mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for David Cohen <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	sathyanarayanan.kuppuswamy@linux.intel.com,
	david.a.cohen@linux.intel.com, tglx@linutronix.de,
	hpa@linux.intel.com
Subject: [tip:x86/intel-mid] x86, intel-mid: Move Medfield code out of intel-mid.c core file
Date: Wed, 15 Jan 2014 14:42:40 -0800	[thread overview]
Message-ID: <tip-ecd6910db979bc40ac19f0e71e027132fc906068@git.kernel.org> (raw)
In-Reply-To: <1387224459-25746-2-git-send-email-david.a.cohen@linux.intel.com>

Commit-ID:  ecd6910db979bc40ac19f0e71e027132fc906068
Gitweb:     http://git.kernel.org/tip/ecd6910db979bc40ac19f0e71e027132fc906068
Author:     David Cohen <david.a.cohen@linux.intel.com>
AuthorDate: Mon, 16 Dec 2013 12:07:36 -0800
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Wed, 15 Jan 2014 14:38:58 -0800

x86, intel-mid: Move Medfield code out of intel-mid.c core file

In order make the driver more portable and support other Intel MID
(Mobile Internet Device) platforms we need to move Medfield code from
intel-mid.c core to its own mfld.c file.

This patch contains no functional changes.

Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Link: http://lkml.kernel.org/r/1387224459-25746-2-git-send-email-david.a.cohen@linux.intel.com
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/platform/intel-mid/Makefile               |  4 +-
 arch/x86/platform/intel-mid/intel-mid.c            | 37 +---------------
 arch/x86/platform/intel-mid/intel_mid_weak_decls.h | 15 +++++++
 arch/x86/platform/intel-mid/mfld.c                 | 51 ++++++++++++++++++++++
 4 files changed, 70 insertions(+), 37 deletions(-)

diff --git a/arch/x86/platform/intel-mid/Makefile b/arch/x86/platform/intel-mid/Makefile
index 01cc29e..78a14ba 100644
--- a/arch/x86/platform/intel-mid/Makefile
+++ b/arch/x86/platform/intel-mid/Makefile
@@ -1,6 +1,6 @@
-obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o
-obj-$(CONFIG_X86_INTEL_MID) += intel_mid_vrtc.o
+obj-$(CONFIG_X86_INTEL_MID) += intel-mid.o intel_mid_vrtc.o mfld.o
 obj-$(CONFIG_EARLY_PRINTK_INTEL_MID) += early_printk_intel_mid.o
+
 # SFI specific code
 ifdef CONFIG_X86_INTEL_MID
 obj-$(CONFIG_SFI) += sfi.o device_libs/
diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c
index f90e290..527d6d5 100644
--- a/arch/x86/platform/intel-mid/intel-mid.c
+++ b/arch/x86/platform/intel-mid/intel-mid.c
@@ -35,6 +35,8 @@
 #include <asm/apb_timer.h>
 #include <asm/reboot.h>
 
+#include "intel_mid_weak_decls.h"
+
 /*
  * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock,
  * cmdline option x86_intel_mid_timer can be used to override the configuration
@@ -61,46 +63,11 @@ enum intel_mid_timer_options intel_mid_timer_options;
 enum intel_mid_cpu_type __intel_mid_cpu_chip;
 EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip);
 
-static void intel_mid_power_off(void)
-{
-}
-
 static void intel_mid_reboot(void)
 {
 	intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0);
 }
 
-static unsigned long __init intel_mid_calibrate_tsc(void)
-{
-	unsigned long fast_calibrate;
-	u32 lo, hi, ratio, fsb;
-
-	rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
-	pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi);
-	ratio = (hi >> 8) & 0x1f;
-	pr_debug("ratio is %d\n", ratio);
-	if (!ratio) {
-		pr_err("read a zero ratio, should be incorrect!\n");
-		pr_err("force tsc ratio to 16 ...\n");
-		ratio = 16;
-	}
-	rdmsr(MSR_FSB_FREQ, lo, hi);
-	if ((lo & 0x7) == 0x7)
-		fsb = PENWELL_FSB_FREQ_83SKU;
-	else
-		fsb = PENWELL_FSB_FREQ_100SKU;
-	fast_calibrate = ratio * fsb;
-	pr_debug("read penwell tsc %lu khz\n", fast_calibrate);
-	lapic_timer_frequency = fsb * 1000 / HZ;
-	/* mark tsc clocksource as reliable */
-	set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE);
-
-	if (fast_calibrate)
-		return fast_calibrate;
-
-	return 0;
-}
-
 static void __init intel_mid_time_init(void)
 {
 	sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr);
