Skip to contentSkip to conversation

Fixups and Cleanups of lemote-2f family machines

PATCH In review Wu Zhangjin 2 participants 10 messages Nov 21, 2009 – Nov 23, 2009 MIPS

lore
Share & tools
lore
#0 lore raw

cover Fixups and Cleanups of lemote-2f family machines

This patchset includes the following changes:

- [loongson] Remove the inline annotation of prom_init_uart_base() Ensure gcc 3.4.6 can compile it.
- [loongson] yeeloong2f: add basic ec operations
add basic support for the Embedded Controller(ec_kb3310b) of yeeloong2f netbook. This support is needed for the coming yeeloong2f platform drivers.
- [loongson] yeeloong2f: add LID open event as the wakeup event Allow users wakeup the netbook from suspend mode via opening the LID.
- [loongson] yeeloong2f: cleanup the reset logic with ec_write function Benefit from "[loongson] yeeloong2f: add basic ec operations",
we can use the cleanup the old reset implementaion now.

All of the above updates have been tested and put into this branch:

git://dev.lemote.com/rt4ls.git linux-loongson/dev/for-upstream

Hi, Ralf, Could you please queue it for linux-2.6.33? Thanks!

Best Wishes,
Wu Zhangjin

Wu Zhangjin (4):
[loongson] Remove the inline annotation of prom_init_uart_base() [loongson] yeeloong2f: add basic ec operations
[loongson] yeeloong2f: add LID open event as the wakeup event [loongson] yeeloong2f: cleanup the reset logic with ec_write function

 arch/mips/include/asm/mach-loongson/loongson.h |    3 +-
 arch/mips/loongson/common/uart_base.c          |    2 +-
 arch/mips/loongson/lemote-2f/Makefile          |    2 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c      |  132 ++++++++++++++++++++++++
 arch/mips/loongson/lemote-2f/ec_kb3310b.h      |   47 +++++++++
 arch/mips/loongson/lemote-2f/irq.c             |    4 +-
 arch/mips/loongson/lemote-2f/pm.c              |   71 ++++++++++++-
 arch/mips/loongson/lemote-2f/reset.c           |   21 +----
 8 files changed, 256 insertions(+), 26 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.c
 create mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
#1 lore raw

PATCH 1/4 Remove the inline annotation of prom_init_uart_base()

gcc 3.4.6 complains about un-implemented prom_init_uart_base() if using inline to annotate prom_init_uart_base(), so, remove the inline here.

---
 arch/mips/include/asm/mach-loongson/loongson.h |    2 +-
 arch/mips/loongson/common/uart_base.c          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/mips/include/asm/mach-loongson/loongson.h +1 -1
index daf7041..a7fa66e 100644
@@ -33,7 +33,7 @@ extern void __init prom_init_machtype(void);
 extern void __init prom_init_env(void);
 extern unsigned long _loongson_uart_base;
 extern unsigned long uart8250_base[];
-extern inline void __maybe_unused prom_init_uart_base(void);
+extern void prom_init_uart_base(void);
 
 /* irq operation functions */
 extern void bonito_irqdispatch(void);
arch/mips/loongson/common/uart_base.c +1 -1
index 275bed6..1d636f4 100644
@@ -29,7 +29,7 @@ unsigned long __maybe_unused uart8250_base[] = {
 };
 EXPORT_SYMBOL(uart8250_base);
 
