Skip to contentSkip to conversation

i2c: Support for Netlogic XLR/XLS on-chip I2C controller.

PATCH In review Jayachandran C. 4 participants 5 messages Jun 23, 2011 – Jul 13, 2011 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: Support for Netlogic XLR/XLS on-chip I2C controller.

From: Ganesan Ramalingam <[email protected]>

- platform.c : add i2c platform device
- i2c-xlr.c : algorithm and i2c adaptor
- Kconfig/Makefile: add CONFIG_I2C_XLR option

---
 arch/mips/configs/nlm_xlr_defconfig |    4 +
 arch/mips/netlogic/xlr/platform.c   |   29 +++
 drivers/i2c/busses/Kconfig          |   11 ++
 drivers/i2c/busses/Makefile         |    1 +
 drivers/i2c/busses/i2c-xlr.c        |  335 +++++++++++++++++++++++++++++++++++
 5 files changed, 380 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/busses/i2c-xlr.c
arch/mips/configs/nlm_xlr_defconfig +4 -0
index e4b399f..6431fd3 100644
@@ -365,6 +365,10 @@ CONFIG_SERIAL_8250_RSA=y
 CONFIG_HW_RANDOM=y
 CONFIG_HW_RANDOM_TIMERIOMEM=m
 CONFIG_RAW_DRIVER=m
+CONFIG_I2C=y
+CONFIG_I2C_XLR=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_DS1374=y
 # CONFIG_HWMON is not set
 # CONFIG_VGA_CONSOLE is not set
 # CONFIG_HID_SUPPORT is not set
arch/mips/netlogic/xlr/platform.c +29 -0
index 609ec25..2cd2d3c 100644
@@ -14,6 +14,7 @@
 #include <linux/resource.h>
 #include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
+#include <linux/i2c.h>
 
 #include <asm/netlogic/xlr/iomap.h>
 #include <asm/netlogic/xlr/pic.h>
@@ -66,6 +67,34 @@ void nlm_xlr_uart_out(struct uart_port *p, int offset, int value)
 		.serial_out	= nlm_xlr_uart_out,	\
 	}
 
+#ifdef CONFIG_I2C
+static struct i2c_board_info nlm_i2c_info1[] __initdata = {
+	/* All XLR boards have this RTC and Max6657 Temp Chip */
+	{"ds1374",          0, 0x68, 0, 0, 0},
+	{"lm90",            0, 0x4c, 0, 0, 0},
+};
+
+static struct platform_device nlm_xlr_i2c_1 = {
+	.name           = "xlr_i2cbus",
+	.id             = 1,
+};
+
+static int __init nlm_i2c_init(void)
+{
+	int err = 0;
+
+	platform_device_register(&nlm_xlr_i2c_1);
+
+	err = i2c_register_board_info(1, nlm_i2c_info1,
+				ARRAY_SIZE(nlm_i2c_info1));
+	if (err < 0)
+		pr_err("nlm-i2c: cannot register board I2C devices\n");
+	return err;
+}
+
+arch_initcall(nlm_i2c_init);
+#endif
+
 static struct plat_serial8250_port xlr_uart_data[] = {
 	PORT(PIC_UART_0_IRQ),
 	PORT(PIC_UART_1_IRQ),
drivers/i2c/busses/Kconfig +11 -0
index 646068e..a75af78 100644
@@ -309,6 +309,17 @@ config I2C_AU1550
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-au1550.
 
+config I2C_XLR
+	tristate "XLR I2C support"
+	depends on I2C && CPU_XLR
+	help
+	  This driver enables support for the on-chip I2C interface of
+	  the Netlogic XLR/XLS MIPS processors.
+
+	  Say yes to this option if you have a Netlogic XLR/XLS based
+	  board and you need to access the I2C devices (typically the
+	  RTC, sensors, EEPROM) connected to this interface.
+
 config I2C_BLACKFIN_TWI
 	tristate "Blackfin TWI I2C support"
 	depends on BLACKFIN
drivers/i2c/busses/Makefile +1 -0
index e6cf294..14e7a76 100644
@@ -65,6 +65,7 @@ obj-$(CONFIG_I2C_TEGRA)		+= i2c-tegra.o
 obj-$(CONFIG_I2C_VERSATILE)	+= i2c-versatile.o
 obj-$(CONFIG_I2C_OCTEON)	+= i2c-octeon.o
 obj-$(CONFIG_I2C_XILINX)	+= i2c-xiic.o
+obj-$(CONFIG_I2C_XLR)           += i2c-xlr.o
 obj-$(CONFIG_I2C_EG20T)         += i2c-eg20t.o
 
 # External I2C/SMBus adapter drivers
drivers/i2c/busses/i2c-xlr.c new file +335 -0

335 lines not on this page · raw message

Signature · 1 line
1.7.4.1

A message that is not in the archive (sent off-list or not yet received): 20110623135057.GA26772-l4W0uAg2RDvWG0bvociYJ/An/[email protected]

#2 lore raw
Quoted 5 lines · Jayachandran C.
 arch/mips/configs/nlm_xlr_defconfig |    4 +
 arch/mips/netlogic/xlr/platform.c   |   29 +++
 drivers/i2c/busses/Kconfig          |   11 ++
 drivers/i2c/busses/Makefile         |    1 +
 drivers/i2c/busses/i2c-xlr.c        |  335 +++++++++++++++++++++++++++++++++++

Normally the arch/mips code would be split out from the driver patch.

drivers/i2c/busses/Kconfig config I2C_AU1550 · line 314

Quoted 3 lines
drivers/i2c/busses/Kconfig +3 -0
+config I2C_XLR
+	tristate "XLR I2C support"
+	depends on I2C && CPU_XLR

No need to depend on I2C in the I2C drivers directory.

drivers/i2c/busses/i2c-xlr.c line 53

Quoted 4 lines
drivers/i2c/busses/i2c-xlr.c new file +4 -0
+struct xlr_i2c_private {
+	struct i2c_adapter adap;
+	u32 *iobase_i2c_regs;
+};

Should there be an __iomem in there?

Quoted 1 line

+static struct xlr_i2c_private xlr_i2c_priv;

This shouldn't be static data, it should be allocated per device.

drivers/i2c/busses/i2c-xlr.c line 65

Quoted 10 lines
drivers/i2c/busses/i2c-xlr.c new file +10 -0
+u32 *get_i2c_base(unsigned short bus)
+{
+	nlm_reg_t *mmio = 0;
+
+	if (bus == 0)
+		mmio = netlogic_io_mmio(NETLOGIC_IO_I2C_0_OFFSET);
+	else
+		mmio = netlogic_io_mmio(NETLOGIC_IO_I2C_1_OFFSET);
+
+	return (u32 *)mmio;

Functions like this should be static, though in this case the memory region should be passed in as a resource rather than being embedded in the driver.

Quoted 7 lines
drivers/i2c/busses/i2c-xlr.c new file +7 -0
+	while (1) {
+		i2c_status = xlr_i2c_read(priv->iobase_i2c_regs,
+				XLR_I2C_STATUS);
+
+		if (i2c_status & XLR_I2C_SDOEMPTY) {
+			pos++;
+			nb = (pos < len) ? buf[pos] : 0;

drivers/i2c/busses/i2c-xlr.c line 113

Quoted 10 lines
drivers/i2c/busses/i2c-xlr.c new file +10 -0
+			xlr_i2c_write(priv->iobase_i2c_regs, XLR_I2C_DATAOUT,
+					nb);
+		}
+
+		if (i2c_status & XLR_I2C_ARB_STARTERR)
+			goto retry;
+
+		if (i2c_status & XLR_I2C_ACK_ERR) {
+			dev_err(&priv->adap.dev, "ACK ERR\n");
+			return -1;

Return a proper error code, not -1.

drivers/i2c/busses/i2c-xlr.c line 117

Quoted 4 lines
drivers/i2c/busses/i2c-xlr.c new file +4 -0
+		}
+
+		if (i2c_status & XLR_I2C_BUS_BUSY)
+			continue;

This is going to loop infinitely if the bus locks up for some reason. There should be some limit on how long we try for. It also looks like we're busy waiting here which isn't terribly good.

drivers/i2c/busses/i2c-xlr.c line 296

Quoted 7 lines
drivers/i2c/busses/i2c-xlr.c new file +7 -0
+static int __devinit xlr_i2c_probe(struct platform_device *pd)
+{
+	xlr_i2c_priv.iobase_i2c_regs = get_i2c_base(pd->id);
+
+	xlr_i2c_priv.adap.dev.parent = &pd->dev;
+	if (xlr_i2c_add_bus(&xlr_i2c_priv) < 0) {
+		dev_err(&xlr_i2c_priv.adap.dev, "Failed to add i2c bus\n");

You should return the error you get.

drivers/i2c/busses/i2c-xlr.c line 299

Quoted 2 lines
drivers/i2c/busses/i2c-xlr.c new file +2 -0
+	} else
+		dev_info(&xlr_i2c_priv.adap.dev, "Added I2C Bus.\n");

This seems needlessly chatty.

Quoted 1 line

+MODULE_AUTHOR("Netlogic Microsystems Inc.");

This should generally be a person.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Mark,

Thanks for the review!

Quoted 9 lines · Mark Brown
Quoted 5 lines · Jayachandran C.
 arch/mips/configs/nlm_xlr_defconfig |    4 +
 arch/mips/netlogic/xlr/platform.c   |   29 +++
 drivers/i2c/busses/Kconfig          |   11 ++
 drivers/i2c/busses/Makefile         |    1 +
 drivers/i2c/busses/i2c-xlr.c        |  335 +++++++++++++++++++++++++++++++++++

Normally the arch/mips code would be split out from the driver patch.

This can be made to two patches, but obviously the MIPS code can go in only after the driver goes in, so it is better that both goes thru the linux-i2c.

Quoted 6 lines

drivers/i2c/busses/Kconfig config I2C_AU1550 · line 314

Quoted 4 lines
drivers/i2c/busses/Kconfig +3 -0
+config I2C_XLR
+	tristate "XLR I2C support"
+	depends on I2C && CPU_XLR

No need to depend on I2C in the I2C drivers directory.

Ok.

Quoted 11 lines

drivers/i2c/busses/i2c-xlr.c line 53

Quoted 5 lines
drivers/i2c/busses/i2c-xlr.c new file +4 -0
+struct xlr_i2c_private {
+	struct i2c_adapter adap;
+	u32 *iobase_i2c_regs;
+};

Should there be an __iomem in there?

Quoted 1 line

+static struct xlr_i2c_private xlr_i2c_priv;

This shouldn't be static data, it should be allocated per device.

True.

Quoted 15 lines

drivers/i2c/busses/i2c-xlr.c line 65

Quoted 11 lines
drivers/i2c/busses/i2c-xlr.c new file +10 -0
+u32 *get_i2c_base(unsigned short bus)
+{
+	nlm_reg_t *mmio = 0;
+
+	if (bus == 0)
+		mmio = netlogic_io_mmio(NETLOGIC_IO_I2C_0_OFFSET);
+	else
+		mmio = netlogic_io_mmio(NETLOGIC_IO_I2C_1_OFFSET);
+
+	return (u32 *)mmio;

Functions like this should be static, though in this case the memory region should be passed in as a resource rather than being embedded in the driver.

Since it is a SoC device, the address will not change at all. But yes, the right way is to use the platform_device resource pointer for this.

Quoted 20 lines
Quoted 7 lines
drivers/i2c/busses/i2c-xlr.c new file +7 -0
+	while (1) {
+		i2c_status = xlr_i2c_read(priv->iobase_i2c_regs,
+				XLR_I2C_STATUS);
+
+		if (i2c_status & XLR_I2C_SDOEMPTY) {
+			pos++;
+			nb = (pos < len) ? buf[pos] : 0;

drivers/i2c/busses/i2c-xlr.c line 113

Quoted 10 lines
drivers/i2c/busses/i2c-xlr.c new file +10 -0
+			xlr_i2c_write(priv->iobase_i2c_regs, XLR_I2C_DATAOUT,
+					nb);
+		}
+
+		if (i2c_status & XLR_I2C_ARB_STARTERR)
+			goto retry;
+
+		if (i2c_status & XLR_I2C_ACK_ERR) {
+			dev_err(&priv->adap.dev, "ACK ERR\n");
+			return -1;

Return a proper error code, not -1.

Quoted 8 lines

drivers/i2c/busses/i2c-xlr.c line 117

Quoted 4 lines
drivers/i2c/busses/i2c-xlr.c new file +4 -0
+		}
+
+		if (i2c_status & XLR_I2C_BUS_BUSY)
+			continue;

This is going to loop infinitely if the bus locks up for some reason. There should be some limit on how long we try for. It also looks like we're busy waiting here which isn't terribly good.

Can add a udelay here, and a loop count.

Quoted 10 lines

drivers/i2c/busses/i2c-xlr.c line 296

Quoted 7 lines
drivers/i2c/busses/i2c-xlr.c new file +7 -0
+static int __devinit xlr_i2c_probe(struct platform_device *pd)
+{
+	xlr_i2c_priv.iobase_i2c_regs = get_i2c_base(pd->id);
+
+	xlr_i2c_priv.adap.dev.parent = &pd->dev;
+	if (xlr_i2c_add_bus(&xlr_i2c_priv) < 0) {
+		dev_err(&xlr_i2c_priv.adap.dev, "Failed to add i2c bus\n");

You should return the error you get.

Quoted 8 lines

drivers/i2c/busses/i2c-xlr.c line 299

Quoted 2 lines
drivers/i2c/busses/i2c-xlr.c new file +2 -0
+	} else
+		dev_info(&xlr_i2c_priv.adap.dev, "Added I2C Bus.\n");

This seems needlessly chatty.

Quoted 1 line

+MODULE_AUTHOR("Netlogic Microsystems Inc.");

This should generally be a person.

Will make the changes and re-submit.

Thanks,
JC.

A message that is not in the archive (sent off-list or not yet received): 20110711070202.GB31303-l4W0uAg2RDvWG0bvociYJ/An/[email protected]

#6 lore raw
Quoted 8 lines · Jayachandran C.
Quoted 6 lines · Mark Brown
Quoted 4 lines · Jayachandran C.
drivers/i2c/busses/i2c-xlr.c new file +4 -0
+	if (bus == 0)
+		mmio = netlogic_io_mmio(NETLOGIC_IO_I2C_0_OFFSET);
+	else
+		mmio = netlogic_io_mmio(NETLOGIC_IO_I2C_1_OFFSET);
Quoted 8 lines
Quoted 5 lines

drivers/i2c/busses/i2c-xlr.c line 65

Quoted 1 line
drivers/i2c/busses/i2c-xlr.c new file +1 -0
+	return (u32 *)mmio;

Functions like this should be static, though in this case the memory region should be passed in as a resource rather than being embedded in the driver.

Since it is a SoC device, the address will not change at all. But yes, the right way is to use the platform_device resource pointer for this.

That doesn't follow at all - while the address won't change for a particular SoC the same IP may be used in multiple SoCs.

Quoted 5 lines
Quoted 3 lines

This is going to loop infinitely if the bus locks up for some reason. There should be some limit on how long we try for. It also looks like we're busy waiting here which isn't terribly good.

Can add a udelay here, and a loop count.

udelay() still busy waits, and I2C transactions take a *long* time.

#7 lore raw
In reply to a message not in the archive
Quoted 9 lines · Jayachandran C.

From: Ganesan Ramalingam <ganesanr-oSioyQM9ZPnuBjGU1YDckgC/[email protected]>

- platform.c : add i2c platform device
- i2c-xlr.c : algorithm and i2c adaptor
- Kconfig/Makefile: add CONFIG_I2C_XLR option

---

snip

Quoted 13 lines
arch/mips/netlogic/xlr/platform.c +1 -0
index 609ec25..2cd2d3c 100644
@@ -14,6 +14,7 @@
 #include <linux/resource.h>
 #include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
+#include <linux/i2c.h>
 
 #include <asm/netlogic/xlr/iomap.h>
 #include <asm/netlogic/xlr/pic.h>

arch/mips/netlogic/xlr/platform.c void nlm_xlr_uart_out(struct uart_port *p, int offset, int value) · line 75

Quoted 9 lines
arch/mips/netlogic/xlr/platform.c +6 -0
@@ -66,6 +67,34 @@ void nlm_xlr_uart_out(struct uart_port *p, int offset, int value)
 		.serial_out	= nlm_xlr_uart_out,	\
 	}
 
+#ifdef CONFIG_I2C
+static struct i2c_board_info nlm_i2c_info1[] __initdata = {
+	/* All XLR boards have this RTC and Max6657 Temp Chip */
+	{"ds1374",          0, 0x68, 0, 0, 0},
+	{"lm90",            0, 0x4c, 0, 0, 0},
+};

- named initialisers, or even the I2C_BOARD_INFO()
- no need to have the fields initialiser with 0 after the address.
- spaces betwee { and }

Quoted 51 lines
arch/mips/netlogic/xlr/platform.c +0 -0
 config I2C_BLACKFIN_TWI
 	tristate "Blackfin TWI I2C support"
 	depends on BLACKFIN

new file mode 100644
index 0000000..ac3d989

drivers/i2c/busses/i2c-xlr.c new file +42 -0
@@ -0,0 +1,335 @@
+/*
+ * Copyright 2011, Netlogic Microsystems Inc.
+ * Copyright 2004, Matt Porter <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
+#include <linux/i2c.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <asm/netlogic/xlr/iomap.h>
+
+/* XLR I2C REGISTERS */
+#define XLR_I2C_CFG		0x00
+#define XLR_I2C_CLKDIV		0x01
+#define XLR_I2C_DEVADDR		0x02
+#define XLR_I2C_ADDR		0x03
+#define XLR_I2C_DATAOUT		0x04
+#define XLR_I2C_DATAIN		0x05
+#define XLR_I2C_STATUS		0x06
+#define XLR_I2C_STARTXFR	0x07
+#define XLR_I2C_BYTECNT		0x08
+#define XLR_I2C_HDSTATIM	0x09
+
+/* XLR I2C REGISTERS FLAGS */
+#define XLR_I2C_BUS_BUSY	0x01
+#define XLR_I2C_SDOEMPTY	0x02
+#define XLR_I2C_RXRDY		0x04
+#define XLR_I2C_ACK_ERR		0x08
+#define XLR_I2C_ARB_STARTERR	0x30
+
+/* Register Programming Values!! Change as required */
+#define XLR_I2C_CFG_ADDR	0xF8    /* 8-Bit dev Addr + POR Values */

drivers/i2c/busses/i2c-xlr.c line 52

Quoted 10 lines
drivers/i2c/busses/i2c-xlr.c new file +10 -0
+#define XLR_I2C_CFG_NOADDR	0xFA    /* 8-Bit reg Addr + POR Values */
+#define XLR_I2C_STARTXFR_ND	0x02    /* No data , only addr */
+#define XLR_I2C_STARTXFR_RD	0x01    /* Read */
+#define XLR_I2C_STARTXFR_WR	0x00    /* Write */
+#define XLR_I2C_CLKDIV_DEF	0x14A   /* 0x00000052 */
+#define XLR_I2C_HDSTATIM_DEF	0x107   /* 0x00000000 */
+
+struct xlr_i2c_private {
+	struct i2c_adapter adap;
+	u32 *iobase_i2c_regs;

this should at-least be __iomem attributed

Quoted 4 lines
drivers/i2c/busses/i2c-xlr.c new file +4 -0
+};
+static struct xlr_i2c_private  xlr_i2c_priv;
+
+u32 *get_i2c_base(unsigned short bus)

drivers/i2c/busses/i2c-xlr.c line 66

Quoted 10 lines
drivers/i2c/busses/i2c-xlr.c new file +10 -0
+{
+	nlm_reg_t *mmio = 0;
+
+	if (bus == 0)
+		mmio = netlogic_io_mmio(NETLOGIC_IO_I2C_0_OFFSET);
+	else
+		mmio = netlogic_io_mmio(NETLOGIC_IO_I2C_1_OFFSET);
+
+	return (u32 *)mmio;
+}

shouldn't this be in with the platform device?

drivers/i2c/busses/i2c-xlr.c line 71

Quoted 4 lines
drivers/i2c/busses/i2c-xlr.c new file +4 -0
+static void xlr_i2c_write(u32 *iobase_i2c_regs, int reg, int val)
+{
+	netlogic_write_reg(iobase_i2c_regs, reg, val);
+}

did you really need to wrapper these functions?

Quoted 50 lines
drivers/i2c/busses/i2c-xlr.c new file +49 -0
+static u32 xlr_i2c_read(u32 *iobase_i2c_regs, int reg)
+{
+	u32 retVal = netlogic_read_reg(iobase_i2c_regs, reg);
+	return retVal;
+}
+
 
+		u16		addr,
+		unsigned short	flags,
+		char		read_write,
+		u8		command,
+		int		protocol,
+		union i2c_smbus_data *data)
+{
+	struct xlr_i2c_private *priv = i2c_adap->algo_data;
+	int err;
+	int len;
+
+	switch (protocol) {
+	case I2C_SMBUS_BYTE:
+		if (read_write == I2C_SMBUS_READ)
+			err = xlr_i2c_rx(priv, 1, &data->byte, addr, command);
+		else
+			err = xlr_i2c_tx(priv, 1, &data->byte, addr, command);
+
+		break;
+	case I2C_SMBUS_BYTE_DATA:
+		if (read_write == I2C_SMBUS_READ)
+			err = xlr_i2c_rx(priv, 1, &data->byte, addr, command);
+		else
+			err = xlr_i2c_tx(priv, 1, &data->byte, addr, command);
+		break;
+
+	case I2C_SMBUS_WORD_DATA:
+	case I2C_SMBUS_PROC_CALL:
+		if (read_write == I2C_SMBUS_READ)
+			err = xlr_i2c_rx(priv, 2, (u8 *)&data->word,
+					addr, command);
+		else
+			err = xlr_i2c_tx(priv, 2, (u8 *)&data->word,
+					addr, command);
+
+		break;
+	case I2C_FUNC_SMBUS_BLOCK_DATA:
+	case I2C_SMBUS_I2C_BLOCK_DATA:
+		len = (data->block[0] > I2C_SMBUS_BLOCK_MAX) ?
+			I2C_SMBUS_BLOCK_MAX : data->block[0];
+		if (read_write == I2C_SMBUS_READ)
+			err = xlr_i2c_rx(priv, len, &data->block[1],
+					addr, command);

drivers/i2c/busses/i2c-xlr.c line 255

Quoted 10 lines
drivers/i2c/busses/i2c-xlr.c new file +10 -0
+		else
+			err = xlr_i2c_tx(priv, len, &data->block[1],
+					addr, command);
+
+		break;
+	default:
+		err = -1;
+	}
+	return err;
+}

thought most of these case where handled by the core translating them into the proper i2c messages?

Quoted 38 lines
drivers/i2c/busses/i2c-xlr.c new file +38 -0
+
+static u32 xlr_func(struct i2c_adapter *adap)
+{
+	/* We emulate SMBUS over I2C */
+	return I2C_FUNC_SMBUS_EMUL;
+}
+
+static struct i2c_algorithm xlr_i2c_algo = {
+	.smbus_xfer	= smbus_xfer,
+	.functionality	= xlr_func,
+};
+
+int xlr_i2c_add_bus(struct xlr_i2c_private *priv)
+{
+	priv->adap.owner	= THIS_MODULE;
+	priv->adap.algo_data	= priv;
+	priv->adap.nr		= 1;
+	priv->adap.algo		= &xlr_i2c_algo;
+	priv->adap.class	= I2C_CLASS_HWMON | I2C_CLASS_SPD;
+	snprintf(priv->adap.name, sizeof(priv->adap.name),
+			"SMBus XLR I2C Adapter");
+
+	/* register new adapter to i2c module... */
+	if (i2c_add_numbered_adapter(&priv->adap))
+		return -1;
+
+	return 0;
+}
+
+int xlr_i2c_del_bus(struct i2c_adapter *adap)
+{
+	return i2c_del_adapter(adap);
+}
+
+static int __devinit xlr_i2c_probe(struct platform_device *pd)
+{
+	xlr_i2c_priv.iobase_i2c_regs = get_i2c_base(pd->id);
+

drivers/i2c/busses/i2c-xlr.c line 303

Quoted 10 lines
drivers/i2c/busses/i2c-xlr.c new file +10 -0
+	xlr_i2c_priv.adap.dev.parent = &pd->dev;
+	if (xlr_i2c_add_bus(&xlr_i2c_priv) < 0) {
+		dev_err(&xlr_i2c_priv.adap.dev, "Failed to add i2c bus\n");
+		goto out;
+	} else
+		dev_info(&xlr_i2c_priv.adap.dev, "Added I2C Bus.\n");
+
+	return 0;
+out:
+	return -ENODEV;

-ENODEV will get ignored by the upper layer. Need to find a better error code.

drivers/i2c/busses/i2c-xlr.c line 332

Quoted 5 lines
drivers/i2c/busses/i2c-xlr.c new file +4 -0
+}
 
+MODULE_AUTHOR("Netlogic Microsystems Inc.");
+MODULE_DESCRIPTION("XLR I2C SMBus driver");
+MODULE_LICENSE("GPL");

no module alias for the platform device?

Quoted 8 lines
drivers/i2c/busses/i2c-xlr.c new file +2 -0
+module_init(xlr_i2c_init);
+module_exit(xlr_i2c_exit);
Signature · 5 lines
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html