From 539e0b5b8418cac13b7f0b68254ebc2f8e1b40f7 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 4 Feb 2013 15:23:07 +0000 Subject: [PATCH] imx21: R.I.P. It is broken since ~22 months and nobody takes care of that. Signed-off-by: Gabor Juhos SVN-Revision: 35487 --- target/linux/imx21/Makefile | 24 -- target/linux/imx21/config-default | 132 --------- .../files/arch/arm/mach-mx2/mach-vp6500.c | 255 ------------------ .../arm/plat-mxc/include/mach/board-vp6500.h | 17 -- target/linux/imx21/image/Makefile | 28 -- .../linux/imx21/patches/010-mach-vp6500.patch | 22 -- .../linux/imx21/patches/011-mach-type.patch | 11 - target/linux/imx21/patches/040-pwm.patch | 137 ---------- 8 files changed, 626 deletions(-) delete mode 100644 target/linux/imx21/Makefile delete mode 100644 target/linux/imx21/config-default delete mode 100644 target/linux/imx21/files/arch/arm/mach-mx2/mach-vp6500.c delete mode 100644 target/linux/imx21/files/arch/arm/plat-mxc/include/mach/board-vp6500.h delete mode 100644 target/linux/imx21/image/Makefile delete mode 100644 target/linux/imx21/patches/010-mach-vp6500.patch delete mode 100644 target/linux/imx21/patches/011-mach-type.patch delete mode 100644 target/linux/imx21/patches/040-pwm.patch diff --git a/target/linux/imx21/Makefile b/target/linux/imx21/Makefile deleted file mode 100644 index 0ca5c8a750..0000000000 --- a/target/linux/imx21/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (C) 2006-2011 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:=imx21 -BOARDNAME:=Freescale i.MX21 -FEATURES:=jffs2 broken -CFLAGS:=-Os -pipe -march=armv5te -mtune=arm926ej-s -fno-caller-saves - -LINUX_VERSION:=2.6.37.6 - -DEVICE_TYPE=phone - -define Target/Description -endef - -include $(INCLUDE_DIR)/target.mk - -$(eval $(call BuildTarget)) diff --git a/target/linux/imx21/config-default b/target/linux/imx21/config-default deleted file mode 100644 index 068f1552c9..0000000000 --- a/target/linux/imx21/config-default +++ /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_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_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_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_XZ_DEC_ARM=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/imx21/files/arch/arm/mach-mx2/mach-vp6500.c b/target/linux/imx21/files/arch/arm/mach-mx2/mach-vp6500.c deleted file mode 100644 index fb4464eb8e..0000000000 --- a/target/linux/imx21/files/arch/arm/mach-mx2/mach-vp6500.c +++ /dev/null @@ -1,255 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "devices.h" - -#include -#include -#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 - - /* LCD Backlight */ - PE5_PF_PWMO, - VP6500_GPIO_BACKLIGHT_EN | GPIO_GPIO | GPIO_OUT, -}; - -/* Flash */ - -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, -}; - -/* LEDs */ - -static struct gpio_led vp6500_leds[] = { - { - .name = "vp6500:orange:keypad", - .gpio = VP6500_GPIO_LED_KEYPAD, - }, - { - .name = "vp6500:green:", - .gpio = VP6500_GPIO_LED_GREEN, - .active_low = 1, - .default_state = LEDS_GPIO_DEFSTATE_ON, - }, - { - .name = "vp6500:red:", - .gpio = VP6500_GPIO_LED_RED, - }, - { - .name = "vp6500:red:camera", - .gpio = VP6500_GPIO_LED_CAMERA, - }, -}; - -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, - }, -}; - -/* Keypad */ - -static const uint32_t vp6500_keypad_keys[] = { - KEY(0, 3, KEY_F2), - KEY(0, 4, KEY_RIGHT), - KEY(1, 0, KEY_ZOOM), - KEY(1, 1, KEY_NUMERIC_POUND), - KEY(1, 2, KEY_0), - KEY(1, 3, KEY_ENTER), - KEY(1, 4, KEY_8), - KEY(2, 0, KEY_5), - KEY(2, 1, KEY_2), - KEY(2, 2, KEY_DOWN), - KEY(2, 3, KEY_OK), - KEY(2, 4, KEY_UP), - KEY(3, 0, KEY_CAMERA), - KEY(3, 1, KEY_NUMERIC_STAR), - KEY(3, 2, KEY_9), - KEY(3, 3, KEY_LEFT), - KEY(3, 4, KEY_6), - KEY(4, 0, KEY_7), - KEY(4, 1, KEY_4), - KEY(4, 2, KEY_1), - KEY(4, 3, KEY_3), - KEY(4, 4, KEY_F1), -}; - -static struct matrix_keymap_data vp6500_keypad_data = { - .keymap = vp6500_keypad_keys, - .keymap_size = ARRAY_SIZE(vp6500_keypad_keys), -}; - -static struct resource vp6500_keypad_resources[] = { - { - .start = MX21_KPP_BASE_ADDR, - .end = MX21_KPP_BASE_ADDR + 0x10 - 1, - .flags = IORESOURCE_MEM, - }, - { - .start = MX21_INT_KPP, - .flags = IORESOURCE_IRQ, - } -}; - -static struct platform_device vp6500_keypad_device = { - .name = "imx-keypad", - .id = 0, - .dev = { - .platform_data = &vp6500_keypad_data, - }, - .resource = vp6500_keypad_resources, - .num_resources = ARRAY_SIZE(vp6500_keypad_resources), -}; - -static struct gpio_keys_button vp6500_keys = { - .gpio = VP6500_GPIO_POWER_KEY, - .code = KEY_POWER, - .desc = "Power button", - .active_low = 1, -}; - -static struct gpio_keys_platform_data vp6500_key_data = { - .buttons = &vp6500_keys, - .nbuttons = 1, -}; - -static struct platform_device vp6500_key_device = { - .name = "gpio-keys", - .id = -1, - .dev = { - .platform_data = &vp6500_key_data, - }, -}; - -/* LCD backlight */ - -static int vp6500_backlight_notify(struct device *dev, int brightness) -{ - gpio_set_value(VP6500_GPIO_BACKLIGHT_EN, !!brightness); - - return brightness; -} - -static struct platform_pwm_backlight_data vp6500_backlight_data = { - .max_brightness = 255, - .dft_brightness = 100, - .pwm_period_ns = 15000000, - .notify = vp6500_backlight_notify, -}; - -static struct platform_device vp6500_backlight_device = { - .name = "pwm-backlight", - .id = -1, - .dev = { - .parent = &mxc_pwm_device.dev, - .platform_data = &vp6500_backlight_data, - }, -}; - - -static struct platform_device *platform_devices[] __initdata = { - &vp6500_nor_mtd_device, - &vp6500_leds_device, - &vp6500_keypad_device, - &vp6500_key_device, - &vp6500_backlight_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); - mxc_register_device(&mxc_pwm_device, 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/imx21/files/arch/arm/plat-mxc/include/mach/board-vp6500.h b/target/linux/imx21/files/arch/arm/plat-mxc/include/mach/board-vp6500.h deleted file mode 100644 index c11d053a5c..0000000000 --- a/target/linux/imx21/files/arch/arm/plat-mxc/include/mach/board-vp6500.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef __BOARD_VP6500__ -#define __BOARD_VP6500__ - -#define VP6500_GPIO_POWER_KEY GPIO_PORTB | 5 -#define VP6500_GPIO_CAMERA_DIRECTION GPIO_PORTB | 13 -#define VP6500_GPIO_LED_KEYPAD GPIO_PORTC | 18 -#define VP6500_GPIO_AMP_ENABLE GPIO_PORTC | 25 -#define VP6500_GPIO_LED_RED GPIO_PORTC | 27 -#define VP6500_GPIO_LED_GREEN GPIO_PORTC | 28 -#define VP6500_GPIO_LED_CAMERA GPIO_PORTC | 29 -#define VP6500_GPIO_BACKLIGHT_EN GPIO_PORTE | 10 - -#define VP6500_GPIO_TLV_RESET GPIO_PORTB | 27 -#define VP6500_GPIO_TLV_ENABLE GPIO_PORTC | 25 - -#endif diff --git a/target/linux/imx21/image/Makefile b/target/linux/imx21/image/Makefile deleted file mode 100644 index 70636ae4d6..0000000000 --- a/target/linux/imx21/image/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (C) 2010 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# -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)/$(IMG_PREFIX)-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)/$(IMG_PREFIX)-root.$(1)) -endef - -$(eval $(call BuildImage)) diff --git a/target/linux/imx21/patches/010-mach-vp6500.patch b/target/linux/imx21/patches/010-mach-vp6500.patch deleted file mode 100644 index 37bfa676f9..0000000000 --- a/target/linux/imx21/patches/010-mach-vp6500.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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 deleted file mode 100644 index 873f03083a..0000000000 --- a/target/linux/imx21/patches/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/040-pwm.patch b/target/linux/imx21/patches/040-pwm.patch deleted file mode 100644 index af47ad1de0..0000000000 --- a/target/linux/imx21/patches/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); -- 2.25.1