-inline void __maybe_unused prom_init_uart_base(void)
+void __maybe_unused prom_init_uart_base(void)
 {
 	_loongson_uart_base =
 		(unsigned long)ioremap_nocache(uart8250_base[mips_machtype], 8);
Signature · 1 line
1.6.2.1
#2 lore raw

PATCH 2/4 yeeloong2f: add basic ec operations

YeeLoong2F has a kb3310b Embedded Controller. This patch add the basic EC operations for future relative drivers or board support.

---
 arch/mips/loongson/lemote-2f/Makefile     |    2 +-
 arch/mips/loongson/lemote-2f/ec_kb3310b.c |  132 +++++++++++++++++++++++++++++
 arch/mips/loongson/lemote-2f/ec_kb3310b.h |   47 ++++++++++
 3 files changed, 180 insertions(+), 1 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.c
 create mode 100644 arch/mips/loongson/lemote-2f/ec_kb3310b.h
arch/mips/loongson/lemote-2f/Makefile +1 -1
index 5add7b2..4d84b27 100644
@@ -2,7 +2,7 @@
 # Makefile for lemote loongson2f family machines
 #
 
-obj-y += irq.o reset.o
+obj-y += irq.o reset.o ec_kb3310b.o
 
 #
 # Suspend Support
arch/mips/loongson/lemote-2f/ec_kb3310b.c new file +132 -0

132 lines not on this page · raw message

arch/mips/loongson/lemote-2f/ec_kb3310b.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.6.2.1
#3 lore raw

PATCH 3/4 yeeloong2f: add LID open event as the wakeup event

Yeeloong2F netbook has an embedded controller(kb3310b) to manage the LID action. when the LID is closed/opened, a SCI interrupt is sent out and the corresponding event is saved to an EC register for later query.

This patch allow the LID open action to wake up the processor from wait mode if it is in the suspend mode.

---
 arch/mips/include/asm/mach-loongson/loongson.h |    1 +
 arch/mips/loongson/lemote-2f/irq.c             |    4 +-
 arch/mips/loongson/lemote-2f/pm.c              |   71 +++++++++++++++++++++++-
 3 files changed, 72 insertions(+), 4 deletions(-)
arch/mips/include/asm/mach-loongson/loongson.h +1 -0
index a7fa66e..06c28f3 100644
@@ -41,6 +41,7 @@ extern void __init bonito_irq_init(void);
 extern void __init set_irq_trigger_mode(void);
 extern void __init mach_init_irq(void);
 extern void mach_irq_dispatch(unsigned int pending);
+extern int mach_i8259_irq(void);
 
 /* We need this in some places... */
 #define delay()	({		\
arch/mips/loongson/lemote-2f/irq.c +3 -1
index 50e7bb6..77d32f9 100644
@@ -9,6 +9,7 @@
  */
 
 #include <linux/interrupt.h>
+#include <linux/module.h>
 
 #include <asm/irq_cpu.h>
 #include <asm/i8259.h>
@@ -30,7 +31,7 @@
  * The generic i8259_irq() make the kernel hang on booting.  Since we cannot
  * get the irq via the IRR directly, we access the ISR instead.
  */
-static inline int mach_i8259_irq(void)
+int mach_i8259_irq(void)
 {
 	int irq, isr;
 
@@ -60,6 +61,7 @@ static inline int mach_i8259_irq(void)
 
 	return irq;
 }
+EXPORT_SYMBOL(mach_i8259_irq);
 
 static void i8259_irqdispatch(void)
 {
arch/mips/loongson/lemote-2f/pm.c +68 -3

98 lines not on this page · raw message

Signature · 1 line
1.6.2.1
#4 lore raw

PATCH 4/4 yeeloong2f: cleanup the reset logic with ec_write function

A commen ec_read/ec_write function is defined in "[loongson] yeeloong2f:
add basic ec operations", So, we can use it here to cleanup the reset logic of yeeloong2f netbook.

---
 arch/mips/loongson/lemote-2f/reset.c |   21 ++-------------------
 1 files changed, 2 insertions(+), 19 deletions(-)
arch/mips/loongson/lemote-2f/reset.c +2 -19
index 44bb984..51d1a60 100644
@@ -20,6 +20,7 @@
 #include <loongson.h>
 
 #include <cs5536/cs5536.h>
+#include "ec_kb3310b.h"
 
 static void reset_cpu(void)
 {
@@ -75,30 +76,12 @@ static void fl2f_shutdown(void)
 
 /* reset support for yeeloong2f and mengloong2f notebook */
 
-/*
- * The following registers are determined by the EC index configuration.
- * 1. fill the PORT_HIGH as EC register high part.
- * 2. fill the PORT_LOW as EC register low part.
- * 3. fill the PORT_DATA as EC register write data or get the data from it.
- */
-
-#define	EC_IO_PORT_HIGH	0x0381
-#define	EC_IO_PORT_LOW	0x0382
-#define	EC_IO_PORT_DATA	0x0383
-#define	REG_RESET_HIGH	0xF4	/* reset the machine auto-clear : rd/wr */
-#define REG_RESET_LOW	0xEC
-#define	BIT_RESET_ON	(1 << 0)
-
 void ml2f_reboot(void)
 {
 	reset_cpu();
 
 	/* sending an reset signal to EC(embedded controller) */
-	outb(REG_RESET_HIGH, EC_IO_PORT_HIGH);
-	outb(REG_RESET_LOW, EC_IO_PORT_LOW);
-	mmiowb();
-	outb(BIT_RESET_ON, EC_IO_PORT_DATA);
-	mmiowb();
+	ec_write(REG_RESET, BIT_RESET_ON);
 }
 
 #define yl2f89_reboot ml2f_reboot
Signature · 1 line
1.6.2.1
#5 lore raw

Re: [PATCH v1 4/4] [loongson] yeeloong2f: cleanup the reset logic with ec_write function

Quoted 5 lines · Wu Zhangjin

A commen ec_read/ec_write function is defined in "[loongson] yeeloong2f:
add basic ec operations", So, we can use it here to cleanup the reset logic of yeeloong2f netbook.

And this one queued for 2.6.33 as well.

Thanks,

Ralf

#6 lore raw

Re: [PATCH v1 3/4] [loongson] yeeloong2f: add LID open event as the wakeup event

In reply to Wu Zhangjin
Quoted 6 lines · Wu Zhangjin

Yeeloong2F netbook has an embedded controller(kb3310b) to manage the LID action. when the LID is closed/opened, a SCI interrupt is sent out and the corresponding event is saved to an EC register for later query.

This patch allow the LID open action to wake up the processor from wait mode if it is in the suspend mode.

Thanks, queued for 2.6.33.

Ralf

#7 lore raw

Re: [PATCH v1 2/4] [loongson] yeeloong2f: add basic ec operations

In reply to Wu Zhangjin
Quoted 2 lines · Wu Zhangjin

YeeLoong2F has a kb3310b Embedded Controller. This patch add the basic EC operations for future relative drivers or board support.

Queued with a bunch of cleanups.

Thanks!

Ralf

#8 lore raw

Re: [PATCH v1 1/4] [loongson] Remove the inline annotation of prom_init_uart_base()

In reply to Wu Zhangjin

Hi, Ralf

This one is also urgent, could you please fold it into "MIPS: Loongson:
Cleanup the serial port support"? thanks!

Best Regards,
Wu Zhangjin

Quoted 35 lines · Wu Zhangjin

gcc 3.4.6 complains about un-implemented prom_init_uart_base() if using inline to annotate prom_init_uart_base(), so, remove the inline here.

---
 arch/mips/include/asm/mach-loongson/loongson.h |    2 +-
 arch/mips/loongson/common/uart_base.c          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/mips/include/asm/mach-loongson/loongson.h +1 -1
index daf7041..a7fa66e 100644
@@ -33,7 +33,7 @@ extern void __init prom_init_machtype(void);
 extern void __init prom_init_env(void);
 extern unsigned long _loongson_uart_base;
 extern unsigned long uart8250_base[];
-extern inline void __maybe_unused prom_init_uart_base(void);
+extern void prom_init_uart_base(void);
 
 /* irq operation functions */
 extern void bonito_irqdispatch(void);
arch/mips/loongson/common/uart_base.c +1 -1
index 275bed6..1d636f4 100644
@@ -29,7 +29,7 @@ unsigned long __maybe_unused uart8250_base[] = {
 };
 EXPORT_SYMBOL(uart8250_base);
 
-inline void __maybe_unused prom_init_uart_base(void)
+void __maybe_unused prom_init_uart_base(void)
 {
 	_loongson_uart_base =
 		(unsigned long)ioremap_nocache(uart8250_base[mips_machtype], 8);
#9 lore raw

Re: [PATCH v1 1/4] [loongson] Remove the inline annotation of prom_init_uart_base()

Quoted 2 lines · Wu Zhangjin

This one is also urgent, could you please fold it into "MIPS: Loongson:
Cleanup the serial port support"? thanks!

Done. Thanks!

Ralf