at91samx5: support
Hi,
The following patch series add the basic support of the new at91sam9x5 series also known as serie 5
This will need an update of the mach-type to get the MACH_AT91SAM9X5EK
Dan Liang (2):
AT91: overall definition: add 5series support
AT91: AT91SAM9x5 processors support
Nicolas Ferre (4):
AT91: PMC header: add 5series support
AT91: clock: add 5series chip family support
AT91: pio: add new PIO3a features
AT91: at91sam9x5: add chip and board file
arch/arm/configs/at91sam9x5ek_defconfig | 180 ++++ arch/arm/mach-at91/Kconfig | 19 + arch/arm/mach-at91/Makefile | 4 + arch/arm/mach-at91/at91sam9x5.c | 416 ++++++++ arch/arm/mach-at91/at91sam9x5_devices.c | 1083 ++++++++++++++++++++ arch/arm/mach-at91/board-sam9x5ek.c | 243 +++++ arch/arm/mach-at91/clock.c | 87 ++- arch/arm/mach-at91/generic.h | 2 + arch/arm/mach-at91/gpio.c | 240 ++++- arch/arm/mach-at91/include/mach/at91_pio.h | 25 + arch/arm/mach-at91/include/mach/at91_pmc.h | 63 +- arch/arm/mach-at91/include/mach/at91sam9x5.h | 179 ++++ .../arm/mach-at91/include/mach/at91sam9x5_matrix.h | 139 +++ arch/arm/mach-at91/include/mach/board.h | 2 +- arch/arm/mach-at91/include/mach/cpu.h | 28 + arch/arm/mach-at91/include/mach/gpio.h | 5 + arch/arm/mach-at91/include/mach/hardware.h | 2 + arch/arm/mach-at91/include/mach/timex.h | 5 + arch/arm/mach-at91/pm.h | 19 + arch/arm/mach-at91/pm_slowclock.S | 11 +- drivers/dma/Kconfig | 2 +- 21 files changed, 2703 insertions(+), 51 deletions(-) create mode 100644 arch/arm/configs/at91sam9x5ek_defconfig create mode 100644 arch/arm/mach-at91/at91sam9x5.c create mode 100644 arch/arm/mach-at91/at91sam9x5_devices.c create mode 100644 arch/arm/mach-at91/board-sam9x5ek.c create mode 100644 arch/arm/mach-at91/include/mach/at91sam9x5.h create mode 100644 arch/arm/mach-at91/include/mach/at91sam9x5_matrix.h
Best Regards,
J.
PATCH 1/6 AT91: overall definition: add 5series support
From: Dan Liang <[email protected]>
[at91sam9x5.h]
Add the definitions of peripheral and system registers for 5series chips family.
[at91sam9x5_matrix.h]
Add definitions of Matrix registers for 5series chips family.
[cpu.h]
Add ARCH_ID and basic cpu macros definition for 5series chips family.
--- arch/arm/mach-at91/include/mach/at91sam9x5.h | 179 ++++++++++++++++++++ .../arm/mach-at91/include/mach/at91sam9x5_matrix.h | 139 +++++++++++++++ arch/arm/mach-at91/include/mach/cpu.h | 28 +++ 3 files changed, 346 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-at91/include/mach/at91sam9x5.h create mode 100644 arch/arm/mach-at91/include/mach/at91sam9x5_matrix.h
arch/arm/mach-at91/include/mach/at91sam9x5.h new file +179 -0
@@ -0,0 +1,179 @@ +/* +* Chip-specific header file for the AT91SAM9x5 family +* +* Copyright (C) 2009-2010 Atmel Corporation. +* +* Common definitions. +* Based on AT91SAM9x5 preliminary datasheet. +* +* 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. +*/ + +#ifndef AT91SAM9X5_H +#define AT91SAM9X5_H + +/* +* Peripheral identifiers/interrupts. +*/ +#define AT91_ID_FIQ 0/* Advanced Interrupt Controller (FIQ) */ +#define AT91_ID_SYS 1/* System Controller Interrupt */ +#define AT91SAM9X5_ID_PIOAB 2/* Parallel I/O Controller A and B */ +#define AT91SAM9X5_ID_PIOCD 3/* Parallel I/O Controller C and D */ +#define AT91SAM9X5_ID_SMD 4/* SMD Soft Modem (SMD) */ +#define AT91SAM9X5_ID_USART0 5/* USART 0 */ +#define AT91SAM9X5_ID_USART1 6/* USART 1 */ +#define AT91SAM9X5_ID_USART2 7/* USART 2 */ +#define AT91SAM9X5_ID_USART3 8/* USART 3 */ +#define AT91SAM9X5_ID_TWI0 9/* Two-Wire Interface 0 */ +#define AT91SAM9X5_ID_TWI1 10/* Two-Wire Interface 1 */ +#define AT91SAM9X5_ID_TWI2 11/* Two-Wire Interface 2 */ +#define AT91SAM9X5_ID_MCI0 12/* High Speed Multimedia Card Interface 0 */ +#define AT91SAM9X5_ID_SPI0 13/* Serial Peripheral Interface 0 */ +#define AT91SAM9X5_ID_SPI1 14/* Serial Peripheral Interface 1 */ +#define AT91SAM9X5_ID_UART0 15/* UART 0 */ +#define AT91SAM9X5_ID_UART1 16/* UART 1 */ +#define AT91SAM9X5_ID_TCB 17/* Timer Counter 0, 1, 2, 3, 4 and 5 */ +#define AT91SAM9X5_ID_PWM 18/* Pulse Width Modulation Controller */ +#define AT91SAM9X5_ID_ADC 19/* ADC Controller */ +#define AT91SAM9X5_ID_DMA0 20/* DMA Controller 0 */ +#define AT91SAM9X5_ID_DMA1 21/* DMA Controller 1 */ +#define AT91SAM9X5_ID_UHPHS 22/* USB Host High Speed */ +#define AT91SAM9X5_ID_UDPHS 23/* USB Device High Speed */ +#define AT91SAM9X5_ID_EMAC0 24/* Ethernet MAC0 */ +#define AT91SAM9X5_ID_LCDC 25/* LCD Controller */ +#define AT91SAM9X5_ID_ISI 25/* Image Sensor Interface */ +#define AT91SAM9X5_ID_MCI1 26/* High Speed Multimedia Card Interface 1 */ +#define AT91SAM9X5_ID_EMAC1 27/* Ethernet MAC1 */ +#define AT91SAM9X5_ID_SSC 28/* Synchronous Serial Controller */ +#define AT91SAM9X5_ID_CAN0 29/* CAN Controller 0 */ +#define AT91SAM9X5_ID_CAN1 30/* CAN Controller 1 */ +#define AT91SAM9X5_ID_IRQ0 31/* Advanced Interrupt Controller */ + +/* +* User Peripheral physical base addresses. +*/ +#define AT91SAM9X5_BASE_SPI0 0xf0000000 +#define AT91SAM9X5_BASE_SPI1 0xf0004000 +#define AT91SAM9X5_BASE_MCI0 0xf0008000 +#define AT91SAM9X5_BASE_MCI1 0xf000c000 +#define AT91SAM9X5_BASE_SSC 0xf0010000 +#define AT91SAM9X5_BASE_CAN0 0xf8000000 +#define AT91SAM9X5_BASE_CAN1 0xf8004000 +#define AT91SAM9X5_BASE_TCB0 0xf8008000 +#define AT91SAM9X5_BASE_TC0 0xf8008000 +#define AT91SAM9X5_BASE_TC1 0xf8008040 +#define AT91SAM9X5_BASE_TC2 0xf8008080 +#define AT91SAM9X5_BASE_TCB1 0xf800c000 +#define AT91SAM9X5_BASE_TC3 0xf800c000 +#define AT91SAM9X5_BASE_TC4 0xf800c040 +#define AT91SAM9X5_BASE_TC5 0xf800c080 +#define AT91SAM9X5_BASE_TWI0 0xf8010000 +#define AT91SAM9X5_BASE_TWI1 0xf8014000 +#define AT91SAM9X5_BASE_TWI2 0xf8018000 +#define AT91SAM9X5_BASE_USART0 0xf801c000 +#define AT91SAM9X5_BASE_USART1 0xf8020000 +#define AT91SAM9X5_BASE_USART2 0xf8024000 +#define AT91SAM9X5_BASE_USART3 0xf8028000 +#define AT91SAM9X5_BASE_EMAC0 0xf802c000 +#define AT91SAM9X5_BASE_EMAC1 0xf8030000 +#define AT91SAM9X5_BASE_PWMC 0xf8034000 +#define AT91SAM9X5_BASE_LCDC 0xf8038000 +#define AT91SAM9X5_BASE_UDPHS 0xf803c000 +#define AT91SAM9X5_BASE_UART0 0xf8040000 +#define AT91SAM9X5_BASE_UART1 0xf8044000 +#define AT91SAM9X5_BASE_ISI 0xf8048000 +#define AT91SAM9X5_BASE_ADC 0xf804c000 +#define AT91_BASE_SYS 0xffffc000 + +/* +* System Peripherals (offset from AT91_BASE_SYS) +*/ +#define AT91_MATRIX (0xffffde00 - AT91_BASE_SYS) +#define AT91_PMECC (0xffffe000 - AT91_BASE_SYS) +#define AT91_PMERRLOC (0xffffe600 - AT91_BASE_SYS) +#define AT91_DDRSDRC0 (0xffffe800 - AT91_BASE_SYS) +#define AT91_SMC (0xffffea00 - AT91_BASE_SYS) +#define AT91_DMA0 (0xffffec00 - AT91_BASE_SYS) +#define AT91_DMA1 (0xffffee00 - AT91_BASE_SYS) +#define AT91_AIC (0xfffff000 - AT91_BASE_SYS) +#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) +#define AT91_PIOA (0xfffff400 - AT91_BASE_SYS) +#define AT91_PIOB (0xfffff600 - AT91_BASE_SYS) +#define AT91_PIOC (0xfffff800 - AT91_BASE_SYS) +#define AT91_PIOD (0xfffffa00 - AT91_BASE_SYS) +#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) +#define AT91_RSTC (0xfffffe00 - AT91_BASE_SYS) +#define AT91_SHDWC (0xfffffe10 - AT91_BASE_SYS) +#define AT91_PIT (0xfffffe30 - AT91_BASE_SYS) +#define AT91_WDT (0xfffffe40 - AT91_BASE_SYS) +#define AT91_GPBR (0xfffffe60 - AT91_BASE_SYS) +#define AT91_RTC (0xfffffeb0 - AT91_BASE_SYS) + +#define AT91_USART0 AT91SAM9X5_BASE_US0 +#define AT91_USART1 AT91SAM9X5_BASE_US1 +#define AT91_USART2 AT91SAM9X5_BASE_US2 +#define AT91_USART3 AT91SAM9X5_BASE_US3 + +/* +* Internal Memory. +*/ +#define AT91SAM9X5_SRAM_BASE 0x00300000/* Internal SRAM base address */ +#define AT91SAM9X5_SRAM_SIZE SZ_32K/* Internal SRAM size (32Kb) */ + +#define AT91SAM9X5_ROM_BASE 0x00400000/* Internal ROM base address */ +#define AT91SAM9X5_ROM_SIZE SZ_64K/* Internal ROM size (64Kb) */ + +#define AT91SAM9X5_SMD_BASE 0x00400000/* SMD Controller */ +#define AT91SAM9X5_UDPHS_FIFO 0x00500000/* USB Device HS controller */ +#define AT91SAM9X5_OHCI_BASE 0x00600000/* USB Host controller (OHCI) */ +#define AT91SAM9X5_EHCI_BASE 0x00700000/* USB Host controller (EHCI) */ + +#define CONFIG_DRAM_BASE AT91_CHIPSELECT_1 + +#define CONSISTENT_DMA_SIZE SZ_4M + +/* +* DMA0 peripheral identifiers +* for hardware handshaking interface +*/ +#define AT_DMA_ID_MCI0 0 +#define AT_DMA_ID_SPI0_TX 1 +#define AT_DMA_ID_SPI0_RX 2 +#define AT_DMA_ID_USART0_TX 3 +#define AT_DMA_ID_USART0_RX 4 +#define AT_DMA_ID_USART1_TX 5 +#define AT_DMA_ID_USART1_RX 6 +#define AT_DMA_ID_TWI0_TX 7 +#define AT_DMA_ID_TWI0_RX 8 +#define AT_DMA_ID_TWI2_TX 9 +#define AT_DMA_ID_TWI2_RX 10 +#define AT_DMA_ID_UART0_TX 11 +#define AT_DMA_ID_UART0_RX 12 +#define AT_DMA_ID_SSC_TX 13 +#define AT_DMA_ID_SSC_RX 14 + +/* +* DMA1 peripheral identifiers +* for hardware handshaking interface +*/ +#define AT_DMA_ID_MCI1 0 +#define AT_DMA_ID_SPI1_TX 1 +#define AT_DMA_ID_SPI1_RX 2 +#define AT_DMA_ID_SMD_TX 3 +#define AT_DMA_ID_SMD_RX 4 +#define AT_DMA_ID_TWI1_TX 5 +#define AT_DMA_ID_TWI1_RX 6 +#define AT_DMA_ID_ADC_RX 7 +#define AT_DMA_ID_DBGU_TX 8 +#define AT_DMA_ID_DBGU_RX 9 +#define AT_DMA_ID_UART1_TX 10 +#define AT_DMA_ID_UART1_RX 11 +#define AT_DMA_ID_USART2_TX 12 +#define AT_DMA_ID_USART2_RX 13 +#define AT_DMA_ID_USART3_TX 14 +#define AT_DMA_ID_USART3_RX 15 + +#endif
arch/arm/mach-at91/include/mach/at91sam9x5_matrix.h new file +139 -0
139 lines not on this page · raw message
arch/arm/mach-at91/include/mach/cpu.h +28 -0
@@ -27,6 +27,7 @@#define ARCH_ID_AT91SAM9G45 0x819b05a0#define ARCH_ID_AT91SAM9G45MRL 0x819b05a2/* aka 9G45-ES2 & non ES lots */ #define ARCH_ID_AT91SAM9G45ES 0x819b05a1/* 9G45-ES (Engineering Sample) */ +#define ARCH_ID_AT91SAM9X5 0x819a05a0#define ARCH_ID_AT91CAP9 0x039A03A0#define ARCH_ID_AT91SAM9XE128 0x329973a0
@@ -55,6 +56,12 @@ static inline unsigned long at91_cpu_fully_identify(void)#define ARCH_EXID_AT91SAM9G46 0x00000003#define ARCH_EXID_AT91SAM9G45 0x00000004 +#define ARCH_EXID_AT91SAM9G15 0x00000000 +#define ARCH_EXID_AT91SAM9G35 0x00000001 +#define ARCH_EXID_AT91SAM9X35 0x00000002 +#define ARCH_EXID_AT91SAM9G25 0x00000003 +#define ARCH_EXID_AT91SAM9X25 0x00000004 +static inline unsigned long at91_exid_identify (void ) {return at91_sys_read (AT91_DBGU_EXID );
@@ -143,6 +150,27 @@ static inline unsigned long at91cap9_rev_identify(void)#define cpu_is_at91sam9m11 () (0)#endif +#ifdef CONFIG_ARCH_AT91SAM9X5 +#define cpu_is_at91sam9x5 () (at91_cpu_identify() == ARCH_ID_AT91SAM9X5) +#define cpu_is_at91sam9g15 () (cpu_is_at91sam9x5() && \ + (at91_exid_identify() == ARCH_EXID_AT91SAM9G15)) +#define cpu_is_at91sam9g35 () (cpu_is_at91sam9x5() && \ + (at91_exid_identify() == ARCH_EXID_AT91SAM9G35)) +#define cpu_is_at91sam9x35 () (cpu_is_at91sam9x5() && \ + (at91_exid_identify() == ARCH_EXID_AT91SAM9X35)) +#define cpu_is_at91sam9g25 () (cpu_is_at91sam9x5() && \ + (at91_exid_identify() == ARCH_EXID_AT91SAM9G25)) +#define cpu_is_at91sam9x25 () (cpu_is_at91sam9x5() && \ + (at91_exid_identify() == ARCH_EXID_AT91SAM9X25)) +#else +#define cpu_is_at91sam9x5 () (0) +#define cpu_is_at91sam9g15 () (0) +#define cpu_is_at91sam9g35 () (0) +#define cpu_is_at91sam9x35 () (0) +#define cpu_is_at91sam9g25 () (0) +#define cpu_is_at91sam9x25 () (0) +#endif +#ifdef CONFIG_ARCH_AT91CAP9 #define cpu_is_at91cap9 () (at91_cpu_identify() == ARCH_ID_AT91CAP9)#define cpu_is_at91cap9_revB () (at91cap9_rev_identify() == ARCH_REVISION_CAP9_B)
Signature · 1 line
1.7.4.1
PATCH 2/6 AT91: PMC header: add 5series support
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Nicolas Ferre <[email protected]>
Add 5series chips family support in PMC header file:
Alternate prescaler location and CSS lenght for PCKR is added. The new Peripheral Control Register management is added. Protection mode register is modified to complete its management.
--- arch/arm/mach-at91/include/mach/at91_pmc.h | 63 ++++++++++++++++++++++------ 1 files changed, 50 insertions(+), 13 deletions(-)
arch/arm/mach-at91/include/mach/at91_pmc.h +50 -13
@@ -47,9 +47,13 @@#define AT91_PMC_BIASCOUNT (0xf << 28)/* UTMI BIAS Start-up Time */ #define AT91_CKGR_MOR (AT91_PMC + 0x20)/* Main Oscillator Register [not on SAM9RL] */ -#define AT91_PMC_MOSCEN (1 << 0)/* Main Oscillator Enable */ -#define AT91_PMC_OSCBYPASS (1 << 1)/* Oscillator Bypass [SAM9x, CAP9] */ -#define AT91_PMC_OSCOUNT (0xff << 8)/* Main Oscillator Start-up Time */ +#define AT91_PMC_MOSCEN (1 << 0)/* Main Oscillator Enable */ +#define AT91_PMC_OSCBYPASS (1 << 1)/* Oscillator Bypass [SAM9x, CAP9] */ +#define AT91_PMC_MOSCRCEN (1 << 3)/* Main On-Chip RC Oscillator Enable [some SAM9] */ +#define AT91_PMC_OSCOUNT (0xff << 8)/* Main Oscillator Start-up Time */ +#define AT91_PMC_KEY (0x37 << 16)/* MOR Writing Key */ +#define AT91_PMC_MOSCSEL (1 << 24)/* Main Oscillator Selection [some SAM9] */ +#define AT91_PMC_CFDEN (1 << 25)/* Clock Failure Detector Enable [some SAM9] */ #define AT91_CKGR_MCFR (AT91_PMC + 0x24)/* Main Clock Frequency Register */ #define AT91_PMC_MAINF (0xffff << 0)/* Main Clock Frequency */
@@ -74,14 +78,24 @@#define AT91_PMC_CSS_PLLA (2 << 0)#define AT91_PMC_CSS_PLLB (3 << 0)#define AT91_PMC_CSS_UPLL (3 << 0)/* [some SAM9 only] */ -#define AT91_PMC_PRES (7 << 2)/* Master Clock Prescaler */ -#define AT91_PMC_PRES_1 (0 << 2) -#define AT91_PMC_PRES_2 (1 << 2) -#define AT91_PMC_PRES_4 (2 << 2) -#define AT91_PMC_PRES_8 (3 << 2) -#define AT91_PMC_PRES_16 (4 << 2) -#define AT91_PMC_PRES_32 (5 << 2) -#define AT91_PMC_PRES_64 (6 << 2) +#define PMC_PRES_OFFSET 2 +#define AT91_PMC_PRES (7 << PMC_PRES_OFFSET)/* Master Clock Prescaler */ +#define AT91_PMC_PRES_1 (0 << PMC_PRES_OFFSET) +#define AT91_PMC_PRES_2 (1 << PMC_PRES_OFFSET) +#define AT91_PMC_PRES_4 (2 << PMC_PRES_OFFSET) +#define AT91_PMC_PRES_8 (3 << PMC_PRES_OFFSET) +#define AT91_PMC_PRES_16 (4 << PMC_PRES_OFFSET) +#define AT91_PMC_PRES_32 (5 << PMC_PRES_OFFSET) +#define AT91_PMC_PRES_64 (6 << PMC_PRES_OFFSET) +#define PMC_ALT_PRES_OFFSET 4 +#define AT91_PMC_ALT_PRES (7 << PMC_ALT_PRES_OFFSET)/* Master Clock Prescaler [alternate location] */ +#define AT91_PMC_ALT_PRES_1 (0 << PMC_ALT_PRES_OFFSET) +#define AT91_PMC_ALT_PRES_2 (1 << PMC_ALT_PRES_OFFSET) +#define AT91_PMC_ALT_PRES_4 (2 << PMC_ALT_PRES_OFFSET) +#define AT91_PMC_ALT_PRES_8 (3 << PMC_ALT_PRES_OFFSET) +#define AT91_PMC_ALT_PRES_16 (4 << PMC_ALT_PRES_OFFSET) +#define AT91_PMC_ALT_PRES_32 (5 << PMC_ALT_PRES_OFFSET) +#define AT91_PMC_ALT_PRES_64 (6 << PMC_ALT_PRES_OFFSET)#define AT91_PMC_MDIV (3 << 8)/* Master Clock Division */ #define AT91RM9200_PMC_MDIV_1 (0 << 8)/* [AT91RM9200 only] */ #define AT91RM9200_PMC_MDIV_2 (1 << 8)
@@ -105,7 +119,14 @@#define AT91_PMC_USBS_UPLL (1 << 0)#define AT91_PMC_OHCIUSBDIV (0xF << 8)/* Divider for USB OHCI Clock */ +#define AT91_PMC_SMD (AT91_PMC + 0x3c)/* Soft Modem Clock Register [some SAM9 only] */ +#define AT91_PMC_SMDS (0x1 << 0)/* SMD input clock selection */ +#define AT91_PMC_SMD_DIV (0x1f << 8)/* SMD input clock divider */ +#define AT91_PMC_SMDDIV (n) (((n) << 8) & AT91_PMC_SMD_DIV) +#define AT91_PMC_PCKR (n) (AT91_PMC + 0x40 + ((n) * 4))/* Programmable Clock 0-N Registers */ +#define AT91_PMC_ALT_PCKR_CSS (0x7 << 0)/* Programmable Clock Source Selection [alternate length] */ +#define AT91_PMC_CSS_MASTER (4 << 0)/* [some SAM9 only] */ #define AT91_PMC_CSSMCK (0x1 << 8)/* CSS or Master Clock Selection */ #define AT91_PMC_CSSMCK_CSS (0 << 8)#define AT91_PMC_CSSMCK_MCK (1 << 8)
@@ -123,11 +144,27 @@#define AT91_PMC_PCK1RDY (1 << 9)/* Programmable Clock 1 */ #define AT91_PMC_PCK2RDY (1 << 10)/* Programmable Clock 2 */ #define AT91_PMC_PCK3RDY (1 << 11)/* Programmable Clock 3 */ +#define AT91_PMC_MOSCSELS (1 << 16)/* Main Oscillator Selection [some SAM9] */ +#define AT91_PMC_MOSCRCS (1 << 17)/* Main On-Chip RC [some SAM9] */ +#define AT91_PMC_CFDEV (1 << 18)/* Clock Failure Detector Event [some SAM9] */ #define AT91_PMC_IMR (AT91_PMC + 0x6c)/* Interrupt Mask Register */ -#define AT91_PMC_PROT (AT91_PMC + 0xe4)/* Protect Register [AT91CAP9 revC only] */ -#define AT91_PMC_PROTKEY 0x504d4301/* Activation Code */ +#define AT91_PMC_PROT (AT91_PMC + 0xe4)/* Write Protect Mode Register [some SAM9, AT91CAP9 revC only] */ +#define AT91_PMC_WPEN (0x1 << 0)/* Write Protect Enable */ +#define AT91_PMC_WPKEY (0xffffff << 8)/* Write Protect Key */ +#define AT91_PMC_PROTKEY (0x504d43 << 8)/* Activation Code */ + +#define AT91_PMC_WPSR (AT91_PMC + 0xe8)/* Write Protect Status Register [some SAM9] */ +#define AT91_PMC_WPVS (0x1 << 0)/* Write Protect Violation Status */ +#define AT91_PMC_WPVSRC (0xffff << 8)/* Write Protect Violation Source */ #define AT91_PMC_VER (AT91_PMC + 0xfc)/* PMC Module Version [AT91CAP9 only] */ +#define AT91_PMC_PCR (AT91_PMC + 0x10c)/* Peripheral Control Register [some SAM9] */ +#define AT91_PMC_PCR_PID (0x3f << 0)/* Peripheral ID */ +#define AT91_PMC_PCR_CMD (0x1 << 12)/* Command */ +#define AT91_PMC_PCR_DIV (0x3 << 16)/* Divisor Value */ +#define AT91_PMC_PCRDIV (n) (((n) << 16) & AT91_PMC_PCR_DIV) +#define AT91_PMC_PCR_EN (0x1 << 28)/* Enable */ +#endif
Signature · 1 line
1.7.4.1
PATCH 3/6 AT91: clock: add 5series chip family support
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Nicolas Ferre <[email protected]>
Several changes to PMC have to be managed for adding this 5series support:
- alternate prescaler location for both MCKR and PCKR
- alternate CSS length for PCKR
- added cpu_is_at91sam9x5() to functional switches
- manage UTMI bias like sam9g45 chip family
--- arch/arm/mach-at91/clock.c | 85 ++++++++++++++++++++++++++++++++++---------- 1 files changed, 66 insertions(+), 19 deletions(-)
arch/arm/mach-at91/clock.c +66 -19
@@ -49,24 +49,37 @@*/ #define cpu_has_utmi () ( cpu_is_at91cap9() \ || cpu_is_at91sam9rl() \ - || cpu_is_at91sam9g45()) + || cpu_is_at91sam9g45() \ + || cpu_is_at91sam9x5())#define cpu_has_800M_plla () ( cpu_is_at91sam9g20() \ - || cpu_is_at91sam9g45()) + || cpu_is_at91sam9g45() \ + || cpu_is_at91sam9x5())#define cpu_has_300M_plla () (cpu_is_at91sam9g10())#define cpu_has_pllb () (!(cpu_is_at91sam9rl() \ - || cpu_is_at91sam9g45())) + || cpu_is_at91sam9g45() \ + || cpu_is_at91sam9x5())) -#define cpu_has_upll () (cpu_is_at91sam9g45()) +#define cpu_has_upll () (cpu_is_at91sam9g45() \ + || cpu_is_at91sam9x5())/* USB host HS & FS */ #define cpu_has_uhp () (!cpu_is_at91sam9rl())/* USB device FS only */ #define cpu_has_udpfs () (!(cpu_is_at91sam9rl() \ - || cpu_is_at91sam9g45())) + || cpu_is_at91sam9g45() \ + || cpu_is_at91sam9x5())) + +#define cpu_has_plladiv2 () (cpu_is_at91sam9g45() \ + || cpu_is_at91sam9x5()) + +#define cpu_has_mdiv3 () (cpu_is_at91sam9g45() \ + || cpu_is_at91sam9x5()) + +#define cpu_has_alt_prescaler () (cpu_is_at91sam9x5())static LIST_HEAD (clocks);static DEFINE_SPINLOCK (clk_lock);
@@ -139,13 +152,6 @@ static void pmc_uckr_mode(struct clk *clk, int is_on) {unsigned int uckr =at91_sys_read (AT91_CKGR_UCKR ); -if (cpu_is_at91sam9g45 ()) { -if (is_on) - uckr |=AT91_PMC_BIASEN ; -else - uckr &= ~AT91_PMC_BIASEN ; - } -if (is_on) { is_on =AT91_PMC_LOCKU ;at91_sys_write (AT91_CKGR_UCKR , uckr | clk->pmc_mask);
@@ -210,11 +216,26 @@ static struct clk __init *at91_css_to_clk(unsigned long css)return &utmi_clk; else if (cpu_has_pllb()) return &pllb; +break ; +/* alternate PMC: can use master clock */ +case AT91_PMC_CSS_MASTER : +return &mck; }return NULL ; } + +static int pmc_prescaler_divider (u32 reg) +{ +if (cpu_has_alt_prescaler ()) { +return 1 << ((reg &AT91_PMC_ALT_PRES ) >>PMC_ALT_PRES_OFFSET ); + }else { +return 1 << ((reg &AT91_PMC_PRES ) >>PMC_PRES_OFFSET ); + } +} + +/* * Associate a particular clock with a function (eg, "uart") and device. * The drivers can then request the same 'function' with several different
@@ -353,12 +374,22 @@ int clk_set_rate(struct clk *clk, unsigned long rate) {unsigned long flags;unsigned prescale; +unsigned long prescale_offset, css_mask;unsigned long actual;if (!clk_is_programmable (clk))return -EINVAL ;if (clk->users)return -EBUSY ; + +if (cpu_has_alt_prescaler ()) { + prescale_offset =PMC_ALT_PRES_OFFSET ; + css_mask =AT91_PMC_ALT_PCKR_CSS ; + }else { + prescale_offset =PMC_PRES_OFFSET ; + css_mask =AT91_PMC_CSS ; + } +spin_lock_irqsave (&clk_lock, flags); actual = clk->parent->rate_hz;
@@ -367,8 +398,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)u32 pckr; pckr =at91_sys_read (AT91_PMC_PCKR (clk->id)); - pckr &=AT91_PMC_CSS ;/* clock selection */ - pckr |= prescale <<2 ; + pckr &= css_mask;/* keep clock selection */ + pckr |= prescale << prescale_offset;at91_sys_write (AT91_PMC_PCKR (clk->id), pckr); clk->rate_hz = actual;break ;
@@ -415,11 +446,17 @@ static void __init init_programmable_clock(struct clk *clk) {struct clk *parent;u32 pckr; +unsigned int css_mask; + +if (cpu_has_alt_prescaler ()) + css_mask =AT91_PMC_ALT_PCKR_CSS ; +else + css_mask =AT91_PMC_CSS ; pckr =at91_sys_read (AT91_PMC_PCKR (clk->id)); - parent =at91_css_to_clk (pckr &AT91_PMC_CSS ); + parent =at91_css_to_clk (pckr & css_mask); clk->parent = parent; - clk->rate_hz = parent->rate_hz / (1 << ((pckr &AT91_PMC_PRES ) >>2 )); + clk->rate_hz = parent->rate_hz /pmc_prescaler_divider (pckr); }#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
@@ -697,7 +734,7 @@ int __init at91_clock_init(unsigned long main_clock)if (pll_overclock)pr_info ("Clocks: PLLA overclocked, %ld MHz\n" , plla.rate_hz /1000000 ); -if (cpu_is_at91sam9g45 ()) { +if (cpu_has_plladiv2 ()) { mckr =at91_sys_read (AT91_PMC_MCKR ); plla.rate_hz /= (1 << ((mckr &AT91_PMC_PLLADIV2 ) >>12 ));/* plla divisor by 2 */ }
@@ -719,6 +756,10 @@ int __init at91_clock_init(unsigned long main_clock)* (obtain the USB High Speed 480 MHz when input is 12 MHz) */ utmi_clk.rate_hz =40 * utmi_clk.parent->rate_hz; + +/* UTMI bias and PLL are managed at the same time */ +if (cpu_is_at91sam9g45 () ||cpu_is_at91sam9x5 ()) + utmi_clk.pmc_mask |=AT91_PMC_BIASEN ; }/*
@@ -737,7 +778,7 @@ int __init at91_clock_init(unsigned long main_clock) mckr =at91_sys_read (AT91_PMC_MCKR ); mck.parent =at91_css_to_clk (mckr &AT91_PMC_CSS ); freq = mck.parent->rate_hz; - freq /= (1 << ((mckr &AT91_PMC_PRES ) >>2 ));/* prescale */ + freq /=pmc_prescaler_divider (mckr);/* prescale */ if (cpu_is_at91rm9200 ()) { mck.rate_hz = freq / (1 + ((mckr &AT91_PMC_MDIV ) >>8 ));/* mdiv */ }else if (cpu_is_at91sam9g20 ()) {
@@ -745,13 +786,19 @@ int __init at91_clock_init(unsigned long main_clock) freq / ((mckr & AT91_PMC_MDIV) >> 7) : freq; /* mdiv ; (x >> 7) = ((x >> 8) * 2) */if (mckr &AT91_PMC_PDIV ) freq /=2 ;/* processor clock division */ - }else if (cpu_is_at91sam9g45 ()) { + }else if (cpu_has_mdiv3 ()) { mck.rate_hz = (mckr &AT91_PMC_MDIV ) ==AT91SAM9_PMC_MDIV_3 ? freq /3 : freq / (1 << ((mckr &AT91_PMC_MDIV ) >>8 ));/* mdiv */ }else { mck.rate_hz = freq / (1 << ((mckr &AT91_PMC_MDIV ) >>8 ));/* mdiv */ } +if (cpu_has_alt_prescaler ()) { +/* Programmable clocks can use MCK */ + mck.type |=CLK_TYPE_PRIMARY ; + mck.id =4 ; + } +/* Register the PMC's standard clocks */ for (i =0 ; i <ARRAY_SIZE (standard_pmc_clocks); i++)list_add_tail (&standard_pmc_clocks[i]->node, &clocks);
Signature · 1 line
1.7.4.1
PATCH 4/6 AT91: AT91SAM9x5 processors support
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Dan Liang <[email protected]>
Add 5series chips family support in at91sam9x5.c:
- Define clock resources for 5series and some initialization code
--- arch/arm/mach-at91/at91sam9x5.c | 416 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 416 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-at91/at91sam9x5.c
arch/arm/mach-at91/at91sam9x5.c new file +416 -0
@@ -0,0 +1,416 @@ +/* +* Chip-specific setup code for the AT91SAM9x5 family +* +* Copyright (C) 2010 Atmel Corporation. +* +* 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 <linux/pm.h> + +#include <asm/irq.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <mach/at91sam9x5.h> +#include <mach/at91_pmc.h> +#include <mach/at91_rstc.h> +#include <mach/at91_shdwc.h> +#include <mach/cpu.h> + +#include "generic.h" +#include "clock.h" + +static struct map_desc at91sam9x5_io_desc[]__initdata = { + { + .virtual =AT91_VA_BASE_SYS , + .pfn =__phys_to_pfn (AT91_BASE_SYS ), + .length =SZ_16K , + .type =MT_DEVICE , + }, { + .virtual =AT91_IO_VIRT_BASE -AT91SAM9X5_SRAM_SIZE , + .pfn =__phys_to_pfn (AT91SAM9X5_SRAM_BASE ), + .length =AT91SAM9X5_SRAM_SIZE , + .type =MT_DEVICE , + } +}; + +/* -------------------------------------------------------------------- +* Clocks +* -------------------------------------------------------------------- */ + +/* +* The peripheral clocks. +*/ +static struct clk pioAB_clk = { + .name ="pioAB_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_PIOAB , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk pioCD_clk = { + .name ="pioCD_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_PIOCD , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk smd_clk = { + .name ="smd_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_SMD , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk usart0_clk = { + .name ="usart0_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_USART0 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk usart1_clk = { + .name ="usart1_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_USART1 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk usart2_clk = { + .name ="usart2_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_USART2 , + .type =CLK_TYPE_PERIPHERAL , +}; +/* USART3 clock - Only for sam9g25/sam9x25 */ +static struct clk usart3_clk = { + .name ="usart3_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_USART3 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk twi0_clk = { + .name ="twi0_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_TWI0 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk twi1_clk = { + .name ="twi1_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_TWI1 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk twi2_clk = { + .name ="twi2_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_TWI2 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk mmc0_clk = { + .name ="mci0_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_MCI0 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk spi0_clk = { + .name ="spi0_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_SPI0 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk spi1_clk = { + .name ="spi1_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_SPI1 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk uart0_clk = { + .name ="uart0_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_UART0 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk uart1_clk = { + .name ="uart1_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_UART1 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk tcb0_clk = { + .name ="tcb0_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_TCB , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk pwm_clk = { + .name ="pwm_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_PWM , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk adc_clk = { + .name ="adc_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_ADC , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk dma0_clk = { + .name ="dma0_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_DMA0 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk dma1_clk = { + .name ="dma1_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_DMA1 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk uhphs_clk = { + .name ="uhphs_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_UHPHS , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk udphs_clk = { + .name ="udphs_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_UDPHS , + .type =CLK_TYPE_PERIPHERAL , +}; +/* emac0 clock - Only for sam9g25/sam9x25/sam9g35/sam9x35 */ +static struct clk macb0_clk = { + .name ="macb0_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_EMAC0 , + .type =CLK_TYPE_PERIPHERAL , +}; +/* lcd clock - Only for sam9g15/sam9g35/sam9x35 */ +static struct clk lcdc_clk = { + .name ="lcdc_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_LCDC , + .type =CLK_TYPE_PERIPHERAL , +}; +/* isi clock - Only for sam9g25 */ +static struct clk isi_clk = { + .name ="isi_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_ISI , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk mmc1_clk = { + .name ="mci1_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_MCI1 , + .type =CLK_TYPE_PERIPHERAL , +}; +/* emac1 clock - Only for sam9x25 */ +static struct clk macb1_clk = { + .name ="macb1_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_EMAC1 , + .type =CLK_TYPE_PERIPHERAL , +}; +static struct clk ssc_clk = { + .name ="ssc_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_SSC , + .type =CLK_TYPE_PERIPHERAL , +}; +/* can0 clock - Only for sam9x35 */ +static struct clk can0_clk = { + .name ="can0_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_CAN0 , + .type =CLK_TYPE_PERIPHERAL , +}; +/* can1 clock - Only for sam9x35 */ +static struct clk can1_clk = { + .name ="can1_clk" , + .pmc_mask =1 <<AT91SAM9X5_ID_CAN1 , + .type =CLK_TYPE_PERIPHERAL , +}; + +/* One additional fake clock for ohci */ +static struct clk ohci_clk = { + .name ="ohci_clk" , + .pmc_mask =0 , + .type =CLK_TYPE_PERIPHERAL , + .parent = &uhphs_clk, +}; + +/* One additional fake clock for second TC block */ +static struct clk tcb1_clk = { + .name ="tcb1_clk" , + .pmc_mask =0 , + .type =CLK_TYPE_PERIPHERAL , + .parent = &tcb0_clk, +}; + +static struct clk *periph_clocks[]__initdata = { + &pioAB_clk, + &pioCD_clk, + &smd_clk, + &usart0_clk, + &usart1_clk, + &usart2_clk, + &twi0_clk, + &twi1_clk, + &twi2_clk, + &mmc0_clk, + &spi0_clk, + &spi1_clk, + &uart0_clk, + &uart1_clk, + &tcb0_clk, + &pwm_clk, + &adc_clk, + &dma0_clk, + &dma1_clk, + &uhphs_clk, + &udphs_clk, + &mmc1_clk, + &ssc_clk, +// irq0 + &ohci_clk, + &tcb1_clk, +}; + +/* +* The two 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 void __init at91sam9x5_register_clocks (void ) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (periph_clocks); i++) +clk_register (periph_clocks[i]); + +if (cpu_is_at91sam9g25 () + ||cpu_is_at91sam9x25 ()) +clk_register (&usart3_clk); + +if (cpu_is_at91sam9g25 () + ||cpu_is_at91sam9x25 () + ||cpu_is_at91sam9g35 () + ||cpu_is_at91sam9x35 ()) +clk_register (&macb0_clk); + +if (cpu_is_at91sam9g15 () + ||cpu_is_at91sam9g35 () + ||cpu_is_at91sam9x35 ()) +clk_register (&lcdc_clk); + +if (cpu_is_at91sam9g25 ()) +clk_register (&isi_clk); + +if (cpu_is_at91sam9x25 ()) +clk_register (&macb1_clk); + +if (cpu_is_at91sam9x35 ()) { +clk_register (&can0_clk); +clk_register (&can1_clk); + } + +clk_register (&pck0); +clk_register (&pck1); +} + +/* -------------------------------------------------------------------- +* GPIO +* -------------------------------------------------------------------- */ + +static struct at91_gpio_bank at91sam9x5_gpio[] = { + { + .id =AT91SAM9X5_ID_PIOAB , + .offset =AT91_PIOA , + .clock = &pioAB_clk, + }, { + .id =AT91SAM9X5_ID_PIOAB , + .offset =AT91_PIOB , + .clock = &pioAB_clk, + }, { + .id =AT91SAM9X5_ID_PIOCD , + .offset =AT91_PIOC , + .clock = &pioCD_clk, + }, { + .id =AT91SAM9X5_ID_PIOCD , + .offset =AT91_PIOD , + .clock = &pioCD_clk, + } +}; + +static void at91sam9x5_reset (void ) +{ +at91_sys_write (AT91_RSTC_CR ,AT91_RSTC_KEY |AT91_RSTC_PROCRST |AT91_RSTC_PERRST ); +} + +static void at91sam9x5_poweroff (void ) +{ +at91_sys_write (AT91_SHDW_CR ,AT91_SHDW_KEY |AT91_SHDW_SHDW ); +} + + +/* -------------------------------------------------------------------- +* AT91SAM9x5 processor initialization +* -------------------------------------------------------------------- */ + +void __init at91sam9x5_initialize (unsigned long main_clock) +{ +/* Map peripherals */ +iotable_init (at91sam9x5_io_desc,ARRAY_SIZE (at91sam9x5_io_desc)); + + at91_arch_reset = at91sam9x5_reset; + pm_power_off = at91sam9x5_poweroff; + at91_extern_irq = (1 <<AT91SAM9X5_ID_IRQ0 ); + +/* Init clock subsystem */ +at91_clock_init (main_clock); + +/* Register the processor-specific clocks */ +at91sam9x5_register_clocks (); + +/* Register GPIO subsystem */ +at91_gpio_init (at91sam9x5_gpio,4 ); +} + +/* -------------------------------------------------------------------- +* Interrupt initialization +* -------------------------------------------------------------------- */ + +/* +* The default interrupt priority levels (0 = lowest, 7 = highest). +*/ +static unsigned int at91sam9x5_default_irq_priority[NR_AIC_IRQS ]__initdata = { +7 ,/* Advanced Interrupt Controller (FIQ) */ +7 ,/* System Peripherals */ +1 ,/* Parallel IO Controller A and B */ +1 ,/* Parallel IO Controller C and D */ +4 ,/* Soft Modem */ +5 ,/* USART 0 */ +5 ,/* USART 1 */ +5 ,/* USART 2 */ +5 ,/* USART 3 */ +6 ,/* Two-Wire Interface 0 */ +6 ,/* Two-Wire Interface 1 */ +6 ,/* Two-Wire Interface 2 */ +0 ,/* Multimedia Card Interface 0 */ +5 ,/* Serial Peripheral Interface 0 */ +5 ,/* Serial Peripheral Interface 1 */ +5 ,/* UART 0 */ +5 ,/* UART 1 */ +0 ,/* Timer Counter 0, 1, 2, 3, 4 and 5 */ +0 ,/* Pulse Width Modulation Controller */ +0 ,/* ADC Controller */ +0 ,/* DMA Controller 0 */ +0 ,/* DMA Controller 1 */ +2 ,/* USB Host High Speed port */ +2 ,/* USB Device High speed port */ +3 ,/* Ethernet MAC 0 */ +3 ,/* LDC Controller or Image Sensor Interface */ +0 ,/* Multimedia Card Interface 1 */ +3 ,/* Ethernet MAC 1 */ +4 ,/* Synchronous Serial Interface */ +4 ,/* CAN Controller 0 */ +4 ,/* CAN Controller 1 */ +0 ,/* Advanced Interrupt Controller (IRQ0) */ +}; + +void __init at91sam9x5_init_interrupts (unsigned int priority[NR_AIC_IRQS ]) +{ +if (!priority) + priority = at91sam9x5_default_irq_priority; + +/* Initialize the AIC interrupt controller */ +at91_aic_init (priority); + +/* Enable GPIO interrupts */ +at91_gpio_irq_setup (); +}
Signature · 1 line
1.7.4.1
PATCH 5/6 AT91: pio: add new PIO3a features
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Nicolas Ferre <[email protected]>
This patch adds the support for new PIO controller found on some at91sam SOCs.
- more peripheral multiplexing
- more features to configure on a PIO (pull-down, Schmitt trigger, debouncer)
- support for several irq tirggering features (type and polarity)
Debugfs at91_gpio file is updated to monitor configuration.
--- arch/arm/mach-at91/gpio.c | 240 ++++++++++++++++++++++++++-- arch/arm/mach-at91/include/mach/at91_pio.h | 25 +++ arch/arm/mach-at91/include/mach/gpio.h | 5 + 3 files changed, 257 insertions(+), 13 deletions(-)
arch/arm/mach-at91/gpio.c +227 -13
@@ -20,6 +20,7 @@#include <linux/module.h> #include <linux/io.h> +#include <mach/cpu.h> #include <mach/hardware.h> #include <mach/at91_pio.h> #include <mach/gpio.h>
@@ -69,6 +70,12 @@ static struct at91_gpio_chip gpio_chip[] = {static int gpio_banks; +/* +* Functionnality can change with newer chips +*/ +#define cpu_has_pio3 () (cpu_is_at91sam9x5()) + +static inline void __iomem *pin_to_controller (unsigned pin) { pin -=PIN_BASE ;
@@ -86,6 +93,52 @@ static inline unsigned pin_to_mask(unsigned pin) } +static char peripheral_function (void __iomem *pio,unsigned mask) +{ +char ret ='X' ; +u8 select; + +if (pio) { +if (cpu_has_pio3 ()) { + select = !!(__raw_readl (pio +PIO_ABCDSR1 ) & mask); + select |= (!!(__raw_readl (pio +PIO_ABCDSR2 ) & mask) <<1 ); + ret ='A' + select; + }else { + ret =__raw_readl (pio +PIO_ABSR ) & mask ? +'B' :'A' ; + } + } + +return ret; +} + +static void gpio_printf (struct seq_file *s,void __iomem *pio,unsigned mask) +{ +char *trigger =NULL ; +char *polarity =NULL ; + +if (__raw_readl (pio +PIO_IMR ) & mask) { +if (!cpu_has_pio3 () || !(__raw_readl (pio +PIO_AIMMR ) & mask )) { + trigger ="edge" ; + polarity ="both" ; + }else { +if (__raw_readl (pio +PIO_ELSR ) & mask) { + trigger ="level" ; + polarity =__raw_readl (pio +PIO_FRLHSR ) & mask ? +"high" :"low" ; + }else { + trigger ="edge" ; + polarity =__raw_readl (pio +PIO_FRLHSR ) & mask ? +"rising" :"falling" ; + } + } +seq_printf (s,"IRQ:%s-%s\t" , trigger, polarity); + }else { +seq_printf (s,"GPIO:%s\t\t" , +__raw_readl (pio +PIO_PDSR ) & mask ?"1" :"0" ); + } +} +/*--------------------------------------------------------------------------*/ /* Not all hardware capabilities are exposed through these calls; they
@@ -133,7 +186,14 @@ int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup)__raw_writel (mask, pio +PIO_IDR );__raw_writel (mask, pio + (use_pullup ?PIO_PUER :PIO_PUDR )); -__raw_writel (mask, pio +PIO_ASR ); +if (cpu_has_pio3 ()) { +__raw_writel (__raw_readl (pio +PIO_ABCDSR1 ) & ~mask, + pio +PIO_ABCDSR1 ); +__raw_writel (__raw_readl (pio +PIO_ABCDSR2 ) & ~mask, + pio +PIO_ABCDSR2 ); + }else { +__raw_writel (mask, pio +PIO_ASR ); + }__raw_writel (mask, pio +PIO_PDR );return 0 ; }
@@ -153,7 +213,14 @@ int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup)__raw_writel (mask, pio +PIO_IDR );__raw_writel (mask, pio + (use_pullup ?PIO_PUER :PIO_PUDR )); -__raw_writel (mask, pio +PIO_BSR ); +if (cpu_has_pio3 ()) { +__raw_writel (__raw_readl (pio +PIO_ABCDSR1 ) | mask, + pio +PIO_ABCDSR1 ); +__raw_writel (__raw_readl (pio +PIO_ABCDSR2 ) & ~mask, + pio +PIO_ABCDSR2 ); + }else { +__raw_writel (mask, pio +PIO_BSR ); + }__raw_writel (mask, pio +PIO_PDR );return 0 ; }
@@ -161,6 +228,48 @@ EXPORT_SYMBOL(at91_set_B_periph);/* +* mux the pin to the "C" internal peripheral role. +*/ +int __init_or_module at91_set_C_periph(unsigned pin, int use_pullup) +{ +void __iomem *pio =pin_to_controller (pin); +unsigned mask =pin_to_mask (pin); + +if (!pio || !cpu_has_pio3 ()) +return -EINVAL ; + +__raw_writel (mask, pio +PIO_IDR ); +__raw_writel (mask, pio + (use_pullup ?PIO_PUER :PIO_PUDR )); +__raw_writel (__raw_readl (pio +PIO_ABCDSR1 ) & ~mask, pio +PIO_ABCDSR1 ); +__raw_writel (__raw_readl (pio +PIO_ABCDSR2 ) | mask, pio +PIO_ABCDSR2 ); +__raw_writel (mask, pio +PIO_PDR ); +return 0 ; +} +EXPORT_SYMBOL (at91_set_C_periph); + + +/* +* mux the pin to the "C" internal peripheral role. +*/ +int __init_or_module at91_set_D_periph(unsigned pin, int use_pullup) +{ +void __iomem *pio =pin_to_controller (pin); +unsigned mask =pin_to_mask (pin); + +if (!pio || !cpu_has_pio3 ()) +return -EINVAL ; + +__raw_writel (mask, pio +PIO_IDR ); +__raw_writel (mask, pio + (use_pullup ?PIO_PUER :PIO_PUDR )); +__raw_writel (__raw_readl (pio +PIO_ABCDSR1 ) | mask, pio +PIO_ABCDSR1 ); +__raw_writel (__raw_readl (pio +PIO_ABCDSR2 ) | mask, pio +PIO_ABCDSR2 ); +__raw_writel (mask, pio +PIO_PDR ); +return 0 ; +} +EXPORT_SYMBOL (at91_set_D_periph); + + +/* * mux the pin to the gpio controller (instead of "A" or "B" peripheral), and * configure it for an input. */
@@ -213,12 +322,37 @@ int __init_or_module at91_set_deglitch(unsigned pin, int is_on)if (!pio)return -EINVAL ; + +if (cpu_has_pio3 () && is_on) +__raw_writel (mask, pio +PIO_IFSCDR );__raw_writel (mask, pio + (is_on ?PIO_IFER :PIO_IFDR ));return 0 ; }EXPORT_SYMBOL (at91_set_deglitch);/* +* enable/disable the debounce filter; +*/ +int __init_or_module at91_set_debounce(unsigned pin, int is_on, int div) +{ +void __iomem *pio =pin_to_controller (pin); +unsigned mask =pin_to_mask (pin); + +if (!pio || !cpu_has_pio3 ()) +return -EINVAL ; + +if (is_on) { +__raw_writel (mask, pio +PIO_IFSCER ); +__raw_writel (div &PIO_SCDR_DIV , pio +PIO_SCDR ); +__raw_writel (mask, pio +PIO_IFER ); + }else { +__raw_writel (mask, pio +PIO_IFDR ); + } +return 0 ; +} +EXPORT_SYMBOL (at91_set_debounce); + +/* * enable/disable the multi-driver; This is only valid for output and * allows the output pin to run as an open collector output. */
@@ -236,6 +370,41 @@ int __init_or_module at91_set_multi_drive(unsigned pin, int is_on)EXPORT_SYMBOL (at91_set_multi_drive);/* +* enable/disable the pull-down. +* If pull-up already enabled while calling the function, we disable it. +*/ +int __init_or_module at91_set_pulldown(unsigned pin, int is_on) +{ +void __iomem *pio =pin_to_controller (pin); +unsigned mask =pin_to_mask (pin); + +if (!pio || !cpu_has_pio3 ()) +return -EINVAL ; + +/* Disable pull-up anyway */ +__raw_writel (mask, pio +PIO_PUDR ); +__raw_writel (mask, pio + (is_on ?PIO_PPDER :PIO_PPDDR )); +return 0 ; +} +EXPORT_SYMBOL (at91_set_pulldown); + +/* +* disable Schmitt trigger +*/ +int __init_or_module at91_disable_schmitt_trig(unsigned pin) +{ +void __iomem *pio =pin_to_controller (pin); +unsigned mask =pin_to_mask (pin); + +if (!pio || !cpu_has_pio3 ()) +return -EINVAL ; + +__raw_writel (__raw_readl (pio +PIO_SCHMITT ) | mask, pio +PIO_SCHMITT ); +return 0 ; +} +EXPORT_SYMBOL (at91_disable_schmitt_trig); + +/* * assuming the pin is muxed as a gpio output, set its value. */ int at91_set_gpio_value (unsigned pin,int value)
@@ -337,7 +506,10 @@ void at91_gpio_resume(void)* To use any AT91_PIN_* as an externally triggered IRQ, first call * at91_set_gpio_input() then maybe enable its glitch filter. * Then just request_irq() with the pin ID; it works like any ARM IRQ -* handler, though it always triggers on rising and falling edges. +* handler. +* First implementation always triggers on rising and falling edges +* whereas the newer PIO3a can be additionally configured to trigger on +* level, edge with any polarity. * * Alternatively, certain pins may be used directly as IRQ0..IRQ6 after * configuring them with at91_set_a_periph() or at91_set_b_periph().
@@ -362,7 +534,7 @@ static void gpio_irq_unmask(struct irq_data *d)__raw_writel (mask, pio +PIO_IER ); } -static int gpio_irq_type (struct irq_data *d,unsigned type) +static int gpio_irq_type (unsigned pin,unsigned type) {switch (type) {case IRQ_TYPE_NONE :
@@ -373,11 +545,50 @@ static int gpio_irq_type(struct irq_data *d, unsigned type) } } +/* Alternate irq type for PIO3a support */ +static int alt_gpio_irq_type (unsigned pin,unsigned type) +{ +void __iomem *pio =pin_to_controller (pin); +unsigned mask =pin_to_mask (pin); + +switch (type) { +case IRQ_TYPE_EDGE_RISING : +__raw_writel (mask, pio +PIO_ESR ); +__raw_writel (mask, pio +PIO_REHLSR ); +break ; +case IRQ_TYPE_EDGE_FALLING : +__raw_writel (mask, pio +PIO_ESR ); +__raw_writel (mask, pio +PIO_FELLSR ); +break ; +case IRQ_TYPE_LEVEL_LOW : +__raw_writel (mask, pio +PIO_LSR ); +__raw_writel (mask, pio +PIO_FELLSR ); +break ; +case IRQ_TYPE_LEVEL_HIGH : +__raw_writel (mask, pio +PIO_LSR ); +__raw_writel (mask, pio +PIO_REHLSR ); +break ; +case IRQ_TYPE_EDGE_BOTH : +/* disable additional interrupt modes: +* fall back to default behavior */ +__raw_writel (mask, pio +PIO_AIMDR ); +return 0 ; +case IRQ_TYPE_NONE : +default : +pr_warn ("AT91: No type for irq %d\n" ,gpio_to_irq (pin)); +return -EINVAL ; + } + +/* enable additional interrupt modes */ +__raw_writel (mask, pio +PIO_AIMER ); + +return 0 ; +} +static struct irq_chip gpio_irqchip = { .name ="GPIO" , .irq_mask = gpio_irq_mask, .irq_unmask = gpio_irq_unmask, - .irq_set_type = gpio_irq_type, .irq_set_wake = gpio_irq_set_wake, };
@@ -444,7 +655,7 @@ static int at91_gpio_show(struct seq_file *s, void *unused)/* print heading */ seq_printf (s,"Pin\t" );for (bank =0 ; bank < gpio_banks; bank++) { -seq_printf (s,"PIO%c\t" ,'A' + bank); +seq_printf (s,"PIO%c\t\t" ,'A' + bank); };seq_printf (s,"\n\n" );
@@ -458,11 +669,10 @@ static int at91_gpio_show(struct seq_file *s, void *unused)unsigned mask =pin_to_mask (pin);if (__raw_readl (pio +PIO_PSR ) & mask) -seq_printf (s,"GPIO:%s" ,__raw_readl (pio +PIO_PDSR ) & mask ?"1" :"0" ); +gpio_printf (s, pio, mask);else -seq_printf (s,"%s" ,__raw_readl (pio +PIO_ABSR ) & mask ?"B" :"A" ); - -seq_printf (s,"\t" ); +seq_printf (s,"%c\t\t" , +peripheral_function (pio, mask)); }seq_printf (s,"\n" );
@@ -509,6 +719,11 @@ void __init at91_gpio_irq_setup(void)unsigned pioc, pin;struct at91_gpio_chip *this, *prev; +if (cpu_has_pio3 ()) + gpio_irqchip.set_type = alt_gpio_irq_type; +else + gpio_irqchip.set_type = gpio_irq_type; +for (pioc =0 , pin =PIN_BASE , this = gpio_chip, prev =NULL ; pioc++ < gpio_banks; prev = this, this++) {
@@ -605,9 +820,8 @@ static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)at91_get_gpio_value (pin) ? "set" : "clear"); else - seq_printf(s, "[periph %s]\n", - __raw_readl(pio + PIO_ABSR) & - mask ? "B" : "A"); + seq_printf(s, "[periph %c]\n", + peripheral_function(pio, mask)); } } }
arch/arm/mach-at91/include/mach/at91_pio.h +25 -0
@@ -40,10 +40,35 @@#define PIO_PUER 0x64/* Pull-up Enable Register */ #define PIO_PUSR 0x68/* Pull-up Status Register */ #define PIO_ASR 0x70/* Peripheral A Select Register */ +#define PIO_ABCDSR1 0x70/* Peripheral ABCD Select Register 1 [some sam9 only] */ #define PIO_BSR 0x74/* Peripheral B Select Register */ +#define PIO_ABCDSR2 0x74/* Peripheral ABCD Select Register 2 [some sam9 only] */ #define PIO_ABSR 0x78/* AB Status Register */ +#define PIO_IFSCDR 0x80/* Input Filter Slow Clock Disable Register */ +#define PIO_IFSCER 0x84/* Input Filter Slow Clock Enable Register */ +#define PIO_IFSCSR 0x88/* Input Filter Slow Clock Status Register */ +#define PIO_SCDR 0x8c/* Slow Clock Divider Debouncing Register */ +#define PIO_SCDR_DIV (0x3fff << 0)/* Slow Clock Divider Mask */ +#define PIO_PPDDR 0x90/* Pad Pull-down Disable Register */ +#define PIO_PPDER 0x94/* Pad Pull-down Enable Register */ +#define PIO_PPDSR 0x98/* Pad Pull-down Status Register */ #define PIO_OWER 0xa0/* Output Write Enable Register */ #define PIO_OWDR 0xa4/* Output Write Disable Register */ #define PIO_OWSR 0xa8/* Output Write Status Register */ +#define PIO_AIMER 0xb0/* Additional Interrupt Modes Enable Register */ +#define PIO_AIMDR 0xb4/* Additional Interrupt Modes Disable Register */ +#define PIO_AIMMR 0xb8/* Additional Interrupt Modes Mask Register */ +#define PIO_ESR 0xc0/* Edge Select Register */ +#define PIO_LSR 0xc4/* Level Select Register */ +#define PIO_ELSR 0xc8/* Edge/Level Status Register */ +#define PIO_FELLSR 0xd0/* Falling Edge/Low Level Select Register */ +#define PIO_REHLSR 0xd4/* Rising Edge/ High Level Select Register */ +#define PIO_FRLHSR 0xd8/* Fall/Rise - Low/High Status Register */ +#define PIO_SCHMITT 0x100/* Schmitt Trigger Register */ + +#define ABCDSR_PERIPH_A 0x0 +#define ABCDSR_PERIPH_B 0x1 +#define ABCDSR_PERIPH_C 0x2 +#define ABCDSR_PERIPH_D 0x3#endif
arch/arm/mach-at91/include/mach/gpio.h +5 -0
@@ -193,10 +193,15 @@ extern int __init_or_module at91_set_GPIO_periph(unsigned pin, int use_pullup); extern int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup); extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup); +extern int __init_or_module at91_set_C_periph(unsigned pin, int use_pullup); +extern int __init_or_module at91_set_D_periph(unsigned pin, int use_pullup); extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup); extern int __init_or_module at91_set_gpio_output(unsigned pin, int value); extern int __init_or_module at91_set_deglitch(unsigned pin, int is_on); +extern int __init_or_module at91_set_debounce(unsigned pin, int is_on, int div); extern int __init_or_module at91_set_multi_drive(unsigned pin, int is_on); +extern int __init_or_module at91_set_pulldown(unsigned pin, int is_on); +extern int __init_or_module at91_disable_schmitt_trig(unsigned pin);/* callable@any time */ extern int at91_set_gpio_value (unsigned pin,int value);
Signature · 1 line
1.7.4.1
PATCH 6/6 AT91: at91sam9x5: add chip and board file
In reply to Jean-Christophe PLAGNIOL-VILLARDFrom: Nicolas Ferre <[email protected]>
On-chip and board related peripherals definitions. Basic implementation for VB board.
--- arch/arm/configs/at91sam9x5ek_defconfig | 180 +++++ arch/arm/mach-at91/Kconfig | 19 + arch/arm/mach-at91/Makefile | 4 + arch/arm/mach-at91/at91sam9x5_devices.c | 1083 ++++++++++++++++++++++++++++ arch/arm/mach-at91/board-sam9x5ek.c | 243 +++++++ arch/arm/mach-at91/clock.c | 2 + arch/arm/mach-at91/generic.h | 2 + arch/arm/mach-at91/include/mach/board.h | 2 +- arch/arm/mach-at91/include/mach/hardware.h | 2 + arch/arm/mach-at91/include/mach/timex.h | 5 + arch/arm/mach-at91/pm.h | 19 + arch/arm/mach-at91/pm_slowclock.S | 11 +- drivers/dma/Kconfig | 2 +- 13 files changed, 1568 insertions(+), 6 deletions(-) create mode 100644 arch/arm/configs/at91sam9x5ek_defconfig create mode 100644 arch/arm/mach-at91/at91sam9x5_devices.c create mode 100644 arch/arm/mach-at91/board-sam9x5ek.c
arch/arm/configs/at91sam9x5ek_defconfig new file +180 -0
@@ -0,0 +1,180 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set +# CONFIG_SWAP is not set +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_UTS_NS is not set +# CONFIG_IPC_NS is not set +# CONFIG_USER_NS is not set +# CONFIG_PID_NS is not set +# CONFIG_NET_NS is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_SLAB=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_LBDAF is not set +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_IOSCHED_DEADLINE is not set +# CONFIG_IOSCHED_CFQ is not set +CONFIG_ARCH_AT91=y +CONFIG_ARCH_AT91SAM9X5=y +CONFIG_CHIP_SAM9X25=y +CONFIG_MACH_AT91SAM9X5EK=y +CONFIG_AT91_PROGRAMMABLE_CLOCKS=y +CONFIG_AT91_SLOW_CLOCK=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_AEABI=y +CONFIG_LEDS=y +CONFIG_LEDS_CPU=y +CONFIG_UACCESS_WITH_MEMCPY=y +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_CMDLINE="mem=128M console=ttyS0,115200 initrd=0x21100000,8000000 root=/dev/ram0 rw mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data)" +CONFIG_FPE_NWFPE=y +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_PM=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +# CONFIG_IPV6 is not set +CONFIG_NETFILTER=y +CONFIG_NETFILTER_NETLINK_QUEUE=m +CONFIG_NETFILTER_NETLINK_LOG=m +CONFIG_NF_CONNTRACK=y +CONFIG_NF_CONNTRACK_MARK=y +CONFIG_NF_CONNTRACK_FTP=m +CONFIG_NF_CT_NETLINK=m +CONFIG_NF_CONNTRACK_IPV4=y +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_MATCH_ADDRTYPE=y +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_TARGET_REJECT=m +CONFIG_IP_NF_TARGET_LOG=m +CONFIG_IP_NF_TARGET_ULOG=m +CONFIG_NF_NAT=y +CONFIG_IP_NF_TARGET_MASQUERADE=y +CONFIG_IP_NF_TARGET_NETMAP=y +CONFIG_IP_NF_TARGET_REDIRECT=y +CONFIG_IP_NF_RAW=m +CONFIG_IP_NF_ARPTABLES=m +CONFIG_BRIDGE=y +CONFIG_VLAN_8021Q=m +CONFIG_NET_SCHED=y +CONFIG_NET_SCH_CBQ=m +CONFIG_NET_SCH_HTB=m +CONFIG_NET_SCH_HFSC=m +CONFIG_NET_SCH_TBF=m +CONFIG_NET_CLS_FW=m +# CONFIG_WIRELESS is not set +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +# CONFIG_STANDALONE is not set +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +# CONFIG_FIRMWARE_IN_KERNEL is not set +CONFIG_MTD=y +CONFIG_MTD_TESTS=m +CONFIG_MTD_CONCAT=y +CONFIG_MTD_PARTITIONS=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_M25P80=y +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ATMEL=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=4 +CONFIG_BLK_DEV_RAM_SIZE=8192 +CONFIG_MISC_DEVICES=y +CONFIG_ATMEL_TCLIB=y +CONFIG_SCSI=y +CONFIG_BLK_DEV_SD=y +CONFIG_SCSI_MULTI_LUN=y +# CONFIG_SCSI_LOWLEVEL is not set +CONFIG_NETDEVICES=y +CONFIG_MII=y +CONFIG_PHYLIB=y +CONFIG_DAVICOM_PHY=y +CONFIG_NET_ETHERNET=y +# CONFIG_NETDEV_1000 is not set +# CONFIG_NETDEV_10000 is not set +# CONFIG_WLAN is not set +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=800 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=480 +CONFIG_INPUT_EVDEV=y +# CONFIG_KEYBOARD_ATKBD is not set +CONFIG_KEYBOARD_GPIO=y +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_SERIAL_ATMEL=y +CONFIG_SERIAL_ATMEL_CONSOLE=y +CONFIG_LEGACY_PTY_COUNT=8 +CONFIG_HW_RANDOM=y +CONFIG_SPI=y +CONFIG_SPI_ATMEL=y +CONFIG_GPIO_SYSFS=y +# CONFIG_HWMON is not set +# CONFIG_MFD_SUPPORT is not set +CONFIG_USB=y +# CONFIG_USB_DEVICE_CLASS is not set +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_USB_LIBUSUAL=y +CONFIG_USB_GADGET=y +CONFIG_USB_ZERO=m +CONFIG_USB_ETH=m +CONFIG_USB_FILE_STORAGE=m +CONFIG_USB_G_SERIAL=m +CONFIG_USB_CDC_COMPOSITE=m +CONFIG_USB_G_MULTI=m +CONFIG_USB_G_MULTI_CDC=y +CONFIG_MMC=y +# CONFIG_MMC_BLOCK_BOUNCE is not set +CONFIG_MMC_ATMELMCI=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_RTC_CLASS=y +CONFIG_DMADEVICES=y +CONFIG_AT_HDMAC=y +CONFIG_DMATEST=m +CONFIG_UIO=y +CONFIG_UIO_PDRV=m +CONFIG_UIO_PDRV_GENIRQ=y +CONFIG_EXT2_FS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_SUMMARY=y +CONFIG_LOGFS=m +CONFIG_CRAMFS=y +CONFIG_SQUASHFS=m +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +CONFIG_NFS_V4=y +CONFIG_ROOT_NFS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_CODEPAGE_850=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_ISO8859_15=y +CONFIG_NLS_UTF8=y +# CONFIG_ENABLE_WARN_DEPRECATED is not set +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_USER=y +CONFIG_CRYPTO=y +# CONFIG_CRYPTO_HW is not set
arch/arm/mach-at91/Kconfig +19 -0
@@ -78,6 +78,11 @@ config ARCH_AT91SAM9G45 select HAVE_FB_ATMEL select HAVE_NET_MACB +config ARCH_AT91SAM9X5 + bool "AT91SAM9X5" + select CPU_ARM926T + select GENERIC_CLOCKEVENTS + config ARCH_AT91CAP9 bool "AT91CAP9" select CPU_ARM926T
@@ -425,6 +430,20 @@ endif # ---------------------------------------------------------- +if ARCH_AT91SAM9X5 + +comment "AT91SAM9x5 Series Board Type" + +config MACH_AT91SAM9X5EK + bool "Atmel AT91SAM9x5 Series Evaluation Kit" + help + Select this if you re using Atmel's AT91SAM9x5-EK Evaluation Kit. + Supported chips are sam9g15, sam9g25, sam9x25, sam9g35 and sam9x35. +endif +# ---------------------------------------------------------- + +# ---------------------------------------------------------- + if ARCH_AT91CAP9 comment "AT91CAP9 Board Type"
arch/arm/mach-at91/Makefile +4 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_d obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o at91sam9_alt_reset.o obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o at91sam9_alt_reset.o obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o +obj-$(CONFIG_ARCH_AT91SAM9X5) += at91sam9x5.o at91sam926x_time.o at91sam9x5_devices.o sam9_smc.o obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o sam9_smc.o obj-$(CONFIG_ARCH_AT572D940HF) += at572d940hf.o at91sam926x_time.o at572d940hf_devices.o sam9_smc.o obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
@@ -75,6 +76,9 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o # AT91SAM9G45 board-specific support obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o +# AT91SAM9X5 board-specific support +obj-$(CONFIG_MACH_AT91SAM9X5EK) += board-sam9x5ek.o + # AT91CAP9 board-specific support obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
arch/arm/mach-at91/at91sam9x5_devices.c new file +1083 -0
1,083 lines not on this page · raw message
arch/arm/mach-at91/board-sam9x5ek.c new file +243 -0
243 lines not on this page · raw message
arch/arm/mach-at91/clock.c +2 -0
@@ -502,9 +502,11 @@ static int at91_clk_show(struct seq_file *s, void *unused)else state ="" ; +#if 0 seq_printf (s,"%-10s users=%2d %-3s %9ld Hz %s\n" , clk->name, clk->users, state,clk_get_rate (clk), clk->parent ? clk->parent->name :"" ); +#endif }return 0 ; }
arch/arm/mach-at91/generic.h +2 -0
@@ -15,6 +15,7 @@ extern void __init at91sam9261_initialize(unsigned long main_clock);extern void __init at91sam9263_initialize (unsigned long main_clock);extern void __init at91sam9rl_initialize (unsigned long main_clock);extern void __init at91sam9g45_initialize (unsigned long main_clock); +extern void __init at91sam9x5_initialize (unsigned long main_clock);extern void __init at91x40_initialize (unsigned long main_clock);extern void __init at91cap9_initialize (unsigned long main_clock);extern void __init at572d940hf_initialize (unsigned long main_clock);
@@ -26,6 +27,7 @@ extern void __init at91sam9261_init_interrupts(unsigned int priority[]);extern void __init at91sam9263_init_interrupts (unsigned int priority[]);extern void __init at91sam9rl_init_interrupts (unsigned int priority[]);extern void __init at91sam9g45_init_interrupts (unsigned int priority[]); +extern void __init at91sam9x5_init_interrupts (unsigned int priority[]);extern void __init at91x40_init_interrupts (unsigned int priority[]);extern void __init at91cap9_init_interrupts (unsigned int priority[]);extern void __init at572d940hf_init_interrupts (unsigned int priority[]);
arch/arm/mach-at91/include/mach/board.h +1 -1
@@ -117,7 +117,7 @@ struct atmel_nand_data {extern void __init at91_add_device_nand (struct atmel_nand_data *data);/* I2C*/ -#if defined(CONFIG_ARCH_AT91SAM9G45 ) +#if defined(CONFIG_ARCH_AT91SAM9G45 ) || defined(CONFIG_ARCH_AT91SAM9X5 )extern void __init at91_add_device_i2c (short i2c_id,struct i2c_board_info *devices,int nr_devices);#else extern void __init at91_add_device_i2c (struct i2c_board_info *devices,int nr_devices);
arch/arm/mach-at91/include/mach/hardware.h +2 -0
@@ -28,6 +28,8 @@#include <mach/at91sam9rl.h> #elif defined(CONFIG_ARCH_AT91SAM9G45 )#include <mach/at91sam9g45.h> +#elif defined(CONFIG_ARCH_AT91SAM9X5 ) +#include <mach/at91sam9x5.h> #elif defined(CONFIG_ARCH_AT91CAP9 )#include <mach/at91cap9.h> #elif defined(CONFIG_ARCH_AT91X40 )
arch/arm/mach-at91/include/mach/timex.h +5 -0
@@ -72,6 +72,11 @@#define AT91SAM9_MASTER_CLOCK 133333333#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) +#elif defined(CONFIG_ARCH_AT91SAM9X5 ) + +#define AT91SAM9_MASTER_CLOCK 133333333 +#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) +#elif defined(CONFIG_ARCH_AT91CAP9 )#define AT91CAP9_MASTER_CLOCK 100000000
arch/arm/mach-at91/pm.h +19 -0
@@ -79,6 +79,25 @@ static inline u32 sdram_selfrefresh_enable(void) } while (0)#define wait_for_interrupt_enable () cpu_do_idle() +#elif defined(CONFIG_ARCH_AT91SAM9X5 ) +#include <mach/at91sam9_ddrsdr.h> + +static inline u32 sdram_selfrefresh_enable (void ) +{ +u32 lpr, saved_lpr; + + saved_lpr =at91_ramc_read (0 ,AT91_DDRSDRC_LPR ); + lpr = saved_lpr & ~AT91_DDRSDRC_LPCB ; + lpr |=AT91_DDRSDRC_LPCB_SELF_REFRESH ; + +at91_ramc_write (0 ,AT91_DDRSDRC_LPR , lpr); + +return saved_lpr; +} + +#define sdram_selfrefresh_disable (saved_lpr) at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr) +#define wait_for_interrupt_enable () cpu_do_idle() +#else #include <mach/at91sam9_sdramc.h>
arch/arm/mach-at91/pm_slowclock.S +7 -4
@@ -20,7 +20,7 @@ #include <mach/at91rm9200_mc.h> #elif defined(CONFIG_ARCH_AT91CAP9) #include <mach/at91cap9_ddrsdr.h> -#elif defined(CONFIG_ARCH_AT91SAM9G45) +#elif defined(CONFIG_ARCH_AT91SAM9G45) || defined(CONFIG_ARCH_AT91SAM9X5) #include <mach/at91sam9_ddrsdr.h> #else #include <mach/at91sam9_sdramc.h>
@@ -132,7 +132,8 @@ ENTRY(at91_slow_clock) mov r3, #1 str r3, [r2, #AT91_SDRAMC_SRR] #elif defined(CONFIG_ARCH_AT91CAP9) \ - || defined(CONFIG_ARCH_AT91SAM9G45) + || defined(CONFIG_ARCH_AT91SAM9G45) \ + || defined(CONFIG_ARCH_AT91SAM9X5) /* prepare for DDRAM self-refresh mode */ ldr r3, [r2, #AT91_DDRSDRC_LPR]
@@ -265,7 +266,8 @@ ENTRY(at91_slow_clock) #ifdef CONFIG_ARCH_AT91RM9200 /* Do nothing - self-refresh is automatically disabled. */ #elif defined(CONFIG_ARCH_AT91CAP9) \ - || defined(CONFIG_ARCH_AT91SAM9G45) + || defined(CONFIG_ARCH_AT91SAM9G45) \ + || defined(CONFIG_ARCH_AT91SAM9X5) /* Restore LPR on AT91 with DDRAM */ ldr r3, .saved_sam9_lpr str r3, [r2, #AT91_DDRSDRC_LPR]
@@ -307,7 +309,8 @@ ENTRY(at91_slow_clock) .at91_va_base_sdramc: .word AT91_VA_BASE_SYS #elif defined(CONFIG_ARCH_AT91CAP9) \ - || defined(CONFIG_ARCH_AT91SAM9G45) + || defined(CONFIG_ARCH_AT91SAM9G45) \ + || defined(CONFIG_ARCH_AT91SAM9X5) .at91_va_base_sdramc: .word AT91_VA_BASE_SYS + AT91_DDRSDRC0 #else
drivers/dma/Kconfig +1 -1
@@ -91,7 +91,7 @@ config DW_DMAC config AT_HDMAC tristate "Atmel AHB DMA support" - depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 + depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 || ARCH_AT91SAM9X5 select DMA_ENGINE help Support the Atmel AHB DMA controller. This can be integrated in
Signature · 1 line
1.7.4.1