blob: 05af66b840b95aad0dbd42ca42ec2b6e1bd62b26 [file] [log] [blame]
Sachin Kamatcd5006d2014-02-14 12:01:30 +05301/*
Ben Dooksccae9412009-11-13 22:54:14 +00002 * Copyright 2004-2009 Simtec Electronics
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * Ben Dooks <ben@simtec.co.uk>
4 *
Daniel Silverstonec564e6a2009-03-13 13:53:46 +00005 * S3C - I2C Controller platform_device info
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
Linus Torvalds1da177e2005-04-16 15:20:36 -070010*/
11
Sachin Kamatcd5006d2014-02-14 12:01:30 +053012#ifndef __I2C_S3C2410_H
13#define __I2C_S3C2410_H __FILE__
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
15#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */
16
Arnd Bergmannb2dc0c22013-02-13 23:08:18 +010017struct platform_device;
18
Daniel Silverstonec564e6a2009-03-13 13:53:46 +000019/**
20 * struct s3c2410_platform_i2c - Platform data for s3c I2C.
21 * @bus_num: The bus number to use (if possible).
22 * @flags: Any flags for the I2C bus (E.g. S3C_IICFLK_FILTER).
23 * @slave_addr: The I2C address for the slave device (if enabled).
24 * @frequency: The desired frequency in Hz of the bus. This is
25 * guaranteed to not be exceeded. If the caller does
26 * not care, use zero and the driver will select a
27 * useful default.
28 * @sda_delay: The delay (in ns) applied to SDA edges.
29 * @cfg_gpio: A callback to configure the pins for I2C operation.
30 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070031struct s3c2410_platform_i2c {
Daniel Silverstonec564e6a2009-03-13 13:53:46 +000032 int bus_num;
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 unsigned int flags;
Daniel Silverstonec564e6a2009-03-13 13:53:46 +000034 unsigned int slave_addr;
35 unsigned long frequency;
36 unsigned int sda_delay;
Ben Dooks3e1b7762008-10-31 16:14:40 +000037
38 void (*cfg_gpio)(struct platform_device *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039};
40
Ben Dooks3e1b7762008-10-31 16:14:40 +000041/**
42 * s3c_i2c0_set_platdata - set platform data for i2c0 device
43 * @i2c: The platform data to set, or NULL for default data.
44 *
45 * Register the given platform data for use with the i2c0 device. This
46 * call copies the platform data, so the caller can use __initdata for
47 * their copy.
48 *
49 * This call will set cfg_gpio if is null to the default platform
50 * implementation.
51 *
52 * Any user of s3c_device_i2c0 should call this, even if it is with
53 * NULL to ensure that the device is given the default platform data
54 * as the driver will no longer carry defaults.
55 */
56extern void s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *i2c);
Ben Dooks1aba8342008-10-31 16:14:55 +000057extern void s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *i2c);
Marek Szyprowskic8d833b2010-05-20 08:13:06 +020058extern void s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *i2c);
Kyungmin Parkb7a98252010-10-12 07:49:24 +090059extern void s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *i2c);
60extern void s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *i2c);
61extern void s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *i2c);
62extern void s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *i2c);
63extern void s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *i2c);
Tomasz Stanislawskic40e7e02011-09-16 18:44:36 +090064extern void s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *i2c);
Ben Dooks3e1b7762008-10-31 16:14:40 +000065
66/* defined by architecture to configure gpio */
67extern void s3c_i2c0_cfg_gpio(struct platform_device *dev);
Ben Dooks1aba8342008-10-31 16:14:55 +000068extern void s3c_i2c1_cfg_gpio(struct platform_device *dev);
Marek Szyprowskic8d833b2010-05-20 08:13:06 +020069extern void s3c_i2c2_cfg_gpio(struct platform_device *dev);
Kyungmin Parkb7a98252010-10-12 07:49:24 +090070extern void s3c_i2c3_cfg_gpio(struct platform_device *dev);
71extern void s3c_i2c4_cfg_gpio(struct platform_device *dev);
72extern void s3c_i2c5_cfg_gpio(struct platform_device *dev);
73extern void s3c_i2c6_cfg_gpio(struct platform_device *dev);
74extern void s3c_i2c7_cfg_gpio(struct platform_device *dev);
Ben Dooks3e1b7762008-10-31 16:14:40 +000075
Naveen Krishna Chatradhi696f6fc2011-07-16 13:30:09 +090076extern struct s3c2410_platform_i2c default_i2c_data;
77
Sachin Kamatcd5006d2014-02-14 12:01:30 +053078#endif /* __I2C_S3C2410_H */