Commit c11c2217 authored by dmitry pervushin's avatar dmitry pervushin Committed by Russell King

[ARM] 5539/1: Freescale STMP: onboard devices declaration

Define onboard devices for Freescale STMP3xxx boards
Signed-off-by: default avatardmitry pervushin <dpervushin@embeddedalley.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent a50808b6
......@@ -19,6 +19,7 @@
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/irq.h>
#include <linux/dma-mapping.h>
#include <asm/dma.h>
#include <asm/setup.h>
......@@ -39,6 +40,8 @@
#include <mach/regs-icoll.h>
#include <mach/regs-apbh.h>
#include <mach/regs-apbx.h>
#include <mach/regs-pxp.h>
#include <mach/regs-i2c.h>
#include "stmp378x.h"
/*
......@@ -232,6 +235,64 @@ static struct map_desc stmp378x_io_desc[] __initdata = {
},
};
static u64 common_dmamask = DMA_BIT_MASK(32);
/*
* devices that are present only on stmp378x, not on all 3xxx boards:
* PxP
* I2C
*/
static struct resource pxp_resource[] = {
{
.flags = IORESOURCE_MEM,
.start = REGS_PXP_PHYS,
.end = REGS_PXP_PHYS + REGS_PXP_SIZE,
}, {
.flags = IORESOURCE_IRQ,
.start = IRQ_PXP,
.end = IRQ_PXP,
},
};
struct platform_device stmp378x_pxp = {
.name = "stmp3xxx-pxp",
.id = -1,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.num_resources = ARRAY_SIZE(pxp_resource),
.resource = pxp_resource,
};
static struct resource i2c_resources[] = {
{
.flags = IORESOURCE_IRQ,
.start = IRQ_I2C_ERROR,
.end = IRQ_I2C_ERROR,
}, {
.flags = IORESOURCE_MEM,
.start = REGS_I2C_PHYS,
.end = REGS_I2C_PHYS + REGS_I2C_SIZE,
}, {
.flags = IORESOURCE_DMA,
.start = STMP3XXX_DMA(3, STMP3XXX_BUS_APBX),
.end = STMP3XXX_DMA(3, STMP3XXX_BUS_APBX),
},
};
struct platform_device stmp378x_i2c = {
.name = "i2c_stmp3xxx",
.id = 0,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.resource = i2c_resources,
.num_resources = ARRAY_SIZE(i2c_resources),
};
void __init stmp378x_map_io(void)
{
iotable_init(stmp378x_io_desc, ARRAY_SIZE(stmp378x_io_desc));
......
......@@ -21,4 +21,5 @@
void stmp378x_map_io(void);
void stmp378x_init_irq(void);
extern struct platform_device stmp378x_pxp, stmp378x_i2c;
#endif /* __MACH_STMP378X_COMMON_H */
......@@ -17,7 +17,12 @@
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/spi/spi.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
......@@ -25,12 +30,39 @@
#include <mach/pins.h>
#include <mach/pinmux.h>
#include <mach/platform.h>
#include <mach/stmp3xxx.h>
#include <mach/mmc.h>
#include <mach/gpmi.h>
#include "stmp378x.h"
static struct platform_device *devices[] = {
&stmp3xxx_dbguart,
&stmp3xxx_appuart,
&stmp3xxx_watchdog,
&stmp3xxx_touchscreen,
&stmp3xxx_rtc,
&stmp3xxx_keyboard,
&stmp3xxx_framebuffer,
&stmp3xxx_backlight,
&stmp3xxx_rotdec,
&stmp3xxx_persistent,
&stmp3xxx_dcp_bootstream,
&stmp3xxx_dcp,
&stmp3xxx_battery,
&stmp378x_pxp,
&stmp378x_i2c,
};
static struct pin_desc i2c_pins_desc[] = {
{ PINID_I2C_SCL, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_I2C_SDA, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
};
static struct pin_group i2c_pins = {
.pins = i2c_pins_desc,
.nr_pins = ARRAY_SIZE(i2c_pins_desc),
};
static struct pin_desc dbguart_pins_0[] = {
......@@ -56,6 +88,215 @@ static int dbguart_pins_control(int id, int request)
return r;
}
static struct pin_desc appuart_pins_0[] = {
{ PINID_AUART1_CTS, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
{ PINID_AUART1_RTS, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
{ PINID_AUART1_RX, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
{ PINID_AUART1_TX, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
};
static struct pin_desc appuart_pins_1[] = {
#if 0 /* enable these when second appuart will be connected */
{ PINID_AUART2_CTS, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
{ PINID_AUART2_RTS, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
{ PINID_AUART2_RX, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
{ PINID_AUART2_TX, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
#endif
};
static struct pin_desc mmc_pins_desc[] = {
{ PINID_SSP1_DATA0, PIN_FUN1, PIN_8MA, PIN_3_3V, 1 },
{ PINID_SSP1_DATA1, PIN_FUN1, PIN_8MA, PIN_3_3V, 1 },
{ PINID_SSP1_DATA2, PIN_FUN1, PIN_8MA, PIN_3_3V, 1 },
{ PINID_SSP1_DATA3, PIN_FUN1, PIN_8MA, PIN_3_3V, 1 },
{ PINID_SSP1_CMD, PIN_FUN1, PIN_8MA, PIN_3_3V, 1 },
{ PINID_SSP1_SCK, PIN_FUN1, PIN_8MA, PIN_3_3V, 0 },
{ PINID_SSP1_DETECT, PIN_FUN1, PIN_8MA, PIN_3_3V, 0 },
};
static struct pin_group mmc_pins = {
.pins = mmc_pins_desc,
.nr_pins = ARRAY_SIZE(mmc_pins_desc),
};
static int stmp3xxxmmc_get_wp(void)
{
return gpio_get_value(PINID_PWM4);
}
static int stmp3xxxmmc_hw_init_ssp1(void)
{
int ret;
ret = stmp3xxx_request_pin_group(&mmc_pins, "mmc");
if (ret)
goto out;
/* Configure write protect GPIO pin */
ret = gpio_request(PINID_PWM4, "mmc wp");
if (ret)
goto out_wp;
gpio_direction_input(PINID_PWM4);
/* Configure POWER pin as gpio to drive power to MMC slot */
ret = gpio_request(PINID_PWM3, "mmc power");
if (ret)
goto out_power;
gpio_direction_output(PINID_PWM3, 0);
mdelay(100);
return 0;
out_power:
gpio_free(PINID_PWM4);
out_wp:
stmp3xxx_release_pin_group(&mmc_pins, "mmc");
out:
return ret;
}
static void stmp3xxxmmc_hw_release_ssp1(void)
{
gpio_free(PINID_PWM3);
gpio_free(PINID_PWM4);
stmp3xxx_release_pin_group(&mmc_pins, "mmc");
}
static void stmp3xxxmmc_cmd_pullup_ssp1(int enable)
{
stmp3xxx_pin_pullup(PINID_SSP1_CMD, enable, "mmc");
}
static unsigned long
stmp3xxxmmc_setclock_ssp1(void __iomem *base, unsigned long hz)
{
struct clk *ssp, *parent;
char *p;
long r;
ssp = clk_get(NULL, "ssp");
/* using SSP1, no timeout, clock rate 1 */
writel(BF(2, SSP_TIMING_CLOCK_DIVIDE) |
BF(0xFFFF, SSP_TIMING_TIMEOUT),
base + HW_SSP_TIMING);
p = (hz > 1000000) ? "io" : "osc_24M";
parent = clk_get(NULL, p);
clk_set_parent(ssp, parent);
r = clk_set_rate(ssp, 2 * hz / 1000);
clk_put(parent);
clk_put(ssp);
return hz;
}
static struct stmp3xxxmmc_platform_data mmc_data = {
.hw_init = stmp3xxxmmc_hw_init_ssp1,
.hw_release = stmp3xxxmmc_hw_release_ssp1,
.get_wp = stmp3xxxmmc_get_wp,
.cmd_pullup = stmp3xxxmmc_cmd_pullup_ssp1,
.setclock = stmp3xxxmmc_setclock_ssp1,
};
static struct pin_group appuart_pins[] = {
[0] = {
.pins = appuart_pins_0,
.nr_pins = ARRAY_SIZE(appuart_pins_0),
},
[1] = {
.pins = appuart_pins_1,
.nr_pins = ARRAY_SIZE(appuart_pins_1),
},
};
static struct pin_desc ssp1_pins_desc[] = {
{ PINID_SSP1_SCK, PIN_FUN1, PIN_8MA, PIN_3_3V, 0, },
{ PINID_SSP1_CMD, PIN_FUN1, PIN_4MA, PIN_3_3V, 0, },
{ PINID_SSP1_DATA0, PIN_FUN1, PIN_4MA, PIN_3_3V, 0, },
{ PINID_SSP1_DATA3, PIN_FUN1, PIN_4MA, PIN_3_3V, 0, },
};
static struct pin_desc ssp2_pins_desc[] = {
{ PINID_GPMI_WRN, PIN_FUN3, PIN_8MA, PIN_3_3V, 0, },
{ PINID_GPMI_RDY1, PIN_FUN3, PIN_4MA, PIN_3_3V, 0, },
{ PINID_GPMI_D00, PIN_FUN3, PIN_4MA, PIN_3_3V, 0, },
{ PINID_GPMI_D03, PIN_FUN3, PIN_4MA, PIN_3_3V, 0, },
};
static struct pin_group ssp1_pins = {
.pins = ssp1_pins_desc,
.nr_pins = ARRAY_SIZE(ssp1_pins_desc),
};
static struct pin_group ssp2_pins = {
.pins = ssp1_pins_desc,
.nr_pins = ARRAY_SIZE(ssp2_pins_desc),
};
static struct pin_desc gpmi_pins_desc[] = {
{ PINID_GPMI_CE0N, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_CE1N, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GMPI_CE2N, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_CLE, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_ALE, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_WPN, PIN_FUN1, PIN_12MA, PIN_3_3V, 0 },
{ PINID_GPMI_RDY1, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_D00, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_D01, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_D02, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_D03, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_D04, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_D05, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_D06, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_D07, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_RDY0, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_RDY2, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_RDY3, PIN_FUN1, PIN_4MA, PIN_3_3V, 0 },
{ PINID_GPMI_WRN, PIN_FUN1, PIN_12MA, PIN_3_3V, 0 },
{ PINID_GPMI_RDN, PIN_FUN1, PIN_12MA, PIN_3_3V, 0 },
};
static struct pin_group gpmi_pins = {
.pins = gpmi_pins_desc,
.nr_pins = ARRAY_SIZE(gpmi_pins_desc),
};
static struct mtd_partition gpmi_partitions[] = {
[0] = {
.name = "boot",
.size = 10 * SZ_1M,
.offset = 0,
},
[1] = {
.name = "data",
.size = MTDPART_SIZ_FULL,
.offset = MTDPART_OFS_APPEND,
},
};
static struct gpmi_platform_data gpmi_data = {
.pins = &gpmi_pins,
.nr_parts = ARRAY_SIZE(gpmi_partitions),
.parts = gpmi_partitions,
.part_types = { "cmdline", NULL },
};
static struct spi_board_info spi_board_info[] __initdata = {
#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
{
.modalias = "enc28j60",
.max_speed_hz = 6 * 1000 * 1000,
.bus_num = 1,
.chip_select = 0,
.platform_data = NULL,
},
#endif
};
static void __init stmp378x_devb_init(void)
{
stmp3xxx_pinmux_init(NR_REAL_IRQS);
......@@ -64,9 +305,22 @@ static void __init stmp378x_devb_init(void)
stmp3xxx_init();
stmp3xxx_dbguart.dev.platform_data = dbguart_pins_control;
stmp3xxx_appuart.dev.platform_data = appuart_pins;
stmp3xxx_mmc.dev.platform_data = &mmc_data;
stmp3xxx_gpmi.dev.platform_data = &gpmi_data;
stmp3xxx_spi1.dev.platform_data = &ssp1_pins;
stmp3xxx_spi2.dev.platform_data = &ssp2_pins;
stmp378x_i2c.dev.platform_data = &i2c_pins;
/* register spi devices */
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
/* add board's devices */
platform_add_devices(devices, ARRAY_SIZE(devices));
/* add devices selected by command line ssp1= and ssp2= options */
stmp3xxx_ssp1_device_register();
stmp3xxx_ssp2_device_register();
}
MACHINE_START(STMP378X, "STMP378X")
......
......@@ -33,6 +33,7 @@
*/
static struct platform_device *stmp37xx_devb_devices[] = {
&stmp3xxx_dbguart,
&stmp3xxx_appuart,
};
static struct pin_desc dbguart_pins_0[] = {
......@@ -40,6 +41,21 @@ static struct pin_desc dbguart_pins_0[] = {
{ PINID_PWM1, PIN_FUN3, },
};
struct pin_desc appuart_pins_0[] = {
{ PINID_UART2_CTS, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
{ PINID_UART2_RTS, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
{ PINID_UART2_RX, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
{ PINID_UART2_TX, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
};
static struct pin_group appuart_pins[] = {
[0] = {
.pins = appuart_pins_0,
.nr_pins = ARRAY_SIZE(appuart_pins_0),
},
/* 37xx has the only app uart */
};
static struct pin_group dbguart_pins[] = {
[0] = {
.pins = dbguart_pins_0,
......@@ -67,6 +83,8 @@ static void __init stmp37xx_devb_init(void)
stmp3xxx_init();
stmp3xxx_dbguart.dev.platform_data = dbguart_pins_control;
stmp3xxx_appuart.dev.platform_data = appuart_pins;
/* Add STMP37xx development board devices */
platform_add_devices(stmp37xx_devb_devices,
ARRAY_SIZE(stmp37xx_devb_devices));
......
......@@ -2,4 +2,4 @@
# Makefile for the linux kernel.
#
# Object file lists.
obj-y += core.o timer.o irq.o dma.o clock.o pinmux.o
obj-y += core.o timer.o irq.o dma.o clock.o pinmux.o devices.o
/*
* Freescale STMP37XX/STMP378X platform devices
*
* Embedded Alley Solutions, Inc <source@embeddedalley.com>
*
* Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
*/
/*
* The code contained herein is licensed under the GNU General Public
* License. You may obtain a copy of the GNU General Public License
* Version 2 or later at the following locations:
*
* http://www.opensource.org/licenses/gpl-license.html
* http://www.gnu.org/copyleft/gpl.html
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <mach/dma.h>
#include <mach/platform.h>
#include <mach/stmp3xxx.h>
#include <mach/regs-lcdif.h>
#include <mach/regs-uartapp.h>
#include <mach/regs-gpmi.h>
#include <mach/regs-usbctrl.h>
#include <mach/regs-ssp.h>
#include <mach/regs-rtc.h>
static u64 common_dmamask = DMA_BIT_MASK(32);
static struct resource appuart_resources[] = {
{
.start = IRQ_UARTAPP_INTERNAL,
.end = IRQ_UARTAPP_INTERNAL,
.flags = IORESOURCE_IRQ,
}, {
.start = IRQ_UARTAPP_RX_DMA,
.end = IRQ_UARTAPP_RX_DMA,
.flags = IORESOURCE_IRQ,
}, {
.start = IRQ_UARTAPP_TX_DMA,
.end = IRQ_UARTAPP_TX_DMA,
.flags = IORESOURCE_IRQ,
}, {
.start = REGS_UARTAPP1_PHYS,
.end = REGS_UARTAPP1_PHYS + REGS_UARTAPP_SIZE,
.flags = IORESOURCE_MEM,
}, {
/* Rx DMA channel */
.start = STMP3XXX_DMA(6, STMP3XXX_BUS_APBX),
.end = STMP3XXX_DMA(6, STMP3XXX_BUS_APBX),
.flags = IORESOURCE_DMA,
}, {
/* Tx DMA channel */
.start = STMP3XXX_DMA(7, STMP3XXX_BUS_APBX),
.end = STMP3XXX_DMA(7, STMP3XXX_BUS_APBX),
.flags = IORESOURCE_DMA,
},
};
struct platform_device stmp3xxx_appuart = {
.name = "stmp3xxx-appuart",
.id = 0,
.resource = appuart_resources,
.num_resources = ARRAY_SIZE(appuart_resources),
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
};
struct platform_device stmp3xxx_watchdog = {
.name = "stmp3xxx_wdt",
.id = -1,
};
static struct resource ts_resource[] = {
{
.flags = IORESOURCE_IRQ,
.start = IRQ_TOUCH_DETECT,
.end = IRQ_TOUCH_DETECT,
}, {
.flags = IORESOURCE_IRQ,
.start = IRQ_LRADC_CH5,
.end = IRQ_LRADC_CH5,
},
};
struct platform_device stmp3xxx_touchscreen = {
.name = "stmp3xxx_ts",
.id = -1,
.resource = ts_resource,
.num_resources = ARRAY_SIZE(ts_resource),
};
/*
* Keypad device
*/
struct platform_device stmp3xxx_keyboard = {
.name = "stmp3xxx-keyboard",
.id = -1,
};
static struct resource gpmi_resources[] = {
{
.flags = IORESOURCE_MEM,
.start = REGS_GPMI_PHYS,
.end = REGS_GPMI_PHYS + REGS_GPMI_SIZE,
}, {
.flags = IORESOURCE_IRQ,
.start = IRQ_GPMI_DMA,
.end = IRQ_GPMI_DMA,
}, {
.flags = IORESOURCE_DMA,
.start = STMP3XXX_DMA(4, STMP3XXX_BUS_APBH),
.end = STMP3XXX_DMA(8, STMP3XXX_BUS_APBH),
},
};
struct platform_device stmp3xxx_gpmi = {
.name = "gpmi",
.id = -1,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.resource = gpmi_resources,
.num_resources = ARRAY_SIZE(gpmi_resources),
};
static struct resource mmc1_resource[] = {
{
.flags = IORESOURCE_MEM,
.start = REGS_SSP1_PHYS,
.end = REGS_SSP1_PHYS + REGS_SSP_SIZE,
}, {
.flags = IORESOURCE_DMA,
.start = STMP3XXX_DMA(1, STMP3XXX_BUS_APBH),
.end = STMP3XXX_DMA(1, STMP3XXX_BUS_APBH),
}, {
.flags = IORESOURCE_IRQ,
.start = IRQ_SSP1_DMA,
.end = IRQ_SSP1_DMA,
}, {
.flags = IORESOURCE_IRQ,
.start = IRQ_SSP_ERROR,
.end = IRQ_SSP_ERROR,
},
};
struct platform_device stmp3xxx_mmc = {
.name = "stmp3xxx-mmc",
.id = 1,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.resource = mmc1_resource,
.num_resources = ARRAY_SIZE(mmc1_resource),
};
static struct resource usb_resources[] = {
{
.start = REGS_USBCTRL_PHYS,
.end = REGS_USBCTRL_PHYS + SZ_4K,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_USB_CTRL,
.end = IRQ_USB_CTRL,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device stmp3xxx_udc = {
.name = "fsl-usb2-udc",
.id = -1,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.resource = usb_resources,
.num_resources = ARRAY_SIZE(usb_resources),
};
struct platform_device stmp3xxx_ehci = {
.name = "fsl-ehci",
.id = -1,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.resource = usb_resources,
.num_resources = ARRAY_SIZE(usb_resources),
};
static struct resource rtc_resources[] = {
{
.start = REGS_RTC_PHYS,
.end = REGS_RTC_PHYS + REGS_RTC_SIZE,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_RTC_ALARM,
.end = IRQ_RTC_ALARM,
.flags = IORESOURCE_IRQ,
}, {
.start = IRQ_RTC_1MSEC,
.end = IRQ_RTC_1MSEC,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device stmp3xxx_rtc = {
.name = "stmp3xxx-rtc",
.id = -1,
.resource = rtc_resources,
.num_resources = ARRAY_SIZE(rtc_resources),
};
static struct resource ssp1_resources[] = {
{
.start = REGS_SSP1_PHYS,
.end = REGS_SSP1_PHYS + REGS_SSP_SIZE,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_SSP1_DMA,
.end = IRQ_SSP1_DMA,
.flags = IORESOURCE_IRQ,
}, {
.start = STMP3XXX_DMA(1, STMP3XXX_BUS_APBH),
.end = STMP3XXX_DMA(1, STMP3XXX_BUS_APBH),
.flags = IORESOURCE_DMA,
},
};
static struct resource ssp2_resources[] = {
{
.start = REGS_SSP2_PHYS,
.end = REGS_SSP2_PHYS + REGS_SSP_SIZE,
.flags = IORESOURCE_MEM,
}, {
.start = IRQ_SSP2_DMA,
.end = IRQ_SSP2_DMA,
.flags = IORESOURCE_IRQ,
}, {
.start = STMP3XXX_DMA(2, STMP3XXX_BUS_APBH),
.end = STMP3XXX_DMA(2, STMP3XXX_BUS_APBH),
.flags = IORESOURCE_DMA,
},
};
struct platform_device stmp3xxx_spi1 = {
.name = "stmp3xxx_ssp",
.id = 1,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.resource = ssp1_resources,
.num_resources = ARRAY_SIZE(ssp1_resources),
};
struct platform_device stmp3xxx_spi2 = {
.name = "stmp3xxx_ssp",
.id = 2,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.resource = ssp2_resources,
.num_resources = ARRAY_SIZE(ssp2_resources),
};
static struct resource fb_resource[] = {
{
.flags = IORESOURCE_IRQ,
.start = IRQ_LCDIF_DMA,
.end = IRQ_LCDIF_DMA,
}, {
.flags = IORESOURCE_IRQ,
.start = IRQ_LCDIF_ERROR,
.end = IRQ_LCDIF_ERROR,
}, {
.flags = IORESOURCE_MEM,
.start = REGS_LCDIF_PHYS,
.end = REGS_LCDIF_PHYS + REGS_LCDIF_SIZE,
},
};
struct platform_device stmp3xxx_framebuffer = {
.name = "stmp3xxx-fb",
.id = -1,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
.num_resources = ARRAY_SIZE(fb_resource),
.resource = fb_resource,
};
#define CMDLINE_DEVICE_CHOOSE(name, dev1, dev2) \
static char *cmdline_device_##name; \
static int cmdline_device_##name##_setup(char *dev) \
{ \
cmdline_device_##name = dev + 1; \
return 0; \
} \
__setup(#name, cmdline_device_##name##_setup); \
int stmp3xxx_##name##_device_register(void) \
{ \
struct platform_device *d = NULL; \
if (!cmdline_device_##name || \
!strcmp(cmdline_device_##name, #dev1)) \
d = &stmp3xxx_##dev1; \
else if (!strcmp(cmdline_device_##name, #dev2)) \
d = &stmp3xxx_##dev2; \
else \
printk(KERN_ERR"Unknown %s assignment '%s'.\n", \
#name, cmdline_device_##name); \
return d ? platform_device_register(d) : -ENOENT; \
}
CMDLINE_DEVICE_CHOOSE(ssp1, mmc, spi1)
CMDLINE_DEVICE_CHOOSE(ssp2, gpmi, spi2)
struct platform_device stmp3xxx_backlight = {
.name = "stmp3xxx-bl",
.id = -1,
};
struct platform_device stmp3xxx_rotdec = {
.name = "stmp3xxx-rotdec",
.id = -1,
};
struct platform_device stmp3xxx_persistent = {
.name = "stmp3xxx-persistent",
.id = -1,
};
struct platform_device stmp3xxx_dcp_bootstream = {
.name = "stmp3xxx-dcpboot",
.id = -1,
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
};
static struct resource dcp_resources[] = {
{
.start = IRQ_DCP_VMI,
.end = IRQ_DCP_VMI,
.flags = IORESOURCE_IRQ,
}, {
.start = IRQ_DCP,
.end = IRQ_DCP,
.flags = IORESOURCE_IRQ,
},
};
struct platform_device stmp3xxx_dcp = {
.name = "stmp3xxx-dcp",
.id = -1,
.resource = dcp_resources,
.num_resources = ARRAY_SIZE(dcp_resources),
.dev = {
.dma_mask = &common_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
};
static struct resource battery_resource[] = {
{
.flags = IORESOURCE_IRQ,
.start = IRQ_VDD5V,
.end = IRQ_VDD5V,
},
};
struct platform_device stmp3xxx_battery = {
.name = "stmp3xxx-battery",
.resource = battery_resource,
.num_resources = ARRAY_SIZE(battery_resource),
};
#ifndef __MACH_GPMI_H
#include <linux/mtd/partitions.h>
#include <mach/regs-gpmi.h>
struct gpmi_platform_data {
void *pins;
int nr_parts;
struct mtd_partition *parts;
const char *part_types[];
};
#endif
#ifndef _MACH_MMC_H
#define _MACH_MMC_H
#include <mach/regs-ssp.h>
struct stmp3xxxmmc_platform_data {
int (*get_wp)(void);
unsigned long (*setclock)(void __iomem *base, unsigned long);
void (*cmd_pullup)(int);
int (*hw_init)(void);
void (*hw_release)(void);
};
#endif
......@@ -25,7 +25,27 @@ extern struct sys_timer stmp3xxx_timer;
void stmp3xxx_init_irq(struct irq_chip *chip);
void stmp3xxx_init(void);
int stmp3xxx_reset_block(void __iomem *hwreg, int just_enable);
extern struct platform_device stmp3xxx_dbguart;
extern struct platform_device stmp3xxx_dbguart,
stmp3xxx_appuart,
stmp3xxx_watchdog,
stmp3xxx_touchscreen,
stmp3xxx_keyboard,
stmp3xxx_gpmi,
stmp3xxx_mmc,
stmp3xxx_udc,
stmp3xxx_ehci,
stmp3xxx_rtc,
stmp3xxx_spi1,
stmp3xxx_spi2,
stmp3xxx_backlight,
stmp3xxx_rotdec,
stmp3xxx_dcp,
stmp3xxx_dcp_bootstream,
stmp3xxx_persistent,
stmp3xxx_framebuffer,
stmp3xxx_battery;
int stmp3xxx_ssp1_device_register(void);
int stmp3xxx_ssp2_device_register(void);
struct pin_group;
void stmp3xxx_release_pin_group(struct pin_group *pin_group, const char *label);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment