Merge remote-tracking branch 'moduleh/module.h-split'
[linux-2.6/next.git] / drivers / net / ethernet / ibm / emac / rgmii.h
blob9296b6c5f92054033235c06f1f965c4ddcce648e
1 /*
2 * drivers/net/ibm_newemac/rgmii.h
4 * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support.
6 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
7 * <benh@kernel.crashing.org>
9 * Based on the arch/ppc version of the driver:
11 * Based on ocp_zmii.h/ibm_emac_zmii.h
12 * Armin Kuster akuster@mvista.com
14 * Copyright 2004 MontaVista Software, Inc.
15 * Matt Porter <mporter@kernel.crashing.org>
17 * Copyright (c) 2004, 2005 Zultys Technologies.
18 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
20 * This program is free software; you can redistribute it and/or modify it
21 * under the terms of the GNU General Public License as published by the
22 * Free Software Foundation; either version 2 of the License, or (at your
23 * option) any later version.
26 #ifndef __IBM_NEWEMAC_RGMII_H
27 #define __IBM_NEWEMAC_RGMII_H
29 /* RGMII bridge type */
30 #define RGMII_STANDARD 0
31 #define RGMII_AXON 1
33 /* RGMII bridge */
34 struct rgmii_regs {
35 u32 fer; /* Function enable register */
36 u32 ssr; /* Speed select register */
39 /* RGMII device */
40 struct rgmii_instance {
41 struct rgmii_regs __iomem *base;
43 /* RGMII bridge flags */
44 int flags;
45 #define EMAC_RGMII_FLAG_HAS_MDIO 0x00000001
47 /* Only one EMAC whacks us at a time */
48 struct mutex lock;
50 /* number of EMACs using this RGMII bridge */
51 int users;
53 /* OF device instance */
54 struct platform_device *ofdev;
57 #ifdef CONFIG_IBM_EMAC_RGMII
59 extern int rgmii_init(void);
60 extern void rgmii_exit(void);
61 extern int rgmii_attach(struct platform_device *ofdev, int input, int mode);
62 extern void rgmii_detach(struct platform_device *ofdev, int input);
63 extern void rgmii_get_mdio(struct platform_device *ofdev, int input);
64 extern void rgmii_put_mdio(struct platform_device *ofdev, int input);
65 extern void rgmii_set_speed(struct platform_device *ofdev, int input, int speed);
66 extern int rgmii_get_regs_len(struct platform_device *ofdev);
67 extern void *rgmii_dump_regs(struct platform_device *ofdev, void *buf);
69 #else
71 # define rgmii_init() 0
72 # define rgmii_exit() do { } while(0)
73 # define rgmii_attach(x,y,z) (-ENXIO)
74 # define rgmii_detach(x,y) do { } while(0)
75 # define rgmii_get_mdio(o,i) do { } while (0)
76 # define rgmii_put_mdio(o,i) do { } while (0)
77 # define rgmii_set_speed(x,y,z) do { } while(0)
78 # define rgmii_get_regs_len(x) 0
79 # define rgmii_dump_regs(x,buf) (buf)
80 #endif /* !CONFIG_IBM_EMAC_RGMII */
82 #endif /* __IBM_NEWEMAC_RGMII_H */