Hi Bernard,
On Fri, Apr 18, 2008 at 8:04 AM, Bernard Blackham
<[EMAIL PROTECTED]> wrote:
> I2C device has some board-specific parameters such as bus frequency
> and per-transaction setup delay. The DM6446 DVEVM, for example,
> requires a much lower bus frequency of 20kHz and a setup delay of
> 100us due to the presence of the MSP430 doing software I2C. Other
> boards can use the defaults defined in drivers/i2c/i2c-davinci.c,
> but will still need to define the platform device themselves.
>
> Signed-off-by: Bernard Blackham <[EMAIL PROTECTED]>
>
> ---
> board-evm.c | 38 ++++++++++++++++++++++++++++++++++++++
> devices.c | 33 ---------------------------------
> 2 files changed, 38 insertions(+), 33 deletions(-)
>
> Index: linux-2.6.24-tl1/arch/arm/mach-davinci/board-evm.c
> ===================================================================
> --- linux-2.6.24-tl1.orig/arch/arm/mach-davinci/board-evm.c 2008-04-18
> 02:41:49.000000000 +0800
> +++ linux-2.6.24-tl1/arch/arm/mach-davinci/board-evm.c 2008-04-18
> 02:49:39.000000000 +0800
> @@ -28,6 +28,7 @@
> #include <asm/mach/flash.h>
>
> #include <asm/arch/common.h>
> +#include <asm/arch/i2c.h>
> #include <asm/arch/hardware.h>
> #include <asm/arch/psc.h>
>
> @@ -197,6 +198,40 @@
> #define setup_usb(void) do {} while(0)
> #endif /* CONFIG_USB_MUSB_HDRC */
>
> +/*
> + * I2C
> + */
> +#if defined(CONFIG_I2C_DAVINCI) || defined(CONFIG_I2C_DAVINCI_MODULE)
> +
> +static struct resource i2c_resources[] = {
> + {
> + .start = DAVINCI_I2C_BASE,
> + .end = DAVINCI_I2C_BASE + 0x40,
> + .flags = IORESOURCE_MEM,
> + },
> + {
> + .start = IRQ_I2C,
> + .flags = IORESOURCE_IRQ,
> + },
> +};
> +
> +static struct davinci_i2c_platform_data dvevm_i2c_platform_data = {
> + .bus_freq = 20,
> + .bus_delay = 100,
> +};
> +
> +static struct platform_device davinci_i2c_device = {
> + .name = "i2c_davinci",
> + .id = 1,
> + .num_resources = ARRAY_SIZE(i2c_resources),
> + .resource = i2c_resources,
> + .dev = {
> + .platform_data = &dvevm_i2c_platform_data,
> + },
> +};
> +
> +#endif
> +
> static struct platform_device rtc_dev = {
> .name = "rtc_davinci_evm",
> .id = -1,
> @@ -213,6 +248,9 @@
> #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
> &usb_dev,
> #endif
> +#if defined(CONFIG_I2C_DAVINCI) || defined(CONFIG_I2C_DAVINCI_MODULE)
> + &davinci_i2c_device,
> +#endif
> &rtc_dev,
> };
>
I think above change can be done in better way, as we can't move
resource structure to board specific file, as it going to common for
all boards. We should better API similar to we have done OMAP. Please
check arch/arm/plat-omap/i2c.c and omap_register_i2c_bus, which
fulfills this requirements in better way.
--
---Trilok Soni
http://triloksoni.wordpress.com
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source