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

📄 kernel-2.6.18-imx21-jk2.patch

📁 针对freescale imx21的linux2.6的补丁。因为官方只提供2.4内核
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+                .end    = (GPIO_PORTB(20)),+                .flags  = IORESOURCE_GPIO,+        },+        [3] = { /* DSR */+                .start  = -1,+                .end    = -1,+                .flags  = IORESOURCE_GPIO,+        },+        [4] = { /* CD */+                .start  = (GPIO_PORTB(11)),+                .end    = (GPIO_PORTB(11)),+                .flags  = IORESOURCE_GPIO,+        },+};+static struct resource imx21_uart4_resources[] = {+        [0] = {+                .start  = 0x1000D000,+                .end    = 0x1000D0FF,+                .flags  = IORESOURCE_MEM,+        },+        [1] = {+                .start  = (INT_UART4),+                .end    = (INT_UART4),+                .flags  = IORESOURCE_IRQ,+        },+};+static struct resource imx21_hcd_resources[] = {+        [0] = {+                .start  = 0x10024000,+                .end    = 0x10025fff,+                .flags  = IORESOURCE_MEM,+        },+        [1] = {+                .start  = (INT_USBHOST),+                .end    = (INT_USBHOST),+                .flags  = IORESOURCE_IRQ,+        },+};++static struct resource imx21_fb_resources[] = {+        [0] = {+                .start  = 0x10021000,+                .end    = 0x10021fff,+                .flags  = IORESOURCE_MEM,+        },+        [1] = {+                .start  = (INT_LCDC),+                .end    = (INT_LCDC),+                .flags  = IORESOURCE_IRQ,+        },+};++static void dummy_release(struct device *dev)+{+        /* normally not freed */+}++static struct platform_device imx21_hcd_device = {+        .name           = "imx21-hcd",+        .id             = 0,+        .num_resources  = ARRAY_SIZE(imx21_hcd_resources),+        .resource       = imx21_hcd_resources,+	.dev = {+		.release        = dummy_release, // not needed+		.coherent_dma_mask = 0xffffffff,+        },+};++static struct platform_device imx21_uart1_device = {+        .name           = "imx2-uart",+        .id             = 0,+        .num_resources  = ARRAY_SIZE(imx21_uart1_resources),+        .resource       = imx21_uart1_resources,+	.dev = {+               .release        = dummy_release, // not needed+        },+};++static struct platform_device imx21_uart2_device = {+        .name           = "imx2-uart",+        .id             = 1,+        .num_resources  = ARRAY_SIZE(imx21_uart2_resources),+        .resource       = imx21_uart2_resources,+	.dev = {+               .release        = dummy_release, // not needed+        },+};+static struct platform_device imx21_uart3_device = {+        .name           = "imx2-uart",+        .id             = 2,+        .num_resources  = ARRAY_SIZE(imx21_uart3_resources),+        .resource       = imx21_uart3_resources,+	.dev = {+               .release        = dummy_release, // not needed+        },+};+static struct platform_device imx21_uart4_device = {+        .name           = "imx2-uart",+        .id             = 3,+        .num_resources  = ARRAY_SIZE(imx21_uart4_resources),+        .resource       = imx21_uart4_resources,+	.dev = {+               .release        = dummy_release, // not needed+        },+};++static struct platform_device imx21_fb_device = {+        .name           = "imx21-fb",+        .id             = 0,+        .num_resources  = ARRAY_SIZE(imx21_fb_resources),+        .resource       = imx21_fb_resources,+	.dev = {+               .release        = dummy_release, // not needed+		.coherent_dma_mask = 0xffffffff,+        },+};+++static struct platform_device *devices[] __initdata = {+        &imx21_uart1_device,+        &imx21_uart2_device,+        &imx21_uart3_device,+        &imx21_uart4_device,+	&imx21_fb_device,+        &imx21_hcd_device,+};++static int __init imx21_init(void)+{+        return platform_add_devices(devices, ARRAY_SIZE(devices));+}++subsys_initcall(imx21_init);+++static struct map_desc imx21_io_desc[] __initdata = {+        {+                .virtual        = MX21_VIRT_IOBASE,+                .pfn            = __phys_to_pfn(MX21_IOBASE),+                .length         = MX21_IOSIZE,+                .type           = MT_DEVICE+        }+};++void __init +imx21_map_io(void) +{+	iotable_init(imx21_io_desc, ARRAY_SIZE(imx21_io_desc));+}++static unsigned int +imx21_get_pll_clk(uint32_t pll)+{+	u32 result;+        u32 mfi = (pll >> 10) & 0xf;+        u32 mfn = pll & 0x3ff;+        u32 mfd = (pll >> 16) & 0x3ff;+        u32 pd =  (pll >> 26) & 0xf;+        u32 f_ref = (CRM_CSCR & CSCR_MCU_SEL) ? 26000000 : (CLK32 * 512);++        mfi = mfi <= 5 ? 5 : mfi;+        result = (2 * (f_ref>>10) * ( (mfi<<10) + (mfn<<10) / (mfd+1) )) / (pd+1);+	//printk("PLL 0x%08x, result 0x%08x\n",pll,result);+	return result;+}++static unsigned int+imx21_get_mpll_clk(void) +{+	u32 mpctl0 = CRM_MPCTL0;+	return imx21_get_pll_clk(mpctl0);	+} ++static unsigned int+imx21_get_spll_clk(void) +{+	u32 spctl0 = CRM_SPCTL0;+	return imx21_get_pll_clk(spctl0);	+} ++unsigned int +imx21_get_perclk1(void)+{+	return imx21_get_mpll_clk() / ((CRM_PCDR1 & 0x3f)+1);+}++unsigned int +imx21_get_perclk2(void)+{+	return imx21_get_mpll_clk() / (((CRM_PCDR1 >> 8) & 0x3f)+1);+}++unsigned int +imx21_get_perclk3(void)+{+	return imx21_get_mpll_clk() / (((CRM_PCDR1 >> 16) & 0x3f)+1);+}++unsigned int +imx21_get_perclk4(void)+{+	return imx21_get_mpll_clk() / (((CRM_PCDR1 >> 24) & 0x3f)+1);+}+EXPORT_SYMBOL(imx21_get_perclk1);+EXPORT_SYMBOL(imx21_get_perclk2);+EXPORT_SYMBOL(imx21_get_perclk3);+EXPORT_SYMBOL(imx21_get_perclk4);diff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx2/generic.h linux-2.6.18-fs3/arch/arm/mach-imx2/generic.h--- linux-2.6.18/arch/arm/mach-imx2/generic.h	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.18-fs3/arch/arm/mach-imx2/generic.h	2006-10-16 13:44:07.000000000 +0200@@ -0,0 +1,13 @@+/*+ *  linux/arch/arm/mach-imx21/generic.h+ *+ * 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.+ */++extern void __init imx21_map_io(void);+extern void __init imx21_init_irq(void);++struct sys_timer;+extern struct sys_timer imx21_timer;diff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx2/irq.c linux-2.6.18-fs3/arch/arm/mach-imx2/irq.c--- linux-2.6.18/arch/arm/mach-imx2/irq.c	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.18-fs3/arch/arm/mach-imx2/irq.c	2006-10-16 13:44:07.000000000 +0200@@ -0,0 +1,208 @@+/*+ *  linux/arch/arm/mach-mx2ads/irq.c+ *+ *  Copyright (C) 2004 Metrowerks Corp.+ *+ *  Based on mach-mx1ads/irq.c, which is:+ *    Copyright (C) 1999 ARM Limited+ *    Copyright (C) 2002 Shane Nay (shane@minirl.com)+ *+ * 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/init.h>+#include <linux/module.h>+#include <linux/sched.h>+#include <linux/interrupt.h>++#include <asm/irq.h>+#include <asm/io.h>++#include <asm/mach/irq.h>+#include <asm/arch/aitc.h>+#include <asm/arch/gpio.h>++static void+imx21_mask_irq(unsigned int irq)+{+        _reg_AITC_INTDISNUM = irq;+}++static void+imx21_unmask_irq(unsigned int irq)+{+        _reg_AITC_INTENNUM = irq;+}++void+imx21_mask_fiq(unsigned int irq)+{+        _reg_AITC_INTDISNUM = (unsigned long) irq;+}++void+imx21_unmask_fiq(unsigned int irq)+{+        _reg_AITC_INTENNUM = (unsigned long)irq;+}++void+imx21_set_type_to_fiq(unsigned int irq)+{+        if (irq >= 32) {+                _reg_AITC_INTTYPEH |= (1<<(irq-32));+        } else {+                _reg_AITC_INTTYPEL |= (1<<irq);+        }+}+++void imx21_set_type_to_irq(unsigned int irq)+{+        if (irq >= 32) {+                _reg_AITC_INTTYPEH &= ~(1<<(irq-32));+        } else {+                _reg_AITC_INTTYPEL &= ~(1<<irq);+        }+}+++unsigned int imx21_get_fiq_num( void)+{+        return (_reg_AITC_FIVECSR);+}+++static struct irqchip imx21_aitc_chip = {+        .ack = imx21_mask_irq,+        .mask = imx21_mask_irq,+        .unmask = imx21_unmask_irq,+};++static void+imx21_gpio_ack_irq(unsigned int irq)+{+        GPIO_ISR(IRQ_TO_REG(irq)) = 1 << ((irq - IRQ_GPIOA(0)) % 32);+}++static void+imx21_gpio_mask_irq(unsigned int irq)+{+        GPIO_IMR(IRQ_TO_REG(irq)) &= ~( 1 << ((irq - IRQ_GPIOA(0)) % 32));+}++static void+imx21_gpio_unmask_irq(unsigned int irq)+{+        GPIO_IMR(IRQ_TO_REG(irq)) |= 1 << ((irq - IRQ_GPIOA(0)) % 32);+}++static int+imx21_gpio_irq_type(unsigned int _irq, unsigned int type)+{+        unsigned int irq_type = 0, irq, port, bit;++        irq = _irq - IRQ_GPIOA(0);+        port = irq >> 5;+        bit = 1 << (irq & 31);++        GPIO_DDIR(port) &= ~(bit);+        GPIO_GIUS(port) |= bit;+++        if (type & __IRQT_RISEDGE) {+                irq_type = 0x0;+        }+        if (type & __IRQT_FALEDGE) {+                irq_type = 0x1;+        }+        if (type & __IRQT_LOWLVL) {+                irq_type = 0x3;+        }+        if (type & __IRQT_HIGHLVL) {+                irq_type = 0x2;+        }++        if ((irq & 31) < 16) {+                GPIO_ICR1(port) = (GPIO_ICR1(port) & ~(0x3 << ((irq % 16) * 2))) |+                    (irq_type << ((irq % 16) * 2));+        } else {+                GPIO_ICR2(port) = (GPIO_ICR2(port) & ~(0x3 << ((irq % 16) * 2))) |+                    (irq_type << ((irq % 16) * 2));+        }++        return 0;++}++static struct irqchip imx21_gpio_chip = {+        .ack = imx21_gpio_ack_irq,+        .mask = imx21_gpio_mask_irq,+        .unmask = imx21_gpio_unmask_irq,+	.set_type = imx21_gpio_irq_type,+};++static inline void+imx21_gpio_handler(unsigned int mask, unsigned int irq,+                 struct irqdesc *desc, struct pt_regs *regs)+{+        desc = irq_desc + irq;+        while (mask) {+                if (mask & 1) {+                        desc_handle_irq(irq, desc, regs);+                }+                irq++;+                desc++;+                mask >>= 1;+        }+}++static void+imx21_gpio_demux_handler(unsigned int irq_unused, struct irqdesc *desc,+                        struct pt_regs *regs)+{+        unsigned int mask, irq;+	int i;++	for(i=0;i<6;i++) {+		mask = GPIO_ISR(i);+		if(mask) {+			irq = IRQ_GPIOA(0) + (i<<5);+			imx21_gpio_handler(mask, irq, desc, regs);+		}+	}+}+++void __init+imx21_init_irq(void)+{+        unsigned int i,irq;++        for (i = 0; i < AITC_NUM_IRQS; i++) {+		set_irq_chip(i,&imx21_aitc_chip);+		set_irq_handler(i,do_level_IRQ);+		set_irq_flags(i, IRQF_VALID );+        }+	for (irq = IRQ_GPIOA(0); irq < IRQ_GPIOF(32); irq++) {+                set_irq_chip(irq, &imx21_gpio_chip);+                set_irq_handler(irq, do_edge_IRQ);+                set_irq_flags(irq, IRQF_VALID);+        }+	set_irq_chained_handler(INT_GPIO, imx21_gpio_demux_handler);+	GPIO_PMASK = 31;++        /* Disable all interrupts initially. */+        /* In mx2 this is done in the bootloader. */+}diff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx2/Kconfig linux-2.6.18-fs3/arch/arm/mach-imx2/Kconfig--- linux-2.6.18/arch/arm/mach-imx2/Kconfig	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.18-fs3/arch/arm/mach-imx2/Kconfig	2006-10-16 13:44:07.000000000 +0200@@ -0,0 +1,18 @@+menu "IMX21 Implementations"+        depends on ARCH_IMX21++config ARCH_MX2ADS+        bool "mx2ads"+        depends on ARCH_IMX21+        select ISA+        help+          Say Y here if you are using the Motorola MX2ADS board++config ARCH_MX21FS3+        bool "mx21fs3"+        depends on ARCH_IMX21+        select ISA+        help+          Say Y here if you are using the Motorola MX2FS3 board++endmenudiff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx2/Makefile linux-2.6.18-fs3/arch/arm/mach-imx2/Makefile--- linux-2.6.18/arch/arm/mach-imx2/Makefile	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.18-fs3/arch/arm/mach-imx2/Makefile	2006-10-16 13:44:07.000000000 +0200@@ -0,0 +1,14 @@+#+# Makefile for the linux kernel.+#+# Note! Dependencies are done automagically by 'make dep', which also+# removes any old dependencies. DON'T put your own dependencies here+# unless it's something special (ie not a .c file).++# Object file lists.++obj-y                   += irq.o time.o generic.o dma.o++# Specific board support+obj-$(CONFIG_ARCH_MX2ADS) += mx2ads.o+obj-$(CONFIG_ARCH_MX21FS3) += mx21fs3.odiff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx2/Makefile.boot linux-2.6.18-fs3/arch/arm/mach-imx2/Makefile.boot--- linux-2.6.18/arch/arm/mach-imx2/Makefile.boot	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.18-fs3/arch/arm/mach-imx2/Makefile.boot	2006-10-16 13:44:07.000000000 +0200@@ -0,0 +1,3 @@+zreladdr-$(CONFIG_ARCH_MX2ADS)      := 0xC0008000+zreladdr-$(CONFIG_ARCH_MX21FS3)      := 0xC0008000+params_phys-y   := 0xC0000100diff -Nur -X linux/Documentation/dontdiff linux-2.6.18/arch/arm/mach-imx2/mx21fs3.c linux-2.6.18-fs3/arch/arm/mach-imx2/mx21fs3.c--- linux-2.6.18/arch/arm/mach-imx2/mx21fs3.c	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.18-fs3/arch/arm/mach-imx2/mx21fs3.c	2006-10-27 09:18:26.000000000 +0200@@ -0,0 +1,271 @@+#include <linux/device.h>+#include <linux/init.h>+#include <linux/platform_device.h>+#include <asm/system.h>+#include <asm/hardware.h>+#include <asm/irq.h>+#include <asm/pgtable.h>+#include <asm/page.h>++#include <asm/mach/map.h>+#include <asm/mach-types.h>+#include <linux/spi/spi.h>++//#include <linux/spi/ads7846.h>+#include <asm/arch/gpio.h>++#include <asm/mach/arch.h>+#include <linux/interrupt.h>+#include <linux/irq.h>+#include "generic.h"+#include <asm/serial.h>+#include <asm/dma.h>++

⌨️ 快捷键说明

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