• Deepak Saxena's avatar
    [PATCH] Update IOP3xx I2C bus driver · 57683a86
    Deepak Saxena authored
    The following patch is a major cleanup of the IOP3xx I2C bus driver
    that is found on Intel's IOP and IXP chipsets. The existing driver in
    the 2.6 tree uses hardcoded I/O addresses based on board configuration
    which is just going to get ugly as more chips use this unit. The update
    switches to using the driver model and passing in the I/O addresses
    via platform_device resources. The patch also updates the ID name to
    more closely match the actual usage of the device.
    
    I have tested this new driver on IXP46x systems and Dave Jiang has
    tested it on both IOP321 and IOP331 systems. ARM-specific patches
    to provide platform-level hooks will go upstream after this patch
    is integrated.
    
    An example of using the new driver (from IXP46x ARM code) follows:
    
    static struct resource ixp46x_i2c_resources[] = {
    	[0] = {
    		.start 	= 0xc8011000,
    		.end	= 0xc801101c,
    		.flags	= IORESOURCE_MEM,
    	},
    	[1] = {
    		.start 	= IRQ_IXP4XX_I2C,
    		.end	= IRQ_IXP4XX_I2C,
    		.flags	= IORESOURCE_IRQ
    	}
    };
    
    static struct platform_device ixp46x_i2c_controller = {
    	.name		= "IOP3xx-I2C",
    	.id		= 0,
    	.num_resources	= 2,
    	.resource	= &ixp46x_i2c_resources
    };
    
    static struct platform_device *ixp46x_devices[] __initdata = {
    	&ixp46x_i2c_controller
    };
    
    void __init ixp4xx_init(void)
    {
    	if (cpu_is_ixp46x()) {
    		platform_add_devices(ixp46x_devices,
    				ARRAY_SIZE(ixp46x_devices));
    	}
    }
    Signed-off-by: default avatarDeepak Saxena <dsaxena@plexity.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
    57683a86
i2c-iop3xx.h 4.15 KB