diff options
Diffstat (limited to 'arch/mips/alchemy/devboards')
21 files changed, 2248 insertions, 0 deletions
diff --git a/arch/mips/alchemy/devboards/db1200/Makefile b/arch/mips/alchemy/devboards/db1200/Makefile new file mode 100644 index 00000000000..17840a5e273 --- /dev/null +++ b/arch/mips/alchemy/devboards/db1200/Makefile | |||
| @@ -0,0 +1 @@ | |||
| obj-y += setup.o platform.o | |||
diff --git a/arch/mips/alchemy/devboards/db1200/platform.c b/arch/mips/alchemy/devboards/db1200/platform.c new file mode 100644 index 00000000000..fbb55935b99 --- /dev/null +++ b/arch/mips/alchemy/devboards/db1200/platform.c | |||
| @@ -0,0 +1,567 @@ | |||
| 1 | /* | ||
| 2 | * DBAu1200 board platform device registration | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2009 Manuel Lauss | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <linux/dma-mapping.h> | ||
| 22 | #include <linux/gpio.h> | ||
| 23 | #include <linux/i2c.h> | ||
| 24 | #include <linux/init.h> | ||
| 25 | #include <linux/io.h> | ||
| 26 | #include <linux/leds.h> | ||
| 27 | #include <linux/mmc/host.h> | ||
| 28 | #include <linux/mtd/mtd.h> | ||
| 29 | #include <linux/mtd/nand.h> | ||
| 30 | #include <linux/mtd/partitions.h> | ||
| 31 | #include <linux/platform_device.h> | ||
| 32 | #include <linux/serial_8250.h> | ||
| 33 | #include <linux/spi/spi.h> | ||
| 34 | #include <linux/spi/flash.h> | ||
| 35 | #include <linux/smc91x.h> | ||
| 36 | |||
| 37 | #include <asm/mach-au1x00/au1100_mmc.h> | ||
| 38 | #include <asm/mach-au1x00/au1xxx_dbdma.h> | ||
| 39 | #include <asm/mach-au1x00/au1550_spi.h> | ||
| 40 | #include <asm/mach-db1x00/bcsr.h> | ||
| 41 | #include <asm/mach-db1x00/db1200.h> | ||
| 42 | |||
| 43 | #include "../platform.h" | ||
| 44 | |||
| 45 | static struct mtd_partition db1200_spiflash_parts[] = { | ||
| 46 | { | ||
| 47 | .name = "DB1200 SPI flash", | ||
| 48 | .offset = 0, | ||
| 49 | .size = MTDPART_SIZ_FULL, | ||
| 50 | }, | ||
| 51 | }; | ||
| 52 | |||
| 53 | static struct flash_platform_data db1200_spiflash_data = { | ||
| 54 | .name = "s25fl001", | ||
| 55 | .parts = db1200_spiflash_parts, | ||
| 56 | .nr_parts = ARRAY_SIZE(db1200_spiflash_parts), | ||
| 57 | .type = "m25p10", | ||
| 58 | }; | ||
| 59 | |||
| 60 | static struct spi_board_info db1200_spi_devs[] __initdata = { | ||
| 61 | { | ||
| 62 | /* TI TMP121AIDBVR temp sensor */ | ||
| 63 | .modalias = "tmp121", | ||
| 64 | .max_speed_hz = 2000000, | ||
| 65 | .bus_num = 0, | ||
| 66 | .chip_select = 0, | ||
| 67 | .mode = 0, | ||
| 68 | }, | ||
| 69 | { | ||
| 70 | /* Spansion S25FL001D0FMA SPI flash */ | ||
| 71 | .modalias = "m25p80", | ||
| 72 | .max_speed_hz = 50000000, | ||
| 73 | .bus_num = 0, | ||
| 74 | .chip_select = 1, | ||
| 75 | .mode = 0, | ||
| 76 | .platform_data = &db1200_spiflash_data, | ||
| 77 | }, | ||
| 78 | }; | ||
| 79 | |||
| 80 | static struct i2c_board_info db1200_i2c_devs[] __initdata = { | ||
| 81 | { | ||
| 82 | /* AT24C04-10 I2C eeprom */ | ||
| 83 | I2C_BOARD_INFO("24c04", 0x52), | ||
| 84 | }, | ||
| 85 | { | ||
| 86 | /* Philips NE1619 temp/voltage sensor (adm1025 drv) */ | ||
| 87 | I2C_BOARD_INFO("ne1619", 0x2d), | ||
| 88 | }, | ||
| 89 | { | ||
| 90 | /* I2S audio codec WM8731 */ | ||
| 91 | I2C_BOARD_INFO("wm8731", 0x1b), | ||
| 92 | }, | ||
| 93 | }; | ||
| 94 | |||
| 95 | /**********************************************************************/ | ||
| 96 | |||
| 97 | static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, | ||
| 98 | unsigned int ctrl) | ||
| 99 | { | ||
| 100 | struct nand_chip *this = mtd->priv; | ||
| 101 | unsigned long ioaddr = (unsigned long)this->IO_ADDR_W; | ||
| 102 | |||
| 103 | ioaddr &= 0xffffff00; | ||
| 104 | |||
| 105 | if (ctrl & NAND_CLE) { | ||
| 106 | ioaddr += MEM_STNAND_CMD; | ||
| 107 | } else if (ctrl & NAND_ALE) { | ||
| 108 | ioaddr += MEM_STNAND_ADDR; | ||
| 109 | } else { | ||
| 110 | /* assume we want to r/w real data by default */ | ||
| 111 | ioaddr += MEM_STNAND_DATA; | ||
| 112 | } | ||
| 113 | this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr; | ||
| 114 | if (cmd != NAND_CMD_NONE) { | ||
| 115 | __raw_writeb(cmd, this->IO_ADDR_W); | ||
| 116 | wmb(); | ||
| 117 | } | ||
| 118 | } | ||
| 119 | |||
| 120 | static int au1200_nand_device_ready(struct mtd_info *mtd) | ||
| 121 | { | ||
| 122 | return __raw_readl((void __iomem *)MEM_STSTAT) & 1; | ||
| 123 | } | ||
| 124 | |||
| 125 | static const char *db1200_part_probes[] = { "cmdlinepart", NULL }; | ||
| 126 | |||
| 127 | static struct mtd_partition db1200_nand_parts[] = { | ||
| 128 | { | ||
| 129 | .name = "NAND FS 0", | ||
| 130 | .offset = 0, | ||
| 131 | .size = 8 * 1024 * 1024, | ||
| 132 | }, | ||
| 133 | { | ||
| 134 | .name = "NAND FS 1", | ||
| 135 | .offset = MTDPART_OFS_APPEND, | ||
| 136 | .size = MTDPART_SIZ_FULL | ||
| 137 | }, | ||
| 138 | }; | ||
| 139 | |||
| 140 | struct platform_nand_data db1200_nand_platdata = { | ||
| 141 | .chip = { | ||
| 142 | .nr_chips = 1, | ||
| 143 | .chip_offset = 0, | ||
| 144 | .nr_partitions = ARRAY_SIZE(db1200_nand_parts), | ||
| 145 | .partitions = db1200_nand_parts, | ||
| 146 | .chip_delay = 20, | ||
| 147 | .part_probe_types = db1200_part_probes, | ||
| 148 | }, | ||
| 149 | .ctrl = { | ||
| 150 | .dev_ready = au1200_nand_device_ready, | ||
| 151 | .cmd_ctrl = au1200_nand_cmd_ctrl, | ||
| 152 | }, | ||
| 153 | }; | ||
| 154 | |||
| 155 | static struct resource db1200_nand_res[] = { | ||
| 156 | [0] = { | ||
| 157 | .start = DB1200_NAND_PHYS_ADDR, | ||
| 158 | .end = DB1200_NAND_PHYS_ADDR + 0xff, | ||
| 159 | .flags = IORESOURCE_MEM, | ||
| 160 | }, | ||
| 161 | }; | ||
| 162 | |||
| 163 | static struct platform_device db1200_nand_dev = { | ||
| 164 | .name = "gen_nand", | ||
| 165 | .num_resources = ARRAY_SIZE(db1200_nand_res), | ||
| 166 | .resource = db1200_nand_res, | ||
| 167 | .id = -1, | ||
| 168 | .dev = { | ||
| 169 | .platform_data = &db1200_nand_platdata, | ||
| 170 | } | ||
| 171 | }; | ||
| 172 | |||
| 173 | /**********************************************************************/ | ||
| 174 | |||
