spi-s3c64xx.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #include <linux/dmaengine.h>
  13. struct platform_device;
  14. /**
  15. * struct s3c64xx_spi_csinfo - ChipSelect description
  16. * @fb_delay: Slave specific feedback delay.
  17. * Refer to FB_CLK_SEL register definition in SPI chapter.
  18. * @line: Custom 'identity' of the CS line.
  19. *
  20. * This is per SPI-Slave Chipselect information.
  21. * Allocate and initialize one in machine init code and make the
  22. * spi_board_info.controller_data point to it.
  23. */
  24. struct s3c64xx_spi_csinfo {
  25. u8 fb_delay;
  26. unsigned line;
  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. * @num_cs: Number of CS this controller emulates.
  32. * @cfg_gpio: Configure pins for this SPI controller.
  33. */
  34. struct s3c64xx_spi_info {
  35. int src_clk_nr;
  36. int num_cs;
  37. int (*cfg_gpio)(void);
  38. dma_filter_fn filter;
  39. };
  40. /**
  41. * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
  42. * initialization code.
  43. * @cfg_gpio: Pointer to gpio setup function.
  44. * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
  45. * @num_cs: Number of elements in the 'cs' array.
  46. *
  47. * Call this from machine init code for each SPI Controller that
  48. * has some chips attached to it.
  49. */
  50. extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  51. int num_cs);
  52. extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  53. int num_cs);
  54. extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
  55. int num_cs);
  56. /* defined by architecture to configure gpio */
  57. extern int s3c64xx_spi0_cfg_gpio(void);
  58. extern int s3c64xx_spi1_cfg_gpio(void);
  59. extern int s3c64xx_spi2_cfg_gpio(void);
  60. extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
  61. extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
  62. extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
  63. #endif /* __S3C64XX_PLAT_SPI_H */