ibm_emac_rgmii.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * drivers/net/ibm_emac/ibm_emac_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. #ifndef _IBM_EMAC_RGMII_H_
  21. #define _IBM_EMAC_RGMII_H_
  22. /* RGMII bridge */
  23. struct rgmii_regs {
  24. u32 fer; /* Function enable register */
  25. u32 ssr; /* Speed select register */
  26. };
  27. /* RGMII device */
  28. struct ibm_ocp_rgmii {
  29. struct rgmii_regs __iomem *base;
  30. int users; /* number of EMACs using this RGMII bridge */
  31. };
  32. #ifdef CONFIG_IBM_EMAC_RGMII
  33. int rgmii_attach(void *emac) __init;
  34. void __rgmii_fini(struct ocp_device *ocpdev, int input) __exit;
  35. static inline void rgmii_fini(struct ocp_device *ocpdev, int input)
  36. {
  37. if (ocpdev)
  38. __rgmii_fini(ocpdev, input);
  39. }
  40. void rgmii_set_speed(struct ocp_device *ocpdev, int input, int speed);
  41. int __rgmii_get_regs_len(struct ocp_device *ocpdev);
  42. static inline int rgmii_get_regs_len(struct ocp_device *ocpdev)
  43. {
  44. return ocpdev ? __rgmii_get_regs_len(ocpdev) : 0;
  45. }
  46. void *rgmii_dump_regs(struct ocp_device *ocpdev, void *buf);
  47. #else
  48. # define rgmii_attach(x) 0
  49. # define rgmii_fini(x,y) ((void)0)
  50. # define rgmii_set_speed(x,y,z) ((void)0)
  51. # define rgmii_get_regs_len(x) 0
  52. # define rgmii_dump_regs(x,buf) (buf)
  53. #endif /* !CONFIG_IBM_EMAC_RGMII */
  54. #endif /* _IBM_EMAC_RGMII_H_ */