public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC: 2.6 patch] remove the i2c-at91.c driver
@ 2008-08-31 16:10 Adrian Bunk
       [not found] ` <20080831161005.GC3695-re2QNgSbS3j4D6uPqz5PAwR5/fbUUdgG@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Adrian Bunk @ 2008-08-31 16:10 UTC (permalink / raw)
  To: khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	Andrew Victor, David Brownell
  Cc: i2c-GZX6beZjE8VD60Wz+7aTrA

David Brownell marked this driver as broken in kernel 2.6.24 due to
hardware problems.

If it depends on BROKEN it can as well be removed.

Signed-off-by: Adrian Bunk <bunk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

---

 arch/arm/mach-at91/at91cap9_devices.c    |   34 --
 arch/arm/mach-at91/at91rm9200_devices.c  |   34 --
 arch/arm/mach-at91/at91sam9260_devices.c |   34 --
 arch/arm/mach-at91/at91sam9261_devices.c |   34 --
 arch/arm/mach-at91/at91sam9263_devices.c |   34 --
 arch/arm/mach-at91/at91sam9rl_devices.c  |   34 --
 drivers/i2c/busses/Kconfig               |   15 -
 drivers/i2c/busses/Makefile              |    1 
 drivers/i2c/busses/i2c-at91.c            |  328 -----------------------
 9 files changed, 548 deletions(-)


diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index abb4aac..7b9ab24 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -486,40 +486,6 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 	platform_device_register(&at91cap9_twi_device);
 }
 
-#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
-
-static struct resource twi_resources[] = {
-	[0] = {
-		.start	= AT91CAP9_BASE_TWI,
-		.end	= AT91CAP9_BASE_TWI + SZ_16K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= AT91CAP9_ID_TWI,
-		.end	= AT91CAP9_ID_TWI,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device at91cap9_twi_device = {
-	.name		= "at91_i2c",
-	.id		= -1,
-	.resource	= twi_resources,
-	.num_resources	= ARRAY_SIZE(twi_resources),
-};
-
-void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
-{
-	/* pins used for TWI interface */
-	at91_set_B_periph(AT91_PIN_PB4, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PB4, 1);
-
-	at91_set_B_periph(AT91_PIN_PB5, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PB5, 1);
-
-	i2c_register_board_info(0, devices, nr_devices);
-	platform_device_register(&at91cap9_twi_device);
-}
 #else
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
 #endif
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 9338825..d500dea 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -470,40 +470,6 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 	platform_device_register(&at91rm9200_twi_device);
 }
 
-#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
-
-static struct resource twi_resources[] = {
-	[0] = {
-		.start	= AT91RM9200_BASE_TWI,
-		.end	= AT91RM9200_BASE_TWI + SZ_16K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= AT91RM9200_ID_TWI,
-		.end	= AT91RM9200_ID_TWI,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device at91rm9200_twi_device = {
-	.name		= "at91_i2c",
-	.id		= -1,
-	.resource	= twi_resources,
-	.num_resources	= ARRAY_SIZE(twi_resources),
-};
-
-void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
-{
-	/* pins used for TWI interface */
-	at91_set_A_periph(AT91_PIN_PA25, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PA25, 1);
-
-	at91_set_A_periph(AT91_PIN_PA26, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PA26, 1);
-
-	i2c_register_board_info(0, devices, nr_devices);
-	platform_device_register(&at91rm9200_twi_device);
-}
 #else
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
 #endif
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 7774d17..8aa8d1a 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -415,40 +415,6 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 	platform_device_register(&at91sam9260_twi_device);
 }
 
-#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
-
-static struct resource twi_resources[] = {
-	[0] = {
-		.start	= AT91SAM9260_BASE_TWI,
-		.end	= AT91SAM9260_BASE_TWI + SZ_16K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= AT91SAM9260_ID_TWI,
-		.end	= AT91SAM9260_ID_TWI,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device at91sam9260_twi_device = {
-	.name		= "at91_i2c",
-	.id		= -1,
-	.resource	= twi_resources,
-	.num_resources	= ARRAY_SIZE(twi_resources),
-};
-
-void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
-{
-	/* pins used for TWI interface */
-	at91_set_A_periph(AT91_PIN_PA23, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PA23, 1);
-
-	at91_set_A_periph(AT91_PIN_PA24, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PA24, 1);
-
-	i2c_register_board_info(0, devices, nr_devices);
-	platform_device_register(&at91sam9260_twi_device);
-}
 #else
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
 #endif
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 6b89172..1d5d44f 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -307,40 +307,6 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 	platform_device_register(&at91sam9261_twi_device);
 }
 
-#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
-
-static struct resource twi_resources[] = {
-	[0] = {
-		.start	= AT91SAM9261_BASE_TWI,
-		.end	= AT91SAM9261_BASE_TWI + SZ_16K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= AT91SAM9261_ID_TWI,
-		.end	= AT91SAM9261_ID_TWI,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device at91sam9261_twi_device = {
-	.name		= "at91_i2c",
-	.id		= -1,
-	.resource	= twi_resources,
-	.num_resources	= ARRAY_SIZE(twi_resources),
-};
-
-void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
-{
-	/* pins used for TWI interface */
-	at91_set_A_periph(AT91_PIN_PA7, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PA7, 1);
-
-	at91_set_A_periph(AT91_PIN_PA8, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PA8, 1);
-
-	i2c_register_board_info(0, devices, nr_devices);
-	platform_device_register(&at91sam9261_twi_device);
-}
 #else
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
 #endif
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index c93992f..a2a9e3d 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -462,40 +462,6 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 	platform_device_register(&at91sam9263_twi_device);
 }
 
-#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
-
-static struct resource twi_resources[] = {
-	[0] = {
-		.start	= AT91SAM9263_BASE_TWI,
-		.end	= AT91SAM9263_BASE_TWI + SZ_16K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= AT91SAM9263_ID_TWI,
-		.end	= AT91SAM9263_ID_TWI,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device at91sam9263_twi_device = {
-	.name		= "at91_i2c",
-	.id		= -1,
-	.resource	= twi_resources,
-	.num_resources	= ARRAY_SIZE(twi_resources),
-};
-
-void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
-{
-	/* pins used for TWI interface */
-	at91_set_A_periph(AT91_PIN_PB4, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PB4, 1);
-
-	at91_set_A_periph(AT91_PIN_PB5, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PB5, 1);
-
-	i2c_register_board_info(0, devices, nr_devices);
-	platform_device_register(&at91sam9263_twi_device);
-}
 #else
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
 #endif
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 6208863..c9a36c0 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -304,40 +304,6 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 	platform_device_register(&at91sam9rl_twi_device);
 }
 
-#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
-
-static struct resource twi_resources[] = {
-	[0] = {
-		.start	= AT91SAM9RL_BASE_TWI0,
-		.end	= AT91SAM9RL_BASE_TWI0 + SZ_16K - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= AT91SAM9RL_ID_TWI0,
-		.end	= AT91SAM9RL_ID_TWI0,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device at91sam9rl_twi_device = {
-	.name		= "at91_i2c",
-	.id		= -1,
-	.resource	= twi_resources,
-	.num_resources	= ARRAY_SIZE(twi_resources),
-};
-
-void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
-{
-	/* pins used for TWI interface */
-	at91_set_A_periph(AT91_PIN_PA23, 0);		/* TWD */
-	at91_set_multi_drive(AT91_PIN_PA23, 1);
-
-	at91_set_A_periph(AT91_PIN_PA24, 0);		/* TWCK */
-	at91_set_multi_drive(AT91_PIN_PA24, 1);
-
-	i2c_register_board_info(0, devices, nr_devices);
-	platform_device_register(&at91sam9rl_twi_device);
-}
 #else
 void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
 #endif
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 6ee997b..fb4cd11 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -256,21 +256,6 @@ config I2C_POWERMAC
 
 comment "I2C system bus drivers (mostly embedded / system-on-chip)"
 
-config I2C_AT91
-	tristate "Atmel AT91 I2C Two-Wire interface (TWI)"
-	depends on ARCH_AT91 && EXPERIMENTAL && BROKEN
-	help
-	  This supports the use of the I2C interface on Atmel AT91
-	  processors.
-
-	  This driver is BROKEN because the controller which it uses
-	  will easily trigger RX overrun and TX underrun errors.  Using
-	  low I2C clock rates may partially work around those issues
-	  on some systems.  Another serious problem is that there is no
-	  documented way to issue repeated START conditions, as needed
-	  to support combined I2C messages.  Use the i2c-gpio driver
-	  unless your system can cope with those limitations.
-
 config I2C_AU1550
 	tristate "Au1550/Au1200 SMBus interface"
 	depends on SOC_AU1550 || SOC_AU1200
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 97dbfa2..69edefd 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_I2C_HYDRA)		+= i2c-hydra.o
 obj-$(CONFIG_I2C_POWERMAC)	+= i2c-powermac.o
 
 # Embebbed system I2C/SMBus host controller drivers
-obj-$(CONFIG_I2C_AT91)		+= i2c-at91.o
 obj-$(CONFIG_I2C_AU1550)	+= i2c-au1550.o
 obj-$(CONFIG_I2C_BLACKFIN_TWI)	+= i2c-bfin-twi.o
 obj-$(CONFIG_I2C_CPM)		+= i2c-cpm.o
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
deleted file mode 100644
index 9efb021..0000000
--- a/drivers/i2c/busses/i2c-at91.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
-    i2c Support for Atmel's AT91 Two-Wire Interface (TWI)
-
-    Copyright (C) 2004 Rick Bronson
-    Converted to 2.6 by Andrew Victor <andrew-eS41wJS13H5l57MIdRCFDg@public.gmane.org>
-
-    Borrowed heavily from original work by:
-    Copyright (C) 2000 Philip Edelbrock <phil-LT64U7CwzWEZMC/lefXSXFaTQe2KTcn/@public.gmane.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-*/
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/delay.h>
-#include <linux/i2c.h>
-#include <linux/init.h>
-#include <linux/clk.h>
-#include <linux/platform_device.h>
-
-#include <asm/io.h>
-
-#include <mach/at91_twi.h>
-#include <mach/board.h>
-#include <mach/cpu.h>
-
-#define TWI_CLOCK		100000		/* Hz. max 400 Kbits/sec */
-
-
-static struct clk *twi_clk;
-static void __iomem *twi_base;
-
-#define at91_twi_read(reg)		__raw_readl(twi_base + (reg))
-#define at91_twi_write(reg, val)	__raw_writel((val), twi_base + (reg))
-
-
-/*
- * Initialize the TWI hardware registers.
- */
-static void __devinit at91_twi_hwinit(void)
-{
-	unsigned long cdiv, ckdiv;
-
-	at91_twi_write(AT91_TWI_IDR, 0xffffffff);	/* Disable all interrupts */
-	at91_twi_write(AT91_TWI_CR, AT91_TWI_SWRST);	/* Reset peripheral */
-	at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN);	/* Set Master mode */
-
-	/* Calcuate clock dividers */
-	cdiv = (clk_get_rate(twi_clk) / (2 * TWI_CLOCK)) - 3;
-	cdiv = cdiv + 1;	/* round up */
-	ckdiv = 0;
-	while (cdiv > 255) {
-		ckdiv++;
-		cdiv = cdiv >> 1;
-	}
-
-	if (cpu_is_at91rm9200()) {			/* AT91RM9200 Errata #22 */
-		if (ckdiv > 5) {
-			printk(KERN_ERR "AT91 I2C: Invalid TWI_CLOCK value!\n");
-			ckdiv = 5;
-		}
-	}
-
-	at91_twi_write(AT91_TWI_CWGR, (ckdiv << 16) | (cdiv << 8) | cdiv);
-}
-
-/*
- * Poll the i2c status register until the specified bit is set.
- * Returns 0 if timed out (100 msec).
- */
-static short at91_poll_status(unsigned long bit)
-{
-	int loop_cntr = 10000;
-
-	do {
-		udelay(10);
-	} while (!(at91_twi_read(AT91_TWI_SR) & bit) && (--loop_cntr > 0));
-
-	return (loop_cntr > 0);
-}
-
-static int xfer_read(struct i2c_adapter *adap, unsigned char *buf, int length)
-{
-	/* Send Start */
-	at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
-
-	/* Read data */
-	while (length--) {
-		if (!length)	/* need to send Stop before reading last byte */
-			at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
-		if (!at91_poll_status(AT91_TWI_RXRDY)) {
-			dev_dbg(&adap->dev, "RXRDY timeout\n");
-			return -ETIMEDOUT;
-		}
-		*buf++ = (at91_twi_read(AT91_TWI_RHR) & 0xff);
-	}
-
-	return 0;
-}
-
-static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length)
-{
-	/* Load first byte into transmitter */
-	at91_twi_write(AT91_TWI_THR, *buf++);
-
-	/* Send Start */
-	at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
-
-	do {
-		if (!at91_poll_status(AT91_TWI_TXRDY)) {
-			dev_dbg(&adap->dev, "TXRDY timeout\n");
-			return -ETIMEDOUT;
-		}
-
-		length--;	/* byte was transmitted */
-
-		if (length > 0)		/* more data to send? */
-			at91_twi_write(AT91_TWI_THR, *buf++);
-	} while (length);
-
-	/* Send Stop */
-	at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
-
-	return 0;
-}
-
-/*
- * Generic i2c master transfer entrypoint.
- *
- * Note: We do not use Atmel's feature of storing the "internal device address".
- * Instead the "internal device address" has to be written using a separate
- * i2c message.
- * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html
- */
-static int at91_xfer(struct i2c_adapter *adap, struct i2c_msg *pmsg, int num)
-{
-	int i, ret;
-
-	dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num);
-
-	for (i = 0; i < num; i++) {
-		dev_dbg(&adap->dev, " #%d: %sing %d byte%s %s 0x%02x\n", i,
-			pmsg->flags & I2C_M_RD ? "read" : "writ",
-			pmsg->len, pmsg->len > 1 ? "s" : "",
-			pmsg->flags & I2C_M_RD ? "from" : "to",	pmsg->addr);
-
-		at91_twi_write(AT91_TWI_MMR, (pmsg->addr << 16)
-			| ((pmsg->flags & I2C_M_RD) ? AT91_TWI_MREAD : 0));
-
-		if (pmsg->len && pmsg->buf) {	/* sanity check */
-			if (pmsg->flags & I2C_M_RD)
-				ret = xfer_read(adap, pmsg->buf, pmsg->len);
-			else
-				ret = xfer_write(adap, pmsg->buf, pmsg->len);
-
-			if (ret)
-				return ret;
-
-			/* Wait until transfer is finished */
-			if (!at91_poll_status(AT91_TWI_TXCOMP)) {
-				dev_dbg(&adap->dev, "TXCOMP timeout\n");
-				return -ETIMEDOUT;
-			}
-		}
-		dev_dbg(&adap->dev, "transfer complete\n");
-		pmsg++;		/* next message */
-	}
-	return i;
-}
-
-/*
- * Return list of supported functionality.
- */
-static u32 at91_func(struct i2c_adapter *adapter)
-{
-	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
-}
-
-static struct i2c_algorithm at91_algorithm = {
-	.master_xfer	= at91_xfer,
-	.functionality	= at91_func,
-};
-
-/*
- * Main initialization routine.
- */
-static int __devinit at91_i2c_probe(struct platform_device *pdev)
-{
-	struct i2c_adapter *adapter;
-	struct resource *res;
-	int rc;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENXIO;
-
-	if (!request_mem_region(res->start, res->end - res->start + 1, "at91_i2c"))
-		return -EBUSY;
-
-	twi_base = ioremap(res->start, res->end - res->start + 1);
-	if (!twi_base) {
-		rc = -ENOMEM;
-		goto fail0;
-	}
-
-	twi_clk = clk_get(NULL, "twi_clk");
-	if (IS_ERR(twi_clk)) {
-		dev_err(&pdev->dev, "no clock defined\n");
-		rc = -ENODEV;
-		goto fail1;
-	}
-
-	adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL);
-	if (adapter == NULL) {
-		dev_err(&pdev->dev, "can't allocate inteface!\n");
-		rc = -ENOMEM;
-		goto fail2;
-	}
-	sprintf(adapter->name, "AT91");
-	adapter->algo = &at91_algorithm;
-	adapter->class = I2C_CLASS_HWMON;
-	adapter->dev.parent = &pdev->dev;
-	/* adapter->id == 0 ... only one TWI controller for now */
-
-	platform_set_drvdata(pdev, adapter);
-
-	clk_enable(twi_clk);		/* enable peripheral clock */
-	at91_twi_hwinit();		/* initialize TWI controller */
-
-	rc = i2c_add_numbered_adapter(adapter);
-	if (rc) {
-		dev_err(&pdev->dev, "Adapter %s registration failed\n",
-				adapter->name);
-		goto fail3;
-	}
-
-	dev_info(&pdev->dev, "AT91 i2c bus driver.\n");
-	return 0;
-
-fail3:
-	platform_set_drvdata(pdev, NULL);
-	kfree(adapter);
-	clk_disable(twi_clk);
-fail2:
-	clk_put(twi_clk);
-fail1:
-	iounmap(twi_base);
-fail0:
-	release_mem_region(res->start, res->end - res->start + 1);
-
-	return rc;
-}
-
-static int __devexit at91_i2c_remove(struct platform_device *pdev)
-{
-	struct i2c_adapter *adapter = platform_get_drvdata(pdev);
-	struct resource *res;
-	int rc;
-
-	rc = i2c_del_adapter(adapter);
-	platform_set_drvdata(pdev, NULL);
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	iounmap(twi_base);
-	release_mem_region(res->start, res->end - res->start + 1);
-
-	clk_disable(twi_clk);		/* disable peripheral clock */
-	clk_put(twi_clk);
-
-	return rc;
-}
-
-#ifdef CONFIG_PM
-
-/* NOTE: could save a few mA by keeping clock off outside of at91_xfer... */
-
-static int at91_i2c_suspend(struct platform_device *pdev, pm_message_t mesg)
-{
-	clk_disable(twi_clk);
-	return 0;
-}
-
-static int at91_i2c_resume(struct platform_device *pdev)
-{
-	return clk_enable(twi_clk);
-}
-
-#else
-#define at91_i2c_suspend	NULL
-#define at91_i2c_resume		NULL
-#endif
-
-/* work with "modprobe at91_i2c" from hotplugging or coldplugging */
-MODULE_ALIAS("platform:at91_i2c");
-
-static struct platform_driver at91_i2c_driver = {
-	.probe		= at91_i2c_probe,
-	.remove		= __devexit_p(at91_i2c_remove),
-	.suspend	= at91_i2c_suspend,
-	.resume		= at91_i2c_resume,
-	.driver		= {
-		.name	= "at91_i2c",
-		.owner	= THIS_MODULE,
-	},
-};
-
-static int __init at91_i2c_init(void)
-{
-	return platform_driver_register(&at91_i2c_driver);
-}
-
-static void __exit at91_i2c_exit(void)
-{
-	platform_driver_unregister(&at91_i2c_driver);
-}
-
-module_init(at91_i2c_init);
-module_exit(at91_i2c_exit);
-
-MODULE_AUTHOR("Rick Bronson");
-MODULE_DESCRIPTION("I2C (TWI) driver for Atmel AT91");
-MODULE_LICENSE("GPL");

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [RFC: 2.6 patch] remove the i2c-at91.c driver
       [not found] ` <20080831161005.GC3695-re2QNgSbS3j4D6uPqz5PAwR5/fbUUdgG@public.gmane.org>
