[PATCH -queue 0/2] add suspend support for loongson2f

View: New views
12 Messages — Rating Filter:   Alert me  

[PATCH -queue 0/2] add suspend support for loongson2f

by Wu Zhangjin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Loongson2f's cpu frequency is software configurable, when we set its frequency
to ZERO, it will go into the suspend mode and can be waked up by the external
interrupts.

With this feature and based on the kernel's suspend framework, this patch add
the suspend support for loongson2f family machines.

To utilize this support, the machines should provide a necessary external
interrupt to wakeup loongson2f from the suspend mode and make sure the
interrupt be able to send to the processor directly or indirectly(the interrupt
path is not blocked). otherwise, it will suspend there all the time.

And If there is an external timer used, please mask it with IRQF_TIMER,
otherwise, the system will fail on resuming from suspend.

The old lemote Fuloong2F mini PC did not provide any method to wakeup the
machine from the suspend mode, so, please not try to suspend the machine.  But
the latest lemote Fuloong2F add an interrupt line from the Power Button to the
Processor, If we press the button and release it immediatly, it will work as a
wakeup button.

For YeeLoong2F netbook, Since it's easy to setup the keyboard interrupt as the
wakeup interrupt, we just setup it and avoid changing the hardware. So the old
YeeLoong2F machines can also utilize this support. and in the coming patchset,
we will also setup the LID interrupt as the wakeup interrupt.

Thanks & Regards,
        Wu Zhangjin

Wu Zhangjin (2):
  [loongson] 2f: add suspend support framework
  [loongson] yeeloong2f: add board specific suspend support

 arch/mips/loongson/Kconfig            |    5 +
 arch/mips/loongson/common/Makefile    |    6 ++
 arch/mips/loongson/common/pm.c        |  157 +++++++++++++++++++++++++++++++++
 arch/mips/loongson/lemote-2f/Makefile |    6 ++
 arch/mips/loongson/lemote-2f/pm.c     |   70 +++++++++++++++
 5 files changed, 244 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson/common/pm.c
 create mode 100644 arch/mips/loongson/lemote-2f/pm.c



Parent Message unknown [PATCH -queue 1/2] [loongson] 2f: add suspend support framework

by Wu Zhangjin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This patch add basic suspend support for loongson2f family machines,
loongson2f have a specific feature: when we set it's frequency to ZERO,
it will go into a wait mode, and then can be waked up by the external
interrupt. so, if we setup suitable interrupts before putting it into
wait mode, we will be able wake it up whenever we want via sending the
relative interrupts to it.

These interrupts are board-specific, Yeeloong2F use the keyboard
interrupt and SCI interrupt, but LingLoong and Fuloong2F use the
interrupts connected to the processors directly. and BTW: some old
LingLoong and FuLoong2F have no such interrupts connected, so, there is
no way to wake them up from suspend mode. and therefore, please do not
enable the kernel support for them.

The board-specific support will be added in the coming patches.

Signed-off-by: Wu Zhangjin <wuzhangjin@...>
---
 arch/mips/loongson/Kconfig         |    5 +
 arch/mips/loongson/common/Makefile |    6 ++
 arch/mips/loongson/common/pm.c     |  157 ++++++++++++++++++++++++++++++++++++
 3 files changed, 168 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson/common/pm.c

diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
index a214127..029360f 100644
--- a/arch/mips/loongson/Kconfig
+++ b/arch/mips/loongson/Kconfig
@@ -61,3 +61,8 @@ endchoice
 
 config CS5536
  bool
+
+config LOONGSON_SUSPEND
+ bool
+ default y
+ depends on CPU_SUPPORT_CPUFREQ && SUSPEND
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile
index a82527f..a21724d 100644
--- a/arch/mips/loongson/common/Makefile
+++ b/arch/mips/loongson/common/Makefile
@@ -16,3 +16,9 @@ obj-$(CONFIG_SERIAL_8250) += serial.o
 # space
 #
 obj-$(CONFIG_CS5536) += cs5536/
