tah.h 2.4 KB

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