s3c64xx-spi.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. 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. * @set_level: CS line control.
  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. void (*set_level)(unsigned line_id, int lvl);
  28. };
  29. /**
  30. * struct s3c64xx_spi_info - SPI Controller defining structure
  31. * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
  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. bool clk_from_cmu;
  44. int num_cs;
  45. int (*cfg_gpio)(struct platform_device *pdev);
  46. /* Following two fields are for future compatibility */
  47. int fifo_lvl_mask;
  48. int rx_lvl_offset;
  49. int high_speed;
  50. int tx_st_done;
  51. };
  52. /**
  53. * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
  54. * initialization code.
  55. * @pd: SPI platform data to set.
  56. * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
  57. * @num_cs: Number of elements in the 'cs' array.
  58. *
  59. * Call this from machine init code for each SPI Controller that
  60. * has some chips attached to it.
  61. */
  62. extern void s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd,
  63. int src_clk_nr, int num_cs);
  64. extern void s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd,
  65. int src_clk_nr, int num_cs);
  66. extern void s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd,
  67. int src_clk_nr, int num_cs);
  68. /* defined by architecture to configure gpio */
  69. extern int s3c64xx_spi0_cfg_gpio(struct platform_device *dev);
  70. extern int s3c64xx_spi1_cfg_gpio(struct platform_device *dev);
  71. extern int s3c64xx_spi2_cfg_gpio(struct platform_device *dev);
  72. extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
  73. extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
  74. extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
  75. #endif /* __S3C64XX_PLAT_SPI_H */