Support for NXP LPC2K SoCs
Subsystems (2)
v2 cover Support for NXP LPC2K SoCs
The following patch series implements support for the ARM7TDMI-S based NXP LPC2K System-on-Chips, and, as first board, the EmbeddedArtists LPC2478 Developer's Kit.
This code will work on the LPC23XX and LPC24XX ranges of chips, but will need some more work for LPC21XX and LPC22XX chips.
---
v2 incorporates the comments from Kevin Wells, Jamie Iles, and Uwe Kleine-K??nig.
PATCH v2 1/9 lpc2k: Core support
Core files (including IRQ handling) for NXP LPC2K architecture.
---
changes since v1:
* implement arch_idle() using PCON register.
* implement arch_reset() using WDT block.
* Fix PLL 'N' mask in regs-scb.h
--- arch/arm/Kconfig | 14 ++++++ arch/arm/Makefile | 1 + arch/arm/mach-lpc2k/Kconfig | 5 ++ arch/arm/mach-lpc2k/Makefile | 1 + arch/arm/mach-lpc2k/Makefile.boot | 3 + arch/arm/mach-lpc2k/include/mach/debug-macro.S | 19 +++++++++ arch/arm/mach-lpc2k/include/mach/entry-macro.S | 33 +++++++++++++++ arch/arm/mach-lpc2k/include/mach/hardware.h | 25 ++++++++++++ arch/arm/mach-lpc2k/include/mach/io.h | 18 ++++++++ arch/arm/mach-lpc2k/include/mach/irqs.h | 49 +++++++++++++++++++++++ arch/arm/mach-lpc2k/include/mach/memory.h | 15 +++++++ arch/arm/mach-lpc2k/include/mach/regs-scb.h | 42 +++++++++++++++++++ arch/arm/mach-lpc2k/include/mach/regs-wdt.h | 26 ++++++++++++ arch/arm/mach-lpc2k/include/mach/system.h | 51 ++++++++++++++++++++++++ arch/arm/mach-lpc2k/include/mach/timex.h | 15 +++++++ arch/arm/mach-lpc2k/include/mach/uncompress.h | 50 +++++++++++++++++++++++ arch/arm/mach-lpc2k/irq.c | 17 ++++++++ 17 files changed, 384 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-lpc2k/Kconfig create mode 100644 arch/arm/mach-lpc2k/Makefile create mode 100644 arch/arm/mach-lpc2k/Makefile.boot create mode 100644 arch/arm/mach-lpc2k/include/mach/debug-macro.S create mode 100644 arch/arm/mach-lpc2k/include/mach/entry-macro.S create mode 100644 arch/arm/mach-lpc2k/include/mach/hardware.h create mode 100644 arch/arm/mach-lpc2k/include/mach/io.h create mode 100644 arch/arm/mach-lpc2k/include/mach/irqs.h create mode 100644 arch/arm/mach-lpc2k/include/mach/memory.h create mode 100644 arch/arm/mach-lpc2k/include/mach/regs-scb.h create mode 100644 arch/arm/mach-lpc2k/include/mach/regs-wdt.h create mode 100644 arch/arm/mach-lpc2k/include/mach/system.h create mode 100644 arch/arm/mach-lpc2k/include/mach/timex.h create mode 100644 arch/arm/mach-lpc2k/include/mach/uncompress.h create mode 100644 arch/arm/mach-lpc2k/irq.c
arch/arm/Kconfig +14 -0
@@ -490,6 +490,18 @@ config ARCH_LOKI help Support for the Marvell Loki (88RC8480) SoC. +config ARCH_LPC2K + bool "NXP LPC2K Family" + depends on !MMU + select CPU_ARM7TDMI + select ARM_VIC + select GENERIC_TIME + select GENERIC_CLOCKEVENTS + help + Support for NXP LPC2K family of SoCs. These SoCs are based on + an ARM7TDMI-S core, and have optional on-chip flash and SRAM, + also UART, I2C, SPI, SSP, CAN, RTC, and other peripherals. + config ARCH_LPC32XX bool "NXP LPC32XX" select CPU_ARM926T
@@ -931,6 +943,8 @@ source "arch/arm/mach-ks8695/Kconfig" source "arch/arm/mach-loki/Kconfig" +source "arch/arm/mach-lpc2k/Kconfig" + source "arch/arm/mach-lpc32xx/Kconfig" source "arch/arm/mach-msm/Kconfig"
arch/arm/Makefile +1 -0
@@ -151,6 +151,7 @@ machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood machine-$(CONFIG_ARCH_KS8695) := ks8695 machine-$(CONFIG_ARCH_LOKI) := loki +machine-$(CONFIG_ARCH_LPC2K) := lpc2k machine-$(CONFIG_ARCH_LPC32XX) := lpc32xx machine-$(CONFIG_ARCH_MMP) := mmp machine-$(CONFIG_ARCH_MSM) := msm
arch/arm/mach-lpc2k/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +if ARCH_LPC2K + +comment "LPC2K machines" + +endif
arch/arm/mach-lpc2k/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y := irq.o
arch/arm/mach-lpc2k/Makefile.boot new file +3 -0
@@ -0,0 +1,3 @@ + zreladdr-y := 0xa0008000 +params_phys-y := 0xa0000100 +initrd_phys-y := 0xa1800000
arch/arm/mach-lpc2k/include/mach/debug-macro.S new file +19 -0
@@ -0,0 +1,19 @@ +/* + * Copyright 2011 Team Embedded VOF + * Ithamar R. Adema <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + + +#include <mach/hardware.h> + + .macro addruart, rp, rv + ldr \rp, =APB_UART0_BASE + ldr \rv, =APB_UART0_BASE + .endm + +#define UART_SHIFT 2 +#include <asm/hardware/debug-8250.S>
arch/arm/mach-lpc2k/include/mach/entry-macro.S new file +33 -0
@@ -0,0 +1,33 @@ +/* + * Copyright 2011 Team Embedded VOF + * Ithamar R. Adema <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <mach/hardware.h> + + .macro disable_fiq + .endm + + .macro get_irqnr_preamble, base, tmp + ldr \base, =APH_VIC_BASE + .endm + + .macro arch_ret_to_user, tmp1, tmp2 + .endm + + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp + ldr \irqstat, [\base, #0] + mov \irqnr, #0 +1001: + tst \irqstat, #1 + bne 1002f + add \irqnr, \irqnr, #1 + mov \irqstat, \irqstat, lsr #1 + cmp \irqnr, #32 + bcc 1001b +1002: + .endm
arch/arm/mach-lpc2k/include/mach/hardware.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright 2011 Team Embedded VOF +* Ithamar R. Adema <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef MACH_LPC2K_HARDWARE_H +#define MACH_LPC2K_HARDWARE_H + +#include <asm/sizes.h> + +/* Default memory size if no ATAGS found */ +#define MEM_SIZE (SZ_32M) + +#define APB_WDT_BASE 0xe0000000 +#define APB_TIMER0_BASE 0xe0004000 +#define APB_TIMER1_BASE 0xe0008000 +#define APB_UART0_BASE 0xe000c000 +#define APB_SCB_BASE 0xe01fc000 +#define APH_VIC_BASE 0xfffff000 + +#endif /* MACH_LPC2K_HARDWARE_H */
arch/arm/mach-lpc2k/include/mach/io.h new file +18 -0
@@ -0,0 +1,18 @@ +/* +* Copyright 2011 Team Embedded VOF +* Ithamar R. Adema <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef MACH_LPC2K_IO_H +#define MACH_LPC2K_IO_H + +#define IO_SPACE_LIMIT 0xffffffff + +#define __mem_pci (a) (a) +#define __io (a) __typesafe_io(a) + +#endif /* MACH_LPC2K_IO_H */
arch/arm/mach-lpc2k/include/mach/irqs.h new file +49 -0
49 lines not on this page · raw message
arch/arm/mach-lpc2k/include/mach/memory.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright 2011 Team Embedded VOF +* Ithamar R. Adema <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef MACH_LPC2K_MEMORY_H +#define MACH_LPC2K_MEMORY_H + +#define PHYS_OFFSET 0xa0000000 + +#endif /* MACH_LPC2K_MEMORY_H */
arch/arm/mach-lpc2k/include/mach/regs-scb.h new file +42 -0
42 lines not on this page · raw message
arch/arm/mach-lpc2k/include/mach/regs-wdt.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Watchdog Timer register definitions +* +* Copyright 2011 Team Embedded VOF +* Ithamar R. Adema <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef MACH_LPC2K_REGS_WDT_H +#define MACH_LPC2K_REGS_WDT_H + +#define WDMOD 0x0000 +#define WDTC 0x0004 +#define WDFEED 0x0008 +#define WDTV 0x000a +#define WDCLKSEL 0x0010 + +#define WDMOD_WDEN (1 << 0) +#define WDMOD_WDRESET (1 << 1) +#define WDMOD_WDTOF (1 << 2) +#define WDMOD_WDINT (1 << 3) + +#endif /* MACH_LPC2K_REGS_WDT_H */
arch/arm/mach-lpc2k/include/mach/system.h new file +51 -0
51 lines not on this page · raw message
arch/arm/mach-lpc2k/include/mach/timex.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Copyright 2011 Team Embedded VOF +* Ithamar R. Adema <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef MACH_LPC2K_TIMEX_H +#define MACH_LPC2K_TIMEX_H + +#define CLOCK_TICK_RATE (HZ * 100UL) + +#endif /* MACH_LPC2K_TIMEX_H */
arch/arm/mach-lpc2k/include/mach/uncompress.h new file +50 -0
50 lines not on this page · raw message
arch/arm/mach-lpc2k/irq.c new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Copyright (C) 2011 Team Embeded VOF +* Ithamar R. Adema <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/module.h> +#include <asm/hardware/vic.h> +#include <mach/hardware.h> + +void __init lpc2k_init_irq (void ) +{ +vic_init ((void __iomem *)APH_VIC_BASE ,0 , ~0 ,0 ); +}
Signature · 1 line
1.7.1
PATCH v2 1/9 lpc2k: Core support
arch/arm/Kconfig config ARCH_LOKI · line 498
Quoted 6 lines · Ithamar R. Adema
arch/arm/Kconfig +6
-0+config ARCH_LPC2K + bool "NXP LPC2K Family" + depends on !MMU + select CPU_ARM7TDMI + select ARM_VIC + select GENERIC_TIME
GENERIC_TIME no longer exists as a valid configuration symbol, so please remove this.
PATCH v2 1/9 lpc2k: Core support
Quoted 2 lines · Russell King - ARM Linux
GENERIC_TIMEno longer exists as a valid configuration symbol, so please remove this.
Ah, wasn't aware of that. Will remove.
Regards,
Ithamar.
PATCH v2 2/9 lpc2k: Exception vector handling
In reply to Ithamar R. AdemaSince the LPC2K does not have an MMU (ARM7TDMI based), it expects the vectors to be stored in on-chip SRAM. However, this moves the vectors too far away from the stubs page, requiring the vector jumps to be indirect.
Since now VECTOR_BASE is below PHYS_OFFSET, do not try to reserve the vector page, as it will fail (and prevent the kernel from booting).
Also, commit 247055aa (6384/1: Remove the domain switching on ARMv6k/v7 CPUs) broke the placement of vectors in the !MMU case, so fix this too.
---
changes since v1:
* added comment to entry-armv.S vector #ifdef.
--- arch/arm/Kconfig | 1 + arch/arm/kernel/entry-armv.S | 24 ++++++++++++++++++++++++ arch/arm/kernel/traps.c | 2 +- arch/arm/mm/nommu.c | 2 ++ 4 files changed, 28 insertions(+), 1 deletions(-)
arch/arm/Kconfig +1 -0
@@ -186,6 +186,7 @@ config VECTORS_BASE hex default 0xffff0000 if MMU || CPU_HIGH_VECTOR default DRAM_BASE if REMAP_VECTORS_TO_RAM + default 0x40000000 if ARCH_LPC2K default 0x00000000 help The base address of exception vectors.
arch/arm/kernel/entry-armv.S +24 -0
@@ -1208,6 +1208,7 @@ __stubs_end: .globl __vectors_start __vectors_start: +#ifndef CONFIG_ARCH_LPC2K ARM( swi SYS_ERROR0 ) THUMB( svc #0 ) THUMB( nop )
@@ -1218,6 +1219,29 @@ __vectors_start: W(b) vector_addrexcptn + stubs_offset W(b) vector_irq + stubs_offset W(b) vector_fiq + stubs_offset +#else /* CONFIG_ARCH_LPC2K */ + /* + * The LPC2K does not have an MMU (ARM7TDMI based), it expects + * the vectors to be stored in on-chip SRAM. This moves the + * vectors too far away from the stubs page, so requiring the + * vector jumps to be indirect. + */ + swi SYS_ERROR0 + ldr pc, .vector_und + ldr pc, .vector_swi + ldr pc, .vector_pabt + ldr pc, .vector_dabt + ldr pc, .vector_addrexcptn + ldr pc, .vector_irq + ldr pc, .vector_fiq +.vector_und: .word vector_und +.vector_swi: .word vector_swi +.vector_pabt: .word vector_pabt +.vector_dabt: .word vector_dabt +.vector_addrexcptn: .word vector_addrexcptn +.vector_irq: .word vector_irq +.vector_fiq: .word vector_fiq +#endif .globl __vectors_end __vectors_end:
arch/arm/kernel/traps.c +1 -1
@@ -758,7 +758,7 @@ static void __init kuser_get_tls_init(unsigned long vectors)void __init early_trap_init (void ) { -#if defined(CONFIG_CPU_USE_DOMAINS ) +#if defined(CONFIG_CPU_USE_DOMAINS ) || !defined(CONFIG_MMU )unsigned long vectors =CONFIG_VECTORS_BASE ;#else unsigned long vectors = (unsigned long )vectors_page;
arch/arm/mm/nommu.c +2 -0
@@ -24,7 +24,9 @@ void __init arm_mm_memblock_reserve(void)* some architectures which the DRAM is the exception vector to trap, * alloc_page breaks with error, although it is not NULL, but "0." */ +#if PHYS_OFFSET <=CONFIG_VECTORS_BASE memblock_reserve (CONFIG_VECTORS_BASE ,PAGE_SIZE ); +#endif }/*
Signature · 1 line
1.7.1
PATCH v2 2/9 lpc2k: Exception vector handling
Quoted 3 lines · Ithamar R. Adema
Since the LPC2K does not have an MMU (ARM7TDMI based), it expects the vectors to be stored in on-chip SRAM. However, this moves the vectors too far away from the stubs page, requiring the vector jumps to be indirect.
Why not copy the vectors and stubs just like we do for MMU-based kernels?
PATCH v2 2/9 lpc2k: Exception vector handling
Quoted 6 lines · Russell King - ARM Linux
Quoted 3 lines · Ithamar R. Adema
Since the LPC2K does not have an MMU (ARM7TDMI based), it expects the vectors to be stored in on-chip SRAM. However, this moves the vectors too far away from the stubs page, requiring the vector jumps to be indirect.
Why not copy the vectors and stubs just like we do for MMU-based kernels?
The problem here is the remapping of the low vectors that the LPC2K SoC does. Although we store the vectors (and stubs) @ 0x40000000 (SRAM) the SoC remaps only the first 64 bytes of that to address 0x00000000 (low vectors).
This means that although the vectors are accessible, the stubs are not. The 64 bytes cover the vectors itself, and the 1-word per vector address variable stored directly after the vectors.
I'll update the commit log to be a bit more clear on this.
Regards,
Ithamar.
PATCH v2 3/9 lpc2k: clk API
In reply to Ithamar R. AdemaImplements clock API using the CLKDEV_LOOKUP common code.
---
changes since v1:
* changed mutex into spinlock
* simplified clk_readl/clk_writel macros
--- arch/arm/Kconfig | 1 + arch/arm/mach-lpc2k/Makefile | 2 +- arch/arm/mach-lpc2k/clock.c | 360 +++++++++++++++++++++++++++++ arch/arm/mach-lpc2k/include/mach/clkdev.h | 17 ++ 4 files changed, 379 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-lpc2k/clock.c create mode 100644 arch/arm/mach-lpc2k/include/mach/clkdev.h
arch/arm/Kconfig +1 -0
@@ -496,6 +496,7 @@ config ARCH_LPC2K depends on !MMU select CPU_ARM7TDMI select ARM_VIC + select CLKDEV_LOOKUP select GENERIC_TIME select GENERIC_CLOCKEVENTS help
arch/arm/mach-lpc2k/Makefile +1 -1
@@ -1 +1 @@ -obj-y := irq.o +obj-y := clock.o irq.o
arch/arm/mach-lpc2k/clock.c new file +360 -0
360 lines not on this page · raw message
arch/arm/mach-lpc2k/include/mach/clkdev.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Copyright (C) 2011 Team Embedded VOF +* Ithamar R. Adema <[email protected]> +* +* 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 MACH_LPC2K_CLKDEV_H +#define MACH_LPC2K_CLKDEV_H + +#define __clk_get (clk) ({ 1; }) +#define __clk_put (clk) do { } while (0) + +#endif /* MACH_LPC2K_CLKDEV_H */
Signature · 1 line
1.7.1
PATCH v2 4/9 lpc2k: generic time and clockevents
In reply to Ithamar R. AdemaThis code was mostly "borrowed" form the lpc32xx implementation.
---
changes since v1:
* make use of clockevents_calc_mult_shift.
--- arch/arm/mach-lpc2k/Makefile | 2 +- arch/arm/mach-lpc2k/time.c | 173 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-lpc2k/time.c
arch/arm/mach-lpc2k/Makefile +1 -1
@@ -1 +1 @@ -obj-y := clock.o irq.o +obj-y := clock.o irq.o time.o
arch/arm/mach-lpc2k/time.c new file +173 -0
173 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 4/9 lpc2k: generic time and clockevents
arch/arm/mach-lpc2k/time.c line 143
Quoted 6 lines · Ithamar R. Adema
arch/arm/mach-lpc2k/time.c new file +6
-0+ clk =clk_get (NULL ,"timer1" ); +BUG_ON (IS_ERR (clk)); + +clk_enable (clk); + rate =clk_get_rate (clk); +clk_put (clk);
Don't put a clock that you continue to use.
PATCH v2 4/9 lpc2k: generic time and clockevents
Quoted 9 lines · Russell King - ARM Linux
arch/arm/mach-lpc2k/time.c line 143
Quoted 6 lines · Ithamar R. Adema
arch/arm/mach-lpc2k/time.c new file +6
-0+ clk =clk_get (NULL ,"timer1" ); +BUG_ON (IS_ERR (clk)); + +clk_enable (clk); + rate =clk_get_rate (clk); +clk_put (clk);Don't put a clock that you continue to use.
Ok, will remove the clk_put() here then.
Regards,
Ithamar.
PATCH v2 4/9 lpc2k: generic time and clockevents
In reply to Russell King - ARM LinuxQuoted 6 lines · Ithamar R. Adema
arch/arm/mach-lpc2k/time.c line 139
Quoted 2 lines
arch/arm/mach-lpc2k/time.c new file +2
-0+ clk =clk_get (NULL ,"timer1" ); +BUG_ON (IS_ERR (clk));
I didn't see a specific enable for timer0, it seems to work for me because my boot loader leaves it on when booting the kernel, but maybe it's also needed.
Quoted 11 lines
arch/arm/mach-lpc2k/time.c line 143
Quoted 4 lines
arch/arm/mach-lpc2k/time.c new file +4
-0+ +clk_enable (clk); + rate =clk_get_rate (clk); +clk_put (clk);Don't put a clock that you continue to use.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 4/9 lpc2k: generic time and clockevents
Quoted 3 lines · Kevin Wells
I didn't see a specific enable for timer0, it seems to work for me because my boot loader leaves it on when booting the kernel, but maybe it's also needed.
Will add, it works because TIMER0 and TIMER1 are both enabled on RESET, and the bootloader does indeed not disable them.
Regards,
Ithamar.
PATCH v2 5/9 lpc2k: gpiolib
In reply to Ithamar R. Ademagpiolib support, including gpio interrupts.
---
no changes since v1.
--- arch/arm/Kconfig | 1 + arch/arm/mach-lpc2k/Makefile | 2 +- arch/arm/mach-lpc2k/gpio.c | 265 +++++++++++++++++++++++++++ arch/arm/mach-lpc2k/include/mach/gpio.h | 22 +++ arch/arm/mach-lpc2k/include/mach/hardware.h | 2 + arch/arm/mach-lpc2k/include/mach/irqs.h | 69 +++++++- 6 files changed, 359 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-lpc2k/gpio.c create mode 100644 arch/arm/mach-lpc2k/include/mach/gpio.h
arch/arm/Kconfig +1 -0
@@ -499,6 +499,7 @@ config ARCH_LPC2K select CLKDEV_LOOKUP select GENERIC_TIME select GENERIC_CLOCKEVENTS + select ARCH_REQUIRE_GPIOLIB help Support for NXP LPC2K family of SoCs. These SoCs are based on an ARM7TDMI-S core, and have optional on-chip flash and SRAM,
arch/arm/mach-lpc2k/Makefile +1 -1
@@ -1 +1 @@ -obj-y := clock.o irq.o time.o +obj-y := clock.o irq.o gpio.o time.o
arch/arm/mach-lpc2k/gpio.c new file +265 -0
265 lines not on this page · raw message
arch/arm/mach-lpc2k/include/mach/gpio.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright (C) 2011 Team Embedded VOF +* Ithamar R. Adema <[email protected]> +* +* 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 MACH_LPC2K_GPIO_H +#define MACH_LPC2K_GPIO_H + +#include <asm-generic/gpio.h> + +#define gpio_get_value __gpio_get_value +#define gpio_set_value __gpio_set_value +#define gpio_cansleep __gpio_cansleep +#define gpio_to_irq __gpio_to_irq + +#endif /* MACH_LPC2K_GPIO_H */
arch/arm/mach-lpc2k/include/mach/hardware.h +2 -0
@@ -15,10 +15,12 @@/* Default memory size if no ATAGS found */ #define MEM_SIZE (SZ_32M) +#define FAST_GPIO_BASE 0x3fffc000#define APB_WDT_BASE 0xe0000000#define APB_TIMER0_BASE 0xe0004000#define APB_TIMER1_BASE 0xe0008000#define APB_UART0_BASE 0xe000c000 +#define APB_GPIO_BASE 0xe0028000#define APB_SCB_BASE 0xe01fc000#define APH_VIC_BASE 0xfffff000
arch/arm/mach-lpc2k/include/mach/irqs.h +68 -1
74 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 6/9 lpc2k: multifunction pin configuration
In reply to Ithamar R. AdemaInspired by the mfp support in PXA. Includes definition of pins for NXP LPC2468/78.
---
no changes since v1.
--- arch/arm/mach-lpc2k/Makefile | 2 +- arch/arm/mach-lpc2k/include/mach/hardware.h | 1 + arch/arm/mach-lpc2k/include/mach/mfp-lpc24xx.h | 98 +++++++++++ arch/arm/mach-lpc2k/include/mach/mfp.h | 209 ++++++++++++++++++++++++ arch/arm/mach-lpc2k/mfp.c | 99 +++++++++++ 5 files changed, 408 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-lpc2k/include/mach/mfp-lpc24xx.h create mode 100644 arch/arm/mach-lpc2k/include/mach/mfp.h create mode 100644 arch/arm/mach-lpc2k/mfp.c
arch/arm/mach-lpc2k/Makefile +1 -1
@@ -1 +1 @@ -obj-y := clock.o irq.o gpio.o time.o +obj-y := clock.o irq.o gpio.o mfp.o time.o
arch/arm/mach-lpc2k/include/mach/hardware.h +1 -0
@@ -21,6 +21,7 @@#define APB_TIMER1_BASE 0xe0008000#define APB_UART0_BASE 0xe000c000#define APB_GPIO_BASE 0xe0028000 +#define APB_PINSEL_BASE 0xe002c000#define APB_SCB_BASE 0xe01fc000#define APH_VIC_BASE 0xfffff000
arch/arm/mach-lpc2k/include/mach/mfp-lpc24xx.h new file +98 -0
98 lines not on this page · raw message
arch/arm/mach-lpc2k/include/mach/mfp.h new file +209 -0
209 lines not on this page · raw message
arch/arm/mach-lpc2k/mfp.c new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 6/9 lpc2k: multifunction pin configuration
Quoted 267 lines
arch/arm/mach-lpc2k/include/mach/mfp-lpc24xx.h new file +90
-0+ +#ifndef MACH_LPC2K_MFP_LPC24XX_H +#define MACH_LPC2K_MFP_LPC24XX_H + +#include <mach/mfp.h> + +#define GPIO0_RD1 MFP_CFG(GPIO0, AF1) +#define GPIO0_TXD3 MFP_CFG(GPIO0, AF2) +#define GPIO0_SDA1 MFP_CFG(GPIO0, AF3) +#define GPIO1_TD1 MFP_CFG(GPIO1, AF1) +#define GPIO1_RXD3 MFP_CFG(GPIO1, AF2) +#define GPIO1_SCL1 MFP_CFG(GPIO1, AF3) +#define GPIO2_TXD0 MFP_CFG(GPIO2, AF1) +#define GPIO3_RXD0 MFP_CFG(GPIO3, AF1) +#define GPIO4_LCDVD0 MFP_CFG(GPIO4, AF1) +#define GPIO5_LCDVD1 MFP_CFG(GPIO5, AF1) +#define GPIO6_LCDVD8 MFP_CFG(GPIO6, AF1) +#define GPIO7_LCDVD9 MFP_CFG(GPIO7, AF1) +#define GPIO8_LCDVD16 MFP_CFG(GPIO8, AF1) +#define GPIO9_LCDVD17 MFP_CFG(GPIO9, AF1) +#define GPIO10_TXD2 MFP_CFG(GPIO10, AF1) +#define GPIO11_RXD2 MFP_CFG(GPIO11, AF1) +#define GPIO12_USB_PPWR2 MFP_CFG(GPIO12, AF1) +#define GPIO13_USB_UP_LED2 MFP_CFG(GPIO13, AF1) +#define GPIO15_SCK MFP_CFG(GPIO15, AF3) +#define GPIO17_MISO MFP_CFG(GPIO17, AF3) +#define GPIO18_MOSI MFP_CFG(GPIO18, AF3) +#define GPIO27_SDA0 MFP_CFG(GPIO27, AF1) +#define GPIO28_SCL0 MFP_CFG(GPIO28, AF1) +#define GPIO29_USB_Dp1 MFP_CFG(GPIO29, AF1) +#define GPIO30_USB_Dn1 MFP_CFG(GPIO30, AF1) +#define GPIO31_USB_Dp2 MFP_CFG(GPIO31, AF1) +#define GPIO32_ENET_TXD0 MFP_CFG(GPIO32, AF1) +#define GPIO33_ENET_TXD1 MFP_CFG(GPIO33, AF1) +#define GPIO34_MCICLK MFP_CFG(GPIO34, AF2) +#define GPIO35_MCICMD MFP_CFG(GPIO35, AF2) +#define GPIO36_ENET_TX_EN MFP_CFG(GPIO36, AF1) +#define GPIO37_MCIPWR MFP_CFG(GPIO37, AF2) +#define GPIO38_ENET_TX_CLK MFP_CFG(GPIO38, AF1) +#define GPIO38_MCIDAT0 MFP_CFG(GPIO38, AF2) +#define GPIO39_MCIDAT1 MFP_CFG(GPIO39, AF2) +#define GPIO40_ENET_CRS MFP_CFG(GPIO40, AF1) +#define GPIO41_ENET_RXD0 MFP_CFG(GPIO41, AF1) +#define GPIO42_ENET_RXD1 MFP_CFG(GPIO42, AF1) +#define GPIO43_MCIDAT2 MFP_CFG(GPIO43, AF2) +#define GPIO44_MCIDAT3 MFP_CFG(GPIO44, AF2) +#define GPIO46_ENET_RX_ERR MFP_CFG(GPIO46, AF1) +#define GPIO47_ENET_REF_CLK MFP_CFG(GPIO47, AF1) +#define GPIO48_ENET_MDC MFP_CFG(GPIO48, AF1) +#define GPIO49_ENET_MDIO MFP_CFG(GPIO49, AF1) +#define GPIO50_PWM1 MFP_CFG(GPIO50, AF2) +#define GPIO52_LCDVD10 MFP_CFG(GPIO52, AF1) +#define GPIO53_LCDVD11 MFP_CFG(GPIO53, AF1) +#define GPIO54_LCDVD12 MFP_CFG(GPIO54, AF1) +#define GPIO55_LCDVD13 MFP_CFG(GPIO55, AF1) +#define GPIO56_LCDVD14 MFP_CFG(GPIO56, AF1) +#define GPIO57_LCDVD15 MFP_CFG(GPIO57, AF1) +#define GPIO58_LCDVD20 MFP_CFG(GPIO58, AF1) +#define GPIO59_LCDVD21 MFP_CFG(GPIO59, AF1) +#define GPIO60_LCDVD22 MFP_CFG(GPIO60, AF1) +#define GPIO61_LCDVD23 MFP_CFG(GPIO61, AF1) +#define GPIO62_VBUS MFP_CFG(GPIO62, AF2) +#define GPIO63_USB_OVRCR2 MFP_CFG(GPIO63, AF1) +#define GPIO64_LCDPWR MFP_CFG(GPIO64, AF3) +#define GPIO65_LCDLE MFP_CFG(GPIO65, AF3) +#define GPIO66_LCDDCLK MFP_CFG(GPIO66, AF3) +#define GPIO67_LCDFP MFP_CFG(GPIO67, AF3) +#define GPIO68_LCDM MFP_CFG(GPIO68, AF3) +#define GPIO69_LCDLP MFP_CFG(GPIO69, AF3) +#define GPIO70_LCDVP4 MFP_CFG(GPIO70, AF3) +#define GPIO71_LCDVP5 MFP_CFG(GPIO71, AF3) +#define GPIO72_LCDVP6 MFP_CFG(GPIO72, AF3) +#define GPIO73_LCDVP7 MFP_CFG(GPIO73, AF3) +#define GPIO75_LCDCLKIN MFP_CFG(GPIO75, AF1) +#define GPIO76_LCDVP18 MFP_CFG(GPIO76, AF1) +#define GPIO77_LCDVP19 MFP_CFG(GPIO77, AF1) +#define GPIO112_TXD1 MFP_CFG(GPIO112, AF3) +#define GPIO113_RXD1 MFP_CFG(GPIO113, AF3) +#define GPIO114_CTS1 MFP_CFG(GPIO114, AF3) +#define GPIO115_DCD1 MFP_CFG(GPIO115, AF3) +#define GPIO116_DSR1 MFP_CFG(GPIO116, AF3) +#define GPIO117_DR1 MFP_CFG(GPIO117, AF3) +#define GPIO118_RI1 MFP_CFG(GPIO118, AF3) +#define GPIO126_RTS1 MFP_CFG(GPIO126, AF3) +#define GPIO156_TXD3 MFP_CFG(GPIO156, AF3) +#define GPIO156_LCDVP2 MFP_CFG(GPIO156, AF2) +#define GPIO157_RXD3 MFP_CFG(GPIO157, AF3) +#define GPIO157_LCDVP3 MFP_CFG(GPIO157, AF2) + +#endif /* MACH_LPC2K_MFP_LPC24XX_H */ arch/arm/mach- renamed from arch/arm/mach-lpc2k/include/mach/mfp.h +0
-0
lpc2k/include/mach/mfp.h
new file mode 100644
index 0000000..3c919c8arch/arm/mach-lpc2k/include/mach/mfp.h new file +170
-0@@ -0,0 +1,209 @@ +/* +* Copyright 2011 Team Embedded VOF +* Ithamar R. Adema <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef ARCH_LPC2K_MFP_H +#define ARCH_LPC2K_MFP_H + +#define mfp_to_gpio (m) ((m) % 160) + +/* list of all the configurable MFP pins */ +enum { +MFP_PIN_INVALID =-1 , + +MFP_PIN_GPIO0 =0 , +MFP_PIN_GPIO1 , +MFP_PIN_GPIO2 , +MFP_PIN_GPIO3 , +MFP_PIN_GPIO4 , +MFP_PIN_GPIO5 , +MFP_PIN_GPIO6 , +MFP_PIN_GPIO7 , +MFP_PIN_GPIO8 , +MFP_PIN_GPIO9 , +MFP_PIN_GPIO10 , +MFP_PIN_GPIO11 , +MFP_PIN_GPIO12 , +MFP_PIN_GPIO13 , +MFP_PIN_GPIO14 , +MFP_PIN_GPIO15 , +MFP_PIN_GPIO16 , +MFP_PIN_GPIO17 , +MFP_PIN_GPIO18 , +MFP_PIN_GPIO19 , +MFP_PIN_GPIO20 , +MFP_PIN_GPIO21 , +MFP_PIN_GPIO22 , +MFP_PIN_GPIO23 , +MFP_PIN_GPIO24 , +MFP_PIN_GPIO25 , +MFP_PIN_GPIO26 , +MFP_PIN_GPIO27 , +MFP_PIN_GPIO28 , +MFP_PIN_GPIO29 , +MFP_PIN_GPIO30 , +MFP_PIN_GPIO31 , +MFP_PIN_GPIO32 , +MFP_PIN_GPIO33 , +MFP_PIN_GPIO34 , +MFP_PIN_GPIO35 , +MFP_PIN_GPIO36 , +MFP_PIN_GPIO37 , +MFP_PIN_GPIO38 , +MFP_PIN_GPIO39 , +MFP_PIN_GPIO40 , +MFP_PIN_GPIO41 , +MFP_PIN_GPIO42 , +MFP_PIN_GPIO43 , +MFP_PIN_GPIO44 , +MFP_PIN_GPIO45 , +MFP_PIN_GPIO46 , +MFP_PIN_GPIO47 , +MFP_PIN_GPIO48 , +MFP_PIN_GPIO49 , +MFP_PIN_GPIO50 , +MFP_PIN_GPIO51 , +MFP_PIN_GPIO52 , +MFP_PIN_GPIO53 , +MFP_PIN_GPIO54 , +MFP_PIN_GPIO55 , +MFP_PIN_GPIO56 , +MFP_PIN_GPIO57 , +MFP_PIN_GPIO58 , +MFP_PIN_GPIO59 , +MFP_PIN_GPIO60 , +MFP_PIN_GPIO61 , +MFP_PIN_GPIO62 , +MFP_PIN_GPIO63 , +MFP_PIN_GPIO64 , +MFP_PIN_GPIO65 , +MFP_PIN_GPIO66 , +MFP_PIN_GPIO67 , +MFP_PIN_GPIO68 , +MFP_PIN_GPIO69 , +MFP_PIN_GPIO70 , +MFP_PIN_GPIO71 , +MFP_PIN_GPIO72 , +MFP_PIN_GPIO73 , +MFP_PIN_GPIO74 , +MFP_PIN_GPIO75 , +MFP_PIN_GPIO76 , +MFP_PIN_GPIO77 , +MFP_PIN_GPIO78 , +MFP_PIN_GPIO79 , +MFP_PIN_GPIO80 , +MFP_PIN_GPIO81 , +MFP_PIN_GPIO82 , +MFP_PIN_GPIO83 , +MFP_PIN_GPIO84 , +MFP_PIN_GPIO85 , +MFP_PIN_GPIO86 , +MFP_PIN_GPIO87 , +MFP_PIN_GPIO88 , +MFP_PIN_GPIO89 , +MFP_PIN_GPIO90 , +MFP_PIN_GPIO91 , +MFP_PIN_GPIO92 , +MFP_PIN_GPIO93 , +MFP_PIN_GPIO94 , +MFP_PIN_GPIO95 , +MFP_PIN_GPIO96 , +MFP_PIN_GPIO97 , +MFP_PIN_GPIO98 , +MFP_PIN_GPIO99 , +MFP_PIN_GPIO100 , +MFP_PIN_GPIO101 , +MFP_PIN_GPIO102 , +MFP_PIN_GPIO103 , +MFP_PIN_GPIO104 , +MFP_PIN_GPIO105 , +MFP_PIN_GPIO106 , +MFP_PIN_GPIO107 , +MFP_PIN_GPIO108 , +MFP_PIN_GPIO109 , +MFP_PIN_GPIO110 , +MFP_PIN_GPIO111 , +MFP_PIN_GPIO112 , +MFP_PIN_GPIO113 , +MFP_PIN_GPIO114 , +MFP_PIN_GPIO115 , +MFP_PIN_GPIO116 , +MFP_PIN_GPIO117 , +MFP_PIN_GPIO118 , +MFP_PIN_GPIO119 , +MFP_PIN_GPIO120 , +MFP_PIN_GPIO121 , +MFP_PIN_GPIO122 , +MFP_PIN_GPIO123 , +MFP_PIN_GPIO124 , +MFP_PIN_GPIO125 , +MFP_PIN_GPIO126 , +MFP_PIN_GPIO127 , +MFP_PIN_GPIO128 , +MFP_PIN_GPIO129 , +MFP_PIN_GPIO130 , +MFP_PIN_GPIO131 , +MFP_PIN_GPIO132 , +MFP_PIN_GPIO133 , +MFP_PIN_GPIO134 , +MFP_PIN_GPIO135 , +MFP_PIN_GPIO136 , +MFP_PIN_GPIO137 , +MFP_PIN_GPIO138 , +MFP_PIN_GPIO139 , +MFP_PIN_GPIO140 , +MFP_PIN_GPIO141 , +MFP_PIN_GPIO142 , +MFP_PIN_GPIO143 , +MFP_PIN_GPIO144 , +MFP_PIN_GPIO145 , +MFP_PIN_GPIO146 , +MFP_PIN_GPIO147 , +MFP_PIN_GPIO148 , +MFP_PIN_GPIO149 , +MFP_PIN_GPIO150 , + MFP_PIN_GPIO151,
arch/arm/mach-lpc2k/include/mach/mfp.h line 180
Quoted 10 lines
arch/arm/mach-lpc2k/include/mach/mfp.h new file +10
-0+MFP_PIN_GPIO152 , +MFP_PIN_GPIO153 , +MFP_PIN_GPIO154 , +MFP_PIN_GPIO155 , +MFP_PIN_GPIO156 , +MFP_PIN_GPIO157 , +MFP_PIN_GPIO158 , + MFP_PIN_GPIO159, +}; +
A small nit here..
You can replace this enum with a single macro, but it might be a little easier all around to use the Px.y names for the GPIOs instead of a just mapping the GPIO numbers linearly. This follows the convention used in the LPC24XX User's guides, EA schematics (at least 2468), and pin designations.
So..MFP_PIN_GPIO0 maps to P0_0, MFP_PIN_GPIO32 maps to P1_0, MFP_PIN_GPIO63 maps to P1_31, MFP_PIN_GPIO64 maps to P2_0, etc.
If this designation is used, you can see the mapping of a GPIO, GPIO IRQ, or multi-function pin directly from the name and save a little mental calculation converting the GPIOx numbers to Px_y numbers when cross checking pin muxing and mapping.
This would affect GPIO_IRQ names, GPIOLIB names, and MFP names. So something like..
arch/arm/mach-lpc2k/include/mach/mfp.h line 182
Quoted 2 lines
arch/arm/mach-lpc2k/include/mach/mfp.h new file +2
-0+#define GPIO0_RD1 MFP_CFG(GPIO0, AF1) +#define GPIO33_ENET_TXD1 MFP_CFG(GPIO33, AF1)
would be something like:
#define PGPIO(x, y) (((x) * 32) + (y))
#define GPIO0_RD1 MFP_CFG(PGPIO(0, 0), AF1)
#define GPIO33_ENET_TXD1 MFP_CFG(PGPIO(1, 1), AF1)
Likewise, with IRQ number mapping, you could used a single macro definition for both P0[0, 31] and P2[0, 31] ranges. It would help save some space.
Quoted 142 lines
arch/arm/mach-lpc2k/include/mach/mfp.h new file +29
-0+/* pin number; currently only 0-159 are used */ +#define MFP_PIN (x) ((x) & 0x3ff) + +/* Alternate functions, currently only 0-3 are used */ +#define MFP_AF0 (0x0 << 10) +#define MFP_AF1 (0x1 << 10) +#define MFP_AF2 (0x2 << 10) +#define MFP_AF3 (0x3 << 10) +#define MFP_AF_MASK (0x3 << 10) +#define MFP_AF (x) (((x) >> 10) & 0x3) + +/* Pullup/down configuration, currently only none/high/low are used */ +#define MFP_PULL_NONE (0x2 << 21) +#define MFP_PULL_LOW (0x3 << 21) +#define MFP_PULL_HIGH (0x0 << 21) +#define MFP_PULL_MASK (0x3 << 21) +#define MFP_PULL (x) (((x) >> 21) & 0x3) + +#define MFP_CFG_DEFAULT (MFP_PULL_HIGH | MFP_AF0) + +#define MFP_CFG (pin, af) \ + ((MFP_CFG_DEFAULT & ~MFP_AF_MASK) |\ + (MFP_PIN(MFP_PIN_##pin) | MFP_##af)) + +#define MFP_CFG_PULL (pin, af, pull) \ + ((MFP_CFG_DEFAULT & ~(MFP_AF_MASK | MFP_PULL_MASK)) |\ + (MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_##pull)) + +#endif /* ARCH_LPC2K_MFP_H */ arch/arm/mach-lpc2k/mfp.c new file +99
-1@@ -0,0 +1,99 @@ +/* +* Copyright (C) 2011 Team Embeded VOF +* Ithamar R. Adema <[email protected]> +* +* Based on MFP code from mach-pxa. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/module.h> +#include <linux/io.h> + +#include <mach/hardware.h> +#include <mach/mfp.h> + +#define PINSEL (bank) (0x00 + (bank)*4) +#define PINMODE (bank) (0x40 + (bank)*4) + +struct gpio_desc { +unsigned valid:1 ; +unsigned long config; +}; + +static struct gpio_desc gpio_desc[MFP_PIN_GPIO159 +1 ]; + +static int __mfp_config_gpio (unsigned gpio,unsigned long c) +{ +unsigned bank = gpio >>4 ; +unsigned shift = (gpio &0xf ) *2 ; +unsigned val; + +/* Configure alternate function */ + val =__raw_readl (APB_PINSEL_BASE +PINSEL (bank)); +if ((val & (3 << shift)) && + (val & (3 << shift)) != (MFP_AF (c) << shift)) +pr_warning + ("GPIO%d is already configured (%x), not reconfigured!\n" , + gpio, (val & (3 << shift)) >> shift); +else { + val &= ~(0x3 << shift); + val |=MFP_AF (c) << shift; +__raw_writel (val,APB_PINSEL_BASE +PINSEL (bank)); + } + +/* Configuration pullup/dn */ + val =__raw_readl (APB_PINSEL_BASE +PINMODE (bank)); + val &= ~(0x3 << shift); + val |=MFP_PULL (c) << shift; +__raw_writel (val,APB_PINSEL_BASE +PINMODE (bank)); + +return 0 ; +} + +static inline int __mfp_validate (int mfp) +{ +int gpio =mfp_to_gpio (mfp); + +if (!gpio_desc[gpio].valid) { +pr_warning ("%s: GPIO%d is invalid pin\n" , __func__, gpio); +return -1 ; + } + +return gpio; +} + +void lpc2k_mfp_config (unsigned long *mfp_cfgs,int num) +{ +unsigned long flags; +unsigned long *c; +int i, gpio; + +for (i =0 , c = mfp_cfgs; i < num; i++, c++) { + + gpio =__mfp_validate (MFP_PIN (*c)); +if (gpio <0 ) +continue ; + +local_irq_save (flags); + + gpio_desc[gpio].config = *c; +__mfp_config_gpio (gpio, *c); + +local_irq_restore (flags); + } +} + +static int __init lpc2k_mfp_init (void ) +{ +int i; + +for (i =MFP_PIN_GPIO0 ; i <=MFP_PIN_GPIO159 ; i++) + gpio_desc[i].valid =1 ; + +return 0 ; +} + +postcore_initcall (lpc2k_mfp_init); --1.7.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 6/9 lpc2k: multifunction pin configuration
Hi Kevin,
On Fri, 2011-03-18 at 18:42 +0100, Kevin Wells wrote:
[...]
Quoted 4 lines
would be something like:
#definePGPIO(x, y)(((x) * 32) + (y))
#defineGPIO0_RD1MFP_CFG(PGPIO(0, 0), AF1)
#defineGPIO33_ENET_TXD1MFP_CFG(PGPIO(1, 1), AF1)
I've introduced an LPC2K_GPIO(port,pin) macro for that, and already use it for the IRQs too. I like your suggestion!
However, since now we're not using explicit GPIO numbers anymore, wouldn't you agree it would be better to make the above:
#define P0_0_RD1 MFP_CFG(LPC2K_GPIO(0, 0), AF1)
instead of still using the GPIOx prefix?
Regards,
Ithamar.
PATCH v2 7/9 lpc2k: Add EmbeddedArtists LPC2478 Developer's Kit board
In reply to Ithamar R. AdemaAdd support for EmbeddedArtists LPC2478 Developer's Kit, consisting of the LPC2478OEM board, with QVGA base board. For details, see:
http://www.embeddedartists.com/products/kits/lpc2478_kit.php
---
changes since v1:
* Fixed RTC clock rate
* Marked mfp_cfgs as __initdata.
* renamed LPC2478OEM to more appropriate EA2478DEVKIT.
since the machine ID was not used anywhere yet, this rename is harmless.
--- arch/arm/mach-lpc2k/Kconfig | 7 ++ arch/arm/mach-lpc2k/Makefile | 2 + arch/arm/mach-lpc2k/common.h | 21 ++++++ arch/arm/mach-lpc2k/mach-ea2478devkit.c | 121 +++++++++++++++++++++++++++++++ arch/arm/tools/mach-types | 2 +- 5 files changed, 152 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-lpc2k/common.h create mode 100644 arch/arm/mach-lpc2k/mach-ea2478devkit.c
arch/arm/mach-lpc2k/Kconfig +7 -0
@@ -2,4 +2,11 @@ if ARCH_LPC2K comment "LPC2K machines" +config MACH_EA2478DEVKIT + bool "Embedded Artists LPC2478 Developer's Kit" + help + Say Y if you want the kernel to support the EmbeddedArtists + LPC2478 Developer's Kit. For more hardware details, see: + http://www.embeddedartists.com/products/kits/lpc2478_kit.php + endif
arch/arm/mach-lpc2k/Makefile +2 -0
@@ -1 +1,3 @@ obj-y := clock.o irq.o gpio.o mfp.o time.o + +obj-$(CONFIG_MACH_EA2478DEVKIT) += mach-ea2478devkit.o
arch/arm/mach-lpc2k/common.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright 2011 Team Embedded VOF +* Ithamar R. Adema <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef LPC2K_COMMON_H +#define LPC2K_COMMON_H + +struct sys_timer ; + +extern void lpc2k_init_clocks (unsigned long xtal,unsigned long rtc); +extern void lpc2k_mfp_config (unsigned long *mfp_cfgs,int num); +extern void lpc2k_init_irq (void ); + +extern struct sys_timer lpc2k_timer; + +#endif /* LPC2K_COMMON_H */
arch/arm/mach-lpc2k/mach-ea2478devkit.c new file +121 -0
121 lines not on this page · raw message
arch/arm/tools/mach-types +1 -1
@@ -2667,7 +2667,7 @@ msm7x30_surf MACH_MSM7X30_SURF MSM7X30_SURF 2679 micro2440 MACH_MICRO2440 MICRO2440 2680 am2440 MACH_AM2440 AM2440 2681 tq2440 MACH_TQ2440 TQ2440 2682 -lpc2478oem MACH_LPC2478OEM LPC2478OEM 2683 +ea2478devkit MACH_EA2478DEVKIT EA2478DEVKIT 2683 ak880x MACH_AK880X AK880X 2684 cobra3530 MACH_COBRA3530 COBRA3530 2685 pmppb MACH_PMPPB PMPPB 2686
Signature · 1 line
1.7.1
PATCH v2 7/9 lpc2k: Add EmbeddedArtists LPC2478 Developer's Kit board
arch/arm/tools/mach-types msm7x30_surf MACH_MSM7X30_SURF MSM7X30_SURF 2679 · line 2673
Quoted 13 lines · Ithamar R. Adema
arch/arm/tools/mach-types +1
-1@@ -2667,7 +2667,7 @@ msm7x30_surf MACH_MSM7X30_SURF MSM7X30_SURF 2679 micro2440 MACH_MICRO2440 MICRO2440 2680 am2440 MACH_AM2440 AM2440 2681 tq2440 MACH_TQ2440 TQ2440 2682 -lpc2478oem MACH_LPC2478OEM LPC2478OEM 2683 +ea2478devkit MACH_EA2478DEVKIT EA2478DEVKIT 2683 ak880x MACH_AK880X AK880X 2684 cobra3530 MACH_COBRA3530 COBRA3530 2685 pmppb MACH_PMPPB PMPPB 2686
NAK. When I or anyone else updates this file this change wil get reverted.
PATCH v2 7/9 lpc2k: Add EmbeddedArtists LPC2478 Developer's Kit board
Dear Russell,
Quoted 6 lines · Russell King - ARM Linux
Quoted 5 lines · Ithamar R. Adema
arch/arm/tools/mach-types +0
-0@@ -2667,7 +2667,7 @@
[...]
Quoted 2 lines
NAK. When I or anyone else updates this file this change wil get reverted.
Ok, I've updated the machine definitions @
http://www.arm.linux.org.uk/developer/machines/ , but can I post an updated arch/arm/tools/mach-types (downloaded from your site) with the next patch set version just so reviewers can actually build the patch set?
Regards,
Ithamar.
PATCH v2 8/9 lpc2k: Add UART, SSP, and MCI devices
In reply to Ithamar R. AdemaAdds devices for which the drivers are already in the tree. For the relevant devices, let the ea2478devkit board set them up.
---
no changes since v1.
--- arch/arm/Kconfig | 1 + arch/arm/mach-lpc2k/Makefile | 2 +- arch/arm/mach-lpc2k/common.h | 4 + arch/arm/mach-lpc2k/devices.c | 174 +++++++++++++++++++++++++++ arch/arm/mach-lpc2k/include/mach/hardware.h | 6 + arch/arm/mach-lpc2k/mach-ea2478devkit.c | 20 +++ 6 files changed, 206 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-lpc2k/devices.c
arch/arm/Kconfig +1 -0
@@ -496,6 +496,7 @@ config ARCH_LPC2K depends on !MMU select CPU_ARM7TDMI select ARM_VIC + select ARM_AMBA select CLKDEV_LOOKUP select GENERIC_TIME select GENERIC_CLOCKEVENTS
arch/arm/mach-lpc2k/Makefile +1 -1
@@ -1,3 +1,3 @@ obj-y := clock.o irq.o gpio.o mfp.o time.o -obj-$(CONFIG_MACH_EA2478DEVKIT) += mach-ea2478devkit.o +obj-$(CONFIG_MACH_EA2478DEVKIT) += mach-ea2478devkit.o devices.o
arch/arm/mach-lpc2k/common.h +4 -0
@@ -16,6 +16,10 @@ extern void lpc2k_init_clocks(unsigned long xtal, unsigned long rtc);extern void lpc2k_mfp_config (unsigned long *mfp_cfgs,int num);extern void lpc2k_init_irq (void ); +extern void lpc2k_add_uart (int nr); +extern void lpc2k_add_ssp (int nr,void *platform_data); +extern void lpc2k_add_mci (void *platform_data,int pwr_high); +extern struct sys_timer lpc2k_timer;#endif /* LPC2K_COMMON_H */
arch/arm/mach-lpc2k/devices.c new file +174 -0
174 lines not on this page · raw message
arch/arm/mach-lpc2k/include/mach/hardware.h +6 -0
@@ -20,8 +20,14 @@#define APB_TIMER0_BASE 0xe0004000#define APB_TIMER1_BASE 0xe0008000#define APB_UART0_BASE 0xe000c000 +#define APB_UART1_BASE 0xe0010000#define APB_GPIO_BASE 0xe0028000#define APB_PINSEL_BASE 0xe002c000 +#define APB_SSP1_BASE 0xe0030000 +#define APB_SSP0_BASE 0xe0068000 +#define APB_UART2_BASE 0xe0078000 +#define APB_UART3_BASE 0xe007c000 +#define APB_MCI_BASE 0xe008c000#define APB_SCB_BASE 0xe01fc000#define APH_VIC_BASE 0xfffff000
arch/arm/mach-lpc2k/mach-ea2478devkit.c +20 -0
@@ -8,6 +8,8 @@*/ #include <linux/module.h> +#include <linux/amba/pl022.h> +#include <linux/amba/mmci.h> #include <linux/io.h> #include <asm/mach/arch.h>
@@ -95,9 +97,27 @@ static unsigned long mfp_cfgs[] __initdata = { GPIO44_MCIDAT3, }; +static struct pl022_ssp_controller ssp0_plat_data = { + .bus_id =0 , + .enable_dma =0 , + .num_chipselect =1 , +}; + +static struct mmci_platform_data mci_plat_data = { + .ocr_mask =MMC_VDD_32_33 |MMC_VDD_33_34 , + .capabilities =MMC_CAP_4_BIT_DATA , + .f_max =200000 , + .gpio_cd =-1 , + .gpio_wp =-1 , +}; +void __init ea2478devkit_init_machine (void ) {lpc2k_mfp_config (mfp_cfgs,ARRAY_SIZE (mfp_cfgs)); + +lpc2k_add_uart (0 ); +lpc2k_add_ssp (0 , &ssp0_plat_data); +lpc2k_add_mci (&mci_plat_data,0 /* active low */ ); }static void __init ea2478devkit_init_irq (void )
Signature · 1 line
1.7.1
PATCH v2 9/9 lpc2k: defconfig for NXP LPC2K platform
In reply to Ithamar R. AdemaAdd a defconfig that is setup to support booting a uClinux based system. This enables ROMFS/CRAMFS, initrd, and FLAT binaries besides the drivers for the devices added in the previous patch.
---
changes since v1:
* enabled CONFIG_MAGIC_SYSRQ for testing arch_reset.
--- arch/arm/configs/lpc2k_defconfig | 57 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-) create mode 100644 arch/arm/configs/lpc2k_defconfig
arch/arm/configs/lpc2k_defconfig new file +57 -0
@@ -0,0 +1,57 @@ +CONFIG_EXPERIMENTAL=y +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_TINY_RCU=y +# CONFIG_UTS_NS is not set +# CONFIG_PID_NS is not set +CONFIG_BLK_DEV_INITRD=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +# CONFIG_COMPAT_BRK is not set +# 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_MMU is not set +CONFIG_ARCH_LPC2K=y +CONFIG_MACH_EA2478DEVKIT=y +CONFIG_PROCESSOR_ID=0x41007700 +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_PREEMPT=y +CONFIG_AEABI=y +CONFIG_CMDLINE="root=/dev/ram initrd=0xa1a00000,4000k console=ttyS0,115200N8 debug rw earlyprintk" +CONFIG_BINFMT_FLAT=y +CONFIG_BINFMT_ZFLAT=y +CONFIG_BINFMT_SHARED_FLAT=y +# CONFIG_SUSPEND is not set +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +# CONFIG_FIRMWARE_IN_KERNEL is not set +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_SERIO is not set +# CONFIG_LEGACY_PTYS is not set +# CONFIG_DEVKMEM is not set +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_HW_RANDOM is not set +CONFIG_SPI=y +CONFIG_SPI_PL022=y +# CONFIG_HWMON is not set +# CONFIG_MFD_SUPPORT is not set +# CONFIG_HID_SUPPORT is not set +# CONFIG_USB_SUPPORT is not set +CONFIG_MMC=y +CONFIG_MMC_ARMMMCI=y +# CONFIG_DNOTIFY is not set +# CONFIG_INOTIFY_USER is not set +CONFIG_CRAMFS=y +CONFIG_ROMFS_FS=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_DEBUG_KERNEL=y +# CONFIG_FTRACE is not set +CONFIG_DEBUG_USER=y +CONFIG_DEBUG_ERRORS=y +CONFIG_DEBUG_LL=y +CONFIG_EARLY_PRINTK=y
Signature · 1 line
1.7.1