tah.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * drivers/net/ethernet/ibm/emac/tah.h
  4. *
  5. * Driver for PowerPC 4xx on-chip ethernet controller, TAH support.
  6. *
  7. * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
  8. * <[email protected]>
  9. *
  10. * Based on the arch/ppc version of the driver:
  11. *
  12. * Copyright 2004 MontaVista Software, Inc.
  13. * Matt Porter <[email protected]>
  14. *
  15. * Copyright (c) 2005 Eugene Surovegin <[email protected]>
  16. */
  17. #ifndef __IBM_NEWEMAC_TAH_H
  18. #define __IBM_NEWEMAC_TAH_H
  19. /* TAH */
  20. struct tah_regs {
  21. u32 revid;
  22. u32 pad[3];
  23. u32 mr;
  24. u32 ssr0;
  25. u32 ssr1;
  26. u32 ssr2;
  27. u32 ssr3;
  28. u32 ssr4;
  29. u32 ssr5;
  30. u32 tsr;
  31. };
  32. /* TAH device */
  33. struct tah_instance {
  34. struct tah_regs __iomem *base;
  35. /* Only one EMAC whacks us at a time */
  36. struct mutex lock;
  37. /* number of EMACs using this TAH */
  38. int users;
  39. /* OF device instance */
  40. struct platform_device *ofdev;
  41. };
  42. /* TAH engine */
  43. #define TAH_MR_CVR 0x80000000
  44. #define TAH_MR_SR 0x40000000
  45. #define TAH_MR_ST_256 0x01000000
  46. #define TAH_MR_ST_512 0x02000000
  47. #define TAH_MR_ST_768 0x03000000
  48. #define TAH_MR_ST_1024 0x04000000
  49. #define TAH_MR_ST_1280 0x05000000
  50. #define TAH_MR_ST_1536 0x06000000
  51. #define TAH_MR_TFS_16KB 0x00000000
  52. #define TAH_MR_TFS_2KB 0x00200000
  53. #define TAH_MR_TFS_4KB 0x00400000
  54. #define TAH_MR_TFS_6KB 0x00600000
  55. #define TAH_MR_TFS_8KB 0x00800000
  56. #define TAH_MR_TFS_10KB 0x00a00000
  57. #define TAH_MR_DTFP 0x00100000
  58. #define TAH_MR_DIG 0x00080000
  59. #ifdef CONFIG_IBM_EMAC_TAH
  60. int tah_init(void);
  61. void tah_exit(void);
  62. int tah_attach(struct platform_device *ofdev, int channel);
  63. void tah_detach(struct platform_device *ofdev, int channel);
  64. void tah_reset(struct platform_device *ofdev);
  65. int tah_get_regs_len(struct platform_device *ofdev);
  66. void *tah_dump_regs(struct platform_device *ofdev, void *buf);
  67. #else
  68. # define tah_init() 0
  69. # define tah_exit() do { } while(0)
  70. # define tah_attach(x,y) (-ENXIO)
  71. # define tah_detach(x,y) do { } while(0)
  72. # define tah_reset(x) do { } while(0)
  73. # define tah_get_regs_len(x) 0
  74. # define tah_dump_regs(x,buf) (buf)
  75. #endif /* !CONFIG_IBM_EMAC_TAH */
  76. #endif /* __IBM_NEWEMAC_TAH_H */