I'm using Sitara AM1705 under linux 3.2.2.
Because all I2C pins are used by another functions I decided to use GPIO I2C. I have only one I2C device on this interface: rtc M41T81. So I configured kernel and modified board's init code as follows:
//****************************************************************************
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=y
#
# I2C Algorithms
#
CONFIG_I2C_ALGOBIT=y
# CONFIG_I2C_ALGOPCF is not set
# CONFIG_I2C_ALGOPCA is not set
#
# I2C Hardware Bus support
#
#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
# CONFIG_I2C_DAVINCI is not set
# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
CONFIG_I2C_GPIO=y
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_PCA_PLATFORM is not set
# CONFIG_I2C_PXA_PCI is not set
# CONFIG_I2C_SIMTEC is not set
# CONFIG_I2C_XILINX is not set
//****************************************************************************
static struct i2c_board_info __initdata gpio_i2c_info[] = {
{
I2C_BOARD_INFO("m41t81", 0x68),
},
};
static struct i2c_gpio_platform_data rtc_gpio_i2c_pdata = {
.sda_pin = 40,
.scl_pin = 39,
.udelay = 10, /* 50 kHz */
};
static struct platform_device rtc_gpio_i2c = {
.name = "i2c-gpio",
.id = 0,
.dev = {
.platform_data = &rtc_gpio_i2c_pdata,
},
};
static int __init ....()
{
...
if (platform_device_register(&rtc_gpio_i2c) != 0)
pr_warning("Failed to register i2c-gpio driver\n");
i2c_register_board_info(0, gpio_i2c_info, ARRAY_SIZE(gpio_i2c_info));
...
}
//****************************************************************************
Linux registers these drivers ("i2c-gpio" adapter, "m41t81" driver), but there are no any signals on SDA/SCL pins when device is probed. RTC debug writes "read error" (see below). Preliminarily I also set PINMUX registers for required GPIO pins (before device probing). What did I miss? How to revive bit-banging?
I read this post: "http://e2e.ti.com/support/dsp/omap_applications_processors/f/447/t/200115.aspx"? but couldn't find anything useful about gpio malfunction.