+
+#
+# Suspend Support
+#
+
+obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
diff --git a/arch/mips/loongson/common/pm.c b/arch/mips/loongson/common/pm.c
new file mode 100644
index 0000000..4e5c56e
--- /dev/null
+++ b/arch/mips/loongson/common/pm.c
@@ -0,0 +1,157 @@
+/*
+ * loongson-specific suspend support
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@...>
+ *
+ * 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.
+ */
+
+#include <linux/suspend.h>
+#include <linux/interrupt.h>
+#include <linux/pm.h>
+
+#include <asm/i8259.h>
+#include <asm/mipsregs.h>
+
+#include <loongson.h>
+
+static unsigned int __maybe_unused cached_master_mask; /* i8259A */
+static unsigned int __maybe_unused cached_slave_mask;
+static unsigned int __maybe_unused cached_bonito_irq_mask; /* bonito */
+
+void arch_suspend_disable_irqs(void)
+{
+ /* disable all mips events */
+ local_irq_disable();
+#ifdef CONFIG_I8259
+ /* disable all events of i8259A */
+ cached_slave_mask = inb(PIC_SLAVE_IMR);
+ cached_master_mask = inb(PIC_MASTER_IMR);
+
+ outb(0xff, PIC_SLAVE_IMR);
+ inb(PIC_SLAVE_IMR);
+ outb(0xff, PIC_MASTER_IMR);
+ inb(PIC_MASTER_IMR);
+#endif
+ /* disable all events of bonito */
+ cached_bonito_irq_mask = LOONGSON_INTEN;
+ LOONGSON_INTENCLR = 0xffff;
+ (void)LOONGSON_INTENCLR;
+}
+
+void arch_suspend_enable_irqs(void)
+{
+ /* enable all mips events */
+ local_irq_enable();
+#ifdef CONFIG_I8259
+ /* only enable the cached events of i8259A */
+ outb(cached_slave_mask, PIC_SLAVE_IMR);
+ outb(cached_master_mask, PIC_MASTER_IMR);
+#endif
+ /* enable all cached events of bonito */
+ LOONGSON_INTENSET = cached_bonito_irq_mask;
+ (void)LOONGSON_INTENSET;
+}
+
+/* setup the board-specific events for waking up loongson from wait mode */
+void __weak setup_wakeup_events(void)
+{
+}
+
+/* check wakeup events */
+int __weak wakeup_loongson(void)
+{
+ return 1;
+}
+
+/* if the events are really what we want to wakeup cpu, wake up it, otherwise,
+ * we Put CPU into wait mode again.
+ */
+static void wait_for_wakeup_events(void)
+{
+ while (!wakeup_loongson())
+ LOONGSON_CHIPCFG0 &= ~0x7;
+}
+
+/* stop all perf counters by default
+ *   $24 is the control register of loongson perf counter
+ */
+static inline void stop_perf_counters(void)
+{
+ __write_64bit_c0_register($24, 0, 0);
+}
+
+
+static void loongson_suspend_enter(void)
+{
+ static unsigned int cached_cpu_freq;
+
+ /* setup wakeup events via enabling the IRQs */
+ setup_wakeup_events();
+
+ /* stop all perf counters */
+ stop_perf_counters();
+
+ cached_cpu_freq = LOONGSON_CHIPCFG0;
+
+ /* Put CPU into wait mode */
+ LOONGSON_CHIPCFG0 &= ~0x7;
+
+ /* wait for the given events to wakeup cpu from wait mode */
+ wait_for_wakeup_events();
+
+ LOONGSON_CHIPCFG0 = cached_cpu_freq;
+ mmiowb();
+}
+
+void __weak mach_suspend(void)
+{
+}
+
+void __weak mach_resume(void)
+{
+}
+
+static int loongson_pm_enter(suspend_state_t state)
+{
+ /* mach specific suspend */
+ mach_suspend();
+
+ /* processor specific suspend */
+ loongson_suspend_enter();
+
+ /* mach specific resume */
+ mach_resume();
+
+ return 0;
+}
+
+static int loongson_pm_valid_state(suspend_state_t state)
+{
+ switch (state) {
+ case PM_SUSPEND_ON:
+ case PM_SUSPEND_STANDBY:
+ case PM_SUSPEND_MEM:
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
+static struct platform_suspend_ops loongson_pm_ops = {
+ .valid = loongson_pm_valid_state,
+ .enter = loongson_pm_enter,
+};
+
+static int __init loongson_pm_init(void)
+{
+ suspend_set_ops(&loongson_pm_ops);
+
+ return 0;
+}
+arch_initcall(loongson_pm_init);
--
1.6.2.1



Parent Message unknown [PATCH -queue 2/2] [loongson] yeeloong2f: add board specific suspend support

by Wu Zhangjin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Lemote loongson2f family machines need an external interrupt to wake up
the system from the suspend mode.

For the new Fuloong2f and LingLoong2f, they add a button to send the
interrupt to the cpu directly, so, there is no need to setup an
interrupt for them.

But for YeeLoong2f and Mengloong2f, there is no hardware change, So, we
setup the keyboard interrupt as the wakeup interrupt, this patch does
it!

Signed-off-by: Wu Zhangjin <wuzhangjin@...>
---
 arch/mips/loongson/lemote-2f/Makefile |    6 +++
 arch/mips/loongson/lemote-2f/pm.c     |   70 +++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/pm.c

diff --git a/arch/mips/loongson/lemote-2f/Makefile b/arch/mips/loongson/lemote-2f/Makefile
index da543b1..5add7b2 100644
--- a/arch/mips/loongson/lemote-2f/Makefile
+++ b/arch/mips/loongson/lemote-2f/Makefile
@@ -3,3 +3,9 @@
 #
 
 obj-y += irq.o reset.o
+
+#
+# Suspend Support
+#
+
+obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
diff --git a/arch/mips/loongson/lemote-2f/pm.c b/arch/mips/loongson/lemote-2f/pm.c
new file mode 100644
index 0000000..771f32d
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/pm.c
@@ -0,0 +1,70 @@
+/*
+ *  Lemote loongson2f family machines' specific suspend support
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@...>
+ *
+ * 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.
+ */
+
+#include <linux/suspend.h>
+#include <linux/interrupt.h>
+#include <linux/pm.h>
+#include <linux/i8042.h>
+
+#include <asm/i8259.h>
+#include <asm/mipsregs.h>
+#include <asm/bootinfo.h>
+
+#include <loongson.h>
+
+#define I8042_KBD_IRQ 1
+#define I8042_CTR_KBDINT 0x01
+#define I8042_CTR_KBDDIS 0x10
+
+static unsigned char i8042_ctr;
+
+static int i8042_enable_kbd_port(void)
+{
+ if (i8042_command(&i8042_ctr, I8042_CMD_CTL_RCTR)) {
+ printk(KERN_ERR "i8042.c: Can't read CTR while enabling i8042 kbd port.\n");
+ return -EIO;
+ }
+
+ i8042_ctr &= ~I8042_CTR_KBDDIS;
+ i8042_ctr |= I8042_CTR_KBDINT;
+
+ if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
+ i8042_ctr &= ~I8042_CTR_KBDINT;
+ i8042_ctr |= I8042_CTR_KBDDIS;
+ printk(KERN_ERR "i8042.c: Failed to enable KBD port.\n");
+ return -EIO;
+ }
+
+ return 0;
+}
+
+/* i8042 is connnectted to i8259A */
+void setup_wakeup_events(void)
+{
+ int irq_mask;
+
+ printk(KERN_INFO "setup wakeup interrupts\n");
+
+ switch (mips_machtype) {
+ case MACH_LEMOTE_ML2F7:
+ case MACH_LEMOTE_YL2F89:
+ /* open the keyboard irq in i8259A */
+ outb((0xff & ~(1 << I8042_KBD_IRQ)), PIC_MASTER_IMR);
+ irq_mask = inb(PIC_MASTER_IMR);
+
+ /* enable keyboard port */
+ i8042_enable_kbd_port();
+ break;
+ default:
+ break;
+ }
+}
--
1.6.2.1



Parent Message unknown [PATCH -queue 1/2] [loongson] 2f: add suspend support framework

by Wu Zhangjin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)

This patch add basic suspend support for loongson2f family machines,
loongson2f have a specific feature: when we set it's frequency to ZERO,
it will go into a wait mode, and then can be waked up by the external
interrupt. so, if we setup suitable interrupts before putting it into
wait mode, we will be able wake it up whenever we want via sending the
relative interrupts to it.

These interrupts are board-specific, Yeeloong2F use the keyboard
interrupt and SCI interrupt, but LingLoong and Fuloong2F use the
interrupts connected to the processors directly. and BTW: some old
LingLoong and FuLoong2F have no such interrupts connected, so, there is
no way to wake them up from suspend mode. and therefore, please do not
enable the kernel support for them.

The board-specific support will be added in the coming patches.

Signed-off-by: Wu Zhangjin <wuzhangjin@...>
---
 arch/mips/loongson/Kconfig         |    5 +
 arch/mips/loongson/common/Makefile |    6 ++
 arch/mips/loongson/common/pm.c     |  157 ++++++++++++++++++++++++++++++++++++
 3 files changed, 168 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson/common/pm.c

diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
index a214127..029360f 100644
--- a/arch/mips/loongson/Kconfig
+++ b/arch/mips/loongson/Kconfig
@@ -61,3 +61,8 @@ endchoice
 
 config CS5536
  bool
