x86/mrst: add Moorestown specific reboot/shutdown support
Subsystems (2)
PATCH 1/3 x86/mrst: add Moorestown specific reboot/shutdown support
From: Alek Du <[email protected]>
Moorestowns needs to use a special IPC command to reboot or shutdown the platform.
---
arch/x86/platform/mrst/mrst.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
arch/x86/platform/mrst/mrst.c +16 -0
@@ -35,6 +35,7 @@#include <asm/i8259.h> #include <asm/intel_scu_ipc.h> #include <asm/apb_timer.h> +#include <asm/reboot.h> /*
@@ -268,6 +269,17 @@ static int mrst_i8042_detect(void)return 0 ; } +/* Reboot and power off are handled by the SCU on a MID device */ +static void mrst_power_off (void ) +{ +intel_scu_ipc_simple_command (0xf1 ,1 ); +} + +static void mrst_reboot (void ) +{ +intel_scu_ipc_simple_command (0xf1 ,0 ); +} +/* * Moorestown specific x86_init function overrides and early setup * calls.
@@ -293,6 +305,10 @@ void __init x86_mrst_early_setup(void) legacy_pic = &null_legacy_pic; +/* Moorestown specific power_off/restart method */ + pm_power_off = mrst_power_off; + machine_ops.emergency_restart = mrst_reboot; +/* Avoid searching for BIOS MP tables */ x86_init.mpparse.find_smp_config = x86_init_noop; x86_init.mpparse.get_smp_config = x86_init_uint_noop;
PATCH 2/3 x86/mrst: add vrtc driver which serves as a wall clock device
From: Feng Tang <[email protected]>
The Moorestown platform doesn't have a m146818 RTC device like traditional x86 PC, but a firmware emulated virtual RTC device(vrtc), which provides some basic RTC functions like get/set time. vrtc serves as the only wall clock device on Moorestown platform.
---
arch/x86/include/asm/fixmap.h | 4 + arch/x86/include/asm/mrst-vrtc.h | 9 +++ arch/x86/include/asm/mrst.h | 10 +++ arch/x86/platform/mrst/Makefile | 1 arch/x86/platform/mrst/mrst.c | 6 -- arch/x86/platform/mrst/vrtc.c | 120 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 143 insertions(+), 7 deletions(-) create mode 100644 arch/x86/include/asm/mrst-vrtc.h create mode 100644 arch/x86/platform/mrst/vrtc.c
arch/x86/include/asm/fixmap.h +4 -0
@@ -117,6 +117,10 @@ enum fixed_addresses {FIX_TEXT_POKE1 ,/* reserve 2 pages for text_poke() */ FIX_TEXT_POKE0 ,/* first page is last, because allocation is backward */ __end_of_permanent_fixed_addresses, + +#ifdef CONFIG_X86_MRST + FIX_LNW_VRTC, +#endif/* * 256 temporary boot-time mappings, used by early_ioremap(), * before ioremap() is functional.
arch/x86/include/asm/mrst-vrtc.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef _MRST_VRTC_H +#define _MRST_VRTC_H + +extern unsigned char vrtc_cmos_read (unsigned char reg); +extern void vrtc_cmos_write (unsigned char val,unsigned char reg); +extern unsigned long vrtc_get_time (void ); +extern int vrtc_set_mmss (unsigned long nowtime); + +#endif
arch/x86/include/asm/mrst.h +9 -1
@@ -14,7 +14,9 @@#include <linux/sfi.h> extern int pci_mrst_init (void ); -int __init sfi_parse_mrtc (struct sfi_table_header *table); +extern int __init sfi_parse_mrtc (struct sfi_table_header *table); +extern int sfi_mrtc_num; +extern struct sfi_rtc_table_entry sfi_mrtc_array[];/* * Medfield is the follow-up of Moorestown, it combines two chip solution into
@@ -54,4 +56,10 @@ extern void hsu_early_console_init(void);extern void intel_scu_devices_create (void );extern void intel_scu_devices_destroy (void ); +/* VRTC timer */ +#define MRST_VRTC_MAP_SZ (1024) +/*#define MRST_VRTC_PGOFFSET (0xc00) */ + +extern void mrst_rtc_init (void ); +#endif /* _ASM_X86_MRST_H */
arch/x86/platform/mrst/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_X86_MRST) += mrst.o +obj-$(CONFIG_X86_MRST) += vrtc.o
arch/x86/platform/mrst/mrst.c +0 -6
@@ -37,7 +37,6 @@#include <asm/apb_timer.h> #include <asm/reboot.h> -/* * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock, * cmdline option x86_mrst_timer can be used to override the configuration
@@ -242,11 +241,6 @@ void __init mrst_time_init(void)apbt_time_init (); } -void __init mrst_rtc_init (void ) -{ -sfi_table_parse (SFI_SIG_MRTC ,NULL ,NULL , sfi_parse_mrtc); -} -void __cpuinit mrst_arch_setup (void ) {if (boot_cpu_data.x86 ==6 && boot_cpu_data.x86_model ==0x27 )
arch/x86/platform/mrst/vrtc.c new file +120 -0
120 lines not on this page · raw message
PATCH 3/3 vrtc: add drivers/rtc/rtc-mrst.c
In reply to Alan CoxFrom: Feng Tang <[email protected]>
Provide the standard kernel rtc driver interface on top of the vrtc layer added in the previous patch.
---
arch/x86/platform/mrst/vrtc.c | 44 +++ drivers/rtc/Kconfig | 12 + drivers/rtc/Makefile | 1 drivers/rtc/rtc-mrst.c | 578 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 635 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-mrst.c
arch/x86/platform/mrst/vrtc.c +44 -0
@@ -118,3 +118,47 @@ void __init mrst_rtc_init(void) x86_platform.get_wallclock = vrtc_get_time; x86_platform.set_wallclock = vrtc_set_mmss; } + +/* +* The Moorestown platform has a memory mapped virtual RTC device that emulates +* the programming interface of the RTC. +*/ + +static struct resource vrtc_resources[] = { + [0 ] = { + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .flags =IORESOURCE_IRQ , + } +}; + +static struct platform_device vrtc_device = { + .name ="rtc_mrst" , + .id =-1 , + .resource = vrtc_resources, + .num_resources =ARRAY_SIZE (vrtc_resources), +}; + +/* Register the RTC device if appropriate */ +static void __init mrst_device_create (void ) +{ +/* No Moorestown, no device */ +if (!mrst_identify_cpu ()) +return ; +/* No timer, no device */ +if (!sfi_mrtc_num) +return ; + +/* iomem resource */ + vrtc_resources[0 ].start = sfi_mrtc_array[0 ].phys_addr; + vrtc_resources[0 ].end = sfi_mrtc_array[0 ].phys_addr + +MRST_VRTC_MAP_SZ ; +/* irq resource */ + vrtc_resources[1 ].start = sfi_mrtc_array[0 ].irq; + vrtc_resources[1 ].end = sfi_mrtc_array[0 ].irq; + +platform_device_register (&vrtc_device); +} + +module_init (mrst_device_create);
drivers/rtc/Kconfig +12 -0
@@ -463,6 +463,18 @@ config RTC_DRV_CMOS This driver can also be built as a module. If so, the module will be called rtc-cmos. +config RTC_DRV_VRTC + tristate "Virtual RTC for Moorestown platforms" + depends on X86_MRST + default y if X86_MRST + + help + Say "yes" here to get direct support for the real time clock + found on Moorestown platforms. The VRTC is a emulated RTC that + derives its clock source from a real RTC in the PMIC. The MC146818 + style programming interface is mostly conserved, but any + updates are done via IPC calls to the system controller FW. + config RTC_DRV_DS1216 tristate "Dallas DS1216" depends on SNI_RM
drivers/rtc/Makefile +1 -0
@@ -30,6 +30,7 @@ obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o obj-$(CONFIG_RTC_DRV_COH901331) += rtc-coh901331.o obj-$(CONFIG_RTC_DRV_DAVINCI) += rtc-davinci.o obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o +obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o obj-$(CONFIG_RTC_DRV_DS1216) += rtc-ds1216.o obj-$(CONFIG_RTC_DRV_DS1286) += rtc-ds1286.o obj-$(CONFIG_RTC_DRV_DS1302) += rtc-ds1302.o
drivers/rtc/rtc-mrst.c new file +578 -0
578 lines not on this page · raw message