Skip to content

Commit a656ffc

Browse files
haukelinvjw
authored andcommitted
bcm47xx: make it possible to build bcm47xx without ssb.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 08ccf57 commit a656ffc

12 files changed

Lines changed: 71 additions & 8 deletions

File tree

‎arch/mips/Kconfig‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,8 @@ config BCM47XX
9191
select DMA_NONCOHERENT
9292
select HW_HAS_PCI
9393
select IRQ_CPU
94-
select SYS_HAS_CPU_MIPS32_R1
9594
select SYS_SUPPORTS_32BIT_KERNEL
9695
select SYS_SUPPORTS_LITTLE_ENDIAN
97-
select SSB
98-
select SSB_DRIVER_MIPS
99-
select SSB_DRIVER_EXTIF
100-
select SSB_EMBEDDED
101-
select SSB_B43_PCI_BRIDGE if PCI
102-
select SSB_PCICORE_HOSTMODE if PCI
10396
select GENERIC_GPIO
10497
select SYS_HAS_EARLY_PRINTK
10598
select CFE
@@ -788,6 +781,7 @@ endchoice
788781

789782
source "arch/mips/alchemy/Kconfig"
790783
source "arch/mips/ath79/Kconfig"
784+
source "arch/mips/bcm47xx/Kconfig"
791785
source "arch/mips/bcm63xx/Kconfig"
792786
source "arch/mips/jazz/Kconfig"
793787
source "arch/mips/jz4740/Kconfig"

‎arch/mips/bcm47xx/Kconfig‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
if BCM47XX
2+
3+
config BCM47XX_SSB
4+
bool "SSB Support for Broadcom BCM47XX"
5+
select SYS_HAS_CPU_MIPS32_R1
6+
select SSB
7+
select SSB_DRIVER_MIPS
8+
select SSB_DRIVER_EXTIF
9+
select SSB_EMBEDDED
10+
select SSB_B43_PCI_BRIDGE if PCI
11+
select SSB_PCICORE_HOSTMODE if PCI
12+
default y
13+
help
14+
Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
15+
16+
This will generate an image with support for SSB and MIPS32 R1 instruction set.
17+
18+
endif

‎arch/mips/bcm47xx/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
# under Linux.
44
#
55

6-
obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o wgt634u.o
6+
obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o
7+
obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o

‎arch/mips/bcm47xx/gpio.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES);
2121
int gpio_request(unsigned gpio, const char *tag)
2222
{
2323
switch (bcm47xx_bus_type) {
24+
#ifdef CONFIG_BCM47XX_SSB
2425
case BCM47XX_BUS_TYPE_SSB:
2526
if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
2627
((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
@@ -34,6 +35,7 @@ int gpio_request(unsigned gpio, const char *tag)
3435
return -EBUSY;
3536

3637
return 0;
38+
#endif
3739
}
3840
return -EINVAL;
3941
}
@@ -42,6 +44,7 @@ EXPORT_SYMBOL(gpio_request);
4244
void gpio_free(unsigned gpio)
4345
{
4446
switch (bcm47xx_bus_type) {
47+
#ifdef CONFIG_BCM47XX_SSB
4548
case BCM47XX_BUS_TYPE_SSB:
4649
if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
4750
((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
@@ -53,20 +56,23 @@ void gpio_free(unsigned gpio)
5356

5457
clear_bit(gpio, gpio_in_use);
5558
return;
59+
#endif
5660
}
5761
}
5862
EXPORT_SYMBOL(gpio_free);
5963

6064
int gpio_to_irq(unsigned gpio)
6165
{
6266
switch (bcm47xx_bus_type) {
67+
#ifdef CONFIG_BCM47XX_SSB
6368
case BCM47XX_BUS_TYPE_SSB:
6469
if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco))
6570
return ssb_mips_irq(bcm47xx_bus.ssb.chipco.dev) + 2;
6671
else if (ssb_extif_available(&bcm47xx_bus.ssb.extif))
6772
return ssb_mips_irq(bcm47xx_bus.ssb.extif.dev) + 2;
6873
else
6974
return -EINVAL;
75+
#endif
7076
}
7177
return -EINVAL;
7278
}

‎arch/mips/bcm47xx/nvram.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ static char nvram_buf[NVRAM_SPACE];
2626
/* Probe for NVRAM header */
2727
static void early_nvram_init(void)
2828
{
29+
#ifdef CONFIG_BCM47XX_SSB
2930
struct ssb_mipscore *mcore_ssb;
31+
#endif
3032
struct nvram_header *header;
3133
int i;
3234
u32 base = 0;
@@ -35,11 +37,13 @@ static void early_nvram_init(void)
3537
u32 *src, *dst;
3638

3739
switch (bcm47xx_bus_type) {
40+
#ifdef CONFIG_BCM47XX_SSB
3841
case BCM47XX_BUS_TYPE_SSB:
3942
mcore_ssb = &bcm47xx_bus.ssb.mipscore;
4043
base = mcore_ssb->flash_window;
4144
lim = mcore_ssb->flash_window_size;
4245
break;
46+
#endif
4347
}
4448

4549
off = FLASH_MIN;

‎arch/mips/bcm47xx/serial.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static struct platform_device uart8250_device = {
2323
},
2424
};
2525

26+
#ifdef CONFIG_BCM47XX_SSB
2627
static int __init uart8250_init_ssb(void)
2728
{
2829
int i;
@@ -44,12 +45,15 @@ static int __init uart8250_init_ssb(void)
4445
}
4546
return platform_device_register(&uart8250_device);
4647
}
48+
#endif
4749

4850
static int __init uart8250_init(void)
4951
{
5052
switch (bcm47xx_bus_type) {
53+
#ifdef CONFIG_BCM47XX_SSB
5154
case BCM47XX_BUS_TYPE_SSB:
5255
return uart8250_init_ssb();
56+
#endif
5357
}
5458
return -EINVAL;
5559
}

‎arch/mips/bcm47xx/setup.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ static void bcm47xx_machine_restart(char *command)
4747
local_irq_disable();
4848
/* Set the watchdog timer to reset immediately */
4949
switch (bcm47xx_bus_type) {
50+
#ifdef CONFIG_BCM47XX_SSB
5051
case BCM47XX_BUS_TYPE_SSB:
5152
ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1);
5253
break;
54+
#endif
5355
}
5456
while (1)
5557
cpu_relax();
@@ -60,14 +62,17 @@ static void bcm47xx_machine_halt(void)
6062
/* Disable interrupts and watchdog and spin forever */
6163
local_irq_disable();
6264
switch (bcm47xx_bus_type) {
65+
#ifdef CONFIG_BCM47XX_SSB
6366
case BCM47XX_BUS_TYPE_SSB:
6467
ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 0);
6568
break;
69+
#endif
6670
}
6771
while (1)
6872
cpu_relax();
6973
}
7074

75+
#ifdef CONFIG_BCM47XX_SSB
7176
#define READ_FROM_NVRAM(_outvar, name, buf) \
7277
if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
7378
sprom->_outvar = simple_strtoul(buf, NULL, 0);
@@ -288,13 +293,16 @@ static void __init bcm47xx_register_ssb(void)
288293
}
289294
}
290295
}
296+
#endif
291297

292298
void __init plat_mem_setup(void)
293299
{
294300
struct cpuinfo_mips *c = &current_cpu_data;
295301

302+
#ifdef CONFIG_BCM47XX_SSB
296303
bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
297304
bcm47xx_register_ssb();
305+
#endif
298306

299307
_machine_restart = bcm47xx_machine_restart;
300308
_machine_halt = bcm47xx_machine_halt;

‎arch/mips/bcm47xx/time.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ void __init plat_time_init(void)
4040
write_c0_compare(0xffff);
4141

4242
switch (bcm47xx_bus_type) {
43+
#ifdef CONFIG_BCM47XX_SSB
4344
case BCM47XX_BUS_TYPE_SSB:
4445
hz = ssb_cpu_clock(&bcm47xx_bus.ssb.mipscore) / 2;
4546
break;
47+
#endif
4648
}
4749

4850
if (!hz)

‎arch/mips/include/asm/mach-bcm47xx/bcm47xx.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@
2222
#include <linux/ssb/ssb.h>
2323

2424
enum bcm47xx_bus_type {
25+
#ifdef CONFIG_BCM47XX_SSB
2526
BCM47XX_BUS_TYPE_SSB,
27+
#endif
2628
};
2729

2830
union bcm47xx_bus {
31+
#ifdef CONFIG_BCM47XX_SSB
2932
struct ssb_bus ssb;
33+
#endif
3034
};
3135

3236
extern union bcm47xx_bus bcm47xx_bus;

‎arch/mips/include/asm/mach-bcm47xx/gpio.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,63 +22,75 @@ extern int gpio_to_irq(unsigned gpio);
2222
static inline int gpio_get_value(unsigned gpio)
2323
{
2424
switch (bcm47xx_bus_type) {
25+
#ifdef CONFIG_BCM47XX_SSB
2526
case BCM47XX_BUS_TYPE_SSB:
2627
return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio);
28+
#endif
2729
}
2830
return -EINVAL;
2931
}
3032

3133
static inline void gpio_set_value(unsigned gpio, int value)
3234
{
3335
switch (bcm47xx_bus_type) {
36+
#ifdef CONFIG_BCM47XX_SSB
3437
case BCM47XX_BUS_TYPE_SSB:
3538
ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
3639
value ? 1 << gpio : 0);
40+
#endif
3741
}
3842
}
3943

4044
static inline int gpio_direction_input(unsigned gpio)
4145
{
4246
switch (bcm47xx_bus_type) {
47+
#ifdef CONFIG_BCM47XX_SSB
4348
case BCM47XX_BUS_TYPE_SSB:
4449
ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0);
4550
return 0;
51+
#endif
4652
}
4753
return -EINVAL;
4854
}
4955

5056
static inline int gpio_direction_output(unsigned gpio, int value)
5157
{
5258
switch (bcm47xx_bus_type) {
59+
#ifdef CONFIG_BCM47XX_SSB
5360
case BCM47XX_BUS_TYPE_SSB:
5461
/* first set the gpio out value */
5562
ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
5663
value ? 1 << gpio : 0);
5764
/* then set the gpio mode */
5865
ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio);
5966
return 0;
67+
#endif
6068
}
6169
return -EINVAL;
6270
}
6371

6472
static inline int gpio_intmask(unsigned gpio, int value)
6573
{
6674
switch (bcm47xx_bus_type) {
75+
#ifdef CONFIG_BCM47XX_SSB
6776
case BCM47XX_BUS_TYPE_SSB:
6877
ssb_gpio_intmask(&bcm47xx_bus.ssb, 1 << gpio,
6978
value ? 1 << gpio : 0);
7079
return 0;
80+
#endif
7181
}
7282
return -EINVAL;
7383
}
7484

7585
static inline int gpio_polarity(unsigned gpio, int value)
7686
{
7787
switch (bcm47xx_bus_type) {
88+
#ifdef CONFIG_BCM47XX_SSB
7889
case BCM47XX_BUS_TYPE_SSB:
7990
ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << gpio,
8091
value ? 1 << gpio : 0);
8192
return 0;
93+
#endif
8294
}
8395
return -EINVAL;
8496
}

0 commit comments

Comments
 (0)