Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'rmobile-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6

* 'rmobile-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (34 commits)
ARM: mach-shmobile: mackerel: add renesas_usbhs support for USB1
ARM: mach-shmobile: Correct the G4EVM SDHI0 I/O range.
ARM: arch-shmobile: sh7372: add renesas_usbhs irq support
ARM: mach-shmobile: sh73a0: mark DMA slave ID 0 as invalid
ARM: mach-shmobile: mark DMA slave ID 0 as invalid
ARM: mach-shmobile: Enable DMAEngine for SDHI on AG5EVM
ARM: mach-shmobile: Enable DMAEngine for MMCIF on AG5EVM
ARM: mach-shmobile: sh73a0 DMA Engine support for SY-DMAC
dmaengine: shdma: Update SH_DMAC_MAX_CHANNELS to 20
dmaengine: shdma: Fix SH_DMAC_MAX_CHANNELS handling
dmaengine: shdma: Make second memory window optional
ARM: mach-shmobile: Tidy up after SH7372 pm changes.
ARM: mach-shmobile: sh7372 Core Standby CPUIdle
ARM: mach-shmobile: CPUIdle support
ARM: mach-shmobile: sh7372 Core Standby Suspend-to-RAM
ARM: mach-shmobile: Suspend-to-RAM support
mailmap: Add entry for Damian Hobson-Garcia.
ARM: switch mackerel to dynamically manage the platform camera
ARM: mach-shmobile: Add SDHI support for AG5EVM and sh73a0
ARM: arch-shmobile: Use multiple irq vectors for SDHI
...

