Skip to contentSkip to conversation

add flexcan support to i.mx

PATCH Superseded Marc Kleine-Budde 2 participants 8 messages Jul 21, 2010 – Jul 22, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover add flexcan support to i.mx

Hello,

this series of patches prepares the i.mx tree for the flexcan driver. Clock support is added or adjusted. The last patch registers flexcan on the pcm043.

This series of patches applies to the sha's "imx/linux-2.6.git imx-for-2.6.36" tree and is available at:
git://git.pengutronix.de/git/mkl/linux-2.6.git for-imx-for-2.6.36

The actual flexcan driver is going over the net-next-2.6 tree and is currently in the (hopefully) final round of review, it is available at:
git://git.pengutronix.de/git/mkl/linux-2.6.git for-net-next-2.6

The combination (current mainline + for-net-next-2.6 + for-imx-for-2.6.36) has been successfully tested on the pcm043 (i.mx35).

please consider to apply
Cheers, Marc

P.S.: this can be pulled:

The following changes since commit 10fda3e745c337332a58ce1c43704d7af3eb79fd:

eukrea_mbimx27-baseboard: fix compile when CONFIG_SPI_IMX is disabled (2010-07-20 08:33:00 +0200)

are available in the git repository at:
git://git.pengutronix.de/git/mkl/linux-2.6.git for-imx-for-2.6.36

Marc Kleine-Budde (3):
mx35: adjust flexcan clock definition
mx35: add flexcan devices
pcm043: register flexcan device

Sascha Hauer (2):
mx25: flexcan clock support
mx25: Add flexcan devices

 arch/arm/mach-mx25/clock.c      |    4 ++
 arch/arm/mach-mx25/devices.c    |   95 +++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-mx25/devices.h    |    2 +
 arch/arm/mach-mx3/clock-imx35.c |    4 +-
 arch/arm/mach-mx3/devices.c     |   40 ++++++++++++++++
 arch/arm/mach-mx3/devices.h     |    2 +
 arch/arm/mach-mx3/mach-pcm043.c |    4 ++
 7 files changed, 149 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/5 mx25: flexcan clock support

From: Sascha Hauer <[email protected]>

---
 arch/arm/mach-mx25/clock.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/mach-mx25/clock.c +4 -0
index 02f8247..40c7cc4 100644
@@ -240,6 +240,8 @@ DEFINE_CLOCK(ssi1_clk,  0, CCM_CGCR2, 11, get_rate_ssi1, NULL, &ssi1_per_clk);
 DEFINE_CLOCK(ssi2_clk,  1, CCM_CGCR2, 12, get_rate_ssi2, NULL, &ssi2_per_clk);
 DEFINE_CLOCK(audmux_clk, 0, CCM_CGCR1, 0, NULL, NULL, NULL);
 DEFINE_CLOCK(csi_clk,    0, CCM_CGCR1,  4, get_rate_csi, NULL,  &csi_per_clk);
+DEFINE_CLOCK(can1_clk,	 0, CCM_CGCR1,  2, get_rate_ipg, NULL, NULL);
+DEFINE_CLOCK(can2_clk,	 0, CCM_CGCR1,  3, get_rate_ipg, NULL, NULL);
 
 #define _REGISTER_CLOCK(d, n, c)	\
 	{				\
@@ -279,6 +281,8 @@ static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
 	_REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
 	_REGISTER_CLOCK(NULL, "audmux", audmux_clk)
+	_REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
+	_REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
 };
 
 int __init mx25_clocks_init(void)
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/5 mx25: Add flexcan devices

In reply to Marc Kleine-Budde

From: Sascha Hauer <[email protected]>

---
 arch/arm/mach-mx25/devices.c |   95 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-mx25/devices.h |    2 +
 2 files changed, 97 insertions(+), 0 deletions(-)
arch/arm/mach-mx25/devices.c +95 -0
index 3468eb1..ecff519 100644
@@ -179,6 +179,101 @@ struct platform_device mxc_pwm_device3 = {
 	.resource = mxc_pwm_resources3,
 };
 
+static struct resource mxc_i2c_1_resources[] = {
+	{
+		.start	= 0x43f80000,
+		.end	= 0x43f83fff,
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= 3,
+		.end	= 3,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device mxc_i2c_device0 = {
+	.name = "imx-i2c",
+	.id = 0,
+	.num_resources = ARRAY_SIZE(mxc_i2c_1_resources),
+	.resource = mxc_i2c_1_resources,
+};
+
+static struct resource mxc_i2c_2_resources[] = {
+	{
+		.start	= 0x43f98000,
+		.end	= 0x43f9bfff,
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= 4,
+		.end	= 4,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device mxc_i2c_device1 = {
+	.name = "imx-i2c",
+	.id = 1,
+	.num_resources = ARRAY_SIZE(mxc_i2c_2_resources),
+	.resource = mxc_i2c_2_resources,
+};
+
+static struct resource mxc_i2c_3_resources[] = {
+	{
+		.start	= 0x43f84000,
+		.end	= 0x43f87fff,
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= 10,
+		.end	= 10,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device mxc_i2c_device2 = {
+	.name = "imx-i2c",
+	.id = 2,
+	.num_resources = ARRAY_SIZE(mxc_i2c_3_resources),
+	.resource = mxc_i2c_3_resources,
+};
+
+static struct resource mxc_can_1_resources[] = {
+	{
+		.start	= 0x43f88000,
+		.end	= 0x43f8bfff,
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= 43,
+		.end	= 43,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device mxc_can_device0 = {
+	.name = "flexcan",
+	.id = 0,
+	.num_resources = ARRAY_SIZE(mxc_can_1_resources),
+	.resource = mxc_can_1_resources,
+};
+
+static struct resource mxc_can_2_resources[] = {
+	{
+		.start	= 0x43f8c000,
+		.end	= 0x43f8ffff,
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= 44,
+		.end	= 44,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device mxc_can_device1 = {
+	.name = "flexcan",
+	.id = 1,
+	.num_resources = ARRAY_SIZE(mxc_can_2_resources),
+	.resource = mxc_can_2_resources,
+};
+
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	{
 		.chip.label = "gpio-0",
arch/arm/mach-mx25/devices.h +2 -0
index 4aceb68..66b72b1 100644
@@ -14,3 +14,5 @@ extern struct platform_device mx25_kpp_device;
 extern struct platform_device imx_ssi_device0;
 extern struct platform_device imx_ssi_device1;
 extern struct platform_device mx25_csi_device;
+extern struct platform_device mxc_can_device0;
+extern struct platform_device mxc_can_device1;
Signature · 1 line
1.7.1
#3 lore raw

PATCH 2/5 mx25: Add flexcan devices

Marc,

--- On Wed, 7/21/10, Marc Kleine-Budde <[email protected]> wrote:
...

Quoted 4 lines

+static struct resource mxc_i2c_1_resources[] = {
+??? {
+??? ???

Shouldn't the inclusion of i2c be handled by a separate patch?

Regards,

Fabio Estevam

#4 lore raw

PATCH 2/5 mx25: Add flexcan devices

Quoted 10 lines · Fabio Estevam

Marc,

--- On Wed, 7/21/10, Marc Kleine-Budde <[email protected]> wrote:
...

arch/arm/mach-mx25/devices.c struct platform_device mxc_pwm_device3 = { · line 193

Quoted 4 lines
arch/arm/mach-mx25/devices.c +3 -0
+static struct resource mxc_i2c_1_resources[] = {
+    {
+       

Shouldn't the inclusion of i2c be handled by a separate patch?

doh! It seems I've handled a rebase conflict wrong.

Thanks for catching this,
Marc

Signature · 12 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100722/5ef95746/attachment.sig>
#5 lore raw

PATCH 3/5 mx35: adjust flexcan clock definition

In reply to Marc Kleine-Budde
---
 arch/arm/mach-mx3/clock-imx35.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-mx3/clock-imx35.c +2 -2
index 28be011..d3af0fd 100644
@@ -428,8 +428,8 @@ static struct clk nfc_clk = {
 static struct clk_lookup lookups[] = {
 	_REGISTER_CLOCK(NULL, "asrc", asrc_clk)
 	_REGISTER_CLOCK(NULL, "ata", ata_clk)
-	_REGISTER_CLOCK(NULL, "can", can1_clk)
-	_REGISTER_CLOCK(NULL, "can", can2_clk)
+	_REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
+	_REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
 	_REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk)
 	_REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk)
 	_REGISTER_CLOCK(NULL, "ect", ect_clk)
Signature · 1 line
1.7.1
#6 lore raw

PATCH 4/5 mx35: add flexcan devices

In reply to Marc Kleine-Budde
---
 arch/arm/mach-mx3/devices.c |   40 ++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-mx3/devices.h |    2 ++
 2 files changed, 42 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/devices.c +40 -0
index a4fd1a2..a8aa157 100644
@@ -29,6 +29,46 @@
 
 #include "devices.h"
 
+#ifdef CONFIG_ARCH_MX35
+static struct resource mxc_can_1_resources[] = {
+	{
+		.start	= 0x53fe4000,
+		.end	= 0x53fe7fff,
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= 43,
+		.end	= 43,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device mxc_can_device0 = {
+	.name = "flexcan",
+	.id = 0,
+	.num_resources = ARRAY_SIZE(mxc_can_1_resources),
+	.resource = mxc_can_1_resources,
+};
+
+static struct resource mxc_can_2_resources[] = {
+	{
+		.start	= 0x53fe8000,
+		.end	= 0x53feffff,
+		.flags	= IORESOURCE_MEM,
+	}, {
+		.start	= 44,
+		.end	= 44,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+struct platform_device mxc_can_device1 = {
+	.name = "flexcan",
+	.id = 1,
+	.num_resources = ARRAY_SIZE(mxc_can_2_resources),
+	.resource = mxc_can_2_resources,
+};
+#endif /* CONFIG_ARCH_MX35 */
+
 /* GPIO port description */
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	{
arch/arm/mach-mx3/devices.h +2 -0
index e553523..c92bc91 100644
@@ -16,3 +16,5 @@ extern struct platform_device imx_ssi_device1;
 extern struct platform_device imx_wdt_device0;
 extern struct platform_device imx_rtc_device0;
 extern struct platform_device imx_kpp_device;
+extern struct platform_device mxc_can_device0;
+extern struct platform_device mxc_can_device1;
Signature · 1 line
1.7.1
#7 lore raw

PATCH 5/5 pcm043: register flexcan device

In reply to Marc Kleine-Budde
---
 arch/arm/mach-mx3/mach-pcm043.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/mach-pcm043.c +4 -0
index b92f624..73d33af 100644
@@ -143,6 +143,7 @@ static struct platform_device *devices[] __initdata = {
 	&pcm043_flash,
 	&mxc_fec_device,
 	&imx_wdt_device0,
+	&mxc_can_device1,
 };
 
 static struct pad_desc pcm043_pads[] = {
@@ -214,6 +215,9 @@ static struct pad_desc pcm043_pads[] = {
 	MX35_PAD_STXD4__AUDMUX_AUD4_TXD,
 	MX35_PAD_SRXD4__AUDMUX_AUD4_RXD,
 	MX35_PAD_SCK4__AUDMUX_AUD4_TXC,
+	/* CAN2 */
+	MX35_PAD_TX5_RX0__CAN2_TXCAN,
+	MX35_PAD_TX4_RX1__CAN2_RXCAN,
 };
 
 #define AC97_GPIO_TXFS	(1 * 32 + 31)
Signature · 1 line
1.7.1