Commit 46056be7 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus

* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
  MIPS: Outline udelay and fix a few issues.
  MIPS: ioctl.h: Fix headers_check warnings
  MIPS: Cobalt: PCI bus is always required to obtain the board ID
  MIPS: Kconfig: Remove "Support for" from Cavium system type
  MIPS: Sibyte: Honor CONFIG_CMDLINE
  SSB: BCM47xx: Export ssb_watchdog_timer_set
parents 5284c6b9 5636919b
...@@ -72,6 +72,7 @@ config MIPS_COBALT ...@@ -72,6 +72,7 @@ config MIPS_COBALT
select IRQ_CPU select IRQ_CPU
select IRQ_GT641XX select IRQ_GT641XX
select PCI_GT64XXX_PCI0 select PCI_GT64XXX_PCI0
select PCI
select SYS_HAS_CPU_NEVADA select SYS_HAS_CPU_NEVADA
select SYS_HAS_EARLY_PRINTK select SYS_HAS_EARLY_PRINTK
select SYS_SUPPORTS_32BIT_KERNEL select SYS_SUPPORTS_32BIT_KERNEL
...@@ -593,7 +594,7 @@ config WR_PPMC ...@@ -593,7 +594,7 @@ config WR_PPMC
board, which is based on GT64120 bridge chip. board, which is based on GT64120 bridge chip.
config CAVIUM_OCTEON_SIMULATOR config CAVIUM_OCTEON_SIMULATOR
bool "Support for the Cavium Networks Octeon Simulator" bool "Cavium Networks Octeon Simulator"
select CEVT_R4K select CEVT_R4K
select 64BIT_PHYS_ADDR select 64BIT_PHYS_ADDR
select DMA_COHERENT select DMA_COHERENT
...@@ -607,7 +608,7 @@ config CAVIUM_OCTEON_SIMULATOR ...@@ -607,7 +608,7 @@ config CAVIUM_OCTEON_SIMULATOR
hardware. hardware.
config CAVIUM_OCTEON_REFERENCE_BOARD config CAVIUM_OCTEON_REFERENCE_BOARD
bool "Support for the Cavium Networks Octeon reference board" bool "Cavium Networks Octeon reference board"
select CEVT_R4K select CEVT_R4K
select 64BIT_PHYS_ADDR select 64BIT_PHYS_ADDR
select DMA_COHERENT select DMA_COHERENT
......
...@@ -39,8 +39,8 @@ struct cache_desc { ...@@ -39,8 +39,8 @@ struct cache_desc {
#define MIPS_CACHE_PINDEX 0x00000020 /* Physically indexed cache */ #define MIPS_CACHE_PINDEX 0x00000020 /* Physically indexed cache */
struct cpuinfo_mips { struct cpuinfo_mips {
unsigned long udelay_val; unsigned int udelay_val;
unsigned long asid_cache; unsigned int asid_cache;
/* /*
* Capability and feature descriptor structure for MIPS CPU * Capability and feature descriptor structure for MIPS CPU
......
...@@ -11,94 +11,12 @@ ...@@ -11,94 +11,12 @@
#ifndef _ASM_DELAY_H #ifndef _ASM_DELAY_H
#define _ASM_DELAY_H #define _ASM_DELAY_H
#include <linux/param.h> extern void __delay(unsigned int loops);
#include <linux/smp.h> extern void __ndelay(unsigned int ns);
extern void __udelay(unsigned int us);
#include <asm/compiler.h> #define ndelay(ns) __udelay(ns)
#include <asm/war.h> #define udelay(us) __udelay(us)
static inline void __delay(unsigned long loops)
{
if (sizeof(long) == 4)
__asm__ __volatile__ (
" .set noreorder \n"
" .align 3 \n"
"1: bnez %0, 1b \n"
" subu %0, 1 \n"
" .set reorder \n"
: "=r" (loops)
: "0" (loops));
else if (sizeof(long) == 8 && !DADDI_WAR)
__asm__ __volatile__ (
" .set noreorder \n"
" .align 3 \n"
"1: bnez %0, 1b \n"
" dsubu %0, 1 \n"
" .set reorder \n"
: "=r" (loops)
: "0" (loops));
else if (sizeof(long) == 8 && DADDI_WAR)
__asm__ __volatile__ (
" .set noreorder \n"
" .align 3 \n"
"1: bnez %0, 1b \n"
" dsubu %0, %2 \n"
" .set reorder \n"
: "=r" (loops)
: "0" (loops), "r" (1));
}
/*
* Division by multiplication: you don't have to worry about
* loss of precision.
*
* Use only for very small delays ( < 1 msec). Should probably use a
* lookup table, really, as the multiplications take much too long with
* short delays. This is a "reasonable" implementation, though (and the
* first constant multiplications gets optimized away if the delay is
* a constant)
*/
static inline void __udelay(unsigned long usecs, unsigned long lpj)
{
unsigned long hi, lo;
/*
* The rates of 128 is rounded wrongly by the catchall case
* for 64-bit. Excessive precission? Probably ...
*/
#if defined(CONFIG_64BIT) && (HZ == 128)
usecs *= 0x0008637bd05af6c7UL; /* 2**64 / (1000000 / HZ) */
#elif defined(CONFIG_64BIT)
usecs *= (0x8000000000000000UL / (500000 / HZ));
#else /* 32-bit junk follows here */
usecs *= (unsigned long) (((0x8000000000000000ULL / (500000 / HZ)) +
0x80000000ULL) >> 32);
#endif
if (sizeof(long) == 4)
__asm__("multu\t%2, %3"
: "=h" (usecs), "=l" (lo)
: "r" (usecs), "r" (lpj)
: GCC_REG_ACCUM);
else if (sizeof(long) == 8 && !R4000_WAR)
__asm__("dmultu\t%2, %3"
: "=h" (usecs), "=l" (lo)
: "r" (usecs), "r" (lpj)
: GCC_REG_ACCUM);
else if (sizeof(long) == 8 && R4000_WAR)
__asm__("dmultu\t%3, %4\n\tmfhi\t%0"
: "=r" (usecs), "=h" (hi), "=l" (lo)
: "r" (usecs), "r" (lpj)
: GCC_REG_ACCUM);
__delay(usecs);
}
#define __udelay_val cpu_data[raw_smp_processor_id()].udelay_val
#define udelay(usecs) __udelay((usecs), __udelay_val)
/* make sure "usecs *= ..." in udelay do not overflow. */ /* make sure "usecs *= ..." in udelay do not overflow. */
#if HZ >= 1000 #if HZ >= 1000
......
...@@ -60,12 +60,16 @@ ...@@ -60,12 +60,16 @@
((nr) << _IOC_NRSHIFT) | \ ((nr) << _IOC_NRSHIFT) | \
((size) << _IOC_SIZESHIFT)) ((size) << _IOC_SIZESHIFT))
#ifdef __KERNEL__
/* provoke compile error for invalid uses of size argument */ /* provoke compile error for invalid uses of size argument */
extern unsigned int __invalid_size_argument_for_IOC; extern unsigned int __invalid_size_argument_for_IOC;
#define _IOC_TYPECHECK(t) \ #define _IOC_TYPECHECK(t) \
((sizeof(t) == sizeof(t[1]) && \ ((sizeof(t) == sizeof(t[1]) && \
sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
sizeof(t) : __invalid_size_argument_for_IOC) sizeof(t) : __invalid_size_argument_for_IOC)
#else
#define _IOC_TYPECHECK(t) (sizeof(t))
#endif
/* used to create numbers */ /* used to create numbers */
#define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0) #define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0)
......
...@@ -42,7 +42,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -42,7 +42,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, fmt, __cpu_name[n], seq_printf(m, fmt, __cpu_name[n],
(version >> 4) & 0x0f, version & 0x0f, (version >> 4) & 0x0f, version & 0x0f,
(fp_vers >> 4) & 0x0f, fp_vers & 0x0f); (fp_vers >> 4) & 0x0f, fp_vers & 0x0f);
seq_printf(m, "BogoMIPS\t\t: %lu.%02lu\n", seq_printf(m, "BogoMIPS\t\t: %u.%02u\n",
cpu_data[n].udelay_val / (500000/HZ), cpu_data[n].udelay_val / (500000/HZ),
(cpu_data[n].udelay_val / (5000/HZ)) % 100); (cpu_data[n].udelay_val / (5000/HZ)) % 100);
seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no"); seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no");
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# Makefile for MIPS-specific library files.. # Makefile for MIPS-specific library files..
# #
lib-y += csum_partial.o memcpy.o memcpy-inatomic.o memset.o strlen_user.o \ lib-y += csum_partial.o delay.o memcpy.o memcpy-inatomic.o memset.o \
strncpy_user.o strnlen_user.o uncached.o strlen_user.o strncpy_user.o strnlen_user.o uncached.o
obj-y += iomap.o obj-y += iomap.o
obj-$(CONFIG_PCI) += iomap-pci.o obj-$(CONFIG_PCI) += iomap-pci.o
......
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1994 by Waldorf Electronics
* Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
* Copyright (C) 2007 Maciej W. Rozycki
*/
#include <linux/module.h>
#include <linux/param.h>
#include <linux/smp.h>
#include <asm/compiler.h>
#include <asm/war.h>
inline void __delay(unsigned int loops)
{
__asm__ __volatile__ (
" .set noreorder \n"
" .align 3 \n"
"1: bnez %0, 1b \n"
" subu %0, 1 \n"
" .set reorder \n"
: "=r" (loops)
: "0" (loops));
}
EXPORT_SYMBOL(__delay);
/*
* Division by multiplication: you don't have to worry about
* loss of precision.
*
* Use only for very small delays ( < 1 msec). Should probably use a
* lookup table, really, as the multiplications take much too long with
* short delays. This is a "reasonable" implementation, though (and the
* first constant multiplications gets optimized away if the delay is
* a constant)
*/
void __udelay(unsigned long us)
{
unsigned int lpj = current_cpu_data.udelay_val;
__delay((us * 0x000010c7 * HZ * lpj) >> 32);
}
EXPORT_SYMBOL(__udelay);
void __ndelay(unsigned long ns)
{
unsigned int lpj = current_cpu_data.udelay_val;
__delay((us * 0x00000005 * HZ * lpj) >> 32);
}
EXPORT_SYMBOL(__ndelay);
...@@ -288,13 +288,7 @@ void __init prom_init(void) ...@@ -288,13 +288,7 @@ void __init prom_init(void)
*/ */
cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE);
if (cfe_getenv("LINUX_CMDLINE", arcs_cmdline, CL_SIZE) < 0) { if (cfe_getenv("LINUX_CMDLINE", arcs_cmdline, CL_SIZE) < 0) {
if (argc < 0) { if (argc >= 0) {
/*
* It's OK for direct boot to not provide a
* command line
*/
strcpy(arcs_cmdline, "root=/dev/ram0 ");
} else {
/* The loader should have set the command line */ /* The loader should have set the command line */
/* too early for panic to do any good */ /* too early for panic to do any good */
printk("LINUX_CMDLINE not defined in cfe."); printk("LINUX_CMDLINE not defined in cfe.");
......
...@@ -29,6 +29,7 @@ int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks) ...@@ -29,6 +29,7 @@ int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks)
} }
return -ENODEV; return -ENODEV;
} }
EXPORT_SYMBOL(ssb_watchdog_timer_set);
u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask) u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask)
{ {
......
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