Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c564e6ae authored by Daniel Silverstone's avatar Daniel Silverstone Committed by Ben Dooks
Browse files

i2c-s3c2410: Simplify bus frequency calculation



The platform data for the i2c-s3c2410 driver used to allow a min,
max and desired frequency for the I2C bus. This patch reduces it
to simply a desired frequency ceiling and corrects all the uses
of the platform data appropriately.

This means, for example, that on a system with a 66MHz fclk, a
request for 100KHz will achieve 65KHz which is safe and
acceptable, rather than 378KHz which it would have achieved
without this change.

Signed-off-by: default avatarSimtec Linux Team <linux@simtec.co.uk>
Signed-off-by: default avatarDaniel Silverstone <dsilvers@simtec.co.uk>
[ben-linux@fluff.org: tidy subject and description]
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent a192f715
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -409,8 +409,7 @@ static struct platform_device bast_sio = {
static struct s3c2410_platform_i2c __initdata bast_i2c_info = {
static struct s3c2410_platform_i2c __initdata bast_i2c_info = {
	.flags		= 0,
	.flags		= 0,
	.slave_addr	= 0x10,
	.slave_addr	= 0x10,
	.bus_freq	= 100*1000,
	.frequency	= 100*1000,
	.max_freq	= 130*1000,
};
};


/* Asix AX88796 10/100 ethernet controller */
/* Asix AX88796 10/100 ethernet controller */
+1 −2
Original line number Original line Diff line number Diff line
@@ -340,8 +340,7 @@ static struct platform_device *n35_devices[] __initdata = {
static struct s3c2410_platform_i2c n30_i2ccfg = {
static struct s3c2410_platform_i2c n30_i2ccfg = {
	.flags		= 0,
	.flags		= 0,
	.slave_addr	= 0x10,
	.slave_addr	= 0x10,
	.bus_freq	= 10*1000,
	.frequency	= 10*1000,
	.max_freq	= 10*1000,
};
};


/* Lots of hardcoded stuff, but it sets up the hardware in a useful
/* Lots of hardcoded stuff, but it sets up the hardware in a useful
+1 −2
Original line number Original line Diff line number Diff line
@@ -453,8 +453,7 @@ static struct spi_board_info __initdata jive_spi_devs[] = {
/* I2C bus and device configuration. */
/* I2C bus and device configuration. */


static struct s3c2410_platform_i2c jive_i2c_cfg __initdata = {
static struct s3c2410_platform_i2c jive_i2c_cfg __initdata = {
	.max_freq	= 80 * 1000,
	.frequency	= 80 * 1000,
	.bus_freq	= 50 * 1000,
	.flags		= S3C_IICFLG_FILTER,
	.flags		= S3C_IICFLG_FILTER,
	.sda_delay	= 2,
	.sda_delay	= 2,
};
};
+2 −3
Original line number Original line Diff line number Diff line
/* linux/arch/arm/plat-s3c/dev-i2c0.c
/* linux/arch/arm/plat-s3c/dev-i2c0.c
 *
 *
 * Copyright 2008 Simtec Electronics
 * Copyright 2008,2009 Simtec Electronics
 *	Ben Dooks <ben@simtec.co.uk>
 *	Ben Dooks <ben@simtec.co.uk>
 *	http://armlinux.simtec.co.uk/
 *	http://armlinux.simtec.co.uk/
 *
 *
@@ -50,8 +50,7 @@ struct platform_device s3c_device_i2c0 = {
static struct s3c2410_platform_i2c default_i2c_data0 __initdata = {
static struct s3c2410_platform_i2c default_i2c_data0 __initdata = {
	.flags		= 0,
	.flags		= 0,
	.slave_addr	= 0x10,
	.slave_addr	= 0x10,
	.bus_freq	= 100*1000,
	.frequency	= 100*1000,
	.max_freq	= 400*1000,
	.sda_delay	= 100,
	.sda_delay	= 100,
};
};


+2 −3
Original line number Original line Diff line number Diff line
/* linux/arch/arm/plat-s3c/dev-i2c1.c
/* linux/arch/arm/plat-s3c/dev-i2c1.c
 *
 *
 * Copyright 2008 Simtec Electronics
 * Copyright 2008,2009 Simtec Electronics
 *	Ben Dooks <ben@simtec.co.uk>
 *	Ben Dooks <ben@simtec.co.uk>
 *	http://armlinux.simtec.co.uk/
 *	http://armlinux.simtec.co.uk/
 *
 *
@@ -47,8 +47,7 @@ static struct s3c2410_platform_i2c default_i2c_data1 __initdata = {
	.flags		= 0,
	.flags		= 0,
	.bus_num	= 1,
	.bus_num	= 1,
	.slave_addr	= 0x10,
	.slave_addr	= 0x10,
	.bus_freq	= 100*1000,
	.frequency	= 100*1000,
	.max_freq	= 400*1000,
	.sda_delay	= 100,
	.sda_delay	= 100,
};
};


Loading