From patchwork Fri Jul 1 01:01:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 933912 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6110kuA001529 for ; Fri, 1 Jul 2011 01:01:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754367Ab1GABBF (ORCPT ); Thu, 30 Jun 2011 21:01:05 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:36780 "EHLO relmlor2.renesas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753687Ab1GABBE (ORCPT ); Thu, 30 Jun 2011 21:01:04 -0400 Received: from relmlir2.idc.renesas.com ([10.200.68.152]) by relmlor2.idc.renesas.com ( SJSMS) with ESMTP id <0LNM00829QTRSA10@relmlor2.idc.renesas.com> for linux-sh@vger.kernel.org; Fri, 01 Jul 2011 10:01:03 +0900 (JST) Received: from relmlac2.idc.renesas.com ([10.200.69.22]) by relmlir2.idc.renesas.com ( SJSMS) with ESMTP id <0LNM00CUAQTRBM90@relmlir2.idc.renesas.com> for linux-sh@vger.kernel.org; Fri, 01 Jul 2011 10:01:03 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 39DE628088; Fri, 01 Jul 2011 10:01:03 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 306D328070; Fri, 01 Jul 2011 10:01:03 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac2.idc.renesas.com with ESMTP id LAD14278; Fri, 01 Jul 2011 10:01:03 +0900 X-IronPort-AV: E=Sophos; i="4.65,455,1304262000"; d="scan'208"; a="34754848" Received: from unknown (HELO [172.30.8.157]) ([172.30.8.157]) by relmlii2.idc.renesas.com with ESMTP; Fri, 01 Jul 2011 10:01:03 +0900 Message-id: <4E0D1C4E.5000803@renesas.com> Date: Fri, 01 Jul 2011 10:01:02 +0900 From: Yoshihiro Shimoda User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-version: 1.0 To: Paul Mundt Cc: SH-Linux Subject: [PATCH] sh: add for i2c-riic driver in board-sh7757lcr Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 01 Jul 2011 01:01:05 +0000 (UTC) This patch adds the platform_device of i2c-riic driver and the i2c_board_info for the board. This patch also adds the enabling the DMAC for RIIC (DMAER2). This register is contained in the SH7757 only. the dmaengine doesn't handle it. So, it is enabled on the board initialize. Signed-off-by: Yoshihiro Shimoda --- arch/sh/boards/board-sh7757lcr.c | 87 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 87 insertions(+), 0 deletions(-) diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c index fa2a208..00bfcc6 100644 --- a/arch/sh/boards/board-sh7757lcr.c +++ b/arch/sh/boards/board-sh7757lcr.c @@ -18,6 +18,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -260,6 +263,60 @@ static struct platform_device sdhi_device = { }, }; +struct riic_platform_data riic2_pdata = { + .clock = 400, + .dma_tx = { + .slave_id = SHDMA_SLAVE_RIIC2_TX, + }, + .dma_rx = { + .slave_id = SHDMA_SLAVE_RIIC2_RX, + }, +}; + +static struct resource riic2_resources[] = { + { + .start = 0xfe520000, + .end = 0xfe5200ff, + .flags = IORESOURCE_MEM, + }, { + .start = 160, + .flags = IORESOURCE_IRQ, + } +}; + +static struct platform_device riic2_device = { + .name = "i2c-riic", + .id = 2, + .num_resources = ARRAY_SIZE(riic2_resources), + .resource = riic2_resources, + .dev = { + .platform_data = &riic2_pdata, + }, +}; + +/* We don't use DMA on the channel because LM75 donen't use large data. */ +struct riic_platform_data riic3_pdata = { + .clock = 400, +}; + +static struct resource riic3_resources[] = { + { + .start = 0xfe530000, + .end = 0xfe5300ff, + .flags = IORESOURCE_MEM, + } +}; + +static struct platform_device riic3_device = { + .name = "i2c-riic", + .id = 3, + .num_resources = ARRAY_SIZE(riic3_resources), + .resource = riic3_resources, + .dev = { + .platform_data = &riic3_pdata, + }, +}; + static struct platform_device *sh7757lcr_devices[] __initdata = { &heartbeat_device, &sh7757_eth0_device, @@ -268,6 +325,8 @@ static struct platform_device *sh7757lcr_devices[] __initdata = { &sh7757_eth_giga1_device, &sh_mmcif_device, &sdhi_device, + &riic2_device, + &riic3_device, }; static struct flash_platform_data spi_flash_data = { @@ -285,6 +344,26 @@ static struct spi_board_info spi_board_info[] = { }, }; +static struct at24_platform_data sh7757_at24_platdata = { + .byte_len = 8192, + .page_size = 64, + .flags = AT24_FLAG_ADDR16, +}; + +static struct i2c_board_info __initdata riic2_board_devices[] = { + { + I2C_BOARD_INFO("24c64", 0x50), + .platform_data = &sh7757_at24_platdata, + }, +}; + +static struct i2c_board_info __initdata riic3_board_devices[] = { + { + I2C_BOARD_INFO("lm75", 0x4f), + }, +}; + +#define DMAER2 0xfffa0000 static int __init sh7757lcr_devices_setup(void) { /* RGMII (PTA) */ @@ -517,6 +596,14 @@ static int __init sh7757lcr_devices_setup(void) spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); + i2c_register_board_info(2, riic2_board_devices, + ARRAY_SIZE(riic2_board_devices)); + i2c_register_board_info(3, riic3_board_devices, + ARRAY_SIZE(riic3_board_devices)); + + /* Enable RIIC's DMA */ + __raw_writel(0x000003ff, DMAER2); + /* General platform */ return platform_add_devices(sh7757lcr_devices, ARRAY_SIZE(sh7757lcr_devices));