@ 2008-09-01 13:13   ` Andrew Victor
       [not found]     ` <cd73a99e0809010613w40569b3fv9f5fc96a7bfb6a29-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Victor @ 2008-09-01 13:13 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: David Brownell, i2c-GZX6beZjE8VD60Wz+7aTrA,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg

hi Adrian,

> David Brownell marked this driver as broken in kernel 2.6.24 due to
> hardware problems.
>
> If it depends on BROKEN it can as well be removed.

This driver should be usable on the new AT91SAM9G20 processor.
Atmel have supposidly resolved all the hardware issues that caused
this driver to fail.


Regards,
  Andrew Victor

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC: 2.6 patch] remove the i2c-at91.c driver
       [not found]     ` <cd73a99e0809010613w40569b3fv9f5fc96a7bfb6a29-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2008-09-02 10:11       ` Ben Dooks
       [not found]         ` <20080902101127.GJ2716-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
  2008-09-02 10:24       ` Ben Dooks
  1 sibling, 1 reply; 9+ messages in thread
From: Ben Dooks @ 2008-09-02 10:11 UTC (permalink / raw)
  To: Andrew Victor
  Cc: David Brownell, i2c-GZX6beZjE8VD60Wz+7aTrA,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg

On Mon, Sep 01, 2008 at 03:13:14PM +0200, Andrew Victor wrote:
> hi Adrian,
> 
> > David Brownell marked this driver as broken in kernel 2.6.24 due to
> > hardware problems.
> >
> > If it depends on BROKEN it can as well be removed.
> 
> This driver should be usable on the new AT91SAM9G20 processor.
> Atmel have supposidly resolved all the hardware issues that caused
> this driver to fail.

