From: Grant Likely <grant.likely@secretlab.ca>
To: Daniel Drake <dsd@laptop.org>
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
x86@kernel.org, linux-kernel@vger.kernel.org,
dilinger@queued.net, devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH 10/11] x86, olpc: Add XO-1 RTC driver
Date: Thu, 19 May 2011 13:35:25 -0600 [thread overview]
Message-ID: <20110519193525.GS5109@ponder.secretlab.ca> (raw)
In-Reply-To: <1304166750-31125-11-git-send-email-dsd@laptop.org>
On Sat, Apr 30, 2011 at 01:32:29PM +0100, Daniel Drake wrote:
> Add a driver to configure the XO-1 RTC via CS5536 MSRs, to be used as a
> system wakeup source via olpc-xo1-pm.
>
> Device detection is based on finding the relevant device tree node.
>
> Signed-off-by: Daniel Drake <dsd@laptop.org>
> Cc: devicetree-discuss@lists.ozlabs.org
Looks good to me.
Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> .../devicetree/bindings/rtc/olpc-xo1-rtc.txt | 5 +
> arch/x86/Kconfig | 7 ++
> arch/x86/platform/olpc/Makefile | 1 +
> arch/x86/platform/olpc/olpc-xo1-rtc.c | 82 ++++++++++++++++++++
> include/linux/cs5535.h | 5 +
> 5 files changed, 100 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
> create mode 100644 arch/x86/platform/olpc/olpc-xo1-rtc.c
>
> diff --git a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
> new file mode 100644
> index 0000000..a2891ce
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
> @@ -0,0 +1,5 @@
> +OLPC XO-1 RTC
> +~~~~~~~~~~~~~
> +
> +Required properties:
> + - compatible : "olpc,xo1-rtc"
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 583e1c5..eb9f377 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2072,6 +2072,13 @@ config OLPC_XO1_PM
> ---help---
> Add support for poweroff and suspend of the OLPC XO-1 laptop.
>
> +config OLPC_XO1_RTC
> + bool "OLPC XO-1 Real Time Clock"
> + depends on OLPC_XO1_PM && RTC_DRV_CMOS
> + ---help---
> + Add support for the XO-1 real time clock, which can be used as a
> + programmable wakeup source.
> +
> config OLPC_XO1_SCI
> bool "OLPC XO-1 SCI extras"
> depends on OLPC && OLPC_XO1_PM && POWER_SUPPLY
> diff --git a/arch/x86/platform/olpc/Makefile b/arch/x86/platform/olpc/Makefile
> index 1ec5ade..8922b9b 100644
> --- a/arch/x86/platform/olpc/Makefile
> +++ b/arch/x86/platform/olpc/Makefile
> @@ -1,3 +1,4 @@
> obj-$(CONFIG_OLPC) += olpc.o olpc_ofw.o olpc_dt.o
> obj-$(CONFIG_OLPC_XO1_PM) += olpc-xo1-pm.o xo1-wakeup.o
> +obj-$(CONFIG_OLPC_XO1_RTC) += olpc-xo1-rtc.o
> obj-$(CONFIG_OLPC_XO1_SCI) += olpc-xo1-sci.o
> diff --git a/arch/x86/platform/olpc/olpc-xo1-rtc.c b/arch/x86/platform/olpc/olpc-xo1-rtc.c
> new file mode 100644
> index 0000000..476cc98
> --- /dev/null
> +++ b/arch/x86/platform/olpc/olpc-xo1-rtc.c
> @@ -0,0 +1,82 @@
> +/*
> + * Support for OLPC XO-1 Real Time Clock (RTC)
> + *
> + * Copyright (C) 2011 One Laptop per Child
> + *
> + * 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/mc146818rtc.h>
> +#include <linux/platform_device.h>
> +#include <linux/rtc.h>
> +#include <linux/of.h>
> +
> +#include <asm/msr.h>
> +#include <asm/olpc.h>
> +
> +static void rtc_wake_on(struct device *dev)
> +{
> + olpc_xo1_pm_wakeup_set(CS5536_PM_RTC);
> +}
> +
> +static void rtc_wake_off(struct device *dev)
> +{
> + olpc_xo1_pm_wakeup_clear(CS5536_PM_RTC);
> +}
> +
> +static struct resource rtc_platform_resource[] = {
> + [0] = {
> + .start = RTC_PORT(0),
> + .end = RTC_PORT(1),
> + .flags = IORESOURCE_IO,
> + },
> + [1] = {
> + .start = RTC_IRQ,
> + .end = RTC_IRQ,
> + .flags = IORESOURCE_IRQ,
> + }
> +};
> +
> +static struct cmos_rtc_board_info rtc_info = {
> + .rtc_day_alarm = 0,
> + .rtc_mon_alarm = 0,
> + .rtc_century = 0,
> + .wake_on = rtc_wake_on,
> + .wake_off = rtc_wake_off,
> +};
> +
> +static struct platform_device xo1_rtc_device = {
> + .name = "rtc_cmos",
> + .id = -1,
> + .num_resources = ARRAY_SIZE(rtc_platform_resource),
> + .dev.platform_data = &rtc_info,
> + .resource = rtc_platform_resource,
> +};
> +
> +static int __init xo1_rtc_init(void)
> +{
> + int r;
> + struct device_node *node;
> +
> + node = of_find_compatible_node(NULL, NULL, "olpc,xo1-rtc");
> + if (!node)
> + return 0;
> + of_node_put(node);
> +
> + pr_info("olpc-xo1-rtc: Initializing OLPC XO-1 RTC\n");
> + rdmsrl(MSR_RTC_DOMA_OFFSET, rtc_info.rtc_day_alarm);
> + rdmsrl(MSR_RTC_MONA_OFFSET, rtc_info.rtc_mon_alarm);
> + rdmsrl(MSR_RTC_CEN_OFFSET, rtc_info.rtc_century);
> +
> + r = platform_device_register(&xo1_rtc_device);
> + if (r)
> + return r;
> +
> + device_init_wakeup(&xo1_rtc_device.dev, 1);
> + return 0;
> +}
> +arch_initcall(xo1_rtc_init);
> +
> diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h
> index f2b4a2f..3f98d81 100644
> --- a/include/linux/cs5535.h
> +++ b/include/linux/cs5535.h
> @@ -38,6 +38,10 @@
> #define MSR_MFGPT_NR 0x51400029
> #define MSR_MFGPT_SETUP 0x5140002B
>
> +#define MSR_RTC_DOMA_OFFSET 0x51400055
> +#define MSR_RTC_MONA_OFFSET 0x51400056
> +#define MSR_RTC_CEN_OFFSET 0x51400057
> +
> #define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */
>
> #define MSR_GX_GLD_MSR_CONFIG 0xC0002001
> @@ -81,6 +85,7 @@
>
> /* CS5536_PM1_EN bits */
> #define CS5536_PM_PWRBTN (1 << 8)
> +#define CS5536_PM_RTC (1 << 10)
>
> /* CS5536_PM_GPE0_STS bits */
> #define CS5536_GPIOM7_PME_FLAG (1 << 31)
> --
> 1.7.4.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2011-05-19 19:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-30 12:32 [PATCH 0/11] OLPC Power Management Daniel Drake
2011-04-30 12:32 ` [PATCH 01/11] x86, olpc: add missing elements to device tree Daniel Drake
2011-04-30 12:32 ` Daniel Drake
2011-04-30 12:32 ` [PATCH 02/11] x86, olpc: Move CS5536-related constants to cs5535.h Daniel Drake
2011-04-30 12:32 ` [PATCH 03/11] x86, olpc: rename olpc-xo1 to olpc-xo1-pm Daniel Drake
2011-04-30 12:32 ` [PATCH 04/11] x86, olpc: Add XO-1 suspend/resume support Daniel Drake
2011-04-30 12:32 ` [PATCH 05/11] x86, olpc: Add XO-1 SCI driver and power button control Daniel Drake
2011-04-30 12:32 ` [PATCH 06/11] x86, olpc: EC SCI wakeup mask functionality Daniel Drake
2011-04-30 12:32 ` [PATCH 07/11] x86, olpc-xo1-sci: Add GPE handler and ebook switch functionality Daniel Drake
2011-05-16 9:08 ` Sebastian Andrzej Siewior
2011-05-16 16:07 ` Andres Salomon
2011-05-24 21:40 ` Daniel Drake
2011-05-31 11:28 ` Sebastian Andrzej Siewior
2011-05-31 20:48 ` Daniel Drake
2011-06-09 0:25 ` Andres Salomon
2011-04-30 12:32 ` [PATCH 08/11] x86, olpc-xo1-sci: Add lid " Daniel Drake
2011-04-30 12:32 ` [PATCH 09/11] x86, olpc-xo1-sci: Propagate power supply/battery events Daniel Drake
2011-04-30 12:32 ` [PATCH 10/11] x86, olpc: Add XO-1 RTC driver Daniel Drake
2011-05-16 9:18 ` Sebastian Andrzej Siewior
2011-05-16 9:18 ` Sebastian Andrzej Siewior
2011-05-19 19:35 ` Grant Likely [this message]
2011-04-30 12:32 ` [PATCH 11/11] x86, olpc: Add XO-1.5 SCI driver Daniel Drake
2011-05-16 9:24 ` Sebastian Andrzej Siewior
2011-05-24 21:52 ` Daniel Drake
2011-05-24 21:52 ` Daniel Drake
2011-04-30 17:07 ` [PATCH 0/11] OLPC Power Management Andres Salomon
2011-05-14 19:09 ` Daniel Drake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110519193525.GS5109@ponder.secretlab.ca \
--to=grant.likely@secretlab.ca \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=dilinger@queued.net \
--cc=dsd@laptop.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.