+
+config LOONGSON_SUSPEND
+ bool
+ default y
+ depends on CPU_SUPPORT_CPUFREQ && SUSPEND
diff --git a/arch/mips/loongson/common/Makefile b/arch/mips/loongson/common/Makefile
index a82527f..a21724d 100644
--- a/arch/mips/loongson/common/Makefile
+++ b/arch/mips/loongson/common/Makefile
@@ -16,3 +16,9 @@ obj-$(CONFIG_SERIAL_8250) += serial.o
 # space
 #
 obj-$(CONFIG_CS5536) += cs5536/
+
+#
+# Suspend Support
+#
+
+obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
diff --git a/arch/mips/loongson/common/pm.c b/arch/mips/loongson/common/pm.c
new file mode 100644
index 0000000..4e5c56e
--- /dev/null
+++ b/arch/mips/loongson/common/pm.c
@@ -0,0 +1,157 @@
+/*
+ * loongson-specific suspend support
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@...>
+ *
+ * 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.
+ */
+
+#include <linux/suspend.h>
+#include <linux/interrupt.h>
+#include <linux/pm.h>
+
+#include <asm/i8259.h>
+#include <asm/mipsregs.h>
+
+#include <loongson.h>
+
+static unsigned int __maybe_unused cached_master_mask; /* i8259A */
+static unsigned int __maybe_unused cached_slave_mask;
+static unsigned int __maybe_unused cached_bonito_irq_mask; /* bonito */
+
+void arch_suspend_disable_irqs(void)
+{
+ /* disable all mips events */
+ local_irq_disable();
+#ifdef CONFIG_I8259
+ /* disable all events of i8259A */
+ cached_slave_mask = inb(PIC_SLAVE_IMR);
+ cached_master_mask = inb(PIC_MASTER_IMR);
+
+ outb(0xff, PIC_SLAVE_IMR);
+ inb(PIC_SLAVE_IMR);
+ outb(0xff, PIC_MASTER_IMR);
+ inb(PIC_MASTER_IMR);
+#endif
+ /* disable all events of bonito */
+ cached_bonito_irq_mask = LOONGSON_INTEN;
+ LOONGSON_INTENCLR = 0xffff;
+ (void)LOONGSON_INTENCLR;
+}
+
+void arch_suspend_enable_irqs(void)
+{
+ /* enable all mips events */
+ local_irq_enable();
+#ifdef CONFIG_I8259
+ /* only enable the cached events of i8259A */
+ outb(cached_slave_mask, PIC_SLAVE_IMR);
+ outb(cached_master_mask, PIC_MASTER_IMR);
+#endif
+ /* enable all cached events of bonito */
+ LOONGSON_INTENSET = cached_bonito_irq_mask;
+ (void)LOONGSON_INTENSET;
+}
+
+/* setup the board-specific events for waking up loongson from wait mode */
+void __weak setup_wakeup_events(void)
+{
+}
+
+/* check wakeup events */
+int __weak wakeup_loongson(void)
+{
+ return 1;
+}
+
+/* if the events are really what we want to wakeup cpu, wake up it, otherwise,
+ * we Put CPU into wait mode again.
+ */
+static void wait_for_wakeup_events(void)
+{
+ while (!wakeup_loongson())
+ LOONGSON_CHIPCFG0 &= ~0x7;
+}
+
+/* stop all perf counters by default
+ *   $24 is the control register of loongson perf counter
+ */
+static inline void stop_perf_counters(void)
+{
+ __write_64bit_c0_register($24, 0, 0);
+}
+
+
+static void loongson_suspend_enter(void)
+{
+ static unsigned int cached_cpu_freq;
+
+ /* setup wakeup events via enabling the IRQs */
+ setup_wakeup_events();
+
+ /* stop all perf counters */
+ stop_perf_counters();
+
+ cached_cpu_freq = LOONGSON_CHIPCFG0;
+
+ /* Put CPU into wait mode */
+ LOONGSON_CHIPCFG0 &= ~0x7;
+
+ /* wait for the given events to wakeup cpu from wait mode */
+ wait_for_wakeup_events();
+
+ LOONGSON_CHIPCFG0 = cached_cpu_freq;
+ mmiowb();
+}
+
+void __weak mach_suspend(void)
+{
+}
+
+void __weak mach_resume(void)
+{
+}
+
+static int loongson_pm_enter(suspend_state_t state)
+{
+ /* mach specific suspend */
+ mach_suspend();
+
+ /* processor specific suspend */
+ loongson_suspend_enter();
+
+ /* mach specific resume */
+ mach_resume();
+
+ return 0;
+}
+
+static int loongson_pm_valid_state(suspend_state_t state)
+{
+ switch (state) {
+ case PM_SUSPEND_ON:
+ case PM_SUSPEND_STANDBY:
+ case PM_SUSPEND_MEM:
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
+static struct platform_suspend_ops loongson_pm_ops = {
+ .valid = loongson_pm_valid_state,
+ .enter = loongson_pm_enter,
+};
+
+static int __init loongson_pm_init(void)
+{
+ suspend_set_ops(&loongson_pm_ops);
+
+ return 0;
+}
+arch_initcall(loongson_pm_init);
--
1.6.2.1





Parent Message unknown [PATCH -queue 2/2] [loongson] yeeloong2f: add board specific suspend support

by Wu Zhangjin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)

Lemote loongson2f family machines need an external interrupt to wake up
the system from the suspend mode.

For the new Fuloong2f and LingLoong2f, they add a button to send the
interrupt to the cpu directly, so, there is no need to setup an
interrupt for them.

But for YeeLoong2f and Mengloong2f, there is no hardware change, So, we
setup the keyboard interrupt as the wakeup interrupt, this patch does
it!

Signed-off-by: Wu Zhangjin <wuzhangjin@...>
---
 arch/mips/loongson/lemote-2f/Makefile |    6 +++
 arch/mips/loongson/lemote-2f/pm.c     |   70 +++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/loongson/lemote-2f/pm.c

diff --git a/arch/mips/loongson/lemote-2f/Makefile b/arch/mips/loongson/lemote-2f/Makefile
index da543b1..5add7b2 100644
--- a/arch/mips/loongson/lemote-2f/Makefile
+++ b/arch/mips/loongson/lemote-2f/Makefile
@@ -3,3 +3,9 @@
 #
 
 obj-y += irq.o reset.o
+
+#
+# Suspend Support
+#
+
+obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
diff --git a/arch/mips/loongson/lemote-2f/pm.c b/arch/mips/loongson/lemote-2f/pm.c
new file mode 100644
index 0000000..771f32d
--- /dev/null
+++ b/arch/mips/loongson/lemote-2f/pm.c
@@ -0,0 +1,70 @@
+/*
+ *  Lemote loongson2f family machines' specific suspend support
+ *
+ *  Copyright (C) 2009 Lemote Inc.
+ *  Author: Wu Zhangjin <wuzj@...>
+ *
+ * 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.
+ */
+
+#include <linux/suspend.h>
+#include <linux/interrupt.h>
+#include <linux/pm.h>
+#include <linux/i8042.h>
+
+#include <asm/i8259.h>
+#include <asm/mipsregs.h>
+#include <asm/bootinfo.h>
+
+#include <loongson.h>
+
+#define I8042_KBD_IRQ 1
+#define I8042_CTR_KBDINT 0x01
+#define I8042_CTR_KBDDIS 0x10
+
+static unsigned char i8042_ctr;
+
+static int i8042_enable_kbd_port(void)
+{
+ if (i8042_command(&i8042_ctr, I8042_CMD_CTL_RCTR)) {
+ printk(KERN_ERR "i8042.c: Can't read CTR while enabling i8042 kbd port.\n");
+ return -EIO;
+ }
+
+ i8042_ctr &= ~I8042_CTR_KBDDIS;
+ i8042_ctr |= I8042_CTR_KBDINT;
+
+ if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
+ i8042_ctr &= ~I8042_CTR_KBDINT;
+ i8042_ctr |= I8042_CTR_KBDDIS;
+ printk(KERN_ERR "i8042.c: Failed to enable KBD port.\n");
+ return -EIO;
+ }
+
+ return 0;
+}
+
+/* i8042 is connnectted to i8259A */
+void setup_wakeup_events(void)
+{
+ int irq_mask;
+
+ printk(KERN_INFO "setup wakeup interrupts\n");
+
+ switch (mips_machtype) {
+ case MACH_LEMOTE_ML2F7:
+ case MACH_LEMOTE_YL2F89:
+ /* open the keyboard irq in i8259A */
+ outb((0xff & ~(1 << I8042_KBD_IRQ)), PIC_MASTER_IMR);
+ irq_mask = inb(PIC_MASTER_IMR);
+
+ /* enable keyboard port */
+ i8042_enable_kbd_port();
+ break;
+ default:
+ break;
+ }
+}
--
1.6.2.1





Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework

