[PATCH V2 0/6]
Subsystems (3)
v2 cover [PATCH V2 0/6]
Hello,
this series of patches prepares the i.mx tree for the flexcan driver. Clock support is added or adjusted. Missing defines for the base addresses and interrupts are added.
The 5th patch uses the newly introduced dynamic registration scheme to provide the flexcan devices. This patch contains two ifdefs to replace the "imx_add_flexcan()" function by a noop if the flexcan driver is not activated. This is needed to compile this series before the actual flexcan driver and it's header file have been merged. The ifdefs can be removed after merging.
The last patch registers flexcan to the pcm043.
please consider to apply.
cheers, Marc
P.S.: this can be pulled:
The following changes since commit ed300d7a8d115ef721b1f69ddf733e4c4dba4eac:
iomux-mx51: add 4 pin definitions (2010-07-22 15:19:45 +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 (5):
mx25: add flexcan address and interrupt definition
mx35: adjust flexcan clock definition
mx35: add flexcan address
imx: dynamically register flexcan devices for mx25 and mx35
pcm043: register flexcan device
Sascha Hauer (1):
mx25: flexcan clock support
PATCH v2 1/6 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
@@ -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
PATCH v2 2/6 mx25: add flexcan address and interrupt definition
In reply to Marc Kleine-Budde--- arch/arm/plat-mxc/include/mach/mx25.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/plat-mxc/include/mach/mx25.h +4 -0
@@ -13,6 +13,8 @@#define MX25_I2C1_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x80000)#define MX25_I2C3_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x84000) +#define MX25_CAN1_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x88000) +#define MX25_CAN2_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x8c000)#define MX25_I2C2_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x98000)#define MX25_CSPI1_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0xa4000)#define MX25_IOMUXC_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0xac000)
@@ -70,6 +72,8 @@#define MX25_INT_NANDFC 33#define MX25_INT_LCDC 39#define MX25_INT_UART5 40 +#define MX25_INT_CAN1 43 +#define MX25_INT_CAN2 44#define MX25_INT_UART1 45#define MX25_INT_FEC 57
Signature · 1 line
1.7.1
PATCH v2 3/6 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
@@ -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
PATCH v2 4/6 mx35: add flexcan address
In reply to Marc Kleine-Budde--- arch/arm/plat-mxc/include/mach/mx35.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/plat-mxc/include/mach/mx35.h +2 -0
@@ -60,6 +60,8 @@#define MX35_RTC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xd8000)#define MX35_WDOG_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xdc000)#define MX35_PWM_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe0000) +#define MX35_CAN1_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe4000) +#define MX35_CAN2_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe8000)#define MX35_RTIC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xec000)#define MX35_OTG_BASE_ADDR 0x53ff4000
Signature · 1 line
1.7.1
PATCH v2 5/6 imx: dynamically register flexcan devices for mx25 and mx35
In reply to Marc Kleine-BuddeIn order to make this patch compile, even if the flexcan driver with it's header defining the platform data isn't merged yet, two ifdefs have been added. They effect that the "imx_add_flexcan" function results in a no-op function if the driver hasn't been activated.
These ifdefs can be removed after the flexcan driver has been merged.
--- arch/arm/mach-mx25/devices-imx25.h | 5 ++++ arch/arm/mach-mx3/devices-imx35.h | 5 ++++ arch/arm/plat-mxc/devices/Kconfig | 4 +++ arch/arm/plat-mxc/devices/Makefile | 4 +++ arch/arm/plat-mxc/devices/platform-flexcan.c | 30 +++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/devices-common.h | 18 +++++++++++++ 6 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-mxc/devices/platform-flexcan.c
arch/arm/mach-mx25/devices-imx25.h +5 -0
@@ -9,6 +9,11 @@#include <mach/mx25.h> #include <mach/devices-common.h> +#define imx25_add_flexcan0 (pdata) \ + imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata) +#define imx25_add_flexcan1 (pdata) \ + imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata) +#define imx25_add_imx_i2c0 (pdata) \ imx_add_imx_i2c(0, MX25_I2C1_BASE_ADDR, SZ_16K, MX25_INT_I2C1, pdata)#define imx25_add_imx_i2c1 (pdata) \
arch/arm/mach-mx3/devices-imx35.h +5 -0
@@ -9,6 +9,11 @@#include <mach/mx35.h> #include <mach/devices-common.h> +#define imx35_add_flexcan0 (pdata) \ + imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata) +#define imx35_add_flexcan1 (pdata) \ + imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata) +#define imx35_add_imx_i2c0 (pdata) \ imx_add_imx_i2c(0, MX35_I2C1_BASE_ADDR, SZ_4K, MX35_INT_I2C1, pdata)#define imx35_add_imx_i2c1 (pdata) \
arch/arm/plat-mxc/devices/Kconfig +4 -0
@@ -1,3 +1,7 @@ +config IMX_HAVE_PLATFORM_FLEXCAN + select HAVE_CAN_FLEXCAN + bool + config IMX_HAVE_PLATFORM_IMX_I2C bool
arch/arm/plat-mxc/devices/Makefile +4 -0
@@ -1,3 +1,7 @@ +ifdef CONFIG_CAN_FLEXCAN +# the ifdef can be removed once the flexcan driver has been merged +obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o +endif obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
arch/arm/plat-mxc/devices/platform-flexcan.c new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright (C) 2010 Pengutronix, Marc Kleine-Budde <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it under +* the terms of the GNU General Public License version 2 as published by the +* Free Software Foundation. +*/ + +#include <mach/devices-common.h> + +struct platform_device *__init imx_add_flexcan (int id, +resource_size_t iobase,resource_size_t iosize, +resource_size_t irq, +const struct flexcan_platform_data *pdata) +{ +struct resource res[] = { + { + .start = iobase, + .end = iobase + iosize -1 , + .flags =IORESOURCE_MEM , + }, { + .start = irq, + .end = irq, + .flags =IORESOURCE_IRQ , + }, + }; + +return imx_add_platform_device ("flexcan" , id, res,ARRAY_SIZE (res), + pdata,sizeof (*pdata)); +}
arch/arm/plat-mxc/include/mach/devices-common.h +18 -0
@@ -14,6 +14,24 @@ struct platform_device *imx_add_platform_device(const char *name, int id, const struct resource *res, unsigned int num_resources, const void *data, size_t size_data); +#if defined (CONFIG_CAN_FLEXCAN ) || defined (CONFIG_CAN_FLEXCAN_MODULE ) +#include <linux/can/platform/flexcan.h> +struct platform_device *__init imx_add_flexcan (int id, +resource_size_t iobase,resource_size_t iosize, +resource_size_t irq, +const struct flexcan_platform_data *pdata); +#else +/* the ifdef can be removed once the flexcan driver has been merged */ +struct flexcan_platform_data ; +static inline struct platform_device *__init imx_add_flexcan (int id, +resource_size_t iobase,resource_size_t iosize, +resource_size_t irq, +const struct flexcan_platform_data *pdata) +{ +return NULL ; +} +#endif +#include <mach/i2c.h> struct platform_device *__init imx_add_imx_i2c(int id, resource_size_t iobase, resource_size_t iosize, int irq,
Signature · 1 line
1.7.1
PATCH v2 6/6 pcm043: register flexcan device
In reply to Marc Kleine-Budde--- arch/arm/mach-mx3/Kconfig | 1 + arch/arm/mach-mx3/mach-pcm043.c | 4 ++++ 2 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/Kconfig +1 -0
@@ -119,6 +119,7 @@ config MACH_PCM043 select IMX_HAVE_PLATFORM_IMX_I2C select IMX_HAVE_PLATFORM_IMX_UART select IMX_HAVE_PLATFORM_MXC_NAND + select IMX_HAVE_PLATFORM_FLEXCAN select MXC_ULPI if USB_ULPI help Include support for Phytec pcm043 platform. This includes
arch/arm/mach-mx3/mach-pcm043.c +4 -0
@@ -214,6 +214,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)
@@ -385,6 +388,7 @@ static void __init mxc_board_init(void)if (!otg_mode_host)mxc_register_device (&mxc_otg_udc_device, &otg_device_pdata); +imx35_add_flexcan1 (NULL ); }static void __init pcm043_timer_init (void )
Signature · 1 line
1.7.1