From a800f11e6c85012896fe6573cef6175ff6016313 Mon Sep 17 00:00:00 2001 From: kaloz Date: Fri, 18 Mar 2011 13:02:12 +0000 Subject: [imx21]: upgrade to 2.6.37, mark it broken git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26222 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/imx21/Makefile | 6 +- target/linux/imx21/config-2.6.34 | 132 -------------------- target/linux/imx21/config-default | 133 ++++++++++++++++++++ .../imx21/patches-2.6.34/010-mach-vp6500.patch | 22 ---- .../linux/imx21/patches-2.6.34/011-mach-type.patch | 11 -- target/linux/imx21/patches-2.6.34/040-pwm.patch | 137 --------------------- target/linux/imx21/patches/010-mach-vp6500.patch | 22 ++++ target/linux/imx21/patches/011-mach-type.patch | 11 ++ target/linux/imx21/patches/040-pwm.patch | 137 +++++++++++++++++++++ 9 files changed, 306 insertions(+), 305 deletions(-) delete mode 100644 target/linux/imx21/config-2.6.34 create mode 100644 target/linux/imx21/config-default delete mode 100644 target/linux/imx21/patches-2.6.34/010-mach-vp6500.patch delete mode 100644 target/linux/imx21/patches-2.6.34/011-mach-type.patch delete mode 100644 target/linux/imx21/patches-2.6.34/040-pwm.patch create mode 100644 target/linux/imx21/patches/010-mach-vp6500.patch create mode 100644 target/linux/imx21/patches/011-mach-type.patch create mode 100644 target/linux/imx21/patches/040-pwm.patch (limited to 'target') diff --git a/target/linux/imx21/Makefile b/target/linux/imx21/Makefile index 76b51ab8f..982719edd 100644 --- a/target/linux/imx21/Makefile +++ b/target/linux/imx21/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2009 OpenWrt.org +# Copyright (C) 2006-2011 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=imx21 BOARDNAME:=Freescale i.MX21 -FEATURES:=jffs2 +FEATURES:=jffs2 broken CFLAGS:=-Os -pipe -march=armv5te -mtune=arm926ej-s -funit-at-a-time -LINUX_VERSION:=2.6.34.8 +LINUX_VERSION:=2.6.37.3 DEVICE_TYPE=phone diff --git a/target/linux/imx21/config-2.6.34 b/target/linux/imx21/config-2.6.34 deleted file mode 100644 index 829c672d1..000000000 --- a/target/linux/imx21/config-2.6.34 +++ /dev/null @@ -1,132 +0,0 @@ -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_REQUIRE_GPIOLIB=y -# CONFIG_ARCH_SELECT_MEMORY_MODEL 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_BSD_PROCESS_ACCT 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_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -# 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_GPIO_SYSFS=y -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_LZMA=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_INPUT=y -CONFIG_INPUT_EVDEV=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_KEYBOARD_ATKBD=y -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_IMX=y -# 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_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_MXC_IRQ_PRIOR is not set -# CONFIG_MXC_PWM is not set -CONFIG_NEED_DMA_MAP_STATE=y -# CONFIG_NETDEV_1000 is not set -# CONFIG_NET_ETHERNET is not set -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_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/imx21/config-default b/target/linux/imx21/config-default new file mode 100644 index 000000000..67a656734 --- /dev/null +++ b/target/linux/imx21/config-default @@ -0,0 +1,133 @@ +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_REQUIRE_GPIOLIB=y +# CONFIG_ARCH_SELECT_MEMORY_MODEL 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_BSD_PROCESS_ACCT 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_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# 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_GPIO_SYSFS=y +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_LZMA=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_INPUT=y +CONFIG_INPUT_EVDEV=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_KEYBOARD_ATKBD=y +CONFIG_KEYBOARD_GPIO=y +CONFIG_KEYBOARD_IMX=y +# 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_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_MXC_DEBUG_BOARD is not set +# CONFIG_MXC_IRQ_PRIOR is not set +# CONFIG_MXC_PWM is not set +CONFIG_NEED_DMA_MAP_STATE=y +# CONFIG_NETDEV_1000 is not set +# CONFIG_NET_ETHERNET is not set +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_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/imx21/patches-2.6.34/010-mach-vp6500.patch b/target/linux/imx21/patches-2.6.34/010-mach-vp6500.patch deleted file mode 100644 index 8d1832b56..000000000 --- a/target/linux/imx21/patches-2.6.34/010-mach-vp6500.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/arch/arm/mach-mx2/Kconfig -+++ b/arch/arm/mach-mx2/Kconfig -@@ -27,6 +27,12 @@ config MACH_MX21ADS - 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 -+++ b/arch/arm/mach-mx2/Makefile -@@ -21,3 +21,4 @@ obj-$(CONFIG_MACH_CPUIMX27) += mach-cpui - 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/imx21/patches-2.6.34/011-mach-type.patch b/target/linux/imx21/patches-2.6.34/011-mach-type.patch deleted file mode 100644 index 873f03083..000000000 --- a/target/linux/imx21/patches-2.6.34/011-mach-type.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/arch/arm/tools/mach-types -+++ b/arch/arm/tools/mach-types -@@ -530,7 +530,7 @@ sg560 MACH_SG560 SG560 513 - 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/imx21/patches-2.6.34/040-pwm.patch b/target/linux/imx21/patches-2.6.34/040-pwm.patch deleted file mode 100644 index af47ad1de..000000000 --- a/target/linux/imx21/patches-2.6.34/040-pwm.patch +++ /dev/null @@ -1,137 +0,0 @@ ---- a/arch/arm/plat-mxc/pwm.c -+++ b/arch/arm/plat-mxc/pwm.c -@@ -25,6 +25,11 @@ - #define MX1_PWMS 0x04 /* PWM Sample Register */ - #define MX1_PWMP 0x08 /* PWM Period Register */ - -+#define MX1_PWMC_EN (1 << 4) -+#define MX1_PWMC_PRESCALER_MASK (0x7f << 8) -+#define MX1_PWMC_PRESCALER(x) ((x & 0x7f) << 8) -+#define MX1_PWMC_CLKSEL_MASK 0x3 -+#define MX1_PWMC_CLKSEL(x) ((x & 0x3)) - - /* i.MX27, i.MX31, i.MX35 share the same PWM function block: */ - -@@ -54,26 +59,33 @@ struct pwm_device { - - int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) - { -+ unsigned long long c; -+ unsigned long period_cycles, duty_cycles, prescale; -+ - if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) - return -EINVAL; - -+ c = clk_get_rate(pwm->clk); -+ -+ c = c * period_ns; -+ -+ if (cpu_is_mx1() || cpu_is_mx2()) -+ c >>= 1; -+ -+ do_div(c, 1000000000); -+ period_cycles = c; -+ -+ prescale = period_cycles / 0x10000 + 1; -+ -+ period_cycles /= prescale; -+ c = (unsigned long long)period_cycles * duty_ns; -+ do_div(c, period_ns); -+ duty_cycles = c; -+ -+ - if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { -- unsigned long long c; -- unsigned long period_cycles, duty_cycles, prescale; - u32 cr; - -- c = clk_get_rate(pwm->clk); -- c = c * period_ns; -- do_div(c, 1000000000); -- period_cycles = c; -- -- prescale = period_cycles / 0x10000 + 1; -- -- period_cycles /= prescale; -- c = (unsigned long long)period_cycles * duty_ns; -- do_div(c, period_ns); -- duty_cycles = c; -- - writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR); - writel(period_cycles, pwm->mmio_base + MX3_PWMPR); - -@@ -86,25 +98,28 @@ int pwm_config(struct pwm_device *pwm, i - - writel(cr, pwm->mmio_base + MX3_PWMCR); - } else if (cpu_is_mx1() || cpu_is_mx21()) { -- /* The PWM subsystem allows for exact frequencies. However, -- * I cannot connect a scope on my device to the PWM line and -- * thus cannot provide the program the PWM controller -- * exactly. Instead, I'm relying on the fact that the -- * Bootloader (u-boot or WinCE+haret) has programmed the PWM -- * function group already. So I'll just modify the PWM sample -- * register to follow the ratio of duty_ns vs. period_ns -- * accordingly. -- * -- * This is good enough for programming the brightness of -- * the LCD backlight. -- * -- * The real implementation would divide PERCLK[0] first by -- * both the prescaler (/1 .. /128) and then by CLKSEL -- * (/2 .. /16). -- */ -- u32 max = readl(pwm->mmio_base + MX1_PWMP); -- u32 p = max * duty_ns / period_ns; -- writel(max - p, pwm->mmio_base + MX1_PWMS); -+ unsigned long clksel = 0; -+ u32 ctrl; -+ -+ while (prescale >= 0x80 && clksel < 4) { -+ prescale >>= 1; -+ ++clksel; -+ } -+ -+ if (clksel > 3) -+ return -EINVAL; -+ -+ ctrl = readl(pwm->mmio_base + MX1_PWMC); -+ writel(ctrl & ~MX1_PWMC_EN, pwm->mmio_base + MX1_PWMC); -+ -+ writel(duty_cycles, pwm->mmio_base + MX1_PWMS); -+ writel(period_cycles, pwm->mmio_base + MX1_PWMP); -+ -+ ctrl &= ~(MX1_PWMC_PRESCALER_MASK | MX1_PWMC_CLKSEL_MASK); -+ ctrl |= MX1_PWMC_PRESCALER(prescale); -+ ctrl |= MX1_PWMC_CLKSEL(clksel); -+ writel(ctrl, pwm->mmio_base + MX1_PWMC); -+ - } else { - BUG(); - } -@@ -116,6 +131,11 @@ EXPORT_SYMBOL(pwm_config); - int pwm_enable(struct pwm_device *pwm) - { - int rc = 0; -+ if (cpu_is_mx1() || cpu_is_mx2()) { -+ u32 ctrl; -+ ctrl = readl(pwm->mmio_base + MX1_PWMC); -+ writel(ctrl | MX1_PWMC_EN, pwm->mmio_base + MX1_PWMC); -+ } - - if (!pwm->clk_enabled) { - rc = clk_enable(pwm->clk); -@@ -128,7 +148,13 @@ EXPORT_SYMBOL(pwm_enable); - - void pwm_disable(struct pwm_device *pwm) - { -- writel(0, pwm->mmio_base + MX3_PWMCR); -+ if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { -+ writel(0, pwm->mmio_base + MX3_PWMCR); -+ } else if (cpu_is_mx1() || cpu_is_mx2()) { -+ u32 ctrl; -+ ctrl = readl(pwm->mmio_base + MX1_PWMC); -+ writel(ctrl & ~MX1_PWMC_EN, pwm->mmio_base + MX1_PWMC); -+ } - - if (pwm->clk_enabled) { - clk_disable(pwm->clk); diff --git a/target/linux/imx21/patches/010-mach-vp6500.patch b/target/linux/imx21/patches/010-mach-vp6500.patch new file mode 100644 index 000000000..37bfa676f --- /dev/null +++ b/target/linux/imx21/patches/010-mach-vp6500.patch @@ -0,0 +1,22 @@ +--- a/arch/arm/mach-imx/Kconfig ++++ b/arch/arm/mach-imx/Kconfig +@@ -83,6 +83,12 @@ if MACH_MX27 + + comment "MX27 platforms:" + ++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" + select IMX_HAVE_PLATFORM_IMX_I2C +--- a/arch/arm/mach-imx/Makefile ++++ b/arch/arm/mach-imx/Makefile +@@ -32,3 +32,4 @@ obj-$(CONFIG_MACH_CPUIMX27) += mach-cpui + 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/imx21/patches/011-mach-type.patch b/target/linux/imx21/patches/011-mach-type.patch new file mode 100644 index 000000000..873f03083 --- /dev/null +++ b/target/linux/imx21/patches/011-mach-type.patch @@ -0,0 +1,11 @@ +--- a/arch/arm/tools/mach-types ++++ b/arch/arm/tools/mach-types +@@ -530,7 +530,7 @@ sg560 MACH_SG560 SG560 513 + 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/imx21/patches/040-pwm.patch b/target/linux/imx21/patches/040-pwm.patch new file mode 100644 index 000000000..af47ad1de --- /dev/null +++ b/target/linux/imx21/patches/040-pwm.patch @@ -0,0 +1,137 @@ +--- a/arch/arm/plat-mxc/pwm.c ++++ b/arch/arm/plat-mxc/pwm.c +@@ -25,6 +25,11 @@ + #define MX1_PWMS 0x04 /* PWM Sample Register */ + #define MX1_PWMP 0x08 /* PWM Period Register */ + ++#define MX1_PWMC_EN (1 << 4) ++#define MX1_PWMC_PRESCALER_MASK (0x7f << 8) ++#define MX1_PWMC_PRESCALER(x) ((x & 0x7f) << 8) ++#define MX1_PWMC_CLKSEL_MASK 0x3 ++#define MX1_PWMC_CLKSEL(x) ((x & 0x3)) + + /* i.MX27, i.MX31, i.MX35 share the same PWM function block: */ + +@@ -54,26 +59,33 @@ struct pwm_device { + + int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) + { ++ unsigned long long c; ++ unsigned long period_cycles, duty_cycles, prescale; ++ + if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) + return -EINVAL; + ++ c = clk_get_rate(pwm->clk); ++ ++ c = c * period_ns; ++ ++ if (cpu_is_mx1() || cpu_is_mx2()) ++ c >>= 1; ++ ++ do_div(c, 1000000000); ++ period_cycles = c; ++ ++ prescale = period_cycles / 0x10000 + 1; ++ ++ period_cycles /= prescale; ++ c = (unsigned long long)period_cycles * duty_ns; ++ do_div(c, period_ns); ++ duty_cycles = c; ++ ++ + if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { +- unsigned long long c; +- unsigned long period_cycles, duty_cycles, prescale; + u32 cr; + +- c = clk_get_rate(pwm->clk); +- c = c * period_ns; +- do_div(c, 1000000000); +- period_cycles = c; +- +- prescale = period_cycles / 0x10000 + 1; +- +- period_cycles /= prescale; +- c = (unsigned long long)period_cycles * duty_ns; +- do_div(c, period_ns); +- duty_cycles = c; +- + writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR); + writel(period_cycles, pwm->mmio_base + MX3_PWMPR); + +@@ -86,25 +98,28 @@ int pwm_config(struct pwm_device *pwm, i + + writel(cr, pwm->mmio_base + MX3_PWMCR); + } else if (cpu_is_mx1() || cpu_is_mx21()) { +- /* The PWM subsystem allows for exact frequencies. However, +- * I cannot connect a scope on my device to the PWM line and +- * thus cannot provide the program the PWM controller +- * exactly. Instead, I'm relying on the fact that the +- * Bootloader (u-boot or WinCE+haret) has programmed the PWM +- * function group already. So I'll just modify the PWM sample +- * register to follow the ratio of duty_ns vs. period_ns +- * accordingly. +- * +- * This is good enough for programming the brightness of +- * the LCD backlight. +- * +- * The real implementation would divide PERCLK[0] first by +- * both the prescaler (/1 .. /128) and then by CLKSEL +- * (/2 .. /16). +- */ +- u32 max = readl(pwm->mmio_base + MX1_PWMP); +- u32 p = max * duty_ns / period_ns; +- writel(max - p, pwm->mmio_base + MX1_PWMS); ++ unsigned long clksel = 0; ++ u32 ctrl; ++ ++ while (prescale >= 0x80 && clksel < 4) { ++ prescale >>= 1; ++ ++clksel; ++ } ++ ++ if (clksel > 3) ++ return -EINVAL; ++ ++ ctrl = readl(pwm->mmio_base + MX1_PWMC); ++ writel(ctrl & ~MX1_PWMC_EN, pwm->mmio_base + MX1_PWMC); ++ ++ writel(duty_cycles, pwm->mmio_base + MX1_PWMS); ++ writel(period_cycles, pwm->mmio_base + MX1_PWMP); ++ ++ ctrl &= ~(MX1_PWMC_PRESCALER_MASK | MX1_PWMC_CLKSEL_MASK); ++ ctrl |= MX1_PWMC_PRESCALER(prescale); ++ ctrl |= MX1_PWMC_CLKSEL(clksel); ++ writel(ctrl, pwm->mmio_base + MX1_PWMC); ++ + } else { + BUG(); + } +@@ -116,6 +131,11 @@ EXPORT_SYMBOL(pwm_config); + int pwm_enable(struct pwm_device *pwm) + { + int rc = 0; ++ if (cpu_is_mx1() || cpu_is_mx2()) { ++ u32 ctrl; ++ ctrl = readl(pwm->mmio_base + MX1_PWMC); ++ writel(ctrl | MX1_PWMC_EN, pwm->mmio_base + MX1_PWMC); ++ } + + if (!pwm->clk_enabled) { + rc = clk_enable(pwm->clk); +@@ -128,7 +148,13 @@ EXPORT_SYMBOL(pwm_enable); + + void pwm_disable(struct pwm_device *pwm) + { +- writel(0, pwm->mmio_base + MX3_PWMCR); ++ if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { ++ writel(0, pwm->mmio_base + MX3_PWMCR); ++ } else if (cpu_is_mx1() || cpu_is_mx2()) { ++ u32 ctrl; ++ ctrl = readl(pwm->mmio_base + MX1_PWMC); ++ writel(ctrl & ~MX1_PWMC_EN, pwm->mmio_base + MX1_PWMC); ++ } + + if (pwm->clk_enabled) { + clk_disable(pwm->clk); -- cgit v1.2.3