Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 265381
b: refs/heads/master
c: a656ffc
h: refs/heads/master
i:
  265379: 9c67224
v: v3
  • Loading branch information
Hauke Mehrtens authored and John W. Linville committed Aug 8, 2011
1 parent 47c75c3 commit e271775
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08ccf57283f89adbc2ff897ad82d6ad4560db7cd
refs/heads/master: a656ffcbc7a98a80d2136ae6bbdd8ae2eb48c78a
8 changes: 1 addition & 7 deletions trunk/arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,8 @@ config BCM47XX
select DMA_NONCOHERENT
select HW_HAS_PCI
select IRQ_CPU
select SYS_HAS_CPU_MIPS32_R1
select SYS_SUPPORTS_32BIT_KERNEL
select SYS_SUPPORTS_LITTLE_ENDIAN
select SSB
select SSB_DRIVER_MIPS
select SSB_DRIVER_EXTIF
select SSB_EMBEDDED
select SSB_B43_PCI_BRIDGE if PCI
select SSB_PCICORE_HOSTMODE if PCI
select GENERIC_GPIO
select SYS_HAS_EARLY_PRINTK
select CFE
Expand Down Expand Up @@ -788,6 +781,7 @@ endchoice

source "arch/mips/alchemy/Kconfig"
source "arch/mips/ath79/Kconfig"
source "arch/mips/bcm47xx/Kconfig"
source "arch/mips/bcm63xx/Kconfig"
source "arch/mips/jazz/Kconfig"
source "arch/mips/jz4740/Kconfig"
Expand Down
18 changes: 18 additions & 0 deletions trunk/arch/mips/bcm47xx/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if BCM47XX

config BCM47XX_SSB
bool "SSB Support for Broadcom BCM47XX"
select SYS_HAS_CPU_MIPS32_R1
select SSB
select SSB_DRIVER_MIPS
select SSB_DRIVER_EXTIF
select SSB_EMBEDDED
select SSB_B43_PCI_BRIDGE if PCI
select SSB_PCICORE_HOSTMODE if PCI
default y
help
Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.

This will generate an image with support for SSB and MIPS32 R1 instruction set.

endif
3 changes: 2 additions & 1 deletion trunk/arch/mips/bcm47xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
# under Linux.
#

obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o wgt634u.o
obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o
obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
6 changes: 6 additions & 0 deletions trunk/arch/mips/bcm47xx/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES);
int gpio_request(unsigned gpio, const char *tag)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
Expand All @@ -34,6 +35,7 @@ int gpio_request(unsigned gpio, const char *tag)
return -EBUSY;

return 0;
#endif
}
return -EINVAL;
}
Expand All @@ -42,6 +44,7 @@ EXPORT_SYMBOL(gpio_request);
void gpio_free(unsigned gpio)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
Expand All @@ -53,20 +56,23 @@ void gpio_free(unsigned gpio)

clear_bit(gpio, gpio_in_use);
return;
#endif
}
}
EXPORT_SYMBOL(gpio_free);

int gpio_to_irq(unsigned gpio)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco))
return ssb_mips_irq(bcm47xx_bus.ssb.chipco.dev) + 2;
else if (ssb_extif_available(&bcm47xx_bus.ssb.extif))
return ssb_mips_irq(bcm47xx_bus.ssb.extif.dev) + 2;
else
return -EINVAL;
#endif
}
return -EINVAL;
}
Expand Down
4 changes: 4 additions & 0 deletions trunk/arch/mips/bcm47xx/nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ static char nvram_buf[NVRAM_SPACE];
/* Probe for NVRAM header */
static void early_nvram_init(void)
{
#ifdef CONFIG_BCM47XX_SSB
struct ssb_mipscore *mcore_ssb;
#endif
struct nvram_header *header;
int i;
u32 base = 0;
Expand All @@ -35,11 +37,13 @@ static void early_nvram_init(void)
u32 *src, *dst;

switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
mcore_ssb = &bcm47xx_bus.ssb.mipscore;
base = mcore_ssb->flash_window;
lim = mcore_ssb->flash_window_size;
break;
#endif
}

off = FLASH_MIN;
Expand Down
4 changes: 4 additions & 0 deletions trunk/arch/mips/bcm47xx/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static struct platform_device uart8250_device = {
},
};

#ifdef CONFIG_BCM47XX_SSB
static int __init uart8250_init_ssb(void)
{
int i;
Expand All @@ -44,12 +45,15 @@ static int __init uart8250_init_ssb(void)
}
return platform_device_register(&uart8250_device);
}
#endif

