spi-s3c64xx.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2009 Samsung Electronics Ltd.
  3. * Jaswinder Singh <jassi.brar@samsung.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #ifndef __SPI_S3C64XX_H
  10. #define __SPI_S3C64XX_H
  11. #include <linux/dmaengine.h>
  12. struct platform_device;
  13. /**
  14. * struct s3c64xx_spi_csinfo - ChipSelect description
  15. * @fb_delay: Slave specific feedback delay.
  16. * Refer to FB_CLK_SEL register definition in SPI chapter.
  17. * @line: Custom 'identity' of the CS line.
  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. };
  27. /**
  28. * struct s3c64xx_spi_info - SPI Controller defining structure
  29. * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
  30. * @num_cs: Number of CS this controller emulates.
  31. * @cfg_gpio: Configure pins for this SPI controller.
  32. */
  33. struct s3c64xx_spi_info {
  34. int src_clk_nr;
  35. int num_cs;
  36. bool no_cs;
  37. int (*cfg_gpio)(void);
  38. dma_filter_fn filter;
  39. void *dma_tx;
  40. void *dma_rx;
  41. };
  42. /**
  43. * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
  44. * initialization code.
  45. * @cfg_gpio: Pointer to gpio setup function.
  46. * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
  47. * @num_cs: Number of elements in the 'cs' array.
  48. *
  49. * Call this from machine init code for each SPI Controller that
  50. * has some chips attached to it.
  51. */
  52. extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  53. int num_cs);
  54. extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  55. int num_cs);
  56. extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  57. int num_cs);
  58. /* defined by architecture to configure gpio */
  59. extern int s3c64xx_spi0_cfg_gpio(void);
  60. extern int s3c64xx_spi1_cfg_gpio(void);
  61. extern int s3c64xx_spi2_cfg_gpio(void);
  62. extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
  63. extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
  64. extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
  65. #endif /*__SPI_S3C64XX_H */