Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137232
b: refs/heads/master
c: b8b19b0
h: refs/heads/master
v: v3
  • Loading branch information
Sascha Hauer committed Mar 13, 2009
1 parent 20b7e8f commit 9aa3a1d
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a4e9a65a1f90e94eca3af1a69b42d039054ef9de
refs/heads/master: b8b19b0d1c2d9ede8a3f8b9f609fd66cf5ede057
63 changes: 63 additions & 0 deletions trunk/arch/arm/mach-mx1/mx1ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mtd/physmap.h>
#include <linux/i2c.h>
#include <linux/i2c/pcf857x.h>

#include <asm/mach-types.h>
#include <asm/mach/arch.h>
Expand All @@ -24,6 +26,10 @@
#include <mach/hardware.h>
#include <mach/common.h>
#include <mach/imx-uart.h>
#include <mach/irqs.h>
#ifdef CONFIG_I2C_IMX
#include <mach/i2c.h>
#endif
#include <mach/iomux.h>
#include "devices.h"

Expand Down Expand Up @@ -103,6 +109,55 @@ static struct platform_device flash_device = {
.num_resources = 1,
};

/*
* I2C
*/

#ifdef CONFIG_I2C_IMX
static int i2c_pins[] = {
PA15_PF_I2C_SDA,
PA16_PF_I2C_SCL,
};

static int i2c_init(struct device *dev)
{
return mxc_gpio_setup_multiple_pins(i2c_pins,
ARRAY_SIZE(i2c_pins), "I2C");
}

static void i2c_exit(struct device *dev)
{
mxc_gpio_release_multiple_pins(i2c_pins,
ARRAY_SIZE(i2c_pins));
}

static struct pcf857x_platform_data pcf857x_data[] = {
{
.gpio_base = 4 * 32,
}, {
.gpio_base = 4 * 32 + 16,
}
};

static struct imxi2c_platform_data mx1ads_i2c_data = {
.bitrate = 100000,
.init = i2c_init,
.exit = i2c_exit,
};

static struct i2c_board_info mx1ads_i2c_devices[] = {
{
I2C_BOARD_INFO("pcf857x", 0x22),
.type = "pcf8575",
.platform_data = &pcf857x_data[0],
}, {
I2C_BOARD_INFO("pcf857x", 0x24),
.type = "pcf8575",
.platform_data = &pcf857x_data[1],
},
};
#endif

/*
* Board init
*/
Expand All @@ -114,6 +169,14 @@ static void __init mx1ads_init(void)

/* Physmap flash */
mxc_register_device(&flash_device, &mx1ads_flash_data);

/* I2C */
#ifdef CONFIG_I2C_IMX
i2c_register_board_info(0, mx1ads_i2c_devices,
ARRAY_SIZE(mx1ads_i2c_devices));

mxc_register_device(&imx_i2c_device, &mx1ads_i2c_data);
#endif
}

static void __init mx1ads_timer_init(void)
Expand Down

0 comments on commit 9aa3a1d

Please sign in to comment.