spear_smi.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright © 2010 ST Microelectronics
  3. * Shiraz Hashim <shiraz.linux.kernel@gmail.com>
  4. *
  5. * This file is licensed under the terms of the GNU General Public
  6. * License version 2. This program is licensed "as is" without any
  7. * warranty of any kind, whether express or implied.
  8. */
  9. #ifndef __MTD_SPEAR_SMI_H
  10. #define __MTD_SPEAR_SMI_H
  11. #include <linux/types.h>
  12. #include <linux/mtd/mtd.h>
  13. #include <linux/mtd/partitions.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/of.h>
  16. /* max possible slots for serial-nor flash chip in the SMI controller */
  17. #define MAX_NUM_FLASH_CHIP 4
  18. /* macro to define partitions for flash devices */
  19. #define DEFINE_PARTS(n, of, s) \
  20. { \
  21. .name = n, \
  22. .offset = of, \
  23. .size = s, \
  24. }
  25. /**
  26. * struct spear_smi_flash_info - platform structure for passing flash
  27. * information
  28. *
  29. * name: name of the serial nor flash for identification
  30. * mem_base: the memory base on which the flash is mapped
  31. * size: size of the flash in bytes
  32. * partitions: parition details
  33. * nr_partitions: number of partitions
  34. * fast_mode: whether flash supports fast mode
  35. */
  36. struct spear_smi_flash_info {
  37. char *name;
  38. unsigned long mem_base;
  39. unsigned long size;
  40. struct mtd_partition *partitions;
  41. int nr_partitions;
  42. u8 fast_mode;
  43. };
  44. /**
  45. * struct spear_smi_plat_data - platform structure for configuring smi
  46. *
  47. * clk_rate: clk rate at which SMI must operate
  48. * num_flashes: number of flashes present on board
  49. * board_flash_info: specific details of each flash present on board
  50. */
  51. struct spear_smi_plat_data {
  52. unsigned long clk_rate;
  53. int num_flashes;
  54. struct spear_smi_flash_info *board_flash_info;
  55. struct device_node *np[MAX_NUM_FLASH_CHIP];
  56. };
  57. #endif /* __MTD_SPEAR_SMI_H */