diff --git a/arch/x86/platform/intel-mid/intel_mid_weak_decls.h b/arch/x86/platform/intel-mid/intel_mid_weak_decls.h
new file mode 100644
index 0000000..519beb7
--- /dev/null
+++ b/arch/x86/platform/intel-mid/intel_mid_weak_decls.h
@@ -0,0 +1,15 @@
+/*
+ * intel_mid_weak_decls.h: Weak declarations of intel-mid.c
+ *
+ * (C) Copyright 2013 Intel Corporation
+ *
+ * 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; version 2
+ * of the License.
+ */
+
+
+/* __attribute__((weak)) makes these declarations overridable */
+extern void intel_mid_power_off(void) __attribute__((weak));
+extern unsigned long __init intel_mid_calibrate_tsc(void) __attribute__((weak));
diff --git a/arch/x86/platform/intel-mid/mfld.c b/arch/x86/platform/intel-mid/mfld.c
new file mode 100644
index 0000000..c7ff83c
--- /dev/null
+++ b/arch/x86/platform/intel-mid/mfld.c
@@ -0,0 +1,51 @@
+/*
+ * mfld.c: Intel Medfield platform setup code
+ *
+ * (C) Copyright 2013 Intel Corporation
+ *
+ * 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; version 2
+ * of the License.
+ */
+
+#include <linux/init.h>
+
+#include <asm/apic.h>
+#include <asm/intel-mid.h>
+#include <asm/intel_mid_vrtc.h>
+
+void intel_mid_power_off(void)
+{
+}
+
+unsigned long __init intel_mid_calibrate_tsc(void)
+{
+	unsigned long fast_calibrate;
+	u32 lo, hi, ratio, fsb;
+
+	rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
+	pr_debug("IA32 perf status is 0x%x, 0x%0x\n", lo, hi);
+	ratio = (hi >> 8) & 0x1f;
+	pr_debug("ratio is %d\n", ratio);
+	if (!ratio) {
+		pr_err("read a zero ratio, should be incorrect!\n");
+		pr_err("force tsc ratio to 16 ...\n");
+		ratio = 16;
+	}
+	rdmsr(MSR_FSB_FREQ, lo, hi);
+	if ((lo & 0x7) == 0x7)
+		fsb = PENWELL_FSB_FREQ_83SKU;
+	else
+		fsb = PENWELL_FSB_FREQ_100SKU;
+	fast_calibrate = ratio * fsb;
+	pr_debug("read penwell tsc %lu khz\n", fast_calibrate);
+	lapic_timer_frequency = fsb * 1000 / HZ;
+	/* mark tsc clocksource as reliable */
+	set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE);
+
+	if (fast_calibrate)
+		return fast_calibrate;
+
+	return 0;
+}

  reply	other threads:[~2014-01-15 22:43 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 20:07 [PATCH v2 0/4] Add Clovertrail and Merrifeld support to Intel MID David Cohen
2013-12-16 20:07 ` [PATCH v2 1/4] x86: intel-mid: move Medfield code out of intel-mid.c core file David Cohen
2014-01-15 22:42   ` tip-bot for David Cohen [this message]
2013-12-16 20:07 ` [PATCH v2 2/4] x86: intel-mid: add Clovertrail platform support David Cohen
2014-01-15 22:42   ` [tip:x86/intel-mid] x86, intel-mid: Add " tip-bot for Kuppuswamy Sathyanarayanan
2013-12-16 20:07 ` [PATCH v2 3/4] x86: intel-mid: add Merrifield " David Cohen
2014-01-15 22:43   ` [tip:x86/intel-mid] x86, intel-mid: Add " tip-bot for David Cohen
2014-01-28  0:52   ` [PATCH v2 3/4] x86: intel-mid: add " Bjorn Helgaas
2014-01-28  1:30     ` David Cohen
2014-01-28 18:40       ` Bjorn Helgaas
2014-01-28 19:35         ` David Cohen
2014-01-28 23:09           ` [PATCH] x86: intel-mid: cleanup some platform code's header files David Cohen
2014-01-28 23:15             ` [tip:x86/intel-mid] x86, intel-mid: Cleanup some platform code' s " tip-bot for David Cohen
2013-12-16 20:07 ` [PATCH v2 4/4] x86: intel-mid: remove deprecated X86_MDFLD and X86_WANT_INTEL_MID configs David Cohen
2013-12-16 20:47   ` Bjorn Helgaas
2013-12-16 21:31     ` David Cohen
2013-12-17  1:37 ` [PATCH v2.1 " David Cohen
2013-12-20  5:42   ` [PATCH 1/2] x86: intel-mid: return proper error code from get_gpio_by_name() David Cohen
2013-12-20  5:42     ` [PATCH 2/2] x86: intel-mid: sfi_handle_*_dev() should check for pdata error code David Cohen
2013-12-20  8:49       ` Ingo Molnar
2013-12-20 17:40         ` David Cohen
2014-01-15  0:21         ` David Cohen
2014-01-15  6:58           ` Ingo Molnar
2014-01-15 17:39             ` David Cohen
2014-01-15 22:26               ` David Cohen
2014-01-16  9:50                 ` Ingo Molnar
2014-01-16 17:23                   ` David Cohen
2014-01-16 23:35                     ` David Cohen
2013-12-21  1:15     ` [PATCH v2 0/3] x86: intel-mid: handle platform code error in better way David Cohen
2013-12-21  1:15       ` [PATCH v2 1/3] x86: intel-mid: sfi_handle_*_dev() should check for pdata error code David Cohen
2013-12-21  1:15       ` [PATCH v2 2/3] x86: intel-mid: platform code should return error when failing David Cohen
2013-12-21  1:15       ` [PATCH v2 3/3] x86: intel-mid: return proper error code from get_gpio_by_name() David Cohen
2014-01-15 22:43   ` [tip:x86/intel-mid] x86, intel-mid: Remove deprecated X86_MDFLD and X86_WANT_INTEL_MID configs tip-bot for David Cohen
2014-01-14 22:44 ` [PATCH v2 0/4] Add Clovertrail and Merrifeld support to Intel MID David Cohen
2014-01-14 23:52   ` H. Peter Anvin
2014-01-15  0:13     ` David Cohen

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=tip-ecd6910db979bc40ac19f0e71e027132fc906068@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=david.a.cohen@linux.intel.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome