xref: /OK3568_Linux_fs/kernel/include/linux/platform_data/i2c-s3c2410.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright 2004-2009 Simtec Electronics
4*4882a593Smuzhiyun  *	Ben Dooks <ben@simtec.co.uk>
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * S3C - I2C Controller platform_device info
7*4882a593Smuzhiyun */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef __I2C_S3C2410_H
10*4882a593Smuzhiyun #define __I2C_S3C2410_H __FILE__
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #define S3C_IICFLG_FILTER	(1<<0)	/* enable s3c2440 filter */
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun struct platform_device;
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun /**
17*4882a593Smuzhiyun  *	struct s3c2410_platform_i2c - Platform data for s3c I2C.
18*4882a593Smuzhiyun  *	@bus_num: The bus number to use (if possible).
19*4882a593Smuzhiyun  *	@flags: Any flags for the I2C bus (E.g. S3C_IICFLK_FILTER).
20*4882a593Smuzhiyun  *	@slave_addr: The I2C address for the slave device (if enabled).
21*4882a593Smuzhiyun  *	@frequency: The desired frequency in Hz of the bus.  This is
22*4882a593Smuzhiyun  *                  guaranteed to not be exceeded.  If the caller does
23*4882a593Smuzhiyun  *                  not care, use zero and the driver will select a
24*4882a593Smuzhiyun  *                  useful default.
25*4882a593Smuzhiyun  *	@sda_delay: The delay (in ns) applied to SDA edges.
26*4882a593Smuzhiyun  *	@cfg_gpio: A callback to configure the pins for I2C operation.
27*4882a593Smuzhiyun  */
28*4882a593Smuzhiyun struct s3c2410_platform_i2c {
29*4882a593Smuzhiyun 	int		bus_num;
30*4882a593Smuzhiyun 	unsigned int	flags;
31*4882a593Smuzhiyun 	unsigned int	slave_addr;
32*4882a593Smuzhiyun 	unsigned long	frequency;
33*4882a593Smuzhiyun 	unsigned int	sda_delay;
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun 	void	(*cfg_gpio)(struct platform_device *dev);
36*4882a593Smuzhiyun };
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun /**
39*4882a593Smuzhiyun  * s3c_i2c0_set_platdata - set platform data for i2c0 device
40*4882a593Smuzhiyun  * @i2c: The platform data to set, or NULL for default data.
41*4882a593Smuzhiyun  *
42*4882a593Smuzhiyun  * Register the given platform data for use with the i2c0 device. This
43*4882a593Smuzhiyun  * call copies the platform data, so the caller can use __initdata for
44*4882a593Smuzhiyun  * their copy.
45*4882a593Smuzhiyun  *
46*4882a593Smuzhiyun  * This call will set cfg_gpio if is null to the default platform
47*4882a593Smuzhiyun  * implementation.
48*4882a593Smuzhiyun  *
49*4882a593Smuzhiyun  * Any user of s3c_device_i2c0 should call this, even if it is with
50*4882a593Smuzhiyun  * NULL to ensure that the device is given the default platform data
51*4882a593Smuzhiyun  * as the driver will no longer carry defaults.
52*4882a593Smuzhiyun  */
53*4882a593Smuzhiyun extern void s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *i2c);
54*4882a593Smuzhiyun extern void s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *i2c);
55*4882a593Smuzhiyun extern void s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *i2c);
56*4882a593Smuzhiyun extern void s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *i2c);
57*4882a593Smuzhiyun extern void s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *i2c);
58*4882a593Smuzhiyun extern void s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *i2c);
59*4882a593Smuzhiyun extern void s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *i2c);
60*4882a593Smuzhiyun extern void s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *i2c);
61*4882a593Smuzhiyun extern void s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *i2c);
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun /* defined by architecture to configure gpio */
64*4882a593Smuzhiyun extern void s3c_i2c0_cfg_gpio(struct platform_device *dev);
65*4882a593Smuzhiyun extern void s3c_i2c1_cfg_gpio(struct platform_device *dev);
66*4882a593Smuzhiyun extern void s3c_i2c2_cfg_gpio(struct platform_device *dev);
67*4882a593Smuzhiyun extern void s3c_i2c3_cfg_gpio(struct platform_device *dev);
68*4882a593Smuzhiyun extern void s3c_i2c4_cfg_gpio(struct platform_device *dev);
69*4882a593Smuzhiyun extern void s3c_i2c5_cfg_gpio(struct platform_device *dev);
70*4882a593Smuzhiyun extern void s3c_i2c6_cfg_gpio(struct platform_device *dev);
71*4882a593Smuzhiyun extern void s3c_i2c7_cfg_gpio(struct platform_device *dev);
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun extern struct s3c2410_platform_i2c default_i2c_data;
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun #endif /* __I2C_S3C2410_H */
76