Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 313127
b: refs/heads/master
c: 661d414
h: refs/heads/master
i:
  313125: e235de5
  313123: 95f5762
  313119: da2123d
v: v3
  • Loading branch information
Linus Walleij committed Jun 10, 2012
1 parent 126381e commit fe9b48d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a31bd28e86ac50eb620f6b5b36464c45b5fa38f
refs/heads/master: 661d414cb4492590f70f01c29212213947aea364
38 changes: 31 additions & 7 deletions trunk/arch/arm/mach-nomadik/i2c-8815nhk.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,43 @@
#include <linux/i2c-gpio.h>
#include <linux/platform_device.h>
#include <plat/gpio-nomadik.h>
#include <plat/pincfg.h>

/*
* There are two busses in the 8815NHK.
* They could, in theory, be driven by the hardware component, but we
* use bit-bang through GPIO by now, to keep things simple
*/

/* I2C0 connected to the STw4811 power management chip */
static struct i2c_gpio_platform_data nhk8815_i2c_data0 = {
/* keep defaults for timeouts; pins are push-pull bidirectional */
.scl_pin = 62,
.sda_pin = 63,
};

/* I2C1 connected to various sensors */
static struct i2c_gpio_platform_data nhk8815_i2c_data1 = {
/* keep defaults for timeouts; pins are push-pull bidirectional */
.scl_pin = 53,
.sda_pin = 54,
};

/* first bus: GPIO XX and YY */
/* I2C2 connected to the USB portions of the STw4811 only */
static struct i2c_gpio_platform_data nhk8815_i2c_data2 = {
/* keep defaults for timeouts; pins are push-pull bidirectional */
.scl_pin = 73,
.sda_pin = 74,
};

static struct platform_device nhk8815_i2c_dev0 = {
.name = "i2c-gpio",
.id = 0,
.dev = {
.platform_data = &nhk8815_i2c_data0,
},
};
/* second bus: GPIO XX and YY */

static struct platform_device nhk8815_i2c_dev1 = {
.name = "i2c-gpio",
.id = 1,
Expand All @@ -41,15 +50,29 @@ static struct platform_device nhk8815_i2c_dev1 = {
},
};

static struct platform_device nhk8815_i2c_dev2 = {
.name = "i2c-gpio",
.id = 2,
.dev = {
.platform_data = &nhk8815_i2c_data2,
},
};

static pin_cfg_t cpu8815_pins_i2c[] = {
PIN_CFG_INPUT(62, GPIO, PULLUP),
PIN_CFG_INPUT(63, GPIO, PULLUP),
PIN_CFG_INPUT(53, GPIO, PULLUP),
PIN_CFG_INPUT(54, GPIO, PULLUP),
PIN_CFG_INPUT(73, GPIO, PULLUP),
PIN_CFG_INPUT(74, GPIO, PULLUP),
};

static int __init nhk8815_i2c_init(void)
{
nmk_gpio_set_mode(nhk8815_i2c_data0.scl_pin, NMK_GPIO_ALT_GPIO);
nmk_gpio_set_mode(nhk8815_i2c_data0.sda_pin, NMK_GPIO_ALT_GPIO);
nmk_config_pins(cpu8815_pins_i2c, ARRAY_SIZE(cpu8815_pins_i2c));
platform_device_register(&nhk8815_i2c_dev0);

nmk_gpio_set_mode(nhk8815_i2c_data1.scl_pin, NMK_GPIO_ALT_GPIO);
nmk_gpio_set_mode(nhk8815_i2c_data1.sda_pin, NMK_GPIO_ALT_GPIO);
platform_device_register(&nhk8815_i2c_dev1);
platform_device_register(&nhk8815_i2c_dev2);

return 0;
}
Expand All @@ -58,6 +81,7 @@ static void __exit nhk8815_i2c_exit(void)
{
platform_device_unregister(&nhk8815_i2c_dev0);
platform_device_unregister(&nhk8815_i2c_dev1);
platform_device_unregister(&nhk8815_i2c_dev2);
return;
}

Expand Down

0 comments on commit fe9b48d

Please sign in to comment.