Skip to content

Commit

Permalink
MIPS: Alchemy: Single kernel for DB1200/1300/1550
Browse files Browse the repository at this point in the history
Combine support for the DB1200/PB1200, DB1300 and DB1550 boards into
a single kernel image.

defconfig-generated image verified on DB1200, DB1300 and DB1550.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/4335/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Manuel Lauss authored and Ralf Baechle committed Oct 11, 2012
1 parent 748e787 commit bd8510d
Show file tree
Hide file tree
Showing 13 changed files with 548 additions and 941 deletions.
22 changes: 3 additions & 19 deletions arch/mips/alchemy/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,9 @@ config MIPS_DB1000
select SYS_SUPPORTS_LITTLE_ENDIAN
select SYS_HAS_EARLY_PRINTK

config MIPS_DB1200
bool "Alchemy DB1200/PB1200 board"
select ALCHEMY_GPIOINT_AU1000
select DMA_COHERENT
select MIPS_DISABLE_OBSOLETE_IDE
select SYS_SUPPORTS_LITTLE_ENDIAN
select SYS_HAS_EARLY_PRINTK

config MIPS_DB1300
bool "NetLogic DB1300 board"
select ALCHEMY_GPIOINT_AU1300
select DMA_COHERENT
select MIPS_DISABLE_OBSOLETE_IDE
select SYS_SUPPORTS_LITTLE_ENDIAN
select SYS_HAS_EARLY_PRINTK

config MIPS_DB1550
bool "Alchemy DB1550 board"
select ALCHEMY_GPIOINT_AU1000
config MIPS_DB1235
bool "Alchemy DB1200/PB1200/DB1300/DB1550 boards"
select ARCH_REQUIRE_GPIOLIB
select HW_HAS_PCI
select DMA_COHERENT
select MIPS_DISABLE_OBSOLETE_IDE
Expand Down
22 changes: 4 additions & 18 deletions arch/mips/alchemy/Platform
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,11 @@ cflags-$(CONFIG_MIPS_DB1000) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000

#
# AMD Alchemy Db1550 eval board
# AMD Alchemy Db1200/Pb1200/Db1550/Db1300 eval boards
#
platform-$(CONFIG_MIPS_DB1550) += alchemy/devboards/
cflags-$(CONFIG_MIPS_DB1550) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000

#
# AMD Alchemy Db1200/Pb1200 eval boards
#
platform-$(CONFIG_MIPS_DB1200) += alchemy/devboards/
cflags-$(CONFIG_MIPS_DB1200) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
load-$(CONFIG_MIPS_DB1200) += 0xffffffff80100000

#
# NetLogic DBAu1300 development platform
#
platform-$(CONFIG_MIPS_DB1300) += alchemy/devboards/
cflags-$(CONFIG_MIPS_DB1300) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
load-$(CONFIG_MIPS_DB1300) += 0xffffffff80100000
platform-$(CONFIG_MIPS_DB1235) += alchemy/devboards/
cflags-$(CONFIG_MIPS_DB1235) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
load-$(CONFIG_MIPS_DB1235) += 0xffffffff80100000

#
# 4G-Systems MTX-1 "MeshCube" wireless router
Expand Down
4 changes: 1 addition & 3 deletions arch/mips/alchemy/devboards/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ obj-$(CONFIG_MIPS_PB1100) += pb1100.o
obj-$(CONFIG_MIPS_PB1500) += pb1500.o
obj-$(CONFIG_MIPS_PB1550) += pb1550.o
obj-$(CONFIG_MIPS_DB1000) += db1000.o
obj-$(CONFIG_MIPS_DB1200) += db1200.o
obj-$(CONFIG_MIPS_DB1300) += db1300.o
obj-$(CONFIG_MIPS_DB1550) += db1550.o
obj-$(CONFIG_MIPS_DB1235) += db1235.o db1200.o db1300.o db1550.o
37 changes: 10 additions & 27 deletions arch/mips/alchemy/devboards/db1200.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,9 @@

#include "platform.h"

static const char *board_type_str(void)
{
switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
case BCSR_WHOAMI_PB1200_DDR1:
case BCSR_WHOAMI_PB1200_DDR2:
return "PB1200";
case BCSR_WHOAMI_DB1200:
return "DB1200";
default:
return "(unknown)";
}
}
const char *get_system_type(void);

const char *get_system_type(void)
{
return board_type_str();
}

static int __init detect_board(void)
static int __init db1200_detect_board(void)
{
int bid;

Expand Down Expand Up @@ -96,19 +80,17 @@ static int __init detect_board(void)
return 1; /* it's neither */
}

void __init board_setup(void)
int __init db1200_board_setup(void)
{
unsigned long freq0, clksrc, div, pfc;
unsigned short whoami;

if (detect_board()) {
printk(KERN_ERR "NOT running on a DB1200/PB1200 board!\n");
return;
}
if (db1200_detect_board())
return -ENODEV;

whoami = bcsr_read(BCSR_WHOAMI);
printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d"
" Board-ID %d Daughtercard ID %d\n", board_type_str(),
" Board-ID %d Daughtercard ID %d\n", get_system_type(),
(whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);

/* SMBus/SPI on PSC0, Audio on PSC1 */
Expand Down Expand Up @@ -138,6 +120,8 @@ void __init board_setup(void)
clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT;
__raw_writel(clksrc, (void __iomem *)SYS_CLKSRC);
wmb();

return 0;
}

/******************************************************************************/
Expand Down Expand Up @@ -796,7 +780,7 @@ static int __init pb1200_res_fixup(void)
return 0;
}

static int __init db1200_dev_init(void)
int __init db1200_dev_setup(void)
{
unsigned long pfc;
unsigned short sw;
Expand Down Expand Up @@ -846,7 +830,7 @@ static int __init db1200_dev_init(void)
gpio_request(215, "otg-vbus");
gpio_direction_output(215, 1);

printk(KERN_INFO "%s device configuration:\n", board_type_str());
printk(KERN_INFO "%s device configuration:\n", get_system_type());

sw = bcsr_read(BCSR_SWITCHES);
if (sw & BCSR_SWITCHES_DIP_8) {
Expand Down Expand Up @@ -922,4 +906,3 @@ static int __init db1200_dev_init(void)

return 0;
}
device_initcall(db1200_dev_init);
84 changes: 84 additions & 0 deletions arch/mips/alchemy/devboards/db1235.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* DB1200/PB1200 / DB1550 / DB1300 board support.
*
* These 4 boards can reliably be supported in a single kernel image.
*/

#include <asm/mach-au1x00/au1000.h>
#include <asm/mach-db1x00/bcsr.h>

int __init db1200_board_setup(void);
int __init db1200_dev_setup(void);
int __init db1300_board_setup(void);
int __init db1300_dev_setup(void);
int __init db1550_board_setup(void);
int __init db1550_dev_setup(void);
int __init db1550_pci_setup(void);

static const char *board_type_str(void)
{
switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
case BCSR_WHOAMI_PB1200_DDR1:
case BCSR_WHOAMI_PB1200_DDR2:
return "PB1200";
case BCSR_WHOAMI_DB1200:
return "DB1200";
case BCSR_WHOAMI_DB1300:
return "DB1300";
case BCSR_WHOAMI_DB1550:
return "DB1550";
default:
return "(unknown)";
}
}

const char *get_system_type(void)
{
return board_type_str();
}

void __init board_setup(void)
{
int ret;

switch (alchemy_get_cputype()) {
case ALCHEMY_CPU_AU1550:
ret = db1550_board_setup();
break;
case ALCHEMY_CPU_AU1200:
ret = db1200_board_setup();
break;
case ALCHEMY_CPU_AU1300:
ret = db1300_board_setup();
break;
default:
pr_err("unsupported CPU on board\n");
ret = -ENODEV;
}
if (ret)
panic("cannot initialize board support\n");
}

int __init db1235_arch_init(void)
{
if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1550)
return db1550_pci_setup();
return 0;
}
arch_initcall(db1235_arch_init);

int __init db1235_dev_init(void)
{
switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
case BCSR_WHOAMI_PB1200_DDR1:
case BCSR_WHOAMI_PB1200_DDR2:
case BCSR_WHOAMI_DB1200:
return db1200_dev_setup();
case BCSR_WHOAMI_DB1300:
return db1300_dev_setup();
case BCSR_WHOAMI_DB1550:
return db1550_dev_setup();
}
return 0;
}
device_initcall(db1235_dev_init);
12 changes: 4 additions & 8 deletions arch/mips/alchemy/devboards/db1300.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ static void __init db1300_gpio_config(void)
au1300_set_dbdma_gpio(1, AU1300_PIN_FG3AUX);
}

char *get_system_type(void)
{
return "DB1300";
}

/**********************************************************************/

static void au1300_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
Expand Down Expand Up @@ -701,7 +696,7 @@ static struct platform_device *db1300_dev[] __initdata = {
&db1300_sndi2s_dev,
};

static int __init db1300_device_init(void)
int __init db1300_dev_setup(void)
{
int swapped, cpldirq;

Expand Down Expand Up @@ -758,10 +753,9 @@ static int __init db1300_device_init(void)

return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev));
}
device_initcall(db1300_device_init);


void __init board_setup(void)
int __init db1300_board_setup(void)
{
unsigned short whoami;

Expand All @@ -779,4 +773,6 @@ void __init board_setup(void)
alchemy_uart_enable(AU1300_UART0_PHYS_ADDR);
alchemy_uart_enable(AU1300_UART1_PHYS_ADDR);
alchemy_uart_enable(AU1300_UART3_PHYS_ADDR);

return 0;
}
15 changes: 4 additions & 11 deletions arch/mips/alchemy/devboards/db1550.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
#include <prom.h>
#include "platform.h"


const char *get_system_type(void)
{
return "DB1550";
}

static void __init db1550_hw_setup(void)
{
void __iomem *base;
Expand Down Expand Up @@ -61,7 +55,7 @@ static void __init db1550_hw_setup(void)
alchemy_gpio_direction_output(202, 0); /* green led on */
}

void __init board_setup(void)
int __init db1550_board_setup(void)
{
unsigned short whoami;

Expand All @@ -74,6 +68,7 @@ void __init board_setup(void)
(whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);

db1550_hw_setup();
return 0;
}

/*****************************************************************************/
Expand Down Expand Up @@ -430,13 +425,12 @@ static struct platform_device *db1550_devs[] __initdata = {
};

/* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */
static int __init db1550_pci_init(void)
int __init db1550_pci_setup(void)
{
return platform_device_register(&db1550_pci_host_dev);
}
arch_initcall(db1550_pci_init);

static int __init db1550_dev_init(void)
int __init db1550_dev_setup(void)
{
int swapped;

Expand Down Expand Up @@ -492,4 +486,3 @@ static int __init db1550_dev_init(void)

return platform_add_devices(db1550_devs, ARRAY_SIZE(db1550_devs));
}
device_initcall(db1550_dev_init);
9 changes: 4 additions & 5 deletions arch/mips/alchemy/devboards/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ void __init prom_init(void)

void prom_putchar(unsigned char c)
{
#ifdef CONFIG_MIPS_DB1300
alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c);
#else
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
#endif
if (alchemy_get_cputype() == ALCHEMY_CPU_AU1300)
alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c);
else
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
}


Expand Down
4 changes: 0 additions & 4 deletions arch/mips/boot/compressed/uart-alchemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@

void putc(char c)
{
#ifdef CONFIG_MIPS_DB1300
alchemy_uart_putchar(AU1300_UART2_PHYS_ADDR, c);
#else
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
#endif
}
Loading

0 comments on commit bd8510d

Please sign in to comment.