blob: 8447f634c7f5a142982b1c6fd0121b4219d91d72 [file] [log] [blame]
Jassi Brar398cccc2010-01-18 17:45:52 +09001/* 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
11#ifndef __S3C64XX_PLAT_SPI_H
12#define __S3C64XX_PLAT_SPI_H
13
Arnd Bergmann78843722013-04-11 22:42:03 +020014#include <linux/dmaengine.h>
15
Mark Brown5b0b34e2011-12-29 18:01:08 +090016struct platform_device;
17
Jassi Brar398cccc2010-01-18 17:45:52 +090018/**
19 * struct s3c64xx_spi_csinfo - ChipSelect description
20 * @fb_delay: Slave specific feedback delay.
21 * Refer to FB_CLK_SEL register definition in SPI chapter.
22 * @line: Custom 'identity' of the CS line.
Jassi Brar398cccc2010-01-18 17:45:52 +090023 *
24 * This is per SPI-Slave Chipselect information.
25 * Allocate and initialize one in machine init code and make the
26 * spi_board_info.controller_data point to it.
27 */
28struct s3c64xx_spi_csinfo {
29 u8 fb_delay;
30 unsigned line;
Jassi Brar398cccc2010-01-18 17:45:52 +090031};
32
33/**
34 * struct s3c64xx_spi_info - SPI Controller defining structure
35 * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
Jassi Brar398cccc2010-01-18 17:45:52 +090036 * @num_cs: Number of CS this controller emulates.
37 * @cfg_gpio: Configure pins for this SPI controller.
Jassi Brar398cccc2010-01-18 17:45:52 +090038 */
39struct s3c64xx_spi_info {
40 int src_clk_nr;
Jassi Brar398cccc2010-01-18 17:45:52 +090041 int num_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;
Jassi Brar398cccc2010-01-18 17:45:52 +090044};
45
46/**
Padmavathi Venna875a5932011-12-23 10:14:31 +090047 * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
Jassi Brar398cccc2010-01-18 17:45:52 +090048 * initialization code.
Thomas Abraham4d0efdd2012-07-13 07:15:14 +090049 * @cfg_gpio: Pointer to gpio setup function.
Jassi Brar398cccc2010-01-18 17:45:52 +090050 * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
51 * @num_cs: Number of elements in the 'cs' array.
52 *
53 * Call this from machine init code for each SPI Controller that
54 * has some chips attached to it.
55 */
Thomas Abraham4d0efdd2012-07-13 07:15:14 +090056extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
57 int num_cs);
58extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
59 int num_cs);
60extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
61 int num_cs);
Padmavathi Venna4566c7f2011-12-23 10:14:36 +090062
63/* defined by architecture to configure gpio */
Thomas Abraham868dee92012-07-13 07:15:14 +090064extern int s3c64xx_spi0_cfg_gpio(void);
65extern int s3c64xx_spi1_cfg_gpio(void);
66extern int s3c64xx_spi2_cfg_gpio(void);
Padmavathi Venna4566c7f2011-12-23 10:14:36 +090067
68extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
69extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
Padmavathi Venna323d7712011-12-23 10:14:45 +090070extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
Jassi Brar398cccc2010-01-18 17:45:52 +090071#endif /* __S3C64XX_PLAT_SPI_H */