* [PATCH 1/2] sh: add platform_device for i2c-riic driver in
@ 2011-09-26 8:43 Yoshihiro Shimoda
2012-01-05 5:41 ` [PATCH 1/2] sh: add platform_device for SUDMAC in setup-sh7757 Shimoda, Yoshihiro
2012-01-08 23:21 ` Paul Mundt
0 siblings, 2 replies; 3+ messages in thread
From: Yoshihiro Shimoda @ 2011-09-26 8:43 UTC (permalink / raw)
To: linux-sh
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 <yoshihiro.shimoda.uh@renesas.com>
---
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(-)
diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
index fa2a208..8e6f9d7 100644
--- a/arch/sh/boards/board-sh7757lcr.c
+++ b/arch/sh/boards/board-sh7757lcr.c
@@ -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));
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 1/2] sh: add platform_device for SUDMAC in setup-sh7757
2011-09-26 8:43 [PATCH 1/2] sh: add platform_device for i2c-riic driver in Yoshihiro Shimoda
@ 2012-01-05 5:41 ` Shimoda, Yoshihiro
2012-01-08 23:21 ` Paul Mundt
1 sibling, 0 replies; 3+ messages in thread
From: Shimoda, Yoshihiro @ 2012-01-05 5:41 UTC (permalink / raw)
To: linux-sh
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
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(-)
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7757.h b/arch/sh/include/cpu-sh4/cpu/sh7757.h
index 41f9f8b..f9be40a 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7757.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7757.h
@@ -283,5 +283,6 @@ enum {
SHDMA_SLAVE_RIIC8_RX,
SHDMA_SLAVE_RIIC9_TX,
SHDMA_SLAVE_RIIC9_RX,
+ SHDMA_SLAVE_SUDMAC00,
};
#endif /* __ASM_SH7757_H__ */
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index 0555929..a3846f5 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -649,6 +649,55 @@ static struct platform_device dma3_device = {
},
};
+/* SUDMAC */
+static const struct sh_dmae_channel sh7757_sudmac_channel[] = {
+ {
+ .offset = 0,
+ .dmars = 0,
+ .dmars_bit = 0,
+ }
+};
+
+static const struct sh_dmae_slave_config sh7757_sudmac00_slaves[] = {
+ {
+ .slave_id = SHDMA_SLAVE_SUDMAC00,
+ .addr = 0xfe451000,
+ },
+};
+
+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,
+};
+
+static struct resource sh7757_sudmac00_resources[] = {
+ [0] = {
+ .start = 0xfe451000,
+ .end = 0xfe451000,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = 50,
+ .end = 50,
+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
+ },
+};
+
+static struct platform_device sudmac00_device = {
+ .name = "sh-dma-engine",
+ .id = 4,
+ .resource = sh7757_sudmac00_resources,
+ .num_resources = ARRAY_SIZE(sh7757_sudmac00_resources),
+ .dev = {
+ .platform_data = &sudmac00_platform_data,
+ },
+};
+
static struct platform_device spi0_device = {
.name = "sh_spi",
.id = 0,
@@ -718,6 +767,7 @@ static struct platform_device *sh7757_devices[] __initdata = {
&dma1_device,
&dma2_device,
&dma3_device,
+ &sudmac00_device,
&spi0_device,
&usb_ehci_device,
&usb_ohci_device,
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] sh: add platform_device for SUDMAC in setup-sh7757
2011-09-26 8:43 [PATCH 1/2] sh: add platform_device for i2c-riic driver in Yoshihiro Shimoda
2012-01-05 5:41 ` [PATCH 1/2] sh: add platform_device for SUDMAC in setup-sh7757 Shimoda, Yoshihiro
@ 2012-01-08 23:21 ` Paul Mundt
1 sibling, 0 replies; 3+ messages in thread
From: Paul Mundt @ 2012-01-08 23:21 UTC (permalink / raw)
To: linux-sh
On Thu, Jan 05, 2012 at 02:41:44PM +0900, Shimoda, Yoshihiro wrote:
> +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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-08 23:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-26 8:43 [PATCH 1/2] sh: add platform_device for i2c-riic driver in Yoshihiro Shimoda
2012-01-05 5:41 ` [PATCH 1/2] sh: add platform_device for SUDMAC in setup-sh7757 Shimoda, Yoshihiro
2012-01-08 23:21 ` Paul Mundt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).