From 8ee8ef2996df477aa1623bd213b1548ab1b9c07c Mon Sep 17 00:00:00 2001 From: Bryan Wu Date: Wed, 14 Mar 2012 01:55:26 +0800 Subject: ARM: mach-clps711x: retire custom LED code of P720T machine Add tigger based LED driver into board file of P720T. Remove old LED driver file. Signed-off-by: Bryan Wu --- arch/arm/mach-clps711x/Makefile | 2 -- arch/arm/mach-clps711x/common.c | 1 - arch/arm/mach-clps711x/p720t-leds.c | 63 ------------------------------------- arch/arm/mach-clps711x/p720t.c | 61 +++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 66 deletions(-) delete mode 100644 arch/arm/mach-clps711x/p720t-leds.c (limited to 'arch/arm/mach-clps711x') diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile index f2f0256232e..5872b49bfae 100644 --- a/arch/arm/mach-clps711x/Makefile +++ b/arch/arm/mach-clps711x/Makefile @@ -16,5 +16,3 @@ obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o obj-$(CONFIG_ARCH_P720T) += p720t.o -leds-$(CONFIG_ARCH_P720T) += p720t-leds.o -obj-$(CONFIG_LEDS) += $(leds-y) diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c index c965fd8eb31..1e1ae48726f 100644 --- a/arch/arm/mach-clps711x/common.c +++ b/arch/arm/mach-clps711x/common.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/arm/mach-clps711x/p720t-leds.c b/arch/arm/mach-clps711x/p720t-leds.c deleted file mode 100644 index bbc449fbe14..00000000000 --- a/arch/arm/mach-clps711x/p720t-leds.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * linux/arch/arm/mach-clps711x/leds.c - * - * Integrator LED control routines - * - * Copyright (C) 2000 Deep Blue Solutions Ltd - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include -#include -#include - -#include -#include -#include - -static void p720t_leds_event(led_event_t ledevt) -{ - unsigned long flags; - u32 pddr; - - local_irq_save(flags); - switch(ledevt) { - case led_idle_start: - break; - - case led_idle_end: - break; - - case led_timer: - pddr = clps_readb(PDDR); - clps_writeb(pddr ^ 1, PDDR); - break; - - default: - break; - } - - local_irq_restore(flags); -} - -static int __init leds_init(void) -{ - if (machine_is_p720t()) - leds_event = p720t_leds_event; - - return 0; -} - -arch_initcall(leds_init); diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c index 42ee8f33eaf..09113a94114 100644 --- a/arch/arm/mach-clps711x/p720t.c +++ b/arch/arm/mach-clps711x/p720t.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include @@ -34,6 +36,8 @@ #include #include +#include + #include "common.h" /* @@ -121,3 +125,60 @@ static int p720t_hw_init(void) __initcall(p720t_hw_init); +/* + * LED controled by CPLD + */ +#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) +static void p720t_led_set(struct led_classdev *cdev, + enum led_brightness b) +{ + u8 reg = clps_readb(PDDR); + + if (b != LED_OFF) + reg |= 0x1; + else + reg &= ~0x1; + + clps_writeb(reg, PDDR); +} + +static enum led_brightness p720t_led_get(struct led_classdev *cdev) +{ + u8 reg = clps_readb(PDDR); + + return (reg & 0x1) ? LED_FULL : LED_OFF; +} + +static int __init p720t_leds_init(void) +{ + + struct led_classdev *cdev; + int ret; + + if (!machine_is_p720t()) + return -ENODEV; + + cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); + if (!cdev) + return -ENOMEM; + + cdev->name = "p720t:0"; + cdev->brightness_set = p720t_led_set; + cdev->brightness_get = p720t_led_get; + cdev->default_trigger = "heartbeat"; + + ret = led_classdev_register(NULL, cdev); + if (ret < 0) { + kfree(cdev); + return ret; + } + + return 0; +} + +/* + * Since we may have triggers on any subsystem, defer registration + * until after subsystem_init. + */ +fs_initcall(p720t_leds_init); +#endif -- cgit v1.2.3 From 61ae48c3cb6bcffd1c7e18164c3d103eb62f06aa Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Tue, 21 Aug 2012 20:59:35 +0400 Subject: ARM: clps711x: Added simple clock framework Modern CPUs from CLPS711X-line can operate at frequencies other than 73 MHz. This patch adds simple clock framework for handling all possible CPU rates. Signed-off-by: Alexander Shiyan --- arch/arm/mach-clps711x/common.c | 89 +++++++++++++++++++++++------ arch/arm/mach-clps711x/include/mach/timex.h | 23 +------- 2 files changed, 74 insertions(+), 38 deletions(-) (limited to 'arch/arm/mach-clps711x') diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c index f15293bd797..509243d89a3 100644 --- a/arch/arm/mach-clps711x/common.c +++ b/arch/arm/mach-clps711x/common.c @@ -19,24 +19,25 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include #include #include -#include #include -#include +#include +#include +#include #include -#include -#include -#include -#include -#include #include #include #include +#include + +static struct clk *clk_pll, *clk_bus, *clk_uart, *clk_timerl, *clk_timerh, + *clk_tint, *clk_spi; +static unsigned long latch; + /* * This maps the generic CLPS711x registers */ @@ -166,8 +167,8 @@ void __init clps711x_init_irq(void) static unsigned long clps711x_gettimeoffset(void) { unsigned long hwticks; - hwticks = LATCH - (clps_readl(TC2D) & 0xffff); /* since last underflow */ - return (hwticks * (tick_nsec / 1000)) / LATCH; + hwticks = latch - (clps_readl(TC2D) & 0xffff); + return (hwticks * (tick_nsec / 1000)) / latch; } /* @@ -185,15 +186,71 @@ static struct irqaction clps711x_timer_irq = { .handler = p720t_timer_interrupt, }; +static void add_fixed_clk(struct clk *clk, const char *name, int rate) +{ + clk = clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate); + clk_register_clkdev(clk, name, NULL); +} + static void __init clps711x_timer_init(void) { - unsigned int syscon; + int osc, ext, pll, cpu, bus, timl, timh, uart, spi; + u32 tmp; + + osc = 3686400; + ext = 13000000; + + tmp = clps_readl(PLLR) >> 24; + if (tmp) + pll = (osc * tmp) / 2; + else + pll = 73728000; /* Default value */ + + tmp = clps_readl(SYSFLG2); + if (tmp & SYSFLG2_CKMODE) { + cpu = ext; + bus = cpu; + spi = 135400; + } else { + cpu = pll; + if (cpu >= 36864000) + bus = cpu / 2; + else + bus = 36864000 / 2; + spi = cpu / 576; + } + + uart = bus / 10; + + if (tmp & SYSFLG2_CKMODE) { + tmp = clps_readl(SYSCON2); + if (tmp & SYSCON2_OSTB) + timh = ext / 26; + else + timh = 541440; + } else + timh = cpu / 144; + + timl = timh / 256; + + /* All clocks are fixed */ + add_fixed_clk(clk_pll, "pll", pll); + add_fixed_clk(clk_bus, "bus", bus); + add_fixed_clk(clk_uart, "uart", uart); + add_fixed_clk(clk_timerl, "timer_lf", timl); + add_fixed_clk(clk_timerh, "timer_hf", timh); + add_fixed_clk(clk_tint, "tint", 64); + add_fixed_clk(clk_spi, "spi", spi); + + pr_info("CPU frequency set at %i Hz.\n", cpu); + + latch = (timh + HZ / 2) / HZ; - syscon = clps_readl(SYSCON1); - syscon |= SYSCON1_TC2S | SYSCON1_TC2M; - clps_writel(syscon, SYSCON1); + tmp = clps_readl(SYSCON1); + tmp |= SYSCON1_TC2S | SYSCON1_TC2M; + clps_writel(tmp, SYSCON1); - clps_writel(LATCH-1, TC2D); /* 512kHz / 100Hz - 1 */ + clps_writel(latch - 1, TC2D); setup_irq(IRQ_TC2OI, &clps711x_timer_irq); } diff --git a/arch/arm/mach-clps711x/include/mach/timex.h b/arch/arm/mach-clps711x/include/mach/timex.h index ac8823ccff9..de6fd192d1c 100644 --- a/arch/arm/mach-clps711x/include/mach/timex.h +++ b/arch/arm/mach-clps711x/include/mach/timex.h @@ -1,23 +1,2 @@ -/* - * arch/arm/mach-clps711x/include/mach/timex.h - * - * Prospector 720T architecture timex specifications - * - * Copyright (C) 2000 Deep Blue Solutions Ltd. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - +/* Bogus value */ #define CLOCK_TICK_RATE 512000 -- cgit v1.2.3 From 7255f87a7169689be2d4722375744a1f932d4b28 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Tue, 21 Aug 2012 20:59:34 +0400 Subject: ARM: clps711x: Fix lowlevel debug-macro CTS signal can not be used for the port and tied to any logic state. In this case we have an infinite loop waiting for the signal. For fix this problem, checking CTS removed, waiting for the signal "busy" was postponed after the byte write to the port. Signed-off-by: Alexander Shiyan --- arch/arm/mach-clps711x/include/mach/debug-macro.S | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'arch/arm/mach-clps711x') diff --git a/arch/arm/mach-clps711x/include/mach/debug-macro.S b/arch/arm/mach-clps711x/include/mach/debug-macro.S index 118b3d93057..cb3684f8dae 100644 --- a/arch/arm/mach-clps711x/include/mach/debug-macro.S +++ b/arch/arm/mach-clps711x/include/mach/debug-macro.S @@ -28,17 +28,11 @@ .endm .macro waituart,rd,rx -1001: ldr \rd, [\rx, #0x0140] @ SYSFLGx - tst \rd, #1 << 11 @ UBUSYx - bne 1001b .endm .macro busyuart,rd,rx - tst \rx, #0x1000 @ UART2 does not have CTS here - bne 1002f 1001: ldr \rd, [\rx, #0x0140] @ SYSFLGx - tst \rd, #1 << 8 @ CTS + tst \rd, #1 << 11 @ UBUSYx bne 1001b -1002: .endm -- cgit v1.2.3 From afc49177b412dfe547c60740ac1f1db7f805da43 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Tue, 21 Aug 2012 20:59:33 +0400 Subject: ARM: clps711x: Fix register definitions This patch contain some fixes: - Fixes the address of register PORTE. - Corrects name for DAIDR0 register. - Removes unused definition for SYNCIO_CFGLEN. - Fixes definition SYNCIO_FRMLEN. Signed-off-by: Alexander Shiyan --- arch/arm/mach-clps711x/include/mach/clps711x.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'arch/arm/mach-clps711x') diff --git a/arch/arm/mach-clps711x/include/mach/clps711x.h b/arch/arm/mach-clps711x/include/mach/clps711x.h index 1dd806f2847..c82e21ca49c 100644 --- a/arch/arm/mach-clps711x/include/mach/clps711x.h +++ b/arch/arm/mach-clps711x/include/mach/clps711x.h @@ -31,8 +31,8 @@ #define PBDDR (0x0041) #define PCDDR (0x0042) #define PDDDR (0x0043) -#define PEDR (0x0080) -#define PEDDR (0x00c0) +#define PEDR (0x0083) +#define PEDDR (0x00c3) #define SYSCON1 (0x0100) #define SYSFLG1 (0x0140) #define MEMCFG1 (0x0180) @@ -77,7 +77,7 @@ #define KBDEOI (0x1700) #define DAIR (0x2000) -#define DAIR0 (0x2040) +#define DAIDR0 (0x2040) #define DAIDR1 (0x2080) #define DAIDR2 (0x20c0) #define DAISR (0x2100) @@ -191,8 +191,7 @@ #define UBRLCR_WRDLEN8 (3 << 17) #define UBRLCR_WRDLEN_MASK (3 << 17) -#define SYNCIO_FRMLEN(x) (((x) & 0x3f) << 7) -#define SYNCIO_CFGLEN(x) ((x) & 0x7f) +#define SYNCIO_FRMLEN(x) (((x) & 0x1f) << 8) #define SYNCIO_SMCKEN (1 << 13) #define SYNCIO_TXFRMEN (1 << 14) -- cgit v1.2.3 From 1c3a918f78b72fb60fcc9ca9a4cebc90de570e58 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Tue, 21 Aug 2012 20:59:32 +0400 Subject: ARM: clps711x: Remove board support for CEIVA The current kernel does not fit in the CEIVA ROM. Also, some functional has already been removed due migrate from 2.6 to 3.0, and it seems that no one uses this platform. So, remove support for this board and modules specific only to this board. Signed-off-by: Alexander Shiyan --- arch/arm/mach-clps711x/Kconfig | 6 --- arch/arm/mach-clps711x/Makefile | 1 - arch/arm/mach-clps711x/ceiva.c | 64 -------------------------- arch/arm/mach-clps711x/include/mach/hardware.h | 48 ------------------- 4 files changed, 119 deletions(-) delete mode 100644 arch/arm/mach-clps711x/ceiva.c (limited to 'arch/arm/mach-clps711x') diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig index ea036d62158..e6135363765 100644 --- a/arch/arm/mach-clps711x/Kconfig +++ b/arch/arm/mach-clps711x/Kconfig @@ -16,12 +16,6 @@ config ARCH_CDB89712 The board includes 2 serial ports, Ethernet, IRDA, and expansion headers. It comes with 16 MB SDRAM and 8 MB flash ROM. -config ARCH_CEIVA - bool "CEIVA" - help - Say Y here if you intend to run this kernel on the Ceiva/Polaroid - PhotoMax Digital Picture Frame. - config ARCH_CLEP7312 bool "CLEP7312" help diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile index f2f0256232e..aed9eb66449 100644 --- a/arch/arm/mach-clps711x/Makefile +++ b/arch/arm/mach-clps711x/Makefile @@ -9,7 +9,6 @@ obj-m := obj-n := obj- := -obj-$(CONFIG_ARCH_CEIVA) += ceiva.o obj-$(CONFIG_ARCH_AUTCPU12) += autcpu12.o obj-$(CONFIG_ARCH_CDB89712) += cdb89712.o obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o diff --git a/arch/arm/mach-clps711x/ceiva.c b/arch/arm/mach-clps711x/ceiva.c deleted file mode 100644 index a70147e347a..00000000000 --- a/arch/arm/mach-clps711x/ceiva.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * linux/arch/arm/mach-clps711x/arch-ceiva.c - * - * Copyright (C) 2002, Rob Scott - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include - -#include "common.h" - -static struct map_desc ceiva_io_desc[] __initdata = { - /* SED1355 controlled video RAM & registers */ - { - .virtual = CEIVA_VIRT_SED1355, - .pfn = __phys_to_pfn(CEIVA_PHYS_SED1355), - .length = SZ_2M, - .type = MT_DEVICE - } -}; - - -static void __init ceiva_map_io(void) -{ - clps711x_map_io(); - iotable_init(ceiva_io_desc, ARRAY_SIZE(ceiva_io_desc)); -} - - -MACHINE_START(CEIVA, "CEIVA/Polaroid Photo MAX Digital Picture Frame") - /* Maintainer: Rob Scott */ - .atag_offset = 0x100, - .map_io = ceiva_map_io, - .init_irq = clps711x_init_irq, - .timer = &clps711x_timer, - .restart = clps711x_restart, -MACHINE_END diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h index 13a64fcd7dd..8497775d6ee 100644 --- a/arch/arm/mach-clps711x/include/mach/hardware.h +++ b/arch/arm/mach-clps711x/include/mach/hardware.h @@ -116,7 +116,6 @@ #endif /* CONFIG_ARCH_EDB7211 */ - /* * Relevant bits in port D, which controls power to the various parts of * the LCD on the EDB7211. @@ -125,51 +124,4 @@ #define EDB_PD2_LCDEN (1<<2) #define EDB_PD3_LCDBL (1<<3) - -#if defined (CONFIG_ARCH_CEIVA) - -/* - * The two flash banks are wired to chip selects 0 and 1. This is the mapping - * for them. - * - * nCS0 and nCS1 are at 0x70000000 and 0x60000000, respectively, when running - * in jumpered boot mode. - */ -#define CEIVA_PHYS_FLASH1 CS0_PHYS_BASE /* physical */ -#define CEIVA_PHYS_FLASH2 CS1_PHYS_BASE /* physical */ - -#define CEIVA_VIRT_FLASH1 (0xfa000000) /* virtual */ -#define CEIVA_VIRT_FLASH2 (0xfb000000) /* virtual */ - -#define CEIVA_FLASH_SIZE 0x100000 -#define CEIVA_FLASH_WIDTH 2 - -/* - * SED1355 LCD controller - */ -#define CEIVA_PHYS_SED1355 CS2_PHYS_BASE -#define CEIVA_VIRT_SED1355 (0xfc000000) - -/* - * Relevant bits in port D, which controls power to the various parts of - * the LCD on the Ceiva Photo Max, and reset to the LCD controller. - */ - -// Reset line to SED1355 (must be high to operate) -#define CEIVA_PD1_LCDRST (1<<1) -// LCD panel enable (set to one, to enable LCD) -#define CEIVA_PD4_LCDEN (1<<4) -// Backlight (set to one, to turn on backlight -#define CEIVA_PD5_LCDBL (1<<5) - -/* - * Relevant bits in port B, which report the status of the buttons. - */ - -// White button -#define CEIVA_PB4_WHT_BTN (1<<4) -// Black button -#define CEIVA_PB0_BLK_BTN (1<<0) -#endif // #if defined (CONFIG_ARCH_CEIVA) - #endif -- cgit v1.2.3