📄 2.6.18-rc4-at91.patch.gz
字号:
+ .dev = {+ .platform_data = &uart2_data,+ .coherent_dma_mask = 0xffffffff,+ },+ .resource = uart2_resources,+ .num_resources = ARRAY_SIZE(uart2_resources),+};++static inline void configure_usart2_pins(void)+{+ at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */+ at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */+}++static struct resource uart3_resources[] = {+ [0] = {+ .start = AT91RM9200_BASE_US3,+ .end = AT91RM9200_BASE_US3 + SZ_16K - 1,+ .flags = IORESOURCE_MEM,+ },+ [1] = {+ .start = AT91RM9200_ID_US3,+ .end = AT91RM9200_ID_US3,+ .flags = IORESOURCE_IRQ,+ },+};++static struct at91_uart_data uart3_data = {+ .use_dma_tx = 1,+ .use_dma_rx = 1,+};++static struct platform_device at91rm9200_uart3_device = {+ .name = "at91_usart",+ .id = 4,+ .dev = {+ .platform_data = &uart3_data,+ .coherent_dma_mask = 0xffffffff,+ },+ .resource = uart3_resources,+ .num_resources = ARRAY_SIZE(uart3_resources),+};++static inline void configure_usart3_pins(void)+{+ at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */+ at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */+}++struct platform_device *at91_uarts[AT91_MAX_UART]; /* the UARTs to use */+struct platform_device *at91_default_console_device; /* the serial console device */++void __init at91_init_serial(struct at91_uart_config *config)+{+ int i;++ /* Fill in list of supported UARTs */+ for (i = 0; i < config->nr_tty; i++) {+ switch (config->tty_map[i]) {+ case 0:+ configure_usart0_pins();+ at91_uarts[i] = &at91rm9200_uart0_device;+ at91_clock_associate("usart0_clk", &at91rm9200_uart0_device.dev, "usart");+ break;+ case 1:+ configure_usart1_pins();+ at91_uarts[i] = &at91rm9200_uart1_device;+ at91_clock_associate("usart1_clk", &at91rm9200_uart1_device.dev, "usart");+ break;+ case 2:+ configure_usart2_pins();+ at91_uarts[i] = &at91rm9200_uart2_device;+ at91_clock_associate("usart2_clk", &at91rm9200_uart2_device.dev, "usart");+ break;+ case 3:+ configure_usart3_pins();+ at91_uarts[i] = &at91rm9200_uart3_device;+ at91_clock_associate("usart3_clk", &at91rm9200_uart3_device.dev, "usart");+ break;+ case 4:+ configure_dbgu_pins();+ at91_uarts[i] = &at91rm9200_dbgu_device;+ at91_clock_associate("mck", &at91rm9200_dbgu_device.dev, "usart");+ break;+ default:+ continue;+ }+ at91_uarts[i]->id = i; /* update ID number to mapped ID */+ }++ /* Set serial console device */+ if (config->console_tty < AT91_MAX_UART)+ at91_default_console_device = at91_uarts[config->console_tty];+ if (!at91_default_console_device)+ printk(KERN_INFO "AT91: No default serial console defined.\n");+}++void __init at91_add_device_serial(void)+{+ int i;++ for (i = 0; i < AT91_MAX_UART; i++) {+ if (at91_uarts[i])+ platform_device_register(at91_uarts[i]);+ }+}+#else+void __init at91_init_serial(struct at91_uart_config *config) {}+void __init at91_add_device_serial(void) {}+#endif+++/* -------------------------------------------------------------------- */++/*+ * These devices are always present and don't need any board-specific+ * setup.+ */+static int __init at91_add_standard_devices(void)+{+ at91_add_device_rtc();+ at91_add_device_watchdog();+ return 0;+}++arch_initcall(at91_add_standard_devices);diff -urN -x CVS linux-2.6.18-rc4/arch/arm/mach-at91rm9200/at91rm9200_time.c linux-2.6.18-rc4-at91/arch/arm/mach-at91rm9200/at91rm9200_time.c--- linux-2.6.18-rc4/arch/arm/mach-at91rm9200/at91rm9200_time.c Fri Aug 25 10:49:30 2006+++ linux-2.6.18-rc4-at91/arch/arm/mach-at91rm9200/at91rm9200_time.c Thu Aug 10 08:49:11 2006@@ -113,7 +113,7 @@ (void) at91_sys_read(AT91_ST_SR); /* Clear any pending interrupts */ /* Make IRQs happen for the system timer */- setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq);+ setup_irq(AT91RM9200_ID_SYS, &at91rm9200_timer_irq); /* Change the kernel's 'tick' value to 10009 usec. (the default is 10000) */ tick_usec = (LATCH * 1000000) / CLOCK_TICK_RATE;diff -urN -x CVS linux-2.6.18-rc4/arch/arm/mach-at91rm9200/at91sam9261.c linux-2.6.18-rc4-at91/arch/arm/mach-at91rm9200/at91sam9261.c--- linux-2.6.18-rc4/arch/arm/mach-at91rm9200/at91sam9261.c Thu Jan 1 02:00:00 1970+++ linux-2.6.18-rc4-at91/arch/arm/mach-at91rm9200/at91sam9261.c Fri Aug 25 10:36:19 2006@@ -0,0 +1,268 @@+/*+ * arch/arm/mach-at91rm9200/at91sam9261.c+ *+ * Copyright (C) 2005 SAN People+ *+ * 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.+ *+ */++#include <linux/module.h>++#include <asm/mach/arch.h>+#include <asm/mach/map.h>++#include <asm/hardware.h>+#include <asm/arch/at91sam9261.h>++#include "generic.h"+#include "clock.h"++static struct map_desc at91sam9261_io_desc[] __initdata = {+ {+ .virtual = AT91_VA_BASE_SYS,+ .pfn = __phys_to_pfn(AT91SAM9261_BASE_SYS),+ .length = SZ_16K,+ .type = MT_DEVICE,+ }, {+ .virtual = AT91_VA_BASE_UDP,+ .pfn = __phys_to_pfn(AT91SAM9261_BASE_UDP),+ .length = SZ_16K,+ .type = MT_DEVICE,+ }, {+ .virtual = AT91_SRAM_VIRT_BASE,+ .pfn = __phys_to_pfn(AT91SAM9261_SRAM_BASE),+ .length = AT91SAM9261_SRAM_SIZE,+ .type = MT_DEVICE,+ },+};++/* --------------------------------------------------------------------+ * Clocks+ * -------------------------------------------------------------------- */++/*+ * The peripheral clocks.+ */+static struct clk udc_clk = {+ .name = "udc_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_UDP,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk ohci_clk = {+ .name = "ohci_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_UHP,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk mmc_clk = {+ .name = "mci_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_MCI,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk twi_clk = {+ .name = "twi_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_TWI,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk usart0_clk = {+ .name = "usart0_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_US0,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk usart1_clk = {+ .name = "usart1_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_US1,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk usart2_clk = {+ .name = "usart2_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_US2,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk spi0_clk = {+ .name = "spi0_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_SPI0,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk spi1_clk = {+ .name = "spi0_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_SPI1,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk pioA_clk = {+ .name = "pioA_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_PIOA,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk pioB_clk = {+ .name = "pioB_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_PIOB,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk pioC_clk = {+ .name = "pioC_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_PIOC,+ .type = CLK_TYPE_PERIPHERAL,+};+static struct clk lcdc_clk = {+ .name = "lcdc_clk",+ .pmc_mask = 1 << AT91SAM9261_ID_LCDC,+ .type = CLK_TYPE_PERIPHERAL,+};++static struct clk *periph_clocks[] __initdata = {+ &pioA_clk,+ &pioB_clk,+ &pioC_clk,+ &usart0_clk,+ &usart1_clk,+ &usart2_clk,+ &mmc_clk,+ &udc_clk,+ &twi_clk,+ &spi0_clk,+ &spi1_clk,+ // ssc 0 .. ssc2+ // tc0 .. tc2+ &ohci_clk,+ &lcdc_clk,+ // irq0 .. irq2+};++/*+ * The four programmable clocks.+ * You must configure pin multiplexing to bring these signals out.+ */+static struct clk pck0 = {+ .name = "pck0",+ .pmc_mask = AT91_PMC_PCK0,+ .type = CLK_TYPE_PROGRAMMABLE,+ .id = 0,+};+static struct clk pck1 = {+ .name = "pck1",+ .pmc_mask = AT91_PMC_PCK1,+ .type = CLK_TYPE_PROGRAMMABLE,+ .id = 1,+};+static struct clk pck2 = {+ .name = "pck2",+ .pmc_mask = AT91_PMC_PCK2,+ .type = CLK_TYPE_PROGRAMMABLE,+ .id = 2,+};+static struct clk pck3 = {+ .name = "pck3",+ .pmc_mask = AT91_PMC_PCK3,+ .type = CLK_TYPE_PROGRAMMABLE,+ .id = 3,+};++static void __init at91sam9261_register_clocks(void)+{+ int i;++ for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)+ clk_register(periph_clocks[i]);++ clk_register(&pck0);+ clk_register(&pck1);+ clk_register(&pck2);+ clk_register(&pck3);+}++/* --------------------------------------------------------------------+ * GPIO+ * -------------------------------------------------------------------- */++static struct at91_gpio_bank at91sam9261_gpio[] = {+ {+ .id = AT91SAM9261_ID_PIOA,+ .offset = AT91_PIOA,+ .clock = &pioA_clk,+ }, {+ .id = AT91SAM9261_ID_PIOB,+ .offset = AT91_PIOB,+ .clock = &pioB_clk,+ }, {+ .id = AT91SAM9261_ID_PIOC,+ .offset = AT91_PIOC,+ .clock = &pioC_clk,+ }+};++/* --------------------------------------------------------------------+ * AT91SAM9261 processor initialization+ * -------------------------------------------------------------------- */++void __init at91sam9261_initialize(unsigned long main_clock)+{+ /* Map peripherals */+ iotable_init(at91sam9261_io_desc, ARRAY_SIZE(at91sam9261_io_desc));++ /* Init clock subsystem */+ at91_clock_init(main_clock);++ /* Register the processor-specific clocks */+ at91sam9261_register_clocks();++ /* Register GPIO subsystem */+ at91_gpio_init(at91sam9261_gpio, 3);+}++/* --------------------------------------------------------------------+ * Interrupt initialization+ * -------------------------------------------------------------------- */++/*+ * The default interrupt priority levels (0 = lowest, 7 = highest).+ */+static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {+ 7, /* Advanced Interrupt Controller */+ 7, /* System Peripherals */+ 0, /* Parallel IO Controller A */+ 0, /* Parallel IO Controller B */+ 0, /* Parallel IO Controller C */+ 0,+ 6, /* USART 0 */+ 6, /* USART 1 */+ 6, /* USART 2 */+ 0, /* Multimedia Card Interface */+ 4, /* USB Device Port */+ 0, /* Two-Wire Interface */+ 6, /* Serial Peripheral Interface 0 */+ 6, /* Serial Peripheral Interface 1 */+ 5, /* Serial Synchronous Controller 0 */+ 5, /* Serial Synchronous Controller 1 */+ 5, /* Serial Synchronous Controller 2 */+ 0, /* Timer Counter 0 */+ 0, /* Timer Counter 1 */+ 0, /* Timer Counter 2 */+ 3, /* USB Host port */+ 3, /* LCD Controller */+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0,+ 0, /* Advanced Interrupt Controller */+ 0, /* Advanced Interrupt Controller */+ 0, /* Advanced Interrupt Controller */+};++void __init at91sam9261_init_irq(unsigned int priority[NR_AIC_IRQS])+{+ if (!priority)+ priority = at91sam9261_default_irq_priority;++ /* Initialize the AIC interrupt controller */+ at91_aic_init(priority);++ /* Enable GPIO interrupts */+ at91_gpio_irq_setup();+}diff -urN -x CVS linux-2.6.18-rc4/arch/arm/mach-at91rm9200/at91sam9261_devices.c linux-2.6.18-rc4-at91/arch/arm/mach-at91rm9200/at91sam9261_devices.c--- linux-2.6.18-rc4/arch/arm/mach-at91rm9200/at91sam9261_devices.c Thu Jan 1 02:00:00 1970+++ linux-2.6.18-rc4-at91/arch/arm/mach-at91rm9200/at91sam9261_devices.c Sat Aug 19 17:35:20 2006@@ -0,0 +1,678 @@+/*+ * arch/arm/mach-at91rm9200/at91sam9261_devices.c+ *+ * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>+ * Copyright (C) 2005 David Brownell+ *+ * 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.+ *+ */+#include <asm/mach/arch.h>+#include <asm/mach/map.h>++#include <linux/platform_device.h>++#include <asm/hardware.h>+#include <asm/arch/board.h>+#include <asm/arch/gpio.h>+#include <asm/arch/at91sam9261.h>++#include "generic.h"++#define SZ_512 0x00000200+#define SZ_256 0x00000100+#define SZ_16 0x00000010++/* --------------------------------------------------------------------+ * USB Host+ * -------------------------------------------------------------------- */++#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)+static u64 ohci_dmamask = 0xffffffffUL;+static struct at91_usbh_data usbh_data;++static struct resource at91_usbh_resources[] = {+ [0] = {+ .start = AT91SAM9261_UHP_BASE,+ .end = AT91SAM9261_UHP_BASE + SZ_1M - 1,+ .flags = IORESOURCE_MEM,+ },+ [1] = {+ .start = AT91SAM9261_ID_UHP,+ .end = AT91SAM9261_ID_UHP,+ .flags = IORESOURCE_IRQ,+ },+};++static struct platform_device at91rm9200_usbh_device = {+ .name = "at91_ohci",+ .id = -1,+ .dev = {+ .dma_mask = &ohci_dmamask,+ .coherent_dma_mask = 0xffffffff,+ .platform_data = &usbh_data,+ },+ .resource = at91_usbh_resources,+ .num_resources = ARRAY_SIZE(at91_usbh_resources),+};++void __init at91_add_device_usbh(struct at91_usbh_data *data)+{+ if (!data)+ return;++ usbh_data = *data;+ platform_device_register(&at91rm9200_usbh_device);+}+#else+void __init at91_add_device_usbh(struct at91_usbh_data *data) {}+#endif+++/* --------------------------------------------------------------------+ * USB Device (Gadget)+ * -------------------------------------------------------------------- */++#ifdef CONFIG_USB_GADGET_AT91+static struct at91_udc_data udc_data;++static struct resource at91_udc_resources[] = {+ [0] = {+ .start = AT91SAM9261_BASE_UDP,+ .end = AT91SAM9261_BASE_UDP + SZ_16K - 1,+ .flags = IORESOURCE_MEM,+ },+ [1] = {+ .start = AT91SAM9261_ID_UDP,+ .end = AT91SAM9261_ID_UDP,+ .flags = IORESOURCE_IRQ,+ },+};++static struct platform_device at91rm9200_udc_device = {+ .name = "at91_udc",+ .id = -1,+ .dev = {+ .platform_data = &udc_data,+ },+ .resource = at91_udc_resources,+ .num_resources = ARRAY_SIZE(at91_udc_resources),+};++void __init at91_add_device_udc(struct at91_udc_data *data)+{+ if (!data)+ return;++
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -