Skip to contentSkip to conversation

ARM: clps711x: Last 2 patches

PATCH New Alexander Shiyan 2 participants 6 messages May 15, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ARM: clps711x: Last 2 patches

This final two patch for branch arm-soc clps711x/cleanup. Removed redundant masking interrupts and adds the ability to proper operation of the kernel at various clock speeds of the CPU.

Alexander Shiyan (2):
ARM: clps711x: Cleanup IRQ handling
ARM: clps711x: Added support for CPU frequencies other than 73 MHz

 arch/arm/mach-clps711x/Kconfig                 |    9 +++++++++
 arch/arm/mach-clps711x/common.c                |   12 ------------
 arch/arm/mach-clps711x/include/mach/hardware.h |    3 +++
 arch/arm/mach-clps711x/include/mach/irqs.h     |    5 +----
 arch/arm/mach-clps711x/include/mach/timex.h    |    4 +++-
 drivers/tty/serial/clps711x.c                  |    4 ++--
 6 files changed, 18 insertions(+), 19 deletions(-)
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/2 ARM: clps711x: Cleanup IRQ handling

This patch contains two changes:
- Removed unused definitions from mach/irqs.h
- Do not mask interrupts in ack procedure, because we have separate intX_mask procedure for do it and actually these 2 functions are called sequentially

---
 arch/arm/mach-clps711x/common.c            |   12 ------------
 arch/arm/mach-clps711x/include/mach/irqs.h |    5 +----
 2 files changed, 1 insertions(+), 16 deletions(-)