by Ralf Baechle DL5RB :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 11, 2009 at 02:52:36PM +0800, Wu Zhangjin wrote:

Folded into the existing patches

  MIPS: Loongson: Register reserved memory pages
  MIPS: Loongson: Add basic Loongson 2F support

Thanks,

  Ralf


Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework

by Pavel Machek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed 2009-11-11 14:57:05, Wu Zhangjin wrote:

> (Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
>
> This patch add basic suspend support for loongson2f family machines,
> loongson2f have a specific feature: when we set it's frequency to ZERO,
> it will go into a wait mode, and then can be waked up by the external
> interrupt. so, if we setup suitable interrupts before putting it into
> wait mode, we will be able wake it up whenever we want via sending the
> relative interrupts to it.
>
> These interrupts are board-specific, Yeeloong2F use the keyboard
> interrupt and SCI interrupt, but LingLoong and Fuloong2F use the
> interrupts connected to the processors directly. and BTW: some old
> LingLoong and FuLoong2F have no such interrupts connected, so, there is
> no way to wake them up from suspend mode. and therefore, please do not
> enable the kernel support for them.
>
> The board-specific support will be added in the coming patches.
>
> Signed-off-by: Wu Zhangjin <wuzhangjin@...>

Comments are slighlty "interesting", but otherwise it looks ok.

> + /* stop all perf counters */
> + stop_perf_counters();

This is not exactly useful comment, right?

> + /* mach specific suspend */
> + mach_suspend();
...
> + /* mach specific resume */
> + mach_resume();


It is probably ok, but you may want to avoid them in future.

ACK.
                                                                        Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Re: [PATCH -queue 2/2] [loongson] yeeloong2f: add board specific suspend support

by Pavel Machek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed 2009-11-11 14:57:41, Wu Zhangjin wrote:

> (Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
>
> Lemote loongson2f family machines need an external interrupt to wake up
> the system from the suspend mode.
>
> For the new Fuloong2f and LingLoong2f, they add a button to send the
> interrupt to the cpu directly, so, there is no need to setup an
> interrupt for them.
>
> But for YeeLoong2f and Mengloong2f, there is no hardware change, So, we
> setup the keyboard interrupt as the wakeup interrupt, this patch does
> it!
>
> Signed-off-by: Wu Zhangjin <wuzhangjin@...>

Looks good. ACK.

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework

by Ralf Baechle DL5RB :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 11, 2009 at 10:41:42AM +0100, Ralf Baechle wrote:

> On Wed, Nov 11, 2009 at 02:52:36PM +0800, Wu Zhangjin wrote:
>
> Folded into the existing patches
>
>   MIPS: Loongson: Register reserved memory pages
>   MIPS: Loongson: Add basic Loongson 2F support
>
> Thanks,

Ignore this mail - I replied to the wrong mail.

  Ralf


Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework

by Wu Zhangjin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Wed, 2009-11-11 at 11:33 +0100, Pavel Machek wrote:

> On Wed 2009-11-11 14:57:05, Wu Zhangjin wrote:
> > (Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
> >
> > This patch add basic suspend support for loongson2f family machines,
> > loongson2f have a specific feature: when we set it's frequency to ZERO,
> > it will go into a wait mode, and then can be waked up by the external
> > interrupt. so, if we setup suitable interrupts before putting it into
> > wait mode, we will be able wake it up whenever we want via sending the
> > relative interrupts to it.
> >
> > These interrupts are board-specific, Yeeloong2F use the keyboard
> > interrupt and SCI interrupt, but LingLoong and Fuloong2F use the
> > interrupts connected to the processors directly. and BTW: some old
> > LingLoong and FuLoong2F have no such interrupts connected, so, there is
> > no way to wake them up from suspend mode. and therefore, please do not
> > enable the kernel support for them.
> >
> > The board-specific support will be added in the coming patches.
> >
> > Signed-off-by: Wu Zhangjin <wuzhangjin@...>
>
> Comments are slighlty "interesting", but otherwise it looks ok.
>
> > + /* stop all perf counters */
> > + stop_perf_counters();
>
> This is not exactly useful comment, right?
>
 
Will remove it later ;) the same to the following two.

> > + /* mach specific suspend */
> > + mach_suspend();
> ...
> > + /* mach specific resume */
> > + mach_resume();
>
>
> It is probably ok, but you may want to avoid them in future.
>
> ACK.
> Pavel
>

Thanks!
        Wu Zhangjin



Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework

by Ralf Baechle DL5RB :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 11, 2009 at 11:33:04AM +0100, Pavel Machek wrote:

> On Wed 2009-11-11 14:57:05, Wu Zhangjin wrote:
> > (Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
> >
> > This patch add basic suspend support for loongson2f family machines,
> > loongson2f have a specific feature: when we set it's frequency to ZERO,
> > it will go into a wait mode, and then can be waked up by the external
> > interrupt. so, if we setup suitable interrupts before putting it into
> > wait mode, we will be able wake it up whenever we want via sending the
> > relative interrupts to it.
> >
> > These interrupts are board-specific, Yeeloong2F use the keyboard
> > interrupt and SCI interrupt, but LingLoong and Fuloong2F use the
> > interrupts connected to the processors directly. and BTW: some old
> > LingLoong and FuLoong2F have no such interrupts connected, so, there is
> > no way to wake them up from suspend mode. and therefore, please do not
> > enable the kernel support for them.
> >
> > The board-specific support will be added in the coming patches.
> >
> > Signed-off-by: Wu Zhangjin <wuzhangjin@...>
>
> Comments are slighlty "interesting", but otherwise it looks ok.
>
> > + /* stop all perf counters */
> > + stop_perf_counters();
>
> This is not exactly useful comment, right?
>
> > + /* mach specific suspend */
> > + mach_suspend();
> ...
> > + /* mach specific resume */
> > + mach_resume();
>
>
> It is probably ok, but you may want to avoid them in future.
>
> ACK.

Thanks.  Queued for 2.6.33 with the comments cleaned up.

  Ralf


Re: [PATCH -queue 2/2] [loongson] yeeloong2f: add board specific suspend support

by Ralf Baechle DL5RB :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 11, 2009 at 11:33:40AM +0100, Pavel Machek wrote:

> > Lemote loongson2f family machines need an external interrupt to wake up
> > the system from the suspend mode.
> >
> > For the new Fuloong2f and LingLoong2f, they add a button to send the
> > interrupt to the cpu directly, so, there is no need to setup an
> > interrupt for them.
> >
> > But for YeeLoong2f and Mengloong2f, there is no hardware change, So, we
> > setup the keyboard interrupt as the wakeup interrupt, this patch does
> > it!
> >
> > Signed-off-by: Wu Zhangjin <wuzhangjin@...>
>
> Looks good. ACK.

Thanks folks.  Queued for 2.6.33,

  Ralf