zmii.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * drivers/net/ethernet/ibm/emac/zmii.h
  3. *
  4. * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support.
  5. *
  6. * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  7. * <benh@kernel.crashing.org>
  8. *
  9. * Based on the arch/ppc version of the driver:
  10. *
  11. * Copyright (c) 2004, 2005 Zultys Technologies.
  12. * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
  13. *
  14. * Based on original work by
  15. * Armin Kuster <akuster@mvista.com>
  16. * Copyright 2001 MontaVista Softare Inc.
  17. *
  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.
  22. *
  23. */
  24. #ifndef __IBM_NEWEMAC_ZMII_H
  25. #define __IBM_NEWEMAC_ZMII_H
  26. /* ZMII bridge registers */
  27. struct zmii_regs {
  28. u32 fer; /* Function enable reg */
  29. u32 ssr; /* Speed select reg */
  30. u32 smiirs; /* SMII status reg */
  31. };
  32. /* ZMII device */
  33. struct zmii_instance {
  34. struct zmii_regs __iomem *base;
  35. /* Only one EMAC whacks us at a time */
  36. struct mutex lock;
  37. /* subset of PHY_MODE_XXXX */
  38. int mode;
  39. /* number of EMACs using this ZMII bridge */
  40. int users;
  41. /* FER value left by firmware */
  42. u32 fer_save;
  43. /* OF device instance */
  44. struct platform_device *ofdev;
  45. };
  46. #ifdef CONFIG_IBM_EMAC_ZMII
  47. int zmii_init(void);
  48. void zmii_exit(void);
  49. int zmii_attach(struct platform_device *ofdev, int input, int *mode);
  50. void zmii_detach(struct platform_device *ofdev, int input);
  51. void zmii_get_mdio(struct platform_device *ofdev, int input);
  52. void zmii_put_mdio(struct platform_device *ofdev, int input);
  53. void zmii_set_speed(struct platform_device *ofdev, int input, int speed);
  54. int zmii_get_regs_len(struct platform_device *ocpdev);
  55. void *zmii_dump_regs(struct platform_device *ofdev, void *buf);
  56. #else
  57. # define zmii_init() 0
  58. # define zmii_exit() do { } while(0)
  59. # define zmii_attach(x,y,z) (-ENXIO)
  60. # define zmii_detach(x,y) do { } while(0)
  61. # define zmii_get_mdio(x,y) do { } while(0)
  62. # define zmii_put_mdio(x,y) do { } while(0)
  63. # define zmii_set_speed(x,y,z) do { } while(0)
  64. # define zmii_get_regs_len(x) 0
  65. # define zmii_dump_regs(x,buf) (buf)
  66. #endif /* !CONFIG_IBM_EMAC_ZMII */
  67. #endif /* __IBM_NEWEMAC_ZMII_H */