s3c64xx-spi.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* linux/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
  2. *
  3. * Copyright (C) 2009 Samsung Electronics Ltd.
  4. * Jaswinder Singh <jassi.brar@samsung.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 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __S3C64XX_PLAT_SPI_H
  11. #define __S3C64XX_PLAT_SPI_H
  12. /**
  13. * struct s3c64xx_spi_csinfo - ChipSelect description
  14. * @fb_delay: Slave specific feedback delay.
  15. * Refer to FB_CLK_SEL register definition in SPI chapter.
  16. * @line: Custom 'identity' of the CS line.
  17. * @set_level: CS line control.
  18. *
  19. * This is per SPI-Slave Chipselect information.
  20. * Allocate and initialize one in machine init code and make the
  21. * spi_board_info.controller_data point to it.
  22. */
  23. struct s3c64xx_spi_csinfo {
  24. u8 fb_delay;
  25. unsigned line;
  26. void (*set_level)(unsigned line_id, int lvl);
  27. };
  28. /**
  29. * struct s3c64xx_spi_info - SPI Controller defining structure
  30. * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
  31. * @src_clk_name: Platform name of the corresponding clock.
  32. * @clk_from_cmu: If the SPI clock/prescalar control block is present
  33. * by the platform's clock-management-unit and not in SPI controller.
  34. * @num_cs: Number of CS this controller emulates.
  35. * @cfg_gpio: Configure pins for this SPI controller.
  36. * @fifo_lvl_mask: All tx fifo_lvl fields start at offset-6
  37. * @rx_lvl_offset: Depends on tx fifo_lvl field and bus number
  38. * @high_speed: If the controller supports HIGH_SPEED_EN bit
  39. * @tx_st_done: Depends on tx fifo_lvl field
  40. */
  41. struct s3c64xx_spi_info {
  42. int src_clk_nr;
  43. char *src_clk_name;
  44. bool clk_from_cmu;
  45. int num_cs;
  46. int (*cfg_gpio)(struct platform_device *pdev);
  47. /* Following two fields are for future compatibility */
  48. int fifo_lvl_mask;
  49. int rx_lvl_offset;
  50. int high_speed;
  51. int tx_st_done;
  52. };
  53. /**
  54. * s3c64xx_spi_set_info - SPI Controller configure callback by the board
  55. * initialization code.
  56. * @cntrlr: SPI controller number the configuration is for.
  57. * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
  58. * @num_cs: Number of elements in the 'cs' array.
  59. *
  60. * Call this from machine init code for each SPI Controller that
  61. * has some chips attached to it.
  62. */
  63. extern void s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
  64. extern void s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
  65. extern void s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
  66. extern void s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
  67. #endif /* __S3C64XX_PLAT_SPI_H */