Skip to content

Commit

Permalink
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-…
Browse files Browse the repository at this point in the history
…linus

* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus:
  MIPS: Kill unused <asm/debug.h> inclusions
  MIPS: IP32: Add platform device for CMOS RTC; remove dead code
  RTC: M48T35: new RTC driver
  MIPS: IP27: Switch over to RTC class driver
  MIPS: DS1286: New RTC driver
  MIPS: IP22/28: Switch over to RTC class driver
  MIPS: PCI: Scan busses when they are registered
  MIPS: WGT634U: Add reset button support
  MIPS: BCM47xx: Use the new SSB GPIO API
  MIPS: BCM47xx: Remove references to BCM947XX
  MIPS: WGT634U: Add machine detection message
  MIPS: Align .data.cacheline_aligned based on CONFIG_MIPS_L1_CACHE_SHIFT
  MIPS: show_cpuinfo prints the type of the calling CPU
  MIPS: Fix wrong branch target in new spin_lock code.
  MIPS: Have a heart for a lonely, lost header file ...
  • Loading branch information
Linus Torvalds committed Oct 15, 2008
2 parents 7c3b1dc + 08da6f1 commit 04ab591
Show file tree
Hide file tree
Showing 31 changed files with 869 additions and 286 deletions.
1 change: 1 addition & 0 deletions arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ config BCM47XX
select SSB
select SSB_DRIVER_MIPS
select SSB_DRIVER_EXTIF
select SSB_EMBEDDED
select SSB_PCICORE_HOSTMODE if PCI
select GENERIC_GPIO
select SYS_HAS_EARLY_PRINTK
Expand Down
85 changes: 34 additions & 51 deletions arch/mips/bcm47xx/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,68 +12,51 @@
#include <asm/mach-bcm47xx/bcm47xx.h>
#include <asm/mach-bcm47xx/gpio.h>

int bcm47xx_gpio_to_irq(unsigned gpio)
#if (BCM47XX_CHIPCO_GPIO_LINES > BCM47XX_EXTIF_GPIO_LINES)
static DECLARE_BITMAP(gpio_in_use, BCM47XX_CHIPCO_GPIO_LINES);
#else
static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES);
#endif