Then would it be possible to have a patch to update the driver's
help text, and possibly update the Kconfig to reflect the dependency
on having working silicon?

Would it be better to rename this driver?

-- 
Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC: 2.6 patch] remove the i2c-at91.c driver
       [not found]     ` <cd73a99e0809010613w40569b3fv9f5fc96a7bfb6a29-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2008-09-02 10:11       ` Ben Dooks
@ 2008-09-02 10:24       ` Ben Dooks
  1 sibling, 0 replies; 9+ messages in thread
From: Ben Dooks @ 2008-09-02 10:24 UTC (permalink / raw)
  To: Andrew Victor
  Cc: David Brownell, i2c-GZX6beZjE8VD60Wz+7aTrA,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg

On Mon, Sep 01, 2008 at 03:13:14PM +0200, Andrew Victor wrote:
> hi Adrian,
> 
> > David Brownell marked this driver as broken in kernel 2.6.24 due to
> > hardware problems.
> >
> > If it depends on BROKEN it can as well be removed.
> 
> This driver should be usable on the new AT91SAM9G20 processor.
> Atmel have supposidly resolved all the hardware issues that caused
> this driver to fail.

As a note, it would be worth filtering Adrian's patch to remove the
hardware I2C support from the machines that cannot support it to
avoid people falling into the trap of using a driver that is not
going to function correctly?

-- 
Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC: 2.6 patch] remove the i2c-at91.c driver
       [not found]         ` <20080902101127.GJ2716-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
