⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kernel-2.6.18-imx21-jk2.patch

📁 针对freescale imx21的linux2.6的补丁。因为官方只提供2.4内核
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+# CONFIG_CRYPTO is not set++#+# Hardware crypto devices+#++#+# Library routines+#+# CONFIG_CRC_CCITT is not set+# CONFIG_CRC16 is not set+CONFIG_CRC32=y+# CONFIG_LIBCRC32C is not set+CONFIG_ZLIB_INFLATE=y+CONFIG_ZLIB_DEFLATE=y+CONFIG_PLIST=ydiff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/Kconfig linux-2.6.18-fs3/arch/arm/Kconfig--- linux-2.6.18/arch/arm/Kconfig	2006-09-20 05:42:06.000000000 +0200+++ linux-2.6.18-fs3/arch/arm/Kconfig	2006-10-16 13:30:24.000000000 +0200@@ -187,6 +187,11 @@ 	help 	  This enables support for systems based on the Hilscher NetX Soc +config ARCH_IMX21+	bool "IMX21"+	help+		This enables support for Freescale iMX21 based boards+ config ARCH_H720X 	bool "Hynix HMS720x-based" 	select ISA_DMA_API@@ -332,6 +337,8 @@  source "arch/arm/mach-imx/Kconfig" +source "arch/arm/mach-imx2/Kconfig"+ source "arch/arm/mach-h720x/Kconfig"  source "arch/arm/mach-versatile/Kconfig"@@ -873,10 +880,10 @@  source "drivers/i2c/Kconfig" -source "drivers/spi/Kconfig"- source "drivers/w1/Kconfig" +source "drivers/spi/Kconfig"+ source "drivers/hwmon/Kconfig"  #source "drivers/l3/Kconfig"diff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/kernel/head.S linux-2.6.18-fs3/arch/arm/kernel/head.S--- linux-2.6.18/arch/arm/kernel/head.S	2006-09-20 05:42:06.000000000 +0200+++ linux-2.6.18-fs3/arch/arm/kernel/head.S	2006-10-16 13:30:24.000000000 +0200@@ -245,7 +245,13 @@ 	add	r3, r3, #1 << 20 	str	r3, [r0, #4]!			@ KERNEL + 2MB 	add	r3, r3, #1 << 20-	str	r3, [r0, #4]			@ KERNEL + 3MB+	str	r3, [r0, #4]!			@ KERNEL + 3MB+	add	r3, r3, #1 << 20+	str	r3, [r0, #4]!			@ KERNEL + 4MB+	add	r3, r3, #1 << 20+	str	r3, [r0, #4]!			@ KERNEL + 5MB+	add	r3, r3, #1 << 20+	str	r3, [r0, #4]!			@ KERNEL + 6MB  	/* 	 * Then map first 1MB of ram in case it contains our boot params.diff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/kernel/setup.c linux-2.6.18-fs3/arch/arm/kernel/setup.c--- linux-2.6.18/arch/arm/kernel/setup.c	2006-09-20 05:42:06.000000000 +0200+++ linux-2.6.18-fs3/arch/arm/kernel/setup.c	2006-10-16 13:30:24.000000000 +0200@@ -777,15 +777,20 @@ 	if (mdesc->soft_reboot) 		reboot_setup("s"); -	if (mdesc->boot_params)+	if (mdesc->boot_params) { 		tags = phys_to_virt(mdesc->boot_params);+	} else {+		printk("No bootparams, using init_tags\n"); // jk+	}  	/* 	 * If we have the old style parameters, convert them to 	 * a tag list. 	 */-	if (tags->hdr.tag != ATAG_CORE)+	if (tags->hdr.tag != ATAG_CORE) {+		printk("Converting old style parameters to tag list\n"); 		convert_to_tag_list(tags);+	} 	if (tags->hdr.tag != ATAG_CORE) 		tags = (struct tag *)&init_tags; diff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx/generic.c linux-2.6.18-fs3/arch/arm/mach-imx/generic.c--- linux-2.6.18/arch/arm/mach-imx/generic.c	2006-09-20 05:42:06.000000000 +0200+++ linux-2.6.18-fs3/arch/arm/mach-imx/generic.c	2006-10-16 13:30:25.000000000 +0200@@ -55,16 +55,18 @@ 		DDIR(port) &= ~(1<<pin);  	/* Primary / alternate function */-	if(gpio_mode & GPIO_AF)+	if(gpio_mode & GPIO_AF) { 		GPR(port) |= (1<<pin);-	else+	} else { 		GPR(port) &= ~(1<<pin);+	}  	/* use as gpio? */-	if(gpio_mode &  GPIO_GIUS)+	if(gpio_mode &  GPIO_GIUS) { 		GIUS(port) |= (1<<pin);-	else+	} else { 		GIUS(port) &= ~(1<<pin);+	}  	/* Output / input configuration */ 	/* FIXME: I'm not very sure about OCR and ICONF, someonediff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx/time.c linux-2.6.18-fs3/arch/arm/mach-imx/time.c--- linux-2.6.18/arch/arm/mach-imx/time.c	2006-09-20 05:42:06.000000000 +0200+++ linux-2.6.18-fs3/arch/arm/mach-imx/time.c	2006-10-16 13:30:25.000000000 +0200@@ -31,6 +31,7 @@ static unsigned long imx_gettimeoffset(void) { 	unsigned long ticks;+	int interrupt_status;  	/* 	 * Get the current number of ticks.  Note that there is a race@@ -44,7 +45,7 @@ 	 * Interrupt pending?  If so, we've reloaded once already. 	 */ 	if (IMX_TSTAT(TIMER_BASE) & TSTAT_COMP)-		ticks += LATCH;+		ticks +=  IMX_TCN(TIMER_BASE);  	/* 	 * Convert the ticks to usecsdiff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx2/dma.c linux-2.6.18-fs3/arch/arm/mach-imx2/dma.c--- linux-2.6.18/arch/arm/mach-imx2/dma.c	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.18-fs3/arch/arm/mach-imx2/dma.c	2006-10-16 13:44:07.000000000 +0200@@ -0,0 +1,204 @@+/*+ *  linux/arch/arm/mach-imx/dma.c+ *+ *  imx DMA registration and IRQ dispatching+ *+ *  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.+ *+ *  04/04/2006 Jochen Karrer+ *	       adapted to i.MX21 + *+ *  03/03/2004 Sascha Hauer <sascha@saschahauer.de>+ *             initial version heavily inspired by+ *             linux/arch/arm/mach-pxa/dma.c+ */++#include <linux/module.h>+#include <linux/init.h>+#include <linux/kernel.h>+#include <linux/interrupt.h>+#include <linux/errno.h>++#include <asm/system.h>+#include <asm/irq.h>+#include <asm/hardware.h>+#include <asm/dma.h>+#include <asm/arch/pll.h>++#define DMA_CHANNELS 16+static struct dma_channel {+	char *name;+	void (*irq_handler) (int, void *, struct pt_regs *);+	void (*err_handler) (int, void *, struct pt_regs *);+	void *data;+	int channel_nr;+} dma_channels[DMA_CHANNELS];++/* set err_handler to NULL to have the standard info-only error handler */++static void +dma_err_handler(struct dma_channel *channel,unsigned int err_mask,struct pt_regs *regs)+{+	int i;+	uint16_t disr = DMA_DISR;+	DMA_DISR = disr & err_mask;++	i=channel->channel_nr;+	if ( (err_mask & (1<<i) && channel->name && channel->err_handler)) {+		channel->err_handler(i, channel->data, regs);+		return;+	}++	if (DMA_DBTOSR & (1 << i)) {+		printk(KERN_WARNING+		       "Burst timeout on channel %d (%s)\n",+		       i, channel->name);+		DMA_DBTOSR = (1 << i);+	}+	if (DMA_DRTOSR & (1 << i)) {+		printk(KERN_WARNING+		       "Request timeout on channel %d (%s)\n",+		       i, channel->name);+		DMA_DRTOSR = (1 << i);+	}+	if (DMA_DSESR & (1 << i)) {+		printk(KERN_WARNING+		       "Transfer timeout on channel %d (%s)\n",+		       i, channel->name);+		DMA_DSESR = (1 << i);+	}+	if (DMA_DBOSR & (1 << i)) {+		printk(KERN_WARNING+		       "Buffer overflow timeout on channel %d (%s)\n",+		       i, channel->name);+		DMA_DBOSR = (1 << i);+	}+	return;+}++static irqreturn_t+dma_irq_handler(int irq, void *dev_id, struct pt_regs *regs)+{+	struct dma_channel *channel = (struct dma_channel *)dev_id;+	int i = channel->channel_nr;+	uint16_t mask = (1<<i);+	uint16_t disr = DMA_DISR;+	uint16_t err_mask = (DMA_DBTOSR | DMA_DRTOSR | DMA_DSESR | DMA_DBOSR) & mask;+	DMA_DISR = disr & mask;+	//printk("Kernel: DMA irq %d, disr 0x%04x err_mask 0x%04x\n",irq,disr,err_mask);+	if(err_mask) {+		dma_err_handler(channel,err_mask,regs);+	} else if (channel->name && channel->irq_handler) {+		channel->irq_handler(i, channel->data, regs);+	} else {+		printk(KERN_WARNING "DMA interrupt, but no handler\n");+	}+	return IRQ_HANDLED;+}++int+imx21_request_dma(char *name, imx_dma_prio prio,+		void (*irq_handler) (int, void *, struct pt_regs *),+		void (*err_handler) (int, void *, struct pt_regs *), void *data)+{+	unsigned long flags;+	int i, found = 0;++	/* basic sanity checks */+	if (!name || !irq_handler)+		return -EINVAL;++	local_irq_save(flags);++	/* try grabbing a DMA channel with the requested priority */+	for (i = prio; i < prio + (prio == DMA_PRIO_LOW) ? 8 : 4; i++) {+		if (!dma_channels[i].name) {+			found = 1;+			break;+		}+	}++	if (!found) {+		/* requested prio group is full, try higher priorities */+		for (i = prio - 1; i >= 0; i--) {+			if (!dma_channels[i].name) {+				found = 1;+				break;+			}+		}+	}++	if (found) {+		int ret;+		ret = request_irq(INT_DMACH0+i, dma_irq_handler, 0, name, &dma_channels[i]);+		if (ret) {+			printk(KERN_CRIT "Wow!  Can't register IRQ for DMA\n");+			return ret;+		}+		//printk("Got IRQ %d for DMACHAN %d\n",INT_DMACH0+i,i); // jk+		dma_channels[i].name = name;+		dma_channels[i].irq_handler = irq_handler;+		dma_channels[i].err_handler = err_handler;+		dma_channels[i].data = data;+		DMA_DIMR &= ~(1 << i);+	} else {+		printk(KERN_WARNING "No more available DMA channels for %s\n",+		       name);+		i = -ENODEV;+	}++	local_irq_restore(flags);+	return i;+}++void+imx21_free_dma(int dma_ch)+{+	unsigned long flags;+	if (!dma_channels[dma_ch].name) {+		printk(KERN_CRIT+		       "%s: trying to free channel %d which is already freed\n",+		       __FUNCTION__, dma_ch);+		return;+	}++	local_irq_save(flags);+	DMA_DIMR |= (1 << dma_ch);+	dma_channels[dma_ch].name = NULL;+	free_irq(INT_DMACH0+dma_ch, &dma_channels[dma_ch]);+	local_irq_restore(flags);+}++static int __init+imx21_dma_init(void)+{+	int i;++	CRM_PCCR0 |=  PCCR0_HCLK_DMA_EN;+	CRM_PCCR0 |=  PCCR0_DMA_EN;++	/* reset DMA module */+	DMA_DCR = DCR_DRST;++	for(i=0;i<DMA_CHANNELS;i++) {+		dma_channels[i].channel_nr = i;+	}++	/* enable DMA module */+	DMA_DCR = DCR_DEN;++	/* clear all interrupts */+	DMA_DISR = 0x3ff;++	/* enable interrupts */ +	DMA_DIMR = 0; /* Should be changed to disable */++	return 0;+}++arch_initcall(imx21_dma_init);++EXPORT_SYMBOL(imx21_request_dma);+EXPORT_SYMBOL(imx21_free_dma);diff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx2/generic.c linux-2.6.18-fs3/arch/arm/mach-imx2/generic.c--- linux-2.6.18/arch/arm/mach-imx2/generic.c	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.18-fs3/arch/arm/mach-imx2/generic.c	2006-10-27 09:50:48.000000000 +0200@@ -0,0 +1,363 @@+/*+ *  arch/arm/mach-imx21/generic.c+ *+ *  Common code for i.MX21 machines+ *+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA+ *+ */++#include <linux/platform_device.h>+#include <linux/init.h>+#include <linux/kernel.h>+#include <linux/module.h>+#include <linux/string.h>++#include <asm/irq.h>+#include <asm/hardware.h>+#include <asm/arch/pll.h>+#include <asm/arch/gpio.h>+#include <asm/mach/map.h>++int+imx21_gpio_read(unsigned int gpio_nr)+{+	int port = gpio_nr >> 5;+        int bit = gpio_nr & 31; +	return (GPIO_SSR(port) >> bit) & 1;+}++void +imx21_gpio_set(int val,unsigned int gpio_nr)+{+	int port = gpio_nr >> 5;+        int bit = gpio_nr & 31; +	unsigned long flags;+	if(val>1) {+		printk("bad argument to gpio_set\n");+	}+	local_irq_save(flags);+	if(val) {+		GPIO_DR(port) |=  (1<<bit);+	} else {+		GPIO_DR(port) &=  ~(1<<bit);+	}+	local_irq_restore(flags);+}++void +imx21_gpio_mode(unsigned int gpio_nr,unsigned int gpio_mode)+{+	uint32_t tmp;+	int port = gpio_nr >> 5;+	int pin = gpio_nr & 0x1f;+	unsigned int ocr = (gpio_mode & GPIO_MODE_OCR_MASK) >> GPIO_MODE_OCR_SHIFT;+	unsigned long flags;+	local_irq_save(flags);+	if(gpio_mode & GPIO_MODE_OUT) {+                GPIO_DDIR(port) |= 1<<pin;+        } else {+                GPIO_DDIR(port) &= ~(1<<pin);+	}+	if(gpio_mode & GPIO_MODE_PUEN) {+		 GPIO_PUEN(port) |= (1<<pin);+	} else {+		 GPIO_PUEN(port) &= ~(1<<pin);+	}+	/* Primary / alternate function */+        if(gpio_mode & GPIO_MODE_AF) {+                GPIO_GPR(port) |= (1<<pin);+        } else {+                GPIO_GPR(port) &= ~(1<<pin);+	}+	 /* use as gpio? */+        if(gpio_mode &  GPIO_MODE_GIUS) {+                GPIO_GIUS(port) |= (1<<pin);+        } else {+                GPIO_GIUS(port) &= ~(1<<pin);+	}++	if(pin<16) {+                tmp = GPIO_OCR1(port);+                tmp &= ~( 3<<(pin*2));+                tmp |= (ocr << (pin*2));+                GPIO_OCR1(port) = tmp;++                GPIO_ICONFA1(port) &= ~( 3<<(pin*2));+                GPIO_ICONFA1(port) |= ((gpio_mode >> GPIO_MODE_AOUT_SHIFT) & 3) << (pin * 2);+                GPIO_ICONFB1(port) &= ~( 3<<(pin*2));+                GPIO_ICONFB1(port) |= ((gpio_mode >> GPIO_MODE_BOUT_SHIFT) & 3) << (pin * 2);+        } else {+                tmp = GPIO_OCR2(port);+                tmp &= ~( 3<<((pin-16)*2));+                tmp |= (ocr << ((pin-16)*2));+                GPIO_OCR2(port) = tmp;++                GPIO_ICONFA2(port) &= ~( 3<<((pin-16)*2));+                GPIO_ICONFA2(port) |= ((gpio_mode >> GPIO_MODE_AOUT_SHIFT) & 3) << ((pin-16) * 2);+                GPIO_ICONFB2(port) &= ~( 3<<((pin-16)*2));+                GPIO_ICONFB2(port) |= ((gpio_mode >> GPIO_MODE_BOUT_SHIFT) & 3) << ((pin-16) * 2);+        }+	local_irq_restore(flags);+}++EXPORT_SYMBOL(imx21_gpio_mode);+EXPORT_SYMBOL(imx21_gpio_read);+EXPORT_SYMBOL(imx21_gpio_set);++static struct resource imx21_uart1_resources[] = {+        [0] = {+                .start  = 0x1000A000,+                .end    = 0x1000A0FF,+                .flags  = IORESOURCE_MEM,+        },+        [1] = {+                .start  = (INT_UART1),+                .end    = (INT_UART1),+                .flags  = IORESOURCE_IRQ,+        },+};+static struct resource imx21_uart2_resources[] = {+        [0] = {+                .start  = 0x1000B000,+                .end    = 0x1000B0FF,+                .flags  = IORESOURCE_MEM,+        },+        [1] = {+                .start  = (INT_UART2),+                .end    = (INT_UART2),+                .flags  = IORESOURCE_IRQ,+        },+};+static struct resource imx21_uart3_resources[] = {+        [0] = {+                .start  = 0x1000C000,+                .end    = 0x1000C0FF,+                .flags  = IORESOURCE_MEM,+        },+        [1] = {+                .start  = (INT_UART3),+                .end    = (INT_UART3),+                .flags  = IORESOURCE_IRQ,+        },+        [2] = { /* DTR */+                .start  = (GPIO_PORTB(20)),

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -