From patchwork Fri Oct 1 11:55:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh KUMAR X-Patchwork-Id: 66339 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ww0-f56.google.com (mail-ww0-f56.google.com [74.125.82.56]) by ozlabs.org (Postfix) with ESMTP id B1053B70F6 for ; Fri, 1 Oct 2010 21:57:54 +1000 (EST) Received: by wwi14 with SMTP id 14sf1398263wwi.11 for ; Fri, 01 Oct 2010 04:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:mime-version:x-beenthere:received :received:received:received:received-spf:received:received:received :received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=J1y/ACCdTz6an++069z+W4J++CnRoTTe6zmqbZTMBV8=; b=pBkRRyJuAFDmDg1T0WHaiBUxsWw07wIQLxr5KscdIEN1JtSgNsy5KXAjtklqChQaW4 TgV2/Dx5hCvjvDu0sy7+cgStaSwCU2d+lfieu3LOlDb0wNi9coGEIp/Y+AzpQanH1kzl voHwUTJQfXdleQgh5F0nv0yaAdvtrKxVDelDI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; b=yDgqIx+mXCukOLhP2QA0aLroQ2jJykWEtAbjfTthVvV3qD8D/IxxLtwjVfkz4+246B qOggnLpGuRRUdTVbxEz6ixv85Rq3aEC7L4mGvRCajnHv5FHAAmUYnSgudvRUhfhwURUV PwkVsvdn394es/d5dYisQhqq+2Gk3ih7gVDaQ= Received: by 10.216.145.9 with SMTP id o9mr1093533wej.0.1285934272673; Fri, 01 Oct 2010 04:57:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.14.46.205 with SMTP id r53ls233423eeb.7.p; Fri, 01 Oct 2010 04:57:52 -0700 (PDT) Received: by 10.14.119.66 with SMTP id m42mr419305eeh.15.1285934271932; Fri, 01 Oct 2010 04:57:51 -0700 (PDT) Received: by 10.14.119.66 with SMTP id m42mr419304eeh.15.1285934271917; Fri, 01 Oct 2010 04:57:51 -0700 (PDT) Received: from eu1sys200aog113.obsmtp.com (eu1sys200aog113.obsmtp.com [207.126.144.135]) by gmr-mx.google.com with ESMTP id a48si1119358eei.2.2010.10.01.04.57.49; Fri, 01 Oct 2010 04:57:51 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of viresh.kumar@st.com) client-ip=207.126.144.135; Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob113.postini.com ([207.126.147.11]) with SMTP ID DSNKTKXMve0YBWXm7dfGt7oS7094SmAlRpRU@postini.com; Fri, 01 Oct 2010 11:57:51 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0E13795; Fri, 1 Oct 2010 11:57:42 +0000 (GMT) Received: from mail2.dlh.st.com (mail2.dlh.st.com [10.199.8.22]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 15A312642; Fri, 1 Oct 2010 11:57:40 +0000 (GMT) Received: from localhost (dlhl0509.dlh.st.com [10.199.7.86]) by mail2.dlh.st.com (MOS 3.8.7a) with ESMTP id CUF00964 (AUTH viresh.kumar@st.com); Fri, 1 Oct 2010 17:27:40 +0530 (IST) From: Viresh KUMAR To: linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com, a.zummo@towertech.it Cc: Rajeev Kumar , shiraz.hashim@st.com, vipin.kumar@st.com, deepak.sikri@st.com, armando.visconti@st.com, vipulkumar.samar@st.com, pratyush.anand@st.com, bhupesh.sharma@st.com, Viresh Kumar Subject: [rtc-linux] [PATCH V2 18/69] ST SPEAr: adding support for synopsis i2c designware Date: Fri, 1 Oct 2010 17:25:38 +0530 Message-Id: X-Mailer: git-send-email 1.7.2.2 In-Reply-To: References: In-Reply-To: References: X-Original-Sender: viresh.kumar@st.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 207.126.144.135 is neither permitted nor denied by best guess record for domain of viresh.kumar@st.com) smtp.mail=viresh.kumar@st.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , From: Rajeev Kumar Signed-off-by: Rajeev Kumar Signed-off-by: Shiraz Hashim Signed-off-by: Viresh Kumar --- arch/arm/mach-spear13xx/include/mach/generic.h | 2 + arch/arm/mach-spear13xx/spear1300_evb.c | 4 +++ arch/arm/mach-spear13xx/spear13xx.c | 23 +++++++++++++++++++ arch/arm/mach-spear3xx/include/mach/generic.h | 3 ++ arch/arm/mach-spear3xx/include/mach/irqs.h | 2 +- arch/arm/mach-spear3xx/spear300_evb.c | 4 +++ arch/arm/mach-spear3xx/spear310_evb.c | 4 +++ arch/arm/mach-spear3xx/spear320.c | 24 +++++++++++++++++++- arch/arm/mach-spear3xx/spear320_evb.c | 5 ++++ arch/arm/mach-spear3xx/spear3xx.c | 22 ++++++++++++++++++ arch/arm/mach-spear6xx/include/mach/generic.h | 2 + arch/arm/mach-spear6xx/spear600_evb.c | 4 +++ arch/arm/mach-spear6xx/spear6xx.c | 22 ++++++++++++++++++ arch/arm/plat-spear/Makefile | 6 +++++ arch/arm/plat-spear/i2c_eval_board.c | 29 ++++++++++++++++++++++++ 15 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 arch/arm/plat-spear/i2c_eval_board.c diff --git a/arch/arm/mach-spear13xx/include/mach/generic.h b/arch/arm/mach-spear13xx/include/mach/generic.h index bf032f6..b0e25be 100644 --- a/arch/arm/mach-spear13xx/include/mach/generic.h +++ b/arch/arm/mach-spear13xx/include/mach/generic.h @@ -30,6 +30,7 @@ /* Add spear13xx family device structure declarations here */ extern struct amba_device spear13xx_uart_device; +extern struct platform_device spear13xx_i2c_device; extern struct platform_device spear13xx_rtc_device; extern struct sys_timer spear13xx_timer; @@ -37,6 +38,7 @@ extern struct sys_timer spear13xx_timer; /* Add spear13xx family function declarations here */ void __init clk_init(void); +void __init i2c_register_board_devices(void); void __init spear_setup_timer(void); void __init spear1300_init(void); void __init spear13xx_map_io(void); diff --git a/arch/arm/mach-spear13xx/spear1300_evb.c b/arch/arm/mach-spear13xx/spear1300_evb.c index 2fce2ec..4c72b7a 100644 --- a/arch/arm/mach-spear13xx/spear1300_evb.c +++ b/arch/arm/mach-spear13xx/spear1300_evb.c @@ -22,6 +22,7 @@ static struct amba_device *amba_devs[] __initdata = { }; static struct platform_device *plat_devs[] __initdata = { + &spear13xx_i2c_device, &spear13xx_rtc_device, }; @@ -32,6 +33,9 @@ static void __init spear1300_evb_init(void) /* call spear1300 machine init function */ spear1300_init(); + /* Register slave devices on the I2C buses */ + i2c_register_board_devices(); + /* Add Platform Devices */ platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs)); diff --git a/arch/arm/mach-spear13xx/spear13xx.c b/arch/arm/mach-spear13xx/spear13xx.c index 5de0fd9..8acf9df 100644 --- a/arch/arm/mach-spear13xx/spear13xx.c +++ b/arch/arm/mach-spear13xx/spear13xx.c @@ -24,6 +24,7 @@ #include /* Add spear13xx machines common devices here */ + /* uart device registeration */ struct amba_device spear13xx_uart_device = { .dev = { @@ -37,6 +38,28 @@ struct amba_device spear13xx_uart_device = { .irq = {IRQ_UART, NO_IRQ}, }; +/* i2c device registeration */ +static struct resource i2c_resources[] = { + { + .start = SPEAR13XX_I2C_BASE, + .end = SPEAR13XX_I2C_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = IRQ_I2C, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device spear13xx_i2c_device = { + .name = "i2c_designware", + .id = 0, + .dev = { + .coherent_dma_mask = ~0, + }, + .num_resources = ARRAY_SIZE(i2c_resources), + .resource = i2c_resources, +}; + /* rtc device registration */ static struct resource rtc_resources[] = { { diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h index 408bb8d..162f33b 100644 --- a/arch/arm/mach-spear3xx/include/mach/generic.h +++ b/arch/arm/mach-spear3xx/include/mach/generic.h @@ -33,11 +33,13 @@ /* Add spear3xx family device structure declarations here */ extern struct amba_device gpio_device; extern struct amba_device uart_device; +extern struct platform_device i2c_device; extern struct platform_device rtc_device; extern struct sys_timer spear3xx_timer; /* Add spear3xx family function declarations here */ void __init clk_init(void); +void __init i2c_register_board_devices(void); void __init spear_setup_timer(void); void __init spear3xx_map_io(void); void __init spear3xx_init_irq(void); @@ -166,6 +168,7 @@ void __init spear310_init(void); #ifdef CONFIG_MACH_SPEAR320 /* Add spear320 machine device structure declarations here */ extern struct amba_device clcd_device; +extern struct platform_device i2c1_device; extern struct platform_device plgpio_device; /* pad mux modes */ diff --git a/arch/arm/mach-spear3xx/include/mach/irqs.h b/arch/arm/mach-spear3xx/include/mach/irqs.h index f1175b9..5ad7574 100644 --- a/arch/arm/mach-spear3xx/include/mach/irqs.h +++ b/arch/arm/mach-spear3xx/include/mach/irqs.h @@ -133,7 +133,7 @@ #define VIRQ_MII1_SMII1 (VIRQ_START + 13) #define VIRQ_WAKEUP_SMII0 (VIRQ_START + 14) #define VIRQ_WAKEUP_MII1_SMII1 (VIRQ_START + 15) -#define VIRQ_I2C (VIRQ_START + 16) +#define VIRQ_I2C1 (VIRQ_START + 16) /* GPIO pins virtual irqs */ #define SPEAR_GPIO_INT_BASE (VIRQ_START + 17) diff --git a/arch/arm/mach-spear3xx/spear300_evb.c b/arch/arm/mach-spear3xx/spear300_evb.c index 392ee4a..083f65c 100644 --- a/arch/arm/mach-spear3xx/spear300_evb.c +++ b/arch/arm/mach-spear3xx/spear300_evb.c @@ -44,6 +44,7 @@ static struct amba_device *amba_devs[] __initdata = { static struct platform_device *plat_devs[] __initdata = { /* spear3xx specific devices */ + &i2c_device, &rtc_device, /* spear300 specific devices */ @@ -61,6 +62,9 @@ static void __init spear300_evb_init(void) /* call spear300 machine init function */ spear300_init(); + /* Register slave devices on the I2C buses */ + i2c_register_board_devices(); + /* Add Platform Devices */ platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs)); diff --git a/arch/arm/mach-spear3xx/spear310_evb.c b/arch/arm/mach-spear3xx/spear310_evb.c index 15ca8fc..208a68ce1 100644 --- a/arch/arm/mach-spear3xx/spear310_evb.c +++ b/arch/arm/mach-spear3xx/spear310_evb.c @@ -50,6 +50,7 @@ static struct amba_device *amba_devs[] __initdata = { static struct platform_device *plat_devs[] __initdata = { /* spear3xx specific devices */ + &i2c_device, &rtc_device, /* spear310 specific devices */ @@ -68,6 +69,9 @@ static void __init spear310_evb_init(void) /* call spear310 machine init function */ spear310_init(); + /* Register slave devices on the I2C buses */ + i2c_register_board_devices(); + /* Add Platform Devices */ platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs)); diff --git a/arch/arm/mach-spear3xx/spear320.c b/arch/arm/mach-spear3xx/spear320.c index 2e388dd..bfb21ae 100644 --- a/arch/arm/mach-spear3xx/spear320.c +++ b/arch/arm/mach-spear3xx/spear320.c @@ -409,6 +409,28 @@ static struct plgpio_platform_data plgpio_plat_data = { .gpio_count = SPEAR_PLGPIO_COUNT, }; +/* i2c1 device registeration */ +static struct resource i2c1_resources[] = { + { + .start = SPEAR320_I2C_BASE, + .end = SPEAR320_I2C_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = VIRQ_I2C1 , + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device i2c1_device = { + .name = "i2c_designware", + .id = 1, + .dev = { + .coherent_dma_mask = ~0, + }, + .num_resources = ARRAY_SIZE(i2c1_resources), + .resource = i2c1_resources, +}; + static struct resource plgpio_resources[] = { { .start = SPEAR320_SOC_CONFIG_BASE, @@ -535,7 +557,7 @@ struct shirq_dev_config shirq_intrcomm_ras_config[] = { .status_mask = WAKEUP_MII1_SMII1_IRQ_MASK, .clear_mask = WAKEUP_MII1_SMII1_IRQ_MASK, }, { - .virq = VIRQ_I2C, + .virq = VIRQ_I2C1, .status_mask = I2C1_IRQ_MASK, .clear_mask = I2C1_IRQ_MASK, }, diff --git a/arch/arm/mach-spear3xx/spear320_evb.c b/arch/arm/mach-spear3xx/spear320_evb.c index 48155cc..90d685e 100644 --- a/arch/arm/mach-spear3xx/spear320_evb.c +++ b/arch/arm/mach-spear3xx/spear320_evb.c @@ -48,9 +48,11 @@ static struct amba_device *amba_devs[] __initdata = { static struct platform_device *plat_devs[] __initdata = { /* spear3xx specific devices */ + &i2c_device, &rtc_device, /* spear320 specific devices */ + &i2c1_device, &plgpio_device, }; @@ -66,6 +68,9 @@ static void __init spear320_evb_init(void) /* call spear320 machine init function */ spear320_init(); + /* Register slave devices on the I2C buses */ + i2c_register_board_devices(); + /* Add Platform Devices */ platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs)); diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c index 64147c9..22d172b 100644 --- a/arch/arm/mach-spear3xx/spear3xx.c +++ b/arch/arm/mach-spear3xx/spear3xx.c @@ -54,6 +54,28 @@ struct amba_device uart_device = { .irq = {IRQ_UART, NO_IRQ}, }; +/* i2c device registeration */ +static struct resource i2c_resources[] = { + { + .start = SPEAR3XX_ICM1_I2C_BASE, + .end = SPEAR3XX_ICM1_I2C_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = IRQ_I2C, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device i2c_device = { + .name = "i2c_designware", + .id = 0, + .dev = { + .coherent_dma_mask = ~0, + }, + .num_resources = ARRAY_SIZE(i2c_resources), + .resource = i2c_resources, +}; + /* rtc device registration */ static struct resource rtc_resources[] = { { diff --git a/arch/arm/mach-spear6xx/include/mach/generic.h b/arch/arm/mach-spear6xx/include/mach/generic.h index 674b16c..44a2f99 100644 --- a/arch/arm/mach-spear6xx/include/mach/generic.h +++ b/arch/arm/mach-spear6xx/include/mach/generic.h @@ -32,10 +32,12 @@ extern struct amba_device clcd_device; extern struct amba_device gpio_device[]; extern struct amba_device uart_device[]; +extern struct platform_device i2c_device; extern struct platform_device rtc_device; extern struct sys_timer spear6xx_timer; /* Add spear6xx family function declarations here */ +void __init i2c_register_board_devices(void); void __init spear_setup_timer(void); void __init spear6xx_map_io(void); void __init spear6xx_init_irq(void); diff --git a/arch/arm/mach-spear6xx/spear600_evb.c b/arch/arm/mach-spear6xx/spear600_evb.c index 861e83d..6b0cf23 100644 --- a/arch/arm/mach-spear6xx/spear600_evb.c +++ b/arch/arm/mach-spear6xx/spear600_evb.c @@ -26,6 +26,7 @@ static struct amba_device *amba_devs[] __initdata = { }; static struct platform_device *plat_devs[] __initdata = { + &i2c_device, &rtc_device, }; @@ -36,6 +37,9 @@ static void __init spear600_evb_init(void) /* call spear600 machine init function */ spear600_init(); + /* Register slave devices on the I2C buses */ + i2c_register_board_devices(); + /* Add Platform Devices */ platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs)); diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear6xx/spear6xx.c index 45bc4ec..646098f 100644 --- a/arch/arm/mach-spear6xx/spear6xx.c +++ b/arch/arm/mach-spear6xx/spear6xx.c @@ -121,6 +121,28 @@ struct amba_device gpio_device[] = { } }; +/* i2c device registeration */ +static struct resource i2c_resources[] = { + { + .start = SPEAR6XX_ICM1_I2C_BASE, + .end = SPEAR6XX_ICM1_I2C_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = IRQ_I2C, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device i2c_device = { + .name = "i2c_designware", + .id = 0, + .dev = { + .coherent_dma_mask = ~0, + }, + .num_resources = ARRAY_SIZE(i2c_resources), + .resource = i2c_resources, +}; + /* rtc device registration */ static struct resource rtc_resources[] = { { diff --git a/arch/arm/plat-spear/Makefile b/arch/arm/plat-spear/Makefile index e66bc5f..c31892a 100644 --- a/arch/arm/plat-spear/Makefile +++ b/arch/arm/plat-spear/Makefile @@ -8,3 +8,9 @@ obj-y := clcd.o clock.o time.o obj-$(CONFIG_ARCH_SPEAR3XX) += shirq.o padmux.o obj-$(CONFIG_MACH_SPEAR310) += plgpio.o obj-$(CONFIG_MACH_SPEAR320) += plgpio.o + +obj-$(CONFIG_BOARD_SPEAR1300_EVB) += i2c_eval_board.o +obj-$(CONFIG_BOARD_SPEAR300_EVB) += i2c_eval_board.o +obj-$(CONFIG_BOARD_SPEAR310_EVB) += i2c_eval_board.o +obj-$(CONFIG_BOARD_SPEAR320_EVB) += i2c_eval_board.o +obj-$(CONFIG_BOARD_SPEAR600_EVB) += i2c_eval_board.o diff --git a/arch/arm/plat-spear/i2c_eval_board.c b/arch/arm/plat-spear/i2c_eval_board.c new file mode 100644 index 0000000..a2473a8 --- /dev/null +++ b/arch/arm/plat-spear/i2c_eval_board.c @@ -0,0 +1,29 @@ +/* + * arch/arm/plat-spear/i2c_eval_board.c + * + * Copyright (C) 2010 ST Microelectronics + * Rajeev Kumar + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include + +static struct i2c_board_info __initdata i2c_board_info[] = { + { + .type = "eeprom", + .addr = 0x50, + }, { + .type = "eeprom", + .addr = 0x51, + }, +}; + +void __init i2c_register_board_devices(void) +{ + i2c_register_board_info(0, i2c_board_info, + ARRAY_SIZE(i2c_board_info)); +}