mcfqspi.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Definitions for Freescale Coldfire QSPI module
  3. *
  4. * Copyright 2010 Steven King <sfking@fdwdc.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2
  8. * as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. */
  20. #ifndef mcfqspi_h
  21. #define mcfqspi_h
  22. #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
  23. #define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340)
  24. #elif defined(CONFIG_M5249)
  25. #define MCFQSPI_IOBASE (MCF_MBAR + 0x300)
  26. #elif defined(CONFIG_M520x) || defined(CONFIG_M532x)
  27. #define MCFQSPI_IOBASE 0xFC058000
  28. #endif
  29. #define MCFQSPI_IOSIZE 0x40
  30. /**
  31. * struct mcfqspi_cs_control - chip select control for the coldfire qspi driver
  32. * @setup: setup the control; allocate gpio's, etc. May be NULL.
  33. * @teardown: finish with the control; free gpio's, etc. May be NULL.
  34. * @select: output the signals to select the device. Can not be NULL.
  35. * @deselect: output the signals to deselect the device. Can not be NULL.
  36. *
  37. * The QSPI module has 4 hardware chip selects. We don't use them. Instead
  38. * platforms are required to supply a mcfqspi_cs_control as a part of the
  39. * platform data for each QSPI master controller. Only the select and
  40. * deselect functions are required.
  41. */
  42. struct mcfqspi_cs_control {
  43. int (*setup)(struct mcfqspi_cs_control *);
  44. void (*teardown)(struct mcfqspi_cs_control *);
  45. void (*select)(struct mcfqspi_cs_control *, u8, bool);
  46. void (*deselect)(struct mcfqspi_cs_control *, u8, bool);
  47. };
  48. /**
  49. * struct mcfqspi_platform_data - platform data for the coldfire qspi driver
  50. * @bus_num: board specific identifier for this qspi driver.
  51. * @num_chipselects: number of chip selects supported by this qspi driver.
  52. * @cs_control: platform dependent chip select control.
  53. */
  54. struct mcfqspi_platform_data {
  55. s16 bus_num;
  56. u16 num_chipselect;
  57. struct mcfqspi_cs_control *cs_control;
  58. };
  59. #endif /* mcfqspi_h */