spi-s3c64xx.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2009 Samsung Electronics Ltd.
  4. * Jaswinder Singh <jassi.brar@samsung.com>
  5. */
  6. #ifndef __SPI_S3C64XX_H
  7. #define __SPI_S3C64XX_H
  8. #include <linux/dmaengine.h>
  9. struct platform_device;
  10. /**
  11. * struct s3c64xx_spi_csinfo - ChipSelect description
  12. * @fb_delay: Slave specific feedback delay.
  13. * Refer to FB_CLK_SEL register definition in SPI chapter.
  14. * @line: Custom 'identity' of the CS line.
  15. *
  16. * This is per SPI-Slave Chipselect information.
  17. * Allocate and initialize one in machine init code and make the
  18. * spi_board_info.controller_data point to it.
  19. */
  20. struct s3c64xx_spi_csinfo {
  21. u8 fb_delay;
  22. unsigned line;
  23. };
  24. /**
  25. * struct s3c64xx_spi_info - SPI Controller defining structure
  26. * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
  27. * @num_cs: Number of CS this controller emulates.
  28. * @cfg_gpio: Configure pins for this SPI controller.
  29. */
  30. struct s3c64xx_spi_info {
  31. int src_clk_nr;
  32. int num_cs;
  33. bool no_cs;
  34. int (*cfg_gpio)(void);
  35. };
  36. /**
  37. * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
  38. * initialization code.
  39. * @cfg_gpio: Pointer to gpio setup function.
  40. * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
  41. * @num_cs: Number of elements in the 'cs' array.
  42. *
  43. * Call this from machine init code for each SPI Controller that
  44. * has some chips attached to it.
  45. */
  46. extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  47. int num_cs);
  48. extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  49. int num_cs);
  50. extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  51. int num_cs);
  52. /* defined by architecture to configure gpio */
  53. extern int s3c64xx_spi0_cfg_gpio(void);
  54. extern int s3c64xx_spi1_cfg_gpio(void);
  55. extern int s3c64xx_spi2_cfg_gpio(void);
  56. extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
  57. extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
  58. extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
  59. #endif /*__SPI_S3C64XX_H */