int gpio_request(unsigned gpio, const char *tag)
{
if (ssb_bcm47xx.chipco.dev)
return ssb_mips_irq(ssb_bcm47xx.chipco.dev) + 2;
else if (ssb_bcm47xx.extif.dev)
return ssb_mips_irq(ssb_bcm47xx.extif.dev) + 2;
else
if (ssb_chipco_available(&ssb_bcm47xx.chipco) &&
((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
return -EINVAL;
}
EXPORT_SYMBOL_GPL(bcm47xx_gpio_to_irq);

int bcm47xx_gpio_get_value(unsigned gpio)
{
if (ssb_bcm47xx.chipco.dev)
return ssb_chipco_gpio_in(&ssb_bcm47xx.chipco, 1 << gpio);
else if (ssb_bcm47xx.extif.dev)
return ssb_extif_gpio_in(&ssb_bcm47xx.extif, 1 << gpio);
else
return 0;
}
EXPORT_SYMBOL_GPL(bcm47xx_gpio_get_value);
if (ssb_extif_available(&ssb_bcm47xx.extif) &&
((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
return -EINVAL;

void bcm47xx_gpio_set_value(unsigned gpio, int value)
{
if (ssb_bcm47xx.chipco.dev)
ssb_chipco_gpio_out(&ssb_bcm47xx.chipco,
1 << gpio,
value ? 1 << gpio : 0);
else if (ssb_bcm47xx.extif.dev)
ssb_extif_gpio_out(&ssb_bcm47xx.extif,
1 << gpio,
value ? 1 << gpio : 0);
}
EXPORT_SYMBOL_GPL(bcm47xx_gpio_set_value);
if (test_and_set_bit(gpio, gpio_in_use))
return -EBUSY;

int bcm47xx_gpio_direction_input(unsigned gpio)
{
if (ssb_bcm47xx.chipco.dev && (gpio < BCM47XX_CHIPCO_GPIO_LINES))
ssb_chipco_gpio_outen(&ssb_bcm47xx.chipco,
1 << gpio, 0);
else if (ssb_bcm47xx.extif.dev && (gpio < BCM47XX_EXTIF_GPIO_LINES))
ssb_extif_gpio_outen(&ssb_bcm47xx.extif,
1 << gpio, 0);
else
return -EINVAL;
return 0;
}
EXPORT_SYMBOL_GPL(bcm47xx_gpio_direction_input);
EXPORT_SYMBOL(gpio_request);

int bcm47xx_gpio_direction_output(unsigned gpio, int value)
void gpio_free(unsigned gpio)
{
bcm47xx_gpio_set_value(gpio, value);
if (ssb_chipco_available(&ssb_bcm47xx.chipco) &&
((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
return;

if (ssb_extif_available(&ssb_bcm47xx.extif) &&
((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
return;

clear_bit(gpio, gpio_in_use);
}
EXPORT_SYMBOL(gpio_free);

if (ssb_bcm47xx.chipco.dev && (gpio < BCM47XX_CHIPCO_GPIO_LINES))
ssb_chipco_gpio_outen(&ssb_bcm47xx.chipco,
1 << gpio, 1 << gpio);
else if (ssb_bcm47xx.extif.dev && (gpio < BCM47XX_EXTIF_GPIO_LINES))
ssb_extif_gpio_outen(&ssb_bcm47xx.extif,
1 << gpio, 1 << gpio);
int gpio_to_irq(unsigned gpio)
{
if (ssb_chipco_available(&ssb_bcm47xx.chipco))
return ssb_mips_irq(ssb_bcm47xx.chipco.dev) + 2;
else if (ssb_extif_available(&ssb_bcm47xx.extif))
return ssb_mips_irq(ssb_bcm47xx.extif.dev) + 2;
else
return -EINVAL;
return 0;
}
EXPORT_SYMBOL_GPL(bcm47xx_gpio_direction_output);
EXPORT_SYMBOL_GPL(gpio_to_irq);

5 changes: 3 additions & 2 deletions arch/mips/bcm47xx/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <linux/types.h>
#include <linux/ssb/ssb.h>
#include <linux/ssb/ssb_embedded.h>
#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
Expand All @@ -41,7 +42,7 @@ static void bcm47xx_machine_restart(char *command)
printk(KERN_ALERT "Please stand by while rebooting the system...\n");
local_irq_disable();
/* Set the watchdog timer to reset immediately */
ssb_chipco_watchdog_timer_set(&ssb_bcm47xx.chipco, 1);
ssb_watchdog_timer_set(&ssb_bcm47xx, 1);
while (1)
cpu_relax();
}
Expand All @@ -50,7 +51,7 @@ static void bcm47xx_machine_halt(void)
{
/* Disable interrupts and watchdog and spin forever */
local_irq_disable();
ssb_chipco_watchdog_timer_set(&ssb_bcm47xx.chipco, 0);
ssb_watchdog_timer_set(&ssb_bcm47xx, 0);
while (1)
cpu_relax();
}
Expand Down
40 changes: 40 additions & 0 deletions arch/mips/bcm47xx/wgt634u.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include <linux/leds.h>
#include <linux/mtd/physmap.h>
#include <linux/ssb/ssb.h>
#include <linux/interrupt.h>
#include <linux/reboot.h>
#include <linux/gpio.h>
#include <asm/mach-bcm47xx/bcm47xx.h>

/* GPIO definitions for the WGT634U */
Expand Down Expand Up @@ -99,6 +102,30 @@ static struct platform_device *wgt634u_devices[] __initdata = {
&wgt634u_gpio_leds,
};

static irqreturn_t gpio_interrupt(int irq, void *ignored)
{
int state;

/* Interrupts are shared, check if the current one is
a GPIO interrupt. */
if (!ssb_chipco_irq_status(&ssb_bcm47xx.chipco,
SSB_CHIPCO_IRQ_GPIO))
return IRQ_NONE;

state = gpio_get_value(WGT634U_GPIO_RESET);

/* Interrupt are level triggered, revert the interrupt polarity
to clear the interrupt. */
gpio_polarity(WGT634U_GPIO_RESET, state);

if (!state) {
printk(KERN_INFO "Reset button pressed");
ctrl_alt_del();
}

return IRQ_HANDLED;
}

static int __init wgt634u_init(void)
{
/* There is no easy way to detect that we are running on a WGT634U
Expand All @@ -112,6 +139,19 @@ static int __init wgt634u_init(void)
((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
(et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;

printk(KERN_INFO "WGT634U machine detected.\n");

if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
gpio_interrupt, IRQF_SHARED,
"WGT634U GPIO", &ssb_bcm47xx.chipco)) {
gpio_direction_input(WGT634U_GPIO_RESET);
gpio_intmask(WGT634U_GPIO_RESET, 1);
ssb_chipco_irq_mask(&ssb_bcm47xx.chipco,
SSB_CHIPCO_IRQ_GPIO,
SSB_CHIPCO_IRQ_GPIO);
}

wgt634u_flash_data.width = mcore->flash_buswidth;
wgt634u_flash_resource.start = mcore->flash_window;
wgt634u_flash_resource.end = mcore->flash_window
Expand Down
1 change: 0 additions & 1 deletion arch/mips/emma2rh/common/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

#include <asm/system.h>
#include <asm/mipsregs.h>
#include <asm/debug.h>
#include <asm/addrspace.h>
#include <asm/bootinfo.h>

Expand Down
1 change: 0 additions & 1 deletion arch/mips/emma2rh/common/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <asm/addrspace.h>
#include <asm/bootinfo.h>
#include <asm/emma2rh/emma2rh.h>
#include <asm/debug.h>

const char *get_system_type(void)
{
Expand Down
1 change: 0 additions & 1 deletion arch/mips/emma2rh/markeins/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <asm/irq.h>
#include <asm/reboot.h>
#include <asm/traps.h>
#include <asm/debug.h>

#include <asm/emma2rh/emma2rh.h>

Expand Down
File renamed without changes.
41 changes: 20 additions & 21 deletions arch/mips/include/asm/mach-bcm47xx/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,46 @@
#ifndef __BCM47XX_GPIO_H
#define __BCM47XX_GPIO_H

#include <linux/ssb/ssb_embedded.h>
#include <asm/mach-bcm47xx/bcm47xx.h>

#define BCM47XX_EXTIF_GPIO_LINES 5
#define BCM47XX_CHIPCO_GPIO_LINES 16

extern int bcm47xx_gpio_to_irq(unsigned gpio);
extern int bcm47xx_gpio_get_value(unsigned gpio);
extern void bcm47xx_gpio_set_value(unsigned gpio, int value);
extern int bcm47xx_gpio_direction_input(unsigned gpio);
extern int bcm47xx_gpio_direction_output(unsigned gpio, int value);

static inline int gpio_request(unsigned gpio, const char *label)
{
return 0;
}
extern int gpio_request(unsigned gpio, const char *label);
extern void gpio_free(unsigned gpio);
extern int gpio_to_irq(unsigned gpio);

static inline void gpio_free(unsigned gpio)
static inline int gpio_get_value(unsigned gpio)
{
return ssb_gpio_in(&ssb_bcm47xx, 1 << gpio);
}

static inline int gpio_to_irq(unsigned gpio)
static inline void gpio_set_value(unsigned gpio, int value)
{
return bcm47xx_gpio_to_irq(gpio);
ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0);
}

static inline int gpio_get_value(unsigned gpio)
static inline int gpio_direction_input(unsigned gpio)
{
return bcm47xx_gpio_get_value(gpio);
return ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0);
}

static inline void gpio_set_value(unsigned gpio, int value)
static inline int gpio_direction_output(unsigned gpio, int value)
{
bcm47xx_gpio_set_value(gpio, value);
return ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio);
}

static inline int gpio_direction_input(unsigned gpio)
static int gpio_intmask(unsigned gpio, int value)
{
return bcm47xx_gpio_direction_input(gpio);
return ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio,
value ? 1 << gpio : 0);
}

static inline int gpio_direction_output(unsigned gpio, int value)
static int gpio_polarity(unsigned gpio, int value)
{
return bcm47xx_gpio_direction_output(gpio, value);
return ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio,
value ? 1 << gpio : 0);
}


Expand Down
6 changes: 3 additions & 3 deletions arch/mips/include/asm/mach-bcm47xx/war.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*
* Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
*/
#ifndef __ASM_MIPS_MACH_BCM947XX_WAR_H
#define __ASM_MIPS_MACH_BCM947XX_WAR_H
#ifndef __ASM_MIPS_MACH_BCM47XX_WAR_H
#define __ASM_MIPS_MACH_BCM47XX_WAR_H

#define R4600_V1_INDEX_ICACHEOP_WAR 0
#define R4600_V1_HIT_CACHEOP_WAR 0
Expand All @@ -22,4 +22,4 @@
#define R10000_LLSC_WAR 0
#define MIPS34K_MISSED_ITLB_WAR 0

#endif /* __ASM_MIPS_MACH_BCM947XX_WAR_H */
#endif /* __ASM_MIPS_MACH_BCM47XX_WAR_H */
18 changes: 0 additions & 18 deletions arch/mips/include/asm/mach-ip22/ds1286.h

This file was deleted.

4 changes: 0 additions & 4 deletions arch/mips/include/asm/mach-ip28/ds1286.h

This file was deleted.

2 changes: 1 addition & 1 deletion arch/mips/include/asm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
" ori %[ticket], %[ticket], 0x2000 \n"
" xori %[ticket], %[ticket], 0x2000 \n"
" sc %[ticket], %[ticket_ptr] \n"
" beqzl %[ticket], 2f \n"
" beqzl %[ticket], 1b \n"
: [ticket_ptr] "+m" (lock->lock),
[ticket] "=&r" (tmp));
} else {
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, "processor\t\t: %ld\n", n);
sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n",
cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : "");
seq_printf(m, fmt, __cpu_name[smp_processor_id()],
seq_printf(m, fmt, __cpu_name[n],
(version >> 4) & 0x0f, version & 0x0f,
(fp_vers >> 4) & 0x0f, fp_vers & 0x0f);
seq_printf(m, "BogoMIPS\t\t: %lu.%02lu\n",
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ SECTIONS
. = ALIGN(_PAGE_SIZE);
__nosave_end = .;

. = ALIGN(32);
. = ALIGN(1 << CONFIG_MIPS_L1_CACHE_SHIFT);
.data.cacheline_aligned : {
*(.data.cacheline_aligned)
}
Expand Down
1 change: 0 additions & 1 deletion arch/mips/pci/fixup-emma2rh.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <linux/pci.h>

#include <asm/bootinfo.h>
#include <asm/debug.h>

#include <asm/emma2rh/emma2rh.h>

Expand Down
2 changes: 0 additions & 2 deletions arch/mips/pci/ops-pnx8550.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

#include <asm/mach-pnx8550/pci.h>
#include <asm/mach-pnx8550/glb.h>
#include <asm/debug.h>


static inline void clear_status(void)
{
Expand Down
1 change: 0 additions & 1 deletion arch/mips/pci/pci-emma2rh.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <linux/pci.h>

#include <asm/bootinfo.h>
#include <asm/debug.h>

#include <asm/emma2rh/emma2rh.h>

Expand Down
Loading

0 comments on commit 04ab591

Please sign in to comment.