static int __init uart8250_init(void)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
return uart8250_init_ssb();
#endif
}
return -EINVAL;
}
Expand Down
8 changes: 8 additions & 0 deletions trunk/arch/mips/bcm47xx/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ static void bcm47xx_machine_restart(char *command)
local_irq_disable();
/* Set the watchdog timer to reset immediately */
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1);
break;
#endif
}
while (1)
cpu_relax();
Expand All @@ -60,14 +62,17 @@ static void bcm47xx_machine_halt(void)
/* Disable interrupts and watchdog and spin forever */
local_irq_disable();
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 0);
break;
#endif
}
while (1)
cpu_relax();
}

#ifdef CONFIG_BCM47XX_SSB
#define READ_FROM_NVRAM(_outvar, name, buf) \
if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
sprom->_outvar = simple_strtoul(buf, NULL, 0);
Expand Down Expand Up @@ -288,13 +293,16 @@ static void __init bcm47xx_register_ssb(void)
}
}
}
#endif

void __init plat_mem_setup(void)
{
struct cpuinfo_mips *c = &current_cpu_data;

#ifdef CONFIG_BCM47XX_SSB
bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
bcm47xx_register_ssb();
#endif

_machine_restart = bcm47xx_machine_restart;
_machine_halt = bcm47xx_machine_halt;
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/mips/bcm47xx/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ void __init plat_time_init(void)
write_c0_compare(0xffff);

switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
hz = ssb_cpu_clock(&bcm47xx_bus.ssb.mipscore) / 2;
break;
#endif
}

if (!hz)
Expand Down
4 changes: 4 additions & 0 deletions trunk/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@
#include <linux/ssb/ssb.h>

enum bcm47xx_bus_type {
#ifdef CONFIG_BCM47XX_SSB
BCM47XX_BUS_TYPE_SSB,
#endif
};

union bcm47xx_bus {
#ifdef CONFIG_BCM47XX_SSB
struct ssb_bus ssb;
#endif
};

extern union bcm47xx_bus bcm47xx_bus;
Expand Down
12 changes: 12 additions & 0 deletions trunk/arch/mips/include/asm/mach-bcm47xx/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,63 +22,75 @@ extern int gpio_to_irq(unsigned gpio);
static inline int gpio_get_value(unsigned gpio)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio);
#endif
}
return -EINVAL;
}

static inline void gpio_set_value(unsigned gpio, int value)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
value ? 1 << gpio : 0);
#endif
}
}

static inline int gpio_direction_input(unsigned gpio)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0);
return 0;
#endif
}
return -EINVAL;
}

static inline int gpio_direction_output(unsigned gpio, int value)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
/* first set the gpio out value */
ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
value ? 1 << gpio : 0);
/* then set the gpio mode */
ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio);
return 0;
#endif
}
return -EINVAL;
}

static inline int gpio_intmask(unsigned gpio, int value)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
ssb_gpio_intmask(&bcm47xx_bus.ssb, 1 << gpio,
value ? 1 << gpio : 0);
return 0;
#endif
}
return -EINVAL;
}

static inline int gpio_polarity(unsigned gpio, int value)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << gpio,
value ? 1 << gpio : 0);
return 0;
#endif
}
return -EINVAL;
}
Expand Down
6 changes: 6 additions & 0 deletions trunk/arch/mips/pci/pci-bcm47xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/ssb/ssb.h>
#include <bcm47xx.h>

int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{
Expand All @@ -33,9 +34,13 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)

int pcibios_plat_dev_init(struct pci_dev *dev)
{
#ifdef CONFIG_BCM47XX_SSB
int res;
u8 slot, pin;

if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
return 0;

res = ssb_pcibios_plat_dev_init(dev);
if (res < 0) {
printk(KERN_ALERT "PCI: Failed to init device %s\n",
Expand All @@ -55,5 +60,6 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
}

dev->irq = res;
#endif
return 0;
}
4 changes: 4 additions & 0 deletions trunk/drivers/watchdog/bcm47xx_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,21 @@ static inline void bcm47xx_wdt_hw_start(void)
{
/* this is 2,5s on 100Mhz clock and 2s on 133 Mhz */
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 0xfffffff);
break;
#endif
}
}

static inline int bcm47xx_wdt_hw_stop(void)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
return ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 0);
#endif
}
return -EINVAL;
}
Expand Down

0 comments on commit e271775

Please sign in to comment.