Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / net / ibm_emac / ibm_emac_rgmii.h
index 49f188f..7f03d53 100644 (file)
@@ -1,5 +1,7 @@
 /*
- * Defines for the IBM RGMII bridge
+ * drivers/net/ibm_emac/ibm_emac_rgmii.c
+ *
+ * Driver for PowerPC 4xx on-chip ethernet controller, RGMII bridge support.
  *
  * Based on ocp_zmii.h/ibm_emac_zmii.h
  * Armin Kuster akuster@mvista.com
@@ -7,6 +9,9 @@
  * Copyright 2004 MontaVista Software, Inc.
  * Matt Porter <mporter@kernel.crashing.org>
  *
+ * Copyright (c) 2004, 2005 Zultys Technologies.
+ * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
+ *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
  * Free Software Foundation;  either version 2 of the  License, or (at your
 #include <linux/config.h>
 
 /* RGMII bridge */
-typedef struct rgmii_regs {
+struct rgmii_regs {
        u32 fer;                /* Function enable register */
        u32 ssr;                /* Speed select register */
-} rgmii_t;
-
-#define RGMII_INPUTS                   4
+};
 
 /* RGMII device */
 struct ibm_ocp_rgmii {
-       struct rgmii_regs *base;
-       int mode[RGMII_INPUTS];
+       struct rgmii_regs __iomem *base;
        int users;              /* number of EMACs using this RGMII bridge */
 };
 
-/* Fuctional Enable Reg */
-#define RGMII_FER_MASK(x)              (0x00000007 << (4*x))
-#define RGMII_RTBI                     0x00000004
-#define RGMII_RGMII                    0x00000005
-#define RGMII_TBI                      0x00000006
-#define RGMII_GMII                     0x00000007
-
-/* Speed Selection reg */
+#ifdef CONFIG_IBM_EMAC_RGMII
+int rgmii_attach(void *emac) __init;
 
-#define RGMII_SP2_100  0x00000002
-#define RGMII_SP2_1000 0x00000004
-#define RGMII_SP3_100  0x00000200
-#define RGMII_SP3_1000 0x00000400
+void __rgmii_fini(struct ocp_device *ocpdev, int input) __exit;
+static inline void rgmii_fini(struct ocp_device *ocpdev, int input)
+{
+       if (ocpdev)
+               __rgmii_fini(ocpdev, input);
+}
 
-#define RGMII_MII2_SPDMASK      0x00000007
-#define RGMII_MII3_SPDMASK      0x00000700
+void rgmii_set_speed(struct ocp_device *ocpdev, int input, int speed);
 
-#define RGMII_MII2_100MB        RGMII_SP2_100 & ~RGMII_SP2_1000
-#define RGMII_MII2_1000MB       RGMII_SP2_1000 & ~RGMII_SP2_100
-#define RGMII_MII2_10MB                 ~(RGMII_SP2_100 | RGMII_SP2_1000)
-#define RGMII_MII3_100MB        RGMII_SP3_100 & ~RGMII_SP3_1000
-#define RGMII_MII3_1000MB       RGMII_SP3_1000 & ~RGMII_SP3_100
-#define RGMII_MII3_10MB                 ~(RGMII_SP3_100 | RGMII_SP3_1000)
+int __rgmii_get_regs_len(struct ocp_device *ocpdev);
+static inline int rgmii_get_regs_len(struct ocp_device *ocpdev)
+{
+       return ocpdev ? __rgmii_get_regs_len(ocpdev) : 0;
+}
 
-#define RTBI           0
-#define RGMII          1
-#define TBI            2
-#define GMII           3
+void *rgmii_dump_regs(struct ocp_device *ocpdev, void *buf);
+#else
+# define rgmii_attach(x)       0
+# define rgmii_fini(x,y)       ((void)0)
+# define rgmii_set_speed(x,y,z)        ((void)0)
+# define rgmii_get_regs_len(x) 0
+# define rgmii_dump_regs(x,buf)        (buf)
+#endif                         /* !CONFIG_IBM_EMAC_RGMII */
 
 #endif                         /* _IBM_EMAC_RGMII_H_ */