aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-14 10:29:55 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-14 10:29:55 +0200
commitd0b1396b7d93f2c28fc0b7c1e64633f78c43a7af (patch)
treead281be501b8bc22f188fce04fed23e4b4af346d
parent1ad7a225ac4317c7cf0a271343c3effc6defbac9 (diff)
downloadltsi-kernel-d0b1396b7d93f2c28fc0b7c1e64633f78c43a7af.tar.gz
more renesas patches
-rw-r--r--patches.renesas/0695-Documentation-dt-bindings-update-xhci-platform-DT-bi.patch7
-rw-r--r--patches.renesas/0696-mmc-sh-mmcif-update-to-print-version-and-bus-clock-r.patch46
-rw-r--r--patches.renesas/0697-mmc-sh-mmcif-use-devm_-for-ioremap.patch71
-rw-r--r--patches.renesas/0698-mmc-sh-mmcif-use-devm_-for-clock-management.patch73
-rw-r--r--patches.renesas/0699-mmc-sh-mmcif-use-devm_-for-irq-management.patch84
-rw-r--r--patches.renesas/0700-mmc-sh-mmcif-no-need-to-call-pm_runtime_suspend-on-e.patch52
-rw-r--r--patches.renesas/0701-mmc-sh-mmcif-final-error-path-cleanup.patch50
-rw-r--r--patches.renesas/0702-pinctrl-sh-pfc-r8a7791-Add-HSCIF-pin-support.patch299
-rw-r--r--patches.renesas/0703-media-vb2-Check-if-there-are-buffers-before-streamon.patch35
-rw-r--r--patches.renesas/0704-media-vb2-rename-queued_count-to-owned_by_drv_count.patch92
-rw-r--r--patches.renesas/0705-media-vb2-only-call-start_streaming-if-sufficient-bu.patch505
-rw-r--r--patches.renesas/0706-v4l-Add-ARGB-and-XRGB-pixel-formats.patch54
-rw-r--r--patches.renesas/0707-DocBook-media-Document-ALPHA_COMPONENT-control-usage.patch49
-rw-r--r--patches.renesas/0708-v4l-Support-extending-the-v4l2_pix_format-structure.patch728
-rw-r--r--patches.renesas/0709-v4l-Add-premultiplied-alpha-flag-for-pixel-formats.patch139
-rw-r--r--patches.renesas/0710-v4l-vb2-Fix-stream-start-and-buffer-completion-race.patch43
-rw-r--r--patches.renesas/0711-PCI-rcar-Remove-redundant-config-accessor-register-n.patch50
-rw-r--r--patches.renesas/0712-PCI-rcar-Use-correct-initial-HW-settings.patch73
-rw-r--r--patches.renesas/0713-PCI-rcar-Cleanup-style-and-formatting.patch406
-rw-r--r--patches.renesas/0714-PCI-rcar-Remove-rcar_pcie_setup_window-resource-argu.patch49
-rw-r--r--patches.renesas/0715-spi-rspi-Remove-unused-variable-in-rspi_rz_transfer_.patch31
-rw-r--r--patches.renesas/0716-spi-rspi-Pass-spi_master-pointer-to-rspi_release_dma.patch59
-rw-r--r--patches.renesas/0717-sh_eth-remove-checks-around-dev_kfree_skb-calls.patch64
-rw-r--r--patches.renesas/0718-mmc-tmio-mmc-Add-renesas-sdhi-r8a7791-to-binding-doc.patch34
-rw-r--r--patches.renesas/0719-sh-pfc-r8a7791-add-CAN-pin-groups.patch218
-rw-r--r--patches.renesas/0720-sh-pfc-Add-renesas-pfc-r8a7791-to-binding-documentat.patch32
-rw-r--r--patches.renesas/0721-sh-pfc-sh73a0-Introduce-the-use-of-devm_regulator_re.patch53
-rw-r--r--patches.renesas/0722-sh-Switch-to-new-style-CMT-device.patch993
-rw-r--r--patches.renesas/0723-sh-Switch-to-new-style-TMU-device.patch3823
-rw-r--r--patches.renesas/0724-sh-Switch-to-new-style-MTU2-device.patch730
-rw-r--r--patches.renesas/0725-clocksource-sh_cmt-Drop-support-for-legacy-platform-.patch280
-rw-r--r--patches.renesas/0726-clocksource-sh_cmt-Replace-global-spinlock-with-a-pe.patch67
-rw-r--r--patches.renesas/0727-clocksource-shmobile-Remove-unused-sh_timer_config-m.patch35
-rw-r--r--patches.renesas/0728-clocksource-sh_cmt-Add-DT-support.patch203
-rw-r--r--patches.renesas/0729-clocksource-sh_mtu2-Drop-support-for-legacy-platform.patch261
-rw-r--r--patches.renesas/0730-clocksource-sh_mtu2-Replace-global-spinlock-with-a-p.patch69
-rw-r--r--patches.renesas/0731-clocksource-sh_mtu2-Add-DT-support.patch96
-rw-r--r--patches.renesas/0732-clocksource-sh_tmu-Drop-support-for-legacy-platform-.patch181
-rw-r--r--patches.renesas/0733-clocksource-sh_tmu-Replace-global-spinlock-with-a-pe.patch70
-rw-r--r--patches.renesas/0734-clocksource-sh_tmu-Add-DT-support.patch162
-rw-r--r--patches.renesas/0735-gpio-rcar-clamp-returned-value-to-0-1.patch38
-rw-r--r--patches.renesas/0736-usb-renesas_usbhs-fix-usbhs_pipe_malloc-to-re-enable.patch32
-rw-r--r--patches.renesas/0737-usb-renesas_usbhs-gadget-fix-re-enabling-pipe-withou.patch89
-rw-r--r--patches.renesas/0738-usb-renesas_usbhs-add-R-Car-Gen.-2-init-and-power-co.patch291
-rw-r--r--patches.renesas/0739-dmaengine-shdma-Add-more-register-documentation.patch140
-rw-r--r--patches.renesas/0740-dmaengine-shdma-Use-defines-instead-of-hardcoded-num.patch46
-rw-r--r--patches.renesas/0741-dmaengine-sh-Rework-Kconfig-and-Makefile.patch120
-rw-r--r--patches.renesas/0742-serial-sh-sci-Updated-calculation-of-bit-error-rate-.patch41
-rw-r--r--patches.renesas/0743-serial-sh-sci-Fix-range-check-of-bit-rate-for-HSCIF.patch36
-rw-r--r--patches.renesas/0744-serial-sh-sci-Add-calculation-recive-margin-for-HSCI.patch147
-rw-r--r--patches.renesas/0745-sh-pfc-r8a7791-fix-CAN-pin-groups.patch54
-rw-r--r--patches.renesas/0746-spi-sh-msiof-Add-more-register-documentation.patch83
-rw-r--r--patches.renesas/0747-spi-sh-msiof-Extract-sh_msiof_spi_-start-stop-helper.patch95
-rw-r--r--patches.renesas/0748-spi-sh-msiof-Improve-transfer-error-handling.patch71
-rw-r--r--patches.renesas/0749-spi-sh-msiof-Refactor-sh_msiof_transfer_one.patch119
-rw-r--r--patches.renesas/0750-spi-sh-msiof-Add-DMA-support.patch533
-rw-r--r--patches.renesas/0751-spi-sh-msiof-Handle-dmaengine_prep_slave_single-fail.patch83
-rw-r--r--patches.renesas/0752-spi-sh-msiof-Use-correct-device-for-DMA-mapping-with.patch95
-rw-r--r--patches.renesas/0753-spi-sh-msiof-Fix-leaking-of-unused-DMA-descriptors.patch150
-rw-r--r--patches.renesas/0754-spi-sh-msiof-Fix-transmit-only-DMA-transfers.patch39
-rw-r--r--patches.renesas/0755-mmc-tmio-Configure-DMA-slave-bus-width.patch40
-rw-r--r--patches.renesas/0756-mmc-sh_mmcif-Fix-DMA-slave-address-configuration.patch49
-rw-r--r--patches.renesas/0757-mmc-sh_mmcif-Configure-DMA-slave-bus-width.patch39
-rw-r--r--patches.renesas/0758-net-sh_eth-Add-r8a7794-support.patch52
-rw-r--r--patches.renesas/0759-sh-intc-Confine-SH_INTC-to-platforms-that-need-it.patch116
-rw-r--r--patches.renesas/0760-spi-rspi-Handle-dmaengine_prep_slave_sg-failures-gra.patch100
-rw-r--r--patches.renesas/0761-spi-rspi-Fix-leaking-of-unused-DMA-descriptors.patch163
-rw-r--r--patches.renesas/0762-thermal-rcar-Document-SoC-specific-bindings.patch67
-rw-r--r--patches.renesas/0763-drm-rcar-du-fix-warnings.patch33
-rw-r--r--patches.renesas/0764-drm-rcar-du-Fix-maximum-frame-buffer-pitch-computati.patch58
-rw-r--r--patches.renesas/0765-PCI-rcar-Fix-GPL-v2-license-string-typo.patch30
-rw-r--r--patches.renesas/0766-i2c-i2c-rcar-Drop-class-based-scanning-to-improve-bo.patch48
-rw-r--r--patches.renesas/0767-media-of-move-graph-helpers-from-drivers-media-v4l2-.patch598
-rw-r--r--patches.renesas/0768-media-rcar_vin-copy-flags-from-pdata.patch85
-rw-r--r--patches.renesas/0769-media-rcar_vin-add-devicetree-support.patch242
-rw-r--r--patches.renesas/0770-media-v4l-vsp1-Fix-routing-cleanup-when-stopping-the.patch39
-rw-r--r--patches.renesas/0771-media-v4l-vsp1-Release-buffers-at-stream-stop.patch39
-rw-r--r--patches.renesas/0772-media-v4l-vsp1-Fix-pipeline-stop-timeout.patch62
-rw-r--r--patches.renesas/0773-media-v4l-vsp1-Fix-typos.patch92
-rw-r--r--patches.renesas/0774-media-v4l-vsp1-Cleanup-video-nodes-at-removal-time.patch135
-rw-r--r--patches.renesas/0775-media-v4l-vsp1-Propagate-vsp1_device_get-errors-to-t.patch87
-rw-r--r--patches.renesas/0776-media-v4l-vsp1-Setup-control-handler-automatically-a.patch124
-rw-r--r--patches.renesas/0777-media-v4l-vsp1-sru-Fix-the-intensity-control-default.patch53
-rw-r--r--patches.renesas/0778-media-v4l-vsp1-sru-Make-the-intensity-controllable-d.patch195
-rw-r--r--patches.renesas/0779-media-v4l-vsp1-wpf-Simplify-cast-to-pipeline-structu.patch34
-rw-r--r--patches.renesas/0780-media-v4l-vsp1-wpf-Clear-RPF-to-WPF-association-at-s.patch40
-rw-r--r--patches.renesas/0781-media-v4l-vsp1-Switch-to-XRGB-formats.patch84
-rw-r--r--patches.renesas/0782-media-v4l-vsp1-Add-alpha-channel-support-to-the-memo.patch182
-rw-r--r--patches.renesas/0783-media-v4l-vsp1-Add-V4L2_CID_ALPHA_COMPONENT-control-.patch216
-rw-r--r--patches.renesas/0784-media-v4l-vsp1-bru-Support-premultiplied-alpha-at-th.patch204
-rw-r--r--patches.renesas/0785-media-v4l-vsp1-bru-Support-non-premultiplied-colors-.patch52
-rw-r--r--patches.renesas/0786-media-v4l-vsp1-bru-Make-the-background-color-configu.patch127
-rw-r--r--patches.renesas/0787-media-v4l-vsp1-uds-Fix-scaling-of-alpha-layer.patch333
-rw-r--r--patches.renesas/0788-ASoC-rsnd-fixup-rsnd_gen_dma_addr-for-Gen1.patch84
-rw-r--r--patches.renesas/0789-ASoC-rsnd-fixup-loop-exit-timing-of-dma-name-search.patch41
-rw-r--r--patches.renesas/0790-ASoC-rcar-Fix-dma-direction-type.patch54
-rw-r--r--patches.renesas/0791-ASoC-rsnd-SSI-DMA-can-select-BUSIF.patch420
-rw-r--r--patches.renesas/0792-ASoC-rsnd-use-dmaengine_prep_dma_cyclic-instead-of-o.patch172
-rw-r--r--patches.renesas/0793-ASoC-rsnd-enable-DVC-when-capture.patch60
-rw-r--r--patches.renesas/0794-ASoC-rsnd-DMA-cleanup-for-flexible-SSI-SRC-selection.patch264
-rw-r--r--patches.renesas/0795-ASoC-rsnd-DMA-start-address-is-properly-used-for-eac.patch64
-rw-r--r--patches.renesas/0796-ASoC-rsnd-add-DT-support-to-DVC.patch152
-rw-r--r--patches.renesas/0797-ASoC-rsnd-add-missing-src-dst_addr_width-for-DMAEngi.patch32
-rw-r--r--patches.renesas/0798-ASoC-rsnd-fixup-dai-remove-callback-operation.patch85
-rw-r--r--patches.renesas/0799-ASoC-rsnd-use-regmap_mmio-instead-of-original-regmap.patch566
-rw-r--r--patches.renesas/0800-ASoC-rsnd-care-detail-of-SRC_BSDSR.patch71
-rw-r--r--patches.renesas/0801-ASoC-rsnd-care-audio-local-bus-data-format-consisten.patch98
-rw-r--r--patches.renesas/0802-ASoC-rsnd-add-missing-dev_dbg-in-rsnd_bset.patch43
-rw-r--r--patches.renesas/0803-ASoC-rsnd-fixup-pcm_new-callback-method.patch55
-rw-r--r--patches.renesas/0804-ASoC-rsnd-fixup-SND_SOC_DAIFMT_xB_xF-behavior.patch92
-rw-r--r--patches.renesas/0805-ASoC-rsnd-tidyup-DVC-control-method.patch135
-rw-r--r--patches.renesas/0806-ASoC-rsnd-enable-Mute-control-on-DVC.patch100
-rw-r--r--patches.renesas/0807-ARM-shmobile-armadillo800eva-reference-dts-Add-match.patch49
-rw-r--r--patches.renesas/0808-ARM-shmobile-marzen-Remove-early_printk-from-command.patch33
-rw-r--r--patches.renesas/0809-ARM-shmobile-armadillo800eva-defconfig-Enable-REGULA.patch43
-rw-r--r--patches.renesas/0810-ARM-shmobile-marzen-Add-to-shmobile-defconfig.patch59
-rw-r--r--patches.renesas/0811-ARM-shmobile-Enable-PM_RUNTIME-in-defconfig.patch28
-rw-r--r--patches.renesas/0812-ARM-shmobile-Enable-CPUFREQ-configuration.patch40
-rw-r--r--patches.renesas/0813-ARM-shmobile-add-cpufreq-cpu0-driver-for-common-SH-M.patch98
-rw-r--r--patches.renesas/0814-ARM-shmobile-Fix-device-node-reference-leakage-in-sh.patch87
-rw-r--r--patches.renesas/0815-ARM-shmobile-Move-intc.h-cleanup-sh_intc.h-usage.patch105
-rw-r--r--patches.renesas/0816-ARM-shmobile-Move-dma-register.h.patch123
-rw-r--r--patches.renesas/0817-ARM-shmobile-Move-clock.h.patch229
-rw-r--r--patches.renesas/0818-ARM-shmobile-Move-most-of-irqs.h-keep-some-for-pinct.patch511
-rw-r--r--patches.renesas/0819-ARM-shmobile-Move-common.h.patch868
-rw-r--r--patches.renesas/0820-ARM-shmobile-Move-pm-rmobile.h-cleanup-sh73xx.h.patch169
-rw-r--r--patches.renesas/0821-ARM-shmobile-Move-pm-rcar.h-cleanup-r8a7779-case.patch162
-rw-r--r--patches.renesas/0822-ARM-shmobile-Move-rcar-gen2.h-cleanup-r8a7790-case.patch200
-rw-r--r--patches.renesas/0823-ARM-shmobile-Update-EMEV2-DTS-to-include-CPU-frequen.patch40
-rw-r--r--patches.renesas/0824-ARM-shmobile-Use-shmobile_init_delay-on-EMEV2.patch45
-rw-r--r--patches.renesas/0825-ARM-shmobile-r8a7779-Add-clocks.patch180
-rw-r--r--patches.renesas/0826-ARM-shmobile-Sync-Marzen-DTS-with-Marzen-reference-D.patch134
-rw-r--r--patches.renesas/0827-ARM-shmobile-marzen-Specify-external-clock-frequency.patch36
-rw-r--r--patches.renesas/0828-ARM-shmobile-r8a7779-Reference-clocks.patch120
-rw-r--r--patches.renesas/0829-ARM-shmobile-r8a7791-SYSC-setup-code.patch115
-rw-r--r--patches.renesas/0830-ARM-shmobile-APMU-Add-Core-Standby-state-for-Suspend.patch142
-rw-r--r--patches.renesas/0831-ARM-shmobile-r8a7790-Support-Core-Standby-for-Suspen.patch31
-rw-r--r--patches.renesas/0832-ARM-shmobile-r8a7791-Support-Core-Standby-for-Suspen.patch30
-rw-r--r--patches.renesas/0833-ARM-shmobile-Mark-all-SoCs-in-shmobile-as-CPUFreq-ca.patch35
-rw-r--r--patches.renesas/0834-ARM-shmobile-Use-shmobile_init_late-on-r8a7790-DT-on.patch32
-rw-r--r--patches.renesas/0835-ARM-shmobile-Use-shmobile_init_late-on-r8a7791-DT-on.patch32
-rw-r--r--patches.renesas/0836-ARM-shmobile-Add-shared-R-Car-Gen2-CMA-reservation-c.patch80
-rw-r--r--patches.renesas/0837-ARM-shmobile-rcar-gen2-Update-for-of_get_flat_dt_pro.patch128
-rw-r--r--patches.renesas/0838-ARM-shmobile-rcar-gen2-Use-1ULL-instead-of-u64-1.patch32
-rw-r--r--patches.renesas/0839-ARM-shmobile-rcar-gen2-Remove-useless-copied-section.patch40
-rw-r--r--patches.renesas/0840-ARM-shmobile-rcar-gen2-correct-return-value-of-shmob.patch38
-rw-r--r--patches.renesas/0841-ARM-shmobile-koelsch-reference-Remove-workarounds-fo.patch58
-rw-r--r--patches.renesas/0842-ARM-shmobile-lager-reference-Remove-workarounds-for-.patch55
-rw-r--r--patches.renesas/0843-ARM-shmobile-armadillo800eva-legacy-Add-LED-support.patch71
-rw-r--r--patches.renesas/0844-ARM-shmobile-armadillo800eva-reference-Spelling-s-ED.patch38
-rw-r--r--patches.renesas/0845-ARM-shmobile-Enable-R-Car-Gen2-CMA-code-in-board-fil.patch67
-rw-r--r--patches.renesas/0846-ARM-shmobile-Get-rid-of-redundant-EMEV2-mach-callbac.patch60
-rw-r--r--patches.renesas/0847-ARM-shmobile-Update-r7s72100-DTS-to-include-CPU-freq.patch34
-rw-r--r--patches.renesas/0848-ARM-shmobile-Use-shmobile_init_delay-on-Genmai-board.patch47
-rw-r--r--patches.renesas/0849-ARM-shmobile-Use-shmobile_init_delay-on-r7s72100.patch58
-rw-r--r--patches.renesas/0850-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-in-common-.patch34
-rw-r--r--patches.renesas/0851-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-for-Lager.patch47
-rw-r--r--patches.renesas/0852-ARM-shmobile-Remove-unused-r8a7790_init_early.patch50
-rw-r--r--patches.renesas/0853-ARM-shmobile-r8a7779-Add-helper-to-read-mode-pins.patch100
-rw-r--r--patches.renesas/0854-ARM-shmobile-r8a7779-Move-r8a7779_earlytimer_init-to.patch77
-rw-r--r--patches.renesas/0855-ARM-shmobile-marzen-reference-Move-clock-and-OF-devi.patch61
-rw-r--r--patches.renesas/0856-ARM-shmobile-r8a7779-Initial-multiplatform-support.patch113
-rw-r--r--patches.renesas/0857-ARM-shmobile-marzen-reference-Initialize-CPG-device.patch65
-rw-r--r--patches.renesas/0858-ARM-shmobile-marzen-reference-Instantiate-clkdevs-fo.patch69
-rw-r--r--patches.renesas/0859-ARM-shmobile-Remove-non-multiplatform-Marzen-referen.patch92
-rw-r--r--patches.renesas/0860-ARM-shmobile-Let-Marzen-multiplatform-boot-with-Marz.patch47
-rw-r--r--patches.renesas/0861-ARM-shmobile-Remove-Marzen-reference-DTS.patch150
-rw-r--r--patches.renesas/0862-ARM-shmobile-marzen-reference-Remove-legacy-clock-su.patch57
-rw-r--r--patches.renesas/0863-ARM-shmobile-r8a7779-Add-Maximum-CPU-Frequency-to-DT.patch50
-rw-r--r--patches.renesas/0864-ARM-shmobile-r8a7779-Use-DT-CPU-Frequency-in-common-.patch35
-rw-r--r--patches.renesas/0865-ARM-shmobile-marzen-reference-Use-DT-CPU-Frequency.patch34
-rw-r--r--patches.renesas/0866-ARM-shmobile-r8a7779-Remove-unused-r8a7779_init_dela.patch49
-rw-r--r--patches.renesas/0867-ARM-shmobile-r8a7779-dtsi-Update-unit-addresses-for-.patch62
-rw-r--r--patches.renesas/0868-ARM-shmobile-r8a7779-dtsi-Correct-address-cells-size.patch75
-rw-r--r--patches.renesas/0869-ARM-shmobile-r8a7779-Add-scif-nodes-to-dtsi.patch86
-rw-r--r--patches.renesas/0870-ARM-shmobile-marzen-Initialise-SCIF-devices-using-DT.patch92
-rw-r--r--patches.renesas/0871-ARM-shmobile-marzen-Do-not-use-workaround-for-scif-d.patch35
-rw-r--r--patches.renesas/0872-ARM-shmobile-r8a7790-add-USB3.0-clocks-to-device-tre.patch42
-rw-r--r--patches.renesas/0873-ARM-shmobile-r8a7791-add-USB3.0-clocks-to-device-tre.patch40
-rw-r--r--patches.renesas/0874-ARM-shmobile-r8a7791-dtsi-add-SYS-DMAC-clocks.patch47
-rw-r--r--patches.renesas/0875-ARM-shmobile-lager-Add-VDD-MPU-regulator-for-DVFS.patch66
-rw-r--r--patches.renesas/0876-ARM-shmobile-r8a7790-lager-dts-Add-DVFS-parameters-i.patch75
-rw-r--r--patches.renesas/0877-ARM-shmobile-koelsch-dts-Add-VDD-MPU-regulator-for-D.patch63
-rw-r--r--patches.renesas/0878-ARM-shmobile-r8a7791-koelsch-dts-Add-DVFS-parameters.patch72
-rw-r--r--patches.renesas/0879-ARM-shmobile-lager-enable-i2c-devices.patch46
-rw-r--r--patches.renesas/0880-ARM-shmobile-lager-add-i2c1-i2c2-pins.patch58
-rw-r--r--patches.renesas/0881-ARM-shmobile-lager-Move-i2c-12-_pins-nodes-to-pfc-no.patch61
-rw-r--r--patches.renesas/0882-ARM-shmobile-Lager-memory-map-update.patch52
-rw-r--r--patches.renesas/0883-ARM-shmobile-lager-Remove-duplicate-i2c3-nodes.patch70
-rw-r--r--patches.renesas/0884-ARM-shmobile-koelsch-Remove-duplicate-i2c6-nodes.patch78
-rw-r--r--patches.renesas/0885-ARM-shmobile-henninger-add-I2C2-DT-support.patch51
-rw-r--r--patches.renesas/0886-ARM-shmobile-r8a7790-add-MSTP10-support-on-DTSI.patch97
-rw-r--r--patches.renesas/0887-ARM-shmobile-r8a7790-add-R-Car-sound-support-on-DTSI.patch83
-rw-r--r--patches.renesas/0888-ARM-shmobile-r8a7791-add-audio-clock-on-DTSI.patch52
-rw-r--r--patches.renesas/0889-ARM-shmobile-r8a7791-add-MSTP10-support-on-DTSI.patch99
-rw-r--r--patches.renesas/0890-ARM-shmobile-r8a7790-Add-PCIEC-clock-device-tree-nod.patch57
-rw-r--r--patches.renesas/0891-ARM-shmobile-r8a7790-Add-default-PCIe-bus-clock.patch39
-rw-r--r--patches.renesas/0892-ARM-shmobile-r8a7790-Add-PCIe-Controller-device-node.patch54
-rw-r--r--patches.renesas/0893-ARM-shmobile-r8a7791-Add-PCIEC-clock-device-tree-nod.patch56
-rw-r--r--patches.renesas/0894-ARM-shmobile-r8a7791-Add-default-PCIe-bus-clock.patch41
-rw-r--r--patches.renesas/0895-ARM-shmobile-r8a7791-Add-PCIe-Controller-device-node.patch50
-rw-r--r--patches.renesas/0896-ARM-shmobile-koelsch-Enable-PCIe-Controller-PCIe-bus.patch35
-rw-r--r--patches.renesas/0897-ARM-shmobile-henninger-Enable-PCIe-Controller-PCIe-b.patch32
-rw-r--r--patches.renesas/0898-ARM-shmobile-r8a7791-add-R-Car-sound-support-on-DTSI.patch83
-rw-r--r--patches.renesas/0899-ARM-shmobile-Enable-genmai-board-in-multiplatform-de.patch31
-rw-r--r--patches.renesas/0900-ARM-shmobile-Move-r7s72100.h.patch99
-rw-r--r--patches.renesas/0901-ARM-shmobile-Move-r8a73a4.h.patch83
-rw-r--r--patches.renesas/0902-ARM-shmobile-Move-r8a7740.h.patch110
-rw-r--r--patches.renesas/0903-ARM-shmobile-Move-r8a7778.h.patch84
-rw-r--r--patches.renesas/0904-ARM-shmobile-Move-r8a7790.h.patch160
-rw-r--r--patches.renesas/0905-ARM-shmobile-Move-sh73a0.h.patch130
-rw-r--r--patches.renesas/0906-ARM-shmobile-Move-sh7372.h.patch99
-rw-r--r--patches.renesas/0907-ARM-shmobile-Move-r8a7779.h.patch148
-rw-r--r--patches.renesas/0908-ARM-shmobile-Move-r8a7791.h.patch121
-rw-r--r--patches.renesas/0909-ARM-shmobile-Allow-use-of-boot-code-for-non-SMP-case.patch105
-rw-r--r--patches.renesas/0910-ARM-shmobile-Adjust-APMU-code-to-build-for-non-SMP.patch80
-rw-r--r--patches.renesas/0911-ARM-shmobile-Use-__init-for-APMU-suspend-init-functi.patch33
-rw-r--r--patches.renesas/0912-ARM-shmobile-Move-r8a7790-reset-code-to-pm-r8a7790.c.patch141
-rw-r--r--patches.renesas/0913-ARM-shmobile-Allow-r8a7790-to-build-non-SMP-APMU-cod.patch73
-rw-r--r--patches.renesas/0914-ARM-shmobile-Move-r8a7791-reset-code-to-pm-r8a7791.c.patch117
-rw-r--r--patches.renesas/0915-ARM-shmobile-Allow-r8a7791-to-build-non-SMP-APMU-cod.patch74
-rw-r--r--patches.renesas/0916-ARM-shmobile-r8a7790-add-internal-PCI-bridge-nodes.patch95
-rw-r--r--patches.renesas/0917-ARM-shmobile-lager-enable-internal-PCI.patch72
-rw-r--r--patches.renesas/0918-ARM-shmobile-r8a7790-add-DVC-support-for-sound-node-.patch44
-rw-r--r--patches.renesas/0919-ARM-shmobile-r8a7791-add-DVC-support-for-sound-node-.patch44
-rw-r--r--patches.renesas/0920-ASoC-fsi-use-SNDRV_DMA_TYPE_DEV-for-sound-buffer.patch202
-rw-r--r--patches.renesas/0921-ARM-shmobile-r8a7790-Fix-whitespace-errors-in-pci-no.patch58
-rw-r--r--patches.renesas/0922-ARM-shmobile-genmai-reference-dts-Add-RSPI-node.patch39
-rw-r--r--patches.renesas/0923-ARM-shmobile-fix-shmobile_smp_apmu_suspend_init-buil.patch34
-rw-r--r--patches.renesas/0924-ARM-shmobile-r8a7791-add-internal-PCI-bridge-nodes.patch72
-rw-r--r--patches.renesas/0925-ARM-shmobile-koelsch-enable-internal-PCI.patch62
-rw-r--r--patches.renesas/0926-ARM-shmobile-henninger-enable-internal-PCI.patch62
-rw-r--r--patches.renesas/0927-ARM-shmobile-henninger-Consistently-use-tabs-for-ind.patch30
-rw-r--r--patches.renesas/0928-ARM-shmobile-r8a7779-Consistently-use-tabs-for-inden.patch42
-rw-r--r--patches.renesas/0929-ARM-shmobile-armadillo800eva-reference-Remove-early_.patch32
-rw-r--r--patches.renesas/0930-ARM-shmobile-kzm9g-reference-Remove-early_printk-fro.patch31
-rw-r--r--patches.renesas/0931-ARM-shmobile-marzen-Consistently-use-tabs-for-indent.patch45
-rw-r--r--patches.renesas/0932-ARM-shmobile-Enable-R-Car-Gen-2-PCIe-in-shmobile_def.patch32
-rw-r--r--patches.renesas/0933-ARM-shmobile-Remove-opps-table-check-for-cpufreq.patch51
-rw-r--r--patches.renesas/0934-ARM-shmobile-Lager-Correct-I2C-bus-for-VDD-MPU-regul.patch48
-rw-r--r--patches.renesas/0935-ARM-shmobile-r8a7790-lager-use-iic-cores-instead-of-.patch74
-rw-r--r--patches.renesas/0936-ARM-shmobile-r8a7778-add-SCI-clock-support-for-DT.patch41
-rw-r--r--patches.renesas/0937-ARM-shmobile-r8a73a4-add-SCI-clock-support-for-DT.patch40
-rw-r--r--patches.renesas/0938-ARM-shmobile-r8a7740-correct-SCI-clock-support-for-D.patch62
-rw-r--r--patches.renesas/0939-ARM-shmobile-sh73a0-add-SCI-clock-support-for-DT.patch48
-rw-r--r--patches.renesas/0940-ARM-shmobile-r8a7778-Add-SCIF-nodes.patch73
-rw-r--r--patches.renesas/0941-ARM-shmobile-bockw-reference-Initialise-SCIF-device-.patch86
-rw-r--r--patches.renesas/0942-ARM-shmobile-r8a73a4-Add-SCIF-nodes.patch72
-rw-r--r--patches.renesas/0943-ARM-shmobile-ape6evm-reference-Initialise-SCIF-devic.patch88
-rw-r--r--patches.renesas/0944-ARM-shmobile-r8a7740-Add-SCIF-nodes.patch93
-rw-r--r--patches.renesas/0945-ARM-shmobile-armadillo800eva-reference-Initialise-SC.patch85
-rw-r--r--patches.renesas/0946-ARM-shmobile-sh73a0-Add-SCIF-nodes.patch102
-rw-r--r--patches.renesas/0947-ARM-shmobile-kzm9g-reference-Initialise-SCIF-device-.patch84
-rw-r--r--patches.renesas/0948-ARM-shmobile-r8a7778-add-TMU-clock-support-for-DT.patch33
-rw-r--r--patches.renesas/0949-ARM-shmobile-r8a7740-add-TMU-clock-support-for-DT.patch32
-rw-r--r--patches.renesas/0950-ARM-shmobile-r8a73a4-add-CMT1-clock-support-for-DT.patch30
-rw-r--r--patches.renesas/0951-ARM-shmobile-r8a7740-add-CMT1-clock-support-for-DT.patch30
-rw-r--r--patches.renesas/0952-ARM-shmobile-sh73a0-add-CMT1-clock-support-for-DT.patch30
-rw-r--r--patches.renesas/0953-ARM-shmobile-genmai-remove-defconfig.patch149
-rw-r--r--patches.renesas/0954-ARM-shmobile-sh73a0-Remove-spurious-0x-from-SCIFB-cl.patch36
-rw-r--r--patches.renesas/0955-ARM-shmobile-defconfig-Remove-MACH_GENMAI.patch33
-rw-r--r--patches.renesas/0956-ARM-shmobile-r8a7790-add-missing-0x0100-for-SDCKCR.patch41
-rw-r--r--patches.renesas/0957-ARM-shmobile-r8a7791-add-missing-0x0100-for-SDCKCR.patch39
-rw-r--r--patches.renesas/0958-ARM-shmobile-koelsch-Remove-non-existent-i2c6-pinmux.patch53
-rw-r--r--patches.renesas/0960-xhci-Platform-Add-en-dis-able_usb3_lpm_timeout.patch35
-rw-r--r--patches.renesas/0961-xhci-Platform-Set-xhci-lpm-support-quirk-based-on-pl.patch102
-rw-r--r--patches.renesas/0962-usb-host-xhci-plat-use-devm_functions.patch83
-rw-r--r--patches.renesas/0963-usb-host-xhci-plat-add-support-for-the-R-Car-H2-and-.patch298
-rw-r--r--patches.renesas/0964-ASoC-ak4642-Make-of_device_id-array-const.patch40
-rw-r--r--patches.renesas/0965-i2c-rcar-fix-MNR-interrupt-handling.patch65
-rw-r--r--patches.renesas/0966-Revert-i2c-rcar-remove-spinlock.patch112
-rw-r--r--patches.renesas/0967-ASoC-rcar-Use-instead-of-for-boolean-expressions.patch37
-rw-r--r--patches.renesas/0968-net-sh_eth-fix-driver-dependencies.patch37
-rw-r--r--patches.renesas/0969-usb-renesas_usbhs-fix-the-behavior-of-some-usbhs_pkt.patch185
-rw-r--r--patches.renesas/0970-usb-renesas_usbhs-protect-mod-irq_-bemp-brdy-sts-by-.patch48
-rw-r--r--patches.renesas/0971-usb-renesas_usbhs-fix-the-condition-of-is_done-in-us.patch61
-rw-r--r--patches.renesas/0972-usb-renesas_usbhs-fix-the-usb_pkt_pop.patch80
-rw-r--r--patches.renesas/0973-i2c-rcar-fix-RCAR_IRQ_ACK_-RECV-SEND.patch31
-rw-r--r--series277
279 files changed, 32462 insertions, 1 deletions
diff --git a/patches.renesas/0695-Documentation-dt-bindings-update-xhci-platform-DT-bi.patch b/patches.renesas/0695-Documentation-dt-bindings-update-xhci-platform-DT-bi.patch
index 51b0831ea9553a..a8cab63ab31686 100644
--- a/patches.renesas/0695-Documentation-dt-bindings-update-xhci-platform-DT-bi.patch
+++ b/patches.renesas/0695-Documentation-dt-bindings-update-xhci-platform-DT-bi.patch
@@ -15,9 +15,11 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c7c1ce8061c0dc5b848e5df0ba459dbbf78057d7)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
- Documentation/devicetree/bindings/usb/usb-xhci.txt | 3 ++-
+ Documentation/devicetree/bindings/usb/usb-xhci.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
+diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
+index 999be5ca901c..5a79377c6a96 100644
--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
@@ -2,7 +2,8 @@ USB xHCI controllers
@@ -30,3 +32,6 @@ Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
"xhci-platform").
- reg: should contain address and length of the standard XHCI
register set for the device.
+--
+2.1.2
+
diff --git a/patches.renesas/0696-mmc-sh-mmcif-update-to-print-version-and-bus-clock-r.patch b/patches.renesas/0696-mmc-sh-mmcif-update-to-print-version-and-bus-clock-r.patch
new file mode 100644
index 00000000000000..8d323c81873eb0
--- /dev/null
+++ b/patches.renesas/0696-mmc-sh-mmcif-update-to-print-version-and-bus-clock-r.patch
@@ -0,0 +1,46 @@
+From db71dc69e3a61256a46c16e519f12525af1bbfc3 Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Wed, 4 Jun 2014 12:42:08 +0100
+Subject: mmc: sh-mmcif: update to print version and bus clock rate on probe
+
+Change the initial print to show chip version and the bus rate it is
+working at instead of the driver version. This is more useful information
+as we already know which driver version from the kernel it is in.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit ba09ab6ba9d2ec27cd68e8cf655ac163cd4d5f6a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/mmc/host/sh_mmcif.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
+index 656fbba4c422..dc9a28a29c18 100644
+--- a/drivers/mmc/host/sh_mmcif.c
++++ b/drivers/mmc/host/sh_mmcif.c
+@@ -1469,16 +1469,17 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+
+ mutex_init(&host->thread_lock);
+
+- clk_disable_unprepare(host->hclk);
+ ret = mmc_add_host(mmc);
+ if (ret < 0)
+ goto emmcaddh;
+
+ dev_pm_qos_expose_latency_limit(&pdev->dev, 100);
+
+- dev_info(&pdev->dev, "driver version %s\n", DRIVER_VERSION);
+- dev_dbg(&pdev->dev, "chip ver H'%04x\n",
+- sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff);
++ dev_info(&pdev->dev, "Chip version 0x%04x, clock rate %luMHz\n",
++ sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0xffff,
++ clk_get_rate(host->hclk) / 1000000UL);
++
++ clk_disable_unprepare(host->hclk);
+ return ret;
+
+ emmcaddh:
+--
+2.1.2
+
diff --git a/patches.renesas/0697-mmc-sh-mmcif-use-devm_-for-ioremap.patch b/patches.renesas/0697-mmc-sh-mmcif-use-devm_-for-ioremap.patch
new file mode 100644
index 00000000000000..63bee1fa12c321
--- /dev/null
+++ b/patches.renesas/0697-mmc-sh-mmcif-use-devm_-for-ioremap.patch
@@ -0,0 +1,71 @@
+From 0e550111e1308a62addba2f2708594f41ce3402c Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Wed, 4 Jun 2014 12:42:09 +0100
+Subject: mmc: sh-mmcif: use devm_ for ioremap
+
+Start tidying the probe/release code by using devm_ioremap_resource() to
+map the IO registers.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit 402de61c9ef9aff9990f6629cc7527827db331e0)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/mmc/host/sh_mmcif.c | 24 ++++++------------------
+ 1 file changed, 6 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
+index dc9a28a29c18..e25821fe4e9e 100644
+--- a/drivers/mmc/host/sh_mmcif.c
++++ b/drivers/mmc/host/sh_mmcif.c
+@@ -1378,22 +1378,15 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+ dev_err(&pdev->dev, "Get irq error\n");
+ return -ENXIO;
+ }
++
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- if (!res) {
+- dev_err(&pdev->dev, "platform_get_resource error.\n");
+- return -ENXIO;
+- }
+- reg = ioremap(res->start, resource_size(res));
+- if (!reg) {
+- dev_err(&pdev->dev, "ioremap error.\n");
+- return -ENOMEM;
+- }
++ reg = devm_ioremap_resource(&pdev->dev, res);
++ if (IS_ERR(reg))
++ return PTR_ERR(reg);
+
+ mmc = mmc_alloc_host(sizeof(struct sh_mmcif_host), &pdev->dev);
+- if (!mmc) {
+- ret = -ENOMEM;
+- goto ealloch;
+- }
++ if (!mmc)
++ return -ENOMEM;
+
+ ret = mmc_of_parse(mmc);
+ if (ret < 0)
+@@ -1498,8 +1491,6 @@ eclkget:
+ pm_runtime_disable(&pdev->dev);
+ eofparse:
+ mmc_free_host(mmc);
+-ealloch:
+- iounmap(reg);
+ return ret;
+ }
+
+@@ -1524,9 +1515,6 @@ static int sh_mmcif_remove(struct platform_device *pdev)
+ */
+ cancel_delayed_work_sync(&host->timeout_work);
+
+- if (host->addr)
+- iounmap(host->addr);
+-
+ irq[0] = platform_get_irq(pdev, 0);
+ irq[1] = platform_get_irq(pdev, 1);
+
+--
+2.1.2
+
diff --git a/patches.renesas/0698-mmc-sh-mmcif-use-devm_-for-clock-management.patch b/patches.renesas/0698-mmc-sh-mmcif-use-devm_-for-clock-management.patch
new file mode 100644
index 00000000000000..73cb2f3ff09465
--- /dev/null
+++ b/patches.renesas/0698-mmc-sh-mmcif-use-devm_-for-clock-management.patch
@@ -0,0 +1,73 @@
+From fa4cb2f5a0cea83433a1eca0b4a71c590ca31655 Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Wed, 4 Jun 2014 12:42:10 +0100
+Subject: mmc: sh-mmcif: use devm_ for clock management
+
+Use the devm_clk_get() code to get the clock and allow it to be freed
+automatically on release.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit 5337a334e4f4f1e9384054e34e08ffab9be93c81)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/mmc/host/sh_mmcif.c | 18 ++++++++----------
+ 1 file changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
+index e25821fe4e9e..ec9bda30da73 100644
+--- a/drivers/mmc/host/sh_mmcif.c
++++ b/drivers/mmc/host/sh_mmcif.c
+@@ -1390,7 +1390,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+
+ ret = mmc_of_parse(mmc);
+ if (ret < 0)
+- goto eofparse;
++ goto err_host;
+
+ host = mmc_priv(mmc);
+ host->mmc = mmc;
+@@ -1420,19 +1420,19 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+ pm_runtime_enable(&pdev->dev);
+ host->power = false;
+
+- host->hclk = clk_get(&pdev->dev, NULL);
++ host->hclk = devm_clk_get(&pdev->dev, NULL);
+ if (IS_ERR(host->hclk)) {
+ ret = PTR_ERR(host->hclk);
+ dev_err(&pdev->dev, "cannot get clock: %d\n", ret);
+- goto eclkget;
++ goto err_pm;
+ }
+ ret = sh_mmcif_clk_update(host);
+ if (ret < 0)
+- goto eclkupdate;
++ goto err_pm;
+
+ ret = pm_runtime_resume(&pdev->dev);
+ if (ret < 0)
+- goto eresume;
++ goto err_clk;
+
+ INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work);
+
+@@ -1483,13 +1483,11 @@ ereqirq1:
+ free_irq(irq[0], host);
+ ereqirq0:
+ pm_runtime_suspend(&pdev->dev);
+-eresume:
++err_clk:
+ clk_disable_unprepare(host->hclk);
+-eclkupdate:
+- clk_put(host->hclk);
+-eclkget:
++err_pm:
+ pm_runtime_disable(&pdev->dev);
+-eofparse:
++err_host:
+ mmc_free_host(mmc);
+ return ret;
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0699-mmc-sh-mmcif-use-devm_-for-irq-management.patch b/patches.renesas/0699-mmc-sh-mmcif-use-devm_-for-irq-management.patch
new file mode 100644
index 00000000000000..4a9a7d78b5ac32
--- /dev/null
+++ b/patches.renesas/0699-mmc-sh-mmcif-use-devm_-for-irq-management.patch
@@ -0,0 +1,84 @@
+From 188fe79de024289c8b6c6a6a92302c313d0eed14 Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Wed, 4 Jun 2014 12:42:11 +0100
+Subject: mmc: sh-mmcif: use devm_ for irq management
+
+Use devm_request_threaded_irq() for the host interrupt handlers so we
+do not have to worry about freeing them on exit or error. Tidies up the
+exit path code for the driver.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit 75bed8a19d15f94bf712bf610ad4e3425c035ebc)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/mmc/host/sh_mmcif.c | 26 ++++++++------------------
+ 1 file changed, 8 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
+index ec9bda30da73..a0776cec070c 100644
+--- a/drivers/mmc/host/sh_mmcif.c
++++ b/drivers/mmc/host/sh_mmcif.c
+@@ -1440,17 +1440,19 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+ sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);
+
+ name = irq[1] < 0 ? dev_name(&pdev->dev) : "sh_mmc:error";
+- ret = request_threaded_irq(irq[0], sh_mmcif_intr, sh_mmcif_irqt, 0, name, host);
++ ret = devm_request_threaded_irq(&pdev->dev, irq[0], sh_mmcif_intr,
++ sh_mmcif_irqt, 0, name, host);
+ if (ret) {
+ dev_err(&pdev->dev, "request_irq error (%s)\n", name);
+- goto ereqirq0;
++ goto err_irq;
+ }
+ if (irq[1] >= 0) {
+- ret = request_threaded_irq(irq[1], sh_mmcif_intr, sh_mmcif_irqt,
+- 0, "sh_mmc:int", host);
++ ret = devm_request_threaded_irq(&pdev->dev, irq[1],
++ sh_mmcif_intr, sh_mmcif_irqt,
++ 0, "sh_mmc:int", host);
+ if (ret) {
+ dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n");
+- goto ereqirq1;
++ goto err_irq;
+ }
+ }
+
+@@ -1477,11 +1479,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+
+ emmcaddh:
+ erqcd:
+- if (irq[1] >= 0)
+- free_irq(irq[1], host);
+-ereqirq1:
+- free_irq(irq[0], host);
+-ereqirq0:
++err_irq:
+ pm_runtime_suspend(&pdev->dev);
+ err_clk:
+ clk_disable_unprepare(host->hclk);
+@@ -1495,7 +1493,6 @@ err_host:
+ static int sh_mmcif_remove(struct platform_device *pdev)
+ {
+ struct sh_mmcif_host *host = platform_get_drvdata(pdev);
+- int irq[2];
+
+ host->dying = true;
+ clk_prepare_enable(host->hclk);
+@@ -1513,13 +1510,6 @@ static int sh_mmcif_remove(struct platform_device *pdev)
+ */
+ cancel_delayed_work_sync(&host->timeout_work);
+
+- irq[0] = platform_get_irq(pdev, 0);
+- irq[1] = platform_get_irq(pdev, 1);
+-
+- free_irq(irq[0], host);
+- if (irq[1] >= 0)
+- free_irq(irq[1], host);
+-
+ clk_disable_unprepare(host->hclk);
+ mmc_free_host(host->mmc);
+ pm_runtime_put_sync(&pdev->dev);
+--
+2.1.2
+
diff --git a/patches.renesas/0700-mmc-sh-mmcif-no-need-to-call-pm_runtime_suspend-on-e.patch b/patches.renesas/0700-mmc-sh-mmcif-no-need-to-call-pm_runtime_suspend-on-e.patch
new file mode 100644
index 00000000000000..7c226a6e94075c
--- /dev/null
+++ b/patches.renesas/0700-mmc-sh-mmcif-no-need-to-call-pm_runtime_suspend-on-e.patch
@@ -0,0 +1,52 @@
+From a245390905a40530c320d08a968617a53237a8fe Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Wed, 4 Jun 2014 12:42:12 +0100
+Subject: mmc: sh-mmcif: no need to call pm_runtime_suspend on error
+
+The pm_runtime call should implicitly disable the device once the
+probe is over if there is no explicit reference gained. There is no
+need to call pm_runtime_suspend() before the pm_runtime_disable()
+call.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit 17ec61c8e8dd656647b50b1db1e223c02fb051a6)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/mmc/host/sh_mmcif.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
+index a0776cec070c..80e200e59dda 100644
+--- a/drivers/mmc/host/sh_mmcif.c
++++ b/drivers/mmc/host/sh_mmcif.c
+@@ -1444,7 +1444,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+ sh_mmcif_irqt, 0, name, host);
+ if (ret) {
+ dev_err(&pdev->dev, "request_irq error (%s)\n", name);
+- goto err_irq;
++ goto err_clk;
+ }
+ if (irq[1] >= 0) {
+ ret = devm_request_threaded_irq(&pdev->dev, irq[1],
+@@ -1452,7 +1452,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+ 0, "sh_mmc:int", host);
+ if (ret) {
+ dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n");
+- goto err_irq;
++ goto err_clk;
+ }
+ }
+
+@@ -1479,8 +1479,6 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+
+ emmcaddh:
+ erqcd:
+-err_irq:
+- pm_runtime_suspend(&pdev->dev);
+ err_clk:
+ clk_disable_unprepare(host->hclk);
+ err_pm:
+--
+2.1.2
+
diff --git a/patches.renesas/0701-mmc-sh-mmcif-final-error-path-cleanup.patch b/patches.renesas/0701-mmc-sh-mmcif-final-error-path-cleanup.patch
new file mode 100644
index 00000000000000..a3bc5846185046
--- /dev/null
+++ b/patches.renesas/0701-mmc-sh-mmcif-final-error-path-cleanup.patch
@@ -0,0 +1,50 @@
+From 1732e449b1f6de14bb80ff14647cb6ba212e5ea8 Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Wed, 4 Jun 2014 12:42:13 +0100
+Subject: mmc: sh-mmcif: final error path cleanup
+
+Remove the error path items that are no longer needed. The mmc card-detect
+code cleans up after itself (and registers with devm) and the host error
+is the same as the clock disable.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit 39792eaab1561e145b07cc36025c23b175b26a1e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/mmc/host/sh_mmcif.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
+index 80e200e59dda..0289b4ecccb3 100644
+--- a/drivers/mmc/host/sh_mmcif.c
++++ b/drivers/mmc/host/sh_mmcif.c
+@@ -1459,14 +1459,14 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+ if (pd && pd->use_cd_gpio) {
+ ret = mmc_gpio_request_cd(mmc, pd->cd_gpio, 0);
+ if (ret < 0)
+- goto erqcd;
++ goto err_clk;
+ }
+
+ mutex_init(&host->thread_lock);
+
+ ret = mmc_add_host(mmc);
+ if (ret < 0)
+- goto emmcaddh;
++ goto err_clk;
+
+ dev_pm_qos_expose_latency_limit(&pdev->dev, 100);
+
+@@ -1477,8 +1477,6 @@ static int sh_mmcif_probe(struct platform_device *pdev)
+ clk_disable_unprepare(host->hclk);
+ return ret;
+
+-emmcaddh:
+-erqcd:
+ err_clk:
+ clk_disable_unprepare(host->hclk);
+ err_pm:
+--
+2.1.2
+
diff --git a/patches.renesas/0702-pinctrl-sh-pfc-r8a7791-Add-HSCIF-pin-support.patch b/patches.renesas/0702-pinctrl-sh-pfc-r8a7791-Add-HSCIF-pin-support.patch
new file mode 100644
index 00000000000000..1608badc8f1e79
--- /dev/null
+++ b/patches.renesas/0702-pinctrl-sh-pfc-r8a7791-Add-HSCIF-pin-support.patch
@@ -0,0 +1,299 @@
+From f51077a76ad2f36b6a81a84ea809a5f806b49a8d Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Tue, 10 Jun 2014 11:37:15 +0900
+Subject: pinctrl: sh-pfc: r8a7791: Add HSCIF pin support
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+(cherry picked from commit 92b14d56d3edf68eff258bc69a62e295dbfb4780)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 250 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 250 insertions(+)
+
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+index 2e688dc4a3c8..394b234488cc 100644
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+@@ -1867,6 +1867,192 @@ static const unsigned int eth_rmii_mux[] = {
+ ETH_RXD0_MARK, ETH_RXD1_MARK, ETH_RX_ER_MARK, ETH_CRS_DV_MARK,
+ ETH_TXD0_MARK, ETH_TXD1_MARK, ETH_TX_EN_MARK, ETH_REFCLK_MARK,
+ };
++
++/* - HSCIF0 ----------------------------------------------------------------- */
++static const unsigned int hscif0_data_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(7, 3), RCAR_GP_PIN(7, 4),
++};
++static const unsigned int hscif0_data_mux[] = {
++ HRX0_MARK, HTX0_MARK,
++};
++static const unsigned int hscif0_clk_pins[] = {
++ /* SCK */
++ RCAR_GP_PIN(7, 2),
++};
++static const unsigned int hscif0_clk_mux[] = {
++ HSCK0_MARK,
++};
++static const unsigned int hscif0_ctrl_pins[] = {
++ /* RTS, CTS */
++ RCAR_GP_PIN(7, 1), RCAR_GP_PIN(7, 0),
++};
++static const unsigned int hscif0_ctrl_mux[] = {
++ HRTS0_N_MARK, HCTS0_N_MARK,
++};
++static const unsigned int hscif0_data_b_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(3, 12), RCAR_GP_PIN(3, 15),
++};
++static const unsigned int hscif0_data_b_mux[] = {
++ HRX0_B_MARK, HTX0_B_MARK,
++};
++static const unsigned int hscif0_ctrl_b_pins[] = {
++ /* RTS, CTS */
++ RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 13),
++};
++static const unsigned int hscif0_ctrl_b_mux[] = {
++ HRTS0_N_B_MARK, HCTS0_N_B_MARK,
++};
++static const unsigned int hscif0_data_c_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1),
++};
++static const unsigned int hscif0_data_c_mux[] = {
++ HRX0_C_MARK, HTX0_C_MARK,
++};
++static const unsigned int hscif0_clk_c_pins[] = {
++ /* SCK */
++ RCAR_GP_PIN(5, 31),
++};
++static const unsigned int hscif0_clk_c_mux[] = {
++ HSCK0_C_MARK,
++};
++/* - HSCIF1 ----------------------------------------------------------------- */
++static const unsigned int hscif1_data_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(7, 5), RCAR_GP_PIN(7, 6),
++};
++static const unsigned int hscif1_data_mux[] = {
++ HRX1_MARK, HTX1_MARK,
++};
++static const unsigned int hscif1_clk_pins[] = {
++ /* SCK */
++ RCAR_GP_PIN(7, 7),
++};
++static const unsigned int hscif1_clk_mux[] = {
++ HSCK1_MARK,
++};
++static const unsigned int hscif1_ctrl_pins[] = {
++ /* RTS, CTS */
++ RCAR_GP_PIN(7, 9), RCAR_GP_PIN(7, 8),
++};
++static const unsigned int hscif1_ctrl_mux[] = {
++ HRTS1_N_MARK, HCTS1_N_MARK,
++};
++static const unsigned int hscif1_data_b_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18),
++};
++static const unsigned int hscif1_data_b_mux[] = {
++ HRX1_B_MARK, HTX1_B_MARK,
++};
++static const unsigned int hscif1_data_c_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(7, 14), RCAR_GP_PIN(7, 15),
++};
++static const unsigned int hscif1_data_c_mux[] = {
++ HRX1_C_MARK, HTX1_C_MARK,
++};
++static const unsigned int hscif1_clk_c_pins[] = {
++ /* SCK */
++ RCAR_GP_PIN(7, 16),
++};
++static const unsigned int hscif1_clk_c_mux[] = {
++ HSCK1_C_MARK,
++};
++static const unsigned int hscif1_ctrl_c_pins[] = {
++ /* RTS, CTS */
++ RCAR_GP_PIN(7, 18), RCAR_GP_PIN(7, 17),
++};
++static const unsigned int hscif1_ctrl_c_mux[] = {
++ HRTS1_N_C_MARK, HCTS1_N_C_MARK,
++};
++static const unsigned int hscif1_data_d_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(4, 28), RCAR_GP_PIN(4, 18),
++};
++static const unsigned int hscif1_data_d_mux[] = {
++ HRX1_D_MARK, HTX1_D_MARK,
++};
++static const unsigned int hscif1_data_e_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(7, 14), RCAR_GP_PIN(7, 15),
++};
++static const unsigned int hscif1_data_e_mux[] = {
++ HRX1_C_MARK, HTX1_C_MARK,
++};
++static const unsigned int hscif1_clk_e_pins[] = {
++ /* SCK */
++ RCAR_GP_PIN(2, 6),
++};
++static const unsigned int hscif1_clk_e_mux[] = {
++ HSCK1_E_MARK,
++};
++static const unsigned int hscif1_ctrl_e_pins[] = {
++ /* RTS, CTS */
++ RCAR_GP_PIN(2, 8), RCAR_GP_PIN(2, 7),
++};
++static const unsigned int hscif1_ctrl_e_mux[] = {
++ HRTS1_N_E_MARK, HCTS1_N_E_MARK,
++};
++/* - HSCIF2 ----------------------------------------------------------------- */
++static const unsigned int hscif2_data_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(4, 16), RCAR_GP_PIN(4, 17),
++};
++static const unsigned int hscif2_data_mux[] = {
++ HRX2_MARK, HTX2_MARK,
++};
++static const unsigned int hscif2_clk_pins[] = {
++ /* SCK */
++ RCAR_GP_PIN(4, 15),
++};
++static const unsigned int hscif2_clk_mux[] = {
++ HSCK2_MARK,
++};
++static const unsigned int hscif2_ctrl_pins[] = {
++ /* RTS, CTS */
++ RCAR_GP_PIN(4, 14), RCAR_GP_PIN(4, 13),
++};
++static const unsigned int hscif2_ctrl_mux[] = {
++ HRTS2_N_MARK, HCTS2_N_MARK,
++};
++static const unsigned int hscif2_data_b_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(1, 20), RCAR_GP_PIN(1, 22),
++};
++static const unsigned int hscif2_data_b_mux[] = {
++ HRX2_B_MARK, HTX2_B_MARK,
++};
++static const unsigned int hscif2_ctrl_b_pins[] = {
++ /* RTS, CTS */
++ RCAR_GP_PIN(1, 23), RCAR_GP_PIN(1, 21),
++};
++static const unsigned int hscif2_ctrl_b_mux[] = {
++ HRTS2_N_B_MARK, HCTS2_N_B_MARK,
++};
++static const unsigned int hscif2_data_c_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1),
++};
++static const unsigned int hscif2_data_c_mux[] = {
++ HRX2_C_MARK, HTX2_C_MARK,
++};
++static const unsigned int hscif2_clk_c_pins[] = {
++ /* SCK */
++ RCAR_GP_PIN(5, 31),
++};
++static const unsigned int hscif2_clk_c_mux[] = {
++ HSCK2_C_MARK,
++};
++static const unsigned int hscif2_data_d_pins[] = {
++ /* RX, TX */
++ RCAR_GP_PIN(1, 20), RCAR_GP_PIN(5, 31),
++};
++static const unsigned int hscif2_data_d_mux[] = {
++ HRX2_B_MARK, HTX2_D_MARK,
++};
+ /* - I2C0 ------------------------------------------------------------------- */
+ static const unsigned int i2c0_pins[] = {
+ /* SCL, SDA */
+@@ -3885,6 +4071,32 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
+ SH_PFC_PIN_GROUP(eth_magic),
+ SH_PFC_PIN_GROUP(eth_mdio),
+ SH_PFC_PIN_GROUP(eth_rmii),
++ SH_PFC_PIN_GROUP(hscif0_data),
++ SH_PFC_PIN_GROUP(hscif0_clk),
++ SH_PFC_PIN_GROUP(hscif0_ctrl),
++ SH_PFC_PIN_GROUP(hscif0_data_b),
++ SH_PFC_PIN_GROUP(hscif0_ctrl_b),
++ SH_PFC_PIN_GROUP(hscif0_data_c),
++ SH_PFC_PIN_GROUP(hscif0_clk_c),
++ SH_PFC_PIN_GROUP(hscif1_data),
++ SH_PFC_PIN_GROUP(hscif1_clk),
++ SH_PFC_PIN_GROUP(hscif1_ctrl),
++ SH_PFC_PIN_GROUP(hscif1_data_b),
++ SH_PFC_PIN_GROUP(hscif1_data_c),
++ SH_PFC_PIN_GROUP(hscif1_clk_c),
++ SH_PFC_PIN_GROUP(hscif1_ctrl_c),
++ SH_PFC_PIN_GROUP(hscif1_data_d),
++ SH_PFC_PIN_GROUP(hscif1_data_e),
++ SH_PFC_PIN_GROUP(hscif1_clk_e),
++ SH_PFC_PIN_GROUP(hscif1_ctrl_e),
++ SH_PFC_PIN_GROUP(hscif2_data),
++ SH_PFC_PIN_GROUP(hscif2_clk),
++ SH_PFC_PIN_GROUP(hscif2_ctrl),
++ SH_PFC_PIN_GROUP(hscif2_data_b),
++ SH_PFC_PIN_GROUP(hscif2_ctrl_b),
++ SH_PFC_PIN_GROUP(hscif2_data_c),
++ SH_PFC_PIN_GROUP(hscif2_clk_c),
++ SH_PFC_PIN_GROUP(hscif2_data_d),
+ SH_PFC_PIN_GROUP(i2c0),
+ SH_PFC_PIN_GROUP(i2c0_b),
+ SH_PFC_PIN_GROUP(i2c0_c),
+@@ -4183,6 +4395,41 @@ static const char * const eth_groups[] = {
+ "eth_rmii",
+ };
+
++static const char * const hscif0_groups[] = {
++ "hscif0_data",
++ "hscif0_clk",
++ "hscif0_ctrl",
++ "hscif0_data_b",
++ "hscif0_ctrl_b",
++ "hscif0_data_c",
++ "hscif0_clk_c",
++};
++
++static const char * const hscif1_groups[] = {
++ "hscif1_data",
++ "hscif1_clk",
++ "hscif1_ctrl",
++ "hscif1_data_b",
++ "hscif1_data_c",
++ "hscif1_clk_c",
++ "hscif1_ctrl_c",
++ "hscif1_data_d",
++ "hscif1_data_e",
++ "hscif1_clk_e",
++ "hscif1_ctrl_e",
++};
++
++static const char * const hscif2_groups[] = {
++ "hscif2_data",
++ "hscif2_clk",
++ "hscif2_ctrl",
++ "hscif2_data_b",
++ "hscif2_ctrl_b",
++ "hscif2_data_c",
++ "hscif2_clk_c",
++ "hscif2_data_d",
++};
++
+ static const char * const i2c0_groups[] = {
+ "i2c0",
+ "i2c0_b",
+@@ -4547,6 +4794,9 @@ static const struct sh_pfc_function pinmux_functions[] = {
+ SH_PFC_FUNCTION(du0),
+ SH_PFC_FUNCTION(du1),
+ SH_PFC_FUNCTION(eth),
++ SH_PFC_FUNCTION(hscif0),
++ SH_PFC_FUNCTION(hscif1),
++ SH_PFC_FUNCTION(hscif2),
+ SH_PFC_FUNCTION(i2c0),
+ SH_PFC_FUNCTION(i2c1),
+ SH_PFC_FUNCTION(i2c2),
+--
+2.1.2
+
diff --git a/patches.renesas/0703-media-vb2-Check-if-there-are-buffers-before-streamon.patch b/patches.renesas/0703-media-vb2-Check-if-there-are-buffers-before-streamon.patch
new file mode 100644
index 00000000000000..0ce09796f43fcc
--- /dev/null
+++ b/patches.renesas/0703-media-vb2-Check-if-there-are-buffers-before-streamon.patch
@@ -0,0 +1,35 @@
+From 4fbb481a565ad61ed101d6a849ff78efe1ef688c Mon Sep 17 00:00:00 2001
+From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
+Date: Wed, 8 Jan 2014 05:01:33 -0300
+Subject: [media] vb2: Check if there are buffers before streamon
+
+This patch adds a test preventing streamon() if there is no buffer
+ready.
+
+Without this patch, a user could call streamon() before
+preparing any buffer. This leads to a situation where if he calls
+close() before calling streamoff() the device is kept streaming.
+
+Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 249f5a58bc844506fef2e9d5d55a88fbc708c5fa)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/v4l2-core/videobuf2-core.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/media/v4l2-core/videobuf2-core.c
++++ b/drivers/media/v4l2-core/videobuf2-core.c
+@@ -1784,6 +1784,11 @@ static int vb2_internal_streamon(struct
+ return -EINVAL;
+ }
+
++ if (!q->num_buffers) {
++ dprintk(1, "streamon: no buffers have been allocated\n");
++ return -EINVAL;
++ }
++
+ /*
+ * If any buffers were queued before streamon,
+ * we can now pass them to driver for processing.
diff --git a/patches.renesas/0704-media-vb2-rename-queued_count-to-owned_by_drv_count.patch b/patches.renesas/0704-media-vb2-rename-queued_count-to-owned_by_drv_count.patch
new file mode 100644
index 00000000000000..79158b687b9a18
--- /dev/null
+++ b/patches.renesas/0704-media-vb2-rename-queued_count-to-owned_by_drv_count.patch
@@ -0,0 +1,92 @@
+From a149403360c557cd39c94a5ed6b69fa87fd8bc48 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <hans.verkuil@cisco.com>
+Date: Thu, 6 Feb 2014 05:46:11 -0300
+Subject: [media] vb2: rename queued_count to owned_by_drv_count
+
+'queued_count' is a bit vague since it is not clear to which queue it
+refers to: the vb2 internal list of buffers or the driver-owned list
+of buffers.
+
+Rename to make it explicit.
+
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Acked-by: Pawel Osciak <pawel@osciak.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 6ea3b980f058d9dbc79ba88c652d581fa2d00792)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+Conflicts:
+ drivers/media/v4l2-core/videobuf2-core.c
+---
+ drivers/media/v4l2-core/videobuf2-core.c | 10 +++++-----
+ include/media/videobuf2-core.h | 4 ++--
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+--- a/drivers/media/v4l2-core/videobuf2-core.c
++++ b/drivers/media/v4l2-core/videobuf2-core.c
+@@ -951,7 +951,7 @@ void vb2_buffer_done(struct vb2_buffer *
+ spin_lock_irqsave(&q->done_lock, flags);
+ vb->state = state;
+ list_add_tail(&vb->done_entry, &q->done_list);
+- atomic_dec(&q->queued_count);
++ atomic_dec(&q->owned_by_drv_count);
+ spin_unlock_irqrestore(&q->done_lock, flags);
+
+ /* Inform any processes that may be waiting for buffers */
+@@ -1240,7 +1240,7 @@ static void __enqueue_in_driver(struct v
+ unsigned int plane;
+
+ vb->state = VB2_BUF_STATE_ACTIVE;
+- atomic_inc(&q->queued_count);
++ atomic_inc(&q->owned_by_drv_count);
+
+ /* sync buffers */
+ for (plane = 0; plane < vb->num_planes; ++plane)
+@@ -1394,7 +1394,7 @@ static int vb2_start_streaming(struct vb
+ int ret;
+
+ /* Tell the driver to start streaming */
+- ret = call_qop(q, start_streaming, q, atomic_read(&q->queued_count));
++ ret = call_qop(q, start_streaming, q, atomic_read(&q->owned_by_drv_count));
+
+ /*
+ * If there are not enough buffers queued to start streaming, then
+@@ -1618,7 +1618,7 @@ int vb2_wait_for_all_buffers(struct vb2_
+ }
+
+ if (!q->retry_start_streaming)
+- wait_event(q->done_wq, !atomic_read(&q->queued_count));
++ wait_event(q->done_wq, !atomic_read(&q->owned_by_drv_count));
+ return 0;
+ }
+ EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffers);
+@@ -1754,7 +1754,7 @@ static void __vb2_queue_cancel(struct vb
+ * has not already dequeued before initiating cancel.
+ */
+ INIT_LIST_HEAD(&q->done_list);
+- atomic_set(&q->queued_count, 0);
++ atomic_set(&q->owned_by_drv_count, 0);
+ wake_up_all(&q->done_wq);
+
+ /*
+--- a/include/media/videobuf2-core.h
++++ b/include/media/videobuf2-core.h
+@@ -320,7 +320,7 @@ struct v4l2_fh;
+ * @bufs: videobuf buffer structures
+ * @num_buffers: number of allocated/used buffers
+ * @queued_list: list of buffers currently queued from userspace
+- * @queued_count: number of buffers owned by the driver
++ * @owned_by_drv_count: number of buffers owned by the driver
+ * @done_list: list of buffers ready to be dequeued to userspace
+ * @done_lock: lock to protect done_list list
+ * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued
+@@ -355,7 +355,7 @@ struct vb2_queue {
+
+ struct list_head queued_list;
+
+- atomic_t queued_count;
++ atomic_t owned_by_drv_count;
+ struct list_head done_list;
+ spinlock_t done_lock;
+ wait_queue_head_t done_wq;
diff --git a/patches.renesas/0705-media-vb2-only-call-start_streaming-if-sufficient-bu.patch b/patches.renesas/0705-media-vb2-only-call-start_streaming-if-sufficient-bu.patch
new file mode 100644
index 00000000000000..0575e92da669cd
--- /dev/null
+++ b/patches.renesas/0705-media-vb2-only-call-start_streaming-if-sufficient-bu.patch
@@ -0,0 +1,505 @@
+From daefcbf7d2e804567eab555b69c35136e043b084 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <hans.verkuil@cisco.com>
+Date: Mon, 24 Feb 2014 13:51:03 -0300
+Subject: [media] vb2: only call start_streaming if sufficient buffers are
+ queued
+
+In commit 02f142ecd24aaf891324ffba8527284c1731b561 support was added to
+start_streaming to return -ENOBUFS if insufficient buffers were queued
+for the DMA engine to start. The vb2 core would attempt calling
+start_streaming again if another buffer would be queued up.
+
+Later analysis uncovered problems with the queue management if start_streaming
+would return an error: the buffers are enqueued to the driver before the
+start_streaming op is called, so after an error they are never returned to
+the vb2 core. The solution for this is to let the driver return them to
+the vb2 core in case of an error while starting the DMA engine. However,
+in the case of -ENOBUFS that would be weird: it is not a real error, it
+just says that more buffers are needed. Requiring start_streaming to give
+them back only to have them requeued again the next time the application
+calls QBUF is inefficient.
+
+This patch changes this mechanism: it adds a 'min_buffers_needed' field
+to vb2_queue that drivers can set with the minimum number of buffers
+required to start the DMA engine. The start_streaming op is only called
+if enough buffers are queued. The -ENOBUFS handling has been dropped in
+favor of this new method.
+
+Drivers are expected to return buffers back to vb2 core with state QUEUED
+if start_streaming would return an error. The vb2 core checks for this
+and produces a warning if that didn't happen and it will forcefully
+reclaim such buffers to ensure that the internal vb2 core state remains
+consistent and all buffer-related resources have been correctly freed
+and all op calls have been balanced.
+
+__reqbufs() has been updated to check that at least min_buffers_needed
+buffers could be allocated. If fewer buffers were allocated then __reqbufs
+will free what was allocated and return -ENOMEM. Based on a suggestion from
+Pawel Osciak.
+
+__create_bufs() doesn't do that check, since the use of __create_bufs
+assumes some advance scenario where the user might want more control.
+Instead streamon will check if enough buffers were allocated to prevent
+streaming with fewer than the minimum required number of buffers.
+
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit b3379c6201bb3555298cdbf0aa004af260f2a6a4)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+Conflicts:
+ drivers/media/platform/davinci/vpbe_display.c
+ drivers/media/platform/davinci/vpif_capture.c
+ drivers/media/platform/davinci/vpif_display.c
+ drivers/media/v4l2-core/videobuf2-core.c
+---
+ drivers/media/platform/davinci/vpbe_display.c | 7 -
+ drivers/media/platform/davinci/vpif_capture.c | 8 -
+ drivers/media/platform/davinci/vpif_display.c | 8 -
+ drivers/media/platform/s5p-tv/mixer_video.c | 6 -
+ drivers/media/v4l2-core/videobuf2-core.c | 143 ++++++++++++++++--------
+ drivers/staging/media/davinci_vpfe/vpfe_video.c | 3
+ include/media/videobuf2-core.h | 14 +-
+ 7 files changed, 115 insertions(+), 74 deletions(-)
+
+--- a/drivers/media/platform/davinci/vpbe_display.c
++++ b/drivers/media/platform/davinci/vpbe_display.c
+@@ -344,11 +344,6 @@ static int vpbe_start_streaming(struct v
+ struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev;
+ int ret;
+
+- /* If buffer queue is empty, return error */
+- if (list_empty(&layer->dma_queue)) {
+- v4l2_err(&vpbe_dev->v4l2_dev, "buffer queue is empty\n");
+- return -ENOBUFS;
+- }
+ /* Get the next frame from the buffer queue */
+ layer->next_frm = layer->cur_frm = list_entry(layer->dma_queue.next,
+ struct vpbe_disp_buffer, list);
+@@ -1415,7 +1410,7 @@ static int vpbe_display_reqbufs(struct f
+ q->ops = &video_qops;
+ q->mem_ops = &vb2_dma_contig_memops;
+ q->buf_struct_size = sizeof(struct vpbe_disp_buffer);
+- q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
++ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+
+ ret = vb2_queue_init(q);
+ if (ret) {
+--- a/drivers/media/platform/davinci/vpif_capture.c
++++ b/drivers/media/platform/davinci/vpif_capture.c
+@@ -272,13 +272,7 @@ static int vpif_start_streaming(struct v
+ unsigned long flags;
+ int ret;
+
+- /* If buffer queue is empty, return error */
+ spin_lock_irqsave(&common->irqlock, flags);
+- if (list_empty(&common->dma_queue)) {
+- spin_unlock_irqrestore(&common->irqlock, flags);
+- vpif_dbg(1, debug, "buffer queue is empty\n");
+- return -ENOBUFS;
+- }
+
+ /* Get the next frame from the buffer queue */
+ common->cur_frm = common->next_frm = list_entry(common->dma_queue.next,
+@@ -1023,7 +1017,7 @@ static int vpif_reqbufs(struct file *fil
+ q->ops = &video_qops;
+ q->mem_ops = &vb2_dma_contig_memops;
+ q->buf_struct_size = sizeof(struct vpif_cap_buffer);
+- q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
++ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+
+ ret = vb2_queue_init(q);
+ if (ret) {
+--- a/drivers/media/platform/davinci/vpif_display.c
++++ b/drivers/media/platform/davinci/vpif_display.c
+@@ -234,13 +234,7 @@ static int vpif_start_streaming(struct v
+ unsigned long flags;
+ int ret;
+
+- /* If buffer queue is empty, return error */
+ spin_lock_irqsave(&common->irqlock, flags);
+- if (list_empty(&common->dma_queue)) {
+- spin_unlock_irqrestore(&common->irqlock, flags);
+- vpif_err("buffer queue is empty\n");
+- return -ENOBUFS;
+- }
+
+ /* Get the next frame from the buffer queue */
+ common->next_frm = common->cur_frm =
+@@ -983,7 +977,7 @@ static int vpif_reqbufs(struct file *fil
+ q->ops = &video_qops;
+ q->mem_ops = &vb2_dma_contig_memops;
+ q->buf_struct_size = sizeof(struct vpif_disp_buffer);
+- q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
++ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+
+ ret = vb2_queue_init(q);
+ if (ret) {
+--- a/drivers/media/platform/s5p-tv/mixer_video.c
++++ b/drivers/media/platform/s5p-tv/mixer_video.c
+@@ -946,11 +946,6 @@ static int start_streaming(struct vb2_qu
+
+ mxr_dbg(mdev, "%s\n", __func__);
+
+- if (count == 0) {
+- mxr_dbg(mdev, "no output buffers queued\n");
+- return -ENOBUFS;
+- }
+-
+ /* block any changes in output configuration */
+ mxr_output_get(mdev);
+
+@@ -1124,6 +1119,7 @@ struct mxr_layer *mxr_base_layer_create(
+ .drv_priv = layer,
+ .buf_struct_size = sizeof(struct mxr_buffer),
+ .ops = &mxr_video_qops,
++ .min_buffers_needed = 1,
+ .mem_ops = &vb2_dma_contig_memops,
+ };
+
+--- a/drivers/media/v4l2-core/videobuf2-core.c
++++ b/drivers/media/v4l2-core/videobuf2-core.c
+@@ -693,6 +693,7 @@ static int __reqbufs(struct vb2_queue *q
+ * Make sure the requested values and current defaults are sane.
+ */
+ num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME);
++ num_buffers = max_t(unsigned int, req->count, q->min_buffers_needed);
+ memset(q->plane_sizes, 0, sizeof(q->plane_sizes));
+ memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx));
+ q->memory = req->memory;
+@@ -716,9 +717,16 @@ static int __reqbufs(struct vb2_queue *q
+ allocated_buffers = ret;
+
+ /*
++ * There is no point in continuing if we can't allocate the minimum
++ * number of buffers needed by this vb2_queue.
++ */
++ if (allocated_buffers < q->min_buffers_needed)
++ ret = -ENOMEM;
++
++ /*
+ * Check if driver can handle the allocated number of buffers.
+ */
+- if (allocated_buffers < num_buffers) {
++ if (!ret && allocated_buffers < num_buffers) {
+ num_buffers = allocated_buffers;
+
+ ret = call_qop(q, queue_setup, q, NULL, &num_buffers,
+@@ -920,13 +928,20 @@ EXPORT_SYMBOL_GPL(vb2_plane_cookie);
+ * vb2_buffer_done() - inform videobuf that an operation on a buffer is finished
+ * @vb: vb2_buffer returned from the driver
+ * @state: either VB2_BUF_STATE_DONE if the operation finished successfully
+- * or VB2_BUF_STATE_ERROR if the operation finished with an error
++ * or VB2_BUF_STATE_ERROR if the operation finished with an error.
++ * If start_streaming fails then it should return buffers with state
++ * VB2_BUF_STATE_QUEUED to put them back into the queue.
+ *
+ * This function should be called by the driver after a hardware operation on
+ * a buffer is finished and the buffer may be returned to userspace. The driver
+ * cannot use this buffer anymore until it is queued back to it by videobuf
+ * by the means of buf_queue callback. Only buffers previously queued to the
+ * driver by buf_queue can be passed to this function.
++ *
++ * While streaming a buffer can only be returned in state DONE or ERROR.
++ * The start_streaming op can also return them in case the DMA engine cannot
++ * be started for some reason. In that case the buffers should be returned with
++ * state QUEUED.
+ */
+ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state)
+ {
+@@ -934,11 +949,17 @@ void vb2_buffer_done(struct vb2_buffer *
+ unsigned long flags;
+ unsigned int plane;
+
+- if (vb->state != VB2_BUF_STATE_ACTIVE)
++ if (WARN_ON(vb->state != VB2_BUF_STATE_ACTIVE))
+ return;
+
+- if (state != VB2_BUF_STATE_DONE && state != VB2_BUF_STATE_ERROR)
+- return;
++ if (!q->start_streaming_called) {
++ if (WARN_ON(state != VB2_BUF_STATE_QUEUED))
++ state = VB2_BUF_STATE_QUEUED;
++ } else if (!WARN_ON(!q->start_streaming_called)) {
++ if (WARN_ON(state != VB2_BUF_STATE_DONE &&
++ state != VB2_BUF_STATE_ERROR))
++ state = VB2_BUF_STATE_ERROR;
++ }
+
+ dprintk(4, "Done processing on buffer %d, state: %d\n",
+ vb->v4l2_buf.index, state);
+@@ -950,10 +971,14 @@ void vb2_buffer_done(struct vb2_buffer *
+ /* Add the buffer to the done buffers list */
+ spin_lock_irqsave(&q->done_lock, flags);
+ vb->state = state;
+- list_add_tail(&vb->done_entry, &q->done_list);
++ if (state != VB2_BUF_STATE_QUEUED)
++ list_add_tail(&vb->done_entry, &q->done_list);
+ atomic_dec(&q->owned_by_drv_count);
+ spin_unlock_irqrestore(&q->done_lock, flags);
+
++ if (state == VB2_BUF_STATE_QUEUED)
++ return;
++
+ /* Inform any processes that may be waiting for buffers */
+ wake_up(&q->done_wq);
+ }
+@@ -1384,32 +1409,48 @@ EXPORT_SYMBOL_GPL(vb2_prepare_buf);
+ * vb2_start_streaming() - Attempt to start streaming.
+ * @q: videobuf2 queue
+ *
+- * If there are not enough buffers, then retry_start_streaming is set to
+- * 1 and 0 is returned. The next time a buffer is queued and
+- * retry_start_streaming is 1, this function will be called again to
+- * retry starting the DMA engine.
++ * Attempt to start streaming. When this function is called there must be
++ * at least q->min_buffers_needed buffers queued up (i.e. the minimum
++ * number of buffers required for the DMA engine to function). If the
++ * @start_streaming op fails it is supposed to return all the driver-owned
++ * buffers back to vb2 in state QUEUED. Check if that happened and if
++ * not warn and reclaim them forcefully.
+ */
+ static int vb2_start_streaming(struct vb2_queue *q)
+ {
++ struct vb2_buffer *vb;
+ int ret;
+
+- /* Tell the driver to start streaming */
+- ret = call_qop(q, start_streaming, q, atomic_read(&q->owned_by_drv_count));
+-
+ /*
+- * If there are not enough buffers queued to start streaming, then
+- * the start_streaming operation will return -ENOBUFS and you have to
+- * retry when the next buffer is queued.
++ * If any buffers were queued before streamon,
++ * we can now pass them to driver for processing.
+ */
+- if (ret == -ENOBUFS) {
+- dprintk(1, "qbuf: not enough buffers, retry when more buffers are queued.\n");
+- q->retry_start_streaming = 1;
++ list_for_each_entry(vb, &q->queued_list, queued_entry)
++ __enqueue_in_driver(vb);
++
++ /* Tell the driver to start streaming */
++ ret = call_qop(q, start_streaming, q,
++ atomic_read(&q->owned_by_drv_count));
++ q->start_streaming_called = ret == 0;
++ if (!ret)
+ return 0;
++
++ dprintk(1, "qbuf: driver refused to start streaming\n");
++ if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
++ unsigned i;
++
++ /*
++ * Forcefully reclaim buffers if the driver did not
++ * correctly return them to vb2.
++ */
++ for (i = 0; i < q->num_buffers; ++i) {
++ vb = q->bufs[i];
++ if (vb->state == VB2_BUF_STATE_ACTIVE)
++ vb2_buffer_done(vb, VB2_BUF_STATE_QUEUED);
++ }
++ /* Must be zero now */
++ WARN_ON(atomic_read(&q->owned_by_drv_count));
+ }
+- if (ret)
+- dprintk(1, "qbuf: driver refused to start streaming\n");
+- else
+- q->retry_start_streaming = 0;
+ return ret;
+ }
+
+@@ -1449,6 +1490,7 @@ static int vb2_internal_qbuf(struct vb2_
+ * dequeued in dqbuf.
+ */
+ list_add_tail(&vb->queued_entry, &q->queued_list);
++ q->queued_count++;
+ q->waiting_for_buffers = false;
+ vb->state = VB2_BUF_STATE_QUEUED;
+
+@@ -1456,13 +1498,20 @@ static int vb2_internal_qbuf(struct vb2_
+ * If already streaming, give the buffer to driver for processing.
+ * If not, the buffer will be given to driver on next streamon.
+ */
+- if (q->streaming)
++ if (q->start_streaming_called)
+ __enqueue_in_driver(vb);
+
+ /* Fill buffer information for the userspace */
+ __fill_v4l2_buffer(vb, b);
+
+- if (q->retry_start_streaming) {
++ /*
++ * If streamon has been called, and we haven't yet called
++ * start_streaming() since not enough buffers were queued, and
++ * we now have reached the minimum number of queued buffers,
++ * then we can finally call start_streaming().
++ */
++ if (q->streaming && !q->start_streaming_called &&
++ q->queued_count >= q->min_buffers_needed) {
+ ret = vb2_start_streaming(q);
+ if (ret)
+ return ret;
+@@ -1617,7 +1666,7 @@ int vb2_wait_for_all_buffers(struct vb2_
+ return -EINVAL;
+ }
+
+- if (!q->retry_start_streaming)
++ if (q->start_streaming_called)
+ wait_event(q->done_wq, !atomic_read(&q->owned_by_drv_count));
+ return 0;
+ }
+@@ -1682,6 +1731,7 @@ static int vb2_internal_dqbuf(struct vb2
+ __fill_v4l2_buffer(vb, b);
+ /* Remove from videobuf queue */
+ list_del(&vb->queued_entry);
++ q->queued_count--;
+ /* go back to dequeued state */
+ __vb2_dqbuf(vb);
+
+@@ -1732,18 +1782,23 @@ static void __vb2_queue_cancel(struct vb
+ {
+ unsigned int i;
+
+- if (q->retry_start_streaming) {
+- q->retry_start_streaming = 0;
+- q->streaming = 0;
+- }
+-
+ /*
+ * Tell driver to stop all transactions and release all queued
+ * buffers.
+ */
+- if (q->streaming)
++ if (q->start_streaming_called)
+ call_qop(q, stop_streaming, q);
+ q->streaming = 0;
++ q->start_streaming_called = 0;
++ q->queued_count = 0;
++
++ if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
++ for (i = 0; i < q->num_buffers; ++i)
++ if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE)
++ vb2_buffer_done(q->bufs[i], VB2_BUF_STATE_ERROR);
++ /* Must be zero now */
++ WARN_ON(atomic_read(&q->owned_by_drv_count));
++ }
+
+ /*
+ * Remove all buffers from videobuf's list...
+@@ -1766,7 +1821,6 @@ static void __vb2_queue_cancel(struct vb
+
+ static int vb2_internal_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
+ {
+- struct vb2_buffer *vb;
+ int ret;
+
+ if (type != q->type) {
+@@ -1788,19 +1842,22 @@ static int vb2_internal_streamon(struct
+ dprintk(1, "streamon: no buffers have been allocated\n");
+ return -EINVAL;
+ }
++ if (q->num_buffers < q->min_buffers_needed) {
++ dprintk(1, "streamon: need at least %u allocated buffers\n",
++ q->min_buffers_needed);
++ return -EINVAL;
++ }
+
+ /*
+- * If any buffers were queued before streamon,
+- * we can now pass them to driver for processing.
++ * Tell driver to start streaming provided sufficient buffers
++ * are available.
+ */
+- list_for_each_entry(vb, &q->queued_list, queued_entry)
+- __enqueue_in_driver(vb);
+-
+- /* Tell driver to start streaming. */
+- ret = vb2_start_streaming(q);
+- if (ret) {
+- __vb2_queue_cancel(q);
+- return ret;
++ if (q->queued_count >= q->min_buffers_needed) {
++ ret = vb2_start_streaming(q);
++ if (ret) {
++ __vb2_queue_cancel(q);
++ return ret;
++ }
+ }
+
+ q->streaming = 1;
+--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
++++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
+@@ -1201,8 +1201,6 @@ static int vpfe_start_streaming(struct v
+ unsigned long addr;
+ int ret;
+
+- if (count == 0)
+- return -ENOBUFS;
+ ret = mutex_lock_interruptible(&video->lock);
+ if (ret)
+ goto streamoff;
+@@ -1327,6 +1325,7 @@ static int vpfe_reqbufs(struct file *fil
+ q->type = req_buf->type;
+ q->io_modes = VB2_MMAP | VB2_USERPTR;
+ q->drv_priv = fh;
++ q->min_buffers_needed = 1;
+ q->ops = &video_qops;
+ q->mem_ops = &vb2_dma_contig_memops;
+ q->buf_struct_size = sizeof(struct vpfe_cap_buffer);
+--- a/include/media/videobuf2-core.h
++++ b/include/media/videobuf2-core.h
+@@ -315,20 +315,24 @@ struct v4l2_fh;
+ * @gfp_flags: additional gfp flags used when allocating the buffers.
+ * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32
+ * to force the buffer allocation to a specific memory zone.
++ * @min_buffers_needed: the minimum number of buffers needed before
++ * start_streaming() can be called. Used when a DMA engine
++ * cannot be started unless at least this number of buffers
++ * have been queued into the driver.
+ *
+ * @memory: current memory type used
+ * @bufs: videobuf buffer structures
+ * @num_buffers: number of allocated/used buffers
+ * @queued_list: list of buffers currently queued from userspace
++ * @queued_count: number of buffers queued and ready for streaming.
+ * @owned_by_drv_count: number of buffers owned by the driver
+ * @done_list: list of buffers ready to be dequeued to userspace
+ * @done_lock: lock to protect done_list list
+ * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued
+ * @alloc_ctx: memory type/allocator-specific contexts for each plane
+ * @streaming: current streaming state
+- * @retry_start_streaming: start_streaming() was called, but there were not enough
+- * buffers queued. If set, then retry calling start_streaming when
+- * queuing a new buffer.
++ * @start_streaming_called: start_streaming() was called successfully and we
++ * started streaming.
+ * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for
+ * buffers. Only set for capture queues if qbuf has not yet been
+ * called since poll() needs to return POLLERR in that situation.
+@@ -347,6 +351,7 @@ struct vb2_queue {
+ unsigned int buf_struct_size;
+ u32 timestamp_type;
+ gfp_t gfp_flags;
++ u32 min_buffers_needed;
+
+ /* private: internal use only */
+ enum v4l2_memory memory;
+@@ -354,6 +359,7 @@ struct vb2_queue {
+ unsigned int num_buffers;
+
+ struct list_head queued_list;
++ unsigned int queued_count;
+
+ atomic_t owned_by_drv_count;
+ struct list_head done_list;
+@@ -364,7 +370,7 @@ struct vb2_queue {
+ unsigned int plane_sizes[VIDEO_MAX_PLANES];
+
+ unsigned int streaming:1;
+- unsigned int retry_start_streaming:1;
++ unsigned int start_streaming_called:1;
+ unsigned int waiting_for_buffers:1;
+
+ struct vb2_fileio_data *fileio;
diff --git a/patches.renesas/0706-v4l-Add-ARGB-and-XRGB-pixel-formats.patch b/patches.renesas/0706-v4l-Add-ARGB-and-XRGB-pixel-formats.patch
new file mode 100644
index 00000000000000..e3d4af6b567ad4
--- /dev/null
+++ b/patches.renesas/0706-v4l-Add-ARGB-and-XRGB-pixel-formats.patch
@@ -0,0 +1,54 @@
+From 81093c4977bc29068a0ed7e361806b3fa3b2d899 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Thu, 22 May 2014 03:07:55 +0200
+Subject: v4l: Add ARGB and XRGB pixel formats
+
+The existing RGB pixel formats are ill-defined in respect to their alpha
+bits and their meaning is driver dependent. Create new standard ARGB and
+XRGB variants with clearly defined meanings and make the existing
+variants deprecated.
+
+The new pixel formats 4CC values have been selected to match the DRM
+4CCs for the same in-memory formats.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+(cherry picked from commit 3ddcdb02a95582bf472a89c934bca6e56f07a2db)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+Conflicts:
+ Documentation/DocBook/media/v4l/pixfmt-packed-rgb.xml
+---
+ include/uapi/linux/videodev2.h | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
+index fe94bb90582e..63274c1d037c 100644
+--- a/include/uapi/linux/videodev2.h
++++ b/include/uapi/linux/videodev2.h
+@@ -289,7 +289,11 @@ struct v4l2_pix_format {
+ /* RGB formats */
+ #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
+ #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
++#define V4L2_PIX_FMT_ARGB444 v4l2_fourcc('A', 'R', '1', '2') /* 16 aaaarrrr ggggbbbb */
++#define V4L2_PIX_FMT_XRGB444 v4l2_fourcc('X', 'R', '1', '2') /* 16 xxxxrrrr ggggbbbb */
+ #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
++#define V4L2_PIX_FMT_ARGB555 v4l2_fourcc('A', 'R', '1', '5') /* 16 ARGB-1-5-5-5 */
++#define V4L2_PIX_FMT_XRGB555 v4l2_fourcc('X', 'R', '1', '5') /* 16 XRGB-1-5-5-5 */
+ #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
+ #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
+ #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
+@@ -297,7 +301,11 @@ struct v4l2_pix_format {
+ #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
+ #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
+ #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
++#define V4L2_PIX_FMT_ABGR32 v4l2_fourcc('A', 'R', '2', '4') /* 32 BGRA-8-8-8-8 */
++#define V4L2_PIX_FMT_XBGR32 v4l2_fourcc('X', 'R', '2', '4') /* 32 BGRX-8-8-8-8 */
+ #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
++#define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */
++#define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */
+
+ /* Grey formats */
+ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
+--
+2.1.2
+
diff --git a/patches.renesas/0707-DocBook-media-Document-ALPHA_COMPONENT-control-usage.patch b/patches.renesas/0707-DocBook-media-Document-ALPHA_COMPONENT-control-usage.patch
new file mode 100644
index 00000000000000..eb92f9f8c8617e
--- /dev/null
+++ b/patches.renesas/0707-DocBook-media-Document-ALPHA_COMPONENT-control-usage.patch
@@ -0,0 +1,49 @@
+From dbd016c0b6e5342227acb9425ef0ef00199b5ba0 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Thu, 22 May 2014 00:16:01 +0200
+Subject: DocBook: media: Document ALPHA_COMPONENT control usage on output
+ devices
+
+Extend the V4L2_CID_ALPHA_COMPONENT control for use on output devices,
+to set the alpha component value when the output format doesn't have an
+alpha channel.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+(cherry picked from commit e632d2f4e25c574a29b269f9f4b0cef2995e402d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ Documentation/DocBook/media/v4l/controls.xml | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
+index a5a3188e5af7..066800dcb123 100644
+--- a/Documentation/DocBook/media/v4l/controls.xml
++++ b/Documentation/DocBook/media/v4l/controls.xml
+@@ -398,14 +398,17 @@ to work.</entry>
+ <row id="v4l2-alpha-component">
+ <entry><constant>V4L2_CID_ALPHA_COMPONENT</constant></entry>
+ <entry>integer</entry>
+- <entry> Sets the alpha color component on the capture device or on
+- the capture buffer queue of a mem-to-mem device. When a mem-to-mem
+- device produces frame format that includes an alpha component
++ <entry>Sets the alpha color component. When a capture device (or
++ capture queue of a mem-to-mem device) produces a frame format that
++ includes an alpha component
+ (e.g. <link linkend="rgb-formats">packed RGB image formats</link>)
+- and the alpha value is not defined by the mem-to-mem input data
+- this control lets you select the alpha component value of all
+- pixels. It is applicable to any pixel format that contains an alpha
+- component.
++ and the alpha value is not defined by the device or the mem-to-mem
++ input data this control lets you select the alpha component value of
++ all pixels. When an output device (or output queue of a mem-to-mem
++ device) consumes a frame format that doesn't include an alpha
++ component and the device supports alpha channel processing this
++ control lets you set the alpha component value of all pixels for
++ further processing in the device.
+ </entry>
+ </row>
+ <row>
+--
+2.1.2
+
diff --git a/patches.renesas/0708-v4l-Support-extending-the-v4l2_pix_format-structure.patch b/patches.renesas/0708-v4l-Support-extending-the-v4l2_pix_format-structure.patch
new file mode 100644
index 00000000000000..e1110b92f2a484
--- /dev/null
+++ b/patches.renesas/0708-v4l-Support-extending-the-v4l2_pix_format-structure.patch
@@ -0,0 +1,728 @@
+From 1fcfbdf95264aea9994629faea9a4f78b96fe5a4 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 27 May 2014 14:41:05 +0200
+Subject: v4l: Support extending the v4l2_pix_format structure
+
+The v4l2_pix_format structure has no reserved field. It is embedded in
+the v4l2_framebuffer structure which has no reserved fields either, and
+in the v4l2_format structure which has reserved fields that were not
+previously required to be zeroed out by applications.
+
+To allow extending v4l2_pix_format, inline it in the v4l2_framebuffer
+structure, and use the priv field as a magic value to indicate that the
+application has set all v4l2_pix_format extended fields and zeroed all
+reserved fields following the v4l2_pix_format field in the v4l2_format
+structure.
+
+The availability of this API extension is reported to userspace through
+the new V4L2_CAP_EXT_PIX_FORMAT capability flag. Just checking that the
+priv field is still set to the magic value at [GS]_FMT return wouldn't
+be enough, as older kernels don't zero the priv field on return.
+
+To simplify the internal API towards drivers zero the extended fields
+and set the priv field to the magic value for applications not aware of
+the extensions.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+(cherry picked from commit af7553db487e1dbcd069d1bb9426fc8c591ea1f4)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+Conflicts:
+ Documentation/DocBook/media/v4l/v4l2.xml
+ Documentation/DocBook/media/v4l/vidioc-querycap.xml
+ drivers/media/platform/davinci/vpif_display.c
+ drivers/media/platform/mem2mem_testdev.c
+ include/uapi/linux/videodev2.h
+---
+ Documentation/DocBook/media/Makefile | 2 +-
+ Documentation/DocBook/media/v4l/pixfmt.xml | 25 +++++++++--
+ drivers/media/parport/bw-qcam.c | 2 -
+ drivers/media/pci/cx18/cx18-ioctl.c | 1 -
+ drivers/media/pci/cx25821/cx25821-video.c | 3 --
+ drivers/media/pci/ivtv/ivtv-ioctl.c | 3 --
+ drivers/media/pci/meye/meye.c | 2 -
+ drivers/media/pci/saa7134/saa7134-empress.c | 3 --
+ drivers/media/pci/saa7134/saa7134-video.c | 2 -
+ drivers/media/pci/sta2x11/sta2x11_vip.c | 1 -
+ drivers/media/platform/coda.c | 2 -
+ drivers/media/platform/omap/omap_vout.c | 2 -
+ drivers/media/platform/sh_veu.c | 2 -
+ drivers/media/platform/vino.c | 5 ---
+ drivers/media/platform/vivi.c | 1 -
+ drivers/media/usb/cx231xx/cx231xx-417.c | 2 -
+ drivers/media/usb/cx231xx/cx231xx-video.c | 2 -
+ drivers/media/usb/gspca/gspca.c | 8 ++--
+ drivers/media/usb/hdpvr/hdpvr-video.c | 1 -
+ drivers/media/usb/stkwebcam/stk-webcam.c | 2 -
+ drivers/media/usb/tlg2300/pd-video.c | 1 -
+ drivers/media/usb/tm6000/tm6000-video.c | 2 -
+ drivers/media/usb/zr364xx/zr364xx.c | 3 --
+ drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 19 ++++++---
+ drivers/media/v4l2-core/v4l2-ioctl.c | 61 +++++++++++++++++++++++++--
+ include/uapi/linux/videodev2.h | 15 ++++++-
+ 26 files changed, 112 insertions(+), 60 deletions(-)
+
+diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile
+index 1d27f0a1abd1..494da944b39d 100644
+--- a/Documentation/DocBook/media/Makefile
++++ b/Documentation/DocBook/media/Makefile
+@@ -174,7 +174,7 @@ FILENAME = \
+ DOCUMENTED = \
+ -e "s/\(enum *\)v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1<link linkend=\"\2\">v4l2_mpeg_cx2341x_video_\2<\/link>/g" \
+ -e "s/\(\(enum\|struct\) *\)\(v4l2_[a-zA-Z0-9_]*\)/\1<link linkend=\"\3\">\3<\/link>/g" \
+- -e "s/\(V4L2_PIX_FMT_[A-Z0-9_]\+\) /<link linkend=\"\1\">\1<\/link> /g" \
++ -e "s/\(V4L2_PIX_FMT_[A-Z0-9_]\+\)\(\s\+v4l2_fourcc\)/<link linkend=\"\1\">\1<\/link>\2/g" \
+ -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \
+ -e "s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g"
+
+diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml
+index 72d72bd67d0a..6e1e520a2750 100644
+--- a/Documentation/DocBook/media/v4l/pixfmt.xml
++++ b/Documentation/DocBook/media/v4l/pixfmt.xml
+@@ -103,9 +103,28 @@ see <xref linkend="colorspaces" />.</entry>
+ <row>
+ <entry>__u32</entry>
+ <entry><structfield>priv</structfield></entry>
+- <entry>Reserved for custom (driver defined) additional
+-information about formats. When not used drivers and applications must
+-set this field to zero.</entry>
++ <entry><para>This field indicates whether the remaining fields of the
++<structname>v4l2_pix_format</structname> structure, also called the extended
++fields, are valid. When set to <constant>V4L2_PIX_FMT_PRIV_MAGIC</constant>, it
++indicates that the extended fields have been correctly initialized. When set to
++any other value it indicates that the extended fields contain undefined values.
++</para>
++<para>Applications that wish to use the pixel format extended fields must first
++ensure that the feature is supported by querying the device for the
++<link linkend="querycap"><constant>V4L2_CAP_EXT_PIX_FORMAT</constant></link>
++capability. If the capability isn't set the pixel format extended fields are not
++supported and using the extended fields will lead to undefined results.</para>
++<para>To use the extended fields, applications must set the
++<structfield>priv</structfield> field to
++<constant>V4L2_PIX_FMT_PRIV_MAGIC</constant>, initialize all the extended fields
++and zero the unused bytes of the <structname>v4l2_format</structname>
++<structfield>raw_data</structfield> field.</para>
++<para>When the <structfield>priv</structfield> field isn't set to
++<constant>V4L2_PIX_FMT_PRIV_MAGIC</constant> drivers must act as if all the
++extended fields were set to zero. On return drivers must set the
++<structfield>priv</structfield> field to
++<constant>V4L2_PIX_FMT_PRIV_MAGIC</constant> and all the extended field to
++applicable values.</para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+diff --git a/drivers/media/parport/bw-qcam.c b/drivers/media/parport/bw-qcam.c
+index d12bd33f39cb..b711b5b5b01a 100644
+--- a/drivers/media/parport/bw-qcam.c
++++ b/drivers/media/parport/bw-qcam.c
+@@ -757,7 +757,6 @@ static int qcam_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f
+ pix->sizeimage = pix->width * pix->height;
+ /* Just a guess */
+ pix->colorspace = V4L2_COLORSPACE_SRGB;
+- pix->priv = 0;
+ return 0;
+ }
+
+@@ -783,7 +782,6 @@ static int qcam_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format
+ pix->sizeimage = pix->width * pix->height;
+ /* Just a guess */
+ pix->colorspace = V4L2_COLORSPACE_SRGB;
+- pix->priv = 0;
+ return 0;
+ }
+
+diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c
+index 1110bcb14e2f..c4c3ff30d0a3 100644
+--- a/drivers/media/pci/cx18/cx18-ioctl.c
++++ b/drivers/media/pci/cx18/cx18-ioctl.c
+@@ -156,7 +156,6 @@ static int cx18_g_fmt_vid_cap(struct file *file, void *fh,
+ pixfmt->height = cx->cxhdl.height;
+ pixfmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
+ pixfmt->field = V4L2_FIELD_INTERLACED;
+- pixfmt->priv = 0;
+ if (id->type == CX18_ENC_STREAM_TYPE_YUV) {
+ pixfmt->pixelformat = s->pixelformat;
+ pixfmt->sizeimage = s->vb_bytes_per_frame;
+diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
+index d270819fd875..c7ae087b668b 100644
+--- a/drivers/media/pci/cx25821/cx25821-video.c
++++ b/drivers/media/pci/cx25821/cx25821-video.c
+@@ -576,7 +576,6 @@ static int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.bytesperline = (chan->width * chan->fmt->depth) >> 3;
+ f->fmt.pix.sizeimage = chan->height * f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+@@ -615,7 +614,6 @@ static int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3;
+ f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+@@ -867,7 +865,6 @@ static int cx25821_vidioc_try_fmt_vid_out(struct file *file, void *priv,
+ f->fmt.pix.bytesperline = (f->fmt.pix.width * fmt->depth) >> 3;
+ f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+- f->fmt.pix.priv = 0;
+ return 0;
+ }
+
+diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c
+index 807b275a847e..d4d0f0ecab98 100644
+--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
++++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
+@@ -351,7 +351,6 @@ static int ivtv_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f
+ pixfmt->height = itv->cxhdl.height;
+ pixfmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
+ pixfmt->field = V4L2_FIELD_INTERLACED;
+- pixfmt->priv = 0;
+ if (id->type == IVTV_ENC_STREAM_TYPE_YUV) {
+ pixfmt->pixelformat = V4L2_PIX_FMT_HM12;
+ /* YUV size is (Y=(h*720) + UV=(h*(720/2))) */
+@@ -418,7 +417,6 @@ static int ivtv_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f
+ pixfmt->height = itv->main_rect.height;
+ pixfmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
+ pixfmt->field = V4L2_FIELD_INTERLACED;
+- pixfmt->priv = 0;
+ if (id->type == IVTV_DEC_STREAM_TYPE_YUV) {
+ switch (itv->yuv_info.lace_mode & IVTV_YUV_MODE_MASK) {
+ case IVTV_YUV_MODE_INTERLACED:
+@@ -1384,7 +1382,6 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
+ fb->fmt.bytesperline = fb->fmt.width;
+ fb->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M;
+ fb->fmt.field = V4L2_FIELD_INTERLACED;
+- fb->fmt.priv = 0;
+ if (fb->fmt.pixelformat != V4L2_PIX_FMT_PAL8)
+ fb->fmt.bytesperline *= 2;
+ if (fb->fmt.pixelformat == V4L2_PIX_FMT_RGB32 ||
+diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
+index 54d5c821007c..4e7fba034a31 100644
+--- a/drivers/media/pci/meye/meye.c
++++ b/drivers/media/pci/meye/meye.c
+@@ -1166,7 +1166,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh,
+ f->fmt.pix.sizeimage = f->fmt.pix.height *
+ f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = 0;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+@@ -1232,7 +1231,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *fh,
+ f->fmt.pix.sizeimage = f->fmt.pix.height *
+ f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = 0;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c
+index 0a9047e754b9..71bf87204c5b 100644
+--- a/drivers/media/pci/saa7134/saa7134-empress.c
++++ b/drivers/media/pci/saa7134/saa7134-empress.c
+@@ -189,7 +189,6 @@ static int empress_g_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
+ f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets;
+ f->fmt.pix.bytesperline = 0;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+@@ -207,7 +206,6 @@ static int empress_s_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
+ f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets;
+ f->fmt.pix.bytesperline = 0;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+@@ -225,7 +223,6 @@ static int empress_try_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
+ f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets;
+ f->fmt.pix.bytesperline = 0;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c
+index 40396e8b16a8..c8c22156991b 100644
+--- a/drivers/media/pci/saa7134/saa7134-video.c
++++ b/drivers/media/pci/saa7134/saa7134-video.c
+@@ -1347,7 +1347,6 @@ static int saa7134_g_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.sizeimage =
+ f->fmt.pix.height * f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+- f->fmt.pix.priv = 0;
+ return 0;
+ }
+
+@@ -1429,7 +1428,6 @@ static int saa7134_try_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.sizeimage =
+ f->fmt.pix.height * f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c b/drivers/media/pci/sta2x11/sta2x11_vip.c
+index e5cfb6cfa18d..7219c598ef50 100644
+--- a/drivers/media/pci/sta2x11/sta2x11_vip.c
++++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
+@@ -642,7 +642,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.bytesperline = f->fmt.pix.width * 2;
+ f->fmt.pix.sizeimage = f->fmt.pix.width * 2 * f->fmt.pix.height;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+- f->fmt.pix.priv = 0;
+ return 0;
+ }
+
+diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
+index 61f3dbcc259f..21c31bc5c380 100644
+--- a/drivers/media/platform/coda.c
++++ b/drivers/media/platform/coda.c
+@@ -613,8 +613,6 @@ static int coda_try_fmt(struct coda_ctx *ctx, struct coda_codec *codec,
+ BUG();
+ }
+
+- f->fmt.pix.priv = 0;
+-
+ return 0;
+ }
+
+diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
+index dfd0a21a0658..17b44401948e 100644
+--- a/drivers/media/platform/omap/omap_vout.c
++++ b/drivers/media/platform/omap/omap_vout.c
+@@ -165,7 +165,6 @@ static int omap_vout_try_format(struct v4l2_pix_format *pix)
+
+ pix->pixelformat = omap_formats[ifmt].pixelformat;
+ pix->field = V4L2_FIELD_ANY;
+- pix->priv = 0;
+
+ switch (pix->pixelformat) {
+ case V4L2_PIX_FMT_YUYV:
+@@ -1895,7 +1894,6 @@ static int __init omap_vout_setup_video_data(struct omap_vout_device *vout)
+ pix->field = V4L2_FIELD_ANY;
+ pix->bytesperline = pix->width * 2;
+ pix->sizeimage = pix->bytesperline * pix->height;
+- pix->priv = 0;
+ pix->colorspace = V4L2_COLORSPACE_JPEG;
+
+ vout->bpp = RGB565_BPP;
+diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c
+index 744e43b480bc..8dc279d4d561 100644
+--- a/drivers/media/platform/sh_veu.c
++++ b/drivers/media/platform/sh_veu.c
+@@ -425,7 +425,6 @@ static int sh_veu_g_fmt(struct sh_veu_file *veu_file, struct v4l2_format *f)
+ pix->bytesperline = vfmt->bytesperline;
+ pix->sizeimage = vfmt->bytesperline * pix->height *
+ vfmt->fmt->depth / vfmt->fmt->ydepth;
+- pix->priv = 0;
+ dev_dbg(veu->dev, "%s(): type: %d, size %u @ %ux%u, fmt %x\n", __func__,
+ f->type, pix->sizeimage, pix->width, pix->height, pix->pixelformat);
+
+@@ -473,7 +472,6 @@ static int sh_veu_try_fmt(struct v4l2_format *f, const struct sh_veu_format *fmt
+
+ pix->pixelformat = fmt->fourcc;
+ pix->colorspace = sh_veu_4cc2cspace(pix->pixelformat);
+- pix->priv = 0;
+
+ pr_debug("%s(): type: %d, size %u\n", __func__, f->type, pix->sizeimage);
+
+diff --git a/drivers/media/platform/vino.c b/drivers/media/platform/vino.c
+index c6af974c5b45..e58796e66ab1 100644
+--- a/drivers/media/platform/vino.c
++++ b/drivers/media/platform/vino.c
+@@ -3147,7 +3147,6 @@ static int vino_try_fmt_vid_cap(struct file *file, void *__fh,
+ pf->colorspace =
+ vino_data_formats[tempvcs.data_format].colorspace;
+
+- pf->priv = 0;
+ return 0;
+ }
+
+@@ -3175,8 +3174,6 @@ static int vino_g_fmt_vid_cap(struct file *file, void *__fh,
+ pf->colorspace =
+ vino_data_formats[vcs->data_format].colorspace;
+
+- pf->priv = 0;
+-
+ spin_unlock_irqrestore(&vino_drvdata->input_lock, flags);
+ return 0;
+ }
+@@ -3219,8 +3216,6 @@ static int vino_s_fmt_vid_cap(struct file *file, void *__fh,
+ pf->colorspace =
+ vino_data_formats[vcs->data_format].colorspace;
+
+- pf->priv = 0;
+-
+ spin_unlock_irqrestore(&vino_drvdata->input_lock, flags);
+ return 0;
+ }
+diff --git a/drivers/media/platform/vivi.c b/drivers/media/platform/vivi.c
+index 2d4e73b45c5e..4807225d63db 100644
+--- a/drivers/media/platform/vivi.c
++++ b/drivers/media/platform/vivi.c
+@@ -1015,7 +1015,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+ else
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB;
+- f->fmt.pix.priv = 0;
+ return 0;
+ }
+
+diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
+index 2f63029e7a36..78a2e34a3286 100644
+--- a/drivers/media/usb/cx231xx/cx231xx-417.c
++++ b/drivers/media/usb/cx231xx/cx231xx-417.c
+@@ -1563,7 +1563,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.width = dev->ts1.width;
+ f->fmt.pix.height = dev->ts1.height;
+ f->fmt.pix.field = V4L2_FIELD_INTERLACED;
+- f->fmt.pix.priv = 0;
+ dprintk(1, "VIDIOC_G_FMT: w: %d, h: %d\n",
+ dev->ts1.width, dev->ts1.height);
+ dprintk(3, "exit vidioc_g_fmt_vid_cap()\n");
+@@ -1582,7 +1581,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.sizeimage = mpeglines * mpeglinesize;
+ f->fmt.pix.field = V4L2_FIELD_INTERLACED;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+- f->fmt.pix.priv = 0;
+ dprintk(1, "VIDIOC_TRY_FMT: w: %d, h: %d\n",
+ dev->ts1.width, dev->ts1.height);
+ dprintk(3, "exit vidioc_try_fmt_vid_cap()\n");
+diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
+index 990626101718..71f10832f97b 100644
+--- a/drivers/media/usb/cx231xx/cx231xx-video.c
++++ b/drivers/media/usb/cx231xx/cx231xx-video.c
+@@ -886,7 +886,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+
+ f->fmt.pix.field = V4L2_FIELD_INTERLACED;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+@@ -931,7 +930,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * height;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+ f->fmt.pix.field = V4L2_FIELD_INTERLACED;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
+index f3a7ace0fac9..1b3d7bf8dab6 100644
+--- a/drivers/media/usb/gspca/gspca.c
++++ b/drivers/media/usb/gspca/gspca.c
+@@ -1102,8 +1102,8 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
+ struct gspca_dev *gspca_dev = video_drvdata(file);
+
+ fmt->fmt.pix = gspca_dev->pixfmt;
+- /* some drivers use priv internally, zero it before giving it to
+- userspace */
++ /* some drivers use priv internally, zero it before giving it back to
++ the core */
+ fmt->fmt.pix.priv = 0;
+ return 0;
+ }
+@@ -1139,8 +1139,8 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
+ fmt->fmt.pix.height = h;
+ gspca_dev->sd_desc->try_fmt(gspca_dev, fmt);
+ }
+- /* some drivers use priv internally, zero it before giving it to
+- userspace */
++ /* some drivers use priv internally, zero it before giving it back to
++ the core */
+ fmt->fmt.pix.priv = 0;
+ return mode; /* used when s_fmt */
+ }
+diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c
+index 6bce01a674f9..caeae8ff365b 100644
+--- a/drivers/media/usb/hdpvr/hdpvr-video.c
++++ b/drivers/media/usb/hdpvr/hdpvr-video.c
+@@ -1022,7 +1022,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *_fh,
+ f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
+ f->fmt.pix.sizeimage = dev->bulk_in_size;
+ f->fmt.pix.bytesperline = 0;
+- f->fmt.pix.priv = 0;
+ if (f->fmt.pix.width == 720) {
+ /* SDTV formats */
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
+index be77482c3070..adfa8320849a 100644
+--- a/drivers/media/usb/stkwebcam/stk-webcam.c
++++ b/drivers/media/usb/stkwebcam/stk-webcam.c
+@@ -923,7 +923,6 @@ static int stk_vidioc_g_fmt_vid_cap(struct file *filp,
+ pix_format->bytesperline = 2 * pix_format->width;
+ pix_format->sizeimage = pix_format->bytesperline
+ * pix_format->height;
+- pix_format->priv = 0;
+ return 0;
+ }
+
+@@ -967,7 +966,6 @@ static int stk_try_fmt_vid_cap(struct file *filp,
+ fmtd->fmt.pix.bytesperline = 2 * fmtd->fmt.pix.width;
+ fmtd->fmt.pix.sizeimage = fmtd->fmt.pix.bytesperline
+ * fmtd->fmt.pix.height;
+- fmtd->fmt.pix.priv = 0;
+ return 0;
+ }
+
+diff --git a/drivers/media/usb/tlg2300/pd-video.c b/drivers/media/usb/tlg2300/pd-video.c
+index 8df668d06552..8cd7f02fcf9f 100644
+--- a/drivers/media/usb/tlg2300/pd-video.c
++++ b/drivers/media/usb/tlg2300/pd-video.c
+@@ -1321,7 +1321,6 @@ static void init_video_context(struct running_context *context)
+ .bytesperline = 720 * 2,
+ .sizeimage = 720 * 576 * 2,
+ .colorspace = V4L2_COLORSPACE_SMPTE170M,
+- .priv = 0
+ };
+ }
+
+diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
+index cc1aa14996ff..97ad689c794e 100644
+--- a/drivers/media/usb/tm6000/tm6000-video.c
++++ b/drivers/media/usb/tm6000/tm6000-video.c
+@@ -918,7 +918,6 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
+ (f->fmt.pix.width * fh->fmt->depth) >> 3;
+ f->fmt.pix.sizeimage =
+ f->fmt.pix.height * f->fmt.pix.bytesperline;
+- f->fmt.pix.priv = 0;
+
+ return 0;
+ }
+@@ -959,7 +958,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.width &= ~0x01;
+
+ f->fmt.pix.field = field;
+- f->fmt.pix.priv = 0;
+
+ f->fmt.pix.bytesperline =
+ (f->fmt.pix.width * fmt->depth) >> 3;
+diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
+index 74d56df3347f..0f63954ee1d4 100644
+--- a/drivers/media/usb/zr364xx/zr364xx.c
++++ b/drivers/media/usb/zr364xx/zr364xx.c
+@@ -806,7 +806,6 @@ static int zr364xx_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.bytesperline = f->fmt.pix.width * 2;
+ f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
+- f->fmt.pix.priv = 0;
+ DBG("%s: V4L2_PIX_FMT_%s (%d) ok!\n", __func__,
+ decode_fourcc(f->fmt.pix.pixelformat, pixelformat_name),
+ f->fmt.pix.field);
+@@ -829,7 +828,6 @@ static int zr364xx_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.bytesperline = f->fmt.pix.width * 2;
+ f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
+- f->fmt.pix.priv = 0;
+ return 0;
+ }
+
+@@ -866,7 +864,6 @@ static int zr364xx_vidioc_s_fmt_vid_cap(struct file *file, void *priv,
+ f->fmt.pix.bytesperline = f->fmt.pix.width * 2;
+ f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
+ f->fmt.pix.colorspace = V4L2_COLORSPACE_JPEG;
+- f->fmt.pix.priv = 0;
+ cam->vb_vidq.field = f->fmt.pix.field;
+
+ if (f->fmt.pix.width == 160 && f->fmt.pix.height == 120)
+diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+index fca336b65351..d0d6530c0b64 100644
+--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
++++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+@@ -540,7 +540,16 @@ struct v4l2_framebuffer32 {
+ __u32 capability;
+ __u32 flags;
+ compat_caddr_t base;
+- struct v4l2_pix_format fmt;
++ struct {
++ __u32 width;
++ __u32 height;
++ __u32 pixelformat;
++ __u32 field;
++ __u32 bytesperline;
++ __u32 sizeimage;
++ __u32 colorspace;
++ __u32 priv;
++ } fmt;
+ };
+
+ static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_framebuffer32 __user *up)
+@@ -550,10 +559,10 @@ static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
+ if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) ||
+ get_user(tmp, &up->base) ||
+ get_user(kp->capability, &up->capability) ||
+- get_user(kp->flags, &up->flags))
++ get_user(kp->flags, &up->flags) ||
++ copy_from_user(&kp->fmt, &up->fmt, sizeof(up->fmt)))
+ return -EFAULT;
+ kp->base = compat_ptr(tmp);
+- get_v4l2_pix_format(&kp->fmt, &up->fmt);
+ return 0;
+ }
+
+@@ -564,9 +573,9 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
+ if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) ||
+ put_user(tmp, &up->base) ||
+ put_user(kp->capability, &up->capability) ||
+- put_user(kp->flags, &up->flags))
++ put_user(kp->flags, &up->flags) ||
++ copy_to_user(&up->fmt, &kp->fmt, sizeof(up->fmt)))
+ return -EFAULT;
+- put_v4l2_pix_format(&kp->fmt, &up->fmt);
+ return 0;
+ }
+
+diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
+index 707aef705a47..feb9e3441c9d 100644
+--- a/drivers/media/v4l2-core/v4l2-ioctl.c
++++ b/drivers/media/v4l2-core/v4l2-ioctl.c
+@@ -936,13 +936,48 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type)
+ return -EINVAL;
+ }
+
++static void v4l_sanitize_format(struct v4l2_format *fmt)
++{
++ unsigned int offset;
++
++ /*
++ * The v4l2_pix_format structure has been extended with fields that were
++ * not previously required to be set to zero by applications. The priv
++ * field, when set to a magic value, indicates the the extended fields
++ * are valid. Otherwise they will contain undefined values. To simplify
++ * the API towards drivers zero the extended fields and set the priv
++ * field to the magic value when the extended pixel format structure
++ * isn't used by applications.
++ */
++
++ if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
++ fmt->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
++ return;
++
++ if (fmt->fmt.pix.priv == V4L2_PIX_FMT_PRIV_MAGIC)
++ return;
++
++ fmt->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
++
++ offset = offsetof(struct v4l2_pix_format, priv)
++ + sizeof(fmt->fmt.pix.priv);
++ memset(((void *)&fmt->fmt.pix) + offset, 0,
++ sizeof(fmt->fmt.pix) - offset);
++}
++
+ static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
+ struct file *file, void *fh, void *arg)
+ {
+ struct v4l2_capability *cap = (struct v4l2_capability *)arg;
++ int ret;
+
+ cap->version = LINUX_VERSION_CODE;
+- return ops->vidioc_querycap(file, fh, cap);
++
++ ret = ops->vidioc_querycap(file, fh, cap);
++
++ cap->capabilities |= V4L2_CAP_EXT_PIX_FORMAT;
++
++ return ret;
+ }
+
+ static int v4l_s_input(const struct v4l2_ioctl_ops *ops,
+@@ -1061,12 +1096,17 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops,
+ bool is_vid = vfd->vfl_type == VFL_TYPE_GRABBER;
+ bool is_rx = vfd->vfl_dir != VFL_DIR_TX;
+ bool is_tx = vfd->vfl_dir != VFL_DIR_RX;
++ int ret;
++
++ v4l_sanitize_format(p);
+
+ switch (p->type) {
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ if (unlikely(!is_rx || !is_vid || !ops->vidioc_g_fmt_vid_cap))
+ break;
+- return ops->vidioc_g_fmt_vid_cap(file, fh, arg);
++ ret = ops->vidioc_g_fmt_vid_cap(file, fh, arg);
++ p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
++ return ret;
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ if (unlikely(!is_rx || !is_vid || !ops->vidioc_g_fmt_vid_cap_mplane))
+ break;
+@@ -1086,7 +1126,9 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops,
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ if (unlikely(!is_tx || !is_vid || !ops->vidioc_g_fmt_vid_out))
+ break;
+- return ops->vidioc_g_fmt_vid_out(file, fh, arg);
++ ret = ops->vidioc_g_fmt_vid_out(file, fh, arg);
++ p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
++ return ret;
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+ if (unlikely(!is_tx || !is_vid || !ops->vidioc_g_fmt_vid_out_mplane))
+ break;
+@@ -1446,7 +1488,18 @@ static int v4l_create_bufs(const struct v4l2_ioctl_ops *ops,
+ struct v4l2_create_buffers *create = arg;
+ int ret = check_fmt(file, create->format.type);
+
+- return ret ? ret : ops->vidioc_create_bufs(file, fh, create);
++ if (ret)
++ return ret;
++
++ v4l_sanitize_format(&create->format);
++
++ ret = ops->vidioc_create_bufs(file, fh, create);
++
++ if (create->format.type == V4L2_BUF_TYPE_VIDEO_CAPTURE ||
++ create->format.type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
++ create->format.fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
++
++ return ret;
+ }
+
+ static int v4l_prepare_buf(const struct v4l2_ioctl_ops *ops,
+diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
+index 63274c1d037c..e6b41cf2c6b2 100644
+--- a/include/uapi/linux/videodev2.h
++++ b/include/uapi/linux/videodev2.h
+@@ -264,6 +264,7 @@ struct v4l2_capability {
+ #define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
+ #define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
+
++#define V4L2_CAP_EXT_PIX_FORMAT 0x00200000 /* Supports the extended pixel format */
+ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
+ #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
+ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
+@@ -439,6 +440,9 @@ struct v4l2_pix_format {
+ #define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
+ #define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */
+
++/* priv field value to indicates that subsequent fields are valid. */
++#define V4L2_PIX_FMT_PRIV_MAGIC 0xdeadbeef
++
+ /*
+ * F O R M A T E N U M E R A T I O N
+ */
+@@ -732,7 +736,16 @@ struct v4l2_framebuffer {
+ /* FIXME: in theory we should pass something like PCI device + memory
+ * region + offset instead of some physical address */
+ void *base;
+- struct v4l2_pix_format fmt;
++ struct {
++ __u32 width;
++ __u32 height;
++ __u32 pixelformat;
++ __u32 field; /* enum v4l2_field */
++ __u32 bytesperline; /* for padding, zero if unused */
++ __u32 sizeimage;
++ __u32 colorspace; /* enum v4l2_colorspace */
++ __u32 priv; /* private data, depends on pixelformat */
++ } fmt;
+ };
+ /* Flags for the 'capability' field. Read only */
+ #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
+--
+2.1.2
+
diff --git a/patches.renesas/0709-v4l-Add-premultiplied-alpha-flag-for-pixel-formats.patch b/patches.renesas/0709-v4l-Add-premultiplied-alpha-flag-for-pixel-formats.patch
new file mode 100644
index 00000000000000..4479307551e8d4
--- /dev/null
+++ b/patches.renesas/0709-v4l-Add-premultiplied-alpha-flag-for-pixel-formats.patch
@@ -0,0 +1,139 @@
+From 2873c1c928f340ce5aed3d37b81b5ffa37b9cba5 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 27 May 2014 15:12:43 +0200
+Subject: v4l: Add premultiplied alpha flag for pixel formats
+
+When set, the new V4L2_PIX_FMT_FLAG_PREMUL_ALPHA flag indicates that the
+pixel values are premultiplied by the alpha channel value.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+(cherry picked from commit e6619dfbf287a75082ec04bc2a8d2df6e3a16299)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+Conflicts:
+ Documentation/DocBook/media/v4l/v4l2.xml
+---
+ Documentation/DocBook/media/v4l/pixfmt.xml | 28 +++++++++++++++++++++++++++-
+ drivers/media/v4l2-core/v4l2-ioctl.c | 5 +++--
+ include/uapi/linux/videodev2.h | 8 +++++++-
+ 3 files changed, 37 insertions(+), 4 deletions(-)
+
+diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml
+index 6e1e520a2750..75882a4b4d3d 100644
+--- a/Documentation/DocBook/media/v4l/pixfmt.xml
++++ b/Documentation/DocBook/media/v4l/pixfmt.xml
+@@ -126,6 +126,12 @@ extended fields were set to zero. On return drivers must set the
+ <constant>V4L2_PIX_FMT_PRIV_MAGIC</constant> and all the extended field to
+ applicable values.</para></entry>
+ </row>
++ <row>
++ <entry>__u32</entry>
++ <entry><structfield>flags</structfield></entry>
++ <entry>Flags set by the application or driver, see <xref
++linkend="format-flags" />.</entry>
++ </row>
+ </tbody>
+ </tgroup>
+ </table>
+@@ -211,9 +217,15 @@ codes can be used.</entry>
+ and the number of valid entries in the
+ <structfield>plane_fmt</structfield> array.</entry>
+ </row>
++ <row>
++ <entry>__u8</entry>
++ <entry><structfield>flags</structfield></entry>
++ <entry>Flags set by the application or driver, see <xref
++linkend="format-flags" />.</entry>
++ </row>
+ <row>
+ <entry>__u8</entry>
+- <entry><structfield>reserved[11]</structfield></entry>
++ <entry><structfield>reserved[10]</structfield></entry>
+ <entry>Reserved for future extensions. Should be zeroed by the
+ application.</entry>
+ </row>
+@@ -1059,4 +1071,18 @@ concatenated to form the JPEG stream. </para>
+ </tbody>
+ </tgroup>
+ </table>
++
++ <table frame="none" pgwide="1" id="format-flags">
++ <title>Format Flags</title>
++ <tgroup cols="3">
++ &cs-def;
++ <tbody valign="top">
++ <row>
++ <entry><constant>V4L2_PIX_FMT_FLAG_PREMUL_ALPHA</constant></entry>
++ <entry>0x00000001</entry>
++ <entry>The pixel values are premultiplied by the alpha channel value.</entry>
++ </row>
++ </tbody>
++ </tgroup>
++ </table>
+ </section>
+diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
+index feb9e3441c9d..9692009cfc4e 100644
+--- a/drivers/media/v4l2-core/v4l2-ioctl.c
++++ b/drivers/media/v4l2-core/v4l2-ioctl.c
+@@ -254,7 +254,8 @@ static void v4l_print_format(const void *arg, bool write_only)
+ pix = &p->fmt.pix;
+ pr_cont(", width=%u, height=%u, "
+ "pixelformat=%c%c%c%c, field=%s, "
+- "bytesperline=%u, sizeimage=%u, colorspace=%d\n",
++ "bytesperline=%u, sizeimage=%u, colorspace=%d, "
++ "flags %u\n",
+ pix->width, pix->height,
+ (pix->pixelformat & 0xff),
+ (pix->pixelformat >> 8) & 0xff,
+@@ -262,7 +263,7 @@ static void v4l_print_format(const void *arg, bool write_only)
+ (pix->pixelformat >> 24) & 0xff,
+ prt_names(pix->field, v4l2_field_names),
+ pix->bytesperline, pix->sizeimage,
+- pix->colorspace);
++ pix->colorspace, pix->flags);
+ break;
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
+index e6b41cf2c6b2..8d6646ea9c33 100644
+--- a/include/uapi/linux/videodev2.h
++++ b/include/uapi/linux/videodev2.h
+@@ -283,6 +283,7 @@ struct v4l2_pix_format {
+ __u32 sizeimage;
+ __u32 colorspace; /* enum v4l2_colorspace */
+ __u32 priv; /* private data, depends on pixelformat */
++ __u32 flags; /* format flags (V4L2_PIX_FMT_FLAG_*) */
+ };
+
+ /* Pixel format FOURCC depth Description */
+@@ -443,6 +444,9 @@ struct v4l2_pix_format {
+ /* priv field value to indicates that subsequent fields are valid. */
+ #define V4L2_PIX_FMT_PRIV_MAGIC 0xdeadbeef
+
++/* Flags */
++#define V4L2_PIX_FMT_FLAG_PREMUL_ALPHA 0x00000001
++
+ /*
+ * F O R M A T E N U M E R A T I O N
+ */
+@@ -1699,6 +1703,7 @@ struct v4l2_plane_pix_format {
+ * @colorspace: enum v4l2_colorspace; supplemental to pixelformat
+ * @plane_fmt: per-plane information
+ * @num_planes: number of planes for this format
++ * @flags: format flags (V4L2_PIX_FMT_FLAG_*)
+ */
+ struct v4l2_pix_format_mplane {
+ __u32 width;
+@@ -1709,7 +1714,8 @@ struct v4l2_pix_format_mplane {
+
+ struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
+ __u8 num_planes;
+- __u8 reserved[11];
++ __u8 flags;
++ __u8 reserved[10];
+ } __attribute__ ((packed));
+
+ /**
+--
+2.1.2
+
diff --git a/patches.renesas/0710-v4l-vb2-Fix-stream-start-and-buffer-completion-race.patch b/patches.renesas/0710-v4l-vb2-Fix-stream-start-and-buffer-completion-race.patch
new file mode 100644
index 00000000000000..04897cd3606339
--- /dev/null
+++ b/patches.renesas/0710-v4l-vb2-Fix-stream-start-and-buffer-completion-race.patch
@@ -0,0 +1,43 @@
+From dbe3c838841c240191362b722a7f1109ef1b077f Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 23 Jun 2014 23:00:22 +0200
+Subject: v4l: vb2: Fix stream start and buffer completion race
+
+videobuf2 stores the driver streaming state internally in the queue in
+the start_streaming_called variable. The state is set right after the
+driver start_stream operation returns, and checked in the
+vb2_buffer_done() function, typically called from the frame completion
+interrupt handler. A race condition exists if the hardware finishes
+processing the first frame before the start_stream operation returns.
+
+Fix this by setting start_streaming_called to 1 before calling the
+start_stream operation, and resetting it to 0 if the operation fails.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+(cherry picked from commit 752bfe5395aa0609def7292c97a37c314ace5837)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+Conflicts:
+ drivers/media/v4l2-core/videobuf2-core.c
+---
+ drivers/media/v4l2-core/videobuf2-core.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/media/v4l2-core/videobuf2-core.c
++++ b/drivers/media/v4l2-core/videobuf2-core.c
+@@ -1429,12 +1429,14 @@ static int vb2_start_streaming(struct vb
+ __enqueue_in_driver(vb);
+
+ /* Tell the driver to start streaming */
++ q->start_streaming_called = 1;
+ ret = call_qop(q, start_streaming, q,
+ atomic_read(&q->owned_by_drv_count));
+- q->start_streaming_called = ret == 0;
+ if (!ret)
+ return 0;
+
++ q->start_streaming_called = 0;
++
+ dprintk(1, "qbuf: driver refused to start streaming\n");
+ if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
+ unsigned i;
diff --git a/patches.renesas/0711-PCI-rcar-Remove-redundant-config-accessor-register-n.patch b/patches.renesas/0711-PCI-rcar-Remove-redundant-config-accessor-register-n.patch
new file mode 100644
index 00000000000000..45139fd658e2d1
--- /dev/null
+++ b/patches.renesas/0711-PCI-rcar-Remove-redundant-config-accessor-register-n.patch
@@ -0,0 +1,50 @@
+From eabaac5c3ed4be41aa240d07bf82fd9fd1ad5f81 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Fri, 27 Jun 2014 18:59:13 +0400
+Subject: PCI: rcar: Remove redundant config accessor register number checks
+
+The PCI core will have already checked the configuration register address
+before calling the {read|write}() methods; so don't check it again in these
+methods.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Acked-by: Phil Edworthy <phil.edworthy@renesas.com>
+Acked-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 8eb12c3b420fb5243ce9b4a8878f3b88a3c91e33)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/pci/host/pcie-rcar.c | 10 ----------
+ 1 file changed, 10 deletions(-)
+
+diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
+index 8e06124aa80f..c06b88846764 100644
+--- a/drivers/pci/host/pcie-rcar.c
++++ b/drivers/pci/host/pcie-rcar.c
+@@ -260,11 +260,6 @@ static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
+ struct rcar_pcie *pcie = sys_to_pcie(bus->sysdata);
+ int ret;
+
+- if ((size == 2) && (where & 1))
+- return PCIBIOS_BAD_REGISTER_NUMBER;
+- else if ((size == 4) && (where & 3))
+- return PCIBIOS_BAD_REGISTER_NUMBER;
+-
+ ret = rcar_pcie_config_access(pcie, PCI_ACCESS_READ,
+ bus, devfn, where, val);
+ if (ret != PCIBIOS_SUCCESSFUL) {
+@@ -292,11 +287,6 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
+ int shift, ret;
+ u32 data;
+
+- if ((size == 2) && (where & 1))
+- return PCIBIOS_BAD_REGISTER_NUMBER;
+- else if ((size == 4) && (where & 3))
+- return PCIBIOS_BAD_REGISTER_NUMBER;
+-
+ ret = rcar_pcie_config_access(pcie, PCI_ACCESS_READ,
+ bus, devfn, where, &data);
+ if (ret != PCIBIOS_SUCCESSFUL)
+--
+2.1.2
+
diff --git a/patches.renesas/0712-PCI-rcar-Use-correct-initial-HW-settings.patch b/patches.renesas/0712-PCI-rcar-Use-correct-initial-HW-settings.patch
new file mode 100644
index 00000000000000..131cdc8c034a3d
--- /dev/null
+++ b/patches.renesas/0712-PCI-rcar-Use-correct-initial-HW-settings.patch
@@ -0,0 +1,73 @@
+From 9be63ab64057d7450d9201429a34add28104a0f9 Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Mon, 30 Jun 2014 08:54:22 +0100
+Subject: PCI: rcar: Use correct initial HW settings
+
+Although the R-Car PCIe driver works as it is, there are a number of
+incorrect settings that this patch corrects. It corrects:
+ - enabling the PCI Express Extended Cap ID.
+ - setting Data Link Layer Link Active Reporting Capable.
+ - terminating list of capabilities.
+
+It also removes enabling the MAC data scrambling as this is the default HW
+setting, and removes incorrect code to enable slave bus mastering as this
+is done by the PCI core.
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Acked-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 2c3fd4c935880d756cb57f4bcdb35bb4b8348ec8)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/pci/host/pcie-rcar.c | 15 ++++-----------
+ 1 file changed, 4 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
+index c06b88846764..680a8ccdcc24 100644
+--- a/drivers/pci/host/pcie-rcar.c
++++ b/drivers/pci/host/pcie-rcar.c
+@@ -483,14 +483,15 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
+ rcar_rmw32(pcie, RCONF(PCI_SUBORDINATE_BUS), 0xff, 1);
+
+ /* Initialize default capabilities. */
+- rcar_rmw32(pcie, REXPCAP(0), 0, PCI_CAP_ID_EXP);
++ rcar_rmw32(pcie, REXPCAP(0), 0xff, PCI_CAP_ID_EXP);
+ rcar_rmw32(pcie, REXPCAP(PCI_EXP_FLAGS),
+ PCI_EXP_FLAGS_TYPE, PCI_EXP_TYPE_ROOT_PORT << 4);
+ rcar_rmw32(pcie, RCONF(PCI_HEADER_TYPE), 0x7f,
+ PCI_HEADER_TYPE_BRIDGE);
+
+ /* Enable data link layer active state reporting */
+- rcar_rmw32(pcie, REXPCAP(PCI_EXP_LNKCAP), 0, PCI_EXP_LNKCAP_DLLLARC);
++ rcar_rmw32(pcie, REXPCAP(PCI_EXP_LNKCAP), PCI_EXP_LNKCAP_DLLLARC,
++ PCI_EXP_LNKCAP_DLLLARC);
+
+ /* Write out the physical slot number = 0 */
+ rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0);
+@@ -499,10 +500,7 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
+ rcar_rmw32(pcie, TLCTLR+1, 0x3f, 50);
+
+ /* Terminate list of capabilities (Next Capability Offset=0) */
+- rcar_rmw32(pcie, RVCCAP(0), 0xfff0, 0);
+-
+- /* Enable MAC data scrambling. */
+- rcar_rmw32(pcie, MACCTLR, SCRAMBLE_DISABLE, 0);
++ rcar_rmw32(pcie, RVCCAP(0), 0xfff00000, 0);
+
+ /* Enable MSI */
+ if (IS_ENABLED(CONFIG_PCI_MSI))
+@@ -519,11 +517,6 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
+ /* Enable INTx interrupts */
+ rcar_rmw32(pcie, PCIEINTXR, 0, 0xF << 8);
+
+- /* Enable slave Bus Mastering */
+- rcar_rmw32(pcie, RCONF(PCI_STATUS), PCI_STATUS_DEVSEL_MASK,
+- PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
+- PCI_STATUS_CAP_LIST | PCI_STATUS_DEVSEL_FAST);
+-
+ wmb();
+
+ return 0;
+--
+2.1.2
+
diff --git a/patches.renesas/0713-PCI-rcar-Cleanup-style-and-formatting.patch b/patches.renesas/0713-PCI-rcar-Cleanup-style-and-formatting.patch
new file mode 100644
index 00000000000000..594dc3da6288e5
--- /dev/null
+++ b/patches.renesas/0713-PCI-rcar-Cleanup-style-and-formatting.patch
@@ -0,0 +1,406 @@
+From c3bafe6cf688577efac87e66a4415889f3777d31 Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Mon, 30 Jun 2014 08:54:23 +0100
+Subject: PCI: rcar: Cleanup style and formatting
+
+This patch just makes symbol and function name changes to avoid potential
+conflicts, along with minor formatting changes.
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Acked-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit b77188495de64abb5393cb96ac5ec518cf386310)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/pci/host/pcie-rcar.c | 124 ++++++++++++++++++++++---------------------
+ 1 file changed, 63 insertions(+), 61 deletions(-)
+
+diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
+index 680a8ccdcc24..758e2b4645f1 100644
+--- a/drivers/pci/host/pcie-rcar.c
++++ b/drivers/pci/host/pcie-rcar.c
+@@ -105,7 +105,7 @@
+ #define PCIE_CONF_DEV(d) (((d) & 0x1f) << 19)
+ #define PCIE_CONF_FUNC(f) (((f) & 0x7) << 16)
+
+-#define PCI_MAX_RESOURCES 4
++#define RCAR_PCI_MAX_RESOURCES 4
+ #define MAX_NR_INBOUND_MAPS 6
+
+ struct rcar_msi {
+@@ -127,7 +127,7 @@ static inline struct rcar_msi *to_rcar_msi(struct msi_chip *chip)
+ struct rcar_pcie {
+ struct device *dev;
+ void __iomem *base;
+- struct resource res[PCI_MAX_RESOURCES];
++ struct resource res[RCAR_PCI_MAX_RESOURCES];
+ struct resource busn;
+ int root_bus_nr;
+ struct clk *clk;
+@@ -140,36 +140,37 @@ static inline struct rcar_pcie *sys_to_pcie(struct pci_sys_data *sys)
+ return sys->private_data;
+ }
+
+-static void pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
+- unsigned long reg)
++static void rcar_pci_write_reg(struct rcar_pcie *pcie, unsigned long val,
++ unsigned long reg)
+ {
+ writel(val, pcie->base + reg);
+ }
+
+-static unsigned long pci_read_reg(struct rcar_pcie *pcie, unsigned long reg)
++static unsigned long rcar_pci_read_reg(struct rcar_pcie *pcie,
++ unsigned long reg)
+ {
+ return readl(pcie->base + reg);
+ }
+
+ enum {
+- PCI_ACCESS_READ,
+- PCI_ACCESS_WRITE,
++ RCAR_PCI_ACCESS_READ,
++ RCAR_PCI_ACCESS_WRITE,
+ };
+
+ static void rcar_rmw32(struct rcar_pcie *pcie, int where, u32 mask, u32 data)
+ {
+ int shift = 8 * (where & 3);
+- u32 val = pci_read_reg(pcie, where & ~3);
++ u32 val = rcar_pci_read_reg(pcie, where & ~3);
+
+ val &= ~(mask << shift);
+ val |= data << shift;
+- pci_write_reg(pcie, val, where & ~3);
++ rcar_pci_write_reg(pcie, val, where & ~3);
+ }
+
+ static u32 rcar_read_conf(struct rcar_pcie *pcie, int where)
+ {
+ int shift = 8 * (where & 3);
+- u32 val = pci_read_reg(pcie, where & ~3);
++ u32 val = rcar_pci_read_reg(pcie, where & ~3);
+
+ return val >> shift;
+ }
+@@ -205,14 +206,14 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
+ if (dev != 0)
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+- if (access_type == PCI_ACCESS_READ) {
+- *data = pci_read_reg(pcie, PCICONF(index));
++ if (access_type == RCAR_PCI_ACCESS_READ) {
++ *data = rcar_pci_read_reg(pcie, PCICONF(index));
+ } else {
+ /* Keep an eye out for changes to the root bus number */
+ if (pci_is_root_bus(bus) && (reg == PCI_PRIMARY_BUS))
+ pcie->root_bus_nr = *data & 0xff;
+
+- pci_write_reg(pcie, *data, PCICONF(index));
++ rcar_pci_write_reg(pcie, *data, PCICONF(index));
+ }
+
+ return PCIBIOS_SUCCESSFUL;
+@@ -222,20 +223,20 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+ /* Clear errors */
+- pci_write_reg(pcie, pci_read_reg(pcie, PCIEERRFR), PCIEERRFR);
++ rcar_pci_write_reg(pcie, rcar_pci_read_reg(pcie, PCIEERRFR), PCIEERRFR);
+
+ /* Set the PIO address */
+- pci_write_reg(pcie, PCIE_CONF_BUS(bus->number) | PCIE_CONF_DEV(dev) |
+- PCIE_CONF_FUNC(func) | reg, PCIECAR);
++ rcar_pci_write_reg(pcie, PCIE_CONF_BUS(bus->number) |
++ PCIE_CONF_DEV(dev) | PCIE_CONF_FUNC(func) | reg, PCIECAR);
+
+ /* Enable the configuration access */
+ if (bus->parent->number == pcie->root_bus_nr)
+- pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE0, PCIECCTLR);
++ rcar_pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE0, PCIECCTLR);
+ else
+- pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE1, PCIECCTLR);
++ rcar_pci_write_reg(pcie, CONFIG_SEND_ENABLE | TYPE1, PCIECCTLR);
+
+ /* Check for errors */
+- if (pci_read_reg(pcie, PCIEERRFR) & UNSUPPORTED_REQUEST)
++ if (rcar_pci_read_reg(pcie, PCIEERRFR) & UNSUPPORTED_REQUEST)
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+ /* Check for master and target aborts */
+@@ -243,13 +244,13 @@ static int rcar_pcie_config_access(struct rcar_pcie *pcie,
+ (PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT))
+ return PCIBIOS_DEVICE_NOT_FOUND;
+
+- if (access_type == PCI_ACCESS_READ)
+- *data = pci_read_reg(pcie, PCIECDR);
++ if (access_type == RCAR_PCI_ACCESS_READ)
++ *data = rcar_pci_read_reg(pcie, PCIECDR);
+ else
+- pci_write_reg(pcie, *data, PCIECDR);
++ rcar_pci_write_reg(pcie, *data, PCIECDR);
+
+ /* Disable the configuration access */
+- pci_write_reg(pcie, 0, PCIECCTLR);
++ rcar_pci_write_reg(pcie, 0, PCIECCTLR);
+
+ return PCIBIOS_SUCCESSFUL;
+ }
+@@ -260,7 +261,7 @@ static int rcar_pcie_read_conf(struct pci_bus *bus, unsigned int devfn,
+ struct rcar_pcie *pcie = sys_to_pcie(bus->sysdata);
+ int ret;
+
+- ret = rcar_pcie_config_access(pcie, PCI_ACCESS_READ,
++ ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ,
+ bus, devfn, where, val);
+ if (ret != PCIBIOS_SUCCESSFUL) {
+ *val = 0xffffffff;
+@@ -287,7 +288,7 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
+ int shift, ret;
+ u32 data;
+
+- ret = rcar_pcie_config_access(pcie, PCI_ACCESS_READ,
++ ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_READ,
+ bus, devfn, where, &data);
+ if (ret != PCIBIOS_SUCCESSFUL)
+ return ret;
+@@ -307,7 +308,7 @@ static int rcar_pcie_write_conf(struct pci_bus *bus, unsigned int devfn,
+ } else
+ data = val;
+
+- ret = rcar_pcie_config_access(pcie, PCI_ACCESS_WRITE,
++ ret = rcar_pcie_config_access(pcie, RCAR_PCI_ACCESS_WRITE,
+ bus, devfn, where, &data);
+
+ return ret;
+@@ -325,7 +326,7 @@ static void rcar_pcie_setup_window(int win, struct resource *res,
+ resource_size_t size;
+ u32 mask;
+
+- pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win));
++ rcar_pci_write_reg(pcie, 0x00000000, PCIEPTCTLR(win));
+
+ /*
+ * The PAMR mask is calculated in units of 128Bytes, which
+@@ -333,17 +334,17 @@ static void rcar_pcie_setup_window(int win, struct resource *res,
+ */
+ size = resource_size(res);
+ mask = (roundup_pow_of_two(size) / SZ_128) - 1;
+- pci_write_reg(pcie, mask << 7, PCIEPAMR(win));
++ rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win));
+
+- pci_write_reg(pcie, upper_32_bits(res->start), PCIEPARH(win));
+- pci_write_reg(pcie, lower_32_bits(res->start), PCIEPARL(win));
++ rcar_pci_write_reg(pcie, upper_32_bits(res->start), PCIEPARH(win));
++ rcar_pci_write_reg(pcie, lower_32_bits(res->start), PCIEPARL(win));
+
+ /* First resource is for IO */
+ mask = PAR_ENABLE;
+ if (res->flags & IORESOURCE_IO)
+ mask |= IO_SPACE;
+
+- pci_write_reg(pcie, mask, PCIEPTCTLR(win));
++ rcar_pci_write_reg(pcie, mask, PCIEPTCTLR(win));
+ }
+
+ static int rcar_pcie_setup(int nr, struct pci_sys_data *sys)
+@@ -355,7 +356,7 @@ static int rcar_pcie_setup(int nr, struct pci_sys_data *sys)
+ pcie->root_bus_nr = -1;
+
+ /* Setup PCI resources */
+- for (i = 0; i < PCI_MAX_RESOURCES; i++) {
++ for (i = 0; i < RCAR_PCI_MAX_RESOURCES; i++) {
+
+ res = &pcie->res[i];
+ if (!res->flags)
+@@ -407,7 +408,7 @@ static int phy_wait_for_ack(struct rcar_pcie *pcie)
+ unsigned int timeout = 100;
+
+ while (timeout--) {
+- if (pci_read_reg(pcie, H1_PCIEPHYADRR) & PHY_ACK)
++ if (rcar_pci_read_reg(pcie, H1_PCIEPHYADRR) & PHY_ACK)
+ return 0;
+
+ udelay(100);
+@@ -430,15 +431,15 @@ static void phy_write_reg(struct rcar_pcie *pcie,
+ ((addr & 0xff) << ADR_POS);
+
+ /* Set write data */
+- pci_write_reg(pcie, data, H1_PCIEPHYDOUTR);
+- pci_write_reg(pcie, phyaddr, H1_PCIEPHYADRR);
++ rcar_pci_write_reg(pcie, data, H1_PCIEPHYDOUTR);
++ rcar_pci_write_reg(pcie, phyaddr, H1_PCIEPHYADRR);
+
+ /* Ignore errors as they will be dealt with if the data link is down */
+ phy_wait_for_ack(pcie);
+
+ /* Clear command */
+- pci_write_reg(pcie, 0, H1_PCIEPHYDOUTR);
+- pci_write_reg(pcie, 0, H1_PCIEPHYADRR);
++ rcar_pci_write_reg(pcie, 0, H1_PCIEPHYDOUTR);
++ rcar_pci_write_reg(pcie, 0, H1_PCIEPHYADRR);
+
+ /* Ignore errors as they will be dealt with if the data link is down */
+ phy_wait_for_ack(pcie);
+@@ -449,7 +450,7 @@ static int rcar_pcie_wait_for_dl(struct rcar_pcie *pcie)
+ unsigned int timeout = 10;
+
+ while (timeout--) {
+- if ((pci_read_reg(pcie, PCIETSTR) & DATA_LINK_ACTIVE))
++ if ((rcar_pci_read_reg(pcie, PCIETSTR) & DATA_LINK_ACTIVE))
+ return 0;
+
+ msleep(5);
+@@ -463,17 +464,17 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
+ int err;
+
+ /* Begin initialization */
+- pci_write_reg(pcie, 0, PCIETCTLR);
++ rcar_pci_write_reg(pcie, 0, PCIETCTLR);
+
+ /* Set mode */
+- pci_write_reg(pcie, 1, PCIEMSR);
++ rcar_pci_write_reg(pcie, 1, PCIEMSR);
+
+ /*
+ * Initial header for port config space is type 1, set the device
+ * class to match. Hardware takes care of propagating the IDSETR
+ * settings, so there is no need to bother with a quirk.
+ */
+- pci_write_reg(pcie, PCI_CLASS_BRIDGE_PCI << 16, IDSETR1);
++ rcar_pci_write_reg(pcie, PCI_CLASS_BRIDGE_PCI << 16, IDSETR1);
+
+ /*
+ * Setup Secondary Bus Number & Subordinate Bus Number, even though
+@@ -497,17 +498,17 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
+ rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0);
+
+ /* Set the completion timer timeout to the maximum 50ms. */
+- rcar_rmw32(pcie, TLCTLR+1, 0x3f, 50);
++ rcar_rmw32(pcie, TLCTLR + 1, 0x3f, 50);
+
+ /* Terminate list of capabilities (Next Capability Offset=0) */
+ rcar_rmw32(pcie, RVCCAP(0), 0xfff00000, 0);
+
+ /* Enable MSI */
+ if (IS_ENABLED(CONFIG_PCI_MSI))
+- pci_write_reg(pcie, 0x101f0000, PCIEMSITXR);
++ rcar_pci_write_reg(pcie, 0x101f0000, PCIEMSITXR);
+
+ /* Finish initialization - establish a PCI Express link */
+- pci_write_reg(pcie, CFINIT, PCIETCTLR);
++ rcar_pci_write_reg(pcie, CFINIT, PCIETCTLR);
+
+ /* This will timeout if we don't have a link. */
+ err = rcar_pcie_wait_for_dl(pcie);
+@@ -545,7 +546,7 @@ static int rcar_pcie_hw_init_h1(struct rcar_pcie *pcie)
+ phy_write_reg(pcie, 0, 0x66, 0x1, 0x00008000);
+
+ while (timeout--) {
+- if (pci_read_reg(pcie, H1_PCIEPHYSR))
++ if (rcar_pci_read_reg(pcie, H1_PCIEPHYSR))
+ return rcar_pcie_hw_init(pcie);
+
+ msleep(5);
+@@ -584,7 +585,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
+ struct rcar_msi *msi = &pcie->msi;
+ unsigned long reg;
+
+- reg = pci_read_reg(pcie, PCIEMSIFR);
++ reg = rcar_pci_read_reg(pcie, PCIEMSIFR);
+
+ /* MSI & INTx share an interrupt - we only handle MSI here */
+ if (!reg)
+@@ -595,7 +596,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
+ unsigned int irq;
+
+ /* clear the interrupt */
+- pci_write_reg(pcie, 1 << index, PCIEMSIFR);
++ rcar_pci_write_reg(pcie, 1 << index, PCIEMSIFR);
+
+ irq = irq_find_mapping(msi->domain, index);
+ if (irq) {
+@@ -609,7 +610,7 @@ static irqreturn_t rcar_pcie_msi_irq(int irq, void *data)
+ }
+
+ /* see if there's any more pending in this vector */
+- reg = pci_read_reg(pcie, PCIEMSIFR);
++ reg = rcar_pci_read_reg(pcie, PCIEMSIFR);
+ }
+
+ return IRQ_HANDLED;
+@@ -636,8 +637,8 @@ static int rcar_msi_setup_irq(struct msi_chip *chip, struct pci_dev *pdev,
+
+ irq_set_msi_desc(irq, desc);
+
+- msg.address_lo = pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE;
+- msg.address_hi = pci_read_reg(pcie, PCIEMSIAUR);
++ msg.address_lo = rcar_pci_read_reg(pcie, PCIEMSIALR) & ~MSIFE;
++ msg.address_hi = rcar_pci_read_reg(pcie, PCIEMSIAUR);
+ msg.data = hwirq;
+
+ write_msi_msg(irq, &msg);
+@@ -714,11 +715,11 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
+ msi->pages = __get_free_pages(GFP_KERNEL, 0);
+ base = virt_to_phys((void *)msi->pages);
+
+- pci_write_reg(pcie, base | MSIFE, PCIEMSIALR);
+- pci_write_reg(pcie, 0, PCIEMSIAUR);
++ rcar_pci_write_reg(pcie, base | MSIFE, PCIEMSIALR);
++ rcar_pci_write_reg(pcie, 0, PCIEMSIAUR);
+
+ /* enable all MSI interrupts */
+- pci_write_reg(pcie, 0xffffffff, PCIEMSIIER);
++ rcar_pci_write_reg(pcie, 0xffffffff, PCIEMSIIER);
+
+ return 0;
+
+@@ -811,6 +812,7 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
+ if (cpu_addr > 0) {
+ unsigned long nr_zeros = __ffs64(cpu_addr);
+ u64 alignment = 1ULL << nr_zeros;
++
+ size = min(range->size, alignment);
+ } else {
+ size = range->size;
+@@ -826,13 +828,13 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie,
+ * Set up 64-bit inbound regions as the range parser doesn't
+ * distinguish between 32 and 64-bit types.
+ */
+- pci_write_reg(pcie, lower_32_bits(pci_addr), PCIEPRAR(idx));
+- pci_write_reg(pcie, lower_32_bits(cpu_addr), PCIELAR(idx));
+- pci_write_reg(pcie, lower_32_bits(mask) | flags, PCIELAMR(idx));
++ rcar_pci_write_reg(pcie, lower_32_bits(pci_addr), PCIEPRAR(idx));
++ rcar_pci_write_reg(pcie, lower_32_bits(cpu_addr), PCIELAR(idx));
++ rcar_pci_write_reg(pcie, lower_32_bits(mask) | flags, PCIELAMR(idx));
+
+- pci_write_reg(pcie, upper_32_bits(pci_addr), PCIEPRAR(idx+1));
+- pci_write_reg(pcie, upper_32_bits(cpu_addr), PCIELAR(idx+1));
+- pci_write_reg(pcie, 0, PCIELAMR(idx+1));
++ rcar_pci_write_reg(pcie, upper_32_bits(pci_addr), PCIEPRAR(idx+1));
++ rcar_pci_write_reg(pcie, upper_32_bits(cpu_addr), PCIELAR(idx+1));
++ rcar_pci_write_reg(pcie, 0, PCIELAMR(idx + 1));
+
+ pci_addr += size;
+ cpu_addr += size;
+@@ -937,7 +939,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
+ of_pci_range_to_resource(&range, pdev->dev.of_node,
+ &pcie->res[win++]);
+
+- if (win > PCI_MAX_RESOURCES)
++ if (win > RCAR_PCI_MAX_RESOURCES)
+ break;
+ }
+
+@@ -967,7 +969,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
+ return 0;
+ }
+
+- data = pci_read_reg(pcie, MACSR);
++ data = rcar_pci_read_reg(pcie, MACSR);
+ dev_info(&pdev->dev, "PCIe x%d: link up\n", (data >> 20) & 0x3f);
+
+ rcar_pcie_enable(pcie);
+--
+2.1.2
+
diff --git a/patches.renesas/0714-PCI-rcar-Remove-rcar_pcie_setup_window-resource-argu.patch b/patches.renesas/0714-PCI-rcar-Remove-rcar_pcie_setup_window-resource-argu.patch
new file mode 100644
index 00000000000000..32ae667746c712
--- /dev/null
+++ b/patches.renesas/0714-PCI-rcar-Remove-rcar_pcie_setup_window-resource-argu.patch
@@ -0,0 +1,49 @@
+From bd3a7f225bd4d7278fcbb9d041109e635754c76c Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Mon, 30 Jun 2014 09:37:01 +0100
+Subject: PCI: rcar: Remove rcar_pcie_setup_window() resource argument
+
+rcar_pcie_setup_window() took both the window number and the resource,
+which was redundant because we can look up the resource from the window
+number.
+
+Remove the "res" argument.
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Acked-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 0549252a1da98c5c39610e1700a9a1755acd0a70)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/pci/host/pcie-rcar.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
+index 758e2b4645f1..efdea0766b64 100644
+--- a/drivers/pci/host/pcie-rcar.c
++++ b/drivers/pci/host/pcie-rcar.c
+@@ -319,9 +319,10 @@ static struct pci_ops rcar_pcie_ops = {
+ .write = rcar_pcie_write_conf,
+ };
+
+-static void rcar_pcie_setup_window(int win, struct resource *res,
+- struct rcar_pcie *pcie)
++static void rcar_pcie_setup_window(int win, struct rcar_pcie *pcie)
+ {
++ struct resource *res = &pcie->res[win];
++
+ /* Setup PCIe address space mappings for each resource */
+ resource_size_t size;
+ u32 mask;
+@@ -362,7 +363,7 @@ static int rcar_pcie_setup(int nr, struct pci_sys_data *sys)
+ if (!res->flags)
+ continue;
+
+- rcar_pcie_setup_window(i, res, pcie);
++ rcar_pcie_setup_window(i, pcie);
+
+ if (res->flags & IORESOURCE_IO)
+ pci_ioremap_io(nr * SZ_64K, res->start);
+--
+2.1.2
+
diff --git a/patches.renesas/0715-spi-rspi-Remove-unused-variable-in-rspi_rz_transfer_.patch b/patches.renesas/0715-spi-rspi-Remove-unused-variable-in-rspi_rz_transfer_.patch
new file mode 100644
index 00000000000000..d91fca98f6953b
--- /dev/null
+++ b/patches.renesas/0715-spi-rspi-Remove-unused-variable-in-rspi_rz_transfer_.patch
@@ -0,0 +1,31 @@
+From 6c154dcfa8e01972cc62b0a0944925cda5484c13 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+Date: Fri, 6 Jun 2014 13:38:42 +0200
+Subject: spi: rspi: Remove unused variable in rspi_rz_transfer_one()
+
+Introduced by commit 8b983e90ea1a3dd82070f96c062ad521a06b7cc0 ("spi: rspi:
+Extract rspi_common_transfer()"), which removed its users.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 95029a00886f0c8d79e700cb8983b881c75af0f1)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-rspi.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
+index 10112745bb17..ddee9df1547d 100644
+--- a/drivers/spi/spi-rspi.c
++++ b/drivers/spi/spi-rspi.c
+@@ -630,7 +630,6 @@ static int rspi_rz_transfer_one(struct spi_master *master,
+ struct spi_transfer *xfer)
+ {
+ struct rspi_data *rspi = spi_master_get_devdata(master);
+- int ret;
+
+ rspi_rz_receive_init(rspi);
+
+--
+2.1.2
+
diff --git a/patches.renesas/0716-spi-rspi-Pass-spi_master-pointer-to-rspi_release_dma.patch b/patches.renesas/0716-spi-rspi-Pass-spi_master-pointer-to-rspi_release_dma.patch
new file mode 100644
index 00000000000000..c5d70d79d82198
--- /dev/null
+++ b/patches.renesas/0716-spi-rspi-Pass-spi_master-pointer-to-rspi_release_dma.patch
@@ -0,0 +1,59 @@
+From 560286cb3f5b72a94bb83a9d0d0601cbd89cdc90 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+Date: Fri, 6 Jun 2014 13:38:43 +0200
+Subject: spi: rspi: Pass spi_master pointer to rspi_release_dma()
+
+rspi_release_dma() doesn't need access to any fields in the driver private
+data, except for the pointer to the SPI master object. Hence just pass the
+needed pointer.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit afcc98dec91b7754e754670bdec0290aa07c3565)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-rspi.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
+index ddee9df1547d..38fd938d6360 100644
+--- a/drivers/spi/spi-rspi.c
++++ b/drivers/spi/spi-rspi.c
+@@ -926,19 +926,19 @@ static int rspi_request_dma(struct device *dev, struct spi_master *master,
+ return 0;
+ }
+
+-static void rspi_release_dma(struct rspi_data *rspi)
++static void rspi_release_dma(struct spi_master *master)
+ {
+- if (rspi->master->dma_tx)
+- dma_release_channel(rspi->master->dma_tx);
+- if (rspi->master->dma_rx)
+- dma_release_channel(rspi->master->dma_rx);
++ if (master->dma_tx)
++ dma_release_channel(master->dma_tx);
++ if (master->dma_rx)
++ dma_release_channel(master->dma_rx);
+ }
+
+ static int rspi_remove(struct platform_device *pdev)
+ {
+ struct rspi_data *rspi = platform_get_drvdata(pdev);
+
+- rspi_release_dma(rspi);
++ rspi_release_dma(rspi->master);
+ pm_runtime_disable(&pdev->dev);
+
+ return 0;
+@@ -1140,7 +1140,7 @@ static int rspi_probe(struct platform_device *pdev)
+ return 0;
+
+ error3:
+- rspi_release_dma(rspi);
++ rspi_release_dma(master);
+ error2:
+ pm_runtime_disable(&pdev->dev);
+ error1:
+--
+2.1.2
+
diff --git a/patches.renesas/0717-sh_eth-remove-checks-around-dev_kfree_skb-calls.patch b/patches.renesas/0717-sh_eth-remove-checks-around-dev_kfree_skb-calls.patch
new file mode 100644
index 00000000000000..547c6ebe9663d2
--- /dev/null
+++ b/patches.renesas/0717-sh_eth-remove-checks-around-dev_kfree_skb-calls.patch
@@ -0,0 +1,64 @@
+From 63f44e207321de3a77610c49bec6fc0bf1b9d3fa Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Sat, 28 Jun 2014 04:10:00 +0400
+Subject: sh_eth: remove checks around dev_kfree_skb() calls
+
+Since consume_skb() (and hence dev_kfree_skb() macro) checks the passed pointer
+for NULL, there's no need to check for NULL before invoking dev_kfree_skb().
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 179d80aff82bf8dff9db30589fe5a2297c454d35)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 18 ++++++------------
+ 1 file changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 10af820e1d45..26936b91f63f 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1094,20 +1094,16 @@ static void sh_eth_ring_free(struct net_device *ndev)
+
+ /* Free Rx skb ringbuffer */
+ if (mdp->rx_skbuff) {
+- for (i = 0; i < mdp->num_rx_ring; i++) {
+- if (mdp->rx_skbuff[i])
+- dev_kfree_skb(mdp->rx_skbuff[i]);
+- }
++ for (i = 0; i < mdp->num_rx_ring; i++)
++ dev_kfree_skb(mdp->rx_skbuff[i]);
+ }
+ kfree(mdp->rx_skbuff);
+ mdp->rx_skbuff = NULL;
+
+ /* Free Tx skb ringbuffer */
+ if (mdp->tx_skbuff) {
+- for (i = 0; i < mdp->num_tx_ring; i++) {
+- if (mdp->tx_skbuff[i])
+- dev_kfree_skb(mdp->tx_skbuff[i]);
+- }
++ for (i = 0; i < mdp->num_tx_ring; i++)
++ dev_kfree_skb(mdp->tx_skbuff[i]);
+ }
+ kfree(mdp->tx_skbuff);
+ mdp->tx_skbuff = NULL;
+@@ -2077,13 +2073,11 @@ static void sh_eth_tx_timeout(struct net_device *ndev)
+ rxdesc = &mdp->rx_ring[i];
+ rxdesc->status = 0;
+ rxdesc->addr = 0xBADF00D0;
+- if (mdp->rx_skbuff[i])
+- dev_kfree_skb(mdp->rx_skbuff[i]);
++ dev_kfree_skb(mdp->rx_skbuff[i]);
+ mdp->rx_skbuff[i] = NULL;
+ }
+ for (i = 0; i < mdp->num_tx_ring; i++) {
+- if (mdp->tx_skbuff[i])
+- dev_kfree_skb(mdp->tx_skbuff[i]);
++ dev_kfree_skb(mdp->tx_skbuff[i]);
+ mdp->tx_skbuff[i] = NULL;
+ }
+
+--
+2.1.2
+
diff --git a/patches.renesas/0718-mmc-tmio-mmc-Add-renesas-sdhi-r8a7791-to-binding-doc.patch b/patches.renesas/0718-mmc-tmio-mmc-Add-renesas-sdhi-r8a7791-to-binding-doc.patch
new file mode 100644
index 00000000000000..f3f56557291150
--- /dev/null
+++ b/patches.renesas/0718-mmc-tmio-mmc-Add-renesas-sdhi-r8a7791-to-binding-doc.patch
@@ -0,0 +1,34 @@
+From 402e632d5f03251282c4afdb4f48b00b3dcaad8d Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 9 Jul 2014 14:23:34 +0200
+Subject: mmc: tmio-mmc: Add renesas, sdhi-r8a7791 to binding documentation
+
+The driver already supports the r8a7791 SoC, and "renesas,sdhi-r8a7791"
+is already in use.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Cc: Ian Molton <ian.molton@codethink.co.uk>
+Cc: Chris Ball <chris@printf.net>
+Cc: linux-mmc@vger.kernel.org
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit bf7978483c0c119e0d650710ee713f0ed95939ca)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ Documentation/devicetree/bindings/mmc/tmio_mmc.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
+index 6a2a1160a70d..fa0f327cde01 100644
+--- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
++++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
+@@ -18,6 +18,7 @@ Required properties:
+ "renesas,sdhi-r8a7778" - SDHI IP on R8A7778 SoC
+ "renesas,sdhi-r8a7779" - SDHI IP on R8A7779 SoC
+ "renesas,sdhi-r8a7790" - SDHI IP on R8A7790 SoC
++ "renesas,sdhi-r8a7791" - SDHI IP on R8A7791 SoC
+
+ Optional properties:
+ - toshiba,mmc-wrprotect-disable: write-protect detection is unavailable
+--
+2.1.2
+
diff --git a/patches.renesas/0719-sh-pfc-r8a7791-add-CAN-pin-groups.patch b/patches.renesas/0719-sh-pfc-r8a7791-add-CAN-pin-groups.patch
new file mode 100644
index 00000000000000..35dfe87272ab6c
--- /dev/null
+++ b/patches.renesas/0719-sh-pfc-r8a7791-add-CAN-pin-groups.patch
@@ -0,0 +1,218 @@
+From 501b7ca6ada6eaeff592471505e6c2e9fcd1f71c Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Wed, 2 Jul 2014 00:58:16 +0400
+Subject: sh-pfc: r8a7791: add CAN pin groups
+
+Add CAN0/1 data/clock pin groups to R8A7791 PFC driver.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+(cherry picked from commit b067580f07b0ae5c323a1d5cd0caa629050406e3)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 167 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 167 insertions(+)
+
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+index 394b234488cc..576d41b459e9 100644
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+@@ -1726,6 +1726,133 @@ static const unsigned int audio_clkout_mux[] = {
+ AUDIO_CLKOUT_MARK,
+ };
+
++/* - CAN -------------------------------------------------------------------- */
++
++static const unsigned int can0_data_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(3, 26), RCAR_GP_PIN(3, 29),
++};
++
++static const unsigned int can0_data_mux[] = {
++ CAN0_TX_MARK, CAN0_RX_MARK,
++};
++
++static const unsigned int can0_data_b_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(7, 4), RCAR_GP_PIN(7, 3),
++};
++
++static const unsigned int can0_data_b_mux[] = {
++ CAN0_TX_B_MARK, CAN0_RX_B_MARK,
++};
++
++static const unsigned int can0_data_c_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(5, 17), RCAR_GP_PIN(5, 18),
++};
++
++static const unsigned int can0_data_c_mux[] = {
++ CAN0_TX_C_MARK, CAN0_RX_C_MARK,
++};
++
++static const unsigned int can0_data_d_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(2, 26), RCAR_GP_PIN(2, 27),
++};
++
++static const unsigned int can0_data_d_mux[] = {
++ CAN0_TX_D_MARK, CAN0_RX_D_MARK,
++};
++
++static const unsigned int can0_data_e_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(4, 18), RCAR_GP_PIN(4, 28),
++};
++
++static const unsigned int can0_data_e_mux[] = {
++ CAN0_TX_E_MARK, CAN0_RX_E_MARK,
++};
++
++static const unsigned int can0_data_f_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(6, 7), RCAR_GP_PIN(6, 6),
++};
++
++static const unsigned int can0_data_f_mux[] = {
++ CAN0_TX_F_MARK, CAN0_RX_F_MARK,
++};
++
++static const unsigned int can1_data_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(3, 21), RCAR_GP_PIN(3, 20),
++};
++
++static const unsigned int can1_data_mux[] = {
++ CAN1_TX_MARK, CAN1_RX_MARK,
++};
++
++static const unsigned int can1_data_b_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(7, 8), RCAR_GP_PIN(7, 9),
++};
++
++static const unsigned int can1_data_b_mux[] = {
++ CAN1_TX_B_MARK, CAN1_RX_B_MARK,
++};
++
++static const unsigned int can1_data_c_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(5, 20), RCAR_GP_PIN(5, 19),
++};
++
++static const unsigned int can1_data_c_mux[] = {
++ CAN1_TX_C_MARK, CAN1_RX_C_MARK,
++};
++
++static const unsigned int can1_data_d_pins[] = {
++ /* TX, RX */
++ RCAR_GP_PIN(4, 29), RCAR_GP_PIN(4, 31),
++};
++
++static const unsigned int can1_data_d_mux[] = {
++ CAN1_TX_D_MARK, CAN1_RX_D_MARK,
++};
++
++static const unsigned int can_clk_pins[] = {
++ /* CLK */
++ RCAR_GP_PIN(7, 2),
++};
++
++static const unsigned int can_clk_mux[] = {
++ CAN_CLK_MARK,
++};
++
++static const unsigned int can_clk_b_pins[] = {
++ /* CLK */
++ RCAR_GP_PIN(5, 21),
++};
++
++static const unsigned int can_clk_b_mux[] = {
++ CAN_CLK_B_MARK,
++};
++
++static const unsigned int can_clk_c_pins[] = {
++ /* CLK */
++ RCAR_GP_PIN(4, 30),
++};
++
++static const unsigned int can_clk_c_mux[] = {
++ CAN_CLK_C_MARK,
++};
++
++static const unsigned int can_clk_d_pins[] = {
++ /* CLK */
++ RCAR_GP_PIN(7, 19),
++};
++
++static const unsigned int can_clk_d_mux[] = {
++ CAN_CLK_D_MARK,
++};
+
+ /* - DU --------------------------------------------------------------------- */
+ static const unsigned int du_rgb666_pins[] = {
+@@ -4055,6 +4182,20 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
+ SH_PFC_PIN_GROUP(audio_clk_b_b),
+ SH_PFC_PIN_GROUP(audio_clk_c),
+ SH_PFC_PIN_GROUP(audio_clkout),
++ SH_PFC_PIN_GROUP(can0_data),
++ SH_PFC_PIN_GROUP(can0_data_b),
++ SH_PFC_PIN_GROUP(can0_data_c),
++ SH_PFC_PIN_GROUP(can0_data_d),
++ SH_PFC_PIN_GROUP(can0_data_e),
++ SH_PFC_PIN_GROUP(can0_data_f),
++ SH_PFC_PIN_GROUP(can1_data),
++ SH_PFC_PIN_GROUP(can1_data_b),
++ SH_PFC_PIN_GROUP(can1_data_c),
++ SH_PFC_PIN_GROUP(can1_data_d),
++ SH_PFC_PIN_GROUP(can_clk),
++ SH_PFC_PIN_GROUP(can_clk_b),
++ SH_PFC_PIN_GROUP(can_clk_c),
++ SH_PFC_PIN_GROUP(can_clk_d),
+ SH_PFC_PIN_GROUP(du_rgb666),
+ SH_PFC_PIN_GROUP(du_rgb888),
+ SH_PFC_PIN_GROUP(du_clk_out_0),
+@@ -4367,6 +4508,30 @@ static const char * const audio_clk_groups[] = {
+ "audio_clkout",
+ };
+
++static const char * const can0_groups[] = {
++ "can0_data_a",
++ "can0_data_b",
++ "can0_data_c",
++ "can0_data_d",
++ "can0_data_e",
++ "can0_data_f",
++ "can_clk_a",
++ "can_clk_b",
++ "can_clk_c",
++ "can_clk_d",
++};
++
++static const char * const can1_groups[] = {
++ "can1_data_a",
++ "can1_data_b",
++ "can1_data_c",
++ "can1_data_d",
++ "can_clk_a",
++ "can_clk_b",
++ "can_clk_c",
++ "can_clk_d",
++};
++
+ static const char * const du_groups[] = {
+ "du_rgb666",
+ "du_rgb888",
+@@ -4790,6 +4955,8 @@ static const char * const vin2_groups[] = {
+
+ static const struct sh_pfc_function pinmux_functions[] = {
+ SH_PFC_FUNCTION(audio_clk),
++ SH_PFC_FUNCTION(can0),
++ SH_PFC_FUNCTION(can1),
+ SH_PFC_FUNCTION(du),
+ SH_PFC_FUNCTION(du0),
+ SH_PFC_FUNCTION(du1),
+--
+2.1.2
+
diff --git a/patches.renesas/0720-sh-pfc-Add-renesas-pfc-r8a7791-to-binding-documentat.patch b/patches.renesas/0720-sh-pfc-Add-renesas-pfc-r8a7791-to-binding-documentat.patch
new file mode 100644
index 00000000000000..21fe75fe2f97e2
--- /dev/null
+++ b/patches.renesas/0720-sh-pfc-Add-renesas-pfc-r8a7791-to-binding-documentat.patch
@@ -0,0 +1,32 @@
+From 19d2de65b18dc86717fc2495991ee4301a91347f Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 9 Jul 2014 14:23:36 +0200
+Subject: sh-pfc: Add renesas,pfc-r8a7791 to binding documentation
+
+The driver already supports the r8a7791 SoC, and "renesas,pfc-r8a7791"
+is already in use.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+(cherry picked from commit 590b4ceab95761c45dfc5d9afbbc6810c1fd64a7)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
+index 35d2e1f186f0..daef6fad6a5f 100644
+--- a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
++++ b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
+@@ -15,6 +15,7 @@ Required Properties:
+ - "renesas,pfc-r8a7778": for R8A7778 (R-Mobile M1) compatible pin-controller.
+ - "renesas,pfc-r8a7779": for R8A7779 (R-Car H1) compatible pin-controller.
+ - "renesas,pfc-r8a7790": for R8A7790 (R-Car H2) compatible pin-controller.
++ - "renesas,pfc-r8a7791": for R8A7791 (R-Car M2) compatible pin-controller.
+ - "renesas,pfc-sh7372": for SH7372 (SH-Mobile AP4) compatible pin-controller.
+ - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible pin-controller.
+
+--
+2.1.2
+
diff --git a/patches.renesas/0721-sh-pfc-sh73a0-Introduce-the-use-of-devm_regulator_re.patch b/patches.renesas/0721-sh-pfc-sh73a0-Introduce-the-use-of-devm_regulator_re.patch
new file mode 100644
index 00000000000000..daefd1f826e212
--- /dev/null
+++ b/patches.renesas/0721-sh-pfc-sh73a0-Introduce-the-use-of-devm_regulator_re.patch
@@ -0,0 +1,53 @@
+From 49864e07ee7ca3b8cccf7773dc356bd5aa603f5c Mon Sep 17 00:00:00 2001
+From: Himangi Saraogi <himangi774@gmail.com>
+Date: Mon, 7 Jul 2014 21:39:16 +0530
+Subject: sh-pfc: sh73a0: Introduce the use of devm_regulator_register
+
+This patch moves data allocated using regulator_register to
+devm_regulator_register and does away the calls to regulator_unregister.
+The sh73a0_pinmux_soc_exit function is no longer needed and is removed.
+
+Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
+Acked-by: Julia Lawall <julia.lawall@lip6.fr>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+(cherry picked from commit 01a7d13a8cfa6424a9568f3c7e925ace57cd3fc8)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/pinctrl/sh-pfc/pfc-sh73a0.c | 11 ++---------
+ 1 file changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
+index ee370de4609a..0bd8f4401b42 100644
+--- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
++++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c
+@@ -3842,7 +3842,8 @@ static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc)
+ cfg.init_data = &sh73a0_vccq_mc0_init_data;
+ cfg.driver_data = pfc;
+
+- data->vccq_mc0 = regulator_register(&sh73a0_vccq_mc0_desc, &cfg);
++ data->vccq_mc0 = devm_regulator_register(pfc->dev,
++ &sh73a0_vccq_mc0_desc, &cfg);
+ if (IS_ERR(data->vccq_mc0)) {
+ ret = PTR_ERR(data->vccq_mc0);
+ dev_err(pfc->dev, "Failed to register VCCQ MC0 regulator: %d\n",
+@@ -3855,16 +3856,8 @@ static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc)
+ return 0;
+ }
+
+-static void sh73a0_pinmux_soc_exit(struct sh_pfc *pfc)
+-{
+- struct sh73a0_pinmux_data *data = pfc->soc_data;
+-
+- regulator_unregister(data->vccq_mc0);
+-}
+-
+ static const struct sh_pfc_soc_operations sh73a0_pinmux_ops = {
+ .init = sh73a0_pinmux_soc_init,
+- .exit = sh73a0_pinmux_soc_exit,
+ .get_bias = sh73a0_pinmux_get_bias,
+ .set_bias = sh73a0_pinmux_set_bias,
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0722-sh-Switch-to-new-style-CMT-device.patch b/patches.renesas/0722-sh-Switch-to-new-style-CMT-device.patch
new file mode 100644
index 00000000000000..91db03f9a235c8
--- /dev/null
+++ b/patches.renesas/0722-sh-Switch-to-new-style-CMT-device.patch
@@ -0,0 +1,993 @@
+From de1f226be0ff9d6cf9cac245e7f0e357a3be969a Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 23 Apr 2014 13:15:08 +0200
+Subject: sh: Switch to new style CMT device
+
+The CMT (Compare Match Timer) driver implements a new style of platform
+data that handles the timer as a single device with multiple channel.
+Switch from the old-style platform data to the new-style platform data.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 9b17e48cd4df4e129976c37660cf9ec644c66059)
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/sh/kernel/cpu/clock-cpg.c | 3 +-
+ arch/sh/kernel/cpu/sh2/setup-sh7619.c | 66 +++------------
+ arch/sh/kernel/cpu/sh2a/clock-sh7264.c | 2 +-
+ arch/sh/kernel/cpu/sh2a/clock-sh7269.c | 2 +-
+ arch/sh/kernel/cpu/sh2a/setup-sh7203.c | 66 +++------------
+ arch/sh/kernel/cpu/sh2a/setup-sh7206.c | 66 +++------------
+ arch/sh/kernel/cpu/sh2a/setup-sh7264.c | 69 +++------------
+ arch/sh/kernel/cpu/sh2a/setup-sh7269.c | 66 +++------------
+ arch/sh/kernel/cpu/sh3/setup-sh7720.c | 150 +++------------------------------
+ arch/sh/kernel/cpu/sh4a/clock-sh7343.c | 2 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7366.c | 2 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7722.c | 2 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7723.c | 2 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7724.c | 2 +-
+ arch/sh/kernel/cpu/sh4a/setup-sh7343.c | 18 +---
+ arch/sh/kernel/cpu/sh4a/setup-sh7366.c | 18 +---
+ arch/sh/kernel/cpu/sh4a/setup-sh7722.c | 18 +---
+ arch/sh/kernel/cpu/sh4a/setup-sh7723.c | 18 +---
+ arch/sh/kernel/cpu/sh4a/setup-sh7724.c | 18 +---
+ 19 files changed, 106 insertions(+), 484 deletions(-)
+
+diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c
+index f59b1f30d44b..8de314b8e5df 100644
+--- a/arch/sh/kernel/cpu/clock-cpg.c
++++ b/arch/sh/kernel/cpu/clock-cpg.c
+@@ -58,7 +58,8 @@ int __init __deprecated cpg_clk_init(void)
+
+ clk_add_alias("tmu_fck", NULL, "peripheral_clk", NULL);
+ clk_add_alias("mtu2_fck", NULL, "peripheral_clk", NULL);
+- clk_add_alias("cmt_fck", NULL, "peripheral_clk", NULL);
++ clk_add_alias("fck", "sh-cmt-16.0", "peripheral_clk", NULL);
++ clk_add_alias("fck", "sh-cmt-32.0", "peripheral_clk", NULL);
+ clk_add_alias("sci_ick", NULL, "peripheral_clk", NULL);
+
+ return ret;
+diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
+index 3860b0be56c7..58c19adae900 100644
+--- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c
++++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
+@@ -152,62 +152,24 @@ static struct platform_device eth_device = {
+ .resource = eth_resources,
+ };
+
+-static struct sh_timer_config cmt0_platform_data = {
+- .channel_offset = 0x02,
+- .timer_bit = 0,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
++static struct sh_timer_config cmt_platform_data = {
++ .channels_mask = 3,
+ };
+
+-static struct resource cmt0_resources[] = {
+- [0] = {
+- .start = 0xf84a0072,
+- .end = 0xf84a0077,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 86,
+- .flags = IORESOURCE_IRQ,
+- },
++static struct resource cmt_resources[] = {
++ DEFINE_RES_MEM(0xf84a0070, 0x10),
++ DEFINE_RES_IRQ(86),
++ DEFINE_RES_IRQ(87),
+ };
+
+-static struct platform_device cmt0_device = {
+- .name = "sh_cmt",
++static struct platform_device cmt_device = {
++ .name = "sh-cmt-16",
+ .id = 0,
+ .dev = {
+- .platform_data = &cmt0_platform_data,
+- },
+- .resource = cmt0_resources,
+- .num_resources = ARRAY_SIZE(cmt0_resources),
+-};
+-
+-static struct sh_timer_config cmt1_platform_data = {
+- .channel_offset = 0x08,
+- .timer_bit = 1,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
+-};
+-
+-static struct resource cmt1_resources[] = {
+- [0] = {
+- .start = 0xf84a0078,
+- .end = 0xf84a007d,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 87,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device cmt1_device = {
+- .name = "sh_cmt",
+- .id = 1,
+- .dev = {
+- .platform_data = &cmt1_platform_data,
++ .platform_data = &cmt_platform_data,
+ },
+- .resource = cmt1_resources,
+- .num_resources = ARRAY_SIZE(cmt1_resources),
++ .resource = cmt_resources,
++ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+ static struct platform_device *sh7619_devices[] __initdata = {
+@@ -215,8 +177,7 @@ static struct platform_device *sh7619_devices[] __initdata = {
+ &scif1_device,
+ &scif2_device,
+ &eth_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ };
+
+ static int __init sh7619_devices_setup(void)
+@@ -235,8 +196,7 @@ static struct platform_device *sh7619_early_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &scif2_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ };
+
+ #define STBCR3 0xf80a0000
+diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7264.c b/arch/sh/kernel/cpu/sh2a/clock-sh7264.c
+index fdf585c95289..c7f3c666a0ac 100644
+--- a/arch/sh/kernel/cpu/sh2a/clock-sh7264.c
++++ b/arch/sh/kernel/cpu/sh2a/clock-sh7264.c
+@@ -117,7 +117,7 @@ static struct clk_lookup lookups[] = {
+ /* MSTP clocks */
+ CLKDEV_CON_ID("sci_ick", &mstp_clks[MSTP77]),
+ CLKDEV_CON_ID("vdc3", &mstp_clks[MSTP74]),
+- CLKDEV_CON_ID("cmt_fck", &mstp_clks[MSTP72]),
++ CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[MSTP72]),
+ CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]),
+ CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP35]),
+ CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP34]),
+diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7269.c b/arch/sh/kernel/cpu/sh2a/clock-sh7269.c
+index 6b787620de99..4f47464f2fb6 100644
+--- a/arch/sh/kernel/cpu/sh2a/clock-sh7269.c
++++ b/arch/sh/kernel/cpu/sh2a/clock-sh7269.c
+@@ -158,7 +158,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]),
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]),
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]),
+- CLKDEV_CON_ID("cmt_fck", &mstp_clks[MSTP72]),
++ CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[MSTP72]),
+ CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]),
+ CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP35]),
+ CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]),
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+index d55a0f30ada3..374f8c09d924 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+@@ -265,62 +265,24 @@ static struct platform_device scif3_device = {
+ },
+ };
+
+-static struct sh_timer_config cmt0_platform_data = {
+- .channel_offset = 0x02,
+- .timer_bit = 0,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
++static struct sh_timer_config cmt_platform_data = {
++ .channels_mask = 3,
+ };
+
+-static struct resource cmt0_resources[] = {
+- [0] = {
+- .start = 0xfffec002,
+- .end = 0xfffec007,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 142,
+- .flags = IORESOURCE_IRQ,
+- },
++static struct resource cmt_resources[] = {
++ DEFINE_RES_MEM(0xfffec000, 0x10),
++ DEFINE_RES_IRQ(142),
++ DEFINE_RES_IRQ(143),
+ };
+
+-static struct platform_device cmt0_device = {
+- .name = "sh_cmt",
++static struct platform_device cmt_device = {
++ .name = "sh-cmt-16",
+ .id = 0,
+ .dev = {
+- .platform_data = &cmt0_platform_data,
+- },
+- .resource = cmt0_resources,
+- .num_resources = ARRAY_SIZE(cmt0_resources),
+-};
+-
+-static struct sh_timer_config cmt1_platform_data = {
+- .channel_offset = 0x08,
+- .timer_bit = 1,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
+-};
+-
+-static struct resource cmt1_resources[] = {
+- [0] = {
+- .start = 0xfffec008,
+- .end = 0xfffec00d,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 143,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device cmt1_device = {
+- .name = "sh_cmt",
+- .id = 1,
+- .dev = {
+- .platform_data = &cmt1_platform_data,
++ .platform_data = &cmt_platform_data,
+ },
+- .resource = cmt1_resources,
+- .num_resources = ARRAY_SIZE(cmt1_resources),
++ .resource = cmt_resources,
++ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+ static struct sh_timer_config mtu2_0_platform_data = {
+@@ -404,8 +366,7 @@ static struct platform_device *sh7203_devices[] __initdata = {
+ &scif1_device,
+ &scif2_device,
+ &scif3_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
+ &rtc_device,
+@@ -428,8 +389,7 @@ static struct platform_device *sh7203_early_devices[] __initdata = {
+ &scif1_device,
+ &scif2_device,
+ &scif3_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
+ };
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
+index 241e745e3ced..d00e6fd998ec 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
+@@ -217,62 +217,24 @@ static struct platform_device scif3_device = {
+ },
+ };
+
+-static struct sh_timer_config cmt0_platform_data = {
+- .channel_offset = 0x02,
+- .timer_bit = 0,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
++static struct sh_timer_config cmt_platform_data = {
++ .channels_mask = 3,
+ };
+
+-static struct resource cmt0_resources[] = {
+- [0] = {
+- .start = 0xfffec002,
+- .end = 0xfffec007,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 140,
+- .flags = IORESOURCE_IRQ,
+- },
++static struct resource cmt_resources[] = {
++ DEFINE_RES_MEM(0xfffec000, 0x10),
++ DEFINE_RES_IRQ(140),
++ DEFINE_RES_IRQ(144),
+ };
+
+-static struct platform_device cmt0_device = {
+- .name = "sh_cmt",
++static struct platform_device cmt_device = {
++ .name = "sh-cmt-16",
+ .id = 0,
+ .dev = {
+- .platform_data = &cmt0_platform_data,
+- },
+- .resource = cmt0_resources,
+- .num_resources = ARRAY_SIZE(cmt0_resources),
+-};
+-
+-static struct sh_timer_config cmt1_platform_data = {
+- .channel_offset = 0x08,
+- .timer_bit = 1,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
+-};
+-
+-static struct resource cmt1_resources[] = {
+- [0] = {
+- .start = 0xfffec008,
+- .end = 0xfffec00d,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 144,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device cmt1_device = {
+- .name = "sh_cmt",
+- .id = 1,
+- .dev = {
+- .platform_data = &cmt1_platform_data,
++ .platform_data = &cmt_platform_data,
+ },
+- .resource = cmt1_resources,
+- .num_resources = ARRAY_SIZE(cmt1_resources),
++ .resource = cmt_resources,
++ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+ static struct sh_timer_config mtu2_0_platform_data = {
+@@ -364,8 +326,7 @@ static struct platform_device *sh7206_devices[] __initdata = {
+ &scif1_device,
+ &scif2_device,
+ &scif3_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
+ &mtu2_2_device,
+@@ -388,8 +349,7 @@ static struct platform_device *sh7206_early_devices[] __initdata = {
+ &scif1_device,
+ &scif2_device,
+ &scif3_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
+ &mtu2_2_device,
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7264.c b/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
+index ad5b0f429882..e95250e82752 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
+@@ -433,65 +433,24 @@ static struct platform_device scif7_device = {
+ },
+ };
+
+-static struct sh_timer_config cmt0_platform_data = {
+- .channel_offset = 0x02,
+- .timer_bit = 0,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
++static struct sh_timer_config cmt_platform_data = {
++ .channels_mask = 3,
+ };
+
+-static struct resource cmt0_resources[] = {
+- [0] = {
+- .name = "CMT0",
+- .start = 0xfffec002,
+- .end = 0xfffec007,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 175,
+- .flags = IORESOURCE_IRQ,
+- },
++static struct resource cmt_resources[] = {
++ DEFINE_RES_MEM(0xfffec000, 0x10),
++ DEFINE_RES_IRQ(175),
++ DEFINE_RES_IRQ(176),
+ };
+
+-static struct platform_device cmt0_device = {
+- .name = "sh_cmt",
++static struct platform_device cmt_device = {
++ .name = "sh-cmt-16",
+ .id = 0,
+ .dev = {
+- .platform_data = &cmt0_platform_data,
+- },
+- .resource = cmt0_resources,
+- .num_resources = ARRAY_SIZE(cmt0_resources),
+-};
+-
+-static struct sh_timer_config cmt1_platform_data = {
+- .name = "CMT1",
+- .channel_offset = 0x08,
+- .timer_bit = 1,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
+-};
+-
+-static struct resource cmt1_resources[] = {
+- [0] = {
+- .name = "CMT1",
+- .start = 0xfffec008,
+- .end = 0xfffec00d,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 176,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device cmt1_device = {
+- .name = "sh_cmt",
+- .id = 1,
+- .dev = {
+- .platform_data = &cmt1_platform_data,
++ .platform_data = &cmt_platform_data,
+ },
+- .resource = cmt1_resources,
+- .num_resources = ARRAY_SIZE(cmt1_resources),
++ .resource = cmt_resources,
++ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+ static struct sh_timer_config mtu2_0_platform_data = {
+@@ -620,8 +579,7 @@ static struct platform_device *sh7264_devices[] __initdata = {
+ &scif5_device,
+ &scif6_device,
+ &scif7_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
+ &rtc_device,
+@@ -649,8 +607,7 @@ static struct platform_device *sh7264_early_devices[] __initdata = {
+ &scif5_device,
+ &scif6_device,
+ &scif7_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
+ };
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7269.c b/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
+index 3995119f65dc..0191e1ae8411 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
+@@ -455,62 +455,24 @@ static struct platform_device scif7_device = {
+ },
+ };
+
+-static struct sh_timer_config cmt0_platform_data = {
+- .channel_offset = 0x02,
+- .timer_bit = 0,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
++static struct sh_timer_config cmt_platform_data = {
++ .channels_mask = 3,
+ };
+
+-static struct resource cmt0_resources[] = {
+- [0] = {
+- .start = 0xfffec002,
+- .end = 0xfffec007,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 188,
+- .flags = IORESOURCE_IRQ,
+- },
++static struct resource cmt_resources[] = {
++ DEFINE_RES_MEM(0xfffec000, 0x10),
++ DEFINE_RES_IRQ(188),
++ DEFINE_RES_IRQ(189),
+ };
+
+-static struct platform_device cmt0_device = {
+- .name = "sh_cmt",
++static struct platform_device cmt_device = {
++ .name = "sh-cmt-16",
+ .id = 0,
+ .dev = {
+- .platform_data = &cmt0_platform_data,
+- },
+- .resource = cmt0_resources,
+- .num_resources = ARRAY_SIZE(cmt0_resources),
+-};
+-
+-static struct sh_timer_config cmt1_platform_data = {
+- .channel_offset = 0x08,
+- .timer_bit = 1,
+- .clockevent_rating = 125,
+- .clocksource_rating = 0, /* disabled due to code generation issues */
+-};
+-
+-static struct resource cmt1_resources[] = {
+- [0] = {
+- .start = 0xfffec008,
+- .end = 0xfffec00d,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 189,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device cmt1_device = {
+- .name = "sh_cmt",
+- .id = 1,
+- .dev = {
+- .platform_data = &cmt1_platform_data,
++ .platform_data = &cmt_platform_data,
+ },
+- .resource = cmt1_resources,
+- .num_resources = ARRAY_SIZE(cmt1_resources),
++ .resource = cmt_resources,
++ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+ static struct sh_timer_config mtu2_0_platform_data = {
+@@ -629,8 +591,7 @@ static struct platform_device *sh7269_devices[] __initdata = {
+ &scif5_device,
+ &scif6_device,
+ &scif7_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
+ &rtc_device,
+@@ -658,8 +619,7 @@ static struct platform_device *sh7269_early_devices[] __initdata = {
+ &scif5_device,
+ &scif6_device,
+ &scif7_device,
+- &cmt0_device,
+- &cmt1_device,
++ &cmt_device,
+ &mtu2_0_device,
+ &mtu2_1_device,
+ };
+diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+index 1d5729dc0724..a53d21925b94 100644
+--- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c
++++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+@@ -152,141 +152,23 @@ static struct platform_device usbf_device = {
+ .resource = usbf_resources,
+ };
+
+-static struct sh_timer_config cmt0_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 0,
+- .clockevent_rating = 125,
+- .clocksource_rating = 125,
++static struct sh_timer_config cmt_platform_data = {
++ .channels_mask = 0x1f,
+ };
+
+-static struct resource cmt0_resources[] = {
+- [0] = {
+- .start = 0x044a0010,
+- .end = 0x044a001b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
++static struct resource cmt_resources[] = {
++ DEFINE_RES_MEM(0x044a0000, 0x60),
++ DEFINE_RES_IRQ(evt2irq(0xf00)),
+ };
+
+-static struct platform_device cmt0_device = {
+- .name = "sh_cmt",
++static struct platform_device cmt_device = {
++ .name = "sh-cmt-32",
+ .id = 0,
+ .dev = {
+- .platform_data = &cmt0_platform_data,
+- },
+- .resource = cmt0_resources,
+- .num_resources = ARRAY_SIZE(cmt0_resources),
+-};
+-
+-static struct sh_timer_config cmt1_platform_data = {
+- .channel_offset = 0x20,
+- .timer_bit = 1,
+-};
+-
+-static struct resource cmt1_resources[] = {
+- [0] = {
+- .start = 0x044a0020,
+- .end = 0x044a002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device cmt1_device = {
+- .name = "sh_cmt",
+- .id = 1,
+- .dev = {
+- .platform_data = &cmt1_platform_data,
+- },
+- .resource = cmt1_resources,
+- .num_resources = ARRAY_SIZE(cmt1_resources),
+-};
+-
+-static struct sh_timer_config cmt2_platform_data = {
+- .channel_offset = 0x30,
+- .timer_bit = 2,
+-};
+-
+-static struct resource cmt2_resources[] = {
+- [0] = {
+- .start = 0x044a0030,
+- .end = 0x044a003b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device cmt2_device = {
+- .name = "sh_cmt",
+- .id = 2,
+- .dev = {
+- .platform_data = &cmt2_platform_data,
+- },
+- .resource = cmt2_resources,
+- .num_resources = ARRAY_SIZE(cmt2_resources),
+-};
+-
+-static struct sh_timer_config cmt3_platform_data = {
+- .channel_offset = 0x40,
+- .timer_bit = 3,
+-};
+-
+-static struct resource cmt3_resources[] = {
+- [0] = {
+- .start = 0x044a0040,
+- .end = 0x044a004b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device cmt3_device = {
+- .name = "sh_cmt",
+- .id = 3,
+- .dev = {
+- .platform_data = &cmt3_platform_data,
+- },
+- .resource = cmt3_resources,
+- .num_resources = ARRAY_SIZE(cmt3_resources),
+-};
+-
+-static struct sh_timer_config cmt4_platform_data = {
+- .channel_offset = 0x50,
+- .timer_bit = 4,
+-};
+-
+-static struct resource cmt4_resources[] = {
+- [0] = {
+- .start = 0x044a0050,
+- .end = 0x044a005b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device cmt4_device = {
+- .name = "sh_cmt",
+- .id = 4,
+- .dev = {
+- .platform_data = &cmt4_platform_data,
++ .platform_data = &cmt_platform_data,
+ },
+- .resource = cmt4_resources,
+- .num_resources = ARRAY_SIZE(cmt4_resources),
++ .resource = cmt_resources,
++ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+@@ -375,11 +257,7 @@ static struct platform_device tmu2_device = {
+ static struct platform_device *sh7720_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+- &cmt0_device,
+- &cmt1_device,
+- &cmt2_device,
+- &cmt3_device,
+- &cmt4_device,
++ &cmt_device,
+ &tmu0_device,
+ &tmu1_device,
+ &tmu2_device,
+@@ -398,11 +276,7 @@ arch_initcall(sh7720_devices_setup);
+ static struct platform_device *sh7720_early_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+- &cmt0_device,
+- &cmt1_device,
+- &cmt2_device,
+- &cmt3_device,
+- &cmt4_device,
++ &cmt_device,
+ &tmu0_device,
+ &tmu1_device,
+ &tmu2_device,
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
+index 53638e231cd0..9edc06c02dcf 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
+@@ -227,7 +227,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("hudi0", &mstp_clks[MSTP019]),
+ CLKDEV_CON_ID("ubc0", &mstp_clks[MSTP017]),
+ CLKDEV_CON_ID("tmu_fck", &mstp_clks[MSTP015]),
+- CLKDEV_CON_ID("cmt_fck", &mstp_clks[MSTP014]),
++ CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[MSTP014]),
+ CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]),
+ CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]),
+ CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
+index 22e485d1990b..955b9add7810 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7366.c
+@@ -225,7 +225,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("hudi0", &mstp_clks[MSTP019]),
+ CLKDEV_CON_ID("ubc0", &mstp_clks[MSTP017]),
+ CLKDEV_CON_ID("tmu_fck", &mstp_clks[MSTP015]),
+- CLKDEV_CON_ID("cmt_fck", &mstp_clks[MSTP014]),
++ CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[MSTP014]),
+ CLKDEV_CON_ID("rwdt0", &mstp_clks[MSTP013]),
+ CLKDEV_CON_ID("mfi0", &mstp_clks[MSTP011]),
+ CLKDEV_CON_ID("flctl0", &mstp_clks[MSTP010]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+index c4cb740e4d10..40974934512a 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+@@ -207,7 +207,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU]),
+ CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU]),
+
+- CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]),
++ CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[HWBLK_CMT]),
+ CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]),
+ CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]),
+
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+index 37c41c7747a3..da64734b0fd3 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+@@ -236,7 +236,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("sh0", &mstp_clks[HWBLK_SHYWAY]),
+ CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]),
+ CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]),
+- CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]),
++ CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[HWBLK_CMT]),
+ CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]),
+ CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[HWBLK_DMAC1]),
+ CLKDEV_CON_ID("flctl0", &mstp_clks[HWBLK_FLCTL]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+index 0128af3399b7..f917f1926507 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+@@ -309,7 +309,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU0]),
+ CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[HWBLK_TMU1]),
+
+- CLKDEV_CON_ID("cmt_fck", &mstp_clks[HWBLK_CMT]),
++ CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[HWBLK_CMT]),
+ CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]),
+ CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[HWBLK_DMAC1]),
+
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+index 245d19254489..ad96492f290d 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+@@ -228,26 +228,16 @@ static struct platform_device jpu_device = {
+ };
+
+ static struct sh_timer_config cmt_platform_data = {
+- .channel_offset = 0x60,
+- .timer_bit = 5,
+- .clockevent_rating = 125,
+- .clocksource_rating = 200,
++ .channels_mask = 0x20,
+ };
+
+ static struct resource cmt_resources[] = {
+- [0] = {
+- .start = 0x044a0060,
+- .end = 0x044a006b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0x044a0000, 0x70),
++ DEFINE_RES_IRQ(evt2irq(0xf00)),
+ };
+
+ static struct platform_device cmt_device = {
+- .name = "sh_cmt",
++ .name = "sh-cmt-32",
+ .id = 0,
+ .dev = {
+ .platform_data = &cmt_platform_data,
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+index 6f56cbd76b20..4e4985d95e53 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+@@ -176,26 +176,16 @@ static struct platform_device veu1_device = {
+ };
+
+ static struct sh_timer_config cmt_platform_data = {
+- .channel_offset = 0x60,
+- .timer_bit = 5,
+- .clockevent_rating = 125,
+- .clocksource_rating = 200,
++ .channels_mask = 0x20,
+ };
+
+ static struct resource cmt_resources[] = {
+- [0] = {
+- .start = 0x044a0060,
+- .end = 0x044a006b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0x044a0000, 0x70),
++ DEFINE_RES_IRQ(evt2irq(0xf00)),
+ };
+
+ static struct platform_device cmt_device = {
+- .name = "sh_cmt",
++ .name = "sh-cmt-32",
+ .id = 0,
+ .dev = {
+ .platform_data = &cmt_platform_data,
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+index 5a94efc8d4ce..4e3218f288e7 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+@@ -413,26 +413,16 @@ static struct platform_device jpu_device = {
+ };
+
+ static struct sh_timer_config cmt_platform_data = {
+- .channel_offset = 0x60,
+- .timer_bit = 5,
+- .clockevent_rating = 125,
+- .clocksource_rating = 125,
++ .channels_mask = 0x20,
+ };
+
+ static struct resource cmt_resources[] = {
+- [0] = {
+- .start = 0x044a0060,
+- .end = 0x044a006b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0x044a0000, 0x70),
++ DEFINE_RES_IRQ(evt2irq(0xf00)),
+ };
+
+ static struct platform_device cmt_device = {
+- .name = "sh_cmt",
++ .name = "sh-cmt-32",
+ .id = 0,
+ .dev = {
+ .platform_data = &cmt_platform_data,
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+index 3c5eb0993a75..5dfdb8501262 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+@@ -245,26 +245,16 @@ static struct platform_device veu1_device = {
+ };
+
+ static struct sh_timer_config cmt_platform_data = {
+- .channel_offset = 0x60,
+- .timer_bit = 5,
+- .clockevent_rating = 125,
+- .clocksource_rating = 125,
++ .channels_mask = 0x20,
+ };
+
+ static struct resource cmt_resources[] = {
+- [0] = {
+- .start = 0x044a0060,
+- .end = 0x044a006b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0x044a0000, 0x70),
++ DEFINE_RES_IRQ(evt2irq(0xf00)),
+ };
+
+ static struct platform_device cmt_device = {
+- .name = "sh_cmt",
++ .name = "sh-cmt-32",
+ .id = 0,
+ .dev = {
+ .platform_data = &cmt_platform_data,
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+index 60ebbc6842ff..b435f076f292 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+@@ -648,26 +648,16 @@ static struct platform_device beu1_device = {
+ };
+
+ static struct sh_timer_config cmt_platform_data = {
+- .channel_offset = 0x60,
+- .timer_bit = 5,
+- .clockevent_rating = 125,
+- .clocksource_rating = 200,
++ .channels_mask = 0x20,
+ };
+
+ static struct resource cmt_resources[] = {
+- [0] = {
+- .start = 0x044a0060,
+- .end = 0x044a006b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xf00),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0x044a0000, 0x70),
++ DEFINE_RES_IRQ(evt2irq(0xf00)),
+ };
+
+ static struct platform_device cmt_device = {
+- .name = "sh_cmt",
++ .name = "sh-cmt-32",
+ .id = 0,
+ .dev = {
+ .platform_data = &cmt_platform_data,
+--
+2.1.2
+
diff --git a/patches.renesas/0723-sh-Switch-to-new-style-TMU-device.patch b/patches.renesas/0723-sh-Switch-to-new-style-TMU-device.patch
new file mode 100644
index 00000000000000..c3e3400e880ce5
--- /dev/null
+++ b/patches.renesas/0723-sh-Switch-to-new-style-TMU-device.patch
@@ -0,0 +1,3823 @@
+From 75771018e86e09052c61fb4669c1d797325c627e Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 23 Apr 2014 13:15:15 +0200
+Subject: sh: Switch to new style TMU device
+
+The TMU (Timer Unit) driver implements a new style of platform data that
+handles the timer as a single device with multiple channel. Switch from
+the old-style platform data to the new-style platform data.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 1399c195ef5009bf44a41649da4718f6e67c0bff)
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/sh/kernel/cpu/clock-cpg.c | 5 +-
+ arch/sh/kernel/cpu/sh3/setup-sh7705.c | 78 +--------
+ arch/sh/kernel/cpu/sh3/setup-sh770x.c | 78 +--------
+ arch/sh/kernel/cpu/sh3/setup-sh7710.c | 78 +--------
+ arch/sh/kernel/cpu/sh3/setup-sh7720.c | 78 +--------
+ arch/sh/kernel/cpu/sh4/setup-sh4-202.c | 78 +--------
+ arch/sh/kernel/cpu/sh4/setup-sh7750.c | 138 ++-------------
+ arch/sh/kernel/cpu/sh4/setup-sh7760.c | 78 +--------
+ arch/sh/kernel/cpu/sh4a/clock-sh7722.c | 4 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7723.c | 8 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7724.c | 8 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7734.c | 12 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7757.c | 4 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7785.c | 8 +-
+ arch/sh/kernel/cpu/sh4a/clock-sh7786.c | 16 +-
+ arch/sh/kernel/cpu/sh4a/clock-shx3.c | 8 +-
+ arch/sh/kernel/cpu/sh4a/setup-sh7343.c | 78 +--------
+ arch/sh/kernel/cpu/sh4a/setup-sh7366.c | 78 +--------
+ arch/sh/kernel/cpu/sh4a/setup-sh7722.c | 78 +--------
+ arch/sh/kernel/cpu/sh4a/setup-sh7723.c | 154 ++---------------
+ arch/sh/kernel/cpu/sh4a/setup-sh7724.c | 155 ++---------------
+ arch/sh/kernel/cpu/sh4a/setup-sh7734.c | 235 +++-----------------------
+ arch/sh/kernel/cpu/sh4a/setup-sh7757.c | 48 +-----
+ arch/sh/kernel/cpu/sh4a/setup-sh7763.c | 154 ++---------------
+ arch/sh/kernel/cpu/sh4a/setup-sh7770.c | 230 ++-----------------------
+ arch/sh/kernel/cpu/sh4a/setup-sh7780.c | 154 ++---------------
+ arch/sh/kernel/cpu/sh4a/setup-sh7785.c | 154 ++---------------
+ arch/sh/kernel/cpu/sh4a/setup-sh7786.c | 299 +++------------------------------
+ arch/sh/kernel/cpu/sh4a/setup-shx3.c | 150 ++---------------
+ arch/sh/kernel/cpu/sh5/setup-sh5.c | 79 +--------
+ 30 files changed, 239 insertions(+), 2486 deletions(-)
+
+diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c
+index 8de314b8e5df..121ef690763f 100644
+--- a/arch/sh/kernel/cpu/clock-cpg.c
++++ b/arch/sh/kernel/cpu/clock-cpg.c
+@@ -56,7 +56,10 @@ int __init __deprecated cpg_clk_init(void)
+
+ clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
+- clk_add_alias("tmu_fck", NULL, "peripheral_clk", NULL);
++ clk_add_alias("fck", "sh-tmu-sh3.0", "peripheral_clk", NULL);
++ clk_add_alias("fck", "sh-tmu.0", "peripheral_clk", NULL);
++ clk_add_alias("fck", "sh-tmu.1", "peripheral_clk", NULL);
++ clk_add_alias("fck", "sh-tmu.2", "peripheral_clk", NULL);
+ clk_add_alias("mtu2_fck", NULL, "peripheral_clk", NULL);
+ clk_add_alias("fck", "sh-cmt-16.0", "peripheral_clk", NULL);
+ clk_add_alias("fck", "sh-cmt-32.0", "peripheral_clk", NULL);
+diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
+index c76b2543b85f..6a72fd14de21 100644
+--- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c
++++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c
+@@ -143,25 +143,18 @@ static struct platform_device rtc_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x02,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xfffffe94,
+- .end = 0xfffffe9f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xfffffe90, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu-sh3",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -170,67 +163,10 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0xe,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xfffffea0,
+- .end = 0xfffffeab,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1a,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xfffffeac,
+- .end = 0xfffffebb,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+ static struct platform_device *sh7705_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ &rtc_device,
+ };
+
+@@ -245,8 +181,6 @@ static struct platform_device *sh7705_early_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
+index ff1465c0519c..9139d14b9c53 100644
+--- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c
++++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
+@@ -185,25 +185,18 @@ static struct platform_device scif2_device = {
+ #endif
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x02,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xfffffe94,
+- .end = 0xfffffe9f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xfffffe90, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu-sh3",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -212,61 +205,6 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0xe,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xfffffea0,
+- .end = 0xfffffeab,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1a,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xfffffeac,
+- .end = 0xfffffebb,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+ static struct platform_device *sh770x_devices[] __initdata = {
+ &scif0_device,
+ #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
+@@ -279,8 +217,6 @@ static struct platform_device *sh770x_devices[] __initdata = {
+ &scif2_device,
+ #endif
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ &rtc_device,
+ };
+
+@@ -303,8 +239,6 @@ static struct platform_device *sh770x_early_devices[] __initdata = {
+ &scif2_device,
+ #endif
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7710.c b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
+index e2ce9360ed5a..e9ed300dba5c 100644
+--- a/arch/sh/kernel/cpu/sh3/setup-sh7710.c
++++ b/arch/sh/kernel/cpu/sh3/setup-sh7710.c
+@@ -142,25 +142,18 @@ static struct platform_device scif1_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x02,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xa412fe94,
+- .end = 0xa412fe9f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xa412fe90, 0x28),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu-sh3",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -169,67 +162,10 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0xe,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xa412fea0,
+- .end = 0xa412feab,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1a,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xa412feac,
+- .end = 0xa412feb5,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+ static struct platform_device *sh7710_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ &rtc_device,
+ };
+
+@@ -244,8 +180,6 @@ static struct platform_device *sh7710_early_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+index a53d21925b94..84df85a5b800 100644
+--- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c
++++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c
+@@ -172,25 +172,18 @@ static struct platform_device cmt_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x02,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xa412fe94,
+- .end = 0xa412fe9f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xa412fe90, 0x28),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu-sh3",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -199,68 +192,11 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0xe,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xa412fea0,
+- .end = 0xa412feab,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1a,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xa412feac,
+- .end = 0xa412feb5,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+ static struct platform_device *sh7720_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &cmt_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ &rtc_device,
+ &usb_ohci_device,
+ &usbf_device,
+@@ -278,8 +214,6 @@ static struct platform_device *sh7720_early_devices[] __initdata = {
+ &scif1_device,
+ &cmt_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
+index a8bd778d5ac8..e7a7b3cdf68d 100644
+--- a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
++++ b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
+@@ -41,25 +41,18 @@ static struct platform_device scif0_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -68,66 +61,9 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+ static struct platform_device *sh4202_devices[] __initdata = {
+ &scif0_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ static int __init sh4202_devices_setup(void)
+@@ -140,8 +76,6 @@ arch_initcall(sh4202_devices_setup);
+ static struct platform_device *sh4202_early_devices[] __initdata = {
+ &scif0_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+index a447a248491f..5f08c59b9f3e 100644
+--- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c
++++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+@@ -82,25 +82,18 @@ static struct platform_device scif_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -109,26 +102,23 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
++/* SH7750R, SH7751 and SH7751R all have two extra timer channels */
++#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
++ defined(CONFIG_CPU_SUBTYPE_SH7751) || \
++ defined(CONFIG_CPU_SUBTYPE_SH7751R)
++
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 3,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xfe100000, 0x20),
++ DEFINE_RES_IRQ(evt2irq(0xb00)),
++ DEFINE_RES_IRQ(evt2irq(0xb80)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+@@ -137,104 +127,15 @@ static struct platform_device tmu1_device = {
+ .num_resources = ARRAY_SIZE(tmu1_resources),
+ };
+
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+-/* SH7750R, SH7751 and SH7751R all have two extra timer channels */
+-#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7751) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7751R)
+-
+-static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xfe100008,
+- .end = 0xfe100013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xb00),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
+- .id = 3,
+- .dev = {
+- .platform_data = &tmu3_platform_data,
+- },
+- .resource = tmu3_resources,
+- .num_resources = ARRAY_SIZE(tmu3_resources),
+-};
+-
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xfe100014,
+- .end = 0xfe10001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xb80),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+ #endif
+
+ static struct platform_device *sh7750_devices[] __initdata = {
+ &rtc_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ #if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7751) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7751R)
+- &tmu3_device,
+- &tmu4_device,
++ &tmu1_device,
+ #endif
+ };
+
+@@ -254,13 +155,10 @@ arch_initcall(sh7750_devices_setup);
+
+ static struct platform_device *sh7750_early_devices[] __initdata = {
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ #if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7751) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7751R)
+- &tmu3_device,
+- &tmu4_device,
++ &tmu1_device,
+ #endif
+ };
+
+diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
+index 1abd9fb4a386..973b736b3b98 100644
+--- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c
++++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c
+@@ -227,25 +227,18 @@ static struct platform_device scif3_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -254,61 +247,6 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+
+ static struct platform_device *sh7760_devices[] __initdata = {
+ &scif0_device,
+@@ -316,8 +254,6 @@ static struct platform_device *sh7760_devices[] __initdata = {
+ &scif2_device,
+ &scif3_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ static int __init sh7760_devices_setup(void)
+@@ -333,8 +269,6 @@ static struct platform_device *sh7760_early_devices[] __initdata = {
+ &scif2_device,
+ &scif3_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+index 40974934512a..8f07a1a38692 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+@@ -203,9 +203,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("uram0", &mstp_clks[HWBLK_URAM]),
+ CLKDEV_CON_ID("xymem0", &mstp_clks[HWBLK_XYMEM]),
+
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[HWBLK_TMU]),
+
+ CLKDEV_ICK_ID("fck", "sh-cmt-32.0", &mstp_clks[HWBLK_CMT]),
+ CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+index da64734b0fd3..ccbcab550df2 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+@@ -264,12 +264,8 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("veu0", &mstp_clks[HWBLK_VEU2H0]),
+ CLKDEV_CON_ID("vpu0", &mstp_clks[HWBLK_VPU]),
+
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU0]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU0]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU0]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[HWBLK_TMU1]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[HWBLK_TMU1]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[HWBLK_TMU1]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[HWBLK_TMU0]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[HWBLK_TMU1]),
+
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[HWBLK_SCIF0]),
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[HWBLK_SCIF1]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+index f917f1926507..f579dd528198 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+@@ -304,17 +304,13 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("hudi0", &mstp_clks[HWBLK_HUDI]),
+ CLKDEV_CON_ID("ubc0", &mstp_clks[HWBLK_UBC]),
+
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[HWBLK_TMU0]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[HWBLK_TMU0]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[HWBLK_TMU0]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[HWBLK_TMU1]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[HWBLK_TMU0]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[HWBLK_TMU1]),
+
+ CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[HWBLK_CMT]),
+ CLKDEV_DEV_ID("sh-wdt.0", &mstp_clks[HWBLK_RWDT]),
+ CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[HWBLK_DMAC1]),
+
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[HWBLK_TMU1]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[HWBLK_TMU1]),
+ CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[HWBLK_SCIF0]),
+ CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[HWBLK_SCIF1]),
+ CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[HWBLK_SCIF2]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7734.c b/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
+index ed9501519ab3..1fdf1ee672de 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
+@@ -201,15 +201,9 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP022]),
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP021]),
+ CLKDEV_CON_ID("hscif", &mstp_clks[MSTP019]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP016]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP016]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP016]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP015]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP015]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP015]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.6", &mstp_clks[MSTP014]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.7", &mstp_clks[MSTP014]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.8", &mstp_clks[MSTP014]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP016]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP015]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.2", &mstp_clks[MSTP014]),
+ CLKDEV_CON_ID("ssi0", &mstp_clks[MSTP012]),
+ CLKDEV_CON_ID("ssi1", &mstp_clks[MSTP011]),
+ CLKDEV_CON_ID("ssi2", &mstp_clks[MSTP010]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
+index e84a43229b9c..10939f927213 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
+@@ -123,8 +123,8 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("riic6", &mstp_clks[MSTP000]),
+ CLKDEV_CON_ID("riic7", &mstp_clks[MSTP000]),
+
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP113]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP114]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP113]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP114]),
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP112]),
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP111]),
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP110]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+index 1c83788db76a..17d0ea55a5a2 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+@@ -146,12 +146,8 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("mmcif_fck", &mstp_clks[MSTP013]),
+ CLKDEV_CON_ID("flctl_fck", &mstp_clks[MSTP012]),
+
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP008]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP009]),
+
+ CLKDEV_CON_ID("siof_fck", &mstp_clks[MSTP003]),
+ CLKDEV_CON_ID("hspi_fck", &mstp_clks[MSTP002]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
+index 8bba6f159023..bec2a83f1ba5 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7786.c
+@@ -155,18 +155,10 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("i2c1_fck", &mstp_clks[MSTP015]),
+ CLKDEV_CON_ID("i2c0_fck", &mstp_clks[MSTP014]),
+
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.6", &mstp_clks[MSTP010]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.7", &mstp_clks[MSTP010]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.8", &mstp_clks[MSTP010]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.9", &mstp_clks[MSTP011]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.10", &mstp_clks[MSTP011]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.11", &mstp_clks[MSTP011]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP008]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP009]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.2", &mstp_clks[MSTP010]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.3", &mstp_clks[MSTP011]),
+
+ CLKDEV_CON_ID("sdif1_fck", &mstp_clks[MSTP005]),
+ CLKDEV_CON_ID("sdif0_fck", &mstp_clks[MSTP004]),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-shx3.c b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
+index a9422dab0ce7..9a49a44f6f94 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-shx3.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-shx3.c
+@@ -124,12 +124,8 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("fe1_fck", &mstp_clks[MSTP001]),
+ CLKDEV_CON_ID("fe0_fck", &mstp_clks[MSTP000]),
+
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.0", &mstp_clks[MSTP008]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.1", &mstp_clks[MSTP008]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.2", &mstp_clks[MSTP008]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.3", &mstp_clks[MSTP009]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.4", &mstp_clks[MSTP009]),
+- CLKDEV_ICK_ID("tmu_fck", "sh_tmu.5", &mstp_clks[MSTP009]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP008]),
++ CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP009]),
+
+ CLKDEV_CON_ID("hudi_fck", &mstp_clks[MSTP119]),
+ CLKDEV_CON_ID("dmac_11_6_fck", &mstp_clks[MSTP105]),
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+index ad96492f290d..ceb3dedad983 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+@@ -247,25 +247,18 @@ static struct platform_device cmt_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -274,61 +267,6 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+ static struct platform_device *sh7343_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+@@ -336,8 +274,6 @@ static struct platform_device *sh7343_devices[] __initdata = {
+ &scif3_device,
+ &cmt_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ &iic0_device,
+ &iic1_device,
+ &vpu_device,
+@@ -363,8 +299,6 @@ static struct platform_device *sh7343_early_devices[] __initdata = {
+ &scif3_device,
+ &cmt_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+index 4e4985d95e53..f75f67343139 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+@@ -195,25 +195,18 @@ static struct platform_device cmt_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 16,
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -222,67 +215,10 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+ static struct platform_device *sh7366_devices[] __initdata = {
+ &scif0_device,
+ &cmt_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ &iic_device,
+ &usb_host_device,
+ &vpu_device,
+@@ -305,8 +241,6 @@ static struct platform_device *sh7366_early_devices[] __initdata = {
+ &scif0_device,
+ &cmt_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+index 4e3218f288e7..57f83a92a505 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+@@ -432,25 +432,18 @@ static struct platform_device cmt_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -459,61 +452,6 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 18,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+ static struct siu_platform siu_platform_data = {
+ .dma_slave_tx_a = SHDMA_SLAVE_SIUA_TX,
+ .dma_slave_rx_a = SHDMA_SLAVE_SIUA_RX,
+@@ -549,8 +487,6 @@ static struct platform_device *sh7722_devices[] __initdata = {
+ &scif2_device,
+ &cmt_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ &rtc_device,
+ &usbf_device,
+ &iic_device,
+@@ -578,8 +514,6 @@ static struct platform_device *sh7722_early_devices[] __initdata = {
+ &scif2_device,
+ &cmt_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+index 5dfdb8501262..3533b56dd465 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+@@ -264,25 +264,18 @@ static struct platform_device cmt_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -292,25 +285,18 @@ static struct platform_device tmu0_device = {
+ };
+
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd90000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x920)),
++ DEFINE_RES_IRQ(evt2irq(0x940)),
++ DEFINE_RES_IRQ(evt2irq(0x960)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+@@ -319,114 +305,6 @@ static struct platform_device tmu1_device = {
+ .num_resources = ARRAY_SIZE(tmu1_resources),
+ };
+
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+-static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xffd90008,
+- .end = 0xffd90013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x920),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
+- .id = 3,
+- .dev = {
+- .platform_data = &tmu3_platform_data,
+- },
+- .resource = tmu3_resources,
+- .num_resources = ARRAY_SIZE(tmu3_resources),
+-};
+-
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xffd90014,
+- .end = 0xffd9001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x940),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+-static struct sh_timer_config tmu5_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu5_resources[] = {
+- [0] = {
+- .start = 0xffd90020,
+- .end = 0xffd9002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x920),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu5_device = {
+- .name = "sh_tmu",
+- .id = 5,
+- .dev = {
+- .platform_data = &tmu5_platform_data,
+- },
+- .resource = tmu5_resources,
+- .num_resources = ARRAY_SIZE(tmu5_resources),
+-};
+-
+ static struct resource rtc_resources[] = {
+ [0] = {
+ .start = 0xa465fec0,
+@@ -517,10 +395,6 @@ static struct platform_device *sh7723_devices[] __initdata = {
+ &cmt_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ &rtc_device,
+ &iic_device,
+ &sh7723_usb_host_device,
+@@ -550,10 +424,6 @@ static struct platform_device *sh7723_early_devices[] __initdata = {
+ &cmt_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+index b435f076f292..b9e84b1d3aa7 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+@@ -667,25 +667,18 @@ static struct platform_device cmt_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -695,25 +688,18 @@ static struct platform_device tmu0_device = {
+ };
+
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd90000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x920)),
++ DEFINE_RES_IRQ(evt2irq(0x940)),
++ DEFINE_RES_IRQ(evt2irq(0x960)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+@@ -722,115 +708,6 @@ static struct platform_device tmu1_device = {
+ .num_resources = ARRAY_SIZE(tmu1_resources),
+ };
+
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+-
+-static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xffd90008,
+- .end = 0xffd90013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x920),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
+- .id = 3,
+- .dev = {
+- .platform_data = &tmu3_platform_data,
+- },
+- .resource = tmu3_resources,
+- .num_resources = ARRAY_SIZE(tmu3_resources),
+-};
+-
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xffd90014,
+- .end = 0xffd9001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x940),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+-static struct sh_timer_config tmu5_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu5_resources[] = {
+- [0] = {
+- .start = 0xffd90020,
+- .end = 0xffd9002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x920),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu5_device = {
+- .name = "sh_tmu",
+- .id = 5,
+- .dev = {
+- .platform_data = &tmu5_platform_data,
+- },
+- .resource = tmu5_resources,
+- .num_resources = ARRAY_SIZE(tmu5_resources),
+-};
+-
+ /* JPU */
+ static struct uio_info jpu_platform_data = {
+ .name = "JPU",
+@@ -928,10 +805,6 @@ static struct platform_device *sh7724_devices[] __initdata = {
+ &cmt_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ &dma0_device,
+ &dma1_device,
+ &rtc_device,
+@@ -971,10 +844,6 @@ static struct platform_device *sh7724_early_devices[] __initdata = {
+ &cmt_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7734.c b/arch/sh/kernel/cpu/sh4a/setup-sh7734.c
+index dad4ed1b2f94..f617bcb734df 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7734.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7734.c
+@@ -200,25 +200,18 @@ static struct platform_device i2c0_device = {
+
+ /* TMU */
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xFFD80008,
+- .end = 0xFFD80014 - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -228,26 +221,19 @@ static struct platform_device tmu0_device = {
+ };
+
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xFFD80014,
+- .end = 0xFFD80020 - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd81000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x480)),
++ DEFINE_RES_IRQ(evt2irq(0x4a0)),
++ DEFINE_RES_IRQ(evt2irq(0x4c0)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
++ .name = "sh-tmu",
++ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+ },
+@@ -256,25 +242,19 @@ static struct platform_device tmu1_device = {
+ };
+
+ static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xFFD80020,
+- .end = 0xFFD80030 - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd82000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x500)),
++ DEFINE_RES_IRQ(evt2irq(0x520)),
++ DEFINE_RES_IRQ(evt2irq(0x540)),
+ };
+
+ static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
++ .name = "sh-tmu",
++ .id = 2,
+ .dev = {
+ .platform_data = &tmu2_platform_data,
+ },
+@@ -282,169 +262,6 @@ static struct platform_device tmu2_device = {
+ .num_resources = ARRAY_SIZE(tmu2_resources),
+ };
+
+-
+-static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xFFD81008,
+- .end = 0xFFD81014 - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x480),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
+- .id = 3,
+- .dev = {
+- .platform_data = &tmu3_platform_data,
+- },
+- .resource = tmu3_resources,
+- .num_resources = ARRAY_SIZE(tmu3_resources),
+-};
+-
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xFFD81014,
+- .end = 0xFFD81020 - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x4A0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+-static struct sh_timer_config tmu5_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu5_resources[] = {
+- [0] = {
+- .start = 0xFFD81020,
+- .end = 0xFFD81030 - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x4C0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu5_device = {
+- .name = "sh_tmu",
+- .id = 5,
+- .dev = {
+- .platform_data = &tmu5_platform_data,
+- },
+- .resource = tmu5_resources,
+- .num_resources = ARRAY_SIZE(tmu5_resources),
+-};
+-
+-static struct sh_timer_config tmu6_platform_data = {
+- .channel_offset = 0x4,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu6_resources[] = {
+- [0] = {
+- .start = 0xFFD82008,
+- .end = 0xFFD82014 - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x500),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu6_device = {
+- .name = "sh_tmu",
+- .id = 6,
+- .dev = {
+- .platform_data = &tmu6_platform_data,
+- },
+- .resource = tmu6_resources,
+- .num_resources = ARRAY_SIZE(tmu6_resources),
+-};
+-
+-static struct sh_timer_config tmu7_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu7_resources[] = {
+- [0] = {
+- .start = 0xFFD82014,
+- .end = 0xFFD82020 - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x520),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu7_device = {
+- .name = "sh_tmu",
+- .id = 7,
+- .dev = {
+- .platform_data = &tmu7_platform_data,
+- },
+- .resource = tmu7_resources,
+- .num_resources = ARRAY_SIZE(tmu7_resources),
+-};
+-
+-static struct sh_timer_config tmu8_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu8_resources[] = {
+- [0] = {
+- .start = 0xFFD82020,
+- .end = 0xFFD82030 - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x540),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu8_device = {
+- .name = "sh_tmu",
+- .id = 8,
+- .dev = {
+- .platform_data = &tmu8_platform_data,
+- },
+- .resource = tmu8_resources,
+- .num_resources = ARRAY_SIZE(tmu8_resources),
+-};
+-
+ static struct platform_device *sh7734_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+@@ -455,12 +272,6 @@ static struct platform_device *sh7734_devices[] __initdata = {
+ &tmu0_device,
+ &tmu1_device,
+ &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+- &tmu6_device,
+- &tmu7_device,
+- &tmu8_device,
+ &rtc_device,
+ };
+
+@@ -474,12 +285,6 @@ static struct platform_device *sh7734_early_devices[] __initdata = {
+ &tmu0_device,
+ &tmu1_device,
+ &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+- &tmu6_device,
+- &tmu7_device,
+- &tmu8_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+index e43e5db53913..7b24ec4b409a 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+@@ -87,25 +87,17 @@ static struct platform_device scif4_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 3,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xfe430008,
+- .end = 0xfe430013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x580),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xfe430000, 0x20),
++ DEFINE_RES_IRQ(evt2irq(0x580)),
++ DEFINE_RES_IRQ(evt2irq(0x5a0)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -114,34 +106,6 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xfe430014,
+- .end = 0xfe43001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x5a0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+ static struct resource spi0_resources[] = {
+ [0] = {
+ .start = 0xfe002000,
+@@ -782,7 +746,6 @@ static struct platform_device *sh7757_devices[] __initdata = {
+ &scif3_device,
+ &scif4_device,
+ &tmu0_device,
+- &tmu1_device,
+ &dma0_device,
+ &dma1_device,
+ &dma2_device,
+@@ -806,7 +769,6 @@ static struct platform_device *sh7757_early_devices[] __initdata = {
+ &scif3_device,
+ &scif4_device,
+ &tmu0_device,
+- &tmu1_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+index 5eebbd7f4c21..5a47d670ddec 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+@@ -158,25 +158,18 @@ static struct platform_device usbf_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x580),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x580)),
++ DEFINE_RES_IRQ(evt2irq(0x5a0)),
++ DEFINE_RES_IRQ(evt2irq(0x5c0)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -186,25 +179,18 @@ static struct platform_device tmu0_device = {
+ };
+
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x5a0),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd88000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0xe00)),
++ DEFINE_RES_IRQ(evt2irq(0xe20)),
++ DEFINE_RES_IRQ(evt2irq(0xe40)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+@@ -213,124 +199,12 @@ static struct platform_device tmu1_device = {
+ .num_resources = ARRAY_SIZE(tmu1_resources),
+ };
+
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x5c0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+-static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xffd88008,
+- .end = 0xffd88013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xe00),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
+- .id = 3,
+- .dev = {
+- .platform_data = &tmu3_platform_data,
+- },
+- .resource = tmu3_resources,
+- .num_resources = ARRAY_SIZE(tmu3_resources),
+-};
+-
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xffd88014,
+- .end = 0xffd8801f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xe20),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+-static struct sh_timer_config tmu5_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu5_resources[] = {
+- [0] = {
+- .start = 0xffd88020,
+- .end = 0xffd8802b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xe40),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu5_device = {
+- .name = "sh_tmu",
+- .id = 5,
+- .dev = {
+- .platform_data = &tmu5_platform_data,
+- },
+- .resource = tmu5_resources,
+- .num_resources = ARRAY_SIZE(tmu5_resources),
+-};
+-
+ static struct platform_device *sh7763_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &scif2_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ &rtc_device,
+ &usb_ohci_device,
+ &usbf_device,
+@@ -349,10 +223,6 @@ static struct platform_device *sh7763_early_devices[] __initdata = {
+ &scif2_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
+index e1ba8cb74e5a..e9b532a76c37 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
+@@ -226,25 +226,18 @@ static struct platform_device scif9_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -254,25 +247,18 @@ static struct platform_device tmu0_device = {
+ };
+
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd81000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x460)),
++ DEFINE_RES_IRQ(evt2irq(0x480)),
++ DEFINE_RES_IRQ(evt2irq(0x4a0)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+@@ -282,24 +268,18 @@ static struct platform_device tmu1_device = {
+ };
+
+ static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd82000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x4c0)),
++ DEFINE_RES_IRQ(evt2irq(0x4e0)),
++ DEFINE_RES_IRQ(evt2irq(0x500)),
+ };
+
+ static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 2,
+ .dev = {
+ .platform_data = &tmu2_platform_data,
+@@ -308,168 +288,6 @@ static struct platform_device tmu2_device = {
+ .num_resources = ARRAY_SIZE(tmu2_resources),
+ };
+
+-static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xffd81008,
+- .end = 0xffd81013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x460),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
+- .id = 3,
+- .dev = {
+- .platform_data = &tmu3_platform_data,
+- },
+- .resource = tmu3_resources,
+- .num_resources = ARRAY_SIZE(tmu3_resources),
+-};
+-
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xffd81014,
+- .end = 0xffd8101f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x480),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+-static struct sh_timer_config tmu5_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu5_resources[] = {
+- [0] = {
+- .start = 0xffd81020,
+- .end = 0xffd8102f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x4a0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu5_device = {
+- .name = "sh_tmu",
+- .id = 5,
+- .dev = {
+- .platform_data = &tmu5_platform_data,
+- },
+- .resource = tmu5_resources,
+- .num_resources = ARRAY_SIZE(tmu5_resources),
+-};
+-
+-static struct sh_timer_config tmu6_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu6_resources[] = {
+- [0] = {
+- .start = 0xffd82008,
+- .end = 0xffd82013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x4c0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu6_device = {
+- .name = "sh_tmu",
+- .id = 6,
+- .dev = {
+- .platform_data = &tmu6_platform_data,
+- },
+- .resource = tmu6_resources,
+- .num_resources = ARRAY_SIZE(tmu6_resources),
+-};
+-
+-static struct sh_timer_config tmu7_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu7_resources[] = {
+- [0] = {
+- .start = 0xffd82014,
+- .end = 0xffd8201f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x4e0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu7_device = {
+- .name = "sh_tmu",
+- .id = 7,
+- .dev = {
+- .platform_data = &tmu7_platform_data,
+- },
+- .resource = tmu7_resources,
+- .num_resources = ARRAY_SIZE(tmu7_resources),
+-};
+-
+-static struct sh_timer_config tmu8_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu8_resources[] = {
+- [0] = {
+- .start = 0xffd82020,
+- .end = 0xffd8202b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x500),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu8_device = {
+- .name = "sh_tmu",
+- .id = 8,
+- .dev = {
+- .platform_data = &tmu8_platform_data,
+- },
+- .resource = tmu8_resources,
+- .num_resources = ARRAY_SIZE(tmu8_resources),
+-};
+-
+ static struct platform_device *sh7770_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+@@ -484,12 +302,6 @@ static struct platform_device *sh7770_devices[] __initdata = {
+ &tmu0_device,
+ &tmu1_device,
+ &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+- &tmu6_device,
+- &tmu7_device,
+- &tmu8_device,
+ };
+
+ static int __init sh7770_devices_setup(void)
+@@ -513,12 +325,6 @@ static struct platform_device *sh7770_early_devices[] __initdata = {
+ &tmu0_device,
+ &tmu1_device,
+ &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+- &tmu6_device,
+- &tmu7_device,
+- &tmu8_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+index 668e54bafa86..3ee7dd9b3a65 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+@@ -62,25 +62,18 @@ static struct platform_device scif1_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x580),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x580)),
++ DEFINE_RES_IRQ(evt2irq(0x5a0)),
++ DEFINE_RES_IRQ(evt2irq(0x5c0)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -90,25 +83,18 @@ static struct platform_device tmu0_device = {
+ };
+
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x5a0),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffdc0000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0xe00)),
++ DEFINE_RES_IRQ(evt2irq(0xe20)),
++ DEFINE_RES_IRQ(evt2irq(0xe40)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+@@ -117,114 +103,6 @@ static struct platform_device tmu1_device = {
+ .num_resources = ARRAY_SIZE(tmu1_resources),
+ };
+
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x5c0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+-static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xffdc0008,
+- .end = 0xffdc0013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xe00),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
+- .id = 3,
+- .dev = {
+- .platform_data = &tmu3_platform_data,
+- },
+- .resource = tmu3_resources,
+- .num_resources = ARRAY_SIZE(tmu3_resources),
+-};
+-
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xffdc0014,
+- .end = 0xffdc001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xe20),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+-static struct sh_timer_config tmu5_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu5_resources[] = {
+- [0] = {
+- .start = 0xffdc0020,
+- .end = 0xffdc002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xe40),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu5_device = {
+- .name = "sh_tmu",
+- .id = 5,
+- .dev = {
+- .platform_data = &tmu5_platform_data,
+- },
+- .resource = tmu5_resources,
+- .num_resources = ARRAY_SIZE(tmu5_resources),
+-};
+-
+ static struct resource rtc_resources[] = {
+ [0] = {
+ .start = 0xffe80000,
+@@ -386,10 +264,6 @@ static struct platform_device *sh7780_devices[] __initdata = {
+ &scif1_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ &rtc_device,
+ &dma0_device,
+ &dma1_device,
+@@ -407,10 +281,6 @@ static struct platform_device *sh7780_early_devices[] __initdata = {
+ &scif1_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+index 4aa679140209..c72d5a5d0995 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+@@ -152,25 +152,18 @@ static struct platform_device scif5_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x580),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x580)),
++ DEFINE_RES_IRQ(evt2irq(0x5a0)),
++ DEFINE_RES_IRQ(evt2irq(0x5c0)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -180,25 +173,18 @@ static struct platform_device tmu0_device = {
+ };
+
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x5a0),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffdc0000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0xe00)),
++ DEFINE_RES_IRQ(evt2irq(0xe20)),
++ DEFINE_RES_IRQ(evt2irq(0xe40)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+@@ -207,114 +193,6 @@ static struct platform_device tmu1_device = {
+ .num_resources = ARRAY_SIZE(tmu1_resources),
+ };
+
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x5c0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+-static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xffdc0008,
+- .end = 0xffdc0013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xe00),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
+- .id = 3,
+- .dev = {
+- .platform_data = &tmu3_platform_data,
+- },
+- .resource = tmu3_resources,
+- .num_resources = ARRAY_SIZE(tmu3_resources),
+-};
+-
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xffdc0014,
+- .end = 0xffdc001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xe20),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+-static struct sh_timer_config tmu5_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu5_resources[] = {
+- [0] = {
+- .start = 0xffdc0020,
+- .end = 0xffdc002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0xe40),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu5_device = {
+- .name = "sh_tmu",
+- .id = 5,
+- .dev = {
+- .platform_data = &tmu5_platform_data,
+- },
+- .resource = tmu5_resources,
+- .num_resources = ARRAY_SIZE(tmu5_resources),
+-};
+-
+ /* DMA */
+ static const struct sh_dmae_channel sh7785_dmae0_channels[] = {
+ {
+@@ -460,10 +338,6 @@ static struct platform_device *sh7785_devices[] __initdata = {
+ &scif5_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ &dma0_device,
+ &dma1_device,
+ };
+@@ -484,10 +358,6 @@ static struct platform_device *sh7785_early_devices[] __initdata = {
+ &scif5_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+index 5d619a551a3b..479e79bdd3d0 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+@@ -175,25 +175,18 @@ static struct platform_device scif5_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffd80008,
+- .end = 0xffd80013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffd80000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -203,25 +196,18 @@ static struct platform_device tmu0_device = {
+ };
+
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffd80014,
+- .end = 0xffd8001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffda0000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x480)),
++ DEFINE_RES_IRQ(evt2irq(0x4a0)),
++ DEFINE_RES_IRQ(evt2irq(0x4c0)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+@@ -231,24 +217,18 @@ static struct platform_device tmu1_device = {
+ };
+
+ static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffd80020,
+- .end = 0xffd8002f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffdc0000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x7a0)),
++ DEFINE_RES_IRQ(evt2irq(0x7a0)),
++ DEFINE_RES_IRQ(evt2irq(0x7a0)),
+ };
+
+ static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 2,
+ .dev = {
+ .platform_data = &tmu2_platform_data,
+@@ -258,24 +238,18 @@ static struct platform_device tmu2_device = {
+ };
+
+ static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xffda0008,
+- .end = 0xffda0013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x480),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffde0000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x7c0)),
++ DEFINE_RES_IRQ(evt2irq(0x7c0)),
++ DEFINE_RES_IRQ(evt2irq(0x7c0)),
+ };
+
+ static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 3,
+ .dev = {
+ .platform_data = &tmu3_platform_data,
+@@ -284,222 +258,6 @@ static struct platform_device tmu3_device = {
+ .num_resources = ARRAY_SIZE(tmu3_resources),
+ };
+
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xffda0014,
+- .end = 0xffda001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x4a0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+-static struct sh_timer_config tmu5_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu5_resources[] = {
+- [0] = {
+- .start = 0xffda0020,
+- .end = 0xffda002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x4c0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu5_device = {
+- .name = "sh_tmu",
+- .id = 5,
+- .dev = {
+- .platform_data = &tmu5_platform_data,
+- },
+- .resource = tmu5_resources,
+- .num_resources = ARRAY_SIZE(tmu5_resources),
+-};
+-
+-static struct sh_timer_config tmu6_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu6_resources[] = {
+- [0] = {
+- .start = 0xffdc0008,
+- .end = 0xffdc0013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x7a0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu6_device = {
+- .name = "sh_tmu",
+- .id = 6,
+- .dev = {
+- .platform_data = &tmu6_platform_data,
+- },
+- .resource = tmu6_resources,
+- .num_resources = ARRAY_SIZE(tmu6_resources),
+-};
+-
+-static struct sh_timer_config tmu7_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu7_resources[] = {
+- [0] = {
+- .start = 0xffdc0014,
+- .end = 0xffdc001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x7a0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu7_device = {
+- .name = "sh_tmu",
+- .id = 7,
+- .dev = {
+- .platform_data = &tmu7_platform_data,
+- },
+- .resource = tmu7_resources,
+- .num_resources = ARRAY_SIZE(tmu7_resources),
+-};
+-
+-static struct sh_timer_config tmu8_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu8_resources[] = {
+- [0] = {
+- .start = 0xffdc0020,
+- .end = 0xffdc002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x7a0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu8_device = {
+- .name = "sh_tmu",
+- .id = 8,
+- .dev = {
+- .platform_data = &tmu8_platform_data,
+- },
+- .resource = tmu8_resources,
+- .num_resources = ARRAY_SIZE(tmu8_resources),
+-};
+-
+-static struct sh_timer_config tmu9_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu9_resources[] = {
+- [0] = {
+- .start = 0xffde0008,
+- .end = 0xffde0013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x7c0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu9_device = {
+- .name = "sh_tmu",
+- .id = 9,
+- .dev = {
+- .platform_data = &tmu9_platform_data,
+- },
+- .resource = tmu9_resources,
+- .num_resources = ARRAY_SIZE(tmu9_resources),
+-};
+-
+-static struct sh_timer_config tmu10_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu10_resources[] = {
+- [0] = {
+- .start = 0xffde0014,
+- .end = 0xffde001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x7c0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu10_device = {
+- .name = "sh_tmu",
+- .id = 10,
+- .dev = {
+- .platform_data = &tmu10_platform_data,
+- },
+- .resource = tmu10_resources,
+- .num_resources = ARRAY_SIZE(tmu10_resources),
+-};
+-
+-static struct sh_timer_config tmu11_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu11_resources[] = {
+- [0] = {
+- .start = 0xffde0020,
+- .end = 0xffde002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x7c0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu11_device = {
+- .name = "sh_tmu",
+- .id = 11,
+- .dev = {
+- .platform_data = &tmu11_platform_data,
+- },
+- .resource = tmu11_resources,
+- .num_resources = ARRAY_SIZE(tmu11_resources),
+-};
+-
+ static const struct sh_dmae_channel dmac0_channels[] = {
+ {
+ .offset = 0,
+@@ -641,15 +399,6 @@ static struct platform_device *sh7786_early_devices[] __initdata = {
+ &tmu0_device,
+ &tmu1_device,
+ &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+- &tmu6_device,
+- &tmu7_device,
+- &tmu8_device,
+- &tmu9_device,
+- &tmu10_device,
+- &tmu11_device,
+ };
+
+ static struct platform_device *sh7786_devices[] __initdata = {
+diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
+index 0856bcbb1da0..a78c5feb4e3b 100644
+--- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c
++++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
+@@ -100,25 +100,18 @@ static struct platform_device scif2_device = {
+ };
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = 0xffc10008,
+- .end = 0xffc10013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x400),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffc10000, 0x30),
++ DEFINE_RES_IRQ(evt2irq(0x400)),
++ DEFINE_RES_IRQ(evt2irq(0x420)),
++ DEFINE_RES_IRQ(evt2irq(0x440)),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -128,25 +121,18 @@ static struct platform_device tmu0_device = {
+ };
+
+ static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = 0xffc10014,
+- .end = 0xffc1001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x420),
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(0xffc20000, 0x2c),
++ DEFINE_RES_IRQ(evt2irq(0x460)),
++ DEFINE_RES_IRQ(evt2irq(0x480)),
++ DEFINE_RES_IRQ(evt2irq(0x4a0)),
+ };
+
+ static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 1,
+ .dev = {
+ .platform_data = &tmu1_platform_data,
+@@ -155,124 +141,12 @@ static struct platform_device tmu1_device = {
+ .num_resources = ARRAY_SIZE(tmu1_resources),
+ };
+
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = 0xffc10020,
+- .end = 0xffc1002f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x440),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+-static struct sh_timer_config tmu3_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+-};
+-
+-static struct resource tmu3_resources[] = {
+- [0] = {
+- .start = 0xffc20008,
+- .end = 0xffc20013,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x460),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu3_device = {
+- .name = "sh_tmu",
+- .id = 3,
+- .dev = {
+- .platform_data = &tmu3_platform_data,
+- },
+- .resource = tmu3_resources,
+- .num_resources = ARRAY_SIZE(tmu3_resources),
+-};
+-
+-static struct sh_timer_config tmu4_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+-};
+-
+-static struct resource tmu4_resources[] = {
+- [0] = {
+- .start = 0xffc20014,
+- .end = 0xffc2001f,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x480),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu4_device = {
+- .name = "sh_tmu",
+- .id = 4,
+- .dev = {
+- .platform_data = &tmu4_platform_data,
+- },
+- .resource = tmu4_resources,
+- .num_resources = ARRAY_SIZE(tmu4_resources),
+-};
+-
+-static struct sh_timer_config tmu5_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu5_resources[] = {
+- [0] = {
+- .start = 0xffc20020,
+- .end = 0xffc2002b,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = evt2irq(0x4a0),
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu5_device = {
+- .name = "sh_tmu",
+- .id = 5,
+- .dev = {
+- .platform_data = &tmu5_platform_data,
+- },
+- .resource = tmu5_resources,
+- .num_resources = ARRAY_SIZE(tmu5_resources),
+-};
+-
+ static struct platform_device *shx3_early_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &scif2_device,
+ &tmu0_device,
+ &tmu1_device,
+- &tmu2_device,
+- &tmu3_device,
+- &tmu4_device,
+- &tmu5_device,
+ };
+
+ static int __init shx3_devices_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh5/setup-sh5.c b/arch/sh/kernel/cpu/sh5/setup-sh5.c
+index 14d68213d16b..1bf0b2cf6652 100644
+--- a/arch/sh/kernel/cpu/sh5/setup-sh5.c
++++ b/arch/sh/kernel/cpu/sh5/setup-sh5.c
+@@ -71,30 +71,20 @@ static struct platform_device rtc_device = {
+
+ #define TMU_BLOCK_OFF 0x01020000
+ #define TMU_BASE PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF
+-#define TMU0_BASE (TMU_BASE + 0x8 + (0xc * 0x0))
+-#define TMU1_BASE (TMU_BASE + 0x8 + (0xc * 0x1))
+-#define TMU2_BASE (TMU_BASE + 0x8 + (0xc * 0x2))
+
+ static struct sh_timer_config tmu0_platform_data = {
+- .channel_offset = 0x04,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++ .channels_mask = 7,
+ };
+
+ static struct resource tmu0_resources[] = {
+- [0] = {
+- .start = TMU0_BASE,
+- .end = TMU0_BASE + 0xc - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = IRQ_TUNI0,
+- .flags = IORESOURCE_IRQ,
+- },
++ DEFINE_RES_MEM(TMU_BASE, 0x30),
++ DEFINE_RES_IRQ(IRQ_TUNI0),
++ DEFINE_RES_IRQ(IRQ_TUNI1),
++ DEFINE_RES_IRQ(IRQ_TUNI2),
+ };
+
+ static struct platform_device tmu0_device = {
+- .name = "sh_tmu",
++ .name = "sh-tmu",
+ .id = 0,
+ .dev = {
+ .platform_data = &tmu0_platform_data,
+@@ -103,66 +93,9 @@ static struct platform_device tmu0_device = {
+ .num_resources = ARRAY_SIZE(tmu0_resources),
+ };
+
+-static struct sh_timer_config tmu1_platform_data = {
+- .channel_offset = 0x10,
+- .timer_bit = 1,
+- .clocksource_rating = 200,
+-};
+-
+-static struct resource tmu1_resources[] = {
+- [0] = {
+- .start = TMU1_BASE,
+- .end = TMU1_BASE + 0xc - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = IRQ_TUNI1,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu1_device = {
+- .name = "sh_tmu",
+- .id = 1,
+- .dev = {
+- .platform_data = &tmu1_platform_data,
+- },
+- .resource = tmu1_resources,
+- .num_resources = ARRAY_SIZE(tmu1_resources),
+-};
+-
+-static struct sh_timer_config tmu2_platform_data = {
+- .channel_offset = 0x1c,
+- .timer_bit = 2,
+-};
+-
+-static struct resource tmu2_resources[] = {
+- [0] = {
+- .start = TMU2_BASE,
+- .end = TMU2_BASE + 0xc - 1,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = IRQ_TUNI2,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device tmu2_device = {
+- .name = "sh_tmu",
+- .id = 2,
+- .dev = {
+- .platform_data = &tmu2_platform_data,
+- },
+- .resource = tmu2_resources,
+- .num_resources = ARRAY_SIZE(tmu2_resources),
+-};
+-
+ static struct platform_device *sh5_early_devices[] __initdata = {
+ &scif0_device,
+ &tmu0_device,
+- &tmu1_device,
+- &tmu2_device,
+ };
+
+ static struct platform_device *sh5_devices[] __initdata = {
+--
+2.1.2
+
diff --git a/patches.renesas/0724-sh-Switch-to-new-style-MTU2-device.patch b/patches.renesas/0724-sh-Switch-to-new-style-MTU2-device.patch
new file mode 100644
index 00000000000000..867b73b7408c7e
--- /dev/null
+++ b/patches.renesas/0724-sh-Switch-to-new-style-MTU2-device.patch
@@ -0,0 +1,730 @@
+From dfdcc20d59de3d006bdf38a5fcba726f03445ab0 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 23 Apr 2014 13:15:21 +0200
+Subject: sh: Switch to new style MTU2 device
+
+The MTU2 (Multi-Function Timer Pulse Unit 2) driver implements a new
+style of platform data that handles the timer as a single device with
+multiple channel. Switch from the old-style platform data to the
+new-style platform data.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Wolfram Sang <wsa@sang-engineering.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 5204601c0877b3ffc90e417bf30fccc9bdf47962)
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/sh/kernel/cpu/clock-cpg.c | 2 +-
+ arch/sh/kernel/cpu/sh2a/clock-sh7264.c | 2 +-
+ arch/sh/kernel/cpu/sh2a/clock-sh7269.c | 2 +-
+ arch/sh/kernel/cpu/sh2a/setup-mxg.c | 98 +++++-----------------------------
+ arch/sh/kernel/cpu/sh2a/setup-sh7201.c | 98 +++++-----------------------------
+ arch/sh/kernel/cpu/sh2a/setup-sh7203.c | 67 ++++-------------------
+ arch/sh/kernel/cpu/sh2a/setup-sh7206.c | 98 +++++-----------------------------
+ arch/sh/kernel/cpu/sh2a/setup-sh7264.c | 71 ++++--------------------
+ arch/sh/kernel/cpu/sh2a/setup-sh7269.c | 67 ++++-------------------
+ 9 files changed, 72 insertions(+), 433 deletions(-)
+
+diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c
+index 121ef690763f..8525a671266f 100644
+--- a/arch/sh/kernel/cpu/clock-cpg.c
++++ b/arch/sh/kernel/cpu/clock-cpg.c
+@@ -60,7 +60,7 @@ int __init __deprecated cpg_clk_init(void)
+ clk_add_alias("fck", "sh-tmu.0", "peripheral_clk", NULL);
+ clk_add_alias("fck", "sh-tmu.1", "peripheral_clk", NULL);
+ clk_add_alias("fck", "sh-tmu.2", "peripheral_clk", NULL);
+- clk_add_alias("mtu2_fck", NULL, "peripheral_clk", NULL);
++ clk_add_alias("fck", "sh-mtu2", "peripheral_clk", NULL);
+ clk_add_alias("fck", "sh-cmt-16.0", "peripheral_clk", NULL);
+ clk_add_alias("fck", "sh-cmt-32.0", "peripheral_clk", NULL);
+ clk_add_alias("sci_ick", NULL, "peripheral_clk", NULL);
+diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7264.c b/arch/sh/kernel/cpu/sh2a/clock-sh7264.c
+index c7f3c666a0ac..8638fba6cd7f 100644
+--- a/arch/sh/kernel/cpu/sh2a/clock-sh7264.c
++++ b/arch/sh/kernel/cpu/sh2a/clock-sh7264.c
+@@ -119,7 +119,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("vdc3", &mstp_clks[MSTP74]),
+ CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[MSTP72]),
+ CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]),
+- CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP35]),
++ CLKDEV_ICK_ID("fck", "sh-mtu2", &mstp_clks[MSTP35]),
+ CLKDEV_CON_ID("sdhi0", &mstp_clks[MSTP34]),
+ CLKDEV_CON_ID("sdhi1", &mstp_clks[MSTP33]),
+ CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]),
+diff --git a/arch/sh/kernel/cpu/sh2a/clock-sh7269.c b/arch/sh/kernel/cpu/sh2a/clock-sh7269.c
+index 4f47464f2fb6..f8a5c2abdfb3 100644
+--- a/arch/sh/kernel/cpu/sh2a/clock-sh7269.c
++++ b/arch/sh/kernel/cpu/sh2a/clock-sh7269.c
+@@ -160,7 +160,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]),
+ CLKDEV_ICK_ID("fck", "sh-cmt-16.0", &mstp_clks[MSTP72]),
+ CLKDEV_CON_ID("usb0", &mstp_clks[MSTP60]),
+- CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP35]),
++ CLKDEV_ICK_ID("fck", "sh-mtu2", &mstp_clks[MSTP35]),
+ CLKDEV_CON_ID("adc0", &mstp_clks[MSTP32]),
+ CLKDEV_CON_ID("rtc0", &mstp_clks[MSTP30]),
+ };
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-mxg.c b/arch/sh/kernel/cpu/sh2a/setup-mxg.c
+index 63e996f9a7ed..26fcdbd4127a 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-mxg.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-mxg.c
+@@ -114,88 +114,18 @@ static struct intc_mask_reg mask_registers[] __initdata = {
+ static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups,
+ mask_registers, prio_registers, NULL);
+
+-static struct sh_timer_config mtu2_0_platform_data = {
+- .channel_offset = -0x80,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++static struct resource mtu2_resources[] = {
++ DEFINE_RES_MEM(0xff801000, 0x400),
++ DEFINE_RES_IRQ_NAMED(228, "tgi0a"),
++ DEFINE_RES_IRQ_NAMED(234, "tgi1a"),
++ DEFINE_RES_IRQ_NAMED(240, "tgi2a"),
+ };
+
+-static struct resource mtu2_0_resources[] = {
+- [0] = {
+- .start = 0xff801300,
+- .end = 0xff801326,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 228,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_0_device = {
+- .name = "sh_mtu2",
+- .id = 0,
+- .dev = {
+- .platform_data = &mtu2_0_platform_data,
+- },
+- .resource = mtu2_0_resources,
+- .num_resources = ARRAY_SIZE(mtu2_0_resources),
+-};
+-
+-static struct sh_timer_config mtu2_1_platform_data = {
+- .channel_offset = -0x100,
+- .timer_bit = 1,
+- .clockevent_rating = 200,
+-};
+-
+-static struct resource mtu2_1_resources[] = {
+- [0] = {
+- .start = 0xff801380,
+- .end = 0xff801390,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 234,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_1_device = {
+- .name = "sh_mtu2",
+- .id = 1,
+- .dev = {
+- .platform_data = &mtu2_1_platform_data,
+- },
+- .resource = mtu2_1_resources,
+- .num_resources = ARRAY_SIZE(mtu2_1_resources),
+-};
+-
+-static struct sh_timer_config mtu2_2_platform_data = {
+- .channel_offset = 0x80,
+- .timer_bit = 2,
+- .clockevent_rating = 200,
+-};
+-
+-static struct resource mtu2_2_resources[] = {
+- [0] = {
+- .start = 0xff801000,
+- .end = 0xff80100a,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 240,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_2_device = {
+- .name = "sh_mtu2",
+- .id = 2,
+- .dev = {
+- .platform_data = &mtu2_2_platform_data,
+- },
+- .resource = mtu2_2_resources,
+- .num_resources = ARRAY_SIZE(mtu2_2_resources),
++static struct platform_device mtu2_device = {
++ .name = "sh-mtu2",
++ .id = -1,
++ .resource = mtu2_resources,
++ .num_resources = ARRAY_SIZE(mtu2_resources),
+ };
+
+ static struct plat_sci_port scif0_platform_data = {
+@@ -221,9 +151,7 @@ static struct platform_device scif0_device = {
+
+ static struct platform_device *mxg_devices[] __initdata = {
+ &scif0_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
+- &mtu2_2_device,
++ &mtu2_device,
+ };
+
+ static int __init mxg_devices_setup(void)
+@@ -240,9 +168,7 @@ void __init plat_irq_setup(void)
+
+ static struct platform_device *mxg_early_devices[] __initdata = {
+ &scif0_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
+- &mtu2_2_device,
++ &mtu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
+index 2c6874461536..abc0ce9fb800 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c
+@@ -365,88 +365,18 @@ static struct platform_device rtc_device = {
+ .resource = rtc_resources,
+ };
+
+-static struct sh_timer_config mtu2_0_platform_data = {
+- .channel_offset = -0x80,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++static struct resource mtu2_resources[] = {
++ DEFINE_RES_MEM(0xfffe4000, 0x400),
++ DEFINE_RES_IRQ_NAMED(108, "tgi0a"),
++ DEFINE_RES_IRQ_NAMED(116, "tgi1a"),
++ DEFINE_RES_IRQ_NAMED(124, "tgi1b"),
+ };
+
+-static struct resource mtu2_0_resources[] = {
+- [0] = {
+- .start = 0xfffe4300,
+- .end = 0xfffe4326,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 108,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_0_device = {
+- .name = "sh_mtu2",
+- .id = 0,
+- .dev = {
+- .platform_data = &mtu2_0_platform_data,
+- },
+- .resource = mtu2_0_resources,
+- .num_resources = ARRAY_SIZE(mtu2_0_resources),
+-};
+-
+-static struct sh_timer_config mtu2_1_platform_data = {
+- .channel_offset = -0x100,
+- .timer_bit = 1,
+- .clockevent_rating = 200,
+-};
+-
+-static struct resource mtu2_1_resources[] = {
+- [0] = {
+- .start = 0xfffe4380,
+- .end = 0xfffe4390,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 116,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_1_device = {
+- .name = "sh_mtu2",
+- .id = 1,
+- .dev = {
+- .platform_data = &mtu2_1_platform_data,
+- },
+- .resource = mtu2_1_resources,
+- .num_resources = ARRAY_SIZE(mtu2_1_resources),
+-};
+-
+-static struct sh_timer_config mtu2_2_platform_data = {
+- .channel_offset = 0x80,
+- .timer_bit = 2,
+- .clockevent_rating = 200,
+-};
+-
+-static struct resource mtu2_2_resources[] = {
+- [0] = {
+- .start = 0xfffe4000,
+- .end = 0xfffe400a,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 124,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_2_device = {
+- .name = "sh_mtu2",
+- .id = 2,
+- .dev = {
+- .platform_data = &mtu2_2_platform_data,
+- },
+- .resource = mtu2_2_resources,
+- .num_resources = ARRAY_SIZE(mtu2_2_resources),
++static struct platform_device mtu2_device = {
++ .name = "sh-mtu2",
++ .id = -1,
++ .resource = mtu2_resources,
++ .num_resources = ARRAY_SIZE(mtu2_resources),
+ };
+
+ static struct platform_device *sh7201_devices[] __initdata = {
+@@ -459,9 +389,7 @@ static struct platform_device *sh7201_devices[] __initdata = {
+ &scif6_device,
+ &scif7_device,
+ &rtc_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
+- &mtu2_2_device,
++ &mtu2_device,
+ };
+
+ static int __init sh7201_devices_setup(void)
+@@ -485,9 +413,7 @@ static struct platform_device *sh7201_early_devices[] __initdata = {
+ &scif5_device,
+ &scif6_device,
+ &scif7_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
+- &mtu2_2_device,
++ &mtu2_device,
+ };
+
+ #define STBCR3 0xfffe0408
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+index 374f8c09d924..3b4894cba92f 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+@@ -285,60 +285,17 @@ static struct platform_device cmt_device = {
+ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+-static struct sh_timer_config mtu2_0_platform_data = {
+- .channel_offset = -0x80,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++static struct resource mtu2_resources[] = {
++ DEFINE_RES_MEM(0xfffe4000, 0x400),
++ DEFINE_RES_IRQ_NAMED(146, "tgi0a"),
++ DEFINE_RES_IRQ_NAMED(153, "tgi1a"),
+ };
+
+-static struct resource mtu2_0_resources[] = {
+- [0] = {
+- .start = 0xfffe4300,
+- .end = 0xfffe4326,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 146,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_0_device = {
+- .name = "sh_mtu2",
+- .id = 0,
+- .dev = {
+- .platform_data = &mtu2_0_platform_data,
+- },
+- .resource = mtu2_0_resources,
+- .num_resources = ARRAY_SIZE(mtu2_0_resources),
+-};
+-
+-static struct sh_timer_config mtu2_1_platform_data = {
+- .channel_offset = -0x100,
+- .timer_bit = 1,
+- .clockevent_rating = 200,
+-};
+-
+-static struct resource mtu2_1_resources[] = {
+- [0] = {
+- .start = 0xfffe4380,
+- .end = 0xfffe4390,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 153,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_1_device = {
+- .name = "sh_mtu2",
+- .id = 1,
+- .dev = {
+- .platform_data = &mtu2_1_platform_data,
+- },
+- .resource = mtu2_1_resources,
+- .num_resources = ARRAY_SIZE(mtu2_1_resources),
++static struct platform_device mtu2_device = {
++ .name = "sh-mtu2",
++ .id = -1,
++ .resource = mtu2_resources,
++ .num_resources = ARRAY_SIZE(mtu2_resources),
+ };
+
+ static struct resource rtc_resources[] = {
+@@ -367,8 +324,7 @@ static struct platform_device *sh7203_devices[] __initdata = {
+ &scif2_device,
+ &scif3_device,
+ &cmt_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
++ &mtu2_device,
+ &rtc_device,
+ };
+
+@@ -390,8 +346,7 @@ static struct platform_device *sh7203_early_devices[] __initdata = {
+ &scif2_device,
+ &scif3_device,
+ &cmt_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
++ &mtu2_device,
+ };
+
+ #define STBCR3 0xfffe0408
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
+index d00e6fd998ec..49bc5a34bec1 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c
+@@ -237,88 +237,18 @@ static struct platform_device cmt_device = {
+ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+-static struct sh_timer_config mtu2_0_platform_data = {
+- .channel_offset = -0x80,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++static struct resource mtu2_resources[] = {
++ DEFINE_RES_MEM(0xfffe4000, 0x400),
++ DEFINE_RES_IRQ_NAMED(156, "tgi0a"),
++ DEFINE_RES_IRQ_NAMED(164, "tgi1a"),
++ DEFINE_RES_IRQ_NAMED(180, "tgi2a"),
+ };
+
+-static struct resource mtu2_0_resources[] = {
+- [0] = {
+- .start = 0xfffe4300,
+- .end = 0xfffe4326,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 156,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_0_device = {
+- .name = "sh_mtu2",
+- .id = 0,
+- .dev = {
+- .platform_data = &mtu2_0_platform_data,
+- },
+- .resource = mtu2_0_resources,
+- .num_resources = ARRAY_SIZE(mtu2_0_resources),
+-};
+-
+-static struct sh_timer_config mtu2_1_platform_data = {
+- .channel_offset = -0x100,
+- .timer_bit = 1,
+- .clockevent_rating = 200,
+-};
+-
+-static struct resource mtu2_1_resources[] = {
+- [0] = {
+- .start = 0xfffe4380,
+- .end = 0xfffe4390,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 164,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_1_device = {
+- .name = "sh_mtu2",
+- .id = 1,
+- .dev = {
+- .platform_data = &mtu2_1_platform_data,
+- },
+- .resource = mtu2_1_resources,
+- .num_resources = ARRAY_SIZE(mtu2_1_resources),
+-};
+-
+-static struct sh_timer_config mtu2_2_platform_data = {
+- .channel_offset = 0x80,
+- .timer_bit = 2,
+- .clockevent_rating = 200,
+-};
+-
+-static struct resource mtu2_2_resources[] = {
+- [0] = {
+- .start = 0xfffe4000,
+- .end = 0xfffe400a,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 180,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_2_device = {
+- .name = "sh_mtu2",
+- .id = 2,
+- .dev = {
+- .platform_data = &mtu2_2_platform_data,
+- },
+- .resource = mtu2_2_resources,
+- .num_resources = ARRAY_SIZE(mtu2_2_resources),
++static struct platform_device mtu2_device = {
++ .name = "sh-mtu2s",
++ .id = -1,
++ .resource = mtu2_resources,
++ .num_resources = ARRAY_SIZE(mtu2_resources),
+ };
+
+ static struct platform_device *sh7206_devices[] __initdata = {
+@@ -327,9 +257,7 @@ static struct platform_device *sh7206_devices[] __initdata = {
+ &scif2_device,
+ &scif3_device,
+ &cmt_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
+- &mtu2_2_device,
++ &mtu2_device,
+ };
+
+ static int __init sh7206_devices_setup(void)
+@@ -350,9 +278,7 @@ static struct platform_device *sh7206_early_devices[] __initdata = {
+ &scif2_device,
+ &scif3_device,
+ &cmt_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
+- &mtu2_2_device,
++ &mtu2_device,
+ };
+
+ #define STBCR3 0xfffe0408
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7264.c b/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
+index e95250e82752..608146455562 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-sh7264.c
+@@ -453,64 +453,17 @@ static struct platform_device cmt_device = {
+ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+-static struct sh_timer_config mtu2_0_platform_data = {
+- .name = "MTU2_0",
+- .channel_offset = -0x80,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++static struct resource mtu2_resources[] = {
++ DEFINE_RES_MEM(0xfffe4000, 0x400),
++ DEFINE_RES_IRQ_NAMED(179, "tgi0a"),
++ DEFINE_RES_IRQ_NAMED(186, "tgi1a"),
+ };
+
+-static struct resource mtu2_0_resources[] = {
+- [0] = {
+- .name = "MTU2_0",
+- .start = 0xfffe4300,
+- .end = 0xfffe4326,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 179,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_0_device = {
+- .name = "sh_mtu2",
+- .id = 0,
+- .dev = {
+- .platform_data = &mtu2_0_platform_data,
+- },
+- .resource = mtu2_0_resources,
+- .num_resources = ARRAY_SIZE(mtu2_0_resources),
+-};
+-
+-static struct sh_timer_config mtu2_1_platform_data = {
+- .name = "MTU2_1",
+- .channel_offset = -0x100,
+- .timer_bit = 1,
+- .clockevent_rating = 200,
+-};
+-
+-static struct resource mtu2_1_resources[] = {
+- [0] = {
+- .name = "MTU2_1",
+- .start = 0xfffe4380,
+- .end = 0xfffe4390,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 186,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_1_device = {
+- .name = "sh_mtu2",
+- .id = 1,
+- .dev = {
+- .platform_data = &mtu2_1_platform_data,
+- },
+- .resource = mtu2_1_resources,
+- .num_resources = ARRAY_SIZE(mtu2_1_resources),
++static struct platform_device mtu2_device = {
++ .name = "sh-mtu2",
++ .id = -1,
++ .resource = mtu2_resources,
++ .num_resources = ARRAY_SIZE(mtu2_resources),
+ };
+
+ static struct resource rtc_resources[] = {
+@@ -580,8 +533,7 @@ static struct platform_device *sh7264_devices[] __initdata = {
+ &scif6_device,
+ &scif7_device,
+ &cmt_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
++ &mtu2_device,
+ &rtc_device,
+ &r8a66597_usb_host_device,
+ };
+@@ -608,8 +560,7 @@ static struct platform_device *sh7264_early_devices[] __initdata = {
+ &scif6_device,
+ &scif7_device,
+ &cmt_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
++ &mtu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7269.c b/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
+index 0191e1ae8411..16ce5aa77bdd 100644
+--- a/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
++++ b/arch/sh/kernel/cpu/sh2a/setup-sh7269.c
+@@ -475,60 +475,17 @@ static struct platform_device cmt_device = {
+ .num_resources = ARRAY_SIZE(cmt_resources),
+ };
+
+-static struct sh_timer_config mtu2_0_platform_data = {
+- .channel_offset = -0x80,
+- .timer_bit = 0,
+- .clockevent_rating = 200,
++static struct resource mtu2_resources[] = {
++ DEFINE_RES_MEM(0xfffe4000, 0x400),
++ DEFINE_RES_IRQ_NAMED(192, "tgi0a"),
++ DEFINE_RES_IRQ_NAMED(203, "tgi1a"),
+ };
+
+-static struct resource mtu2_0_resources[] = {
+- [0] = {
+- .start = 0xfffe4300,
+- .end = 0xfffe4326,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 192,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_0_device = {
+- .name = "sh_mtu2",
+- .id = 0,
+- .dev = {
+- .platform_data = &mtu2_0_platform_data,
+- },
+- .resource = mtu2_0_resources,
+- .num_resources = ARRAY_SIZE(mtu2_0_resources),
+-};
+-
+-static struct sh_timer_config mtu2_1_platform_data = {
+- .channel_offset = -0x100,
+- .timer_bit = 1,
+- .clockevent_rating = 200,
+-};
+-
+-static struct resource mtu2_1_resources[] = {
+- [0] = {
+- .start = 0xfffe4380,
+- .end = 0xfffe4390,
+- .flags = IORESOURCE_MEM,
+- },
+- [1] = {
+- .start = 203,
+- .flags = IORESOURCE_IRQ,
+- },
+-};
+-
+-static struct platform_device mtu2_1_device = {
+- .name = "sh_mtu2",
+- .id = 1,
+- .dev = {
+- .platform_data = &mtu2_1_platform_data,
+- },
+- .resource = mtu2_1_resources,
+- .num_resources = ARRAY_SIZE(mtu2_1_resources),
++static struct platform_device mtu2_device = {
++ .name = "sh-mtu2",
++ .id = -1,
++ .resource = mtu2_resources,
++ .num_resources = ARRAY_SIZE(mtu2_resources),
+ };
+
+ static struct resource rtc_resources[] = {
+@@ -592,8 +549,7 @@ static struct platform_device *sh7269_devices[] __initdata = {
+ &scif6_device,
+ &scif7_device,
+ &cmt_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
++ &mtu2_device,
+ &rtc_device,
+ &r8a66597_usb_host_device,
+ };
+@@ -620,8 +576,7 @@ static struct platform_device *sh7269_early_devices[] __initdata = {
+ &scif6_device,
+ &scif7_device,
+ &cmt_device,
+- &mtu2_0_device,
+- &mtu2_1_device,
++ &mtu2_device,
+ };
+
+ void __init plat_early_device_setup(void)
+--
+2.1.2
+
diff --git a/patches.renesas/0725-clocksource-sh_cmt-Drop-support-for-legacy-platform-.patch b/patches.renesas/0725-clocksource-sh_cmt-Drop-support-for-legacy-platform-.patch
new file mode 100644
index 00000000000000..f01691dd3cb972
--- /dev/null
+++ b/patches.renesas/0725-clocksource-sh_cmt-Drop-support-for-legacy-platform-.patch
@@ -0,0 +1,280 @@
+From 3299a98dc63658c707816ac96c99fa14df12fa70 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 28 Jan 2014 15:52:46 +0100
+Subject: clocksource: sh_cmt: Drop support for legacy platform data
+
+Now that all platforms have switched to the new-style platform data,
+drop support for the legacy version.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 31e912f598371bcfdffc990289029e1110f8b3f9)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/clocksource/sh_cmt.c | 172 ++++++++++---------------------------------
+ 1 file changed, 40 insertions(+), 132 deletions(-)
+
+diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
+index dfa780396b91..fcd38db9ce5c 100644
+--- a/drivers/clocksource/sh_cmt.c
++++ b/drivers/clocksource/sh_cmt.c
+@@ -114,9 +114,7 @@ struct sh_cmt_device {
+ struct platform_device *pdev;
+
+ const struct sh_cmt_info *info;
+- bool legacy;
+
+- void __iomem *mapbase_ch;
+ void __iomem *mapbase;
+ struct clk *clk;
+
+@@ -792,7 +790,7 @@ static int sh_cmt_register_clockevent(struct sh_cmt_channel *ch,
+ int irq;
+ int ret;
+
+- irq = platform_get_irq(ch->cmt->pdev, ch->cmt->legacy ? 0 : ch->index);
++ irq = platform_get_irq(ch->cmt->pdev, ch->index);
+ if (irq < 0) {
+ dev_err(&ch->cmt->pdev->dev, "ch%u: failed to get irq\n",
+ ch->index);
+@@ -863,33 +861,26 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
+ * Compute the address of the channel control register block. For the
+ * timers with a per-channel start/stop register, compute its address
+ * as well.
+- *
+- * For legacy configuration the address has been mapped explicitly.
+ */
+- if (cmt->legacy) {
+- ch->ioctrl = cmt->mapbase_ch;
+- } else {
+- switch (cmt->info->model) {
+- case SH_CMT_16BIT:
+- ch->ioctrl = cmt->mapbase + 2 + ch->hwidx * 6;
+- break;
+- case SH_CMT_32BIT:
+- case SH_CMT_48BIT:
+- ch->ioctrl = cmt->mapbase + 0x10 + ch->hwidx * 0x10;
+- break;
+- case SH_CMT_32BIT_FAST:
+- /*
+- * The 32-bit "fast" timer has a single channel at hwidx
+- * 5 but is located at offset 0x40 instead of 0x60 for
+- * some reason.
+- */
+- ch->ioctrl = cmt->mapbase + 0x40;
+- break;
+- case SH_CMT_48BIT_GEN2:
+- ch->iostart = cmt->mapbase + ch->hwidx * 0x100;
+- ch->ioctrl = ch->iostart + 0x10;
+- break;
+- }
++ switch (cmt->info->model) {
++ case SH_CMT_16BIT:
++ ch->ioctrl = cmt->mapbase + 2 + ch->hwidx * 6;
++ break;
++ case SH_CMT_32BIT:
++ case SH_CMT_48BIT:
++ ch->ioctrl = cmt->mapbase + 0x10 + ch->hwidx * 0x10;
++ break;
++ case SH_CMT_32BIT_FAST:
++ /*
++ * The 32-bit "fast" timer has a single channel at hwidx 5 but
++ * is located at offset 0x40 instead of 0x60 for some reason.
++ */
++ ch->ioctrl = cmt->mapbase + 0x40;
++ break;
++ case SH_CMT_48BIT_GEN2:
++ ch->iostart = cmt->mapbase + ch->hwidx * 0x100;
++ ch->ioctrl = ch->iostart + 0x10;
++ break;
+ }
+
+ if (cmt->info->width == (sizeof(ch->max_match_value) * 8))
+@@ -900,12 +891,7 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
+ ch->match_value = ch->max_match_value;
+ raw_spin_lock_init(&ch->lock);
+
+- if (cmt->legacy) {
+- ch->timer_bit = ch->hwidx;
+- } else {
+- ch->timer_bit = cmt->info->model == SH_CMT_48BIT_GEN2
+- ? 0 : ch->hwidx;
+- }
++ ch->timer_bit = cmt->info->model == SH_CMT_48BIT_GEN2 ? 0 : ch->hwidx;
+
+ ret = sh_cmt_register(ch, dev_name(&cmt->pdev->dev),
+ clockevent, clocksource);
+@@ -938,60 +924,12 @@ static int sh_cmt_map_memory(struct sh_cmt_device *cmt)
+ return 0;
+ }
+
+-static int sh_cmt_map_memory_legacy(struct sh_cmt_device *cmt)
+-{
+- struct sh_timer_config *cfg = cmt->pdev->dev.platform_data;
+- struct resource *res, *res2;
+-
+- /* map memory, let mapbase_ch point to our channel */
+- res = platform_get_resource(cmt->pdev, IORESOURCE_MEM, 0);
+- if (!res) {
+- dev_err(&cmt->pdev->dev, "failed to get I/O memory\n");
+- return -ENXIO;
+- }
+-
+- cmt->mapbase_ch = ioremap_nocache(res->start, resource_size(res));
+- if (cmt->mapbase_ch == NULL) {
+- dev_err(&cmt->pdev->dev, "failed to remap I/O memory\n");
+- return -ENXIO;
+- }
+-
+- /* optional resource for the shared timer start/stop register */
+- res2 = platform_get_resource(cmt->pdev, IORESOURCE_MEM, 1);
+-
+- /* map second resource for CMSTR */
+- cmt->mapbase = ioremap_nocache(res2 ? res2->start :
+- res->start - cfg->channel_offset,
+- res2 ? resource_size(res2) : 2);
+- if (cmt->mapbase == NULL) {
+- dev_err(&cmt->pdev->dev, "failed to remap I/O second memory\n");
+- iounmap(cmt->mapbase_ch);
+- return -ENXIO;
+- }
+-
+- /* identify the model based on the resources */
+- if (resource_size(res) == 6)
+- cmt->info = &sh_cmt_info[SH_CMT_16BIT];
+- else if (res2 && (resource_size(res2) == 4))
+- cmt->info = &sh_cmt_info[SH_CMT_48BIT_GEN2];
+- else
+- cmt->info = &sh_cmt_info[SH_CMT_32BIT];
+-
+- return 0;
+-}
+-
+-static void sh_cmt_unmap_memory(struct sh_cmt_device *cmt)
+-{
+- iounmap(cmt->mapbase);
+- if (cmt->mapbase_ch)
+- iounmap(cmt->mapbase_ch);
+-}
+-
+ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+ {
+ struct sh_timer_config *cfg = pdev->dev.platform_data;
+ const struct platform_device_id *id = pdev->id_entry;
+- unsigned int hw_channels;
++ unsigned int mask;
++ unsigned int i;
+ int ret;
+
+ memset(cmt, 0, sizeof(*cmt));
+@@ -1003,10 +941,9 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+ }
+
+ cmt->info = (const struct sh_cmt_info *)id->driver_data;
+- cmt->legacy = cmt->info ? false : true;
+
+ /* Get hold of clock. */
+- cmt->clk = clk_get(&cmt->pdev->dev, cmt->legacy ? "cmt_fck" : "fck");
++ cmt->clk = clk_get(&cmt->pdev->dev, "fck");
+ if (IS_ERR(cmt->clk)) {
+ dev_err(&cmt->pdev->dev, "cannot get clock\n");
+ return PTR_ERR(cmt->clk);
+@@ -1016,27 +953,13 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+ if (ret < 0)
+ goto err_clk_put;
+
+- /*
+- * Map the memory resource(s). We need to support both the legacy
+- * platform device configuration (with one device per channel) and the
+- * new version (with multiple channels per device).
+- */
+- if (cmt->legacy)
+- ret = sh_cmt_map_memory_legacy(cmt);
+- else
+- ret = sh_cmt_map_memory(cmt);
+-
++ /* Map the memory resource(s). */
++ ret = sh_cmt_map_memory(cmt);
+ if (ret < 0)
+ goto err_clk_unprepare;
+
+ /* Allocate and setup the channels. */
+- if (cmt->legacy) {
+- cmt->num_channels = 1;
+- hw_channels = 0;
+- } else {
+- cmt->num_channels = hweight8(cfg->channels_mask);
+- hw_channels = cfg->channels_mask;
+- }
++ cmt->num_channels = hweight8(cfg->channels_mask);
+
+ cmt->channels = kzalloc(cmt->num_channels * sizeof(*cmt->channels),
+ GFP_KERNEL);
+@@ -1045,35 +968,21 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+ goto err_unmap;
+ }
+
+- if (cmt->legacy) {
+- ret = sh_cmt_setup_channel(&cmt->channels[0],
+- cfg->timer_bit, cfg->timer_bit,
+- cfg->clockevent_rating != 0,
+- cfg->clocksource_rating != 0, cmt);
++ /*
++ * Use the first channel as a clock event device and the second channel
++ * as a clock source. If only one channel is available use it for both.
++ */
++ for (i = 0, mask = cfg->channels_mask; i < cmt->num_channels; ++i) {
++ unsigned int hwidx = ffs(mask) - 1;
++ bool clocksource = i == 1 || cmt->num_channels == 1;
++ bool clockevent = i == 0;
++
++ ret = sh_cmt_setup_channel(&cmt->channels[i], i, hwidx,
++ clockevent, clocksource, cmt);
+ if (ret < 0)
+ goto err_unmap;
+- } else {
+- unsigned int mask = hw_channels;
+- unsigned int i;
+
+- /*
+- * Use the first channel as a clock event device and the second
+- * channel as a clock source. If only one channel is available
+- * use it for both.
+- */
+- for (i = 0; i < cmt->num_channels; ++i) {
+- unsigned int hwidx = ffs(mask) - 1;
+- bool clocksource = i == 1 || cmt->num_channels == 1;
+- bool clockevent = i == 0;
+-
+- ret = sh_cmt_setup_channel(&cmt->channels[i], i, hwidx,
+- clockevent, clocksource,
+- cmt);
+- if (ret < 0)
+- goto err_unmap;
+-
+- mask &= ~(1 << hwidx);
+- }
++ mask &= ~(1 << hwidx);
+ }
+
+ platform_set_drvdata(pdev, cmt);
+@@ -1082,7 +991,7 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+
+ err_unmap:
+ kfree(cmt->channels);
+- sh_cmt_unmap_memory(cmt);
++ iounmap(cmt->mapbase);
+ err_clk_unprepare:
+ clk_unprepare(cmt->clk);
+ err_clk_put:
+@@ -1133,7 +1042,6 @@ static int sh_cmt_remove(struct platform_device *pdev)
+ }
+
+ static const struct platform_device_id sh_cmt_id_table[] = {
+- { "sh_cmt", 0 },
+ { "sh-cmt-16", (kernel_ulong_t)&sh_cmt_info[SH_CMT_16BIT] },
+ { "sh-cmt-32", (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT] },
+ { "sh-cmt-32-fast", (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT_FAST] },
+--
+2.1.2
+
diff --git a/patches.renesas/0726-clocksource-sh_cmt-Replace-global-spinlock-with-a-pe.patch b/patches.renesas/0726-clocksource-sh_cmt-Replace-global-spinlock-with-a-pe.patch
new file mode 100644
index 00000000000000..b90ca8a2dff1e6
--- /dev/null
+++ b/patches.renesas/0726-clocksource-sh_cmt-Replace-global-spinlock-with-a-pe.patch
@@ -0,0 +1,67 @@
+From 6de420f767f4c83f84403fd362bec640424429d3 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 17 Feb 2014 16:49:05 +0100
+Subject: clocksource: sh_cmt: Replace global spinlock with a per-device
+ spinlock
+
+The global spinlock is used to protect the shared start/stop register.
+Now that all CMT channels are handled by a single device instance, use a
+per-device spinlock.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit de599c8843ebbdfc29a119c94af481b1de76700e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/clocksource/sh_cmt.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
+index fcd38db9ce5c..190c655d8352 100644
+--- a/drivers/clocksource/sh_cmt.c
++++ b/drivers/clocksource/sh_cmt.c
+@@ -118,6 +118,8 @@ struct sh_cmt_device {
+ void __iomem *mapbase;
+ struct clk *clk;
+
++ raw_spinlock_t lock; /* Protect the shared start/stop register */
++
+ struct sh_cmt_channel *channels;
+ unsigned int num_channels;
+
+@@ -299,14 +301,12 @@ static unsigned long sh_cmt_get_counter(struct sh_cmt_channel *ch,
+ return v2;
+ }
+
+-static DEFINE_RAW_SPINLOCK(sh_cmt_lock);
+-
+ static void sh_cmt_start_stop_ch(struct sh_cmt_channel *ch, int start)
+ {
+ unsigned long flags, value;
+
+ /* start stop register shared by multiple timer channels */
+- raw_spin_lock_irqsave(&sh_cmt_lock, flags);
++ raw_spin_lock_irqsave(&ch->cmt->lock, flags);
+ value = sh_cmt_read_cmstr(ch);
+
+ if (start)
+@@ -315,7 +315,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_channel *ch, int start)
+ value &= ~(1 << ch->timer_bit);
+
+ sh_cmt_write_cmstr(ch, value);
+- raw_spin_unlock_irqrestore(&sh_cmt_lock, flags);
++ raw_spin_unlock_irqrestore(&ch->cmt->lock, flags);
+ }
+
+ static int sh_cmt_enable(struct sh_cmt_channel *ch, unsigned long *rate)
+@@ -934,6 +934,7 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+
+ memset(cmt, 0, sizeof(*cmt));
+ cmt->pdev = pdev;
++ raw_spin_lock_init(&cmt->lock);
+
+ if (!cfg) {
+ dev_err(&cmt->pdev->dev, "missing platform data\n");
+--
+2.1.2
+
diff --git a/patches.renesas/0727-clocksource-shmobile-Remove-unused-sh_timer_config-m.patch b/patches.renesas/0727-clocksource-shmobile-Remove-unused-sh_timer_config-m.patch
new file mode 100644
index 00000000000000..4e56b0ca2e802d
--- /dev/null
+++ b/patches.renesas/0727-clocksource-shmobile-Remove-unused-sh_timer_config-m.patch
@@ -0,0 +1,35 @@
+From ed2a102bc496201d654500ef58c2e509e94ce356 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 4 Mar 2014 18:50:53 +0100
+Subject: clocksource: shmobile: Remove unused sh_timer_config members
+
+The name, channel_offset, timer_bit, clockevent_rating and
+clocksource_rating members are unused. Remove them.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 628627bfd943c077c65489acd8b23c7bb14eb0e2)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ include/linux/sh_timer.h | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/include/linux/sh_timer.h b/include/linux/sh_timer.h
+index 8e1e036d6d45..64638b058076 100644
+--- a/include/linux/sh_timer.h
++++ b/include/linux/sh_timer.h
+@@ -2,11 +2,6 @@
+ #define __SH_TIMER_H__
+
+ struct sh_timer_config {
+- char *name;
+- long channel_offset;
+- int timer_bit;
+- unsigned long clockevent_rating;
+- unsigned long clocksource_rating;
+ unsigned int channels_mask;
+ };
+
+--
+2.1.2
+
diff --git a/patches.renesas/0728-clocksource-sh_cmt-Add-DT-support.patch b/patches.renesas/0728-clocksource-sh_cmt-Add-DT-support.patch
new file mode 100644
index 00000000000000..e17bc81b4ba140
--- /dev/null
+++ b/patches.renesas/0728-clocksource-sh_cmt-Add-DT-support.patch
@@ -0,0 +1,203 @@
+From dcdd09a574c635a9b7a1b32a9f890ece4e150092 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 12 Feb 2014 17:12:40 +0100
+Subject: clocksource: sh_cmt: Add DT support
+
+Document DT bindings and parse them in the CMT driver.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 1768aa2f4c1248051013282c6cf63b368016cb53)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ .../devicetree/bindings/timer/renesas,cmt.txt | 47 +++++++++++++++
+ drivers/clocksource/sh_cmt.c | 66 ++++++++++++++++------
+ 2 files changed, 95 insertions(+), 18 deletions(-)
+ create mode 100644 Documentation/devicetree/bindings/timer/renesas,cmt.txt
+
+diff --git a/Documentation/devicetree/bindings/timer/renesas,cmt.txt b/Documentation/devicetree/bindings/timer/renesas,cmt.txt
+new file mode 100644
+index 000000000000..a17418b0ece3
+--- /dev/null
++++ b/Documentation/devicetree/bindings/timer/renesas,cmt.txt
+@@ -0,0 +1,47 @@
++* Renesas R-Car Compare Match Timer (CMT)
++
++The CMT is a multi-channel 16/32/48-bit timer/counter with configurable clock
++inputs and programmable compare match.
++
++Channels share hardware resources but their counter and compare match value
++are independent. A particular CMT instance can implement only a subset of the
++channels supported by the CMT model. Channel indices represent the hardware
++position of the channel in the CMT and don't match the channel numbers in the
++datasheets.
++
++Required Properties:
++
++ - compatible: must contain one of the following.
++ - "renesas,cmt-32" for the 32-bit CMT
++ (CMT0 on sh7372, sh73a0 and r8a7740)
++ - "renesas,cmt-32-fast" for the 32-bit CMT with fast clock support
++ (CMT[234] on sh7372, sh73a0 and r8a7740)
++ - "renesas,cmt-48" for the 48-bit CMT
++ (CMT1 on sh7372, sh73a0 and r8a7740)
++ - "renesas,cmt-48-gen2" for the second generation 48-bit CMT
++ (CMT[01] on r8a73a4, r8a7790 and r8a7791)
++
++ - reg: base address and length of the registers block for the timer module.
++ - interrupts: interrupt-specifier for the timer, one per channel.
++ - clocks: a list of phandle + clock-specifier pairs, one for each entry
++ in clock-names.
++ - clock-names: must contain "fck" for the functional clock.
++
++ - renesas,channels-mask: bitmask of the available channels.
++
++
++Example: R8A7790 (R-Car H2) CMT0 node
++
++ CMT0 on R8A7790 implements hardware channels 5 and 6 only and names
++ them channels 0 and 1 in the documentation.
++
++ cmt0: timer@ffca0000 {
++ compatible = "renesas,cmt-48-gen2";
++ reg = <0 0xffca0000 0 0x1004>;
++ interrupts = <0 142 IRQ_TYPE_LEVEL_HIGH>,
++ <0 142 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp1_clks R8A7790_CLK_CMT0>;
++ clock-names = "fck";
++
++ renesas,channels-mask = <0x60>;
++ };
+diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
+index 190c655d8352..2bd13b53b727 100644
+--- a/drivers/clocksource/sh_cmt.c
++++ b/drivers/clocksource/sh_cmt.c
+@@ -24,6 +24,7 @@
+ #include <linux/ioport.h>
+ #include <linux/irq.h>
+ #include <linux/module.h>
++#include <linux/of.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_domain.h>
+ #include <linux/pm_runtime.h>
+@@ -122,6 +123,7 @@ struct sh_cmt_device {
+
+ struct sh_cmt_channel *channels;
+ unsigned int num_channels;
++ unsigned int hw_channels;
+
+ bool has_clockevent;
+ bool has_clocksource;
+@@ -924,10 +926,35 @@ static int sh_cmt_map_memory(struct sh_cmt_device *cmt)
+ return 0;
+ }
+
++static const struct platform_device_id sh_cmt_id_table[] = {
++ { "sh-cmt-16", (kernel_ulong_t)&sh_cmt_info[SH_CMT_16BIT] },
++ { "sh-cmt-32", (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT] },
++ { "sh-cmt-32-fast", (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT_FAST] },
++ { "sh-cmt-48", (kernel_ulong_t)&sh_cmt_info[SH_CMT_48BIT] },
++ { "sh-cmt-48-gen2", (kernel_ulong_t)&sh_cmt_info[SH_CMT_48BIT_GEN2] },
++ { }
++};
++MODULE_DEVICE_TABLE(platform, sh_cmt_id_table);
++
++static const struct of_device_id sh_cmt_of_table[] __maybe_unused = {
++ { .compatible = "renesas,cmt-32", .data = &sh_cmt_info[SH_CMT_32BIT] },
++ { .compatible = "renesas,cmt-32-fast", .data = &sh_cmt_info[SH_CMT_32BIT_FAST] },
++ { .compatible = "renesas,cmt-48", .data = &sh_cmt_info[SH_CMT_48BIT] },
++ { .compatible = "renesas,cmt-48-gen2", .data = &sh_cmt_info[SH_CMT_48BIT_GEN2] },
++ { }
++};
++MODULE_DEVICE_TABLE(of, sh_cmt_of_table);
++
++static int sh_cmt_parse_dt(struct sh_cmt_device *cmt)
++{
++ struct device_node *np = cmt->pdev->dev.of_node;
++
++ return of_property_read_u32(np, "renesas,channels-mask",
++ &cmt->hw_channels);
++}
++
+ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+ {
+- struct sh_timer_config *cfg = pdev->dev.platform_data;
+- const struct platform_device_id *id = pdev->id_entry;
+ unsigned int mask;
+ unsigned int i;
+ int ret;
+@@ -936,13 +963,26 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+ cmt->pdev = pdev;
+ raw_spin_lock_init(&cmt->lock);
+
+- if (!cfg) {
++ if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
++ const struct of_device_id *id;
++
++ id = of_match_node(sh_cmt_of_table, pdev->dev.of_node);
++ cmt->info = id->data;
++
++ ret = sh_cmt_parse_dt(cmt);
++ if (ret < 0)
++ return ret;
++ } else if (pdev->dev.platform_data) {
++ struct sh_timer_config *cfg = pdev->dev.platform_data;
++ const struct platform_device_id *id = pdev->id_entry;
++
++ cmt->info = (const struct sh_cmt_info *)id->driver_data;
++ cmt->hw_channels = cfg->channels_mask;
++ } else {
+ dev_err(&cmt->pdev->dev, "missing platform data\n");
+ return -ENXIO;
+ }
+
+- cmt->info = (const struct sh_cmt_info *)id->driver_data;
+-
+ /* Get hold of clock. */
+ cmt->clk = clk_get(&cmt->pdev->dev, "fck");
+ if (IS_ERR(cmt->clk)) {
+@@ -960,8 +1000,7 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+ goto err_clk_unprepare;
+
+ /* Allocate and setup the channels. */
+- cmt->num_channels = hweight8(cfg->channels_mask);
+-
++ cmt->num_channels = hweight8(cmt->hw_channels);
+ cmt->channels = kzalloc(cmt->num_channels * sizeof(*cmt->channels),
+ GFP_KERNEL);
+ if (cmt->channels == NULL) {
+@@ -973,7 +1012,7 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
+ * Use the first channel as a clock event device and the second channel
+ * as a clock source. If only one channel is available use it for both.
+ */
+- for (i = 0, mask = cfg->channels_mask; i < cmt->num_channels; ++i) {
++ for (i = 0, mask = cmt->hw_channels; i < cmt->num_channels; ++i) {
+ unsigned int hwidx = ffs(mask) - 1;
+ bool clocksource = i == 1 || cmt->num_channels == 1;
+ bool clockevent = i == 0;
+@@ -1042,21 +1081,12 @@ static int sh_cmt_remove(struct platform_device *pdev)
+ return -EBUSY; /* cannot unregister clockevent and clocksource */
+ }
+
+-static const struct platform_device_id sh_cmt_id_table[] = {
+- { "sh-cmt-16", (kernel_ulong_t)&sh_cmt_info[SH_CMT_16BIT] },
+- { "sh-cmt-32", (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT] },
+- { "sh-cmt-32-fast", (kernel_ulong_t)&sh_cmt_info[SH_CMT_32BIT_FAST] },
+- { "sh-cmt-48", (kernel_ulong_t)&sh_cmt_info[SH_CMT_48BIT] },
+- { "sh-cmt-48-gen2", (kernel_ulong_t)&sh_cmt_info[SH_CMT_48BIT_GEN2] },
+- { }
+-};
+-MODULE_DEVICE_TABLE(platform, sh_cmt_id_table);
+-
+ static struct platform_driver sh_cmt_device_driver = {
+ .probe = sh_cmt_probe,
+ .remove = sh_cmt_remove,
+ .driver = {
+ .name = "sh_cmt",
++ .of_match_table = of_match_ptr(sh_cmt_of_table),
+ },
+ .id_table = sh_cmt_id_table,
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0729-clocksource-sh_mtu2-Drop-support-for-legacy-platform.patch b/patches.renesas/0729-clocksource-sh_mtu2-Drop-support-for-legacy-platform.patch
new file mode 100644
index 00000000000000..db5d518d2acbba
--- /dev/null
+++ b/patches.renesas/0729-clocksource-sh_mtu2-Drop-support-for-legacy-platform.patch
@@ -0,0 +1,261 @@
+From 409422d1d0e593caa5f0cdf7612115503f0d9802 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 4 Mar 2014 18:13:57 +0100
+Subject: clocksource: sh_mtu2: Drop support for legacy platform data
+
+Now that all platforms have switched to the new-style platform data,
+drop support for the legacy version.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Wolfram Sang <wsa@sang-engineering.com>
+(cherry picked from commit 1a5da0e43be0c07462e445549dbdd4a1731a3e11)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/clocksource/sh_mtu2.c | 130 ++++++++++--------------------------------
+ 1 file changed, 31 insertions(+), 99 deletions(-)
+
+diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
+index 188d4e092efc..0342e4a01c9e 100644
+--- a/drivers/clocksource/sh_mtu2.c
++++ b/drivers/clocksource/sh_mtu2.c
+@@ -37,7 +37,6 @@ struct sh_mtu2_channel {
+ unsigned int index;
+
+ void __iomem *base;
+- int irq;
+
+ struct clock_event_device ced;
+ };
+@@ -51,7 +50,6 @@ struct sh_mtu2_device {
+ struct sh_mtu2_channel *channels;
+ unsigned int num_channels;
+
+- bool legacy;
+ bool has_clockevent;
+ };
+
+@@ -162,12 +160,8 @@ static inline unsigned long sh_mtu2_read(struct sh_mtu2_channel *ch, int reg_nr)
+ {
+ unsigned long offs;
+
+- if (reg_nr == TSTR) {
+- if (ch->mtu->legacy)
+- return ioread8(ch->mtu->mapbase);
+- else
+- return ioread8(ch->mtu->mapbase + 0x280);
+- }
++ if (reg_nr == TSTR)
++ return ioread8(ch->mtu->mapbase + 0x280);
+
+ offs = mtu2_reg_offs[reg_nr];
+
+@@ -182,12 +176,8 @@ static inline void sh_mtu2_write(struct sh_mtu2_channel *ch, int reg_nr,
+ {
+ unsigned long offs;
+
+- if (reg_nr == TSTR) {
+- if (ch->mtu->legacy)
+- return iowrite8(value, ch->mtu->mapbase);
+- else
+- return iowrite8(value, ch->mtu->mapbase + 0x280);
+- }
++ if (reg_nr == TSTR)
++ return iowrite8(value, ch->mtu->mapbase + 0x280);
+
+ offs = mtu2_reg_offs[reg_nr];
+
+@@ -331,7 +321,6 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_channel *ch,
+ const char *name)
+ {
+ struct clock_event_device *ced = &ch->ced;
+- int ret;
+
+ ced->name = name;
+ ced->features = CLOCK_EVT_FEAT_PERIODIC;
+@@ -344,24 +333,12 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_channel *ch,
+ dev_info(&ch->mtu->pdev->dev, "ch%u: used for clock events\n",
+ ch->index);
+ clockevents_register_device(ced);
+-
+- ret = request_irq(ch->irq, sh_mtu2_interrupt,
+- IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING,
+- dev_name(&ch->mtu->pdev->dev), ch);
+- if (ret) {
+- dev_err(&ch->mtu->pdev->dev, "ch%u: failed to request irq %d\n",
+- ch->index, ch->irq);
+- return;
+- }
+ }
+
+-static int sh_mtu2_register(struct sh_mtu2_channel *ch, const char *name,
+- bool clockevent)
++static int sh_mtu2_register(struct sh_mtu2_channel *ch, const char *name)
+ {
+- if (clockevent) {
+- ch->mtu->has_clockevent = true;
+- sh_mtu2_register_clockevent(ch, name);
+- }
++ ch->mtu->has_clockevent = true;
++ sh_mtu2_register_clockevent(ch, name);
+
+ return 0;
+ }
+@@ -372,40 +349,32 @@ static int sh_mtu2_setup_channel(struct sh_mtu2_channel *ch, unsigned int index,
+ static const unsigned int channel_offsets[] = {
+ 0x300, 0x380, 0x000,
+ };
+- bool clockevent;
++ char name[6];
++ int irq;
++ int ret;
+
+ ch->mtu = mtu;
+
+- if (mtu->legacy) {
+- struct sh_timer_config *cfg = mtu->pdev->dev.platform_data;
+-
+- clockevent = cfg->clockevent_rating != 0;
+-
+- ch->irq = platform_get_irq(mtu->pdev, 0);
+- ch->base = mtu->mapbase - cfg->channel_offset;
+- ch->index = cfg->timer_bit;
+- } else {
+- char name[6];
+-
+- clockevent = true;
+-
+- sprintf(name, "tgi%ua", index);
+- ch->irq = platform_get_irq_byname(mtu->pdev, name);
+- ch->base = mtu->mapbase + channel_offsets[index];
+- ch->index = index;
+- }
+-
+- if (ch->irq < 0) {
++ sprintf(name, "tgi%ua", index);
++ irq = platform_get_irq_byname(mtu->pdev, name);
++ if (irq < 0) {
+ /* Skip channels with no declared interrupt. */
+- if (!mtu->legacy)
+- return 0;
++ return 0;
++ }
+
+- dev_err(&mtu->pdev->dev, "ch%u: failed to get irq\n",
+- ch->index);
+- return ch->irq;
++ ret = request_irq(irq, sh_mtu2_interrupt,
++ IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING,
++ dev_name(&ch->mtu->pdev->dev), ch);
++ if (ret) {
++ dev_err(&ch->mtu->pdev->dev, "ch%u: failed to request irq %d\n",
++ index, irq);
++ return ret;
+ }
+
+- return sh_mtu2_register(ch, dev_name(&mtu->pdev->dev), clockevent);
++ ch->base = mtu->mapbase + channel_offsets[index];
++ ch->index = index;
++
++ return sh_mtu2_register(ch, dev_name(&mtu->pdev->dev));
+ }
+
+ static int sh_mtu2_map_memory(struct sh_mtu2_device *mtu)
+@@ -422,46 +391,19 @@ static int sh_mtu2_map_memory(struct sh_mtu2_device *mtu)
+ if (mtu->mapbase == NULL)
+ return -ENXIO;
+
+- /*
+- * In legacy platform device configuration (with one device per channel)
+- * the resource points to the channel base address.
+- */
+- if (mtu->legacy) {
+- struct sh_timer_config *cfg = mtu->pdev->dev.platform_data;
+- mtu->mapbase += cfg->channel_offset;
+- }
+-
+ return 0;
+ }
+
+-static void sh_mtu2_unmap_memory(struct sh_mtu2_device *mtu)
+-{
+- if (mtu->legacy) {
+- struct sh_timer_config *cfg = mtu->pdev->dev.platform_data;
+- mtu->mapbase -= cfg->channel_offset;
+- }
+-
+- iounmap(mtu->mapbase);
+-}
+-
+ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
+ struct platform_device *pdev)
+ {
+- struct sh_timer_config *cfg = pdev->dev.platform_data;
+- const struct platform_device_id *id = pdev->id_entry;
+ unsigned int i;
+ int ret;
+
+ mtu->pdev = pdev;
+- mtu->legacy = id->driver_data;
+-
+- if (mtu->legacy && !cfg) {
+- dev_err(&mtu->pdev->dev, "missing platform data\n");
+- return -ENXIO;
+- }
+
+ /* Get hold of clock. */
+- mtu->clk = clk_get(&mtu->pdev->dev, mtu->legacy ? "mtu2_fck" : "fck");
++ mtu->clk = clk_get(&mtu->pdev->dev, "fck");
+ if (IS_ERR(mtu->clk)) {
+ dev_err(&mtu->pdev->dev, "cannot get clock\n");
+ return PTR_ERR(mtu->clk);
+@@ -479,10 +421,7 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
+ }
+
+ /* Allocate and setup the channels. */
+- if (mtu->legacy)
+- mtu->num_channels = 1;
+- else
+- mtu->num_channels = 3;
++ mtu->num_channels = 3;
+
+ mtu->channels = kzalloc(sizeof(*mtu->channels) * mtu->num_channels,
+ GFP_KERNEL);
+@@ -491,16 +430,10 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
+ goto err_unmap;
+ }
+
+- if (mtu->legacy) {
+- ret = sh_mtu2_setup_channel(&mtu->channels[0], 0, mtu);
++ for (i = 0; i < mtu->num_channels; ++i) {
++ ret = sh_mtu2_setup_channel(&mtu->channels[i], i, mtu);
+ if (ret < 0)
+ goto err_unmap;
+- } else {
+- for (i = 0; i < mtu->num_channels; ++i) {
+- ret = sh_mtu2_setup_channel(&mtu->channels[i], i, mtu);
+- if (ret < 0)
+- goto err_unmap;
+- }
+ }
+
+ platform_set_drvdata(pdev, mtu);
+@@ -509,7 +442,7 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
+
+ err_unmap:
+ kfree(mtu->channels);
+- sh_mtu2_unmap_memory(mtu);
++ iounmap(mtu->mapbase);
+ err_clk_unprepare:
+ clk_unprepare(mtu->clk);
+ err_clk_put:
+@@ -560,7 +493,6 @@ static int sh_mtu2_remove(struct platform_device *pdev)
+ }
+
+ static const struct platform_device_id sh_mtu2_id_table[] = {
+- { "sh_mtu2", 1 },
+ { "sh-mtu2", 0 },
+ { },
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0730-clocksource-sh_mtu2-Replace-global-spinlock-with-a-p.patch b/patches.renesas/0730-clocksource-sh_mtu2-Replace-global-spinlock-with-a-p.patch
new file mode 100644
index 00000000000000..91703d474b6f0b
--- /dev/null
+++ b/patches.renesas/0730-clocksource-sh_mtu2-Replace-global-spinlock-with-a-p.patch
@@ -0,0 +1,69 @@
+From c91591665631db71e5e2de581bdc7107452bff90 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 4 Mar 2014 15:25:56 +0100
+Subject: clocksource: sh_mtu2: Replace global spinlock with a per-device
+ spinlock
+
+The global spinlock is used to protect the shared start/stop register.
+Now that all MTU2 channels are handled by a single device instance, use
+a per-device spinlock.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Wolfram Sang <wsa@sang-engineering.com>
+(cherry picked from commit 8b2463d8cae2dda0c98ab5a15f25a0350a0e998d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/clocksource/sh_mtu2.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
+index 0342e4a01c9e..b0c229f4b4c6 100644
+--- a/drivers/clocksource/sh_mtu2.c
++++ b/drivers/clocksource/sh_mtu2.c
+@@ -47,14 +47,14 @@ struct sh_mtu2_device {
+ void __iomem *mapbase;
+ struct clk *clk;
+
++ raw_spinlock_t lock; /* Protect the shared registers */
++
+ struct sh_mtu2_channel *channels;
+ unsigned int num_channels;
+
+ bool has_clockevent;
+ };
+
+-static DEFINE_RAW_SPINLOCK(sh_mtu2_lock);
+-
+ #define TSTR -1 /* shared register */
+ #define TCR 0 /* channel register */
+ #define TMDR 1 /* channel register */
+@@ -192,7 +192,7 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_channel *ch, int start)
+ unsigned long flags, value;
+
+ /* start stop register shared by multiple timer channels */
+- raw_spin_lock_irqsave(&sh_mtu2_lock, flags);
++ raw_spin_lock_irqsave(&ch->mtu->lock, flags);
+ value = sh_mtu2_read(ch, TSTR);
+
+ if (start)
+@@ -201,7 +201,7 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_channel *ch, int start)
+ value &= ~(1 << ch->index);
+
+ sh_mtu2_write(ch, TSTR, value);
+- raw_spin_unlock_irqrestore(&sh_mtu2_lock, flags);
++ raw_spin_unlock_irqrestore(&ch->mtu->lock, flags);
+ }
+
+ static int sh_mtu2_enable(struct sh_mtu2_channel *ch)
+@@ -402,6 +402,8 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
+
+ mtu->pdev = pdev;
+
++ raw_spin_lock_init(&mtu->lock);
++
+ /* Get hold of clock. */
+ mtu->clk = clk_get(&mtu->pdev->dev, "fck");
+ if (IS_ERR(mtu->clk)) {
+--
+2.1.2
+
diff --git a/patches.renesas/0731-clocksource-sh_mtu2-Add-DT-support.patch b/patches.renesas/0731-clocksource-sh_mtu2-Add-DT-support.patch
new file mode 100644
index 00000000000000..e163550fa32f35
--- /dev/null
+++ b/patches.renesas/0731-clocksource-sh_mtu2-Add-DT-support.patch
@@ -0,0 +1,96 @@
+From 689c57a876eb1a749393d50fb733b2a5ef35623b Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 4 Mar 2014 18:28:26 +0100
+Subject: clocksource: sh_mtu2: Add DT support
+
+Document DT bindings and parse them in the MTU2 driver.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Wolfram Sang <wsa@sang-engineering.com>
+(cherry picked from commit cca8d0596c4c7acb371ea1bc5eee9b404b30516a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ .../devicetree/bindings/timer/renesas,mtu2.txt | 39 ++++++++++++++++++++++
+ drivers/clocksource/sh_mtu2.c | 8 +++++
+ 2 files changed, 47 insertions(+)
+ create mode 100644 Documentation/devicetree/bindings/timer/renesas,mtu2.txt
+
+diff --git a/Documentation/devicetree/bindings/timer/renesas,mtu2.txt b/Documentation/devicetree/bindings/timer/renesas,mtu2.txt
+new file mode 100644
+index 000000000000..917453f826bc
+--- /dev/null
++++ b/Documentation/devicetree/bindings/timer/renesas,mtu2.txt
+@@ -0,0 +1,39 @@
++* Renesas R-Car Multi-Function Timer Pulse Unit 2 (MTU2)
++
++The MTU2 is a multi-purpose, multi-channel timer/counter with configurable
++clock inputs and programmable compare match.
++
++Channels share hardware resources but their counter and compare match value
++are independent. The MTU2 hardware supports five channels indexed from 0 to 4.
++
++Required Properties:
++
++ - compatible: must contain "renesas,mtu2"
++
++ - reg: base address and length of the registers block for the timer module.
++
++ - interrupts: interrupt specifiers for the timer, one for each entry in
++ interrupt-names.
++ - interrupt-names: must contain one entry named "tgi?a" for each enabled
++ channel, where "?" is the channel index expressed as one digit from "0" to
++ "4".
++
++ - clocks: a list of phandle + clock-specifier pairs, one for each entry
++ in clock-names.
++ - clock-names: must contain "fck" for the functional clock.
++
++
++Example: R7S72100 (RZ/A1H) MTU2 node
++
++ mtu2: timer@fcff0000 {
++ compatible = "renesas,mtu2";
++ reg = <0xfcff0000 0x400>;
++ interrupts = <0 139 IRQ_TYPE_LEVEL_HIGH>,
++ <0 146 IRQ_TYPE_LEVEL_HIGH>,
++ <0 150 IRQ_TYPE_LEVEL_HIGH>,
++ <0 154 IRQ_TYPE_LEVEL_HIGH>,
++ <0 159 IRQ_TYPE_LEVEL_HIGH>;
++ interrupt-names = "tgi0a", "tgi1a", "tgi2a", "tgi3a", "tgi4a";
++ clocks = <&mstp3_clks R7S72100_CLK_MTU2>;
++ clock-names = "fck";
++ };
+diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
+index b0c229f4b4c6..3d88698cf2b8 100644
+--- a/drivers/clocksource/sh_mtu2.c
++++ b/drivers/clocksource/sh_mtu2.c
+@@ -23,6 +23,7 @@
+ #include <linux/ioport.h>
+ #include <linux/irq.h>
+ #include <linux/module.h>
++#include <linux/of.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_domain.h>
+ #include <linux/pm_runtime.h>
+@@ -500,11 +501,18 @@ static const struct platform_device_id sh_mtu2_id_table[] = {
+ };
+ MODULE_DEVICE_TABLE(platform, sh_mtu2_id_table);
+
++static const struct of_device_id sh_mtu2_of_table[] __maybe_unused = {
++ { .compatible = "renesas,mtu2" },
++ { }
++};
++MODULE_DEVICE_TABLE(of, sh_mtu2_of_table);
++
+ static struct platform_driver sh_mtu2_device_driver = {
+ .probe = sh_mtu2_probe,
+ .remove = sh_mtu2_remove,
+ .driver = {
+ .name = "sh_mtu2",
++ .of_match_table = of_match_ptr(sh_mtu2_of_table),
+ },
+ .id_table = sh_mtu2_id_table,
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0732-clocksource-sh_tmu-Drop-support-for-legacy-platform-.patch b/patches.renesas/0732-clocksource-sh_tmu-Drop-support-for-legacy-platform-.patch
new file mode 100644
index 00000000000000..a7d15bbd915276
--- /dev/null
+++ b/patches.renesas/0732-clocksource-sh_tmu-Drop-support-for-legacy-platform-.patch
@@ -0,0 +1,181 @@
+From 7821081eda16c4f62a34338583c7c8eee8264173 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 28 Jan 2014 15:52:46 +0100
+Subject: clocksource: sh_tmu: Drop support for legacy platform data
+
+Now that all platforms have switched to the new-style platform data,
+drop support for the legacy version.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 681b9e852cf2d48ebd63954028814c7cece71945)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/clocksource/sh_tmu.c | 82 ++++++++------------------------------------
+ 1 file changed, 15 insertions(+), 67 deletions(-)
+
+diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
+index 6bd17a8f3dd4..3eee5c8c26aa 100644
+--- a/drivers/clocksource/sh_tmu.c
++++ b/drivers/clocksource/sh_tmu.c
+@@ -32,7 +32,6 @@
+ #include <linux/spinlock.h>
+
+ enum sh_tmu_model {
+- SH_TMU_LEGACY,
+ SH_TMU,
+ SH_TMU_SH3,
+ };
+@@ -91,8 +90,6 @@ static inline unsigned long sh_tmu_read(struct sh_tmu_channel *ch, int reg_nr)
+
+ if (reg_nr == TSTR) {
+ switch (ch->tmu->model) {
+- case SH_TMU_LEGACY:
+- return ioread8(ch->tmu->mapbase);
+ case SH_TMU_SH3:
+ return ioread8(ch->tmu->mapbase + 2);
+ case SH_TMU:
+@@ -115,8 +112,6 @@ static inline void sh_tmu_write(struct sh_tmu_channel *ch, int reg_nr,
+
+ if (reg_nr == TSTR) {
+ switch (ch->tmu->model) {
+- case SH_TMU_LEGACY:
+- return iowrite8(value, ch->tmu->mapbase);
+ case SH_TMU_SH3:
+ return iowrite8(value, ch->tmu->mapbase + 2);
+ case SH_TMU:
+@@ -476,27 +471,12 @@ static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index,
+ return 0;
+
+ ch->tmu = tmu;
++ ch->index = index;
+
+- if (tmu->model == SH_TMU_LEGACY) {
+- struct sh_timer_config *cfg = tmu->pdev->dev.platform_data;
+-
+- /*
+- * The SH3 variant (SH770x, SH7705, SH7710 and SH7720) maps
+- * channel registers blocks at base + 2 + 12 * index, while all
+- * other variants map them at base + 4 + 12 * index. We can
+- * compute the index by just dividing by 12, the 2 bytes or 4
+- * bytes offset being hidden by the integer division.
+- */
+- ch->index = cfg->channel_offset / 12;
+- ch->base = tmu->mapbase + cfg->channel_offset;
+- } else {
+- ch->index = index;
+-
+- if (tmu->model == SH_TMU_SH3)
+- ch->base = tmu->mapbase + 4 + ch->index * 12;
+- else
+- ch->base = tmu->mapbase + 8 + ch->index * 12;
+- }
++ if (tmu->model == SH_TMU_SH3)
++ ch->base = tmu->mapbase + 4 + ch->index * 12;
++ else
++ ch->base = tmu->mapbase + 8 + ch->index * 12;
+
+ ch->irq = platform_get_irq(tmu->pdev, index);
+ if (ch->irq < 0) {
+@@ -526,28 +506,9 @@ static int sh_tmu_map_memory(struct sh_tmu_device *tmu)
+ if (tmu->mapbase == NULL)
+ return -ENXIO;
+
+- /*
+- * In legacy platform device configuration (with one device per channel)
+- * the resource points to the channel base address.
+- */
+- if (tmu->model == SH_TMU_LEGACY) {
+- struct sh_timer_config *cfg = tmu->pdev->dev.platform_data;
+- tmu->mapbase -= cfg->channel_offset;
+- }
+-
+ return 0;
+ }
+
+-static void sh_tmu_unmap_memory(struct sh_tmu_device *tmu)
+-{
+- if (tmu->model == SH_TMU_LEGACY) {
+- struct sh_timer_config *cfg = tmu->pdev->dev.platform_data;
+- tmu->mapbase += cfg->channel_offset;
+- }
+-
+- iounmap(tmu->mapbase);
+-}
+-
+ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+ {
+ struct sh_timer_config *cfg = pdev->dev.platform_data;
+@@ -564,8 +525,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+ tmu->model = id->driver_data;
+
+ /* Get hold of clock. */
+- tmu->clk = clk_get(&tmu->pdev->dev,
+- tmu->model == SH_TMU_LEGACY ? "tmu_fck" : "fck");
++ tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+ if (IS_ERR(tmu->clk)) {
+ dev_err(&tmu->pdev->dev, "cannot get clock\n");
+ return PTR_ERR(tmu->clk);
+@@ -583,10 +543,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+ }
+
+ /* Allocate and setup the channels. */
+- if (tmu->model == SH_TMU_LEGACY)
+- tmu->num_channels = 1;
+- else
+- tmu->num_channels = hweight8(cfg->channels_mask);
++ tmu->num_channels = hweight8(cfg->channels_mask);
+
+ tmu->channels = kzalloc(sizeof(*tmu->channels) * tmu->num_channels,
+ GFP_KERNEL);
+@@ -595,23 +552,15 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+ goto err_unmap;
+ }
+
+- if (tmu->model == SH_TMU_LEGACY) {
+- ret = sh_tmu_channel_setup(&tmu->channels[0], 0,
+- cfg->clockevent_rating != 0,
+- cfg->clocksource_rating != 0, tmu);
++ /*
++ * Use the first channel as a clock event device and the second channel
++ * as a clock source.
++ */
++ for (i = 0; i < tmu->num_channels; ++i) {
++ ret = sh_tmu_channel_setup(&tmu->channels[i], i,
++ i == 0, i == 1, tmu);
+ if (ret < 0)
+ goto err_unmap;
+- } else {
+- /*
+- * Use the first channel as a clock event device and the second
+- * channel as a clock source.
+- */
+- for (i = 0; i < tmu->num_channels; ++i) {
+- ret = sh_tmu_channel_setup(&tmu->channels[i], i,
+- i == 0, i == 1, tmu);
+- if (ret < 0)
+- goto err_unmap;
+- }
+ }
+
+ platform_set_drvdata(pdev, tmu);
+@@ -620,7 +569,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+
+ err_unmap:
+ kfree(tmu->channels);
+- sh_tmu_unmap_memory(tmu);
++ iounmap(tmu->mapbase);
+ err_clk_unprepare:
+ clk_unprepare(tmu->clk);
+ err_clk_put:
+@@ -671,7 +620,6 @@ static int sh_tmu_remove(struct platform_device *pdev)
+ }
+
+ static const struct platform_device_id sh_tmu_id_table[] = {
+- { "sh_tmu", SH_TMU_LEGACY },
+ { "sh-tmu", SH_TMU },
+ { "sh-tmu-sh3", SH_TMU_SH3 },
+ { }
+--
+2.1.2
+
diff --git a/patches.renesas/0733-clocksource-sh_tmu-Replace-global-spinlock-with-a-pe.patch b/patches.renesas/0733-clocksource-sh_tmu-Replace-global-spinlock-with-a-pe.patch
new file mode 100644
index 00000000000000..168b1af825470d
--- /dev/null
+++ b/patches.renesas/0733-clocksource-sh_tmu-Replace-global-spinlock-with-a-pe.patch
@@ -0,0 +1,70 @@
+From 869e7a834998dbbb94c5b78e3306f2df926a7b15 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 17 Feb 2014 16:49:05 +0100
+Subject: clocksource: sh_tmu: Replace global spinlock with a per-device
+ spinlock
+
+The global spinlock is used to protect the shared start/stop register.
+Now that all TMU channels are handled by a single device instance, use a
+per-device spinlock.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 2b027f1f0f887097b4140a71b5c1e878da1e2fd9)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/clocksource/sh_tmu.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
+index 3eee5c8c26aa..560a31acbc9c 100644
+--- a/drivers/clocksource/sh_tmu.c
++++ b/drivers/clocksource/sh_tmu.c
+@@ -61,6 +61,8 @@ struct sh_tmu_device {
+
+ enum sh_tmu_model model;
+
++ raw_spinlock_t lock; /* Protect the shared start/stop register */
++
+ struct sh_tmu_channel *channels;
+ unsigned int num_channels;
+
+@@ -68,8 +70,6 @@ struct sh_tmu_device {
+ bool has_clocksource;
+ };
+
+-static DEFINE_RAW_SPINLOCK(sh_tmu_lock);
+-
+ #define TSTR -1 /* shared register */
+ #define TCOR 0 /* channel register */
+ #define TCNT 1 /* channel register */
+@@ -132,7 +132,7 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_channel *ch, int start)
+ unsigned long flags, value;
+
+ /* start stop register shared by multiple timer channels */
+- raw_spin_lock_irqsave(&sh_tmu_lock, flags);
++ raw_spin_lock_irqsave(&ch->tmu->lock, flags);
+ value = sh_tmu_read(ch, TSTR);
+
+ if (start)
+@@ -141,7 +141,7 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_channel *ch, int start)
+ value &= ~(1 << ch->index);
+
+ sh_tmu_write(ch, TSTR, value);
+- raw_spin_unlock_irqrestore(&sh_tmu_lock, flags);
++ raw_spin_unlock_irqrestore(&ch->tmu->lock, flags);
+ }
+
+ static int __sh_tmu_enable(struct sh_tmu_channel *ch)
+@@ -524,6 +524,8 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+ tmu->pdev = pdev;
+ tmu->model = id->driver_data;
+
++ raw_spin_lock_init(&tmu->lock);
++
+ /* Get hold of clock. */
+ tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+ if (IS_ERR(tmu->clk)) {
+--
+2.1.2
+
diff --git a/patches.renesas/0734-clocksource-sh_tmu-Add-DT-support.patch b/patches.renesas/0734-clocksource-sh_tmu-Add-DT-support.patch
new file mode 100644
index 00000000000000..fbc2cb5abd5fa7
--- /dev/null
+++ b/patches.renesas/0734-clocksource-sh_tmu-Add-DT-support.patch
@@ -0,0 +1,162 @@
+From d164b1c0ee06c776cba03c98028f18b1e525806e Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Fri, 11 Apr 2014 16:23:40 +0200
+Subject: clocksource: sh_tmu: Add DT support
+
+Document DT bindings and parse them in the TMU driver.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Tested-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 3e29b5543f9250bb358169cff0594f58284ece74)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ .../devicetree/bindings/timer/renesas,tmu.txt | 39 +++++++++++++++++
+ drivers/clocksource/sh_tmu.c | 51 +++++++++++++++++-----
+ 2 files changed, 80 insertions(+), 10 deletions(-)
+ create mode 100644 Documentation/devicetree/bindings/timer/renesas,tmu.txt
+
+diff --git a/Documentation/devicetree/bindings/timer/renesas,tmu.txt b/Documentation/devicetree/bindings/timer/renesas,tmu.txt
+new file mode 100644
+index 000000000000..425d0c5f4aee
+--- /dev/null
++++ b/Documentation/devicetree/bindings/timer/renesas,tmu.txt
+@@ -0,0 +1,39 @@
++* Renesas R-Car Timer Unit (TMU)
++
++The TMU is a 32-bit timer/counter with configurable clock inputs and
++programmable compare match.
++
++Channels share hardware resources but their counter and compare match value
++are independent. The TMU hardware supports up to three channels.
++
++Required Properties:
++
++ - compatible: must contain "renesas,tmu"
++
++ - reg: base address and length of the registers block for the timer module.
++
++ - interrupts: interrupt-specifier for the timer, one per channel.
++
++ - clocks: a list of phandle + clock-specifier pairs, one for each entry
++ in clock-names.
++ - clock-names: must contain "fck" for the functional clock.
++
++Optional Properties:
++
++ - #renesas,channels: number of channels implemented by the timer, must be 2
++ or 3 (if not specified the value defaults to 3).
++
++
++Example: R8A7779 (R-Car H1) TMU0 node
++
++ tmu0: timer@ffd80000 {
++ compatible = "renesas,tmu";
++ reg = <0xffd80000 0x30>;
++ interrupts = <0 32 IRQ_TYPE_LEVEL_HIGH>,
++ <0 33 IRQ_TYPE_LEVEL_HIGH>,
++ <0 34 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp0_clks R8A7779_CLK_TMU0>;
++ clock-names = "fck";
++
++ #renesas,channels = <3>;
++ };
+diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
+index 560a31acbc9c..0f665b8f2461 100644
+--- a/drivers/clocksource/sh_tmu.c
++++ b/drivers/clocksource/sh_tmu.c
+@@ -24,6 +24,7 @@
+ #include <linux/ioport.h>
+ #include <linux/irq.h>
+ #include <linux/module.h>
++#include <linux/of.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_domain.h>
+ #include <linux/pm_runtime.h>
+@@ -509,23 +510,48 @@ static int sh_tmu_map_memory(struct sh_tmu_device *tmu)
+ return 0;
+ }
+
++static int sh_tmu_parse_dt(struct sh_tmu_device *tmu)
++{
++ struct device_node *np = tmu->pdev->dev.of_node;
++
++ tmu->model = SH_TMU;
++ tmu->num_channels = 3;
++
++ of_property_read_u32(np, "#renesas,channels", &tmu->num_channels);
++
++ if (tmu->num_channels != 2 && tmu->num_channels != 3) {
++ dev_err(&tmu->pdev->dev, "invalid number of channels %u\n",
++ tmu->num_channels);
++ return -EINVAL;
++ }
++
++ return 0;
++}
++
+ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+ {
+- struct sh_timer_config *cfg = pdev->dev.platform_data;
+- const struct platform_device_id *id = pdev->id_entry;
+ unsigned int i;
+ int ret;
+
+- if (!cfg) {
+- dev_err(&tmu->pdev->dev, "missing platform data\n");
+- return -ENXIO;
+- }
+-
+ tmu->pdev = pdev;
+- tmu->model = id->driver_data;
+
+ raw_spin_lock_init(&tmu->lock);
+
++ if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
++ ret = sh_tmu_parse_dt(tmu);
++ if (ret < 0)
++ return ret;
++ } else if (pdev->dev.platform_data) {
++ const struct platform_device_id *id = pdev->id_entry;
++ struct sh_timer_config *cfg = pdev->dev.platform_data;
++
++ tmu->model = id->driver_data;
++ tmu->num_channels = hweight8(cfg->channels_mask);
++ } else {
++ dev_err(&tmu->pdev->dev, "missing platform data\n");
++ return -ENXIO;
++ }
++
+ /* Get hold of clock. */
+ tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+ if (IS_ERR(tmu->clk)) {
+@@ -545,8 +571,6 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+ }
+
+ /* Allocate and setup the channels. */
+- tmu->num_channels = hweight8(cfg->channels_mask);
+-
+ tmu->channels = kzalloc(sizeof(*tmu->channels) * tmu->num_channels,
+ GFP_KERNEL);
+ if (tmu->channels == NULL) {
+@@ -628,11 +652,18 @@ static const struct platform_device_id sh_tmu_id_table[] = {
+ };
+ MODULE_DEVICE_TABLE(platform, sh_tmu_id_table);
+
++static const struct of_device_id sh_tmu_of_table[] __maybe_unused = {
++ { .compatible = "renesas,tmu" },
++ { }
++};
++MODULE_DEVICE_TABLE(of, sh_tmu_of_table);
++
+ static struct platform_driver sh_tmu_device_driver = {
+ .probe = sh_tmu_probe,
+ .remove = sh_tmu_remove,
+ .driver = {
+ .name = "sh_tmu",
++ .of_match_table = of_match_ptr(sh_tmu_of_table),
+ },
+ .id_table = sh_tmu_id_table,
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0735-gpio-rcar-clamp-returned-value-to-0-1.patch b/patches.renesas/0735-gpio-rcar-clamp-returned-value-to-0-1.patch
new file mode 100644
index 00000000000000..2e8c0bb5bb45d9
--- /dev/null
+++ b/patches.renesas/0735-gpio-rcar-clamp-returned-value-to-0-1.patch
@@ -0,0 +1,38 @@
+From 2a4a115a97661af08f99a97b12a9f8476e011ee4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=BCrg=20Billeter?= <j@bitron.ch>
+Date: Tue, 24 Jun 2014 04:19:50 +0200
+Subject: gpio: rcar: clamp returned value to [0,1]
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+While it will be clamped to bool by gpiolib, let's make this sane
+in the driver as well.
+
+Signed-off-by: Jürg Billeter <j@bitron.ch>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+(cherry picked from commit 7cb5409b10d9f8316ca2539591acb6a5f7fd4139)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/gpio/gpio-rcar.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
+index b6ae89ea8811..0d251dc7643d 100644
+--- a/drivers/gpio/gpio-rcar.c
++++ b/drivers/gpio/gpio-rcar.c
+@@ -240,9 +240,9 @@ static int gpio_rcar_get(struct gpio_chip *chip, unsigned offset)
+ /* testing on r8a7790 shows that INDT does not show correct pin state
+ * when configured as output, so use OUTDT in case of output pins */
+ if (gpio_rcar_read(gpio_to_priv(chip), INOUTSEL) & bit)
+- return (int)(gpio_rcar_read(gpio_to_priv(chip), OUTDT) & bit);
++ return !!(gpio_rcar_read(gpio_to_priv(chip), OUTDT) & bit);
+ else
+- return (int)(gpio_rcar_read(gpio_to_priv(chip), INDT) & bit);
++ return !!(gpio_rcar_read(gpio_to_priv(chip), INDT) & bit);
+ }
+
+ static void gpio_rcar_set(struct gpio_chip *chip, unsigned offset, int value)
+--
+2.1.2
+
diff --git a/patches.renesas/0736-usb-renesas_usbhs-fix-usbhs_pipe_malloc-to-re-enable.patch b/patches.renesas/0736-usb-renesas_usbhs-fix-usbhs_pipe_malloc-to-re-enable.patch
new file mode 100644
index 00000000000000..9d8cd3e75e2bb2
--- /dev/null
+++ b/patches.renesas/0736-usb-renesas_usbhs-fix-usbhs_pipe_malloc-to-re-enable.patch
@@ -0,0 +1,32 @@
+From 08495f7b321a4caf92820b7ef3f9f785cce97bc3 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 9 Jul 2014 20:30:03 +0900
+Subject: usb: renesas_usbhs: fix usbhs_pipe_malloc() to re-enable a pipe.
+
+This patch fixes an issue that the driver cannot push a new data when
+a pipe is re-enabled after the pipe is queued.
+
+Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+(cherry picked from commit 6a0541599f54b556442d6130e4f9faaad91bf3a2)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/renesas_usbhs/pipe.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
+index 7926e1c700f1..239b889ca5b5 100644
+--- a/drivers/usb/renesas_usbhs/pipe.c
++++ b/drivers/usb/renesas_usbhs/pipe.c
+@@ -710,6 +710,7 @@ struct usbhs_pipe *usbhs_pipe_malloc(struct usbhs_priv *priv,
+ usbhsp_pipe_select(pipe);
+ usbhsp_pipe_cfg_set(pipe, 0xFFFF, pipecfg);
+ usbhsp_pipe_buf_set(pipe, 0xFFFF, pipebuf);
++ usbhs_pipe_clear(pipe);
+
+ usbhs_pipe_sequence_data0(pipe);
+
+--
+2.1.2
+
diff --git a/patches.renesas/0737-usb-renesas_usbhs-gadget-fix-re-enabling-pipe-withou.patch b/patches.renesas/0737-usb-renesas_usbhs-gadget-fix-re-enabling-pipe-withou.patch
new file mode 100644
index 00000000000000..53bae7c6f5533b
--- /dev/null
+++ b/patches.renesas/0737-usb-renesas_usbhs-gadget-fix-re-enabling-pipe-withou.patch
@@ -0,0 +1,89 @@
+From bddfc00d111a346e29ef152840d3116d37929bad Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 9 Jul 2014 20:30:13 +0900
+Subject: usb: renesas_usbhs: gadget: fix re-enabling pipe without
+ re-connecting
+
+This patch fixes an issue that the renesas_usbhs driver in gadget mode
+cannot work correctly even if I disabled DMAC of the driver when I used
+the g_zero driver and the testusb tool.
+
+When a usb cable is re-connected, the renesas_usbhs driver calls the
+usbhsp_flags_init() (via usbhs_hotplug() --> usbhs_mod_call(start) -->
+usbhsg_try_start() --> usbhs_pipe_init()). However, the driver doesn't
+call the usbhsp_flags_init() when usbhsg_ep_disable() is called.
+So, if a gadget driver calls usb_ep_enable() and usb_ep_disable() again
+and again, the renesas_usbhs driver will output the following log:
+
+ renesas_usbhs renesas_usbhs: can't get pipe (BULK)
+ renesas_usbhs renesas_usbhs: wrong recip request
+
+Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+(cherry picked from commit dfb87b8bfe09f933abaf387693992089f6f9053e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/renesas_usbhs/mod_gadget.c | 2 ++
+ drivers/usb/renesas_usbhs/pipe.c | 10 ++++++++++
+ drivers/usb/renesas_usbhs/pipe.h | 1 +
+ 3 files changed, 13 insertions(+)
+
+diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
+index 458f3766bef1..04e6505777d0 100644
+--- a/drivers/usb/renesas_usbhs/mod_gadget.c
++++ b/drivers/usb/renesas_usbhs/mod_gadget.c
+@@ -600,8 +600,10 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
+ static int usbhsg_ep_disable(struct usb_ep *ep)
+ {
+ struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep);
++ struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep);
+
+ usbhsg_pipe_disable(uep);
++ usbhs_pipe_free(pipe);
+
+ uep->pipe->mod_private = NULL;
+ uep->pipe = NULL;
+diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
+index 239b889ca5b5..75fbcf6b102e 100644
+--- a/drivers/usb/renesas_usbhs/pipe.c
++++ b/drivers/usb/renesas_usbhs/pipe.c
+@@ -640,6 +640,11 @@ static struct usbhs_pipe *usbhsp_get_pipe(struct usbhs_priv *priv, u32 type)
+ return pipe;
+ }
+
++static void usbhsp_put_pipe(struct usbhs_pipe *pipe)
++{
++ usbhsp_flags_init(pipe);
++}
++
+ void usbhs_pipe_init(struct usbhs_priv *priv,
+ int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map))
+ {
+@@ -727,6 +732,11 @@ struct usbhs_pipe *usbhs_pipe_malloc(struct usbhs_priv *priv,
+ return pipe;
+ }
+
++void usbhs_pipe_free(struct usbhs_pipe *pipe)
++{
++ usbhsp_put_pipe(pipe);
++}
++
+ void usbhs_pipe_select_fifo(struct usbhs_pipe *pipe, struct usbhs_fifo *fifo)
+ {
+ if (pipe->fifo)
+diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h
+index 3e5349879838..406f36d050e4 100644
+--- a/drivers/usb/renesas_usbhs/pipe.h
++++ b/drivers/usb/renesas_usbhs/pipe.h
+@@ -75,6 +75,7 @@ struct usbhs_pipe_info {
+ char *usbhs_pipe_name(struct usbhs_pipe *pipe);
+ struct usbhs_pipe
+ *usbhs_pipe_malloc(struct usbhs_priv *priv, int endpoint_type, int dir_in);
++void usbhs_pipe_free(struct usbhs_pipe *pipe);
+ int usbhs_pipe_probe(struct usbhs_priv *priv);
+ void usbhs_pipe_remove(struct usbhs_priv *priv);
+ int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe);
+--
+2.1.2
+
diff --git a/patches.renesas/0738-usb-renesas_usbhs-add-R-Car-Gen.-2-init-and-power-co.patch b/patches.renesas/0738-usb-renesas_usbhs-add-R-Car-Gen.-2-init-and-power-co.patch
new file mode 100644
index 00000000000000..bc1e3ef44da3d9
--- /dev/null
+++ b/patches.renesas/0738-usb-renesas_usbhs-add-R-Car-Gen.-2-init-and-power-co.patch
@@ -0,0 +1,291 @@
+From 3ad40ac9b1a0583b3eac18fe0cc3f434cb85f385 Mon Sep 17 00:00:00 2001
+From: Ulrich Hecht <ulrich.hecht@gmail.com>
+Date: Thu, 10 Jul 2014 09:53:59 +0200
+Subject: usb: renesas_usbhs: add R-Car Gen. 2 init and power control
+
+In preparation for DT conversion to reduce reliance on platform device
+callbacks.
+
+Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+(cherry picked from commit 8ecef00fe1f33658ee36e902dba6850b51312073)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/renesas_usbhs/Makefile | 2 +-
+ drivers/usb/renesas_usbhs/common.c | 66 +++++++++++++++++++++++++++++---
+ drivers/usb/renesas_usbhs/common.h | 2 +
+ drivers/usb/renesas_usbhs/rcar2.c | 77 ++++++++++++++++++++++++++++++++++++++
+ drivers/usb/renesas_usbhs/rcar2.h | 4 ++
+ include/linux/usb/renesas_usbhs.h | 6 +++
+ 6 files changed, 151 insertions(+), 6 deletions(-)
+ create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
+ create mode 100644 drivers/usb/renesas_usbhs/rcar2.h
+
+diff --git a/drivers/usb/renesas_usbhs/Makefile b/drivers/usb/renesas_usbhs/Makefile
+index bc8aef4311a1..9e47f477b6d2 100644
+--- a/drivers/usb/renesas_usbhs/Makefile
++++ b/drivers/usb/renesas_usbhs/Makefile
+@@ -4,7 +4,7 @@
+
+ obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs.o
+
+-renesas_usbhs-y := common.o mod.o pipe.o fifo.o
++renesas_usbhs-y := common.o mod.o pipe.o fifo.o rcar2.o
+
+ ifneq ($(CONFIG_USB_RENESAS_USBHS_HCD),)
+ renesas_usbhs-y += mod_host.o
+diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
+index 17267b0a2e95..1b9bf8d83235 100644
+--- a/drivers/usb/renesas_usbhs/common.c
++++ b/drivers/usb/renesas_usbhs/common.c
+@@ -15,12 +15,14 @@
+ *
+ */
+ #include <linux/err.h>
++#include <linux/gpio.h>
+ #include <linux/io.h>
+ #include <linux/module.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/slab.h>
+ #include <linux/sysfs.h>
+ #include "common.h"
++#include "rcar2.h"
+
+ /*
+ * image of renesas_usbhs
+@@ -284,6 +286,8 @@ static void usbhsc_set_buswait(struct usbhs_priv *priv)
+ /*
+ * platform default param
+ */
++
++/* commonly used on old SH-Mobile SoCs */
+ static u32 usbhsc_default_pipe_type[] = {
+ USB_ENDPOINT_XFER_CONTROL,
+ USB_ENDPOINT_XFER_ISOC,
+@@ -297,6 +301,26 @@ static u32 usbhsc_default_pipe_type[] = {
+ USB_ENDPOINT_XFER_INT,
+ };
+
++/* commonly used on newer SH-Mobile and R-Car SoCs */
++static u32 usbhsc_new_pipe_type[] = {
++ USB_ENDPOINT_XFER_CONTROL,
++ USB_ENDPOINT_XFER_ISOC,
++ USB_ENDPOINT_XFER_ISOC,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_INT,
++ USB_ENDPOINT_XFER_INT,
++ USB_ENDPOINT_XFER_INT,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++ USB_ENDPOINT_XFER_BULK,
++};
++
+ /*
+ * power control
+ */
+@@ -423,8 +447,7 @@ static int usbhs_probe(struct platform_device *pdev)
+ int ret;
+
+ /* check platform information */
+- if (!info ||
+- !info->platform_callback.get_id) {
++ if (!info) {
+ dev_err(&pdev->dev, "no platform information\n");
+ return -EINVAL;
+ }
+@@ -451,13 +474,32 @@ static int usbhs_probe(struct platform_device *pdev)
+ /*
+ * care platform info
+ */
+- memcpy(&priv->pfunc,
+- &info->platform_callback,
+- sizeof(struct renesas_usbhs_platform_callback));
++
+ memcpy(&priv->dparam,
+ &info->driver_param,
+ sizeof(struct renesas_usbhs_driver_param));
+
++ switch (priv->dparam.type) {
++ case USBHS_TYPE_R8A7790:
++ case USBHS_TYPE_R8A7791:
++ priv->pfunc = usbhs_rcar2_ops;
++ if (!priv->dparam.pipe_type) {
++ priv->dparam.pipe_type = usbhsc_new_pipe_type;
++ priv->dparam.pipe_size =
++ ARRAY_SIZE(usbhsc_new_pipe_type);
++ }
++ break;
++ default:
++ if (!info->platform_callback.get_id) {
++ dev_err(&pdev->dev, "no platform callbacks");
++ return -EINVAL;
++ }
++ memcpy(&priv->pfunc,
++ &info->platform_callback,
++ sizeof(struct renesas_usbhs_platform_callback));
++ break;
++ }
++
+ /* set driver callback functions for platform */
+ dfunc = &info->driver_callback;
+ dfunc->notify_hotplug = usbhsc_drvcllbck_notify_hotplug;
+@@ -507,6 +549,20 @@ static int usbhs_probe(struct platform_device *pdev)
+ */
+ usbhs_sys_clock_ctrl(priv, 0);
+
++ /* check GPIO determining if USB function should be enabled */
++ if (priv->dparam.enable_gpio) {
++ gpio_request_one(priv->dparam.enable_gpio, GPIOF_IN, NULL);
++ ret = !gpio_get_value(priv->dparam.enable_gpio);
++ gpio_free(priv->dparam.enable_gpio);
++ if (ret) {
++ dev_warn(&pdev->dev,
++ "USB function not selected (GPIO %d)\n",
++ priv->dparam.enable_gpio);
++ ret = -ENOTSUPP;
++ goto probe_end_mod_exit;
++ }
++ }
++
+ /*
+ * platform call
+ *
+diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
+index c69dd2fba360..a7996da6a1bd 100644
+--- a/drivers/usb/renesas_usbhs/common.h
++++ b/drivers/usb/renesas_usbhs/common.h
+@@ -268,6 +268,8 @@ struct usbhs_priv {
+ * fifo control
+ */
+ struct usbhs_fifo_info fifo_info;
++
++ struct usb_phy *phy;
+ };
+
+ /*
+diff --git a/drivers/usb/renesas_usbhs/rcar2.c b/drivers/usb/renesas_usbhs/rcar2.c
+new file mode 100644
+index 000000000000..e6b9dcc1c289
+--- /dev/null
++++ b/drivers/usb/renesas_usbhs/rcar2.c
+@@ -0,0 +1,77 @@
++/*
++ * Renesas USB driver R-Car Gen. 2 initialization and power control
++ *
++ * Copyright (C) 2014 Ulrich Hecht
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ */
++
++#include <linux/gpio.h>
++#include <linux/of_gpio.h>
++#include <linux/platform_data/gpio-rcar.h>
++#include <linux/usb/phy.h>
++#include "common.h"
++#include "rcar2.h"
++
++static int usbhs_rcar2_hardware_init(struct platform_device *pdev)
++{
++ struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
++ struct usb_phy *phy;
++
++ phy = usb_get_phy_dev(&pdev->dev, 0);
++ if (IS_ERR(phy))
++ return PTR_ERR(phy);
++
++ priv->phy = phy;
++ return 0;
++}
++
++static int usbhs_rcar2_hardware_exit(struct platform_device *pdev)
++{
++ struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
++
++ if (!priv->phy)
++ return 0;
++
++ usb_put_phy(priv->phy);
++ priv->phy = NULL;
++
++ return 0;
++}
++
++static int usbhs_rcar2_power_ctrl(struct platform_device *pdev,
++ void __iomem *base, int enable)
++{
++ struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
++
++ if (!priv->phy)
++ return -ENODEV;
++
++ if (enable) {
++ int retval = usb_phy_init(priv->phy);
++
++ if (!retval)
++ retval = usb_phy_set_suspend(priv->phy, 0);
++ return retval;
++ }
++
++ usb_phy_set_suspend(priv->phy, 1);
++ usb_phy_shutdown(priv->phy);
++ return 0;
++}
++
++static int usbhs_rcar2_get_id(struct platform_device *pdev)
++{
++ return USBHS_GADGET;
++}
++
++const struct renesas_usbhs_platform_callback usbhs_rcar2_ops = {
++ .hardware_init = usbhs_rcar2_hardware_init,
++ .hardware_exit = usbhs_rcar2_hardware_exit,
++ .power_ctrl = usbhs_rcar2_power_ctrl,
++ .get_id = usbhs_rcar2_get_id,
++};
+diff --git a/drivers/usb/renesas_usbhs/rcar2.h b/drivers/usb/renesas_usbhs/rcar2.h
+new file mode 100644
+index 000000000000..f07f10d9b3b2
+--- /dev/null
++++ b/drivers/usb/renesas_usbhs/rcar2.h
+@@ -0,0 +1,4 @@
++#include "common.h"
++
++extern const struct renesas_usbhs_platform_callback
++ usbhs_rcar2_ops;
+diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
+index e452ba6ec6bd..d5952bb66752 100644
+--- a/include/linux/usb/renesas_usbhs.h
++++ b/include/linux/usb/renesas_usbhs.h
+@@ -153,6 +153,9 @@ struct renesas_usbhs_driver_param {
+ */
+ int pio_dma_border; /* default is 64byte */
+
++ u32 type;
++ u32 enable_gpio;
++
+ /*
+ * option:
+ */
+@@ -160,6 +163,9 @@ struct renesas_usbhs_driver_param {
+ u32 has_sudmac:1; /* for SUDMAC */
+ };
+
++#define USBHS_TYPE_R8A7790 1
++#define USBHS_TYPE_R8A7791 2
++
+ /*
+ * option:
+ *
+--
+2.1.2
+
diff --git a/patches.renesas/0739-dmaengine-shdma-Add-more-register-documentation.patch b/patches.renesas/0739-dmaengine-shdma-Add-more-register-documentation.patch
new file mode 100644
index 00000000000000..aa7aaf6d18cfb2
--- /dev/null
+++ b/patches.renesas/0739-dmaengine-shdma-Add-more-register-documentation.patch
@@ -0,0 +1,140 @@
+From 87b7edbaa34fc283e4e115cbf2f0b0a8d66a7b47 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 14:37:38 +0200
+Subject: dmaengine: shdma: Add more register documentation
+
+Also add a few definitions that were missing.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 6b32fafee2bb5fcf0b3d3d04a9762d3a0212089e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/sh/include/asm/dma-register.h | 36 +++++++++++++++++++-----------------
+ drivers/dma/sh/shdmac.c | 12 ++++++------
+ include/linux/sh_dma.h | 24 +++++++++++++-----------
+ 3 files changed, 38 insertions(+), 34 deletions(-)
+
+diff --git a/arch/sh/include/asm/dma-register.h b/arch/sh/include/asm/dma-register.h
+index 51cd78feacff..c757b47e6b64 100644
+--- a/arch/sh/include/asm/dma-register.h
++++ b/arch/sh/include/asm/dma-register.h
+@@ -13,17 +13,17 @@
+ #ifndef DMA_REGISTER_H
+ #define DMA_REGISTER_H
+
+-/* DMA register */
+-#define SAR 0x00
+-#define DAR 0x04
+-#define TCR 0x08
+-#define CHCR 0x0C
+-#define DMAOR 0x40
++/* DMA registers */
++#define SAR 0x00 /* Source Address Register */
++#define DAR 0x04 /* Destination Address Register */
++#define TCR 0x08 /* Transfer Count Register */
++#define CHCR 0x0C /* Channel Control Register */
++#define DMAOR 0x40 /* DMA Operation Register */
+
+ /* DMAOR definitions */
+-#define DMAOR_AE 0x00000004
++#define DMAOR_AE 0x00000004 /* Address Error Flag */
+ #define DMAOR_NMIF 0x00000002
+-#define DMAOR_DME 0x00000001
++#define DMAOR_DME 0x00000001 /* DMA Master Enable */
+
+ /* Definitions for the SuperH DMAC */
+ #define REQ_L 0x00000000
+@@ -34,18 +34,20 @@
+ #define ACK_W 0x00020000
+ #define ACK_H 0x00000000
+ #define ACK_L 0x00010000
+-#define DM_INC 0x00004000
+-#define DM_DEC 0x00008000
+-#define DM_FIX 0x0000c000
+-#define SM_INC 0x00001000
+-#define SM_DEC 0x00002000
+-#define SM_FIX 0x00003000
++#define DM_INC 0x00004000 /* Destination addresses are incremented */
++#define DM_DEC 0x00008000 /* Destination addresses are decremented */
++#define DM_FIX 0x0000c000 /* Destination address is fixed */
++#define SM_INC 0x00001000 /* Source addresses are incremented */
++#define SM_DEC 0x00002000 /* Source addresses are decremented */
++#define SM_FIX 0x00003000 /* Source address is fixed */
+ #define RS_IN 0x00000200
+ #define RS_OUT 0x00000300
++#define RS_AUTO 0x00000400 /* Auto Request */
++#define RS_ERS 0x00000800 /* DMA extended resource selector */
+ #define TS_BLK 0x00000040
+ #define TM_BUR 0x00000020
+-#define CHCR_DE 0x00000001
+-#define CHCR_TE 0x00000002
+-#define CHCR_IE 0x00000004
++#define CHCR_DE 0x00000001 /* DMA Enable */
++#define CHCR_TE 0x00000002 /* Transfer End Flag */
++#define CHCR_IE 0x00000004 /* Interrupt Enable */
+
+ #endif
+diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
+index 0d765c0e21ec..9acbba84759b 100644
+--- a/drivers/dma/sh/shdmac.c
++++ b/drivers/dma/sh/shdmac.c
+@@ -37,12 +37,12 @@
+ #include "../dmaengine.h"
+ #include "shdma.h"
+
+-/* DMA register */
+-#define SAR 0x00
+-#define DAR 0x04
+-#define TCR 0x08
+-#define CHCR 0x0C
+-#define DMAOR 0x40
++/* DMA registers */
++#define SAR 0x00 /* Source Address Register */
++#define DAR 0x04 /* Destination Address Register */
++#define TCR 0x08 /* Transfer Count Register */
++#define CHCR 0x0C /* Channel Control Register */
++#define DMAOR 0x40 /* DMA Operation Register */
+
+ #define TEND 0x18 /* USB-DMAC */
+
+diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
+index b7b43b82231e..56b97eed28a4 100644
+--- a/include/linux/sh_dma.h
++++ b/include/linux/sh_dma.h
+@@ -95,19 +95,21 @@ struct sh_dmae_pdata {
+ };
+
+ /* DMAOR definitions */
+-#define DMAOR_AE 0x00000004
++#define DMAOR_AE 0x00000004 /* Address Error Flag */
+ #define DMAOR_NMIF 0x00000002
+-#define DMAOR_DME 0x00000001
++#define DMAOR_DME 0x00000001 /* DMA Master Enable */
+
+ /* Definitions for the SuperH DMAC */
+-#define DM_INC 0x00004000
+-#define DM_DEC 0x00008000
+-#define DM_FIX 0x0000c000
+-#define SM_INC 0x00001000
+-#define SM_DEC 0x00002000
+-#define SM_FIX 0x00003000
+-#define CHCR_DE 0x00000001
+-#define CHCR_TE 0x00000002
+-#define CHCR_IE 0x00000004
++#define DM_INC 0x00004000 /* Destination addresses are incremented */
++#define DM_DEC 0x00008000 /* Destination addresses are decremented */
++#define DM_FIX 0x0000c000 /* Destination address is fixed */
++#define SM_INC 0x00001000 /* Source addresses are incremented */
++#define SM_DEC 0x00002000 /* Source addresses are decremented */
++#define SM_FIX 0x00003000 /* Source address is fixed */
++#define RS_AUTO 0x00000400 /* Auto Request */
++#define RS_ERS 0x00000800 /* DMA extended resource selector */
++#define CHCR_DE 0x00000001 /* DMA Enable */
++#define CHCR_TE 0x00000002 /* Transfer End Flag */
++#define CHCR_IE 0x00000004 /* Interrupt Enable */
+
+ #endif
+--
+2.1.2
+
diff --git a/patches.renesas/0740-dmaengine-shdma-Use-defines-instead-of-hardcoded-num.patch b/patches.renesas/0740-dmaengine-shdma-Use-defines-instead-of-hardcoded-num.patch
new file mode 100644
index 00000000000000..30681c2b14b1d2
--- /dev/null
+++ b/patches.renesas/0740-dmaengine-shdma-Use-defines-instead-of-hardcoded-num.patch
@@ -0,0 +1,46 @@
+From d75e715bd59869d0ca568f77ee12d995a431feec Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 14:37:41 +0200
+Subject: dmaengine: shdma: Use defines instead of hardcoded numbers
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 0cdbee33ea42bfd5f61f824e258a1a0944dd2a27)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/dma/sh/shdma-arm.h | 4 ++--
+ drivers/dma/sh/shdmac.c | 3 +--
+ 2 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/dma/sh/shdma-arm.h b/drivers/dma/sh/shdma-arm.h
+index a2b8258426c9..a1b0ef45d6a2 100644
+--- a/drivers/dma/sh/shdma-arm.h
++++ b/drivers/dma/sh/shdma-arm.h
+@@ -45,7 +45,7 @@ enum {
+ ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\
+ (((i) & TS_HI_BIT) << TS_HI_SHIFT))
+
+-#define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL((xmit_sz)))
+-#define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL((xmit_sz)))
++#define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL((xmit_sz)))
++#define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL((xmit_sz)))
+
+ #endif
+diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
+index 9acbba84759b..5c1fbe7d300a 100644
+--- a/drivers/dma/sh/shdmac.c
++++ b/drivers/dma/sh/shdmac.c
+@@ -238,9 +238,8 @@ static void dmae_init(struct sh_dmae_chan *sh_chan)
+ {
+ /*
+ * Default configuration for dual address memory-memory transfer.
+- * 0x400 represents auto-request.
+ */
+- u32 chcr = DM_INC | SM_INC | 0x400 | log2size_to_chcr(sh_chan,
++ u32 chcr = DM_INC | SM_INC | RS_AUTO | log2size_to_chcr(sh_chan,
+ LOG2_DEFAULT_XFER_SIZE);
+ sh_chan->xmit_shift = calc_xmit_shift(sh_chan, chcr);
+ chcr_write(sh_chan, chcr);
+--
+2.1.2
+
diff --git a/patches.renesas/0741-dmaengine-sh-Rework-Kconfig-and-Makefile.patch b/patches.renesas/0741-dmaengine-sh-Rework-Kconfig-and-Makefile.patch
new file mode 100644
index 00000000000000..5e70ddb7d96a15
--- /dev/null
+++ b/patches.renesas/0741-dmaengine-sh-Rework-Kconfig-and-Makefile.patch
@@ -0,0 +1,120 @@
+From fdd7ce8e8a49133fe410ed2ecf84fc594e5bcf1e Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Thu, 31 Jul 2014 09:34:04 +0900
+Subject: dmaengine: sh: Rework Kconfig and Makefile
+
+Separate helpers and drivers in the Kconfig and Makefile to improve
+readability and move the CONFIG_OF dependency from the Makefile to
+Kconfig.
+
+[pebolle@tiscali.nl: reported need to rename SHDMA_R8A73A4 instances]
+Reported-by: Paul Bolle <pebolle@tiscali.nl>
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+[horms+renesas@verge.net.au: squashed rename of SHDMA_R8A73A4 instances]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+Signed-off-by: Vinod Koul <vinod.koul@intel.com>
+
+(cherry picked from commit 9f2c2bb31258e11b1ebaf73bdf2a88f8afaa2dd2)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/dma/sh/Kconfig | 24 +++++++++++++++++++-----
+ drivers/dma/sh/Makefile | 16 ++++++++++++----
+ drivers/dma/sh/shdma.h | 2 +-
+ 3 files changed, 32 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/dma/sh/Kconfig b/drivers/dma/sh/Kconfig
+index 0f719816c91b..0349125a2e20 100644
+--- a/drivers/dma/sh/Kconfig
++++ b/drivers/dma/sh/Kconfig
+@@ -2,21 +2,39 @@
+ # DMA engine configuration for sh
+ #
+
++#
++# DMA Engine Helpers
++#
++
+ config SH_DMAE_BASE
+ bool "Renesas SuperH DMA Engine support"
+- depends on (SUPERH && SH_DMA) || ARCH_SHMOBILE || COMPILE_TEST
++ depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
++ depends on !SUPERH || SH_DMA
+ depends on !SH_DMA_API
+ default y
+ select DMA_ENGINE
+ help
+ Enable support for the Renesas SuperH DMA controllers.
+
++#
++# DMA Controllers
++#
++
+ config SH_DMAE
+ tristate "Renesas SuperH DMAC support"
+ depends on SH_DMAE_BASE
+ help
+ Enable support for the Renesas SuperH DMA controllers.
+
++if SH_DMAE
++
++config SH_DMAE_R8A73A4
++ def_bool y
++ depends on ARCH_R8A73A4
++ depends on OF
++
++endif
++
+ config SUDMAC
+ tristate "Renesas SUDMAC support"
+ depends on SH_DMAE_BASE
+@@ -34,7 +52,3 @@ config RCAR_AUDMAC_PP
+ depends on SH_DMAE_BASE
+ help
+ Enable support for the Renesas R-Car Audio DMAC Peripheral Peripheral controllers.
+-
+-config SHDMA_R8A73A4
+- def_bool y
+- depends on ARCH_R8A73A4 && SH_DMAE != n
+diff --git a/drivers/dma/sh/Makefile b/drivers/dma/sh/Makefile
+index 1ce88b28cfc6..0a5cfdb76e45 100644
+--- a/drivers/dma/sh/Makefile
++++ b/drivers/dma/sh/Makefile
+@@ -1,10 +1,18 @@
++#
++# DMA Engine Helpers
++#
++
+ obj-$(CONFIG_SH_DMAE_BASE) += shdma-base.o shdma-of.o
+-obj-$(CONFIG_SH_DMAE) += shdma.o
++
++#
++# DMA Controllers
++#
++
+ shdma-y := shdmac.o
+-ifeq ($(CONFIG_OF),y)
+-shdma-$(CONFIG_SHDMA_R8A73A4) += shdma-r8a73a4.o
+-endif
++shdma-$(CONFIG_SH_DMAE_R8A73A4) += shdma-r8a73a4.o
+ shdma-objs := $(shdma-y)
++obj-$(CONFIG_SH_DMAE) += shdma.o
++
+ obj-$(CONFIG_SUDMAC) += sudmac.o
+ obj-$(CONFIG_RCAR_HPB_DMAE) += rcar-hpbdma.o
+ obj-$(CONFIG_RCAR_AUDMAC_PP) += rcar-audmapp.o
+diff --git a/drivers/dma/sh/shdma.h b/drivers/dma/sh/shdma.h
+index 758a57b51875..2c0a969adc9f 100644
+--- a/drivers/dma/sh/shdma.h
++++ b/drivers/dma/sh/shdma.h
+@@ -62,7 +62,7 @@ struct sh_dmae_desc {
+ #define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
+ struct sh_dmae_device, shdma_dev.dma_dev)
+
+-#ifdef CONFIG_SHDMA_R8A73A4
++#ifdef CONFIG_SH_DMAE_R8A73A4
+ extern const struct sh_dmae_pdata r8a73a4_dma_pdata;
+ #define r8a73a4_shdma_devid (&r8a73a4_dma_pdata)
+ #else
+--
+2.1.2
+
diff --git a/patches.renesas/0742-serial-sh-sci-Updated-calculation-of-bit-error-rate-.patch b/patches.renesas/0742-serial-sh-sci-Updated-calculation-of-bit-error-rate-.patch
new file mode 100644
index 00000000000000..b9eb65f17d6e6c
--- /dev/null
+++ b/patches.renesas/0742-serial-sh-sci-Updated-calculation-of-bit-error-rate-.patch
@@ -0,0 +1,41 @@
+From 79253be887e74e8c7e6e5c963eb918772ffdd0d4 Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Mon, 14 Jul 2014 16:09:58 +0900
+Subject: serial: sh-sci: Updated calculation of bit error rate and bit rate
+
+Currently, the decimal point is discarded calculation of BRR.
+Therefore, it can not calculate a value close to the correct value.
+This patch fixes this problem by using DIV_ROUND_CLOSEST.
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+(cherry picked from commit b7d66397f4d282ddf2a2fe516fc9329c5a063459)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 88236da0ddf7..ce8013702560 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1796,11 +1796,13 @@ static void sci_baud_calc_hscif(unsigned int bps, unsigned long freq,
+ for (sr = 8; sr <= 32; sr++) {
+ for (c = 0; c <= 3; c++) {
+ /* integerized formulas from HSCIF documentation */
+- br = freq / (sr * (1 << (2 * c + 1)) * bps) - 1;
++ br = DIV_ROUND_CLOSEST(freq, (sr *
++ (1 << (2 * c + 1)) * bps)) - 1;
+ if (br < 0 || br > 255)
+ continue;
+- err = freq / ((br + 1) * bps * sr *
+- (1 << (2 * c + 1)) / 1000) - 1000;
++ err = DIV_ROUND_CLOSEST(freq, ((br + 1) * bps * sr *
++ (1 << (2 * c + 1)) / 1000)) -
++ 1000;
+ if (min_err > err) {
+ min_err = err;
+ *brr = br;
+--
+2.1.2
+
diff --git a/patches.renesas/0743-serial-sh-sci-Fix-range-check-of-bit-rate-for-HSCIF.patch b/patches.renesas/0743-serial-sh-sci-Fix-range-check-of-bit-rate-for-HSCIF.patch
new file mode 100644
index 00000000000000..3e026bb9fb39fe
--- /dev/null
+++ b/patches.renesas/0743-serial-sh-sci-Fix-range-check-of-bit-rate-for-HSCIF.patch
@@ -0,0 +1,36 @@
+From f26b05b6f8e3a25e9eab2dc4175f7f775b00a53c Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Mon, 14 Jul 2014 16:09:59 +0900
+Subject: serial: sh-sci: Fix range check of bit-rate for HSCIF
+
+If bit-rate calculation result of HSCIF is expect 255 from 0,
+driver does not calculate error bit. However, we need to round
+the value to calculate error bit in the case of negative value.
+This rounds the value of bit-rate using clamp(), and bit-rate is the
+case of negative value, it enables the calculation of the error bit.
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+(cherry picked from commit bcb9973a6097652a12660958449301aada41de9c)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index ce8013702560..7f571a8bdcfb 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1798,8 +1798,7 @@ static void sci_baud_calc_hscif(unsigned int bps, unsigned long freq,
+ /* integerized formulas from HSCIF documentation */
+ br = DIV_ROUND_CLOSEST(freq, (sr *
+ (1 << (2 * c + 1)) * bps)) - 1;
+- if (br < 0 || br > 255)
+- continue;
++ br = clamp(br, 0, 255);
+ err = DIV_ROUND_CLOSEST(freq, ((br + 1) * bps * sr *
+ (1 << (2 * c + 1)) / 1000)) -
+ 1000;
+--
+2.1.2
+
diff --git a/patches.renesas/0744-serial-sh-sci-Add-calculation-recive-margin-for-HSCI.patch b/patches.renesas/0744-serial-sh-sci-Add-calculation-recive-margin-for-HSCI.patch
new file mode 100644
index 00000000000000..6b676391e84eaa
--- /dev/null
+++ b/patches.renesas/0744-serial-sh-sci-Add-calculation-recive-margin-for-HSCI.patch
@@ -0,0 +1,147 @@
+From 0c50063c76e90d7b12485f5e9ea6513c018ae1dd Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Mon, 14 Jul 2014 16:10:00 +0900
+Subject: serial: sh-sci: Add calculation recive margin for HSCIF
+
+When the error of the same bit rate is detected, we will need to select
+the recive margin is large. Current code holds the minimum error, it does
+not have to check the recive margin. This adds this calculation.
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+(cherry picked from commit 730c4e782c039caf40b467c35f595c005e94220c)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 77 ++++++++++++++++++++++++++++++++++-----------
+ 1 file changed, 59 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 7f571a8bdcfb..d879c0ca400a 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1783,13 +1783,30 @@ static unsigned int sci_scbrr_calc(struct sci_port *s, unsigned int bps,
+ return ((freq + 16 * bps) / (32 * bps) - 1);
+ }
+
++/* calculate frame length from SMR */
++static int sci_baud_calc_frame_len(unsigned int smr_val)
++{
++ int len = 10;
++
++ if (smr_val & SCSMR_CHR)
++ len--;
++ if (smr_val & SCSMR_PE)
++ len++;
++ if (smr_val & SCSMR_STOP)
++ len++;
++
++ return len;
++}
++
++
+ /* calculate sample rate, BRR, and clock select for HSCIF */
+ static void sci_baud_calc_hscif(unsigned int bps, unsigned long freq,
+ int *brr, unsigned int *srr,
+- unsigned int *cks)
++ unsigned int *cks, int frame_len)
+ {
+- int sr, c, br, err;
++ int sr, c, br, err, recv_margin;
+ int min_err = 1000; /* 100% */
++ int recv_max_margin = 0;
+
+ /* Find the combination of sample rate and clock select with the
+ smallest deviation from the desired baud rate. */
+@@ -1802,12 +1819,35 @@ static void sci_baud_calc_hscif(unsigned int bps, unsigned long freq,
+ err = DIV_ROUND_CLOSEST(freq, ((br + 1) * bps * sr *
+ (1 << (2 * c + 1)) / 1000)) -
+ 1000;
++ if (err < 0)
++ continue;
++
++ /* Calc recv margin
++ * M: Receive margin (%)
++ * N: Ratio of bit rate to clock (N = sampling rate)
++ * D: Clock duty (D = 0 to 1.0)
++ * L: Frame length (L = 9 to 12)
++ * F: Absolute value of clock frequency deviation
++ *
++ * M = |(0.5 - 1 / 2 * N) - ((L - 0.5) * F) -
++ * (|D - 0.5| / N * (1 + F))|
++ * NOTE: Usually, treat D for 0.5, F is 0 by this
++ * calculation.
++ */
++ recv_margin = abs((500 -
++ DIV_ROUND_CLOSEST(1000, sr << 1)) / 10);
+ if (min_err > err) {
+ min_err = err;
+- *brr = br;
+- *srr = sr - 1;
+- *cks = c;
+- }
++ recv_max_margin = recv_margin;
++ } else if ((min_err == err) &&
++ (recv_margin > recv_max_margin))
++ recv_max_margin = recv_margin;
++ else
++ continue;
++
++ *brr = br;
++ *srr = sr - 1;
++ *cks = c;
+ }
+ }
+
+@@ -1841,10 +1881,19 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+ {
+ struct sci_port *s = to_sci_port(port);
+ struct plat_sci_reg *reg;
+- unsigned int baud, smr_val, max_baud, cks = 0;
++ unsigned int baud, smr_val = 0, max_baud, cks = 0;
+ int t = -1;
+ unsigned int srr = 15;
+
++ if ((termios->c_cflag & CSIZE) == CS7)
++ smr_val |= SCSMR_CHR;
++ if (termios->c_cflag & PARENB)
++ smr_val |= SCSMR_PE;
++ if (termios->c_cflag & PARODD)
++ smr_val |= SCSMR_PE | SCSMR_ODD;
++ if (termios->c_cflag & CSTOPB)
++ smr_val |= SCSMR_STOP;
++
+ /*
+ * earlyprintk comes here early on with port->uartclk set to zero.
+ * the clock framework is not up and running at this point so here
+@@ -1858,8 +1907,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+ baud = uart_get_baud_rate(port, termios, old, 0, max_baud);
+ if (likely(baud && port->uartclk)) {
+ if (s->cfg->type == PORT_HSCIF) {
++ int frame_len = sci_baud_calc_frame_len(smr_val);
+ sci_baud_calc_hscif(baud, port->uartclk, &t, &srr,
+- &cks);
++ &cks, frame_len);
+ } else {
+ t = sci_scbrr_calc(s, baud, port->uartclk);
+ for (cks = 0; t >= 256 && cks <= 3; cks++)
+@@ -1871,16 +1921,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+
+ sci_reset(port);
+
+- smr_val = serial_port_in(port, SCSMR) & 3;
+-
+- if ((termios->c_cflag & CSIZE) == CS7)
+- smr_val |= SCSMR_CHR;
+- if (termios->c_cflag & PARENB)
+- smr_val |= SCSMR_PE;
+- if (termios->c_cflag & PARODD)
+- smr_val |= SCSMR_PE | SCSMR_ODD;
+- if (termios->c_cflag & CSTOPB)
+- smr_val |= SCSMR_STOP;
++ smr_val |= serial_port_in(port, SCSMR) & 3;
+
+ uart_update_timeout(port, termios->c_cflag, baud);
+
+--
+2.1.2
+
diff --git a/patches.renesas/0745-sh-pfc-r8a7791-fix-CAN-pin-groups.patch b/patches.renesas/0745-sh-pfc-r8a7791-fix-CAN-pin-groups.patch
new file mode 100644
index 00000000000000..f6f6b31ae05bb5
--- /dev/null
+++ b/patches.renesas/0745-sh-pfc-r8a7791-fix-CAN-pin-groups.patch
@@ -0,0 +1,54 @@
+From 6c4fc4152dc30be36da21c2c627e2b014dcc90ff Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Tue, 29 Jul 2014 02:12:55 +0400
+Subject: sh-pfc: r8a7791: fix CAN pin groups
+
+I had made last-minute changes before submitting the patch "sh-pfc: r8a7791:
+add CAN pin groups"; now I'm seeing that they weren't complete: I had missed
+update to the pin group names in pin[01]_groups[]. Drop the "_a" suffixes there.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+(cherry picked from commit 302fb1781783ded370f515e8e649b8285ee29cdc)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+index 576d41b459e9..c6e5deba238e 100644
+--- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
++++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
+@@ -4509,24 +4509,24 @@ static const char * const audio_clk_groups[] = {
+ };
+
+ static const char * const can0_groups[] = {
+- "can0_data_a",
++ "can0_data",
+ "can0_data_b",
+ "can0_data_c",
+ "can0_data_d",
+ "can0_data_e",
+ "can0_data_f",
+- "can_clk_a",
++ "can_clk",
+ "can_clk_b",
+ "can_clk_c",
+ "can_clk_d",
+ };
+
+ static const char * const can1_groups[] = {
+- "can1_data_a",
++ "can1_data",
+ "can1_data_b",
+ "can1_data_c",
+ "can1_data_d",
+- "can_clk_a",
++ "can_clk",
+ "can_clk_b",
+ "can_clk_c",
+ "can_clk_d",
+--
+2.1.2
+
diff --git a/patches.renesas/0746-spi-sh-msiof-Add-more-register-documentation.patch b/patches.renesas/0746-spi-sh-msiof-Add-more-register-documentation.patch
new file mode 100644
index 00000000000000..0527088f831222
--- /dev/null
+++ b/patches.renesas/0746-spi-sh-msiof-Add-more-register-documentation.patch
@@ -0,0 +1,83 @@
+From d95b68544779988bdf26faa3650fefe84d259189 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 12:16:16 +0200
+Subject: spi: sh-msiof: Add more register documentation
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 2e2b36872d7b45b1f88a590283b14c67931b777f)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-sh-msiof.c | 54 +++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 53 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
+index 45b09142afe2..38824a994131 100644
+--- a/drivers/spi/spi-sh-msiof.c
++++ b/drivers/spi/spi-sh-msiof.c
+@@ -113,9 +113,61 @@ struct sh_msiof_spi_priv {
+ #define CTR_TXE 0x00000200 /* Transmit Enable */
+ #define CTR_RXE 0x00000100 /* Receive Enable */
+
+-/* STR and IER */
++/* FCTR */
++#define FCTR_TFWM_MASK 0xe0000000 /* Transmit FIFO Watermark */
++#define FCTR_TFWM_64 0x00000000 /* Transfer Request when 64 empty stages */
++#define FCTR_TFWM_32 0x20000000 /* Transfer Request when 32 empty stages */
++#define FCTR_TFWM_24 0x40000000 /* Transfer Request when 24 empty stages */
++#define FCTR_TFWM_16 0x60000000 /* Transfer Request when 16 empty stages */
++#define FCTR_TFWM_12 0x80000000 /* Transfer Request when 12 empty stages */
++#define FCTR_TFWM_8 0xa0000000 /* Transfer Request when 8 empty stages */
++#define FCTR_TFWM_4 0xc0000000 /* Transfer Request when 4 empty stages */
++#define FCTR_TFWM_1 0xe0000000 /* Transfer Request when 1 empty stage */
++#define FCTR_TFUA_MASK 0x07f00000 /* Transmit FIFO Usable Area */
++#define FCTR_TFUA_SHIFT 20
++#define FCTR_TFUA(i) ((i) << FCTR_TFUA_SHIFT)
++#define FCTR_RFWM_MASK 0x0000e000 /* Receive FIFO Watermark */
++#define FCTR_RFWM_1 0x00000000 /* Transfer Request when 1 valid stages */
++#define FCTR_RFWM_4 0x00002000 /* Transfer Request when 4 valid stages */
++#define FCTR_RFWM_8 0x00004000 /* Transfer Request when 8 valid stages */
++#define FCTR_RFWM_16 0x00006000 /* Transfer Request when 16 valid stages */
++#define FCTR_RFWM_32 0x00008000 /* Transfer Request when 32 valid stages */
++#define FCTR_RFWM_64 0x0000a000 /* Transfer Request when 64 valid stages */
++#define FCTR_RFWM_128 0x0000c000 /* Transfer Request when 128 valid stages */
++#define FCTR_RFWM_256 0x0000e000 /* Transfer Request when 256 valid stages */
++#define FCTR_RFUA_MASK 0x00001ff0 /* Receive FIFO Usable Area (0x40 = full) */
++#define FCTR_RFUA_SHIFT 4
++#define FCTR_RFUA(i) ((i) << FCTR_RFUA_SHIFT)
++
++/* STR */
++#define STR_TFEMP 0x20000000 /* Transmit FIFO Empty */
++#define STR_TDREQ 0x10000000 /* Transmit Data Transfer Request */
+ #define STR_TEOF 0x00800000 /* Frame Transmission End */
++#define STR_TFSERR 0x00200000 /* Transmit Frame Synchronization Error */
++#define STR_TFOVF 0x00100000 /* Transmit FIFO Overflow */
++#define STR_TFUDF 0x00080000 /* Transmit FIFO Underflow */
++#define STR_RFFUL 0x00002000 /* Receive FIFO Full */
++#define STR_RDREQ 0x00001000 /* Receive Data Transfer Request */
+ #define STR_REOF 0x00000080 /* Frame Reception End */
++#define STR_RFSERR 0x00000020 /* Receive Frame Synchronization Error */
++#define STR_RFUDF 0x00000010 /* Receive FIFO Underflow */
++#define STR_RFOVF 0x00000008 /* Receive FIFO Overflow */
++
++/* IER */
++#define IER_TDMAE 0x80000000 /* Transmit Data DMA Transfer Req. Enable */
++#define IER_TFEMPE 0x20000000 /* Transmit FIFO Empty Enable */
++#define IER_TDREQE 0x10000000 /* Transmit Data Transfer Request Enable */
++#define IER_TEOFE 0x00800000 /* Frame Transmission End Enable */
++#define IER_TFSERRE 0x00200000 /* Transmit Frame Sync Error Enable */
++#define IER_TFOVFE 0x00100000 /* Transmit FIFO Overflow Enable */
++#define IER_TFUDFE 0x00080000 /* Transmit FIFO Underflow Enable */
++#define IER_RDMAE 0x00008000 /* Receive Data DMA Transfer Req. Enable */
++#define IER_RFFULE 0x00002000 /* Receive FIFO Full Enable */
++#define IER_RDREQE 0x00001000 /* Receive Data Transfer Request Enable */
++#define IER_REOFE 0x00000080 /* Frame Reception End Enable */
++#define IER_RFSERRE 0x00000020 /* Receive Frame Sync Error Enable */
++#define IER_RFUDFE 0x00000010 /* Receive FIFO Underflow Enable */
++#define IER_RFOVFE 0x00000008 /* Receive FIFO Overflow Enable */
+
+
+ static u32 sh_msiof_read(struct sh_msiof_spi_priv *p, int reg_offs)
+--
+2.1.2
+
diff --git a/patches.renesas/0747-spi-sh-msiof-Extract-sh_msiof_spi_-start-stop-helper.patch b/patches.renesas/0747-spi-sh-msiof-Extract-sh_msiof_spi_-start-stop-helper.patch
new file mode 100644
index 00000000000000..07ab3165277fc7
--- /dev/null
+++ b/patches.renesas/0747-spi-sh-msiof-Extract-sh_msiof_spi_-start-stop-helper.patch
@@ -0,0 +1,95 @@
+From 8f823258e8982b397a040cdc46b25161654b1419 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 12:16:17 +0200
+Subject: spi: sh-msiof: Extract sh_msiof_spi_{start,stop}() helpers
+
+Based on an old patch by Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 76c02e71612533206cb062b875c9609bce83d23a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-sh-msiof.c | 51 +++++++++++++++++++++++++++++++++-------------
+ 1 file changed, 37 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
+index 38824a994131..2cd5fcb86f71 100644
+--- a/drivers/spi/spi-sh-msiof.c
++++ b/drivers/spi/spi-sh-msiof.c
+@@ -509,6 +509,40 @@ static int sh_msiof_prepare_message(struct spi_master *master,
+ return 0;
+ }
+
++static int sh_msiof_spi_start(struct sh_msiof_spi_priv *p, void *rx_buf)
++{
++ int ret;
++
++ /* setup clock and rx/tx signals */
++ ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TSCKE);
++ if (rx_buf && !ret)
++ ret = sh_msiof_modify_ctr_wait(p, 0, CTR_RXE);
++ if (!ret)
++ ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TXE);
++
++ /* start by setting frame bit */
++ if (!ret)
++ ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TFSE);
++
++ return ret;
++}
++
++static int sh_msiof_spi_stop(struct sh_msiof_spi_priv *p, void *rx_buf)
++{
++ int ret;
++
++ /* shut down frame, rx/tx and clock signals */
++ ret = sh_msiof_modify_ctr_wait(p, CTR_TFSE, 0);
++ if (!ret)
++ ret = sh_msiof_modify_ctr_wait(p, CTR_TXE, 0);
++ if (rx_buf && !ret)
++ ret = sh_msiof_modify_ctr_wait(p, CTR_RXE, 0);
++ if (!ret)
++ ret = sh_msiof_modify_ctr_wait(p, CTR_TSCKE, 0);
++
++ return ret;
++}
++
+ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p,
+ void (*tx_fifo)(struct sh_msiof_spi_priv *,
+ const void *, int, int),
+@@ -536,15 +570,9 @@ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p,
+ if (tx_buf)
+ tx_fifo(p, tx_buf, words, fifo_shift);
+
+- /* setup clock and rx/tx signals */
+- ret = sh_msiof_modify_ctr_wait(p, 0, CTR_TSCKE);
+- if (rx_buf)
+- ret = ret ? ret : sh_msiof_modify_ctr_wait(p, 0, CTR_RXE);
+- ret = ret ? ret : sh_msiof_modify_ctr_wait(p, 0, CTR_TXE);
+-
+- /* start by setting frame bit */
+ reinit_completion(&p->done);
+- ret = ret ? ret : sh_msiof_modify_ctr_wait(p, 0, CTR_TFSE);
++
++ ret = sh_msiof_spi_start(p, rx_buf);
+ if (ret) {
+ dev_err(&p->pdev->dev, "failed to start hardware\n");
+ goto err;
+@@ -560,12 +588,7 @@ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p,
+ /* clear status bits */
+ sh_msiof_reset_str(p);
+
+- /* shut down frame, rx/tx and clock signals */
+- ret = sh_msiof_modify_ctr_wait(p, CTR_TFSE, 0);
+- ret = ret ? ret : sh_msiof_modify_ctr_wait(p, CTR_TXE, 0);
+- if (rx_buf)
+- ret = ret ? ret : sh_msiof_modify_ctr_wait(p, CTR_RXE, 0);
+- ret = ret ? ret : sh_msiof_modify_ctr_wait(p, CTR_TSCKE, 0);
++ ret = sh_msiof_spi_stop(p, rx_buf);
+ if (ret) {
+ dev_err(&p->pdev->dev, "failed to shut down hardware\n");
+ goto err;
+--
+2.1.2
+
diff --git a/patches.renesas/0748-spi-sh-msiof-Improve-transfer-error-handling.patch b/patches.renesas/0748-spi-sh-msiof-Improve-transfer-error-handling.patch
new file mode 100644
index 00000000000000..309d58f7b700d0
--- /dev/null
+++ b/patches.renesas/0748-spi-sh-msiof-Improve-transfer-error-handling.patch
@@ -0,0 +1,71 @@
+From 8287d99084cd46071a2074b95662ee7d663ad70c Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 12:16:18 +0200
+Subject: spi: sh-msiof: Improve transfer error handling
+
+ - Add a timeout when waiting for the transfer complete interrupt,
+ - If sh_msiof_spi_stop() fails, there's no need to clear IER, as the
+ interrupt handler has already done that,
+ - Propagate transfer failures in sh_msiof_transfer_one().
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 75b82e23a4ea20a9e1a48695ff5e01761889dbb3)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-sh-msiof.c | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
+index 2cd5fcb86f71..e5894a65c797 100644
+--- a/drivers/spi/spi-sh-msiof.c
++++ b/drivers/spi/spi-sh-msiof.c
+@@ -575,11 +575,16 @@ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p,
+ ret = sh_msiof_spi_start(p, rx_buf);
+ if (ret) {
+ dev_err(&p->pdev->dev, "failed to start hardware\n");
+- goto err;
++ goto stop_ier;
+ }
+
+ /* wait for tx fifo to be emptied / rx fifo to be filled */
+- wait_for_completion(&p->done);
++ ret = wait_for_completion_timeout(&p->done, HZ);
++ if (!ret) {
++ dev_err(&p->pdev->dev, "PIO timeout\n");
++ ret = -ETIMEDOUT;
++ goto stop_reset;
++ }
+
+ /* read rx fifo */
+ if (rx_buf)
+@@ -591,12 +596,15 @@ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p,
+ ret = sh_msiof_spi_stop(p, rx_buf);
+ if (ret) {
+ dev_err(&p->pdev->dev, "failed to shut down hardware\n");
+- goto err;
++ return ret;
+ }
+
+ return words;
+
+- err:
++stop_reset:
++ sh_msiof_reset_str(p);
++ sh_msiof_spi_stop(p, rx_buf);
++stop_ier:
+ sh_msiof_write(p, IER, 0);
+ return ret;
+ }
+@@ -679,7 +687,7 @@ static int sh_msiof_transfer_one(struct spi_master *master,
+ rx_buf,
+ words, bits);
+ if (n < 0)
+- break;
++ return n;
+
+ bytes_done += n * bytes_per_word;
+ words -= n;
+--
+2.1.2
+
diff --git a/patches.renesas/0749-spi-sh-msiof-Refactor-sh_msiof_transfer_one.patch b/patches.renesas/0749-spi-sh-msiof-Refactor-sh_msiof_transfer_one.patch
new file mode 100644
index 00000000000000..cea0b90d72eb7c
--- /dev/null
+++ b/patches.renesas/0749-spi-sh-msiof-Refactor-sh_msiof_transfer_one.patch
@@ -0,0 +1,119 @@
+From aeba79f4237373a48c1de437b1d107381c5131f8 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 12:16:19 +0200
+Subject: spi: sh-msiof: Refactor sh_msiof_transfer_one()
+
+ - Move buffer pointer and length setup to the top,
+ - Make unsigned values unsigned,
+ - Loop over words and increment pointers instead of recalculating them,
+ which allows to kill bytes_done.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 0312d59130693adad85c2acfbc0b92a669930a41)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-sh-msiof.c | 43 +++++++++++++++++++++----------------------
+ 1 file changed, 21 insertions(+), 22 deletions(-)
+
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
+index e5894a65c797..824f44e6bd88 100644
+--- a/drivers/spi/spi-sh-msiof.c
++++ b/drivers/spi/spi-sh-msiof.c
+@@ -616,16 +616,17 @@ static int sh_msiof_transfer_one(struct spi_master *master,
+ struct sh_msiof_spi_priv *p = spi_master_get_devdata(master);
+ void (*tx_fifo)(struct sh_msiof_spi_priv *, const void *, int, int);
+ void (*rx_fifo)(struct sh_msiof_spi_priv *, void *, int, int);
+- int bits;
+- int bytes_per_word;
+- int bytes_done;
+- int words;
++ const void *tx_buf = t->tx_buf;
++ void *rx_buf = t->rx_buf;
++ unsigned int len = t->len;
++ unsigned int bits = t->bits_per_word;
++ unsigned int bytes_per_word;
++ unsigned int words;
+ int n;
+ bool swab;
+
+- bits = t->bits_per_word;
+
+- if (bits <= 8 && t->len > 15 && !(t->len & 3)) {
++ if (bits <= 8 && len > 15 && !(len & 3)) {
+ bits = 32;
+ swab = true;
+ } else {
+@@ -639,34 +640,34 @@ static int sh_msiof_transfer_one(struct spi_master *master,
+ rx_fifo = sh_msiof_spi_read_fifo_8;
+ } else if (bits <= 16) {
+ bytes_per_word = 2;
+- if ((unsigned long)t->tx_buf & 0x01)
++ if ((unsigned long)tx_buf & 0x01)
+ tx_fifo = sh_msiof_spi_write_fifo_16u;
+ else
+ tx_fifo = sh_msiof_spi_write_fifo_16;
+
+- if ((unsigned long)t->rx_buf & 0x01)
++ if ((unsigned long)rx_buf & 0x01)
+ rx_fifo = sh_msiof_spi_read_fifo_16u;
+ else
+ rx_fifo = sh_msiof_spi_read_fifo_16;
+ } else if (swab) {
+ bytes_per_word = 4;
+- if ((unsigned long)t->tx_buf & 0x03)
++ if ((unsigned long)tx_buf & 0x03)
+ tx_fifo = sh_msiof_spi_write_fifo_s32u;
+ else
+ tx_fifo = sh_msiof_spi_write_fifo_s32;
+
+- if ((unsigned long)t->rx_buf & 0x03)
++ if ((unsigned long)rx_buf & 0x03)
+ rx_fifo = sh_msiof_spi_read_fifo_s32u;
+ else
+ rx_fifo = sh_msiof_spi_read_fifo_s32;
+ } else {
+ bytes_per_word = 4;
+- if ((unsigned long)t->tx_buf & 0x03)
++ if ((unsigned long)tx_buf & 0x03)
+ tx_fifo = sh_msiof_spi_write_fifo_32u;
+ else
+ tx_fifo = sh_msiof_spi_write_fifo_32;
+
+- if ((unsigned long)t->rx_buf & 0x03)
++ if ((unsigned long)rx_buf & 0x03)
+ rx_fifo = sh_msiof_spi_read_fifo_32u;
+ else
+ rx_fifo = sh_msiof_spi_read_fifo_32;
+@@ -676,20 +677,18 @@ static int sh_msiof_transfer_one(struct spi_master *master,
+ sh_msiof_spi_set_clk_regs(p, clk_get_rate(p->clk), t->speed_hz);
+
+ /* transfer in fifo sized chunks */
+- words = t->len / bytes_per_word;
+- bytes_done = 0;
+-
+- while (bytes_done < t->len) {
+- void *rx_buf = t->rx_buf ? t->rx_buf + bytes_done : NULL;
+- const void *tx_buf = t->tx_buf ? t->tx_buf + bytes_done : NULL;
+- n = sh_msiof_spi_txrx_once(p, tx_fifo, rx_fifo,
+- tx_buf,
+- rx_buf,
++ words = len / bytes_per_word;
++
++ while (words > 0) {
++ n = sh_msiof_spi_txrx_once(p, tx_fifo, rx_fifo, tx_buf, rx_buf,
+ words, bits);
+ if (n < 0)
+ return n;
+
+- bytes_done += n * bytes_per_word;
++ if (tx_buf)
++ tx_buf += n * bytes_per_word;
++ if (rx_buf)
++ rx_buf += n * bytes_per_word;
+ words -= n;
+ }
+
+--
+2.1.2
+
diff --git a/patches.renesas/0750-spi-sh-msiof-Add-DMA-support.patch b/patches.renesas/0750-spi-sh-msiof-Add-DMA-support.patch
new file mode 100644
index 00000000000000..7cfe8c417ba808
--- /dev/null
+++ b/patches.renesas/0750-spi-sh-msiof-Add-DMA-support.patch
@@ -0,0 +1,533 @@
+From 4aa30897cdb6fab241d7c9639ba623dee98568c2 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Mon, 30 Jun 2014 12:10:24 +0200
+Subject: spi: sh-msiof: Add DMA support
+
+Add DMA support to the MSIOF driver using platform data.
+
+As MSIOF DMA is limited to 32-bit words (requiring byte/wordswapping for
+smaller wordsizes), and the group length is limited to 256 words, DMA is
+performed on two fixed pages, allocated and mapped at driver initialization
+time.
+
+Performance figures (in Mbps) on r8a7791/koelsch at different SPI clock
+frequencies for 1024-byte and 4096-byte transfers:
+
+ 1024 bytes 4096 bytes
+ - 3.25 MHz: PIO 2.1, DMA 2.6 | PIO 2.8, DMA 3.1
+ - 6.5 MHz: PIO 3.2, DMA 4.4 | PIO 5.0, DMA 5.9
+ - 13 MHz: PIO 4.2, DMA 6.6 | PIO 8.2, DMA 10.7
+ - 26 MHz: PIO 5.9, DMA 10.4 | PIO 12.4, DMA 18.4
+
+Note that DMA is only faster than PIO for transfers that exceed the FIFO
+size (typically 64 words / 256 bytes).
+
+Also note that large transfers (larger than the group length for DMA, or
+larger than the FIFO size for PIO), should use cs-gpio (with the
+appropriate pinmux setup), as the hardware chipselect will be deasserted in
+between chunks.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit b0d0ce8b6b91a0f6f99045b6019fc4c824634fb4)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-sh-msiof.c | 348 ++++++++++++++++++++++++++++++++++++++++++-
+ include/linux/spi/sh_msiof.h | 2 +
+ 2 files changed, 343 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
+index 824f44e6bd88..9922ed3a4441 100644
+--- a/drivers/spi/spi-sh-msiof.c
++++ b/drivers/spi/spi-sh-msiof.c
+@@ -2,6 +2,7 @@
+ * SuperH MSIOF SPI Master Interface
+ *
+ * Copyright (c) 2009 Magnus Damm
++ * Copyright (C) 2014 Glider bvba
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+@@ -13,6 +14,8 @@
+ #include <linux/clk.h>
+ #include <linux/completion.h>
+ #include <linux/delay.h>
++#include <linux/dma-mapping.h>
++#include <linux/dmaengine.h>
+ #include <linux/err.h>
+ #include <linux/gpio.h>
+ #include <linux/interrupt.h>
+@@ -23,6 +26,7 @@
+ #include <linux/of_device.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_runtime.h>
++#include <linux/sh_dma.h>
+
+ #include <linux/spi/sh_msiof.h>
+ #include <linux/spi/spi.h>
+@@ -37,6 +41,7 @@ struct sh_msiof_chipdata {
+ };
+
+ struct sh_msiof_spi_priv {
++ struct spi_master *master;
+ void __iomem *mapbase;
+ struct clk *clk;
+ struct platform_device *pdev;
+@@ -45,6 +50,10 @@ struct sh_msiof_spi_priv {
+ struct completion done;
+ int tx_fifo_size;
+ int rx_fifo_size;
++ void *tx_dma_page;
++ void *rx_dma_page;
++ dma_addr_t tx_dma_addr;
++ dma_addr_t rx_dma_addr;
+ };
+
+ #define TMDR1 0x00 /* Transmit Mode Register 1 */
+@@ -84,6 +93,8 @@ struct sh_msiof_spi_priv {
+ #define MDR2_WDLEN1(i) (((i) - 1) << 16) /* Word Count (1-64/256 (SH, A1))) */
+ #define MDR2_GRPMASK1 0x00000001 /* Group Output Mask 1 (SH, A1) */
+
++#define MAX_WDLEN 256U
++
+ /* TSCR and RSCR */
+ #define SCR_BRPS_MASK 0x1f00 /* Prescaler Setting (1-32) */
+ #define SCR_BRPS(i) (((i) - 1) << 8)
+@@ -282,8 +293,6 @@ static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p,
+ * 1 0 11 11 0 0
+ * 1 1 11 11 1 1
+ */
+- sh_msiof_write(p, FCTR, 0);
+-
+ tmp = MDR1_SYNCMD_SPI | 1 << MDR1_FLD_SHIFT | MDR1_XXSTP;
+ tmp |= !cs_high << MDR1_SYNCAC_SHIFT;
+ tmp |= lsb_first << MDR1_BITLSB_SHIFT;
+@@ -319,8 +328,6 @@ static void sh_msiof_spi_set_mode_regs(struct sh_msiof_spi_priv *p,
+
+ if (rx_buf)
+ sh_msiof_write(p, RMDR2, dr2);
+-
+- sh_msiof_write(p, IER, STR_TEOF | STR_REOF);
+ }
+
+ static void sh_msiof_reset_str(struct sh_msiof_spi_priv *p)
+@@ -563,8 +570,12 @@ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p,
+ /* the fifo contents need shifting */
+ fifo_shift = 32 - bits;
+
++ /* default FIFO watermarks for PIO */
++ sh_msiof_write(p, FCTR, 0);
++
+ /* setup msiof transfer mode registers */
+ sh_msiof_spi_set_mode_regs(p, tx_buf, rx_buf, bits, words);
++ sh_msiof_write(p, IER, IER_TEOFE | IER_REOFE);
+
+ /* write tx fifo */
+ if (tx_buf)
+@@ -609,11 +620,170 @@ stop_ier:
+ return ret;
+ }
+
++static void sh_msiof_dma_complete(void *arg)
++{
++ struct sh_msiof_spi_priv *p = arg;
++
++ sh_msiof_write(p, IER, 0);
++ complete(&p->done);
++}
++
++static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
++ void *rx, unsigned int len)
++{
++ u32 ier_bits = 0;
++ struct dma_async_tx_descriptor *desc_tx = NULL, *desc_rx = NULL;
++ dma_cookie_t cookie;
++ int ret;
++
++ /* 1 stage FIFO watermarks for DMA */
++ sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1);
++
++ /* setup msiof transfer mode registers (32-bit words) */
++ sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4);
++
++ if (tx) {
++ ier_bits |= IER_TDREQE | IER_TDMAE;
++ dma_sync_single_for_device(&p->pdev->dev, p->tx_dma_addr, len,
++ DMA_TO_DEVICE);
++ desc_tx = dmaengine_prep_slave_single(p->master->dma_tx,
++ p->tx_dma_addr, len, DMA_TO_DEVICE,
++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
++ if (!desc_tx)
++ return -EIO;
++ }
++
++ if (rx) {
++ ier_bits |= IER_RDREQE | IER_RDMAE;
++ desc_rx = dmaengine_prep_slave_single(p->master->dma_rx,
++ p->rx_dma_addr, len, DMA_FROM_DEVICE,
++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
++ if (!desc_rx)
++ return -EIO;
++ }
++ sh_msiof_write(p, IER, ier_bits);
++
++ reinit_completion(&p->done);
++
++ if (rx) {
++ desc_rx->callback = sh_msiof_dma_complete;
++ desc_rx->callback_param = p;
++ cookie = dmaengine_submit(desc_rx);
++ if (dma_submit_error(cookie)) {
++ ret = cookie;
++ goto stop_ier;
++ }
++ dma_async_issue_pending(p->master->dma_rx);
++ }
++
++ if (tx) {
++ if (rx) {
++ /* No callback */
++ desc_tx->callback = NULL;
++ } else {
++ desc_tx->callback = sh_msiof_dma_complete;
++ desc_tx->callback_param = p;
++ }
++ cookie = dmaengine_submit(desc_tx);
++ if (dma_submit_error(cookie)) {
++ ret = cookie;
++ goto stop_rx;
++ }
++ dma_async_issue_pending(p->master->dma_tx);
++ }
++
++ ret = sh_msiof_spi_start(p, rx);
++ if (ret) {
++ dev_err(&p->pdev->dev, "failed to start hardware\n");
++ goto stop_tx;
++ }
++
++ /* wait for tx fifo to be emptied / rx fifo to be filled */
++ ret = wait_for_completion_timeout(&p->done, HZ);
++ if (!ret) {
++ dev_err(&p->pdev->dev, "DMA timeout\n");
++ ret = -ETIMEDOUT;
++ goto stop_reset;
++ }
++
++ /* clear status bits */
++ sh_msiof_reset_str(p);
++
++ ret = sh_msiof_spi_stop(p, rx);
++ if (ret) {
++ dev_err(&p->pdev->dev, "failed to shut down hardware\n");
++ return ret;
++ }
++
++ if (rx)
++ dma_sync_single_for_cpu(&p->pdev->dev, p->rx_dma_addr, len,
++ DMA_FROM_DEVICE);
++
++ return 0;
++
++stop_reset:
++ sh_msiof_reset_str(p);
++ sh_msiof_spi_stop(p, rx);
++stop_tx:
++ if (tx)
++ dmaengine_terminate_all(p->master->dma_tx);
++stop_rx:
++ if (rx)
++ dmaengine_terminate_all(p->master->dma_rx);
++stop_ier:
++ sh_msiof_write(p, IER, 0);
++ return ret;
++}
++
++static void copy_bswap32(u32 *dst, const u32 *src, unsigned int words)
++{
++ /* src or dst can be unaligned, but not both */
++ if ((unsigned long)src & 3) {
++ while (words--) {
++ *dst++ = swab32(get_unaligned(src));
++ src++;
++ }
++ } else if ((unsigned long)dst & 3) {
++ while (words--) {
++ put_unaligned(swab32(*src++), dst);
++ dst++;
++ }
++ } else {
++ while (words--)
++ *dst++ = swab32(*src++);
++ }
++}
++
++static void copy_wswap32(u32 *dst, const u32 *src, unsigned int words)
++{
++ /* src or dst can be unaligned, but not both */
++ if ((unsigned long)src & 3) {
++ while (words--) {
++ *dst++ = swahw32(get_unaligned(src));
++ src++;
++ }
++ } else if ((unsigned long)dst & 3) {
++ while (words--) {
++ put_unaligned(swahw32(*src++), dst);
++ dst++;
++ }
++ } else {
++ while (words--)
++ *dst++ = swahw32(*src++);
++ }
++}
++
++static void copy_plain32(u32 *dst, const u32 *src, unsigned int words)
++{
++ memcpy(dst, src, words * 4);
++}
++
+ static int sh_msiof_transfer_one(struct spi_master *master,
+ struct spi_device *spi,
+ struct spi_transfer *t)
+ {
+ struct sh_msiof_spi_priv *p = spi_master_get_devdata(master);
++ void (*copy32)(u32 *, const u32 *, unsigned int);
+ void (*tx_fifo)(struct sh_msiof_spi_priv *, const void *, int, int);
+ void (*rx_fifo)(struct sh_msiof_spi_priv *, void *, int, int);
+ const void *tx_buf = t->tx_buf;
+@@ -624,7 +794,48 @@ static int sh_msiof_transfer_one(struct spi_master *master,
+ unsigned int words;
+ int n;
+ bool swab;
++ int ret;
++
++ /* setup clocks (clock already enabled in chipselect()) */
++ sh_msiof_spi_set_clk_regs(p, clk_get_rate(p->clk), t->speed_hz);
++
++ while (master->dma_tx && len > 15) {
++ /*
++ * DMA supports 32-bit words only, hence pack 8-bit and 16-bit
++ * words, with byte resp. word swapping.
++ */
++ unsigned int l = min(len, MAX_WDLEN * 4);
++
++ if (bits <= 8) {
++ if (l & 3)
++ break;
++ copy32 = copy_bswap32;
++ } else if (bits <= 16) {
++ if (l & 1)
++ break;
++ copy32 = copy_wswap32;
++ } else {
++ copy32 = copy_plain32;
++ }
++
++ if (tx_buf)
++ copy32(p->tx_dma_page, tx_buf, l / 4);
+
++ ret = sh_msiof_dma_once(p, tx_buf, rx_buf, l);
++ if (ret)
++ return ret;
++
++ if (rx_buf) {
++ copy32(rx_buf, p->rx_dma_page, l / 4);
++ rx_buf += l;
++ }
++ if (tx_buf)
++ tx_buf += l;
++
++ len -= l;
++ if (!len)
++ return 0;
++ }
+
+ if (bits <= 8 && len > 15 && !(len & 3)) {
+ bits = 32;
+@@ -673,9 +884,6 @@ static int sh_msiof_transfer_one(struct spi_master *master,
+ rx_fifo = sh_msiof_spi_read_fifo_32;
+ }
+
+- /* setup clocks (clock already enabled in chipselect()) */
+- sh_msiof_spi_set_clk_regs(p, clk_get_rate(p->clk), t->speed_hz);
+-
+ /* transfer in fifo sized chunks */
+ words = len / bytes_per_word;
+
+@@ -745,6 +953,123 @@ static struct sh_msiof_spi_info *sh_msiof_spi_parse_dt(struct device *dev)
+ }
+ #endif
+
++static struct dma_chan *sh_msiof_request_dma_chan(struct device *dev,
++ enum dma_transfer_direction dir, unsigned int id, dma_addr_t port_addr)
++{
++ dma_cap_mask_t mask;
++ struct dma_chan *chan;
++ struct dma_slave_config cfg;
++ int ret;
++
++ dma_cap_zero(mask);
++ dma_cap_set(DMA_SLAVE, mask);
++
++ chan = dma_request_channel(mask, shdma_chan_filter,
++ (void *)(unsigned long)id);
++ if (!chan) {
++ dev_warn(dev, "dma_request_channel failed\n");
++ return NULL;
++ }
++
++ memset(&cfg, 0, sizeof(cfg));
++ cfg.slave_id = id;
++ cfg.direction = dir;
++ if (dir == DMA_MEM_TO_DEV)
++ cfg.dst_addr = port_addr;
++ else
++ cfg.src_addr = port_addr;
++
++ ret = dmaengine_slave_config(chan, &cfg);
++ if (ret) {
++ dev_warn(dev, "dmaengine_slave_config failed %d\n", ret);
++ dma_release_channel(chan);
++ return NULL;
++ }
++
++ return chan;
++}
++
++static int sh_msiof_request_dma(struct sh_msiof_spi_priv *p)
++{
++ struct platform_device *pdev = p->pdev;
++ struct device *dev = &pdev->dev;
++ const struct sh_msiof_spi_info *info = dev_get_platdata(dev);
++ const struct resource *res;
++ struct spi_master *master;
++
++ if (!info || !info->dma_tx_id || !info->dma_rx_id)
++ return 0; /* The driver assumes no error */
++
++ /* The DMA engine uses the second register set, if present */
++ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
++ if (!res)
++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++
++ master = p->master;
++ master->dma_tx = sh_msiof_request_dma_chan(dev, DMA_MEM_TO_DEV,
++ info->dma_tx_id,
++ res->start + TFDR);
++ if (!master->dma_tx)
++ return -ENODEV;
++
++ master->dma_rx = sh_msiof_request_dma_chan(dev, DMA_DEV_TO_MEM,
++ info->dma_rx_id,
++ res->start + RFDR);
++ if (!master->dma_rx)
++ goto free_tx_chan;
++
++ p->tx_dma_page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
++ if (!p->tx_dma_page)
++ goto free_rx_chan;
++
++ p->rx_dma_page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
++ if (!p->rx_dma_page)
++ goto free_tx_page;
++
++ p->tx_dma_addr = dma_map_single(dev, p->tx_dma_page, PAGE_SIZE,
++ DMA_TO_DEVICE);
++ if (dma_mapping_error(dev, p->tx_dma_addr))
++ goto free_rx_page;
++
++ p->rx_dma_addr = dma_map_single(dev, p->rx_dma_page, PAGE_SIZE,
++ DMA_FROM_DEVICE);
++ if (dma_mapping_error(dev, p->rx_dma_addr))
++ goto unmap_tx_page;
++
++ dev_info(dev, "DMA available");
++ return 0;
++
++unmap_tx_page:
++ dma_unmap_single(dev, p->tx_dma_addr, PAGE_SIZE, DMA_TO_DEVICE);
++free_rx_page:
++ free_page((unsigned long)p->rx_dma_page);
++free_tx_page:
++ free_page((unsigned long)p->tx_dma_page);
++free_rx_chan:
++ dma_release_channel(master->dma_rx);
++free_tx_chan:
++ dma_release_channel(master->dma_tx);
++ master->dma_tx = NULL;
++ return -ENODEV;
++}
++
++static void sh_msiof_release_dma(struct sh_msiof_spi_priv *p)
++{
++ struct spi_master *master = p->master;
++ struct device *dev;
++
++ if (!master->dma_tx)
++ return;
++
++ dev = &p->pdev->dev;
++ dma_unmap_single(dev, p->rx_dma_addr, PAGE_SIZE, DMA_FROM_DEVICE);
++ dma_unmap_single(dev, p->tx_dma_addr, PAGE_SIZE, DMA_TO_DEVICE);
++ free_page((unsigned long)p->rx_dma_page);
++ free_page((unsigned long)p->tx_dma_page);
++ dma_release_channel(master->dma_rx);
++ dma_release_channel(master->dma_tx);
++}
++
+ static int sh_msiof_spi_probe(struct platform_device *pdev)
+ {
+ struct resource *r;
+@@ -763,6 +1088,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
+ p = spi_master_get_devdata(master);
+
+ platform_set_drvdata(pdev, p);
++ p->master = master;
+
+ of_id = of_match_device(sh_msiof_match, &pdev->dev);
+ if (of_id) {
+@@ -833,6 +1159,10 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
+ master->auto_runtime_pm = true;
+ master->transfer_one = sh_msiof_transfer_one;
+
++ ret = sh_msiof_request_dma(p);
++ if (ret < 0)
++ dev_warn(&pdev->dev, "DMA not available, using PIO\n");
++
+ ret = devm_spi_register_master(&pdev->dev, master);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "spi_register_master error.\n");
+@@ -842,6 +1172,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
+ return 0;
+
+ err2:
++ sh_msiof_release_dma(p);
+ pm_runtime_disable(&pdev->dev);
+ err1:
+ spi_master_put(master);
+@@ -850,6 +1181,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
+
+ static int sh_msiof_spi_remove(struct platform_device *pdev)
+ {
++ struct sh_msiof_spi_priv *p = platform_get_drvdata(pdev);
++
++ sh_msiof_release_dma(p);
+ pm_runtime_disable(&pdev->dev);
+ return 0;
+ }
+diff --git a/include/linux/spi/sh_msiof.h b/include/linux/spi/sh_msiof.h
+index 2e8db3d2d2e5..88a14d81c49e 100644
+--- a/include/linux/spi/sh_msiof.h
++++ b/include/linux/spi/sh_msiof.h
+@@ -5,6 +5,8 @@ struct sh_msiof_spi_info {
+ int tx_fifo_override;
+ int rx_fifo_override;
+ u16 num_chipselect;
++ unsigned int dma_tx_id;
++ unsigned int dma_rx_id;
+ };
+
+ #endif /* __SPI_SH_MSIOF_H__ */
+--
+2.1.2
+
diff --git a/patches.renesas/0751-spi-sh-msiof-Handle-dmaengine_prep_slave_single-fail.patch b/patches.renesas/0751-spi-sh-msiof-Handle-dmaengine_prep_slave_single-fail.patch
new file mode 100644
index 00000000000000..5ccde6ad05e5cc
--- /dev/null
+++ b/patches.renesas/0751-spi-sh-msiof-Handle-dmaengine_prep_slave_single-fail.patch
@@ -0,0 +1,83 @@
+From aeeaa360e45f79dae3fae23a24b9ea3d3b4d7aa7 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 9 Jul 2014 12:26:23 +0200
+Subject: spi: sh-msiof: Handle dmaengine_prep_slave_single() failures
+ gracefully
+
+As typically a shmobile SoC has less DMA channels than devices that can use
+DMA, we may want to prioritize access to the DMA channels in the future.
+This means that dmaengine_prep_slave_single() may start failing
+arbitrarily.
+
+Handle dmaengine_prep_slave_single() failures gracefully by falling back to
+PIO. This requires moving DMA-specific configuration of the MSIOF device
+after the call(s) to dmaengine_prep_slave_single().
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 279d2378c9c4f05bbe41b55625b4003871026266)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-sh-msiof.c | 23 +++++++++++++++--------
+ 1 file changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
+index 9922ed3a4441..373de70baf08 100644
+--- a/drivers/spi/spi-sh-msiof.c
++++ b/drivers/spi/spi-sh-msiof.c
+@@ -636,12 +636,6 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
+ dma_cookie_t cookie;
+ int ret;
+
+- /* 1 stage FIFO watermarks for DMA */
+- sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1);
+-
+- /* setup msiof transfer mode registers (32-bit words) */
+- sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4);
+-
+ if (tx) {
+ ier_bits |= IER_TDREQE | IER_TDMAE;
+ dma_sync_single_for_device(&p->pdev->dev, p->tx_dma_addr, len,
+@@ -650,7 +644,7 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
+ p->tx_dma_addr, len, DMA_TO_DEVICE,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+ if (!desc_tx)
+- return -EIO;
++ return -EAGAIN;
+ }
+
+ if (rx) {
+@@ -659,8 +653,15 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
+ p->rx_dma_addr, len, DMA_FROM_DEVICE,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+ if (!desc_rx)
+- return -EIO;
++ return -EAGAIN;
+ }
++
++ /* 1 stage FIFO watermarks for DMA */
++ sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1);
++
++ /* setup msiof transfer mode registers (32-bit words) */
++ sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4);
++
+ sh_msiof_write(p, IER, ier_bits);
+
+ reinit_completion(&p->done);
+@@ -822,6 +823,12 @@ static int sh_msiof_transfer_one(struct spi_master *master,
+ copy32(p->tx_dma_page, tx_buf, l / 4);
+
+ ret = sh_msiof_dma_once(p, tx_buf, rx_buf, l);
++ if (ret == -EAGAIN) {
++ pr_warn_once("%s %s: DMA not available, falling back to PIO\n",
++ dev_driver_string(&p->pdev->dev),
++ dev_name(&p->pdev->dev));
++ break;
++ }
+ if (ret)
+ return ret;
+
+--
+2.1.2
+
diff --git a/patches.renesas/0752-spi-sh-msiof-Use-correct-device-for-DMA-mapping-with.patch b/patches.renesas/0752-spi-sh-msiof-Use-correct-device-for-DMA-mapping-with.patch
new file mode 100644
index 00000000000000..57b24b847cabb9
--- /dev/null
+++ b/patches.renesas/0752-spi-sh-msiof-Use-correct-device-for-DMA-mapping-with.patch
@@ -0,0 +1,95 @@
+From b1f44af2ea1ec518755b47779bf3bec50e75ff1e Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 11 Jul 2014 17:56:22 +0200
+Subject: spi: sh-msiof: Use correct device for DMA mapping with IOMMU
+
+To function correctly in the presence of an IOMMU, the DMA buffers must be
+mapped using the DMA channel's device instead of the MSIOF platform
+device's device.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 5dabcf2f27ded864cf79204c4a3cca1516b66026)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-sh-msiof.c | 26 ++++++++++++++++----------
+ 1 file changed, 16 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
+index 373de70baf08..2a4354dcd661 100644
+--- a/drivers/spi/spi-sh-msiof.c
++++ b/drivers/spi/spi-sh-msiof.c
+@@ -638,8 +638,8 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
+
+ if (tx) {
+ ier_bits |= IER_TDREQE | IER_TDMAE;
+- dma_sync_single_for_device(&p->pdev->dev, p->tx_dma_addr, len,
+- DMA_TO_DEVICE);
++ dma_sync_single_for_device(p->master->dma_tx->device->dev,
++ p->tx_dma_addr, len, DMA_TO_DEVICE);
+ desc_tx = dmaengine_prep_slave_single(p->master->dma_tx,
+ p->tx_dma_addr, len, DMA_TO_DEVICE,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+@@ -717,7 +717,8 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
+ }
+
+ if (rx)
+- dma_sync_single_for_cpu(&p->pdev->dev, p->rx_dma_addr, len,
++ dma_sync_single_for_cpu(p->master->dma_rx->device->dev,
++ p->rx_dma_addr, len,
+ DMA_FROM_DEVICE);
+
+ return 0;
+@@ -1003,6 +1004,7 @@ static int sh_msiof_request_dma(struct sh_msiof_spi_priv *p)
+ const struct sh_msiof_spi_info *info = dev_get_platdata(dev);
+ const struct resource *res;
+ struct spi_master *master;
++ struct device *tx_dev, *rx_dev;
+
+ if (!info || !info->dma_tx_id || !info->dma_rx_id)
+ return 0; /* The driver assumes no error */
+@@ -1033,21 +1035,23 @@ static int sh_msiof_request_dma(struct sh_msiof_spi_priv *p)
+ if (!p->rx_dma_page)
+ goto free_tx_page;
+
+- p->tx_dma_addr = dma_map_single(dev, p->tx_dma_page, PAGE_SIZE,
++ tx_dev = master->dma_tx->device->dev;
++ p->tx_dma_addr = dma_map_single(tx_dev, p->tx_dma_page, PAGE_SIZE,
+ DMA_TO_DEVICE);
+- if (dma_mapping_error(dev, p->tx_dma_addr))
++ if (dma_mapping_error(tx_dev, p->tx_dma_addr))
+ goto free_rx_page;
+
+- p->rx_dma_addr = dma_map_single(dev, p->rx_dma_page, PAGE_SIZE,
++ rx_dev = master->dma_rx->device->dev;
++ p->rx_dma_addr = dma_map_single(rx_dev, p->rx_dma_page, PAGE_SIZE,
+ DMA_FROM_DEVICE);
+- if (dma_mapping_error(dev, p->rx_dma_addr))
++ if (dma_mapping_error(rx_dev, p->rx_dma_addr))
+ goto unmap_tx_page;
+
+ dev_info(dev, "DMA available");
+ return 0;
+
+ unmap_tx_page:
+- dma_unmap_single(dev, p->tx_dma_addr, PAGE_SIZE, DMA_TO_DEVICE);
++ dma_unmap_single(tx_dev, p->tx_dma_addr, PAGE_SIZE, DMA_TO_DEVICE);
+ free_rx_page:
+ free_page((unsigned long)p->rx_dma_page);
+ free_tx_page:
+@@ -1069,8 +1073,10 @@ static void sh_msiof_release_dma(struct sh_msiof_spi_priv *p)
+ return;
+
+ dev = &p->pdev->dev;
+- dma_unmap_single(dev, p->rx_dma_addr, PAGE_SIZE, DMA_FROM_DEVICE);
+- dma_unmap_single(dev, p->tx_dma_addr, PAGE_SIZE, DMA_TO_DEVICE);
++ dma_unmap_single(master->dma_rx->device->dev, p->rx_dma_addr,
++ PAGE_SIZE, DMA_FROM_DEVICE);
++ dma_unmap_single(master->dma_tx->device->dev, p->tx_dma_addr,
++ PAGE_SIZE, DMA_TO_DEVICE);
+ free_page((unsigned long)p->rx_dma_page);
+ free_page((unsigned long)p->tx_dma_page);
+ dma_release_channel(master->dma_rx);
+--
+2.1.2
+
diff --git a/patches.renesas/0753-spi-sh-msiof-Fix-leaking-of-unused-DMA-descriptors.patch b/patches.renesas/0753-spi-sh-msiof-Fix-leaking-of-unused-DMA-descriptors.patch
new file mode 100644
index 00000000000000..13418fd0ea8504
--- /dev/null
+++ b/patches.renesas/0753-spi-sh-msiof-Fix-leaking-of-unused-DMA-descriptors.patch
@@ -0,0 +1,150 @@
+From 140f76322323532c845ce383a60918cf1808e05a Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 6 Aug 2014 14:59:03 +0200
+Subject: spi: sh-msiof: Fix leaking of unused DMA descriptors
+
+If dmaengine_prep_slave_sg() or dmaengine_submit() fail, we may leak
+unused DMA descriptors.
+
+As per Documentation/dmaengine.txt, once a DMA descriptor has been
+obtained, it must be submitted. Hence:
+ - First prepare and submit all DMA descriptors,
+ - Prepare the SPI controller for DMA,
+ - Start DMA by calling dma_async_issue_pending(),
+ - Make sure to call dmaengine_terminate_all() on all descriptors that
+ haven't completed.
+
+Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 3e81b59208fa4697c6c3b6eefb92892b47f8b1e7)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-sh-msiof.c | 71 +++++++++++++++++++++++++---------------------
+ 1 file changed, 38 insertions(+), 33 deletions(-)
+
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
+index 2a4354dcd661..887c2084130f 100644
+--- a/drivers/spi/spi-sh-msiof.c
++++ b/drivers/spi/spi-sh-msiof.c
+@@ -636,48 +636,38 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
+ dma_cookie_t cookie;
+ int ret;
+
+- if (tx) {
+- ier_bits |= IER_TDREQE | IER_TDMAE;
+- dma_sync_single_for_device(p->master->dma_tx->device->dev,
+- p->tx_dma_addr, len, DMA_TO_DEVICE);
+- desc_tx = dmaengine_prep_slave_single(p->master->dma_tx,
+- p->tx_dma_addr, len, DMA_TO_DEVICE,
+- DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+- if (!desc_tx)
+- return -EAGAIN;
+- }
+-
++ /* First prepare and submit the DMA request(s), as this may fail */
+ if (rx) {
+ ier_bits |= IER_RDREQE | IER_RDMAE;
+ desc_rx = dmaengine_prep_slave_single(p->master->dma_rx,
+ p->rx_dma_addr, len, DMA_FROM_DEVICE,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+- if (!desc_rx)
+- return -EAGAIN;
+- }
+-
+- /* 1 stage FIFO watermarks for DMA */
+- sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1);
+-
+- /* setup msiof transfer mode registers (32-bit words) */
+- sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4);
+-
+- sh_msiof_write(p, IER, ier_bits);
+-
+- reinit_completion(&p->done);
++ if (!desc_rx) {
++ ret = -EAGAIN;
++ goto no_dma_rx;
++ }
+
+- if (rx) {
+ desc_rx->callback = sh_msiof_dma_complete;
+ desc_rx->callback_param = p;
+ cookie = dmaengine_submit(desc_rx);
+ if (dma_submit_error(cookie)) {
+ ret = cookie;
+- goto stop_ier;
++ goto no_dma_rx;
+ }
+- dma_async_issue_pending(p->master->dma_rx);
+ }
+
+ if (tx) {
++ ier_bits |= IER_TDREQE | IER_TDMAE;
++ dma_sync_single_for_device(p->master->dma_tx->device->dev,
++ p->tx_dma_addr, len, DMA_TO_DEVICE);
++ desc_tx = dmaengine_prep_slave_single(p->master->dma_tx,
++ p->tx_dma_addr, len, DMA_TO_DEVICE,
++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
++ if (!desc_tx) {
++ ret = -EAGAIN;
++ goto no_dma_tx;
++ }
++
+ if (rx) {
+ /* No callback */
+ desc_tx->callback = NULL;
+@@ -688,15 +678,30 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
+ cookie = dmaengine_submit(desc_tx);
+ if (dma_submit_error(cookie)) {
+ ret = cookie;
+- goto stop_rx;
++ goto no_dma_tx;
+ }
+- dma_async_issue_pending(p->master->dma_tx);
+ }
+
++ /* 1 stage FIFO watermarks for DMA */
++ sh_msiof_write(p, FCTR, FCTR_TFWM_1 | FCTR_RFWM_1);
++
++ /* setup msiof transfer mode registers (32-bit words) */
++ sh_msiof_spi_set_mode_regs(p, tx, rx, 32, len / 4);
++
++ sh_msiof_write(p, IER, ier_bits);
++
++ reinit_completion(&p->done);
++
++ /* Now start DMA */
++ if (tx)
++ dma_async_issue_pending(p->master->dma_rx);
++ if (rx)
++ dma_async_issue_pending(p->master->dma_tx);
++
+ ret = sh_msiof_spi_start(p, rx);
+ if (ret) {
+ dev_err(&p->pdev->dev, "failed to start hardware\n");
+- goto stop_tx;
++ goto stop_dma;
+ }
+
+ /* wait for tx fifo to be emptied / rx fifo to be filled */
+@@ -726,14 +731,14 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
+ stop_reset:
+ sh_msiof_reset_str(p);
+ sh_msiof_spi_stop(p, rx);
+-stop_tx:
++stop_dma:
+ if (tx)
+ dmaengine_terminate_all(p->master->dma_tx);
+-stop_rx:
++no_dma_tx:
+ if (rx)
+ dmaengine_terminate_all(p->master->dma_rx);
+-stop_ier:
+ sh_msiof_write(p, IER, 0);
++no_dma_rx:
+ return ret;
+ }
+
+--
+2.1.2
+
diff --git a/patches.renesas/0754-spi-sh-msiof-Fix-transmit-only-DMA-transfers.patch b/patches.renesas/0754-spi-sh-msiof-Fix-transmit-only-DMA-transfers.patch
new file mode 100644
index 00000000000000..f9f5d090270e5c
--- /dev/null
+++ b/patches.renesas/0754-spi-sh-msiof-Fix-transmit-only-DMA-transfers.patch
@@ -0,0 +1,39 @@
+From 33fdf90712aaa97c3f4c8da9b4363da8ef64d4a7 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Thu, 7 Aug 2014 14:07:43 +0200
+Subject: spi: sh-msiof: Fix transmit-only DMA transfers
+
+Fix tx/rx mixup, which broke transmit-only transfers.
+
+Introduced by commit 4240305f7cbdc7782aa8bc40cc702775d9ac0839
+("spi: sh-msiof: Fix leaking of unused DMA descriptors").
+
+Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit cdcd565fa0925edf9b80c875fcc84a231c75bd1d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-sh-msiof.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
+index 887c2084130f..543075b80f16 100644
+--- a/drivers/spi/spi-sh-msiof.c
++++ b/drivers/spi/spi-sh-msiof.c
+@@ -693,9 +693,9 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
+ reinit_completion(&p->done);
+
+ /* Now start DMA */
+- if (tx)
+- dma_async_issue_pending(p->master->dma_rx);
+ if (rx)
++ dma_async_issue_pending(p->master->dma_rx);
++ if (tx)
+ dma_async_issue_pending(p->master->dma_tx);
+
+ ret = sh_msiof_spi_start(p, rx);
+--
+2.1.2
+
diff --git a/patches.renesas/0755-mmc-tmio-Configure-DMA-slave-bus-width.patch b/patches.renesas/0755-mmc-tmio-Configure-DMA-slave-bus-width.patch
new file mode 100644
index 00000000000000..0ec4780ce155b9
--- /dev/null
+++ b/patches.renesas/0755-mmc-tmio-Configure-DMA-slave-bus-width.patch
@@ -0,0 +1,40 @@
+From d7006a1ea766a4189721fc58a843d0c56dd136b9 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 16 Jul 2014 00:45:14 +0200
+Subject: mmc: tmio: Configure DMA slave bus width
+
+Even though some implementations support 4-bytes data register access,
+the tmio driver never configures the hardware in such a way and always
+performs 2-bytes accesses. Hardcode the DMA transfer size to 2 bytes.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit 39ab196243e8732ad68928be97129305b29afbbd)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/mmc/host/tmio_mmc_dma.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
+index 03e7b280cb4c..eb8f1d5c34b1 100644
+--- a/drivers/mmc/host/tmio_mmc_dma.c
++++ b/drivers/mmc/host/tmio_mmc_dma.c
+@@ -294,6 +294,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
+ cfg.slave_id = pdata->dma->slave_id_tx;
+ cfg.direction = DMA_MEM_TO_DEV;
+ cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->pdata->bus_shift);
++ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ cfg.src_addr = 0;
+ ret = dmaengine_slave_config(host->chan_tx, &cfg);
+ if (ret < 0)
+@@ -312,6 +313,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
+ cfg.slave_id = pdata->dma->slave_id_rx;
+ cfg.direction = DMA_DEV_TO_MEM;
+ cfg.src_addr = cfg.dst_addr;
++ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ cfg.dst_addr = 0;
+ ret = dmaengine_slave_config(host->chan_rx, &cfg);
+ if (ret < 0)
+--
+2.1.2
+
diff --git a/patches.renesas/0756-mmc-sh_mmcif-Fix-DMA-slave-address-configuration.patch b/patches.renesas/0756-mmc-sh_mmcif-Fix-DMA-slave-address-configuration.patch
new file mode 100644
index 00000000000000..bdcdda1a50f37f
--- /dev/null
+++ b/patches.renesas/0756-mmc-sh_mmcif-Fix-DMA-slave-address-configuration.patch
@@ -0,0 +1,49 @@
+From 382eec9e2a05a2b00c8845e258bb553ddcac80d9 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 16 Jul 2014 00:45:12 +0200
+Subject: mmc: sh_mmcif: Fix DMA slave address configuration
+
+Commit e5a233cb647d749de2f188477c9a54b94d90477f ("mmc: sh_mmcif:
+Factorize DMA channel request and configuration code") incorrectly
+set the destination address for both slave channels instead of setting
+the source address for the receive channel. Fix that.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit d25006e7e5045e76575e9f58903efc1a860a3ff1)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/mmc/host/sh_mmcif.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
+index 0289b4ecccb3..863d21ee4a2f 100644
+--- a/drivers/mmc/host/sh_mmcif.c
++++ b/drivers/mmc/host/sh_mmcif.c
+@@ -386,7 +386,7 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host,
+ struct sh_mmcif_plat_data *pdata,
+ enum dma_transfer_direction direction)
+ {
+- struct dma_slave_config cfg;
++ struct dma_slave_config cfg = { 0, };
+ struct dma_chan *chan;
+ unsigned int slave_id;
+ struct resource *res;
+@@ -417,8 +417,12 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host,
+ /* In the OF case the driver will get the slave ID from the DT */
+ cfg.slave_id = slave_id;
+ cfg.direction = direction;
+- cfg.dst_addr = res->start + MMCIF_CE_DATA;
+- cfg.src_addr = 0;
++
++ if (direction == DMA_DEV_TO_MEM)
++ cfg.src_addr = res->start + MMCIF_CE_DATA;
++ else
++ cfg.dst_addr = res->start + MMCIF_CE_DATA;
++
+ ret = dmaengine_slave_config(chan, &cfg);
+ if (ret < 0) {
+ dma_release_channel(chan);
+--
+2.1.2
+
diff --git a/patches.renesas/0757-mmc-sh_mmcif-Configure-DMA-slave-bus-width.patch b/patches.renesas/0757-mmc-sh_mmcif-Configure-DMA-slave-bus-width.patch
new file mode 100644
index 00000000000000..06d36968e821c0
--- /dev/null
+++ b/patches.renesas/0757-mmc-sh_mmcif-Configure-DMA-slave-bus-width.patch
@@ -0,0 +1,39 @@
+From d7f83c97441a1475d7f9ea42e347b74cc888e857 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 16 Jul 2014 00:45:13 +0200
+Subject: mmc: sh_mmcif: Configure DMA slave bus width
+
+The data register is 4 bytes wide, hardcode the DMA transfer size to
+4 bytes in both directions.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+(cherry picked from commit e36152aa84cf68bd7f09acffd480cd2b6aa5480d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/mmc/host/sh_mmcif.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
+index 863d21ee4a2f..d11708c815d7 100644
+--- a/drivers/mmc/host/sh_mmcif.c
++++ b/drivers/mmc/host/sh_mmcif.c
+@@ -418,10 +418,13 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host,
+ cfg.slave_id = slave_id;
+ cfg.direction = direction;
+
+- if (direction == DMA_DEV_TO_MEM)
++ if (direction == DMA_DEV_TO_MEM) {
+ cfg.src_addr = res->start + MMCIF_CE_DATA;
+- else
++ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
++ } else {
+ cfg.dst_addr = res->start + MMCIF_CE_DATA;
++ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
++ }
+
+ ret = dmaengine_slave_config(chan, &cfg);
+ if (ret < 0) {
+--
+2.1.2
+
diff --git a/patches.renesas/0758-net-sh_eth-Add-r8a7794-support.patch b/patches.renesas/0758-net-sh_eth-Add-r8a7794-support.patch
new file mode 100644
index 00000000000000..b346e55add8db6
--- /dev/null
+++ b/patches.renesas/0758-net-sh_eth-Add-r8a7794-support.patch
@@ -0,0 +1,52 @@
+From b6847f4fc981b68b3ab2d39f5b5a8b4146ce2dfe Mon Sep 17 00:00:00 2001
+From: Hisashi Nakamura <hisashi.nakamura.ak@renesas.com>
+Date: Fri, 1 Aug 2014 17:03:00 +0200
+Subject: net: sh_eth: Add r8a7794 support
+
+Signed-off-by: Hisashi Nakamura <hisashi.nakamura.ak@renesas.com>
+[uli: added bindings documentation]
+Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+
+(cherry picked from commit 0f76b9d83b2b010b63a094024b3cfd82e20af28d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ Documentation/devicetree/bindings/net/sh_eth.txt | 1 +
+ drivers/net/ethernet/renesas/sh_eth.c | 2 ++
+ 2 files changed, 3 insertions(+)
+
+diff --git a/Documentation/devicetree/bindings/net/sh_eth.txt b/Documentation/devicetree/bindings/net/sh_eth.txt
+index e7106b50dbdc..34d4db1a4e25 100644
+--- a/Documentation/devicetree/bindings/net/sh_eth.txt
++++ b/Documentation/devicetree/bindings/net/sh_eth.txt
+@@ -9,6 +9,7 @@ Required properties:
+ "renesas,ether-r8a7779" if the device is a part of R8A7779 SoC.
+ "renesas,ether-r8a7790" if the device is a part of R8A7790 SoC.
+ "renesas,ether-r8a7791" if the device is a part of R8A7791 SoC.
++ "renesas,ether-r8a7794" if the device is a part of R8A7794 SoC.
+ "renesas,ether-r7s72100" if the device is a part of R7S72100 SoC.
+ - reg: offset and length of (1) the E-DMAC/feLic register block (required),
+ (2) the TSU register block (optional).
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 26936b91f63f..177d263a1dc4 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -2746,6 +2746,7 @@ static const struct of_device_id sh_eth_match_table[] = {
+ { .compatible = "renesas,ether-r8a7779", .data = &r8a777x_data },
+ { .compatible = "renesas,ether-r8a7790", .data = &r8a779x_data },
+ { .compatible = "renesas,ether-r8a7791", .data = &r8a779x_data },
++ { .compatible = "renesas,ether-r8a7794", .data = &r8a779x_data },
+ { .compatible = "renesas,ether-r7s72100", .data = &r7s72100_data },
+ { }
+ };
+@@ -2972,6 +2973,7 @@ static struct platform_device_id sh_eth_id_table[] = {
+ { "r8a777x-ether", (kernel_ulong_t)&r8a777x_data },
+ { "r8a7790-ether", (kernel_ulong_t)&r8a779x_data },
+ { "r8a7791-ether", (kernel_ulong_t)&r8a779x_data },
++ { "r8a7794-ether", (kernel_ulong_t)&r8a779x_data },
+ { }
+ };
+ MODULE_DEVICE_TABLE(platform, sh_eth_id_table);
+--
+2.1.2
+
diff --git a/patches.renesas/0759-sh-intc-Confine-SH_INTC-to-platforms-that-need-it.patch b/patches.renesas/0759-sh-intc-Confine-SH_INTC-to-platforms-that-need-it.patch
new file mode 100644
index 00000000000000..ea810ad6932077
--- /dev/null
+++ b/patches.renesas/0759-sh-intc-Confine-SH_INTC-to-platforms-that-need-it.patch
@@ -0,0 +1,116 @@
+From 77b0acecda2f53a09306d0bb546f4400b1dd4d08 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 20 Aug 2014 15:39:22 +0200
+Subject: sh: intc: Confine SH_INTC to platforms that need it
+
+Currently the sh-intc driver is compiled on all SuperH and
+non-multiplatform SH-Mobile platforms, while it's only used on a limited
+number of platforms:
+ - SuperH: SH2(A), SH3(A), SH4(A)(L) (all but SH5)
+ - ARM: sh7372, sh73a0
+
+Drop the "default y" on SH_INTC, make all CPU platforms that use it
+select it, and protect all sub-options by "if SH_INTC" to fix this.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 049d28048be595e0a10a58fe1c104b153c386633)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+Conflicts:
+ arch/arm/mach-shmobile/Kconfig
+ arch/sh/Kconfig
+---
+ arch/arm/mach-shmobile/Kconfig | 2 ++
+ arch/sh/Kconfig | 3 +++
+ drivers/sh/Makefile | 3 +--
+ drivers/sh/intc/Kconfig | 6 +++++-
+ 4 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index 54c9210461c7..0548968e21a8 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -64,6 +64,7 @@ config ARCH_SH7372
+ select ARM_CPU_SUSPEND if PM || CPU_IDLE
+ select CPU_V7
+ select SH_CLK_CPG
++ select SH_INTC
+ select SYS_SUPPORTS_SH_CMT
+ select SYS_SUPPORTS_SH_TMU
+
+@@ -74,6 +75,7 @@ config ARCH_SH73A0
+ select CPU_V7
+ select I2C
+ select SH_CLK_CPG
++ select SH_INTC
+ select RENESAS_INTC_IRQPIN
+ select SYS_SUPPORTS_SH_CMT
+ select SYS_SUPPORTS_SH_TMU
+diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
+index b2cdb203e843..8356f395a10a 100644
+--- a/arch/sh/Kconfig
++++ b/arch/sh/Kconfig
+@@ -181,6 +181,7 @@ menu "System type"
+ #
+ config CPU_SH2
+ bool
++ select SH_INTC
+
+ config CPU_SH2A
+ bool
+@@ -191,6 +192,7 @@ config CPU_SH3
+ bool
+ select CPU_HAS_INTEVT
+ select CPU_HAS_SR_RB
++ select SH_INTC
+ select SYS_SUPPORTS_TMU
+
+ config CPU_SH4
+@@ -198,6 +200,7 @@ config CPU_SH4
+ select CPU_HAS_INTEVT
+ select CPU_HAS_SR_RB
+ select CPU_HAS_FPU if !CPU_SH4AL_DSP
++ select SH_INTC
+ select SYS_SUPPORTS_TMU
+ select SYS_SUPPORTS_HUGETLBFS if MMU
+
+diff --git a/drivers/sh/Makefile b/drivers/sh/Makefile
+index 788ed9b59b4e..114203f32843 100644
+--- a/drivers/sh/Makefile
++++ b/drivers/sh/Makefile
+@@ -1,8 +1,7 @@
+ #
+ # Makefile for the SuperH specific drivers.
+ #
+-obj-$(CONFIG_SUPERH) += intc/
+-obj-$(CONFIG_ARCH_SHMOBILE_LEGACY) += intc/
++obj-$(CONFIG_SH_INTC) += intc/
+ ifneq ($(CONFIG_COMMON_CLK),y)
+ obj-$(CONFIG_HAVE_CLK) += clk/
+ endif
+diff --git a/drivers/sh/intc/Kconfig b/drivers/sh/intc/Kconfig
+index 60228fae943f..6a1b05ddc8c9 100644
+--- a/drivers/sh/intc/Kconfig
++++ b/drivers/sh/intc/Kconfig
+@@ -1,7 +1,9 @@
+ config SH_INTC
+- def_bool y
++ bool
+ select IRQ_DOMAIN
+
++if SH_INTC
++
+ comment "Interrupt controller options"
+
+ config INTC_USERIMASK
+@@ -37,3 +39,5 @@ config INTC_MAPPING_DEBUG
+ between system IRQs and the per-controller id tables.
+
+ If in doubt, say N.
++
++endif
+--
+2.1.2
+
diff --git a/patches.renesas/0760-spi-rspi-Handle-dmaengine_prep_slave_sg-failures-gra.patch b/patches.renesas/0760-spi-rspi-Handle-dmaengine_prep_slave_sg-failures-gra.patch
new file mode 100644
index 00000000000000..57eef8c4a3a5e8
--- /dev/null
+++ b/patches.renesas/0760-spi-rspi-Handle-dmaengine_prep_slave_sg-failures-gra.patch
@@ -0,0 +1,100 @@
+From 8efccf0ca3ccebdcea5e33bafd88ab1bdbea45f2 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 9 Jul 2014 12:26:22 +0200
+Subject: spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully
+
+As typically a shmobile SoC has less DMA channels than devices that can use
+DMA, we may want to prioritize access to the DMA channels in the future.
+This means that dmaengine_prep_slave_sg() may start failing arbitrarily.
+
+Handle dmaengine_prep_slave_sg() failures gracefully by falling back to
+PIO.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 85912a88c1ebcad04a5cfec971771195ce8d6691)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-rspi.c | 30 ++++++++++++++++++++++--------
+ 1 file changed, 22 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
+index 38fd938d6360..c850dfdfa9e3 100644
+--- a/drivers/spi/spi-rspi.c
++++ b/drivers/spi/spi-rspi.c
+@@ -477,7 +477,7 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
+ tx->sgl, tx->nents, DMA_TO_DEVICE,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+ if (!desc_tx)
+- return -EIO;
++ goto no_dma;
+
+ irq_mask |= SPCR_SPTIE;
+ }
+@@ -486,7 +486,7 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
+ rx->sgl, rx->nents, DMA_FROM_DEVICE,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+ if (!desc_rx)
+- return -EIO;
++ goto no_dma;
+
+ irq_mask |= SPCR_SPRIE;
+ }
+@@ -540,6 +540,12 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
+ enable_irq(rspi->rx_irq);
+
+ return ret;
++
++no_dma:
++ pr_warn_once("%s %s: DMA not available, falling back to PIO\n",
++ dev_driver_string(&rspi->master->dev),
++ dev_name(&rspi->master->dev));
++ return -EAGAIN;
+ }
+
+ static void rspi_receive_init(const struct rspi_data *rspi)
+@@ -593,8 +599,10 @@ static int rspi_common_transfer(struct rspi_data *rspi,
+
+ if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) {
+ /* rx_buf can be NULL on RSPI on SH in TX-only Mode */
+- return rspi_dma_transfer(rspi, &xfer->tx_sg,
+- xfer->rx_buf ? &xfer->rx_sg : NULL);
++ ret = rspi_dma_transfer(rspi, &xfer->tx_sg,
++ xfer->rx_buf ? &xfer->rx_sg : NULL);
++ if (ret != -EAGAIN)
++ return ret;
+ }
+
+ ret = rspi_pio_transfer(rspi, xfer->tx_buf, xfer->rx_buf, xfer->len);
+@@ -648,8 +656,11 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer)
+ {
+ int ret;
+
+- if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer))
+- return rspi_dma_transfer(rspi, &xfer->tx_sg, NULL);
++ if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) {
++ ret = rspi_dma_transfer(rspi, &xfer->tx_sg, NULL);
++ if (ret != -EAGAIN)
++ return ret;
++ }
+
+ ret = rspi_pio_transfer(rspi, xfer->tx_buf, NULL, xfer->len);
+ if (ret < 0)
+@@ -663,8 +674,11 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer)
+
+ static int qspi_transfer_in(struct rspi_data *rspi, struct spi_transfer *xfer)
+ {
+- if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer))
+- return rspi_dma_transfer(rspi, NULL, &xfer->rx_sg);
++ if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) {
++ int ret = rspi_dma_transfer(rspi, NULL, &xfer->rx_sg);
++ if (ret != -EAGAIN)
++ return ret;
++ }
+
+ return rspi_pio_transfer(rspi, NULL, xfer->rx_buf, xfer->len);
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0761-spi-rspi-Fix-leaking-of-unused-DMA-descriptors.patch b/patches.renesas/0761-spi-rspi-Fix-leaking-of-unused-DMA-descriptors.patch
new file mode 100644
index 00000000000000..12b1b9b8705c19
--- /dev/null
+++ b/patches.renesas/0761-spi-rspi-Fix-leaking-of-unused-DMA-descriptors.patch
@@ -0,0 +1,163 @@
+From e5e819f67b1b345456e5849653fc71f8c0d1142c Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 6 Aug 2014 14:58:58 +0200
+Subject: spi: rspi: Fix leaking of unused DMA descriptors
+
+If dmaengine_prep_slave_sg() or dmaengine_submit() fail, we may leak
+unused DMA descriptors.
+
+As per Documentation/dmaengine.txt, once a DMA descriptor has been
+obtained, it must be submitted. Hence:
+ - First prepare and submit all DMA descriptors,
+ - Prepare the SPI controller for DMA,
+ - Start DMA by calling dma_async_issue_pending(),
+ - Make sure to call dmaengine_terminate_all() on all descriptors that
+ haven't completed.
+
+Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 3819bc8752367eae0d72fa1c473dc88ea45631a7)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/spi/spi-rspi.c | 94 +++++++++++++++++++++++++++++++-------------------
+ 1 file changed, 58 insertions(+), 36 deletions(-)
+
+diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
+index c850dfdfa9e3..ad87a98f8f68 100644
+--- a/drivers/spi/spi-rspi.c
++++ b/drivers/spi/spi-rspi.c
+@@ -472,25 +472,52 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
+ dma_cookie_t cookie;
+ int ret;
+
+- if (tx) {
+- desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx,
+- tx->sgl, tx->nents, DMA_TO_DEVICE,
+- DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+- if (!desc_tx)
+- goto no_dma;
+-
+- irq_mask |= SPCR_SPTIE;
+- }
++ /* First prepare and submit the DMA request(s), as this may fail */
+ if (rx) {
+ desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx,
+ rx->sgl, rx->nents, DMA_FROM_DEVICE,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+- if (!desc_rx)
+- goto no_dma;
++ if (!desc_rx) {
++ ret = -EAGAIN;
++ goto no_dma_rx;
++ }
++
++ desc_rx->callback = rspi_dma_complete;
++ desc_rx->callback_param = rspi;
++ cookie = dmaengine_submit(desc_rx);
++ if (dma_submit_error(cookie)) {
++ ret = cookie;
++ goto no_dma_rx;
++ }
+
+ irq_mask |= SPCR_SPRIE;
+ }
+
++ if (tx) {
++ desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx,
++ tx->sgl, tx->nents, DMA_TO_DEVICE,
++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
++ if (!desc_tx) {
++ ret = -EAGAIN;
++ goto no_dma_tx;
++ }
++
++ if (rx) {
++ /* No callback */
++ desc_tx->callback = NULL;
++ } else {
++ desc_tx->callback = rspi_dma_complete;
++ desc_tx->callback_param = rspi;
++ }
++ cookie = dmaengine_submit(desc_tx);
++ if (dma_submit_error(cookie)) {
++ ret = cookie;
++ goto no_dma_tx;
++ }
++
++ irq_mask |= SPCR_SPTIE;
++ }
++
+ /*
+ * DMAC needs SPxIE, but if SPxIE is set, the IRQ routine will be
+ * called. So, this driver disables the IRQ while DMA transfer.
+@@ -503,34 +530,24 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
+ rspi_enable_irq(rspi, irq_mask);
+ rspi->dma_callbacked = 0;
+
+- if (rx) {
+- desc_rx->callback = rspi_dma_complete;
+- desc_rx->callback_param = rspi;
+- cookie = dmaengine_submit(desc_rx);
+- if (dma_submit_error(cookie))
+- return cookie;
++ /* Now start DMA */
++ if (rx)
+ dma_async_issue_pending(rspi->master->dma_rx);
+- }
+- if (tx) {
+- if (rx) {
+- /* No callback */
+- desc_tx->callback = NULL;
+- } else {
+- desc_tx->callback = rspi_dma_complete;
+- desc_tx->callback_param = rspi;
+- }
+- cookie = dmaengine_submit(desc_tx);
+- if (dma_submit_error(cookie))
+- return cookie;
++ if (tx)
+ dma_async_issue_pending(rspi->master->dma_tx);
+- }
+
+ ret = wait_event_interruptible_timeout(rspi->wait,
+ rspi->dma_callbacked, HZ);
+ if (ret > 0 && rspi->dma_callbacked)
+ ret = 0;
+- else if (!ret)
++ else if (!ret) {
++ dev_err(&rspi->master->dev, "DMA timeout\n");
+ ret = -ETIMEDOUT;
++ if (tx)
++ dmaengine_terminate_all(rspi->master->dma_tx);
++ if (rx)
++ dmaengine_terminate_all(rspi->master->dma_rx);
++ }
+
+ rspi_disable_irq(rspi, irq_mask);
+
+@@ -541,11 +558,16 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx,
+
+ return ret;
+
+-no_dma:
+- pr_warn_once("%s %s: DMA not available, falling back to PIO\n",
+- dev_driver_string(&rspi->master->dev),
+- dev_name(&rspi->master->dev));
+- return -EAGAIN;
++no_dma_tx:
++ if (rx)
++ dmaengine_terminate_all(rspi->master->dma_rx);
++no_dma_rx:
++ if (ret == -EAGAIN) {
++ pr_warn_once("%s %s: DMA not available, falling back to PIO\n",
++ dev_driver_string(&rspi->master->dev),
++ dev_name(&rspi->master->dev));
++ }
++ return ret;
+ }
+
+ static void rspi_receive_init(const struct rspi_data *rspi)
+--
+2.1.2
+
diff --git a/patches.renesas/0762-thermal-rcar-Document-SoC-specific-bindings.patch b/patches.renesas/0762-thermal-rcar-Document-SoC-specific-bindings.patch
new file mode 100644
index 00000000000000..0a067daa7fc1bb
--- /dev/null
+++ b/patches.renesas/0762-thermal-rcar-Document-SoC-specific-bindings.patch
@@ -0,0 +1,67 @@
+From 398f3431f4962d409baf9e4c9b63d7650d680df6 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 9 Jul 2014 14:23:35 +0200
+Subject: thermal: rcar: Document SoC-specific bindings
+
+The documentation only mentioned the generic fallback compatible property.
+Add the missing SoC-specific compatible properties, some of which are
+already in use.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Cc: Zhang Rui <rui.zhang@intel.com>
+Cc: Eduardo Valentin <eduardo.valentin@ti.com>
+Cc: linux-pm@vger.kernel.org
+Acked-by: Simon Horman <horms+renesas@verge.net.au>
+Signed-off-by: Zhang Rui <rui.zhang@intel.com>
+(cherry picked from commit fa313103c953fd832b7c4e431c74be55c20b1ce1)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ .../devicetree/bindings/thermal/rcar-thermal.txt | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
+index 28ef498a66e5..0ef00be44b01 100644
+--- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
++++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
+@@ -1,7 +1,13 @@
+ * Renesas R-Car Thermal
+
+ Required properties:
+-- compatible : "renesas,rcar-thermal"
++- compatible : "renesas,thermal-<soctype>", "renesas,rcar-thermal"
++ as fallback.
++ Examples with soctypes are:
++ - "renesas,thermal-r8a73a4" (R-Mobile AP6)
++ - "renesas,thermal-r8a7779" (R-Car H1)
++ - "renesas,thermal-r8a7790" (R-Car H2)
++ - "renesas,thermal-r8a7791" (R-Car M2)
+ - reg : Address range of the thermal registers.
+ The 1st reg will be recognized as common register
+ if it has "interrupts".
+@@ -12,18 +18,18 @@ Option properties:
+
+ Example (non interrupt support):
+
+-thermal@e61f0100 {
+- compatible = "renesas,rcar-thermal";
+- reg = <0xe61f0100 0x38>;
++thermal@ffc48000 {
++ compatible = "renesas,thermal-r8a7779", "renesas,rcar-thermal";
++ reg = <0xffc48000 0x38>;
+ };
+
+ Example (interrupt support):
+
+ thermal@e61f0000 {
+- compatible = "renesas,rcar-thermal";
++ compatible = "renesas,thermal-r8a73a4", "renesas,rcar-thermal";
+ reg = <0xe61f0000 0x14
+ 0xe61f0100 0x38
+ 0xe61f0200 0x38
+ 0xe61f0300 0x38>;
+- interrupts = <0 69 4>;
++ interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0763-drm-rcar-du-fix-warnings.patch b/patches.renesas/0763-drm-rcar-du-fix-warnings.patch
new file mode 100644
index 00000000000000..363e8d016d338f
--- /dev/null
+++ b/patches.renesas/0763-drm-rcar-du-fix-warnings.patch
@@ -0,0 +1,33 @@
+From 1b46ba2882544f4d6747f0d65a4ce4ad6281ba0d Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@arm.linux.org.uk>
+Date: Sun, 13 Jul 2014 12:18:58 +0100
+Subject: drm: rcar-du: fix warnings
+
+drivers/gpu/drm/rcar-du/rcar_du_drv.c:190:5: warning: "CONFIG_PM_SLEEP" is not defined [-Wundef]
+
+Always use #ifdef with CONFIG symbols, never just bare #if
+
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+(cherry picked from commit 396d7a24a9b3ddbce3335c57a234227eb7762d14)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+index 792fd1d20e86..fda64b7b73e8 100644
+--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
++++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+@@ -187,7 +187,7 @@ static struct drm_driver rcar_du_driver = {
+ * Power management
+ */
+
+-#if CONFIG_PM_SLEEP
++#ifdef CONFIG_PM_SLEEP
+ static int rcar_du_pm_suspend(struct device *dev)
+ {
+ struct rcar_du_device *rcdu = dev_get_drvdata(dev);
+--
+2.1.2
+
diff --git a/patches.renesas/0764-drm-rcar-du-Fix-maximum-frame-buffer-pitch-computati.patch b/patches.renesas/0764-drm-rcar-du-Fix-maximum-frame-buffer-pitch-computati.patch
new file mode 100644
index 00000000000000..ffa6f9c68bd7cc
--- /dev/null
+++ b/patches.renesas/0764-drm-rcar-du-Fix-maximum-frame-buffer-pitch-computati.patch
@@ -0,0 +1,58 @@
+From b3d4ace2b7a80e7ca463af9af090fe18fde8ab63 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 28 Jul 2014 20:18:36 +0200
+Subject: drm/rcar-du: Fix maximum frame buffer pitch computation
+
+The maximum pitch constraint for the hardware is expressed in pixels.
+Convert it to bytes to validate frame buffer creation, as frame buffer
+pitches are expressed in bytes.
+
+Reported-by: Phil Edworthy <phil.edworthy@renesas.com>
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+(cherry picked from commit 8bed5cc765ffdd61b59f8405d38b377f5a7f0920)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/gpu/drm/rcar-du/rcar_du_kms.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+index a87edfac111f..76026104d000 100644
+--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
++++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+@@ -135,7 +135,9 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
+ {
+ struct rcar_du_device *rcdu = dev->dev_private;
+ const struct rcar_du_format_info *format;
++ unsigned int max_pitch;
+ unsigned int align;
++ unsigned int bpp;
+
+ format = rcar_du_format_info(mode_cmd->pixel_format);
+ if (format == NULL) {
+@@ -144,13 +146,20 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
+ return ERR_PTR(-EINVAL);
+ }
+
++ /*
++ * The pitch and alignment constraints are expressed in pixels on the
++ * hardware side and in bytes in the DRM API.
++ */
++ bpp = format->planes == 2 ? 1 : format->bpp / 8;
++ max_pitch = 4096 * bpp;
++
+ if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B))
+ align = 128;
+ else
+- align = 16 * format->bpp / 8;
++ align = 16 * bpp;
+
+ if (mode_cmd->pitches[0] & (align - 1) ||
+- mode_cmd->pitches[0] >= 8192) {
++ mode_cmd->pitches[0] >= max_pitch) {
+ dev_dbg(dev->dev, "invalid pitch value %u\n",
+ mode_cmd->pitches[0]);
+ return ERR_PTR(-EINVAL);
+--
+2.1.2
+
diff --git a/patches.renesas/0765-PCI-rcar-Fix-GPL-v2-license-string-typo.patch b/patches.renesas/0765-PCI-rcar-Fix-GPL-v2-license-string-typo.patch
new file mode 100644
index 00000000000000..3592a5f12df704
--- /dev/null
+++ b/patches.renesas/0765-PCI-rcar-Fix-GPL-v2-license-string-typo.patch
@@ -0,0 +1,30 @@
+From fa37aa5309283a8d67e4a9c30901dae9846a5151 Mon Sep 17 00:00:00 2001
+From: Bjorn Helgaas <bhelgaas@google.com>
+Date: Tue, 15 Jul 2014 15:06:12 -0600
+Subject: PCI: rcar: Fix GPL v2 license string typo
+
+Per license_is_gpl_compatible(), the MODULE_LICENSE() string for GPL v2 is
+"GPL v2", not "GPLv2". Use "GPL v2" so this module doesn't taint the
+kernel.
+
+Based-on-work-by: Thierry Reding <treding@nvidia.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+(cherry picked from commit 68947eb17503ce2009c603d0d0bb9feb139fb8b8)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/pci/host/pcie-rcar.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
+index efdea0766b64..0a9e8164e32c 100644
+--- a/drivers/pci/host/pcie-rcar.c
++++ b/drivers/pci/host/pcie-rcar.c
+@@ -991,4 +991,4 @@ module_platform_driver(rcar_pcie_driver);
+
+ MODULE_AUTHOR("Phil Edworthy <phil.edworthy@renesas.com>");
+ MODULE_DESCRIPTION("Renesas R-Car PCIe driver");
+-MODULE_LICENSE("GPLv2");
++MODULE_LICENSE("GPL v2");
+--
+2.1.2
+
diff --git a/patches.renesas/0766-i2c-i2c-rcar-Drop-class-based-scanning-to-improve-bo.patch b/patches.renesas/0766-i2c-i2c-rcar-Drop-class-based-scanning-to-improve-bo.patch
new file mode 100644
index 00000000000000..ad80a2db59617f
--- /dev/null
+++ b/patches.renesas/0766-i2c-i2c-rcar-Drop-class-based-scanning-to-improve-bo.patch
@@ -0,0 +1,48 @@
+From 24b3150981d548717988c8b3d0dda593468f00ca Mon Sep 17 00:00:00 2001
+From: Wolfram Sang <wsa@the-dreams.de>
+Date: Thu, 10 Jul 2014 13:46:31 +0200
+Subject: i2c: i2c-rcar: Drop class based scanning to improve bootup time
+
+This driver has been flagged to drop class based instantiation. The removal
+improves boot-up time and is unneeded for embedded controllers. Users have been
+warned to switch for some time now, so we can actually do the removal. Keep the
+DEPRECATED flag, so the core can inform users that the behaviour finally
+changed now. After another transition period, this flag can go, too.
+While we are here, remove the indentation for the array setup because
+such things always break after some time.
+
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+(cherry picked from commit 929e3aba5114235388793443cbc05882904577b9)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/i2c/busses/i2c-rcar.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
+index 899405923678..f3c7139dfa25 100644
+--- a/drivers/i2c/busses/i2c-rcar.c
++++ b/drivers/i2c/busses/i2c-rcar.c
+@@ -541,13 +541,13 @@ static int rcar_i2c_probe(struct platform_device *pdev)
+ irq = platform_get_irq(pdev, 0);
+ init_waitqueue_head(&priv->wait);
+
+- adap = &priv->adap;
+- adap->nr = pdev->id;
+- adap->algo = &rcar_i2c_algo;
+- adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
+- adap->retries = 3;
+- adap->dev.parent = dev;
+- adap->dev.of_node = dev->of_node;
++ adap = &priv->adap;
++ adap->nr = pdev->id;
++ adap->algo = &rcar_i2c_algo;
++ adap->class = I2C_CLASS_DEPRECATED;
++ adap->retries = 3;
++ adap->dev.parent = dev;
++ adap->dev.of_node = dev->of_node;
+ i2c_set_adapdata(adap, priv);
+ strlcpy(adap->name, pdev->name, sizeof(adap->name));
+
+--
+2.1.2
+
diff --git a/patches.renesas/0767-media-of-move-graph-helpers-from-drivers-media-v4l2-.patch b/patches.renesas/0767-media-of-move-graph-helpers-from-drivers-media-v4l2-.patch
new file mode 100644
index 00000000000000..6f98f7a26ad2a6
--- /dev/null
+++ b/patches.renesas/0767-media-of-move-graph-helpers-from-drivers-media-v4l2-.patch
@@ -0,0 +1,598 @@
+From 62863563dcb0eb491091d7a8aa85d0bc6e8520d7 Mon Sep 17 00:00:00 2001
+From: Philipp Zabel <p.zabel@pengutronix.de>
+Date: Mon, 10 Feb 2014 22:01:48 +0100
+Subject: [media] of: move graph helpers from drivers/media/v4l2-core to
+ drivers/of
+
+This patch moves the parsing helpers used to parse connected graphs
+in the device tree, like the video interface bindings documented in
+Documentation/devicetree/bindings/media/video-interfaces.txt, from
+drivers/media/v4l2-core/v4l2-of.c into drivers/of/base.c.
+
+This allows to reuse the same parser code from outside the V4L2
+framework, most importantly from display drivers.
+The functions v4l2_of_get_next_endpoint, v4l2_of_get_remote_port,
+and v4l2_of_get_remote_port_parent are moved. They are renamed to
+of_graph_get_next_endpoint, of_graph_get_remote_port, and
+of_graph_get_remote_port_parent, respectively.
+Since there are not that many current users yet, switch all of
+them to the new functions right away.
+
+Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
+Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
+(cherry picked from commit fd9fdb78a9bf85b94fb2190c82ff280c8f8375cc)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/i2c/adv7343.c | 4 +-
+ drivers/media/i2c/mt9p031.c | 4 +-
+ drivers/media/i2c/s5k5baf.c | 3 +-
+ drivers/media/i2c/tvp514x.c | 3 +-
+ drivers/media/i2c/tvp7002.c | 3 +-
+ drivers/media/platform/exynos4-is/fimc-is.c | 6 +-
+ drivers/media/platform/exynos4-is/media-dev.c | 3 +-
+ drivers/media/platform/exynos4-is/mipi-csis.c | 3 +-
+ drivers/media/v4l2-core/v4l2-of.c | 117 -------------------------
+ drivers/of/base.c | 118 ++++++++++++++++++++++++++
+ include/linux/of_graph.h | 46 ++++++++++
+ include/media/v4l2-of.h | 25 +-----
+ 12 files changed, 182 insertions(+), 153 deletions(-)
+ create mode 100644 include/linux/of_graph.h
+
+diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
+index d4e15a617c3b..9d38f7b36cd1 100644
+--- a/drivers/media/i2c/adv7343.c
++++ b/drivers/media/i2c/adv7343.c
+@@ -26,12 +26,12 @@
+ #include <linux/videodev2.h>
+ #include <linux/uaccess.h>
+ #include <linux/of.h>
++#include <linux/of_graph.h>
+
+ #include <media/adv7343.h>
+ #include <media/v4l2-async.h>
+ #include <media/v4l2-device.h>
+ #include <media/v4l2-ctrls.h>
+-#include <media/v4l2-of.h>
+
+ #include "adv7343_regs.h"
+
+@@ -410,7 +410,7 @@ adv7343_get_pdata(struct i2c_client *client)
+ if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
+ return client->dev.platform_data;
+
+- np = v4l2_of_get_next_endpoint(client->dev.of_node, NULL);
++ np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+ if (!np)
+ return NULL;
+
+diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
+index e5ddf47030fd..192c4aad05d6 100644
+--- a/drivers/media/i2c/mt9p031.c
++++ b/drivers/media/i2c/mt9p031.c
+@@ -21,6 +21,7 @@
+ #include <linux/module.h>
+ #include <linux/of.h>
+ #include <linux/of_gpio.h>
++#include <linux/of_graph.h>
+ #include <linux/pm.h>
+ #include <linux/regulator/consumer.h>
+ #include <linux/slab.h>
+@@ -29,7 +30,6 @@
+ #include <media/mt9p031.h>
+ #include <media/v4l2-ctrls.h>
+ #include <media/v4l2-device.h>
+-#include <media/v4l2-of.h>
+ #include <media/v4l2-subdev.h>
+
+ #include "aptina-pll.h"
+@@ -943,7 +943,7 @@ mt9p031_get_pdata(struct i2c_client *client)
+ if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
+ return client->dev.platform_data;
+
+- np = v4l2_of_get_next_endpoint(client->dev.of_node, NULL);
++ np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+ if (!np)
+ return NULL;
+
+diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
+index 77e10e0fd8d6..2d768ef67cc5 100644
+--- a/drivers/media/i2c/s5k5baf.c
++++ b/drivers/media/i2c/s5k5baf.c
+@@ -21,6 +21,7 @@
+ #include <linux/media.h>
+ #include <linux/module.h>
+ #include <linux/of_gpio.h>
++#include <linux/of_graph.h>
+ #include <linux/regulator/consumer.h>
+ #include <linux/slab.h>
+
+@@ -1855,7 +1856,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf *state, struct device *dev)
+ if (ret < 0)
+ return ret;
+
+- node_ep = v4l2_of_get_next_endpoint(node, NULL);
++ node_ep = of_graph_get_next_endpoint(node, NULL);
+ if (!node_ep) {
+ dev_err(dev, "no endpoint defined at node %s\n",
+ node->full_name);
+diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
+index 83d85df4853a..ca001178c5bf 100644
+--- a/drivers/media/i2c/tvp514x.c
++++ b/drivers/media/i2c/tvp514x.c
+@@ -36,6 +36,7 @@
+ #include <linux/module.h>
+ #include <linux/v4l2-mediabus.h>
+ #include <linux/of.h>
++#include <linux/of_graph.h>
+
+ #include <media/v4l2-async.h>
+ #include <media/v4l2-device.h>
+@@ -1068,7 +1069,7 @@ tvp514x_get_pdata(struct i2c_client *client)
+ if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
+ return client->dev.platform_data;
+
+- endpoint = v4l2_of_get_next_endpoint(client->dev.of_node, NULL);
++ endpoint = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+ if (!endpoint)
+ return NULL;
+
+diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
+index 912e1cccdd1c..c4e1e2cb3094 100644
+--- a/drivers/media/i2c/tvp7002.c
++++ b/drivers/media/i2c/tvp7002.c
+@@ -30,6 +30,7 @@
+ #include <linux/videodev2.h>
+ #include <linux/module.h>
+ #include <linux/of.h>
++#include <linux/of_graph.h>
+ #include <linux/v4l2-dv-timings.h>
+ #include <media/tvp7002.h>
+ #include <media/v4l2-async.h>
+@@ -957,7 +958,7 @@ tvp7002_get_pdata(struct i2c_client *client)
+ if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
+ return client->dev.platform_data;
+
+- endpoint = v4l2_of_get_next_endpoint(client->dev.of_node, NULL);
++ endpoint = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+ if (!endpoint)
+ return NULL;
+
+diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c
+index 13a4228952e3..9bdfa4599bc3 100644
+--- a/drivers/media/platform/exynos4-is/fimc-is.c
++++ b/drivers/media/platform/exynos4-is/fimc-is.c
+@@ -24,13 +24,13 @@
+ #include <linux/i2c.h>
+ #include <linux/of_irq.h>
+ #include <linux/of_address.h>
++#include <linux/of_graph.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/slab.h>
+ #include <linux/types.h>
+ #include <linux/videodev2.h>
+-#include <media/v4l2-of.h>
+ #include <media/videobuf2-dma-contig.h>
+
+ #include "media-dev.h"
+@@ -167,10 +167,10 @@ static int fimc_is_parse_sensor_config(struct fimc_is_sensor *sensor,
+ u32 tmp = 0;
+ int ret;
+
+- np = v4l2_of_get_next_endpoint(np, NULL);
++ np = of_graph_get_next_endpoint(np, NULL);
+ if (!np)
+ return -ENXIO;
+- np = v4l2_of_get_remote_port(np);
++ np = of_graph_get_remote_port(np);
+ if (!np)
+ return -ENXIO;
+
+diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
+index c1bce170df6f..d0f82da59ac5 100644
+--- a/drivers/media/platform/exynos4-is/media-dev.c
++++ b/drivers/media/platform/exynos4-is/media-dev.c
+@@ -20,6 +20,7 @@
+ #include <linux/of.h>
+ #include <linux/of_platform.h>
+ #include <linux/of_device.h>
++#include <linux/of_graph.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/types.h>
+@@ -473,7 +474,7 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
+
+ pd->mux_id = (endpoint.port - 1) & 0x1;
+
+- rem = v4l2_of_get_remote_port_parent(ep);
++ rem = of_graph_get_remote_port_parent(ep);
+ of_node_put(ep);
+ if (rem == NULL) {
+ v4l2_info(&fmd->v4l2_dev, "Remote device at %s not found\n",
+diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c
+index f3c3591fdc5d..fd1ae6549607 100644
+--- a/drivers/media/platform/exynos4-is/mipi-csis.c
++++ b/drivers/media/platform/exynos4-is/mipi-csis.c
+@@ -20,6 +20,7 @@
+ #include <linux/memory.h>
+ #include <linux/module.h>
+ #include <linux/of.h>
++#include <linux/of_graph.h>
+ #include <linux/phy/phy.h>
+ #include <linux/platform_data/mipi-csis.h>
+ #include <linux/platform_device.h>
+@@ -762,7 +763,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
+ &state->max_num_lanes))
+ return -EINVAL;
+
+- node = v4l2_of_get_next_endpoint(node, NULL);
++ node = of_graph_get_next_endpoint(node, NULL);
+ if (!node) {
+ dev_err(&pdev->dev, "No port node at %s\n",
+ pdev->dev.of_node->full_name);
+diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c
+index 42e3e8a5e361..f919db358bbe 100644
+--- a/drivers/media/v4l2-core/v4l2-of.c
++++ b/drivers/media/v4l2-core/v4l2-of.c
+@@ -152,120 +152,3 @@ int v4l2_of_parse_endpoint(const struct device_node *node,
+ return 0;
+ }
+ EXPORT_SYMBOL(v4l2_of_parse_endpoint);
+-
+-/**
+- * v4l2_of_get_next_endpoint() - get next endpoint node
+- * @parent: pointer to the parent device node
+- * @prev: previous endpoint node, or NULL to get first
+- *
+- * Return: An 'endpoint' node pointer with refcount incremented. Refcount
+- * of the passed @prev node is not decremented, the caller have to use
+- * of_node_put() on it when done.
+- */
+-struct device_node *v4l2_of_get_next_endpoint(const struct device_node *parent,
+- struct device_node *prev)
+-{
+- struct device_node *endpoint;
+- struct device_node *port = NULL;
+-
+- if (!parent)
+- return NULL;
+-
+- if (!prev) {
+- struct device_node *node;
+- /*
+- * It's the first call, we have to find a port subnode
+- * within this node or within an optional 'ports' node.
+- */
+- node = of_get_child_by_name(parent, "ports");
+- if (node)
+- parent = node;
+-
+- port = of_get_child_by_name(parent, "port");
+-
+- if (port) {
+- /* Found a port, get an endpoint. */
+- endpoint = of_get_next_child(port, NULL);
+- of_node_put(port);
+- } else {
+- endpoint = NULL;
+- }
+-
+- if (!endpoint)
+- pr_err("%s(): no endpoint nodes specified for %s\n",
+- __func__, parent->full_name);
+- of_node_put(node);
+- } else {
+- port = of_get_parent(prev);
+- if (!port)
+- /* Hm, has someone given us the root node ?... */
+- return NULL;
+-
+- /* Avoid dropping prev node refcount to 0. */
+- of_node_get(prev);
+- endpoint = of_get_next_child(port, prev);
+- if (endpoint) {
+- of_node_put(port);
+- return endpoint;
+- }
+-
+- /* No more endpoints under this port, try the next one. */
+- do {
+- port = of_get_next_child(parent, port);
+- if (!port)
+- return NULL;
+- } while (of_node_cmp(port->name, "port"));
+-
+- /* Pick up the first endpoint in this port. */
+- endpoint = of_get_next_child(port, NULL);
+- of_node_put(port);
+- }
+-
+- return endpoint;
+-}
+-EXPORT_SYMBOL(v4l2_of_get_next_endpoint);
+-
+-/**
+- * v4l2_of_get_remote_port_parent() - get remote port's parent node
+- * @node: pointer to a local endpoint device_node
+- *
+- * Return: Remote device node associated with remote endpoint node linked
+- * to @node. Use of_node_put() on it when done.
+- */
+-struct device_node *v4l2_of_get_remote_port_parent(
+- const struct device_node *node)
+-{
+- struct device_node *np;
+- unsigned int depth;
+-
+- /* Get remote endpoint node. */
+- np = of_parse_phandle(node, "remote-endpoint", 0);
+-
+- /* Walk 3 levels up only if there is 'ports' node. */
+- for (depth = 3; depth && np; depth--) {
+- np = of_get_next_parent(np);
+- if (depth == 2 && of_node_cmp(np->name, "ports"))
+- break;
+- }
+- return np;
+-}
+-EXPORT_SYMBOL(v4l2_of_get_remote_port_parent);
+-
+-/**
+- * v4l2_of_get_remote_port() - get remote port node
+- * @node: pointer to a local endpoint device_node
+- *
+- * Return: Remote port node associated with remote endpoint node linked
+- * to @node. Use of_node_put() on it when done.
+- */
+-struct device_node *v4l2_of_get_remote_port(const struct device_node *node)
+-{
+- struct device_node *np;
+-
+- /* Get remote endpoint node. */
+- np = of_parse_phandle(node, "remote-endpoint", 0);
+- if (!np)
+- return NULL;
+- return of_get_next_parent(np);
+-}
+-EXPORT_SYMBOL(v4l2_of_get_remote_port);
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index 1b95a405628f..2aad560cef84 100644
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -21,6 +21,7 @@
+ #include <linux/cpu.h>
+ #include <linux/module.h>
+ #include <linux/of.h>
++#include <linux/of_graph.h>
+ #include <linux/spinlock.h>
+ #include <linux/slab.h>
+ #include <linux/proc_fs.h>
+@@ -2014,3 +2015,120 @@ struct device_node *of_find_next_cache_node(const struct device_node *np)
+
+ return NULL;
+ }
++
++/**
++ * of_graph_get_next_endpoint() - get next endpoint node
++ * @parent: pointer to the parent device node
++ * @prev: previous endpoint node, or NULL to get first
++ *
++ * Return: An 'endpoint' node pointer with refcount incremented. Refcount
++ * of the passed @prev node is not decremented, the caller have to use
++ * of_node_put() on it when done.
++ */
++struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
++ struct device_node *prev)
++{
++ struct device_node *endpoint;
++ struct device_node *port = NULL;
++
++ if (!parent)
++ return NULL;
++
++ if (!prev) {
++ struct device_node *node;
++ /*
++ * It's the first call, we have to find a port subnode
++ * within this node or within an optional 'ports' node.
++ */
++ node = of_get_child_by_name(parent, "ports");
++ if (node)
++ parent = node;
++
++ port = of_get_child_by_name(parent, "port");
++
++ if (port) {
++ /* Found a port, get an endpoint. */
++ endpoint = of_get_next_child(port, NULL);
++ of_node_put(port);
++ } else {
++ endpoint = NULL;
++ }
++
++ if (!endpoint)
++ pr_err("%s(): no endpoint nodes specified for %s\n",
++ __func__, parent->full_name);
++ of_node_put(node);
++ } else {
++ port = of_get_parent(prev);
++ if (!port)
++ /* Hm, has someone given us the root node ?... */
++ return NULL;
++
++ /* Avoid dropping prev node refcount to 0. */
++ of_node_get(prev);
++ endpoint = of_get_next_child(port, prev);
++ if (endpoint) {
++ of_node_put(port);
++ return endpoint;
++ }
++
++ /* No more endpoints under this port, try the next one. */
++ do {
++ port = of_get_next_child(parent, port);
++ if (!port)
++ return NULL;
++ } while (of_node_cmp(port->name, "port"));
++
++ /* Pick up the first endpoint in this port. */
++ endpoint = of_get_next_child(port, NULL);
++ of_node_put(port);
++ }
++
++ return endpoint;
++}
++EXPORT_SYMBOL(of_graph_get_next_endpoint);
++
++/**
++ * of_graph_get_remote_port_parent() - get remote port's parent node
++ * @node: pointer to a local endpoint device_node
++ *
++ * Return: Remote device node associated with remote endpoint node linked
++ * to @node. Use of_node_put() on it when done.
++ */
++struct device_node *of_graph_get_remote_port_parent(
++ const struct device_node *node)
++{
++ struct device_node *np;
++ unsigned int depth;
++
++ /* Get remote endpoint node. */
++ np = of_parse_phandle(node, "remote-endpoint", 0);
++
++ /* Walk 3 levels up only if there is 'ports' node. */
++ for (depth = 3; depth && np; depth--) {
++ np = of_get_next_parent(np);
++ if (depth == 2 && of_node_cmp(np->name, "ports"))
++ break;
++ }
++ return np;
++}
++EXPORT_SYMBOL(of_graph_get_remote_port_parent);
++
++/**
++ * of_graph_get_remote_port() - get remote port node
++ * @node: pointer to a local endpoint device_node
++ *
++ * Return: Remote port node associated with remote endpoint node linked
++ * to @node. Use of_node_put() on it when done.
++ */
++struct device_node *of_graph_get_remote_port(const struct device_node *node)
++{
++ struct device_node *np;
++
++ /* Get remote endpoint node. */
++ np = of_parse_phandle(node, "remote-endpoint", 0);
++ if (!np)
++ return NULL;
++ return of_get_next_parent(np);
++}
++EXPORT_SYMBOL(of_graph_get_remote_port);
+diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
+new file mode 100644
+index 000000000000..3bbeb609a360
+--- /dev/null
++++ b/include/linux/of_graph.h
+@@ -0,0 +1,46 @@
++/*
++ * OF graph binding parsing helpers
++ *
++ * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
++ * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
++ *
++ * Copyright (C) 2012 Renesas Electronics Corp.
++ * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of version 2 of the GNU General Public License as
++ * published by the Free Software Foundation.
++ */
++#ifndef __LINUX_OF_GRAPH_H
++#define __LINUX_OF_GRAPH_H
++
++#ifdef CONFIG_OF
++struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
++ struct device_node *previous);
++struct device_node *of_graph_get_remote_port_parent(
++ const struct device_node *node);
++struct device_node *of_graph_get_remote_port(const struct device_node *node);
++#else
++
++static inline struct device_node *of_graph_get_next_endpoint(
++ const struct device_node *parent,
++ struct device_node *previous)
++{
++ return NULL;
++}
++
++static inline struct device_node *of_graph_get_remote_port_parent(
++ const struct device_node *node)
++{
++ return NULL;
++}
++
++static inline struct device_node *of_graph_get_remote_port(
++ const struct device_node *node)
++{
++ return NULL;
++}
++
++#endif /* CONFIG_OF */
++
++#endif /* __LINUX_OF_GRAPH_H */
+diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
+index 541cea4122e9..3a49735c56a0 100644
+--- a/include/media/v4l2-of.h
++++ b/include/media/v4l2-of.h
+@@ -17,6 +17,7 @@
+ #include <linux/list.h>
+ #include <linux/types.h>
+ #include <linux/errno.h>
++#include <linux/of_graph.h>
+
+ #include <media/v4l2-mediabus.h>
+
+@@ -72,11 +73,6 @@ struct v4l2_of_endpoint {
+ #ifdef CONFIG_OF
+ int v4l2_of_parse_endpoint(const struct device_node *node,
+ struct v4l2_of_endpoint *endpoint);
+-struct device_node *v4l2_of_get_next_endpoint(const struct device_node *parent,
+- struct device_node *previous);
+-struct device_node *v4l2_of_get_remote_port_parent(
+- const struct device_node *node);
+-struct device_node *v4l2_of_get_remote_port(const struct device_node *node);
+ #else /* CONFIG_OF */
+
+ static inline int v4l2_of_parse_endpoint(const struct device_node *node,
+@@ -85,25 +81,6 @@ static inline int v4l2_of_parse_endpoint(const struct device_node *node,
+ return -ENOSYS;
+ }
+
+-static inline struct device_node *v4l2_of_get_next_endpoint(
+- const struct device_node *parent,
+- struct device_node *previous)
+-{
+- return NULL;
+-}
+-
+-static inline struct device_node *v4l2_of_get_remote_port_parent(
+- const struct device_node *node)
+-{
+- return NULL;
+-}
+-
+-static inline struct device_node *v4l2_of_get_remote_port(
+- const struct device_node *node)
+-{
+- return NULL;
+-}
+-
+ #endif /* CONFIG_OF */
+
+ #endif /* _V4L2_OF_H */
+--
+2.1.2
+
diff --git a/patches.renesas/0768-media-rcar_vin-copy-flags-from-pdata.patch b/patches.renesas/0768-media-rcar_vin-copy-flags-from-pdata.patch
new file mode 100644
index 00000000000000..447900caaf4103
--- /dev/null
+++ b/patches.renesas/0768-media-rcar_vin-copy-flags-from-pdata.patch
@@ -0,0 +1,85 @@
+From 18171de5495b6e5b0e07befc8f3b17a12ce6ef90 Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Mon, 14 Apr 2014 07:36:40 -0300
+Subject: [media] rcar_vin: copy flags from pdata
+
+The platform data is a single word, so simply copy
+it into the device's private data structure than
+keeping a copy of the pointer.
+
+This will make changing to device-tree binding
+easier as it is one allocation instead of two.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 25dfa02ce21981ef08d375be987862f96676d8ab)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/soc_camera/rcar_vin.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
+index 702dc47062a2..47516dffbf65 100644
+--- a/drivers/media/platform/soc_camera/rcar_vin.c
++++ b/drivers/media/platform/soc_camera/rcar_vin.c
+@@ -126,13 +126,13 @@ struct rcar_vin_priv {
+ int sequence;
+ /* State of the VIN module in capturing mode */
+ enum rcar_vin_state state;
+- struct rcar_vin_platform_data *pdata;
+ struct soc_camera_host ici;
+ struct list_head capture;
+ #define MAX_BUFFER_NUM 3
+ struct vb2_buffer *queue_buf[MAX_BUFFER_NUM];
+ struct vb2_alloc_ctx *alloc_ctx;
+ enum v4l2_field field;
++ unsigned int pdata_flags;
+ unsigned int vb_count;
+ unsigned int nr_hw_slots;
+ bool request_to_stop;
+@@ -275,12 +275,12 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
+ break;
+ case V4L2_MBUS_FMT_YUYV8_2X8:
+ /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */
+- vnmc |= priv->pdata->flags & RCAR_VIN_BT656 ?
++ vnmc |= priv->pdata_flags & RCAR_VIN_BT656 ?
+ VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601;
+ break;
+ case V4L2_MBUS_FMT_YUYV10_2X10:
+ /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */
+- vnmc |= priv->pdata->flags & RCAR_VIN_BT656 ?
++ vnmc |= priv->pdata_flags & RCAR_VIN_BT656 ?
+ VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601;
+ break;
+ default:
+@@ -799,7 +799,7 @@ static int rcar_vin_set_bus_param(struct soc_camera_device *icd)
+ /* Make choises, based on platform preferences */
+ if ((common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) &&
+ (common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) {
+- if (priv->pdata->flags & RCAR_VIN_HSYNC_ACTIVE_LOW)
++ if (priv->pdata_flags & RCAR_VIN_HSYNC_ACTIVE_LOW)
+ common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_HIGH;
+ else
+ common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_LOW;
+@@ -807,7 +807,7 @@ static int rcar_vin_set_bus_param(struct soc_camera_device *icd)
+
+ if ((common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) &&
+ (common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) {
+- if (priv->pdata->flags & RCAR_VIN_VSYNC_ACTIVE_LOW)
++ if (priv->pdata_flags & RCAR_VIN_VSYNC_ACTIVE_LOW)
+ common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_HIGH;
+ else
+ common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_LOW;
+@@ -1447,7 +1447,7 @@ static int rcar_vin_probe(struct platform_device *pdev)
+ priv->ici.drv_name = dev_name(&pdev->dev);
+ priv->ici.ops = &rcar_vin_host_ops;
+
+- priv->pdata = pdata;
++ priv->pdata_flags = pdata->flags;
+ priv->chip = pdev->id_entry->driver_data;
+ spin_lock_init(&priv->lock);
+ INIT_LIST_HEAD(&priv->capture);
+--
+2.1.2
+
diff --git a/patches.renesas/0769-media-rcar_vin-add-devicetree-support.patch b/patches.renesas/0769-media-rcar_vin-add-devicetree-support.patch
new file mode 100644
index 00000000000000..eca4754a34613a
--- /dev/null
+++ b/patches.renesas/0769-media-rcar_vin-add-devicetree-support.patch
@@ -0,0 +1,242 @@
+From 934c68c1324e0db2f19cc6d660609067805f6eba Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Sat, 5 Jul 2014 19:26:22 -0300
+Subject: [media] rcar_vin: add devicetree support
+
+Add support for devicetree probe for the rcar-vin
+driver.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+[g.liakhovetski@gmx.de fix a typo, sort headers alphabetically]
+Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 47c71bd61b772cd72159dff4aae43734257a485a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ .../devicetree/bindings/media/rcar_vin.txt | 86 ++++++++++++++++++++++
+ drivers/media/platform/soc_camera/rcar_vin.c | 72 ++++++++++++++++--
+ 2 files changed, 151 insertions(+), 7 deletions(-)
+ create mode 100644 Documentation/devicetree/bindings/media/rcar_vin.txt
+
+diff --git a/Documentation/devicetree/bindings/media/rcar_vin.txt b/Documentation/devicetree/bindings/media/rcar_vin.txt
+new file mode 100644
+index 000000000000..ba61782c2af9
+--- /dev/null
++++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
+@@ -0,0 +1,86 @@
++Renesas RCar Video Input driver (rcar_vin)
++------------------------------------------
++
++The rcar_vin device provides video input capabilities for the Renesas R-Car
++family of devices. The current blocks are always slaves and suppot one input
++channel which can be either RGB, YUYV or BT656.
++
++ - compatible: Must be one of the following
++ - "renesas,vin-r8a7791" for the R8A7791 device
++ - "renesas,vin-r8a7790" for the R8A7790 device
++ - "renesas,vin-r8a7779" for the R8A7779 device
++ - "renesas,vin-r8a7778" for the R8A7778 device
++ - reg: the register base and size for the device registers
++ - interrupts: the interrupt for the device
++ - clocks: Reference to the parent clock
++
++Additionally, an alias named vinX will need to be created to specify
++which video input device this is.
++
++The per-board settings:
++ - port sub-node describing a single endpoint connected to the vin
++ as described in video-interfaces.txt[1]. Only the first one will
++ be considered as each vin interface has one input port.
++
++ These settings are used to work out video input format and widths
++ into the system.
++
++
++Device node example
++-------------------
++
++ aliases {
++ vin0 = &vin0;
++ };
++
++ vin0: vin@0xe6ef0000 {
++ compatible = "renesas,vin-r8a7790";
++ clocks = <&mstp8_clks R8A7790_CLK_VIN0>;
++ reg = <0 0xe6ef0000 0 0x1000>;
++ interrupts = <0 188 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++Board setup example (vin1 composite video input)
++------------------------------------------------
++
++&i2c2 {
++ status = "ok";
++ pinctrl-0 = <&i2c2_pins>;
++ pinctrl-names = "default";
++
++ adv7180@20 {
++ compatible = "adi,adv7180";
++ reg = <0x20>;
++ remote = <&vin1>;
++
++ port {
++ adv7180: endpoint {
++ bus-width = <8>;
++ remote-endpoint = <&vin1ep0>;
++ };
++ };
++ };
++};
++
++/* composite video input */
++&vin1 {
++ pinctrl-0 = <&vin1_pins>;
++ pinctrl-names = "default";
++
++ status = "ok";
++
++ port {
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ vin1ep0: endpoint {
++ remote-endpoint = <&adv7180>;
++ bus-width = <8>;
++ };
++ };
++};
++
++
++
++[1] video-interfaces.txt common video media interface
+diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
+index 47516dffbf65..4ea0fa8be14f 100644
+--- a/drivers/media/platform/soc_camera/rcar_vin.c
++++ b/drivers/media/platform/soc_camera/rcar_vin.c
+@@ -19,6 +19,8 @@
+ #include <linux/io.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
++#include <linux/of.h>
++#include <linux/of_device.h>
+ #include <linux/platform_data/camera-rcar.h>
+ #include <linux/platform_device.h>
+ #include <linux/pm_runtime.h>
+@@ -31,6 +33,7 @@
+ #include <media/v4l2-dev.h>
+ #include <media/v4l2-device.h>
+ #include <media/v4l2-mediabus.h>
++#include <media/v4l2-of.h>
+ #include <media/v4l2-subdev.h>
+ #include <media/videobuf2-dma-contig.h>
+
+@@ -1392,6 +1395,17 @@ static struct soc_camera_host_ops rcar_vin_host_ops = {
+ .init_videobuf2 = rcar_vin_init_videobuf2,
+ };
+
++#ifdef CONFIG_OF
++static struct of_device_id rcar_vin_of_table[] = {
++ { .compatible = "renesas,vin-r8a7791", .data = (void *)RCAR_GEN2 },
++ { .compatible = "renesas,vin-r8a7790", .data = (void *)RCAR_GEN2 },
++ { .compatible = "renesas,vin-r8a7779", .data = (void *)RCAR_H1 },
++ { .compatible = "renesas,vin-r8a7778", .data = (void *)RCAR_M1 },
++ { },
++};
++MODULE_DEVICE_TABLE(of, rcar_vin_of_table);
++#endif
++
+ static struct platform_device_id rcar_vin_id_table[] = {
+ { "r8a7791-vin", RCAR_GEN2 },
+ { "r8a7790-vin", RCAR_GEN2 },
+@@ -1404,15 +1418,52 @@ MODULE_DEVICE_TABLE(platform, rcar_vin_id_table);
+
+ static int rcar_vin_probe(struct platform_device *pdev)
+ {
++ const struct of_device_id *match = NULL;
+ struct rcar_vin_priv *priv;
+ struct resource *mem;
+ struct rcar_vin_platform_data *pdata;
++ unsigned int pdata_flags;
+ int irq, ret;
+
+- pdata = pdev->dev.platform_data;
+- if (!pdata || !pdata->flags) {
+- dev_err(&pdev->dev, "platform data not set\n");
+- return -EINVAL;
++ if (pdev->dev.of_node) {
++ struct v4l2_of_endpoint ep;
++ struct device_node *np;
++
++ match = of_match_device(of_match_ptr(rcar_vin_of_table),
++ &pdev->dev);
++
++ np = of_graph_get_next_endpoint(pdev->dev.of_node, NULL);
++ if (!np) {
++ dev_err(&pdev->dev, "could not find endpoint\n");
++ return -EINVAL;
++ }
++
++ ret = v4l2_of_parse_endpoint(np, &ep);
++ if (ret) {
++ dev_err(&pdev->dev, "could not parse endpoint\n");
++ return ret;
++ }
++
++ if (ep.bus_type == V4L2_MBUS_BT656)
++ pdata_flags = RCAR_VIN_BT656;
++ else {
++ pdata_flags = 0;
++ if (ep.bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
++ pdata_flags |= RCAR_VIN_HSYNC_ACTIVE_LOW;
++ if (ep.bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
++ pdata_flags |= RCAR_VIN_VSYNC_ACTIVE_LOW;
++ }
++
++ of_node_put(np);
++
++ dev_dbg(&pdev->dev, "pdata_flags = %08x\n", pdata_flags);
++ } else {
++ pdata = pdev->dev.platform_data;
++ if (!pdata || !pdata->flags) {
++ dev_err(&pdev->dev, "platform data not set\n");
++ return -EINVAL;
++ }
++ pdata_flags = pdata->flags;
+ }
+
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+@@ -1443,12 +1494,18 @@ static int rcar_vin_probe(struct platform_device *pdev)
+
+ priv->ici.priv = priv;
+ priv->ici.v4l2_dev.dev = &pdev->dev;
+- priv->ici.nr = pdev->id;
+ priv->ici.drv_name = dev_name(&pdev->dev);
+ priv->ici.ops = &rcar_vin_host_ops;
+
+- priv->pdata_flags = pdata->flags;
+- priv->chip = pdev->id_entry->driver_data;
++ priv->pdata_flags = pdata_flags;
++ if (!match) {
++ priv->ici.nr = pdev->id;
++ priv->chip = pdev->id_entry->driver_data;
++ } else {
++ priv->ici.nr = of_alias_get_id(pdev->dev.of_node, "vin");
++ priv->chip = (enum chip_id)match->data;
++ };
++
+ spin_lock_init(&priv->lock);
+ INIT_LIST_HEAD(&priv->capture);
+
+@@ -1489,6 +1546,7 @@ static struct platform_driver rcar_vin_driver = {
+ .driver = {
+ .name = DRV_NAME,
+ .owner = THIS_MODULE,
++ .of_match_table = of_match_ptr(rcar_vin_of_table),
+ },
+ .id_table = rcar_vin_id_table,
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0770-media-v4l-vsp1-Fix-routing-cleanup-when-stopping-the.patch b/patches.renesas/0770-media-v4l-vsp1-Fix-routing-cleanup-when-stopping-the.patch
new file mode 100644
index 00000000000000..6eea8b3f7b3a79
--- /dev/null
+++ b/patches.renesas/0770-media-v4l-vsp1-Fix-routing-cleanup-when-stopping-the.patch
@@ -0,0 +1,39 @@
+From bf63282d61609dba60fcb18af5b593d91491d04a Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 23 Jun 2014 18:40:49 -0300
+Subject: [media] v4l: vsp1: Fix routing cleanup when stopping the stream
+
+Commit d9b45ed3d8b75e8cf38c8cd1563c29217eecba27 ("v4l: vsp1: Support
+multi-input entities") reworked pipeline routing configuration and
+introduced a bug by writing to the entities routing registers without
+first checking whether the entity had a routing register. This results
+in overwriting the value at offset 0 of the device register space when
+stopping the stream.
+
+Fix this by skipping routing register write for entities without a
+routing register.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit aaa48cbb098e13cf9c22066b8c65958a7243fb95)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_video.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
+index 2fc67b6161f1..dcb11474f5bb 100644
+--- a/drivers/media/platform/vsp1/vsp1_video.c
++++ b/drivers/media/platform/vsp1/vsp1_video.c
+@@ -479,7 +479,7 @@ static int vsp1_pipeline_stop(struct vsp1_pipeline *pipe)
+ ret = ret == 0 ? -ETIMEDOUT : 0;
+
+ list_for_each_entry(entity, &pipe->entities, list_pipe) {
+- if (entity->route)
++ if (entity->route && entity->route->reg)
+ vsp1_write(entity->vsp1, entity->route->reg,
+ VI6_DPR_NODE_UNUSED);
+
+--
+2.1.2
+
diff --git a/patches.renesas/0771-media-v4l-vsp1-Release-buffers-at-stream-stop.patch b/patches.renesas/0771-media-v4l-vsp1-Release-buffers-at-stream-stop.patch
new file mode 100644
index 00000000000000..c6424bb6132a7b
--- /dev/null
+++ b/patches.renesas/0771-media-v4l-vsp1-Release-buffers-at-stream-stop.patch
@@ -0,0 +1,39 @@
+From e93307678a24edfd51417977b0c203f9de3f306b Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 23 Jun 2014 16:57:22 -0300
+Subject: [media] v4l: vsp1: Release buffers at stream stop
+
+videobuf2 expects no buffer to be owned by the driver when the
+stop_stream queue operation returns. As the vsp1 driver fails to do so,
+a warning is generated at stream top time.
+
+Fix this by releasing all buffers queued on the IRQ queue in the
+stop_stream operation handler and marking them as erroneous.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 9df04e9d9ac6982d16a8a042c8274410ed29fb0e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_video.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/media/platform/vsp1/vsp1_video.c
++++ b/drivers/media/platform/vsp1/vsp1_video.c
+@@ -742,6 +742,7 @@ static int vsp1_video_stop_streaming(str
+ {
+ struct vsp1_video *video = vb2_get_drv_priv(vq);
+ struct vsp1_pipeline *pipe = to_vsp1_pipeline(&video->video.entity);
++ struct vsp1_video_buffer *buffer;
+ unsigned long flags;
+ int ret;
+
+@@ -759,6 +760,8 @@ static int vsp1_video_stop_streaming(str
+
+ /* Remove all buffers from the IRQ queue. */
+ spin_lock_irqsave(&video->irqlock, flags);
++ list_for_each_entry(buffer, &video->irqqueue, queue)
++ vb2_buffer_done(&buffer->buf, VB2_BUF_STATE_ERROR);
+ INIT_LIST_HEAD(&video->irqqueue);
+ spin_unlock_irqrestore(&video->irqlock, flags);
+
diff --git a/patches.renesas/0772-media-v4l-vsp1-Fix-pipeline-stop-timeout.patch b/patches.renesas/0772-media-v4l-vsp1-Fix-pipeline-stop-timeout.patch
new file mode 100644
index 00000000000000..9ec7951eaf4d9c
--- /dev/null
+++ b/patches.renesas/0772-media-v4l-vsp1-Fix-pipeline-stop-timeout.patch
@@ -0,0 +1,62 @@
+From 2fe92e7967dd33656e9e45001029946c00db9aa8 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 23 Jun 2014 17:15:02 -0300
+Subject: [media] v4l: vsp1: Fix pipeline stop timeout
+
+If the pipeline was already stopped when stopping the stream, no
+frame end interrupt will be generated and the driver will time out
+waiting for the pipeline to stop.
+
+Fix this by setting the pipeline state to STOPPED when the pipeline is
+idle waiting for frames to process, and to STOPPING at stream stop time
+only when the pipeline is currently RUNNING.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 9b3e6e2abd7568f9458e927fc4e5eca1b3cde521)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_video.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
+index a0d5ddb21660..5e6f8af2a7f5 100644
+--- a/drivers/media/platform/vsp1/vsp1_video.c
++++ b/drivers/media/platform/vsp1/vsp1_video.c
+@@ -471,7 +471,8 @@ static int vsp1_pipeline_stop(struct vsp1_pipeline *pipe)
+ int ret;
+
+ spin_lock_irqsave(&pipe->irqlock, flags);
+- pipe->state = VSP1_PIPELINE_STOPPING;
++ if (pipe->state == VSP1_PIPELINE_RUNNING)
++ pipe->state = VSP1_PIPELINE_STOPPING;
+ spin_unlock_irqrestore(&pipe->irqlock, flags);
+
+ ret = wait_event_timeout(pipe->wq, pipe->state == VSP1_PIPELINE_STOPPED,
+@@ -576,6 +577,7 @@ static void vsp1_video_frame_end(struct vsp1_pipeline *pipe,
+
+ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
+ {
++ enum vsp1_pipeline_state state;
+ unsigned long flags;
+ unsigned int i;
+
+@@ -591,11 +593,13 @@ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
+
+ spin_lock_irqsave(&pipe->irqlock, flags);
+
++ state = pipe->state;
++ pipe->state = VSP1_PIPELINE_STOPPED;
++
+ /* If a stop has been requested, mark the pipeline as stopped and
+ * return.
+ */
+- if (pipe->state == VSP1_PIPELINE_STOPPING) {
+- pipe->state = VSP1_PIPELINE_STOPPED;
++ if (state == VSP1_PIPELINE_STOPPING) {
+ wake_up(&pipe->wq);
+ goto done;
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0773-media-v4l-vsp1-Fix-typos.patch b/patches.renesas/0773-media-v4l-vsp1-Fix-typos.patch
new file mode 100644
index 00000000000000..62c0006c3ef50b
--- /dev/null
+++ b/patches.renesas/0773-media-v4l-vsp1-Fix-typos.patch
@@ -0,0 +1,92 @@
+From 8fbe97af0edb5a2e4173a42ce44e4cb6b751b7a3 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 27 May 2014 12:59:39 -0300
+Subject: [media] v4l: vsp1: Fix typos
+
+Several macros were mistakenly prefixed with VPS1 instead of VSP1. Fix
+them.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 7005a81705d032887b9f4f808e6dce8e57b8980a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1.h | 12 ++++++------
+ drivers/media/platform/vsp1/vsp1_drv.c | 6 +++---
+ drivers/media/platform/vsp1/vsp1_video.h | 2 +-
+ 3 files changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h
+index 6ca2cf20d545..3cfa3939157e 100644
+--- a/drivers/media/platform/vsp1/vsp1.h
++++ b/drivers/media/platform/vsp1/vsp1.h
+@@ -36,9 +36,9 @@ struct vsp1_rwpf;
+ struct vsp1_sru;
+ struct vsp1_uds;
+
+-#define VPS1_MAX_RPF 5
+-#define VPS1_MAX_UDS 3
+-#define VPS1_MAX_WPF 4
++#define VSP1_MAX_RPF 5
++#define VSP1_MAX_UDS 3
++#define VSP1_MAX_WPF 4
+
+ struct vsp1_device {
+ struct device *dev;
+@@ -55,10 +55,10 @@ struct vsp1_device {
+ struct vsp1_hsit *hst;
+ struct vsp1_lif *lif;
+ struct vsp1_lut *lut;
+- struct vsp1_rwpf *rpf[VPS1_MAX_RPF];
++ struct vsp1_rwpf *rpf[VSP1_MAX_RPF];
+ struct vsp1_sru *sru;
+- struct vsp1_uds *uds[VPS1_MAX_UDS];
+- struct vsp1_rwpf *wpf[VPS1_MAX_WPF];
++ struct vsp1_uds *uds[VSP1_MAX_UDS];
++ struct vsp1_rwpf *wpf[VSP1_MAX_WPF];
+
+ struct list_head entities;
+
+diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
+index c69ee0657f75..0c5e74cdd3d0 100644
+--- a/drivers/media/platform/vsp1/vsp1_drv.c
++++ b/drivers/media/platform/vsp1/vsp1_drv.c
+@@ -440,19 +440,19 @@ static int vsp1_validate_platform_data(struct platform_device *pdev,
+ return -EINVAL;
+ }
+
+- if (pdata->rpf_count <= 0 || pdata->rpf_count > VPS1_MAX_RPF) {
++ if (pdata->rpf_count <= 0 || pdata->rpf_count > VSP1_MAX_RPF) {
+ dev_err(&pdev->dev, "invalid number of RPF (%u)\n",
+ pdata->rpf_count);
+ return -EINVAL;
+ }
+
+- if (pdata->uds_count <= 0 || pdata->uds_count > VPS1_MAX_UDS) {
++ if (pdata->uds_count <= 0 || pdata->uds_count > VSP1_MAX_UDS) {
+ dev_err(&pdev->dev, "invalid number of UDS (%u)\n",
+ pdata->uds_count);
+ return -EINVAL;
+ }
+
+- if (pdata->wpf_count <= 0 || pdata->wpf_count > VPS1_MAX_WPF) {
++ if (pdata->wpf_count <= 0 || pdata->wpf_count > VSP1_MAX_WPF) {
+ dev_err(&pdev->dev, "invalid number of WPF (%u)\n",
+ pdata->wpf_count);
+ return -EINVAL;
+diff --git a/drivers/media/platform/vsp1/vsp1_video.h b/drivers/media/platform/vsp1/vsp1_video.h
+index c04d48fa2999..8464cd913760 100644
+--- a/drivers/media/platform/vsp1/vsp1_video.h
++++ b/drivers/media/platform/vsp1/vsp1_video.h
+@@ -73,7 +73,7 @@ struct vsp1_pipeline {
+
+ unsigned int num_video;
+ unsigned int num_inputs;
+- struct vsp1_rwpf *inputs[VPS1_MAX_RPF];
++ struct vsp1_rwpf *inputs[VSP1_MAX_RPF];
+ struct vsp1_rwpf *output;
+ struct vsp1_entity *bru;
+ struct vsp1_entity *lif;
+--
+2.1.2
+
diff --git a/patches.renesas/0774-media-v4l-vsp1-Cleanup-video-nodes-at-removal-time.patch b/patches.renesas/0774-media-v4l-vsp1-Cleanup-video-nodes-at-removal-time.patch
new file mode 100644
index 00000000000000..2acbde6335061a
--- /dev/null
+++ b/patches.renesas/0774-media-v4l-vsp1-Cleanup-video-nodes-at-removal-time.patch
@@ -0,0 +1,135 @@
+From e2f6c2853ff5168282fb1825ea0e3a6da3169562 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 28 May 2014 12:49:13 -0300
+Subject: [media] v4l: vsp1: Cleanup video nodes at removal time
+
+Video nodes created and initialized in the RPF and WPF init code paths
+are never unregistered, and the related resources (videobuf alloc
+context and media entity) never released.
+
+Fix this by storing a pointer to the vsp1_video object in vsp1_entity
+and calling vsp1_video_cleanup() from vsp1_entity_destroy(). This also
+allows simplifying the init error code paths.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 1499be67a545fb6f41acb5614b8e4732147cec50)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_entity.c | 3 +++
+ drivers/media/platform/vsp1/vsp1_entity.h | 3 +++
+ drivers/media/platform/vsp1/vsp1_rpf.c | 12 ++++++------
+ drivers/media/platform/vsp1/vsp1_wpf.c | 12 ++++++------
+ 4 files changed, 18 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
+index 44167834285d..ceac0d7e5643 100644
+--- a/drivers/media/platform/vsp1/vsp1_entity.c
++++ b/drivers/media/platform/vsp1/vsp1_entity.c
+@@ -20,6 +20,7 @@
+
+ #include "vsp1.h"
+ #include "vsp1_entity.h"
++#include "vsp1_video.h"
+
+ /* -----------------------------------------------------------------------------
+ * V4L2 Subdevice Operations
+@@ -185,6 +186,8 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
+
+ void vsp1_entity_destroy(struct vsp1_entity *entity)
+ {
++ if (entity->video)
++ vsp1_video_cleanup(entity->video);
+ if (entity->subdev.ctrl_handler)
+ v4l2_ctrl_handler_free(entity->subdev.ctrl_handler);
+ media_entity_cleanup(&entity->subdev.entity);
+diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h
+index 7afbd8a7ba66..f0257f68f16a 100644
+--- a/drivers/media/platform/vsp1/vsp1_entity.h
++++ b/drivers/media/platform/vsp1/vsp1_entity.h
+@@ -18,6 +18,7 @@
+ #include <media/v4l2-subdev.h>
+
+ struct vsp1_device;
++struct vsp1_video;
+
+ enum vsp1_entity_type {
+ VSP1_ENTITY_BRU,
+@@ -68,6 +69,8 @@ struct vsp1_entity {
+
+ struct v4l2_subdev subdev;
+ struct v4l2_mbus_framefmt *formats;
++
++ struct vsp1_video *video;
+ };
+
+ static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
+diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c
+index c3d98642a4aa..9b3fc70e18f0 100644
+--- a/drivers/media/platform/vsp1/vsp1_rpf.c
++++ b/drivers/media/platform/vsp1/vsp1_rpf.c
+@@ -205,7 +205,9 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index)
+
+ ret = vsp1_video_init(video, &rpf->entity);
+ if (ret < 0)
+- goto error_video;
++ goto error;
++
++ rpf->entity.video = video;
+
+ /* Connect the video device to the RPF. */
+ ret = media_entity_create_link(&rpf->video.video.entity, 0,
+@@ -214,13 +216,11 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index)
+ MEDIA_LNK_FL_ENABLED |
+ MEDIA_LNK_FL_IMMUTABLE);
+ if (ret < 0)
+- goto error_link;
++ goto error;
+
+ return rpf;
+
+-error_link:
+- vsp1_video_cleanup(video);
+-error_video:
+- media_entity_cleanup(&rpf->entity.subdev.entity);
++error:
++ vsp1_entity_destroy(&rpf->entity);
+ return ERR_PTR(ret);
+ }
+diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
+index 1294340dcb36..36c479362f8c 100644
+--- a/drivers/media/platform/vsp1/vsp1_wpf.c
++++ b/drivers/media/platform/vsp1/vsp1_wpf.c
+@@ -216,7 +216,9 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
+
+ ret = vsp1_video_init(video, &wpf->entity);
+ if (ret < 0)
+- goto error_video;
++ goto error;
++
++ wpf->entity.video = video;
+
+ /* Connect the video device to the WPF. All connections are immutable
+ * except for the WPF0 source link if a LIF is present.
+@@ -229,15 +231,13 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
+ RWPF_PAD_SOURCE,
+ &wpf->video.video.entity, 0, flags);
+ if (ret < 0)
+- goto error_link;
++ goto error;
+
+ wpf->entity.sink = &wpf->video.video.entity;
+
+ return wpf;
+
+-error_link:
+- vsp1_video_cleanup(video);
+-error_video:
+- media_entity_cleanup(&wpf->entity.subdev.entity);
++error:
++ vsp1_entity_destroy(&wpf->entity);
+ return ERR_PTR(ret);
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0775-media-v4l-vsp1-Propagate-vsp1_device_get-errors-to-t.patch b/patches.renesas/0775-media-v4l-vsp1-Propagate-vsp1_device_get-errors-to-t.patch
new file mode 100644
index 00000000000000..0a620e11697743
--- /dev/null
+++ b/patches.renesas/0775-media-v4l-vsp1-Propagate-vsp1_device_get-errors-to-t.patch
@@ -0,0 +1,87 @@
+From f8daafd4fae32c108caa34ed7c32c7221289740d Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Sat, 31 May 2014 08:50:32 -0300
+Subject: [media] v4l: vsp1: Propagate vsp1_device_get errors to the callers
+
+Modify the vsp1_device_get() function to return an error code instead of
+a pointer to the VSP1 device, and use the return value in the callers.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 4c16d6a079a4c9a64d664cc9c30ebae5f0bd0c64)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1.h | 2 +-
+ drivers/media/platform/vsp1/vsp1_drv.c | 16 ++++++----------
+ drivers/media/platform/vsp1/vsp1_video.c | 4 ++--
+ 3 files changed, 9 insertions(+), 13 deletions(-)
+
+--- a/drivers/media/platform/vsp1/vsp1.h
++++ b/drivers/media/platform/vsp1/vsp1.h
+@@ -66,7 +66,7 @@ struct vsp1_device {
+ struct media_device media_dev;
+ };
+
+-struct vsp1_device *vsp1_device_get(struct vsp1_device *vsp1);
++int vsp1_device_get(struct vsp1_device *vsp1);
+ void vsp1_device_put(struct vsp1_device *vsp1);
+
+ static inline u32 vsp1_read(struct vsp1_device *vsp1, u32 reg)
+--- a/drivers/media/platform/vsp1/vsp1_drv.c
++++ b/drivers/media/platform/vsp1/vsp1_drv.c
+@@ -345,36 +345,32 @@ static int vsp1_device_init(struct vsp1_
+ * Increment the VSP1 reference count and initialize the device if the first
+ * reference is taken.
+ *
+- * Return a pointer to the VSP1 device or NULL if an error occurred.
++ * Return 0 on success or a negative error code otherwise.
+ */
+-struct vsp1_device *vsp1_device_get(struct vsp1_device *vsp1)
++int vsp1_device_get(struct vsp1_device *vsp1)
+ {
+- struct vsp1_device *__vsp1 = vsp1;
+- int ret;
++ int ret = 0;
+
+ mutex_lock(&vsp1->lock);
+ if (vsp1->ref_count > 0)
+ goto done;
+
+ ret = clk_prepare_enable(vsp1->clock);
+- if (ret < 0) {
+- __vsp1 = NULL;
++ if (ret < 0)
+ goto done;
+- }
+
+ ret = vsp1_device_init(vsp1);
+ if (ret < 0) {
+ clk_disable_unprepare(vsp1->clock);
+- __vsp1 = NULL;
+ goto done;
+ }
+
+ done:
+- if (__vsp1)
++ if (!ret)
+ vsp1->ref_count++;
+
+ mutex_unlock(&vsp1->lock);
+- return __vsp1;
++ return ret;
+ }
+
+ /*
+--- a/drivers/media/platform/vsp1/vsp1_video.c
++++ b/drivers/media/platform/vsp1/vsp1_video.c
+@@ -957,8 +957,8 @@ static int vsp1_video_open(struct file *
+
+ file->private_data = vfh;
+
+- if (!vsp1_device_get(video->vsp1)) {
+- ret = -EBUSY;
++ ret = vsp1_device_get(video->vsp1);
++ if (ret < 0) {
+ v4l2_fh_del(vfh);
+ kfree(vfh);
+ }
diff --git a/patches.renesas/0776-media-v4l-vsp1-Setup-control-handler-automatically-a.patch b/patches.renesas/0776-media-v4l-vsp1-Setup-control-handler-automatically-a.patch
new file mode 100644
index 00000000000000..7f11c3a8e665da
--- /dev/null
+++ b/patches.renesas/0776-media-v4l-vsp1-Setup-control-handler-automatically-a.patch
@@ -0,0 +1,124 @@
+From 51e64f84d5cda37988092bfba75413931f6809d8 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Sat, 31 May 2014 10:40:51 -0300
+Subject: [media] v4l: vsp1: Setup control handler automatically at stream on
+ time
+
+When setting a control directly on a subdev node the VSP1 driver doesn't
+guarantee that the device is powered on. This leads to crashes when the
+control handlers writes to hardware registers. One easy way to fix this
+is to ensure that the device gets powered on when a subdev node is
+opened. However, this consumes power unnecessarily, as there's no need
+to power the device on when setting formats on the pipeline.
+Furthermore, control handler setup at entity init time suffers from the
+same problem as the device isn't powered on easier.
+
+Fix this by extend the entity base object to setup the control handler
+automatically when starting the stream. Entities must then skip writing
+to registers in the set control handler when not streaming, which can be
+tested with the new vsp1_entity_is_streaming() helper function.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 960de2cff49a4e5f45e6a60175f4298cc34dc526)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_entity.c | 39 +++++++++++++++++++++++++++++++
+ drivers/media/platform/vsp1/vsp1_entity.h | 7 ++++++
+ 2 files changed, 46 insertions(+)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
+index ceac0d7e5643..79af71d5e270 100644
+--- a/drivers/media/platform/vsp1/vsp1_entity.c
++++ b/drivers/media/platform/vsp1/vsp1_entity.c
+@@ -22,6 +22,41 @@
+ #include "vsp1_entity.h"
+ #include "vsp1_video.h"
+
++bool vsp1_entity_is_streaming(struct vsp1_entity *entity)
++{
++ bool streaming;
++
++ mutex_lock(&entity->lock);
++ streaming = entity->streaming;
++ mutex_unlock(&entity->lock);
++
++ return streaming;
++}
++
++int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming)
++{
++ int ret;
++
++ mutex_lock(&entity->lock);
++ entity->streaming = streaming;
++ mutex_unlock(&entity->lock);
++
++ if (!streaming)
++ return 0;
++
++ if (!entity->subdev.ctrl_handler)
++ return 0;
++
++ ret = v4l2_ctrl_handler_setup(entity->subdev.ctrl_handler);
++ if (ret < 0) {
++ mutex_lock(&entity->lock);
++ entity->streaming = false;
++ mutex_unlock(&entity->lock);
++ }
++
++ return ret;
++}
++
+ /* -----------------------------------------------------------------------------
+ * V4L2 Subdevice Operations
+ */
+@@ -158,6 +193,8 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
+ if (i == ARRAY_SIZE(vsp1_routes))
+ return -EINVAL;
+
++ mutex_init(&entity->lock);
++
+ entity->vsp1 = vsp1;
+ entity->source_pad = num_pads - 1;
+
+@@ -191,4 +228,6 @@ void vsp1_entity_destroy(struct vsp1_entity *entity)
+ if (entity->subdev.ctrl_handler)
+ v4l2_ctrl_handler_free(entity->subdev.ctrl_handler);
+ media_entity_cleanup(&entity->subdev.entity);
++
++ mutex_destroy(&entity->lock);
+ }
+diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h
+index f0257f68f16a..aa20aaa58208 100644
+--- a/drivers/media/platform/vsp1/vsp1_entity.h
++++ b/drivers/media/platform/vsp1/vsp1_entity.h
+@@ -14,6 +14,7 @@
+ #define __VSP1_ENTITY_H__
+
+ #include <linux/list.h>
++#include <linux/mutex.h>
+
+ #include <media/v4l2-subdev.h>
+
+@@ -71,6 +72,9 @@ struct vsp1_entity {
+ struct v4l2_mbus_framefmt *formats;
+
+ struct vsp1_video *video;
++
++ struct mutex lock; /* Protects the streaming field */
++ bool streaming;
+ };
+
+ static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev)
+@@ -92,4 +96,7 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity,
+ void vsp1_entity_init_formats(struct v4l2_subdev *subdev,
+ struct v4l2_subdev_fh *fh);
+
++bool vsp1_entity_is_streaming(struct vsp1_entity *entity);
++int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming);
++
+ #endif /* __VSP1_ENTITY_H__ */
+--
+2.1.2
+
diff --git a/patches.renesas/0777-media-v4l-vsp1-sru-Fix-the-intensity-control-default.patch b/patches.renesas/0777-media-v4l-vsp1-sru-Fix-the-intensity-control-default.patch
new file mode 100644
index 00000000000000..64ed4ef11e1144
--- /dev/null
+++ b/patches.renesas/0777-media-v4l-vsp1-sru-Fix-the-intensity-control-default.patch
@@ -0,0 +1,53 @@
+From 4c1e78b8096fe5396353349d746ada5afff13722 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 21 May 2014 19:00:05 -0300
+Subject: [media] v4l: vsp1: sru: Fix the intensity control default value
+
+The default value isn't set and defaults to 0, which isn't in the 1-6
+min-max range. Fix it by setting the default value to 1.
+
+This shoud have been caught when checking the control handler error
+field at initialization time, but the check was missing. Add it.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit a1606102dafe6942905e97a88ceea9a60e1a2c7d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_sru.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c
+index aa0e04c56f3f..18e127accf25 100644
+--- a/drivers/media/platform/vsp1/vsp1_sru.c
++++ b/drivers/media/platform/vsp1/vsp1_sru.c
+@@ -67,6 +67,7 @@ static const struct v4l2_ctrl_config sru_intensity_control = {
+ .type = V4L2_CTRL_TYPE_INTEGER,
+ .min = 1,
+ .max = 6,
++ .def = 1,
+ .step = 1,
+ };
+
+@@ -348,8 +349,17 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1)
+ /* Initialize the control handler. */
+ v4l2_ctrl_handler_init(&sru->ctrls, 1);
+ v4l2_ctrl_new_custom(&sru->ctrls, &sru_intensity_control, NULL);
+- v4l2_ctrl_handler_setup(&sru->ctrls);
++
+ sru->entity.subdev.ctrl_handler = &sru->ctrls;
+
++ if (sru->ctrls.error) {
++ dev_err(vsp1->dev, "sru: failed to initialize controls\n");
++ ret = sru->ctrls.error;
++ vsp1_entity_destroy(&sru->entity);
++ return ERR_PTR(ret);
++ }
++
++ v4l2_ctrl_handler_setup(&sru->ctrls);
++
+ return sru;
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0778-media-v4l-vsp1-sru-Make-the-intensity-controllable-d.patch b/patches.renesas/0778-media-v4l-vsp1-sru-Make-the-intensity-controllable-d.patch
new file mode 100644
index 00000000000000..dca633d0156689
--- /dev/null
+++ b/patches.renesas/0778-media-v4l-vsp1-sru-Make-the-intensity-controllable-d.patch
@@ -0,0 +1,195 @@
+From 3697a459a5f6d05a073f312be4ec1bba7a77ce21 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Sat, 31 May 2014 20:30:11 -0300
+Subject: [media] v4l: vsp1: sru: Make the intensity controllable during
+ streaming
+
+The control value is currently stored in the SRU structure by the
+control set handler and written to the hardware at stream on time,
+making control set during streaming ineffective. Fix it by writing to
+the registers from within the control set handler.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 58f896d859ce555dd3684f439f8a65bfda437533)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_regs.h | 2 +
+ drivers/media/platform/vsp1/vsp1_sru.c | 101 +++++++++++++++++++-------------
+ drivers/media/platform/vsp1/vsp1_sru.h | 1 -
+ 3 files changed, 61 insertions(+), 43 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h
+index 3e74b44286f6..55f163d32d15 100644
+--- a/drivers/media/platform/vsp1/vsp1_regs.h
++++ b/drivers/media/platform/vsp1/vsp1_regs.h
+@@ -336,7 +336,9 @@
+ */
+
+ #define VI6_SRU_CTRL0 0x2200
++#define VI6_SRU_CTRL0_PARAM0_MASK (0x1ff << 16)
+ #define VI6_SRU_CTRL0_PARAM0_SHIFT 16
++#define VI6_SRU_CTRL0_PARAM1_MASK (0x1f << 8)
+ #define VI6_SRU_CTRL0_PARAM1_SHIFT 8
+ #define VI6_SRU_CTRL0_MODE_UPSCALE (4 << 4)
+ #define VI6_SRU_CTRL0_PARAM2 (1 << 3)
+diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c
+index 18e127accf25..b7d3c8b9f189 100644
+--- a/drivers/media/platform/vsp1/vsp1_sru.c
++++ b/drivers/media/platform/vsp1/vsp1_sru.c
+@@ -42,39 +42,6 @@ static inline void vsp1_sru_write(struct vsp1_sru *sru, u32 reg, u32 data)
+
+ #define V4L2_CID_VSP1_SRU_INTENSITY (V4L2_CID_USER_BASE + 1)
+
+-static int sru_s_ctrl(struct v4l2_ctrl *ctrl)
+-{
+- struct vsp1_sru *sru =
+- container_of(ctrl->handler, struct vsp1_sru, ctrls);
+-
+- switch (ctrl->id) {
+- case V4L2_CID_VSP1_SRU_INTENSITY:
+- sru->intensity = ctrl->val;
+- break;
+- }
+-
+- return 0;
+-}
+-
+-static const struct v4l2_ctrl_ops sru_ctrl_ops = {
+- .s_ctrl = sru_s_ctrl,
+-};
+-
+-static const struct v4l2_ctrl_config sru_intensity_control = {
+- .ops = &sru_ctrl_ops,
+- .id = V4L2_CID_VSP1_SRU_INTENSITY,
+- .name = "Intensity",
+- .type = V4L2_CTRL_TYPE_INTEGER,
+- .min = 1,
+- .max = 6,
+- .def = 1,
+- .step = 1,
+-};
+-
+-/* -----------------------------------------------------------------------------
+- * V4L2 Subdevice Core Operations
+- */
+-
+ struct vsp1_sru_param {
+ u32 ctrl0;
+ u32 ctrl2;
+@@ -111,22 +78,66 @@ static const struct vsp1_sru_param vsp1_sru_params[] = {
+ },
+ };
+
++static int sru_s_ctrl(struct v4l2_ctrl *ctrl)
++{
++ struct vsp1_sru *sru =
++ container_of(ctrl->handler, struct vsp1_sru, ctrls);
++ const struct vsp1_sru_param *param;
++ u32 value;
++
++ switch (ctrl->id) {
++ case V4L2_CID_VSP1_SRU_INTENSITY:
++ param = &vsp1_sru_params[ctrl->val - 1];
++
++ value = vsp1_sru_read(sru, VI6_SRU_CTRL0);
++ value &= ~(VI6_SRU_CTRL0_PARAM0_MASK |
++ VI6_SRU_CTRL0_PARAM1_MASK);
++ value |= param->ctrl0;
++ vsp1_sru_write(sru, VI6_SRU_CTRL0, value);
++
++ vsp1_sru_write(sru, VI6_SRU_CTRL2, param->ctrl2);
++ break;
++ }
++
++ return 0;
++}
++
++static const struct v4l2_ctrl_ops sru_ctrl_ops = {
++ .s_ctrl = sru_s_ctrl,
++};
++
++static const struct v4l2_ctrl_config sru_intensity_control = {
++ .ops = &sru_ctrl_ops,
++ .id = V4L2_CID_VSP1_SRU_INTENSITY,
++ .name = "Intensity",
++ .type = V4L2_CTRL_TYPE_INTEGER,
++ .min = 1,
++ .max = 6,
++ .def = 1,
++ .step = 1,
++};
++
++/* -----------------------------------------------------------------------------
++ * V4L2 Subdevice Core Operations
++ */
++
+ static int sru_s_stream(struct v4l2_subdev *subdev, int enable)
+ {
+ struct vsp1_sru *sru = to_sru(subdev);
+- const struct vsp1_sru_param *param;
+ struct v4l2_mbus_framefmt *input;
+ struct v4l2_mbus_framefmt *output;
+- bool upscale;
+ u32 ctrl0;
++ int ret;
++
++ ret = vsp1_entity_set_streaming(&sru->entity, enable);
++ if (ret < 0)
++ return ret;
+
+ if (!enable)
+ return 0;
+
+ input = &sru->entity.formats[SRU_PAD_SINK];
+ output = &sru->entity.formats[SRU_PAD_SOURCE];
+- upscale = input->width != output->width;
+- param = &vsp1_sru_params[sru->intensity];
+
+ if (input->code == V4L2_MBUS_FMT_ARGB8888_1X32)
+ ctrl0 = VI6_SRU_CTRL0_PARAM2 | VI6_SRU_CTRL0_PARAM3
+@@ -134,10 +145,18 @@ static int sru_s_stream(struct v4l2_subdev *subdev, int enable)
+ else
+ ctrl0 = VI6_SRU_CTRL0_PARAM3;
+
+- vsp1_sru_write(sru, VI6_SRU_CTRL0, param->ctrl0 | ctrl0 |
+- (upscale ? VI6_SRU_CTRL0_MODE_UPSCALE : 0));
++ if (input->width != output->width)
++ ctrl0 |= VI6_SRU_CTRL0_MODE_UPSCALE;
++
++ /* Take the control handler lock to ensure that the CTRL0 value won't be
++ * changed behind our back by a set control operation.
++ */
++ mutex_lock(sru->ctrls.lock);
++ ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0)
++ & (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK);
++ mutex_unlock(sru->ctrls.lock);
++
+ vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5);
+- vsp1_sru_write(sru, VI6_SRU_CTRL2, param->ctrl2);
+
+ return 0;
+ }
+@@ -359,7 +378,5 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1)
+ return ERR_PTR(ret);
+ }
+
+- v4l2_ctrl_handler_setup(&sru->ctrls);
+-
+ return sru;
+ }
+diff --git a/drivers/media/platform/vsp1/vsp1_sru.h b/drivers/media/platform/vsp1/vsp1_sru.h
+index 381870b74780..b6768bf3dc47 100644
+--- a/drivers/media/platform/vsp1/vsp1_sru.h
++++ b/drivers/media/platform/vsp1/vsp1_sru.h
+@@ -28,7 +28,6 @@ struct vsp1_sru {
+ struct vsp1_entity entity;
+
+ struct v4l2_ctrl_handler ctrls;
+- unsigned int intensity;
+ };
+
+ static inline struct vsp1_sru *to_sru(struct v4l2_subdev *subdev)
+--
+2.1.2
+
diff --git a/patches.renesas/0779-media-v4l-vsp1-wpf-Simplify-cast-to-pipeline-structu.patch b/patches.renesas/0779-media-v4l-vsp1-wpf-Simplify-cast-to-pipeline-structu.patch
new file mode 100644
index 00000000000000..55bd37a0cdd95e
--- /dev/null
+++ b/patches.renesas/0779-media-v4l-vsp1-wpf-Simplify-cast-to-pipeline-structu.patch
@@ -0,0 +1,34 @@
+From c48ecd0468431136c63521b711089a6fa146aa7b Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 27 May 2014 20:35:36 -0300
+Subject: [media] v4l: vsp1: wpf: Simplify cast to pipeline structure
+
+Use the subdev pointer directly to_vsp1_pipeline() macro instead of
+casting from the subdev to the wpf object and back to the subdev.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 5aeb01adbea81e858318072097d98fc44578c7be)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_wpf.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
+index 36c479362f8c..591f09ca3aff 100644
+--- a/drivers/media/platform/vsp1/vsp1_wpf.c
++++ b/drivers/media/platform/vsp1/vsp1_wpf.c
+@@ -44,9 +44,8 @@ static inline void vsp1_wpf_write(struct vsp1_rwpf *wpf, u32 reg, u32 data)
+
+ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
+ {
++ struct vsp1_pipeline *pipe = to_vsp1_pipeline(&subdev->entity);
+ struct vsp1_rwpf *wpf = to_rwpf(subdev);
+- struct vsp1_pipeline *pipe =
+- to_vsp1_pipeline(&wpf->entity.subdev.entity);
+ struct vsp1_device *vsp1 = wpf->entity.vsp1;
+ const struct v4l2_rect *crop = &wpf->crop;
+ unsigned int i;
+--
+2.1.2
+
diff --git a/patches.renesas/0780-media-v4l-vsp1-wpf-Clear-RPF-to-WPF-association-at-s.patch b/patches.renesas/0780-media-v4l-vsp1-wpf-Clear-RPF-to-WPF-association-at-s.patch
new file mode 100644
index 00000000000000..edc8bc7102e174
--- /dev/null
+++ b/patches.renesas/0780-media-v4l-vsp1-wpf-Clear-RPF-to-WPF-association-at-s.patch
@@ -0,0 +1,40 @@
+From 83ec3513da89e0c00efff9346c2acf6af6aadb2d Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 28 May 2014 13:10:33 -0300
+Subject: [media] v4l: vsp1: wpf: Clear RPF to WPF association at stream off
+ time
+
+The VSP1 stores the video pipelines' input (RPF) to output (WPF)
+mappings in a WPF register. An RPF must never be associated with
+multiple WPFs, even if all of those WPFs but one are unused, otherwise
+the hardware won't function properly.
+
+The driver doesn't ensure this correctly as it never clears the
+mappings. An RPF used with one WPF and later with a different WPF will
+lead to malfunction, as it will be associated with two WPFs. Clear the
+mappings at stream off time to fix this.
+
+Reported-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit d6c71e8ceb9fe79aaf9c2f73af5cb2ef93526b0d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_wpf.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
+index 591f09ca3aff..d33086530778 100644
+--- a/drivers/media/platform/vsp1/vsp1_wpf.c
++++ b/drivers/media/platform/vsp1/vsp1_wpf.c
+@@ -54,6 +54,7 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
+
+ if (!enable) {
+ vsp1_write(vsp1, VI6_WPF_IRQ_ENB(wpf->entity.index), 0);
++ vsp1_wpf_write(wpf, VI6_WPF_SRCRPF, 0);
+ return 0;
+ }
+
+--
+2.1.2
+
diff --git a/patches.renesas/0781-media-v4l-vsp1-Switch-to-XRGB-formats.patch b/patches.renesas/0781-media-v4l-vsp1-Switch-to-XRGB-formats.patch
new file mode 100644
index 00000000000000..96b7ffad6ef4fc
--- /dev/null
+++ b/patches.renesas/0781-media-v4l-vsp1-Switch-to-XRGB-formats.patch
@@ -0,0 +1,84 @@
+From 540f5f407cedbe0b057478689c63d0da5f81838e Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 26 May 2014 19:57:21 -0300
+Subject: [media] v4l: vsp1: Switch to XRGB formats
+
+The driver ignores the alpha component on output video nodes and
+hardcodes the alpha component to 0 on capture video nodes. Make this
+explicit by exposing XRGB formats.
+
+Compatibility with existing userspace applications is handled by
+selecting the XRGB format corresponding to the requested old RGB format.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 56bfef3e72cf4a98d0e8f56129673146733c1366)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_video.c | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
+index 062e13d00088..8c286e8a2638 100644
+--- a/drivers/media/platform/vsp1/vsp1_video.c
++++ b/drivers/media/platform/vsp1/vsp1_video.c
+@@ -51,11 +51,11 @@ static const struct vsp1_format_info vsp1_video_formats[] = {
+ VI6_FMT_RGB_332, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 8, 0, 0 }, false, false, 1, 1 },
+- { V4L2_PIX_FMT_RGB444, V4L2_MBUS_FMT_ARGB8888_1X32,
++ { V4L2_PIX_FMT_XRGB444, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_XRGB_4444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+ 1, { 16, 0, 0 }, false, false, 1, 1 },
+- { V4L2_PIX_FMT_RGB555, V4L2_MBUS_FMT_ARGB8888_1X32,
++ { V4L2_PIX_FMT_XRGB555, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_XRGB_1555, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+ 1, { 16, 0, 0 }, false, false, 1, 1 },
+@@ -71,10 +71,10 @@ static const struct vsp1_format_info vsp1_video_formats[] = {
+ VI6_FMT_RGB_888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 24, 0, 0 }, false, false, 1, 1 },
+- { V4L2_PIX_FMT_BGR32, V4L2_MBUS_FMT_ARGB8888_1X32,
++ { V4L2_PIX_FMT_XBGR32, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
+ 1, { 32, 0, 0 }, false, false, 1, 1 },
+- { V4L2_PIX_FMT_RGB32, V4L2_MBUS_FMT_ARGB8888_1X32,
++ { V4L2_PIX_FMT_XRGB32, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+ 1, { 32, 0, 0 }, false, false, 1, 1 },
+@@ -181,11 +181,29 @@ static int __vsp1_video_try_format(struct vsp1_video *video,
+ struct v4l2_pix_format_mplane *pix,
+ const struct vsp1_format_info **fmtinfo)
+ {
++ static const u32 xrgb_formats[][2] = {
++ { V4L2_PIX_FMT_RGB444, V4L2_PIX_FMT_XRGB444 },
++ { V4L2_PIX_FMT_RGB555, V4L2_PIX_FMT_XRGB555 },
++ { V4L2_PIX_FMT_BGR32, V4L2_PIX_FMT_XBGR32 },
++ { V4L2_PIX_FMT_RGB32, V4L2_PIX_FMT_XRGB32 },
++ };
++
+ const struct vsp1_format_info *info;
+ unsigned int width = pix->width;
+ unsigned int height = pix->height;
+ unsigned int i;
+
++ /* Backward compatibility: replace deprecated RGB formats by their XRGB
++ * equivalent. This selects the format older userspace applications want
++ * while still exposing the new format.
++ */
++ for (i = 0; i < ARRAY_SIZE(xrgb_formats); ++i) {
++ if (xrgb_formats[i][0] == pix->pixelformat) {
++ pix->pixelformat = xrgb_formats[i][1];
++ break;
++ }
++ }
++
+ /* Retrieve format information and select the default format if the
+ * requested format isn't supported.
+ */
+--
+2.1.2
+
diff --git a/patches.renesas/0782-media-v4l-vsp1-Add-alpha-channel-support-to-the-memo.patch b/patches.renesas/0782-media-v4l-vsp1-Add-alpha-channel-support-to-the-memo.patch
new file mode 100644
index 00000000000000..e7585241f0fbeb
--- /dev/null
+++ b/patches.renesas/0782-media-v4l-vsp1-Add-alpha-channel-support-to-the-memo.patch
@@ -0,0 +1,182 @@
+From f975561360d5c386774563bcaeaf04502c5a4e23 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 26 May 2014 20:12:53 -0300
+Subject: [media] v4l: vsp1: Add alpha channel support to the memory ports
+
+Support ARGB formats on the RPF side by reading the alpha component from
+memory and on the WPF side by writing it to memory.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 7a52b6dea8e9559428149fbed0cddd587004006e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_rpf.c | 8 ++++--
+ drivers/media/platform/vsp1/vsp1_video.c | 49 +++++++++++++++++++++-----------
+ drivers/media/platform/vsp1/vsp1_video.h | 2 ++
+ drivers/media/platform/vsp1/vsp1_wpf.c | 2 ++
+ 4 files changed, 41 insertions(+), 20 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c
+index 9b3fc70e18f0..2824f5354f55 100644
+--- a/drivers/media/platform/vsp1/vsp1_rpf.c
++++ b/drivers/media/platform/vsp1/vsp1_rpf.c
+@@ -101,10 +101,12 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable)
+ (rpf->location.left << VI6_RPF_LOC_HCOORD_SHIFT) |
+ (rpf->location.top << VI6_RPF_LOC_VCOORD_SHIFT));
+
+- /* Disable alpha, mask and color key. Set the alpha channel to a fixed
+- * value of 255.
++ /* Use the alpha channel (extended to 8 bits) when available or a
++ * hardcoded 255 value otherwise. Disable color keying.
+ */
+- vsp1_rpf_write(rpf, VI6_RPF_ALPH_SEL, VI6_RPF_ALPH_SEL_ASEL_FIXED);
++ vsp1_rpf_write(rpf, VI6_RPF_ALPH_SEL, VI6_RPF_ALPH_SEL_AEXT_EXT |
++ (fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED
++ : VI6_RPF_ALPH_SEL_ASEL_FIXED));
+ vsp1_rpf_write(rpf, VI6_RPF_VRTCOL_SET,
+ 255 << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);
+ vsp1_rpf_write(rpf, VI6_RPF_MSK_CTRL, 0);
+diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
+index 8c286e8a2638..10f8944f0c13 100644
+--- a/drivers/media/platform/vsp1/vsp1_video.c
++++ b/drivers/media/platform/vsp1/vsp1_video.c
+@@ -50,70 +50,85 @@ static const struct vsp1_format_info vsp1_video_formats[] = {
+ { V4L2_PIX_FMT_RGB332, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_RGB_332, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 1, { 8, 0, 0 }, false, false, 1, 1 },
++ 1, { 8, 0, 0 }, false, false, 1, 1, false },
++ { V4L2_PIX_FMT_ARGB444, V4L2_MBUS_FMT_ARGB8888_1X32,
++ VI6_FMT_ARGB_4444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
++ VI6_RPF_DSWAP_P_WDS,
++ 1, { 16, 0, 0 }, false, false, 1, 1, true },
+ { V4L2_PIX_FMT_XRGB444, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_XRGB_4444, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+- 1, { 16, 0, 0 }, false, false, 1, 1 },
++ 1, { 16, 0, 0 }, false, false, 1, 1, true },
++ { V4L2_PIX_FMT_ARGB555, V4L2_MBUS_FMT_ARGB8888_1X32,
++ VI6_FMT_ARGB_1555, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
++ VI6_RPF_DSWAP_P_WDS,
++ 1, { 16, 0, 0 }, false, false, 1, 1, true },
+ { V4L2_PIX_FMT_XRGB555, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_XRGB_1555, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+- 1, { 16, 0, 0 }, false, false, 1, 1 },
++ 1, { 16, 0, 0 }, false, false, 1, 1, false },
+ { V4L2_PIX_FMT_RGB565, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_RGB_565, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS,
+- 1, { 16, 0, 0 }, false, false, 1, 1 },
++ 1, { 16, 0, 0 }, false, false, 1, 1, false },
+ { V4L2_PIX_FMT_BGR24, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_BGR_888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 1, { 24, 0, 0 }, false, false, 1, 1 },
++ 1, { 24, 0, 0 }, false, false, 1, 1, false },
+ { V4L2_PIX_FMT_RGB24, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_RGB_888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 1, { 24, 0, 0 }, false, false, 1, 1 },
++ 1, { 24, 0, 0 }, false, false, 1, 1, false },
++ { V4L2_PIX_FMT_ABGR32, V4L2_MBUS_FMT_ARGB8888_1X32,
++ VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
++ 1, { 32, 0, 0 }, false, false, 1, 1, true },
+ { V4L2_PIX_FMT_XBGR32, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS,
+- 1, { 32, 0, 0 }, false, false, 1, 1 },
++ 1, { 32, 0, 0 }, false, false, 1, 1, false },
++ { V4L2_PIX_FMT_ARGB32, V4L2_MBUS_FMT_ARGB8888_1X32,
++ VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
++ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
++ 1, { 32, 0, 0 }, false, false, 1, 1, true },
+ { V4L2_PIX_FMT_XRGB32, V4L2_MBUS_FMT_ARGB8888_1X32,
+ VI6_FMT_ARGB_8888, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 1, { 32, 0, 0 }, false, false, 1, 1 },
++ 1, { 32, 0, 0 }, false, false, 1, 1, false },
+ { V4L2_PIX_FMT_UYVY, V4L2_MBUS_FMT_AYUV8_1X32,
+ VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 1, { 16, 0, 0 }, false, false, 2, 1 },
++ 1, { 16, 0, 0 }, false, false, 2, 1, false },
+ { V4L2_PIX_FMT_VYUY, V4L2_MBUS_FMT_AYUV8_1X32,
+ VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 1, { 16, 0, 0 }, false, true, 2, 1 },
++ 1, { 16, 0, 0 }, false, true, 2, 1, false },
+ { V4L2_PIX_FMT_YUYV, V4L2_MBUS_FMT_AYUV8_1X32,
+ VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 1, { 16, 0, 0 }, true, false, 2, 1 },
++ 1, { 16, 0, 0 }, true, false, 2, 1, false },
+ { V4L2_PIX_FMT_YVYU, V4L2_MBUS_FMT_AYUV8_1X32,
+ VI6_FMT_YUYV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 1, { 16, 0, 0 }, true, true, 2, 1 },
++ 1, { 16, 0, 0 }, true, true, 2, 1, false },
+ { V4L2_PIX_FMT_NV12M, V4L2_MBUS_FMT_AYUV8_1X32,
+ VI6_FMT_Y_UV_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 2, { 8, 16, 0 }, false, false, 2, 2 },
++ 2, { 8, 16, 0 }, false, false, 2, 2, false },
+ { V4L2_PIX_FMT_NV21M, V4L2_MBUS_FMT_AYUV8_1X32,
+ VI6_FMT_Y_UV_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 2, { 8, 16, 0 }, false, true, 2, 2 },
++ 2, { 8, 16, 0 }, false, true, 2, 2, false },
+ { V4L2_PIX_FMT_NV16M, V4L2_MBUS_FMT_AYUV8_1X32,
+ VI6_FMT_Y_UV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 2, { 8, 16, 0 }, false, false, 2, 1 },
++ 2, { 8, 16, 0 }, false, false, 2, 1, false },
+ { V4L2_PIX_FMT_NV61M, V4L2_MBUS_FMT_AYUV8_1X32,
+ VI6_FMT_Y_UV_422, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 2, { 8, 16, 0 }, false, true, 2, 1 },
++ 2, { 8, 16, 0 }, false, true, 2, 1, false },
+ { V4L2_PIX_FMT_YUV420M, V4L2_MBUS_FMT_AYUV8_1X32,
+ VI6_FMT_Y_U_V_420, VI6_RPF_DSWAP_P_LLS | VI6_RPF_DSWAP_P_LWS |
+ VI6_RPF_DSWAP_P_WDS | VI6_RPF_DSWAP_P_BTS,
+- 3, { 8, 8, 8 }, false, false, 2, 2 },
++ 3, { 8, 8, 8 }, false, false, 2, 2, false },
+ };
+
+ /*
+diff --git a/drivers/media/platform/vsp1/vsp1_video.h b/drivers/media/platform/vsp1/vsp1_video.h
+index 8464cd913760..1c3ec53914b6 100644
+--- a/drivers/media/platform/vsp1/vsp1_video.h
++++ b/drivers/media/platform/vsp1/vsp1_video.h
+@@ -33,6 +33,7 @@ struct vsp1_video;
+ * @swap_uv: the U and V components are swapped (V comes before U)
+ * @hsub: horizontal subsampling factor
+ * @vsub: vertical subsampling factor
++ * @alpha: has an alpha channel
+ */
+ struct vsp1_format_info {
+ u32 fourcc;
+@@ -45,6 +46,7 @@ struct vsp1_format_info {
+ bool swap_uv;
+ unsigned int hsub;
+ unsigned int vsub;
++ bool alpha;
+ };
+
+ enum vsp1_pipeline_state {
+diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
+index d33086530778..a2ba10721f1b 100644
+--- a/drivers/media/platform/vsp1/vsp1_wpf.c
++++ b/drivers/media/platform/vsp1/vsp1_wpf.c
+@@ -99,6 +99,8 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
+
+ outfmt = fmtinfo->hwfmt << VI6_WPF_OUTFMT_WRFMT_SHIFT;
+
++ if (fmtinfo->alpha)
++ outfmt |= VI6_WPF_OUTFMT_PXA;
+ if (fmtinfo->swap_yc)
+ outfmt |= VI6_WPF_OUTFMT_SPYCS;
+ if (fmtinfo->swap_uv)
+--
+2.1.2
+
diff --git a/patches.renesas/0783-media-v4l-vsp1-Add-V4L2_CID_ALPHA_COMPONENT-control-.patch b/patches.renesas/0783-media-v4l-vsp1-Add-V4L2_CID_ALPHA_COMPONENT-control-.patch
new file mode 100644
index 00000000000000..27a005bcfdb0d1
--- /dev/null
+++ b/patches.renesas/0783-media-v4l-vsp1-Add-V4L2_CID_ALPHA_COMPONENT-control-.patch
@@ -0,0 +1,216 @@
+From 7fa2f015c02889f190b18ff459f6cf50e8497891 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 21 May 2014 19:00:05 -0300
+Subject: [media] v4l: vsp1: Add V4L2_CID_ALPHA_COMPONENT control support
+
+The control is used to configure the fixed alpha channel value, when
+reading from memory in the RPF or writing to memory in the WPF.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 7578c204620c8e25ec6e4849cd12098f831a14d0)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_rpf.c | 52 ++++++++++++++++++++++++++++---
+ drivers/media/platform/vsp1/vsp1_rwpf.h | 2 ++
+ drivers/media/platform/vsp1/vsp1_wpf.c | 54 +++++++++++++++++++++++++++++++++
+ 3 files changed, 104 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c
+index 2824f5354f55..576779f2332b 100644
+--- a/drivers/media/platform/vsp1/vsp1_rpf.c
++++ b/drivers/media/platform/vsp1/vsp1_rpf.c
+@@ -39,6 +39,32 @@ static inline void vsp1_rpf_write(struct vsp1_rwpf *rpf, u32 reg, u32 data)
+ }
+
+ /* -----------------------------------------------------------------------------
++ * Controls
++ */
++
++static int rpf_s_ctrl(struct v4l2_ctrl *ctrl)
++{
++ struct vsp1_rwpf *rpf =
++ container_of(ctrl->handler, struct vsp1_rwpf, ctrls);
++
++ if (!vsp1_entity_is_streaming(&rpf->entity))
++ return 0;
++
++ switch (ctrl->id) {
++ case V4L2_CID_ALPHA_COMPONENT:
++ vsp1_rpf_write(rpf, VI6_RPF_VRTCOL_SET,
++ ctrl->val << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);
++ break;
++ }
++
++ return 0;
++}
++
++static const struct v4l2_ctrl_ops rpf_ctrl_ops = {
++ .s_ctrl = rpf_s_ctrl,
++};
++
++/* -----------------------------------------------------------------------------
+ * V4L2 Subdevice Core Operations
+ */
+
+@@ -50,6 +76,11 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable)
+ const struct v4l2_rect *crop = &rpf->crop;
+ u32 pstride;
+ u32 infmt;
++ int ret;
++
++ ret = vsp1_entity_set_streaming(&rpf->entity, enable);
++ if (ret < 0)
++ return ret;
+
+ if (!enable)
+ return 0;
+@@ -101,14 +132,13 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable)
+ (rpf->location.left << VI6_RPF_LOC_HCOORD_SHIFT) |
+ (rpf->location.top << VI6_RPF_LOC_VCOORD_SHIFT));
+
+- /* Use the alpha channel (extended to 8 bits) when available or a
+- * hardcoded 255 value otherwise. Disable color keying.
++ /* Use the alpha channel (extended to 8 bits) when available or an
++ * alpha value set through the V4L2_CID_ALPHA_COMPONENT control
++ * otherwise. Disable color keying.
+ */
+ vsp1_rpf_write(rpf, VI6_RPF_ALPH_SEL, VI6_RPF_ALPH_SEL_AEXT_EXT |
+ (fmtinfo->alpha ? VI6_RPF_ALPH_SEL_ASEL_PACKED
+ : VI6_RPF_ALPH_SEL_ASEL_FIXED));
+- vsp1_rpf_write(rpf, VI6_RPF_VRTCOL_SET,
+- 255 << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);
+ vsp1_rpf_write(rpf, VI6_RPF_MSK_CTRL, 0);
+ vsp1_rpf_write(rpf, VI6_RPF_CKEY_CTRL, 0);
+
+@@ -198,6 +228,20 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index)
+
+ vsp1_entity_init_formats(subdev, NULL);
+
++ /* Initialize the control handler. */
++ v4l2_ctrl_handler_init(&rpf->ctrls, 1);
++ v4l2_ctrl_new_std(&rpf->ctrls, &rpf_ctrl_ops, V4L2_CID_ALPHA_COMPONENT,
++ 0, 255, 1, 255);
++
++ rpf->entity.subdev.ctrl_handler = &rpf->ctrls;
++
++ if (rpf->ctrls.error) {
++ dev_err(vsp1->dev, "rpf%u: failed to initialize controls\n",
++ index);
++ ret = rpf->ctrls.error;
++ goto error;
++ }
++
+ /* Initialize the video device. */
+ video = &rpf->video;
+
+diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h
+index b4fb65e58770..28dd9e7b3838 100644
+--- a/drivers/media/platform/vsp1/vsp1_rwpf.h
++++ b/drivers/media/platform/vsp1/vsp1_rwpf.h
+@@ -14,6 +14,7 @@
+ #define __VSP1_RWPF_H__
+
+ #include <media/media-entity.h>
++#include <media/v4l2-ctrls.h>
+ #include <media/v4l2-subdev.h>
+
+ #include "vsp1.h"
+@@ -26,6 +27,7 @@
+ struct vsp1_rwpf {
+ struct vsp1_entity entity;
+ struct vsp1_video video;
++ struct v4l2_ctrl_handler ctrls;
+
+ unsigned int max_width;
+ unsigned int max_height;
+diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c
+index a2ba10721f1b..6e057762c933 100644
+--- a/drivers/media/platform/vsp1/vsp1_wpf.c
++++ b/drivers/media/platform/vsp1/vsp1_wpf.c
+@@ -39,6 +39,35 @@ static inline void vsp1_wpf_write(struct vsp1_rwpf *wpf, u32 reg, u32 data)
+ }
+
+ /* -----------------------------------------------------------------------------
++ * Controls
++ */
++
++static int wpf_s_ctrl(struct v4l2_ctrl *ctrl)
++{
++ struct vsp1_rwpf *wpf =
++ container_of(ctrl->handler, struct vsp1_rwpf, ctrls);
++ u32 value;
++
++ if (!vsp1_entity_is_streaming(&wpf->entity))
++ return 0;
++
++ switch (ctrl->id) {
++ case V4L2_CID_ALPHA_COMPONENT:
++ value = vsp1_wpf_read(wpf, VI6_WPF_OUTFMT);
++ value &= ~VI6_WPF_OUTFMT_PDV_MASK;
++ value |= ctrl->val << VI6_WPF_OUTFMT_PDV_SHIFT;
++ vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, value);
++ break;
++ }
++
++ return 0;
++}
++
++static const struct v4l2_ctrl_ops wpf_ctrl_ops = {
++ .s_ctrl = wpf_s_ctrl,
++};
++
++/* -----------------------------------------------------------------------------
+ * V4L2 Subdevice Core Operations
+ */
+
+@@ -51,6 +80,11 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
+ unsigned int i;
+ u32 srcrpf = 0;
+ u32 outfmt = 0;
++ int ret;
++
++ ret = vsp1_entity_set_streaming(&wpf->entity, enable);
++ if (ret < 0)
++ return ret;
+
+ if (!enable) {
+ vsp1_write(vsp1, VI6_WPF_IRQ_ENB(wpf->entity.index), 0);
+@@ -113,7 +147,13 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable)
+ wpf->entity.formats[RWPF_PAD_SOURCE].code)
+ outfmt |= VI6_WPF_OUTFMT_CSC;
+
++ /* Take the control handler lock to ensure that the PDV value won't be
++ * changed behind our back by a set control operation.
++ */
++ mutex_lock(wpf->ctrls.lock);
++ outfmt |= vsp1_wpf_read(wpf, VI6_WPF_OUTFMT) & VI6_WPF_OUTFMT_PDV_MASK;
+ vsp1_wpf_write(wpf, VI6_WPF_OUTFMT, outfmt);
++ mutex_unlock(wpf->ctrls.lock);
+
+ vsp1_write(vsp1, VI6_DPR_WPF_FPORCH(wpf->entity.index),
+ VI6_DPR_WPF_FPORCH_FP_WPFN);
+@@ -209,6 +249,20 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
+
+ vsp1_entity_init_formats(subdev, NULL);
+
++ /* Initialize the control handler. */
++ v4l2_ctrl_handler_init(&wpf->ctrls, 1);
++ v4l2_ctrl_new_std(&wpf->ctrls, &wpf_ctrl_ops, V4L2_CID_ALPHA_COMPONENT,
++ 0, 255, 1, 255);
++
++ wpf->entity.subdev.ctrl_handler = &wpf->ctrls;
++
++ if (wpf->ctrls.error) {
++ dev_err(vsp1->dev, "wpf%u: failed to initialize controls\n",
++ index);
++ ret = wpf->ctrls.error;
++ goto error;
++ }
++
+ /* Initialize the video device. */
+ video = &wpf->video;
+
+--
+2.1.2
+
diff --git a/patches.renesas/0784-media-v4l-vsp1-bru-Support-premultiplied-alpha-at-th.patch b/patches.renesas/0784-media-v4l-vsp1-bru-Support-premultiplied-alpha-at-th.patch
new file mode 100644
index 00000000000000..171df25d9a1669
--- /dev/null
+++ b/patches.renesas/0784-media-v4l-vsp1-bru-Support-premultiplied-alpha-at-th.patch
@@ -0,0 +1,204 @@
+From 92f005b4133a37368837ae7d234ecc3b1732f74d Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 27 May 2014 20:35:36 -0300
+Subject: [media] v4l: vsp1: bru: Support premultiplied alpha at the BRU inputs
+
+Adjust the BRU blending formula to avoid the multiplication by alpha
+when the corresponding input format is premultiplied. As this requires
+access to the RPFs connected to the BRU inputs from the BRU module,
+store pointers to the RPFs in the BRU structure when validating the
+pipeline.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 6418b4d6e1f1d70199a93eeeed948be2229b9c1a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_bru.c | 27 ++++++++++++-------
+ drivers/media/platform/vsp1/vsp1_bru.h | 6 ++++-
+ drivers/media/platform/vsp1/vsp1_video.c | 45 +++++++++++++++++++-------------
+ 3 files changed, 50 insertions(+), 28 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c
+index f80695480060..d8d49fb7f5ff 100644
+--- a/drivers/media/platform/vsp1/vsp1_bru.c
++++ b/drivers/media/platform/vsp1/vsp1_bru.c
+@@ -18,6 +18,7 @@
+
+ #include "vsp1.h"
+ #include "vsp1_bru.h"
++#include "vsp1_rwpf.h"
+
+ #define BRU_MIN_SIZE 4U
+ #define BRU_MAX_SIZE 8190U
+@@ -40,11 +41,6 @@ static inline void vsp1_bru_write(struct vsp1_bru *bru, u32 reg, u32 data)
+ * V4L2 Subdevice Core Operations
+ */
+
+-static bool bru_is_input_enabled(struct vsp1_bru *bru, unsigned int input)
+-{
+- return media_entity_remote_pad(&bru->entity.pads[input]) != NULL;
+-}
+-
+ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
+ {
+ struct vsp1_bru *bru = to_bru(subdev);
+@@ -84,6 +80,7 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
+ VI6_BRU_ROP_AROP(VI6_ROP_NOP));
+
+ for (i = 0; i < 4; ++i) {
++ bool premultiplied = false;
+ u32 ctrl = 0;
+
+ /* Configure all Blend/ROP units corresponding to an enabled BRU
+@@ -91,11 +88,15 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
+ * disabled BRU inputs are used in ROP NOP mode to ignore the
+ * SRC input.
+ */
+- if (bru_is_input_enabled(bru, i))
++ if (bru->inputs[i].rpf) {
+ ctrl |= VI6_BRU_CTRL_RBC;
+- else
++
++ premultiplied = bru->inputs[i].rpf->video.format.flags
++ & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA;
++ } else {
+ ctrl |= VI6_BRU_CTRL_CROP(VI6_ROP_NOP)
+ | VI6_BRU_CTRL_AROP(VI6_ROP_NOP);
++ }
+
+ /* Select the virtual RPF as the Blend/ROP unit A DST input to
+ * serve as a background color.
+@@ -117,10 +118,18 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
+ *
+ * DSTc = DSTc * (1 - SRCa) + SRCc * SRCa
+ * DSTa = DSTa * (1 - SRCa) + SRCa
++ *
++ * when the SRC input isn't premultiplied, and to
++ *
++ * DSTc = DSTc * (1 - SRCa) + SRCc
++ * DSTa = DSTa * (1 - SRCa) + SRCa
++ *
++ * otherwise.
+ */
+ vsp1_bru_write(bru, VI6_BRU_BLD(i),
+ VI6_BRU_BLD_CCMDX_255_SRC_A |
+- VI6_BRU_BLD_CCMDY_SRC_A |
++ (premultiplied ? VI6_BRU_BLD_CCMDY_COEFY :
++ VI6_BRU_BLD_CCMDY_SRC_A) |
+ VI6_BRU_BLD_ACMDX_255_SRC_A |
+ VI6_BRU_BLD_ACMDY_COEFY |
+ (0xff << VI6_BRU_BLD_COEFY_SHIFT));
+@@ -192,7 +201,7 @@ static struct v4l2_rect *bru_get_compose(struct vsp1_bru *bru,
+ case V4L2_SUBDEV_FORMAT_TRY:
+ return v4l2_subdev_get_try_crop(fh, pad);
+ case V4L2_SUBDEV_FORMAT_ACTIVE:
+- return &bru->compose[pad];
++ return &bru->inputs[pad].compose;
+ default:
+ return NULL;
+ }
+diff --git a/drivers/media/platform/vsp1/vsp1_bru.h b/drivers/media/platform/vsp1/vsp1_bru.h
+index 37062704dbf6..5b03479c5982 100644
+--- a/drivers/media/platform/vsp1/vsp1_bru.h
++++ b/drivers/media/platform/vsp1/vsp1_bru.h
+@@ -19,6 +19,7 @@
+ #include "vsp1_entity.h"
+
+ struct vsp1_device;
++struct vsp1_rwpf;
+
+ #define BRU_PAD_SINK(n) (n)
+ #define BRU_PAD_SOURCE 4
+@@ -26,7 +27,10 @@ struct vsp1_device;
+ struct vsp1_bru {
+ struct vsp1_entity entity;
+
+- struct v4l2_rect compose[4];
++ struct {
++ struct vsp1_rwpf *rpf;
++ struct v4l2_rect compose;
++ } inputs[4];
+ };
+
+ static inline struct vsp1_bru *to_bru(struct v4l2_subdev *subdev)
+diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
+index 10f8944f0c13..2ef03f2f6b64 100644
+--- a/drivers/media/platform/vsp1/vsp1_video.c
++++ b/drivers/media/platform/vsp1/vsp1_video.c
+@@ -334,7 +334,10 @@ static int vsp1_pipeline_validate_branch(struct vsp1_rwpf *input,
+ */
+ if (entity->type == VSP1_ENTITY_BRU) {
+ struct vsp1_bru *bru = to_bru(&entity->subdev);
+- struct v4l2_rect *rect = &bru->compose[pad->index];
++ struct v4l2_rect *rect =
++ &bru->inputs[pad->index].compose;
++
++ bru->inputs[pad->index].rpf = input;
+
+ input->location.left = rect->left;
+ input->location.top = rect->top;
+@@ -373,6 +376,26 @@ static int vsp1_pipeline_validate_branch(struct vsp1_rwpf *input,
+ return 0;
+ }
+
++static void __vsp1_pipeline_cleanup(struct vsp1_pipeline *pipe)
++{
++ if (pipe->bru) {
++ struct vsp1_bru *bru = to_bru(&pipe->bru->subdev);
++ unsigned int i;
++
++ for (i = 0; i < ARRAY_SIZE(bru->inputs); ++i)
++ bru->inputs[i].rpf = NULL;
++ }
++
++ INIT_LIST_HEAD(&pipe->entities);
++ pipe->state = VSP1_PIPELINE_STOPPED;
++ pipe->buffers_ready = 0;
++ pipe->num_video = 0;
++ pipe->num_inputs = 0;
++ pipe->output = NULL;
++ pipe->bru = NULL;
++ pipe->lif = NULL;
++}
++
+ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
+ struct vsp1_video *video)
+ {
+@@ -437,13 +460,7 @@ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
+ return 0;
+
+ error:
+- INIT_LIST_HEAD(&pipe->entities);
+- pipe->buffers_ready = 0;
+- pipe->num_video = 0;
+- pipe->num_inputs = 0;
+- pipe->output = NULL;
+- pipe->bru = NULL;
+- pipe->lif = NULL;
++ __vsp1_pipeline_cleanup(pipe);
+ return ret;
+ }
+
+@@ -474,16 +491,8 @@ static void vsp1_pipeline_cleanup(struct vsp1_pipeline *pipe)
+ mutex_lock(&pipe->lock);
+
+ /* If we're the last user clean up the pipeline. */
+- if (--pipe->use_count == 0) {
+- INIT_LIST_HEAD(&pipe->entities);
+- pipe->state = VSP1_PIPELINE_STOPPED;
+- pipe->buffers_ready = 0;
+- pipe->num_video = 0;
+- pipe->num_inputs = 0;
+- pipe->output = NULL;
+- pipe->bru = NULL;
+- pipe->lif = NULL;
+- }
++ if (--pipe->use_count == 0)
++ __vsp1_pipeline_cleanup(pipe);
+
+ mutex_unlock(&pipe->lock);
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0785-media-v4l-vsp1-bru-Support-non-premultiplied-colors-.patch b/patches.renesas/0785-media-v4l-vsp1-bru-Support-non-premultiplied-colors-.patch
new file mode 100644
index 00000000000000..0d58d1af3b3f82
--- /dev/null
+++ b/patches.renesas/0785-media-v4l-vsp1-bru-Support-non-premultiplied-colors-.patch
@@ -0,0 +1,52 @@
+From 4061e797495dadd329dcdb5f482034b4d5f1dd76 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 27 May 2014 20:35:36 -0300
+Subject: [media] v4l: vsp1: bru: Support non-premultiplied colors at the BRU
+ output
+
+The BRU outputs premultiplied colors, enable color data normalization
+when the format configured at the output of the pipeline isn't
+premultiplied.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit 9aca813e1401dcafe1c0a9d3b03795e254571504)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_bru.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c
+index d8d49fb7f5ff..86b32bca408d 100644
+--- a/drivers/media/platform/vsp1/vsp1_bru.c
++++ b/drivers/media/platform/vsp1/vsp1_bru.c
+@@ -43,8 +43,10 @@ static inline void vsp1_bru_write(struct vsp1_bru *bru, u32 reg, u32 data)
+
+ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
+ {
++ struct vsp1_pipeline *pipe = to_vsp1_pipeline(&subdev->entity);
+ struct vsp1_bru *bru = to_bru(subdev);
+ struct v4l2_mbus_framefmt *format;
++ unsigned int flags;
+ unsigned int i;
+
+ if (!enable)
+@@ -58,8 +60,13 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
+ * to sane default values for now.
+ */
+
+- /* Disable both color data normalization and dithering. */
+- vsp1_bru_write(bru, VI6_BRU_INCTRL, 0);
++ /* Disable dithering and enable color data normalization unless the
++ * format at the pipeline output is premultiplied.
++ */
++ flags = pipe->output ? pipe->output->video.format.flags : 0;
++ vsp1_bru_write(bru, VI6_BRU_INCTRL,
++ flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ?
++ 0 : VI6_BRU_INCTRL_NRM);
+
+ /* Set the background position to cover the whole output image and
+ * set its color to opaque black.
+--
+2.1.2
+
diff --git a/patches.renesas/0786-media-v4l-vsp1-bru-Make-the-background-color-configu.patch b/patches.renesas/0786-media-v4l-vsp1-bru-Make-the-background-color-configu.patch
new file mode 100644
index 00000000000000..666bbfa39c451c
--- /dev/null
+++ b/patches.renesas/0786-media-v4l-vsp1-bru-Make-the-background-color-configu.patch
@@ -0,0 +1,127 @@
+From 0b326941bcd5ee3b87b82e92b49501274f01699d Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Tue, 27 May 2014 22:46:30 -0300
+Subject: [media] v4l: vsp1: bru: Make the background color configurable
+
+Expose the background color to userspace through the V4L2_CID_BG_COLOR
+control.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit a16e2794592b733d47f372f0cadcd9ff0f349ca9)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_bru.c | 51 ++++++++++++++++++++++++++++++----
+ drivers/media/platform/vsp1/vsp1_bru.h | 3 ++
+ 2 files changed, 49 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c
+index 86b32bca408d..a0c1984c733e 100644
+--- a/drivers/media/platform/vsp1/vsp1_bru.c
++++ b/drivers/media/platform/vsp1/vsp1_bru.c
+@@ -38,6 +38,32 @@ static inline void vsp1_bru_write(struct vsp1_bru *bru, u32 reg, u32 data)
+ }
+
+ /* -----------------------------------------------------------------------------
++ * Controls
++ */
++
++static int bru_s_ctrl(struct v4l2_ctrl *ctrl)
++{
++ struct vsp1_bru *bru =
++ container_of(ctrl->handler, struct vsp1_bru, ctrls);
++
++ if (!vsp1_entity_is_streaming(&bru->entity))
++ return 0;
++
++ switch (ctrl->id) {
++ case V4L2_CID_BG_COLOR:
++ vsp1_bru_write(bru, VI6_BRU_VIRRPF_COL, ctrl->val |
++ (0xff << VI6_BRU_VIRRPF_COL_A_SHIFT));
++ break;
++ }
++
++ return 0;
++}
++
++static const struct v4l2_ctrl_ops bru_ctrl_ops = {
++ .s_ctrl = bru_s_ctrl,
++};
++
++/* -----------------------------------------------------------------------------
+ * V4L2 Subdevice Core Operations
+ */
+
+@@ -48,6 +74,11 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
+ struct v4l2_mbus_framefmt *format;
+ unsigned int flags;
+ unsigned int i;
++ int ret;
++
++ ret = vsp1_entity_set_streaming(&bru->entity, enable);
++ if (ret < 0)
++ return ret;
+
+ if (!enable)
+ return 0;
+@@ -68,15 +99,11 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
+ flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ?
+ 0 : VI6_BRU_INCTRL_NRM);
+
+- /* Set the background position to cover the whole output image and
+- * set its color to opaque black.
+- */
++ /* Set the background position to cover the whole output image. */
+ vsp1_bru_write(bru, VI6_BRU_VIRRPF_SIZE,
+ (format->width << VI6_BRU_VIRRPF_SIZE_HSIZE_SHIFT) |
+ (format->height << VI6_BRU_VIRRPF_SIZE_VSIZE_SHIFT));
+ vsp1_bru_write(bru, VI6_BRU_VIRRPF_LOC, 0);
+- vsp1_bru_write(bru, VI6_BRU_VIRRPF_COL,
+- 0xff << VI6_BRU_VIRRPF_COL_A_SHIFT);
+
+ /* Route BRU input 1 as SRC input to the ROP unit and configure the ROP
+ * unit with a NOP operation to make BRU input 1 available as the
+@@ -407,5 +434,19 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1)
+
+ vsp1_entity_init_formats(subdev, NULL);
+
++ /* Initialize the control handler. */
++ v4l2_ctrl_handler_init(&bru->ctrls, 1);
++ v4l2_ctrl_new_std(&bru->ctrls, &bru_ctrl_ops, V4L2_CID_BG_COLOR,
++ 0, 0xffffff, 1, 0);
++
++ bru->entity.subdev.ctrl_handler = &bru->ctrls;
++
++ if (bru->ctrls.error) {
++ dev_err(vsp1->dev, "bru: failed to initialize controls\n");
++ ret = bru->ctrls.error;
++ vsp1_entity_destroy(&bru->entity);
++ return ERR_PTR(ret);
++ }
++
+ return bru;
+ }
+diff --git a/drivers/media/platform/vsp1/vsp1_bru.h b/drivers/media/platform/vsp1/vsp1_bru.h
+index 5b03479c5982..16b1c6554911 100644
+--- a/drivers/media/platform/vsp1/vsp1_bru.h
++++ b/drivers/media/platform/vsp1/vsp1_bru.h
+@@ -14,6 +14,7 @@
+ #define __VSP1_BRU_H__
+
+ #include <media/media-entity.h>
++#include <media/v4l2-ctrls.h>
+ #include <media/v4l2-subdev.h>
+
+ #include "vsp1_entity.h"
+@@ -27,6 +28,8 @@ struct vsp1_rwpf;
+ struct vsp1_bru {
+ struct vsp1_entity entity;
+
++ struct v4l2_ctrl_handler ctrls;
++
+ struct {
+ struct vsp1_rwpf *rpf;
+ struct v4l2_rect compose;
+--
+2.1.2
+
diff --git a/patches.renesas/0787-media-v4l-vsp1-uds-Fix-scaling-of-alpha-layer.patch b/patches.renesas/0787-media-v4l-vsp1-uds-Fix-scaling-of-alpha-layer.patch
new file mode 100644
index 00000000000000..25a079cf6a1f09
--- /dev/null
+++ b/patches.renesas/0787-media-v4l-vsp1-uds-Fix-scaling-of-alpha-layer.patch
@@ -0,0 +1,333 @@
+From 4c987cfe369674163a8d451e33d34bc0392dc84e Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Fri, 30 May 2014 21:45:48 -0300
+Subject: [media] v4l: vsp1: uds: Fix scaling of alpha layer
+
+Pixel color components can be scaled using either bilinear interpolation
+or a multitap filter. The multitap filter provides better results, but
+can't be selected when the alpha layer need to be scaled down by more
+than 1/2.
+
+Disable alpha scaling when the input has a fixed alpha value, and
+program the UDS to output a fixed alpha value in that case. This ensures
+the multitap filter will be used whenever possible.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+(cherry picked from commit bdc2df62ae38bbab044078f4d25a7a3d9e2379c9)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/media/platform/vsp1/vsp1_rpf.c | 4 +
+ drivers/media/platform/vsp1/vsp1_uds.c | 63 ++++++++++++++-----------
+ drivers/media/platform/vsp1/vsp1_uds.h | 6 +-
+ drivers/media/platform/vsp1/vsp1_video.c | 78 +++++++++++++++++++++++++++++--
+ drivers/media/platform/vsp1/vsp1_video.h | 6 ++
+ 5 files changed, 122 insertions(+), 35 deletions(-)
+
+--- a/drivers/media/platform/vsp1/vsp1_rpf.c
++++ b/drivers/media/platform/vsp1/vsp1_rpf.c
+@@ -46,6 +46,7 @@ static int rpf_s_ctrl(struct v4l2_ctrl *
+ {
+ struct vsp1_rwpf *rpf =
+ container_of(ctrl->handler, struct vsp1_rwpf, ctrls);
++ struct vsp1_pipeline *pipe;
+
+ if (!vsp1_entity_is_streaming(&rpf->entity))
+ return 0;
+@@ -54,6 +55,9 @@ static int rpf_s_ctrl(struct v4l2_ctrl *
+ case V4L2_CID_ALPHA_COMPONENT:
+ vsp1_rpf_write(rpf, VI6_RPF_VRTCOL_SET,
+ ctrl->val << VI6_RPF_VRTCOL_SET_LAYA_SHIFT);
++
++ pipe = to_vsp1_pipeline(&rpf->entity.subdev.entity);
++ vsp1_pipeline_propagate_alpha(pipe, &rpf->entity, ctrl->val);
+ break;
+ }
+
+--- a/drivers/media/platform/vsp1/vsp1_uds.c
++++ b/drivers/media/platform/vsp1/vsp1_uds.c
+@@ -45,6 +45,11 @@ static inline void vsp1_uds_write(struct
+ * Scaling Computation
+ */
+
++void vsp1_uds_set_alpha(struct vsp1_uds *uds, unsigned int alpha)
++{
++ vsp1_uds_write(uds, VI6_UDS_ALPVAL, alpha << VI6_UDS_ALPVAL_VAL0_SHIFT);
++}
++
+ /*
+ * uds_output_size - Return the output size for an input size and scaling ratio
+ * @input: input size in pixels
+@@ -105,49 +110,56 @@ static unsigned int uds_compute_ratio(un
+ return (input - 1) * 4096 / (output - 1);
+ }
+
+-static void uds_compute_ratios(struct vsp1_uds *uds)
+-{
+- struct v4l2_mbus_framefmt *input = &uds->entity.formats[UDS_PAD_SINK];
+- struct v4l2_mbus_framefmt *output =
+- &uds->entity.formats[UDS_PAD_SOURCE];
+-
+- uds->hscale = uds_compute_ratio(input->width, output->width);
+- uds->vscale = uds_compute_ratio(input->height, output->height);
+-
+- dev_dbg(uds->entity.vsp1->dev, "hscale %u vscale %u\n",
+- uds->hscale, uds->vscale);
+-}
+-
+ /* -----------------------------------------------------------------------------
+ * V4L2 Subdevice Core Operations
+ */
+
+ static int uds_s_stream(struct v4l2_subdev *subdev, int enable)
+ {
+- const struct v4l2_mbus_framefmt *format;
+ struct vsp1_uds *uds = to_uds(subdev);
++ const struct v4l2_mbus_framefmt *output;
++ const struct v4l2_mbus_framefmt *input;
++ unsigned int hscale;
++ unsigned int vscale;
++ bool multitap;
+
+ if (!enable)
+ return 0;
+
+- /* Enable multi-tap scaling. */
+- vsp1_uds_write(uds, VI6_UDS_CTRL, VI6_UDS_CTRL_AON | VI6_UDS_CTRL_BC);
++ input = &uds->entity.formats[UDS_PAD_SINK];
++ output = &uds->entity.formats[UDS_PAD_SOURCE];
++
++ hscale = uds_compute_ratio(input->width, output->width);
++ vscale = uds_compute_ratio(input->height, output->height);
++
++ dev_dbg(uds->entity.vsp1->dev, "hscale %u vscale %u\n", hscale, vscale);
++
++ /* Multi-tap scaling can't be enabled along with alpha scaling when
++ * scaling down with a factor lower than or equal to 1/2 in either
++ * direction.
++ */
++ if (uds->scale_alpha && (hscale >= 8192 || vscale >= 8192))
++ multitap = false;
++ else
++ multitap = true;
++
++ vsp1_uds_write(uds, VI6_UDS_CTRL,
++ (uds->scale_alpha ? VI6_UDS_CTRL_AON : 0) |
++ (multitap ? VI6_UDS_CTRL_BC : 0));
+
+ vsp1_uds_write(uds, VI6_UDS_PASS_BWIDTH,
+- (uds_passband_width(uds->hscale)
++ (uds_passband_width(hscale)
+ << VI6_UDS_PASS_BWIDTH_H_SHIFT) |
+- (uds_passband_width(uds->vscale)
++ (uds_passband_width(vscale)
+ << VI6_UDS_PASS_BWIDTH_V_SHIFT));
+
+ /* Set the scaling ratios and the output size. */
+- format = &uds->entity.formats[UDS_PAD_SOURCE];
+-
+ vsp1_uds_write(uds, VI6_UDS_SCALE,
+- (uds->hscale << VI6_UDS_SCALE_HFRAC_SHIFT) |
+- (uds->vscale << VI6_UDS_SCALE_VFRAC_SHIFT));
++ (hscale << VI6_UDS_SCALE_HFRAC_SHIFT) |
++ (vscale << VI6_UDS_SCALE_VFRAC_SHIFT));
+ vsp1_uds_write(uds, VI6_UDS_CLIP_SIZE,
+- (format->width << VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) |
+- (format->height << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT));
++ (output->width << VI6_UDS_CLIP_SIZE_HSIZE_SHIFT) |
++ (output->height << VI6_UDS_CLIP_SIZE_VSIZE_SHIFT));
+
+ return 0;
+ }
+@@ -280,9 +292,6 @@ static int uds_set_format(struct v4l2_su
+ uds_try_format(uds, fh, UDS_PAD_SOURCE, format, fmt->which);
+ }
+
+- if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE)
+- uds_compute_ratios(uds);
+-
+ return 0;
+ }
+
+--- a/drivers/media/platform/vsp1/vsp1_uds.h
++++ b/drivers/media/platform/vsp1/vsp1_uds.h
+@@ -25,9 +25,7 @@ struct vsp1_device;
+
+ struct vsp1_uds {
+ struct vsp1_entity entity;
+-
+- unsigned int hscale;
+- unsigned int vscale;
++ bool scale_alpha;
+ };
+
+ static inline struct vsp1_uds *to_uds(struct v4l2_subdev *subdev)
+@@ -37,4 +35,6 @@ static inline struct vsp1_uds *to_uds(st
+
+ struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index);
+
++void vsp1_uds_set_alpha(struct vsp1_uds *uds, unsigned int alpha);
++
+ #endif /* __VSP1_UDS_H__ */
+--- a/drivers/media/platform/vsp1/vsp1_video.c
++++ b/drivers/media/platform/vsp1/vsp1_video.c
+@@ -31,6 +31,7 @@
+ #include "vsp1_bru.h"
+ #include "vsp1_entity.h"
+ #include "vsp1_rwpf.h"
++#include "vsp1_uds.h"
+ #include "vsp1_video.h"
+
+ #define VSP1_VIDEO_DEF_FORMAT V4L2_PIX_FMT_YUYV
+@@ -306,13 +307,14 @@ vsp1_video_format_adjust(struct vsp1_vid
+ * Pipeline Management
+ */
+
+-static int vsp1_pipeline_validate_branch(struct vsp1_rwpf *input,
++static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
++ struct vsp1_rwpf *input,
+ struct vsp1_rwpf *output)
+ {
+ struct vsp1_entity *entity;
+ unsigned int entities = 0;
+ struct media_pad *pad;
+- bool uds_found = false;
++ bool bru_found = false;
+
+ input->location.left = 0;
+ input->location.top = 0;
+@@ -341,6 +343,8 @@ static int vsp1_pipeline_validate_branch
+
+ input->location.left = rect->left;
+ input->location.top = rect->top;
++
++ bru_found = true;
+ }
+
+ /* We've reached the WPF, we're done. */
+@@ -355,9 +359,12 @@ static int vsp1_pipeline_validate_branch
+
+ /* UDS can't be chained. */
+ if (entity->type == VSP1_ENTITY_UDS) {
+- if (uds_found)
++ if (pipe->uds)
+ return -EPIPE;
+- uds_found = true;
++
++ pipe->uds = entity;
++ pipe->uds_input = bru_found ? pipe->bru
++ : &input->entity;
+ }
+
+ /* Follow the source link. The link setup operations ensure
+@@ -394,6 +401,7 @@ static void __vsp1_pipeline_cleanup(stru
+ pipe->output = NULL;
+ pipe->bru = NULL;
+ pipe->lif = NULL;
++ pipe->uds = NULL;
+ }
+
+ static int vsp1_pipeline_validate(struct vsp1_pipeline *pipe,
+@@ -451,7 +459,7 @@ static int vsp1_pipeline_validate(struct
+ * contains no loop and that all branches end at the output WPF.
+ */
+ for (i = 0; i < pipe->num_inputs; ++i) {
+- ret = vsp1_pipeline_validate_branch(pipe->inputs[i],
++ ret = vsp1_pipeline_validate_branch(pipe, pipe->inputs[i],
+ pipe->output);
+ if (ret < 0)
+ goto error;
+@@ -654,6 +662,47 @@ done:
+ spin_unlock_irqrestore(&pipe->irqlock, flags);
+ }
+
++/*
++ * Propagate the alpha value through the pipeline.
++ *
++ * As the UDS has restricted scaling capabilities when the alpha component needs
++ * to be scaled, we disable alpha scaling when the UDS input has a fixed alpha
++ * value. The UDS then outputs a fixed alpha value which needs to be programmed
++ * from the input RPF alpha.
++ */
++void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
++ struct vsp1_entity *input,
++ unsigned int alpha)
++{
++ struct vsp1_entity *entity;
++ struct media_pad *pad;
++
++ pad = media_entity_remote_pad(&input->pads[RWPF_PAD_SOURCE]);
++
++ while (pad) {
++ if (media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
++ break;
++
++ entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity));
++
++ /* The BRU background color has a fixed alpha value set to 255,
++ * the output alpha value is thus always equal to 255.
++ */
++ if (entity->type == VSP1_ENTITY_BRU)
++ alpha = 255;
++
++ if (entity->type == VSP1_ENTITY_UDS) {
++ struct vsp1_uds *uds = to_uds(&entity->subdev);
++
++ vsp1_uds_set_alpha(uds, alpha);
++ break;
++ }
++
++ pad = &entity->pads[entity->source_pad];
++ pad = media_entity_remote_pad(pad);
++ }
++}
++
+ /* -----------------------------------------------------------------------------
+ * videobuf2 Queue Operations
+ */
+@@ -761,6 +810,25 @@ static int vsp1_video_start_streaming(st
+
+ mutex_lock(&pipe->lock);
+ if (pipe->stream_count == pipe->num_video - 1) {
++ if (pipe->uds) {
++ struct vsp1_uds *uds = to_uds(&pipe->uds->subdev);
++
++ /* If a BRU is present in the pipeline before the UDS,
++ * the alpha component doesn't need to be scaled as the
++ * BRU output alpha value is fixed to 255. Otherwise we
++ * need to scale the alpha component only when available
++ * at the input RPF.
++ */
++ if (pipe->uds_input->type == VSP1_ENTITY_BRU) {
++ uds->scale_alpha = false;
++ } else {
++ struct vsp1_rwpf *rpf =
++ to_rwpf(&pipe->uds_input->subdev);
++
++ uds->scale_alpha = rpf->video.fmtinfo->alpha;
++ }
++ }
++
+ list_for_each_entry(entity, &pipe->entities, list_pipe) {
+ vsp1_entity_route_setup(entity);
+
+--- a/drivers/media/platform/vsp1/vsp1_video.h
++++ b/drivers/media/platform/vsp1/vsp1_video.h
+@@ -79,6 +79,8 @@ struct vsp1_pipeline {
+ struct vsp1_rwpf *output;
+ struct vsp1_entity *bru;
+ struct vsp1_entity *lif;
++ struct vsp1_entity *uds;
++ struct vsp1_entity *uds_input;
+
+ struct list_head entities;
+ };
+@@ -143,4 +145,8 @@ void vsp1_video_cleanup(struct vsp1_vide
+
+ void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe);
+
++void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
++ struct vsp1_entity *input,
++ unsigned int alpha);
++
+ #endif /* __VSP1_VIDEO_H__ */
diff --git a/patches.renesas/0788-ASoC-rsnd-fixup-rsnd_gen_dma_addr-for-Gen1.patch b/patches.renesas/0788-ASoC-rsnd-fixup-rsnd_gen_dma_addr-for-Gen1.patch
new file mode 100644
index 00000000000000..ae524f0cab19c7
--- /dev/null
+++ b/patches.renesas/0788-ASoC-rsnd-fixup-rsnd_gen_dma_addr-for-Gen1.patch
@@ -0,0 +1,84 @@
+From 48b776e49c3c1b8dd1b21747cf83d4b87681e772 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 18 Jun 2014 17:54:43 +0900
+Subject: ASoC: rsnd: fixup rsnd_gen_dma_addr() for Gen1
+
+ad32d0c7b0e993433df152ae747652647eb65a27
+(ASoC: rsnd: add rsnd_gen_dma_addr() for DMAC addr)
+added rsnd_gen_dma_addr() to calculate DMA addr,
+but, it is necessary only for Gen2.
+This patch ignores Gen1 case.
+Kernel will be panic without this patch.
+Special thanks to Simon
+
+Reported-by: Simon Horman <horms@verge.net.au>
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Tested-by: Simon Horman <horms+renesas@verge.net.au>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 64eae986fc1e3a281b00f04b7c9c00b145ec8a57)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/gen.c | 33 +++++++++++++++++++++------------
+ 1 file changed, 21 insertions(+), 12 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
+index 1dd2b7d38c2c..0280a11c0899 100644
+--- a/sound/soc/sh/rcar/gen.c
++++ b/sound/soc/sh/rcar/gen.c
+@@ -184,7 +184,7 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
+ #define RDMA_CMD_O_N(addr, i) (addr ##_reg - 0x004f8000 + (0x400 * i))
+ #define RDMA_CMD_O_P(addr, i) (addr ##_reg - 0x001f8000 + (0x400 * i))
+
+-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
++static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+ struct rsnd_dma *dma,
+ struct dma_slave_config *cfg,
+ int is_play, int slave_id)
+@@ -226,17 +226,6 @@ void rsnd_gen_dma_addr(struct rsnd_priv *priv,
+ }
+ };
+
+- cfg->slave_id = slave_id;
+- cfg->src_addr = 0;
+- cfg->dst_addr = 0;
+- cfg->direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+-
+- /*
+- * gen1 uses default DMA addr
+- */
+- if (rsnd_is_gen1(priv))
+- return;
+-
+ /* it shouldn't happen */
+ if (use_dvc & !use_src) {
+ dev_err(dev, "DVC is selected without SRC\n");
+@@ -250,6 +239,26 @@ void rsnd_gen_dma_addr(struct rsnd_priv *priv,
+ id, cfg->src_addr, cfg->dst_addr);
+ }
+
++void rsnd_gen_dma_addr(struct rsnd_priv *priv,
++ struct rsnd_dma *dma,
++ struct dma_slave_config *cfg,
++ int is_play, int slave_id)
++{
++ cfg->slave_id = slave_id;
++ cfg->src_addr = 0;
++ cfg->dst_addr = 0;
++ cfg->direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
++
++ /*
++ * gen1 uses default DMA addr
++ */
++ if (rsnd_is_gen1(priv))
++ return;
++
++ rsnd_gen2_dma_addr(priv, dma, cfg, is_play, slave_id);
++}
++
++
+ /*
+ * Gen2
+ */
+--
+2.1.2
+
diff --git a/patches.renesas/0789-ASoC-rsnd-fixup-loop-exit-timing-of-dma-name-search.patch b/patches.renesas/0789-ASoC-rsnd-fixup-loop-exit-timing-of-dma-name-search.patch
new file mode 100644
index 00000000000000..e1963151678838
--- /dev/null
+++ b/patches.renesas/0789-ASoC-rsnd-fixup-loop-exit-timing-of-dma-name-search.patch
@@ -0,0 +1,41 @@
+From e79b54e966e1a9f61498a00971c011f099a555f4 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 18 Jun 2014 17:55:09 +0900
+Subject: ASoC: rsnd: fixup loop exit timing of dma name search
+
+Current dma name search loop didn't care about SSI index
+This patch fixes it.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit c08c3b088053cec1465051258844e7934d3e3e37)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/core.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index 4e86265f625c..ed76901f8202 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -297,7 +297,6 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
+ for (i = 1; i < MOD_MAX; i++) {
+ if (!src) {
+ mod[i] = ssi;
+- break;
+ } else if (!dvc) {
+ mod[i] = src;
+ src = NULL;
+@@ -308,6 +307,9 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
+
+ if (mod[i] == this)
+ index = i;
++
++ if (mod[i] == ssi)
++ break;
+ }
+
+ if (is_play) {
+--
+2.1.2
+
diff --git a/patches.renesas/0790-ASoC-rcar-Fix-dma-direction-type.patch b/patches.renesas/0790-ASoC-rcar-Fix-dma-direction-type.patch
new file mode 100644
index 00000000000000..67c0adb0dd4026
--- /dev/null
+++ b/patches.renesas/0790-ASoC-rcar-Fix-dma-direction-type.patch
@@ -0,0 +1,54 @@
+From ed18d899e65389a72e255b74e0ae67a5836d916c Mon Sep 17 00:00:00 2001
+From: Lars-Peter Clausen <lars@metafoo.de>
+Date: Thu, 19 Jun 2014 09:40:30 +0200
+Subject: ASoC: rcar: Fix dma direction type
+
+dmaengine_prep_slave_single() expects a enum dma_transfer_direction and not a
+enum dma_data_direction. Since the integer representations of both DMA_TO_DEVICE
+and DMA_MEM_TO_DEV aswell as DMA_FROM_DEVICE and DMA_DEV_TO_MEM have the same
+value the code worked fine even though it was using the wrong type.
+
+Fixes the following warning from sparse:
+ sound/soc/sh/rcar/core.c:227:49: warning: mixing different enum types
+ sound/soc/sh/rcar/core.c:227:49: int enum dma_data_direction versus
+ sound/soc/sh/rcar/core.c:227:49: int enum dma_transfer_direction
+
+Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
+Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit cd7bcc6000165f6215d15e2e32b58a646e5de5ec)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/core.c | 2 +-
+ sound/soc/sh/rcar/rsnd.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index ed76901f8202..7f68b33dcbbb 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -365,7 +365,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
+ if (ret < 0)
+ goto rsnd_dma_init_err;
+
+- dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
++ dma->dir = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+ INIT_WORK(&dma->work, rsnd_dma_do_work);
+
+ return 0;
+diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
+index 39d98af5ee05..067a89e9f25c 100644
+--- a/sound/soc/sh/rcar/rsnd.h
++++ b/sound/soc/sh/rcar/rsnd.h
+@@ -158,7 +158,7 @@ struct rsnd_dma {
+ struct sh_dmae_slave slave;
+ struct work_struct work;
+ struct dma_chan *chan;
+- enum dma_data_direction dir;
++ enum dma_transfer_direction dir;
+
+ int submit_loop;
+ int offset; /* it cares A/B plane */
+--
+2.1.2
+
diff --git a/patches.renesas/0791-ASoC-rsnd-SSI-DMA-can-select-BUSIF.patch b/patches.renesas/0791-ASoC-rsnd-SSI-DMA-can-select-BUSIF.patch
new file mode 100644
index 00000000000000..96f3da50cd3cc4
--- /dev/null
+++ b/patches.renesas/0791-ASoC-rsnd-SSI-DMA-can-select-BUSIF.patch
@@ -0,0 +1,420 @@
+From 80f3b3b5d12b5c26f4f33361b5e5ed0dceb376c5 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Sun, 22 Jun 2014 17:56:23 -0700
+Subject: ASoC: rsnd: SSI + DMA can select BUSIF
+
+Sound data needs to be sent to R-Car sound SSI when playback.
+But, there are 2 interfaces for it.
+1st is SSITDR/SSIRDR which are mapped on SSI.
+2nd is SSIn_BUSIF which are mapped on SSIU.
+
+2nd SSIn_BUSIF is used when DMA transfer,
+and it is always used if sound data came from via SRC.
+But, we can use it when SSI+DMA case too.
+(Current driver is assuming 1st SSITDR/SSIRDR for it)
+
+2nd SSIn_BUSIF can be used as FIFO.
+This is very helpful/useful for SSI+DMA.
+
+But DMA address / DMA ID are not same between 1st/2nd cases.
+This patch care about these settings.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit d9288d0ba12de1b5efb830b9128e4cc6877318fc)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ .../devicetree/bindings/sound/renesas,rsnd.txt | 1 +
+ include/sound/rcar_snd.h | 1 +
+ sound/soc/sh/rcar/core.c | 22 +++++---
+ sound/soc/sh/rcar/gen.c | 64 ++++++++++++++--------
+ sound/soc/sh/rcar/rsnd.h | 10 +++-
+ sound/soc/sh/rcar/src.c | 37 +++++++++----
+ sound/soc/sh/rcar/ssi.c | 33 ++++++++++-
+ 7 files changed, 123 insertions(+), 45 deletions(-)
+
+diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+index 8346cab046cd..41a120c2389d 100644
+--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
++++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+@@ -21,6 +21,7 @@ SSI subnode properties:
+ - interrupts : Should contain SSI interrupt for PIO transfer
+ - shared-pin : if shared clock pin
+ - pio-transfer : use PIO transfer mode
++- no-busif : BUSIF is not ussed when [mem -> SSI] via DMA case
+
+ SRC subnode properties:
+ no properties at this point
+diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
+index f4a706f82cb7..d76412b84b48 100644
+--- a/include/sound/rcar_snd.h
++++ b/include/sound/rcar_snd.h
+@@ -34,6 +34,7 @@
+ * B : SSI direction
+ */
+ #define RSND_SSI_CLK_PIN_SHARE (1 << 31)
++#define RSND_SSI_NO_BUSIF (1 << 30) /* SSI+DMA without BUSIF */
+
+ #define RSND_SSI(_dma_id, _pio_irq, _flags) \
+ { .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index 7f68b33dcbbb..8c3707a68603 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -138,6 +138,17 @@ char *rsnd_mod_name(struct rsnd_mod *mod)
+ return mod->ops->name;
+ }
+
++char *rsnd_mod_dma_name(struct rsnd_mod *mod)
++{
++ if (!mod || !mod->ops)
++ return "unknown";
++
++ if (!mod->ops->dma_name)
++ return mod->ops->name;
++
++ return mod->ops->dma_name(mod);
++}
++
+ void rsnd_mod_init(struct rsnd_priv *priv,
+ struct rsnd_mod *mod,
+ struct rsnd_mod_ops *ops,
+@@ -261,7 +272,7 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
+ {
+ if (mod)
+ return snprintf(dma_name, DMA_NAME_SIZE / 2, "%s%d",
+- rsnd_mod_name(mod), rsnd_mod_id(mod));
++ rsnd_mod_dma_name(mod), rsnd_mod_id(mod));
+ else
+ return snprintf(dma_name, DMA_NAME_SIZE / 2, "mem");
+
+@@ -343,11 +354,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
+ dma_cap_zero(mask);
+ dma_cap_set(DMA_SLAVE, mask);
+
+- if (dev->of_node)
+- rsnd_dma_of_name(dma, is_play, dma_name);
+- else
+- snprintf(dma_name, DMA_NAME_SIZE,
+- is_play ? "tx" : "rx");
++ rsnd_dma_of_name(dma, is_play, dma_name);
++ rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
+
+ dev_dbg(dev, "dma name : %s\n", dma_name);
+
+@@ -359,8 +367,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
+ return -EIO;
+ }
+
+- rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
+-
+ ret = dmaengine_slave_config(dma->chan, &cfg);
+ if (ret < 0)
+ goto rsnd_dma_init_err;
+diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
+index 0280a11c0899..46677af6c748 100644
+--- a/sound/soc/sh/rcar/gen.c
++++ b/sound/soc/sh/rcar/gen.c
+@@ -165,15 +165,19 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
+ *
+ * ex) R-Car H2 case
+ * mod / DMAC in / DMAC out / DMAC PP in / DMAC pp out
+- * SSI : 0xec541000 / 0xec241008 / 0xec24100c / 0xec400000 / 0xec400000
++ * SSI : 0xec541000 / 0xec241008 / 0xec24100c
++ * SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
+ * SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
+ * CMD : 0xec500000 / 0xec008000 0xec308000
+ */
+ #define RDMA_SSI_I_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
+ #define RDMA_SSI_O_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
+
+-#define RDMA_SSI_I_P(addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i))
+-#define RDMA_SSI_O_P(addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i))
++#define RDMA_SSIU_I_N(addr, i) (addr ##_reg - 0x00441000 + (0x1000 * i))
++#define RDMA_SSIU_O_N(addr, i) (addr ##_reg - 0x00441000 + (0x1000 * i))
++
++#define RDMA_SSIU_I_P(addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i))
++#define RDMA_SSIU_O_P(addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i))
+
+ #define RDMA_SRC_I_N(addr, i) (addr ##_reg - 0x00500000 + (0x400 * i))
+ #define RDMA_SRC_O_N(addr, i) (addr ##_reg - 0x004fc000 + (0x400 * i))
+@@ -204,26 +208,36 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+ struct dma_addr {
+ dma_addr_t src_addr;
+ dma_addr_t dst_addr;
+- } dma_addrs[2][2][3] = {
+- { /* SRC */
+- /* Capture */
+- {{ 0, 0 },
+- { RDMA_SRC_O_N(src, id), 0 },
+- { RDMA_CMD_O_N(src, id), 0 }},
+- /* Playback */
+- {{ 0, 0, },
+- { 0, RDMA_SRC_I_N(src, id) },
+- { 0, RDMA_SRC_I_N(src, id) }}
+- }, { /* SSI */
+- /* Capture */
+- {{ RDMA_SSI_O_N(ssi, id), 0 },
+- { RDMA_SSI_O_P(ssi, id), RDMA_SRC_I_P(src, id) },
+- { RDMA_SSI_O_P(ssi, id), RDMA_SRC_I_P(src, id) }},
+- /* Playback */
+- {{ 0, RDMA_SSI_I_N(ssi, id) },
+- { RDMA_SRC_O_P(src, id), RDMA_SSI_I_P(ssi, id) },
+- { RDMA_CMD_O_P(src, id), RDMA_SSI_I_P(ssi, id) }}
+- }
++ } dma_addrs[3][2][3] = {
++ /* SRC */
++ {{{ 0, 0 },
++ /* Capture */
++ { RDMA_SRC_O_N(src, id), 0 },
++ { RDMA_CMD_O_N(src, id), 0 } },
++ /* Playback */
++ {{ 0, 0, },
++ { 0, RDMA_SRC_I_N(src, id) },
++ { 0, RDMA_SRC_I_N(src, id) } }
++ },
++ /* SSI */
++ /* Capture */
++ {{{ RDMA_SSI_O_N(ssi, id), 0 },
++ { 0, 0 },
++ { 0, 0 } },
++ /* Playback */
++ {{ 0, RDMA_SSI_I_N(ssi, id) },
++ { 0, 0 },
++ { 0, 0 } }
++ },
++ /* SSIU */
++ /* Capture */
++ {{{ RDMA_SSIU_O_N(ssi, id), 0 },
++ { RDMA_SSIU_O_P(ssi, id), RDMA_SRC_I_P(src, id) },
++ { RDMA_SSIU_O_P(ssi, id), RDMA_SRC_I_P(src, id) } },
++ /* Playback */
++ {{ 0, RDMA_SSIU_I_N(ssi, id) },
++ { RDMA_SRC_O_P(src, id), RDMA_SSIU_I_P(ssi, id) },
++ { RDMA_CMD_O_P(src, id), RDMA_SSIU_I_P(ssi, id) } } },
+ };
+
+ /* it shouldn't happen */
+@@ -232,6 +246,10 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+ return;
+ }
+
++ /* use SSIU or SSI ? */
++ if (is_ssi && (0 == strcmp(rsnd_mod_dma_name(mod), "ssiu")))
++ is_ssi++;
++
+ cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
+ cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
+
+diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
+index 067a89e9f25c..a1466c1570bc 100644
+--- a/sound/soc/sh/rcar/rsnd.h
++++ b/sound/soc/sh/rcar/rsnd.h
+@@ -185,6 +185,7 @@ enum rsnd_mod_type {
+
+ struct rsnd_mod_ops {
+ char *name;
++ char* (*dma_name)(struct rsnd_mod *mod);
+ int (*probe)(struct rsnd_mod *mod,
+ struct rsnd_dai *rdai);
+ int (*remove)(struct rsnd_mod *mod,
+@@ -224,6 +225,7 @@ void rsnd_mod_init(struct rsnd_priv *priv,
+ enum rsnd_mod_type type,
+ int id);
+ char *rsnd_mod_name(struct rsnd_mod *mod);
++char *rsnd_mod_dma_name(struct rsnd_mod *mod);
+
+ /*
+ * R-Car sound DAI
+@@ -391,8 +393,12 @@ struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id);
+ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
+ struct rsnd_dai_stream *io,
+ struct snd_pcm_runtime *runtime);
+-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
+- struct rsnd_dai *rdai);
++int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
++ struct rsnd_dai *rdai,
++ int use_busif);
++int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
++ struct rsnd_dai *rdai,
++ int use_busif);
+ int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,
+ struct rsnd_dai *rdai);
+
+diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
+index 200eda019bc7..4d39505c21cf 100644
+--- a/sound/soc/sh/rcar/src.c
++++ b/sound/soc/sh/rcar/src.c
+@@ -106,18 +106,17 @@ struct rsnd_src {
+ /*
+ * Gen1/Gen2 common functions
+ */
+-int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
+- struct rsnd_dai *rdai)
++int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
++ struct rsnd_dai *rdai,
++ int use_busif)
+ {
+- struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod);
+- struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
+ int ssi_id = rsnd_mod_id(ssi_mod);
+
+ /*
+ * SSI_MODE0
+ */
+ rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id),
+- src_mod ? 0 : (1 << ssi_id));
++ !use_busif << ssi_id);
+
+ /*
+ * SSI_MODE1
+@@ -143,6 +142,29 @@ int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
+ 0x2 << shift : 0x1 << shift);
+ }
+
++ /*
++ * DMA settings for SSIU
++ */
++ if (use_busif) {
++ rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
++ rsnd_get_adinr(ssi_mod));
++ rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE, 1);
++ rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
++ }
++
++ return 0;
++}
++
++int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
++ struct rsnd_dai *rdai,
++ int use_busif)
++{
++ /*
++ * DMA settings for SSIU
++ */
++ if (use_busif)
++ rsnd_mod_write(ssi_mod, SSI_CTRL, 0);
++
+ return 0;
+ }
+
+@@ -467,9 +489,6 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
+ if (ret < 0)
+ return ret;
+
+- rsnd_mod_write(mod, SSI_BUSIF_ADINR, rsnd_get_adinr(mod));
+- rsnd_mod_write(mod, SSI_BUSIF_MODE, 1);
+-
+ rsnd_mod_write(mod, SRC_SRCCR, 0x00011110);
+
+ rsnd_mod_write(mod, SRC_BSDSR, 0x01800000);
+@@ -554,7 +573,6 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
+
+ rsnd_dma_start(rsnd_mod_to_dma(&src->mod));
+
+- rsnd_mod_write(mod, SSI_CTRL, 0x1);
+ rsnd_mod_write(mod, SRC_CTRL, val);
+
+ return rsnd_src_start(mod, rdai);
+@@ -565,7 +583,6 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
+ {
+ struct rsnd_src *src = rsnd_mod_to_src(mod);
+
+- rsnd_mod_write(mod, SSI_CTRL, 0);
+ rsnd_mod_write(mod, SRC_CTRL, 0);
+
+ rsnd_dma_stop(rsnd_mod_to_dma(&src->mod));
+diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
+index 2df723df5d19..34e84009162b 100644
+--- a/sound/soc/sh/rcar/ssi.c
++++ b/sound/soc/sh/rcar/ssi.c
+@@ -90,6 +90,20 @@ struct rsnd_ssi {
+ #define rsnd_ssi_mode_flags(p) ((p)->info->flags)
+ #define rsnd_ssi_dai_id(ssi) ((ssi)->info->dai_id)
+
++static int rsnd_ssi_use_busif(struct rsnd_mod *mod)
++{
++ struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
++ struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
++ int use_busif = 0;
++
++ if (!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_NO_BUSIF))
++ use_busif = 1;
++ if (rsnd_io_to_mod_src(io))
++ use_busif = 1;
++
++ return use_busif;
++}
++
+ static void rsnd_ssi_status_check(struct rsnd_mod *mod,
+ u32 bit)
+ {
+@@ -289,8 +303,6 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
+ ssi->cr_own = cr;
+ ssi->err = -1; /* ignore 1st error */
+
+- rsnd_src_ssi_mode_init(mod, rdai);
+-
+ return 0;
+ }
+
+@@ -389,6 +401,8 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
+ /* enable PIO IRQ */
+ ssi->cr_etc = UIEN | OIEN | DIEN;
+
++ rsnd_src_ssiu_start(mod, rdai, 0);
++
+ rsnd_src_enable_ssi_irq(mod, rdai);
+
+ rsnd_ssi_hw_start(ssi, rdai, io);
+@@ -405,6 +419,8 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
+
+ rsnd_ssi_hw_stop(ssi, rdai);
+
++ rsnd_src_ssiu_stop(mod, rdai, 0);
++
+ return 0;
+ }
+
+@@ -457,6 +473,8 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
+ /* enable DMA transfer */
+ ssi->cr_etc = DMEN;
+
++ rsnd_src_ssiu_start(mod, rdai, rsnd_ssi_use_busif(mod));
++
+ rsnd_dma_start(dma);
+
+ rsnd_ssi_hw_start(ssi, ssi->rdai, io);
+@@ -482,11 +500,19 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
+
+ rsnd_dma_stop(dma);
+
++ rsnd_src_ssiu_stop(mod, rdai, 1);
++
+ return 0;
+ }
+
++static char *rsnd_ssi_dma_name(struct rsnd_mod *mod)
++{
++ return rsnd_ssi_use_busif(mod) ? "ssiu" : SSI_NAME;
++}
++
+ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
+ .name = SSI_NAME,
++ .dma_name = rsnd_ssi_dma_name,
+ .probe = rsnd_ssi_dma_probe,
+ .remove = rsnd_ssi_dma_remove,
+ .init = rsnd_ssi_init,
+@@ -595,6 +621,9 @@ static void rsnd_of_parse_ssi(struct platform_device *pdev,
+ */
+ ssi_info->dma_id = of_get_property(np, "pio-transfer", NULL) ?
+ 0 : 1;
++
++ if (of_get_property(np, "no-busif", NULL))
++ ssi_info->flags |= RSND_SSI_NO_BUSIF;
+ }
+
+ rsnd_of_parse_ssi_end:
+--
+2.1.2
+
diff --git a/patches.renesas/0792-ASoC-rsnd-use-dmaengine_prep_dma_cyclic-instead-of-o.patch b/patches.renesas/0792-ASoC-rsnd-use-dmaengine_prep_dma_cyclic-instead-of-o.patch
new file mode 100644
index 00000000000000..96f86c752d940b
--- /dev/null
+++ b/patches.renesas/0792-ASoC-rsnd-use-dmaengine_prep_dma_cyclic-instead-of-o.patch
@@ -0,0 +1,172 @@
+From 6eea46c7e6699fd008a747e4b78815470f01df21 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Sun, 22 Jun 2014 17:56:41 -0700
+Subject: ASoC: rsnd: use dmaengine_prep_dma_cyclic() instead of original
+ method
+
+Current R-Car sound driver is using DMAEngine directly,
+but, ASoC is requesting to use common DMA transfer method,
+like snd_dmaengine_pcm_trigger() or dmaengine_pcm_ops.
+It is difficult to switch at this point, since Renesas
+driver is also supporting PIO transfer.
+This patch uses dmaengine_prep_dma_cyclic() instead
+of dmaengine_prep_slave_single().
+It is used in requested method,
+and is good first step to switch over.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit ccd01559ead29b59918458e9b412ff18b88fc6cf)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/core.c | 76 ++++++++++++------------------------------------
+ sound/soc/sh/rcar/rsnd.h | 4 ---
+ 2 files changed, 18 insertions(+), 62 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index 8c3707a68603..5149fe2dae9f 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -164,26 +164,8 @@ void rsnd_mod_init(struct rsnd_priv *priv,
+ /*
+ * rsnd_dma functions
+ */
+-static void __rsnd_dma_start(struct rsnd_dma *dma);
+-static void rsnd_dma_continue(struct rsnd_dma *dma)
+-{
+- /* push next A or B plane */
+- dma->submit_loop = 1;
+- schedule_work(&dma->work);
+-}
+-
+-void rsnd_dma_start(struct rsnd_dma *dma)
+-{
+- /* push both A and B plane*/
+- dma->offset = 0;
+- dma->submit_loop = 2;
+- __rsnd_dma_start(dma);
+-}
+-
+ void rsnd_dma_stop(struct rsnd_dma *dma)
+ {
+- dma->submit_loop = 0;
+- cancel_work_sync(&dma->work);
+ dmaengine_terminate_all(dma->chan);
+ }
+
+@@ -191,11 +173,7 @@ static void rsnd_dma_complete(void *data)
+ {
+ struct rsnd_dma *dma = (struct rsnd_dma *)data;
+ struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
+- struct rsnd_priv *priv = rsnd_mod_to_priv(rsnd_dma_to_mod(dma));
+ struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+- unsigned long flags;
+-
+- rsnd_lock(priv, flags);
+
+ /*
+ * Renesas sound Gen1 needs 1 DMAC,
+@@ -208,57 +186,40 @@ static void rsnd_dma_complete(void *data)
+ * rsnd_dai_pointer_update() will be called twice,
+ * ant it will breaks io->byte_pos
+ */
+- if (dma->submit_loop)
+- rsnd_dma_continue(dma);
+-
+- rsnd_unlock(priv, flags);
+
+ rsnd_dai_pointer_update(io, io->byte_per_period);
+ }
+
+-static void __rsnd_dma_start(struct rsnd_dma *dma)
++void rsnd_dma_start(struct rsnd_dma *dma)
+ {
+ struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
+ struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+ struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+- struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
++ struct snd_pcm_substream *substream = io->substream;
+ struct device *dev = rsnd_priv_to_dev(priv);
+ struct dma_async_tx_descriptor *desc;
+- dma_addr_t buf;
+- size_t len = io->byte_per_period;
+- int i;
+-
+- for (i = 0; i < dma->submit_loop; i++) {
+
+- buf = runtime->dma_addr +
+- rsnd_dai_pointer_offset(io, dma->offset + len);
+- dma->offset = len;
++ desc = dmaengine_prep_dma_cyclic(dma->chan,
++ substream->runtime->dma_addr,
++ snd_pcm_lib_buffer_bytes(substream),
++ snd_pcm_lib_period_bytes(substream),
++ dma->dir,
++ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+
+- desc = dmaengine_prep_slave_single(
+- dma->chan, buf, len, dma->dir,
+- DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+- if (!desc) {
+- dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
+- return;
+- }
+-
+- desc->callback = rsnd_dma_complete;
+- desc->callback_param = dma;
++ if (!desc) {
++ dev_err(dev, "dmaengine_prep_slave_sg() fail\n");
++ return;
++ }
+
+- if (dmaengine_submit(desc) < 0) {
+- dev_err(dev, "dmaengine_submit() fail\n");
+- return;
+- }
++ desc->callback = rsnd_dma_complete;
++ desc->callback_param = dma;
+
+- dma_async_issue_pending(dma->chan);
++ if (dmaengine_submit(desc) < 0) {
++ dev_err(dev, "dmaengine_submit() fail\n");
++ return;
+ }
+-}
+-
+-static void rsnd_dma_do_work(struct work_struct *work)
+-{
+- struct rsnd_dma *dma = container_of(work, struct rsnd_dma, work);
+
+- __rsnd_dma_start(dma);
++ dma_async_issue_pending(dma->chan);
+ }
+
+ int rsnd_dma_available(struct rsnd_dma *dma)
+@@ -372,7 +333,6 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
+ goto rsnd_dma_init_err;
+
+ dma->dir = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+- INIT_WORK(&dma->work, rsnd_dma_do_work);
+
+ return 0;
+
+diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
+index a1466c1570bc..60b5e9260600 100644
+--- a/sound/soc/sh/rcar/rsnd.h
++++ b/sound/soc/sh/rcar/rsnd.h
+@@ -156,12 +156,8 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod);
+ */
+ struct rsnd_dma {
+ struct sh_dmae_slave slave;
+- struct work_struct work;
+ struct dma_chan *chan;
+ enum dma_transfer_direction dir;
+-
+- int submit_loop;
+- int offset; /* it cares A/B plane */
+ };
+
+ void rsnd_dma_start(struct rsnd_dma *dma);
+--
+2.1.2
+
diff --git a/patches.renesas/0793-ASoC-rsnd-enable-DVC-when-capture.patch b/patches.renesas/0793-ASoC-rsnd-enable-DVC-when-capture.patch
new file mode 100644
index 00000000000000..3ed21f55898fbd
--- /dev/null
+++ b/patches.renesas/0793-ASoC-rsnd-enable-DVC-when-capture.patch
@@ -0,0 +1,60 @@
+From 2775700aed948d9bf1b01b2875091c4730144200 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Sun, 22 Jun 2014 17:57:04 -0700
+Subject: ASoC: rsnd: enable DVC when capture
+
+Current DVC can be enabled only when playback,
+but, this came from misunderstanding.
+It is not correct.
+
+DVC <-> DMA relationship is...
+
+Playback: MEM -> DMAC -> SRC -> DVC -> DMACp -> SSI
+Capture: SSI -> DMACp -> SRC -> DVC -> DMAC -> MEM
+
+DVC can be used for both Playback/Capture
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 65f459923b7926f6a7f156970d83360bd80cb169)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/dvc.c | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
+index ed0007006899..deef310c75dc 100644
+--- a/sound/soc/sh/rcar/dvc.c
++++ b/sound/soc/sh/rcar/dvc.c
+@@ -191,24 +191,20 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
+ struct snd_soc_pcm_runtime *rtd)
+ {
+ struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+- struct device *dev = rsnd_priv_to_dev(priv);
+ struct snd_card *card = rtd->card->snd_card;
+ struct snd_kcontrol *kctrl;
+ static struct snd_kcontrol_new knew = {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+- .name = "Playback Volume",
+ .info = rsnd_dvc_volume_info,
+ .get = rsnd_dvc_volume_get,
+ .put = rsnd_dvc_volume_put,
+ };
+ int ret;
+
+- if (!rsnd_dai_is_play(rdai, io)) {
+- dev_err(dev, "DVC%d is connected to Capture DAI\n",
+- rsnd_mod_id(mod));
+- return -EINVAL;
+- }
++ if (rsnd_dai_is_play(rdai, io))
++ knew.name = "Playback Volume";
++ else
++ knew.name = "Capture Volume";
+
+ kctrl = snd_ctl_new1(&knew, mod);
+ if (!kctrl)
+--
+2.1.2
+
diff --git a/patches.renesas/0794-ASoC-rsnd-DMA-cleanup-for-flexible-SSI-SRC-selection.patch b/patches.renesas/0794-ASoC-rsnd-DMA-cleanup-for-flexible-SSI-SRC-selection.patch
new file mode 100644
index 00000000000000..233b2cbb475f5e
--- /dev/null
+++ b/patches.renesas/0794-ASoC-rsnd-DMA-cleanup-for-flexible-SSI-SRC-selection.patch
@@ -0,0 +1,264 @@
+From de10782c355f238a13bd8af5d30a80774dc268a3 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Sun, 22 Jun 2014 17:58:26 -0700
+Subject: ASoC: rsnd: DMA cleanup for flexible SSI/SRC selection
+
+Current R-Car sound SSI/SRC/DVC selection has feature limit.
+(It is assuming that SSI/SRC are using same index number)
+
+So that enabling SSI/SRC flexible selection,
+this patch modifies DMA settings.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 37523034851d6a4b1dc951e24bf2f11bc28fe58d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/core.c | 45 ++++++++++++++++++++----------
+ sound/soc/sh/rcar/gen.c | 71 +++++++++++++++++++++---------------------------
+ sound/soc/sh/rcar/rsnd.h | 7 ++---
+ 3 files changed, 64 insertions(+), 59 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index 5149fe2dae9f..4435a31ecdad 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -239,8 +239,21 @@ static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
+
+ }
+
+-static void rsnd_dma_of_name(struct rsnd_dma *dma,
+- int is_play, char *dma_name)
++static void rsnd_dma_of_name(struct rsnd_mod *mod_from,
++ struct rsnd_mod *mod_to,
++ char *dma_name)
++{
++ int index = 0;
++
++ index = _rsnd_dma_of_name(dma_name + index, mod_from);
++ *(dma_name + index++) = '_';
++ index = _rsnd_dma_of_name(dma_name + index, mod_to);
++}
++
++static void rsnd_dma_of_path(struct rsnd_dma *dma,
++ int is_play,
++ struct rsnd_mod **mod_from,
++ struct rsnd_mod **mod_to)
+ {
+ struct rsnd_mod *this = rsnd_dma_to_mod(dma);
+ struct rsnd_dai_stream *io = rsnd_mod_to_io(this);
+@@ -248,7 +261,6 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
+ struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+ struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
+ struct rsnd_mod *mod[MOD_MAX];
+- struct rsnd_mod *src_mod, *dst_mod;
+ int i, index;
+
+
+@@ -285,17 +297,12 @@ static void rsnd_dma_of_name(struct rsnd_dma *dma,
+ }
+
+ if (is_play) {
+- src_mod = mod[index - 1];
+- dst_mod = mod[index];
++ *mod_from = mod[index - 1];
++ *mod_to = mod[index];
+ } else {
+- src_mod = mod[index];
+- dst_mod = mod[index - 1];
++ *mod_from = mod[index];
++ *mod_to = mod[index - 1];
+ }
+-
+- index = 0;
+- index = _rsnd_dma_of_name(dma_name + index, src_mod);
+- *(dma_name + index++) = '_';
+- index = _rsnd_dma_of_name(dma_name + index, dst_mod);
+ }
+
+ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
+@@ -303,6 +310,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
+ {
+ struct device *dev = rsnd_priv_to_dev(priv);
+ struct dma_slave_config cfg;
++ struct rsnd_mod *mod_from;
++ struct rsnd_mod *mod_to;
+ char dma_name[DMA_NAME_SIZE];
+ dma_cap_mask_t mask;
+ int ret;
+@@ -315,10 +324,16 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
+ dma_cap_zero(mask);
+ dma_cap_set(DMA_SLAVE, mask);
+
+- rsnd_dma_of_name(dma, is_play, dma_name);
+- rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
++ rsnd_dma_of_path(dma, is_play, &mod_from, &mod_to);
++ rsnd_dma_of_name(mod_from, mod_to, dma_name);
++
++ cfg.slave_id = id;
++ cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
++ cfg.src_addr = rsnd_gen_dma_addr(priv, mod_from, is_play, 1);
++ cfg.dst_addr = rsnd_gen_dma_addr(priv, mod_to, is_play, 0);
+
+- dev_dbg(dev, "dma name : %s\n", dma_name);
++ dev_dbg(dev, "dma : %s %pad -> %pad\n",
++ dma_name, &cfg.src_addr, &cfg.dst_addr);
+
+ dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
+ (void *)id, dev,
+diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
+index 46677af6c748..73ce4c90efda 100644
+--- a/sound/soc/sh/rcar/gen.c
++++ b/sound/soc/sh/rcar/gen.c
+@@ -168,7 +168,7 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
+ * SSI : 0xec541000 / 0xec241008 / 0xec24100c
+ * SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
+ * SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
+- * CMD : 0xec500000 / 0xec008000 0xec308000
++ * CMD : 0xec500000 / / 0xec008000 0xec308000
+ */
+ #define RDMA_SSI_I_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
+ #define RDMA_SSI_O_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
+@@ -188,14 +188,13 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
+ #define RDMA_CMD_O_N(addr, i) (addr ##_reg - 0x004f8000 + (0x400 * i))
+ #define RDMA_CMD_O_P(addr, i) (addr ##_reg - 0x001f8000 + (0x400 * i))
+
+-static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+- struct rsnd_dma *dma,
+- struct dma_slave_config *cfg,
+- int is_play, int slave_id)
++static dma_addr_t
++rsnd_gen2_dma_addr(struct rsnd_priv *priv,
++ struct rsnd_mod *mod,
++ int is_play, int is_from)
+ {
+ struct platform_device *pdev = rsnd_priv_to_pdev(priv);
+ struct device *dev = rsnd_priv_to_dev(priv);
+- struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
+ struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+ dma_addr_t ssi_reg = platform_get_resource(pdev,
+ IORESOURCE_MEM, RSND_GEN2_SSI)->start;
+@@ -206,76 +205,68 @@ static void rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+ int use_dvc = !!rsnd_io_to_mod_dvc(io);
+ int id = rsnd_mod_id(mod);
+ struct dma_addr {
+- dma_addr_t src_addr;
+- dma_addr_t dst_addr;
++ dma_addr_t out_addr;
++ dma_addr_t in_addr;
+ } dma_addrs[3][2][3] = {
+ /* SRC */
+ {{{ 0, 0 },
+ /* Capture */
+- { RDMA_SRC_O_N(src, id), 0 },
+- { RDMA_CMD_O_N(src, id), 0 } },
++ { RDMA_SRC_O_N(src, id), RDMA_SRC_I_P(src, id) },
++ { RDMA_CMD_O_N(src, id), RDMA_SRC_I_P(src, id) } },
+ /* Playback */
+ {{ 0, 0, },
+- { 0, RDMA_SRC_I_N(src, id) },
+- { 0, RDMA_SRC_I_N(src, id) } }
++ { RDMA_SRC_O_P(src, id), RDMA_SRC_I_N(src, id) },
++ { RDMA_CMD_O_P(src, id), RDMA_SRC_I_N(src, id) } }
+ },
+ /* SSI */
+ /* Capture */
+ {{{ RDMA_SSI_O_N(ssi, id), 0 },
+- { 0, 0 },
+- { 0, 0 } },
++ { RDMA_SSIU_O_P(ssi, id), 0 },
++ { RDMA_SSIU_O_P(ssi, id), 0 } },
+ /* Playback */
+ {{ 0, RDMA_SSI_I_N(ssi, id) },
+- { 0, 0 },
+- { 0, 0 } }
++ { 0, RDMA_SSIU_I_P(ssi, id) },
++ { 0, RDMA_SSIU_I_P(ssi, id) } }
+ },
+ /* SSIU */
+ /* Capture */
+ {{{ RDMA_SSIU_O_N(ssi, id), 0 },
+- { RDMA_SSIU_O_P(ssi, id), RDMA_SRC_I_P(src, id) },
+- { RDMA_SSIU_O_P(ssi, id), RDMA_SRC_I_P(src, id) } },
++ { RDMA_SSIU_O_P(ssi, id), 0 },
++ { RDMA_SSIU_O_P(ssi, id), 0 } },
+ /* Playback */
+ {{ 0, RDMA_SSIU_I_N(ssi, id) },
+- { RDMA_SRC_O_P(src, id), RDMA_SSIU_I_P(ssi, id) },
+- { RDMA_CMD_O_P(src, id), RDMA_SSIU_I_P(ssi, id) } } },
++ { 0, RDMA_SSIU_I_P(ssi, id) },
++ { 0, RDMA_SSIU_I_P(ssi, id) } } },
+ };
+
+ /* it shouldn't happen */
+- if (use_dvc & !use_src) {
++ if (use_dvc & !use_src)
+ dev_err(dev, "DVC is selected without SRC\n");
+- return;
+- }
+
+ /* use SSIU or SSI ? */
+ if (is_ssi && (0 == strcmp(rsnd_mod_dma_name(mod), "ssiu")))
+ is_ssi++;
+
+- cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
+- cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
+-
+- dev_dbg(dev, "dma%d addr - src : %x / dst : %x\n",
+- id, cfg->src_addr, cfg->dst_addr);
++ return (is_from) ?
++ dma_addrs[is_ssi][is_play][use_src + use_dvc].out_addr :
++ dma_addrs[is_ssi][is_play][use_src + use_dvc].in_addr;
+ }
+
+-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
+- struct rsnd_dma *dma,
+- struct dma_slave_config *cfg,
+- int is_play, int slave_id)
++dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
++ struct rsnd_mod *mod,
++ int is_play, int is_from)
+ {
+- cfg->slave_id = slave_id;
+- cfg->src_addr = 0;
+- cfg->dst_addr = 0;
+- cfg->direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+-
+ /*
+ * gen1 uses default DMA addr
+ */
+ if (rsnd_is_gen1(priv))
+- return;
++ return 0;
+
+- rsnd_gen2_dma_addr(priv, dma, cfg, is_play, slave_id);
+-}
++ if (!mod)
++ return 0;
+
++ return rsnd_gen2_dma_addr(priv, mod, is_play, is_from);
++}
+
+ /*
+ * Gen2
+diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
+index 60b5e9260600..425b22ee6fb9 100644
+--- a/sound/soc/sh/rcar/rsnd.h
++++ b/sound/soc/sh/rcar/rsnd.h
+@@ -279,10 +279,9 @@ int rsnd_gen_probe(struct platform_device *pdev,
+ void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,
+ struct rsnd_mod *mod,
+ enum rsnd_reg reg);
+-void rsnd_gen_dma_addr(struct rsnd_priv *priv,
+- struct rsnd_dma *dma,
+- struct dma_slave_config *cfg,
+- int is_play, int slave_id);
++dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
++ struct rsnd_mod *mod,
++ int is_play, int is_from);
+
+ #define rsnd_is_gen1(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1)
+ #define rsnd_is_gen2(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2)
+--
+2.1.2
+
diff --git a/patches.renesas/0795-ASoC-rsnd-DMA-start-address-is-properly-used-for-eac.patch b/patches.renesas/0795-ASoC-rsnd-DMA-start-address-is-properly-used-for-eac.patch
new file mode 100644
index 00000000000000..1e8963ea3435a5
--- /dev/null
+++ b/patches.renesas/0795-ASoC-rsnd-DMA-start-address-is-properly-used-for-eac.patch
@@ -0,0 +1,64 @@
+From c317b82b4eb12a09c9affc19245aa9dee66c958d Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Sun, 22 Jun 2014 17:59:02 -0700
+Subject: ASoC: rsnd: DMA start address is properly used for each DMAC
+
+R-Car sound uses Audio DMAC and Audio DMAC peri peri.
+Audio DMAC peri peri transfers data inside circuit.
+
+DMA transfer needs source / destination address,
+and destination address can be set via dmaengine_slave_config().
+The source address can be set when starting DMAEngine.
+Because Audio DMAC peri peri always ignores its value,
+current driver always used same source address for
+Audio DMAC / Audio DMAC peri peri
+(Audio DMAC peri peri source / destination address
+is always fixed value)
+But, This is not good match for DT booting.
+This patch properly uses DMA start address
+for Audio DMAC / Audio DMAC peri peri.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 340371005d399b595f4044fc5e336f4a66ead101)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/core.c | 2 ++
+ sound/soc/sh/rcar/rsnd.h | 1 +
+ 2 files changed, 3 insertions(+)
+
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index 4435a31ecdad..49d9b31b185c 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -200,6 +200,7 @@ void rsnd_dma_start(struct rsnd_dma *dma)
+ struct dma_async_tx_descriptor *desc;
+
+ desc = dmaengine_prep_dma_cyclic(dma->chan,
++ (dma->addr) ? dma->addr :
+ substream->runtime->dma_addr,
+ snd_pcm_lib_buffer_bytes(substream),
+ snd_pcm_lib_period_bytes(substream),
+@@ -347,6 +348,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
+ if (ret < 0)
+ goto rsnd_dma_init_err;
+
++ dma->addr = is_play ? cfg.src_addr : cfg.dst_addr;
+ dma->dir = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+
+ return 0;
+diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
+index 425b22ee6fb9..631b149df08f 100644
+--- a/sound/soc/sh/rcar/rsnd.h
++++ b/sound/soc/sh/rcar/rsnd.h
+@@ -158,6 +158,7 @@ struct rsnd_dma {
+ struct sh_dmae_slave slave;
+ struct dma_chan *chan;
+ enum dma_transfer_direction dir;
++ dma_addr_t addr;
+ };
+
+ void rsnd_dma_start(struct rsnd_dma *dma);
+--
+2.1.2
+
diff --git a/patches.renesas/0796-ASoC-rsnd-add-DT-support-to-DVC.patch b/patches.renesas/0796-ASoC-rsnd-add-DT-support-to-DVC.patch
new file mode 100644
index 00000000000000..87cc6c31369560
--- /dev/null
+++ b/patches.renesas/0796-ASoC-rsnd-add-DT-support-to-DVC.patch
@@ -0,0 +1,152 @@
+From 94c7242200393217fa3fe762ae6eadee321b529e Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Sun, 22 Jun 2014 17:59:28 -0700
+Subject: ASoC: rsnd: add DT support to DVC
+
+Now, DVC can use DT
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 34cb6123f90d264d63bdcd3ee0df0d2cb4b36aab)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ .../devicetree/bindings/sound/renesas,rsnd.txt | 8 +++++
+ sound/soc/sh/rcar/core.c | 13 ++++++--
+ sound/soc/sh/rcar/dvc.c | 38 ++++++++++++++++++++++
+ 3 files changed, 57 insertions(+), 2 deletions(-)
+
+diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+index 41a120c2389d..aa697abf337e 100644
+--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
++++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+@@ -13,6 +13,9 @@ Required properties:
+ - rcar_sound,src : Should contain SRC feature.
+ The number of SRC subnode should be same as HW.
+ see below for detail.
++- rcar_sound,dvc : Should contain DVC feature.
++ The number of DVC subnode should be same as HW.
++ see below for detail.
+ - rcar_sound,dai : DAI contents.
+ The number of DAI subnode should be same as HW.
+ see below for detail.
+@@ -40,6 +43,11 @@ rcar_sound: rcar_sound@0xffd90000 {
+ <0 0xec540000 0 0x1000>, /* SSIU */
+ <0 0xec541000 0 0x1280>; /* SSI */
+
++ rcar_sound,dvc {
++ dvc0: dvc@0 { };
++ dvc1: dvc@1 { };
++ };
++
+ rcar_sound,src {
+ src0: src@0 { };
+ src1: src@1 { };
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index 49d9b31b185c..907d4802fd5c 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -286,7 +286,13 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
+ mod[i] = src;
+ src = NULL;
+ } else {
+- mod[i] = dvc;
++ if ((!is_play) && (this == src))
++ this = dvc;
++
++ mod[i] = (is_play) ? src : dvc;
++ i++;
++ mod[i] = (is_play) ? dvc : src;
++ src = NULL;
+ dvc = NULL;
+ }
+
+@@ -719,12 +725,13 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
+ struct device_node *dai_node, *dai_np;
+ struct device_node *ssi_node, *ssi_np;
+ struct device_node *src_node, *src_np;
++ struct device_node *dvc_node, *dvc_np;
+ struct device_node *playback, *capture;
+ struct rsnd_dai_platform_info *dai_info;
+ struct rcar_snd_info *info = rsnd_priv_to_info(priv);
+ struct device *dev = &pdev->dev;
+ int nr, i;
+- int dai_i, ssi_i, src_i;
++ int dai_i, ssi_i, src_i, dvc_i;
+
+ if (!of_data)
+ return;
+@@ -750,6 +757,7 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
+
+ ssi_node = of_get_child_by_name(dev->of_node, "rcar_sound,ssi");
+ src_node = of_get_child_by_name(dev->of_node, "rcar_sound,src");
++ dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
+
+ #define mod_parse(name) \
+ if (name##_node) { \
+@@ -785,6 +793,7 @@ if (name##_node) { \
+
+ mod_parse(ssi);
+ mod_parse(src);
++ mod_parse(dvc);
+
+ if (playback)
+ of_node_put(playback);
+diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
+index deef310c75dc..9096fb03d001 100644
+--- a/sound/soc/sh/rcar/dvc.c
++++ b/sound/soc/sh/rcar/dvc.c
+@@ -235,6 +235,42 @@ struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id)
+ return &((struct rsnd_dvc *)(priv->dvc) + id)->mod;
+ }
+
++static void rsnd_of_parse_dvc(struct platform_device *pdev,
++ const struct rsnd_of_data *of_data,
++ struct rsnd_priv *priv)
++{
++ struct device_node *node;
++ struct rsnd_dvc_platform_info *dvc_info;
++ struct rcar_snd_info *info = rsnd_priv_to_info(priv);
++ struct device *dev = &pdev->dev;
++ int nr;
++
++ if (!of_data)
++ return;
++
++ node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
++ if (!node)
++ return;
++
++ nr = of_get_child_count(node);
++ if (!nr)
++ goto rsnd_of_parse_dvc_end;
++
++ dvc_info = devm_kzalloc(dev,
++ sizeof(struct rsnd_dvc_platform_info) * nr,
++ GFP_KERNEL);
++ if (!dvc_info) {
++ dev_err(dev, "dvc info allocation error\n");
++ goto rsnd_of_parse_dvc_end;
++ }
++
++ info->dvc_info = dvc_info;
++ info->dvc_info_nr = nr;
++
++rsnd_of_parse_dvc_end:
++ of_node_put(node);
++}
++
+ int rsnd_dvc_probe(struct platform_device *pdev,
+ const struct rsnd_of_data *of_data,
+ struct rsnd_priv *priv)
+@@ -246,6 +282,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
+ char name[RSND_DVC_NAME_SIZE];
+ int i, nr;
+
++ rsnd_of_parse_dvc(pdev, of_data, priv);
++
+ nr = info->dvc_info_nr;
+ if (!nr)
+ return 0;
+--
+2.1.2
+
diff --git a/patches.renesas/0797-ASoC-rsnd-add-missing-src-dst_addr_width-for-DMAEngi.patch b/patches.renesas/0797-ASoC-rsnd-add-missing-src-dst_addr_width-for-DMAEngi.patch
new file mode 100644
index 00000000000000..b6c7ffcdcea5cc
--- /dev/null
+++ b/patches.renesas/0797-ASoC-rsnd-add-missing-src-dst_addr_width-for-DMAEngi.patch
@@ -0,0 +1,32 @@
+From de2e3bdd355dd0fa39908a1438509f8ac9cc6a66 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 16 Jul 2014 23:18:44 -0700
+Subject: ASoC: rsnd: add missing src/dst_addr_width for DMAEngine
+
+Renesas new DMAEngine driver requests src/dst_addr_width
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 2bf865ba30405056e7922b960a1687bb4d5a4999)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/core.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index 907d4802fd5c..c48d999a3fce 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -338,6 +338,8 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
+ cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+ cfg.src_addr = rsnd_gen_dma_addr(priv, mod_from, is_play, 1);
+ cfg.dst_addr = rsnd_gen_dma_addr(priv, mod_to, is_play, 0);
++ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
++ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+
+ dev_dbg(dev, "dma : %s %pad -> %pad\n",
+ dma_name, &cfg.src_addr, &cfg.dst_addr);
+--
+2.1.2
+
diff --git a/patches.renesas/0798-ASoC-rsnd-fixup-dai-remove-callback-operation.patch b/patches.renesas/0798-ASoC-rsnd-fixup-dai-remove-callback-operation.patch
new file mode 100644
index 00000000000000..ac462697ea4def
--- /dev/null
+++ b/patches.renesas/0798-ASoC-rsnd-fixup-dai-remove-callback-operation.patch
@@ -0,0 +1,85 @@
+From aa1367bf9ff1f8ba67b8ac3f31a70253530873c4 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 24 Jul 2014 01:51:31 -0700
+Subject: ASoC: rsnd: fixup dai remove callback operation
+
+rsnd driver is using SSI/SRC/DVC which are
+using "mod" base operation.
+These "mod" are supporting "probe" and "remove" callbacks.
+
+Current rsnd_probe should call "remove" if "probe" was failed,
+since "probe" might be having DMAEngine handle.
+Some mod's "remove" callback might be called without calling
+"probe", but it is no problem. because "remove" do nothing
+in such case.
+
+So, all mod's "remove" should be called when error case
+of rsnd_probe() and rsnd_remove().
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit d62a3dcd4d75b1713d12697afdbffaf9a9da8f43)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/core.c | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index c48d999a3fce..f07742f1eb11 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -1043,11 +1043,11 @@ static int rsnd_probe(struct platform_device *pdev)
+ for_each_rsnd_dai(rdai, priv, i) {
+ ret = rsnd_dai_call(probe, &rdai->playback, rdai);
+ if (ret)
+- return ret;
++ goto exit_snd_probe;
+
+ ret = rsnd_dai_call(probe, &rdai->capture, rdai);
+ if (ret)
+- return ret;
++ goto exit_snd_probe;
+ }
+
+ /*
+@@ -1075,6 +1075,11 @@ static int rsnd_probe(struct platform_device *pdev)
+
+ exit_snd_soc:
+ snd_soc_unregister_platform(dev);
++exit_snd_probe:
++ for_each_rsnd_dai(rdai, priv, i) {
++ rsnd_dai_call(remove, &rdai->playback, rdai);
++ rsnd_dai_call(remove, &rdai->capture, rdai);
++ }
+
+ return ret;
+ }
+@@ -1083,21 +1088,16 @@ static int rsnd_remove(struct platform_device *pdev)
+ {
+ struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev);
+ struct rsnd_dai *rdai;
+- int ret, i;
++ int ret = 0, i;
+
+ pm_runtime_disable(&pdev->dev);
+
+ for_each_rsnd_dai(rdai, priv, i) {
+- ret = rsnd_dai_call(remove, &rdai->playback, rdai);
+- if (ret)
+- return ret;
+-
+- ret = rsnd_dai_call(remove, &rdai->capture, rdai);
+- if (ret)
+- return ret;
++ ret |= rsnd_dai_call(remove, &rdai->playback, rdai);
++ ret |= rsnd_dai_call(remove, &rdai->capture, rdai);
+ }
+
+- return 0;
++ return ret;
+ }
+
+ static struct platform_driver rsnd_driver = {
+--
+2.1.2
+
diff --git a/patches.renesas/0799-ASoC-rsnd-use-regmap_mmio-instead-of-original-regmap.patch b/patches.renesas/0799-ASoC-rsnd-use-regmap_mmio-instead-of-original-regmap.patch
new file mode 100644
index 00000000000000..730a673bc1febc
--- /dev/null
+++ b/patches.renesas/0799-ASoC-rsnd-use-regmap_mmio-instead-of-original-regmap.patch
@@ -0,0 +1,566 @@
+From 42f1100da913179ba34b2f3d8d96f6d0d5631020 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 29 Jul 2014 00:37:31 -0700
+Subject: ASoC: rsnd: use regmap_mmio instead of original regmap bus
+
+Current rsnd driver is using regmap and regmap_field.
+It used original regmap bus which is
+single regmap instance for multi register mapping.
+This patch modifies it to use regmap_mmio bus,
+and tidyuped probe method
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit b8c637864a6904a9ba8e0df556d5bdf9f26b2c54)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/Kconfig | 2 +-
+ sound/soc/sh/rcar/gen.c | 439 +++++++++++++++++++++---------------------------
+ 2 files changed, 189 insertions(+), 252 deletions(-)
+
+diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig
+index b43fdf0d08af..80245b6eebd6 100644
+--- a/sound/soc/sh/Kconfig
++++ b/sound/soc/sh/Kconfig
+@@ -37,7 +37,7 @@ config SND_SOC_SH4_SIU
+ config SND_SOC_RCAR
+ tristate "R-Car series SRU/SCU/SSIU/SSI support"
+ select SND_SIMPLE_CARD
+- select REGMAP
++ select REGMAP_MMIO
+ help
+ This option enables R-Car SUR/SCU/SSIU/SSI sound support
+
+diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
+index 73ce4c90efda..5f9e0722abcf 100644
+--- a/sound/soc/sh/rcar/gen.c
++++ b/sound/soc/sh/rcar/gen.c
+@@ -15,63 +15,35 @@ struct rsnd_gen {
+
+ struct rsnd_gen_ops *ops;
+
+- struct regmap *regmap;
++ struct regmap *regmap[RSND_BASE_MAX];
+ struct regmap_field *regs[RSND_REG_MAX];
+ };
+
+ #define rsnd_priv_to_gen(p) ((struct rsnd_gen *)(p)->gen)
+
+-#define RSND_REG_SET(gen, id, reg_id, offset, _id_offset, _id_size) \
+- [id] = { \
+- .reg = (unsigned int)gen->base[reg_id] + offset, \
+- .lsb = 0, \
+- .msb = 31, \
+- .id_size = _id_size, \
+- .id_offset = _id_offset, \
+- }
+-
+-/*
+- * basic function
+- */
+-static int rsnd_regmap_write32(void *context, const void *_data, size_t count)
+-{
+- struct rsnd_priv *priv = context;
+- struct device *dev = rsnd_priv_to_dev(priv);
+- u32 *data = (u32 *)_data;
+- u32 val = data[1];
+- void __iomem *reg = (void *)data[0];
+-
+- iowrite32(val, reg);
+-
+- dev_dbg(dev, "w %p : %08x\n", reg, val);
+-
+- return 0;
+-}
+-
+-static int rsnd_regmap_read32(void *context,
+- const void *_data, size_t reg_size,
+- void *_val, size_t val_size)
+-{
+- struct rsnd_priv *priv = context;
+- struct device *dev = rsnd_priv_to_dev(priv);
+- u32 *data = (u32 *)_data;
+- u32 *val = (u32 *)_val;
+- void __iomem *reg = (void *)data[0];
+-
+- *val = ioread32(reg);
+-
+- dev_dbg(dev, "r %p : %08x\n", reg, *val);
++struct rsnd_regmap_field_conf {
++ int idx;
++ unsigned int reg_offset;
++ unsigned int id_offset;
++};
+
+- return 0;
++#define RSND_REG_SET(id, offset, _id_offset) \
++{ \
++ .idx = id, \
++ .reg_offset = offset, \
++ .id_offset = _id_offset, \
+ }
++/* single address mapping */
++#define RSND_GEN_S_REG(id, offset) \
++ RSND_REG_SET(RSND_REG_##id, offset, 0)
+
+-static struct regmap_bus rsnd_regmap_bus = {
+- .write = rsnd_regmap_write32,
+- .read = rsnd_regmap_read32,
+- .reg_format_endian_default = REGMAP_ENDIAN_NATIVE,
+- .val_format_endian_default = REGMAP_ENDIAN_NATIVE,
+-};
++/* multi address mapping */
++#define RSND_GEN_M_REG(id, offset, _id_offset) \
++ RSND_REG_SET(RSND_REG_##id, offset, _id_offset)
+
++/*
++ * basic function
++ */
+ static int rsnd_is_accessible_reg(struct rsnd_priv *priv,
+ struct rsnd_gen *gen, enum rsnd_reg reg)
+ {
+@@ -88,6 +60,7 @@ static int rsnd_is_accessible_reg(struct rsnd_priv *priv,
+ u32 rsnd_read(struct rsnd_priv *priv,
+ struct rsnd_mod *mod, enum rsnd_reg reg)
+ {
++ struct device *dev = rsnd_priv_to_dev(priv);
+ struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
+ u32 val;
+
+@@ -96,6 +69,8 @@ u32 rsnd_read(struct rsnd_priv *priv,
+
+ regmap_fields_read(gen->regs[reg], rsnd_mod_id(mod), &val);
+
++ dev_dbg(dev, "r %s - 0x%04d : %08x\n", rsnd_mod_name(mod), reg, val);
++
+ return val;
+ }
+
+@@ -103,12 +78,15 @@ void rsnd_write(struct rsnd_priv *priv,
+ struct rsnd_mod *mod,
+ enum rsnd_reg reg, u32 data)
+ {
++ struct device *dev = rsnd_priv_to_dev(priv);
+ struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
+
+ if (!rsnd_is_accessible_reg(priv, gen, reg))
+ return;
+
+ regmap_fields_write(gen->regs[reg], rsnd_mod_id(mod), data);
++
++ dev_dbg(dev, "w %s - 0x%04d : %08x\n", rsnd_mod_name(mod), reg, data);
+ }
+
+ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,
+@@ -123,33 +101,58 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,
+ mask, data);
+ }
+
+-static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
+- struct rsnd_gen *gen,
+- struct reg_field *regf)
++#define rsnd_gen_regmap_init(priv, id_size, reg_id, conf) \
++ _rsnd_gen_regmap_init(priv, id_size, reg_id, conf, ARRAY_SIZE(conf))
++static int _rsnd_gen_regmap_init(struct rsnd_priv *priv,
++ int id_size,
++ int reg_id,
++ struct rsnd_regmap_field_conf *conf,
++ int conf_size)
+ {
+- int i;
++ struct platform_device *pdev = rsnd_priv_to_pdev(priv);
++ struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
+ struct device *dev = rsnd_priv_to_dev(priv);
++ struct resource *res;
+ struct regmap_config regc;
++ struct regmap_field *regs;
++ struct regmap *regmap;
++ struct reg_field regf;
++ void __iomem *base;
++ int i;
+
+ memset(&regc, 0, sizeof(regc));
+ regc.reg_bits = 32;
+ regc.val_bits = 32;
++ regc.reg_stride = 4;
+
+- gen->regmap = devm_regmap_init(dev, &rsnd_regmap_bus, priv, &regc);
+- if (IS_ERR(gen->regmap)) {
+- dev_err(dev, "regmap error %ld\n", PTR_ERR(gen->regmap));
+- return PTR_ERR(gen->regmap);
+- }
++ res = platform_get_resource(pdev, IORESOURCE_MEM, reg_id);
++ if (!res)
++ return -ENODEV;
++
++ base = devm_ioremap_resource(dev, res);
++ if (IS_ERR(base))
++ return PTR_ERR(base);
+
+- for (i = 0; i < RSND_REG_MAX; i++) {
+- gen->regs[i] = NULL;
+- if (!regf[i].reg)
+- continue;
++ regmap = devm_regmap_init_mmio(dev, base, &regc);
++ if (IS_ERR(regmap))
++ return PTR_ERR(regmap);
+
+- gen->regs[i] = devm_regmap_field_alloc(dev, gen->regmap, regf[i]);
+- if (IS_ERR(gen->regs[i]))
+- return PTR_ERR(gen->regs[i]);
++ gen->base[reg_id] = base;
++ gen->regmap[reg_id] = regmap;
+
++ for (i = 0; i < conf_size; i++) {
++
++ regf.reg = conf[i].reg_offset;
++ regf.id_offset = conf[i].id_offset;
++ regf.lsb = 0;
++ regf.msb = 31;
++ regf.id_size = id_size;
++
++ regs = devm_regmap_field_alloc(dev, regmap, regf);
++ if (IS_ERR(regs))
++ return PTR_ERR(regs);
++
++ gen->regs[conf[i].idx] = regs;
+ }
+
+ return 0;
+@@ -271,119 +274,85 @@ dma_addr_t rsnd_gen_dma_addr(struct rsnd_priv *priv,
+ /*
+ * Gen2
+ */
+-
+-/* single address mapping */
+-#define RSND_GEN2_S_REG(gen, reg, id, offset) \
+- RSND_REG_SET(gen, RSND_REG_##id, RSND_GEN2_##reg, offset, 0, 10)
+-
+-/* multi address mapping */
+-#define RSND_GEN2_M_REG(gen, reg, id, offset, _id_offset) \
+- RSND_REG_SET(gen, RSND_REG_##id, RSND_GEN2_##reg, offset, _id_offset, 10)
+-
+-static int rsnd_gen2_regmap_init(struct rsnd_priv *priv, struct rsnd_gen *gen)
+-{
+- struct reg_field regf[RSND_REG_MAX] = {
+- RSND_GEN2_S_REG(gen, SSIU, SSI_MODE0, 0x800),
+- RSND_GEN2_S_REG(gen, SSIU, SSI_MODE1, 0x804),
+- /* FIXME: it needs SSI_MODE2/3 in the future */
+- RSND_GEN2_M_REG(gen, SSIU, SSI_BUSIF_MODE, 0x0, 0x80),
+- RSND_GEN2_M_REG(gen, SSIU, SSI_BUSIF_ADINR,0x4, 0x80),
+- RSND_GEN2_M_REG(gen, SSIU, SSI_CTRL, 0x10, 0x80),
+- RSND_GEN2_M_REG(gen, SSIU, INT_ENABLE, 0x18, 0x80),
+-
+- RSND_GEN2_M_REG(gen, SCU, SRC_BUSIF_MODE, 0x0, 0x20),
+- RSND_GEN2_M_REG(gen, SCU, SRC_ROUTE_MODE0,0xc, 0x20),
+- RSND_GEN2_M_REG(gen, SCU, SRC_CTRL, 0x10, 0x20),
+- RSND_GEN2_M_REG(gen, SCU, CMD_ROUTE_SLCT, 0x18c, 0x20),
+- RSND_GEN2_M_REG(gen, SCU, CMD_CTRL, 0x190, 0x20),
+- RSND_GEN2_M_REG(gen, SCU, SRC_SWRSR, 0x200, 0x40),
+- RSND_GEN2_M_REG(gen, SCU, SRC_SRCIR, 0x204, 0x40),
+- RSND_GEN2_M_REG(gen, SCU, SRC_ADINR, 0x214, 0x40),
+- RSND_GEN2_M_REG(gen, SCU, SRC_IFSCR, 0x21c, 0x40),
+- RSND_GEN2_M_REG(gen, SCU, SRC_IFSVR, 0x220, 0x40),
+- RSND_GEN2_M_REG(gen, SCU, SRC_SRCCR, 0x224, 0x40),
+- RSND_GEN2_M_REG(gen, SCU, SRC_BSDSR, 0x22c, 0x40),
+- RSND_GEN2_M_REG(gen, SCU, SRC_BSISR, 0x238, 0x40),
+- RSND_GEN2_M_REG(gen, SCU, DVC_SWRSR, 0xe00, 0x100),
+- RSND_GEN2_M_REG(gen, SCU, DVC_DVUIR, 0xe04, 0x100),
+- RSND_GEN2_M_REG(gen, SCU, DVC_ADINR, 0xe08, 0x100),
+- RSND_GEN2_M_REG(gen, SCU, DVC_DVUCR, 0xe10, 0x100),
+- RSND_GEN2_M_REG(gen, SCU, DVC_ZCMCR, 0xe14, 0x100),
+- RSND_GEN2_M_REG(gen, SCU, DVC_VOL0R, 0xe28, 0x100),
+- RSND_GEN2_M_REG(gen, SCU, DVC_VOL1R, 0xe2c, 0x100),
+- RSND_GEN2_M_REG(gen, SCU, DVC_DVUER, 0xe48, 0x100),
+-
+- RSND_GEN2_S_REG(gen, ADG, BRRA, 0x00),
+- RSND_GEN2_S_REG(gen, ADG, BRRB, 0x04),
+- RSND_GEN2_S_REG(gen, ADG, SSICKR, 0x08),
+- RSND_GEN2_S_REG(gen, ADG, AUDIO_CLK_SEL0, 0x0c),
+- RSND_GEN2_S_REG(gen, ADG, AUDIO_CLK_SEL1, 0x10),
+- RSND_GEN2_S_REG(gen, ADG, AUDIO_CLK_SEL2, 0x14),
+- RSND_GEN2_S_REG(gen, ADG, DIV_EN, 0x30),
+- RSND_GEN2_S_REG(gen, ADG, SRCIN_TIMSEL0, 0x34),
+- RSND_GEN2_S_REG(gen, ADG, SRCIN_TIMSEL1, 0x38),
+- RSND_GEN2_S_REG(gen, ADG, SRCIN_TIMSEL2, 0x3c),
+- RSND_GEN2_S_REG(gen, ADG, SRCIN_TIMSEL3, 0x40),
+- RSND_GEN2_S_REG(gen, ADG, SRCIN_TIMSEL4, 0x44),
+- RSND_GEN2_S_REG(gen, ADG, SRCOUT_TIMSEL0, 0x48),
+- RSND_GEN2_S_REG(gen, ADG, SRCOUT_TIMSEL1, 0x4c),
+- RSND_GEN2_S_REG(gen, ADG, SRCOUT_TIMSEL2, 0x50),
+- RSND_GEN2_S_REG(gen, ADG, SRCOUT_TIMSEL3, 0x54),
+- RSND_GEN2_S_REG(gen, ADG, SRCOUT_TIMSEL4, 0x58),
+- RSND_GEN2_S_REG(gen, ADG, CMDOUT_TIMSEL, 0x5c),
+-
+- RSND_GEN2_M_REG(gen, SSI, SSICR, 0x00, 0x40),
+- RSND_GEN2_M_REG(gen, SSI, SSISR, 0x04, 0x40),
+- RSND_GEN2_M_REG(gen, SSI, SSITDR, 0x08, 0x40),
+- RSND_GEN2_M_REG(gen, SSI, SSIRDR, 0x0c, 0x40),
+- RSND_GEN2_M_REG(gen, SSI, SSIWSR, 0x20, 0x40),
+- };
+-
+- return rsnd_gen_regmap_init(priv, gen, regf);
+-}
+-
+ static int rsnd_gen2_probe(struct platform_device *pdev,
+ struct rsnd_priv *priv)
+ {
+ struct device *dev = rsnd_priv_to_dev(priv);
+- struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
+- struct resource *scu_res;
+- struct resource *adg_res;
+- struct resource *ssiu_res;
+- struct resource *ssi_res;
+- int ret;
+-
+- /*
+- * map address
+- */
+- scu_res = platform_get_resource(pdev, IORESOURCE_MEM, RSND_GEN2_SCU);
+- adg_res = platform_get_resource(pdev, IORESOURCE_MEM, RSND_GEN2_ADG);
+- ssiu_res = platform_get_resource(pdev, IORESOURCE_MEM, RSND_GEN2_SSIU);
+- ssi_res = platform_get_resource(pdev, IORESOURCE_MEM, RSND_GEN2_SSI);
+-
+- gen->base[RSND_GEN2_SCU] = devm_ioremap_resource(dev, scu_res);
+- gen->base[RSND_GEN2_ADG] = devm_ioremap_resource(dev, adg_res);
+- gen->base[RSND_GEN2_SSIU] = devm_ioremap_resource(dev, ssiu_res);
+- gen->base[RSND_GEN2_SSI] = devm_ioremap_resource(dev, ssi_res);
+- if (IS_ERR(gen->base[RSND_GEN2_SCU]) ||
+- IS_ERR(gen->base[RSND_GEN2_ADG]) ||
+- IS_ERR(gen->base[RSND_GEN2_SSIU]) ||
+- IS_ERR(gen->base[RSND_GEN2_SSI]))
+- return -ENODEV;
+-
+- ret = rsnd_gen2_regmap_init(priv, gen);
+- if (ret < 0)
+- return ret;
+-
+- dev_dbg(dev, "Gen2 device probed\n");
+- dev_dbg(dev, "SCU : %pap => %p\n", &scu_res->start,
+- gen->base[RSND_GEN2_SCU]);
+- dev_dbg(dev, "ADG : %pap => %p\n", &adg_res->start,
+- gen->base[RSND_GEN2_ADG]);
+- dev_dbg(dev, "SSIU : %pap => %p\n", &ssiu_res->start,
+- gen->base[RSND_GEN2_SSIU]);
+- dev_dbg(dev, "SSI : %pap => %p\n", &ssi_res->start,
+- gen->base[RSND_GEN2_SSI]);
++ struct rsnd_regmap_field_conf conf_ssiu[] = {
++ RSND_GEN_S_REG(SSI_MODE0, 0x800),
++ RSND_GEN_S_REG(SSI_MODE1, 0x804),
++ /* FIXME: it needs SSI_MODE2/3 in the future */
++ RSND_GEN_M_REG(SSI_BUSIF_MODE, 0x0, 0x80),
++ RSND_GEN_M_REG(SSI_BUSIF_ADINR, 0x4, 0x80),
++ RSND_GEN_M_REG(SSI_CTRL, 0x10, 0x80),
++ RSND_GEN_M_REG(INT_ENABLE, 0x18, 0x80),
++ };
++ struct rsnd_regmap_field_conf conf_scu[] = {
++ RSND_GEN_M_REG(SRC_BUSIF_MODE, 0x0, 0x20),
++ RSND_GEN_M_REG(SRC_ROUTE_MODE0, 0xc, 0x20),
++ RSND_GEN_M_REG(SRC_CTRL, 0x10, 0x20),
++ RSND_GEN_M_REG(CMD_ROUTE_SLCT, 0x18c, 0x20),
++ RSND_GEN_M_REG(CMD_CTRL, 0x190, 0x20),
++ RSND_GEN_M_REG(SRC_SWRSR, 0x200, 0x40),
++ RSND_GEN_M_REG(SRC_SRCIR, 0x204, 0x40),
++ RSND_GEN_M_REG(SRC_ADINR, 0x214, 0x40),
++ RSND_GEN_M_REG(SRC_IFSCR, 0x21c, 0x40),
++ RSND_GEN_M_REG(SRC_IFSVR, 0x220, 0x40),
++ RSND_GEN_M_REG(SRC_SRCCR, 0x224, 0x40),
++ RSND_GEN_M_REG(SRC_BSDSR, 0x22c, 0x40),
++ RSND_GEN_M_REG(SRC_BSISR, 0x238, 0x40),
++ RSND_GEN_M_REG(DVC_SWRSR, 0xe00, 0x100),
++ RSND_GEN_M_REG(DVC_DVUIR, 0xe04, 0x100),
++ RSND_GEN_M_REG(DVC_ADINR, 0xe08, 0x100),
++ RSND_GEN_M_REG(DVC_DVUCR, 0xe10, 0x100),
++ RSND_GEN_M_REG(DVC_ZCMCR, 0xe14, 0x100),
++ RSND_GEN_M_REG(DVC_VOL0R, 0xe28, 0x100),
++ RSND_GEN_M_REG(DVC_VOL1R, 0xe2c, 0x100),
++ RSND_GEN_M_REG(DVC_DVUER, 0xe48, 0x100),
++ };
++ struct rsnd_regmap_field_conf conf_adg[] = {
++ RSND_GEN_S_REG(BRRA, 0x00),
++ RSND_GEN_S_REG(BRRB, 0x04),
++ RSND_GEN_S_REG(SSICKR, 0x08),
++ RSND_GEN_S_REG(AUDIO_CLK_SEL0, 0x0c),
++ RSND_GEN_S_REG(AUDIO_CLK_SEL1, 0x10),
++ RSND_GEN_S_REG(AUDIO_CLK_SEL2, 0x14),
++ RSND_GEN_S_REG(DIV_EN, 0x30),
++ RSND_GEN_S_REG(SRCIN_TIMSEL0, 0x34),
++ RSND_GEN_S_REG(SRCIN_TIMSEL1, 0x38),
++ RSND_GEN_S_REG(SRCIN_TIMSEL2, 0x3c),
++ RSND_GEN_S_REG(SRCIN_TIMSEL3, 0x40),
++ RSND_GEN_S_REG(SRCIN_TIMSEL4, 0x44),
++ RSND_GEN_S_REG(SRCOUT_TIMSEL0, 0x48),
++ RSND_GEN_S_REG(SRCOUT_TIMSEL1, 0x4c),
++ RSND_GEN_S_REG(SRCOUT_TIMSEL2, 0x50),
++ RSND_GEN_S_REG(SRCOUT_TIMSEL3, 0x54),
++ RSND_GEN_S_REG(SRCOUT_TIMSEL4, 0x58),
++ RSND_GEN_S_REG(CMDOUT_TIMSEL, 0x5c),
++ };
++ struct rsnd_regmap_field_conf conf_ssi[] = {
++ RSND_GEN_M_REG(SSICR, 0x00, 0x40),
++ RSND_GEN_M_REG(SSISR, 0x04, 0x40),
++ RSND_GEN_M_REG(SSITDR, 0x08, 0x40),
++ RSND_GEN_M_REG(SSIRDR, 0x0c, 0x40),
++ RSND_GEN_M_REG(SSIWSR, 0x20, 0x40),
++ };
++ int ret_ssiu;
++ int ret_scu;
++ int ret_adg;
++ int ret_ssi;
++
++ ret_ssiu = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_SSIU, conf_ssiu);
++ ret_scu = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_SCU, conf_scu);
++ ret_adg = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_ADG, conf_adg);
++ ret_ssi = rsnd_gen_regmap_init(priv, 10, RSND_GEN2_SSI, conf_ssi);
++ if (ret_ssiu < 0 ||
++ ret_scu < 0 ||
++ ret_adg < 0 ||
++ ret_ssi < 0)
++ return ret_ssiu | ret_scu | ret_adg | ret_ssi;
++
++ dev_dbg(dev, "Gen2 is probed\n");
+
+ return 0;
+ }
+@@ -392,92 +361,60 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
+ * Gen1
+ */
+
+-/* single address mapping */
+-#define RSND_GEN1_S_REG(gen, reg, id, offset) \
+- RSND_REG_SET(gen, RSND_REG_##id, RSND_GEN1_##reg, offset, 0, 9)
+-
+-/* multi address mapping */
+-#define RSND_GEN1_M_REG(gen, reg, id, offset, _id_offset) \
+- RSND_REG_SET(gen, RSND_REG_##id, RSND_GEN1_##reg, offset, _id_offset, 9)
+-
+-static int rsnd_gen1_regmap_init(struct rsnd_priv *priv, struct rsnd_gen *gen)
+-{
+- struct reg_field regf[RSND_REG_MAX] = {
+- RSND_GEN1_S_REG(gen, SRU, SRC_ROUTE_SEL, 0x00),
+- RSND_GEN1_S_REG(gen, SRU, SRC_TMG_SEL0, 0x08),
+- RSND_GEN1_S_REG(gen, SRU, SRC_TMG_SEL1, 0x0c),
+- RSND_GEN1_S_REG(gen, SRU, SRC_TMG_SEL2, 0x10),
+- RSND_GEN1_S_REG(gen, SRU, SRC_ROUTE_CTRL, 0xc0),
+- RSND_GEN1_S_REG(gen, SRU, SSI_MODE0, 0xD0),
+- RSND_GEN1_S_REG(gen, SRU, SSI_MODE1, 0xD4),
+- RSND_GEN1_M_REG(gen, SRU, SRC_BUSIF_MODE, 0x20, 0x4),
+- RSND_GEN1_M_REG(gen, SRU, SRC_ROUTE_MODE0,0x50, 0x8),
+- RSND_GEN1_M_REG(gen, SRU, SRC_SWRSR, 0x200, 0x40),
+- RSND_GEN1_M_REG(gen, SRU, SRC_SRCIR, 0x204, 0x40),
+- RSND_GEN1_M_REG(gen, SRU, SRC_ADINR, 0x214, 0x40),
+- RSND_GEN1_M_REG(gen, SRU, SRC_IFSCR, 0x21c, 0x40),
+- RSND_GEN1_M_REG(gen, SRU, SRC_IFSVR, 0x220, 0x40),
+- RSND_GEN1_M_REG(gen, SRU, SRC_SRCCR, 0x224, 0x40),
+- RSND_GEN1_M_REG(gen, SRU, SRC_MNFSR, 0x228, 0x40),
+-
+- RSND_GEN1_S_REG(gen, ADG, BRRA, 0x00),
+- RSND_GEN1_S_REG(gen, ADG, BRRB, 0x04),
+- RSND_GEN1_S_REG(gen, ADG, SSICKR, 0x08),
+- RSND_GEN1_S_REG(gen, ADG, AUDIO_CLK_SEL0, 0x0c),
+- RSND_GEN1_S_REG(gen, ADG, AUDIO_CLK_SEL1, 0x10),
+- RSND_GEN1_S_REG(gen, ADG, AUDIO_CLK_SEL3, 0x18),
+- RSND_GEN1_S_REG(gen, ADG, AUDIO_CLK_SEL4, 0x1c),
+- RSND_GEN1_S_REG(gen, ADG, AUDIO_CLK_SEL5, 0x20),
+-
+- RSND_GEN1_M_REG(gen, SSI, SSICR, 0x00, 0x40),
+- RSND_GEN1_M_REG(gen, SSI, SSISR, 0x04, 0x40),
+- RSND_GEN1_M_REG(gen, SSI, SSITDR, 0x08, 0x40),
+- RSND_GEN1_M_REG(gen, SSI, SSIRDR, 0x0c, 0x40),
+- RSND_GEN1_M_REG(gen, SSI, SSIWSR, 0x20, 0x40),
+- };
+-
+- return rsnd_gen_regmap_init(priv, gen, regf);
+-}
+-
+ static int rsnd_gen1_probe(struct platform_device *pdev,
+ struct rsnd_priv *priv)
+ {
+ struct device *dev = rsnd_priv_to_dev(priv);
+- struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
+- struct resource *sru_res;
+- struct resource *adg_res;
+- struct resource *ssi_res;
+- int ret;
+-
+- /*
+- * map address
+- */
+- sru_res = platform_get_resource(pdev, IORESOURCE_MEM, RSND_GEN1_SRU);
+- adg_res = platform_get_resource(pdev, IORESOURCE_MEM, RSND_GEN1_ADG);
+- ssi_res = platform_get_resource(pdev, IORESOURCE_MEM, RSND_GEN1_SSI);
+-
+- gen->base[RSND_GEN1_SRU] = devm_ioremap_resource(dev, sru_res);
+- gen->base[RSND_GEN1_ADG] = devm_ioremap_resource(dev, adg_res);
+- gen->base[RSND_GEN1_SSI] = devm_ioremap_resource(dev, ssi_res);
+- if (IS_ERR(gen->base[RSND_GEN1_SRU]) ||
+- IS_ERR(gen->base[RSND_GEN1_ADG]) ||
+- IS_ERR(gen->base[RSND_GEN1_SSI]))
+- return -ENODEV;
++ struct rsnd_regmap_field_conf conf_sru[] = {
++ RSND_GEN_S_REG(SRC_ROUTE_SEL, 0x00),
++ RSND_GEN_S_REG(SRC_TMG_SEL0, 0x08),
++ RSND_GEN_S_REG(SRC_TMG_SEL1, 0x0c),
++ RSND_GEN_S_REG(SRC_TMG_SEL2, 0x10),
++ RSND_GEN_S_REG(SRC_ROUTE_CTRL, 0xc0),
++ RSND_GEN_S_REG(SSI_MODE0, 0xD0),
++ RSND_GEN_S_REG(SSI_MODE1, 0xD4),
++ RSND_GEN_M_REG(SRC_BUSIF_MODE, 0x20, 0x4),
++ RSND_GEN_M_REG(SRC_ROUTE_MODE0, 0x50, 0x8),
++ RSND_GEN_M_REG(SRC_SWRSR, 0x200, 0x40),
++ RSND_GEN_M_REG(SRC_SRCIR, 0x204, 0x40),
++ RSND_GEN_M_REG(SRC_ADINR, 0x214, 0x40),
++ RSND_GEN_M_REG(SRC_IFSCR, 0x21c, 0x40),
++ RSND_GEN_M_REG(SRC_IFSVR, 0x220, 0x40),
++ RSND_GEN_M_REG(SRC_SRCCR, 0x224, 0x40),
++ RSND_GEN_M_REG(SRC_MNFSR, 0x228, 0x40),
++ };
++ struct rsnd_regmap_field_conf conf_adg[] = {
++ RSND_GEN_S_REG(BRRA, 0x00),
++ RSND_GEN_S_REG(BRRB, 0x04),
++ RSND_GEN_S_REG(SSICKR, 0x08),
++ RSND_GEN_S_REG(AUDIO_CLK_SEL0, 0x0c),
++ RSND_GEN_S_REG(AUDIO_CLK_SEL1, 0x10),
++ RSND_GEN_S_REG(AUDIO_CLK_SEL3, 0x18),
++ RSND_GEN_S_REG(AUDIO_CLK_SEL4, 0x1c),
++ RSND_GEN_S_REG(AUDIO_CLK_SEL5, 0x20),
++ };
++ struct rsnd_regmap_field_conf conf_ssi[] = {
++ RSND_GEN_M_REG(SSICR, 0x00, 0x40),
++ RSND_GEN_M_REG(SSISR, 0x04, 0x40),
++ RSND_GEN_M_REG(SSITDR, 0x08, 0x40),
++ RSND_GEN_M_REG(SSIRDR, 0x0c, 0x40),
++ RSND_GEN_M_REG(SSIWSR, 0x20, 0x40),
++ };
++ int ret_sru;
++ int ret_adg;
++ int ret_ssi;
+
+- ret = rsnd_gen1_regmap_init(priv, gen);
+- if (ret < 0)
+- return ret;
++ ret_sru = rsnd_gen_regmap_init(priv, 9, RSND_GEN1_SRU, conf_sru);
++ ret_adg = rsnd_gen_regmap_init(priv, 9, RSND_GEN1_ADG, conf_adg);
++ ret_ssi = rsnd_gen_regmap_init(priv, 9, RSND_GEN1_SSI, conf_ssi);
++ if (ret_sru < 0 ||
++ ret_adg < 0 ||
++ ret_ssi < 0)
++ return ret_sru | ret_adg | ret_ssi;
+
+- dev_dbg(dev, "Gen1 device probed\n");
+- dev_dbg(dev, "SRU : %pap => %p\n", &sru_res->start,
+- gen->base[RSND_GEN1_SRU]);
+- dev_dbg(dev, "ADG : %pap => %p\n", &adg_res->start,
+- gen->base[RSND_GEN1_ADG]);
+- dev_dbg(dev, "SSI : %pap => %p\n", &ssi_res->start,
+- gen->base[RSND_GEN1_SSI]);
++ dev_dbg(dev, "Gen1 is probed\n");
+
+ return 0;
+-
+ }
+
+ /*
+--
+2.1.2
+
diff --git a/patches.renesas/0800-ASoC-rsnd-care-detail-of-SRC_BSDSR.patch b/patches.renesas/0800-ASoC-rsnd-care-detail-of-SRC_BSDSR.patch
new file mode 100644
index 00000000000000..f1a1988d6bd3b4
--- /dev/null
+++ b/patches.renesas/0800-ASoC-rsnd-care-detail-of-SRC_BSDSR.patch
@@ -0,0 +1,71 @@
+From 9415fe2ed03e4cd9d5095eefebd5db791f257651 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 30 Jul 2014 23:52:04 -0700
+Subject: ASoC: rsnd: care detail of SRC_BSDSR
+
+Driver should care more detail of SRC_BSDSR settings.
+The sound includes noise without this patch
+if it used SRC.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 054cd7f4b986a941b56372b743602f7df6569c98)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/src.c | 32 +++++++++++++++++++++++++++++++-
+ 1 file changed, 31 insertions(+), 1 deletion(-)
+
+diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
+index 4d39505c21cf..1ef811a26bd7 100644
+--- a/sound/soc/sh/rcar/src.c
++++ b/sound/soc/sh/rcar/src.c
+@@ -483,15 +483,45 @@ static struct rsnd_mod_ops rsnd_src_gen1_ops = {
+ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
+ struct rsnd_dai *rdai)
+ {
++ struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
++ struct device *dev = rsnd_priv_to_dev(priv);
++ struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
++ struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
++ struct rsnd_src *src = rsnd_mod_to_src(mod);
++ uint ratio;
+ int ret;
+
++ /* 6 - 1/6 are very enough ratio for SRC_BSDSR */
++ if (!rsnd_src_convert_rate(src))
++ ratio = 0;
++ else if (rsnd_src_convert_rate(src) > runtime->rate)
++ ratio = 100 * rsnd_src_convert_rate(src) / runtime->rate;
++ else
++ ratio = 100 * runtime->rate / rsnd_src_convert_rate(src);
++
++ if (ratio > 600) {
++ dev_err(dev, "FSO/FSI ratio error\n");
++ return -EINVAL;
++ }
++
+ ret = rsnd_src_set_convert_rate(mod, rdai);
+ if (ret < 0)
+ return ret;
+
+ rsnd_mod_write(mod, SRC_SRCCR, 0x00011110);
+
+- rsnd_mod_write(mod, SRC_BSDSR, 0x01800000);
++ switch (rsnd_mod_id(mod)) {
++ case 5:
++ case 6:
++ case 7:
++ case 8:
++ rsnd_mod_write(mod, SRC_BSDSR, 0x02400000);
++ break;
++ default:
++ rsnd_mod_write(mod, SRC_BSDSR, 0x01800000);
++ break;
++ }
++
+ rsnd_mod_write(mod, SRC_BSISR, 0x00100060);
+
+ return 0;
+--
+2.1.2
+
diff --git a/patches.renesas/0801-ASoC-rsnd-care-audio-local-bus-data-format-consisten.patch b/patches.renesas/0801-ASoC-rsnd-care-audio-local-bus-data-format-consisten.patch
new file mode 100644
index 00000000000000..b8639fa4dfb624
--- /dev/null
+++ b/patches.renesas/0801-ASoC-rsnd-care-audio-local-bus-data-format-consisten.patch
@@ -0,0 +1,98 @@
+From de42f72714d1b91e061159079898c31c74679ca9 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 30 Jul 2014 23:52:26 -0700
+Subject: ASoC: rsnd: care audio local bus data format consistency
+
+R-Car sound uses Audio Local Bus which uses Lch/Rch format.
+This bus is used if driver uses BUSIF.
+But sound data is written as Rch/Lch format in register.
+This means Rch <-> Lch will be inverted.
+SSIU :: BUSIF_DALIGN is used to controlling data format.
+
+Reported-by: Jun Watanabe <jun.watanabe.ue@renesas.com>
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 1cc7195929501b96fccce42646f1ad0ffe2598a6)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/gen.c | 1 +
+ sound/soc/sh/rcar/rsnd.h | 2 ++
+ sound/soc/sh/rcar/src.c | 19 +++++++++++++++++++
+ 3 files changed, 22 insertions(+)
+
+diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
+index 5f9e0722abcf..5db055750991 100644
+--- a/sound/soc/sh/rcar/gen.c
++++ b/sound/soc/sh/rcar/gen.c
+@@ -284,6 +284,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
+ /* FIXME: it needs SSI_MODE2/3 in the future */
+ RSND_GEN_M_REG(SSI_BUSIF_MODE, 0x0, 0x80),
+ RSND_GEN_M_REG(SSI_BUSIF_ADINR, 0x4, 0x80),
++ RSND_GEN_M_REG(BUSIF_DALIGN, 0x8, 0x80),
+ RSND_GEN_M_REG(SSI_CTRL, 0x10, 0x80),
+ RSND_GEN_M_REG(INT_ENABLE, 0x18, 0x80),
+ };
+diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
+index 631b149df08f..d119adf97c9c 100644
+--- a/sound/soc/sh/rcar/rsnd.h
++++ b/sound/soc/sh/rcar/rsnd.h
+@@ -90,6 +90,7 @@ enum rsnd_reg {
+ RSND_REG_SHARE19,
+ RSND_REG_SHARE20,
+ RSND_REG_SHARE21,
++ RSND_REG_SHARE22,
+
+ RSND_REG_MAX,
+ };
+@@ -127,6 +128,7 @@ enum rsnd_reg {
+ #define RSND_REG_AUDIO_CLK_SEL2 RSND_REG_SHARE19
+ #define RSND_REG_CMD_CTRL RSND_REG_SHARE20
+ #define RSND_REG_CMDOUT_TIMSEL RSND_REG_SHARE21
++#define RSND_REG_BUSIF_DALIGN RSND_REG_SHARE22
+
+ struct rsnd_of_data;
+ struct rsnd_priv;
+diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
+index 1ef811a26bd7..9183e0145503 100644
+--- a/sound/soc/sh/rcar/src.c
++++ b/sound/soc/sh/rcar/src.c
+@@ -110,6 +110,8 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+ struct rsnd_dai *rdai,
+ int use_busif)
+ {
++ struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod);
++ struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
+ int ssi_id = rsnd_mod_id(ssi_mod);
+
+ /*
+@@ -146,10 +148,27 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
+ * DMA settings for SSIU
+ */
+ if (use_busif) {
++ u32 val = 0x76543210;
++ u32 mask = ~0;
++
+ rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
+ rsnd_get_adinr(ssi_mod));
+ rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE, 1);
+ rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
++
++ mask <<= runtime->channels * 4;
++ val = val & mask;
++
++ switch (runtime->sample_bits) {
++ case 16:
++ val |= 0x67452301 & ~mask;
++ break;
++ case 32:
++ val |= 0x76543210 & ~mask;
++ break;
++ }
++ rsnd_mod_write(ssi_mod, BUSIF_DALIGN, val);
++
+ }
+
+ return 0;
+--
+2.1.2
+
diff --git a/patches.renesas/0802-ASoC-rsnd-add-missing-dev_dbg-in-rsnd_bset.patch b/patches.renesas/0802-ASoC-rsnd-add-missing-dev_dbg-in-rsnd_bset.patch
new file mode 100644
index 00000000000000..21fe99b7281b39
--- /dev/null
+++ b/patches.renesas/0802-ASoC-rsnd-add-missing-dev_dbg-in-rsnd_bset.patch
@@ -0,0 +1,43 @@
+From ea63bc79e423c9b497c19f310785995cd7cdb530 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 30 Jul 2014 23:52:50 -0700
+Subject: ASoC: rsnd: add missing dev_dbg() in rsnd_bset()
+
+b8c637864a6904a9ba8e0df556d5bdf9f26b2c54
+(ASoC: rsnd: use regmap_mmio instead of original regmap bus)
+used regmap_mmio and modified dev_dbg() for rsnd_read/write().
+But rsnd_bset() is missing it.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 4f8f86aa41232cc4595136f18013324482fdf749)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/gen.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
+index 5db055750991..3fdf3be7b99a 100644
+--- a/sound/soc/sh/rcar/gen.c
++++ b/sound/soc/sh/rcar/gen.c
+@@ -92,6 +92,7 @@ void rsnd_write(struct rsnd_priv *priv,
+ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,
+ enum rsnd_reg reg, u32 mask, u32 data)
+ {
++ struct device *dev = rsnd_priv_to_dev(priv);
+ struct rsnd_gen *gen = rsnd_priv_to_gen(priv);
+
+ if (!rsnd_is_accessible_reg(priv, gen, reg))
+@@ -99,6 +100,9 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,
+
+ regmap_fields_update_bits(gen->regs[reg], rsnd_mod_id(mod),
+ mask, data);
++
++ dev_dbg(dev, "b %s - 0x%04d : %08x/%08x\n",
++ rsnd_mod_name(mod), reg, data, mask);
+ }
+
+ #define rsnd_gen_regmap_init(priv, id_size, reg_id, conf) \
+--
+2.1.2
+
diff --git a/patches.renesas/0803-ASoC-rsnd-fixup-pcm_new-callback-method.patch b/patches.renesas/0803-ASoC-rsnd-fixup-pcm_new-callback-method.patch
new file mode 100644
index 00000000000000..f33f0302a8063b
--- /dev/null
+++ b/patches.renesas/0803-ASoC-rsnd-fixup-pcm_new-callback-method.patch
@@ -0,0 +1,55 @@
+From 3d14d6ad95c0a1de443f66fd3bc24c24e18d065e Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 30 Jul 2014 23:53:03 -0700
+Subject: ASoC: rsnd: fixup pcm_new callback method
+
+bff58ea4f43d9b4a9fd6fb05fabc8f50f68131f5
+(ASoC: rsnd: add DVC support) added DVC support,
+and it added pcm_new callback feature for it.
+Then it called all DAI's pcm_new callback, and it was wrong.
+This patch fixup it and call correct callback.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 7c63f3c02f5a998621758239abed43c5bd454b70)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/core.c | 20 +++++++++-----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index f07742f1eb11..d7c669790dd4 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -944,19 +944,17 @@ static struct snd_pcm_ops rsnd_pcm_ops = {
+
+ static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd)
+ {
+- struct rsnd_priv *priv = snd_soc_dai_get_drvdata(rtd->cpu_dai);
+- struct rsnd_dai *rdai;
+- int i, ret;
++ struct snd_soc_dai *dai = rtd->cpu_dai;
++ struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
++ int ret;
+
+- for_each_rsnd_dai(rdai, priv, i) {
+- ret = rsnd_dai_call(pcm_new, &rdai->playback, rdai, rtd);
+- if (ret)
+- return ret;
++ ret = rsnd_dai_call(pcm_new, &rdai->playback, rdai, rtd);
++ if (ret)
++ return ret;
+
+- ret = rsnd_dai_call(pcm_new, &rdai->capture, rdai, rtd);
+- if (ret)
+- return ret;
+- }
++ ret = rsnd_dai_call(pcm_new, &rdai->capture, rdai, rtd);
++ if (ret)
++ return ret;
+
+ return snd_pcm_lib_preallocate_pages_for_all(
+ rtd->pcm,
+--
+2.1.2
+
diff --git a/patches.renesas/0804-ASoC-rsnd-fixup-SND_SOC_DAIFMT_xB_xF-behavior.patch b/patches.renesas/0804-ASoC-rsnd-fixup-SND_SOC_DAIFMT_xB_xF-behavior.patch
new file mode 100644
index 00000000000000..43a2067b4a57ea
--- /dev/null
+++ b/patches.renesas/0804-ASoC-rsnd-fixup-SND_SOC_DAIFMT_xB_xF-behavior.patch
@@ -0,0 +1,92 @@
+From 45a398dcadf51ee28cfe4dae8890d0fac70dc597 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 31 Jul 2014 18:08:18 -0700
+Subject: ASoC: rsnd: fixup SND_SOC_DAIFMT_xB_xF behavior
+
+In current R-Car rsnd driver,
+the SND_SOC_DAIFMT_xB_xF flags are used to HW default behavior,
+but, it should be used to specific format.
+The waveforms of LEFT_J/RIGHT_J format with
+SND_SOC_DAIFMT_NB_NF flag will be
+started from "falling edge" without this patch.
+But, it should be started from "rising edge".
+
+Reported-by: Jun Watanabe <jun.watanabe.ue@renesas.com>
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 1a7889ca8aba333d7c74fad543d692c31bc7f280)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/core.c | 43 ++++++++++++++++++++++---------------------
+ 1 file changed, 22 insertions(+), 21 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
+index d7c669790dd4..19f78963e8b9 100644
+--- a/sound/soc/sh/rcar/core.c
++++ b/sound/soc/sh/rcar/core.c
+@@ -624,40 +624,41 @@ static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
+ return -EINVAL;
+ }
+
+- /* set clock inversion */
+- switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+- case SND_SOC_DAIFMT_NB_IF:
+- rdai->bit_clk_inv = 0;
+- rdai->frm_clk_inv = 1;
+- break;
+- case SND_SOC_DAIFMT_IB_NF:
+- rdai->bit_clk_inv = 1;
+- rdai->frm_clk_inv = 0;
+- break;
+- case SND_SOC_DAIFMT_IB_IF:
+- rdai->bit_clk_inv = 1;
+- rdai->frm_clk_inv = 1;
+- break;
+- case SND_SOC_DAIFMT_NB_NF:
+- default:
+- rdai->bit_clk_inv = 0;
+- rdai->frm_clk_inv = 0;
+- break;
+- }
+-
+ /* set format */
+ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+ case SND_SOC_DAIFMT_I2S:
+ rdai->sys_delay = 0;
+ rdai->data_alignment = 0;
++ rdai->frm_clk_inv = 0;
+ break;
+ case SND_SOC_DAIFMT_LEFT_J:
+ rdai->sys_delay = 1;
+ rdai->data_alignment = 0;
++ rdai->frm_clk_inv = 1;
+ break;
+ case SND_SOC_DAIFMT_RIGHT_J:
+ rdai->sys_delay = 1;
+ rdai->data_alignment = 1;
++ rdai->frm_clk_inv = 1;
++ break;
++ }
++
++ /* set clock inversion */
++ switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
++ case SND_SOC_DAIFMT_NB_IF:
++ rdai->bit_clk_inv = rdai->bit_clk_inv;
++ rdai->frm_clk_inv = !rdai->frm_clk_inv;
++ break;
++ case SND_SOC_DAIFMT_IB_NF:
++ rdai->bit_clk_inv = !rdai->bit_clk_inv;
++ rdai->frm_clk_inv = rdai->frm_clk_inv;
++ break;
++ case SND_SOC_DAIFMT_IB_IF:
++ rdai->bit_clk_inv = !rdai->bit_clk_inv;
++ rdai->frm_clk_inv = !rdai->frm_clk_inv;
++ break;
++ case SND_SOC_DAIFMT_NB_NF:
++ default:
+ break;
+ }
+
+--
+2.1.2
+
diff --git a/patches.renesas/0805-ASoC-rsnd-tidyup-DVC-control-method.patch b/patches.renesas/0805-ASoC-rsnd-tidyup-DVC-control-method.patch
new file mode 100644
index 00000000000000..484f53eda0a988
--- /dev/null
+++ b/patches.renesas/0805-ASoC-rsnd-tidyup-DVC-control-method.patch
@@ -0,0 +1,135 @@
+From 298d5d55e2eae2b5e3a2fcca22a8d9e9eaca7a01 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Fri, 1 Aug 2014 03:10:47 -0700
+Subject: ASoC: rsnd: tidyup DVC control method
+
+DVC can use Volume and Mute control,
+and these control methods doesn't have much difference.
+This patch cleanup current method,
+and it will be used for Mute control.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 486b09c750e58777976ad74a37de7b4252630332)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/dvc.c | 59 ++++++++++++++++++++++++++++---------------------
+ 1 file changed, 34 insertions(+), 25 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
+index 9096fb03d001..12a0a2068d34 100644
+--- a/sound/soc/sh/rcar/dvc.c
++++ b/sound/soc/sh/rcar/dvc.c
+@@ -20,7 +20,7 @@ struct rsnd_dvc {
+ struct rsnd_dvc_platform_info *info; /* rcar_snd.h */
+ struct rsnd_mod mod;
+ struct clk *clk;
+- long volume[RSND_DVC_VOLUME_NUM];
++ u8 volume[RSND_DVC_VOLUME_NUM];
+ };
+
+ #define rsnd_mod_to_dvc(_mod) \
+@@ -151,12 +151,11 @@ static int rsnd_dvc_volume_info(struct snd_kcontrol *kctrl,
+ static int rsnd_dvc_volume_get(struct snd_kcontrol *kctrl,
+ struct snd_ctl_elem_value *ucontrol)
+ {
+- struct rsnd_mod *mod = snd_kcontrol_chip(kctrl);
+- struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
++ u8 *val = (u8 *)kctrl->private_value;
+ int i;
+
+ for (i = 0; i < RSND_DVC_VOLUME_NUM; i++)
+- ucontrol->value.integer.value[i] = dvc->volume[i];
++ ucontrol->value.integer.value[i] = val[i];
+
+ return 0;
+ }
+@@ -165,47 +164,38 @@ static int rsnd_dvc_volume_put(struct snd_kcontrol *kctrl,
+ struct snd_ctl_elem_value *ucontrol)
+ {
+ struct rsnd_mod *mod = snd_kcontrol_chip(kctrl);
+- struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
++ u8 *val = (u8 *)kctrl->private_value;
+ int i, change = 0;
+
+ for (i = 0; i < RSND_DVC_VOLUME_NUM; i++) {
+- if (ucontrol->value.integer.value[i] < 0 ||
+- ucontrol->value.integer.value[i] > RSND_DVC_VOLUME_MAX)
+- return -EINVAL;
+-
+- change |= (ucontrol->value.integer.value[i] != dvc->volume[i]);
++ change |= (ucontrol->value.integer.value[i] != val[i]);
++ val[i] = ucontrol->value.integer.value[i];
+ }
+
+- if (change) {
+- for (i = 0; i < RSND_DVC_VOLUME_NUM; i++)
+- dvc->volume[i] = ucontrol->value.integer.value[i];
+-
++ if (change)
+ rsnd_dvc_volume_update(mod);
+- }
+
+ return change;
+ }
+
+-static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
+- struct rsnd_dai *rdai,
+- struct snd_soc_pcm_runtime *rtd)
++static int __rsnd_dvc_pcm_new(struct rsnd_mod *mod,
++ struct rsnd_dai *rdai,
++ struct snd_soc_pcm_runtime *rtd,
++ const unsigned char *name,
++ u8 *private)
+ {
+- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
+ struct snd_card *card = rtd->card->snd_card;
+ struct snd_kcontrol *kctrl;
+- static struct snd_kcontrol_new knew = {
++ struct snd_kcontrol_new knew = {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
++ .name = name,
+ .info = rsnd_dvc_volume_info,
+ .get = rsnd_dvc_volume_get,
+ .put = rsnd_dvc_volume_put,
++ .private_value = (unsigned long)private,
+ };
+ int ret;
+
+- if (rsnd_dai_is_play(rdai, io))
+- knew.name = "Playback Volume";
+- else
+- knew.name = "Capture Volume";
+-
+ kctrl = snd_ctl_new1(&knew, mod);
+ if (!kctrl)
+ return -ENOMEM;
+@@ -217,6 +207,25 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
+ return 0;
+ }
+
++static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
++ struct rsnd_dai *rdai,
++ struct snd_soc_pcm_runtime *rtd)
++{
++ struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
++ struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
++ int ret;
++
++ /* Volume */
++ ret = __rsnd_dvc_pcm_new(mod, rdai, rtd,
++ rsnd_dai_is_play(rdai, io) ?
++ "DVC Out Playback Volume" : "DVC In Capture Volume",
++ dvc->volume);
++ if (ret < 0)
++ return ret;
++
++ return 0;
++}
++
+ static struct rsnd_mod_ops rsnd_dvc_ops = {
+ .name = DVC_NAME,
+ .probe = rsnd_dvc_probe_gen2,
+--
+2.1.2
+
diff --git a/patches.renesas/0806-ASoC-rsnd-enable-Mute-control-on-DVC.patch b/patches.renesas/0806-ASoC-rsnd-enable-Mute-control-on-DVC.patch
new file mode 100644
index 00000000000000..71a14681380222
--- /dev/null
+++ b/patches.renesas/0806-ASoC-rsnd-enable-Mute-control-on-DVC.patch
@@ -0,0 +1,100 @@
+From f2dbfbc0ae3f37895504e88f4678ccc4e16a4504 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Fri, 1 Aug 2014 03:10:55 -0700
+Subject: ASoC: rsnd: enable Mute control on DVC
+
+DVC can control Mute.
+This patch supports it.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit cd2b65741e72da64508957cd1cde85116102d8dd)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/dvc.c | 34 +++++++++++++++++++++++++++++-----
+ 1 file changed, 29 insertions(+), 5 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
+index 12a0a2068d34..3f443930c2b1 100644
+--- a/sound/soc/sh/rcar/dvc.c
++++ b/sound/soc/sh/rcar/dvc.c
+@@ -21,6 +21,7 @@ struct rsnd_dvc {
+ struct rsnd_mod mod;
+ struct clk *clk;
+ u8 volume[RSND_DVC_VOLUME_NUM];
++ u8 mute[RSND_DVC_VOLUME_NUM];
+ };
+
+ #define rsnd_mod_to_dvc(_mod) \
+@@ -37,13 +38,18 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod)
+ struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
+ u32 max = (0x00800000 - 1);
+ u32 vol[RSND_DVC_VOLUME_NUM];
++ u32 mute = 0;
+ int i;
+
+- for (i = 0; i < RSND_DVC_VOLUME_NUM; i++)
++ for (i = 0; i < RSND_DVC_VOLUME_NUM; i++) {
+ vol[i] = max / RSND_DVC_VOLUME_MAX * dvc->volume[i];
++ mute |= (!!dvc->mute[i]) << i;
++ }
+
+ rsnd_mod_write(mod, DVC_VOL0R, vol[0]);
+ rsnd_mod_write(mod, DVC_VOL1R, vol[1]);
++
++ rsnd_mod_write(mod, DVC_ZCMCR, mute);
+ }
+
+ static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod,
+@@ -96,8 +102,8 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
+
+ rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod));
+
+- /* enable Volume */
+- rsnd_mod_write(dvc_mod, DVC_DVUCR, 0x100);
++ /* enable Volume / Mute */
++ rsnd_mod_write(dvc_mod, DVC_DVUCR, 0x101);
+
+ /* ch0/ch1 Volume */
+ rsnd_dvc_volume_update(dvc_mod);
+@@ -140,10 +146,20 @@ static int rsnd_dvc_stop(struct rsnd_mod *mod,
+ static int rsnd_dvc_volume_info(struct snd_kcontrol *kctrl,
+ struct snd_ctl_elem_info *uinfo)
+ {
+- uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
++ struct rsnd_mod *mod = snd_kcontrol_chip(kctrl);
++ struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
++ u8 *val = (u8 *)kctrl->private_value;
++
+ uinfo->count = RSND_DVC_VOLUME_NUM;
+ uinfo->value.integer.min = 0;
+- uinfo->value.integer.max = RSND_DVC_VOLUME_MAX;
++
++ if (val == dvc->volume) {
++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
++ uinfo->value.integer.max = RSND_DVC_VOLUME_MAX;
++ } else {
++ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
++ uinfo->value.integer.max = 1;
++ }
+
+ return 0;
+ }
+@@ -223,6 +239,14 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
+ if (ret < 0)
+ return ret;
+
++ /* Mute */
++ ret = __rsnd_dvc_pcm_new(mod, rdai, rtd,
++ rsnd_dai_is_play(rdai, io) ?
++ "DVC Out Mute Switch" : "DVC In Mute Switch",
++ dvc->mute);
++ if (ret < 0)
++ return ret;
++
+ return 0;
+ }
+
+--
+2.1.2
+
diff --git a/patches.renesas/0807-ARM-shmobile-armadillo800eva-reference-dts-Add-match.patch b/patches.renesas/0807-ARM-shmobile-armadillo800eva-reference-dts-Add-match.patch
new file mode 100644
index 00000000000000..b87bac50c3a896
--- /dev/null
+++ b/patches.renesas/0807-ARM-shmobile-armadillo800eva-reference-dts-Add-match.patch
@@ -0,0 +1,49 @@
+From 4289dafc39771144cf6ff5d40808ca42e1d7f591 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 14 May 2014 16:51:19 +0200
+Subject: ARM: shmobile: armadillo800eva reference dts: Add matching LED labels
+
+And make the node name numbering match the label numbering.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Cc: devicetree@vger.kernel.org
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 0ba06992e8919128d0547066247de9e54a8bb992)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+index 486007d7ffe4..f6ef73ff49e8 100644
+--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
++++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+@@ -104,17 +104,21 @@
+
+ leds {
+ compatible = "gpio-leds";
+- led1 {
++ led3 {
+ gpios = <&pfc 102 GPIO_ACTIVE_HIGH>;
++ label = "LED3";
+ };
+- led2 {
++ led4 {
+ gpios = <&pfc 111 GPIO_ACTIVE_HIGH>;
++ label = "LED4";
+ };
+- led3 {
++ led5 {
+ gpios = <&pfc 110 GPIO_ACTIVE_HIGH>;
++ label = "LED5";
+ };
+- led4 {
++ led6 {
+ gpios = <&pfc 177 GPIO_ACTIVE_HIGH>;
++ label = "LED6";
+ };
+ };
+
+--
+2.1.2
+
diff --git a/patches.renesas/0808-ARM-shmobile-marzen-Remove-early_printk-from-command.patch b/patches.renesas/0808-ARM-shmobile-marzen-Remove-early_printk-from-command.patch
new file mode 100644
index 00000000000000..97d3b42bedffc1
--- /dev/null
+++ b/patches.renesas/0808-ARM-shmobile-marzen-Remove-early_printk-from-command.patch
@@ -0,0 +1,33 @@
+From 57699751bba17af267b253a3746a62d039b7c5a9 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:39:31 +0900
+Subject: ARM: shmobile: marzen: Remove early_printk from command line
+
+As early printk support is not enabled in the kernel in the
+shmobile defconfig it does not make much sense to provide for
+it in the default command line.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 7432695daeebffa39bae94d8f15ffe96ede3e581)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779-marzen.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
+index a7af2c2371f2..ee2338838b3f 100644
+--- a/arch/arm/boot/dts/r8a7779-marzen.dts
++++ b/arch/arm/boot/dts/r8a7779-marzen.dts
+@@ -17,7 +17,7 @@
+ compatible = "renesas,marzen", "renesas,r8a7779";
+
+ chosen {
+- bootargs = "console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on";
++ bootargs = "console=ttySC2,115200 ignore_loglevel root=/dev/nfs ip=on";
+ };
+
+ memory {
+--
+2.1.2
+
diff --git a/patches.renesas/0809-ARM-shmobile-armadillo800eva-defconfig-Enable-REGULA.patch b/patches.renesas/0809-ARM-shmobile-armadillo800eva-defconfig-Enable-REGULA.patch
new file mode 100644
index 00000000000000..ca98599fa1a0ee
--- /dev/null
+++ b/patches.renesas/0809-ARM-shmobile-armadillo800eva-defconfig-Enable-REGULA.patch
@@ -0,0 +1,43 @@
+From c81134b4da032c0c33e7425b5f06f8da1a6af9d8 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 14 May 2014 16:51:22 +0200
+Subject: ARM: shmobile: armadillo800eva defconfig: Enable REGULATOR_GPIO and
+ LEDS_GPIO
+
+Enable missing options for devices in platform data and/or DT:
+ - REGULATOR_GPIO
+ - LEDS_GPIO (and its dependencies)
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 65b590adb672cbe91624f9bd7a80d5ef8919db48)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/configs/armadillo800eva_defconfig | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
+index 065adddeee3e..d9675c68a399 100644
+--- a/arch/arm/configs/armadillo800eva_defconfig
++++ b/arch/arm/configs/armadillo800eva_defconfig
+@@ -96,6 +96,7 @@ CONFIG_I2C_GPIO=y
+ CONFIG_I2C_SH_MOBILE=y
+ # CONFIG_HWMON is not set
+ CONFIG_REGULATOR=y
++CONFIG_REGULATOR_GPIO=y
+ CONFIG_MEDIA_SUPPORT=y
+ CONFIG_VIDEO_DEV=y
+ CONFIG_MEDIA_CAMERA_SUPPORT=y
+@@ -127,6 +128,9 @@ CONFIG_USB_ETH=m
+ CONFIG_MMC=y
+ CONFIG_MMC_SDHI=y
+ CONFIG_MMC_SH_MMCIF=y
++CONFIG_NEW_LEDS=y
++CONFIG_LEDS_CLASS=y
++CONFIG_LEDS_GPIO=y
+ CONFIG_RTC_CLASS=y
+ CONFIG_RTC_DRV_S35390A=y
+ CONFIG_DMADEVICES=y
+--
+2.1.2
+
diff --git a/patches.renesas/0810-ARM-shmobile-marzen-Add-to-shmobile-defconfig.patch b/patches.renesas/0810-ARM-shmobile-marzen-Add-to-shmobile-defconfig.patch
new file mode 100644
index 00000000000000..900d450bd36376
--- /dev/null
+++ b/patches.renesas/0810-ARM-shmobile-marzen-Add-to-shmobile-defconfig.patch
@@ -0,0 +1,59 @@
+From 61e6d754f609affaa934e69be6a43230c4dd576b Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms@verge.net.au>
+Date: Fri, 16 May 2014 09:04:13 +0900
+Subject: ARM: shmobile: marzen: Add to shmobile defconfig
+
+Add marzen to shmobile defconfig now that it supports multiplatform
+Also enable SH_HSPI which is used by marzen.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit b2bfcdc2f28b045cf01f63d0949f7eb9bd597405)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/configs/shmobile_defconfig | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
+index 6d6437cbbc52..8cde033b08a7 100644
+--- a/arch/arm/configs/shmobile_defconfig
++++ b/arch/arm/configs/shmobile_defconfig
+@@ -10,10 +10,12 @@ CONFIG_PERF_EVENTS=y
+ CONFIG_SLAB=y
+ CONFIG_ARCH_SHMOBILE_MULTI=y
+ CONFIG_ARCH_EMEV2=y
++CONFIG_ARCH_R8A7779=y
+ CONFIG_ARCH_R8A7790=y
+ CONFIG_ARCH_R8A7791=y
+ CONFIG_MACH_KOELSCH=y
+ CONFIG_MACH_LAGER=y
++CONFIG_MACH_MARZEN=y
+ # CONFIG_SWP_EMULATE is not set
+ CONFIG_CPU_BPREDICT_DISABLE=y
+ CONFIG_PL310_ERRATA_588369=y
+@@ -82,6 +84,7 @@ CONFIG_I2C_RCAR=y
+ CONFIG_SPI=y
+ CONFIG_SPI_RSPI=y
+ CONFIG_SPI_SH_MSIOF=y
++CONFIG_SPI_SH_HSPI=y
+ CONFIG_GPIO_EM=y
+ CONFIG_GPIO_RCAR=y
+ # CONFIG_HWMON is not set
+@@ -109,12 +112,14 @@ CONFIG_SND=y
+ CONFIG_SND_SOC=y
+ CONFIG_SND_SOC_RCAR=y
+ CONFIG_USB=y
+-CONFIG_USB_RCAR_GEN2_PHY=y
+ CONFIG_USB_EHCI_HCD=y
+ CONFIG_USB_OHCI_HCD=y
+ CONFIG_USB_RENESAS_USBHS=y
++CONFIG_USB_RCAR_PHY=y
++CONFIG_USB_RCAR_GEN2_PHY=y
+ CONFIG_USB_GADGET=y
+ CONFIG_USB_RENESAS_USBHS_UDC=y
++CONFIG_USB_ETH=y
+ CONFIG_MMC=y
+ CONFIG_MMC_SDHI=y
+ CONFIG_MMC_SH_MMCIF=y
+--
+2.1.2
+
diff --git a/patches.renesas/0811-ARM-shmobile-Enable-PM_RUNTIME-in-defconfig.patch b/patches.renesas/0811-ARM-shmobile-Enable-PM_RUNTIME-in-defconfig.patch
new file mode 100644
index 00000000000000..1a37d2801bbe13
--- /dev/null
+++ b/patches.renesas/0811-ARM-shmobile-Enable-PM_RUNTIME-in-defconfig.patch
@@ -0,0 +1,28 @@
+From 65793cc0d1b43fd004da2c0ba34e9c9e099e65ff Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Fri, 16 May 2014 09:04:42 +0900
+Subject: ARM: shmobile: Enable PM_RUNTIME in defconfig
+
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 6e2776388a85e6b41e8cc816ece318d944fc3388)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/configs/shmobile_defconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
+index 8cde033b08a7..94d7736cbf9e 100644
+--- a/arch/arm/configs/shmobile_defconfig
++++ b/arch/arm/configs/shmobile_defconfig
+@@ -35,6 +35,7 @@ CONFIG_KEXEC=y
+ CONFIG_VFP=y
+ CONFIG_NEON=y
+ # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
++CONFIG_PM_RUNTIME=y
+ CONFIG_NET=y
+ CONFIG_PACKET=y
+ CONFIG_UNIX=y
+--
+2.1.2
+
diff --git a/patches.renesas/0812-ARM-shmobile-Enable-CPUFREQ-configuration.patch b/patches.renesas/0812-ARM-shmobile-Enable-CPUFREQ-configuration.patch
new file mode 100644
index 00000000000000..64e9beec6749bc
--- /dev/null
+++ b/patches.renesas/0812-ARM-shmobile-Enable-CPUFREQ-configuration.patch
@@ -0,0 +1,40 @@
+From 627ccfbbff6f45cda64ee5b981051a46e15d17b9 Mon Sep 17 00:00:00 2001
+From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Date: Tue, 3 Jun 2014 21:03:34 +0900
+Subject: ARM: shmobile: Enable CPUFREQ configuration
+
+This changes of configuration is multiplatform build only for r8a7790/r8a7791.
+
+Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 468c570ed078f0326745bfe85868adb925659502)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/configs/shmobile_defconfig | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
+index 94d7736cbf9e..c4b72aa48e67 100644
+--- a/arch/arm/configs/shmobile_defconfig
++++ b/arch/arm/configs/shmobile_defconfig
+@@ -147,3 +147,16 @@ CONFIG_NLS_ISO8859_1=y
+ # CONFIG_ENABLE_WARN_DEPRECATED is not set
+ # CONFIG_ENABLE_MUST_CHECK is not set
+ # CONFIG_ARM_UNWIND is not set
++CONFIG_CPU_FREQ=y
++CONFIG_CPU_FREQ_GOV_COMMON=y
++CONFIG_CPU_FREQ_STAT=y
++CONFIG_CPU_FREQ_STAT_DETAILS=y
++CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
++CONFIG_CPU_FREQ_GOV_POWERSAVE=y
++CONFIG_CPU_FREQ_GOV_USERSPACE=y
++CONFIG_CPU_FREQ_GOV_ONDEMAND=y
++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
++CONFIG_CPU_THERMAL=y
++CONFIG_GENERIC_CPUFREQ_CPU0=y
++CONFIG_REGULATOR_DA9210=y
+--
+2.1.2
+
diff --git a/patches.renesas/0813-ARM-shmobile-add-cpufreq-cpu0-driver-for-common-SH-M.patch b/patches.renesas/0813-ARM-shmobile-add-cpufreq-cpu0-driver-for-common-SH-M.patch
new file mode 100644
index 00000000000000..36d87188bc0a29
--- /dev/null
+++ b/patches.renesas/0813-ARM-shmobile-add-cpufreq-cpu0-driver-for-common-SH-M.patch
@@ -0,0 +1,98 @@
+From 29ba2a1cfe5146594f3829a70a1a278b4c3702dd Mon Sep 17 00:00:00 2001
+From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Date: Tue, 3 Jun 2014 21:02:45 +0900
+Subject: ARM: shmobile: add cpufreq-cpu0 driver for common SH-Mobile
+
+I add a new file(cpufreq.c) for the following reasons.
+- Registration of platform_device must be unified in SH-Mobile.
+- We can't create a node of cpufreq drivers into device tree.
+ (Because cpufreq driver is virtual device.)
+
+Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 06e32c91dbce3c24ccbe84e3af2a35199662bca0)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/Makefile | 1 +
+ arch/arm/mach-shmobile/cpufreq.c | 31 ++++++++++++++++++++++++++++
+ arch/arm/mach-shmobile/include/mach/common.h | 7 +++++++
+ 3 files changed, 39 insertions(+)
+ create mode 100644 arch/arm/mach-shmobile/cpufreq.c
+
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index 38d5fe825e93..1b966da2c81c 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -48,6 +48,7 @@ obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
+ # PM objects
+ obj-$(CONFIG_SUSPEND) += suspend.o
+ obj-$(CONFIG_CPU_IDLE) += cpuidle.o
++obj-$(CONFIG_CPU_FREQ) += cpufreq.o
+ obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o
+ obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o
+ obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o
+diff --git a/arch/arm/mach-shmobile/cpufreq.c b/arch/arm/mach-shmobile/cpufreq.c
+new file mode 100644
+index 000000000000..e2c868fc41cf
+--- /dev/null
++++ b/arch/arm/mach-shmobile/cpufreq.c
+@@ -0,0 +1,31 @@
++/*
++ * CPUFreq support code for SH-Mobile ARM
++ *
++ * Copyright (C) 2014 Gaku Inami
++ *
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License. See the file "COPYING" in the main directory of this archive
++ * for more details.
++ */
++
++#include <linux/of.h>
++#include <linux/of_device.h>
++#include <linux/platform_device.h>
++
++int __init shmobile_cpufreq_init(void)
++{
++ struct device_node *np;
++
++ np = of_cpu_device_node_get(0);
++ if (np == NULL) {
++ pr_err("failed to find cpu0 node\n");
++ return 0;
++ }
++
++ if (of_get_property(np, "operating-points", NULL))
++ platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0);
++
++ of_node_put(np);
++
++ return 0;
++}
+diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
+index f7a360edcc35..921a18ef4dfe 100644
+--- a/arch/arm/mach-shmobile/include/mach/common.h
++++ b/arch/arm/mach-shmobile/include/mach/common.h
+@@ -45,12 +45,19 @@ int shmobile_cpuidle_init(void);
+ static inline int shmobile_cpuidle_init(void) { return 0; }
+ #endif
+
++#ifdef CONFIG_CPU_FREQ
++int shmobile_cpufreq_init(void);
++#else
++static inline int shmobile_cpufreq_init(void) { return 0; }
++#endif
++
+ extern void __iomem *shmobile_scu_base;
+
+ static inline void __init shmobile_init_late(void)
+ {
+ shmobile_suspend_init();
+ shmobile_cpuidle_init();
++ shmobile_cpufreq_init();
+ }
+
+ #endif /* __ARCH_MACH_COMMON_H */
+--
+2.1.2
+
diff --git a/patches.renesas/0814-ARM-shmobile-Fix-device-node-reference-leakage-in-sh.patch b/patches.renesas/0814-ARM-shmobile-Fix-device-node-reference-leakage-in-sh.patch
new file mode 100644
index 00000000000000..31348dab9e046d
--- /dev/null
+++ b/patches.renesas/0814-ARM-shmobile-Fix-device-node-reference-leakage-in-sh.patch
@@ -0,0 +1,87 @@
+From 90a80327ee82b46f8eeb7d1dff04f8f04dfc9721 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 21 May 2014 15:31:05 +0200
+Subject: ARM: shmobile: Fix device node reference leakage in
+ shmobile_init_delay
+
+The of_find_compatible_node() function returns a new reference to the
+found node. Instead of just adding of_node_put() calls, simplify the
+code by moving the CPU identification logic inside the loop over cpu
+nodes, in order to lower complexity from O(n) to O(1) by replacing
+of_find_compatible_node() calls with of_device_is_compatible().
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Acked-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit edc8fb1d6ebdfc4efa009073586d3567c3368475)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/timer.c | 50 ++++++++++++++++++++++++------------------
+ 1 file changed, 29 insertions(+), 21 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
+index 68bc0b82226d..942efdc82a62 100644
+--- a/arch/arm/mach-shmobile/timer.c
++++ b/arch/arm/mach-shmobile/timer.c
+@@ -59,29 +59,37 @@ void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
+
+ void __init shmobile_init_delay(void)
+ {
+- struct device_node *np, *parent;
+- u32 max_freq, freq;
+-
+- max_freq = 0;
+-
+- parent = of_find_node_by_path("/cpus");
+- if (parent) {
+- for_each_child_of_node(parent, np) {
+- if (!of_property_read_u32(np, "clock-frequency", &freq))
+- max_freq = max(max_freq, freq);
+- }
+- of_node_put(parent);
+- }
++ struct device_node *np, *cpus;
++ bool is_a8_a9 = false;
++ bool is_a15 = false;
++ u32 max_freq = 0;
++
++ cpus = of_find_node_by_path("/cpus");
++ if (!cpus)
++ return;
++
++ for_each_child_of_node(cpus, np) {
++ u32 freq;
++
++ if (!of_property_read_u32(np, "clock-frequency", &freq))
++ max_freq = max(max_freq, freq);
+
+- if (max_freq) {
+- if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8"))
+- shmobile_setup_delay_hz(max_freq, 1, 3);
+- else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9"))
+- shmobile_setup_delay_hz(max_freq, 1, 3);
+- else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15"))
+- if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
+- shmobile_setup_delay_hz(max_freq, 2, 4);
++ if (of_device_is_compatible(np, "arm,cortex-a8") ||
++ of_device_is_compatible(np, "arm,cortex-a9"))
++ is_a8_a9 = true;
++ else if (of_device_is_compatible(np, "arm,cortex-a15"))
++ is_a15 = true;
+ }
++
++ of_node_put(cpus);
++
++ if (!max_freq)
++ return;
++
++ if (is_a8_a9)
++ shmobile_setup_delay_hz(max_freq, 1, 3);
++ else if (is_a15 && !IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
++ shmobile_setup_delay_hz(max_freq, 2, 4);
+ }
+
+ static void __init shmobile_late_time_init(void)
+--
+2.1.2
+
diff --git a/patches.renesas/0815-ARM-shmobile-Move-intc.h-cleanup-sh_intc.h-usage.patch b/patches.renesas/0815-ARM-shmobile-Move-intc.h-cleanup-sh_intc.h-usage.patch
new file mode 100644
index 00000000000000..8f414234b66cf8
--- /dev/null
+++ b/patches.renesas/0815-ARM-shmobile-Move-intc.h-cleanup-sh_intc.h-usage.patch
@@ -0,0 +1,105 @@
+From 698e13fe676095028712e2774e0d02b8a5a80271 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 17 Jun 2014 16:47:05 +0900
+Subject: ARM: shmobile: Move intc.h, cleanup sh_intc.h usage
+
+Change location of intc.h so it can be used as #include "intc.h"
+instead of the old style #include <mach/intc.h>. Also clean up
+some code to get rid of redundant #include <linux/sh_intc.h>.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 6200e2c1847b2282db13877b2398a5bee9e42254)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-mackerel.c | 1 -
+ arch/arm/mach-shmobile/intc-sh7372.c | 3 +--
+ arch/arm/mach-shmobile/intc-sh73a0.c | 3 +--
+ arch/arm/mach-shmobile/{include/mach => }/intc.h | 0
+ arch/arm/mach-shmobile/setup-sh7372.c | 1 -
+ arch/arm/mach-shmobile/setup-sh73a0.c | 1 -
+ 6 files changed, 2 insertions(+), 7 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/intc.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 0ff4d8e45cf7..0864a63291d9 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -47,7 +47,6 @@
+ #include <linux/regulator/fixed.h>
+ #include <linux/regulator/machine.h>
+ #include <linux/smsc911x.h>
+-#include <linux/sh_intc.h>
+ #include <linux/tca6416_keypad.h>
+ #include <linux/usb/renesas_usbhs.h>
+ #include <linux/dma-mapping.h>
+diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
+index a91caad7db7c..bd021238c77b 100644
+--- a/arch/arm/mach-shmobile/intc-sh7372.c
++++ b/arch/arm/mach-shmobile/intc-sh7372.c
+@@ -22,11 +22,10 @@
+ #include <linux/module.h>
+ #include <linux/irq.h>
+ #include <linux/io.h>
+-#include <linux/sh_intc.h>
+-#include <mach/intc.h>
+ #include <mach/irqs.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "intc.h"
+
+ enum {
+ UNUSED_INTCA = 0,
+diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
+index 19a26f4579b3..facb70e6a0b0 100644
+--- a/arch/arm/mach-shmobile/intc-sh73a0.c
++++ b/arch/arm/mach-shmobile/intc-sh73a0.c
+@@ -22,14 +22,13 @@
+ #include <linux/module.h>
+ #include <linux/irq.h>
+ #include <linux/io.h>
+-#include <linux/sh_intc.h>
+ #include <linux/irqchip.h>
+ #include <linux/irqchip/arm-gic.h>
+-#include <mach/intc.h>
+ #include <mach/irqs.h>
+ #include <mach/sh73a0.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "intc.h"
+
+ enum {
+ UNUSED = 0,
+diff --git a/arch/arm/mach-shmobile/include/mach/intc.h b/arch/arm/mach-shmobile/intc.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/intc.h
+rename to arch/arm/mach-shmobile/intc.h
+diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
+index 2a8b9f2a2f54..3b23ced2eb55 100644
+--- a/arch/arm/mach-shmobile/setup-sh7372.c
++++ b/arch/arm/mach-shmobile/setup-sh7372.c
+@@ -29,7 +29,6 @@
+ #include <linux/io.h>
+ #include <linux/serial_sci.h>
+ #include <linux/sh_dma.h>
+-#include <linux/sh_intc.h>
+ #include <linux/sh_timer.h>
+ #include <linux/pm_domain.h>
+ #include <linux/dma-mapping.h>
+diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
+index ad00724a2269..a758d2adca31 100644
+--- a/arch/arm/mach-shmobile/setup-sh73a0.c
++++ b/arch/arm/mach-shmobile/setup-sh73a0.c
+@@ -29,7 +29,6 @@
+ #include <linux/io.h>
+ #include <linux/serial_sci.h>
+ #include <linux/sh_dma.h>
+-#include <linux/sh_intc.h>
+ #include <linux/sh_timer.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+ #include <linux/platform_data/irq-renesas-intc-irqpin.h>
+--
+2.1.2
+
diff --git a/patches.renesas/0816-ARM-shmobile-Move-dma-register.h.patch b/patches.renesas/0816-ARM-shmobile-Move-dma-register.h.patch
new file mode 100644
index 00000000000000..aaa65627e213ca
--- /dev/null
+++ b/patches.renesas/0816-ARM-shmobile-Move-dma-register.h.patch
@@ -0,0 +1,123 @@
+From c98a0bd5cecc1637ebc100a3b9fc1106aa6358b4 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 17 Jun 2014 16:47:13 +0900
+Subject: ARM: shmobile: Move dma-register.h
+
+Change location of dma-register.h so it can be used as #include
+"dma-register.h" instead of the old style #include <mach/dma-register.h>.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 74ac0de8b7ee41246b8d6aae1df0618a64451435)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/{include/mach => }/dma-register.h | 0
+ arch/arm/mach-shmobile/setup-r8a73a4.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7740.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7790.c | 2 +-
+ arch/arm/mach-shmobile/setup-sh7372.c | 2 +-
+ arch/arm/mach-shmobile/setup-sh73a0.c | 2 +-
+ 6 files changed, 5 insertions(+), 5 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/dma-register.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/include/mach/dma-register.h b/arch/arm/mach-shmobile/dma-register.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/dma-register.h
+rename to arch/arm/mach-shmobile/dma-register.h
+diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
+index 9333770cfac2..985739e1885d 100644
+--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
++++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
+@@ -25,10 +25,10 @@
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+ #include <mach/common.h>
+-#include <mach/dma-register.h>
+ #include <mach/irqs.h>
+ #include <mach/r8a73a4.h>
+ #include <asm/mach/arch.h>
++#include "dma-register.h"
+
+ static const struct resource pfc_resources[] = {
+ DEFINE_RES_MEM(0xe6050000, 0x9000),
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index 35dec233301e..7cf4bbd90aa8 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -31,7 +31,6 @@
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+-#include <mach/dma-register.h>
+ #include <mach/r8a7740.h>
+ #include <mach/pm-rmobile.h>
+ #include <mach/common.h>
+@@ -40,6 +39,7 @@
+ #include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
++#include "dma-register.h"
+
+ static struct map_desc r8a7740_io_desc[] __initdata = {
+ /*
+diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
+index 6bd08b127fa4..3eed62673bf4 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7790.c
++++ b/arch/arm/mach-shmobile/setup-r8a7790.c
+@@ -27,10 +27,10 @@
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+ #include <mach/common.h>
+-#include <mach/dma-register.h>
+ #include <mach/irqs.h>
+ #include <mach/r8a7790.h>
+ #include <asm/mach/arch.h>
++#include "dma-register.h"
+
+ /* Audio-DMAC */
+ #define AUDIO_DMAC_SLAVE(_id, _addr, t, r) \
+diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
+index 3b23ced2eb55..062929b303f7 100644
+--- a/arch/arm/mach-shmobile/setup-sh7372.c
++++ b/arch/arm/mach-shmobile/setup-sh7372.c
+@@ -33,7 +33,6 @@
+ #include <linux/pm_domain.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+-#include <mach/dma-register.h>
+ #include <mach/irqs.h>
+ #include <mach/sh7372.h>
+ #include <mach/common.h>
+@@ -41,6 +40,7 @@
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
++#include "dma-register.h"
+
+ static struct map_desc sh7372_io_desc[] __initdata = {
+ /* create a 1:1 entity map for 0xe6xxxxxx
+diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
+index a758d2adca31..370d55c400e8 100644
+--- a/arch/arm/mach-shmobile/setup-sh73a0.c
++++ b/arch/arm/mach-shmobile/setup-sh73a0.c
+@@ -32,7 +32,6 @@
+ #include <linux/sh_timer.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+ #include <linux/platform_data/irq-renesas-intc-irqpin.h>
+-#include <mach/dma-register.h>
+ #include <mach/irqs.h>
+ #include <mach/sh73a0.h>
+ #include <mach/common.h>
+@@ -40,6 +39,7 @@
+ #include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
++#include "dma-register.h"
+
+ static struct map_desc sh73a0_io_desc[] __initdata = {
+ /* create a 1:1 entity map for 0xe6xxxxxx
+--
+2.1.2
+
diff --git a/patches.renesas/0817-ARM-shmobile-Move-clock.h.patch b/patches.renesas/0817-ARM-shmobile-Move-clock.h.patch
new file mode 100644
index 00000000000000..e437ca93cc73ac
--- /dev/null
+++ b/patches.renesas/0817-ARM-shmobile-Move-clock.h.patch
@@ -0,0 +1,229 @@
+From 90c46084d324d1468ff19ab5fd93a3903abb05d3 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 17 Jun 2014 16:47:21 +0900
+Subject: ARM: shmobile: Move clock.h
+
+Change location of clock.h so it can be used as #include "clock.h"
+instead of the old style #include <mach/clock.h>.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ad6ffa0b59dc2c81474d7642fa2188e25cce99d6)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-genmai-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-koelsch-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-lager-reference.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a73a4.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7740.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7778.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7779.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7790.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7791.c | 2 +-
+ arch/arm/mach-shmobile/clock-sh7372.c | 2 +-
+ arch/arm/mach-shmobile/clock-sh73a0.c | 2 +-
+ arch/arm/mach-shmobile/clock.c | 4 ++--
+ arch/arm/mach-shmobile/{include/mach => }/clock.h | 0
+ 13 files changed, 13 insertions(+), 13 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/clock.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
+index 2ff6ad6e608e..c3535858eff8 100644
+--- a/arch/arm/mach-shmobile/board-genmai-reference.c
++++ b/arch/arm/mach-shmobile/board-genmai-reference.c
+@@ -20,11 +20,11 @@
+
+ #include <linux/kernel.h>
+ #include <linux/of_platform.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
+ #include <mach/r7s72100.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "clock.h"
+
+ /*
+ * This is a really crude hack to provide clkdev support to platform
+diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
+index d322a162b4b0..4a6dd63f75a8 100644
+--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
++++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
+@@ -23,12 +23,12 @@
+ #include <linux/kernel.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
+ #include <mach/irqs.h>
+ #include <mach/rcar-gen2.h>
+ #include <mach/r8a7791.h>
+ #include <asm/mach/arch.h>
++#include "clock.h"
+
+ /* DU */
+ static struct rcar_du_encoder_data koelsch_du_encoders[] = {
+diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
+index 749832e3f33c..1d198b029c07 100644
+--- a/arch/arm/mach-shmobile/board-lager-reference.c
++++ b/arch/arm/mach-shmobile/board-lager-reference.c
+@@ -22,12 +22,12 @@
+ #include <linux/init.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
+ #include <mach/irqs.h>
+ #include <mach/rcar-gen2.h>
+ #include <mach/r8a7790.h>
+ #include <asm/mach/arch.h>
++#include "clock.h"
+
+ /* DU */
+ static struct rcar_du_encoder_data lager_du_encoders[] = {
+diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
+index b5bc22c6a858..857b142e4af9 100644
+--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
++++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
+@@ -22,8 +22,8 @@
+ #include <linux/kernel.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
++#include "clock.h"
+
+ #define CPG_BASE 0xe6150000
+ #define CPG_LEN 0x270
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+index 50931e3c97c7..6986527da6f0 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7740.c
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -22,9 +22,9 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
+ #include <mach/r8a7740.h>
++#include "clock.h"
+
+ /*
+ * | MDx | XTAL1/EXTAL1 | System | EXTALR |
+diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
+index 13f8f3ab8840..017fa503c2b8 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7778.c
++++ b/arch/arm/mach-shmobile/clock-r8a7778.c
+@@ -39,8 +39,8 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
++#include "clock.h"
+
+ #define MSTPCR0 IOMEM(0xffc80030)
+ #define MSTPCR1 IOMEM(0xffc80034)
+diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
+index a13298bd37a8..eb7b13187057 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7779.c
++++ b/arch/arm/mach-shmobile/clock-r8a7779.c
+@@ -23,8 +23,8 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
++#include "clock.h"
+
+ /*
+ * MD1 = 1 MD1 = 0
+diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
+index 296a057109e4..8c6244609cbe 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7790.c
++++ b/arch/arm/mach-shmobile/clock-r8a7790.c
+@@ -22,9 +22,9 @@
+ #include <linux/kernel.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
+ #include <mach/r8a7790.h>
++#include "clock.h"
+
+ /*
+ * MD EXTAL PLL0 PLL1 PLL3
+diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
+index e2fdfcc14436..20cad4a4d741 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7791.c
++++ b/arch/arm/mach-shmobile/clock-r8a7791.c
+@@ -23,9 +23,9 @@
+ #include <linux/kernel.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
+ #include <mach/rcar-gen2.h>
++#include "clock.h"
+
+ /*
+ * MD EXTAL PLL0 PLL1 PLL3
+diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
+index d16d9ca7f79e..b19bc7e50a9a 100644
+--- a/arch/arm/mach-shmobile/clock-sh7372.c
++++ b/arch/arm/mach-shmobile/clock-sh7372.c
+@@ -21,8 +21,8 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
++#include "clock.h"
+
+ /* SH7372 registers */
+ #define FRQCRA IOMEM(0xe6150000)
+diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
+index 0d9cd1fe0212..3956b95ef99b 100644
+--- a/arch/arm/mach-shmobile/clock-sh73a0.c
++++ b/arch/arm/mach-shmobile/clock-sh73a0.c
+@@ -22,8 +22,8 @@
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+ #include <asm/processor.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
++#include "clock.h"
+
+ #define FRQCRA IOMEM(0xe6150000)
+ #define FRQCRB IOMEM(0xe6150004)
+diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
+index e7232a0373b9..2a58a782e203 100644
+--- a/arch/arm/mach-shmobile/clock.c
++++ b/arch/arm/mach-shmobile/clock.c
+@@ -25,7 +25,7 @@
+ #ifdef CONFIG_COMMON_CLK
+ #include <linux/clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/clock.h>
++#include "clock.h"
+
+ void __init shmobile_clk_workaround(const struct clk_name *clks,
+ int nr_clks, bool enable)
+@@ -49,8 +49,8 @@ void __init shmobile_clk_workaround(const struct clk_name *clks,
+ #else /* CONFIG_COMMON_CLK */
+ #include <linux/sh_clk.h>
+ #include <linux/export.h>
+-#include <mach/clock.h>
+ #include <mach/common.h>
++#include "clock.h"
+
+ unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk)
+ {
+diff --git a/arch/arm/mach-shmobile/include/mach/clock.h b/arch/arm/mach-shmobile/clock.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/clock.h
+rename to arch/arm/mach-shmobile/clock.h
+--
+2.1.2
+
diff --git a/patches.renesas/0818-ARM-shmobile-Move-most-of-irqs.h-keep-some-for-pinct.patch b/patches.renesas/0818-ARM-shmobile-Move-most-of-irqs.h-keep-some-for-pinct.patch
new file mode 100644
index 00000000000000..669841be3b4970
--- /dev/null
+++ b/patches.renesas/0818-ARM-shmobile-Move-most-of-irqs.h-keep-some-for-pinct.patch
@@ -0,0 +1,511 @@
+From 37c3b5e09e707377ca6fe2c849cb45d3b3199660 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 17 Jun 2014 16:47:29 +0900
+Subject: ARM: shmobile: Move most of irqs.h, keep some for pinctl
+
+Move most of irqs.h so it can be used as #include "irqs.h"
+instead of the old style #include <mach/irqs.h>.
+
+Legacy code in drivers/pinctrl needs more work to get rid
+of the "mach" portion of the include path, so some part
+is left in the original location.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+[horms+renesas@verge.net.au: Do not add trailing blank line to irqs.h]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit b6bab1263c61e39cfc3427f54baff6f683f54298)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ape6evm.c | 2 +-
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 3 +--
+ arch/arm/mach-shmobile/board-bockw.c | 2 +-
+ arch/arm/mach-shmobile/board-genmai.c | 2 +-
+ arch/arm/mach-shmobile/board-koelsch-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-koelsch.c | 2 +-
+ arch/arm/mach-shmobile/board-kzm9g.c | 2 +-
+ arch/arm/mach-shmobile/board-lager-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-lager.c | 2 +-
+ arch/arm/mach-shmobile/board-mackerel.c | 5 +----
+ arch/arm/mach-shmobile/board-marzen-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-marzen.c | 2 +-
+ arch/arm/mach-shmobile/include/mach/irqs.h | 16 +---------------
+ arch/arm/mach-shmobile/intc-sh7372.c | 2 +-
+ arch/arm/mach-shmobile/intc-sh73a0.c | 2 +-
+ arch/arm/mach-shmobile/irqs.h | 21 +++++++++++++++++++++
+ arch/arm/mach-shmobile/setup-r7s72100.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a73a4.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7740.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7778.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7779.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7790.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7791.c | 2 +-
+ arch/arm/mach-shmobile/setup-sh7372.c | 2 +-
+ arch/arm/mach-shmobile/setup-sh73a0.c | 2 +-
+ 25 files changed, 45 insertions(+), 42 deletions(-)
+ create mode 100644 arch/arm/mach-shmobile/irqs.h
+
+diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
+index fe071a9130b7..48ec1449bd02 100644
+--- a/arch/arm/mach-shmobile/board-ape6evm.c
++++ b/arch/arm/mach-shmobile/board-ape6evm.c
+@@ -34,10 +34,10 @@
+ #include <linux/sh_clk.h>
+ #include <linux/smsc911x.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a73a4.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "irqs.h"
+
+ /* LEDS */
+ static struct gpio_led ape6evm_leds[] = {
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 5b2aee4eac0c..79fd9c9b3707 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -46,7 +46,6 @@
+ #include <linux/i2c-gpio.h>
+ #include <linux/reboot.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a7740.h>
+ #include <media/mt9t112.h>
+ #include <media/sh_mobile_ceu.h>
+@@ -61,7 +60,7 @@
+ #include <video/sh_mobile_hdmi.h>
+ #include <sound/sh_fsi.h>
+ #include <sound/simple_card.h>
+-
++#include "irqs.h"
+ #include "sh-gpio.h"
+
+ /*
+diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
+index f444be2f241e..22252fb31ec5 100644
+--- a/arch/arm/mach-shmobile/board-bockw.c
++++ b/arch/arm/mach-shmobile/board-bockw.c
+@@ -36,11 +36,11 @@
+ #include <linux/usb/renesas_usbhs.h>
+ #include <media/soc_camera.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a7778.h>
+ #include <asm/mach/arch.h>
+ #include <sound/rcar_snd.h>
+ #include <sound/simple_card.h>
++#include "irqs.h"
+
+ #define FPGA 0x18200000
+ #define IRQ0MR 0x30
+diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
+index c94201ee8596..5ce1025a662b 100644
+--- a/arch/arm/mach-shmobile/board-genmai.c
++++ b/arch/arm/mach-shmobile/board-genmai.c
+@@ -26,10 +26,10 @@
+ #include <linux/spi/rspi.h>
+ #include <linux/spi/spi.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r7s72100.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "irqs.h"
+
+ /* Ether */
+ static const struct sh_eth_plat_data ether_pdata __initconst = {
+diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
+index 4a6dd63f75a8..fc174e199cb3 100644
+--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
++++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
+@@ -24,11 +24,11 @@
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/rcar-gen2.h>
+ #include <mach/r8a7791.h>
+ #include <asm/mach/arch.h>
+ #include "clock.h"
++#include "irqs.h"
+
+ /* DU */
+ static struct rcar_du_encoder_data koelsch_du_encoders[] = {
+diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
+index c6c68892caa3..52665adf0b41 100644
+--- a/arch/arm/mach-shmobile/board-koelsch.c
++++ b/arch/arm/mach-shmobile/board-koelsch.c
+@@ -46,11 +46,11 @@
+ #include <linux/spi/rspi.h>
+ #include <linux/spi/spi.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a7791.h>
+ #include <mach/rcar-gen2.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "irqs.h"
+
+ /* DU */
+ static struct rcar_du_encoder_data koelsch_du_encoders[] = {
+diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
+index 03dc3ac84502..1719b63e5bc5 100644
+--- a/arch/arm/mach-shmobile/board-kzm9g.c
++++ b/arch/arm/mach-shmobile/board-kzm9g.c
+@@ -43,13 +43,13 @@
+ #include <linux/videodev2.h>
+ #include <sound/sh_fsi.h>
+ #include <sound/simple_card.h>
+-#include <mach/irqs.h>
+ #include <mach/sh73a0.h>
+ #include <mach/common.h>
+ #include <asm/hardware/cache-l2x0.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <video/sh_mobile_lcdc.h>
++#include "irqs.h"
+
+ /*
+ * external GPIO
+diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
+index 1d198b029c07..31cf06d2629b 100644
+--- a/arch/arm/mach-shmobile/board-lager-reference.c
++++ b/arch/arm/mach-shmobile/board-lager-reference.c
+@@ -23,11 +23,11 @@
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/rcar-gen2.h>
+ #include <mach/r8a7790.h>
+ #include <asm/mach/arch.h>
+ #include "clock.h"
++#include "irqs.h"
+
+ /* DU */
+ static struct rcar_du_encoder_data lager_du_encoders[] = {
+diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
+index f8b1e05463cc..8f6d4e626273 100644
+--- a/arch/arm/mach-shmobile/board-lager.c
++++ b/arch/arm/mach-shmobile/board-lager.c
+@@ -46,7 +46,6 @@
+ #include <linux/usb/phy.h>
+ #include <linux/usb/renesas_usbhs.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a7790.h>
+ #include <media/soc_camera.h>
+ #include <asm/mach-types.h>
+@@ -58,6 +57,7 @@
+ #include <linux/spi/spi.h>
+ #include <sound/rcar_snd.h>
+ #include <sound/simple_card.h>
++#include "irqs.h"
+
+ /*
+ * SSI-AK4643
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 0864a63291d9..92fbc4752733 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -57,14 +57,11 @@
+ #include <media/soc_camera_platform.h>
+ #include <sound/sh_fsi.h>
+ #include <sound/simple_card.h>
+-
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/sh7372.h>
+-
+ #include <asm/mach/arch.h>
+ #include <asm/mach-types.h>
+-
++#include "irqs.h"
+ #include "sh-gpio.h"
+
+ /*
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index 2773936bf7dc..08eb1c08e0d0 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -21,9 +21,9 @@
+
+ #include <mach/r8a7779.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <asm/irq.h>
+ #include <asm/mach/arch.h>
++#include "irqs.h"
+
+ static void __init marzen_init(void)
+ {
+diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
+index d832a4477b4b..a9529bad4d60 100644
+--- a/arch/arm/mach-shmobile/board-marzen.c
++++ b/arch/arm/mach-shmobile/board-marzen.c
+@@ -44,10 +44,10 @@
+ #include <media/soc_camera.h>
+ #include <mach/r8a7779.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/traps.h>
++#include "irqs.h"
+
+ /* Fixed 3.3V regulator to be used by SDHI0 */
+ static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
+diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
+index d241bfd6926d..5aee83f079e2 100644
+--- a/arch/arm/mach-shmobile/include/mach/irqs.h
++++ b/arch/arm/mach-shmobile/include/mach/irqs.h
+@@ -1,24 +1,10 @@
+ #ifndef __ASM_MACH_IRQS_H
+ #define __ASM_MACH_IRQS_H
+
+-#include <linux/sh_intc.h>
+-
+-/* GIC */
+-#define gic_spi(nr) ((nr) + 32)
+-#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */
+-
+-/* INTCS */
+-#define INTCS_VECT_BASE 0x3400
+-#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
+-#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
++/* Stuck here until drivers/pinctl/sh-pfc gets rid of legacy code */
+
+ /* External IRQ pins */
+ #define IRQPIN_BASE 2000
+ #define irq_pin(nr) ((nr) + IRQPIN_BASE)
+
+-/* GPIO IRQ */
+-#define _GPIO_IRQ_BASE 2500
+-#define GPIO_IRQ_BASE(x) (_GPIO_IRQ_BASE + (32 * x))
+-#define GPIO_IRQ(x, y) (_GPIO_IRQ_BASE + (32 * x) + y)
+-
+ #endif /* __ASM_MACH_IRQS_H */
+diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
+index bd021238c77b..e2af00b1bd9d 100644
+--- a/arch/arm/mach-shmobile/intc-sh7372.c
++++ b/arch/arm/mach-shmobile/intc-sh7372.c
+@@ -22,10 +22,10 @@
+ #include <linux/module.h>
+ #include <linux/irq.h>
+ #include <linux/io.h>
+-#include <mach/irqs.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include "intc.h"
++#include "irqs.h"
+
+ enum {
+ UNUSED_INTCA = 0,
+diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
+index facb70e6a0b0..1a8f9a7af983 100644
+--- a/arch/arm/mach-shmobile/intc-sh73a0.c
++++ b/arch/arm/mach-shmobile/intc-sh73a0.c
+@@ -24,11 +24,11 @@
+ #include <linux/io.h>
+ #include <linux/irqchip.h>
+ #include <linux/irqchip/arm-gic.h>
+-#include <mach/irqs.h>
+ #include <mach/sh73a0.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include "intc.h"
++#include "irqs.h"
+
+ enum {
+ UNUSED = 0,
+diff --git a/arch/arm/mach-shmobile/irqs.h b/arch/arm/mach-shmobile/irqs.h
+new file mode 100644
+index 000000000000..4ff2d2aa94f0
+--- /dev/null
++++ b/arch/arm/mach-shmobile/irqs.h
+@@ -0,0 +1,21 @@
++#ifndef __SHMOBILE_IRQS_H
++#define __SHMOBILE_IRQS_H
++
++#include <linux/sh_intc.h>
++#include <mach/irqs.h>
++
++/* GIC */
++#define gic_spi(nr) ((nr) + 32)
++#define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */
++
++/* INTCS */
++#define INTCS_VECT_BASE 0x3400
++#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
++#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
++
++/* GPIO IRQ */
++#define _GPIO_IRQ_BASE 2500
++#define GPIO_IRQ_BASE(x) (_GPIO_IRQ_BASE + (32 * x))
++#define GPIO_IRQ(x, y) (_GPIO_IRQ_BASE + (32 * x) + y)
++
++#endif /* __SHMOBILE_IRQS_H */
+diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
+index 412e179429cd..a185f691b917 100644
+--- a/arch/arm/mach-shmobile/setup-r7s72100.c
++++ b/arch/arm/mach-shmobile/setup-r7s72100.c
+@@ -23,9 +23,9 @@
+ #include <linux/of_platform.h>
+ #include <linux/sh_timer.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r7s72100.h>
+ #include <asm/mach/arch.h>
++#include "irqs.h"
+
+ static struct resource mtu2_resources[] __initdata = {
+ DEFINE_RES_MEM(0xfcff0000, 0x400),
+diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
+index 985739e1885d..7efa77d74d69 100644
+--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
++++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
+@@ -25,10 +25,10 @@
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a73a4.h>
+ #include <asm/mach/arch.h>
+ #include "dma-register.h"
++#include "irqs.h"
+
+ static const struct resource pfc_resources[] = {
+ DEFINE_RES_MEM(0xe6050000, 0x9000),
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index 7cf4bbd90aa8..e87c642f047d 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -34,12 +34,12 @@
+ #include <mach/r8a7740.h>
+ #include <mach/pm-rmobile.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
+ #include "dma-register.h"
++#include "irqs.h"
+
+ static struct map_desc r8a7740_io_desc[] __initdata = {
+ /*
+diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
+index 8c02e24f2483..5859267c822a 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7778.c
++++ b/arch/arm/mach-shmobile/setup-r8a7778.c
+@@ -37,11 +37,11 @@
+ #include <linux/usb/ehci_pdriver.h>
+ #include <linux/usb/ohci_pdriver.h>
+ #include <linux/dma-mapping.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a7778.h>
+ #include <mach/common.h>
+ #include <asm/mach/arch.h>
+ #include <asm/hardware/cache-l2x0.h>
++#include "irqs.h"
+
+ /* SCIF */
+ #define R8A7778_SCIF(index, baseaddr, irq) \
+diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
+index d197b5adc886..ce1ee935b738 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7779.c
++++ b/arch/arm/mach-shmobile/setup-r8a7779.c
+@@ -40,7 +40,6 @@
+ #include <linux/usb/ehci_pdriver.h>
+ #include <linux/usb/ohci_pdriver.h>
+ #include <linux/pm_runtime.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a7779.h>
+ #include <mach/common.h>
+ #include <asm/mach-types.h>
+@@ -48,6 +47,7 @@
+ #include <asm/mach/time.h>
+ #include <asm/mach/map.h>
+ #include <asm/hardware/cache-l2x0.h>
++#include "irqs.h"
+
+ static struct map_desc r8a7779_io_desc[] __initdata = {
+ /* 2M entity map for 0xf0000000 (MPCORE) */
+diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
+index 3eed62673bf4..925327d48bc1 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7790.c
++++ b/arch/arm/mach-shmobile/setup-r8a7790.c
+@@ -27,10 +27,10 @@
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a7790.h>
+ #include <asm/mach/arch.h>
+ #include "dma-register.h"
++#include "irqs.h"
+
+ /* Audio-DMAC */
+ #define AUDIO_DMAC_SLAVE(_id, _addr, t, r) \
+diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
+index 04a96ddb3224..8055cff2d953 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7791.c
++++ b/arch/arm/mach-shmobile/setup-r8a7791.c
+@@ -27,10 +27,10 @@
+ #include <linux/serial_sci.h>
+ #include <linux/sh_timer.h>
+ #include <mach/common.h>
+-#include <mach/irqs.h>
+ #include <mach/r8a7791.h>
+ #include <mach/rcar-gen2.h>
+ #include <asm/mach/arch.h>
++#include "irqs.h"
+
+ static const struct resource pfc_resources[] __initconst = {
+ DEFINE_RES_MEM(0xe6060000, 0x250),
+diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
+index 062929b303f7..0fab666fdf64 100644
+--- a/arch/arm/mach-shmobile/setup-sh7372.c
++++ b/arch/arm/mach-shmobile/setup-sh7372.c
+@@ -33,7 +33,6 @@
+ #include <linux/pm_domain.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+-#include <mach/irqs.h>
+ #include <mach/sh7372.h>
+ #include <mach/common.h>
+ #include <asm/mach/map.h>
+@@ -41,6 +40,7 @@
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
+ #include "dma-register.h"
++#include "irqs.h"
+
+ static struct map_desc sh7372_io_desc[] __initdata = {
+ /* create a 1:1 entity map for 0xe6xxxxxx
+diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
+index 370d55c400e8..bb5100205866 100644
+--- a/arch/arm/mach-shmobile/setup-sh73a0.c
++++ b/arch/arm/mach-shmobile/setup-sh73a0.c
+@@ -32,7 +32,6 @@
+ #include <linux/sh_timer.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+ #include <linux/platform_data/irq-renesas-intc-irqpin.h>
+-#include <mach/irqs.h>
+ #include <mach/sh73a0.h>
+ #include <mach/common.h>
+ #include <asm/mach-types.h>
+@@ -40,6 +39,7 @@
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
+ #include "dma-register.h"
++#include "irqs.h"
+
+ static struct map_desc sh73a0_io_desc[] __initdata = {
+ /* create a 1:1 entity map for 0xe6xxxxxx
+--
+2.1.2
+
diff --git a/patches.renesas/0819-ARM-shmobile-Move-common.h.patch b/patches.renesas/0819-ARM-shmobile-Move-common.h.patch
new file mode 100644
index 00000000000000..f850aada32509a
--- /dev/null
+++ b/patches.renesas/0819-ARM-shmobile-Move-common.h.patch
@@ -0,0 +1,868 @@
+From 45095c37b0bd39644c563fbfd89fd46f9878defd Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 17 Jun 2014 16:47:37 +0900
+Subject: ARM: shmobile: Move common.h
+
+Change location for common.h so it can be used as #include "common.h"
+instead of the old style #include <mach/common.h>.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit fd44aa5e570d1d8c7d361dcbf94c2b8cd25cfe92)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ape6evm-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-ape6evm.c | 2 +-
+ arch/arm/mach-shmobile/board-armadillo800eva-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 2 +-
+ arch/arm/mach-shmobile/board-bockw-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-bockw.c | 2 +-
+ arch/arm/mach-shmobile/board-genmai-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-genmai.c | 2 +-
+ arch/arm/mach-shmobile/board-koelsch-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-koelsch.c | 2 +-
+ arch/arm/mach-shmobile/board-kzm9g-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-kzm9g.c | 2 +-
+ arch/arm/mach-shmobile/board-lager-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-lager.c | 2 +-
+ arch/arm/mach-shmobile/board-mackerel.c | 2 +-
+ arch/arm/mach-shmobile/board-marzen-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-marzen.c | 2 +-
+ arch/arm/mach-shmobile/clock-r7s72100.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a73a4.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7740.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7778.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7779.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7790.c | 2 +-
+ arch/arm/mach-shmobile/clock-r8a7791.c | 2 +-
+ arch/arm/mach-shmobile/clock-sh7372.c | 2 +-
+ arch/arm/mach-shmobile/clock-sh73a0.c | 2 +-
+ arch/arm/mach-shmobile/clock.c | 2 +-
+ arch/arm/mach-shmobile/{include/mach => }/common.h | 0
+ arch/arm/mach-shmobile/console.c | 2 +-
+ arch/arm/mach-shmobile/platsmp-apmu.c | 2 +-
+ arch/arm/mach-shmobile/platsmp-scu.c | 2 +-
+ arch/arm/mach-shmobile/platsmp.c | 2 +-
+ arch/arm/mach-shmobile/pm-r8a7740.c | 2 +-
+ arch/arm/mach-shmobile/pm-r8a7779.c | 2 +-
+ arch/arm/mach-shmobile/pm-sh7372.c | 2 +-
+ arch/arm/mach-shmobile/pm-sh73a0.c | 2 +-
+ arch/arm/mach-shmobile/setup-emev2.c | 2 +-
+ arch/arm/mach-shmobile/setup-r7s72100.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a73a4.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7740.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7778.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7779.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7790.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7791.c | 2 +-
+ arch/arm/mach-shmobile/setup-rcar-gen2.c | 2 +-
+ arch/arm/mach-shmobile/setup-sh7372.c | 2 +-
+ arch/arm/mach-shmobile/setup-sh73a0.c | 2 +-
+ arch/arm/mach-shmobile/smp-emev2.c | 2 +-
+ arch/arm/mach-shmobile/smp-r8a7779.c | 2 +-
+ arch/arm/mach-shmobile/smp-r8a7790.c | 2 +-
+ arch/arm/mach-shmobile/smp-r8a7791.c | 2 +-
+ arch/arm/mach-shmobile/smp-sh73a0.c | 2 +-
+ 52 files changed, 51 insertions(+), 51 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/common.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-ape6evm-reference.c b/arch/arm/mach-shmobile/board-ape6evm-reference.c
+index 3276afcf3cc9..76e4ff14be68 100644
+--- a/arch/arm/mach-shmobile/board-ape6evm-reference.c
++++ b/arch/arm/mach-shmobile/board-ape6evm-reference.c
+@@ -24,10 +24,10 @@
+ #include <linux/pinctrl/machine.h>
+ #include <linux/platform_device.h>
+ #include <linux/sh_clk.h>
+-#include <mach/common.h>
+ #include <mach/r8a73a4.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+
+ static void __init ape6evm_add_standard_devices(void)
+ {
+diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
+index 48ec1449bd02..8f8da25310e7 100644
+--- a/arch/arm/mach-shmobile/board-ape6evm.c
++++ b/arch/arm/mach-shmobile/board-ape6evm.c
+@@ -33,10 +33,10 @@
+ #include <linux/regulator/machine.h>
+ #include <linux/sh_clk.h>
+ #include <linux/smsc911x.h>
+-#include <mach/common.h>
+ #include <mach/r8a73a4.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+ #include "irqs.h"
+
+ /* LEDS */
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+index 57d246eb8813..6b7c975e8ee2 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+@@ -24,10 +24,10 @@
+ #include <linux/kernel.h>
+ #include <linux/gpio.h>
+ #include <linux/io.h>
+-#include <mach/common.h>
+ #include <mach/r8a7740.h>
+ #include <asm/mach/arch.h>
+ #include <asm/hardware/cache-l2x0.h>
++#include "common.h"
+
+ /*
+ * CON1 Camera Module
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 79fd9c9b3707..93d92b4409bd 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -45,7 +45,6 @@
+ #include <linux/mmc/sh_mobile_sdhi.h>
+ #include <linux/i2c-gpio.h>
+ #include <linux/reboot.h>
+-#include <mach/common.h>
+ #include <mach/r8a7740.h>
+ #include <media/mt9t112.h>
+ #include <media/sh_mobile_ceu.h>
+@@ -60,6 +59,7 @@
+ #include <video/sh_mobile_hdmi.h>
+ #include <sound/sh_fsi.h>
+ #include <sound/simple_card.h>
++#include "common.h"
+ #include "irqs.h"
+ #include "sh-gpio.h"
+
+diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
+index 027373f8de82..91ff3a27ccc7 100644
+--- a/arch/arm/mach-shmobile/board-bockw-reference.c
++++ b/arch/arm/mach-shmobile/board-bockw-reference.c
+@@ -19,9 +19,9 @@
+ */
+
+ #include <linux/of_platform.h>
+-#include <mach/common.h>
+ #include <mach/r8a7778.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+
+ /*
+ * see board-bock.c for checking detail of dip-switch
+diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
+index 22252fb31ec5..8cb057f95c44 100644
+--- a/arch/arm/mach-shmobile/board-bockw.c
++++ b/arch/arm/mach-shmobile/board-bockw.c
+@@ -35,11 +35,11 @@
+ #include <linux/spi/flash.h>
+ #include <linux/usb/renesas_usbhs.h>
+ #include <media/soc_camera.h>
+-#include <mach/common.h>
+ #include <mach/r8a7778.h>
+ #include <asm/mach/arch.h>
+ #include <sound/rcar_snd.h>
+ #include <sound/simple_card.h>
++#include "common.h"
+ #include "irqs.h"
+
+ #define FPGA 0x18200000
+diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
+index c3535858eff8..d341ef09ec37 100644
+--- a/arch/arm/mach-shmobile/board-genmai-reference.c
++++ b/arch/arm/mach-shmobile/board-genmai-reference.c
+@@ -20,11 +20,11 @@
+
+ #include <linux/kernel.h>
+ #include <linux/of_platform.h>
+-#include <mach/common.h>
+ #include <mach/r7s72100.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include "clock.h"
++#include "common.h"
+
+ /*
+ * This is a really crude hack to provide clkdev support to platform
+diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
+index 5ce1025a662b..f0a8eca7d10d 100644
+--- a/arch/arm/mach-shmobile/board-genmai.c
++++ b/arch/arm/mach-shmobile/board-genmai.c
+@@ -25,10 +25,10 @@
+ #include <linux/sh_eth.h>
+ #include <linux/spi/rspi.h>
+ #include <linux/spi/spi.h>
+-#include <mach/common.h>
+ #include <mach/r7s72100.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+ #include "irqs.h"
+
+ /* Ether */
+diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
+index fc174e199cb3..10fd0858c98c 100644
+--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
++++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
+@@ -23,11 +23,11 @@
+ #include <linux/kernel.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+-#include <mach/common.h>
+ #include <mach/rcar-gen2.h>
+ #include <mach/r8a7791.h>
+ #include <asm/mach/arch.h>
+ #include "clock.h"
++#include "common.h"
+ #include "irqs.h"
+
+ /* DU */
+diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
+index 52665adf0b41..1d8b6e6bebdb 100644
+--- a/arch/arm/mach-shmobile/board-koelsch.c
++++ b/arch/arm/mach-shmobile/board-koelsch.c
+@@ -45,11 +45,11 @@
+ #include <linux/spi/flash.h>
+ #include <linux/spi/rspi.h>
+ #include <linux/spi/spi.h>
+-#include <mach/common.h>
+ #include <mach/r8a7791.h>
+ #include <mach/rcar-gen2.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+ #include "irqs.h"
+
+ /* DU */
+diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
+index 598e32488410..f7b2d0708311 100644
+--- a/arch/arm/mach-shmobile/board-kzm9g-reference.c
++++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
+@@ -26,10 +26,10 @@
+ #include <linux/input.h>
+ #include <linux/of_platform.h>
+ #include <mach/sh73a0.h>
+-#include <mach/common.h>
+ #include <asm/hardware/cache-l2x0.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+
+ static void __init kzm_init(void)
+ {
+diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
+index 1719b63e5bc5..638859ee247f 100644
+--- a/arch/arm/mach-shmobile/board-kzm9g.c
++++ b/arch/arm/mach-shmobile/board-kzm9g.c
+@@ -44,11 +44,11 @@
+ #include <sound/sh_fsi.h>
+ #include <sound/simple_card.h>
+ #include <mach/sh73a0.h>
+-#include <mach/common.h>
+ #include <asm/hardware/cache-l2x0.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <video/sh_mobile_lcdc.h>
++#include "common.h"
+ #include "irqs.h"
+
+ /*
+diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
+index 31cf06d2629b..6e1a2618a8d1 100644
+--- a/arch/arm/mach-shmobile/board-lager-reference.c
++++ b/arch/arm/mach-shmobile/board-lager-reference.c
+@@ -22,11 +22,11 @@
+ #include <linux/init.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+-#include <mach/common.h>
+ #include <mach/rcar-gen2.h>
+ #include <mach/r8a7790.h>
+ #include <asm/mach/arch.h>
+ #include "clock.h"
++#include "common.h"
+ #include "irqs.h"
+
+ /* DU */
+diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
+index 8f6d4e626273..f0249ca237eb 100644
+--- a/arch/arm/mach-shmobile/board-lager.c
++++ b/arch/arm/mach-shmobile/board-lager.c
+@@ -45,7 +45,6 @@
+ #include <linux/sh_eth.h>
+ #include <linux/usb/phy.h>
+ #include <linux/usb/renesas_usbhs.h>
+-#include <mach/common.h>
+ #include <mach/r8a7790.h>
+ #include <media/soc_camera.h>
+ #include <asm/mach-types.h>
+@@ -57,6 +56,7 @@
+ #include <linux/spi/spi.h>
+ #include <sound/rcar_snd.h>
+ #include <sound/simple_card.h>
++#include "common.h"
+ #include "irqs.h"
+
+ /*
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 92fbc4752733..3558ff0f834a 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -57,10 +57,10 @@
+ #include <media/soc_camera_platform.h>
+ #include <sound/sh_fsi.h>
+ #include <sound/simple_card.h>
+-#include <mach/common.h>
+ #include <mach/sh7372.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach-types.h>
++#include "common.h"
+ #include "irqs.h"
+ #include "sh-gpio.h"
+
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index 08eb1c08e0d0..94bd57203ff5 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -20,9 +20,9 @@
+ */
+
+ #include <mach/r8a7779.h>
+-#include <mach/common.h>
+ #include <asm/irq.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+ #include "irqs.h"
+
+ static void __init marzen_init(void)
+diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
+index a9529bad4d60..fe445ef49fb9 100644
+--- a/arch/arm/mach-shmobile/board-marzen.c
++++ b/arch/arm/mach-shmobile/board-marzen.c
+@@ -43,10 +43,10 @@
+ #include <linux/mfd/tmio.h>
+ #include <media/soc_camera.h>
+ #include <mach/r8a7779.h>
+-#include <mach/common.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/traps.h>
++#include "common.h"
+ #include "irqs.h"
+
+ /* Fixed 3.3V regulator to be used by SDHI0 */
+diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
+index df187484de5d..457dab0f8fc9 100644
+--- a/arch/arm/mach-shmobile/clock-r7s72100.c
++++ b/arch/arm/mach-shmobile/clock-r7s72100.c
+@@ -19,8 +19,8 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/common.h>
+ #include <mach/r7s72100.h>
++#include "common.h"
+
+ /* Frequency Control Registers */
+ #define FRQCR 0xfcfe0010
+diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
+index 857b142e4af9..0f431498229b 100644
+--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
++++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
+@@ -22,7 +22,7 @@
+ #include <linux/kernel.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/common.h>
++#include "common.h"
+ #include "clock.h"
+
+ #define CPG_BASE 0xe6150000
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+index 6986527da6f0..ffefec53b058 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7740.c
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -22,9 +22,9 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/common.h>
+ #include <mach/r8a7740.h>
+ #include "clock.h"
++#include "common.h"
+
+ /*
+ * | MDx | XTAL1/EXTAL1 | System | EXTALR |
+diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
+index 017fa503c2b8..16bbc94a1520 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7778.c
++++ b/arch/arm/mach-shmobile/clock-r8a7778.c
+@@ -39,8 +39,8 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/common.h>
+ #include "clock.h"
++#include "common.h"
+
+ #define MSTPCR0 IOMEM(0xffc80030)
+ #define MSTPCR1 IOMEM(0xffc80034)
+diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
+index eb7b13187057..d81539a26dbd 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7779.c
++++ b/arch/arm/mach-shmobile/clock-r8a7779.c
+@@ -23,8 +23,8 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/common.h>
+ #include "clock.h"
++#include "common.h"
+
+ /*
+ * MD1 = 1 MD1 = 0
+diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
+index 8c6244609cbe..b6781a0ea747 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7790.c
++++ b/arch/arm/mach-shmobile/clock-r8a7790.c
+@@ -22,9 +22,9 @@
+ #include <linux/kernel.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/common.h>
+ #include <mach/r8a7790.h>
+ #include "clock.h"
++#include "common.h"
+
+ /*
+ * MD EXTAL PLL0 PLL1 PLL3
+diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
+index 20cad4a4d741..494aaf69461a 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7791.c
++++ b/arch/arm/mach-shmobile/clock-r8a7791.c
+@@ -23,9 +23,9 @@
+ #include <linux/kernel.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/common.h>
+ #include <mach/rcar-gen2.h>
+ #include "clock.h"
++#include "common.h"
+
+ /*
+ * MD EXTAL PLL0 PLL1 PLL3
+diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
+index b19bc7e50a9a..7071676145c4 100644
+--- a/arch/arm/mach-shmobile/clock-sh7372.c
++++ b/arch/arm/mach-shmobile/clock-sh7372.c
+@@ -21,8 +21,8 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/common.h>
+ #include "clock.h"
++#include "common.h"
+
+ /* SH7372 registers */
+ #define FRQCRA IOMEM(0xe6150000)
+diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
+index 3956b95ef99b..37f48383e05a 100644
+--- a/arch/arm/mach-shmobile/clock-sh73a0.c
++++ b/arch/arm/mach-shmobile/clock-sh73a0.c
+@@ -22,8 +22,8 @@
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+ #include <asm/processor.h>
+-#include <mach/common.h>
+ #include "clock.h"
++#include "common.h"
+
+ #define FRQCRA IOMEM(0xe6150000)
+ #define FRQCRB IOMEM(0xe6150004)
+diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
+index 2a58a782e203..806f94038cc4 100644
+--- a/arch/arm/mach-shmobile/clock.c
++++ b/arch/arm/mach-shmobile/clock.c
+@@ -49,8 +49,8 @@ void __init shmobile_clk_workaround(const struct clk_name *clks,
+ #else /* CONFIG_COMMON_CLK */
+ #include <linux/sh_clk.h>
+ #include <linux/export.h>
+-#include <mach/common.h>
+ #include "clock.h"
++#include "common.h"
+
+ unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk)
+ {
+diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/common.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/common.h
+rename to arch/arm/mach-shmobile/common.h
+diff --git a/arch/arm/mach-shmobile/console.c b/arch/arm/mach-shmobile/console.c
+index 9411a5bf4fd6..f2e79f2376e1 100644
+--- a/arch/arm/mach-shmobile/console.c
++++ b/arch/arm/mach-shmobile/console.c
+@@ -19,8 +19,8 @@
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/platform_device.h>
+-#include <mach/common.h>
+ #include <asm/mach/map.h>
++#include "common.h"
+
+ void __init shmobile_setup_console(void)
+ {
+diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
+index 8cb641c00fdb..fe648f5d8f06 100644
+--- a/arch/arm/mach-shmobile/platsmp-apmu.c
++++ b/arch/arm/mach-shmobile/platsmp-apmu.c
+@@ -16,7 +16,7 @@
+ #include <asm/cacheflush.h>
+ #include <asm/cp15.h>
+ #include <asm/smp_plat.h>
+-#include <mach/common.h>
++#include "common.h"
+
+ static struct {
+ void __iomem *iomem;
+diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
+index 673ad6e80869..64663110ab6c 100644
+--- a/arch/arm/mach-shmobile/platsmp-scu.c
++++ b/arch/arm/mach-shmobile/platsmp-scu.c
+@@ -15,7 +15,7 @@
+ #include <asm/cacheflush.h>
+ #include <asm/smp_plat.h>
+ #include <asm/smp_scu.h>
+-#include <mach/common.h>
++#include "common.h"
+
+ static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
+ unsigned long action, void *hcpu)
+diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
+index 9ebc246b8d7d..3923e09e966d 100644
+--- a/arch/arm/mach-shmobile/platsmp.c
++++ b/arch/arm/mach-shmobile/platsmp.c
+@@ -13,7 +13,7 @@
+ #include <linux/init.h>
+ #include <asm/cacheflush.h>
+ #include <asm/smp_plat.h>
+-#include <mach/common.h>
++#include "common.h"
+
+ extern unsigned long shmobile_smp_fn[];
+ extern unsigned long shmobile_smp_arg[];
+diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
+index 40b87aa1d448..a8a0d0506f13 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7740.c
++++ b/arch/arm/mach-shmobile/pm-r8a7740.c
+@@ -11,7 +11,7 @@
+ #include <linux/console.h>
+ #include <linux/suspend.h>
+ #include <mach/pm-rmobile.h>
+-#include <mach/common.h>
++#include "common.h"
+
+ #ifdef CONFIG_PM
+ static int r8a7740_pd_a4s_suspend(void)
+diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
+index d6fe189b2df6..2b79bacd9dcb 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7779.c
++++ b/arch/arm/mach-shmobile/pm-r8a7779.c
+@@ -19,9 +19,9 @@
+ #include <linux/interrupt.h>
+ #include <linux/console.h>
+ #include <asm/io.h>
+-#include <mach/common.h>
+ #include <mach/pm-rcar.h>
+ #include <mach/r8a7779.h>
++#include "common.h"
+
+ /* SYSC */
+ #define SYSCIER 0x0c
+diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
+index 0de75fd394b9..0b1b4deca03e 100644
+--- a/arch/arm/mach-shmobile/pm-sh7372.c
++++ b/arch/arm/mach-shmobile/pm-sh7372.c
+@@ -25,9 +25,9 @@
+ #include <asm/io.h>
+ #include <asm/tlbflush.h>
+ #include <asm/suspend.h>
+-#include <mach/common.h>
+ #include <mach/sh7372.h>
+ #include <mach/pm-rmobile.h>
++#include "common.h"
+
+ /* DBG */
+ #define DBGREG1 IOMEM(0xe6100020)
+diff --git a/arch/arm/mach-shmobile/pm-sh73a0.c b/arch/arm/mach-shmobile/pm-sh73a0.c
+index 99086e98fbbc..a7e466817965 100644
+--- a/arch/arm/mach-shmobile/pm-sh73a0.c
++++ b/arch/arm/mach-shmobile/pm-sh73a0.c
+@@ -9,7 +9,7 @@
+ */
+
+ #include <linux/suspend.h>
+-#include <mach/common.h>
++#include "common.h"
+
+ #ifdef CONFIG_SUSPEND
+ static int sh73a0_enter_suspend(suspend_state_t suspend_state)
+diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
+index d953ff6e78a2..6e4ffa74dad4 100644
+--- a/arch/arm/mach-shmobile/setup-emev2.c
++++ b/arch/arm/mach-shmobile/setup-emev2.c
+@@ -20,10 +20,10 @@
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/of_platform.h>
+-#include <mach/common.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/map.h>
++#include "common.h"
+
+ static struct map_desc emev2_io_desc[] __initdata = {
+ #ifdef CONFIG_SMP
+diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
+index a185f691b917..17a74d355c5d 100644
+--- a/arch/arm/mach-shmobile/setup-r7s72100.c
++++ b/arch/arm/mach-shmobile/setup-r7s72100.c
+@@ -22,9 +22,9 @@
+ #include <linux/kernel.h>
+ #include <linux/of_platform.h>
+ #include <linux/sh_timer.h>
+-#include <mach/common.h>
+ #include <mach/r7s72100.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+ #include "irqs.h"
+
+ static struct resource mtu2_resources[] __initdata = {
+diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
+index 7efa77d74d69..da94d9b9292e 100644
+--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
++++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
+@@ -24,9 +24,9 @@
+ #include <linux/serial_sci.h>
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+-#include <mach/common.h>
+ #include <mach/r8a73a4.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index e87c642f047d..d86a128206b3 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -33,11 +33,11 @@
+ #include <linux/platform_data/sh_ipmmu.h>
+ #include <mach/r8a7740.h>
+ #include <mach/pm-rmobile.h>
+-#include <mach/common.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
++#include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
+index 5859267c822a..b7deec3c3d8d 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7778.c
++++ b/arch/arm/mach-shmobile/setup-r8a7778.c
+@@ -38,9 +38,9 @@
+ #include <linux/usb/ohci_pdriver.h>
+ #include <linux/dma-mapping.h>
+ #include <mach/r8a7778.h>
+-#include <mach/common.h>
+ #include <asm/mach/arch.h>
+ #include <asm/hardware/cache-l2x0.h>
++#include "common.h"
+ #include "irqs.h"
+
+ /* SCIF */
+diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
+index ce1ee935b738..e2bd28de39d0 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7779.c
++++ b/arch/arm/mach-shmobile/setup-r8a7779.c
+@@ -41,12 +41,12 @@
+ #include <linux/usb/ohci_pdriver.h>
+ #include <linux/pm_runtime.h>
+ #include <mach/r8a7779.h>
+-#include <mach/common.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
+ #include <asm/mach/map.h>
+ #include <asm/hardware/cache-l2x0.h>
++#include "common.h"
+ #include "irqs.h"
+
+ static struct map_desc r8a7779_io_desc[] __initdata = {
+diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
+index 925327d48bc1..7bbe5c05d2a5 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7790.c
++++ b/arch/arm/mach-shmobile/setup-r8a7790.c
+@@ -26,9 +26,9 @@
+ #include <linux/serial_sci.h>
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+-#include <mach/common.h>
+ #include <mach/r8a7790.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
+index 8055cff2d953..6d8c61f42895 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7791.c
++++ b/arch/arm/mach-shmobile/setup-r8a7791.c
+@@ -26,10 +26,10 @@
+ #include <linux/platform_data/irq-renesas-irqc.h>
+ #include <linux/serial_sci.h>
+ #include <linux/sh_timer.h>
+-#include <mach/common.h>
+ #include <mach/r8a7791.h>
+ #include <mach/rcar-gen2.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+ #include "irqs.h"
+
+ static const struct resource pfc_resources[] __initconst = {
+diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+index 542c5a47173f..1c41227bb770 100644
+--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
++++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+@@ -22,9 +22,9 @@
+ #include <linux/clocksource.h>
+ #include <linux/io.h>
+ #include <linux/kernel.h>
+-#include <mach/common.h>
+ #include <mach/rcar-gen2.h>
+ #include <asm/mach/arch.h>
++#include "common.h"
+
+ #define MODEMR 0xe6160060
+
+diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
+index 0fab666fdf64..8da836a373fe 100644
+--- a/arch/arm/mach-shmobile/setup-sh7372.c
++++ b/arch/arm/mach-shmobile/setup-sh7372.c
+@@ -34,11 +34,11 @@
+ #include <linux/dma-mapping.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+ #include <mach/sh7372.h>
+-#include <mach/common.h>
+ #include <asm/mach/map.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
++#include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
+
+diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
+index bb5100205866..b30bbee6dc65 100644
+--- a/arch/arm/mach-shmobile/setup-sh73a0.c
++++ b/arch/arm/mach-shmobile/setup-sh73a0.c
+@@ -33,11 +33,11 @@
+ #include <linux/platform_data/sh_ipmmu.h>
+ #include <linux/platform_data/irq-renesas-intc-irqpin.h>
+ #include <mach/sh73a0.h>
+-#include <mach/common.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
++#include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
+
+diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
+index 2dfd748da7f3..6ff1df1df9a7 100644
+--- a/arch/arm/mach-shmobile/smp-emev2.c
++++ b/arch/arm/mach-shmobile/smp-emev2.c
+@@ -23,9 +23,9 @@
+ #include <linux/spinlock.h>
+ #include <linux/io.h>
+ #include <linux/delay.h>
+-#include <mach/common.h>
+ #include <asm/smp_plat.h>
+ #include <asm/smp_scu.h>
++#include "common.h"
+
+ #define EMEV2_SCU_BASE 0x1e000000
+ #define EMEV2_SMU_BASE 0xe0110000
+diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
+index e7a3201473d0..e063cd29c30f 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7779.c
++++ b/arch/arm/mach-shmobile/smp-r8a7779.c
+@@ -23,13 +23,13 @@
+ #include <linux/spinlock.h>
+ #include <linux/io.h>
+ #include <linux/delay.h>
+-#include <mach/common.h>
+ #include <mach/pm-rcar.h>
+ #include <mach/r8a7779.h>
+ #include <asm/cacheflush.h>
+ #include <asm/smp_plat.h>
+ #include <asm/smp_scu.h>
+ #include <asm/smp_twd.h>
++#include "common.h"
+
+ #define AVECR IOMEM(0xfe700040)
+ #define R8A7779_SCU_BASE 0xf0000000
+diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
+index 591052799e8f..fea53d57fd1e 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7790.c
++++ b/arch/arm/mach-shmobile/smp-r8a7790.c
+@@ -18,9 +18,9 @@
+ #include <linux/smp.h>
+ #include <linux/io.h>
+ #include <asm/smp_plat.h>
+-#include <mach/common.h>
+ #include <mach/pm-rcar.h>
+ #include <mach/r8a7790.h>
++#include "common.h"
+
+ #define RST 0xe6160000
+ #define CA15BAR 0x0020
+diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
+index ec979529f30f..bf88c66b3c18 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7791.c
++++ b/arch/arm/mach-shmobile/smp-r8a7791.c
+@@ -18,9 +18,9 @@
+ #include <linux/smp.h>
+ #include <linux/io.h>
+ #include <asm/smp_plat.h>
+-#include <mach/common.h>
+ #include <mach/r8a7791.h>
+ #include <mach/rcar-gen2.h>
++#include "common.h"
+
+ #define RST 0xe6160000
+ #define CA15BAR 0x0020
+diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
+index 13ba36a6831f..bf4aff99ed1c 100644
+--- a/arch/arm/mach-shmobile/smp-sh73a0.c
++++ b/arch/arm/mach-shmobile/smp-sh73a0.c
+@@ -22,10 +22,10 @@
+ #include <linux/smp.h>
+ #include <linux/io.h>
+ #include <linux/delay.h>
+-#include <mach/common.h>
+ #include <mach/sh73a0.h>
+ #include <asm/smp_plat.h>
+ #include <asm/smp_twd.h>
++#include "common.h"
+
+ #define WUPCR IOMEM(0xe6151010)
+ #define SRESCR IOMEM(0xe6151018)
+--
+2.1.2
+
diff --git a/patches.renesas/0820-ARM-shmobile-Move-pm-rmobile.h-cleanup-sh73xx.h.patch b/patches.renesas/0820-ARM-shmobile-Move-pm-rmobile.h-cleanup-sh73xx.h.patch
new file mode 100644
index 00000000000000..ff571a5c60535e
--- /dev/null
+++ b/patches.renesas/0820-ARM-shmobile-Move-pm-rmobile.h-cleanup-sh73xx.h.patch
@@ -0,0 +1,169 @@
+From 6b3f8f431e744032334ca44993cfb3b4e2b10c3e Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 17 Jun 2014 16:47:45 +0900
+Subject: ARM: shmobile: Move pm-rmobile.h, cleanup sh73xx.h
+
+Change location of pm-rmobile.h so it can be used as #include "pm-rmobile.h"
+instead of the old style #include <mach/pm-rmobile.h>. Also clean up
+the sh7372 and sh73a0 header files to get rid of unused include files.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 6b8b0cb477b3e77721982effae3415f3c5f58fee)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 1 +
+ arch/arm/mach-shmobile/board-mackerel.c | 2 ++
+ arch/arm/mach-shmobile/include/mach/r8a7740.h | 2 --
+ arch/arm/mach-shmobile/include/mach/sh7372.h | 4 ----
+ arch/arm/mach-shmobile/pm-r8a7740.c | 2 +-
+ arch/arm/mach-shmobile/pm-rmobile.c | 2 +-
+ arch/arm/mach-shmobile/{include/mach => }/pm-rmobile.h | 0
+ arch/arm/mach-shmobile/pm-sh7372.c | 2 +-
+ arch/arm/mach-shmobile/setup-r8a7740.c | 2 +-
+ arch/arm/mach-shmobile/setup-sh7372.c | 1 +
+ 10 files changed, 8 insertions(+), 10 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/pm-rmobile.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 93d92b4409bd..284877ae9c83 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -61,6 +61,7 @@
+ #include <sound/simple_card.h>
+ #include "common.h"
+ #include "irqs.h"
++#include "pm-rmobile.h"
+ #include "sh-gpio.h"
+
+ /*
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 3558ff0f834a..0ece865cbc4d 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -47,6 +47,7 @@
+ #include <linux/regulator/fixed.h>
+ #include <linux/regulator/machine.h>
+ #include <linux/smsc911x.h>
++#include <linux/sh_clk.h>
+ #include <linux/tca6416_keypad.h>
+ #include <linux/usb/renesas_usbhs.h>
+ #include <linux/dma-mapping.h>
+@@ -62,6 +63,7 @@
+ #include <asm/mach-types.h>
+ #include "common.h"
+ #include "irqs.h"
++#include "pm-rmobile.h"
+ #include "sh-gpio.h"
+
+ /*
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h
+index 5e3c9ec06303..1d1a5fd78b6b 100644
+--- a/arch/arm/mach-shmobile/include/mach/r8a7740.h
++++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h
+@@ -19,8 +19,6 @@
+ #ifndef __ASM_R8A7740_H__
+ #define __ASM_R8A7740_H__
+
+-#include <mach/pm-rmobile.h>
+-
+ /*
+ * MD_CKx pin
+ */
+diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
+index 854a9f0ca040..4ad960d5075b 100644
+--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
++++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
+@@ -11,10 +11,6 @@
+ #ifndef __ASM_SH7372_H__
+ #define __ASM_SH7372_H__
+
+-#include <linux/sh_clk.h>
+-#include <linux/pm_domain.h>
+-#include <mach/pm-rmobile.h>
+-
+ /* DMA slave IDs */
+ enum {
+ SHDMA_SLAVE_INVALID,
+diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
+index a8a0d0506f13..a0d44d537fa0 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7740.c
++++ b/arch/arm/mach-shmobile/pm-r8a7740.c
+@@ -10,8 +10,8 @@
+ */
+ #include <linux/console.h>
+ #include <linux/suspend.h>
+-#include <mach/pm-rmobile.h>
+ #include "common.h"
++#include "pm-rmobile.h"
+
+ #ifdef CONFIG_PM
+ static int r8a7740_pd_a4s_suspend(void)
+diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
+index f710235aff2f..ebdd16e94a84 100644
+--- a/arch/arm/mach-shmobile/pm-rmobile.c
++++ b/arch/arm/mach-shmobile/pm-rmobile.c
+@@ -17,7 +17,7 @@
+ #include <linux/pm.h>
+ #include <linux/pm_clock.h>
+ #include <asm/io.h>
+-#include <mach/pm-rmobile.h>
++#include "pm-rmobile.h"
+
+ /* SYSC */
+ #define SPDCR IOMEM(0xe6180008)
+diff --git a/arch/arm/mach-shmobile/include/mach/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/pm-rmobile.h
+rename to arch/arm/mach-shmobile/pm-rmobile.h
+diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
+index 0b1b4deca03e..7ef9a0126780 100644
+--- a/arch/arm/mach-shmobile/pm-sh7372.c
++++ b/arch/arm/mach-shmobile/pm-sh7372.c
+@@ -26,8 +26,8 @@
+ #include <asm/tlbflush.h>
+ #include <asm/suspend.h>
+ #include <mach/sh7372.h>
+-#include <mach/pm-rmobile.h>
+ #include "common.h"
++#include "pm-rmobile.h"
+
+ /* DBG */
+ #define DBGREG1 IOMEM(0xe6100020)
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index d86a128206b3..10170b3560c2 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -32,7 +32,6 @@
+ #include <linux/sh_timer.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+ #include <mach/r8a7740.h>
+-#include <mach/pm-rmobile.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
+@@ -40,6 +39,7 @@
+ #include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
++#include "pm-rmobile.h"
+
+ static struct map_desc r8a7740_io_desc[] __initdata = {
+ /*
+diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
+index 8da836a373fe..5571f867c611 100644
+--- a/arch/arm/mach-shmobile/setup-sh7372.c
++++ b/arch/arm/mach-shmobile/setup-sh7372.c
+@@ -41,6 +41,7 @@
+ #include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
++#include "pm-rmobile.h"
+
+ static struct map_desc sh7372_io_desc[] __initdata = {
+ /* create a 1:1 entity map for 0xe6xxxxxx
+--
+2.1.2
+
diff --git a/patches.renesas/0821-ARM-shmobile-Move-pm-rcar.h-cleanup-r8a7779-case.patch b/patches.renesas/0821-ARM-shmobile-Move-pm-rcar.h-cleanup-r8a7779-case.patch
new file mode 100644
index 00000000000000..982d1145746a1d
--- /dev/null
+++ b/patches.renesas/0821-ARM-shmobile-Move-pm-rcar.h-cleanup-r8a7779-case.patch
@@ -0,0 +1,162 @@
+From 3fdc0633f47ef455eb0beb1051c94c910860f4e3 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 17 Jun 2014 16:47:53 +0900
+Subject: ARM: shmobile: Move pm-rcar.h, cleanup r8a7779 case
+
+Change location of pm-rcar.h so it can be used as #include "pm-rcar.h"
+instead of the old style #include <mach/pm-rcar.h>. Also clean up
+the r8a7779 case to move some unused header file cruft into a C
+file.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 585c09df3738d4f72cee36eb0b975351fd9a339a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/include/mach/r8a7779.h | 12 ------------
+ arch/arm/mach-shmobile/pm-r8a7779.c | 13 ++++++++++++-
+ arch/arm/mach-shmobile/pm-r8a7790.c | 2 +-
+ arch/arm/mach-shmobile/pm-rcar.c | 2 +-
+ arch/arm/mach-shmobile/{include/mach => }/pm-rcar.h | 0
+ arch/arm/mach-shmobile/smp-r8a7779.c | 2 +-
+ arch/arm/mach-shmobile/smp-r8a7790.c | 2 +-
+ 7 files changed, 16 insertions(+), 17 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/pm-rcar.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
+index 88eeceaf1088..def10a29e09a 100644
+--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
++++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
+@@ -2,8 +2,6 @@
+ #define __ASM_R8A7779_H__
+
+ #include <linux/sh_clk.h>
+-#include <linux/pm_domain.h>
+-#include <mach/pm-rcar.h>
+
+ /* HPB-DMA slave IDs */
+ enum {
+@@ -12,16 +10,6 @@ enum {
+ HPBDMA_SLAVE_SDHI0_RX,
+ };
+
+-struct r8a7779_pm_domain {
+- struct generic_pm_domain genpd;
+- struct rcar_sysc_ch ch;
+-};
+-
+-static inline struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
+-{
+- return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
+-}
+-
+ extern void r8a7779_init_delay(void);
+ extern void r8a7779_init_irq_extpin(int irlm);
+ extern void r8a7779_init_irq_extpin_dt(int irlm);
+diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
+index 2b79bacd9dcb..f0f36cb5ffe7 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7779.c
++++ b/arch/arm/mach-shmobile/pm-r8a7779.c
+@@ -13,20 +13,31 @@
+ #include <linux/suspend.h>
+ #include <linux/err.h>
+ #include <linux/pm_clock.h>
++#include <linux/pm_domain.h>
+ #include <linux/platform_device.h>
+ #include <linux/delay.h>
+ #include <linux/irq.h>
+ #include <linux/interrupt.h>
+ #include <linux/console.h>
+ #include <asm/io.h>
+-#include <mach/pm-rcar.h>
+ #include <mach/r8a7779.h>
+ #include "common.h"
++#include "pm-rcar.h"
+
+ /* SYSC */
+ #define SYSCIER 0x0c
+ #define SYSCIMR 0x10
+
++struct r8a7779_pm_domain {
++ struct generic_pm_domain genpd;
++ struct rcar_sysc_ch ch;
++};
++
++static inline struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
++{
++ return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
++}
++
+ #if defined(CONFIG_PM) || defined(CONFIG_SMP)
+
+ static void __init r8a7779_sysc_init(void)
+diff --git a/arch/arm/mach-shmobile/pm-r8a7790.c b/arch/arm/mach-shmobile/pm-r8a7790.c
+index fc82839e2c2a..0f1090d851e7 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7790.c
++++ b/arch/arm/mach-shmobile/pm-r8a7790.c
+@@ -12,8 +12,8 @@
+
+ #include <linux/kernel.h>
+ #include <asm/io.h>
+-#include <mach/pm-rcar.h>
+ #include <mach/r8a7790.h>
++#include "pm-rcar.h"
+
+ /* SYSC */
+ #define SYSCIER 0x0c
+diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
+index 1f465a12d1b1..34b8a5674f85 100644
+--- a/arch/arm/mach-shmobile/pm-rcar.c
++++ b/arch/arm/mach-shmobile/pm-rcar.c
+@@ -13,7 +13,7 @@
+ #include <linux/mm.h>
+ #include <linux/spinlock.h>
+ #include <asm/io.h>
+-#include <mach/pm-rcar.h>
++#include "pm-rcar.h"
+
+ /* SYSC */
+ #define SYSCSR 0x00
+diff --git a/arch/arm/mach-shmobile/include/mach/pm-rcar.h b/arch/arm/mach-shmobile/pm-rcar.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/pm-rcar.h
+rename to arch/arm/mach-shmobile/pm-rcar.h
+diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
+index e063cd29c30f..c230fc0c3fef 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7779.c
++++ b/arch/arm/mach-shmobile/smp-r8a7779.c
+@@ -23,13 +23,13 @@
+ #include <linux/spinlock.h>
+ #include <linux/io.h>
+ #include <linux/delay.h>
+-#include <mach/pm-rcar.h>
+ #include <mach/r8a7779.h>
+ #include <asm/cacheflush.h>
+ #include <asm/smp_plat.h>
+ #include <asm/smp_scu.h>
+ #include <asm/smp_twd.h>
+ #include "common.h"
++#include "pm-rcar.h"
+
+ #define AVECR IOMEM(0xfe700040)
+ #define R8A7779_SCU_BASE 0xf0000000
+diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
+index fea53d57fd1e..a8ace58c3dd2 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7790.c
++++ b/arch/arm/mach-shmobile/smp-r8a7790.c
+@@ -18,9 +18,9 @@
+ #include <linux/smp.h>
+ #include <linux/io.h>
+ #include <asm/smp_plat.h>
+-#include <mach/pm-rcar.h>
+ #include <mach/r8a7790.h>
+ #include "common.h"
++#include "pm-rcar.h"
+
+ #define RST 0xe6160000
+ #define CA15BAR 0x0020
+--
+2.1.2
+
diff --git a/patches.renesas/0822-ARM-shmobile-Move-rcar-gen2.h-cleanup-r8a7790-case.patch b/patches.renesas/0822-ARM-shmobile-Move-rcar-gen2.h-cleanup-r8a7790-case.patch
new file mode 100644
index 00000000000000..9d10966b71aba9
--- /dev/null
+++ b/patches.renesas/0822-ARM-shmobile-Move-rcar-gen2.h-cleanup-r8a7790-case.patch
@@ -0,0 +1,200 @@
+From 389e02175b51170c3ec635b163cb39c61c9b87b2 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 17 Jun 2014 16:48:01 +0900
+Subject: ARM: shmobile: Move rcar-gen2.h, cleanup r8a7790 case
+
+Change location of rcar-gen2.h so it can be used as #include "rcar-gen2.h"
+instead of the old style #include <mach/rcar-gen2.h>. Also clean up
+the r8a7790 case to follow the same style as r8a7791.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 62872989bdbf1245d7239b9f4c05a8ee7c775ed5)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-koelsch-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-koelsch.c | 2 +-
+ arch/arm/mach-shmobile/board-lager-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-lager.c | 1 +
+ arch/arm/mach-shmobile/clock-r8a7790.c | 1 +
+ arch/arm/mach-shmobile/clock-r8a7791.c | 2 +-
+ arch/arm/mach-shmobile/include/mach/r8a7790.h | 2 --
+ arch/arm/mach-shmobile/{include/mach => }/rcar-gen2.h | 0
+ arch/arm/mach-shmobile/setup-r8a7790.c | 1 +
+ arch/arm/mach-shmobile/setup-r8a7791.c | 2 +-
+ arch/arm/mach-shmobile/setup-rcar-gen2.c | 2 +-
+ arch/arm/mach-shmobile/smp-r8a7791.c | 2 +-
+ 12 files changed, 10 insertions(+), 9 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/rcar-gen2.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
+index 10fd0858c98c..1d3f67d4ccd6 100644
+--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
++++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
+@@ -23,12 +23,12 @@
+ #include <linux/kernel.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+-#include <mach/rcar-gen2.h>
+ #include <mach/r8a7791.h>
+ #include <asm/mach/arch.h>
+ #include "clock.h"
+ #include "common.h"
+ #include "irqs.h"
++#include "rcar-gen2.h"
+
+ /* DU */
+ static struct rcar_du_encoder_data koelsch_du_encoders[] = {
+diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
+index 1d8b6e6bebdb..0d44e7eb6508 100644
+--- a/arch/arm/mach-shmobile/board-koelsch.c
++++ b/arch/arm/mach-shmobile/board-koelsch.c
+@@ -46,11 +46,11 @@
+ #include <linux/spi/rspi.h>
+ #include <linux/spi/spi.h>
+ #include <mach/r8a7791.h>
+-#include <mach/rcar-gen2.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include "common.h"
+ #include "irqs.h"
++#include "rcar-gen2.h"
+
+ /* DU */
+ static struct rcar_du_encoder_data koelsch_du_encoders[] = {
+diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
+index 6e1a2618a8d1..4f0af91ebc81 100644
+--- a/arch/arm/mach-shmobile/board-lager-reference.c
++++ b/arch/arm/mach-shmobile/board-lager-reference.c
+@@ -22,12 +22,12 @@
+ #include <linux/init.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+-#include <mach/rcar-gen2.h>
+ #include <mach/r8a7790.h>
+ #include <asm/mach/arch.h>
+ #include "clock.h"
+ #include "common.h"
+ #include "irqs.h"
++#include "rcar-gen2.h"
+
+ /* DU */
+ static struct rcar_du_encoder_data lager_du_encoders[] = {
+diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
+index f0249ca237eb..83bbb5c48863 100644
+--- a/arch/arm/mach-shmobile/board-lager.c
++++ b/arch/arm/mach-shmobile/board-lager.c
+@@ -58,6 +58,7 @@
+ #include <sound/simple_card.h>
+ #include "common.h"
+ #include "irqs.h"
++#include "rcar-gen2.h"
+
+ /*
+ * SSI-AK4643
+diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
+index b6781a0ea747..ca980669806f 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7790.c
++++ b/arch/arm/mach-shmobile/clock-r8a7790.c
+@@ -25,6 +25,7 @@
+ #include <mach/r8a7790.h>
+ #include "clock.h"
+ #include "common.h"
++#include "rcar-gen2.h"
+
+ /*
+ * MD EXTAL PLL0 PLL1 PLL3
+diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
+index 494aaf69461a..10e193d707f5 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7791.c
++++ b/arch/arm/mach-shmobile/clock-r8a7791.c
+@@ -23,9 +23,9 @@
+ #include <linux/kernel.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/rcar-gen2.h>
+ #include "clock.h"
+ #include "common.h"
++#include "rcar-gen2.h"
+
+ /*
+ * MD EXTAL PLL0 PLL1 PLL3
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/include/mach/r8a7790.h
+index 0b95babe84ba..d7555440fc7b 100644
+--- a/arch/arm/mach-shmobile/include/mach/r8a7790.h
++++ b/arch/arm/mach-shmobile/include/mach/r8a7790.h
+@@ -1,8 +1,6 @@
+ #ifndef __ASM_R8A7790_H__
+ #define __ASM_R8A7790_H__
+
+-#include <mach/rcar-gen2.h>
+-
+ /* DMA slave IDs */
+ enum {
+ RCAR_DMA_SLAVE_INVALID,
+diff --git a/arch/arm/mach-shmobile/include/mach/rcar-gen2.h b/arch/arm/mach-shmobile/rcar-gen2.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/rcar-gen2.h
+rename to arch/arm/mach-shmobile/rcar-gen2.h
+diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
+index 7bbe5c05d2a5..4212c8de987a 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7790.c
++++ b/arch/arm/mach-shmobile/setup-r8a7790.c
+@@ -31,6 +31,7 @@
+ #include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
++#include "rcar-gen2.h"
+
+ /* Audio-DMAC */
+ #define AUDIO_DMAC_SLAVE(_id, _addr, t, r) \
+diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
+index 6d8c61f42895..f554cda4a96a 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7791.c
++++ b/arch/arm/mach-shmobile/setup-r8a7791.c
+@@ -27,10 +27,10 @@
+ #include <linux/serial_sci.h>
+ #include <linux/sh_timer.h>
+ #include <mach/r8a7791.h>
+-#include <mach/rcar-gen2.h>
+ #include <asm/mach/arch.h>
+ #include "common.h"
+ #include "irqs.h"
++#include "rcar-gen2.h"
+
+ static const struct resource pfc_resources[] __initconst = {
+ DEFINE_RES_MEM(0xe6060000, 0x250),
+diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+index 1c41227bb770..fdc714ebc4cd 100644
+--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
++++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+@@ -22,9 +22,9 @@
+ #include <linux/clocksource.h>
+ #include <linux/io.h>
+ #include <linux/kernel.h>
+-#include <mach/rcar-gen2.h>
+ #include <asm/mach/arch.h>
+ #include "common.h"
++#include "rcar-gen2.h"
+
+ #define MODEMR 0xe6160060
+
+diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
+index bf88c66b3c18..2648d68650e4 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7791.c
++++ b/arch/arm/mach-shmobile/smp-r8a7791.c
+@@ -19,8 +19,8 @@
+ #include <linux/io.h>
+ #include <asm/smp_plat.h>
+ #include <mach/r8a7791.h>
+-#include <mach/rcar-gen2.h>
+ #include "common.h"
++#include "rcar-gen2.h"
+
+ #define RST 0xe6160000
+ #define CA15BAR 0x0020
+--
+2.1.2
+
diff --git a/patches.renesas/0823-ARM-shmobile-Update-EMEV2-DTS-to-include-CPU-frequen.patch b/patches.renesas/0823-ARM-shmobile-Update-EMEV2-DTS-to-include-CPU-frequen.patch
new file mode 100644
index 00000000000000..4f590c11192ba8
--- /dev/null
+++ b/patches.renesas/0823-ARM-shmobile-Update-EMEV2-DTS-to-include-CPU-frequen.patch
@@ -0,0 +1,40 @@
+From eae46be0d5018cc62755b67efe8f541a37c619a0 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Thu, 5 Jun 2014 14:31:56 +0900
+Subject: ARM: shmobile: Update EMEV2 DTS to include CPU frequency
+
+Add CPU Frequency information to the EMEV2 DTS file. This
+will allow us to use the shared C code to on EMEV2 which
+reads out the clock frequency from DT and calculates the
+delay settings from there.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 11f1ca10b668995a031aade5c2728f0a251aaec7)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/emev2.dtsi | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
+index e37985fa10e2..00eeed3721b6 100644
+--- a/arch/arm/boot/dts/emev2.dtsi
++++ b/arch/arm/boot/dts/emev2.dtsi
+@@ -31,11 +31,13 @@
+ device_type = "cpu";
+ compatible = "arm,cortex-a9";
+ reg = <0>;
++ clock-frequency = <533000000>;
+ };
+ cpu@1 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a9";
+ reg = <1>;
++ clock-frequency = <533000000>;
+ };
+ };
+
+--
+2.1.2
+
diff --git a/patches.renesas/0824-ARM-shmobile-Use-shmobile_init_delay-on-EMEV2.patch b/patches.renesas/0824-ARM-shmobile-Use-shmobile_init_delay-on-EMEV2.patch
new file mode 100644
index 00000000000000..c7f40194f6502e
--- /dev/null
+++ b/patches.renesas/0824-ARM-shmobile-Use-shmobile_init_delay-on-EMEV2.patch
@@ -0,0 +1,45 @@
+From fd3454443b7e542cae6e8d1c23f6a466b57ed5eb Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Thu, 5 Jun 2014 14:32:04 +0900
+Subject: ARM: shmobile: Use shmobile_init_delay() on EMEV2
+
+Adjust EMEV2 to use shmobile_init_delay() together with
+CPU Frequency settings from the DTS.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ef9026e6879da358376b58fc63fe7a82f07404ad)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-emev2.c | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
+index 6e4ffa74dad4..e10d34e24817 100644
+--- a/arch/arm/mach-shmobile/setup-emev2.c
++++ b/arch/arm/mach-shmobile/setup-emev2.c
+@@ -42,11 +42,6 @@ static void __init emev2_map_io(void)
+ iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
+ }
+
+-static void __init emev2_init_delay(void)
+-{
+- shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
+-}
+-
+ static void __init emev2_add_standard_devices_dt(void)
+ {
+ of_clk_init(NULL);
+@@ -63,7 +58,7 @@ extern struct smp_operations emev2_smp_ops;
+ DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
+ .smp = smp_ops(emev2_smp_ops),
+ .map_io = emev2_map_io,
+- .init_early = emev2_init_delay,
++ .init_early = shmobile_init_delay,
+ .init_machine = emev2_add_standard_devices_dt,
+ .init_late = shmobile_init_late,
+ .dt_compat = emev2_boards_compat_dt,
+--
+2.1.2
+
diff --git a/patches.renesas/0825-ARM-shmobile-r8a7779-Add-clocks.patch b/patches.renesas/0825-ARM-shmobile-r8a7779-Add-clocks.patch
new file mode 100644
index 00000000000000..504a997d1fc194
--- /dev/null
+++ b/patches.renesas/0825-ARM-shmobile-r8a7779-Add-clocks.patch
@@ -0,0 +1,180 @@
+From 94d9cf31aaa444284affca1dd57647945972fc3d Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:31:57 +0900
+Subject: ARM: shmobile: r8a7779: Add clocks
+
+Declare all core and MSTP clocks currently used by r8a7779-based boards.
+
+Based on work by Laurent Pinchart for the r8a7790 and r8a7791 SoCs.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 1e8515384bfa5efa5803a38c5ba7fecd6514c527)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779.dtsi | 144 +++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 144 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
+index b517c8e6b420..5a62970f9a12 100644
+--- a/arch/arm/boot/dts/r8a7779.dtsi
++++ b/arch/arm/boot/dts/r8a7779.dtsi
+@@ -11,6 +11,7 @@
+
+ /include/ "skeleton.dtsi"
+
++#include <dt-bindings/clock/r8a7779-clock.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ / {
+@@ -265,4 +266,147 @@
+ #size-cells = <0>;
+ status = "disabled";
+ };
++
++ clocks {
++ #address-cells = <2>;
++ #size-cells = <2>;
++ ranges;
++
++ /* External root clock */
++ extal_clk: extal_clk {
++ compatible = "fixed-clock";
++ #clock-cells = <0>;
++ /* This value must be overriden by the board. */
++ clock-frequency = <0>;
++ clock-output-names = "extal";
++ };
++
++ /* Special CPG clocks */
++ cpg_clocks: cpg_clocks@0xe6150000 {
++ compatible = "renesas,r8a7779-cpg-clocks";
++ reg = <0 0xffc80000 0 0x30>;
++ clocks = <&extal_clk>;
++ #clock-cells = <1>;
++ clock-output-names = "plla", "z", "zs", "s",
++ "s1", "p", "b", "out";
++ };
++
++ /* Fixed factor clocks */
++ i_clk: i_clk {
++ compatible = "fixed-factor-clock";
++ clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
++ #clock-cells = <0>;
++ clock-div = <2>;
++ clock-mult = <1>;
++ clock-output-names = "i";
++ };
++ s3_clk: s3_clk {
++ compatible = "fixed-factor-clock";
++ clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
++ #clock-cells = <0>;
++ clock-div = <8>;
++ clock-mult = <1>;
++ clock-output-names = "s3";
++ };
++ s4_clk: s4_clk {
++ compatible = "fixed-factor-clock";
++ clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
++ #clock-cells = <0>;
++ clock-div = <16>;
++ clock-mult = <1>;
++ clock-output-names = "s4";
++ };
++ g_clk: g_clk {
++ compatible = "fixed-factor-clock";
++ clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
++ #clock-cells = <0>;
++ clock-div = <24>;
++ clock-mult = <1>;
++ clock-output-names = "g";
++ };
++
++ /* Gate clocks */
++ mstp0_clks: mstp0_clks {
++ compatible = "renesas,r8a7779-mstp-clocks",
++ "renesas,cpg-mstp-clocks";
++ reg = <0 0xffc80030 0 4>;
++ clocks = <&cpg_clocks R8A7779_CLK_S>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_S>,
++ <&cpg_clocks R8A7779_CLK_S>,
++ <&cpg_clocks R8A7779_CLK_S1>,
++ <&cpg_clocks R8A7779_CLK_S1>,
++ <&cpg_clocks R8A7779_CLK_S1>,
++ <&cpg_clocks R8A7779_CLK_S1>,
++ <&cpg_clocks R8A7779_CLK_S1>,
++ <&cpg_clocks R8A7779_CLK_S1>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_P>;
++ #clock-cells = <1>;
++ renesas,clock-indices = <
++ R8A7779_CLK_HSPI R8A7779_CLK_TMU2
++ R8A7779_CLK_TMU1 R8A7779_CLK_TMU0
++ R8A7779_CLK_HSCIF1 R8A7779_CLK_HSCIF0
++ R8A7779_CLK_SCIF5 R8A7779_CLK_SCIF4
++ R8A7779_CLK_SCIF3 R8A7779_CLK_SCIF2
++ R8A7779_CLK_SCIF1 R8A7779_CLK_SCIF0
++ R8A7779_CLK_I2C3 R8A7779_CLK_I2C2
++ R8A7779_CLK_I2C1 R8A7779_CLK_I2C0
++ >;
++ clock-output-names =
++ "hspi", "tmu2", "tmu1", "tmu0", "hscif1",
++ "hscif0", "scif5", "scif4", "scif3", "scif2",
++ "scif1", "scif0", "i2c3", "i2c2", "i2c1",
++ "i2c0";
++ };
++ mstp1_clks: mstp1_clks {
++ compatible = "renesas,r8a7779-mstp-clocks",
++ "renesas,cpg-mstp-clocks";
++ reg = <0 0xffc80034 0 4>, <0 0xffc80044 0 4>;
++ clocks = <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_S>,
++ <&cpg_clocks R8A7779_CLK_S>,
++ <&cpg_clocks R8A7779_CLK_S>,
++ <&cpg_clocks R8A7779_CLK_S>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_P>,
++ <&cpg_clocks R8A7779_CLK_S>;
++ #clock-cells = <1>;
++ renesas,clock-indices = <
++ R8A7779_CLK_USB01 R8A7779_CLK_USB2
++ R8A7779_CLK_DU R8A7779_CLK_VIN2
++ R8A7779_CLK_VIN1 R8A7779_CLK_VIN0
++ R8A7779_CLK_ETHER R8A7779_CLK_SATA
++ R8A7779_CLK_PCIE R8A7779_CLK_VIN3
++ >;
++ clock-output-names =
++ "usb01", "usb2",
++ "du", "vin2",
++ "vin1", "vin0",
++ "ether", "sata",
++ "pcie", "vin3";
++ };
++ mstp3_clks: mstp3_clks {
++ compatible = "renesas,r8a7779-mstp-clocks",
++ "renesas,cpg-mstp-clocks";
++ reg = <0 0xffc8003c 0 4>;
++ clocks = <&s4_clk>, <&s4_clk>, <&s4_clk>, <&s4_clk>,
++ <&s4_clk>, <&s4_clk>;
++ #clock-cells = <1>;
++ renesas,clock-indices = <
++ R8A7779_CLK_SDHI3 R8A7779_CLK_SDHI2
++ R8A7779_CLK_SDHI1 R8A7779_CLK_SDHI0
++ R8A7779_CLK_MMC1 R8A7779_CLK_MMC0
++ >;
++ clock-output-names =
++ "sdhi3", "sdhi2", "sdhi1", "sdhi0",
++ "mmc1", "mmc0";
++ };
++ };
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0826-ARM-shmobile-Sync-Marzen-DTS-with-Marzen-reference-D.patch b/patches.renesas/0826-ARM-shmobile-Sync-Marzen-DTS-with-Marzen-reference-D.patch
new file mode 100644
index 00000000000000..7603c67dc6abe7
--- /dev/null
+++ b/patches.renesas/0826-ARM-shmobile-Sync-Marzen-DTS-with-Marzen-reference-D.patch
@@ -0,0 +1,134 @@
+From f5186c90ab624a8c0bb75f6689ffab19299f7ee8 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:31:58 +0900
+Subject: ARM: shmobile: Sync Marzen DTS with Marzen reference DTS
+
+Copy the device nodes from Marzen reference into the Marzen device tree
+file. This will allow us to use a single DTS file regardless of kernel
+configuration. In case of legacy C board code the device nodes may or
+may not be used, but in the multiplatform case all the DT device nodes
+will be used.
+
+Based on a similar change for the Lager board by Laurent Pinchart.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit bedd672409d68c98e717ac79f58b0ba155879275)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779-marzen.dts | 94 ++++++++++++++++++++++++++++++++++++
+ 1 file changed, 94 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
+index ee2338838b3f..cf90d2db64b7 100644
+--- a/arch/arm/boot/dts/r8a7779-marzen.dts
++++ b/arch/arm/boot/dts/r8a7779-marzen.dts
+@@ -11,6 +11,8 @@
+
+ /dts-v1/;
+ #include "r8a7779.dtsi"
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/interrupt-controller/irq.h>
+
+ / {
+ model = "marzen";
+@@ -24,4 +26,96 @@
+ device_type = "memory";
+ reg = <0x60000000 0x40000000>;
+ };
++
++ fixedregulator3v3: fixedregulator@0 {
++ compatible = "regulator-fixed";
++ regulator-name = "fixed-3.3V";
++ regulator-min-microvolt = <3300000>;
++ regulator-max-microvolt = <3300000>;
++ regulator-boot-on;
++ regulator-always-on;
++ };
++
++ lan0@18000000 {
++ compatible = "smsc,lan9220", "smsc,lan9115";
++ reg = <0x18000000 0x100>;
++ pinctrl-0 = <&lan0_pins>;
++ pinctrl-names = "default";
++
++ phy-mode = "mii";
++ interrupt-parent = <&irqpin0>;
++ interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
++ smsc,irq-push-pull;
++ reg-io-width = <4>;
++ vddvario-supply = <&fixedregulator3v3>;
++ vdd33a-supply = <&fixedregulator3v3>;
++ };
++
++ leds {
++ compatible = "gpio-leds";
++ led2 {
++ gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
++ };
++ led3 {
++ gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
++ };
++ led4 {
++ gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;
++ };
++ };
++};
++
++&irqpin0 {
++ status = "okay";
++};
++
++&pfc {
++ pinctrl-0 = <&scif2_pins &scif4_pins>;
++ pinctrl-names = "default";
++
++ lan0_pins: lan0 {
++ intc {
++ renesas,groups = "intc_irq1_b";
++ renesas,function = "intc";
++ };
++ lbsc {
++ renesas,groups = "lbsc_ex_cs0";
++ renesas,function = "lbsc";
++ };
++ };
++
++ scif2_pins: serial2 {
++ renesas,groups = "scif2_data_c";
++ renesas,function = "scif2";
++ };
++
++ scif4_pins: serial4 {
++ renesas,groups = "scif4_data";
++ renesas,function = "scif4";
++ };
++
++ sdhi0_pins: sd0 {
++ renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
++ renesas,function = "sdhi0";
++ };
++
++ hspi0_pins: hspi0 {
++ renesas,groups = "hspi0";
++ renesas,function = "hspi0";
++ };
++};
++
++&sdhi0 {
++ pinctrl-0 = <&sdhi0_pins>;
++ pinctrl-names = "default";
++
++ vmmc-supply = <&fixedregulator3v3>;
++ bus-width = <4>;
++ status = "okay";
++};
++
++&hspi0 {
++ pinctrl-0 = <&hspi0_pins>;
++ pinctrl-names = "default";
++ status = "okay";
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0827-ARM-shmobile-marzen-Specify-external-clock-frequency.patch b/patches.renesas/0827-ARM-shmobile-marzen-Specify-external-clock-frequency.patch
new file mode 100644
index 00000000000000..09369a5440d088
--- /dev/null
+++ b/patches.renesas/0827-ARM-shmobile-marzen-Specify-external-clock-frequency.patch
@@ -0,0 +1,36 @@
+From 191635b7c38969d43cc04d7c9ee9c0199a1e61b1 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:31:59 +0900
+Subject: ARM: shmobile: marzen: Specify external clock frequency in DT
+
+The external crystal frequency is 31.25 on the Marzen board.
+Specify it in the device tree.
+
+Based on work for the Lager board by Laurent Pinchart.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 954e42cf541b3cbb8dd07ba29f5974f91cb8c248)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779-marzen.dts | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
+index cf90d2db64b7..321290828eee 100644
+--- a/arch/arm/boot/dts/r8a7779-marzen.dts
++++ b/arch/arm/boot/dts/r8a7779-marzen.dts
+@@ -69,6 +69,10 @@
+ status = "okay";
+ };
+
++&extal_clk {
++ clock-frequency = <31250000>;
++};
++
+ &pfc {
+ pinctrl-0 = <&scif2_pins &scif4_pins>;
+ pinctrl-names = "default";
+--
+2.1.2
+
diff --git a/patches.renesas/0828-ARM-shmobile-r8a7779-Reference-clocks.patch b/patches.renesas/0828-ARM-shmobile-r8a7779-Reference-clocks.patch
new file mode 100644
index 00000000000000..5a15b41c5f0d1e
--- /dev/null
+++ b/patches.renesas/0828-ARM-shmobile-r8a7779-Reference-clocks.patch
@@ -0,0 +1,120 @@
+From 05736a67166e1f8449a2f56ab12a5cb3be4112c1 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:00 +0900
+Subject: ARM: shmobile: r8a7779: Reference clocks
+
+Reference clocks using a "clocks" property in all nodes corresponding to
+devices that require a clock.
+
+Based on work by Laurent Pinchart for the r8a7790 and r8a7791 SoC.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 3325cbe8ab74731c88e70d172ffef74cbca13f18)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779.dtsi | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
+index 5a62970f9a12..bdaaadcfa1f1 100644
+--- a/arch/arm/boot/dts/r8a7779.dtsi
++++ b/arch/arm/boot/dts/r8a7779.dtsi
+@@ -158,6 +158,7 @@
+ compatible = "renesas,i2c-r8a7779";
+ reg = <0xffc70000 0x1000>;
+ interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp0_clks R8A7779_CLK_I2C0>;
+ status = "disabled";
+ };
+
+@@ -167,6 +168,7 @@
+ compatible = "renesas,i2c-r8a7779";
+ reg = <0xffc71000 0x1000>;
+ interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp0_clks R8A7779_CLK_I2C1>;
+ status = "disabled";
+ };
+
+@@ -176,6 +178,7 @@
+ compatible = "renesas,i2c-r8a7779";
+ reg = <0xffc72000 0x1000>;
+ interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp0_clks R8A7779_CLK_I2C2>;
+ status = "disabled";
+ };
+
+@@ -185,6 +188,7 @@
+ compatible = "renesas,i2c-r8a7779";
+ reg = <0xffc73000 0x1000>;
+ interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp0_clks R8A7779_CLK_I2C3>;
+ status = "disabled";
+ };
+
+@@ -202,12 +206,14 @@
+ compatible = "renesas,rcar-sata";
+ reg = <0xfc600000 0x2000>;
+ interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp1_clks R8A7779_CLK_SATA>;
+ };
+
+ sdhi0: sd@ffe4c000 {
+ compatible = "renesas,sdhi-r8a7779";
+ reg = <0xffe4c000 0x100>;
+ interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp3_clks R8A7779_CLK_SDHI0>;
+ cap-sd-highspeed;
+ cap-sdio-irq;
+ status = "disabled";
+@@ -217,6 +223,7 @@
+ compatible = "renesas,sdhi-r8a7779";
+ reg = <0xffe4d000 0x100>;
+ interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp3_clks R8A7779_CLK_SDHI1>;
+ cap-sd-highspeed;
+ cap-sdio-irq;
+ status = "disabled";
+@@ -226,6 +233,7 @@
+ compatible = "renesas,sdhi-r8a7779";
+ reg = <0xffe4e000 0x100>;
+ interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp3_clks R8A7779_CLK_SDHI2>;
+ cap-sd-highspeed;
+ cap-sdio-irq;
+ status = "disabled";
+@@ -235,6 +243,7 @@
+ compatible = "renesas,sdhi-r8a7779";
+ reg = <0xffe4f000 0x100>;
+ interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp3_clks R8A7779_CLK_SDHI3>;
+ cap-sd-highspeed;
+ cap-sdio-irq;
+ status = "disabled";
+@@ -246,6 +255,7 @@
+ interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <1>;
+ #size-cells = <0>;
++ clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
+ status = "disabled";
+ };
+
+@@ -255,6 +265,7 @@
+ interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <1>;
+ #size-cells = <0>;
++ clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
+ status = "disabled";
+ };
+
+@@ -264,6 +275,7 @@
+ interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
+ #address-cells = <1>;
+ #size-cells = <0>;
++ clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
+ status = "disabled";
+ };
+
+--
+2.1.2
+
diff --git a/patches.renesas/0829-ARM-shmobile-r8a7791-SYSC-setup-code.patch b/patches.renesas/0829-ARM-shmobile-r8a7791-SYSC-setup-code.patch
new file mode 100644
index 00000000000000..a179aa44385eb7
--- /dev/null
+++ b/patches.renesas/0829-ARM-shmobile-r8a7791-SYSC-setup-code.patch
@@ -0,0 +1,115 @@
+From 384497a7052cdb37230877edd93230dcae176ca7 Mon Sep 17 00:00:00 2001
+From: keita kobayashi <keita.kobayashi.ym@renesas.com>
+Date: Fri, 30 May 2014 14:18:48 +0900
+Subject: ARM: shmobile: r8a7791 SYSC setup code
+
+Add r8a7791 SYSC power management support.
+
+Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
+Acked-by: Magnus Damm <damm+renesas@opensource.se>
+[horms+renesas@verge.net.au: rebased]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 5f6108bb9643949bf5ec0bc9f5cbde588c542c7f)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/Makefile | 1 +
+ arch/arm/mach-shmobile/include/mach/r8a7791.h | 1 +
+ arch/arm/mach-shmobile/pm-r8a7791.c | 47 +++++++++++++++++++++++++++
+ arch/arm/mach-shmobile/smp-r8a7791.c | 2 ++
+ 4 files changed, 51 insertions(+)
+ create mode 100644 arch/arm/mach-shmobile/pm-r8a7791.c
+
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index 1b966da2c81c..efe4dd295f39 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -54,6 +54,7 @@ obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o
+ obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o
+ obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o pm-rcar.o
+ obj-$(CONFIG_ARCH_R8A7790) += pm-r8a7790.o pm-rcar.o
++obj-$(CONFIG_ARCH_R8A7791) += pm-r8a7791.o pm-rcar.o
+
+ # Board objects
+ ifdef CONFIG_ARCH_SHMOBILE_MULTI
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7791.h b/arch/arm/mach-shmobile/include/mach/r8a7791.h
+index 664274cc4b64..86eae7bceb6f 100644
+--- a/arch/arm/mach-shmobile/include/mach/r8a7791.h
++++ b/arch/arm/mach-shmobile/include/mach/r8a7791.h
+@@ -5,6 +5,7 @@ void r8a7791_add_standard_devices(void);
+ void r8a7791_add_dt_devices(void);
+ void r8a7791_clock_init(void);
+ void r8a7791_pinmux_init(void);
++void r8a7791_pm_init(void);
+ extern struct smp_operations r8a7791_smp_ops;
+
+ #endif /* __ASM_R8A7791_H__ */
+diff --git a/arch/arm/mach-shmobile/pm-r8a7791.c b/arch/arm/mach-shmobile/pm-r8a7791.c
+new file mode 100644
+index 000000000000..15190875d507
+--- /dev/null
++++ b/arch/arm/mach-shmobile/pm-r8a7791.c
+@@ -0,0 +1,47 @@
++/*
++ * r8a7791 Power management support
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ * Copyright (C) 2011 Renesas Solutions Corp.
++ * Copyright (C) 2011 Magnus Damm
++ *
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License. See the file "COPYING" in the main directory of this archive
++ * for more details.
++ */
++
++#include <asm/io.h>
++#include <linux/kernel.h>
++#include <mach/r8a7791.h>
++#include "pm-rcar.h"
++
++/* SYSC */
++#define SYSCIER 0x0c
++#define SYSCIMR 0x10
++
++#if defined(CONFIG_SMP)
++
++static void __init r8a7791_sysc_init(void)
++{
++ void __iomem *base = rcar_sysc_init(0xe6180000);
++
++ /* enable all interrupt sources, but do not use interrupt handler */
++ iowrite32(0x0131000e, base + SYSCIER);
++ iowrite32(0, base + SYSCIMR);
++}
++
++#else /* CONFIG_SMP */
++
++static inline void r8a7791_sysc_init(void) {}
++
++#endif /* CONFIG_SMP */
++
++void __init r8a7791_pm_init(void)
++{
++ static int once;
++
++ if (once++)
++ return;
++
++ r8a7791_sysc_init();
++}
+diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
+index 2648d68650e4..17720860f0dd 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7791.c
++++ b/arch/arm/mach-shmobile/smp-r8a7791.c
+@@ -50,6 +50,8 @@ static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
+ writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
+ p + CA15RESCNT);
+ iounmap(p);
++
++ r8a7791_pm_init();
+ }
+
+ static int r8a7791_smp_boot_secondary(unsigned int cpu,
+--
+2.1.2
+
diff --git a/patches.renesas/0830-ARM-shmobile-APMU-Add-Core-Standby-state-for-Suspend.patch b/patches.renesas/0830-ARM-shmobile-APMU-Add-Core-Standby-state-for-Suspend.patch
new file mode 100644
index 00000000000000..ec920418bd2ef1
--- /dev/null
+++ b/patches.renesas/0830-ARM-shmobile-APMU-Add-Core-Standby-state-for-Suspend.patch
@@ -0,0 +1,142 @@
+From 4af0f4878a58c3cc1e672dcede3f4db23278ca28 Mon Sep 17 00:00:00 2001
+From: keita kobayashi <keita.kobayashi.ym@renesas.com>
+Date: Thu, 29 May 2014 16:24:27 +0900
+Subject: ARM: shmobile: APMU: Add Core-Standby-state for Suspend to RAM
+
+This patch add Core-Standby-state for Suspend to RAM.
+
+Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
+Acked-by: Magnus Damm <damm+renesas@opensource.se>
+[horms+renesas@verge.net.au: rebase]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit d6d757c9a4e06e118fa5158fa74e03c514d862d2)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/common.h | 2 ++
+ arch/arm/mach-shmobile/platsmp-apmu.c | 60 ++++++++++++++++++++++++++++++++---
+ 2 files changed, 58 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h
+index 921a18ef4dfe..ab5a9b2886cf 100644
+--- a/arch/arm/mach-shmobile/common.h
++++ b/arch/arm/mach-shmobile/common.h
+@@ -35,8 +35,10 @@ extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv);
+
+ #ifdef CONFIG_SUSPEND
+ int shmobile_suspend_init(void);
++void shmobile_smp_apmu_suspend_init(void);
+ #else
+ static inline int shmobile_suspend_init(void) { return 0; }
++static inline void shmobile_smp_apmu_suspend_init(void) { return 0; }
+ #endif
+
+ #ifdef CONFIG_CPU_IDLE
+diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
+index fe648f5d8f06..590e35c22a60 100644
+--- a/arch/arm/mach-shmobile/platsmp-apmu.c
++++ b/arch/arm/mach-shmobile/platsmp-apmu.c
+@@ -7,15 +7,19 @@
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
++#include <linux/cpu_pm.h>
+ #include <linux/delay.h>
+ #include <linux/init.h>
+ #include <linux/io.h>
+ #include <linux/ioport.h>
+ #include <linux/of_address.h>
+ #include <linux/smp.h>
++#include <linux/suspend.h>
+ #include <asm/cacheflush.h>
+ #include <asm/cp15.h>
++#include <asm/proc-fns.h>
+ #include <asm/smp_plat.h>
++#include <asm/suspend.h>
+ #include "common.h"
+
+ static struct {
+@@ -141,7 +145,7 @@ int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
+ return apmu_wrap(cpu, apmu_power_on);
+ }
+
+-#ifdef CONFIG_HOTPLUG_CPU
++#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND)
+ /* nicked from arch/arm/mach-exynos/hotplug.c */
+ static inline void cpu_enter_lowpower_a15(void)
+ {
+@@ -172,16 +176,40 @@ static inline void cpu_enter_lowpower_a15(void)
+ dsb();
+ }
+
+-void shmobile_smp_apmu_cpu_die(unsigned int cpu)
++void shmobile_smp_apmu_cpu_shutdown(unsigned int cpu)
+ {
+- /* For this particular CPU deregister boot vector */
+- shmobile_smp_hook(cpu, 0, 0);
+
+ /* Select next sleep mode using the APMU */
+ apmu_wrap(cpu, apmu_power_off);
+
+ /* Do ARM specific CPU shutdown */
+ cpu_enter_lowpower_a15();
++}
++
++static inline void cpu_leave_lowpower(void)
++{
++ unsigned int v;
++
++ asm volatile("mrc p15, 0, %0, c1, c0, 0\n"
++ " orr %0, %0, %1\n"
++ " mcr p15, 0, %0, c1, c0, 0\n"
++ " mrc p15, 0, %0, c1, c0, 1\n"
++ " orr %0, %0, %2\n"
++ " mcr p15, 0, %0, c1, c0, 1\n"
++ : "=&r" (v)
++ : "Ir" (CR_C), "Ir" (0x40)
++ : "cc");
++}
++#endif
++
++#if defined(CONFIG_HOTPLUG_CPU)
++void shmobile_smp_apmu_cpu_die(unsigned int cpu)
++{
++ /* For this particular CPU deregister boot vector */
++ shmobile_smp_hook(cpu, 0, 0);
++
++ /* Shutdown CPU core */
++ shmobile_smp_apmu_cpu_shutdown(cpu);
+
+ /* jump to shared mach-shmobile sleep / reset code */
+ shmobile_smp_sleep();
+@@ -192,3 +220,27 @@ int shmobile_smp_apmu_cpu_kill(unsigned int cpu)
+ return apmu_wrap(cpu, apmu_power_off_poll);
+ }
+ #endif
++
++#if defined(CONFIG_SUSPEND)
++static int shmobile_smp_apmu_do_suspend(unsigned long cpu)
++{
++ shmobile_smp_hook(cpu, virt_to_phys(cpu_resume), 0);
++ shmobile_smp_apmu_cpu_shutdown(cpu);
++ cpu_do_idle(); /* WFI selects Core Standby */
++ return 1;
++}
++
++static int shmobile_smp_apmu_enter_suspend(suspend_state_t state)
++{
++ cpu_suspend(smp_processor_id(), shmobile_smp_apmu_do_suspend);
++ cpu_leave_lowpower();
++ return 0;
++}
++
++void shmobile_smp_apmu_suspend_init(void)
++{
++ shmobile_suspend_ops.enter = shmobile_smp_apmu_enter_suspend;
++}
++#else
++void shmobile_smp_apmu_suspend_init(void) {}
++#endif
+--
+2.1.2
+
diff --git a/patches.renesas/0831-ARM-shmobile-r8a7790-Support-Core-Standby-for-Suspen.patch b/patches.renesas/0831-ARM-shmobile-r8a7790-Support-Core-Standby-for-Suspen.patch
new file mode 100644
index 00000000000000..77806856d0ed0e
--- /dev/null
+++ b/patches.renesas/0831-ARM-shmobile-r8a7790-Support-Core-Standby-for-Suspen.patch
@@ -0,0 +1,31 @@
+From c75bc5a9537116fde544e7692f59612eaac209a4 Mon Sep 17 00:00:00 2001
+From: keita kobayashi <keita.kobayashi.ym@renesas.com>
+Date: Thu, 29 May 2014 16:24:39 +0900
+Subject: ARM: shmobile: r8a7790: Support Core-Standby for Suspend to RAM
+
+Add r8a7790 Core-Standby state for Suspend to RAM support.
+
+Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
+Acked-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ce508d1b13d1008db570ac58e775ce36bd9c5112)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/smp-r8a7790.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
+index a8ace58c3dd2..7590e2b6e2fa 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7790.c
++++ b/arch/arm/mach-shmobile/smp-r8a7790.c
+@@ -69,6 +69,7 @@ static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
+
+ /* turn on power to SCU */
+ r8a7790_pm_init();
++ shmobile_smp_apmu_suspend_init();
+ rcar_sysc_power_up(&r8a7790_ca15_scu);
+ rcar_sysc_power_up(&r8a7790_ca7_scu);
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0832-ARM-shmobile-r8a7791-Support-Core-Standby-for-Suspen.patch b/patches.renesas/0832-ARM-shmobile-r8a7791-Support-Core-Standby-for-Suspen.patch
new file mode 100644
index 00000000000000..bcb366dd88916f
--- /dev/null
+++ b/patches.renesas/0832-ARM-shmobile-r8a7791-Support-Core-Standby-for-Suspen.patch
@@ -0,0 +1,30 @@
+From b2dd9428ee44290b4cd75c1612b6f0794541c78b Mon Sep 17 00:00:00 2001
+From: keita kobayashi <keita.kobayashi.ym@renesas.com>
+Date: Thu, 29 May 2014 16:24:52 +0900
+Subject: ARM: shmobile: r8a7791: Support Core-Standby for Suspend to RAM
+
+Add r8a7791 Core-Standby state for Suspend to RAM support.
+
+Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 7f6234013a835476f1503be2c9287f1fe3497457)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/smp-r8a7791.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
+index 17720860f0dd..c6543b6ec759 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7791.c
++++ b/arch/arm/mach-shmobile/smp-r8a7791.c
+@@ -52,6 +52,7 @@ static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
+ iounmap(p);
+
+ r8a7791_pm_init();
++ shmobile_smp_apmu_suspend_init();
+ }
+
+ static int r8a7791_smp_boot_secondary(unsigned int cpu,
+--
+2.1.2
+
diff --git a/patches.renesas/0833-ARM-shmobile-Mark-all-SoCs-in-shmobile-as-CPUFreq-ca.patch b/patches.renesas/0833-ARM-shmobile-Mark-all-SoCs-in-shmobile-as-CPUFreq-ca.patch
new file mode 100644
index 00000000000000..b22fdca73e901a
--- /dev/null
+++ b/patches.renesas/0833-ARM-shmobile-Mark-all-SoCs-in-shmobile-as-CPUFreq-ca.patch
@@ -0,0 +1,35 @@
+From dfcd5d6733a1aa91b5bacb49ee4751398bda65f4 Mon Sep 17 00:00:00 2001
+From: Benoit Cousson <bcousson@baylibre.com>
+Date: Thu, 5 Jun 2014 12:49:44 +0900
+Subject: ARM: shmobile: Mark all SoCs in shmobile as CPUFreq, capable
+
+Mark all SoCs in shmobile as CPUFreq capable
+on multiplatform build only.
+
+Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
+[gaku.inami.xw@bp.renesas.com: Move the definition of cpufreq capable]
+Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 6596e97e054647fecb016ecb7e1935aa2b7db954)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/Kconfig | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index 0548968e21a8..22363ac76de4 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -12,6 +12,8 @@ config ARCH_SHMOBILE_MULTI
+ select NO_IOPORT_MAP
+ select PINCTRL
+ select ARCH_REQUIRE_GPIOLIB
++ select ARCH_HAS_CPUFREQ
++ select ARCH_HAS_OPP
+
+ if ARCH_SHMOBILE_MULTI
+
+--
+2.1.2
+
diff --git a/patches.renesas/0834-ARM-shmobile-Use-shmobile_init_late-on-r8a7790-DT-on.patch b/patches.renesas/0834-ARM-shmobile-Use-shmobile_init_late-on-r8a7790-DT-on.patch
new file mode 100644
index 00000000000000..bae4aebd4ebbc3
--- /dev/null
+++ b/patches.renesas/0834-ARM-shmobile-Use-shmobile_init_late-on-r8a7790-DT-on.patch
@@ -0,0 +1,32 @@
+From 08f6616db3ff10e538240ef4af845d2d3bc38865 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 15:13:47 +0900
+Subject: ARM: shmobile: Use shmobile_init_late() on r8a7790 DT-only
+
+Tie in shmobile_init_late for the DT-only r8a7790 SoC
+Multiplatform support code. This will make sure that
+Suspend-to-RAM, CPUIdle and CPUFreq get initialized.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 7d95b9ddfb933f94354fa2ff9b1bfccdd6c54653)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-r8a7790.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
+index 4212c8de987a..516b4e4a3ddd 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7790.c
++++ b/arch/arm/mach-shmobile/setup-r8a7790.c
+@@ -326,6 +326,7 @@ DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
+ .smp = smp_ops(r8a7790_smp_ops),
+ .init_early = r8a7790_init_early,
+ .init_time = rcar_gen2_timer_init,
++ .init_late = shmobile_init_late,
+ .dt_compat = r8a7790_boards_compat_dt,
+ MACHINE_END
+ #endif /* CONFIG_USE_OF */
+--
+2.1.2
+
diff --git a/patches.renesas/0835-ARM-shmobile-Use-shmobile_init_late-on-r8a7791-DT-on.patch b/patches.renesas/0835-ARM-shmobile-Use-shmobile_init_late-on-r8a7791-DT-on.patch
new file mode 100644
index 00000000000000..9f0b7fc774c872
--- /dev/null
+++ b/patches.renesas/0835-ARM-shmobile-Use-shmobile_init_late-on-r8a7791-DT-on.patch
@@ -0,0 +1,32 @@
+From 615bf84e0c324a4b446d5a9d4ae4f0b9501fa4ba Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 15:15:23 +0900
+Subject: ARM: shmobile: Use shmobile_init_late() on r8a7791 DT-only
+
+Tie in shmobile_init_late for the DT-only r8a7791 SoC
+Multiplatform support code. This will make sure that
+Suspend-to-RAM, CPUIdle and CPUFreq get initialized.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 3d65226bc925f4749c2b2ab0ea3f4d274e194688)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-r8a7791.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
+index f554cda4a96a..9e16b1daba59 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7791.c
++++ b/arch/arm/mach-shmobile/setup-r8a7791.c
+@@ -217,6 +217,7 @@ DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
+ .smp = smp_ops(r8a7791_smp_ops),
+ .init_early = shmobile_init_delay,
+ .init_time = rcar_gen2_timer_init,
++ .init_late = shmobile_init_late,
+ .dt_compat = r8a7791_boards_compat_dt,
+ MACHINE_END
+ #endif /* CONFIG_USE_OF */
+--
+2.1.2
+
diff --git a/patches.renesas/0836-ARM-shmobile-Add-shared-R-Car-Gen2-CMA-reservation-c.patch b/patches.renesas/0836-ARM-shmobile-Add-shared-R-Car-Gen2-CMA-reservation-c.patch
new file mode 100644
index 00000000000000..fa89da9c07fb45
--- /dev/null
+++ b/patches.renesas/0836-ARM-shmobile-Add-shared-R-Car-Gen2-CMA-reservation-c.patch
@@ -0,0 +1,80 @@
+From 6d7262fa88d692c7ceede3206628203118d4f36d Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Mon, 9 Jun 2014 21:38:45 +0900
+Subject: ARM: shmobile: Add shared R-Car Gen2 CMA reservation code
+
+Add R-Car Gen2 CMA memory reservation code that can be
+shared between multiple SoCs and boards. At this point
+r8a7790 and r8a7791 are supported.
+
+The top 256MiB of the legacy 32-bit physical memory space
+is assigned to a separate CMA area that may be assigned
+to various devices later on.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+[horms+renesas@verge.net.au: rebased]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit f8e819352d12f1b7d109d846e9bf1c07e006469a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/rcar-gen2.h | 1 +
+ arch/arm/mach-shmobile/setup-r8a7790.c | 1 +
+ arch/arm/mach-shmobile/setup-r8a7791.c | 1 +
+ arch/arm/mach-shmobile/setup-rcar-gen2.c | 3 +++
+ 4 files changed, 6 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/rcar-gen2.h b/arch/arm/mach-shmobile/rcar-gen2.h
+index 43f606eb2d82..ce53cb5f53a1 100644
+--- a/arch/arm/mach-shmobile/rcar-gen2.h
++++ b/arch/arm/mach-shmobile/rcar-gen2.h
+@@ -4,5 +4,6 @@
+ void rcar_gen2_timer_init(void);
+ #define MD(nr) BIT(nr)
+ u32 rcar_gen2_read_mode_pins(void);
++void rcar_gen2_reserve(void);
+
+ #endif /* __ASM_RCAR_GEN2_H__ */
+diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
+index 516b4e4a3ddd..e1907686ace4 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7790.c
++++ b/arch/arm/mach-shmobile/setup-r8a7790.c
+@@ -327,6 +327,7 @@ DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
+ .init_early = r8a7790_init_early,
+ .init_time = rcar_gen2_timer_init,
+ .init_late = shmobile_init_late,
++ .reserve = rcar_gen2_reserve,
+ .dt_compat = r8a7790_boards_compat_dt,
+ MACHINE_END
+ #endif /* CONFIG_USE_OF */
+diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
+index 9e16b1daba59..7e970d005f7f 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7791.c
++++ b/arch/arm/mach-shmobile/setup-r8a7791.c
+@@ -218,6 +218,7 @@ DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
+ .init_early = shmobile_init_delay,
+ .init_time = rcar_gen2_timer_init,
+ .init_late = shmobile_init_late,
++ .reserve = rcar_gen2_reserve,
+ .dt_compat = r8a7791_boards_compat_dt,
+ MACHINE_END
+ #endif /* CONFIG_USE_OF */
+diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+index fdc714ebc4cd..544b9bf28840 100644
+--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
++++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+@@ -20,8 +20,11 @@
+
+ #include <linux/clk/shmobile.h>
+ #include <linux/clocksource.h>
++#include <linux/device.h>
++#include <linux/dma-contiguous.h>
+ #include <linux/io.h>
+ #include <linux/kernel.h>
++#include <linux/of_fdt.h>
+ #include <asm/mach/arch.h>
+ #include "common.h"
+ #include "rcar-gen2.h"
+--
+2.1.2
+
diff --git a/patches.renesas/0837-ARM-shmobile-rcar-gen2-Update-for-of_get_flat_dt_pro.patch b/patches.renesas/0837-ARM-shmobile-rcar-gen2-Update-for-of_get_flat_dt_pro.patch
new file mode 100644
index 00000000000000..c72f6db7c399f8
--- /dev/null
+++ b/patches.renesas/0837-ARM-shmobile-rcar-gen2-Update-for-of_get_flat_dt_pro.patch
@@ -0,0 +1,128 @@
+From cee921bc239954da8203beb129483cbcca72acf5 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Thu, 12 Jun 2014 10:42:22 +0200
+Subject: ARM: shmobile: rcar-gen2: Update for of_get_flat_dt_prop() update
+
+Commit 9d0c4dfedd96ee54fc075b16d02f82499c8cc3a6 ("of/fdt: update
+of_get_flat_dt_prop in prep for libfdt") changed the function prototypes
+of of_get_flat_dt_prop():
+ - The return type was made const,
+ - The last parameter was changed from "unsigned long *" to "int *".
+and dt_mem_next_cell():
+ - The second parameter was made const.
+
+This causes the following compiler warnings:
+
+arch/arm/mach-shmobile/setup-rcar-gen2.c: In function 'rcar_gen2_scan_mem':
+arch/arm/mach-shmobile/setup-rcar-gen2.c:125:15: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
+arch/arm/mach-shmobile/setup-rcar-gen2.c:142:2: warning: passing argument 3 of 'of_get_flat_dt_prop' from incompatible pointer type [enabled by default]
+include/linux/of_fdt.h:53:20: note: expected 'int *' but argument is of type 'long unsigned int *'
+arch/arm/mach-shmobile/setup-rcar-gen2.c:142:6: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
+arch/arm/mach-shmobile/setup-rcar-gen2.c:144:3: warning: passing argument 3 of 'of_get_flat_dt_prop' from incompatible pointer type [enabled by default]
+include/linux/of_fdt.h:53:20: note: expected 'int *' but argument is of type 'long unsigned int *'
+arch/arm/mach-shmobile/setup-rcar-gen2.c:144:7: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
+arch/arm/mach-shmobile/setup-rcar-gen2.c:152:3: warning: passing argument 2 of 'dt_mem_next_cell' from incompatible pointer type [enabled by default]
+include/linux/of_fdt.h:69:12: note: expected 'const __be32 **' but argument is of type '__be32 **'
+arch/arm/mach-shmobile/setup-rcar-gen2.c:153:3: warning: passing argument 2 of 'dt_mem_next_cell' from incompatible pointer type [enabled by default]
+include/linux/of_fdt.h:69:12: note: expected 'const __be32 **' but argument is of type '__be32 **'
+
+Update the variable types in rcar_gen2_scan_mem() to fix this.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Magnus Damm <damm+renesas@opensource.se>
+[horms+renesas@verge.net.au: rebased]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 83850b04ae7744f51681533fb7afb645e66ce8fe)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-rcar-gen2.c | 76 ++++++++++++++++++++++++++++++++
+ 1 file changed, 76 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+index 544b9bf28840..b0626f89d7a6 100644
+--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
++++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+@@ -113,3 +113,79 @@ void __init rcar_gen2_timer_init(void)
+ #endif
+ clocksource_of_init();
+ }
++
++struct memory_reserve_config {
++ u64 reserved;
++ u64 base, size;
++};
++
++static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
++ int depth, void *data)
++{
++ const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
++ const __be32 *reg, *endp;
++ int l;
++ struct memory_reserve_config *mrc = data;
++ u64 lpae_start = (u64)1 << 32;
++
++ /* We are scanning "memory" nodes only */
++ if (type == NULL) {
++ /*
++ * The longtrail doesn't have a device_type on the
++ * /memory node, so look for the node called /memory@0.
++ */
++ if (depth != 1 || strcmp(uname, "memory@0") != 0)
++ return 0;
++ } else if (strcmp(type, "memory") != 0)
++ return 0;
++
++ reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
++ if (reg == NULL)
++ reg = of_get_flat_dt_prop(node, "reg", &l);
++ if (reg == NULL)
++ return 0;
++
++ endp = reg + (l / sizeof(__be32));
++ while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
++ u64 base, size;
++
++ base = dt_mem_next_cell(dt_root_addr_cells, &reg);
++ size = dt_mem_next_cell(dt_root_size_cells, &reg);
++
++ if (base >= lpae_start)
++ continue;
++
++ if ((base + size) >= lpae_start)
++ size = lpae_start - base;
++
++ if (size < mrc->reserved)
++ continue;
++
++ if (base < mrc->base)
++ continue;
++
++ /* keep the area at top near the 32-bit legacy limit */
++ mrc->base = base + size - mrc->reserved;
++ mrc->size = mrc->reserved;
++ }
++
++ return 0;
++}
++
++struct cma *rcar_gen2_dma_contiguous;
++
++void __init rcar_gen2_reserve(void)
++{
++ struct memory_reserve_config mrc;
++
++ /* reserve 256 MiB at the top of the physical legacy 32-bit space */
++ memset(&mrc, 0, sizeof(mrc));
++ mrc.reserved = SZ_256M;
++
++ of_scan_flat_dt(rcar_gen2_scan_mem, &mrc);
++#ifdef CONFIG_DMA_CMA
++ if (mrc.size)
++ dma_contiguous_reserve_area(mrc.size, mrc.base, 0,
++ &rcar_gen2_dma_contiguous);
++#endif
++}
+--
+2.1.2
+
diff --git a/patches.renesas/0838-ARM-shmobile-rcar-gen2-Use-1ULL-instead-of-u64-1.patch b/patches.renesas/0838-ARM-shmobile-rcar-gen2-Use-1ULL-instead-of-u64-1.patch
new file mode 100644
index 00000000000000..17bfbd77b9618a
--- /dev/null
+++ b/patches.renesas/0838-ARM-shmobile-rcar-gen2-Use-1ULL-instead-of-u64-1.patch
@@ -0,0 +1,32 @@
+From 31729185fe686bd7f6ef4b57aad9962383f50207 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Thu, 12 Jun 2014 10:42:23 +0200
+Subject: ARM: shmobile: rcar-gen2: Use "1ULL" instead of "(u64)1"
+
+Casts are evil
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit b69f47c00f2eff19b532cf0142d81b993e587bf0)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-rcar-gen2.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+index b0626f89d7a6..51d572306e1a 100644
+--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
++++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+@@ -126,7 +126,7 @@ static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
+ const __be32 *reg, *endp;
+ int l;
+ struct memory_reserve_config *mrc = data;
+- u64 lpae_start = (u64)1 << 32;
++ u64 lpae_start = 1ULL << 32;
+
+ /* We are scanning "memory" nodes only */
+ if (type == NULL) {
+--
+2.1.2
+
diff --git a/patches.renesas/0839-ARM-shmobile-rcar-gen2-Remove-useless-copied-section.patch b/patches.renesas/0839-ARM-shmobile-rcar-gen2-Remove-useless-copied-section.patch
new file mode 100644
index 00000000000000..56ba5860998db3
--- /dev/null
+++ b/patches.renesas/0839-ARM-shmobile-rcar-gen2-Remove-useless-copied-section.patch
@@ -0,0 +1,40 @@
+From e980b51433330a52c55613862aa6a8282fdd1a76 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Thu, 12 Jun 2014 10:42:24 +0200
+Subject: ARM: shmobile: rcar-gen2: Remove useless copied section for LongTrail
+
+Open Firmware in the CHRP LongTrail does not support plugging in ARM CPUs
+in its PPC 603e/604e-compatible CPU socket ;-)
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ea2a0d581a3e742c2fb2bc520c8c8887fe1dafa6)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-rcar-gen2.c | 9 +--------
+ 1 file changed, 1 insertion(+), 8 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+index 51d572306e1a..73fb2a659d9f 100644
+--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
++++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
+@@ -129,14 +129,7 @@ static int __init rcar_gen2_scan_mem(unsigned long node, const char *uname,
+ u64 lpae_start = 1ULL << 32;
+
+ /* We are scanning "memory" nodes only */
+- if (type == NULL) {
+- /*
+- * The longtrail doesn't have a device_type on the
+- * /memory node, so look for the node called /memory@0.
+- */
+- if (depth != 1 || strcmp(uname, "memory@0") != 0)
+- return 0;
+- } else if (strcmp(type, "memory") != 0)
++ if (type == NULL || strcmp(type, "memory"))
+ return 0;
+
+ reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
+--
+2.1.2
+
diff --git a/patches.renesas/0840-ARM-shmobile-rcar-gen2-correct-return-value-of-shmob.patch b/patches.renesas/0840-ARM-shmobile-rcar-gen2-correct-return-value-of-shmob.patch
new file mode 100644
index 00000000000000..698bb5f3dd56ad
--- /dev/null
+++ b/patches.renesas/0840-ARM-shmobile-rcar-gen2-correct-return-value-of-shmob.patch
@@ -0,0 +1,38 @@
+From 608ee0ea805144d1580c44dea3d9c47320bf33f7 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 16 Jun 2014 20:21:13 +0900
+Subject: ARM: shmobile: rcar-gen2: correct return value of
+ shmobile_smp_apmu_suspend_init
+
+The dummy shmobile_smp_apmu_suspend_init() function provided when
+CPU_IDLE is not set should not return a value as per the signature
+of the function.
+
+This problem appears to have been introduced by
+867ba81f728f1daa ("ARM: shmobile: APMU: Add Core-Standby-state for Suspend
+to RAM").
+
+Cc: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ecdaca48629bd99609fdc612685363330967dce2)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/common.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h
+index ab5a9b2886cf..98056081f0da 100644
+--- a/arch/arm/mach-shmobile/common.h
++++ b/arch/arm/mach-shmobile/common.h
+@@ -38,7 +38,7 @@ int shmobile_suspend_init(void);
+ void shmobile_smp_apmu_suspend_init(void);
+ #else
+ static inline int shmobile_suspend_init(void) { return 0; }
+-static inline void shmobile_smp_apmu_suspend_init(void) { return 0; }
++static inline void shmobile_smp_apmu_suspend_init(void) { }
+ #endif
+
+ #ifdef CONFIG_CPU_IDLE
+--
+2.1.2
+
diff --git a/patches.renesas/0841-ARM-shmobile-koelsch-reference-Remove-workarounds-fo.patch b/patches.renesas/0841-ARM-shmobile-koelsch-reference-Remove-workarounds-fo.patch
new file mode 100644
index 00000000000000..cfda6be885887c
--- /dev/null
+++ b/patches.renesas/0841-ARM-shmobile-koelsch-reference-Remove-workarounds-fo.patch
@@ -0,0 +1,58 @@
+From 5f3bcd088d380992d099ca66f871fc210b2533c7 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 14 May 2014 16:47:45 +0200
+Subject: ARM: shmobile: koelsch-reference: Remove workarounds for core clock
+ issues
+
+Now the core clock issues have been fixed by commit
+3c90c55dcde745bed81f6447f24ba96bda43d984 ("drivers: sh: compile
+drivers/sh/pm_runtime.c if ARCH_SHMOBILE_MULTI"), revert the following
+3 commits:
+ - 4dcb4c80380dfa482874b931e308fd382597feab ("ARM: shmobile: Add Koelsch
+ clock workarounds for SDHI"),
+ - 8e4f394b20a0fe474dd88204d76978191566decf ("ARM: shmobile:
+ koelsch-reference: Annotate clk_enables as __initconst"),
+ - 3d75d9ea74fee6f5a4bdcbbdf2d577661d047eef ("ARM: shmobile:
+ koelsch-reference: Work around core clock issues").
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit d37e9b0b20dd7670946ad6034b4aa93b7e7048aa)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-koelsch-reference.c | 15 ---------------
+ 1 file changed, 15 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
+index 1d3f67d4ccd6..28e3c45c8b90 100644
+--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
++++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
+@@ -92,24 +92,9 @@ static const struct clk_name clk_names[] __initconst = {
+ { "lvds0", "lvds.0", "rcar-du-r8a7791" },
+ };
+
+-/*
+- * This is a really crude hack to work around core platform clock issues
+- */
+-static const struct clk_name clk_enables[] __initconst = {
+- { "ether", NULL, "ee700000.ethernet" },
+- { "i2c2", NULL, "e6530000.i2c" },
+- { "msiof0", NULL, "e6e20000.spi" },
+- { "qspi_mod", NULL, "e6b10000.spi" },
+- { "sdhi0", NULL, "ee100000.sd" },
+- { "sdhi1", NULL, "ee140000.sd" },
+- { "sdhi2", NULL, "ee160000.sd" },
+- { "thermal", NULL, "e61f0000.thermal" },
+-};
+-
+ static void __init koelsch_add_standard_devices(void)
+ {
+ shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
+- shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
+ r8a7791_add_dt_devices();
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+
+--
+2.1.2
+
diff --git a/patches.renesas/0842-ARM-shmobile-lager-reference-Remove-workarounds-for-.patch b/patches.renesas/0842-ARM-shmobile-lager-reference-Remove-workarounds-for-.patch
new file mode 100644
index 00000000000000..668212959535e0
--- /dev/null
+++ b/patches.renesas/0842-ARM-shmobile-lager-reference-Remove-workarounds-for-.patch
@@ -0,0 +1,55 @@
+From 499b36a56ebb5a81fdf56498f1e1992ab2c197ae Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 14 May 2014 16:47:46 +0200
+Subject: ARM: shmobile: lager-reference: Remove workarounds for core clock
+ issues
+
+Now the core clock issues have been fixed by commit
+3c90c55dcde745bed81f6447f24ba96bda43d984 ("drivers: sh: compile
+drivers/sh/pm_runtime.c if ARCH_SHMOBILE_MULTI"), revert the following
+2 commits:
+ - f98b55d730492e664fb2649bd7054fec0fe81acd ("ARM: shmobile: Add Lager
+ clock workarounds for SDHI and MMCIF"),
+ - aa5de826afe747c353162bbc116c63ab5335f91c ("ARM: shmobile:
+ lager-reference: Work around core clock issues").
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit f47b9e1ec3a1d694f07fcc0d5ba0c2582acce099)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-lager-reference.c | 14 --------------
+ 1 file changed, 14 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
+index 4f0af91ebc81..9e0624e1b2f0 100644
+--- a/arch/arm/mach-shmobile/board-lager-reference.c
++++ b/arch/arm/mach-shmobile/board-lager-reference.c
+@@ -98,23 +98,9 @@ static const struct clk_name clk_names[] __initconst = {
+ { "lvds1", "lvds.1", "rcar-du-r8a7790" },
+ };
+
+-/*
+- * This is a really crude hack to work around core platform clock issues
+- */
+-static const struct clk_name clk_enables[] __initconst = {
+- { "ether", NULL, "ee700000.ethernet" },
+- { "msiof1", NULL, "e6e10000.spi" },
+- { "mmcif1", NULL, "ee220000.mmc" },
+- { "qspi_mod", NULL, "e6b10000.spi" },
+- { "sdhi0", NULL, "ee100000.sd" },
+- { "sdhi2", NULL, "ee140000.sd" },
+- { "thermal", NULL, "e61f0000.thermal" },
+-};
+-
+ static void __init lager_add_standard_devices(void)
+ {
+ shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
+- shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
+ r8a7790_add_dt_devices();
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+
+--
+2.1.2
+
diff --git a/patches.renesas/0843-ARM-shmobile-armadillo800eva-legacy-Add-LED-support.patch b/patches.renesas/0843-ARM-shmobile-armadillo800eva-legacy-Add-LED-support.patch
new file mode 100644
index 00000000000000..ce25124b66322f
--- /dev/null
+++ b/patches.renesas/0843-ARM-shmobile-armadillo800eva-legacy-Add-LED-support.patch
@@ -0,0 +1,71 @@
+From 7ea1d62f37d17950a6d43600f90abe267c99b5bd Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 14 May 2014 16:51:21 +0200
+Subject: ARM: shmobile: armadillo800eva legacy: Add LED support
+
+Cfr. r8a7740-armadillo800eva-reference.dts
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 111bcc1360235ad1cdab4bc27f5ccca943ca8af5)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 35 ++++++++++++++++++++++++++
+ 1 file changed, 35 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 284877ae9c83..90a0b2b15545 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -578,6 +578,40 @@ static struct platform_device hdmi_lcdc_device = {
+ },
+ };
+
++/* LEDS */
++static struct gpio_led gpio_leds[] = {
++ {
++ .name = "LED3",
++ .gpio = 102,
++ .default_state = LEDS_GPIO_DEFSTATE_ON,
++ }, {
++ .name = "LED4",
++ .gpio = 111,
++ .default_state = LEDS_GPIO_DEFSTATE_ON,
++ }, {
++ .name = "LED5",
++ .gpio = 110,
++ .default_state = LEDS_GPIO_DEFSTATE_ON,
++ }, {
++ .name = "LED6",
++ .gpio = 177,
++ .default_state = LEDS_GPIO_DEFSTATE_ON,
++ },
++};
++
++static struct gpio_led_platform_data leds_gpio_info = {
++ .leds = gpio_leds,
++ .num_leds = ARRAY_SIZE(gpio_leds),
++};
++
++static struct platform_device leds_gpio_device = {
++ .name = "leds-gpio",
++ .id = -1,
++ .dev = {
++ .platform_data = &leds_gpio_info,
++ },
++};
++
+ /* GPIO KEY */
+ #define GPIO_KEY(c, g, d, ...) \
+ { .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ }
+@@ -1069,6 +1103,7 @@ static struct platform_device *eva_devices[] __initdata = {
+ &lcdc0_device,
+ &pwm_device,
+ &pwm_backlight_device,
++ &leds_gpio_device,
+ &gpio_keys_device,
+ &sh_eth_device,
+ &vcc_sdhi0,
+--
+2.1.2
+
diff --git a/patches.renesas/0844-ARM-shmobile-armadillo800eva-reference-Spelling-s-ED.patch b/patches.renesas/0844-ARM-shmobile-armadillo800eva-reference-Spelling-s-ED.patch
new file mode 100644
index 00000000000000..7b6ed4e7e51dfa
--- /dev/null
+++ b/patches.renesas/0844-ARM-shmobile-armadillo800eva-reference-Spelling-s-ED.patch
@@ -0,0 +1,38 @@
+From 38c3c0449374678e6723fb12152dae2f8651b620 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Wed, 14 May 2014 16:51:20 +0200
+Subject: ARM: shmobile: armadillo800eva reference: Spelling s/ED/LED/
+
+And add missing spaces before opening parentheses
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 8a0d1a2fcfd019adf9893076f6c65a9a05712853)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-armadillo800eva-reference.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+index 6b7c975e8ee2..10b13c7ac214 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+@@ -53,11 +53,11 @@
+ * CON22 Serial
+ * CON23 LAN
+ * CON24 USB3
+- * LED1 Camera LED(Yellow)
++ * LED1 Camera LED (Yellow)
+ * LED2 Power LED (Green)
+- * ED3-LED6 User LED(Yellow)
+- * LED7 LAN link LED(Green)
+- * LED8 LAN activity LED(Yellow)
++ * LED3-LED6 User LED (Yellow)
++ * LED7 LAN link LED (Green)
++ * LED8 LAN activity LED (Yellow)
+ */
+
+ /*
+--
+2.1.2
+
diff --git a/patches.renesas/0845-ARM-shmobile-Enable-R-Car-Gen2-CMA-code-in-board-fil.patch b/patches.renesas/0845-ARM-shmobile-Enable-R-Car-Gen2-CMA-code-in-board-fil.patch
new file mode 100644
index 00000000000000..fcd29e62d00fd2
--- /dev/null
+++ b/patches.renesas/0845-ARM-shmobile-Enable-R-Car-Gen2-CMA-code-in-board-fil.patch
@@ -0,0 +1,67 @@
+From cd21f828583eb9dbcf48d5ee47d483292506b469 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Mon, 9 Jun 2014 21:38:53 +0900
+Subject: ARM: shmobile: Enable R-Car Gen2 CMA code in board files
+
+Hook in the R-Car Gen2 CMA reservation code in the board
+files for Lager and Koelsch. Both the DT-reference code
+and the legacy code is modified.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 5f65c5bd58bf027eb2bacc2294a98e7aea81c630)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-koelsch-reference.c | 1 +
+ arch/arm/mach-shmobile/board-koelsch.c | 1 +
+ arch/arm/mach-shmobile/board-lager-reference.c | 1 +
+ arch/arm/mach-shmobile/board-lager.c | 1 +
+ 4 files changed, 4 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
+index 28e3c45c8b90..5e0375fdc6f7 100644
+--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
++++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
+@@ -113,5 +113,6 @@ DT_MACHINE_START(KOELSCH_DT, "koelsch")
+ .init_time = rcar_gen2_timer_init,
+ .init_machine = koelsch_add_standard_devices,
+ .init_late = shmobile_init_late,
++ .reserve = rcar_gen2_reserve,
+ .dt_compat = koelsch_boards_compat_dt,
+ MACHINE_END
+diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
+index 0d44e7eb6508..db4b8a311c75 100644
+--- a/arch/arm/mach-shmobile/board-koelsch.c
++++ b/arch/arm/mach-shmobile/board-koelsch.c
+@@ -526,5 +526,6 @@ DT_MACHINE_START(KOELSCH_DT, "koelsch")
+ .init_time = rcar_gen2_timer_init,
+ .init_machine = koelsch_init,
+ .init_late = shmobile_init_late,
++ .reserve = rcar_gen2_reserve,
+ .dt_compat = koelsch_boards_compat_dt,
+ MACHINE_END
+diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
+index 9e0624e1b2f0..c5e656e3bae3 100644
+--- a/arch/arm/mach-shmobile/board-lager-reference.c
++++ b/arch/arm/mach-shmobile/board-lager-reference.c
+@@ -119,5 +119,6 @@ DT_MACHINE_START(LAGER_DT, "lager")
+ .init_time = rcar_gen2_timer_init,
+ .init_machine = lager_add_standard_devices,
+ .init_late = shmobile_init_late,
++ .reserve = rcar_gen2_reserve,
+ .dt_compat = lager_boards_compat_dt,
+ MACHINE_END
+diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
+index 83bbb5c48863..a51d202cddcf 100644
+--- a/arch/arm/mach-shmobile/board-lager.c
++++ b/arch/arm/mach-shmobile/board-lager.c
+@@ -891,5 +891,6 @@ DT_MACHINE_START(LAGER_DT, "lager")
+ .init_time = rcar_gen2_timer_init,
+ .init_machine = lager_init,
+ .init_late = shmobile_init_late,
++ .reserve = rcar_gen2_reserve,
+ .dt_compat = lager_boards_compat_dt,
+ MACHINE_END
+--
+2.1.2
+
diff --git a/patches.renesas/0846-ARM-shmobile-Get-rid-of-redundant-EMEV2-mach-callbac.patch b/patches.renesas/0846-ARM-shmobile-Get-rid-of-redundant-EMEV2-mach-callbac.patch
new file mode 100644
index 00000000000000..92bfa10f58d5cc
--- /dev/null
+++ b/patches.renesas/0846-ARM-shmobile-Get-rid-of-redundant-EMEV2-mach-callbac.patch
@@ -0,0 +1,60 @@
+From cff58ff6eca1c62e9b8e8695f18f63f21c5b6318 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Thu, 5 Jun 2014 14:32:12 +0900
+Subject: ARM: shmobile: Get rid of redundant EMEV2 mach callbacks
+
+Update the EMEV2 specific SoC callbacks to get rid
+of the calls to of_clk_init() and of_platform_populate().
+Those calls are by default executed by the functions in
+the shared ARM code in case the SoC specific mach
+callbacks are NULL.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit af164ca33dcb3c1e6a2e723f24542d1278a8bef8)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-emev2.c | 10 +---------
+ 1 file changed, 1 insertion(+), 9 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
+index e10d34e24817..b06a9e8f59a5 100644
+--- a/arch/arm/mach-shmobile/setup-emev2.c
++++ b/arch/arm/mach-shmobile/setup-emev2.c
+@@ -16,10 +16,9 @@
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+-#include <linux/clk-provider.h>
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+-#include <linux/of_platform.h>
++#include <linux/mm.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/map.h>
+@@ -42,12 +41,6 @@ static void __init emev2_map_io(void)
+ iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
+ }
+
+-static void __init emev2_add_standard_devices_dt(void)
+-{
+- of_clk_init(NULL);
+- of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+-}
+-
+ static const char *emev2_boards_compat_dt[] __initconst = {
+ "renesas,emev2",
+ NULL,
+@@ -59,7 +52,6 @@ DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
+ .smp = smp_ops(emev2_smp_ops),
+ .map_io = emev2_map_io,
+ .init_early = shmobile_init_delay,
+- .init_machine = emev2_add_standard_devices_dt,
+ .init_late = shmobile_init_late,
+ .dt_compat = emev2_boards_compat_dt,
+ MACHINE_END
+--
+2.1.2
+
diff --git a/patches.renesas/0847-ARM-shmobile-Update-r7s72100-DTS-to-include-CPU-freq.patch b/patches.renesas/0847-ARM-shmobile-Update-r7s72100-DTS-to-include-CPU-freq.patch
new file mode 100644
index 00000000000000..0c8ed5d8ea1403
--- /dev/null
+++ b/patches.renesas/0847-ARM-shmobile-Update-r7s72100-DTS-to-include-CPU-freq.patch
@@ -0,0 +1,34 @@
+From b2da2ec10ec4f52c9155af6be665a479ace64811 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 14:28:49 +0900
+Subject: ARM: shmobile: Update r7s72100 DTS to include CPU frequency
+
+Add CPU Frequency information to the r7s72100 DTS file. This
+will allow us to use the shared C code on r7s72100 and Genmai
+which reads out the clock frequency from DT and calculates the
+delay settings from there.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 005407fdf1c65a06fc0a9c588408f57e2eacef7c)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r7s72100.dtsi | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
+index f50fbc8f3bd9..bdee22541189 100644
+--- a/arch/arm/boot/dts/r7s72100.dtsi
++++ b/arch/arm/boot/dts/r7s72100.dtsi
+@@ -144,6 +144,7 @@
+ device_type = "cpu";
+ compatible = "arm,cortex-a9";
+ reg = <0>;
++ clock-frequency = <400000000>;
+ };
+ };
+
+--
+2.1.2
+
diff --git a/patches.renesas/0848-ARM-shmobile-Use-shmobile_init_delay-on-Genmai-board.patch b/patches.renesas/0848-ARM-shmobile-Use-shmobile_init_delay-on-Genmai-board.patch
new file mode 100644
index 00000000000000..f0674f510a03d3
--- /dev/null
+++ b/patches.renesas/0848-ARM-shmobile-Use-shmobile_init_delay-on-Genmai-board.patch
@@ -0,0 +1,47 @@
+From bb131925fb4a0087833052e9bca91f0e143cf75a Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 14:28:56 +0900
+Subject: ARM: shmobile: Use shmobile_init_delay() on Genmai boards
+
+Adjust Genmai board support to use shmobile_init_delay() together
+with r7s72100 CPU Frequency settings from the DTS.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 4387ac5282616ff14edc733aca79fe046ddb45f5)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-genmai-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-genmai.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
+index d341ef09ec37..c06dc5c12d1e 100644
+--- a/arch/arm/mach-shmobile/board-genmai-reference.c
++++ b/arch/arm/mach-shmobile/board-genmai-reference.c
+@@ -47,7 +47,7 @@ static const char * const genmai_boards_compat_dt[] __initconst = {
+ };
+
+ DT_MACHINE_START(GENMAI_DT, "genmai")
+- .init_early = r7s72100_init_early,
++ .init_early = shmobile_init_delay,
+ .init_machine = genmai_add_standard_devices,
+ .dt_compat = genmai_boards_compat_dt,
+ MACHINE_END
+diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
+index f0a8eca7d10d..a0994f36b348 100644
+--- a/arch/arm/mach-shmobile/board-genmai.c
++++ b/arch/arm/mach-shmobile/board-genmai.c
+@@ -154,7 +154,7 @@ static const char * const genmai_boards_compat_dt[] __initconst = {
+ };
+
+ DT_MACHINE_START(GENMAI_DT, "genmai")
+- .init_early = r7s72100_init_early,
++ .init_early = shmobile_init_delay,
+ .init_machine = genmai_add_standard_devices,
+ .dt_compat = genmai_boards_compat_dt,
+ MACHINE_END
+--
+2.1.2
+
diff --git a/patches.renesas/0849-ARM-shmobile-Use-shmobile_init_delay-on-r7s72100.patch b/patches.renesas/0849-ARM-shmobile-Use-shmobile_init_delay-on-r7s72100.patch
new file mode 100644
index 00000000000000..426b135622aa84
--- /dev/null
+++ b/patches.renesas/0849-ARM-shmobile-Use-shmobile_init_delay-on-r7s72100.patch
@@ -0,0 +1,58 @@
+From 19ed160c9c3354ff6361e754ca37786aae6b7578 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 14:29:04 +0900
+Subject: ARM: shmobile: Use shmobile_init_delay() on r7s72100
+
+Adjust the r7s72100 SoC support code to use shmobile_init_delay()
+together with CPU Frequency settings from the DTS. Get rid of the
+C code version.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit b42a6f7e8f22552aad0d8e595cd83f36316e312b)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/include/mach/r7s72100.h | 1 -
+ arch/arm/mach-shmobile/setup-r7s72100.c | 7 +------
+ 2 files changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/include/mach/r7s72100.h b/arch/arm/mach-shmobile/include/mach/r7s72100.h
+index 5f34b20ecd4a..efb723c88dd0 100644
+--- a/arch/arm/mach-shmobile/include/mach/r7s72100.h
++++ b/arch/arm/mach-shmobile/include/mach/r7s72100.h
+@@ -3,6 +3,5 @@
+
+ void r7s72100_add_dt_devices(void);
+ void r7s72100_clock_init(void);
+-void r7s72100_init_early(void);
+
+ #endif /* __ASM_R7S72100_H__ */
+diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
+index 17a74d355c5d..a55d68d89e6e 100644
+--- a/arch/arm/mach-shmobile/setup-r7s72100.c
++++ b/arch/arm/mach-shmobile/setup-r7s72100.c
+@@ -43,11 +43,6 @@ void __init r7s72100_add_dt_devices(void)
+ r7s72100_register_mtu2();
+ }
+
+-void __init r7s72100_init_early(void)
+-{
+- shmobile_setup_delay(400, 1, 3); /* Cortex-A9 @ 400MHz */
+-}
+-
+ #ifdef CONFIG_USE_OF
+ static const char *r7s72100_boards_compat_dt[] __initdata = {
+ "renesas,r7s72100",
+@@ -55,7 +50,7 @@ static const char *r7s72100_boards_compat_dt[] __initdata = {
+ };
+
+ DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)")
+- .init_early = r7s72100_init_early,
++ .init_early = shmobile_init_delay,
+ .dt_compat = r7s72100_boards_compat_dt,
+ MACHINE_END
+ #endif /* CONFIG_USE_OF */
+--
+2.1.2
+
diff --git a/patches.renesas/0850-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-in-common-.patch b/patches.renesas/0850-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-in-common-.patch
new file mode 100644
index 00000000000000..a6c242553b7dff
--- /dev/null
+++ b/patches.renesas/0850-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-in-common-.patch
@@ -0,0 +1,34 @@
+From f0b01256d5ab0d14ae57d49c9cb868adff513bb4 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 20 May 2014 08:37:24 +0900
+Subject: ARM: shmobile: Use r8a7790 DT CPU Frequency in common case
+
+Convert the common C-code-less r8a7790 DT board support
+to use shmobile_init_delay() to be able to migrate away
+from per-SoC delay setup functions.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ed06ecbcc66f6224a908c8abfe940b00540f0aa8)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-r8a7790.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
+index e1907686ace4..4bfa8539d72a 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7790.c
++++ b/arch/arm/mach-shmobile/setup-r8a7790.c
+@@ -324,7 +324,7 @@ static const char * const r8a7790_boards_compat_dt[] __initconst = {
+
+ DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
+ .smp = smp_ops(r8a7790_smp_ops),
+- .init_early = r8a7790_init_early,
++ .init_early = shmobile_init_delay,
+ .init_time = rcar_gen2_timer_init,
+ .init_late = shmobile_init_late,
+ .reserve = rcar_gen2_reserve,
+--
+2.1.2
+
diff --git a/patches.renesas/0851-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-for-Lager.patch b/patches.renesas/0851-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-for-Lager.patch
new file mode 100644
index 00000000000000..640da5073da647
--- /dev/null
+++ b/patches.renesas/0851-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-for-Lager.patch
@@ -0,0 +1,47 @@
+From ab6fb627a7ffd11c0bfa7f015824fc4871153488 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 20 May 2014 08:37:33 +0900
+Subject: ARM: shmobile: Use r8a7790 DT CPU Frequency for Lager
+
+Convert the Lager board support to use shmobile_init_delay()
+to be able to migrate away from per-SoC delay setup functions.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit a5d626813fc13f80b6ab80de1fe303ce5cdd8c54)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-lager-reference.c | 2 +-
+ arch/arm/mach-shmobile/board-lager.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
+index c5e656e3bae3..c2175c8e1ce7 100644
+--- a/arch/arm/mach-shmobile/board-lager-reference.c
++++ b/arch/arm/mach-shmobile/board-lager-reference.c
+@@ -115,7 +115,7 @@ static const char *lager_boards_compat_dt[] __initdata = {
+
+ DT_MACHINE_START(LAGER_DT, "lager")
+ .smp = smp_ops(r8a7790_smp_ops),
+- .init_early = r8a7790_init_early,
++ .init_early = shmobile_init_delay,
+ .init_time = rcar_gen2_timer_init,
+ .init_machine = lager_add_standard_devices,
+ .init_late = shmobile_init_late,
+diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
+index a51d202cddcf..6fb08dbc953c 100644
+--- a/arch/arm/mach-shmobile/board-lager.c
++++ b/arch/arm/mach-shmobile/board-lager.c
+@@ -887,7 +887,7 @@ static const char * const lager_boards_compat_dt[] __initconst = {
+
+ DT_MACHINE_START(LAGER_DT, "lager")
+ .smp = smp_ops(r8a7790_smp_ops),
+- .init_early = r8a7790_init_early,
++ .init_early = shmobile_init_delay,
+ .init_time = rcar_gen2_timer_init,
+ .init_machine = lager_init,
+ .init_late = shmobile_init_late,
+--
+2.1.2
+
diff --git a/patches.renesas/0852-ARM-shmobile-Remove-unused-r8a7790_init_early.patch b/patches.renesas/0852-ARM-shmobile-Remove-unused-r8a7790_init_early.patch
new file mode 100644
index 00000000000000..dbd33846d3ddb7
--- /dev/null
+++ b/patches.renesas/0852-ARM-shmobile-Remove-unused-r8a7790_init_early.patch
@@ -0,0 +1,50 @@
+From 6e2f0eea8d7e70131f6d1b76f705b5eec5574aaf Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Tue, 20 May 2014 08:37:42 +0900
+Subject: ARM: shmobile: Remove unused r8a7790_init_early()
+
+Remove the now unused r8a7790_init_early() function.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit d83fa4c9c27c4d8612e39e99506b5420fa05b58b)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/include/mach/r8a7790.h | 1 -
+ arch/arm/mach-shmobile/setup-r8a7790.c | 7 -------
+ 2 files changed, 8 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/include/mach/r8a7790.h
+index d7555440fc7b..459827f1369b 100644
+--- a/arch/arm/mach-shmobile/include/mach/r8a7790.h
++++ b/arch/arm/mach-shmobile/include/mach/r8a7790.h
+@@ -31,7 +31,6 @@ void r8a7790_add_dt_devices(void);
+ void r8a7790_clock_init(void);
+ void r8a7790_pinmux_init(void);
+ void r8a7790_pm_init(void);
+-void r8a7790_init_early(void);
+ extern struct smp_operations r8a7790_smp_ops;
+
+ #endif /* __ASM_R8A7790_H__ */
+diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
+index 4bfa8539d72a..a34229d5da41 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7790.c
++++ b/arch/arm/mach-shmobile/setup-r8a7790.c
+@@ -308,13 +308,6 @@ void __init r8a7790_add_standard_devices(void)
+ r8a7790_register_audio_dmac(1);
+ }
+
+-void __init r8a7790_init_early(void)
+-{
+-#ifndef CONFIG_ARM_ARCH_TIMER
+- shmobile_setup_delay(1300, 2, 4); /* Cortex-A15 @ 1300MHz */
+-#endif
+-}
+-
+ #ifdef CONFIG_USE_OF
+
+ static const char * const r8a7790_boards_compat_dt[] __initconst = {
+--
+2.1.2
+
diff --git a/patches.renesas/0853-ARM-shmobile-r8a7779-Add-helper-to-read-mode-pins.patch b/patches.renesas/0853-ARM-shmobile-r8a7779-Add-helper-to-read-mode-pins.patch
new file mode 100644
index 00000000000000..8a11c9d7f7ca46
--- /dev/null
+++ b/patches.renesas/0853-ARM-shmobile-r8a7779-Add-helper-to-read-mode-pins.patch
@@ -0,0 +1,100 @@
+From 7ee34ef34d077800db82b8999237b02f11213ff2 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:01 +0900
+Subject: ARM: shmobile: r8a7779: Add helper to read mode pins
+
+Add and use helper to read mode pins.
+This will be re-used when moving marzen-reference to
+the common clock framework.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 3e05f24aa95bb043f1103b41392b61ce83d2675e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7779.c | 11 ++---------
+ arch/arm/mach-shmobile/include/mach/r8a7779.h | 1 +
+ arch/arm/mach-shmobile/setup-r8a7779.c | 18 ++++++++++++++++++
+ 3 files changed, 21 insertions(+), 9 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
+index d81539a26dbd..5dd66a21f036 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7779.c
++++ b/arch/arm/mach-shmobile/clock-r8a7779.c
+@@ -23,6 +23,7 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
++#include <mach/r8a7779.h>
+ #include "clock.h"
+ #include "common.h"
+
+@@ -52,9 +53,6 @@
+ #define MSTPCR3 IOMEM(0xffc8003c)
+ #define MSTPSR1 IOMEM(0xffc80044)
+
+-#define MODEMR 0xffcc0020
+-
+-
+ /* ioremap() through clock mapping mandatory to avoid
+ * collision with ARM coherent DMA virtual memory range.
+ */
+@@ -207,14 +205,9 @@ static struct clk_lookup lookups[] = {
+
+ void __init r8a7779_clock_init(void)
+ {
+- void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
+- u32 mode;
++ u32 mode = r8a7779_read_mode_pins();
+ int k, ret = 0;
+
+- BUG_ON(!modemr);
+- mode = ioread32(modemr);
+- iounmap(modemr);
+-
+ if (mode & MD(1)) {
+ plla_clk.rate = 1500000000;
+
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
+index def10a29e09a..5ef0bad6334d 100644
+--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
++++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
+@@ -20,6 +20,7 @@ extern void r8a7779_add_early_devices(void);
+ extern void r8a7779_add_standard_devices(void);
+ extern void r8a7779_add_standard_devices_dt(void);
+ extern void r8a7779_init_late(void);
++extern u32 r8a7779_read_mode_pins(void);
+ extern void r8a7779_clock_init(void);
+ extern void r8a7779_pinmux_init(void);
+ extern void r8a7779_pm_init(void);
+diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
+index e2bd28de39d0..c00e42254822 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7779.c
++++ b/arch/arm/mach-shmobile/setup-r8a7779.c
+@@ -762,6 +762,24 @@ void __init r8a7779_add_standard_devices_dt(void)
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+ }
+
++#define MODEMR 0xffcc0020
++
++u32 __init r8a7779_read_mode_pins(void)
++{
++ static u32 mode;
++ static bool mode_valid;
++
++ if (!mode_valid) {
++ void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
++ BUG_ON(!modemr);
++ mode = ioread32(modemr);
++ iounmap(modemr);
++ mode_valid = true;
++ }
++
++ return mode;
++}
++
+ static const char *r8a7779_compat_dt[] __initdata = {
+ "renesas,r8a7779",
+ NULL,
+--
+2.1.2
+
diff --git a/patches.renesas/0854-ARM-shmobile-r8a7779-Move-r8a7779_earlytimer_init-to.patch b/patches.renesas/0854-ARM-shmobile-r8a7779-Move-r8a7779_earlytimer_init-to.patch
new file mode 100644
index 00000000000000..75397263dc0f37
--- /dev/null
+++ b/patches.renesas/0854-ARM-shmobile-r8a7779-Move-r8a7779_earlytimer_init-to.patch
@@ -0,0 +1,77 @@
+From c6f5dc176e1e5a83c82ff37156d8c77fb7f8c825 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:02 +0900
+Subject: ARM: shmobile: r8a7779: Move r8a7779_earlytimer_init to
+ clock-r8a7779.c
+
+r8a7779_earlytimer_init() calls r8a7779_clock_init() and
+r8a7779_clock_init() is defined in clock-r8a7779.c.
+
+If both CONFIG_COMMON_CLK and CONFIG_ARCH_R8A7779 are enabled,
+as will be the case when marzen-reference moves to use
+the common clock framework, then setup-r8a7779.c is compiled
+but clock-r8a7779.c is not.
+
+As r8a7779_earlytimer_init() is not used by marzen-reference
+simply move it to clock-r8a7779.c.
+
+[horms+renesas@verge.net.au: rebase]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit f48039a3da40f0c193122c83ad582913f2daf29d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7779.c | 11 +++++++++++
+ arch/arm/mach-shmobile/setup-r8a7779.c | 10 ----------
+ 2 files changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
+index 5dd66a21f036..e690927f3505 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7779.c
++++ b/arch/arm/mach-shmobile/clock-r8a7779.c
+@@ -23,6 +23,7 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
++#include <linux/sh_timer.h>
+ #include <mach/r8a7779.h>
+ #include "clock.h"
+ #include "common.h"
+@@ -261,3 +262,13 @@ void __init r8a7779_clock_init(void)
+ else
+ panic("failed to setup r8a7779 clocks\n");
+ }
++
++/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
++void __init __weak r8a7779_register_twd(void) { }
++
++void __init r8a7779_earlytimer_init(void)
++{
++ r8a7779_clock_init();
++ r8a7779_register_twd();
++ shmobile_earlytimer_init();
++}
+diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
+index c00e42254822..8f93628a4d9b 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7779.c
++++ b/arch/arm/mach-shmobile/setup-r8a7779.c
+@@ -674,16 +674,6 @@ void __init r8a7779_add_standard_devices(void)
+ r8a7779_register_hpb_dmae();
+ }
+
+-/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
+-void __init __weak r8a7779_register_twd(void) { }
+-
+-void __init r8a7779_earlytimer_init(void)
+-{
+- r8a7779_clock_init();
+- r8a7779_register_twd();
+- shmobile_earlytimer_init();
+-}
+-
+ void __init r8a7779_add_early_devices(void)
+ {
+ early_platform_add_devices(r8a7779_devices_dt,
+--
+2.1.2
+
diff --git a/patches.renesas/0855-ARM-shmobile-marzen-reference-Move-clock-and-OF-devi.patch b/patches.renesas/0855-ARM-shmobile-marzen-reference-Move-clock-and-OF-devi.patch
new file mode 100644
index 00000000000000..3880b5527134e3
--- /dev/null
+++ b/patches.renesas/0855-ARM-shmobile-marzen-reference-Move-clock-and-OF-devi.patch
@@ -0,0 +1,61 @@
+From bb0f8f41ba066eb9d6d153b94370f802f7d78e13 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:03 +0900
+Subject: ARM: shmobile: marzen-reference: Move clock and OF device
+ initialisation into board code
+
+Move the clock initialisation and OF device population from
+SoC to board code. This is in keeping with the pattern used by Lager.
+And the clock portion is part of decoupling clock initialisation
+from SoC code in preparation for moving to the common clock framework.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit f8fba0ce6628109bac9d33f65b637a87a2f3be24)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-marzen-reference.c | 3 +++
+ arch/arm/mach-shmobile/setup-r8a7779.c | 4 ----
+ 2 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index 94bd57203ff5..46ed17a50183 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -19,6 +19,7 @@
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
++#include <linux/of_platform.h>
+ #include <mach/r8a7779.h>
+ #include <asm/irq.h>
+ #include <asm/mach/arch.h>
+@@ -27,7 +28,9 @@
+
+ static void __init marzen_init(void)
+ {
++ r8a7779_clock_init();
+ r8a7779_add_standard_devices_dt();
++ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+ r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
+ }
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
+index 8f93628a4d9b..188f0df510be 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7779.c
++++ b/arch/arm/mach-shmobile/setup-r8a7779.c
+@@ -744,12 +744,8 @@ void __init r8a7779_init_delay(void)
+
+ void __init r8a7779_add_standard_devices_dt(void)
+ {
+- /* clocks are setup late during boot in the case of DT */
+- r8a7779_clock_init();
+-
+ platform_add_devices(r8a7779_devices_dt,
+ ARRAY_SIZE(r8a7779_devices_dt));
+- of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+ }
+
+ #define MODEMR 0xffcc0020
+--
+2.1.2
+
diff --git a/patches.renesas/0856-ARM-shmobile-r8a7779-Initial-multiplatform-support.patch b/patches.renesas/0856-ARM-shmobile-r8a7779-Initial-multiplatform-support.patch
new file mode 100644
index 00000000000000..f99680a15f3d83
--- /dev/null
+++ b/patches.renesas/0856-ARM-shmobile-r8a7779-Initial-multiplatform-support.patch
@@ -0,0 +1,113 @@
+From 6cb8a1cbf9dc53ec864d3cad359e5a1068699746 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:05 +0900
+Subject: ARM: shmobile: r8a7779: Initial multiplatform support
+
+Add Marzen and r8a7779 to CONFIG_SHMOBILE_MULTI. At this
+point CCF is not yet supported so you cannot run this code
+yet. For CCF support to happen several different components
+are needed, and this is one simple portion that moves us
+forward. Other patches need to build on top of this one.
+
+Marzen board support exists in 3 flavours:
+1) SHMOBILE_MULTI, MACH_MARZEN - board-marzen-reference.c (CCF + DT)
+2) SHMOBILE, MACH_MARZEN_REFERENCE - board-marzen-reference.c (DT)
+3) SHMOBILE, MACH_MARZEN - board-marzen.c (legacy C code)
+
+When CCF is done then 2) will be removed. When 1) includes same features
+as 3) then 3) will be removed.
+
+Based on work for the Koelsch and r8a7791 by Magnus Damm.
+
+Cc: Magnus Damm <damm@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 5016c81bf92eb01741fc71ce7fb8380183a6f66a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/Makefile | 3 ++-
+ arch/arm/mach-shmobile/Kconfig | 10 ++++++++++
+ arch/arm/mach-shmobile/Makefile | 1 +
+ arch/arm/mach-shmobile/board-marzen-reference.c | 5 +++++
+ 4 files changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index 6ec1b220c4c4..290dabcb63fe 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -262,7 +262,8 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
+ r7s72100-genmai.dtb \
+ r8a7791-henninger.dtb \
+ r8a7791-koelsch.dtb \
+- r8a7790-lager.dtb
++ r8a7790-lager.dtb \
++ r8a7779-marzen-reference.dtb
+ dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
+ socfpga_cyclone5_socdk.dtb \
+ socfpga_cyclone5_sockit.dtb \
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index 22363ac76de4..d9ed05172a04 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -27,6 +27,11 @@ config ARCH_R7S72100
+ bool "RZ/A1H (R7S72100)"
+ select SYS_SUPPORTS_SH_MTU2
+
++config ARCH_R8A7779
++ bool "R-Car H1 (R8A77790)"
++ select RENESAS_INTC_IRQPIN
++ select SYS_SUPPORTS_SH_TMU
++
+ config ARCH_R8A7790
+ bool "R-Car H2 (R8A77900)"
+ select RENESAS_IRQC
+@@ -53,6 +58,11 @@ config MACH_LAGER
+ depends on ARCH_R8A7790
+ select MICREL_PHY if SH_ETH
+
++config MACH_MARZEN
++ bool "MARZEN board"
++ depends on ARCH_R8A7779
++ select REGULATOR_FIXED_VOLTAGE if REGULATOR
++
+ comment "Renesas ARM SoCs System Configuration"
+ endif
+
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index efe4dd295f39..2bc1a45d0d00 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -61,6 +61,7 @@ ifdef CONFIG_ARCH_SHMOBILE_MULTI
+ obj-$(CONFIG_MACH_GENMAI) += board-genmai-reference.o
+ obj-$(CONFIG_MACH_KOELSCH) += board-koelsch-reference.o
+ obj-$(CONFIG_MACH_LAGER) += board-lager-reference.o
++obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o
+ else
+ obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o
+ obj-$(CONFIG_MACH_APE6EVM_REFERENCE) += board-ape6evm-reference.o
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index 46ed17a50183..d90843b22027 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -19,6 +19,7 @@
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
++#include <linux/clk-provider.h>
+ #include <linux/of_platform.h>
+ #include <mach/r8a7779.h>
+ #include <asm/irq.h>
+@@ -28,7 +29,11 @@
+
+ static void __init marzen_init(void)
+ {
++#ifdef CONFIG_COMMON_CLK
++ of_clk_init(NULL);
++#else
+ r8a7779_clock_init();
++#endif
+ r8a7779_add_standard_devices_dt();
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+ r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
+--
+2.1.2
+
diff --git a/patches.renesas/0857-ARM-shmobile-marzen-reference-Initialize-CPG-device.patch b/patches.renesas/0857-ARM-shmobile-marzen-reference-Initialize-CPG-device.patch
new file mode 100644
index 00000000000000..a23858b7ad35b9
--- /dev/null
+++ b/patches.renesas/0857-ARM-shmobile-marzen-reference-Initialize-CPG-device.patch
@@ -0,0 +1,65 @@
+From 1d8d223d3e02ead31b54d34f0022af1266ab2e05 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:06 +0900
+Subject: ARM: shmobile: marzen-reference: Initialize CPG device
+
+On multiplatform kernels clocks are handled by the CCF CPG driver. It
+must be explicitly initialized by a call to r8a7779_clocks_init() with
+the value of the boot mode pins.
+
+Based on similar work for the Koelsch board by Laurent Pinchart.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit a92fbd077bbfbe98e4dee84081d84c44ae99538b)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-marzen-reference.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index d90843b22027..f642819009ad 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -19,7 +19,8 @@
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+-#include <linux/clk-provider.h>
++#include <linux/clk/shmobile.h>
++#include <linux/clocksource.h>
+ #include <linux/of_platform.h>
+ #include <mach/r8a7779.h>
+ #include <asm/irq.h>
+@@ -27,11 +28,17 @@
+ #include "common.h"
+ #include "irqs.h"
+
+-static void __init marzen_init(void)
++static void __init marzen_init_timer(void)
+ {
+ #ifdef CONFIG_COMMON_CLK
+- of_clk_init(NULL);
+-#else
++ r8a7779_clocks_init(r8a7779_read_mode_pins());
++#endif
++ clocksource_of_init();
++}
++
++static void __init marzen_init(void)
++{
++#ifndef CONFIG_COMMON_CLK
+ r8a7779_clock_init();
+ #endif
+ r8a7779_add_standard_devices_dt();
+@@ -48,6 +55,7 @@ DT_MACHINE_START(MARZEN, "marzen")
+ .smp = smp_ops(r8a7779_smp_ops),
+ .map_io = r8a7779_map_io,
+ .init_early = r8a7779_init_delay,
++ .init_time = marzen_init_timer,
+ .nr_irqs = NR_IRQS_LEGACY,
+ .init_irq = r8a7779_init_irq_dt,
+ .init_machine = marzen_init,
+--
+2.1.2
+
diff --git a/patches.renesas/0858-ARM-shmobile-marzen-reference-Instantiate-clkdevs-fo.patch b/patches.renesas/0858-ARM-shmobile-marzen-reference-Instantiate-clkdevs-fo.patch
new file mode 100644
index 00000000000000..ada0f0a7e48676
--- /dev/null
+++ b/patches.renesas/0858-ARM-shmobile-marzen-reference-Instantiate-clkdevs-fo.patch
@@ -0,0 +1,69 @@
+From 9981c110bf2fe60e58a640425e07d4c3dfa545a4 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:07 +0900
+Subject: ARM: shmobile: marzen-reference: Instantiate clkdevs for SCIF and TMU
+
+Now that the common clock framework is supported, the clock lookup
+entries in clock-r8a7779.c are not registered anymore. Devices must
+instead reference their clocks in the device tree. However, SCIF and CMT
+devices are still instantiated through platform code, and thus need a
+clock lookup entry.
+
+Retrieve the SCIF and CMT clock entries by name and register clkdevs for
+the corresponding devices. This will be removed when the SCIF and CMT
+devices will be instantiated from the device tree.
+
+Based on work for the Koelsch board by Laurent Pinchart.
+
+Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 2b2084e8d4ae9265a3240722cb8adce06c0f393f)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-marzen-reference.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index f642819009ad..3017040c68be 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -25,6 +25,7 @@
+ #include <mach/r8a7779.h>
+ #include <asm/irq.h>
+ #include <asm/mach/arch.h>
++#include "clock.h"
+ #include "common.h"
+ #include "irqs.h"
+
+@@ -36,9 +37,27 @@ static void __init marzen_init_timer(void)
+ clocksource_of_init();
+ }
+
++#ifdef CONFIG_COMMON_CLK
++/*
++ * This is a really crude hack to provide clkdev support to platform
++ * devices until they get moved to DT.
++ */
++static const struct clk_name clk_names[] __initconst = {
++ { "scif0", NULL, "sh-sci.0" },
++ { "scif1", NULL, "sh-sci.1" },
++ { "scif2", NULL, "sh-sci.2" },
++ { "scif3", NULL, "sh-sci.3" },
++ { "scif4", NULL, "sh-sci.4" },
++ { "scif5", NULL, "sh-sci.5" },
++ { "tmu0", "fck", "sh-tmu.0" },
++};
++#endif
++
+ static void __init marzen_init(void)
+ {
+-#ifndef CONFIG_COMMON_CLK
++#ifdef CONFIG_COMMON_CLK
++ shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
++#else
+ r8a7779_clock_init();
+ #endif
+ r8a7779_add_standard_devices_dt();
+--
+2.1.2
+
diff --git a/patches.renesas/0859-ARM-shmobile-Remove-non-multiplatform-Marzen-referen.patch b/patches.renesas/0859-ARM-shmobile-Remove-non-multiplatform-Marzen-referen.patch
new file mode 100644
index 00000000000000..5d47e721135515
--- /dev/null
+++ b/patches.renesas/0859-ARM-shmobile-Remove-non-multiplatform-Marzen-referen.patch
@@ -0,0 +1,92 @@
+From ee14349c8c70e38205911f671501ee5dd7cd0737 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:09 +0900
+Subject: ARM: shmobile: Remove non-multiplatform Marzen reference support
+
+Now that r8a7779 has CCF support remove the legacy Marzen reference
+Kconfig bits CONFIG_MACH_MARZEN_REFERENCE for the non-multiplatform
+case.
+
+Starting from this commit Marzen board support is always enabled via
+CONFIG_MACH_MARZEN, and CONFIG_ARCH_MULTIPLATFORM is used to select
+between board-marzen.c and board-marzen-reference.c
+
+The file board-marzen-reference.c can no longer be used together with
+the legacy sh-clk clock framework, instead CCF is used.
+
+Based on work for the Koelsch board by Laurent Pinchart.
+
+Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 1ece7f7bb014485b13faf9504b238ff891a9088a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/Makefile | 1 -
+ arch/arm/mach-shmobile/Kconfig | 13 -------------
+ arch/arm/mach-shmobile/Makefile | 1 -
+ arch/arm/mach-shmobile/Makefile.boot | 1 -
+ 4 files changed, 16 deletions(-)
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index 290dabcb63fe..776b3aa1d1a7 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -250,7 +250,6 @@ dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += r7s72100-genmai.dtb \
+ r8a7778-bockw-reference.dtb \
+ r8a7740-armadillo800eva-reference.dtb \
+ r8a7779-marzen.dtb \
+- r8a7779-marzen-reference.dtb \
+ r8a7791-koelsch.dtb \
+ r8a7790-lager.dtb \
+ sh73a0-kzm9g.dtb \
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index d9ed05172a04..3e2380130769 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -249,19 +249,6 @@ config MACH_MARZEN
+ select REGULATOR_FIXED_VOLTAGE if REGULATOR
+ select USE_OF
+
+-config MACH_MARZEN_REFERENCE
+- bool "MARZEN board - Reference Device Tree Implementation"
+- depends on ARCH_R8A7779
+- select ARCH_REQUIRE_GPIOLIB
+- select REGULATOR_FIXED_VOLTAGE if REGULATOR
+- select USE_OF
+- ---help---
+- Use reference implementation of Marzen board support
+- which makes use of device tree at the expense
+- of not supporting a number of devices.
+-
+- This is intended to aid developers
+-
+ config MACH_LAGER
+ bool "Lager board"
+ depends on ARCH_R8A7790
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index 2bc1a45d0d00..ccb056327fd4 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -70,7 +70,6 @@ obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
+ obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
+ obj-$(CONFIG_MACH_GENMAI) += board-genmai.o
+ obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
+-obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
+ obj-$(CONFIG_MACH_LAGER) += board-lager.o
+ obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
+ obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o
+diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
+index 918fccffa1b6..ebf97d4bcfd8 100644
+--- a/arch/arm/mach-shmobile/Makefile.boot
++++ b/arch/arm/mach-shmobile/Makefile.boot
+@@ -13,7 +13,6 @@ loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
+ loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
+ loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
+ loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
+-loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
+
+ __ZRELADDR := $(sort $(loadaddr-y))
+ zreladdr-y += $(__ZRELADDR)
+--
+2.1.2
+
diff --git a/patches.renesas/0860-ARM-shmobile-Let-Marzen-multiplatform-boot-with-Marz.patch b/patches.renesas/0860-ARM-shmobile-Let-Marzen-multiplatform-boot-with-Marz.patch
new file mode 100644
index 00000000000000..35faeaa27523c1
--- /dev/null
+++ b/patches.renesas/0860-ARM-shmobile-Let-Marzen-multiplatform-boot-with-Marz.patch
@@ -0,0 +1,47 @@
+From 9922329b887ce499f2fceb82907570257e2de572 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:10 +0900
+Subject: ARM: shmobile: Let Marzen multiplatform boot with Marzen DTB
+
+Let the multiplatform Marzen support boot with the legacy DTS for
+Marzen as well as the Marzen reference DTS.
+
+Based on work for the Koelsch board by Laurent Pinchart.
+
+Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 04d3e8a0b150f1931d48ed9168672a971fc4c761)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/Makefile | 2 +-
+ arch/arm/mach-shmobile/board-marzen-reference.c | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index 776b3aa1d1a7..29cc71e9d81b 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -262,7 +262,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
+ r8a7791-henninger.dtb \
+ r8a7791-koelsch.dtb \
+ r8a7790-lager.dtb \
+- r8a7779-marzen-reference.dtb
++ r8a7779-marzen.dtb
+ dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
+ socfpga_cyclone5_socdk.dtb \
+ socfpga_cyclone5_sockit.dtb \
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index 3017040c68be..46936ff2627e 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -66,6 +66,7 @@ static void __init marzen_init(void)
+ }
+
+ static const char *marzen_boards_compat_dt[] __initdata = {
++ "renesas,marzen",
+ "renesas,marzen-reference",
+ NULL,
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0861-ARM-shmobile-Remove-Marzen-reference-DTS.patch b/patches.renesas/0861-ARM-shmobile-Remove-Marzen-reference-DTS.patch
new file mode 100644
index 00000000000000..88f30eba638323
--- /dev/null
+++ b/patches.renesas/0861-ARM-shmobile-Remove-Marzen-reference-DTS.patch
@@ -0,0 +1,150 @@
+From bcc6ee375d8127d307c8a6de53f33dc10e3ad3c0 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:11 +0900
+Subject: ARM: shmobile: Remove Marzen reference DTS
+
+Now that the DTS file r8a7779-marzen.dts can be used with
+board-marzen.c and board-marzen-reference.c, proceed with removing
+r8a7779-marzen-reference.dts.
+
+Based on work for the Koelsch board by Laurent Pinchart.
+
+Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 47ad265dd443802ead3d7e1aa3ef60ff1a8da952)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779-marzen-reference.dts | 121 -------------------------
+ 1 file changed, 121 deletions(-)
+ delete mode 100644 arch/arm/boot/dts/r8a7779-marzen-reference.dts
+
+diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
+deleted file mode 100644
+index b27c6373ff4d..000000000000
+--- a/arch/arm/boot/dts/r8a7779-marzen-reference.dts
++++ /dev/null
+@@ -1,121 +0,0 @@
+-/*
+- * Reference Device Tree Source for the Marzen board
+- *
+- * Copyright (C) 2013 Renesas Solutions Corp.
+- * Copyright (C) 2013 Simon Horman
+- *
+- * This file is licensed under the terms of the GNU General Public License
+- * version 2. This program is licensed "as is" without any warranty of any
+- * kind, whether express or implied.
+- */
+-
+-/dts-v1/;
+-#include "r8a7779.dtsi"
+-#include <dt-bindings/gpio/gpio.h>
+-#include <dt-bindings/interrupt-controller/irq.h>
+-
+-/ {
+- model = "marzen";
+- compatible = "renesas,marzen-reference", "renesas,r8a7779";
+-
+- chosen {
+- bootargs = "console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on rw";
+- };
+-
+- memory {
+- device_type = "memory";
+- reg = <0x60000000 0x40000000>;
+- };
+-
+- fixedregulator3v3: fixedregulator@0 {
+- compatible = "regulator-fixed";
+- regulator-name = "fixed-3.3V";
+- regulator-min-microvolt = <3300000>;
+- regulator-max-microvolt = <3300000>;
+- regulator-boot-on;
+- regulator-always-on;
+- };
+-
+- lan0@18000000 {
+- compatible = "smsc,lan9220", "smsc,lan9115";
+- reg = <0x18000000 0x100>;
+- pinctrl-0 = <&lan0_pins>;
+- pinctrl-names = "default";
+-
+- phy-mode = "mii";
+- interrupt-parent = <&irqpin0>;
+- interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
+- smsc,irq-push-pull;
+- reg-io-width = <4>;
+- vddvario-supply = <&fixedregulator3v3>;
+- vdd33a-supply = <&fixedregulator3v3>;
+- };
+-
+- leds {
+- compatible = "gpio-leds";
+- led2 {
+- gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
+- };
+- led3 {
+- gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
+- };
+- led4 {
+- gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;
+- };
+- };
+-};
+-
+-&irqpin0 {
+- status = "okay";
+-};
+-
+-&pfc {
+- pinctrl-0 = <&scif2_pins &scif4_pins>;
+- pinctrl-names = "default";
+-
+- lan0_pins: lan0 {
+- intc {
+- renesas,groups = "intc_irq1_b";
+- renesas,function = "intc";
+- };
+- lbsc {
+- renesas,groups = "lbsc_ex_cs0";
+- renesas,function = "lbsc";
+- };
+- };
+-
+- scif2_pins: serial2 {
+- renesas,groups = "scif2_data_c";
+- renesas,function = "scif2";
+- };
+-
+- scif4_pins: serial4 {
+- renesas,groups = "scif4_data";
+- renesas,function = "scif4";
+- };
+-
+- sdhi0_pins: sd0 {
+- renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
+- renesas,function = "sdhi0";
+- };
+-
+- hspi0_pins: hspi0 {
+- renesas,groups = "hspi0";
+- renesas,function = "hspi0";
+- };
+-};
+-
+-&sdhi0 {
+- pinctrl-0 = <&sdhi0_pins>;
+- pinctrl-names = "default";
+-
+- vmmc-supply = <&fixedregulator3v3>;
+- bus-width = <4>;
+- status = "okay";
+-};
+-
+-&hspi0 {
+- pinctrl-0 = <&hspi0_pins>;
+- pinctrl-names = "default";
+- status = "okay";
+-};
+--
+2.1.2
+
diff --git a/patches.renesas/0862-ARM-shmobile-marzen-reference-Remove-legacy-clock-su.patch b/patches.renesas/0862-ARM-shmobile-marzen-reference-Remove-legacy-clock-su.patch
new file mode 100644
index 00000000000000..9da7decec97ece
--- /dev/null
+++ b/patches.renesas/0862-ARM-shmobile-marzen-reference-Remove-legacy-clock-su.patch
@@ -0,0 +1,57 @@
+From b5df1d2a11d27776f061bcbd22a8da97f3222c1c Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:32:12 +0900
+Subject: ARM: shmobile: marzen-reference: Remove legacy clock support
+
+Marzen DT reference is now only built for multiplatform
+which means that CCF comes with the package. Remove unused legacy
+code ifdefs to clean up the code.
+
+Based on similar work for the Koelsch board by Magnus Damm.
+
+Cc: Magnus Damm <damm@opensource.se>
+Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit f0b78f8b63fe92242232b7a3e4aa951983ee1f45)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-marzen-reference.c | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index 46936ff2627e..1b63686e0160 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -31,13 +31,10 @@
+
+ static void __init marzen_init_timer(void)
+ {
+-#ifdef CONFIG_COMMON_CLK
+ r8a7779_clocks_init(r8a7779_read_mode_pins());
+-#endif
+ clocksource_of_init();
+ }
+
+-#ifdef CONFIG_COMMON_CLK
+ /*
+ * This is a really crude hack to provide clkdev support to platform
+ * devices until they get moved to DT.
+@@ -51,15 +48,10 @@ static const struct clk_name clk_names[] __initconst = {
+ { "scif5", NULL, "sh-sci.5" },
+ { "tmu0", "fck", "sh-tmu.0" },
+ };
+-#endif
+
+ static void __init marzen_init(void)
+ {
+-#ifdef CONFIG_COMMON_CLK
+ shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
+-#else
+- r8a7779_clock_init();
+-#endif
+ r8a7779_add_standard_devices_dt();
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+ r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
+--
+2.1.2
+
diff --git a/patches.renesas/0863-ARM-shmobile-r8a7779-Add-Maximum-CPU-Frequency-to-DT.patch b/patches.renesas/0863-ARM-shmobile-r8a7779-Add-Maximum-CPU-Frequency-to-DT.patch
new file mode 100644
index 00000000000000..1e418742fc013c
--- /dev/null
+++ b/patches.renesas/0863-ARM-shmobile-r8a7779-Add-Maximum-CPU-Frequency-to-DT.patch
@@ -0,0 +1,50 @@
+From 14fc4e182d5ceaaae6ccf9d169f006d31a59d223 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Fri, 16 May 2014 13:42:58 +0900
+Subject: ARM: shmobile: r8a7779: Add Maximum CPU Frequency to DTS
+
+Add 1GHz to the r8a7779 DTS to describe the maximum CPU frequency.
+
+Based on work by Magnus dam for the r8a7740 SoC.
+
+Cc: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 6b060f93fe7dedbeb067feacbc8c4780c59f5df4)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779.dtsi | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
+index bdaaadcfa1f1..038c16a18373 100644
+--- a/arch/arm/boot/dts/r8a7779.dtsi
++++ b/arch/arm/boot/dts/r8a7779.dtsi
+@@ -26,21 +26,25 @@
+ device_type = "cpu";
+ compatible = "arm,cortex-a9";
+ reg = <0>;
++ clock-frequency = <1000000000>;
+ };
+ cpu@1 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a9";
+ reg = <1>;
++ clock-frequency = <1000000000>;
+ };
+ cpu@2 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a9";
+ reg = <2>;
++ clock-frequency = <1000000000>;
+ };
+ cpu@3 {
+ device_type = "cpu";
+ compatible = "arm,cortex-a9";
+ reg = <3>;
++ clock-frequency = <1000000000>;
+ };
+ };
+
+--
+2.1.2
+
diff --git a/patches.renesas/0864-ARM-shmobile-r8a7779-Use-DT-CPU-Frequency-in-common-.patch b/patches.renesas/0864-ARM-shmobile-r8a7779-Use-DT-CPU-Frequency-in-common-.patch
new file mode 100644
index 00000000000000..e4dbf3d01b6000
--- /dev/null
+++ b/patches.renesas/0864-ARM-shmobile-r8a7779-Use-DT-CPU-Frequency-in-common-.patch
@@ -0,0 +1,35 @@
+From f946e872a566e7a7dc6e25590b8ea98342d41bc5 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Fri, 16 May 2014 13:42:59 +0900
+Subject: ARM: shmobile: r8a7779: Use DT CPU Frequency in common case
+
+Convert the common C-code-less r8a7779 DT board support
+to use shmobile_init_delay() to be able to migrate away
+from per-SoC delay setup functions.
+
+Based on work by Magnus dam for the r8a7740 SoC.
+
+Cc: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 0157b62674aa3db1fc574bb65e6b0e30bb0683d7)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-r8a7779.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
+index 188f0df510be..a03bfec15d96 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7779.c
++++ b/arch/arm/mach-shmobile/setup-r8a7779.c
+@@ -773,7 +773,7 @@ static const char *r8a7779_compat_dt[] __initdata = {
+
+ DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
+ .map_io = r8a7779_map_io,
+- .init_early = r8a7779_init_delay,
++ .init_early = shmobile_init_delay,
+ .nr_irqs = NR_IRQS_LEGACY,
+ .init_irq = r8a7779_init_irq_dt,
+ .init_machine = r8a7779_add_standard_devices_dt,
+--
+2.1.2
+
diff --git a/patches.renesas/0865-ARM-shmobile-marzen-reference-Use-DT-CPU-Frequency.patch b/patches.renesas/0865-ARM-shmobile-marzen-reference-Use-DT-CPU-Frequency.patch
new file mode 100644
index 00000000000000..a283de919b84c7
--- /dev/null
+++ b/patches.renesas/0865-ARM-shmobile-marzen-reference-Use-DT-CPU-Frequency.patch
@@ -0,0 +1,34 @@
+From 63503da0431c7ad7b75f3684254eb4d55ff8e1a9 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Fri, 16 May 2014 13:43:00 +0900
+Subject: ARM: shmobile: marzen-reference: Use DT CPU Frequency
+
+Convert the Marzen DT reference board support to use shmobile_init_delay()
+to be able to migrate away from per-SoC delay setup functions.
+
+Based on work for the Armadillo800 EVA board by Magnus Damm.
+
+Cc: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 17ed9efd8afdd8c38f19ff72f08e71c1fd2376e3)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-marzen-reference.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index 1b63686e0160..bb2df32f597a 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -66,7 +66,7 @@ static const char *marzen_boards_compat_dt[] __initdata = {
+ DT_MACHINE_START(MARZEN, "marzen")
+ .smp = smp_ops(r8a7779_smp_ops),
+ .map_io = r8a7779_map_io,
+- .init_early = r8a7779_init_delay,
++ .init_early = shmobile_init_delay,
+ .init_time = marzen_init_timer,
+ .nr_irqs = NR_IRQS_LEGACY,
+ .init_irq = r8a7779_init_irq_dt,
+--
+2.1.2
+
diff --git a/patches.renesas/0866-ARM-shmobile-r8a7779-Remove-unused-r8a7779_init_dela.patch b/patches.renesas/0866-ARM-shmobile-r8a7779-Remove-unused-r8a7779_init_dela.patch
new file mode 100644
index 00000000000000..140b3b1adb1cf4
--- /dev/null
+++ b/patches.renesas/0866-ARM-shmobile-r8a7779-Remove-unused-r8a7779_init_dela.patch
@@ -0,0 +1,49 @@
+From 0f8adf43ba5d4cafb23900f08eb1d3a11a3361b6 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Fri, 16 May 2014 13:43:01 +0900
+Subject: ARM: shmobile: r8a7779: Remove unused r8a7779_init_delay()
+
+Remove the now unused r8a7779_init_delay() function.
+
+Based on work for the r8a7740 SoC by Magnus Damm.
+
+Cc: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit daab540e3a2afeb8c087a67dfaee5aa50a29e844)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/include/mach/r8a7779.h | 1 -
+ arch/arm/mach-shmobile/setup-r8a7779.c | 5 -----
+ 2 files changed, 6 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
+index 5ef0bad6334d..5415c719dc19 100644
+--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
++++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
+@@ -10,7 +10,6 @@ enum {
+ HPBDMA_SLAVE_SDHI0_RX,
+ };
+
+-extern void r8a7779_init_delay(void);
+ extern void r8a7779_init_irq_extpin(int irlm);
+ extern void r8a7779_init_irq_extpin_dt(int irlm);
+ extern void r8a7779_init_irq_dt(void);
+diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
+index a03bfec15d96..c10ded91f477 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7779.c
++++ b/arch/arm/mach-shmobile/setup-r8a7779.c
+@@ -737,11 +737,6 @@ void __init r8a7779_init_irq_dt(void)
+ __raw_writel(0x003fee3f, INT2SMSKCR4);
+ }
+
+-void __init r8a7779_init_delay(void)
+-{
+- shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
+-}
+-
+ void __init r8a7779_add_standard_devices_dt(void)
+ {
+ platform_add_devices(r8a7779_devices_dt,
+--
+2.1.2
+
diff --git a/patches.renesas/0867-ARM-shmobile-r8a7779-dtsi-Update-unit-addresses-for-.patch b/patches.renesas/0867-ARM-shmobile-r8a7779-dtsi-Update-unit-addresses-for-.patch
new file mode 100644
index 00000000000000..adb0265fdde2ae
--- /dev/null
+++ b/patches.renesas/0867-ARM-shmobile-r8a7779-dtsi-Update-unit-addresses-for-.patch
@@ -0,0 +1,62 @@
+From 8f42f4ffe61723135abb6b9c9d1d9b1dc9013de1 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 23 May 2014 09:46:20 +0200
+Subject: ARM: shmobile: r8a7779 dtsi: Update unit-addresses for clocks
+
+ - Correct the unit-address for the "cpg_clocks" node,
+ - Add missing unit-addresses for the "mstp*_clks" nodes,
+ - Rename "cpg_clocks" and "mstp*_clks" nodes to the more generic
+ "clocks".
+
+Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 2909b8746d6f5534aa7714d2df110b3633a59556)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779.dtsi | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
+index 038c16a18373..27bf2274ff08 100644
+--- a/arch/arm/boot/dts/r8a7779.dtsi
++++ b/arch/arm/boot/dts/r8a7779.dtsi
+@@ -298,7 +298,7 @@
+ };
+
+ /* Special CPG clocks */
+- cpg_clocks: cpg_clocks@0xe6150000 {
++ cpg_clocks: clocks@ffc80000 {
+ compatible = "renesas,r8a7779-cpg-clocks";
+ reg = <0 0xffc80000 0 0x30>;
+ clocks = <&extal_clk>;
+@@ -342,7 +342,7 @@
+ };
+
+ /* Gate clocks */
+- mstp0_clks: mstp0_clks {
++ mstp0_clks: clocks@ffc80030 {
+ compatible = "renesas,r8a7779-mstp-clocks",
+ "renesas,cpg-mstp-clocks";
+ reg = <0 0xffc80030 0 4>;
+@@ -379,7 +379,7 @@
+ "scif1", "scif0", "i2c3", "i2c2", "i2c1",
+ "i2c0";
+ };
+- mstp1_clks: mstp1_clks {
++ mstp1_clks: clocks@ffc80034 {
+ compatible = "renesas,r8a7779-mstp-clocks",
+ "renesas,cpg-mstp-clocks";
+ reg = <0 0xffc80034 0 4>, <0 0xffc80044 0 4>;
+@@ -408,7 +408,7 @@
+ "ether", "sata",
+ "pcie", "vin3";
+ };
+- mstp3_clks: mstp3_clks {
++ mstp3_clks: clocks@ffc8003c {
+ compatible = "renesas,r8a7779-mstp-clocks",
+ "renesas,cpg-mstp-clocks";
+ reg = <0 0xffc8003c 0 4>;
+--
+2.1.2
+
diff --git a/patches.renesas/0868-ARM-shmobile-r8a7779-dtsi-Correct-address-cells-size.patch b/patches.renesas/0868-ARM-shmobile-r8a7779-dtsi-Correct-address-cells-size.patch
new file mode 100644
index 00000000000000..d45daf45537264
--- /dev/null
+++ b/patches.renesas/0868-ARM-shmobile-r8a7779-dtsi-Correct-address-cells-size.patch
@@ -0,0 +1,75 @@
+From ff1ccb59257af159744db0d96cf4a84cc78aa156 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 23 May 2014 09:46:19 +0200
+Subject: ARM: shmobile: r8a7779 dtsi: Correct #address-cells/#size-cells for
+ clocks
+
+Warning (ranges_format): /clocks has empty "ranges" property but its #address-cells (2) differs from / (1)
+Warning (ranges_format): /clocks has empty "ranges" property but its #size-cells (2) differs from / (1)
+
+As r8a7779 doesn't support LPAE, change #address-cells and #size-cells from
+"<2>" to "<1>", and update the affected "reg" properties to fix this.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 5cc8afcbc47c5f33732fb1a4b37a35841e7494e8)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779.dtsi | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
+index 27bf2274ff08..61d08f42456c 100644
+--- a/arch/arm/boot/dts/r8a7779.dtsi
++++ b/arch/arm/boot/dts/r8a7779.dtsi
+@@ -284,8 +284,8 @@
+ };
+
+ clocks {
+- #address-cells = <2>;
+- #size-cells = <2>;
++ #address-cells = <1>;
++ #size-cells = <1>;
+ ranges;
+
+ /* External root clock */
+@@ -300,7 +300,7 @@
+ /* Special CPG clocks */
+ cpg_clocks: clocks@ffc80000 {
+ compatible = "renesas,r8a7779-cpg-clocks";
+- reg = <0 0xffc80000 0 0x30>;
++ reg = <0xffc80000 0x30>;
+ clocks = <&extal_clk>;
+ #clock-cells = <1>;
+ clock-output-names = "plla", "z", "zs", "s",
+@@ -345,7 +345,7 @@
+ mstp0_clks: clocks@ffc80030 {
+ compatible = "renesas,r8a7779-mstp-clocks",
+ "renesas,cpg-mstp-clocks";
+- reg = <0 0xffc80030 0 4>;
++ reg = <0xffc80030 4>;
+ clocks = <&cpg_clocks R8A7779_CLK_S>,
+ <&cpg_clocks R8A7779_CLK_P>,
+ <&cpg_clocks R8A7779_CLK_P>,
+@@ -382,7 +382,7 @@
+ mstp1_clks: clocks@ffc80034 {
+ compatible = "renesas,r8a7779-mstp-clocks",
+ "renesas,cpg-mstp-clocks";
+- reg = <0 0xffc80034 0 4>, <0 0xffc80044 0 4>;
++ reg = <0xffc80034 4>, <0xffc80044 4>;
+ clocks = <&cpg_clocks R8A7779_CLK_P>,
+ <&cpg_clocks R8A7779_CLK_P>,
+ <&cpg_clocks R8A7779_CLK_S>,
+@@ -411,7 +411,7 @@
+ mstp3_clks: clocks@ffc8003c {
+ compatible = "renesas,r8a7779-mstp-clocks",
+ "renesas,cpg-mstp-clocks";
+- reg = <0 0xffc8003c 0 4>;
++ reg = <0xffc8003c 4>;
+ clocks = <&s4_clk>, <&s4_clk>, <&s4_clk>, <&s4_clk>,
+ <&s4_clk>, <&s4_clk>;
+ #clock-cells = <1>;
+--
+2.1.2
+
diff --git a/patches.renesas/0869-ARM-shmobile-r8a7779-Add-scif-nodes-to-dtsi.patch b/patches.renesas/0869-ARM-shmobile-r8a7779-Add-scif-nodes-to-dtsi.patch
new file mode 100644
index 00000000000000..38cec613ff4444
--- /dev/null
+++ b/patches.renesas/0869-ARM-shmobile-r8a7779-Add-scif-nodes-to-dtsi.patch
@@ -0,0 +1,86 @@
+From ccb5d46d4f7294f184037e9009019c44a6bfb060 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:39:30 +0900
+Subject: ARM: shmobile: r8a7779: Add scif nodes to dtsi
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit fd953b89f44e541bc584a65ba046d1b4cf77840f)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779.dtsi | 60 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 60 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
+index 61d08f42456c..94e2fc836492 100644
+--- a/arch/arm/boot/dts/r8a7779.dtsi
++++ b/arch/arm/boot/dts/r8a7779.dtsi
+@@ -196,6 +196,66 @@
+ status = "disabled";
+ };
+
++ scif0: serial@ffe40000 {
++ compatible = "renesas,scif-r8a7779", "renesas,scif";
++ reg = <0xffe40000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&cpg_clocks R8A7779_CLK_P>;
++ clock-names = "sci_ick";
++ status = "disabled";
++ };
++
++ scif1: serial@ffe41000 {
++ compatible = "renesas,scif-r8a7779", "renesas,scif";
++ reg = <0xffe41000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&cpg_clocks R8A7779_CLK_P>;
++ clock-names = "sci_ick";
++ status = "disabled";
++ };
++
++ scif2: serial@ffe42000 {
++ compatible = "renesas,scif-r8a7779", "renesas,scif";
++ reg = <0xffe42000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&cpg_clocks R8A7779_CLK_P>;
++ clock-names = "sci_ick";
++ status = "disabled";
++ };
++
++ scif3: serial@ffe43000 {
++ compatible = "renesas,scif-r8a7779", "renesas,scif";
++ reg = <0xffe43000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&cpg_clocks R8A7779_CLK_P>;
++ clock-names = "sci_ick";
++ status = "disabled";
++ };
++
++ scif4: serial@ffe44000 {
++ compatible = "renesas,scif-r8a7779", "renesas,scif";
++ reg = <0xffe44000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&cpg_clocks R8A7779_CLK_P>;
++ clock-names = "sci_ick";
++ status = "disabled";
++ };
++
++ scif5: serial@ffe45000 {
++ compatible = "renesas,scif-r8a7779", "renesas,scif";
++ reg = <0xffe45000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&cpg_clocks R8A7779_CLK_P>;
++ clock-names = "sci_ick";
++ status = "disabled";
++ };
++
+ pfc: pfc@fffc0000 {
+ compatible = "renesas,pfc-r8a7779";
+ reg = <0xfffc0000 0x23c>;
+--
+2.1.2
+
diff --git a/patches.renesas/0870-ARM-shmobile-marzen-Initialise-SCIF-devices-using-DT.patch b/patches.renesas/0870-ARM-shmobile-marzen-Initialise-SCIF-devices-using-DT.patch
new file mode 100644
index 00000000000000..1458b865b67463
--- /dev/null
+++ b/patches.renesas/0870-ARM-shmobile-marzen-Initialise-SCIF-devices-using-DT.patch
@@ -0,0 +1,92 @@
+From fbb241e6e911c6a1c65d4c4d720b72983c3255d1 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:39:32 +0900
+Subject: ARM: shmobile: marzen: Initialise SCIF devices using DT
+
+Initialise SCIF devices using DT when booting marzen
+using multiplatform.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 6d4abd79c80742629477479b01077bb92eccdd53)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779-marzen.dts | 22 +++++++++++++++++++---
+ arch/arm/mach-shmobile/setup-r8a7779.c | 8 ++++----
+ 2 files changed, 23 insertions(+), 7 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
+index 321290828eee..20b176807848 100644
+--- a/arch/arm/boot/dts/r8a7779-marzen.dts
++++ b/arch/arm/boot/dts/r8a7779-marzen.dts
+@@ -18,6 +18,11 @@
+ model = "marzen";
+ compatible = "renesas,marzen", "renesas,r8a7779";
+
++ aliases {
++ serial2 = &scif2;
++ serial4 = &scif4;
++ };
++
+ chosen {
+ bootargs = "console=ttySC2,115200 ignore_loglevel root=/dev/nfs ip=on";
+ };
+@@ -74,9 +79,6 @@
+ };
+
+ &pfc {
+- pinctrl-0 = <&scif2_pins &scif4_pins>;
+- pinctrl-names = "default";
+-
+ lan0_pins: lan0 {
+ intc {
+ renesas,groups = "intc_irq1_b";
+@@ -109,6 +111,20 @@
+ };
+ };
+
++&scif2 {
++ pinctrl-0 = <&scif2_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++};
++
++&scif4 {
++ pinctrl-0 = <&scif4_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++};
++
+ &sdhi0 {
+ pinctrl-0 = <&sdhi0_pins>;
+ pinctrl-names = "default";
+diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
+index c10ded91f477..219050ec9640 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7779.c
++++ b/arch/arm/mach-shmobile/setup-r8a7779.c
+@@ -640,16 +640,16 @@ static void __init r8a7779_register_hpb_dmae(void)
+ }
+
+ static struct platform_device *r8a7779_devices_dt[] __initdata = {
++ &tmu0_device,
++};
++
++static struct platform_device *r8a7779_standard_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &scif2_device,
+ &scif3_device,
+ &scif4_device,
+ &scif5_device,
+- &tmu0_device,
+-};
+-
+-static struct platform_device *r8a7779_standard_devices[] __initdata = {
+ &i2c0_device,
+ &i2c1_device,
+ &i2c2_device,
+--
+2.1.2
+
diff --git a/patches.renesas/0871-ARM-shmobile-marzen-Do-not-use-workaround-for-scif-d.patch b/patches.renesas/0871-ARM-shmobile-marzen-Do-not-use-workaround-for-scif-d.patch
new file mode 100644
index 00000000000000..56aab960725080
--- /dev/null
+++ b/patches.renesas/0871-ARM-shmobile-marzen-Do-not-use-workaround-for-scif-d.patch
@@ -0,0 +1,35 @@
+From 087395ac5cb06d30a3b28ced0c2ac969790ca89a Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Thu, 15 May 2014 20:39:33 +0900
+Subject: ARM: shmobile: marzen: Do not use workaround for scif devices
+
+Now that SCIF devices are initialised using DT it should
+not be necessary to use the work around to provide clocks any more.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit c1a0f9932b66b2298163c31f8ac3f2844476e1c2)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-marzen-reference.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index bb2df32f597a..0a000b74ac6d 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -40,12 +40,6 @@ static void __init marzen_init_timer(void)
+ * devices until they get moved to DT.
+ */
+ static const struct clk_name clk_names[] __initconst = {
+- { "scif0", NULL, "sh-sci.0" },
+- { "scif1", NULL, "sh-sci.1" },
+- { "scif2", NULL, "sh-sci.2" },
+- { "scif3", NULL, "sh-sci.3" },
+- { "scif4", NULL, "sh-sci.4" },
+- { "scif5", NULL, "sh-sci.5" },
+ { "tmu0", "fck", "sh-tmu.0" },
+ };
+
+--
+2.1.2
+
diff --git a/patches.renesas/0872-ARM-shmobile-r8a7790-add-USB3.0-clocks-to-device-tre.patch b/patches.renesas/0872-ARM-shmobile-r8a7790-add-USB3.0-clocks-to-device-tre.patch
new file mode 100644
index 00000000000000..76b0b820ed6985
--- /dev/null
+++ b/patches.renesas/0872-ARM-shmobile-r8a7790-add-USB3.0-clocks-to-device-tre.patch
@@ -0,0 +1,42 @@
+From 7866364853766b255612e976a4dab7d9610e5e94 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Tue, 3 Jun 2014 15:54:19 +0900
+Subject: ARM: shmobile: r8a7790: add USB3.0 clocks to device tree
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 35b5da7b0abfda695924bef011995031f4f3dcfe)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790.dtsi | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index 7ff29601f962..e2c7d6df5be4 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -754,17 +754,17 @@
+ reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
+ clocks = <&hp_clk>, <&cp_clk>, <&mmc1_clk>, <&sd3_clk>,
+ <&sd2_clk>, <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>, <&mmc0_clk>,
+- <&hp_clk>, <&hp_clk>, <&rclk_clk>;
++ <&hp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>;
+ #clock-cells = <1>;
+ renesas,clock-indices = <
+ R8A7790_CLK_IIC2 R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
+ R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0 R8A7790_CLK_MMCIF0
+- R8A7790_CLK_IIC0 R8A7790_CLK_IIC1 R8A7790_CLK_CMT1
++ R8A7790_CLK_IIC0 R8A7790_CLK_IIC1 R8A7790_CLK_SSUSB R8A7790_CLK_CMT1
+ >;
+ clock-output-names =
+ "iic2", "tpu0", "mmcif1", "sdhi3",
+ "sdhi2", "sdhi1", "sdhi0", "mmcif0",
+- "iic0", "iic1", "cmt1";
++ "iic0", "iic1", "ssusb", "cmt1";
+ };
+ mstp5_clks: mstp5_clks@e6150144 {
+ compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+--
+2.1.2
+
diff --git a/patches.renesas/0873-ARM-shmobile-r8a7791-add-USB3.0-clocks-to-device-tre.patch b/patches.renesas/0873-ARM-shmobile-r8a7791-add-USB3.0-clocks-to-device-tre.patch
new file mode 100644
index 00000000000000..9b6c9525ec8a89
--- /dev/null
+++ b/patches.renesas/0873-ARM-shmobile-r8a7791-add-USB3.0-clocks-to-device-tre.patch
@@ -0,0 +1,40 @@
+From 7214ffa85b9b8a19c0dcbfc93229fd47f2be055d Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Tue, 3 Jun 2014 15:57:05 +0900
+Subject: ARM: shmobile: r8a7791: add USB3.0 clocks to device tree
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 308f306283894a0d3eeee7d1030289e4e668d49d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 79f68acfd5d4..48056baa8dd8 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -758,15 +758,15 @@
+ compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+ reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
+ clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>, <&cpg_clocks R8A7791_CLK_SD0>,
+- <&mmc0_clk>, <&hp_clk>, <&hp_clk>, <&rclk_clk>;
++ <&mmc0_clk>, <&hp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>;
+ #clock-cells = <1>;
+ renesas,clock-indices = <
+ R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1 R8A7791_CLK_SDHI0
+- R8A7791_CLK_MMCIF0 R8A7791_CLK_IIC0 R8A7791_CLK_IIC1 R8A7791_CLK_CMT1
++ R8A7791_CLK_MMCIF0 R8A7791_CLK_IIC0 R8A7791_CLK_IIC1 R8A7791_CLK_SSUSB R8A7791_CLK_CMT1
+ >;
+ clock-output-names =
+ "tpu0", "sdhi2", "sdhi1", "sdhi0",
+- "mmcif0", "i2c7", "i2c8", "cmt1";
++ "mmcif0", "i2c7", "i2c8", "ssusb", "cmt1";
+ };
+ mstp5_clks: mstp5_clks@e6150144 {
+ compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+--
+2.1.2
+
diff --git a/patches.renesas/0874-ARM-shmobile-r8a7791-dtsi-add-SYS-DMAC-clocks.patch b/patches.renesas/0874-ARM-shmobile-r8a7791-dtsi-add-SYS-DMAC-clocks.patch
new file mode 100644
index 00000000000000..23688d56510f36
--- /dev/null
+++ b/patches.renesas/0874-ARM-shmobile-r8a7791-dtsi-add-SYS-DMAC-clocks.patch
@@ -0,0 +1,47 @@
+From 8267816a7d7c1aaa631fcc58aacf8364cfb76b2e Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Mon, 2 Jun 2014 15:42:07 +0200
+Subject: ARM: shmobile: r8a7791 dtsi: add SYS-DMAC clocks
+
+Add clocks for the SYS-DMAC0 and SYS-DMAC1 hardware blocks.
+
+Cfr. the r8a7790 version by Ben Dooks.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 4e074bc8114f0ba8a2e0a69fb459564814c9e966)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 48056baa8dd8..15dc67e94f28 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -743,16 +743,19 @@
+ compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+ reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>;
+ clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>,
+- <&mp_clk>, <&mp_clk>, <&mp_clk>;
++ <&mp_clk>, <&mp_clk>, <&mp_clk>,
++ <&zs_clk>, <&zs_clk>;
+ #clock-cells = <1>;
+ renesas,clock-indices = <
+ R8A7791_CLK_SCIFA2 R8A7791_CLK_SCIFA1 R8A7791_CLK_SCIFA0
+ R8A7791_CLK_MSIOF2 R8A7791_CLK_SCIFB0 R8A7791_CLK_SCIFB1
+ R8A7791_CLK_MSIOF1 R8A7791_CLK_SCIFB2
++ R8A7791_CLK_SYS_DMAC1 R8A7791_CLK_SYS_DMAC0
+ >;
+ clock-output-names =
+ "scifa2", "scifa1", "scifa0", "msiof2", "scifb0",
+- "scifb1", "msiof1", "scifb2";
++ "scifb1", "msiof1", "scifb2",
++ "sys-dmac1", "sys-dmac0";
+ };
+ mstp3_clks: mstp3_clks@e615013c {
+ compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+--
+2.1.2
+
diff --git a/patches.renesas/0875-ARM-shmobile-lager-Add-VDD-MPU-regulator-for-DVFS.patch b/patches.renesas/0875-ARM-shmobile-lager-Add-VDD-MPU-regulator-for-DVFS.patch
new file mode 100644
index 00000000000000..64cfd701ce68e2
--- /dev/null
+++ b/patches.renesas/0875-ARM-shmobile-lager-Add-VDD-MPU-regulator-for-DVFS.patch
@@ -0,0 +1,66 @@
+From 6c39b8a9c8f47d552fa6ae9ad28aef66459df22b Mon Sep 17 00:00:00 2001
+From: Benoit Cousson <bcousson@baylibre.com>
+Date: Tue, 3 Jun 2014 21:02:12 +0900
+Subject: ARM: shmobile: lager: Add VDD MPU regulator for DVFS
+
+The CA15 cluster is capable of voltage scaling. Add the regulator
+in the i2c3 node, to allow the generic CPUFreq driver to use it.
+
+Enable the i2c3 pin mux and the device node as well since the
+da9210 is connected to that bus.
+
+Note: In R-CAR Gen2, each frequency is using the same voltage,
+and DVS control is not used. Therefore, this patch set the
+voltage(Vmin/Vmax) to 1000mv.
+
+Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
+[gaku.inami.xw@bp.renesas.com: Changes Vmin for disabling DVS]
+Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 05f72e03b7553958609d1475c79491f90e6b50d3)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index 9becef78c797..8428204d9512 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -204,6 +204,11 @@
+ "msiof1_tx";
+ renesas,function = "msiof1";
+ };
++
++ i2c3_pins: i2c3 {
++ renesas,groups = "i2c3";
++ renesas,function = "i2c3";
++ };
+ };
+
+ &ether {
+@@ -317,3 +322,19 @@
+ cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>;
+ status = "okay";
+ };
++
++&i2c3 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&i2c3_pins>;
++ status = "okay";
++
++ vdd_dvfs: regulator@68 {
++ compatible = "diasemi,da9210";
++ reg = <0x68>;
++
++ regulator-min-microvolt = <1000000>;
++ regulator-max-microvolt = <1000000>;
++ regulator-boot-on;
++ regulator-always-on;
++ };
++};
+--
+2.1.2
+
diff --git a/patches.renesas/0876-ARM-shmobile-r8a7790-lager-dts-Add-DVFS-parameters-i.patch b/patches.renesas/0876-ARM-shmobile-r8a7790-lager-dts-Add-DVFS-parameters-i.patch
new file mode 100644
index 00000000000000..c8a042044cfdcb
--- /dev/null
+++ b/patches.renesas/0876-ARM-shmobile-r8a7790-lager-dts-Add-DVFS-parameters-i.patch
@@ -0,0 +1,75 @@
+From 271f89812cd7d4f735f2bbb931a7884a30ca4bd1 Mon Sep 17 00:00:00 2001
+From: Benoit Cousson <bcousson@baylibre.com>
+Date: Tue, 3 Jun 2014 21:02:24 +0900
+Subject: ARM: shmobile: r8a7790/lager dts: Add DVFS parameters into cpu0 node
+ for r8a7790
+
+Add needed information inside CPU0 for the generic cpufreq-cpu0 driver.
+
+- voltage-tolerance = 1%
+ It reflects the tolerance for the CPU voltage defined inside the OPP
+ table. Due to the lack of proper OPP definition, use an arbitrary safe
+ value.
+- clock-latency = 300 us
+ Approximate worst-case latency to do a full DVFS transition for every
+ OPPs. Due to the lack of HW information, use an arbitrary safe value.
+ Note: The term transition-latency will be more accurate to define this
+ value since the clock transition latency is not the only parameter that
+ will define the overall DVFS transition.
+- operating-points = < kHz - uV >
+ List of 6 operating points. All of them are using the same voltage
+ since the valid Vmin voltage is not documented in the HW spec.
+- clocks
+ phandle to the CPU clock source. This clock source is used for all the
+ 4 CortexA15 located inside the same cluster.
+
+Signed-off-by: Benoit Cousson <bcousson+renesas@baylibre.com>
+[gaku.inami.xw@bp.renesas.com: Change the setting of OPPs for ES2.0]
+Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit b989e1386385466761f703b8a91e00468bb5ca2a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 4 ++++
+ arch/arm/boot/dts/r8a7790.dtsi | 11 +++++++++++
+ 2 files changed, 15 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index 8428204d9512..b9cbeda87530 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -338,3 +338,7 @@
+ regulator-always-on;
+ };
+ };
++
++&cpu0 {
++ cpu0-supply = <&vdd_dvfs>;
++};
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index e2c7d6df5be4..e990d3c4fe62 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -44,6 +44,17 @@
+ compatible = "arm,cortex-a15";
+ reg = <0>;
+ clock-frequency = <1300000000>;
++ voltage-tolerance = <1>; /* 1% */
++ clocks = <&cpg_clocks R8A7790_CLK_Z>;
++ clock-latency = <300000>; /* 300 us */
++
++ /* kHz - uV - OPPs unknown yet */
++ operating-points = <1400000 1000000>,
++ <1225000 1000000>,
++ <1050000 1000000>,
++ < 875000 1000000>,
++ < 700000 1000000>,
++ < 350000 1000000>;
+ };
+
+ cpu1: cpu@1 {
+--
+2.1.2
+
diff --git a/patches.renesas/0877-ARM-shmobile-koelsch-dts-Add-VDD-MPU-regulator-for-D.patch b/patches.renesas/0877-ARM-shmobile-koelsch-dts-Add-VDD-MPU-regulator-for-D.patch
new file mode 100644
index 00000000000000..2452ed5d1d8eeb
--- /dev/null
+++ b/patches.renesas/0877-ARM-shmobile-koelsch-dts-Add-VDD-MPU-regulator-for-D.patch
@@ -0,0 +1,63 @@
+From 953a3a3b6d767a422a0acafcdd26a9b8e0b19dce Mon Sep 17 00:00:00 2001
+From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Date: Tue, 3 Jun 2014 21:02:59 +0900
+Subject: ARM: shmobile: koelsch dts: Add VDD MPU regulator for DVFS
+
+The CA15 cluster is capable of voltage scaling. Add the regulator
+in the i2c6 node, to allow the generic CPUFreq driver to use it.
+
+Enable the i2c6 pin mux and the device node as well since the
+da9210 is connected to that bus.
+
+Note: In R-CAR Gen2, each frequency is using the same voltage,
+and DVS control is not used. Therefore, this patch set the
+voltage(Vmin/Vmax) to 1000mv.
+
+Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 1d41f36a68c0f4e9b01d563ce33bab5201858b54)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-koelsch.dts | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
+index 05d44f9b202f..95331d73042d 100644
+--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
++++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
+@@ -293,6 +293,11 @@
+ "msiof0_tx";
+ renesas,function = "msiof0";
+ };
++
++ i2c6_pins: i2c6 {
++ renesas,groups = "i2c6";
++ renesas,function = "i2c6";
++ };
+ };
+
+ &ether {
+@@ -408,3 +413,19 @@
+ spi-cpha;
+ };
+ };
++
++&i2c6 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&i2c6_pins>;
++ status = "okay";
++
++ vdd_dvfs: regulator@68 {
++ compatible = "diasemi,da9210";
++ reg = <0x68>;
++
++ regulator-min-microvolt = <1000000>;
++ regulator-max-microvolt = <1000000>;
++ regulator-boot-on;
++ regulator-always-on;
++ };
++};
+--
+2.1.2
+
diff --git a/patches.renesas/0878-ARM-shmobile-r8a7791-koelsch-dts-Add-DVFS-parameters.patch b/patches.renesas/0878-ARM-shmobile-r8a7791-koelsch-dts-Add-DVFS-parameters.patch
new file mode 100644
index 00000000000000..22e0f1f247be14
--- /dev/null
+++ b/patches.renesas/0878-ARM-shmobile-r8a7791-koelsch-dts-Add-DVFS-parameters.patch
@@ -0,0 +1,72 @@
+From f77fae69a8b387ef34ea8371674b1f92ac55013b Mon Sep 17 00:00:00 2001
+From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Date: Tue, 3 Jun 2014 21:03:10 +0900
+Subject: ARM: shmobile: r8a7791/koelsch dts: Add DVFS parameters into cpu0
+ node for r8a7791
+
+Add needed information inside CPU0 for the generic cpufreq-cpu0 driver.
+
+- voltage-tolerance = 1%
+ It reflects the tolerance for the CPU voltage defined inside the OPP
+ table. Due to the lack of proper OPP definition, use an arbitrary safe
+ value.
+- clock-latency = 300 us
+ Approximate worst-case latency to do a full DVFS transition for every
+ OPPs. Due to the lack of HW information, use an arbitrary safe value.
+ Note: The term transition-latency will be more accurate to define this
+ value since the clock transition latency is not the only parameter that
+ will define the overall DVFS transition.
+- operating-points = < kHz - uV >
+ List of 6 operating points. All of them are using the same voltage
+ since DVS is not supported in R-CAR Gen2.
+- clocks
+ phandle to the CPU clock source. This clock source is used for all the
+ 2 CortexA15 located inside the same cluster.
+
+Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit a57004eca542428a444025847098b2af4e52a81c)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-koelsch.dts | 4 ++++
+ arch/arm/boot/dts/r8a7791.dtsi | 11 +++++++++++
+ 2 files changed, 15 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
+index 95331d73042d..b2e661613dda 100644
+--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
++++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
+@@ -429,3 +429,7 @@
+ regulator-always-on;
+ };
+ };
++
++&cpu0 {
++ cpu0-supply = <&vdd_dvfs>;
++};
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 15dc67e94f28..76150f1a82db 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -45,6 +45,17 @@
+ compatible = "arm,cortex-a15";
+ reg = <0>;
+ clock-frequency = <1500000000>;
++ voltage-tolerance = <1>; /* 1% */
++ clocks = <&cpg_clocks R8A7791_CLK_Z>;
++ clock-latency = <300000>; /* 300 us */
++
++ /* kHz - uV - OPPs unknown yet */
++ operating-points = <1500000 1000000>,
++ <1312500 1000000>,
++ <1125000 1000000>,
++ < 937500 1000000>,
++ < 750000 1000000>,
++ < 375000 1000000>;
+ };
+
+ cpu1: cpu@1 {
+--
+2.1.2
+
diff --git a/patches.renesas/0879-ARM-shmobile-lager-enable-i2c-devices.patch b/patches.renesas/0879-ARM-shmobile-lager-enable-i2c-devices.patch
new file mode 100644
index 00000000000000..9cd05724045790
--- /dev/null
+++ b/patches.renesas/0879-ARM-shmobile-lager-enable-i2c-devices.patch
@@ -0,0 +1,46 @@
+From b1a63d9861ae058ce5629facadf25a6342ebc528 Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Wed, 12 Feb 2014 17:04:33 +0000
+Subject: ARM: shmobile: lager: enable i2c devices
+
+Add i2c0, i2c1, i2c2 and i2c3 nodes to the Lager reference device tree as
+these busses all have devices on them that can be probed even if they
+are no drivers yet.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+[horms+renesas@verge.net.au: Added shmobile to title]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit e489c2a9bc82713167d9f721ca764f4b0d37e543)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index b9cbeda87530..7840b60596b0 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -342,3 +342,19 @@
+ &cpu0 {
+ cpu0-supply = <&vdd_dvfs>;
+ };
++
++&i2c0 {
++ status = "ok";
++};
++
++&i2c1 {
++ status = "ok";
++};
++
++&i2c2 {
++ status = "ok";
++};
++
++&i2c3 {
++ status = "ok";
++};
+--
+2.1.2
+
diff --git a/patches.renesas/0880-ARM-shmobile-lager-add-i2c1-i2c2-pins.patch b/patches.renesas/0880-ARM-shmobile-lager-add-i2c1-i2c2-pins.patch
new file mode 100644
index 00000000000000..5ac2b7662799a7
--- /dev/null
+++ b/patches.renesas/0880-ARM-shmobile-lager-add-i2c1-i2c2-pins.patch
@@ -0,0 +1,58 @@
+From b11b8f456e720206a1e8eaf8753eddf2cc970cfc Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Wed, 12 Feb 2014 17:04:34 +0000
+Subject: ARM: shmobile: lager: add i2c1, i2c2 pins
+
+Add pinctrl definitions for i2c1 and i2c2 busses on the Lager board
+to ensure these are setup correctly at initialisation time. The i2c0
+and i2c3 busses are connected to single function pins.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+[horms+renesas@verge.net.au: Added shmobile to patch title]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit e1a2c4eb132018ce5b988c9ff5ba7a01e5494af5)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index 7840b60596b0..c72372484548 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -144,6 +144,16 @@
+ states = <3300000 1
+ 1800000 0>;
+ };
++
++ i2c1_pins: i2c1 {
++ renesas,groups = "i2c1";
++ renesas,function = "i2c1";
++ };
++
++ i2c2_pins: i2c2 {
++ renesas,groups = "i2c2";
++ renesas,function = "i2c2";
++ };
+ };
+
+ &extal_clk {
+@@ -349,10 +359,14 @@
+
+ &i2c1 {
+ status = "ok";
++ pinctrl-0 = <&i2c1_pins>;
++ pinctrl-names = "default";
+ };
+
+ &i2c2 {
+ status = "ok";
++ pinctrl-0 = <&i2c2_pins>;
++ pinctrl-names = "default";
+ };
+
+ &i2c3 {
+--
+2.1.2
+
diff --git a/patches.renesas/0881-ARM-shmobile-lager-Move-i2c-12-_pins-nodes-to-pfc-no.patch b/patches.renesas/0881-ARM-shmobile-lager-Move-i2c-12-_pins-nodes-to-pfc-no.patch
new file mode 100644
index 00000000000000..4c53b11bdcc2bb
--- /dev/null
+++ b/patches.renesas/0881-ARM-shmobile-lager-Move-i2c-12-_pins-nodes-to-pfc-no.patch
@@ -0,0 +1,61 @@
+From 58710ff548ad5c07b53bbfee0115d998c92adfb4 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Fri, 6 Jun 2014 16:11:00 +0900
+Subject: ARM: shmobile: lager: Move i2c[12]_pins nodes to pfc node
+
+Due to an error when resolving conflicts df40f256b18300e1 ("ARM: shmobile:
+lager: add i2c1, i2c2 pins") added the i2c[12]_pins nodes to the wrong
+node.
+
+This patch moves them to their correct location in the pfc node.
+
+Cc: Ben Dooks <ben.dooks@codethink.co.uk>
+Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit d90bf60ceaf453b59c8cd5dbfa59538e27255706)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index c72372484548..85a5107c9396 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -144,16 +144,6 @@
+ states = <3300000 1
+ 1800000 0>;
+ };
+-
+- i2c1_pins: i2c1 {
+- renesas,groups = "i2c1";
+- renesas,function = "i2c1";
+- };
+-
+- i2c2_pins: i2c2 {
+- renesas,groups = "i2c2";
+- renesas,function = "i2c2";
+- };
+ };
+
+ &extal_clk {
+@@ -215,6 +205,16 @@
+ renesas,function = "msiof1";
+ };
+
++ i2c1_pins: i2c1 {
++ renesas,groups = "i2c1";
++ renesas,function = "i2c1";
++ };
++
++ i2c2_pins: i2c2 {
++ renesas,groups = "i2c2";
++ renesas,function = "i2c2";
++ };
++
+ i2c3_pins: i2c3 {
+ renesas,groups = "i2c3";
+ renesas,function = "i2c3";
+--
+2.1.2
+
diff --git a/patches.renesas/0882-ARM-shmobile-Lager-memory-map-update.patch b/patches.renesas/0882-ARM-shmobile-Lager-memory-map-update.patch
new file mode 100644
index 00000000000000..d2707f63ee95bc
--- /dev/null
+++ b/patches.renesas/0882-ARM-shmobile-Lager-memory-map-update.patch
@@ -0,0 +1,52 @@
+From ebb9dad7ea2f0b119c90116c96a40b2ee1dd37a2 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 15:40:26 +0900
+Subject: ARM: shmobile: Lager memory map update
+
+Update the Lager DTS to make use of the new unified legacy
+memory map where the legacy window on Lager and Koelsch
+have the same size.
+
+With this change in place the code gets aligned with the
+documentation.
+
+After update the Lager board has the following map:
+Bank0: 1GiB RAM (Legacy 32-bit: 0x40000000->0x7fffffff)
+Bank1: 3GiB RAM (LPAE area: 0x140000000->0x1ffffffff)
+
+Before the update the old map looked like this:
+Bank0: 2GiB RAM (Legacy 32-bit: 0x40000000->0xbfffffff)
+Bank1: 2GiB RAM (LPAE area: 0x180000000->0x1ffffffff)
+
+Tested with and without LPAE on r8a7790 Lager.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 7b16c61a86ce41edd5c42a87f22a0a146968b62f)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index 85a5107c9396..295a60e0c60e 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -29,12 +29,12 @@
+
+ memory@40000000 {
+ device_type = "memory";
+- reg = <0 0x40000000 0 0x80000000>;
++ reg = <0 0x40000000 0 0x40000000>;
+ };
+
+ memory@180000000 {
+ device_type = "memory";
+- reg = <1 0x80000000 0 0x80000000>;
++ reg = <1 0x40000000 0 0xc0000000>;
+ };
+
+ lbsc {
+--
+2.1.2
+
diff --git a/patches.renesas/0883-ARM-shmobile-lager-Remove-duplicate-i2c3-nodes.patch b/patches.renesas/0883-ARM-shmobile-lager-Remove-duplicate-i2c3-nodes.patch
new file mode 100644
index 00000000000000..7cdd2bcfbae8a0
--- /dev/null
+++ b/patches.renesas/0883-ARM-shmobile-lager-Remove-duplicate-i2c3-nodes.patch
@@ -0,0 +1,70 @@
+From dd5545b283f5e04f64057b3e4e470b8a524be73b Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 9 Jun 2014 11:09:44 +0900
+Subject: ARM: shmobile: lager: Remove duplicate i2c3 nodes
+
+Due to an error when merging df40f256b18300e1 ("ARM: shmobile:
+lager: add i2c1, i2c2 pins") a duplicate i2c3 node.
+
+This patch moves the duplicate and moves to old node to
+be closer to the other new i2c nodes.
+
+Cc: Ben Dooks <ben.dooks@codethink.co.uk>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit aca4ec446c646d8794fdbf617d187423a227305d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 32 ++++++++++++++------------------
+ 1 file changed, 14 insertions(+), 18 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index 295a60e0c60e..850dff8aedb9 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -333,22 +333,6 @@
+ status = "okay";
+ };
+
+-&i2c3 {
+- pinctrl-names = "default";
+- pinctrl-0 = <&i2c3_pins>;
+- status = "okay";
+-
+- vdd_dvfs: regulator@68 {
+- compatible = "diasemi,da9210";
+- reg = <0x68>;
+-
+- regulator-min-microvolt = <1000000>;
+- regulator-max-microvolt = <1000000>;
+- regulator-boot-on;
+- regulator-always-on;
+- };
+-};
+-
+ &cpu0 {
+ cpu0-supply = <&vdd_dvfs>;
+ };
+@@ -369,6 +353,18 @@
+ pinctrl-names = "default";
+ };
+
+-&i2c3 {
+- status = "ok";
++&i2c3 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&i2c3_pins>;
++ status = "okay";
++
++ vdd_dvfs: regulator@68 {
++ compatible = "diasemi,da9210";
++ reg = <0x68>;
++
++ regulator-min-microvolt = <1000000>;
++ regulator-max-microvolt = <1000000>;
++ regulator-boot-on;
++ regulator-always-on;
++ };
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0884-ARM-shmobile-koelsch-Remove-duplicate-i2c6-nodes.patch b/patches.renesas/0884-ARM-shmobile-koelsch-Remove-duplicate-i2c6-nodes.patch
new file mode 100644
index 00000000000000..6c7a5cc4d4c840
--- /dev/null
+++ b/patches.renesas/0884-ARM-shmobile-koelsch-Remove-duplicate-i2c6-nodes.patch
@@ -0,0 +1,78 @@
+From 468f6529187cc6aebdfc765cae46988ce599434e Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 9 Jun 2014 17:50:28 +0900
+Subject: ARM: shmobile: koelsch: Remove duplicate i2c6 nodes
+
+A second i2c6 node was a added by
+05e234a187058ee ("ARM: shmobile: koelsch dts: Add VDD MPU regulator for
+DVFS"). Merge this into the existing node.
+
+Also shuffle i2c nodes so they are all together.
+
+Cc: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 897dfdbc14603d764637dea92696fef4fc66ea3e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-koelsch.dts | 34 +++++++++++++++-------------------
+ 1 file changed, 15 insertions(+), 19 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
+index b2e661613dda..b0cfbd48e299 100644
+--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
++++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
+@@ -215,25 +215,6 @@
+ clock-frequency = <20000000>;
+ };
+
+-&i2c2 {
+- pinctrl-0 = <&i2c2_pins>;
+- pinctrl-names = "default";
+-
+- status = "okay";
+- clock-frequency = <400000>;
+-
+- eeprom@50 {
+- compatible = "renesas,24c02";
+- reg = <0x50>;
+- pagesize = <16>;
+- };
+-};
+-
+-&i2c6 {
+- status = "okay";
+- clock-frequency = <100000>;
+-};
+-
+ &pfc {
+ pinctrl-0 = <&du_pins>;
+ pinctrl-names = "default";
+@@ -414,10 +395,25 @@
+ };
+ };
+
++&i2c2 {
++ pinctrl-0 = <&i2c2_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++ clock-frequency = <400000>;
++
++ eeprom@50 {
++ compatible = "renesas,24c02";
++ reg = <0x50>;
++ pagesize = <16>;
++ };
++};
++
+ &i2c6 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c6_pins>;
+ status = "okay";
++ clock-frequency = <100000>;
+
+ vdd_dvfs: regulator@68 {
+ compatible = "diasemi,da9210";
+--
+2.1.2
+
diff --git a/patches.renesas/0885-ARM-shmobile-henninger-add-I2C2-DT-support.patch b/patches.renesas/0885-ARM-shmobile-henninger-add-I2C2-DT-support.patch
new file mode 100644
index 00000000000000..d2a02d506e825f
--- /dev/null
+++ b/patches.renesas/0885-ARM-shmobile-henninger-add-I2C2-DT-support.patch
@@ -0,0 +1,51 @@
+From eda1d9af2bd8d1e4220be16b4605b96b03b0a06c Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Wed, 11 Jun 2014 02:45:21 +0400
+Subject: ARM: shmobile: henninger: add I2C2 DT support
+
+Define the Henninger board dependent part of the I2C2 device node.
+
+Based on the Koelsch I2C2 device tree patch by Wolfram Sang.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 29a647c396a054b087b124372ffb261f40ee9856)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-henninger.dts | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791-henninger.dts b/arch/arm/boot/dts/r8a7791-henninger.dts
+index cc6d992e8db2..c0c58ce7746e 100644
+--- a/arch/arm/boot/dts/r8a7791-henninger.dts
++++ b/arch/arm/boot/dts/r8a7791-henninger.dts
+@@ -110,6 +110,11 @@
+ renesas,function = "sdhi2";
+ };
+
++ i2c2_pins: i2c2 {
++ renesas,groups = "i2c2";
++ renesas,function = "i2c2";
++ };
++
+ qspi_pins: spi0 {
+ renesas,groups = "qspi_ctrl", "qspi_data4";
+ renesas,function = "qspi";
+@@ -170,6 +175,14 @@
+ status = "okay";
+ };
+
++&i2c2 {
++ pinctrl-0 = <&i2c2_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++ clock-frequency = <400000>;
++};
++
+ &qspi {
+ pinctrl-0 = <&qspi_pins>;
+ pinctrl-names = "default";
+--
+2.1.2
+
diff --git a/patches.renesas/0886-ARM-shmobile-r8a7790-add-MSTP10-support-on-DTSI.patch b/patches.renesas/0886-ARM-shmobile-r8a7790-add-MSTP10-support-on-DTSI.patch
new file mode 100644
index 00000000000000..78f5b79af8336a
--- /dev/null
+++ b/patches.renesas/0886-ARM-shmobile-r8a7790-add-MSTP10-support-on-DTSI.patch
@@ -0,0 +1,97 @@
+From 8141a04d1e78325976cd0e110f767df1020a74ad Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 10 Jun 2014 23:53:27 -0700
+Subject: ARM: shmobile: r8a7790: add MSTP10 support on DTSI
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit bcde37225438687231bb9510c07e60dcb8db1988)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790.dtsi | 33 +++++++++++++++++++++++++++++++
+ include/dt-bindings/clock/r8a7790-clock.h | 26 ++++++++++++++++++++++++
+ 2 files changed, 59 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index e990d3c4fe62..0f83bd778a3d 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -835,6 +835,39 @@
+ "rcan1", "rcan0", "qspi_mod", "iic3",
+ "i2c3", "i2c2", "i2c1", "i2c0";
+ };
++ mstp10_clks: mstp10_clks@e6150998 {
++ compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
++ reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>;
++ clocks = <&p_clk>,
++ <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
++ <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
++ <&p_clk>,
++ <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7790_CLK_SCU_ALL>, <&mstp10_clks R8A7790_CLK_SCU_ALL>;
++
++ #clock-cells = <1>;
++ clock-indices = <
++ R8A7790_CLK_SSI_ALL
++ R8A7790_CLK_SSI9 R8A7790_CLK_SSI8 R8A7790_CLK_SSI7 R8A7790_CLK_SSI6 R8A7790_CLK_SSI5
++ R8A7790_CLK_SSI4 R8A7790_CLK_SSI3 R8A7790_CLK_SSI2 R8A7790_CLK_SSI1 R8A7790_CLK_SSI0
++ R8A7790_CLK_SCU_ALL
++ R8A7790_CLK_SCU_DVC1 R8A7790_CLK_SCU_DVC0
++ R8A7790_CLK_SCU_SRC9 R8A7790_CLK_SCU_SRC8 R8A7790_CLK_SCU_SRC7 R8A7790_CLK_SCU_SRC6 R8A7790_CLK_SCU_SRC5
++ R8A7790_CLK_SCU_SRC4 R8A7790_CLK_SCU_SRC3 R8A7790_CLK_SCU_SRC2 R8A7790_CLK_SCU_SRC1 R8A7790_CLK_SCU_SRC0
++ >;
++ clock-output-names =
++ "ssi-all",
++ "ssi9", "ssi8", "ssi7", "ssi6", "ssi5",
++ "ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
++ "scu-all",
++ "scu-dvc1", "scu-dvc0",
++ "scu-src9", "scu-src8", "scu-src7", "scu-src6", "scu-src5",
++ "scu-src4", "scu-src3", "scu-src2", "scu-src1", "scu-src0";
++ };
+ };
+
+ qspi: spi@e6b10000 {
+diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
+index 1118f7a4bca6..a16df68ac97d 100644
+--- a/include/dt-bindings/clock/r8a7790-clock.h
++++ b/include/dt-bindings/clock/r8a7790-clock.h
+@@ -107,4 +107,30 @@
+ #define R8A7790_CLK_I2C1 30
+ #define R8A7790_CLK_I2C0 31
+
++/* MSTP10 */
++#define R8A7790_CLK_SSI_ALL 5
++#define R8A7790_CLK_SSI9 6
++#define R8A7790_CLK_SSI8 7
++#define R8A7790_CLK_SSI7 8
++#define R8A7790_CLK_SSI6 9
++#define R8A7790_CLK_SSI5 10
++#define R8A7790_CLK_SSI4 11
++#define R8A7790_CLK_SSI3 12
++#define R8A7790_CLK_SSI2 13
++#define R8A7790_CLK_SSI1 14
++#define R8A7790_CLK_SSI0 15
++#define R8A7790_CLK_SCU_ALL 17
++#define R8A7790_CLK_SCU_DVC1 18
++#define R8A7790_CLK_SCU_DVC0 19
++#define R8A7790_CLK_SCU_SRC9 22
++#define R8A7790_CLK_SCU_SRC8 23
++#define R8A7790_CLK_SCU_SRC7 24
++#define R8A7790_CLK_SCU_SRC6 25
++#define R8A7790_CLK_SCU_SRC5 26
++#define R8A7790_CLK_SCU_SRC4 27
++#define R8A7790_CLK_SCU_SRC3 28
++#define R8A7790_CLK_SCU_SRC2 29
++#define R8A7790_CLK_SCU_SRC1 30
++#define R8A7790_CLK_SCU_SRC0 31
++
+ #endif /* __DT_BINDINGS_CLOCK_R8A7790_H__ */
+--
+2.1.2
+
diff --git a/patches.renesas/0887-ARM-shmobile-r8a7790-add-R-Car-sound-support-on-DTSI.patch b/patches.renesas/0887-ARM-shmobile-r8a7790-add-R-Car-sound-support-on-DTSI.patch
new file mode 100644
index 00000000000000..8e5feccf503056
--- /dev/null
+++ b/patches.renesas/0887-ARM-shmobile-r8a7790-add-R-Car-sound-support-on-DTSI.patch
@@ -0,0 +1,83 @@
+From 88e60285385948593de549a38c33d5cc0553d9e8 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 10 Jun 2014 23:53:54 -0700
+Subject: ARM: shmobile: r8a7790: add R-Car sound support on DTSI
+
+This patch support PIO transfer only at this point
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 7df2fd572b9f159657a145f3fdd700d3e00760d9)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790.dtsi | 56 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 56 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index 0f83bd778a3d..29907c9d8e5b 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -920,4 +920,60 @@
+ #size-cells = <0>;
+ status = "disabled";
+ };
++
++ rcar_sound: rcar_sound@0xec500000 {
++ #sound-dai-cells = <1>;
++ compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
++ interrupt-parent = <&gic>;
++ reg = <0 0xec500000 0 0x1000>, /* SCU */
++ <0 0xec5a0000 0 0x100>, /* ADG */
++ <0 0xec540000 0 0x1000>, /* SSIU */
++ <0 0xec541000 0 0x1280>; /* SSI */
++ clocks = <&mstp10_clks R8A7790_CLK_SSI_ALL>,
++ <&mstp10_clks R8A7790_CLK_SSI9>, <&mstp10_clks R8A7790_CLK_SSI8>,
++ <&mstp10_clks R8A7790_CLK_SSI7>, <&mstp10_clks R8A7790_CLK_SSI6>,
++ <&mstp10_clks R8A7790_CLK_SSI5>, <&mstp10_clks R8A7790_CLK_SSI4>,
++ <&mstp10_clks R8A7790_CLK_SSI3>, <&mstp10_clks R8A7790_CLK_SSI2>,
++ <&mstp10_clks R8A7790_CLK_SSI1>, <&mstp10_clks R8A7790_CLK_SSI0>,
++ <&mstp10_clks R8A7790_CLK_SCU_SRC9>, <&mstp10_clks R8A7790_CLK_SCU_SRC8>,
++ <&mstp10_clks R8A7790_CLK_SCU_SRC7>, <&mstp10_clks R8A7790_CLK_SCU_SRC6>,
++ <&mstp10_clks R8A7790_CLK_SCU_SRC5>, <&mstp10_clks R8A7790_CLK_SCU_SRC4>,
++ <&mstp10_clks R8A7790_CLK_SCU_SRC3>, <&mstp10_clks R8A7790_CLK_SCU_SRC2>,
++ <&mstp10_clks R8A7790_CLK_SCU_SRC1>, <&mstp10_clks R8A7790_CLK_SCU_SRC0>,
++ <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
++ clock-names = "ssi-all",
++ "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
++ "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
++ "src.9", "src.8", "src.7", "src.6", "src.5",
++ "src.4", "src.3", "src.2", "src.1", "src.0",
++ "clk_a", "clk_b", "clk_c", "clk_i";
++
++ status = "disabled";
++
++ rcar_sound,src {
++ src0: src@0 { };
++ src1: src@1 { };
++ src2: src@2 { };
++ src3: src@3 { };
++ src4: src@4 { };
++ src5: src@5 { };
++ src6: src@6 { };
++ src7: src@7 { };
++ src8: src@8 { };
++ src9: src@9 { };
++ };
++
++ rcar_sound,ssi {
++ ssi0: ssi@0 { interrupts = <0 370 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi1: ssi@1 { interrupts = <0 371 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi2: ssi@2 { interrupts = <0 372 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi3: ssi@3 { interrupts = <0 373 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi4: ssi@4 { interrupts = <0 374 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi5: ssi@5 { interrupts = <0 375 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi6: ssi@6 { interrupts = <0 376 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi7: ssi@7 { interrupts = <0 377 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi8: ssi@8 { interrupts = <0 378 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi9: ssi@9 { interrupts = <0 379 IRQ_TYPE_LEVEL_HIGH>; };
++ };
++ };
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0888-ARM-shmobile-r8a7791-add-audio-clock-on-DTSI.patch b/patches.renesas/0888-ARM-shmobile-r8a7791-add-audio-clock-on-DTSI.patch
new file mode 100644
index 00000000000000..18a612368739cf
--- /dev/null
+++ b/patches.renesas/0888-ARM-shmobile-r8a7791-add-audio-clock-on-DTSI.patch
@@ -0,0 +1,52 @@
+From dd634c7f4d345e737f0706500fde1bcb699159b5 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 11 Jun 2014 21:44:04 -0700
+Subject: ARM: shmobile: r8a7791: add audio clock on DTSI
+
+audio_clk_a/b/c are required from sound driver
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 0d3dbde84a45977cdd7d85115cd5ea1b4ede312e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 76150f1a82db..37a4ea7a1b06 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -532,6 +532,29 @@
+ clock-output-names = "extal";
+ };
+
++ /*
++ * The external audio clocks are configured as 0 Hz fixed frequency clocks by
++ * default. Boards that provide audio clocks should override them.
++ */
++ audio_clk_a: audio_clk_a {
++ compatible = "fixed-clock";
++ #clock-cells = <0>;
++ clock-frequency = <0>;
++ clock-output-names = "audio_clk_a";
++ };
++ audio_clk_b: audio_clk_b {
++ compatible = "fixed-clock";
++ #clock-cells = <0>;
++ clock-frequency = <0>;
++ clock-output-names = "audio_clk_b";
++ };
++ audio_clk_c: audio_clk_c {
++ compatible = "fixed-clock";
++ #clock-cells = <0>;
++ clock-frequency = <0>;
++ clock-output-names = "audio_clk_c";
++ };
++
+ /* Special CPG clocks */
+ cpg_clocks: cpg_clocks@e6150000 {
+ compatible = "renesas,r8a7791-cpg-clocks",
+--
+2.1.2
+
diff --git a/patches.renesas/0889-ARM-shmobile-r8a7791-add-MSTP10-support-on-DTSI.patch b/patches.renesas/0889-ARM-shmobile-r8a7791-add-MSTP10-support-on-DTSI.patch
new file mode 100644
index 00000000000000..50ba8077453928
--- /dev/null
+++ b/patches.renesas/0889-ARM-shmobile-r8a7791-add-MSTP10-support-on-DTSI.patch
@@ -0,0 +1,99 @@
+From 4cc85e3f308373e235c347257dc1fa10da031e65 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 11 Jun 2014 21:44:16 -0700
+Subject: ARM: shmobile: r8a7791: add MSTP10 support on DTSI
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ee9141522dcf13f861ed3cef6490c6cbfaafefb9)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 33 +++++++++++++++++++++++++++++++
+ include/dt-bindings/clock/r8a7791-clock.h | 26 ++++++++++++++++++++++++
+ 2 files changed, 59 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 37a4ea7a1b06..93b10cbdead8 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -865,6 +865,39 @@
+ "rcan1", "rcan0", "qspi_mod", "i2c5", "i2c6", "i2c4", "i2c3", "i2c2",
+ "i2c1", "i2c0";
+ };
++ mstp10_clks: mstp10_clks@e6150998 {
++ compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
++ reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>;
++ clocks = <&p_clk>,
++ <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
++ <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
++ <&p_clk>,
++ <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>,
++ <&mstp10_clks R8A7791_CLK_SCU_ALL>, <&mstp10_clks R8A7791_CLK_SCU_ALL>;
++
++ #clock-cells = <1>;
++ clock-indices = <
++ R8A7791_CLK_SSI_ALL
++ R8A7791_CLK_SSI9 R8A7791_CLK_SSI8 R8A7791_CLK_SSI7 R8A7791_CLK_SSI6 R8A7791_CLK_SSI5
++ R8A7791_CLK_SSI4 R8A7791_CLK_SSI3 R8A7791_CLK_SSI2 R8A7791_CLK_SSI1 R8A7791_CLK_SSI0
++ R8A7791_CLK_SCU_ALL
++ R8A7791_CLK_SCU_DVC1 R8A7791_CLK_SCU_DVC0
++ R8A7791_CLK_SCU_SRC9 R8A7791_CLK_SCU_SRC8 R8A7791_CLK_SCU_SRC7 R8A7791_CLK_SCU_SRC6 R8A7791_CLK_SCU_SRC5
++ R8A7791_CLK_SCU_SRC4 R8A7791_CLK_SCU_SRC3 R8A7791_CLK_SCU_SRC2 R8A7791_CLK_SCU_SRC1 R8A7791_CLK_SCU_SRC0
++ >;
++ clock-output-names =
++ "ssi-all",
++ "ssi9", "ssi8", "ssi7", "ssi6", "ssi5",
++ "ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
++ "scu-all",
++ "scu-dvc1", "scu-dvc0",
++ "scu-src9", "scu-src8", "scu-src7", "scu-src6", "scu-src5",
++ "scu-src4", "scu-src3", "scu-src2", "scu-src1", "scu-src0";
++ };
+ mstp11_clks: mstp11_clks@e615099c {
+ compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+ reg = <0 0xe615099c 0 4>, <0 0xe61509ac 0 4>;
+diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
+index b050d18437ce..0410bea2ad1d 100644
+--- a/include/dt-bindings/clock/r8a7791-clock.h
++++ b/include/dt-bindings/clock/r8a7791-clock.h
+@@ -107,6 +107,32 @@
+ #define R8A7791_CLK_I2C1 30
+ #define R8A7791_CLK_I2C0 31
+
++/* MSTP10 */
++#define R8A7791_CLK_SSI_ALL 5
++#define R8A7791_CLK_SSI9 6
++#define R8A7791_CLK_SSI8 7
++#define R8A7791_CLK_SSI7 8
++#define R8A7791_CLK_SSI6 9
++#define R8A7791_CLK_SSI5 10
++#define R8A7791_CLK_SSI4 11
++#define R8A7791_CLK_SSI3 12
++#define R8A7791_CLK_SSI2 13
++#define R8A7791_CLK_SSI1 14
++#define R8A7791_CLK_SSI0 15
++#define R8A7791_CLK_SCU_ALL 17
++#define R8A7791_CLK_SCU_DVC1 18
++#define R8A7791_CLK_SCU_DVC0 19
++#define R8A7791_CLK_SCU_SRC9 22
++#define R8A7791_CLK_SCU_SRC8 23
++#define R8A7791_CLK_SCU_SRC7 24
++#define R8A7791_CLK_SCU_SRC6 25
++#define R8A7791_CLK_SCU_SRC5 26
++#define R8A7791_CLK_SCU_SRC4 27
++#define R8A7791_CLK_SCU_SRC3 28
++#define R8A7791_CLK_SCU_SRC2 29
++#define R8A7791_CLK_SCU_SRC1 30
++#define R8A7791_CLK_SCU_SRC0 31
++
+ /* MSTP11 */
+ #define R8A7791_CLK_SCIFA3 6
+ #define R8A7791_CLK_SCIFA4 7
+--
+2.1.2
+
diff --git a/patches.renesas/0890-ARM-shmobile-r8a7790-Add-PCIEC-clock-device-tree-nod.patch b/patches.renesas/0890-ARM-shmobile-r8a7790-Add-PCIEC-clock-device-tree-nod.patch
new file mode 100644
index 00000000000000..08db5b2a23cdf9
--- /dev/null
+++ b/patches.renesas/0890-ARM-shmobile-r8a7790-Add-PCIEC-clock-device-tree-nod.patch
@@ -0,0 +1,57 @@
+From 3dcc6bf490d9fcd9c8aa5aa3401bd55c0c4c7f4d Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Fri, 13 Jun 2014 10:37:15 +0100
+Subject: ARM: shmobile: r8a7790: Add PCIEC clock device tree node
+
+This patch adds the device tree clock node for the PCIe Controller
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ecafea8cd261833d7bb857aad76cf2e721821e88)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790.dtsi | 6 +++---
+ include/dt-bindings/clock/r8a7790-clock.h | 1 +
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index 29907c9d8e5b..9df57122e9c0 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -765,17 +765,17 @@
+ reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
+ clocks = <&hp_clk>, <&cp_clk>, <&mmc1_clk>, <&sd3_clk>,
+ <&sd2_clk>, <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>, <&mmc0_clk>,
+- <&hp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>;
++ <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>;
+ #clock-cells = <1>;
+ renesas,clock-indices = <
+ R8A7790_CLK_IIC2 R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
+ R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0 R8A7790_CLK_MMCIF0
+- R8A7790_CLK_IIC0 R8A7790_CLK_IIC1 R8A7790_CLK_SSUSB R8A7790_CLK_CMT1
++ R8A7790_CLK_IIC0 R8A7790_CLK_PCIEC R8A7790_CLK_IIC1 R8A7790_CLK_SSUSB R8A7790_CLK_CMT1
+ >;
+ clock-output-names =
+ "iic2", "tpu0", "mmcif1", "sdhi3",
+ "sdhi2", "sdhi1", "sdhi0", "mmcif0",
+- "iic0", "iic1", "ssusb", "cmt1";
++ "iic0", "pciec", "iic1", "ssusb", "cmt1";
+ };
+ mstp5_clks: mstp5_clks@e6150144 {
+ compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
+index a16df68ac97d..f929a79e6998 100644
+--- a/include/dt-bindings/clock/r8a7790-clock.h
++++ b/include/dt-bindings/clock/r8a7790-clock.h
+@@ -59,6 +59,7 @@
+ #define R8A7790_CLK_SDHI0 14
+ #define R8A7790_CLK_MMCIF0 15
+ #define R8A7790_CLK_IIC0 18
++#define R8A7790_CLK_PCIEC 19
+ #define R8A7790_CLK_IIC1 23
+ #define R8A7790_CLK_SSUSB 28
+ #define R8A7790_CLK_CMT1 29
+--
+2.1.2
+
diff --git a/patches.renesas/0891-ARM-shmobile-r8a7790-Add-default-PCIe-bus-clock.patch b/patches.renesas/0891-ARM-shmobile-r8a7790-Add-default-PCIe-bus-clock.patch
new file mode 100644
index 00000000000000..ab13c534e05b4c
--- /dev/null
+++ b/patches.renesas/0891-ARM-shmobile-r8a7790-Add-default-PCIe-bus-clock.patch
@@ -0,0 +1,39 @@
+From cf7cda3b85cb2f6af13bc4160e2a4e2bb45640f4 Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Fri, 13 Jun 2014 10:37:16 +0100
+Subject: ARM: shmobile: r8a7790: Add default PCIe bus clock
+
+This patch adds a default PCIe bus clock node.
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 51d17918077215cd93d78a2b13a3b57090eb1f3d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790.dtsi | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index 9df57122e9c0..2c55c4b8295f 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -487,6 +487,15 @@
+ clock-output-names = "extal";
+ };
+
++ /* External PCIe clock - can be overridden by the board */
++ pcie_bus_clk: pcie_bus_clk {
++ compatible = "fixed-clock";
++ #clock-cells = <0>;
++ clock-frequency = <100000000>;
++ clock-output-names = "pcie_bus";
++ status = "disabled";
++ };
++
+ /*
+ * The external audio clocks are configured as 0 Hz fixed frequency clocks by
+ * default. Boards that provide audio clocks should override them.
+--
+2.1.2
+
diff --git a/patches.renesas/0892-ARM-shmobile-r8a7790-Add-PCIe-Controller-device-node.patch b/patches.renesas/0892-ARM-shmobile-r8a7790-Add-PCIe-Controller-device-node.patch
new file mode 100644
index 00000000000000..69e873856f5ef1
--- /dev/null
+++ b/patches.renesas/0892-ARM-shmobile-r8a7790-Add-PCIe-Controller-device-node.patch
@@ -0,0 +1,54 @@
+From 5f2821871db515f4020e78493244f8ffd13c22fe Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Fri, 13 Jun 2014 10:37:17 +0100
+Subject: ARM: shmobile: r8a7790: Add PCIe Controller device node
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+[horms+renesas@verge.net.au: resolved conflict]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 745329d280c8c73f00724745693658f3d4113ea8)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790.dtsi | 25 +++++++++++++++++++++++++
+ 1 file changed, 25 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index 2c55c4b8295f..994330e81a52 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -930,6 +930,31 @@
+ status = "disabled";
+ };
+
++ pciec: pcie@fe000000 {
++ compatible = "renesas,pcie-r8a7790";
++ reg = <0 0xfe000000 0 0x80000>;
++ #address-cells = <3>;
++ #size-cells = <2>;
++ bus-range = <0x00 0xff>;
++ device_type = "pci";
++ ranges = <0x01000000 0 0x00000000 0 0xfe100000 0 0x00100000
++ 0x02000000 0 0xfe200000 0 0xfe200000 0 0x00200000
++ 0x02000000 0 0x30000000 0 0x30000000 0 0x08000000
++ 0x42000000 0 0x38000000 0 0x38000000 0 0x08000000>;
++ /* Map all possible DDR as inbound ranges */
++ dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0 0x80000000
++ 0x43000000 1 0x80000000 1 0x80000000 0 0x80000000>;
++ interrupts = <0 116 IRQ_TYPE_LEVEL_HIGH>,
++ <0 117 IRQ_TYPE_LEVEL_HIGH>,
++ <0 118 IRQ_TYPE_LEVEL_HIGH>;
++ #interrupt-cells = <1>;
++ interrupt-map-mask = <0 0 0 0>;
++ interrupt-map = <0 0 0 0 &gic 0 116 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp3_clks R8A7790_CLK_PCIEC>, <&pcie_bus_clk>;
++ clock-names = "pcie", "pcie_bus";
++ status = "disabled";
++ };
++
+ rcar_sound: rcar_sound@0xec500000 {
+ #sound-dai-cells = <1>;
+ compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
+--
+2.1.2
+
diff --git a/patches.renesas/0893-ARM-shmobile-r8a7791-Add-PCIEC-clock-device-tree-nod.patch b/patches.renesas/0893-ARM-shmobile-r8a7791-Add-PCIEC-clock-device-tree-nod.patch
new file mode 100644
index 00000000000000..323fb41a71a524
--- /dev/null
+++ b/patches.renesas/0893-ARM-shmobile-r8a7791-Add-PCIEC-clock-device-tree-nod.patch
@@ -0,0 +1,56 @@
+From 99ddf2f0841dbdbdbf835b98574c82bfede4bfaa Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Fri, 13 Jun 2014 10:37:18 +0100
+Subject: ARM: shmobile: r8a7791: Add PCIEC clock device tree node
+
+This patch adds the device tree clock node for the PCIe Controller
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 4bfb37675b5343798f5260adad92a67444a9fd47)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 7 ++++---
+ include/dt-bindings/clock/r8a7791-clock.h | 1 +
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 93b10cbdead8..d1b8c4740c72 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -795,15 +795,16 @@
+ compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+ reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
+ clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>, <&cpg_clocks R8A7791_CLK_SD0>,
+- <&mmc0_clk>, <&hp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>;
++ <&mmc0_clk>, <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>;
+ #clock-cells = <1>;
+ renesas,clock-indices = <
+ R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1 R8A7791_CLK_SDHI0
+- R8A7791_CLK_MMCIF0 R8A7791_CLK_IIC0 R8A7791_CLK_IIC1 R8A7791_CLK_SSUSB R8A7791_CLK_CMT1
++ R8A7791_CLK_MMCIF0 R8A7791_CLK_IIC0 R8A7791_CLK_PCIEC R8A7791_CLK_IIC1
++ R8A7791_CLK_SSUSB R8A7791_CLK_CMT1
+ >;
+ clock-output-names =
+ "tpu0", "sdhi2", "sdhi1", "sdhi0",
+- "mmcif0", "i2c7", "i2c8", "ssusb", "cmt1";
++ "mmcif0", "i2c7", "pciec", "i2c8", "ssusb", "cmt1";
+ };
+ mstp5_clks: mstp5_clks@e6150144 {
+ compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
+diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
+index 0410bea2ad1d..f0d4d1049162 100644
+--- a/include/dt-bindings/clock/r8a7791-clock.h
++++ b/include/dt-bindings/clock/r8a7791-clock.h
+@@ -53,6 +53,7 @@
+ #define R8A7791_CLK_SDHI0 14
+ #define R8A7791_CLK_MMCIF0 15
+ #define R8A7791_CLK_IIC0 18
++#define R8A7791_CLK_PCIEC 19
+ #define R8A7791_CLK_IIC1 23
+ #define R8A7791_CLK_SSUSB 28
+ #define R8A7791_CLK_CMT1 29
+--
+2.1.2
+
diff --git a/patches.renesas/0894-ARM-shmobile-r8a7791-Add-default-PCIe-bus-clock.patch b/patches.renesas/0894-ARM-shmobile-r8a7791-Add-default-PCIe-bus-clock.patch
new file mode 100644
index 00000000000000..b04184728f6897
--- /dev/null
+++ b/patches.renesas/0894-ARM-shmobile-r8a7791-Add-default-PCIe-bus-clock.patch
@@ -0,0 +1,41 @@
+From b3afe4f781baae681f4d520203cb80f2bd579177 Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Fri, 13 Jun 2014 10:37:19 +0100
+Subject: ARM: shmobile: r8a7791: Add default PCIe bus clock
+
+This patch adds a default PCIe bus clock node.
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+[horms+renesas@verge.net.au: resolved conflict]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 66c405e72bf332e59ab29461e33a4e94cb8bdd7a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index d1b8c4740c72..7c676b9786e1 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -555,6 +555,15 @@
+ clock-output-names = "audio_clk_c";
+ };
+
++ /* External PCIe clock - can be overridden by the board */
++ pcie_bus_clk: pcie_bus_clk {
++ compatible = "fixed-clock";
++ #clock-cells = <0>;
++ clock-frequency = <100000000>;
++ clock-output-names = "pcie_bus";
++ status = "disabled";
++ };
++
+ /* Special CPG clocks */
+ cpg_clocks: cpg_clocks@e6150000 {
+ compatible = "renesas,r8a7791-cpg-clocks",
+--
+2.1.2
+
diff --git a/patches.renesas/0895-ARM-shmobile-r8a7791-Add-PCIe-Controller-device-node.patch b/patches.renesas/0895-ARM-shmobile-r8a7791-Add-PCIe-Controller-device-node.patch
new file mode 100644
index 00000000000000..318cfab22c80de
--- /dev/null
+++ b/patches.renesas/0895-ARM-shmobile-r8a7791-Add-PCIe-Controller-device-node.patch
@@ -0,0 +1,50 @@
+From 542c36a7b373d235a60c6394d307eb3364283959 Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Fri, 13 Jun 2014 10:37:20 +0100
+Subject: ARM: shmobile: r8a7791: Add PCIe Controller device node
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 811cdfae502137a21b91326ed6912a94d3dc7723)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 25 +++++++++++++++++++++++++
+ 1 file changed, 25 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 7c676b9786e1..ddaebf346525 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -960,4 +960,29 @@
+ #size-cells = <0>;
+ status = "disabled";
+ };
++
++ pciec: pcie@fe000000 {
++ compatible = "renesas,pcie-r8a7791";
++ reg = <0 0xfe000000 0 0x80000>;
++ #address-cells = <3>;
++ #size-cells = <2>;
++ bus-range = <0x00 0xff>;
++ device_type = "pci";
++ ranges = <0x01000000 0 0x00000000 0 0xfe100000 0 0x00100000
++ 0x02000000 0 0xfe200000 0 0xfe200000 0 0x00200000
++ 0x02000000 0 0x30000000 0 0x30000000 0 0x08000000
++ 0x42000000 0 0x38000000 0 0x38000000 0 0x08000000>;
++ /* Map all possible DDR as inbound ranges */
++ dma-ranges = <0x42000000 0 0x40000000 0 0x40000000 0 0x80000000
++ 0x43000000 2 0x00000000 2 0x00000000 1 0x00000000>;
++ interrupts = <0 116 IRQ_TYPE_LEVEL_HIGH>,
++ <0 117 IRQ_TYPE_LEVEL_HIGH>,
++ <0 118 IRQ_TYPE_LEVEL_HIGH>;
++ #interrupt-cells = <1>;
++ interrupt-map-mask = <0 0 0 0>;
++ interrupt-map = <0 0 0 0 &gic 0 116 IRQ_TYPE_LEVEL_HIGH>;
++ clocks = <&mstp3_clks R8A7791_CLK_PCIEC>, <&pcie_bus_clk>;
++ clock-names = "pcie", "pcie_bus";
++ status = "disabled";
++ };
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0896-ARM-shmobile-koelsch-Enable-PCIe-Controller-PCIe-bus.patch b/patches.renesas/0896-ARM-shmobile-koelsch-Enable-PCIe-Controller-PCIe-bus.patch
new file mode 100644
index 00000000000000..a88ff6be0510d6
--- /dev/null
+++ b/patches.renesas/0896-ARM-shmobile-koelsch-Enable-PCIe-Controller-PCIe-bus.patch
@@ -0,0 +1,35 @@
+From fec1a1b1d0f74f842b568f72bc939aab31428197 Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Fri, 13 Jun 2014 10:37:21 +0100
+Subject: ARM: shmobile: koelsch: Enable PCIe Controller & PCIe bus clock
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 998d7d64e1aeede4e03b6c67adb78fe55a278db7)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-koelsch.dts | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
+index b0cfbd48e299..5dac67395525 100644
+--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
++++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
+@@ -426,6 +426,14 @@
+ };
+ };
+
++&pcie_bus_clk {
++ status = "okay";
++};
++
++&pciec {
++ status = "okay";
++};
++
+ &cpu0 {
+ cpu0-supply = <&vdd_dvfs>;
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0897-ARM-shmobile-henninger-Enable-PCIe-Controller-PCIe-b.patch b/patches.renesas/0897-ARM-shmobile-henninger-Enable-PCIe-Controller-PCIe-b.patch
new file mode 100644
index 00000000000000..cedf4cffc5489e
--- /dev/null
+++ b/patches.renesas/0897-ARM-shmobile-henninger-Enable-PCIe-Controller-PCIe-b.patch
@@ -0,0 +1,32 @@
+From 2f214d8426321f32cfefb54687d0acbca711c554 Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Fri, 13 Jun 2014 10:37:22 +0100
+Subject: ARM: shmobile: henninger: Enable PCIe Controller & PCIe bus clock
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 485f3ce67c11ce086c322b2622db01d7e7c59a84)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-henninger.dts | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791-henninger.dts b/arch/arm/boot/dts/r8a7791-henninger.dts
+index c0c58ce7746e..bc48bccfff54 100644
+--- a/arch/arm/boot/dts/r8a7791-henninger.dts
++++ b/arch/arm/boot/dts/r8a7791-henninger.dts
+@@ -230,3 +230,11 @@
+ spi-cpha;
+ };
+ };
++
++&pcie_bus_clk {
++ status = "okay";
++};
++
++&pciec {
++ status = "okay";
++};
+--
+2.1.2
+
diff --git a/patches.renesas/0898-ARM-shmobile-r8a7791-add-R-Car-sound-support-on-DTSI.patch b/patches.renesas/0898-ARM-shmobile-r8a7791-add-R-Car-sound-support-on-DTSI.patch
new file mode 100644
index 00000000000000..f3d4303a2902ae
--- /dev/null
+++ b/patches.renesas/0898-ARM-shmobile-r8a7791-add-R-Car-sound-support-on-DTSI.patch
@@ -0,0 +1,83 @@
+From e3be437a9703c9ecd2132ed8abb56cd84f53d585 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 11 Jun 2014 21:44:26 -0700
+Subject: ARM: shmobile: r8a7791: add R-Car sound support on DTSI
+
+This patch support PIO transfer only at this point
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 09abd1fd11f98d6abde9c23244234170e7e36c2f)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 56 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 56 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index ddaebf346525..40bff5aaf986 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -985,4 +985,60 @@
+ clock-names = "pcie", "pcie_bus";
+ status = "disabled";
+ };
++
++ rcar_sound: rcar_sound@0xec500000 {
++ #sound-dai-cells = <1>;
++ compatible = "renesas,rcar_sound-r8a7791", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
++ interrupt-parent = <&gic>;
++ reg = <0 0xec500000 0 0x1000>, /* SCU */
++ <0 0xec5a0000 0 0x100>, /* ADG */
++ <0 0xec540000 0 0x1000>, /* SSIU */
++ <0 0xec541000 0 0x1280>; /* SSI */
++ clocks = <&mstp10_clks R8A7791_CLK_SSI_ALL>,
++ <&mstp10_clks R8A7791_CLK_SSI9>, <&mstp10_clks R8A7791_CLK_SSI8>,
++ <&mstp10_clks R8A7791_CLK_SSI7>, <&mstp10_clks R8A7791_CLK_SSI6>,
++ <&mstp10_clks R8A7791_CLK_SSI5>, <&mstp10_clks R8A7791_CLK_SSI4>,
++ <&mstp10_clks R8A7791_CLK_SSI3>, <&mstp10_clks R8A7791_CLK_SSI2>,
++ <&mstp10_clks R8A7791_CLK_SSI1>, <&mstp10_clks R8A7791_CLK_SSI0>,
++ <&mstp10_clks R8A7791_CLK_SCU_SRC9>, <&mstp10_clks R8A7791_CLK_SCU_SRC8>,
++ <&mstp10_clks R8A7791_CLK_SCU_SRC7>, <&mstp10_clks R8A7791_CLK_SCU_SRC6>,
++ <&mstp10_clks R8A7791_CLK_SCU_SRC5>, <&mstp10_clks R8A7791_CLK_SCU_SRC4>,
++ <&mstp10_clks R8A7791_CLK_SCU_SRC3>, <&mstp10_clks R8A7791_CLK_SCU_SRC2>,
++ <&mstp10_clks R8A7791_CLK_SCU_SRC1>, <&mstp10_clks R8A7791_CLK_SCU_SRC0>,
++ <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
++ clock-names = "ssi-all",
++ "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
++ "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
++ "src.9", "src.8", "src.7", "src.6", "src.5",
++ "src.4", "src.3", "src.2", "src.1", "src.0",
++ "clk_a", "clk_b", "clk_c", "clk_i";
++
++ status = "disabled";
++
++ rcar_sound,src {
++ src0: src@0 { };
++ src1: src@1 { };
++ src2: src@2 { };
++ src3: src@3 { };
++ src4: src@4 { };
++ src5: src@5 { };
++ src6: src@6 { };
++ src7: src@7 { };
++ src8: src@8 { };
++ src9: src@9 { };
++ };
++
++ rcar_sound,ssi {
++ ssi0: ssi@0 { interrupts = <0 370 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi1: ssi@1 { interrupts = <0 371 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi2: ssi@2 { interrupts = <0 372 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi3: ssi@3 { interrupts = <0 373 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi4: ssi@4 { interrupts = <0 374 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi5: ssi@5 { interrupts = <0 375 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi6: ssi@6 { interrupts = <0 376 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi7: ssi@7 { interrupts = <0 377 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi8: ssi@8 { interrupts = <0 378 IRQ_TYPE_LEVEL_HIGH>; };
++ ssi9: ssi@9 { interrupts = <0 379 IRQ_TYPE_LEVEL_HIGH>; };
++ };
++ };
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0899-ARM-shmobile-Enable-genmai-board-in-multiplatform-de.patch b/patches.renesas/0899-ARM-shmobile-Enable-genmai-board-in-multiplatform-de.patch
new file mode 100644
index 00000000000000..e0b8364d4b57c2
--- /dev/null
+++ b/patches.renesas/0899-ARM-shmobile-Enable-genmai-board-in-multiplatform-de.patch
@@ -0,0 +1,31 @@
+From 21426f50ec857ca58e6b011e6a0cf201f481c577 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 16 Jun 2014 19:49:43 +0900
+Subject: ARM: shmobile: Enable genmai board in multiplatform defconfig
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit c61010050d3baa3e1a3964bec7e62437d21107c6)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/configs/shmobile_defconfig | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
+index c4b72aa48e67..5f05e98eb762 100644
+--- a/arch/arm/configs/shmobile_defconfig
++++ b/arch/arm/configs/shmobile_defconfig
+@@ -10,9 +10,11 @@ CONFIG_PERF_EVENTS=y
+ CONFIG_SLAB=y
+ CONFIG_ARCH_SHMOBILE_MULTI=y
+ CONFIG_ARCH_EMEV2=y
++CONFIG_ARCH_R7S72100=y
+ CONFIG_ARCH_R8A7779=y
+ CONFIG_ARCH_R8A7790=y
+ CONFIG_ARCH_R8A7791=y
++CONFIG_MACH_GENMAI=y
+ CONFIG_MACH_KOELSCH=y
+ CONFIG_MACH_LAGER=y
+ CONFIG_MACH_MARZEN=y
+--
+2.1.2
+
diff --git a/patches.renesas/0900-ARM-shmobile-Move-r7s72100.h.patch b/patches.renesas/0900-ARM-shmobile-Move-r7s72100.h.patch
new file mode 100644
index 00000000000000..3d6114068121af
--- /dev/null
+++ b/patches.renesas/0900-ARM-shmobile-Move-r7s72100.h.patch
@@ -0,0 +1,99 @@
+From e63631c58b14ce2d1b481b88b511164ec3fb568d Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 18:53:01 +0200
+Subject: ARM: shmobile: Move r7s72100.h
+
+Change location of r7s72100.h so it can be included using "r7s72100.h"
+instead of the old style <mach/r7s72100.h>.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 96bd090066e2150f3970b32f35895de2ab631c95)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-genmai-reference.c | 4 +++-
+ arch/arm/mach-shmobile/board-genmai.c | 4 +++-
+ arch/arm/mach-shmobile/clock-r7s72100.c | 3 ++-
+ arch/arm/mach-shmobile/{include/mach => }/r7s72100.h | 0
+ arch/arm/mach-shmobile/setup-r7s72100.c | 4 +++-
+ 5 files changed, 11 insertions(+), 4 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/r7s72100.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-genmai-reference.c b/arch/arm/mach-shmobile/board-genmai-reference.c
+index c06dc5c12d1e..e5448f7b868a 100644
+--- a/arch/arm/mach-shmobile/board-genmai-reference.c
++++ b/arch/arm/mach-shmobile/board-genmai-reference.c
+@@ -20,11 +20,13 @@
+
+ #include <linux/kernel.h>
+ #include <linux/of_platform.h>
+-#include <mach/r7s72100.h>
++
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++
+ #include "clock.h"
+ #include "common.h"
++#include "r7s72100.h"
+
+ /*
+ * This is a really crude hack to provide clkdev support to platform
+diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
+index a0994f36b348..e2a3ba4871c3 100644
+--- a/arch/arm/mach-shmobile/board-genmai.c
++++ b/arch/arm/mach-shmobile/board-genmai.c
+@@ -25,11 +25,13 @@
+ #include <linux/sh_eth.h>
+ #include <linux/spi/rspi.h>
+ #include <linux/spi/spi.h>
+-#include <mach/r7s72100.h>
++
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r7s72100.h"
+
+ /* Ether */
+ static const struct sh_eth_plat_data ether_pdata __initconst = {
+diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
+index 457dab0f8fc9..3eb2ec401e0c 100644
+--- a/arch/arm/mach-shmobile/clock-r7s72100.c
++++ b/arch/arm/mach-shmobile/clock-r7s72100.c
+@@ -19,8 +19,9 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/r7s72100.h>
++
+ #include "common.h"
++#include "r7s72100.h"
+
+ /* Frequency Control Registers */
+ #define FRQCR 0xfcfe0010
+diff --git a/arch/arm/mach-shmobile/include/mach/r7s72100.h b/arch/arm/mach-shmobile/r7s72100.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/r7s72100.h
+rename to arch/arm/mach-shmobile/r7s72100.h
+diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
+index a55d68d89e6e..4a98b232d316 100644
+--- a/arch/arm/mach-shmobile/setup-r7s72100.c
++++ b/arch/arm/mach-shmobile/setup-r7s72100.c
+@@ -22,10 +22,12 @@
+ #include <linux/kernel.h>
+ #include <linux/of_platform.h>
+ #include <linux/sh_timer.h>
+-#include <mach/r7s72100.h>
++
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r7s72100.h"
+
+ static struct resource mtu2_resources[] __initdata = {
+ DEFINE_RES_MEM(0xfcff0000, 0x400),
+--
+2.1.2
+
diff --git a/patches.renesas/0901-ARM-shmobile-Move-r8a73a4.h.patch b/patches.renesas/0901-ARM-shmobile-Move-r8a73a4.h.patch
new file mode 100644
index 00000000000000..4128a821a74932
--- /dev/null
+++ b/patches.renesas/0901-ARM-shmobile-Move-r8a73a4.h.patch
@@ -0,0 +1,83 @@
+From 864a98221a7182b7ddc5e0ac3e93c7da23f921ef Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 18:53:02 +0200
+Subject: ARM: shmobile: Move r8a73a4.h
+
+Change location of r8a73a4.h so it can be included as "r8a73a4.h"
+instead of the old style <mach/r8a73a4.h>
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit fac49568b0d19e039e216ca6d13bc534ebf12c34)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ape6evm-reference.c | 4 +++-
+ arch/arm/mach-shmobile/board-ape6evm.c | 4 +++-
+ arch/arm/mach-shmobile/{include/mach => }/r8a73a4.h | 0
+ arch/arm/mach-shmobile/setup-r8a73a4.c | 4 +++-
+ 4 files changed, 9 insertions(+), 3 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/r8a73a4.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-ape6evm-reference.c b/arch/arm/mach-shmobile/board-ape6evm-reference.c
+index 76e4ff14be68..2f7723e5fe91 100644
+--- a/arch/arm/mach-shmobile/board-ape6evm-reference.c
++++ b/arch/arm/mach-shmobile/board-ape6evm-reference.c
+@@ -24,10 +24,12 @@
+ #include <linux/pinctrl/machine.h>
+ #include <linux/platform_device.h>
+ #include <linux/sh_clk.h>
+-#include <mach/r8a73a4.h>
++
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
++#include "r8a73a4.h"
+
+ static void __init ape6evm_add_standard_devices(void)
+ {
+diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
+index 8f8da25310e7..485567876d39 100644
+--- a/arch/arm/mach-shmobile/board-ape6evm.c
++++ b/arch/arm/mach-shmobile/board-ape6evm.c
+@@ -33,11 +33,13 @@
+ #include <linux/regulator/machine.h>
+ #include <linux/sh_clk.h>
+ #include <linux/smsc911x.h>
+-#include <mach/r8a73a4.h>
++
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a73a4.h"
+
+ /* LEDS */
+ static struct gpio_led ape6evm_leds[] = {
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a73a4.h b/arch/arm/mach-shmobile/r8a73a4.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/r8a73a4.h
+rename to arch/arm/mach-shmobile/r8a73a4.h
+diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
+index da94d9b9292e..f470b3cc0b7b 100644
+--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
++++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
+@@ -24,11 +24,13 @@
+ #include <linux/serial_sci.h>
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+-#include <mach/r8a73a4.h>
++
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
++#include "r8a73a4.h"
+
+ static const struct resource pfc_resources[] = {
+ DEFINE_RES_MEM(0xe6050000, 0x9000),
+--
+2.1.2
+
diff --git a/patches.renesas/0902-ARM-shmobile-Move-r8a7740.h.patch b/patches.renesas/0902-ARM-shmobile-Move-r8a7740.h.patch
new file mode 100644
index 00000000000000..f338d752d2849e
--- /dev/null
+++ b/patches.renesas/0902-ARM-shmobile-Move-r8a7740.h.patch
@@ -0,0 +1,110 @@
+From 494e282d75b656692e8793d9bd334e85416f6840 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 18:53:03 +0200
+Subject: ARM: shmobile: Move r8a7740.h
+
+Change location of r8a7740.h so it can be included as "r8a7740.h"
+instead of the old style <mach/r8a7740.h>
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 9e38b84b456ab7b2abd28257eec5caee4fb1f5ea)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-armadillo800eva-reference.c | 4 +++-
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 4 +++-
+ arch/arm/mach-shmobile/clock-r8a7740.c | 3 ++-
+ arch/arm/mach-shmobile/{include/mach => }/r8a7740.h | 0
+ arch/arm/mach-shmobile/setup-r8a7740.c | 4 +++-
+ 5 files changed, 11 insertions(+), 4 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/r8a7740.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+index 10b13c7ac214..36fab42f4a93 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+@@ -24,10 +24,12 @@
+ #include <linux/kernel.h>
+ #include <linux/gpio.h>
+ #include <linux/io.h>
+-#include <mach/r8a7740.h>
++
+ #include <asm/mach/arch.h>
+ #include <asm/hardware/cache-l2x0.h>
++
+ #include "common.h"
++#include "r8a7740.h"
+
+ /*
+ * CON1 Camera Module
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 90a0b2b15545..4612a18c797f 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -45,7 +45,7 @@
+ #include <linux/mmc/sh_mobile_sdhi.h>
+ #include <linux/i2c-gpio.h>
+ #include <linux/reboot.h>
+-#include <mach/r8a7740.h>
++
+ #include <media/mt9t112.h>
+ #include <media/sh_mobile_ceu.h>
+ #include <media/soc_camera.h>
+@@ -59,9 +59,11 @@
+ #include <video/sh_mobile_hdmi.h>
+ #include <sound/sh_fsi.h>
+ #include <sound/simple_card.h>
++
+ #include "common.h"
+ #include "irqs.h"
+ #include "pm-rmobile.h"
++#include "r8a7740.h"
+ #include "sh-gpio.h"
+
+ /*
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+index ffefec53b058..789091cfa37a 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7740.c
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -22,9 +22,10 @@
+ #include <linux/io.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/r8a7740.h>
++
+ #include "clock.h"
+ #include "common.h"
++#include "r8a7740.h"
+
+ /*
+ * | MDx | XTAL1/EXTAL1 | System | EXTALR |
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/r8a7740.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/r8a7740.h
+rename to arch/arm/mach-shmobile/r8a7740.h
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index 10170b3560c2..348af358a239 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -31,15 +31,17 @@
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+-#include <mach/r8a7740.h>
++
+ #include <asm/mach-types.h>
+ #include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
++
+ #include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
+ #include "pm-rmobile.h"
++#include "r8a7740.h"
+
+ static struct map_desc r8a7740_io_desc[] __initdata = {
+ /*
+--
+2.1.2
+
diff --git a/patches.renesas/0903-ARM-shmobile-Move-r8a7778.h.patch b/patches.renesas/0903-ARM-shmobile-Move-r8a7778.h.patch
new file mode 100644
index 00000000000000..6b70c8999175b7
--- /dev/null
+++ b/patches.renesas/0903-ARM-shmobile-Move-r8a7778.h.patch
@@ -0,0 +1,84 @@
+From 0b9e140ee3e254ac081ec30c5273244a3947180e Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 18:53:04 +0200
+Subject: ARM: shmobile: Move r8a7778.h
+
+Change location of r8a7778.h so it can be included as "r8a7778.h"
+instead of the old style <mach/r8a7778.h>
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 02c94f38bf3bcdaaceb1f3486b4dbee1ab550793)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-bockw-reference.c | 4 +++-
+ arch/arm/mach-shmobile/board-bockw.c | 4 +++-
+ arch/arm/mach-shmobile/{include/mach => }/r8a7778.h | 0
+ arch/arm/mach-shmobile/setup-r8a7778.c | 4 +++-
+ 4 files changed, 9 insertions(+), 3 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/r8a7778.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
+index 91ff3a27ccc7..ba840cd333b9 100644
+--- a/arch/arm/mach-shmobile/board-bockw-reference.c
++++ b/arch/arm/mach-shmobile/board-bockw-reference.c
+@@ -19,9 +19,11 @@
+ */
+
+ #include <linux/of_platform.h>
+-#include <mach/r8a7778.h>
++
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
++#include "r8a7778.h"
+
+ /*
+ * see board-bock.c for checking detail of dip-switch
+diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
+index 8cb057f95c44..b4e4789017bc 100644
+--- a/arch/arm/mach-shmobile/board-bockw.c
++++ b/arch/arm/mach-shmobile/board-bockw.c
+@@ -34,13 +34,15 @@
+ #include <linux/spi/spi.h>
+ #include <linux/spi/flash.h>
+ #include <linux/usb/renesas_usbhs.h>
++
+ #include <media/soc_camera.h>
+-#include <mach/r8a7778.h>
+ #include <asm/mach/arch.h>
+ #include <sound/rcar_snd.h>
+ #include <sound/simple_card.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7778.h"
+
+ #define FPGA 0x18200000
+ #define IRQ0MR 0x30
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/r8a7778.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/r8a7778.h
+rename to arch/arm/mach-shmobile/r8a7778.h
+diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
+index b7deec3c3d8d..13512e97cd05 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7778.c
++++ b/arch/arm/mach-shmobile/setup-r8a7778.c
+@@ -37,11 +37,13 @@
+ #include <linux/usb/ehci_pdriver.h>
+ #include <linux/usb/ohci_pdriver.h>
+ #include <linux/dma-mapping.h>
+-#include <mach/r8a7778.h>
++
+ #include <asm/mach/arch.h>
+ #include <asm/hardware/cache-l2x0.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7778.h"
+
+ /* SCIF */
+ #define R8A7778_SCIF(index, baseaddr, irq) \
+--
+2.1.2
+
diff --git a/patches.renesas/0904-ARM-shmobile-Move-r8a7790.h.patch b/patches.renesas/0904-ARM-shmobile-Move-r8a7790.h.patch
new file mode 100644
index 00000000000000..8a148e25993195
--- /dev/null
+++ b/patches.renesas/0904-ARM-shmobile-Move-r8a7790.h.patch
@@ -0,0 +1,160 @@
+From 871c85e01bcef18253f9038f8e1fe8d78353c7f7 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 18:53:06 +0200
+Subject: ARM: shmobile: Move r8a7790.h
+
+Change location of r8a7790.h so it can be included as "r8a7790.h"
+instead of the old style <mach/r8a7790.h>
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit fccae89318fda71012f96042dd971a6f9bf0904e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-lager-reference.c | 4 +++-
+ arch/arm/mach-shmobile/board-lager.c | 14 ++++++++------
+ arch/arm/mach-shmobile/clock-r8a7790.c | 3 ++-
+ arch/arm/mach-shmobile/pm-r8a7790.c | 4 +++-
+ arch/arm/mach-shmobile/{include/mach => }/r8a7790.h | 0
+ arch/arm/mach-shmobile/setup-r8a7790.c | 4 +++-
+ arch/arm/mach-shmobile/smp-r8a7790.c | 4 +++-
+ 7 files changed, 22 insertions(+), 11 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/r8a7790.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
+index c2175c8e1ce7..41c808e56005 100644
+--- a/arch/arm/mach-shmobile/board-lager-reference.c
++++ b/arch/arm/mach-shmobile/board-lager-reference.c
+@@ -22,11 +22,13 @@
+ #include <linux/init.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+-#include <mach/r8a7790.h>
++
+ #include <asm/mach/arch.h>
++
+ #include "clock.h"
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7790.h"
+ #include "rcar-gen2.h"
+
+ /* DU */
+diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
+index 6fb08dbc953c..b8b2b44970ce 100644
+--- a/arch/arm/mach-shmobile/board-lager.c
++++ b/arch/arm/mach-shmobile/board-lager.c
+@@ -31,6 +31,8 @@
+ #include <linux/mmc/host.h>
+ #include <linux/mmc/sh_mmcif.h>
+ #include <linux/mmc/sh_mobile_sdhi.h>
++#include <linux/mtd/partitions.h>
++#include <linux/mtd/mtd.h>
+ #include <linux/pinctrl/machine.h>
+ #include <linux/platform_data/camera-rcar.h>
+ #include <linux/platform_data/gpio-rcar.h>
+@@ -43,21 +45,21 @@
+ #include <linux/regulator/gpio-regulator.h>
+ #include <linux/regulator/machine.h>
+ #include <linux/sh_eth.h>
++#include <linux/spi/flash.h>
++#include <linux/spi/rspi.h>
++#include <linux/spi/spi.h>
+ #include <linux/usb/phy.h>
+ #include <linux/usb/renesas_usbhs.h>
+-#include <mach/r8a7790.h>
++
+ #include <media/soc_camera.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+-#include <linux/mtd/partitions.h>
+-#include <linux/mtd/mtd.h>
+-#include <linux/spi/flash.h>
+-#include <linux/spi/rspi.h>
+-#include <linux/spi/spi.h>
+ #include <sound/rcar_snd.h>
+ #include <sound/simple_card.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7790.h"
+ #include "rcar-gen2.h"
+
+ /*
+diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
+index ca980669806f..17435c1aa2fe 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7790.c
++++ b/arch/arm/mach-shmobile/clock-r8a7790.c
+@@ -22,9 +22,10 @@
+ #include <linux/kernel.h>
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+-#include <mach/r8a7790.h>
++
+ #include "clock.h"
+ #include "common.h"
++#include "r8a7790.h"
+ #include "rcar-gen2.h"
+
+ /*
+diff --git a/arch/arm/mach-shmobile/pm-r8a7790.c b/arch/arm/mach-shmobile/pm-r8a7790.c
+index 0f1090d851e7..8845433a00b3 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7790.c
++++ b/arch/arm/mach-shmobile/pm-r8a7790.c
+@@ -11,9 +11,11 @@
+ */
+
+ #include <linux/kernel.h>
++
+ #include <asm/io.h>
+-#include <mach/r8a7790.h>
++
+ #include "pm-rcar.h"
++#include "r8a7790.h"
+
+ /* SYSC */
+ #define SYSCIER 0x0c
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/r8a7790.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/r8a7790.h
+rename to arch/arm/mach-shmobile/r8a7790.h
+diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
+index a34229d5da41..c37d82d38617 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7790.c
++++ b/arch/arm/mach-shmobile/setup-r8a7790.c
+@@ -26,11 +26,13 @@
+ #include <linux/serial_sci.h>
+ #include <linux/sh_dma.h>
+ #include <linux/sh_timer.h>
+-#include <mach/r8a7790.h>
++
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
++#include "r8a7790.h"
+ #include "rcar-gen2.h"
+
+ /* Audio-DMAC */
+diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
+index 7590e2b6e2fa..ad66beab2ea6 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7790.c
++++ b/arch/arm/mach-shmobile/smp-r8a7790.c
+@@ -17,10 +17,12 @@
+ #include <linux/init.h>
+ #include <linux/smp.h>
+ #include <linux/io.h>
++
+ #include <asm/smp_plat.h>
+-#include <mach/r8a7790.h>
++
+ #include "common.h"
+ #include "pm-rcar.h"
++#include "r8a7790.h"
+
+ #define RST 0xe6160000
+ #define CA15BAR 0x0020
+--
+2.1.2
+
diff --git a/patches.renesas/0905-ARM-shmobile-Move-sh73a0.h.patch b/patches.renesas/0905-ARM-shmobile-Move-sh73a0.h.patch
new file mode 100644
index 00000000000000..e5e07a35357b42
--- /dev/null
+++ b/patches.renesas/0905-ARM-shmobile-Move-sh73a0.h.patch
@@ -0,0 +1,130 @@
+From 117b1e84d51d2305ccaa25fc19fdbe638cf0149d Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 18:53:09 +0200
+Subject: ARM: shmobile: Move sh73a0.h
+
+Change location of sh73a0.h so it can be included as "sh73a0.h"
+instead of the old style <mach/sh73a0.h>
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ded59d6dfc47683d1b810c069ed637e1e60e75fd)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-kzm9g-reference.c | 4 +++-
+ arch/arm/mach-shmobile/board-kzm9g.c | 4 +++-
+ arch/arm/mach-shmobile/intc-sh73a0.c | 4 +++-
+ arch/arm/mach-shmobile/setup-sh73a0.c | 4 +++-
+ arch/arm/mach-shmobile/{include/mach => }/sh73a0.h | 0
+ arch/arm/mach-shmobile/smp-sh73a0.c | 4 +++-
+ 6 files changed, 15 insertions(+), 5 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/sh73a0.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
+index f7b2d0708311..95307cd0ebc4 100644
+--- a/arch/arm/mach-shmobile/board-kzm9g-reference.c
++++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
+@@ -25,11 +25,13 @@
+ #include <linux/irq.h>
+ #include <linux/input.h>
+ #include <linux/of_platform.h>
+-#include <mach/sh73a0.h>
++
+ #include <asm/hardware/cache-l2x0.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
++#include "sh73a0.h"
+
+ static void __init kzm_init(void)
+ {
+diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
+index 638859ee247f..dc529f9f58d7 100644
+--- a/arch/arm/mach-shmobile/board-kzm9g.c
++++ b/arch/arm/mach-shmobile/board-kzm9g.c
+@@ -41,15 +41,17 @@
+ #include <linux/usb/r8a66597.h>
+ #include <linux/usb/renesas_usbhs.h>
+ #include <linux/videodev2.h>
++
+ #include <sound/sh_fsi.h>
+ #include <sound/simple_card.h>
+-#include <mach/sh73a0.h>
+ #include <asm/hardware/cache-l2x0.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <video/sh_mobile_lcdc.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "sh73a0.h"
+
+ /*
+ * external GPIO
+diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
+index 1a8f9a7af983..44457a94897b 100644
+--- a/arch/arm/mach-shmobile/intc-sh73a0.c
++++ b/arch/arm/mach-shmobile/intc-sh73a0.c
+@@ -24,11 +24,13 @@
+ #include <linux/io.h>
+ #include <linux/irqchip.h>
+ #include <linux/irqchip/arm-gic.h>
+-#include <mach/sh73a0.h>
++
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++
+ #include "intc.h"
+ #include "irqs.h"
++#include "sh73a0.h"
+
+ enum {
+ UNUSED = 0,
+diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
+index b30bbee6dc65..224882151667 100644
+--- a/arch/arm/mach-shmobile/setup-sh73a0.c
++++ b/arch/arm/mach-shmobile/setup-sh73a0.c
+@@ -32,14 +32,16 @@
+ #include <linux/sh_timer.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+ #include <linux/platform_data/irq-renesas-intc-irqpin.h>
+-#include <mach/sh73a0.h>
++
+ #include <asm/mach-types.h>
+ #include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
++
+ #include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
++#include "sh73a0.h"
+
+ static struct map_desc sh73a0_io_desc[] __initdata = {
+ /* create a 1:1 entity map for 0xe6xxxxxx
+diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/sh73a0.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/sh73a0.h
+rename to arch/arm/mach-shmobile/sh73a0.h
+diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
+index bf4aff99ed1c..22d8f87b23e9 100644
+--- a/arch/arm/mach-shmobile/smp-sh73a0.c
++++ b/arch/arm/mach-shmobile/smp-sh73a0.c
+@@ -22,10 +22,12 @@
+ #include <linux/smp.h>
+ #include <linux/io.h>
+ #include <linux/delay.h>
+-#include <mach/sh73a0.h>
++
+ #include <asm/smp_plat.h>
+ #include <asm/smp_twd.h>
++
+ #include "common.h"
++#include "sh73a0.h"
+
+ #define WUPCR IOMEM(0xe6151010)
+ #define SRESCR IOMEM(0xe6151018)
+--
+2.1.2
+
diff --git a/patches.renesas/0906-ARM-shmobile-Move-sh7372.h.patch b/patches.renesas/0906-ARM-shmobile-Move-sh7372.h.patch
new file mode 100644
index 00000000000000..ca2083feba7429
--- /dev/null
+++ b/patches.renesas/0906-ARM-shmobile-Move-sh7372.h.patch
@@ -0,0 +1,99 @@
+From e08d59239682b2d0bf7413129477a6f8164d4140 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 18:53:08 +0200
+Subject: ARM: shmobile: Move sh7372.h
+
+Change location of sh7372.h so it can be included as "sh7372.h"
+instead of the old style <mach/sh7372.h>
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 113522ee3034427472bcb4b8665833719809b31a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-mackerel.c | 4 +++-
+ arch/arm/mach-shmobile/pm-sh7372.c | 4 +++-
+ arch/arm/mach-shmobile/setup-sh7372.c | 4 +++-
+ arch/arm/mach-shmobile/{include/mach => }/sh7372.h | 0
+ 4 files changed, 9 insertions(+), 3 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/sh7372.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 0ece865cbc4d..304b76f3bf4a 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -51,6 +51,7 @@
+ #include <linux/tca6416_keypad.h>
+ #include <linux/usb/renesas_usbhs.h>
+ #include <linux/dma-mapping.h>
++
+ #include <video/sh_mobile_hdmi.h>
+ #include <video/sh_mobile_lcdc.h>
+ #include <media/sh_mobile_ceu.h>
+@@ -58,13 +59,14 @@
+ #include <media/soc_camera_platform.h>
+ #include <sound/sh_fsi.h>
+ #include <sound/simple_card.h>
+-#include <mach/sh7372.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach-types.h>
++
+ #include "common.h"
+ #include "irqs.h"
+ #include "pm-rmobile.h"
+ #include "sh-gpio.h"
++#include "sh7372.h"
+
+ /*
+ * Address Interface BusWidth note
+diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
+index 7ef9a0126780..7e5c2676c489 100644
+--- a/arch/arm/mach-shmobile/pm-sh7372.c
++++ b/arch/arm/mach-shmobile/pm-sh7372.c
+@@ -21,13 +21,15 @@
+ #include <linux/irq.h>
+ #include <linux/bitrev.h>
+ #include <linux/console.h>
++
+ #include <asm/cpuidle.h>
+ #include <asm/io.h>
+ #include <asm/tlbflush.h>
+ #include <asm/suspend.h>
+-#include <mach/sh7372.h>
++
+ #include "common.h"
+ #include "pm-rmobile.h"
++#include "sh7372.h"
+
+ /* DBG */
+ #define DBGREG1 IOMEM(0xe6100020)
+diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
+index 5571f867c611..9cdfcdfd38fc 100644
+--- a/arch/arm/mach-shmobile/setup-sh7372.c
++++ b/arch/arm/mach-shmobile/setup-sh7372.c
+@@ -33,15 +33,17 @@
+ #include <linux/pm_domain.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/platform_data/sh_ipmmu.h>
+-#include <mach/sh7372.h>
++
+ #include <asm/mach/map.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
++
+ #include "common.h"
+ #include "dma-register.h"
+ #include "irqs.h"
+ #include "pm-rmobile.h"
++#include "sh7372.h"
+
+ static struct map_desc sh7372_io_desc[] __initdata = {
+ /* create a 1:1 entity map for 0xe6xxxxxx
+diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/sh7372.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/sh7372.h
+rename to arch/arm/mach-shmobile/sh7372.h
+--
+2.1.2
+
diff --git a/patches.renesas/0907-ARM-shmobile-Move-r8a7779.h.patch b/patches.renesas/0907-ARM-shmobile-Move-r8a7779.h.patch
new file mode 100644
index 00000000000000..3e7216b35a4acd
--- /dev/null
+++ b/patches.renesas/0907-ARM-shmobile-Move-r8a7779.h.patch
@@ -0,0 +1,148 @@
+From dc723ee54d05e0bb8e0f7e021b6b4a2b515bd5fe Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 18:53:05 +0200
+Subject: ARM: shmobile: Move r8a7779.h
+
+Change location of r8a7779.h so it can be included as "r8a7779.h"
+instead of the old style <mach/r8a7779.h>
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 1b55353c9214788b0d0797a5fd4585af1557a12c)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-marzen-reference.c | 4 +++-
+ arch/arm/mach-shmobile/board-marzen.c | 4 +++-
+ arch/arm/mach-shmobile/clock-r8a7779.c | 3 ++-
+ arch/arm/mach-shmobile/pm-r8a7779.c | 4 +++-
+ arch/arm/mach-shmobile/{include/mach => }/r8a7779.h | 0
+ arch/arm/mach-shmobile/setup-r8a7779.c | 4 +++-
+ arch/arm/mach-shmobile/smp-r8a7779.c | 4 +++-
+ 7 files changed, 17 insertions(+), 6 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/r8a7779.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
+index 0a000b74ac6d..21b3e1ca2261 100644
+--- a/arch/arm/mach-shmobile/board-marzen-reference.c
++++ b/arch/arm/mach-shmobile/board-marzen-reference.c
+@@ -22,12 +22,14 @@
+ #include <linux/clk/shmobile.h>
+ #include <linux/clocksource.h>
+ #include <linux/of_platform.h>
+-#include <mach/r8a7779.h>
++
+ #include <asm/irq.h>
+ #include <asm/mach/arch.h>
++
+ #include "clock.h"
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7779.h"
+
+ static void __init marzen_init_timer(void)
+ {
+diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
+index fe445ef49fb9..25a1037e289d 100644
+--- a/arch/arm/mach-shmobile/board-marzen.c
++++ b/arch/arm/mach-shmobile/board-marzen.c
+@@ -41,13 +41,15 @@
+ #include <linux/mmc/host.h>
+ #include <linux/mmc/sh_mobile_sdhi.h>
+ #include <linux/mfd/tmio.h>
++
+ #include <media/soc_camera.h>
+-#include <mach/r8a7779.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/traps.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7779.h"
+
+ /* Fixed 3.3V regulator to be used by SDHI0 */
+ static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
+diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
+index e690927f3505..c51f9db3f66f 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7779.c
++++ b/arch/arm/mach-shmobile/clock-r8a7779.c
+@@ -24,9 +24,10 @@
+ #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
+ #include <linux/sh_timer.h>
+-#include <mach/r8a7779.h>
++
+ #include "clock.h"
+ #include "common.h"
++#include "r8a7779.h"
+
+ /*
+ * MD1 = 1 MD1 = 0
+diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
+index f0f36cb5ffe7..69f70b7f7fb2 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7779.c
++++ b/arch/arm/mach-shmobile/pm-r8a7779.c
+@@ -19,10 +19,12 @@
+ #include <linux/irq.h>
+ #include <linux/interrupt.h>
+ #include <linux/console.h>
++
+ #include <asm/io.h>
+-#include <mach/r8a7779.h>
++
+ #include "common.h"
+ #include "pm-rcar.h"
++#include "r8a7779.h"
+
+ /* SYSC */
+ #define SYSCIER 0x0c
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/r8a7779.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/r8a7779.h
+rename to arch/arm/mach-shmobile/r8a7779.h
+diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
+index 219050ec9640..5845df36985c 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7779.c
++++ b/arch/arm/mach-shmobile/setup-r8a7779.c
+@@ -40,14 +40,16 @@
+ #include <linux/usb/ehci_pdriver.h>
+ #include <linux/usb/ohci_pdriver.h>
+ #include <linux/pm_runtime.h>
+-#include <mach/r8a7779.h>
++
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/time.h>
+ #include <asm/mach/map.h>
+ #include <asm/hardware/cache-l2x0.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7779.h"
+
+ static struct map_desc r8a7779_io_desc[] __initdata = {
+ /* 2M entity map for 0xf0000000 (MPCORE) */
+diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
+index c230fc0c3fef..3100e355c3fd 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7779.c
++++ b/arch/arm/mach-shmobile/smp-r8a7779.c
+@@ -23,13 +23,15 @@
+ #include <linux/spinlock.h>
+ #include <linux/io.h>
+ #include <linux/delay.h>
+-#include <mach/r8a7779.h>
++
+ #include <asm/cacheflush.h>
+ #include <asm/smp_plat.h>
+ #include <asm/smp_scu.h>
+ #include <asm/smp_twd.h>
++
+ #include "common.h"
+ #include "pm-rcar.h"
++#include "r8a7779.h"
+
+ #define AVECR IOMEM(0xfe700040)
+ #define R8A7779_SCU_BASE 0xf0000000
+--
+2.1.2
+
diff --git a/patches.renesas/0908-ARM-shmobile-Move-r8a7791.h.patch b/patches.renesas/0908-ARM-shmobile-Move-r8a7791.h.patch
new file mode 100644
index 00000000000000..3321db7a64a927
--- /dev/null
+++ b/patches.renesas/0908-ARM-shmobile-Move-r8a7791.h.patch
@@ -0,0 +1,121 @@
+From 7648ae5665df6ef67c7d391c4af67527a7c5bb70 Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 20 Jun 2014 18:53:07 +0200
+Subject: ARM: shmobile: Move r8a7791.h
+
+Change location of r8a7791.h so it can be included as "r8a7791.h"
+instead of the old style <mach/r8a7791.h>
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 5201b5a792e95e3ecebe74cd3553413a67da09db)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-koelsch-reference.c | 4 +++-
+ arch/arm/mach-shmobile/board-koelsch.c | 4 +++-
+ arch/arm/mach-shmobile/pm-r8a7791.c | 6 ++++--
+ arch/arm/mach-shmobile/{include/mach => }/r8a7791.h | 0
+ arch/arm/mach-shmobile/setup-r8a7791.c | 4 +++-
+ arch/arm/mach-shmobile/smp-r8a7791.c | 4 +++-
+ 6 files changed, 16 insertions(+), 6 deletions(-)
+ rename arch/arm/mach-shmobile/{include/mach => }/r8a7791.h (100%)
+
+diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c
+index 5e0375fdc6f7..3ff88c138896 100644
+--- a/arch/arm/mach-shmobile/board-koelsch-reference.c
++++ b/arch/arm/mach-shmobile/board-koelsch-reference.c
+@@ -23,11 +23,13 @@
+ #include <linux/kernel.h>
+ #include <linux/of_platform.h>
+ #include <linux/platform_data/rcar-du.h>
+-#include <mach/r8a7791.h>
++
+ #include <asm/mach/arch.h>
++
+ #include "clock.h"
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7791.h"
+ #include "rcar-gen2.h"
+
+ /* DU */
+diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
+index db4b8a311c75..2cd3194a2d47 100644
+--- a/arch/arm/mach-shmobile/board-koelsch.c
++++ b/arch/arm/mach-shmobile/board-koelsch.c
+@@ -45,11 +45,13 @@
+ #include <linux/spi/flash.h>
+ #include <linux/spi/rspi.h>
+ #include <linux/spi/spi.h>
+-#include <mach/r8a7791.h>
++
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7791.h"
+ #include "rcar-gen2.h"
+
+ /* DU */
+diff --git a/arch/arm/mach-shmobile/pm-r8a7791.c b/arch/arm/mach-shmobile/pm-r8a7791.c
+index 15190875d507..b7e6513fb38a 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7791.c
++++ b/arch/arm/mach-shmobile/pm-r8a7791.c
+@@ -10,10 +10,12 @@
+ * for more details.
+ */
+
+-#include <asm/io.h>
+ #include <linux/kernel.h>
+-#include <mach/r8a7791.h>
++
++#include <asm/io.h>
++
+ #include "pm-rcar.h"
++#include "r8a7791.h"
+
+ /* SYSC */
+ #define SYSCIER 0x0c
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7791.h b/arch/arm/mach-shmobile/r8a7791.h
+similarity index 100%
+rename from arch/arm/mach-shmobile/include/mach/r8a7791.h
+rename to arch/arm/mach-shmobile/r8a7791.h
+diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
+index 7e970d005f7f..8823324ac5a9 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7791.c
++++ b/arch/arm/mach-shmobile/setup-r8a7791.c
+@@ -26,10 +26,12 @@
+ #include <linux/platform_data/irq-renesas-irqc.h>
+ #include <linux/serial_sci.h>
+ #include <linux/sh_timer.h>
+-#include <mach/r8a7791.h>
++
+ #include <asm/mach/arch.h>
++
+ #include "common.h"
+ #include "irqs.h"
++#include "r8a7791.h"
+ #include "rcar-gen2.h"
+
+ static const struct resource pfc_resources[] __initconst = {
+diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
+index c6543b6ec759..248255524127 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7791.c
++++ b/arch/arm/mach-shmobile/smp-r8a7791.c
+@@ -17,9 +17,11 @@
+ #include <linux/init.h>
+ #include <linux/smp.h>
+ #include <linux/io.h>
++
+ #include <asm/smp_plat.h>
+-#include <mach/r8a7791.h>
++
+ #include "common.h"
++#include "r8a7791.h"
+ #include "rcar-gen2.h"
+
+ #define RST 0xe6160000
+--
+2.1.2
+
diff --git a/patches.renesas/0909-ARM-shmobile-Allow-use-of-boot-code-for-non-SMP-case.patch b/patches.renesas/0909-ARM-shmobile-Allow-use-of-boot-code-for-non-SMP-case.patch
new file mode 100644
index 00000000000000..47d6a61310709f
--- /dev/null
+++ b/patches.renesas/0909-ARM-shmobile-Allow-use-of-boot-code-for-non-SMP-case.patch
@@ -0,0 +1,105 @@
+From 1cf00a253464485b091b1cb7a53235189bbebfb0 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 16:20:10 +0900
+Subject: ARM: shmobile: Allow use of boot code for non-SMP case
+
+Allow build of platsmp.c and headsmp.S even though
+SMP is disabled in the kernel configuration. With
+this in place it is possible to share the reset
+vector setup code with power management code that
+needs to be built even though SMP is disabled.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 8b438bcb9009609a15e5480ab1947acff6fb9005)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/Makefile | 11 +++++++----
+ arch/arm/mach-shmobile/headsmp.S | 13 ++++++++-----
+ 2 files changed, 15 insertions(+), 9 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index ccb056327fd4..cf83a1ab8122 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -34,17 +34,17 @@ obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o
+ obj-$(CONFIG_ARCH_R7S72100) += clock-r7s72100.o
+ endif
+
++# CPU reset vector handling objects
++cpu-y := platsmp.o headsmp.o
++
+ # SMP objects
+-smp-y := platsmp.o headsmp.o
++smp-y := $(cpu-y)
+ smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
+ smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
+ smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o platsmp-apmu.o
+ smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o platsmp-apmu.o
+ smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o
+
+-# IRQ objects
+-obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
+-
+ # PM objects
+ obj-$(CONFIG_SUSPEND) += suspend.o
+ obj-$(CONFIG_CPU_IDLE) += cpuidle.o
+@@ -56,6 +56,9 @@ obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o pm-rcar.o
+ obj-$(CONFIG_ARCH_R8A7790) += pm-r8a7790.o pm-rcar.o
+ obj-$(CONFIG_ARCH_R8A7791) += pm-r8a7791.o pm-rcar.o
+
++# IRQ objects
++obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
++
+ # Board objects
+ ifdef CONFIG_ARCH_SHMOBILE_MULTI
+ obj-$(CONFIG_MACH_GENMAI) += board-genmai-reference.o
+diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
+index e5be5c88644b..faf82144a262 100644
+--- a/arch/arm/mach-shmobile/headsmp.S
++++ b/arch/arm/mach-shmobile/headsmp.S
+@@ -10,14 +10,17 @@
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+-#include <linux/linkage.h>
+ #include <linux/init.h>
++#include <linux/linkage.h>
++#include <linux/threads.h>
+ #include <asm/memory.h>
+
++#ifdef CONFIG_SMP
+ ENTRY(shmobile_invalidate_start)
+ bl v7_invalidate_l1
+ b secondary_startup
+ ENDPROC(shmobile_invalidate_start)
++#endif
+
+ /*
+ * Reset vector for secondary CPUs.
+@@ -68,7 +71,7 @@ shmobile_smp_boot_find_mpidr:
+
+ shmobile_smp_boot_next:
+ add r1, r1, #1
+- cmp r1, #CONFIG_NR_CPUS
++ cmp r1, #NR_CPUS
+ blo shmobile_smp_boot_find_mpidr
+
+ b shmobile_smp_sleep
+@@ -85,10 +88,10 @@ ENDPROC(shmobile_smp_sleep)
+
+ .globl shmobile_smp_mpidr
+ shmobile_smp_mpidr:
+-1: .space CONFIG_NR_CPUS * 4
++1: .space NR_CPUS * 4
+ .globl shmobile_smp_fn
+ shmobile_smp_fn:
+-2: .space CONFIG_NR_CPUS * 4
++2: .space NR_CPUS * 4
+ .globl shmobile_smp_arg
+ shmobile_smp_arg:
+-3: .space CONFIG_NR_CPUS * 4
++3: .space NR_CPUS * 4
+--
+2.1.2
+
diff --git a/patches.renesas/0910-ARM-shmobile-Adjust-APMU-code-to-build-for-non-SMP.patch b/patches.renesas/0910-ARM-shmobile-Adjust-APMU-code-to-build-for-non-SMP.patch
new file mode 100644
index 00000000000000..229739d2ba51a4
--- /dev/null
+++ b/patches.renesas/0910-ARM-shmobile-Adjust-APMU-code-to-build-for-non-SMP.patch
@@ -0,0 +1,80 @@
+From 04de1be8208bd83e6bc91afa59388eeedee85d2b Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 16:20:18 +0900
+Subject: ARM: shmobile: Adjust APMU code to build for non-SMP
+
+Adjust the APMU code to allow build when CONFIG_SMP=n.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 784500be40a0eabcee1e48c70927aea9c9accb1e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/platsmp-apmu.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
+index 590e35c22a60..ce07eb9f5cd5 100644
+--- a/arch/arm/mach-shmobile/platsmp-apmu.c
++++ b/arch/arm/mach-shmobile/platsmp-apmu.c
+@@ -15,6 +15,7 @@
+ #include <linux/of_address.h>
+ #include <linux/smp.h>
+ #include <linux/suspend.h>
++#include <linux/threads.h>
+ #include <asm/cacheflush.h>
+ #include <asm/cp15.h>
+ #include <asm/proc-fns.h>
+@@ -25,13 +26,13 @@
+ static struct {
+ void __iomem *iomem;
+ int bit;
+-} apmu_cpus[CONFIG_NR_CPUS];
++} apmu_cpus[NR_CPUS];
+
+ #define WUPCR_OFFS 0x10
+ #define PSTR_OFFS 0x40
+ #define CPUNCR_OFFS(n) (0x100 + (0x10 * (n)))
+
+-static int apmu_power_on(void __iomem *p, int bit)
++static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
+ {
+ /* request power on */
+ writel_relaxed(BIT(bit), p + WUPCR_OFFS);
+@@ -50,7 +51,7 @@ static int apmu_power_off(void __iomem *p, int bit)
+ return 0;
+ }
+
+-static int apmu_power_off_poll(void __iomem *p, int bit)
++static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
+ {
+ int k;
+
+@@ -73,7 +74,7 @@ static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
+
+ static void apmu_init_cpu(struct resource *res, int cpu, int bit)
+ {
+- if (apmu_cpus[cpu].iomem)
++ if ((cpu >= ARRAY_SIZE(apmu_cpus)) || apmu_cpus[cpu].iomem)
+ return;
+
+ apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res));
+@@ -137,6 +138,7 @@ void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus)
+ apmu_parse_cfg(apmu_init_cpu);
+ }
+
++#ifdef CONFIG_SMP
+ int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
+ {
+ /* For this particular CPU register boot vector */
+@@ -144,6 +146,7 @@ int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
+
+ return apmu_wrap(cpu, apmu_power_on);
+ }
++#endif
+
+ #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND)
+ /* nicked from arch/arm/mach-exynos/hotplug.c */
+--
+2.1.2
+
diff --git a/patches.renesas/0911-ARM-shmobile-Use-__init-for-APMU-suspend-init-functi.patch b/patches.renesas/0911-ARM-shmobile-Use-__init-for-APMU-suspend-init-functi.patch
new file mode 100644
index 00000000000000..e60bc14fa27292
--- /dev/null
+++ b/patches.renesas/0911-ARM-shmobile-Use-__init-for-APMU-suspend-init-functi.patch
@@ -0,0 +1,33 @@
+From 2435bbce72967585675268303fcda8cb5d24f82a Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 16:20:46 +0900
+Subject: ARM: shmobile: Use __init for APMU suspend init function
+
+The function shmobile_smp_apmu_suspend_init() should
+be put into the init section to not trigger section
+mismatch warnings.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 0d77c9aa7a13a9fcfc93836188474f43394ea657)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/platsmp-apmu.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
+index ce07eb9f5cd5..a05b16d88257 100644
+--- a/arch/arm/mach-shmobile/platsmp-apmu.c
++++ b/arch/arm/mach-shmobile/platsmp-apmu.c
+@@ -240,7 +240,7 @@ static int shmobile_smp_apmu_enter_suspend(suspend_state_t state)
+ return 0;
+ }
+
+-void shmobile_smp_apmu_suspend_init(void)
++void __init shmobile_smp_apmu_suspend_init(void)
+ {
+ shmobile_suspend_ops.enter = shmobile_smp_apmu_enter_suspend;
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0912-ARM-shmobile-Move-r8a7790-reset-code-to-pm-r8a7790.c.patch b/patches.renesas/0912-ARM-shmobile-Move-r8a7790-reset-code-to-pm-r8a7790.c.patch
new file mode 100644
index 00000000000000..ad746364b2e781
--- /dev/null
+++ b/patches.renesas/0912-ARM-shmobile-Move-r8a7790-reset-code-to-pm-r8a7790.c.patch
@@ -0,0 +1,141 @@
+From 6ab094d6494ec27c7361acb9b49b206b3bbfa796 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 16:20:54 +0900
+Subject: ARM: shmobile: Move r8a7790 reset code to pm-r8a7790.c
+
+Move r8a7790 specific reset vector setup code from the
+SMP glue code to PM code. This makes the code one step
+closer to allow PM operations such as Suspend-to-RAM
+in the case when SMP is disabled in the kernel config.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+[horms+renesas@verge.net.au: updated for recent #include changes]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 07ce9dfaf477e0d16d40faea251898d5a38d8051)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+Conflicts:
+ arch/arm/mach-shmobile/pm-r8a7790.c
+---
+ arch/arm/mach-shmobile/pm-r8a7790.c | 40 ++++++++++++++++++++++++++++++++++--
+ arch/arm/mach-shmobile/smp-r8a7790.c | 30 ---------------------------
+ 2 files changed, 38 insertions(+), 32 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/pm-r8a7790.c b/arch/arm/mach-shmobile/pm-r8a7790.c
+index 8845433a00b3..c6efade323d6 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7790.c
++++ b/arch/arm/mach-shmobile/pm-r8a7790.c
+@@ -12,11 +12,23 @@
+
+ #include <linux/kernel.h>
+
++#include <linux/smp.h>
+ #include <asm/io.h>
+
++#include "common.h"
+ #include "pm-rcar.h"
+ #include "r8a7790.h"
+
++/* RST */
++#define RST 0xe6160000
++#define CA15BAR 0x0020
++#define CA7BAR 0x0030
++#define CA15RESCNT 0x0040
++#define CA7RESCNT 0x0044
++
++/* On-chip RAM */
++#define MERAM 0xe8080000
++
+ /* SYSC */
+ #define SYSCIER 0x0c
+ #define SYSCIMR 0x10
+@@ -40,8 +52,32 @@ static inline void r8a7790_sysc_init(void) {}
+
+ void __init r8a7790_pm_init(void)
+ {
++ void __iomem *p;
++ u32 bar;
+ static int once;
+
+- if (!once++)
+- r8a7790_sysc_init();
++ if (once++)
++ return;
++
++ /* MERAM for jump stub, because BAR requires 256KB aligned address */
++ p = ioremap_nocache(MERAM, shmobile_boot_size);
++ memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
++ iounmap(p);
++
++ /* setup reset vectors */
++ p = ioremap_nocache(RST, 0x63);
++ bar = (MERAM >> 8) & 0xfffffc00;
++ writel_relaxed(bar, p + CA15BAR);
++ writel_relaxed(bar, p + CA7BAR);
++ writel_relaxed(bar | 0x10, p + CA15BAR);
++ writel_relaxed(bar | 0x10, p + CA7BAR);
++
++ /* de-assert reset for all CPUs */
++ writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
++ p + CA15RESCNT);
++ writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
++ p + CA7RESCNT);
++ iounmap(p);
++
++ r8a7790_sysc_init();
+ }
+diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
+index ad66beab2ea6..8a2e7d5af930 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7790.c
++++ b/arch/arm/mach-shmobile/smp-r8a7790.c
+@@ -24,13 +24,6 @@
+ #include "pm-rcar.h"
+ #include "r8a7790.h"
+
+-#define RST 0xe6160000
+-#define CA15BAR 0x0020
+-#define CA7BAR 0x0030
+-#define CA15RESCNT 0x0040
+-#define CA7RESCNT 0x0044
+-#define MERAM 0xe8080000
+-
+ static struct rcar_sysc_ch r8a7790_ca15_scu = {
+ .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
+ .isr_bit = 12, /* CA15-SCU */
+@@ -43,32 +36,9 @@ static struct rcar_sysc_ch r8a7790_ca7_scu = {
+
+ static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
+ {
+- void __iomem *p;
+- u32 bar;
+-
+ /* let APMU code install data related to shmobile_boot_vector */
+ shmobile_smp_apmu_prepare_cpus(max_cpus);
+
+- /* MERAM for jump stub, because BAR requires 256KB aligned address */
+- p = ioremap_nocache(MERAM, shmobile_boot_size);
+- memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
+- iounmap(p);
+-
+- /* setup reset vectors */
+- p = ioremap_nocache(RST, 0x63);
+- bar = (MERAM >> 8) & 0xfffffc00;
+- writel_relaxed(bar, p + CA15BAR);
+- writel_relaxed(bar, p + CA7BAR);
+- writel_relaxed(bar | 0x10, p + CA15BAR);
+- writel_relaxed(bar | 0x10, p + CA7BAR);
+-
+- /* enable clocks to all CPUs */
+- writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
+- p + CA15RESCNT);
+- writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
+- p + CA7RESCNT);
+- iounmap(p);
+-
+ /* turn on power to SCU */
+ r8a7790_pm_init();
+ shmobile_smp_apmu_suspend_init();
+--
+2.1.2
+
diff --git a/patches.renesas/0913-ARM-shmobile-Allow-r8a7790-to-build-non-SMP-APMU-cod.patch b/patches.renesas/0913-ARM-shmobile-Allow-r8a7790-to-build-non-SMP-APMU-cod.patch
new file mode 100644
index 00000000000000..b8d5f2ca3cf2ed
--- /dev/null
+++ b/patches.renesas/0913-ARM-shmobile-Allow-r8a7790-to-build-non-SMP-APMU-cod.patch
@@ -0,0 +1,73 @@
+From fd7c4acb635eaf46bacf811a489f18867a706918 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 16:21:03 +0900
+Subject: ARM: shmobile: Allow r8a7790 to build non-SMP APMU code
+
+Build the APMU for r8a7790 even though SMP is
+disabled in the kernel config. Also initialize
+Suspend-to-RAM from pm-r8a7790.c to in the future
+cover both UP and SMP use cases of the APMU.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 06f2c5dcc24b026872bfc9b50b47c384638d2111)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/Makefile | 5 +++--
+ arch/arm/mach-shmobile/pm-r8a7790.c | 1 +
+ arch/arm/mach-shmobile/smp-r8a7790.c | 1 -
+ 3 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index cf83a1ab8122..59f63b7b52be 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -36,12 +36,13 @@ endif
+
+ # CPU reset vector handling objects
+ cpu-y := platsmp.o headsmp.o
++cpu-$(CONFIG_ARCH_R8A7790) += platsmp-apmu.o
+
+ # SMP objects
+ smp-y := $(cpu-y)
+ smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
+ smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
+-smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o platsmp-apmu.o
++smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o
+ smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o platsmp-apmu.o
+ smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o
+
+@@ -53,7 +54,7 @@ obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o
+ obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o
+ obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o
+ obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o pm-rcar.o
+-obj-$(CONFIG_ARCH_R8A7790) += pm-r8a7790.o pm-rcar.o
++obj-$(CONFIG_ARCH_R8A7790) += pm-r8a7790.o pm-rcar.o $(cpu-y)
+ obj-$(CONFIG_ARCH_R8A7791) += pm-r8a7791.o pm-rcar.o
+
+ # IRQ objects
+diff --git a/arch/arm/mach-shmobile/pm-r8a7790.c b/arch/arm/mach-shmobile/pm-r8a7790.c
+index c6efade323d6..f7912d1bf3f4 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7790.c
++++ b/arch/arm/mach-shmobile/pm-r8a7790.c
+@@ -80,4 +80,5 @@ void __init r8a7790_pm_init(void)
+ iounmap(p);
+
+ r8a7790_sysc_init();
++ shmobile_smp_apmu_suspend_init();
+ }
+diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
+index 8a2e7d5af930..2311694636e1 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7790.c
++++ b/arch/arm/mach-shmobile/smp-r8a7790.c
+@@ -41,7 +41,6 @@ static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
+
+ /* turn on power to SCU */
+ r8a7790_pm_init();
+- shmobile_smp_apmu_suspend_init();
+ rcar_sysc_power_up(&r8a7790_ca15_scu);
+ rcar_sysc_power_up(&r8a7790_ca7_scu);
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0914-ARM-shmobile-Move-r8a7791-reset-code-to-pm-r8a7791.c.patch b/patches.renesas/0914-ARM-shmobile-Move-r8a7791-reset-code-to-pm-r8a7791.c.patch
new file mode 100644
index 00000000000000..7a1c5e4a87df54
--- /dev/null
+++ b/patches.renesas/0914-ARM-shmobile-Move-r8a7791-reset-code-to-pm-r8a7791.c.patch
@@ -0,0 +1,117 @@
+From 13876e9abf6aac6626936285685fdfbd7cbdc836 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 16:21:11 +0900
+Subject: ARM: shmobile: Move r8a7791 reset code to pm-r8a7791.c
+
+Move r8a7791 specific reset vector setup code from the
+SMP glue code to PM code. This makes the code one step
+closer to allow PM operations such as Suspend-to-RAM
+in the case when SMP is disabled in the kernel config.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+[horms+renesas@verge.net.au: updated for recent header file changes]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 8e26118d44c4877fa52dc8117692f3cc9af3c769)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/pm-r8a7791.c | 27 +++++++++++++++++++++++++--
+ arch/arm/mach-shmobile/smp-r8a7791.c | 24 ------------------------
+ 2 files changed, 25 insertions(+), 26 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/pm-r8a7791.c b/arch/arm/mach-shmobile/pm-r8a7791.c
+index b7e6513fb38a..c44304c3c6df 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7791.c
++++ b/arch/arm/mach-shmobile/pm-r8a7791.c
+@@ -11,12 +11,17 @@
+ */
+
+ #include <linux/kernel.h>
+-
++#include <linux/smp.h>
+ #include <asm/io.h>
+-
++#include "common.h"
+ #include "pm-rcar.h"
+ #include "r8a7791.h"
+
++#define RST 0xe6160000
++#define CA15BAR 0x0020
++#define CA15RESCNT 0x0040
++#define RAM 0xe6300000
++
+ /* SYSC */
+ #define SYSCIER 0x0c
+ #define SYSCIMR 0x10
+@@ -40,10 +45,28 @@ static inline void r8a7791_sysc_init(void) {}
+
+ void __init r8a7791_pm_init(void)
+ {
++ void __iomem *p;
++ u32 bar;
+ static int once;
+
+ if (once++)
+ return;
+
++ /* RAM for jump stub, because BAR requires 256KB aligned address */
++ p = ioremap_nocache(RAM, shmobile_boot_size);
++ memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
++ iounmap(p);
++
++ /* setup reset vectors */
++ p = ioremap_nocache(RST, 0x63);
++ bar = (RAM >> 8) & 0xfffffc00;
++ writel_relaxed(bar, p + CA15BAR);
++ writel_relaxed(bar | 0x10, p + CA15BAR);
++
++ /* enable clocks to all CPUs */
++ writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
++ p + CA15RESCNT);
++ iounmap(p);
++
+ r8a7791_sysc_init();
+ }
+diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
+index 248255524127..df086aa79630 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7791.c
++++ b/arch/arm/mach-shmobile/smp-r8a7791.c
+@@ -24,35 +24,11 @@
+ #include "r8a7791.h"
+ #include "rcar-gen2.h"
+
+-#define RST 0xe6160000
+-#define CA15BAR 0x0020
+-#define CA15RESCNT 0x0040
+-#define RAM 0xe6300000
+-
+ static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
+ {
+- void __iomem *p;
+- u32 bar;
+-
+ /* let APMU code install data related to shmobile_boot_vector */
+ shmobile_smp_apmu_prepare_cpus(max_cpus);
+
+- /* RAM for jump stub, because BAR requires 256KB aligned address */
+- p = ioremap_nocache(RAM, shmobile_boot_size);
+- memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
+- iounmap(p);
+-
+- /* setup reset vectors */
+- p = ioremap_nocache(RST, 0x63);
+- bar = (RAM >> 8) & 0xfffffc00;
+- writel_relaxed(bar, p + CA15BAR);
+- writel_relaxed(bar | 0x10, p + CA15BAR);
+-
+- /* enable clocks to all CPUs */
+- writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
+- p + CA15RESCNT);
+- iounmap(p);
+-
+ r8a7791_pm_init();
+ shmobile_smp_apmu_suspend_init();
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0915-ARM-shmobile-Allow-r8a7791-to-build-non-SMP-APMU-cod.patch b/patches.renesas/0915-ARM-shmobile-Allow-r8a7791-to-build-non-SMP-APMU-cod.patch
new file mode 100644
index 00000000000000..7d3031421ed5c3
--- /dev/null
+++ b/patches.renesas/0915-ARM-shmobile-Allow-r8a7791-to-build-non-SMP-APMU-cod.patch
@@ -0,0 +1,74 @@
+From 3e7b6a202d3d95e2dc0b12c2b6aba20bd93a8db3 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm+renesas@opensource.se>
+Date: Fri, 6 Jun 2014 16:21:19 +0900
+Subject: ARM: shmobile: Allow r8a7791 to build non-SMP APMU code
+
+Build the APMU for r8a7791 even though SMP is
+disabled in the kernel config. Also initialize
+Suspend-to-RAM from pm-r8a7791.c to in the future
+cover both UP and SMP use cases of the APMU.
+
+Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit bfe4cfa8ae21628267f2b879b4396ee17ea4fd3a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/Makefile | 5 +++--
+ arch/arm/mach-shmobile/pm-r8a7791.c | 1 +
+ arch/arm/mach-shmobile/smp-r8a7791.c | 1 -
+ 3 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index 59f63b7b52be..fe3878a1a69a 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -37,13 +37,14 @@ endif
+ # CPU reset vector handling objects
+ cpu-y := platsmp.o headsmp.o
+ cpu-$(CONFIG_ARCH_R8A7790) += platsmp-apmu.o
++cpu-$(CONFIG_ARCH_R8A7791) += platsmp-apmu.o
+
+ # SMP objects
+ smp-y := $(cpu-y)
+ smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
+ smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
+ smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o
+-smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o platsmp-apmu.o
++smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o
+ smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o
+
+ # PM objects
+@@ -55,7 +56,7 @@ obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o
+ obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o
+ obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o pm-rcar.o
+ obj-$(CONFIG_ARCH_R8A7790) += pm-r8a7790.o pm-rcar.o $(cpu-y)
+-obj-$(CONFIG_ARCH_R8A7791) += pm-r8a7791.o pm-rcar.o
++obj-$(CONFIG_ARCH_R8A7791) += pm-r8a7791.o pm-rcar.o $(cpu-y)
+
+ # IRQ objects
+ obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
+diff --git a/arch/arm/mach-shmobile/pm-r8a7791.c b/arch/arm/mach-shmobile/pm-r8a7791.c
+index c44304c3c6df..25f107bb3657 100644
+--- a/arch/arm/mach-shmobile/pm-r8a7791.c
++++ b/arch/arm/mach-shmobile/pm-r8a7791.c
+@@ -69,4 +69,5 @@ void __init r8a7791_pm_init(void)
+ iounmap(p);
+
+ r8a7791_sysc_init();
++ shmobile_smp_apmu_suspend_init();
+ }
+diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
+index df086aa79630..f743386166fb 100644
+--- a/arch/arm/mach-shmobile/smp-r8a7791.c
++++ b/arch/arm/mach-shmobile/smp-r8a7791.c
+@@ -30,7 +30,6 @@ static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
+ shmobile_smp_apmu_prepare_cpus(max_cpus);
+
+ r8a7791_pm_init();
+- shmobile_smp_apmu_suspend_init();
+ }
+
+ static int r8a7791_smp_boot_secondary(unsigned int cpu,
+--
+2.1.2
+
diff --git a/patches.renesas/0916-ARM-shmobile-r8a7790-add-internal-PCI-bridge-nodes.patch b/patches.renesas/0916-ARM-shmobile-r8a7790-add-internal-PCI-bridge-nodes.patch
new file mode 100644
index 00000000000000..03f42b1001c16b
--- /dev/null
+++ b/patches.renesas/0916-ARM-shmobile-r8a7790-add-internal-PCI-bridge-nodes.patch
@@ -0,0 +1,95 @@
+From 5586c7e4bbdc487020c8ceb76af37ab1f0e9d144 Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Tue, 24 Jun 2014 21:59:54 +0400
+Subject: ARM: shmobile: r8a7790: add internal PCI bridge nodes
+
+Add device nodes for the R8A7790 internal PCI bridge devices.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Reviewed-by: Ian Molton <ian.molton@codethink.co.uk>
+[Sergei: added several properties to the PCI bridge nodes]
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit ff4f3eb8b3386208944fe60b85e6cba4d338198e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790.dtsi | 60 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 60 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index 994330e81a52..373d9a21c912 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -930,6 +930,66 @@
+ status = "disabled";
+ };
+
++ pci0: pci@ee090000 {
++ compatible = "renesas,pci-r8a7790";
++ device_type = "pci";
++ clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
++ reg = <0 0xee090000 0 0xc00>,
++ <0 0xee080000 0 0x1100>;
++ interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++
++ bus-range = <0 0>;
++ #address-cells = <3>;
++ #size-cells = <2>;
++ #interrupt-cells = <1>;
++ ranges = <0x02000000 0 0xee080000 0 0xee080000 0 0x00010000>;
++ interrupt-map-mask = <0xff00 0 0 0x7>;
++ interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
++ 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
++ 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>;
++ };
++
++ pci1: pci@ee0b0000 {
++ compatible = "renesas,pci-r8a7790";
++ device_type = "pci";
++ clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
++ reg = <0 0xee0b0000 0 0xc00>,
++ <0 0xee0a0000 0 0x1100>;
++ interrupts = <0 112 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++
++ bus-range = <1 1>;
++ #address-cells = <3>;
++ #size-cells = <2>;
++ #interrupt-cells = <1>;
++ ranges = <0x02000000 0 0xee0a0000 0 0xee0a0000 0 0x00010000>;
++ interrupt-map-mask = <0xff00 0 0 0x7>;
++ interrupt-map = <0x0000 0 0 1 &gic 0 112 IRQ_TYPE_LEVEL_HIGH
++ 0x0800 0 0 1 &gic 0 112 IRQ_TYPE_LEVEL_HIGH
++ 0x1000 0 0 2 &gic 0 112 IRQ_TYPE_LEVEL_HIGH>;
++ };
++
++ pci2: pci@ee0d0000 {
++ compatible = "renesas,pci-r8a7790";
++ device_type = "pci";
++ clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
++ reg = <0 0xee0d0000 0 0xc00>,
++ <0 0xee0c0000 0 0x1100>;
++ interrupts = <0 113 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++
++ bus-range = <2 2>;
++ #address-cells = <3>;
++ #size-cells = <2>;
++ #interrupt-cells = <1>;
++ ranges = <0x02000000 0 0xee0c0000 0 0xee0c0000 0 0x00010000>;
++ interrupt-map-mask = <0xff00 0 0 0x7>;
++ interrupt-map = <0x0000 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
++ 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
++ 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>;
++ };
++
+ pciec: pcie@fe000000 {
+ compatible = "renesas,pcie-r8a7790";
+ reg = <0 0xfe000000 0 0x80000>;
+--
+2.1.2
+
diff --git a/patches.renesas/0917-ARM-shmobile-lager-enable-internal-PCI.patch b/patches.renesas/0917-ARM-shmobile-lager-enable-internal-PCI.patch
new file mode 100644
index 00000000000000..31a1d093039bab
--- /dev/null
+++ b/patches.renesas/0917-ARM-shmobile-lager-enable-internal-PCI.patch
@@ -0,0 +1,72 @@
+From 90cce61d85c8b50d09861de3f80ea4cfa577f81d Mon Sep 17 00:00:00 2001
+From: Ben Dooks <ben.dooks@codethink.co.uk>
+Date: Tue, 24 Jun 2014 22:02:21 +0400
+Subject: ARM: shmobile: lager: enable internal PCI
+
+Enable internal AHB-PCI bridges for the USB EHCI/OHCI controllers attached to
+them.
+
+Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
+Reviewed-by: Ian Molton <ian.molton@codethink.co.uk>
+[Sergei: enabled PCI0]
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit d8584660676e00157735abcb34b09d690d96ee16)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 33 +++++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index 850dff8aedb9..17ff3f9e31ee 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -219,6 +219,21 @@
+ renesas,groups = "i2c3";
+ renesas,function = "i2c3";
+ };
++
++ usb0_pins: usb0 {
++ renesas,groups = "usb0";
++ renesas,function = "usb0";
++ };
++
++ usb1_pins: usb1 {
++ renesas,groups = "usb1";
++ renesas,function = "usb1";
++ };
++
++ usb2_pins: usb2 {
++ renesas,groups = "usb2";
++ renesas,function = "usb2";
++ };
+ };
+
+ &ether {
+@@ -368,3 +383,21 @@
+ regulator-always-on;
+ };
+ };
++
++&pci0 {
++ status = "okay";
++ pinctrl-0 = <&usb0_pins>;
++ pinctrl-names = "default";
++};
++
++&pci1 {
++ status = "okay";
++ pinctrl-0 = <&usb1_pins>;
++ pinctrl-names = "default";
++};
++
++&pci2 {
++ status = "okay";
++ pinctrl-0 = <&usb2_pins>;
++ pinctrl-names = "default";
++};
+--
+2.1.2
+
diff --git a/patches.renesas/0918-ARM-shmobile-r8a7790-add-DVC-support-for-sound-node-.patch b/patches.renesas/0918-ARM-shmobile-r8a7790-add-DVC-support-for-sound-node-.patch
new file mode 100644
index 00000000000000..caacb7ed2fdf24
--- /dev/null
+++ b/patches.renesas/0918-ARM-shmobile-r8a7790-add-DVC-support-for-sound-node-.patch
@@ -0,0 +1,44 @@
+From fb923aeebc26ddb7aba937d4d4cb06eaae97ff41 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 25 Jun 2014 17:52:17 -0700
+Subject: ARM: shmobile: r8a7790: add DVC support for sound node on DTSI
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 334d69a23b177a4ed38e654912444dc48ac46765)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790.dtsi | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index 373d9a21c912..bdcb7f08fcc5 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -1034,16 +1034,23 @@
+ <&mstp10_clks R8A7790_CLK_SCU_SRC5>, <&mstp10_clks R8A7790_CLK_SCU_SRC4>,
+ <&mstp10_clks R8A7790_CLK_SCU_SRC3>, <&mstp10_clks R8A7790_CLK_SCU_SRC2>,
+ <&mstp10_clks R8A7790_CLK_SCU_SRC1>, <&mstp10_clks R8A7790_CLK_SCU_SRC0>,
++ <&mstp10_clks R8A7790_CLK_SCU_DVC0>, <&mstp10_clks R8A7790_CLK_SCU_DVC1>,
+ <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
+ clock-names = "ssi-all",
+ "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
+ "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
+ "src.9", "src.8", "src.7", "src.6", "src.5",
+ "src.4", "src.3", "src.2", "src.1", "src.0",
++ "dvc.0", "dvc.1",
+ "clk_a", "clk_b", "clk_c", "clk_i";
+
+ status = "disabled";
+
++ rcar_sound,dvc {
++ dvc0: dvc@0 { };
++ dvc1: dvc@1 { };
++ };
++
+ rcar_sound,src {
+ src0: src@0 { };
+ src1: src@1 { };
+--
+2.1.2
+
diff --git a/patches.renesas/0919-ARM-shmobile-r8a7791-add-DVC-support-for-sound-node-.patch b/patches.renesas/0919-ARM-shmobile-r8a7791-add-DVC-support-for-sound-node-.patch
new file mode 100644
index 00000000000000..a783646f665c08
--- /dev/null
+++ b/patches.renesas/0919-ARM-shmobile-r8a7791-add-DVC-support-for-sound-node-.patch
@@ -0,0 +1,44 @@
+From b0b4db9f236a0010e06f3afbd9860fcc399a3f23 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 25 Jun 2014 17:52:33 -0700
+Subject: ARM: shmobile: r8a7791: add DVC support for sound node on DTSI
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 150c8ad40808189423002ea9fc6a858a3a59e6dc)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 40bff5aaf986..67262f6a7168 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -1005,16 +1005,23 @@
+ <&mstp10_clks R8A7791_CLK_SCU_SRC5>, <&mstp10_clks R8A7791_CLK_SCU_SRC4>,
+ <&mstp10_clks R8A7791_CLK_SCU_SRC3>, <&mstp10_clks R8A7791_CLK_SCU_SRC2>,
+ <&mstp10_clks R8A7791_CLK_SCU_SRC1>, <&mstp10_clks R8A7791_CLK_SCU_SRC0>,
++ <&mstp10_clks R8A7791_CLK_SCU_DVC0>, <&mstp10_clks R8A7791_CLK_SCU_DVC1>,
+ <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
+ clock-names = "ssi-all",
+ "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
+ "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
+ "src.9", "src.8", "src.7", "src.6", "src.5",
+ "src.4", "src.3", "src.2", "src.1", "src.0",
++ "dvc.0", "dvc.1",
+ "clk_a", "clk_b", "clk_c", "clk_i";
+
+ status = "disabled";
+
++ rcar_sound,dvc {
++ dvc0: dvc@0 { };
++ dvc1: dvc@1 { };
++ };
++
+ rcar_sound,src {
+ src0: src@0 { };
+ src1: src@1 { };
+--
+2.1.2
+
diff --git a/patches.renesas/0920-ASoC-fsi-use-SNDRV_DMA_TYPE_DEV-for-sound-buffer.patch b/patches.renesas/0920-ASoC-fsi-use-SNDRV_DMA_TYPE_DEV-for-sound-buffer.patch
new file mode 100644
index 00000000000000..b365b25e6a28ca
--- /dev/null
+++ b/patches.renesas/0920-ASoC-fsi-use-SNDRV_DMA_TYPE_DEV-for-sound-buffer.patch
@@ -0,0 +1,202 @@
+From e4f78b53d46ae1b7d680a535c57face76d34b370 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Sun, 22 Jun 2014 17:55:18 -0700
+Subject: ASoC: fsi: use SNDRV_DMA_TYPE_DEV for sound buffer
+
+Current fsi driver is using SNDRV_DMA_TYPE_CONTINUOUS
+for snd_pcm_lib_preallocate_pages_for_all().
+But, it came from original dma-sh7760.c,
+and no longer needed.
+This patch exchange its parameter, and removed
+original dma mapping and un-needed
+dma_sync_single_xxx() from driver.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit ffb83e8cb14cace1b08ceb56695b580c808d8a41)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 4 +++
+ arch/arm/mach-shmobile/board-kzm9g.c | 2 ++
+ arch/arm/mach-shmobile/board-mackerel.c | 4 +++
+ arch/sh/boards/mach-ecovec24/setup.c | 2 ++
+ sound/soc/sh/fsi.c | 42 +++-----------------------
+ 5 files changed, 17 insertions(+), 37 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 4612a18c797f..922887b2492f 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -1034,6 +1034,8 @@ static struct platform_device fsi_wm8978_device = {
+ .id = 0,
+ .dev = {
+ .platform_data = &fsi_wm8978_info,
++ .coherent_dma_mask = DMA_BIT_MASK(32),
++ .dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask,
+ },
+ };
+
+@@ -1057,6 +1059,8 @@ static struct platform_device fsi_hdmi_device = {
+ .id = 1,
+ .dev = {
+ .platform_data = &fsi2_hdmi_info,
++ .coherent_dma_mask = DMA_BIT_MASK(32),
++ .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
+ },
+ };
+
+diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
+index dc529f9f58d7..c4336cc1d8ed 100644
+--- a/arch/arm/mach-shmobile/board-kzm9g.c
++++ b/arch/arm/mach-shmobile/board-kzm9g.c
+@@ -605,6 +605,8 @@ static struct platform_device fsi_ak4648_device = {
+ .name = "asoc-simple-card",
+ .dev = {
+ .platform_data = &fsi2_ak4648_info,
++ .coherent_dma_mask = DMA_BIT_MASK(32),
++ .dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask,
+ },
+ };
+
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 304b76f3bf4a..79f448e93abb 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -523,6 +523,8 @@ static struct platform_device fsi_hdmi_device = {
+ .id = 1,
+ .dev = {
+ .platform_data = &fsi2_hdmi_info,
++ .coherent_dma_mask = DMA_BIT_MASK(32),
++ .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
+ },
+ };
+
+@@ -919,6 +921,8 @@ static struct platform_device fsi_ak4643_device = {
+ .name = "asoc-simple-card",
+ .dev = {
+ .platform_data = &fsi2_ak4643_info,
++ .coherent_dma_mask = DMA_BIT_MASK(32),
++ .dma_mask = &fsi_ak4643_device.dev.coherent_dma_mask,
+ },
+ };
+
+diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
+index 85d5255d259f..0d3049244cd3 100644
+--- a/arch/sh/boards/mach-ecovec24/setup.c
++++ b/arch/sh/boards/mach-ecovec24/setup.c
+@@ -874,6 +874,8 @@ static struct platform_device fsi_da7210_device = {
+ .name = "asoc-simple-card",
+ .dev = {
+ .platform_data = &fsi_da7210_info,
++ .coherent_dma_mask = DMA_BIT_MASK(32),
++ .dma_mask = &fsi_da7210_device.dev.coherent_dma_mask,
+ },
+ };
+
+diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
+index 710a079a7377..7a6b632c3db8 100644
+--- a/sound/soc/sh/fsi.c
++++ b/sound/soc/sh/fsi.c
+@@ -233,7 +233,6 @@ struct fsi_stream {
+ */
+ struct dma_chan *chan;
+ struct work_struct work;
+- dma_addr_t dma;
+ int dma_id;
+ int loop_cnt;
+ int additional_pos;
+@@ -1279,11 +1278,6 @@ static irqreturn_t fsi_interrupt(int irq, void *data)
+ */
+ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
+ {
+- struct snd_pcm_runtime *runtime = io->substream->runtime;
+- struct snd_soc_dai *dai = fsi_get_dai(io->substream);
+- enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
+- DMA_TO_DEVICE : DMA_FROM_DEVICE;
+-
+ /*
+ * 24bit data : 24bit bus / package in back
+ * 16bit data : 16bit bus / stream mode
+@@ -1293,19 +1287,7 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
+
+ io->loop_cnt = 2; /* push 1st, 2nd period first, then 3rd, 4th... */
+ io->additional_pos = 0;
+- io->dma = dma_map_single(dai->dev, runtime->dma_area,
+- snd_pcm_lib_buffer_bytes(io->substream), dir);
+- return 0;
+-}
+-
+-static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io)
+-{
+- struct snd_soc_dai *dai = fsi_get_dai(io->substream);
+- enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
+- DMA_TO_DEVICE : DMA_FROM_DEVICE;
+
+- dma_unmap_single(dai->dev, io->dma,
+- snd_pcm_lib_buffer_bytes(io->substream), dir);
+ return 0;
+ }
+
+@@ -1317,7 +1299,8 @@ static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
+ if (period >= runtime->periods)
+ period = 0;
+
+- return io->dma + samples_to_bytes(runtime, period * io->period_samples);
++ return runtime->dma_addr +
++ samples_to_bytes(runtime, period * io->period_samples);
+ }
+
+ static void fsi_dma_complete(void *data)
+@@ -1325,12 +1308,6 @@ static void fsi_dma_complete(void *data)
+ struct fsi_stream *io = (struct fsi_stream *)data;
+ struct fsi_priv *fsi = fsi_stream_to_priv(io);
+ struct snd_pcm_runtime *runtime = io->substream->runtime;
+- struct snd_soc_dai *dai = fsi_get_dai(io->substream);
+- enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
+- DMA_TO_DEVICE : DMA_FROM_DEVICE;
+-
+- dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io, 0),
+- samples_to_bytes(runtime, io->period_samples), dir);
+
+ io->buff_sample_pos += io->period_samples;
+ io->period_pos++;
+@@ -1369,8 +1346,6 @@ static void fsi_dma_do_work(struct work_struct *work)
+ for (i = 0; i < io->loop_cnt; i++) {
+ buf = fsi_dma_get_area(io, io->additional_pos);
+
+- dma_sync_single_for_device(dai->dev, buf, len, dir);
+-
+ desc = dmaengine_prep_slave_single(io->chan, buf, len, dir,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+ if (!desc) {
+@@ -1495,7 +1470,6 @@ static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
+
+ static struct fsi_stream_handler fsi_dma_push_handler = {
+ .init = fsi_dma_init,
+- .quit = fsi_dma_quit,
+ .probe = fsi_dma_probe,
+ .transfer = fsi_dma_transfer,
+ .remove = fsi_dma_remove,
+@@ -1850,16 +1824,10 @@ static void fsi_pcm_free(struct snd_pcm *pcm)
+
+ static int fsi_pcm_new(struct snd_soc_pcm_runtime *rtd)
+ {
+- struct snd_pcm *pcm = rtd->pcm;
+-
+- /*
+- * dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel
+- * in MMAP mode (i.e. aplay -M)
+- */
+ return snd_pcm_lib_preallocate_pages_for_all(
+- pcm,
+- SNDRV_DMA_TYPE_CONTINUOUS,
+- snd_dma_continuous_data(GFP_KERNEL),
++ rtd->pcm,
++ SNDRV_DMA_TYPE_DEV,
++ rtd->card->snd_card->dev,
+ PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
+ }
+
+--
+2.1.2
+
diff --git a/patches.renesas/0921-ARM-shmobile-r8a7790-Fix-whitespace-errors-in-pci-no.patch b/patches.renesas/0921-ARM-shmobile-r8a7790-Fix-whitespace-errors-in-pci-no.patch
new file mode 100644
index 00000000000000..b5e64e596077ce
--- /dev/null
+++ b/patches.renesas/0921-ARM-shmobile-r8a7790-Fix-whitespace-errors-in-pci-no.patch
@@ -0,0 +1,58 @@
+From 3a9245366e78d817959fa22ddfe2c83943b10e0d Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Mon, 30 Jun 2014 11:49:53 +0200
+Subject: ARM: shmobile: r8a7790: Fix whitespace errors in pci nodes
+
+Remove spaces in between tabs.
+
+Introduced by commit ff4f3eb8b3386208944fe60b85e6cba4d338198e ("ARM:
+shmobile: r8a7790: add internal PCI bridge nodes").
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 517ec80a3321e01fd07eeb6098c3d7b455fcca68)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790.dtsi | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
+index bdcb7f08fcc5..d9ddecbb859c 100644
+--- a/arch/arm/boot/dts/r8a7790.dtsi
++++ b/arch/arm/boot/dts/r8a7790.dtsi
+@@ -946,8 +946,8 @@
+ ranges = <0x02000000 0 0xee080000 0 0xee080000 0 0x00010000>;
+ interrupt-map-mask = <0xff00 0 0 0x7>;
+ interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
+- 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
+- 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>;
++ 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
++ 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ pci1: pci@ee0b0000 {
+@@ -966,8 +966,8 @@
+ ranges = <0x02000000 0 0xee0a0000 0 0xee0a0000 0 0x00010000>;
+ interrupt-map-mask = <0xff00 0 0 0x7>;
+ interrupt-map = <0x0000 0 0 1 &gic 0 112 IRQ_TYPE_LEVEL_HIGH
+- 0x0800 0 0 1 &gic 0 112 IRQ_TYPE_LEVEL_HIGH
+- 0x1000 0 0 2 &gic 0 112 IRQ_TYPE_LEVEL_HIGH>;
++ 0x0800 0 0 1 &gic 0 112 IRQ_TYPE_LEVEL_HIGH
++ 0x1000 0 0 2 &gic 0 112 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ pci2: pci@ee0d0000 {
+@@ -986,8 +986,8 @@
+ ranges = <0x02000000 0 0xee0c0000 0 0xee0c0000 0 0x00010000>;
+ interrupt-map-mask = <0xff00 0 0 0x7>;
+ interrupt-map = <0x0000 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
+- 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
+- 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>;
++ 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
++ 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
+ pciec: pcie@fe000000 {
+--
+2.1.2
+
diff --git a/patches.renesas/0922-ARM-shmobile-genmai-reference-dts-Add-RSPI-node.patch b/patches.renesas/0922-ARM-shmobile-genmai-reference-dts-Add-RSPI-node.patch
new file mode 100644
index 00000000000000..1720ff8bd2185f
--- /dev/null
+++ b/patches.renesas/0922-ARM-shmobile-genmai-reference-dts-Add-RSPI-node.patch
@@ -0,0 +1,39 @@
+From a3386ab700f5d259a47710b0b33d5024d709c9ad Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+Date: Thu, 3 Jul 2014 14:02:45 +0200
+Subject: ARM: shmobile: genmai reference dts: Add RSPI node
+
+Add SPI device for RSPI on Genmai.
+
+On this board, only rspi4 is in use. Its bus contains a single device
+(a wm8978 audio codec), for which no bindings are defined yet.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ae6b61840bfa36d4f1d89703a312ce29a52c3a76)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r7s72100-genmai.dts | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r7s72100-genmai.dts b/arch/arm/boot/dts/r7s72100-genmai.dts
+index 56849b55e1c2..20705467f4c9 100644
+--- a/arch/arm/boot/dts/r7s72100-genmai.dts
++++ b/arch/arm/boot/dts/r7s72100-genmai.dts
+@@ -57,3 +57,13 @@
+ &scif2 {
+ status = "okay";
+ };
++
++&spi4 {
++ status = "okay";
++
++ codec: codec@0 {
++ compatible = "wlf,wm8978";
++ reg = <0>;
++ spi-max-frequency = <5000000>;
++ };
++};
+--
+2.1.2
+
diff --git a/patches.renesas/0923-ARM-shmobile-fix-shmobile_smp_apmu_suspend_init-buil.patch b/patches.renesas/0923-ARM-shmobile-fix-shmobile_smp_apmu_suspend_init-buil.patch
new file mode 100644
index 00000000000000..e96378c9442b2b
--- /dev/null
+++ b/patches.renesas/0923-ARM-shmobile-fix-shmobile_smp_apmu_suspend_init-buil.patch
@@ -0,0 +1,34 @@
+From 9292daebe095ed43e635403bfc0098793710a9b3 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 3 Jul 2014 16:08:30 +0200
+Subject: ARM: shmobile: fix shmobile_smp_apmu_suspend_init build failure for
+ !SUSPEND
+
+Patch d6d757c9a4e ("ARM: shmobile: APMU: Add Core-Standby-state for
+Suspend to RAM") added both an inline wrapper for shmobile_smp_apmu_suspend_init
+and an empty function in arch/arm/mach-shmobile/platsmp-apmu.c. We get a
+build failure when both are present, so this patch removes the one in the .c
+file and keeps the inline version.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit d358c99838f3cf63ad7536124be4318cc84b11fa)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/platsmp-apmu.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
+index a05b16d88257..2c06810d3a70 100644
+--- a/arch/arm/mach-shmobile/platsmp-apmu.c
++++ b/arch/arm/mach-shmobile/platsmp-apmu.c
+@@ -244,6 +244,4 @@ void __init shmobile_smp_apmu_suspend_init(void)
+ {
+ shmobile_suspend_ops.enter = shmobile_smp_apmu_enter_suspend;
+ }
+-#else
+-void shmobile_smp_apmu_suspend_init(void) {}
+ #endif
+--
+2.1.2
+
diff --git a/patches.renesas/0924-ARM-shmobile-r8a7791-add-internal-PCI-bridge-nodes.patch b/patches.renesas/0924-ARM-shmobile-r8a7791-add-internal-PCI-bridge-nodes.patch
new file mode 100644
index 00000000000000..d78e23bd51aab3
--- /dev/null
+++ b/patches.renesas/0924-ARM-shmobile-r8a7791-add-internal-PCI-bridge-nodes.patch
@@ -0,0 +1,72 @@
+From 2f128c09de44ae4f0b68599ebda540a088f3a9cb Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Tue, 24 Jun 2014 22:10:05 +0400
+Subject: ARM: shmobile: r8a7791: add internal PCI bridge nodes
+
+Add device nodes for the R8A7791 internal PCI bridge devices.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+[horms+renesas@verge.net.au: minor witespace changes]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit aace0809e9bbbfe1570a298a3284d9802fbf2d1a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791.dtsi | 40 ++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
+index 67262f6a7168..0d82a4b3c650 100644
+--- a/arch/arm/boot/dts/r8a7791.dtsi
++++ b/arch/arm/boot/dts/r8a7791.dtsi
+@@ -961,6 +961,46 @@
+ status = "disabled";
+ };
+
++ pci0: pci@ee090000 {
++ compatible = "renesas,pci-r8a7791";
++ device_type = "pci";
++ clocks = <&mstp7_clks R8A7791_CLK_EHCI>;
++ reg = <0 0xee090000 0 0xc00>,
++ <0 0xee080000 0 0x1100>;
++ interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++
++ bus-range = <0 0>;
++ #address-cells = <3>;
++ #size-cells = <2>;
++ #interrupt-cells = <1>;
++ ranges = <0x02000000 0 0xee080000 0 0xee080000 0 0x00010000>;
++ interrupt-map-mask = <0xff00 0 0 0x7>;
++ interrupt-map = <0x0000 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
++ 0x0800 0 0 1 &gic 0 108 IRQ_TYPE_LEVEL_HIGH
++ 0x1000 0 0 2 &gic 0 108 IRQ_TYPE_LEVEL_HIGH>;
++ };
++
++ pci1: pci@ee0d0000 {
++ compatible = "renesas,pci-r8a7791";
++ device_type = "pci";
++ clocks = <&mstp7_clks R8A7791_CLK_EHCI>;
++ reg = <0 0xee0d0000 0 0xc00>,
++ <0 0xee0c0000 0 0x1100>;
++ interrupts = <0 113 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++
++ bus-range = <1 1>;
++ #address-cells = <3>;
++ #size-cells = <2>;
++ #interrupt-cells = <1>;
++ ranges = <0x02000000 0 0xee0c0000 0 0xee0c0000 0 0x00010000>;
++ interrupt-map-mask = <0xff00 0 0 0x7>;
++ interrupt-map = <0x0000 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
++ 0x0800 0 0 1 &gic 0 113 IRQ_TYPE_LEVEL_HIGH
++ 0x1000 0 0 2 &gic 0 113 IRQ_TYPE_LEVEL_HIGH>;
++ };
++
+ pciec: pcie@fe000000 {
+ compatible = "renesas,pcie-r8a7791";
+ reg = <0 0xfe000000 0 0x80000>;
+--
+2.1.2
+
diff --git a/patches.renesas/0925-ARM-shmobile-koelsch-enable-internal-PCI.patch b/patches.renesas/0925-ARM-shmobile-koelsch-enable-internal-PCI.patch
new file mode 100644
index 00000000000000..5193676334406d
--- /dev/null
+++ b/patches.renesas/0925-ARM-shmobile-koelsch-enable-internal-PCI.patch
@@ -0,0 +1,62 @@
+From 11a6ecdc6afd5cc3dd5ab6d77e1955d8523c30c6 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Tue, 24 Jun 2014 22:11:44 +0400
+Subject: ARM: shmobile: koelsch: enable internal PCI
+
+Enable internal AHB-PCI bridges for the USB EHCI/OHCI controllers attached to
+them.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+[horms+renesas@verge.net.au: minor witespace changes]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 7540aeb0dd2c830ed490e7227d51bc3050ac798c)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-koelsch.dts | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
+index 5dac67395525..23486c081a69 100644
+--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
++++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
+@@ -279,6 +279,16 @@
+ renesas,groups = "i2c6";
+ renesas,function = "i2c6";
+ };
++
++ usb0_pins: usb0 {
++ renesas,groups = "usb0";
++ renesas,function = "usb0";
++ };
++
++ usb1_pins: usb1 {
++ renesas,groups = "usb1";
++ renesas,function = "usb1";
++ };
+ };
+
+ &ether {
+@@ -426,6 +436,18 @@
+ };
+ };
+
++&pci0 {
++ status = "okay";
++ pinctrl-0 = <&usb0_pins>;
++ pinctrl-names = "default";
++};
++
++&pci1 {
++ status = "okay";
++ pinctrl-0 = <&usb1_pins>;
++ pinctrl-names = "default";
++};
++
+ &pcie_bus_clk {
+ status = "okay";
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0926-ARM-shmobile-henninger-enable-internal-PCI.patch b/patches.renesas/0926-ARM-shmobile-henninger-enable-internal-PCI.patch
new file mode 100644
index 00000000000000..b5d76ec835feae
--- /dev/null
+++ b/patches.renesas/0926-ARM-shmobile-henninger-enable-internal-PCI.patch
@@ -0,0 +1,62 @@
+From c8abd6ba05a91aacfb7e6051368f0000d8b24c59 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Tue, 24 Jun 2014 22:13:38 +0400
+Subject: ARM: shmobile: henninger: enable internal PCI
+
+Enable internal AHB-PCI bridges for the USB EHCI/OHCI controllers attached to
+them.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+[horms+renesas@verge.net.au: minor witespace changes]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 83ccfa8d0c6a734720ed8cd23b97256ffcae156a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-henninger.dts | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7791-henninger.dts b/arch/arm/boot/dts/r8a7791-henninger.dts
+index bc48bccfff54..cfd1fa68d674 100644
+--- a/arch/arm/boot/dts/r8a7791-henninger.dts
++++ b/arch/arm/boot/dts/r8a7791-henninger.dts
+@@ -125,6 +125,16 @@
+ "msiof0_tx";
+ renesas,function = "msiof0";
+ };
++
++ usb0_pins: usb0 {
++ renesas,groups = "usb0";
++ renesas,function = "usb0";
++ };
++
++ usb1_pins: usb1 {
++ renesas,groups = "usb1";
++ renesas,function = "usb1";
++ };
+ };
+
+ &scif0 {
+@@ -231,6 +241,18 @@
+ };
+ };
+
++&pci0 {
++ status = "okay";
++ pinctrl-0 = <&usb0_pins>;
++ pinctrl-names = "default";
++};
++
++&pci1 {
++ status = "okay";
++ pinctrl-0 = <&usb1_pins>;
++ pinctrl-names = "default";
++};
++
+ &pcie_bus_clk {
+ status = "okay";
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0927-ARM-shmobile-henninger-Consistently-use-tabs-for-ind.patch b/patches.renesas/0927-ARM-shmobile-henninger-Consistently-use-tabs-for-ind.patch
new file mode 100644
index 00000000000000..cd9689ef225208
--- /dev/null
+++ b/patches.renesas/0927-ARM-shmobile-henninger-Consistently-use-tabs-for-ind.patch
@@ -0,0 +1,30 @@
+From e1f7952f30f26045ea26993bdb690ccf36e855af Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 08:47:36 +0200
+Subject: ARM: shmobile: henninger: Consistently use tabs for indentation
+
+Unify white space usage by consistently using tabs for indentation.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit eb0f12e24f357f1663b4da8c571214d5a11eb011)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-henninger.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/r8a7791-henninger.dts b/arch/arm/boot/dts/r8a7791-henninger.dts
+index cfd1fa68d674..3a2ef0a2a137 100644
+--- a/arch/arm/boot/dts/r8a7791-henninger.dts
++++ b/arch/arm/boot/dts/r8a7791-henninger.dts
+@@ -161,7 +161,7 @@
+ };
+
+ &sata0 {
+- status = "okay";
++ status = "okay";
+ };
+
+ &sdhi0 {
+--
+2.1.2
+
diff --git a/patches.renesas/0928-ARM-shmobile-r8a7779-Consistently-use-tabs-for-inden.patch b/patches.renesas/0928-ARM-shmobile-r8a7779-Consistently-use-tabs-for-inden.patch
new file mode 100644
index 00000000000000..f1122e9184eaf2
--- /dev/null
+++ b/patches.renesas/0928-ARM-shmobile-r8a7779-Consistently-use-tabs-for-inden.patch
@@ -0,0 +1,42 @@
+From 9a90a720ad1c8a84a2bf2fd6ab495c87263a8ad1 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 08:47:38 +0200
+Subject: ARM: shmobile: r8a7779: Consistently use tabs for indentation
+
+Unify white space usage by consistently using tabs for indentation.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit cc703a59c0f8769456a7eb0d53a8d709e5c19387)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779.dtsi | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
+index 94e2fc836492..58d0d952d60e 100644
+--- a/arch/arm/boot/dts/r8a7779.dtsi
++++ b/arch/arm/boot/dts/r8a7779.dtsi
+@@ -54,13 +54,13 @@
+ spi2 = &hspi2;
+ };
+
+- gic: interrupt-controller@f0001000 {
+- compatible = "arm,cortex-a9-gic";
+- #interrupt-cells = <3>;
+- interrupt-controller;
+- reg = <0xf0001000 0x1000>,
+- <0xf0000100 0x100>;
+- };
++ gic: interrupt-controller@f0001000 {
++ compatible = "arm,cortex-a9-gic";
++ #interrupt-cells = <3>;
++ interrupt-controller;
++ reg = <0xf0001000 0x1000>,
++ <0xf0000100 0x100>;
++ };
+
+ gpio0: gpio@ffc40000 {
+ compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar";
+--
+2.1.2
+
diff --git a/patches.renesas/0929-ARM-shmobile-armadillo800eva-reference-Remove-early_.patch b/patches.renesas/0929-ARM-shmobile-armadillo800eva-reference-Remove-early_.patch
new file mode 100644
index 00000000000000..ba783d37b19a6a
--- /dev/null
+++ b/patches.renesas/0929-ARM-shmobile-armadillo800eva-reference-Remove-early_.patch
@@ -0,0 +1,32 @@
+From f52a73276b94532fcd3350873d86ee043f8d5b15 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 08:50:08 +0200
+Subject: ARM: shmobile: armadillo800eva-reference: Remove early_printk from
+ command line
+
+As early printk is not supported when devices are initialised
+using DT, so remove it from the command line.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit b2386fa51696ffcae82f27ebbdc667b037be5048)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+index f6ef73ff49e8..ba2e1806b3ad 100644
+--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
++++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+@@ -20,7 +20,7 @@
+ compatible = "renesas,armadillo800eva-reference", "renesas,r8a7740";
+
+ chosen {
+- bootargs = "console=tty0 console=ttySC1,115200 earlyprintk=sh-sci.1,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
++ bootargs = "console=tty0 console=ttySC1,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
+ };
+
+ memory {
+--
+2.1.2
+
diff --git a/patches.renesas/0930-ARM-shmobile-kzm9g-reference-Remove-early_printk-fro.patch b/patches.renesas/0930-ARM-shmobile-kzm9g-reference-Remove-early_printk-fro.patch
new file mode 100644
index 00000000000000..5e6566bb5889d0
--- /dev/null
+++ b/patches.renesas/0930-ARM-shmobile-kzm9g-reference-Remove-early_printk-fro.patch
@@ -0,0 +1,31 @@
+From 78f213bb90362cf0208b9f5d938d8f3f9a4699d7 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 08:50:09 +0200
+Subject: ARM: shmobile: kzm9g-reference: Remove early_printk from command line
+
+As early printk is not supported when devices are initialised
+using DT, so remove it from the command line.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 0b7324706ea24489a0ddcbd9d472e232520aad80)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/sh73a0-kzm9g-reference.dts | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+index a99171c8a782..838f93e44452 100644
+--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
++++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+@@ -35,7 +35,7 @@
+ };
+
+ chosen {
+- bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200 rw";
++ bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel rw";
+ };
+
+ memory {
+--
+2.1.2
+
diff --git a/patches.renesas/0931-ARM-shmobile-marzen-Consistently-use-tabs-for-indent.patch b/patches.renesas/0931-ARM-shmobile-marzen-Consistently-use-tabs-for-indent.patch
new file mode 100644
index 00000000000000..88fb58c690ce6d
--- /dev/null
+++ b/patches.renesas/0931-ARM-shmobile-marzen-Consistently-use-tabs-for-indent.patch
@@ -0,0 +1,45 @@
+From 1f8b6fec6752d619b0ad2e856c34cd6b11d88c80 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 08:47:37 +0200
+Subject: ARM: shmobile: marzen: Consistently use tabs for indentation
+
+Unify white space usage by consistently using tabs for indentation.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 08af64097d4c5cb17f9df4dadf80ed5f508db743)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7779-marzen.dts | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
+index 20b176807848..5745555df943 100644
+--- a/arch/arm/boot/dts/r8a7779-marzen.dts
++++ b/arch/arm/boot/dts/r8a7779-marzen.dts
+@@ -112,17 +112,17 @@
+ };
+
+ &scif2 {
+- pinctrl-0 = <&scif2_pins>;
+- pinctrl-names = "default";
++ pinctrl-0 = <&scif2_pins>;
++ pinctrl-names = "default";
+
+- status = "okay";
++ status = "okay";
+ };
+
+ &scif4 {
+- pinctrl-0 = <&scif4_pins>;
+- pinctrl-names = "default";
++ pinctrl-0 = <&scif4_pins>;
++ pinctrl-names = "default";
+
+- status = "okay";
++ status = "okay";
+ };
+
+ &sdhi0 {
+--
+2.1.2
+
diff --git a/patches.renesas/0932-ARM-shmobile-Enable-R-Car-Gen-2-PCIe-in-shmobile_def.patch b/patches.renesas/0932-ARM-shmobile-Enable-R-Car-Gen-2-PCIe-in-shmobile_def.patch
new file mode 100644
index 00000000000000..a91ca5f853cfe0
--- /dev/null
+++ b/patches.renesas/0932-ARM-shmobile-Enable-R-Car-Gen-2-PCIe-in-shmobile_def.patch
@@ -0,0 +1,32 @@
+From ad64652956b97714da3a49ba49ed620c0d8afdca Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 15:23:52 +0200
+Subject: ARM: shmobile: Enable R-Car Gen 2 PCIe in shmobile_defconfig
+
+The R-Car Gen 2 PCIe driver provides PCIe host support for
+Renesas R-Car Gen2 platforms. To increase hardware support enable
+the driver in the shmobile_defconfig multiplatform configuration.
+
+Cc: Phil Edworthy <phil.edworthy@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 8cbf869a0a278c4d39e50daa4f4101b394a72a93)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/configs/shmobile_defconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
+index 5f05e98eb762..6bc85a5539f1 100644
+--- a/arch/arm/configs/shmobile_defconfig
++++ b/arch/arm/configs/shmobile_defconfig
+@@ -24,6 +24,7 @@ CONFIG_PL310_ERRATA_588369=y
+ CONFIG_ARM_ERRATA_754322=y
+ CONFIG_PCI=y
+ CONFIG_PCI_RCAR_GEN2=y
++CONFIG_PCI_RCAR_GEN2_PCIE=y
+ CONFIG_SMP=y
+ CONFIG_SCHED_MC=y
+ CONFIG_HAVE_ARM_ARCH_TIMER=y
+--
+2.1.2
+
diff --git a/patches.renesas/0933-ARM-shmobile-Remove-opps-table-check-for-cpufreq.patch b/patches.renesas/0933-ARM-shmobile-Remove-opps-table-check-for-cpufreq.patch
new file mode 100644
index 00000000000000..e85c0c9ab1456c
--- /dev/null
+++ b/patches.renesas/0933-ARM-shmobile-Remove-opps-table-check-for-cpufreq.patch
@@ -0,0 +1,51 @@
+From d447907240076223f05d916a6a9f8f656cafa96a Mon Sep 17 00:00:00 2001
+From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Date: Wed, 25 Jun 2014 16:58:40 +0900
+Subject: ARM: shmobile: Remove opps table check for cpufreq
+
+This patch is based on feedback from Viresh Kumar.
+Since cpufreq-cpu0 driver has already check opp table, there is no
+need to same check in mach-shmobile.
+
+Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
+Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit e423d12cbcb9576785e891617888f627f1f57bf4)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/cpufreq.c | 16 +---------------
+ 1 file changed, 1 insertion(+), 15 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/cpufreq.c b/arch/arm/mach-shmobile/cpufreq.c
+index e2c868fc41cf..8a24b2be46ae 100644
+--- a/arch/arm/mach-shmobile/cpufreq.c
++++ b/arch/arm/mach-shmobile/cpufreq.c
+@@ -8,24 +8,10 @@
+ * for more details.
+ */
+
+-#include <linux/of.h>
+-#include <linux/of_device.h>
+ #include <linux/platform_device.h>
+
+ int __init shmobile_cpufreq_init(void)
+ {
+- struct device_node *np;
+-
+- np = of_cpu_device_node_get(0);
+- if (np == NULL) {
+- pr_err("failed to find cpu0 node\n");
+- return 0;
+- }
+-
+- if (of_get_property(np, "operating-points", NULL))
+- platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0);
+-
+- of_node_put(np);
+-
++ platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0);
+ return 0;
+ }
+--
+2.1.2
+
diff --git a/patches.renesas/0934-ARM-shmobile-Lager-Correct-I2C-bus-for-VDD-MPU-regul.patch b/patches.renesas/0934-ARM-shmobile-Lager-Correct-I2C-bus-for-VDD-MPU-regul.patch
new file mode 100644
index 00000000000000..3924298a788317
--- /dev/null
+++ b/patches.renesas/0934-ARM-shmobile-Lager-Correct-I2C-bus-for-VDD-MPU-regul.patch
@@ -0,0 +1,48 @@
+From ef562cd6ef336960f50160b9a60b9e4b6ed160e6 Mon Sep 17 00:00:00 2001
+From: Khiem Nguyen <khiem.nguyen.xt@renesas.com>
+Date: Fri, 4 Jul 2014 09:19:51 +0900
+Subject: ARM: shmobile: Lager: Correct I2C bus for VDD MPU regulator
+
+I2C bus for VDD MPU regulator is IIC3, not I2C3.
+
+Signed-off-by: Khiem Nguyen <khiem.nguyen.xt@renesas.com>
+Reviewed-by: Wolfram Sang <wsa@sang-engineering.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 5179ffd099446e65a1e094b9cb17cc7edab45583)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index 17ff3f9e31ee..d949ff04f2ec 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -215,9 +215,9 @@
+ renesas,function = "i2c2";
+ };
+
+- i2c3_pins: i2c3 {
+- renesas,groups = "i2c3";
+- renesas,function = "i2c3";
++ iic3_pins: iic3 {
++ renesas,groups = "iic3";
++ renesas,function = "iic3";
+ };
+
+ usb0_pins: usb0 {
+@@ -368,9 +368,9 @@
+ pinctrl-names = "default";
+ };
+
+-&i2c3 {
++&iic3 {
+ pinctrl-names = "default";
+- pinctrl-0 = <&i2c3_pins>;
++ pinctrl-0 = <&iic3_pins>;
+ status = "okay";
+
+ vdd_dvfs: regulator@68 {
+--
+2.1.2
+
diff --git a/patches.renesas/0935-ARM-shmobile-r8a7790-lager-use-iic-cores-instead-of-.patch b/patches.renesas/0935-ARM-shmobile-r8a7790-lager-use-iic-cores-instead-of-.patch
new file mode 100644
index 00000000000000..957978270ff9b3
--- /dev/null
+++ b/patches.renesas/0935-ARM-shmobile-r8a7790-lager-use-iic-cores-instead-of-.patch
@@ -0,0 +1,74 @@
+From a4fe4729b89a8d2515359c5ec99b2a77df82217c Mon Sep 17 00:00:00 2001
+From: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Date: Thu, 10 Jul 2014 12:50:56 +0200
+Subject: ARM: shmobile: r8a7790: lager: use iic cores instead of i2c
+
+On Lager board, i2c and iic cores can be interchanged since they can be
+muxed to the same wires. Commit e489c2a9bc82713167d9f721ca764f4b0d37e543
+("ARM: shmobile: lager: enable i2c devices") activated the i2c cores,
+yet the iic cores should be default since they have the more interesting
+features for generic use cases, i.e. SMBUS_QUICK and DMA (yet to be
+supported).
+
+Reported-by: Khiem Nguyen <khiem.nguyen.xt@renesas.com>
+Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit cb9a2b12e0cb524022c9a81d8ed29f2453ec240d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7790-lager.dts | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
+index d949ff04f2ec..2bff0a756053 100644
+--- a/arch/arm/boot/dts/r8a7790-lager.dts
++++ b/arch/arm/boot/dts/r8a7790-lager.dts
+@@ -205,14 +205,14 @@
+ renesas,function = "msiof1";
+ };
+
+- i2c1_pins: i2c1 {
+- renesas,groups = "i2c1";
+- renesas,function = "i2c1";
++ iic1_pins: iic1 {
++ renesas,groups = "iic1";
++ renesas,function = "iic1";
+ };
+
+- i2c2_pins: i2c2 {
+- renesas,groups = "i2c2";
+- renesas,function = "i2c2";
++ iic2_pins: iic2 {
++ renesas,groups = "iic2";
++ renesas,function = "iic2";
+ };
+
+ iic3_pins: iic3 {
+@@ -352,19 +352,19 @@
+ cpu0-supply = <&vdd_dvfs>;
+ };
+
+-&i2c0 {
++&iic0 {
+ status = "ok";
+ };
+
+-&i2c1 {
++&iic1 {
+ status = "ok";
+- pinctrl-0 = <&i2c1_pins>;
++ pinctrl-0 = <&iic1_pins>;
+ pinctrl-names = "default";
+ };
+
+-&i2c2 {
++&iic2 {
+ status = "ok";
+- pinctrl-0 = <&i2c2_pins>;
++ pinctrl-0 = <&iic2_pins>;
+ pinctrl-names = "default";
+ };
+
+--
+2.1.2
+
diff --git a/patches.renesas/0936-ARM-shmobile-r8a7778-add-SCI-clock-support-for-DT.patch b/patches.renesas/0936-ARM-shmobile-r8a7778-add-SCI-clock-support-for-DT.patch
new file mode 100644
index 00000000000000..bfa25d277072b3
--- /dev/null
+++ b/patches.renesas/0936-ARM-shmobile-r8a7778-add-SCI-clock-support-for-DT.patch
@@ -0,0 +1,41 @@
+From 04ab62b356376c58d97c3f8889fa7b5fa07c5cfd Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:26 +0200
+Subject: ARM: shmobile: r8a7778: add SCI clock support for DT
+
+This will be used when initialising SCI devices using DT
+until common clock framework support is added.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 7a0c99478dca80f862912be02bf8ec240a9098d1)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7778.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
+index 16bbc94a1520..95579073cfce 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7778.c
++++ b/arch/arm/mach-shmobile/clock-r8a7778.c
+@@ -202,11 +202,17 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */
+ CLKDEV_DEV_ID("ffc73000.i2c", &mstp_clks[MSTP027]), /* I2C3 */
+ CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
++ CLKDEV_DEV_ID("ffe40000.serial", &mstp_clks[MSTP026]), /* SCIF0 */
+ CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
++ CLKDEV_DEV_ID("ffe41000.serial", &mstp_clks[MSTP025]), /* SCIF1 */
+ CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
++ CLKDEV_DEV_ID("ffe42000.serial", &mstp_clks[MSTP024]), /* SCIF2 */
+ CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP023]), /* SCIF3 */
++ CLKDEV_DEV_ID("ffe43000.serial", &mstp_clks[MSTP023]), /* SCIF3 */
+ CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */
++ CLKDEV_DEV_ID("ffe44000.serial", &mstp_clks[MSTP022]), /* SCIF4 */
+ CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */
++ CLKDEV_DEV_ID("ffe45000.serial", &mstp_clks[MSTP021]), /* SCIF5 */
+ CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
+ CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */
+ CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
+--
+2.1.2
+
diff --git a/patches.renesas/0937-ARM-shmobile-r8a73a4-add-SCI-clock-support-for-DT.patch b/patches.renesas/0937-ARM-shmobile-r8a73a4-add-SCI-clock-support-for-DT.patch
new file mode 100644
index 00000000000000..2ffd92ba1350e6
--- /dev/null
+++ b/patches.renesas/0937-ARM-shmobile-r8a73a4-add-SCI-clock-support-for-DT.patch
@@ -0,0 +1,40 @@
+From 731e2ea3b16162a739a081d44d45b4fcef6a783f Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:32 +0200
+Subject: ARM: shmobile: r8a73a4: add SCI clock support for DT
+
+This will be used when initialising SCI devices using DT
+until common clock framework support is added.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 9947efaac0545fd833b0ff5147578aba79d297bc)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a73a4.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
+index 0f431498229b..49d139748aa6 100644
+--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
++++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
+@@ -574,11 +574,17 @@ static struct clk_lookup lookups[] = {
+
+ /* MSTP */
+ CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
++ CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]),
+ CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
++ CLKDEV_DEV_ID("e6c50000.serial", &mstp_clks[MSTP203]),
+ CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]),
++ CLKDEV_DEV_ID("e6c20000.serial", &mstp_clks[MSTP206]),
+ CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]),
++ CLKDEV_DEV_ID("e6c30000.serial", &mstp_clks[MSTP207]),
+ CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]),
++ CLKDEV_DEV_ID("e6ce0000.serial", &mstp_clks[MSTP216]),
+ CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]),
++ CLKDEV_DEV_ID("e6cf0000.serial", &mstp_clks[MSTP217]),
+ CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
+ CLKDEV_DEV_ID("e6700020.dma-controller", &mstp_clks[MSTP218]),
+ CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
+--
+2.1.2
+
diff --git a/patches.renesas/0938-ARM-shmobile-r8a7740-correct-SCI-clock-support-for-D.patch b/patches.renesas/0938-ARM-shmobile-r8a7740-correct-SCI-clock-support-for-D.patch
new file mode 100644
index 00000000000000..5c9cebfd799e68
--- /dev/null
+++ b/patches.renesas/0938-ARM-shmobile-r8a7740-correct-SCI-clock-support-for-D.patch
@@ -0,0 +1,62 @@
+From 1a2d90ab2a0fe1b100f60c9b690e7fba2b92a172 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:40 +0200
+Subject: ARM: shmobile: r8a7740: correct SCI clock support for DT
+
+When initialising SCI devices their names will be .serial
+not .sci.
+
+This will be used when initialising SCI devices using DT
+until common clock framework support is added.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit d1ec90f2875471df2c954f7cbd45b2389ff86aa2)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7740.c | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+index 789091cfa37a..a60c324df64e 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7740.c
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -556,27 +556,27 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]),
+
+ CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),
+- CLKDEV_DEV_ID("e6c80000.sci", &mstp_clks[MSTP200]),
++ CLKDEV_DEV_ID("e6c80000.serial", &mstp_clks[MSTP200]),
+ CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]),
+- CLKDEV_DEV_ID("e6c70000.sci", &mstp_clks[MSTP201]),
++ CLKDEV_DEV_ID("e6c70000.serial", &mstp_clks[MSTP201]),
+ CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]),
+- CLKDEV_DEV_ID("e6c60000.sci", &mstp_clks[MSTP202]),
++ CLKDEV_DEV_ID("e6c60000.serial", &mstp_clks[MSTP202]),
+ CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
+- CLKDEV_DEV_ID("e6c50000.sci", &mstp_clks[MSTP203]),
++ CLKDEV_DEV_ID("e6c50000.serial", &mstp_clks[MSTP203]),
+ CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
+- CLKDEV_DEV_ID("e6c40000.sci", &mstp_clks[MSTP204]),
++ CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]),
+ CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]),
+- CLKDEV_DEV_ID("e6c30000.sci", &mstp_clks[MSTP206]),
++ CLKDEV_DEV_ID("e6c30000.serial", &mstp_clks[MSTP206]),
+ CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]),
+- CLKDEV_DEV_ID("e6cb0000.sci", &mstp_clks[MSTP207]),
++ CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]),
+ CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]),
+ CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]),
+ CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]),
+ CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
+ CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]),
+- CLKDEV_DEV_ID("e6cd0000.sci", &mstp_clks[MSTP222]),
++ CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]),
+ CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]),
+- CLKDEV_DEV_ID("e6cc0000.sci", &mstp_clks[MSTP230]),
++ CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]),
+
+ CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]),
+ CLKDEV_DEV_ID("fe1f0000.sound", &mstp_clks[MSTP328]),
+--
+2.1.2
+
diff --git a/patches.renesas/0939-ARM-shmobile-sh73a0-add-SCI-clock-support-for-DT.patch b/patches.renesas/0939-ARM-shmobile-sh73a0-add-SCI-clock-support-for-DT.patch
new file mode 100644
index 00000000000000..412aa2cde77102
--- /dev/null
+++ b/patches.renesas/0939-ARM-shmobile-sh73a0-add-SCI-clock-support-for-DT.patch
@@ -0,0 +1,48 @@
+From 8f7af940c2c902ff63348773a3c5b4c1f5742a12 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:50 +0200
+Subject: ARM: shmobile: sh73a0: add SCI clock support for DT
+
+This will be used when initialising SCI devices using DT
+until common clock framework support is added.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ff4ce48e1f163d945c037c1c90ce12950961d91d)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-sh73a0.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
+index 37f48383e05a..9433a4e2c88e 100644
+--- a/arch/arm/mach-shmobile/clock-sh73a0.c
++++ b/arch/arm/mach-shmobile/clock-sh73a0.c
+@@ -638,16 +638,25 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_DEV_ID("e6820000.i2c", &mstp_clks[MSTP116]), /* I2C0 */
+ CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */
+ CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */
++ CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP219]), /* SCIFA7 */
+ CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */
+ CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), /* MP-DMAC */
+ CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
++ CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]), /* SCIFA5 */
+ CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */
++ CLKDEV_DEV_ID("0xe6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */
+ CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
++ CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]), /* SCIFA0 */
+ CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
++ CLKDEV_DEV_ID("e6c50000.serial", &mstp_clks[MSTP203]), /* SCIFA1 */
+ CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */
++ CLKDEV_DEV_ID("e6c60000.serial", &mstp_clks[MSTP202]), /* SCIFA2 */
+ CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
++ CLKDEV_DEV_ID("e6c70000.serial", &mstp_clks[MSTP201]), /* SCIFA3 */
+ CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
++ CLKDEV_DEV_ID("e6c80000.serial", &mstp_clks[MSTP200]), /* SCIFA4 */
+ CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
++ CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP331]), /* SCIFA6 */
+ CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */
+ CLKDEV_DEV_ID("ec230000.sound", &mstp_clks[MSTP328]), /* FSI */
+ CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */
+--
+2.1.2
+
diff --git a/patches.renesas/0940-ARM-shmobile-r8a7778-Add-SCIF-nodes.patch b/patches.renesas/0940-ARM-shmobile-r8a7778-Add-SCIF-nodes.patch
new file mode 100644
index 00000000000000..b6591e91137946
--- /dev/null
+++ b/patches.renesas/0940-ARM-shmobile-r8a7778-Add-SCIF-nodes.patch
@@ -0,0 +1,73 @@
+From 65d26ed10c1ba232317151b33cd8aa82f70947fe Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:27 +0200
+Subject: ARM: shmobile: r8a7778: Add SCIF nodes
+
+This describes all of the SCIF hardware of the r8a7778.
+Each node is disabled and may be enabled as necessary
+by board DTS files.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 9930dc8ee1f59271a54ed4b4922c9c944625a8d6)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7778.dtsi | 42 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 42 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
+index 3af0a2187493..ecfdf4b01b5a 100644
+--- a/arch/arm/boot/dts/r8a7778.dtsi
++++ b/arch/arm/boot/dts/r8a7778.dtsi
+@@ -156,6 +156,48 @@
+ status = "disabled";
+ };
+
++ scif0: serial@ffe40000 {
++ compatible = "renesas,scif-r8a7778", "renesas,scif";
++ reg = <0xffe40000 0x100>;
++ interrupts = <0 70 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scif1: serial@ffe41000 {
++ compatible = "renesas,scif-r8a7778", "renesas,scif";
++ reg = <0xffe41000 0x100>;
++ interrupts = <0 71 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scif2: serial@ffe42000 {
++ compatible = "renesas,scif-r8a7778", "renesas,scif";
++ reg = <0xffe42000 0x100>;
++ interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scif3: serial@ffe43000 {
++ compatible = "renesas,scif-r8a7778", "renesas,scif";
++ reg = <0xffe43000 0x100>;
++ interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scif4: serial@ffe44000 {
++ compatible = "renesas,scif-r8a7778", "renesas,scif";
++ reg = <0xffe44000 0x100>;
++ interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scif5: serial@ffe45000 {
++ compatible = "renesas,scif-r8a7778", "renesas,scif";
++ reg = <0xffe45000 0x100>;
++ interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
+ mmcif: mmc@ffe4e000 {
+ compatible = "renesas,sh-mmcif";
+ reg = <0xffe4e000 0x100>;
+--
+2.1.2
+
diff --git a/patches.renesas/0941-ARM-shmobile-bockw-reference-Initialise-SCIF-device-.patch b/patches.renesas/0941-ARM-shmobile-bockw-reference-Initialise-SCIF-device-.patch
new file mode 100644
index 00000000000000..91d5a6be9a50e8
--- /dev/null
+++ b/patches.renesas/0941-ARM-shmobile-bockw-reference-Initialise-SCIF-device-.patch
@@ -0,0 +1,86 @@
+From 18893e720f51fa234c10faefee1f62aba4c9289e Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:28 +0200
+Subject: ARM: shmobile: bockw-reference: Initialise SCIF device using DT
+
+Initialise SCIF device using DT when booting bockw
+using DT reference.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 5be97ca4a4f6e11c4a839ec3c08dea25589dfeb4)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7778-bockw-reference.dts | 14 +++++++++++---
+ arch/arm/mach-shmobile/setup-r8a7778.c | 12 ++++++------
+ 2 files changed, 17 insertions(+), 9 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+index f76f6ec01e19..3342c74c5de8 100644
+--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
++++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+@@ -23,6 +23,10 @@
+ model = "bockw";
+ compatible = "renesas,bockw-reference", "renesas,r8a7778";
+
++ aliases {
++ serial0 = &scif0;
++ };
++
+ chosen {
+ bootargs = "console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
+ };
+@@ -70,9 +74,6 @@
+ };
+
+ &pfc {
+- pinctrl-0 = <&scif0_pins>;
+- pinctrl-names = "default";
+-
+ scif0_pins: serial0 {
+ renesas,groups = "scif0_data_a", "scif0_ctrl";
+ renesas,function = "scif0";
+@@ -124,3 +125,10 @@
+ };
+ };
+ };
++
++&scif0 {
++ pinctrl-0 = <&scif0_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++};
+diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
+index 13512e97cd05..8d832640202e 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7778.c
++++ b/arch/arm/mach-shmobile/setup-r8a7778.c
+@@ -294,12 +294,6 @@ void __init r8a7778_add_dt_devices(void)
+ }
+ #endif
+
+- r8a7778_register_scif(0);
+- r8a7778_register_scif(1);
+- r8a7778_register_scif(2);
+- r8a7778_register_scif(3);
+- r8a7778_register_scif(4);
+- r8a7778_register_scif(5);
+ r8a7778_register_tmu(0);
+ }
+
+@@ -508,6 +502,12 @@ static void __init r8a7778_register_hpb_dmae(void)
+ void __init r8a7778_add_standard_devices(void)
+ {
+ r8a7778_add_dt_devices();
++ r8a7778_register_scif(0);
++ r8a7778_register_scif(1);
++ r8a7778_register_scif(2);
++ r8a7778_register_scif(3);
++ r8a7778_register_scif(4);
++ r8a7778_register_scif(5);
+ r8a7778_register_i2c(0);
+ r8a7778_register_i2c(1);
+ r8a7778_register_i2c(2);
+--
+2.1.2
+
diff --git a/patches.renesas/0942-ARM-shmobile-r8a73a4-Add-SCIF-nodes.patch b/patches.renesas/0942-ARM-shmobile-r8a73a4-Add-SCIF-nodes.patch
new file mode 100644
index 00000000000000..aca04036ea381c
--- /dev/null
+++ b/patches.renesas/0942-ARM-shmobile-r8a73a4-Add-SCIF-nodes.patch
@@ -0,0 +1,72 @@
+From e7e76773c1cf4962f6eed2fd9e8311de229d0772 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:33 +0200
+Subject: ARM: shmobile: r8a73a4: Add SCIF nodes
+
+This describes all of the SCIF hardware of the r8a73a4.
+Each node is disabled and may be enabled as necessary
+by board DTS files.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 94f1a03db6988c64601dc84eaf6c8ef1b956d9e7)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a73a4.dtsi | 42 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 42 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
+index 82c5ac825386..d8ec5058c351 100644
+--- a/arch/arm/boot/dts/r8a73a4.dtsi
++++ b/arch/arm/boot/dts/r8a73a4.dtsi
+@@ -252,6 +252,48 @@
+ status = "disabled";
+ };
+
++ scifa0: serial@e6c40000 {
++ compatible = "renesas,scifa-r8a73a4", "renesas,scifa";
++ reg = <0 0xe6c40000 0 0x100>;
++ interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa1: serial@e6c50000 {
++ compatible = "renesas,scifa-r8a73a4", "renesas,scifa";
++ reg = <0 0xe6c50000 0 0x100>;
++ interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifb2: serial@e6c20000 {
++ compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
++ reg = <0 0xe6c20000 0 0x100>;
++ interrupts = <0 148 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifb3: serial@e6c30000 {
++ compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
++ reg = <0 0xe6c30000 0 0x100>;
++ interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifb4: serial@e6ce0000 {
++ compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
++ reg = <0 0xe6ce0000 0 0x100>;
++ interrupts = <0 150 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifb5: serial@e6cf0000 {
++ compatible = "renesas,scifb-r8a73a4", "renesas,scifb";
++ reg = <0 0xe6cf0000 0 0x100>;
++ interrupts = <0 151 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
+ mmcif0: mmc@ee200000 {
+ compatible = "renesas,sh-mmcif";
+ reg = <0 0xee200000 0 0x80>;
+--
+2.1.2
+
diff --git a/patches.renesas/0943-ARM-shmobile-ape6evm-reference-Initialise-SCIF-devic.patch b/patches.renesas/0943-ARM-shmobile-ape6evm-reference-Initialise-SCIF-devic.patch
new file mode 100644
index 00000000000000..7d76f766cc087c
--- /dev/null
+++ b/patches.renesas/0943-ARM-shmobile-ape6evm-reference-Initialise-SCIF-devic.patch
@@ -0,0 +1,88 @@
+From c4f2c70af4d2630926e6f599cee1b933d412467a Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:34 +0200
+Subject: ARM: shmobile: ape6evm-reference: Initialise SCIF device using DT
+
+Initialise SCIF device using DT when booting ape6evm
+using DT reference.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 27bc82353a3f214a383d7f3b1ccaefdb70d6c94f)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts | 14 +++++++++++---
+ arch/arm/mach-shmobile/setup-r8a73a4.c | 12 ++++++------
+ 2 files changed, 17 insertions(+), 9 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
+index 70b1fff8f4a3..a860f32bca27 100644
+--- a/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
++++ b/arch/arm/boot/dts/r8a73a4-ape6evm-reference.dts
+@@ -16,6 +16,10 @@
+ model = "APE6EVM";
+ compatible = "renesas,ape6evm-reference", "renesas,r8a73a4";
+
++ aliases {
++ serial0 = &scifa0;
++ };
++
+ chosen {
+ bootargs = "console=ttySC0,115200 ignore_loglevel rw";
+ };
+@@ -90,9 +94,6 @@
+ };
+
+ &pfc {
+- pinctrl-0 = <&scifa0_pins>;
+- pinctrl-names = "default";
+-
+ scifa0_pins: serial0 {
+ renesas,groups = "scifa0_data";
+ renesas,function = "scifa0";
+@@ -123,6 +124,13 @@
+ status = "okay";
+ };
+
++&scifa0 {
++ pinctrl-0 = <&scifa0_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++};
++
+ &sdhi0 {
+ vmmc-supply = <&vcc_sdhi0>;
+ bus-width = <4>;
+diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
+index f470b3cc0b7b..2e1ec5e52b66 100644
+--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
++++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
+@@ -189,12 +189,6 @@ static struct resource cmt1_resources[] = {
+
+ void __init r8a73a4_add_dt_devices(void)
+ {
+- r8a73a4_register_scif(0);
+- r8a73a4_register_scif(1);
+- r8a73a4_register_scif(2);
+- r8a73a4_register_scif(3);
+- r8a73a4_register_scif(4);
+- r8a73a4_register_scif(5);
+ r8a7790_register_cmt(1);
+ }
+
+@@ -289,6 +283,12 @@ static struct resource dma_resources[] = {
+ void __init r8a73a4_add_standard_devices(void)
+ {
+ r8a73a4_add_dt_devices();
++ r8a73a4_register_scif(0);
++ r8a73a4_register_scif(1);
++ r8a73a4_register_scif(2);
++ r8a73a4_register_scif(3);
++ r8a73a4_register_scif(4);
++ r8a73a4_register_scif(5);
+ r8a73a4_register_irqc(0);
+ r8a73a4_register_irqc(1);
+ r8a73a4_register_thermal();
+--
+2.1.2
+
diff --git a/patches.renesas/0944-ARM-shmobile-r8a7740-Add-SCIF-nodes.patch b/patches.renesas/0944-ARM-shmobile-r8a7740-Add-SCIF-nodes.patch
new file mode 100644
index 00000000000000..585aeefa617e2d
--- /dev/null
+++ b/patches.renesas/0944-ARM-shmobile-r8a7740-Add-SCIF-nodes.patch
@@ -0,0 +1,93 @@
+From d73089e4fbc63e71554d8fa880122d8b7650314f Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:41 +0200
+Subject: ARM: shmobile: r8a7740: Add SCIF nodes
+
+This describes all of the SCIF hardware of the r8a7740.
+Each node is disabled and may be enabled as necessary
+by board DTS files.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit fa12355b24a430729f34c349473b9c0a3d125679)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7740.dtsi | 63 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 63 insertions(+)
+
+diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
+index 55d29f4d2ed6..bda18fb3d9e5 100644
+--- a/arch/arm/boot/dts/r8a7740.dtsi
++++ b/arch/arm/boot/dts/r8a7740.dtsi
+@@ -156,6 +156,69 @@
+ status = "disabled";
+ };
+
++ scifa0: serial@e6c40000 {
++ compatible = "renesas,scifa-r8a7740", "renesas,scifa";
++ reg = <0xe6c40000 0x100>;
++ interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa1: serial@e6c50000 {
++ compatible = "renesas,scifa-r8a7740", "renesas,scifa";
++ reg = <0xe6c50000 0x100>;
++ interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa2: serial@e6c60000 {
++ compatible = "renesas,scifa-r8a7740", "renesas,scifa";
++ reg = <0xe6c60000 0x100>;
++ interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa3: serial@e6c70000 {
++ compatible = "renesas,scifa-r8a7740", "renesas,scifa";
++ reg = <0xe6c70000 0x100>;
++ interrupts = <0 103 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa4: serial@e6c80000 {
++ compatible = "renesas,scifa-r8a7740", "renesas,scifa";
++ reg = <0xe6c80000 0x100>;
++ interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa5: serial@e6cb0000 {
++ compatible = "renesas,scifa-r8a7740", "renesas,scifa";
++ reg = <0xe6cb0000 0x100>;
++ interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa6: serial@e6cc0000 {
++ compatible = "renesas,scifa-r8a7740", "renesas,scifa";
++ reg = <0xe6cc0000 0x100>;
++ interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa7: serial@e6cd0000 {
++ compatible = "renesas,scifa-r8a7740", "renesas,scifa";
++ reg = <0xe6cd0000 0x100>;
++ interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifb8: serial@e6c30000 {
++ compatible = "renesas,scifb-r8a7740", "renesas,scifb";
++ reg = <0xe6c30000 0x100>;
++ interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
+ pfc: pfc@e6050000 {
+ compatible = "renesas,pfc-r8a7740";
+ reg = <0xe6050000 0x8000>,
+--
+2.1.2
+
diff --git a/patches.renesas/0945-ARM-shmobile-armadillo800eva-reference-Initialise-SC.patch b/patches.renesas/0945-ARM-shmobile-armadillo800eva-reference-Initialise-SC.patch
new file mode 100644
index 00000000000000..a3b9fb35860356
--- /dev/null
+++ b/patches.renesas/0945-ARM-shmobile-armadillo800eva-reference-Initialise-SC.patch
@@ -0,0 +1,85 @@
+From 897abc538754f1141514e4a8a81036ef3c0fdcfa Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:42 +0200
+Subject: ARM: shmobile: armadillo800eva-reference: Initialise SCIF device
+ using DT
+
+Initialise SCIF device using DT when booting armadillo800eva
+using DT reference.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit c4fac6f2f92331fa5788811357f8b8c3352e5ad8)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts | 14 +++++++++++---
+ arch/arm/mach-shmobile/setup-r8a7740.c | 8 ++++----
+ 2 files changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+index ba2e1806b3ad..ee9e7d5c97a9 100644
+--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
++++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+@@ -19,6 +19,10 @@
+ model = "armadillo 800 eva reference";
+ compatible = "renesas,armadillo800eva-reference", "renesas,r8a7740";
+
++ aliases {
++ serial1 = &scifa1;
++ };
++
+ chosen {
+ bootargs = "console=tty0 console=ttySC1,115200 ignore_loglevel root=/dev/nfs ip=dhcp rw";
+ };
+@@ -202,9 +206,6 @@
+ };
+
+ &pfc {
+- pinctrl-0 = <&scifa1_pins>;
+- pinctrl-names = "default";
+-
+ ether_pins: ether {
+ renesas,groups = "gether_mii", "gether_int";
+ renesas,function = "gether";
+@@ -256,6 +257,13 @@
+ status = "okay";
+ };
+
++&scifa1 {
++ pinctrl-0 = <&scifa1_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++};
++
+ &sdhi0 {
+ pinctrl-0 = <&sdhi0_pins>;
+ pinctrl-names = "default";
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index 348af358a239..3d5eacaba3e6 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -312,6 +312,10 @@ static struct platform_device ipmmu_device = {
+ };
+
+ static struct platform_device *r8a7740_devices_dt[] __initdata = {
++ &cmt1_device,
++};
++
++static struct platform_device *r8a7740_early_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &scif2_device,
+@@ -321,10 +325,6 @@ static struct platform_device *r8a7740_devices_dt[] __initdata = {
+ &scif6_device,
+ &scif7_device,
+ &scif8_device,
+- &cmt1_device,
+-};
+-
+-static struct platform_device *r8a7740_early_devices[] __initdata = {
+ &irqpin0_device,
+ &irqpin1_device,
+ &irqpin2_device,
+--
+2.1.2
+
diff --git a/patches.renesas/0946-ARM-shmobile-sh73a0-Add-SCIF-nodes.patch b/patches.renesas/0946-ARM-shmobile-sh73a0-Add-SCIF-nodes.patch
new file mode 100644
index 00000000000000..cd13451da90ce1
--- /dev/null
+++ b/patches.renesas/0946-ARM-shmobile-sh73a0-Add-SCIF-nodes.patch
@@ -0,0 +1,102 @@
+From 722f599a781e8223bbd77a226904696d09c332ee Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:51 +0200
+Subject: ARM: shmobile: sh73a0: Add SCIF nodes
+
+This describes all of the SCIF hardware of the sh73a0.
+Each node is disabled and may be enabled as necessary
+by board DTS files.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 2131421b85c9f25082a2b0ec371c7ad0c47cc943)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/sh73a0.dtsi | 72 +++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 72 insertions(+)
+
+diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
+index 5ecf552e1c00..910b79079d5a 100644
+--- a/arch/arm/boot/dts/sh73a0.dtsi
++++ b/arch/arm/boot/dts/sh73a0.dtsi
+@@ -235,6 +235,78 @@
+ status = "disabled";
+ };
+
++ scifa0: serial@e6c40000 {
++ compatible = "renesas,scifa-sh73a0", "renesas,scifa";
++ reg = <0xe6c40000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa1: serial@e6c50000 {
++ compatible = "renesas,scifa-sh73a0", "renesas,scifa";
++ reg = <0xe6c50000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa2: serial@e6c60000 {
++ compatible = "renesas,scifa-sh73a0", "renesas,scifa";
++ reg = <0xe6c60000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa3: serial@e6c70000 {
++ compatible = "renesas,scifa-sh73a0", "renesas,scifa";
++ reg = <0xe6c70000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa4: serial@e6c80000 {
++ compatible = "renesas,scifa-sh73a0", "renesas,scifa";
++ reg = <0xe6c80000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa5: serial@e6cb0000 {
++ compatible = "renesas,scifa-sh73a0", "renesas,scifa";
++ reg = <0xe6cb0000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa6: serial@e6cc0000 {
++ compatible = "renesas,scifa-sh73a0", "renesas,scifa";
++ reg = <0xe6cc0000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifa7: serial@e6cd0000 {
++ compatible = "renesas,scifa-sh73a0", "renesas,scifa";
++ reg = <0xe6cd0000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 143 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
++ scifb8: serial@e6c30000 {
++ compatible = "renesas,scifb-sh73a0", "renesas,scifb";
++ reg = <0xe6c30000 0x100>;
++ interrupt-parent = <&gic>;
++ interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
++ status = "disabled";
++ };
++
+ pfc: pfc@e6050000 {
+ compatible = "renesas,pfc-sh73a0";
+ reg = <0xe6050000 0x8000>,
+--
+2.1.2
+
diff --git a/patches.renesas/0947-ARM-shmobile-kzm9g-reference-Initialise-SCIF-device-.patch b/patches.renesas/0947-ARM-shmobile-kzm9g-reference-Initialise-SCIF-device-.patch
new file mode 100644
index 00000000000000..488b072e7b1c1f
--- /dev/null
+++ b/patches.renesas/0947-ARM-shmobile-kzm9g-reference-Initialise-SCIF-device-.patch
@@ -0,0 +1,84 @@
+From c57b5958aeae76519e698eee1fcdcf9e4c790259 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:52 +0200
+Subject: ARM: shmobile: kzm9g-reference: Initialise SCIF device using DT
+
+Initialise SCIF device using DT when booting armadillo800eva
+using DT reference.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 700ce7c2bb2a4963472d95eba1436d6b0945918e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/sh73a0-kzm9g-reference.dts | 14 +++++++++++---
+ arch/arm/mach-shmobile/setup-sh73a0.c | 8 ++++----
+ 2 files changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+index 838f93e44452..18662aec2ec4 100644
+--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
++++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+@@ -21,6 +21,10 @@
+ model = "KZM-A9-GT";
+ compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
+
++ aliases {
++ serial4 = &scifa4;
++ };
++
+ cpus {
+ cpu@0 {
+ cpu0-supply = <&vdd_dvfs>;
+@@ -276,9 +280,6 @@
+ };
+
+ &pfc {
+- pinctrl-0 = <&scifa4_pins>;
+- pinctrl-names = "default";
+-
+ i2c3_pins: i2c3 {
+ renesas,groups = "i2c3_1";
+ renesas,function = "i2c3";
+@@ -318,6 +319,13 @@
+ };
+ };
+
++&scifa4 {
++ pinctrl-0 = <&scifa4_pins>;
++ pinctrl-names = "default";
++
++ status = "okay";
++};
++
+ &sdhi0 {
+ pinctrl-0 = <&sdhi0_pins>;
+ pinctrl-names = "default";
+diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
+index 224882151667..2c802ae9b241 100644
+--- a/arch/arm/mach-shmobile/setup-sh73a0.c
++++ b/arch/arm/mach-shmobile/setup-sh73a0.c
+@@ -697,6 +697,10 @@ static struct platform_device irqpin3_device = {
+ };
+
+ static struct platform_device *sh73a0_devices_dt[] __initdata = {
++ &cmt1_device,
++};
++
++static struct platform_device *sh73a0_early_devices[] __initdata = {
+ &scif0_device,
+ &scif1_device,
+ &scif2_device,
+@@ -706,10 +710,6 @@ static struct platform_device *sh73a0_devices_dt[] __initdata = {
+ &scif6_device,
+ &scif7_device,
+ &scif8_device,
+- &cmt1_device,
+-};
+-
+-static struct platform_device *sh73a0_early_devices[] __initdata = {
+ &tmu0_device,
+ &ipmmu_device,
+ };
+--
+2.1.2
+
diff --git a/patches.renesas/0948-ARM-shmobile-r8a7778-add-TMU-clock-support-for-DT.patch b/patches.renesas/0948-ARM-shmobile-r8a7778-add-TMU-clock-support-for-DT.patch
new file mode 100644
index 00000000000000..bab0ef46a7e926
--- /dev/null
+++ b/patches.renesas/0948-ARM-shmobile-r8a7778-add-TMU-clock-support-for-DT.patch
@@ -0,0 +1,33 @@
+From 4cfd5ece5f6600e492ab0f6308fdf0f37838ed64 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:29 +0200
+Subject: ARM: shmobile: r8a7778: add TMU clock support for DT
+
+This will be used when initialising TMU devices using DT
+until common clock framework support is added.
+
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 0985f38d1379291c8701572e761c809f0d5f6476)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7778.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
+index 95579073cfce..67980a08a601 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7778.c
++++ b/arch/arm/mach-shmobile/clock-r8a7778.c
+@@ -244,7 +244,9 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_ICK_ID("src.7", "rcar_sound", &mstp_clks[MSTP524]),
+ CLKDEV_ICK_ID("src.8", "rcar_sound", &mstp_clks[MSTP523]),
+ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP016]),
++ CLKDEV_ICK_ID("fck", "ffd80000.timer", &mstp_clks[MSTP016]),
+ CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP015]),
++ CLKDEV_ICK_ID("fck", "ffd81000.timer", &mstp_clks[MSTP015]),
+ };
+
+ void __init r8a7778_clock_init(void)
+--
+2.1.2
+
diff --git a/patches.renesas/0949-ARM-shmobile-r8a7740-add-TMU-clock-support-for-DT.patch b/patches.renesas/0949-ARM-shmobile-r8a7740-add-TMU-clock-support-for-DT.patch
new file mode 100644
index 00000000000000..750cafbc5a64e3
--- /dev/null
+++ b/patches.renesas/0949-ARM-shmobile-r8a7740-add-TMU-clock-support-for-DT.patch
@@ -0,0 +1,32 @@
+From 78ccb5f24322e9ee1aed19432fa593170da2c8f1 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:43 +0200
+Subject: ARM: shmobile: r8a7740: add TMU clock support for DT
+
+This will be used when initialising TMU devices using DT
+until common clock framework support is added.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit ef9cb75ca70c8d31b2493d1fd6cbf8b3dd1dec95)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7740.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+index a60c324df64e..b4ecbd697140 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7740.c
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -599,7 +599,9 @@ static struct clk_lookup lookups[] = {
+
+ /* ICK */
+ CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP111]),
++ CLKDEV_ICK_ID("fck", "fff90000.timer", &mstp_clks[MSTP111]),
+ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]),
++ CLKDEV_ICK_ID("fck", "fff80000.timer", &mstp_clks[MSTP125]),
+ CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]),
+ CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]),
+ CLKDEV_ICK_ID("func", "renesas_usbhs", &mstp_clks[MSTP407]),
+--
+2.1.2
+
diff --git a/patches.renesas/0950-ARM-shmobile-r8a73a4-add-CMT1-clock-support-for-DT.patch b/patches.renesas/0950-ARM-shmobile-r8a73a4-add-CMT1-clock-support-for-DT.patch
new file mode 100644
index 00000000000000..055661a4b3e805
--- /dev/null
+++ b/patches.renesas/0950-ARM-shmobile-r8a73a4-add-CMT1-clock-support-for-DT.patch
@@ -0,0 +1,30 @@
+From 9a077784f332c5529741979f1d4424fb86c13421 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:35 +0200
+Subject: ARM: shmobile: r8a73a4: add CMT1 clock support for DT
+
+This will be used when initialising CMT1 device using DT
+until common clock framework support is added.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit aad64dc31954dbbb84cd8fcfaf1bc028f3bc2616)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a73a4.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
+index 49d139748aa6..c2330ea1802c 100644
+--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
++++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
+@@ -604,6 +604,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_DEV_ID("e6500000.i2c", &mstp_clks[MSTP318]),
+ CLKDEV_DEV_ID("e6510000.i2c", &mstp_clks[MSTP323]),
+ CLKDEV_ICK_ID("fck", "sh-cmt-48-gen2.1", &mstp_clks[MSTP329]),
++ CLKDEV_ICK_ID("fck", "e6130000.timer", &mstp_clks[MSTP329]),
+ CLKDEV_DEV_ID("e60b0000.i2c", &mstp_clks[MSTP409]),
+ CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP410]),
+ CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP411]),
+--
+2.1.2
+
diff --git a/patches.renesas/0951-ARM-shmobile-r8a7740-add-CMT1-clock-support-for-DT.patch b/patches.renesas/0951-ARM-shmobile-r8a7740-add-CMT1-clock-support-for-DT.patch
new file mode 100644
index 00000000000000..f5473a35b05b5c
--- /dev/null
+++ b/patches.renesas/0951-ARM-shmobile-r8a7740-add-CMT1-clock-support-for-DT.patch
@@ -0,0 +1,30 @@
+From 13b829387674568717c605b28670ba0543cdfaa8 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:46 +0200
+Subject: ARM: shmobile: r8a7740: add CMT1 clock support for DT
+
+This will be used when initialising CMT1 device using DT
+until common clock framework support is added.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 2e11179da78a56c2a44fc3fe097f2af8dc18f9d6)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7740.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+index b4ecbd697140..0794f0426e70 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7740.c
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -603,6 +603,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]),
+ CLKDEV_ICK_ID("fck", "fff80000.timer", &mstp_clks[MSTP125]),
+ CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]),
++ CLKDEV_ICK_ID("fck", "e6138000.timer", &mstp_clks[MSTP329]),
+ CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]),
+ CLKDEV_ICK_ID("func", "renesas_usbhs", &mstp_clks[MSTP407]),
+ CLKDEV_ICK_ID("phy", "renesas_usbhs", &mstp_clks[MSTP406]),
+--
+2.1.2
+
diff --git a/patches.renesas/0952-ARM-shmobile-sh73a0-add-CMT1-clock-support-for-DT.patch b/patches.renesas/0952-ARM-shmobile-sh73a0-add-CMT1-clock-support-for-DT.patch
new file mode 100644
index 00000000000000..e88d9ee4c388c8
--- /dev/null
+++ b/patches.renesas/0952-ARM-shmobile-sh73a0-add-CMT1-clock-support-for-DT.patch
@@ -0,0 +1,30 @@
+From e5826d6e3b7becf646c53f52d02b0771e835591c Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Mon, 7 Jul 2014 09:54:53 +0200
+Subject: ARM: shmobile: sh73a0: add CMT1 clock support for DT
+
+This will be used when initialising CMT1 device using DT
+until common clock framework support is added.
+
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit a0f7e7496d56ac2da7c684e2035815318c17973a)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-sh73a0.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
+index 9433a4e2c88e..d8c4048b9e33 100644
+--- a/arch/arm/mach-shmobile/clock-sh73a0.c
++++ b/arch/arm/mach-shmobile/clock-sh73a0.c
+@@ -690,6 +690,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
+ CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
+ CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]), /* CMT1 */
++ CLKDEV_ICK_ID("fck", "e6138000.timer", &mstp_clks[MSTP329]), /* CMT1 */
+ CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]), /* TMU0 */
+ };
+
+--
+2.1.2
+
diff --git a/patches.renesas/0953-ARM-shmobile-genmai-remove-defconfig.patch b/patches.renesas/0953-ARM-shmobile-genmai-remove-defconfig.patch
new file mode 100644
index 00000000000000..4fd97229befb14
--- /dev/null
+++ b/patches.renesas/0953-ARM-shmobile-genmai-remove-defconfig.patch
@@ -0,0 +1,149 @@
+From 09a59ddf51852d6bf7945e0d45858e9e96dcc121 Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Tue, 15 Jul 2014 16:29:24 +0900
+Subject: ARM: shmobile: genmai: remove defconfig
+
+The genmai board code is scheduled for removal and once
+that occurs the defconfig will be of no use. Remove it.
+
+Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Acked-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 3ed27bd90d6d0c8b4d686a2468b6d50cc1ef74e4)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/configs/genmai_defconfig | 122 --------------------------------------
+ 1 file changed, 122 deletions(-)
+ delete mode 100644 arch/arm/configs/genmai_defconfig
+
+diff --git a/arch/arm/configs/genmai_defconfig b/arch/arm/configs/genmai_defconfig
+deleted file mode 100644
+index d238fafb6762..000000000000
+--- a/arch/arm/configs/genmai_defconfig
++++ /dev/null
+@@ -1,122 +0,0 @@
+-CONFIG_SYSVIPC=y
+-CONFIG_NO_HZ=y
+-CONFIG_IKCONFIG=y
+-CONFIG_IKCONFIG_PROC=y
+-CONFIG_LOG_BUF_SHIFT=16
+-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+-CONFIG_SYSCTL_SYSCALL=y
+-CONFIG_EMBEDDED=y
+-CONFIG_PERF_EVENTS=y
+-CONFIG_SLAB=y
+-# CONFIG_LBDAF is not set
+-# CONFIG_BLK_DEV_BSG is not set
+-# CONFIG_IOSCHED_DEADLINE is not set
+-# CONFIG_IOSCHED_CFQ is not set
+-CONFIG_ARCH_SHMOBILE_LEGACY=y
+-CONFIG_ARCH_R7S72100=y
+-CONFIG_MACH_GENMAI=y
+-# CONFIG_SH_TIMER_CMT is not set
+-# CONFIG_SH_TIMER_MTU2 is not set
+-# CONFIG_SH_TIMER_TMU is not set
+-# CONFIG_EM_TIMER_STI is not set
+-CONFIG_ARM_ERRATA_430973=y
+-CONFIG_ARM_ERRATA_458693=y
+-CONFIG_ARM_ERRATA_460075=y
+-CONFIG_ARM_ERRATA_743622=y
+-CONFIG_ARM_ERRATA_754322=y
+-CONFIG_AEABI=y
+-# CONFIG_OABI_COMPAT is not set
+-CONFIG_FORCE_MAX_ZONEORDER=13
+-CONFIG_ZBOOT_ROM_TEXT=0x0
+-CONFIG_ZBOOT_ROM_BSS=0x0
+-CONFIG_ARM_APPENDED_DTB=y
+-CONFIG_KEXEC=y
+-CONFIG_AUTO_ZRELADDR=y
+-CONFIG_VFP=y
+-CONFIG_NEON=y
+-# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+-CONFIG_PM_RUNTIME=y
+-CONFIG_NET=y
+-CONFIG_PACKET=y
+-CONFIG_UNIX=y
+-CONFIG_INET=y
+-CONFIG_IP_PNP=y
+-CONFIG_IP_PNP_DHCP=y
+-# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+-# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+-# CONFIG_INET_XFRM_MODE_BEET is not set
+-# CONFIG_INET_LRO is not set
+-# CONFIG_INET_DIAG is not set
+-# CONFIG_IPV6 is not set
+-# CONFIG_WIRELESS is not set
+-CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+-CONFIG_DEVTMPFS=y
+-CONFIG_DEVTMPFS_MOUNT=y
+-CONFIG_EEPROM_AT24=y
+-CONFIG_NETDEVICES=y
+-# CONFIG_NET_CORE is not set
+-# CONFIG_NET_VENDOR_ARC is not set
+-# CONFIG_NET_CADENCE is not set
+-# CONFIG_NET_VENDOR_BROADCOM is not set
+-# CONFIG_NET_VENDOR_CIRRUS is not set
+-# CONFIG_NET_VENDOR_FARADAY is not set
+-# CONFIG_NET_VENDOR_INTEL is not set
+-# CONFIG_NET_VENDOR_MARVELL is not set
+-# CONFIG_NET_VENDOR_MICREL is not set
+-# CONFIG_NET_VENDOR_NATSEMI is not set
+-CONFIG_SH_ETH=y
+-# CONFIG_NET_VENDOR_SEEQ is not set
+-# CONFIG_NET_VENDOR_SMSC is not set
+-# CONFIG_NET_VENDOR_STMICRO is not set
+-# CONFIG_NET_VENDOR_VIA is not set
+-# CONFIG_NET_VENDOR_WIZNET is not set
+-# CONFIG_WLAN is not set
+-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+-CONFIG_INPUT_EVDEV=y
+-# CONFIG_KEYBOARD_ATKBD is not set
+-# CONFIG_INPUT_MOUSE is not set
+-# CONFIG_SERIO is not set
+-# CONFIG_LEGACY_PTYS is not set
+-CONFIG_SERIAL_SH_SCI=y
+-CONFIG_SERIAL_SH_SCI_NR_UARTS=10
+-CONFIG_SERIAL_SH_SCI_CONSOLE=y
+-# CONFIG_HW_RANDOM is not set
+-CONFIG_I2C_CHARDEV=y
+-CONFIG_I2C_RIIC=y
+-CONFIG_SPI=y
+-CONFIG_SPI_RSPI=y
+-# CONFIG_HWMON is not set
+-CONFIG_THERMAL=y
+-CONFIG_RCAR_THERMAL=y
+-CONFIG_REGULATOR=y
+-CONFIG_REGULATOR_FIXED_VOLTAGE=y
+-CONFIG_DRM=y
+-CONFIG_DRM_RCAR_DU=y
+-# CONFIG_USB_SUPPORT is not set
+-CONFIG_MMC=y
+-CONFIG_MMC_SDHI=y
+-CONFIG_MMC_SH_MMCIF=y
+-CONFIG_NEW_LEDS=y
+-CONFIG_LEDS_CLASS=y
+-CONFIG_RTC_CLASS=y
+-CONFIG_DMADEVICES=y
+-CONFIG_SH_DMAE=y
+-# CONFIG_IOMMU_SUPPORT is not set
+-# CONFIG_DNOTIFY is not set
+-CONFIG_MSDOS_FS=y
+-CONFIG_VFAT_FS=y
+-CONFIG_TMPFS=y
+-CONFIG_CONFIGFS_FS=y
+-# CONFIG_MISC_FILESYSTEMS is not set
+-CONFIG_NFS_FS=y
+-CONFIG_NFS_V3_ACL=y
+-CONFIG_NFS_V4=y
+-CONFIG_NFS_V4_1=y
+-CONFIG_ROOT_NFS=y
+-CONFIG_NLS_CODEPAGE_437=y
+-CONFIG_NLS_ISO8859_1=y
+-# CONFIG_ENABLE_WARN_DEPRECATED is not set
+-# CONFIG_ENABLE_MUST_CHECK is not set
+-# CONFIG_ARM_UNWIND is not set
+-# CONFIG_CRYPTO_ANSI_CPRNG is not set
+-# CONFIG_CRYPTO_HW is not set
+--
+2.1.2
+
diff --git a/patches.renesas/0954-ARM-shmobile-sh73a0-Remove-spurious-0x-from-SCIFB-cl.patch b/patches.renesas/0954-ARM-shmobile-sh73a0-Remove-spurious-0x-from-SCIFB-cl.patch
new file mode 100644
index 00000000000000..6c410883a52938
--- /dev/null
+++ b/patches.renesas/0954-ARM-shmobile-sh73a0-Remove-spurious-0x-from-SCIFB-cl.patch
@@ -0,0 +1,36 @@
+From 635ca7a7f107f869ba40bc4cf507a9efec9f905f Mon Sep 17 00:00:00 2001
+From: Simon Horman <horms+renesas@verge.net.au>
+Date: Wed, 16 Jul 2014 09:11:21 +0900
+Subject: ARM: shmobile: sh73a0: Remove spurious 0x from SCIFB clock name
+
+A stray '0x' crept into a0f7e7496d56ac2d ("ARM: shmobile: sh73a0: add CMT1
+clock support for DT"). This patch removes it.
+
+This change should not have any run-time affect at this time as
+the clock in question is used by a SCIF device that is not enabled by
+default.
+
+Reported-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 2c3758b01aa6f11382d2b018614b5d48ecf30350)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-sh73a0.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
+index d8c4048b9e33..02a6f45a0b9e 100644
+--- a/arch/arm/mach-shmobile/clock-sh73a0.c
++++ b/arch/arm/mach-shmobile/clock-sh73a0.c
+@@ -644,7 +644,7 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
+ CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]), /* SCIFA5 */
+ CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */
+- CLKDEV_DEV_ID("0xe6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */
++ CLKDEV_DEV_ID("e6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */
+ CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
+ CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]), /* SCIFA0 */
+ CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
+--
+2.1.2
+
diff --git a/patches.renesas/0955-ARM-shmobile-defconfig-Remove-MACH_GENMAI.patch b/patches.renesas/0955-ARM-shmobile-defconfig-Remove-MACH_GENMAI.patch
new file mode 100644
index 00000000000000..c633181615602f
--- /dev/null
+++ b/patches.renesas/0955-ARM-shmobile-defconfig-Remove-MACH_GENMAI.patch
@@ -0,0 +1,33 @@
+From fa4798501222356ef9b8983f6ee4d87839d78442 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Wed, 16 Jul 2014 14:02:56 +0200
+Subject: ARM: shmobile: defconfig: Remove MACH_GENMAI
+
+The CONFIG_MACH_GENMAI is scheduled for removal so remove it from
+shmobile_defconfig.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+[horms+renesas@verge.net.au: revised changelog for updated commit order]
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+
+(cherry picked from commit 92db2b7af591d3c3212183a34856b4cb190b6999)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/configs/shmobile_defconfig | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
+index 6bc85a5539f1..3b136144cc83 100644
+--- a/arch/arm/configs/shmobile_defconfig
++++ b/arch/arm/configs/shmobile_defconfig
+@@ -14,7 +14,6 @@ CONFIG_ARCH_R7S72100=y
+ CONFIG_ARCH_R8A7779=y
+ CONFIG_ARCH_R8A7790=y
+ CONFIG_ARCH_R8A7791=y
+-CONFIG_MACH_GENMAI=y
+ CONFIG_MACH_KOELSCH=y
+ CONFIG_MACH_LAGER=y
+ CONFIG_MACH_MARZEN=y
+--
+2.1.2
+
diff --git a/patches.renesas/0956-ARM-shmobile-r8a7790-add-missing-0x0100-for-SDCKCR.patch b/patches.renesas/0956-ARM-shmobile-r8a7790-add-missing-0x0100-for-SDCKCR.patch
new file mode 100644
index 00000000000000..d0279ad0bd5c9c
--- /dev/null
+++ b/patches.renesas/0956-ARM-shmobile-r8a7790-add-missing-0x0100-for-SDCKCR.patch
@@ -0,0 +1,41 @@
+From dfc99117fd2af4fa1f1d71b5e55d21ae2540da65 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 5 Aug 2014 18:24:30 -0700
+Subject: ARM: shmobile: r8a7790: add missing 0x0100 for SDCKCR
+
+9f13ee6f83c52065112d3e396e42e3780911ef53
+(ARM: shmobile: r8a7790: add div4 clocks)
+added r8a7790 DIV4 clock support.
+
+But, it is missing
+"0x0100: x 1/8" division ratio.
+This patch fixes hidden bug.
+It is based on R-Car H2 v0.7, R-Car M2 v0.9.
+
+Reported-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 4fb12fe9c34928c1d2bed817e144aec3f44540e9)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7790.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
+index 17435c1aa2fe..126ddafad526 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7790.c
++++ b/arch/arm/mach-shmobile/clock-r8a7790.c
+@@ -183,8 +183,8 @@ enum {
+
+ static struct clk div4_clks[DIV4_NR] = {
+ [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT),
+- [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT),
+- [DIV4_SD1] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 0, 0x1de0, CLK_ENABLE_ON_INIT),
++ [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1df0, CLK_ENABLE_ON_INIT),
++ [DIV4_SD1] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 0, 0x1df0, CLK_ENABLE_ON_INIT),
+ };
+
+ /* DIV6 clocks */
+--
+2.1.2
+
diff --git a/patches.renesas/0957-ARM-shmobile-r8a7791-add-missing-0x0100-for-SDCKCR.patch b/patches.renesas/0957-ARM-shmobile-r8a7791-add-missing-0x0100-for-SDCKCR.patch
new file mode 100644
index 00000000000000..61bbffa30a5a54
--- /dev/null
+++ b/patches.renesas/0957-ARM-shmobile-r8a7791-add-missing-0x0100-for-SDCKCR.patch
@@ -0,0 +1,39 @@
+From b05c7db5986acbf91f534b95a8cc83a7a8e48323 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 5 Aug 2014 18:24:51 -0700
+Subject: ARM: shmobile: r8a7791: add missing 0x0100 for SDCKCR
+
+4bfb358b1d6cdeff8c6a13677f01ed78e9696b98
+(ARM: shmobile: Add r8a7791 legacy SDHI clocks)
+added r8a7791 SDHI clock support.
+
+But, it is missing
+"0x0100: x 1/8" division ratio.
+This patch fixes hidden bug.
+It is based on R-Car H2 v0.7, R-Car M2 v0.9.
+
+Reported-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+(cherry picked from commit 58b80ad6472c0fa12926dfa1f9103d3a326bdf18)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7791.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
+index 10e193d707f5..453b23129cfa 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7791.c
++++ b/arch/arm/mach-shmobile/clock-r8a7791.c
+@@ -152,7 +152,7 @@ enum {
+
+ static struct clk div4_clks[DIV4_NR] = {
+ [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT),
+- [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT),
++ [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1df0, CLK_ENABLE_ON_INIT),
+ };
+
+ /* DIV6 clocks */
+--
+2.1.2
+
diff --git a/patches.renesas/0958-ARM-shmobile-koelsch-Remove-non-existent-i2c6-pinmux.patch b/patches.renesas/0958-ARM-shmobile-koelsch-Remove-non-existent-i2c6-pinmux.patch
new file mode 100644
index 00000000000000..79fc614e53c36e
--- /dev/null
+++ b/patches.renesas/0958-ARM-shmobile-koelsch-Remove-non-existent-i2c6-pinmux.patch
@@ -0,0 +1,53 @@
+From 2cd602a6cbe6839909eaf4576da861033a27656b Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Fri, 15 Aug 2014 07:19:10 +0900
+Subject: ARM: shmobile: koelsch: Remove non-existent i2c6 pinmux
+
+On r8a7791, i2c6 (aka iic3) doesn't need pinmux, but the koelsch dts
+refers to non-existent pinmux configuration data:
+
+pinmux core: sh-pfc does not support function i2c6
+sh-pfc e6060000.pfc: invalid function i2c6 in map table
+
+Remove it to fix this.
+
+Fixes: commit 1d41f36a68c0f4e9b01d563ce33bab5201858b54 ("ARM: shmobile:
+ koelsch dts: Add VDD MPU regulator for DVFS")
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+Signed-off-by: Olof Johansson <olof@lixom.net>
+(cherry picked from commit 12266db732ff3845eaa9ba9354c4938249787aaf)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ arch/arm/boot/dts/r8a7791-koelsch.dts | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
+index 23486c081a69..be59014474b2 100644
+--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
++++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
+@@ -275,11 +275,6 @@
+ renesas,function = "msiof0";
+ };
+
+- i2c6_pins: i2c6 {
+- renesas,groups = "i2c6";
+- renesas,function = "i2c6";
+- };
+-
+ usb0_pins: usb0 {
+ renesas,groups = "usb0";
+ renesas,function = "usb0";
+@@ -420,8 +415,6 @@
+ };
+
+ &i2c6 {
+- pinctrl-names = "default";
+- pinctrl-0 = <&i2c6_pins>;
+ status = "okay";
+ clock-frequency = <100000>;
+
+--
+2.1.2
+
diff --git a/patches.renesas/0960-xhci-Platform-Add-en-dis-able_usb3_lpm_timeout.patch b/patches.renesas/0960-xhci-Platform-Add-en-dis-able_usb3_lpm_timeout.patch
new file mode 100644
index 00000000000000..c3a5cde5277cd1
--- /dev/null
+++ b/patches.renesas/0960-xhci-Platform-Add-en-dis-able_usb3_lpm_timeout.patch
@@ -0,0 +1,35 @@
+From d3215f95d1320acc7b848a1bb41e111c260c7f08 Mon Sep 17 00:00:00 2001
+From: Pratyush Anand <pratyush.anand@st.com>
+Date: Fri, 4 Jul 2014 17:01:24 +0300
+Subject: xhci: Platform: Add (en/dis)able_usb3_lpm_timeout
+
+To use auto U0-U1/U2 transition by xhci platform device add
+(en/dis)able_usb3_lpm_timeout function to the xhci_plat_xhci_driver struct.
+
+Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
+Tested-by: Aymen Bouattay <aymen.bouattay@st.com>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+(cherry picked from commit 94ef3d50426240a5402688e8d43a079df5ae21be)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/host/xhci-plat.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
+index ea9e4a210c58..15a65b6ab760 100644
+--- a/drivers/usb/host/xhci-plat.c
++++ b/drivers/usb/host/xhci-plat.c
+@@ -90,6 +90,9 @@ static const struct hc_driver xhci_plat_xhci_driver = {
+ .hub_status_data = xhci_hub_status_data,
+ .bus_suspend = xhci_bus_suspend,
+ .bus_resume = xhci_bus_resume,
++
++ .enable_usb3_lpm_timeout = xhci_enable_usb3_lpm_timeout,
++ .disable_usb3_lpm_timeout = xhci_disable_usb3_lpm_timeout,
+ };
+
+ static int xhci_plat_probe(struct platform_device *pdev)
+--
+2.1.2
+
diff --git a/patches.renesas/0961-xhci-Platform-Set-xhci-lpm-support-quirk-based-on-pl.patch b/patches.renesas/0961-xhci-Platform-Set-xhci-lpm-support-quirk-based-on-pl.patch
new file mode 100644
index 00000000000000..7ff8dcca4d25cf
--- /dev/null
+++ b/patches.renesas/0961-xhci-Platform-Set-xhci-lpm-support-quirk-based-on-pl.patch
@@ -0,0 +1,102 @@
+From 4ef80e75dc148ee391f19e23c0c8fd38d2cb53aa Mon Sep 17 00:00:00 2001
+From: Pratyush Anand <pratyush.anand@st.com>
+Date: Fri, 4 Jul 2014 17:01:25 +0300
+Subject: xhci: Platform: Set xhci lpm support quirk based on platform data
+
+If an xhci platform supports USB3 LPM capability then enable
+XHCI_LPM_SUPPORT quirk flag.
+
+Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+(cherry picked from commit 20f6fdd01c2c0de9cc1109083222edded24c5350)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ Documentation/devicetree/bindings/usb/usb-xhci.txt | 3 ++-
+ drivers/usb/host/xhci-plat.c | 6 +++++
+ include/linux/usb/xhci_pdriver.h | 27 ++++++++++++++++++++++
+ 3 files changed, 35 insertions(+), 1 deletion(-)
+ create mode 100644 include/linux/usb/xhci_pdriver.h
+
+diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt
+index 5a79377c6a96..86f67f0886bc 100644
+--- a/Documentation/devicetree/bindings/usb/usb-xhci.txt
++++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt
+@@ -9,8 +9,9 @@ Required properties:
+ register set for the device.
+ - interrupts: one XHCI interrupt should be described here.
+
+-Optional property:
++Optional properties:
+ - clocks: reference to a clock
++ - usb3-lpm-capable: determines if platform is USB3 LPM capable
+
+ Example:
+ usb@f0931000 {
+diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
+index 15a65b6ab760..e41e4b476ee3 100644
+--- a/drivers/usb/host/xhci-plat.c
++++ b/drivers/usb/host/xhci-plat.c
+@@ -17,6 +17,7 @@
+ #include <linux/of.h>
+ #include <linux/platform_device.h>
+ #include <linux/slab.h>
++#include <linux/usb/xhci_pdriver.h>
+
+ #include "xhci.h"
+ #include "xhci-mvebu.h"
+@@ -97,6 +98,8 @@ static const struct hc_driver xhci_plat_xhci_driver = {
+
+ static int xhci_plat_probe(struct platform_device *pdev)
+ {
++ struct device_node *node = pdev->dev.of_node;
++ struct usb_xhci_pdata *pdata = dev_get_platdata(&pdev->dev);
+ const struct hc_driver *driver;
+ struct xhci_hcd *xhci;
+ struct resource *res;
+@@ -185,6 +188,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
+ goto dealloc_usb2_hcd;
+ }
+
++ if ((node && of_property_read_bool(node, "usb3-lpm-capable")) ||
++ (pdata && pdata->usb3_lpm_capable))
++ xhci->quirks |= XHCI_LPM_SUPPORT;
+ /*
+ * Set the xHCI pointer before xhci_plat_setup() (aka hcd_driver.reset)
+ * is called by usb_add_hcd().
+diff --git a/include/linux/usb/xhci_pdriver.h b/include/linux/usb/xhci_pdriver.h
+new file mode 100644
+index 000000000000..376654b5b0f7
+--- /dev/null
++++ b/include/linux/usb/xhci_pdriver.h
+@@ -0,0 +1,27 @@
++/*
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++ * for more details.
++ *
++ */
++
++#ifndef __USB_CORE_XHCI_PDRIVER_H
++#define __USB_CORE_XHCI_PDRIVER_H
++
++/**
++ * struct usb_xhci_pdata - platform_data for generic xhci platform driver
++ *
++ * @usb3_lpm_capable: determines if this xhci platform supports USB3
++ * LPM capability
++ *
++ */
++struct usb_xhci_pdata {
++ unsigned usb3_lpm_capable:1;
++};
++
++#endif /* __USB_CORE_XHCI_PDRIVER_H */
+--
+2.1.2
+
diff --git a/patches.renesas/0962-usb-host-xhci-plat-use-devm_functions.patch b/patches.renesas/0962-usb-host-xhci-plat-use-devm_functions.patch
new file mode 100644
index 00000000000000..56551fcdd0d581
--- /dev/null
+++ b/patches.renesas/0962-usb-host-xhci-plat-use-devm_functions.patch
@@ -0,0 +1,83 @@
+From d80fa6bee8ef019c02e7389e1ca88604938990b1 Mon Sep 17 00:00:00 2001
+From: Himangi Saraogi <himangi774@gmail.com>
+Date: Fri, 20 Jun 2014 23:11:23 +0530
+Subject: usb: host: xhci-plat: use devm_functions
+
+This patch introduces the use of managed interface devm_ioremap_resource
+for ioremap_nocache and request_mem_region and removes the corresponding
+free functions in the probe and remove functions.
+
+Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
+Acked-by: Julia Lawall <julia.lawall@lip6.fr>
+Reviewed-by: Felipe Balbi <balbi@ti.com>
+Acked-by: Felipe Balbi <balbi@ti.com>
+Cc: Mathias Nyman <mathias.nyman@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+(cherry picked from commit fd666348c51f6ab66410c98a149e0418b9a258f0)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/host/xhci-plat.c | 24 ++++--------------------
+ 1 file changed, 4 insertions(+), 20 deletions(-)
+
+diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
+index e41e4b476ee3..5cb5de1ee766 100644
+--- a/drivers/usb/host/xhci-plat.c
++++ b/drivers/usb/host/xhci-plat.c
+@@ -146,20 +146,12 @@ static int xhci_plat_probe(struct platform_device *pdev)
+ hcd->rsrc_start = res->start;
+ hcd->rsrc_len = resource_size(res);
+
+- if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
+- driver->description)) {
+- dev_dbg(&pdev->dev, "controller already in use\n");
+- ret = -EBUSY;
++ hcd->regs = devm_ioremap_resource(&pdev->dev, res);
++ if (IS_ERR(hcd->regs)) {
++ ret = PTR_ERR(hcd->regs);
+ goto put_hcd;
+ }
+
+- hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
+- if (!hcd->regs) {
+- dev_dbg(&pdev->dev, "error mapping memory\n");
+- ret = -EFAULT;
+- goto release_mem_region;
+- }
+-
+ /*
+ * Not all platforms have a clk so it is not an error if the
+ * clock does not exists.
+@@ -168,7 +160,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
+ if (!IS_ERR(clk)) {
+ ret = clk_prepare_enable(clk);
+ if (ret)
+- goto unmap_registers;
++ goto put_hcd;
+ }
+
+ ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
+@@ -213,12 +205,6 @@ disable_clk:
+ if (!IS_ERR(clk))
+ clk_disable_unprepare(clk);
+
+-unmap_registers:
+- iounmap(hcd->regs);
+-
+-release_mem_region:
+- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+-
+ put_hcd:
+ usb_put_hcd(hcd);
+
+@@ -237,8 +223,6 @@ static int xhci_plat_remove(struct platform_device *dev)
+ usb_remove_hcd(hcd);
+ if (!IS_ERR(clk))
+ clk_disable_unprepare(clk);
+- iounmap(hcd->regs);
+- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+ usb_put_hcd(hcd);
+ kfree(xhci);
+
+--
+2.1.2
+
diff --git a/patches.renesas/0963-usb-host-xhci-plat-add-support-for-the-R-Car-H2-and-.patch b/patches.renesas/0963-usb-host-xhci-plat-add-support-for-the-R-Car-H2-and-.patch
new file mode 100644
index 00000000000000..07f961b29499cf
--- /dev/null
+++ b/patches.renesas/0963-usb-host-xhci-plat-add-support-for-the-R-Car-H2-and-.patch
@@ -0,0 +1,298 @@
+From bf05fe928085a2060fc4e1d7d4bee75d500388d8 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 9 Jul 2014 10:08:52 +0900
+Subject: usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI
+ controllers
+
+The R-Car H2 and M2 SoCs come with an xHCI controller that requires
+some specific initializations related to the firmware downloading and
+some specific registers. This patch adds the support for this special
+configuration as an xHCI quirk executed during probe and start.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Cc: "mathias.nyman@intel.com" <mathias.nyman@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+(cherry picked from commit 4ac8918f3a737c21d81e250e4194c12ea2b7eb04)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/host/Kconfig | 8 +++
+ drivers/usb/host/Makefile | 3 +
+ drivers/usb/host/xhci-plat.c | 19 ++++++
+ drivers/usb/host/xhci-rcar.c | 148 +++++++++++++++++++++++++++++++++++++++++++
+ drivers/usb/host/xhci-rcar.h | 27 ++++++++
+ 5 files changed, 205 insertions(+)
+ create mode 100644 drivers/usb/host/xhci-rcar.c
+ create mode 100644 drivers/usb/host/xhci-rcar.h
+
+diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
+index ed79c7abf226..eba5893285f1 100644
+--- a/drivers/usb/host/Kconfig
++++ b/drivers/usb/host/Kconfig
+@@ -37,6 +37,14 @@ config USB_XHCI_MVEBU
+ Say 'Y' to enable the support for the xHCI host controller
+ found in Marvell Armada 375/38x ARM SOCs.
+
++config USB_XHCI_RCAR
++ tristate "xHCI support for Renesas R-Car SoCs"
++ select USB_XHCI_PLATFORM
++ depends on ARCH_SHMOBILE || COMPILE_TEST
++ ---help---
++ Say 'Y' to enable the support for the xHCI host controller
++ found in Renesas R-Car ARM SoCs.
++
+ endif # USB_XHCI_HCD
+
+ config USB_EHCI_HCD
+diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
+index 7c0886a35182..b59ca3c9415d 100644
+--- a/drivers/usb/host/Makefile
++++ b/drivers/usb/host/Makefile
+@@ -22,6 +22,9 @@ ifneq ($(CONFIG_USB_XHCI_PLATFORM), )
+ ifneq ($(CONFIG_USB_XHCI_MVEBU), )
+ xhci-hcd-y += xhci-mvebu.o
+ endif
++ifneq ($(CONFIG_USB_XHCI_RCAR), )
++ xhci-hcd-y += xhci-rcar.o
++endif
+ endif
+
+ obj-$(CONFIG_USB_WHCI_HCD) += whci/
+diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
+index 5cb5de1ee766..d1dda3334105 100644
+--- a/drivers/usb/host/xhci-plat.c
++++ b/drivers/usb/host/xhci-plat.c
+@@ -21,6 +21,7 @@
+
+ #include "xhci.h"
+ #include "xhci-mvebu.h"
++#include "xhci-rcar.h"
+
+ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
+ {
+@@ -35,11 +36,27 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
+ /* called during probe() after chip reset completes */
+ static int xhci_plat_setup(struct usb_hcd *hcd)
+ {
++ struct device_node *of_node = hcd->self.controller->of_node;
++ int ret;
++
++ if (of_device_is_compatible(of_node, "renesas,xhci-r8a7790") ||
++ of_device_is_compatible(of_node, "renesas,xhci-r8a7791")) {
++ ret = xhci_rcar_init_quirk(hcd);
++ if (ret)
++ return ret;
++ }
++
+ return xhci_gen_setup(hcd, xhci_plat_quirks);
+ }
+
+ static int xhci_plat_start(struct usb_hcd *hcd)
+ {
++ struct device_node *of_node = hcd->self.controller->of_node;
++
++ if (of_device_is_compatible(of_node, "renesas,xhci-r8a7790") ||
++ of_device_is_compatible(of_node, "renesas,xhci-r8a7791"))
++ xhci_rcar_start(hcd);
++
+ return xhci_run(hcd);
+ }
+
+@@ -260,6 +277,8 @@ static const struct of_device_id usb_xhci_of_match[] = {
+ { .compatible = "xhci-platform" },
+ { .compatible = "marvell,armada-375-xhci"},
+ { .compatible = "marvell,armada-380-xhci"},
++ { .compatible = "renesas,xhci-r8a7790"},
++ { .compatible = "renesas,xhci-r8a7791"},
+ { },
+ };
+ MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
+diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
+new file mode 100644
+index 000000000000..ff0d1b44ea58
+--- /dev/null
++++ b/drivers/usb/host/xhci-rcar.c
+@@ -0,0 +1,148 @@
++/*
++ * xHCI host controller driver for R-Car SoCs
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * version 2 as published by the Free Software Foundation.
++ */
++
++#include <linux/firmware.h>
++#include <linux/module.h>
++#include <linux/platform_device.h>
++#include <linux/usb/phy.h>
++
++#include "xhci.h"
++#include "xhci-rcar.h"
++
++#define FIRMWARE_NAME "r8a779x_usb3_v1.dlmem"
++MODULE_FIRMWARE(FIRMWARE_NAME);
++
++/*** Register Offset ***/
++#define RCAR_USB3_INT_ENA 0x224 /* Interrupt Enable */
++#define RCAR_USB3_DL_CTRL 0x250 /* FW Download Control & Status */
++#define RCAR_USB3_FW_DATA0 0x258 /* FW Data0 */
++
++#define RCAR_USB3_LCLK 0xa44 /* LCLK Select */
++#define RCAR_USB3_CONF1 0xa48 /* USB3.0 Configuration1 */
++#define RCAR_USB3_CONF2 0xa5c /* USB3.0 Configuration2 */
++#define RCAR_USB3_CONF3 0xaa8 /* USB3.0 Configuration3 */
++#define RCAR_USB3_RX_POL 0xab0 /* USB3.0 RX Polarity */
++#define RCAR_USB3_TX_POL 0xab8 /* USB3.0 TX Polarity */
++
++/*** Register Settings ***/
++/* Interrupt Enable */
++#define RCAR_USB3_INT_XHC_ENA 0x00000001
++#define RCAR_USB3_INT_PME_ENA 0x00000002
++#define RCAR_USB3_INT_HSE_ENA 0x00000004
++#define RCAR_USB3_INT_ENA_VAL (RCAR_USB3_INT_XHC_ENA | \
++ RCAR_USB3_INT_PME_ENA | RCAR_USB3_INT_HSE_ENA)
++
++/* FW Download Control & Status */
++#define RCAR_USB3_DL_CTRL_ENABLE 0x00000001
++#define RCAR_USB3_DL_CTRL_FW_SUCCESS 0x00000010
++#define RCAR_USB3_DL_CTRL_FW_SET_DATA0 0x00000100
++
++/* LCLK Select */
++#define RCAR_USB3_LCLK_ENA_VAL 0x01030001
++
++/* USB3.0 Configuration */
++#define RCAR_USB3_CONF1_VAL 0x00030204
++#define RCAR_USB3_CONF2_VAL 0x00030300
++#define RCAR_USB3_CONF3_VAL 0x13802007
++
++/* USB3.0 Polarity */
++#define RCAR_USB3_RX_POL_VAL BIT(21)
++#define RCAR_USB3_TX_POL_VAL BIT(4)
++
++void xhci_rcar_start(struct usb_hcd *hcd)
++{
++ u32 temp;
++
++ if (hcd->regs != NULL) {
++ /* Interrupt Enable */
++ temp = readl(hcd->regs + RCAR_USB3_INT_ENA);
++ temp |= RCAR_USB3_INT_ENA_VAL;
++ writel(temp, hcd->regs + RCAR_USB3_INT_ENA);
++ /* LCLK Select */
++ writel(RCAR_USB3_LCLK_ENA_VAL, hcd->regs + RCAR_USB3_LCLK);
++ /* USB3.0 Configuration */
++ writel(RCAR_USB3_CONF1_VAL, hcd->regs + RCAR_USB3_CONF1);
++ writel(RCAR_USB3_CONF2_VAL, hcd->regs + RCAR_USB3_CONF2);
++ writel(RCAR_USB3_CONF3_VAL, hcd->regs + RCAR_USB3_CONF3);
++ /* USB3.0 Polarity */
++ writel(RCAR_USB3_RX_POL_VAL, hcd->regs + RCAR_USB3_RX_POL);
++ writel(RCAR_USB3_TX_POL_VAL, hcd->regs + RCAR_USB3_TX_POL);
++ }
++}
++
++static int xhci_rcar_download_firmware(struct device *dev, void __iomem *regs)
++{
++ const struct firmware *fw;
++ int retval, index, j, time;
++ int timeout = 10000;
++ u32 data, val, temp;
++
++ /* request R-Car USB3.0 firmware */
++ retval = request_firmware(&fw, FIRMWARE_NAME, dev);
++ if (retval)
++ return retval;
++
++ /* download R-Car USB3.0 firmware */
++ temp = readl(regs + RCAR_USB3_DL_CTRL);
++ temp |= RCAR_USB3_DL_CTRL_ENABLE;
++ writel(temp, regs + RCAR_USB3_DL_CTRL);
++
++ for (index = 0; index < fw->size; index += 4) {
++ /* to avoid reading beyond the end of the buffer */
++ for (data = 0, j = 3; j >= 0; j--) {
++ if ((j + index) < fw->size)
++ data |= fw->data[index + j] << (8 * j);
++ }
++ writel(data, regs + RCAR_USB3_FW_DATA0);
++ temp = readl(regs + RCAR_USB3_DL_CTRL);
++ temp |= RCAR_USB3_DL_CTRL_FW_SET_DATA0;
++ writel(temp, regs + RCAR_USB3_DL_CTRL);
++
++ for (time = 0; time < timeout; time++) {
++ val = readl(regs + RCAR_USB3_DL_CTRL);
++ if ((val & RCAR_USB3_DL_CTRL_FW_SET_DATA0) == 0)
++ break;
++ udelay(1);
++ }
++ if (time == timeout) {
++ retval = -ETIMEDOUT;
++ break;
++ }
++ }
++
++ temp = readl(regs + RCAR_USB3_DL_CTRL);
++ temp &= ~RCAR_USB3_DL_CTRL_ENABLE;
++ writel(temp, regs + RCAR_USB3_DL_CTRL);
++
++ for (time = 0; time < timeout; time++) {
++ val = readl(regs + RCAR_USB3_DL_CTRL);
++ if (val & RCAR_USB3_DL_CTRL_FW_SUCCESS) {
++ retval = 0;
++ break;
++ }
++ udelay(1);
++ }
++ if (time == timeout)
++ retval = -ETIMEDOUT;
++
++ release_firmware(fw);
++
++ return retval;
++}
++
++/* This function needs to initialize a "phy" of usb before */
++int xhci_rcar_init_quirk(struct usb_hcd *hcd)
++{
++ /* If hcd->regs is NULL, we don't just call the following function */
++ if (!hcd->regs)
++ return 0;
++
++ return xhci_rcar_download_firmware(hcd->self.controller, hcd->regs);
++}
+diff --git a/drivers/usb/host/xhci-rcar.h b/drivers/usb/host/xhci-rcar.h
+new file mode 100644
+index 000000000000..58501256715d
+--- /dev/null
++++ b/drivers/usb/host/xhci-rcar.h
+@@ -0,0 +1,27 @@
++/*
++ * drivers/usb/host/xhci-rcar.h
++ *
++ * Copyright (C) 2014 Renesas Electronics Corporation
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License
++ * version 2 as published by the Free Software Foundation.
++ */
++
++#ifndef _XHCI_RCAR_H
++#define _XHCI_RCAR_H
++
++#if IS_ENABLED(CONFIG_USB_XHCI_RCAR)
++void xhci_rcar_start(struct usb_hcd *hcd);
++int xhci_rcar_init_quirk(struct usb_hcd *hcd);
++#else
++static inline void xhci_rcar_start(struct usb_hcd *hcd)
++{
++}
++
++static inline int xhci_rcar_init_quirk(struct usb_hcd *hcd)
++{
++ return 0;
++}
++#endif
++#endif /* _XHCI_RCAR_H */
+--
+2.1.2
+
diff --git a/patches.renesas/0964-ASoC-ak4642-Make-of_device_id-array-const.patch b/patches.renesas/0964-ASoC-ak4642-Make-of_device_id-array-const.patch
new file mode 100644
index 00000000000000..6cc7ef17fa553d
--- /dev/null
+++ b/patches.renesas/0964-ASoC-ak4642-Make-of_device_id-array-const.patch
@@ -0,0 +1,40 @@
+From 1e5decb227801c9d2cdf77b51c5e3e134ac22d33 Mon Sep 17 00:00:00 2001
+From: Kiran Padwal <kiran.padwal21@gmail.com>
+Date: Mon, 28 Jul 2014 11:41:04 +0530
+Subject: ASoC: ak4642: Make of_device_id array const
+
+Make of_device_id array const, because all OF functions handle it as const
+
+Signed-off-by: Kiran Padwal <kiran.padwal21@gmail.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit 27204ca8b981160c3b65cdc226c9070f76cbbd36)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/codecs/ak4642.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
+index 647be66078ec..7d862597bac8 100644
+--- a/sound/soc/codecs/ak4642.c
++++ b/sound/soc/codecs/ak4642.c
+@@ -555,7 +555,7 @@ static const struct ak4642_drvdata ak4648_drvdata = {
+ .extended_frequencies = 1,
+ };
+
+-static struct of_device_id ak4642_of_match[];
++static const struct of_device_id ak4642_of_match[];
+ static int ak4642_i2c_probe(struct i2c_client *i2c,
+ const struct i2c_device_id *id)
+ {
+@@ -601,7 +601,7 @@ static int ak4642_i2c_remove(struct i2c_client *client)
+ return 0;
+ }
+
+-static struct of_device_id ak4642_of_match[] = {
++static const struct of_device_id ak4642_of_match[] = {
+ { .compatible = "asahi-kasei,ak4642", .data = &ak4642_drvdata},
+ { .compatible = "asahi-kasei,ak4643", .data = &ak4643_drvdata},
+ { .compatible = "asahi-kasei,ak4648", .data = &ak4648_drvdata},
+--
+2.1.2
+
diff --git a/patches.renesas/0965-i2c-rcar-fix-MNR-interrupt-handling.patch b/patches.renesas/0965-i2c-rcar-fix-MNR-interrupt-handling.patch
new file mode 100644
index 00000000000000..21ea077b8f09be
--- /dev/null
+++ b/patches.renesas/0965-i2c-rcar-fix-MNR-interrupt-handling.patch
@@ -0,0 +1,65 @@
+From 331fb731824c9a0b18238f0cbf98dc0daac640a3 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Tue, 2 Sep 2014 01:15:26 +0400
+Subject: i2c: rcar: fix MNR interrupt handling
+
+Sometimes the MNR and MST interrupts happen simultaneously (stop automatically
+follows NACK, according to the manuals) and in such case the ID_NACK flag isn't
+set since the MST interrupt handling precedes MNR and all interrupts are cleared
+and disabled then, so that MNR interrupt is never noticed -- this causes NACK'ed
+transfers to be falsely reported as successful. Exchanging MNR and MST handlers
+fixes this issue, however the MNR bit somehow gets set again even after being
+explicitly cleared, so I decided to completely suppress handling of all disabled
+interrupts (which is a good thing anyway)...
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+(cherry picked from commit dd318b0df27c582ac0d72a346fd6e693700be23c)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/i2c/busses/i2c-rcar.c | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
+index f3c7139dfa25..dc32f5fa75d0 100644
+--- a/drivers/i2c/busses/i2c-rcar.c
++++ b/drivers/i2c/busses/i2c-rcar.c
+@@ -367,18 +367,15 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
+
+ msr = rcar_i2c_read(priv, ICMSR);
+
++ /* Only handle interrupts that are currently enabled */
++ msr &= rcar_i2c_read(priv, ICMIER);
++
+ /* Arbitration lost */
+ if (msr & MAL) {
+ rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST));
+ goto out;
+ }
+
+- /* Stop */
+- if (msr & MST) {
+- rcar_i2c_flags_set(priv, ID_DONE);
+- goto out;
+- }
+-
+ /* Nack */
+ if (msr & MNR) {
+ /* go to stop phase */
+@@ -388,6 +385,12 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
+ goto out;
+ }
+
++ /* Stop */
++ if (msr & MST) {
++ rcar_i2c_flags_set(priv, ID_DONE);
++ goto out;
++ }
++
+ if (rcar_i2c_is_recv(priv))
+ rcar_i2c_flags_set(priv, rcar_i2c_irq_recv(priv, msr));
+ else
+--
+2.1.2
+
diff --git a/patches.renesas/0966-Revert-i2c-rcar-remove-spinlock.patch b/patches.renesas/0966-Revert-i2c-rcar-remove-spinlock.patch
new file mode 100644
index 00000000000000..88cf2bfc2dc8f7
--- /dev/null
+++ b/patches.renesas/0966-Revert-i2c-rcar-remove-spinlock.patch
@@ -0,0 +1,112 @@
+From 4107f0d4d0f717e760954a046cc5a7b008e99151 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Sun, 24 Aug 2014 00:44:09 +0400
+Subject: Revert "i2c: rcar: remove spinlock"
+
+This reverts commit 150b8be3cda54412ad7b54f5392b513b25c0aaa7.
+
+The I2C core's per-adapter locks can't protect from IRQs, so the driver still
+needs a spinlock to protect the register accesses.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Cc: stable@vger.kernel.org # 3.16+
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+(cherry picked from commit 91bfe2989af02e709ca01ccf518c4fbda3efc70f)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/i2c/busses/i2c-rcar.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
+index dc32f5fa75d0..1cc146cfc1f3 100644
+--- a/drivers/i2c/busses/i2c-rcar.c
++++ b/drivers/i2c/busses/i2c-rcar.c
+@@ -34,6 +34,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/slab.h>
++#include <linux/spinlock.h>
+
+ /* register offsets */
+ #define ICSCR 0x00 /* slave ctrl */
+@@ -95,6 +96,7 @@ struct rcar_i2c_priv {
+ struct i2c_msg *msg;
+ struct clk *clk;
+
++ spinlock_t lock;
+ wait_queue_head_t wait;
+
+ int pos;
+@@ -365,6 +367,9 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr)
+ struct rcar_i2c_priv *priv = ptr;
+ u32 msr;
+
++ /*-------------- spin lock -----------------*/
++ spin_lock(&priv->lock);
++
+ msr = rcar_i2c_read(priv, ICMSR);
+
+ /* Only handle interrupts that are currently enabled */
+@@ -403,6 +408,9 @@ out:
+ wake_up(&priv->wait);
+ }
+
++ spin_unlock(&priv->lock);
++ /*-------------- spin unlock -----------------*/
++
+ return IRQ_HANDLED;
+ }
+
+@@ -412,14 +420,21 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
+ {
+ struct rcar_i2c_priv *priv = i2c_get_adapdata(adap);
+ struct device *dev = rcar_i2c_priv_to_dev(priv);
++ unsigned long flags;
+ int i, ret, timeout;
+
+ pm_runtime_get_sync(dev);
+
++ /*-------------- spin lock -----------------*/
++ spin_lock_irqsave(&priv->lock, flags);
++
+ rcar_i2c_init(priv);
+ /* start clock */
+ rcar_i2c_write(priv, ICCCR, priv->icccr);
+
++ spin_unlock_irqrestore(&priv->lock, flags);
++ /*-------------- spin unlock -----------------*/
++
+ ret = rcar_i2c_bus_barrier(priv);
+ if (ret < 0)
+ goto out;
+@@ -431,6 +446,9 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
+ break;
+ }
+
++ /*-------------- spin lock -----------------*/
++ spin_lock_irqsave(&priv->lock, flags);
++
+ /* init each data */
+ priv->msg = &msgs[i];
+ priv->pos = 0;
+@@ -440,6 +458,9 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
+
+ ret = rcar_i2c_prepare_msg(priv);
+
++ spin_unlock_irqrestore(&priv->lock, flags);
++ /*-------------- spin unlock -----------------*/
++
+ if (ret < 0)
+ break;
+
+@@ -543,6 +564,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
+
+ irq = platform_get_irq(pdev, 0);
+ init_waitqueue_head(&priv->wait);
++ spin_lock_init(&priv->lock);
+
+ adap = &priv->adap;
+ adap->nr = pdev->id;
+--
+2.1.2
+
diff --git a/patches.renesas/0967-ASoC-rcar-Use-instead-of-for-boolean-expressions.patch b/patches.renesas/0967-ASoC-rcar-Use-instead-of-for-boolean-expressions.patch
new file mode 100644
index 00000000000000..8555179394e69b
--- /dev/null
+++ b/patches.renesas/0967-ASoC-rcar-Use-instead-of-for-boolean-expressions.patch
@@ -0,0 +1,37 @@
+From 459435b1ce52be8b55bb41f803f1f26a9554d183 Mon Sep 17 00:00:00 2001
+From: Lars-Peter Clausen <lars@metafoo.de>
+Date: Sun, 17 Aug 2014 16:18:19 +0200
+Subject: ASoC: rcar: Use && instead of & for boolean expressions
+
+Sparse spits out the following warning:
+ sound/soc/sh/rcar/gen.c:250:21: warning: dubious: x & !y
+
+It does this because sometimes mixing boolean and bit-wise logic has not the
+intended result. In this case we are fine, but replacing the bit-wise '&' with
+the boolean '&&' silences the sparse warning. The generated code for both cases
+is the same.
+
+Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+(cherry picked from commit c8e6e960733f4a5835265c15429fced4d2f1595e)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ sound/soc/sh/rcar/gen.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
+index 3fdf3be7b99a..f95e7ab135e8 100644
+--- a/sound/soc/sh/rcar/gen.c
++++ b/sound/soc/sh/rcar/gen.c
+@@ -247,7 +247,7 @@ rsnd_gen2_dma_addr(struct rsnd_priv *priv,
+ };
+
+ /* it shouldn't happen */
+- if (use_dvc & !use_src)
++ if (use_dvc && !use_src)
+ dev_err(dev, "DVC is selected without SRC\n");
+
+ /* use SSIU or SSI ? */
+--
+2.1.2
+
diff --git a/patches.renesas/0968-net-sh_eth-fix-driver-dependencies.patch b/patches.renesas/0968-net-sh_eth-fix-driver-dependencies.patch
new file mode 100644
index 00000000000000..499204ce5b3648
--- /dev/null
+++ b/patches.renesas/0968-net-sh_eth-fix-driver-dependencies.patch
@@ -0,0 +1,37 @@
+From 61a1abccbe56888695310f39a2d8f77fa76aff01 Mon Sep 17 00:00:00 2001
+From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+Date: Mon, 1 Sep 2014 16:25:35 +0200
+Subject: net: sh_eth: fix driver dependencies
+
+Renesas SuperH Ethernet support should be available only on
+Renesas ARM SoCs and SuperH architecture.
+
+Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
+Cc: Simon Horman <horms@verge.net.au>
+Cc: Magnus Damm <magnus.damm@gmail.com>
+Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Acked-by: Simon Horman <horms+renesas@verge.net.au>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit f6ec9c335b502d8011971d07508589d212cb3c93)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/net/ethernet/renesas/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig
+index 9e757c792d84..196e98a2d93b 100644
+--- a/drivers/net/ethernet/renesas/Kconfig
++++ b/drivers/net/ethernet/renesas/Kconfig
+@@ -5,6 +5,7 @@
+ config SH_ETH
+ tristate "Renesas SuperH Ethernet support"
+ depends on HAS_DMA
++ depends on ARCH_SHMOBILE || SUPERH || COMPILE_TEST
+ select CRC32
+ select MII
+ select MDIO_BITBANG
+--
+2.1.2
+
diff --git a/patches.renesas/0969-usb-renesas_usbhs-fix-the-behavior-of-some-usbhs_pkt.patch b/patches.renesas/0969-usb-renesas_usbhs-fix-the-behavior-of-some-usbhs_pkt.patch
new file mode 100644
index 00000000000000..5e24b564502cb7
--- /dev/null
+++ b/patches.renesas/0969-usb-renesas_usbhs-fix-the-behavior-of-some-usbhs_pkt.patch
@@ -0,0 +1,185 @@
+From d20f9492d163be389b2f60911d2894696c54b755 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Fri, 22 Aug 2014 20:13:50 +0900
+Subject: usb: renesas_usbhs: fix the behavior of some usbhs_pkt_handle
+
+Some gadget drivers will call usb_ep_queue() more than once before
+the first queue doesn't finish. However, this driver didn't handle
+it correctly. So, this patch fixes the behavior of some
+usbhs_pkt_handle using the "running" flag. Otherwise, the oops below
+happens if we use g_ncm driver and when the "iperf -u -c host -b 200M"
+is running.
+
+Unable to handle kernel NULL pointer dereference at virtual address 00000000
+pgd = c0004000
+[00000000] *pgd=00000000
+Internal error: Oops: 80000007 [#1] SMP ARM
+Modules linked in: usb_f_ncm g_ncm libcomposite u_ether
+CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 3.17.0-rc1-00008-g8b2be8a-dirty #20
+task: c051c7e0 ti: c0512000 task.ti: c0512000
+PC is at 0x0
+LR is at usbhsf_pkt_handler+0xa8/0x114
+pc : [<00000000>] lr : [<c0278fb4>] psr: 60000193
+sp : c0513ce8 ip : c0513c58 fp : c0513d24
+r10: 00000001 r9 : 00000193 r8 : eebec4a0
+r7 : eebec410 r6 : eebe0c6c r5 : 00000000 r4 : ee4a2774
+r3 : 00000000 r2 : ee251e00 r1 : c0513cf4 r0 : ee4a2774
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+(cherry picked from commit 8355b2b3082d302091506703d2e4e239f7deed7f)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/renesas_usbhs/fifo.c | 25 ++++++++++++++++++++++++-
+ drivers/usb/renesas_usbhs/pipe.c | 13 +++++++++++++
+ drivers/usb/renesas_usbhs/pipe.h | 4 ++++
+ 3 files changed, 41 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
+index 4fd36530bfa3..3efece3c72a3 100644
+--- a/drivers/usb/renesas_usbhs/fifo.c
++++ b/drivers/usb/renesas_usbhs/fifo.c
+@@ -544,6 +544,7 @@ static int usbhsf_pio_try_push(struct usbhs_pkt *pkt, int *is_done)
+ usbhsf_send_terminator(pipe, fifo);
+
+ usbhsf_tx_irq_ctrl(pipe, !*is_done);
++ usbhs_pipe_running(pipe, !*is_done);
+ usbhs_pipe_enable(pipe);
+
+ dev_dbg(dev, " send %d (%d/ %d/ %d/ %d)\n",
+@@ -570,12 +571,21 @@ usbhs_fifo_write_busy:
+ * retry in interrupt
+ */
+ usbhsf_tx_irq_ctrl(pipe, 1);
++ usbhs_pipe_running(pipe, 1);
+
+ return ret;
+ }
+
++static int usbhsf_pio_prepare_push(struct usbhs_pkt *pkt, int *is_done)
++{
++ if (usbhs_pipe_is_running(pkt->pipe))
++ return 0;
++
++ return usbhsf_pio_try_push(pkt, is_done);
++}
++
+ struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = {
+- .prepare = usbhsf_pio_try_push,
++ .prepare = usbhsf_pio_prepare_push,
+ .try_run = usbhsf_pio_try_push,
+ };
+
+@@ -589,6 +599,9 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done)
+ if (usbhs_pipe_is_busy(pipe))
+ return 0;
+
++ if (usbhs_pipe_is_running(pipe))
++ return 0;
++
+ /*
+ * pipe enable to prepare packet receive
+ */
+@@ -597,6 +610,7 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done)
+
+ usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length);
+ usbhs_pipe_enable(pipe);
++ usbhs_pipe_running(pipe, 1);
+ usbhsf_rx_irq_ctrl(pipe, 1);
+
+ return 0;
+@@ -642,6 +656,7 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done)
+ (total_len < maxp)) { /* short packet */
+ *is_done = 1;
+ usbhsf_rx_irq_ctrl(pipe, 0);
++ usbhs_pipe_running(pipe, 0);
+ usbhs_pipe_disable(pipe); /* disable pipe first */
+ }
+
+@@ -805,6 +820,7 @@ static void xfer_work(struct work_struct *work)
+ dev_dbg(dev, " %s %d (%d/ %d)\n",
+ fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero);
+
++ usbhs_pipe_running(pipe, 1);
+ usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans);
+ usbhs_pipe_enable(pipe);
+ usbhsf_dma_start(pipe, fifo);
+@@ -836,6 +852,10 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done)
+ if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */
+ goto usbhsf_pio_prepare_push;
+
++ /* return at this time if the pipe is running */
++ if (usbhs_pipe_is_running(pipe))
++ return 0;
++
+ /* get enable DMA fifo */
+ fifo = usbhsf_get_dma_fifo(priv, pkt);
+ if (!fifo)
+@@ -873,6 +893,7 @@ static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done)
+ pkt->actual = pkt->trans;
+
+ *is_done = !pkt->zero; /* send zero packet ? */
++ usbhs_pipe_running(pipe, !*is_done);
+
+ usbhsf_dma_stop(pipe, pipe->fifo);
+ usbhsf_dma_unmap(pkt);
+@@ -972,8 +993,10 @@ static int usbhsf_dma_pop_done(struct usbhs_pkt *pkt, int *is_done)
+ if ((pkt->actual == pkt->length) || /* receive all data */
+ (pkt->trans < maxp)) { /* short packet */
+ *is_done = 1;
++ usbhs_pipe_running(pipe, 0);
+ } else {
+ /* re-enable */
++ usbhs_pipe_running(pipe, 0);
+ usbhsf_prepare_pop(pkt, is_done);
+ }
+
+diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
+index 75fbcf6b102e..040bcefcb040 100644
+--- a/drivers/usb/renesas_usbhs/pipe.c
++++ b/drivers/usb/renesas_usbhs/pipe.c
+@@ -578,6 +578,19 @@ int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe)
+ return usbhsp_flags_has(pipe, IS_DIR_HOST);
+ }
+
++int usbhs_pipe_is_running(struct usbhs_pipe *pipe)
++{
++ return usbhsp_flags_has(pipe, IS_RUNNING);
++}
++
++void usbhs_pipe_running(struct usbhs_pipe *pipe, int running)
++{
++ if (running)
++ usbhsp_flags_set(pipe, IS_RUNNING);
++ else
++ usbhsp_flags_clr(pipe, IS_RUNNING);
++}
++
+ void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence)
+ {
+ u16 mask = (SQCLR | SQSET);
+diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h
+index 406f36d050e4..d24a05972370 100644
+--- a/drivers/usb/renesas_usbhs/pipe.h
++++ b/drivers/usb/renesas_usbhs/pipe.h
+@@ -36,6 +36,7 @@ struct usbhs_pipe {
+ #define USBHS_PIPE_FLAGS_IS_USED (1 << 0)
+ #define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1)
+ #define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2)
++#define USBHS_PIPE_FLAGS_IS_RUNNING (1 << 3)
+
+ struct usbhs_pkt_handle *handler;
+
+@@ -80,6 +81,9 @@ int usbhs_pipe_probe(struct usbhs_priv *priv);
+ void usbhs_pipe_remove(struct usbhs_priv *priv);
+ int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe);
+ int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe);
++int usbhs_pipe_is_running(struct usbhs_pipe *pipe);
++void usbhs_pipe_running(struct usbhs_pipe *pipe, int running);
++
+ void usbhs_pipe_init(struct usbhs_priv *priv,
+ int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map));
+ int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe);
+--
+2.1.2
+
diff --git a/patches.renesas/0970-usb-renesas_usbhs-protect-mod-irq_-bemp-brdy-sts-by-.patch b/patches.renesas/0970-usb-renesas_usbhs-protect-mod-irq_-bemp-brdy-sts-by-.patch
new file mode 100644
index 00000000000000..9df8800309469f
--- /dev/null
+++ b/patches.renesas/0970-usb-renesas_usbhs-protect-mod-irq_-bemp-brdy-sts-by-.patch
@@ -0,0 +1,48 @@
+From b6b190101fc647207746da0f0ddfcc8d9fbd7895 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Fri, 22 Aug 2014 20:14:00 +0900
+Subject: usb: renesas_usbhs: protect mod->irq_{bemp,brdy}sts by spin lock
+
+This patch protects the mod->irq_bempsts and mod->irq_brdysts by
+spin lock in the usbhs_status_get_each_irq() because other functions
+will write them during spin lock. Otherwise, the driver will clears
+the BRDYSTS and/or BEMPSTS wrongly, and then, the transaction will not
+finish.
+Also since the driver should use the INTSTS0 and BRDYSTS and BEMPSTS
+as the same timing, the patch protects them.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+(cherry picked from commit c4d8199ba1a7aa390b06db23f4532e2c1875aefb)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/renesas_usbhs/mod.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c
+index 6a030b931a3b..9a705b15b3a1 100644
+--- a/drivers/usb/renesas_usbhs/mod.c
++++ b/drivers/usb/renesas_usbhs/mod.c
+@@ -213,7 +213,10 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv,
+ {
+ struct usbhs_mod *mod = usbhs_mod_get_current(priv);
+ u16 intenb0, intenb1;
++ unsigned long flags;
+
++ /******************** spin lock ********************/
++ usbhs_lock(priv, flags);
+ state->intsts0 = usbhs_read(priv, INTSTS0);
+ state->intsts1 = usbhs_read(priv, INTSTS1);
+
+@@ -229,6 +232,8 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv,
+ state->bempsts &= mod->irq_bempsts;
+ state->brdysts &= mod->irq_brdysts;
+ }
++ usbhs_unlock(priv, flags);
++ /******************** spin unlock ******************/
+
+ /*
+ * Check whether the irq enable registers and the irq status are set
+--
+2.1.2
+
diff --git a/patches.renesas/0971-usb-renesas_usbhs-fix-the-condition-of-is_done-in-us.patch b/patches.renesas/0971-usb-renesas_usbhs-fix-the-condition-of-is_done-in-us.patch
new file mode 100644
index 00000000000000..e841e834b01c74
--- /dev/null
+++ b/patches.renesas/0971-usb-renesas_usbhs-fix-the-condition-of-is_done-in-us.patch
@@ -0,0 +1,61 @@
+From 8c1efbc74942c8584c0e9343993f401869c45538 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Fri, 22 Aug 2014 20:14:10 +0900
+Subject: usb: renesas_usbhs: fix the condition of is_done in
+ usbhsf_dma_push_done
+
+This patch fixes the condition of is_done in usbhsf_dma_push_done().
+This function will be called after a transmission finished by DMAC.
+So, the function should check if the transmission packet is short packet
+or not. Also the function should call try_run to send the zero packet
+by the pio handler if the "*is_done" is not set. Otherwize, the
+transaction will not finish if a gadget driver sets the "zero" flag
+in a transmission.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+(cherry picked from commit c0ed8b23b257a84d103764cdbd490ee5e2749da3)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/renesas_usbhs/fifo.c | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
+index 3efece3c72a3..1564829951c0 100644
+--- a/drivers/usb/renesas_usbhs/fifo.c
++++ b/drivers/usb/renesas_usbhs/fifo.c
+@@ -889,16 +889,29 @@ usbhsf_pio_prepare_push:
+ static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done)
+ {
+ struct usbhs_pipe *pipe = pkt->pipe;
++ int is_short = pkt->trans % usbhs_pipe_get_maxpacket(pipe);
+
+- pkt->actual = pkt->trans;
++ pkt->actual += pkt->trans;
++
++ if (pkt->actual < pkt->length)
++ *is_done = 0; /* there are remainder data */
++ else if (is_short)
++ *is_done = 1; /* short packet */
++ else
++ *is_done = !pkt->zero; /* send zero packet? */
+
+- *is_done = !pkt->zero; /* send zero packet ? */
+ usbhs_pipe_running(pipe, !*is_done);
+
+ usbhsf_dma_stop(pipe, pipe->fifo);
+ usbhsf_dma_unmap(pkt);
+ usbhsf_fifo_unselect(pipe, pipe->fifo);
+
++ if (!*is_done) {
++ /* change handler to PIO */
++ pkt->handler = &usbhs_fifo_pio_push_handler;
++ return pkt->handler->try_run(pkt, is_done);
++ }
++
+ return 0;
+ }
+
+--
+2.1.2
+
diff --git a/patches.renesas/0972-usb-renesas_usbhs-fix-the-usb_pkt_pop.patch b/patches.renesas/0972-usb-renesas_usbhs-fix-the-usb_pkt_pop.patch
new file mode 100644
index 00000000000000..b5eff178068c02
--- /dev/null
+++ b/patches.renesas/0972-usb-renesas_usbhs-fix-the-usb_pkt_pop.patch
@@ -0,0 +1,80 @@
+From aa377e5fad872713d3cd5f9c334c012481381535 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Fri, 22 Aug 2014 20:14:28 +0900
+Subject: usb: renesas_usbhs: fix the usb_pkt_pop()
+
+This patch fixes the usb_pkt_pop(). If a gadget driver calls
+usb_ep_dequeue(), this driver will call the usb_pkt_pop().
+So, the usb_pkt_pop() should cancel the transaction.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+(cherry picked from commit 2743e7f90dc08282d027dbc2f6486f5cb85aa493)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/usb/renesas_usbhs/fifo.c | 30 +++++++++++++++++++++++++++---
+ 1 file changed, 27 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
+index 1564829951c0..b0c97a3f1bfe 100644
+--- a/drivers/usb/renesas_usbhs/fifo.c
++++ b/drivers/usb/renesas_usbhs/fifo.c
+@@ -108,19 +108,45 @@ static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe)
+ return list_first_entry(&pipe->list, struct usbhs_pkt, node);
+ }
+
++static void usbhsf_fifo_clear(struct usbhs_pipe *pipe,
++ struct usbhs_fifo *fifo);
++static void usbhsf_fifo_unselect(struct usbhs_pipe *pipe,
++ struct usbhs_fifo *fifo);
++static struct dma_chan *usbhsf_dma_chan_get(struct usbhs_fifo *fifo,
++ struct usbhs_pkt *pkt);
++#define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1)
++#define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0)
++static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map);
+ struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt)
+ {
+ struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
++ struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe);
+ unsigned long flags;
+
+ /******************** spin lock ********************/
+ usbhs_lock(priv, flags);
+
++ usbhs_pipe_disable(pipe);
++
+ if (!pkt)
+ pkt = __usbhsf_pkt_get(pipe);
+
+- if (pkt)
++ if (pkt) {
++ struct dma_chan *chan = NULL;
++
++ if (fifo)
++ chan = usbhsf_dma_chan_get(fifo, pkt);
++ if (chan) {
++ dmaengine_terminate_all(chan);
++ usbhsf_fifo_clear(pipe, fifo);
++ usbhsf_dma_unmap(pkt);
++ }
++
+ __usbhsf_pkt_del(pkt);
++ }
++
++ if (fifo)
++ usbhsf_fifo_unselect(pipe, fifo);
+
+ usbhs_unlock(priv, flags);
+ /******************** spin unlock ******************/
+@@ -778,8 +804,6 @@ static void __usbhsf_dma_ctrl(struct usbhs_pipe *pipe,
+ usbhs_bset(priv, fifo->sel, DREQE, dreqe);
+ }
+
+-#define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1)
+-#define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0)
+ static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map)
+ {
+ struct usbhs_pipe *pipe = pkt->pipe;
+--
+2.1.2
+
diff --git a/patches.renesas/0973-i2c-rcar-fix-RCAR_IRQ_ACK_-RECV-SEND.patch b/patches.renesas/0973-i2c-rcar-fix-RCAR_IRQ_ACK_-RECV-SEND.patch
new file mode 100644
index 00000000000000..52b39d452a34b0
--- /dev/null
+++ b/patches.renesas/0973-i2c-rcar-fix-RCAR_IRQ_ACK_-RECV-SEND.patch
@@ -0,0 +1,31 @@
+From efafa3809db75d58e5d8ee96956e7415bda90472 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Sat, 6 Sep 2014 03:34:32 +0400
+Subject: i2c: rcar: fix RCAR_IRQ_ACK_{RECV|SEND}
+
+Bits 8-31 of all registers reflect the value of bits 0-7 on reads and should be
+0 on writes, according to the manuals. RCAR_IRQ_ACK_{RECV|SEND} macros have all
+1's in bits 8-31, thus going against the manuals, so fix them.
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+(cherry picked from commit 938916fbb8e8cb67eacb784f4eda17e2950c16c5)
+Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
+---
+ drivers/i2c/busses/i2c-rcar.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/i2c/busses/i2c-rcar.c
++++ b/drivers/i2c/busses/i2c-rcar.c
+@@ -76,8 +76,8 @@
+ #define RCAR_IRQ_RECV (MNR | MAL | MST | MAT | MDR)
+ #define RCAR_IRQ_STOP (MST)
+
+-#define RCAR_IRQ_ACK_SEND (~(MAT | MDE))
+-#define RCAR_IRQ_ACK_RECV (~(MAT | MDR))
++#define RCAR_IRQ_ACK_SEND (~(MAT | MDE) & 0xFF)
++#define RCAR_IRQ_ACK_RECV (~(MAT | MDR) & 0xFF)
+
+ #define ID_LAST_MSG (1 << 0)
+ #define ID_IOERROR (1 << 1)
diff --git a/series b/series
index 5b8cf9de95a8fe..8c25217e681206 100644
--- a/series
+++ b/series
@@ -727,6 +727,283 @@ patches.renesas/0692-ASoC-rsnd-add-rsnd_gen_dma_addr-for-DMAC-addr.patch
patches.renesas/0693-ASoC-rsnd-fixup-index-of-src-dst-mod-when-capture.patch
patches.renesas/0694-Documentation-dt-bindings-update-xhci-platform-DT-bi.patch
patches.renesas/0695-Documentation-dt-bindings-update-xhci-platform-DT-bi.patch
+patches.renesas/0696-mmc-sh-mmcif-update-to-print-version-and-bus-clock-r.patch
+patches.renesas/0697-mmc-sh-mmcif-use-devm_-for-ioremap.patch
+patches.renesas/0698-mmc-sh-mmcif-use-devm_-for-clock-management.patch
+patches.renesas/0699-mmc-sh-mmcif-use-devm_-for-irq-management.patch
+patches.renesas/0700-mmc-sh-mmcif-no-need-to-call-pm_runtime_suspend-on-e.patch
+patches.renesas/0701-mmc-sh-mmcif-final-error-path-cleanup.patch
+patches.renesas/0702-pinctrl-sh-pfc-r8a7791-Add-HSCIF-pin-support.patch
+patches.renesas/0703-media-vb2-Check-if-there-are-buffers-before-streamon.patch
+patches.renesas/0704-media-vb2-rename-queued_count-to-owned_by_drv_count.patch
+patches.renesas/0705-media-vb2-only-call-start_streaming-if-sufficient-bu.patch
+patches.renesas/0706-v4l-Add-ARGB-and-XRGB-pixel-formats.patch
+patches.renesas/0707-DocBook-media-Document-ALPHA_COMPONENT-control-usage.patch
+patches.renesas/0708-v4l-Support-extending-the-v4l2_pix_format-structure.patch
+patches.renesas/0709-v4l-Add-premultiplied-alpha-flag-for-pixel-formats.patch
+patches.renesas/0710-v4l-vb2-Fix-stream-start-and-buffer-completion-race.patch
+patches.renesas/0711-PCI-rcar-Remove-redundant-config-accessor-register-n.patch
+patches.renesas/0712-PCI-rcar-Use-correct-initial-HW-settings.patch
+patches.renesas/0713-PCI-rcar-Cleanup-style-and-formatting.patch
+patches.renesas/0714-PCI-rcar-Remove-rcar_pcie_setup_window-resource-argu.patch
+patches.renesas/0715-spi-rspi-Remove-unused-variable-in-rspi_rz_transfer_.patch
+patches.renesas/0716-spi-rspi-Pass-spi_master-pointer-to-rspi_release_dma.patch
+patches.renesas/0717-sh_eth-remove-checks-around-dev_kfree_skb-calls.patch
+patches.renesas/0718-mmc-tmio-mmc-Add-renesas-sdhi-r8a7791-to-binding-doc.patch
+patches.renesas/0719-sh-pfc-r8a7791-add-CAN-pin-groups.patch
+patches.renesas/0720-sh-pfc-Add-renesas-pfc-r8a7791-to-binding-documentat.patch
+patches.renesas/0721-sh-pfc-sh73a0-Introduce-the-use-of-devm_regulator_re.patch
+patches.renesas/0722-sh-Switch-to-new-style-CMT-device.patch
+patches.renesas/0723-sh-Switch-to-new-style-TMU-device.patch
+patches.renesas/0724-sh-Switch-to-new-style-MTU2-device.patch
+patches.renesas/0725-clocksource-sh_cmt-Drop-support-for-legacy-platform-.patch
+patches.renesas/0726-clocksource-sh_cmt-Replace-global-spinlock-with-a-pe.patch
+patches.renesas/0727-clocksource-shmobile-Remove-unused-sh_timer_config-m.patch
+patches.renesas/0728-clocksource-sh_cmt-Add-DT-support.patch
+patches.renesas/0729-clocksource-sh_mtu2-Drop-support-for-legacy-platform.patch
+patches.renesas/0730-clocksource-sh_mtu2-Replace-global-spinlock-with-a-p.patch
+patches.renesas/0731-clocksource-sh_mtu2-Add-DT-support.patch
+patches.renesas/0732-clocksource-sh_tmu-Drop-support-for-legacy-platform-.patch
+patches.renesas/0733-clocksource-sh_tmu-Replace-global-spinlock-with-a-pe.patch
+patches.renesas/0734-clocksource-sh_tmu-Add-DT-support.patch
+patches.renesas/0735-gpio-rcar-clamp-returned-value-to-0-1.patch
+patches.renesas/0736-usb-renesas_usbhs-fix-usbhs_pipe_malloc-to-re-enable.patch
+patches.renesas/0737-usb-renesas_usbhs-gadget-fix-re-enabling-pipe-withou.patch
+patches.renesas/0738-usb-renesas_usbhs-add-R-Car-Gen.-2-init-and-power-co.patch
+patches.renesas/0739-dmaengine-shdma-Add-more-register-documentation.patch
+patches.renesas/0740-dmaengine-shdma-Use-defines-instead-of-hardcoded-num.patch
+patches.renesas/0741-dmaengine-sh-Rework-Kconfig-and-Makefile.patch
+patches.renesas/0742-serial-sh-sci-Updated-calculation-of-bit-error-rate-.patch
+patches.renesas/0743-serial-sh-sci-Fix-range-check-of-bit-rate-for-HSCIF.patch
+patches.renesas/0744-serial-sh-sci-Add-calculation-recive-margin-for-HSCI.patch
+patches.renesas/0745-sh-pfc-r8a7791-fix-CAN-pin-groups.patch
+patches.renesas/0746-spi-sh-msiof-Add-more-register-documentation.patch
+patches.renesas/0747-spi-sh-msiof-Extract-sh_msiof_spi_-start-stop-helper.patch
+patches.renesas/0748-spi-sh-msiof-Improve-transfer-error-handling.patch
+patches.renesas/0749-spi-sh-msiof-Refactor-sh_msiof_transfer_one.patch
+patches.renesas/0750-spi-sh-msiof-Add-DMA-support.patch
+patches.renesas/0751-spi-sh-msiof-Handle-dmaengine_prep_slave_single-fail.patch
+patches.renesas/0752-spi-sh-msiof-Use-correct-device-for-DMA-mapping-with.patch
+patches.renesas/0753-spi-sh-msiof-Fix-leaking-of-unused-DMA-descriptors.patch
+patches.renesas/0754-spi-sh-msiof-Fix-transmit-only-DMA-transfers.patch
+patches.renesas/0755-mmc-tmio-Configure-DMA-slave-bus-width.patch
+patches.renesas/0756-mmc-sh_mmcif-Fix-DMA-slave-address-configuration.patch
+patches.renesas/0757-mmc-sh_mmcif-Configure-DMA-slave-bus-width.patch
+patches.renesas/0758-net-sh_eth-Add-r8a7794-support.patch
+patches.renesas/0759-sh-intc-Confine-SH_INTC-to-platforms-that-need-it.patch
+patches.renesas/0760-spi-rspi-Handle-dmaengine_prep_slave_sg-failures-gra.patch
+patches.renesas/0761-spi-rspi-Fix-leaking-of-unused-DMA-descriptors.patch
+patches.renesas/0762-thermal-rcar-Document-SoC-specific-bindings.patch
+patches.renesas/0763-drm-rcar-du-fix-warnings.patch
+patches.renesas/0764-drm-rcar-du-Fix-maximum-frame-buffer-pitch-computati.patch
+patches.renesas/0765-PCI-rcar-Fix-GPL-v2-license-string-typo.patch
+patches.renesas/0766-i2c-i2c-rcar-Drop-class-based-scanning-to-improve-bo.patch
+patches.renesas/0767-media-of-move-graph-helpers-from-drivers-media-v4l2-.patch
+patches.renesas/0768-media-rcar_vin-copy-flags-from-pdata.patch
+patches.renesas/0769-media-rcar_vin-add-devicetree-support.patch
+patches.renesas/0770-media-v4l-vsp1-Fix-routing-cleanup-when-stopping-the.patch
+patches.renesas/0771-media-v4l-vsp1-Release-buffers-at-stream-stop.patch
+patches.renesas/0772-media-v4l-vsp1-Fix-pipeline-stop-timeout.patch
+patches.renesas/0773-media-v4l-vsp1-Fix-typos.patch
+patches.renesas/0774-media-v4l-vsp1-Cleanup-video-nodes-at-removal-time.patch
+patches.renesas/0775-media-v4l-vsp1-Propagate-vsp1_device_get-errors-to-t.patch
+patches.renesas/0776-media-v4l-vsp1-Setup-control-handler-automatically-a.patch
+patches.renesas/0777-media-v4l-vsp1-sru-Fix-the-intensity-control-default.patch
+patches.renesas/0778-media-v4l-vsp1-sru-Make-the-intensity-controllable-d.patch
+patches.renesas/0779-media-v4l-vsp1-wpf-Simplify-cast-to-pipeline-structu.patch
+patches.renesas/0780-media-v4l-vsp1-wpf-Clear-RPF-to-WPF-association-at-s.patch
+patches.renesas/0781-media-v4l-vsp1-Switch-to-XRGB-formats.patch
+patches.renesas/0782-media-v4l-vsp1-Add-alpha-channel-support-to-the-memo.patch
+patches.renesas/0783-media-v4l-vsp1-Add-V4L2_CID_ALPHA_COMPONENT-control-.patch
+patches.renesas/0784-media-v4l-vsp1-bru-Support-premultiplied-alpha-at-th.patch
+patches.renesas/0785-media-v4l-vsp1-bru-Support-non-premultiplied-colors-.patch
+patches.renesas/0786-media-v4l-vsp1-bru-Make-the-background-color-configu.patch
+patches.renesas/0787-media-v4l-vsp1-uds-Fix-scaling-of-alpha-layer.patch
+patches.renesas/0788-ASoC-rsnd-fixup-rsnd_gen_dma_addr-for-Gen1.patch
+patches.renesas/0789-ASoC-rsnd-fixup-loop-exit-timing-of-dma-name-search.patch
+patches.renesas/0790-ASoC-rcar-Fix-dma-direction-type.patch
+patches.renesas/0791-ASoC-rsnd-SSI-DMA-can-select-BUSIF.patch
+patches.renesas/0792-ASoC-rsnd-use-dmaengine_prep_dma_cyclic-instead-of-o.patch
+patches.renesas/0793-ASoC-rsnd-enable-DVC-when-capture.patch
+patches.renesas/0794-ASoC-rsnd-DMA-cleanup-for-flexible-SSI-SRC-selection.patch
+patches.renesas/0795-ASoC-rsnd-DMA-start-address-is-properly-used-for-eac.patch
+patches.renesas/0796-ASoC-rsnd-add-DT-support-to-DVC.patch
+patches.renesas/0797-ASoC-rsnd-add-missing-src-dst_addr_width-for-DMAEngi.patch
+patches.renesas/0798-ASoC-rsnd-fixup-dai-remove-callback-operation.patch
+patches.renesas/0799-ASoC-rsnd-use-regmap_mmio-instead-of-original-regmap.patch
+patches.renesas/0800-ASoC-rsnd-care-detail-of-SRC_BSDSR.patch
+patches.renesas/0801-ASoC-rsnd-care-audio-local-bus-data-format-consisten.patch
+patches.renesas/0802-ASoC-rsnd-add-missing-dev_dbg-in-rsnd_bset.patch
+patches.renesas/0803-ASoC-rsnd-fixup-pcm_new-callback-method.patch
+patches.renesas/0804-ASoC-rsnd-fixup-SND_SOC_DAIFMT_xB_xF-behavior.patch
+patches.renesas/0805-ASoC-rsnd-tidyup-DVC-control-method.patch
+patches.renesas/0806-ASoC-rsnd-enable-Mute-control-on-DVC.patch
+patches.renesas/0807-ARM-shmobile-armadillo800eva-reference-dts-Add-match.patch
+patches.renesas/0808-ARM-shmobile-marzen-Remove-early_printk-from-command.patch
+patches.renesas/0809-ARM-shmobile-armadillo800eva-defconfig-Enable-REGULA.patch
+patches.renesas/0810-ARM-shmobile-marzen-Add-to-shmobile-defconfig.patch
+patches.renesas/0811-ARM-shmobile-Enable-PM_RUNTIME-in-defconfig.patch
+patches.renesas/0812-ARM-shmobile-Enable-CPUFREQ-configuration.patch
+patches.renesas/0813-ARM-shmobile-add-cpufreq-cpu0-driver-for-common-SH-M.patch
+patches.renesas/0814-ARM-shmobile-Fix-device-node-reference-leakage-in-sh.patch
+patches.renesas/0815-ARM-shmobile-Move-intc.h-cleanup-sh_intc.h-usage.patch
+patches.renesas/0816-ARM-shmobile-Move-dma-register.h.patch
+patches.renesas/0817-ARM-shmobile-Move-clock.h.patch
+patches.renesas/0818-ARM-shmobile-Move-most-of-irqs.h-keep-some-for-pinct.patch
+patches.renesas/0819-ARM-shmobile-Move-common.h.patch
+patches.renesas/0820-ARM-shmobile-Move-pm-rmobile.h-cleanup-sh73xx.h.patch
+patches.renesas/0821-ARM-shmobile-Move-pm-rcar.h-cleanup-r8a7779-case.patch
+patches.renesas/0822-ARM-shmobile-Move-rcar-gen2.h-cleanup-r8a7790-case.patch
+patches.renesas/0823-ARM-shmobile-Update-EMEV2-DTS-to-include-CPU-frequen.patch
+patches.renesas/0824-ARM-shmobile-Use-shmobile_init_delay-on-EMEV2.patch
+patches.renesas/0825-ARM-shmobile-r8a7779-Add-clocks.patch
+patches.renesas/0826-ARM-shmobile-Sync-Marzen-DTS-with-Marzen-reference-D.patch
+patches.renesas/0827-ARM-shmobile-marzen-Specify-external-clock-frequency.patch
+patches.renesas/0828-ARM-shmobile-r8a7779-Reference-clocks.patch
+patches.renesas/0829-ARM-shmobile-r8a7791-SYSC-setup-code.patch
+patches.renesas/0830-ARM-shmobile-APMU-Add-Core-Standby-state-for-Suspend.patch
+patches.renesas/0831-ARM-shmobile-r8a7790-Support-Core-Standby-for-Suspen.patch
+patches.renesas/0832-ARM-shmobile-r8a7791-Support-Core-Standby-for-Suspen.patch
+patches.renesas/0833-ARM-shmobile-Mark-all-SoCs-in-shmobile-as-CPUFreq-ca.patch
+patches.renesas/0834-ARM-shmobile-Use-shmobile_init_late-on-r8a7790-DT-on.patch
+patches.renesas/0835-ARM-shmobile-Use-shmobile_init_late-on-r8a7791-DT-on.patch
+patches.renesas/0836-ARM-shmobile-Add-shared-R-Car-Gen2-CMA-reservation-c.patch
+patches.renesas/0837-ARM-shmobile-rcar-gen2-Update-for-of_get_flat_dt_pro.patch
+patches.renesas/0838-ARM-shmobile-rcar-gen2-Use-1ULL-instead-of-u64-1.patch
+patches.renesas/0839-ARM-shmobile-rcar-gen2-Remove-useless-copied-section.patch
+patches.renesas/0840-ARM-shmobile-rcar-gen2-correct-return-value-of-shmob.patch
+patches.renesas/0841-ARM-shmobile-koelsch-reference-Remove-workarounds-fo.patch
+patches.renesas/0842-ARM-shmobile-lager-reference-Remove-workarounds-for-.patch
+patches.renesas/0843-ARM-shmobile-armadillo800eva-legacy-Add-LED-support.patch
+patches.renesas/0844-ARM-shmobile-armadillo800eva-reference-Spelling-s-ED.patch
+patches.renesas/0845-ARM-shmobile-Enable-R-Car-Gen2-CMA-code-in-board-fil.patch
+patches.renesas/0846-ARM-shmobile-Get-rid-of-redundant-EMEV2-mach-callbac.patch
+patches.renesas/0847-ARM-shmobile-Update-r7s72100-DTS-to-include-CPU-freq.patch
+patches.renesas/0848-ARM-shmobile-Use-shmobile_init_delay-on-Genmai-board.patch
+patches.renesas/0849-ARM-shmobile-Use-shmobile_init_delay-on-r7s72100.patch
+patches.renesas/0850-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-in-common-.patch
+patches.renesas/0851-ARM-shmobile-Use-r8a7790-DT-CPU-Frequency-for-Lager.patch
+patches.renesas/0852-ARM-shmobile-Remove-unused-r8a7790_init_early.patch
+patches.renesas/0853-ARM-shmobile-r8a7779-Add-helper-to-read-mode-pins.patch
+patches.renesas/0854-ARM-shmobile-r8a7779-Move-r8a7779_earlytimer_init-to.patch
+patches.renesas/0855-ARM-shmobile-marzen-reference-Move-clock-and-OF-devi.patch
+patches.renesas/0856-ARM-shmobile-r8a7779-Initial-multiplatform-support.patch
+patches.renesas/0857-ARM-shmobile-marzen-reference-Initialize-CPG-device.patch
+patches.renesas/0858-ARM-shmobile-marzen-reference-Instantiate-clkdevs-fo.patch
+patches.renesas/0859-ARM-shmobile-Remove-non-multiplatform-Marzen-referen.patch
+patches.renesas/0860-ARM-shmobile-Let-Marzen-multiplatform-boot-with-Marz.patch
+patches.renesas/0861-ARM-shmobile-Remove-Marzen-reference-DTS.patch
+patches.renesas/0862-ARM-shmobile-marzen-reference-Remove-legacy-clock-su.patch
+patches.renesas/0863-ARM-shmobile-r8a7779-Add-Maximum-CPU-Frequency-to-DT.patch
+patches.renesas/0864-ARM-shmobile-r8a7779-Use-DT-CPU-Frequency-in-common-.patch
+patches.renesas/0865-ARM-shmobile-marzen-reference-Use-DT-CPU-Frequency.patch
+patches.renesas/0866-ARM-shmobile-r8a7779-Remove-unused-r8a7779_init_dela.patch
+patches.renesas/0867-ARM-shmobile-r8a7779-dtsi-Update-unit-addresses-for-.patch
+patches.renesas/0868-ARM-shmobile-r8a7779-dtsi-Correct-address-cells-size.patch
+patches.renesas/0869-ARM-shmobile-r8a7779-Add-scif-nodes-to-dtsi.patch
+patches.renesas/0870-ARM-shmobile-marzen-Initialise-SCIF-devices-using-DT.patch
+patches.renesas/0871-ARM-shmobile-marzen-Do-not-use-workaround-for-scif-d.patch
+patches.renesas/0872-ARM-shmobile-r8a7790-add-USB3.0-clocks-to-device-tre.patch
+patches.renesas/0873-ARM-shmobile-r8a7791-add-USB3.0-clocks-to-device-tre.patch
+patches.renesas/0874-ARM-shmobile-r8a7791-dtsi-add-SYS-DMAC-clocks.patch
+patches.renesas/0875-ARM-shmobile-lager-Add-VDD-MPU-regulator-for-DVFS.patch
+patches.renesas/0876-ARM-shmobile-r8a7790-lager-dts-Add-DVFS-parameters-i.patch
+patches.renesas/0877-ARM-shmobile-koelsch-dts-Add-VDD-MPU-regulator-for-D.patch
+patches.renesas/0878-ARM-shmobile-r8a7791-koelsch-dts-Add-DVFS-parameters.patch
+patches.renesas/0879-ARM-shmobile-lager-enable-i2c-devices.patch
+patches.renesas/0880-ARM-shmobile-lager-add-i2c1-i2c2-pins.patch
+patches.renesas/0881-ARM-shmobile-lager-Move-i2c-12-_pins-nodes-to-pfc-no.patch
+patches.renesas/0882-ARM-shmobile-Lager-memory-map-update.patch
+patches.renesas/0883-ARM-shmobile-lager-Remove-duplicate-i2c3-nodes.patch
+patches.renesas/0884-ARM-shmobile-koelsch-Remove-duplicate-i2c6-nodes.patch
+patches.renesas/0885-ARM-shmobile-henninger-add-I2C2-DT-support.patch
+patches.renesas/0886-ARM-shmobile-r8a7790-add-MSTP10-support-on-DTSI.patch
+patches.renesas/0887-ARM-shmobile-r8a7790-add-R-Car-sound-support-on-DTSI.patch
+patches.renesas/0888-ARM-shmobile-r8a7791-add-audio-clock-on-DTSI.patch
+patches.renesas/0889-ARM-shmobile-r8a7791-add-MSTP10-support-on-DTSI.patch
+patches.renesas/0890-ARM-shmobile-r8a7790-Add-PCIEC-clock-device-tree-nod.patch
+patches.renesas/0891-ARM-shmobile-r8a7790-Add-default-PCIe-bus-clock.patch
+patches.renesas/0892-ARM-shmobile-r8a7790-Add-PCIe-Controller-device-node.patch
+patches.renesas/0893-ARM-shmobile-r8a7791-Add-PCIEC-clock-device-tree-nod.patch
+patches.renesas/0894-ARM-shmobile-r8a7791-Add-default-PCIe-bus-clock.patch
+patches.renesas/0895-ARM-shmobile-r8a7791-Add-PCIe-Controller-device-node.patch
+patches.renesas/0896-ARM-shmobile-koelsch-Enable-PCIe-Controller-PCIe-bus.patch
+patches.renesas/0897-ARM-shmobile-henninger-Enable-PCIe-Controller-PCIe-b.patch
+patches.renesas/0898-ARM-shmobile-r8a7791-add-R-Car-sound-support-on-DTSI.patch
+patches.renesas/0899-ARM-shmobile-Enable-genmai-board-in-multiplatform-de.patch
+patches.renesas/0900-ARM-shmobile-Move-r7s72100.h.patch
+patches.renesas/0901-ARM-shmobile-Move-r8a73a4.h.patch
+patches.renesas/0902-ARM-shmobile-Move-r8a7740.h.patch
+patches.renesas/0903-ARM-shmobile-Move-r8a7778.h.patch
+patches.renesas/0904-ARM-shmobile-Move-r8a7790.h.patch
+patches.renesas/0905-ARM-shmobile-Move-sh73a0.h.patch
+patches.renesas/0906-ARM-shmobile-Move-sh7372.h.patch
+patches.renesas/0907-ARM-shmobile-Move-r8a7779.h.patch
+patches.renesas/0908-ARM-shmobile-Move-r8a7791.h.patch
+patches.renesas/0909-ARM-shmobile-Allow-use-of-boot-code-for-non-SMP-case.patch
+patches.renesas/0910-ARM-shmobile-Adjust-APMU-code-to-build-for-non-SMP.patch
+patches.renesas/0911-ARM-shmobile-Use-__init-for-APMU-suspend-init-functi.patch
+patches.renesas/0912-ARM-shmobile-Move-r8a7790-reset-code-to-pm-r8a7790.c.patch
+patches.renesas/0913-ARM-shmobile-Allow-r8a7790-to-build-non-SMP-APMU-cod.patch
+patches.renesas/0914-ARM-shmobile-Move-r8a7791-reset-code-to-pm-r8a7791.c.patch
+patches.renesas/0915-ARM-shmobile-Allow-r8a7791-to-build-non-SMP-APMU-cod.patch
+patches.renesas/0916-ARM-shmobile-r8a7790-add-internal-PCI-bridge-nodes.patch
+patches.renesas/0917-ARM-shmobile-lager-enable-internal-PCI.patch
+patches.renesas/0918-ARM-shmobile-r8a7790-add-DVC-support-for-sound-node-.patch
+patches.renesas/0919-ARM-shmobile-r8a7791-add-DVC-support-for-sound-node-.patch
+patches.renesas/0920-ASoC-fsi-use-SNDRV_DMA_TYPE_DEV-for-sound-buffer.patch
+patches.renesas/0921-ARM-shmobile-r8a7790-Fix-whitespace-errors-in-pci-no.patch
+patches.renesas/0922-ARM-shmobile-genmai-reference-dts-Add-RSPI-node.patch
+patches.renesas/0923-ARM-shmobile-fix-shmobile_smp_apmu_suspend_init-buil.patch
+patches.renesas/0924-ARM-shmobile-r8a7791-add-internal-PCI-bridge-nodes.patch
+patches.renesas/0925-ARM-shmobile-koelsch-enable-internal-PCI.patch
+patches.renesas/0926-ARM-shmobile-henninger-enable-internal-PCI.patch
+patches.renesas/0927-ARM-shmobile-henninger-Consistently-use-tabs-for-ind.patch
+patches.renesas/0928-ARM-shmobile-r8a7779-Consistently-use-tabs-for-inden.patch
+patches.renesas/0929-ARM-shmobile-armadillo800eva-reference-Remove-early_.patch
+patches.renesas/0930-ARM-shmobile-kzm9g-reference-Remove-early_printk-fro.patch
+patches.renesas/0931-ARM-shmobile-marzen-Consistently-use-tabs-for-indent.patch
+patches.renesas/0932-ARM-shmobile-Enable-R-Car-Gen-2-PCIe-in-shmobile_def.patch
+patches.renesas/0933-ARM-shmobile-Remove-opps-table-check-for-cpufreq.patch
+patches.renesas/0934-ARM-shmobile-Lager-Correct-I2C-bus-for-VDD-MPU-regul.patch
+patches.renesas/0935-ARM-shmobile-r8a7790-lager-use-iic-cores-instead-of-.patch
+patches.renesas/0936-ARM-shmobile-r8a7778-add-SCI-clock-support-for-DT.patch
+patches.renesas/0937-ARM-shmobile-r8a73a4-add-SCI-clock-support-for-DT.patch
+patches.renesas/0938-ARM-shmobile-r8a7740-correct-SCI-clock-support-for-D.patch
+patches.renesas/0939-ARM-shmobile-sh73a0-add-SCI-clock-support-for-DT.patch
+patches.renesas/0940-ARM-shmobile-r8a7778-Add-SCIF-nodes.patch
+patches.renesas/0941-ARM-shmobile-bockw-reference-Initialise-SCIF-device-.patch
+patches.renesas/0942-ARM-shmobile-r8a73a4-Add-SCIF-nodes.patch
+patches.renesas/0943-ARM-shmobile-ape6evm-reference-Initialise-SCIF-devic.patch
+patches.renesas/0944-ARM-shmobile-r8a7740-Add-SCIF-nodes.patch
+patches.renesas/0945-ARM-shmobile-armadillo800eva-reference-Initialise-SC.patch
+patches.renesas/0946-ARM-shmobile-sh73a0-Add-SCIF-nodes.patch
+patches.renesas/0947-ARM-shmobile-kzm9g-reference-Initialise-SCIF-device-.patch
+patches.renesas/0948-ARM-shmobile-r8a7778-add-TMU-clock-support-for-DT.patch
+patches.renesas/0949-ARM-shmobile-r8a7740-add-TMU-clock-support-for-DT.patch
+patches.renesas/0950-ARM-shmobile-r8a73a4-add-CMT1-clock-support-for-DT.patch
+patches.renesas/0951-ARM-shmobile-r8a7740-add-CMT1-clock-support-for-DT.patch
+patches.renesas/0952-ARM-shmobile-sh73a0-add-CMT1-clock-support-for-DT.patch
+patches.renesas/0953-ARM-shmobile-genmai-remove-defconfig.patch
+patches.renesas/0954-ARM-shmobile-sh73a0-Remove-spurious-0x-from-SCIFB-cl.patch
+patches.renesas/0955-ARM-shmobile-defconfig-Remove-MACH_GENMAI.patch
+patches.renesas/0956-ARM-shmobile-r8a7790-add-missing-0x0100-for-SDCKCR.patch
+patches.renesas/0957-ARM-shmobile-r8a7791-add-missing-0x0100-for-SDCKCR.patch
+patches.renesas/0958-ARM-shmobile-koelsch-Remove-non-existent-i2c6-pinmux.patch
+patches.renesas/0960-xhci-Platform-Add-en-dis-able_usb3_lpm_timeout.patch
+patches.renesas/0961-xhci-Platform-Set-xhci-lpm-support-quirk-based-on-pl.patch
+patches.renesas/0962-usb-host-xhci-plat-use-devm_functions.patch
+patches.renesas/0963-usb-host-xhci-plat-add-support-for-the-R-Car-H2-and-.patch
+patches.renesas/0964-ASoC-ak4642-Make-of_device_id-array-const.patch
+patches.renesas/0965-i2c-rcar-fix-MNR-interrupt-handling.patch
+patches.renesas/0966-Revert-i2c-rcar-remove-spinlock.patch
+patches.renesas/0967-ASoC-rcar-Use-instead-of-for-boolean-expressions.patch
+patches.renesas/0968-net-sh_eth-fix-driver-dependencies.patch
+patches.renesas/0969-usb-renesas_usbhs-fix-the-behavior-of-some-usbhs_pkt.patch
+patches.renesas/0970-usb-renesas_usbhs-protect-mod-irq_-bemp-brdy-sts-by-.patch
+patches.renesas/0971-usb-renesas_usbhs-fix-the-condition-of-is_done-in-us.patch
+patches.renesas/0972-usb-renesas_usbhs-fix-the-usb_pkt_pop.patch
+patches.renesas/0973-i2c-rcar-fix-RCAR_IRQ_ACK_-RECV-SEND.patch
#############################################################################