zmii.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * drivers/net/ibm_newemac/zmii.h
  3. *
  4. * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support.
  5. *
  6. * Copyright (c) 2004, 2005 Zultys Technologies.
  7. * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
  8. *
  9. * Based on original work by
  10. * Armin Kuster <akuster@mvista.com>
  11. * Copyright 2001 MontaVista Softare Inc.
  12. *
  13. * This program is free software; you can redistribute it and/or modify it
  14. * under the terms of the GNU General Public License as published by the
  15. * Free Software Foundation; either version 2 of the License, or (at your
  16. * option) any later version.
  17. *
  18. */
  19. #ifndef __IBM_NEWEMAC_ZMII_H
  20. #define __IBM_NEWEMAC_ZMII_H
  21. /* ZMII bridge registers */
  22. struct zmii_regs {
  23. u32 fer; /* Function enable reg */
  24. u32 ssr; /* Speed select reg */
  25. u32 smiirs; /* SMII status reg */
  26. };
  27. /* ZMII device */
  28. struct zmii_instance {
  29. struct zmii_regs __iomem *base;
  30. /* Only one EMAC whacks us at a time */
  31. struct mutex lock;
  32. /* subset of PHY_MODE_XXXX */
  33. int mode;
  34. /* number of EMACs using this ZMII bridge */
  35. int users;
  36. /* FER value left by firmware */
  37. u32 fer_save;
  38. /* OF device instance */
  39. struct of_device *ofdev;
  40. };
  41. #ifdef CONFIG_IBM_NEW_EMAC_ZMII
  42. extern int zmii_init(void);
  43. extern void zmii_exit(void);
  44. extern int zmii_attach(struct of_device *ofdev, int input, int *mode);
  45. extern void zmii_detach(struct of_device *ofdev, int input);
  46. extern void zmii_get_mdio(struct of_device *ofdev, int input);
  47. extern void zmii_put_mdio(struct of_device *ofdev, int input);
  48. extern void zmii_set_speed(struct of_device *ofdev, int input, int speed);
  49. extern int zmii_get_regs_len(struct of_device *ocpdev);
  50. extern void *zmii_dump_regs(struct of_device *ofdev, void *buf);
  51. #else
  52. # define zmii_init() 0
  53. # define zmii_exit() do { } while(0)
  54. # define zmii_attach(x,y,z) (-ENXIO)
  55. # define zmii_detach(x,y) do { } while(0)
  56. # define zmii_get_mdio(x,y) do { } while(0)
  57. # define zmii_put_mdio(x,y) do { } while(0)
  58. # define zmii_set_speed(x,y,z) do { } while(0)
  59. # define zmii_get_regs_len(x) 0
  60. # define zmii_dump_regs(x,buf) (buf)
  61. #endif /* !CONFIG_IBM_NEW_EMAC_ZMII */
  62. #endif /* __IBM_NEWEMAC_ZMII_H */