Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / drivers / net / ibm_newemac / zmii.h
blob6c9beba0c4b6d6a6a480ce2bad36f48863ce9732
1 /*
2 * drivers/net/ibm_newemac/zmii.h
4 * Driver for PowerPC 4xx on-chip ethernet controller, ZMII 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 * Copyright (c) 2004, 2005 Zultys Technologies.
12 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
14 * Based on original work by
15 * Armin Kuster <akuster@mvista.com>
16 * Copyright 2001 MontaVista Softare Inc.
18 * This program is free software; you can redistribute it and/or modify it
19 * under the terms of the GNU General Public License as published by the
20 * Free Software Foundation; either version 2 of the License, or (at your
21 * option) any later version.
24 #ifndef __IBM_NEWEMAC_ZMII_H
25 #define __IBM_NEWEMAC_ZMII_H
27 /* ZMII bridge registers */
28 struct zmii_regs {
29 u32 fer; /* Function enable reg */
30 u32 ssr; /* Speed select reg */
31 u32 smiirs; /* SMII status reg */
34 /* ZMII device */
35 struct zmii_instance {
36 struct zmii_regs __iomem *base;
38 /* Only one EMAC whacks us at a time */
39 struct mutex lock;
41 /* subset of PHY_MODE_XXXX */
42 int mode;
44 /* number of EMACs using this ZMII bridge */
45 int users;
47 /* FER value left by firmware */
48 u32 fer_save;
50 /* OF device instance */
51 struct of_device *ofdev;
54 #ifdef CONFIG_IBM_NEW_EMAC_ZMII
56 extern int zmii_init(void);
57 extern void zmii_exit(void);
58 extern int zmii_attach(struct of_device *ofdev, int input, int *mode);
59 extern void zmii_detach(struct of_device *ofdev, int input);
60 extern void zmii_get_mdio(struct of_device *ofdev, int input);
61 extern void zmii_put_mdio(struct of_device *ofdev, int input);
62 extern void zmii_set_speed(struct of_device *ofdev, int input, int speed);
63 extern int zmii_get_regs_len(struct of_device *ocpdev);
64 extern void *zmii_dump_regs(struct of_device *ofdev, void *buf);
66 #else
67 # define zmii_init() 0
68 # define zmii_exit() do { } while(0)
69 # define zmii_attach(x,y,z) (-ENXIO)
70 # define zmii_detach(x,y) do { } while(0)
71 # define zmii_get_mdio(x,y) do { } while(0)
72 # define zmii_put_mdio(x,y) do { } while(0)
73 # define zmii_set_speed(x,y,z) do { } while(0)
74 # define zmii_get_regs_len(x) 0
75 # define zmii_dump_regs(x,buf) (buf)
76 #endif /* !CONFIG_IBM_NEW_EMAC_ZMII */
78 #endif /* __IBM_NEWEMAC_ZMII_H */