@ 2008-09-04 18:55           ` Andrew Victor
       [not found]             ` <cd73a99e0809041155m1f9e576dt5659da679fffb56d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Victor @ 2008-09-04 18:55 UTC (permalink / raw)
  To: Ben Dooks; +Cc: David Brownell, i2c-GZX6beZjE8VD60Wz+7aTrA

hi Ben,

>> This driver should be usable on the new AT91SAM9G20 processor.
>> Atmel have supposidly resolved all the hardware issues that caused
>> this driver to fail.
>
> Then would it be possible to have a patch to update the driver's
> help text, and possibly update the Kconfig to reflect the dependency
> on having working silicon?

I think the help text at the moment is pretty clear that the driver is
marked as broken.
All the in-kernel boards now by default use the bit-banging driver.

I don't actually have G20 hardware to test it on, but until
somebody/Atmel have verified if this driver works or not, I'd prefer
to just to leave it as broken.
If it still doesn't work, then just remove all references to the driver.


Regards,
  Andrew Victor

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC: 2.6 patch] remove the i2c-at91.c driver
       [not found]             ` <cd73a99e0809041155m1f9e576dt5659da679fffb56d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2008-09-04 19:18               ` David Brownell
       [not found]                 ` <200809041218.49604.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: David Brownell @ 2008-09-04 19:18 UTC (permalink / raw)
  To: Andrew Victor; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA, Ben Dooks

On Thursday 04 September 2008, Andrew Victor wrote:
> 
> I don't actually have G20 hardware to test it on, but until
> somebody/Atmel have verified if this driver works or not, I'd prefer
> to just to leave it as broken.
> If it still doesn't work, then just remove all references to the driver.

Right ...

Note that resolving the lack of support for repeated starts
would require driver updates in any case.  Some of which COULD
have been done with existing hardware.  ISTR a combined
transaction could be done

	S addr W [A] byte1 [A] byte2 [A] byte3 [A]
	Sr addr R [A] [byte4] A [byte5] ... N P

... with up to three bytes in the write segment.  Obviously
that's not an arbitrary I2C transaction ... in fact, it'd
best be handled (IMO) as an SMBus adapter not an I2C adapter.
(So maybe a new driver would be appropriate...)

But I recall the lack of flow control to be a bigger issue.
The hardware liked to TX the next byte before it was loaded
into the (single byte) TX fifo, and then complain that there
was no byte there.  And likewise, to RX the next byte before
the previous one got removed.  Or ... if that's not what it
was doing, it sure acted like it was!  Now, *THOSE* issues
seem highly amenable to hardware-only fixes:  just stretch
the clock until the FIFO is ready.

- Dave

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC: 2.6 patch] remove the i2c-at91.c driver
       [not found]                 ` <200809041218.49604.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