+1943 -102
+1
.mailmap
··· 32 32 Brian King <brking@us.ibm.com> 33 33 Christoph Hellwig <hch@lst.de> 34 34 Corey Minyard <minyard@acm.org> 35 + Damian Hobson-Garcia <dhobsong@igel.co.jp> 35 36 David Brownell <david-b@pacbell.net> 36 37 David Woodhouse <dwmw2@shinybook.infradead.org> 37 38 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
+5
arch/arm/mach-shmobile/Makefile
··· 30 30 obj-$(CONFIG_ARCH_SH7372) += entry-intc.o 31 31 obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o 32 32 33 + # PM objects 34 + obj-$(CONFIG_SUSPEND) += suspend.o 35 + obj-$(CONFIG_CPU_IDLE) += cpuidle.o 36 + obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o 37 + 33 38 # Board objects 34 39 obj-$(CONFIG_MACH_G3EVM) += board-g3evm.o 35 40 obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o
+118
arch/arm/mach-shmobile/board-ag5evm.c
··· 34 34 #include <linux/input/sh_keysc.h> 35 35 #include <linux/mmc/host.h> 36 36 #include <linux/mmc/sh_mmcif.h> 37 + #include <linux/mmc/sh_mobile_sdhi.h> 38 + #include <linux/mfd/tmio.h> 37 39 #include <linux/sh_clk.h> 38 40 #include <video/sh_mobile_lcdc.h> 39 41 #include <video/sh_mipi_dsi.h> ··· 158 156 }, 159 157 }; 160 158 159 + static struct sh_mmcif_dma sh_mmcif_dma = { 160 + .chan_priv_rx = { 161 + .slave_id = SHDMA_SLAVE_MMCIF_RX, 162 + }, 163 + .chan_priv_tx = { 164 + .slave_id = SHDMA_SLAVE_MMCIF_TX, 165 + }, 166 + }; 161 167 static struct sh_mmcif_plat_data sh_mmcif_platdata = { 162 168 .sup_pclk = 0, 163 169 .ocr = MMC_VDD_165_195, 164 170 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, 171 + .dma = &sh_mmcif_dma, 165 172 }; 166 173 167 174 static struct platform_device mmc_device = { ··· 307 296 /* MIPI-DSI */ 308 297 static struct resource mipidsi0_resources[] = { 309 298 [0] = { 299 + .name = "DSI0", 310 300 .start = 0xfeab0000, 311 301 .end = 0xfeab3fff, 312 302 .flags = IORESOURCE_MEM, 313 303 }, 314 304 [1] = { 305 + .name = "DSI0", 315 306 .start = 0xfeab4000, 316 307 .end = 0xfeab7fff, 317 308 .flags = IORESOURCE_MEM, ··· 338 325 }, 339 326 }; 340 327 328 + static struct sh_mobile_sdhi_info sdhi0_info = { 329 + .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 330 + .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 331 + .tmio_caps = MMC_CAP_SD_HIGHSPEED, 332 + .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 333 + }; 334 + 335 + static struct resource sdhi0_resources[] = { 336 + [0] = { 337 + .name = "SDHI0", 338 + .start = 0xee100000, 339 + .end = 0xee1000ff, 340 + .flags = IORESOURCE_MEM, 341 + }, 342 + [1] = { 343 + .start = gic_spi(83), 344 + .flags = IORESOURCE_IRQ, 345 + }, 346 + [2] = { 347 + .start = gic_spi(84), 348 + .flags = IORESOURCE_IRQ, 349 + }, 350 + [3] = { 351 + .start = gic_spi(85), 352 + .flags = IORESOURCE_IRQ, 353 + }, 354 + }; 355 + 356 + static struct platform_device sdhi0_device = { 357 + .name = "sh_mobile_sdhi", 358 + .id = 0, 359 + .num_resources = ARRAY_SIZE(sdhi0_resources), 360 + .resource = sdhi0_resources, 361 + .dev = { 362 + .platform_data = &sdhi0_info, 363 + }, 364 + }; 365 + 366 + void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state) 367 + { 368 + gpio_set_value(GPIO_PORT114, state); 369 + } 370 + 371 + static struct sh_mobile_sdhi_info sh_sdhi1_platdata = { 372 + .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 373 + .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 374 + .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, 375 + .tmio_caps = MMC_CAP_NONREMOVABLE, 376 + .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 377 + .set_pwr = ag5evm_sdhi1_set_pwr, 378 + }; 379 + 380 + static struct resource sdhi1_resources[] = { 381 + [0] = { 382 + .name = "SDHI1", 383 + .start = 0xee120000, 384 + .end = 0xee1200ff, 385 + .flags = IORESOURCE_MEM, 386 + }, 387 + [1] = { 388 + .start = gic_spi(87), 389 + .flags = IORESOURCE_IRQ, 390 + }, 391 + [2] = { 392 + .start = gic_spi(88), 393 + .flags = IORESOURCE_IRQ, 394 + }, 395 + [3] = { 396 + .start = gic_spi(89), 397 + .flags = IORESOURCE_IRQ, 398 + }, 399 + }; 400 + 401 + static struct platform_device sdhi1_device = { 402 + .name = "sh_mobile_sdhi", 403 + .id = 1, 404 + .dev = { 405 + .platform_data = &sh_sdhi1_platdata, 406 + }, 407 + .num_resources = ARRAY_SIZE(sdhi1_resources), 408 + .resource = sdhi1_resources, 409 + }; 410 + 341 411 static struct platform_device *ag5evm_devices[] __initdata = { 342 412 &eth_device, 343 413 &keysc_device, ··· 429 333 &irda_device, 430 334 &lcdc0_device, 431 335 &mipidsi0_device, 336 + &sdhi0_device, 337 + &sdhi1_device, 432 338 }; 433 339 434 340 static struct map_desc ag5evm_io_desc[] __initdata = { ··· 551 453 552 454 /* MIPI-DSI clock setup */ 553 455 __raw_writel(0x2a809010, DSI0PHYCR); 456 + 457 + /* enable SDHI0 on CN15 [SD I/F] */ 458 + gpio_request(GPIO_FN_SDHICD0, NULL); 459 + gpio_request(GPIO_FN_SDHIWP0, NULL); 460 + gpio_request(GPIO_FN_SDHICMD0, NULL); 461 + gpio_request(GPIO_FN_SDHICLK0, NULL); 462 + gpio_request(GPIO_FN_SDHID0_3, NULL); 463 + gpio_request(GPIO_FN_SDHID0_2, NULL); 464 + gpio_request(GPIO_FN_SDHID0_1, NULL); 465 + gpio_request(GPIO_FN_SDHID0_0, NULL); 466 + 467 + /* enable SDHI1 on CN4 [WLAN I/F] */ 468 + gpio_request(GPIO_FN_SDHICLK1, NULL); 469 + gpio_request(GPIO_FN_SDHICMD1_PU, NULL); 470 + gpio_request(GPIO_FN_SDHID1_3_PU, NULL); 471 + gpio_request(GPIO_FN_SDHID1_2_PU, NULL); 472 + gpio_request(GPIO_FN_SDHID1_1_PU, NULL); 473 + gpio_request(GPIO_FN_SDHID1_0_PU, NULL); 474 + gpio_request(GPIO_PORT114, "sdhi1_power"); 475 + gpio_direction_output(GPIO_PORT114, 0); 554 476 555 477 #ifdef CONFIG_CACHE_L2X0 556 478 /* Shared attribute override enable, 64K*8way */
+21 -9
arch/arm/mach-shmobile/board-ap4evb.c
··· 316 316 .flags = IORESOURCE_MEM, 317 317 }, 318 318 [1] = { 319 - .start = evt2irq(0x0e00) /* SDHI0 */, 320 - .flags = IORESOURCE_IRQ, 319 + .start = evt2irq(0x0e00) /* SDHI0_SDHI0I0 */, 320 + .flags = IORESOURCE_IRQ, 321 + }, 322 + [2] = { 323 + .start = evt2irq(0x0e20) /* SDHI0_SDHI0I1 */, 324 + .flags = IORESOURCE_IRQ, 325 + }, 326 + [3] = { 327 + .start = evt2irq(0x0e40) /* SDHI0_SDHI0I2 */, 328 + .flags = IORESOURCE_IRQ, 321 329 }, 322 330 }; 323 331 ··· 357 349 .flags = IORESOURCE_MEM, 358 350 }, 359 351 [1] = { 360 - .start = evt2irq(0x0e80), 361 - .flags = IORESOURCE_IRQ, 352 + .start = evt2irq(0x0e80), /* SDHI1_SDHI1I0 */ 353 + .flags = IORESOURCE_IRQ, 354 + }, 355 + [2] = { 356 + .start = evt2irq(0x0ea0), /* SDHI1_SDHI1I1 */ 357 + .flags = IORESOURCE_IRQ, 358 + }, 359 + [3] = { 360 + .start = evt2irq(0x0ec0), /* SDHI1_SDHI1I2 */ 361 + .flags = IORESOURCE_IRQ, 362 362 }, 363 363 }; 364 364 ··· 996 980 goto out; 997 981 } 998 982 999 - ret = clk_enable(&sh7372_pllc2_clk); 1000 - if (ret < 0) { 1001 - pr_err("Cannot enable pllc2 clock\n"); 1002 - goto out; 1003 - } 1004 983 pr_debug("PLLC2 set frequency %lu\n", rate); 1005 984 1006 985 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); ··· 1354 1343 1355 1344 hdmi_init_pm_clock(); 1356 1345 fsi_init_pm_clock(); 1346 + sh7372_pm_init(); 1357 1347 } 1358 1348 1359 1349 static void __init ap4evb_timer_init(void)
+1 -1
arch/arm/mach-shmobile/board-g4evm.c
··· 205 205 [0] = { 206 206 .name = "SDHI0", 207 207 .start = 0xe6d50000, 208 - .end = 0xe6d50nff, 208 + .end = 0xe6d500ff, 209 209 .flags = IORESOURCE_MEM, 210 210 }, 211 211 [1] = {
+239 -35
arch/arm/mach-shmobile/board-mackerel.c
··· 43 43 #include <linux/sh_intc.h> 44 44 #include <linux/tca6416_keypad.h> 45 45 #include <linux/usb/r8a66597.h> 46 + #include <linux/usb/renesas_usbhs.h> 46 47 47 48 #include <video/sh_mobile_hdmi.h> 48 49 #include <video/sh_mobile_lcdc.h> ··· 144 143 * open | external VBUS | Function 145 144 * 146 145 * *1 147 - * CN31 is used as Host in Linux. 146 + * CN31 is used as 147 + * CONFIG_USB_R8A66597_HCD Host 148 + * CONFIG_USB_RENESAS_USBHS Function 149 + * 150 + * CAUTION 151 + * 152 + * renesas_usbhs driver can use external interrupt mode 153 + * (which come from USB-PHY) or autonomy mode (it use own interrupt) 154 + * for detecting connection/disconnection when Function. 155 + * USB will be power OFF while it has been disconnecting 156 + * if external interrupt mode, and it is always power ON if autonomy mode, 157 + * 158 + * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0", 159 + * because Touchscreen is using IRQ7-PORT40. 160 + * It is impossible to use IRQ7 demux on this board. 161 + * 162 + * We can use external interrupt mode USB-Function on "USB1". 163 + * USB1 can become Host by r8a66597, and become Function by renesas_usbhs. 164 + * But don't select both drivers in same time. 165 + * These uses same IRQ number for request_irq(), and aren't supporting 166 + * IRQF_SHARD / IORESOURCE_IRQ_SHAREABLE. 167 + * 168 + * Actually these are old/new version of USB driver. 169 + * This mean its register will be broken if it supports SHARD IRQ, 148 170 */ 149 171 150 172 /* ··· 209 185 * FIXME !! 210 186 * 211 187 * gpio_no_direction 188 + * gpio_pull_down 212 189 * are quick_hack. 213 190 * 214 191 * current gpio frame work doesn't have ··· 219 194 static void __init gpio_no_direction(u32 addr) 220 195 { 221 196 __raw_writeb(0x00, addr); 197 + } 198 + 199 + static void __init gpio_pull_down(u32 addr) 200 + { 201 + u8 data = __raw_readb(addr); 202 + 203 + data &= 0x0F; 204 + data |= 0xA0; 205 + 206 + __raw_writeb(data, addr); 222 207 } 223 208 224 209 /* MTD */ ··· 493 458 goto out; 494 459 } 495 460 496 - ret = clk_enable(&sh7372_pllc2_clk); 497 - if (ret < 0) { 498 - pr_err("Cannot enable pllc2 clock\n"); 499 - goto out; 500 - } 501 - 502 461 pr_debug("PLLC2 set frequency %lu\n", rate); 503 462 504 463 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk); ··· 543 514 .num_resources = ARRAY_SIZE(usb1_host_resources), 544 515 .resource = usb1_host_resources, 545 516 }; 517 + 518 + /* USB1 (Function) */ 519 + #define USB_PHY_MODE (1 << 4) 520 + #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) 521 + #define USB_PHY_ON (1 << 1) 522 + #define USB_PHY_OFF (1 << 0) 523 + #define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF) 524 + 525 + struct usbhs_private { 526 + unsigned int irq; 527 + unsigned int usbphyaddr; 528 + unsigned int usbcrcaddr; 529 + struct renesas_usbhs_platform_info info; 530 + }; 531 + 532 + #define usbhs_get_priv(pdev) \ 533 + container_of(renesas_usbhs_get_info(pdev), \ 534 + struct usbhs_private, info) 535 + 536 + #define usbhs_is_connected(priv) \ 537 + (!((1 << 7) & __raw_readw(priv->usbcrcaddr))) 538 + 539 + static int usbhs1_get_id(struct platform_device *pdev) 540 + { 541 + return USBHS_GADGET; 542 + } 543 + 544 + static int usbhs1_get_vbus(struct platform_device *pdev) 545 + { 546 + return usbhs_is_connected(usbhs_get_priv(pdev)); 547 + } 548 + 549 + static irqreturn_t usbhs1_interrupt(int irq, void *data) 550 + { 551 + struct platform_device *pdev = data; 552 + struct usbhs_private *priv = usbhs_get_priv(pdev); 553 + 554 + dev_dbg(&pdev->dev, "%s\n", __func__); 555 + 556 + renesas_usbhs_call_notify_hotplug(pdev); 557 + 558 + /* clear status */ 559 + __raw_writew(__raw_readw(priv->usbphyaddr) | USB_PHY_INT_CLR, 560 + priv->usbphyaddr); 561 + 562 + return IRQ_HANDLED; 563 + } 564 + 565 + static int usbhs1_hardware_init(struct platform_device *pdev) 566 + { 567 + struct usbhs_private *priv = usbhs_get_priv(pdev); 568 + int ret; 569 + 570 + irq_set_irq_type(priv->irq, IRQ_TYPE_LEVEL_HIGH); 571 + 572 + /* clear interrupt status */ 573 + __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->usbphyaddr); 574 + 575 + ret = request_irq(priv->irq, usbhs1_interrupt, 0, 576 + dev_name(&pdev->dev), pdev); 577 + if (ret) { 578 + dev_err(&pdev->dev, "request_irq err\n"); 579 + return ret; 580 + } 581 + 582 + /* enable USB phy interrupt */ 583 + __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->usbphyaddr); 584 + 585 + return 0; 586 + } 587 + 588 + static void usbhs1_hardware_exit(struct platform_device *pdev) 589 + { 590 + struct usbhs_private *priv = usbhs_get_priv(pdev); 591 + 592 + /* clear interrupt status */ 593 + __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->usbphyaddr); 594 + 595 + free_irq(priv->irq, pdev); 596 + } 597 + 598 + static void usbhs1_phy_reset(struct platform_device *pdev) 599 + { 600 + struct usbhs_private *priv = usbhs_get_priv(pdev); 601 + 602 + /* init phy */ 603 + __raw_writew(0x8a0a, priv->usbcrcaddr); 604 + } 605 + 606 + static u32 usbhs1_pipe_cfg[] = { 607 + USB_ENDPOINT_XFER_CONTROL, 608 + USB_ENDPOINT_XFER_ISOC, 609 + USB_ENDPOINT_XFER_ISOC, 610 + USB_ENDPOINT_XFER_BULK, 611 + USB_ENDPOINT_XFER_BULK, 612 + USB_ENDPOINT_XFER_BULK, 613 + USB_ENDPOINT_XFER_INT, 614 + USB_ENDPOINT_XFER_INT, 615 + USB_ENDPOINT_XFER_INT, 616 + USB_ENDPOINT_XFER_BULK, 617 + USB_ENDPOINT_XFER_BULK, 618 + USB_ENDPOINT_XFER_BULK, 619 + USB_ENDPOINT_XFER_BULK, 620 + USB_ENDPOINT_XFER_BULK, 621 + USB_ENDPOINT_XFER_BULK, 622 + USB_ENDPOINT_XFER_BULK, 623 + }; 624 + 625 + static struct usbhs_private usbhs1_private = { 626 + .irq = evt2irq(0x0300), /* IRQ8 */ 627 + .usbphyaddr = 0xE60581E2, /* USBPHY1INTAP */ 628 + .usbcrcaddr = 0xE6058130, /* USBCR4 */ 629 + .info = { 630 + .platform_callback = { 631 + .hardware_init = usbhs1_hardware_init, 632 + .hardware_exit = usbhs1_hardware_exit, 633 + .phy_reset = usbhs1_phy_reset, 634 + .get_id = usbhs1_get_id, 635 + .get_vbus = usbhs1_get_vbus, 636 + }, 637 + .driver_param = { 638 + .buswait_bwait = 4, 639 + .pipe_type = usbhs1_pipe_cfg, 640 + .pipe_size = ARRAY_SIZE(usbhs1_pipe_cfg), 641 + }, 642 + }, 643 + }; 644 + 645 + static struct resource usbhs1_resources[] = { 646 + [0] = { 647 + .name = "USBHS", 648 + .start = 0xE68B0000, 649 + .end = 0xE68B00E6 - 1, 650 + .flags = IORESOURCE_MEM, 651 + }, 652 + [1] = { 653 + .start = evt2irq(0x1ce0) /* USB1_USB1I0 */, 654 + .flags = IORESOURCE_IRQ, 655 + }, 656 + }; 657 + 658 + static struct platform_device usbhs1_device = { 659 + .name = "renesas_usbhs", 660 + .id = 1, 661 + .dev = { 662 + .platform_data = &usbhs1_private.info, 663 + }, 664 + .num_resources = ARRAY_SIZE(usbhs1_resources), 665 + .resource = usbhs1_resources, 666 + }; 667 + 546 668 547 669 /* LED */ 548 670 static struct gpio_led mackerel_leds[] = { ··· 870 690 .flags = IORESOURCE_MEM, 871 691 }, 872 692 [1] = { 873 - .start = evt2irq(0x0e00) /* SDHI0 */, 693 + .start = evt2irq(0x0e00) /* SDHI0_SDHI0I0 */, 694 + .flags = IORESOURCE_IRQ, 695 + }, 696 + [2] = { 697 + .start = evt2irq(0x0e20) /* SDHI0_SDHI0I1 */, 698 + .flags = IORESOURCE_IRQ, 699 + }, 700 + [3] = { 701 + .start = evt2irq(0x0e40) /* SDHI0_SDHI0I2 */, 874 702 .flags = IORESOURCE_IRQ, 875 703 }, 876 704 }; ··· 893 705 }, 894 706 }; 895 707 896 - #if !defined(CONFIG_MMC_SH_MMCIF) 708 + #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 897 709 /* SDHI1 */ 898 710 static struct sh_mobile_sdhi_info sdhi1_info = { 899 711 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, ··· 913 725 .flags = IORESOURCE_MEM, 914 726 }, 915 727 [1] = { 916 - .start = evt2irq(0x0e80), 728 + .start = evt2irq(0x0e80), /* SDHI1_SDHI1I0 */ 729 + .flags = IORESOURCE_IRQ, 730 + }, 731 + [2] = { 732 + .start = evt2irq(0x0ea0), /* SDHI1_SDHI1I1 */ 733 + .flags = IORESOURCE_IRQ, 734 + }, 735 + [3] = { 736 + .start = evt2irq(0x0ec0), /* SDHI1_SDHI1I2 */ 917 737 .flags = IORESOURCE_IRQ, 918 738 }, 919 739 }; ··· 964 768 .flags = IORESOURCE_MEM, 965 769 }, 966 770 [1] = { 967 - .start = evt2irq(0x1200), 771 + .start = evt2irq(0x1200), /* SDHI2_SDHI2I0 */ 772 + .flags = IORESOURCE_IRQ, 773 + }, 774 + [2] = { 775 + .start = evt2irq(0x1220), /* SDHI2_SDHI2I1 */ 776 + .flags = IORESOURCE_IRQ, 777 + }, 778 + [3] = { 779 + .start = evt2irq(0x1240), /* SDHI2_SDHI2I2 */ 968 780 .flags = IORESOURCE_IRQ, 969 781 }, 970 782 }; ··· 1007 803 }, 1008 804 }; 1009 805 806 + static struct sh_mmcif_dma sh_mmcif_dma = { 807 + .chan_priv_rx = { 808 + .slave_id = SHDMA_SLAVE_MMCIF_RX, 809 + }, 810 + .chan_priv_tx = { 811 + .slave_id = SHDMA_SLAVE_MMCIF_TX, 812 + }, 813 + }; 814 + 1010 815 static struct sh_mmcif_plat_data sh_mmcif_plat = { 1011 816 .sup_pclk = 0, 1012 817 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, ··· 1023 810 MMC_CAP_8_BIT_DATA | 1024 811 MMC_CAP_NEEDS_POLL, 1025 812 .get_cd = slot_cn7_get_cd, 813 + .dma = &sh_mmcif_dma, 1026 814 }; 1027 815 1028 816 static struct platform_device sh_mmcif_device = { ··· 1072 858 .priv = &camera_info, 1073 859 }; 1074 860 1075 - static void dummy_release(struct device *dev) 1076 - { 1077 - } 861 + static struct platform_device *camera_device; 1078 862 1079 - static struct platform_device camera_device = { 1080 - .name = "soc_camera_platform", 1081 - .dev = { 1082 - .platform_data = &camera_info, 1083 - .release = dummy_release, 1084 - }, 1085 - }; 863 + static void mackerel_camera_release(struct device *dev) 864 + { 865 + soc_camera_platform_release(&camera_device); 866 + } 1086 867 1087 868 static int mackerel_camera_add(struct soc_camera_link *icl, 1088 869 struct device *dev) 1089 870 { 1090 - if (icl != &camera_link) 1091 - return -ENODEV; 1092 - 1093 - camera_info.dev = dev; 1094 - 1095 - return platform_device_register(&camera_device); 871 + return soc_camera_platform_add(icl, dev, &camera_device, &camera_link, 872 + mackerel_camera_release, 0); 1096 873 } 1097 874 1098 875 static void mackerel_camera_del(struct soc_camera_link *icl) 1099 876 { 1100 - if (icl != &camera_link) 1101 - return; 1102 - 1103 - platform_device_unregister(&camera_device); 1104 - memset(&camera_device.dev.kobj, 0, 1105 - sizeof(camera_device.dev.kobj)); 877 + soc_camera_platform_del(icl, camera_device, &camera_link); 1106 878 } 1107 879 1108 880 static struct sh_mobile_ceu_info sh_mobile_ceu_info = { ··· 1135 935 &smc911x_device, 1136 936 &lcdc_device, 1137 937 &usb1_host_device, 938 + &usbhs1_device, 1138 939 &leds_device, 1139 940 &fsi_device, 1140 941 &fsi_ak4643_device, 1141 942 &fsi_hdmi_device, 1142 943 &sdhi0_device, 1143 - #if !defined(CONFIG_MMC_SH_MMCIF) 944 + #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 1144 945 &sdhi1_device, 1145 946 #endif 1146 947 &sdhi2_device, ··· 1231 1030 1232 1031 #define GPIO_PORT9CR 0xE6051009 1233 1032 #define GPIO_PORT10CR 0xE605100A 1033 + #define GPIO_PORT168CR 0xE60520A8 1234 1034 #define SRCR4 0xe61580bc 1235 1035 #define USCCR1 0xE6058144 1236 1036 static void __init mackerel_init(void) ··· 1290 1088 gpio_request(GPIO_FN_OVCN_1_114, NULL); 1291 1089 gpio_request(GPIO_FN_EXTLP_1, NULL); 1292 1090 gpio_request(GPIO_FN_OVCN2_1, NULL); 1091 + gpio_pull_down(GPIO_PORT168CR); 1293 1092 1294 1093 /* setup USB phy */ 1295 1094 __raw_writew(0x8a0a, 0xE6058130); /* USBCR4 */ ··· 1343 1140 gpio_request(GPIO_FN_SDHID0_1, NULL); 1344 1141 gpio_request(GPIO_FN_SDHID0_0, NULL); 1345 1142 1346 - #if !defined(CONFIG_MMC_SH_MMCIF) 1143 + #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 1347 1144 /* enable SDHI1 */ 1348 1145 gpio_request(GPIO_FN_SDHICMD1, NULL); 1349 1146 gpio_request(GPIO_FN_SDHICLK1, NULL); ··· 1419 1216 platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices)); 1420 1217 1421 1218 hdmi_init_pm_clock(); 1219 + sh7372_pm_init(); 1422 1220 } 1423 1221 1424 1222 static void __init mackerel_timer_init(void)
+17 -4
arch/arm/mach-shmobile/clock-sh7372.c
··· 44 44 #define DSI1PCKCR 0xe6150098 45 45 #define PLLC01CR 0xe6150028 46 46 #define PLLC2CR 0xe615002c 47 + #define RMSTPCR0 0xe6150110 48 + #define RMSTPCR1 0xe6150114 49 + #define RMSTPCR2 0xe6150118 50 + #define RMSTPCR3 0xe615011c 51 + #define RMSTPCR4 0xe6150120 47 52 #define SMSTPCR0 0xe6150130 48 53 #define SMSTPCR1 0xe6150134 49 54 #define SMSTPCR2 0xe6150138 ··· 426 421 427 422 value = __raw_readl(clk->mapping->base); 428 423 429 - if ((value & 0x3) != 0x3) 430 - return 0; 431 - 432 424 value >>= 16; 433 425 if (value < 2) 434 426 return 0; ··· 506 504 enum { MSTP001, 507 505 MSTP131, MSTP130, 508 506 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, 509 - MSTP118, MSTP117, MSTP116, 507 + MSTP118, MSTP117, MSTP116, MSTP113, 510 508 MSTP106, MSTP101, MSTP100, 511 509 MSTP223, 512 510 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, ··· 529 527 [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX */ 530 528 [MSTP117] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ 531 529 [MSTP116] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ 530 + [MSTP113] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 13, 0), /* MERAM */ 532 531 [MSTP106] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 6, 0), /* JPU */ 533 532 [MSTP101] = MSTP(&div4_clks[DIV4_M1], SMSTPCR1, 1, 0), /* VPU */ 534 533 [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ ··· 620 617 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX0 */ 621 618 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */ 622 619 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */ 620 + CLKDEV_DEV_ID("sh_mobile_meram.0", &mstp_clks[MSTP113]), /* MERAM */ 623 621 CLKDEV_DEV_ID("uio_pdrv_genirq.5", &mstp_clks[MSTP106]), /* JPU */ 624 622 CLKDEV_DEV_ID("uio_pdrv_genirq.0", &mstp_clks[MSTP101]), /* VPU */ 625 623 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ ··· 638 634 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */ 639 635 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USB0 */ 640 636 CLKDEV_DEV_ID("r8a66597_udc.0", &mstp_clks[MSTP322]), /* USB0 */ 637 + CLKDEV_DEV_ID("renesas_usbhs.0", &mstp_clks[MSTP322]), /* USB0 */ 641 638 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ 642 639 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ 643 640 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMC */ ··· 649 644 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* IIC4 */ 650 645 CLKDEV_DEV_ID("r8a66597_hcd.1", &mstp_clks[MSTP406]), /* USB1 */ 651 646 CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */ 647 + CLKDEV_DEV_ID("renesas_usbhs.1", &mstp_clks[MSTP406]), /* USB1 */ 652 648 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ 653 649 654 650 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]), ··· 660 654 void __init sh7372_clock_init(void) 661 655 { 662 656 int k, ret = 0; 657 + 658 + /* make sure MSTP bits on the RT/SH4AL-DSP side are off */ 659 + __raw_writel(0xe4ef8087, RMSTPCR0); 660 + __raw_writel(0xffffffff, RMSTPCR1); 661 + __raw_writel(0x37c7f7ff, RMSTPCR2); 662 + __raw_writel(0xffffffff, RMSTPCR3); 663 + __raw_writel(0xffe0fffd, RMSTPCR4); 663 664 664 665 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) 665 666 ret = clk_register(main_clks[k]);
+18 -1
arch/arm/mach-shmobile/clock-sh73a0.c
··· 266 266 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, 267 267 MSTP219, 268 268 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 269 - MSTP331, MSTP329, MSTP325, MSTP323, MSTP312, 269 + MSTP331, MSTP329, MSTP325, MSTP323, MSTP318, 270 + MSTP314, MSTP313, MSTP312, MSTP311, 270 271 MSTP411, MSTP410, MSTP403, 271 272 MSTP_NR }; 272 273 ··· 296 295 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ 297 296 [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */ 298 297 [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */ 298 + [MSTP318] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 18, 0), /* SY-DMAC */ 299 + [MSTP314] = MSTP(&div6_clks[DIV6_SDHI0], SMSTPCR3, 14, 0), /* SDHI0 */ 300 + [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */ 299 301 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ 302 + [MSTP311] = MSTP(&div6_clks[DIV6_SDHI2], SMSTPCR3, 11, 0), /* SDHI2 */ 300 303 [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */ 301 304 [MSTP410] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 10, 0), /* IIC4 */ 302 305 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */ ··· 318 313 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]), 319 314 CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]), 320 315 CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]), 316 + CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]), 317 + CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]), 318 + CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]), 321 319 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), 322 320 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), 323 321 CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), ··· 349 341 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ 350 342 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ 351 343 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ 344 + CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP318]), /* SY-DMAC */ 345 + CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ 346 + CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ 352 347 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ 348 + CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ 353 349 CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ 354 350 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ 355 351 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ ··· 362 350 void __init sh73a0_clock_init(void) 363 351 { 364 352 int k, ret = 0; 353 + 354 + /* Set SDHI clocks to a known state */ 355 + __raw_writel(0x108, SD0CKCR); 356 + __raw_writel(0x108, SD1CKCR); 357 + __raw_writel(0x108, SD2CKCR); 365 358 366 359 /* detect main clock parent */ 367 360 switch ((__raw_readl(CKSCR) >> 24) & 0x03) {
+92
arch/arm/mach-shmobile/cpuidle.c
··· 1 + /* 2 + * CPUIdle support code for SH-Mobile ARM 3 + * 4 + * Copyright (C) 2011 Magnus Damm 5 + * 6 + * This file is subject to the terms and conditions of the GNU General Public 7 + * License. See the file "COPYING" in the main directory of this archive 8 + * for more details. 9 + */ 10 + 11 + #include <linux/pm.h> 12 + #include <linux/cpuidle.h> 13 + #include <linux/suspend.h> 14 + #include <linux/module.h> 15 + #include <linux/err.h> 16 + #include <asm/system.h> 17 + #include <asm/io.h> 18 + 19 + static void shmobile_enter_wfi(void) 20 + { 21 + cpu_do_idle(); 22 + } 23 + 24 + void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void) = { 25 + shmobile_enter_wfi, /* regular sleep mode */ 26 + }; 27 + 28 + static int shmobile_cpuidle_enter(struct cpuidle_device *dev, 29 + struct cpuidle_state *state) 30 + { 31 + ktime_t before, after; 32 + int requested_state = state - &dev->states[0]; 33 + 34 + dev->last_state = &dev->states[requested_state]; 35 + before = ktime_get(); 36 + 37 + local_irq_disable(); 38 + local_fiq_disable(); 39 + 40 + shmobile_cpuidle_modes[requested_state](); 41 + 42 + local_irq_enable(); 43 + local_fiq_enable(); 44 + 45 + after = ktime_get(); 46 + return ktime_to_ns(ktime_sub(after, before)) >> 10; 47 + } 48 + 49 + static struct cpuidle_device shmobile_cpuidle_dev; 50 + static struct cpuidle_driver shmobile_cpuidle_driver = { 51 + .name = "shmobile_cpuidle", 52 + .owner = THIS_MODULE, 53 + }; 54 + 55 + void (*shmobile_cpuidle_setup)(struct cpuidle_device *dev); 56 + 57 + static int shmobile_cpuidle_init(void) 58 + { 59 + struct cpuidle_device *dev = &shmobile_cpuidle_dev; 60 + struct cpuidle_state *state; 61 + int i; 62 + 63 + cpuidle_register_driver(&shmobile_cpuidle_driver); 64 + 65 + for (i = 0; i < CPUIDLE_STATE_MAX; i++) { 66 + dev->states[i].name[0] = '\0'; 67 + dev->states[i].desc[0] = '\0'; 68 + dev->states[i].enter = shmobile_cpuidle_enter; 69 + } 70 + 71 + i = CPUIDLE_DRIVER_STATE_START; 72 + 73 + state = &dev->states[i++]; 74 + snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); 75 + strncpy(state->desc, "WFI", CPUIDLE_DESC_LEN); 76 + state->exit_latency = 1; 77 + state->target_residency = 1 * 2; 78 + state->power_usage = 3; 79 + state->flags = 0; 80 + state->flags |= CPUIDLE_FLAG_TIME_VALID; 81 + 82 + dev->safe_state = state; 83 + dev->state_count = i; 84 + 85 + if (shmobile_cpuidle_setup) 86 + shmobile_cpuidle_setup(dev); 87 + 88 + cpuidle_register_device(dev); 89 + 90 + return 0; 91 + } 92 + late_initcall(shmobile_cpuidle_init);
+1 -1
arch/arm/mach-shmobile/headsmp.S
··· 24 24 .align 12 25 25 ENTRY(shmobile_secondary_vector) 26 26 ldr pc, 1f 27 - 1: .long secondary_startup - PAGE_OFFSET + PHYS_OFFSET 27 + 1: .long secondary_startup - PAGE_OFFSET + PLAT_PHYS_OFFSET
+7
arch/arm/mach-shmobile/include/mach/common.h
··· 8 8 extern int clk_init(void); 9 9 extern void shmobile_handle_irq_intc(struct pt_regs *); 10 10 extern void shmobile_handle_irq_gic(struct pt_regs *); 11 + extern struct platform_suspend_ops shmobile_suspend_ops; 12 + struct cpuidle_device; 13 + extern void (*shmobile_cpuidle_modes[])(void); 14 + extern void (*shmobile_cpuidle_setup)(struct cpuidle_device *dev); 11 15 12 16 extern void sh7367_init_irq(void); 13 17 extern void sh7367_add_early_devices(void); ··· 34 30 extern void sh7372_add_standard_devices(void); 35 31 extern void sh7372_clock_init(void); 36 32 extern void sh7372_pinmux_init(void); 33 + extern void sh7372_pm_init(void); 34 + extern void sh7372_cpu_suspend(void); 35 + extern void sh7372_cpu_resume(void); 37 36 extern struct clk sh7372_extal1_clk; 38 37 extern struct clk sh7372_extal2_clk; 39 38
+1 -2
arch/arm/mach-shmobile/include/mach/head-ap4evb.txt
··· 87 87 ED 0xFE400354, 0x01AD8002 88 88 89 89 LIST "SCIF0 - Serial port for earlyprintk" 90 - EB 0xE6053098, 0x11 91 90 EB 0xE6053098, 0xe1 92 91 EW 0xE6C40000, 0x0000 93 92 EB 0xE6C40004, 0x19 94 - EW 0xE6C40008, 0x3000 93 + EW 0xE6C40008, 0x0030
+1 -2
arch/arm/mach-shmobile/include/mach/head-mackerel.txt
··· 87 87 ED 0xFE400354, 0x01AD8002 88 88 89 89 LIST "SCIF0 - Serial port for earlyprintk" 90 - EB 0xE6053098, 0x11 91 90 EB 0xE6053098, 0xe1 92 91 EW 0xE6C40000, 0x0000 93 92 EB 0xE6C40004, 0x19 94 - EW 0xE6C40008, 0x3000 93 + EW 0xE6C40008, 0x0030
+1
arch/arm/mach-shmobile/include/mach/sh7372.h
··· 435 435 436 436 /* DMA slave IDs */ 437 437 enum { 438 + SHDMA_SLAVE_INVALID, 438 439 SHDMA_SLAVE_SCIF0_TX, 439 440 SHDMA_SLAVE_SCIF0_RX, 440 441 SHDMA_SLAVE_SCIF1_TX,
+30
arch/arm/mach-shmobile/include/mach/sh73a0.h
··· 463 463 GPIO_FN_FSIAIBT_PU, 464 464 GPIO_FN_FSIAISLD_PU, 465 465 }; 466 + /* DMA slave IDs */ 467 + enum { 468 + SHDMA_SLAVE_INVALID, 469 + SHDMA_SLAVE_SCIF0_TX, 470 + SHDMA_SLAVE_SCIF0_RX, 471 + SHDMA_SLAVE_SCIF1_TX, 472 + SHDMA_SLAVE_SCIF1_RX, 473 + SHDMA_SLAVE_SCIF2_TX, 474 + SHDMA_SLAVE_SCIF2_RX, 475 + SHDMA_SLAVE_SCIF3_TX, 476 + SHDMA_SLAVE_SCIF3_RX, 477 + SHDMA_SLAVE_SCIF4_TX, 478 + SHDMA_SLAVE_SCIF4_RX, 479 + SHDMA_SLAVE_SCIF5_TX, 480 + SHDMA_SLAVE_SCIF5_RX, 481 + SHDMA_SLAVE_SCIF6_TX, 482 + SHDMA_SLAVE_SCIF6_RX, 483 + SHDMA_SLAVE_SCIF7_TX, 484 + SHDMA_SLAVE_SCIF7_RX, 485 + SHDMA_SLAVE_SCIF8_TX, 486 + SHDMA_SLAVE_SCIF8_RX, 487 + SHDMA_SLAVE_SDHI0_TX, 488 + SHDMA_SLAVE_SDHI0_RX, 489 + SHDMA_SLAVE_SDHI1_TX, 490 + SHDMA_SLAVE_SDHI1_RX, 491 + SHDMA_SLAVE_SDHI2_TX, 492 + SHDMA_SLAVE_SDHI2_RX, 493 + SHDMA_SLAVE_MMCIF_TX, 494 + SHDMA_SLAVE_MMCIF_RX, 495 + }; 466 496 467 497 #endif /* __ASM_SH73A0_H__ */
+23 -23
arch/arm/mach-shmobile/intc-sh7372.c
··· 27 27 28 28 enum { 29 29 UNUSED_INTCA = 0, 30 - ENABLED, 31 - DISABLED, 32 30 33 31 /* interrupt sources INTCA */ 34 32 IRQ0A, IRQ1A, IRQ2A, IRQ3A, IRQ4A, IRQ5A, IRQ6A, IRQ7A, ··· 47 49 MSIOF2, MSIOF1, 48 50 SCIFA4, SCIFA5, SCIFB, 49 51 FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I, 50 - SDHI0, 51 - SDHI1, 52 + SDHI0_SDHI0I0, SDHI0_SDHI0I1, SDHI0_SDHI0I2, SDHI0_SDHI0I3, 53 + SDHI1_SDHI1I0, SDHI1_SDHI1I1, SDHI1_SDHI1I2, 52 54 IRREM, 53 55 IRDA, 54 56 TPU0, 55 57 TTI20, 56 58 DDM, 57 - SDHI2, 59 + SDHI2_SDHI2I0, SDHI2_SDHI2I1, SDHI2_SDHI2I2, SDHI2_SDHI2I3, 58 60 RWDT0, 59 61 DMAC1_1_DEI0, DMAC1_1_DEI1, DMAC1_1_DEI2, DMAC1_1_DEI3, 60 62 DMAC1_2_DEI4, DMAC1_2_DEI5, DMAC1_2_DADERR, ··· 82 84 83 85 /* interrupt groups INTCA */ 84 86 DMAC1_1, DMAC1_2, DMAC2_1, DMAC2_2, DMAC3_1, DMAC3_2, SHWYSTAT, 85 - AP_ARM1, AP_ARM2, SPU2, FLCTL, IIC1 87 + AP_ARM1, AP_ARM2, SPU2, FLCTL, IIC1, SDHI0, SDHI1, SDHI2 86 88 }; 87 89 88 90 static struct intc_vect intca_vectors[] __initdata = { ··· 123 125 INTC_VECT(SCIFB, 0x0d60), 124 126 INTC_VECT(FLCTL_FLSTEI, 0x0d80), INTC_VECT(FLCTL_FLTENDI, 0x0da0), 125 127 INTC_VECT(FLCTL_FLTREQ0I, 0x0dc0), INTC_VECT(FLCTL_FLTREQ1I, 0x0de0), 126 - INTC_VECT(SDHI0, 0x0e00), INTC_VECT(SDHI0, 0x0e20), 127 - INTC_VECT(SDHI0, 0x0e40), INTC_VECT(SDHI0, 0x0e60), 128 - INTC_VECT(SDHI1, 0x0e80), INTC_VECT(SDHI1, 0x0ea0), 129 - INTC_VECT(SDHI1, 0x0ec0), 128 + INTC_VECT(SDHI0_SDHI0I0, 0x0e00), INTC_VECT(SDHI0_SDHI0I1, 0x0e20), 129 + INTC_VECT(SDHI0_SDHI0I2, 0x0e40), INTC_VECT(SDHI0_SDHI0I3, 0x0e60), 130 + INTC_VECT(SDHI1_SDHI1I0, 0x0e80), INTC_VECT(SDHI1_SDHI1I1, 0x0ea0), 131 + INTC_VECT(SDHI1_SDHI1I2, 0x0ec0), 130 132 INTC_VECT(IRREM, 0x0f60), 131 133 INTC_VECT(IRDA, 0x0480), 132 134 INTC_VECT(TPU0, 0x04a0), 133 135 INTC_VECT(TTI20, 0x1100), 134 136 INTC_VECT(DDM, 0x1140), 135 - INTC_VECT(SDHI2, 0x1200), INTC_VECT(SDHI2, 0x1220), 136 - INTC_VECT(SDHI2, 0x1240), INTC_VECT(SDHI2, 0x1260), 137 + INTC_VECT(SDHI2_SDHI2I0, 0x1200), INTC_VECT(SDHI2_SDHI2I1, 0x1220), 138 + INTC_VECT(SDHI2_SDHI2I2, 0x1240), INTC_VECT(SDHI2_SDHI2I3, 0x1260), 137 139 INTC_VECT(RWDT0, 0x1280), 138 140 INTC_VECT(DMAC1_1_DEI0, 0x2000), INTC_VECT(DMAC1_1_DEI1, 0x2020), 139 141 INTC_VECT(DMAC1_1_DEI2, 0x2040), INTC_VECT(DMAC1_1_DEI3, 0x2060), ··· 193 195 INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLTENDI, 194 196 FLCTL_FLTREQ0I, FLCTL_FLTREQ1I), 195 197 INTC_GROUP(IIC1, IIC1_ALI1, IIC1_TACKI1, IIC1_WAITI1, IIC1_DTEI1), 198 + INTC_GROUP(SDHI0, SDHI0_SDHI0I0, SDHI0_SDHI0I1, 199 + SDHI0_SDHI0I2, SDHI0_SDHI0I3), 200 + INTC_GROUP(SDHI1, SDHI1_SDHI1I0, SDHI1_SDHI1I1, 201 + SDHI1_SDHI1I2), 202 + INTC_GROUP(SDHI2, SDHI2_SDHI2I0, SDHI2_SDHI2I1, 203 + SDHI2_SDHI2I2, SDHI2_SDHI2I3), 196 204 INTC_GROUP(SHWYSTAT, SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM), 197 205 }; 198 206 ··· 234 230 { SCIFB, SCIFA5, SCIFA4, MSIOF1, 235 231 0, 0, MSIOF2, 0 } }, 236 232 { 0xe694009c, 0xe69400dc, 8, /* IMR7A / IMCR7A */ 237 - { DISABLED, ENABLED, ENABLED, ENABLED, 233 + { SDHI0_SDHI0I3, SDHI0_SDHI0I2, SDHI0_SDHI0I1, SDHI0_SDHI0I0, 238 234 FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } }, 239 235 { 0xe69400a0, 0xe69400e0, 8, /* IMR8A / IMCR8A */ 240 - { 0, ENABLED, ENABLED, ENABLED, 236 + { 0, SDHI1_SDHI1I2, SDHI1_SDHI1I1, SDHI1_SDHI1I0, 241 237 TTI20, USBHSDMAC0_USHDMI, 0, 0 } }, 242 238 { 0xe69400a4, 0xe69400e4, 8, /* IMR9A / IMCR9A */ 243 239 { CMT1_CMT13, CMT1_CMT12, CMT1_CMT11, CMT1_CMT10, ··· 252 248 { 0, 0, TPU0, 0, 253 249 0, 0, 0, 0 } }, 254 250 { 0xe69400b4, 0xe69400f4, 8, /* IMR13A / IMCR13A */ 255 - { DISABLED, DISABLED, ENABLED, ENABLED, 251 + { SDHI2_SDHI2I3, SDHI2_SDHI2I2, SDHI2_SDHI2I1, SDHI2_SDHI2I0, 256 252 0, CMT3, 0, RWDT0 } }, 257 253 { 0xe6950080, 0xe69500c0, 8, /* IMR0A3 / IMCR0A3 */ 258 254 { SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM, 0, ··· 358 354 { IRQ24A, IRQ25A, IRQ26A, IRQ27A, IRQ28A, IRQ29A, IRQ30A, IRQ31A } }, 359 355 }; 360 356 361 - static struct intc_desc intca_desc __initdata = { 362 - .name = "sh7372-intca", 363 - .force_enable = ENABLED, 364 - .force_disable = DISABLED, 365 - .hw = INTC_HW_DESC(intca_vectors, intca_groups, 366 - intca_mask_registers, intca_prio_registers, 367 - intca_sense_registers, intca_ack_registers), 368 - }; 357 + static DECLARE_INTC_DESC_ACK(intca_desc, "sh7372-intca", 358 + intca_vectors, intca_groups, 359 + intca_mask_registers, intca_prio_registers, 360 + intca_sense_registers, intca_ack_registers); 369 361 370 362 enum { 371 363 UNUSED_INTCS = 0,
+108
arch/arm/mach-shmobile/pm-sh7372.c
··· 1 + /* 2 + * sh7372 Power management support 3 + * 4 + * Copyright (C) 2011 Magnus Damm 5 + * 6 + * This file is subject to the terms and conditions of the GNU General Public 7 + * License. See the file "COPYING" in the main directory of this archive 8 + * for more details. 9 + */ 10 + 11 + #include <linux/pm.h> 12 + #include <linux/suspend.h> 13 + #include <linux/cpuidle.h> 14 + #include <linux/module.h> 15 + #include <linux/list.h> 16 + #include <linux/err.h> 17 + #include <linux/slab.h> 18 + #include <asm/system.h> 19 + #include <asm/io.h> 20 + #include <asm/tlbflush.h> 21 + #include <mach/common.h> 22 + 23 + #define SMFRAM 0xe6a70000 24 + #define SYSTBCR 0xe6150024 25 + #define SBAR 0xe6180020 26 + #define APARMBAREA 0xe6f10020 27 + 28 + static void sh7372_enter_core_standby(void) 29 + { 30 + void __iomem *smfram = (void __iomem *)SMFRAM; 31 + 32 + __raw_writel(0, APARMBAREA); /* translate 4k */ 33 + __raw_writel(__pa(sh7372_cpu_resume), SBAR); /* set reset vector */ 34 + __raw_writel(0x10, SYSTBCR); /* enable core standby */ 35 + 36 + __raw_writel(0, smfram + 0x3c); /* clear page table address */ 37 + 38 + sh7372_cpu_suspend(); 39 + cpu_init(); 40 + 41 + /* if page table address is non-NULL then we have been powered down */ 42 + if (__raw_readl(smfram + 0x3c)) { 43 + __raw_writel(__raw_readl(smfram + 0x40), 44 + __va(__raw_readl(smfram + 0x3c))); 45 + 46 + flush_tlb_all(); 47 + set_cr(__raw_readl(smfram + 0x38)); 48 + } 49 + 50 + __raw_writel(0, SYSTBCR); /* disable core standby */ 51 + __raw_writel(0, SBAR); /* disable reset vector translation */ 52 + } 53 + 54 + #ifdef CONFIG_CPU_IDLE 55 + static void sh7372_cpuidle_setup(struct cpuidle_device *dev) 56 + { 57 + struct cpuidle_state *state; 58 + int i = dev->state_count; 59 + 60 + state = &dev->states[i]; 61 + snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); 62 + strncpy(state->desc, "Core Standby Mode", CPUIDLE_DESC_LEN); 63 + state->exit_latency = 10; 64 + state->target_residency = 20 + 10; 65 + state->power_usage = 1; /* perhaps not */ 66 + state->flags = 0; 67 + state->flags |= CPUIDLE_FLAG_TIME_VALID; 68 + shmobile_cpuidle_modes[i] = sh7372_enter_core_standby; 69 + 70 + dev->state_count = i + 1; 71 + } 72 + 73 + static void sh7372_cpuidle_init(void) 74 + { 75 + shmobile_cpuidle_setup = sh7372_cpuidle_setup; 76 + } 77 + #else 78 + static void sh7372_cpuidle_init(void) {} 79 + #endif 80 + 81 + #ifdef CONFIG_SUSPEND 82 + static int sh7372_enter_suspend(suspend_state_t suspend_state) 83 + { 84 + sh7372_enter_core_standby(); 85 + return 0; 86 + } 87 + 88 + static void sh7372_suspend_init(void) 89 + { 90 + shmobile_suspend_ops.enter = sh7372_enter_suspend; 91 + } 92 + #else 93 + static void sh7372_suspend_init(void) {} 94 + #endif 95 + 96 + #define DBGREG1 0xe6100020 97 + #define DBGREG9 0xe6100040 98 + 99 + void __init sh7372_pm_init(void) 100 + { 101 + /* enable DBG hardware block to kick SYSC */ 102 + __raw_writel(0x0000a500, DBGREG9); 103 + __raw_writel(0x0000a501, DBGREG9); 104 + __raw_writel(0x00000000, DBGREG1); 105 + 106 + sh7372_suspend_init(); 107 + sh7372_cpuidle_init(); 108 + }
+223
arch/arm/mach-shmobile/setup-sh7367.c
··· 22 22 #include <linux/interrupt.h> 23 23 #include <linux/irq.h> 24 24 #include <linux/platform_device.h> 25 + #include <linux/uio_driver.h> 25 26 #include <linux/delay.h> 26 27 #include <linux/input.h> 27 28 #include <linux/io.h> ··· 196 195 .num_resources = ARRAY_SIZE(cmt10_resources), 197 196 }; 198 197 198 + /* VPU */ 199 + static struct uio_info vpu_platform_data = { 200 + .name = "VPU5", 201 + .version = "0", 202 + .irq = intcs_evt2irq(0x980), 203 + }; 204 + 205 + static struct resource vpu_resources[] = { 206 + [0] = { 207 + .name = "VPU", 208 + .start = 0xfe900000, 209 + .end = 0xfe902807, 210 + .flags = IORESOURCE_MEM, 211 + }, 212 + }; 213 + 214 + static struct platform_device vpu_device = { 215 + .name = "uio_pdrv_genirq", 216 + .id = 0, 217 + .dev = { 218 + .platform_data = &vpu_platform_data, 219 + }, 220 + .resource = vpu_resources, 221 + .num_resources = ARRAY_SIZE(vpu_resources), 222 + }; 223 + 224 + /* VEU0 */ 225 + static struct uio_info veu0_platform_data = { 226 + .name = "VEU0", 227 + .version = "0", 228 + .irq = intcs_evt2irq(0x700), 229 + }; 230 + 231 + static struct resource veu0_resources[] = { 232 + [0] = { 233 + .name = "VEU0", 234 + .start = 0xfe920000, 235 + .end = 0xfe9200b7, 236 + .flags = IORESOURCE_MEM, 237 + }, 238 + }; 239 + 240 + static struct platform_device veu0_device = { 241 + .name = "uio_pdrv_genirq", 242 + .id = 1, 243 + .dev = { 244 + .platform_data = &veu0_platform_data, 245 + }, 246 + .resource = veu0_resources, 247 + .num_resources = ARRAY_SIZE(veu0_resources), 248 + }; 249 + 250 + /* VEU1 */ 251 + static struct uio_info veu1_platform_data = { 252 + .name = "VEU1", 253 + .version = "0", 254 + .irq = intcs_evt2irq(0x720), 255 + }; 256 + 257 + static struct resource veu1_resources[] = { 258 + [0] = { 259 + .name = "VEU1", 260 + .start = 0xfe924000, 261 + .end = 0xfe9240b7, 262 + .flags = IORESOURCE_MEM, 263 + }, 264 + }; 265 + 266 + static struct platform_device veu1_device = { 267 + .name = "uio_pdrv_genirq", 268 + .id = 2, 269 + .dev = { 270 + .platform_data = &veu1_platform_data, 271 + }, 272 + .resource = veu1_resources, 273 + .num_resources = ARRAY_SIZE(veu1_resources), 274 + }; 275 + 276 + /* VEU2 */ 277 + static struct uio_info veu2_platform_data = { 278 + .name = "VEU2", 279 + .version = "0", 280 + .irq = intcs_evt2irq(0x740), 281 + }; 282 + 283 + static struct resource veu2_resources[] = { 284 + [0] = { 285 + .name = "VEU2", 286 + .start = 0xfe928000, 287 + .end = 0xfe9280b7, 288 + .flags = IORESOURCE_MEM, 289 + }, 290 + }; 291 + 292 + static struct platform_device veu2_device = { 293 + .name = "uio_pdrv_genirq", 294 + .id = 3, 295 + .dev = { 296 + .platform_data = &veu2_platform_data, 297 + }, 298 + .resource = veu2_resources, 299 + .num_resources = ARRAY_SIZE(veu2_resources), 300 + }; 301 + 302 + /* VEU3 */ 303 + static struct uio_info veu3_platform_data = { 304 + .name = "VEU3", 305 + .version = "0", 306 + .irq = intcs_evt2irq(0x760), 307 + }; 308 + 309 + static struct resource veu3_resources[] = { 310 + [0] = { 311 + .name = "VEU3", 312 + .start = 0xfe92c000, 313 + .end = 0xfe92c0b7, 314 + .flags = IORESOURCE_MEM, 315 + }, 316 + }; 317 + 318 + static struct platform_device veu3_device = { 319 + .name = "uio_pdrv_genirq", 320 + .id = 4, 321 + .dev = { 322 + .platform_data = &veu3_platform_data, 323 + }, 324 + .resource = veu3_resources, 325 + .num_resources = ARRAY_SIZE(veu3_resources), 326 + }; 327 + 328 + /* VEU2H */ 329 + static struct uio_info veu2h_platform_data = { 330 + .name = "VEU2H", 331 + .version = "0", 332 + .irq = intcs_evt2irq(0x520), 333 + }; 334 + 335 + static struct resource veu2h_resources[] = { 336 + [0] = { 337 + .name = "VEU2H", 338 + .start = 0xfe93c000, 339 + .end = 0xfe93c27b, 340 + .flags = IORESOURCE_MEM, 341 + }, 342 + }; 343 + 344 + static struct platform_device veu2h_device = { 345 + .name = "uio_pdrv_genirq", 346 + .id = 5, 347 + .dev = { 348 + .platform_data = &veu2h_platform_data, 349 + }, 350 + .resource = veu2h_resources, 351 + .num_resources = ARRAY_SIZE(veu2h_resources), 352 + }; 353 + 354 + /* JPU */ 355 + static struct uio_info jpu_platform_data = { 356 + .name = "JPU", 357 + .version = "0", 358 + .irq = intcs_evt2irq(0x560), 359 + }; 360 + 361 + static struct resource jpu_resources[] = { 362 + [0] = { 363 + .name = "JPU", 364 + .start = 0xfe980000, 365 + .end = 0xfe9902d3, 366 + .flags = IORESOURCE_MEM, 367 + }, 368 + }; 369 + 370 + static struct platform_device jpu_device = { 371 + .name = "uio_pdrv_genirq", 372 + .id = 6, 373 + .dev = { 374 + .platform_data = &jpu_platform_data, 375 + }, 376 + .resource = jpu_resources, 377 + .num_resources = ARRAY_SIZE(jpu_resources), 378 + }; 379 + 380 + /* SPU1 */ 381 + static struct uio_info spu1_platform_data = { 382 + .name = "SPU1", 383 + .version = "0", 384 + .irq = evt2irq(0xfc0), 385 + }; 386 + 387 + static struct resource spu1_resources[] = { 388 + [0] = { 389 + .name = "SPU1", 390 + .start = 0xfe300000, 391 + .end = 0xfe3fffff, 392 + .flags = IORESOURCE_MEM, 393 + }, 394 + }; 395 + 396 + static struct platform_device spu1_device = { 397 + .name = "uio_pdrv_genirq", 398 + .id = 7, 399 + .dev = { 400 + .platform_data = &spu1_platform_data, 401 + }, 402 + .resource = spu1_resources, 403 + .num_resources = ARRAY_SIZE(spu1_resources), 404 + }; 405 + 199 406 static struct platform_device *sh7367_early_devices[] __initdata = { 200 407 &scif0_device, 201 408 &scif1_device, ··· 415 206 &cmt10_device, 416 207 }; 417 208 209 + static struct platform_device *sh7367_devices[] __initdata = { 210 + &vpu_device, 211 + &veu0_device, 212 + &veu1_device, 213 + &veu2_device, 214 + &veu3_device, 215 + &veu2h_device, 216 + &jpu_device, 217 + &spu1_device, 218 + }; 219 + 418 220 void __init sh7367_add_standard_devices(void) 419 221 { 420 222 platform_add_devices(sh7367_early_devices, 421 223 ARRAY_SIZE(sh7367_early_devices)); 224 + 225 + platform_add_devices(sh7367_devices, 226 + ARRAY_SIZE(sh7367_devices)); 422 227 } 423 228 424 229 #define SYMSTPCR2 0xe6158048
+217
arch/arm/mach-shmobile/setup-sh7372.c
··· 22 22 #include <linux/interrupt.h> 23 23 #include <linux/irq.h> 24 24 #include <linux/platform_device.h> 25 + #include <linux/uio_driver.h> 25 26 #include <linux/delay.h> 26 27 #include <linux/input.h> 27 28 #include <linux/io.h> ··· 602 601 }, 603 602 }; 604 603 604 + /* VPU */ 605 + static struct uio_info vpu_platform_data = { 606 + .name = "VPU5HG", 607 + .version = "0", 608 + .irq = intcs_evt2irq(0x980), 609 + }; 610 + 611 + static struct resource vpu_resources[] = { 612 + [0] = { 613 + .name = "VPU", 614 + .start = 0xfe900000, 615 + .end = 0xfe900157, 616 + .flags = IORESOURCE_MEM, 617 + }, 618 + }; 619 + 620 + static struct platform_device vpu_device = { 621 + .name = "uio_pdrv_genirq", 622 + .id = 0, 623 + .dev = { 624 + .platform_data = &vpu_platform_data, 625 + }, 626 + .resource = vpu_resources, 627 + .num_resources = ARRAY_SIZE(vpu_resources), 628 + }; 629 + 630 + /* VEU0 */ 631 + static struct uio_info veu0_platform_data = { 632 + .name = "VEU0", 633 + .version = "0", 634 + .irq = intcs_evt2irq(0x700), 635 + }; 636 + 637 + static struct resource veu0_resources[] = { 638 + [0] = { 639 + .name = "VEU0", 640 + .start = 0xfe920000, 641 + .end = 0xfe9200cb, 642 + .flags = IORESOURCE_MEM, 643 + }, 644 + }; 645 + 646 + static struct platform_device veu0_device = { 647 + .name = "uio_pdrv_genirq", 648 + .id = 1, 649 + .dev = { 650 + .platform_data = &veu0_platform_data, 651 + }, 652 + .resource = veu0_resources, 653 + .num_resources = ARRAY_SIZE(veu0_resources), 654 + }; 655 + 656 + /* VEU1 */ 657 + static struct uio_info veu1_platform_data = { 658 + .name = "VEU1", 659 + .version = "0", 660 + .irq = intcs_evt2irq(0x720), 661 + }; 662 + 663 + static struct resource veu1_resources[] = { 664 + [0] = { 665 + .name = "VEU1", 666 + .start = 0xfe924000, 667 + .end = 0xfe9240cb, 668 + .flags = IORESOURCE_MEM, 669 + }, 670 + }; 671 + 672 + static struct platform_device veu1_device = { 673 + .name = "uio_pdrv_genirq", 674 + .id = 2, 675 + .dev = { 676 + .platform_data = &veu1_platform_data, 677 + }, 678 + .resource = veu1_resources, 679 + .num_resources = ARRAY_SIZE(veu1_resources), 680 + }; 681 + 682 + /* VEU2 */ 683 + static struct uio_info veu2_platform_data = { 684 + .name = "VEU2", 685 + .version = "0", 686 + .irq = intcs_evt2irq(0x740), 687 + }; 688 + 689 + static struct resource veu2_resources[] = { 690 + [0] = { 691 + .name = "VEU2", 692 + .start = 0xfe928000, 693 + .end = 0xfe928307, 694 + .flags = IORESOURCE_MEM, 695 + }, 696 + }; 697 + 698 + static struct platform_device veu2_device = { 699 + .name = "uio_pdrv_genirq", 700 + .id = 3, 701 + .dev = { 702 + .platform_data = &veu2_platform_data, 703 + }, 704 + .resource = veu2_resources, 705 + .num_resources = ARRAY_SIZE(veu2_resources), 706 + }; 707 + 708 + /* VEU3 */ 709 + static struct uio_info veu3_platform_data = { 710 + .name = "VEU3", 711 + .version = "0", 712 + .irq = intcs_evt2irq(0x760), 713 + }; 714 + 715 + static struct resource veu3_resources[] = { 716 + [0] = { 717 + .name = "VEU3", 718 + .start = 0xfe92c000, 719 + .end = 0xfe92c307, 720 + .flags = IORESOURCE_MEM, 721 + }, 722 + }; 723 + 724 + static struct platform_device veu3_device = { 725 + .name = "uio_pdrv_genirq", 726 + .id = 4, 727 + .dev = { 728 + .platform_data = &veu3_platform_data, 729 + }, 730 + .resource = veu3_resources, 731 + .num_resources = ARRAY_SIZE(veu3_resources), 732 + }; 733 + 734 + /* JPU */ 735 + static struct uio_info jpu_platform_data = { 736 + .name = "JPU", 737 + .version = "0", 738 + .irq = intcs_evt2irq(0x560), 739 + }; 740 + 741 + static struct resource jpu_resources[] = { 742 + [0] = { 743 + .name = "JPU", 744 + .start = 0xfe980000, 745 + .end = 0xfe9902d3, 746 + .flags = IORESOURCE_MEM, 747 + }, 748 + }; 749 + 750 + static struct platform_device jpu_device = { 751 + .name = "uio_pdrv_genirq", 752 + .id = 5, 753 + .dev = { 754 + .platform_data = &jpu_platform_data, 755 + }, 756 + .resource = jpu_resources, 757 + .num_resources = ARRAY_SIZE(jpu_resources), 758 + }; 759 + 760 + /* SPU2DSP0 */ 761 + static struct uio_info spu0_platform_data = { 762 + .name = "SPU2DSP0", 763 + .version = "0", 764 + .irq = evt2irq(0x1800), 765 + }; 766 + 767 + static struct resource spu0_resources[] = { 768 + [0] = { 769 + .name = "SPU2DSP0", 770 + .start = 0xfe200000, 771 + .end = 0xfe2fffff, 772 + .flags = IORESOURCE_MEM, 773 + }, 774 + }; 775 + 776 + static struct platform_device spu0_device = { 777 + .name = "uio_pdrv_genirq", 778 + .id = 6, 779 + .dev = { 780 + .platform_data = &spu0_platform_data, 781 + }, 782 + .resource = spu0_resources, 783 + .num_resources = ARRAY_SIZE(spu0_resources), 784 + }; 785 + 786 + /* SPU2DSP1 */ 787 + static struct uio_info spu1_platform_data = { 788 + .name = "SPU2DSP1", 789 + .version = "0", 790 + .irq = evt2irq(0x1820), 791 + }; 792 + 793 + static struct resource spu1_resources[] = { 794 + [0] = { 795 + .name = "SPU2DSP1", 796 + .start = 0xfe300000, 797 + .end = 0xfe3fffff, 798 + .flags = IORESOURCE_MEM, 799 + }, 800 + }; 801 + 802 + static struct platform_device spu1_device = { 803 + .name = "uio_pdrv_genirq", 804 + .id = 7, 805 + .dev = { 806 + .platform_data = &spu1_platform_data, 807 + }, 808 + .resource = spu1_resources, 809 + .num_resources = ARRAY_SIZE(spu1_resources), 810 + }; 811 + 605 812 static struct platform_device *sh7372_early_devices[] __initdata = { 606 813 &scif0_device, 607 814 &scif1_device, ··· 829 620 &dma0_device, 830 621 &dma1_device, 831 622 &dma2_device, 623 + &vpu_device, 624 + &veu0_device, 625 + &veu1_device, 626 + &veu2_device, 627 + &veu3_device, 628 + &jpu_device, 629 + &spu0_device, 630 + &spu1_device, 832 631 }; 833 632 834 633 void __init sh7372_add_standard_devices(void)
+231 -8
arch/arm/mach-shmobile/setup-sh7377.c
··· 22 22 #include <linux/interrupt.h> 23 23 #include <linux/irq.h> 24 24 #include <linux/platform_device.h> 25 + #include <linux/uio_driver.h> 25 26 #include <linux/delay.h> 26 27 #include <linux/input.h> 27 28 #include <linux/io.h> ··· 39 38 .flags = UPF_BOOT_AUTOCONF, 40 39 .scscr = SCSCR_RE | SCSCR_TE, 41 40 .scbrr_algo_id = SCBRR_ALGO_4, 42 - .type = PORT_SCIF, 41 + .type = PORT_SCIFA, 43 42 .irqs = { evt2irq(0xc00), evt2irq(0xc00), 44 43 evt2irq(0xc00), evt2irq(0xc00) }, 45 44 }; ··· 58 57 .flags = UPF_BOOT_AUTOCONF, 59 58 .scscr = SCSCR_RE | SCSCR_TE, 60 59 .scbrr_algo_id = SCBRR_ALGO_4, 61 - .type = PORT_SCIF, 60 + .type = PORT_SCIFA, 62 61 .irqs = { evt2irq(0xc20), evt2irq(0xc20), 63 62 evt2irq(0xc20), evt2irq(0xc20) }, 64 63 }; ··· 77 76 .flags = UPF_BOOT_AUTOCONF, 78 77 .scscr = SCSCR_RE | SCSCR_TE, 79 78 .scbrr_algo_id = SCBRR_ALGO_4, 80 - .type = PORT_SCIF, 79 + .type = PORT_SCIFA, 81 80 .irqs = { evt2irq(0xc40), evt2irq(0xc40), 82 81 evt2irq(0xc40), evt2irq(0xc40) }, 83 82 }; ··· 96 95 .flags = UPF_BOOT_AUTOCONF, 97 96 .scscr = SCSCR_RE | SCSCR_TE, 98 97 .scbrr_algo_id = SCBRR_ALGO_4, 99 - .type = PORT_SCIF, 98 + .type = PORT_SCIFA, 100 99 .irqs = { evt2irq(0xc60), evt2irq(0xc60), 101 100 evt2irq(0xc60), evt2irq(0xc60) }, 102 101 }; ··· 115 114 .flags = UPF_BOOT_AUTOCONF, 116 115 .scscr = SCSCR_RE | SCSCR_TE, 117 116 .scbrr_algo_id = SCBRR_ALGO_4, 118 - .type = PORT_SCIF, 117 + .type = PORT_SCIFA, 119 118 .irqs = { evt2irq(0xd20), evt2irq(0xd20), 120 119 evt2irq(0xd20), evt2irq(0xd20) }, 121 120 }; ··· 134 133 .flags = UPF_BOOT_AUTOCONF, 135 134 .scscr = SCSCR_RE | SCSCR_TE, 136 135 .scbrr_algo_id = SCBRR_ALGO_4, 137 - .type = PORT_SCIF, 136 + .type = PORT_SCIFA, 138 137 .irqs = { evt2irq(0xd40), evt2irq(0xd40), 139 138 evt2irq(0xd40), evt2irq(0xd40) }, 140 139 }; ··· 153 152 .flags = UPF_BOOT_AUTOCONF, 154 153 .scscr = SCSCR_RE | SCSCR_TE, 155 154 .scbrr_algo_id = SCBRR_ALGO_4, 156 - .type = PORT_SCIF, 155 + .type = PORT_SCIFA, 157 156 .irqs = { intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80), 158 157 intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80) }, 159 158 }; ··· 172 171 .flags = UPF_BOOT_AUTOCONF, 173 172 .scscr = SCSCR_RE | SCSCR_TE, 174 173 .scbrr_algo_id = SCBRR_ALGO_4, 175 - .type = PORT_SCIF, 174 + .type = PORT_SCIFB, 176 175 .irqs = { evt2irq(0xd60), evt2irq(0xd60), 177 176 evt2irq(0xd60), evt2irq(0xd60) }, 178 177 }; ··· 216 215 .num_resources = ARRAY_SIZE(cmt10_resources), 217 216 }; 218 217 218 + /* VPU */ 219 + static struct uio_info vpu_platform_data = { 220 + .name = "VPU5HG", 221 + .version = "0", 222 + .irq = intcs_evt2irq(0x980), 223 + }; 224 + 225 + static struct resource vpu_resources[] = { 226 + [0] = { 227 + .name = "VPU", 228 + .start = 0xfe900000, 229 + .end = 0xfe900157, 230 + .flags = IORESOURCE_MEM, 231 + }, 232 + }; 233 + 234 + static struct platform_device vpu_device = { 235 + .name = "uio_pdrv_genirq", 236 + .id = 0, 237 + .dev = { 238 + .platform_data = &vpu_platform_data, 239 + }, 240 + .resource = vpu_resources, 241 + .num_resources = ARRAY_SIZE(vpu_resources), 242 + }; 243 + 244 + /* VEU0 */ 245 + static struct uio_info veu0_platform_data = { 246 + .name = "VEU0", 247 + .version = "0", 248 + .irq = intcs_evt2irq(0x700), 249 + }; 250 + 251 + static struct resource veu0_resources[] = { 252 + [0] = { 253 + .name = "VEU0", 254 + .start = 0xfe920000, 255 + .end = 0xfe9200cb, 256 + .flags = IORESOURCE_MEM, 257 + }, 258 + }; 259 + 260 + static struct platform_device veu0_device = { 261 + .name = "uio_pdrv_genirq", 262 + .id = 1, 263 + .dev = { 264 + .platform_data = &veu0_platform_data, 265 + }, 266 + .resource = veu0_resources, 267 + .num_resources = ARRAY_SIZE(veu0_resources), 268 + }; 269 + 270 + /* VEU1 */ 271 + static struct uio_info veu1_platform_data = { 272 + .name = "VEU1", 273 + .version = "0", 274 + .irq = intcs_evt2irq(0x720), 275 + }; 276 + 277 + static struct resource veu1_resources[] = { 278 + [0] = { 279 + .name = "VEU1", 280 + .start = 0xfe924000, 281 + .end = 0xfe9240cb, 282 + .flags = IORESOURCE_MEM, 283 + }, 284 + }; 285 + 286 + static struct platform_device veu1_device = { 287 + .name = "uio_pdrv_genirq", 288 + .id = 2, 289 + .dev = { 290 + .platform_data = &veu1_platform_data, 291 + }, 292 + .resource = veu1_resources, 293 + .num_resources = ARRAY_SIZE(veu1_resources), 294 + }; 295 + 296 + /* VEU2 */ 297 + static struct uio_info veu2_platform_data = { 298 + .name = "VEU2", 299 + .version = "0", 300 + .irq = intcs_evt2irq(0x740), 301 + }; 302 + 303 + static struct resource veu2_resources[] = { 304 + [0] = { 305 + .name = "VEU2", 306 + .start = 0xfe928000, 307 + .end = 0xfe928307, 308 + .flags = IORESOURCE_MEM, 309 + }, 310 + }; 311 + 312 + static struct platform_device veu2_device = { 313 + .name = "uio_pdrv_genirq", 314 + .id = 3, 315 + .dev = { 316 + .platform_data = &veu2_platform_data, 317 + }, 318 + .resource = veu2_resources, 319 + .num_resources = ARRAY_SIZE(veu2_resources), 320 + }; 321 + 322 + /* VEU3 */ 323 + static struct uio_info veu3_platform_data = { 324 + .name = "VEU3", 325 + .version = "0", 326 + .irq = intcs_evt2irq(0x760), 327 + }; 328 + 329 + static struct resource veu3_resources[] = { 330 + [0] = { 331 + .name = "VEU3", 332 + .start = 0xfe92c000, 333 + .end = 0xfe92c307, 334 + .flags = IORESOURCE_MEM, 335 + }, 336 + }; 337 + 338 + static struct platform_device veu3_device = { 339 + .name = "uio_pdrv_genirq", 340 + .id = 4, 341 + .dev = { 342 + .platform_data = &veu3_platform_data, 343 + }, 344 + .resource = veu3_resources, 345 + .num_resources = ARRAY_SIZE(veu3_resources), 346 + }; 347 + 348 + /* JPU */ 349 + static struct uio_info jpu_platform_data = { 350 + .name = "JPU", 351 + .version = "0", 352 + .irq = intcs_evt2irq(0x560), 353 + }; 354 + 355 + static struct resource jpu_resources[] = { 356 + [0] = { 357 + .name = "JPU", 358 + .start = 0xfe980000, 359 + .end = 0xfe9902d3, 360 + .flags = IORESOURCE_MEM, 361 + }, 362 + }; 363 + 364 + static struct platform_device jpu_device = { 365 + .name = "uio_pdrv_genirq", 366 + .id = 5, 367 + .dev = { 368 + .platform_data = &jpu_platform_data, 369 + }, 370 + .resource = jpu_resources, 371 + .num_resources = ARRAY_SIZE(jpu_resources), 372 + }; 373 + 374 + /* SPU2DSP0 */ 375 + static struct uio_info spu0_platform_data = { 376 + .name = "SPU2DSP0", 377 + .version = "0", 378 + .irq = evt2irq(0x1800), 379 + }; 380 + 381 + static struct resource spu0_resources[] = { 382 + [0] = { 383 + .name = "SPU2DSP0", 384 + .start = 0xfe200000, 385 + .end = 0xfe2fffff, 386 + .flags = IORESOURCE_MEM, 387 + }, 388 + }; 389 + 390 + static struct platform_device spu0_device = { 391 + .name = "uio_pdrv_genirq", 392 + .id = 6, 393 + .dev = { 394 + .platform_data = &spu0_platform_data, 395 + }, 396 + .resource = spu0_resources, 397 + .num_resources = ARRAY_SIZE(spu0_resources), 398 + }; 399 + 400 + /* SPU2DSP1 */ 401 + static struct uio_info spu1_platform_data = { 402 + .name = "SPU2DSP1", 403 + .version = "0", 404 + .irq = evt2irq(0x1820), 405 + }; 406 + 407 + static struct resource spu1_resources[] = { 408 + [0] = { 409 + .name = "SPU2DSP1", 410 + .start = 0xfe300000, 411 + .end = 0xfe3fffff, 412 + .flags = IORESOURCE_MEM, 413 + }, 414 + }; 415 + 416 + static struct platform_device spu1_device = { 417 + .name = "uio_pdrv_genirq", 418 + .id = 7, 419 + .dev = { 420 + .platform_data = &spu1_platform_data, 421 + }, 422 + .resource = spu1_resources, 423 + .num_resources = ARRAY_SIZE(spu1_resources), 424 + }; 425 + 219 426 static struct platform_device *sh7377_early_devices[] __initdata = { 220 427 &scif0_device, 221 428 &scif1_device, ··· 436 227 &cmt10_device, 437 228 }; 438 229 230 + static struct platform_device *sh7377_devices[] __initdata = { 231 + &vpu_device, 232 + &veu0_device, 233 + &veu1_device, 234 + &veu2_device, 235 + &veu3_device, 236 + &jpu_device, 237 + &spu0_device, 238 + &spu1_device, 239 + }; 240 + 439 241 void __init sh7377_add_standard_devices(void) 440 242 { 441 243 platform_add_devices(sh7377_early_devices, 442 244 ARRAY_SIZE(sh7377_early_devices)); 245 + 246 + platform_add_devices(sh7377_devices, 247 + ARRAY_SIZE(sh7377_devices)); 443 248 } 444 249 445 250 #define SMSTPCR3 0xe615013c
+244
arch/arm/mach-shmobile/setup-sh73a0.c
··· 27 27 #include <linux/input.h> 28 28 #include <linux/io.h> 29 29 #include <linux/serial_sci.h> 30 + #include <linux/sh_dma.h> 30 31 #include <linux/sh_intc.h> 31 32 #include <linux/sh_timer.h> 32 33 #include <mach/hardware.h> 34 + #include <mach/sh73a0.h> 33 35 #include <asm/mach-types.h> 34 36 #include <asm/mach/arch.h> 35 37 ··· 394 392 .num_resources = ARRAY_SIZE(i2c4_resources), 395 393 }; 396 394 395 + /* Transmit sizes and respective CHCR register values */ 396 + enum { 397 + XMIT_SZ_8BIT = 0, 398 + XMIT_SZ_16BIT = 1, 399 + XMIT_SZ_32BIT = 2, 400 + XMIT_SZ_64BIT = 7, 401 + XMIT_SZ_128BIT = 3, 402 + XMIT_SZ_256BIT = 4, 403 + XMIT_SZ_512BIT = 5, 404 + }; 405 + 406 + /* log2(size / 8) - used to calculate number of transfers */ 407 + #define TS_SHIFT { \ 408 + [XMIT_SZ_8BIT] = 0, \ 409 + [XMIT_SZ_16BIT] = 1, \ 410 + [XMIT_SZ_32BIT] = 2, \ 411 + [XMIT_SZ_64BIT] = 3, \ 412 + [XMIT_SZ_128BIT] = 4, \ 413 + [XMIT_SZ_256BIT] = 5, \ 414 + [XMIT_SZ_512BIT] = 6, \ 415 + } 416 + 417 + #define TS_INDEX2VAL(i) ((((i) & 3) << 3) | (((i) & 0xc) << (20 - 2))) 418 + #define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL((xmit_sz))) 419 + #define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL((xmit_sz))) 420 + 421 + static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = { 422 + { 423 + .slave_id = SHDMA_SLAVE_SCIF0_TX, 424 + .addr = 0xe6c40020, 425 + .chcr = CHCR_TX(XMIT_SZ_8BIT), 426 + .mid_rid = 0x21, 427 + }, { 428 + .slave_id = SHDMA_SLAVE_SCIF0_RX, 429 + .addr = 0xe6c40024, 430 + .chcr = CHCR_RX(XMIT_SZ_8BIT), 431 + .mid_rid = 0x22, 432 + }, { 433 + .slave_id = SHDMA_SLAVE_SCIF1_TX, 434 + .addr = 0xe6c50020, 435 + .chcr = CHCR_TX(XMIT_SZ_8BIT), 436 + .mid_rid = 0x25, 437 + }, { 438 + .slave_id = SHDMA_SLAVE_SCIF1_RX, 439 + .addr = 0xe6c50024, 440 + .chcr = CHCR_RX(XMIT_SZ_8BIT), 441 + .mid_rid = 0x26, 442 + }, { 443 + .slave_id = SHDMA_SLAVE_SCIF2_TX, 444 + .addr = 0xe6c60020, 445 + .chcr = CHCR_TX(XMIT_SZ_8BIT), 446 + .mid_rid = 0x29, 447 + }, { 448 + .slave_id = SHDMA_SLAVE_SCIF2_RX, 449 + .addr = 0xe6c60024, 450 + .chcr = CHCR_RX(XMIT_SZ_8BIT), 451 + .mid_rid = 0x2a, 452 + }, { 453 + .slave_id = SHDMA_SLAVE_SCIF3_TX, 454 + .addr = 0xe6c70020, 455 + .chcr = CHCR_TX(XMIT_SZ_8BIT), 456 + .mid_rid = 0x2d, 457 + }, { 458 + .slave_id = SHDMA_SLAVE_SCIF3_RX, 459 + .addr = 0xe6c70024, 460 + .chcr = CHCR_RX(XMIT_SZ_8BIT), 461 + .mid_rid = 0x2e, 462 + }, { 463 + .slave_id = SHDMA_SLAVE_SCIF4_TX, 464 + .addr = 0xe6c80020, 465 + .chcr = CHCR_TX(XMIT_SZ_8BIT), 466 + .mid_rid = 0x39, 467 + }, { 468 + .slave_id = SHDMA_SLAVE_SCIF4_RX, 469 + .addr = 0xe6c80024, 470 + .chcr = CHCR_RX(XMIT_SZ_8BIT), 471 + .mid_rid = 0x3a, 472 + }, { 473 + .slave_id = SHDMA_SLAVE_SCIF5_TX, 474 + .addr = 0xe6cb0020, 475 + .chcr = CHCR_TX(XMIT_SZ_8BIT), 476 + .mid_rid = 0x35, 477 + }, { 478 + .slave_id = SHDMA_SLAVE_SCIF5_RX, 479 + .addr = 0xe6cb0024, 480 + .chcr = CHCR_RX(XMIT_SZ_8BIT), 481 + .mid_rid = 0x36, 482 + }, { 483 + .slave_id = SHDMA_SLAVE_SCIF6_TX, 484 + .addr = 0xe6cc0020, 485 + .chcr = CHCR_TX(XMIT_SZ_8BIT), 486 + .mid_rid = 0x1d, 487 + }, { 488 + .slave_id = SHDMA_SLAVE_SCIF6_RX, 489 + .addr = 0xe6cc0024, 490 + .chcr = CHCR_RX(XMIT_SZ_8BIT), 491 + .mid_rid = 0x1e, 492 + }, { 493 + .slave_id = SHDMA_SLAVE_SCIF7_TX, 494 + .addr = 0xe6cd0020, 495 + .chcr = CHCR_TX(XMIT_SZ_8BIT), 496 + .mid_rid = 0x19, 497 + }, { 498 + .slave_id = SHDMA_SLAVE_SCIF7_RX, 499 + .addr = 0xe6cd0024, 500 + .chcr = CHCR_RX(XMIT_SZ_8BIT), 501 + .mid_rid = 0x1a, 502 + }, { 503 + .slave_id = SHDMA_SLAVE_SCIF8_TX, 504 + .addr = 0xe6c30040, 505 + .chcr = CHCR_TX(XMIT_SZ_8BIT), 506 + .mid_rid = 0x3d, 507 + }, { 508 + .slave_id = SHDMA_SLAVE_SCIF8_RX, 509 + .addr = 0xe6c30060, 510 + .chcr = CHCR_RX(XMIT_SZ_8BIT), 511 + .mid_rid = 0x3e, 512 + }, { 513 + .slave_id = SHDMA_SLAVE_SDHI0_TX, 514 + .addr = 0xee100030, 515 + .chcr = CHCR_TX(XMIT_SZ_16BIT), 516 + .mid_rid = 0xc1, 517 + }, { 518 + .slave_id = SHDMA_SLAVE_SDHI0_RX, 519 + .addr = 0xee100030, 520 + .chcr = CHCR_RX(XMIT_SZ_16BIT), 521 + .mid_rid = 0xc2, 522 + }, { 523 + .slave_id = SHDMA_SLAVE_SDHI1_TX, 524 + .addr = 0xee120030, 525 + .chcr = CHCR_TX(XMIT_SZ_16BIT), 526 + .mid_rid = 0xc9, 527 + }, { 528 + .slave_id = SHDMA_SLAVE_SDHI1_RX, 529 + .addr = 0xee120030, 530 + .chcr = CHCR_RX(XMIT_SZ_16BIT), 531 + .mid_rid = 0xca, 532 + }, { 533 + .slave_id = SHDMA_SLAVE_SDHI2_TX, 534 + .addr = 0xee140030, 535 + .chcr = CHCR_TX(XMIT_SZ_16BIT), 536 + .mid_rid = 0xcd, 537 + }, { 538 + .slave_id = SHDMA_SLAVE_SDHI2_RX, 539 + .addr = 0xee140030, 540 + .chcr = CHCR_RX(XMIT_SZ_16BIT), 541 + .mid_rid = 0xce, 542 + }, { 543 + .slave_id = SHDMA_SLAVE_MMCIF_TX, 544 + .addr = 0xe6bd0034, 545 + .chcr = CHCR_TX(XMIT_SZ_32BIT), 546 + .mid_rid = 0xd1, 547 + }, { 548 + .slave_id = SHDMA_SLAVE_MMCIF_RX, 549 + .addr = 0xe6bd0034, 550 + .chcr = CHCR_RX(XMIT_SZ_32BIT), 551 + .mid_rid = 0xd2, 552 + }, 553 + }; 554 + 555 + #define DMAE_CHANNEL(_offset) \ 556 + { \ 557 + .offset = _offset - 0x20, \ 558 + .dmars = _offset - 0x20 + 0x40, \ 559 + } 560 + 561 + static const struct sh_dmae_channel sh73a0_dmae_channels[] = { 562 + DMAE_CHANNEL(0x8000), 563 + DMAE_CHANNEL(0x8080), 564 + DMAE_CHANNEL(0x8100), 565 + DMAE_CHANNEL(0x8180), 566 + DMAE_CHANNEL(0x8200), 567 + DMAE_CHANNEL(0x8280), 568 + DMAE_CHANNEL(0x8300), 569 + DMAE_CHANNEL(0x8380), 570 + DMAE_CHANNEL(0x8400), 571 + DMAE_CHANNEL(0x8480), 572 + DMAE_CHANNEL(0x8500), 573 + DMAE_CHANNEL(0x8580), 574 + DMAE_CHANNEL(0x8600), 575 + DMAE_CHANNEL(0x8680), 576 + DMAE_CHANNEL(0x8700), 577 + DMAE_CHANNEL(0x8780), 578 + DMAE_CHANNEL(0x8800), 579 + DMAE_CHANNEL(0x8880), 580 + DMAE_CHANNEL(0x8900), 581 + DMAE_CHANNEL(0x8980), 582 + }; 583 + 584 + static const unsigned int ts_shift[] = TS_SHIFT; 585 + 586 + static struct sh_dmae_pdata sh73a0_dmae_platform_data = { 587 + .slave = sh73a0_dmae_slaves, 588 + .slave_num = ARRAY_SIZE(sh73a0_dmae_slaves), 589 + .channel = sh73a0_dmae_channels, 590 + .channel_num = ARRAY_SIZE(sh73a0_dmae_channels), 591 + .ts_low_shift = 3, 592 + .ts_low_mask = 0x18, 593 + .ts_high_shift = (20 - 2), /* 2 bits for shifted low TS */ 594 + .ts_high_mask = 0x00300000, 595 + .ts_shift = ts_shift, 596 + .ts_shift_num = ARRAY_SIZE(ts_shift), 597 + .dmaor_init = DMAOR_DME, 598 + }; 599 + 600 + static struct resource sh73a0_dmae_resources[] = { 601 + { 602 + /* Registers including DMAOR and channels including DMARSx */ 603 + .start = 0xfe000020, 604 + .end = 0xfe008a00 - 1, 605 + .flags = IORESOURCE_MEM, 606 + }, 607 + { 608 + /* DMA error IRQ */ 609 + .start = gic_spi(129), 610 + .end = gic_spi(129), 611 + .flags = IORESOURCE_IRQ, 612 + }, 613 + { 614 + /* IRQ for channels 0-19 */ 615 + .start = gic_spi(109), 616 + .end = gic_spi(128), 617 + .flags = IORESOURCE_IRQ, 618 + }, 619 + }; 620 + 621 + static struct platform_device dma0_device = { 622 + .name = "sh-dma-engine", 623 + .id = 0, 624 + .resource = sh73a0_dmae_resources, 625 + .num_resources = ARRAY_SIZE(sh73a0_dmae_resources), 626 + .dev = { 627 + .platform_data = &sh73a0_dmae_platform_data, 628 + }, 629 + }; 630 + 397 631 static struct platform_device *sh73a0_early_devices[] __initdata = { 398 632 &scif0_device, 399 633 &scif1_device, ··· 651 413 &i2c2_device, 652 414 &i2c3_device, 653 415 &i2c4_device, 416 + &dma0_device, 654 417 }; 418 + 419 + #define SRCR2 0xe61580b0 655 420 656 421 void __init sh73a0_add_standard_devices(void) 657 422 { 423 + /* Clear software reset bit on SY-DMAC module */ 424 + __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2); 425 + 658 426 platform_add_devices(sh73a0_early_devices, 659 427 ARRAY_SIZE(sh73a0_early_devices)); 660 428 platform_add_devices(sh73a0_late_devices,
+260
arch/arm/mach-shmobile/sleep-sh7372.S
··· 1 + /* 2 + * sh7372 lowlevel sleep code for "Core Standby Mode" 3 + * 4 + * Copyright (C) 2011 Magnus Damm 5 + * 6 + * In "Core Standby Mode" the ARM core is off, but L2 cache is still on 7 + * 8 + * Based on mach-omap2/sleep34xx.S 9 + * 10 + * (C) Copyright 2007 Texas Instruments 11 + * Karthik Dasu <karthik-dp@ti.com> 12 + * 13 + * (C) Copyright 2004 Texas Instruments, <www.ti.com> 14 + * Richard Woodruff <r-woodruff2@ti.com> 15 + * 16 + * This program is free software; you can redistribute it and/or 17 + * modify it under the terms of the GNU General Public License as 18 + * published by the Free Software Foundation; either version 2 of 19 + * the License, or (at your option) any later version. 20 + * 21 + * This program is distributed in the hope that it will be useful, 22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the 24 + * GNU General Public License for more details. 25 + * 26 + * You should have received a copy of the GNU General Public License 27 + * along with this program; if not, write to the Free Software 28 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 29 + * MA 02111-1307 USA 30 + */ 31 + 32 + #include <linux/linkage.h> 33 + #include <asm/assembler.h> 34 + 35 + #define SMFRAM 0xe6a70000 36 + 37 + .align 38 + kernel_flush: 39 + .word v7_flush_dcache_all 40 + 41 + .align 3 42 + ENTRY(sh7372_cpu_suspend) 43 + stmfd sp!, {r0-r12, lr} @ save registers on stack 44 + 45 + ldr r8, =SMFRAM 46 + 47 + mov r4, sp @ Store sp 48 + mrs r5, spsr @ Store spsr 49 + mov r6, lr @ Store lr 50 + stmia r8!, {r4-r6} 51 + 52 + mrc p15, 0, r4, c1, c0, 2 @ Coprocessor access control register 53 + mrc p15, 0, r5, c2, c0, 0 @ TTBR0 54 + mrc p15, 0, r6, c2, c0, 1 @ TTBR1 55 + mrc p15, 0, r7, c2, c0, 2 @ TTBCR 56 + stmia r8!, {r4-r7} 57 + 58 + mrc p15, 0, r4, c3, c0, 0 @ Domain access Control Register 59 + mrc p15, 0, r5, c10, c2, 0 @ PRRR 60 + mrc p15, 0, r6, c10, c2, 1 @ NMRR 61 + stmia r8!,{r4-r6} 62 + 63 + mrc p15, 0, r4, c13, c0, 1 @ Context ID 64 + mrc p15, 0, r5, c13, c0, 2 @ User r/w thread and process ID 65 + mrc p15, 0, r6, c12, c0, 0 @ Secure or NS vector base address 66 + mrs r7, cpsr @ Store current cpsr 67 + stmia r8!, {r4-r7} 68 + 69 + mrc p15, 0, r4, c1, c0, 0 @ save control register 70 + stmia r8!, {r4} 71 + 72 + /* 73 + * jump out to kernel flush routine 74 + * - reuse that code is better 75 + * - it executes in a cached space so is faster than refetch per-block 76 + * - should be faster and will change with kernel 77 + * - 'might' have to copy address, load and jump to it 78 + * Flush all data from the L1 data cache before disabling 79 + * SCTLR.C bit. 80 + */ 81 + ldr r1, kernel_flush 82 + mov lr, pc 83 + bx r1 84 + 85 + /* 86 + * Clear the SCTLR.C bit to prevent further data cache 87 + * allocation. Clearing SCTLR.C would make all the data accesses 88 + * strongly ordered and would not hit the cache. 89 + */ 90 + mrc p15, 0, r0, c1, c0, 0 91 + bic r0, r0, #(1 << 2) @ Disable the C bit 92 + mcr p15, 0, r0, c1, c0, 0 93 + isb 94 + 95 + /* 96 + * Invalidate L1 data cache. Even though only invalidate is 97 + * necessary exported flush API is used here. Doing clean 98 + * on already clean cache would be almost NOP. 99 + */ 100 + ldr r1, kernel_flush 101 + blx r1 102 + /* 103 + * The kernel doesn't interwork: v7_flush_dcache_all in particluar will 104 + * always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled. 105 + * This sequence switches back to ARM. Note that .align may insert a 106 + * nop: bx pc needs to be word-aligned in order to work. 107 + */ 108 + THUMB( .thumb ) 109 + THUMB( .align ) 110 + THUMB( bx pc ) 111 + THUMB( nop ) 112 + .arm 113 + 114 + /* Data memory barrier and Data sync barrier */ 115 + dsb 116 + dmb 117 + 118 + /* 119 + * =================================== 120 + * == WFI instruction => Enter idle == 121 + * =================================== 122 + */ 123 + wfi @ wait for interrupt 124 + 125 + /* 126 + * =================================== 127 + * == Resume path for non-OFF modes == 128 + * =================================== 129 + */ 130 + mrc p15, 0, r0, c1, c0, 0 131 + tst r0, #(1 << 2) @ Check C bit enabled? 132 + orreq r0, r0, #(1 << 2) @ Enable the C bit if cleared 133 + mcreq p15, 0, r0, c1, c0, 0 134 + isb 135 + 136 + /* 137 + * =================================== 138 + * == Exit point from non-OFF modes == 139 + * =================================== 140 + */ 141 + ldmfd sp!, {r0-r12, pc} @ restore regs and return 142 + 143 + .pool 144 + 145 + .align 12 146 + .text 147 + .global sh7372_cpu_resume 148 + sh7372_cpu_resume: 149 + 150 + mov r1, #0 151 + /* 152 + * Invalidate all instruction caches to PoU 153 + * and flush branch target cache 154 + */ 155 + mcr p15, 0, r1, c7, c5, 0 156 + 157 + ldr r3, =SMFRAM 158 + 159 + ldmia r3!, {r4-r6} 160 + mov sp, r4 @ Restore sp 161 + msr spsr_cxsf, r5 @ Restore spsr 162 + mov lr, r6 @ Restore lr 163 + 164 + ldmia r3!, {r4-r7} 165 + mcr p15, 0, r4, c1, c0, 2 @ Coprocessor access Control Register 166 + mcr p15, 0, r5, c2, c0, 0 @ TTBR0 167 + mcr p15, 0, r6, c2, c0, 1 @ TTBR1 168 + mcr p15, 0, r7, c2, c0, 2 @ TTBCR 169 + 170 + ldmia r3!,{r4-r6} 171 + mcr p15, 0, r4, c3, c0, 0 @ Domain access Control Register 172 + mcr p15, 0, r5, c10, c2, 0 @ PRRR 173 + mcr p15, 0, r6, c10, c2, 1 @ NMRR 174 + 175 + ldmia r3!,{r4-r7} 176 + mcr p15, 0, r4, c13, c0, 1 @ Context ID 177 + mcr p15, 0, r5, c13, c0, 2 @ User r/w thread and process ID 178 + mrc p15, 0, r6, c12, c0, 0 @ Secure or NS vector base address 179 + msr cpsr, r7 @ store cpsr 180 + 181 + /* Starting to enable MMU here */ 182 + mrc p15, 0, r7, c2, c0, 2 @ Read TTBRControl 183 + /* Extract N (0:2) bits and decide whether to use TTBR0 or TTBR1 */ 184 + and r7, #0x7 185 + cmp r7, #0x0 186 + beq usettbr0 187 + ttbr_error: 188 + /* 189 + * More work needs to be done to support N[0:2] value other than 0 190 + * So looping here so that the error can be detected 191 + */ 192 + b ttbr_error 193 + 194 + .align 195 + cache_pred_disable_mask: 196 + .word 0xFFFFE7FB 197 + ttbrbit_mask: 198 + .word 0xFFFFC000 199 + table_index_mask: 200 + .word 0xFFF00000 201 + table_entry: 202 + .word 0x00000C02 203 + usettbr0: 204 + 205 + mrc p15, 0, r2, c2, c0, 0 206 + ldr r5, ttbrbit_mask 207 + and r2, r5 208 + mov r4, pc 209 + ldr r5, table_index_mask 210 + and r4, r5 @ r4 = 31 to 20 bits of pc 211 + /* Extract the value to be written to table entry */ 212 + ldr r6, table_entry 213 + /* r6 has the value to be written to table entry */ 214 + add r6, r6, r4 215 + /* Getting the address of table entry to modify */ 216 + lsr r4, #18 217 + /* r2 has the location which needs to be modified */ 218 + add r2, r4 219 + ldr r4, [r2] 220 + str r6, [r2] /* modify the table entry */ 221 + 222 + mov r7, r6 223 + mov r5, r2 224 + mov r6, r4 225 + /* r5 = original page table address */ 226 + /* r6 = original page table data */ 227 + 228 + mov r0, #0 229 + mcr p15, 0, r0, c7, c5, 4 @ Flush prefetch buffer 230 + mcr p15, 0, r0, c7, c5, 6 @ Invalidate branch predictor array 231 + mcr p15, 0, r0, c8, c5, 0 @ Invalidate instruction TLB 232 + mcr p15, 0, r0, c8, c6, 0 @ Invalidate data TLB 233 + 234 + /* 235 + * Restore control register. This enables the MMU. 236 + * The caches and prediction are not enabled here, they 237 + * will be enabled after restoring the MMU table entry. 238 + */ 239 + ldmia r3!, {r4} 240 + stmia r3!, {r5} /* save original page table address */ 241 + stmia r3!, {r6} /* save original page table data */ 242 + stmia r3!, {r7} /* save modified page table data */ 243 + 244 + ldr r2, cache_pred_disable_mask 245 + and r4, r2 246 + mcr p15, 0, r4, c1, c0, 0 247 + dsb 248 + isb 249 + 250 + ldr r0, =restoremmu_on 251 + bx r0 252 + 253 + /* 254 + * ============================== 255 + * == Exit point from OFF mode == 256 + * ============================== 257 + */ 258 + restoremmu_on: 259 + 260 + ldmfd sp!, {r0-r12, pc} @ restore regs and return
+5 -4
arch/arm/mach-shmobile/smp-sh73a0.c
··· 59 59 { 60 60 void __iomem *scu_base = scu_base_addr(); 61 61 62 + #ifdef CONFIG_HAVE_ARM_TWD 63 + /* twd_base needs to be initialized before percpu_timer_setup() */ 64 + twd_base = (void __iomem *)0xf0000600; 65 + #endif 66 + 62 67 return scu_get_core_count(scu_base); 63 68 } 64 69 ··· 87 82 88 83 void __init sh73a0_smp_prepare_cpus(void) 89 84 { 90 - #ifdef CONFIG_HAVE_ARM_TWD 91 - twd_base = (void __iomem *)0xf0000600; 92 - #endif 93 - 94 85 scu_enable(scu_base_addr()); 95 86 96 87 /* Map the reset vector (in headsmp.S) */
+47
arch/arm/mach-shmobile/suspend.c
··· 1 + /* 2 + * Suspend-to-RAM support code for SH-Mobile ARM 3 + * 4 + * Copyright (C) 2011 Magnus Damm 5 + * 6 + * This file is subject to the terms and conditions of the GNU General Public 7 + * License. See the file "COPYING" in the main directory of this archive 8 + * for more details. 9 + */ 10 + 11 + #include <linux/pm.h> 12 + #include <linux/suspend.h> 13 + #include <linux/module.h> 14 + #include <linux/err.h> 15 + #include <asm/system.h> 16 + #include <asm/io.h> 17 + 18 + static int shmobile_suspend_default_enter(suspend_state_t suspend_state) 19 + { 20 + cpu_do_idle(); 21 + return 0; 22 + } 23 + 24 + static int shmobile_suspend_begin(suspend_state_t state) 25 + { 26 + disable_hlt(); 27 + return 0; 28 + } 29 + 30 + static void shmobile_suspend_end(void) 31 + { 32 + enable_hlt(); 33 + } 34 + 35 + struct platform_suspend_ops shmobile_suspend_ops = { 36 + .begin = shmobile_suspend_begin, 37 + .end = shmobile_suspend_end, 38 + .enter = shmobile_suspend_default_enter, 39 + .valid = suspend_valid_only_mem, 40 + }; 41 + 42 + static int __init shmobile_suspend_init(void) 43 + { 44 + suspend_set_ops(&shmobile_suspend_ops); 45 + return 0; 46 + } 47 + late_initcall(shmobile_suspend_init);
+31 -11
drivers/dma/shdma.c
··· 213 213 struct sh_dmae_device, common); 214 214 struct sh_dmae_pdata *pdata = shdev->pdata; 215 215 const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id]; 216 - u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16); 216 + u16 __iomem *addr = shdev->dmars; 217 217 int shift = chan_pdata->dmars_bit; 218 218 219 219 if (dmae_is_busy(sh_chan)) 220 220 return -EBUSY; 221 + 222 + /* in the case of a missing DMARS resource use first memory window */ 223 + if (!addr) 224 + addr = (u16 __iomem *)shdev->chan_reg; 225 + addr += chan_pdata->dmars / sizeof(u16); 221 226 222 227 __raw_writew((__raw_readw(addr) & (0xff00 >> shift)) | (val << shift), 223 228 addr); ··· 1083 1078 unsigned long irqflags = IRQF_DISABLED, 1084 1079 chan_flag[SH_DMAC_MAX_CHANNELS] = {}; 1085 1080 int errirq, chan_irq[SH_DMAC_MAX_CHANNELS]; 1086 - int err, i, irq_cnt = 0, irqres = 0; 1081 + int err, i, irq_cnt = 0, irqres = 0, irq_cap = 0; 1087 1082 struct sh_dmae_device *shdev; 1088 1083 struct resource *chan, *dmars, *errirq_res, *chanirq_res; 1089 1084 ··· 1092 1087 return -ENODEV; 1093 1088 1094 1089 chan = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1095 - /* DMARS area is optional, if absent, this controller cannot do slave DMA */ 1090 + /* DMARS area is optional */ 1096 1091 dmars = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1097 1092 /* 1098 1093 * IRQ resources: ··· 1159 1154 INIT_LIST_HEAD(&shdev->common.channels); 1160 1155 1161 1156 dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask); 1162 - if (dmars) 1157 + if (pdata->slave && pdata->slave_num) 1163 1158 dma_cap_set(DMA_SLAVE, shdev->common.cap_mask); 1164 1159 1165 1160 shdev->common.device_alloc_chan_resources ··· 1208 1203 !platform_get_resource(pdev, IORESOURCE_IRQ, 1)) { 1209 1204 /* Special case - all multiplexed */ 1210 1205 for (; irq_cnt < pdata->channel_num; irq_cnt++) { 1211 - chan_irq[irq_cnt] = chanirq_res->start; 1212 - chan_flag[irq_cnt] = IRQF_SHARED; 1206 + if (irq_cnt < SH_DMAC_MAX_CHANNELS) { 1207 + chan_irq[irq_cnt] = chanirq_res->start; 1208 + chan_flag[irq_cnt] = IRQF_SHARED; 1209 + } else { 1210 + irq_cap = 1; 1211 + break; 1212 + } 1213 1213 } 1214 1214 } else { 1215 1215 do { ··· 1228 1218 "Found IRQ %d for channel %d\n", 1229 1219 i, irq_cnt); 1230 1220 chan_irq[irq_cnt++] = i; 1221 + 1222 + if (irq_cnt >= SH_DMAC_MAX_CHANNELS) 1223 + break; 1224 + } 1225 + 1226 + if (irq_cnt >= SH_DMAC_MAX_CHANNELS) { 1227 + irq_cap = 1; 1228 + break; 1231 1229 } 1232 1230 chanirq_res = platform_get_resource(pdev, 1233 1231 IORESOURCE_IRQ, ++irqres); 1234 1232 } while (irq_cnt < pdata->channel_num && chanirq_res); 1235 1233 } 1236 1234 1237 - if (irq_cnt < pdata->channel_num) 1238 - goto eirqres; 1239 - 1240 1235 /* Create DMA Channel */ 1241 - for (i = 0; i < pdata->channel_num; i++) { 1236 + for (i = 0; i < irq_cnt; i++) { 1242 1237 err = sh_dmae_chan_probe(shdev, i, chan_irq[i], chan_flag[i]); 1243 1238 if (err) 1244 1239 goto chan_probe_err; 1245 1240 } 1241 + 1242 + if (irq_cap) 1243 + dev_notice(&pdev->dev, "Attempting to register %d DMA " 1244 + "channels when a maximum of %d are supported.\n", 1245 + pdata->channel_num, SH_DMAC_MAX_CHANNELS); 1246 1246 1247 1247 pm_runtime_put(&pdev->dev); 1248 1248 ··· 1263 1243 1264 1244 chan_probe_err: 1265 1245 sh_dmae_chan_remove(shdev); 1266 - eirqres: 1246 + 1267 1247 #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) 1268 1248 free_irq(errirq, shdev); 1269 1249 eirq_err:
+1 -1
drivers/dma/shdma.h
··· 17 17 #include <linux/interrupt.h> 18 18 #include <linux/list.h> 19 19 20 - #define SH_DMAC_MAX_CHANNELS 6 20 + #define SH_DMAC_MAX_CHANNELS 20 21 21 #define SH_DMA_SLAVE_NUMBER 256 22 22 #define SH_DMA_TCR_MAX 0x00FFFFFF /* 16MB */ 23 23