|
19 | 19 | #include <linux/mtd/rawnand.h> |
20 | 20 | #include <linux/mtd/partitions.h> |
21 | 21 | #include <linux/spi/spi.h> |
| 22 | +#include <linux/spi/flash.h> |
| 23 | +#include <linux/spi/mmc_spi.h> |
| 24 | +#include <linux/mmc/host.h> |
22 | 25 | #include <linux/platform_data/spi-ep93xx.h> |
23 | 26 |
|
24 | 27 | #include <mach/gpio-ep93xx.h> |
25 | 28 | #include <mach/hardware.h> |
| 29 | +#include <mach/irqs.h> |
| 30 | +#include <mach/gpio-ep93xx.h> |
26 | 31 |
|
27 | 32 | #include <asm/mach-types.h> |
28 | 33 | #include <asm/mach/map.h> |
@@ -50,6 +55,11 @@ static struct map_desc ts72xx_io_desc[] __initdata = { |
50 | 55 | .pfn = __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE), |
51 | 56 | .length = TS72XX_OPTIONS2_SIZE, |
52 | 57 | .type = MT_DEVICE, |
| 58 | + }, { |
| 59 | + .virtual = (unsigned long)TS72XX_CPLDVER_VIRT_BASE, |
| 60 | + .pfn = __phys_to_pfn(TS72XX_CPLDVER_PHYS_BASE), |
| 61 | + .length = TS72XX_CPLDVER_SIZE, |
| 62 | + .type = MT_DEVICE, |
53 | 63 | } |
54 | 64 | }; |
55 | 65 |
|
@@ -211,6 +221,69 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = { |
211 | 221 | .phy_id = 1, |
212 | 222 | }; |
213 | 223 |
|
| 224 | +/************************************************************************* |
| 225 | + * SPI SD/MMC host |
| 226 | + *************************************************************************/ |
| 227 | +#define BK3_EN_SDCARD_PHYS_BASE 0x12400000 |
| 228 | +#define BK3_EN_SDCARD_PWR 0x0 |
| 229 | +#define BK3_DIS_SDCARD_PWR 0x0C |
| 230 | +static void bk3_mmc_spi_setpower(struct device *dev, unsigned int vdd) |
| 231 | +{ |
| 232 | + void __iomem *pwr_sd = ioremap(BK3_EN_SDCARD_PHYS_BASE, SZ_4K); |
| 233 | + |
| 234 | + if (!pwr_sd) { |
| 235 | + pr_err("Failed to enable SD card power!"); |
| 236 | + return; |
| 237 | + } |
| 238 | + |
| 239 | + pr_debug("%s: SD card pwr %s VDD:0x%x\n", __func__, |
| 240 | + !!vdd ? "ON" : "OFF", vdd); |
| 241 | + |
| 242 | + if (!!vdd) |
| 243 | + __raw_writeb(BK3_EN_SDCARD_PWR, pwr_sd); |
| 244 | + else |
| 245 | + __raw_writeb(BK3_DIS_SDCARD_PWR, pwr_sd); |
| 246 | + |
| 247 | + iounmap(pwr_sd); |
| 248 | +} |
| 249 | + |
| 250 | +static struct mmc_spi_platform_data bk3_spi_mmc_data = { |
| 251 | + .detect_delay = 500, |
| 252 | + .powerup_msecs = 100, |
| 253 | + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 254 | + .caps = MMC_CAP_NONREMOVABLE, |
| 255 | + .setpower = bk3_mmc_spi_setpower, |
| 256 | +}; |
| 257 | + |
| 258 | +/************************************************************************* |
| 259 | + * SPI Bus - SD card access |
| 260 | + *************************************************************************/ |
| 261 | +static struct spi_board_info bk3_spi_board_info[] __initdata = { |
| 262 | + { |
| 263 | + .modalias = "mmc_spi", |
| 264 | + .platform_data = &bk3_spi_mmc_data, |
| 265 | + .max_speed_hz = 7.4E6, |
| 266 | + .bus_num = 0, |
| 267 | + .chip_select = 0, |
| 268 | + .mode = SPI_MODE_0, |
| 269 | + }, |
| 270 | +}; |
| 271 | + |
| 272 | +/* |
| 273 | + * This is a stub -> the FGPIO[3] pin is not connected on the schematic |
| 274 | + * The all work is performed automatically by !SPI_FRAME (SFRM1) and |
| 275 | + * goes through CPLD |
| 276 | + */ |
| 277 | +static int bk3_spi_chipselects[] __initdata = { |
| 278 | + EP93XX_GPIO_LINE_F(3), |
| 279 | +}; |
| 280 | + |
| 281 | +static struct ep93xx_spi_info bk3_spi_master __initdata = { |
| 282 | + .chipselect = bk3_spi_chipselects, |
| 283 | + .num_chipselect = ARRAY_SIZE(bk3_spi_chipselects), |
| 284 | + .use_dma = 1, |
| 285 | +}; |
| 286 | + |
214 | 287 | /************************************************************************* |
215 | 288 | * TS72XX support code |
216 | 289 | *************************************************************************/ |
@@ -285,3 +358,66 @@ MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC") |
285 | 358 | .init_late = ep93xx_init_late, |
286 | 359 | .restart = ep93xx_restart, |
287 | 360 | MACHINE_END |
| 361 | + |
| 362 | +/************************************************************************* |
| 363 | + * EP93xx I2S audio peripheral handling |
| 364 | + *************************************************************************/ |
| 365 | +static struct resource ep93xx_i2s_resource[] = { |
| 366 | + DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100), |
| 367 | + DEFINE_RES_IRQ_NAMED(IRQ_EP93XX_SAI, "spilink i2s slave"), |
| 368 | +}; |
| 369 | + |
| 370 | +static struct platform_device ep93xx_i2s_device = { |
| 371 | + .name = "ep93xx-spilink-i2s", |
| 372 | + .id = -1, |
| 373 | + .num_resources = ARRAY_SIZE(ep93xx_i2s_resource), |
| 374 | + .resource = ep93xx_i2s_resource, |
| 375 | +}; |
| 376 | + |
| 377 | +/************************************************************************* |
| 378 | + * BK3 support code |
| 379 | + *************************************************************************/ |
| 380 | +static struct mtd_partition bk3_nand_parts[] = { |
| 381 | + { |
| 382 | + .name = "System", |
| 383 | + .offset = 0x00000000, |
| 384 | + .size = 0x01e00000, |
| 385 | + }, { |
| 386 | + .name = "Data", |
| 387 | + .offset = 0x01e00000, |
| 388 | + .size = 0x05f20000 |
| 389 | + }, { |
| 390 | + .name = "RedBoot", |
| 391 | + .offset = 0x07d20000, |
| 392 | + .size = 0x002e0000, |
| 393 | + .mask_flags = MTD_WRITEABLE, /* force RO */ |
| 394 | + }, |
| 395 | +}; |
| 396 | + |
| 397 | +static void __init bk3_init_machine(void) |
| 398 | +{ |
| 399 | + ep93xx_init_devices(); |
| 400 | + |
| 401 | + ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts), |
| 402 | + EP93XX_CS6_PHYS_BASE); |
| 403 | + |
| 404 | + ep93xx_register_eth(&ts72xx_eth_data, 1); |
| 405 | + |
| 406 | + ep93xx_register_spi(&bk3_spi_master, bk3_spi_board_info, |
| 407 | + ARRAY_SIZE(bk3_spi_board_info)); |
| 408 | + |
| 409 | + /* Configure ep93xx's I2S to use AC97 pins */ |
| 410 | + ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_I2SONAC97); |
| 411 | + platform_device_register(&ep93xx_i2s_device); |
| 412 | +} |
| 413 | + |
| 414 | +MACHINE_START(BK3, "Liebherr controller BK3.1") |
| 415 | + /* Maintainer: Lukasz Majewski <lukma@denx.de> */ |
| 416 | + .atag_offset = 0x100, |
| 417 | + .map_io = ts72xx_map_io, |
| 418 | + .init_irq = ep93xx_init_irq, |
| 419 | + .init_time = ep93xx_timer_init, |
| 420 | + .init_machine = bk3_init_machine, |
| 421 | + .init_late = ep93xx_init_late, |
| 422 | + .restart = ep93xx_restart, |
| 423 | +MACHINE_END |
0 commit comments