spi-fsl-spi.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Freescale SPI controller driver.
  3. *
  4. * Maintainer: Kumar Gala
  5. *
  6. * Copyright (C) 2006 Polycom, Inc.
  7. * Copyright 2010 Freescale Semiconductor, Inc.
  8. *
  9. * CPM SPI and QE buffer descriptors mode support:
  10. * Copyright (c) 2009 MontaVista Software, Inc.
  11. * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify it
  14. * under the terms of the GNU General Public License as published by the
  15. * Free Software Foundation; either version 2 of the License, or (at your
  16. * option) any later version.
  17. */
  18. #ifndef __SPI_FSL_SPI_H__
  19. #define __SPI_FSL_SPI_H__
  20. /* SPI Controller registers */
  21. struct fsl_spi_reg {
  22. u8 res1[0x20];
  23. __be32 mode;
  24. __be32 event;
  25. __be32 mask;
  26. __be32 command;
  27. __be32 transmit;
  28. __be32 receive;
  29. };
  30. /* SPI Controller mode register definitions */
  31. #define SPMODE_LOOP (1 << 30)
  32. #define SPMODE_CI_INACTIVEHIGH (1 << 29)
  33. #define SPMODE_CP_BEGIN_EDGECLK (1 << 28)
  34. #define SPMODE_DIV16 (1 << 27)
  35. #define SPMODE_REV (1 << 26)
  36. #define SPMODE_MS (1 << 25)
  37. #define SPMODE_ENABLE (1 << 24)
  38. #define SPMODE_LEN(x) ((x) << 20)
  39. #define SPMODE_PM(x) ((x) << 16)
  40. #define SPMODE_OP (1 << 14)
  41. #define SPMODE_CG(x) ((x) << 7)
  42. /*
  43. * Default for SPI Mode:
  44. * SPI MODE 0 (inactive low, phase middle, MSB, 8-bit length, slow clk
  45. */
  46. #define SPMODE_INIT_VAL (SPMODE_CI_INACTIVEHIGH | SPMODE_DIV16 | SPMODE_REV | \
  47. SPMODE_MS | SPMODE_LEN(7) | SPMODE_PM(0xf))
  48. /* SPIE register values */
  49. #define SPIE_NE 0x00000200 /* Not empty */
  50. #define SPIE_NF 0x00000100 /* Not full */
  51. /* SPIM register values */
  52. #define SPIM_NE 0x00000200 /* Not empty */
  53. #define SPIM_NF 0x00000100 /* Not full */
  54. #endif /* __SPI_FSL_SPI_H__ */