Andi Shyti | 78b5d70 | 2017-12-14 15:28:27 +0900 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | |
Sachin Kamat | 963eb4b | 2014-02-14 12:26:17 +0530 | [diff] [blame] | 3 | /* |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 4 | * Copyright (C) 2009 Samsung Electronics Ltd. |
| 5 | * Jaswinder Singh <jassi.brar@samsung.com> |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 6 | */ |
| 7 | |
Sachin Kamat | 963eb4b | 2014-02-14 12:26:17 +0530 | [diff] [blame] | 8 | #ifndef __SPI_S3C64XX_H |
| 9 | #define __SPI_S3C64XX_H |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 10 | |
Arnd Bergmann | 7884372 | 2013-04-11 22:42:03 +0200 | [diff] [blame] | 11 | #include <linux/dmaengine.h> |
| 12 | |
Mark Brown | 5b0b34e | 2011-12-29 18:01:08 +0900 | [diff] [blame] | 13 | struct platform_device; |
| 14 | |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 15 | /** |
| 16 | * struct s3c64xx_spi_csinfo - ChipSelect description |
| 17 | * @fb_delay: Slave specific feedback delay. |
| 18 | * Refer to FB_CLK_SEL register definition in SPI chapter. |
| 19 | * @line: Custom 'identity' of the CS line. |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 20 | * |
| 21 | * This is per SPI-Slave Chipselect information. |
| 22 | * Allocate and initialize one in machine init code and make the |
| 23 | * spi_board_info.controller_data point to it. |
| 24 | */ |
| 25 | struct s3c64xx_spi_csinfo { |
| 26 | u8 fb_delay; |
| 27 | unsigned line; |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | /** |
| 31 | * struct s3c64xx_spi_info - SPI Controller defining structure |
| 32 | * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field. |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 33 | * @num_cs: Number of CS this controller emulates. |
| 34 | * @cfg_gpio: Configure pins for this SPI controller. |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 35 | */ |
| 36 | struct s3c64xx_spi_info { |
| 37 | int src_clk_nr; |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 38 | int num_cs; |
Andi Shyti | a92e7c3 | 2016-06-28 11:41:12 +0900 | [diff] [blame] | 39 | bool no_cs; |
Thomas Abraham | 868dee9 | 2012-07-13 07:15:14 +0900 | [diff] [blame] | 40 | int (*cfg_gpio)(void); |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | /** |
Padmavathi Venna | 875a593 | 2011-12-23 10:14:31 +0900 | [diff] [blame] | 44 | * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 45 | * initialization code. |
Thomas Abraham | 4d0efdd | 2012-07-13 07:15:14 +0900 | [diff] [blame] | 46 | * @cfg_gpio: Pointer to gpio setup function. |
Jassi Brar | 398cccc | 2010-01-18 17:45:52 +0900 | [diff] [blame] | 47 | * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks. |
| 48 | * @num_cs: Number of elements in the 'cs' array. |
| 49 | * |
| 50 | * Call this from machine init code for each SPI Controller that |
| 51 | * has some chips attached to it. |
| 52 | */ |
Thomas Abraham | 4d0efdd | 2012-07-13 07:15:14 +0900 | [diff] [blame] | 53 | extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
| 54 | int num_cs); |
| 55 | extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
| 56 | int num_cs); |
| 57 | extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
| 58 | int num_cs); |
Padmavathi Venna | 4566c7f | 2011-12-23 10:14:36 +0900 | [diff] [blame] | 59 | |
| 60 | /* defined by architecture to configure gpio */ |
Thomas Abraham | 868dee9 | 2012-07-13 07:15:14 +0900 | [diff] [blame] | 61 | extern int s3c64xx_spi0_cfg_gpio(void); |
| 62 | extern int s3c64xx_spi1_cfg_gpio(void); |
| 63 | extern int s3c64xx_spi2_cfg_gpio(void); |
Padmavathi Venna | 4566c7f | 2011-12-23 10:14:36 +0900 | [diff] [blame] | 64 | |
| 65 | extern struct s3c64xx_spi_info s3c64xx_spi0_pdata; |
| 66 | extern struct s3c64xx_spi_info s3c64xx_spi1_pdata; |
Padmavathi Venna | 323d771 | 2011-12-23 10:14:45 +0900 | [diff] [blame] | 67 | extern struct s3c64xx_spi_info s3c64xx_spi2_pdata; |
Sachin Kamat | 963eb4b | 2014-02-14 12:26:17 +0530 | [diff] [blame] | 68 | #endif /*__SPI_S3C64XX_H */ |