static int db1x_pm_enter(suspend_state_t state) { unsigned short bcsrs[16]; int i, j, hasint; /* save CPLD regs */ hasint = bcsr_read(BCSR_WHOAMI); hasint = BCSR_WHOAMI_BOARD(hasint) >= BCSR_WHOAMI_DB1200; j = (hasint) ? BCSR_MASKSET : BCSR_SYSTEM; for (i = BCSR_STATUS; i <= j; i++) bcsrs[i] = bcsr_read(i); /* shut off hexleds */ bcsr_write(BCSR_HEXCLEAR, 3); /* enable GPIO based wakeup */ alchemy_gpio1_input_enable(); /* clear and setup wake cause and source */ alchemy_wrsys(0, AU1000_SYS_WAKEMSK); alchemy_wrsys(0, AU1000_SYS_WAKESRC); alchemy_wrsys(db1x_pm_wakemsk, AU1000_SYS_WAKEMSK); /* setup 1Hz-timer-based wakeup: wait for reg access */ while (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_M20) asm volatile ("nop"); alchemy_wrsys(alchemy_rdsys(AU1000_SYS_TOYREAD) + db1x_pm_sleep_secs, AU1000_SYS_TOYMATCH2); /* wait for value to really hit the register */ while (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_M20) asm volatile ("nop"); /* ...and now the sandman can come! */ au_sleep(); /* restore CPLD regs */ for (i = BCSR_STATUS; i <= BCSR_SYSTEM; i++) bcsr_write(i, bcsrs[i]); /* restore CPLD int registers */ if (hasint) { bcsr_write(BCSR_INTCLR, 0xffff); bcsr_write(BCSR_MASKCLR, 0xffff); bcsr_write(BCSR_INTSTAT, 0xffff); bcsr_write(BCSR_INTSET, bcsrs[BCSR_INTSET]); bcsr_write(BCSR_MASKSET, bcsrs[BCSR_MASKSET]); } /* light up hexleds */ bcsr_write(BCSR_HEXCLEAR, 0); return 0; }
static int pb1200_mmc1_cd_setup(void *mmc_host, int en) { int ret; if (en) { ret = request_irq(PB1200_SD1_INSERT_INT, pb1200_mmc1_cd, 0, "sd1_insert", mmc_host); if (ret) goto out; ret = request_irq(PB1200_SD1_EJECT_INT, pb1200_mmc1_cd, 0, "sd1_eject", mmc_host); if (ret) { free_irq(PB1200_SD1_INSERT_INT, mmc_host); goto out; } if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) enable_irq(PB1200_SD1_EJECT_INT); else enable_irq(PB1200_SD1_INSERT_INT); } else { free_irq(PB1200_SD1_INSERT_INT, mmc_host); free_irq(PB1200_SD1_EJECT_INT, mmc_host); } ret = 0; out: return ret; }
static int db1200_mmc_cd_setup(void *mmc_host, int en) { int ret; if (en) { ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd, IRQF_DISABLED, "sd_insert", mmc_host); if (ret) goto out; ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd, IRQF_DISABLED, "sd_eject", mmc_host); if (ret) { free_irq(DB1200_SD0_INSERT_INT, mmc_host); goto out; } if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) enable_irq(DB1200_SD0_EJECT_INT); else enable_irq(DB1200_SD0_INSERT_INT); } else { free_irq(DB1200_SD0_INSERT_INT, mmc_host); free_irq(DB1200_SD0_EJECT_INT, mmc_host); } ret = 0; out: return ret; }
static int __init pb1100_dev_init(void) { int swapped; irq_set_irq_type(AU1100_GPIO9_INT, IRQF_TRIGGER_LOW); /* PCCD# */ irq_set_irq_type(AU1100_GPIO10_INT, IRQF_TRIGGER_LOW); /* PCSTSCHG# */ irq_set_irq_type(AU1100_GPIO11_INT, IRQF_TRIGGER_LOW); /* PCCard# */ irq_set_irq_type(AU1100_GPIO13_INT, IRQF_TRIGGER_LOW); /* DC_IRQ# */ /* PCMCIA. single socket, identical to Pb1500 */ db1x_register_pcmcia_socket( AU1000_PCMCIA_ATTR_PHYS_ADDR, AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, AU1000_PCMCIA_MEM_PHYS_ADDR, AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, AU1000_PCMCIA_IO_PHYS_ADDR, AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, AU1100_GPIO11_INT, AU1100_GPIO9_INT, /* card / insert */ /*AU1100_GPIO10_INT*/0, 0, 0); /* stschg / eject / id */ swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT; db1x_register_norflash(64 * 1024 * 1024, 4, swapped); platform_device_register(&au1100_lcd_device); return 0; }
static int __init pb1200_init_irq(void) { /* We have a problem with CPLD rev 3. */ if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) { printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "Pb1200 must be at CPLD rev 4. Please have Pb1200\n"); printk(KERN_ERR "updated to latest revision. This software will\n"); printk(KERN_ERR "not work on anything less than CPLD rev 4.\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); panic("Game over. Your score is 0."); } set_irq_type(AU1200_GPIO7_INT, IRQF_TRIGGER_LOW); bcsr_init_irq(PB1200_INT_BEGIN, PB1200_INT_END, AU1200_GPIO7_INT); return 0; }
int __init db1300_board_setup(void) { unsigned short whoami; bcsr_init(DB1300_BCSR_PHYS_ADDR, DB1300_BCSR_PHYS_ADDR + DB1300_BCSR_HEXLED_OFS); whoami = bcsr_read(BCSR_WHOAMI); if (BCSR_WHOAMI_BOARD(whoami) != BCSR_WHOAMI_DB1300) return -ENODEV; db1300_gpio_config(); printk(KERN_INFO "NetLogic DBAu1300 Development Platform.\n\t" "BoardID %d CPLD Rev %d DaughtercardID %d\n", BCSR_WHOAMI_BOARD(whoami), BCSR_WHOAMI_CPLD(whoami), BCSR_WHOAMI_DCID(whoami)); /* enable UARTs, YAMON only enables #2 */ alchemy_uart_enable(AU1300_UART0_PHYS_ADDR); alchemy_uart_enable(AU1300_UART1_PHYS_ADDR); alchemy_uart_enable(AU1300_UART3_PHYS_ADDR); return 0; }
static int __init db1300_device_init(void) { int swapped, cpldirq; /* setup CPLD IRQ muxer */ cpldirq = au1300_gpio_to_irq(AU1300_PIN_EXTCLK1); irq_set_irq_type(cpldirq, IRQ_TYPE_LEVEL_HIGH); bcsr_init_irq(DB1300_FIRST_INT, DB1300_LAST_INT, cpldirq); /* insert/eject IRQs: one always triggers so don't enable them * when doing request_irq() on them. DB1200 has this bug too. */ irq_set_status_flags(DB1300_SD1_INSERT_INT, IRQ_NOAUTOEN); irq_set_status_flags(DB1300_SD1_EJECT_INT, IRQ_NOAUTOEN); irq_set_status_flags(DB1300_CF_INSERT_INT, IRQ_NOAUTOEN); irq_set_status_flags(DB1300_CF_EJECT_INT, IRQ_NOAUTOEN); /* * setup board */ prom_get_ethernet_addr(&db1300_eth_config.mac[0]); i2c_register_board_info(0, db1300_i2c_devs, ARRAY_SIZE(db1300_i2c_devs)); /* Audio PSC clock is supplied by codecs (PSC1, 2) */ __raw_writel(PSC_SEL_CLK_SERCLK, (void __iomem *)KSEG1ADDR(AU1300_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); wmb(); __raw_writel(PSC_SEL_CLK_SERCLK, (void __iomem *)KSEG1ADDR(AU1300_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET); wmb(); /* I2C uses internal 48MHz EXTCLK1 */ __raw_writel(PSC_SEL_CLK_INTCLK, (void __iomem *)KSEG1ADDR(AU1300_PSC3_PHYS_ADDR) + PSC_SEL_OFFSET); wmb(); /* enable power to USB ports */ bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_USBHPWR | BCSR_RESETS_OTGPWR); /* although it is socket #0, it uses the CPLD bits which previous boards * have used for socket #1. */ db1x_register_pcmcia_socket( AU1000_PCMCIA_ATTR_PHYS_ADDR, AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x00400000 - 1, AU1000_PCMCIA_MEM_PHYS_ADDR, AU1000_PCMCIA_MEM_PHYS_ADDR + 0x00400000 - 1, AU1000_PCMCIA_IO_PHYS_ADDR, AU1000_PCMCIA_IO_PHYS_ADDR + 0x00010000 - 1, DB1300_CF_INT, DB1300_CF_INSERT_INT, 0, DB1300_CF_EJECT_INT, 1); swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; db1x_register_norflash(64 << 20, 2, swapped); return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev)); }
int __init db1235_arch_init(void) { int id = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); if (id == BCSR_WHOAMI_DB1550) return db1550_pci_setup(0); else if ((id == BCSR_WHOAMI_PB1550_SDR) || (id == BCSR_WHOAMI_PB1550_DDR)) return db1550_pci_setup(1); return 0; }
static int __init db1200_detect_board(void) { int bid; /* try the DB1200 first */ bcsr_init(DB1200_BCSR_PHYS_ADDR, DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS); if (BCSR_WHOAMI_DB1200 == BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { unsigned short t = bcsr_read(BCSR_HEXLEDS); bcsr_write(BCSR_HEXLEDS, ~t); if (bcsr_read(BCSR_HEXLEDS) != t) { bcsr_write(BCSR_HEXLEDS, t); return 0; } } /* okay, try the PB1200 then */ bcsr_init(PB1200_BCSR_PHYS_ADDR, PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS); bid = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); if ((bid == BCSR_WHOAMI_PB1200_DDR1) || (bid == BCSR_WHOAMI_PB1200_DDR2)) { unsigned short t = bcsr_read(BCSR_HEXLEDS); bcsr_write(BCSR_HEXLEDS, ~t); if (bcsr_read(BCSR_HEXLEDS) != t) { bcsr_write(BCSR_HEXLEDS, t); return 0; } } return 1; /* it's neither */ }
static const char *board_type_str(void) { switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { case BCSR_WHOAMI_DB1000: return "DB1000"; case BCSR_WHOAMI_DB1500: return "DB1500"; case BCSR_WHOAMI_DB1100: return "DB1100"; default: return "(unknown)"; } }
static void db1100_mmc1_set_power(void *mmc_host, int state) { int bit; if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100) bit = BCSR_BOARD_SD1PWR; else bit = BCSR_BOARD_PB1100_SD1PWR; if (state) { bcsr_mod(BCSR_BOARD, 0, bit); msleep(400); /* stabilization time */ } else bcsr_mod(BCSR_BOARD, bit, 0); }
static int __init db1300_device_init(void) { int swapped, cpldirq; cpldirq = au1300_gpio_to_irq(AU1300_PIN_EXTCLK1); irq_set_irq_type(cpldirq, IRQ_TYPE_LEVEL_HIGH); bcsr_init_irq(DB1300_FIRST_INT, DB1300_LAST_INT, cpldirq); irq_set_status_flags(DB1300_SD1_INSERT_INT, IRQ_NOAUTOEN); irq_set_status_flags(DB1300_SD1_EJECT_INT, IRQ_NOAUTOEN); irq_set_status_flags(DB1300_CF_INSERT_INT, IRQ_NOAUTOEN); irq_set_status_flags(DB1300_CF_EJECT_INT, IRQ_NOAUTOEN); prom_get_ethernet_addr(&db1300_eth_config.mac[0]); i2c_register_board_info(0, db1300_i2c_devs, ARRAY_SIZE(db1300_i2c_devs)); __raw_writel(PSC_SEL_CLK_SERCLK, (void __iomem *)KSEG1ADDR(AU1300_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); wmb(); __raw_writel(PSC_SEL_CLK_SERCLK, (void __iomem *)KSEG1ADDR(AU1300_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET); wmb(); __raw_writel(PSC_SEL_CLK_INTCLK, (void __iomem *)KSEG1ADDR(AU1300_PSC3_PHYS_ADDR) + PSC_SEL_OFFSET); wmb(); bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_USBHPWR | BCSR_RESETS_OTGPWR); db1x_register_pcmcia_socket( AU1000_PCMCIA_ATTR_PHYS_ADDR, AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x00400000 - 1, AU1000_PCMCIA_MEM_PHYS_ADDR, AU1000_PCMCIA_MEM_PHYS_ADDR + 0x00400000 - 1, AU1000_PCMCIA_IO_PHYS_ADDR, AU1000_PCMCIA_IO_PHYS_ADDR + 0x00010000 - 1, DB1300_CF_INT, DB1300_CF_INSERT_INT, 0, DB1300_CF_EJECT_INT, 1); swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; db1x_register_norflash(64 << 20, 2, swapped); return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev)); }
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: case BCSR_WHOAMI_PB1550_SDR: case BCSR_WHOAMI_PB1550_DDR: return db1550_dev_setup(); } return 0; }
static int db1100_mmc1_cd_setup(void *mmc_host, int en) { int ret = 0, irq; if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100) irq = AU1100_GPIO20_INT; else irq = AU1100_GPIO15_INT; /* PB1100 SD1 CD# */ if (en) { irq_set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); ret = request_irq(irq, db1100_mmc_cd, 0, "sd1_cd", mmc_host); } else free_irq(irq, mmc_host); return ret; }
int __init db1000_board_setup(void) { /* initialize board register space */ bcsr_init(DB1000_BCSR_PHYS_ADDR, DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS); switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) { case BCSR_WHOAMI_DB1000: case BCSR_WHOAMI_DB1500: case BCSR_WHOAMI_DB1100: case BCSR_WHOAMI_PB1500: case BCSR_WHOAMI_PB1500R2: case BCSR_WHOAMI_PB1100: pr_info("AMD Alchemy %s Board\n", get_system_type()); return 0; } return -ENODEV; }
void __init board_setup(void) { unsigned short whoami; db1300_gpio_config(); bcsr_init(DB1300_BCSR_PHYS_ADDR, DB1300_BCSR_PHYS_ADDR + DB1300_BCSR_HEXLED_OFS); whoami = bcsr_read(BCSR_WHOAMI); printk(KERN_INFO "NetLogic DBAu1300 Development Platform.\n\t" "BoardID %d CPLD Rev %d DaughtercardID %d\n", BCSR_WHOAMI_BOARD(whoami), BCSR_WHOAMI_CPLD(whoami), BCSR_WHOAMI_DCID(whoami)); alchemy_uart_enable(AU1300_UART0_PHYS_ADDR); alchemy_uart_enable(AU1300_UART1_PHYS_ADDR); alchemy_uart_enable(AU1300_UART3_PHYS_ADDR); }
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"; case BCSR_WHOAMI_PB1550_SDR: case BCSR_WHOAMI_PB1550_DDR: return "PB1550"; default: return "(unknown)"; } }
static int __init pb1500_dev_init(void) { int swapped; /* PCMCIA. single socket, identical to Pb1500 */ db1x_register_pcmcia_socket(PCMCIA_ATTR_PHYS_ADDR, PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, PCMCIA_MEM_PHYS_ADDR, PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, PCMCIA_IO_PHYS_ADDR, PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, AU1500_GPIO11_INT, /* card */ AU1500_GPIO9_INT, /* insert */ /*AU1500_GPIO10_INT*/0, /* stschg */ 0, /* eject */ 0); /* id */ swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT; db1x_register_norflash(64 * 1024 * 1024, 4, swapped); return 0; }
static int __init pb1200_init_irq(void) { /* We have a problem with CPLD rev 3. */ if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) { printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "Pb1200 must be at CPLD rev 4. Please have Pb1200\n"); printk(KERN_ERR "updated to latest revision. This software will\n"); printk(KERN_ERR "not work on anything less than CPLD rev 4.\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); panic("Game over. Your score is 0."); } <<<<<<< HEAD
/* Some peripheral base addresses differ on the PB1200 */ static int __init pb1200_res_fixup(void) { /* CPLD Revs earlier than 4 cause problems */ if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) { printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "PB1200 must be at CPLD rev 4. Please have\n"); printk(KERN_ERR "the board updated to latest revisions.\n"); printk(KERN_ERR "This software will not work reliably\n"); printk(KERN_ERR "on anything older than CPLD rev 4.!\n"); printk(KERN_ERR "WARNING!!!\n"); printk(KERN_ERR "WARNING!!!\n"); return 1; } db1200_nand_res[0].start = PB1200_NAND_PHYS_ADDR; 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_eth_res[0].start = PB1200_ETH_PHYS_ADDR; db1200_eth_res[0].end = PB1200_ETH_PHYS_ADDR + 0xff; return 0; }
int __init db1200_board_setup(void) { unsigned short whoami; if (db1200_detect_board()) return -ENODEV; whoami = bcsr_read(BCSR_WHOAMI); switch (BCSR_WHOAMI_BOARD(whoami)) { case BCSR_WHOAMI_PB1200_DDR1: case BCSR_WHOAMI_PB1200_DDR2: case BCSR_WHOAMI_DB1200: break; default: return -ENODEV; } printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d" " Board-ID %d Daughtercard ID %d\n", get_system_type(), (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf); return 0; }
static int __init db1200_audio_load(void) { int ret; ret = -ENOMEM; db1200_asoc_dev = platform_device_alloc("soc-audio", 1); /* PSC1 */ if (!db1200_asoc_dev) goto out; /* DB1200 board setup set PSC1MUX to preferred audio device */ if (bcsr_read(BCSR_RESETS) & BCSR_RESETS_PSC1MUX) platform_set_drvdata(db1200_asoc_dev, &db1200_i2s_machine); else platform_set_drvdata(db1200_asoc_dev, &db1200_ac97_machine); ret = platform_device_add(db1200_asoc_dev); if (ret) { platform_device_put(db1200_asoc_dev); db1200_asoc_dev = NULL; } out: return ret; }
static int db1200_mmc_card_inserted(void *mmc_host) { return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) ? 1 : 0; }
static int db1300_mmc_card_inserted(void *mmc_host) { return bcsr_read(BCSR_SIGSTAT) & (1 << 12); /* insertion irq signal */ }
static int db1300_mmc_card_readonly(void *mmc_host) { /* it uses SD1 interface, but the DB1200's SD0 bit in the CPLD */ return bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP; }
static int db1100_mmc1_card_readonly(void *mmc_host) { return (bcsr_read(BCSR_BOARD) & BCSR_BOARD_SD1WP) ? 1 : 0; }
static int __init db1000_dev_init(void) { int board = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); int c0, c1, d0, d1, s0, s1; unsigned long pfc; if (board == BCSR_WHOAMI_DB1500) { c0 = AU1500_GPIO2_INT; c1 = AU1500_GPIO5_INT; d0 = AU1500_GPIO0_INT; d1 = AU1500_GPIO3_INT; s0 = AU1500_GPIO1_INT; s1 = AU1500_GPIO4_INT; } else if (board == BCSR_WHOAMI_DB1100) { c0 = AU1100_GPIO2_INT; c1 = AU1100_GPIO5_INT; d0 = AU1100_GPIO0_INT; d1 = AU1100_GPIO3_INT; s0 = AU1100_GPIO1_INT; s1 = AU1100_GPIO4_INT; gpio_direction_input(19); /* sd0 cd# */ gpio_direction_input(20); /* sd1 cd# */ gpio_direction_input(21); /* touch pendown# */ gpio_direction_input(207); /* SPI MISO */ gpio_direction_output(208, 0); /* SPI MOSI */ gpio_direction_output(209, 1); /* SPI SCK */ gpio_direction_output(210, 1); /* SPI CS# */ /* spi_gpio on SSI0 pins */ pfc = __raw_readl((void __iomem *)SYS_PINFUNC); pfc |= (1 << 0); /* SSI0 pins as GPIOs */ __raw_writel(pfc, (void __iomem *)SYS_PINFUNC); wmb(); spi_register_board_info(db1100_spi_info, ARRAY_SIZE(db1100_spi_info)); platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs)); } else if (board == BCSR_WHOAMI_DB1000) { c0 = AU1000_GPIO2_INT; c1 = AU1000_GPIO5_INT; d0 = AU1000_GPIO0_INT; d1 = AU1000_GPIO3_INT; s0 = AU1000_GPIO1_INT; s1 = AU1000_GPIO4_INT; platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs)); } else return 0; /* unknown board, no further dev setup to do */ irq_set_irq_type(d0, IRQ_TYPE_EDGE_BOTH); irq_set_irq_type(d1, IRQ_TYPE_EDGE_BOTH); irq_set_irq_type(c0, IRQ_TYPE_LEVEL_LOW); irq_set_irq_type(c1, IRQ_TYPE_LEVEL_LOW); irq_set_irq_type(s0, IRQ_TYPE_LEVEL_LOW); irq_set_irq_type(s1, IRQ_TYPE_LEVEL_LOW); db1x_register_pcmcia_socket( AU1000_PCMCIA_ATTR_PHYS_ADDR, AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, AU1000_PCMCIA_MEM_PHYS_ADDR, AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, AU1000_PCMCIA_IO_PHYS_ADDR, AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, c0, d0, /*s0*/0, 0, 0); db1x_register_pcmcia_socket( AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000, AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1, AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000, AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, c1, d1, /*s1*/0, 0, 1); platform_add_devices(db1x00_devs, ARRAY_SIZE(db1x00_devs)); db1x_register_norflash(32 << 20, 4 /* 32bit */, F_SWAPPED); return 0; }
static int db1200_mmc_card_readonly(void *mmc_host) { return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 1 : 0; }
static int db1300_mmc_card_readonly(void *mmc_host) { return bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP; }
static int __init db1200_dev_init(void) { unsigned long pfc; unsigned short sw; int swapped; i2c_register_board_info(0, db1200_i2c_devs, ARRAY_SIZE(db1200_i2c_devs)); spi_register_board_info(db1200_spi_devs, ARRAY_SIZE(db1200_i2c_devs)); /* SWITCHES: S6.8 I2C/SPI selector (OFF=I2C ON=SPI) * S6.7 AC97/I2S selector (OFF=AC97 ON=I2S) */ /* NOTE: GPIO215 controls OTG VBUS supply. In SPI mode however * this pin is claimed by PSC0 (unused though, but pinmux doesn't * allow to free it without crippling the SPI interface). * As a result, in SPI mode, OTG simply won't work (PSC0 uses * it as an input pin which is pulled high on the boards). */ pfc = __raw_readl((void __iomem *)SYS_PINFUNC) & ~SYS_PINFUNC_P0A; /* switch off OTG VBUS supply */ gpio_request(215, "otg-vbus"); gpio_direction_output(215, 1); printk(KERN_INFO "DB1200 device configuration:\n"); sw = bcsr_read(BCSR_SWITCHES); if (sw & BCSR_SWITCHES_DIP_8) { db1200_devs[0] = &db1200_i2c_dev; bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0); pfc |= (2 << 17); /* GPIO2 block owns GPIO215 */ printk(KERN_INFO " S6.8 OFF: PSC0 mode I2C\n"); printk(KERN_INFO " OTG port VBUS supply available!\n"); } else { db1200_devs[0] = &db1200_spi_dev; bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC0MUX); pfc |= (1 << 17); /* PSC0 owns GPIO215 */ printk(KERN_INFO " S6.8 ON : PSC0 mode SPI\n"); printk(KERN_INFO " OTG port VBUS supply disabled\n"); } __raw_writel(pfc, (void __iomem *)SYS_PINFUNC); wmb(); /* Audio: DIP7 selects I2S(0)/AC97(1), but need I2C for I2S! * so: DIP7=1 || DIP8=0 => AC97, DIP7=0 && DIP8=1 => I2S */ sw &= BCSR_SWITCHES_DIP_8 | BCSR_SWITCHES_DIP_7; if (sw == BCSR_SWITCHES_DIP_8) { bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX); db1200_audio_dev.name = "au1xpsc_i2s"; db1200_sound_dev.name = "db1200-i2s"; printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n"); } else { bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0); db1200_audio_dev.name = "au1xpsc_ac97"; db1200_sound_dev.name = "db1200-ac97"; printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n"); } /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */ __raw_writel(PSC_SEL_CLK_SERCLK, (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); wmb(); db1x_register_pcmcia_socket( AU1000_PCMCIA_ATTR_PHYS_ADDR, AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1, AU1000_PCMCIA_MEM_PHYS_ADDR, AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1, AU1000_PCMCIA_IO_PHYS_ADDR, AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, DB1200_PC0_INT, DB1200_PC0_INSERT_INT, /*DB1200_PC0_STSCHG_INT*/0, DB1200_PC0_EJECT_INT, 0); db1x_register_pcmcia_socket( AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000, AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1, AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000, AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, DB1200_PC1_INT, DB1200_PC1_INSERT_INT, /*DB1200_PC1_STSCHG_INT*/0, DB1200_PC1_EJECT_INT, 1); swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT; db1x_register_norflash(64 << 20, 2, swapped); return platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs)); }