Skip to contentSkip to conversation

sh: add platform_device for i2c-riic driver in

PATCH In review Yoshihiro Shimoda 2 participants 3 messages Sep 26, 2011 – Jan 8, 2012 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sh: add platform_device for i2c-riic driver in

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.

---
This patch depends on the following patches:
- i2c: i2c-riic: add support for Renesas RIIC
- i2c: i2c-riic: add dmaengine supporting

 arch/sh/boards/board-sh7757lcr.c |   87 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)
arch/sh/boards/board-sh7757lcr.c +87 -0
index fa2a208..8e6f9d7 100644
@@ -21,6 +21,9 @@
 #include <cpu/sh7757.h>
 #include <asm/sh_eth.h>
 #include <asm/heartbeat.h>
+#include <linux/i2c.h>
+#include <linux/i2c/riic.h>
+#include <linux/i2c/at24.h>
 
 static struct resource heartbeat_resource = {
 	.start	= 0xffec005c,	/* PUDR */
@@ -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));
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/2 sh: add platform_device for SUDMAC in setup-sh7757

---
This patch depends on the following patch:
- dmaengine: shdma: add support for SUDMAC

 arch/sh/include/cpu-sh4/cpu/sh7757.h   |    1 +
 arch/sh/kernel/cpu/sh4a/setup-sh7757.c |   50 ++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 0 deletions(-)
arch/sh/include/cpu-sh4/cpu/sh7757.h +1 -0
index 41f9f8b..f9be40a 100644
@@ -283,5 +283,6 @@ enum {
 	SHDMA_SLAVE_RIIC8_RX,
 	SHDMA_SLAVE_RIIC9_TX,
 	SHDMA_SLAVE_RIIC9_RX,
+	SHDMA_SLAVE_SUDMAC00,
 };
 #endif /* __ASM_SH7757_H__ */
arch/sh/kernel/cpu/sh4a/setup-sh7757.c +50 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 1/2] sh: add platform_device for SUDMAC in setup-sh7757

In reply to Yoshihiro Shimoda

Review

Quoted 9 lines · Yoshihiro
(quoted diff) +9 -0
+static struct sh_dmae_pdata sudmac00_platform_data = {
+	.slave		= sh7757_sudmac00_slaves,
+	.slave_num	= ARRAY_SIZE(sh7757_sudmac00_slaves),
+	.channel	= sh7757_sudmac_channel,
+	.channel_num	= 1,
+	.no_dmars	= 1,
+	.no_error_irq	= 1,
+	.sudmac		= 1,
+};

You will have to re-spin this patch with the updated support patch dropping the no_error_irq member.