@ 2008-09-04 20:14                   ` Andrew Victor
       [not found]                     ` <cd73a99e0809041314i54c7fd71ued53270517ecc829-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Victor @ 2008-09-04 20:14 UTC (permalink / raw)
  To: David Brownell; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA, Ben Dooks

hi David,

> But I recall the lack of flow control to be a bigger issue.
> The hardware liked to TX the next byte before it was loaded
> into the (single byte) TX fifo, and then complain that there
> was no byte there.  And likewise, to RX the next byte before
> the previous one got removed.  Or ... if that's not what it
> was doing, it sure acted like it was!  Now, *THOSE* issues
> seem highly amenable to hardware-only fixes:  just stretch
> the clock until the FIFO is ready.

According to the datasheet, the G20 supports both clock stretching and
repeated starts.
The TWI is now also connected to a PDC, so we can set-up a DMA buffer
for the TWI receives and transmits.


Regards,
  Andrew Victor

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC: 2.6 patch] remove the i2c-at91.c driver
       [not found]                     ` <cd73a99e0809041314i54c7fd71ued53270517ecc829-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2008-09-04 20:25                       ` David Brownell
       [not found]                         ` <200809041325.30330.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: David Brownell @ 2008-09-04 20:25 UTC (permalink / raw)
  To: Andrew Victor; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA, Ben Dooks

On Thursday 04 September 2008, Andrew Victor wrote:
> According to the datasheet, the G20 supports both clock stretching and
> repeated starts.

Same is true for docs about current silicon ... but the clock
stretching doesn't prevent those FIFO problems, and repeated
starts are barely enough to support older versions of SMBus.

Is that a *general* mechanism for repeated starts?

Or is it just the current/limited one where there can be at most
two segments in any combined message, going to the same slave
address ... a write of up to 3 bytes (assuming 7bit addressses)
then a longer read?

Either way:  driver updates needed for that!

(I'd call clock stretching to prevent those FIFO issues just
a bugfix, myself.  It should need no driver updates.)


> The TWI is now also connected to a PDC, so we can set-up a DMA buffer
> for the TWI receives and transmits.

Using DMA also implies driver updates.

Maybe the best answer would be to remove this and have a g20-specific
driver later.

- Dave


_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC: 2.6 patch] remove the i2c-at91.c driver
       [not found]                         ` <200809041325.30330.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
