diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-08-22 23:56:01 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:52 -0400 |
commit | 1d3bb996481e116f5f2b127cbd29b83365d2cf62 (patch) | |
tree | b612a1dbf51c920fb5a9758a6d35f9ed37eb927f /drivers/net/ibm_newemac/rgmii.h | |
parent | 03233b90b0977d577322a6e1ddd56d9cc570d406 (diff) |
Device tree aware EMAC driver
Based on BenH's earlier work, this is a new version of the EMAC driver
for the built-in ethernet found on PowerPC 4xx embedded CPUs. The
same ASIC is also found in the Axon bridge chip. This new version is
designed to work in the arch/powerpc tree, using the device tree to
probe the device, rather than the old and ugly arch/ppc OCP layer.
This driver is designed to sit alongside the old driver (that lies in
drivers/net/ibm_emac and this one in drivers/net/ibm_newemac). The
old driver is left in place to support arch/ppc until arch/ppc itself
reaches its final demise (not too long now, with luck).
This driver still has a number of things that could do with cleaning
up, but I think they can be fixed up after merging. Specifically:
- Should be adjusted to properly use the dma mapping API.
Axon needs this.
- Probe logic needs reworking, in conjuction with the general
probing code for of_platform devices. The dependencies here between
EMAC, MAL, ZMII etc. make this complicated. At present, it usually
works, because we initialize and register the sub-drivers before the
EMAC driver itself, and (being in driver code) runs after the devices
themselves have been instantiated from the device tree.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ibm_newemac/rgmii.h')
-rw-r--r-- | drivers/net/ibm_newemac/rgmii.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/drivers/net/ibm_newemac/rgmii.h b/drivers/net/ibm_newemac/rgmii.h new file mode 100644 index 000000000000..57806833121e --- /dev/null +++ b/drivers/net/ibm_newemac/rgmii.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * drivers/net/ibm_newemac/rgmii.h | ||
3 | * | ||
4 | * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support. | ||
5 | * | ||
6 | * Based on ocp_zmii.h/ibm_emac_zmii.h | ||
7 | * Armin Kuster akuster@mvista.com | ||
8 | * | ||
9 | * Copyright 2004 MontaVista Software, Inc. | ||
10 | * Matt Porter <mporter@kernel.crashing.org> | ||
11 | * | ||
12 | * Copyright (c) 2004, 2005 Zultys Technologies. | ||
13 | * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the | ||
17 | * Free Software Foundation; either version 2 of the License, or (at your | ||
18 | * option) any later version. | ||
19 | */ | ||
20 | |||
21 | #ifndef __IBM_NEWEMAC_RGMII_H | ||
22 | #define __IBM_NEWEMAC_RGMII_H | ||
23 | |||
24 | /* RGMII bridge type */ | ||
25 | #define RGMII_STANDARD 0 | ||
26 | #define RGMII_AXON 1 | ||
27 | |||
28 | /* RGMII bridge */ | ||
29 | struct rgmii_regs { | ||
30 | u32 fer; /* Function enable register */ | ||
31 | u32 ssr; /* Speed select register */ | ||
32 | }; | ||
33 | |||
34 | /* RGMII device */ | ||
35 | struct rgmii_instance { | ||
36 | struct rgmii_regs __iomem *base; | ||
37 | |||
38 | /* Type of RGMII bridge */ | ||
39 | int type; | ||
40 | |||
41 | /* Only one EMAC whacks us at a time */ | ||
42 | struct mutex lock; | ||
43 | |||
44 | /* number of EMACs using this RGMII bridge */ | ||
45 | int users; | ||
46 | |||
47 | /* OF device instance */ | ||
48 | struct of_device *ofdev; | ||
49 | }; | ||
50 | |||
51 | #ifdef CONFIG_IBM_NEW_EMAC_RGMII | ||
52 | |||
53 | extern int rgmii_init(void); | ||
54 | extern void rgmii_exit(void); | ||
55 | extern int rgmii_attach(struct of_device *ofdev, int input, int mode); | ||
56 | extern void rgmii_detach(struct of_device *ofdev, int input); | ||
57 | extern void rgmii_get_mdio(struct of_device *ofdev, int input); | ||
58 | extern void rgmii_put_mdio(struct of_device *ofdev, int input); | ||
59 | extern void rgmii_set_speed(struct of_device *ofdev, int input, int speed); | ||
60 | extern int rgmii_get_regs_len(struct of_device *ofdev); | ||
61 | extern void *rgmii_dump_regs(struct of_device *ofdev, void *buf); | ||
62 | |||
63 | #else | ||
64 | |||
65 | # define rgmii_init() 0 | ||
66 | # define rgmii_exit() do { } while(0) | ||
67 | # define rgmii_attach(x,y,z) (-ENXIO) | ||
68 | # define rgmii_detach(x,y) do { } while(0) | ||
69 | # define rgmii_get_mdio(o,i) do { } while (0) | ||
70 | # define rgmii_put_mdio(o,i) do { } while (0) | ||
71 | # define rgmii_set_speed(x,y,z) do { } while(0) | ||
72 | # define rgmii_get_regs_len(x) 0 | ||
73 | # define rgmii_dump_regs(x,buf) (buf) | ||
74 | #endif /* !CONFIG_IBM_NEW_EMAC_RGMII */ | ||
75 | |||
76 | #endif /* __IBM_NEWEMAC_RGMII_H */ | ||