Fixups and Cleanups of lemote-2f family machines
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
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
@@ -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
@@ -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
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
@@ -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
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
@@ -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
@@ -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
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
@@ -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
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.Signed-off-by Wu Zhangjin <[email protected]>
And this one queued for 2.6.33 as well.
Thanks,
Ralf
Re: [PATCH v1 3/4] [loongson] yeeloong2f: add LID open event as the wakeup event
In reply to Wu ZhangjinQuoted 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
Re: [PATCH v1 2/4] [loongson] yeeloong2f: add basic ec operations
In reply to Wu ZhangjinQuoted 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
Re: [PATCH v1 1/4] [loongson] Remove the inline annotation of prom_init_uart_base()
In reply to Wu ZhangjinHi, 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 annotateprom_init_uart_base(), so, remove the inline here.Signed-off-by Wu Zhangjin <[email protected]>--- 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@@ -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@@ -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 );
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