From 1d8823ae6163ffde33a3acf0da8f1f1865d05efc Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 10 Apr 2010 18:37:34 +0000 Subject: [PATCH] Add mx2 target with very basic support for the vp6500 voip phone SVN-Revision: 20786 --- target/linux/mx2/Makefile | 24 +++ target/linux/mx2/config-2.6.34 | 170 ++++++++++++++++++ .../mx2/files/arch/arm/mach-mx2/mach-vp6500.c | 128 +++++++++++++ .../arm/plat-mxc/include/mach/board-vp6500.h | 9 + target/linux/mx2/image/Makefile | 22 +++ .../mx2/patches-2.6.34/010-mach-vp6500.patch | 22 +++ .../mx2/patches-2.6.34/011-mach-type.patch | 11 ++ .../020-fix-usb-ioresource.patch | 22 +++ 8 files changed, 408 insertions(+) create mode 100644 target/linux/mx2/Makefile create mode 100644 target/linux/mx2/config-2.6.34 create mode 100644 target/linux/mx2/files/arch/arm/mach-mx2/mach-vp6500.c create mode 100644 target/linux/mx2/files/arch/arm/plat-mxc/include/mach/board-vp6500.h create mode 100644 target/linux/mx2/image/Makefile create mode 100644 target/linux/mx2/patches-2.6.34/010-mach-vp6500.patch create mode 100644 target/linux/mx2/patches-2.6.34/011-mach-type.patch create mode 100644 target/linux/mx2/patches-2.6.34/020-fix-usb-ioresource.patch diff --git a/target/linux/mx2/Makefile b/target/linux/mx2/Makefile new file mode 100644 index 0000000000..734ab1a70c --- /dev/null +++ b/target/linux/mx2/Makefile @@ -0,0 +1,24 @@ +# +# Copyright (C) 2006-2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=arm +BOARD:=mx2 +BOARDNAME:=Freescale MX2 +FEATURES:=jffs2 +CFLAGS:=-Os -pipe -march=armv5te -mtune=arm926ej-s -funit-at-a-time + +LINUX_VERSION:=2.6.34-rc3 + +DEVICE_TYPE=phone + +define Target/Description +endef + +include $(INCLUDE_DIR)/target.mk + +$(eval $(call BuildTarget)) diff --git a/target/linux/mx2/config-2.6.34 b/target/linux/mx2/config-2.6.34 new file mode 100644 index 0000000000..478e552058 --- /dev/null +++ b/target/linux/mx2/config-2.6.34 @@ -0,0 +1,170 @@ +# CONFIG_AEABI is not set +CONFIG_ALIGNMENT_TRAP=y +# CONFIG_ARCH_MX1 is not set +CONFIG_ARCH_MX2=y +# CONFIG_ARCH_MX25 is not set +# CONFIG_ARCH_MX3 is not set +# CONFIG_ARCH_MX5 is not set +CONFIG_ARCH_MXC=y +# CONFIG_ARCH_MXC91231 is not set +CONFIG_ARCH_MXC_AUDMUX_V1=y +# CONFIG_ARCH_NUC93X is not set +CONFIG_ARCH_REQUIRE_GPIOLIB=y +# CONFIG_ARCH_S5P6440 is not set +# CONFIG_ARCH_S5P6442 is not set +# CONFIG_ARCH_S5PV210 is not set +# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set +# CONFIG_ARCH_SHMOBILE is not set +# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM=y +CONFIG_ARM_L1_CACHE_SHIFT=5 +CONFIG_ARM_THUMB=y +CONFIG_BITREVERSE=y +# CONFIG_BLK_DEV is not set +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_BRIDGE_IGMP_SNOOPING=y +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_CEPH_FS is not set +CONFIG_CMDLINE="unused -- bootloader passes ATAG list" +CONFIG_COMMON_CLKDEV=y +CONFIG_COMPAT_BRK=y +CONFIG_CPU_32v5=y +CONFIG_CPU_ABRT_EV5TJ=y +CONFIG_CPU_ARM926T=y +# CONFIG_CPU_CACHE_ROUND_ROBIN is not set +CONFIG_CPU_CACHE_VIVT=y +CONFIG_CPU_COPY_V4WB=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +# CONFIG_CPU_DCACHE_WRITETHROUGH is not set +# CONFIG_CPU_ICACHE_DISABLE is not set +CONFIG_CPU_PABRT_LEGACY=y +CONFIG_CPU_TLB_V4WBI=y +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_USER is not set +CONFIG_DECOMPRESS_LZMA=y +# CONFIG_DEFAULT_SECURITY_SELINUX is not set +# CONFIG_DEFAULT_SECURITY_SMACK is not set +# CONFIG_DEFAULT_SECURITY_TOMOYO is not set +# CONFIG_DM9000 is not set +# CONFIG_FPE_FASTFPE is not set +# CONFIG_FPE_NWFPE is not set +CONFIG_FRAME_POINTER=y +# CONFIG_FSNOTIFY is not set +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_FIND_LAST_BIT=y +CONFIG_GENERIC_GPIO=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GPIOLIB=y +# CONFIG_GPIO_IT8761E is not set +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAVE_AOUT=y +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_CLK=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +CONFIG_HAVE_PROC_CPU=y +# CONFIG_HW_RANDOM is not set +CONFIG_IMX_HAVE_IOMUX_V1=y +# CONFIG_INLINE_READ_LOCK is not set +# CONFIG_INLINE_READ_LOCK_BH is not set +# CONFIG_INLINE_READ_LOCK_IRQ is not set +# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set +# CONFIG_INLINE_READ_TRYLOCK is not set +CONFIG_INLINE_READ_UNLOCK=y +# CONFIG_INLINE_READ_UNLOCK_BH is not set +CONFIG_INLINE_READ_UNLOCK_IRQ=y +# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set +# CONFIG_INLINE_SPIN_LOCK is not set +# CONFIG_INLINE_SPIN_LOCK_BH is not set +# CONFIG_INLINE_SPIN_LOCK_IRQ is not set +# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set +# CONFIG_INLINE_SPIN_TRYLOCK is not set +# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set +CONFIG_INLINE_SPIN_UNLOCK=y +# CONFIG_INLINE_SPIN_UNLOCK_BH is not set +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set +# CONFIG_INLINE_WRITE_LOCK is not set +# CONFIG_INLINE_WRITE_LOCK_BH is not set +# CONFIG_INLINE_WRITE_LOCK_IRQ is not set +# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set +# CONFIG_INLINE_WRITE_TRYLOCK is not set +CONFIG_INLINE_WRITE_UNLOCK=y +# CONFIG_INLINE_WRITE_UNLOCK_BH is not set +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set +CONFIG_INPUT=y +CONFIG_INPUT_KEYBOARD=y +# CONFIG_INPUT_MISC is not set +# CONFIG_ISDN_CAPI is not set +# CONFIG_ISDN_DRV_GIGASET is not set +# CONFIG_ISDN_I4L is not set +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_LZMA is not set +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_GPIO is not set +# CONFIG_KEYBOARD_IMX is not set +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_MATRIX is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_XTKBD is not set +CONFIG_LEDS_GPIO=y +# CONFIG_LEDS_TRIGGER_NETDEV is not set +# CONFIG_LKDTM is not set +# CONFIG_LOGFS is not set +CONFIG_MACH_MX21=y +# CONFIG_MACH_MX21ADS is not set +# CONFIG_MACH_MX27 is not set +CONFIG_MACH_VP6500=y +# CONFIG_MFD_T7L66XB is not set +# CONFIG_MTD_CFI_INTELEXT is not set +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_PHYSMAP=y +# CONFIG_MUTEX_SPIN_ON_OWNER is not set +# CONFIG_MXC_IRQ_PRIOR is not set +# CONFIG_MXC_PWM is not set +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PAGE_OFFSET=0xC0000000 +# CONFIG_PCI_SYSCALL is not set +CONFIG_PERF_USE_VMALLOC=y +CONFIG_RATIONAL=y +# CONFIG_SCSI_DMA is not set +CONFIG_SCSI_MOD=y +# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_IMX=y +CONFIG_SERIAL_IMX_CONSOLE=y +# CONFIG_SERIAL_TIMBERDALE is not set +CONFIG_SERIO=y +# CONFIG_SERIO_ALTERA_PS2 is not set +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_RAW is not set +CONFIG_SERIO_SERPORT=y +CONFIG_SPLIT_PTLOCK_CPUS=999999 +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +# CONFIG_TREE_PREEMPT_RCU is not set +# CONFIG_UID16 is not set +CONFIG_VECTORS_BASE=0xffff0000 +# CONFIG_VFP is not set +# CONFIG_WATCHDOG is not set +CONFIG_ZBOOT_ROM_BSS=0x0 +CONFIG_ZBOOT_ROM_TEXT=0x0 +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/mx2/files/arch/arm/mach-mx2/mach-vp6500.c b/target/linux/mx2/files/arch/arm/mach-mx2/mach-vp6500.c new file mode 100644 index 0000000000..20327743a9 --- /dev/null +++ b/target/linux/mx2/files/arch/arm/mach-mx2/mach-vp6500.c @@ -0,0 +1,128 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "devices.h" + +#include +#include + +static unsigned int vp6500_pins[] = { + + /* UART1 */ + PE12_PF_UART1_TXD, + PE13_PF_UART1_RXD, + +#if 0 + /* LCDC */ + PA5_PF_LSCLK, + PA6_PF_LD0, + PA7_PF_LD1, + PA8_PF_LD2, + PA9_PF_LD3, + PA10_PF_LD4, + PA11_PF_LD5, + PA12_PF_LD6, + PA13_PF_LD7, + PA14_PF_LD8, + PA15_PF_LD9, + PA16_PF_LD10, + PA17_PF_LD11, + PA18_PF_LD12, + PA19_PF_LD13, + PA20_PF_LD14, + PA21_PF_LD15, + PA22_PF_LD16, + PA28_PF_HSYNC, + PA29_PF_VSYNC, + PA30_PF_CONTRAST, + PA31_PF_OE_ACD, +#endif +}; + +static struct physmap_flash_data vp6500_flash_data = { + .width = 2, +}; + +static struct resource vp6500_flash_resource = { + .start = MX21_CS0_BASE_ADDR, + .end = MX21_CS0_BASE_ADDR + SZ_64M - 1, + .flags = IORESOURCE_MEM, +}; + +static struct platform_device vp6500_nor_mtd_device = { + .name = "physmap-flash", + .id = -1, + .dev = { + .platform_data = &vp6500_flash_data, + }, + .num_resources = 1, + .resource = &vp6500_flash_resource, +}; + +static struct gpio_led vp6500_leds[] = { + { + .name = "vp6500:orange:keypad", + .gpio = VP6500_GPIO_KEYPAD_LEDS, + }, +}; + +static struct gpio_led_platform_data vp6500_leds_data = { + .leds = vp6500_leds, + .num_leds = ARRAY_SIZE(vp6500_leds), +}; + +static struct platform_device vp6500_leds_device = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &vp6500_leds_data, + }, +}; + +static struct platform_device *platform_devices[] __initdata = { + &vp6500_nor_mtd_device, + &vp6500_leds_device, +}; + +static void __init vp6500_board_init(void) +{ + mxc_gpio_setup_multiple_pins(vp6500_pins, ARRAY_SIZE(vp6500_pins), + "vp6500"); + + mxc_register_device(&mxc_uart_device0, NULL); + + platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); +} + +static void __init vp6500_timer_init(void) +{ + mx21_clocks_init(32768, 26000000); +} + +static struct sys_timer vp6500_timer = { + .init = vp6500_timer_init, +}; + +MACHINE_START(VP6500, "Phillips VP6500") + .phys_io = MX21_AIPI_BASE_ADDR, + .io_pg_offst = ((MX21_AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc, + .boot_params = MX21_PHYS_OFFSET + 0x100, + .map_io = mx21_map_io, + .init_irq = mx21_init_irq, + .init_machine = vp6500_board_init, + .timer = &vp6500_timer, +MACHINE_END diff --git a/target/linux/mx2/files/arch/arm/plat-mxc/include/mach/board-vp6500.h b/target/linux/mx2/files/arch/arm/plat-mxc/include/mach/board-vp6500.h new file mode 100644 index 0000000000..6c351f0380 --- /dev/null +++ b/target/linux/mx2/files/arch/arm/plat-mxc/include/mach/board-vp6500.h @@ -0,0 +1,9 @@ + +#ifndef __BOARD_VP6500__ +#define __BOARD_VP6500__ + +#define VP6500_GPIO_CAMERA_DIRECTION 45 +#define VP6500_GPIO_KEYPAD_LEDS 82 +#define VP6500_GPIO_AMP_ENABLE 89 + +#endif diff --git a/target/linux/mx2/image/Makefile b/target/linux/mx2/image/Makefile new file mode 100644 index 0000000000..12fbe4ee4f --- /dev/null +++ b/target/linux/mx2/image/Makefile @@ -0,0 +1,22 @@ +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +JFFS2_BLOCKSIZE=128k 16k +#JFFS2OPTS += -n -s 2048 +JFFS2OPTS += -n + +define Image/BuildKernel + mkdir -p $(BIN_DIR) + cp $(KDIR)/vmlinuz $(BIN_DIR)/openwrt-$(BOARD)-zImage +endef + +define Image/Prepare + cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/vmlinuz +endef + + +define Image/Build/squashfs + $(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-root.$(1)) +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/mx2/patches-2.6.34/010-mach-vp6500.patch b/target/linux/mx2/patches-2.6.34/010-mach-vp6500.patch new file mode 100644 index 0000000000..42d0e1e3f1 --- /dev/null +++ b/target/linux/mx2/patches-2.6.34/010-mach-vp6500.patch @@ -0,0 +1,22 @@ +--- a/arch/arm/mach-mx2/Kconfig 2010-04-10 13:56:17.000000000 +0200 ++++ b/arch/arm/mach-mx2/Kconfig 2010-04-10 13:42:38.000000000 +0200 +@@ -27,6 +27,12 @@ + Include support for MX21ADS platform. This includes specific + configurations for the board and its peripherals. + ++config MACH_VP6500 ++ bool "Phillips VP6500 VoIP phone" ++ depends on MACH_MX21 ++ help ++ Include support for the Phillips VP6500 VoIP phone. ++ + config MACH_MX27ADS + bool "MX27ADS platform" + depends on MACH_MX27 +--- a/arch/arm/mach-mx2/Makefile 2010-04-10 13:56:17.000000000 +0200 ++++ b/arch/arm/mach-mx2/Makefile 2010-04-10 13:49:32.000000000 +0200 +@@ -21,3 +21,4 @@ + obj-$(CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD) += eukrea_mbimx27-baseboard.o + obj-$(CONFIG_MACH_PCA100) += mach-pca100.o + obj-$(CONFIG_MACH_MXT_TD60) += mach-mxt_td60.o ++obj-$(CONFIG_MACH_VP6500) += mach-vp6500.o diff --git a/target/linux/mx2/patches-2.6.34/011-mach-type.patch b/target/linux/mx2/patches-2.6.34/011-mach-type.patch new file mode 100644 index 0000000000..39075f5e2b --- /dev/null +++ b/target/linux/mx2/patches-2.6.34/011-mach-type.patch @@ -0,0 +1,11 @@ +--- a/arch/arm/tools/mach-types 2010-04-10 13:56:20.000000000 +0200 ++++ b/arch/arm/tools/mach-types 2010-04-10 15:24:46.000000000 +0200 +@@ -530,7 +530,7 @@ + dp1000 MACH_DP1000 DP1000 514 + omap_osk MACH_OMAP_OSK OMAP_OSK 515 + rg100v3 MACH_RG100V3 RG100V3 516 +-mx2ads MACH_MX2ADS MX2ADS 517 ++vp6500 MACH_VP6500 VP6500 517 + pxa_kilo MACH_PXA_KILO PXA_KILO 518 + ixp4xx_eagle MACH_IXP4XX_EAGLE IXP4XX_EAGLE 519 + tosa MACH_TOSA TOSA 520 diff --git a/target/linux/mx2/patches-2.6.34/020-fix-usb-ioresource.patch b/target/linux/mx2/patches-2.6.34/020-fix-usb-ioresource.patch new file mode 100644 index 0000000000..dae59b15d7 --- /dev/null +++ b/target/linux/mx2/patches-2.6.34/020-fix-usb-ioresource.patch @@ -0,0 +1,22 @@ +--- a/arch/arm/mach-mx2/devices.c 2010-04-10 13:56:17.000000000 +0200 ++++ b/arch/arm/mach-mx2/devices.c 2010-04-10 15:15:17.000000000 +0200 +@@ -304,7 +304,7 @@ + #ifdef CONFIG_MACH_MX27 + static struct resource otg_resources[] = { + { +- .start = MX27_USBOTG_BASE_ADDR, ++ .start = MX27_usbotg_BASE_ADDR, + .end = MX27_USBOTG_BASE_ADDR + 0x1ff, + .flags = IORESOURCE_MEM, + }, { +@@ -483,8 +483,8 @@ + #ifdef CONFIG_MACH_MX21 + static struct resource mx21_usbhc_resources[] = { + { +- .start = MX21_BASE_ADDR, +- .end = MX21_BASE_ADDR + 0x1FFF, ++ .start = MX21_USBOTG_BASE_ADDR, ++ .end = MX21_USBOTG_BASE_ADDR + 0x1FFF, + .flags = IORESOURCE_MEM, + }, + { -- 2.30.2