arch/arm/mach-clps711x/common.c +0 -12
index b6dfd2f..c965fd8 100644
@@ -66,12 +66,6 @@ static void int1_mask(struct irq_data *d)
 
 static void int1_ack(struct irq_data *d)
 {
-	u32 intmr1;
-
-	intmr1 = clps_readl(INTMR1);
-	intmr1 &= ~(1 << d->irq);
-	clps_writel(intmr1, INTMR1);
-
 	switch (d->irq) {
 	case IRQ_CSINT:  clps_writel(0, COEOI);  break;
 	case IRQ_TC1OI:  clps_writel(0, TC1EOI); break;
@@ -108,12 +102,6 @@ static void int2_mask(struct irq_data *d)
 
 static void int2_ack(struct irq_data *d)
 {
-	u32 intmr2;
-
-	intmr2 = clps_readl(INTMR2);
-	intmr2 &= ~(1 << (d->irq - 16));
-	clps_writel(intmr2, INTMR2);
-
 	switch (d->irq) {
 	case IRQ_KBDINT: clps_writel(0, KBDEOI); break;
 	}
arch/arm/mach-clps711x/include/mach/irqs.h +1 -4
index 30b7e97..14d215f 100644
@@ -35,7 +35,6 @@
 #define IRQ_SSEOTI			15
 
 #define INT1_IRQS			(0x0000fff0)
-#define INT1_ACK_IRQS			(0x00004f10)
 
 /*
  * Interrupts from INTSR2
@@ -47,7 +46,5 @@
 #define IRQ_URXINT2			(16+13)	/* bit 13 */
 
 #define INT2_IRQS			(0x30070000)
-#define INT2_ACK_IRQS			(0x00010000)
-
-#define NR_IRQS                         30
 
+#define NR_IRQS				30
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 1/2 ARM: clps711x: Cleanup IRQ handling

Quoted 7 lines · Alexander Shiyan

This patch contains two changes:
- Removed unused definitions from mach/irqs.h
- Do not mask interrupts in ack procedure, because we have separate intX_mask procedure for do it and actually these 2 functions are called sequentially

Applied, and pulled it with the other cleanup into the next/cleanup branch.

Thanks,

Arnd

#3 lore raw

PATCH 2/2 ARM: clps711x: Added support for CPU frequencies other than 73 MHz

In reply to Alexander Shiyan

Modern CPUs from CLPS711X-line can operate at frequencies other than 73 MHz. This patch adds calculation of system clock frequency and the frequency of UART, depending on processor speed. Kconfig option "CPU frequency" was added for this purposes.

---
 arch/arm/mach-clps711x/Kconfig                 |    9 +++++++++
 arch/arm/mach-clps711x/include/mach/hardware.h |    3 +++
 arch/arm/mach-clps711x/include/mach/timex.h    |    4 +++-
 drivers/tty/serial/clps711x.c                  |    4 ++--
 4 files changed, 17 insertions(+), 3 deletions(-)
arch/arm/mach-clps711x/Kconfig +9 -0
index ea036d6..24a7279 100644
@@ -45,6 +45,15 @@ config ARCH_P720T
 config ARCH_FORTUNET
 	bool "FORTUNET"
 
+config EP72XX_CPU_SPEED
+	int "CPU frequency"
+	default 73728000
+	help
+	  This is a CPU frequency. This value must be setup in bootlader,
+	  before loading kernel.
+	  The value can be one of: 18432000, 36864000, 49152000, 73728000 or
+	  90316800.
+
 config EP72XX_ROM_BOOT
 	bool "EP721x/EP731x ROM boot"
 	help
arch/arm/mach-clps711x/include/mach/hardware.h +3 -0
index 13a64fc..76e3293 100644
@@ -24,6 +24,9 @@
 
 #include <mach/clps711x.h>
 
+#define CPU_BUS_SPEED		(CONFIG_EP72XX_CPU_SPEED / 2)
+#define UART_BAUD_BASE		(CPU_BUS_SPEED / 10)
+
 #define CLPS711X_VIRT_BASE	IOMEM(0xff000000)
 
 #ifndef __ASSEMBLY__
arch/arm/mach-clps711x/include/mach/timex.h +3 -1
index ac8823c..fa5ad13 100644
@@ -20,4 +20,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE 512000
+#include <mach/hardware.h>
+
+#define CLOCK_TICK_RATE		(CONFIG_EP72XX_CPU_SPEED / 144)
drivers/tty/serial/clps711x.c +2 -2
index d0f719f..bae678d 100644
@@ -401,7 +401,7 @@ static struct uart_port clps711x_ports[UART_NR] = {
 	{
 		.iobase		= SYSCON1,
 		.irq		= IRQ_UTXINT1, /* IRQ_URXINT1, IRQ_UMSINT */
-		.uartclk	= 3686400,
+		.uartclk	= UART_BAUD_BASE,
 		.fifosize	= 16,
 		.ops		= &clps711x_pops,
 		.line		= 0,
@@ -410,7 +410,7 @@ static struct uart_port clps711x_ports[UART_NR] = {
 	{
 		.iobase		= SYSCON2,
 		.irq		= IRQ_UTXINT2, /* IRQ_URXINT2 */
-		.uartclk	= 3686400,
+		.uartclk	= UART_BAUD_BASE,
 		.fifosize	= 16,
 		.ops		= &clps711x_pops,
 		.line		= 1,
Signature · 1 line
1.7.3.4
#4 lore raw

PATCH 2/2 ARM: clps711x: Added support for CPU frequencies other than 73 MHz

Quoted 6 lines · Alexander Shiyan

Modern CPUs from CLPS711X-line can operate at frequencies other than 73 MHz. This patch adds calculation of system clock frequency and the frequency of UART, depending on processor speed. Kconfig option "CPU frequency" was added for this purposes.

I'm sceptical about this patch. While it is an improvement, it doesn't really go far enough and does not make it possible to build a kernel that runs on multiple mach-clps711x based machines that each have different clock frequencies. It would be much better to make it a run-time option like most other platforms rather than hardcode at compile time.

Quoted 7 lines
arch/arm/mach-clps711x/Kconfig +0 -0
index ea036d6..24a7279 100644
@@ -45,6 +45,15 @@ config ARCH_P720T
 config ARCH_FORTUNET
 	bool "FORTUNET"

arch/arm/mach-clps711x/Kconfig config ARCH_P720T · line 56

Quoted 10 lines
arch/arm/mach-clps711x/Kconfig +9 -0
 
+config EP72XX_CPU_SPEED
+	int "CPU frequency"
+	default 73728000
+	help
+	  This is a CPU frequency. This value must be setup in bootlader,
+	  before loading kernel.
+	  The value can be one of: 18432000, 36864000, 49152000, 73728000 or
+	  90316800.
+

I think it would be better to express this as a "choice" statement if you end up requiring this to be a compile-time option.

arch/arm/mach-clps711x/include/mach/timex.h line 25

Quoted 13 lines
b renamed from arch/arm/mach-clps711x/include/mach/hardware.h +0 -0
arch/arm/mach-clps711x/include/mach/timex.h +3 -1
index ac8823c..fa5ad13 100644
@@ -20,4 +20,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define CLOCK_TICK_RATE 512000
+#include <mach/hardware.h>
+
+#define CLOCK_TICK_RATE		(CONFIG_EP72XX_CPU_SPEED / 144)

We're actually trying hard to remove CLOCK_TICK_RATE in the long run. Most people believe that by now it's completely bogus for all common code, but I think Russell still isn't convinced.

Quoted 14 lines
drivers/tty/serial/clps711x.c +1 -1
index d0f719f..bae678d 100644
@@ -401,7 +401,7 @@ static struct uart_port clps711x_ports[UART_NR] = {
 	{
 		.iobase		= SYSCON1,
 		.irq		= IRQ_UTXINT1, /* IRQ_URXINT1, IRQ_UMSINT */
-		.uartclk	= 3686400,
+		.uartclk	= UART_BAUD_BASE,
 		.fifosize	= 16,
 		.ops		= &clps711x_pops,
 		.line		= 0,

drivers/tty/serial/clps711x.c static struct uart_port clps711x_ports[UART_NR] = { · line 416

Quoted 8 lines
drivers/tty/serial/clps711x.c +1 -1
@@ -410,7 +410,7 @@ static struct uart_port clps711x_ports[UART_NR] = {
 	{
 		.iobase		= SYSCON2,
 		.irq		= IRQ_UTXINT2, /* IRQ_URXINT2 */
-		.uartclk	= 3686400,
+		.uartclk	= UART_BAUD_BASE,
 		.fifosize	= 16,
 		.ops		= &clps711x_pops,
 		.line		= 1,

I think the right way to do this is to move the uart_add_one_port() call and the clps711x_ports array into platform code, so you can modify the frequency at boot time, but leave the uart_driver where it is. That will require some other changes for the console.

It's probably best to leave this patch for after the merge window, so you can come up with a good solution for 3.6, ok?

Arnd

#5 lore raw

Re[2]: [PATCH 2/2] ARM: clps711x: Added support for CPU frequencies other than 73 MHz

Hello.

Tue, 15 May 2012 19:36:47 +0000 ?? Arnd Bergmann <[email protected]>:

Quoted 5 lines · Alexander Shiyan
Quoted 4 lines

Modern CPUs from CLPS711X-line can operate at frequencies other than 73 MHz. This patch adds calculation of system clock frequency and the frequency of UART, depending on processor speed. Kconfig option "CPU frequency" was added for this purposes.

...

Quoted 7 lines

I think the right way to do this is to move the uart_add_one_port() call and the clps711x_ports array into platform code, so you can modify the frequency at boot time, but leave the uart_driver where it is. That will require some other changes for the console.

It's probably best to leave this patch for after the merge window, so you can come up with a good solution for 3.6, ok?

OK, Arnd, I'll think about the other implementation.