blob: 5c1e21c8727080d40ac03fe3af96b3e2f5a5e9c1 [file] [log] [blame]
Sachin Kamat963eb4b2014-02-14 12:26:17 +05301/*
Jassi Brar398cccc2010-01-18 17:45:52 +09002 * 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
Sachin Kamat963eb4b2014-02-14 12:26:17 +053010#ifndef __SPI_S3C64XX_H
11#define __SPI_S3C64XX_H
Jassi Brar398cccc2010-01-18 17:45:52 +090012
Arnd Bergmann78843722013-04-11 22:42:03 +020013#include <linux/dmaengine.h>
14
Mark Brown5b0b34e2011-12-29 18:01:08 +090015struct platform_device;
16
Jassi Brar398cccc2010-01-18 17:45:52 +090017/**
18 * struct s3c64xx_spi_csinfo - ChipSelect description
19 * @fb_delay: Slave specific feedback delay.
20 * Refer to FB_CLK_SEL register definition in SPI chapter.
21 * @line: Custom 'identity' of the CS line.
Jassi Brar398cccc2010-01-18 17:45:52 +090022 *
23 * This is per SPI-Slave Chipselect information.
24 * Allocate and initialize one in machine init code and make the
25 * spi_board_info.controller_data point to it.
26 */
27struct s3c64xx_spi_csinfo {
28 u8 fb_delay;
29 unsigned line;
Jassi Brar398cccc2010-01-18 17:45:52 +090030};
31
32/**
33 * struct s3c64xx_spi_info - SPI Controller defining structure
34 * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
Jassi Brar398cccc2010-01-18 17:45:52 +090035 * @num_cs: Number of CS this controller emulates.
36 * @cfg_gpio: Configure pins for this SPI controller.
Jassi Brar398cccc2010-01-18 17:45:52 +090037 */
38struct s3c64xx_spi_info {
39 int src_clk_nr;
Jassi Brar398cccc2010-01-18 17:45:52 +090040 int num_cs;
Andi Shytia92e7c32016-06-28 11:41:12 +090041 bool no_cs;
Thomas Abraham868dee92012-07-13 07:15:14 +090042 int (*cfg_gpio)(void);
Arnd Bergmann78843722013-04-11 22:42:03 +020043 dma_filter_fn filter;
Arnd Bergmanna0067db2015-11-18 15:21:32 +010044 void *dma_tx;
45 void *dma_rx;
Jassi Brar398cccc2010-01-18 17:45:52 +090046};
47
48/**
Padmavathi Venna875a5932011-12-23 10:14:31 +090049 * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
Jassi Brar398cccc2010-01-18 17:45:52 +090050 * initialization code.
Thomas Abraham4d0efdd2012-07-13 07:15:14 +090051 * @cfg_gpio: Pointer to gpio setup function.
Jassi Brar398cccc2010-01-18 17:45:52 +090052 * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
53 * @num_cs: Number of elements in the 'cs' array.
54 *
55 * Call this from machine init code for each SPI Controller that
56 * has some chips attached to it.
57 */
Thomas Abraham4d0efdd2012-07-13 07:15:14 +090058extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
59 int num_cs);
60extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
61 int num_cs);
62extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
63 int num_cs);
Padmavathi Venna4566c7f2011-12-23 10:14:36 +090064
65/* defined by architecture to configure gpio */
Thomas Abraham868dee92012-07-13 07:15:14 +090066extern int s3c64xx_spi0_cfg_gpio(void);
67extern int s3c64xx_spi1_cfg_gpio(void);
68extern int s3c64xx_spi2_cfg_gpio(void);
Padmavathi Venna4566c7f2011-12-23 10:14:36 +090069
70extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
71extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
Padmavathi Venna323d7712011-12-23 10:14:45 +090072extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
Sachin Kamat963eb4b2014-02-14 12:26:17 +053073#endif /*__SPI_S3C64XX_H */