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

Commit b32dd41e authored by Tony Lindgren's avatar Tony Lindgren
Browse files

omap: Fix i2c platform init code for omap4



Add separate omap_i2c_add_bus functions for mach-omap1
and mach-omap2. Make the mach-omap2 init set the interrupt
dynamically to support.

This is needed to add support for omap4 in a way that
works with multi-omap builds. This will eventually get
fixed in a generic way with the omap hwmods.

Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 20c9d2c4
Loading
Loading
Loading
Loading
+47 −20
Original line number Original line Diff line number Diff line
@@ -100,32 +100,43 @@ static int __init omap_i2c_nr_ports(void)
	return ports;
	return ports;
}
}


static int __init omap_i2c_add_bus(int bus_id)
/* Shared between omap2 and 3 */
static resource_size_t omap2_i2c_irq[3] __initdata = {
	INT_24XX_I2C1_IRQ,
	INT_24XX_I2C2_IRQ,
	INT_34XX_I2C3_IRQ,
};

static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id)
{
{
	struct platform_device *pdev;
	struct omap_i2c_bus_platform_data *pd;
	struct omap_i2c_bus_platform_data *pd;
	struct resource *res;
	struct resource *res;
	resource_size_t base, irq;


	pdev = &omap_i2c_devices[bus_id - 1];
	pd = pdev->dev.platform_data;
	pd = pdev->dev.platform_data;
	if (bus_id == 1) {
	res = pdev->resource;
	res = pdev->resource;
		if (cpu_class_is_omap1()) {
	res[0].start = OMAP1_I2C_BASE;
			base = OMAP1_I2C_BASE;
	res[0].end = res[0].start + OMAP_I2C_SIZE;
			irq = INT_I2C;
	res[1].start = INT_I2C;
		} else {
	omap1_i2c_mux_pins(bus_id);
			base = OMAP2_I2C_BASE1;

			irq = INT_24XX_I2C1_IRQ;
	return platform_device_register(pdev);
}
}
		res[0].start = base;

		res[0].end = base + OMAP_I2C_SIZE;
static inline int omap2_i2c_add_bus(struct platform_device *pdev, int bus_id)
		res[1].start = irq;
{
	struct resource *res;
	resource_size_t *irq;

	res = pdev->resource;

	irq = omap2_i2c_irq;

	if (bus_id == 1) {
		res[0].start = OMAP2_I2C_BASE1;
		res[0].end = res[0].start + OMAP_I2C_SIZE;
	}
	}


	if (cpu_class_is_omap1())
	res[1].start = irq[bus_id - 1];
		omap1_i2c_mux_pins(bus_id);
	if (cpu_class_is_omap2())
	omap2_i2c_mux_pins(bus_id);
	omap2_i2c_mux_pins(bus_id);


	/*
	/*
@@ -134,12 +145,28 @@ static int __init omap_i2c_add_bus(int bus_id)
	 * ensure quick enough wakeup from idle, when transfer
	 * ensure quick enough wakeup from idle, when transfer
	 * completes.
	 * completes.
	 */
	 */
	if (cpu_is_omap34xx())
	if (cpu_is_omap34xx()) {
		struct omap_i2c_bus_platform_data *pd;

		pd = pdev->dev.platform_data;
		pd->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat;
		pd->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat;
	}


	return platform_device_register(pdev);
	return platform_device_register(pdev);
}
}


static int __init omap_i2c_add_bus(int bus_id)
{
	struct platform_device *pdev;

	pdev = &omap_i2c_devices[bus_id - 1];

	if (cpu_class_is_omap1())
		return omap1_i2c_add_bus(pdev, bus_id);
	else
		return omap2_i2c_add_bus(pdev, bus_id);
}

/**
/**
 * omap_i2c_bus_setup - Process command line options for the I2C bus speed
 * omap_i2c_bus_setup - Process command line options for the I2C bus speed
 * @str: String of options
 * @str: String of options