Commit 107d5a72 authored by Brent Casavant's avatar Brent Casavant Committed by Linus Torvalds

[PATCH] ioc4: Remove SN2 feature and config dependencies

The SGI PCI-RT card, based on the SGI IOC4 chip, will be made available on
Altix XE (x86_64) platforms in the near future.  As such dependencies on
SN2-specific features and config dependencies need to be removed.

This patch updates the Kconfig files to remove the config dependency, and
updates the IOC4 bus speed detection routine to use universally available
time interfaces instead of mmtimer.
Signed-off-by: default avatarBrent Casavant <bcasavan@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4d99bfac
...@@ -7,16 +7,15 @@ menu "SN Devices" ...@@ -7,16 +7,15 @@ menu "SN Devices"
config SGI_IOC4 config SGI_IOC4
tristate "SGI IOC4 Base IO support" tristate "SGI IOC4 Base IO support"
depends on MMTIMER
default m default m
---help--- ---help---
This option enables basic support for the SGI IOC4-based Base IO This option enables basic support for the IOC4 chip on certain
controller card. This option does not enable any specific SGI IO controller cards (IO9, IO10, and PCI-RT). This option
functions on such a card, but provides necessary infrastructure does not enable any specific functions on such a card, but provides
for other drivers to utilize. necessary infrastructure for other drivers to utilize.
If you have an SGI Altix with an IOC4-based If you have an SGI Altix with an IOC4-based card say Y.
I/O controller say Y. Otherwise say N. Otherwise say N.
config SGI_IOC3 config SGI_IOC3
tristate "SGI IOC3 Base IO support" tristate "SGI IOC3 Base IO support"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* License. See the file "COPYING" in the main directory of this archive * License. See the file "COPYING" in the main directory of this archive
* for more details. * for more details.
* *
* Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved. * Copyright (C) 2005-2006 Silicon Graphics, Inc. All Rights Reserved.
*/ */
/* This file contains the master driver module for use by SGI IOC4 subdrivers. /* This file contains the master driver module for use by SGI IOC4 subdrivers.
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/ioc4.h> #include <linux/ioc4.h>
#include <linux/mmtimer.h> #include <linux/ktime.h>
#include <linux/rtc.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/time.h>
#include <asm/sn/addrs.h> #include <asm/sn/addrs.h>
#include <asm/sn/clksupport.h> #include <asm/sn/clksupport.h>
#include <asm/sn/shub_mmr.h> #include <asm/sn/shub_mmr.h>
...@@ -143,11 +143,11 @@ ioc4_unregister_submodule(struct ioc4_submodule *is) ...@@ -143,11 +143,11 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
static void static void
ioc4_clock_calibrate(struct ioc4_driver_data *idd) ioc4_clock_calibrate(struct ioc4_driver_data *idd)
{ {
extern unsigned long sn_rtc_cycles_per_second;
union ioc4_int_out int_out; union ioc4_int_out int_out;
union ioc4_gpcr gpcr; union ioc4_gpcr gpcr;
unsigned int state, last_state = 1; unsigned int state, last_state = 1;
uint64_t start = 0, end, period; struct timespec start_ts, end_ts;
uint64_t start, end, period;
unsigned int count = 0; unsigned int count = 0;
/* Enable output */ /* Enable output */
...@@ -175,30 +175,28 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd) ...@@ -175,30 +175,28 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd)
if (!last_state && state) { if (!last_state && state) {
count++; count++;
if (count == IOC4_CALIBRATE_END) { if (count == IOC4_CALIBRATE_END) {
end = rtc_time(); ktime_get_ts(&end_ts);
break; break;
} else if (count == IOC4_CALIBRATE_DISCARD) } else if (count == IOC4_CALIBRATE_DISCARD)
start = rtc_time(); ktime_get_ts(&start_ts);
} }
last_state = state; last_state = state;
} while (1); } while (1);
/* Calculation rearranged to preserve intermediate precision. /* Calculation rearranged to preserve intermediate precision.
* Logically: * Logically:
* 1. "end - start" gives us number of RTC cycles over all the * 1. "end - start" gives us the measurement period over all
* square wave cycles measured. * the square wave cycles.
* 2. Divide by number of square wave cycles to get number of * 2. Divide by number of square wave cycles to get the period
* RTC cycles per square wave cycle. * of a square wave cycle.
* 3. Divide by 2*(int_out.fields.count+1), which is the formula * 3. Divide by 2*(int_out.fields.count+1), which is the formula
* by which the IOC4 generates the square wave, to get the * by which the IOC4 generates the square wave, to get the
* number of RTC cycles per IOC4 INT_OUT count. * period of an IOC4 INT_OUT count.
* 4. Divide by sn_rtc_cycles_per_second to get seconds per
* count.
* 5. Multiply by 1E9 to get nanoseconds per count.
*/ */
period = ((end - start) * 1000000000) / end = end_ts.tv_sec * NSEC_PER_SEC + end_ts.tv_nsec;
(IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1) start = start_ts.tv_sec * NSEC_PER_SEC + start_ts.tv_nsec;
* sn_rtc_cycles_per_second); period = (end - start) /
(IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1));
/* Bounds check the result. */ /* Bounds check the result. */
if (period > IOC4_CALIBRATE_LOW_LIMIT || if (period > IOC4_CALIBRATE_LOW_LIMIT ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment