MIPS: Whitespace cleanup.
[linux-drm-fsl-dcu.git] / arch / mips / alchemy / devboards / db1200.c
index bf2248474fa8da6c4516c0567803c781636cb385..a84d98b8f96e8fbe2abfb4652f03c579ff3f3ab1 100644 (file)
 
 #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;
 
@@ -96,26 +80,24 @@ 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 */
        pfc = __raw_readl((void __iomem *)SYS_PINFUNC);
        pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
        pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3);
-       pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */
+       pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */
        __raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
        wmb();
 
@@ -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;
 }
 
 /******************************************************************************/
@@ -145,7 +129,7 @@ void __init board_setup(void)
 static struct mtd_partition db1200_spiflash_parts[] = {
        {
                .name   = "spi_flash",
-               .offset = 0,
+               .offset = 0,
                .size   = MTDPART_SIZ_FULL,
        },
 };
@@ -216,12 +200,12 @@ static int au1200_nand_device_ready(struct mtd_info *mtd)
 static struct mtd_partition db1200_nand_parts[] = {
        {
                .name   = "NAND FS 0",
-               .offset = 0,
+               .offset = 0,
                .size   = 8 * 1024 * 1024,
        },
        {
                .name   = "NAND FS 1",
-               .offset = MTDPART_OFS_APPEND,
+               .offset = MTDPART_OFS_APPEND,
                .size   = MTDPART_SIZ_FULL
        },
 };
@@ -411,7 +395,7 @@ static void db1200_mmcled_set(struct led_classdev *led,
 }
 
 static struct led_classdev db1200_mmc_led = {
-       .brightness_set = db1200_mmcled_set,
+       .brightness_set = db1200_mmcled_set,
 };
 
 /* -- */
@@ -479,7 +463,7 @@ static void pb1200_mmc1led_set(struct led_classdev *led,
 }
 
 static struct led_classdev pb1200_mmc1_led = {
-       .brightness_set = pb1200_mmc1led_set,
+       .brightness_set = pb1200_mmc1led_set,
 };
 
 static void pb1200_mmc1_set_power(void *mmc_host, int state)
@@ -542,7 +526,7 @@ static struct resource au1200_mmc0_resources[] = {
        }
 };
 
-static u64 au1xxx_mmc_dmamask =  DMA_BIT_MASK(32);
+static u64 au1xxx_mmc_dmamask =         DMA_BIT_MASK(32);
 
 static struct platform_device db1200_mmc0_dev = {
        .name           = "au1xxx-mmc",
@@ -617,7 +601,7 @@ static int db1200fb_panel_shutdown(void)
 static struct au1200fb_platdata db1200fb_pd = {
        .panel_index    = db1200fb_panel_index,
        .panel_init     = db1200fb_panel_init,
-       .panel_shutdown = db1200fb_panel_shutdown,
+       .panel_shutdown = db1200fb_panel_shutdown,
 };
 
 static struct resource au1200_lcd_res[] = {
@@ -788,15 +772,15 @@ static int __init pb1200_res_fixup(void)
        }
 
        db1200_nand_res[0].start = PB1200_NAND_PHYS_ADDR;
-       db1200_nand_res[0].end   = PB1200_NAND_PHYS_ADDR + 0xff;
+       db1200_nand_res[0].end   = PB1200_NAND_PHYS_ADDR + 0xff;
        db1200_ide_res[0].start = PB1200_IDE_PHYS_ADDR;
-       db1200_ide_res[0].end   = PB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1;
+       db1200_ide_res[0].end   = PB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1;
        db1200_eth_res[0].start = PB1200_ETH_PHYS_ADDR;
-       db1200_eth_res[0].end   = PB1200_ETH_PHYS_ADDR + 0xff;
+       db1200_eth_res[0].end   = PB1200_ETH_PHYS_ADDR + 0xff;
        return 0;
 }
 
-static int __init db1200_dev_init(void)
+int __init db1200_dev_setup(void)
 {
        unsigned long pfc;
        unsigned short sw;
@@ -813,7 +797,7 @@ static int __init db1200_dev_init(void)
        irq_set_irq_type(AU1200_GPIO7_INT, IRQ_TYPE_LEVEL_LOW);
        bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT);
 
-       /* insert/eject pairs: one of both is always screaming.  To avoid
+       /* insert/eject pairs: one of both is always screaming.  To avoid
         * issues they must not be automatically enabled when initially
         * requested.
         */
@@ -829,7 +813,7 @@ static int __init db1200_dev_init(void)
        spi_register_board_info(db1200_spi_devs,
                                ARRAY_SIZE(db1200_i2c_devs));
 
-       /* SWITCHES:    S6.8 I2C/SPI selector  (OFF=I2C  ON=SPI)
+       /* SWITCHES:    S6.8 I2C/SPI selector  (OFF=I2C  ON=SPI)
         *              S6.7 AC97/I2S selector (OFF=AC97 ON=I2S)
         *              or S12 on the PB1200.
         */
@@ -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) {
@@ -922,4 +906,3 @@ static int __init db1200_dev_init(void)
 
        return 0;
 }
-device_initcall(db1200_dev_init);