[Armadeus-commitlog] SF.net SVN: armadeus: [614] trunk/buildroot/target/device/armadeus/linux/ kern
Brought to you by:
sszy
|
From: <ar...@us...> - 2007-08-03 21:52:47
|
Revision: 614
http://armadeus.svn.sourceforge.net/armadeus/?rev=614&view=rev
Author: artemys
Date: 2007-08-03 14:46:12 -0700 (Fri, 03 Aug 2007)
Log Message:
-----------
[LINUX] Add support to TSC2102 in apf9328 machine file = hardware configuration
Modified Paths:
--------------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff
Added Paths:
-----------
trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/075-linux-2.6.18-spi2-reg-irq-defines.diff
Modified: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff 2007-07-28 17:49:54 UTC (rev 613)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/021-linux-2.6.18-apf9328.diff 2007-08-03 21:46:12 UTC (rev 614)
@@ -809,8 +809,8 @@
+CONFIG_ZLIB_DEFLATE=y
diff -urN linux-2.6.18.1/arch/arm/mach-imx/apf9328.c linux-2.6.18.1.mod/arch/arm/mach-imx/apf9328.c
--- linux-2.6.18.1/arch/arm/mach-imx/apf9328.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.18.1.mod/arch/arm/mach-imx/apf9328.c 2007-01-07 21:39:30.000000000 +0100
-@@ -0,0 +1,349 @@
++++ linux-2.6.18.1.mod/arch/arm/mach-imx/apf9328.c 2007-07-22 22:46:57.000000000 +0200
+@@ -0,0 +1,463 @@
+/*
+ * linux/arch/arm/mach-imx/apf9328.c
+ *
@@ -839,6 +839,7 @@
+#include <linux/spi/spi.h>
+// Get CONFIG_ options:
+#include <linux/config.h>
++#include <linux/spi/tsc2102.h>
+
+#include <asm/system.h>
+#include <asm/hardware.h>
@@ -852,6 +853,7 @@
+#include <asm/arch/imx-uart.h>
+#include <asm/arch/mmc.h>
+#include <asm/arch/spi_imx.h>
++#include <asm/arch/imx-regs.h> // imx_gpio_mode()
+
+#ifdef CONFIG_DM9000
+#include <linux/dm9000.h>
@@ -865,6 +867,9 @@
+#ifdef CONFIG_SPI_IMX_MODULE
+#define CONFIG_SPI_IMX 1
+#endif
++#ifdef CONFIG_SPI_TSC2102_MODULE
++#define CONFIG_SPI_TSC2102 1
++#endif
+#ifdef CONFIG_IMX_BACKLIGHT_MODULE
+#define CONFIG_IMX_BACKLIGHT 1
+#endif
@@ -986,7 +991,7 @@
+};
+
+#ifdef CONFIG_SPI_IMX
-+static struct resource imx_spi0_resource[] = {
++static struct resource imx_spi1_resource[] = {
+ [0] = {
+ .start = 0x00213000,
+ .end = 0x00213fff,
@@ -999,20 +1004,49 @@
+ }
+};
+
-+static struct spi_imx_master imx_spi_master_info = {
++static struct spi_imx_master imx_spi1_master_info = {
+ .num_chipselect = 1,
+ .enable_dma=0,
+};
+
-+static struct platform_device imx_spi = {
++static struct platform_device imx_spi1 = {
+ .name = "imx-spi",
+ .id = 1,
-+ .resource = imx_spi0_resource,
-+ .num_resources = ARRAY_SIZE(imx_spi0_resource),
++ .resource = imx_spi1_resource,
++ .num_resources = ARRAY_SIZE(imx_spi1_resource),
+ .dev = {
-+ .platform_data = &imx_spi_master_info,
++ .platform_data = &imx_spi1_master_info,
+ },
+};
++
++static struct resource imx_spi2_resource[] = {
++ [0] = {
++ .start = 0x00219000,
++ .end = 0x00219fff,
++ .flags = IORESOURCE_MEM,
++ },
++ [1] = {
++ .start = SPI2_INT,
++ .end = SPI2_INT,
++ .flags = IORESOURCE_IRQ,
++ }
++};
++
++static struct spi_imx_master imx_spi2_master_info = {
++ .num_chipselect = 1,
++ .enable_dma=0,
++};
++
++static struct platform_device imx_spi2 = {
++ .name = "imx-spi",
++ .id = 2,
++ .resource = imx_spi2_resource,
++ .num_resources = ARRAY_SIZE(imx_spi2_resource),
++ .dev = {
++ .platform_data = &imx_spi2_master_info,
++ },
++};
++
+#endif //CONFIG_SPI_IMX
+
+#ifdef CONFIG_SENSORS_MAX1027
@@ -1020,16 +1054,17 @@
+#define IMX_SPI1_SS (1<<15)
+static void max1027_init_cs(void)
+{
-+ // SPI CSn is used as chip select but in GPIO mode
++ // SPI CSn is used as chip select but in GPIO mode
+ OCR1(2) |= 3<<(IMX_SPI1_SS_PIN*2);
+ DDIR(2) |= IMX_SPI1_SS;
+ DR(2) |= IMX_SPI1_SS;
-+ GIUS(2) = IMX_SPI1_SS;
++ GIUS(2) |= IMX_SPI1_SS;
++ GIUS(2) &= ~(1<<14 | 1<<16 | 1<< 17); // Set SPI primary functions
+}
+static void max1027_cs(u32 command)
+{
+ if( command == SPI_CS_DEASSERT )
-+ DR(2) |= IMX_SPI1_SS;
++ DR(2) |= IMX_SPI1_SS;
+ else
+ DR(2) &= ~IMX_SPI1_SS;
+}
@@ -1038,16 +1073,90 @@
+ .cs_control = max1027_cs,
+};
+
-+static struct spi_board_info spi_board_info[] __initdata = { {
-+ .modalias = "max1027",
-+ .controller_data = &max1027_hw,
-+ .max_speed_hz = 8000000,
-+ .bus_num = 1,
-+ .chip_select = 0,
-+ .mode = 0,
++#endif // CONFIG_SENSORS_MAX1027
++
++#ifdef CONFIG_SPI_TSC2102
++#define TSC2102_CS_GPIOB 17
++static void tsc2102_init_gpio(void)
++{
++ // Activate SPI2 port ----
++ // PortB 19 is used as chip select (in GPIO mode)
++ DR(1) |= 1 << TSC2102_CS_GPIOB; // Initializes it High
++ imx_gpio_mode( GPIO_PORTB | TSC2102_CS_GPIOB | GPIO_OUT | GPIO_GIUS | GPIO_DR );
++ // Configure SPI2 outputs
++ imx_gpio_mode( PD7_AIN_SPI2_SCLK );
++ imx_gpio_mode( PD10_AIN_SPI2_TXD );
++ imx_gpio_mode( PD9_AOUT_SPI2_RXD );
++ FMCR |= SPI2_RXD_SEL; // RX is AOUT on PORTD
++
++ // PortD 8 is used as PINTDAV interrupt
++ imx_gpio_mode( GPIO_PORTD | 8 | GPIO_IN | GPIO_GIUS );
++ //imx_gpio_irq_type( IRQ_GPIOD(8), __IRQT_FALEDGE );
++
++ // Activate SSI on PortC ----
++ imx_gpio_mode( PC3_PF_SSI_RXFS );
++ FMCR &= ~(SSI_RXFS_SEL);
++ imx_gpio_mode( PC4_PF_SSI_RXCLK );
++ FMCR &= ~(SSI_RXCLK_SEL);
++ imx_gpio_mode( PC5_PF_SSI_RXDAT );
++ FMCR &= ~(SSI_RXDAT_SEL);
++ imx_gpio_mode( PC6_PF_SSI_TXDAT );
++ imx_gpio_mode( PC7_PF_SSI_TXFS );
++ FMCR &= ~(SSI_TXFS_SEL);
++ imx_gpio_mode( PC8_PF_SSI_TXCLK );
++ FMCR &= ~(SSI_TXCLK_SEL);
++
++ printk("TSC2102 GPIOs initialized\n");
++}
++
++// Chip select command for TSC2102
++static void tsc2102_cs(u32 command)
++{
++ // PortB 19 is used as chip select
++ if( command == SPI_CS_DEASSERT )
++ DR(1) |= 1<< TSC2102_CS_GPIOB;
++ else
++ DR(1) &= ~(1<< TSC2102_CS_GPIOB);
++}
++
++static struct spi_imx_chip tsc2102_hw = {
++ .cs_control = tsc2102_cs,
++};
++
++static struct tsc2102_config apf9328_tsc2102_config = {
++ .use_internal = 1, // -> use internal voltage reference
++ .monitor = TSC_BAT1 | TSC_AUX | TSC_TEMP,
++ .temp_at25c = { 2200, 2615 },
++/* .apm_report = palmte_get_power_status,
++ .alsa_config = &palmte_alsa_config,*/
++};
++
++#endif // CONFIG_SPI_TSC2102
++
++static struct spi_board_info spi_board_info[] __initdata = {
++#ifdef CONFIG_SENSORS_MAX1027
++{
++ .modalias = "max1027",
++ .controller_data = &max1027_hw,
++ .max_speed_hz = 8000000,
++ .bus_num = 1, // SPI1
++ .chip_select = 0,
++ .mode = 0,
+},
++#endif // CONFIG_SENSORS_MAX1027
++#ifdef CONFIG_SPI_TSC2102
++{
++ .modalias = "tsc2102",
++ .controller_data = &tsc2102_hw,
++ .max_speed_hz = 8000000,
++ .bus_num = 2, // SPI2
++ .irq = IRQ_GPIOD(8),
++ .chip_select = 0,
++ .mode = 0,
++ .platform_data = &apf9328_tsc2102_config,
++},
++#endif // CONFIG_SPI_TSC2102
+};
-+#endif // CONFIG_SENSORS_MAX1027
+
+// --- LCD RESSOURCE ---
+#ifdef CONFIG_FB_IMX
@@ -1081,7 +1190,8 @@
+ &dm9000x_device,
+#endif // CONFIG_DM9000
+#ifdef CONFIG_SPI_IMX
-+ &imx_spi,
++ &imx_spi1,
++ &imx_spi2,
+#endif //CONFIG_SPI_IMX
+ &imx_pwm_device,
+#ifdef CONFIG_IMX_BACKLIGHT
@@ -1092,7 +1202,7 @@
+static void __init apf9328_init(void)
+{
+ printk("--- Registering APF9328 ressources\n");
-+
++
+ // Serial
+ UFCR(IMX_UART1_BASE) = 0xa81;
+ UFCR(IMX_UART2_BASE) = 0xa81;
@@ -1107,11 +1217,15 @@
+#ifdef CONFIG_SENSORS_MAX1027
+ max1027_init_cs();
+#endif //CONFIG_SENSORS_MAX1027
++#ifdef CONFIG_SPI_TSC2102
++ tsc2102_init_gpio();
++#endif // CONFIG_SPI_TSC2102
+
+ platform_add_devices(devices, ARRAY_SIZE(devices));
-+#ifdef CONFIG_SENSORS_MAX1027
-+ spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
++#if defined (CONFIG_SENSORS_MAX1027) || defined (CONFIG_SPI_TSC2102)
++ spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
+#endif // CONFIG_SENSORS_MAX1027
++
+ printk("--- APF9328 ressources registered\n");
+}
+
Added: trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/075-linux-2.6.18-spi2-reg-irq-defines.diff
===================================================================
--- trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/075-linux-2.6.18-spi2-reg-irq-defines.diff (rev 0)
+++ trunk/buildroot/target/device/armadeus/linux/kernel-patches/2.6.18.1/075-linux-2.6.18-spi2-reg-irq-defines.diff 2007-08-03 21:46:12 UTC (rev 614)
@@ -0,0 +1,38 @@
+--- linux-2.6.18.1/include/asm-arm/arch-imx/imx-regs.h 2007-08-01 22:01:00.000000000 +0200
++++ linux-2.6.18.1.mod/include/asm-arm/arch-imx/imx-regs.h 2007-07-17 00:08:11.000000000 +0200
+@@ -39,6 +39,16 @@
+ #define IMX_AITC_BASE (0x23000 + IMX_IO_BASE)
+ #define IMX_CSI_BASE (0x24000 + IMX_IO_BASE)
+
++/* System control registers */
++
++#define FMCR __REG(0x1B808 + IMX_IO_BASE)
++#define SPI2_RXD_SEL (1 << 8)
++#define SSI_RXFS_SEL (1 << 7)
++#define SSI_RXCLK_SEL (1 << 6)
++#define SSI_RXDAT_SEL (1 << 5)
++#define SSI_TXFS_SEL (1 << 4)
++#define SSI_TXCLK_SEL (1 << 3)
++
+ /* PLL registers */
+ #define CSCR __REG(IMX_PLL_BASE) /* Clock Source Control Register */
+ #define CSCR_SYSTEM_SEL (1<<16)
+@@ -216,7 +226,7 @@
+ #define PD6_PF_LSCLK ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 6 )
+ #define PD7_PF_REV ( GPIO_PORTD | GPIO_PF | 7 )
+ #define PD7_AF_UART2_DTR ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7 )
+-#define PD7_AIN_SPI2_SCLK ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7 )
++#define PD7_AIN_SPI2_SCLK ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | GPIO_OUT | 7 )
+ #define PD8_PF_CLS ( GPIO_PORTD | GPIO_PF | 8 )
+ #define PD8_AF_UART2_DCD ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 8 )
+ #define PD8_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8 )
+--- linux-2.6.18.1/include/asm-arm/arch-imx/irqs.h 2006-10-14 05:34:03.000000000 +0200
++++ linux-2.6.18.1.mod/include/asm-arm/arch-imx/irqs.h 2007-07-15 15:59:04.000000000 +0200
+@@ -61,6 +61,7 @@
+ #define PWM_INT 34
+ #define SDHC_INT 35
+ #define I2C_INT 39
++#define SPI2_INT 40
+ #define CSPI_INT 41
+ #define SSI_TX_INT 42
+ #define SSI_TX_ERR_INT 43
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|