tah.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * drivers/net/ibm_newemac/tah.h
  3. *
  4. * Driver for PowerPC 4xx on-chip ethernet controller, TAH support.
  5. *
  6. * Copyright 2004 MontaVista Software, Inc.
  7. * Matt Porter <mporter@kernel.crashing.org>
  8. *
  9. * Copyright (c) 2005 Eugene Surovegin <ebs@ebshome.net>
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the
  13. * Free Software Foundation; either version 2 of the License, or (at your
  14. * option) any later version.
  15. */
  16. #ifndef __IBM_NEWEMAC_TAH_H
  17. #define __IBM_NEWEMAC_TAH_H
  18. /* TAH */
  19. struct tah_regs {
  20. u32 revid;
  21. u32 pad[3];
  22. u32 mr;
  23. u32 ssr0;
  24. u32 ssr1;
  25. u32 ssr2;
  26. u32 ssr3;
  27. u32 ssr4;
  28. u32 ssr5;
  29. u32 tsr;
  30. };
  31. /* TAH device */
  32. struct tah_instance {
  33. struct tah_regs __iomem *base;
  34. /* Only one EMAC whacks us at a time */
  35. struct mutex lock;
  36. /* number of EMACs using this TAH */
  37. int users;
  38. /* OF device instance */
  39. struct of_device *ofdev;
  40. };
  41. /* TAH engine */
  42. #define TAH_MR_CVR 0x80000000
  43. #define TAH_MR_SR 0x40000000
  44. #define TAH_MR_ST_256 0x01000000
  45. #define TAH_MR_ST_512 0x02000000
  46. #define TAH_MR_ST_768 0x03000000
  47. #define TAH_MR_ST_1024 0x04000000
  48. #define TAH_MR_ST_1280 0x05000000
  49. #define TAH_MR_ST_1536 0x06000000
  50. #define TAH_MR_TFS_16KB 0x00000000
  51. #define TAH_MR_TFS_2KB 0x00200000
  52. #define TAH_MR_TFS_4KB 0x00400000
  53. #define TAH_MR_TFS_6KB 0x00600000
  54. #define TAH_MR_TFS_8KB 0x00800000
  55. #define TAH_MR_TFS_10KB 0x00a00000
  56. #define TAH_MR_DTFP 0x00100000
  57. #define TAH_MR_DIG 0x00080000
  58. #ifdef CONFIG_IBM_NEW_EMAC_TAH
  59. extern int tah_init(void);
  60. extern void tah_exit(void);
  61. extern int tah_attach(struct of_device *ofdev, int channel);
  62. extern void tah_detach(struct of_device *ofdev, int channel);
  63. extern void tah_reset(struct of_device *ofdev);
  64. extern int tah_get_regs_len(struct of_device *ofdev);
  65. extern void *tah_dump_regs(struct of_device *ofdev, void *buf);
  66. #else
  67. # define tah_init() 0
  68. # define tah_exit() do { } while(0)
  69. # define tah_attach(x,y) (-ENXIO)
  70. # define tah_detach(x,y) do { } while(0)
  71. # define tah_reset(x) do { } while(0)
  72. # define tah_get_regs_len(x) 0
  73. # define tah_dump_regs(x,buf) (buf)
  74. #endif /* !CONFIG_IBM_NEW_EMAC_TAH */
  75. #endif /* __IBM_NEWEMAC_TAH_H */