@ 2008-09-22 18:22                           ` Andrew Victor
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Victor @ 2008-09-22 18:22 UTC (permalink / raw)
  To: David Brownell; +Cc: i2c-GZX6beZjE8VD60Wz+7aTrA, Ben Dooks

hi,

> Maybe the best answer would be to remove this and have a g20-specific
> driver later.

The comment from Atmel is that in the short-term they don't have time
to look into testing or fixing the driver on the G20.

So I think we might aswell just apply Adrian's patch to mainline.
  Acked-by: Andrew Victor <linux-PelNFVqkFnVyf+4FbqDuWQ@public.gmane.org>

I'll include it in the -at91 patch incase anybody still wants to use it.


Regards,
  Andrew Victor

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-09-22 18:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-31 16:10 [RFC: 2.6 patch] remove the i2c-at91.c driver Adrian Bunk
     [not found] ` <20080831161005.GC3695-re2QNgSbS3j4D6uPqz5PAwR5/fbUUdgG@public.gmane.org>
2008-09-01 13:13   ` Andrew Victor
     [not found]     ` <cd73a99e0809010613w40569b3fv9f5fc96a7bfb6a29-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-09-02 10:11       ` Ben Dooks
     [not found]         ` <20080902101127.GJ2716-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2008-09-04 18:55           ` Andrew Victor
     [not found]             ` <cd73a99e0809041155m1f9e576dt5659da679fffb56d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-09-04 19:18               ` David Brownell
     [not found]                 ` <200809041218.49604.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-09-04 20:14                   ` Andrew Victor
     [not found]                     ` <cd73a99e0809041314i54c7fd71ued53270517ecc829-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-09-04 20:25                       ` David Brownell
     [not found]                         ` <200809041325.30330.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-09-22 18:22                           ` Andrew Victor
2008-09-02 10:24       ` Ben Dooks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox