2008-11-14 05:01:38 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
|
|
|
|
* Copyright 2008 Sascha Hauer, kernel@pengutronix.de
|
|
|
|
* Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
|
2008-11-14 05:01:38 -05:00
|
|
|
* Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt>
|
2008-11-14 05:01:38 -05:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/gpio.h>
|
2009-01-29 04:07:50 -05:00
|
|
|
#include <mach/irqs.h>
|
2008-11-14 05:01:38 -05:00
|
|
|
#include <mach/hardware.h>
|
|
|
|
|
2009-01-29 10:00:23 -05:00
|
|
|
#include "devices.h"
|
|
|
|
|
2008-11-14 05:01:38 -05:00
|
|
|
static struct resource imx_csi_resources[] = {
|
2009-06-23 06:14:39 -04:00
|
|
|
{
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = 0x00224000,
|
|
|
|
.end = 0x00224010,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = CSI_INT,
|
|
|
|
.end = CSI_INT,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static u64 imx_csi_dmamask = 0xffffffffUL;
|
|
|
|
|
|
|
|
struct platform_device imx_csi_device = {
|
2009-04-03 09:34:05 -04:00
|
|
|
.name = "mx1-camera",
|
2008-11-14 05:01:38 -05:00
|
|
|
.id = 0, /* This is used to put cameras on this interface */
|
|
|
|
.dev = {
|
|
|
|
.dma_mask = &imx_csi_dmamask,
|
|
|
|
.coherent_dma_mask = 0xffffffff,
|
|
|
|
},
|
|
|
|
.resource = imx_csi_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(imx_csi_resources),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource imx_i2c_resources[] = {
|
2009-06-23 06:14:39 -04:00
|
|
|
{
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = 0x00217000,
|
|
|
|
.end = 0x00217010,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = I2C_INT,
|
|
|
|
.end = I2C_INT,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
struct platform_device imx_i2c_device = {
|
|
|
|
.name = "imx-i2c",
|
|
|
|
.id = 0,
|
|
|
|
.resource = imx_i2c_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(imx_i2c_resources),
|
|
|
|
};
|
|
|
|
|
2008-11-14 05:01:38 -05:00
|
|
|
static struct resource imx_uart1_resources[] = {
|
2009-06-23 06:14:39 -04:00
|
|
|
{
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = UART1_BASE_ADDR,
|
|
|
|
.end = UART1_BASE_ADDR + 0xD0,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = UART1_MINT_RX,
|
|
|
|
.end = UART1_MINT_RX,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = UART1_MINT_TX,
|
|
|
|
.end = UART1_MINT_TX,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = UART1_MINT_RTS,
|
|
|
|
.end = UART1_MINT_RTS,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
struct platform_device imx_uart1_device = {
|
|
|
|
.name = "imx-uart",
|
|
|
|
.id = 0,
|
|
|
|
.num_resources = ARRAY_SIZE(imx_uart1_resources),
|
|
|
|
.resource = imx_uart1_resources,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource imx_uart2_resources[] = {
|
2009-06-23 06:14:39 -04:00
|
|
|
{
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = UART2_BASE_ADDR,
|
|
|
|
.end = UART2_BASE_ADDR + 0xD0,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = UART2_MINT_RX,
|
|
|
|
.end = UART2_MINT_RX,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = UART2_MINT_TX,
|
|
|
|
.end = UART2_MINT_TX,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = UART2_MINT_RTS,
|
|
|
|
.end = UART2_MINT_RTS,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
struct platform_device imx_uart2_device = {
|
|
|
|
.name = "imx-uart",
|
|
|
|
.id = 1,
|
|
|
|
.num_resources = ARRAY_SIZE(imx_uart2_resources),
|
|
|
|
.resource = imx_uart2_resources,
|
|
|
|
};
|
|
|
|
|
2008-11-14 05:01:38 -05:00
|
|
|
static struct resource imx_rtc_resources[] = {
|
2009-06-23 06:14:39 -04:00
|
|
|
{
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = 0x00204000,
|
|
|
|
.end = 0x00204024,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = RTC_INT,
|
|
|
|
.end = RTC_INT,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = RTC_SAMINT,
|
|
|
|
.end = RTC_SAMINT,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
struct platform_device imx_rtc_device = {
|
|
|
|
.name = "rtc-imx",
|
|
|
|
.id = 0,
|
|
|
|
.resource = imx_rtc_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(imx_rtc_resources),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource imx_wdt_resources[] = {
|
2009-06-23 06:14:39 -04:00
|
|
|
{
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = 0x00201000,
|
|
|
|
.end = 0x00201008,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = WDT_INT,
|
|
|
|
.end = WDT_INT,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
struct platform_device imx_wdt_device = {
|
|
|
|
.name = "imx-wdt",
|
|
|
|
.id = 0,
|
|
|
|
.resource = imx_wdt_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(imx_wdt_resources),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource imx_usb_resources[] = {
|
2009-06-23 06:14:39 -04:00
|
|
|
{
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = 0x00212000,
|
|
|
|
.end = 0x00212148,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = USBD_INT0,
|
|
|
|
.end = USBD_INT0,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = USBD_INT1,
|
|
|
|
.end = USBD_INT1,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = USBD_INT2,
|
|
|
|
.end = USBD_INT2,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = USBD_INT3,
|
|
|
|
.end = USBD_INT3,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = USBD_INT4,
|
|
|
|
.end = USBD_INT4,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = USBD_INT5,
|
|
|
|
.end = USBD_INT5,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2009-06-23 06:14:39 -04:00
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.start = USBD_INT6,
|
|
|
|
.end = USBD_INT6,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
struct platform_device imx_usb_device = {
|
|
|
|
.name = "imx_udc",
|
|
|
|
.id = 0,
|
|
|
|
.num_resources = ARRAY_SIZE(imx_usb_resources),
|
|
|
|
.resource = imx_usb_resources,
|
|
|
|
};
|
|
|
|
|
2008-11-14 05:01:38 -05:00
|
|
|
/* GPIO port description */
|
|
|
|
static struct mxc_gpio_port imx_gpio_ports[] = {
|
2009-06-23 06:14:39 -04:00
|
|
|
{
|
2008-11-14 05:01:38 -05:00
|
|
|
.chip.label = "gpio-0",
|
|
|
|
.base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR),
|
|
|
|
.irq = GPIO_INT_PORTA,
|
2009-06-23 06:14:39 -04:00
|
|
|
.virtual_irq_start = MXC_GPIO_IRQ_START,
|
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.chip.label = "gpio-1",
|
|
|
|
.base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100),
|
|
|
|
.irq = GPIO_INT_PORTB,
|
2009-06-23 06:14:39 -04:00
|
|
|
.virtual_irq_start = MXC_GPIO_IRQ_START + 32,
|
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.chip.label = "gpio-2",
|
|
|
|
.base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200),
|
|
|
|
.irq = GPIO_INT_PORTC,
|
2009-06-23 06:14:39 -04:00
|
|
|
.virtual_irq_start = MXC_GPIO_IRQ_START + 64,
|
|
|
|
}, {
|
2008-11-14 05:01:38 -05:00
|
|
|
.chip.label = "gpio-3",
|
|
|
|
.base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300),
|
|
|
|
.irq = GPIO_INT_PORTD,
|
2009-06-23 06:14:39 -04:00
|
|
|
.virtual_irq_start = MXC_GPIO_IRQ_START + 96,
|
2008-11-14 05:01:38 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
int __init mxc_register_gpios(void)
|
|
|
|
{
|
|
|
|
return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
|
|
|
|
}
|