Commit 695a9d23 authored by Russell King's avatar Russell King Committed by Russell King

Merge AT91 branch

parents c322e24b 55c20c0a
...@@ -49,6 +49,18 @@ ...@@ -49,6 +49,18 @@
cmp r7, r3 cmp r7, r3
beq 99f beq 99f
@ Embest ATEB9200 : 923
mov r3, #(MACH_TYPE_ATEB9200 & 0xff)
orr r3, r3, #(MACH_TYPE_ATEB9200 & 0xff00)
cmp r7, r3
beq 99f
@ Sperry-Sun KAFA : 662
mov r3, #(MACH_TYPE_KAFA & 0xff)
orr r3, r3, #(MACH_TYPE_KAFA & 0xff00)
cmp r7, r3
beq 99f
@ Unknown board, use the AT91RM9200DK board @ Unknown board, use the AT91RM9200DK board
@ mov r7, #MACH_TYPE_AT91RM9200 @ mov r7, #MACH_TYPE_AT91RM9200
mov r7, #(MACH_TYPE_AT91RM9200DK & 0xff) mov r7, #(MACH_TYPE_AT91RM9200DK & 0xff)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -40,6 +40,18 @@ config MACH_KB9200 ...@@ -40,6 +40,18 @@ config MACH_KB9200
help help
Select this if you are using KwikByte's KB920x board Select this if you are using KwikByte's KB920x board
config MACH_ATEB9200
bool "Embest's ATEB9200"
depends on ARCH_AT91RM9200
help
Select this if you are using Embest's ATEB9200 board
config MACH_KAFA
bool "Sperry-Sun KAFA board"
depends on ARCH_AT91RM9200
help
Select this if you are using Sperry-Sun's KAFA board
comment "AT91RM9200 Feature Selections" comment "AT91RM9200 Feature Selections"
......
...@@ -7,22 +7,31 @@ obj-m := ...@@ -7,22 +7,31 @@ obj-m :=
obj-n := obj-n :=
obj- := obj- :=
obj-$(CONFIG_PM) += pm.o
# Board-specific support # Board-specific support
obj-$(CONFIG_ARCH_AT91RM9200DK) += board-dk.o obj-$(CONFIG_ARCH_AT91RM9200DK) += board-dk.o
obj-$(CONFIG_MACH_AT91RM9200EK) += board-ek.o obj-$(CONFIG_MACH_AT91RM9200EK) += board-ek.o
obj-$(CONFIG_MACH_CSB337) += board-csb337.o obj-$(CONFIG_MACH_CSB337) += board-csb337.o
obj-$(CONFIG_MACH_CSB637) += board-csb637.o obj-$(CONFIG_MACH_CSB637) += board-csb637.o
#obj-$(CONFIG_MACH_CARMEVA) += board-carmeva.o obj-$(CONFIG_MACH_CARMEVA) += board-carmeva.o
#obj-$(CONFIG_MACH_KB9200) += board-kb9202.o obj-$(CONFIG_MACH_KB9200) += board-kb9202.o
obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o
obj-$(CONFIG_MACH_KAFA) += board-kafa.o
# LEDs support # LEDs support
led-$(CONFIG_ARCH_AT91RM9200DK) += leds.o led-$(CONFIG_ARCH_AT91RM9200DK) += leds.o
led-$(CONFIG_MACH_AT91RM9200EK) += leds.o led-$(CONFIG_MACH_AT91RM9200EK) += leds.o
led-$(CONFIG_MACH_CSB337) += leds.o led-$(CONFIG_MACH_CSB337) += leds.o
led-$(CONFIG_MACH_CSB637) += leds.o led-$(CONFIG_MACH_CSB637) += leds.o
#led-$(CONFIG_MACH_KB9200) += leds.o led-$(CONFIG_MACH_KB9200) += leds.o
#led-$(CONFIG_MACH_KAFA) += leds.o led-$(CONFIG_MACH_KAFA) += leds.o
obj-$(CONFIG_LEDS) += $(led-y) obj-$(CONFIG_LEDS) += $(led-y)
# VGA support # VGA support
#obj-$(CONFIG_FB_S1D13XXX) += ics1523.o #obj-$(CONFIG_FB_S1D13XXX) += ics1523.o
ifeq ($(CONFIG_PM_DEBUG),y)
CFLAGS_pm.o += -DDEBUG
endif
/*
* linux/arch/arm/mach-at91rm9200/board-carmeva.c
*
* Copyright (c) 2005 Peer Georgi
* Conitec Datasystems
*
* 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/config.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/hardware.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/arch/hardware.h>
#include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h"
static void __init carmeva_init_irq(void)
{
/* Initialize AIC controller */
at91rm9200_init_irq(NULL);
/* Set up the GPIO interrupts */
at91_gpio_irq_setup(BGA_GPIO_BANKS);
}
/*
* Serial port configuration.
* 0 .. 3 = USART0 .. USART3
* 4 = DBGU
*/
static struct at91_uart_config __initdata carmeva_uart_config = {
.console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init carmeva_map_io(void)
{
at91rm9200_map_io();
/* Initialize clocks: 20.000 MHz crystal */
at91_clock_init(20000000);
/* Setup the serial ports and console */
at91_init_serial(&carmeva_uart_config);
}
static struct at91_eth_data __initdata carmeva_eth_data = {
.phy_irq_pin = AT91_PIN_PC4,
.is_rmii = 1,
};
static struct at91_usbh_data __initdata carmeva_usbh_data = {
.ports = 2,
};
static struct at91_udc_data __initdata carmeva_udc_data = {
.vbus_pin = AT91_PIN_PD12,
.pullup_pin = AT91_PIN_PD9,
};
/* FIXME: user dependend */
// static struct at91_cf_data __initdata carmeva_cf_data = {
// .det_pin = AT91_PIN_PB0,
// .rst_pin = AT91_PIN_PC5,
// .irq_pin = ... not connected
// .vcc_pin = ... always powered
// };
static struct at91_mmc_data __initdata carmeva_mmc_data = {
.is_b = 0,
.wire4 = 1,
};
static void __init carmeva_board_init(void)
{
/* Serial */
at91_add_device_serial();
/* Ethernet */
at91_add_device_eth(&carmeva_eth_data);
/* USB Host */
at91_add_device_usbh(&carmeva_usbh_data);
/* USB Device */
at91_add_device_udc(&carmeva_udc_data);
/* I2C */
at91_add_device_i2c();
/* Compact Flash */
// at91_add_device_cf(&carmeva_cf_data);
/* SPI */
// at91_add_device_spi(NULL, 0);
/* MMC */
at91_add_device_mmc(&carmeva_mmc_data);
}
MACHINE_START(CARMEVA, "Carmeva")
/* Maintainer: Conitec Datasystems */
.phys_io = AT91_BASE_SYS,
.io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
.boot_params = AT91_SDRAM_BASE + 0x100,
.timer = &at91rm9200_timer,
.map_io = carmeva_map_io,
.init_irq = carmeva_init_irq,
.init_machine = carmeva_board_init,
MACHINE_END
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/setup.h> #include <asm/setup.h>
...@@ -35,8 +36,8 @@ ...@@ -35,8 +36,8 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#include <asm/mach/serial_at91rm9200.h>
#include <asm/arch/board.h> #include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h" #include "generic.h"
...@@ -54,32 +55,24 @@ static void __init csb337_init_irq(void) ...@@ -54,32 +55,24 @@ static void __init csb337_init_irq(void)
* 0 .. 3 = USART0 .. USART3 * 0 .. 3 = USART0 .. USART3
* 4 = DBGU * 4 = DBGU
*/ */
#define CSB337_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ static struct at91_uart_config __initdata csb337_uart_config = {
#define CSB337_SERIAL_CONSOLE 0 /* ttyS0 */ .console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init csb337_map_io(void) static void __init csb337_map_io(void)
{ {
int serial[AT91_NR_UART] = CSB337_UART_MAP;
int i;
at91rm9200_map_io(); at91rm9200_map_io();
/* Initialize clocks: 3.6864 MHz crystal */ /* Initialize clocks: 3.6864 MHz crystal */
at91_clock_init(3686400); at91_clock_init(3686400);
/* Setup the LEDs */ /* Setup the LEDs */
at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
#ifdef CONFIG_SERIAL_AT91 /* Setup the serial ports and console */
at91_console_port = CSB337_SERIAL_CONSOLE; at91_init_serial(&csb337_uart_config);
memcpy(at91_serial_map, serial, sizeof(serial));
/* Register UARTs */
for (i = 0; i < AT91_NR_UART; i++) {
if (serial[i] >= 0)
at91_register_uart(i, serial[i]);
}
#endif
} }
static struct at91_eth_data __initdata csb337_eth_data = { static struct at91_eth_data __initdata csb337_eth_data = {
...@@ -118,17 +111,31 @@ static struct at91_mmc_data __initdata csb337_mmc_data = { ...@@ -118,17 +111,31 @@ static struct at91_mmc_data __initdata csb337_mmc_data = {
.wp_pin = AT91_PIN_PD6, .wp_pin = AT91_PIN_PD6,
}; };
static struct spi_board_info csb337_spi_devices[] = {
{ /* CAN controller */
.modalias = "sak82c900",
.chip_select = 0,
.max_speed_hz = 6 * 1000 * 1000,
},
};
static void __init csb337_board_init(void) static void __init csb337_board_init(void)
{ {
/* Serial */
at91_add_device_serial();
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&csb337_eth_data); at91_add_device_eth(&csb337_eth_data);
/* USB Host */ /* USB Host */
at91_add_device_usbh(&csb337_usbh_data); at91_add_device_usbh(&csb337_usbh_data);
/* USB Device */ /* USB Device */
at91_add_device_udc(&csb337_udc_data); at91_add_device_udc(&csb337_udc_data);
/* I2C */
at91_add_device_i2c();
/* Compact Flash */ /* Compact Flash */
at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */ at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */
at91_add_device_cf(&csb337_cf_data); at91_add_device_cf(&csb337_cf_data);
/* SPI */
at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices));
/* MMC */ /* MMC */
at91_add_device_mmc(&csb337_mmc_data); at91_add_device_mmc(&csb337_mmc_data);
} }
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#include <asm/mach/serial_at91rm9200.h>
#include <asm/arch/board.h> #include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h" #include "generic.h"
...@@ -54,14 +54,14 @@ static void __init csb637_init_irq(void) ...@@ -54,14 +54,14 @@ static void __init csb637_init_irq(void)
* 0 .. 3 = USART0 .. USART3 * 0 .. 3 = USART0 .. USART3
* 4 = DBGU * 4 = DBGU
*/ */
#define CSB637_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ static struct at91_uart_config __initdata csb637_uart_config = {
#define CSB637_SERIAL_CONSOLE 0 /* ttyS0 */ .console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init csb637_map_io(void) static void __init csb637_map_io(void)
{ {
int serial[AT91_NR_UART] = CSB637_UART_MAP;
int i;
at91rm9200_map_io(); at91rm9200_map_io();
/* Initialize clocks: 3.6864 MHz crystal */ /* Initialize clocks: 3.6864 MHz crystal */
...@@ -70,16 +70,8 @@ static void __init csb637_map_io(void) ...@@ -70,16 +70,8 @@ static void __init csb637_map_io(void)
/* Setup the LEDs */ /* Setup the LEDs */
at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
#ifdef CONFIG_SERIAL_AT91 /* Setup the serial ports and console */
at91_console_port = CSB637_SERIAL_CONSOLE; at91_init_serial(&csb637_uart_config);
memcpy(at91_serial_map, serial, sizeof(serial));
/* Register UARTs */
for (i = 0; i < AT91_NR_UART; i++) {
if (serial[i] >= 0)
at91_register_uart(i, serial[i]);
}
#endif
} }
static struct at91_eth_data __initdata csb637_eth_data = { static struct at91_eth_data __initdata csb637_eth_data = {
...@@ -98,12 +90,18 @@ static struct at91_udc_data __initdata csb637_udc_data = { ...@@ -98,12 +90,18 @@ static struct at91_udc_data __initdata csb637_udc_data = {
static void __init csb637_board_init(void) static void __init csb637_board_init(void)
{ {
/* Serial */
at91_add_device_serial();
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&csb637_eth_data); at91_add_device_eth(&csb637_eth_data);
/* USB Host */ /* USB Host */
at91_add_device_usbh(&csb637_usbh_data); at91_add_device_usbh(&csb637_usbh_data);
/* USB Device */ /* USB Device */
at91_add_device_udc(&csb637_udc_data); at91_add_device_udc(&csb637_udc_data);
/* I2C */
at91_add_device_i2c();
/* SPI */
at91_add_device_spi(NULL, 0);
} }
MACHINE_START(CSB637, "Cogent CSB637") MACHINE_START(CSB637, "Cogent CSB637")
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/setup.h> #include <asm/setup.h>
...@@ -38,8 +39,8 @@ ...@@ -38,8 +39,8 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#include <asm/mach/serial_at91rm9200.h>
#include <asm/arch/board.h> #include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h" #include "generic.h"
...@@ -57,14 +58,14 @@ static void __init dk_init_irq(void) ...@@ -57,14 +58,14 @@ static void __init dk_init_irq(void)
* 0 .. 3 = USART0 .. USART3 * 0 .. 3 = USART0 .. USART3
* 4 = DBGU * 4 = DBGU
*/ */
#define DK_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ static struct at91_uart_config __initdata dk_uart_config = {
#define DK_SERIAL_CONSOLE 0 /* ttyS0 */ .console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init dk_map_io(void) static void __init dk_map_io(void)
{ {
int serial[AT91_NR_UART] = DK_UART_MAP;
int i;
at91rm9200_map_io(); at91rm9200_map_io();
/* Initialize clocks: 18.432 MHz crystal */ /* Initialize clocks: 18.432 MHz crystal */
...@@ -73,16 +74,8 @@ static void __init dk_map_io(void) ...@@ -73,16 +74,8 @@ static void __init dk_map_io(void)
/* Setup the LEDs */ /* Setup the LEDs */
at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
#ifdef CONFIG_SERIAL_AT91 /* Setup the serial ports and console */
at91_console_port = DK_SERIAL_CONSOLE; at91_init_serial(&dk_uart_config);
memcpy(at91_serial_map, serial, sizeof(serial));
/* Register UARTs */
for (i = 0; i < AT91_NR_UART; i++) {
if (at91_serial_map[i] >= 0)
at91_register_uart(i, at91_serial_map[i]);
}
#endif
} }
static struct at91_eth_data __initdata dk_eth_data = { static struct at91_eth_data __initdata dk_eth_data = {
...@@ -111,16 +104,48 @@ static struct at91_mmc_data __initdata dk_mmc_data = { ...@@ -111,16 +104,48 @@ static struct at91_mmc_data __initdata dk_mmc_data = {
.wire4 = 1, .wire4 = 1,
}; };
static struct spi_board_info dk_spi_devices[] = {
{ /* DataFlash chip */
.modalias = "mtd_dataflash",
.chip_select = 0,
.max_speed_hz = 15 * 1000 * 1000,
},
{ /* UR6HCPS2-SP40 PS2-to-SPI adapter */
.modalias = "ur6hcps2",
.chip_select = 1,
.max_speed_hz = 250 * 1000,
},
{ /* TLV1504 ADC, 4 channels, 10 bits; one is a temp sensor */
.modalias = "tlv1504",
.chip_select = 2,
.max_speed_hz = 20 * 1000 * 1000,
},
#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
{ /* DataFlash card */
.modalias = "mtd_dataflash",
.chip_select = 3,
.max_speed_hz = 15 * 1000 * 1000,
}
#endif
};
static void __init dk_board_init(void) static void __init dk_board_init(void)
{ {
/* Serial */
at91_add_device_serial();
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&dk_eth_data); at91_add_device_eth(&dk_eth_data);
/* USB Host */ /* USB Host */
at91_add_device_usbh(&dk_usbh_data); at91_add_device_usbh(&dk_usbh_data);
/* USB Device */ /* USB Device */
at91_add_device_udc(&dk_udc_data); at91_add_device_udc(&dk_udc_data);
at91_set_multi_drive(dk_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
/* Compact Flash */ /* Compact Flash */
at91_add_device_cf(&dk_cf_data); at91_add_device_cf(&dk_cf_data);
/* I2C */
at91_add_device_i2c();
/* SPI */
at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices));
#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD #ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
/* DataFlash card */ /* DataFlash card */
at91_set_gpio_output(AT91_PIN_PB7, 0); at91_set_gpio_output(AT91_PIN_PB7, 0);
......
/*
* linux/arch/arm/mach-at91rm9200/board-eb9200.c
*
* Copyright (C) 2005 SAN People, adapted for ATEB9200 from Embest
* by Andrew Patrikalakis
*
* 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/config.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/device.h>
#include <asm/hardware.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/arch/hardware.h>
#include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h"
static void __init eb9200_init_irq(void)
{
/* Initialize AIC controller */
at91rm9200_init_irq(NULL);
/* Set up the GPIO interrupts */
at91_gpio_irq_setup(BGA_GPIO_BANKS);
}
/*
* Serial port configuration.
* 0 .. 3 = USART0 .. USART3
* 4 = DBGU
*/
static struct at91_uart_config __initdata eb9200_uart_config = {
.console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init eb9200_map_io(void)
{
at91rm9200_map_io();
/* Initialize clocks: 18.432 MHz crystal */
at91_clock_init(18432000);
/* Setup the serial ports and console */
at91_init_serial(&eb9200_uart_config);
}
static struct at91_eth_data __initdata eb9200_eth_data = {
.phy_irq_pin = AT91_PIN_PC4,
.is_rmii = 1,
};
static struct at91_usbh_data __initdata eb9200_usbh_data = {
.ports = 2,
};
static struct at91_udc_data __initdata eb9200_udc_data = {
.vbus_pin = AT91_PIN_PD4,
.pullup_pin = AT91_PIN_PD5,
};
static struct at91_cf_data __initdata eb9200_cf_data = {
.det_pin = AT91_PIN_PB0,
.rst_pin = AT91_PIN_PC5,
// .irq_pin = ... not connected
// .vcc_pin = ... always powered
};
static struct at91_mmc_data __initdata eb9200_mmc_data = {
.is_b = 0,
.wire4 = 1,
};
static void __init eb9200_board_init(void)
{
/* Serial */
at91_add_device_serial();
/* Ethernet */
at91_add_device_eth(&eb9200_eth_data);
/* USB Host */
at91_add_device_usbh(&eb9200_usbh_data);
/* USB Device */
at91_add_device_udc(&eb9200_udc_data);
/* I2C */
at91_add_device_i2c();
/* Compact Flash */
at91_add_device_cf(&eb9200_cf_data);
/* SPI */
at91_add_device_spi(NULL, 0);
/* MMC */
/* only supports 1 or 4 bit interface, not wired through to SPI */
at91_add_device_mmc(&eb9200_mmc_data);
}
MACHINE_START(ATEB9200, "Embest ATEB9200")
.phys_io = AT91_BASE_SYS,
.io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
.boot_params = AT91_SDRAM_BASE + 0x100,
.timer = &at91rm9200_timer,
.map_io = eb9200_map_io,
.init_irq = eb9200_init_irq,
.init_machine = eb9200_board_init,
MACHINE_END
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/setup.h> #include <asm/setup.h>
...@@ -38,8 +39,8 @@ ...@@ -38,8 +39,8 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#include <asm/mach/serial_at91rm9200.h>
#include <asm/arch/board.h> #include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h" #include "generic.h"
...@@ -57,14 +58,14 @@ static void __init ek_init_irq(void) ...@@ -57,14 +58,14 @@ static void __init ek_init_irq(void)
* 0 .. 3 = USART0 .. USART3 * 0 .. 3 = USART0 .. USART3
* 4 = DBGU * 4 = DBGU
*/ */
#define EK_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */ static struct at91_uart_config __initdata ek_uart_config = {
#define EK_SERIAL_CONSOLE 0 /* ttyS0 */ .console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init ek_map_io(void) static void __init ek_map_io(void)
{ {
int serial[AT91_NR_UART] = EK_UART_MAP;
int i;
at91rm9200_map_io(); at91rm9200_map_io();
/* Initialize clocks: 18.432 MHz crystal */ /* Initialize clocks: 18.432 MHz crystal */
...@@ -73,16 +74,8 @@ static void __init ek_map_io(void) ...@@ -73,16 +74,8 @@ static void __init ek_map_io(void)
/* Setup the LEDs */ /* Setup the LEDs */
at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2); at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
#ifdef CONFIG_SERIAL_AT91 /* Setup the serial ports and console */
at91_console_port = EK_SERIAL_CONSOLE; at91_init_serial(&ek_uart_config);
memcpy(at91_serial_map, serial, sizeof(serial));
/* Register UARTs */
for (i = 0; i < AT91_NR_UART; i++) {
if (serial[i] >= 0)
at91_register_uart(i, serial[i]);
}
#endif
} }
static struct at91_eth_data __initdata ek_eth_data = { static struct at91_eth_data __initdata ek_eth_data = {
...@@ -106,14 +99,36 @@ static struct at91_mmc_data __initdata ek_mmc_data = { ...@@ -106,14 +99,36 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
.wp_pin = AT91_PIN_PA17, .wp_pin = AT91_PIN_PA17,
}; };
static struct spi_board_info ek_spi_devices[] = {
{ /* DataFlash chip */
.modalias = "mtd_dataflash",
.chip_select = 0,
.max_speed_hz = 15 * 1000 * 1000,
},
#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
{ /* DataFlash card */
.modalias = "mtd_dataflash",
.chip_select = 3,
.max_speed_hz = 15 * 1000 * 1000,
},
#endif
};
static void __init ek_board_init(void) static void __init ek_board_init(void)
{ {
/* Serial */
at91_add_device_serial();
/* Ethernet */ /* Ethernet */
at91_add_device_eth(&ek_eth_data); at91_add_device_eth(&ek_eth_data);
/* USB Host */ /* USB Host */
at91_add_device_usbh(&ek_usbh_data); at91_add_device_usbh(&ek_usbh_data);
/* USB Device */ /* USB Device */
at91_add_device_udc(&ek_udc_data); at91_add_device_udc(&ek_udc_data);
at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
/* I2C */
at91_add_device_i2c();
/* SPI */
at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD #ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
/* DataFlash card */ /* DataFlash card */
at91_set_gpio_output(AT91_PIN_PB22, 0); at91_set_gpio_output(AT91_PIN_PB22, 0);
......
/*
* linux/arch/arm/mach-at91rm9200/board-kafa.c
*
* Copyright (C) 2006 Sperry-Sun
*
* 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/config.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/hardware.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/arch/hardware.h>
#include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h"
static void __init kafa_init_irq(void)
{
/* Initialize AIC controller */
at91rm9200_init_irq(NULL);
/* Set up the GPIO interrupts */
at91_gpio_irq_setup(PQFP_GPIO_BANKS);
}
/*
* Serial port configuration.
* 0 .. 3 = USART0 .. USART3
* 4 = DBGU
*/
static struct at91_uart_config __initdata kafa_uart_config = {
.console_tty = 0, /* ttyS0 */
.nr_tty = 2,
.tty_map = { 4, 0, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init kafa_map_io(void)
{
at91rm9200_map_io();
/* Initialize clocks: 18.432 MHz crystal */
at91_clock_init(18432000);
/* Set up the LEDs */
at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4);
/* Setup the serial ports and console */
at91_init_serial(&kafa_uart_config);
}
static struct at91_eth_data __initdata kafa_eth_data = {
.phy_irq_pin = AT91_PIN_PC4,
.is_rmii = 0,
};
static struct at91_usbh_data __initdata kafa_usbh_data = {
.ports = 1,
};
static struct at91_udc_data __initdata kafa_udc_data = {
.vbus_pin = AT91_PIN_PB6,
.pullup_pin = AT91_PIN_PB7,
};
static void __init kafa_board_init(void)
{
/* Serial */
at91_add_device_serial();
/* Ethernet */
at91_add_device_eth(&kafa_eth_data);
/* USB Host */
at91_add_device_usbh(&kafa_usbh_data);
/* USB Device */
at91_add_device_udc(&kafa_udc_data);
/* I2C */
at91_add_device_i2c();
/* SPI */
at91_add_device_spi(NULL, 0);
}
MACHINE_START(KAFA, "Sperry-Sun KAFA")
/* Maintainer: Sergei Sharonov */
.phys_io = AT91_BASE_SYS,
.io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
.boot_params = AT91_SDRAM_BASE + 0x100,
.timer = &at91rm9200_timer,
.map_io = kafa_map_io,
.init_irq = kafa_init_irq,
.init_machine = kafa_board_init,
MACHINE_END
/*
* linux/arch/arm/mach-at91rm9200/board-kb9202.c
*
* Copyright (c) 2005 kb_admin
* KwikByte, Inc.
*
* 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/config.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/hardware.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/arch/hardware.h>
#include <asm/arch/board.h>
#include <asm/arch/gpio.h>
#include "generic.h"
static void __init kb9202_init_irq(void)
{
/* Initialize AIC controller */
at91rm9200_init_irq(NULL);
/* Set up the GPIO interrupts */
at91_gpio_irq_setup(PQFP_GPIO_BANKS);
}
/*
* Serial port configuration.
* 0 .. 3 = USART0 .. USART3
* 4 = DBGU
*/
static struct at91_uart_config __initdata kb9202_uart_config = {
.console_tty = 0, /* ttyS0 */
.nr_tty = 3,
.tty_map = { 4, 0, 1, -1, -1 } /* ttyS0, ..., ttyS4 */
};
static void __init kb9202_map_io(void)
{
at91rm9200_map_io();
/* Initialize clocks: 10 MHz crystal */
at91_clock_init(10000000);
/* Set up the LEDs */
at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
/* Setup the serial ports and console */
at91_init_serial(&kb9202_uart_config);
}
static struct at91_eth_data __initdata kb9202_eth_data = {
.phy_irq_pin = AT91_PIN_PB29,
.is_rmii = 0,
};
static struct at91_usbh_data __initdata kb9202_usbh_data = {
.ports = 1,
};
static struct at91_udc_data __initdata kb9202_udc_data = {
.vbus_pin = AT91_PIN_PB24,
.pullup_pin = AT91_PIN_PB22,
};
static struct at91_mmc_data __initdata kb9202_mmc_data = {
.det_pin = AT91_PIN_PB2,
.is_b = 0,
.wire4 = 1,
};
static void __init kb9202_board_init(void)
{
/* Serial */
at91_add_device_serial();
/* Ethernet */
at91_add_device_eth(&kb9202_eth_data);
/* USB Host */
at91_add_device_usbh(&kb9202_usbh_data);
/* USB Device */
at91_add_device_udc(&kb9202_udc_data);
/* MMC */
at91_add_device_mmc(&kb9202_mmc_data);
/* I2C */
at91_add_device_i2c();
/* SPI */
at91_add_device_spi(NULL, 0);
}
MACHINE_START(KB9200, "KB920x")
/* Maintainer: KwikByte, Inc. */
.phys_io = AT91_BASE_SYS,
.io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
.boot_params = AT91_SDRAM_BASE + 0x100,
.timer = &at91rm9200_timer,
.map_io = kb9202_map_io,
.init_irq = kb9202_init_irq,
.init_machine = kb9202_board_init,
MACHINE_END
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#include <asm/arch/board.h> /* for master clock global */
#include "generic.h" #include "generic.h"
/* /*
* There's a lot more which can be done with clocks, including cpufreq * There's a lot more which can be done with clocks, including cpufreq
* integration, slow clock mode support (for system suspend), letting * integration, slow clock mode support (for system suspend), letting
...@@ -722,9 +722,6 @@ int __init at91_clock_init(unsigned long main_clock) ...@@ -722,9 +722,6 @@ int __init at91_clock_init(unsigned long main_clock)
(unsigned) main_clock / 1000000, (unsigned) main_clock / 1000000,
((unsigned) main_clock % 1000000) / 1000); ((unsigned) main_clock % 1000000) / 1000);
/* FIXME get rid of master_clock global */
at91_master_clock = mck.rate_hz;
#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
/* establish PCK0..PCK3 parentage */ /* establish PCK0..PCK3 parentage */
for (tmp = 0; tmp < ARRAY_SIZE(clock_list); tmp++) { for (tmp = 0; tmp < ARRAY_SIZE(clock_list); tmp++) {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
#include "generic.h"
static struct map_desc at91rm9200_io_desc[] __initdata = { static struct map_desc at91rm9200_io_desc[] __initdata = {
{ {
...@@ -94,6 +95,11 @@ static struct map_desc at91rm9200_io_desc[] __initdata = { ...@@ -94,6 +95,11 @@ static struct map_desc at91rm9200_io_desc[] __initdata = {
.pfn = __phys_to_pfn(AT91_BASE_TCB0), .pfn = __phys_to_pfn(AT91_BASE_TCB0),
.length = SZ_16K, .length = SZ_16K,
.type = MT_DEVICE, .type = MT_DEVICE,
}, {
.virtual = AT91_SRAM_VIRT_BASE,
.pfn = __phys_to_pfn(AT91_SRAM_BASE),
.length = AT91_SRAM_SIZE,
.type = MT_DEVICE,
}, },
}; };
...@@ -102,14 +108,3 @@ void __init at91rm9200_map_io(void) ...@@ -102,14 +108,3 @@ void __init at91rm9200_map_io(void)
iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc)); iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc));
} }
unsigned long at91_master_clock;
EXPORT_SYMBOL(at91_master_clock);
int at91_serial_map[AT91_NR_UART];
int at91_console_port;
EXPORT_SYMBOL(at91_serial_map);
EXPORT_SYMBOL(at91_console_port);
This diff is collapsed.
...@@ -16,3 +16,10 @@ extern struct sys_timer at91rm9200_timer; ...@@ -16,3 +16,10 @@ extern struct sys_timer at91rm9200_timer;
extern void __init at91rm9200_map_io(void); extern void __init at91rm9200_map_io(void);
extern int __init at91_clock_init(unsigned long main_clock); extern int __init at91_clock_init(unsigned long main_clock);
struct device;
extern void __init at91_clock_associate(const char *id, struct device *dev, const char *func);
/* Power Management */
extern void at91_irq_suspend(void);
extern void at91_irq_resume(void);
...@@ -213,6 +213,84 @@ EXPORT_SYMBOL(at91_get_gpio_value); ...@@ -213,6 +213,84 @@ EXPORT_SYMBOL(at91_get_gpio_value);
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#ifdef CONFIG_PM
static u32 wakeups[BGA_GPIO_BANKS];
static u32 backups[BGA_GPIO_BANKS];
static int gpio_irq_set_wake(unsigned pin, unsigned state)
{
unsigned mask = pin_to_mask(pin);
pin -= PIN_BASE;
pin /= 32;
if (unlikely(pin >= BGA_GPIO_BANKS))
return -EINVAL;
if (state)
wakeups[pin] |= mask;
else
wakeups[pin] &= ~mask;
return 0;
}
void at91_gpio_suspend(void)
{
int i;
for (i = 0; i < BGA_GPIO_BANKS; i++) {
u32 pio = pio_controller_offset[i];
/*
* Note: drivers should have disabled GPIO interrupts that
* aren't supposed to be wakeup sources.
* But that is not much good on ARM..... disable_irq() does
* not update the hardware immediately, so the hardware mask
* (IMR) has the wrong value (not current, too much is
* permitted).
*
* Our workaround is to disable all non-wakeup IRQs ...
* which is exactly what correct drivers asked for in the
* first place!
*/
backups[i] = at91_sys_read(pio + PIO_IMR);
at91_sys_write(pio_controller_offset[i] + PIO_IDR, backups[i]);
at91_sys_write(pio_controller_offset[i] + PIO_IER, wakeups[i]);
if (!wakeups[i]) {
disable_irq_wake(AT91_ID_PIOA + i);
at91_sys_write(AT91_PMC_PCDR, 1 << (AT91_ID_PIOA + i));
} else {
enable_irq_wake(AT91_ID_PIOA + i);
#ifdef CONFIG_PM_DEBUG
printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", "ABCD"[i], wakeups[i]);
#endif
}
}
}
void at91_gpio_resume(void)
{
int i;
for (i = 0; i < BGA_GPIO_BANKS; i++) {
at91_sys_write(pio_controller_offset[i] + PIO_IDR, wakeups[i]);
at91_sys_write(pio_controller_offset[i] + PIO_IER, backups[i]);
}
at91_sys_write(AT91_PMC_PCER,
(1 << AT91_ID_PIOA)
| (1 << AT91_ID_PIOB)
| (1 << AT91_ID_PIOC)
| (1 << AT91_ID_PIOD));
}
#else
#define gpio_irq_set_wake NULL
#endif
/* Several AIC controller irqs are dispatched through this GPIO handler. /* Several AIC controller irqs are dispatched through this GPIO handler.
* To use any AT91_PIN_* as an externally triggered IRQ, first call * To use any AT91_PIN_* as an externally triggered IRQ, first call
...@@ -252,6 +330,7 @@ static struct irqchip gpio_irqchip = { ...@@ -252,6 +330,7 @@ static struct irqchip gpio_irqchip = {
.mask = gpio_irq_mask, .mask = gpio_irq_mask,
.unmask = gpio_irq_unmask, .unmask = gpio_irq_unmask,
.set_type = gpio_irq_type, .set_type = gpio_irq_type,
.set_wake = gpio_irq_set_wake,
}; };
static void gpio_irq_handler(unsigned irq, struct irqdesc *desc, struct pt_regs *regs) static void gpio_irq_handler(unsigned irq, struct irqdesc *desc, struct pt_regs *regs)
...@@ -266,6 +345,7 @@ static void gpio_irq_handler(unsigned irq, struct irqdesc *desc, struct pt_regs ...@@ -266,6 +345,7 @@ static void gpio_irq_handler(unsigned irq, struct irqdesc *desc, struct pt_regs
/* temporarily mask (level sensitive) parent IRQ */ /* temporarily mask (level sensitive) parent IRQ */
desc->chip->ack(irq); desc->chip->ack(irq);
for (;;) { for (;;) {
/* reading ISR acks the pending (edge triggered) GPIO interrupt */
isr = __raw_readl(pio + PIO_ISR) & __raw_readl(pio + PIO_IMR); isr = __raw_readl(pio + PIO_ISR) & __raw_readl(pio + PIO_IMR);
if (!isr) if (!isr)
break; break;
...@@ -315,15 +395,16 @@ void __init at91_gpio_irq_setup(unsigned banks) ...@@ -315,15 +395,16 @@ void __init at91_gpio_irq_setup(unsigned banks)
set_irq_chipdata(id, controller); set_irq_chipdata(id, controller);
for (i = 0; i < 32; i++, pin++) { for (i = 0; i < 32; i++, pin++) {
/*
* Can use the "simple" and not "edge" handler since it's
* shorter, and the AIC handles interupts sanely.
*/
set_irq_chip(pin, &gpio_irqchip); set_irq_chip(pin, &gpio_irqchip);
set_irq_handler(pin, do_simple_IRQ); set_irq_handler(pin, do_simple_IRQ);
set_irq_flags(pin, IRQF_VALID); set_irq_flags(pin, IRQF_VALID);
} }
set_irq_chained_handler(id, gpio_irq_handler); set_irq_chained_handler(id, gpio_irq_handler);
/* enable the PIO peripheral clock */
at91_sys_write(AT91_PMC_PCER, 1 << id);
} }
pr_info("AT91: %d gpio irqs in %d banks\n", pin - PIN_BASE, banks); pr_info("AT91: %d gpio irqs in %d banks\n", pin - PIN_BASE, banks);
} }
...@@ -92,10 +92,6 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type) ...@@ -92,10 +92,6 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type)
{ {
unsigned int smr, srctype; unsigned int smr, srctype;
/* change triggering only for FIQ and external IRQ0..IRQ6 */
if ((irq < AT91_ID_IRQ0) && (irq != AT91_ID_FIQ))
return -EINVAL;
switch (type) { switch (type) {
case IRQT_HIGH: case IRQT_HIGH:
srctype = AT91_AIC_SRCTYPE_HIGH; srctype = AT91_AIC_SRCTYPE_HIGH;
...@@ -104,9 +100,13 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type) ...@@ -104,9 +100,13 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type)
srctype = AT91_AIC_SRCTYPE_RISING; srctype = AT91_AIC_SRCTYPE_RISING;
break; break;
case IRQT_LOW: case IRQT_LOW:
if ((irq > AT91_ID_FIQ) && (irq < AT91_ID_IRQ0)) /* only supported on external interrupts */
return -EINVAL;
srctype = AT91_AIC_SRCTYPE_LOW; srctype = AT91_AIC_SRCTYPE_LOW;
break; break;
case IRQT_FALLING: case IRQT_FALLING:
if ((irq > AT91_ID_FIQ) && (irq < AT91_ID_IRQ0)) /* only supported on external interrupts */
return -EINVAL;
srctype = AT91_AIC_SRCTYPE_FALLING; srctype = AT91_AIC_SRCTYPE_FALLING;
break; break;
default: default:
...@@ -118,11 +118,47 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type) ...@@ -118,11 +118,47 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type)
return 0; return 0;
} }
#ifdef CONFIG_PM
static u32 wakeups;
static u32 backups;
static int at91rm9200_irq_set_wake(unsigned irq, unsigned value)
{
if (unlikely(irq >= 32))
return -EINVAL;
if (value)
wakeups |= (1 << irq);
else
wakeups &= ~(1 << irq);
return 0;
}
void at91_irq_suspend(void)
{
backups = at91_sys_read(AT91_AIC_IMR);
at91_sys_write(AT91_AIC_IDCR, backups);
at91_sys_write(AT91_AIC_IECR, wakeups);
}
void at91_irq_resume(void)
{
at91_sys_write(AT91_AIC_IDCR, wakeups);
at91_sys_write(AT91_AIC_IECR, backups);
}
#else
#define at91rm9200_irq_set_wake NULL
#endif
static struct irqchip at91rm9200_irq_chip = { static struct irqchip at91rm9200_irq_chip = {
.ack = at91rm9200_mask_irq, .ack = at91rm9200_mask_irq,
.mask = at91rm9200_mask_irq, .mask = at91rm9200_mask_irq,
.unmask = at91rm9200_unmask_irq, .unmask = at91rm9200_unmask_irq,
.set_type = at91rm9200_irq_type, .set_type = at91rm9200_irq_type,
.set_wake = at91rm9200_irq_set_wake,
}; };
/* /*
......
This diff is collapsed.
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
static unsigned long last_crtr;
/* /*
* The ST_CRTR is updated asynchronously to the master clock. It is therefore * The ST_CRTR is updated asynchronously to the master clock. It is therefore
* necessary to read it twice (with the same value) to ensure accuracy. * necessary to read it twice (with the same value) to ensure accuracy.
...@@ -56,7 +58,7 @@ static unsigned long at91rm9200_gettimeoffset(void) ...@@ -56,7 +58,7 @@ static unsigned long at91rm9200_gettimeoffset(void)
{ {
unsigned long elapsed; unsigned long elapsed;
elapsed = (read_CRTR() - at91_sys_read(AT91_ST_RTAR)) & AT91_ST_ALMV; elapsed = (read_CRTR() - last_crtr) & AT91_ST_ALMV;
return (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH; return (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH;
} }
...@@ -66,15 +68,12 @@ static unsigned long at91rm9200_gettimeoffset(void) ...@@ -66,15 +68,12 @@ static unsigned long at91rm9200_gettimeoffset(void)
*/ */
static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
unsigned long rtar;
if (at91_sys_read(AT91_ST_SR) & AT91_ST_PITS) { /* This is a shared interrupt */ if (at91_sys_read(AT91_ST_SR) & AT91_ST_PITS) { /* This is a shared interrupt */
write_seqlock(&xtime_lock); write_seqlock(&xtime_lock);
while (((read_CRTR() - at91_sys_read(AT91_ST_RTAR)) & AT91_ST_ALMV) >= LATCH) { while (((read_CRTR() - last_crtr) & AT91_ST_ALMV) >= LATCH) {
timer_tick(regs); timer_tick(regs);
rtar = (at91_sys_read(AT91_ST_RTAR) + LATCH) & AT91_ST_ALMV; last_crtr = (last_crtr + LATCH) & AT91_ST_ALMV;
at91_sys_write(AT91_ST_RTAR, rtar);
} }
write_sequnlock(&xtime_lock); write_sequnlock(&xtime_lock);
...@@ -87,10 +86,24 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id, struct pt_r ...@@ -87,10 +86,24 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id, struct pt_r
static struct irqaction at91rm9200_timer_irq = { static struct irqaction at91rm9200_timer_irq = {
.name = "at91_tick", .name = "at91_tick",
.flags = SA_SHIRQ | SA_INTERRUPT, .flags = SA_SHIRQ | SA_INTERRUPT | SA_TIMER,
.handler = at91rm9200_timer_interrupt .handler = at91rm9200_timer_interrupt
}; };
void at91rm9200_timer_reset(void)
{
last_crtr = 0;
/* Real time counter incremented every 30.51758 microseconds */
at91_sys_write(AT91_ST_RTMR, 1);
/* Set Period Interval timer */
at91_sys_write(AT91_ST_PIMR, LATCH);
/* Enable Period Interval Timer interrupt */
at91_sys_write(AT91_ST_IER, AT91_ST_PITS);
}
/* /*
* Set up timer interrupt. * Set up timer interrupt.
*/ */
...@@ -100,28 +113,30 @@ void __init at91rm9200_timer_init(void) ...@@ -100,28 +113,30 @@ void __init at91rm9200_timer_init(void)
at91_sys_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS); at91_sys_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS);
(void) at91_sys_read(AT91_ST_SR); /* Clear any pending interrupts */ (void) at91_sys_read(AT91_ST_SR); /* Clear any pending interrupts */
/* /* Make IRQs happen for the system timer */
* Make IRQs happen for the system timer.
*/
setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq); setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq);
/* Set initial alarm to 0 */
at91_sys_write(AT91_ST_RTAR, 0);
/* Real time counter incremented every 30.51758 microseconds */
at91_sys_write(AT91_ST_RTMR, 1);
/* Set Period Interval timer */
at91_sys_write(AT91_ST_PIMR, LATCH);
/* Change the kernel's 'tick' value to 10009 usec. (the default is 10000) */ /* Change the kernel's 'tick' value to 10009 usec. (the default is 10000) */
tick_usec = (LATCH * 1000000) / CLOCK_TICK_RATE; tick_usec = (LATCH * 1000000) / CLOCK_TICK_RATE;
/* Enable Period Interval Timer interrupt */ /* Initialize and enable the timer interrupt */
at91_sys_write(AT91_ST_IER, AT91_ST_PITS); at91rm9200_timer_reset();
}
#ifdef CONFIG_PM
static void at91rm9200_timer_suspend(void)
{
/* disable Period Interval Timer interrupt */
at91_sys_write(AT91_ST_IDR, AT91_ST_PITS);
} }
#else
#define at91rm9200_timer_suspend NULL
#endif
struct sys_timer at91rm9200_timer = { struct sys_timer at91rm9200_timer = {
.init = at91rm9200_timer_init, .init = at91rm9200_timer_init,
.offset = at91rm9200_gettimeoffset, .offset = at91rm9200_gettimeoffset,
.suspend = at91rm9200_timer_suspend,
.resume = at91rm9200_timer_reset,
}; };
...@@ -300,21 +300,22 @@ config SERIAL_AMBA_PL011_CONSOLE ...@@ -300,21 +300,22 @@ config SERIAL_AMBA_PL011_CONSOLE
kernel at boot time.) kernel at boot time.)
config SERIAL_AT91 config SERIAL_AT91
bool "AT91RM9200 serial port support" bool "AT91RM9200 / AT91SAM9261 serial port support"
depends on ARM && ARCH_AT91RM9200 depends on ARM && (ARCH_AT91RM9200 || ARCH_AT91SAM9261)
select SERIAL_CORE select SERIAL_CORE
help help
This enables the driver for the on-chip UARTs of the AT91RM9200 This enables the driver for the on-chip UARTs of the Atmel
processor. AT91RM9200 and AT91SAM926 processor.
config SERIAL_AT91_CONSOLE config SERIAL_AT91_CONSOLE
bool "Support for console on AT91RM9200 serial port" bool "Support for console on AT91RM9200 / AT91SAM9261 serial port"
depends on SERIAL_AT91=y depends on SERIAL_AT91=y
select SERIAL_CORE_CONSOLE select SERIAL_CORE_CONSOLE
help help
Say Y here if you wish to use a UART on the AT91RM9200 as the system Say Y here if you wish to use a UART on the Atmel AT91RM9200 or
console (the system console is the device which receives all kernel AT91SAM9261 as the system console (the system console is the device
messages and warnings and which allows logins in single user mode). which receives all kernel messages and warnings and which allows
logins in single user mode).
config SERIAL_AT91_TTYAT config SERIAL_AT91_TTYAT
bool "Install as device ttyAT0-4 instead of ttyS0-4" bool "Install as device ttyAT0-4 instead of ttyS0-4"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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