zmii.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * drivers/net/ethernet/ibm/emac/zmii.h
  4. *
  5. * Driver for PowerPC 4xx on-chip ethernet controller, ZMII bridge support.
  6. *
  7. * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  8. * <benh@kernel.crashing.org>
  9. *
  10. * Based on the arch/ppc version of the driver:
  11. *
  12. * Copyright (c) 2004, 2005 Zultys Technologies.
  13. * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
  14. *
  15. * Based on original work by
  16. * Armin Kuster <akuster@mvista.com>
  17. * Copyright 2001 MontaVista Softare Inc.
  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 platform_device *ofdev;
  40. };
  41. #ifdef CONFIG_IBM_EMAC_ZMII
  42. int zmii_init(void);
  43. void zmii_exit(void);
  44. int zmii_attach(struct platform_device *ofdev, int input, int *mode);
  45. void zmii_detach(struct platform_device *ofdev, int input);
  46. void zmii_get_mdio(struct platform_device *ofdev, int input);
  47. void zmii_put_mdio(struct platform_device *ofdev, int input);
  48. void zmii_set_speed(struct platform_device *ofdev, int input, int speed);
  49. int zmii_get_regs_len(struct platform_device *ocpdev);
  50. void *zmii_dump_regs(struct platform_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_EMAC_ZMII */
  62. #endif /* __IBM_NEWEMAC_ZMII_H */