aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-02 18:23:36 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-02 18:23:36 -0700
commit8eac33ee4371fbc59e8265531ff5210900a5bc10 (patch)
tree3223c61dca20901945eee5209d5e2f7c067a9340
parentb881fd03ea0aa426a776cbb595bd79495e88589b (diff)
downloadltsi-kernel-8eac33ee4371fbc59e8265531ff5210900a5bc10.tar.gz
start over at 4.9.40 for the next round of ltsi.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--KERNEL_VERSION2
-rw-r--r--patches.altera/0001-ARM-Add-msi.h-to-Kbuild.patch31
-rw-r--r--patches.altera/0001-ARM-socfpga-dts-add-cpu1-start-addr-for-Arria-10.patch27
-rw-r--r--patches.altera/0001-nios2-Export-get_cycles.patch38
-rw-r--r--patches.altera/0001-usage-documentation-for-FPGA-manager-core.patch196
-rw-r--r--patches.altera/0002-ARM-socfpga-dts-disable-the-sdmmc-and-uart-nodes-in-.patch47
-rw-r--r--patches.altera/0002-PCI-altera-Add-Altera-PCIe-host-controller-driver.patch731
-rw-r--r--patches.altera/0002-fpga-manager-add-sysfs-interface-document.patch63
-rw-r--r--patches.altera/0002-nios2-check-number-of-timer-instances.patch48
-rw-r--r--patches.altera/0003-ARM-socfpga-dts-enable-UART1-for-the-debug-uart.patch60
-rw-r--r--patches.altera/0003-PCI-altera-Add-Altera-PCIe-MSI-driver.patch420
-rw-r--r--patches.altera/0003-add-FPGA-manager-core.patch608
-rw-r--r--patches.altera/0003-nios2-time-Migrate-to-new-set-state-interface.patch113
-rw-r--r--patches.altera/0004-ARM-socfpga-dts-rename-socdk-board-file-to-socdk_sdm.patch167
-rw-r--r--patches.altera/0004-PCI-altera-Fix-loop-in-tlp_read_packet.patch45
-rw-r--r--patches.altera/0004-fpga-manager-add-driver-for-socfpga-fpga-manager.patch674
-rw-r--r--patches.altera/0004-nios2-fixed-variable-imm16-to-s16.patch29
-rw-r--r--patches.altera/0005-ARM-socfpga-dts-Add-a-clock-node-for-sdmmc-CIU.patch48
-rw-r--r--patches.altera/0005-MAINTAINERS-add-fpga-manager-framework.patch32
-rw-r--r--patches.altera/0005-PCI-altera-Fix-Requester-ID-for-config-accesses.patch54
-rw-r--r--patches.altera/0005-nios2-remove-unused-statistic-counters.patch112
-rw-r--r--patches.altera/0006-ARM-socfpga-dts-Add-multicast-bins-and-unicast-filte.patch51
-rw-r--r--patches.altera/0006-ARM-socfpga_defconfig-enable-fpga-manager.patch33
-rw-r--r--patches.altera/0006-PCI-altera-Check-TLP-completion-status.patch70
-rw-r--r--patches.altera/0006-nios2-Add-Max10-device-tree.patch272
-rw-r--r--patches.altera/0007-ARM-socfpga-dts-Add-tx-fifo-depth-and-rx-fifo-depth-.patch66
-rw-r--r--patches.altera/0007-ARM-socfpga-dts-add-fpga-manager.patch32
-rw-r--r--patches.altera/0007-PCI-altera-Fix-error-when-INTx-is-4.patch38
-rw-r--r--patches.altera/0007-nios2-add-Max10-defconfig.patch105
-rw-r--r--patches.altera/0008-ARM-socfpga-dts-add-clocks-to-the-Arria10-platform.patch417
-rw-r--r--patches.altera/0008-nios2-Fix-unused-variable-warning.patch36
-rw-r--r--patches.altera/0009-ARM-socfpga-Add-support-for-UART1-debug-uart-for-ear.patch75
-rw-r--r--patches.altera/0009-nios2-Switch-to-generic-__xchg.patch76
-rw-r--r--patches.altera/0010-ARM-socfpga-remove-the-need-to-map-uart_io_desc.patch45
-rw-r--r--patches.altera/0011-ARM-socfpga-dts-add-the-a9-scu-node.patch33
-rw-r--r--patches.altera/0012-ARM-socfpga-use-of_iomap-to-map-the-SCU.patch129
-rw-r--r--patches.altera/0013-clk-socfpga-update-clk.h-so-for-Arria10-platform-to-.patch60
-rw-r--r--patches.altera/0014-clk-socfpga-add-a-clock-driver-for-the-Arria-10-plat.patch555
-rw-r--r--patches.altera/0015-ARM-socfpga-dts-add-the-a9-scu-node-for-arria10.patch33
-rw-r--r--patches.altera/0016-ARM-socfpga-dts-add-enable-method-property-for-cpu-n.patch45
-rw-r--r--patches.altera/0017-clk-of-helper-for-filling-parent-clock-array-and-ret.patch74
-rw-r--r--patches.altera/0018-clk-socfpga-make-use-of-of_clk_parent_fill-helper-fu.patch71
-rw-r--r--patches.altera/0019-ARM-socfpga-use-CPU_METHOD_OF_DECLARE-for-socfpga_cy.patch54
-rw-r--r--patches.altera/0020-ARM-socfpga-add-CPU_METHOD_OF_DECLARE-for-Arria-10.patch85
-rw-r--r--patches.altera/0021-ARM-socfpga-dts-enable-ethernet-for-Arria10-devkit.patch112
-rw-r--r--patches.altera/0022-ARM-socfpga-support-suspend-to-ram.patch400
-rw-r--r--patches.altera/0023-ARM-dts-socfpga-enable-the-data-and-instruction-pref.patch32
-rw-r--r--patches.altera/0024-ARM-dts-socfpga-use-stdout-path-for-chosen-node.patch93
-rw-r--r--patches.altera/0025-ARM-socfpga-add-reset-for-the-Arria-10-platform.patch72
-rw-r--r--patches.altera/0026-ARM-socfpga-dts-Correct-the-parent-clock-for-l3_sp_c.patch44
-rw-r--r--patches.altera/0027-ARM-socfpga-dts-Fix-gpio-dts-entry-for-the-correct-c.patch49
-rw-r--r--patches.altera/0028-ARM-socfpga-dts-add-osc1-as-a-possible-parent-for-db.patch31
-rw-r--r--patches.altera/0029-reset-socfpga-Update-reset-socfpga-to-read-the-altr-.patch93
-rw-r--r--patches.altera/0030-dt-bindings-Add-reset-manager-offsets-for-Arria10.patch135
-rw-r--r--patches.altera/0031-ARM-socfpga-dts-add-altr-modrst-offset-property.patch63
-rw-r--r--patches.altera/0032-ARM-socfpga-dts-Add-resets-for-EMACs-on-Arria10.patch47
-rw-r--r--patches.altera/0033-clk-socfpga-Add-a-second-parent-option-for-the-dbg_b.patch82
-rw-r--r--patches.altera/0034-EDAC-altera-Generalize-driver-to-use-DT-Memory-size.patch114
-rw-r--r--patches.altera/0035-EDAC-altera-Refactor-for-Altera-CycloneV-SoC.patch478
-rw-r--r--patches.altera/0036-EDAC-altera-Add-Arria10-EDAC-support.patch337
-rw-r--r--patches.altera/0037-arm-socfpga-dts-Add-Arria10-SDRAM-EDAC-DTS-support.patch69
-rw-r--r--patches.altera/0038-EDAC-altera-Do-not-allow-suspend-when-EDAC-is-enable.patch67
-rw-r--r--patches.altera/0039-ARM-dts-socfpga-Add-support-of-Terasic-DE0-Atlas-boa.patch144
-rw-r--r--patches.altera/arm-socfpga-fix-build-error-due-to-secondary_startup.patch33
-rw-r--r--patches.ktap/ktap-0.4.patch23278
-rw-r--r--patches.ltsi/ltsi-makefile-addition.patch6
-rw-r--r--patches.misc/input-add-support-for-rohm-bu21023-24-touchscreen.patch1262
-rw-r--r--patches.misc/input-rohm_bu21023-fix-handling-of-retrying-firmware.patch26
-rw-r--r--patches.misc/mtd-nand-support-for-toshiba-benand-built-in-ecc-nand.patch338
-rw-r--r--patches.renesas/0001-ARM-shmobile-r8a73a4-Add-IRQC-clock-to-device-tree.patch75
-rw-r--r--patches.renesas/0002-ARM-shmobile-r8a7790-Add-IRQC-clock-to-device-tree.patch61
-rw-r--r--patches.renesas/0003-ARM-shmobile-r8a7791-Add-IRQC-clock-to-device-tree.patch61
-rw-r--r--patches.renesas/0004-ARM-shmobile-r8a7794-Add-IRQC-clock-to-device-tree.patch61
-rw-r--r--patches.renesas/0005-clk-emev2-Silence-sparse-warnings.patch33
-rw-r--r--patches.renesas/0006-clk-shmobile-Add-r8a7778-SoC-to-MSTP-bindings.patch29
-rw-r--r--patches.renesas/0007-clk-shmobile-Add-r8a7793-SoC-to-MSTP-bindings.patch35
-rw-r--r--patches.renesas/0008-clk-shmobile-mstp-Document-mandatory-compatible-fall.patch35
-rw-r--r--patches.renesas/0009-i2c-sh_mobile-add-errata-workaround.patch111
-rw-r--r--patches.renesas/0010-i2c-sh_mobile-use-adapter-default-for-timeout.patch34
-rw-r--r--patches.renesas/0011-i2c-sh_mobile-use-proper-type-for-timeout.patch46
-rw-r--r--patches.renesas/0012-irqchip-Constify-irq_domain_ops.patch233
-rw-r--r--patches.renesas/0013-irqchip-renesas-intc-irqpin-Improve-binding-document.patch86
-rw-r--r--patches.renesas/0014-irqchip-irqc-Remove-platform-data-support.patch123
-rw-r--r--patches.renesas/0015-ARM-shmobile-r8a7790-Remove-MSIOF-address-from-devic.patch62
-rw-r--r--patches.renesas/0016-ARM-shmobile-r8a7791-Remove-MSIOF-address-from-devic.patch67
-rw-r--r--patches.renesas/0017-ARM-shmobile-r8a7740-dtsi-Fix-SCIFB-naming.patch31
-rw-r--r--patches.renesas/0018-ARM-shmobile-sh73a0-dtsi-Fix-SCIFB-naming.patch31
-rw-r--r--patches.renesas/0019-ARM-shmobile-defconfig-Replace-USB_RCAR_GEN2_PHY-by-.patch51
-rw-r--r--patches.renesas/0020-ARM-shmobile-r8a7740-dtsi-Use-generic-names-for-devi.patch59
-rw-r--r--patches.renesas/0021-ARM-shmobile-r8a7778-dtsi-Use-generic-names-for-devi.patch32
-rw-r--r--patches.renesas/0022-ARM-shmobile-r8a7779-dtsi-Use-generic-names-for-devi.patch32
-rw-r--r--patches.renesas/0023-ARM-shmobile-r8a7790-dtsi-Use-generic-names-for-devi.patch32
-rw-r--r--patches.renesas/0024-ARM-shmobile-r8a7791-dtsi-Use-generic-names-for-devi.patch32
-rw-r--r--patches.renesas/0025-ARM-shmobile-sh73a0-dtsi-Use-generic-names-for-devic.patch59
-rw-r--r--patches.renesas/0026-ARM-shmobile-ape6evm-dts-Use-generic-names-for-devic.patch32
-rw-r--r--patches.renesas/0027-ARM-shmobile-kzm9d-dts-Use-generic-names-for-device-.patch42
-rw-r--r--patches.renesas/0028-ARM-shmobile-marzen-dts-Use-generic-names-for-device.patch45
-rw-r--r--patches.renesas/0029-ARM-shmobile-armadillo800eva-dts-Use-generic-names-f.patch32
-rw-r--r--patches.renesas/0030-ARM-shmobile-henninger-dts-Add-nor-jedec-compatible-.patch35
-rw-r--r--patches.renesas/0031-ARM-shmobile-bockw-reference-dts-Add-nor-jedec-compa.patch35
-rw-r--r--patches.renesas/0032-ARM-shmobile-lager-dts-Add-nor-jedec-compatible-valu.patch35
-rw-r--r--patches.renesas/0033-ARM-shmobile-bockw-dts-Add-nor-jedec-compatible-valu.patch35
-rw-r--r--patches.renesas/0034-ARM-shmobile-koelsch-dts-Add-nor-jedec-compatible-va.patch35
-rw-r--r--patches.renesas/0035-ARM-shmobile-bockw-dts-Use-generic-names-for-device-.patch32
-rw-r--r--patches.renesas/0036-ARM-shmobile-lager-dts-Use-generic-names-for-device-.patch32
-rw-r--r--patches.renesas/0037-ARM-shmobile-koelsch-dts-Use-generic-names-for-devic.patch32
-rw-r--r--patches.renesas/0038-ARM-shmobile-kzm9g-dts-Configure-the-HOME-key-as-wak.patch32
-rw-r--r--patches.renesas/0039-ARM-shmobile-r8a7790-add-USB-DMAC-device-nodes.patch50
-rw-r--r--patches.renesas/0040-ARM-shmobile-r8a7790-Enable-DMA-for-HSUSB.patch32
-rw-r--r--patches.renesas/0041-ARM-shmobile-r8a7791-add-USB-DMAC-device-nodes.patch50
-rw-r--r--patches.renesas/0042-ARM-shmobile-r8a7791-Enable-DMA-for-HSUSB.patch32
-rw-r--r--patches.renesas/0043-ARM-shmobile-lager-dts-Replace-nor-jedec-by-jedec-sp.patch34
-rw-r--r--patches.renesas/0044-ARM-shmobile-koelsch-dts-Replace-nor-jedec-by-jedec-.patch34
-rw-r--r--patches.renesas/0045-ARM-shmobile-bockw-reference-dts-Replace-nor-jedec-b.patch34
-rw-r--r--patches.renesas/0046-ARM-shmobile-henninger-dts-Replace-nor-jedec-by-jede.patch34
-rw-r--r--patches.renesas/0047-ARM-shmobile-bockw-dts-Replace-nor-jedec-by-jedec-sp.patch34
-rw-r--r--patches.renesas/0048-ARM-shmobile-r8a7790-add-MMCIF-max-frequency.patch37
-rw-r--r--patches.renesas/0049-ARM-shmobile-r8a7791-add-MMCIF-max-frequency.patch28
-rw-r--r--patches.renesas/0050-ARM-shmobile-only-select-sound-drivers-that-build.patch52
-rw-r--r--patches.renesas/0051-ARM-shmobile-r8a7794-dtsi-Describe-DMA-for-the-seria.patch185
-rw-r--r--patches.renesas/0052-ARM-shmobile-r8a7791-dtsi-Describe-DMA-for-the-seria.patch185
-rw-r--r--patches.renesas/0053-ARM-shmobile-r8a7790-dtsi-Describe-DMA-for-the-seria.patch113
-rw-r--r--patches.renesas/0055-ARM-shmobile-r8a7740-remove-I2C-errata-handling.patch101
-rw-r--r--patches.renesas/0056-phy-core-Check-requested-PHY-status-in-_of_phy_get.patch88
-rw-r--r--patches.renesas/0057-phy-rcar-gen2-Add-support-for-R-Car-E2.patch45
-rw-r--r--patches.renesas/0058-usb-phy-Remove-the-phy-rcar-gen2-usb-driver.patch345
-rw-r--r--patches.renesas/0059-pinctrl-allow-exlusive-GPIO-mux-pin-allocation.patch135
-rw-r--r--patches.renesas/0060-pinctrl-move-strict-option-to-pinmux_ops.patch130
-rw-r--r--patches.renesas/0061-pinctrl-use-ERR_CAST-instead-of-ERR_PTR-PTR_ERR.patch31
-rw-r--r--patches.renesas/0062-pinctrl-Grammar-s-used-in-as-used-as.patch29
-rw-r--r--patches.renesas/0063-pinctrl-improve-debugfs-for-strict-controllers.patch81
-rw-r--r--patches.renesas/0064-pinctrl-remove-useless-const-qualifier.patch33
-rw-r--r--patches.renesas/0065-pinctrl-use-const-struct-.-rather-than-struct-.-cons.patch36
-rw-r--r--patches.renesas/0066-pinctrl-fix-confusing-debug-message-in-pinctrl_regis.patch37
-rw-r--r--patches.renesas/0067-pinctrl-don-t-print-unavailable-function-groups.patch38
-rw-r--r--patches.renesas/0068-pinctrl-make-pinctrl_register-return-proper-error-co.patch713
-rw-r--r--patches.renesas/0069-dmaengine-rcar-dmac-fixup-spinlock-in-rcar-dmac.patch175
-rw-r--r--patches.renesas/0070-dmaengine-rcar-dmac-Use-DECLARE_BITMAP.patch31
-rw-r--r--patches.renesas/0071-drm-rcar-du-Document-the-rcar_du_crtc-structure.patch42
-rw-r--r--patches.renesas/0072-drm-rcar-du-Document-the-rcar_du_plane_state-structu.patch44
-rw-r--r--patches.renesas/0073-drm-rcar-du-Move-properties-from-rcar_du_planes-to-r.patch189
-rw-r--r--patches.renesas/0074-drm-rcar-du-Embed-rcar_du_planes-structure-into-rcar.patch139
-rw-r--r--patches.renesas/0075-drm-rcar-du-Rename-to_rcar_du_plane_state-to-to_rcar.patch180
-rw-r--r--patches.renesas/0076-drm-rcar-du-Add-plane-allocation-debugging.patch119
-rw-r--r--patches.renesas/0077-drm-rcar-du-Keep-plane-to-CRTC-associations-when-dis.patch141
-rw-r--r--patches.renesas/0078-drm-rcar-du-Consider-plane-to-CRTC-associations-in-t.patch72
-rw-r--r--patches.renesas/0079-drm-rcar-du-Store-the-number-of-CRTCs-per-group-in-t.patch83
-rw-r--r--patches.renesas/0080-drm-rcar-du-Split-planes-pre-association-4-4-between.patch55
-rw-r--r--patches.renesas/0081-drm-rcar-du-Print-the-error-value-when-DRM-KMS-init-.patch31
-rw-r--r--patches.renesas/0082-drm-rcar-du-Disable-all-planes-when-stopping-the-CRT.patch51
-rw-r--r--patches.renesas/0083-drm-rcar-du-Fix-crash-with-groups-that-have-less-tha.patch108
-rw-r--r--patches.renesas/0084-drm-rcar-du-Clarify-error-message-when-encoder-initi.patch48
-rw-r--r--patches.renesas/0085-drm-rcar-du-Convert-rcar_du_encoders_init_one-return.patch70
-rw-r--r--patches.renesas/0086-drm-rcar-du-Clean-up-planes-in-the-error-paths-of-.a.patch57
-rw-r--r--patches.renesas/0087-drm-rcar-du-Use-the-drm-atomic-state-duplication-hel.patch55
-rw-r--r--patches.renesas/0088-i2c-add-FUNC-flag-for-slave-capabilities.patch31
-rw-r--r--patches.renesas/0089-i2c-constify-platform_device_id.patch63
-rw-r--r--patches.renesas/0090-i2c-rcar-report-slave-capabilities-to-users.patch31
-rw-r--r--patches.renesas/0091-i2c-rcar-use-adapter-default-for-timeout.patch34
-rw-r--r--patches.renesas/0092-i2c-rcar-use-proper-type-for-timeout.patch33
-rw-r--r--patches.renesas/0093-media-rcar-vin-use-monotonic-timestamps.patch34
-rw-r--r--patches.renesas/0094-sh-pfc-fix-sparse-GPIOs-for-R-Car-SoCs.patch39
-rw-r--r--patches.renesas/0095-ASoC-soc-pcm-DPCM-cares-BE-format.patch118
-rw-r--r--patches.renesas/0096-ASoC-rsnd-add-rsnd_dai_to_priv-macro.patch43
-rw-r--r--patches.renesas/0097-ASoC-rsnd-make-sure-it-uses-lock-when-it-calls-rsnd_.patch123
-rw-r--r--patches.renesas/0098-ASoC-rsnd-tidyup-SSI-parent-related-function-macro-n.patch78
-rw-r--r--patches.renesas/0099-ASoC-rsnd-make-sure-SSI-parent-child-uses-same-numbe.patch93
-rw-r--r--patches.renesas/0100-ASoC-rsnd-care-snd_kcontrol-s-index.patch39
-rw-r--r--patches.renesas/0101-ASoC-rsnd-Use-generic-names-for-device-nodes.patch32
-rw-r--r--patches.renesas/0102-ASoC-rsnd-revert-lock-for-calls-to-rsnd_dai_call.patch126
-rw-r--r--patches.renesas/0103-ASoC-rsnd-indicate-unknown-HW-start.patch38
-rw-r--r--patches.renesas/0104-ASoC-rsnd-add-rsnd_dai_stream_quit.patch70
-rw-r--r--patches.renesas/0105-ASoC-rsnd-rsrc-card-uses-FE-BE-merged-format-when-DP.patch30
-rw-r--r--patches.renesas/0106-ASoC-rsnd-spin-lock-for-interrupt-handler.patch165
-rw-r--r--patches.renesas/0107-ASoC-rsnd-Document-r8a7778-specific-binding.patch31
-rw-r--r--patches.renesas/0108-ASoC-rsnd-don-t-care-under-over-run-error-when-PIO.patch61
-rw-r--r--patches.renesas/0109-ASoC-rsnd-don-t-call-snd_pcm_period_elapsed-under-sp.patch148
-rw-r--r--patches.renesas/0110-ASoC-rsrc-card-used-fe.xxx-be.xxx-name-for-dai_link.patch72
-rw-r--r--patches.renesas/0111-ASoC-rsrc-card-tidyup-priv-snd_card-setup-timing.patch74
-rw-r--r--patches.renesas/0112-ASoC-rsrc-card-enable-multi-cpu-codec-for-DPCM.patch90
-rw-r--r--patches.renesas/0113-ASoC-rsrc-card-remove-unused-name.patch29
-rw-r--r--patches.renesas/0114-ASoC-rsnd-card-tidyup-rsrc_priv_to_.patch50
-rw-r--r--patches.renesas/0115-ASoC-rsrc-card-move-rsrc_card_parse_daifmt-to-upper-.patch108
-rw-r--r--patches.renesas/0116-ASoC-rsrc-card-tidyup-return-value-of-clock-error.patch34
-rw-r--r--patches.renesas/0117-ASoC-rsrc-card-cleanup-for-DPCM.patch513
-rw-r--r--patches.renesas/0118-ASoC-rsnd-count-each-mod-SSI-SRC-DVC.patch109
-rw-r--r--patches.renesas/0119-ASoC-rsnd-rsnd_mod-has-rsnd_priv.patch119
-rw-r--r--patches.renesas/0120-ASoC-rsnd-adds-struct-rsnd_dai_stream-as-on-each-fuc.patch396
-rw-r--r--patches.renesas/0121-ASoC-rsnd-add-common-interrupt-handler-for-SSI-SRC-D.patch72
-rw-r--r--patches.renesas/0122-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_get_adinr.patch215
-rw-r--r--patches.renesas/0123-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_dma_xxx.patch534
-rw-r--r--patches.renesas/0124-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_ssi_xxx.patch162
-rw-r--r--patches.renesas/0125-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_src_xxx.patch212
-rw-r--r--patches.renesas/0126-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-snd_kcontrol.patch264
-rw-r--r--patches.renesas/0127-ASoC-rsnd-move-rsnd_mod_is_working-to-rsnd_io_is_wor.patch103
-rw-r--r--patches.renesas/0128-ASoC-rsnd-remove-io-from-rsnd_mod.patch62
-rw-r--r--patches.renesas/0129-ASoC-rsrc-card-remove-unused-ret.patch33
-rw-r--r--patches.renesas/0130-clk-shmobile-Remove-unneeded-include-linux-clkdev.h.patch149
-rw-r--r--patches.renesas/0131-clk-shmobile-emev2-deassert-reset-for-IIC0-1.patch43
-rw-r--r--patches.renesas/0132-clk-shmobile-Add-CPG-MSTP-Clock-Domain-support.patch173
-rw-r--r--patches.renesas/0133-clk-shmobile-r8a7778-Add-CPG-MSTP-Clock-Domain-suppo.patch109
-rw-r--r--patches.renesas/0134-clk-shmobile-r8a7779-Add-CPG-MSTP-Clock-Domain-suppo.patch100
-rw-r--r--patches.renesas/0135-clk-shmobile-rcar-gen2-Add-CPG-MSTP-Clock-Domain-sup.patch93
-rw-r--r--patches.renesas/0136-clk-shmobile-rz-Add-CPG-MSTP-Clock-Domain-support.patch115
-rw-r--r--patches.renesas/0137-regulator-da9210-Add-optional-interrupt-support.patch138
-rw-r--r--patches.renesas/0138-gpio-rcar-Fine-grained-Runtime-PM-support.patch93
-rw-r--r--patches.renesas/0139-gpio-rcar-Add-r8a7795-R-Car-H3-support.patch48
-rw-r--r--patches.renesas/0140-irqchip-renesas-irqc-Get-rid-of-IRQF_VALID.patch35
-rw-r--r--patches.renesas/0141-irqchip-renesas-irqc-Use-linear-IRQ-domain.patch40
-rw-r--r--patches.renesas/0142-irqchip-renesas-irqc-Make-use-of-irq_find_mapping.patch75
-rw-r--r--patches.renesas/0143-ARM-shmobile-R-Mobile-Move-to_rmobile_pd-from-header.patch54
-rw-r--r--patches.renesas/0144-ARM-shmobile-R-Mobile-Use-BIT-macro-instead-of-open-.patch39
-rw-r--r--patches.renesas/0145-ARM-shmobile-r8a7779-Remove-GENPD_FLAG_PM_CLK-flag.patch38
-rw-r--r--patches.renesas/0146-ARM-shmobile-Remove-legacy-board-code-for-KZM-A9-GT.patch1775
-rw-r--r--patches.renesas/0147-ARM-shmobile-Remove-legacy-kzm9g_defconfig.patch192
-rw-r--r--patches.renesas/0148-ARM-shmobile-Drop-sh73a0-kzm9g.dtb-for-legacy-builds.patch33
-rw-r--r--patches.renesas/0149-ARM-shmobile-Remove-legacy-SoC-code-for-SH-Mobile-AG.patch1755
-rw-r--r--patches.renesas/0150-ARM-shmobile-Remove-legacy-board-code-for-Armadillo-.patch1446
-rw-r--r--patches.renesas/0151-ARM-shmobile-Remove-legacy-armadillo800eva_defconfig.patch201
-rw-r--r--patches.renesas/0152-ARM-shmobile-Drop-r8a7740-armadillo800eva.dtb-for-le.patch31
-rw-r--r--patches.renesas/0153-ARM-shmobile-Remove-legacy-SoC-code-for-R-Mobile-A1.patch1686
-rw-r--r--patches.renesas/0154-ARM-shmobile-Remove-unused-dma-register.h.patch110
-rw-r--r--patches.renesas/0155-ARM-shmobile-R-Mobile-Remove-legacy-PM-Domain-code.patch107
-rw-r--r--patches.renesas/0156-ARM-shmobile-Remove-obsolete-zboot-support.patch251
-rw-r--r--patches.renesas/0157-ARM-shmobile-R-Car-Gen2-CONFIG_ARCH_SHMOBILE_MULTI-i.patch37
-rw-r--r--patches.renesas/0158-ARM-shmobile-timer-r8a73a4-and-r8a7790-are-multi-pla.patch46
-rw-r--r--patches.renesas/0159-ARM-shmobile-Enable-gose-board-in-multiplatform-defc.patch30
-rw-r--r--patches.renesas/0160-ARM-shmobile-add-r8a7793-minimal-SoC-device-tree.patch567
-rw-r--r--patches.renesas/0161-ARM-shmobile-r8a7793-add-minimal-Gose-board-device-t.patch104
-rw-r--r--patches.renesas/0162-ARM-shmobile-r8a7790-add-EtherAVB-clocks.patch60
-rw-r--r--patches.renesas/0163-ARM-shmobile-r8a7790-add-EtherAVB-DT-support.patch41
-rw-r--r--patches.renesas/0164-ARM-shmobile-armadillo800eva-dts-Add-pinctrl-and-gpi.patch51
-rw-r--r--patches.renesas/0165-ARM-shmobile-r8a73a4-dtsi-Use-arm-gic-400-for-GIC.patch38
-rw-r--r--patches.renesas/0166-ARM-shmobile-r8a7790-dtsi-Use-arm-gic-400-for-GIC.patch38
-rw-r--r--patches.renesas/0167-ARM-shmobile-r8a7791-dtsi-Use-arm-gic-400-for-GIC.patch38
-rw-r--r--patches.renesas/0168-ARM-shmobile-r8a7793-dtsi-Use-arm-gic-400-for-GIC.patch38
-rw-r--r--patches.renesas/0169-ARM-shmobile-r8a7794-dtsi-Use-arm-gic-400-for-GIC.patch38
-rw-r--r--patches.renesas/0170-ARM-shmobile-r8a7779-Configure-IRLM-mode-via-DT.patch43
-rw-r--r--patches.renesas/0171-ARM-shmobile-R-Car-Improve-documentation.patch119
-rw-r--r--patches.renesas/0172-ARM-shmobile-R-Car-Shrink-rcar_sysc_ch-size.patch42
-rw-r--r--patches.renesas/0173-ARM-shmobile-R-Car-Break-infinite-loop.patch64
-rw-r--r--patches.renesas/0174-ARM-shmobile-R-Car-Make-struct-rcar_sysc_ch-paramete.patch94
-rw-r--r--patches.renesas/0175-ARM-shmobile-R-Car-Use-BIT-macro-instead-of-open-cod.patch59
-rw-r--r--patches.renesas/0176-ARM-shmobile-R-Car-Get-rid-of-on_off_fn-function-poi.patch95
-rw-r--r--patches.renesas/0177-ARM-shmobile-r8a7779-Make-struct-rcar_sysc_ch-const.patch84
-rw-r--r--patches.renesas/0178-ARM-shmobile-r8a7790-Make-struct-rcar_sysc_ch-const.patch36
-rw-r--r--patches.renesas/0179-ARM-shmobile-Basic-r8a7793-SoC-support.patch88
-rw-r--r--patches.renesas/0180-ARM-shmobile-gose-enable-R-Car-Gen2-regulator-quirk.patch60
-rw-r--r--patches.renesas/0181-ARM-shmobile-apmu-silence-build-warnings.patch45
-rw-r--r--patches.renesas/0182-ARM-shmobile-r8a7779-Generic-CCF-and-timer-support.patch63
-rw-r--r--patches.renesas/0183-ARM-shmobile-r8a7779-Generic-SMP-ops.patch32
-rw-r--r--patches.renesas/0184-ARM-shmobile-emev2-add-IIC-cores-to-dtsi.patch87
-rw-r--r--patches.renesas/0185-ARM-shmobile-emev2-kzm9d-enable-IIC-busses.patch35
-rw-r--r--patches.renesas/0186-ARM-shmobile-lager-add-sound-label-on-DTS.patch31
-rw-r--r--patches.renesas/0187-ARM-shmobile-koelsch-add-sound-label-on-DTS.patch31
-rw-r--r--patches.renesas/0188-ARM-shmobile-defconfig-add-Renesas-DPCM-Sound-Card.patch35
-rw-r--r--patches.renesas/0189-ARM-shmobile-Remove-marzen_defconfig.patch151
-rw-r--r--patches.renesas/0190-ARM-shmobile-lager-Fix-adv7511-IRQ-sensing.patch35
-rw-r--r--patches.renesas/0191-ARM-shmobile-r8a7790-Add-Audio-CTU-support-on-DTSI.patch93
-rw-r--r--patches.renesas/0192-ARM-shmobile-r8a7790-Add-Audio-MIX-support-on-DTSI.patch49
-rw-r--r--patches.renesas/0193-ARM-shmobile-r8a7791-Add-Audio-CTU-support-on-DTSI.patch92
-rw-r--r--patches.renesas/0194-ARM-shmobile-r8a7791-Add-Audio-MIX-support-on-DTSI.patch48
-rw-r--r--patches.renesas/0195-ARM-shmobile-Enable-fixed-voltage-regulator-in-shmob.patch33
-rw-r--r--patches.renesas/0196-ARM-shmobile-marzen-reference-Remove-C-board-code.patch119
-rw-r--r--patches.renesas/0197-ARM-shmobile-r8a7779-Cleanup-header-file.patch68
-rw-r--r--patches.renesas/0198-ARM-shmobile-marzen-Remove-legacy-board-code.patch441
-rw-r--r--patches.renesas/0199-ARM-shmobile-r8a7779-Remove-legacy-SoC-code.patch1100
-rw-r--r--patches.renesas/0200-ARM-shmobile-r8a7790-Add-JPU-device-node.patch37
-rw-r--r--patches.renesas/0201-ARM-shmobile-r8a7791-Add-JPU-device-node.patch37
-rw-r--r--patches.renesas/0202-ARM-shmobile-r8a7794-add-PFC-DT-support.patch38
-rw-r--r--patches.renesas/0203-ARM-shmobile-silk-initial-device-tree.patch93
-rw-r--r--patches.renesas/0204-ARM-shmobile-r8a7794-add-MMCIF-DT-support.patch42
-rw-r--r--patches.renesas/0205-ARM-shmobile-r8a73a4-dtsi-Add-missing-gpio-ranges-to.patch70
-rw-r--r--patches.renesas/0206-ARM-shmobile-r8a7740-dtsi-Add-missing-gpio-ranges-to.patch64
-rw-r--r--patches.renesas/0207-ARM-shmobile-sh73a0-dtsi-Add-missing-gpio-ranges-to-.patch66
-rw-r--r--patches.renesas/0208-ARM-shmobile-r7s72100-dtsi-Add-CPG-MSTP-Clock-Domain.patch182
-rw-r--r--patches.renesas/0209-ARM-shmobile-r8a7778-dtsi-Add-CPG-MSTP-Clock-Domain.patch208
-rw-r--r--patches.renesas/0210-ARM-shmobile-r8a7779-dtsi-Add-CPG-MSTP-Clock-Domain.patch214
-rw-r--r--patches.renesas/0211-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain.patch605
-rw-r--r--patches.renesas/0212-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain.patch635
-rw-r--r--patches.renesas/0213-ARM-shmobile-r8a7793-dtsi-Add-CPG-MSTP-Clock-Domain.patch86
-rw-r--r--patches.renesas/0214-ARM-shmobile-r8a7794-dtsi-Add-CPG-MSTP-Clock-Domain.patch262
-rw-r--r--patches.renesas/0215-pinctrl-simplify-of_pinctrl_get.patch37
-rw-r--r--patches.renesas/0216-pinctrl-pinconf-Allow-groups-to-be-configured-via-de.patch64
-rw-r--r--patches.renesas/0217-pinctrl-pinconf-Fix-display-of-configs.patch146
-rw-r--r--patches.renesas/0218-pinctrl-pinconf-pinconf_show_config-can-be-static.patch29
-rw-r--r--patches.renesas/0219-pinctrl-use-dev_err-to-show-message-in-pinctrl_regis.patch37
-rw-r--r--patches.renesas/0220-pinctrl-use-dev_err-to-show-message-in-pinmux_func_n.patch36
-rw-r--r--patches.renesas/0221-pinctrl-join-dev_dbg-strings-into-a-single-line.patch33
-rw-r--r--patches.renesas/0222-media-media-soc_camera-rcar_vin-Add-BT.709-24-bit-RG.patch88
-rw-r--r--patches.renesas/0223-media-media-rcar_vin-fill-in-bus_info-field.patch33
-rw-r--r--patches.renesas/0224-media-media-rcar_vin-Reject-videobufs-that-are-too-s.patch36
-rw-r--r--patches.renesas/0225-spi-rspi-Drop-variable-error-in-qspi_trigger_transfe.patch54
-rw-r--r--patches.renesas/0226-spi-rspi-Make-qspi_set_send_trigger-return-unsigned-.patch46
-rw-r--r--patches.renesas/0227-ata-sata_rcar-Remove-obsolete-sata-r8a779-platform_d.patch39
-rw-r--r--patches.renesas/0228-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-32.patch35
-rw-r--r--patches.renesas/0229-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch36
-rw-r--r--patches.renesas/0230-sh-irq-Use-irq-accessor-functions-instead-of-open-co.patch55
-rw-r--r--patches.renesas/0231-sh-intc-Use-irq_desc_get_xxx-to-avoid-redundant-look.patch116
-rw-r--r--patches.renesas/0232-sh_eth-propagate-platform_get_irq-error-upstream.patch32
-rw-r--r--patches.renesas/0233-mmc-sh_mmcif-Fix-suspend-process.patch33
-rw-r--r--patches.renesas/0234-mmc-tmio-Fix-timeout-value-for-command-request.patch54
-rw-r--r--patches.renesas/0235-spi-sh-msiof-Remove-obsolete-spi_r8a779x_msiof-platf.patch35
-rw-r--r--patches.renesas/0237-pinctrl-sh-pfc-Remove-r8a73a4-platform_device_id-ent.patch39
-rw-r--r--patches.renesas/0238-pinctrl-sh-pfc-r8a7740-Fix-typo-SCIFAB-in-comment.patch33
-rw-r--r--patches.renesas/0239-pinctrl-sh-pfc-Add-r8a7793-support.patch90
-rw-r--r--patches.renesas/0240-pinctrl-sh-pfc-Enable-building-of-r8a7793-PFC-suppor.patch48
-rw-r--r--patches.renesas/0241-pinctrl-sh-pfc-Add-renesas-pfc-r8a7793-to-binding-do.patch37
-rw-r--r--patches.renesas/0242-pinctrl-sh-pfc-r8a73a4-Remove-obsolete-multi-platfor.patch39
-rw-r--r--patches.renesas/0243-pinctrl-sh-pfc-r8a7790-Add-PWM-pin-groups-and-functi.patch152
-rw-r--r--patches.renesas/0244-pinctrl-sh-pfc-r8a7791-Add-PWM-pin-groups-and-functi.patch176
-rw-r--r--patches.renesas/0245-pinctrl-Spelling-s-reseved-reserved.patch169
-rw-r--r--patches.renesas/0246-pinctrl-sh-pfc-add-R8A7794-PFC-support.patch4133
-rw-r--r--patches.renesas/0247-pinctrl-sh-pfc-r8a7794-add-MMCIF-pin-groups.patch100
-rw-r--r--patches.renesas/0248-pinctrl-sh-pfc-r8a7794-add-SDHI-pin-groups.patch208
-rw-r--r--patches.renesas/0249-sh-pfc-r8a7790-remove-non-existing-GPIO-pins.patch53
-rw-r--r--patches.renesas/0250-sh-pfc-r8a7791-remove-non-existing-GPIO-pins.patch57
-rw-r--r--patches.renesas/0251-pinctrl-sh-pfc-Accept-standard-function-pins-and-gro.patch188
-rw-r--r--patches.renesas/0252-pinctrl-sh-pfc-Convert-to-platform_get_.patch116
-rw-r--r--patches.renesas/0253-dmaengine-shdma-Make-dummy-shdma_chan_filter-always-.patch59
-rw-r--r--patches.renesas/0254-dmaengine-sort-the-sh-Makefile.patch30
-rw-r--r--patches.renesas/0255-usb-renesas_usbhs-Replace-deprecated-API-of-extcon.patch41
-rw-r--r--patches.renesas/0256-usb-renesas_usbhs-Allow-an-OTG-PHY-driver-to-provide.patch143
-rw-r--r--patches.renesas/0257-media-media-uapi-vsp1-Use-__u32-instead-of-u32.patch32
-rw-r--r--patches.renesas/0258-media-v4l-vsp1-Fix-VI6_WPF_SZCLIP_SIZE_MASK-macro.patch34
-rw-r--r--patches.renesas/0259-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FP_MASK-macro.patch34
-rw-r--r--patches.renesas/0260-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FXA_MASK-macro.patch33
-rw-r--r--patches.renesas/0261-media-v4l-vsp1-Fix-Suspend-to-RAM.patch179
-rw-r--r--patches.renesas/0262-media-v4l-vsp1-Fix-race-condition-when-stopping-pipe.patch63
-rw-r--r--patches.renesas/0263-media-v4l-vsp1-Align-crop-rectangle-to-even-boundary.patch47
-rw-r--r--patches.renesas/0264-media-vsp1-declar-vsp1_pipeline_stopped-as-static.patch33
-rw-r--r--patches.renesas/0265-media-v4l-vsp1-Fix-plane-stride-and-size-checks.patch35
-rw-r--r--patches.renesas/0266-media-v4l-vsp1-Don-t-sleep-in-atomic-context.patch105
-rw-r--r--patches.renesas/0267-regmap-add-force_write-option-on-_regmap_update_bits.patch96
-rw-r--r--patches.renesas/0268-regmap-add-regmap_fields_force_write.patch57
-rw-r--r--patches.renesas/0269-regmap-add-regmap_write_bits.patch82
-rw-r--r--patches.renesas/0270-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch37
-rw-r--r--patches.renesas/0271-pinctrl-sh-pfc-Remove-obsolete-sh73a0-platform_devic.patch39
-rw-r--r--patches.renesas/0272-pinctrl-sh-pfc-Remove-obsolete-r8a7740-platform_devi.patch39
-rw-r--r--patches.renesas/0273-pinctrl-sh-pfc-Implement-pinconf-power-source-param-.patch156
-rw-r--r--patches.renesas/0274-pinctrl-sh-pfc-r8a7794-add-USB-pin-groups.patch84
-rw-r--r--patches.renesas/0275-ASoC-core-add-snd_soc_of_parse_audio_prefix.patch61
-rw-r--r--patches.renesas/0276-ASoC-rsnd-gen-add-rsnd_force_write.patch69
-rw-r--r--patches.renesas/0277-ASoC-rsrc-card-use-snd_soc_of_parse_audio_route-pref.patch94
-rw-r--r--patches.renesas/0278-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch37
-rw-r--r--patches.renesas/0279-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch37
-rw-r--r--patches.renesas/0280-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch37
-rw-r--r--patches.renesas/0281-ASoC-rsnd-rename-BUSIF_DALIGN-to-SSI_BUSIF_DALIGN.patch60
-rw-r--r--patches.renesas/0282-ASoC-rsnd-rename-INT_ENABLE-to-SSI_INT_ENABLE.patch74
-rw-r--r--patches.renesas/0283-ASoC-rsnd-fixup-each-module-counter-on-__rsnd_mod_ca.patch38
-rw-r--r--patches.renesas/0284-ASoC-rsnd-add-workaround-for-SRC-sync-convert-DVC.patch98
-rw-r--r--patches.renesas/0285-ASoC-rsnd-rsnd_mod_id-return-1-if-mod-was-NULL.patch32
-rw-r--r--patches.renesas/0286-ASoC-rsnd-move-DVC-specific-macro-into-dvc.c.patch44
-rw-r--r--patches.renesas/0287-ASoC-rsnd-move-SRC-specific-macro-into-src.c.patch45
-rw-r--r--patches.renesas/0288-ASoC-rsnd-dvc-make-sure-DVC-soft-reset.patch59
-rw-r--r--patches.renesas/0289-ASoC-rsnd-src-make-sure-SRC-soft-reset.patch61
-rw-r--r--patches.renesas/0290-ASoC-rsnd-enable-module-multi-connection.patch41
-rw-r--r--patches.renesas/0291-ASoC-rsnd-rename-rsnd_path_parse-break-into-add-remo.patch75
-rw-r--r--patches.renesas/0292-ASoC-rsnd-add-rsnd_path_parse-for-CTU-MIX-DVC-route-.patch135
-rw-r--r--patches.renesas/0293-ASoC-rsnd-add-rsnd_dvc_initialize_lock-unlock.patch71
-rw-r--r--patches.renesas/0294-ASoC-rsnd-add-rsnd_src_initialize_lock-unlock.patch76
-rw-r--r--patches.renesas/0295-ASoC-rsnd-tidyup-ADINR-function-name.patch92
-rw-r--r--patches.renesas/0296-ASoC-rsnd-add-rsnd_get_adinr_chan.patch68
-rw-r--r--patches.renesas/0297-ASoC-rsnd-tidyup-data-align-position.patch169
-rw-r--r--patches.renesas/0298-ASoC-rsnd-show-debug-message-for-SSI-SRC-DVC-connect.patch43
-rw-r--r--patches.renesas/0299-ASoC-rsnd-tidyup-rsnd_dma_ops-definition-place.patch57
-rw-r--r--patches.renesas/0300-ASoC-rsnd-check-the-Gen1-at-the-beginning-of-DVC-pro.patch49
-rw-r--r--patches.renesas/0301-ASoC-rsnd-dma-add-DMA-name-on-.ops.patch79
-rw-r--r--patches.renesas/0302-ASoC-rsnd-add-rsnd_io_to_mod.patch39
-rw-r--r--patches.renesas/0303-ASoC-rsnd-tidyup-SRC-position-on-each-code.patch123
-rw-r--r--patches.renesas/0304-ASoC-rsnd-update-Audio-DMA-path-search-method.patch151
-rw-r--r--patches.renesas/0305-ASoC-rsnd-add-CTU-Channel-Transfer-Unit-prototype-su.patch474
-rw-r--r--patches.renesas/0306-ASoC-rsnd-add-MIX-Mixer-support.patch611
-rw-r--r--patches.renesas/0307-ASoC-rsnd-tidyup-parameter-assignment-position.patch44
-rw-r--r--patches.renesas/0308-ASoC-rcar-ctu-Staticise-local-symbols.patch36
-rw-r--r--patches.renesas/0309-ASoC-rsnd-Silence-DMA-slave-ID-compile-warning-on-64.patch42
-rw-r--r--patches.renesas/0310-irqchip-renesas-intc-irqpin-Use-a-separate-lockdep-c.patch101
-rw-r--r--patches.renesas/0311-irqchip-renesas-intc-irqpin-Propagate-wake-up-settin.patch51
-rw-r--r--patches.renesas/0312-irqchip-renesas-irqc-Use-a-separate-lockdep-class.patch97
-rw-r--r--patches.renesas/0313-irqchip-renesas-irqc-Propagate-wake-up-settings-to-p.patch50
-rw-r--r--patches.renesas/0314-pinctrl-join-lines-that-can-be-a-single-line-within-.patch33
-rw-r--r--patches.renesas/0315-pinctrl-core-Warn-about-NULL-gpio_chip-in-pinctrl_re.patch36
-rw-r--r--patches.renesas/0316-PCI-rcar-Add-R8A7794-support.patch46
-rw-r--r--patches.renesas/0317-drivers-sh-Disable-legacy-default-PM-Domain-on-emev2.patch36
-rw-r--r--patches.renesas/0318-drivers-sh-Disable-PM-runtime-for-multi-platform-ARM.patch70
-rw-r--r--patches.renesas/0319-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain-.patch36
-rw-r--r--patches.renesas/0320-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain-.patch36
-rw-r--r--patches.renesas/0321-spi-sh-msiof-Match-renesas-rx-fifo-size-in-DT-bindin.patch34
-rw-r--r--patches.renesas/0322-usb-renesas_usbhs-Change-USBHS_TYPE_R8A779x-to-USBHS.patch80
-rw-r--r--patches.renesas/0323-usb-renesas_usbhs-Add-support-for-R-Car-E2.patch47
-rw-r--r--patches.renesas/0324-usb-renesas_usbhs-fix-build-warning-if-64-bit-archit.patch50
-rw-r--r--patches.renesas/0325-usb-renesas_usbhs-Add-support-for-R-Car-H3.patch45
-rw-r--r--patches.renesas/0328-sh_eth-fix-RX-buffer-size-calculation.patch36
-rw-r--r--patches.renesas/0329-Revert-staging-board-disable-as-it-breaks-the-build.patch36
-rw-r--r--patches.renesas/0330-staging-board-Initialize-staging-board-code-earlier.patch36
-rw-r--r--patches.renesas/0331-staging-board-Add-support-for-translating-hwirq-to-v.patch147
-rw-r--r--patches.renesas/0332-staging-board-kzm9d-Translate-hwirq-numbers-to-virq-.patch53
-rw-r--r--patches.renesas/0333-staging-board-Add-support-for-devices-with-complex-d.patch141
-rw-r--r--patches.renesas/0334-staging-board-armadillo800eva-Board-staging-for-sh_m.patch152
-rw-r--r--patches.renesas/0335-staging-make-board-support-depend-on-OF_IRQ-and-CLKD.patch55
-rw-r--r--patches.renesas/0336-staging-board-Migrate-away-from-__pm_genpd_name_add_.patch92
-rw-r--r--patches.renesas/0337-ARM-dts-fix-gpio-keys-wakeup-source-property.patch115
-rw-r--r--patches.renesas/clkdev-const-ify-connection-id-to-clk_add_alias.patch49
-rw-r--r--patches.renesas/clkdev-get-rid-of-redundant-clk_add_alias-prototype-in-linux-clk.h.patch111
-rw-r--r--patches.renesas/clkdev-use-clk_hw-internally.patch125
-rw-r--r--patches.renesas/clockevents-drivers-sh_cmt-only-perform-clocksource-suspend-resume-if-enabled.patch107
-rw-r--r--patches.renesas/pm-domains-skip-timings-during-syscore-suspend-resume.patch215
-rw-r--r--series408
408 files changed, 4 insertions, 74826 deletions
diff --git a/KERNEL_VERSION b/KERNEL_VERSION
index 4b4d80f46d051c..ef01d37040d772 100644
--- a/KERNEL_VERSION
+++ b/KERNEL_VERSION
@@ -1 +1 @@
-4.1.42
+4.9.40
diff --git a/patches.altera/0001-ARM-Add-msi.h-to-Kbuild.patch b/patches.altera/0001-ARM-Add-msi.h-to-Kbuild.patch
deleted file mode 100644
index 6ae892ea75e240..00000000000000
--- a/patches.altera/0001-ARM-Add-msi.h-to-Kbuild.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 12648d2bb2f4fec718948e9758aafa251ade27d0 Mon Sep 17 00:00:00 2001
-From: Ley Foon Tan <lftan@altera.com>
-Date: Wed, 9 Dec 2015 21:07:22 +0800
-Subject: [PATCH 1/7] ARM: Add msi.h to Kbuild
-
-Include asm-generic/msi.h to support CONFIG_GENERIC_MSI_IRQ_DOMAIN.
-This fixes a compilation error:
-
- include/linux/msi.h:123:21: fatal error: asm/msi.h: No such file or directory
-
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
----
- arch/arm/include/asm/Kbuild | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
-index 3c4596d0ce6c..01806f52768c 100644
---- a/arch/arm/include/asm/Kbuild
-+++ b/arch/arm/include/asm/Kbuild
-@@ -14,6 +14,7 @@ generic-y += local.h
- generic-y += local64.h
- generic-y += mcs_spinlock.h
- generic-y += msgbuf.h
-+generic-y += msi.h
- generic-y += param.h
- generic-y += parport.h
- generic-y += poll.h
---
-2.6.3
-
diff --git a/patches.altera/0001-ARM-socfpga-dts-add-cpu1-start-addr-for-Arria-10.patch b/patches.altera/0001-ARM-socfpga-dts-add-cpu1-start-addr-for-Arria-10.patch
deleted file mode 100644
index 53b07a149c714b..00000000000000
--- a/patches.altera/0001-ARM-socfpga-dts-add-cpu1-start-addr-for-Arria-10.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From f456a6f437ae935f3849ee21f4c522745cfb53f2 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Mon, 9 Mar 2015 22:41:17 -0500
-Subject: [PATCH 01/39] ARM: socfpga: dts: add cpu1-start-addr for Arria 10
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 6770a255b7650d574c5050c11f08cfeab5dfc498)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga_arria10.dtsi | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index 8a05c47fd57f..69d616a05b14 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -284,6 +284,7 @@
- sysmgr: sysmgr@ffd06000 {
- compatible = "altr,sys-mgr", "syscon";
- reg = <0xffd06000 0x300>;
-+ cpu1-start-addr = <0xffd06230>;
- };
-
- /* Local timer */
---
-2.6.2
-
diff --git a/patches.altera/0001-nios2-Export-get_cycles.patch b/patches.altera/0001-nios2-Export-get_cycles.patch
deleted file mode 100644
index 6e6c3d94c31700..00000000000000
--- a/patches.altera/0001-nios2-Export-get_cycles.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From b0d9b942747467745e6035caa5272a6c919141c2 Mon Sep 17 00:00:00 2001
-From: Herbert Xu <herbert@gondor.apana.org.au>
-Date: Tue, 9 Jun 2015 12:46:46 +0800
-Subject: [PATCH 1/9] nios2: Export get_cycles
-
-nios2 is the only architecture that does not inline get_cycles
-and does not export it. This breaks crypto as it uses get_cycles
-in a number of modules.
-
-Reported-by: Guenter Roeck <linux@roeck-us.net>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- arch/nios2/kernel/time.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/arch/nios2/kernel/time.c b/arch/nios2/kernel/time.c
-index 7f4547418ee1..be186a75f622 100644
---- a/arch/nios2/kernel/time.c
-+++ b/arch/nios2/kernel/time.c
-@@ -8,6 +8,7 @@
- * for more details.
- */
-
-+#include <linux/export.h>
- #include <linux/interrupt.h>
- #include <linux/clockchips.h>
- #include <linux/clocksource.h>
-@@ -106,6 +107,7 @@ cycles_t get_cycles(void)
- {
- return nios2_timer_read(&nios2_cs.cs);
- }
-+EXPORT_SYMBOL(get_cycles);
-
- static void nios2_timer_start(struct nios2_timer *timer)
- {
---
-2.6.2
-
diff --git a/patches.altera/0001-usage-documentation-for-FPGA-manager-core.patch b/patches.altera/0001-usage-documentation-for-FPGA-manager-core.patch
deleted file mode 100644
index 08b4c2fcd955ca..00000000000000
--- a/patches.altera/0001-usage-documentation-for-FPGA-manager-core.patch
+++ /dev/null
@@ -1,196 +0,0 @@
-From 0cf026d06a9d7f22f2d29de5ac43edd10c676fe1 Mon Sep 17 00:00:00 2001
-From: Alan Tull <atull@opensource.altera.com>
-Date: Wed, 7 Oct 2015 16:36:26 +0100
-Subject: [PATCH 1/7] usage documentation for FPGA manager core
-
-Add a document on the new FPGA manager core.
-
-Signed-off-by: Alan Tull <atull@opensource.altera.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit e8f5fda1ad477f02bf82a50284acbd0f7f1364e3)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- Documentation/fpga/fpga-mgr.txt | 171 ++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 171 insertions(+)
- create mode 100644 Documentation/fpga/fpga-mgr.txt
-
-diff --git a/Documentation/fpga/fpga-mgr.txt b/Documentation/fpga/fpga-mgr.txt
-new file mode 100644
-index 000000000000..ce3e84fa9023
---- /dev/null
-+++ b/Documentation/fpga/fpga-mgr.txt
-@@ -0,0 +1,171 @@
-+FPGA Manager Core
-+
-+Alan Tull 2015
-+
-+Overview
-+========
-+
-+The FPGA manager core exports a set of functions for programming an FPGA with
-+an image. The API is manufacturer agnostic. All manufacturer specifics are
-+hidden away in a low level driver which registers a set of ops with the core.
-+The FPGA image data itself is very manufacturer specific, but for our purposes
-+it's just binary data. The FPGA manager core won't parse it.
-+
-+
-+API Functions:
-+==============
-+
-+To program the FPGA from a file or from a buffer:
-+-------------------------------------------------
-+
-+ int fpga_mgr_buf_load(struct fpga_manager *mgr, u32 flags,
-+ const char *buf, size_t count);
-+
-+Load the FPGA from an image which exists as a buffer in memory.
-+
-+ int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
-+ const char *image_name);
-+
-+Load the FPGA from an image which exists as a file. The image file must be on
-+the firmware search path (see the firmware class documentation).
-+
-+For both these functions, flags == 0 for normal full reconfiguration or
-+FPGA_MGR_PARTIAL_RECONFIG for partial reconfiguration. If successful, the FPGA
-+ends up in operating mode. Return 0 on success or a negative error code.
-+
-+
-+To get/put a reference to a FPGA manager:
-+-----------------------------------------
-+
-+ struct fpga_manager *of_fpga_mgr_get(struct device_node *node);
-+
-+ void fpga_mgr_put(struct fpga_manager *mgr);
-+
-+Given a DT node, get an exclusive reference to a FPGA manager or release
-+the reference.
-+
-+
-+To register or unregister the low level FPGA-specific driver:
-+-------------------------------------------------------------
-+
-+ int fpga_mgr_register(struct device *dev, const char *name,
-+ const struct fpga_manager_ops *mops,
-+ void *priv);
-+
-+ void fpga_mgr_unregister(struct device *dev);
-+
-+Use of these two functions is described below in "How To Support a new FPGA
-+device."
-+
-+
-+How to write an image buffer to a supported FPGA
-+================================================
-+/* Include to get the API */
-+#include <linux/fpga/fpga-mgr.h>
-+
-+/* device node that specifies the FPGA manager to use */
-+struct device_node *mgr_node = ...
-+
-+/* FPGA image is in this buffer. count is size of the buffer. */
-+char *buf = ...
-+int count = ...
-+
-+/* flags indicates whether to do full or partial reconfiguration */
-+int flags = 0;
-+
-+int ret;
-+
-+/* Get exclusive control of FPGA manager */
-+struct fpga_manager *mgr = of_fpga_mgr_get(mgr_node);
-+
-+/* Load the buffer to the FPGA */
-+ret = fpga_mgr_buf_load(mgr, flags, buf, count);
-+
-+/* Release the FPGA manager */
-+fpga_mgr_put(mgr);
-+
-+
-+How to write an image file to a supported FPGA
-+==============================================
-+/* Include to get the API */
-+#include <linux/fpga/fpga-mgr.h>
-+
-+/* device node that specifies the FPGA manager to use */
-+struct device_node *mgr_node = ...
-+
-+/* FPGA image is in this file which is in the firmware search path */
-+const char *path = "fpga-image-9.rbf"
-+
-+/* flags indicates whether to do full or partial reconfiguration */
-+int flags = 0;
-+
-+int ret;
-+
-+/* Get exclusive control of FPGA manager */
-+struct fpga_manager *mgr = of_fpga_mgr_get(mgr_node);
-+
-+/* Get the firmware image (path) and load it to the FPGA */
-+ret = fpga_mgr_firmware_load(mgr, flags, path);
-+
-+/* Release the FPGA manager */
-+fpga_mgr_put(mgr);
-+
-+
-+How to support a new FPGA device
-+================================
-+To add another FPGA manager, write a driver that implements a set of ops. The
-+probe function calls fpga_mgr_register(), such as:
-+
-+static const struct fpga_manager_ops socfpga_fpga_ops = {
-+ .write_init = socfpga_fpga_ops_configure_init,
-+ .write = socfpga_fpga_ops_configure_write,
-+ .write_complete = socfpga_fpga_ops_configure_complete,
-+ .state = socfpga_fpga_ops_state,
-+};
-+
-+static int socfpga_fpga_probe(struct platform_device *pdev)
-+{
-+ struct device *dev = &pdev->dev;
-+ struct socfpga_fpga_priv *priv;
-+ int ret;
-+
-+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-+ if (!priv)
-+ return -ENOMEM;
-+
-+ /* ... do ioremaps, get interrupts, etc. and save
-+ them in priv... */
-+
-+ return fpga_mgr_register(dev, "Altera SOCFPGA FPGA Manager",
-+ &socfpga_fpga_ops, priv);
-+}
-+
-+static int socfpga_fpga_remove(struct platform_device *pdev)
-+{
-+ fpga_mgr_unregister(&pdev->dev);
-+
-+ return 0;
-+}
-+
-+
-+The ops will implement whatever device specific register writes are needed to
-+do the programming sequence for this particular FPGA. These ops return 0 for
-+success or negative error codes otherwise.
-+
-+The programming sequence is:
-+ 1. .write_init
-+ 2. .write (may be called once or multiple times)
-+ 3. .write_complete
-+
-+The .write_init function will prepare the FPGA to receive the image data.
-+
-+The .write function writes a buffer to the FPGA. The buffer may be contain the
-+whole FPGA image or may be a smaller chunk of an FPGA image. In the latter
-+case, this function is called multiple times for successive chunks.
-+
-+The .write_complete function is called after all the image has been written
-+to put the FPGA into operating mode.
-+
-+The ops include a .state function which will read the hardware FPGA manager and
-+return a code of type enum fpga_mgr_states. It doesn't result in a change in
-+hardware state.
---
-2.6.2
-
diff --git a/patches.altera/0002-ARM-socfpga-dts-disable-the-sdmmc-and-uart-nodes-in-.patch b/patches.altera/0002-ARM-socfpga-dts-disable-the-sdmmc-and-uart-nodes-in-.patch
deleted file mode 100644
index c48258e83cd6ec..00000000000000
--- a/patches.altera/0002-ARM-socfpga-dts-disable-the-sdmmc-and-uart-nodes-in-.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 3f654bb5a6966029388184f489f5c531c5949971 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Mon, 9 Mar 2015 23:05:21 -0500
-Subject: [PATCH 02/39] ARM: socfpga: dts: disable the sdmmc, and uart nodes in
- the base arria10
-
-Add status = "disabled" in the base DTSI for Arria10. The SDMMC and uart
-nodes should be enabled in the appropriate board file.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry-picked from commit 1dfb7d2fd6a8f9c69f0b434473637d88917c9ec7)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga_arria10.dtsi | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index 69d616a05b14..d8436095b1dd 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -268,6 +268,7 @@
- reg = <0xff808000 0x1000>;
- interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
- fifo-depth = <0x400>;
-+ status = "disabled";
- };
-
- ocram: sram@ffe00000 {
-@@ -324,6 +325,7 @@
- interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
- reg-shift = <2>;
- reg-io-width = <4>;
-+ status = "disabled";
- };
-
- uart1: serial1@ffc02100 {
-@@ -332,6 +334,7 @@
- interrupts = <0 111 IRQ_TYPE_LEVEL_HIGH>;
- reg-shift = <2>;
- reg-io-width = <4>;
-+ status = "disabled";
- };
-
- usbphy0: usbphy@0 {
---
-2.6.2
-
diff --git a/patches.altera/0002-PCI-altera-Add-Altera-PCIe-host-controller-driver.patch b/patches.altera/0002-PCI-altera-Add-Altera-PCIe-host-controller-driver.patch
deleted file mode 100644
index d354ca7202a60c..00000000000000
--- a/patches.altera/0002-PCI-altera-Add-Altera-PCIe-host-controller-driver.patch
+++ /dev/null
@@ -1,731 +0,0 @@
-From 2ad8e4c2e98b8c67c94d831e2f5a8056178c4fbb Mon Sep 17 00:00:00 2001
-From: Ley Foon Tan <lftan@altera.com>
-Date: Wed, 9 Dec 2015 21:07:23 +0800
-Subject: [PATCH 2/7] PCI: altera: Add Altera PCIe host controller driver
-
-Add the Altera PCIe host controller driver.
-
-[lftan: backport to 4.1-ltsi]
-[bhelgaas: whitespace, fold in DT and maintainer updates, OF_PCI
-dependency from Arnd]
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
-Acked-by: Rob Herring <robh@kernel.org> (DT binding)
----
- Documentation/devicetree/bindings/pci/altera-pcie.txt | 49 +
- MAINTAINERS | 8
- drivers/pci/host/Kconfig | 9
- drivers/pci/host/Makefile | 1
- drivers/pci/host/pcie-altera.c | 612 ++++++++++++++++++
- 5 files changed, 679 insertions(+)
- create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie.txt
- create mode 100644 drivers/pci/host/pcie-altera.c
-
---- /dev/null
-+++ b/Documentation/devicetree/bindings/pci/altera-pcie.txt
-@@ -0,0 +1,49 @@
-+* Altera PCIe controller
-+
-+Required properties:
-+- compatible : should contain "altr,pcie-root-port-1.0"
-+- reg: a list of physical base address and length for TXS and CRA.
-+- reg-names: must include the following entries:
-+ "Txs": TX slave port region
-+ "Cra": Control register access region
-+- interrupt-parent: interrupt source phandle.
-+- interrupts: specifies the interrupt source of the parent interrupt controller.
-+ The format of the interrupt specifier depends on the parent interrupt
-+ controller.
-+- device_type: must be "pci"
-+- #address-cells: set to <3>
-+- #size-cells: set to <2>
-+- #interrupt-cells: set to <1>
-+- ranges: describes the translation of addresses for root ports and standard
-+ PCI regions.
-+- interrupt-map-mask and interrupt-map: standard PCI properties to define the
-+ mapping of the PCIe interface to interrupt numbers.
-+
-+Optional properties:
-+- msi-parent: Link to the hardware entity that serves as the MSI controller for this PCIe
-+ controller.
-+- bus-range: PCI bus numbers covered
-+
-+Example
-+ pcie_0: pcie@0xc00000000 {
-+ compatible = "altr,pcie-root-port-1.0";
-+ reg = <0xc0000000 0x20000000>,
-+ <0xff220000 0x00004000>;
-+ reg-names = "Txs", "Cra";
-+ interrupt-parent = <&hps_0_arm_gic_0>;
-+ interrupts = <0 40 4>;
-+ interrupt-controller;
-+ #interrupt-cells = <1>;
-+ bus-range = <0x0 0xFF>;
-+ device_type = "pci";
-+ msi-parent = <&msi_to_gic_gen_0>;
-+ #address-cells = <3>;
-+ #size-cells = <2>;
-+ interrupt-map-mask = <0 0 0 7>;
-+ interrupt-map = <0 0 0 1 &pcie_0 1>,
-+ <0 0 0 2 &pcie_0 2>,
-+ <0 0 0 3 &pcie_0 3>,
-+ <0 0 0 4 &pcie_0 4>;
-+ ranges = <0x82000000 0x00000000 0x00000000 0xc0000000 0x00000000 0x10000000
-+ 0x82000000 0x00000000 0x10000000 0xd0000000 0x00000000 0x10000000>;
-+ };
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -7509,6 +7509,14 @@ F: include/linux/pci*
- F: arch/x86/pci/
- F: arch/x86/kernel/quirks.c
-
-+PCI DRIVER FOR ALTERA PCIE IP
-+M: Ley Foon Tan <lftan@altera.com>
-+L: rfi@lists.rocketboards.org (moderated for non-subscribers)
-+L: linux-pci@vger.kernel.org
-+S: Supported
-+F: Documentation/devicetree/bindings/pci/altera-pcie.txt
-+F: drivers/pci/host/pcie-altera.c
-+
- PCI DRIVER FOR ARM VERSATILE PLATFORM
- M: Rob Herring <robh@kernel.org>
- L: linux-pci@vger.kernel.org
---- a/drivers/pci/host/Kconfig
-+++ b/drivers/pci/host/Kconfig
-@@ -125,4 +125,13 @@ config PCIE_IPROC_PLATFORM
- Say Y here if you want to use the Broadcom iProc PCIe controller
- through the generic platform bus interface
-
-+config PCIE_ALTERA
-+ bool "Altera PCIe controller"
-+ depends on ARM || NIOS2
-+ depends on OF_PCI
-+ select PCI_DOMAINS
-+ help
-+ Say Y here if you want to enable PCIe controller support on Altera
-+ FPGA.
-+
- endmenu
---- a/drivers/pci/host/Makefile
-+++ b/drivers/pci/host/Makefile
-@@ -15,3 +15,4 @@ obj-$(CONFIG_PCI_LAYERSCAPE) += pci-laye
- obj-$(CONFIG_PCI_VERSATILE) += pci-versatile.o
- obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o
- obj-$(CONFIG_PCIE_IPROC_PLATFORM) += pcie-iproc-platform.o
-+obj-$(CONFIG_PCIE_ALTERA) += pcie-altera.o
---- /dev/null
-+++ b/drivers/pci/host/pcie-altera.c
-@@ -0,0 +1,612 @@
-+/*
-+ * Copyright Altera Corporation (C) 2013-2015. All rights reserved
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+#include <linux/delay.h>
-+#include <linux/interrupt.h>
-+#include <linux/irqchip/chained_irq.h>
-+#include <linux/module.h>
-+#include <linux/of_address.h>
-+#include <linux/of_irq.h>
-+#include <linux/of_pci.h>
-+#include <linux/pci.h>
-+#include <linux/platform_device.h>
-+#include <linux/slab.h>
-+
-+#define RP_TX_REG0 0x2000
-+#define RP_TX_REG1 0x2004
-+#define RP_TX_CNTRL 0x2008
-+#define RP_TX_EOP 0x2
-+#define RP_TX_SOP 0x1
-+#define RP_RXCPL_STATUS 0x2010
-+#define RP_RXCPL_EOP 0x2
-+#define RP_RXCPL_SOP 0x1
-+#define RP_RXCPL_REG0 0x2014
-+#define RP_RXCPL_REG1 0x2018
-+#define P2A_INT_STATUS 0x3060
-+#define P2A_INT_STS_ALL 0xf
-+#define P2A_INT_ENABLE 0x3070
-+#define P2A_INT_ENA_ALL 0xf
-+#define RP_LTSSM 0x3c64
-+#define LTSSM_L0 0xf
-+
-+/* TLP configuration type 0 and 1 */
-+#define TLP_FMTTYPE_CFGRD0 0x04 /* Configuration Read Type 0 */
-+#define TLP_FMTTYPE_CFGWR0 0x44 /* Configuration Write Type 0 */
-+#define TLP_FMTTYPE_CFGRD1 0x05 /* Configuration Read Type 1 */
-+#define TLP_FMTTYPE_CFGWR1 0x45 /* Configuration Write Type 1 */
-+#define TLP_PAYLOAD_SIZE 0x01
-+#define TLP_READ_TAG 0x1d
-+#define TLP_WRITE_TAG 0x10
-+#define TLP_CFG_DW0(fmttype) (((fmttype) << 24) | TLP_PAYLOAD_SIZE)
-+#define TLP_CFG_DW1(reqid, tag, be) (((reqid) << 16) | (tag << 8) | (be))
-+#define TLP_CFG_DW2(bus, devfn, offset) \
-+ (((bus) << 24) | ((devfn) << 16) | (offset))
-+#define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn))
-+#define TLP_HDR_SIZE 3
-+#define TLP_LOOP 500
-+
-+#define INTX_NUM 4
-+
-+#define DWORD_MASK 3
-+
-+struct altera_pcie {
-+ struct platform_device *pdev;
-+ void __iomem *cra_base;
-+ int irq;
-+ u8 root_bus_nr;
-+ struct irq_domain *irq_domain;
-+ struct resource bus_range;
-+ struct list_head resources;
-+ struct msi_controller *msi;
-+};
-+
-+struct tlp_rp_regpair_t {
-+ u32 ctrl;
-+ u32 reg0;
-+ u32 reg1;
-+};
-+
-+#ifdef CONFIG_PCI_MSI
-+struct irq_domain *arch_get_pci_msi_domain(struct pci_dev *dev)
-+{
-+ struct altera_pcie *pcie = dev->bus->sysdata;
-+
-+ return pcie->msi->domain;
-+}
-+#endif /* CONFIG_PCI_MSI */
-+
-+static void altera_pcie_retrain(struct pci_dev *dev)
-+{
-+ u16 linkcap, linkstat;
-+
-+ /*
-+ * Set the retrain bit if the PCIe rootport support > 2.5GB/s, but
-+ * current speed is 2.5 GB/s.
-+ */
-+ pcie_capability_read_word(dev, PCI_EXP_LNKCAP, &linkcap);
-+
-+ if ((linkcap & PCI_EXP_LNKCAP_SLS) <= PCI_EXP_LNKCAP_SLS_2_5GB)
-+ return;
-+
-+ pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &linkstat);
-+ if ((linkstat & PCI_EXP_LNKSTA_CLS) == PCI_EXP_LNKSTA_CLS_2_5GB)
-+ pcie_capability_set_word(dev, PCI_EXP_LNKCTL,
-+ PCI_EXP_LNKCTL_RL);
-+}
-+DECLARE_PCI_FIXUP_EARLY(0x1172, PCI_ANY_ID, altera_pcie_retrain);
-+
-+/*
-+ * Altera PCIe port uses BAR0 of RC's configuration space as the translation
-+ * from PCI bus to native BUS. Entire DDR region is mapped into PCIe space
-+ * using these registers, so it can be reached by DMA from EP devices.
-+ * This BAR0 will also access to MSI vector when receiving MSI/MSIX interrupt
-+ * from EP devices, eventually trigger interrupt to GIC. The BAR0 of bridge
-+ * should be hidden during enumeration to avoid the sizing and resource
-+ * allocation by PCIe core.
-+ */
-+static bool altera_pcie_hide_rc_bar(struct pci_bus *bus, unsigned int devfn,
-+ int offset)
-+{
-+ if (pci_is_root_bus(bus) && (devfn == 0) &&
-+ (offset == PCI_BASE_ADDRESS_0))
-+ return true;
-+
-+ return false;
-+}
-+
-+static inline void cra_writel(struct altera_pcie *pcie, const u32 value,
-+ const u32 reg)
-+{
-+ writel_relaxed(value, pcie->cra_base + reg);
-+}
-+
-+static inline u32 cra_readl(struct altera_pcie *pcie, const u32 reg)
-+{
-+ return readl_relaxed(pcie->cra_base + reg);
-+}
-+
-+static void tlp_write_tx(struct altera_pcie *pcie,
-+ struct tlp_rp_regpair_t *tlp_rp_regdata)
-+{
-+ cra_writel(pcie, tlp_rp_regdata->reg0, RP_TX_REG0);
-+ cra_writel(pcie, tlp_rp_regdata->reg1, RP_TX_REG1);
-+ cra_writel(pcie, tlp_rp_regdata->ctrl, RP_TX_CNTRL);
-+}
-+
-+static bool altera_pcie_link_is_up(struct altera_pcie *pcie)
-+{
-+ return !!(cra_readl(pcie, RP_LTSSM) & LTSSM_L0);
-+}
-+
-+static bool altera_pcie_valid_config(struct altera_pcie *pcie,
-+ struct pci_bus *bus, int dev)
-+{
-+ /* If there is no link, then there is no device */
-+ if (bus->number != pcie->root_bus_nr) {
-+ if (!altera_pcie_link_is_up(pcie))
-+ return false;
-+ }
-+
-+ /* access only one slot on each root port */
-+ if (bus->number == pcie->root_bus_nr && dev > 0)
-+ return false;
-+
-+ /*
-+ * Do not read more than one device on the bus directly attached
-+ * to root port, root port can only attach to one downstream port.
-+ */
-+ if (bus->primary == pcie->root_bus_nr && dev > 0)
-+ return false;
-+
-+ return true;
-+}
-+
-+static int tlp_read_packet(struct altera_pcie *pcie, u32 *value)
-+{
-+ u8 loop;
-+ bool sop = 0;
-+ u32 ctrl;
-+ u32 reg0, reg1;
-+
-+ /*
-+ * Minimum 2 loops to read TLP headers and 1 loop to read data
-+ * payload.
-+ */
-+ for (loop = 0; loop < TLP_LOOP; loop++) {
-+ ctrl = cra_readl(pcie, RP_RXCPL_STATUS);
-+ if ((ctrl & RP_RXCPL_SOP) || (ctrl & RP_RXCPL_EOP) || sop) {
-+ reg0 = cra_readl(pcie, RP_RXCPL_REG0);
-+ reg1 = cra_readl(pcie, RP_RXCPL_REG1);
-+
-+ if (ctrl & RP_RXCPL_SOP)
-+ sop = true;
-+
-+ if (ctrl & RP_RXCPL_EOP) {
-+ if (value)
-+ *value = reg0;
-+ return PCIBIOS_SUCCESSFUL;
-+ }
-+ }
-+ udelay(5);
-+ }
-+
-+ return -ENOENT;
-+}
-+
-+static void tlp_write_packet(struct altera_pcie *pcie, u32 *headers,
-+ u32 data, bool align)
-+{
-+ struct tlp_rp_regpair_t tlp_rp_regdata;
-+
-+ tlp_rp_regdata.reg0 = headers[0];
-+ tlp_rp_regdata.reg1 = headers[1];
-+ tlp_rp_regdata.ctrl = RP_TX_SOP;
-+ tlp_write_tx(pcie, &tlp_rp_regdata);
-+
-+ if (align) {
-+ tlp_rp_regdata.reg0 = headers[2];
-+ tlp_rp_regdata.reg1 = 0;
-+ tlp_rp_regdata.ctrl = 0;
-+ tlp_write_tx(pcie, &tlp_rp_regdata);
-+
-+ tlp_rp_regdata.reg0 = data;
-+ tlp_rp_regdata.reg1 = 0;
-+ } else {
-+ tlp_rp_regdata.reg0 = headers[2];
-+ tlp_rp_regdata.reg1 = data;
-+ }
-+
-+ tlp_rp_regdata.ctrl = RP_TX_EOP;
-+ tlp_write_tx(pcie, &tlp_rp_regdata);
-+}
-+
-+static int tlp_cfg_dword_read(struct altera_pcie *pcie, u8 bus, u32 devfn,
-+ int where, u8 byte_en, u32 *value)
-+{
-+ u32 headers[TLP_HDR_SIZE];
-+
-+ if (bus == pcie->root_bus_nr)
-+ headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD0);
-+ else
-+ headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD1);
-+
-+ headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn),
-+ TLP_READ_TAG, byte_en);
-+ headers[2] = TLP_CFG_DW2(bus, devfn, where);
-+
-+ tlp_write_packet(pcie, headers, 0, false);
-+
-+ return tlp_read_packet(pcie, value);
-+}
-+
-+static int tlp_cfg_dword_write(struct altera_pcie *pcie, u8 bus, u32 devfn,
-+ int where, u8 byte_en, u32 value)
-+{
-+ u32 headers[TLP_HDR_SIZE];
-+ int ret;
-+
-+ if (bus == pcie->root_bus_nr)
-+ headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGWR0);
-+ else
-+ headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGWR1);
-+
-+ headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn),
-+ TLP_WRITE_TAG, byte_en);
-+ headers[2] = TLP_CFG_DW2(bus, devfn, where);
-+
-+ /* check alignment to Qword */
-+ if ((where & 0x7) == 0)
-+ tlp_write_packet(pcie, headers, value, true);
-+ else
-+ tlp_write_packet(pcie, headers, value, false);
-+
-+ ret = tlp_read_packet(pcie, NULL);
-+ if (ret != PCIBIOS_SUCCESSFUL)
-+ return ret;
-+
-+ /*
-+ * Monitor changes to PCI_PRIMARY_BUS register on root port
-+ * and update local copy of root bus number accordingly.
-+ */
-+ if ((bus == pcie->root_bus_nr) && (where == PCI_PRIMARY_BUS))
-+ pcie->root_bus_nr = (u8)(value);
-+
-+ return PCIBIOS_SUCCESSFUL;
-+}
-+
-+static int altera_pcie_cfg_read(struct pci_bus *bus, unsigned int devfn,
-+ int where, int size, u32 *value)
-+{
-+ struct altera_pcie *pcie = bus->sysdata;
-+ int ret;
-+ u32 data;
-+ u8 byte_en;
-+
-+ if (altera_pcie_hide_rc_bar(bus, devfn, where))
-+ return PCIBIOS_BAD_REGISTER_NUMBER;
-+
-+ if (!altera_pcie_valid_config(pcie, bus, PCI_SLOT(devfn))) {
-+ *value = 0xffffffff;
-+ return PCIBIOS_DEVICE_NOT_FOUND;
-+ }
-+
-+ switch (size) {
-+ case 1:
-+ byte_en = 1 << (where & 3);
-+ break;
-+ case 2:
-+ byte_en = 3 << (where & 3);
-+ break;
-+ default:
-+ byte_en = 0xf;
-+ break;
-+ }
-+
-+ ret = tlp_cfg_dword_read(pcie, bus->number, devfn,
-+ (where & ~DWORD_MASK), byte_en, &data);
-+ if (ret != PCIBIOS_SUCCESSFUL)
-+ return ret;
-+
-+ switch (size) {
-+ case 1:
-+ *value = (data >> (8 * (where & 0x3))) & 0xff;
-+ break;
-+ case 2:
-+ *value = (data >> (8 * (where & 0x2))) & 0xffff;
-+ break;
-+ default:
-+ *value = data;
-+ break;
-+ }
-+
-+ return PCIBIOS_SUCCESSFUL;
-+}
-+
-+static int altera_pcie_cfg_write(struct pci_bus *bus, unsigned int devfn,
-+ int where, int size, u32 value)
-+{
-+ struct altera_pcie *pcie = bus->sysdata;
-+ u32 data32;
-+ u32 shift = 8 * (where & 3);
-+ u8 byte_en;
-+
-+ if (altera_pcie_hide_rc_bar(bus, devfn, where))
-+ return PCIBIOS_BAD_REGISTER_NUMBER;
-+
-+ if (!altera_pcie_valid_config(pcie, bus, PCI_SLOT(devfn)))
-+ return PCIBIOS_DEVICE_NOT_FOUND;
-+
-+ switch (size) {
-+ case 1:
-+ data32 = (value & 0xff) << shift;
-+ byte_en = 1 << (where & 3);
-+ break;
-+ case 2:
-+ data32 = (value & 0xffff) << shift;
-+ byte_en = 3 << (where & 3);
-+ break;
-+ default:
-+ data32 = value;
-+ byte_en = 0xf;
-+ break;
-+ }
-+
-+ return tlp_cfg_dword_write(pcie, bus->number, devfn,
-+ (where & ~DWORD_MASK), byte_en, data32);
-+}
-+
-+static struct pci_ops altera_pcie_ops = {
-+ .read = altera_pcie_cfg_read,
-+ .write = altera_pcie_cfg_write,
-+};
-+
-+static int altera_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
-+ irq_hw_number_t hwirq)
-+{
-+ irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq);
-+ irq_set_chip_data(irq, domain->host_data);
-+
-+ return 0;
-+}
-+
-+static const struct irq_domain_ops intx_domain_ops = {
-+ .map = altera_pcie_intx_map,
-+};
-+
-+static void altera_pcie_isr(unsigned int irq, struct irq_desc *desc)
-+{
-+ struct irq_chip *chip = irq_desc_get_chip(desc);
-+ struct altera_pcie *pcie;
-+ unsigned long status;
-+ u32 bit;
-+ u32 virq;
-+
-+ chained_irq_enter(chip, desc);
-+ pcie = irq_desc_get_handler_data(desc);
-+
-+ while ((status = cra_readl(pcie, P2A_INT_STATUS)
-+ & P2A_INT_STS_ALL) != 0) {
-+ for_each_set_bit(bit, &status, INTX_NUM) {
-+ /* clear interrupts */
-+ cra_writel(pcie, 1 << bit, P2A_INT_STATUS);
-+
-+ virq = irq_find_mapping(pcie->irq_domain, bit + 1);
-+ if (virq)
-+ generic_handle_irq(virq);
-+ else
-+ dev_err(&pcie->pdev->dev,
-+ "unexpected IRQ, INT%d\n", bit);
-+ }
-+ }
-+
-+ chained_irq_exit(chip, desc);
-+}
-+
-+static void altera_pcie_release_of_pci_ranges(struct altera_pcie *pcie)
-+{
-+ pci_free_resource_list(&pcie->resources);
-+}
-+
-+static int altera_pcie_parse_request_of_pci_ranges(struct altera_pcie *pcie)
-+{
-+ int err, res_valid = 0;
-+ struct device *dev = &pcie->pdev->dev;
-+ struct device_node *np = dev->of_node;
-+ struct resource_entry *win;
-+
-+ err = of_pci_get_host_bridge_resources(np, 0, 0xff, &pcie->resources,
-+ NULL);
-+ if (err)
-+ return err;
-+
-+ resource_list_for_each_entry(win, &pcie->resources) {
-+ struct resource *parent, *res = win->res;
-+
-+ switch (resource_type(res)) {
-+ case IORESOURCE_MEM:
-+ parent = &iomem_resource;
-+ res_valid |= !(res->flags & IORESOURCE_PREFETCH);
-+ break;
-+ default:
-+ continue;
-+ }
-+
-+ err = devm_request_resource(dev, parent, res);
-+ if (err)
-+ goto out_release_res;
-+ }
-+
-+ if (!res_valid) {
-+ dev_err(dev, "non-prefetchable memory resource required\n");
-+ err = -EINVAL;
-+ goto out_release_res;
-+ }
-+
-+ return 0;
-+
-+out_release_res:
-+ altera_pcie_release_of_pci_ranges(pcie);
-+ return err;
-+}
-+
-+static int altera_pcie_init_irq_domain(struct altera_pcie *pcie)
-+{
-+ struct device *dev = &pcie->pdev->dev;
-+ struct device_node *node = dev->of_node;
-+
-+ /* Setup INTx */
-+ pcie->irq_domain = irq_domain_add_linear(node, INTX_NUM,
-+ &intx_domain_ops, pcie);
-+ if (!pcie->irq_domain) {
-+ dev_err(dev, "Failed to get a INTx IRQ domain\n");
-+ return -ENOMEM;
-+ }
-+
-+ return 0;
-+}
-+
-+static int altera_pcie_parse_dt(struct altera_pcie *pcie)
-+{
-+ struct resource *cra;
-+ struct platform_device *pdev = pcie->pdev;
-+
-+ cra = platform_get_resource_byname(pdev, IORESOURCE_MEM, "Cra");
-+ if (!cra) {
-+ dev_err(&pdev->dev, "no Cra memory resource defined\n");
-+ return -ENODEV;
-+ }
-+
-+ pcie->cra_base = devm_ioremap_resource(&pdev->dev, cra);
-+ if (IS_ERR(pcie->cra_base)) {
-+ dev_err(&pdev->dev, "failed to map cra memory\n");
-+ return PTR_ERR(pcie->cra_base);
-+ }
-+
-+ /* setup IRQ */
-+ pcie->irq = platform_get_irq(pdev, 0);
-+ if (pcie->irq <= 0) {
-+ dev_err(&pdev->dev, "failed to get IRQ: %d\n", pcie->irq);
-+ return -EINVAL;
-+ }
-+
-+ irq_set_handler_data(pcie->irq, pcie);
-+ irq_set_chained_handler(pcie->irq, altera_pcie_isr);
-+
-+ return 0;
-+}
-+
-+static int altera_pcie_msi_enable(struct altera_pcie *pcie)
-+{
-+ struct device_node *msi_node;
-+
-+ msi_node = of_parse_phandle(pcie->pdev->dev.of_node,
-+ "msi-parent", 0);
-+
-+ if (!msi_node)
-+ return -ENODEV;
-+
-+ pcie->msi = of_pci_find_msi_chip_by_node(msi_node);
-+
-+ if (!pcie->msi)
-+ return -ENODEV;
-+
-+ return 0;
-+}
-+
-+static int altera_pcie_probe(struct platform_device *pdev)
-+{
-+ struct altera_pcie *pcie;
-+ struct pci_bus *bus;
-+ struct pci_bus *child;
-+ int ret;
-+
-+ pcie = devm_kzalloc(&pdev->dev, sizeof(*pcie), GFP_KERNEL);
-+ if (!pcie)
-+ return -ENOMEM;
-+
-+ pcie->pdev = pdev;
-+
-+ ret = altera_pcie_parse_dt(pcie);
-+ if (ret) {
-+ dev_err(&pdev->dev, "Parsing DT failed\n");
-+ return ret;
-+ }
-+
-+ INIT_LIST_HEAD(&pcie->resources);
-+
-+ ret = altera_pcie_parse_request_of_pci_ranges(pcie);
-+ if (ret) {
-+ dev_err(&pdev->dev, "Failed add resources\n");
-+ return ret;
-+ }
-+
-+ ret = altera_pcie_init_irq_domain(pcie);
-+ if (ret) {
-+ dev_err(&pdev->dev, "Failed creating IRQ Domain\n");
-+ return ret;
-+ }
-+
-+ /* clear all interrupts */
-+ cra_writel(pcie, P2A_INT_STS_ALL, P2A_INT_STATUS);
-+ /* enable all interrupts */
-+ cra_writel(pcie, P2A_INT_ENA_ALL, P2A_INT_ENABLE);
-+
-+ bus = pci_scan_root_bus(&pdev->dev, pcie->root_bus_nr, &altera_pcie_ops,
-+ pcie, &pcie->resources);
-+ if (!bus)
-+ return -ENOMEM;
-+
-+ if (IS_ENABLED(CONFIG_PCI_MSI))
-+ if (altera_pcie_msi_enable(pcie))
-+ dev_info(&pdev->dev, "failed to enable MSI\n");
-+
-+ pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
-+ pci_assign_unassigned_bus_resources(bus);
-+
-+ /* Configure PCI Express setting. */
-+ list_for_each_entry(child, &bus->children, node)
-+ pcie_bus_configure_settings(child);
-+
-+ pci_bus_add_devices(bus);
-+
-+ platform_set_drvdata(pdev, pcie);
-+ return ret;
-+}
-+
-+static const struct of_device_id altera_pcie_of_match[] = {
-+ { .compatible = "altr,pcie-root-port-1.0", },
-+ {},
-+};
-+MODULE_DEVICE_TABLE(of, altera_pcie_of_match);
-+
-+static struct platform_driver altera_pcie_driver = {
-+ .probe = altera_pcie_probe,
-+ .driver = {
-+ .name = "altera-pcie",
-+ .of_match_table = altera_pcie_of_match,
-+ .suppress_bind_attrs = true,
-+ },
-+};
-+
-+static int altera_pcie_init(void)
-+{
-+ return platform_driver_register(&altera_pcie_driver);
-+}
-+module_init(altera_pcie_init);
-+
-+MODULE_AUTHOR("Ley Foon Tan <lftan@altera.com>");
-+MODULE_DESCRIPTION("Altera PCIe host controller driver");
-+MODULE_LICENSE("GPL v2");
diff --git a/patches.altera/0002-fpga-manager-add-sysfs-interface-document.patch b/patches.altera/0002-fpga-manager-add-sysfs-interface-document.patch
deleted file mode 100644
index 82137d40ba74ae..00000000000000
--- a/patches.altera/0002-fpga-manager-add-sysfs-interface-document.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From f92ef90a1c0b6517bef416ab08ed805058fab46e Mon Sep 17 00:00:00 2001
-From: Alan Tull <atull@opensource.altera.com>
-Date: Wed, 7 Oct 2015 16:36:27 +0100
-Subject: [PATCH 2/7] fpga manager: add sysfs interface document
-
-Add documentation under drivers/staging for new fpga manager's
-sysfs interface.
-
-Signed-off-by: Alan Tull <atull@opensource.altera.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit afb79e993a949d02895b912eacc86ab0e416b6fd)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- Documentation/ABI/testing/sysfs-class-fpga-manager | 37 ++++++++++++++++++++++
- 1 file changed, 37 insertions(+)
- create mode 100644 Documentation/ABI/testing/sysfs-class-fpga-manager
-
-diff --git a/Documentation/ABI/testing/sysfs-class-fpga-manager b/Documentation/ABI/testing/sysfs-class-fpga-manager
-new file mode 100644
-index 000000000000..23056c532fdd
---- /dev/null
-+++ b/Documentation/ABI/testing/sysfs-class-fpga-manager
-@@ -0,0 +1,37 @@
-+What: /sys/class/fpga_manager/<fpga>/name
-+Date: August 2015
-+KernelVersion: 4.3
-+Contact: Alan Tull <atull@opensource.altera.com>
-+Description: Name of low level fpga manager driver.
-+
-+What: /sys/class/fpga_manager/<fpga>/state
-+Date: August 2015
-+KernelVersion: 4.3
-+Contact: Alan Tull <atull@opensource.altera.com>
-+Description: Read fpga manager state as a string.
-+ The intent is to provide enough detail that if something goes
-+ wrong during FPGA programming (something that the driver can't
-+ fix) then userspace can know, i.e. if the firmware request
-+ fails, that could be due to not being able to find the firmware
-+ file.
-+
-+ This is a superset of FPGA states and fpga manager driver
-+ states. The fpga manager driver is walking through these steps
-+ to get the FPGA into a known operating state. It's a sequence,
-+ though some steps may get skipped. Valid FPGA states will vary
-+ by manufacturer; this is a superset.
-+
-+ * unknown = can't determine state
-+ * power off = FPGA power is off
-+ * power up = FPGA reports power is up
-+ * reset = FPGA held in reset state
-+ * firmware request = firmware class request in progress
-+ * firmware request error = firmware request failed
-+ * write init = preparing FPGA for programming
-+ * write init error = Error while preparing FPGA for
-+ programming
-+ * write = FPGA ready to receive image data
-+ * write error = Error while programming
-+ * write complete = Doing post programming steps
-+ * write complete error = Error while doing post programming
-+ * operating = FPGA is programmed and operating
---
-2.6.2
-
diff --git a/patches.altera/0002-nios2-check-number-of-timer-instances.patch b/patches.altera/0002-nios2-check-number-of-timer-instances.patch
deleted file mode 100644
index 047757cd990a71..00000000000000
--- a/patches.altera/0002-nios2-check-number-of-timer-instances.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From f842e15b14fca61686a1d6488f9edaedecb302ee Mon Sep 17 00:00:00 2001
-From: Ley Foon Tan <lftan@altera.com>
-Date: Wed, 24 Jun 2015 17:52:44 +0800
-Subject: [PATCH 2/9] nios2: check number of timer instances
-
-Display error message if number of timers is less than 2.
-
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
----
- arch/nios2/kernel/time.c | 15 +++++++++++++--
- 1 file changed, 13 insertions(+), 2 deletions(-)
-
-diff --git a/arch/nios2/kernel/time.c b/arch/nios2/kernel/time.c
-index be186a75f622..9e3cc8a40ee9 100644
---- a/arch/nios2/kernel/time.c
-+++ b/arch/nios2/kernel/time.c
-@@ -19,7 +19,9 @@
- #include <linux/io.h>
- #include <linux/slab.h>
-
--#define ALTERA_TIMER_STATUS_REG 0
-+#define ALTR_TIMER_COMPATIBLE "altr,timer-1.0"
-+
-+#define ALTERA_TIMER_STATUS_REG 0
- #define ALTERA_TIMER_CONTROL_REG 4
- #define ALTERA_TIMER_PERIODL_REG 8
- #define ALTERA_TIMER_PERIODH_REG 12
-@@ -304,7 +306,16 @@ void read_persistent_clock(struct timespec *ts)
-
- void __init time_init(void)
- {
-+ struct device_node *np;
-+ int count = 0;
-+
-+ for_each_compatible_node(np, NULL, ALTR_TIMER_COMPATIBLE)
-+ count++;
-+
-+ if (count < 2)
-+ panic("%d timer is found, it needs 2 timers in system\n", count);
-+
- clocksource_of_init();
- }
-
--CLOCKSOURCE_OF_DECLARE(nios2_timer, "altr,timer-1.0", nios2_time_init);
-+CLOCKSOURCE_OF_DECLARE(nios2_timer, ALTR_TIMER_COMPATIBLE, nios2_time_init);
---
-2.6.2
-
diff --git a/patches.altera/0003-ARM-socfpga-dts-enable-UART1-for-the-debug-uart.patch b/patches.altera/0003-ARM-socfpga-dts-enable-UART1-for-the-debug-uart.patch
deleted file mode 100644
index 7c20a5f3d9b824..00000000000000
--- a/patches.altera/0003-ARM-socfpga-dts-enable-UART1-for-the-debug-uart.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 258a4abb89b030c45d155a98bb7b4a58669c6fa9 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Thu, 2 Apr 2015 13:26:35 -0500
-Subject: [PATCH 03/39] ARM: socfpga: dts: enable UART1 for the debug uart
-
-Arria10 devkit is using UART1 for the debug uart port. Remove
-unused aliases.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry-picked from commit 74568da48f69c21c8628090eaedb990369813a0b)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga_arria10.dtsi | 12 ------------
- arch/arm/boot/dts/socfpga_arria10_socdk.dts | 8 ++++----
- 2 files changed, 4 insertions(+), 16 deletions(-)
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index d8436095b1dd..6c3ad9220845 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -21,18 +21,6 @@
- #address-cells = <1>;
- #size-cells = <1>;
-
-- aliases {
-- ethernet0 = &gmac0;
-- ethernet1 = &gmac1;
-- ethernet2 = &gmac2;
-- serial0 = &uart0;
-- serial1 = &uart1;
-- timer0 = &timer0;
-- timer1 = &timer1;
-- timer2 = &timer2;
-- timer3 = &timer3;
-- };
--
- cpus {
- #address-cells = <1>;
- #size-cells = <0>;
-diff --git a/arch/arm/boot/dts/socfpga_arria10_socdk.dts b/arch/arm/boot/dts/socfpga_arria10_socdk.dts
-index 3015ce8d3057..811a61cd9dc7 100755
---- a/arch/arm/boot/dts/socfpga_arria10_socdk.dts
-+++ b/arch/arm/boot/dts/socfpga_arria10_socdk.dts
-@@ -40,9 +40,9 @@
- };
- };
- };
--
-- serial0@ffc02000 {
-- status = "okay";
-- };
- };
- };
-+
-+&uart1 {
-+ status = "okay";
-+};
---
-2.6.2
-
diff --git a/patches.altera/0003-PCI-altera-Add-Altera-PCIe-MSI-driver.patch b/patches.altera/0003-PCI-altera-Add-Altera-PCIe-MSI-driver.patch
deleted file mode 100644
index 82d04a5ad96538..00000000000000
--- a/patches.altera/0003-PCI-altera-Add-Altera-PCIe-MSI-driver.patch
+++ /dev/null
@@ -1,420 +0,0 @@
-From 43bc1a95a4e5662552b3c096e68902daeccfe180 Mon Sep 17 00:00:00 2001
-From: Ley Foon Tan <lftan@altera.com>
-Date: Wed, 9 Dec 2015 21:07:24 +0800
-Subject: [PATCH 3/7] PCI: altera: Add Altera PCIe MSI driver
-
-Add Altera PCIe MSI driver. This soft IP supports a configurable number of
-vectors, which is a DTS parameter.
-
-[lftan: backport to 4.1-ltsi]
-[bhelgaas: Kconfig depend on PCIE_ALTERA, typos, whitespace]
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
-Acked-by: Rob Herring <robh@kernel.org>
----
- Documentation/devicetree/bindings/pci/altera-pcie-msi.txt | 28 +
- MAINTAINERS | 8
- drivers/pci/host/Kconfig | 8
- drivers/pci/host/Makefile | 1
- drivers/pci/host/pcie-altera-msi.c | 323 ++++++++++++++
- 5 files changed, 368 insertions(+)
- create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
- create mode 100644 drivers/pci/host/pcie-altera-msi.c
-
---- /dev/null
-+++ b/Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
-@@ -0,0 +1,28 @@
-+* Altera PCIe MSI controller
-+
-+Required properties:
-+- compatible: should contain "altr,msi-1.0"
-+- reg: specifies the physical base address of the controller and
-+ the length of the memory mapped region.
-+- reg-names: must include the following entries:
-+ "csr": CSR registers
-+ "vector_slave": vectors slave port region
-+- interrupt-parent: interrupt source phandle.
-+- interrupts: specifies the interrupt source of the parent interrupt
-+ controller. The format of the interrupt specifier depends on the
-+ parent interrupt controller.
-+- num-vectors: number of vectors, range 1 to 32.
-+- msi-controller: indicates that this is MSI controller node
-+
-+
-+Example
-+msi0: msi@0xFF200000 {
-+ compatible = "altr,msi-1.0";
-+ reg = <0xFF200000 0x00000010
-+ 0xFF200010 0x00000080>;
-+ reg-names = "csr", "vector_slave";
-+ interrupt-parent = <&hps_0_arm_gic_0>;
-+ interrupts = <0 42 4>;
-+ msi-controller;
-+ num-vectors = <32>;
-+};
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -7618,6 +7618,14 @@ L: linux-pci@vger.kernel.org
- S: Maintained
- F: drivers/pci/host/*spear*
-
-+PCI MSI DRIVER FOR ALTERA MSI IP
-+M: Ley Foon Tan <lftan@altera.com>
-+L: rfi@lists.rocketboards.org (moderated for non-subscribers)
-+L: linux-pci@vger.kernel.org
-+S: Supported
-+F: Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
-+F: drivers/pci/host/pcie-altera-msi.c
-+
- PCMCIA SUBSYSTEM
- P: Linux PCMCIA Team
- L: linux-pcmcia@lists.infradead.org
---- a/drivers/pci/host/Kconfig
-+++ b/drivers/pci/host/Kconfig
-@@ -134,4 +134,12 @@ config PCIE_ALTERA
- Say Y here if you want to enable PCIe controller support on Altera
- FPGA.
-
-+config PCIE_ALTERA_MSI
-+ bool "Altera PCIe MSI feature"
-+ depends on PCIE_ALTERA && PCI_MSI
-+ select PCI_MSI_IRQ_DOMAIN
-+ help
-+ Say Y here if you want PCIe MSI support for the Altera FPGA.
-+ This MSI driver supports Altera MSI to GIC controller IP.
-+
- endmenu
---- a/drivers/pci/host/Makefile
-+++ b/drivers/pci/host/Makefile
-@@ -16,3 +16,4 @@ obj-$(CONFIG_PCI_VERSATILE) += pci-versa
- obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o
- obj-$(CONFIG_PCIE_IPROC_PLATFORM) += pcie-iproc-platform.o
- obj-$(CONFIG_PCIE_ALTERA) += pcie-altera.o
-+obj-$(CONFIG_PCIE_ALTERA_MSI) += pcie-altera-msi.o
---- /dev/null
-+++ b/drivers/pci/host/pcie-altera-msi.c
-@@ -0,0 +1,323 @@
-+/*
-+ * Copyright Altera Corporation (C) 2013-2015. All rights reserved
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+#include <linux/interrupt.h>
-+#include <linux/irqchip/chained_irq.h>
-+#include <linux/module.h>
-+#include <linux/msi.h>
-+#include <linux/of_address.h>
-+#include <linux/of_irq.h>
-+#include <linux/of_pci.h>
-+#include <linux/pci.h>
-+#include <linux/platform_device.h>
-+#include <linux/slab.h>
-+
-+#define MSI_STATUS 0x0
-+#define MSI_ERROR 0x4
-+#define MSI_INTMASK 0x8
-+
-+#define MAX_MSI_VECTORS 32
-+
-+struct altera_msi {
-+ DECLARE_BITMAP(used, MAX_MSI_VECTORS);
-+ struct mutex lock; /* protect "used" bitmap */
-+ struct platform_device *pdev;
-+ struct irq_domain *inner_domain;
-+ void __iomem *csr_base;
-+ void __iomem *vector_base;
-+ phys_addr_t vector_phy;
-+ u32 num_of_vectors;
-+ int irq;
-+ struct msi_controller mchip;
-+};
-+
-+static inline void msi_writel(struct altera_msi *msi, const u32 value,
-+ const u32 reg)
-+{
-+ writel_relaxed(value, msi->csr_base + reg);
-+}
-+
-+static inline u32 msi_readl(struct altera_msi *msi, const u32 reg)
-+{
-+ return readl_relaxed(msi->csr_base + reg);
-+}
-+
-+static void altera_msi_isr(unsigned int irq, struct irq_desc *desc)
-+{
-+ struct irq_chip *chip = irq_desc_get_chip(desc);
-+ struct altera_msi *msi;
-+ unsigned long status;
-+ u32 num_of_vectors;
-+ u32 bit;
-+ u32 virq;
-+
-+ chained_irq_enter(chip, desc);
-+ msi = irq_desc_get_handler_data(desc);
-+ num_of_vectors = msi->num_of_vectors;
-+
-+ while ((status = msi_readl(msi, MSI_STATUS)) != 0) {
-+ for_each_set_bit(bit, &status, msi->num_of_vectors) {
-+ /* Dummy read from vector to clear the interrupt */
-+ readl_relaxed(msi->vector_base + (bit * sizeof(u32)));
-+
-+ virq = irq_find_mapping(msi->inner_domain, bit);
-+ if (virq)
-+ generic_handle_irq(virq);
-+ else
-+ dev_err(&msi->pdev->dev, "unexpected MSI\n");
-+ }
-+ }
-+
-+ chained_irq_exit(chip, desc);
-+}
-+
-+static struct irq_chip altera_msi_irq_chip = {
-+ .name = "Altera PCIe MSI",
-+ .irq_mask = pci_msi_mask_irq,
-+ .irq_unmask = pci_msi_unmask_irq,
-+};
-+
-+static struct msi_domain_info altera_msi_domain_info = {
-+ .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
-+ MSI_FLAG_PCI_MSIX),
-+ .chip = &altera_msi_irq_chip,
-+};
-+
-+static void altera_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
-+{
-+ struct altera_msi *msi = irq_data_get_irq_chip_data(data);
-+ phys_addr_t addr = msi->vector_phy + (data->hwirq * sizeof(u32));
-+
-+ msg->address_lo = lower_32_bits(addr);
-+ msg->address_hi = upper_32_bits(addr);
-+ msg->data = data->hwirq;
-+
-+ dev_dbg(&msi->pdev->dev, "msi#%d address_hi %#x address_lo %#x\n",
-+ (int)data->hwirq, msg->address_hi, msg->address_lo);
-+}
-+
-+static int altera_msi_set_affinity(struct irq_data *irq_data,
-+ const struct cpumask *mask, bool force)
-+{
-+ return -EINVAL;
-+}
-+
-+static struct irq_chip altera_msi_bottom_irq_chip = {
-+ .name = "Altera MSI",
-+ .irq_compose_msi_msg = altera_compose_msi_msg,
-+ .irq_set_affinity = altera_msi_set_affinity,
-+};
-+
-+static int altera_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
-+ unsigned int nr_irqs, void *args)
-+{
-+ struct altera_msi *msi = domain->host_data;
-+ unsigned long bit;
-+ u32 mask;
-+
-+ WARN_ON(nr_irqs != 1);
-+ mutex_lock(&msi->lock);
-+
-+ bit = find_first_zero_bit(msi->used, msi->num_of_vectors);
-+ if (bit >= msi->num_of_vectors) {
-+ mutex_unlock(&msi->lock);
-+ return -ENOSPC;
-+ }
-+
-+ set_bit(bit, msi->used);
-+
-+ mutex_unlock(&msi->lock);
-+
-+ irq_domain_set_info(domain, virq, bit, &altera_msi_bottom_irq_chip,
-+ domain->host_data, handle_simple_irq,
-+ NULL, NULL);
-+
-+ mask = msi_readl(msi, MSI_INTMASK);
-+ mask |= 1 << bit;
-+ msi_writel(msi, mask, MSI_INTMASK);
-+
-+ return 0;
-+}
-+
-+static void altera_irq_domain_free(struct irq_domain *domain,
-+ unsigned int virq, unsigned int nr_irqs)
-+{
-+ struct irq_data *d = irq_domain_get_irq_data(domain, virq);
-+ struct altera_msi *msi = irq_data_get_irq_chip_data(d);
-+ u32 mask;
-+
-+ mutex_lock(&msi->lock);
-+
-+ if (!test_bit(d->hwirq, msi->used)) {
-+ dev_err(&msi->pdev->dev, "trying to free unused MSI#%lu\n",
-+ d->hwirq);
-+ } else {
-+ __clear_bit(d->hwirq, msi->used);
-+ mask = msi_readl(msi, MSI_INTMASK);
-+ mask &= ~(1 << d->hwirq);
-+ msi_writel(msi, mask, MSI_INTMASK);
-+ }
-+
-+ mutex_unlock(&msi->lock);
-+}
-+
-+static const struct irq_domain_ops msi_domain_ops = {
-+ .alloc = altera_irq_domain_alloc,
-+ .free = altera_irq_domain_free,
-+};
-+
-+static int altera_allocate_domains(struct altera_msi *msi)
-+{
-+ int ret;
-+
-+ msi->inner_domain = irq_domain_add_linear(NULL, msi->num_of_vectors,
-+ &msi_domain_ops, msi);
-+ if (!msi->inner_domain) {
-+ dev_err(&msi->pdev->dev, "failed to create IRQ domain\n");
-+ return -ENOMEM;
-+ }
-+
-+ msi->mchip.domain = pci_msi_create_irq_domain(msi->pdev->dev.of_node,
-+ &altera_msi_domain_info, msi->inner_domain);
-+ if (!msi->mchip.domain) {
-+ dev_err(&msi->pdev->dev, "failed to create MSI domain\n");
-+ irq_domain_remove(msi->inner_domain);
-+ return -ENOMEM;
-+ }
-+
-+ msi->mchip.of_node = msi->pdev->dev.of_node;
-+ ret = of_pci_msi_chip_add(&msi->mchip);
-+ if (ret) {
-+ dev_err(&msi->pdev->dev, "failed to add MSI controller chip\n");
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
-+static void altera_free_domains(struct altera_msi *msi)
-+{
-+ irq_domain_remove(msi->mchip.domain);
-+ irq_domain_remove(msi->inner_domain);
-+}
-+
-+static int altera_msi_remove(struct platform_device *pdev)
-+{
-+ struct altera_msi *msi = platform_get_drvdata(pdev);
-+
-+ msi_writel(msi, 0, MSI_INTMASK);
-+ irq_set_chained_handler(msi->irq, NULL);
-+ irq_set_handler_data(msi->irq, NULL);
-+
-+ altera_free_domains(msi);
-+
-+ platform_set_drvdata(pdev, NULL);
-+ return 0;
-+}
-+
-+static int altera_msi_probe(struct platform_device *pdev)
-+{
-+ struct altera_msi *msi;
-+ struct device_node *np = pdev->dev.of_node;
-+ struct resource *res;
-+ int ret;
-+
-+ msi = devm_kzalloc(&pdev->dev, sizeof(struct altera_msi),
-+ GFP_KERNEL);
-+ if (!msi)
-+ return -ENOMEM;
-+
-+ mutex_init(&msi->lock);
-+ msi->pdev = pdev;
-+
-+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "csr");
-+ if (!res) {
-+ dev_err(&pdev->dev, "no csr memory resource defined\n");
-+ return -ENODEV;
-+ }
-+
-+ msi->csr_base = devm_ioremap_resource(&pdev->dev, res);
-+ if (IS_ERR(msi->csr_base)) {
-+ dev_err(&pdev->dev, "failed to map csr memory\n");
-+ return PTR_ERR(msi->csr_base);
-+ }
-+
-+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-+ "vector_slave");
-+ if (!res) {
-+ dev_err(&pdev->dev, "no vector_slave memory resource defined\n");
-+ return -ENODEV;
-+ }
-+
-+ msi->vector_base = devm_ioremap_resource(&pdev->dev, res);
-+ if (IS_ERR(msi->vector_base)) {
-+ dev_err(&pdev->dev, "failed to map vector_slave memory\n");
-+ return PTR_ERR(msi->vector_base);
-+ }
-+
-+ msi->vector_phy = res->start;
-+
-+ if (of_property_read_u32(np, "num-vectors", &msi->num_of_vectors)) {
-+ dev_err(&pdev->dev, "failed to parse the number of vectors\n");
-+ return -EINVAL;
-+ }
-+
-+ ret = altera_allocate_domains(msi);
-+ if (ret)
-+ return ret;
-+
-+ msi->irq = platform_get_irq(pdev, 0);
-+ if (msi->irq <= 0) {
-+ dev_err(&pdev->dev, "failed to map IRQ: %d\n", msi->irq);
-+ ret = -ENODEV;
-+ goto err;
-+ }
-+
-+ irq_set_handler_data(msi->irq, msi);
-+ irq_set_chained_handler(msi->irq, altera_msi_isr);
-+
-+ platform_set_drvdata(pdev, msi);
-+
-+ return 0;
-+
-+err:
-+ altera_msi_remove(pdev);
-+ return ret;
-+}
-+
-+static const struct of_device_id altera_msi_of_match[] = {
-+ { .compatible = "altr,msi-1.0", NULL },
-+ { },
-+};
-+
-+static struct platform_driver altera_msi_driver = {
-+ .driver = {
-+ .name = "altera-msi",
-+ .of_match_table = altera_msi_of_match,
-+ },
-+ .probe = altera_msi_probe,
-+ .remove = altera_msi_remove,
-+};
-+
-+static int __init altera_msi_init(void)
-+{
-+ return platform_driver_register(&altera_msi_driver);
-+}
-+subsys_initcall(altera_msi_init);
-+
-+MODULE_AUTHOR("Ley Foon Tan <lftan@altera.com>");
-+MODULE_DESCRIPTION("Altera PCIe MSI support");
-+MODULE_LICENSE("GPL v2");
diff --git a/patches.altera/0003-add-FPGA-manager-core.patch b/patches.altera/0003-add-FPGA-manager-core.patch
deleted file mode 100644
index bb4491d2e0764a..00000000000000
--- a/patches.altera/0003-add-FPGA-manager-core.patch
+++ /dev/null
@@ -1,608 +0,0 @@
-From e821d320b23b7fa202632ed65adc8718b01b9193 Mon Sep 17 00:00:00 2001
-From: Alan Tull <atull@opensource.altera.com>
-Date: Wed, 7 Oct 2015 16:36:28 +0100
-Subject: [PATCH 3/7] add FPGA manager core
-
-API to support programming FPGA's.
-
-The following functions are exported as GPL:
-* fpga_mgr_buf_load
- Load fpga from image in buffer
-
-* fpga_mgr_firmware_load
- Request firmware and load it to the FPGA.
-
-* fpga_mgr_register
-* fpga_mgr_unregister
- FPGA device drivers can be added by calling
- fpga_mgr_register() to register a set of
- fpga_manager_ops to do device specific stuff.
-
-* of_fpga_mgr_get
-* fpga_mgr_put
- Get/put a reference to a fpga manager.
-
-The following sysfs files are created:
-* /sys/class/fpga_manager/<fpga>/name
- Name of low level driver.
-
-* /sys/class/fpga_manager/<fpga>/state
- State of fpga manager
-
-Signed-off-by: Alan Tull <atull@opensource.altera.com>
-Acked-by: Michal Simek <michal.simek@xilinx.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit 6a8c3be7ec8eb3c1197766f9245e0d65a4e5aff8)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/Kconfig | 2
- drivers/Makefile | 1
- drivers/fpga/Kconfig | 14 +
- drivers/fpga/Makefile | 8
- drivers/fpga/fpga-mgr.c | 382 ++++++++++++++++++++++++++++++++++++++++++
- include/linux/fpga/fpga-mgr.h | 127 +++++++++++++
- 6 files changed, 534 insertions(+)
- create mode 100644 drivers/fpga/Kconfig
- create mode 100644 drivers/fpga/Makefile
- create mode 100644 drivers/fpga/fpga-mgr.c
- create mode 100644 include/linux/fpga/fpga-mgr.h
-
---- a/drivers/Kconfig
-+++ b/drivers/Kconfig
-@@ -182,4 +182,6 @@ source "drivers/thunderbolt/Kconfig"
-
- source "drivers/android/Kconfig"
-
-+source "drivers/fpga/Kconfig"
-+
- endmenu
---- a/drivers/Makefile
-+++ b/drivers/Makefile
-@@ -166,3 +166,4 @@ obj-$(CONFIG_RAS) += ras/
- obj-$(CONFIG_THUNDERBOLT) += thunderbolt/
- obj-$(CONFIG_CORESIGHT) += hwtracing/coresight/
- obj-$(CONFIG_ANDROID) += android/
-+obj-$(CONFIG_FPGA) += fpga/
---- /dev/null
-+++ b/drivers/fpga/Kconfig
-@@ -0,0 +1,14 @@
-+#
-+# FPGA framework configuration
-+#
-+
-+menu "FPGA Configuration Support"
-+
-+config FPGA
-+ tristate "FPGA Configuration Framework"
-+ help
-+ Say Y here if you want support for configuring FPGAs from the
-+ kernel. The FPGA framework adds a FPGA manager class and FPGA
-+ manager drivers.
-+
-+endmenu
---- /dev/null
-+++ b/drivers/fpga/Makefile
-@@ -0,0 +1,8 @@
-+#
-+# Makefile for the fpga framework and fpga manager drivers.
-+#
-+
-+# Core FPGA Manager Framework
-+obj-$(CONFIG_FPGA) += fpga-mgr.o
-+
-+# FPGA Manager Drivers
---- /dev/null
-+++ b/drivers/fpga/fpga-mgr.c
-@@ -0,0 +1,382 @@
-+/*
-+ * FPGA Manager Core
-+ *
-+ * Copyright (C) 2013-2015 Altera Corporation
-+ *
-+ * With code from the mailing list:
-+ * Copyright (C) 2013 Xilinx, Inc.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+#include <linux/firmware.h>
-+#include <linux/fpga/fpga-mgr.h>
-+#include <linux/idr.h>
-+#include <linux/module.h>
-+#include <linux/of.h>
-+#include <linux/mutex.h>
-+#include <linux/slab.h>
-+
-+static DEFINE_IDA(fpga_mgr_ida);
-+static struct class *fpga_mgr_class;
-+
-+/**
-+ * fpga_mgr_buf_load - load fpga from image in buffer
-+ * @mgr: fpga manager
-+ * @flags: flags setting fpga confuration modes
-+ * @buf: buffer contain fpga image
-+ * @count: byte count of buf
-+ *
-+ * Step the low level fpga manager through the device-specific steps of getting
-+ * an FPGA ready to be configured, writing the image to it, then doing whatever
-+ * post-configuration steps necessary.
-+ *
-+ * Return: 0 on success, negative error code otherwise.
-+ */
-+int fpga_mgr_buf_load(struct fpga_manager *mgr, u32 flags, const char *buf,
-+ size_t count)
-+{
-+ struct device *dev = &mgr->dev;
-+ int ret;
-+
-+ if (!mgr)
-+ return -ENODEV;
-+
-+ /*
-+ * Call the low level driver's write_init function. This will do the
-+ * device-specific things to get the FPGA into the state where it is
-+ * ready to receive an FPGA image.
-+ */
-+ mgr->state = FPGA_MGR_STATE_WRITE_INIT;
-+ ret = mgr->mops->write_init(mgr, flags, buf, count);
-+ if (ret) {
-+ dev_err(dev, "Error preparing FPGA for writing\n");
-+ mgr->state = FPGA_MGR_STATE_WRITE_INIT_ERR;
-+ return ret;
-+ }
-+
-+ /*
-+ * Write the FPGA image to the FPGA.
-+ */
-+ mgr->state = FPGA_MGR_STATE_WRITE;
-+ ret = mgr->mops->write(mgr, buf, count);
-+ if (ret) {
-+ dev_err(dev, "Error while writing image data to FPGA\n");
-+ mgr->state = FPGA_MGR_STATE_WRITE_ERR;
-+ return ret;
-+ }
-+
-+ /*
-+ * After all the FPGA image has been written, do the device specific
-+ * steps to finish and set the FPGA into operating mode.
-+ */
-+ mgr->state = FPGA_MGR_STATE_WRITE_COMPLETE;
-+ ret = mgr->mops->write_complete(mgr, flags);
-+ if (ret) {
-+ dev_err(dev, "Error after writing image data to FPGA\n");
-+ mgr->state = FPGA_MGR_STATE_WRITE_COMPLETE_ERR;
-+ return ret;
-+ }
-+ mgr->state = FPGA_MGR_STATE_OPERATING;
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(fpga_mgr_buf_load);
-+
-+/**
-+ * fpga_mgr_firmware_load - request firmware and load to fpga
-+ * @mgr: fpga manager
-+ * @flags: flags setting fpga confuration modes
-+ * @image_name: name of image file on the firmware search path
-+ *
-+ * Request an FPGA image using the firmware class, then write out to the FPGA.
-+ * Update the state before each step to provide info on what step failed if
-+ * there is a failure.
-+ *
-+ * Return: 0 on success, negative error code otherwise.
-+ */
-+int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
-+ const char *image_name)
-+{
-+ struct device *dev = &mgr->dev;
-+ const struct firmware *fw;
-+ int ret;
-+
-+ if (!mgr)
-+ return -ENODEV;
-+
-+ dev_info(dev, "writing %s to %s\n", image_name, mgr->name);
-+
-+ mgr->state = FPGA_MGR_STATE_FIRMWARE_REQ;
-+
-+ ret = request_firmware(&fw, image_name, dev);
-+ if (ret) {
-+ mgr->state = FPGA_MGR_STATE_FIRMWARE_REQ_ERR;
-+ dev_err(dev, "Error requesting firmware %s\n", image_name);
-+ return ret;
-+ }
-+
-+ ret = fpga_mgr_buf_load(mgr, flags, fw->data, fw->size);
-+ if (ret)
-+ return ret;
-+
-+ release_firmware(fw);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(fpga_mgr_firmware_load);
-+
-+static const char * const state_str[] = {
-+ [FPGA_MGR_STATE_UNKNOWN] = "unknown",
-+ [FPGA_MGR_STATE_POWER_OFF] = "power off",
-+ [FPGA_MGR_STATE_POWER_UP] = "power up",
-+ [FPGA_MGR_STATE_RESET] = "reset",
-+
-+ /* requesting FPGA image from firmware */
-+ [FPGA_MGR_STATE_FIRMWARE_REQ] = "firmware request",
-+ [FPGA_MGR_STATE_FIRMWARE_REQ_ERR] = "firmware request error",
-+
-+ /* Preparing FPGA to receive image */
-+ [FPGA_MGR_STATE_WRITE_INIT] = "write init",
-+ [FPGA_MGR_STATE_WRITE_INIT_ERR] = "write init error",
-+
-+ /* Writing image to FPGA */
-+ [FPGA_MGR_STATE_WRITE] = "write",
-+ [FPGA_MGR_STATE_WRITE_ERR] = "write error",
-+
-+ /* Finishing configuration after image has been written */
-+ [FPGA_MGR_STATE_WRITE_COMPLETE] = "write complete",
-+ [FPGA_MGR_STATE_WRITE_COMPLETE_ERR] = "write complete error",
-+
-+ /* FPGA reports to be in normal operating mode */
-+ [FPGA_MGR_STATE_OPERATING] = "operating",
-+};
-+
-+static ssize_t name_show(struct device *dev,
-+ struct device_attribute *attr, char *buf)
-+{
-+ struct fpga_manager *mgr = to_fpga_manager(dev);
-+
-+ return sprintf(buf, "%s\n", mgr->name);
-+}
-+
-+static ssize_t state_show(struct device *dev,
-+ struct device_attribute *attr, char *buf)
-+{
-+ struct fpga_manager *mgr = to_fpga_manager(dev);
-+
-+ return sprintf(buf, "%s\n", state_str[mgr->state]);
-+}
-+
-+static DEVICE_ATTR_RO(name);
-+static DEVICE_ATTR_RO(state);
-+
-+static struct attribute *fpga_mgr_attrs[] = {
-+ &dev_attr_name.attr,
-+ &dev_attr_state.attr,
-+ NULL,
-+};
-+ATTRIBUTE_GROUPS(fpga_mgr);
-+
-+static int fpga_mgr_of_node_match(struct device *dev, const void *data)
-+{
-+ return dev->of_node == data;
-+}
-+
-+/**
-+ * of_fpga_mgr_get - get an exclusive reference to a fpga mgr
-+ * @node: device node
-+ *
-+ * Given a device node, get an exclusive reference to a fpga mgr.
-+ *
-+ * Return: fpga manager struct or IS_ERR() condition containing error code.
-+ */
-+struct fpga_manager *of_fpga_mgr_get(struct device_node *node)
-+{
-+ struct fpga_manager *mgr;
-+ struct device *dev;
-+
-+ if (!node)
-+ return ERR_PTR(-EINVAL);
-+
-+ dev = class_find_device(fpga_mgr_class, NULL, node,
-+ fpga_mgr_of_node_match);
-+ if (!dev)
-+ return ERR_PTR(-ENODEV);
-+
-+ mgr = to_fpga_manager(dev);
-+ put_device(dev);
-+ if (!mgr)
-+ return ERR_PTR(-ENODEV);
-+
-+ /* Get exclusive use of fpga manager */
-+ if (!mutex_trylock(&mgr->ref_mutex))
-+ return ERR_PTR(-EBUSY);
-+
-+ if (!try_module_get(THIS_MODULE)) {
-+ mutex_unlock(&mgr->ref_mutex);
-+ return ERR_PTR(-ENODEV);
-+ }
-+
-+ return mgr;
-+}
-+EXPORT_SYMBOL_GPL(of_fpga_mgr_get);
-+
-+/**
-+ * fpga_mgr_put - release a reference to a fpga manager
-+ * @mgr: fpga manager structure
-+ */
-+void fpga_mgr_put(struct fpga_manager *mgr)
-+{
-+ if (mgr) {
-+ module_put(THIS_MODULE);
-+ mutex_unlock(&mgr->ref_mutex);
-+ }
-+}
-+EXPORT_SYMBOL_GPL(fpga_mgr_put);
-+
-+/**
-+ * fpga_mgr_register - register a low level fpga manager driver
-+ * @dev: fpga manager device from pdev
-+ * @name: fpga manager name
-+ * @mops: pointer to structure of fpga manager ops
-+ * @priv: fpga manager private data
-+ *
-+ * Return: 0 on success, negative error code otherwise.
-+ */
-+int fpga_mgr_register(struct device *dev, const char *name,
-+ const struct fpga_manager_ops *mops,
-+ void *priv)
-+{
-+ struct fpga_manager *mgr;
-+ const char *dt_label;
-+ int id, ret;
-+
-+ if (!mops || !mops->write_init || !mops->write ||
-+ !mops->write_complete || !mops->state) {
-+ dev_err(dev, "Attempt to register without fpga_manager_ops\n");
-+ return -EINVAL;
-+ }
-+
-+ if (!name || !strlen(name)) {
-+ dev_err(dev, "Attempt to register with no name!\n");
-+ return -EINVAL;
-+ }
-+
-+ mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
-+ if (!mgr)
-+ return -ENOMEM;
-+
-+ id = ida_simple_get(&fpga_mgr_ida, 0, 0, GFP_KERNEL);
-+ if (id < 0) {
-+ ret = id;
-+ goto error_kfree;
-+ }
-+
-+ mutex_init(&mgr->ref_mutex);
-+
-+ mgr->name = name;
-+ mgr->mops = mops;
-+ mgr->priv = priv;
-+
-+ /*
-+ * Initialize framework state by requesting low level driver read state
-+ * from device. FPGA may be in reset mode or may have been programmed
-+ * by bootloader or EEPROM.
-+ */
-+ mgr->state = mgr->mops->state(mgr);
-+
-+ device_initialize(&mgr->dev);
-+ mgr->dev.class = fpga_mgr_class;
-+ mgr->dev.parent = dev;
-+ mgr->dev.of_node = dev->of_node;
-+ mgr->dev.id = id;
-+ dev_set_drvdata(dev, mgr);
-+
-+ dt_label = of_get_property(mgr->dev.of_node, "label", NULL);
-+ if (dt_label)
-+ ret = dev_set_name(&mgr->dev, "%s", dt_label);
-+ else
-+ ret = dev_set_name(&mgr->dev, "fpga%d", id);
-+
-+ ret = device_add(&mgr->dev);
-+ if (ret)
-+ goto error_device;
-+
-+ dev_info(&mgr->dev, "%s registered\n", mgr->name);
-+
-+ return 0;
-+
-+error_device:
-+ ida_simple_remove(&fpga_mgr_ida, id);
-+error_kfree:
-+ kfree(mgr);
-+
-+ return ret;
-+}
-+EXPORT_SYMBOL_GPL(fpga_mgr_register);
-+
-+/**
-+ * fpga_mgr_unregister - unregister a low level fpga manager driver
-+ * @dev: fpga manager device from pdev
-+ */
-+void fpga_mgr_unregister(struct device *dev)
-+{
-+ struct fpga_manager *mgr = dev_get_drvdata(dev);
-+
-+ dev_info(&mgr->dev, "%s %s\n", __func__, mgr->name);
-+
-+ /*
-+ * If the low level driver provides a method for putting fpga into
-+ * a desired state upon unregister, do it.
-+ */
-+ if (mgr->mops->fpga_remove)
-+ mgr->mops->fpga_remove(mgr);
-+
-+ device_unregister(&mgr->dev);
-+}
-+EXPORT_SYMBOL_GPL(fpga_mgr_unregister);
-+
-+static void fpga_mgr_dev_release(struct device *dev)
-+{
-+ struct fpga_manager *mgr = to_fpga_manager(dev);
-+
-+ ida_simple_remove(&fpga_mgr_ida, mgr->dev.id);
-+ kfree(mgr);
-+}
-+
-+static int __init fpga_mgr_class_init(void)
-+{
-+ pr_info("FPGA manager framework\n");
-+
-+ fpga_mgr_class = class_create(THIS_MODULE, "fpga_manager");
-+ if (IS_ERR(fpga_mgr_class))
-+ return PTR_ERR(fpga_mgr_class);
-+
-+ fpga_mgr_class->dev_groups = fpga_mgr_groups;
-+ fpga_mgr_class->dev_release = fpga_mgr_dev_release;
-+
-+ return 0;
-+}
-+
-+static void __exit fpga_mgr_class_exit(void)
-+{
-+ class_destroy(fpga_mgr_class);
-+ ida_destroy(&fpga_mgr_ida);
-+}
-+
-+MODULE_AUTHOR("Alan Tull <atull@opensource.altera.com>");
-+MODULE_DESCRIPTION("FPGA manager framework");
-+MODULE_LICENSE("GPL v2");
-+
-+subsys_initcall(fpga_mgr_class_init);
-+module_exit(fpga_mgr_class_exit);
---- /dev/null
-+++ b/include/linux/fpga/fpga-mgr.h
-@@ -0,0 +1,127 @@
-+/*
-+ * FPGA Framework
-+ *
-+ * Copyright (C) 2013-2015 Altera Corporation
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+#include <linux/mutex.h>
-+#include <linux/platform_device.h>
-+
-+#ifndef _LINUX_FPGA_MGR_H
-+#define _LINUX_FPGA_MGR_H
-+
-+struct fpga_manager;
-+
-+/**
-+ * enum fpga_mgr_states - fpga framework states
-+ * @FPGA_MGR_STATE_UNKNOWN: can't determine state
-+ * @FPGA_MGR_STATE_POWER_OFF: FPGA power is off
-+ * @FPGA_MGR_STATE_POWER_UP: FPGA reports power is up
-+ * @FPGA_MGR_STATE_RESET: FPGA in reset state
-+ * @FPGA_MGR_STATE_FIRMWARE_REQ: firmware request in progress
-+ * @FPGA_MGR_STATE_FIRMWARE_REQ_ERR: firmware request failed
-+ * @FPGA_MGR_STATE_WRITE_INIT: preparing FPGA for programming
-+ * @FPGA_MGR_STATE_WRITE_INIT_ERR: Error during WRITE_INIT stage
-+ * @FPGA_MGR_STATE_WRITE: writing image to FPGA
-+ * @FPGA_MGR_STATE_WRITE_ERR: Error while writing FPGA
-+ * @FPGA_MGR_STATE_WRITE_COMPLETE: Doing post programming steps
-+ * @FPGA_MGR_STATE_WRITE_COMPLETE_ERR: Error during WRITE_COMPLETE
-+ * @FPGA_MGR_STATE_OPERATING: FPGA is programmed and operating
-+ */
-+enum fpga_mgr_states {
-+ /* default FPGA states */
-+ FPGA_MGR_STATE_UNKNOWN,
-+ FPGA_MGR_STATE_POWER_OFF,
-+ FPGA_MGR_STATE_POWER_UP,
-+ FPGA_MGR_STATE_RESET,
-+
-+ /* getting an image for loading */
-+ FPGA_MGR_STATE_FIRMWARE_REQ,
-+ FPGA_MGR_STATE_FIRMWARE_REQ_ERR,
-+
-+ /* write sequence: init, write, complete */
-+ FPGA_MGR_STATE_WRITE_INIT,
-+ FPGA_MGR_STATE_WRITE_INIT_ERR,
-+ FPGA_MGR_STATE_WRITE,
-+ FPGA_MGR_STATE_WRITE_ERR,
-+ FPGA_MGR_STATE_WRITE_COMPLETE,
-+ FPGA_MGR_STATE_WRITE_COMPLETE_ERR,
-+
-+ /* fpga is programmed and operating */
-+ FPGA_MGR_STATE_OPERATING,
-+};
-+
-+/*
-+ * FPGA Manager flags
-+ * FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
-+ */
-+#define FPGA_MGR_PARTIAL_RECONFIG BIT(0)
-+
-+/**
-+ * struct fpga_manager_ops - ops for low level fpga manager drivers
-+ * @state: returns an enum value of the FPGA's state
-+ * @write_init: prepare the FPGA to receive confuration data
-+ * @write: write count bytes of configuration data to the FPGA
-+ * @write_complete: set FPGA to operating state after writing is done
-+ * @fpga_remove: optional: Set FPGA into a specific state during driver remove
-+ *
-+ * fpga_manager_ops are the low level functions implemented by a specific
-+ * fpga manager driver. The optional ones are tested for NULL before being
-+ * called, so leaving them out is fine.
-+ */
-+struct fpga_manager_ops {
-+ enum fpga_mgr_states (*state)(struct fpga_manager *mgr);
-+ int (*write_init)(struct fpga_manager *mgr, u32 flags,
-+ const char *buf, size_t count);
-+ int (*write)(struct fpga_manager *mgr, const char *buf, size_t count);
-+ int (*write_complete)(struct fpga_manager *mgr, u32 flags);
-+ void (*fpga_remove)(struct fpga_manager *mgr);
-+};
-+
-+/**
-+ * struct fpga_manager - fpga manager structure
-+ * @name: name of low level fpga manager
-+ * @dev: fpga manager device
-+ * @ref_mutex: only allows one reference to fpga manager
-+ * @state: state of fpga manager
-+ * @mops: pointer to struct of fpga manager ops
-+ * @priv: low level driver private date
-+ */
-+struct fpga_manager {
-+ const char *name;
-+ struct device dev;
-+ struct mutex ref_mutex;
-+ enum fpga_mgr_states state;
-+ const struct fpga_manager_ops *mops;
-+ void *priv;
-+};
-+
-+#define to_fpga_manager(d) container_of(d, struct fpga_manager, dev)
-+
-+int fpga_mgr_buf_load(struct fpga_manager *mgr, u32 flags,
-+ const char *buf, size_t count);
-+
-+int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
-+ const char *image_name);
-+
-+struct fpga_manager *of_fpga_mgr_get(struct device_node *node);
-+
-+void fpga_mgr_put(struct fpga_manager *mgr);
-+
-+int fpga_mgr_register(struct device *dev, const char *name,
-+ const struct fpga_manager_ops *mops, void *priv);
-+
-+void fpga_mgr_unregister(struct device *dev);
-+
-+#endif /*_LINUX_FPGA_MGR_H */
diff --git a/patches.altera/0003-nios2-time-Migrate-to-new-set-state-interface.patch b/patches.altera/0003-nios2-time-Migrate-to-new-set-state-interface.patch
deleted file mode 100644
index 675af3d75546ec..00000000000000
--- a/patches.altera/0003-nios2-time-Migrate-to-new-set-state-interface.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From be2926f60f84ffc870e5b57c255e9a5d236c7cbf Mon Sep 17 00:00:00 2001
-From: Viresh Kumar <viresh.kumar@linaro.org>
-Date: Tue, 18 Aug 2015 13:59:28 +0800
-Subject: [PATCH 3/9] nios2/time: Migrate to new 'set-state' interface
-
-Migrate nios2 driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now.
-
-This also enables us to implement callbacks for new states of clockevent devices, for example: ONESHOT_STOPPED.
-
-Cc: Ley Foon Tan <lftan@altera.com>
-Cc: Tobias Klauser <tklauser@distanz.ch>
-Cc: Herbert Xu <herbert@gondor.apana.org.au>
-Cc: Dmitry Torokhov <dtor@chromium.org>
-Cc: nios2-dev@lists.rocketboards.org
-Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
-Acked-by: Ley Foon Tan <lftan@altera.com>
----
- arch/nios2/kernel/time.c | 49 ++++++++++++++++++++++++++++--------------------
- 1 file changed, 29 insertions(+), 20 deletions(-)
-
-diff --git a/arch/nios2/kernel/time.c b/arch/nios2/kernel/time.c
-index 9e3cc8a40ee9..bbc3f9157f9c 100644
---- a/arch/nios2/kernel/time.c
-+++ b/arch/nios2/kernel/time.c
-@@ -130,7 +130,7 @@ static void nios2_timer_stop(struct nios2_timer *timer)
- }
-
- static void nios2_timer_config(struct nios2_timer *timer, unsigned long period,
-- enum clock_event_mode mode)
-+ bool periodic)
- {
- u16 ctrl;
-
-@@ -148,7 +148,7 @@ static void nios2_timer_config(struct nios2_timer *timer, unsigned long period,
- timer_writew(timer, period >> 16, ALTERA_TIMER_PERIODH_REG);
-
- ctrl |= ALTERA_TIMER_CONTROL_START_MSK | ALTERA_TIMER_CONTROL_ITO_MSK;
-- if (mode == CLOCK_EVT_MODE_PERIODIC)
-+ if (periodic)
- ctrl |= ALTERA_TIMER_CONTROL_CONT_MSK;
- else
- ctrl &= ~ALTERA_TIMER_CONTROL_CONT_MSK;
-@@ -160,32 +160,38 @@ static int nios2_timer_set_next_event(unsigned long delta,
- {
- struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt);
-
-- nios2_timer_config(&nios2_ced->timer, delta, evt->mode);
-+ nios2_timer_config(&nios2_ced->timer, delta, false);
-
- return 0;
- }
-
--static void nios2_timer_set_mode(enum clock_event_mode mode,
-- struct clock_event_device *evt)
-+static int nios2_timer_shutdown(struct clock_event_device *evt)
-+{
-+ struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt);
-+ struct nios2_timer *timer = &nios2_ced->timer;
-+
-+ nios2_timer_stop(timer);
-+ return 0;
-+}
-+
-+static int nios2_timer_set_periodic(struct clock_event_device *evt)
- {
- unsigned long period;
- struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt);
- struct nios2_timer *timer = &nios2_ced->timer;
-
-- switch (mode) {
-- case CLOCK_EVT_MODE_PERIODIC:
-- period = DIV_ROUND_UP(timer->freq, HZ);
-- nios2_timer_config(timer, period, CLOCK_EVT_MODE_PERIODIC);
-- break;
-- case CLOCK_EVT_MODE_ONESHOT:
-- case CLOCK_EVT_MODE_UNUSED:
-- case CLOCK_EVT_MODE_SHUTDOWN:
-- nios2_timer_stop(timer);
-- break;
-- case CLOCK_EVT_MODE_RESUME:
-- nios2_timer_start(timer);
-- break;
-- }
-+ period = DIV_ROUND_UP(timer->freq, HZ);
-+ nios2_timer_config(timer, period, true);
-+ return 0;
-+}
-+
-+static int nios2_timer_resume(struct clock_event_device *evt)
-+{
-+ struct nios2_clockevent_dev *nios2_ced = to_nios2_clkevent(evt);
-+ struct nios2_timer *timer = &nios2_ced->timer;
-+
-+ nios2_timer_start(timer);
-+ return 0;
- }
-
- irqreturn_t timer_interrupt(int irq, void *dev_id)
-@@ -218,7 +224,10 @@ static struct nios2_clockevent_dev nios2_ce = {
- .rating = 250,
- .shift = 32,
- .set_next_event = nios2_timer_set_next_event,
-- .set_mode = nios2_timer_set_mode,
-+ .set_state_shutdown = nios2_timer_shutdown,
-+ .set_state_periodic = nios2_timer_set_periodic,
-+ .set_state_oneshot = nios2_timer_shutdown,
-+ .tick_resume = nios2_timer_resume,
- },
- };
-
---
-2.6.2
-
diff --git a/patches.altera/0004-ARM-socfpga-dts-rename-socdk-board-file-to-socdk_sdm.patch b/patches.altera/0004-ARM-socfpga-dts-rename-socdk-board-file-to-socdk_sdm.patch
deleted file mode 100644
index 1b29cfd6599883..00000000000000
--- a/patches.altera/0004-ARM-socfpga-dts-rename-socdk-board-file-to-socdk_sdm.patch
+++ /dev/null
@@ -1,167 +0,0 @@
-From 93ecd79aece107b9d152a9e344362833ed530b92 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Mon, 9 Mar 2015 22:57:04 -0500
-Subject: [PATCH 04/39] ARM: socfpga: dts: rename socdk board file to
- socdk_sdmmc
-
-Rename the socfpga_arria10_socdk board file to socfpga_arria10_socdk_sdmmc
-as Arria 10 devkit cannot support SDMMC and QSPI at the same time. Thus
-we will need to have 2 separate board files, one for SDMMC and one for
-QSPI. We also add a new base board dtsi file, socfpga_arria10_socdk.dtsi
-so that we use common peripherals for each flavor of the devkits.
-
-Add the sdmmc node to the socfpga_arria10_socdk_sdmmc.dts board file.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 88c8e4c2648c9daa18430a47e746a669254f00e5)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/Makefile | 2
- arch/arm/boot/dts/socfpga_arria10_socdk.dts | 48 ----------------------
- arch/arm/boot/dts/socfpga_arria10_socdk.dtsi | 46 +++++++++++++++++++++
- arch/arm/boot/dts/socfpga_arria10_socdk_sdmmc.dts | 26 +++++++++++
- 4 files changed, 73 insertions(+), 49 deletions(-)
- rename arch/arm/boot/dts/{socfpga_arria10_socdk.dts => socfpga_arria10_socdk.dtsi} (94%)
- mode change 100755 => 100644
- create mode 100644 arch/arm/boot/dts/socfpga_arria10_socdk_sdmmc.dts
-
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -495,7 +495,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += \
- sh73a0-kzm9g.dtb
- dtb-$(CONFIG_ARCH_SOCFPGA) += \
- socfpga_arria5_socdk.dtb \
-- socfpga_arria10_socdk.dtb \
-+ socfpga_arria10_socdk_sdmmc.dtb \
- socfpga_cyclone5_socdk.dtb \
- socfpga_cyclone5_sockit.dtb \
- socfpga_cyclone5_socrates.dtb \
---- a/arch/arm/boot/dts/socfpga_arria10_socdk.dts
-+++ /dev/null
-@@ -1,48 +0,0 @@
--/*
-- * Copyright (C) 2014 Altera Corporation <www.altera.com>
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License, or
-- * (at your option) any later version.
-- *
-- * 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.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program. If not, see <http://www.gnu.org/licenses/>.
-- */
--
--/dts-v1/;
--#include "socfpga_arria10.dtsi"
--
--/ {
-- model = "Altera SOCFPGA Arria 10";
-- compatible = "altr,socfpga-arria10", "altr,socfpga";
--
-- chosen {
-- bootargs = "console=ttyS0,115200 rootwait";
-- };
--
-- memory {
-- name = "memory";
-- device_type = "memory";
-- reg = <0x0 0x40000000>; /* 1GB */
-- };
--
-- soc {
-- clkmgr@ffd04000 {
-- clocks {
-- osc1 {
-- clock-frequency = <25000000>;
-- };
-- };
-- };
-- };
--};
--
--&uart1 {
-- status = "okay";
--};
---- /dev/null
-+++ b/arch/arm/boot/dts/socfpga_arria10_socdk.dtsi
-@@ -0,0 +1,46 @@
-+/*
-+ * Copyright (C) 2015 Altera Corporation <www.altera.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+#include "socfpga_arria10.dtsi"
-+
-+/ {
-+ model = "Altera SOCFPGA Arria 10";
-+ compatible = "altr,socfpga-arria10", "altr,socfpga";
-+
-+ chosen {
-+ bootargs = "console=ttyS0,115200 rootwait";
-+ };
-+
-+ memory {
-+ name = "memory";
-+ device_type = "memory";
-+ reg = <0x0 0x40000000>; /* 1GB */
-+ };
-+
-+ soc {
-+ clkmgr@ffd04000 {
-+ clocks {
-+ osc1 {
-+ clock-frequency = <25000000>;
-+ };
-+ };
-+ };
-+ };
-+};
-+
-+&uart1 {
-+ status = "okay";
-+};
---- /dev/null
-+++ b/arch/arm/boot/dts/socfpga_arria10_socdk_sdmmc.dts
-@@ -0,0 +1,26 @@
-+/*
-+ * Copyright (C) 2014-2015 Altera Corporation <www.altera.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * 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.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+/dts-v1/;
-+#include "socfpga_arria10_socdk.dtsi"
-+
-+&mmc {
-+ status = "okay";
-+ num-slots = <1>;
-+ broken-cd;
-+ bus-width = <4>;
-+};
diff --git a/patches.altera/0004-PCI-altera-Fix-loop-in-tlp_read_packet.patch b/patches.altera/0004-PCI-altera-Fix-loop-in-tlp_read_packet.patch
deleted file mode 100644
index 5c9de4ddf4ca0c..00000000000000
--- a/patches.altera/0004-PCI-altera-Fix-loop-in-tlp_read_packet.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 22b72b6683c75f8c7a349f3dac5f1d107e81f8ae Mon Sep 17 00:00:00 2001
-From: Dan Carpenter <dan.carpenter@oracle.com>
-Date: Wed, 9 Dec 2015 21:07:25 +0800
-Subject: [PATCH 4/7] PCI: altera: Fix loop in tlp_read_packet()
-
-TLP_LOOP is 500 and the "loop" variable was a u8 so "loop < TLP_LOOP" is
-always true. We only need this condition to work if there is a problem so
-it would have been easy to miss this in testing.
-
-Make it a normal for loop with "int i" instead of over thinking things and
-making it complicated.
-
-Fixes: 6bb4dd154ae8 ("PCI: altera: Add Altera PCIe host controller driver")
-Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-Acked-by: Ley Foon Tan <lftan@altera.com>
----
- drivers/pci/host/pcie-altera.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
-index 5d018092a484..0ff6b0053e82 100644
---- a/drivers/pci/host/pcie-altera.c
-+++ b/drivers/pci/host/pcie-altera.c
-@@ -176,7 +176,7 @@ static bool altera_pcie_valid_config(struct altera_pcie *pcie,
-
- static int tlp_read_packet(struct altera_pcie *pcie, u32 *value)
- {
-- u8 loop;
-+ int i;
- bool sop = 0;
- u32 ctrl;
- u32 reg0, reg1;
-@@ -185,7 +185,7 @@ static int tlp_read_packet(struct altera_pcie *pcie, u32 *value)
- * Minimum 2 loops to read TLP headers and 1 loop to read data
- * payload.
- */
-- for (loop = 0; loop < TLP_LOOP; loop++) {
-+ for (i = 0; i < TLP_LOOP; i++) {
- ctrl = cra_readl(pcie, RP_RXCPL_STATUS);
- if ((ctrl & RP_RXCPL_SOP) || (ctrl & RP_RXCPL_EOP) || sop) {
- reg0 = cra_readl(pcie, RP_RXCPL_REG0);
---
-2.6.3
-
diff --git a/patches.altera/0004-fpga-manager-add-driver-for-socfpga-fpga-manager.patch b/patches.altera/0004-fpga-manager-add-driver-for-socfpga-fpga-manager.patch
deleted file mode 100644
index 167c56dde4a1b1..00000000000000
--- a/patches.altera/0004-fpga-manager-add-driver-for-socfpga-fpga-manager.patch
+++ /dev/null
@@ -1,674 +0,0 @@
-From eecacbe271611256a67f37240ec8585f0ec82456 Mon Sep 17 00:00:00 2001
-From: Alan Tull <atull@opensource.altera.com>
-Date: Wed, 7 Oct 2015 16:36:29 +0100
-Subject: [PATCH 4/7] fpga manager: add driver for socfpga fpga manager
-
-Add driver to fpga manager framework to allow configuration
-of FPGA in Altera SoCFPGA parts.
-
-Signed-off-by: Alan Tull <atull@opensource.altera.com>
-Acked-by: Michal Simek <michal.simek@xilinx.com>
-Acked-by: Moritz Fischer <moritz.fischer@ettus.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit fab6266e82a8981cccec55af47589665daf69fb6)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/fpga/Kconfig | 10 +
- drivers/fpga/Makefile | 1 +
- drivers/fpga/socfpga.c | 616 +++++++++++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 627 insertions(+)
- create mode 100644 drivers/fpga/socfpga.c
-
-diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
-index f1f1f6df54d3..dfc1f1ec093b 100644
---- a/drivers/fpga/Kconfig
-+++ b/drivers/fpga/Kconfig
-@@ -11,4 +11,14 @@ config FPGA
- kernel. The FPGA framework adds a FPGA manager class and FPGA
- manager drivers.
-
-+if FPGA
-+
-+config FPGA_MGR_SOCFPGA
-+ tristate "Altera SOCFPGA FPGA Manager"
-+ depends on ARCH_SOCFPGA
-+ help
-+ FPGA manager driver support for Altera SOCFPGA.
-+
-+endif # FPGA
-+
- endmenu
-diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
-index 3313c5266795..ba6c5c597a4d 100644
---- a/drivers/fpga/Makefile
-+++ b/drivers/fpga/Makefile
-@@ -6,3 +6,4 @@
- obj-$(CONFIG_FPGA) += fpga-mgr.o
-
- # FPGA Manager Drivers
-+obj-$(CONFIG_FPGA_MGR_SOCFPGA) += socfpga.o
-diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c
-new file mode 100644
-index 000000000000..706b80d25266
---- /dev/null
-+++ b/drivers/fpga/socfpga.c
-@@ -0,0 +1,616 @@
-+/*
-+ * FPGA Manager Driver for Altera SOCFPGA
-+ *
-+ * Copyright (C) 2013-2015 Altera Corporation
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+#include <linux/completion.h>
-+#include <linux/delay.h>
-+#include <linux/fpga/fpga-mgr.h>
-+#include <linux/interrupt.h>
-+#include <linux/io.h>
-+#include <linux/module.h>
-+#include <linux/of_address.h>
-+#include <linux/of_irq.h>
-+#include <linux/pm.h>
-+
-+/* Register offsets */
-+#define SOCFPGA_FPGMGR_STAT_OFST 0x0
-+#define SOCFPGA_FPGMGR_CTL_OFST 0x4
-+#define SOCFPGA_FPGMGR_DCLKCNT_OFST 0x8
-+#define SOCFPGA_FPGMGR_DCLKSTAT_OFST 0xc
-+#define SOCFPGA_FPGMGR_GPIO_INTEN_OFST 0x830
-+#define SOCFPGA_FPGMGR_GPIO_INTMSK_OFST 0x834
-+#define SOCFPGA_FPGMGR_GPIO_INTTYPE_LEVEL_OFST 0x838
-+#define SOCFPGA_FPGMGR_GPIO_INT_POL_OFST 0x83c
-+#define SOCFPGA_FPGMGR_GPIO_INTSTAT_OFST 0x840
-+#define SOCFPGA_FPGMGR_GPIO_RAW_INTSTAT_OFST 0x844
-+#define SOCFPGA_FPGMGR_GPIO_PORTA_EOI_OFST 0x84c
-+#define SOCFPGA_FPGMGR_GPIO_EXT_PORTA_OFST 0x850
-+
-+/* Register bit defines */
-+/* SOCFPGA_FPGMGR_STAT register mode field values */
-+#define SOCFPGA_FPGMGR_STAT_POWER_UP 0x0 /*ramping*/
-+#define SOCFPGA_FPGMGR_STAT_RESET 0x1
-+#define SOCFPGA_FPGMGR_STAT_CFG 0x2
-+#define SOCFPGA_FPGMGR_STAT_INIT 0x3
-+#define SOCFPGA_FPGMGR_STAT_USER_MODE 0x4
-+#define SOCFPGA_FPGMGR_STAT_UNKNOWN 0x5
-+#define SOCFPGA_FPGMGR_STAT_STATE_MASK 0x7
-+/* This is a flag value that doesn't really happen in this register field */
-+#define SOCFPGA_FPGMGR_STAT_POWER_OFF 0x0
-+
-+#define MSEL_PP16_FAST_NOAES_NODC 0x0
-+#define MSEL_PP16_FAST_AES_NODC 0x1
-+#define MSEL_PP16_FAST_AESOPT_DC 0x2
-+#define MSEL_PP16_SLOW_NOAES_NODC 0x4
-+#define MSEL_PP16_SLOW_AES_NODC 0x5
-+#define MSEL_PP16_SLOW_AESOPT_DC 0x6
-+#define MSEL_PP32_FAST_NOAES_NODC 0x8
-+#define MSEL_PP32_FAST_AES_NODC 0x9
-+#define MSEL_PP32_FAST_AESOPT_DC 0xa
-+#define MSEL_PP32_SLOW_NOAES_NODC 0xc
-+#define MSEL_PP32_SLOW_AES_NODC 0xd
-+#define MSEL_PP32_SLOW_AESOPT_DC 0xe
-+#define SOCFPGA_FPGMGR_STAT_MSEL_MASK 0x000000f8
-+#define SOCFPGA_FPGMGR_STAT_MSEL_SHIFT 3
-+
-+/* SOCFPGA_FPGMGR_CTL register */
-+#define SOCFPGA_FPGMGR_CTL_EN 0x00000001
-+#define SOCFPGA_FPGMGR_CTL_NCE 0x00000002
-+#define SOCFPGA_FPGMGR_CTL_NCFGPULL 0x00000004
-+
-+#define CDRATIO_X1 0x00000000
-+#define CDRATIO_X2 0x00000040
-+#define CDRATIO_X4 0x00000080
-+#define CDRATIO_X8 0x000000c0
-+#define SOCFPGA_FPGMGR_CTL_CDRATIO_MASK 0x000000c0
-+
-+#define SOCFPGA_FPGMGR_CTL_AXICFGEN 0x00000100
-+
-+#define CFGWDTH_16 0x00000000
-+#define CFGWDTH_32 0x00000200
-+#define SOCFPGA_FPGMGR_CTL_CFGWDTH_MASK 0x00000200
-+
-+/* SOCFPGA_FPGMGR_DCLKSTAT register */
-+#define SOCFPGA_FPGMGR_DCLKSTAT_DCNTDONE_E_DONE 0x1
-+
-+/* SOCFPGA_FPGMGR_GPIO_* registers share the same bit positions */
-+#define SOCFPGA_FPGMGR_MON_NSTATUS 0x0001
-+#define SOCFPGA_FPGMGR_MON_CONF_DONE 0x0002
-+#define SOCFPGA_FPGMGR_MON_INIT_DONE 0x0004
-+#define SOCFPGA_FPGMGR_MON_CRC_ERROR 0x0008
-+#define SOCFPGA_FPGMGR_MON_CVP_CONF_DONE 0x0010
-+#define SOCFPGA_FPGMGR_MON_PR_READY 0x0020
-+#define SOCFPGA_FPGMGR_MON_PR_ERROR 0x0040
-+#define SOCFPGA_FPGMGR_MON_PR_DONE 0x0080
-+#define SOCFPGA_FPGMGR_MON_NCONFIG_PIN 0x0100
-+#define SOCFPGA_FPGMGR_MON_NSTATUS_PIN 0x0200
-+#define SOCFPGA_FPGMGR_MON_CONF_DONE_PIN 0x0400
-+#define SOCFPGA_FPGMGR_MON_FPGA_POWER_ON 0x0800
-+#define SOCFPGA_FPGMGR_MON_STATUS_MASK 0x0fff
-+
-+#define SOCFPGA_FPGMGR_NUM_SUPPLIES 3
-+#define SOCFPGA_RESUME_TIMEOUT 3
-+
-+/* In power-up order. Reverse for power-down. */
-+static const char *supply_names[SOCFPGA_FPGMGR_NUM_SUPPLIES] __maybe_unused = {
-+ "FPGA-1.5V",
-+ "FPGA-1.1V",
-+ "FPGA-2.5V",
-+};
-+
-+struct socfpga_fpga_priv {
-+ void __iomem *fpga_base_addr;
-+ void __iomem *fpga_data_addr;
-+ struct completion status_complete;
-+ int irq;
-+};
-+
-+struct cfgmgr_mode {
-+ /* Values to set in the CTRL register */
-+ u32 ctrl;
-+
-+ /* flag that this table entry is a valid mode */
-+ bool valid;
-+};
-+
-+/* For SOCFPGA_FPGMGR_STAT_MSEL field */
-+static struct cfgmgr_mode cfgmgr_modes[] = {
-+ [MSEL_PP16_FAST_NOAES_NODC] = { CFGWDTH_16 | CDRATIO_X1, 1 },
-+ [MSEL_PP16_FAST_AES_NODC] = { CFGWDTH_16 | CDRATIO_X2, 1 },
-+ [MSEL_PP16_FAST_AESOPT_DC] = { CFGWDTH_16 | CDRATIO_X4, 1 },
-+ [MSEL_PP16_SLOW_NOAES_NODC] = { CFGWDTH_16 | CDRATIO_X1, 1 },
-+ [MSEL_PP16_SLOW_AES_NODC] = { CFGWDTH_16 | CDRATIO_X2, 1 },
-+ [MSEL_PP16_SLOW_AESOPT_DC] = { CFGWDTH_16 | CDRATIO_X4, 1 },
-+ [MSEL_PP32_FAST_NOAES_NODC] = { CFGWDTH_32 | CDRATIO_X1, 1 },
-+ [MSEL_PP32_FAST_AES_NODC] = { CFGWDTH_32 | CDRATIO_X4, 1 },
-+ [MSEL_PP32_FAST_AESOPT_DC] = { CFGWDTH_32 | CDRATIO_X8, 1 },
-+ [MSEL_PP32_SLOW_NOAES_NODC] = { CFGWDTH_32 | CDRATIO_X1, 1 },
-+ [MSEL_PP32_SLOW_AES_NODC] = { CFGWDTH_32 | CDRATIO_X4, 1 },
-+ [MSEL_PP32_SLOW_AESOPT_DC] = { CFGWDTH_32 | CDRATIO_X8, 1 },
-+};
-+
-+static u32 socfpga_fpga_readl(struct socfpga_fpga_priv *priv, u32 reg_offset)
-+{
-+ return readl(priv->fpga_base_addr + reg_offset);
-+}
-+
-+static void socfpga_fpga_writel(struct socfpga_fpga_priv *priv, u32 reg_offset,
-+ u32 value)
-+{
-+ writel(value, priv->fpga_base_addr + reg_offset);
-+}
-+
-+static u32 socfpga_fpga_raw_readl(struct socfpga_fpga_priv *priv,
-+ u32 reg_offset)
-+{
-+ return __raw_readl(priv->fpga_base_addr + reg_offset);
-+}
-+
-+static void socfpga_fpga_raw_writel(struct socfpga_fpga_priv *priv,
-+ u32 reg_offset, u32 value)
-+{
-+ __raw_writel(value, priv->fpga_base_addr + reg_offset);
-+}
-+
-+static void socfpga_fpga_data_writel(struct socfpga_fpga_priv *priv, u32 value)
-+{
-+ writel(value, priv->fpga_data_addr);
-+}
-+
-+static inline void socfpga_fpga_set_bitsl(struct socfpga_fpga_priv *priv,
-+ u32 offset, u32 bits)
-+{
-+ u32 val;
-+
-+ val = socfpga_fpga_readl(priv, offset);
-+ val |= bits;
-+ socfpga_fpga_writel(priv, offset, val);
-+}
-+
-+static inline void socfpga_fpga_clr_bitsl(struct socfpga_fpga_priv *priv,
-+ u32 offset, u32 bits)
-+{
-+ u32 val;
-+
-+ val = socfpga_fpga_readl(priv, offset);
-+ val &= ~bits;
-+ socfpga_fpga_writel(priv, offset, val);
-+}
-+
-+static u32 socfpga_fpga_mon_status_get(struct socfpga_fpga_priv *priv)
-+{
-+ return socfpga_fpga_readl(priv, SOCFPGA_FPGMGR_GPIO_EXT_PORTA_OFST) &
-+ SOCFPGA_FPGMGR_MON_STATUS_MASK;
-+}
-+
-+static u32 socfpga_fpga_state_get(struct socfpga_fpga_priv *priv)
-+{
-+ u32 status = socfpga_fpga_mon_status_get(priv);
-+
-+ if ((status & SOCFPGA_FPGMGR_MON_FPGA_POWER_ON) == 0)
-+ return SOCFPGA_FPGMGR_STAT_POWER_OFF;
-+
-+ return socfpga_fpga_readl(priv, SOCFPGA_FPGMGR_STAT_OFST) &
-+ SOCFPGA_FPGMGR_STAT_STATE_MASK;
-+}
-+
-+static void socfpga_fpga_clear_done_status(struct socfpga_fpga_priv *priv)
-+{
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_DCLKSTAT_OFST,
-+ SOCFPGA_FPGMGR_DCLKSTAT_DCNTDONE_E_DONE);
-+}
-+
-+/*
-+ * Set the DCLKCNT, wait for DCLKSTAT to report the count completed, and clear
-+ * the complete status.
-+ */
-+static int socfpga_fpga_dclk_set_and_wait_clear(struct socfpga_fpga_priv *priv,
-+ u32 count)
-+{
-+ int timeout = 2;
-+ u32 done;
-+
-+ /* Clear any existing DONE status. */
-+ if (socfpga_fpga_readl(priv, SOCFPGA_FPGMGR_DCLKSTAT_OFST))
-+ socfpga_fpga_clear_done_status(priv);
-+
-+ /* Issue the DCLK count. */
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_DCLKCNT_OFST, count);
-+
-+ /* Poll DCLKSTAT to see if it completed in the timeout period. */
-+ do {
-+ done = socfpga_fpga_readl(priv, SOCFPGA_FPGMGR_DCLKSTAT_OFST);
-+ if (done == SOCFPGA_FPGMGR_DCLKSTAT_DCNTDONE_E_DONE) {
-+ socfpga_fpga_clear_done_status(priv);
-+ return 0;
-+ }
-+ udelay(1);
-+ } while (timeout--);
-+
-+ return -ETIMEDOUT;
-+}
-+
-+static int socfpga_fpga_wait_for_state(struct socfpga_fpga_priv *priv,
-+ u32 state)
-+{
-+ int timeout = 2;
-+
-+ /*
-+ * HW doesn't support an interrupt for changes in state, so poll to see
-+ * if it matches the requested state within the timeout period.
-+ */
-+ do {
-+ if ((socfpga_fpga_state_get(priv) & state) != 0)
-+ return 0;
-+ msleep(20);
-+ } while (timeout--);
-+
-+ return -ETIMEDOUT;
-+}
-+
-+static void socfpga_fpga_enable_irqs(struct socfpga_fpga_priv *priv, u32 irqs)
-+{
-+ /* set irqs to level sensitive */
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_GPIO_INTTYPE_LEVEL_OFST, 0);
-+
-+ /* set interrupt polarity */
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_GPIO_INT_POL_OFST, irqs);
-+
-+ /* clear irqs */
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_GPIO_PORTA_EOI_OFST, irqs);
-+
-+ /* unmask interrupts */
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_GPIO_INTMSK_OFST, 0);
-+
-+ /* enable interrupts */
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_GPIO_INTEN_OFST, irqs);
-+}
-+
-+static void socfpga_fpga_disable_irqs(struct socfpga_fpga_priv *priv)
-+{
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_GPIO_INTEN_OFST, 0);
-+}
-+
-+static irqreturn_t socfpga_fpga_isr(int irq, void *dev_id)
-+{
-+ struct socfpga_fpga_priv *priv = dev_id;
-+ u32 irqs, st;
-+ bool conf_done, nstatus;
-+
-+ /* clear irqs */
-+ irqs = socfpga_fpga_raw_readl(priv, SOCFPGA_FPGMGR_GPIO_INTSTAT_OFST);
-+
-+ socfpga_fpga_raw_writel(priv, SOCFPGA_FPGMGR_GPIO_PORTA_EOI_OFST, irqs);
-+
-+ st = socfpga_fpga_raw_readl(priv, SOCFPGA_FPGMGR_GPIO_EXT_PORTA_OFST);
-+ conf_done = (st & SOCFPGA_FPGMGR_MON_CONF_DONE) != 0;
-+ nstatus = (st & SOCFPGA_FPGMGR_MON_NSTATUS) != 0;
-+
-+ /* success */
-+ if (conf_done && nstatus) {
-+ /* disable irqs */
-+ socfpga_fpga_raw_writel(priv,
-+ SOCFPGA_FPGMGR_GPIO_INTEN_OFST, 0);
-+ complete(&priv->status_complete);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static int socfpga_fpga_wait_for_config_done(struct socfpga_fpga_priv *priv)
-+{
-+ int timeout, ret = 0;
-+
-+ socfpga_fpga_disable_irqs(priv);
-+ init_completion(&priv->status_complete);
-+ socfpga_fpga_enable_irqs(priv, SOCFPGA_FPGMGR_MON_CONF_DONE);
-+
-+ timeout = wait_for_completion_interruptible_timeout(
-+ &priv->status_complete,
-+ msecs_to_jiffies(10));
-+ if (timeout == 0)
-+ ret = -ETIMEDOUT;
-+
-+ socfpga_fpga_disable_irqs(priv);
-+ return ret;
-+}
-+
-+static int socfpga_fpga_cfg_mode_get(struct socfpga_fpga_priv *priv)
-+{
-+ u32 msel;
-+
-+ msel = socfpga_fpga_readl(priv, SOCFPGA_FPGMGR_STAT_OFST);
-+ msel &= SOCFPGA_FPGMGR_STAT_MSEL_MASK;
-+ msel >>= SOCFPGA_FPGMGR_STAT_MSEL_SHIFT;
-+
-+ /* Check that this MSEL setting is supported */
-+ if ((msel >= ARRAY_SIZE(cfgmgr_modes)) || !cfgmgr_modes[msel].valid)
-+ return -EINVAL;
-+
-+ return msel;
-+}
-+
-+static int socfpga_fpga_cfg_mode_set(struct socfpga_fpga_priv *priv)
-+{
-+ u32 ctrl_reg;
-+ int mode;
-+
-+ /* get value from MSEL pins */
-+ mode = socfpga_fpga_cfg_mode_get(priv);
-+ if (mode < 0)
-+ return mode;
-+
-+ /* Adjust CTRL for the CDRATIO */
-+ ctrl_reg = socfpga_fpga_readl(priv, SOCFPGA_FPGMGR_CTL_OFST);
-+ ctrl_reg &= ~SOCFPGA_FPGMGR_CTL_CDRATIO_MASK;
-+ ctrl_reg &= ~SOCFPGA_FPGMGR_CTL_CFGWDTH_MASK;
-+ ctrl_reg |= cfgmgr_modes[mode].ctrl;
-+
-+ /* Set NCE to 0. */
-+ ctrl_reg &= ~SOCFPGA_FPGMGR_CTL_NCE;
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_CTL_OFST, ctrl_reg);
-+
-+ return 0;
-+}
-+
-+static int socfpga_fpga_reset(struct fpga_manager *mgr)
-+{
-+ struct socfpga_fpga_priv *priv = mgr->priv;
-+ u32 ctrl_reg, status;
-+ int ret;
-+
-+ /*
-+ * Step 1:
-+ * - Set CTRL.CFGWDTH, CTRL.CDRATIO to match cfg mode
-+ * - Set CTRL.NCE to 0
-+ */
-+ ret = socfpga_fpga_cfg_mode_set(priv);
-+ if (ret)
-+ return ret;
-+
-+ /* Step 2: Set CTRL.EN to 1 */
-+ socfpga_fpga_set_bitsl(priv, SOCFPGA_FPGMGR_CTL_OFST,
-+ SOCFPGA_FPGMGR_CTL_EN);
-+
-+ /* Step 3: Set CTRL.NCONFIGPULL to 1 to put FPGA in reset */
-+ ctrl_reg = socfpga_fpga_readl(priv, SOCFPGA_FPGMGR_CTL_OFST);
-+ ctrl_reg |= SOCFPGA_FPGMGR_CTL_NCFGPULL;
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_CTL_OFST, ctrl_reg);
-+
-+ /* Step 4: Wait for STATUS.MODE to report FPGA is in reset phase */
-+ status = socfpga_fpga_wait_for_state(priv, SOCFPGA_FPGMGR_STAT_RESET);
-+
-+ /* Step 5: Set CONTROL.NCONFIGPULL to 0 to release FPGA from reset */
-+ ctrl_reg &= ~SOCFPGA_FPGMGR_CTL_NCFGPULL;
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_CTL_OFST, ctrl_reg);
-+
-+ /* Timeout waiting for reset */
-+ if (status)
-+ return -ETIMEDOUT;
-+
-+ return 0;
-+}
-+
-+/*
-+ * Prepare the FPGA to receive the configuration data.
-+ */
-+static int socfpga_fpga_ops_configure_init(struct fpga_manager *mgr, u32 flags,
-+ const char *buf, size_t count)
-+{
-+ struct socfpga_fpga_priv *priv = mgr->priv;
-+ int ret;
-+
-+ if (flags & FPGA_MGR_PARTIAL_RECONFIG) {
-+ dev_err(&mgr->dev, "Partial reconfiguration not supported.\n");
-+ return -EINVAL;
-+ }
-+ /* Steps 1 - 5: Reset the FPGA */
-+ ret = socfpga_fpga_reset(mgr);
-+ if (ret)
-+ return ret;
-+
-+ /* Step 6: Wait for FPGA to enter configuration phase */
-+ if (socfpga_fpga_wait_for_state(priv, SOCFPGA_FPGMGR_STAT_CFG))
-+ return -ETIMEDOUT;
-+
-+ /* Step 7: Clear nSTATUS interrupt */
-+ socfpga_fpga_writel(priv, SOCFPGA_FPGMGR_GPIO_PORTA_EOI_OFST,
-+ SOCFPGA_FPGMGR_MON_NSTATUS);
-+
-+ /* Step 8: Set CTRL.AXICFGEN to 1 to enable transfer of config data */
-+ socfpga_fpga_set_bitsl(priv, SOCFPGA_FPGMGR_CTL_OFST,
-+ SOCFPGA_FPGMGR_CTL_AXICFGEN);
-+
-+ return 0;
-+}
-+
-+/*
-+ * Step 9: write data to the FPGA data register
-+ */
-+static int socfpga_fpga_ops_configure_write(struct fpga_manager *mgr,
-+ const char *buf, size_t count)
-+{
-+ struct socfpga_fpga_priv *priv = mgr->priv;
-+ u32 *buffer_32 = (u32 *)buf;
-+ size_t i = 0;
-+
-+ if (count <= 0)
-+ return -EINVAL;
-+
-+ /* Write out the complete 32-bit chunks. */
-+ while (count >= sizeof(u32)) {
-+ socfpga_fpga_data_writel(priv, buffer_32[i++]);
-+ count -= sizeof(u32);
-+ }
-+
-+ /* Write out remaining non 32-bit chunks. */
-+ switch (count) {
-+ case 3:
-+ socfpga_fpga_data_writel(priv, buffer_32[i++] & 0x00ffffff);
-+ break;
-+ case 2:
-+ socfpga_fpga_data_writel(priv, buffer_32[i++] & 0x0000ffff);
-+ break;
-+ case 1:
-+ socfpga_fpga_data_writel(priv, buffer_32[i++] & 0x000000ff);
-+ break;
-+ case 0:
-+ break;
-+ default:
-+ /* This will never happen. */
-+ return -EFAULT;
-+ }
-+
-+ return 0;
-+}
-+
-+static int socfpga_fpga_ops_configure_complete(struct fpga_manager *mgr,
-+ u32 flags)
-+{
-+ struct socfpga_fpga_priv *priv = mgr->priv;
-+ u32 status;
-+
-+ /*
-+ * Step 10:
-+ * - Observe CONF_DONE and nSTATUS (active low)
-+ * - if CONF_DONE = 1 and nSTATUS = 1, configuration was successful
-+ * - if CONF_DONE = 0 and nSTATUS = 0, configuration failed
-+ */
-+ status = socfpga_fpga_wait_for_config_done(priv);
-+ if (status)
-+ return status;
-+
-+ /* Step 11: Clear CTRL.AXICFGEN to disable transfer of config data */
-+ socfpga_fpga_clr_bitsl(priv, SOCFPGA_FPGMGR_CTL_OFST,
-+ SOCFPGA_FPGMGR_CTL_AXICFGEN);
-+
-+ /*
-+ * Step 12:
-+ * - Write 4 to DCLKCNT
-+ * - Wait for STATUS.DCNTDONE = 1
-+ * - Clear W1C bit in STATUS.DCNTDONE
-+ */
-+ if (socfpga_fpga_dclk_set_and_wait_clear(priv, 4))
-+ return -ETIMEDOUT;
-+
-+ /* Step 13: Wait for STATUS.MODE to report USER MODE */
-+ if (socfpga_fpga_wait_for_state(priv, SOCFPGA_FPGMGR_STAT_USER_MODE))
-+ return -ETIMEDOUT;
-+
-+ /* Step 14: Set CTRL.EN to 0 */
-+ socfpga_fpga_clr_bitsl(priv, SOCFPGA_FPGMGR_CTL_OFST,
-+ SOCFPGA_FPGMGR_CTL_EN);
-+
-+ return 0;
-+}
-+
-+/* Translate state register values to FPGA framework state */
-+static const enum fpga_mgr_states socfpga_state_to_framework_state[] = {
-+ [SOCFPGA_FPGMGR_STAT_POWER_OFF] = FPGA_MGR_STATE_POWER_OFF,
-+ [SOCFPGA_FPGMGR_STAT_RESET] = FPGA_MGR_STATE_RESET,
-+ [SOCFPGA_FPGMGR_STAT_CFG] = FPGA_MGR_STATE_WRITE_INIT,
-+ [SOCFPGA_FPGMGR_STAT_INIT] = FPGA_MGR_STATE_WRITE_INIT,
-+ [SOCFPGA_FPGMGR_STAT_USER_MODE] = FPGA_MGR_STATE_OPERATING,
-+ [SOCFPGA_FPGMGR_STAT_UNKNOWN] = FPGA_MGR_STATE_UNKNOWN,
-+};
-+
-+static enum fpga_mgr_states socfpga_fpga_ops_state(struct fpga_manager *mgr)
-+{
-+ struct socfpga_fpga_priv *priv = mgr->priv;
-+ enum fpga_mgr_states ret;
-+ u32 state;
-+
-+ state = socfpga_fpga_state_get(priv);
-+
-+ if (state < ARRAY_SIZE(socfpga_state_to_framework_state))
-+ ret = socfpga_state_to_framework_state[state];
-+ else
-+ ret = FPGA_MGR_STATE_UNKNOWN;
-+
-+ return ret;
-+}
-+
-+static const struct fpga_manager_ops socfpga_fpga_ops = {
-+ .state = socfpga_fpga_ops_state,
-+ .write_init = socfpga_fpga_ops_configure_init,
-+ .write = socfpga_fpga_ops_configure_write,
-+ .write_complete = socfpga_fpga_ops_configure_complete,
-+};
-+
-+static int socfpga_fpga_probe(struct platform_device *pdev)
-+{
-+ struct device *dev = &pdev->dev;
-+ struct socfpga_fpga_priv *priv;
-+ struct resource *res;
-+ int ret;
-+
-+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-+ if (!priv)
-+ return -ENOMEM;
-+
-+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+ priv->fpga_base_addr = devm_ioremap_resource(dev, res);
-+ if (IS_ERR(priv->fpga_base_addr))
-+ return PTR_ERR(priv->fpga_base_addr);
-+
-+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-+ priv->fpga_data_addr = devm_ioremap_resource(dev, res);
-+ if (IS_ERR(priv->fpga_data_addr))
-+ return PTR_ERR(priv->fpga_data_addr);
-+
-+ priv->irq = platform_get_irq(pdev, 0);
-+ if (priv->irq < 0)
-+ return priv->irq;
-+
-+ ret = devm_request_irq(dev, priv->irq, socfpga_fpga_isr, 0,
-+ dev_name(dev), priv);
-+ if (IS_ERR_VALUE(ret))
-+ return ret;
-+
-+ return fpga_mgr_register(dev, "Altera SOCFPGA FPGA Manager",
-+ &socfpga_fpga_ops, priv);
-+}
-+
-+static int socfpga_fpga_remove(struct platform_device *pdev)
-+{
-+ fpga_mgr_unregister(&pdev->dev);
-+
-+ return 0;
-+}
-+
-+#ifdef CONFIG_OF
-+static const struct of_device_id socfpga_fpga_of_match[] = {
-+ { .compatible = "altr,socfpga-fpga-mgr", },
-+ {},
-+};
-+
-+MODULE_DEVICE_TABLE(of, socfpga_fpga_of_match);
-+#endif
-+
-+static struct platform_driver socfpga_fpga_driver = {
-+ .probe = socfpga_fpga_probe,
-+ .remove = socfpga_fpga_remove,
-+ .driver = {
-+ .name = "socfpga_fpga_manager",
-+ .of_match_table = of_match_ptr(socfpga_fpga_of_match),
-+ },
-+};
-+
-+module_platform_driver(socfpga_fpga_driver);
-+
-+MODULE_AUTHOR("Alan Tull <atull@opensource.altera.com>");
-+MODULE_DESCRIPTION("Altera SOCFPGA FPGA Manager");
-+MODULE_LICENSE("GPL v2");
---
-2.6.2
-
diff --git a/patches.altera/0004-nios2-fixed-variable-imm16-to-s16.patch b/patches.altera/0004-nios2-fixed-variable-imm16-to-s16.patch
deleted file mode 100644
index baa96df37877dc..00000000000000
--- a/patches.altera/0004-nios2-fixed-variable-imm16-to-s16.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 503c5aa3817e2c566ecc6fd6dae4e20d7d4da259 Mon Sep 17 00:00:00 2001
-From: Bernd Weiberg <bernd.weiberg@siemens.com>
-Date: Fri, 4 Sep 2015 17:03:03 +0800
-Subject: [PATCH 4/9] nios2: fixed variable imm16 to s16
-
-Fxid variable imm16 to s16 instead of u16, offset might be negative.
-
-Signed-off-by: Bernd Weiberg <bernd.weiberg@siemens.com>
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
----
- arch/nios2/kernel/misaligned.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/nios2/kernel/misaligned.c b/arch/nios2/kernel/misaligned.c
-index 4e5907a0cabe..89fe0b6ee339 100644
---- a/arch/nios2/kernel/misaligned.c
-+++ b/arch/nios2/kernel/misaligned.c
-@@ -71,7 +71,7 @@ asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
- u32 isn, addr, val;
- int in_kernel;
- u8 a, b, d0, d1, d2, d3;
-- u16 imm16;
-+ s16 imm16;
- unsigned int fault;
-
- /* back up one instruction */
---
-2.6.2
-
diff --git a/patches.altera/0005-ARM-socfpga-dts-Add-a-clock-node-for-sdmmc-CIU.patch b/patches.altera/0005-ARM-socfpga-dts-Add-a-clock-node-for-sdmmc-CIU.patch
deleted file mode 100644
index da9d097b616a2b..00000000000000
--- a/patches.altera/0005-ARM-socfpga-dts-Add-a-clock-node-for-sdmmc-CIU.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From c7a3d89527c63e5432f5597579849372cb891ad7 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 10 Apr 2015 15:40:42 -0500
-Subject: [PATCH 05/39] ARM: socfpga: dts: Add a clock node for sdmmc CIU
-
-The CIU(Card Interface Unit) get its clock from the sdmmc_clk_divided clock
-which is used to clock the card. The sdmmc_clk_divided clock is the sdmmc_clk
-passed through a fixed divider of 4. This patch adds the sdmmc_clk_divided
-node and makes the sdmmc_clk it's parent.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 5459f9abe24c810e09d012519788747e97b3cdd7)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga.dtsi | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
-index d9176e606173..be4beda11d3d 100644
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -451,6 +451,14 @@
- clk-phase = <0 135>;
- };
-
-+ sdmmc_clk_divided: sdmmc_clk_divided {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-gate-clk";
-+ clocks = <&sdmmc_clk>;
-+ clk-gate = <0xa0 8>;
-+ fixed-divider = <4>;
-+ };
-+
- nand_x_clk: nand_x_clk {
- #clock-cells = <0>;
- compatible = "altr,socfpga-gate-clk";
-@@ -635,7 +643,7 @@
- fifo-depth = <0x400>;
- #address-cells = <1>;
- #size-cells = <0>;
-- clocks = <&l4_mp_clk>, <&sdmmc_clk>;
-+ clocks = <&l4_mp_clk>, <&sdmmc_clk_divided>;
- clock-names = "biu", "ciu";
- };
-
---
-2.6.2
-
diff --git a/patches.altera/0005-MAINTAINERS-add-fpga-manager-framework.patch b/patches.altera/0005-MAINTAINERS-add-fpga-manager-framework.patch
deleted file mode 100644
index 67dd39e2399d1a..00000000000000
--- a/patches.altera/0005-MAINTAINERS-add-fpga-manager-framework.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From da7344379a9be3e4bd910bc210f5e93051206a0a Mon Sep 17 00:00:00 2001
-From: Alan Tull <atull@opensource.altera.com>
-Date: Wed, 7 Oct 2015 20:49:23 +0100
-Subject: [PATCH 5/7] MAINTAINERS: add fpga manager framework
-
-Add fpga manager framework to MAINTAINERS and add myself as
-maintainer.
-
-Signed-off-by: Alan Tull <atull@opensource.altera.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit 3c0ed7d56d77b61f2177e8b72855ea32073c2091)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- MAINTAINERS | 7 +++++++
- 1 file changed, 7 insertions(+)
-
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -4099,6 +4099,13 @@ F: include/linux/fmc*.h
- F: include/linux/ipmi-fru.h
- K: fmc_d.*register
-
-+FPGA MANAGER FRAMEWORK
-+M: Alan Tull <atull@opensource.altera.com>
-+S: Maintained
-+F: drivers/fpga/
-+F: include/linux/fpga/fpga-mgr.h
-+W: http://www.rocketboards.org
-+
- FPU EMULATOR
- M: Bill Metzenthen <billm@melbpc.org.au>
- W: http://floatingpoint.sourceforge.net/emulator/index.html
diff --git a/patches.altera/0005-PCI-altera-Fix-Requester-ID-for-config-accesses.patch b/patches.altera/0005-PCI-altera-Fix-Requester-ID-for-config-accesses.patch
deleted file mode 100644
index eb5b73aec62f92..00000000000000
--- a/patches.altera/0005-PCI-altera-Fix-Requester-ID-for-config-accesses.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 3b8086077159a6c7f0cd9a5680f64e46db30e721 Mon Sep 17 00:00:00 2001
-From: Ley Foon Tan <lftan@altera.com>
-Date: Wed, 9 Dec 2015 21:07:26 +0800
-Subject: [PATCH 5/7] PCI: altera: Fix Requester ID for config accesses
-
-The Requester ID should use the Root Port devfn and it should be always 0.
-Previously we constructed the Requester ID using the *Completer* devfn,
-i.e., the devfn of the Function we expect to respond to the config access.
-This causes issues when accessing configuration space for devices other
-than the Root Port.
-
-Build the Requester ID using the Root Port devfn.
-
-Tested on Ethernet adapter card with multi-functions.
-
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
----
- drivers/pci/host/pcie-altera.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
-index 0ff6b0053e82..f23d3d1846ba 100644
---- a/drivers/pci/host/pcie-altera.c
-+++ b/drivers/pci/host/pcie-altera.c
-@@ -57,6 +57,7 @@
- #define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn))
- #define TLP_HDR_SIZE 3
- #define TLP_LOOP 500
-+#define RP_DEVFN 0
-
- #define INTX_NUM 4
-
-@@ -243,7 +244,7 @@ static int tlp_cfg_dword_read(struct altera_pcie *pcie, u8 bus, u32 devfn,
- else
- headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD1);
-
-- headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn),
-+ headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, RP_DEVFN),
- TLP_READ_TAG, byte_en);
- headers[2] = TLP_CFG_DW2(bus, devfn, where);
-
-@@ -263,7 +264,7 @@ static int tlp_cfg_dword_write(struct altera_pcie *pcie, u8 bus, u32 devfn,
- else
- headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGWR1);
-
-- headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn),
-+ headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, RP_DEVFN),
- TLP_WRITE_TAG, byte_en);
- headers[2] = TLP_CFG_DW2(bus, devfn, where);
-
---
-2.6.3
-
diff --git a/patches.altera/0005-nios2-remove-unused-statistic-counters.patch b/patches.altera/0005-nios2-remove-unused-statistic-counters.patch
deleted file mode 100644
index 6a957025026107..00000000000000
--- a/patches.altera/0005-nios2-remove-unused-statistic-counters.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-From 4fda2c0976d428ba8b33c733e8439c3846161dd6 Mon Sep 17 00:00:00 2001
-From: Bernd Weiberg <bernd.weiberg@siemens.com>
-Date: Fri, 4 Sep 2015 16:59:45 +0800
-Subject: [PATCH 5/9] nios2: remove unused statistic counters
-
-Removed some statistic counters to improve the performance of the handler.
-
-Signed-off-by: Bernd Weiberg <bernd.weiberg@siemens.com>
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
----
- arch/nios2/kernel/misaligned.c | 18 ------------------
- 1 file changed, 18 deletions(-)
-
-diff --git a/arch/nios2/kernel/misaligned.c b/arch/nios2/kernel/misaligned.c
-index 89fe0b6ee339..23e0544e117c 100644
---- a/arch/nios2/kernel/misaligned.c
-+++ b/arch/nios2/kernel/misaligned.c
-@@ -32,8 +32,6 @@
- #define INST_STW 0x15
- #define INST_LDW 0x17
-
--static unsigned long ma_user, ma_kern, ma_skipped, ma_half, ma_word;
--
- static unsigned int ma_usermode;
- #define UM_WARN 0x01
- #define UM_FIXUP 0x02
-@@ -53,7 +51,6 @@ static int reg_offsets[32];
- static inline u32 get_reg_val(struct pt_regs *fp, int reg)
- {
- u8 *p = ((u8 *)fp) + reg_offsets[reg];
--
- return *(u32 *)p;
- }
-
-@@ -78,7 +75,6 @@ asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
- fp->ea -= 4;
-
- if (fixup_exception(fp)) {
-- ma_skipped++;
- return;
- }
-
-@@ -103,18 +99,11 @@ asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
- fault |= __get_user(d1, (u8 *)(addr+1));
- val = (d1 << 8) | d0;
- put_reg_val(fp, b, val);
-- ma_half++;
- break;
- case INST_STH:
- val = get_reg_val(fp, b);
- d1 = val >> 8;
- d0 = val >> 0;
--
-- pr_debug("sth: ra=%d (%08x) rb=%d (%08x), imm16 %04x addr %08x val %08x\n",
-- a, get_reg_val(fp, a),
-- b, get_reg_val(fp, b),
-- imm16, addr, val);
--
- if (in_kernel) {
- *(u8 *)(addr+0) = d0;
- *(u8 *)(addr+1) = d1;
-@@ -122,14 +111,12 @@ asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
- fault |= __put_user(d0, (u8 *)(addr+0));
- fault |= __put_user(d1, (u8 *)(addr+1));
- }
-- ma_half++;
- break;
- case INST_LDH:
- fault |= __get_user(d0, (u8 *)(addr+0));
- fault |= __get_user(d1, (u8 *)(addr+1));
- val = (short)((d1 << 8) | d0);
- put_reg_val(fp, b, val);
-- ma_half++;
- break;
- case INST_STW:
- val = get_reg_val(fp, b);
-@@ -148,7 +135,6 @@ asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
- fault |= __put_user(d2, (u8 *)(addr+2));
- fault |= __put_user(d3, (u8 *)(addr+3));
- }
-- ma_word++;
- break;
- case INST_LDW:
- fault |= __get_user(d0, (u8 *)(addr+0));
-@@ -157,7 +143,6 @@ asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
- fault |= __get_user(d3, (u8 *)(addr+3));
- val = (d3 << 24) | (d2 << 16) | (d1 << 8) | d0;
- put_reg_val(fp, b, val);
-- ma_word++;
- break;
- }
- }
-@@ -186,7 +171,6 @@ asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
- * note exception and skip bad instruction (return)
- */
- if (in_kernel) {
-- ma_kern++;
- fp->ea += 4;
-
- if (ma_usermode & KM_WARN) {
-@@ -200,8 +184,6 @@ asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause)
- return;
- }
-
-- ma_user++;
--
- /*
- * user mode -
- * possibly warn,
---
-2.6.2
-
diff --git a/patches.altera/0006-ARM-socfpga-dts-Add-multicast-bins-and-unicast-filte.patch b/patches.altera/0006-ARM-socfpga-dts-Add-multicast-bins-and-unicast-filte.patch
deleted file mode 100644
index bb8464af9922f3..00000000000000
--- a/patches.altera/0006-ARM-socfpga-dts-Add-multicast-bins-and-unicast-filte.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From deed2b628a9784142de80611c0bd8bbee09eb845 Mon Sep 17 00:00:00 2001
-From: Vince Bridgers <vbridger@opensource.altera.com>
-Date: Tue, 21 Apr 2015 14:15:40 -0500
-Subject: [PATCH 06/39] ARM: socfpga: dts: Add multicast bins and unicast
- filter entries
-
-Add multicast-filter-bins and perfect-filter-entries configuration properties
-to the socfpga devicetree for the Arria 10 socfpga.
-
-Signed-off-by: Vince Bridgers <vbridger@opensource.altera.com>
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit be9863cac24b53e826ded959ae4747a6f388885f)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga_arria10.dtsi | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index 6c3ad9220845..38c643d620c4 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -116,6 +116,8 @@
- interrupt-names = "macirq";
- /* Filled in by bootloader */
- mac-address = [00 00 00 00 00 00];
-+ snps,multicast-filter-bins = <256>;
-+ snps,perfect-filter-entries = <128>;
- status = "disabled";
- };
-
-@@ -126,6 +128,8 @@
- interrupt-names = "macirq";
- /* Filled in by bootloader */
- mac-address = [00 00 00 00 00 00];
-+ snps,multicast-filter-bins = <256>;
-+ snps,perfect-filter-entries = <128>;
- status = "disabled";
- };
-
-@@ -136,6 +140,8 @@
- interrupt-names = "macirq";
- /* Filled in by bootloader */
- mac-address = [00 00 00 00 00 00];
-+ snps,multicast-filter-bins = <256>;
-+ snps,perfect-filter-entries = <128>;
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.altera/0006-ARM-socfpga_defconfig-enable-fpga-manager.patch b/patches.altera/0006-ARM-socfpga_defconfig-enable-fpga-manager.patch
deleted file mode 100644
index 088df8c3ed3aa4..00000000000000
--- a/patches.altera/0006-ARM-socfpga_defconfig-enable-fpga-manager.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From d221d48b7a18798ea489ece65eb1cbad2980e6c7 Mon Sep 17 00:00:00 2001
-From: Alan Tull <atull@opensource.altera.com>
-Date: Tue, 13 Oct 2015 18:30:02 +0000
-Subject: [PATCH 6/7] ARM: socfpga_defconfig: enable fpga manager
-
-Enable fpga manager framework and low level driver for
-socfpga in socfpga_defconfig
-
-Signed-off-by: Alan Tull <atull@opensource.altera.com>
-Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit b97cecc7a61df121f2c1e350e09fc784a1706ef0)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/configs/socfpga_defconfig | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig
-index a2956c3112f1..8128b93ed72c 100644
---- a/arch/arm/configs/socfpga_defconfig
-+++ b/arch/arm/configs/socfpga_defconfig
-@@ -86,6 +86,8 @@ CONFIG_USB_DWC2=y
- CONFIG_USB_DWC2_HOST=y
- CONFIG_MMC=y
- CONFIG_MMC_DW=y
-+CONFIG_FPGA=y
-+CONFIG_FPGA_MGR_SOCFPGA=y
- CONFIG_EXT2_FS=y
- CONFIG_EXT2_FS_XATTR=y
- CONFIG_EXT2_FS_POSIX_ACL=y
---
-2.6.2
-
diff --git a/patches.altera/0006-PCI-altera-Check-TLP-completion-status.patch b/patches.altera/0006-PCI-altera-Check-TLP-completion-status.patch
deleted file mode 100644
index 1aa865af88d28c..00000000000000
--- a/patches.altera/0006-PCI-altera-Check-TLP-completion-status.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From e36f748db5b84273db9aaa6b8d366a7db1711e3b Mon Sep 17 00:00:00 2001
-From: Ley Foon Tan <lftan@altera.com>
-Date: Wed, 9 Dec 2015 21:07:27 +0800
-Subject: [PATCH 6/7] PCI: altera: Check TLP completion status
-
-Check TLP packet successful completion status. This fix the issue when
-accessing multi-function devices in enumeration process, TLP will return
-error when accessing non-exist function number. Returns PCI error code
-instead of generic errno.
-
-Tested on Ethernet adapter card with multi-functions.
-
-[bhelgaas: simplify completion status checking code]
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
----
- drivers/pci/host/pcie-altera.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
-index f23d3d1846ba..929a80878bb7 100644
---- a/drivers/pci/host/pcie-altera.c
-+++ b/drivers/pci/host/pcie-altera.c
-@@ -55,6 +55,7 @@
- #define TLP_CFG_DW2(bus, devfn, offset) \
- (((bus) << 24) | ((devfn) << 16) | (offset))
- #define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn))
-+#define TLP_COMP_STATUS(s) (((s) >> 12) & 7)
- #define TLP_HDR_SIZE 3
- #define TLP_LOOP 500
- #define RP_DEVFN 0
-@@ -181,6 +182,7 @@ static int tlp_read_packet(struct altera_pcie *pcie, u32 *value)
- bool sop = 0;
- u32 ctrl;
- u32 reg0, reg1;
-+ u32 comp_status = 1;
-
- /*
- * Minimum 2 loops to read TLP headers and 1 loop to read data
-@@ -192,19 +194,25 @@ static int tlp_read_packet(struct altera_pcie *pcie, u32 *value)
- reg0 = cra_readl(pcie, RP_RXCPL_REG0);
- reg1 = cra_readl(pcie, RP_RXCPL_REG1);
-
-- if (ctrl & RP_RXCPL_SOP)
-+ if (ctrl & RP_RXCPL_SOP) {
- sop = true;
-+ comp_status = TLP_COMP_STATUS(reg1);
-+ }
-
- if (ctrl & RP_RXCPL_EOP) {
-+ if (comp_status)
-+ return PCIBIOS_DEVICE_NOT_FOUND;
-+
- if (value)
- *value = reg0;
-+
- return PCIBIOS_SUCCESSFUL;
- }
- }
- udelay(5);
- }
-
-- return -ENOENT;
-+ return PCIBIOS_DEVICE_NOT_FOUND;
- }
-
- static void tlp_write_packet(struct altera_pcie *pcie, u32 *headers,
---
-2.6.3
-
diff --git a/patches.altera/0006-nios2-Add-Max10-device-tree.patch b/patches.altera/0006-nios2-Add-Max10-device-tree.patch
deleted file mode 100644
index 358f2d78856dbb..00000000000000
--- a/patches.altera/0006-nios2-Add-Max10-device-tree.patch
+++ /dev/null
@@ -1,272 +0,0 @@
-From 1ed6d08bf81a5feef41266d49ca6ee93bfd85f86 Mon Sep 17 00:00:00 2001
-From: Chee Nouk Phoon <cnphoon@altera.com>
-Date: Tue, 8 Sep 2015 18:07:44 +0800
-Subject: [PATCH 6/9] nios2: Add Max10 device tree
-
-Max10 is a FPGA device. This patch adds Nios2 support for Max10.
-This device tree is based on Max10 hardware reference design.
-
-Signed-off-by: Chee Nouk Phoon <cnphoon@altera.com>
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
----
- arch/nios2/boot/dts/10m50_devboard.dts | 248 +++++++++++++++++++++++++++++++++
- 1 file changed, 248 insertions(+)
- create mode 100755 arch/nios2/boot/dts/10m50_devboard.dts
-
-diff --git a/arch/nios2/boot/dts/10m50_devboard.dts b/arch/nios2/boot/dts/10m50_devboard.dts
-new file mode 100755
-index 000000000000..3e411c644824
---- /dev/null
-+++ b/arch/nios2/boot/dts/10m50_devboard.dts
-@@ -0,0 +1,248 @@
-+/*
-+ * Copyright (C) 2015 Altera Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+/dts-v1/;
-+
-+/ {
-+ model = "Altera NiosII Max10";
-+ compatible = "altr,niosii-max10";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+
-+ cpus {
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+
-+ cpu: cpu@0 {
-+ device_type = "cpu";
-+ compatible = "altr,nios2-1.1";
-+ reg = <0x00000000>;
-+ interrupt-controller;
-+ #interrupt-cells = <1>;
-+ altr,exception-addr = <0xc8000120>;
-+ altr,fast-tlb-miss-addr = <0xc0000100>;
-+ altr,has-div = <1>;
-+ altr,has-initda = <1>;
-+ altr,has-mmu = <1>;
-+ altr,has-mul = <1>;
-+ altr,implementation = "fast";
-+ altr,pid-num-bits = <8>;
-+ altr,reset-addr = <0xd4000000>;
-+ altr,tlb-num-entries = <256>;
-+ altr,tlb-num-ways = <16>;
-+ altr,tlb-ptr-sz = <8>;
-+ clock-frequency = <75000000>;
-+ dcache-line-size = <32>;
-+ dcache-size = <32768>;
-+ icache-line-size = <32>;
-+ icache-size = <32768>;
-+ };
-+ };
-+
-+ memory {
-+ device_type = "memory";
-+ reg = <0x08000000 0x08000000>,
-+ <0x00000000 0x00000400>;
-+ };
-+
-+ sopc0: sopc@0 {
-+ device_type = "soc";
-+ ranges;
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ compatible = "altr,avalon", "simple-bus";
-+ bus-frequency = <75000000>;
-+
-+ jtag_uart: serial@18001530 {
-+ compatible = "altr,juart-1.0";
-+ reg = <0x18001530 0x00000008>;
-+ interrupt-parent = <&cpu>;
-+ interrupts = <7>;
-+ };
-+
-+ a_16550_uart_0: serial@18001600 {
-+ compatible = "altr,16550-FIFO32", "ns16550a";
-+ reg = <0x18001600 0x00000200>;
-+ interrupt-parent = <&cpu>;
-+ interrupts = <1>;
-+ auto-flow-control = <1>;
-+ clock-frequency = <50000000>;
-+ fifo-size = <32>;
-+ reg-io-width = <4>;
-+ reg-shift = <2>;
-+ };
-+
-+ sysid: sysid@18001528 {
-+ compatible = "altr,sysid-1.0";
-+ reg = <0x18001528 0x00000008>;
-+ id = <4207856382>;
-+ timestamp = <1431309290>;
-+ };
-+
-+ rgmii_0_eth_tse_0: ethernet@400 {
-+ compatible = "altr,tse-msgdma-1.0", "altr,tse-1.0";
-+ reg = <0x00000400 0x00000400>,
-+ <0x00000820 0x00000020>,
-+ <0x00000800 0x00000020>,
-+ <0x000008c0 0x00000008>,
-+ <0x00000840 0x00000020>,
-+ <0x00000860 0x00000020>;
-+ reg-names = "control_port", "rx_csr", "rx_desc", "rx_resp", "tx_csr", "tx_desc";
-+ interrupt-parent = <&cpu>;
-+ interrupts = <2 3>;
-+ interrupt-names = "rx_irq", "tx_irq";
-+ rx-fifo-depth = <8192>;
-+ tx-fifo-depth = <8192>;
-+ address-bits = <48>;
-+ max-frame-size = <1518>;
-+ local-mac-address = [00 00 00 00 00 00];
-+ altr,has-supplementary-unicast;
-+ altr,enable-sup-addr = <1>;
-+ altr,has-hash-multicast-filter;
-+ altr,enable-hash = <1>;
-+ phy-mode = "rgmii-id";
-+ phy-handle = <&phy0>;
-+ rgmii_0_eth_tse_0_mdio: mdio {
-+ compatible = "altr,tse-mdio";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ phy0: ethernet-phy@0 {
-+ reg = <0>;
-+ device_type = "ethernet-phy";
-+ };
-+ };
-+ };
-+
-+ enet_pll: clock@0 {
-+ compatible = "altr,pll-1.0";
-+ #clock-cells = <1>;
-+
-+ enet_pll_c0: enet_pll_c0 {
-+ compatible = "fixed-clock";
-+ #clock-cells = <0>;
-+ clock-frequency = <125000000>;
-+ clock-output-names = "enet_pll-c0";
-+ };
-+
-+ enet_pll_c1: enet_pll_c1 {
-+ compatible = "fixed-clock";
-+ #clock-cells = <0>;
-+ clock-frequency = <25000000>;
-+ clock-output-names = "enet_pll-c1";
-+ };
-+
-+ enet_pll_c2: enet_pll_c2 {
-+ compatible = "fixed-clock";
-+ #clock-cells = <0>;
-+ clock-frequency = <2500000>;
-+ clock-output-names = "enet_pll-c2";
-+ };
-+ };
-+
-+ sys_pll: clock@1 {
-+ compatible = "altr,pll-1.0";
-+ #clock-cells = <1>;
-+
-+ sys_pll_c0: sys_pll_c0 {
-+ compatible = "fixed-clock";
-+ #clock-cells = <0>;
-+ clock-frequency = <100000000>;
-+ clock-output-names = "sys_pll-c0";
-+ };
-+
-+ sys_pll_c1: sys_pll_c1 {
-+ compatible = "fixed-clock";
-+ #clock-cells = <0>;
-+ clock-frequency = <50000000>;
-+ clock-output-names = "sys_pll-c1";
-+ };
-+
-+ sys_pll_c2: sys_pll_c2 {
-+ compatible = "fixed-clock";
-+ #clock-cells = <0>;
-+ clock-frequency = <75000000>;
-+ clock-output-names = "sys_pll-c2";
-+ };
-+ };
-+
-+ sys_clk_timer: timer@18001440 {
-+ compatible = "altr,timer-1.0";
-+ reg = <0x18001440 0x00000020>;
-+ interrupt-parent = <&cpu>;
-+ interrupts = <0>;
-+ clock-frequency = <75000000>;
-+ };
-+
-+ led_pio: gpio@180014d0 {
-+ compatible = "altr,pio-1.0";
-+ reg = <0x180014d0 0x00000010>;
-+ altr,gpio-bank-width = <4>;
-+ resetvalue = <15>;
-+ #gpio-cells = <2>;
-+ gpio-controller;
-+ };
-+
-+ button_pio: gpio@180014c0 {
-+ compatible = "altr,pio-1.0";
-+ reg = <0x180014c0 0x00000010>;
-+ interrupt-parent = <&cpu>;
-+ interrupts = <6>;
-+ altr,gpio-bank-width = <3>;
-+ altr,interrupt-type = <2>;
-+ edge_type = <1>;
-+ level_trigger = <0>;
-+ resetvalue = <0>;
-+ #gpio-cells = <2>;
-+ gpio-controller;
-+ };
-+
-+ sys_clk_timer_1: timer@880 {
-+ compatible = "altr,timer-1.0";
-+ reg = <0x00000880 0x00000020>;
-+ interrupt-parent = <&cpu>;
-+ interrupts = <5>;
-+ clock-frequency = <75000000>;
-+ };
-+
-+ fpga_leds: leds {
-+ compatible = "gpio-leds";
-+
-+ led_fpga0: fpga0 {
-+ label = "fpga_led0";
-+ gpios = <&led_pio 0 1>;
-+ };
-+
-+ led_fpga1: fpga1 {
-+ label = "fpga_led1";
-+ gpios = <&led_pio 1 1>;
-+ };
-+
-+ led_fpga2: fpga2 {
-+ label = "fpga_led2";
-+ gpios = <&led_pio 2 1>;
-+ };
-+
-+ led_fpga3: fpga3 {
-+ label = "fpga_led3";
-+ gpios = <&led_pio 3 1>;
-+ };
-+ };
-+ };
-+
-+ chosen {
-+ bootargs = "debug console=ttyS0,115200";
-+ };
-+};
---
-2.6.2
-
diff --git a/patches.altera/0007-ARM-socfpga-dts-Add-tx-fifo-depth-and-rx-fifo-depth-.patch b/patches.altera/0007-ARM-socfpga-dts-Add-tx-fifo-depth-and-rx-fifo-depth-.patch
deleted file mode 100644
index 7c47e45d3ba274..00000000000000
--- a/patches.altera/0007-ARM-socfpga-dts-Add-tx-fifo-depth-and-rx-fifo-depth-.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 0e850b693fdfd03b4dde6dcc229ca4fb42abd402 Mon Sep 17 00:00:00 2001
-From: Vince Bridgers <vbridger@opensource.altera.com>
-Date: Tue, 21 Apr 2015 14:19:24 -0500
-Subject: [PATCH 07/39] ARM: socfpga: dts: Add tx-fifo-depth and rx-fifo-depth
- properties
-
-Add tx-fifo-depth and rx-fifo-depth devicetree properties for socfpga
-stmmac. These devicetree properties will be used to configure certain
-features of the stmmac on the socfpga.
-
-Signed-off-by: Vince Bridgers <vbridger@opensource.altera.com>
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit c01e8cdb7bf52681530d1a6ac3474c070468983b)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga.dtsi | 4 ++++
- arch/arm/boot/dts/socfpga_arria10.dtsi | 4 ++++
- 2 files changed, 8 insertions(+)
-
-diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
-index be4beda11d3d..2e9ed36df12e 100644
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -496,6 +496,8 @@
- reset-names = "stmmaceth";
- snps,multicast-filter-bins = <256>;
- snps,perfect-filter-entries = <128>;
-+ tx-fifo-depth = <4096>;
-+ rx-fifo-depth = <4096>;
- status = "disabled";
- };
-
-@@ -512,6 +514,8 @@
- reset-names = "stmmaceth";
- snps,multicast-filter-bins = <256>;
- snps,perfect-filter-entries = <128>;
-+ tx-fifo-depth = <4096>;
-+ rx-fifo-depth = <4096>;
- status = "disabled";
- };
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index 38c643d620c4..ab0af2afdcf7 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -130,6 +130,8 @@
- mac-address = [00 00 00 00 00 00];
- snps,multicast-filter-bins = <256>;
- snps,perfect-filter-entries = <128>;
-+ tx-fifo-depth = <4096>;
-+ rx-fifo-depth = <16384>;
- status = "disabled";
- };
-
-@@ -142,6 +144,8 @@
- mac-address = [00 00 00 00 00 00];
- snps,multicast-filter-bins = <256>;
- snps,perfect-filter-entries = <128>;
-+ tx-fifo-depth = <4096>;
-+ rx-fifo-depth = <16384>;
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.altera/0007-ARM-socfpga-dts-add-fpga-manager.patch b/patches.altera/0007-ARM-socfpga-dts-add-fpga-manager.patch
deleted file mode 100644
index 9cdde6b26b4005..00000000000000
--- a/patches.altera/0007-ARM-socfpga-dts-add-fpga-manager.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 12269e99151ad7a9157ac8defd76444b01e7d634 Mon Sep 17 00:00:00 2001
-From: Alan Tull <atull@opensource.altera.com>
-Date: Tue, 13 Oct 2015 19:38:59 +0000
-Subject: [PATCH 7/7] ARM: socfpga: dts: add fpga manager
-
-Add FPGA manager to device tree for SoCFPGA.
-
-Signed-off-by: Alan Tull <atull@opensource.altera.com>
-Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit ebb251030bf25b27b05f0e4204e27b85c5664364)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga.dtsi | 7 +++++++
- 1 file changed, 7 insertions(+)
-
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -484,6 +484,13 @@
- };
- };
-
-+ fpgamgr0: fpgamgr@ff706000 {
-+ compatible = "altr,socfpga-fpga-mgr";
-+ reg = <0xff706000 0x1000
-+ 0xffb90000 0x1000>;
-+ interrupts = <0 175 4>;
-+ };
-+
- gmac0: ethernet@ff700000 {
- compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac";
- altr,sysmgr-syscon = <&sysmgr 0x60 0>;
diff --git a/patches.altera/0007-PCI-altera-Fix-error-when-INTx-is-4.patch b/patches.altera/0007-PCI-altera-Fix-error-when-INTx-is-4.patch
deleted file mode 100644
index 31edf50434ef1b..00000000000000
--- a/patches.altera/0007-PCI-altera-Fix-error-when-INTx-is-4.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 9a036240ecf3cea9f5bd742e1d2f34a9ab9a0e42 Mon Sep 17 00:00:00 2001
-From: Ley Foon Tan <lftan@altera.com>
-Date: Wed, 9 Dec 2015 21:07:28 +0800
-Subject: [PATCH 7/7] PCI: altera: Fix error when INTx is 4
-
-PCI interrupt lines start at 1, not at 0. So, creates additional one
-interrupt when register for irq domain.
-
-Error when PCIe devices have 4 INTx:
-
- WARNING: CPU: 1 PID: 1 at kernel/irq/irqdomain.c:280
- irq_domain_associate+0x17c/0x1cc()
- error: hwirq 0x4 is too large for dummy
-
-Tested on Ethernet adapter card with multi-functions.
-
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
----
- drivers/pci/host/pcie-altera.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
-index 929a80878bb7..749954c3f9ec 100644
---- a/drivers/pci/host/pcie-altera.c
-+++ b/drivers/pci/host/pcie-altera.c
-@@ -477,7 +477,7 @@ static int altera_pcie_init_irq_domain(struct altera_pcie *pcie)
- struct device_node *node = dev->of_node;
-
- /* Setup INTx */
-- pcie->irq_domain = irq_domain_add_linear(node, INTX_NUM,
-+ pcie->irq_domain = irq_domain_add_linear(node, INTX_NUM + 1,
- &intx_domain_ops, pcie);
- if (!pcie->irq_domain) {
- dev_err(dev, "Failed to get a INTx IRQ domain\n");
---
-2.6.3
-
diff --git a/patches.altera/0007-nios2-add-Max10-defconfig.patch b/patches.altera/0007-nios2-add-Max10-defconfig.patch
deleted file mode 100644
index d8e96180ed3779..00000000000000
--- a/patches.altera/0007-nios2-add-Max10-defconfig.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-From f8a56cef689111e5bec8f600b7748ef15ec5f0f2 Mon Sep 17 00:00:00 2001
-From: Chee Nouk Phoon <cnphoon@altera.com>
-Date: Tue, 8 Sep 2015 18:08:56 +0800
-Subject: [PATCH 7/9] nios2: add Max10 defconfig
-
-Max10 is a FPGA device. This patch adds defconfig based on Max10 hardware
-reference design. Design is intended to run on Max10 development kit.
-
-Signed-off-by: Chee Nouk Phoon <cnphoon@altera.com>
-Signed-off-by: Ley Foon Tan <lftan@altera.com>
----
- arch/nios2/configs/10m50_defconfig | 81 ++++++++++++++++++++++++++++++++++++++
- 1 file changed, 81 insertions(+)
- create mode 100755 arch/nios2/configs/10m50_defconfig
-
-diff --git a/arch/nios2/configs/10m50_defconfig b/arch/nios2/configs/10m50_defconfig
-new file mode 100755
-index 000000000000..8b2a30b3b34f
---- /dev/null
-+++ b/arch/nios2/configs/10m50_defconfig
-@@ -0,0 +1,81 @@
-+CONFIG_SYSVIPC=y
-+CONFIG_NO_HZ_IDLE=y
-+CONFIG_BSD_PROCESS_ACCT=y
-+CONFIG_LOG_BUF_SHIFT=14
-+CONFIG_SYSCTL_SYSCALL=y
-+# CONFIG_ELF_CORE is not set
-+# CONFIG_EPOLL is not set
-+# CONFIG_SIGNALFD is not set
-+# CONFIG_TIMERFD is not set
-+# CONFIG_EVENTFD is not set
-+# CONFIG_SHMEM is not set
-+# CONFIG_AIO is not set
-+CONFIG_EMBEDDED=y
-+CONFIG_SLAB=y
-+CONFIG_MODULES=y
-+CONFIG_MODULE_UNLOAD=y
-+CONFIG_NIOS2_MEM_BASE=0x8000000
-+CONFIG_NIOS2_HW_MUL_SUPPORT=y
-+CONFIG_NIOS2_HW_DIV_SUPPORT=y
-+CONFIG_CUSTOM_CACHE_SETTINGS=y
-+CONFIG_NIOS2_DCACHE_SIZE=0x8000
-+CONFIG_NIOS2_ICACHE_SIZE=0x8000
-+# CONFIG_NIOS2_CMDLINE_IGNORE_DTB is not set
-+CONFIG_NET=y
-+CONFIG_PACKET=y
-+CONFIG_UNIX=y
-+CONFIG_INET=y
-+CONFIG_IP_MULTICAST=y
-+CONFIG_IP_PNP=y
-+CONFIG_IP_PNP_DHCP=y
-+CONFIG_IP_PNP_BOOTP=y
-+CONFIG_IP_PNP_RARP=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_IPV6 is not set
-+# CONFIG_WIRELESS is not set
-+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
-+CONFIG_DEVTMPFS=y
-+CONFIG_DEVTMPFS_MOUNT=y
-+# CONFIG_FW_LOADER is not set
-+CONFIG_MTD=y
-+CONFIG_MTD_CMDLINE_PARTS=y
-+CONFIG_MTD_BLOCK=y
-+CONFIG_MTD_CFI=y
-+CONFIG_MTD_CFI_INTELEXT=y
-+CONFIG_MTD_CFI_AMDSTD=y
-+CONFIG_BLK_DEV_LOOP=y
-+CONFIG_NETDEVICES=y
-+CONFIG_ALTERA_TSE=y
-+CONFIG_MARVELL_PHY=y
-+# CONFIG_WLAN is not set
-+# CONFIG_INPUT_MOUSE is not set
-+# CONFIG_SERIO_SERPORT is not set
-+# CONFIG_VT is not set
-+CONFIG_SERIAL_8250=y
-+# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
-+CONFIG_SERIAL_8250_CONSOLE=y
-+CONFIG_SERIAL_OF_PLATFORM=y
-+CONFIG_SERIAL_ALTERA_JTAGUART=y
-+# CONFIG_HW_RANDOM is not set
-+CONFIG_GPIOLIB=y
-+CONFIG_GPIO_SYSFS=y
-+CONFIG_GPIO_ALTERA=y
-+# CONFIG_HWMON is not set
-+# CONFIG_USB_SUPPORT is not set
-+CONFIG_NEW_LEDS=y
-+CONFIG_LEDS_CLASS=y
-+CONFIG_LEDS_GPIO=y
-+CONFIG_LEDS_TRIGGERS=y
-+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
-+# CONFIG_DNOTIFY is not set
-+# CONFIG_INOTIFY_USER is not set
-+CONFIG_JFFS2_FS=y
-+CONFIG_NFS_FS=y
-+CONFIG_NFS_V3_ACL=y
-+CONFIG_ROOT_NFS=y
-+CONFIG_SUNRPC_DEBUG=y
-+CONFIG_DEBUG_INFO=y
-+# CONFIG_ENABLE_WARN_DEPRECATED is not set
---
-2.6.2
-
diff --git a/patches.altera/0008-ARM-socfpga-dts-add-clocks-to-the-Arria10-platform.patch b/patches.altera/0008-ARM-socfpga-dts-add-clocks-to-the-Arria10-platform.patch
deleted file mode 100644
index 58ecf78354bb52..00000000000000
--- a/patches.altera/0008-ARM-socfpga-dts-add-clocks-to-the-Arria10-platform.patch
+++ /dev/null
@@ -1,417 +0,0 @@
-From bee6d610400e4cdad642e08945ac12aae29d7547 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Thu, 2 Apr 2015 11:43:20 -0500
-Subject: [PATCH 08/39] ARM: socfpga: dts: add clocks to the Arria10 platform
-
-Add all the clock nodes for the Arria10 platform. At the same time, update
-the peripherals with their respective clocks property.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit da29d824a6709116dd4dc50b82400547447a4f53)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga_arria10.dtsi | 309 ++++++++++++++++++++++++++++++++-
- 1 file changed, 305 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index ab0af2afdcf7..abf97630c592 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -86,6 +86,21 @@
- #address-cells = <1>;
- #size-cells = <0>;
-
-+ cb_intosc_hs_div2_clk: cb_intosc_hs_div2_clk {
-+ #clock-cells = <0>;
-+ compatible = "fixed-clock";
-+ };
-+
-+ cb_intosc_ls_clk: cb_intosc_ls_clk {
-+ #clock-cells = <0>;
-+ compatible = "fixed-clock";
-+ };
-+
-+ f2s_free_clk: f2s_free_clk {
-+ #clock-cells = <0>;
-+ compatible = "fixed-clock";
-+ };
-+
- osc1: osc1 {
- #clock-cells = <0>;
- compatible = "fixed-clock";
-@@ -95,16 +110,286 @@
- #address-cells = <1>;
- #size-cells = <0>;
- #clock-cells = <0>;
-- compatible = "altr,socfpga-pll-clock";
-- clocks = <&osc1>;
-+ compatible = "altr,socfpga-a10-pll-clock";
-+ clocks = <&osc1>, <&cb_intosc_ls_clk>,
-+ <&f2s_free_clk>;
-+ reg = <0x40>;
-+
-+ main_mpu_base_clk: main_mpu_base_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ div-reg = <0x140 0 11>;
-+ };
-+
-+ main_noc_base_clk: main_noc_base_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ div-reg = <0x144 0 11>;
-+ };
-+
-+ main_emaca_clk: main_emaca_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ reg = <0x68>;
-+ };
-+
-+ main_emacb_clk: main_emacb_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ reg = <0x6C>;
-+ };
-+
-+ main_emac_ptp_clk: main_emac_ptp_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ reg = <0x70>;
-+ };
-+
-+ main_gpio_db_clk: main_gpio_db_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ reg = <0x74>;
-+ };
-+
-+ main_sdmmc_clk: main_sdmmc_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk"
-+;
-+ clocks = <&main_pll>;
-+ reg = <0x78>;
-+ };
-+
-+ main_s2f_usr0_clk: main_s2f_usr0_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ reg = <0x7C>;
-+ };
-+
-+ main_s2f_usr1_clk: main_s2f_usr1_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ reg = <0x80>;
-+ };
-+
-+ main_hmc_pll_ref_clk: main_hmc_pll_ref_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ reg = <0x84>;
-+ };
-+
-+ main_periph_ref_clk: main_periph_ref_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_pll>;
-+ reg = <0x9C>;
-+ };
- };
-
- periph_pll: periph_pll {
- #address-cells = <1>;
- #size-cells = <0>;
- #clock-cells = <0>;
-- compatible = "altr,socfpga-pll-clock";
-- clocks = <&osc1>;
-+ compatible = "altr,socfpga-a10-pll-clock";
-+ clocks = <&osc1>, <&cb_intosc_ls_clk>,
-+ <&f2s_free_clk>, <&main_periph_ref_clk>;
-+ reg = <0xC0>;
-+
-+ peri_mpu_base_clk: peri_mpu_base_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ div-reg = <0x140 16 11>;
-+ };
-+
-+ peri_noc_base_clk: peri_noc_base_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ div-reg = <0x144 16 11>;
-+ };
-+
-+ peri_emaca_clk: peri_emaca_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ reg = <0xE8>;
-+ };
-+
-+ peri_emacb_clk: peri_emacb_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ reg = <0xEC>;
-+ };
-+
-+ peri_emac_ptp_clk: peri_emac_ptp_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ reg = <0xF0>;
-+ };
-+
-+ peri_gpio_db_clk: peri_gpio_db_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ reg = <0xF4>;
-+ };
-+
-+ peri_sdmmc_clk: peri_sdmmc_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ reg = <0xF8>;
-+ };
-+
-+ peri_s2f_usr0_clk: peri_s2f_usr0_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ reg = <0xFC>;
-+ };
-+
-+ peri_s2f_usr1_clk: peri_s2f_usr1_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ reg = <0x100>;
-+ };
-+
-+ peri_hmc_pll_ref_clk: peri_hmc_pll_ref_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&periph_pll>;
-+ reg = <0x104>;
-+ };
-+ };
-+
-+ mpu_free_clk: mpu_free_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_mpu_base_clk>, <&peri_mpu_base_clk>,
-+ <&osc1>, <&cb_intosc_hs_div2_clk>,
-+ <&f2s_free_clk>;
-+ reg = <0x60>;
-+ };
-+
-+ noc_free_clk: noc_free_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_noc_base_clk>, <&peri_noc_base_clk>,
-+ <&osc1>, <&cb_intosc_hs_div2_clk>,
-+ <&f2s_free_clk>;
-+ reg = <0x64>;
-+ };
-+
-+ s2f_user1_free_clk: s2f_user1_free_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_s2f_usr1_clk>, <&peri_s2f_usr1_clk>,
-+ <&osc1>, <&cb_intosc_hs_div2_clk>,
-+ <&f2s_free_clk>;
-+ reg = <0x104>;
-+ };
-+
-+ sdmmc_free_clk: sdmmc_free_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&main_sdmmc_clk>, <&peri_sdmmc_clk>,
-+ <&osc1>, <&cb_intosc_hs_div2_clk>,
-+ <&f2s_free_clk>;
-+ fixed-divider = <4>;
-+ reg = <0xF8>;
-+ };
-+
-+ l4_sys_free_clk: l4_sys_free_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-perip-clk";
-+ clocks = <&noc_free_clk>;
-+ fixed-divider = <4>;
-+ };
-+
-+ l4_main_clk: l4_main_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&noc_free_clk>;
-+ div-reg = <0xA8 0 2>;
-+ clk-gate = <0x48 1>;
-+ };
-+
-+ l4_mp_clk: l4_mp_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&noc_free_clk>;
-+ div-reg = <0xA8 8 2>;
-+ clk-gate = <0x48 2>;
-+ };
-+
-+ l4_sp_clk: l4_sp_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&noc_free_clk>;
-+ div-reg = <0xA8 16 2>;
-+ clk-gate = <0x48 3>;
-+ };
-+
-+ mpu_periph_clk: mpu_periph_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&mpu_free_clk>;
-+ fixed-divider = <4>;
-+ clk-gate = <0x48 0>;
-+ };
-+
-+ sdmmc_clk: sdmmc_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&sdmmc_free_clk>;
-+ clk-gate = <0xC8 5>;
-+ };
-+
-+ qspi_clk: qspi_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&l4_main_clk>;
-+ clk-gate = <0xC8 11>;
-+ };
-+
-+ nand_clk: nand_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&l4_mp_clk>;
-+ clk-gate = <0xC8 10>;
-+ };
-+
-+ spi_m_clk: spi_m_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&l4_main_clk>;
-+ clk-gate = <0xC8 9>;
-+ };
-+
-+ usb_clk: usb_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&l4_mp_clk>;
-+ clk-gate = <0xC8 8>;
-+ };
-+
-+ s2f_usr1_clk: s2f_usr1_clk {
-+ #clock-cells = <0>;
-+ compatible = "altr,socfpga-a10-gate-clk";
-+ clocks = <&peri_s2f_usr1_clk>;
-+ clk-gate = <0xC8 6>;
- };
- };
- };
-@@ -266,6 +551,8 @@
- reg = <0xff808000 0x1000>;
- interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
- fifo-depth = <0x400>;
-+ clocks = <&l4_mp_clk>, <&sdmmc_free_clk>;
-+ clock-names = "biu", "ciu";
- status = "disabled";
- };
-
-@@ -291,30 +578,39 @@
- compatible = "arm,cortex-a9-twd-timer";
- reg = <0xffffc600 0x100>;
- interrupts = <1 13 0xf04>;
-+ clocks = <&mpu_periph_clk>;
- };
-
- timer0: timer0@ffc02700 {
- compatible = "snps,dw-apb-timer";
- interrupts = <0 115 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0xffc02700 0x100>;
-+ clocks = <&l4_sp_clk>;
-+ clock-names = "timer";
- };
-
- timer1: timer1@ffc02800 {
- compatible = "snps,dw-apb-timer";
- interrupts = <0 116 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0xffc02800 0x100>;
-+ clocks = <&l4_sp_clk>;
-+ clock-names = "timer";
- };
-
- timer2: timer2@ffd00000 {
- compatible = "snps,dw-apb-timer";
- interrupts = <0 117 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0xffd00000 0x100>;
-+ clocks = <&l4_sys_free_clk>;
-+ clock-names = "timer";
- };
-
- timer3: timer3@ffd00100 {
- compatible = "snps,dw-apb-timer";
- interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>;
- reg = <0xffd01000 0x100>;
-+ clocks = <&l4_sys_free_clk>;
-+ clock-names = "timer";
- };
-
- uart0: serial0@ffc02000 {
-@@ -332,6 +628,7 @@
- interrupts = <0 111 IRQ_TYPE_LEVEL_HIGH>;
- reg-shift = <2>;
- reg-io-width = <4>;
-+ clocks = <&l4_sp_clk>;
- status = "disabled";
- };
-
-@@ -345,6 +642,8 @@
- compatible = "snps,dwc2";
- reg = <0xffb00000 0xffff>;
- interrupts = <0 95 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&usb_clk>;
-+ clock-names = "otg";
- phys = <&usbphy0>;
- phy-names = "usb2-phy";
- status = "disabled";
-@@ -363,6 +662,7 @@
- compatible = "snps,dw-wdt";
- reg = <0xffd00200 0x100>;
- interrupts = <0 119 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&l4_sys_free_clk>;
- status = "disabled";
- };
-
-@@ -370,6 +670,7 @@
- compatible = "snps,dw-wdt";
- reg = <0xffd00300 0x100>;
- interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&l4_sys_free_clk>;
- status = "disabled";
- };
- };
---
-2.6.2
-
diff --git a/patches.altera/0008-nios2-Fix-unused-variable-warning.patch b/patches.altera/0008-nios2-Fix-unused-variable-warning.patch
deleted file mode 100644
index 2d86f8f993cd48..00000000000000
--- a/patches.altera/0008-nios2-Fix-unused-variable-warning.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 577da9b93378b056215d239ba2216401bfd5a069 Mon Sep 17 00:00:00 2001
-From: Marek Vasut <marex@denx.de>
-Date: Wed, 30 Sep 2015 22:06:46 +0800
-Subject: [PATCH 8/9] nios2: Fix unused variable warning
-
-Fix the following compiler splat by adding __maybe_unused annotation to
-the variable. Using this particular annotation has the least ugly impact
-on the code compared to using ifdeffery.
-
-arch/nios2/kernel/setup.c: In function 'nios2_boot_init':
-arch/nios2/kernel/setup.c:107:7: warning: unused variable 'cmdline_passed' [-Wunused-variable]
- char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
- ^
-
-Signed-off-by: Marek Vasut <marex@denx.de>
-Acked-by: Ley Foon Tan <lftan@altera.com>
----
- arch/nios2/kernel/setup.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c
-index b101a43d3c5a..a4ff86d58d5c 100644
---- a/arch/nios2/kernel/setup.c
-+++ b/arch/nios2/kernel/setup.c
-@@ -104,7 +104,7 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
- unsigned r7)
- {
- unsigned dtb_passed = 0;
-- char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
-+ char cmdline_passed[COMMAND_LINE_SIZE] __maybe_unused = { 0, };
-
- #if defined(CONFIG_NIOS2_PASS_CMDLINE)
- if (r4 == 0x534f494e) { /* r4 is magic NIOS */
---
-2.6.2
-
diff --git a/patches.altera/0009-ARM-socfpga-Add-support-for-UART1-debug-uart-for-ear.patch b/patches.altera/0009-ARM-socfpga-Add-support-for-UART1-debug-uart-for-ear.patch
deleted file mode 100644
index bffee87696a9dc..00000000000000
--- a/patches.altera/0009-ARM-socfpga-Add-support-for-UART1-debug-uart-for-ear.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 9fb7d95533b91b8910f2db18fcf15b25a6a411e4 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Mon, 9 Mar 2015 15:48:31 -0500
-Subject: [PATCH 09/39] ARM: socfpga: Add support for UART1 debug uart for
- earlyprintk
-
-Add support for hardware uart1 for earlyprintk support on Arria10 devkit.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit de73c162fc2e91e19b7716fc9c0150f759be2567)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/Kconfig.debug | 26 +++++++++++++++++++-------
- 1 file changed, 19 insertions(+), 7 deletions(-)
-
---- a/arch/arm/Kconfig.debug
-+++ b/arch/arm/Kconfig.debug
-@@ -907,13 +907,22 @@ choice
- on SA-11x0 UART ports. The kernel will check for the first
- enabled UART in a sequence 3-1-2.
-
-- config DEBUG_SOCFPGA_UART
-+ config DEBUG_SOCFPGA_UART0
- depends on ARCH_SOCFPGA
-- bool "Use SOCFPGA UART for low-level debug"
-+ bool "Use SOCFPGA UART0 for low-level debug"
- select DEBUG_UART_8250
- help
- Say Y here if you want kernel low-level debugging support
-- on SOCFPGA based platforms.
-+ on SOCFPGA(Cyclone 5 and Arria 5) based platforms.
-+
-+ config DEBUG_SOCFPGA_UART1
-+ depends on ARCH_SOCFPGA
-+ bool "Use SOCFPGA UART1 for low-level debug"
-+ select DEBUG_UART_8250
-+ help
-+ Say Y here if you want kernel low-level debugging support
-+ on SOCFPGA(Arria 10) based platforms.
-+
-
- config DEBUG_SUN9I_UART0
- bool "Kernel low-level debugging messages via sun9i UART0"
-@@ -1402,7 +1411,8 @@ config DEBUG_UART_PHYS
- default 0xfd883000 if DEBUG_ALPINE_UART0
- default 0xfe800000 if ARCH_IOP32X
- default 0xff690000 if DEBUG_RK32_UART2
-- default 0xffc02000 if DEBUG_SOCFPGA_UART
-+ default 0xffc02000 if DEBUG_SOCFPGA_UART0
-+ default 0xffc02100 if DEBUG_SOCFPGA_UART1
- default 0xffd82340 if ARCH_IOP13XX
- default 0xffe40000 if DEBUG_RCAR_GEN1_SCIF0
- default 0xffe42000 if DEBUG_RCAR_GEN1_SCIF2
-@@ -1480,7 +1490,8 @@ config DEBUG_UART_VIRT
- default 0xfeb26000 if DEBUG_RK3X_UART1
- default 0xfeb30c00 if DEBUG_KEYSTONE_UART0
- default 0xfeb31000 if DEBUG_KEYSTONE_UART1
-- default 0xfec02000 if DEBUG_SOCFPGA_UART
-+ default 0xfec02000 if DEBUG_SOCFPGA_UART0
-+ default 0xfec02100 if DEBUG_SOCFPGA_UART1
- default 0xfec12000 if DEBUG_MVEBU_UART0 || DEBUG_MVEBU_UART0_ALTERNATE
- default 0xfec12100 if DEBUG_MVEBU_UART1_ALTERNATE
- default 0xfec10000 if DEBUG_SIRFATLAS7_UART0
-@@ -1525,8 +1536,9 @@ config DEBUG_UART_8250_WORD
- bool "Use 32-bit accesses for 8250 UART"
- depends on DEBUG_LL_UART_8250 || DEBUG_UART_8250
- depends on DEBUG_UART_8250_SHIFT >= 2
-- default y if DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \
-- ARCH_KEYSTONE || DEBUG_ALPINE_UART0 || \
-+ default y if DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART0 || \
-+ DEBUG_SOCFPGA_UART1 || ARCH_KEYSTONE || \
-+ DEBUG_ALPINE_UART0 || \
- DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \
- DEBUG_DAVINCI_DA8XX_UART2 || \
- DEBUG_BCM_KONA_UART || DEBUG_RK32_UART2 || \
diff --git a/patches.altera/0009-nios2-Switch-to-generic-__xchg.patch b/patches.altera/0009-nios2-Switch-to-generic-__xchg.patch
deleted file mode 100644
index 109ba8570d7758..00000000000000
--- a/patches.altera/0009-nios2-Switch-to-generic-__xchg.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-From 90df4ef19e6dfb7521e05ece60546677491c9e32 Mon Sep 17 00:00:00 2001
-From: Marek Vasut <marex@denx.de>
-Date: Wed, 30 Sep 2015 22:08:00 +0800
-Subject: [PATCH 9/9] nios2: Switch to generic __xchg()
-
-The generic __xchg() implementation present in asm-generic/cmpxchg.h is
-correct on nios2 and even generates the same code. Switch to this generic
-implementation to trim down the amount of ad-hoc copies of the code.
-
-Signed-off-by: Marek Vasut <marex@denx.de>
-Acked-by: Ley Foon Tan <lftan@altera.com>
----
- arch/nios2/include/asm/cmpxchg.h | 47 ----------------------------------------
- 1 file changed, 47 deletions(-)
-
-diff --git a/arch/nios2/include/asm/cmpxchg.h b/arch/nios2/include/asm/cmpxchg.h
-index 85938711542d..a7978f14d157 100644
---- a/arch/nios2/include/asm/cmpxchg.h
-+++ b/arch/nios2/include/asm/cmpxchg.h
-@@ -9,53 +9,6 @@
- #ifndef _ASM_NIOS2_CMPXCHG_H
- #define _ASM_NIOS2_CMPXCHG_H
-
--#include <linux/irqflags.h>
--
--#define xchg(ptr, x) \
-- ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
--
--struct __xchg_dummy { unsigned long a[100]; };
--#define __xg(x) ((volatile struct __xchg_dummy *)(x))
--
--static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
-- int size)
--{
-- unsigned long tmp, flags;
--
-- local_irq_save(flags);
--
-- switch (size) {
-- case 1:
-- __asm__ __volatile__(
-- "ldb %0, %2\n"
-- "stb %1, %2\n"
-- : "=&r" (tmp)
-- : "r" (x), "m" (*__xg(ptr))
-- : "memory");
-- break;
-- case 2:
-- __asm__ __volatile__(
-- "ldh %0, %2\n"
-- "sth %1, %2\n"
-- : "=&r" (tmp)
-- : "r" (x), "m" (*__xg(ptr))
-- : "memory");
-- break;
-- case 4:
-- __asm__ __volatile__(
-- "ldw %0, %2\n"
-- "stw %1, %2\n"
-- : "=&r" (tmp)
-- : "r" (x), "m" (*__xg(ptr))
-- : "memory");
-- break;
-- }
--
-- local_irq_restore(flags);
-- return tmp;
--}
--
- #include <asm-generic/cmpxchg.h>
--#include <asm-generic/cmpxchg-local.h>
-
- #endif /* _ASM_NIOS2_CMPXCHG_H */
---
-2.6.2
-
diff --git a/patches.altera/0010-ARM-socfpga-remove-the-need-to-map-uart_io_desc.patch b/patches.altera/0010-ARM-socfpga-remove-the-need-to-map-uart_io_desc.patch
deleted file mode 100644
index 5c3af2eecb7003..00000000000000
--- a/patches.altera/0010-ARM-socfpga-remove-the-need-to-map-uart_io_desc.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From a121e113b664c4eb6e11dd0fc5d562b5e892930f Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Mon, 9 Mar 2015 22:10:02 -0500
-Subject: [PATCH 10/39] ARM: socfpga: remove the need to map uart_io_desc
-
-All the necessary debug uart mapping is already being done in
-debug_ll_io_init, there's no need for it here.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 65ce7a37ec23c9e7878bd77e2f75b1eb9d8926e3)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/mach-socfpga/socfpga.c | 9 ---------
- 1 file changed, 9 deletions(-)
-
-diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
-index f5e597c207b9..358f2c712979 100644
---- a/arch/arm/mach-socfpga/socfpga.c
-+++ b/arch/arm/mach-socfpga/socfpga.c
-@@ -39,13 +39,6 @@ static struct map_desc scu_io_desc __initdata = {
- .type = MT_DEVICE,
- };
-
--static struct map_desc uart_io_desc __initdata = {
-- .virtual = 0xfec02000,
-- .pfn = __phys_to_pfn(0xffc02000),
-- .length = SZ_8K,
-- .type = MT_DEVICE,
--};
--
- static void __init socfpga_scu_map_io(void)
- {
- unsigned long base;
-@@ -60,8 +53,6 @@ static void __init socfpga_scu_map_io(void)
- static void __init socfpga_map_io(void)
- {
- socfpga_scu_map_io();
-- iotable_init(&uart_io_desc, 1);
-- early_printk("Early printk initialized\n");
- }
-
- void __init socfpga_sysmgr_init(void)
---
-2.6.2
-
diff --git a/patches.altera/0011-ARM-socfpga-dts-add-the-a9-scu-node.patch b/patches.altera/0011-ARM-socfpga-dts-add-the-a9-scu-node.patch
deleted file mode 100644
index 2b3e2290fdf6ea..00000000000000
--- a/patches.altera/0011-ARM-socfpga-dts-add-the-a9-scu-node.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 94947b77f52bf8b37621bf91123907c3cfaf4fa6 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Tue, 12 May 2015 15:48:13 -0500
-Subject: [PATCH 11/39] ARM: socfpga: dts: add the a9-scu node
-
-Add the dts node for the A9 SCU.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 8508452e57f7d50216338c28db6d42dfe585389a)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga.dtsi | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
-index 2e9ed36df12e..9b653edd003f 100644
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -667,6 +667,11 @@
- status = "disabled";
- };
-
-+ scu: snoop-control-unit@fffec000 {
-+ compatible = "arm,cortex-a9-scu";
-+ reg = <0xfffec000 0x100>;
-+ };
-+
- spi1: spi@fff01000 {
- compatible = "snps,dw-apb-ssi";
- #address-cells = <1>;
---
-2.6.2
-
diff --git a/patches.altera/0012-ARM-socfpga-use-of_iomap-to-map-the-SCU.patch b/patches.altera/0012-ARM-socfpga-use-of_iomap-to-map-the-SCU.patch
deleted file mode 100644
index f23ab91db1fa2b..00000000000000
--- a/patches.altera/0012-ARM-socfpga-use-of_iomap-to-map-the-SCU.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-From 7d6b3c462a19dda153de86d2ccc5805ad7f47443 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Tue, 12 May 2015 16:49:21 -0500
-Subject: [PATCH 12/39] ARM: socfpga: use of_iomap to map the SCU
-
-Use of_iomap to map the "arm,cortex-a9-scu". By doing this, we can remove
-map_io in socfpga.c.
-
-Also, we can remove socfpga_smp_init_cpus, as arm_dt_init_cpu_maps is
-already doing the CPU mapping.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 122694a0c71281cf2b349af41309c3caf5f31d61)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/mach-socfpga/core.h | 2 --
- arch/arm/mach-socfpga/platsmp.c | 33 ++++++++++-----------------------
- arch/arm/mach-socfpga/socfpga.c | 25 -------------------------
- 3 files changed, 10 insertions(+), 50 deletions(-)
-
---- a/arch/arm/mach-socfpga/core.h
-+++ b/arch/arm/mach-socfpga/core.h
-@@ -31,8 +31,6 @@
-
- #define RSTMGR_MPUMODRST_CPU1 0x2 /* CPU1 Reset */
-
--extern void __iomem *socfpga_scu_base_addr;
--
- extern void socfpga_init_clocks(void);
- extern void socfpga_sysmgr_init(void);
-
---- a/arch/arm/mach-socfpga/platsmp.c
-+++ b/arch/arm/mach-socfpga/platsmp.c
-@@ -54,32 +54,20 @@ static int socfpga_boot_secondary(unsign
- return 0;
- }
-
--/*
-- * Initialise the CPU possible map early - this describes the CPUs
-- * which may be present or become present in the system.
-- */
--static void __init socfpga_smp_init_cpus(void)
-+static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
- {
-- unsigned int i, ncores;
--
-- ncores = scu_get_core_count(socfpga_scu_base_addr);
--
-- for (i = 0; i < ncores; i++)
-- set_cpu_possible(i, true);
-+ struct device_node *np;
-+ void __iomem *socfpga_scu_base_addr;
-
-- /* sanity check */
-- if (ncores > num_possible_cpus()) {
-- pr_warn("socfpga: no. of cores (%d) greater than configured"
-- "maximum of %d - clipping\n", ncores, num_possible_cpus());
-- ncores = num_possible_cpus();
-+ np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
-+ if (!np) {
-+ pr_err("%s: missing scu\n", __func__);
-+ return;
- }
-
-- for (i = 0; i < ncores; i++)
-- set_cpu_possible(i, true);
--}
--
--static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
--{
-+ socfpga_scu_base_addr = of_iomap(np, 0);
-+ if (!socfpga_scu_base_addr)
-+ return;
- scu_enable(socfpga_scu_base_addr);
- }
-
-@@ -96,7 +84,6 @@ static void socfpga_cpu_die(unsigned int
- }
-
- struct smp_operations socfpga_smp_ops __initdata = {
-- .smp_init_cpus = socfpga_smp_init_cpus,
- .smp_prepare_cpus = socfpga_smp_prepare_cpus,
- .smp_boot_secondary = socfpga_boot_secondary,
- #ifdef CONFIG_HOTPLUG_CPU
---- a/arch/arm/mach-socfpga/socfpga.c
-+++ b/arch/arm/mach-socfpga/socfpga.c
-@@ -27,34 +27,10 @@
-
- #include "core.h"
-
--void __iomem *socfpga_scu_base_addr = ((void __iomem *)(SOCFPGA_SCU_VIRT_BASE));
- void __iomem *sys_manager_base_addr;
- void __iomem *rst_manager_base_addr;
- unsigned long socfpga_cpu1start_addr;
-
--static struct map_desc scu_io_desc __initdata = {
-- .virtual = SOCFPGA_SCU_VIRT_BASE,
-- .pfn = 0, /* run-time */
-- .length = SZ_8K,
-- .type = MT_DEVICE,
--};
--
--static void __init socfpga_scu_map_io(void)
--{
-- unsigned long base;
--
-- /* Get SCU base */
-- asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
--
-- scu_io_desc.pfn = __phys_to_pfn(base);
-- iotable_init(&scu_io_desc, 1);
--}
--
--static void __init socfpga_map_io(void)
--{
-- socfpga_scu_map_io();
--}
--
- void __init socfpga_sysmgr_init(void)
- {
- struct device_node *np;
-@@ -103,7 +79,6 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPG
- .l2c_aux_val = 0,
- .l2c_aux_mask = ~0,
- .smp = smp_ops(socfpga_smp_ops),
-- .map_io = socfpga_map_io,
- .init_irq = socfpga_init_irq,
- .restart = socfpga_cyclone5_restart,
- .dt_compat = altera_dt_match,
diff --git a/patches.altera/0013-clk-socfpga-update-clk.h-so-for-Arria10-platform-to-.patch b/patches.altera/0013-clk-socfpga-update-clk.h-so-for-Arria10-platform-to-.patch
deleted file mode 100644
index e4337db46f111d..00000000000000
--- a/patches.altera/0013-clk-socfpga-update-clk.h-so-for-Arria10-platform-to-.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 802a04ce9dfe11e78a5aa6fb5389d7c5f935a33f Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Tue, 19 May 2015 22:22:41 -0500
-Subject: [PATCH 13/39] clk: socfpga: update clk.h so for Arria10 platform to
- use
-
-There are 5 possible parent clocks for the SoCFPGA Arria10. Move the define
-SYSMGR_SDMMC_CTRL_SET and streq() to clk.h so that the Arria clock driver
-can use.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-(cherry picked from commit 5611a5ba8e5435740df99235b262b553f687b13b)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/clk/socfpga/clk-gate.c | 4 ----
- drivers/clk/socfpga/clk.h | 6 +++++-
- 2 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
-index dd3a78c64795..607ab352f73c 100644
---- a/drivers/clk/socfpga/clk-gate.c
-+++ b/drivers/clk/socfpga/clk-gate.c
-@@ -32,14 +32,10 @@
- #define SOCFPGA_MMC_CLK "sdmmc_clk"
- #define SOCFPGA_GPIO_DB_CLK_OFFSET 0xA8
-
--#define streq(a, b) (strcmp((a), (b)) == 0)
--
- #define to_socfpga_gate_clk(p) container_of(p, struct socfpga_gate_clk, hw.hw)
-
- /* SDMMC Group for System Manager defines */
- #define SYSMGR_SDMMCGRP_CTRL_OFFSET 0x108
--#define SYSMGR_SDMMC_CTRL_SET(smplsel, drvsel) \
-- ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0))
-
- static u8 socfpga_clk_get_parent(struct clk_hw *hwclk)
- {
-diff --git a/drivers/clk/socfpga/clk.h b/drivers/clk/socfpga/clk.h
-index d291f60c46e1..b09a5d50547e 100644
---- a/drivers/clk/socfpga/clk.h
-+++ b/drivers/clk/socfpga/clk.h
-@@ -26,9 +26,13 @@
- #define CLKMGR_L4SRC 0x70
- #define CLKMGR_PERPLL_SRC 0xAC
-
--#define SOCFPGA_MAX_PARENTS 3
-+#define SOCFPGA_MAX_PARENTS 5
- #define div_mask(width) ((1 << (width)) - 1)
-
-+#define streq(a, b) (strcmp((a), (b)) == 0)
-+#define SYSMGR_SDMMC_CTRL_SET(smplsel, drvsel) \
-+ ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0))
-+
- extern void __iomem *clk_mgr_base_addr;
-
- void __init socfpga_pll_init(struct device_node *node);
---
-2.6.2
-
diff --git a/patches.altera/0014-clk-socfpga-add-a-clock-driver-for-the-Arria-10-plat.patch b/patches.altera/0014-clk-socfpga-add-a-clock-driver-for-the-Arria-10-plat.patch
deleted file mode 100644
index ecafd3c91993d0..00000000000000
--- a/patches.altera/0014-clk-socfpga-add-a-clock-driver-for-the-Arria-10-plat.patch
+++ /dev/null
@@ -1,555 +0,0 @@
-From 908c56457c90fd483edd9ec76081415b10486711 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Tue, 19 May 2015 22:22:42 -0500
-Subject: [PATCH 14/39] clk: socfpga: add a clock driver for the Arria 10
- platform
-
-The clocks on the Arria 10 platform is a bit different than the
-Cyclone/Arria 5 platform that it should just have it's own
-driver.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-(cherry picked from commit 5343325ff3dd299f459fa9dacbd95dca5c9bf215)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/clk/socfpga/Makefile | 1 +
- drivers/clk/socfpga/clk-gate-a10.c | 190 +++++++++++++++++++++++++++++++++++
- drivers/clk/socfpga/clk-periph-a10.c | 138 +++++++++++++++++++++++++
- drivers/clk/socfpga/clk-pll-a10.c | 129 ++++++++++++++++++++++++
- drivers/clk/socfpga/clk.c | 7 +-
- drivers/clk/socfpga/clk.h | 5 +
- 6 files changed, 469 insertions(+), 1 deletion(-)
- create mode 100644 drivers/clk/socfpga/clk-gate-a10.c
- create mode 100644 drivers/clk/socfpga/clk-periph-a10.c
- create mode 100644 drivers/clk/socfpga/clk-pll-a10.c
-
-diff --git a/drivers/clk/socfpga/Makefile b/drivers/clk/socfpga/Makefile
-index 7e2d15a0c7b8..d8bb239753a4 100644
---- a/drivers/clk/socfpga/Makefile
-+++ b/drivers/clk/socfpga/Makefile
-@@ -2,3 +2,4 @@ obj-y += clk.o
- obj-y += clk-gate.o
- obj-y += clk-pll.o
- obj-y += clk-periph.o
-+obj-y += clk-pll-a10.o clk-periph-a10.o clk-gate-a10.o
-diff --git a/drivers/clk/socfpga/clk-gate-a10.c b/drivers/clk/socfpga/clk-gate-a10.c
-new file mode 100644
-index 000000000000..be3e998b85d0
---- /dev/null
-+++ b/drivers/clk/socfpga/clk-gate-a10.c
-@@ -0,0 +1,190 @@
-+/*
-+ * Copyright (C) 2015 Altera Corporation. All rights reserved
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+#include <linux/clk-provider.h>
-+#include <linux/io.h>
-+#include <linux/mfd/syscon.h>
-+#include <linux/of.h>
-+#include <linux/regmap.h>
-+
-+#include "clk.h"
-+
-+#define streq(a, b) (strcmp((a), (b)) == 0)
-+
-+#define to_socfpga_gate_clk(p) container_of(p, struct socfpga_gate_clk, hw.hw)
-+
-+/* SDMMC Group for System Manager defines */
-+#define SYSMGR_SDMMCGRP_CTRL_OFFSET 0x28
-+
-+static unsigned long socfpga_gate_clk_recalc_rate(struct clk_hw *hwclk,
-+ unsigned long parent_rate)
-+{
-+ struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
-+ u32 div = 1, val;
-+
-+ if (socfpgaclk->fixed_div)
-+ div = socfpgaclk->fixed_div;
-+ else if (socfpgaclk->div_reg) {
-+ val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
-+ val &= div_mask(socfpgaclk->width);
-+ div = (1 << val);
-+ }
-+
-+ return parent_rate / div;
-+}
-+
-+static int socfpga_clk_prepare(struct clk_hw *hwclk)
-+{
-+ struct socfpga_gate_clk *socfpgaclk = to_socfpga_gate_clk(hwclk);
-+ int i;
-+ u32 hs_timing;
-+ u32 clk_phase[2];
-+
-+ if (socfpgaclk->clk_phase[0] || socfpgaclk->clk_phase[1]) {
-+ for (i = 0; i < ARRAY_SIZE(clk_phase); i++) {
-+ switch (socfpgaclk->clk_phase[i]) {
-+ case 0:
-+ clk_phase[i] = 0;
-+ break;
-+ case 45:
-+ clk_phase[i] = 1;
-+ break;
-+ case 90:
-+ clk_phase[i] = 2;
-+ break;
-+ case 135:
-+ clk_phase[i] = 3;
-+ break;
-+ case 180:
-+ clk_phase[i] = 4;
-+ break;
-+ case 225:
-+ clk_phase[i] = 5;
-+ break;
-+ case 270:
-+ clk_phase[i] = 6;
-+ break;
-+ case 315:
-+ clk_phase[i] = 7;
-+ break;
-+ default:
-+ clk_phase[i] = 0;
-+ break;
-+ }
-+ }
-+
-+ hs_timing = SYSMGR_SDMMC_CTRL_SET(clk_phase[0], clk_phase[1]);
-+ if (!IS_ERR(socfpgaclk->sys_mgr_base_addr))
-+ regmap_write(socfpgaclk->sys_mgr_base_addr,
-+ SYSMGR_SDMMCGRP_CTRL_OFFSET, hs_timing);
-+ else
-+ pr_err("%s: cannot set clk_phase because sys_mgr_base_addr is not available!\n",
-+ __func__);
-+ }
-+ return 0;
-+}
-+
-+static struct clk_ops gateclk_ops = {
-+ .prepare = socfpga_clk_prepare,
-+ .recalc_rate = socfpga_gate_clk_recalc_rate,
-+};
-+
-+static void __init __socfpga_gate_init(struct device_node *node,
-+ const struct clk_ops *ops)
-+{
-+ u32 clk_gate[2];
-+ u32 div_reg[3];
-+ u32 clk_phase[2];
-+ u32 fixed_div;
-+ struct clk *clk;
-+ struct socfpga_gate_clk *socfpga_clk;
-+ const char *clk_name = node->name;
-+ const char *parent_name[SOCFPGA_MAX_PARENTS];
-+ struct clk_init_data init;
-+ int rc;
-+ int i = 0;
-+
-+ socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL);
-+ if (WARN_ON(!socfpga_clk))
-+ return;
-+
-+ rc = of_property_read_u32_array(node, "clk-gate", clk_gate, 2);
-+ if (rc)
-+ clk_gate[0] = 0;
-+
-+ if (clk_gate[0]) {
-+ socfpga_clk->hw.reg = clk_mgr_a10_base_addr + clk_gate[0];
-+ socfpga_clk->hw.bit_idx = clk_gate[1];
-+
-+ gateclk_ops.enable = clk_gate_ops.enable;
-+ gateclk_ops.disable = clk_gate_ops.disable;
-+ }
-+
-+ rc = of_property_read_u32(node, "fixed-divider", &fixed_div);
-+ if (rc)
-+ socfpga_clk->fixed_div = 0;
-+ else
-+ socfpga_clk->fixed_div = fixed_div;
-+
-+ rc = of_property_read_u32_array(node, "div-reg", div_reg, 3);
-+ if (!rc) {
-+ socfpga_clk->div_reg = clk_mgr_a10_base_addr + div_reg[0];
-+ socfpga_clk->shift = div_reg[1];
-+ socfpga_clk->width = div_reg[2];
-+ } else {
-+ socfpga_clk->div_reg = NULL;
-+ }
-+
-+ rc = of_property_read_u32_array(node, "clk-phase", clk_phase, 2);
-+ if (!rc) {
-+ socfpga_clk->clk_phase[0] = clk_phase[0];
-+ socfpga_clk->clk_phase[1] = clk_phase[1];
-+
-+ socfpga_clk->sys_mgr_base_addr =
-+ syscon_regmap_lookup_by_compatible("altr,sys-mgr");
-+ if (IS_ERR(socfpga_clk->sys_mgr_base_addr)) {
-+ pr_err("%s: failed to find altr,sys-mgr regmap!\n",
-+ __func__);
-+ return;
-+ }
-+ }
-+
-+ of_property_read_string(node, "clock-output-names", &clk_name);
-+
-+ init.name = clk_name;
-+ init.ops = ops;
-+ init.flags = 0;
-+ while (i < SOCFPGA_MAX_PARENTS && (parent_name[i] =
-+ of_clk_get_parent_name(node, i)) != NULL)
-+ i++;
-+
-+ init.parent_names = parent_name;
-+ init.num_parents = i;
-+ socfpga_clk->hw.hw.init = &init;
-+
-+ clk = clk_register(NULL, &socfpga_clk->hw.hw);
-+ if (WARN_ON(IS_ERR(clk))) {
-+ kfree(socfpga_clk);
-+ return;
-+ }
-+ rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
-+ if (WARN_ON(rc))
-+ return;
-+}
-+
-+void __init socfpga_a10_gate_init(struct device_node *node)
-+{
-+ __socfpga_gate_init(node, &gateclk_ops);
-+}
-diff --git a/drivers/clk/socfpga/clk-periph-a10.c b/drivers/clk/socfpga/clk-periph-a10.c
-new file mode 100644
-index 000000000000..9d0181b5a6a4
---- /dev/null
-+++ b/drivers/clk/socfpga/clk-periph-a10.c
-@@ -0,0 +1,138 @@
-+/*
-+ * Copyright (C) 2015 Altera Corporation. All rights reserved
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+#include <linux/clk-provider.h>
-+#include <linux/io.h>
-+#include <linux/of.h>
-+
-+#include "clk.h"
-+
-+#define CLK_MGR_FREE_SHIFT 16
-+#define CLK_MGR_FREE_MASK 0x7
-+
-+#define SOCFPGA_MPU_FREE_CLK "mpu_free_clk"
-+#define SOCFPGA_NOC_FREE_CLK "noc_free_clk"
-+#define SOCFPGA_SDMMC_FREE_CLK "sdmmc_free_clk"
-+#define to_socfpga_periph_clk(p) container_of(p, struct socfpga_periph_clk, hw.hw)
-+
-+static unsigned long clk_periclk_recalc_rate(struct clk_hw *hwclk,
-+ unsigned long parent_rate)
-+{
-+ struct socfpga_periph_clk *socfpgaclk = to_socfpga_periph_clk(hwclk);
-+ u32 div;
-+
-+ if (socfpgaclk->fixed_div) {
-+ div = socfpgaclk->fixed_div;
-+ } else if (socfpgaclk->div_reg) {
-+ div = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
-+ div &= div_mask(socfpgaclk->width);
-+ div += 1;
-+ } else {
-+ div = ((readl(socfpgaclk->hw.reg) & 0x7ff) + 1);
-+ }
-+
-+ return parent_rate / div;
-+}
-+
-+static u8 clk_periclk_get_parent(struct clk_hw *hwclk)
-+{
-+ struct socfpga_periph_clk *socfpgaclk = to_socfpga_periph_clk(hwclk);
-+ u32 clk_src;
-+
-+ clk_src = readl(socfpgaclk->hw.reg);
-+ if (streq(hwclk->init->name, SOCFPGA_MPU_FREE_CLK) ||
-+ streq(hwclk->init->name, SOCFPGA_NOC_FREE_CLK) ||
-+ streq(hwclk->init->name, SOCFPGA_SDMMC_FREE_CLK))
-+ return (clk_src >> CLK_MGR_FREE_SHIFT) &
-+ CLK_MGR_FREE_MASK;
-+ else
-+ return 0;
-+}
-+
-+static const struct clk_ops periclk_ops = {
-+ .recalc_rate = clk_periclk_recalc_rate,
-+ .get_parent = clk_periclk_get_parent,
-+};
-+
-+static __init void __socfpga_periph_init(struct device_node *node,
-+ const struct clk_ops *ops)
-+{
-+ u32 reg;
-+ struct clk *clk;
-+ struct socfpga_periph_clk *periph_clk;
-+ const char *clk_name = node->name;
-+ const char *parent_name;
-+ struct clk_init_data init;
-+ int rc;
-+ u32 fixed_div;
-+ u32 div_reg[3];
-+
-+ of_property_read_u32(node, "reg", &reg);
-+
-+ periph_clk = kzalloc(sizeof(*periph_clk), GFP_KERNEL);
-+ if (WARN_ON(!periph_clk))
-+ return;
-+
-+ periph_clk->hw.reg = clk_mgr_a10_base_addr + reg;
-+
-+ rc = of_property_read_u32_array(node, "div-reg", div_reg, 3);
-+ if (!rc) {
-+ periph_clk->div_reg = clk_mgr_a10_base_addr + div_reg[0];
-+ periph_clk->shift = div_reg[1];
-+ periph_clk->width = div_reg[2];
-+ } else {
-+ periph_clk->div_reg = NULL;
-+ }
-+
-+ rc = of_property_read_u32(node, "fixed-divider", &fixed_div);
-+ if (rc)
-+ periph_clk->fixed_div = 0;
-+ else
-+ periph_clk->fixed_div = fixed_div;
-+
-+ of_property_read_string(node, "clock-output-names", &clk_name);
-+
-+ init.name = clk_name;
-+ init.ops = ops;
-+ init.flags = 0;
-+
-+ parent_name = of_clk_get_parent_name(node, 0);
-+ init.num_parents = 1;
-+ init.parent_names = &parent_name;
-+
-+ periph_clk->hw.hw.init = &init;
-+
-+ clk = clk_register(NULL, &periph_clk->hw.hw);
-+ if (WARN_ON(IS_ERR(clk))) {
-+ kfree(periph_clk);
-+ return;
-+ }
-+ rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
-+ if (rc < 0) {
-+ pr_err("Could not register clock provider for node:%s\n",
-+ clk_name);
-+ goto err_clk;
-+ }
-+
-+ return;
-+
-+err_clk:
-+ clk_unregister(clk);
-+}
-+
-+void __init socfpga_a10_periph_init(struct device_node *node)
-+{
-+ __socfpga_periph_init(node, &periclk_ops);
-+}
-diff --git a/drivers/clk/socfpga/clk-pll-a10.c b/drivers/clk/socfpga/clk-pll-a10.c
-new file mode 100644
-index 000000000000..1178b11babca
---- /dev/null
-+++ b/drivers/clk/socfpga/clk-pll-a10.c
-@@ -0,0 +1,129 @@
-+/*
-+ * Copyright (C) 2015 Altera Corporation. All rights reserved
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+#include <linux/clk-provider.h>
-+#include <linux/io.h>
-+#include <linux/of.h>
-+#include <linux/of_address.h>
-+
-+#include "clk.h"
-+
-+/* Clock Manager offsets */
-+#define CLK_MGR_PLL_CLK_SRC_SHIFT 8
-+#define CLK_MGR_PLL_CLK_SRC_MASK 0x3
-+
-+/* Clock bypass bits */
-+#define SOCFPGA_PLL_BG_PWRDWN 0
-+#define SOCFPGA_PLL_PWR_DOWN 1
-+#define SOCFPGA_PLL_EXT_ENA 2
-+#define SOCFPGA_PLL_DIVF_MASK 0x00001FFF
-+#define SOCFPGA_PLL_DIVF_SHIFT 0
-+#define SOCFPGA_PLL_DIVQ_MASK 0x003F0000
-+#define SOCFPGA_PLL_DIVQ_SHIFT 16
-+#define SOCFGPA_MAX_PARENTS 5
-+
-+#define SOCFPGA_MAIN_PLL_CLK "main_pll"
-+#define SOCFPGA_PERIP_PLL_CLK "periph_pll"
-+
-+#define to_socfpga_clk(p) container_of(p, struct socfpga_pll, hw.hw)
-+
-+void __iomem *clk_mgr_a10_base_addr;
-+
-+static unsigned long clk_pll_recalc_rate(struct clk_hw *hwclk,
-+ unsigned long parent_rate)
-+{
-+ struct socfpga_pll *socfpgaclk = to_socfpga_clk(hwclk);
-+ unsigned long divf, divq, reg;
-+ unsigned long long vco_freq;
-+
-+ /* read VCO1 reg for numerator and denominator */
-+ reg = readl(socfpgaclk->hw.reg + 0x4);
-+ divf = (reg & SOCFPGA_PLL_DIVF_MASK) >> SOCFPGA_PLL_DIVF_SHIFT;
-+ divq = (reg & SOCFPGA_PLL_DIVQ_MASK) >> SOCFPGA_PLL_DIVQ_SHIFT;
-+ vco_freq = (unsigned long long)parent_rate * (divf + 1);
-+ do_div(vco_freq, (1 + divq));
-+ return (unsigned long)vco_freq;
-+}
-+
-+static u8 clk_pll_get_parent(struct clk_hw *hwclk)
-+{
-+ struct socfpga_pll *socfpgaclk = to_socfpga_clk(hwclk);
-+ u32 pll_src;
-+
-+ pll_src = readl(socfpgaclk->hw.reg);
-+
-+ return (pll_src >> CLK_MGR_PLL_CLK_SRC_SHIFT) &
-+ CLK_MGR_PLL_CLK_SRC_MASK;
-+}
-+
-+static struct clk_ops clk_pll_ops = {
-+ .recalc_rate = clk_pll_recalc_rate,
-+ .get_parent = clk_pll_get_parent,
-+};
-+
-+static struct __init clk * __socfpga_pll_init(struct device_node *node,
-+ const struct clk_ops *ops)
-+{
-+ u32 reg;
-+ struct clk *clk;
-+ struct socfpga_pll *pll_clk;
-+ const char *clk_name = node->name;
-+ const char *parent_name[SOCFGPA_MAX_PARENTS];
-+ struct clk_init_data init;
-+ struct device_node *clkmgr_np;
-+ int rc;
-+ int i = 0;
-+
-+ of_property_read_u32(node, "reg", &reg);
-+
-+ pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL);
-+ if (WARN_ON(!pll_clk))
-+ return NULL;
-+
-+ clkmgr_np = of_find_compatible_node(NULL, NULL, "altr,clk-mgr");
-+ clk_mgr_a10_base_addr = of_iomap(clkmgr_np, 0);
-+ BUG_ON(!clk_mgr_a10_base_addr);
-+ pll_clk->hw.reg = clk_mgr_a10_base_addr + reg;
-+
-+ of_property_read_string(node, "clock-output-names", &clk_name);
-+
-+ init.name = clk_name;
-+ init.ops = ops;
-+ init.flags = 0;
-+
-+ while (i < SOCFGPA_MAX_PARENTS && (parent_name[i] =
-+ of_clk_get_parent_name(node, i)) != NULL)
-+ i++;
-+ init.num_parents = i;
-+ init.parent_names = parent_name;
-+ pll_clk->hw.hw.init = &init;
-+
-+ pll_clk->hw.bit_idx = SOCFPGA_PLL_EXT_ENA;
-+ clk_pll_ops.enable = clk_gate_ops.enable;
-+ clk_pll_ops.disable = clk_gate_ops.disable;
-+
-+ clk = clk_register(NULL, &pll_clk->hw.hw);
-+ if (WARN_ON(IS_ERR(clk))) {
-+ kfree(pll_clk);
-+ return NULL;
-+ }
-+ rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
-+ return clk;
-+}
-+
-+void __init socfpga_a10_pll_init(struct device_node *node)
-+{
-+ __socfpga_pll_init(node, &clk_pll_ops);
-+}
-diff --git a/drivers/clk/socfpga/clk.c b/drivers/clk/socfpga/clk.c
-index 43db947e5f0e..7564d2e35f32 100644
---- a/drivers/clk/socfpga/clk.c
-+++ b/drivers/clk/socfpga/clk.c
-@@ -24,4 +24,9 @@
- CLK_OF_DECLARE(socfpga_pll_clk, "altr,socfpga-pll-clock", socfpga_pll_init);
- CLK_OF_DECLARE(socfpga_perip_clk, "altr,socfpga-perip-clk", socfpga_periph_init);
- CLK_OF_DECLARE(socfpga_gate_clk, "altr,socfpga-gate-clk", socfpga_gate_init);
--
-+CLK_OF_DECLARE(socfpga_a10_pll_clk, "altr,socfpga-a10-pll-clock",
-+ socfpga_a10_pll_init);
-+CLK_OF_DECLARE(socfpga_a10_perip_clk, "altr,socfpga-a10-perip-clk",
-+ socfpga_a10_periph_init);
-+CLK_OF_DECLARE(socfpga_a10_gate_clk, "altr,socfpga-a10-gate-clk",
-+ socfpga_a10_gate_init);
-diff --git a/drivers/clk/socfpga/clk.h b/drivers/clk/socfpga/clk.h
-index b09a5d50547e..603973ab7e29 100644
---- a/drivers/clk/socfpga/clk.h
-+++ b/drivers/clk/socfpga/clk.h
-@@ -34,10 +34,14 @@
- ((((smplsel) & 0x7) << 3) | (((drvsel) & 0x7) << 0))
-
- extern void __iomem *clk_mgr_base_addr;
-+extern void __iomem *clk_mgr_a10_base_addr;
-
- void __init socfpga_pll_init(struct device_node *node);
- void __init socfpga_periph_init(struct device_node *node);
- void __init socfpga_gate_init(struct device_node *node);
-+void socfpga_a10_pll_init(struct device_node *node);
-+void socfpga_a10_periph_init(struct device_node *node);
-+void socfpga_a10_gate_init(struct device_node *node);
-
- struct socfpga_pll {
- struct clk_gate hw;
-@@ -48,6 +52,7 @@ struct socfpga_gate_clk {
- char *parent_name;
- u32 fixed_div;
- void __iomem *div_reg;
-+ struct regmap *sys_mgr_base_addr;
- u32 width; /* only valid if div_reg != 0 */
- u32 shift; /* only valid if div_reg != 0 */
- u32 clk_phase[2];
---
-2.6.2
-
diff --git a/patches.altera/0015-ARM-socfpga-dts-add-the-a9-scu-node-for-arria10.patch b/patches.altera/0015-ARM-socfpga-dts-add-the-a9-scu-node-for-arria10.patch
deleted file mode 100644
index 4e4ff2c381bbf9..00000000000000
--- a/patches.altera/0015-ARM-socfpga-dts-add-the-a9-scu-node-for-arria10.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 88e0b84faef41aaa768e9b2266b8b556b08343fa Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Thu, 14 May 2015 09:49:14 -0500
-Subject: [PATCH 15/39] ARM: socfpga: dts: add the a9-scu node for arria10
-
-Add a dts node for the A9 SCU on the Arria10 platform.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 479f8df04c4b7b1dd53b8c2e5b157b678c8a319c)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga_arria10.dtsi | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index abf97630c592..d025f77b11f2 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -567,6 +567,11 @@
- reg = <0xffd05000 0x100>;
- };
-
-+ scu: snoop-control-unit@ffffc000 {
-+ compatible = "arm,cortex-a9-scu";
-+ reg = <0xffffc000 0x100>;
-+ };
-+
- sysmgr: sysmgr@ffd06000 {
- compatible = "altr,sys-mgr", "syscon";
- reg = <0xffd06000 0x300>;
---
-2.6.2
-
diff --git a/patches.altera/0016-ARM-socfpga-dts-add-enable-method-property-for-cpu-n.patch b/patches.altera/0016-ARM-socfpga-dts-add-enable-method-property-for-cpu-n.patch
deleted file mode 100644
index c12f1e4f34720c..00000000000000
--- a/patches.altera/0016-ARM-socfpga-dts-add-enable-method-property-for-cpu-n.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From e4d54548768143ed7840e75dbf3dc51883d3d89c Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 22 May 2015 23:00:10 -0500
-Subject: [PATCH 16/39] ARM: socfpga: dts: add enable-method property for cpu
- nodes
-
-Add the enable-method property for the cpu node on socfpga.dtsi and
-socfpga_arria10.dtsi. This is for CPU_METHOD_OF_DECLARE to use to enable
-the secondary core.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit ebbce1bbc4f25c0ca68f66df54ea5e8eefa90da5)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga.dtsi | 1 +
- arch/arm/boot/dts/socfpga_arria10.dtsi | 1 +
- 2 files changed, 2 insertions(+)
-
-diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
-index 9b653edd003f..80f924deed37 100644
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -36,6 +36,7 @@
- cpus {
- #address-cells = <1>;
- #size-cells = <0>;
-+ enable-method = "altr,socfpga-smp";
-
- cpu@0 {
- compatible = "arm,cortex-a9";
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index d025f77b11f2..6ceb26e542ec 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -24,6 +24,7 @@
- cpus {
- #address-cells = <1>;
- #size-cells = <0>;
-+ enable-method = "altr,socfpga-a10-smp";
-
- cpu@0 {
- compatible = "arm,cortex-a9";
---
-2.6.2
-
diff --git a/patches.altera/0017-clk-of-helper-for-filling-parent-clock-array-and-ret.patch b/patches.altera/0017-clk-of-helper-for-filling-parent-clock-array-and-ret.patch
deleted file mode 100644
index c635a754a2f4bd..00000000000000
--- a/patches.altera/0017-clk-of-helper-for-filling-parent-clock-array-and-ret.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 7d45a8582944d287a796ae846e88d41d5e3f02e1 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 5 Jun 2015 11:26:13 -0500
-Subject: [PATCH 17/39] clk: of: helper for filling parent clock array and
- return num of parents
-
-Sprinkled all through the platform clock drivers are code like this to
-fill the clock parent array:
-
-for (i = 0; i < num_parents; ++i)
- parent_names[i] = of_clk_get_parent_name(np, i);
-
-The of_clk_parent_fill() will do the same as the code above, and while
-at it, return the number of parents as well since the logic of the
-function is to the walk the clock node to look for the parent.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-[sboyd@codeaurora.org: Fixed kernel-doc]
-Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-(cherry picked from commit 2e61dfb3602b904966491f260f62c01b9895936a)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/clk/clk.c | 21 +++++++++++++++++++++
- include/linux/clk-provider.h | 2 ++
- 2 files changed, 23 insertions(+)
-
-diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
-index 9f9cadd00bc8..80f3f38a2575 100644
---- a/drivers/clk/clk.c
-+++ b/drivers/clk/clk.c
-@@ -3069,6 +3069,27 @@ const char *of_clk_get_parent_name(struct device_node *np, int index)
- }
- EXPORT_SYMBOL_GPL(of_clk_get_parent_name);
-
-+/**
-+ * of_clk_parent_fill() - Fill @parents with names of @np's parents and return
-+ * number of parents
-+ * @np: Device node pointer associated with clock provider
-+ * @parents: pointer to char array that hold the parents' names
-+ * @size: size of the @parents array
-+ *
-+ * Return: number of parents for the clock node.
-+ */
-+int of_clk_parent_fill(struct device_node *np, const char **parents,
-+ unsigned int size)
-+{
-+ unsigned int i = 0;
-+
-+ while (i < size && (parents[i] = of_clk_get_parent_name(np, i)) != NULL)
-+ i++;
-+
-+ return i;
-+}
-+EXPORT_SYMBOL_GPL(of_clk_parent_fill);
-+
- struct clock_provider {
- of_clk_init_cb_t clk_init_cb;
- struct device_node *np;
-diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
-index df695313f975..6068df19d08a 100644
---- a/include/linux/clk-provider.h
-+++ b/include/linux/clk-provider.h
-@@ -624,6 +624,8 @@ struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
- void *data);
- struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
- int of_clk_get_parent_count(struct device_node *np);
-+int of_clk_parent_fill(struct device_node *np, const char **parents,
-+ unsigned int size);
- const char *of_clk_get_parent_name(struct device_node *np, int index);
-
- void of_clk_init(const struct of_device_id *matches);
---
-2.6.2
-
diff --git a/patches.altera/0018-clk-socfpga-make-use-of-of_clk_parent_fill-helper-fu.patch b/patches.altera/0018-clk-socfpga-make-use-of-of_clk_parent_fill-helper-fu.patch
deleted file mode 100644
index d60f03010d7a98..00000000000000
--- a/patches.altera/0018-clk-socfpga-make-use-of-of_clk_parent_fill-helper-fu.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 8affc952ff5eefdab643797d064f4557cc7ffb09 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 5 Jun 2015 11:26:14 -0500
-Subject: [PATCH 18/39] clk: socfpga: make use of of_clk_parent_fill helper
- function
-
-Use of_clk_parent_fill to fill in the parent clock's array.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-(cherry picked from commit 761d3e328c503c8428cec54e33196e49f5c46e55)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/clk/socfpga/clk-gate.c | 6 +-----
- drivers/clk/socfpga/clk-pll.c | 7 +------
- 2 files changed, 2 insertions(+), 11 deletions(-)
-
-diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c
-index 607ab352f73c..b37f6c2fdd3b 100644
---- a/drivers/clk/socfpga/clk-gate.c
-+++ b/drivers/clk/socfpga/clk-gate.c
-@@ -190,7 +190,6 @@ static void __init __socfpga_gate_init(struct device_node *node,
- const char *parent_name[SOCFPGA_MAX_PARENTS];
- struct clk_init_data init;
- int rc;
-- int i = 0;
-
- socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL);
- if (WARN_ON(!socfpga_clk))
-@@ -234,12 +233,9 @@ static void __init __socfpga_gate_init(struct device_node *node,
- init.name = clk_name;
- init.ops = ops;
- init.flags = 0;
-- while (i < SOCFPGA_MAX_PARENTS && (parent_name[i] =
-- of_clk_get_parent_name(node, i)) != NULL)
-- i++;
-
-+ init.num_parents = of_clk_parent_fill(node, parent_name, SOCFPGA_MAX_PARENTS);
- init.parent_names = parent_name;
-- init.num_parents = i;
- socfpga_clk->hw.hw.init = &init;
-
- clk = clk_register(NULL, &socfpga_clk->hw.hw);
-diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c
-index de6da957a09d..8f26b5234947 100644
---- a/drivers/clk/socfpga/clk-pll.c
-+++ b/drivers/clk/socfpga/clk-pll.c
-@@ -92,7 +92,6 @@ static __init struct clk *__socfpga_pll_init(struct device_node *node,
- struct clk_init_data init;
- struct device_node *clkmgr_np;
- int rc;
-- int i = 0;
-
- of_property_read_u32(node, "reg", &reg);
-
-@@ -111,11 +110,7 @@ static __init struct clk *__socfpga_pll_init(struct device_node *node,
- init.ops = ops;
- init.flags = 0;
-
-- while (i < SOCFPGA_MAX_PARENTS && (parent_name[i] =
-- of_clk_get_parent_name(node, i)) != NULL)
-- i++;
--
-- init.num_parents = i;
-+ init.num_parents = of_clk_parent_fill(node, parent_name, SOCFPGA_MAX_PARENTS);
- init.parent_names = parent_name;
- pll_clk->hw.hw.init = &init;
-
---
-2.6.2
-
diff --git a/patches.altera/0019-ARM-socfpga-use-CPU_METHOD_OF_DECLARE-for-socfpga_cy.patch b/patches.altera/0019-ARM-socfpga-use-CPU_METHOD_OF_DECLARE-for-socfpga_cy.patch
deleted file mode 100644
index 290e3bfd5f5f65..00000000000000
--- a/patches.altera/0019-ARM-socfpga-use-CPU_METHOD_OF_DECLARE-for-socfpga_cy.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 1fae7a42aeedf37fb99d9757afce4a080bbcae68 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Tue, 2 Jun 2015 21:14:01 -0500
-Subject: [PATCH 19/39] ARM: socfpga: use CPU_METHOD_OF_DECLARE for
- socfpga_cyclone5
-
-Convert cyclone5/arria5 to use CPU_METHOD_OF_DECLARE for smp operations.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-Signed-off-by: Kevin Hilman <khilman@linaro.org>
-(cherry picked from commit 5f763ef80d4dff7f2aa519a31472b03499e2c2e1)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/mach-socfpga/core.h | 1 -
- arch/arm/mach-socfpga/platsmp.c | 4 +++-
- arch/arm/mach-socfpga/socfpga.c | 1 -
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
---- a/arch/arm/mach-socfpga/core.h
-+++ b/arch/arm/mach-socfpga/core.h
-@@ -37,7 +37,6 @@ extern void socfpga_sysmgr_init(void);
- extern void __iomem *sys_manager_base_addr;
- extern void __iomem *rst_manager_base_addr;
-
--extern struct smp_operations socfpga_smp_ops;
- extern char secondary_trampoline, secondary_trampoline_end;
-
- extern unsigned long socfpga_cpu1start_addr;
---- a/arch/arm/mach-socfpga/platsmp.c
-+++ b/arch/arm/mach-socfpga/platsmp.c
-@@ -83,10 +83,12 @@ static void socfpga_cpu_die(unsigned int
- cpu_do_idle();
- }
-
--struct smp_operations socfpga_smp_ops __initdata = {
-+static struct smp_operations socfpga_smp_ops __initdata = {
- .smp_prepare_cpus = socfpga_smp_prepare_cpus,
- .smp_boot_secondary = socfpga_boot_secondary,
- #ifdef CONFIG_HOTPLUG_CPU
- .cpu_die = socfpga_cpu_die,
- #endif
- };
-+
-+CPU_METHOD_OF_DECLARE(socfpga_smp, "altr,socfpga-smp", &socfpga_smp_ops);
---- a/arch/arm/mach-socfpga/socfpga.c
-+++ b/arch/arm/mach-socfpga/socfpga.c
-@@ -78,7 +78,6 @@ static const char *altera_dt_match[] = {
- DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
- .l2c_aux_val = 0,
- .l2c_aux_mask = ~0,
-- .smp = smp_ops(socfpga_smp_ops),
- .init_irq = socfpga_init_irq,
- .restart = socfpga_cyclone5_restart,
- .dt_compat = altera_dt_match,
diff --git a/patches.altera/0020-ARM-socfpga-add-CPU_METHOD_OF_DECLARE-for-Arria-10.patch b/patches.altera/0020-ARM-socfpga-add-CPU_METHOD_OF_DECLARE-for-Arria-10.patch
deleted file mode 100644
index 03e89bdbf7ba8b..00000000000000
--- a/patches.altera/0020-ARM-socfpga-add-CPU_METHOD_OF_DECLARE-for-Arria-10.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-From 24384bf8330823848560ee48ff30d2c6882a6284 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Tue, 2 Jun 2015 21:14:02 -0500
-Subject: [PATCH 20/39] ARM: socfpga: add CPU_METHOD_OF_DECLARE for Arria 10
-
-Add boot_secondary implementation for the Arria10 platform. Bringing up
-the secondary core on the Arria 10 platform is pretty similar to the
-Cyclone/Arria 5 platform, with the exception of the following differences:
-
-- Register offset to bringup CPU1 out of reset is different.
-- The cpu1-start-addr for Arria10 contains an additional nibble.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-Signed-off-by: Kevin Hilman <khilman@linaro.org>
-(cherry picked from commit 45be0cdb5323d6f2b4005a4d9263a72eac2040cd)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/mach-socfpga/core.h | 2 ++
- arch/arm/mach-socfpga/platsmp.c | 32 ++++++++++++++++++++++++++++++++
- 2 files changed, 34 insertions(+)
-
-diff --git a/arch/arm/mach-socfpga/core.h b/arch/arm/mach-socfpga/core.h
-index 38e5cbf37f45..27e7c65093c0 100644
---- a/arch/arm/mach-socfpga/core.h
-+++ b/arch/arm/mach-socfpga/core.h
-@@ -25,6 +25,8 @@
- #define SOCFPGA_RSTMGR_MODPERRST 0x14
- #define SOCFPGA_RSTMGR_BRGMODRST 0x1c
-
-+#define SOCFPGA_A10_RSTMGR_MODMPURST 0x20
-+
- /* System Manager bits */
- #define RSTMGR_CTRL_SWCOLDRSTREQ 0x1 /* Cold Reset */
- #define RSTMGR_CTRL_SWWARMRSTREQ 0x2 /* Warm Reset */
-diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
-index b84c1a12d3ae..5454e9ce31ea 100644
---- a/arch/arm/mach-socfpga/platsmp.c
-+++ b/arch/arm/mach-socfpga/platsmp.c
-@@ -54,6 +54,29 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
- return 0;
- }
-
-+static int socfpga_a10_boot_secondary(unsigned int cpu, struct task_struct *idle)
-+{
-+ int trampoline_size = &secondary_trampoline_end - &secondary_trampoline;
-+
-+ if (socfpga_cpu1start_addr) {
-+ writel(RSTMGR_MPUMODRST_CPU1, rst_manager_base_addr +
-+ SOCFPGA_A10_RSTMGR_MODMPURST);
-+ memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
-+
-+ writel(virt_to_phys(socfpga_secondary_startup),
-+ sys_manager_base_addr + (socfpga_cpu1start_addr & 0x00000fff));
-+
-+ flush_cache_all();
-+ smp_wmb();
-+ outer_clean_range(0, trampoline_size);
-+
-+ /* This will release CPU #1 out of reset. */
-+ writel(0, rst_manager_base_addr + SOCFPGA_A10_RSTMGR_MODMPURST);
-+ }
-+
-+ return 0;
-+}
-+
- static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
- {
- struct device_node *np;
-@@ -91,4 +114,13 @@ static struct smp_operations socfpga_smp_ops __initdata = {
- #endif
- };
-
-+static struct smp_operations socfpga_a10_smp_ops __initdata = {
-+ .smp_prepare_cpus = socfpga_smp_prepare_cpus,
-+ .smp_boot_secondary = socfpga_a10_boot_secondary,
-+#ifdef CONFIG_HOTPLUG_CPU
-+ .cpu_die = socfpga_cpu_die,
-+#endif
-+};
-+
- CPU_METHOD_OF_DECLARE(socfpga_smp, "altr,socfpga-smp", &socfpga_smp_ops);
-+CPU_METHOD_OF_DECLARE(socfpga_a10_smp, "altr,socfpga-a10-smp", &socfpga_a10_smp_ops);
---
-2.6.2
-
diff --git a/patches.altera/0021-ARM-socfpga-dts-enable-ethernet-for-Arria10-devkit.patch b/patches.altera/0021-ARM-socfpga-dts-enable-ethernet-for-Arria10-devkit.patch
deleted file mode 100644
index cc2023bd3f835a..00000000000000
--- a/patches.altera/0021-ARM-socfpga-dts-enable-ethernet-for-Arria10-devkit.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-From 0599bf4506bc1d87a15e5883a86bb3dc8750a67a Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Tue, 2 Jun 2015 21:31:00 -0500
-Subject: [PATCH 21/39] ARM: socfpga: dts: enable ethernet for Arria10 devkit
-
-Update the arria10 gmac nodes with all the necessary properties for ethernet
-to function on the Arria10 devkit.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-Signed-off-by: Kevin Hilman <khilman@linaro.org>
-(cherry picked from commit 112cadfd4365b1949c7f13a2616f6b99990f5fd5)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga_arria10.dtsi | 11 +++++++++++
- arch/arm/boot/dts/socfpga_arria10_socdk.dtsi | 28 ++++++++++++++++++++++++++++
- 2 files changed, 39 insertions(+)
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index 6ceb26e542ec..f5bebdd6d1be 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -397,6 +397,7 @@
-
- gmac0: ethernet@ff800000 {
- compatible = "altr,socfpga-stmmac", "snps,dwmac-3.72a", "snps,dwmac";
-+ altr,sysmgr-syscon = <&sysmgr 0x44 0>;
- reg = <0xff800000 0x2000>;
- interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "macirq";
-@@ -404,11 +405,16 @@
- mac-address = [00 00 00 00 00 00];
- snps,multicast-filter-bins = <256>;
- snps,perfect-filter-entries = <128>;
-+ tx-fifo-depth = <4096>;
-+ rx-fifo-depth = <16384>;
-+ clocks = <&l4_mp_clk>;
-+ clock-names = "stmmaceth";
- status = "disabled";
- };
-
- gmac1: ethernet@ff802000 {
- compatible = "altr,socfpga-stmmac", "snps,dwmac-3.72a", "snps,dwmac";
-+ altr,sysmgr-syscon = <&sysmgr 0x48 0>;
- reg = <0xff802000 0x2000>;
- interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "macirq";
-@@ -418,11 +424,14 @@
- snps,perfect-filter-entries = <128>;
- tx-fifo-depth = <4096>;
- rx-fifo-depth = <16384>;
-+ clocks = <&l4_mp_clk>;
-+ clock-names = "stmmaceth";
- status = "disabled";
- };
-
- gmac2: ethernet@ff804000 {
- compatible = "altr,socfpga-stmmac", "snps,dwmac-3.72a", "snps,dwmac";
-+ altr,sysmgr-syscon = <&sysmgr 0x4C 0>;
- reg = <0xff804000 0x2000>;
- interrupts = <0 94 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "macirq";
-@@ -432,6 +441,8 @@
- snps,perfect-filter-entries = <128>;
- tx-fifo-depth = <4096>;
- rx-fifo-depth = <16384>;
-+ clocks = <&l4_mp_clk>;
-+ clock-names = "stmmaceth";
- status = "disabled";
- };
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10_socdk.dtsi b/arch/arm/boot/dts/socfpga_arria10_socdk.dtsi
-index 347ca4ef58f8..94a0709b2fe6 100644
---- a/arch/arm/boot/dts/socfpga_arria10_socdk.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10_socdk.dtsi
-@@ -41,6 +41,34 @@
- };
- };
-
-+&gmac0 {
-+ phy-mode = "rgmii";
-+ phy-addr = <0xffffffff>; /* probe for phy addr */
-+
-+ /*
-+ * These skews assume the user's FPGA design is adding 600ps of delay
-+ * for TX_CLK on Arria 10.
-+ *
-+ * All skews are offset since hardware skew values for the ksz9031
-+ * range from a negative skew to a positive skew.
-+ * See the micrel-ksz90x1.txt Documentation file for details.
-+ */
-+ txd0-skew-ps = <0>; /* -420ps */
-+ txd1-skew-ps = <0>; /* -420ps */
-+ txd2-skew-ps = <0>; /* -420ps */
-+ txd3-skew-ps = <0>; /* -420ps */
-+ rxd0-skew-ps = <420>; /* 0ps */
-+ rxd1-skew-ps = <420>; /* 0ps */
-+ rxd2-skew-ps = <420>; /* 0ps */
-+ rxd3-skew-ps = <420>; /* 0ps */
-+ txen-skew-ps = <0>; /* -420ps */
-+ txc-skew-ps = <1860>; /* 960ps */
-+ rxdv-skew-ps = <420>; /* 0ps */
-+ rxc-skew-ps = <1680>; /* 780ps */
-+ max-frame-size = <3800>;
-+ status = "okay";
-+};
-+
- &uart1 {
- status = "okay";
- };
---
-2.6.2
-
diff --git a/patches.altera/0022-ARM-socfpga-support-suspend-to-ram.patch b/patches.altera/0022-ARM-socfpga-support-suspend-to-ram.patch
deleted file mode 100644
index 509f3d165b377f..00000000000000
--- a/patches.altera/0022-ARM-socfpga-support-suspend-to-ram.patch
+++ /dev/null
@@ -1,400 +0,0 @@
-From f37a045095f3b8dad974826d4ca38b1c54e4bd0f Mon Sep 17 00:00:00 2001
-From: Alan Tull <atull@opensource.altera.com>
-Date: Fri, 5 Jun 2015 08:24:52 -0500
-Subject: [PATCH 22/39] ARM: socfpga: support suspend to ram
-
-Add code that requests that the sdr controller go into
-self-refresh mode. This code is run from ocram.
-
-Suspend-to-RAM and EDAC support are mutually exclusive on
-SOCFPGA. If the EDAC is enabled, it will prevent the
-platform from going into suspend.
-
-Example of how to request to suspend to ram:
- $ echo enabled > \
-/sys/devices/soc/ffc02000.serial0/tty/ttyS0/power/wakeup
-
- $ echo -n mem > /sys/power/state
-
-Signed-off-by: Alan Tull <atull@opensource.altera.com>
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-Signed-off-by: Kevin Hilman <khilman@linaro.org>
-(cherry picked from commit 44fd8c7d4005f660f48679439f0a54225ba234a4)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/mach-socfpga/Kconfig | 10 ++
- arch/arm/mach-socfpga/Makefile | 1
- arch/arm/mach-socfpga/core.h | 6 +
- arch/arm/mach-socfpga/pm.c | 149 +++++++++++++++++++++++++++++++++++
- arch/arm/mach-socfpga/self-refresh.S | 136 +++++++++++++++++++++++++++++++
- arch/arm/mach-socfpga/socfpga.c | 6 +
- 6 files changed, 305 insertions(+), 3 deletions(-)
- create mode 100644 arch/arm/mach-socfpga/pm.c
- create mode 100644 arch/arm/mach-socfpga/self-refresh.S
-
---- a/arch/arm/mach-socfpga/Kconfig
-+++ b/arch/arm/mach-socfpga/Kconfig
-@@ -1,4 +1,4 @@
--config ARCH_SOCFPGA
-+menuconfig ARCH_SOCFPGA
- bool "Altera SOCFPGA family" if ARCH_MULTI_V7
- select ARM_AMBA
- select ARM_GIC
-@@ -8,3 +8,11 @@ config ARCH_SOCFPGA
- select HAVE_ARM_SCU
- select HAVE_ARM_TWD if SMP
- select MFD_SYSCON
-+
-+if ARCH_SOCFPGA
-+config SOCFPGA_SUSPEND
-+ bool "Suspend to RAM on SOCFPGA"
-+ help
-+ Select this if you want to enable Suspend-to-RAM on SOCFPGA
-+ platforms.
-+endif
---- a/arch/arm/mach-socfpga/Makefile
-+++ b/arch/arm/mach-socfpga/Makefile
-@@ -4,3 +4,4 @@
-
- obj-y := socfpga.o
- obj-$(CONFIG_SMP) += headsmp.o platsmp.o
-+obj-$(CONFIG_SOCFPGA_SUSPEND) += pm.o self-refresh.o
---- a/arch/arm/mach-socfpga/core.h
-+++ b/arch/arm/mach-socfpga/core.h
-@@ -1,6 +1,6 @@
- /*
- * Copyright 2012 Pavel Machek <pavel@denx.de>
-- * Copyright (C) 2012 Altera Corporation
-+ * Copyright (C) 2012-2015 Altera Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -38,6 +38,10 @@ extern void socfpga_sysmgr_init(void);
-
- extern void __iomem *sys_manager_base_addr;
- extern void __iomem *rst_manager_base_addr;
-+extern void __iomem *sdr_ctl_base_addr;
-+
-+u32 socfpga_sdram_self_refresh(u32 sdr_base);
-+extern unsigned int socfpga_sdram_self_refresh_sz;
-
- extern char secondary_trampoline, secondary_trampoline_end;
-
---- /dev/null
-+++ b/arch/arm/mach-socfpga/pm.c
-@@ -0,0 +1,149 @@
-+/*
-+ * arch/arm/mach-socfpga/pm.c
-+ *
-+ * Copyright (C) 2014-2015 Altera Corporation. All rights reserved.
-+ *
-+ * with code from pm-imx6.c
-+ * Copyright 2011-2014 Freescale Semiconductor, Inc.
-+ * Copyright 2011 Linaro Ltd.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+#include <linux/bitops.h>
-+#include <linux/genalloc.h>
-+#include <linux/init.h>
-+#include <linux/io.h>
-+#include <linux/of_platform.h>
-+#include <linux/suspend.h>
-+#include <asm/suspend.h>
-+#include <asm/fncpy.h>
-+#include "core.h"
-+
-+/* Pointer to function copied to ocram */
-+static u32 (*socfpga_sdram_self_refresh_in_ocram)(u32 sdr_base);
-+
-+static int socfpga_setup_ocram_self_refresh(void)
-+{
-+ struct platform_device *pdev;
-+ phys_addr_t ocram_pbase;
-+ struct device_node *np;
-+ struct gen_pool *ocram_pool;
-+ unsigned long ocram_base;
-+ void __iomem *suspend_ocram_base;
-+ int ret = 0;
-+
-+ np = of_find_compatible_node(NULL, NULL, "mmio-sram");
-+ if (!np) {
-+ pr_err("%s: Unable to find mmio-sram in dtb\n", __func__);
-+ return -ENODEV;
-+ }
-+
-+ pdev = of_find_device_by_node(np);
-+ if (!pdev) {
-+ pr_warn("%s: failed to find ocram device!\n", __func__);
-+ ret = -ENODEV;
-+ goto put_node;
-+ }
-+
-+ ocram_pool = dev_get_gen_pool(&pdev->dev);
-+ if (!ocram_pool) {
-+ pr_warn("%s: ocram pool unavailable!\n", __func__);
-+ ret = -ENODEV;
-+ goto put_node;
-+ }
-+
-+ ocram_base = gen_pool_alloc(ocram_pool, socfpga_sdram_self_refresh_sz);
-+ if (!ocram_base) {
-+ pr_warn("%s: unable to alloc ocram!\n", __func__);
-+ ret = -ENOMEM;
-+ goto put_node;
-+ }
-+
-+ ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base);
-+
-+ suspend_ocram_base = __arm_ioremap_exec(ocram_pbase,
-+ socfpga_sdram_self_refresh_sz,
-+ false);
-+ if (!suspend_ocram_base) {
-+ pr_warn("%s: __arm_ioremap_exec failed!\n", __func__);
-+ ret = -ENOMEM;
-+ goto put_node;
-+ }
-+
-+ /* Copy the code that puts DDR in self refresh to ocram */
-+ socfpga_sdram_self_refresh_in_ocram =
-+ (void *)fncpy(suspend_ocram_base,
-+ &socfpga_sdram_self_refresh,
-+ socfpga_sdram_self_refresh_sz);
-+
-+ WARN(!socfpga_sdram_self_refresh_in_ocram,
-+ "could not copy function to ocram");
-+ if (!socfpga_sdram_self_refresh_in_ocram)
-+ ret = -EFAULT;
-+
-+put_node:
-+ of_node_put(np);
-+
-+ return ret;
-+}
-+
-+static int socfpga_pm_suspend(unsigned long arg)
-+{
-+ u32 ret;
-+
-+ if (!sdr_ctl_base_addr)
-+ return -EFAULT;
-+
-+ ret = socfpga_sdram_self_refresh_in_ocram((u32)sdr_ctl_base_addr);
-+
-+ pr_debug("%s self-refresh loops request=%d exit=%d\n", __func__,
-+ ret & 0xffff, (ret >> 16) & 0xffff);
-+
-+ return 0;
-+}
-+
-+static int socfpga_pm_enter(suspend_state_t state)
-+{
-+ switch (state) {
-+ case PM_SUSPEND_STANDBY:
-+ case PM_SUSPEND_MEM:
-+ outer_disable();
-+ cpu_suspend(0, socfpga_pm_suspend);
-+ outer_resume();
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+ return 0;
-+}
-+
-+static const struct platform_suspend_ops socfpga_pm_ops = {
-+ .valid = suspend_valid_only_mem,
-+ .enter = socfpga_pm_enter,
-+};
-+
-+static int __init socfpga_pm_init(void)
-+{
-+ int ret;
-+
-+ ret = socfpga_setup_ocram_self_refresh();
-+ if (ret)
-+ return ret;
-+
-+ suspend_set_ops(&socfpga_pm_ops);
-+ pr_info("SoCFPGA initialized for DDR self-refresh during suspend.\n");
-+
-+ return 0;
-+}
-+arch_initcall(socfpga_pm_init);
---- /dev/null
-+++ b/arch/arm/mach-socfpga/self-refresh.S
-@@ -0,0 +1,136 @@
-+/*
-+ * Copyright (C) 2014-2015 Altera Corporation. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+#include <linux/linkage.h>
-+#include <asm/assembler.h>
-+
-+#define MAX_LOOP_COUNT 1000
-+
-+/* Register offset */
-+#define SDR_CTRLGRP_LOWPWREQ_ADDR 0x54
-+#define SDR_CTRLGRP_LOWPWRACK_ADDR 0x58
-+
-+/* Bitfield positions */
-+#define SELFRSHREQ_POS 3
-+#define SELFRSHREQ_MASK 0x8
-+
-+#define SELFRFSHACK_POS 1
-+#define SELFRFSHACK_MASK 0x2
-+
-+ /*
-+ * This code assumes that when the bootloader configured
-+ * the sdram controller for the DDR on the board it
-+ * configured the following fields depending on the DDR
-+ * vendor/configuration:
-+ *
-+ * sdr.ctrlcfg.lowpwreq.selfrfshmask
-+ * sdr.ctrlcfg.lowpwrtiming.clkdisablecycles
-+ * sdr.ctrlcfg.dramtiming4.selfrfshexit
-+ */
-+
-+ .arch armv7-a
-+ .text
-+ .align 3
-+
-+ /*
-+ * socfpga_sdram_self_refresh
-+ *
-+ * r0 : sdr_ctl_base_addr
-+ * r1 : temp storage of return value
-+ * r2 : temp storage of register values
-+ * r3 : loop counter
-+ *
-+ * return value: lower 16 bits: loop count going into self refresh
-+ * upper 16 bits: loop count exiting self refresh
-+ */
-+ENTRY(socfpga_sdram_self_refresh)
-+ /* Enable dynamic clock gating in the Power Control Register. */
-+ mrc p15, 0, r2, c15, c0, 0
-+ orr r2, r2, #1
-+ mcr p15, 0, r2, c15, c0, 0
-+
-+ /* Enable self refresh: set sdr.ctrlgrp.lowpwreq.selfrshreq = 1 */
-+ ldr r2, [r0, #SDR_CTRLGRP_LOWPWREQ_ADDR]
-+ orr r2, r2, #SELFRSHREQ_MASK
-+ str r2, [r0, #SDR_CTRLGRP_LOWPWREQ_ADDR]
-+
-+ /* Poll until sdr.ctrlgrp.lowpwrack.selfrfshack == 1 or hit max loops */
-+ mov r3, #0
-+while_ack_0:
-+ ldr r2, [r0, #SDR_CTRLGRP_LOWPWRACK_ADDR]
-+ and r2, r2, #SELFRFSHACK_MASK
-+ cmp r2, #SELFRFSHACK_MASK
-+ beq ack_1
-+
-+ add r3, #1
-+ cmp r3, #MAX_LOOP_COUNT
-+ bne while_ack_0
-+
-+ack_1:
-+ mov r1, r3
-+
-+ /*
-+ * Execute an ISB instruction to ensure that all of the
-+ * CP15 register changes have been committed.
-+ */
-+ isb
-+
-+ /*
-+ * Execute a barrier instruction to ensure that all cache,
-+ * TLB and branch predictor maintenance operations issued
-+ * by any CPU in the cluster have completed.
-+ */
-+ dsb
-+ dmb
-+
-+ wfi
-+
-+ /* Disable self-refresh: set sdr.ctrlgrp.lowpwreq.selfrshreq = 0 */
-+ ldr r2, [r0, #SDR_CTRLGRP_LOWPWREQ_ADDR]
-+ bic r2, r2, #SELFRSHREQ_MASK
-+ str r2, [r0, #SDR_CTRLGRP_LOWPWREQ_ADDR]
-+
-+ /* Poll until sdr.ctrlgrp.lowpwrack.selfrfshack == 0 or hit max loops */
-+ mov r3, #0
-+while_ack_1:
-+ ldr r2, [r0, #SDR_CTRLGRP_LOWPWRACK_ADDR]
-+ and r2, r2, #SELFRFSHACK_MASK
-+ cmp r2, #SELFRFSHACK_MASK
-+ bne ack_0
-+
-+ add r3, #1
-+ cmp r3, #MAX_LOOP_COUNT
-+ bne while_ack_1
-+
-+ack_0:
-+ /*
-+ * Prepare return value:
-+ * Shift loop count for exiting self refresh into upper 16 bits.
-+ * Leave loop count for requesting self refresh in lower 16 bits.
-+ */
-+ mov r3, r3, lsl #16
-+ add r1, r1, r3
-+
-+ /* Disable dynamic clock gating in the Power Control Register. */
-+ mrc p15, 0, r2, c15, c0, 0
-+ bic r2, r2, #1
-+ mcr p15, 0, r2, c15, c0, 0
-+
-+ mov r0, r1 @ return value
-+ bx lr @ return
-+
-+ENDPROC(socfpga_sdram_self_refresh)
-+ENTRY(socfpga_sdram_self_refresh_sz)
-+ .word . - socfpga_sdram_self_refresh
---- a/arch/arm/mach-socfpga/socfpga.c
-+++ b/arch/arm/mach-socfpga/socfpga.c
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (C) 2012 Altera Corporation
-+ * Copyright (C) 2012-2015 Altera Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
-@@ -29,6 +29,7 @@
-
- void __iomem *sys_manager_base_addr;
- void __iomem *rst_manager_base_addr;
-+void __iomem *sdr_ctl_base_addr;
- unsigned long socfpga_cpu1start_addr;
-
- void __init socfpga_sysmgr_init(void)
-@@ -49,6 +50,9 @@ void __init socfpga_sysmgr_init(void)
-
- np = of_find_compatible_node(NULL, NULL, "altr,rst-mgr");
- rst_manager_base_addr = of_iomap(np, 0);
-+
-+ np = of_find_compatible_node(NULL, NULL, "altr,sdr-ctl");
-+ sdr_ctl_base_addr = of_iomap(np, 0);
- }
-
- static void __init socfpga_init_irq(void)
diff --git a/patches.altera/0023-ARM-dts-socfpga-enable-the-data-and-instruction-pref.patch b/patches.altera/0023-ARM-dts-socfpga-enable-the-data-and-instruction-pref.patch
deleted file mode 100644
index 9f887cab4b7618..00000000000000
--- a/patches.altera/0023-ARM-dts-socfpga-enable-the-data-and-instruction-pref.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From b1f0088dc002a07672fb6c862cc7c81a179abb1b Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Thu, 16 Jul 2015 15:48:50 -0500
-Subject: [PATCH 23/39] ARM: dts: socfpga: enable the data and instruction
- prefetch for the l2 cache
-
-Just in case the firmware did not enable data and instruction prefetch in
-the L2 cache controller, we enable it in the kernel.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 2211a658620a35f3b3eabdfa2587f46b7abf3ee7)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga.dtsi | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
-index 80f924deed37..1e3c833dfbd2 100644
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -639,6 +639,8 @@
- cache-level = <2>;
- arm,tag-latency = <1 1 1>;
- arm,data-latency = <2 1 1>;
-+ prefetch-data = <1>;
-+ prefetch-instr = <1>;
- };
-
- mmc: dwmmc0@ff704000 {
---
-2.6.2
-
diff --git a/patches.altera/0024-ARM-dts-socfpga-use-stdout-path-for-chosen-node.patch b/patches.altera/0024-ARM-dts-socfpga-use-stdout-path-for-chosen-node.patch
deleted file mode 100644
index b14235a2d3db39..00000000000000
--- a/patches.altera/0024-ARM-dts-socfpga-use-stdout-path-for-chosen-node.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 940016336f7e0cb0a64cf17aa0a0620597ace52f Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Tue, 14 Jul 2015 17:19:02 -0500
-Subject: [PATCH 24/39] ARM: dts: socfpga: use stdout-path for chosen node
-
-Use stdout-path dts property for kernel console.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit efc1985c8f79ee8259d19a9b6e3df6a07d063669)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga_arria10.dtsi | 5 +++++
- arch/arm/boot/dts/socfpga_arria10_socdk.dtsi | 3 ++-
- arch/arm/boot/dts/socfpga_arria5_socdk.dts | 3 ++-
- arch/arm/boot/dts/socfpga_cyclone5_socdk.dts | 3 ++-
- arch/arm/boot/dts/socfpga_cyclone5_sockit.dts | 3 ++-
- 5 files changed, 13 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index f5bebdd6d1be..9f25a92a1e48 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -21,6 +21,11 @@
- #address-cells = <1>;
- #size-cells = <1>;
-
-+ aliases {
-+ serial0 = &uart0;
-+ serial1 = &uart1;
-+ };
-+
- cpus {
- #address-cells = <1>;
- #size-cells = <0>;
-diff --git a/arch/arm/boot/dts/socfpga_arria10_socdk.dtsi b/arch/arm/boot/dts/socfpga_arria10_socdk.dtsi
-index 94a0709b2fe6..99aa9a1c8af0 100644
---- a/arch/arm/boot/dts/socfpga_arria10_socdk.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10_socdk.dtsi
-@@ -21,7 +21,8 @@
- compatible = "altr,socfpga-arria10", "altr,socfpga";
-
- chosen {
-- bootargs = "console=ttyS0,115200 rootwait";
-+ bootargs = "earlyprintk";
-+ stdout-path = "serial1:115200n8";
- };
-
- memory {
-diff --git a/arch/arm/boot/dts/socfpga_arria5_socdk.dts b/arch/arm/boot/dts/socfpga_arria5_socdk.dts
-index ccaf41742fc3..a75a666032b2 100644
---- a/arch/arm/boot/dts/socfpga_arria5_socdk.dts
-+++ b/arch/arm/boot/dts/socfpga_arria5_socdk.dts
-@@ -22,7 +22,8 @@
- compatible = "altr,socfpga-arria5", "altr,socfpga";
-
- chosen {
-- bootargs = "console=ttyS0,115200";
-+ bootargs = "earlyprintk";
-+ stdout-path = "serial0:115200n8";
- };
-
- memory {
-diff --git a/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts b/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
-index 258865da8f6a..d4d0a28fb331 100644
---- a/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
-+++ b/arch/arm/boot/dts/socfpga_cyclone5_socdk.dts
-@@ -22,7 +22,8 @@
- compatible = "altr,socfpga-cyclone5", "altr,socfpga";
-
- chosen {
-- bootargs = "console=ttyS0,115200";
-+ bootargs = "earlyprintk";
-+ stdout-path = "serial0:115200n8";
- };
-
- memory {
-diff --git a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
-index 16ea6f5f2ab8..1ab1d6902504 100644
---- a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
-+++ b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
-@@ -22,7 +22,8 @@
- compatible = "altr,socfpga-cyclone5", "altr,socfpga";
-
- chosen {
-- bootargs = "console=ttyS0,115200";
-+ bootargs = "earlyprintk";
-+ stdout-path = "serial0:115200n8";
- };
-
- memory {
---
-2.6.2
-
diff --git a/patches.altera/0025-ARM-socfpga-add-reset-for-the-Arria-10-platform.patch b/patches.altera/0025-ARM-socfpga-add-reset-for-the-Arria-10-platform.patch
deleted file mode 100644
index de8496c282d659..00000000000000
--- a/patches.altera/0025-ARM-socfpga-add-reset-for-the-Arria-10-platform.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From e6929c08d62da19eb9860819f94d406b3b611329 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Mon, 20 Jul 2015 11:23:13 -0500
-Subject: [PATCH 25/39] ARM: socfpga: add reset for the Arria 10 platform
-
-Since the Arria10's reset register offset is different from the Cyclone/Arria 5,
-it's best to add a new DT_MACHINE_START() for the Arria10.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit cd871d517d46f26943f3c8f61c0d2ac6665da6a2)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/mach-socfpga/core.h | 1 +
- arch/arm/mach-socfpga/socfpga.c | 26 ++++++++++++++++++++++++++
- 2 files changed, 27 insertions(+)
-
-diff --git a/arch/arm/mach-socfpga/core.h b/arch/arm/mach-socfpga/core.h
-index 2484179c2b47..04d187434a6b 100644
---- a/arch/arm/mach-socfpga/core.h
-+++ b/arch/arm/mach-socfpga/core.h
-@@ -25,6 +25,7 @@
- #define SOCFPGA_RSTMGR_MODPERRST 0x14
- #define SOCFPGA_RSTMGR_BRGMODRST 0x1c
-
-+#define SOCFPGA_A10_RSTMGR_CTRL 0xC
- #define SOCFPGA_A10_RSTMGR_MODMPURST 0x20
-
- /* System Manager bits */
-diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
-index 19643a756c48..a1c0efaa8794 100644
---- a/arch/arm/mach-socfpga/socfpga.c
-+++ b/arch/arm/mach-socfpga/socfpga.c
-@@ -74,6 +74,19 @@ static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
- writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
- }
-
-+static void socfpga_arria10_restart(enum reboot_mode mode, const char *cmd)
-+{
-+ u32 temp;
-+
-+ temp = readl(rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL);
-+
-+ if (mode == REBOOT_HARD)
-+ temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
-+ else
-+ temp |= RSTMGR_CTRL_SWWARMRSTREQ;
-+ writel(temp, rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL);
-+}
-+
- static const char *altera_dt_match[] = {
- "altr,socfpga",
- NULL
-@@ -86,3 +99,16 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
- .restart = socfpga_cyclone5_restart,
- .dt_compat = altera_dt_match,
- MACHINE_END
-+
-+static const char *altera_a10_dt_match[] = {
-+ "altr,socfpga-arria10",
-+ NULL
-+};
-+
-+DT_MACHINE_START(SOCFPGA_A10, "Altera SOCFPGA Arria10")
-+ .l2c_aux_val = 0,
-+ .l2c_aux_mask = ~0,
-+ .init_irq = socfpga_init_irq,
-+ .restart = socfpga_arria10_restart,
-+ .dt_compat = altera_a10_dt_match,
-+MACHINE_END
---
-2.6.2
-
diff --git a/patches.altera/0026-ARM-socfpga-dts-Correct-the-parent-clock-for-l3_sp_c.patch b/patches.altera/0026-ARM-socfpga-dts-Correct-the-parent-clock-for-l3_sp_c.patch
deleted file mode 100644
index 5535063cdd53c1..00000000000000
--- a/patches.altera/0026-ARM-socfpga-dts-Correct-the-parent-clock-for-l3_sp_c.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From dbc9e4f4f5fa52118578558cbfff17229103a2ed Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Wed, 20 Nov 2013 09:39:17 -0600
-Subject: [PATCH 26/39] ARM: socfpga: dts: Correct the parent clock for
- l3_sp_clk and dbg_clk
-
-The l3_sp_clk's parent should be the l3_mp_clk. This will account for
-the extra divider that is present for the l3_mp_clk.
-
-The dbg_clk's parent should be the dbg_at_clk. This will account for
-the extra divider that is present for the dbg_at_clk.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit c5dab6e2c1f7bbf33ec855cebae92a1566ed6d04)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga.dtsi | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
-index 1e3c833dfbd2..7860935ae3a2 100644
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -318,7 +318,7 @@
- l3_sp_clk: l3_sp_clk {
- #clock-cells = <0>;
- compatible = "altr,socfpga-gate-clk";
-- clocks = <&mainclk>;
-+ clocks = <&l3_mp_clk>;
- div-reg = <0x64 2 2>;
- };
-
-@@ -349,7 +349,7 @@
- dbg_clk: dbg_clk {
- #clock-cells = <0>;
- compatible = "altr,socfpga-gate-clk";
-- clocks = <&dbg_base_clk>;
-+ clocks = <&dbg_at_clk>;
- div-reg = <0x68 2 2>;
- clk-gate = <0x60 5>;
- };
---
-2.6.2
-
diff --git a/patches.altera/0027-ARM-socfpga-dts-Fix-gpio-dts-entry-for-the-correct-c.patch b/patches.altera/0027-ARM-socfpga-dts-Fix-gpio-dts-entry-for-the-correct-c.patch
deleted file mode 100644
index 325f8b6ace2d1f..00000000000000
--- a/patches.altera/0027-ARM-socfpga-dts-Fix-gpio-dts-entry-for-the-correct-c.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 9b0cd899425c09a4b737c25a04c2ea6f63ec8e2c Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Wed, 28 May 2014 22:40:13 -0500
-Subject: [PATCH 27/39] ARM: socfpga: dts: Fix gpio dts entry for the correct
- clock
-
-The correct clock for the HPS gpio(s) should be the l4_mp_clk.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit e9f9fe35f8940c9a4c5deba091d532e3a02bf78b)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga.dtsi | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
-index 7860935ae3a2..b0acaec3b81a 100644
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -565,7 +565,7 @@
- #size-cells = <0>;
- compatible = "snps,dw-apb-gpio";
- reg = <0xff708000 0x1000>;
-- clocks = <&per_base_clk>;
-+ clocks = <&l4_mp_clk>;
- status = "disabled";
-
- porta: gpio-controller@0 {
-@@ -585,7 +585,7 @@
- #size-cells = <0>;
- compatible = "snps,dw-apb-gpio";
- reg = <0xff709000 0x1000>;
-- clocks = <&per_base_clk>;
-+ clocks = <&l4_mp_clk>;
- status = "disabled";
-
- portb: gpio-controller@0 {
-@@ -605,7 +605,7 @@
- #size-cells = <0>;
- compatible = "snps,dw-apb-gpio";
- reg = <0xff70a000 0x1000>;
-- clocks = <&per_base_clk>;
-+ clocks = <&l4_mp_clk>;
- status = "disabled";
-
- portc: gpio-controller@0 {
---
-2.6.2
-
diff --git a/patches.altera/0028-ARM-socfpga-dts-add-osc1-as-a-possible-parent-for-db.patch b/patches.altera/0028-ARM-socfpga-dts-add-osc1-as-a-possible-parent-for-db.patch
deleted file mode 100644
index 7c31785f8350c2..00000000000000
--- a/patches.altera/0028-ARM-socfpga-dts-add-osc1-as-a-possible-parent-for-db.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 4de95d60860e167d40be1a68245075cc16a62ef7 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 24 Jul 2015 22:10:59 -0500
-Subject: [PATCH 28/39] ARM: socfpga: dts: add osc1 as a possible parent for
- dbg_base_clk
-
-The dbg_base_clk can also have osc1 has a parent.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 2e4c7588f6c1d24ae991a85140e05139e953c9b5)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
-index b0acaec3b81a..9bb3b8ac0cb2 100644
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -164,7 +164,7 @@
- dbg_base_clk: dbg_base_clk {
- #clock-cells = <0>;
- compatible = "altr,socfpga-perip-clk";
-- clocks = <&main_pll>;
-+ clocks = <&main_pll>, <&osc1>;
- div-reg = <0xe8 0 9>;
- reg = <0x50>;
- };
---
-2.6.2
-
diff --git a/patches.altera/0029-reset-socfpga-Update-reset-socfpga-to-read-the-altr-.patch b/patches.altera/0029-reset-socfpga-Update-reset-socfpga-to-read-the-altr-.patch
deleted file mode 100644
index e58c714facde5b..00000000000000
--- a/patches.altera/0029-reset-socfpga-Update-reset-socfpga-to-read-the-altr-.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 946e3ffb70bff0ffaa5b47538c167fb32920f5ee Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 31 Jul 2015 16:03:10 -0500
-Subject: [PATCH 29/39] reset: socfpga: Update reset-socfpga to read the
- altr,modrst-offset property
-
-In order for the Arria10 to be able to re-use the reset driver for SoCFPGA
-Cyclone5/Arria5, we need to read the 'altr,modrst-offset' property from the
-device tree entry. The 'altr,modrst-offset' property is the first register
-into the reset manager that is used for bringing peripherals out of reset.
-
-The driver assumes a modrst-offset of 0x10 in order to support legacy
-Cyclone5/Arria5 hardware.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 27e44646dc0083c931b71bbb8e179aeb38010d31)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/reset/reset-socfpga.c | 19 +++++++++++++------
- 1 file changed, 13 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
-index 0a8def35ea2e..1a6c5d66c83b 100644
---- a/drivers/reset/reset-socfpga.c
-+++ b/drivers/reset/reset-socfpga.c
-@@ -24,11 +24,11 @@
- #include <linux/types.h>
-
- #define NR_BANKS 4
--#define OFFSET_MODRST 0x10
-
- struct socfpga_reset_data {
- spinlock_t lock;
- void __iomem *membase;
-+ u32 modrst_offset;
- struct reset_controller_dev rcdev;
- };
-
-@@ -45,8 +45,8 @@ static int socfpga_reset_assert(struct reset_controller_dev *rcdev,
-
- spin_lock_irqsave(&data->lock, flags);
-
-- reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));
-- writel(reg | BIT(offset), data->membase + OFFSET_MODRST +
-+ reg = readl(data->membase + data->modrst_offset + (bank * NR_BANKS));
-+ writel(reg | BIT(offset), data->membase + data->modrst_offset +
- (bank * NR_BANKS));
- spin_unlock_irqrestore(&data->lock, flags);
-
-@@ -67,8 +67,8 @@ static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
-
- spin_lock_irqsave(&data->lock, flags);
-
-- reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));
-- writel(reg & ~BIT(offset), data->membase + OFFSET_MODRST +
-+ reg = readl(data->membase + data->modrst_offset + (bank * NR_BANKS));
-+ writel(reg & ~BIT(offset), data->membase + data->modrst_offset +
- (bank * NR_BANKS));
-
- spin_unlock_irqrestore(&data->lock, flags);
-@@ -85,7 +85,7 @@ static int socfpga_reset_status(struct reset_controller_dev *rcdev,
- int offset = id % BITS_PER_LONG;
- u32 reg;
-
-- reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));
-+ reg = readl(data->membase + data->modrst_offset + (bank * NR_BANKS));
-
- return !(reg & BIT(offset));
- }
-@@ -100,6 +100,8 @@ static int socfpga_reset_probe(struct platform_device *pdev)
- {
- struct socfpga_reset_data *data;
- struct resource *res;
-+ struct device *dev = &pdev->dev;
-+ struct device_node *np = dev->of_node;
-
- /*
- * The binding was mainlined without the required property.
-@@ -120,6 +122,11 @@ static int socfpga_reset_probe(struct platform_device *pdev)
- if (IS_ERR(data->membase))
- return PTR_ERR(data->membase);
-
-+ if (of_property_read_u32(np, "altr,modrst-offset", &data->modrst_offset)) {
-+ dev_warn(dev, "missing altr,modrst-offset property, assuming 0x10!\n");
-+ data->modrst_offset = 0x10;
-+ }
-+
- spin_lock_init(&data->lock);
-
- data->rcdev.owner = THIS_MODULE;
---
-2.6.2
-
diff --git a/patches.altera/0030-dt-bindings-Add-reset-manager-offsets-for-Arria10.patch b/patches.altera/0030-dt-bindings-Add-reset-manager-offsets-for-Arria10.patch
deleted file mode 100644
index bf8af3eea98eb0..00000000000000
--- a/patches.altera/0030-dt-bindings-Add-reset-manager-offsets-for-Arria10.patch
+++ /dev/null
@@ -1,135 +0,0 @@
-From 2105d44605f99793a624f1650b972efcf8ee554b Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 24 Jul 2015 00:01:55 -0500
-Subject: [PATCH 30/39] dt-bindings: Add reset manager offsets for Arria10
-
-The reset manager for is pretty similar to the one for SoCFPGA
-cyclone5/arria5 except for a few offsets. This patch adds those offsets.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 007bb689b3dbad83cdab0ad192bc6ed0162451e0)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- include/dt-bindings/reset/altr,rst-mgr-a10.h | 110 +++++++++++++++++++++++++++
- 1 file changed, 110 insertions(+)
- create mode 100644 include/dt-bindings/reset/altr,rst-mgr-a10.h
-
-diff --git a/include/dt-bindings/reset/altr,rst-mgr-a10.h b/include/dt-bindings/reset/altr,rst-mgr-a10.h
-new file mode 100644
-index 000000000000..acb0bbf4f9f5
---- /dev/null
-+++ b/include/dt-bindings/reset/altr,rst-mgr-a10.h
-@@ -0,0 +1,110 @@
-+/*
-+ * Copyright (c) 2014, Steffen Trumtrar <s.trumtrar@pengutronix.de>
-+ *
-+ * This software is licensed under the terms of the GNU General Public
-+ * License version 2, as published by the Free Software Foundation, and
-+ * may be copied, distributed, and modified under those terms.
-+ *
-+ * 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 _DT_BINDINGS_RESET_ALTR_RST_MGR_A10_H
-+#define _DT_BINDINGS_RESET_ALTR_RST_MGR_A10_H
-+
-+/* MPUMODRST */
-+#define CPU0_RESET 0
-+#define CPU1_RESET 1
-+#define WDS_RESET 2
-+#define SCUPER_RESET 3
-+
-+/* PER0MODRST */
-+#define EMAC0_RESET 32
-+#define EMAC1_RESET 33
-+#define EMAC2_RESET 34
-+#define USB0_RESET 35
-+#define USB1_RESET 36
-+#define NAND_RESET 37
-+#define QSPI_RESET 38
-+#define SDMMC_RESET 39
-+#define EMAC0_OCP_RESET 40
-+#define EMAC1_OCP_RESET 41
-+#define EMAC2_OCP_RESET 42
-+#define USB0_OCP_RESET 43
-+#define USB1_OCP_RESET 44
-+#define NAND_OCP_RESET 45
-+#define QSPI_OCP_RESET 46
-+#define SDMMC_OCP_RESET 47
-+#define DMA_RESET 48
-+#define SPIM0_RESET 49
-+#define SPIM1_RESET 50
-+#define SPIS0_RESET 51
-+#define SPIS1_RESET 52
-+#define DMA_OCP_RESET 53
-+#define EMAC_PTP_RESET 54
-+/* 55 is empty*/
-+#define DMAIF0_RESET 56
-+#define DMAIF1_RESET 57
-+#define DMAIF2_RESET 58
-+#define DMAIF3_RESET 59
-+#define DMAIF4_RESET 60
-+#define DMAIF5_RESET 61
-+#define DMAIF6_RESET 62
-+#define DMAIF7_RESET 63
-+
-+/* PER1MODRST */
-+#define L4WD0_RESET 64
-+#define L4WD1_RESET 65
-+#define L4SYSTIMER0_RESET 66
-+#define L4SYSTIMER1_RESET 67
-+#define SPTIMER0_RESET 68
-+#define SPTIMER1_RESET 69
-+/* 70-71 is reserved */
-+#define I2C0_RESET 72
-+#define I2C1_RESET 73
-+#define I2C2_RESET 74
-+#define I2C3_RESET 75
-+#define I2C4_RESET 76
-+/* 77-79 is reserved */
-+#define UART0_RESET 80
-+#define UART1_RESET 81
-+/* 82-87 is reserved */
-+#define GPIO0_RESET 88
-+#define GPIO1_RESET 89
-+#define GPIO2_RESET 90
-+
-+/* BRGMODRST */
-+#define HPS2FPGA_RESET 96
-+#define LWHPS2FPGA_RESET 97
-+#define FPGA2HPS_RESET 98
-+#define F2SSDRAM0_RESET 99
-+#define F2SSDRAM1_RESET 100
-+#define F2SSDRAM2_RESET 101
-+#define DDRSCH_RESET 102
-+
-+/* SYSMODRST*/
-+#define ROM_RESET 128
-+#define OCRAM_RESET 129
-+/* 130 is reserved */
-+#define FPGAMGR_RESET 131
-+#define S2F_RESET 132
-+#define SYSDBG_RESET 133
-+#define OCRAM_OCP_RESET 134
-+
-+/* COLDMODRST */
-+#define CLKMGRCOLD_RESET 160
-+/* 161-162 is reserved */
-+#define S2FCOLD_RESET 163
-+#define TIMESTAMPCOLD_RESET 164
-+#define TAPCOLD_RESET 165
-+#define HMCCOLD_RESET 166
-+#define IOMGRCOLD_RESET 167
-+
-+/* NRSTMODRST */
-+#define NRSTPINOE_RESET 192
-+
-+/* DBGMODRST */
-+#define DBG_RESET 224
-+#endif
---
-2.6.2
-
diff --git a/patches.altera/0031-ARM-socfpga-dts-add-altr-modrst-offset-property.patch b/patches.altera/0031-ARM-socfpga-dts-add-altr-modrst-offset-property.patch
deleted file mode 100644
index 0b3a9427c2eddb..00000000000000
--- a/patches.altera/0031-ARM-socfpga-dts-add-altr-modrst-offset-property.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 0553f0e52ee98abeb8904ee9621739be981c20ea Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 24 Jul 2015 14:05:06 -0500
-Subject: [PATCH 31/39] ARM: socfpga: dts: add "altr,modrst-offset" property
-
-The "altr,modrst-offset" property represents the offset into the reset manager
-that is the first register to be used by the driver to bring peripherals out
-of reset.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 1a94acf858000836d28b13942eebf5cbffc9ac34)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- Documentation/devicetree/bindings/reset/socfpga-reset.txt | 2 ++
- arch/arm/boot/dts/socfpga.dtsi | 1 +
- arch/arm/boot/dts/socfpga_arria10.dtsi | 1 +
- 3 files changed, 4 insertions(+)
-
-diff --git a/Documentation/devicetree/bindings/reset/socfpga-reset.txt b/Documentation/devicetree/bindings/reset/socfpga-reset.txt
-index 32c1c8bfd5dc..98c9f560e5c5 100644
---- a/Documentation/devicetree/bindings/reset/socfpga-reset.txt
-+++ b/Documentation/devicetree/bindings/reset/socfpga-reset.txt
-@@ -3,6 +3,7 @@ Altera SOCFPGA Reset Manager
- Required properties:
- - compatible : "altr,rst-mgr"
- - reg : Should contain 1 register ranges(address and length)
-+- altr,modrst-offset : Should contain the offset of the first modrst register.
- - #reset-cells: 1
-
- Example:
-@@ -10,4 +11,5 @@ Example:
- #reset-cells = <1>;
- compatible = "altr,rst-mgr";
- reg = <0xffd05000 0x1000>;
-+ altr,modrst-offset = <0x10>;
- };
-diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
-index 9bb3b8ac0cb2..9e1563c39990 100644
---- a/arch/arm/boot/dts/socfpga.dtsi
-+++ b/arch/arm/boot/dts/socfpga.dtsi
-@@ -754,6 +754,7 @@
- #reset-cells = <1>;
- compatible = "altr,rst-mgr";
- reg = <0xffd05000 0x1000>;
-+ altr,modrst-offset = <0x10>;
- };
-
- usbphy0: usbphy@0 {
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index 9f25a92a1e48..d80ca7a0cc7c 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -582,6 +582,7 @@
- #reset-cells = <1>;
- compatible = "altr,rst-mgr";
- reg = <0xffd05000 0x100>;
-+ altr,modrst-offset = <0x20>;
- };
-
- scu: snoop-control-unit@ffffc000 {
---
-2.6.2
-
diff --git a/patches.altera/0032-ARM-socfpga-dts-Add-resets-for-EMACs-on-Arria10.patch b/patches.altera/0032-ARM-socfpga-dts-Add-resets-for-EMACs-on-Arria10.patch
deleted file mode 100644
index a974fe4300527f..00000000000000
--- a/patches.altera/0032-ARM-socfpga-dts-Add-resets-for-EMACs-on-Arria10.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 455d260b81cd4dd8d3c55da978ecea6c37695565 Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 24 Jul 2015 15:13:17 -0500
-Subject: [PATCH 32/39] ARM: socfpga: dts: Add resets for EMACs on Arria10
-
-Add the reset property for the EMAC controllers on Arria10.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 6855e5b7090330add9521d8947017875d5f4f88e)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/socfpga_arria10.dtsi | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index d80ca7a0cc7c..bcf3b781a9fc 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -16,6 +16,7 @@
-
- #include "skeleton.dtsi"
- #include <dt-bindings/interrupt-controller/arm-gic.h>
-+#include <dt-bindings/reset/altr,rst-mgr-a10.h>
-
- / {
- #address-cells = <1>;
-@@ -414,6 +415,8 @@
- rx-fifo-depth = <16384>;
- clocks = <&l4_mp_clk>;
- clock-names = "stmmaceth";
-+ resets = <&rst EMAC0_RESET>;
-+ reset-names = "stmmaceth";
- status = "disabled";
- };
-
-@@ -431,6 +434,8 @@
- rx-fifo-depth = <16384>;
- clocks = <&l4_mp_clk>;
- clock-names = "stmmaceth";
-+ resets = <&rst EMAC1_RESET>;
-+ reset-names = "stmmaceth";
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.altera/0033-clk-socfpga-Add-a-second-parent-option-for-the-dbg_b.patch b/patches.altera/0033-clk-socfpga-Add-a-second-parent-option-for-the-dbg_b.patch
deleted file mode 100644
index 6c05e33ba537d6..00000000000000
--- a/patches.altera/0033-clk-socfpga-Add-a-second-parent-option-for-the-dbg_b.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From 1551fee162675433aecccb9f26d03daa2760e42b Mon Sep 17 00:00:00 2001
-From: Dinh Nguyen <dinguyen@opensource.altera.com>
-Date: Fri, 24 Jul 2015 22:30:18 -0500
-Subject: [PATCH 33/39] clk: socfpga: Add a second parent option for the
- dbg_base_clk
-
-The debug base clock can be bypassed from the main PLL to the OSC1 clock.
-The bypass register is the staysoc1(0x10) register that is in the clock
-manager.
-
-This patch adds the option to get the correct parent for the debug base
-clock.
-
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-(cherry picked from commit 34d5003bfba44a73fe9fbcf75e1d41d130d59bd1)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/clk/socfpga/clk-periph.c | 18 ++++++++++++++----
- drivers/clk/socfpga/clk.h | 1 +
- 2 files changed, 15 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/clk/socfpga/clk-periph.c b/drivers/clk/socfpga/clk-periph.c
-index 46531c34ec9b..8a4932fb83a8 100644
---- a/drivers/clk/socfpga/clk-periph.c
-+++ b/drivers/clk/socfpga/clk-periph.c
-@@ -45,8 +45,17 @@ static unsigned long clk_periclk_recalc_rate(struct clk_hw *hwclk,
- return parent_rate / div;
- }
-
-+static u8 clk_periclk_get_parent(struct clk_hw *hwclk)
-+{
-+ u32 clk_src;
-+
-+ clk_src = readl(clk_mgr_base_addr + CLKMGR_DBCTRL);
-+ return clk_src & 0x1;
-+}
-+
- static const struct clk_ops periclk_ops = {
- .recalc_rate = clk_periclk_recalc_rate,
-+ .get_parent = clk_periclk_get_parent,
- };
-
- static __init void __socfpga_periph_init(struct device_node *node,
-@@ -56,7 +65,7 @@ static __init void __socfpga_periph_init(struct device_node *node,
- struct clk *clk;
- struct socfpga_periph_clk *periph_clk;
- const char *clk_name = node->name;
-- const char *parent_name;
-+ const char *parent_name[SOCFPGA_MAX_PARENTS];
- struct clk_init_data init;
- int rc;
- u32 fixed_div;
-@@ -90,9 +99,10 @@ static __init void __socfpga_periph_init(struct device_node *node,
- init.name = clk_name;
- init.ops = ops;
- init.flags = 0;
-- parent_name = of_clk_get_parent_name(node, 0);
-- init.parent_names = &parent_name;
-- init.num_parents = 1;
-+
-+ init.num_parents = of_clk_parent_fill(node, parent_name,
-+ SOCFPGA_MAX_PARENTS);
-+ init.parent_names = parent_name;
-
- periph_clk->hw.hw.init = &init;
-
-diff --git a/drivers/clk/socfpga/clk.h b/drivers/clk/socfpga/clk.h
-index 603973ab7e29..a75f0801a8bb 100644
---- a/drivers/clk/socfpga/clk.h
-+++ b/drivers/clk/socfpga/clk.h
-@@ -23,6 +23,7 @@
- /* Clock Manager offsets */
- #define CLKMGR_CTRL 0x0
- #define CLKMGR_BYPASS 0x4
-+#define CLKMGR_DBCTRL 0x10
- #define CLKMGR_L4SRC 0x70
- #define CLKMGR_PERPLL_SRC 0xAC
-
---
-2.6.2
-
diff --git a/patches.altera/0034-EDAC-altera-Generalize-driver-to-use-DT-Memory-size.patch b/patches.altera/0034-EDAC-altera-Generalize-driver-to-use-DT-Memory-size.patch
deleted file mode 100644
index 4fb3aa784a43d6..00000000000000
--- a/patches.altera/0034-EDAC-altera-Generalize-driver-to-use-DT-Memory-size.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 18e01c2388a965f73b127ee8cc5a2ee8f23250b4 Mon Sep 17 00:00:00 2001
-From: Thor Thayer <tthayer@opensource.altera.com>
-Date: Thu, 4 Jun 2015 09:28:45 -0500
-Subject: [PATCH 34/39] EDAC, altera: Generalize driver to use DT Memory size
-
-The Arria10 SOC uses a completely different SDRAM controller from the
-earlier CycloneV and ArriaV SoCs. The memory size is calculated in the
-bootloader and passed via the device tree. Using this device tree size
-is more generic than using the register fields to calculate the memory
-size for different SDRAM controllers.
-
-Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
-Cc: Arnd Bergmann <arnd@arndb.de>
-Cc: devicetree@vger.kernel.org
-Cc: dinguyen@opensource.altera.com
-Cc: galak@codeaurora.org
-Cc: grant.likely@linaro.org
-Cc: ijc+devicetree@hellion.org.uk
-Cc: linux-arm-kernel@lists.infradead.org
-Cc: linux-edac <linux-edac@vger.kernel.org>
-Cc: m.chehab@samsung.com
-Cc: mark.rutland@arm.com
-Cc: pawel.moll@arm.com
-Cc: robh+dt@kernel.org
-Cc: tthayer.linux@gmail.com
-Link: http://lkml.kernel.org/r/1433428128-7292-2-git-send-email-tthayer@opensource.altera.com
-Signed-off-by: Borislav Petkov <bp@suse.de>
-(cherry picked from commit f9ae487e04370e229a96c83a8c86510299712192)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/edac/altera_edac.c | 58 +++++++++++++++++++++-------------------------
- 1 file changed, 26 insertions(+), 32 deletions(-)
-
-diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
-index 3c4929fda9d5..1d55c5b98024 100644
---- a/drivers/edac/altera_edac.c
-+++ b/drivers/edac/altera_edac.c
-@@ -219,36 +219,31 @@ static void altr_sdr_mc_create_debugfs_nodes(struct mem_ctl_info *mci)
- {}
- #endif
-
--/* Get total memory size in bytes */
--static u32 altr_sdram_get_total_mem_size(struct regmap *mc_vbase)
-+/* Get total memory size from Open Firmware DTB */
-+static unsigned long get_total_mem(void)
- {
-- u32 size, read_reg, row, bank, col, cs, width;
--
-- if (regmap_read(mc_vbase, DRAMADDRW_OFST, &read_reg) < 0)
-- return 0;
--
-- if (regmap_read(mc_vbase, DRAMIFWIDTH_OFST, &width) < 0)
-- return 0;
--
-- col = (read_reg & DRAMADDRW_COLBIT_MASK) >>
-- DRAMADDRW_COLBIT_SHIFT;
-- row = (read_reg & DRAMADDRW_ROWBIT_MASK) >>
-- DRAMADDRW_ROWBIT_SHIFT;
-- bank = (read_reg & DRAMADDRW_BANKBIT_MASK) >>
-- DRAMADDRW_BANKBIT_SHIFT;
-- cs = (read_reg & DRAMADDRW_CSBIT_MASK) >>
-- DRAMADDRW_CSBIT_SHIFT;
--
-- /* Correct for ECC as its not addressible */
-- if (width == DRAMIFWIDTH_32B_ECC)
-- width = 32;
-- if (width == DRAMIFWIDTH_16B_ECC)
-- width = 16;
--
-- /* calculate the SDRAM size base on this info */
-- size = 1 << (row + bank + col);
-- size = size * cs * (width / 8);
-- return size;
-+ struct device_node *np = NULL;
-+ const unsigned int *reg, *reg_end;
-+ int len, sw, aw;
-+ unsigned long start, size, total_mem = 0;
-+
-+ for_each_node_by_type(np, "memory") {
-+ aw = of_n_addr_cells(np);
-+ sw = of_n_size_cells(np);
-+ reg = (const unsigned int *)of_get_property(np, "reg", &len);
-+ reg_end = reg + (len / sizeof(u32));
-+
-+ total_mem = 0;
-+ do {
-+ start = of_read_number(reg, aw);
-+ reg += aw;
-+ size = of_read_number(reg, sw);
-+ reg += sw;
-+ total_mem += size;
-+ } while (reg < reg_end);
-+ }
-+ edac_dbg(0, "total_mem 0x%lx\n", total_mem);
-+ return total_mem;
- }
-
- static int altr_sdram_probe(struct platform_device *pdev)
-@@ -280,10 +275,9 @@ static int altr_sdram_probe(struct platform_device *pdev)
- }
-
- /* Grab memory size from device tree. */
-- mem_size = altr_sdram_get_total_mem_size(mc_vbase);
-+ mem_size = get_total_mem();
- if (!mem_size) {
-- edac_printk(KERN_ERR, EDAC_MC,
-- "Unable to calculate memory size\n");
-+ edac_printk(KERN_ERR, EDAC_MC, "Unable to calculate memory size\n");
- return -ENODEV;
- }
-
---
-2.6.2
-
diff --git a/patches.altera/0035-EDAC-altera-Refactor-for-Altera-CycloneV-SoC.patch b/patches.altera/0035-EDAC-altera-Refactor-for-Altera-CycloneV-SoC.patch
deleted file mode 100644
index c17a3f23702743..00000000000000
--- a/patches.altera/0035-EDAC-altera-Refactor-for-Altera-CycloneV-SoC.patch
+++ /dev/null
@@ -1,478 +0,0 @@
-From b677a87b67bb7f631e388cbb6e70b1fb75d86811 Mon Sep 17 00:00:00 2001
-From: Thor Thayer <tthayer@opensource.altera.com>
-Date: Thu, 4 Jun 2015 09:28:46 -0500
-Subject: [PATCH 35/39] EDAC, altera: Refactor for Altera CycloneV SoC
-
-The Arria10 SoC uses a completely different SDRAM controller from the
-earlier CycloneV and ArriaV SoCs. This patch abstracts the SDRAM bits
-for the CycloneV/ArriaV SoCs in preparation for the Arria10 support.
-
-Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
-Cc: Arnd Bergmann <arnd@arndb.de>
-Cc: devicetree@vger.kernel.org
-Cc: dinguyen@opensource.altera.com
-Cc: galak@codeaurora.org
-Cc: grant.likely@linaro.org
-Cc: ijc+devicetree@hellion.org.uk
-Cc: linux-arm-kernel@lists.infradead.org
-Cc: linux-edac <linux-edac@vger.kernel.org>
-Cc: m.chehab@samsung.com
-Cc: mark.rutland@arm.com
-Cc: pawel.moll@arm.com
-Cc: robh+dt@kernel.org
-Cc: tthayer.linux@gmail.com
-Link: http://lkml.kernel.org/r/1433428128-7292-3-git-send-email-tthayer@opensource.altera.com
-Signed-off-by: Borislav Petkov <bp@suse.de>
-(cherry picked from commit 143f4a5ac5af82a4055100c8f40b26187d5c20ba)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/edac/altera_edac.c | 194 +++++++++++++++++++++------------------------
- drivers/edac/altera_edac.h | 116 +++++++++++++++++++++++++++
- 2 files changed, 206 insertions(+), 104 deletions(-)
- create mode 100644 drivers/edac/altera_edac.h
-
-diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
-index 1d55c5b98024..4ac4e6c11ece 100644
---- a/drivers/edac/altera_edac.c
-+++ b/drivers/edac/altera_edac.c
-@@ -1,5 +1,5 @@
- /*
-- * Copyright Altera Corporation (C) 2014. All rights reserved.
-+ * Copyright Altera Corporation (C) 2014-2015. All rights reserved.
- * Copyright 2011-2012 Calxeda, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
-@@ -28,111 +28,64 @@
- #include <linux/types.h>
- #include <linux/uaccess.h>
-
-+#include "altera_edac.h"
- #include "edac_core.h"
- #include "edac_module.h"
-
- #define EDAC_MOD_STR "altera_edac"
- #define EDAC_VERSION "1"
-
--/* SDRAM Controller CtrlCfg Register */
--#define CTLCFG_OFST 0x00
--
--/* SDRAM Controller CtrlCfg Register Bit Masks */
--#define CTLCFG_ECC_EN 0x400
--#define CTLCFG_ECC_CORR_EN 0x800
--#define CTLCFG_GEN_SB_ERR 0x2000
--#define CTLCFG_GEN_DB_ERR 0x4000
--
--#define CTLCFG_ECC_AUTO_EN (CTLCFG_ECC_EN | \
-- CTLCFG_ECC_CORR_EN)
--
--/* SDRAM Controller Address Width Register */
--#define DRAMADDRW_OFST 0x2C
--
--/* SDRAM Controller Address Widths Field Register */
--#define DRAMADDRW_COLBIT_MASK 0x001F
--#define DRAMADDRW_COLBIT_SHIFT 0
--#define DRAMADDRW_ROWBIT_MASK 0x03E0
--#define DRAMADDRW_ROWBIT_SHIFT 5
--#define DRAMADDRW_BANKBIT_MASK 0x1C00
--#define DRAMADDRW_BANKBIT_SHIFT 10
--#define DRAMADDRW_CSBIT_MASK 0xE000
--#define DRAMADDRW_CSBIT_SHIFT 13
--
--/* SDRAM Controller Interface Data Width Register */
--#define DRAMIFWIDTH_OFST 0x30
--
--/* SDRAM Controller Interface Data Width Defines */
--#define DRAMIFWIDTH_16B_ECC 24
--#define DRAMIFWIDTH_32B_ECC 40
--
--/* SDRAM Controller DRAM Status Register */
--#define DRAMSTS_OFST 0x38
--
--/* SDRAM Controller DRAM Status Register Bit Masks */
--#define DRAMSTS_SBEERR 0x04
--#define DRAMSTS_DBEERR 0x08
--#define DRAMSTS_CORR_DROP 0x10
--
--/* SDRAM Controller DRAM IRQ Register */
--#define DRAMINTR_OFST 0x3C
--
--/* SDRAM Controller DRAM IRQ Register Bit Masks */
--#define DRAMINTR_INTREN 0x01
--#define DRAMINTR_SBEMASK 0x02
--#define DRAMINTR_DBEMASK 0x04
--#define DRAMINTR_CORRDROPMASK 0x08
--#define DRAMINTR_INTRCLR 0x10
--
--/* SDRAM Controller Single Bit Error Count Register */
--#define SBECOUNT_OFST 0x40
--
--/* SDRAM Controller Single Bit Error Count Register Bit Masks */
--#define SBECOUNT_MASK 0x0F
--
--/* SDRAM Controller Double Bit Error Count Register */
--#define DBECOUNT_OFST 0x44
--
--/* SDRAM Controller Double Bit Error Count Register Bit Masks */
--#define DBECOUNT_MASK 0x0F
--
--/* SDRAM Controller ECC Error Address Register */
--#define ERRADDR_OFST 0x48
--
--/* SDRAM Controller ECC Error Address Register Bit Masks */
--#define ERRADDR_MASK 0xFFFFFFFF
--
--/* Altera SDRAM Memory Controller data */
--struct altr_sdram_mc_data {
-- struct regmap *mc_vbase;
-+static const struct altr_sdram_prv_data c5_data = {
-+ .ecc_ctrl_offset = CV_CTLCFG_OFST,
-+ .ecc_ctl_en_mask = CV_CTLCFG_ECC_AUTO_EN,
-+ .ecc_stat_offset = CV_DRAMSTS_OFST,
-+ .ecc_stat_ce_mask = CV_DRAMSTS_SBEERR,
-+ .ecc_stat_ue_mask = CV_DRAMSTS_DBEERR,
-+ .ecc_saddr_offset = CV_ERRADDR_OFST,
-+ .ecc_cecnt_offset = CV_SBECOUNT_OFST,
-+ .ecc_uecnt_offset = CV_DBECOUNT_OFST,
-+ .ecc_irq_en_offset = CV_DRAMINTR_OFST,
-+ .ecc_irq_en_mask = CV_DRAMINTR_INTREN,
-+ .ecc_irq_clr_offset = CV_DRAMINTR_OFST,
-+ .ecc_irq_clr_mask = (CV_DRAMINTR_INTRCLR | CV_DRAMINTR_INTREN),
-+ .ecc_cnt_rst_offset = CV_DRAMINTR_OFST,
-+ .ecc_cnt_rst_mask = CV_DRAMINTR_INTRCLR,
-+#ifdef CONFIG_EDAC_DEBUG
-+ .ce_ue_trgr_offset = CV_CTLCFG_OFST,
-+ .ce_set_mask = CV_CTLCFG_GEN_SB_ERR,
-+ .ue_set_mask = CV_CTLCFG_GEN_DB_ERR,
-+#endif
- };
-
- static irqreturn_t altr_sdram_mc_err_handler(int irq, void *dev_id)
- {
- struct mem_ctl_info *mci = dev_id;
- struct altr_sdram_mc_data *drvdata = mci->pvt_info;
-+ const struct altr_sdram_prv_data *priv = drvdata->data;
- u32 status, err_count, err_addr;
-
- /* Error Address is shared by both SBE & DBE */
-- regmap_read(drvdata->mc_vbase, ERRADDR_OFST, &err_addr);
-+ regmap_read(drvdata->mc_vbase, priv->ecc_saddr_offset, &err_addr);
-
-- regmap_read(drvdata->mc_vbase, DRAMSTS_OFST, &status);
-+ regmap_read(drvdata->mc_vbase, priv->ecc_stat_offset, &status);
-
-- if (status & DRAMSTS_DBEERR) {
-- regmap_read(drvdata->mc_vbase, DBECOUNT_OFST, &err_count);
-+ if (status & priv->ecc_stat_ue_mask) {
-+ regmap_read(drvdata->mc_vbase, priv->ecc_uecnt_offset,
-+ &err_count);
- panic("\nEDAC: [%d Uncorrectable errors @ 0x%08X]\n",
- err_count, err_addr);
- }
-- if (status & DRAMSTS_SBEERR) {
-- regmap_read(drvdata->mc_vbase, SBECOUNT_OFST, &err_count);
-+ if (status & priv->ecc_stat_ce_mask) {
-+ regmap_read(drvdata->mc_vbase, priv->ecc_cecnt_offset,
-+ &err_count);
- edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, err_count,
- err_addr >> PAGE_SHIFT,
- err_addr & ~PAGE_MASK, 0,
- 0, 0, -1, mci->ctl_name, "");
- }
-
-- regmap_write(drvdata->mc_vbase, DRAMINTR_OFST,
-- (DRAMINTR_INTRCLR | DRAMINTR_INTREN));
-+ regmap_write(drvdata->mc_vbase, priv->ecc_irq_clr_offset,
-+ priv->ecc_irq_clr_mask);
-
- return IRQ_HANDLED;
- }
-@@ -144,6 +97,7 @@ static ssize_t altr_sdr_mc_err_inject_write(struct file *file,
- {
- struct mem_ctl_info *mci = file->private_data;
- struct altr_sdram_mc_data *drvdata = mci->pvt_info;
-+ const struct altr_sdram_prv_data *priv = drvdata->data;
- u32 *ptemp;
- dma_addr_t dma_handle;
- u32 reg, read_reg;
-@@ -156,8 +110,9 @@ static ssize_t altr_sdr_mc_err_inject_write(struct file *file,
- return -ENOMEM;
- }
-
-- regmap_read(drvdata->mc_vbase, CTLCFG_OFST, &read_reg);
-- read_reg &= ~(CTLCFG_GEN_SB_ERR | CTLCFG_GEN_DB_ERR);
-+ regmap_read(drvdata->mc_vbase, priv->ce_ue_trgr_offset,
-+ &read_reg);
-+ read_reg &= ~(priv->ce_set_mask | priv->ue_set_mask);
-
- /* Error are injected by writing a word while the SBE or DBE
- * bit in the CTLCFG register is set. Reading the word will
-@@ -166,20 +121,20 @@ static ssize_t altr_sdr_mc_err_inject_write(struct file *file,
- if (count == 3) {
- edac_printk(KERN_ALERT, EDAC_MC,
- "Inject Double bit error\n");
-- regmap_write(drvdata->mc_vbase, CTLCFG_OFST,
-- (read_reg | CTLCFG_GEN_DB_ERR));
-+ regmap_write(drvdata->mc_vbase, priv->ce_ue_trgr_offset,
-+ (read_reg | priv->ue_set_mask));
- } else {
- edac_printk(KERN_ALERT, EDAC_MC,
- "Inject Single bit error\n");
-- regmap_write(drvdata->mc_vbase, CTLCFG_OFST,
-- (read_reg | CTLCFG_GEN_SB_ERR));
-+ regmap_write(drvdata->mc_vbase, priv->ce_ue_trgr_offset,
-+ (read_reg | priv->ce_set_mask));
- }
-
- ptemp[0] = 0x5A5A5A5A;
- ptemp[1] = 0xA5A5A5A5;
-
- /* Clear the error injection bits */
-- regmap_write(drvdata->mc_vbase, CTLCFG_OFST, read_reg);
-+ regmap_write(drvdata->mc_vbase, priv->ce_ue_trgr_offset, read_reg);
- /* Ensure it has been written out */
- wmb();
-
-@@ -246,18 +201,29 @@ static unsigned long get_total_mem(void)
- return total_mem;
- }
-
-+static const struct of_device_id altr_sdram_ctrl_of_match[] = {
-+ { .compatible = "altr,sdram-edac", .data = (void *)&c5_data},
-+ {},
-+};
-+MODULE_DEVICE_TABLE(of, altr_sdram_ctrl_of_match);
-+
- static int altr_sdram_probe(struct platform_device *pdev)
- {
-+ const struct of_device_id *id;
- struct edac_mc_layer layers[2];
- struct mem_ctl_info *mci;
- struct altr_sdram_mc_data *drvdata;
-+ const struct altr_sdram_prv_data *priv;
- struct regmap *mc_vbase;
- struct dimm_info *dimm;
-- u32 read_reg, mem_size;
-- int irq;
-- int res = 0;
-+ u32 read_reg;
-+ int irq, res = 0;
-+ unsigned long mem_size;
-+
-+ id = of_match_device(altr_sdram_ctrl_of_match, &pdev->dev);
-+ if (!id)
-+ return -ENODEV;
-
-- /* Validate the SDRAM controller has ECC enabled */
- /* Grab the register range from the sdr controller in device tree */
- mc_vbase = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
- "altr,sdr-syscon");
-@@ -267,8 +233,13 @@ static int altr_sdram_probe(struct platform_device *pdev)
- return -ENODEV;
- }
-
-- if (regmap_read(mc_vbase, CTLCFG_OFST, &read_reg) ||
-- ((read_reg & CTLCFG_ECC_AUTO_EN) != CTLCFG_ECC_AUTO_EN)) {
-+ /* Check specific dependencies for the module */
-+ priv = of_match_node(altr_sdram_ctrl_of_match,
-+ pdev->dev.of_node)->data;
-+
-+ /* Validate the SDRAM controller has ECC enabled */
-+ if (regmap_read(mc_vbase, priv->ecc_ctrl_offset, &read_reg) ||
-+ ((read_reg & priv->ecc_ctl_en_mask) != priv->ecc_ctl_en_mask)) {
- edac_printk(KERN_ERR, EDAC_MC,
- "No ECC/ECC disabled [0x%08X]\n", read_reg);
- return -ENODEV;
-@@ -281,10 +252,27 @@ static int altr_sdram_probe(struct platform_device *pdev)
- return -ENODEV;
- }
-
-- /* Ensure the SDRAM Interrupt is disabled and cleared */
-- if (regmap_write(mc_vbase, DRAMINTR_OFST, DRAMINTR_INTRCLR)) {
-+ /* Ensure the SDRAM Interrupt is disabled */
-+ if (regmap_update_bits(mc_vbase, priv->ecc_irq_en_offset,
-+ priv->ecc_irq_en_mask, 0)) {
-+ edac_printk(KERN_ERR, EDAC_MC,
-+ "Error disabling SDRAM ECC IRQ\n");
-+ return -ENODEV;
-+ }
-+
-+ /* Toggle to clear the SDRAM Error count */
-+ if (regmap_update_bits(mc_vbase, priv->ecc_cnt_rst_offset,
-+ priv->ecc_cnt_rst_mask,
-+ priv->ecc_cnt_rst_mask)) {
-+ edac_printk(KERN_ERR, EDAC_MC,
-+ "Error clearing SDRAM ECC count\n");
-+ return -ENODEV;
-+ }
-+
-+ if (regmap_update_bits(mc_vbase, priv->ecc_cnt_rst_offset,
-+ priv->ecc_cnt_rst_mask, 0)) {
- edac_printk(KERN_ERR, EDAC_MC,
-- "Error clearing SDRAM ECC IRQ\n");
-+ "Error clearing SDRAM ECC count\n");
- return -ENODEV;
- }
-
-@@ -309,9 +297,12 @@ static int altr_sdram_probe(struct platform_device *pdev)
- mci->pdev = &pdev->dev;
- drvdata = mci->pvt_info;
- drvdata->mc_vbase = mc_vbase;
-+ drvdata->data = priv;
- platform_set_drvdata(pdev, mci);
-
- if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) {
-+ edac_printk(KERN_ERR, EDAC_MC,
-+ "Unable to get managed device resource\n");
- res = -ENOMEM;
- goto free;
- }
-@@ -345,8 +336,9 @@ static int altr_sdram_probe(struct platform_device *pdev)
- goto err2;
- }
-
-- if (regmap_write(drvdata->mc_vbase, DRAMINTR_OFST,
-- (DRAMINTR_INTRCLR | DRAMINTR_INTREN))) {
-+ /* Infrastructure ready - enable the IRQ */
-+ if (regmap_update_bits(drvdata->mc_vbase, priv->ecc_irq_en_offset,
-+ priv->ecc_irq_en_mask, priv->ecc_irq_en_mask)) {
- edac_mc_printk(mci, KERN_ERR,
- "Error enabling SDRAM ECC IRQ\n");
- res = -ENODEV;
-@@ -382,12 +374,6 @@ static int altr_sdram_remove(struct platform_device *pdev)
- return 0;
- }
-
--static const struct of_device_id altr_sdram_ctrl_of_match[] = {
-- { .compatible = "altr,sdram-edac", },
-- {},
--};
--MODULE_DEVICE_TABLE(of, altr_sdram_ctrl_of_match);
--
- static struct platform_driver altr_sdram_edac_driver = {
- .probe = altr_sdram_probe,
- .remove = altr_sdram_remove,
-diff --git a/drivers/edac/altera_edac.h b/drivers/edac/altera_edac.h
-new file mode 100644
-index 000000000000..b744d914d976
---- /dev/null
-+++ b/drivers/edac/altera_edac.h
-@@ -0,0 +1,116 @@
-+/*
-+ *
-+ * Copyright (C) 2015 Altera Corporation
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+#ifndef _ALTERA_EDAC_H
-+#define _ALTERA_EDAC_H
-+
-+#include <linux/edac.h>
-+#include <linux/types.h>
-+
-+/* SDRAM Controller CtrlCfg Register */
-+#define CV_CTLCFG_OFST 0x00
-+
-+/* SDRAM Controller CtrlCfg Register Bit Masks */
-+#define CV_CTLCFG_ECC_EN 0x400
-+#define CV_CTLCFG_ECC_CORR_EN 0x800
-+#define CV_CTLCFG_GEN_SB_ERR 0x2000
-+#define CV_CTLCFG_GEN_DB_ERR 0x4000
-+
-+#define CV_CTLCFG_ECC_AUTO_EN (CV_CTLCFG_ECC_EN | \
-+ CV_CTLCFG_ECC_CORR_EN)
-+
-+/* SDRAM Controller Address Width Register */
-+#define CV_DRAMADDRW_OFST 0x2C
-+
-+/* SDRAM Controller Address Widths Field Register */
-+#define DRAMADDRW_COLBIT_MASK 0x001F
-+#define DRAMADDRW_COLBIT_SHIFT 0
-+#define DRAMADDRW_ROWBIT_MASK 0x03E0
-+#define DRAMADDRW_ROWBIT_SHIFT 5
-+#define CV_DRAMADDRW_BANKBIT_MASK 0x1C00
-+#define CV_DRAMADDRW_BANKBIT_SHIFT 10
-+#define CV_DRAMADDRW_CSBIT_MASK 0xE000
-+#define CV_DRAMADDRW_CSBIT_SHIFT 13
-+
-+/* SDRAM Controller Interface Data Width Register */
-+#define CV_DRAMIFWIDTH_OFST 0x30
-+
-+/* SDRAM Controller Interface Data Width Defines */
-+#define CV_DRAMIFWIDTH_16B_ECC 24
-+#define CV_DRAMIFWIDTH_32B_ECC 40
-+
-+/* SDRAM Controller DRAM Status Register */
-+#define CV_DRAMSTS_OFST 0x38
-+
-+/* SDRAM Controller DRAM Status Register Bit Masks */
-+#define CV_DRAMSTS_SBEERR 0x04
-+#define CV_DRAMSTS_DBEERR 0x08
-+#define CV_DRAMSTS_CORR_DROP 0x10
-+
-+/* SDRAM Controller DRAM IRQ Register */
-+#define CV_DRAMINTR_OFST 0x3C
-+
-+/* SDRAM Controller DRAM IRQ Register Bit Masks */
-+#define CV_DRAMINTR_INTREN 0x01
-+#define CV_DRAMINTR_SBEMASK 0x02
-+#define CV_DRAMINTR_DBEMASK 0x04
-+#define CV_DRAMINTR_CORRDROPMASK 0x08
-+#define CV_DRAMINTR_INTRCLR 0x10
-+
-+/* SDRAM Controller Single Bit Error Count Register */
-+#define CV_SBECOUNT_OFST 0x40
-+
-+/* SDRAM Controller Double Bit Error Count Register */
-+#define CV_DBECOUNT_OFST 0x44
-+
-+/* SDRAM Controller ECC Error Address Register */
-+#define CV_ERRADDR_OFST 0x48
-+
-+struct altr_sdram_prv_data {
-+ int ecc_ctrl_offset;
-+ int ecc_ctl_en_mask;
-+ int ecc_cecnt_offset;
-+ int ecc_uecnt_offset;
-+ int ecc_stat_offset;
-+ int ecc_stat_ce_mask;
-+ int ecc_stat_ue_mask;
-+ int ecc_saddr_offset;
-+ int ecc_daddr_offset;
-+ int ecc_irq_en_offset;
-+ int ecc_irq_en_mask;
-+ int ecc_irq_clr_offset;
-+ int ecc_irq_clr_mask;
-+ int ecc_cnt_rst_offset;
-+ int ecc_cnt_rst_mask;
-+#ifdef CONFIG_EDAC_DEBUG
-+ struct edac_dev_sysfs_attribute *eccmgr_sysfs_attr;
-+ int ecc_enable_mask;
-+ int ce_set_mask;
-+ int ue_set_mask;
-+ int ce_ue_trgr_offset;
-+#endif
-+};
-+
-+/* Altera SDRAM Memory Controller data */
-+struct altr_sdram_mc_data {
-+ struct regmap *mc_vbase;
-+ int sb_irq;
-+ int db_irq;
-+ const struct altr_sdram_prv_data *data;
-+};
-+
-+#endif /* #ifndef _ALTERA_EDAC_H */
---
-2.6.2
-
diff --git a/patches.altera/0036-EDAC-altera-Add-Arria10-EDAC-support.patch b/patches.altera/0036-EDAC-altera-Add-Arria10-EDAC-support.patch
deleted file mode 100644
index 8b909cbafe40f1..00000000000000
--- a/patches.altera/0036-EDAC-altera-Add-Arria10-EDAC-support.patch
+++ /dev/null
@@ -1,337 +0,0 @@
-From 55a09d124336781839cfed610e18ea7945782d49 Mon Sep 17 00:00:00 2001
-From: Thor Thayer <tthayer@opensource.altera.com>
-Date: Thu, 4 Jun 2015 09:28:47 -0500
-Subject: [PATCH 36/39] EDAC, altera: Add Arria10 EDAC support
-
-The Arria10 SDRAM and ECC system differs significantly from the
-Cyclone5 and Arria5 SoCs. This patch adds support for the Arria10
-SoC.
-1) IRQ handler needs to support SHARED IRQ
-2) Support sberr and dberr address reporting.
-
-Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
-Cc: Arnd Bergmann <arnd@arndb.de>
-Cc: devicetree@vger.kernel.org
-Cc: dinguyen@opensource.altera.com
-Cc: galak@codeaurora.org
-Cc: grant.likely@linaro.org
-Cc: ijc+devicetree@hellion.org.uk
-Cc: linux-arm-kernel@lists.infradead.org
-Cc: linux-edac <linux-edac@vger.kernel.org>
-Cc: m.chehab@samsung.com
-Cc: mark.rutland@arm.com
-Cc: pawel.moll@arm.com
-Cc: robh+dt@kernel.org
-Cc: tthayer.linux@gmail.com
-Link: http://lkml.kernel.org/r/1433428128-7292-4-git-send-email-tthayer@opensource.altera.com
-Signed-off-by: Borislav Petkov <bp@suse.de>
-(cherry picked from commit 73bcc942f4271fab2ea41e6a3992d3c2164faaa8)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/edac/altera_edac.c | 135 +++++++++++++++++++++++++++++++++++++++------
- drivers/edac/altera_edac.h | 85 ++++++++++++++++++++++++++++
- 2 files changed, 204 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
-index 4ac4e6c11ece..182c741adf3e 100644
---- a/drivers/edac/altera_edac.c
-+++ b/drivers/edac/altera_edac.c
-@@ -42,6 +42,7 @@ static const struct altr_sdram_prv_data c5_data = {
- .ecc_stat_ce_mask = CV_DRAMSTS_SBEERR,
- .ecc_stat_ue_mask = CV_DRAMSTS_DBEERR,
- .ecc_saddr_offset = CV_ERRADDR_OFST,
-+ .ecc_daddr_offset = CV_ERRADDR_OFST,
- .ecc_cecnt_offset = CV_SBECOUNT_OFST,
- .ecc_uecnt_offset = CV_DBECOUNT_OFST,
- .ecc_irq_en_offset = CV_DRAMINTR_OFST,
-@@ -57,37 +58,62 @@ static const struct altr_sdram_prv_data c5_data = {
- #endif
- };
-
-+static const struct altr_sdram_prv_data a10_data = {
-+ .ecc_ctrl_offset = A10_ECCCTRL1_OFST,
-+ .ecc_ctl_en_mask = A10_ECCCTRL1_ECC_EN,
-+ .ecc_stat_offset = A10_INTSTAT_OFST,
-+ .ecc_stat_ce_mask = A10_INTSTAT_SBEERR,
-+ .ecc_stat_ue_mask = A10_INTSTAT_DBEERR,
-+ .ecc_saddr_offset = A10_SERRADDR_OFST,
-+ .ecc_daddr_offset = A10_DERRADDR_OFST,
-+ .ecc_irq_en_offset = A10_ERRINTEN_OFST,
-+ .ecc_irq_en_mask = A10_ECC_IRQ_EN_MASK,
-+ .ecc_irq_clr_offset = A10_INTSTAT_OFST,
-+ .ecc_irq_clr_mask = (A10_INTSTAT_SBEERR | A10_INTSTAT_DBEERR),
-+ .ecc_cnt_rst_offset = A10_ECCCTRL1_OFST,
-+ .ecc_cnt_rst_mask = A10_ECC_CNT_RESET_MASK,
-+#ifdef CONFIG_EDAC_DEBUG
-+ .ce_ue_trgr_offset = A10_DIAGINTTEST_OFST,
-+ .ce_set_mask = A10_DIAGINT_TSERRA_MASK,
-+ .ue_set_mask = A10_DIAGINT_TDERRA_MASK,
-+#endif
-+};
-+
- static irqreturn_t altr_sdram_mc_err_handler(int irq, void *dev_id)
- {
- struct mem_ctl_info *mci = dev_id;
- struct altr_sdram_mc_data *drvdata = mci->pvt_info;
- const struct altr_sdram_prv_data *priv = drvdata->data;
-- u32 status, err_count, err_addr;
--
-- /* Error Address is shared by both SBE & DBE */
-- regmap_read(drvdata->mc_vbase, priv->ecc_saddr_offset, &err_addr);
-+ u32 status, err_count = 1, err_addr;
-
- regmap_read(drvdata->mc_vbase, priv->ecc_stat_offset, &status);
-
- if (status & priv->ecc_stat_ue_mask) {
-- regmap_read(drvdata->mc_vbase, priv->ecc_uecnt_offset,
-- &err_count);
-+ regmap_read(drvdata->mc_vbase, priv->ecc_daddr_offset,
-+ &err_addr);
-+ if (priv->ecc_uecnt_offset)
-+ regmap_read(drvdata->mc_vbase, priv->ecc_uecnt_offset,
-+ &err_count);
- panic("\nEDAC: [%d Uncorrectable errors @ 0x%08X]\n",
- err_count, err_addr);
- }
- if (status & priv->ecc_stat_ce_mask) {
-- regmap_read(drvdata->mc_vbase, priv->ecc_cecnt_offset,
-- &err_count);
-+ regmap_read(drvdata->mc_vbase, priv->ecc_saddr_offset,
-+ &err_addr);
-+ if (priv->ecc_uecnt_offset)
-+ regmap_read(drvdata->mc_vbase, priv->ecc_cecnt_offset,
-+ &err_count);
- edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, err_count,
- err_addr >> PAGE_SHIFT,
- err_addr & ~PAGE_MASK, 0,
- 0, 0, -1, mci->ctl_name, "");
-- }
--
-- regmap_write(drvdata->mc_vbase, priv->ecc_irq_clr_offset,
-- priv->ecc_irq_clr_mask);
-+ /* Clear IRQ to resume */
-+ regmap_write(drvdata->mc_vbase, priv->ecc_irq_clr_offset,
-+ priv->ecc_irq_clr_mask);
-
-- return IRQ_HANDLED;
-+ return IRQ_HANDLED;
-+ }
-+ return IRQ_NONE;
- }
-
- #ifdef CONFIG_EDAC_DEBUG
-@@ -203,10 +229,60 @@ static unsigned long get_total_mem(void)
-
- static const struct of_device_id altr_sdram_ctrl_of_match[] = {
- { .compatible = "altr,sdram-edac", .data = (void *)&c5_data},
-+ { .compatible = "altr,sdram-edac-a10", .data = (void *)&a10_data},
- {},
- };
- MODULE_DEVICE_TABLE(of, altr_sdram_ctrl_of_match);
-
-+static int a10_init(struct regmap *mc_vbase)
-+{
-+ if (regmap_update_bits(mc_vbase, A10_INTMODE_OFST,
-+ A10_INTMODE_SB_INT, A10_INTMODE_SB_INT)) {
-+ edac_printk(KERN_ERR, EDAC_MC,
-+ "Error setting SB IRQ mode\n");
-+ return -ENODEV;
-+ }
-+
-+ if (regmap_write(mc_vbase, A10_SERRCNTREG_OFST, 1)) {
-+ edac_printk(KERN_ERR, EDAC_MC,
-+ "Error setting trigger count\n");
-+ return -ENODEV;
-+ }
-+
-+ return 0;
-+}
-+
-+static int a10_unmask_irq(struct platform_device *pdev, u32 mask)
-+{
-+ void __iomem *sm_base;
-+ int ret = 0;
-+
-+ if (!request_mem_region(A10_SYMAN_INTMASK_CLR, sizeof(u32),
-+ dev_name(&pdev->dev))) {
-+ edac_printk(KERN_ERR, EDAC_MC,
-+ "Unable to request mem region\n");
-+ return -EBUSY;
-+ }
-+
-+ sm_base = ioremap(A10_SYMAN_INTMASK_CLR, sizeof(u32));
-+ if (!sm_base) {
-+ edac_printk(KERN_ERR, EDAC_MC,
-+ "Unable to ioremap device\n");
-+
-+ ret = -ENOMEM;
-+ goto release;
-+ }
-+
-+ iowrite32(mask, sm_base);
-+
-+ iounmap(sm_base);
-+
-+release:
-+ release_mem_region(A10_SYMAN_INTMASK_CLR, sizeof(u32));
-+
-+ return ret;
-+}
-+
- static int altr_sdram_probe(struct platform_device *pdev)
- {
- const struct of_device_id *id;
-@@ -217,8 +293,8 @@ static int altr_sdram_probe(struct platform_device *pdev)
- struct regmap *mc_vbase;
- struct dimm_info *dimm;
- u32 read_reg;
-- int irq, res = 0;
-- unsigned long mem_size;
-+ int irq, irq2, res = 0;
-+ unsigned long mem_size, irqflags = 0;
-
- id = of_match_device(altr_sdram_ctrl_of_match, &pdev->dev);
- if (!id)
-@@ -283,6 +359,9 @@ static int altr_sdram_probe(struct platform_device *pdev)
- return -ENODEV;
- }
-
-+ /* Arria10 has a 2nd IRQ */
-+ irq2 = platform_get_irq(pdev, 1);
-+
- layers[0].type = EDAC_MC_LAYER_CHIP_SELECT;
- layers[0].size = 1;
- layers[0].is_virt_csrow = true;
-@@ -327,8 +406,32 @@ static int altr_sdram_probe(struct platform_device *pdev)
- if (res < 0)
- goto err;
-
-+ /* Only the Arria10 has separate IRQs */
-+ if (irq2 > 0) {
-+ /* Arria10 specific initialization */
-+ res = a10_init(mc_vbase);
-+ if (res < 0)
-+ goto err2;
-+
-+ res = devm_request_irq(&pdev->dev, irq2,
-+ altr_sdram_mc_err_handler,
-+ IRQF_SHARED, dev_name(&pdev->dev), mci);
-+ if (res < 0) {
-+ edac_mc_printk(mci, KERN_ERR,
-+ "Unable to request irq %d\n", irq2);
-+ res = -ENODEV;
-+ goto err2;
-+ }
-+
-+ res = a10_unmask_irq(pdev, A10_DDR0_IRQ_MASK);
-+ if (res < 0)
-+ goto err2;
-+
-+ irqflags = IRQF_SHARED;
-+ }
-+
- res = devm_request_irq(&pdev->dev, irq, altr_sdram_mc_err_handler,
-- 0, dev_name(&pdev->dev), mci);
-+ irqflags, dev_name(&pdev->dev), mci);
- if (res < 0) {
- edac_mc_printk(mci, KERN_ERR,
- "Unable to request irq %d\n", irq);
-diff --git a/drivers/edac/altera_edac.h b/drivers/edac/altera_edac.h
-index b744d914d976..7b64dc7c4eb7 100644
---- a/drivers/edac/altera_edac.h
-+++ b/drivers/edac/altera_edac.h
-@@ -80,6 +80,91 @@
- /* SDRAM Controller ECC Error Address Register */
- #define CV_ERRADDR_OFST 0x48
-
-+/*-----------------------------------------*/
-+
-+/* SDRAM Controller EccCtrl Register */
-+#define A10_ECCCTRL1_OFST 0x00
-+
-+/* SDRAM Controller EccCtrl Register Bit Masks */
-+#define A10_ECCCTRL1_ECC_EN 0x001
-+#define A10_ECCCTRL1_CNT_RST 0x010
-+#define A10_ECCCTRL1_AWB_CNT_RST 0x100
-+#define A10_ECC_CNT_RESET_MASK (A10_ECCCTRL1_CNT_RST | \
-+ A10_ECCCTRL1_AWB_CNT_RST)
-+
-+/* SDRAM Controller Address Width Register */
-+#define CV_DRAMADDRW 0xFFC2502C
-+#define A10_DRAMADDRW 0xFFCFA0A8
-+
-+/* SDRAM Controller Address Widths Field Register */
-+#define DRAMADDRW_COLBIT_MASK 0x001F
-+#define DRAMADDRW_COLBIT_SHIFT 0
-+#define DRAMADDRW_ROWBIT_MASK 0x03E0
-+#define DRAMADDRW_ROWBIT_SHIFT 5
-+#define CV_DRAMADDRW_BANKBIT_MASK 0x1C00
-+#define CV_DRAMADDRW_BANKBIT_SHIFT 10
-+#define CV_DRAMADDRW_CSBIT_MASK 0xE000
-+#define CV_DRAMADDRW_CSBIT_SHIFT 13
-+
-+#define A10_DRAMADDRW_BANKBIT_MASK 0x3C00
-+#define A10_DRAMADDRW_BANKBIT_SHIFT 10
-+#define A10_DRAMADDRW_GRPBIT_MASK 0xC000
-+#define A10_DRAMADDRW_GRPBIT_SHIFT 14
-+#define A10_DRAMADDRW_CSBIT_MASK 0x70000
-+#define A10_DRAMADDRW_CSBIT_SHIFT 16
-+
-+/* SDRAM Controller Interface Data Width Register */
-+#define CV_DRAMIFWIDTH 0xFFC25030
-+#define A10_DRAMIFWIDTH 0xFFCFB008
-+
-+/* SDRAM Controller Interface Data Width Defines */
-+#define CV_DRAMIFWIDTH_16B_ECC 24
-+#define CV_DRAMIFWIDTH_32B_ECC 40
-+
-+#define A10_DRAMIFWIDTH_16B 0x0
-+#define A10_DRAMIFWIDTH_32B 0x1
-+#define A10_DRAMIFWIDTH_64B 0x2
-+
-+/* SDRAM Controller DRAM IRQ Register */
-+#define A10_ERRINTEN_OFST 0x10
-+
-+/* SDRAM Controller DRAM IRQ Register Bit Masks */
-+#define A10_ERRINTEN_SERRINTEN 0x01
-+#define A10_ERRINTEN_DERRINTEN 0x02
-+#define A10_ECC_IRQ_EN_MASK (A10_ERRINTEN_SERRINTEN | \
-+ A10_ERRINTEN_DERRINTEN)
-+
-+/* SDRAM Interrupt Mode Register */
-+#define A10_INTMODE_OFST 0x1C
-+#define A10_INTMODE_SB_INT 1
-+
-+/* SDRAM Controller Error Status Register */
-+#define A10_INTSTAT_OFST 0x20
-+
-+/* SDRAM Controller Error Status Register Bit Masks */
-+#define A10_INTSTAT_SBEERR 0x01
-+#define A10_INTSTAT_DBEERR 0x02
-+
-+/* SDRAM Controller ECC Error Address Register */
-+#define A10_DERRADDR_OFST 0x2C
-+#define A10_SERRADDR_OFST 0x30
-+
-+/* SDRAM Controller ECC Diagnostic Register */
-+#define A10_DIAGINTTEST_OFST 0x24
-+
-+#define A10_DIAGINT_TSERRA_MASK 0x0001
-+#define A10_DIAGINT_TDERRA_MASK 0x0100
-+
-+#define A10_SBERR_IRQ 34
-+#define A10_DBERR_IRQ 32
-+
-+/* SDRAM Single Bit Error Count Compare Set Register */
-+#define A10_SERRCNTREG_OFST 0x3C
-+
-+#define A10_SYMAN_INTMASK_CLR 0xFFD06098
-+#define A10_INTMASK_CLR_OFST 0x10
-+#define A10_DDR0_IRQ_MASK BIT(17)
-+
- struct altr_sdram_prv_data {
- int ecc_ctrl_offset;
- int ecc_ctl_en_mask;
---
-2.6.2
-
diff --git a/patches.altera/0037-arm-socfpga-dts-Add-Arria10-SDRAM-EDAC-DTS-support.patch b/patches.altera/0037-arm-socfpga-dts-Add-Arria10-SDRAM-EDAC-DTS-support.patch
deleted file mode 100644
index c19640cb422b33..00000000000000
--- a/patches.altera/0037-arm-socfpga-dts-Add-Arria10-SDRAM-EDAC-DTS-support.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 38ebd6db21176b14e4db3d7d782633f82c7dfbd9 Mon Sep 17 00:00:00 2001
-From: Thor Thayer <tthayer@opensource.altera.com>
-Date: Thu, 4 Jun 2015 09:28:48 -0500
-Subject: [PATCH 37/39] arm: socfpga: dts: Add Arria10 SDRAM EDAC DTS support
-
-Add support for the Arria10 SDRAM EDAC. Update the bindings document for
-the new match string.
-
-Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
-Cc: Arnd Bergmann <arnd@arndb.de>
-Cc: devicetree@vger.kernel.org
-Cc: dinguyen@opensource.altera.com
-Cc: galak@codeaurora.org
-Cc: grant.likely@linaro.org
-Cc: ijc+devicetree@hellion.org.uk
-Cc: linux-arm-kernel@lists.infradead.org
-Cc: linux-edac <linux-edac@vger.kernel.org>
-Cc: m.chehab@samsung.com
-Cc: mark.rutland@arm.com
-Cc: pawel.moll@arm.com
-Cc: robh+dt@kernel.org
-Cc: tthayer.linux@gmail.com
-Link: http://lkml.kernel.org/r/1433428128-7292-5-git-send-email-tthayer@opensource.altera.com
-Signed-off-by: Borislav Petkov <bp@suse.de>
-(cherry picked from commit 54b4a8f57848bb08dcbdfba94b9b1ddef1c23358)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- .../devicetree/bindings/arm/altera/socfpga-sdram-edac.txt | 2 +-
- arch/arm/boot/dts/socfpga_arria10.dtsi | 11 +++++++++++
- 2 files changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt b/Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
-index d0ce01da5c59..f5ad0ff69fae 100644
---- a/Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
-+++ b/Documentation/devicetree/bindings/arm/altera/socfpga-sdram-edac.txt
-@@ -2,7 +2,7 @@ Altera SOCFPGA SDRAM Error Detection & Correction [EDAC]
- The EDAC accesses a range of registers in the SDRAM controller.
-
- Required properties:
--- compatible : should contain "altr,sdram-edac";
-+- compatible : should contain "altr,sdram-edac" or "altr,sdram-edac-a10"
- - altr,sdr-syscon : phandle of the sdr module
- - interrupts : Should contain the SDRAM ECC IRQ in the
- appropriate format for the IRQ controller.
-diff --git a/arch/arm/boot/dts/socfpga_arria10.dtsi b/arch/arm/boot/dts/socfpga_arria10.dtsi
-index bcf3b781a9fc..2340fcb2b535 100644
---- a/arch/arm/boot/dts/socfpga_arria10.dtsi
-+++ b/arch/arm/boot/dts/socfpga_arria10.dtsi
-@@ -558,6 +558,17 @@
- status = "disabled";
- };
-
-+ sdr: sdr@ffc25000 {
-+ compatible = "syscon";
-+ reg = <0xffcfb100 0x80>;
-+ };
-+
-+ sdramedac {
-+ compatible = "altr,sdram-edac-a10";
-+ altr,sdr-syscon = <&sdr>;
-+ interrupts = <0 2 4>, <0 0 4>;
-+ };
-+
- L2: l2-cache@fffff000 {
- compatible = "arm,pl310-cache";
- reg = <0xfffff000 0x1000>;
---
-2.6.2
-
diff --git a/patches.altera/0038-EDAC-altera-Do-not-allow-suspend-when-EDAC-is-enable.patch b/patches.altera/0038-EDAC-altera-Do-not-allow-suspend-when-EDAC-is-enable.patch
deleted file mode 100644
index e7cd3c5499eae2..00000000000000
--- a/patches.altera/0038-EDAC-altera-Do-not-allow-suspend-when-EDAC-is-enable.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From d3e8a3bde5d6c4b9df0d7044a884422547a99937 Mon Sep 17 00:00:00 2001
-From: Alan Tull <atull@opensource.altera.com>
-Date: Fri, 5 Jun 2015 08:49:15 -0500
-Subject: [PATCH 38/39] EDAC, altera: Do not allow suspend when EDAC is enabled
-
-Suspend-to-RAM and EDAC support are mutually exclusive on SOCFPGA. If
-EDAC is enabled, it will prevent the platform from going into suspend.
-
-The reason is that the IRQ vectors for OCRAM reside on DDR and in
-Suspend-to-RAM mode we're executing out of OCRAM. If an ECC error
-occurs, we can't handle it so it was decided to make them mutually
-exclusive.
-
-Signed-off-by: Alan Tull <atull@opensource.altera.com>
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-Cc: dinh.linux@gmail.com
-Cc: dougthompson@xmission.com
-Cc: linux-edac <linux-edac@vger.kernel.org>
-Cc: mchehab@osg.samsung.com
-Cc: tthayer@opensource.altera.com
-Link: http://lkml.kernel.org/r/1433512155-9906-1-git-send-email-dinguyen@opensource.altera.com
-Signed-off-by: Borislav Petkov <bp@suse.de>
-(cherry picked from commit 6f2b6422d4787ffa72bd81abdc1b503dbf87a49a)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- drivers/edac/altera_edac.c | 20 ++++++++++++++++++++
- 1 file changed, 20 insertions(+)
-
-diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
-index 182c741adf3e..23ef0917483c 100644
---- a/drivers/edac/altera_edac.c
-+++ b/drivers/edac/altera_edac.c
-@@ -477,11 +477,31 @@ static int altr_sdram_remove(struct platform_device *pdev)
- return 0;
- }
-
-+/*
-+ * If you want to suspend, need to disable EDAC by removing it
-+ * from the device tree or defconfig.
-+ */
-+#ifdef CONFIG_PM
-+static int altr_sdram_prepare(struct device *dev)
-+{
-+ pr_err("Suspend not allowed when EDAC is enabled.\n");
-+
-+ return -EPERM;
-+}
-+
-+static const struct dev_pm_ops altr_sdram_pm_ops = {
-+ .prepare = altr_sdram_prepare,
-+};
-+#endif
-+
- static struct platform_driver altr_sdram_edac_driver = {
- .probe = altr_sdram_probe,
- .remove = altr_sdram_remove,
- .driver = {
- .name = "altr_sdram_edac",
-+#ifdef CONFIG_PM
-+ .pm = &altr_sdram_pm_ops,
-+#endif
- .of_match_table = altr_sdram_ctrl_of_match,
- },
- };
---
-2.6.2
-
diff --git a/patches.altera/0039-ARM-dts-socfpga-Add-support-of-Terasic-DE0-Atlas-boa.patch b/patches.altera/0039-ARM-dts-socfpga-Add-support-of-Terasic-DE0-Atlas-boa.patch
deleted file mode 100644
index 3359223d5f635c..00000000000000
--- a/patches.altera/0039-ARM-dts-socfpga-Add-support-of-Terasic-DE0-Atlas-boa.patch
+++ /dev/null
@@ -1,144 +0,0 @@
-From 41d251e155fb401b459c88e58b0182f3b3a87ca5 Mon Sep 17 00:00:00 2001
-From: Dalon Westergreen <dwesterg@gmail.com>
-Date: Wed, 8 Jul 2015 16:48:49 -0700
-Subject: [PATCH 39/39] ARM: dts: socfpga: Add support of Terasic DE0 Atlas
- board
-
-The Terasic DE0 Atlas board is also known as the DE0-Nano board.
-This patch adds the DTS board file for the DE0-Nano Sockit board, and not
-the DE0 Nano "Development Board".
-
-Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
-(cherry picked from commit 57c0f8c9c45365d167f8606dad7fde9565432b7a)
-Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
----
- arch/arm/boot/dts/Makefile | 1
- arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts | 111 ++++++++++++++++++++++
- 2 files changed, 112 insertions(+)
- create mode 100644 arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts
-
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -497,6 +497,7 @@ dtb-$(CONFIG_ARCH_SOCFPGA) += \
- socfpga_arria5_socdk.dtb \
- socfpga_arria10_socdk_sdmmc.dtb \
- socfpga_cyclone5_socdk.dtb \
-+ socfpga_cyclone5_de0_sockit.dtb \
- socfpga_cyclone5_sockit.dtb \
- socfpga_cyclone5_socrates.dtb \
- socfpga_vt.dtb
---- /dev/null
-+++ b/arch/arm/boot/dts/socfpga_cyclone5_de0_sockit.dts
-@@ -0,0 +1,111 @@
-+/*
-+ * Copyright Altera Corporation (C) 2015. All rights reserved.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * This program is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program. If not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+#include "socfpga_cyclone5.dtsi"
-+
-+/ {
-+ model = "Terasic DE-0(Atlas)";
-+ compatible = "altr,socfpga-cyclone5", "altr,socfpga";
-+
-+ chosen {
-+ bootargs = "earlyprintk";
-+ stdout-path = "serial0:115200n8";
-+ };
-+
-+ memory {
-+ name = "memory";
-+ device_type = "memory";
-+ reg = <0x0 0x40000000>; /* 1GB */
-+ };
-+
-+ aliases {
-+ ethernet0 = &gmac1;
-+ };
-+
-+ regulator_3_3v: 3-3-v-regulator {
-+ compatible = "regulator-fixed";
-+ regulator-name = "3.3V";
-+ regulator-min-microvolt = <3300000>;
-+ regulator-max-microvolt = <3300000>;
-+ };
-+
-+ leds {
-+ compatible = "gpio-leds";
-+ hps0 {
-+ label = "hps_led0";
-+ gpios = <&portb 24 0>;
-+ linux,default-trigger = "heartbeat";
-+ };
-+ };
-+};
-+
-+&gmac1 {
-+ status = "okay";
-+ phy-mode = "rgmii";
-+
-+ txd0-skew-ps = <0>; /* -420ps */
-+ txd1-skew-ps = <0>; /* -420ps */
-+ txd2-skew-ps = <0>; /* -420ps */
-+ txd3-skew-ps = <0>; /* -420ps */
-+ rxd0-skew-ps = <420>; /* 0ps */
-+ rxd1-skew-ps = <420>; /* 0ps */
-+ rxd2-skew-ps = <420>; /* 0ps */
-+ rxd3-skew-ps = <420>; /* 0ps */
-+ txen-skew-ps = <0>; /* -420ps */
-+ txc-skew-ps = <1860>; /* 960ps */
-+ rxdv-skew-ps = <420>; /* 0ps */
-+ rxc-skew-ps = <1680>; /* 780ps */
-+
-+ max-frame-size = <3800>;
-+};
-+
-+&gpio0 {
-+ status = "okay";
-+};
-+
-+&gpio1 {
-+ status = "okay";
-+};
-+
-+&gpio2 {
-+ status = "okay";
-+};
-+
-+&i2c0 {
-+ status = "okay";
-+ speed-mode = <0>;
-+
-+ adxl345: adxl345@0 {
-+ compatible = "adi,adxl345";
-+ reg = <0x53>;
-+
-+ interrupt-parent = <&portc>;
-+ interrupts = <3 2>;
-+ };
-+};
-+
-+&mmc0 {
-+ vmmc-supply = <&regulator_3_3v>;
-+ vqmmc-supply = <&regulator_3_3v>;
-+};
-+
-+&uart0 {
-+ status = "okay";
-+};
-+
-+&usb1 {
-+ status = "okay";
-+};
diff --git a/patches.altera/arm-socfpga-fix-build-error-due-to-secondary_startup.patch b/patches.altera/arm-socfpga-fix-build-error-due-to-secondary_startup.patch
deleted file mode 100644
index 513e6a407a4015..00000000000000
--- a/patches.altera/arm-socfpga-fix-build-error-due-to-secondary_startup.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 89b8da06ba302dd130df60df7964ccd3ab151cd6 Mon Sep 17 00:00:00 2001
-From: Kevin Hilman <khilman@linaro.org>
-Date: Thu, 11 Jun 2015 15:41:58 -0700
-Subject: ARM: socfpga: fix build error due to secondary_startup
-
-After commit 02b4e2756e01 (ARM: v7 setup function should invalidate L1
-cache) the soc specific secondary_startup is removed, causing build
-failures:
-
-../arch/arm/mach-socfpga/platsmp.c: In function 'socfpga_a10_boot_secondary':
-../arch/arm/mach-socfpga/platsmp.c:66:140: error: 'socfpga_secondary_startup' undeclared (first use in this function)
-../arch/arm/mach-socfpga/platsmp.c:66:140: note: each undeclared identifier is reported only once for each function it appears in
-
-To fix, use the generic secondary_startup.
-
-Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
-Signed-off-by: Kevin Hilman <khilman@linaro.org>
-
----
- arch/arm/mach-socfpga/platsmp.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/arch/arm/mach-socfpga/platsmp.c
-+++ b/arch/arm/mach-socfpga/platsmp.c
-@@ -63,7 +63,7 @@ static int socfpga_a10_boot_secondary(un
- SOCFPGA_A10_RSTMGR_MODMPURST);
- memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
-
-- writel(virt_to_phys(socfpga_secondary_startup),
-+ writel(virt_to_phys(secondary_startup),
- sys_manager_base_addr + (socfpga_cpu1start_addr & 0x00000fff));
-
- flush_cache_all();
diff --git a/patches.ktap/ktap-0.4.patch b/patches.ktap/ktap-0.4.patch
deleted file mode 100644
index eee5885e18b4f8..00000000000000
--- a/patches.ktap/ktap-0.4.patch
+++ /dev/null
@@ -1,23278 +0,0 @@
-From 982d59f0bfdb7a85fd64fcebf4d18b49dfdf5120 Mon Sep 17 00:00:00 2001
-From: Li xin <lixin.fnst@cn.fujitsu.com>
-Date: Fri, 17 Oct 2014 15:06:28 +0300
-Subject: [PATCH] ktap-0.4
-
----
- drivers/staging/Kconfig | 2
- drivers/staging/Makefile | 1
- drivers/staging/ktap/Kconfig | 32
- drivers/staging/ktap/Makefile | 203 +
- drivers/staging/ktap/README.md | 167
- drivers/staging/ktap/RELEASES.txt | 155
- drivers/staging/ktap/doc/tutorial.md | 691 +++
- drivers/staging/ktap/include/ktap_ffi.h | 180
- drivers/staging/ktap/include/ktap_opcodes.h | 239 +
- drivers/staging/ktap/include/ktap_types.h | 609 +++
- drivers/staging/ktap/runtime/ffi/call_x86_64.S | 143
- drivers/staging/ktap/runtime/ffi/cdata.c | 67
- drivers/staging/ktap/runtime/ffi/ffi_call.c | 427 ++
- drivers/staging/ktap/runtime/ffi/ffi_symbol.c | 174
- drivers/staging/ktap/runtime/ffi/ffi_type.c | 51
- drivers/staging/ktap/runtime/ffi/ffi_util.c | 92
- drivers/staging/ktap/runtime/kp_amalg.c | 43
- drivers/staging/ktap/runtime/kp_load.c | 401 ++
- drivers/staging/ktap/runtime/kp_load.h | 6
- drivers/staging/ktap/runtime/kp_obj.c | 478 ++
- drivers/staging/ktap/runtime/kp_obj.h | 29
- drivers/staging/ktap/runtime/kp_opcode.c | 134
- drivers/staging/ktap/runtime/kp_str.c | 460 ++
- drivers/staging/ktap/runtime/kp_str.h | 20
- drivers/staging/ktap/runtime/kp_tab.c | 1396 +++++++
- drivers/staging/ktap/runtime/kp_tab.h | 32
- drivers/staging/ktap/runtime/kp_transport.c | 641 +++
- drivers/staging/ktap/runtime/kp_transport.h | 13
- drivers/staging/ktap/runtime/kp_vm.c | 1496 +++++++
- drivers/staging/ktap/runtime/kp_vm.h | 16
- drivers/staging/ktap/runtime/ktap.c | 217 +
- drivers/staging/ktap/runtime/ktap.h | 130
- drivers/staging/ktap/runtime/lib_ansi.c | 155
- drivers/staging/ktap/runtime/lib_base.c | 607 +++
- drivers/staging/ktap/runtime/lib_ffi.c | 50
- drivers/staging/ktap/runtime/lib_kdebug.c | 426 ++
- drivers/staging/ktap/runtime/lib_timer.c | 193
- drivers/staging/ktap/samples/ansi/ansi_color_demo.kp | 22
- drivers/staging/ktap/samples/basic/backtrace.kp | 6
- drivers/staging/ktap/samples/basic/event_trigger.kp | 24
- drivers/staging/ktap/samples/basic/event_trigger_ftrace.kp | 28
- drivers/staging/ktap/samples/basic/ftrace.kp | 6
- drivers/staging/ktap/samples/basic/function_time.kp | 57
- drivers/staging/ktap/samples/basic/kretprobe.kp | 6
- drivers/staging/ktap/samples/ffi/ffi_kmalloc.kp | 19
- drivers/staging/ktap/samples/ffi/printk.kp | 10
- drivers/staging/ktap/samples/ffi/sched_clock.kp | 6
- drivers/staging/ktap/samples/game/tetris.kp | 293 +
- drivers/staging/ktap/samples/helloworld.kp | 3
- drivers/staging/ktap/samples/interrupt/hardirq_time.kp | 24
- drivers/staging/ktap/samples/interrupt/softirq_time.kp | 24
- drivers/staging/ktap/samples/io/kprobes-do-sys-open.kp | 20
- drivers/staging/ktap/samples/io/traceio.kp | 54
- drivers/staging/ktap/samples/mem/kmalloc-top.kp | 17
- drivers/staging/ktap/samples/mem/kmem.kp | 30
- drivers/staging/ktap/samples/profiling/function_profiler.kp | 41
- drivers/staging/ktap/samples/profiling/stack_profile.kp | 30
- drivers/staging/ktap/samples/schedule/sched_transition.kp | 5
- drivers/staging/ktap/samples/schedule/schedtimes.kp | 125
- drivers/staging/ktap/samples/syscalls/errinfo.kp | 145
- drivers/staging/ktap/samples/syscalls/execve.kp | 8
- drivers/staging/ktap/samples/syscalls/opensnoop.kp | 31
- drivers/staging/ktap/samples/syscalls/sctop.kp | 13
- drivers/staging/ktap/samples/syscalls/syscalls.kp | 6
- drivers/staging/ktap/samples/syscalls/syscalls_count.kp | 54
- drivers/staging/ktap/samples/syscalls/syscalls_count_by_proc.kp | 22
- drivers/staging/ktap/samples/syscalls/syslatl.kp | 30
- drivers/staging/ktap/samples/syscalls/syslist.kp | 31
- drivers/staging/ktap/samples/tracepoints/eventcount.kp | 210 +
- drivers/staging/ktap/samples/tracepoints/eventcount_by_proc.kp | 57
- drivers/staging/ktap/samples/tracepoints/tracepoints.kp | 6
- drivers/staging/ktap/samples/userspace/gcc_unwind.kp | 9
- drivers/staging/ktap/samples/userspace/glibc_func_hist.kp | 44
- drivers/staging/ktap/samples/userspace/glibc_sdt.kp | 11
- drivers/staging/ktap/samples/userspace/glibc_trace.kp | 11
- drivers/staging/ktap/samples/userspace/malloc_free.kp | 20
- drivers/staging/ktap/samples/userspace/malloc_size_hist.kp | 22
- drivers/staging/ktap/test/arg.kp | 24
- drivers/staging/ktap/test/arithmetic.kp | 50
- drivers/staging/ktap/test/benchmark/sembench.c | 556 ++
- drivers/staging/ktap/test/benchmark/test.sh | 26
- drivers/staging/ktap/test/concat.kp | 15
- drivers/staging/ktap/test/count.kp | 20
- drivers/staging/ktap/test/ffi/.gitignore | 2
- drivers/staging/ktap/test/ffi/Makefile | 46
- drivers/staging/ktap/test/ffi/cparser_test.c | 322 +
- drivers/staging/ktap/test/ffi/ffi_test.kp | 47
- drivers/staging/ktap/test/ffi/ktap_ffi_test.c | 64
- drivers/staging/ktap/test/fibonacci.kp | 36
- drivers/staging/ktap/test/function.kp | 88
- drivers/staging/ktap/test/if.kp | 24
- drivers/staging/ktap/test/kprobe.kp | 19
- drivers/staging/ktap/test/kretprobe.kp | 14
- drivers/staging/ktap/test/ksym.kp | 17
- drivers/staging/ktap/test/len.kp | 25
- drivers/staging/ktap/test/looping.kp | 40
- drivers/staging/ktap/test/pairs.kp | 84
- drivers/staging/ktap/test/ptable.kp | 46
- drivers/staging/ktap/test/run_test.sh | 62
- drivers/staging/ktap/test/stack_overflow.kp | 9
- drivers/staging/ktap/test/table.kp | 71
- drivers/staging/ktap/test/timer.kp | 28
- drivers/staging/ktap/test/tracepoint.kp | 22
- drivers/staging/ktap/test/zerodivide.kp | 5
- drivers/staging/ktap/userspace/code.c | 998 +++++
- drivers/staging/ktap/userspace/cparser.h | 202 +
- drivers/staging/ktap/userspace/dump.c | 251 +
- drivers/staging/ktap/userspace/eventdef.c | 857 ++++
- drivers/staging/ktap/userspace/ffi/cparser.c | 1755 ++++++++
- drivers/staging/ktap/userspace/ffi/ctype.c | 551 ++
- drivers/staging/ktap/userspace/ktapc.h | 393 ++
- drivers/staging/ktap/userspace/ktapio.c | 106
- drivers/staging/ktap/userspace/lex.c | 632 +++
- drivers/staging/ktap/userspace/main.c | 727 +++
- drivers/staging/ktap/userspace/parser.c | 1963 ++++++++++
- drivers/staging/ktap/userspace/symbol.c | 291 +
- drivers/staging/ktap/userspace/symbol.h | 50
- drivers/staging/ktap/userspace/util.c | 381 +
- 118 files changed, 22675 insertions(+)
- create mode 100644 drivers/staging/ktap/Kconfig
- create mode 100644 drivers/staging/ktap/Makefile
- create mode 100644 drivers/staging/ktap/README.md
- create mode 100644 drivers/staging/ktap/RELEASES.txt
- create mode 100644 drivers/staging/ktap/doc/tutorial.md
- create mode 100644 drivers/staging/ktap/include/ktap_ffi.h
- create mode 100644 drivers/staging/ktap/include/ktap_opcodes.h
- create mode 100644 drivers/staging/ktap/include/ktap_types.h
- create mode 100644 drivers/staging/ktap/runtime/ffi/call_x86_64.S
- create mode 100644 drivers/staging/ktap/runtime/ffi/cdata.c
- create mode 100644 drivers/staging/ktap/runtime/ffi/ffi_call.c
- create mode 100644 drivers/staging/ktap/runtime/ffi/ffi_symbol.c
- create mode 100644 drivers/staging/ktap/runtime/ffi/ffi_type.c
- create mode 100644 drivers/staging/ktap/runtime/ffi/ffi_util.c
- create mode 100644 drivers/staging/ktap/runtime/kp_amalg.c
- create mode 100644 drivers/staging/ktap/runtime/kp_load.c
- create mode 100644 drivers/staging/ktap/runtime/kp_load.h
- create mode 100644 drivers/staging/ktap/runtime/kp_obj.c
- create mode 100644 drivers/staging/ktap/runtime/kp_obj.h
- create mode 100644 drivers/staging/ktap/runtime/kp_opcode.c
- create mode 100644 drivers/staging/ktap/runtime/kp_str.c
- create mode 100644 drivers/staging/ktap/runtime/kp_str.h
- create mode 100644 drivers/staging/ktap/runtime/kp_tab.c
- create mode 100644 drivers/staging/ktap/runtime/kp_tab.h
- create mode 100644 drivers/staging/ktap/runtime/kp_transport.c
- create mode 100644 drivers/staging/ktap/runtime/kp_transport.h
- create mode 100644 drivers/staging/ktap/runtime/kp_vm.c
- create mode 100644 drivers/staging/ktap/runtime/kp_vm.h
- create mode 100644 drivers/staging/ktap/runtime/ktap.c
- create mode 100644 drivers/staging/ktap/runtime/ktap.h
- create mode 100644 drivers/staging/ktap/runtime/lib_ansi.c
- create mode 100644 drivers/staging/ktap/runtime/lib_base.c
- create mode 100644 drivers/staging/ktap/runtime/lib_ffi.c
- create mode 100644 drivers/staging/ktap/runtime/lib_kdebug.c
- create mode 100644 drivers/staging/ktap/runtime/lib_timer.c
- create mode 100644 drivers/staging/ktap/samples/ansi/ansi_color_demo.kp
- create mode 100644 drivers/staging/ktap/samples/basic/backtrace.kp
- create mode 100644 drivers/staging/ktap/samples/basic/event_trigger.kp
- create mode 100644 drivers/staging/ktap/samples/basic/event_trigger_ftrace.kp
- create mode 100644 drivers/staging/ktap/samples/basic/ftrace.kp
- create mode 100644 drivers/staging/ktap/samples/basic/function_time.kp
- create mode 100644 drivers/staging/ktap/samples/basic/kretprobe.kp
- create mode 100644 drivers/staging/ktap/samples/ffi/ffi_kmalloc.kp
- create mode 100644 drivers/staging/ktap/samples/ffi/printk.kp
- create mode 100644 drivers/staging/ktap/samples/ffi/sched_clock.kp
- create mode 100644 drivers/staging/ktap/samples/game/tetris.kp
- create mode 100644 drivers/staging/ktap/samples/helloworld.kp
- create mode 100644 drivers/staging/ktap/samples/interrupt/hardirq_time.kp
- create mode 100644 drivers/staging/ktap/samples/interrupt/softirq_time.kp
- create mode 100644 drivers/staging/ktap/samples/io/kprobes-do-sys-open.kp
- create mode 100644 drivers/staging/ktap/samples/io/traceio.kp
- create mode 100644 drivers/staging/ktap/samples/mem/kmalloc-top.kp
- create mode 100644 drivers/staging/ktap/samples/mem/kmem.kp
- create mode 100644 drivers/staging/ktap/samples/profiling/function_profiler.kp
- create mode 100644 drivers/staging/ktap/samples/profiling/stack_profile.kp
- create mode 100644 drivers/staging/ktap/samples/schedule/sched_transition.kp
- create mode 100644 drivers/staging/ktap/samples/schedule/schedtimes.kp
- create mode 100644 drivers/staging/ktap/samples/syscalls/errinfo.kp
- create mode 100644 drivers/staging/ktap/samples/syscalls/execve.kp
- create mode 100644 drivers/staging/ktap/samples/syscalls/opensnoop.kp
- create mode 100644 drivers/staging/ktap/samples/syscalls/sctop.kp
- create mode 100644 drivers/staging/ktap/samples/syscalls/syscalls.kp
- create mode 100644 drivers/staging/ktap/samples/syscalls/syscalls_count.kp
- create mode 100644 drivers/staging/ktap/samples/syscalls/syscalls_count_by_proc.kp
- create mode 100644 drivers/staging/ktap/samples/syscalls/syslatl.kp
- create mode 100644 drivers/staging/ktap/samples/syscalls/syslist.kp
- create mode 100644 drivers/staging/ktap/samples/tracepoints/eventcount.kp
- create mode 100644 drivers/staging/ktap/samples/tracepoints/eventcount_by_proc.kp
- create mode 100644 drivers/staging/ktap/samples/tracepoints/tracepoints.kp
- create mode 100644 drivers/staging/ktap/samples/userspace/gcc_unwind.kp
- create mode 100644 drivers/staging/ktap/samples/userspace/glibc_func_hist.kp
- create mode 100644 drivers/staging/ktap/samples/userspace/glibc_sdt.kp
- create mode 100644 drivers/staging/ktap/samples/userspace/glibc_trace.kp
- create mode 100644 drivers/staging/ktap/samples/userspace/malloc_free.kp
- create mode 100644 drivers/staging/ktap/samples/userspace/malloc_size_hist.kp
- create mode 100644 drivers/staging/ktap/test/arg.kp
- create mode 100644 drivers/staging/ktap/test/arithmetic.kp
- create mode 100644 drivers/staging/ktap/test/benchmark/sembench.c
- create mode 100644 drivers/staging/ktap/test/benchmark/test.sh
- create mode 100644 drivers/staging/ktap/test/concat.kp
- create mode 100644 drivers/staging/ktap/test/count.kp
- create mode 100644 drivers/staging/ktap/test/ffi/.gitignore
- create mode 100644 drivers/staging/ktap/test/ffi/Makefile
- create mode 100644 drivers/staging/ktap/test/ffi/cparser_test.c
- create mode 100644 drivers/staging/ktap/test/ffi/ffi_test.kp
- create mode 100644 drivers/staging/ktap/test/ffi/ktap_ffi_test.c
- create mode 100644 drivers/staging/ktap/test/fibonacci.kp
- create mode 100644 drivers/staging/ktap/test/function.kp
- create mode 100644 drivers/staging/ktap/test/if.kp
- create mode 100644 drivers/staging/ktap/test/kprobe.kp
- create mode 100644 drivers/staging/ktap/test/kretprobe.kp
- create mode 100644 drivers/staging/ktap/test/ksym.kp
- create mode 100644 drivers/staging/ktap/test/len.kp
- create mode 100644 drivers/staging/ktap/test/looping.kp
- create mode 100644 drivers/staging/ktap/test/pairs.kp
- create mode 100644 drivers/staging/ktap/test/ptable.kp
- create mode 100644 drivers/staging/ktap/test/run_test.sh
- create mode 100644 drivers/staging/ktap/test/stack_overflow.kp
- create mode 100644 drivers/staging/ktap/test/table.kp
- create mode 100644 drivers/staging/ktap/test/timer.kp
- create mode 100644 drivers/staging/ktap/test/tracepoint.kp
- create mode 100644 drivers/staging/ktap/test/zerodivide.kp
- create mode 100644 drivers/staging/ktap/userspace/code.c
- create mode 100644 drivers/staging/ktap/userspace/cparser.h
- create mode 100644 drivers/staging/ktap/userspace/dump.c
- create mode 100644 drivers/staging/ktap/userspace/eventdef.c
- create mode 100644 drivers/staging/ktap/userspace/ffi/cparser.c
- create mode 100644 drivers/staging/ktap/userspace/ffi/ctype.c
- create mode 100644 drivers/staging/ktap/userspace/ktapc.h
- create mode 100644 drivers/staging/ktap/userspace/ktapio.c
- create mode 100644 drivers/staging/ktap/userspace/lex.c
- create mode 100644 drivers/staging/ktap/userspace/main.c
- create mode 100644 drivers/staging/ktap/userspace/parser.c
- create mode 100644 drivers/staging/ktap/userspace/symbol.c
- create mode 100644 drivers/staging/ktap/userspace/symbol.h
- create mode 100644 drivers/staging/ktap/userspace/util.c
-
---- a/drivers/staging/Kconfig
-+++ b/drivers/staging/Kconfig
-@@ -146,4 +146,6 @@ source "drivers/staging/dgnc/Kconfig"
-
- source "drivers/staging/dgap/Kconfig"
-
-+source "drivers/staging/ktap/Kconfig"
-+
- endif # STAGING
---- a/drivers/staging/Makefile
-+++ b/drivers/staging/Makefile
-@@ -65,3 +65,4 @@ obj-$(CONFIG_XILLYBUS) += xillybus/
- obj-$(CONFIG_DGNC) += dgnc/
- obj-$(CONFIG_DGAP) += dgap/
- obj-$(CONFIG_MTD_SPINAND_MT29F) += mt29f_spinand/
-+obj-$(CONFIG_KTAP) += ktap/
---- /dev/null
-+++ b/drivers/staging/ktap/Kconfig
-@@ -0,0 +1,32 @@
-+config KTAP
-+ tristate "a programable dynamic tracing tool for Linux"
-+ depends on PERF_EVENTS && EVENT_TRACING
-+ default n
-+ help
-+ ktap is a new script-based dynamic tracing tool for Linux,
-+ it uses a scripting language and lets users trace the
-+ Linux kernel dynamically. ktap is designed to give
-+ operational insights with interoperability that allow
-+ users to tune, troubleshoot and extend kernel and application.
-+ It's similar with Linux Systemtap and Solaris Dtrace.
-+
-+ ktap have different design principles from Linux mainstream
-+ dynamic tracing language in that it's based on bytecode,
-+ so it doesn't depend upon GCC, doesn't require compiling
-+ kernel module for each script, safe to use in production
-+ environment, fulfilling the embedded ecosystem's tracing needs.
-+
-+ See ktap tutorial for more information:
-+ http://www.ktap.org/doc/tutorial.html
-+
-+config KTAP_FFI
-+ tristate "FFI support for ktap"
-+ depends on KTAP
-+ depends on X86_64
-+ default n
-+ help
-+ This option brings FFI support to ktap. With FFI enabled ktap,
-+ users can call into native kernel C function directly in ktap
-+ script. Except for a new cdef keyword, this option also adds
-+ a ffi module which exports helper functions like ffi.new and
-+ ffi.sizeof.
---- /dev/null
-+++ b/drivers/staging/ktap/Makefile
-@@ -0,0 +1,203 @@
-+
-+#
-+# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
-+# (this will also disable resolve resolving symbols in DSO functionality)
-+#
-+# Define FFI if you want to compile ktap with FFI support. By default This
-+# toggle is off.
-+#
-+# Define amalg to enable amalgamation build, This compiles the ktapvm as
-+# one huge C file and allows GCC to generate faster and shorter code. Alas,
-+# this requires lots of memory during the build.
-+# Recommend to use amalgmation build as default.
-+amalg = 1
-+NO_LIBELF = 1
-+# Do not instrument the tracer itself:
-+ifdef CONFIG_FUNCTION_TRACER
-+ORIG_CFLAGS := $(KBUILD_CFLAGS)
-+KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
-+endif
-+
-+all: mod ktap
-+
-+INC = include
-+RUNTIME = runtime
-+
-+FFIDIR = $(RUNTIME)/ffi
-+KTAP_LIBS = -lpthread
-+
-+LIB_OBJS += $(RUNTIME)/lib_base.o $(RUNTIME)/lib_kdebug.o $(RUNTIME)/lib_timer.o \
-+ $(RUNTIME)/lib_ansi.o
-+
-+ifndef amalg
-+ifdef FFI
-+FFI_OBJS += $(FFIDIR)/ffi_call.o $(FFIDIR)/ffi_type.o $(FFIDIR)/ffi_symbol.o \
-+ $(FFIDIR)/cdata.o $(FFIDIR)/ffi_util.o
-+RUNTIME_OBJS += $(FFI_OBJS)
-+LIB_OBJS += $(RUNTIME)/lib_ffi.o
-+endif
-+RUNTIME_OBJS += $(RUNTIME)/ktap.o $(RUNTIME)/kp_load.o $(RUNTIME)/kp_obj.o \
-+ $(RUNTIME)/kp_str.o $(RUNTIME)/kp_tab.o $(RUNTIME)/kp_vm.o \
-+ $(RUNTIME)/kp_opcode.o $(RUNTIME)/kp_transport.o \
-+ $(LIB_OBJS)
-+else
-+RUNTIME_OBJS += $(RUNTIME)/kp_amalg.o
-+endif
-+
-+ifdef FFI
-+ifeq ($(KBUILD_MODULES), 1)
-+ifdef CONFIG_X86_64
-+# call_x86_64.o is compiled from call_x86_64.S
-+RUNTIME_OBJS += $(FFIDIR)/call_x86_64.o
-+else
-+$(error ktap FFI only supports x86_64 for now!)
-+endif
-+endif
-+
-+
-+ccflags-y += -DCONFIG_KTAP_FFI
-+endif
-+
-+obj-m += ktapvm.o
-+ktapvm-y := $(RUNTIME_OBJS)
-+
-+KVERSION ?= $(shell uname -r)
-+KERNEL_SRC ?= /lib/modules/$(KVERSION)/build
-+PWD := $(shell pwd)
-+mod:
-+ $(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules
-+
-+modules_install:
-+ $(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules_install
-+
-+KTAPC_CFLAGS = -Wall -O2
-+
-+
-+# try-cc
-+# Usage: option = $(call try-cc, source-to-build, cc-options, msg)
-+ifneq ($(V),1)
-+TRY_CC_OUTPUT= > /dev/null 2>&1
-+endif
-+TRY_CC_MSG=echo " CHK $(3)" 1>&2;
-+
-+try-cc = $(shell sh -c \
-+ 'TMP="/tmp/.$$$$"; \
-+ $(TRY_CC_MSG) \
-+ echo "$(1)" | \
-+ $(CC) -x c - $(2) -o "$$TMP" $(TRY_CC_OUTPUT) && echo y; \
-+ rm -f "$$TMP"')
-+
-+
-+define SOURCE_LIBELF
-+#include <libelf.h>
-+
-+int main(void)
-+{
-+ Elf *elf = elf_begin(0, ELF_C_READ, 0);
-+ return (long)elf;
-+}
-+endef
-+
-+FLAGS_LIBELF = -lelf
-+
-+ifdef NO_LIBELF
-+ KTAPC_CFLAGS += -DNO_LIBELF
-+else
-+ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
-+ $(warning No libelf found, disables symbol resolving, please install elfutils-libelf-devel/libelf-dev);
-+ NO_LIBELF := 1
-+ KTAPC_CFLAGS += -DNO_LIBELF
-+else
-+ KTAP_LIBS += -lelf
-+endif
-+endif
-+
-+UDIR = userspace
-+
-+$(UDIR)/lex.o: $(UDIR)/lex.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/parser.o: $(UDIR)/parser.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/code.o: $(UDIR)/code.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/dump.o: $(UDIR)/dump.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/main.o: $(UDIR)/main.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/util.o: $(UDIR)/util.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/ktapio.o: $(UDIR)/ktapio.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/eventdef.o: $(UDIR)/eventdef.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/kp_opcode.o: $(RUNTIME)/kp_opcode.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/kp_tab.o: $(RUNTIME)/kp_tab.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/kp_str.o: $(RUNTIME)/kp_str.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/kp_obj.o: $(RUNTIME)/kp_obj.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+ifndef NO_LIBELF
-+$(UDIR)/symbol.o: $(UDIR)/symbol.c
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+endif
-+ifdef FFI
-+KTAPC_CFLAGS += -DCONFIG_KTAP_FFI
-+$(UDIR)/ffi_type.o: $(RUNTIME)/ffi/ffi_type.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/ffi/cparser.o: $(UDIR)/ffi/cparser.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+$(UDIR)/ffi/ctype.o: $(UDIR)/ffi/ctype.c $(INC)/*
-+ $(QUIET_CC)$(CC) $(DEBUGINFO_FLAG) $(KTAPC_CFLAGS) -o $@ -c $<
-+endif
-+
-+
-+KTAPOBJS =
-+KTAPOBJS += $(UDIR)/lex.o
-+KTAPOBJS += $(UDIR)/parser.o
-+KTAPOBJS += $(UDIR)/code.o
-+KTAPOBJS += $(UDIR)/dump.o
-+KTAPOBJS += $(UDIR)/main.o
-+KTAPOBJS += $(UDIR)/util.o
-+KTAPOBJS += $(UDIR)/ktapio.o
-+KTAPOBJS += $(UDIR)/eventdef.o
-+KTAPOBJS += $(UDIR)/kp_opcode.o
-+KTAPOBJS += $(UDIR)/kp_tab.o
-+KTAPOBJS += $(UDIR)/kp_str.o
-+KTAPOBJS += $(UDIR)/kp_obj.o
-+ifndef NO_LIBELF
-+KTAPOBJS += $(UDIR)/symbol.o
-+endif
-+ifdef FFI
-+KTAPOBJS += $(UDIR)/ffi_type.o
-+KTAPOBJS += $(UDIR)/ffi/cparser.o
-+KTAPOBJS += $(UDIR)/ffi/ctype.o
-+endif
-+
-+ktap: $(KTAPOBJS)
-+ $(QUIET_LINK)$(CC) $(KTAPC_CFLAGS) -o $@ $(KTAPOBJS) $(KTAP_LIBS)
-+
-+KMISC := /lib/modules/$(KVERSION)/ktapvm/
-+
-+install: mod ktap
-+ install -d $(KMISC)
-+ install -m 644 -c *.ko /lib/modules/$(KVERSION)/ktapvm/
-+ /sbin/depmod -a
-+
-+load:
-+ insmod ktapvm.ko
-+
-+unload:
-+ rmmod ktapvm
-+
-+test: FORCE
-+ cd test; sh ./run_test.sh; cd -
-+
-+clean:
-+ $(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
-+ $(RM) ktap
-+
-+PHONY += FORCE
-+FORCE:
-+
---- /dev/null
-+++ b/drivers/staging/ktap/README.md
-@@ -0,0 +1,167 @@
-+# ktap
-+
-+A New Scripting Dynamic Tracing Tool For Linux
-+[www.ktap.org][homepage]
-+
-+ktap is a new scripting dynamic tracing tool for Linux,
-+it uses a scripting language and lets users trace the Linux kernel dynamically.
-+ktap is designed to give operational insights with interoperability
-+that allows users to tune, troubleshoot and extend kernel and application.
-+It's similar with Linux Systemtap and Solaris Dtrace.
-+
-+ktap have different design principles from Linux mainstream dynamic tracing
-+language in that it's based on bytecode, so it doesn't depend upon GCC,
-+doesn't require compiling kernel module for each script, safe to use in
-+production environment, fulfilling the embedded ecosystem's tracing needs.
-+
-+More information can be found at [ktap homepage][homepage].
-+
-+[homepage]: http://www.ktap.org
-+
-+## Highlights
-+
-+ * simple but powerful scripting language
-+ * register based interpreter (heavily optimized) in Linux kernel
-+ * small and lightweight (6KLOC of interpreter)
-+ * not depend on gcc for each script running
-+ * easy to use in embedded environment without debugging info
-+ * support for tracepoint, kprobe, uprobe, function trace, timer, and more
-+ * supported in x86, arm, ppc, mips
-+ * safety in sandbox
-+
-+## Building & Running
-+
-+1. Clone ktap from github
-+
-+ $ git clone http://github.com/ktap/ktap.git
-+
-+2. Compiling ktap
-+
-+ $ cd ktap
-+ $ make #generate ktapvm kernel module and ktap binary
-+
-+3. Load ktapvm kernel module(make sure debugfs mounted)
-+
-+ $ make load #need to be root or have sudo access
-+
-+4. Running ktap
-+
-+ $ ./ktap samples/helloworld.kp
-+
-+
-+## Examples
-+
-+1. simplest one-liner command to enable all tracepoints
-+
-+ ktap -e "trace *:* { print(argevent) }"
-+
-+2. syscall tracing on target process
-+
-+ ktap -e "trace syscalls:* { print(argevent) }" -- ls
-+
-+3. ftrace(kernel newer than 3.3, and must compiled with CONFIG_FUNCTION_TRACER)
-+
-+ ktap -e "trace ftrace:function { print(argevent) }"
-+
-+ ktap -e "trace ftrace:function /ip==mutex*/ { print(argevent) }"
-+
-+4. simple syscall tracing
-+
-+ trace syscalls:* {
-+ print(cpu(), pid(), execname(), argevent)
-+ }
-+
-+5. syscall tracing in histogram style
-+
-+ s = {}
-+
-+ trace syscalls:sys_enter_* {
-+ s[argname] += 1
-+ }
-+
-+ trace_end {
-+ histogram(s)
-+ }
-+
-+6. kprobe tracing
-+
-+ trace probe:do_sys_open dfd=%di fname=%dx flags=%cx mode=+4($stack) {
-+ print("entry:", execname(), argevent)
-+ }
-+
-+ trace probe:do_sys_open%return fd=$retval {
-+ print("exit:", execname(), argevent)
-+ }
-+
-+7. uprobe tracing
-+
-+ trace probe:/lib/libc.so.6:malloc {
-+ print("entry:", execname(), argevent)
-+ }
-+
-+ trace probe:/lib/libc.so.6:malloc%return {
-+ print("exit:", execname(), argevent)
-+ }
-+
-+8. stapsdt tracing (userspace static marker)
-+
-+ trace sdt:/lib64/libc.so.6:lll_futex_wake {
-+ print("lll_futex_wake", execname(), argevent)
-+ }
-+
-+ or:
-+
-+ #trace all static mark in libc
-+ trace sdt:/lib64/libc.so.6:* {
-+ print(execname(), argevent)
-+ }
-+
-+9. timer
-+
-+ tick-1ms {
-+ printf("time fired on one cpu\n");
-+ }
-+
-+ profile-2s {
-+ printf("time fired on every cpu\n");
-+ }
-+
-+10. FFI (Call kernel function from ktap script, need compile with FFI=1)
-+
-+ cdef[[
-+ int printk(char *fmt, ...);
-+ ]]
-+
-+ C.printk("This message is called from ktap ffi\n")
-+
-+More examples can be found at [samples][samples_dir] directory.
-+
-+[samples_dir]: https://github.com/ktap/ktap/tree/master/samples
-+
-+## Mailing list
-+
-+ktap@freelists.org
-+You can subscribe to ktap mailing list at link (subscribe before posting):
-+http://www.freelists.org/list/ktap
-+
-+
-+## Copyright and License
-+
-+ktap is licensed under GPL v2
-+
-+Copyright (C) 2012-2013, Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+All rights reserved.
-+
-+
-+## Contribution
-+
-+ktap is still under active development, so contributions are welcome.
-+You are encouraged to report bugs, provide feedback, send feature request,
-+or hack on it.
-+
-+
-+## See More
-+
-+More info can be found at [documentation][tutorial]
-+[tutorial]: http://www.ktap.org/doc/tutorial.html
-+
---- /dev/null
-+++ b/drivers/staging/ktap/RELEASES.txt
-@@ -0,0 +1,155 @@
-+Version 0.4 (Dec 9 2013)
-+-------------------------
-+= Highlight changes from v0.3
-+
-+ * kernel symbol read (syntax: `symbol_name`)
-+
-+ * parse symbol on uprobe (need libelf link)
-+ trace probe:/lib64/libc.so.6:malloc {}
-+ trace probe:/lib64/libc.so.6:malloc%return {}
-+ trace probe:/lib64/libc.so.6:* {} # trace all function in glibc
-+
-+ * support static marker(SDT)
-+ trace sdt:/lib64/libc.so.6:setjmp {}
-+ trace sdt:/lib64/libc.so.6:* {} # trace all sdt in glibc
-+
-+ * support kprobe wildcard
-+ trace probe:vfs* {}
-+
-+ * support run multiple ktap instances concurrently
-+
-+ * add command option for list available events and symbols
-+ -le [glob] : list pre-defined events in system
-+ -lf DSO : list available functions from DSO
-+ -lm DSO : list available sdt notes from DSO
-+
-+ * better annotation for output of argname
-+
-+ * basic FFI support (depend on CONFIG_KTAP_FFI)
-+ FFI will allow call kernel function from ktap script
-+
-+ cdef [[ int printk(char *fmt, ...); ]]
-+ C.printk("this is ffi printk from ktap\n")
-+
-+ (currently only support basic C types, structure support is ongoing)
-+
-+ * New sample scripts
-+ userspace/malloc_size_hist.kp
-+ userspace/malloc_free.kp
-+ userspace/gcc_unwind.kp
-+ userspace/glibc_sdt.kp #trace all static marker in glibc
-+ userspace/glibc_trace.kp #trace all functions in glibc
-+ userspace/glibc_func_hist.kp #show glibc functions in histogram
-+ syscalls/syslatl.kp #syscall latency linear aggregation
-+ syscalls/syslist.kp #syscall latency as a list with counts
-+ syscalls/opensnoop.kp #trace open() syscalls and print basic details
-+ ffi/ffi_kmalloc.kp
-+ ffi/printk.kp
-+ ffi/sched_clock.kp
-+
-+ * use amalgamation build as default
-+ x86_64 build: ktap binary size is 98K, ktapvm.ko size is 983K
-+
-+ * Big cleanups and lots of bugfix
-+
-+
-+Version 0.3 (Oct 29 2013)
-+-------------------------
-+= Highlight changes from v0.2
-+
-+ * Homepage released: www.ktap.org
-+
-+ * Tutorial: http://www.ktap.org/doc/tutorial.html
-+
-+ * Wiki: https://github.com/ktap/ktap/wiki
-+
-+ * simple new tracing block syntax
-+ trace EVENTDEF { action }
-+ trace_end { action }
-+
-+ * New event tracing keywords: argevent, argname, arg1..arg9
-+ trace "syscalls:*" function () {
-+ print(argevent)
-+ }
-+
-+ * New timer block syntax
-+ tick-N { action }
-+ profile-N { action }
-+
-+ * Basic aggregation support
-+ It's similar with systemtap, use "<<<" operator
-+ support aggregate function: count, sum, avg, max, min
-+
-+ * Introduce new "+=" operator
-+
-+ * Introduce sort_paris for table sort iteration
-+
-+ * New sample scripts
-+ helloworld.kp
-+ syscalls/sctop.kp
-+ profiling/stack_profile.kp
-+ io/traceio.kp
-+ mem/kmalloc-top.kp
-+ syscalls/errinfo.kp
-+ schedule/schedtimes.kp
-+ game/tetris.kp
-+
-+ * ansi library for sending ANSI escape sequences
-+
-+
-+ * statistics of ktapvm
-+
-+ * Big cleanups and lots of bugfix
-+
-+Version 0.2 (Jul 31 2013)
-+-------------------------
-+
-+= Script highlight changes from v0.1
-+
-+ * new tracing block syntax
-+ trace EVENTDEF function (e) { BODY }
-+ trace_end function (e) { BODY }
-+
-+ * support trace filter
-+ trace 'sched:sched_switch /prev_comm == foo || next_comm == foo/
-+
-+ * support kprobe/kretprobe
-+ trace "probe:do_sys_open dfd=%di filename=%dx flags=%cx mode=+4($stack)"
-+ trace "probe:do_sys_open%return fd=$retval"
-+
-+ * support uprobe/uretprobe
-+ trace "probe:/lib/libc.so.6:0x000773c0"
-+ trace "probe:/lib/libc.so.6:0x000773c0%return"
-+
-+ * support function tracing
-+ trace "ftrace:function /ip == mutex*/"
-+
-+ * support oneline scripting
-+ ktap -e 'trace "syscalls:*" function (e) { print(e) }'
-+
-+ * specific pid or cpu to tracing
-+ ktap -C cpu *.kp
-+ ktap -p pid *.kp
-+
-+ * more sample scripts
-+
-+ * support calling print_backtrace() in any context
-+
-+ * support calling exit() in any context
-+
-+= Backend highlight changes from v0.1
-+
-+ * unified perf callback mechanism
-+ * use ring buffer transport instead of relayfs
-+ * reentrant in ktap tracing
-+ * performance boost(use percpu data in many case)
-+ * safe table/string manipulation
-+ * safe ktap exit
-+ * big code cleanups
-+ * fixed a lot of bugs, more stable than v0.1
-+
-+Version 0.1 (May 21 2013)
-+-------------------------
-+
-+ https://lwn.net/Articles/551253/
-+
---- /dev/null
-+++ b/drivers/staging/ktap/doc/tutorial.md
-@@ -0,0 +1,691 @@
-+% The ktap Tutorial
-+
-+# Introduction
-+
-+ktap is a new script-based dynamic tracing tool for linux
-+http://www.ktap.org
-+
-+ktap is a new script-based dynamic tracing tool for Linux,
-+it uses a scripting language and lets users trace the Linux kernel dynamically.
-+ktap is designed to give operational insights with interoperability
-+that allows users to tune, troubleshoot and extend kernel and application.
-+It's similar with Linux Systemtap and Solaris Dtrace.
-+
-+ktap have different design principles from Linux mainstream dynamic tracing
-+language in that it's based on bytecode, so it doesn't depend upon GCC,
-+doesn't require compiling kernel module for each script, safe to use in
-+production environment, fulfilling the embedded ecosystem's tracing needs.
-+
-+Highlights features:
-+
-+* simple but powerful scripting language
-+* register based interpreter (heavily optimized) in Linux kernel
-+* small and lightweight
-+* not depend on gcc for each script running
-+* easy to use in embedded environment without debugging info
-+* support for tracepoint, kprobe, uprobe, function trace, timer, and more
-+* supported in x86, arm, ppc, mips
-+* safety in sandbox
-+
-+
-+# Getting started
-+
-+Requirements
-+
-+* Linux 3.1 or later(Need some kernel patches for kernel earlier than 3.1)
-+* CONFIG_EVENT_TRACING enabled
-+* CONFIG_PERF_EVENTS enabled
-+* CONFIG_DEBUG_FS enabled
-+ make sure debugfs mounted before insmod ktapvm
-+ mount debugfs: mount -t debugfs none /sys/kernel/debug/
-+* libelf (optional)
-+ Install elfutils-libelf-devel on RHEL-based distros, or libelf-dev on
-+ Debian-based distros.
-+ Use `make NO_LIBELF=1` to build without libelf support.
-+ libelf is required for resolving symbols to addresses in DSO, and for sdt.
-+
-+Note that those configuration is always enabled in Linux distribution,
-+like REHL, Fedora, Ubuntu, etc.
-+
-+1. Clone ktap from github
-+
-+ $ git clone http://github.com/ktap/ktap.git
-+
-+2. Compiling ktap
-+
-+ $ cd ktap
-+ $ make #generate ktapvm kernel module and ktap binary
-+
-+3. Load ktapvm kernel module(make sure debugfs mounted)
-+
-+ $ make load #need to be root or have sudo access
-+
-+4. Running ktap
-+
-+ $ ./ktap scripts/helloworld.kp
-+
-+
-+# Language basics
-+
-+## Syntax basics
-+
-+ktap's syntax is design on the mind of C language syntax friendly,
-+to make it easy scripting by kernel developer.
-+
-+1. Variable declaration
-+The biggest syntax differences with C is that ktap is a dynamic typed
-+language, so you won't need add any variable type declaration, just
-+use the variable.
-+
-+2. function
-+All functions in ktap should use keyword "function" declaration
-+
-+3. comments
-+The comments of ktap is starting from '#', long comments doesn't support now.
-+
-+4. others
-+Don't need place any ';' at the ending of statement in ktap.
-+ktap use free syntax style, so you can choose to use the ';' or not.
-+
-+ktap use nil as NULL, the result of any number operate on nil is nil.
-+
-+ktap don't have array structure, also don't have any pointer operation.
-+
-+## Control structures
-+
-+ktap if/else is same as C language.
-+
-+There have two method of for-loop in ktap:
-+
-+ for (i = init, limit, step) { body }
-+
-+this is same as below in C:
-+
-+ for (i = init; i < limit; i += step) { body }
-+
-+The next for-loop method is:
-+
-+ for (k, v in pairs(t)) { body } # looping all elements of table
-+
-+Note that ktap don't have "continue" keyword, but C does.
-+
-+## Date structures
-+
-+Associative array is heavily used in ktap, it's also called by table.
-+
-+table declaration:
-+
-+ t = {}
-+
-+how to use table:
-+
-+ t[1] = 1
-+ t[1] = "xxx"
-+ t["key"] = 10
-+ t["key"] = "value"
-+
-+ for (k, v in pairs(t)) { body } # looping all elements of table
-+
-+
-+# Built in functions and librarys
-+
-+## Built in functions
-+
-+**print (...)**
-+Receives any number of arguments, and prints their values,
-+print is not intended for formatted output, but only as a
-+quick way to show a value, typically for debugging.
-+For formatted output, use printf.
-+
-+**printf (fmt, ...)**
-+Similar with C printf, use for format string output.
-+
-+**pairs (t)**
-+Returns three values: the next function, the table t, and nil,
-+so that the construction
-+for (k,v in pairs(t)) { body }
-+will iterate over all key-value pairs of table t.
-+
-+**len (t) /len (s)**
-+If the argument is string, return length of string,
-+if the argument is table, return counts of table pairs.
-+
-+**in_interrupt ()**
-+checking is context is interrupt context
-+
-+**exit ()**
-+quit ktap executing, similar with exit syscall
-+
-+**pid ()**
-+return current process pid
-+
-+**tid ()**
-+return current thread id
-+
-+**uid ()**
-+return current process uid
-+
-+**execname ()**
-+return current process exec name string
-+
-+**cpu ()**
-+return current cpu id
-+
-+**arch ()**
-+return machine architecture, like x86, arm, etc.
-+
-+**kernel_v ()**
-+return Linux kernel version string, like 3.9, etc.
-+
-+**user_string (addr)**
-+Receive userspace address, read string from userspace, return string.
-+
-+**histogram (t)**
-+Receive table, output table histogram to user.
-+
-+**curr_task_info (offset, fetch_bytes)**
-+fetch value in field offset of task_struct structure, argument fetch_bytes
-+could be 4 or 8, if fetch_bytes is not given, default is 4.
-+
-+user may need to get field offset by gdb, for example:
-+gdb vmlinux
-+(gdb)p &(((struct task_struct *)0).prio)
-+
-+**print_backtrace ()**
-+print current task stack info
-+
-+
-+## Librarys
-+
-+### Kdebug Library
-+
-+**kdebug.probe_by_id (eventdef_info, eventfun)**
-+
-+This function is underly representation of high level tracing primitive.
-+Note that eventdef_info is just a userspace memory pointer refer to real
-+eventdef_info structure, the structure defintion is:
-+
-+ struct ktap_eventdef_info {
-+ int nr; /* the number to id */
-+ int *id_arr; /* id array */
-+ char *filter;
-+ };
-+
-+Those id is read from /sys/kernel/debug/tracing/events/$SYS/$EVENT/id
-+
-+The second argument in above examples is a function:
-+function eventfun () { action }
-+
-+
-+**kdebug.probe_end (endfunc)**
-+
-+This function is used for invoking a function when tracing end, it will wait
-+until user press CTRL+C to stop tracing, then ktap will call endfunc function,
-+user could show tracing results in that function, or do other things.
-+
-+User don't have to use kdebug library directly, use trace/trace_end keyword.
-+
-+### Timer Library
-+
-+
-+
-+# Linux tracing basics
-+
-+tracepoints, probe, timer
-+filters
-+above explaintion
-+Ring buffer
-+
-+# Tracing semantics in ktap
-+
-+## Tracing block
-+
-+**trace EVENTDEF /FILTER/ { ACTION }**
-+
-+This is the basic tracing block for ktap, you need to use a specific EVENTDEF
-+string, and own event function.
-+
-+There have four type of EVENTDEF, tracepoint, kprobe, uprobe, sdt.
-+
-+- tracepoint:
-+
-+ EventDef Description
-+ -------------------- -------------------------------
-+ syscalls:* trace all syscalls events
-+ syscalls:sys_enter_* trace all syscalls entry events
-+ kmem:* trace all kmem related events
-+ sched:* trace all sched related events
-+ sched:sched_switch trace sched_switch tracepoint
-+ \*:\* trace all tracepoints in system
-+
-+ All tracepoint events are based on:
-+ /sys/kernel/debug/tracing/events/$SYS/$EVENT
-+
-+- ftrace(kernel newer than 3.3, and must compiled with CONFIG_FUNCTION_TRACER)
-+
-+ EventDef Description
-+ -------------------- -------------------------------
-+ ftrace:function trace kernel functions based on ftrace
-+
-+ User need to use filter (/ip==*/) to trace specfic functions.
-+ Function must be listed in /sys/kernel/debug/tracing/available_filter_functions
-+
-+> ***Note*** of function event
-+>
-+> perf support ftrace:function tracepoint since Linux 3.3(see below commit),
-+> ktap is based on perf callback, so it means kernel must be newer than 3.3
-+> then can use this feature.
-+>
-+> commit ced39002f5ea736b716ae233fb68b26d59783912
-+> Author: Jiri Olsa <jolsa@redhat.com>
-+> Date: Wed Feb 15 15:51:52 2012 +0100
-+>
-+> ftrace, perf: Add support to use function tracepoint in perf
-+>
-+
-+- kprobe:
-+
-+ EventDef Description
-+ -------------------- -----------------------------------
-+ probe:schedule trace schedule function
-+ probe:schedule%return trace schedule function return
-+ probe:SyS_write trace SyS_write function
-+ probe:vfs* trace wildcards vfs related function
-+
-+ kprobe functions must be listed in /proc/kallsyms
-+- uprobe:
-+
-+ EventDef Description
-+ ------------------------------------ ---------------------------
-+ probe:/lib64/libc.so.6:malloc trace malloc function
-+ probe:/lib64/libc.so.6:malloc%return trace malloc function return
-+ probe:/lib64/libc.so.6:free trace free function
-+ probe:/lib64/libc.so.6:0x82000 trace function with file offset 0x82000
-+ probe:/lib64/libc.so.6:* trace all libc function
-+
-+ symbol resolving need libelf support
-+
-+- sdt:
-+
-+ EventDef Description
-+ ------------------------------------ --------------------------
-+ sdt:/libc64/libc.so.6:lll_futex_wake trace stapsdt lll_futex_wake
-+ sdt:/libc64/libc.so.6:* trace all static markers in libc
-+
-+ sdt resolving need libelf support
-+
-+
-+**trace_end { ACTION }**
-+
-+## Tracing built-in variables
-+
-+**argevent**
-+event object, you can print it by: print(argevent), it will print events
-+into human readable string, the result is mostly same as each entry of
-+/sys/kernel/debug/tracing/trace
-+
-+**argname**
-+event name, each event have a name associated with it.
-+
-+**arg1..9**
-+get argument 1..9 of event object.
-+
-+> ***Note*** of arg offset
-+>
-+> The arg offset(1..9) is determined by event format shown in debugfs.
-+>
-+> #cat /sys/kernel/debug/tracing/events/sched/sched_switch/format
-+> name: sched_switch
-+> ID: 268
-+> format:
-+> field:char prev_comm[32]; <- arg1
-+> field:pid_t prev_pid; <- arg2
-+> field:int prev_prio; <- arg3
-+> field:long prev_state; <- arg4
-+> field:char next_comm[32]; <- arg5
-+> field:pid_t next_pid; <- arg6
-+> field:int next_prio; <- arg7
-+>
-+> As shown, tracepoint event sched:sched_switch have 7 arguments, from arg1 to
-+> arg7.
-+>
-+> Need to note that arg1 of syscall event is syscall number, not first argument
-+> of syscall function. Use arg2 as first argument of syscall function.
-+> For example:
-+>
-+> SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count)
-+> <arg2> <arg3> <arg4>
-+>
-+> This is similar with kprobe and uprobe, the arg1 of kprobe/uprobe event
-+> always is _probe_ip, not the first argument given by user, for example:
-+>
-+> # ktap -e 'trace probe:/lib64/libc.so.6:malloc size=%di'
-+>
-+> # cat /sys/kernel/debug/tracing/events/ktap_uprobes_3796/malloc/format
-+> field:unsigned long __probe_ip; <- arg1
-+> field:u64 size; <- arg2
-+
-+
-+## Timer syntax
-+
-+**tick-Ns { ACTION }**
-+**tick-Nsec { ACTION }**
-+**tick-Nms { ACTION }**
-+**tick-Nmsec { ACTION }**
-+**tick-Nus { ACTION }**
-+**tick-Nusec { ACTION }**
-+
-+**profile-Ns { ACTION }**
-+**profile-Nsec { ACTION }**
-+**profile-Nms { ACTION }**
-+**profile-Nmsec { ACTION }**
-+**profile-Nus { ACTION }**
-+**profile-Nusec { ACTION }**
-+
-+architecture overview picture reference(pnp format)
-+one-liners
-+simple event tracing
-+
-+# Advanced tracing pattern
-+
-+Aggregation/Histogram
-+thread local
-+flame graph
-+
-+# Overhead/Performance
-+
-+ktap have more fast boot time thant Systemtap(try the helloword script)
-+ktap have little memory usage than Systemtap
-+and some scripts show that ktap have a little overhead than Systemtap
-+(we choosed two scripts to compare, function profile, stack profile.
-+this is not means all scripts in Systemtap have big overhead than ktap)
-+
-+
-+# FAQ
-+
-+**Q: Why use bytecode design?**
-+A: Using bytecode would be a clean and lightweight solution,
-+ you don't need gcc toolchain to compile every scripts, all you
-+ need is a ktapvm kernel modules and userspace tool called ktap.
-+ Since its language virtual machine design, it have great portability,
-+ suppose you are working at a multi-arch cluster, if you want to run
-+ a tracing script on each board, you won't need cross-compile tracing
-+ script onto all board, what you really need to do is use ktap tool
-+ to run script just in time.
-+
-+ Bytecode based design also will make executing more safer, than native code
-+ generation.
-+
-+ Reality already showing that SystemTap is not widely used in embedded Linux,
-+ caused by problem of SystemTap's architecture design choice, it's a natural
-+ design for Redhat and IBM, because Redhat/IBM is focusing on server area,
-+ not embedded area.
-+
-+**Q: What's the differences with SystemTap and Dtrace?**
-+A: For SystemTap, the answer is already mentioned at above question,
-+ SystemTap use translator design, for trade-off on performance with usability,
-+ based on GCC, that's what ktap want to solve.
-+
-+ For Dtrace, one common design with Dtrace is also use bytecode, so basically
-+ Dtrace and ktap is on the same road. There have some projects aim to porting
-+ Dtrace from Solaris to Linux, but the process is still on the road, Dtrace
-+ is rooted in Solaris, and there have many huge differences between Solaris
-+ tracing infrastructure with Linux's.
-+
-+ Dtrace is based on D language, a language subset of C, it's a restricted
-+ language, like without for-looping, for safty use in production system.
-+ It seems that Dtrace for Linux only support x86 architecture, not work on
-+ powerpc and arm/mips, obviously it's not suit for embedded Linux currently.
-+
-+ Dtrace use ctf as input for debuginfo handing, compare with vmlinux for
-+ SystemTap.
-+
-+ On the license part, Dtrace is released as CDDL, which is incompatible with
-+ GPL(this is why it's impossible to upstream Dtrace into mainline).
-+
-+**Q: Why use dynamically typed language? but not statically typed language?**
-+A: It's hard to say which one is more better than other, dynamically typed
-+ language bring efficiency and fast prototype production, but loosing type
-+ check at compiling phase, and easy to make mistake in runtime, also it's
-+ need many runtime checking, In contrast, statically typed language win on
-+ programing safety, and performance. Statically language would suit for
-+ interoperate with kernel, as kernel is wrote mainly in C, Need to note that
-+ SystemTap and Dtrace both is statically language.
-+
-+ ktap choose dynamically typed language as initial implementation.
-+
-+**Q: Why we need ktap for event tracing? There already have a built-in ftrace**
-+A: This also is a common question for all dynamic tracing tool, not only ktap.
-+ ktap provide more flexibility than built-in tracing infrastructure. Suppose
-+ you need print a global variable when tracepoint hit, or you want print
-+ backtrace, even more, you want to store some info into associative array, and
-+ display it in histogram style when tracing end, in these case, some of them
-+ ftrace can take it, some of them ftrace can not.
-+ Overall, ktap provide you with great flexibility to scripting your own trace
-+ need.
-+
-+**Q: How about the performance? Is ktap slow?**
-+A: ktap is not slow, the bytecode is very high-level, based on lua, the language
-+ virtual machine is register-based(compare with stack-based), with little
-+ instruction, the table data structure is heavily optimized in ktapvm.
-+ ktap use per-cpu allocation in many place, without global locking scheme,
-+ it's very fast when executing tracepoint callback.
-+ Performance benchmark showing that the overhead of ktap running is nearly
-+ 10%(store event name into associative array), compare with full speed
-+ running without any tracepoint enabled.
-+
-+ ktap will optimize overhead all the time, hopefully the overhead will
-+ decrease to little than 5%, even more.
-+
-+**Q: Why not porting a high level language implementation into kernel directly?
-+ Like python/JVM?**
-+A: I take serious on the size of vm and memory footprint. Python vm is large,
-+ it's not suit to embed into kernel, and python have some functionality
-+ which we don't need.
-+
-+ The bytecode of other high level language is also big, ktap only have 32
-+ bytecodes, python/java/erlang have nearly two hundred bytecodes.
-+ There also have some problems when porting those language into kernel,
-+ userspace programming have many differences with kernel programming,
-+ like float numbers, handle sleeping code carefully in kernel, deadloop is
-+ not allowed in kernel, multi-thread management, etc.., so it's impossible
-+ to porting language implementation into kernel with little adaption work.
-+
-+**Q: What's the status of ktap now?**
-+A: Basically it works on x86-32, x86-64, powerpc, arm, it also could work for
-+ other hardware architecture, but not proven yet(I don't have enough hardware
-+ to test)
-+ If you found some bug, fix it on you own programming skill, or report to me.
-+
-+**Q: How to hack ktap? I want to write some extensions onto ktap.**
-+A: welcome hacking.
-+ You can write your own library to fulfill your specific need,
-+ you can write any script as you want.
-+
-+**Q: What's the plan of ktap? any roadmap?**
-+A: the current plan is deliver stable ktapvm kernel modules, more ktap script,
-+ and bugfix.
-+
-+
-+# References
-+
-+* [Linux Performance Analysis and Tools][LPAT]
-+* [Dtrace Blog][dtraceblog]
-+* [Dtrace User Guide][dug]
-+* [LWN: ktap -- yet another kernel tracer][lwn1]
-+* [LWN: Ktap almost gets into 3.13][lwn2]
-+* [staging: ktap: add to the kernel tree][ktap_commit]
-+* [ktap introduction in LinuxCon Japan 2013][lcj](content is out of date)
-+* [ktap Examples by Brendan Gregg][KEBG]
-+
-+[LPAT]: http://www.brendangregg.com/Slides/SCaLE_Linux_Performance2013.pdf
-+[dtraceblog]: http://dtrace.org/blogs/
-+[dug]: http://docs.huihoo.com/opensolaris/dtrace-user-guide/html/index.html
-+[lwn1]: http://lwn.net/Articles/551314/
-+[lwn2]: http://lwn.net/Articles/572788/
-+[ktap_commit]: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c63a164271f81220ff4966d41218a9101f3d0ec4
-+[lcj]: http://events.linuxfoundation.org/sites/events/files/lcjpcojp13_zhangwei.pdf
-+[KEBG]: http://www.brendangregg.com/ktap.html
-+
-+# History
-+
-+* ktap was invented at 2002
-+* First RFC sent to LKML at 2012.12.31
-+* The code was released in github at 2013.01.18
-+* ktap released v0.1 at 2013.05.21
-+* ktap released v0.2 at 2013.07.31
-+* ktap released v0.3 at 2013.10.29
-+
-+For more release info, please look at RELEASES.txt in project root directory.
-+
-+# Examples
-+
-+1. simplest one-liner command to enable all tracepoints
-+
-+ ktap -e "trace *:* { print(argevent) }"
-+
-+2. syscall tracing on target process
-+
-+ ktap -e "trace syscalls:* { print(argevent) }" -- ls
-+
-+3. ftrace(kernel newer than 3.3, and must compiled with CONFIG_FUNCTION_TRACER)
-+
-+ ktap -e "trace ftrace:function { print(argevent) }"
-+
-+ ktap -e "trace ftrace:function /ip==mutex*/ { print(argevent) }"
-+
-+4. simple syscall tracing
-+
-+ trace syscalls:* {
-+ print(cpu(), pid(), execname(), argevent)
-+ }
-+
-+5. syscall tracing in histogram style
-+
-+ s = {}
-+
-+ trace syscalls:sys_enter_* {
-+ s[argname] += 1
-+ }
-+
-+ trace_end {
-+ histogram(s)
-+ }
-+
-+6. kprobe tracing
-+
-+ trace probe:do_sys_open dfd=%di fname=%dx flags=%cx mode=+4($stack) {
-+ print("entry:", execname(), argevent)
-+ }
-+
-+ trace probe:do_sys_open%return fd=$retval {
-+ print("exit:", execname(), argevent)
-+ }
-+
-+7. uprobe tracing
-+
-+ trace probe:/lib/libc.so.6:malloc {
-+ print("entry:", execname(), argevent)
-+ }
-+
-+ trace probe:/lib/libc.so.6:malloc%return {
-+ print("exit:", execname(), argevent)
-+ }
-+
-+8. stapsdt tracing (userspace static marker)
-+
-+ trace sdt:/lib64/libc.so.6:lll_futex_wake {
-+ print("lll_futex_wake", execname(), argevent)
-+ }
-+
-+ or:
-+
-+ #trace all static mark in libc
-+ trace sdt:/lib64/libc.so.6:* {
-+ print(execname(), argevent)
-+ }
-+
-+9. timer
-+
-+ tick-1ms {
-+ printf("time fired on one cpu\n");
-+ }
-+
-+ profile-2s {
-+ printf("time fired on every cpu\n");
-+ }
-+
-+10. FFI (Call kernel function from ktap script, need compile with FFI=1)
-+
-+ cdef[[
-+ int printk(char *fmt, ...);
-+ ]]
-+
-+ C.printk("This message is called from ktap ffi\n")
-+
-+More examples can be found at [samples][samples_dir] directory.
-+
-+[samples_dir]: https://github.com/ktap/ktap/tree/master/samples
-+
-+# Appendix
-+
-+Here is the complete syntax of ktap in extended BNF.
-+(based on lua syntax: http://www.lua.org/manual/5.1/manual.html#5.1)
-+
-+ chunk ::= {stat [';']} [laststat [';']
-+
-+ block ::= chunk
-+
-+ stat ::= varlist '=' explist |
-+ functioncall |
-+ { block } |
-+ while exp { block } |
-+ repeat block until exp |
-+ if exp { block {elseif exp { block }} [else block] } |
-+ for Name '=' exp ',' exp [',' exp] { block } |
-+ for namelist in explist { block } |
-+ function funcname funcbody |
-+ local function Name funcbody |
-+ local namelist ['=' explist]
-+
-+ laststat ::= return [explist] | break
-+
-+ funcname ::= Name {'.' Name} [':' Name]
-+
-+ varlist ::= var {',' var}
-+
-+ var ::= Name | prefixexp '[' exp ']'| prefixexp '.' Name
-+
-+ namelist ::= Name {',' Name}
-+
-+ explist ::= {exp ',' exp
-+
-+ exp ::= nil | false | true | Number | String | '...' | function |
-+ prefixexp | tableconstructor | exp binop exp | unop exp
-+
-+ prefixexp ::= var | functioncall | '(' exp ')'
-+
-+ functioncall ::= prefixexp args | prefixexp ':' Name args
-+
-+ args ::= '(' [explist] ')' | tableconstructor | String
-+
-+ function ::= function funcbody
-+
-+ funcbody ::= '(' [parlist] ')' { block }
-+
-+ parlist ::= namelist [',' '...'] | '...'
-+
-+ tableconstructor ::= '{' [fieldlist] '}'
-+
-+ fieldlist ::= field {fieldsep field} [fieldsep]
-+
-+ field ::= '[' exp ']' '=' exp | Name '=' exp | exp
-+
-+ fieldsep ::= ',' | ';'
-+
-+ binop ::= '+' | '-' | '*' | '/' | '^' | '%' | '..' |
-+ '<' | '<=' | '>' | '>=' | '==' | '!=' |
-+ and | or
-+
-+ unop ::= '-'
-+
---- /dev/null
-+++ b/drivers/staging/ktap/include/ktap_ffi.h
-@@ -0,0 +1,180 @@
-+#ifndef __KTAP_FFI_H__
-+#define __KTAP_FFI_H__
-+
-+#ifdef CONFIG_KTAP_FFI
-+
-+#include "../include/ktap_types.h"
-+
-+/*
-+ * Types design in FFI module
-+ *
-+ * ktap_cdata is an instance of csymbol, so it's a combination of csymbol
-+ * and it's actual data in memory.
-+ *
-+ * csymbol structs are globally unique and readonly type that represent C
-+ * types. For non scalar C types like struct and function, helper structs are
-+ * used to store detailed information. See csymbol_func and csymbol_struct for
-+ * more information.
-+ */
-+
-+typedef enum {
-+ /* 0 - 4 */
-+ FFI_VOID,
-+ FFI_UINT8,
-+ FFI_INT8,
-+ FFI_UINT16,
-+ FFI_INT16,
-+ /* 5 - 9 */
-+ FFI_UINT32,
-+ FFI_INT32,
-+ FFI_UINT64,
-+ FFI_INT64,
-+ FFI_PTR,
-+ /* 10 - 12 */
-+ FFI_FUNC,
-+ FFI_STRUCT,
-+ FFI_UNKNOWN,
-+} ffi_type;
-+#define NUM_FFI_TYPE ((int)FFI_UNKNOWN)
-+
-+
-+/* following struct and macros are added for C typedef
-+ * size and alignment calculation */
-+typedef struct {
-+ size_t size;
-+ size_t align;
-+ const char *name;
-+} ffi_mode;
-+extern const ffi_mode const ffi_type_modes[];
-+
-+#define ffi_type_size(t) (ffi_type_modes[t].size)
-+#define ffi_type_align(t) (ffi_type_modes[t].align)
-+#define ffi_type_name(t) (ffi_type_modes[t].name)
-+
-+
-+/* start of csymbol definition */
-+#define CSYM_NAME_MAX_LEN 64
-+
-+typedef struct csymbol_func {
-+ void *addr; /* function address */
-+ csymbol_id ret_id; /* function return type */
-+ int arg_nr; /* number of arguments */
-+ csymbol_id *arg_ids; /* function argument types */
-+ unsigned has_var_arg; /* is this a var arg function? */
-+} csymbol_func;
-+
-+typedef struct struct_member {
-+ char name[CSYM_NAME_MAX_LEN]; /* name for this struct member */
-+ csymbol_id id; /* type for this struct member */
-+} struct_member;
-+
-+typedef struct csymbol_struct {
-+ int memb_nr; /* number of members */
-+ struct_member *members; /* array for each member definition */
-+ size_t size; /* bytes used to store struct */
-+ /* alignment of the struct, 0 indicates uninitialization */
-+ size_t align;
-+} csymbol_struct;
-+
-+
-+/* wrapper struct for all C symbols */
-+typedef struct csymbol {
-+ char name[CSYM_NAME_MAX_LEN]; /* name for this symbol */
-+ ffi_type type; /* type for this symbol */
-+ /* following members are used only for non scalar C types */
-+ union {
-+ csymbol_id p; /* pointer type */
-+ csymbol_func f; /* C function type */
-+ csymbol_struct st; /* struct type */
-+ csymbol_id td; /* typedef type */
-+ } u;
-+} csymbol;
-+
-+/* lookup csymbol address by it's id */
-+inline csymbol *ffi_get_csym_by_id(ktap_state *ks, csymbol_id id);
-+#define id_to_csym(ks, id) (ffi_get_csym_by_id(ks, id))
-+
-+/* helper macros for struct csymbol */
-+#define csym_type(cs) ((cs)->type)
-+#define csym_name(cs) ((cs)->name)
-+
-+/*
-+ * helper macros for pointer symbol
-+ */
-+#define csym_ptr_deref_id(cs) ((cs)->u.p)
-+#define csym_set_ptr_deref_id(cs, id) ((cs)->u.p = (id))
-+/* following macro gets csymbol address */
-+#define csym_ptr_deref(ks, cs) (id_to_csym(ks, csym_ptr_deref_id(cs)))
-+
-+/*
-+ * helper macros for function symbol
-+ * csym_* accepts csymbol type
-+ * csymf_* accepts csymbol_func type
-+ */
-+#define csymf_addr(csf) ((csf)->addr)
-+#define csymf_ret_id(csf) ((csf)->ret_id)
-+#define csymf_arg_nr(csf) ((csf)->arg_nr)
-+#define csymf_arg_ids(csf) ((csf)->arg_ids)
-+/* get csymbol id for the nth argument */
-+#define csymf_arg_id(csf, n) ((csf)->arg_ids[n])
-+#define csym_func(cs) (&((cs)->u.f))
-+#define csym_func_addr(cs) (csymf_addr(csym_func(cs)))
-+#define csym_func_arg_ids(cs) (csymf_arg_ids(csym_func(cs)))
-+/* following macros get csymbol address */
-+#define csymf_ret(ks, csf) (id_to_csym(ks, csymf_ret_id(csf)))
-+/* get csymbol address for the nth argument */
-+#define csymf_arg(ks, csf, n) (id_to_csym(ks, csymf_arg_id(csf, n)))
-+#define csym_func_arg(ks, cs, n) (csymf_arg(ks, csym_func(cs), n))
-+
-+/*
-+ * helper macors for struct symbol
-+ * csym_* accepts csymbol type
-+ * csymst_* accepts csymbol_struct type
-+ */
-+#define csymst_mb_nr(csst) ((csst)->memb_nr)
-+#define csym_struct(cs) (&(cs)->u.st)
-+#define csym_struct_mb(cs) (csymst_mb(ks, csym_struct(cs), n))
-+/* following macro gets csymbol address for the nth struct member */
-+#define csymst_mb(ks, csst, n) (id_to_csym(ks, (csst)->members[n].id))
-+
-+
-+/*
-+ * helper macros for ktap_cdata type
-+ */
-+#define cd_csym_id(cd) ((cd)->id)
-+#define cd_set_csym_id(cd, id) (cd_csym_id(cd) = (id))
-+#define cd_csym(ks, cd) (id_to_csym(ks, cd_csym_id(cd)))
-+#define cd_type(ks, cd) (cd_csym(ks, cd)->type)
-+
-+#define cd_int(cd) ((cd)->u.i)
-+#define cd_ptr(cd) ((cd)->u.p)
-+#define cd_struct(cd) ((cd)->u.st)
-+
-+
-+#ifdef __KERNEL__
-+size_t csym_size(ktap_state *ks, csymbol *sym);
-+size_t csym_align(ktap_state *ks, csymbol *sym);
-+size_t csym_struct_offset(ktap_state *ks, csymbol_struct *csst, int idx);
-+void init_csym_struct(ktap_state *ks, csymbol_struct *csst);
-+
-+void kp_ffi_free_symbol(ktap_state *ks);
-+csymbol_id ffi_get_csym_id(ktap_state *ks, char *name);
-+
-+ktap_cdata *kp_cdata_new(ktap_state *ks);
-+void kp_cdata_dump(ktap_state *ks, ktap_cdata *cd);
-+ktap_cdata *kp_cdata_new_ptr(ktap_state *ks, void *addr, csymbol_id id);
-+ktap_cdata *kp_cdata_new_struct(ktap_state *ks, void *val, csymbol_id id);
-+
-+int kp_ffi_call(ktap_state *ks, csymbol_func *cf);
-+#endif /* for __KERNEL__ */
-+
-+#else
-+
-+static void __maybe_unused kp_ffi_free_symbol(ktap_state *ks)
-+{
-+ return;
-+}
-+
-+#endif /* CONFIG_KTAP_FFI */
-+
-+#endif /* __KTAP_FFI_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/include/ktap_opcodes.h
-@@ -0,0 +1,239 @@
-+#ifndef __KTAP_BYTECODE_H__
-+#define __KTAP_BYTECODE_H__
-+
-+
-+/* opcode is copied from lua initially */
-+
-+typedef enum {
-+/*----------------------------------------------------------------------
-+ * name args description
-+ * ------------------------------------------------------------------------*/
-+OP_MOVE,/* A B R(A) := R(B) */
-+OP_LOADK,/* A Bx R(A) := Kst(Bx) */
-+OP_LOADKX,/* A R(A) := Kst(extra arg) */
-+OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) pc++ */
-+OP_LOADNIL,/* A B R(A), R(A+1), ..., R(A+B) := nil */
-+OP_GETUPVAL,/* A B R(A) := UpValue[B] */
-+
-+OP_GETTABUP,/* A B C R(A) := UpValue[B][RK(C)] */
-+OP_GETTABLE,/* A B C R(A) := R(B)[RK(C)] */
-+
-+OP_SETTABUP,/* A B C UpValue[A][RK(B)] := RK(C) */
-+OP_SETTABUP_INCR,/* A B C UpValue[A][RK(B)] += RK(C) */
-+OP_SETTABUP_AGGR,/* A B C UpValue[A][RK(B)] <<< RK(C) */
-+OP_SETUPVAL,/* A B UpValue[B] := R(A) */
-+OP_SETTABLE,/* A B C R(A)[RK(B)] := RK(C) */
-+OP_SETTABLE_INCR,/* A B C R(A)[RK(B)] += RK(C) */
-+OP_SETTABLE_AGGR,/* A B C R(A)[RK(B)] <<< RK(C) */
-+
-+OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */
-+
-+OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */
-+
-+OP_ADD,/* A B C R(A) := RK(B) + RK(C) */
-+OP_SUB,/* A B C R(A) := RK(B) - RK(C) */
-+OP_MUL,/* A B C R(A) := RK(B) * RK(C) */
-+OP_DIV,/* A B C R(A) := RK(B) / RK(C) */
-+OP_MOD,/* A B C R(A) := RK(B) % RK(C) */
-+OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */
-+OP_UNM,/* A B R(A) := -R(B) */
-+OP_NOT,/* A B R(A) := not R(B) */
-+OP_LEN,/* A B R(A) := length of R(B) */
-+
-+OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
-+
-+OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A) + 1 */
-+OP_EQ,/* A B C if ((RK(B) == RK(C)) != A) then pc++ */
-+OP_LT,/* A B C if ((RK(B) < RK(C)) != A) then pc++ */
-+OP_LE,/* A B C if ((RK(B) <= RK(C)) != A) then pc++ */
-+
-+OP_TEST,/* A C if not (R(A) <=> C) then pc++ */
-+OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
-+
-+OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
-+OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */
-+OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */
-+
-+OP_FORLOOP,/* A sBx R(A)+=R(A+2);
-+ if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/
-+OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */
-+
-+OP_TFORCALL,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); */
-+OP_TFORLOOP,/* A sBx if R(A+1) != nil then { R(A)=R(A+1); pc += sBx }*/
-+
-+OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */
-+
-+OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */
-+
-+OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */
-+
-+OP_EXTRAARG,/* Ax extra (larger) argument for previous opcode */
-+
-+OP_EVENT,/* A B C R(A) := R(B)[C] */
-+
-+OP_EVENTNAME, /* A R(A) = event_name() */
-+
-+OP_EVENTARG,/* A B R(A) := event_arg(B)*/
-+
-+OP_LOAD_GLOBAL,/* A B C R(A) := R(B)[C] */
-+
-+OP_EXIT,
-+
-+} OpCode;
-+
-+
-+#define NUM_OPCODES ((int)OP_LOAD_GLOBAL + 1)
-+
-+
-+enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */
-+
-+
-+/*
-+ * ** size and position of opcode arguments.
-+ * */
-+#define SIZE_C 9
-+#define SIZE_B 9
-+#define SIZE_Bx (SIZE_C + SIZE_B)
-+#define SIZE_A 8
-+#define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A)
-+
-+#define SIZE_OP 6
-+
-+#define POS_OP 0
-+#define POS_A (POS_OP + SIZE_OP)
-+#define POS_C (POS_A + SIZE_A)
-+#define POS_B (POS_C + SIZE_C)
-+#define POS_Bx POS_C
-+#define POS_Ax POS_A
-+
-+
-+
-+/*
-+ * ** limits for opcode arguments.
-+ * ** we use (signed) int to manipulate most arguments,
-+ * ** so they must fit in LUAI_BITSINT-1 bits (-1 for sign)
-+ * */
-+#define MAXARG_Bx ((1<<SIZE_Bx)-1)
-+#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */
-+
-+#define MAXARG_Ax ((1<<SIZE_Ax)-1)
-+
-+#define MAXARG_A ((1<<SIZE_A)-1)
-+#define MAXARG_B ((1<<SIZE_B)-1)
-+#define MAXARG_C ((1<<SIZE_C)-1)
-+
-+
-+/* creates a mask with `n' 1 bits at position `p' */
-+#define MASK1(n,p) ((~((~(ktap_instruction)0)<<(n)))<<(p))
-+
-+/* creates a mask with `n' 0 bits at position `p' */
-+#define MASK0(n,p) (~MASK1(n,p))
-+
-+/*
-+ * ** the following macros help to manipulate instructions
-+ * */
-+
-+#define GET_OPCODE(i) ((OpCode)((i)>>POS_OP) & MASK1(SIZE_OP,0))
-+#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
-+ ((((ktap_instruction)o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))
-+
-+#define getarg(i,pos,size) ((int)((i)>>pos) & MASK1(size,0))
-+#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \
-+ ((((ktap_instruction)v)<<pos)&MASK1(size,pos))))
-+
-+#define GETARG_A(i) getarg(i, POS_A, SIZE_A)
-+#define SETARG_A(i,v) setarg(i, v, POS_A, SIZE_A)
-+
-+#define GETARG_B(i) getarg(i, POS_B, SIZE_B)
-+#define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B)
-+
-+#define GETARG_C(i) getarg(i, POS_C, SIZE_C)
-+#define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
-+
-+#define GETARG_Bx(i) getarg(i, POS_Bx, SIZE_Bx)
-+#define SETARG_Bx(i,v) setarg(i, v, POS_Bx, SIZE_Bx)
-+
-+#define GETARG_Ax(i) getarg(i, POS_Ax, SIZE_Ax)
-+#define SETARG_Ax(i,v) setarg(i, v, POS_Ax, SIZE_Ax)
-+
-+#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
-+#define SETARG_sBx(i,b) SETARG_Bx((i), (unsigned int)(b)+MAXARG_sBx)
-+
-+#define CREATE_ABC(o,a,b,c) (((ktap_instruction)(o))<<POS_OP) \
-+ | (((ktap_instruction)(a))<<POS_A) \
-+ | (((ktap_instruction)(b))<<POS_B) \
-+ | (((ktap_instruction)(c))<<POS_C)
-+
-+#define CREATE_ABx(o,a,bc) (((ktap_instruction)(o))<<POS_OP) \
-+ | (((ktap_instruction)(a))<<POS_A) \
-+ | (((ktap_instruction)(bc))<<POS_Bx)
-+
-+#define CREATE_Ax(o,a) (((ktap_instruction)(o))<<POS_OP) \
-+ | (((ktap_instruction)(a))<<POS_Ax)
-+
-+
-+
-+/*
-+ * ** Macros to operate RK indices
-+ * */
-+
-+/* this bit 1 means constant (0 means register) */
-+#define BITRK (1 << (SIZE_B - 1))
-+
-+/* test whether value is a constant */
-+#define ISK(x) ((x) & BITRK)
-+
-+/* gets the index of the constant */
-+#define INDEXK(r) ((int)(r) & ~BITRK)
-+
-+#define MAXINDEXRK (BITRK - 1)
-+
-+/* code a constant index as a RK value */
-+#define RKASK(x) ((x) | BITRK)
-+
-+
-+/*
-+ * ** invalid register that fits in 8 bits
-+ * */
-+#define NO_REG MAXARG_A
-+
-+
-+/*
-+ * ** R(x) - register
-+ * ** Kst(x) - constant (in constant table)
-+ * ** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x)
-+ * */
-+
-+
-+
-+/*
-+ * ** masks for instruction properties. The format is:
-+ * ** bits 0-1: op mode
-+ * ** bits 2-3: C arg mode
-+ * ** bits 4-5: B arg mode
-+ * ** bit 6: instruction set register A
-+ * ** bit 7: operator is a test (next instruction must be a jump)
-+ * */
-+
-+enum OpArgMask {
-+ OpArgN, /* argument is not used */
-+ OpArgU, /* argument is used */
-+ OpArgR, /* argument is a register or a jump offset */
-+ OpArgK /* argument is a constant or register/constant */
-+};
-+
-+extern const u8 ktap_opmodes[NUM_OPCODES];
-+
-+#define getOpMode(m) ((enum OpMode)ktap_opmodes[m] & 3)
-+#define getBMode(m) ((enum OpArgMask)(ktap_opmodes[m] >> 4) & 3)
-+#define getCMode(m) ((enum OpArgMask)(ktap_opmodes[m] >> 2) & 3)
-+#define testAMode(m) (ktap_opmodes[m] & (1 << 6))
-+#define testTMode(m) (ktap_opmodes[m] & (1 << 7))
-+
-+
-+/* number of list items to accumulate before a SETLIST instruction */
-+#define LFIELDS_PER_FLUSH 50
-+
-+extern const char *const ktap_opnames[NUM_OPCODES + 1];
-+
-+#endif /* __KTAP_BYTECODE_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/include/ktap_types.h
-@@ -0,0 +1,609 @@
-+#ifndef __KTAP_TYPES_H__
-+#define __KTAP_TYPES_H__
-+
-+#ifdef __KERNEL__
-+#include <linux/perf_event.h>
-+#else
-+typedef char u8;
-+#include <stdlib.h>
-+#include <stdio.h>
-+#include <string.h>
-+#include <stdint.h>
-+#endif
-+
-+/*
-+ * The first argument type of kdebug.probe_by_id()
-+ * The value is a userspace memory pointer.
-+ */
-+typedef struct ktap_eventdef_info {
-+ int nr;
-+ int *id_arr;
-+ char *filter;
-+} ktap_eventdef_info;
-+
-+typedef struct ktap_parm {
-+ char *trunk; /* __user */
-+ int trunk_len;
-+ int argc;
-+ char **argv; /* __user */
-+ int verbose;
-+ int trace_pid;
-+ int workload;
-+ int trace_cpu;
-+ int print_timestamp;
-+ int quiet;
-+} ktap_parm;
-+
-+/*
-+ * Ioctls that can be done on a ktap fd:
-+ * todo: use _IO macro in include/uapi/asm-generic/ioctl.h
-+ */
-+#define KTAP_CMD_IOC_VERSION ('$' + 0)
-+#define KTAP_CMD_IOC_RUN ('$' + 1)
-+#define KTAP_CMD_IOC_EXIT ('$' + 3)
-+
-+#define KTAP_ENV "_ENV"
-+
-+#define KTAP_VERSION_MAJOR "0"
-+#define KTAP_VERSION_MINOR "4"
-+
-+#define KTAP_VERSION "ktap " KTAP_VERSION_MAJOR "." KTAP_VERSION_MINOR
-+#define KTAP_AUTHOR "Jovi Zhangwei <jovi.zhangwei@gmail.com>"
-+#define KTAP_COPYRIGHT KTAP_VERSION " Copyright (C) 2012-2013, " KTAP_AUTHOR
-+
-+#define MYINT(s) (s[0] - '0')
-+#define VERSION (MYINT(KTAP_VERSION_MAJOR) * 16 + MYINT(KTAP_VERSION_MINOR))
-+#define FORMAT 0 /* this is the official format */
-+
-+#define KTAP_SIGNATURE "\033ktap"
-+
-+/* data to catch conversion errors */
-+#define KTAPC_TAIL "\x19\x93\r\n\x1a\n"
-+
-+/* size in bytes of header of binary files */
-+#define KTAPC_HEADERSIZE (sizeof(KTAP_SIGNATURE) - sizeof(char) + 2 + \
-+ 6 + sizeof(KTAPC_TAIL) - sizeof(char))
-+
-+typedef long ktap_number;
-+#define kp_number2int(i, n) ((i) = (int)(n))
-+
-+typedef int ktap_instruction;
-+
-+typedef union ktap_gcobject ktap_gcobject;
-+
-+#define CommonHeader ktap_gcobject *next; u8 tt;
-+
-+typedef union ktap_string {
-+ int dummy; /* ensures maximum alignment for strings */
-+ struct {
-+ CommonHeader;
-+ u8 extra; /* reserved words for short strings; "has hash" for longs */
-+ unsigned int hash;
-+ size_t len; /* number of characters in string */
-+ } tsv;
-+ /* short string is stored here, just after tsv */
-+} ktap_string;
-+
-+
-+struct ktap_state;
-+typedef int (*ktap_cfunction) (struct ktap_state *ks);
-+
-+typedef struct ktap_value {
-+ union {
-+ ktap_gcobject *gc; /* collectable objects */
-+ void *p; /* light userdata */
-+ int b; /* booleans */
-+ ktap_cfunction f; /* light C functions */
-+ ktap_number n; /* numbers */
-+ } val;
-+ int type;
-+} ktap_value;
-+
-+typedef ktap_value * StkId;
-+
-+
-+/*
-+ * Description of an upvalue for function prototypes
-+ */
-+typedef struct ktap_upvaldesc {
-+ ktap_string *name; /* upvalue name (for debug information) */
-+ u8 instack; /* whether it is in stack */
-+ u8 idx; /* index of upvalue (in stack or in outer function's list) */
-+} ktap_upvaldesc;
-+
-+/*
-+ * Description of a local variable for function prototypes
-+ * (used for debug information)
-+ */
-+typedef struct ktap_locvar {
-+ ktap_string *varname;
-+ int startpc; /* first point where variable is active */
-+ int endpc; /* first point where variable is dead */
-+} ktap_locvar;
-+
-+
-+typedef struct ktap_upval {
-+ CommonHeader;
-+ ktap_value *v; /* points to stack or to its own value */
-+ union {
-+ ktap_value value; /* the value (when closed) */
-+ struct { /* double linked list (when open) */
-+ struct ktap_upval *prev;
-+ struct ktap_upval *next;
-+ } l;
-+ } u;
-+} ktap_upval;
-+
-+
-+#define KTAP_MAX_STACK_ENTRIES 100
-+
-+typedef struct ktap_btrace {
-+ CommonHeader;
-+ unsigned int nr_entries;
-+ /* entries stored in here, after nr_entries */
-+} ktap_btrace;
-+
-+typedef struct ktap_closure {
-+ CommonHeader;
-+ u8 nupvalues;
-+ struct ktap_proto *p;
-+ struct ktap_upval *upvals[1]; /* list of upvalues */
-+ ktap_gcobject *gclist;
-+} ktap_closure;
-+
-+typedef struct ktap_proto {
-+ CommonHeader;
-+ ktap_value *k; /* constants used by the function */
-+ ktap_instruction *code;
-+ struct ktap_proto **p; /* functions defined inside the function */
-+ int *lineinfo; /* map from opcodes to source lines (debug information) */
-+ struct ktap_locvar *locvars; /* information about local variables (debug information) */
-+ struct ktap_upvaldesc *upvalues; /* upvalue information */
-+ ktap_closure *cache; /* last created closure with this prototype */
-+ ktap_string *source; /* used for debug information */
-+ int sizeupvalues; /* size of 'upvalues' */
-+ int sizek; /* size of `k' */
-+ int sizecode;
-+ int sizelineinfo;
-+ int sizep; /* size of `p' */
-+ int sizelocvars;
-+ int linedefined;
-+ int lastlinedefined;
-+ u8 numparams; /* number of fixed parameters */
-+ u8 is_vararg;
-+ u8 maxstacksize; /* maximum stack used by this function */
-+} ktap_proto;
-+
-+
-+/*
-+ * information about a call
-+ */
-+typedef struct ktap_callinfo {
-+ StkId func; /* function index in the stack */
-+ StkId top; /* top for this function */
-+ struct ktap_callinfo *prev, *next; /* dynamic call link */
-+ short nresults; /* expected number of results from this function */
-+ u8 callstatus;
-+ int extra;
-+ union {
-+ struct { /* only for ktap functions */
-+ StkId base; /* base for this function */
-+ const unsigned int *savedpc;
-+ } l;
-+ struct { /* only for C functions */
-+ int ctx; /* context info. in case of yields */
-+ u8 status;
-+ } c;
-+ } u;
-+} ktap_callinfo;
-+
-+
-+/*
-+ * ktap_tab
-+ */
-+typedef struct ktap_tkey {
-+ struct ktap_tnode *next; /* for chaining */
-+ ktap_value tvk;
-+} ktap_tkey;
-+
-+
-+typedef struct ktap_tnode {
-+ ktap_value i_val;
-+ ktap_tkey i_key;
-+} ktap_tnode;
-+
-+
-+typedef struct ktap_stat_data {
-+ int count;
-+ int sum;
-+ int min, max;
-+} ktap_stat_data;
-+
-+
-+typedef struct ktap_tab {
-+ CommonHeader;
-+#ifdef __KERNEL__
-+ arch_spinlock_t lock;
-+#endif
-+ u8 flags; /* 1<<p means tagmethod(p) is not present */
-+ u8 lsizenode; /* log2 of size of `node' array */
-+ int sizearray; /* size of `array' array */
-+ ktap_value *array; /* array part */
-+ ktap_tnode *node;
-+ ktap_tnode *lastfree; /* any free position is before this position */
-+
-+ int with_stats; /* for aggregation table: ptable */
-+ ktap_stat_data *sd_arr;
-+ ktap_stat_data *sd_rec;
-+
-+ ktap_tnode *sorted; /* sorted table, with linked node list */
-+ ktap_tnode *sort_head;
-+
-+ ktap_gcobject *gclist;
-+} ktap_tab;
-+
-+#define lmod(s,size) ((int)((s) & ((size)-1)))
-+
-+/* parallel table */
-+typedef struct ktap_ptab {
-+ CommonHeader;
-+ ktap_tab **tbl; /* percpu table */
-+ ktap_tab *agg;
-+} ktap_ptab;
-+
-+typedef struct ktap_stringtable {
-+ ktap_gcobject **hash;
-+ int nuse;
-+ int size;
-+} ktap_stringtable;
-+
-+#ifdef CONFIG_KTAP_FFI
-+typedef int csymbol_id;
-+typedef struct csymbol csymbol;
-+
-+/* global ffi state maintained in each ktap vm instance */
-+typedef struct ffi_state {
-+ ktap_tab *ctable;
-+ int csym_nr;
-+ csymbol *csym_arr;
-+} ffi_state;
-+
-+/* instance of csymbol */
-+typedef struct ktap_cdata {
-+ CommonHeader;
-+ csymbol_id id;
-+ union {
-+ uint64_t i;
-+ void *p; /* pointer address */
-+ void *st; /* struct member data */
-+ } u;
-+} ktap_cdata;
-+#endif
-+
-+typedef struct ktap_stats {
-+ int mem_allocated;
-+ int nr_mem_allocate;
-+ int nr_mem_free;
-+ int events_hits;
-+ int events_missed;
-+} ktap_stats;
-+
-+#define KTAP_STATS(ks) this_cpu_ptr(G(ks)->stats)
-+
-+enum {
-+ KTAP_PERCPU_DATA_STATE,
-+ KTAP_PERCPU_DATA_STACK,
-+ KTAP_PERCPU_DATA_BUFFER,
-+ KTAP_PERCPU_DATA_BUFFER2,
-+ KTAP_PERCPU_DATA_BTRACE,
-+
-+ KTAP_PERCPU_DATA_MAX
-+};
-+
-+typedef struct ktap_global_state {
-+ ktap_stringtable strt; /* hash table for strings */
-+ ktap_value registry;
-+ unsigned int seed; /* randonized seed for hashes */
-+
-+ ktap_gcobject *allgc; /* list of all collectable objects */
-+
-+ ktap_upval uvhead; /* head of double-linked list of all open upvalues */
-+
-+ struct ktap_state *mainthread;
-+#ifdef __KERNEL__
-+ /* global percpu data(like stack) */
-+ void __percpu *pcpu_data[KTAP_PERCPU_DATA_MAX][PERF_NR_CONTEXTS];
-+
-+ int __percpu *recursion_context[PERF_NR_CONTEXTS];
-+
-+ arch_spinlock_t str_lock; /* string opertion lock */
-+
-+ ktap_parm *parm;
-+ pid_t trace_pid;
-+ struct task_struct *trace_task;
-+ cpumask_var_t cpumask;
-+ struct ring_buffer *buffer;
-+ struct dentry *trace_pipe_dentry;
-+ int nr_builtin_cfunction;
-+ ktap_value *cfunction_tbl;
-+ struct task_struct *task;
-+ int trace_enabled;
-+ struct list_head timers;
-+ struct list_head probe_events_head;
-+ int exit;
-+ int wait_user;
-+ ktap_closure *trace_end_closure;
-+ struct ktap_stats __percpu *stats;
-+ struct kmem_cache *pevent_cache;
-+#ifdef CONFIG_KTAP_FFI
-+ ffi_state ffis;
-+#endif
-+#endif
-+ int error;
-+} ktap_global_state;
-+
-+typedef struct ktap_state {
-+ CommonHeader;
-+ ktap_global_state *g;
-+ int stop;
-+ StkId top;
-+ ktap_callinfo *ci;
-+ const unsigned long *oldpc;
-+ StkId stack_last;
-+ StkId stack;
-+ ktap_gcobject *openupval;
-+ ktap_callinfo baseci;
-+
-+ /* list of temp collectable objects, free when thread exit */
-+ ktap_gcobject *gclist;
-+
-+#ifdef __KERNEL__
-+ struct ktap_event *current_event;
-+#endif
-+} ktap_state;
-+
-+
-+typedef struct gcheader {
-+ CommonHeader;
-+} gcheader;
-+
-+/*
-+ * Union of all collectable objects
-+ */
-+union ktap_gcobject {
-+ gcheader gch; /* common header */
-+ union ktap_string ts;
-+ struct ktap_closure cl;
-+ struct ktap_tab h;
-+ struct ktap_ptab ph;
-+ struct ktap_proto p;
-+ struct ktap_upval uv;
-+ struct ktap_state th; /* thread */
-+ struct ktap_btrace bt; /* backtrace object */
-+#ifdef CONFIG_KTAP_FFI
-+ struct ktap_cdata cd;
-+#endif
-+};
-+
-+#define gch(o) (&(o)->gch)
-+
-+/* macros to convert a GCObject into a specific value */
-+#define rawgco2ts(o) (&((o)->ts))
-+
-+#define gco2ts(o) (&rawgco2ts(o)->tsv)
-+#define gco2uv(o) (&((o)->uv))
-+#define obj2gco(v) ((ktap_gcobject *)(v))
-+#define check_exp(c, e) (e)
-+
-+
-+/* predefined values in the registry */
-+#define KTAP_RIDX_MAINTHREAD 1
-+#define KTAP_RIDX_GLOBALS 2
-+#define KTAP_RIDX_LAST KTAP_RIDX_GLOBALS
-+
-+#define KTAP_TNONE (-1)
-+
-+#define KTAP_TNIL 0
-+#define KTAP_TBOOLEAN 1
-+#define KTAP_TLIGHTUSERDATA 2
-+#define KTAP_TNUMBER 3
-+#define KTAP_TSTRING 4
-+#define KTAP_TSHRSTR (KTAP_TSTRING | (0 << 4)) /* short strings */
-+#define KTAP_TLNGSTR (KTAP_TSTRING | (1 << 4)) /* long strings */
-+#define KTAP_TTABLE 5
-+#define KTAP_TFUNCTION 6
-+#define KTAP_TCLOSURE (KTAP_TFUNCTION | (0 << 4)) /* closure */
-+#define KTAP_TCFUNCTION (KTAP_TFUNCTION | (1 << 4)) /* light C function */
-+#define KTAP_TTHREAD 7
-+#define KTAP_TPROTO 8
-+#define KTAP_TUPVAL 9
-+#define KTAP_TEVENT 10
-+#define KTAP_TBTRACE 11
-+#define KTAP_TPTABLE 12
-+#define KTAP_TSTATDATA 13
-+#define KTAP_TCDATA 14
-+/*
-+ * type number is ok so far, but it may collide later between
-+ * 16+ and | (1 << 4), so be careful on this.
-+ */
-+
-+#define ttype(o) ((o->type) & 0x3F)
-+#define settype(obj, t) ((obj)->type = (t))
-+
-+/* raw type tag of a TValue */
-+#define rttype(o) ((o)->type)
-+
-+/* tag with no variants (bits 0-3) */
-+#define novariant(x) ((x) & 0x0F)
-+
-+/* type tag of a TValue with no variants (bits 0-3) */
-+#define ttypenv(o) (novariant(rttype(o)))
-+
-+#define val_(o) ((o)->val)
-+#define gcvalue(o) (val_(o).gc)
-+
-+#define bvalue(o) (val_(o).b)
-+#define nvalue(o) (val_(o).n)
-+#define hvalue(o) (&val_(o).gc->h)
-+#define phvalue(o) (&val_(o).gc->ph)
-+#define clvalue(o) (&val_(o).gc->cl)
-+
-+#define getstr(ts) (const char *)((ts) + 1)
-+#define eqshrstr(a, b) ((a) == (b))
-+#define rawtsvalue(o) (&val_(o).gc->ts)
-+#define svalue(o) getstr(rawtsvalue(o))
-+
-+#define pvalue(o) (&val_(o).p)
-+#define sdvalue(o) ((ktap_stat_data *)val_(o).p)
-+#define fvalue(o) (val_(o).f)
-+#define evalue(o) (val_(o).p)
-+#define btvalue(o) (&val_(o).gc->bt)
-+#define cdvalue(o) (&val_(o).gc->cd)
-+
-+#define is_nil(o) ((o)->type == KTAP_TNIL)
-+#define is_boolean(o) ((o)->type == KTAP_TBOOLEAN)
-+#define is_false(o) (is_nil(o) || (is_boolean(o) && bvalue(o) == 0))
-+#define is_shrstring(o) ((o)->type == KTAP_TSHRSTR)
-+#define is_string(o) (((o)->type & 0x0F) == KTAP_TSTRING)
-+#define is_number(o) ((o)->type == KTAP_TNUMBER)
-+#define is_table(o) ((o)->type == KTAP_TTABLE)
-+#define is_ptable(o) ((o)->type == KTAP_TPTABLE)
-+#define is_statdata(o) ((o)->type == KTAP_TSTATDATA)
-+#define is_event(o) ((o)->type == KTAP_TEVENT)
-+#define is_btrace(o) ((o)->type == KTAP_TBTRACE)
-+#define is_needclone(o) is_btrace(o)
-+#ifdef CONFIG_KTAP_FFI
-+#define is_cdata(o) ((o)->type == KTAP_TCDATA)
-+#endif
-+
-+
-+#define set_nil(obj) \
-+ { ktap_value *io = (obj); io->val.n = 0; settype(io, KTAP_TNIL); }
-+
-+#define set_boolean(obj, x) \
-+ { ktap_value *io = (obj); io->val.b = (x); settype(io, KTAP_TBOOLEAN); }
-+
-+#define set_number(obj, x) \
-+ { ktap_value *io = (obj); io->val.n = (x); settype(io, KTAP_TNUMBER); }
-+
-+#define set_statdata(obj, x) \
-+ { ktap_value *io = (obj); \
-+ io->val.p = (x); settype(io, KTAP_TSTATDATA); }
-+
-+#define set_string(obj, x) \
-+ { ktap_value *io = (obj); \
-+ ktap_string *x_ = (x); \
-+ io->val.gc = (ktap_gcobject *)x_; settype(io, x_->tsv.tt); }
-+
-+#define set_closure(obj, x) \
-+ { ktap_value *io = (obj); \
-+ io->val.gc = (ktap_gcobject *)x; settype(io, KTAP_TCLOSURE); }
-+
-+#define set_cfunction(obj, x) \
-+ { ktap_value *io = (obj); val_(io).f = (x); settype(io, KTAP_TCFUNCTION); }
-+
-+#define set_table(obj, x) \
-+ { ktap_value *io = (obj); \
-+ val_(io).gc = (ktap_gcobject *)(x); settype(io, KTAP_TTABLE); }
-+
-+#define set_ptable(obj, x) \
-+ { ktap_value *io = (obj); \
-+ val_(io).gc = (ktap_gcobject *)(x); settype(io, KTAP_TPTABLE); }
-+
-+#define set_thread(obj, x) \
-+ { ktap_value *io = (obj); \
-+ val_(io).gc = (ktap_gcobject *)(x); settype(io, KTAP_TTHREAD); }
-+
-+#define set_event(obj, x) \
-+ { ktap_value *io = (obj); val_(io).p = (x); settype(io, KTAP_TEVENT); }
-+
-+#define set_btrace(obj, x) \
-+ { ktap_value *io = (obj); \
-+ val_(io).gc = (ktap_gcobject *)(x); settype(io, KTAP_TBTRACE); }
-+
-+#ifdef CONFIG_KTAP_FFI
-+#define set_cdata(obj, x) \
-+ { ktap_value *io=(obj); \
-+ val_(io).gc = (ktap_gcobject *)(x); settype(io, KTAP_TCDATA); }
-+#endif
-+
-+#define set_obj(obj1, obj2) \
-+ { const ktap_value *io2 = (obj2); ktap_value *io1 = (obj1); \
-+ io1->val = io2->val; io1->type = io2->type; }
-+
-+#define rawequalobj(t1, t2) \
-+ (((t1)->type == (t2)->type) && kp_equalobjv(NULL, t1, t2))
-+
-+#define incr_top(ks) {ks->top++;}
-+
-+#define NUMADD(a, b) ((a) + (b))
-+#define NUMSUB(a, b) ((a) - (b))
-+#define NUMMUL(a, b) ((a) * (b))
-+#define NUMDIV(a, b) ((a) / (b))
-+#define NUMUNM(a) (-(a))
-+#define NUMEQ(a, b) ((a) == (b))
-+#define NUMLT(a, b) ((a) < (b))
-+#define NUMLE(a, b) ((a) <= (b))
-+#define NUMISNAN(a) (!NUMEQ((a), (a)))
-+
-+/* todo: floor and pow in kernel */
-+#define NUMMOD(a, b) ((a) % (b))
-+#define NUMPOW(a, b) (pow(a, b))
-+
-+#define ktap_assert(s)
-+
-+#define kp_realloc(ks, v, osize, nsize, t) \
-+ ((v) = (t *)kp_reallocv(ks, v, osize * sizeof(t), nsize * sizeof(t)))
-+
-+#define kp_error(ks, args...) \
-+ do { \
-+ kp_printf(ks, "error: "args); \
-+ G(ks)->error = 1; \
-+ kp_exit(ks); \
-+ } while(0)
-+
-+#ifdef __KERNEL__
-+#define G(ks) (ks->g)
-+
-+void kp_printf(ktap_state *ks, const char *fmt, ...);
-+extern void __kp_puts(ktap_state *ks, const char *str);
-+extern void __kp_bputs(ktap_state *ks, const char *str);
-+
-+#define kp_puts(ks, str) ({ \
-+ static const char *trace_printk_fmt \
-+ __attribute__((section("__trace_printk_fmt"))) = \
-+ __builtin_constant_p(str) ? str : NULL; \
-+ \
-+ if (__builtin_constant_p(str)) \
-+ __kp_bputs(ks, trace_printk_fmt); \
-+ else \
-+ __kp_puts(ks, str); \
-+})
-+
-+#else
-+/*
-+ * this is used for ktapc tstring operation, tstring need G(ks)->strt
-+ * and G(ks)->seed, so ktapc need to init those field
-+ */
-+#define G(ks) (&dummy_global_state)
-+extern ktap_global_state dummy_global_state;
-+
-+#define kp_printf(ks, args...) printf(args)
-+#define kp_puts(ks, str) printf("%s", str)
-+#define kp_exit(ks) exit(EXIT_FAILURE)
-+
-+#endif
-+
-+#define __maybe_unused __attribute__((unused))
-+
-+/*
-+ * KTAP_QL describes how error messages quote program elements.
-+ * CHANGE it if you want a different appearance.
-+ */
-+#define KTAP_QL(x) "'" x "'"
-+#define KTAP_QS KTAP_QL("%s")
-+
-+#define STRINGIFY(type) #type
-+
-+#endif /* __KTAP_TYPES_H__ */
-+
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/ffi/call_x86_64.S
-@@ -0,0 +1,143 @@
-+/*
-+ * call_x86_64.S - assembly code to call C function and handle return value
-+ *
-+ * This file is part of ktap by Jovi Zhangwei
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+
-+#ifdef __x86_64
-+
-+ .file "call_x86_64.S"
-+ .text
-+
-+/* ffi_call_assem_x86_64(void *stack, void *temp_stack,
-+ * void *rvalue, void *func_addr, ffi_type rftype)
-+ * @stack: base address of register values and new stack
-+ * @temp_stack: stack to store temporary values
-+ * @func_addr: Function address
-+ * @rvalue: where to put return value
-+ * @rftype: FFI type of return value
-+ */
-+ .align 2
-+ .globl ffi_call_assem_x86_64
-+ .type ffi_call_assem_x86_64,@function
-+
-+ffi_call_assem_x86_64:
-+ movq (%rsp), %rax /* save return address */
-+ /* move stuffs to temp memory region(void *temp_stack) */
-+ movq %rcx, (%rsi) /* save pointer to return value */
-+ movq %r8, 8(%rsi) /* save return_ffi_type */
-+ movq %rbp, 16(%rsi) /* save %rbp */
-+ movq %rax, 24(%rsi) /* save return address */
-+ movq %rsp, 32(%rsi) /* save %rsp */
-+ movq %rsi, %rbp /* point %rbp to temp memory region */
-+
-+ movq %rdx, %r11 /* move function address to %r11 */
-+
-+ movq %rdi, %r10 /* set %r10 point to register region */
-+ movq (%r10), %rdi /* load registers */
-+ movq 8(%r10), %rsi
-+ movq 16(%r10), %rdx
-+ movq 24(%r10), %rcx
-+ movq 32(%r10), %r8
-+ movq 40(%r10), %r9
-+ xorq %rax, %rax
-+
-+ leaq 48(%r10), %rsp
-+
-+ callq *%r11
-+
-+ movq 32(%rbp), %rsp /* restore %rsp */
-+ movq 24(%rbp), %rcx /* restore return address */
-+ movq %rcx, (%rsp)
-+
-+ movq (%rbp), %rcx /* get pointer to return value */
-+ movq 8(%rbp), %r8 /* get return_ffi_type */
-+ movq 16(%rbp), %rbp /* restore rbp */
-+
-+ leaq .Lreturn_table(%rip), %r11 /* start address of return_table */
-+ movslq (%r11, %r8, 8), %r11 /* fetch target address from table */
-+ jmpq *%r11 /* jump according to value in table */
-+
-+ .align 8
-+.Lreturn_table:
-+ .quad .Lreturn_void /* FFI_VOID */
-+ .quad .Lreturn_uint8 /* FFI_UINT8 */
-+ .quad .Lreturn_int8 /* FFI_INT8 */
-+ .quad .Lreturn_uint16 /* FFI_UINT16 */
-+ .quad .Lreturn_int16 /* FFI_INT16 */
-+ .quad .Lreturn_uint32 /* FFI_UINT32 */
-+ .quad .Lreturn_int32 /* FFI_INT32 */
-+ .quad .Lreturn_uint64 /* FFI_UINT64 */
-+ .quad .Lreturn_int64 /* FFI_INT64 */
-+ .quad .Lreturn_ptr /* FFI_PTR */
-+ .quad .Lreturn_func /* FFI_FUNC */
-+ .quad .Lreturn_struct /* FFI_STRUCT */
-+ .quad .Lreturn_unknown /* FFI_UNKNOWN */
-+
-+ .align 8
-+.Lreturn_void:
-+.Lreturn_func:
-+.Lreturn_unknown:
-+ retq
-+ .align 8
-+.Lreturn_uint8:
-+ movzbq %al, %rax
-+ movq %rax, (%rcx)
-+ retq
-+ .align 8
-+.Lreturn_int8:
-+ movsbq %al, %rax
-+ movq %rax, (%rcx)
-+ retq
-+ .align 8
-+.Lreturn_uint16:
-+ movzwq %ax, %rax
-+ movq %rax, (%rcx)
-+ retq
-+ .align 8
-+.Lreturn_int16:
-+ movswq %ax, %rax
-+ movq %rax, (%rcx)
-+ retq
-+ .align 8
-+.Lreturn_uint32:
-+ movl %eax, %eax
-+ movq %rax, (%rcx)
-+ retq
-+ .align 8
-+.Lreturn_int32:
-+ movslq %eax, %rax
-+ movq %rax, (%rcx)
-+ retq
-+ .align 8
-+.Lreturn_uint64:
-+.Lreturn_int64:
-+.Lreturn_ptr:
-+ movq %rax, (%rcx)
-+ retq
-+/* Struct type indicates that struct is put into at most two registers,
-+ * and 16 bytes space is always available
-+ */
-+ .align 8
-+.Lreturn_struct:
-+ movq %rax, (%rcx)
-+ movq %rdx, 8(%rcx)
-+ retq
-+
-+#endif /* end for __x86_64 */
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/ffi/cdata.c
-@@ -0,0 +1,67 @@
-+/*
-+ * cdata.c - support functions for ktap_cdata
-+ *
-+ * This file is part of ktap by Jovi Zhangwei
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+
-+#include "../../include/ktap_types.h"
-+#include "../../include/ktap_ffi.h"
-+#include "../kp_obj.h"
-+
-+ktap_cdata *kp_cdata_new(ktap_state *ks)
-+{
-+ ktap_cdata *cd;
-+
-+ cd = &kp_newobject(ks, KTAP_TCDATA, sizeof(ktap_cdata), NULL)->cd;
-+
-+ return cd;
-+}
-+
-+ktap_cdata *kp_cdata_new_ptr(ktap_state *ks, void *addr, csymbol_id id)
-+{
-+ ktap_cdata *cd;
-+
-+ cd = kp_cdata_new(ks);
-+ cd_set_csym_id(cd, id);
-+ cd_ptr(cd) = addr;
-+
-+ return cd;
-+}
-+
-+ktap_cdata *kp_cdata_new_struct(ktap_state *ks, void *val, csymbol_id id)
-+{
-+ ktap_cdata *cd;
-+
-+ cd = kp_cdata_new(ks);
-+ cd_set_csym_id(cd, id);
-+ cd_struct(cd) = val;
-+
-+ return cd;
-+}
-+
-+void kp_cdata_dump(ktap_state *ks, ktap_cdata *cd)
-+{
-+ switch (cd_type(ks, cd)) {
-+ case FFI_PTR:
-+ kp_printf(ks, "pointer(%p)", cd_ptr(cd));
-+ break;
-+ default:
-+ kp_printf(ks, "unsupported cdata type %d!\n", cd_type(ks, cd));
-+ }
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/ffi/ffi_call.c
-@@ -0,0 +1,427 @@
-+/*
-+ * ffi_call.c - foreign function calling library support for ktap
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License 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/ctype.h>
-+#include <linux/slab.h>
-+#include "../../include/ktap_types.h"
-+#include "../../include/ktap_ffi.h"
-+#include "../ktap.h"
-+#include "../kp_vm.h"
-+#include "../kp_obj.h"
-+
-+static int ffi_type_check(ktap_state *ks, csymbol_func *csf, int idx)
-+{
-+ StkId arg;
-+ csymbol *cs;
-+ ffi_type type;
-+
-+ if (idx >= csymf_arg_nr(csf))
-+ return 0;
-+ arg = kp_arg(ks, idx + 1);
-+ cs = csymf_arg(ks, csf, idx);
-+ type = csym_type(cs);
-+
-+ if (type == FFI_FUNC)
-+ goto error;
-+
-+ switch (ttypenv(arg)) {
-+ case KTAP_TLIGHTUSERDATA:
-+ if (type != FFI_PTR) goto error;
-+ break;
-+ case KTAP_TBOOLEAN:
-+ case KTAP_TNUMBER:
-+ if (type != FFI_UINT8 && type != FFI_INT8
-+ && type != FFI_UINT16 && type != FFI_INT16
-+ && type != FFI_UINT32 && type != FFI_INT32
-+ && type != FFI_UINT64 && type != FFI_INT64)
-+ goto error;
-+ break;
-+ case KTAP_TSTRING:
-+ if (type != FFI_PTR && type != FFI_UINT8 && type != FFI_INT8)
-+ goto error;
-+ break;
-+ case KTAP_TCDATA:
-+ if (cs != cd_csym(ks, cdvalue(arg)))
-+ goto error;
-+ break;
-+ default:
-+ goto error;
-+ }
-+ return 0;
-+
-+ error:
-+ kp_error(ks, "Error: Cannot convert to csymbol %s for arg %d\n",
-+ csym_name(cs), idx);
-+ return -1;
-+}
-+
-+static csymbol *ffi_get_arg_csym(ktap_state *ks, csymbol_func *csf, int idx)
-+{
-+ StkId arg;
-+ csymbol *cs;
-+
-+ if (idx < csymf_arg_nr(csf))
-+ return csymf_arg(ks, csf, idx);
-+
-+ arg = kp_arg(ks, idx + 1);
-+ cs = id_to_csym(ks, ffi_get_csym_id(ks, "void *"));
-+ switch (ttypenv(arg)) {
-+ case KTAP_TLIGHTUSERDATA:
-+ case KTAP_TBOOLEAN:
-+ case KTAP_TNUMBER:
-+ case KTAP_TSTRING:
-+ return cs;
-+ case KTAP_TCDATA:
-+ return cd_csym(ks, cdvalue(arg));
-+ default:
-+ kp_error(ks, "Error: Cannot get type for arg %d\n", idx);
-+ return cs;
-+ }
-+}
-+
-+static void ffi_unpack(ktap_state *ks, csymbol_func *csf, int idx,
-+ char *dst, int align)
-+{
-+ StkId arg = kp_arg(ks, idx + 1);
-+ csymbol *cs = ffi_get_arg_csym(ks, csf, idx);
-+ ffi_type type = csym_type(cs);
-+ size_t size = csym_size(ks, cs);
-+ void *p;
-+ struct ktap_cdata *cd;
-+
-+ /* initialize the destination section */
-+ memset(dst, 0, ALIGN(size, align));
-+
-+ switch (ttypenv(arg)) {
-+ case KTAP_TBOOLEAN:
-+ memcpy(dst, &bvalue(arg), sizeof(bool));
-+ return;
-+ case KTAP_TLIGHTUSERDATA:
-+ memcpy(dst, pvalue(arg), size);
-+ return;
-+ case KTAP_TNUMBER:
-+ memcpy(dst, &nvalue(arg), size < sizeof(ktap_number) ?
-+ size : sizeof(ktap_number));
-+ return;
-+ case KTAP_TSTRING:
-+ p = &rawtsvalue(arg)->tsv + 1;
-+ memcpy(dst, &p, size);
-+ return;
-+ }
-+
-+ cd = cdvalue(arg);
-+ switch (type) {
-+ case FFI_VOID:
-+ kp_error(ks, "Error: Cannot copy data from void type\n");
-+ return;
-+ case FFI_UINT8:
-+ case FFI_INT8:
-+ case FFI_UINT16:
-+ case FFI_INT16:
-+ case FFI_UINT32:
-+ case FFI_INT32:
-+ case FFI_UINT64:
-+ case FFI_INT64:
-+ memcpy(dst, &cd_int(cd), size);
-+ return;
-+ case FFI_PTR:
-+ memcpy(dst, &cd_ptr(cd), size);
-+ return;
-+ case FFI_STRUCT:
-+ memcpy(dst, cd_struct(cd), size);
-+ return;
-+ case FFI_FUNC:
-+ case FFI_UNKNOWN:
-+ kp_error(ks, "Error: internal error for csymbol %s\n",
-+ csym_name(cs));
-+ return;
-+ }
-+}
-+
-+#ifdef __x86_64
-+
-+enum arg_status {
-+ IN_REGISTER,
-+ IN_MEMORY,
-+ IN_STACK,
-+};
-+
-+#define ALIGN_STACK(v, a) ((void *)(ALIGN(((uint64_t)v), a)))
-+#define STACK_ALIGNMENT 8
-+#define REDZONE_SIZE 128
-+#define GPR_SIZE (sizeof(void *))
-+#define MAX_GPR 6
-+#define MAX_GPR_SIZE (MAX_GPR * GPR_SIZE)
-+#define NEWSTACK_SIZE 512
-+
-+#define ffi_call(ks, cf, rvalue) ffi_call_x86_64(ks, cf, rvalue)
-+
-+extern void ffi_call_assem_x86_64(void *stack, void *temp_stack,
-+ void *func_addr, void *rvalue, ffi_type rtype);
-+
-+static void ffi_call_x86_64(ktap_state *ks, csymbol_func *csf, void *rvalue)
-+{
-+ int i;
-+ int gpr_nr;
-+ int arg_bytes; /* total bytes needed for exceeded args in stack */
-+ int mem_bytes; /* total bytes needed for memory storage */
-+ char *stack, *stack_p, *gpr_p, *arg_p, *mem_p, *tmp_p;
-+ int arg_nr;
-+ csymbol *rsym;
-+ ffi_type rtype;
-+ size_t rsize;
-+ bool ret_in_memory;
-+ /* New stack to call C function */
-+ char space[NEWSTACK_SIZE];
-+
-+ arg_nr = kp_arg_nr(ks);
-+ rsym = csymf_ret(ks, csf);
-+ rtype = csym_type(rsym);
-+ rsize = csym_size(ks, rsym);
-+ ret_in_memory = false;
-+ if (rtype == FFI_STRUCT) {
-+ if (rsize > 16) {
-+ rvalue = kp_malloc(ks, rsize);
-+ rtype = FFI_VOID;
-+ ret_in_memory = true;
-+ } else {
-+ /* much easier to always copy 16 bytes from registers */
-+ rvalue = kp_malloc(ks, 16);
-+ }
-+ }
-+
-+ gpr_nr = 0;
-+ arg_bytes = mem_bytes = 0;
-+ if (ret_in_memory)
-+ gpr_nr++;
-+ /* calculate bytes needed for stack */
-+ for (i = 0; i < arg_nr; i++) {
-+ csymbol *cs = ffi_get_arg_csym(ks, csf, i);
-+ size_t size = csym_size(ks, cs);
-+ size_t align = csym_align(ks, cs);
-+ enum arg_status st = IN_REGISTER;
-+ int n_gpr_nr = 0;
-+ if (size > 32) {
-+ st = IN_MEMORY;
-+ n_gpr_nr = 1;
-+ } else if (size > 16)
-+ st = IN_STACK;
-+ else
-+ n_gpr_nr = ALIGN(size, GPR_SIZE) / GPR_SIZE;
-+
-+ if (gpr_nr + n_gpr_nr > MAX_GPR) {
-+ if (st == IN_MEMORY)
-+ arg_bytes += GPR_SIZE;
-+ else
-+ st = IN_STACK;
-+ } else
-+ gpr_nr += n_gpr_nr;
-+ if (st == IN_STACK) {
-+ arg_bytes = ALIGN(arg_bytes, align);
-+ arg_bytes += size;
-+ arg_bytes = ALIGN(arg_bytes, STACK_ALIGNMENT);
-+ }
-+ if (st == IN_MEMORY) {
-+ mem_bytes = ALIGN(mem_bytes, align);
-+ mem_bytes += size;
-+ mem_bytes = ALIGN(mem_bytes, STACK_ALIGNMENT);
-+ }
-+ }
-+
-+ /* apply space to fake stack for C function call */
-+ if (16 + REDZONE_SIZE + MAX_GPR_SIZE + arg_bytes +
-+ mem_bytes + 6 * 8 >= NEWSTACK_SIZE) {
-+ kp_error(ks, "Unable to handle that many arguments by now\n");
-+ return;
-+ }
-+ stack = space;
-+ /* 128 bytes below %rsp is red zone */
-+ /* stack should be 16-bytes aligned */
-+ stack_p = ALIGN_STACK(stack + REDZONE_SIZE, 16);
-+ /* save general purpose registers here */
-+ gpr_p = stack_p;
-+ memset(gpr_p, 0, MAX_GPR_SIZE);
-+ /* save arguments in stack here */
-+ arg_p = gpr_p + MAX_GPR_SIZE;
-+ /* save arguments in memory here */
-+ mem_p = arg_p + arg_bytes;
-+ /* set additional space as temporary space */
-+ tmp_p = mem_p + mem_bytes;
-+
-+ /* copy arguments here */
-+ gpr_nr = 0;
-+ if (ret_in_memory) {
-+ memcpy(gpr_p, &rvalue, GPR_SIZE);
-+ gpr_p += GPR_SIZE;
-+ gpr_nr++;
-+ }
-+ for (i = 0; i < arg_nr; i++) {
-+ csymbol *cs = ffi_get_arg_csym(ks, csf, i);
-+ size_t size = csym_size(ks, cs);
-+ size_t align = csym_align(ks, cs);
-+ enum arg_status st = IN_REGISTER;
-+ int n_gpr_nr = 0;
-+ if (size > 32) {
-+ st = IN_MEMORY;
-+ n_gpr_nr = 1;
-+ } else if (size > 16)
-+ st = IN_STACK;
-+ else
-+ n_gpr_nr = ALIGN(size, GPR_SIZE) / GPR_SIZE;
-+
-+ if (st == IN_MEMORY)
-+ mem_p = ALIGN_STACK(mem_p, align);
-+ /* Tricky way about storing it above mem_p. It won't overflow
-+ * because temp region can be temporarily used if necesseary. */
-+ ffi_unpack(ks, csf, i, mem_p, GPR_SIZE);
-+ if (gpr_nr + n_gpr_nr > MAX_GPR) {
-+ if (st == IN_MEMORY) {
-+ memcpy(arg_p, &mem_p, GPR_SIZE);
-+ arg_p += GPR_SIZE;
-+ } else
-+ st = IN_STACK;
-+ } else {
-+ memcpy(gpr_p, mem_p, n_gpr_nr * GPR_SIZE);
-+ gpr_p += n_gpr_nr * GPR_SIZE;
-+ gpr_nr += n_gpr_nr;
-+ }
-+ if (st == IN_STACK) {
-+ arg_p = ALIGN_STACK(arg_p, align);
-+ memcpy(arg_p, mem_p, size);
-+ arg_p += size;
-+ arg_p = ALIGN_STACK(arg_p, STACK_ALIGNMENT);
-+ }
-+ if (st == IN_MEMORY) {
-+ mem_p += size;
-+ mem_p = ALIGN_STACK(mem_p, STACK_ALIGNMENT);
-+ }
-+ }
-+
-+ kp_verbose_printf(ks, "Stack location: %p -redzone- %p -general purpose "
-+ "register used- %p -zero- %p -stack for argument- %p"
-+ " -memory for argument- %p -temp stack-\n",
-+ stack, stack_p, gpr_p, stack_p + MAX_GPR_SIZE,
-+ arg_p, mem_p);
-+ kp_verbose_printf(ks, "GPR number: %d; arg in stack: %d; "
-+ "arg in mem: %d\n",
-+ gpr_nr, arg_bytes, mem_bytes);
-+ kp_verbose_printf(ks, "Return: address %p type %d\n", rvalue, rtype);
-+ kp_verbose_printf(ks, "Number of register used: %d\n", gpr_nr);
-+ kp_verbose_printf(ks, "Start FFI call on %p\n", csf->addr);
-+ ffi_call_assem_x86_64(stack_p, tmp_p, csf->addr, rvalue, rtype);
-+}
-+
-+#else /* non-supported platform */
-+
-+#define ffi_call(ks, cf, rvalue) ffi_call_unsupported(ks, cf, rvalue)
-+
-+static void ffi_call_unsupported(ktap_state *ks,
-+ csymbol_func *csf, void *rvalue)
-+{
-+ kp_error(ks, "unsupported architecture.\n");
-+}
-+
-+#endif /* end for platform-specific setting */
-+
-+
-+static int ffi_set_return(ktap_state *ks, void *rvalue, csymbol_id ret_id)
-+{
-+ ktap_cdata *cd;
-+ ffi_type type = csym_type(id_to_csym(ks, ret_id));
-+
-+ /* push return value to ktap stack */
-+ switch (type) {
-+ case FFI_VOID:
-+ return 0;
-+ case FFI_UINT8:
-+ case FFI_INT8:
-+ case FFI_UINT16:
-+ case FFI_INT16:
-+ case FFI_UINT32:
-+ case FFI_INT32:
-+ case FFI_UINT64:
-+ case FFI_INT64:
-+ set_number(ks->top, (ktap_number)rvalue);
-+ break;
-+ case FFI_PTR:
-+ cd = kp_cdata_new_ptr(ks, rvalue, ret_id);
-+ set_cdata(ks->top, cd);
-+ break;
-+ case FFI_STRUCT:
-+ cd = kp_cdata_new_struct(ks, rvalue, ret_id);
-+ set_cdata(ks->top, cd);
-+ break;
-+ case FFI_FUNC:
-+ case FFI_UNKNOWN:
-+ kp_error(ks, "Error: Have not support ffi_type %s\n",
-+ ffi_type_name(type));
-+ return 0;
-+ }
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+/*
-+ * Call C into function
-+ * First argument should be function symbol address, argument types
-+ * and return type.
-+ * Left arguments should be arguments for calling the C function.
-+ * Types between Ktap and C are converted automatically.
-+ * Only support x86_64 function call by now
-+ */
-+int kp_ffi_call(ktap_state *ks, csymbol_func *csf)
-+{
-+ int i;
-+ int expected_arg_nr, arg_nr;
-+ ktap_closure *cl;
-+ void *rvalue;
-+
-+ expected_arg_nr = csymf_arg_nr(csf);
-+ arg_nr = kp_arg_nr(ks);
-+
-+ /* check stack status for C call */
-+ if (!csf->has_var_arg && expected_arg_nr != arg_nr) {
-+ kp_error(ks, "wrong argument number %d, which should be %d\n",
-+ arg_nr, expected_arg_nr);
-+ goto out;
-+ }
-+ if (csf->has_var_arg && expected_arg_nr > arg_nr) {
-+ kp_error(ks, "argument number %d, which should be bigger than %d\n",
-+ arg_nr, expected_arg_nr);
-+ goto out;
-+ }
-+
-+ /* maybe useful later, leave it here first */
-+ cl = clvalue(kp_arg(ks, arg_nr + 1));
-+
-+ /* check the argument types */
-+ for (i = 0; i < arg_nr; i++) {
-+ if (ffi_type_check(ks, csf, i) < 0)
-+ goto out;
-+ }
-+
-+ /* platform-specific calling workflow */
-+ ffi_call(ks, csf, &rvalue);
-+ kp_verbose_printf(ks, "Finish FFI call\n");
-+
-+out:
-+ return ffi_set_return(ks, rvalue, csymf_ret_id(csf));
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/ffi/ffi_symbol.c
-@@ -0,0 +1,174 @@
-+/*
-+ * ffi_symbol.c - ktapvm kernel module ffi symbol submodule
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+
-+#include "../../include/ktap_types.h"
-+#include "../../include/ktap_ffi.h"
-+#include "../ktap.h"
-+#include "../kp_vm.h"
-+#include "../kp_obj.h"
-+#include "../kp_str.h"
-+#include "../kp_tab.h"
-+
-+void setup_kp_ffi_symbol_table(ktap_state *ks);
-+
-+
-+static inline csymbol *get_csym_arr(ktap_state *ks)
-+{
-+ return G(ks)->ffis.csym_arr;
-+}
-+
-+static inline int get_csym_nr(ktap_state *ks)
-+{
-+ return G(ks)->ffis.csym_nr;
-+}
-+
-+static inline void set_csym_arr(ktap_state *ks, csymbol *csym)
-+{
-+ G(ks)->ffis.csym_arr = csym;
-+}
-+
-+static inline void set_csym_nr(ktap_state *ks, int nr)
-+{
-+ G(ks)->ffis.csym_nr = nr;
-+}
-+
-+
-+static inline ktap_tab *get_ffi_ctable(ktap_state *ks)
-+{
-+ return G(ks)->ffis.ctable;
-+}
-+
-+static void setup_ffi_ctable(ktap_state *ks)
-+{
-+ ktap_value ffi_lib_name, ffi_mt;
-+ ktap_tab *registry;
-+ const ktap_value *gt;
-+
-+ gt = kp_tab_getint(hvalue(&G(ks)->registry), KTAP_RIDX_GLOBALS);
-+
-+ G(ks)->ffis.ctable = kp_tab_new(ks);
-+
-+ /* insert ffi C table to global table */
-+ set_table(&ffi_mt, get_ffi_ctable(ks));
-+ set_string(&ffi_lib_name, kp_tstring_new(ks, "C"));
-+ registry = hvalue(gt);
-+ kp_tab_setvalue(ks, registry, &ffi_lib_name, &ffi_mt);
-+}
-+
-+void ffi_set_csym_arr(ktap_state *ks, int cs_nr, csymbol *new_arr)
-+{
-+ set_csym_nr(ks, cs_nr);
-+ set_csym_arr(ks, new_arr);
-+
-+ if (!new_arr)
-+ return;
-+
-+ setup_kp_ffi_symbol_table(ks);
-+}
-+
-+inline csymbol *ffi_get_csym_by_id(ktap_state *ks, int id)
-+{
-+ return &(get_csym_arr(ks)[id]);
-+}
-+
-+csymbol_id ffi_get_csym_id(ktap_state *ks, char *name)
-+{
-+ int i;
-+
-+ for (i = 0; i < get_csym_nr(ks); i++) {
-+ if (!strcmp(name, csym_name(ffi_get_csym_by_id(ks, i)))) {
-+ return i;
-+ }
-+ }
-+
-+ kp_error(ks, "Cannot find csymbol with name %s\n", name);
-+ return 0;
-+}
-+
-+static void add_ffi_func_to_ctable(ktap_state *ks, csymbol_id id)
-+{
-+ ktap_value func_name, fv;
-+ ktap_cdata *cd;
-+ csymbol *cs;
-+
-+ /* push cdata to ctable */
-+ set_cdata(&fv, kp_newobject(ks, KTAP_TCDATA, sizeof(ktap_cdata), NULL));
-+ cd = cdvalue(&fv);
-+ cd_set_csym_id(cd, id);
-+
-+ cs = id_to_csym(ks, id);
-+ set_string(&func_name, kp_tstring_new(ks, csym_name(cs)));
-+ kp_tab_setvalue(ks, get_ffi_ctable(ks), &func_name, &fv);
-+}
-+
-+void setup_kp_ffi_symbol_table(ktap_state *ks)
-+{
-+ int i;
-+ csymbol *cs;
-+
-+ setup_ffi_ctable(ks);
-+
-+ /* push all functions to ctable */
-+ for (i = 0; i < get_csym_nr(ks); i++) {
-+ cs = &get_csym_arr(ks)[i];
-+ switch (cs->type) {
-+ case FFI_FUNC:
-+ kp_verbose_printf(ks, "[%d] loading C function %s\n",
-+ i, csym_name(cs));
-+ add_ffi_func_to_ctable(ks, i);
-+ kp_verbose_printf(ks, "%s loaded\n", csym_name(cs));
-+ break;
-+ case FFI_STRUCT:
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+}
-+
-+void kp_ffi_free_symbol(ktap_state *ks)
-+{
-+ int i;
-+ csymbol_id *arg_ids;
-+ csymbol *cs;
-+
-+ if (!get_csym_arr(ks))
-+ return;
-+
-+ for (i = 0; i < get_csym_nr(ks); i++) {
-+ cs = &get_csym_arr(ks)[i];
-+ switch (csym_type(cs)) {
-+ case FFI_FUNC:
-+ arg_ids = csym_func_arg_ids(cs);
-+ if (arg_ids)
-+ kp_free(ks, arg_ids);
-+ break;
-+ case FFI_STRUCT:
-+ /*@TODO finish this 20.11 2013 (houqp)*/
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+
-+ kp_free(ks, get_csym_arr(ks));
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/ffi/ffi_type.c
-@@ -0,0 +1,51 @@
-+#include "../../include/ktap_ffi.h"
-+#ifdef __KERNEL__
-+#include <linux/types.h>
-+#else
-+#include <stdint.h>
-+#include <stddef.h>
-+#endif
-+
-+#define CTYPE_MODE_HELPER(name, type) \
-+struct _##name##_align { \
-+ type t1; \
-+ char c; \
-+ type t2; \
-+};
-+
-+#define CTYPE_MODE(name) \
-+{ \
-+ offsetof(struct _##name##_align, c), \
-+ offsetof(struct _##name##_align, t2) - \
-+ offsetof(struct _##name##_align, c), \
-+ #name \
-+}
-+
-+#define CTYPE_MODE_NAME(name) _##name##_mode
-+
-+/* ffi_ctype_mode should be corresponded to ffi_ctype */
-+CTYPE_MODE_HELPER(uint8, uint8_t);
-+CTYPE_MODE_HELPER(int8, int8_t);
-+CTYPE_MODE_HELPER(uint16, uint16_t);
-+CTYPE_MODE_HELPER(int16, int16_t);
-+CTYPE_MODE_HELPER(uint32, uint32_t);
-+CTYPE_MODE_HELPER(int32, int32_t);
-+CTYPE_MODE_HELPER(uint64, uint64_t);
-+CTYPE_MODE_HELPER(int64, int64_t);
-+CTYPE_MODE_HELPER(pointer, void*);
-+
-+const ffi_mode ffi_type_modes[NUM_FFI_TYPE+1] = {
-+ {0, 1, "void"},
-+ CTYPE_MODE(uint8),
-+ CTYPE_MODE(int8),
-+ CTYPE_MODE(uint16),
-+ CTYPE_MODE(int16),
-+ CTYPE_MODE(uint32),
-+ CTYPE_MODE(int32),
-+ CTYPE_MODE(uint64),
-+ CTYPE_MODE(int64),
-+ CTYPE_MODE(pointer),
-+ {0, 1, "function"},
-+ {0, 1, "struct"},
-+ {0, 1, "unknown"},
-+};
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/ffi/ffi_util.c
-@@ -0,0 +1,92 @@
-+/*
-+ * ffi_util.c - utility function for ffi module
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+
-+#include "../../include/ktap_types.h"
-+#include "../../include/ktap_ffi.h"
-+#include "../ktap.h"
-+
-+size_t csym_size(ktap_state *ks, csymbol *cs)
-+{
-+ ffi_type type = csym_type(cs);
-+ switch(type) {
-+ case FFI_STRUCT:
-+ if (csym_struct(cs)->align == 0)
-+ init_csym_struct(ks, csym_struct(cs));
-+ return csym_struct(cs)->size;
-+ default:
-+ return ffi_type_size(type);
-+ }
-+}
-+
-+size_t csym_align(ktap_state *ks, csymbol *cs)
-+{
-+ ffi_type type = csym_type(cs);
-+ switch(type) {
-+ case FFI_STRUCT:
-+ if (csym_struct(cs)->align == 0)
-+ init_csym_struct(ks, csym_struct(cs));
-+ return csym_struct(cs)->align;
-+ default:
-+ return ffi_type_align(type);
-+ }
-+}
-+
-+size_t csym_struct_offset(ktap_state *ks, csymbol_struct *csst, int idx)
-+{
-+ int nr = csymst_mb_nr(csst);
-+ size_t off = 0;
-+ size_t align = 1;
-+ int i;
-+
-+ if (idx < 0 || idx > nr)
-+ return -1;
-+ for (i = 0; i < idx; i++) {
-+ csymbol *var_cs = csymst_mb(ks, csst, i);
-+ size_t var_size = csym_size(ks, var_cs);
-+ size_t var_align = csym_align(ks, var_cs);
-+ off = ALIGN(off, var_align);
-+ off += var_size;
-+ align = align > var_align ? align : var_align;
-+ }
-+ off = ALIGN(off, align);
-+ return off;
-+}
-+
-+void init_csym_struct(ktap_state *ks, csymbol_struct *csst)
-+{
-+ int nr = csymst_mb_nr(csst);
-+ size_t size = 0;
-+ size_t align = 1;
-+ int i;
-+
-+ for (i = 0; i < nr; i++) {
-+ csymbol *var_cs = csymst_mb(ks, csst, i);
-+ size_t var_size = csym_size(ks, var_cs);
-+ size_t var_align = csym_align(ks, var_cs);
-+ size = ALIGN(size, var_align);
-+ size += var_size;
-+ align = align > var_align ? align : var_align;
-+ }
-+ size = ALIGN(size, align);
-+ csst->size = size;
-+ csst->align = align;
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_amalg.c
-@@ -0,0 +1,43 @@
-+/*
-+ * kp_amalg.c - ktapvm kernel module amalgamation.
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+
-+#include "ktap.c"
-+#include "kp_opcode.c"
-+#include "kp_obj.c"
-+#include "kp_load.c"
-+#include "kp_str.c"
-+#include "kp_tab.c"
-+#include "kp_transport.c"
-+#include "kp_vm.c"
-+#include "lib_base.c"
-+#include "lib_ansi.c"
-+#include "lib_kdebug.c"
-+#include "lib_timer.c"
-+
-+#ifdef CONFIG_KTAP_FFI
-+#include "ffi/ffi_call.c"
-+#include "ffi/ffi_type.c"
-+#include "ffi/ffi_symbol.c"
-+#include "ffi/cdata.c"
-+#include "ffi/ffi_util.c"
-+#include "lib_ffi.c"
-+#endif
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_load.c
-@@ -0,0 +1,401 @@
-+/*
-+ * kp_load.c - loader for ktap bytecode chunk file
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License 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/slab.h>
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_ffi.h"
-+#include "ktap.h"
-+#include "kp_load.h"
-+#include "kp_obj.h"
-+#include "kp_str.h"
-+#include "kp_tab.h"
-+#include "kp_vm.h"
-+
-+#define KTAPC_TAIL "\x19\x93\r\n\x1a\n"
-+
-+struct load_state {
-+ unsigned char *buff;
-+ int pos;
-+ ktap_state *ks;
-+};
-+
-+#define READ_CHAR(S) (S->buff[S->pos++])
-+#define READ_BYTE(S) READ_CHAR(S)
-+#define READ_INT(S) load_int(S)
-+#define READ_NUMBER(S) load_number(S)
-+#define READ_STRING(S) load_string(S)
-+#define READ_VECTOR(S, dst, size) \
-+ do { \
-+ memcpy(dst, &S->buff[S->pos], size); \
-+ S->pos += size; \
-+ } while(0)
-+
-+#define NEW_VECTOR(S, size) kp_malloc(S->ks, size)
-+#define FREE_VECTOR(S, v) kp_free(S->ks, v)
-+#define GET_CURRENT(S) &S->buff[S->pos]
-+#define ADD_POS(S, size) S->pos += size
-+
-+
-+static int load_function(struct load_state *S, ktap_proto *f);
-+
-+
-+static int load_int(struct load_state *S)
-+{
-+ int x;
-+
-+ READ_VECTOR(S, &x, sizeof(int));
-+ return x;
-+}
-+
-+static long load_number(struct load_state *S)
-+{
-+ long x;
-+
-+ READ_VECTOR(S, &x, sizeof(ktap_number));
-+ return x;
-+}
-+
-+static ktap_string *load_string(struct load_state *S)
-+{
-+ ktap_string *ts;
-+ size_t size;
-+
-+ size = READ_INT(S);
-+
-+ if (!size)
-+ return NULL;
-+ else {
-+ char *s = GET_CURRENT(S);
-+ ADD_POS(S, size);
-+ /* remove trailing '\0' */
-+ ts = kp_tstring_newlstr(S->ks, s, size - 1);
-+ return ts;
-+ }
-+}
-+
-+
-+static int load_code(struct load_state *S, ktap_proto *f)
-+{
-+ int n = READ_INT(S);
-+
-+ f->sizecode = n;
-+ f->code = NEW_VECTOR(S, n * sizeof(ktap_instruction));
-+ READ_VECTOR(S, f->code, n * sizeof(ktap_instruction));
-+
-+ return 0;
-+}
-+
-+static int load_constants(struct load_state *S, ktap_proto *f)
-+{
-+ int i,n;
-+
-+ n = READ_INT(S);
-+
-+ f->sizek = n;
-+ f->k = NEW_VECTOR(S, n * sizeof(ktap_value));
-+ for (i = 0; i < n; i++)
-+ set_nil(&f->k[i]);
-+
-+ for (i=0; i < n; i++) {
-+ ktap_value *o = &f->k[i];
-+
-+ int t = READ_CHAR(S);
-+ switch (t) {
-+ case KTAP_TNIL:
-+ set_nil(o);
-+ break;
-+ case KTAP_TBOOLEAN:
-+ set_boolean(o, READ_CHAR(S));
-+ break;
-+ case KTAP_TNUMBER:
-+ /*
-+ * todo: kernel not support fp, check double when
-+ * loading
-+ */
-+ set_number(o, READ_NUMBER(S));
-+ break;
-+ case KTAP_TSTRING:
-+ set_string(o, READ_STRING(S));
-+ break;
-+ default:
-+ kp_error(S->ks, "ktap: load_constants: "
-+ "unknow ktap_value\n");
-+ return -1;
-+
-+ }
-+ }
-+
-+ n = READ_INT(S);
-+ f->p = NEW_VECTOR(S, n * sizeof(ktap_proto));
-+ f->sizep = n;
-+ for (i = 0; i < n; i++)
-+ f->p[i] = NULL;
-+ for (i = 0; i < n; i++) {
-+ f->p[i] = kp_newproto(S->ks);
-+ if (load_function(S, f->p[i]))
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+
-+static int load_upvalues(struct load_state *S, ktap_proto *f)
-+{
-+ int i,n;
-+
-+ n = READ_INT(S);
-+ f->upvalues = NEW_VECTOR(S, n * sizeof(ktap_upvaldesc));
-+ f->sizeupvalues = n;
-+
-+ for (i = 0; i < n; i++)
-+ f->upvalues[i].name = NULL;
-+
-+ for (i = 0; i < n; i++) {
-+ f->upvalues[i].instack = READ_BYTE(S);
-+ f->upvalues[i].idx = READ_BYTE(S);
-+ }
-+
-+ return 0;
-+}
-+
-+static int load_debuginfo(struct load_state *S, ktap_proto *f)
-+{
-+ int i,n;
-+
-+ f->source = READ_STRING(S);
-+ n = READ_INT(S);
-+ f->sizelineinfo = n;
-+ f->lineinfo = NEW_VECTOR(S, n * sizeof(int));
-+ READ_VECTOR(S, f->lineinfo, n * sizeof(int));
-+ n = READ_INT(S);
-+ f->locvars = NEW_VECTOR(S, n * sizeof(struct ktap_locvar));
-+ f->sizelocvars = n;
-+ for (i = 0; i < n; i++)
-+ f->locvars[i].varname = NULL;
-+ for (i = 0; i < n; i++) {
-+ f->locvars[i].varname = READ_STRING(S);
-+ f->locvars[i].startpc = READ_INT(S);
-+ f->locvars[i].endpc = READ_INT(S);
-+ }
-+ n = READ_INT(S);
-+ for (i = 0; i < n; i++)
-+ f->upvalues[i].name = READ_STRING(S);
-+
-+ return 0;
-+}
-+
-+static int load_function(struct load_state *S, ktap_proto *f)
-+{
-+ f->linedefined = READ_INT(S);
-+ f->lastlinedefined = READ_INT(S);
-+ f->numparams = READ_BYTE(S);
-+ f->is_vararg = READ_BYTE(S);
-+ f->maxstacksize = READ_BYTE(S);
-+ if (load_code(S, f))
-+ return -1;
-+ if (load_constants(S, f))
-+ return -1;
-+ if (load_upvalues(S, f))
-+ return -1;
-+ if (load_debuginfo(S, f))
-+ return -1;
-+
-+ return 0;
-+}
-+
-+
-+#define error(S, why) \
-+ kp_error(S->ks, "load failed: %s precompiled chunk\n", why)
-+
-+#define N0 KTAPC_HEADERSIZE
-+#define N1 (sizeof(KTAP_SIGNATURE) - sizeof(char))
-+#define N2 N1 + 2
-+#define N3 N2 + 6
-+
-+static int load_header(struct load_state *S)
-+{
-+ u8 h[KTAPC_HEADERSIZE];
-+ u8 s[KTAPC_HEADERSIZE];
-+
-+ kp_header(h);
-+ READ_VECTOR(S, s, KTAPC_HEADERSIZE);
-+
-+ if (memcmp(h, s, N0) == 0)
-+ return 0;
-+ if (memcmp(h, s, N1) != 0)
-+ error(S, "not a");
-+ else if (memcmp(h, s, N2) != 0)
-+ error(S, "version mismatch in");
-+ else if (memcmp(h, s, N3) != 0)
-+ error(S, "incompatible");
-+ else
-+ error(S,"corrupted");
-+
-+ return -1;
-+}
-+
-+#ifdef CONFIG_KTAP_FFI
-+void ffi_set_csym_arr(ktap_state *ks, int cs_nr, csymbol *new_arr);
-+
-+static void load_csymbol_func(struct load_state *S, csymbol *cs)
-+{
-+ csymbol_func *csf = csym_func(cs);
-+ int arg_nr = csymf_arg_nr(csf);
-+
-+ if (arg_nr > 0) {
-+ csf->arg_ids = NEW_VECTOR(S, arg_nr*sizeof(int));
-+ READ_VECTOR(S, csf->arg_ids, arg_nr*sizeof(int));
-+ } else {
-+ csf->arg_ids = NULL;
-+ }
-+}
-+
-+static void load_csymbol_struct(struct load_state *S, csymbol *cs)
-+{
-+ csymbol_struct *csst = csym_struct(cs);
-+ int mb_nr = csymst_mb_nr(csst);
-+
-+ csst->members = NEW_VECTOR(S, mb_nr*sizeof(struct_member));
-+ READ_VECTOR(S, csst->members, mb_nr*sizeof(struct_member));
-+}
-+
-+static int load_csymbols(struct load_state *S)
-+{
-+ csymbol *cs_arr, *cs;
-+ int i, csym_nr;
-+
-+ /* read number of csymbols */
-+ csym_nr = READ_INT(S);
-+ if (csym_nr <= 0) {
-+ ffi_set_csym_arr(S->ks, 0, NULL);
-+ return 0;
-+ }
-+
-+ /* csymbol size safty check */
-+ if (sizeof(csymbol) != READ_INT(S)) {
-+ kp_error(S->ks, "invalid csymbol size in chunk\n");
-+ return -1;
-+ }
-+
-+ cs_arr = NEW_VECTOR(S, sizeof(csymbol)*csym_nr);
-+ for (i = 0; i < csym_nr; i++) {
-+ cs = &cs_arr[i];
-+ READ_VECTOR(S, cs, sizeof(csymbol));
-+ switch (cs->type) {
-+ case FFI_FUNC:
-+ load_csymbol_func(S, cs);
-+ break;
-+ case FFI_STRUCT:
-+ load_csymbol_struct(S, cs);
-+ break;
-+ default:
-+ break;
-+ }
-+ }
-+
-+ ffi_set_csym_arr(S->ks, csym_nr, cs_arr);
-+
-+ return 0;
-+}
-+#else
-+static int load_csymbols(struct load_state *S)
-+{
-+ int csym_nr = READ_INT(S);
-+
-+ /* if FFI is disabled in ktapc, csym_nr should be 0 */
-+ if (csym_nr != 0) {
-+ /* skip corrupted csymbol chunk */
-+ int cs_size = READ_INT(S);
-+ ADD_POS(S, cs_size*csym_nr);
-+ kp_error(S->ks, "VM compiled without FFI support!\n");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+#endif
-+
-+static int verify_code(struct load_state *S, ktap_proto *f)
-+{
-+ /* not support now */
-+ return 0;
-+}
-+
-+
-+ktap_closure *kp_load(ktap_state *ks, unsigned char *buff)
-+{
-+ struct load_state S;
-+ ktap_closure *cl;
-+ int ret, i;
-+
-+ S.ks = ks;
-+ S.buff = buff;
-+ S.pos = 0;
-+
-+ ret = load_header(&S);
-+ if (ret)
-+ return NULL;
-+
-+ ret = load_csymbols(&S);
-+ if (ret)
-+ return NULL;
-+
-+ cl = kp_newclosure(ks, 1);
-+ if (!cl)
-+ return cl;
-+
-+ /* put closure on the top, prepare to run with this closure */
-+ set_closure(ks->top, cl);
-+ incr_top(ks);
-+
-+ cl->p = kp_newproto(ks);
-+ if (load_function(&S, cl->p))
-+ return NULL;
-+
-+ if (cl->p->sizeupvalues != 1) {
-+ ktap_proto *p = cl->p;
-+ cl = kp_newclosure(ks, cl->p->sizeupvalues);
-+ cl->p = p;
-+ set_closure(ks->top - 1, cl);
-+ }
-+
-+ for (i = 0; i < cl->nupvalues; i++) { /* initialize upvalues */
-+ ktap_upval *up = kp_newupval(ks);
-+ cl->upvals[i] = up;
-+ }
-+
-+ /* set global table as 1st upvalue of 'f' */
-+ if (cl->nupvalues == 1) {
-+ ktap_tab *reg = hvalue(&G(ks)->registry);
-+ const ktap_value *gt = kp_tab_getint(reg, KTAP_RIDX_GLOBALS);
-+ set_obj(cl->upvals[0]->v, gt);
-+ }
-+
-+ verify_code(&S, cl->p);
-+
-+ return cl;
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_load.h
-@@ -0,0 +1,6 @@
-+#ifndef __KTAP_LOAD_H__
-+#define __KTAP_LOAD_H__
-+
-+ktap_closure *kp_load(ktap_state *ks, unsigned char *buff);
-+
-+#endif /* __KTAP_LOAD_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_obj.c
-@@ -0,0 +1,478 @@
-+/*
-+ * kp_obj.c - ktap object generic operation
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_ffi.h"
-+#include "kp_obj.h"
-+#include "kp_str.h"
-+#include "kp_tab.h"
-+
-+#ifdef __KERNEL__
-+#include <linux/slab.h>
-+#include "ktap.h"
-+#include "kp_vm.h"
-+#include "kp_transport.h"
-+
-+#define KTAP_ALLOC_FLAGS ((GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN) \
-+ & ~__GFP_WAIT)
-+
-+void *kp_malloc(ktap_state *ks, int size)
-+{
-+ void *addr;
-+
-+ /*
-+ * Normally we don't want to trace under memory pressure,
-+ * so we use a simple rule to handle memory allocation failure:
-+ *
-+ * retry until allocation success, this will make caller don't need
-+ * to handle the unlikely failure case, then ktap exit.
-+ *
-+ * In this approach, if user find there have memory allocation failure,
-+ * user should re-run the ktap script, or fix the memory pressure
-+ * issue, or figure out why the script need so many memory.
-+ *
-+ * Perhaps return pre-allocated stub memory trunk when allocate failed
-+ * is a better approch?
-+ */
-+ addr = kmalloc(size, KTAP_ALLOC_FLAGS);
-+ if (unlikely(!addr)) {
-+ kp_error(ks, "kmalloc size %d failed, retry again\n", size);
-+ printk("ktap kmalloc size %d failed, retry again\n", size);
-+ dump_stack();
-+ while (1) {
-+ addr = kmalloc(size, KTAP_ALLOC_FLAGS);
-+ if (addr)
-+ break;
-+ }
-+ kp_printf(ks, "kmalloc retry success after failed, exit\n");
-+ }
-+
-+ preempt_disable();
-+ KTAP_STATS(ks)->nr_mem_allocate += 1;
-+ KTAP_STATS(ks)->mem_allocated += size;
-+ preempt_enable();
-+
-+ return addr;
-+}
-+
-+void kp_free(ktap_state *ks, void *addr)
-+{
-+ preempt_disable();
-+ KTAP_STATS(ks)->nr_mem_free += 1;
-+ preempt_enable();
-+
-+ kfree(addr);
-+}
-+
-+void *kp_reallocv(ktap_state *ks, void *addr, int oldsize, int newsize)
-+{
-+ void *new_addr;
-+
-+ new_addr = krealloc(addr, newsize, KTAP_ALLOC_FLAGS);
-+ if (unlikely(!new_addr)) {
-+ kp_error(ks, "krealloc size %d failed, retry again\n", newsize);
-+ printk("ktap krealloc size %d failed, retry again\n", newsize);
-+ dump_stack();
-+ while (1) {
-+ new_addr = krealloc(addr, newsize, KTAP_ALLOC_FLAGS);
-+ if (new_addr)
-+ break;
-+ }
-+ kp_printf(ks, "krealloc retry success after failed, exit\n");
-+ }
-+
-+ preempt_disable();
-+ if (oldsize == 0) {
-+ KTAP_STATS(ks)->nr_mem_allocate += 1;
-+ }
-+ KTAP_STATS(ks)->mem_allocated += newsize - oldsize;
-+ preempt_enable();
-+
-+ return new_addr;
-+}
-+
-+void *kp_zalloc(ktap_state *ks, int size)
-+{
-+ void *addr;
-+
-+ addr = kzalloc(size, KTAP_ALLOC_FLAGS);
-+ if (unlikely(!addr)) {
-+ kp_error(ks, "kzalloc size %d failed, retry again\n", size);
-+ printk("ktap kzalloc size %d failed, retry again\n", size);
-+ dump_stack();
-+ while (1) {
-+ addr = kzalloc(size, KTAP_ALLOC_FLAGS);
-+ if (addr)
-+ break;
-+ }
-+ kp_printf(ks, "kzalloc retry success after failed, exit\n");
-+ }
-+
-+ preempt_disable();
-+ KTAP_STATS(ks)->nr_mem_allocate += 1;
-+ KTAP_STATS(ks)->mem_allocated += size;
-+ preempt_enable();
-+
-+ return addr;
-+}
-+#endif
-+
-+void kp_obj_dump(ktap_state *ks, const ktap_value *v)
-+{
-+ switch (ttype(v)) {
-+ case KTAP_TNIL:
-+ kp_puts(ks, "NIL");
-+ break;
-+ case KTAP_TNUMBER:
-+ kp_printf(ks, "NUMBER %ld", nvalue(v));
-+ break;
-+ case KTAP_TBOOLEAN:
-+ kp_printf(ks, "BOOLEAN %d", bvalue(v));
-+ break;
-+ case KTAP_TLIGHTUSERDATA:
-+ kp_printf(ks, "LIGHTUSERDATA 0x%lx", (unsigned long)pvalue(v));
-+ break;
-+ case KTAP_TCFUNCTION:
-+ kp_printf(ks, "LIGHTCFCUNTION 0x%lx", (unsigned long)fvalue(v));
-+ break;
-+ case KTAP_TSHRSTR:
-+ case KTAP_TLNGSTR:
-+ kp_printf(ks, "SHRSTR #%s", svalue(v));
-+ break;
-+ case KTAP_TTABLE:
-+ kp_printf(ks, "TABLE 0x%lx", (unsigned long)hvalue(v));
-+ break;
-+ default:
-+ kp_printf(ks, "GCVALUE 0x%lx", (unsigned long)gcvalue(v));
-+ break;
-+ }
-+}
-+
-+#ifdef __KERNEL__
-+#include <linux/stacktrace.h>
-+#include <linux/module.h>
-+#include <linux/kallsyms.h>
-+
-+static void kp_btrace_dump(ktap_state *ks, ktap_btrace *bt)
-+{
-+ char str[KSYM_SYMBOL_LEN];
-+ unsigned long *entries = (unsigned long *)(bt + 1);
-+ int i;
-+
-+ for (i = 0; i < bt->nr_entries; i++) {
-+ unsigned long p = entries[i];
-+
-+ if (p == ULONG_MAX)
-+ break;
-+
-+ SPRINT_SYMBOL(str, p);
-+ kp_printf(ks, "%s\n", str);
-+ }
-+}
-+
-+static int kp_btrace_equal(ktap_btrace *bt1, ktap_btrace *bt2)
-+{
-+ unsigned long *entries1 = (unsigned long *)(bt1 + 1);
-+ unsigned long *entries2 = (unsigned long *)(bt2 + 1);
-+ int i;
-+
-+ if (bt1->nr_entries != bt2->nr_entries)
-+ return 0;
-+
-+ for (i = 0; i < bt1->nr_entries; i++) {
-+ if (entries1[i] != entries2[i])
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+#endif
-+
-+void kp_showobj(ktap_state *ks, const ktap_value *v)
-+{
-+ switch (ttype(v)) {
-+ case KTAP_TNIL:
-+ kp_puts(ks, "nil");
-+ break;
-+ case KTAP_TNUMBER:
-+ kp_printf(ks, "%ld", nvalue(v));
-+ break;
-+ case KTAP_TBOOLEAN:
-+ kp_puts(ks, (bvalue(v) == 1) ? "true" : "false");
-+ break;
-+ case KTAP_TLIGHTUSERDATA:
-+ kp_printf(ks, "0x%lx", (unsigned long)pvalue(v));
-+ break;
-+ case KTAP_TCFUNCTION:
-+ kp_printf(ks, "0x%lx", (unsigned long)fvalue(v));
-+ break;
-+ case KTAP_TSHRSTR:
-+ case KTAP_TLNGSTR:
-+ kp_puts(ks, svalue(v));
-+ break;
-+ case KTAP_TTABLE:
-+ kp_tab_dump(ks, hvalue(v));
-+ break;
-+#ifdef __KERNEL__
-+#ifdef CONFIG_KTAP_FFI
-+ case KTAP_TCDATA:
-+ kp_cdata_dump(ks, cdvalue(v));
-+ break;
-+#endif
-+ case KTAP_TEVENT:
-+ kp_transport_event_write(ks, evalue(v));
-+ break;
-+ case KTAP_TBTRACE:
-+ kp_btrace_dump(ks, btvalue(v));
-+ break;
-+ case KTAP_TPTABLE:
-+ kp_ptab_dump(ks, phvalue(v));
-+ break;
-+ case KTAP_TSTATDATA:
-+ kp_statdata_dump(ks, sdvalue(v));
-+ break;
-+#endif
-+ default:
-+ kp_error(ks, "print unknown value type: %d\n", ttype(v));
-+ break;
-+ }
-+}
-+
-+
-+/*
-+ * equality of ktap values. ks == NULL means raw equality
-+ */
-+int kp_equalobjv(ktap_state *ks, const ktap_value *t1, const ktap_value *t2)
-+{
-+ switch (ttype(t1)) {
-+ case KTAP_TNIL:
-+ return 1;
-+ case KTAP_TNUMBER:
-+ return nvalue(t1) == nvalue(t2);
-+ case KTAP_TBOOLEAN:
-+ return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
-+ case KTAP_TLIGHTUSERDATA:
-+ return pvalue(t1) == pvalue(t2);
-+ case KTAP_TCFUNCTION:
-+ return fvalue(t1) == fvalue(t2);
-+ case KTAP_TSHRSTR:
-+ return eqshrstr(rawtsvalue(t1), rawtsvalue(t2));
-+ case KTAP_TLNGSTR:
-+ return kp_tstring_eqlngstr(rawtsvalue(t1), rawtsvalue(t2));
-+ case KTAP_TTABLE:
-+ if (hvalue(t1) == hvalue(t2))
-+ return 1;
-+ else if (ks == NULL)
-+ return 0;
-+#ifdef __KERNEL__
-+ case KTAP_TBTRACE:
-+ return kp_btrace_equal(btvalue(t1), btvalue(t2));
-+#endif
-+ default:
-+ return gcvalue(t1) == gcvalue(t2);
-+ }
-+
-+ return 0;
-+}
-+
-+/*
-+ * ktap will not use lua's length operator on table meaning,
-+ * also # is not for length operator any more in ktap.
-+ */
-+int kp_objlen(ktap_state *ks, const ktap_value *v)
-+{
-+ switch(v->type) {
-+ case KTAP_TTABLE:
-+ return kp_tab_length(ks, hvalue(v));
-+ case KTAP_TSTRING:
-+ return rawtsvalue(v)->tsv.len;
-+ default:
-+ kp_printf(ks, "cannot get length of type %d\n", v->type);
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+/* need to protect allgc field? */
-+ktap_gcobject *kp_newobject(ktap_state *ks, int type, size_t size,
-+ ktap_gcobject **list)
-+{
-+ ktap_gcobject *o;
-+
-+ o = kp_malloc(ks, size);
-+ if (list == NULL)
-+ list = &G(ks)->allgc;
-+
-+ gch(o)->tt = type;
-+ gch(o)->next = *list;
-+ *list = o;
-+
-+ return o;
-+}
-+
-+ktap_upval *kp_newupval(ktap_state *ks)
-+{
-+ ktap_upval *uv;
-+
-+ uv = &kp_newobject(ks, KTAP_TUPVAL, sizeof(ktap_upval), NULL)->uv;
-+ uv->v = &uv->u.value;
-+ set_nil(uv->v);
-+ return uv;
-+}
-+
-+static ktap_btrace *kp_newbacktrace(ktap_state *ks, int nr_entries,
-+ ktap_gcobject **list)
-+{
-+ ktap_btrace *bt;
-+ int size = sizeof(ktap_btrace) + nr_entries * sizeof(unsigned long);
-+
-+ bt = &kp_newobject(ks, KTAP_TBTRACE, size, list)->bt;
-+ bt->nr_entries = nr_entries;
-+ return bt;
-+}
-+
-+void kp_objclone(ktap_state *ks, const ktap_value *o, ktap_value *newo,
-+ ktap_gcobject **list)
-+{
-+ if (is_btrace(o)) {
-+ int nr_entries = btvalue(o)->nr_entries;
-+ ktap_btrace *bt;
-+
-+ bt = kp_newbacktrace(ks, nr_entries, list);
-+ memcpy((unsigned long *)(bt + 1), btvalue(o) + 1,
-+ nr_entries * sizeof(unsigned long));
-+ set_btrace(newo, bt);
-+ } else {
-+ kp_error(ks, "cannot clone ktap value type %d\n", ttype(o));
-+ set_nil(newo);
-+ }
-+}
-+
-+ktap_closure *kp_newclosure(ktap_state *ks, int n)
-+{
-+ ktap_closure *cl;
-+
-+ cl = (ktap_closure *)kp_newobject(ks, KTAP_TCLOSURE, sizeof(*cl), NULL);
-+ cl->p = NULL;
-+ cl->nupvalues = n;
-+ while (n--)
-+ cl->upvals[n] = NULL;
-+
-+ return cl;
-+}
-+
-+static void free_proto(ktap_state *ks, ktap_proto *f)
-+{
-+ kp_free(ks, f->code);
-+ kp_free(ks, f->p);
-+ kp_free(ks, f->k);
-+ kp_free(ks, f->lineinfo);
-+ kp_free(ks, f->locvars);
-+ kp_free(ks, f->upvalues);
-+ kp_free(ks, f);
-+}
-+
-+ktap_proto *kp_newproto(ktap_state *ks)
-+{
-+ ktap_proto *f;
-+ f = (ktap_proto *)kp_newobject(ks, KTAP_TPROTO, sizeof(*f), NULL);
-+ f->k = NULL;
-+ f->sizek = 0;
-+ f->p = NULL;
-+ f->sizep = 0;
-+ f->code = NULL;
-+ f->cache = NULL;
-+ f->sizecode = 0;
-+ f->lineinfo = NULL;
-+ f->sizelineinfo = 0;
-+ f->upvalues = NULL;
-+ f->sizeupvalues = 0;
-+ f->numparams = 0;
-+ f->is_vararg = 0;
-+ f->maxstacksize = 0;
-+ f->locvars = NULL;
-+ f->sizelocvars = 0;
-+ f->linedefined = 0;
-+ f->lastlinedefined = 0;
-+ f->source = NULL;
-+ return f;
-+}
-+
-+void kp_free_gclist(ktap_state *ks, ktap_gcobject *o)
-+{
-+ while (o) {
-+ ktap_gcobject *next;
-+
-+ next = gch(o)->next;
-+ switch (gch(o)->tt) {
-+ case KTAP_TTABLE:
-+ kp_tab_free(ks, (ktap_tab *)o);
-+ break;
-+ case KTAP_TPROTO:
-+ free_proto(ks, (ktap_proto *)o);
-+ break;
-+#ifdef __KERNEL__
-+ case KTAP_TPTABLE:
-+ kp_ptab_free(ks, (ktap_ptab *)o);
-+ break;
-+#endif
-+ default:
-+ kp_free(ks, o);
-+ }
-+ o = next;
-+ }
-+}
-+
-+void kp_free_all_gcobject(ktap_state *ks)
-+{
-+ kp_free_gclist(ks, G(ks)->allgc);
-+ G(ks)->allgc = NULL;
-+}
-+
-+/******************************************************************************/
-+
-+/*
-+ * make header for precompiled chunks
-+ * if you change the code below be sure to update load_header and FORMAT above
-+ * and KTAPC_HEADERSIZE in ktap_types.h
-+ */
-+void kp_header(u8 *h)
-+{
-+ int x = 1;
-+
-+ memcpy(h, KTAP_SIGNATURE, sizeof(KTAP_SIGNATURE) - sizeof(char));
-+ h += sizeof(KTAP_SIGNATURE) - sizeof(char);
-+ *h++ = (u8)VERSION;
-+ *h++ = (u8)FORMAT;
-+ *h++ = (u8)(*(char*)&x); /* endianness */
-+ *h++ = (u8)(sizeof(int));
-+ *h++ = (u8)(sizeof(size_t));
-+ *h++ = (u8)(sizeof(ktap_instruction));
-+ *h++ = (u8)(sizeof(ktap_number));
-+ *h++ = (u8)(((ktap_number)0.5) == 0); /* is ktap_number integral? */
-+ memcpy(h, KTAPC_TAIL, sizeof(KTAPC_TAIL) - sizeof(char));
-+}
-+
-+
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_obj.h
-@@ -0,0 +1,29 @@
-+#ifndef __KTAP_OBJ_H__
-+#define __KTAP_OBJ_H__
-+
-+#ifdef __KERNEL__
-+void *kp_malloc(ktap_state *ks, int size);
-+void kp_free(ktap_state *ks, void *addr);
-+void *kp_reallocv(ktap_state *ks, void *addr, int oldsize, int newsize);
-+void *kp_zalloc(ktap_state *ks, int size);
-+#else
-+#define kp_malloc(ks, size) malloc(size)
-+#define kp_free(ks, block) free(block)
-+#define kp_reallocv(ks, block, osize, nsize) realloc(block, nsize)
-+#endif
-+
-+void kp_obj_dump(ktap_state *ks, const ktap_value *v);
-+void kp_showobj(ktap_state *ks, const ktap_value *v);
-+int kp_objlen(ktap_state *ks, const ktap_value *rb);
-+void kp_objclone(ktap_state *ks, const ktap_value *o, ktap_value *newo,
-+ ktap_gcobject **list);
-+ktap_gcobject *kp_newobject(ktap_state *ks, int type, size_t size, ktap_gcobject **list);
-+int kp_equalobjv(ktap_state *ks, const ktap_value *t1, const ktap_value *t2);
-+ktap_closure *kp_newclosure(ktap_state *ks, int n);
-+ktap_proto *kp_newproto(ktap_state *ks);
-+ktap_upval *kp_newupval(ktap_state *ks);
-+void kp_free_gclist(ktap_state *ks, ktap_gcobject *o);
-+void kp_free_all_gcobject(ktap_state *ks);
-+void kp_header(u8 *h);
-+
-+#endif /* __KTAP_OBJ_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_opcode.c
-@@ -0,0 +1,134 @@
-+/*
-+ * kp_opcode.c
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_opcodes.h"
-+
-+const char *const ktap_opnames[NUM_OPCODES + 1] = {
-+ "MOVE",
-+ "LOADK",
-+ "LOADKX",
-+ "LOADBOOL",
-+ "LOADNIL",
-+ "GETUPVAL",
-+ "GETTABUP",
-+ "GETTABLE",
-+ "SETTABUP",
-+ "SETTABUP_INCR",
-+ "SETTABUP_AGGR",
-+ "SETUPVAL",
-+ "SETTABLE",
-+ "SETTABLE_INCR",
-+ "SETTABLE_AGGR",
-+ "NEWTABLE",
-+ "SELF",
-+ "ADD",
-+ "SUB",
-+ "MUL",
-+ "DIV",
-+ "MOD",
-+ "POW",
-+ "UNM",
-+ "NOT",
-+ "LEN",
-+ "CONCAT",
-+ "JMP",
-+ "EQ",
-+ "LT",
-+ "LE",
-+ "TEST",
-+ "TESTSET",
-+ "CALL",
-+ "TAILCALL",
-+ "RETURN",
-+ "FORLOOP",
-+ "FORPREP",
-+ "TFORCALL",
-+ "TFORLOOP",
-+ "SETLIST",
-+ "CLOSURE",
-+ "VARARG",
-+ "EXTRAARG",
-+
-+ "EVENT",
-+ "EVENT_NAME",
-+ "EVENT_ARG", /* arg1, arg2 .. arg9 */
-+ NULL
-+};
-+
-+
-+#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
-+
-+const u8 ktap_opmodes[NUM_OPCODES] = {
-+/* T A B C mode opcode */
-+ opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */
-+ ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */
-+ ,opmode(0, 1, OpArgN, OpArgN, iABx) /* OP_LOADKX */
-+ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */
-+ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_LOADNIL */
-+ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */
-+ ,opmode(0, 1, OpArgU, OpArgK, iABC) /* OP_GETTABUP */
-+ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */
-+ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP */
-+ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP_INCR */
-+ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP_AGGR */
-+ ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */
-+ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */
-+ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP_INCR */
-+ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP_AGGR */
-+ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */
-+ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */
-+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */
-+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */
-+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */
-+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */
-+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */
-+ ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */
-+ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */
-+ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */
-+ ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */
-+ ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */
-+ ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */
-+ ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */
-+ ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */
-+ ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */
-+ ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */
-+ ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */
-+ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */
-+ ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */
-+ ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */
-+ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */
-+ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */
-+ ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */
-+ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */
-+ ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */
-+ ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */
-+ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */
-+ ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */
-+ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_EVENT */
-+ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_EVENTNAME */
-+ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_EVENTARG */
-+};
-+
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_str.c
-@@ -0,0 +1,460 @@
-+/*
-+ * kp_str.c - ktap string data struction manipulation
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include "../include/ktap_types.h"
-+#include "kp_obj.h"
-+#include "kp_str.h"
-+
-+#ifdef __KERNEL__
-+#include <linux/ctype.h>
-+#include <linux/module.h>
-+#include <linux/kallsyms.h>
-+#include "ktap.h"
-+#include "kp_transport.h"
-+#include "kp_vm.h"
-+#endif
-+
-+#define STRING_MAXSHORTLEN 40
-+
-+int kp_tstring_cmp(const ktap_string *ls, const ktap_string *rs)
-+{
-+ const char *l = getstr(ls);
-+ size_t ll = ls->tsv.len;
-+ const char *r = getstr(rs);
-+ size_t lr = rs->tsv.len;
-+
-+ for (;;) {
-+ int temp = strcmp(l, r);
-+ if (temp != 0)
-+ return temp;
-+ else {
-+ /* strings are equal up to a `\0' */
-+
-+ /* index of first `\0' in both strings */
-+ size_t len = strlen(l);
-+
-+ /* r is finished? */
-+ if (len == lr)
-+ return (len == ll) ? 0 : 1;
-+ else if (len == ll) /* l is finished? */
-+ return -1;
-+
-+ /*
-+ * both strings longer than `len';
-+ * go on comparing (after the `\0')
-+ */
-+ len++;
-+ l += len; ll -= len; r += len; lr -= len;
-+ }
-+ }
-+}
-+
-+/*
-+ * equality for long strings
-+ */
-+int kp_tstring_eqlngstr(ktap_string *a, ktap_string *b)
-+{
-+ size_t len = a->tsv.len;
-+
-+ return (a == b) || ((len == b->tsv.len) &&
-+ (memcmp(getstr(a), getstr(b), len) == 0));
-+}
-+
-+/*
-+ * equality for strings
-+ */
-+int kp_tstring_eqstr(ktap_string *a, ktap_string *b)
-+{
-+ return (a->tsv.tt == b->tsv.tt) &&
-+ (a->tsv.tt == KTAP_TSHRSTR ? eqshrstr(a, b) :
-+ kp_tstring_eqlngstr(a, b));
-+}
-+
-+#define STRING_HASHLIMIT 5
-+unsigned int kp_string_hash(const char *str, size_t l, unsigned int seed)
-+{
-+ unsigned int h = seed ^ l;
-+ size_t l1;
-+ size_t step = (l >> STRING_HASHLIMIT) + 1;
-+
-+ for (l1 = l; l1 >= step; l1 -= step)
-+ h = h ^ ((h<<5) + (h>>2) + (u8)(str[l1 - 1]));
-+
-+ return h;
-+}
-+
-+
-+/*
-+ * resizes the string table
-+ */
-+void kp_tstring_resize(ktap_state *ks, int newsize)
-+{
-+ int i;
-+ ktap_stringtable *tb = &G(ks)->strt;
-+
-+ if (newsize > tb->size) {
-+ kp_realloc(ks, tb->hash, tb->size, newsize, ktap_gcobject *);
-+
-+ for (i = tb->size; i < newsize; i++)
-+ tb->hash[i] = NULL;
-+ }
-+
-+ /* rehash */
-+ for (i = 0; i < tb->size; i++) {
-+ ktap_gcobject *p = tb->hash[i];
-+ tb->hash[i] = NULL;
-+
-+ while (p) {
-+ ktap_gcobject *next = gch(p)->next;
-+ unsigned int h = lmod(gco2ts(p)->hash, newsize);
-+
-+ gch(p)->next = tb->hash[h];
-+ tb->hash[h] = p;
-+ p = next;
-+ }
-+ }
-+
-+ if (newsize < tb->size) {
-+ /* shrinking slice must be empty */
-+ kp_realloc(ks, tb->hash, tb->size, newsize, ktap_gcobject *);
-+ }
-+
-+ tb->size = newsize;
-+}
-+
-+/*
-+ * creates a new string object
-+ */
-+static ktap_string *createstrobj(ktap_state *ks, const char *str, size_t l,
-+ int tag, unsigned int h, ktap_gcobject **list)
-+{
-+ ktap_string *ts;
-+ size_t totalsize; /* total size of TString object */
-+
-+ totalsize = sizeof(ktap_string) + ((l + 1) * sizeof(char));
-+ ts = &kp_newobject(ks, tag, totalsize, list)->ts;
-+ ts->tsv.len = l;
-+ ts->tsv.hash = h;
-+ ts->tsv.extra = 0;
-+ memcpy(ts + 1, str, l * sizeof(char));
-+ ((char *)(ts + 1))[l] = '\0'; /* ending 0 */
-+ return ts;
-+}
-+
-+/*
-+ * creates a new short string, inserting it into string table
-+ */
-+static ktap_string *newshrstr(ktap_state *ks, const char *str, size_t l,
-+ unsigned int h)
-+{
-+ ktap_gcobject **list;
-+ ktap_stringtable *tb = &G(ks)->strt;
-+ ktap_string *s;
-+
-+ if (tb->nuse >= (int)tb->size)
-+ kp_tstring_resize(ks, tb->size * 2); /* too crowded */
-+
-+ list = &tb->hash[lmod(h, tb->size)];
-+ s = createstrobj(ks, str, l, KTAP_TSHRSTR, h, list);
-+ tb->nuse++;
-+ return s;
-+}
-+
-+/*
-+ * checks whether short string exists and reuses it or creates a new one
-+ */
-+static ktap_string *internshrstr(ktap_state *ks, const char *str, size_t l)
-+{
-+ ktap_gcobject *o;
-+ ktap_global_state *g = G(ks);
-+ ktap_string *ts;
-+ unsigned int h = kp_string_hash(str, l, g->seed);
-+ unsigned long __maybe_unused flags;
-+
-+#ifdef __KERNEL__
-+ local_irq_save(flags);
-+ arch_spin_lock(&G(ks)->str_lock);
-+#endif
-+
-+ for (o = g->strt.hash[lmod(h, g->strt.size)]; o != NULL;
-+ o = gch(o)->next) {
-+ ts = rawgco2ts(o);
-+
-+ if (h == ts->tsv.hash && ts->tsv.len == l &&
-+ (memcmp(str, getstr(ts), l * sizeof(char)) == 0))
-+ goto out;
-+ }
-+
-+ ts = newshrstr(ks, str, l, h); /* not found; create a new string */
-+
-+ out:
-+#ifdef __KERNEL__
-+ arch_spin_unlock(&G(ks)->str_lock);
-+ local_irq_restore(flags);
-+#endif
-+ return ts;
-+}
-+
-+
-+/*
-+ * new string (with explicit length)
-+ */
-+ktap_string *kp_tstring_newlstr(ktap_state *ks, const char *str, size_t l)
-+{
-+ /* short string? */
-+ if (l <= STRING_MAXSHORTLEN)
-+ return internshrstr(ks, str, l);
-+ else
-+ return createstrobj(ks, str, l, KTAP_TLNGSTR, G(ks)->seed,
-+ NULL);
-+}
-+
-+ktap_string *kp_tstring_newlstr_local(ktap_state *ks, const char *str, size_t l)
-+{
-+ return createstrobj(ks, str, l, KTAP_TLNGSTR, G(ks)->seed,
-+ &ks->gclist);
-+}
-+
-+/*
-+ * new zero-terminated string
-+ */
-+ktap_string *kp_tstring_new(ktap_state *ks, const char *str)
-+{
-+ return kp_tstring_newlstr(ks, str, strlen(str));
-+}
-+
-+ktap_string *kp_tstring_new_local(ktap_state *ks, const char *str)
-+{
-+ return createstrobj(ks, str, strlen(str), KTAP_TLNGSTR, G(ks)->seed,
-+ &ks->gclist);
-+}
-+
-+void kp_tstring_freeall(ktap_state *ks)
-+{
-+ ktap_global_state *g = G(ks);
-+ int h;
-+
-+ for (h = 0; h < g->strt.size; h++) {
-+ ktap_gcobject *o, *next;
-+ o = g->strt.hash[h];
-+ while (o) {
-+ next = gch(o)->next;
-+ kp_free(ks, o);
-+ o = next;
-+ }
-+ g->strt.hash[h] = NULL;
-+ }
-+
-+ kp_free(ks, g->strt.hash);
-+}
-+
-+/* todo: dump long string, strt table only contain short string */
-+void kp_tstring_dump(ktap_state *ks)
-+{
-+ ktap_gcobject *o;
-+ ktap_global_state *g = G(ks);
-+ int h;
-+
-+ kp_printf(ks, "tstring dump: strt size: %d, nuse: %d\n", g->strt.size,
-+ g->strt.nuse);
-+ for (h = 0; h < g->strt.size; h++) {
-+ for (o = g->strt.hash[h]; o != NULL; o = gch(o)->next) {
-+ ktap_string *ts = rawgco2ts(o);
-+ kp_printf(ks, "%s [%d]\n", getstr(ts), (int)ts->tsv.len);
-+ }
-+ }
-+}
-+
-+#ifdef __KERNEL__
-+/* kp_str_fmt - printf implementation */
-+
-+/* macro to `unsign' a character */
-+#define uchar(c) ((unsigned char)(c))
-+
-+#define L_ESC '%'
-+
-+/* valid flags in a format specification */
-+#define FLAGS "-+ #0"
-+
-+#define INTFRMLEN "ll"
-+#define INTFRM_T long long
-+
-+/*
-+ * maximum size of each format specification (such as '%-099.99d')
-+ * (+10 accounts for %99.99x plus margin of error)
-+ */
-+#define MAX_FORMAT (sizeof(FLAGS) + sizeof(INTFRMLEN) + 10)
-+
-+static const char *scanformat(ktap_state *ks, const char *strfrmt, char *form)
-+{
-+ const char *p = strfrmt;
-+ while (*p != '\0' && strchr(FLAGS, *p) != NULL)
-+ p++; /* skip flags */
-+
-+ if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char)) {
-+ kp_error(ks, "invalid format (repeated flags)\n");
-+ return NULL;
-+ }
-+
-+ if (isdigit(uchar(*p)))
-+ p++; /* skip width */
-+
-+ if (isdigit(uchar(*p)))
-+ p++; /* (2 digits at most) */
-+
-+ if (*p == '.') {
-+ p++;
-+ if (isdigit(uchar(*p)))
-+ p++; /* skip precision */
-+ if (isdigit(uchar(*p)))
-+ p++; /* (2 digits at most) */
-+ }
-+
-+ if (isdigit(uchar(*p))) {
-+ kp_error(ks, "invalid format (width or precision too long)\n");
-+ return NULL;
-+ }
-+
-+ *(form++) = '%';
-+ memcpy(form, strfrmt, (p - strfrmt + 1) * sizeof(char));
-+ form += p - strfrmt + 1;
-+ *form = '\0';
-+ return p;
-+}
-+
-+
-+/*
-+ * add length modifier into formats
-+ */
-+static void addlenmod(char *form, const char *lenmod)
-+{
-+ size_t l = strlen(form);
-+ size_t lm = strlen(lenmod);
-+ char spec = form[l - 1];
-+
-+ strcpy(form + l - 1, lenmod);
-+ form[l + lm - 1] = spec;
-+ form[l + lm] = '\0';
-+}
-+
-+
-+static void ktap_argerror(ktap_state *ks, int narg, const char *extramsg)
-+{
-+ kp_error(ks, "bad argument #%d: (%s)\n", narg, extramsg);
-+}
-+
-+int kp_str_fmt(ktap_state *ks, struct trace_seq *seq)
-+{
-+ int arg = 1;
-+ size_t sfl;
-+ ktap_value *arg_fmt = kp_arg(ks, 1);
-+ int argnum = kp_arg_nr(ks);
-+ const char *strfrmt, *strfrmt_end;
-+
-+ strfrmt = svalue(arg_fmt);
-+ sfl = rawtsvalue(arg_fmt)->tsv.len;
-+ strfrmt_end = strfrmt + sfl;
-+
-+ while (strfrmt < strfrmt_end) {
-+ if (*strfrmt != L_ESC)
-+ trace_seq_putc(seq, *strfrmt++);
-+ else if (*++strfrmt == L_ESC)
-+ trace_seq_putc(seq, *strfrmt++);
-+ else { /* format item */
-+ char form[MAX_FORMAT];
-+
-+ if (++arg > argnum) {
-+ ktap_argerror(ks, arg, "no value");
-+ return -1;
-+ }
-+
-+ strfrmt = scanformat(ks, strfrmt, form);
-+ switch (*strfrmt++) {
-+ case 'c':
-+ trace_seq_printf(seq, form,
-+ nvalue(kp_arg(ks, arg)));
-+ break;
-+ case 'd': case 'i': {
-+ ktap_number n = nvalue(kp_arg(ks, arg));
-+ INTFRM_T ni = (INTFRM_T)n;
-+ addlenmod(form, INTFRMLEN);
-+ trace_seq_printf(seq, form, ni);
-+ break;
-+ }
-+ case 'p': {
-+ char str[KSYM_SYMBOL_LEN];
-+ SPRINT_SYMBOL(str, nvalue(kp_arg(ks, arg)));
-+ _trace_seq_puts(seq, str);
-+ break;
-+ }
-+ case 'o': case 'u': case 'x': case 'X': {
-+ ktap_number n = nvalue(kp_arg(ks, arg));
-+ unsigned INTFRM_T ni = (unsigned INTFRM_T)n;
-+ addlenmod(form, INTFRMLEN);
-+ trace_seq_printf(seq, form, ni);
-+ break;
-+ }
-+ case 's': {
-+ ktap_value *v = kp_arg(ks, arg);
-+ const char *s;
-+ size_t l;
-+
-+ if (is_nil(v)) {
-+ _trace_seq_puts(seq, "nil");
-+ return 0;
-+ }
-+
-+ if (is_event(v)) {
-+ kp_event_tostring(ks, seq);
-+ return 0;
-+ }
-+
-+ s = svalue(v);
-+ l = rawtsvalue(v)->tsv.len;
-+ if (!strchr(form, '.') && l >= 100) {
-+ /*
-+ * no precision and string is too long
-+ * to be formatted;
-+ * keep original string
-+ */
-+ _trace_seq_puts(seq, s);
-+ break;
-+ } else {
-+ trace_seq_printf(seq, form, s);
-+ break;
-+ }
-+ }
-+ default: /* also treat cases `pnLlh' */
-+ kp_error(ks, "invalid option " KTAP_QL("%%%c")
-+ " to " KTAP_QL("format"),
-+ *(strfrmt - 1));
-+ }
-+ }
-+ }
-+
-+ return 0;
-+}
-+#endif
-+
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_str.h
-@@ -0,0 +1,20 @@
-+#ifndef __KTAP_STR_H__
-+#define __KTAP_STR_H__
-+
-+ktap_string *kp_tstring_newlstr(ktap_state *ks, const char *str, size_t l);
-+ktap_string *kp_tstring_newlstr_local(ktap_state *ks, const char *str, size_t l);
-+ktap_string *kp_tstring_new(ktap_state *ks, const char *str);
-+ktap_string *kp_tstring_new_local(ktap_state *ks, const char *str);
-+int kp_tstring_eqstr(ktap_string *a, ktap_string *b);
-+unsigned int kp_string_hash(const char *str, size_t l, unsigned int seed);
-+int kp_tstring_eqlngstr(ktap_string *a, ktap_string *b);
-+int kp_tstring_cmp(const ktap_string *ls, const ktap_string *rs);
-+void kp_tstring_resize(ktap_state *ks, int newsize);
-+void kp_tstring_freeall(ktap_state *ks);
-+
-+#ifdef __KERNEL__
-+#include <linux/trace_seq.h>
-+int kp_str_fmt(ktap_state *ks, struct trace_seq *seq);
-+#endif
-+
-+#endif /* __KTAP_STR_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_tab.c
-@@ -0,0 +1,1396 @@
-+/*
-+ * kp_tab.c - ktap table data structure manipulation
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include "../include/ktap_types.h"
-+
-+#ifdef __KERNEL__
-+#include <linux/spinlock.h>
-+#include <linux/module.h>
-+#include <linux/kallsyms.h>
-+#include <linux/sort.h>
-+#include "ktap.h"
-+#include "kp_vm.h"
-+#else
-+static inline void sort(void *base, size_t num, size_t size,
-+ int (*cmp_func)(const void *, const void *),
-+ void (*swap_func)(void *, void *, int size))
-+{}
-+#endif
-+
-+#include "kp_obj.h"
-+#include "kp_str.h"
-+
-+#ifdef __KERNEL__
-+#define kp_tab_lock_init(t) \
-+ do { \
-+ (t)->lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \
-+ } while (0)
-+#define kp_tab_lock(t) \
-+ do { \
-+ local_irq_save(flags); \
-+ arch_spin_lock(&(t)->lock); \
-+ } while (0)
-+#define kp_tab_unlock(t) \
-+ do { \
-+ arch_spin_unlock(&(t)->lock); \
-+ local_irq_restore(flags); \
-+ } while (0)
-+
-+#else
-+#define kp_tab_lock_init(t)
-+#define kp_tab_lock(t)
-+#define kp_tab_unlock(t)
-+#endif
-+
-+#define MAXBITS 30
-+#define MAXASIZE (1 << MAXBITS)
-+
-+
-+#define NILCONSTANT {NULL}, KTAP_TNIL
-+const struct ktap_value ktap_nilobjectv = {NILCONSTANT};
-+#define ktap_nilobject (&ktap_nilobjectv)
-+
-+static const ktap_tnode dummynode_ = {
-+ {NILCONSTANT}, /* value */
-+ {NULL, {NILCONSTANT}}, /* key */
-+};
-+
-+#define gnode(t,i) (&(t)->node[i])
-+#define gkey(n) (&(n)->i_key.tvk)
-+#define gval(n) (&(n)->i_val)
-+#define gnext(n) ((n)->i_key.next)
-+
-+#define twoto(x) (1<<(x))
-+#define sizenode(t) (twoto((t)->lsizenode))
-+
-+#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t))))
-+
-+#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1))))
-+
-+#define hashstr(t,str) hashpow2(t, (str)->tsv.hash)
-+#define hashboolean(t,p) hashpow2(t, p)
-+#define hashnum(t, n) hashmod(t, (unsigned int)n)
-+#define hashpointer(t,p) hashmod(t, (unsigned long)(p))
-+
-+#define dummynode (&dummynode_)
-+#define isdummy(n) ((n) == dummynode)
-+
-+static void table_setint(ktap_state *ks, ktap_tab *t, int key, ktap_value *v);
-+static ktap_value *table_set(ktap_state *ks, ktap_tab *t,
-+ const ktap_value *key);
-+static void setnodevector(ktap_state *ks, ktap_tab *t, int size);
-+
-+static int ceillog2(unsigned int x)
-+{
-+ static const u8 log_2[256] = {
-+ 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
-+ };
-+
-+ int l = 0;
-+
-+ x--;
-+ while (x >= 256) { l += 8; x >>= 8; }
-+ return l + log_2[x];
-+}
-+
-+#ifdef __KERNEL__
-+static inline ktap_stat_data *_read_sd(const ktap_value *v,
-+ ktap_tnode *hnode, ktap_stat_data *hsd)
-+{
-+ ktap_tnode *node = container_of(v, ktap_tnode, i_val);
-+ return hsd + (node - hnode);
-+}
-+
-+static inline ktap_stat_data *read_sd(ktap_tab *t, const ktap_value *v)
-+{
-+ if (v >= &t->array[0] && v < &t->array[t->sizearray])
-+ return &t->sd_arr[v - &t->array[0]];
-+ else
-+ return _read_sd(v, t->node, t->sd_rec);
-+}
-+
-+#else
-+static inline ktap_stat_data *_read_sd(const ktap_value *v,
-+ ktap_tnode *hnode, ktap_stat_data *hsd)
-+{
-+ return NULL;
-+}
-+
-+static inline ktap_stat_data *read_sd(ktap_tab *t, const ktap_value *v)
-+{
-+ return NULL;
-+}
-+#endif
-+
-+
-+ktap_tab *kp_tab_new(ktap_state *ks)
-+{
-+ ktap_tab *t = &kp_newobject(ks, KTAP_TTABLE, sizeof(ktap_tab),
-+ NULL)->h;
-+ t->flags = (u8)(~0);
-+ t->array = NULL;
-+ t->sizearray = 0;
-+ t->node = (ktap_tnode *)dummynode;
-+ t->gclist = NULL;
-+ t->with_stats = 0;
-+ t->sd_arr = NULL;
-+ t->sd_rec = NULL;
-+ setnodevector(ks, t, 0);
-+
-+ t->sorted = NULL;
-+ t->sort_head = NULL;
-+
-+ kp_tab_lock_init(t);
-+ return t;
-+}
-+
-+static const ktap_value *table_getint(ktap_tab *t, int key)
-+{
-+ ktap_tnode *n;
-+
-+ if ((unsigned int)(key - 1) < (unsigned int)t->sizearray)
-+ return &t->array[key - 1];
-+
-+ n = hashnum(t, key);
-+ do {
-+ if (is_number(gkey(n)) && nvalue(gkey(n)) == key)
-+ return gval(n);
-+ else
-+ n = gnext(n);
-+ } while (n);
-+
-+ return ktap_nilobject;
-+}
-+
-+const ktap_value *kp_tab_getint(ktap_tab *t, int key)
-+{
-+ const ktap_value *val;
-+ unsigned long __maybe_unused flags;
-+
-+ kp_tab_lock(t);
-+ val = table_getint(t, key);
-+ kp_tab_unlock(t);
-+
-+ return val;
-+}
-+
-+static ktap_tnode *mainposition (const ktap_tab *t, const ktap_value *key)
-+{
-+ switch (ttype(key)) {
-+ case KTAP_TNUMBER:
-+ return hashnum(t, nvalue(key));
-+ case KTAP_TLNGSTR: {
-+ ktap_string *s = rawtsvalue(key);
-+ if (s->tsv.extra == 0) { /* no hash? */
-+ s->tsv.hash = kp_string_hash(getstr(s), s->tsv.len,
-+ s->tsv.hash);
-+ s->tsv.extra = 1; /* now it has its hash */
-+ }
-+ return hashstr(t, rawtsvalue(key));
-+ }
-+ case KTAP_TSHRSTR:
-+ return hashstr(t, rawtsvalue(key));
-+ case KTAP_TBOOLEAN:
-+ return hashboolean(t, bvalue(key));
-+ case KTAP_TLIGHTUSERDATA:
-+ return hashpointer(t, pvalue(key));
-+ case KTAP_TCFUNCTION:
-+ return hashpointer(t, fvalue(key));
-+ case KTAP_TBTRACE: {
-+ /* use first entry as hash key, cannot use gcvalue as key */
-+ unsigned long *entries = (unsigned long *)(btvalue(key) + 1);
-+ return hashpointer(t, entries[0]);
-+ }
-+ default:
-+ return hashpointer(t, gcvalue(key));
-+ }
-+}
-+
-+static int arrayindex(const ktap_value *key)
-+{
-+ if (is_number(key)) {
-+ ktap_number n = nvalue(key);
-+ int k = (int)n;
-+ if ((ktap_number)k == n)
-+ return k;
-+ }
-+
-+ /* `key' did not match some condition */
-+ return -1;
-+}
-+
-+/*
-+ * returns the index of a `key' for table traversals. First goes all
-+ * elements in the array part, then elements in the hash part. The
-+ * beginning of a traversal is signaled by -1.
-+ */
-+static int findindex(ktap_state *ks, ktap_tab *t, StkId key)
-+{
-+ int i;
-+
-+ if (is_nil(key))
-+ return -1; /* first iteration */
-+
-+ i = arrayindex(key);
-+ if (i > 0 && i <= t->sizearray) /* is `key' inside array part? */
-+ return i - 1; /* yes; that's the index (corrected to C) */
-+ else {
-+ ktap_tnode *n = mainposition(t, key);
-+ for (;;) { /* check whether `key' is somewhere in the chain */
-+ /* key may be dead already, but it is ok to use it in `next' */
-+ if (kp_equalobjv(ks, gkey(n), key)) {
-+ i = n - gnode(t, 0); /* key index in hash table */
-+ /* hash elements are numbered after array ones */
-+ return i + t->sizearray;
-+ } else
-+ n = gnext(n);
-+
-+ if (n == NULL)
-+ /* key not found */
-+ kp_error(ks, "invalid table key to next");
-+ }
-+ }
-+}
-+
-+int kp_tab_next(ktap_state *ks, ktap_tab *t, StkId key)
-+{
-+ unsigned long __maybe_unused flags;
-+ int i;
-+
-+ kp_tab_lock(t);
-+
-+ i = findindex(ks, t, key); /* find original element */
-+
-+ for (i++; i < t->sizearray; i++) { /* try first array part */
-+ if (!is_nil(&t->array[i])) { /* a non-nil value? */
-+ set_number(key, i+1);
-+ set_obj(key+1, &t->array[i]);
-+ kp_tab_unlock(t);
-+ return 1;
-+ }
-+ }
-+
-+ for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */
-+ if (!is_nil(gval(gnode(t, i)))) { /* a non-nil value? */
-+ set_obj(key, gkey(gnode(t, i)));
-+ set_obj(key+1, gval(gnode(t, i)));
-+ kp_tab_unlock(t);
-+ return 1;
-+ }
-+ }
-+
-+ kp_tab_unlock(t);
-+ return 0; /* no more elements */
-+}
-+
-+#ifdef __KERNEL__
-+int kp_tab_sort_next(ktap_state *ks, ktap_tab *t, StkId key)
-+{
-+ unsigned long __maybe_unused flags;
-+ ktap_tnode *node = t->sort_head;
-+
-+ kp_tab_lock(t);
-+
-+ if (is_nil(key)) {
-+ /* first iteration */
-+ set_obj(key, gkey(node));
-+ set_obj(key + 1, gval(node));
-+ kp_tab_unlock(t);
-+ return 1;
-+ }
-+
-+ while (node && !is_nil(gval(node))) {
-+ if (kp_equalobjv(ks, gkey(node), key)) {
-+ node = gnext(node);
-+ if (!node)
-+ goto out;
-+
-+ set_obj(key, gkey(node));
-+ set_obj(key + 1, gval(node));
-+ kp_tab_unlock(t);
-+ return 1;
-+ }
-+ node = gnext(node);
-+ }
-+
-+ out:
-+ kp_tab_unlock(t);
-+ return 0; /* no more elements */
-+}
-+
-+
-+static int default_compare(ktap_state *ks, ktap_closure *cmp_func,
-+ ktap_value *v1, ktap_value *v2)
-+{
-+ return nvalue(v1) < nvalue(v2);
-+}
-+
-+static int closure_compare(ktap_state *ks, ktap_closure *cmp_func,
-+ ktap_value *v1, ktap_value *v2)
-+{
-+ ktap_value *func;
-+ int res;
-+
-+ func = ks->top;
-+ set_closure(ks->top++, cmp_func);
-+ set_obj(ks->top++, v1);
-+ set_obj(ks->top++, v2);
-+
-+ kp_call(ks, func, 1);
-+
-+ res = !is_false(ks->top - 1);
-+
-+ ks->top = func; /* restore ks->top */
-+
-+ return res;
-+}
-+
-+static void insert_sorted_list(ktap_state *ks, ktap_tab *t,
-+ ktap_closure *cmp_func,
-+ ktap_value *key, ktap_value *val)
-+{
-+ ktap_tnode *node = t->sort_head;
-+ ktap_tnode *newnode, *prevnode = NULL;
-+ int (*compare)(ktap_state *ks, ktap_closure *cmp_func,
-+ ktap_value *v1, ktap_value *v2);
-+ int i = 0;
-+
-+ if (is_nil(gval(node))) {
-+ *gkey(node) = *key;
-+ *gval(node) = *val;
-+ return;
-+ }
-+
-+ if (!cmp_func)
-+ compare = default_compare;
-+ else
-+ compare = closure_compare;
-+
-+ while (node) {
-+ //if (nvalue(gval(node)) < nvalue(val)) {
-+ if (compare(ks, cmp_func, gval(node), val)) {
-+ prevnode = node;
-+ node = gnext(node);
-+ continue;
-+ } else
-+ break;
-+ }
-+
-+ /* find free position */
-+ while (!is_nil(gval(&t->sorted[i]))) {
-+ i++;
-+ }
-+
-+ newnode = &t->sorted[i];
-+ *gkey(newnode) = *key;
-+ *gval(newnode) = *val;
-+ gnext(newnode) = node;
-+ if (prevnode)
-+ gnext(prevnode) = newnode;
-+ else
-+ t->sort_head = newnode;
-+}
-+
-+void kp_tab_sort(ktap_state *ks, ktap_tab *t, ktap_closure *cmp_func)
-+{
-+ unsigned long __maybe_unused flags;
-+ int size = t->sizearray + sizenode(t);
-+ int i;
-+
-+ kp_tab_lock(t);
-+
-+ kp_realloc(ks, t->sorted, 0, size, ktap_tnode);
-+ memset(t->sorted, 0, size * sizeof(ktap_tnode));
-+ t->sort_head = t->sorted;
-+
-+ for (i = 0; i < t->sizearray; i++) {
-+ ktap_value *v = &t->array[i];
-+ ktap_value key;
-+
-+ if (!is_nil(v)) {
-+ set_number(&key, i + 1);
-+ insert_sorted_list(ks, t, cmp_func, &key, v);
-+ }
-+ }
-+
-+ for (i = 0; i < sizenode(t); i++) {
-+ ktap_tnode *node = &t->node[i];
-+
-+ if (is_nil(gkey(node)))
-+ continue;
-+
-+ insert_sorted_list(ks, t, cmp_func, gkey(node), gval(node));
-+ }
-+
-+ kp_tab_unlock(t);
-+}
-+#endif
-+
-+static int computesizes (int nums[], int *narray)
-+{
-+ int i;
-+ int twotoi; /* 2^i */
-+ int a = 0; /* number of elements smaller than 2^i */
-+ int na = 0; /* number of elements to go to array part */
-+ int n = 0; /* optimal size for array part */
-+
-+ for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) {
-+ if (nums[i] > 0) {
-+ a += nums[i];
-+ /* more than half elements present? */
-+ if (a > twotoi/2) {
-+ /* optimal size (till now) */
-+ n = twotoi;
-+ /*
-+ * all elements smaller than n will go to
-+ * array part
-+ */
-+ na = a;
-+ }
-+ }
-+ if (a == *narray)
-+ break; /* all elements already counted */
-+ }
-+ *narray = n;
-+ return na;
-+}
-+
-+
-+static int countint(const ktap_value *key, int *nums)
-+{
-+ int k = arrayindex(key);
-+
-+ /* is `key' an appropriate array index? */
-+ if (0 < k && k <= MAXASIZE) {
-+ nums[ceillog2(k)]++; /* count as such */
-+ return 1;
-+ } else
-+ return 0;
-+}
-+
-+
-+static int numusearray(const ktap_tab *t, int *nums)
-+{
-+ int lg;
-+ int ttlg; /* 2^lg */
-+ int ause = 0; /* summation of `nums' */
-+ int i = 1; /* count to traverse all array keys */
-+
-+ /* for each slice */
-+ for (lg=0, ttlg=1; lg <= MAXBITS; lg++, ttlg *= 2) {
-+ int lc = 0; /* counter */
-+ int lim = ttlg;
-+
-+ if (lim > t->sizearray) {
-+ lim = t->sizearray; /* adjust upper limit */
-+ if (i > lim)
-+ break; /* no more elements to count */
-+ }
-+
-+ /* count elements in range (2^(lg-1), 2^lg] */
-+ for (; i <= lim; i++) {
-+ if (!is_nil(&t->array[i-1]))
-+ lc++;
-+ }
-+ nums[lg] += lc;
-+ ause += lc;
-+ }
-+ return ause;
-+}
-+
-+static int numusehash(const ktap_tab *t, int *nums, int *pnasize)
-+{
-+ int totaluse = 0; /* total number of elements */
-+ int ause = 0; /* summation of `nums' */
-+ int i = sizenode(t);
-+
-+ while (i--) {
-+ ktap_tnode *n = &t->node[i];
-+ if (!is_nil(gval(n))) {
-+ ause += countint(gkey(n), nums);
-+ totaluse++;
-+ }
-+ }
-+
-+ *pnasize += ause;
-+ return totaluse;
-+}
-+
-+static void update_array_sd(ktap_tab *t)
-+{
-+ int i;
-+
-+ for (i = 0; i < t->sizearray; i++) {
-+ ktap_value *v = &t->array[i];
-+
-+ if (!is_statdata(v))
-+ continue;
-+
-+ set_statdata(v, &t->sd_arr[i]);
-+ }
-+}
-+
-+static void setarrayvector(ktap_state *ks, ktap_tab *t, int size)
-+{
-+ int i;
-+
-+ kp_realloc(ks, t->array, t->sizearray, size, ktap_value);
-+ if (t->with_stats) {
-+ kp_realloc(ks, t->sd_arr, t->sizearray, size,
-+ ktap_stat_data);
-+ update_array_sd(t);
-+ }
-+
-+ for (i = t->sizearray; i < size; i++)
-+ set_nil(&t->array[i]);
-+
-+ t->sizearray = size;
-+}
-+
-+static void setnodevector(ktap_state *ks, ktap_tab *t, int size)
-+{
-+ int lsize;
-+
-+ if (size == 0) { /* no elements to hash part? */
-+ t->node = (ktap_tnode *)dummynode; /* use common `dummynode' */
-+ lsize = 0;
-+ } else {
-+ int i;
-+ lsize = ceillog2(size);
-+ if (lsize > MAXBITS) {
-+ kp_error(ks, "table overflow\n");
-+ return;
-+ }
-+
-+ size = twoto(lsize);
-+ t->node = kp_malloc(ks, size * sizeof(ktap_tnode));
-+ if (t->with_stats)
-+ t->sd_rec = kp_malloc(ks, size *
-+ sizeof(ktap_stat_data));
-+ for (i = 0; i < size; i++) {
-+ ktap_tnode *n = gnode(t, i);
-+ gnext(n) = NULL;
-+ set_nil(gkey(n));
-+ set_nil(gval(n));
-+ }
-+ }
-+
-+ t->lsizenode = (u8)lsize;
-+ t->lastfree = gnode(t, size); /* all positions are free */
-+}
-+
-+static void table_resize(ktap_state *ks, ktap_tab *t, int nasize, int nhsize)
-+{
-+ int oldasize = t->sizearray;
-+ int oldhsize = t->lsizenode;
-+ ktap_tnode *nold = t->node; /* save old hash */
-+ ktap_stat_data *sd_rec_old = t->sd_rec; /* save stat_data */
-+ int i;
-+
-+#ifdef __KERNEL__
-+ kp_verbose_printf(ks, "table resize, nasize: %d, nhsize: %d\n",
-+ nasize, nhsize);
-+#endif
-+
-+ if (nasize > oldasize) /* array part must grow? */
-+ setarrayvector(ks, t, nasize);
-+
-+ /* create new hash part with appropriate size */
-+ setnodevector(ks, t, nhsize);
-+
-+ if (nasize < oldasize) { /* array part must shrink? */
-+ t->sizearray = nasize;
-+ /* re-insert elements from vanishing slice */
-+ for (i = nasize; i < oldasize; i++) {
-+ if (!is_nil(&t->array[i])) {
-+ ktap_value *v;
-+ v = (ktap_value *)table_getint(t, i + 1);
-+ set_obj(v, &t->array[i]);
-+
-+ if (t->with_stats) {
-+ *read_sd(t, v) = t->sd_arr[i];
-+ set_statdata(v, read_sd(t, v));
-+ }
-+ }
-+ }
-+
-+ /* shrink array */
-+ kp_realloc(ks, t->array, oldasize, nasize, ktap_value);
-+ if (t->with_stats) {
-+ kp_realloc(ks, t->sd_arr, oldasize, nasize,
-+ ktap_stat_data);
-+ update_array_sd(t);
-+ }
-+ }
-+
-+ /* re-insert elements from hash part */
-+ for (i = twoto(oldhsize) - 1; i >= 0; i--) {
-+ ktap_tnode *old = nold + i;
-+ if (!is_nil(gval(old))) {
-+ ktap_value *v = table_set(ks, t, gkey(old));
-+ /*
-+ * doesn't need barrier/invalidate cache, as entry was
-+ * already present in the table
-+ */
-+ set_obj(v, gval(old));
-+
-+ if (t->with_stats) {
-+ ktap_stat_data *sd;
-+
-+ sd = read_sd(t, v);
-+ *sd = *_read_sd(gval(old), nold, sd_rec_old);
-+ set_statdata(v, sd);
-+ }
-+ }
-+ }
-+
-+ if (!isdummy(nold)) {
-+ kp_free(ks, nold); /* free old array */
-+ kp_free(ks, sd_rec_old);
-+ }
-+}
-+
-+void kp_tab_resize(ktap_state *ks, ktap_tab *t, int nasize, int nhsize)
-+{
-+ unsigned long __maybe_unused flags;
-+
-+ kp_tab_lock(t);
-+ table_resize(ks, t, nasize, nhsize);
-+ kp_tab_unlock(t);
-+}
-+
-+void kp_tab_resizearray(ktap_state *ks, ktap_tab *t, int nasize)
-+{
-+ unsigned long __maybe_unused flags;
-+ int nsize;
-+
-+ kp_tab_lock(t);
-+
-+ nsize = isdummy(t->node) ? 0 : sizenode(t);
-+ table_resize(ks, t, nasize, nsize);
-+
-+ kp_tab_unlock(t);
-+}
-+
-+static void rehash(ktap_state *ks, ktap_tab *t, const ktap_value *ek)
-+{
-+ int nasize, na;
-+ /* nums[i] = number of keys with 2^(i-1) < k <= 2^i */
-+ int nums[MAXBITS+1];
-+ int i;
-+ int totaluse;
-+
-+ for (i = 0; i <= MAXBITS; i++)
-+ nums[i] = 0; /* reset counts */
-+
-+ nasize = numusearray(t, nums); /* count keys in array part */
-+ totaluse = nasize; /* all those keys are integer keys */
-+ totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */
-+ /* count extra key */
-+ nasize += countint(ek, nums);
-+ totaluse++;
-+ /* compute new size for array part */
-+ na = computesizes(nums, &nasize);
-+ /* resize the table to new computed sizes */
-+ table_resize(ks, t, nasize, totaluse - na);
-+}
-+
-+
-+static ktap_tnode *getfreepos(ktap_tab *t)
-+{
-+ while (t->lastfree > t->node) {
-+ t->lastfree--;
-+ if (is_nil(gkey(t->lastfree)))
-+ return t->lastfree;
-+ }
-+ return NULL; /* could not find a free place */
-+}
-+
-+
-+static ktap_value *table_newkey(ktap_state *ks, ktap_tab *t,
-+ const ktap_value *key)
-+{
-+ ktap_tnode *mp;
-+ ktap_value newkey;
-+
-+ mp = mainposition(t, key);
-+ if (!is_nil(gval(mp)) || isdummy(mp)) { /* main position is taken? */
-+ ktap_tnode *othern;
-+ ktap_tnode *n = getfreepos(t); /* get a free place */
-+ if (n == NULL) { /* cannot find a free place? */
-+ rehash(ks, t, key); /* grow table */
-+ /* insert key into grown table */
-+ return table_set(ks, t, key);
-+ }
-+
-+ othern = mainposition(t, gkey(mp));
-+ if (othern != mp) {
-+ /* is colliding node out of its main position? */
-+
-+ /* move colliding node into free position */
-+ while (gnext(othern) != mp)
-+ othern = gnext(othern); /* find previous */
-+
-+ /* redo the chain with `n' in place of `mp' */
-+ gnext(othern) = n;
-+
-+ /* copy colliding node into free pos */
-+ *n = *mp;
-+
-+ if (t->with_stats) {
-+ ktap_stat_data *sd = read_sd(t, gval(n));
-+ *sd = *read_sd(t, gval(mp));
-+ set_statdata(gval(n), sd);
-+ }
-+
-+ gnext(mp) = NULL; /* now `mp' is free */
-+ set_nil(gval(mp));
-+ } else {
-+ /* colliding node is in its own main position */
-+
-+ /* new node will go into free position */
-+ gnext(n) = gnext(mp); /* chain new position */
-+ gnext(mp) = n;
-+ mp = n;
-+ }
-+ }
-+
-+ /* special handling for cloneable object, maily for btrace object */
-+ if (is_needclone(key))
-+ kp_objclone(ks, key, &newkey, &t->gclist);
-+ else
-+ newkey = *key;
-+
-+ set_obj(gkey(mp), &newkey);
-+ return gval(mp);
-+}
-+
-+
-+/*
-+ * search function for short strings
-+ */
-+static const ktap_value *table_getstr(ktap_tab *t, ktap_string *key)
-+{
-+ ktap_tnode *n = hashstr(t, key);
-+
-+ do { /* check whether `key' is somewhere in the chain */
-+ if (is_shrstring(gkey(n)) && eqshrstr(rawtsvalue(gkey(n)),
-+ key))
-+ return gval(n); /* that's it */
-+ else
-+ n = gnext(n);
-+ } while (n);
-+
-+ return ktap_nilobject;
-+}
-+
-+
-+/*
-+ * main search function
-+ */
-+static const ktap_value *table_get(ktap_tab *t, const ktap_value *key)
-+{
-+ switch (ttype(key)) {
-+ case KTAP_TNIL:
-+ return ktap_nilobject;
-+ case KTAP_TSHRSTR:
-+ return table_getstr(t, rawtsvalue(key));
-+ case KTAP_TNUMBER: {
-+ ktap_number n = nvalue(key);
-+ int k = (int)n;
-+ if ((ktap_number)k == nvalue(key)) /* index is int? */
-+ return table_getint(t, k); /* use specialized version */
-+ /* else go through */
-+ }
-+ default: {
-+ ktap_tnode *n = mainposition(t, key);
-+ do { /* check whether `key' is somewhere in the chain */
-+ if (rawequalobj(gkey(n), key))
-+ return gval(n); /* that's it */
-+ else
-+ n = gnext(n);
-+ } while (n);
-+
-+ return ktap_nilobject;
-+ }
-+ }
-+}
-+
-+const ktap_value *kp_tab_get(ktap_tab *t, const ktap_value *key)
-+{
-+ const ktap_value *val;
-+ unsigned long __maybe_unused flags;
-+
-+ kp_tab_lock(t);
-+ val = table_get(t, key);
-+ kp_tab_unlock(t);
-+
-+ return val;
-+}
-+
-+static ktap_value *table_set(ktap_state *ks, ktap_tab *t,
-+ const ktap_value *key)
-+{
-+ const ktap_value *p = table_get(t, key);
-+
-+ if (p != ktap_nilobject)
-+ return (ktap_value *)p;
-+ else
-+ return table_newkey(ks, t, key);
-+}
-+
-+void kp_tab_setvalue(ktap_state *ks, ktap_tab *t,
-+ const ktap_value *key, ktap_value *val)
-+{
-+ unsigned long __maybe_unused flags;
-+
-+ if (is_nil(key)) {
-+ kp_printf(ks, "table index is nil\n");
-+ kp_exit(ks);
-+ return;
-+ }
-+
-+ kp_tab_lock(t);
-+ set_obj(table_set(ks, t, key), val);
-+ kp_tab_unlock(t);
-+}
-+
-+static void table_setint(ktap_state *ks, ktap_tab *t, int key, ktap_value *v)
-+{
-+ const ktap_value *p;
-+ ktap_value *cell;
-+
-+ p = table_getint(t, key);
-+
-+ if (p != ktap_nilobject)
-+ cell = (ktap_value *)p;
-+ else {
-+ ktap_value k;
-+ set_number(&k, key);
-+ cell = table_newkey(ks, t, &k);
-+ }
-+
-+ set_obj(cell, v);
-+}
-+
-+void kp_tab_setint(ktap_state *ks, ktap_tab *t, int key, ktap_value *val)
-+{
-+ unsigned long __maybe_unused flags;
-+
-+ kp_tab_lock(t);
-+ table_setint(ks, t, key, val);
-+ kp_tab_unlock(t);
-+}
-+
-+void kp_tab_atomic_inc(ktap_state *ks, ktap_tab *t, ktap_value *key, int n)
-+{
-+ unsigned long __maybe_unused flags;
-+ ktap_value *v;
-+
-+ if (is_nil(key)) {
-+ kp_printf(ks, "table index is nil\n");
-+ kp_exit(ks);
-+ return;
-+ }
-+
-+ kp_tab_lock(t);
-+
-+ v = table_set(ks, t, key);
-+ if (is_nil(v)) {
-+ set_number(v, n);
-+ } else
-+ set_number(v, nvalue(v) + n);
-+
-+ kp_tab_unlock(t);
-+}
-+
-+int kp_tab_length(ktap_state *ks, ktap_tab *t)
-+{
-+ unsigned long __maybe_unused flags;
-+ int i, len = 0;
-+
-+ kp_tab_lock(t);
-+
-+ for (i = 0; i < t->sizearray; i++) {
-+ ktap_value *v = &t->array[i];
-+
-+ if (is_nil(v))
-+ continue;
-+ len++;
-+ }
-+
-+ for (i = 0; i < sizenode(t); i++) {
-+ ktap_tnode *n = &t->node[i];
-+
-+ if (is_nil(gkey(n)))
-+ continue;
-+
-+ len++;
-+ }
-+
-+ kp_tab_unlock(t);
-+ return len;
-+}
-+
-+void kp_tab_free(ktap_state *ks, ktap_tab *t)
-+{
-+ if (t->sizearray > 0) {
-+ kp_free(ks, t->array);
-+ kp_free(ks, t->sd_arr);
-+ }
-+
-+ if (!isdummy(t->node)) {
-+ kp_free(ks, t->node);
-+ kp_free(ks, t->sd_rec);
-+ }
-+
-+ kp_free(ks, t->sorted);
-+ kp_free_gclist(ks, t->gclist);
-+ kp_free(ks, t);
-+}
-+
-+void kp_tab_dump(ktap_state *ks, ktap_tab *t)
-+{
-+ int i;
-+
-+ for (i = 0; i < t->sizearray; i++) {
-+ ktap_value *v = &t->array[i];
-+
-+ if (is_nil(v))
-+ continue;
-+
-+ kp_printf(ks, "%d:\t", i + 1);
-+ kp_showobj(ks, v);
-+ kp_puts(ks, "\n");
-+ }
-+
-+ for (i = 0; i < sizenode(t); i++) {
-+ ktap_tnode *n = &t->node[i];
-+
-+ if (is_nil(gkey(n)))
-+ continue;
-+
-+ kp_showobj(ks, gkey(n));
-+ kp_puts(ks, ":\t");
-+ kp_showobj(ks, gval(n));
-+ kp_puts(ks, "\n");
-+ }
-+}
-+
-+/*
-+ * table-clear only set nil of all elements, not free t->array and nodes.
-+ * we assume user will reuse table soon after clear table, so reserve array
-+ * and nodes will avoid memory allocation when insert key-value again.
-+ */
-+void kp_tab_clear(ktap_state *ks, ktap_tab *t)
-+{
-+ unsigned long __maybe_unused flags;
-+
-+ kp_tab_lock(t);
-+
-+ memset(t->array, 0, t->sizearray * sizeof(ktap_value));
-+ memset(t->node, 0, sizenode(t) * sizeof(ktap_tnode));
-+
-+ kp_tab_unlock(t);
-+}
-+
-+#ifdef __KERNEL__
-+static void string_convert(char *output, const char *input)
-+{
-+ if (strlen(input) > 32) {
-+ strncpy(output, input, 32-4);
-+ memset(output + 32-4, '.', 3);
-+ } else
-+ memcpy(output, input, strlen(input));
-+}
-+
-+struct table_hist_record {
-+ ktap_value key;
-+ ktap_value val;
-+};
-+
-+static int hist_record_cmp(const void *r1, const void *r2)
-+{
-+ const struct table_hist_record *i = r1;
-+ const struct table_hist_record *j = r2;
-+
-+ if ((nvalue(&i->val) == nvalue(&j->val))) {
-+ return 0;
-+ } else if ((nvalue(&i->val) < nvalue(&j->val))) {
-+ return 1;
-+ } else
-+ return -1;
-+}
-+
-+/* todo: make histdump to be faster */
-+
-+/* histogram: key should be number or string, value must be number */
-+static void table_histdump(ktap_state *ks, ktap_tab *t, int shownums)
-+{
-+ struct table_hist_record *thr;
-+ unsigned long __maybe_unused flags;
-+ char dist_str[40];
-+ int i, ratio, total = 0, count = 0, top_num, is_kernel_address = 0;
-+ int size, num;
-+
-+ size = sizeof(*thr) * (t->sizearray + sizenode(t));
-+ thr = kp_malloc(ks, size);
-+ if (!thr) {
-+ kp_error(ks, "Cannot allocate %d of histogram memory", size);
-+ return;
-+ }
-+
-+ kp_tab_lock(t);
-+
-+ for (i = 0; i < t->sizearray; i++) {
-+ ktap_value *v = &t->array[i];
-+
-+ if (is_nil(v))
-+ continue;
-+
-+ if (is_number(v))
-+ num = nvalue(v);
-+ else if (is_statdata(v))
-+ num = sdvalue(v)->count;
-+ else {
-+ kp_tab_unlock(t);
-+ goto error;
-+ }
-+
-+ set_number(&thr[count].key, i + 1);
-+ set_number(&thr[count].val, num);
-+ count++;
-+ total += num;
-+ }
-+
-+ for (i = 0; i < sizenode(t); i++) {
-+ ktap_tnode *n = &t->node[i];
-+ ktap_value *v = gval(n);
-+
-+ if (is_nil(gkey(n)))
-+ continue;
-+
-+ if (is_number(v))
-+ num = nvalue(v);
-+ else if (is_statdata(v))
-+ num = sdvalue(v)->count;
-+ else {
-+ kp_tab_unlock(t);
-+ goto error;
-+ }
-+
-+ set_obj(&thr[count].key, gkey(n));
-+ set_number(&thr[count].val, num);
-+ count++;
-+ total += num;
-+ }
-+
-+ kp_tab_unlock(t);
-+
-+ sort(thr, count, sizeof(struct table_hist_record),
-+ hist_record_cmp, NULL);
-+
-+ dist_str[sizeof(dist_str) - 1] = '\0';
-+
-+ /* check the first key is a kernel text symbol or not */
-+ if (is_number(&thr[0].key)) {
-+ char str[KSYM_SYMBOL_LEN];
-+
-+ SPRINT_SYMBOL(str, nvalue(&thr[0].key));
-+ if (str[0] != '0' || str[1] != 'x')
-+ is_kernel_address = 1;
-+ }
-+
-+ top_num = min(shownums, count);
-+ for (i = 0; i < top_num; i++) {
-+ ktap_value *key = &thr[i].key;
-+ ktap_value *val = &thr[i].val;
-+
-+ memset(dist_str, ' ', sizeof(dist_str) - 1);
-+ ratio = (nvalue(val) * (sizeof(dist_str) - 1)) / total;
-+ memset(dist_str, '@', ratio);
-+
-+ if (is_string(key)) {
-+ char buf[32 + 1] = {0};
-+
-+ string_convert(buf, svalue(key));
-+ kp_printf(ks, "%32s |%s%-7d\n", buf, dist_str,
-+ nvalue(val));
-+ } else if (is_number(key)) {
-+ char str[KSYM_SYMBOL_LEN];
-+ char buf[32 + 1] = {0};
-+
-+ if (is_kernel_address) {
-+ /* suppose it's a symbol, fix it in future */
-+ SPRINT_SYMBOL(str, nvalue(key));
-+ string_convert(buf, str);
-+ kp_printf(ks, "%32s |%s%-7d\n", buf, dist_str,
-+ nvalue(val));
-+ } else {
-+ kp_printf(ks, "%32d |%s%-7d\n", nvalue(key),
-+ dist_str, nvalue(val));
-+ }
-+ }
-+ }
-+
-+ if (count > shownums)
-+ kp_printf(ks, "%32s |\n", "...");
-+
-+ goto out;
-+
-+ error:
-+ kp_puts(ks, "error: table histogram only handle "
-+ " (key: string/number val: number)\n");
-+ out:
-+ kp_free(ks, thr);
-+}
-+
-+#define HISTOGRAM_DEFAULT_TOP_NUM 20
-+
-+#define DISTRIBUTION_STR "------------- Distribution -------------"
-+void kp_tab_histogram(ktap_state *ks, ktap_tab *t)
-+{
-+ kp_printf(ks, "%32s%s%s\n", "value ", DISTRIBUTION_STR, " count");
-+ table_histdump(ks, t, HISTOGRAM_DEFAULT_TOP_NUM);
-+}
-+
-+/*
-+ * Parallel Table
-+ */
-+
-+void kp_statdata_dump(ktap_state *ks, ktap_stat_data *sd)
-+{
-+ kp_printf(ks, "[count: %6d sum: %6d max: %6d min: %6d avg: %6d]",
-+ sd->count, sd->sum, sd->max, sd->min, sd->sum/sd->count);
-+}
-+
-+static void statdata_add(ktap_stat_data *sd1, ktap_stat_data *sd2)
-+{
-+ sd2->count += sd1->count;
-+ sd2->sum += sd1->sum;
-+ if (sd1->max > sd2->max)
-+ sd2->max = sd1->max;
-+ if (sd1->min < sd2->min)
-+ sd2->min = sd1->min;
-+}
-+
-+static void merge_table(ktap_state *ks, ktap_tab *t1, ktap_tab *t2)
-+{
-+ unsigned long __maybe_unused flags;
-+ ktap_value *newv;
-+ ktap_value n;
-+ int i;
-+
-+ kp_tab_lock(t1);
-+ kp_tab_lock(t2);
-+
-+ for (i = 0; i < t1->sizearray; i++) {
-+ ktap_value *v = &t1->array[i];
-+ ktap_stat_data *sd;
-+
-+ if (is_nil(v))
-+ continue;
-+
-+ set_number(&n, i);
-+
-+ newv = table_set(ks, t2, &n);
-+ sd = read_sd(t2, newv);
-+ if (is_nil(newv)) {
-+ *sd = *read_sd(t1, v);
-+ set_statdata(newv, sd);
-+ } else
-+ statdata_add(read_sd(t1, v), sd);
-+ }
-+
-+ for (i = 0; i < sizenode(t1); i++) {
-+ ktap_tnode *node = &t1->node[i];
-+
-+ if (is_nil(gkey(node)))
-+ continue;
-+
-+ newv = table_set(ks, t2, gkey(node));
-+ if (is_nil(newv)) {
-+ *read_sd(t2, newv) = *read_sd(t1, gval(node));
-+ set_statdata(newv, read_sd(t2, newv));
-+ } else
-+ statdata_add(read_sd(t1, gval(node)),
-+ read_sd(t2, newv));
-+ }
-+
-+ kp_tab_unlock(t2);
-+ kp_tab_unlock(t1);
-+}
-+
-+ktap_tab *kp_ptab_synthesis(ktap_state *ks, ktap_ptab *ph)
-+{
-+ ktap_tab *agg;
-+ int cpu;
-+
-+ agg = ph->agg;
-+
-+ /* clear the table content before store new elements */
-+ kp_tab_clear(ks, agg);
-+
-+ for_each_possible_cpu(cpu) {
-+ ktap_tab **t = per_cpu_ptr(ph->tbl, cpu);
-+ merge_table(ks, *t, agg);
-+ }
-+
-+ return agg;
-+}
-+
-+void kp_ptab_dump(ktap_state *ks, ktap_ptab *ph)
-+{
-+ kp_tab_dump(ks, kp_ptab_synthesis(ks, ph));
-+}
-+
-+ktap_ptab *kp_ptab_new(ktap_state *ks)
-+{
-+ ktap_ptab *ph;
-+ int cpu;
-+
-+ ph = &kp_newobject(ks, KTAP_TPTABLE, sizeof(ktap_ptab),
-+ NULL)->ph;
-+ ph->tbl = alloc_percpu(ktap_tab *);
-+
-+ for_each_possible_cpu(cpu) {
-+ ktap_tab **t = per_cpu_ptr(ph->tbl, cpu);
-+ *t = kp_tab_new(ks);
-+
-+ (*t)->with_stats = 1;
-+
-+ /* todo: make this value to be configuable, MAXENTRIES? */
-+ table_resize(ks, *t, 0, 2000);
-+ }
-+
-+ ph->agg = kp_tab_new(ks);
-+ ph->agg->with_stats = 1;
-+ table_resize(ks, ph->agg, 0, 2000);
-+
-+ return ph;
-+}
-+
-+void kp_ptab_free(ktap_state *ks, ktap_ptab *ph)
-+{
-+ free_percpu(ph->tbl);
-+ kp_free(ks, ph);
-+}
-+
-+void kp_ptab_set(ktap_state *ks, ktap_ptab *ph,
-+ ktap_value *key, ktap_value *val)
-+{
-+ ktap_tab *t = *__this_cpu_ptr(ph->tbl);
-+ unsigned long __maybe_unused flags;
-+ ktap_value *v;
-+ ktap_stat_data *sd;
-+ int aggval;;
-+
-+ if (unlikely(!is_number(val))) {
-+ kp_error(ks, "add non number value to aggregation table\n");
-+ return;
-+ }
-+
-+ aggval = nvalue(val);
-+
-+ kp_tab_lock(t);
-+
-+ v = table_set(ks, t, key);
-+ sd = read_sd(t, v);
-+
-+ if (is_nil(v)) {
-+ sd->count = 1;
-+ sd->sum = sd->min = sd->max = aggval;
-+ set_statdata(v, sd);
-+ kp_tab_unlock(t);
-+ return;
-+ }
-+
-+ sd->count++;
-+ sd->sum += aggval;
-+ if (aggval > sd->max)
-+ sd->max = aggval;
-+ if (aggval < sd->min)
-+ sd->min = aggval;
-+
-+ kp_tab_unlock(t);
-+}
-+
-+void kp_ptab_get(ktap_state *ks, ktap_ptab *ph,
-+ ktap_value *key, ktap_value *val)
-+{
-+ unsigned long __maybe_unused flags;
-+ ktap_stat_data sd, *aggsd;
-+ const ktap_value *v;
-+ ktap_value *aggval;
-+ int cpu;
-+
-+ sd.count = sd.sum = sd.max = sd.min = -1;
-+
-+ for_each_possible_cpu(cpu) {
-+ ktap_tab **t = per_cpu_ptr(ph->tbl, cpu);
-+
-+ kp_tab_lock(*t);
-+ v = table_get(*t, key);
-+ if (is_nil(v)) {
-+ kp_tab_unlock(*t);
-+ continue;
-+ }
-+
-+ if (sd.count == -1) {
-+ sd = *read_sd(*t, v);
-+ kp_tab_unlock(*t);
-+ continue;
-+ }
-+
-+ statdata_add(read_sd(*t, v), &sd);
-+ kp_tab_unlock(*t);
-+ }
-+
-+ if (sd.count == -1) {
-+ set_nil(val);
-+ return;
-+ }
-+
-+ kp_tab_lock(ph->agg);
-+ aggval = table_set(ks, ph->agg, key);
-+ aggsd = read_sd(ph->agg, aggval);
-+ *aggsd = sd;
-+ set_statdata(aggval, aggsd);
-+ set_statdata(val, aggsd);
-+ kp_tab_unlock(ph->agg);
-+}
-+
-+void kp_ptab_histogram(ktap_state *ks, ktap_ptab *ph)
-+{
-+ kp_tab_histogram(ks, kp_ptab_synthesis(ks, ph));
-+}
-+#endif
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_tab.h
-@@ -0,0 +1,32 @@
-+#ifndef __KTAP_TAB_H__
-+#define __KTAP_TAB_H__
-+
-+ktap_value *kp_tab_set(ktap_state *ks, ktap_tab *t, const ktap_value *key);
-+ktap_tab *kp_tab_new(ktap_state *ks);
-+const ktap_value *kp_tab_getint(ktap_tab *t, int key);
-+void kp_tab_setint(ktap_state *ks, ktap_tab *t, int key, ktap_value *v);
-+const ktap_value *kp_tab_get(ktap_tab *t, const ktap_value *key);
-+void kp_tab_setvalue(ktap_state *ks, ktap_tab *t, const ktap_value *key, ktap_value *val);
-+void kp_tab_resize(ktap_state *ks, ktap_tab *t, int nasize, int nhsize);
-+void kp_tab_resizearray(ktap_state *ks, ktap_tab *t, int nasize);
-+void kp_tab_free(ktap_state *ks, ktap_tab *t);
-+int kp_tab_length(ktap_state *ks, ktap_tab *t);
-+void kp_tab_dump(ktap_state *ks, ktap_tab *t);
-+void kp_tab_clear(ktap_state *ks, ktap_tab *t);
-+void kp_tab_histogram(ktap_state *ks, ktap_tab *t);
-+int kp_tab_next(ktap_state *ks, ktap_tab *t, StkId key);
-+int kp_tab_sort_next(ktap_state *ks, ktap_tab *t, StkId key);
-+void kp_tab_sort(ktap_state *ks, ktap_tab *t, ktap_closure *cmp_func);
-+void kp_tab_atomic_inc(ktap_state *ks, ktap_tab *t, ktap_value *key, int n);
-+void kp_statdata_dump(ktap_state *ks, ktap_stat_data *sd);
-+ktap_ptab *kp_ptab_new(ktap_state *ks);
-+ktap_tab *kp_ptab_synthesis(ktap_state *ks, ktap_ptab *ph);
-+void kp_ptab_dump(ktap_state *ks, ktap_ptab *ph);
-+void kp_ptab_free(ktap_state *ks, ktap_ptab *ph);
-+void kp_ptab_set(ktap_state *ks, ktap_ptab *ph,
-+ ktap_value *key, ktap_value *val);
-+void kp_ptab_get(ktap_state *ks, ktap_ptab *ph,
-+ ktap_value *key, ktap_value *val);
-+void kp_ptab_histogram(ktap_state *ks, ktap_ptab *ph);
-+
-+#endif /* __KTAP_TAB_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_transport.c
-@@ -0,0 +1,641 @@
-+/*
-+ * kp_transport.c - ktap transport functionality
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License 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/debugfs.h>
-+#include <linux/ftrace_event.h>
-+#include <linux/stacktrace.h>
-+#include <linux/clocksource.h>
-+#include <asm/uaccess.h>
-+#include <linux/slab.h>
-+#include <linux/module.h>
-+#include <linux/kallsyms.h>
-+#include "../include/ktap_types.h"
-+#include "ktap.h"
-+#include "kp_transport.h"
-+
-+struct ktap_trace_iterator {
-+ struct ring_buffer *buffer;
-+ int print_timestamp;
-+ void *private;
-+
-+ struct trace_iterator iter;
-+};
-+
-+enum ktap_trace_type {
-+ __TRACE_FIRST_TYPE = 0,
-+
-+ TRACE_FN = 1, /* must be same as ftrace definition in kernel */
-+ TRACE_PRINT,
-+ TRACE_BPUTS,
-+ TRACE_STACK,
-+ TRACE_USER_STACK,
-+
-+ __TRACE_LAST_TYPE,
-+};
-+
-+#define KTAP_TRACE_ITER(iter) \
-+ container_of(iter, struct ktap_trace_iterator, iter)
-+
-+static
-+ssize_t _trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt)
-+{
-+ int len;
-+ int ret;
-+
-+ if (!cnt)
-+ return 0;
-+
-+ if (s->len <= s->readpos)
-+ return -EBUSY;
-+
-+ len = s->len - s->readpos;
-+ if (cnt > len)
-+ cnt = len;
-+ ret = copy_to_user(ubuf, s->buffer + s->readpos, cnt);
-+ if (ret == cnt)
-+ return -EFAULT;
-+
-+ cnt -= ret;
-+
-+ s->readpos += cnt;
-+ return cnt;
-+}
-+
-+int _trace_seq_puts(struct trace_seq *s, const char *str)
-+{
-+ int len = strlen(str);
-+
-+ if (s->full)
-+ return 0;
-+
-+ if (len > ((PAGE_SIZE - 1) - s->len)) {
-+ s->full = 1;
-+ return 0;
-+ }
-+
-+ memcpy(s->buffer + s->len, str, len);
-+ s->len += len;
-+
-+ return len;
-+}
-+
-+static int trace_empty(struct trace_iterator *iter)
-+{
-+ struct ktap_trace_iterator *ktap_iter = KTAP_TRACE_ITER(iter);
-+ int cpu;
-+
-+ for_each_online_cpu(cpu) {
-+ if (!ring_buffer_empty_cpu(ktap_iter->buffer, cpu))
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+static void trace_consume(struct trace_iterator *iter)
-+{
-+ struct ktap_trace_iterator *ktap_iter = KTAP_TRACE_ITER(iter);
-+
-+ ring_buffer_consume(ktap_iter->buffer, iter->cpu, &iter->ts,
-+ &iter->lost_events);
-+}
-+
-+unsigned long long ns2usecs(cycle_t nsec)
-+{
-+ nsec += 500;
-+ do_div(nsec, 1000);
-+ return nsec;
-+}
-+
-+static int trace_print_timestamp(struct trace_iterator *iter)
-+{
-+ struct trace_seq *s = &iter->seq;
-+ unsigned long long t;
-+ unsigned long secs, usec_rem;
-+
-+ t = ns2usecs(iter->ts);
-+ usec_rem = do_div(t, USEC_PER_SEC);
-+ secs = (unsigned long)t;
-+
-+ return trace_seq_printf(s, "%5lu.%06lu: ", secs, usec_rem);
-+}
-+
-+/* todo: export kernel function ftrace_find_event in future, and make faster */
-+static struct trace_event *(*ftrace_find_event)(int type);
-+
-+static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
-+{
-+ struct ktap_trace_iterator *ktap_iter = KTAP_TRACE_ITER(iter);
-+ struct trace_entry *entry = iter->ent;
-+ struct trace_event *ev;
-+
-+ ev = ftrace_find_event(entry->type);
-+
-+ if (ktap_iter->print_timestamp && !trace_print_timestamp(iter))
-+ return TRACE_TYPE_PARTIAL_LINE;
-+
-+ if (ev) {
-+ int ret = ev->funcs->trace(iter, 0, ev);
-+
-+ /* overwrite '\n' at the ending */
-+ iter->seq.buffer[iter->seq.len - 1] = '\0';
-+ iter->seq.len--;
-+ return ret;
-+ }
-+
-+ return TRACE_TYPE_PARTIAL_LINE;
-+}
-+
-+static enum print_line_t print_trace_stack(struct trace_iterator *iter)
-+{
-+ struct trace_entry *entry = iter->ent;
-+ struct stack_trace trace;
-+ char str[KSYM_SYMBOL_LEN];
-+ int i;
-+
-+ trace.entries = (unsigned long *)(entry + 1);
-+ trace.nr_entries = (iter->ent_size - sizeof(*entry)) /
-+ sizeof(unsigned long);
-+
-+ if (!_trace_seq_puts(&iter->seq, "<stack trace>\n"))
-+ return TRACE_TYPE_PARTIAL_LINE;
-+
-+ for (i = 0; i < trace.nr_entries; i++) {
-+ unsigned long p = trace.entries[i];
-+
-+ if (p == ULONG_MAX)
-+ break;
-+
-+ sprint_symbol(str, p);
-+ if (!trace_seq_printf(&iter->seq, " => %s\n", str))
-+ return TRACE_TYPE_PARTIAL_LINE;
-+ }
-+
-+ return TRACE_TYPE_HANDLED;
-+}
-+
-+struct ktap_ftrace_entry {
-+ struct trace_entry entry;
-+ unsigned long ip;
-+ unsigned long parent_ip;
-+};
-+
-+static enum print_line_t print_trace_fn(struct trace_iterator *iter)
-+{
-+ struct ktap_trace_iterator *ktap_iter = KTAP_TRACE_ITER(iter);
-+ struct ktap_ftrace_entry *field = (struct ktap_ftrace_entry *)iter->ent;
-+ char str[KSYM_SYMBOL_LEN];
-+
-+ if (ktap_iter->print_timestamp && !trace_print_timestamp(iter))
-+ return TRACE_TYPE_PARTIAL_LINE;
-+
-+ sprint_symbol(str, field->ip);
-+ if (!_trace_seq_puts(&iter->seq, str))
-+ return TRACE_TYPE_PARTIAL_LINE;
-+
-+ if (!_trace_seq_puts(&iter->seq, " <- "))
-+ return TRACE_TYPE_PARTIAL_LINE;
-+
-+ sprint_symbol(str, field->parent_ip);
-+ if (!_trace_seq_puts(&iter->seq, str))
-+ return TRACE_TYPE_PARTIAL_LINE;
-+
-+ return TRACE_TYPE_HANDLED;
-+}
-+
-+static enum print_line_t print_trace_bputs(struct trace_iterator *iter)
-+{
-+ if (!_trace_seq_puts(&iter->seq,
-+ (const char *)(*(unsigned long *)(iter->ent + 1))))
-+ return TRACE_TYPE_PARTIAL_LINE;
-+
-+ return TRACE_TYPE_HANDLED;
-+}
-+
-+static enum print_line_t print_trace_line(struct trace_iterator *iter)
-+{
-+ struct trace_entry *entry = iter->ent;
-+ char *str = (char *)(entry + 1);
-+
-+ if (entry->type == TRACE_PRINT) {
-+ if (!trace_seq_printf(&iter->seq, "%s", str))
-+ return TRACE_TYPE_PARTIAL_LINE;
-+
-+ return TRACE_TYPE_HANDLED;
-+ }
-+
-+ if (entry->type == TRACE_BPUTS)
-+ return print_trace_bputs(iter);
-+
-+ if (entry->type == TRACE_STACK)
-+ return print_trace_stack(iter);
-+
-+ if (entry->type == TRACE_FN)
-+ return print_trace_fn(iter);
-+
-+ return print_trace_fmt(iter);
-+}
-+
-+static struct trace_entry *
-+peek_next_entry(struct trace_iterator *iter, int cpu, u64 *ts,
-+ unsigned long *lost_events)
-+{
-+ struct ktap_trace_iterator *ktap_iter = KTAP_TRACE_ITER(iter);
-+ struct ring_buffer_event *event;
-+
-+ event = ring_buffer_peek(ktap_iter->buffer, cpu, ts, lost_events);
-+ if (event) {
-+ iter->ent_size = ring_buffer_event_length(event);
-+ return ring_buffer_event_data(event);
-+ }
-+
-+ return NULL;
-+}
-+
-+static struct trace_entry *
-+__find_next_entry(struct trace_iterator *iter, int *ent_cpu,
-+ unsigned long *missing_events, u64 *ent_ts)
-+{
-+ struct ktap_trace_iterator *ktap_iter = KTAP_TRACE_ITER(iter);
-+ struct ring_buffer *buffer = ktap_iter->buffer;
-+ struct trace_entry *ent, *next = NULL;
-+ unsigned long lost_events = 0, next_lost = 0;
-+ u64 next_ts = 0, ts;
-+ int next_cpu = -1;
-+ int next_size = 0;
-+ int cpu;
-+
-+ for_each_online_cpu(cpu) {
-+ if (ring_buffer_empty_cpu(buffer, cpu))
-+ continue;
-+
-+ ent = peek_next_entry(iter, cpu, &ts, &lost_events);
-+ /*
-+ * Pick the entry with the smallest timestamp:
-+ */
-+ if (ent && (!next || ts < next_ts)) {
-+ next = ent;
-+ next_cpu = cpu;
-+ next_ts = ts;
-+ next_lost = lost_events;
-+ next_size = iter->ent_size;
-+ }
-+ }
-+
-+ iter->ent_size = next_size;
-+
-+ if (ent_cpu)
-+ *ent_cpu = next_cpu;
-+
-+ if (ent_ts)
-+ *ent_ts = next_ts;
-+
-+ if (missing_events)
-+ *missing_events = next_lost;
-+
-+ return next;
-+}
-+
-+/* Find the next real entry, and increment the iterator to the next entry */
-+static void *trace_find_next_entry_inc(struct trace_iterator *iter)
-+{
-+ iter->ent = __find_next_entry(iter, &iter->cpu,
-+ &iter->lost_events, &iter->ts);
-+ if (iter->ent)
-+ iter->idx++;
-+
-+ return iter->ent ? iter : NULL;
-+}
-+
-+static void poll_wait_pipe(void)
-+{
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ /* sleep for 100 msecs, and try again. */
-+ schedule_timeout(HZ / 10);
-+}
-+
-+static int tracing_wait_pipe(struct file *filp)
-+{
-+ struct trace_iterator *iter = filp->private_data;
-+ struct ktap_trace_iterator *ktap_iter = KTAP_TRACE_ITER(iter);
-+ ktap_state *ks = ktap_iter->private;
-+
-+ while (trace_empty(iter)) {
-+
-+ if ((filp->f_flags & O_NONBLOCK)) {
-+ return -EAGAIN;
-+ }
-+
-+ mutex_unlock(&iter->mutex);
-+
-+ poll_wait_pipe();
-+
-+ mutex_lock(&iter->mutex);
-+
-+ if (G(ks)->wait_user && trace_empty(iter))
-+ return -EINTR;
-+ }
-+
-+ return 1;
-+}
-+
-+static ssize_t
-+tracing_read_pipe(struct file *filp, char __user *ubuf, size_t cnt,
-+ loff_t *ppos)
-+{
-+ struct trace_iterator *iter = filp->private_data;
-+ ssize_t sret;
-+
-+ /* return any leftover data */
-+ sret = _trace_seq_to_user(&iter->seq, ubuf, cnt);
-+ if (sret != -EBUSY)
-+ return sret;
-+ /*
-+ * Avoid more than one consumer on a single file descriptor
-+ * This is just a matter of traces coherency, the ring buffer itself
-+ * is protected.
-+ */
-+ mutex_lock(&iter->mutex);
-+
-+waitagain:
-+ sret = tracing_wait_pipe(filp);
-+ if (sret <= 0)
-+ goto out;
-+
-+ /* stop when tracing is finished */
-+ if (trace_empty(iter)) {
-+ sret = 0;
-+ goto out;
-+ }
-+
-+ if (cnt >= PAGE_SIZE)
-+ cnt = PAGE_SIZE - 1;
-+
-+ /* reset all but tr, trace, and overruns */
-+ memset(&iter->seq, 0,
-+ sizeof(struct trace_iterator) -
-+ offsetof(struct trace_iterator, seq));
-+ iter->pos = -1;
-+
-+ while (trace_find_next_entry_inc(iter) != NULL) {
-+ enum print_line_t ret;
-+ int len = iter->seq.len;
-+
-+ ret = print_trace_line(iter);
-+ if (ret == TRACE_TYPE_PARTIAL_LINE) {
-+ /* don't print partial lines */
-+ iter->seq.len = len;
-+ break;
-+ }
-+ if (ret != TRACE_TYPE_NO_CONSUME)
-+ trace_consume(iter);
-+
-+ if (iter->seq.len >= cnt)
-+ break;
-+
-+ /*
-+ * Setting the full flag means we reached the trace_seq buffer
-+ * size and we should leave by partial output condition above.
-+ * One of the trace_seq_* functions is not used properly.
-+ */
-+ WARN_ONCE(iter->seq.full, "full flag set for trace type %d",
-+ iter->ent->type);
-+ }
-+
-+ /* Now copy what we have to the user */
-+ sret = _trace_seq_to_user(&iter->seq, ubuf, cnt);
-+ if (iter->seq.readpos >= iter->seq.len)
-+ trace_seq_init(&iter->seq);
-+
-+ /*
-+ * If there was nothing to send to user, in spite of consuming trace
-+ * entries, go back to wait for more entries.
-+ */
-+ if (sret == -EBUSY)
-+ goto waitagain;
-+
-+out:
-+ mutex_unlock(&iter->mutex);
-+
-+ return sret;
-+}
-+
-+static int tracing_open_pipe(struct inode *inode, struct file *filp)
-+{
-+ struct ktap_trace_iterator *ktap_iter;
-+ ktap_state *ks = inode->i_private;
-+
-+ /* create a buffer to store the information to pass to userspace */
-+ ktap_iter = kzalloc(sizeof(*ktap_iter), GFP_KERNEL);
-+ if (!ktap_iter)
-+ return -ENOMEM;
-+
-+ ktap_iter->private = ks;
-+ ktap_iter->buffer = G(ks)->buffer;
-+ ktap_iter->print_timestamp = G(ks)->parm->print_timestamp;
-+ mutex_init(&ktap_iter->iter.mutex);
-+ filp->private_data = &ktap_iter->iter;
-+
-+ nonseekable_open(inode, filp);
-+
-+ return 0;
-+}
-+
-+static int tracing_release_pipe(struct inode *inode, struct file *file)
-+{
-+ struct trace_iterator *iter = file->private_data;
-+ struct ktap_trace_iterator *ktap_iter = KTAP_TRACE_ITER(iter);
-+
-+ mutex_destroy(&iter->mutex);
-+ kfree(ktap_iter);
-+ return 0;
-+}
-+
-+static const struct file_operations tracing_pipe_fops = {
-+ .open = tracing_open_pipe,
-+ .read = tracing_read_pipe,
-+ .splice_read = NULL,
-+ .release = tracing_release_pipe,
-+ .llseek = no_llseek,
-+};
-+
-+/*
-+ * preempt disabled in ring_buffer_lock_reserve
-+ *
-+ * The implementation is similar with funtion __ftrace_trace_stack.
-+ */
-+void kp_transport_print_backtrace(ktap_state *ks, int skip, int max_entries)
-+{
-+ struct ring_buffer *buffer = G(ks)->buffer;
-+ struct ring_buffer_event *event;
-+ struct trace_entry *entry;
-+ int size;
-+
-+ size = max_entries * sizeof(unsigned long);
-+ event = ring_buffer_lock_reserve(buffer, sizeof(*entry) + size);
-+ if (!event) {
-+ KTAP_STATS(ks)->events_missed += 1;
-+ return;
-+ } else {
-+ struct stack_trace trace;
-+
-+ entry = ring_buffer_event_data(event);
-+ tracing_generic_entry_update(entry, 0, 0);
-+ entry->type = TRACE_STACK;
-+
-+ trace.nr_entries = 0;
-+ trace.skip = skip;
-+ trace.max_entries = max_entries;
-+ trace.entries = (unsigned long *)(entry + 1);
-+ save_stack_trace(&trace);
-+
-+ ring_buffer_unlock_commit(buffer, event);
-+ }
-+}
-+
-+void kp_transport_event_write(ktap_state *ks, struct ktap_event *e)
-+{
-+ struct ring_buffer *buffer = G(ks)->buffer;
-+ struct ring_buffer_event *event;
-+ struct trace_entry *entry;
-+
-+ event = ring_buffer_lock_reserve(buffer, e->entry_size +
-+ sizeof(struct ftrace_event_call *));
-+ if (!event) {
-+ KTAP_STATS(ks)->events_missed += 1;
-+ return;
-+ } else {
-+ entry = ring_buffer_event_data(event);
-+
-+ memcpy(entry, e->entry, e->entry_size);
-+
-+ ring_buffer_unlock_commit(buffer, event);
-+ }
-+}
-+
-+void kp_transport_write(ktap_state *ks, const void *data, size_t length)
-+{
-+ struct ring_buffer *buffer = G(ks)->buffer;
-+ struct ring_buffer_event *event;
-+ struct trace_entry *entry;
-+ int size;
-+
-+ size = sizeof(struct trace_entry) + length;
-+
-+ event = ring_buffer_lock_reserve(buffer, size);
-+ if (!event) {
-+ KTAP_STATS(ks)->events_missed += 1;
-+ return;
-+ } else {
-+ entry = ring_buffer_event_data(event);
-+
-+ tracing_generic_entry_update(entry, 0, 0);
-+ entry->type = TRACE_PRINT;
-+ memcpy(entry + 1, data, length);
-+
-+ ring_buffer_unlock_commit(buffer, event);
-+ }
-+}
-+
-+/* general print function */
-+void kp_printf(ktap_state *ks, const char *fmt, ...)
-+{
-+ char buff[1024];
-+ va_list args;
-+ int len;
-+
-+ va_start(args, fmt);
-+ len = vscnprintf(buff, 1024, fmt, args);
-+ va_end(args);
-+
-+ buff[len] = '\0';
-+ kp_transport_write(ks, buff, len + 1);
-+}
-+
-+void __kp_puts(ktap_state *ks, const char *str)
-+{
-+ kp_transport_write(ks, str, strlen(str) + 1);
-+}
-+
-+void __kp_bputs(ktap_state *ks, const char *str)
-+{
-+ struct ring_buffer *buffer = G(ks)->buffer;
-+ struct ring_buffer_event *event;
-+ struct trace_entry *entry;
-+ int size;
-+
-+ size = sizeof(struct trace_entry) + sizeof(unsigned long *);
-+
-+ event = ring_buffer_lock_reserve(buffer, size);
-+ if (!event) {
-+ KTAP_STATS(ks)->events_missed += 1;
-+ return;
-+ } else {
-+ entry = ring_buffer_event_data(event);
-+
-+ tracing_generic_entry_update(entry, 0, 0);
-+ entry->type = TRACE_BPUTS;
-+ *(unsigned long *)(entry + 1) = (unsigned long)str;
-+
-+ ring_buffer_unlock_commit(buffer, event);
-+ }
-+}
-+
-+void kp_transport_exit(ktap_state *ks)
-+{
-+ ring_buffer_free(G(ks)->buffer);
-+ debugfs_remove(G(ks)->trace_pipe_dentry);
-+}
-+
-+#define TRACE_BUF_SIZE_DEFAULT 1441792UL /* 16384 * 88 (sizeof(entry)) */
-+
-+int kp_transport_init(ktap_state *ks, struct dentry *dir)
-+{
-+ struct ring_buffer *buffer;
-+ struct dentry *dentry;
-+ char filename[32] = {0};
-+
-+ ftrace_find_event = (void *)kallsyms_lookup_name("ftrace_find_event");
-+ if (!ftrace_find_event) {
-+ printk("ktap: cannot lookup ftrace_find_event in kallsyms\n");
-+ return -EINVAL;
-+ }
-+
-+ buffer = ring_buffer_alloc(TRACE_BUF_SIZE_DEFAULT, RB_FL_OVERWRITE);
-+ if (!buffer)
-+ return -ENOMEM;
-+
-+ sprintf(filename, "trace_pipe_%d", (int)task_tgid_vnr(current));
-+
-+ dentry = debugfs_create_file(filename, 0444, dir,
-+ ks, &tracing_pipe_fops);
-+ if (!dentry) {
-+ pr_err("ktapvm: cannot create trace_pipe file in debugfs\n");
-+ ring_buffer_free(buffer);
-+ return -1;
-+ }
-+
-+ G(ks)->buffer = buffer;
-+ G(ks)->trace_pipe_dentry = dentry;
-+
-+ return 0;
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_transport.h
-@@ -0,0 +1,13 @@
-+#ifndef __KTAP_TRANSPORT_H__
-+#define __KTAP_TRANSPORT_H__
-+
-+void kp_transport_write(ktap_state *ks, const void *data, size_t length);
-+void kp_transport_event_write(ktap_state *ks, struct ktap_event *e);
-+void kp_transport_print_backtrace(ktap_state *ks, int skip, int max_entries);
-+void *kp_transport_reserve(ktap_state *ks, size_t length);
-+void kp_transport_exit(ktap_state *ks);
-+int kp_transport_init(ktap_state *ks, struct dentry *dir);
-+
-+int _trace_seq_puts(struct trace_seq *s, const char *str);
-+
-+#endif /* __KTAP_TRANSPORT_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_vm.c
-@@ -0,0 +1,1496 @@
-+/*
-+ * kp_vm.c - ktap script virtual machine in Linux kernel
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License 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/slab.h>
-+#include <linux/ftrace_event.h>
-+#include <linux/signal.h>
-+#include <linux/sched.h>
-+#include <linux/uaccess.h>
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_opcodes.h"
-+#include "../include/ktap_ffi.h"
-+#include "ktap.h"
-+#include "kp_obj.h"
-+#include "kp_str.h"
-+#include "kp_tab.h"
-+#include "kp_transport.h"
-+#include "kp_vm.h"
-+
-+#define KTAP_MIN_RESERVED_STACK_SIZE 20
-+#define KTAP_STACK_SIZE 120 /* enlarge this value for big stack */
-+#define KTAP_STACK_SIZE_BYTES (KTAP_STACK_SIZE * sizeof(ktap_value))
-+
-+#define CIST_KTAP (1 << 0) /* call is running a ktap function */
-+#define CIST_REENTRY (1 << 2)
-+
-+#define isktapfunc(ci) ((ci)->callstatus & CIST_KTAP)
-+
-+
-+/* common helper function */
-+int gettimeofday_us(void)
-+{
-+ struct timeval tv;
-+
-+ do_gettimeofday(&tv);
-+ return tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
-+}
-+
-+
-+static void ktap_concat(ktap_state *ks, int start, int end)
-+{
-+ int i, len = 0;
-+ StkId top = ks->ci->u.l.base;
-+ ktap_string *ts;
-+ char *ptr, *buffer;
-+
-+ for (i = start; i <= end; i++) {
-+ if (!is_string(top + i)) {
-+ kp_error(ks, "cannot concat non-string\n");
-+ set_nil(top + start);
-+ return;
-+ }
-+
-+ len += rawtsvalue(top + i)->tsv.len;
-+ }
-+
-+ if (len >= KTAP_PERCPU_BUFFER_SIZE) {
-+ kp_error(ks, "Error: too long string concatenation\n");
-+ return;
-+ }
-+
-+ preempt_disable_notrace();
-+
-+ buffer = kp_percpu_data(ks, KTAP_PERCPU_DATA_BUFFER);
-+ ptr = buffer;
-+
-+ for (i = start; i <= end; i++) {
-+ int len = rawtsvalue(top + i)->tsv.len;
-+ strncpy(ptr, svalue(top + i), len);
-+ ptr += len;
-+ }
-+ ts = kp_tstring_newlstr(ks, buffer, len);
-+ set_string(top + start, ts);
-+
-+ preempt_enable_notrace();
-+}
-+
-+/* todo: compare l == r if both is tstring type? */
-+static int lessthan(ktap_state *ks, const ktap_value *l, const ktap_value *r)
-+{
-+ if (is_number(l) && is_number(r))
-+ return NUMLT(nvalue(l), nvalue(r));
-+ else if (is_string(l) && is_string(r))
-+ return kp_tstring_cmp(rawtsvalue(l), rawtsvalue(r)) < 0;
-+
-+ return 0;
-+}
-+
-+static int lessequal(ktap_state *ks, const ktap_value *l, const ktap_value *r)
-+{
-+ if (is_number(l) && is_number(r))
-+ return NUMLE(nvalue(l), nvalue(r));
-+ else if (is_string(l) && is_string(r))
-+ return kp_tstring_cmp(rawtsvalue(l), rawtsvalue(r)) <= 0;
-+
-+ return 0;
-+}
-+
-+static int fb2int (int x)
-+{
-+ int e = (x >> 3) & 0x1f;
-+ if (e == 0)
-+ return x;
-+ else
-+ return ((x & 7) + 8) << (e - 1);
-+}
-+
-+static const ktap_value *ktap_tonumber(const ktap_value *obj, ktap_value *n)
-+{
-+ if (is_number(obj))
-+ return obj;
-+
-+ return NULL;
-+}
-+
-+static ktap_upval *findupval(ktap_state *ks, StkId level)
-+{
-+ ktap_global_state *g = G(ks);
-+ ktap_gcobject **pp = &ks->openupval;
-+ ktap_upval *p;
-+ ktap_upval *uv;
-+
-+ while (*pp != NULL && (p = gco2uv(*pp))->v >= level) {
-+ if (p->v == level) { /* found a corresponding upvalue? */
-+ return p;
-+ }
-+ pp = &p->next;
-+ }
-+
-+ /* not found: create a new one */
-+ uv = &kp_newobject(ks, KTAP_TUPVAL, sizeof(ktap_upval), pp)->uv;
-+ uv->v = level; /* current value lives in the stack */
-+ uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */
-+ uv->u.l.next = g->uvhead.u.l.next;
-+ uv->u.l.next->u.l.prev = uv;
-+ g->uvhead.u.l.next = uv;
-+ return uv;
-+}
-+
-+/* todo: implement this*/
-+static void function_close (ktap_state *ks, StkId level)
-+{
-+}
-+
-+/* create a new closure */
-+static void pushclosure(ktap_state *ks, ktap_proto *p, ktap_upval **encup,
-+ StkId base, StkId ra)
-+{
-+ int nup = p->sizeupvalues;
-+ ktap_upvaldesc *uv = p->upvalues;
-+ int i;
-+ ktap_closure *ncl = kp_newclosure(ks, nup);
-+
-+ ncl->p = p;
-+ set_closure(ra, ncl); /* anchor new closure in stack */
-+
-+ /* fill in its upvalues */
-+ for (i = 0; i < nup; i++) {
-+ if (uv[i].instack) {
-+ /* upvalue refers to local variable? */
-+ ncl->upvals[i] = findupval(ks, base + uv[i].idx);
-+ } else {
-+ /* get upvalue from enclosing function */
-+ ncl->upvals[i] = encup[uv[i].idx];
-+ }
-+ }
-+ //p->cache = ncl; /* save it on cache for reuse */
-+}
-+
-+static void gettable(ktap_state *ks, const ktap_value *t, ktap_value *key,
-+ StkId val)
-+{
-+ if (is_table(t)) {
-+ set_obj(val, kp_tab_get(hvalue(t), key));
-+ } else if (is_ptable(t)) {
-+ kp_ptab_get(ks, phvalue(t), key, val);
-+ } else {
-+ kp_error(ks, "get key from non-table\n");
-+ }
-+}
-+
-+static void settable(ktap_state *ks, const ktap_value *t, ktap_value *key,
-+ StkId val)
-+{
-+ if (is_table(t)) {
-+ kp_tab_setvalue(ks, hvalue(t), key, val);
-+ } else if (is_ptable(t)) {
-+ kp_ptab_set(ks, phvalue(t), key, val);
-+ } else {
-+ kp_error(ks, "set key to non-table\n");
-+ }
-+}
-+
-+static void settable_incr(ktap_state *ks, const ktap_value *t, ktap_value *key,
-+ StkId val)
-+{
-+ if (unlikely(!is_table(t))) {
-+ kp_error(ks, "use += operator for non-table\n");
-+ return;
-+ }
-+
-+ if (unlikely(!is_number(val))) {
-+ kp_error(ks, "use non-number to += operator\n");
-+ return;
-+ }
-+
-+ kp_tab_atomic_inc(ks, hvalue(t), key, nvalue(val));
-+}
-+
-+static inline int checkstack(ktap_state *ks, int n)
-+{
-+ if (unlikely(ks->stack_last - ks->top <= n)) {
-+ kp_error(ks, "stack overflow, please enlarge stack size\n");
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static StkId adjust_varargs(ktap_state *ks, ktap_proto *p, int actual)
-+{
-+ int i;
-+ int nfixargs = p->numparams;
-+ StkId base, fixed;
-+
-+ /* move fixed parameters to final position */
-+ fixed = ks->top - actual; /* first fixed argument */
-+ base = ks->top; /* final position of first argument */
-+
-+ for (i=0; i < nfixargs; i++) {
-+ set_obj(ks->top++, fixed + i);
-+ set_nil(fixed + i);
-+ }
-+
-+ return base;
-+}
-+
-+static int poscall(ktap_state *ks, StkId first_result)
-+{
-+ ktap_callinfo *ci;
-+ StkId res;
-+ int wanted, i;
-+
-+ ci = ks->ci;
-+
-+ res = ci->func;
-+ wanted = ci->nresults;
-+
-+ ks->ci = ci = ci->prev;
-+
-+ for (i = wanted; i != 0 && first_result < ks->top; i--)
-+ set_obj(res++, first_result++);
-+
-+ while(i-- > 0)
-+ set_nil(res++);
-+
-+ ks->top = res;
-+
-+ return (wanted - (-1));
-+}
-+
-+static ktap_callinfo *extend_ci(ktap_state *ks)
-+{
-+ ktap_callinfo *ci;
-+
-+ ci = kp_malloc(ks, sizeof(ktap_callinfo));
-+ ks->ci->next = ci;
-+ ci->prev = ks->ci;
-+ ci->next = NULL;
-+
-+ return ci;
-+}
-+
-+static void free_ci(ktap_state *ks)
-+{
-+ ktap_callinfo *ci = ks->ci;
-+ ktap_callinfo *next;
-+
-+ if (!ci)
-+ return;
-+
-+ next = ci->next;
-+ ci->next = NULL;
-+ while ((ci = next) != NULL) {
-+ next = ci->next;
-+ kp_free(ks, ci);
-+ }
-+}
-+
-+#define next_ci(ks) (ks->ci = ks->ci->next ? ks->ci->next : extend_ci(ks))
-+#define savestack(ks, p) ((char *)(p) - (char *)ks->stack)
-+#define restorestack(ks, n) ((ktap_value *)((char *)ks->stack + (n)))
-+
-+static int precall(ktap_state *ks, StkId func, int nresults)
-+{
-+ ktap_cfunction f;
-+ ktap_callinfo *ci;
-+ ktap_proto *p;
-+#ifdef CONFIG_KTAP_FFI
-+ ktap_cdata *cd;
-+ csymbol *cs;
-+#endif
-+ StkId base;
-+ ptrdiff_t funcr = savestack(ks, func);
-+ int n;
-+
-+ switch (ttype(func)) {
-+ case KTAP_TCFUNCTION: /* light C function */
-+ f = fvalue(func);
-+
-+ if (checkstack(ks, KTAP_MIN_RESERVED_STACK_SIZE))
-+ return 1;
-+
-+ ci = next_ci(ks);
-+ ci->nresults = nresults;
-+ ci->func = restorestack(ks, funcr);
-+ ci->top = ks->top + KTAP_MIN_RESERVED_STACK_SIZE;
-+ ci->callstatus = 0;
-+ n = (*f)(ks);
-+ poscall(ks, ks->top - n);
-+ return 1;
-+ case KTAP_TCLOSURE:
-+ p = clvalue(func)->p;
-+
-+ if (checkstack(ks, p->maxstacksize))
-+ return 1;
-+
-+ func = restorestack(ks, funcr);
-+ n = (int)(ks->top - func) - 1; /* number of real arguments */
-+
-+ /* complete missing arguments */
-+ for (; n < p->numparams; n++)
-+ set_nil(ks->top++);
-+
-+ base = (!p->is_vararg) ? func + 1 : adjust_varargs(ks, p, n);
-+ ci = next_ci(ks);
-+ ci->nresults = nresults;
-+ ci->func = func;
-+ ci->u.l.base = base;
-+ ci->top = base + p->maxstacksize;
-+ ci->u.l.savedpc = p->code; /* starting point */
-+ ci->callstatus = CIST_KTAP;
-+ ks->top = ci->top;
-+ return 0;
-+#ifdef CONFIG_KTAP_FFI
-+ case KTAP_TCDATA:
-+ cd = cdvalue(func);
-+
-+ if (checkstack(ks, KTAP_MIN_RESERVED_STACK_SIZE))
-+ return 1;
-+
-+ if (cd_type(ks, cd) != FFI_FUNC)
-+ kp_error(ks, "Value in cdata is not a c funcion\n");
-+ cs = cd_csym(ks, cd);
-+ kp_verbose_printf(ks, "calling ffi function [%s] with address %p\n",
-+ csym_name(cs), csym_func_addr(cs));
-+
-+ ci = next_ci(ks);
-+ ci->nresults = nresults;
-+ ci->func = restorestack(ks, funcr);
-+ ci->top = ks->top + KTAP_MIN_RESERVED_STACK_SIZE;
-+ ci->callstatus = 0;
-+
-+ n = kp_ffi_call(ks, csym_func(cs));
-+ kp_verbose_printf(ks, "returned from ffi call...\n");
-+ poscall(ks, ks->top - n);
-+ return 1;
-+#endif
-+ default:
-+ kp_error(ks, "attempt to call nil function\n");
-+ }
-+
-+ return 0;
-+}
-+
-+#define RA(i) (base+GETARG_A(i))
-+#define RB(i) (base+GETARG_B(i))
-+#define ISK(x) ((x) & BITRK)
-+#define RC(i) base+GETARG_C(i)
-+#define RKB(i) \
-+ ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)
-+#define RKC(i) \
-+ ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)
-+
-+#define dojump(ci,i,e) { \
-+ ci->u.l.savedpc += GETARG_sBx(i) + e; }
-+#define donextjump(ci) { instr = *ci->u.l.savedpc; dojump(ci, instr, 1); }
-+
-+#define arith_op(ks, op) { \
-+ ktap_value *rb = RKB(instr); \
-+ ktap_value *rc = RKC(instr); \
-+ if (is_number(rb) && is_number(rc)) { \
-+ ktap_number nb = nvalue(rb), nc = nvalue(rc); \
-+ set_number(ra, op(nb, nc)); \
-+ } else { \
-+ kp_puts(ks, "Error: Cannot make arith operation\n"); \
-+ return; \
-+ } }
-+
-+static ktap_value *cfunction_cache_get(ktap_state *ks, int index);
-+
-+static void ktap_execute(ktap_state *ks)
-+{
-+ int exec_count = 0;
-+ ktap_callinfo *ci;
-+ ktap_closure *cl;
-+ ktap_value *k;
-+ unsigned int instr, opcode;
-+ StkId base; /* stack pointer */
-+ StkId ra; /* register pointer */
-+ int res, nresults; /* temp varible */
-+
-+ ci = ks->ci;
-+
-+ newframe:
-+ cl = clvalue(ci->func);
-+ k = cl->p->k;
-+ base = ci->u.l.base;
-+
-+ mainloop:
-+ /* main loop of interpreter */
-+
-+ /* dead loop detaction */
-+ if (exec_count++ == kp_max_exec_count) {
-+ if (G(ks)->mainthread != ks) {
-+ kp_error(ks, "non-mainthread executed instructions "
-+ "exceed max limit(%d)\n",
-+ kp_max_exec_count);
-+ return;
-+ }
-+
-+ cond_resched();
-+ if (signal_pending(current)) {
-+ flush_signals(current);
-+ return;
-+ }
-+ exec_count = 0;
-+ }
-+
-+ instr = *(ci->u.l.savedpc++);
-+ opcode = GET_OPCODE(instr);
-+
-+ /* ra is target register */
-+ ra = RA(instr);
-+
-+ switch (opcode) {
-+ case OP_MOVE:
-+ set_obj(ra, base + GETARG_B(instr));
-+ break;
-+ case OP_LOADK:
-+ set_obj(ra, k + GETARG_Bx(instr));
-+ break;
-+ case OP_LOADKX:
-+ set_obj(ra, k + GETARG_Ax(*ci->u.l.savedpc++));
-+ break;
-+ case OP_LOADBOOL:
-+ set_boolean(ra, GETARG_B(instr));
-+ if (GETARG_C(instr))
-+ ci->u.l.savedpc++;
-+ break;
-+ case OP_LOADNIL: {
-+ int b = GETARG_B(instr);
-+ do {
-+ set_nil(ra++);
-+ } while (b--);
-+ break;
-+ }
-+ case OP_GETUPVAL: {
-+ int b = GETARG_B(instr);
-+ set_obj(ra, cl->upvals[b]->v);
-+ break;
-+ }
-+ case OP_GETTABUP: {
-+ int b = GETARG_B(instr);
-+ gettable(ks, cl->upvals[b]->v, RKC(instr), ra);
-+ base = ci->u.l.base;
-+ break;
-+ }
-+ case OP_GETTABLE:
-+ gettable(ks, RB(instr), RKC(instr), ra);
-+ base = ci->u.l.base;
-+ break;
-+ case OP_SETTABUP: {
-+ int a = GETARG_A(instr);
-+ settable(ks, cl->upvals[a]->v, RKB(instr), RKC(instr));
-+ base = ci->u.l.base;
-+ break;
-+ }
-+ case OP_SETTABUP_INCR: {
-+ int a = GETARG_A(instr);
-+ settable_incr(ks, cl->upvals[a]->v, RKB(instr), RKC(instr));
-+ base = ci->u.l.base;
-+ break;
-+ }
-+ case OP_SETTABUP_AGGR: {
-+ int a = GETARG_A(instr);
-+ ktap_value *v = cl->upvals[a]->v;
-+ if (!is_ptable(v)) {
-+ kp_error(ks, "<<< must be operate on ptable\n");
-+ return;
-+ }
-+
-+ kp_ptab_set(ks, phvalue(v), RKB(instr), RKC(instr));
-+ base = ci->u.l.base;
-+ break;
-+ }
-+ case OP_SETUPVAL: {
-+ ktap_upval *uv = cl->upvals[GETARG_B(instr)];
-+ set_obj(uv->v, ra);
-+ break;
-+ }
-+ case OP_SETTABLE:
-+ settable(ks, ra, RKB(instr), RKC(instr));
-+ base = ci->u.l.base;
-+ break;
-+ case OP_SETTABLE_INCR:
-+ settable_incr(ks, ra, RKB(instr), RKC(instr));
-+ base = ci->u.l.base;
-+ break;
-+ case OP_SETTABLE_AGGR:
-+ if (!is_ptable(ra)) {
-+ kp_error(ks, "<<< must be operate on ptable\n");
-+ return;
-+ }
-+
-+ kp_ptab_set(ks, phvalue(ra), RKB(instr), RKC(instr));
-+ base = ci->u.l.base;
-+ break;
-+ case OP_NEWTABLE: {
-+ int b = GETARG_B(instr);
-+ int c = GETARG_C(instr);
-+ ktap_tab *t = kp_tab_new(ks);
-+ set_table(ra, t);
-+ if (b != 0 || c != 0)
-+ kp_tab_resize(ks, t, fb2int(b), fb2int(c));
-+ break;
-+ }
-+ case OP_SELF: {
-+ StkId rb = RB(instr);
-+ set_obj(ra+1, rb);
-+ gettable(ks, rb, RKC(instr), ra);
-+ base = ci->u.l.base;
-+ break;
-+ }
-+ case OP_ADD:
-+ arith_op(ks, NUMADD);
-+ break;
-+ case OP_SUB:
-+ arith_op(ks, NUMSUB);
-+ break;
-+ case OP_MUL:
-+ arith_op(ks, NUMMUL);
-+ break;
-+ case OP_DIV:
-+ /* divide 0 checking */
-+ if (!nvalue(RKC(instr))) {
-+ kp_error(ks, "divide 0 arith operation\n");
-+ return;
-+ }
-+ arith_op(ks, NUMDIV);
-+ break;
-+ case OP_MOD:
-+ /* divide 0 checking */
-+ if (!nvalue(RKC(instr))) {
-+ kp_error(ks, "mod 0 arith operation\n");
-+ return;
-+ }
-+ arith_op(ks, NUMMOD);
-+ break;
-+ case OP_POW:
-+ kp_error(ks, "ktap don't support pow arith in kernel\n");
-+ return;
-+ case OP_UNM: {
-+ ktap_value *rb = RB(instr);
-+ if (is_number(rb)) {
-+ ktap_number nb = nvalue(rb);
-+ set_number(ra, NUMUNM(nb));
-+ }
-+ break;
-+ }
-+ case OP_NOT:
-+ res = is_false(RB(instr));
-+ set_boolean(ra, res);
-+ break;
-+ case OP_LEN: {
-+ int len = kp_objlen(ks, RB(instr));
-+ if (len < 0)
-+ return;
-+ set_number(ra, len);
-+ break;
-+ }
-+ case OP_CONCAT: {
-+ int b = GETARG_B(instr);
-+ int c = GETARG_C(instr);
-+ ktap_concat(ks, b, c);
-+ break;
-+ }
-+ case OP_JMP:
-+ dojump(ci, instr, 0);
-+ break;
-+ case OP_EQ: {
-+ ktap_value *rb = RKB(instr);
-+ ktap_value *rc = RKC(instr);
-+ if ((int)rawequalobj(rb, rc) != GETARG_A(instr))
-+ ci->u.l.savedpc++;
-+ else
-+ donextjump(ci);
-+
-+ base = ci->u.l.base;
-+ break;
-+ }
-+ case OP_LT: {
-+ if (lessthan(ks, RKB(instr), RKC(instr)) != GETARG_A(instr)) {
-+ ci->u.l.savedpc++;
-+ } else
-+ donextjump(ci);
-+ base = ci->u.l.base;
-+ break;
-+ }
-+ case OP_LE:
-+ if (lessequal(ks, RKB(instr), RKC(instr)) != GETARG_A(instr))
-+ ci->u.l.savedpc++;
-+ else
-+ donextjump(ci);
-+ base = ci->u.l.base;
-+ break;
-+ case OP_TEST:
-+ if (GETARG_C(instr) ? is_false(ra) : !is_false(ra))
-+ ci->u.l.savedpc++;
-+ else
-+ donextjump(ci);
-+ break;
-+ case OP_TESTSET: {
-+ ktap_value *rb = RB(instr);
-+ if (GETARG_C(instr) ? is_false(rb) : !is_false(rb))
-+ ci->u.l.savedpc++;
-+ else {
-+ set_obj(ra, rb);
-+ donextjump(ci);
-+ }
-+ break;
-+ }
-+ case OP_CALL: {
-+ int b = GETARG_B(instr);
-+ int ret;
-+
-+ nresults = GETARG_C(instr) - 1;
-+
-+ if (b != 0)
-+ ks->top = ra + b;
-+
-+ ret = precall(ks, ra, nresults);
-+ if (ret) { /* C function */
-+ if (nresults >= 0)
-+ ks->top = ci->top;
-+ base = ci->u.l.base;
-+ break;
-+ } else { /* ktap function */
-+ ci = ks->ci;
-+ /* this flag is used for return time, see OP_RETURN */
-+ ci->callstatus |= CIST_REENTRY;
-+ goto newframe;
-+ }
-+ break;
-+ }
-+ case OP_TAILCALL: {
-+ int b = GETARG_B(instr);
-+
-+ if (b != 0)
-+ ks->top = ra+b;
-+ if (precall(ks, ra, -1)) /* C function? */
-+ base = ci->u.l.base;
-+ else {
-+ int aux;
-+
-+ /*
-+ * tail call: put called frame (n) in place of
-+ * caller one (o)
-+ */
-+ ktap_callinfo *nci = ks->ci; /* called frame */
-+ ktap_callinfo *oci = nci->prev; /* caller frame */
-+ StkId nfunc = nci->func; /* called function */
-+ StkId ofunc = oci->func; /* caller function */
-+ /* last stack slot filled by 'precall' */
-+ StkId lim = nci->u.l.base +
-+ clvalue(nfunc)->p->numparams;
-+
-+ /* close all upvalues from previous call */
-+ if (cl->p->sizep > 0)
-+ function_close(ks, oci->u.l.base);
-+
-+ /* move new frame into old one */
-+ for (aux = 0; nfunc + aux < lim; aux++)
-+ set_obj(ofunc + aux, nfunc + aux);
-+ /* correct base */
-+ oci->u.l.base = ofunc + (nci->u.l.base - nfunc);
-+ /* correct top */
-+ oci->top = ks->top = ofunc + (ks->top - nfunc);
-+ oci->u.l.savedpc = nci->u.l.savedpc;
-+ /* remove new frame */
-+ ci = ks->ci = oci;
-+ /* restart ktap_execute over new ktap function */
-+ goto newframe;
-+ }
-+ break;
-+ }
-+ case OP_RETURN: {
-+ int b = GETARG_B(instr);
-+ if (b != 0)
-+ ks->top = ra+b-1;
-+ if (cl->p->sizep > 0)
-+ function_close(ks, base);
-+ b = poscall(ks, ra);
-+
-+ /* if it's called from external invocation, just return */
-+ if (!(ci->callstatus & CIST_REENTRY))
-+ return;
-+
-+ ci = ks->ci;
-+ if (b)
-+ ks->top = ci->top;
-+ goto newframe;
-+ }
-+ case OP_FORLOOP: {
-+ ktap_number step = nvalue(ra+2);
-+ /* increment index */
-+ ktap_number idx = NUMADD(nvalue(ra), step);
-+ ktap_number limit = nvalue(ra+1);
-+ if (NUMLT(0, step) ? NUMLE(idx, limit) : NUMLE(limit, idx)) {
-+ ci->u.l.savedpc += GETARG_sBx(instr); /* jump back */
-+ set_number(ra, idx); /* update internal index... */
-+ set_number(ra+3, idx); /* ...and external index */
-+ }
-+ break;
-+ }
-+ case OP_FORPREP: {
-+ const ktap_value *init = ra;
-+ const ktap_value *plimit = ra + 1;
-+ const ktap_value *pstep = ra + 2;
-+
-+ if (!ktap_tonumber(init, ra)) {
-+ kp_error(ks, KTAP_QL("for")
-+ " initial value must be a number\n");
-+ return;
-+ } else if (!ktap_tonumber(plimit, ra + 1)) {
-+ kp_error(ks, KTAP_QL("for")
-+ " limit must be a number\n");
-+ return;
-+ } else if (!ktap_tonumber(pstep, ra + 2)) {
-+ kp_error(ks, KTAP_QL("for") " step must be a number\n");
-+ return;
-+ }
-+
-+ set_number(ra, NUMSUB(nvalue(ra), nvalue(pstep)));
-+ ci->u.l.savedpc += GETARG_sBx(instr);
-+ break;
-+ }
-+ case OP_TFORCALL: {
-+ StkId cb = ra + 3; /* call base */
-+ set_obj(cb + 2, ra + 2);
-+ set_obj(cb + 1, ra + 1);
-+ set_obj(cb, ra);
-+ ks->top = cb + 3; /* func. + 2 args (state and index) */
-+ kp_call(ks, cb, GETARG_C(instr));
-+ base = ci->u.l.base;
-+ ks->top = ci->top;
-+ instr = *(ci->u.l.savedpc++); /* go to next instruction */
-+ ra = RA(instr);
-+ }
-+ /*go through */
-+ case OP_TFORLOOP:
-+ if (!is_nil(ra + 1)) { /* continue loop? */
-+ set_obj(ra, ra + 1); /* save control variable */
-+ ci->u.l.savedpc += GETARG_sBx(instr); /* jump back */
-+ }
-+ break;
-+ case OP_SETLIST: {
-+ int n = GETARG_B(instr);
-+ int c = GETARG_C(instr);
-+ int last;
-+ ktap_tab *h;
-+
-+ if (n == 0)
-+ n = (int)(ks->top - ra) - 1;
-+ if (c == 0)
-+ c = GETARG_Ax(*ci->u.l.savedpc++);
-+
-+ h = hvalue(ra);
-+ last = ((c - 1) * LFIELDS_PER_FLUSH) + n;
-+ if (last > h->sizearray) /* needs more space? */
-+ kp_tab_resizearray(ks, h, last);
-+
-+ for (; n > 0; n--) {
-+ ktap_value *val = ra+n;
-+ kp_tab_setint(ks, h, last--, val);
-+ }
-+ /* correct top (in case of previous open call) */
-+ ks->top = ci->top;
-+ break;
-+ }
-+ case OP_CLOSURE: {
-+ /* need to use closure cache? (multithread contention issue)*/
-+ ktap_proto *p = cl->p->p[GETARG_Bx(instr)];
-+ pushclosure(ks, p, cl->upvals, base, ra);
-+ break;
-+ }
-+ case OP_VARARG: {
-+ int b = GETARG_B(instr) - 1;
-+ int j;
-+ int n = (int)(base - ci->func) - cl->p->numparams - 1;
-+ if (b < 0) { /* B == 0? */
-+ b = n; /* get all var. arguments */
-+ if(checkstack(ks, n))
-+ return;
-+ /* previous call may change the stack */
-+ ra = RA(instr);
-+ ks->top = ra + n;
-+ }
-+ for (j = 0; j < b; j++) {
-+ if (j < n) {
-+ set_obj(ra + j, base - n + j);
-+ } else
-+ set_nil(ra + j);
-+ }
-+ break;
-+ }
-+ case OP_EXTRAARG:
-+ return;
-+
-+ case OP_EVENT: {
-+ struct ktap_event *e = ks->current_event;
-+
-+ if (unlikely(!e)) {
-+ kp_error(ks, "invalid event context\n");
-+ return;
-+ }
-+ set_event(ra, e);
-+ break;
-+ }
-+
-+ case OP_EVENTNAME: {
-+ struct ktap_event *e = ks->current_event;
-+
-+ if (unlikely(!e)) {
-+ kp_error(ks, "invalid event context\n");
-+ return;
-+ }
-+ set_string(ra, kp_tstring_new(ks, e->call->name));
-+ break;
-+ }
-+ case OP_EVENTARG:
-+ if (unlikely(!ks->current_event)) {
-+ kp_error(ks, "invalid event context\n");
-+ return;
-+ }
-+
-+ kp_event_getarg(ks, ra, GETARG_B(instr));
-+ break;
-+ case OP_LOAD_GLOBAL: {
-+ ktap_value *cfunc = cfunction_cache_get(ks, GETARG_C(instr));
-+ set_obj(ra, cfunc);
-+ }
-+ break;
-+
-+ case OP_EXIT:
-+ return;
-+ }
-+
-+ goto mainloop;
-+}
-+
-+void kp_call(ktap_state *ks, StkId func, int nresults)
-+{
-+ if (!precall(ks, func, nresults))
-+ ktap_execute(ks);
-+}
-+
-+static int cfunction_cache_getindex(ktap_state *ks, ktap_value *fname);
-+
-+/*
-+ * This function must be called before all code loaded.
-+ */
-+void kp_optimize_code(ktap_state *ks, int level, ktap_proto *f)
-+{
-+ int i;
-+
-+ for (i = 0; i < f->sizecode; i++) {
-+ int instr = f->code[i];
-+ ktap_value *k = f->k;
-+
-+ if (GET_OPCODE(instr) == OP_GETTABUP) {
-+ if ((GETARG_B(instr) == 0) && ISK(GETARG_C(instr))) {
-+ ktap_value *field = k + INDEXK(GETARG_C(instr));
-+ if (ttype(field) == KTAP_TSTRING) {
-+ int index = cfunction_cache_getindex(ks,
-+ field);
-+ if (index == -1)
-+ break;
-+
-+ SET_OPCODE(instr, OP_LOAD_GLOBAL);
-+ SETARG_C(instr, index);
-+ f->code[i] = instr;
-+ break;
-+ }
-+ }
-+ }
-+ }
-+
-+ /* continue optimize sub functions */
-+ for (i = 0; i < f->sizep; i++)
-+ kp_optimize_code(ks, level + 1, f->p[i]);
-+}
-+
-+static ktap_value *cfunction_cache_get(ktap_state *ks, int index)
-+{
-+ return &G(ks)->cfunction_tbl[index];
-+}
-+
-+static int cfunction_cache_getindex(ktap_state *ks, ktap_value *fname)
-+{
-+ const ktap_value *gt = kp_tab_getint(hvalue(&G(ks)->registry),
-+ KTAP_RIDX_GLOBALS);
-+ const ktap_value *cfunc;
-+ int nr, i;
-+
-+ nr = G(ks)->nr_builtin_cfunction;
-+ cfunc = kp_tab_get(hvalue(gt), fname);
-+
-+ for (i = 0; i < nr; i++) {
-+ if (rawequalobj(&G(ks)->cfunction_tbl[i], cfunc))
-+ return i;
-+ }
-+
-+ return -1;
-+}
-+
-+static void cfunction_cache_add(ktap_state *ks, ktap_value *func)
-+{
-+ int nr = G(ks)->nr_builtin_cfunction;
-+ set_obj(&G(ks)->cfunction_tbl[nr], func);
-+ G(ks)->nr_builtin_cfunction++;
-+}
-+
-+static void cfunction_cache_exit(ktap_state *ks)
-+{
-+ kp_free(ks, G(ks)->cfunction_tbl);
-+}
-+
-+static int cfunction_cache_init(ktap_state *ks)
-+{
-+ G(ks)->cfunction_tbl = kp_zalloc(ks, sizeof(ktap_value) * 128);
-+ if (!G(ks)->cfunction_tbl)
-+ return -ENOMEM;
-+
-+ return 0;
-+}
-+
-+/* function for register library */
-+void kp_register_lib(ktap_state *ks, const char *libname, const ktap_Reg *funcs)
-+{
-+ int i;
-+ ktap_tab *target_tbl;
-+ const ktap_value *gt = kp_tab_getint(hvalue(&G(ks)->registry),
-+ KTAP_RIDX_GLOBALS);
-+
-+ /* lib is null when register baselib function */
-+ if (libname == NULL)
-+ target_tbl = hvalue(gt);
-+ else {
-+ ktap_value key, val;
-+
-+ target_tbl = kp_tab_new(ks);
-+ kp_tab_resize(ks, target_tbl, 0,
-+ sizeof(*funcs) / sizeof(ktap_Reg));
-+
-+ set_string(&key, kp_tstring_new(ks, libname));
-+ set_table(&val, target_tbl);
-+ kp_tab_setvalue(ks, hvalue(gt), &key, &val);
-+ }
-+
-+ for (i = 0; funcs[i].name != NULL; i++) {
-+ ktap_value func_name, cl;
-+
-+ set_string(&func_name, kp_tstring_new(ks, funcs[i].name));
-+ set_cfunction(&cl, funcs[i].func);
-+ kp_tab_setvalue(ks, target_tbl, &func_name, &cl);
-+
-+ cfunction_cache_add(ks, &cl);
-+ }
-+}
-+
-+static void kp_init_registry(ktap_state *ks)
-+{
-+ ktap_value mt;
-+ ktap_tab *registry = kp_tab_new(ks);
-+
-+ set_table(&G(ks)->registry, registry);
-+ kp_tab_resize(ks, registry, KTAP_RIDX_LAST, 0);
-+ set_thread(&mt, ks);
-+ kp_tab_setint(ks, registry, KTAP_RIDX_MAINTHREAD, &mt);
-+ set_table(&mt, kp_tab_new(ks));
-+ kp_tab_setint(ks, registry, KTAP_RIDX_GLOBALS, &mt);
-+}
-+
-+static int kp_init_arguments(ktap_state *ks, int argc, char __user **user_argv)
-+{
-+ const ktap_value *gt = kp_tab_getint(hvalue(&G(ks)->registry),
-+ KTAP_RIDX_GLOBALS);
-+ ktap_tab *global_tbl = hvalue(gt);
-+ ktap_tab *arg_tbl = kp_tab_new(ks);
-+ ktap_value arg_tblval;
-+ ktap_value arg_tsval;
-+ char **argv;
-+ int i, ret;
-+
-+ set_string(&arg_tsval, kp_tstring_new(ks, "arg"));
-+ set_table(&arg_tblval, arg_tbl);
-+ kp_tab_setvalue(ks, global_tbl, &arg_tsval, &arg_tblval);
-+
-+ if (!argc)
-+ return 0;
-+
-+ if (argc > 1024)
-+ return -EINVAL;
-+
-+ argv = kzalloc(argc * sizeof(char *), GFP_KERNEL);
-+ if (!argv)
-+ return -ENOMEM;
-+
-+ ret = copy_from_user(argv, user_argv, argc * sizeof(char *));
-+ if (ret < 0) {
-+ kfree(argv);
-+ return -EFAULT;
-+ }
-+
-+ kp_tab_resize(ks, arg_tbl, argc, 1);
-+
-+ ret = 0;
-+ for (i = 0; i < argc; i++) {
-+ ktap_value val;
-+ char __user *ustr = argv[i];
-+ char *kstr;
-+ int len;
-+ int res;
-+
-+ len = strlen_user(ustr);
-+ if (len > 0x1000) {
-+ ret = -EINVAL;
-+ break;
-+ }
-+
-+ kstr = kmalloc(len + 1, GFP_KERNEL);
-+ if (!kstr) {
-+ ret = -ENOMEM;
-+ break;
-+ }
-+
-+ if (strncpy_from_user(kstr, ustr, len) < 0) {
-+ ret = -EFAULT;
-+ break;
-+ }
-+
-+ kstr[len] = '\0';
-+
-+ if (!kstrtoint(kstr, 10, &res)) {
-+ set_number(&val, res);
-+ } else
-+ set_string(&val, kp_tstring_new(ks, kstr));
-+
-+ kp_tab_setint(ks, arg_tbl, i, &val);
-+
-+ kfree(kstr);
-+ }
-+
-+ kfree(argv);
-+ return ret;
-+}
-+
-+static void free_kp_percpu_data(ktap_state *ks)
-+{
-+ int i, j;
-+
-+ for (i = 0; i < KTAP_PERCPU_DATA_MAX; i++) {
-+ for (j = 0; j < PERF_NR_CONTEXTS; j++)
-+ free_percpu(G(ks)->pcpu_data[i][j]);
-+ }
-+
-+ for (j = 0; j < PERF_NR_CONTEXTS; j++)
-+ if (G(ks)->recursion_context[j])
-+ free_percpu(G(ks)->recursion_context[j]);
-+}
-+
-+static int alloc_kp_percpu_data(ktap_state *ks)
-+{
-+ int data_size[KTAP_PERCPU_DATA_MAX] = {
-+ sizeof(ktap_state), KTAP_STACK_SIZE_BYTES,
-+ KTAP_PERCPU_BUFFER_SIZE, KTAP_PERCPU_BUFFER_SIZE,
-+ sizeof(ktap_btrace) + (KTAP_MAX_STACK_ENTRIES *
-+ sizeof(unsigned long))};
-+ int i, j;
-+
-+ for (i = 0; i < KTAP_PERCPU_DATA_MAX; i++) {
-+ for (j = 0; j < PERF_NR_CONTEXTS; j++) {
-+ void __percpu *data = __alloc_percpu(data_size[i],
-+ __alignof__(char));
-+ if (!data)
-+ goto fail;
-+ G(ks)->pcpu_data[i][j] = data;
-+ }
-+ }
-+
-+ for (j = 0; j < PERF_NR_CONTEXTS; j++) {
-+ G(ks)->recursion_context[j] = alloc_percpu(int);
-+ if (!G(ks)->recursion_context[j])
-+ goto fail;
-+ }
-+
-+ return 0;
-+
-+ fail:
-+ free_kp_percpu_data(ks);
-+ return -ENOMEM;
-+}
-+
-+static void kp_init_state(ktap_state *ks)
-+{
-+ ktap_callinfo *ci;
-+
-+ /* init all stack vaule to nil */
-+ memset(ks->stack, 0, KTAP_STACK_SIZE_BYTES);
-+
-+ ks->top = ks->stack;
-+ ks->stack_last = ks->stack + KTAP_STACK_SIZE;
-+
-+ ci = &ks->baseci;
-+ ci->callstatus = 0;
-+ ci->func = ks->top;
-+ ci->top = ks->top + KTAP_MIN_RESERVED_STACK_SIZE;
-+ ks->ci = ci;
-+}
-+
-+static void free_all_ci(ktap_state *ks)
-+{
-+ int cpu, j;
-+
-+ for_each_possible_cpu(cpu) {
-+ for (j = 0; j < PERF_NR_CONTEXTS; j++) {
-+ void *pcd = G(ks)->pcpu_data[KTAP_PERCPU_DATA_STATE][j];
-+ ktap_state *ks;
-+
-+ if (!pcd)
-+ break;
-+
-+ ks = per_cpu_ptr(pcd, cpu);
-+ if (!ks)
-+ break;
-+
-+ free_ci(ks);
-+ }
-+ }
-+
-+ free_ci(ks);
-+}
-+
-+void kp_exitthread(ktap_state *ks)
-+{
-+ /* free local allocation objects, like annotate strings */
-+ kp_free_gclist(ks, ks->gclist);
-+}
-+
-+ktap_state *kp_newthread(ktap_state *mainthread)
-+{
-+ ktap_state *ks;
-+
-+ ks = kp_percpu_data(mainthread, KTAP_PERCPU_DATA_STATE);
-+ ks->stack = kp_percpu_data(mainthread, KTAP_PERCPU_DATA_STACK);
-+ G(ks) = G(mainthread);
-+ ks->gclist = NULL;
-+ kp_init_state(ks);
-+ return ks;
-+}
-+
-+/*
-+ * wait ktapio thread read all content in ring buffer.
-+ *
-+ * Here we use stupid approach to sync with ktapio thread,
-+ * note that we cannot use semaphore/completion/other sync method,
-+ * because ktapio thread could be killed by SIG_KILL in anytime, there
-+ * have no safe way to up semaphore or wake waitqueue before thread exit.
-+ *
-+ * we also cannot use waitqueue of current->signal->wait_chldexit to sync
-+ * exit, becasue mainthread and ktapio thread are in same thread group.
-+ *
-+ * Also ktap mainthread must wait ktapio thread exit, otherwise ktapio
-+ * thread will oops when access ktap structure.
-+ */
-+static void wait_user_completion(ktap_state *ks)
-+{
-+ struct task_struct *tsk = G(ks)->task;
-+ G(ks)->wait_user = 1;
-+
-+ while (1) {
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ /* sleep for 100 msecs, and try again. */
-+ schedule_timeout(HZ / 10);
-+
-+ if (get_nr_threads(tsk) == 1)
-+ break;
-+ }
-+}
-+
-+static void sleep_loop(ktap_state *ks,
-+ int (*actor)(ktap_state *ks, void *arg), void *arg)
-+{
-+ while (!ks->stop) {
-+ set_current_state(TASK_INTERRUPTIBLE);
-+ /* sleep for 100 msecs, and try again. */
-+ schedule_timeout(HZ / 10);
-+
-+ if (actor(ks, arg))
-+ return;
-+ }
-+}
-+
-+static int sl_wait_task_pause_actor(ktap_state *ks, void *arg)
-+{
-+ struct task_struct *task = (struct task_struct *)arg;
-+
-+ if (task->state)
-+ return 1;
-+ else
-+ return 0;
-+}
-+
-+static int sl_wait_task_exit_actor(ktap_state *ks, void *arg)
-+{
-+ struct task_struct *task = (struct task_struct *)arg;
-+
-+ if (signal_pending(current)) {
-+ flush_signals(current);
-+
-+ /* newline for handle CTRL+C display as ^C */
-+ kp_puts(ks, "\n");
-+ return 1;
-+ }
-+
-+ /* stop waiting if target pid is exited */
-+ if (task && task->state == TASK_DEAD)
-+ return 1;
-+
-+ return 0;
-+}
-+
-+/* kp_wait: used for mainthread waiting for exit */
-+static void kp_wait(ktap_state *ks)
-+{
-+ struct task_struct *task = G(ks)->trace_task;
-+
-+ if (G(ks)->exit)
-+ return;
-+
-+ ks->stop = 0;
-+
-+ if (G(ks)->parm->workload) {
-+ /* make sure workload is in pause state
-+ * so it won't miss the signal */
-+ sleep_loop(ks, sl_wait_task_pause_actor, task);
-+ /* tell workload process to start executing */
-+ send_sig(SIGINT, G(ks)->trace_task, 0);
-+ }
-+
-+ if (!G(ks)->parm->quiet)
-+ kp_printf(ks, "Tracing... Hit Ctrl-C to end.\n");
-+
-+ sleep_loop(ks, sl_wait_task_exit_actor, task);
-+}
-+
-+static unsigned int kp_stub_exit_instr;
-+
-+static inline void set_next_as_exit(ktap_state *ks)
-+{
-+ ktap_callinfo *ci;
-+
-+ ci = ks->ci;
-+ if (!ci)
-+ return;
-+
-+ ci->u.l.savedpc = &kp_stub_exit_instr;
-+
-+ /* See precall, ci changed to ci->prev after invoke C function */
-+ if (ci->prev) {
-+ ci = ci->prev;
-+ ci->u.l.savedpc = &kp_stub_exit_instr;
-+ }
-+}
-+
-+void kp_exit(ktap_state *ks)
-+{
-+ set_next_as_exit(ks);
-+
-+ G(ks)->mainthread->stop = 1;
-+ G(ks)->exit = 1;
-+}
-+
-+void kp_init_exit_instruction(void)
-+{
-+ SET_OPCODE(kp_stub_exit_instr, OP_EXIT);
-+}
-+
-+/*
-+ * Be careful in stats_cleanup, only can use kp_printf, since almost
-+ * all ktap resources already freed now.
-+ */
-+static void kp_stats_cleanup(ktap_state *ks)
-+{
-+ ktap_stats __percpu *stats = G(ks)->stats;
-+ int mem_allocated = 0, nr_mem_allocate = 0, nr_mem_free = 0;
-+ int events_hits = 0, events_missed = 0;
-+ int cpu;
-+
-+ for_each_possible_cpu(cpu) {
-+ ktap_stats *per_stats = per_cpu_ptr(stats, cpu);
-+ mem_allocated += per_stats->mem_allocated;
-+ nr_mem_allocate += per_stats->nr_mem_allocate;
-+ nr_mem_free += per_stats->nr_mem_free;
-+ events_hits += per_stats->events_hits;
-+ events_missed += per_stats->events_missed;
-+ }
-+
-+ kp_verbose_printf(ks, "ktap stats:\n");
-+ kp_verbose_printf(ks, "memory allocated size: %d\n", mem_allocated);
-+ kp_verbose_printf(ks, "memory allocate num: %d\n", nr_mem_allocate);
-+ kp_verbose_printf(ks, "memory free num: %d\n", nr_mem_free);
-+ kp_verbose_printf(ks, "events_hits: %d\n", events_hits);
-+ kp_verbose_printf(ks, "events_missed: %d\n", events_missed);
-+
-+ if (stats)
-+ free_percpu(stats);
-+}
-+
-+static int kp_stats_init(ktap_state *ks)
-+{
-+ ktap_stats __percpu *stats = alloc_percpu(ktap_stats);
-+ if (!stats)
-+ return -ENOMEM;
-+
-+ G(ks)->stats = stats;
-+ return 0;
-+}
-+
-+void kp_final_exit(ktap_state *ks)
-+{
-+ if (!list_empty(&G(ks)->probe_events_head) ||
-+ !list_empty(&G(ks)->timers))
-+ kp_wait(ks);
-+
-+ kp_exit_timers(ks);
-+ kp_probe_exit(ks);
-+
-+ /* free all resources got by ktap */
-+ kp_ffi_free_symbol(ks);
-+ kp_tstring_freeall(ks);
-+ kp_free_all_gcobject(ks);
-+ cfunction_cache_exit(ks);
-+
-+ kp_exitthread(ks);
-+ kp_free(ks, ks->stack);
-+ free_all_ci(ks);
-+
-+ free_kp_percpu_data(ks);
-+ free_cpumask_var(G(ks)->cpumask);
-+
-+ kp_stats_cleanup(ks);
-+ wait_user_completion(ks);
-+
-+ /* should invoke after wait_user_completion */
-+ if (G(ks)->trace_task)
-+ put_task_struct(G(ks)->trace_task);
-+
-+ kp_transport_exit(ks);
-+ kp_free(ks, ks);
-+}
-+
-+/* ktap mainthread initization, main entry for ktap */
-+ktap_state *kp_newstate(ktap_parm *parm, struct dentry *dir)
-+{
-+ ktap_state *ks;
-+ pid_t pid;
-+ int cpu;
-+
-+ ks = kzalloc(sizeof(ktap_state) + sizeof(ktap_global_state),
-+ GFP_KERNEL);
-+ if (!ks)
-+ return NULL;
-+
-+ G(ks) = (ktap_global_state *)(ks + 1);
-+ G(ks)->mainthread = ks;
-+ G(ks)->seed = 201236; /* todo: make more random in future */
-+ G(ks)->task = current;
-+ G(ks)->parm = parm;
-+ G(ks)->str_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
-+ INIT_LIST_HEAD(&(G(ks)->timers));
-+ INIT_LIST_HEAD(&(G(ks)->probe_events_head));
-+ G(ks)->exit = 0;
-+
-+ if (kp_stats_init(ks))
-+ goto out;
-+
-+ if (kp_transport_init(ks, dir))
-+ goto out;
-+
-+ ks->stack = kp_malloc(ks, KTAP_STACK_SIZE_BYTES);
-+
-+ pid = (pid_t)parm->trace_pid;
-+ if (pid != -1) {
-+ struct task_struct *task;
-+
-+ rcu_read_lock();
-+ task = pid_task(find_vpid(pid), PIDTYPE_PID);
-+ if (!task) {
-+ kp_error(ks, "cannot find pid %d\n", pid);
-+ rcu_read_unlock();
-+ goto out;
-+ }
-+ G(ks)->trace_task = task;
-+ get_task_struct(task);
-+ rcu_read_unlock();
-+ }
-+
-+ if( !alloc_cpumask_var(&G(ks)->cpumask, GFP_KERNEL))
-+ goto out;
-+
-+ cpumask_copy(G(ks)->cpumask, cpu_online_mask);
-+
-+ cpu = parm->trace_cpu;
-+ if (cpu != -1) {
-+ if (!cpu_online(cpu)) {
-+ kp_error(ks, "ktap: cpu %d is not online\n", cpu);
-+ goto out;
-+ }
-+
-+ cpumask_clear(G(ks)->cpumask);
-+ cpumask_set_cpu(cpu, G(ks)->cpumask);
-+ }
-+
-+ if (cfunction_cache_init(ks))
-+ goto out;
-+
-+ kp_tstring_resize(ks, 512); /* set inital string hashtable size */
-+
-+ kp_init_state(ks);
-+ kp_init_registry(ks);
-+ kp_init_arguments(ks, parm->argc, parm->argv);
-+
-+ /* init library */
-+ kp_init_baselib(ks);
-+ kp_init_kdebuglib(ks);
-+ kp_init_timerlib(ks);
-+ kp_init_ansilib(ks);
-+ kp_init_ffilib(ks);
-+
-+ if (alloc_kp_percpu_data(ks))
-+ goto out;
-+
-+ if (kp_probe_init(ks))
-+ goto out;
-+
-+ return ks;
-+
-+ out:
-+ G(ks)->exit = 1;
-+ kp_final_exit(ks);
-+ return NULL;
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/kp_vm.h
-@@ -0,0 +1,16 @@
-+#ifndef __KTAP_VM_H__
-+#define __KTAP_VM_H__
-+
-+int gettimeofday_us(void); /* common helper function */
-+ktap_state *kp_newstate(struct ktap_parm *parm, struct dentry *dir);
-+void kp_exit(ktap_state *ks);
-+void kp_init_exit_instruction(void);
-+void kp_final_exit(ktap_state *ks);
-+ktap_state *kp_newthread(ktap_state *mainthread);
-+void kp_exitthread(ktap_state *ks);
-+void kp_call(ktap_state *ks, StkId func, int nresults);
-+void kp_optimize_code(ktap_state *ks, int level, ktap_proto *f);
-+void kp_register_lib(ktap_state *ks, const char *libname,
-+ const ktap_Reg *funcs);
-+
-+#endif /* __KTAP_VM_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/ktap.c
-@@ -0,0 +1,217 @@
-+/*
-+ * ktap.c - ktapvm kernel module main entry
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+/*
-+ * this file is the first file to be compile, add CONFIG_ checking in here.
-+ * See Requirements in doc/introduction.txt
-+ */
-+
-+#include <linux/version.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0)
-+#error "Currently ktap don't support kernel older than 3.1"
-+#endif
-+
-+#if !CONFIG_EVENT_TRACING
-+#error "Please enable CONFIG_EVENT_TRACING before compile ktap"
-+#endif
-+
-+#if !CONFIG_PERF_EVENTS
-+#error "Please enable CONFIG_PERF_EVENTS before compile ktap"
-+#endif
-+
-+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-+
-+#include <linux/module.h>
-+#include <linux/errno.h>
-+#include <linux/file.h>
-+#include <linux/slab.h>
-+#include <linux/fcntl.h>
-+#include <linux/sched.h>
-+#include <linux/poll.h>
-+#include <linux/anon_inodes.h>
-+#include <linux/debugfs.h>
-+#include <linux/vmalloc.h>
-+#include "../include/ktap_types.h"
-+#include "ktap.h"
-+#include "kp_load.h"
-+#include "kp_vm.h"
-+
-+static int load_trunk(struct ktap_parm *parm, unsigned long **buff)
-+{
-+ int ret;
-+ unsigned long *vmstart;
-+
-+ vmstart = vmalloc(parm->trunk_len);
-+ if (!vmstart)
-+ return -ENOMEM;
-+
-+ ret = copy_from_user(vmstart, (void __user *)parm->trunk,
-+ parm->trunk_len);
-+ if (ret < 0) {
-+ vfree(vmstart);
-+ return -EFAULT;
-+ }
-+
-+ *buff = vmstart;
-+ return 0;
-+}
-+
-+static struct dentry *kp_dir_dentry;
-+
-+/* Ktap Main Entry */
-+static int ktap_main(struct file *file, ktap_parm *parm)
-+{
-+ unsigned long *buff = NULL;
-+ ktap_state *ks;
-+ ktap_closure *cl;
-+ int start_time, delta_time;
-+ int ret;
-+
-+ start_time = gettimeofday_us();
-+
-+ ks = kp_newstate(parm, kp_dir_dentry);
-+ if (unlikely(!ks))
-+ return -ENOEXEC;
-+
-+ file->private_data = ks;
-+
-+ ret = load_trunk(parm, &buff);
-+ if (ret) {
-+ pr_err("cannot load file\n");
-+ return ret;
-+ }
-+
-+ cl = kp_load(ks, (unsigned char *)buff);
-+
-+ vfree(buff);
-+
-+ if (cl) {
-+ /* optimize bytecode before excuting */
-+ kp_optimize_code(ks, 0, cl->p);
-+
-+ delta_time = gettimeofday_us() - start_time;
-+ kp_verbose_printf(ks, "booting time: %d (us)\n", delta_time);
-+ kp_call(ks, ks->top - 1, 0);
-+ }
-+
-+ kp_final_exit(ks);
-+ return ret;
-+}
-+
-+
-+static void print_version(void)
-+{
-+}
-+
-+static long ktap_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-+{
-+ ktap_parm parm;
-+ int ret;
-+
-+ switch (cmd) {
-+ case KTAP_CMD_IOC_VERSION:
-+ print_version();
-+ return 0;
-+ case KTAP_CMD_IOC_RUN:
-+ ret = copy_from_user(&parm, (void __user *)arg,
-+ sizeof(ktap_parm));
-+ if (ret < 0)
-+ return -EFAULT;
-+
-+ return ktap_main(file, &parm);
-+ default:
-+ return -EINVAL;
-+ };
-+
-+ return 0;
-+}
-+
-+static const struct file_operations ktap_fops = {
-+ .llseek = no_llseek,
-+ .unlocked_ioctl = ktap_ioctl,
-+};
-+
-+static long ktapvm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-+{
-+ int new_fd, err;
-+ struct file *new_file;
-+
-+ new_fd = get_unused_fd();
-+ if (new_fd < 0)
-+ return new_fd;
-+
-+ new_file = anon_inode_getfile("[ktap]", &ktap_fops, NULL, O_RDWR);
-+ if (IS_ERR(new_file)) {
-+ err = PTR_ERR(new_file);
-+ put_unused_fd(new_fd);
-+ return err;
-+ }
-+
-+ file->private_data = NULL;
-+ fd_install(new_fd, new_file);
-+ return new_fd;
-+}
-+
-+static const struct file_operations ktapvm_fops = {
-+ .owner = THIS_MODULE,
-+ .unlocked_ioctl = ktapvm_ioctl,
-+};
-+
-+static int __init init_ktap(void)
-+{
-+ struct dentry *ktapvm_dentry;
-+
-+ kp_dir_dentry = debugfs_create_dir("ktap", NULL);
-+ if (!kp_dir_dentry) {
-+ pr_err("ktap: debugfs_create_dir failed\n");
-+ return -1;
-+ }
-+
-+ ktapvm_dentry = debugfs_create_file("ktapvm", 0444, kp_dir_dentry, NULL,
-+ &ktapvm_fops);
-+
-+ if (!ktapvm_dentry) {
-+ pr_err("ktapvm: cannot create ktapvm file\n");
-+ debugfs_remove_recursive(kp_dir_dentry);
-+ return -1;
-+ }
-+
-+ kp_init_exit_instruction();
-+
-+ return 0;
-+}
-+
-+static void __exit exit_ktap(void)
-+{
-+ debugfs_remove_recursive(kp_dir_dentry);
-+}
-+
-+module_init(init_ktap);
-+module_exit(exit_ktap);
-+
-+MODULE_AUTHOR("Jovi Zhangwei <jovi.zhangwei@gmail.com>");
-+MODULE_DESCRIPTION("ktap");
-+MODULE_LICENSE("GPL");
-+
-+int kp_max_exec_count = 10000;
-+module_param_named(max_exec_count, kp_max_exec_count, int, S_IRUGO | S_IWUSR);
-+MODULE_PARM_DESC(max_exec_count, "non-mainthread max instruction execution count");
-+
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/ktap.h
-@@ -0,0 +1,130 @@
-+#ifndef __KTAP_H__
-+#define __KTAP_H__
-+
-+#ifdef __KERNEL__
-+#include <linux/version.h>
-+#include <linux/hardirq.h>
-+#include <linux/trace_seq.h>
-+#endif
-+
-+typedef struct ktap_Reg {
-+ const char *name;
-+ ktap_cfunction func;
-+} ktap_Reg;
-+
-+struct ktap_probe_event {
-+ struct list_head list;
-+ struct perf_event *perf;
-+ ktap_state *ks;
-+ ktap_closure *cl;
-+};
-+
-+/* this structure allocate on stack */
-+struct ktap_event {
-+ struct ktap_probe_event *pevent;
-+ struct ftrace_event_call *call;
-+ struct trace_entry *entry;
-+ int entry_size;
-+ struct pt_regs *regs;
-+};
-+
-+#define KTAP_PERCPU_BUFFER_SIZE (3 * PAGE_SIZE)
-+
-+void kp_init_baselib(ktap_state *ks);
-+void kp_init_oslib(ktap_state *ks);
-+void kp_init_kdebuglib(ktap_state *ks);
-+void kp_init_timerlib(ktap_state *ks);
-+void kp_init_ansilib(ktap_state *ks);
-+#ifdef CONFIG_KTAP_FFI
-+void kp_init_ffilib(ktap_state *ks);
-+#else
-+static void __maybe_unused kp_init_ffilib(ktap_state *ks)
-+{
-+ return;
-+}
-+#endif
-+
-+
-+int kp_probe_init(ktap_state *ks);
-+void kp_probe_exit(ktap_state *ks);
-+
-+void kp_perf_event_register(ktap_state *ks, struct perf_event_attr *attr,
-+ struct task_struct *task, char *filter,
-+ ktap_closure *cl);
-+
-+void kp_event_getarg(ktap_state *ks, ktap_value *ra, int n);
-+void kp_event_tostring(ktap_state *ks, struct trace_seq *seq);
-+void kp_exit_timers(ktap_state *ks);
-+
-+extern int kp_max_exec_count;
-+
-+/* get from kernel/trace/trace.h */
-+static __always_inline int trace_get_context_bit(void)
-+{
-+ int bit;
-+
-+ if (in_interrupt()) {
-+ if (in_nmi())
-+ bit = 0;
-+ else if (in_irq())
-+ bit = 1;
-+ else
-+ bit = 2;
-+ } else
-+ bit = 3;
-+
-+ return bit;
-+}
-+
-+static __always_inline int get_recursion_context(ktap_state *ks)
-+{
-+ int rctx = trace_get_context_bit();
-+ int *val = __this_cpu_ptr(G(ks)->recursion_context[rctx]);
-+
-+ if (*val)
-+ return -1;
-+
-+ *val = true;
-+ barrier();
-+
-+ return rctx;
-+}
-+
-+static inline void put_recursion_context(ktap_state *ks, int rctx)
-+{
-+ int *val = __this_cpu_ptr(G(ks)->recursion_context[rctx]);
-+
-+ barrier();
-+ *val = false;
-+}
-+
-+static inline void *kp_percpu_data(ktap_state *ks, int type)
-+{
-+ return this_cpu_ptr(G(ks)->pcpu_data[type][trace_get_context_bit()]);
-+}
-+
-+
-+#define kp_verbose_printf(ks, ...) \
-+ if (G(ks)->parm->verbose) \
-+ kp_printf(ks, "[verbose] "__VA_ARGS__);
-+
-+/* get argument operation macro */
-+#define kp_arg(ks, n) ((ks)->ci->func + (n))
-+#define kp_arg_nr(ks) ((int)(ks->top - (ks->ci->func + 1)))
-+
-+#define kp_arg_check(ks, narg, type) \
-+ do { \
-+ if (unlikely(ttypenv(kp_arg(ks, narg)) != type)) { \
-+ kp_error(ks, "wrong type of argument %d\n", narg);\
-+ return -1; \
-+ } \
-+ } while (0)
-+
-+
-+#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 5, 0)
-+#define SPRINT_SYMBOL sprint_symbol_no_offset
-+#else
-+#define SPRINT_SYMBOL sprint_symbol
-+#endif
-+
-+#endif /* __KTAP_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/lib_ansi.c
-@@ -0,0 +1,155 @@
-+/*
-+ * ansilib.c - ANSI escape sequences library
-+ *
-+ * http://en.wikipedia.org/wiki/ANSI_escape_code
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include "../include/ktap_types.h"
-+#include "ktap.h"
-+#include "kp_vm.h"
-+
-+/**
-+ * function ansi.clear_screen - Move cursor to top left and clear screen.
-+ *
-+ * Description: Sends ansi code for moving cursor to top left and then the
-+ * ansi code for clearing the screen from the cursor position to the end.
-+ */
-+
-+static int ktap_lib_clear_screen(ktap_state *ks)
-+{
-+ kp_printf(ks, "\033[1;1H\033[J");
-+ return 0;
-+}
-+
-+/**
-+ * function ansi.set_color - Set the ansi Select Graphic Rendition mode.
-+ * @fg: Foreground color to set.
-+ *
-+ * Description: Sends ansi code for Select Graphic Rendition mode for the
-+ * given forground color. Black (30), Blue (34), Green (32), Cyan (36),
-+ * Red (31), Purple (35), Brown (33), Light Gray (37).
-+ */
-+
-+static int ktap_lib_set_color(ktap_state *ks)
-+{
-+ int fg;
-+
-+ kp_arg_check(ks, 1, KTAP_TNUMBER);
-+
-+ fg = nvalue(kp_arg(ks, 1));
-+ kp_printf(ks, "\033[%dm", fg);
-+ return 0;
-+}
-+
-+/**
-+ * function ansi.set_color2 - Set the ansi Select Graphic Rendition mode.
-+ * @fg: Foreground color to set.
-+ * @bg: Background color to set.
-+ *
-+ * Description: Sends ansi code for Select Graphic Rendition mode for the
-+ * given forground color, Black (30), Blue (34), Green (32), Cyan (36),
-+ * Red (31), Purple (35), Brown (33), Light Gray (37) and the given
-+ * background color, Black (40), Red (41), Green (42), Yellow (43),
-+ * Blue (44), Magenta (45), Cyan (46), White (47).
-+ */
-+static int ktap_lib_set_color2(ktap_state *ks)
-+{
-+ int fg, bg;
-+
-+ kp_arg_check(ks, 1, KTAP_TNUMBER);
-+ kp_arg_check(ks, 2, KTAP_TNUMBER);
-+
-+ fg = nvalue(kp_arg(ks, 1));
-+ bg = nvalue(kp_arg(ks, 2));
-+ kp_printf(ks, "\033[%d;%dm", fg, bg);
-+ return 0;
-+}
-+
-+/**
-+ * function ansi.set_color3 - Set the ansi Select Graphic Rendition mode.
-+ * @fg: Foreground color to set.
-+ * @bg: Background color to set.
-+ * @attr: Color attribute to set.
-+ *
-+ * Description: Sends ansi code for Select Graphic Rendition mode for the
-+ * given forground color, Black (30), Blue (34), Green (32), Cyan (36),
-+ * Red (31), Purple (35), Brown (33), Light Gray (37), the given
-+ * background color, Black (40), Red (41), Green (42), Yellow (43),
-+ * Blue (44), Magenta (45), Cyan (46), White (47) and the color attribute
-+ * All attributes off (0), Intensity Bold (1), Underline Single (4),
-+ * Blink Slow (5), Blink Rapid (6), Image Negative (7).
-+ */
-+static int ktap_lib_set_color3(ktap_state *ks)
-+{
-+ int fg, bg, attr;
-+
-+ kp_arg_check(ks, 1, KTAP_TNUMBER);
-+ kp_arg_check(ks, 2, KTAP_TNUMBER);
-+ kp_arg_check(ks, 3, KTAP_TNUMBER);
-+
-+ fg = nvalue(kp_arg(ks, 1));
-+ bg = nvalue(kp_arg(ks, 2));
-+ attr = nvalue(kp_arg(ks, 3));
-+
-+ if (attr)
-+ kp_printf(ks, "\033[%d;%d;%dm", fg, bg, attr);
-+ else
-+ kp_printf(ks, "\033[%d;%dm", fg, bg);
-+
-+ return 0;
-+}
-+
-+/**
-+ * function ansi.reset_color - Resets Select Graphic Rendition mode.
-+ *
-+ * Description: Sends ansi code to reset foreground, background and color
-+ * attribute to default values.
-+ */
-+static int ktap_lib_reset_color(ktap_state *ks)
-+{
-+ kp_printf(ks, "\033[0;0m");
-+ return 0;
-+}
-+
-+/**
-+ * function ansi.new_line - Move cursor to new line.
-+ *
-+ * Description: Sends ansi code new line.
-+ */
-+static int ktap_lib_new_line (ktap_state *ks)
-+{
-+ kp_printf(ks, "\12");
-+ return 0;
-+}
-+
-+static const ktap_Reg ansi_funcs[] = {
-+ {"clear_screen", ktap_lib_clear_screen},
-+ {"set_color", ktap_lib_set_color},
-+ {"set_color2", ktap_lib_set_color2},
-+ {"set_color3", ktap_lib_set_color3},
-+ {"reset_color", ktap_lib_reset_color},
-+ {"new_line", ktap_lib_new_line},
-+ {NULL}
-+};
-+
-+void kp_init_ansilib(ktap_state *ks)
-+{
-+ kp_register_lib(ks, "ansi", ansi_funcs);
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/lib_base.c
-@@ -0,0 +1,607 @@
-+/*
-+ * baselib.c - ktapvm kernel module base library
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License 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/version.h>
-+#include <linux/hardirq.h>
-+#include <linux/kallsyms.h>
-+#include <linux/sched.h>
-+#include <linux/uaccess.h>
-+#include <linux/utsname.h>
-+#include <linux/time.h>
-+#include <linux/clocksource.h>
-+#include <linux/ring_buffer.h>
-+#include <linux/stacktrace.h>
-+#include <linux/cred.h>
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
-+#include <linux/uidgid.h>
-+#endif
-+#include "../include/ktap_types.h"
-+#include "ktap.h"
-+#include "kp_obj.h"
-+#include "kp_str.h"
-+#include "kp_tab.h"
-+#include "kp_transport.h"
-+#include "kp_vm.h"
-+
-+static int ktap_lib_next(ktap_state *ks)
-+{
-+ ktap_tab *t = hvalue(ks->top - 2);
-+
-+ if (kp_tab_next(ks, t, ks->top-1)) {
-+ ks->top += 1;
-+ return 2;
-+ } else {
-+ ks->top -= 1;
-+ set_nil(ks->top++);
-+ return 1;
-+ }
-+}
-+
-+static int ktap_lib_pairs(ktap_state *ks)
-+{
-+ ktap_value *v = kp_arg(ks, 1);
-+ ktap_tab *t;
-+
-+ if (is_table(v)) {
-+ t = hvalue(v);
-+ } else if (is_ptable(v)) {
-+ t = kp_ptab_synthesis(ks, phvalue(v));
-+ } else if (is_nil(v)) {
-+ kp_error(ks, "table is nil in pairs\n");
-+ return 0;
-+ } else {
-+ kp_error(ks, "wrong argument for pairs\n");
-+ return 0;
-+ }
-+
-+ set_cfunction(ks->top++, ktap_lib_next);
-+ set_table(ks->top++, t);
-+ set_nil(ks->top++);
-+ return 3;
-+}
-+
-+static int ktap_lib_sort_next(ktap_state *ks)
-+{
-+ ktap_tab *t = hvalue(ks->top - 2);
-+
-+ if (kp_tab_sort_next(ks, t, ks->top-1)) {
-+ ks->top += 1;
-+ return 2;
-+ } else {
-+ ks->top -= 1;
-+ set_nil(ks->top++);
-+ return 1;
-+ }
-+}
-+
-+static int ktap_lib_sort_pairs(ktap_state *ks)
-+{
-+ ktap_value *v = kp_arg(ks, 1);
-+ ktap_closure *cmp_func = NULL;
-+ ktap_tab *t;
-+
-+ if (is_table(v)) {
-+ t = hvalue(v);
-+ } else if (is_ptable(v)) {
-+ t = kp_ptab_synthesis(ks, phvalue(v));
-+ } else if (is_nil(v)) {
-+ kp_error(ks, "table is nil in pairs\n");
-+ return 0;
-+ } else {
-+ kp_error(ks, "wrong argument for pairs\n");
-+ return 0;
-+ }
-+
-+ if (kp_arg_nr(ks) > 1) {
-+ kp_arg_check(ks, 2, KTAP_TFUNCTION);
-+ cmp_func = clvalue(kp_arg(ks, 2));
-+ }
-+
-+ kp_tab_sort(ks, t, cmp_func);
-+ set_cfunction(ks->top++, ktap_lib_sort_next);
-+ set_table(ks->top++, t);
-+ set_nil(ks->top++);
-+ return 3;
-+}
-+
-+static int ktap_lib_len(ktap_state *ks)
-+{
-+ int len = kp_objlen(ks, kp_arg(ks, 1));
-+
-+ if (len < 0)
-+ return -1;
-+
-+ set_number(ks->top, len);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_print(ktap_state *ks)
-+{
-+ int i;
-+ int n = kp_arg_nr(ks);
-+
-+ for (i = 1; i <= n; i++) {
-+ ktap_value *arg = kp_arg(ks, i);
-+ if (i > 1)
-+ kp_puts(ks, "\t");
-+ kp_showobj(ks, arg);
-+ }
-+
-+ kp_puts(ks, "\n");
-+
-+ return 0;
-+}
-+
-+/* don't engage with tstring when printf, use buffer directly */
-+static int ktap_lib_printf(ktap_state *ks)
-+{
-+ struct trace_seq *seq;
-+
-+ preempt_disable_notrace();
-+
-+ seq = kp_percpu_data(ks, KTAP_PERCPU_DATA_BUFFER);
-+ trace_seq_init(seq);
-+
-+ if (kp_str_fmt(ks, seq))
-+ goto out;
-+
-+ seq->buffer[seq->len] = '\0';
-+ kp_transport_write(ks, seq->buffer, seq->len + 1);
-+
-+ out:
-+ preempt_enable_notrace();
-+ return 0;
-+}
-+
-+#ifdef CONFIG_STACKTRACE
-+static int ktap_lib_print_backtrace(ktap_state *ks)
-+{
-+ int skip = 10, max_entries = 10;
-+ int n = kp_arg_nr(ks);
-+
-+ if (n >= 1) {
-+ kp_arg_check(ks, 1, KTAP_TNUMBER);
-+ skip = nvalue(kp_arg(ks, 1));
-+ }
-+ if (n >= 2) {
-+ kp_arg_check(ks, 2, KTAP_TNUMBER);
-+ max_entries = nvalue(kp_arg(ks, 2));
-+ max_entries = min(max_entries, KTAP_MAX_STACK_ENTRIES);
-+ }
-+
-+ kp_transport_print_backtrace(ks, skip, max_entries);
-+ return 0;
-+}
-+#else
-+static int ktap_lib_print_backtrace(ktap_state *ks)
-+{
-+ kp_error(ks, "Please enable CONFIG_STACKTRACE before use "
-+ "ktap print_backtrace\n");
-+ return 0;
-+}
-+#endif
-+
-+static int ktap_lib_backtrace(ktap_state *ks)
-+{
-+ struct stack_trace trace;
-+ int skip = 10, max_entries = 10;
-+ int n = kp_arg_nr(ks);
-+ ktap_btrace *bt;
-+
-+ if (n >= 1) {
-+ kp_arg_check(ks, 1, KTAP_TNUMBER);
-+ skip = nvalue(kp_arg(ks, 1));
-+ }
-+ if (n >= 2) {
-+ kp_arg_check(ks, 2, KTAP_TNUMBER);
-+ max_entries = nvalue(kp_arg(ks, 2));
-+ max_entries = min(max_entries, KTAP_MAX_STACK_ENTRIES);
-+ }
-+
-+ bt = kp_percpu_data(ks, KTAP_PERCPU_DATA_BTRACE);
-+
-+ trace.nr_entries = 0;
-+ trace.skip = skip;
-+ trace.max_entries = max_entries;
-+ trace.entries = (unsigned long *)(bt + 1);
-+ save_stack_trace(&trace);
-+
-+ bt->nr_entries = trace.nr_entries;
-+ set_btrace(ks->top, bt);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+extern unsigned long long ns2usecs(cycle_t nsec);
-+static int ktap_lib_print_trace_clock(ktap_state *ks)
-+{
-+ unsigned long long t;
-+ unsigned long secs, usec_rem;
-+ u64 timestamp;
-+
-+ /* use ring buffer's timestamp */
-+ timestamp = ring_buffer_time_stamp(G(ks)->buffer, smp_processor_id());
-+
-+ t = ns2usecs(timestamp);
-+ usec_rem = do_div(t, USEC_PER_SEC);
-+ secs = (unsigned long)t;
-+
-+ kp_printf(ks, "%5lu.%06lu\n", secs, usec_rem);
-+
-+ return 0;
-+}
-+
-+static int ktap_lib_exit(ktap_state *ks)
-+{
-+ kp_exit(ks);
-+
-+ /* do not execute bytecode any more in this thread */
-+ return -1;
-+}
-+
-+static int ktap_lib_pid(ktap_state *ks)
-+{
-+ set_number(ks->top, (int)current->pid);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_tid(ktap_state *ks)
-+{
-+ pid_t pid = task_pid_vnr(current);
-+
-+ set_number(ks->top, (int)pid);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_uid(ktap_state *ks)
-+{
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
-+ uid_t uid = from_kuid_munged(current_user_ns(), current_uid());
-+#else
-+ uid_t uid = current_uid();
-+#endif
-+ set_number(ks->top, (int)uid);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_execname(ktap_state *ks)
-+{
-+ ktap_string *ts = kp_tstring_new(ks, current->comm);
-+ set_string(ks->top, ts);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_cpu(ktap_state *ks)
-+{
-+ set_number(ks->top, smp_processor_id());
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_num_cpus(ktap_state *ks)
-+{
-+ set_number(ks->top, num_online_cpus());
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_in_interrupt(ktap_state *ks)
-+{
-+ int ret = in_interrupt();
-+
-+ set_number(ks->top, ret);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_arch(ktap_state *ks)
-+{
-+ set_string(ks->top, kp_tstring_new(ks, utsname()->machine));
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_kernel_v(ktap_state *ks)
-+{
-+ set_string(ks->top, kp_tstring_new(ks, utsname()->release));
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_kernel_string(ktap_state *ks)
-+{
-+ unsigned long addr;
-+ char str[256] = {0};
-+ char *ret;
-+
-+ kp_arg_check(ks, 1, KTAP_TNUMBER);
-+
-+ addr = nvalue(kp_arg(ks, 1));
-+
-+ ret = strncpy((void *)str, (const void *)addr, 256);
-+ (void) &ret; /* Silence compiler warning. */
-+
-+ str[255] = '\0';
-+ set_string(ks->top, kp_tstring_new_local(ks, str));
-+
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_user_string(ktap_state *ks)
-+{
-+ unsigned long addr;
-+ char str[256] = {0};
-+ int ret;
-+
-+ kp_arg_check(ks, 1, KTAP_TNUMBER);
-+
-+ addr = nvalue(kp_arg(ks, 1));
-+
-+ pagefault_disable();
-+ ret = __copy_from_user_inatomic((void *)str, (const void *)addr, 256);
-+ (void) &ret; /* Silence compiler warning. */
-+ pagefault_enable();
-+ str[255] = '\0';
-+ set_string(ks->top, kp_tstring_new(ks, str));
-+
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_histogram(ktap_state *ks)
-+{
-+ ktap_value *v = kp_arg(ks, 1);
-+
-+ if (is_table(v))
-+ kp_tab_histogram(ks, hvalue(v));
-+ else if (is_ptable(v))
-+ kp_ptab_histogram(ks, phvalue(v));
-+
-+ return 0;
-+}
-+
-+static int ktap_lib_ptable(ktap_state *ks)
-+{
-+ ktap_ptab *ph;
-+
-+ ph = kp_ptab_new(ks);
-+ set_ptable(ks->top, ph);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_count(ktap_state *ks)
-+{
-+ ktap_value *v = kp_arg(ks, 1);
-+ ktap_stat_data *sd;
-+
-+ if (is_nil(v)) {
-+ set_number(ks->top, 0);
-+ incr_top(ks);
-+ return 1;
-+ }
-+
-+ kp_arg_check(ks, 1, KTAP_TSTATDATA);
-+ sd = sdvalue(v);
-+
-+ set_number(ks->top, sd->count);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_max(ktap_state *ks)
-+{
-+ ktap_value *v = kp_arg(ks, 1);
-+ ktap_stat_data *sd;
-+
-+ if (is_nil(v)) {
-+ set_number(ks->top, 0);
-+ incr_top(ks);
-+ return 1;
-+ }
-+
-+ kp_arg_check(ks, 1, KTAP_TSTATDATA);
-+ sd = sdvalue(v);
-+
-+ set_number(ks->top, sd->max);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_min(ktap_state *ks)
-+{
-+ ktap_value *v = kp_arg(ks, 1);
-+ ktap_stat_data *sd;
-+
-+ if (is_nil(v)) {
-+ set_number(ks->top, 0);
-+ incr_top(ks);
-+ return 1;
-+ }
-+
-+ kp_arg_check(ks, 1, KTAP_TSTATDATA);
-+ sd = sdvalue(v);
-+
-+ set_number(ks->top, sd->min);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_sum(ktap_state *ks)
-+{
-+ ktap_value *v = kp_arg(ks, 1);
-+ ktap_stat_data *sd;
-+
-+ if (is_nil(v)) {
-+ set_number(ks->top, 0);
-+ incr_top(ks);
-+ return 1;
-+ }
-+
-+ kp_arg_check(ks, 1, KTAP_TSTATDATA);
-+ sd = sdvalue(v);
-+
-+ set_number(ks->top, sd->sum);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_avg(ktap_state *ks)
-+{
-+ ktap_value *v = kp_arg(ks, 1);
-+ ktap_stat_data *sd;
-+
-+ if (is_nil(v)) {
-+ set_number(ks->top, 0);
-+ incr_top(ks);
-+ return 1;
-+ }
-+
-+ kp_arg_check(ks, 1, KTAP_TSTATDATA);
-+ sd = sdvalue(v);
-+
-+ set_number(ks->top, sd->sum / sd->count);
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+static int ktap_lib_delete(ktap_state *ks)
-+{
-+ kp_arg_check(ks, 1, KTAP_TTABLE);
-+
-+ kp_tab_clear(ks, hvalue(kp_arg(ks, 1)));
-+ return 0;
-+}
-+
-+static int ktap_lib_gettimeofday_us(ktap_state *ks)
-+{
-+ set_number(ks->top, gettimeofday_us());
-+ incr_top(ks);
-+
-+ return 1;
-+}
-+
-+/*
-+ * use gdb to get field offset of struct task_struct, for example:
-+ *
-+ * gdb vmlinux
-+ * (gdb)p &(((struct task_struct *)0).prio)
-+ */
-+static int ktap_lib_curr_task_info(ktap_state *ks)
-+{
-+ int offset;
-+ int fetch_bytes;
-+
-+ kp_arg_check(ks, 1, KTAP_TNUMBER);
-+
-+ offset = nvalue(kp_arg(ks, 1));
-+
-+ if (kp_arg_nr(ks) == 1)
-+ fetch_bytes = 4; /* default fetch 4 bytes*/
-+ else {
-+ kp_arg_check(ks, 2, KTAP_TNUMBER);
-+ fetch_bytes = nvalue(kp_arg(ks, 2));
-+ }
-+
-+ if (offset >= sizeof(struct task_struct)) {
-+ set_nil(ks->top++);
-+ kp_error(ks, "access out of bound value of task_struct\n");
-+ return 1;
-+ }
-+
-+#define RET_VALUE ((unsigned long)current + offset)
-+
-+ switch (fetch_bytes) {
-+ case 4:
-+ set_number(ks->top, *(unsigned int *)RET_VALUE);
-+ break;
-+ case 8:
-+ set_number(ks->top, *(unsigned long *)RET_VALUE);
-+ break;
-+ default:
-+ kp_error(ks, "unsupported fetch bytes in curr_task_info\n");
-+ set_nil(ks->top);
-+ break;
-+ }
-+
-+#undef RET_VALUE
-+
-+ incr_top(ks);
-+ return 1;
-+}
-+
-+/*
-+ * This built-in function mainly purpose scripts/schedule/schedtimes.kp
-+ */
-+static int ktap_lib_in_iowait(ktap_state *ks)
-+{
-+ set_number(ks->top, current->in_iowait);
-+ incr_top(ks);
-+
-+ return 1;
-+}
-+
-+static const ktap_Reg base_funcs[] = {
-+ {"pairs", ktap_lib_pairs},
-+ {"sort_pairs", ktap_lib_sort_pairs},
-+ {"len", ktap_lib_len},
-+ {"print", ktap_lib_print},
-+ {"printf", ktap_lib_printf},
-+ {"print_backtrace", ktap_lib_print_backtrace},
-+ {"backtrace", ktap_lib_backtrace},
-+ {"print_trace_clock", ktap_lib_print_trace_clock},
-+ {"in_interrupt", ktap_lib_in_interrupt},
-+ {"exit", ktap_lib_exit},
-+ {"pid", ktap_lib_pid},
-+ {"tid", ktap_lib_tid},
-+ {"uid", ktap_lib_uid},
-+ {"execname", ktap_lib_execname},
-+ {"cpu", ktap_lib_cpu},
-+ {"num_cpus", ktap_lib_num_cpus},
-+ {"arch", ktap_lib_arch},
-+ {"kernel_v", ktap_lib_kernel_v},
-+ {"kernel_string", ktap_lib_kernel_string},
-+ {"user_string", ktap_lib_user_string},
-+ {"histogram", ktap_lib_histogram},
-+ {"ptable", ktap_lib_ptable},
-+ {"count", ktap_lib_count},
-+ {"max", ktap_lib_max},
-+ {"min", ktap_lib_min},
-+ {"sum", ktap_lib_sum},
-+ {"avg", ktap_lib_avg},
-+
-+ {"delete", ktap_lib_delete},
-+ {"gettimeofday_us", ktap_lib_gettimeofday_us},
-+ {"curr_taskinfo", ktap_lib_curr_task_info},
-+ {"in_iowait", ktap_lib_in_iowait},
-+ {NULL}
-+};
-+
-+void kp_init_baselib(ktap_state *ks)
-+{
-+ kp_register_lib(ks, NULL, base_funcs);
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/lib_ffi.c
-@@ -0,0 +1,50 @@
-+/*
-+ * ffi.c - ktapvm kernel module ffi library
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_ffi.h"
-+#include "ktap.h"
-+#include "kp_vm.h"
-+
-+/*@TODO Design how to implement ffi helper functions 22.11 2013 (unihorn)*/
-+
-+static int kp_ffi_new(ktap_state *ks)
-+{
-+ /*@TODO finish this 08.11 2013 (houqp)*/
-+ return 0;
-+}
-+
-+static int kp_ffi_sizeof(ktap_state *ks)
-+{
-+ /*@TODO finish this 08.11 2013 (houqp)*/
-+ return 0;
-+}
-+
-+static const ktap_Reg ffi_funcs[] = {
-+ {"sizeof", kp_ffi_sizeof},
-+ {"new", kp_ffi_new},
-+ {NULL}
-+};
-+
-+void kp_init_ffilib(ktap_state *ks)
-+{
-+ kp_register_lib(ks, "ffi", ffi_funcs);
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/lib_kdebug.c
-@@ -0,0 +1,426 @@
-+/*
-+ * kdebug.c - ktap probing core implementation
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License 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/module.h>
-+#include <linux/ctype.h>
-+#include <linux/version.h>
-+#include <linux/ftrace_event.h>
-+#include "../include/ktap_types.h"
-+#include "ktap.h"
-+#include "kp_obj.h"
-+#include "kp_str.h"
-+#include "kp_transport.h"
-+#include "kp_vm.h"
-+
-+static void ktap_call_probe_closure(ktap_state *mainthread, ktap_closure *cl,
-+ struct ktap_event *e)
-+{
-+ ktap_state *ks;
-+ ktap_value *func;
-+
-+ ks = kp_newthread(mainthread);
-+ set_closure(ks->top, cl);
-+ func = ks->top;
-+ incr_top(ks);
-+
-+ ks->current_event = e;
-+
-+ kp_call(ks, func, 0);
-+
-+ ks->current_event = NULL;
-+ kp_exitthread(ks);
-+}
-+
-+void kp_event_tostring(ktap_state *ks, struct trace_seq *seq)
-+{
-+ struct ktap_event *e = ks->current_event;
-+ struct trace_iterator *iter;
-+ struct trace_event *ev;
-+ enum print_line_t ret = TRACE_TYPE_NO_CONSUME;
-+
-+ /* Simulate the iterator */
-+
-+ /*
-+ * use temp percpu buffer as trace_iterator
-+ * we cannot use same temp buffer as printf.
-+ */
-+ iter = kp_percpu_data(ks, KTAP_PERCPU_DATA_BUFFER2);
-+
-+ trace_seq_init(&iter->seq);
-+ iter->ent = e->entry;
-+
-+ ev = &(e->call->event);
-+ if (ev)
-+ ret = ev->funcs->trace(iter, 0, ev);
-+
-+ if (ret != TRACE_TYPE_NO_CONSUME) {
-+ struct trace_seq *s = &iter->seq;
-+ int len = s->len >= PAGE_SIZE ? PAGE_SIZE - 1 : s->len;
-+
-+ s->buffer[len] = '\0';
-+ _trace_seq_puts(seq, s->buffer);
-+ }
-+}
-+
-+/* This definition should keep update with kernel/trace/trace.h */
-+struct ftrace_event_field {
-+ struct list_head link;
-+ const char *name;
-+ const char *type;
-+ int filter_type;
-+ int offset;
-+ int size;
-+ int is_signed;
-+};
-+
-+static struct list_head *ktap_get_fields(struct ftrace_event_call *event_call)
-+{
-+ if (!event_call->class->get_fields)
-+ return &event_call->class->fields;
-+ return event_call->class->get_fields(event_call);
-+}
-+
-+static void get_field_value(ktap_state *ks, struct ktap_event *e,
-+ struct ftrace_event_field *field, ktap_value *ra)
-+{
-+ void *value = (unsigned char *)e->entry + field->offset;
-+
-+ if (field->size == 4) {
-+ int n = *(int *)value;
-+ set_number(ra, n);
-+ return;
-+ } else if (field->size == 8) {
-+ long n = *(long *)value;
-+ set_number(ra, n);
-+ return;
-+ }
-+
-+ if (!strncmp(field->type, "char", 4)) {
-+ set_string(ra, kp_tstring_new(ks, (char *)value));
-+ return;
-+ }
-+}
-+
-+void kp_event_getarg(ktap_state *ks, ktap_value *ra, int n)
-+{
-+ struct ktap_event *e = ks->current_event;
-+ int index = n;
-+ struct ftrace_event_field *field;
-+ struct list_head *head;
-+
-+ /* this is very slow and not safe, fix it in future */
-+ head = ktap_get_fields(e->call);
-+ list_for_each_entry_reverse(field, head, link) {
-+ if (--index == 0) {
-+ get_field_value(ks, e, field, ra);
-+ return;
-+ }
-+ }
-+
-+ set_nil(ra);
-+ return;
-+}
-+
-+/* Callback function for perf event subsystem
-+ * make ktap reentrant, don't disable irq in callback function,
-+ * same as perf and ftrace. to make reentrant, we need some
-+ * percpu data to be context isolation(irq/sirq/nmi/process)
-+ *
-+ * The recursion checking in here is mainly purpose for avoiding
-+ * corrupt ktap_state with timer closure callback. For tracepoint
-+ * recusion, perf core already handle it.
-+ *
-+ * Note tracepoint handler is calling with rcu_read_lock.
-+ */
-+static void ktap_overflow_callback(struct perf_event *event,
-+ struct perf_sample_data *data,
-+ struct pt_regs *regs)
-+{
-+ struct ktap_probe_event *ktap_pevent;
-+ struct ktap_event e;
-+ ktap_state *ks;
-+ int rctx;
-+
-+ ktap_pevent = event->overflow_handler_context;
-+ ks = ktap_pevent->ks;
-+
-+ if (unlikely(ks->stop))
-+ return;
-+
-+ rctx = get_recursion_context(ks);
-+ if (rctx < 0)
-+ return;
-+
-+ KTAP_STATS(ks)->events_hits += 1;
-+
-+ /* profile perf event don't have valid associated tp_event */
-+ if (event->tp_event) {
-+ e.call = event->tp_event;
-+ e.entry = data->raw->data;
-+ e.entry_size = data->raw->size;
-+ }
-+ e.pevent = ktap_pevent;
-+ e.regs = regs;
-+
-+ ktap_call_probe_closure(ks, ktap_pevent->cl, &e);
-+
-+ put_recursion_context(ks, rctx);
-+}
-+
-+static void perf_destructor(struct ktap_probe_event *ktap_pevent)
-+{
-+ perf_event_release_kernel(ktap_pevent->perf);
-+}
-+
-+static int (*kp_ftrace_profile_set_filter)(struct perf_event *event,
-+ int event_id, char *filter_str);
-+
-+/*
-+ * Generic perf event register function
-+ * used by tracepoints/kprobe/uprobe/profile-timer/hw_breakpoint.
-+ */
-+void kp_perf_event_register(ktap_state *ks, struct perf_event_attr *attr,
-+ struct task_struct *task, char *filter,
-+ ktap_closure *cl)
-+{
-+ struct ktap_probe_event *ktap_pevent;
-+ struct kmem_cache *pevent_cache = G(ks)->pevent_cache;
-+ struct perf_event *event;
-+ int cpu, ret;
-+
-+ kp_verbose_printf(ks, "enable perf event id: %d, filter: %s "
-+ "pid: %d\n", attr->config, filter,
-+ task ? task_tgid_vnr(task) : -1);
-+
-+ /*
-+ * don't tracing until ktap_wait, the reason is:
-+ * 1). some event may hit before apply filter
-+ * 2). more simple to manage tracing thread
-+ * 3). avoid race with mainthread.
-+ *
-+ * Another way to do this is make attr.disabled as 1, then use
-+ * perf_event_enable after filter apply, however, perf_event_enable
-+ * was not exported in kernel older than 3.3, so we drop this method.
-+ */
-+ ks->stop = 1;
-+
-+ for_each_cpu(cpu, G(ks)->cpumask) {
-+ ktap_pevent = kmem_cache_zalloc(pevent_cache, GFP_KERNEL);
-+ if (!ktap_pevent)
-+ return;
-+
-+ ktap_pevent->ks = ks;
-+ ktap_pevent->cl = cl;
-+ event = perf_event_create_kernel_counter(attr, cpu, task,
-+ ktap_overflow_callback,
-+ ktap_pevent);
-+ if (IS_ERR(event)) {
-+ int err = PTR_ERR(event);
-+ kp_error(ks, "unable register perf event %d on cpu %d, "
-+ "err: %d\n", attr->config, cpu, err);
-+ kp_free(ks, ktap_pevent);
-+ return;
-+ }
-+
-+ ktap_pevent->perf = event;
-+ INIT_LIST_HEAD(&ktap_pevent->list);
-+ list_add_tail(&ktap_pevent->list, &G(ks)->probe_events_head);
-+
-+ if (!filter)
-+ continue;
-+
-+ ret = kp_ftrace_profile_set_filter(event, attr->config, filter);
-+ if (ret) {
-+ kp_error(ks, "unable set filter %s for event id %d, "
-+ "ret: %d\n", filter, attr->config, ret);
-+ perf_destructor(ktap_pevent);
-+ list_del(&ktap_pevent->list);
-+ kp_free(ks, ktap_pevent);
-+ return;
-+ }
-+ }
-+}
-+
-+static void end_probes(struct ktap_state *ks)
-+{
-+ struct ktap_probe_event *ktap_pevent;
-+ struct list_head *tmp, *pos;
-+ struct list_head *head = &G(ks)->probe_events_head;
-+
-+ list_for_each(pos, head) {
-+ ktap_pevent = container_of(pos, struct ktap_probe_event,
-+ list);
-+ perf_destructor(ktap_pevent);
-+ }
-+ /*
-+ * Ensure our callback won't be called anymore. The buffers
-+ * will be freed after that.
-+ */
-+ tracepoint_synchronize_unregister();
-+
-+ list_for_each_safe(pos, tmp, head) {
-+ ktap_pevent = container_of(pos, struct ktap_probe_event,
-+ list);
-+ list_del(&ktap_pevent->list);
-+ kp_free(ks, ktap_pevent);
-+ }
-+}
-+
-+static int ktap_lib_probe_by_id(ktap_state *ks)
-+{
-+ ktap_closure *cl;
-+ struct task_struct *task = G(ks)->trace_task;
-+ ktap_eventdef_info evdef_info;
-+ char *filter = NULL;
-+ int *id_arr;
-+ int ret, i;
-+
-+ /* the number is userspace address refer to ktap_eventdef_info */
-+ kp_arg_check(ks, 1, KTAP_TNUMBER);
-+ kp_arg_check(ks, 2, KTAP_TFUNCTION);
-+
-+ ret = copy_from_user(&evdef_info, (void *)nvalue(kp_arg(ks, 1)),
-+ sizeof(evdef_info));
-+ if (ret < 0)
-+ return -1;
-+
-+ if (evdef_info.filter) {
-+ int len;
-+
-+ len = strlen_user(evdef_info.filter);
-+ if (len > 0x1000)
-+ return -1;
-+
-+ filter = kmalloc(len + 1, GFP_KERNEL);
-+ if (!filter)
-+ return -1;
-+
-+ if (strncpy_from_user(filter, evdef_info.filter, len) < 0) {
-+ kfree(filter);
-+ return -1;
-+ }
-+ }
-+
-+ id_arr = kmalloc(evdef_info.nr * sizeof(int), GFP_KERNEL);
-+ if (!id_arr) {
-+ kfree(filter);
-+ return -1;
-+ }
-+
-+ ret = copy_from_user(id_arr, evdef_info.id_arr,
-+ evdef_info.nr * sizeof(int));
-+ if (ret < 0) {
-+ kfree(filter);
-+ kfree(id_arr);
-+ return -1;
-+ }
-+
-+ cl = clvalue(kp_arg(ks, 2));
-+
-+ for (i = 0; i < evdef_info.nr; i++) {
-+ struct perf_event_attr attr;
-+
-+ memset(&attr, 0, sizeof(attr));
-+ attr.type = PERF_TYPE_TRACEPOINT;
-+ attr.config = id_arr[i];
-+ attr.sample_type = PERF_SAMPLE_RAW | PERF_SAMPLE_TIME |
-+ PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD;
-+ attr.sample_period = 1;
-+ attr.size = sizeof(attr);
-+ attr.disabled = 0;
-+
-+ kp_perf_event_register(ks, &attr, task, filter, cl);
-+ }
-+
-+ kfree(filter);
-+ kfree(id_arr);
-+ return 0;
-+}
-+
-+static int ktap_lib_probe_end(ktap_state *ks)
-+{
-+ kp_arg_check(ks, 1, KTAP_TFUNCTION);
-+
-+ G(ks)->trace_end_closure = clvalue(kp_arg(ks, 1));
-+ return 0;
-+}
-+
-+static int ktap_lib_traceoff(ktap_state *ks)
-+{
-+ end_probes(ks);
-+
-+ /* call trace_end_closure after probed end */
-+ if (G(ks)->trace_end_closure) {
-+ set_closure(ks->top, G(ks)->trace_end_closure);
-+ incr_top(ks);
-+ kp_call(ks, ks->top - 1, 0);
-+ G(ks)->trace_end_closure = NULL;
-+ }
-+
-+ return 0;
-+}
-+
-+void kp_probe_exit(ktap_state *ks)
-+{
-+ if (!G(ks)->trace_enabled)
-+ return;
-+
-+ end_probes(ks);
-+
-+ /* call trace_end_closure after probed end */
-+ if (!G(ks)->error && G(ks)->trace_end_closure) {
-+ set_closure(ks->top, G(ks)->trace_end_closure);
-+ incr_top(ks);
-+ kp_call(ks, ks->top - 1, 0);
-+ G(ks)->trace_end_closure = NULL;
-+ }
-+
-+ kmem_cache_destroy(G(ks)->pevent_cache);
-+ G(ks)->trace_enabled = 0;
-+}
-+
-+int kp_probe_init(ktap_state *ks)
-+{
-+ G(ks)->pevent_cache = KMEM_CACHE(ktap_probe_event, SLAB_PANIC);
-+ G(ks)->trace_enabled = 1;
-+ return 0;
-+}
-+
-+static const ktap_Reg kdebuglib_funcs[] = {
-+ {"probe_by_id", ktap_lib_probe_by_id},
-+ {"probe_end", ktap_lib_probe_end},
-+ {"traceoff", ktap_lib_traceoff},
-+ {NULL}
-+};
-+
-+void kp_init_kdebuglib(ktap_state *ks)
-+{
-+ kp_ftrace_profile_set_filter =
-+ (void *)kallsyms_lookup_name("ftrace_profile_set_filter");
-+ if (!kp_ftrace_profile_set_filter) {
-+ kp_error(ks, "ktap: cannot lookup ftrace_profile_set_filter "
-+ "in kallsyms\n");
-+ return;
-+ }
-+
-+ kp_register_lib(ks, "kdebug", kdebuglib_funcs);
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/runtime/lib_timer.c
-@@ -0,0 +1,193 @@
-+/*
-+ * timer.c - timer library support for ktap
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License 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/ctype.h>
-+#include <linux/slab.h>
-+#include <linux/delay.h>
-+#include <linux/sched.h>
-+#include "../include/ktap_types.h"
-+#include "ktap.h"
-+#include "kp_obj.h"
-+#include "kp_vm.h"
-+
-+struct hrtimer_ktap {
-+ struct hrtimer timer;
-+ ktap_state *ks;
-+ ktap_closure *cl;
-+ u64 ns;
-+ struct list_head list;
-+};
-+
-+/*
-+ * Currently ktap disallow tracing event in timer callback closure,
-+ * that will corrupt ktap_state and ktap stack, because timer closure
-+ * and event closure use same irq percpu ktap_state and stack.
-+ * We can use a different percpu ktap_state and stack for timer purpuse,
-+ * but that's don't bring any big value with cost on memory consuming.
-+ *
-+ * So just simply disable tracing in timer closure,
-+ * get_recursion_context()/put_recursion_context() is used for this purpose.
-+ */
-+static enum hrtimer_restart hrtimer_ktap_fn(struct hrtimer *timer)
-+{
-+ struct hrtimer_ktap *t;
-+ ktap_state *ks;
-+ int rctx;
-+
-+ rcu_read_lock_sched_notrace();
-+
-+ t = container_of(timer, struct hrtimer_ktap, timer);
-+ rctx = get_recursion_context(t->ks);
-+
-+ ks = kp_newthread(t->ks);
-+ set_closure(ks->top, t->cl);
-+ incr_top(ks);
-+ kp_call(ks, ks->top - 1, 0);
-+ kp_exitthread(ks);
-+
-+ hrtimer_add_expires_ns(timer, t->ns);
-+
-+ put_recursion_context(ks, rctx);
-+ rcu_read_unlock_sched_notrace();
-+
-+ return HRTIMER_RESTART;
-+}
-+
-+static void set_tick_timer(ktap_state *ks, u64 period, ktap_closure *cl)
-+{
-+ struct hrtimer_ktap *t;
-+
-+ t = kp_malloc(ks, sizeof(*t));
-+ t->ks = ks;
-+ t->cl = cl;
-+ t->ns = period;
-+
-+ INIT_LIST_HEAD(&t->list);
-+ list_add(&t->list, &(G(ks)->timers));
-+
-+ hrtimer_init(&t->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-+ t->timer.function = hrtimer_ktap_fn;
-+ hrtimer_start(&t->timer, ns_to_ktime(period), HRTIMER_MODE_REL);
-+}
-+
-+static void set_profile_timer(ktap_state *ks, u64 period, ktap_closure *cl)
-+{
-+ struct perf_event_attr attr;
-+
-+ memset(&attr, 0, sizeof(attr));
-+ attr.type = PERF_TYPE_SOFTWARE;
-+ attr.config = PERF_COUNT_SW_CPU_CLOCK;
-+ attr.sample_type = PERF_SAMPLE_RAW | PERF_SAMPLE_TIME |
-+ PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD;
-+ attr.sample_period = period;
-+ attr.size = sizeof(attr);
-+ attr.disabled = 0;
-+
-+ kp_perf_event_register(ks, &attr, NULL, NULL, cl);
-+}
-+
-+static int do_tick_profile(ktap_state *ks, int is_tick)
-+{
-+ const char *str, *tmp;
-+ char interval_str[32] = {0};
-+ char suffix[10] = {0};
-+ int n, i = 0;
-+ int factor;
-+
-+ kp_arg_check(ks, 1, KTAP_TSTRING);
-+ kp_arg_check(ks, 2, KTAP_TFUNCTION);
-+
-+ str = svalue(kp_arg(ks, 1));
-+ tmp = str;
-+ while (isdigit(*tmp))
-+ tmp++;
-+
-+ strncpy(interval_str, str, tmp - str);
-+ if (kstrtoint(interval_str, 10, &n))
-+ goto error;
-+
-+ strncpy(suffix, tmp, 9);
-+ while (suffix[i] != ' ' && suffix[i] != '\0')
-+ i++;
-+
-+ suffix[i] = '\0';
-+
-+ if (!strcmp(suffix, "s") || !strcmp(suffix, "sec"))
-+ factor = NSEC_PER_SEC;
-+ else if (!strcmp(suffix, "ms") || !strcmp(suffix, "msec"))
-+ factor = NSEC_PER_MSEC;
-+ else if (!strcmp(suffix, "us") || !strcmp(suffix, "usec"))
-+ factor = NSEC_PER_USEC;
-+ else
-+ goto error;
-+
-+ if (is_tick)
-+ set_tick_timer(ks, (u64)factor * n, clvalue(kp_arg(ks, 2)));
-+ else
-+ set_profile_timer(ks, (u64)factor * n, clvalue(kp_arg(ks, 2)));
-+
-+ return 0;
-+
-+ error:
-+ kp_error(ks, "cannot parse timer interval: %s\n", str);
-+ return -1;
-+}
-+
-+/*
-+ * tick-n probes fire on only one CPU per interval.
-+ * valid time suffixes: sec/s, msec/ms, usec/us
-+ */
-+static int ktap_lib_tick(ktap_state *ks)
-+{
-+ return do_tick_profile(ks, 1);
-+}
-+
-+/*
-+ * A profile-n probe fires every fixed interval on every CPU
-+ * valid time suffixes: sec/s, msec/ms, usec/us
-+ */
-+static int ktap_lib_profile(ktap_state *ks)
-+{
-+ return do_tick_profile(ks, 0);
-+}
-+
-+void kp_exit_timers(ktap_state *ks)
-+{
-+ struct hrtimer_ktap *t, *tmp;
-+ struct list_head *timers_list = &(G(ks)->timers);
-+
-+ list_for_each_entry_safe(t, tmp, timers_list, list) {
-+ hrtimer_cancel(&t->timer);
-+ kp_free(ks, t);
-+ }
-+}
-+
-+static const ktap_Reg timerlib_funcs[] = {
-+ {"profile", ktap_lib_profile},
-+ {"tick", ktap_lib_tick},
-+ {NULL}
-+};
-+
-+void kp_init_timerlib(ktap_state *ks)
-+{
-+ kp_register_lib(ks, "timer", timerlib_funcs);
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/ansi/ansi_color_demo.kp
-@@ -0,0 +1,22 @@
-+#!/usr/bin/env ktap
-+
-+#this script demonstrate how to use ktap to output color text.
-+
-+ansi.clear_screen()
-+
-+ansi.set_color(32)
-+printf("this line should be Green color\n")
-+
-+ansi.set_color(31)
-+printf("this line should be Red color\n")
-+
-+ansi.set_color2(34, 43)
-+printf("this line should be Blue color, with Yellow background\n")
-+
-+ansi.reset_color()
-+ansi.set_color3(34, 46, 4)
-+printf("this line should be Blue color, with Cyan background, underline single attribute\n")
-+
-+ansi.reset_color()
-+ansi.new_line()
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/basic/backtrace.kp
-@@ -0,0 +1,6 @@
-+#!/usr/bin/env ktap
-+
-+trace sched:sched_switch {
-+ print_backtrace()
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/basic/event_trigger.kp
-@@ -0,0 +1,24 @@
-+#!/usr/bin/env ktap
-+
-+soft_disabled = 1
-+this_cpu = 0
-+
-+trace syscalls:sys_enter_open {
-+ print(argevent)
-+ soft_disabled = 0
-+ this_cpu = cpu()
-+}
-+
-+trace *:* {
-+ if (soft_disabled == 0 && cpu() == this_cpu) {
-+ print(argevent)
-+ }
-+}
-+
-+trace syscalls:sys_exit_open {
-+ print(argevent)
-+ if (cpu() == this_cpu) {
-+ exit()
-+ }
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/basic/event_trigger_ftrace.kp
-@@ -0,0 +1,28 @@
-+#!/usr/bin/env ktap
-+
-+
-+#This ktap script will output all function calling between
-+#sys_enter_open and sys_exit_open, in one cpu.
-+
-+soft_disabled = 1
-+this_cpu = 0
-+
-+trace syscalls:sys_enter_open {
-+ print(argevent)
-+ soft_disabled = 0
-+ this_cpu = cpu()
-+}
-+
-+trace ftrace:function {
-+ if (soft_disabled == 0 && cpu() == this_cpu) {
-+ print(argevent)
-+ }
-+}
-+
-+trace syscalls:sys_exit_open {
-+ print(argevent)
-+ if (cpu() == this_cpu) {
-+ exit()
-+ }
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/basic/ftrace.kp
-@@ -0,0 +1,6 @@
-+#!/usr/bin/env ktap
-+
-+trace ftrace:function /ip==mutex*/ {
-+ print(cpu(), pid(), execname(), argevent)
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/basic/function_time.kp
-@@ -0,0 +1,57 @@
-+#!/usr/bin/env ktap
-+
-+#Demo for thread-local variable
-+#
-+#Note this kind of function time tracing already handled concurrent issue,
-+#but not aware on the recursion problem, user need to aware this limitation,
-+#so don't use this script to trace function which could be called recursive.
-+
-+self = {}
-+count_max = 0
-+count_min = 0
-+count_num = 0
-+total_time = 0
-+
-+printf("measure time(us) of function vfs_read\n");
-+
-+trace probe:vfs_read {
-+ if (execname() == "ktap") {
-+ return
-+ }
-+
-+ self[tid()] = gettimeofday_us()
-+}
-+
-+trace probe:vfs_read%return {
-+ if (execname() == "ktap") {
-+ return
-+ }
-+
-+ if (self[tid()] == nil) {
-+ return
-+ }
-+
-+ local durtion = gettimeofday_us() - self[tid()]
-+ if (durtion > count_max) {
-+ count_max = durtion
-+ }
-+ local min = count_min
-+ if (min == 0 || durtion < min) {
-+ count_min = durtion
-+ }
-+
-+ count_num = count_num + 1
-+ total_time = total_time + durtion
-+
-+ self[tid()] = nil
-+}
-+
-+trace_end {
-+ printf("avg\tmax\tmin\n");
-+ printf("-------------------\n")
-+
-+ printf("%d\t%d\t%d\n", total_time/count_num,
-+ count_max, count_min)
-+}
-+
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/basic/kretprobe.kp
-@@ -0,0 +1,6 @@
-+#!/usr/bin/env ktap
-+
-+trace probe:vfs_read%return fd=$retval {
-+ print(execname(), argevent);
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/ffi/ffi_kmalloc.kp
-@@ -0,0 +1,19 @@
-+#!/usr/bin/env ktap
-+
-+cdef[[
-+ typedef unsigned gfp_t;
-+ typedef unsigned long size_t;
-+ void *__kmalloc( size_t size, gfp_t flags);
-+ void kfree(const void *objp);
-+]]
-+
-+t1 = gettimeofday_us()
-+
-+for (i = 1, 1000, 1) {
-+ local object = C.__kmalloc(128, 208) #GFP_KERNEL is 208
-+ C.kfree(object)
-+}
-+
-+t2 = gettimeofday_us()
-+
-+printf("execution time: %d us\n", t2 - t1)
---- /dev/null
-+++ b/drivers/staging/ktap/samples/ffi/printk.kp
-@@ -0,0 +1,10 @@
-+cdef[[
-+ int printk(char *fmt, ...);
-+]]
-+
-+
-+C.printk("This is printed out by ffi\n")
-+C.printk("Show me the %s\n", "code")
-+C.printk("%s should be at %02d/%02d %02d:%02d:%02d\n", "New Year", 1, 1, 0, 0, 0)
-+C.printk("\'a\' + 5 = \'%c\'\n", 95 + 5)
-+C.printk("The string is located at 0x%p\n", "str")
---- /dev/null
-+++ b/drivers/staging/ktap/samples/ffi/sched_clock.kp
-@@ -0,0 +1,6 @@
-+cdef[[
-+ unsigned long long sched_clock();
-+]]
-+
-+ret = C.sched_clock()
-+print("C.sched_clock returned, value: ", ret)
---- /dev/null
-+++ b/drivers/staging/ktap/samples/game/tetris.kp
-@@ -0,0 +1,293 @@
-+#!/usr/bin/env ktap
-+
-+#
-+# Tetris KTAP Script
-+#
-+# Copyright (C) 2013/OCT/05 Tadaki SAKAI
-+#
-+# based on stapgames (Systemtap Game Collection)
-+# https://github.com/mhiramat/stapgames/blob/master/games/tetris.stp
-+#
-+# - Requirements
-+# Kernel Configuration: CONFIG_KPROBE_EVENT=y
-+# CONFIG_EVENT_TRACING=y
-+# CONFIG_PERF_EVENTS=y
-+# CONFIG_DEBUG_FS=y
-+# CPU Architecture : x86_64
-+#
-+# - Setup
-+# $ sudo mount -t debugfs none /sys/kernel/debug/
-+#
-+# $ git clone https://github.com/ktap/ktap
-+# $ cd ktap
-+# $ make 2>&1 | tee ../make.log
-+# $ sudo make load
-+# $ sudo sh -c 'echo 50000 > /sys/module/ktapvm/parameters/max_exec_count'
-+#
-+# - Run Tetris
-+# $ sudo ./ktap samples/game/tetris.kp
-+#
-+
-+
-+#
-+# utils
-+#
-+
-+function rand(max) {
-+ r = gettimeofday_us()
-+ if (r < 0) {
-+ r = r * -1
-+ }
-+ return r % max
-+}
-+
-+function update_display() {
-+ for (i = 0, 239, 1) {
-+ if ((i % 12 - 11) != 0) {
-+ tmp = ""
-+ } else {
-+ tmp = "\n"
-+ }
-+
-+ if (display_buffer[240 + i] == empty) {
-+ printf(" %s", tmp)
-+ } else {
-+ color = display_buffer[240 + i] + 40
-+ ansi.set_color2(color, color)
-+ printf(" %s", tmp)
-+ ansi.reset_color()
-+ }
-+
-+ # clear the display buffer
-+ display_buffer[240 + i] = display_buffer[i]
-+ }
-+
-+ printf("%d\n",point)
-+}
-+
-+
-+#
-+# global value
-+#
-+
-+empty = -1
-+
-+key_code = 0
-+point = 0
-+block_number = 0
-+height = 0
-+height_update = 0
-+
-+destination_position = {}
-+display_buffer = {}
-+
-+block_data0 = {}
-+block_data1 = {}
-+block_data2 = {}
-+block_data3 = {}
-+block_data4 = {}
-+block_data5 = {}
-+block_data6 = {}
-+block_table = {}
-+
-+#
-+# Initialize
-+#
-+
-+# Create blocks
-+# block is represented by the position from the center.
-+# Every block has "L" part in the center except for a bar.
-+block_data0[0] = -11 # non-"L" part for each block
-+block_data1[0] = -24
-+block_data2[0] = 2
-+block_data3[0] = 13
-+block_data4[0] = -13
-+block_data5[0] = -1
-+block_data6[0] = 2
-+
-+block_table[0] = block_data0
-+block_table[1] = block_data1
-+block_table[2] = block_data2
-+block_table[3] = block_data3
-+block_table[4] = block_data4
-+block_table[5] = block_data5
-+block_table[6] = block_data6
-+
-+for (i = 0, len(block_table) - 1, 1) {
-+ # common "L" part
-+ block_table[i][1] = 0
-+ block_table[i][2] = 1
-+ block_table[i][3] = -12
-+}
-+
-+block_table[6][3] = -1 # bar is not common
-+# Position: 1 row has 12 columns,
-+# and (x, y) is represented by h = x + y * 12.p
-+height = 17 # First block position (center)
-+
-+for (i = 0, 240, 1) {
-+ # Wall and Floor (sentinel)
-+ if (((i % 12) < 2) || (i > 228)) {
-+ tmp = 7 # White
-+ } else {
-+ tmp = empty
-+ }
-+ display_buffer[i - 1] = tmp
-+ display_buffer[240 + i - 1] = tmp
-+}
-+
-+block_number = rand(7)
-+
-+ansi.clear_screen()
-+
-+
-+#
-+# Key Input
-+#
-+
-+trace probe:kbd_event handle=%di event_type=%si event_code=%dx value=%cx {
-+ # Only can run it in x86_64
-+ #
-+ # Register follow x86_64 call conversion:
-+ #
-+ # x86_64:
-+ # %rcx 4 argument
-+ # %rdx 3 argument
-+ # %rsi 2 argument
-+ # %rdi 1 argument
-+
-+ local event_code = arg4
-+ local value = arg5
-+
-+ if (value != 0) {
-+ if ((event_code - 4) != 0) {
-+ key_code = event_code
-+ }
-+ }
-+}
-+
-+
-+#
-+# timer
-+#
-+
-+tick-200ms {
-+ ansi.clear_screen()
-+
-+ f = 0 # move/rotate flag
-+
-+ if (key_code != 0) { # if key is pressed
-+ if(key_code != 103) { #move left or right
-+ # d: movement direction
-+ if ((key_code - 105) != 0) {
-+ if ((key_code - 106) != 0) {
-+ d = 0
-+ } else {
-+ d = 1
-+ }
-+ } else {
-+ d = -1
-+ }
-+
-+ for (i = 0, 3, 1) { # check if the block can be moved
-+ # destination is free
-+ if (display_buffer[height +
-+ block_table[block_number][i] + d]
-+ != empty) {
-+ f = 1
-+ }
-+ }
-+ # move if destinations of every block are free
-+ if (f == 0) {
-+ height = height + d
-+ }
-+ } else { # rotate
-+ for (i = 0, 3, 1) { # check if block can be rotated
-+ # each block position
-+ p = block_table[block_number][i]
-+
-+ # destination x pos(p/12 rounded)
-+ v = (p * 2 + 252) / 24 - 10
-+ w = p - v * 12 # destination y pos
-+
-+ # destination position
-+ destination_position[i] = w * 12 - v
-+
-+ # check if desetination is free
-+ if (display_buffer[height +
-+ destination_position[i]] != empty) {
-+ f = 1
-+ }
-+ }
-+
-+ if (f == 0) {
-+ # rotate if destinations of every block
-+ # are free
-+ for (i = 0, 3, 1) {
-+ block_table[block_number][i] =
-+ destination_position[i]
-+ }
-+ }
-+ }
-+ }
-+ key_code = 0 # clear the input key
-+
-+ f = 0
-+ for (i = 0, 3, 1) { # drop 1 row
-+ # check if destination is free
-+ p = height + block_table[block_number][i]
-+ if (display_buffer[12 + p] != empty) {
-+ f = 1
-+ }
-+
-+ # copy the moving block to display buffer
-+ display_buffer[240 + p] = block_number
-+ }
-+
-+ if ((f == 1) && (height == 17)) {
-+ update_display()
-+ exit() # exit if there are block at initial position
-+ }
-+
-+ height_update = !height_update
-+ if (height_update != 0) {
-+ if(f != 0) { # the block can't drop anymore
-+ for (i = 0, 3, 1) {
-+ # fix the block
-+ display_buffer[height +
-+ block_table[block_number][i]] = block_number
-+ }
-+ # determin the next block
-+ block_number = rand(7)
-+ height = 17 # make the block to initial position
-+ } else {
-+ height = height + 12 # drop the block 1 row
-+ }
-+ }
-+
-+ k = 1
-+ for (i = 18, 0, -1) { #check if line is filled
-+ # search for filled line
-+ j = 10
-+ while ((j > 0) &&
-+ (display_buffer[i * 12 + j] != empty)) {
-+ j = j - 1
-+ }
-+
-+ if (j == 0) { # filled!
-+ # add a point: 1 line - 1 point, ..., tetris - 10points
-+ point = point + k
-+ k = k + 1
-+
-+ # drop every upper block
-+ j = (i + 1) * 12
-+ i = i + 1
-+ while (j > 2 * 12) {
-+ j = j - 1
-+ display_buffer[j] = display_buffer[j - 12]
-+ }
-+ }
-+ }
-+
-+ update_display()
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/helloworld.kp
-@@ -0,0 +1,3 @@
-+#!/usr/bin/env ktap
-+
-+print("Hello World! I am ktap")
---- /dev/null
-+++ b/drivers/staging/ktap/samples/interrupt/hardirq_time.kp
-@@ -0,0 +1,24 @@
-+#!/usr/bin/env ktap
-+
-+#this script output each average consumimg time of each hardirq
-+s = ptable()
-+map = {}
-+
-+trace irq:irq_handler_entry {
-+ map[cpu()] = gettimeofday_us()
-+}
-+
-+trace irq:irq_handler_exit {
-+ local entry_time = map[cpu()]
-+ if (entry_time == nil) {
-+ return;
-+ }
-+
-+ s[arg1] <<< gettimeofday_us() - entry_time
-+ map[cpu()] = nil
-+}
-+
-+trace_end {
-+ print(s)
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/interrupt/softirq_time.kp
-@@ -0,0 +1,24 @@
-+#!/usr/bin/env ktap
-+
-+#this script output each average consumimg time of each softirq line
-+s = ptable()
-+map = {}
-+
-+trace irq:softirq_entry {
-+ map[cpu()] = gettimeofday_us()
-+}
-+
-+trace irq:softirq_exit {
-+ local entry_time = map[cpu()]
-+ if (entry_time == nil) {
-+ return;
-+ }
-+
-+ s[arg1] <<< gettimeofday_us() - entry_time
-+ map[cpu()] = nil
-+}
-+
-+trace_end {
-+ print(s)
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/io/kprobes-do-sys-open.kp
-@@ -0,0 +1,20 @@
-+#!/usr/bin/env ktap
-+
-+#Only can run it in x86_64
-+#
-+#Register follow x86_64 call conversion:
-+#
-+#x86_64:
-+# %rcx 4 argument
-+# %rdx 3 argument
-+# %rsi 2 argument
-+# %rdi 1 argument
-+
-+trace probe:do_sys_open dfd=%di filename=%si flags=%dx mode=%cx {
-+ printf("[do_sys_open entry]: (%s) open file (%s)\n",
-+ execname(), user_string(arg3))
-+}
-+
-+trace probe:do_sys_open%return fd=$retval {
-+ printf("[do_sys_open exit]: return fd (%d)\n", arg3)
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/io/traceio.kp
-@@ -0,0 +1,54 @@
-+#! /usr/bin/env ktap
-+
-+# Based on systemtap traceio.stp
-+
-+reads = ptable()
-+writes = ptable()
-+total_io = ptable()
-+
-+trace syscalls:sys_exit_read {
-+ reads[execname()] <<< arg2
-+ total_io[execname()] <<< arg2
-+}
-+
-+trace syscalls:sys_exit_write {
-+ writes[execname()] <<< arg2
-+ total_io[execname()] <<< arg2
-+}
-+
-+function humanread_digit(bytes) {
-+ if (bytes > 1024*1024*1024) {
-+ return bytes/1024/1024/1024
-+ } elseif (bytes > 1024*1024) {
-+ return bytes/1024/1024
-+ } elseif (bytes > 1024) {
-+ return bytes/1024
-+ } else {
-+ return bytes
-+ }
-+}
-+
-+function humanread_x(bytes) {
-+ if (bytes > 1024*1024*1024) {
-+ return " GiB"
-+ } elseif (bytes > 1024*1024) {
-+ return " MiB"
-+ } elseif (bytes > 1024) {
-+ return " KiB"
-+ } else {
-+ return " B"
-+ }
-+}
-+
-+tick-1s {
-+ ansi.clear_screen()
-+ for (exec, _ in pairs(total_io)) {
-+ local readnum = sum(reads[exec])
-+ local writenum = sum(writes[exec])
-+ printf("%15s r: %12d%s w: %12d%s\n", exec,
-+ humanread_digit(readnum), humanread_x(readnum),
-+ humanread_digit(writenum), humanread_x(writenum))
-+ }
-+ printf("\n")
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/mem/kmalloc-top.kp
-@@ -0,0 +1,17 @@
-+#!/usr/bin/env ktap
-+
-+kmalloc_stack = {}
-+
-+trace kmem:kmalloc {
-+ kmalloc_stack[backtrace()] += 1
-+}
-+
-+tick-60s {
-+ for (k, v in pairs(kmalloc_stack)) {
-+ print(k)
-+ printf("%d\n\n", v)
-+ }
-+
-+ exit()
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/mem/kmem.kp
-@@ -0,0 +1,30 @@
-+#!/usr/bin/env ktap
-+
-+count1 = 0
-+trace kmem:kmalloc {
-+ count1 = count1 + 1
-+}
-+
-+count2 = 0
-+trace kmem:kfree {
-+ count2 = count2 + 1
-+}
-+
-+count3 = 0
-+trace kmem:mm_page_alloc {
-+ count3 = count3 + 1
-+}
-+
-+count4 = 0
-+trace kmem:mm_page_free {
-+ count4 = count4 + 1
-+}
-+
-+trace_end {
-+ print("\n")
-+ print("kmem:kmalloc:\t", count1)
-+ print("kmem:kfree:\t", count2)
-+ print("kmem:mm_page_alloc:", count3)
-+ print("kmem:mm_page_free:", count4)
-+ print("trace ending\n")
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/profiling/function_profiler.kp
-@@ -0,0 +1,41 @@
-+#!/usr/bin/env ktap
-+
-+#kernel function profile
-+#You can use this script to know what function is called frequently,
-+#without enable CONFIG_FUNCTION_PROFILER in kernel.
-+
-+s = ptable()
-+
-+trace ftrace:function {
-+ s[arg1] <<< 1
-+}
-+
-+trace_end {
-+ histogram(s)
-+}
-+
-+#sample output
-+#^C
-+# value ------------- Distribution ------------- count
-+# sub_preempt_count | @@@@@ 34904
-+# add_preempt_count | @@@@@ 33435
-+# nsecs_to_jiffies64 | @@@ 19919
-+# irqtime_account_process_tick... | @ 9970
-+# account_idle_time | @ 9880
-+# _raw_spin_lock | 5100
-+# _raw_spin_unlock | 5021
-+# _raw_spin_unlock_irqrestore | 4235
-+# _raw_spin_lock_irqsave | 4232
-+# __rcu_read_lock | 3373
-+# __rcu_read_unlock | 3373
-+# lookup_address | 2392
-+# pfn_range_is_mapped | 2384
-+# update_cfs_rq_blocked_load | 1983
-+# idle_cpu | 1808
-+# ktime_get | 1394
-+# _raw_spin_unlock_irq | 1270
-+# _raw_spin_lock_irq | 1091
-+# update_curr | 950
-+# irqtime_account_irq | 950
-+# ... |
-+#
---- /dev/null
-+++ b/drivers/staging/ktap/samples/profiling/stack_profile.kp
-@@ -0,0 +1,30 @@
-+#!/usr/bin/env ktap
-+
-+# This ktap script samples stacktrace of system per 10us,
-+# you can use generated output to make a flame graph.
-+#
-+# Flame Graphs:
-+# http://dtrace.org/blogs/brendan/2012/03/17/linux-kernel-performance-flame-graphs/
-+
-+s = ptable()
-+
-+profile-10us {
-+ #skip 12 stack entries, and dump all remain entries.
-+ s[backtrace(12, -1)] <<< 1
-+}
-+
-+tick-60s {
-+ exit()
-+}
-+
-+trace_end {
-+ function cmp(v1, v2) {
-+ return (count(v1) < count(v2))
-+ }
-+ for (k, v in sort_pairs(s, cmp)) {
-+ print(k)
-+ print(count(v))
-+ print()
-+ }
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/schedule/sched_transition.kp
-@@ -0,0 +1,5 @@
-+#!/usr/bin/env ktap
-+
-+trace sched:sched_switch {
-+ printf("%s ... ", arg1)
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/schedule/schedtimes.kp
-@@ -0,0 +1,125 @@
-+#!/usr/vin/env ktap
-+
-+#schedtimer.kp
-+#Initially inspired by Systemtap schedtimes.stp
-+#and more bugfree compare with Systemtap's version
-+#
-+#Note that the time value is associate with pid, not with execname strictly,
-+#sometime you will found there have sleep time for command "ls", the reason
-+#is that sleep time is belong to parent process bash, so clear on this.
-+
-+RUNNING = 0
-+QUEUED = 1
-+SLEEPING = 2
-+DEAD = 64
-+
-+run_time = {}
-+queued_time = {}
-+sleep_time = {}
-+io_wait_time = {}
-+
-+pid_state = {}
-+pid_names = {}
-+prev_timestamp = {}
-+io_wait = {}
-+
-+trace sched:sched_switch {
-+ local prev_comm = arg1
-+ local prev_pid = arg2
-+ local prev_state = arg4
-+ local next_comm = arg5
-+ local next_pid = arg6
-+ local t = gettimeofday_us()
-+
-+ if (pid_state[prev_pid] == nil) {
-+ #do nothing
-+ } elseif (pid_state[prev_pid] == RUNNING) {
-+ run_time[prev_pid] += t - prev_timestamp[prev_pid]
-+ } elseif (pid_state[prev_pid] == QUEUED) {
-+ #found this:
-+ #sched_wakeup comm=foo
-+ #sched_switch prev_comm=foo
-+ run_time[prev_pid] += t - prev_timestamp[prev_pid]
-+ }
-+
-+ pid_names[prev_pid] = prev_comm
-+ prev_timestamp[prev_pid] = t
-+
-+ if (prev_state == DEAD) {
-+ pid_state[prev_pid] = DEAD
-+ } elseif (prev_state > 0) {
-+ if (in_iowait() == 1) {
-+ io_wait[prev_pid] = 1
-+ }
-+ pid_state[prev_pid] = SLEEPING
-+ } elseif (prev_state == 0) {
-+ pid_state[prev_pid] = QUEUED
-+ }
-+
-+ if (pid_state[next_pid] == nil) {
-+ pid_state[next_pid] = RUNNING
-+ } elseif (pid_state[next_pid] == QUEUED) {
-+ queued_time[next_pid] += t - prev_timestamp[next_pid]
-+ pid_state[next_pid] = RUNNING
-+ }
-+
-+ pid_names[next_pid] = next_comm
-+ prev_timestamp[next_pid] = t
-+}
-+
-+trace sched:sched_wakeup, sched:sched_wakeup_new {
-+ local comm = arg1
-+ local wakeup_pid = arg2
-+ local success = arg4
-+ local t = gettimeofday_us()
-+
-+ if (pid_state[wakeup_pid] == nil) {
-+ #do nothing
-+ } elseif (pid_state[wakeup_pid] == SLEEPING) {
-+ local durtion = t - prev_timestamp[wakeup_pid]
-+
-+ sleep_time[wakeup_pid] += durtion
-+ if (io_wait[wakeup_pid] == 1) {
-+ io_wait_time[wakeup_pid] += durtion
-+ io_wait[wakeup_pid] = 0
-+ }
-+ } elseif (pid_state[wakeup_pid] == RUNNING) {
-+ return
-+ }
-+
-+ pid_names[wakeup_pid] = comm
-+ prev_timestamp[wakeup_pid] = t
-+ pid_state[wakeup_pid] = QUEUED
-+}
-+
-+trace_end {
-+ local t = gettimeofday_us()
-+
-+ for (pid, state in pairs(pid_state)) {
-+ local durtion = t - prev_timestamp[pid]
-+ if (state == SLEEPING) {
-+ sleep_time[pid] += durtion
-+ } elseif (state == QUEUED) {
-+ queued_time[pid] += durtion
-+ } elseif (state == RUNNING) {
-+ run_time[pid] += durtion
-+ }
-+ }
-+
-+ printf ("%16s: %6s %10s %10s %10s %10s %10s\n\n",
-+ "execname", "pid", "run(us)", "sleep(us)", "io_wait(us)",
-+ "queued(us)", "total(us)")
-+
-+ for (pid, time in pairs(run_time)) {
-+ if (sleep_time[pid] == nil) {
-+ sleep_time[pid] = 0
-+ }
-+ if (queued_time[pid] == nil) {
-+ queue_time[pid] = 0
-+ }
-+ printf("%16s: %6d %10d %10d %10d %10d %10d\n",
-+ pid_names[pid], pid, run_time[pid], sleep_time[pid],
-+ io_wait_time[pid], queued_time[pid],
-+ run_time[pid] + sleep_time[pid] + queued_time[pid]);
-+ }
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/syscalls/errinfo.kp
-@@ -0,0 +1,145 @@
-+#!/usr/bin/env ktap
-+
-+#errdesc get from include/uapi/asm-generic/errno*.h
-+errdesc = {
-+ [1] = "Operation not permitted", #EPERM
-+ [2] = "No such file or directory", #ENOENT
-+ [3] = "No such process", #ESRCH
-+ [4] = "Interrupted system call", #EINRT
-+ [5] = "I/O error", #EIO
-+ [6] = "No such device or address", #ENXIO
-+ [7] = "Argument list too long", #E2BIG
-+ [8] = "Exec format error", #ENOEXEC
-+ [9] = "Bad file number", #EBADF
-+ [10] = "No child processes", #ECHILD
-+ [11] = "Try again", #EAGAIN
-+ [12] = "Out of memory", #ENOMEM
-+ [13] = "Permission denied", #EACCES
-+ [14] = "Bad address", #EFAULT
-+ [15] = "Block device required", #ENOTBLK
-+ [16] = "Device or resource busy", #EBUSY
-+ [17] = "File exists", #EEXIST
-+ [18] = "Cross-device link", #EXDEV
-+ [19] = "No such device", #ENODEV
-+ [20] = "Not a directory", #ENOTDIR
-+ [21] = "Is a directory", #EISDIR
-+ [22] = "Invalid argument", #EINVAL
-+ [23] = "File table overflow", #ENFILE
-+ [24] = "Too many open files", #EMFILE
-+ [25] = "Not a typewriter", #ENOTTY
-+ [26] = "Text file busy", #ETXTBSY
-+ [27] = "File too large", #EFBIG
-+ [28] = "No space left on device", #ENOSPC
-+ [29] = "Illegal seek", #ESPIPE
-+ [30] = "Read-only file system", #EROFS
-+ [31] = "Too many links", #EMLINK
-+ [32] = "Broken pipe", #EPIPE
-+ [33] = "Math argument out of domain of func", #EDOM
-+ [34] = "Math result not representable", #ERANGE
-+
-+ [35] = "Resource deadlock would occur", #EDEADLK
-+ [36] = "File name too long", #ENAMETOOLONG
-+ [37] = "No record locks available", #ENOLCK
-+ [38] = "Function not implemented", #ENOSYS
-+ [39] = "Directory not empty", #ENOTEMPTY
-+ [40] = "Too many symbolic links encountered", #ELOOP
-+ [42] = "No message of desired type", #ENOMSG
-+ [43] = "Identifier removed", #EIDRM
-+ [44] = "Channel number out of range", #ECHRNG
-+ [45] = "Level 2 not synchronized", #EL2NSYNC
-+ [46] = "Level 3 halted", #EL3HLT
-+ [47] = "Level 3 reset", #EL3RST
-+ [48] = "Link number out of range", #ELNRNG
-+ [49] = "Protocol driver not attached", #EUNATCH
-+ [50] = "No CSI structure available", #ENOCSI
-+ [51] = "Level 2 halted", #EL2HLT
-+ [52] = "Invalid exchange", #EBADE
-+ [53] = "Invalid request descriptor", #EBADR
-+ [54] = "Exchange full", #EXFULL
-+ [55] = "No anode", #ENOANO
-+ [56] = "Invalid request code", #EBADRQC
-+ [57] = "Invalid slot", #EBADSLT
-+
-+ [59] = "Bad font file format", #EBFONT
-+ [60] = "Device not a stream", #ENOSTR
-+ [61] = "No data available", #ENODATA
-+ [62] = "Timer expired", #ETIME
-+ [63] = "Out of streams resources", #ENOSR
-+ [64] = "Machine is not on the network", #ENONET
-+ [65] = "Package not installed", #ENOPKG
-+ [66] = "Object is remote", #EREMOTE
-+ [67] = "Link has been severed", #ENOLINK
-+ [68] = "Advertise error", #EADV
-+ [69] = "Srmount error", #ESRMNT
-+ [70] = "Communication error on send", #ECOMM
-+ [71] = "Protocol error", #EPROTO
-+ [72] = "Multihop attempted", #EMULTIHOP
-+ [73] = "RFS specific error", #EDOTDOT
-+ [74] = "Not a data message", #EBADMSG
-+ [75] = "Value too large for defined data type", #EOVERFLOW
-+ [76] = "Name not unique on network", #ENOTUNIQ
-+ [77] = "File descriptor in bad state", #EBADFD
-+ [78] = "Remote address changed", #EREMCHG
-+ [79] = "Can not access a needed shared library", #ELIBACC
-+ [80] = "Accessing a corrupted shared library", #ELIBBAD
-+ [81] = ".lib section in a.out corrupted", #ELIBSCN
-+ [82] = "Attempting to link in too many shared libraries", #ELIBMAX
-+ [83] = "Cannot exec a shared library directly", #ELIBEXEC
-+ [84] = "Illegal byte sequence", #EILSEQ
-+ [85] = "Interrupted system call should be restarted", #ERESTART
-+ [86] = "Streams pipe error", #ESTRPIPE
-+ [87] = "Too many users", #EUSERS
-+ [88] = "Socket operation on non-socket", #ENOTSOCK
-+ [89] = "Destination address required", #EDESTADDRREQ
-+ [90] = "Message too long", #EMSGSIZE
-+ [91] = "Protocol wrong type for socket", #EPROTOTYPE
-+ [92] = "Protocol not available", #ENOPROTOOPT
-+ [93] = "Protocol not supported", #EPROTONOSUPPORT
-+ [94] = "Socket type not supported", #ESOCKTNOSUPPORT
-+ [95] = "Operation not supported on transport endpoint", #EOPNOTSUPP
-+ [96] = "Protocol family not supported", #EPFNOSUPPORT
-+ [97] = "Address family not supported by protocol", #EAFNOSUPPORT
-+ [98] = "Address already in use", #EADDRINUSE
-+ [99] = "Cannot assign requested address", #EADDRNOTAVAIL
-+ [100] = "Network is down", #ENETDOWN
-+ [101] = "Network is unreachable", #ENETUNREACH
-+ [102] = "Network dropped connection because of reset", #ENETRESET
-+ [103] = "Software caused connection abort", #ECONNABORTED
-+ [104] = "Connection reset by peer", #ECONNRESET
-+ [105] = "No buffer space available", #ENOBUFS
-+ [106] = "Transport endpoint is already connected", #EISCONN
-+ [107] = "Transport endpoint is not connected", #ENOTCONN
-+ [108] = " Cannot send after transport endpoint shutdown", #ESHUTDOWN
-+ [109] = "Too many references: cannot splice", #ETOOMANYREFS
-+ [110] = "Connection timed out", #ETIMEDOUT
-+ [111] = "Connection refused", #ECONNREFUSED
-+ [112] = "Host is down", #EHOSTDOWN
-+ [113] = "No route to host", #EHOSTUNREACH
-+ [114] = "Operation already in progress", #EALREADY
-+ [115] = "Operation now in progress", #EINPROGRESS
-+ [116] = "Stale NFS file handle", #ESTALE
-+ [117] = "Structure needs cleaning", #EUCLEAN
-+ [118] = "Not a XENIX named type file", #ENOTNAM
-+ [119] = "No XENIX semaphores available", #ENAVAIL
-+ [120] = "Is a named type file", #EISNAM
-+ [121] = "Remote I/O error", #EREMOTEIO
-+ [122] = "Quota exceeded", #EDQUOT
-+ [123] = "No medium found", #ENOMEDIUM
-+ [124] = "Wrong medium type", #EMEDIUMTYPE
-+ [125] = "Operation Canceled", #ECANCELED
-+ [126] = "Required key not available", #ENOKEY
-+ [127] = "Key has expired", #EKEYEXPIRED
-+ [128] = "Key has been revoked", #EKEYREVOKED
-+ [129] = "Key was rejected by service", #EKEYREJECTED
-+ [130] = "Owner died", #EOWNERDEAD
-+ [131] = "State not recoverable", #ENOTRECOVERABLE
-+
-+}
-+
-+trace syscalls:sys_exit_* {
-+ if (arg2 < 0) {
-+ local errno = -arg2
-+ printf("%-15s%-20s\t%d\t%-30s\n",
-+ execname(), argname, errno, errdesc[errno])
-+ }
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/syscalls/execve.kp
-@@ -0,0 +1,8 @@
-+#!/usr/bin/env ktap
-+
-+#This script trace filename of process execution
-+#only tested in x86-64
-+
-+trace probe:do_execve filename=%di {
-+ printf("[do_execve entry]: (%s) name=%s\n", execname(), kernel_string(arg2))
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/syscalls/opensnoop.kp
-@@ -0,0 +1,31 @@
-+#!/usr/local/bin/ktap -q
-+#
-+# opensnoop.kp trace open syscalls with pathnames and basic info
-+#
-+# 23-Nov-2013 Brendan Gregg Created this
-+
-+path = {}
-+
-+printf("%5s %6s %-12s %3s %3s %s\n", "UID", "PID", "COMM", "FD", "ERR", "PATH");
-+
-+trace syscalls:sys_enter_open {
-+ path[tid()] = user_string(arg2)
-+}
-+
-+trace syscalls:sys_exit_open {
-+ local fd
-+ local errno
-+
-+ if (arg2 < 0) {
-+ fd = 0
-+ errno = -arg2
-+ } else {
-+ fd = arg2
-+ errno = 0
-+ }
-+
-+ printf("%5d %6d %-12s %3d %3d %s\n", uid(), pid(), execname(), fd,
-+ errno, path[tid()])
-+
-+ path[tid()] = 0
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/syscalls/sctop.kp
-@@ -0,0 +1,13 @@
-+#! /usr/bin/env ktap
-+
-+s = {}
-+
-+trace syscalls:sys_enter_* {
-+ s[argname] += 1
-+}
-+
-+tick-5s {
-+ ansi.clear_screen()
-+ histogram(s)
-+ delete(s)
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/syscalls/syscalls.kp
-@@ -0,0 +1,6 @@
-+#!/usr/bin/env ktap
-+
-+trace syscalls:* {
-+ print(cpu(), pid(), execname(), argevent)
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/syscalls/syscalls_count.kp
-@@ -0,0 +1,54 @@
-+#!/usr/bin/env ktap
-+
-+s = ptable()
-+
-+trace syscalls:sys_enter_* {
-+ s[argname] <<< 1
-+}
-+
-+trace_end {
-+ histogram(s)
-+}
-+
-+#Result:
-+#
-+#[root@jovi ktap]# ./ktap samples/syscalls_histogram.kp
-+#^C
-+# value ------------- Distribution ------------- count
-+# sys_enter_rt_sigprocmask |@@@@@@ 326
-+# sys_enter_read |@@@@@ 287
-+# sys_enter_close |@@@@ 236
-+# sys_enter_open |@@@@ 222
-+# sys_enter_stat64 |@@ 132
-+# sys_enter_select |@@ 123
-+# sys_enter_rt_sigaction |@@ 107
-+# sys_enter_poll |@ 72
-+# sys_enter_write |@ 70
-+# sys_enter_mmap_pgoff |@ 58
-+# sys_enter_fstat64 | 41
-+# sys_enter_nanosleep | 23
-+# sys_enter_access | 20
-+# sys_enter_mprotect | 18
-+# sys_enter_geteuid | 17
-+# sys_enter_getegid | 16
-+# sys_enter_getuid | 16
-+# sys_enter_getgid | 16
-+# sys_enter_brk | 15
-+# sys_enter_waitpid | 11
-+# sys_enter_time | 10
-+# sys_enter_ioctl | 9
-+# sys_enter_munmap | 9
-+# sys_enter_fcntl64 | 7
-+# sys_enter_dup2 | 7
-+# sys_enter_clone | 6
-+# sys_enter_exit_group | 6
-+# sys_enter_execve | 4
-+# sys_enter_pipe | 3
-+# sys_enter_gettimeofday | 3
-+# sys_enter_getdents | 2
-+# sys_enter_getgroups | 2
-+# sys_enter_statfs64 | 2
-+# sys_enter_lseek | 2
-+# sys_enter_openat | 1
-+# sys_enter_newuname | 1
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/syscalls/syscalls_count_by_proc.kp
-@@ -0,0 +1,22 @@
-+#!/usr/bin/env ktap
-+
-+s = ptable()
-+
-+trace syscalls:sys_enter_* {
-+ s[execname()] <<< 1
-+}
-+
-+trace_end {
-+ histogram(s)
-+}
-+
-+#Result:
-+#
-+#[root@jovi ktap]# ./ktap samples/syscalls_histogram2.kp
-+#^C
-+# value ------------- Distribution ------------- count
-+# sshd |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 196
-+# iscsid |@@@@ 24
-+# sendmail |@ 9
-+
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/syscalls/syslatl.kp
-@@ -0,0 +1,30 @@
-+#!/usr/bin/env ktap
-+#
-+# syslatl.kp syscall latency linear aggregation
-+#
-+# 10-Nov-2013 Brendan Gregg Created this
-+
-+step = 10 # number of ms per step
-+
-+self = {}
-+lats = {}
-+max = 0
-+
-+trace syscalls:sys_enter_* {
-+ self[tid()] = gettimeofday_us()
-+}
-+
-+trace syscalls:sys_exit_* {
-+ if (self[tid()] == nil) { return }
-+ delta = (gettimeofday_us() - self[tid()]) / (step * 1000)
-+ if (delta > max) { max = delta }
-+ lats[delta] += 1
-+ self[tid()] = nil
-+}
-+
-+trace_end {
-+ printf(" %8s %8s\n", "LAT(ms)+", "COUNT");
-+ for (i = 0, max, 1) {
-+ printf(" %8d %8d\n", i * step, lats[i]);
-+ }
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/syscalls/syslist.kp
-@@ -0,0 +1,31 @@
-+#!/usr/bin/env ktap
-+#
-+# syslist.kp syscall latency as a list with counts
-+#
-+# 10-Nov-2013 Brendan Gregg Created this
-+
-+self = {}
-+lats = {}
-+order = {} # a workaround for key sorting
-+
-+trace syscalls:sys_enter_* {
-+ self[tid()] = gettimeofday_us()
-+}
-+
-+trace syscalls:sys_exit_* {
-+ if (self[tid()] == nil) { return }
-+ delta = gettimeofday_us() - self[tid()]
-+ lats[delta] += 1
-+ order[delta] = delta
-+ self[tid()] = nil
-+}
-+
-+trace_end {
-+ printf(" %8s %8s\n", "LAT(us)", "COUNT");
-+ function cmp(v1, v2) {
-+ return (v1 < v2)
-+ }
-+ for (lat, dummy in sort_pairs(order, cmp)) {
-+ printf(" %8d %8d\n", lat, lats[lat]);
-+ }
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/tracepoints/eventcount.kp
-@@ -0,0 +1,210 @@
-+#!/usr/bin/env ktap
-+
-+# showing all tracepoints in histogram style
-+
-+s = ptable()
-+
-+trace *:* {
-+ s[argname] <<< 1
-+}
-+
-+trace_end {
-+ histogram(s)
-+}
-+
-+#Results:
-+#^C
-+#
-+# value ------------- Distribution ------------- count
-+# rcu_utilization |@@@@@ 225289
-+# cpu_idle |@@@ 120168
-+# sched_wakeup |@@ 91950
-+# timer_cancel |@@ 91232
-+# timer_start |@@ 91201
-+# sched_stat_sleep |@@ 90981
-+# timer_expire_exit |@@ 90634
-+# timer_expire_entry |@@ 90625
-+# hrtimer_cancel |@ 75411
-+# hrtimer_start |@ 74946
-+# softirq_raise |@ 63117
-+# softirq_exit |@ 63109
-+# softirq_entry |@ 63094
-+# sched_switch |@ 62331
-+# sched_stat_wait |@ 60491
-+# hrtimer_expire_exit |@ 47538
-+# hrtimer_expire_entry |@ 47530
-+# sched_stat_runtime | 2780
-+# kmem_cache_free | 2684
-+# kmem_cache_alloc | 2415
-+# kfree | 2288
-+# sys_exit | 2145
-+# sys_enter | 2145
-+# sys_exit_rt_sigprocmask | 1000
-+# sys_enter_rt_sigprocmask | 1000
-+# timer_init | 912
-+# sched_stat_blocked | 685
-+# kmalloc | 667
-+# workqueue_execute_end | 621
-+# workqueue_execute_start | 621
-+# sys_enter_select | 566
-+# sys_exit_select | 566
-+# sys_enter_read | 526
-+# sys_exit_read | 526
-+# mm_page_free | 478
-+# mm_page_alloc | 427
-+# mm_page_free_batched | 382
-+# net_dev_queue | 296
-+# net_dev_xmit | 296
-+# consume_skb | 296
-+# sys_exit_write | 290
-+# sys_enter_write | 290
-+# kfree_skb | 289
-+# kmem_cache_alloc_node | 269
-+# kmalloc_node | 263
-+# sys_enter_close | 249
-+# sys_exit_close | 249
-+# hrtimer_init | 248
-+# netif_receive_skb | 242
-+# sys_enter_open | 237
-+# sys_exit_open | 237
-+# napi_poll | 226
-+# sched_migrate_task | 207
-+# sys_exit_poll | 173
-+# sys_enter_poll | 173
-+# workqueue_queue_work | 152
-+# workqueue_activate_work | 152
-+# sys_enter_stat64 | 133
-+# sys_exit_stat64 | 133
-+# sys_exit_rt_sigaction | 133
-+# sys_enter_rt_sigaction | 133
-+# irq_handler_entry | 125
-+# irq_handler_exit | 125
-+# mm_page_alloc_zone_locked | 99
-+# sys_exit_mmap_pgoff | 66
-+# sys_enter_mmap_pgoff | 66
-+# sys_exit_fstat64 | 54
-+# sys_enter_fstat64 | 54
-+# sys_enter_nanosleep | 51
-+# sys_exit_nanosleep | 51
-+# block_bio_queue | 46
-+# block_bio_remap | 46
-+# block_bio_complete | 46
-+# mix_pool_bytes | 44
-+# mm_page_pcpu_drain | 31
-+# sys_exit_time | 23
-+# sys_enter_time | 23
-+# sys_exit_access | 20
-+# sys_enter_access | 20
-+# mix_pool_bytes_nolock | 18
-+# sys_enter_mprotect | 18
-+# sys_exit_mprotect | 18
-+# sys_enter_geteuid | 17
-+# sys_exit_geteuid | 17
-+# sys_enter_munmap | 17
-+# sys_exit_munmap | 17
-+# block_getrq | 16
-+# sys_enter_getuid | 16
-+# sys_enter_getgid | 16
-+# sys_exit_getgid | 16
-+# sys_exit_getuid | 16
-+# block_rq_issue | 16
-+# scsi_dispatch_cmd_start | 16
-+# block_rq_complete | 16
-+# scsi_dispatch_cmd_done | 16
-+# sys_enter_getegid | 16
-+# sys_exit_getegid | 16
-+# block_rq_insert | 16
-+# skb_copy_datagram_iovec | 15
-+# sys_enter_brk | 15
-+# sys_exit_brk | 15
-+# credit_entropy_bits | 14
-+# wbc_writepage | 14
-+# sys_exit_clone | 12
-+# block_touch_buffer | 12
-+# sched_process_wait | 11
-+# sys_enter_waitpid | 11
-+# sys_exit_waitpid | 11
-+# writeback_written | 10
-+# writeback_start | 10
-+# writeback_queue_io | 10
-+# ext4_es_lookup_extent_enter | 9
-+# sys_enter_ioctl | 9
-+# sys_exit_ioctl | 9
-+# ext4_ext_map_blocks_enter | 9
-+# ext4_ext_map_blocks_exit | 9
-+# ext4_es_lookup_extent_exit | 9
-+# ext4_es_insert_extent | 9
-+# ext4_ext_show_extent | 8
-+# extract_entropy | 8
-+#ext4_es_find_delayed_extent_exit | 8
-+# ext4_es_find_delayed_extent_... | 8
-+# writeback_pages_written | 7
-+# sys_exit_dup2 | 7
-+# sys_enter_dup2 | 7
-+# signal_generate | 7
-+# sys_enter_fcntl64 | 7
-+# sys_exit_fcntl64 | 7
-+# global_dirty_state | 7
-+# writeback_dirty_inode_start | 7
-+# block_bio_backmerge | 7
-+# writeback_dirty_inode | 7
-+# sched_wakeup_new | 6
-+# sched_process_free | 6
-+# sys_enter_exit_group | 6
-+# task_newtask | 6
-+# sys_enter_clone | 6
-+# sched_process_fork | 6
-+# sched_process_exit | 6
-+# sys_exit_gettimeofday | 5
-+# signal_deliver | 5
-+# sys_enter_gettimeofday | 5
-+# writeback_single_inode | 4
-+# sys_enter_execve | 4
-+# task_rename | 4
-+# sched_process_exec | 4
-+# block_dirty_buffer | 4
-+# sys_exit_execve | 4
-+# block_unplug | 4
-+# sched_stat_iowait | 4
-+# writeback_single_inode_start | 4
-+# block_plug | 4
-+# writeback_write_inode | 3
-+# sys_enter_pipe | 3
-+# writeback_dirty_page | 3
-+# writeback_write_inode_start | 3
-+# ext4_mark_inode_dirty | 3
-+# ext4_journal_start | 3
-+# sys_exit_pipe | 3
-+# jbd2_drop_transaction | 2
-+# jbd2_commit_locking | 2
-+# jbd2_commit_flushing | 2
-+# jbd2_handle_start | 2
-+# jbd2_run_stats | 2
-+# sys_exit_getdents | 2
-+# jbd2_checkpoint_stats | 2
-+# sys_enter_getgroups | 2
-+# jbd2_start_commit | 2
-+# jbd2_end_commit | 2
-+# ext4_da_writepages | 2
-+# jbd2_handle_stats | 2
-+# sys_enter_statfs64 | 2
-+# sys_exit_statfs64 | 2
-+# sys_exit_getgroups | 2
-+# sys_exit_lseek | 2
-+# sys_enter_lseek | 2
-+# sys_enter_getdents | 2
-+# ext4_da_write_pages | 2
-+# jbd2_commit_logging | 2
-+# ext4_request_blocks | 1
-+# sys_exit_openat | 1
-+# ext4_discard_preallocations | 1
-+# ext4_mballoc_alloc | 1
-+# sys_enter_openat | 1
-+# ext4_da_writepages_result | 1
-+# ext4_allocate_blocks | 1
-+# sys_enter_newuname | 1
-+# ext4_da_update_reserve_space | 1
-+# ext4_get_reserved_cluster_alloc | 1
-+# sys_exit_newuname | 1
-+# writeback_wake_thread | 1
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/tracepoints/eventcount_by_proc.kp
-@@ -0,0 +1,57 @@
-+#!/usr/bin/env ktap
-+
-+# showing all tracepoints in histogram style
-+
-+s = ptable()
-+
-+trace *:* {
-+ s[execname()] <<< 1
-+}
-+
-+trace_end {
-+ histogram(s)
-+}
-+
-+#Results:
-+#^C
-+# value ------------- Distribution ------------- count
-+# swapper/0 |@@@@@@@@@@@@ 354378
-+# swapper/1 |@@@@@@@@@@ 284984
-+# ps |@@@@ 115697
-+# ksmtuned |@@@ 95857
-+# iscsid |@@ 80008
-+# awk |@ 30354
-+# irqbalance | 16530
-+# rcu_sched | 15892
-+# sendmail | 14463
-+# kworker/0:1 | 10540
-+# kworker/u4:2 | 9250
-+# kworker/1:2 | 7943
-+# sleep | 7555
-+# crond | 3911
-+# ksoftirqd/0 | 3817
-+# sshd | 2849
-+# systemd-journal | 2209
-+# migration/1 | 1601
-+# migration/0 | 1350
-+# dhclient | 1343
-+# nm-dhcp-client. | 1208
-+# ksoftirqd/1 | 1064
-+# watchdog/1 | 966
-+# watchdog/0 | 964
-+# khugepaged | 776
-+# dbus-daemon | 611
-+# rpcbind | 607
-+# gdbus | 529
-+# NetworkManager | 399
-+# jbd2/dm-1-8 | 378
-+# modem-manager | 184
-+# abrt-watch-log | 157
-+# polkitd | 156
-+# rs:main Q:Reg | 153
-+# avahi-daemon | 151
-+# rsyslogd | 102
-+# systemd | 96
-+# kworker/0:1H | 45
-+# smartd | 30
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/tracepoints/tracepoints.kp
-@@ -0,0 +1,6 @@
-+#!/usr/bin/env ktap
-+
-+trace *:* {
-+ print(cpu(), pid(), execname(), argevent)
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/userspace/gcc_unwind.kp
-@@ -0,0 +1,9 @@
-+#!/usr/bin/env ktap
-+
-+#only tested in x86-64 system,
-+#if you run this script in x86_32, change the libc path.
-+
-+trace sdt:/lib/x86_64-linux-gnu/libgcc_s.so.1:unwind {
-+ print(execname(), argevent)
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/userspace/glibc_func_hist.kp
-@@ -0,0 +1,44 @@
-+#!/usr/bin/env ktap
-+
-+#This ktap script trace all glibc functions in histogram output
-+
-+#only tested in x86-64 system,
-+#if you run this script in x86_32, change the libc path.
-+
-+s = {}
-+
-+trace probe:/lib64/libc.so.6:* {
-+ s[argname] += 1
-+}
-+
-+trace_end {
-+ histogram(s)
-+}
-+
-+# Example result:
-+#[root@localhost ktap]# ./ktap ./glibc_func_hist.kp
-+#Tracing... Ctrl-C to end.
-+#^C
-+# value ------------- Distribution ------------- count
-+# _IO_sputbackc | 1536
-+# __strncmp_sse2 | 1522
-+# __GI_strncmp | 1522
-+# __GI_memcpy | 1446
-+# __memcpy_sse2 | 1446
-+# _dl_mcount_wrapper_check | 1433
-+# __GI__dl_mcount_wrapper_check | 1433
-+# __gconv_transform_utf8_internal | 1429
-+# __mbrtowc | 1425
-+# mbrtoc32 | 1425
-+# __GI___mbrtowc | 1425
-+# mbrtowc | 1425
-+# __GI_mbrtowc | 1425
-+# strtouq | 1274
-+# strtoull | 1274
-+# strtoul | 1274
-+# __ctype_get_mb_cur_max | 984
-+# ____strtoull_l_internal | 970
-+# __GI_____strtoul_l_internal | 970
-+# __GI__IO_sputbackc | 960
-+# ... |
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/userspace/glibc_sdt.kp
-@@ -0,0 +1,11 @@
-+#!/usr/bin/env ktap
-+
-+#This ktap script trace all sdt notes in glibc
-+
-+#only tested in x86-64 system,
-+#if you run this script in x86_32, change the libc path.
-+
-+trace sdt:/lib64/libc.so.6:* {
-+ print(execname(), argevent)
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/userspace/glibc_trace.kp
-@@ -0,0 +1,11 @@
-+#!/usr/bin/env ktap
-+
-+#This ktap script trace all functions in glibc
-+
-+#only tested in x86-64 system,
-+#if you run this script in x86_32, change the libc path.
-+
-+trace probe:/lib64/libc.so.6:* {
-+ print(execname(), argevent)
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/samples/userspace/malloc_free.kp
-@@ -0,0 +1,20 @@
-+#!/usr/bin/env ktap
-+
-+#only tested in x86-64 system,
-+#if you run this script in x86_32, change the libc path.
-+
-+trace probe:/lib64/libc.so.6:malloc {
-+ print("malloc entry:", execname())
-+}
-+
-+trace probe:/lib64/libc.so.6:malloc%return {
-+ print("malloc exit:", execname())
-+}
-+
-+trace probe:/lib64/libc.so.6:free {
-+ print("free entry:", execname())
-+}
-+
-+trace probe:/lib64/libc.so.6:free%return {
-+ print("free exit:", execname())
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/samples/userspace/malloc_size_hist.kp
-@@ -0,0 +1,22 @@
-+#!/usr/bin/env ktap
-+
-+# Aggregate system or process malloc size
-+
-+# only tested in x86-64 system,
-+# if you run this script in x86_32, change the libc path and register name.
-+#
-+# Examples:
-+#
-+# ktap malloc_size_hist.kp
-+# ktap malloc_size_hist.kp -- ls
-+
-+m = {}
-+
-+trace probe:/lib64/libc.so.6:malloc size=%di {
-+ #arg2 is argument "size" of malloc function
-+ m[arg2] += 1
-+}
-+
-+trace_end {
-+ histogram(m)
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/test/arg.kp
-@@ -0,0 +1,24 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#-----------------------------------------#
-+
-+if (!arg[0]) {
-+ failed()
-+}
-+
-+if (arg[1] != 1) {
-+ failed()
-+}
-+
-+if (arg[2] != "testing") {
-+ failed()
-+}
-+
-+if (arg[3] != "2 3 4") {
-+ failed()
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/test/arithmetic.kp
-@@ -0,0 +1,50 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#-----------------------------------------#
-+
-+if (1 > 2) {
-+ failed()
-+}
-+
-+if (200 < 100) {
-+ failed()
-+}
-+
-+a = 4
-+b = 5
-+
-+if ((a + b) != 9) {
-+ failed()
-+}
-+
-+if ((a - b) != -1) {
-+ failed()
-+}
-+
-+if ((a % b) != 4) {
-+ failed()
-+}
-+
-+if ((a / b) != 0) {
-+ failed()
-+}
-+
-+
-+#below checking only valid for 64-bit system
-+
-+c = 0x1234567812345678
-+d = 0x2
-+
-+if (c + d != 0x123456781234567a) {
-+ failed()
-+}
-+
-+if (-1 != 0xffffffffffffffff) {
-+ failed()
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/benchmark/sembench.c
-@@ -0,0 +1,556 @@
-+/*
-+ * copyright Oracle 2007. Licensed under GPLv2
-+ * To compile: gcc -Wall -o sembench sembench.c -lpthread
-+ *
-+ * usage: sembench -t thread count -w wakenum -r runtime -o op
-+ * op can be: 0 (ipc sem) 1 (nanosleep) 2 (futexes)
-+ *
-+ * example:
-+ * sembench -t 1024 -w 512 -r 60 -o 2
-+ * runs 1024 threads, waking up 512 at a time, running for 60 seconds using
-+ * futex locking.
-+ *
-+ */
-+#define _GNU_SOURCE
-+#define _POSIX_C_SOURCE 199309
-+#include <fcntl.h>
-+#include <sched.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <sys/sem.h>
-+#include <sys/ipc.h>
-+#include <sys/types.h>
-+#include <sys/mman.h>
-+#include <pthread.h>
-+#include <unistd.h>
-+#include <string.h>
-+#include <time.h>
-+#include <sys/time.h>
-+#include <sys/syscall.h>
-+#include <errno.h>
-+
-+#define VERSION "0.2"
-+
-+/* futexes have been around since 2.5.something, but it still seems I
-+ * need to make my own syscall. Sigh.
-+ */
-+#define FUTEX_WAIT 0
-+#define FUTEX_WAKE 1
-+#define FUTEX_FD 2
-+#define FUTEX_REQUEUE 3
-+#define FUTEX_CMP_REQUEUE 4
-+#define FUTEX_WAKE_OP 5
-+static inline int futex (int *uaddr, int op, int val,
-+ const struct timespec *timeout,
-+ int *uaddr2, int val3)
-+{
-+ return syscall(__NR_futex, uaddr, op, val, timeout, uaddr2, val3);
-+}
-+
-+static void smp_mb(void)
-+{
-+ __sync_synchronize();
-+}
-+
-+static int all_done = 0;
-+static int timeout_test = 0;
-+
-+#define SEMS_PERID 250
-+
-+struct sem_operations;
-+
-+struct lockinfo {
-+ unsigned long id;
-+ unsigned long index;
-+ int data;
-+ pthread_t tid;
-+ struct lockinfo *next;
-+ struct sem_operations *ops;
-+ unsigned long ready;
-+};
-+
-+struct sem_wakeup_info {
-+ int wakeup_count;
-+ struct sembuf sb[SEMS_PERID];
-+};
-+
-+struct sem_operations {
-+ void (*wait)(struct lockinfo *l);
-+ int (*wake)(struct sem_wakeup_info *wi, int num_semids, int num);
-+ void (*setup)(struct sem_wakeup_info **wi, int num_semids);
-+ void (*cleanup)(int num_semids);
-+ char *name;
-+};
-+
-+int *semid_lookup = NULL;
-+
-+pthread_mutex_t worklist_mutex = PTHREAD_MUTEX_INITIALIZER;
-+static unsigned long total_burns = 0;
-+static unsigned long min_burns = ~0UL;
-+static unsigned long max_burns = 0;
-+
-+/* currently running threads */
-+static int thread_count = 0;
-+
-+struct lockinfo *worklist = NULL;
-+static int workers_started = 0;
-+
-+/* total threads started */
-+static int num_threads = 2048;
-+
-+static void worklist_add(struct lockinfo *l)
-+{
-+ smp_mb();
-+ l->ready = 1;
-+}
-+
-+static struct lockinfo *worklist_rm(void)
-+{
-+ static int last_index = 0;
-+ int i;
-+ struct lockinfo *l;
-+
-+ for (i = 0; i < num_threads; i++) {
-+ int test = (last_index + i) % num_threads;
-+
-+ l = worklist + test;
-+ smp_mb();
-+ if (l->ready) {
-+ l->ready = 0;
-+ last_index = test;
-+ return l;
-+ }
-+ }
-+ return NULL;
-+}
-+
-+/* ipc semaphore post& wait */
-+void wait_ipc_sem(struct lockinfo *l)
-+{
-+ struct sembuf sb;
-+ int ret;
-+ struct timespec *tvp = NULL;
-+ struct timespec tv = { 0, 1 };
-+
-+ sb.sem_num = l->index;
-+ sb.sem_flg = 0;
-+
-+ sb.sem_op = -1;
-+ l->data = 1;
-+
-+ if (timeout_test && (l->id % 5) == 0)
-+ tvp = &tv;
-+
-+ worklist_add(l);
-+ ret = semtimedop(semid_lookup[l->id], &sb, 1, tvp);
-+
-+ while(l->data != 0 && tvp) {
-+ struct timespec tv2 = { 0, 500 };
-+ nanosleep(&tv2, NULL);
-+ }
-+
-+ if (l->data != 0) {
-+ if (tvp)
-+ return;
-+ fprintf(stderr, "wakeup without data update\n");
-+ exit(1);
-+ }
-+ if (ret) {
-+ if (errno == EAGAIN && tvp)
-+ return;
-+ perror("semtimed op");
-+ exit(1);
-+ }
-+}
-+
-+int ipc_wake_some(struct sem_wakeup_info *wi, int num_semids, int num)
-+{
-+ int i;
-+ int ret;
-+ struct lockinfo *l;
-+ int found = 0;
-+
-+ for (i = 0; i < num_semids; i++) {
-+ wi[i].wakeup_count = 0;
-+ }
-+ while(num > 0) {
-+ struct sembuf *sb;
-+ l = worklist_rm();
-+ if (!l)
-+ break;
-+ if (l->data != 1)
-+ fprintf(stderr, "warning, lockinfo data was %d\n",
-+ l->data);
-+ l->data = 0;
-+ sb = wi[l->id].sb + wi[l->id].wakeup_count;
-+ sb->sem_num = l->index;
-+ sb->sem_op = 1;
-+ sb->sem_flg = IPC_NOWAIT;
-+ wi[l->id].wakeup_count++;
-+ found++;
-+ num--;
-+ }
-+ if (!found)
-+ return 0;
-+ for (i = 0; i < num_semids; i++) {
-+ int wakeup_total;
-+ int cur;
-+ int offset = 0;
-+ if (!wi[i].wakeup_count)
-+ continue;
-+ wakeup_total = wi[i].wakeup_count;
-+ while(wakeup_total > 0) {
-+ cur = wakeup_total > 64 ? 64 : wakeup_total;
-+ ret = semtimedop(semid_lookup[i], wi[i].sb + offset,
-+ cur, NULL);
-+ if (ret) {
-+ perror("semtimedop");
-+ exit(1);
-+ }
-+ offset += cur;
-+ wakeup_total -= cur;
-+ }
-+ }
-+ return found;
-+}
-+
-+void setup_ipc_sems(struct sem_wakeup_info **wi, int num_semids)
-+{
-+ int i;
-+ *wi = malloc(sizeof(**wi) * num_semids);
-+ semid_lookup = malloc(num_semids * sizeof(int));
-+ for(i = 0; i < num_semids; i++) {
-+ semid_lookup[i] = semget(IPC_PRIVATE, SEMS_PERID,
-+ IPC_CREAT | 0777);
-+ if (semid_lookup[i] < 0) {
-+ perror("semget");
-+ exit(1);
-+ }
-+ }
-+ sleep(10);
-+}
-+
-+void cleanup_ipc_sems(int num)
-+{
-+ int i;
-+ for (i = 0; i < num; i++) {
-+ semctl(semid_lookup[i], 0, IPC_RMID);
-+ }
-+}
-+
-+struct sem_operations ipc_sem_ops = {
-+ .wait = wait_ipc_sem,
-+ .wake = ipc_wake_some,
-+ .setup = setup_ipc_sems,
-+ .cleanup = cleanup_ipc_sems,
-+ .name = "ipc sem operations",
-+};
-+
-+/* futex post & wait */
-+void wait_futex_sem(struct lockinfo *l)
-+{
-+ int ret;
-+ l->data = 1;
-+ worklist_add(l);
-+ while(l->data == 1) {
-+ ret = futex(&l->data, FUTEX_WAIT, 1, NULL, NULL, 0);
-+ /*
-+ if (ret && ret != EWOULDBLOCK) {
-+ perror("futex wait");
-+ exit(1);
-+ }*/
-+ }
-+}
-+
-+int futex_wake_some(struct sem_wakeup_info *wi, int num_semids, int num)
-+{
-+ int i;
-+ int ret;
-+ struct lockinfo *l;
-+ int found = 0;
-+
-+ for (i = 0; i < num; i++) {
-+ l = worklist_rm();
-+ if (!l)
-+ break;
-+ if (l->data != 1)
-+ fprintf(stderr, "warning, lockinfo data was %d\n",
-+ l->data);
-+ l->data = 0;
-+ ret = futex(&l->data, FUTEX_WAKE, 1, NULL, NULL, 0);
-+ if (ret < 0) {
-+ perror("futex wake");
-+ exit(1);
-+ }
-+ found++;
-+ }
-+ return found;
-+}
-+
-+void setup_futex_sems(struct sem_wakeup_info **wi, int num_semids)
-+{
-+ return;
-+}
-+
-+void cleanup_futex_sems(int num)
-+{
-+ return;
-+}
-+
-+struct sem_operations futex_sem_ops = {
-+ .wait = wait_futex_sem,
-+ .wake = futex_wake_some,
-+ .setup = setup_futex_sems,
-+ .cleanup = cleanup_futex_sems,
-+ .name = "futex sem operations",
-+};
-+
-+/* nanosleep sems here */
-+void wait_nanosleep_sem(struct lockinfo *l)
-+{
-+ int ret;
-+ struct timespec tv = { 0, 1000000 };
-+ int count = 0;
-+
-+ l->data = 1;
-+ worklist_add(l);
-+ while(l->data) {
-+ ret = nanosleep(&tv, NULL);
-+ if (ret) {
-+ perror("nanosleep");
-+ exit(1);
-+ }
-+ count++;
-+ }
-+}
-+
-+int nanosleep_wake_some(struct sem_wakeup_info *wi, int num_semids, int num)
-+{
-+ int i;
-+ struct lockinfo *l;
-+
-+ for (i = 0; i < num; i++) {
-+ l = worklist_rm();
-+ if (!l)
-+ break;
-+ if (l->data != 1)
-+ fprintf(stderr, "warning, lockinfo data was %d\n",
-+ l->data);
-+ l->data = 0;
-+ }
-+ return i;
-+}
-+
-+void setup_nanosleep_sems(struct sem_wakeup_info **wi, int num_semids)
-+{
-+ return;
-+}
-+
-+void cleanup_nanosleep_sems(int num)
-+{
-+ return;
-+}
-+
-+struct sem_operations nanosleep_sem_ops = {
-+ .wait = wait_nanosleep_sem,
-+ .wake = nanosleep_wake_some,
-+ .setup = setup_nanosleep_sems,
-+ .cleanup = cleanup_nanosleep_sems,
-+ .name = "nano sleep sem operations",
-+};
-+
-+void *worker(void *arg)
-+{
-+ struct lockinfo *l = (struct lockinfo *)arg;
-+ int burn_count = 0;
-+ pthread_t tid = pthread_self();
-+ size_t pagesize = getpagesize();
-+ char *buf = malloc(pagesize);
-+
-+ if (!buf) {
-+ perror("malloc");
-+ exit(1);
-+ }
-+
-+ l->tid = tid;
-+ workers_started = 1;
-+ smp_mb();
-+
-+ while(!all_done) {
-+ l->ops->wait(l);
-+ if (all_done)
-+ break;
-+ burn_count++;
-+ }
-+ pthread_mutex_lock(&worklist_mutex);
-+ total_burns += burn_count;
-+ if (burn_count < min_burns)
-+ min_burns = burn_count;
-+ if (burn_count > max_burns)
-+ max_burns = burn_count;
-+ thread_count--;
-+ pthread_mutex_unlock(&worklist_mutex);
-+ return (void *)0;
-+}
-+
-+void print_usage(void)
-+{
-+ printf("usage: sembench [-t threads] [-w wake incr] [-r runtime]");
-+ printf(" [-o num] (0=ipc, 1=nanosleep, 2=futex)\n");
-+ exit(1);
-+}
-+
-+#define NUM_OPERATIONS 3
-+struct sem_operations *allops[NUM_OPERATIONS] = { &ipc_sem_ops,
-+ &nanosleep_sem_ops,
-+ &futex_sem_ops};
-+
-+int main(int ac, char **av) {
-+ int ret;
-+ int i;
-+ int semid = 0;
-+ int sem_num = 0;
-+ int burn_count = 0;
-+ struct sem_wakeup_info *wi = NULL;
-+ struct timeval start;
-+ struct timeval now;
-+ int num_semids = 0;
-+ int wake_num = 256;
-+ int run_secs = 30;
-+ int pagesize = getpagesize();
-+ char *buf = malloc(pagesize);
-+ struct sem_operations *ops = allops[0];
-+ cpu_set_t cpu_mask;
-+ cpu_set_t target_mask;
-+ int target_cpu = 0;
-+ int max_cpu = -1;
-+
-+ if (!buf) {
-+ perror("malloc");
-+ exit(1);
-+ }
-+ for (i = 1; i < ac; i++) {
-+ if (strcmp(av[i], "-t") == 0) {
-+ if (i == ac -1)
-+ print_usage();
-+ num_threads = atoi(av[i+1]);
-+ i++;
-+ } else if (strcmp(av[i], "-w") == 0) {
-+ if (i == ac -1)
-+ print_usage();
-+ wake_num = atoi(av[i+1]);
-+ i++;
-+ } else if (strcmp(av[i], "-r") == 0) {
-+ if (i == ac -1)
-+ print_usage();
-+ run_secs = atoi(av[i+1]);
-+ i++;
-+ } else if (strcmp(av[i], "-o") == 0) {
-+ int index;
-+ if (i == ac -1)
-+ print_usage();
-+ index = atoi(av[i+1]);
-+ if (index >= NUM_OPERATIONS) {
-+ fprintf(stderr, "invalid operations %d\n",
-+ index);
-+ exit(1);
-+ }
-+ ops = allops[index];
-+ i++;
-+ } else if (strcmp(av[i], "-T") == 0) {
-+ timeout_test = 1;
-+ } else if (strcmp(av[i], "-h") == 0) {
-+ print_usage();
-+ }
-+ }
-+ num_semids = (num_threads + SEMS_PERID - 1) / SEMS_PERID;
-+ ops->setup(&wi, num_semids);
-+
-+ ret = sched_getaffinity(0, sizeof(cpu_set_t), &cpu_mask);
-+ if (ret) {
-+ perror("sched_getaffinity");
-+ exit(1);
-+ }
-+ for (i = 0; i < CPU_SETSIZE; i++)
-+ if (CPU_ISSET(i, &cpu_mask))
-+ max_cpu = i;
-+ if (max_cpu == -1) {
-+ fprintf(stderr, "sched_getaffinity returned empty mask\n");
-+ exit(1);
-+ }
-+
-+ CPU_ZERO(&target_mask);
-+
-+ worklist = malloc(sizeof(*worklist) * num_threads);
-+ memset(worklist, 0, sizeof(*worklist) * num_threads);
-+
-+ for (i = 0; i < num_threads; i++) {
-+ struct lockinfo *l;
-+ pthread_t tid;
-+ thread_count++;
-+ l = worklist + i;
-+ if (!l) {
-+ perror("malloc");
-+ exit(1);
-+ }
-+ l->id = semid;
-+ l->index = sem_num++;
-+ l->ops = ops;
-+ if (sem_num >= SEMS_PERID) {
-+ semid++;
-+ sem_num = 0;
-+ }
-+ ret = pthread_create(&tid, NULL, worker, (void *)l);
-+ if (ret) {
-+ perror("pthread_create");
-+ exit(1);
-+ }
-+
-+ while (!CPU_ISSET(target_cpu, &cpu_mask)) {
-+ target_cpu++;
-+ if (target_cpu > max_cpu)
-+ target_cpu = 0;
-+ }
-+ CPU_SET(target_cpu, &target_mask);
-+ ret = pthread_setaffinity_np(tid, sizeof(cpu_set_t),
-+ &target_mask);
-+ CPU_CLR(target_cpu, &target_mask);
-+ target_cpu++;
-+
-+ ret = pthread_detach(tid);
-+ if (ret) {
-+ perror("pthread_detach");
-+ exit(1);
-+ }
-+ }
-+ while(!workers_started) {
-+ smp_mb();
-+ usleep(200);
-+ }
-+ gettimeofday(&start, NULL);
-+ fprintf(stderr, "main loop going\n");
-+ while(1) {
-+ ops->wake(wi, num_semids, wake_num);
-+ burn_count++;
-+ gettimeofday(&now, NULL);
-+ if (now.tv_sec - start.tv_sec >= run_secs)
-+ break;
-+ }
-+ fprintf(stderr, "all done\n");
-+ all_done = 1;
-+ while(thread_count > 0) {
-+ ops->wake(wi, num_semids, wake_num);
-+ usleep(200);
-+ }
-+ printf("%d threads, waking %d at a time\n", num_threads, wake_num);
-+ printf("using %s\n", ops->name);
-+ printf("main thread burns: %d\n", burn_count);
-+ printf("worker burn count total %lu min %lu max %lu avg %lu\n",
-+ total_burns, min_burns, max_burns, total_burns / num_threads);
-+ printf("run time %d seconds %lu worker burns per second\n",
-+ (int)(now.tv_sec - start.tv_sec),
-+ total_burns / (now.tv_sec - start.tv_sec));
-+ ops->cleanup(num_semids);
-+ return 0;
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/benchmark/test.sh
-@@ -0,0 +1,26 @@
-+#!/bin/sh
-+
-+gcc -o sembench sembench.c -O2 -lpthread
-+
-+COMMAND="./sembench -t 200 -w 20 -r 30 -o 2"
-+
-+echo -e "\n\t\tPass 1 without tracing"
-+$COMMAND
-+echo -e "\n\t\tPass 2 without tracing"
-+$COMMAND
-+echo -e "\n\t\tPass 3 without tracing"
-+$COMMAND
-+
-+echo ""
-+
-+../../ktap -e 'trace syscalls:sys_*_futex {}' &
-+
-+echo -e "\n\t\tPass 1 with tracing"
-+$COMMAND
-+echo -e "\n\t\tPass 2 with tracing"
-+$COMMAND
-+echo -e "\n\t\tPass 3 with tracing"
-+$COMMAND
-+
-+pkill ktap
-+rm -rf ./sembench
---- /dev/null
-+++ b/drivers/staging/ktap/test/concat.kp
-@@ -0,0 +1,15 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#----------------------------------------#
-+
-+a = "123"
-+b = "456"
-+
-+if (a..b != "123456") {
-+ failed()
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/test/count.kp
-@@ -0,0 +1,20 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#---------------------------------------#
-+
-+t = {}
-+
-+t["key"] += 1
-+if (t["key"] != 1) {
-+ failed()
-+}
-+
-+t["key"] += 1
-+if (t["key"] != 2) {
-+ failed()
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/test/ffi/.gitignore
-@@ -0,0 +1,2 @@
-+cparser_test
-+Module.symvers
---- /dev/null
-+++ b/drivers/staging/ktap/test/ffi/Makefile
-@@ -0,0 +1,46 @@
-+obj-m += ktap_ffi_test.o
-+
-+all: funct_mod cparser_test
-+
-+funct_mod:
-+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
-+
-+INC=../../include
-+U_DIR=../../userspace
-+RUNTIME=../../runtime
-+U_FFI_DIR=$(U_DIR)/ffi
-+CPARSER_FILES=cparser.o ctype.o ffi_type.o
-+KTAPC_CFLAGS = -Wall -O2
-+
-+cparser.o: $(U_FFI_DIR)/cparser.c $(INC)/*
-+ $(QUIET_CC)$(CC) -DCONFIG_KTAP_FFI -o $@ -c $<
-+
-+ctype.o: $(U_FFI_DIR)/ctype.c $(INC)/*
-+ $(QUIET_CC)$(CC) -DCONFIG_KTAP_FFI -o $@ -c $<
-+
-+ffi_type.o: $(RUNTIME)/ffi/ffi_type.c $(INC)/*
-+ $(QUIET_CC)$(CC) -DCONFIG_KTAP_FFI -o $@ -c $<
-+
-+cparser_test: cparser_test.c $(CPARSER_FILES) $(INC)/*
-+ $(QUIET_CC)$(CC) -DCONFIG_KTAP_FFI -I$(INC) -I$(U_DIR) $(KTAPC_CFLAGS) \
-+ -o $@ $< $(CPARSER_FILES)
-+
-+load:
-+ insmod ktap_ffi_test.ko
-+
-+unload:
-+ rmmod ktap_ffi_test
-+
-+test: all
-+ @echo "testing cparser:"
-+ ./cparser_test
-+ @echo "testing ffi module:"
-+ rmmod ktap_ffi_test > /dev/null 2>&1 || true
-+ insmod ktap_ffi_test.ko
-+ ../../ktap ffi_test.kp
-+ rmmod ktap_ffi_test.ko
-+ @echo "[*] all ffi tests passed."
-+
-+clean:
-+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
-+ rm -rf cparser_test
---- /dev/null
-+++ b/drivers/staging/ktap/test/ffi/cparser_test.c
-@@ -0,0 +1,322 @@
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <assert.h>
-+
-+#include "ktap_types.h"
-+#include "ktap_opcodes.h"
-+#include "../../userspace/ktapc.h"
-+#include "cparser.h"
-+
-+void ffi_cparser_init(void);
-+void ffi_cparser_free(void);
-+int ffi_cdef(const char *s);
-+
-+static cp_csymbol_state *csym_state;
-+
-+#define cs_nr (csym_state->cs_nr)
-+#define cs_arr_size (csym_state->cs_arr_size)
-+#define cs_arr (csym_state->cs_arr)
-+
-+
-+#define DO_TEST(name) do { \
-+ ffi_cparser_init(); \
-+ int ret; \
-+ printf("[*] start "#name" test... "); \
-+ ret = test_##name(); \
-+ if (ret) \
-+ fprintf(stderr, "\n[!] "#name" test failed.\n");\
-+ else \
-+ printf(" passed.\n"); \
-+ ffi_cparser_free(); \
-+} while (0)
-+
-+#define assert_csym_arr_type(cs_arr, n, t) do { \
-+ csymbol *ncs; \
-+ ncs = &cs_arr[n]; \
-+ assert(ncs->type == t); \
-+} while (0)
-+
-+#define assert_fret_type(fcs, t) do { \
-+ csymbol *ncs; \
-+ ncs = &cs_arr[fcs->ret_id]; \
-+ assert(ncs->type == t); \
-+} while (0)
-+
-+#define assert_farg_type(fcs, n, t) do { \
-+ csymbol *ncs; \
-+ ncs = &cs_arr[fcs->arg_ids[n]]; \
-+ assert(ncs->type == t); \
-+} while (0)
-+
-+
-+
-+
-+/* mock find_kernel_symbol */
-+unsigned long find_kernel_symbol(const char *symbol)
-+{
-+ return 0xdeadbeef;
-+}
-+
-+int lookup_csymbol_id_by_name(char *name)
-+{
-+ int i;
-+
-+ for (i = 0; i < cs_nr; i++) {
-+ if (!strcmp(name, cs_arr[i].name)) {
-+ return i;
-+ }
-+ }
-+
-+ return -1;
-+}
-+
-+int test_func_sched_clock()
-+{
-+ int idx;
-+ csymbol *cs;
-+ csymbol_func *fcs;
-+
-+ ffi_cdef("unsigned long long sched_clock();");
-+
-+ csym_state = ctype_get_csym_state();
-+ assert(cs_arr);
-+
-+ idx = lookup_csymbol_id_by_name("sched_clock");
-+ assert(idx >= 0);
-+ cs = &cs_arr[idx];
-+ assert(cs->type == FFI_FUNC);
-+
-+ fcs = csym_func(cs);
-+
-+ /* check return type */
-+ assert_fret_type(fcs, FFI_UINT64);
-+
-+ /* check arguments */
-+ assert(fcs->arg_nr == 0);
-+
-+ return 0;
-+}
-+
-+int test_func_funct_module()
-+{
-+ int idx;
-+ csymbol *cs;
-+ csymbol_func *fcs;
-+
-+ ffi_cdef("void funct_void();");
-+ ffi_cdef("int funct_int1(unsigned char a, char b, unsigned short c, "
-+ "short d);");
-+ ffi_cdef("long long funct_int2(unsigned int a, int b, "
-+ "unsigned long c, long d, unsigned long long e, "
-+ "long long f, long long g);");
-+ ffi_cdef("void *funct_pointer1(char *a);");
-+
-+ csym_state = ctype_get_csym_state();
-+ assert(cs_arr);
-+
-+ /* check funct_void function */
-+ idx = lookup_csymbol_id_by_name("funct_void");
-+ assert(idx >= 0);
-+ cs = &cs_arr[idx];
-+ assert(cs->type == FFI_FUNC);
-+ fcs = csym_func(cs);
-+
-+ /* check return type */
-+ assert_fret_type(fcs, FFI_VOID);
-+
-+ /* check arguments */
-+ assert(fcs->arg_nr == 0);
-+
-+
-+
-+ /* check funct_int1 function */
-+ idx = lookup_csymbol_id_by_name("funct_int1");
-+ assert(idx >= 0);
-+ cs = &cs_arr[idx];
-+ assert(cs);
-+ assert(cs->type == FFI_FUNC);
-+ fcs = csym_func(cs);
-+
-+ /* check return type */
-+ assert_fret_type(fcs, FFI_INT32);
-+
-+ /* check arguments */
-+ assert(fcs->arg_nr == 4);
-+ assert_farg_type(fcs, 0, FFI_UINT8);
-+ assert_farg_type(fcs, 1, FFI_INT8);
-+ assert_farg_type(fcs, 2, FFI_UINT16);
-+ assert_farg_type(fcs, 3, FFI_INT16);
-+
-+
-+
-+ /* check funct_int2 function */
-+ idx = lookup_csymbol_id_by_name("funct_int2");
-+ assert(idx >= 0);
-+ cs = &cs_arr[idx];
-+ assert(cs);
-+ assert(cs->type == FFI_FUNC);
-+ fcs = csym_func(cs);
-+
-+ /* check return type */
-+ assert_fret_type(fcs, FFI_INT64);
-+
-+ /* check arguments */
-+ assert(fcs->arg_nr == 7);
-+ assert_farg_type(fcs, 0, FFI_UINT32);
-+ assert_farg_type(fcs, 1, FFI_INT32);
-+ assert_farg_type(fcs, 2, FFI_UINT64);
-+ assert_farg_type(fcs, 3, FFI_INT64);
-+ assert_farg_type(fcs, 4, FFI_UINT64);
-+ assert_farg_type(fcs, 5, FFI_INT64);
-+ assert_farg_type(fcs, 6, FFI_INT64);
-+
-+
-+
-+ /* check funct_pointer1 function */
-+ idx = lookup_csymbol_id_by_name("funct_pointer1");
-+ assert(idx >= 0);
-+ cs = &cs_arr[idx];
-+ assert(cs);
-+ assert(cs->type == FFI_FUNC);
-+ fcs = csym_func(cs);
-+
-+ /* check return type */
-+ assert_fret_type(fcs, FFI_PTR);
-+
-+ /* check arguments */
-+ assert(fcs->arg_nr == 1);
-+ assert_farg_type(fcs, 0, FFI_PTR);
-+ /*@TODO check pointer dereference type 18.11 2013 (houqp)*/
-+
-+ return 0;
-+}
-+
-+int test_struct_timespec()
-+{
-+ int idx;
-+ csymbol *cs;
-+ csymbol_struct *stcs;
-+
-+ ffi_cdef("struct timespec { long ts_sec; long ts_nsec; };");
-+
-+ csym_state = ctype_get_csym_state();
-+ assert(cs_arr);
-+
-+ idx = lookup_csymbol_id_by_name("struct timespec");
-+ assert(idx >= 0);
-+ cs = &cs_arr[idx];
-+ assert(cs);
-+ assert(cs->type == FFI_STRUCT);
-+
-+ stcs = csym_struct(cs);
-+ assert(stcs->memb_nr == 2);
-+
-+ return 0;
-+}
-+
-+int test_func_time_to_tm()
-+{
-+ int idx;
-+ csymbol *cs, *arg_cs;
-+ csymbol_struct *stcs;
-+ csymbol_func *fcs;
-+
-+ ffi_cdef("typedef long time_t;");
-+ ffi_cdef("struct tm { "
-+ "int tm_sec;"
-+ "int tm_min;"
-+ "int tm_hour;"
-+ "int tm_mday;"
-+ "int tm_mon;"
-+ "long tm_year;"
-+ "int tm_wday;"
-+ "int tm_yday;"
-+ "};");
-+ ffi_cdef("void time_to_tm(time_t totalsecs, int offset, struct tm *result);");
-+
-+ csym_state = ctype_get_csym_state();
-+ assert(cs_arr);
-+
-+ idx = lookup_csymbol_id_by_name("struct tm");
-+ assert(idx >= 0);
-+ cs = cp_id_to_csym(idx);
-+ assert(cs);
-+ assert(cs->type == FFI_STRUCT);
-+
-+ stcs = csym_struct(cs);
-+ assert(stcs->memb_nr == 8);
-+
-+
-+ idx = lookup_csymbol_id_by_name("time_to_tm");
-+ assert(idx >= 0);
-+ cs = cp_id_to_csym(idx);
-+ assert(cs);
-+ assert(cs->type == FFI_FUNC);
-+
-+ fcs = csym_func(cs);
-+ assert(csymf_arg_nr(fcs) == 3);
-+ /* check first argument */
-+ assert_farg_type(fcs, 0, FFI_INT64);
-+
-+ /* check second argument */
-+ assert_farg_type(fcs, 1, FFI_INT32);
-+ /* check third argument */
-+ assert_farg_type(fcs, 2, FFI_PTR);
-+ arg_cs = cp_csymf_arg(fcs, 2);
-+ assert(!strcmp(csym_name(arg_cs), "struct tm *"));
-+ assert(csym_ptr_deref_id(arg_cs) ==
-+ lookup_csymbol_id_by_name("struct tm"));
-+
-+ return 0;
-+}
-+
-+int test_pointer_symbols()
-+{
-+ csymbol_func *fcs_foo, *fcs_bar;
-+
-+ /* int pointer symbol should be resolved to the same id */
-+ ffi_cdef("void foo(int *a);");
-+ ffi_cdef("int *bar(void);");
-+
-+ csym_state = ctype_get_csym_state();
-+ assert(cs_arr);
-+
-+ fcs_foo = csym_func(cp_id_to_csym(lookup_csymbol_id_by_name("foo")));
-+ fcs_bar = csym_func(cp_id_to_csym(lookup_csymbol_id_by_name("bar")));
-+
-+ assert(csymf_arg_ids(fcs_foo)[0] == csymf_ret_id(fcs_bar));
-+ assert(cp_csymf_arg(fcs_foo, 0) == cp_csymf_ret(fcs_bar));
-+
-+ return 0;
-+}
-+
-+int test_var_arg_function()
-+{
-+ csymbol_func *fcs;
-+
-+ ffi_cdef("int printk(char *fmt, ...);");
-+
-+ fcs = csym_func(cp_id_to_csym(lookup_csymbol_id_by_name("printk")));
-+
-+ /* var arg function needs void * type argument type checking */
-+ assert(lookup_csymbol_id_by_name("void *") >= 0);
-+
-+ assert_fret_type(fcs, FFI_INT32);
-+ assert_farg_type(fcs, 0, FFI_PTR);
-+ assert(fcs->has_var_arg);
-+
-+ return 0;
-+}
-+
-+int main (int argc, char *argv[])
-+{
-+ DO_TEST(func_sched_clock);
-+ DO_TEST(func_funct_module);
-+ DO_TEST(struct_timespec);
-+ DO_TEST(func_time_to_tm);
-+ DO_TEST(pointer_symbols);
-+ DO_TEST(var_arg_function);
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/test/ffi/ffi_test.kp
-@@ -0,0 +1,47 @@
-+function failed(msg) {
-+ printf("failed: " .. msg);
-+ printf("\n")
-+ exit(-1);
-+}
-+
-+
-+cdef[[
-+ void ffi_test_void();
-+ int ffi_test_int1(unsigned char a, char b, unsigned short c, short d);
-+ long long ffi_test_int2(unsigned int a, int b, unsigned long c, long d,
-+ unsigned long long e, long long f, long long g);
-+ void *ffi_test_pointer1(char *a);
-+ long long ffi_test_var_arg(int n, ...);
-+ unsigned long long ffi_test_sched_clock(void);
-+]]
-+
-+
-+ret = C.ffi_test_void()
-+if (ret != nil) {
-+ failed("ffi_test_void should return nil")
-+}
-+
-+ret = C.ffi_test_int1(1111, 1111, 1111, 1111)
-+if (ret != 2396) {
-+ failed("ffi_test_int1(1111, 1111, 1111, 1111) should return 2396")
-+}
-+
-+ret = C.ffi_test_int2(90, 7800, 560000, 34000000, 1200000000, 900000000000, 78000000000000)
-+if (ret != 78901234567890) {
-+ failed("ffi_test_int2 should return 78901234567890")
-+}
-+
-+ret = C.ffi_test_pointer1("")
-+if (ret == nil) {
-+ failed("ffi_test_pointer1 shoudl return address around 0xffff8800--------")
-+}
-+
-+ret = C.ffi_test_var_arg(7, 90, 7800, 560000, 34000000, 1200000000, 900000000000, 78000000000000)
-+if (ret != 78901234567890) {
-+ failed("ffi_test_var_arg should return 78901234567890")
-+}
-+
-+ret = C.ffi_test_sched_clock()
-+if (ret == nil) {
-+ failed("ffi_test_clock should not return nil")
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/test/ffi/ktap_ffi_test.c
-@@ -0,0 +1,64 @@
-+#include <linux/module.h>
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/sched.h>
-+
-+void ffi_test_void(void)
-+{
-+}
-+EXPORT_SYMBOL(ffi_test_void);
-+
-+int ffi_test_int1(unsigned char a, char b, unsigned short c, short d)
-+{
-+ return a + b + c + d;
-+}
-+EXPORT_SYMBOL(ffi_test_int1);
-+
-+long long ffi_test_int2(unsigned int a, int b, unsigned long c, long d,
-+ unsigned long long e, long long f, long long g)
-+{
-+ return a + b + c + d + e + f + g;
-+}
-+EXPORT_SYMBOL(ffi_test_int2);
-+
-+void *ffi_test_pointer1(char *a) {
-+ return a;
-+}
-+EXPORT_SYMBOL(ffi_test_pointer1);
-+
-+long long ffi_test_var_arg(int n, ...) {
-+ va_list ap;
-+ int i;
-+ long long sum = 0;
-+ va_start(ap, n);
-+ for (i = 0; i < n; i++) {
-+ sum += va_arg(ap, long long);
-+ }
-+ va_end(ap);
-+ return sum;
-+}
-+EXPORT_SYMBOL(ffi_test_var_arg);
-+
-+unsigned long long ffi_test_sched_clock(void)
-+{
-+ return sched_clock();
-+}
-+EXPORT_SYMBOL(ffi_test_sched_clock);
-+
-+
-+
-+static int __init ffi_test_init(void)
-+{
-+ return 0;
-+}
-+
-+static void __exit ffi_test_exit(void)
-+{
-+}
-+
-+
-+MODULE_DESCRIPTION("ktap ffi test module");
-+MODULE_LICENSE("GPL");
-+
-+module_init(ffi_test_init);
-+module_exit(ffi_test_exit);
---- /dev/null
-+++ b/drivers/staging/ktap/test/fibonacci.kp
-@@ -0,0 +1,36 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#---------------fibonacci----------------
-+
-+
-+#regular recursive fibonacci
-+function fib(n) {
-+ if (n < 2) {
-+ return n
-+ }
-+ return fib(n-1) + fib(n-2)
-+}
-+
-+if (fib(20) != 6765) {
-+ failed()
-+}
-+
-+#tail recursive fibonacci
-+function fib(n) {
-+ f = function (iter, res, next) {
-+ if (iter == 0) {
-+ return res;
-+ }
-+ return f(iter-1, next, res+next)
-+ }
-+ return f(n, 0, 1)
-+}
-+
-+if (fib(20) != 6765) {
-+ failed()
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/test/function.kp
-@@ -0,0 +1,88 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+### basic function call ###
-+function f1(a, b) {
-+ return a + b
-+}
-+
-+if (f1(2, 3) != 5) {
-+ failed();
-+}
-+
-+### return string ###
-+function f2() {
-+ return "function return"
-+}
-+
-+if (f2() != "function return") {
-+ failed();
-+}
-+
-+### mutli-value return ###
-+function f3(a, b) {
-+ return a+b, a-b;
-+}
-+
-+c, d = f3(2, 3);
-+if(c != 5 || d != -1) {
-+ failed();
-+}
-+
-+
-+### closure testing ###
-+function f4() {
-+ f5 = function(a, b) {
-+ return a * b
-+ }
-+ return f5
-+}
-+
-+local f = f4()
-+if (f(9, 9) != 81) {
-+ failed();
-+}
-+
-+### closure with lexcial variable ###
-+# issue: variable cannot be local
-+i = 1
-+function f6() {
-+ i = 5
-+ f7 = function(a, b) {
-+ return a * b + i
-+ }
-+ return f7
-+}
-+
-+f = f6()
-+if (f(9, 9) != 81 + i) {
-+ failed();
-+}
-+
-+i = 6
-+if (f(9, 9) != 81 + i) {
-+ failed();
-+}
-+
-+### tail call
-+### stack should not overflow in tail call mechanism
-+a = 0
-+function f8(i) {
-+ if (i == 1000000) {
-+ a = 1000000
-+ return
-+ }
-+ # must add return here, otherwise stack overflow
-+ return f8(i+1)
-+}
-+
-+f8(0)
-+if (a != 1000000) {
-+ failed();
-+}
-+
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/if.kp
-@@ -0,0 +1,24 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#-----------------------------------------#
-+
-+if (false) {
-+ failed()
-+}
-+
-+if (nil) {
-+ failed()
-+}
-+
-+# ktap only think false and nil is "real false", number 0 is true
-+# it's same as lua
-+# Might change it in future, to make similar with C
-+if (0) {
-+ #failed()
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/kprobe.kp
-@@ -0,0 +1,19 @@
-+#!/usr/bin/env ktap
-+
-+n = 0
-+trace probe:schedule {
-+ n = n + 1
-+}
-+
-+# share same event id with previous one
-+trace probe:schedule {
-+}
-+
-+
-+tick-1s {
-+ if (n == 0) {
-+ printf("failed\n");
-+ }
-+ exit()
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/kretprobe.kp
-@@ -0,0 +1,14 @@
-+#!/usr/bin/env ktap
-+
-+n = 0
-+trace probe:__schedule%return {
-+ n = n + 1
-+}
-+
-+tick-1s {
-+ if (n == 0) {
-+ printf("failed\n");
-+ }
-+ exit()
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/ksym.kp
-@@ -0,0 +1,17 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#-----------------------------------------#
-+
-+a = `generic_file_buffered_write`
-+b = `generic_file_mmap`
-+
-+printf("generic_file_buffered_write: 0x%x\n", a);
-+printf("generic_file_mmap: 0x%x\n", b);
-+
-+# test read symbol in kernel module
-+printf("kp_call: 0x%x\n", `kp_call`)
---- /dev/null
-+++ b/drivers/staging/ktap/test/len.kp
-@@ -0,0 +1,25 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#-----------------------------------------#
-+
-+a = "123456789"
-+
-+if (len(a) != 9) {
-+ failed()
-+}
-+
-+b = {}
-+b[0] = 0
-+b[1] = 1
-+b["keys"] = "values"
-+
-+if (len(b) != 3) {
-+ failed()
-+}
-+
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/looping.kp
-@@ -0,0 +1,40 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+### basic while-loop testing
-+a = 1
-+while (a < 1000) {
-+ a = a + 1
-+}
-+
-+if (a != 1000) {
-+ failed()
-+}
-+
-+### break testing
-+### Note that ktap don't have continue keyword
-+a = 1
-+while (a < 1000) {
-+ if (a == 10) {
-+ break
-+ }
-+ a = a + 1
-+}
-+
-+if (a != 10) {
-+ failed()
-+}
-+
-+### for-loop testing
-+b=0
-+for (c = 0, 1000, 1) {
-+ b = b + 1
-+}
-+
-+if (b != 1001) {
-+ failed()
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/test/pairs.kp
-@@ -0,0 +1,84 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#-----------------------------------------#
-+
-+t = {}
-+t[1] = 101
-+t[2] = 102
-+t[3] = 103
-+t["key_1"] = "value_1"
-+t["key_2"] = "value_2"
-+t["key_3"] = "value_3"
-+
-+local n = 0
-+
-+for (k, v in pairs(t)) {
-+ n = n + 1
-+
-+ if (k == 1 && v != 101) {
-+ failed()
-+ }
-+ if (k == 2 && v != 102) {
-+ failed()
-+ }
-+ if (k == 3 && v != 103) {
-+ failed()
-+ }
-+ if (k == "key_1" && v != "value_1") {
-+ failed()
-+ }
-+ if (k == "key_2" && v != "value_2") {
-+ failed()
-+ }
-+ if (k == "key_3" && v != "value_3") {
-+ failed()
-+ }
-+}
-+
-+if (n != len(t)) {
-+ failed()
-+}
-+
-+
-+#-------------------------------------------------#
-+
-+s = {}
-+s[1] = 12
-+s[2] = 2
-+s[3] = 3
-+s["124"] = 100
-+s["125"] = -1
-+
-+ordered = {}
-+
-+number = 0
-+
-+function cmp(v1, v2) {
-+ return (v1 > v2)
-+}
-+
-+for (k, v in sort_pairs(s, cmp)) {
-+ number += 1
-+ ordered[number] = v
-+}
-+
-+if (ordered[1] != 100) {
-+ failed()
-+}
-+if (ordered[2] != 12) {
-+ failed()
-+}
-+if (ordered[3] != 3) {
-+ failed()
-+}
-+if (ordered[4] != 2) {
-+ failed()
-+}
-+if (ordered[5] != -1) {
-+ failed()
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/test/ptable.kp
-@@ -0,0 +1,46 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#---------------------------------#
-+
-+s = ptable()
-+
-+for (i = 1, 100, 1) {
-+ s["k"] <<< i
-+}
-+
-+if (count(s["k"]) != 100) {
-+ failed()
-+}
-+if (sum(s["k"]) != 5050) {
-+ failed()
-+}
-+if (max(s["k"]) != 100) {
-+ failed()
-+}
-+if (min(s["k"]) != 1) {
-+ failed()
-+}
-+
-+for (i = 1, 10000, 1) {
-+ s[i] <<< i
-+}
-+
-+if (min(s[1]) != 1) {
-+ failed()
-+}
-+
-+if (sum(s[10]) != 10) {
-+ failed()
-+}
-+
-+if (max(s[100]) != 100) {
-+ failed()
-+}
-+
-+
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/run_test.sh
-@@ -0,0 +1,62 @@
-+#!/bin/sh
-+
-+rmmod ktapvm > /dev/null 2>&1
-+insmod ../ktapvm.ko
-+if test $? -ne 0; then
-+ echo "Cannot insmod ../ktapvm.ko"
-+ exit -1
-+fi
-+
-+KTAP=../ktap
-+ktaprun() {
-+ echo "$KTAP $@"
-+ $KTAP $@
-+}
-+
-+
-+
-+#######################################################
-+# Use $ktap directly if the arguments contains strings
-+$KTAP arg.kp 1 testing "2 3 4"
-+$KTAP -e 'print("one-liner testing")'
-+$KTAP -e 'exit()'
-+$KTAP -o /dev/null -e 'trace syscalls:* { print(argevent) }' \
-+ -- ls > /dev/null
-+
-+$KTAP -o /dev/null -e 'trace syscalls:* { print(argevent) }' \
-+ -- $KTAP -e 'print("trace ktap by self")'
-+
-+ktaprun arithmetic.kp
-+ktaprun -o /dev/null stack_overflow.kp
-+ktaprun concat.kp
-+ktaprun count.kp
-+ktaprun fibonacci.kp
-+ktaprun function.kp
-+ktaprun if.kp
-+ktaprun -q kprobe.kp
-+ktaprun -q kretprobe.kp
-+ktaprun len.kp
-+ktaprun looping.kp
-+ktaprun pairs.kp
-+ktaprun table.kp
-+ktaprun ptable.kp
-+ktaprun -q timer.kp
-+ktaprun -q tracepoint.kp
-+ktaprun -o /dev/null zerodivide.kp
-+ktaprun -o /dev/null ksym.kp
-+
-+echo "testing kill deadloop ktap script"
-+$KTAP -e 'while (1) {}' &
-+sleep 1
-+pkill ktap
-+sleep 1
-+
-+cd ffi && make --quiet --no-print-directory test && cd -
-+
-+#####################################################
-+rmmod ktapvm
-+if test $? -ne 0; then
-+ echo "Error in rmmod ../ktapvm.ko, leak module refcount?"
-+ exit -1
-+fi
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/stack_overflow.kp
-@@ -0,0 +1,9 @@
-+#!/usr/bin/env ktap
-+
-+#this script check overflow in ktap
-+
-+function f(a) {
-+ return 1 + f(a+1)
-+}
-+
-+print(f(0))
---- /dev/null
-+++ b/drivers/staging/ktap/test/table.kp
-@@ -0,0 +1,71 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+### table testing ###
-+x = {}
-+x[1] = "1"
-+if (x[1] != "1") {
-+ failed()
-+}
-+
-+x[1] = 22222222222222222222222222222222222222222
-+if (x[1] != 22222222222222222222222222222222222222222) {
-+ failed()
-+}
-+
-+x[1] = "jovi"
-+if (x[1] != "jovi") {
-+ failed()
-+}
-+
-+x[11111111111111111111111111111111] = "jovi"
-+if (x[11111111111111111111111111111111] != "jovi") {
-+ failed()
-+}
-+
-+x["jovi"] = 1
-+if (x["jovi"] != 1) {
-+ failed()
-+}
-+
-+x["long string....................................."] = 1
-+if (x["long string....................................."] != 1) {
-+ failed()
-+}
-+
-+# issue: subx must declare firstly, otherwise kernel will oops
-+subx = {}
-+subx["test"] = "this is test"
-+x["test"] = subx
-+if (x["test"]["test"] != "this is test") {
-+ failed()
-+}
-+
-+tbl = {}
-+i = 1
-+while (i < 100000) {
-+ tbl[i] = i
-+ i = i + 1
-+}
-+
-+i = 1
-+while (i < 100000) {
-+ if (tbl[i] != i) {
-+ failed()
-+ }
-+ i = i + 1
-+}
-+
-+#### table initization
-+days = {"Sunday", "Monday", "Tuesday", "Wednesday",
-+ "Thursday", "Friday", "Saturday"}
-+
-+if (days[2] != "Monday") {
-+ failed()
-+}
-+
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/timer.kp
-@@ -0,0 +1,28 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#---------------------------------------#
-+
-+n1 = 0
-+n2 = 0
-+
-+tick-1s {
-+ n1 = n1 + 1
-+}
-+
-+tick-1s {
-+ n2 = n2 + 1
-+}
-+
-+tick-4s {
-+ if (n1 == 0 || n2 == 0) {
-+ failed()
-+ }
-+ exit()
-+}
-+
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/tracepoint.kp
-@@ -0,0 +1,22 @@
-+#!/usr/bin/env ktap
-+
-+function failed() {
-+ printf("failed\n");
-+ exit(-1);
-+}
-+
-+#----------------------------------------#
-+
-+n = 0
-+
-+trace sched:* {
-+ n = n + 1
-+}
-+
-+tick-1s {
-+ if (n == 0) {
-+ failed()
-+ }
-+ exit()
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/test/zerodivide.kp
-@@ -0,0 +1,5 @@
-+#!/usr/bin/env ktap
-+
-+a = 1/0
-+#should not go here
-+printf("Failed\n")
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/code.c
-@@ -0,0 +1,998 @@
-+/*
-+ * code.c - Code generator for ktap
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_opcodes.h"
-+#include "ktapc.h"
-+#include "../runtime/kp_obj.h"
-+
-+
-+#define hasjumps(e) ((e)->t != (e)->f)
-+
-+void codegen_patchtohere (ktap_funcstate *fs, int list);
-+
-+static int isnumeral(ktap_expdesc *e)
-+{
-+ return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP);
-+}
-+
-+void codegen_nil(ktap_funcstate *fs, int from, int n)
-+{
-+ ktap_instruction *previous;
-+ int l = from + n - 1; /* last register to set nil */
-+
-+ if (fs->pc > fs->lasttarget) { /* no jumps to current position? */
-+ previous = &fs->f->code[fs->pc-1];
-+ if (GET_OPCODE(*previous) == OP_LOADNIL) {
-+ int pfrom = GETARG_A(*previous);
-+ int pl = pfrom + GETARG_B(*previous);
-+
-+ if ((pfrom <= from && from <= pl + 1) ||
-+ (from <= pfrom && pfrom <= l + 1)) { /* can connect both? */
-+ if (pfrom < from)
-+ from = pfrom; /* from = min(from, pfrom) */
-+ if (pl > l)
-+ l = pl; /* l = max(l, pl) */
-+ SETARG_A(*previous, from);
-+ SETARG_B(*previous, l - from);
-+ return;
-+ }
-+ } /* else go through */
-+ }
-+ codegen_codeABC(fs, OP_LOADNIL, from, n - 1, 0); /* else no optimization */
-+}
-+
-+int codegen_jump(ktap_funcstate *fs)
-+{
-+ int jpc = fs->jpc; /* save list of jumps to here */
-+ int j;
-+
-+ fs->jpc = NO_JUMP;
-+ j = codegen_codeAsBx(fs, OP_JMP, 0, NO_JUMP);
-+ codegen_concat(fs, &j, jpc); /* keep them on hold */
-+ return j;
-+}
-+
-+void codegen_ret(ktap_funcstate *fs, int first, int nret)
-+{
-+ codegen_codeABC(fs, OP_RETURN, first, nret+1, 0);
-+}
-+
-+static int condjump(ktap_funcstate *fs, OpCode op, int A, int B, int C)
-+{
-+ codegen_codeABC(fs, op, A, B, C);
-+ return codegen_jump(fs);
-+}
-+
-+static void fixjump(ktap_funcstate *fs, int pc, int dest)
-+{
-+ ktap_instruction *jmp = &fs->f->code[pc];
-+ int offset = dest-(pc+1);
-+
-+ ktap_assert(dest != NO_JUMP);
-+ if (abs(offset) > MAXARG_sBx)
-+ lex_syntaxerror(fs->ls, "control structure too long");
-+ SETARG_sBx(*jmp, offset);
-+}
-+
-+/*
-+ * returns current `pc' and marks it as a jump target (to avoid wrong
-+ * optimizations with consecutive instructions not in the same basic block).
-+ */
-+int codegen_getlabel(ktap_funcstate *fs)
-+{
-+ fs->lasttarget = fs->pc;
-+ return fs->pc;
-+}
-+
-+static int getjump(ktap_funcstate *fs, int pc)
-+{
-+ int offset = GETARG_sBx(fs->f->code[pc]);
-+
-+ if (offset == NO_JUMP) /* point to itself represents end of list */
-+ return NO_JUMP; /* end of list */
-+ else
-+ return (pc+1)+offset; /* turn offset into absolute position */
-+}
-+
-+static ktap_instruction *getjumpcontrol(ktap_funcstate *fs, int pc)
-+{
-+ ktap_instruction *pi = &fs->f->code[pc];
-+ if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1))))
-+ return pi-1;
-+ else
-+ return pi;
-+}
-+
-+/*
-+ * check whether list has any jump that do not produce a value
-+ * (or produce an inverted value)
-+ */
-+static int need_value(ktap_funcstate *fs, int list)
-+{
-+ for (; list != NO_JUMP; list = getjump(fs, list)) {
-+ ktap_instruction i = *getjumpcontrol(fs, list);
-+ if (GET_OPCODE(i) != OP_TESTSET)
-+ return 1;
-+ }
-+ return 0; /* not found */
-+}
-+
-+static int patchtestreg(ktap_funcstate *fs, int node, int reg)
-+{
-+ ktap_instruction *i = getjumpcontrol(fs, node);
-+ if (GET_OPCODE(*i) != OP_TESTSET)
-+ return 0; /* cannot patch other instructions */
-+ if (reg != NO_REG && reg != GETARG_B(*i))
-+ SETARG_A(*i, reg);
-+ else /* no register to put value or register already has the value */
-+ *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i));
-+
-+ return 1;
-+}
-+
-+static void removevalues(ktap_funcstate *fs, int list)
-+{
-+ for (; list != NO_JUMP; list = getjump(fs, list))
-+ patchtestreg(fs, list, NO_REG);
-+}
-+
-+static void patchlistaux(ktap_funcstate *fs, int list, int vtarget, int reg,
-+ int dtarget)
-+{
-+ while (list != NO_JUMP) {
-+ int next = getjump(fs, list);
-+ if (patchtestreg(fs, list, reg))
-+ fixjump(fs, list, vtarget);
-+ else
-+ fixjump(fs, list, dtarget); /* jump to default target */
-+ list = next;
-+ }
-+}
-+
-+static void dischargejpc(ktap_funcstate *fs)
-+{
-+ patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc);
-+ fs->jpc = NO_JUMP;
-+}
-+
-+void codegen_patchlist(ktap_funcstate *fs, int list, int target)
-+{
-+ if (target == fs->pc)
-+ codegen_patchtohere(fs, list);
-+ else {
-+ ktap_assert(target < fs->pc);
-+ patchlistaux(fs, list, target, NO_REG, target);
-+ }
-+}
-+
-+void codegen_patchclose(ktap_funcstate *fs, int list, int level)
-+{
-+ level++; /* argument is +1 to reserve 0 as non-op */
-+ while (list != NO_JUMP) {
-+ int next = getjump(fs, list);
-+ ktap_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP &&
-+ (GETARG_A(fs->f->code[list]) == 0 ||
-+ GETARG_A(fs->f->code[list]) >= level));
-+ SETARG_A(fs->f->code[list], level);
-+ list = next;
-+ }
-+}
-+
-+void codegen_patchtohere(ktap_funcstate *fs, int list)
-+{
-+ codegen_getlabel(fs);
-+ codegen_concat(fs, &fs->jpc, list);
-+}
-+
-+void codegen_concat(ktap_funcstate *fs, int *l1, int l2)
-+{
-+ if (l2 == NO_JUMP)
-+ return;
-+ else if (*l1 == NO_JUMP)
-+ *l1 = l2;
-+ else {
-+ int list = *l1;
-+ int next;
-+ while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */
-+ list = next;
-+ fixjump(fs, list, l2);
-+ }
-+}
-+
-+static int codegen_code(ktap_funcstate *fs, ktap_instruction i)
-+{
-+ ktap_proto *f = fs->f;
-+
-+ dischargejpc(fs); /* `pc' will change */
-+
-+ /* put new instruction in code array */
-+ ktapc_growvector(f->code, fs->pc, f->sizecode, ktap_instruction,
-+ MAX_INT, "opcodes");
-+ f->code[fs->pc] = i;
-+
-+ /* save corresponding line information */
-+ ktapc_growvector(f->lineinfo, fs->pc, f->sizelineinfo, int,
-+ MAX_INT, "opcodes");
-+ f->lineinfo[fs->pc] = fs->ls->lastline;
-+ return fs->pc++;
-+}
-+
-+int codegen_codeABC(ktap_funcstate *fs, OpCode o, int a, int b, int c)
-+{
-+ ktap_assert(getOpMode(o) == iABC);
-+ //ktap_assert(getBMode(o) != OpArgN || b == 0);
-+ //ktap_assert(getCMode(o) != OpArgN || c == 0);
-+ //ktap_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C);
-+ return codegen_code(fs, CREATE_ABC(o, a, b, c));
-+}
-+
-+int codegen_codeABx(ktap_funcstate *fs, OpCode o, int a, unsigned int bc)
-+{
-+ ktap_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx);
-+ ktap_assert(getCMode(o) == OpArgN);
-+ ktap_assert(a <= MAXARG_A && bc <= MAXARG_Bx);
-+ return codegen_code(fs, CREATE_ABx(o, a, bc));
-+}
-+
-+static int codeextraarg(ktap_funcstate *fs, int a)
-+{
-+ ktap_assert(a <= MAXARG_Ax);
-+ return codegen_code(fs, CREATE_Ax(OP_EXTRAARG, a));
-+}
-+
-+int codegen_codek(ktap_funcstate *fs, int reg, int k)
-+{
-+ if (k <= MAXARG_Bx)
-+ return codegen_codeABx(fs, OP_LOADK, reg, k);
-+ else {
-+ int p = codegen_codeABx(fs, OP_LOADKX, reg, 0);
-+ codeextraarg(fs, k);
-+ return p;
-+ }
-+}
-+
-+void codegen_checkstack(ktap_funcstate *fs, int n)
-+{
-+ int newstack = fs->freereg + n;
-+
-+ if (newstack > fs->f->maxstacksize) {
-+ if (newstack >= MAXSTACK)
-+ lex_syntaxerror(fs->ls, "function or expression too complex");
-+ fs->f->maxstacksize = (u8)(newstack);
-+ }
-+}
-+
-+void codegen_reserveregs(ktap_funcstate *fs, int n)
-+{
-+ codegen_checkstack(fs, n);
-+ fs->freereg += n;
-+}
-+
-+static void freereg(ktap_funcstate *fs, int reg)
-+{
-+ if (!ISK(reg) && reg >= fs->nactvar) {
-+ fs->freereg--;
-+ ktap_assert(reg == fs->freereg);
-+ }
-+}
-+
-+static void freeexp(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ if (e->k == VNONRELOC)
-+ freereg(fs, e->u.info);
-+}
-+
-+static int addk(ktap_funcstate *fs, ktap_value *key, ktap_value *v)
-+{
-+ const ktap_value *idx = ktapc_table_get(fs->h, key);
-+ ktap_proto *f = fs->f;
-+ ktap_value kn;
-+ int k, oldsize;
-+
-+ if (is_number(idx)) {
-+ ktap_number n = nvalue(idx);
-+ kp_number2int(k, n);
-+ if (ktapc_equalobj(&f->k[k], v))
-+ return k;
-+ /* else may be a collision (e.g., between 0.0 and "\0\0\0\0\0\0\0\0");
-+ go through and create a new entry for this value */
-+ }
-+ /* constant not found; create a new entry */
-+ oldsize = f->sizek;
-+ k = fs->nk;
-+
-+ /* numerical value does not need GC barrier;
-+ table has no metatable, so it does not need to invalidate cache */
-+ set_number(&kn, (ktap_number)k);
-+ ktapc_table_setvalue(fs->h, key, &kn);
-+ ktapc_growvector(f->k, k, f->sizek, ktap_value, MAXARG_Ax, "constants");
-+ while (oldsize < f->sizek)
-+ set_nil(&f->k[oldsize++]);
-+ set_obj(&f->k[k], v);
-+ fs->nk++;
-+ return k;
-+}
-+
-+int codegen_stringK(ktap_funcstate *fs, ktap_string *s)
-+{
-+ ktap_value o;
-+
-+ set_string(&o, s);
-+ return addk(fs, &o, &o);
-+}
-+
-+int codegen_numberK(ktap_funcstate *fs, ktap_number r)
-+{
-+ int n;
-+ ktap_value o, s;
-+
-+ set_number(&o, r);
-+ if (r == 0 || ktap_numisnan(NULL, r)) { /* handle -0 and NaN */
-+ /* use raw representation as key to avoid numeric problems */
-+ set_string(&s, ktapc_ts_newlstr((char *)&r, sizeof(r)));
-+ // incr_top(L);
-+ n = addk(fs, &s, &o);
-+ // L->top--;
-+ } else
-+ n = addk(fs, &o, &o); /* regular case */
-+ return n;
-+}
-+
-+static int boolK(ktap_funcstate *fs, int b)
-+{
-+ ktap_value o;
-+ set_boolean(&o, b);
-+ return addk(fs, &o, &o);
-+}
-+
-+static int nilK(ktap_funcstate *fs)
-+{
-+ ktap_value k, v;
-+ set_nil(&v);
-+ /* cannot use nil as key; instead use table itself to represent nil */
-+ set_table(&k, fs->h);
-+ return addk(fs, &k, &v);
-+}
-+
-+void codegen_setreturns(ktap_funcstate *fs, ktap_expdesc *e, int nresults)
-+{
-+ if (e->k == VCALL) { /* expression is an open function call? */
-+ SETARG_C(getcode(fs, e), nresults+1);
-+ }
-+ else if (e->k == VVARARG) {
-+ SETARG_B(getcode(fs, e), nresults+1);
-+ SETARG_A(getcode(fs, e), fs->freereg);
-+ codegen_reserveregs(fs, 1);
-+ }
-+}
-+
-+void codegen_setoneret(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ if (e->k == VCALL) { /* expression is an open function call? */
-+ e->k = VNONRELOC;
-+ e->u.info = GETARG_A(getcode(fs, e));
-+ } else if (e->k == VVARARG) {
-+ SETARG_B(getcode(fs, e), 2);
-+ e->k = VRELOCABLE; /* can relocate its simple result */
-+ }
-+}
-+
-+void codegen_dischargevars(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ switch (e->k) {
-+ case VLOCAL: {
-+ e->k = VNONRELOC;
-+ break;
-+ }
-+ case VUPVAL: {
-+ e->u.info = codegen_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0);
-+ e->k = VRELOCABLE;
-+ break;
-+ }
-+ case VINDEXED: {
-+ OpCode op = OP_GETTABUP; /* assume 't' is in an upvalue */
-+ freereg(fs, e->u.ind.idx);
-+ if (e->u.ind.vt == VLOCAL) { /* 't' is in a register? */
-+ freereg(fs, e->u.ind.t);
-+ op = OP_GETTABLE;
-+ }
-+ e->u.info = codegen_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx);
-+ e->k = VRELOCABLE;
-+ break;
-+ }
-+ case VVARARG:
-+ case VCALL: {
-+ codegen_setoneret(fs, e);
-+ break;
-+ }
-+ default:
-+ break; /* there is one value available (somewhere) */
-+ }
-+}
-+
-+static int code_label(ktap_funcstate *fs, int A, int b, int jump)
-+{
-+ codegen_getlabel(fs); /* those instructions may be jump targets */
-+ return codegen_codeABC(fs, OP_LOADBOOL, A, b, jump);
-+}
-+
-+static void discharge2reg(ktap_funcstate *fs, ktap_expdesc *e, int reg)
-+{
-+ codegen_dischargevars(fs, e);
-+ switch (e->k) {
-+ case VNIL: {
-+ codegen_nil(fs, reg, 1);
-+ break;
-+ }
-+ case VFALSE: case VTRUE: {
-+ codegen_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);
-+ break;
-+ }
-+ case VEVENT:
-+ codegen_codeABC(fs, OP_EVENT, reg, 0, 0);
-+ break;
-+ case VEVENTNAME:
-+ codegen_codeABC(fs, OP_EVENTNAME, reg, 0, 0);
-+ break;
-+ case VEVENTARG:
-+ codegen_codeABC(fs, OP_EVENTARG, reg, e->u.info, 0);
-+ break;
-+ case VK: {
-+ codegen_codek(fs, reg, e->u.info);
-+ break;
-+ }
-+ case VKNUM: {
-+ codegen_codek(fs, reg, codegen_numberK(fs, e->u.nval));
-+ break;
-+ }
-+ case VRELOCABLE: {
-+ ktap_instruction *pc = &getcode(fs, e);
-+ SETARG_A(*pc, reg);
-+ break;
-+ }
-+ case VNONRELOC: {
-+ if (reg != e->u.info)
-+ codegen_codeABC(fs, OP_MOVE, reg, e->u.info, 0);
-+ break;
-+ }
-+ default:
-+ ktap_assert(e->k == VVOID || e->k == VJMP);
-+ return; /* nothing to do... */
-+ }
-+
-+ e->u.info = reg;
-+ e->k = VNONRELOC;
-+}
-+
-+static void discharge2anyreg(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ if (e->k != VNONRELOC) {
-+ codegen_reserveregs(fs, 1);
-+ discharge2reg(fs, e, fs->freereg-1);
-+ }
-+}
-+
-+static void exp2reg(ktap_funcstate *fs, ktap_expdesc *e, int reg)
-+{
-+ discharge2reg(fs, e, reg);
-+ if (e->k == VJMP)
-+ codegen_concat(fs, &e->t, e->u.info); /* put this jump in `t' list */
-+ if (hasjumps(e)) {
-+ int final; /* position after whole expression */
-+ int p_f = NO_JUMP; /* position of an eventual LOAD false */
-+ int p_t = NO_JUMP; /* position of an eventual LOAD true */
-+
-+ if (need_value(fs, e->t) || need_value(fs, e->f)) {
-+ int fj = (e->k == VJMP) ? NO_JUMP : codegen_jump(fs);
-+
-+ p_f = code_label(fs, reg, 0, 1);
-+ p_t = code_label(fs, reg, 1, 0);
-+ codegen_patchtohere(fs, fj);
-+ }
-+ final = codegen_getlabel(fs);
-+ patchlistaux(fs, e->f, final, reg, p_f);
-+ patchlistaux(fs, e->t, final, reg, p_t);
-+ }
-+ e->f = e->t = NO_JUMP;
-+ e->u.info = reg;
-+ e->k = VNONRELOC;
-+}
-+
-+void codegen_exp2nextreg(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ codegen_dischargevars(fs, e);
-+ freeexp(fs, e);
-+ codegen_reserveregs(fs, 1);
-+ exp2reg(fs, e, fs->freereg - 1);
-+}
-+
-+int codegen_exp2anyreg(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ codegen_dischargevars(fs, e);
-+ if (e->k == VNONRELOC) {
-+ if (!hasjumps(e))
-+ return e->u.info; /* exp is already in a register */
-+ if (e->u.info >= fs->nactvar) { /* reg. is not a local? */
-+ exp2reg(fs, e, e->u.info); /* put value on it */
-+ return e->u.info;
-+ }
-+ }
-+ codegen_exp2nextreg(fs, e); /* default */
-+ return e->u.info;
-+}
-+
-+void codegen_exp2anyregup(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ if (e->k != VUPVAL || hasjumps(e))
-+ codegen_exp2anyreg(fs, e);
-+}
-+
-+void codegen_exp2val(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ if (hasjumps(e))
-+ codegen_exp2anyreg(fs, e);
-+ else
-+ codegen_dischargevars(fs, e);
-+}
-+
-+int codegen_exp2RK(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ codegen_exp2val(fs, e);
-+ switch (e->k) {
-+ case VTRUE:
-+ case VFALSE:
-+ case VNIL: {
-+ if (fs->nk <= MAXINDEXRK) { /* constant fits in RK operand? */
-+ e->u.info = (e->k == VNIL) ? nilK(fs) :
-+ boolK(fs, (e->k == VTRUE));
-+ e->k = VK;
-+ return RKASK(e->u.info);
-+ }
-+ else
-+ break;
-+ }
-+ case VKNUM: {
-+ e->u.info = codegen_numberK(fs, e->u.nval);
-+ e->k = VK;
-+ /* go through */
-+ }
-+ case VK: {
-+ if (e->u.info <= MAXINDEXRK) /* constant fits in argC? */
-+ return RKASK(e->u.info);
-+ else
-+ break;
-+ }
-+ default:
-+ break;
-+ }
-+ /* not a constant in the right range: put it in a register */
-+ return codegen_exp2anyreg(fs, e);
-+}
-+
-+void codegen_storevar(ktap_funcstate *fs, ktap_expdesc *var, ktap_expdesc *ex)
-+{
-+ switch (var->k) {
-+ case VLOCAL: {
-+ freeexp(fs, ex);
-+ exp2reg(fs, ex, var->u.info);
-+ return;
-+ }
-+ case VUPVAL: {
-+ int e = codegen_exp2anyreg(fs, ex);
-+ codegen_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0);
-+ break;
-+ }
-+ case VINDEXED: {
-+ OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP;
-+ int e = codegen_exp2RK(fs, ex);
-+ codegen_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e);
-+ break;
-+ }
-+ default:
-+ ktap_assert(0); /* invalid var kind to store */
-+ break;
-+ }
-+
-+ freeexp(fs, ex);
-+}
-+
-+void codegen_storeincr(ktap_funcstate *fs, ktap_expdesc *var, ktap_expdesc *ex)
-+{
-+ switch (var->k) {
-+#if 0 /*current not supported */
-+ case VLOCAL: {
-+ freeexp(fs, ex);
-+ exp2reg(fs, ex, var->u.info);
-+ return;
-+ }
-+ case VUPVAL: {
-+ int e = codegen_exp2anyreg(fs, ex);
-+ codegen_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0);
-+ break;
-+ }
-+#endif
-+ case VINDEXED: {
-+ OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE_INCR :
-+ OP_SETTABUP_INCR;
-+ int e = codegen_exp2RK(fs, ex);
-+ codegen_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e);
-+ break;
-+ }
-+ default:
-+ ktap_assert(0); /* invalid var kind to store */
-+ break;
-+ }
-+
-+ freeexp(fs, ex);
-+}
-+
-+void codegen_store_aggr(ktap_funcstate *fs, ktap_expdesc *var, ktap_expdesc *ex)
-+{
-+ switch (var->k) {
-+#if 0 /*current not supported */
-+ case VLOCAL: {
-+ freeexp(fs, ex);
-+ exp2reg(fs, ex, var->u.info);
-+ return;
-+ }
-+ case VUPVAL: {
-+ int e = codegen_exp2anyreg(fs, ex);
-+ codegen_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0);
-+ break;
-+ }
-+#endif
-+ case VINDEXED: {
-+ OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE_AGGR :
-+ OP_SETTABUP_AGGR;
-+ int e = codegen_exp2RK(fs, ex);
-+ codegen_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e);
-+ break;
-+ }
-+ default:
-+ ktap_assert(0); /* invalid var kind to store */
-+ break;
-+ }
-+
-+ freeexp(fs, ex);
-+}
-+
-+void codegen_self(ktap_funcstate *fs, ktap_expdesc *e, ktap_expdesc *key)
-+{
-+ int ereg;
-+
-+ codegen_exp2anyreg(fs, e);
-+ ereg = e->u.info; /* register where 'e' was placed */
-+ freeexp(fs, e);
-+ e->u.info = fs->freereg; /* base register for op_self */
-+ e->k = VNONRELOC;
-+ codegen_reserveregs(fs, 2); /* function and 'self' produced by op_self */
-+ codegen_codeABC(fs, OP_SELF, e->u.info, ereg, codegen_exp2RK(fs, key));
-+ freeexp(fs, key);
-+}
-+
-+static void invertjump(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ ktap_instruction *pc = getjumpcontrol(fs, e->u.info);
-+ ktap_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET &&
-+ GET_OPCODE(*pc) != OP_TEST);
-+ SETARG_A(*pc, !(GETARG_A(*pc)));
-+}
-+
-+static int jumponcond(ktap_funcstate *fs, ktap_expdesc *e, int cond)
-+{
-+ if (e->k == VRELOCABLE) {
-+ ktap_instruction ie = getcode(fs, e);
-+ if (GET_OPCODE(ie) == OP_NOT) {
-+ fs->pc--; /* remove previous OP_NOT */
-+ return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond);
-+ }
-+ /* else go through */
-+ }
-+ discharge2anyreg(fs, e);
-+ freeexp(fs, e);
-+ return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond);
-+}
-+
-+void codegen_goiftrue(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ int pc; /* pc of last jump */
-+
-+ codegen_dischargevars(fs, e);
-+ switch (e->k) {
-+ case VJMP: {
-+ invertjump(fs, e);
-+ pc = e->u.info;
-+ break;
-+ }
-+ case VK: case VKNUM: case VTRUE: {
-+ pc = NO_JUMP; /* always true; do nothing */
-+ break;
-+ }
-+ default:
-+ pc = jumponcond(fs, e, 0);
-+ break;
-+ }
-+
-+ codegen_concat(fs, &e->f, pc); /* insert last jump in `f' list */
-+ codegen_patchtohere(fs, e->t);
-+ e->t = NO_JUMP;
-+}
-+
-+void codegen_goiffalse(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ int pc; /* pc of last jump */
-+ codegen_dischargevars(fs, e);
-+
-+ switch (e->k) {
-+ case VJMP: {
-+ pc = e->u.info;
-+ break;
-+ }
-+ case VNIL: case VFALSE: {
-+ pc = NO_JUMP; /* always false; do nothing */
-+ break;
-+ }
-+ default:
-+ pc = jumponcond(fs, e, 1);
-+ break;
-+ }
-+ codegen_concat(fs, &e->t, pc); /* insert last jump in `t' list */
-+ codegen_patchtohere(fs, e->f);
-+ e->f = NO_JUMP;
-+}
-+
-+static void codenot(ktap_funcstate *fs, ktap_expdesc *e)
-+{
-+ codegen_dischargevars(fs, e);
-+ switch (e->k) {
-+ case VNIL: case VFALSE: {
-+ e->k = VTRUE;
-+ break;
-+ }
-+ case VK: case VKNUM: case VTRUE: {
-+ e->k = VFALSE;
-+ break;
-+ }
-+ case VJMP: {
-+ invertjump(fs, e);
-+ break;
-+ }
-+ case VRELOCABLE:
-+ case VNONRELOC: {
-+ discharge2anyreg(fs, e);
-+ freeexp(fs, e);
-+ e->u.info = codegen_codeABC(fs, OP_NOT, 0, e->u.info, 0);
-+ e->k = VRELOCABLE;
-+ break;
-+ }
-+ default:
-+ ktap_assert(0); /* cannot happen */
-+ break;
-+ }
-+
-+ /* interchange true and false lists */
-+ { int temp = e->f; e->f = e->t; e->t = temp; }
-+ removevalues(fs, e->f);
-+ removevalues(fs, e->t);
-+}
-+
-+void codegen_indexed(ktap_funcstate *fs, ktap_expdesc *t, ktap_expdesc *k)
-+{
-+ ktap_assert(!hasjumps(t));
-+ t->u.ind.t = t->u.info;
-+ t->u.ind.idx = codegen_exp2RK(fs, k);
-+ t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL
-+ : check_exp(vkisinreg(t->k), VLOCAL);
-+ t->k = VINDEXED;
-+}
-+
-+static int constfolding(OpCode op, ktap_expdesc *e1, ktap_expdesc *e2)
-+{
-+ ktap_number r;
-+
-+ if (!isnumeral(e1) || !isnumeral(e2))
-+ return 0;
-+
-+ if ((op == OP_DIV || op == OP_MOD) && e2->u.nval == 0)
-+ return 0; /* do not attempt to divide by 0 */
-+
-+ if (op == OP_POW)
-+ return 0; /* ktap current do not suppor pow arith */
-+
-+ r = ktapc_arith(op - OP_ADD + KTAP_OPADD, e1->u.nval, e2->u.nval);
-+ e1->u.nval = r;
-+ return 1;
-+}
-+
-+static void codearith(ktap_funcstate *fs, OpCode op,
-+ ktap_expdesc *e1, ktap_expdesc *e2, int line)
-+{
-+ if (constfolding(op, e1, e2))
-+ return;
-+ else {
-+ int o2 = (op != OP_UNM && op != OP_LEN) ? codegen_exp2RK(fs, e2) : 0;
-+ int o1 = codegen_exp2RK(fs, e1);
-+
-+ if (o1 > o2) {
-+ freeexp(fs, e1);
-+ freeexp(fs, e2);
-+ } else {
-+ freeexp(fs, e2);
-+ freeexp(fs, e1);
-+ }
-+ e1->u.info = codegen_codeABC(fs, op, 0, o1, o2);
-+ e1->k = VRELOCABLE;
-+ codegen_fixline(fs, line);
-+ }
-+}
-+
-+static void codecomp(ktap_funcstate *fs, OpCode op, int cond, ktap_expdesc *e1,
-+ ktap_expdesc *e2)
-+{
-+ int o1 = codegen_exp2RK(fs, e1);
-+ int o2 = codegen_exp2RK(fs, e2);
-+
-+ freeexp(fs, e2);
-+ freeexp(fs, e1);
-+ if (cond == 0 && op != OP_EQ) {
-+ int temp; /* exchange args to replace by `<' or `<=' */
-+ temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */
-+ cond = 1;
-+ }
-+ e1->u.info = condjump(fs, op, cond, o1, o2);
-+ e1->k = VJMP;
-+}
-+
-+void codegen_prefix(ktap_funcstate *fs, UnOpr op, ktap_expdesc *e, int line)
-+{
-+ ktap_expdesc e2;
-+
-+ e2.t = e2.f = NO_JUMP;
-+ e2.k = VKNUM;
-+ e2.u.nval = 0;
-+
-+ switch (op) {
-+ case OPR_MINUS: {
-+ if (isnumeral(e)) /* minus constant? */
-+ e->u.nval = ktap_numunm(e->u.nval); /* fold it */
-+ else {
-+ codegen_exp2anyreg(fs, e);
-+ codearith(fs, OP_UNM, e, &e2, line);
-+ }
-+ break;
-+ }
-+ case OPR_NOT:
-+ codenot(fs, e);
-+ break;
-+ case OPR_LEN: {
-+ codegen_exp2anyreg(fs, e); /* cannot operate on constants */
-+ codearith(fs, OP_LEN, e, &e2, line);
-+ break;
-+ }
-+ default:
-+ ktap_assert(0);
-+ }
-+}
-+
-+void codegen_infix(ktap_funcstate *fs, BinOpr op, ktap_expdesc *v)
-+{
-+ switch (op) {
-+ case OPR_AND: {
-+ codegen_goiftrue(fs, v);
-+ break;
-+ }
-+ case OPR_OR: {
-+ codegen_goiffalse(fs, v);
-+ break;
-+ }
-+ case OPR_CONCAT: {
-+ codegen_exp2nextreg(fs, v); /* operand must be on the `stack' */
-+ break;
-+ }
-+ case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
-+ case OPR_MOD: case OPR_POW: {
-+ if (!isnumeral(v)) codegen_exp2RK(fs, v);
-+ break;
-+ }
-+ default:
-+ codegen_exp2RK(fs, v);
-+ break;
-+ }
-+}
-+
-+void codegen_posfix(ktap_funcstate *fs, BinOpr op, ktap_expdesc *e1, ktap_expdesc *e2, int line)
-+{
-+ switch (op) {
-+ case OPR_AND: {
-+ ktap_assert(e1->t == NO_JUMP); /* list must be closed */
-+ codegen_dischargevars(fs, e2);
-+ codegen_concat(fs, &e2->f, e1->f);
-+ *e1 = *e2;
-+ break;
-+ }
-+ case OPR_OR: {
-+ ktap_assert(e1->f == NO_JUMP); /* list must be closed */
-+ codegen_dischargevars(fs, e2);
-+ codegen_concat(fs, &e2->t, e1->t);
-+ *e1 = *e2;
-+ break;
-+ }
-+ case OPR_CONCAT: {
-+ codegen_exp2val(fs, e2);
-+ if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {
-+ ktap_assert(e1->u.info == GETARG_B(getcode(fs, e2))-1);
-+ freeexp(fs, e1);
-+ SETARG_B(getcode(fs, e2), e1->u.info);
-+ e1->k = VRELOCABLE; e1->u.info = e2->u.info;
-+ } else {
-+ codegen_exp2nextreg(fs, e2); /* operand must be on the 'stack' */
-+ codearith(fs, OP_CONCAT, e1, e2, line);
-+ }
-+ break;
-+ }
-+ case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
-+ case OPR_MOD: case OPR_POW: {
-+ codearith(fs, (OpCode)(op - OPR_ADD + OP_ADD), e1, e2, line);
-+ break;
-+ }
-+ case OPR_EQ: case OPR_LT: case OPR_LE: {
-+ codecomp(fs, (OpCode)(op - OPR_EQ + OP_EQ), 1, e1, e2);
-+ break;
-+ }
-+ case OPR_NE: case OPR_GT: case OPR_GE: {
-+ codecomp(fs, (OpCode)(op - OPR_NE + OP_EQ), 0, e1, e2);
-+ break;
-+ }
-+ default:
-+ ktap_assert(0);
-+ }
-+}
-+
-+void codegen_fixline(ktap_funcstate *fs, int line)
-+{
-+ fs->f->lineinfo[fs->pc - 1] = line;
-+}
-+
-+void codegen_setlist(ktap_funcstate *fs, int base, int nelems, int tostore)
-+{
-+ int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1;
-+ int b = (tostore == KTAP_MULTRET) ? 0 : tostore;
-+
-+ ktap_assert(tostore != 0);
-+ if (c <= MAXARG_C)
-+ codegen_codeABC(fs, OP_SETLIST, base, b, c);
-+ else if (c <= MAXARG_Ax) {
-+ codegen_codeABC(fs, OP_SETLIST, base, b, 0);
-+ codeextraarg(fs, c);
-+ } else
-+ lex_syntaxerror(fs->ls, "constructor too long");
-+ fs->freereg = base + 1; /* free registers with list values */
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/cparser.h
-@@ -0,0 +1,202 @@
-+#ifndef __KTAP_CPARSER_H__
-+#define __KTAP_CPARSER_H__
-+
-+/*
-+ * Copyright (c) 2011 James R. McKaskill
-+ *
-+ * This software is licensed under the stock MIT license:
-+ *
-+ * Permission is hereby granted, free of charge, to any person obtaining a
-+ * copy of this software and associated documentation files (the "Software"),
-+ * to deal in the Software without restriction, including without limitation
-+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
-+ * and/or sell copies of the Software, and to permit persons to whom the
-+ * Software is furnished to do so, subject to the following conditions:
-+ *
-+ * The above copyright notice and this permission notice shall be included in
-+ * all copies or substantial portions of the Software.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-+ * DEALINGS IN THE SOFTWARE.
-+ *
-+ * ----------------------------------------------------------------------------
-+ */
-+
-+/*
-+ * Adapted from luaffi commit: abc638c9341025580099dcf77795c4b320ba0e63
-+ *
-+ * Copyright (c) 2013 Yicheng Qin, Qingping Hou
-+ */
-+
-+#ifdef CONFIG_KTAP_FFI
-+
-+#include <assert.h>
-+#include <stdlib.h>
-+#include <stdio.h>
-+#include <stdint.h>
-+#include <string.h>
-+#include <stdbool.h>
-+
-+#include "../include/ktap_ffi.h"
-+
-+#define PTR_ALIGN_MASK (sizeof(void*) - 1)
-+#define FUNCTION_ALIGN_MASK (sizeof(void (*)()) - 1)
-+#define DEFAULT_ALIGN_MASK 7
-+
-+struct parser {
-+ int line;
-+ const char *next;
-+ const char *prev;
-+ unsigned align_mask;
-+};
-+
-+enum {
-+ C_CALL,
-+ STD_CALL,
-+ FAST_CALL,
-+};
-+
-+
-+#define MAX_TYPE_NAME_LEN CSYM_NAME_MAX_LEN
-+
-+enum {
-+ /* 0 - 4 */
-+ INVALID_TYPE,
-+ VOID_TYPE,
-+ BOOL_TYPE,
-+ INT8_TYPE,
-+ INT16_TYPE,
-+ /* 5 - 9 */
-+ INT32_TYPE,
-+ INT64_TYPE,
-+ INTPTR_TYPE,
-+ ENUM_TYPE,
-+ UNION_TYPE,
-+ /* 10 - 12 */
-+ STRUCT_TYPE,
-+ FUNCTION_TYPE,
-+ FUNCTION_PTR_TYPE,
-+};
-+
-+
-+#define IS_CHAR_UNSIGNED (((char) -1) > 0)
-+
-+#define POINTER_BITS 2
-+#define POINTER_MAX ((1 << POINTER_BITS) - 1)
-+
-+#define ALIGNOF(S) ((int) ((char*) &S.v - (char*) &S - 1))
-+
-+
-+/* Note: if adding a new member that is associated with a struct/union
-+ * definition then it needs to be copied over in ctype.c:set_defined for when
-+ * we create types based off of the declaration alone.
-+ *
-+ * Since this is used as a header for every ctype and cdata, and we create a
-+ * ton of them on the stack, we try and minimise its size.
-+ */
-+struct cp_ctype {
-+ size_t base_size; /* size of the base type in bytes */
-+ int ffi_cs_id; /* index for csymbol from ktap vm */
-+ union {
-+ /* valid if is_bitfield */
-+ struct {
-+ /* size of bitfield in bits */
-+ unsigned bit_size : 7;
-+ /* offset within the current byte between 0-63 */
-+ unsigned bit_offset : 6;
-+ };
-+ /* Valid if is_array */
-+ size_t array_size;
-+ /* Valid for is_variable_struct or is_variable_array. If
-+ * variable_size_known (only used for is_variable_struct)
-+ * then this is the total increment otherwise this is the
-+ * per element increment.
-+ */
-+ size_t variable_increment;
-+ };
-+ size_t offset;
-+ /* as (align bytes - 1) eg 7 gives 8 byte alignment */
-+ unsigned align_mask : 4;
-+ /* number of dereferences to get to the base type
-+ * including +1 for arrays */
-+ unsigned pointers : POINTER_BITS;
-+ /* const pointer mask, LSB is current pointer, +1 for the whether
-+ * the base type is const */
-+ unsigned const_mask : POINTER_MAX + 1;
-+ unsigned type : 5; /* value given by type enum above */
-+ unsigned is_reference : 1;
-+ unsigned is_array : 1;
-+ unsigned is_defined : 1;
-+ unsigned is_null : 1;
-+ unsigned has_member_name : 1;
-+ unsigned calling_convention : 2;
-+ unsigned has_var_arg : 1;
-+ /* set for variable array types where we don't know
-+ * the variable size yet */
-+ unsigned is_variable_array : 1;
-+ unsigned is_variable_struct : 1;
-+ /* used for variable structs after we know the variable size */
-+ unsigned variable_size_known : 1;
-+ unsigned is_bitfield : 1;
-+ unsigned has_bitfield : 1;
-+ unsigned is_jitted : 1;
-+ unsigned is_packed : 1;
-+ unsigned is_unsigned : 1;
-+};
-+
-+#define ALIGNED_DEFAULT (__alignof__(void* __attribute__((aligned))) - 1)
-+
-+csymbol *cp_id_to_csym(int id);
-+#define ct_ffi_cs(ct) (cp_id_to_csym((ct)->ffi_cs_id))
-+
-+size_t ctype_size(const struct cp_ctype* ct);
-+int cp_ctype_init();
-+int cp_ctype_free();
-+struct cp_ctype *ctype_lookup_type(char *name);
-+void cp_ctype_dump_stack();
-+void cp_error(const char *err_msg_fmt, ...);
-+struct cp_ctype *cp_ctype_reg_type(char *name, struct cp_ctype *ct);
-+
-+void cp_push_ctype_with_name(struct cp_ctype *ct, const char *name, int nlen);
-+void cp_push_ctype(struct cp_ctype *ct);
-+void cp_set_defined(struct cp_ctype *ct);
-+
-+int cp_symbol_build_func(struct cp_ctype *type,
-+ const char *fname, int fn_size);
-+int cp_symbol_build_struct(const char *stname);
-+int cp_symbol_build_pointer(struct cp_ctype *ct);
-+
-+int ffi_cdef(const char *s);
-+void ffi_cparser_init(void);
-+void ffi_cparser_free(void);
-+
-+
-+static inline csymbol *cp_csymf_ret(csymbol_func *csf)
-+{
-+ return cp_id_to_csym(csf->ret_id);
-+}
-+
-+static inline csymbol *cp_csymf_arg(csymbol_func *csf, int idx)
-+{
-+ return cp_id_to_csym(csf->arg_ids[idx]);
-+}
-+
-+
-+#else
-+static void __maybe_unused ffi_cparser_init(void)
-+{
-+ return;
-+}
-+static void __maybe_unused ffi_cparser_free(void)
-+{
-+ return;
-+}
-+#endif /* CONFIG_KTAP_FFI */
-+
-+
-+#endif /* __KTAP_CPARSER_H__ */
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/dump.c
-@@ -0,0 +1,251 @@
-+/*
-+ * dump.c - save precompiled ktap chunks
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_opcodes.h"
-+#include "ktapc.h"
-+#include "../runtime/kp_obj.h"
-+#include "cparser.h"
-+
-+
-+typedef struct {
-+ ktap_writer writer;
-+ void *data;
-+ int strip;
-+ int status;
-+} DumpState;
-+
-+#define DumpMem(b, n, size, D) DumpBlock(b, (n)*(size), D)
-+#define DumpVar(x, D) DumpMem(&x, 1, sizeof(x), D)
-+
-+static void DumpBlock(const void *b, size_t size, DumpState *D)
-+{
-+ if (D->status == 0)
-+ D->status = ((D->writer))(b, size, D->data);
-+}
-+
-+static void DumpChar(int y, DumpState *D)
-+{
-+ char x = (char)y;
-+ DumpVar(x, D);
-+}
-+
-+static void DumpInt(int x, DumpState *D)
-+{
-+ DumpVar(x, D);
-+}
-+
-+static void DumpNumber(ktap_number x, DumpState *D)
-+{
-+ DumpVar(x,D);
-+}
-+
-+static void DumpVector(const void *b, int n, size_t size, DumpState *D)
-+{
-+ DumpInt(n, D);
-+ DumpMem(b, n, size, D);
-+}
-+
-+static void DumpString(const ktap_string *s, DumpState *D)
-+{
-+ if (s == NULL) {
-+ int size = 0;
-+ DumpVar(size, D);
-+ } else {
-+ int size = s->tsv.len + 1; /* include trailing '\0' */
-+ DumpVar(size, D);
-+ DumpBlock(getstr(s), size * sizeof(char), D);
-+ }
-+}
-+
-+#define DumpCode(f, D) DumpVector(f->code, f->sizecode, sizeof(ktap_instruction), D)
-+
-+static void DumpFunction(const ktap_proto *f, DumpState *D);
-+
-+static void DumpConstants(const ktap_proto *f, DumpState *D)
-+{
-+ int i, n = f->sizek;
-+
-+ DumpInt(n, D);
-+ for (i = 0; i < n; i++) {
-+ const ktap_value* o=&f->k[i];
-+ DumpChar(ttypenv(o), D);
-+ switch (ttypenv(o)) {
-+ case KTAP_TNIL:
-+ break;
-+ case KTAP_TBOOLEAN:
-+ DumpChar(bvalue(o), D);
-+ break;
-+ case KTAP_TNUMBER:
-+ DumpNumber(nvalue(o), D);
-+ break;
-+ case KTAP_TSTRING:
-+ DumpString(rawtsvalue(o), D);
-+ break;
-+ default:
-+ printf("ktap: DumpConstants with unknown vaule type %d\n", ttypenv(o));
-+ ktap_assert(0);
-+ }
-+ }
-+ n = f->sizep;
-+ DumpInt(n, D);
-+ for (i = 0; i < n; i++)
-+ DumpFunction(f->p[i], D);
-+}
-+
-+static void DumpUpvalues(const ktap_proto *f, DumpState *D)
-+{
-+ int i, n = f->sizeupvalues;
-+
-+ DumpInt(n, D);
-+ for (i = 0; i < n; i++) {
-+ DumpChar(f->upvalues[i].instack, D);
-+ DumpChar(f->upvalues[i].idx, D);
-+ }
-+}
-+
-+static void DumpDebug(const ktap_proto *f, DumpState *D)
-+{
-+ int i,n;
-+
-+ DumpString((D->strip) ? NULL : f->source, D);
-+ n= (D->strip) ? 0 : f->sizelineinfo;
-+ DumpVector(f->lineinfo, n, sizeof(int), D);
-+ n = (D->strip) ? 0 : f->sizelocvars;
-+ DumpInt(n, D);
-+
-+ for (i = 0; i < n; i++) {
-+ DumpString(f->locvars[i].varname, D);
-+ DumpInt(f->locvars[i].startpc, D);
-+ DumpInt(f->locvars[i].endpc, D);
-+ }
-+ n = (D->strip) ? 0 : f->sizeupvalues;
-+ DumpInt(n, D);
-+ for (i = 0; i < n; i++)
-+ DumpString(f->upvalues[i].name, D);
-+}
-+
-+static void DumpFunction(const ktap_proto *f, DumpState *D)
-+{
-+ DumpInt(f->linedefined, D);
-+ DumpInt(f->lastlinedefined, D);
-+ DumpChar(f->numparams, D);
-+ DumpChar(f->is_vararg, D);
-+ DumpChar(f->maxstacksize, D);
-+ DumpCode(f, D);
-+ DumpConstants(f, D);
-+ DumpUpvalues(f, D);
-+ DumpDebug(f, D);
-+}
-+
-+static void DumpHeader(DumpState *D)
-+{
-+ u8 h[KTAPC_HEADERSIZE];
-+
-+ kp_header(h);
-+ DumpBlock(h, KTAPC_HEADERSIZE, D);
-+}
-+
-+#ifdef CONFIG_KTAP_FFI
-+static void DumpCSymbolFunc(csymbol *cs, DumpState *D)
-+{
-+ csymbol_func *csf = csym_func(cs);
-+
-+ DumpBlock(cs, sizeof(csymbol), D);
-+ /* dump csymbol index for argument types */
-+ DumpBlock(csf->arg_ids, csf->arg_nr*sizeof(int), D);
-+}
-+
-+static void DumpCSymbolStruct(csymbol *cs, DumpState *D)
-+{
-+ csymbol_struct *csst = csym_struct(cs);
-+
-+ DumpBlock(cs, sizeof(csymbol), D);
-+ /* dump csymbol index for argument types */
-+ DumpBlock(csst->members, csst->memb_nr*sizeof(struct_member), D);
-+}
-+
-+static void DumpCSymbols(DumpState *D)
-+{
-+ int i, cs_nr;
-+ cp_csymbol_state *cs_state;
-+ csymbol *cs, *cs_arr;
-+
-+ cs_state = ctype_get_csym_state();
-+ cs_arr = cs_state->cs_arr;
-+ cs_nr = cs_state->cs_nr;
-+
-+ if (!cs_arr || cs_nr == 0) {
-+ DumpInt(0, D);
-+ return;
-+ }
-+
-+ /* dump number of csymbols */
-+ DumpInt(cs_nr, D);
-+ /* dump size of csymbol, for safty check in vm */
-+ DumpInt(sizeof(csymbol), D);
-+ for (i = 0; i < cs_nr; i++) {
-+ cs = &cs_arr[i];
-+ switch (cs->type) {
-+ case FFI_FUNC:
-+ DumpCSymbolFunc(cs, D);
-+ break;
-+ case FFI_STRUCT:
-+ DumpCSymbolStruct(cs, D);
-+ break;
-+ default:
-+ DumpBlock(cs, sizeof(csymbol), D);
-+ break;
-+ }
-+ }
-+}
-+#else
-+static void DumpCSymbols(DumpState *D)
-+{
-+ /* always dump zero when FFI is disabled */
-+ DumpInt(0, D);
-+}
-+#endif /* CONFIG_KTAP_FFI */
-+
-+/*
-+ * dump ktap function as precompiled chunk
-+ */
-+int ktapc_dump(const ktap_proto *f, ktap_writer w, void *data, int strip)
-+{
-+ DumpState D;
-+
-+ D.writer = w;
-+ D.data = data;
-+ D.strip = strip;
-+ D.status = 0;
-+ DumpHeader(&D);
-+ DumpCSymbols(&D);
-+ DumpFunction(f, &D);
-+ return D.status;
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/eventdef.c
-@@ -0,0 +1,857 @@
-+/*
-+ * eventdef.c - ktap eventdef parser
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include <unistd.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <dirent.h>
-+#include <fcntl.h>
-+
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_opcodes.h"
-+#include "ktapc.h"
-+#include "symbol.h"
-+
-+#define TRACING_EVENTS_DIR "/sys/kernel/debug/tracing/events"
-+
-+static u8 *idmap;
-+static int idmap_size = 1024; /* set init size */
-+static int id_nr = 0;
-+
-+static int idmap_init(void)
-+{
-+ idmap = malloc(idmap_size);
-+ if (!idmap)
-+ return -1;
-+
-+ memset(idmap, 0, idmap_size);
-+ return 0;
-+}
-+
-+static void idmap_free(void)
-+{
-+ free(idmap);
-+}
-+
-+static inline int idmap_is_set(int id)
-+{
-+ return idmap[id / 8] & (1 << (id % 8));
-+}
-+
-+static void idmap_set(int id)
-+{
-+ if (id >= idmap_size * 8) {
-+ int newsize = id + 100; /* allocate extra 800 id */
-+ idmap = realloc(idmap, newsize);
-+ memset(idmap + idmap_size, 0, newsize - idmap_size);
-+ idmap_size = newsize;
-+ }
-+
-+ if (!idmap_is_set(id))
-+ id_nr++;
-+
-+ idmap[id / 8] = idmap[id / 8] | (1 << (id % 8));
-+}
-+
-+static void idmap_clear(int id)
-+{
-+ id_nr--;
-+ idmap[id / 8] = idmap[id / 8] & ~ (1 << (id % 8));
-+}
-+
-+static int idmap_get_max_id(void)
-+{
-+ return idmap_size * 8;
-+}
-+
-+static int *get_id_array()
-+{
-+ int *id_array;
-+ int i, j = 0;
-+
-+ id_array = malloc(sizeof(int) * id_nr);
-+ if (!id_array)
-+ return NULL;
-+
-+ for (i = 0; i < idmap_get_max_id(); i++) {
-+ if (idmap_is_set(i))
-+ id_array[j++] = i;
-+ }
-+
-+ return id_array;
-+}
-+
-+static int add_event(char *evtid_path)
-+{
-+ char id_buf[24];
-+ int id, fd;
-+
-+ fd = open(evtid_path, O_RDONLY);
-+ if (fd < 0) {
-+ /*
-+ * some tracepoint doesn't have id file, like ftrace,
-+ * return success in here, and don't print error.
-+ */
-+ verbose_printf("warning: cannot open file %s\n", evtid_path);
-+ return 0;
-+ }
-+
-+ if (read(fd, id_buf, sizeof(id_buf)) < 0) {
-+ fprintf(stderr, "read file error %s\n", evtid_path);
-+ close(fd);
-+ return -1;
-+ }
-+
-+ id = atoll(id_buf);
-+
-+ idmap_set(id);
-+
-+ close(fd);
-+ return 0;
-+}
-+
-+static int add_tracepoint(char *sys_name, char *evt_name)
-+{
-+ char evtid_path[PATH_MAX] = {0};
-+
-+
-+ snprintf(evtid_path, PATH_MAX, "%s/%s/%s/id", TRACING_EVENTS_DIR,
-+ sys_name, evt_name);
-+ return add_event(evtid_path);
-+}
-+
-+static int add_tracepoint_multi_event(char *sys_name, char *evt_name)
-+{
-+ char evt_path[PATH_MAX];
-+ struct dirent *evt_ent;
-+ DIR *evt_dir;
-+ int ret = 0;
-+
-+ snprintf(evt_path, PATH_MAX, "%s/%s", TRACING_EVENTS_DIR, sys_name);
-+ evt_dir = opendir(evt_path);
-+ if (!evt_dir) {
-+ perror("Can't open event dir");
-+ return -1;
-+ }
-+
-+ while (!ret && (evt_ent = readdir(evt_dir))) {
-+ if (!strcmp(evt_ent->d_name, ".")
-+ || !strcmp(evt_ent->d_name, "..")
-+ || !strcmp(evt_ent->d_name, "enable")
-+ || !strcmp(evt_ent->d_name, "filter"))
-+ continue;
-+
-+ if (!strglobmatch(evt_ent->d_name, evt_name))
-+ continue;
-+
-+ ret = add_tracepoint(sys_name, evt_ent->d_name);
-+ }
-+
-+ closedir(evt_dir);
-+ return ret;
-+}
-+
-+static int add_tracepoint_event(char *sys_name, char *evt_name)
-+{
-+ return strpbrk(evt_name, "*?") ?
-+ add_tracepoint_multi_event(sys_name, evt_name) :
-+ add_tracepoint(sys_name, evt_name);
-+}
-+
-+static int add_tracepoint_multi_sys(char *sys_name, char *evt_name)
-+{
-+ struct dirent *events_ent;
-+ DIR *events_dir;
-+ int ret = 0;
-+
-+ events_dir = opendir(TRACING_EVENTS_DIR);
-+ if (!events_dir) {
-+ perror("Can't open event dir");
-+ return -1;
-+ }
-+
-+ while (!ret && (events_ent = readdir(events_dir))) {
-+ if (!strcmp(events_ent->d_name, ".")
-+ || !strcmp(events_ent->d_name, "..")
-+ || !strcmp(events_ent->d_name, "enable")
-+ || !strcmp(events_ent->d_name, "header_event")
-+ || !strcmp(events_ent->d_name, "header_page"))
-+ continue;
-+
-+ if (!strglobmatch(events_ent->d_name, sys_name))
-+ continue;
-+
-+ ret = add_tracepoint_event(events_ent->d_name,
-+ evt_name);
-+ }
-+
-+ closedir(events_dir);
-+ return ret;
-+}
-+
-+static int parse_events_add_tracepoint(char *sys, char *event)
-+{
-+ if (strpbrk(sys, "*?"))
-+ return add_tracepoint_multi_sys(sys, event);
-+ else
-+ return add_tracepoint_event(sys, event);
-+}
-+
-+enum {
-+ KPROBE_EVENT,
-+ UPROBE_EVENT,
-+};
-+
-+struct probe_list {
-+ struct probe_list *next;
-+ int type;
-+ char event[64];
-+};
-+
-+static struct probe_list *probe_list_head; /* for cleanup resources */
-+
-+/*
-+ * Some symbol format cannot write to uprobe_events in debugfs, like:
-+ * symbol "check_one_fd.part.0" in glibc.
-+ * For those symbols, we change the format, get rid of invalid chars,
-+ * "check_one_fd.part.0" -> "check_one_fd"
-+ *
-+ * This function copy is_good_name function in linux/kernel/trace/trace_probe.h
-+ */
-+static char *format_symbol_name(const char *old_symbol)
-+{
-+ char *new_name = strdup(old_symbol);
-+ char *name = new_name;
-+
-+ if (!isalpha(*name) && *name != '_')
-+ *name = '\0';
-+
-+ while (*++name != '\0') {
-+ if (!isalpha(*name) && !isdigit(*name) && *name != '_') {
-+ *name = '\0';
-+ break;
-+ }
-+ }
-+
-+ /* this is a good name */
-+ return new_name;
-+}
-+
-+
-+#define KPROBE_EVENTS_PATH "/sys/kernel/debug/tracing/kprobe_events"
-+
-+/**
-+ * @return 0 on success, otherwise -1
-+ */
-+static int
-+write_kprobe_event(int fd, int ret_probe, const char *symbol, char *fetch_args)
-+{
-+ char probe_event[128] = {0};
-+ char event[64] = {0};
-+ struct probe_list *pl;
-+ char event_id_path[128] = {0};
-+ char *symbol_name;
-+ int id_fd, ret;
-+
-+ /* In case some symbols cannot write to uprobe_events debugfs file */
-+ symbol_name = format_symbol_name(symbol);
-+
-+ if (!fetch_args)
-+ fetch_args = " ";
-+
-+ if (ret_probe) {
-+ snprintf(event, 64, "ktap_kprobes_%d/ret_%s",
-+ getpid(), symbol_name);
-+ snprintf(probe_event, 128, "r:%s %s %s",
-+ event, symbol, fetch_args);
-+ } else {
-+ snprintf(event, 64, "ktap_kprobes_%d/%s",
-+ getpid(), symbol_name);
-+ snprintf(probe_event, 128, "p:%s %s %s",
-+ event, symbol, fetch_args);
-+ }
-+
-+ sprintf(event_id_path, "/sys/kernel/debug/tracing/events/%s/id", event);
-+ /* if event id already exist, then don't write to kprobes_event again */
-+ id_fd = open(event_id_path, O_RDONLY);
-+ if (id_fd > 0) {
-+ close(id_fd);
-+
-+ /* remember add event id to ids_array */
-+ ret = add_event(event_id_path);
-+ if (ret)
-+ goto error;
-+
-+ goto out;
-+ }
-+
-+ verbose_printf("write kprobe event %s\n", probe_event);
-+
-+ if (write(fd, probe_event, strlen(probe_event)) <= 0) {
-+ fprintf(stderr, "Cannot write %s to %s\n", probe_event,
-+ KPROBE_EVENTS_PATH);
-+ goto error;
-+ }
-+
-+ /* add to cleanup list */
-+ pl = malloc(sizeof(struct probe_list));
-+ if (!pl)
-+ goto error;
-+
-+ pl->type = KPROBE_EVENT;
-+ pl->next = probe_list_head;
-+ memcpy(pl->event, event, 64);
-+ probe_list_head = pl;
-+
-+ ret = add_event(event_id_path);
-+ if (ret < 0)
-+ goto error;
-+
-+ out:
-+ free(symbol_name);
-+ return 0;
-+
-+ error:
-+ free(symbol_name);
-+ return -1;
-+}
-+
-+static unsigned long core_kernel_text_start;
-+static unsigned long core_kernel_text_end;
-+static unsigned long kprobes_text_start;
-+static unsigned long kprobes_text_end;
-+
-+static void init_kprobe_prohibited_area(void)
-+{
-+ static int once = 0;
-+
-+ if (once > 0)
-+ return;
-+
-+ once = 1;
-+
-+ core_kernel_text_start = find_kernel_symbol("_stext");
-+ core_kernel_text_end = find_kernel_symbol("_etext");
-+ kprobes_text_start = find_kernel_symbol("__kprobes_text_start");
-+ kprobes_text_end = find_kernel_symbol("__kprobes_text_end");
-+}
-+
-+static int check_kprobe_addr_prohibited(unsigned long addr)
-+{
-+ if (addr <= core_kernel_text_start || addr >= core_kernel_text_end)
-+ return -1;
-+
-+ if (addr >= kprobes_text_start && addr <= kprobes_text_end)
-+ return -1;
-+
-+ return 0;
-+}
-+
-+struct probe_cb_base {
-+ int fd;
-+ int ret_probe;
-+ const char *event;
-+ char *binary;
-+ char *symbol;
-+ char *fetch_args;
-+};
-+
-+static int kprobe_symbol_actor(void *arg, const char *name, char type,
-+ unsigned long start)
-+{
-+ struct probe_cb_base *base = (struct probe_cb_base *)arg;
-+
-+ /* only can probe text function */
-+ if (type != 't' && type != 'T')
-+ return 0;
-+
-+ if (!strglobmatch(name, base->symbol))
-+ return 0;
-+
-+ if (check_kprobe_addr_prohibited(start))
-+ return 0;
-+
-+ return write_kprobe_event(base->fd, base->ret_probe, name,
-+ base->fetch_args);
-+}
-+
-+static int parse_events_add_kprobe(char *event)
-+{
-+ char *symbol, *end;
-+ struct probe_cb_base base;
-+ int fd, ret;
-+
-+ fd = open(KPROBE_EVENTS_PATH, O_WRONLY);
-+ if (fd < 0) {
-+ fprintf(stderr, "Cannot open %s\n", KPROBE_EVENTS_PATH);
-+ return -1;
-+ }
-+
-+ end = strpbrk(event, "% ");
-+ if (end)
-+ symbol = strndup(event, end - event);
-+ else
-+ symbol = strdup(event);
-+
-+ base.fd = fd;
-+ base.ret_probe = !!strstr(event, "%return");
-+ base.symbol = symbol;
-+ base.fetch_args = strchr(event, ' ');
-+
-+ init_kprobe_prohibited_area();
-+
-+ ret = kallsyms_parse(&base, kprobe_symbol_actor);
-+ if (ret < 0)
-+ fprintf(stderr, "cannot parse symbol \"%s\"\n", symbol);
-+
-+ free(symbol);
-+ close(fd);
-+
-+ return ret;
-+}
-+
-+#define UPROBE_EVENTS_PATH "/sys/kernel/debug/tracing/uprobe_events"
-+
-+/**
-+ * @return 0 on success, otherwise -1
-+ */
-+static int
-+write_uprobe_event(int fd, int ret_probe, const char *binary,
-+ const char *symbol, unsigned long addr,
-+ char *fetch_args)
-+{
-+ char probe_event[128] = {0};
-+ char event[64] = {0};
-+ struct probe_list *pl;
-+ char event_id_path[128] = {0};
-+ char *symbol_name;
-+ int id_fd, ret;
-+
-+ /* In case some symbols cannot write to uprobe_events debugfs file */
-+ symbol_name = format_symbol_name(symbol);
-+
-+ if (!fetch_args)
-+ fetch_args = " ";
-+
-+ if (ret_probe) {
-+ snprintf(event, 64, "ktap_uprobes_%d/ret_%s",
-+ getpid(), symbol_name);
-+ snprintf(probe_event, 128, "r:%s %s:0x%lx %s",
-+ event, binary, addr, fetch_args);
-+ } else {
-+ snprintf(event, 64, "ktap_uprobes_%d/%s",
-+ getpid(), symbol_name);
-+ snprintf(probe_event, 128, "p:%s %s:0x%lx %s",
-+ event, binary, addr, fetch_args);
-+ }
-+
-+ sprintf(event_id_path, "/sys/kernel/debug/tracing/events/%s/id", event);
-+ /* if event id already exist, then don't write to uprobes_event again */
-+ id_fd = open(event_id_path, O_RDONLY);
-+ if (id_fd > 0) {
-+ close(id_fd);
-+
-+ /* remember add event id to ids_array */
-+ ret = add_event(event_id_path);
-+ if (ret)
-+ goto error;
-+
-+ goto out;
-+ }
-+
-+ verbose_printf("write uprobe event %s\n", probe_event);
-+
-+ if (write(fd, probe_event, strlen(probe_event)) <= 0) {
-+ fprintf(stderr, "Cannot write %s to %s\n", probe_event,
-+ UPROBE_EVENTS_PATH);
-+ goto error;
-+ }
-+
-+ /* add to cleanup list */
-+ pl = malloc(sizeof(struct probe_list));
-+ if (!pl)
-+ goto error;
-+
-+ pl->type = UPROBE_EVENT;
-+ pl->next = probe_list_head;
-+ memcpy(pl->event, event, 64);
-+ probe_list_head = pl;
-+
-+ ret = add_event(event_id_path);
-+ if (ret < 0)
-+ goto error;
-+
-+ out:
-+ free(symbol_name);
-+ return 0;
-+
-+ error:
-+ free(symbol_name);
-+ return -1;
-+}
-+
-+/**
-+ * TODO: avoid copy-paste stuff
-+ *
-+ * @return 1 on success, otherwise 0
-+ */
-+#ifdef NO_LIBELF
-+static int parse_events_resolve_symbol(int fd, char *event, int type)
-+{
-+ char *colon, *binary, *fetch_args;
-+ unsigned long symbol_address;
-+
-+ colon = strchr(event, ':');
-+ if (!colon)
-+ return -1;
-+
-+ symbol_address = strtol(colon + 1 /* skip ":" */, NULL, 0);
-+
-+ fetch_args = strchr(event, ' ');
-+
-+ /**
-+ * We already have address, no need in resolving.
-+ */
-+ if (symbol_address) {
-+ int ret;
-+
-+ binary = strndup(event, colon - event);
-+ ret = write_uprobe_event(fd, !!strstr(event, "%return"), binary,
-+ "NULL", symbol_address, fetch_args);
-+ free(binary);
-+ return ret;
-+ }
-+
-+ fprintf(stderr, "error: cannot resolve event \"%s\" without libelf, "
-+ "please recompile ktap with NO_LIBELF disabled\n",
-+ event);
-+ exit(EXIT_FAILURE);
-+ return -1;
-+}
-+
-+#else
-+static int uprobe_symbol_actor(const char *name, vaddr_t addr, void *arg)
-+{
-+ struct probe_cb_base *base = (struct probe_cb_base *)arg;
-+ int ret;
-+
-+ if (!strglobmatch(name, base->symbol))
-+ return 0;
-+
-+ verbose_printf("uprobe: binary: \"%s\" symbol \"%s\" "
-+ "resolved to 0x%lx\n",
-+ base->binary, base->symbol, addr);
-+
-+ ret = write_uprobe_event(base->fd, base->ret_probe, base->binary,
-+ name, addr, base->fetch_args);
-+ if (ret)
-+ return ret;
-+
-+ return 0;
-+}
-+
-+static int parse_events_resolve_symbol(int fd, char *event, int type)
-+{
-+ char *colon, *end;
-+ vaddr_t symbol_address;
-+ int ret;
-+ struct probe_cb_base base = {
-+ .fd = fd,
-+ .event = event
-+ };
-+
-+ colon = strchr(event, ':');
-+ if (!colon)
-+ return 0;
-+
-+ base.ret_probe = !!strstr(event, "%return");
-+ symbol_address = strtol(colon + 1 /* skip ":" */, NULL, 0);
-+ base.binary = strndup(event, colon - event);
-+
-+ base.fetch_args = strchr(event, ' ');
-+
-+ /*
-+ * We already have address, no need in resolving.
-+ */
-+ if (symbol_address) {
-+ int ret;
-+ ret = write_uprobe_event(fd, base.ret_probe, base.binary,
-+ "NULL", symbol_address,
-+ base.fetch_args);
-+ free(base.binary);
-+ return ret;
-+ }
-+
-+ end = strpbrk(event, "% ");
-+ if (end)
-+ base.symbol = strndup(colon + 1, end - 1 - colon);
-+ else
-+ base.symbol = strdup(colon + 1);
-+
-+ ret = parse_dso_symbols(base.binary, type, uprobe_symbol_actor,
-+ (void *)&base);
-+ if (!ret) {
-+ fprintf(stderr, "error: cannot find symbol %s in binary %s\n",
-+ base.symbol, base.binary);
-+ ret = -1;
-+ } else if(ret > 0) {
-+ /* no error found when parse symbols */
-+ ret = 0;
-+ }
-+
-+ free(base.binary);
-+ free(base.symbol);
-+
-+ return ret;
-+}
-+#endif
-+
-+static int parse_events_add_uprobe(char *old_event, int type)
-+{
-+ int ret;
-+ int fd;
-+
-+ fd = open(UPROBE_EVENTS_PATH, O_WRONLY);
-+ if (fd < 0) {
-+ fprintf(stderr, "Cannot open %s\n", UPROBE_EVENTS_PATH);
-+ return -1;
-+ }
-+
-+ ret = parse_events_resolve_symbol(fd, old_event, type);
-+
-+ close(fd);
-+ return ret;
-+}
-+
-+static int parse_events_add_probe(char *old_event)
-+{
-+ char *separator;
-+
-+ separator = strchr(old_event, ':');
-+ if (!separator || (separator == old_event))
-+ return parse_events_add_kprobe(old_event);
-+ else
-+ return parse_events_add_uprobe(old_event, FIND_SYMBOL);
-+}
-+
-+static int parse_events_add_sdt(char *old_event)
-+{
-+ return parse_events_add_uprobe(old_event, FIND_STAPSDT_NOTE);
-+}
-+
-+static void strim(char *s)
-+{
-+ size_t size;
-+ char *end;
-+
-+ size = strlen(s);
-+ if (!size)
-+ return;
-+
-+ end = s + size -1;
-+ while (end >= s && isspace(*end))
-+ end--;
-+
-+ *(end + 1) = '\0';
-+}
-+
-+static int get_sys_event_filter_str(char *start,
-+ char **sys, char **event, char **filter)
-+{
-+ char *separator, *separator2, *ptr, *end;
-+
-+ while (*start == ' ')
-+ start++;
-+
-+ /* find sys */
-+ separator = strchr(start, ':');
-+ if (!separator || (separator == start)) {
-+ return -1;
-+ }
-+
-+ ptr = malloc(separator - start + 1);
-+ if (!ptr)
-+ return -1;
-+
-+ strncpy(ptr, start, separator - start);
-+ ptr[separator - start] = '\0';
-+
-+ strim(ptr);
-+ *sys = ptr;
-+
-+ if (!strcmp(*sys, "probe") && (*(separator + 1) == '/')) {
-+ /* it's uprobe event */
-+ separator2 = strchr(separator + 1, ':');
-+ if (!separator2)
-+ return -1;
-+ } else
-+ separator2 = separator;
-+
-+ /* find filter */
-+ end = start + strlen(start);
-+ while (*--end == ' ') {
-+ }
-+
-+ if (*end == '/') {
-+ char *filter_start;
-+
-+ filter_start = strchr(separator2, '/');
-+ if (filter_start == end)
-+ return -1;
-+
-+ ptr = malloc(end - filter_start + 2);
-+ if (!ptr)
-+ return -1;
-+
-+ memcpy(ptr, filter_start, end - filter_start + 1);
-+ ptr[end - filter_start + 1] = '\0';
-+
-+ *filter = ptr;
-+
-+ end = filter_start;
-+ } else {
-+ *filter = NULL;
-+ end++;
-+ }
-+
-+ /* find event */
-+ ptr = malloc(end - separator);
-+ if (!ptr)
-+ return -1;
-+
-+ memcpy(ptr, separator + 1, end - separator - 1);
-+ ptr[end - separator - 1] = '\0';
-+
-+ strim(ptr);
-+ *event = ptr;
-+
-+ return 0;
-+}
-+
-+static char *get_next_eventdef(char *str)
-+{
-+ char *separator;
-+
-+ separator = strchr(str, ',');
-+ if (!separator)
-+ return str + strlen(str);
-+
-+ *separator = '\0';
-+ return separator + 1;
-+}
-+
-+ktap_eventdef_info *ktapc_parse_eventdef(const char *eventdef)
-+{
-+ char *str = strdup(eventdef);
-+ char *sys, *event, *filter, *next;
-+ ktap_eventdef_info *evdef_info;
-+ int ret;
-+
-+ idmap_init();
-+
-+ parse_next_eventdef:
-+ next = get_next_eventdef(str);
-+
-+ if (get_sys_event_filter_str(str, &sys, &event, &filter))
-+ goto error;
-+
-+ verbose_printf("parse_eventdef: sys[%s], event[%s], filter[%s]\n",
-+ sys, event, filter);
-+
-+ if (!strcmp(sys, "probe"))
-+ ret = parse_events_add_probe(event);
-+ else if (!strcmp(sys, "sdt"))
-+ ret = parse_events_add_sdt(event);
-+ else
-+ ret = parse_events_add_tracepoint(sys, event);
-+
-+ if (ret)
-+ goto error;
-+
-+ /* don't trace ftrace:function when all tracepoints enabled */
-+ if (!strcmp(sys, "*"))
-+ idmap_clear(1);
-+
-+
-+ if (filter && *next != '\0') {
-+ fprintf(stderr, "Error: eventdef only can append one filter\n");
-+ goto error;
-+ }
-+
-+ str = next;
-+ if (*next != '\0')
-+ goto parse_next_eventdef;
-+
-+ evdef_info = malloc(sizeof(*evdef_info));
-+ if (!evdef_info)
-+ goto error;
-+
-+ evdef_info->nr = id_nr;
-+ evdef_info->id_arr = get_id_array();
-+ evdef_info->filter = filter;
-+
-+ idmap_free();
-+ return evdef_info;
-+ error:
-+ idmap_free();
-+ cleanup_event_resources();
-+ return NULL;
-+}
-+
-+void cleanup_event_resources(void)
-+{
-+ struct probe_list *pl;
-+ const char *path;
-+ char probe_event[128] = {0};
-+ int fd, ret;
-+
-+ for (pl = probe_list_head; pl; pl = pl->next) {
-+ if (pl->type == KPROBE_EVENT)
-+ path = KPROBE_EVENTS_PATH;
-+ else if (pl->type == UPROBE_EVENT)
-+ path = UPROBE_EVENTS_PATH;
-+ else {
-+ fprintf(stderr, "Cannot cleanup event type %d\n",
-+ pl->type);
-+ continue;
-+ }
-+
-+ snprintf(probe_event, 128, "-:%s", pl->event);
-+
-+ fd = open(path, O_WRONLY);
-+ if (fd < 0) {
-+ fprintf(stderr, "Cannot open %s\n", UPROBE_EVENTS_PATH);
-+ continue;
-+ }
-+
-+ ret = write(fd, probe_event, strlen(probe_event));
-+ if (ret <= 0) {
-+ fprintf(stderr, "Cannot write %s to %s\n", probe_event,
-+ path);
-+ close(fd);
-+ continue;
-+ }
-+
-+ close(fd);
-+ }
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/ffi/cparser.c
-@@ -0,0 +1,1755 @@
-+#include <stdarg.h>
-+#include "../cparser.h"
-+
-+#define IS_CONST(tok) (IS_LITERAL(tok, "const") || IS_LITERAL(tok, "__const") \
-+ || IS_LITERAL(tok, "__const__"))
-+#define IS_VOLATILE(tok) (IS_LITERAL(tok, "volatile") || \
-+ IS_LITERAL(tok, "__volatile") || \
-+ IS_LITERAL(tok, "__volatile__"))
-+#define IS_RESTRICT(tok) (IS_LITERAL(tok, "restrict") || \
-+ IS_LITERAL(tok, "__restrict") || \
-+ IS_LITERAL(tok, "__restrict__"))
-+
-+#define max(a,b) ((a) < (b) ? (b) : (a))
-+#define min(a,b) ((a) < (b) ? (a) : (b))
-+
-+
-+enum etoken {
-+ /* 0 - 3 */
-+ TOK_NIL,
-+ TOK_NUMBER,
-+ TOK_STRING,
-+ TOK_TOKEN,
-+
-+ /* the order of these values must match the token strings in lex.c */
-+
-+ /* 4 - 5 */
-+ TOK_3_BEGIN,
-+ TOK_VA_ARG,
-+
-+ /* 6 - 14 */
-+ TOK_2_BEGIN,
-+ TOK_LEFT_SHIFT, TOK_RIGHT_SHIFT, TOK_LOGICAL_AND, TOK_LOGICAL_OR,
-+ TOK_LESS_EQUAL, TOK_GREATER_EQUAL, TOK_EQUAL, TOK_NOT_EQUAL,
-+
-+ /* 15 - 20 */
-+ TOK_1_BEGIN,
-+ TOK_OPEN_CURLY, TOK_CLOSE_CURLY, TOK_SEMICOLON, TOK_COMMA, TOK_COLON,
-+ /* 21 - 30 */
-+ TOK_ASSIGN, TOK_OPEN_PAREN, TOK_CLOSE_PAREN, TOK_OPEN_SQUARE, TOK_CLOSE_SQUARE,
-+ TOK_DOT, TOK_AMPERSAND, TOK_LOGICAL_NOT, TOK_BITWISE_NOT, TOK_MINUS,
-+ /* 31 - 40 */
-+ TOK_PLUS, TOK_STAR, TOK_DIVIDE, TOK_MODULUS, TOK_LESS,
-+ TOK_GREATER, TOK_BITWISE_XOR, TOK_BITWISE_OR, TOK_QUESTION, TOK_POUND,
-+
-+ /* 41 - 43 */
-+ TOK_REFERENCE = TOK_AMPERSAND,
-+ TOK_MULTIPLY = TOK_STAR,
-+ TOK_BITWISE_AND = TOK_AMPERSAND,
-+};
-+
-+struct token {
-+ enum etoken type;
-+ int64_t integer;
-+ const char *str;
-+ size_t size;
-+};
-+
-+#define IS_LITERAL(TOK, STR) \
-+ (((TOK).size == sizeof(STR) - 1) && \
-+ 0 == memcmp((TOK).str, STR, sizeof(STR) - 1))
-+
-+
-+static int parse_type_name(struct parser *P, char *type_name);
-+static void parse_argument(struct parser *P, struct cp_ctype *ct,
-+ struct token *pname, struct parser *asmname);
-+static int parse_attribute(struct parser *P, struct token *tok,
-+ struct cp_ctype *ct, struct parser *asmname);
-+static int parse_record(struct parser *P, struct cp_ctype *ct);
-+static void instantiate_typedef(struct parser *P, struct cp_ctype *tt,
-+ const struct cp_ctype *ft);
-+
-+
-+/* the order of tokens _must_ match the order of the enum etoken enum */
-+
-+static char tok3[][4] = {
-+ "...", /* unused ">>=", "<<=", */
-+};
-+
-+static char tok2[][3] = {
-+ "<<", ">>", "&&", "||", "<=",
-+ ">=", "==", "!=",
-+ /* unused "+=", "-=", "*=", "/=", "%=", "&=", "^=",
-+ * "|=", "++", "--", "->", "::", */
-+};
-+
-+static char tok1[] = {
-+ '{', '}', ';', ',', ':',
-+ '=', '(', ')', '[', ']',
-+ '.', '&', '!', '~', '-',
-+ '+', '*', '/', '%', '<',
-+ '>', '^', '|', '?', '#'
-+};
-+
-+
-+/* this function never returns, but it's an idiom to use it in C functions
-+ * as return cp_error */
-+void cp_error(const char *err_msg_fmt, ...)
-+{
-+ va_list ap;
-+
-+ fprintf(stderr, "cparser error:\n");
-+
-+ va_start(ap, err_msg_fmt);
-+ vfprintf(stderr, err_msg_fmt, ap);
-+ va_end(ap);
-+
-+ exit(EXIT_FAILURE);
-+}
-+
-+static int set_struct_type_name(char *dst, const char *src, int len)
-+{
-+ int prefix_len = sizeof("struct ");
-+
-+ if (len + prefix_len > MAX_TYPE_NAME_LEN)
-+ return -1;
-+
-+ memset(dst, 0, MAX_TYPE_NAME_LEN);
-+ strcpy(dst, "struct ");
-+ strncat(dst, src, len);
-+
-+ return 0;
-+}
-+
-+static void increase_ptr_deref_level(struct parser *P, struct cp_ctype *ct)
-+{
-+ if (ct->pointers == POINTER_MAX) {
-+ cp_error("maximum number of pointer derefs reached - use a "
-+ "struct to break up the pointers on line %d", P->line);
-+ } else {
-+ ct->pointers++;
-+ ct->const_mask <<= 1;
-+ }
-+}
-+
-+static int next_token(struct parser *P, struct token *tok)
-+{
-+ size_t i;
-+ const char *s = P->next;
-+
-+ /* UTF8 BOM */
-+ if (s[0] == '\xEF' && s[1] == '\xBB' && s[2] == '\xBF') {
-+ s += 3;
-+ }
-+
-+ /* consume whitespace and comments */
-+ for (;;) {
-+ /* consume whitespace */
-+ while (*s == '\t' || *s == '\n' || *s == ' '
-+ || *s == '\v' || *s == '\r') {
-+ if (*s == '\n') {
-+ P->line++;
-+ }
-+ s++;
-+ }
-+
-+ /* consume comments */
-+ if (*s == '/' && *(s+1) == '/') {
-+
-+ s = strchr(s, '\n');
-+ if (!s) {
-+ cp_error("non-terminated comment");
-+ }
-+
-+ } else if (*s == '/' && *(s+1) == '*') {
-+ s += 2;
-+
-+ for (;;) {
-+ if (s[0] == '\0') {
-+ cp_error("non-terminated comment");
-+ } else if (s[0] == '*' && s[1] == '/') {
-+ s += 2;
-+ break;
-+ } else if (s[0] == '\n') {
-+ P->line++;
-+ }
-+ s++;
-+ }
-+
-+ } else if (*s == '\0') {
-+ tok->type = TOK_NIL;
-+ return 0;
-+
-+ } else {
-+ break;
-+ }
-+ }
-+
-+ P->prev = s;
-+
-+ for (i = 0; i < sizeof(tok3) / sizeof(tok3[0]); i++) {
-+ if (s[0] == tok3[i][0] && s[1] == tok3[i][1] && s[2] == tok3[i][2]) {
-+ tok->type = (enum etoken) (TOK_3_BEGIN + 1 + i);
-+ P->next = s + 3;
-+ goto end;
-+ }
-+ }
-+
-+ for (i = 0; i < sizeof(tok2) / sizeof(tok2[0]); i++) {
-+ if (s[0] == tok2[i][0] && s[1] == tok2[i][1]) {
-+ tok->type = (enum etoken) (TOK_2_BEGIN + 1 + i);
-+ P->next = s + 2;
-+ goto end;
-+ }
-+ }
-+
-+ for (i = 0; i < sizeof(tok1) / sizeof(tok1[0]); i++) {
-+ if (s[0] == tok1[i]) {
-+ tok->type = (enum etoken) (TOK_1_BEGIN + 1 + i);
-+ P->next = s + 1;
-+ goto end;
-+ }
-+ }
-+
-+ if (*s == '.' || *s == '-' || ('0' <= *s && *s <= '9')) {
-+ /* number */
-+ tok->type = TOK_NUMBER;
-+
-+ /* split out the negative case so we get the full range of
-+ * bits for unsigned (eg to support 0xFFFFFFFF where
-+ * sizeof(long) == 4 */
-+ if (*s == '-') {
-+ tok->integer = strtol(s, (char**) &s, 0);
-+ } else {
-+ tok->integer = strtoul(s, (char**) &s, 0);
-+ }
-+
-+ while (*s == 'u' || *s == 'U' || *s == 'l' || *s == 'L') {
-+ s++;
-+ }
-+
-+ P->next = s;
-+ goto end;
-+
-+ } else if (*s == '\'' || *s == '\"') {
-+ /* "..." or '...' */
-+ char quote = *s;
-+ s++; /* jump over " */
-+
-+ tok->type = TOK_STRING;
-+ tok->str = s;
-+
-+ while (*s != quote) {
-+ if (*s == '\0' || (*s == '\\' && *(s+1) == '\0')) {
-+ cp_error("string not finished\n");
-+ }
-+ if (*s == '\\') {
-+ s++;
-+ }
-+ s++;
-+ }
-+
-+ tok->size = s - tok->str;
-+ s++; /* jump over " */
-+ P->next = s;
-+ goto end;
-+
-+ } else if (('a' <= *s && *s <= 'z') || ('A' <= *s && *s <= 'Z')
-+ || *s == '_') {
-+ /* tokens */
-+ tok->type = TOK_TOKEN;
-+ tok->str = s;
-+
-+ while (('a' <= *s && *s <= 'z') || ('A' <= *s && *s <= 'Z')
-+ || *s == '_' || ('0' <= *s && *s <= '9')) {
-+ s++;
-+ }
-+
-+ tok->size = s - tok->str;
-+ P->next = s;
-+ goto end;
-+ } else {
-+ cp_error("invalid character %d", P->line);
-+ }
-+
-+end:
-+ return 1;
-+}
-+
-+static void require_token(struct parser *P, struct token *tok)
-+{
-+ if (!next_token(P, tok)) {
-+ cp_error("unexpected end");
-+ }
-+}
-+
-+static void check_token(struct parser *P, int type, const char *str,
-+ const char *err, ...)
-+{
-+ va_list ap;
-+ struct token tok;
-+ if (!next_token(P, &tok) || tok.type != type
-+ || (tok.type == TOK_TOKEN && (tok.size != strlen(str)
-+ || memcmp(tok.str, str, tok.size) != 0))) {
-+
-+ va_start(ap, err);
-+ vfprintf(stderr, err, ap);
-+ va_end(ap);
-+
-+ exit(EXIT_FAILURE);
-+ }
-+}
-+
-+static void put_back(struct parser *P) {
-+ P->next = P->prev;
-+}
-+
-+int64_t calculate_constant(struct parser *P);
-+
-+/* parses out the base type of a type expression in a function declaration,
-+ * struct definition, typedef etc
-+ *
-+ * leaves the usr value of the type on the stack
-+ */
-+int parse_type(struct parser *P, struct cp_ctype *ct)
-+{
-+ struct token tok;
-+
-+ memset(ct, 0, sizeof(*ct));
-+
-+ require_token(P, &tok);
-+
-+ /* get function attributes before the return type */
-+ while (parse_attribute(P, &tok, ct, NULL)) {
-+ require_token(P, &tok);
-+ }
-+
-+ /* get const/volatile before the base type */
-+ for (;;) {
-+ if (tok.type != TOK_TOKEN) {
-+ cp_error("unexpected value before type name on line %d",
-+ P->line);
-+ return 0;
-+ } else if (IS_CONST(tok)) {
-+ ct->const_mask = 1;
-+ require_token(P, &tok);
-+ } else if (IS_VOLATILE(tok) || IS_RESTRICT(tok)) {
-+ /* ignored for now */
-+ require_token(P, &tok);
-+ } else {
-+ break;
-+ }
-+ }
-+
-+ /* get base type */
-+ if (tok.type != TOK_TOKEN) {
-+ cp_error("unexpected value before type name on line %d", P->line);
-+ return 0;
-+ } else if (IS_LITERAL(tok, "struct")) {
-+ ct->type = STRUCT_TYPE;
-+ parse_record(P, ct);
-+ } else if (IS_LITERAL(tok, "union")) {
-+ ct->type = UNION_TYPE;
-+ parse_record(P, ct);
-+ } else if (IS_LITERAL(tok, "enum")) {
-+ ct->type = ENUM_TYPE;
-+ parse_record(P, ct);
-+ } else {
-+ put_back(P);
-+
-+ /* lookup type */
-+ struct cp_ctype *lct;
-+ char cur_type_name[MAX_TYPE_NAME_LEN];
-+
-+ memset(cur_type_name, 0, MAX_TYPE_NAME_LEN);
-+ parse_type_name(P, cur_type_name);
-+ lct = ctype_lookup_type(cur_type_name);
-+ if (!lct)
-+ cp_error("unknow type: \"%s\"\n", cur_type_name);
-+
-+ instantiate_typedef(P, ct, lct);
-+ }
-+
-+ while (next_token(P, &tok)) {
-+ if (tok.type != TOK_TOKEN) {
-+ put_back(P);
-+ break;
-+ } else if (IS_CONST(tok) || IS_VOLATILE(tok)) {
-+ /* ignore for now */
-+ } else {
-+ put_back(P);
-+ break;
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+enum test {TEST};
-+
-+/* Parses an enum definition from after the open curly through to the close
-+ * curly. Expects the user table to be on the top of the stack
-+ */
-+static int parse_enum(struct parser *P, struct cp_ctype *type)
-+{
-+ struct token tok;
-+ int value = -1;
-+
-+ /*@TODO clean up this function when enum support is added*/
-+ cp_error("TODO: enum not supported!\n");
-+
-+ for (;;) {
-+ require_token(P, &tok);
-+
-+ if (tok.type == TOK_CLOSE_CURLY) {
-+ break;
-+ } else if (tok.type != TOK_TOKEN) {
-+ cp_error("unexpected token in enum at line %d", P->line);
-+ return 0;
-+ }
-+ require_token(P, &tok);
-+
-+ if (tok.type == TOK_COMMA || tok.type == TOK_CLOSE_CURLY) {
-+ /* we have an auto calculated enum value */
-+ value++;
-+ } else if (tok.type == TOK_ASSIGN) {
-+ /* we have an explicit enum value */
-+ value = (int) calculate_constant(P);
-+ require_token(P, &tok);
-+ } else {
-+ cp_error("unexpected token in enum at line %d", P->line);
-+ return 0;
-+ }
-+
-+ if (tok.type == TOK_CLOSE_CURLY) {
-+ break;
-+ } else if (tok.type != TOK_COMMA) {
-+ cp_error("unexpected token in enum at line %d", P->line);
-+ return 0;
-+ }
-+ }
-+
-+ type->base_size = sizeof(enum test);
-+ type->align_mask = sizeof(enum test) - 1;
-+
-+ return 0;
-+}
-+
-+/* Parses a struct from after the open curly through to the close curly. */
-+static int parse_struct(struct parser *P, const struct cp_ctype *ct)
-+{
-+ struct token tok;
-+
-+ /* parse members */
-+ for (;;) {
-+ struct cp_ctype mbase;
-+
-+ /* see if we're at the end of the struct */
-+ require_token(P, &tok);
-+ if (tok.type == TOK_CLOSE_CURLY) {
-+ break;
-+ } else if (ct->is_variable_struct) {
-+ cp_error("can't have members after a variable sized "
-+ "member on line %d", P->line);
-+ return -1;
-+ } else {
-+ put_back(P);
-+ }
-+
-+ /* members are of the form
-+ * <base type> <arg>, <arg>, <arg>;
-+ * eg struct foo bar, *bar2[2];
-+ * mbase is 'struct foo'
-+ * mtype is '' then '*[2]'
-+ * mname is 'bar' then 'bar2'
-+ */
-+
-+ parse_type(P, &mbase);
-+
-+ for (;;) {
-+ struct token mname;
-+ struct cp_ctype mt = mbase;
-+
-+ memset(&mname, 0, sizeof(mname));
-+
-+ if (ct->is_variable_struct) {
-+ cp_error("can't have members after a variable "
-+ "sized member on line %d", P->line);
-+ return -1;
-+ }
-+
-+ parse_argument(P, &mt, &mname, NULL);
-+
-+ if (!mt.is_defined && (mt.pointers - mt.is_array) == 0) {
-+ cp_error("member type is undefined on line %d",
-+ P->line);
-+ return -1;
-+ }
-+
-+ if (mt.type == VOID_TYPE
-+ && (mt.pointers - mt.is_array) == 0) {
-+ cp_error("member type can not be void on line %d",
-+ P->line);
-+ return -1;
-+ }
-+
-+ mt.has_member_name = (mname.size > 0);
-+ if (mt.has_member_name) {
-+ cp_push_ctype_with_name(&mt,
-+ mname.str, mname.size);
-+ } else {
-+ /* @TODO handle unnamed member (houqp) */
-+ cp_error("TODO: unnamed member not supported.");
-+ cp_push_ctype(&mt);
-+ }
-+
-+ require_token(P, &tok);
-+ if (tok.type == TOK_SEMICOLON) {
-+ break;
-+ } else if (tok.type != TOK_COMMA) {
-+ cp_error("unexpected token in struct "
-+ "definition on line %d", P->line);
-+ }
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+/* copy over attributes that could be specified before the typedef eg
-+ * __attribute__(packed) const type_t */
-+static void instantiate_typedef(struct parser *P, struct cp_ctype *tt,
-+ const struct cp_ctype *ft)
-+{
-+ struct cp_ctype pt = *tt;
-+ *tt = *ft;
-+
-+ tt->const_mask |= pt.const_mask;
-+ tt->is_packed = pt.is_packed;
-+
-+ if (tt->is_packed) {
-+ tt->align_mask = 0;
-+ } else {
-+ /* Instantiate the typedef in the current packing. This may be
-+ * further updated if a pointer is added or another alignment
-+ * attribute is applied. If pt.align_mask is already non-zero
-+ * than an increased alignment via __declspec(aligned(#)) has
-+ * been set. */
-+ tt->align_mask = max(min(P->align_mask, tt->align_mask),
-+ pt.align_mask);
-+ }
-+}
-+
-+/* this parses a struct or union starting with the optional
-+ * name before the opening brace
-+ * leaves the type usr value on the stack */
-+static int parse_record(struct parser *P, struct cp_ctype *ct)
-+{
-+ struct token tok;
-+ char cur_type_name[MAX_TYPE_NAME_LEN];
-+
-+ require_token(P, &tok);
-+
-+ /* name is optional */
-+ if (tok.type == TOK_TOKEN) {
-+ /* declaration */
-+ struct cp_ctype *lct;
-+
-+ memset(cur_type_name, 0, MAX_TYPE_NAME_LEN);
-+ set_struct_type_name(cur_type_name, tok.str, tok.size);
-+;
-+ /* lookup the name to see if we've seen this type before */
-+ lct = ctype_lookup_type(cur_type_name);
-+
-+ if (!lct) {
-+ /* new type, delay type registration to the end
-+ * of this function */
-+ } else {
-+ /* get the exsting declared type */
-+ if (lct->type != ct->type) {
-+ cp_error("type '%s' previously declared as '%s'",
-+ cur_type_name,
-+ csym_name(ct_ffi_cs(lct)));
-+ }
-+
-+ instantiate_typedef(P, ct, lct);
-+ }
-+
-+ /* if a name is given then we may be at the end of the string
-+ * eg for ffi.new('struct foo') */
-+ if (!next_token(P, &tok)) {
-+ return 0;
-+ }
-+ } else {
-+ /* create a new unnamed record */
-+
-+ /*@TODO clean this up after unnamed record support is added */
-+ cp_error("TODO: support unnamed record.\n");
-+ }
-+
-+ if (tok.type != TOK_OPEN_CURLY) {
-+ /* this may just be a declaration or use of the type as an
-+ * argument or member */
-+ put_back(P);
-+ return 0;
-+ }
-+
-+ if (ct->is_defined) {
-+ cp_error("redefinition in line %d", P->line);
-+ return 0;
-+ }
-+
-+ if (ct->type == ENUM_TYPE) {
-+ parse_enum(P, ct);
-+ } else {
-+ /* we do a two stage parse, where we parse the content first
-+ * and build up the temp user table. We then iterate over that
-+ * to calculate the offsets and fill out ct_usr. This is so we
-+ * can handle out of order members (eg vtable) and attributes
-+ * specified at the end of the struct. */
-+ parse_struct(P, ct);
-+ /* build symbol for vm */
-+ ct->ffi_cs_id = cp_symbol_build_struct(cur_type_name);
-+ /* save cp_ctype for parser */
-+ cp_ctype_reg_type(cur_type_name, ct);
-+ }
-+
-+ cp_set_defined(ct);
-+ return 0;
-+}
-+
-+/* parses single or multi work built in types, and pushes it onto the stack */
-+static int parse_type_name(struct parser *P, char *type_name)
-+{
-+ struct token tok;
-+ int flags = 0;
-+
-+ enum {
-+ UNSIGNED = 0x01,
-+ SIGNED = 0x02,
-+ LONG = 0x04,
-+ SHORT = 0x08,
-+ INT = 0x10,
-+ CHAR = 0x20,
-+ LONG_LONG = 0x40,
-+ INT8 = 0x80,
-+ INT16 = 0x100,
-+ INT32 = 0x200,
-+ INT64 = 0x400,
-+ };
-+
-+ require_token(P, &tok);
-+
-+ /* we have to manually decode the builtin types since they can take up
-+ * more then one token */
-+ for (;;) {
-+ if (tok.type != TOK_TOKEN) {
-+ break;
-+ } else if (IS_LITERAL(tok, "unsigned")) {
-+ flags |= UNSIGNED;
-+ } else if (IS_LITERAL(tok, "signed")) {
-+ flags |= SIGNED;
-+ } else if (IS_LITERAL(tok, "short")) {
-+ flags |= SHORT;
-+ } else if (IS_LITERAL(tok, "char")) {
-+ flags |= CHAR;
-+ } else if (IS_LITERAL(tok, "long")) {
-+ flags |= (flags & LONG) ? LONG_LONG : LONG;
-+ } else if (IS_LITERAL(tok, "int")) {
-+ flags |= INT;
-+ } else if (IS_LITERAL(tok, "__int8")) {
-+ flags |= INT8;
-+ } else if (IS_LITERAL(tok, "__int16")) {
-+ flags |= INT16;
-+ } else if (IS_LITERAL(tok, "__int32")) {
-+ flags |= INT32;
-+ } else if (IS_LITERAL(tok, "__int64")) {
-+ flags |= INT64;
-+ } else if (IS_LITERAL(tok, "register")) {
-+ /* ignore */
-+ } else {
-+ break;
-+ }
-+
-+ if (!next_token(P, &tok)) {
-+ break;
-+ }
-+ }
-+
-+ if (flags) {
-+ put_back(P);
-+ }
-+
-+ if (flags & CHAR) {
-+ if (flags & SIGNED) {
-+ strcpy(type_name, "int8_t");
-+ } else if (flags & UNSIGNED) {
-+ strcpy(type_name, "uint8_t");
-+ } else {
-+ if (((char) -1) > 0) {
-+ strcpy(type_name, "uint8_t");
-+ } else {
-+ strcpy(type_name, "int8_t");
-+ }
-+ }
-+ } else if (flags & INT8) {
-+ strcpy(type_name, (flags & UNSIGNED) ? "uint8_t" : "int8_t");
-+ } else if (flags & INT16) {
-+ strcpy(type_name, (flags & UNSIGNED) ? "uint16_t" : "int16_t");
-+ } else if (flags & INT32) {
-+ strcpy(type_name, (flags & UNSIGNED) ? "uint32_t" : "int32_t");
-+ } else if (flags & INT64) {
-+ strcpy(type_name, (flags & UNSIGNED) ? "uint64_t" : "int64_t");
-+ } else if (flags & LONG_LONG) {
-+ strcpy(type_name, (flags & UNSIGNED) ? "uint64_t" : "int64_t");
-+ } else if (flags & SHORT) {
-+#define SHORT_TYPE(u) (sizeof(short) == sizeof(int64_t) ? \
-+ u "int64_t" : sizeof(short) == sizeof(int32_t) ? \
-+ u "int32_t" : u "int16_t")
-+ if (flags & UNSIGNED) {
-+ strcpy(type_name, SHORT_TYPE("u"));
-+ } else {
-+ strcpy(type_name, SHORT_TYPE(""));
-+ }
-+#undef SHORT_TYPE
-+ } else if (flags & LONG) {
-+#define LONG_TYPE(u) (sizeof(long) == sizeof(int64_t) ? \
-+ u "int64_t" : u "int32_t")
-+ if (flags & UNSIGNED) {
-+ strcpy(type_name, LONG_TYPE("u"));
-+ } else {
-+ strcpy(type_name, LONG_TYPE(""));
-+ }
-+#undef LONG_TYPE
-+ } else if (flags) {
-+#define INT_TYPE(u) (sizeof(int) == sizeof(int64_t) ? \
-+ u "int64_t" : sizeof(int) == sizeof(int32_t) ? \
-+ u "int32_t" : u "int16_t")
-+ if (flags & UNSIGNED) {
-+ strcpy(type_name, INT_TYPE("u"));
-+ } else {
-+ strcpy(type_name, INT_TYPE(""));
-+ }
-+#undef INT_TYPE
-+ } else {
-+ strncpy(type_name, tok.str, tok.size);
-+ }
-+
-+ return 0;
-+}
-+
-+/* parse_attribute parses a token to see if it is an attribute. It may then
-+ * parse some following tokens to decode the attribute setting the appropriate
-+ * fields in ct. It will return 1 if the token was used (and possibly some
-+ * more following it) or 0 if not. If the token was used, the next token must
-+ * be retrieved using next_token/require_token. */
-+static int parse_attribute(struct parser *P, struct token *tok,
-+ struct cp_ctype *ct, struct parser *asmname)
-+{
-+ if (tok->type != TOK_TOKEN) {
-+ return 0;
-+ } else if (asmname && (IS_LITERAL(*tok, "__asm__")
-+ || IS_LITERAL(*tok, "__asm"))) {
-+ check_token(P, TOK_OPEN_PAREN, NULL,
-+ "unexpected token after __asm__ on line %d",
-+ P->line);
-+ *asmname = *P;
-+
-+ require_token(P, tok);
-+ while (tok->type == TOK_STRING) {
-+ require_token(P, tok);
-+ }
-+
-+ if (tok->type != TOK_CLOSE_PAREN) {
-+ cp_error("unexpected token after __asm__ on line %d",
-+ P->line);
-+ }
-+ return 1;
-+
-+ } else if (IS_LITERAL(*tok, "__attribute__")
-+ || IS_LITERAL(*tok, "__declspec")) {
-+ int parens = 1;
-+ check_token(P, TOK_OPEN_PAREN, NULL,
-+ "expected parenthesis after __attribute__ or "
-+ "__declspec on line %d", P->line);
-+
-+ for (;;) {
-+ require_token(P, tok);
-+ if (tok->type == TOK_OPEN_PAREN) {
-+ parens++;
-+ } else if (tok->type == TOK_CLOSE_PAREN) {
-+ if (--parens == 0) {
-+ break;
-+ }
-+
-+ } else if (tok->type != TOK_TOKEN) {
-+ /* ignore unknown symbols within parentheses */
-+
-+ } else if (IS_LITERAL(*tok, "align") ||
-+ IS_LITERAL(*tok, "aligned") ||
-+ IS_LITERAL(*tok, "__aligned__")) {
-+ unsigned align = 0;
-+ require_token(P, tok);
-+
-+ switch (tok->type) {
-+ case TOK_CLOSE_PAREN:
-+ align = ALIGNED_DEFAULT;
-+ put_back(P);
-+ break;
-+
-+ case TOK_OPEN_PAREN:
-+ require_token(P, tok);
-+
-+ if (tok->type != TOK_NUMBER) {
-+ cp_error("expected align(#) "
-+ "on line %d", P->line);
-+ }
-+
-+ switch (tok->integer) {
-+ case 1: align = 0; break;
-+ case 2: align = 1; break;
-+ case 4: align = 3; break;
-+ case 8: align = 7; break;
-+ case 16: align = 15; break;
-+ default:
-+ cp_error("unsupported align "
-+ "size on line %d",
-+ P->line);
-+ }
-+
-+ check_token(P, TOK_CLOSE_PAREN, NULL,
-+ "expected align(#) on line %d",
-+ P->line);
-+ break;
-+
-+ default:
-+ cp_error("expected align(#) on line %d",
-+ P->line);
-+ }
-+
-+ /* __attribute__(aligned(#)) is only supposed
-+ * to increase alignment */
-+ ct->align_mask = max(align, ct->align_mask);
-+
-+ } else if (IS_LITERAL(*tok, "packed")
-+ || IS_LITERAL(*tok, "__packed__")) {
-+ ct->align_mask = 0;
-+ ct->is_packed = 1;
-+
-+ } else if (IS_LITERAL(*tok, "mode")
-+ || IS_LITERAL(*tok, "__mode__")) {
-+
-+ check_token(P, TOK_OPEN_PAREN, NULL,
-+ "expected mode(MODE) on line %d",
-+ P->line);
-+
-+ require_token(P, tok);
-+ if (tok->type != TOK_TOKEN) {
-+ cp_error("expected mode(MODE) on line %d",
-+ P->line);
-+ }
-+
-+
-+ struct {char ch; uint16_t v;} a16;
-+ struct {char ch; uint32_t v;} a32;
-+ struct {char ch; uint64_t v;} a64;
-+
-+ if (IS_LITERAL(*tok, "QI")
-+ || IS_LITERAL(*tok, "__QI__")
-+ || IS_LITERAL(*tok, "byte")
-+ || IS_LITERAL(*tok, "__byte__")
-+ ) {
-+ ct->type = INT8_TYPE;
-+ ct->base_size = sizeof(uint8_t);
-+ ct->align_mask = 0;
-+
-+ } else if (IS_LITERAL(*tok, "HI")
-+ || IS_LITERAL(*tok, "__HI__")) {
-+ ct->type = INT16_TYPE;
-+ ct->base_size = sizeof(uint16_t);
-+ ct->align_mask = ALIGNOF(a16);
-+
-+ } else if (IS_LITERAL(*tok, "SI")
-+ || IS_LITERAL(*tok, "__SI__")
-+#if defined ARCH_X86 || defined ARCH_ARM
-+ || IS_LITERAL(*tok, "word")
-+ || IS_LITERAL(*tok, "__word__")
-+ || IS_LITERAL(*tok, "pointer")
-+ || IS_LITERAL(*tok, "__pointer__")
-+#endif
-+ ) {
-+ ct->type = INT32_TYPE;
-+ ct->base_size = sizeof(uint32_t);
-+ ct->align_mask = ALIGNOF(a32);
-+
-+ } else if (IS_LITERAL(*tok, "DI")
-+ || IS_LITERAL(*tok, "__DI__")
-+#if defined ARCH_X64
-+ || IS_LITERAL(*tok, "word")
-+ || IS_LITERAL(*tok, "__word__")
-+ || IS_LITERAL(*tok, "pointer")
-+ || IS_LITERAL(*tok, "__pointer__")
-+#endif
-+ ) {
-+ ct->type = INT64_TYPE;
-+ ct->base_size = sizeof(uint64_t);
-+ ct->align_mask = ALIGNOF(a64);
-+
-+ } else {
-+ cp_error("unexpected mode on line %d",
-+ P->line);
-+ }
-+
-+ check_token(P, TOK_CLOSE_PAREN, NULL,
-+ "expected mode(MODE) on line %d", P->line);
-+
-+ } else if (IS_LITERAL(*tok, "cdecl")
-+ || IS_LITERAL(*tok, "__cdecl__")) {
-+ ct->calling_convention = C_CALL;
-+
-+ } else if (IS_LITERAL(*tok, "fastcall")
-+ || IS_LITERAL(*tok, "__fastcall__")) {
-+ ct->calling_convention = FAST_CALL;
-+
-+ } else if (IS_LITERAL(*tok, "stdcall")
-+ || IS_LITERAL(*tok, "__stdcall__")) {
-+ ct->calling_convention = STD_CALL;
-+ }
-+ /* ignore unknown tokens within parentheses */
-+ }
-+ return 1;
-+
-+ } else if (IS_LITERAL(*tok, "__cdecl")) {
-+ ct->calling_convention = C_CALL;
-+ return 1;
-+
-+ } else if (IS_LITERAL(*tok, "__fastcall")) {
-+ ct->calling_convention = FAST_CALL;
-+ return 1;
-+
-+ } else if (IS_LITERAL(*tok, "__stdcall")) {
-+ ct->calling_convention = STD_CALL;
-+ return 1;
-+
-+ } else if (IS_LITERAL(*tok, "__extension__")
-+ || IS_LITERAL(*tok, "extern")) {
-+ /* ignore */
-+ return 1;
-+ } else {
-+ return 0;
-+ }
-+}
-+
-+/* parses from after the opening paranthesis to after the closing parenthesis */
-+static void parse_function_arguments(struct parser* P, struct cp_ctype* ct)
-+{
-+ struct token tok;
-+ int args = 0;
-+
-+ for (;;) {
-+ require_token(P, &tok);
-+
-+ if (tok.type == TOK_CLOSE_PAREN)
-+ break;
-+
-+ if (args) {
-+ if (tok.type != TOK_COMMA) {
-+ cp_error("unexpected token in function "
-+ "argument %d on line %d",
-+ args, P->line);
-+ }
-+ require_token(P, &tok);
-+ }
-+
-+ if (tok.type == TOK_VA_ARG) {
-+ ct->has_var_arg = true;
-+ check_token(P, TOK_CLOSE_PAREN, "",
-+ "unexpected token after ... in "
-+ "function on line %d",
-+ P->line);
-+ break;
-+ } else if (tok.type == TOK_TOKEN) {
-+ struct cp_ctype at;
-+
-+ put_back(P);
-+ parse_type(P, &at);
-+ parse_argument(P, &at, NULL, NULL);
-+
-+ /* array arguments are just treated as their
-+ * base pointer type */
-+ at.is_array = 0;
-+
-+ /* check for the c style int func(void) and error
-+ * on other uses of arguments of type void */
-+ if (at.type == VOID_TYPE && at.pointers == 0) {
-+ if (args) {
-+ cp_error("can't have argument of type "
-+ "void on line %d",
-+ P->line);
-+ }
-+
-+ check_token(P, TOK_CLOSE_PAREN, "",
-+ "unexpected void in function on line %d",
-+ P->line);
-+ break;
-+ }
-+ cp_push_ctype(&at);
-+ args++;
-+ } else {
-+ cp_error("unexpected token in function argument %d "
-+ "on line %d", args+1, P->line);
-+ }
-+ }
-+}
-+
-+static int max_bitfield_size(int type)
-+{
-+ switch (type) {
-+ case BOOL_TYPE:
-+ return 1;
-+ case INT8_TYPE:
-+ return 8;
-+ case INT16_TYPE:
-+ return 16;
-+ case INT32_TYPE:
-+ case ENUM_TYPE:
-+ return 32;
-+ case INT64_TYPE:
-+ return 64;
-+ default:
-+ return -1;
-+ }
-+}
-+
-+static struct cp_ctype *parse_argument2(struct parser *P, struct cp_ctype *ct,
-+ struct token *name, struct parser *asmname);
-+
-+/* parses from after the first ( in a function declaration or function pointer
-+ * can be one of:
-+ * void foo(...) before ...
-+ * void (foo)(...) before foo
-+ * void (* <>)(...) before <> which is the inner type */
-+static struct cp_ctype *parse_function(struct parser *P, struct cp_ctype *ct,
-+ struct token *name, struct parser *asmname)
-+{
-+ /* We have a function pointer or a function. The usr table will
-+ * get replaced by the canonical one (if there is one) in
-+ * find_canonical_usr after all the arguments and returns have
-+ * been parsed. */
-+ struct token tok;
-+ struct cp_ctype *ret = ct;
-+
-+ cp_push_ctype(ct);
-+
-+ memset(ct, 0, sizeof(*ct));
-+ ct->base_size = sizeof(void (*)());
-+ ct->align_mask = min(FUNCTION_ALIGN_MASK, P->align_mask);
-+ ct->type = FUNCTION_TYPE;
-+ ct->is_defined = 1;
-+
-+ if (name->type == TOK_NIL) {
-+ for (;;) {
-+ require_token(P, &tok);
-+
-+ if (tok.type == TOK_STAR) {
-+ if (ct->type == FUNCTION_TYPE) {
-+ ct->type = FUNCTION_PTR_TYPE;
-+ } else {
-+ increase_ptr_deref_level(P, ct);
-+ }
-+ } else if (parse_attribute(P, &tok, ct, asmname)) {
-+ /* parse_attribute sets the appropriate fields */
-+ } else {
-+ /* call parse_argument to handle the inner
-+ * contents e.g. the <> in "void (* <>)
-+ * (...)". Note that the inner contents can
-+ * itself be a function, a function ptr,
-+ * array, etc (e.g. "void (*signal(int sig,
-+ * void (*func)(int)))(int)" ). */
-+ cp_error("TODO: inner function not supported for now.");
-+ put_back(P);
-+ ct = parse_argument2(P, ct, name, asmname);
-+ break;
-+ }
-+ }
-+
-+ check_token(P, TOK_CLOSE_PAREN, NULL,
-+ "unexpected token in function on line %d", P->line);
-+ check_token(P, TOK_OPEN_PAREN, NULL,
-+ "unexpected token in function on line %d", P->line);
-+ }
-+
-+ parse_function_arguments(P, ct);
-+
-+ /*@TODO support for inner function 24.11 2013 (houqp)*/
-+ /* if we have an inner function then set the outer function ptr as its
-+ * return type and return the inner function
-+ * e.g. for void (* <signal(int, void (*)(int))> )(int) inner is
-+ * surrounded by <>, return type is void (*)(int) */
-+
-+ return ret;
-+}
-+
-+static struct cp_ctype *parse_argument2(struct parser *P, struct cp_ctype *ct,
-+ struct token *name, struct parser *asmname)
-+{
-+ struct token tok;
-+
-+ for (;;) {
-+ if (!next_token(P, &tok)) {
-+ /* we've reached the end of the string */
-+ break;
-+ } else if (tok.type == TOK_STAR) {
-+ increase_ptr_deref_level(P, ct);
-+
-+ /* __declspec(align(#)) may come before the type in a
-+ * member */
-+ if (!ct->is_packed) {
-+ ct->align_mask = max(min(PTR_ALIGN_MASK, P->align_mask),
-+ ct->align_mask);
-+ }
-+ } else if (tok.type == TOK_REFERENCE) {
-+ cp_error("NYI: c++ reference types");
-+ return 0;
-+ } else if (parse_attribute(P, &tok, ct, asmname)) {
-+ /* parse attribute has filled out appropriate fields in type */
-+
-+ } else if (tok.type == TOK_OPEN_PAREN) {
-+ ct = parse_function(P, ct, name, asmname);
-+ } else if (tok.type == TOK_OPEN_SQUARE) {
-+ /* array */
-+ if (ct->pointers == POINTER_MAX) {
-+ cp_error("maximum number of pointer derefs "
-+ "reached - use a struct to break up "
-+ "the pointers");
-+ }
-+ ct->is_array = 1;
-+ ct->pointers++;
-+ ct->const_mask <<= 1;
-+ require_token(P, &tok);
-+
-+ if (ct->pointers == 1 && !ct->is_defined) {
-+ cp_error("array of undefined type on line %d",
-+ P->line);
-+ }
-+
-+ if (ct->is_variable_struct || ct->is_variable_array) {
-+ cp_error("can't have an array of a variably "
-+ "sized type on line %d", P->line);
-+ }
-+
-+ if (tok.type == TOK_QUESTION) {
-+ ct->is_variable_array = 1;
-+ ct->variable_increment = (ct->pointers > 1) ?
-+ sizeof(void*) : ct->base_size;
-+ check_token(P, TOK_CLOSE_SQUARE, "",
-+ "invalid character in array on line %d",
-+ P->line);
-+
-+ } else if (tok.type == TOK_CLOSE_SQUARE) {
-+ ct->array_size = 0;
-+
-+ } else if (tok.type == TOK_TOKEN && IS_RESTRICT(tok)) {
-+ /* odd gcc extension foo[__restrict] for arguments */
-+ ct->array_size = 0;
-+ check_token(P, TOK_CLOSE_SQUARE, "",
-+ "invalid character in array on line %d",
-+ P->line);
-+ } else {
-+ int64_t asize;
-+ put_back(P);
-+ asize = calculate_constant(P);
-+ if (asize < 0) {
-+ cp_error("array size can not be "
-+ "negative on line %d", P->line);
-+ return 0;
-+ }
-+ ct->array_size = (size_t) asize;
-+ check_token(P, TOK_CLOSE_SQUARE, "",
-+ "invalid character in array on line %d",
-+ P->line);
-+ }
-+
-+ } else if (tok.type == TOK_COLON) {
-+ int64_t bsize = calculate_constant(P);
-+
-+ if (ct->pointers || bsize < 0
-+ || bsize > max_bitfield_size(ct->type)) {
-+ cp_error("invalid bitfield on line %d", P->line);
-+ }
-+
-+ ct->is_bitfield = 1;
-+ ct->bit_size = (unsigned) bsize;
-+
-+ } else if (tok.type != TOK_TOKEN) {
-+ /* we've reached the end of the declaration */
-+ put_back(P);
-+ break;
-+
-+ } else if (IS_CONST(tok)) {
-+ ct->const_mask |= 1;
-+
-+ } else if (IS_VOLATILE(tok) || IS_RESTRICT(tok)) {
-+ /* ignored for now */
-+
-+ } else {
-+ *name = tok;
-+ }
-+ }
-+
-+ return ct;
-+}
-+
-+
-+
-+/* parses after the main base type of a typedef, function argument or
-+ * struct/union member
-+ * eg for const void* bar[3] the base type is void with the subtype so far of
-+ * const, this parses the "* bar[3]" and updates the type argument
-+ *
-+ * type must be as filled out by parse_type
-+ *
-+ * pushes the updated user value on the top of the stack
-+ */
-+void parse_argument(struct parser *P, struct cp_ctype *ct, struct token *pname,
-+ struct parser *asmname)
-+{
-+ struct token tok, name;
-+
-+ memset(&name, 0, sizeof(name));
-+ parse_argument2(P, ct, &name, asmname);
-+
-+ for (;;) {
-+ if (!next_token(P, &tok)) {
-+ break;
-+ } else if (parse_attribute(P, &tok, ct, asmname)) {
-+ /* parse_attribute sets the appropriate fields */
-+ } else {
-+ put_back(P);
-+ break;
-+ }
-+ }
-+
-+ if (pname) {
-+ *pname = name;
-+ }
-+}
-+
-+static void parse_typedef(struct parser *P)
-+{
-+ struct token tok;
-+ struct cp_ctype base_type;
-+ char typedef_name[MAX_TYPE_NAME_LEN];
-+
-+ parse_type(P, &base_type);
-+
-+ for (;;) {
-+ struct cp_ctype arg_type = base_type;
-+ struct token name;
-+
-+ memset(&name, 0, sizeof(name));
-+
-+ parse_argument(P, &arg_type, &name, NULL);
-+
-+ if (!name.size) {
-+ cp_error("Can't have a typedef without a name on line %d",
-+ P->line);
-+ } else if (arg_type.is_variable_array) {
-+ cp_error("Can't typedef a variable length array on line %d",
-+ P->line);
-+ }
-+
-+ memset(typedef_name, 0, sizeof(typedef_name));
-+ strncpy(typedef_name, name.str, name.size);
-+ /* link typedef name with ctype for parser */
-+ cp_ctype_reg_type(typedef_name, &arg_type);
-+
-+ require_token(P, &tok);
-+
-+ if (tok.type == TOK_SEMICOLON) {
-+ break;
-+ } else if (tok.type != TOK_COMMA) {
-+ cp_error("Unexpected character in typedef on line %d",
-+ P->line);
-+ }
-+ }
-+}
-+
-+#define END 0
-+#define PRAGMA_POP 1
-+
-+static int parse_root(struct parser *P)
-+{
-+ struct token tok;
-+
-+ while (next_token(P, &tok)) {
-+ /* we can have:
-+ * struct definition
-+ * enum definition
-+ * union definition
-+ * struct/enum/union declaration
-+ * typedef
-+ * function declaration
-+ * pragma pack
-+ */
-+
-+ if (tok.type == TOK_SEMICOLON) {
-+ /* empty semicolon in root continue on */
-+
-+ } else if (tok.type == TOK_POUND) {
-+
-+ check_token(P, TOK_TOKEN, "pragma",
-+ "unexpected pre processor directive on line %d",
-+ P->line);
-+ check_token(P, TOK_TOKEN, "pack",
-+ "unexpected pre processor directive on line %d",
-+ P->line);
-+ check_token(P, TOK_OPEN_PAREN, "",
-+ "invalid pack directive on line %d",
-+ P->line);
-+ require_token(P, &tok);
-+
-+ if (tok.type == TOK_NUMBER) {
-+ if (tok.integer != 1 && tok.integer != 2
-+ && tok.integer != 4
-+ && tok.integer != 8
-+ && tok.integer != 16) {
-+ cp_error("pack directive with invalid "
-+ "pack size on line %d",
-+ P->line);
-+ return 0;
-+ }
-+
-+ P->align_mask = (unsigned) (tok.integer - 1);
-+ check_token(P, TOK_CLOSE_PAREN, "",
-+ "invalid pack directive on line %d",
-+ P->line);
-+ } else if (tok.type == TOK_TOKEN && IS_LITERAL(tok, "push")) {
-+ /*int line = P->line;*/
-+ unsigned previous_alignment = P->align_mask;
-+
-+ check_token(P, TOK_CLOSE_PAREN, "",
-+ "invalid pack directive on line %d",
-+ P->line);
-+
-+ if (parse_root(P) != PRAGMA_POP) {
-+ cp_error("reached end of string "
-+ "without a pragma pop to "
-+ "match the push on line %d",
-+ P->line);
-+ return 0;
-+ }
-+
-+ P->align_mask = previous_alignment;
-+
-+ } else if (tok.type == TOK_TOKEN && IS_LITERAL(tok, "pop")) {
-+ check_token(P, TOK_CLOSE_PAREN, "",
-+ "invalid pack directive on line %d",
-+ P->line);
-+ return PRAGMA_POP;
-+ } else {
-+ cp_error("invalid pack directive on line %d",
-+ P->line);
-+ return 0;
-+ }
-+ } else if (tok.type != TOK_TOKEN) {
-+ cp_error("unexpected character on line %d", P->line);
-+ return 0;
-+ } else if (IS_LITERAL(tok, "__extension__")) {
-+ /* ignore */
-+ continue;
-+ } else if (IS_LITERAL(tok, "extern")) {
-+ /* ignore extern as data and functions can only be
-+ * extern */
-+ continue;
-+ } else if (IS_LITERAL(tok, "typedef")) {
-+ parse_typedef(P);
-+ } else if (IS_LITERAL(tok, "static")) {
-+ /*@TODO we haven't tested static so far */
-+ cp_error("TODO: support static keyword.\n");
-+ } else {
-+ /* type declaration, type definition, or function
-+ * declaration */
-+ struct cp_ctype type;
-+ struct token name;
-+ struct parser asmname;
-+
-+ memset(&name, 0, sizeof(name));
-+ memset(&asmname, 0, sizeof(asmname));
-+
-+ put_back(P);
-+ parse_type(P, &type);
-+
-+ for (;;) {
-+ parse_argument(P, &type, &name, &asmname);
-+
-+ if (name.size) {
-+ /* global/function declaration */
-+ cp_symbol_build_func(&type, name.str, name.size);
-+ /* @TODO asmname is not used for now
-+ * since we are not supporting __asm__
-+ * as this point.
-+ * might need to bind it with function
-+ * name later. */
-+ } else {
-+ /* type declaration/definition -
-+ * already been processed */
-+ }
-+ require_token(P, &tok);
-+
-+ if (tok.type == TOK_SEMICOLON) {
-+ break;
-+ } else if (tok.type != TOK_COMMA) {
-+ cp_error("missing semicolon on line %d",
-+ P->line);
-+ }
-+ }
-+ }
-+ }
-+
-+ return END;
-+}
-+
-+static int64_t calculate_constant2(struct parser *P, struct token *tok);
-+
-+/* () */
-+static int64_t calculate_constant1(struct parser *P, struct token *tok)
-+{
-+ int64_t ret;
-+
-+ if (tok->type == TOK_NUMBER) {
-+ ret = tok->integer;
-+ next_token(P, tok);
-+ return ret;
-+
-+ } else if (tok->type == TOK_TOKEN) {
-+ /* look up name in constants table */
-+ cp_error("TODO: support name lookup in constant table\n");
-+ next_token(P, tok);
-+ return ret;
-+
-+ } else if (tok->type == TOK_OPEN_PAREN) {
-+ struct parser before_cast = *P;
-+ cp_error("TODO: handle open parent token in constant1\n");
-+ *P = before_cast;
-+ ret = calculate_constant(P);
-+
-+ require_token(P, tok);
-+ if (tok->type != TOK_CLOSE_PAREN) {
-+ cp_error("error whilst parsing constant at line %d",
-+ P->line);
-+ }
-+
-+ next_token(P, tok);
-+ return ret;
-+ } else {
-+ cp_error("unexpected token whilst parsing constant at line %d",
-+ P->line);
-+ return 0;
-+ }
-+}
-+
-+/* ! and ~, unary + and -, and sizeof */
-+static int64_t calculate_constant2(struct parser *P, struct token *tok)
-+{
-+ if (tok->type == TOK_LOGICAL_NOT) {
-+ require_token(P, tok);
-+ return !calculate_constant2(P, tok);
-+
-+ } else if (tok->type == TOK_BITWISE_NOT) {
-+ require_token(P, tok);
-+ return ~calculate_constant2(P, tok);
-+
-+ } else if (tok->type == TOK_PLUS) {
-+ require_token(P, tok);
-+ return calculate_constant2(P, tok);
-+
-+ } else if (tok->type == TOK_MINUS) {
-+ require_token(P, tok);
-+ return -calculate_constant2(P, tok);
-+
-+ } else if (tok->type == TOK_TOKEN &&
-+ (IS_LITERAL(*tok, "sizeof")
-+ || IS_LITERAL(*tok, "alignof")
-+ || IS_LITERAL(*tok, "__alignof__")
-+ || IS_LITERAL(*tok, "__alignof"))) {
-+ cp_error("TODO: support sizeof\n");
-+ bool issize = IS_LITERAL(*tok, "sizeof");
-+ struct cp_ctype type;
-+
-+ require_token(P, tok);
-+ if (tok->type != TOK_OPEN_PAREN) {
-+ cp_error("invalid sizeof at line %d", P->line);
-+ }
-+
-+ parse_type(P, &type);
-+ parse_argument(P, &type, NULL, NULL);
-+
-+ require_token(P, tok);
-+ if (tok->type != TOK_CLOSE_PAREN) {
-+ cp_error("invalid sizeof at line %d", P->line);
-+ }
-+
-+ next_token(P, tok);
-+
-+ return issize ? ctype_size(&type) : type.align_mask + 1;
-+
-+ } else {
-+ return calculate_constant1(P, tok);
-+ }
-+}
-+
-+/* binary * / and % (left associative) */
-+static int64_t calculate_constant3(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant2(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_MULTIPLY) {
-+ require_token(P, tok);
-+ left *= calculate_constant2(P, tok);
-+
-+ } else if (tok->type == TOK_DIVIDE) {
-+ require_token(P, tok);
-+ left /= calculate_constant2(P, tok);
-+
-+ } else if (tok->type == TOK_MODULUS) {
-+ require_token(P, tok);
-+ left %= calculate_constant2(P, tok);
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* binary + and - (left associative) */
-+static int64_t calculate_constant4(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant3(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_PLUS) {
-+ require_token(P, tok);
-+ left += calculate_constant3(P, tok);
-+
-+ } else if (tok->type == TOK_MINUS) {
-+ require_token(P, tok);
-+ left -= calculate_constant3(P, tok);
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* binary << and >> (left associative) */
-+static int64_t calculate_constant5(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant4(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_LEFT_SHIFT) {
-+ require_token(P, tok);
-+ left <<= calculate_constant4(P, tok);
-+
-+ } else if (tok->type == TOK_RIGHT_SHIFT) {
-+ require_token(P, tok);
-+ left >>= calculate_constant4(P, tok);
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* binary <, <=, >, and >= (left associative) */
-+static int64_t calculate_constant6(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant5(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_LESS) {
-+ require_token(P, tok);
-+ left = (left < calculate_constant5(P, tok));
-+
-+ } else if (tok->type == TOK_LESS_EQUAL) {
-+ require_token(P, tok);
-+ left = (left <= calculate_constant5(P, tok));
-+
-+ } else if (tok->type == TOK_GREATER) {
-+ require_token(P, tok);
-+ left = (left > calculate_constant5(P, tok));
-+
-+ } else if (tok->type == TOK_GREATER_EQUAL) {
-+ require_token(P, tok);
-+ left = (left >= calculate_constant5(P, tok));
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* binary ==, != (left associative) */
-+static int64_t calculate_constant7(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant6(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_EQUAL) {
-+ require_token(P, tok);
-+ left = (left == calculate_constant6(P, tok));
-+
-+ } else if (tok->type == TOK_NOT_EQUAL) {
-+ require_token(P, tok);
-+ left = (left != calculate_constant6(P, tok));
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* binary & (left associative) */
-+static int64_t calculate_constant8(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant7(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_BITWISE_AND) {
-+ require_token(P, tok);
-+ left = (left & calculate_constant7(P, tok));
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* binary ^ (left associative) */
-+static int64_t calculate_constant9(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant8(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_BITWISE_XOR) {
-+ require_token(P, tok);
-+ left = (left ^ calculate_constant8(P, tok));
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* binary | (left associative) */
-+static int64_t calculate_constant10(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant9(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_BITWISE_OR) {
-+ require_token(P, tok);
-+ left = (left | calculate_constant9(P, tok));
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* binary && (left associative) */
-+static int64_t calculate_constant11(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant10(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_LOGICAL_AND) {
-+ require_token(P, tok);
-+ left = (left && calculate_constant10(P, tok));
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* binary || (left associative) */
-+static int64_t calculate_constant12(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant11(P, tok);
-+
-+ for (;;) {
-+ if (tok->type == TOK_LOGICAL_OR) {
-+ require_token(P, tok);
-+ left = (left || calculate_constant11(P, tok));
-+
-+ } else {
-+ return left;
-+ }
-+ }
-+}
-+
-+/* ternary ?: (right associative) */
-+static int64_t calculate_constant13(struct parser *P, struct token *tok)
-+{
-+ int64_t left = calculate_constant12(P, tok);
-+
-+ if (tok->type == TOK_QUESTION) {
-+ int64_t middle, right;
-+ require_token(P, tok);
-+ middle = calculate_constant13(P, tok);
-+ if (tok->type != TOK_COLON) {
-+ cp_error("invalid ternery (? :) in constant on line %d",
-+ P->line);
-+ }
-+ require_token(P, tok);
-+ right = calculate_constant13(P, tok);
-+ return left ? middle : right;
-+
-+ } else {
-+ return left;
-+ }
-+}
-+
-+int64_t calculate_constant(struct parser* P)
-+{
-+ struct token tok;
-+ int64_t ret;
-+ require_token(P, &tok);
-+ ret = calculate_constant13(P, &tok);
-+
-+ if (tok.type != TOK_NIL) {
-+ put_back(P);
-+ }
-+
-+ return ret;
-+}
-+
-+int ffi_cdef(const char *s)
-+{
-+ struct parser P;
-+
-+ memset(&P, 0, sizeof(struct parser));
-+ P.line = 1;
-+ P.prev = P.next = s;
-+ P.align_mask = DEFAULT_ALIGN_MASK;
-+
-+ if (parse_root(&P) == PRAGMA_POP) {
-+ cp_error("pragma pop without an associated push on line %d",
-+ P.line);
-+ }
-+
-+ return 0;
-+}
-+
-+void ffi_cparser_init(void)
-+{
-+ cp_ctype_init();
-+}
-+
-+void ffi_cparser_free(void)
-+{
-+ cp_ctype_free();
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/ffi/ctype.c
-@@ -0,0 +1,551 @@
-+#include "../../include/ktap_types.h"
-+#include "../../include/ktap_opcodes.h"
-+#include "../ktapc.h"
-+#include "../cparser.h"
-+
-+
-+/* for ktap vm */
-+cp_csymbol_state csym_state;
-+
-+#define cs_nr (csym_state.cs_nr)
-+#define cs_arr_size (csym_state.cs_arr_size)
-+#define cs_arr (csym_state.cs_arr)
-+
-+csymbol *cp_id_to_csym(int id)
-+{
-+ return &cs_arr[id];
-+}
-+
-+
-+typedef struct cp_ctype_entry {
-+ char name[MAX_TYPE_NAME_LEN];
-+ struct cp_ctype ct;
-+} cp_ctype_entry;
-+
-+#define DEFAULT_CTYPE_ARR_SIZE 100
-+static int cte_nr;
-+static int cte_arr_size;
-+static cp_ctype_entry *cte_arr;
-+
-+
-+/* stack to help maintain state during parsing */
-+typedef struct cp_ctype_stack {
-+ int size;
-+ int top;
-+ cp_ctype_entry *stack;
-+} ctype_stack;
-+
-+
-+static ctype_stack cts;
-+
-+#define ct_stack(id) (&(cts.stack[id]))
-+#define ct_stack_ct(id) (&(cts.stack[id].ct))
-+
-+
-+
-+int cp_ctype_reg_csymbol(csymbol *cs);
-+
-+
-+size_t ctype_size(const struct cp_ctype *ct)
-+{
-+ if (ct->pointers - ct->is_array) {
-+ return sizeof(void*) * (ct->is_array ? ct->array_size : 1);
-+
-+ } else if (!ct->is_defined || ct->type == VOID_TYPE) {
-+ cp_error("can't calculate size of an undefined type");
-+ return 0;
-+ } else if (ct->variable_size_known) {
-+ assert(ct->is_variable_struct && !ct->is_array);
-+ return ct->base_size + ct->variable_increment;
-+ } else if (ct->is_variable_array || ct->is_variable_struct) {
-+ cp_error("internal error: calc size of variable type with "
-+ "unknown size");
-+ return 0;
-+ } else {
-+ return ct->base_size * (ct->is_array ? ct->array_size : 1);
-+ }
-+}
-+
-+#define MAX_STACK_SIZE 100
-+int ctype_stack_grow(int size)
-+{
-+ struct cp_ctype_entry *new_st;
-+
-+ assert(cts.size + size < MAX_STACK_SIZE);
-+
-+ new_st = realloc(cts.stack, (cts.size+size)*sizeof(cp_ctype_entry));
-+ if (new_st)
-+ cts.stack = new_st;
-+ else
-+ return -1;
-+
-+ cts.size += size;
-+
-+ return size;
-+}
-+
-+int ctype_stack_free_space()
-+{
-+ return cts.size - cts.top;
-+}
-+
-+void ctype_stack_reset()
-+{
-+ cts.top = 0;
-+}
-+
-+/* push ctype to stack, create new csymbol if needed */
-+void cp_push_ctype_with_name(struct cp_ctype *ct, const char *name, int nlen)
-+{
-+ int i;
-+ struct cp_ctype *nct;
-+
-+ if (ctype_stack_free_space() < 1)
-+ ctype_stack_grow(4);
-+
-+ /* we have to check pointer here because does type lookup by name
-+ * before parsing '*', and for pointers, ct will always be the
-+ * original type */
-+ if (ct->pointers) {
-+ for (i = 0; i < cte_nr; i++) {
-+ nct = &(cte_arr[i].ct);
-+ if (nct->type == ct->type &&
-+ nct->pointers == ct->pointers) {
-+ break;
-+ }
-+ }
-+
-+ if (i == cte_nr) {
-+ /* pointer type not found
-+ * create a new pointer symbol for this type */
-+ /* associate ctype with new csymbol */
-+ ct->ffi_cs_id = cp_symbol_build_pointer(ct);
-+ /* register wit new pointer name */
-+ cp_ctype_reg_type(csym_name(ct_ffi_cs(ct)), ct);
-+ } else {
-+ /* pointer type already registered, reinstantiate ct */
-+ *ct = cte_arr[i].ct;
-+ }
-+ }
-+ memset(ct_stack(cts.top), 0, sizeof(cp_ctype_entry));
-+ ct_stack(cts.top)->ct = *ct;
-+ if (name)
-+ strncpy(ct_stack(cts.top)->name, name, nlen);
-+ cts.top++;
-+}
-+
-+void cp_push_ctype(struct cp_ctype *ct)
-+{
-+ cp_push_ctype_with_name(ct, NULL, 0);
-+}
-+
-+void cp_set_defined(struct cp_ctype *ct)
-+{
-+ ct->is_defined = 1;
-+
-+ /* @TODO: update ctypes and cdatas that were created before the
-+ * definition came in */
-+}
-+
-+void cp_ctype_dump_stack()
-+{
-+ int i;
-+ struct cp_ctype *ct;
-+
-+ printf("---------------------------\n");
-+ printf("start of ctype stack (%d) dump: \n", cts.top);
-+ for (i = 0; i < cts.top; i++) {
-+ ct = ct_stack_ct(i);
-+ printf("[%d] -> cp_ctype: %d, sym_type: %d, pointer: %d "
-+ "symbol_id: %d, name: %s\n",
-+ i, ct->type,
-+ csym_type(ct_ffi_cs(ct)), ct->pointers, ct->ffi_cs_id,
-+ ct_stack(i)->name);
-+ }
-+}
-+
-+int ctype_reg_table_grow()
-+{
-+ cp_ctype_entry *new_arr;
-+
-+ new_arr = realloc(cte_arr, sizeof(cp_ctype_entry)*cte_arr_size*2);
-+ if (!new_arr)
-+ cp_error("failed to allocate memory for ctype array\n");
-+
-+ cte_arr_size = cte_arr_size * 2;
-+ return 0;
-+}
-+
-+/* return index in csymbol array */
-+int cp_ctype_reg_csymbol(csymbol *cs)
-+{
-+ if (cs_nr >= cs_arr_size) {
-+ cs_arr_size *= 2;
-+ cs_arr = realloc(cs_arr, cs_arr_size*sizeof(csymbol));
-+ if (!cs_arr)
-+ cp_error("failed to extend csymbol array!\n");
-+ }
-+
-+ cs_arr[cs_nr] = *cs;
-+ cs_nr++;
-+
-+ return cs_nr-1;
-+}
-+
-+void __cp_symbol_dump_struct(csymbol *cs)
-+{
-+ int i;
-+ csymbol *ncs;
-+ csymbol_struct *stcs = csym_struct(cs);
-+
-+ printf("=== [%s] definition ==================\n", csym_name(cs));
-+ for (i = 0; i < stcs->memb_nr; i++) {
-+ printf("\t(%d) ", i);
-+ printf("csym_id: %d, ", stcs->members[i].id);
-+ ncs = &cs_arr[stcs->members[i].id];
-+ printf("name: %s, ffi_ctype: %d, %s\n",
-+ stcs->members[i].name, ncs->type, csym_name(ncs));
-+ }
-+}
-+
-+void cp_symbol_dump_struct(int id)
-+{
-+ __cp_symbol_dump_struct(&cs_arr[id]);
-+}
-+
-+int cp_symbol_build_struct(const char *stname)
-+{
-+ int i, id, memb_size;
-+ cp_ctype_entry *cte;
-+ csymbol nst;
-+ struct_member *st_membs;
-+ csymbol_struct *stcs;
-+
-+ if (cts.top <= 0 || !stname) {
-+ cp_error("invalid struct definition.\n");
-+ }
-+
-+ memb_size = cts.top;
-+ st_membs = malloc(memb_size*sizeof(struct_member));
-+ if (!st_membs)
-+ cp_error("failed to allocate memory for struct members.\n");
-+ memset(st_membs, 0, memb_size*sizeof(struct_member));
-+
-+ nst.type = FFI_STRUCT;
-+ strcpy(nst.name, stname);
-+
-+ stcs = csym_struct(&nst);
-+ stcs->memb_nr = memb_size;
-+ stcs->members = st_membs;
-+
-+ for (i = 0; i < memb_size; i++) {
-+ assert(i < cts.top);
-+ cte = ct_stack(i);
-+ if (cte->name)
-+ strcpy(st_membs[i].name, cte->name);
-+ st_membs[i].id = ct_stack_ct(i)->ffi_cs_id;
-+ }
-+
-+ id = cp_ctype_reg_csymbol(&nst);
-+
-+ ctype_stack_reset();
-+
-+ return id;
-+}
-+
-+/* build pointer symbol from given csymbol */
-+int cp_symbol_build_pointer(struct cp_ctype *ct)
-+{
-+ int id, ret;
-+ csymbol ncspt;
-+ csymbol *ref_cs = ct_ffi_cs(ct);
-+
-+ /* TODO: Check correctness of multi-level pointer 24.11.2013(unihorn) */
-+ memset(&ncspt, 0, sizeof(csymbol));
-+ ncspt.type = FFI_PTR;
-+ ret = sprintf(ncspt.name, "%s *", csym_name(ref_cs));
-+ assert(ret < MAX_TYPE_NAME_LEN);
-+
-+ csym_set_ptr_deref_id(&ncspt, ct->ffi_cs_id);
-+ id = cp_ctype_reg_csymbol(&ncspt);
-+
-+ return id;
-+}
-+
-+void __cp_symbol_dump_func(csymbol *cs)
-+{
-+ int i;
-+ csymbol *ncs;
-+ csymbol_func *fcs = csym_func(cs);
-+
-+ printf("=== [%s] function definition =============\n", csym_name(cs));
-+ ncs = cp_csymf_ret(fcs);
-+ printf("address: %p\n", fcs->addr);
-+ printf("return type: \n");
-+ printf("\tcsym_id: %d, ffi_ctype: %d, %s\n",
-+ fcs->ret_id, ncs->type, csym_name(ncs));
-+ printf("args type (%d): \n", fcs->arg_nr);
-+ for (i = 0; i < csymf_arg_nr(fcs); i++) {
-+ printf("\t (%d) ", i);
-+ printf("csym_id: %d, ", fcs->arg_ids[i]);
-+ ncs = cp_csymf_arg(fcs, i);
-+ printf("ffi_ctype: %d, %s\n", ncs->type, csym_name(ncs));
-+ }
-+}
-+
-+void cp_symbol_dump_func(int id)
-+{
-+ __cp_symbol_dump_func(&cs_arr[id]);
-+}
-+
-+int cp_symbol_build_func(struct cp_ctype *type, const char *fname, int fn_size)
-+{
-+ int i = 1, arg_nr, id;
-+ int *argsym_id_arr;
-+ csymbol nfcs;
-+ csymbol_func *fcs;
-+
-+ if (cts.top == 0 || fn_size < 0 || !fname) {
-+ cp_error("invalid function definition.\n");
-+ }
-+
-+ argsym_id_arr = NULL;
-+ memset(&nfcs, 0, sizeof(csymbol));
-+ csym_type(&nfcs) = FFI_FUNC;
-+
-+ strncpy(csym_name(&nfcs), fname, fn_size);
-+
-+ fcs = csym_func(&nfcs);
-+ fcs->has_var_arg = type->has_var_arg;
-+ /* Type needed for handling variable args handle */
-+ if (fcs->has_var_arg && !ctype_lookup_type("void *"))
-+ cp_symbol_build_pointer(ctype_lookup_type("void"));
-+
-+ /* Fetch start address of function */
-+ fcs->addr = (void *)find_kernel_symbol(csym_name(&nfcs));
-+ if (!fcs->addr)
-+ cp_error("wrong function address for %s\n", csym_name(&nfcs));
-+
-+ /* bottom of the stack is return type */
-+ fcs->ret_id = ct_stack_ct(0)->ffi_cs_id;
-+
-+ /* the rest is argument type */
-+ if (cts.top == 1) {
-+ /* function takes no argument */
-+ arg_nr = 0;
-+ } else {
-+ arg_nr = cts.top - 1;
-+ argsym_id_arr = malloc(arg_nr * sizeof(int));
-+ if (!argsym_id_arr)
-+ cp_error("failed to allocate memory for function args.\n");
-+ for (i = 0; i < arg_nr; i++) {
-+ argsym_id_arr[i] = ct_stack_ct(i+1)->ffi_cs_id;
-+ }
-+ }
-+ fcs->arg_nr = arg_nr;
-+ fcs->arg_ids = argsym_id_arr;
-+
-+ id = cp_ctype_reg_csymbol(&nfcs);
-+
-+ /* clear stack since we have consumed all the ctypes */
-+ ctype_stack_reset();
-+
-+ return id;
-+}
-+
-+struct cp_ctype *cp_ctype_reg_type(char *name, struct cp_ctype *ct)
-+{
-+ if (cte_nr >= cte_arr_size)
-+ ctype_reg_table_grow();
-+
-+ memset(cte_arr[cte_nr].name, 0, MAX_TYPE_NAME_LEN);
-+ strcpy(cte_arr[cte_nr].name, name);
-+
-+ cte_arr[cte_nr].ct = *ct;
-+ cte_nr++;
-+
-+ return &(cte_arr[cte_nr-1].ct);
-+}
-+
-+#if 0
-+/* TODO: used for size calculation */
-+static ffi_type ffi_int_type(ktap_state *ks, int size, bool sign)
-+{
-+ switch(size) {
-+ case 1:
-+ if (!sign)
-+ return FFI_UINT8;
-+ else
-+ return FFI_INT8;
-+ case 2:
-+ if (!sign)
-+ return FFI_UINT16;
-+ else
-+ return FFI_INT16;
-+ case 4:
-+ if (!sign)
-+ return FFI_UINT32;
-+ else
-+ return FFI_INT32;
-+ case 8:
-+ if (!sign)
-+ return FFI_UINT64;
-+ else
-+ return FFI_INT64;
-+ default:
-+ kp_error(ks, "Error: Have not support int type of size %d\n", size);
-+ return FFI_UNKNOWN;
-+ }
-+
-+ /* NEVER reach here, silence compiler */
-+ return -1;
-+}
-+#endif
-+
-+
-+static inline void ct_set_type(struct cp_ctype *ct, int type, int is_unsigned)
-+{
-+ ct->type = type;
-+ ct->is_unsigned = is_unsigned;
-+}
-+
-+static void init_builtin_type(struct cp_ctype *ct, ffi_type ftype)
-+{
-+ csymbol cs;
-+ int cs_id;
-+
-+ csym_type(&cs) = ftype;
-+ strncpy(csym_name(&cs), ffi_type_name(ftype), CSYM_NAME_MAX_LEN);
-+ cs_id = cp_ctype_reg_csymbol(&cs);
-+
-+ memset(ct, 0, sizeof(*ct));
-+ ct->ffi_cs_id = cs_id;
-+ switch (ftype) {
-+ case FFI_VOID: ct_set_type(ct, VOID_TYPE, 0); break;
-+ case FFI_UINT8: ct_set_type(ct, INT8_TYPE, 1); break;
-+ case FFI_INT8: ct_set_type(ct, INT8_TYPE, 0); break;
-+ case FFI_UINT16: ct_set_type(ct, INT16_TYPE, 1); break;
-+ case FFI_INT16: ct_set_type(ct, INT16_TYPE, 0); break;
-+ case FFI_UINT32: ct_set_type(ct, INT32_TYPE, 1); break;
-+ case FFI_INT32: ct_set_type(ct, INT32_TYPE, 0); break;
-+ case FFI_UINT64: ct_set_type(ct, INT64_TYPE, 1); break;
-+ case FFI_INT64: ct_set_type(ct, INT64_TYPE, 0); break;
-+ default: break;
-+ }
-+ ct->base_size = ffi_type_size(ftype);
-+ ct->align_mask = ffi_type_align(ftype) - 1;
-+ ct->is_defined = 1;
-+}
-+
-+/*
-+ * lookup and register builtin C type on demand
-+ * You should ensure that the type with name doesn't appear in
-+ * csymbol table before calling.
-+ */
-+struct cp_ctype *ctype_lookup_builtin_type(char *name)
-+{
-+ struct cp_ctype ct;
-+
-+ if (!strncmp(name, "void", sizeof("void"))) {
-+ init_builtin_type(&ct, FFI_VOID);
-+ return cp_ctype_reg_type("void", &ct);
-+ } else if (!strncmp(name, "int8_t", sizeof("int8_t"))) {
-+ init_builtin_type(&ct, FFI_INT8);
-+ return cp_ctype_reg_type("int8_t", &ct);
-+ } else if (!strncmp(name, "uint8_t", sizeof("uint8_t"))) {
-+ init_builtin_type(&ct, FFI_UINT8);
-+ return cp_ctype_reg_type("uint8_t", &ct);
-+ } else if (!strncmp(name, "int16_t", sizeof("int16_t"))) {
-+ init_builtin_type(&ct, FFI_INT16);
-+ return cp_ctype_reg_type("int16_t", &ct);
-+ } else if (!strncmp(name, "uint16_t", sizeof("uint16_t"))) {
-+ init_builtin_type(&ct, FFI_UINT16);
-+ return cp_ctype_reg_type("uint16_t", &ct);
-+ } else if (!strncmp(name, "int32_t", sizeof("int32_t"))) {
-+ init_builtin_type(&ct, FFI_INT32);
-+ return cp_ctype_reg_type("int32_t", &ct);
-+ } else if (!strncmp(name, "uint32_t", sizeof("uint32_t"))) {
-+ init_builtin_type(&ct, FFI_UINT32);
-+ return cp_ctype_reg_type("uint32_t", &ct);
-+ } else if (!strncmp(name, "int64_t", sizeof("int64_t"))) {
-+ init_builtin_type(&ct, FFI_INT64);
-+ return cp_ctype_reg_type("int64_t", &ct);
-+ } else if (!strncmp(name, "uint64_t", sizeof("uint64_t"))) {
-+ init_builtin_type(&ct, FFI_UINT64);
-+ return cp_ctype_reg_type("uint64_t", &ct);
-+ } else {
-+ /* no builtin type matched */
-+ return NULL;
-+ }
-+}
-+
-+/* start ctype reg table */
-+struct cp_ctype *ctype_lookup_type(char *name)
-+{
-+ int i;
-+ struct cp_ctype *ct;
-+
-+ for (i = 0; i < cte_nr; i++) {
-+ ct = &cte_arr[i].ct;
-+ if (!strcmp(name, cte_arr[i].name))
-+ return ct;
-+ }
-+
-+ /* see if it's a builtin C type
-+ * return NULL if still no match */
-+ return ctype_lookup_builtin_type(name);
-+}
-+
-+cp_csymbol_state *ctype_get_csym_state(void)
-+{
-+ return &csym_state;
-+}
-+
-+#define DEFAULT_STACK_SIZE 20
-+#define DEFAULT_SYM_ARR_SIZE 20
-+int cp_ctype_init()
-+{
-+ cts.size = DEFAULT_STACK_SIZE;
-+ cts.top = 0;
-+ cts.stack = malloc(sizeof(cp_ctype_entry)*DEFAULT_STACK_SIZE);
-+
-+ cs_nr = 0;
-+ cs_arr_size = DEFAULT_SYM_ARR_SIZE;
-+ cs_arr = malloc(sizeof(csymbol)*DEFAULT_SYM_ARR_SIZE);
-+ memset(cs_arr, 0, sizeof(csymbol)*DEFAULT_SYM_ARR_SIZE);
-+
-+ cte_nr = 0;
-+ cte_arr_size = DEFAULT_CTYPE_ARR_SIZE;
-+ cte_arr = malloc(sizeof(cp_ctype_entry)*DEFAULT_CTYPE_ARR_SIZE);
-+
-+ return 0;
-+}
-+
-+int cp_ctype_free()
-+{
-+ int i;
-+ csymbol *cs;
-+
-+ if (cts.stack)
-+ free(cts.stack);
-+
-+ if (cs_arr) {
-+ for (i = 0; i < cs_nr; i++) {
-+ cs = &cs_arr[i];
-+ if (csym_type(cs) == FFI_FUNC) {
-+ if (csym_func(cs)->arg_ids)
-+ free(csym_func(cs)->arg_ids);
-+ } else if (csym_type(cs) == FFI_STRUCT) {
-+ if (csym_struct(cs)->members)
-+ free(csym_struct(cs)->members);
-+ }
-+ }
-+ free(cs_arr);
-+ }
-+
-+ if (cte_arr) {
-+ free(cte_arr);
-+ }
-+
-+ return 0;
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/ktapc.h
-@@ -0,0 +1,393 @@
-+/*
-+ * ktapc.h
-+ * only can be included by userspace compiler
-+ */
-+
-+#include <ctype.h>
-+
-+typedef int bool;
-+#define false 0
-+#define true 1
-+
-+#define MAX_INT ((int)(~0U>>1))
-+#define UCHAR_MAX 255
-+
-+#define MAX_SIZET ((size_t)(~(size_t)0)-2)
-+
-+#define KTAP_ERRSYNTAX 3
-+
-+/*
-+ * KTAP_IDSIZE gives the maximum size for the description of the source
-+ * of a function in debug information.
-+ * CHANGE it if you want a different size.
-+ */
-+#define KTAP_IDSIZE 60
-+
-+
-+#define FIRST_RESERVED 257
-+
-+/*
-+ * maximum depth for nested C calls and syntactical nested non-terminals
-+ * in a program. (Value must fit in an unsigned short int.)
-+ */
-+#define KTAP_MAXCCALLS 200
-+
-+#define KTAP_MULTRET (-1)
-+
-+
-+#define SHRT_MAX UCHAR_MAX
-+
-+#define MAXUPVAL UCHAR_MAX
-+
-+
-+/* maximum stack for a ktap function */
-+#define MAXSTACK 250
-+
-+#define islalpha(c) (isalpha(c) || (c) == '_')
-+#define islalnum(c) (isalnum(c) || (c) == '_')
-+
-+#define isreserved(s) ((s)->tsv.tt == KTAP_TSHRSTR && (s)->tsv.extra > 0)
-+
-+#define ktap_numeq(a,b) ((a)==(b))
-+#define ktap_numisnan(L,a) (!ktap_numeq((a), (a)))
-+
-+#define ktap_numunm(a) (-(a))
-+
-+/*
-+ * ** Comparison and arithmetic functions
-+ * */
-+
-+#define KTAP_OPADD 0 /* ORDER TM */
-+#define KTAP_OPSUB 1
-+#define KTAP_OPMUL 2
-+#define KTAP_OPDIV 3
-+#define KTAP_OPMOD 4
-+#define KTAP_OPPOW 5
-+#define KTAP_OPUNM 6
-+
-+#define KTAP_OPEQ 0
-+#define KTAP_OPLT 1
-+#define KTAP_OPLE 2
-+
-+
-+/*
-+ * WARNING: if you change the order of this enumeration,
-+ * grep "ORDER RESERVED"
-+ */
-+enum RESERVED {
-+ /* terminal symbols denoted by reserved words */
-+ TK_TRACE = FIRST_RESERVED, TK_TRACE_END,
-+ TK_ARGEVENT, TK_ARGNAME,
-+ TK_FFI_CDEF,
-+ TK_ARG1, TK_ARG2, TK_ARG3, TK_ARG4, TK_ARG5, TK_ARG6, TK_ARG7, TK_ARG8,
-+ TK_ARG9, TK_PROFILE, TK_TICK, TK_AGGR_ASSIGN,
-+ TK_AND, TK_BREAK,
-+ TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
-+ TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
-+ TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
-+ /* other terminal symbols */
-+ TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_INCR, TK_DBCOLON,
-+ TK_EOS, TK_NUMBER, TK_NAME, TK_STRING, TK_KSYM
-+};
-+
-+/* number of reserved words */
-+#define NUM_RESERVED ((int)(TK_WHILE-FIRST_RESERVED + 1))
-+
-+#define EOZ (0) /* end of stream */
-+
-+typedef union {
-+ ktap_number r;
-+ ktap_string *ts;
-+} ktap_seminfo; /* semantics information */
-+
-+
-+typedef struct ktap_token {
-+ int token;
-+ ktap_seminfo seminfo;
-+} ktap_token;
-+
-+typedef struct ktap_mbuffer {
-+ char *buffer;
-+ size_t n;
-+ size_t buffsize;
-+} ktap_mbuffer;
-+
-+#define mbuff_init(buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)
-+#define mbuff(buff) ((buff)->buffer)
-+#define mbuff_reset(buff) ((buff)->n = 0, memset((buff)->buffer, 0, (buff)->buffsize))
-+#define mbuff_len(buff) ((buff)->n)
-+#define mbuff_size(buff) ((buff)->buffsize)
-+
-+#define mbuff_resize(buff, size) \
-+ (ktapc_realloc((buff)->buffer, (buff)->buffsize, size, char), \
-+ (buff)->buffsize = size)
-+
-+#define mbuff_free(buff) mbuff_resize(buff, 0)
-+
-+
-+/*
-+ * state of the lexer plus state of the parser when shared by all
-+ * functions
-+ */
-+typedef struct ktap_lexstate {
-+ char *ptr; /* source file reading position */
-+ int current; /* current character (charint) */
-+ int linenumber; /* input line counter */
-+ int lastline; /* line of last token `consumed' */
-+ ktap_token t; /* current token */
-+ ktap_token lookahead; /* look ahead token */
-+ struct ktap_funcstate *fs; /* current function (parser) */
-+ ktap_mbuffer *buff; /* buffer for tokens */
-+ struct ktap_dyndata *dyd; /* dynamic structures used by the parser */
-+ ktap_string *source; /* current source name */
-+ ktap_string *envn; /* environment variable name */
-+ char decpoint; /* locale decimal point */
-+ int nCcalls;
-+} ktap_lexstate;
-+
-+
-+/*
-+ * Expression descriptor
-+ */
-+typedef enum {
-+ VVOID, /* no value */
-+ VNIL,
-+ VTRUE,
-+ VFALSE,
-+ VK, /* info = index of constant in `k' */
-+ VKNUM, /* nval = numerical value */
-+ VNONRELOC, /* info = result register */
-+ VLOCAL, /* info = local register */
-+ VUPVAL, /* info = index of upvalue in 'upvalues' */
-+ VINDEXED, /* t = table register/upvalue; idx = index R/K */
-+ VJMP, /* info = instruction pc */
-+ VRELOCABLE, /* info = instruction pc */
-+ VCALL, /* info = instruction pc */
-+ VVARARG, /* info = instruction pc */
-+ VEVENT,
-+ VEVENTNAME,
-+ VEVENTARG,
-+} expkind;
-+
-+
-+#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED)
-+#define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL)
-+
-+typedef struct ktap_expdesc {
-+ expkind k;
-+ union {
-+ struct { /* for indexed variables (VINDEXED) */
-+ short idx; /* index (R/K) */
-+ u8 t; /* table (register or upvalue) */
-+ u8 vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */
-+ } ind;
-+ int info; /* for generic use */
-+ ktap_number nval; /* for VKNUM */
-+ } u;
-+ int t; /* patch list of `exit when true' */
-+ int f; /* patch list of `exit when false' */
-+} ktap_expdesc;
-+
-+
-+typedef struct ktap_vardesc {
-+ short idx; /* variable index in stack */
-+} ktap_vardesc;
-+
-+
-+/* description of pending goto statements and label statements */
-+typedef struct ktap_labeldesc {
-+ ktap_string *name; /* label identifier */
-+ int pc; /* position in code */
-+ int line; /* line where it appeared */
-+ u8 nactvar; /* local level where it appears in current block */
-+} ktap_labeldesc;
-+
-+
-+/* list of labels or gotos */
-+typedef struct ktap_labellist {
-+ ktap_labeldesc *arr; /* array */
-+ int n; /* number of entries in use */
-+ int size; /* array size */
-+} ktap_labellist;
-+
-+
-+/* dynamic structures used by the parser */
-+typedef struct ktap_dyndata {
-+ struct { /* list of active local variables */
-+ ktap_vardesc *arr;
-+ int n;
-+ int size;
-+ } actvar;
-+ ktap_labellist gt; /* list of pending gotos */
-+ ktap_labellist label; /* list of active labels */
-+} ktap_dyndata;
-+
-+
-+/* control of blocks */
-+struct ktap_blockcnt; /* defined in lparser.c */
-+
-+
-+/* state needed to generate code for a given function */
-+typedef struct ktap_funcstate {
-+ ktap_proto *f; /* current function header */
-+ ktap_tab *h; /* table to find (and reuse) elements in `k' */
-+ struct ktap_funcstate *prev; /* enclosing function */
-+ struct ktap_lexstate *ls; /* lexical state */
-+ struct ktap_blockcnt *bl; /* chain of current blocks */
-+ int pc; /* next position to code (equivalent to `ncode') */
-+ int lasttarget; /* 'label' of last 'jump label' */
-+ int jpc; /* list of pending jumps to `pc' */
-+ int nk; /* number of elements in `k' */
-+ int np; /* number of elements in `p' */
-+ int firstlocal; /* index of first local var (in ktap_dyndata array) */
-+ short nlocvars; /* number of elements in 'f->locvars' */
-+ u8 nactvar; /* number of active local variables */
-+ u8 nups; /* number of upvalues */
-+ u8 freereg; /* first free register */
-+} ktap_funcstate;
-+
-+
-+/*
-+ * Marks the end of a patch list. It is an invalid value both as an absolute
-+ * address, and as a list link (would link an element to itself).
-+ */
-+#define NO_JUMP (-1)
-+
-+
-+/*
-+ * grep "ORDER OPR" if you change these enums (ORDER OP)
-+ */
-+typedef enum BinOpr {
-+ OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW,
-+ OPR_CONCAT,
-+ OPR_EQ, OPR_LT, OPR_LE,
-+ OPR_NE, OPR_GT, OPR_GE,
-+ OPR_AND, OPR_OR,
-+ OPR_NOBINOPR
-+} BinOpr;
-+
-+
-+typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
-+
-+
-+#define getcode(fs,e) ((fs)->f->code[(e)->u.info])
-+
-+#define codegen_codeAsBx(fs,o,A,sBx) codegen_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
-+
-+#define codegen_setmultret(fs,e) codegen_setreturns(fs, e, KTAP_MULTRET)
-+
-+#define codegen_jumpto(fs,t) codegen_patchlist(fs, codegen_jump(fs), t)
-+
-+
-+#define ktapc_realloc(v, osize, nsize, t) \
-+ ((v) = (t *)ktapc_reallocv(v, osize * sizeof(t), nsize * sizeof(t)))
-+
-+#define ktapc_reallocvector(v,oldn,n,t) ktapc_realloc(v,oldn,n,t)
-+
-+
-+#define ktapc_growvector(v,nelems,size,t,limit,e) \
-+ if ((nelems)+1 > (size)) \
-+ ((v)=(t *)ktapc_growaux(v,&(size),sizeof(t),limit,e))
-+
-+
-+void lex_init();
-+ktap_string *lex_newstring(ktap_lexstate *ls, const char *str, size_t l);
-+const char *lex_token2str(ktap_lexstate *ls, int token);
-+void lex_syntaxerror(ktap_lexstate *ls, const char *msg);
-+void lex_setinput(ktap_lexstate *ls, char *ptr, ktap_string *source, int firstchar);
-+void lex_next(ktap_lexstate *ls);
-+int lex_lookahead(ktap_lexstate *ls);
-+void lex_read_string_until(ktap_lexstate *ls, int c);
-+ktap_closure *ktapc_parser(char *pos, const char *name);
-+ktap_string *ktapc_ts_new(const char *str);
-+int ktapc_ts_eqstr(ktap_string *a, ktap_string *b);
-+ktap_string *ktapc_ts_newlstr(const char *str, size_t l);
-+ktap_proto *ktapc_newproto();
-+ktap_tab *ktapc_table_new();
-+const ktap_value *ktapc_table_get(ktap_tab *t, const ktap_value *key);
-+void ktapc_table_setvalue(ktap_tab *t, const ktap_value *key, ktap_value *val);
-+ktap_closure *ktapc_newclosure(int n);
-+char *ktapc_sprintf(const char *fmt, ...);
-+
-+void *ktapc_reallocv(void *block, size_t osize, size_t nsize);
-+void *ktapc_growaux(void *block, int *size, size_t size_elems, int limit,
-+ const char *what);
-+
-+void ktapio_exit(void);
-+int ktapio_create(const char *output_filename);
-+
-+ktap_eventdef_info *ktapc_parse_eventdef(const char *eventdef);
-+void cleanup_event_resources(void);
-+
-+extern int verbose;
-+#define verbose_printf(...) \
-+ if (verbose) \
-+ printf("[verbose] " __VA_ARGS__);
-+
-+#define ktapc_equalobj(t1, t2) kp_equalobjv(NULL, t1, t2)
-+
-+int codegen_stringK(ktap_funcstate *fs, ktap_string *s);
-+void codegen_indexed(ktap_funcstate *fs, ktap_expdesc *t, ktap_expdesc *k);
-+void codegen_setreturns(ktap_funcstate *fs, ktap_expdesc *e, int nresults);
-+void codegen_reserveregs(ktap_funcstate *fs, int n);
-+void codegen_exp2nextreg(ktap_funcstate *fs, ktap_expdesc *e);
-+void codegen_nil(ktap_funcstate *fs, int from, int n);
-+void codegen_patchlist(ktap_funcstate *fs, int list, int target);
-+void codegen_patchclose(ktap_funcstate *fs, int list, int level);
-+int codegen_jump(ktap_funcstate *fs);
-+void codegen_patchtohere(ktap_funcstate *fs, int list);
-+int codegen_codeABx(ktap_funcstate *fs, OpCode o, int a, unsigned int bc);
-+void codegen_ret(ktap_funcstate *fs, int first, int nret);
-+void codegen_exp2anyregup(ktap_funcstate *fs, ktap_expdesc *e);
-+void codegen_exp2val(ktap_funcstate *fs, ktap_expdesc *e);
-+int codegen_exp2RK(ktap_funcstate *fs, ktap_expdesc *e);
-+int codegen_codeABC(ktap_funcstate *fs, OpCode o, int a, int b, int c);
-+void codegen_setlist(ktap_funcstate *fs, int base, int nelems, int tostore);
-+void codegen_fixline (ktap_funcstate *fs, int line);
-+void codegen_dischargevars(ktap_funcstate *fs, ktap_expdesc *e);
-+void codegen_self(ktap_funcstate *fs, ktap_expdesc *e, ktap_expdesc *key);
-+void codegen_prefix(ktap_funcstate *fs, UnOpr op, ktap_expdesc *e, int line);
-+void codegen_infix(ktap_funcstate *fs, BinOpr op, ktap_expdesc *v);
-+void codegen_posfix(ktap_funcstate *fs, BinOpr op, ktap_expdesc *e1, ktap_expdesc *e2, int line);
-+void codegen_setoneret(ktap_funcstate *fs, ktap_expdesc *e);
-+void codegen_storevar(ktap_funcstate *fs, ktap_expdesc *var, ktap_expdesc *ex);
-+void codegen_storeincr(ktap_funcstate *fs, ktap_expdesc *var, ktap_expdesc *ex);
-+void codegen_store_aggr(ktap_funcstate *fs, ktap_expdesc *var,
-+ ktap_expdesc *ex);
-+void codegen_goiftrue(ktap_funcstate *fs, ktap_expdesc *e);
-+int codegen_getlabel(ktap_funcstate *fs);
-+int codegen_codek(ktap_funcstate *fs, int reg, int k);
-+int codegen_numberK(ktap_funcstate *fs, ktap_number r);
-+void codegen_checkstack(ktap_funcstate *fs, int n);
-+void codegen_goiffalse(ktap_funcstate *fs, ktap_expdesc *e);
-+void codegen_concat(ktap_funcstate *fs, int *l1, int l2);
-+int codegen_exp2anyreg(ktap_funcstate *fs, ktap_expdesc *e);
-+
-+typedef int (*ktap_writer)(const void* p, size_t sz, void* ud);
-+int ktapc_dump(const ktap_proto *f, ktap_writer w, void *data, int strip);
-+
-+void ktapc_chunkid(char *out, const char *source, size_t bufflen);
-+int ktapc_str2d(const char *s, size_t len, ktap_number *result);
-+int ktapc_hexavalue(int c);
-+ktap_number ktapc_arith(int op, ktap_number v1, ktap_number v2);
-+int ktapc_int2fb(unsigned int x);
-+bool strglobmatch(const char *str, const char *pat);
-+int kallsyms_parse(void *arg,
-+ int(*process_symbol)(void *arg, const char *name,
-+ char type, unsigned long start));
-+
-+unsigned long find_kernel_symbol(const char *symbol);
-+void list_available_events(const char *match);
-+
-+
-+#ifdef CONFIG_KTAP_FFI
-+#include "../include/ktap_ffi.h"
-+
-+typedef struct cp_csymbol_state {
-+ int cs_nr; /* number of c symbols */
-+ int cs_arr_size; /* size of current symbol arrays */
-+ csymbol *cs_arr;
-+} cp_csymbol_state;
-+
-+cp_csymbol_state *ctype_get_csym_state(void);
-+#endif
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/ktapio.c
-@@ -0,0 +1,106 @@
-+/*
-+ * ktapio.c - ring buffer transport in userspace
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <unistd.h>
-+#include <sys/mman.h>
-+#include <sys/stat.h>
-+#include <sys/poll.h>
-+#include <sys/signal.h>
-+#include <fcntl.h>
-+#include <pthread.h>
-+
-+#define MAX_BUFLEN 131072
-+#define PATH_MAX 128
-+
-+#define handle_error(str) do { perror(str); exit(-1); } while(0)
-+
-+void sigfunc(int signo)
-+{
-+ /* should not not reach here */
-+}
-+
-+static void block_sigint()
-+{
-+ sigset_t mask;
-+
-+ sigemptyset(&mask);
-+ sigaddset(&mask, SIGINT);
-+
-+ pthread_sigmask(SIG_BLOCK, &mask, NULL);
-+}
-+
-+static void *reader_thread(void *data)
-+{
-+ char buf[MAX_BUFLEN];
-+ char filename[PATH_MAX];
-+ const char *output = data;
-+ int failed = 0, fd, out_fd, len;
-+
-+ block_sigint();
-+
-+ if (output) {
-+ out_fd = open(output, O_CREAT | O_WRONLY | O_TRUNC,
-+ S_IRUSR|S_IWUSR);
-+ if (out_fd < 0) {
-+ fprintf(stderr, "Cannot open output file %s\n", output);
-+ return NULL;
-+ }
-+ } else
-+ out_fd = 2;
-+
-+ sprintf(filename, "/sys/kernel/debug/ktap/trace_pipe_%d", getpid());
-+
-+ open_again:
-+ fd = open(filename, O_RDONLY);
-+ if (fd < 0) {
-+ usleep(10000);
-+
-+ if (failed++ == 10) {
-+ fprintf(stderr, "Cannot open file %s\n", filename);
-+ return NULL;
-+ }
-+ goto open_again;
-+ }
-+
-+ while ((len = read(fd, buf, sizeof(buf))) > 0)
-+ write(out_fd, buf, len);
-+
-+ close(fd);
-+ close(out_fd);
-+
-+ return NULL;
-+}
-+
-+int ktapio_create(const char *output)
-+{
-+ pthread_t reader;
-+
-+ signal(SIGINT, sigfunc);
-+
-+ if (pthread_create(&reader, NULL, reader_thread, (void *)output) < 0)
-+ handle_error("pthread_create reader_thread failed\n");
-+
-+ return 0;
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/lex.c
-@@ -0,0 +1,632 @@
-+/*
-+ * lex.c - ktap lexical analyzer
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <locale.h>
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_opcodes.h"
-+#include "ktapc.h"
-+
-+#define next(ls) (ls->current = *ls->ptr++)
-+
-+#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r')
-+
-+#define KTAP_MINBUFFER 32
-+
-+/* ORDER RESERVED */
-+static const char *const ktap_tokens [] = {
-+ "trace", "trace_end", "argevent", "argname", "cdef",
-+ "arg1", "arg2", "arg3", "arg4", "arg5", "arg6", "arg7", "arg9", "arg9",
-+ "profile", "tick", "<<<",
-+ "and", "break", "do", "else", "elseif",
-+ "end", "false", "for", "function", "goto", "if",
-+ "in", "local", "nil", "not", "or", "repeat",
-+ "return", "then", "true", "until", "while",
-+ "..", "...", "==", ">=", "<=", "!=", "+=", "::", "<eof>",
-+ "<number>", "<name>", "<string>", "<symbol>"
-+};
-+
-+#define save_and_next(ls) (save(ls, ls->current), next(ls))
-+
-+static void lexerror(ktap_lexstate *ls, const char *msg, int token);
-+
-+static void save(ktap_lexstate *ls, int c)
-+{
-+ ktap_mbuffer *b = ls->buff;
-+ if (mbuff_len(b) + 1 > mbuff_size(b)) {
-+ size_t newsize;
-+ if (mbuff_size(b) >= MAX_SIZET / 2)
-+ lexerror(ls, "lexical element too long", 0);
-+ newsize = mbuff_size(b) * 2;
-+ mbuff_resize(b, newsize);
-+ }
-+ b->buffer[mbuff_len(b)++] = (char)c;
-+}
-+
-+void lex_init()
-+{
-+ int i;
-+ for (i = 0; i < NUM_RESERVED; i++) {
-+ ktap_string *ts = ktapc_ts_new(ktap_tokens[i]);
-+ ts->tsv.extra = (u8)(i+1); /* reserved word */
-+ }
-+}
-+
-+const char *lex_token2str(ktap_lexstate *ls, int token)
-+{
-+ if (token < FIRST_RESERVED) {
-+ ktap_assert(token == (unsigned char)token);
-+ return (isprint(token)) ? ktapc_sprintf(KTAP_QL("%c"), token) :
-+ ktapc_sprintf("char(%d)", token);
-+ } else {
-+ const char *s = ktap_tokens[token - FIRST_RESERVED];
-+ if (token < TK_EOS)
-+ return ktapc_sprintf(KTAP_QS, s);
-+ else
-+ return s;
-+ }
-+}
-+
-+static const char *txtToken(ktap_lexstate *ls, int token)
-+{
-+ switch (token) {
-+ case TK_NAME:
-+ case TK_STRING:
-+ case TK_NUMBER:
-+ save(ls, '\0');
-+ return ktapc_sprintf(KTAP_QS, mbuff(ls->buff));
-+ default:
-+ return lex_token2str(ls, token);
-+ }
-+}
-+
-+static void lexerror(ktap_lexstate *ls, const char *msg, int token)
-+{
-+ char buff[KTAP_IDSIZE];
-+ char *newmsg;
-+
-+ ktapc_chunkid(buff, getstr(ls->source), KTAP_IDSIZE);
-+ newmsg = ktapc_sprintf("%s:%d: %s", buff, ls->linenumber, msg);
-+ if (token)
-+ newmsg = ktapc_sprintf("%s near %s", newmsg, txtToken(ls, token));
-+ printf("lexerror: %s\n", newmsg);
-+ exit(EXIT_FAILURE);
-+}
-+
-+void lex_syntaxerror(ktap_lexstate *ls, const char *msg)
-+{
-+ lexerror(ls, msg, ls->t.token);
-+}
-+
-+/*
-+ * creates a new string and anchors it in function's table so that
-+ * it will not be collected until the end of the function's compilation
-+ * (by that time it should be anchored in function's prototype)
-+ */
-+ktap_string *lex_newstring(ktap_lexstate *ls, const char *str, size_t l)
-+{
-+ const ktap_value *o; /* entry for `str' */
-+ ktap_value val; /* entry for `str' */
-+ ktap_value tsv;
-+ ktap_string *ts = ktapc_ts_newlstr(str, l); /* create new string */
-+ set_string(&tsv, ts);
-+ o = ktapc_table_get(ls->fs->h, &tsv);
-+ if (is_nil(o)) { /* not in use yet? (see 'addK') */
-+ /* boolean value does not need GC barrier;
-+ table has no metatable, so it does not need to invalidate cache */
-+ set_boolean(&val, 1); /* t[string] = true */
-+ ktapc_table_setvalue(ls->fs->h, &tsv, &val);
-+ }
-+ return ts;
-+}
-+
-+/*
-+ * increment line number and skips newline sequence (any of
-+ * \n, \r, \n\r, or \r\n)
-+ */
-+static void inclinenumber(ktap_lexstate *ls)
-+{
-+ int old = ls->current;
-+ ktap_assert(currIsNewline(ls));
-+ next(ls); /* skip `\n' or `\r' */
-+ if (currIsNewline(ls) && ls->current != old)
-+ next(ls); /* skip `\n\r' or `\r\n' */
-+ if (++ls->linenumber >= MAX_INT)
-+ lex_syntaxerror(ls, "chunk has too many lines");
-+}
-+
-+void lex_setinput(ktap_lexstate *ls, char *ptr, ktap_string *source, int firstchar)
-+{
-+ ls->decpoint = '.';
-+ ls->current = firstchar;
-+ ls->lookahead.token = TK_EOS; /* no look-ahead token */
-+ ls->ptr = ptr;
-+ ls->fs = NULL;
-+ ls->linenumber = 1;
-+ ls->lastline = 1;
-+ ls->source = source;
-+ ls->envn = ktapc_ts_new(KTAP_ENV); /* create env name */
-+ mbuff_resize(ls->buff, KTAP_MINBUFFER); /* initialize buffer */
-+}
-+
-+/*
-+ * =======================================================
-+ * LEXICAL ANALYZER
-+ * =======================================================
-+ */
-+static int check_next(ktap_lexstate *ls, const char *set)
-+{
-+ if (ls->current == '\0' || !strchr(set, ls->current))
-+ return 0;
-+ save_and_next(ls);
-+ return 1;
-+}
-+
-+/*
-+ * change all characters 'from' in buffer to 'to'
-+ */
-+static void buffreplace(ktap_lexstate *ls, char from, char to)
-+{
-+ size_t n = mbuff_len(ls->buff);
-+ char *p = mbuff(ls->buff);
-+ while (n--)
-+ if (p[n] == from) p[n] = to;
-+}
-+
-+#if !defined(getlocaledecpoint)
-+#define getlocaledecpoint() (localeconv()->decimal_point[0])
-+#endif
-+
-+#define mbuff2d(b,e) ktapc_str2d(mbuff(b), mbuff_len(b) - 1, e)
-+
-+/*
-+ * in case of format error, try to change decimal point separator to
-+ * the one defined in the current locale and check again
-+ */
-+static void trydecpoint(ktap_lexstate *ls, ktap_seminfo *seminfo)
-+{
-+ char old = ls->decpoint;
-+ ls->decpoint = getlocaledecpoint();
-+ buffreplace(ls, old, ls->decpoint); /* try new decimal separator */
-+ if (!mbuff2d(ls->buff, &seminfo->r)) {
-+ /* format error with correct decimal point: no more options */
-+ buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */
-+ lexerror(ls, "malformed number", TK_NUMBER);
-+ }
-+}
-+
-+/*
-+ * this function is quite liberal in what it accepts, as 'ktapc_str2d'
-+ * will reject ill-formed numerals.
-+ */
-+static void read_numeral(ktap_lexstate *ls, ktap_seminfo *seminfo)
-+{
-+ const char *expo = "Ee";
-+ int first = ls->current;
-+
-+ ktap_assert(isdigit(ls->current));
-+ save_and_next(ls);
-+ if (first == '0' && check_next(ls, "Xx")) /* hexadecimal? */
-+ expo = "Pp";
-+ for (;;) {
-+ if (check_next(ls, expo)) /* exponent part? */
-+ check_next(ls, "+-"); /* optional exponent sign */
-+ if (isxdigit(ls->current) || ls->current == '.')
-+ save_and_next(ls);
-+ else
-+ break;
-+ }
-+ save(ls, '\0');
-+ buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
-+ if (!mbuff2d(ls->buff, &seminfo->r)) /* format error? */
-+ trydecpoint(ls, seminfo); /* try to update decimal point separator */
-+}
-+
-+/*
-+ * skip a sequence '[=*[' or ']=*]' and return its number of '='s or
-+ * -1 if sequence is malformed
-+ */
-+static int skip_sep(ktap_lexstate *ls)
-+{
-+ int count = 0;
-+ int s = ls->current;
-+
-+ ktap_assert(s == '[' || s == ']');
-+ save_and_next(ls);
-+ while (ls->current == '=') {
-+ save_and_next(ls);
-+ count++;
-+ }
-+ return (ls->current == s) ? count : (-count) - 1;
-+}
-+
-+static void read_long_string(ktap_lexstate *ls, ktap_seminfo *seminfo, int sep)
-+{
-+ save_and_next(ls); /* skip 2nd `[' */
-+ if (currIsNewline(ls)) /* string starts with a newline? */
-+ inclinenumber(ls); /* skip it */
-+ for (;;) {
-+ switch (ls->current) {
-+ case EOZ:
-+ lexerror(ls, (seminfo) ? "unfinished long string" :
-+ "unfinished long comment", TK_EOS);
-+ break; /* to avoid warnings */
-+ case ']': {
-+ if (skip_sep(ls) == sep) {
-+ save_and_next(ls); /* skip 2nd `]' */
-+ goto endloop;
-+ }
-+ break;
-+ }
-+ case '\n':
-+ case '\r': {
-+ save(ls, '\n');
-+ inclinenumber(ls);
-+ /* avoid wasting space */
-+ if (!seminfo)
-+ mbuff_reset(ls->buff);
-+ break;
-+ }
-+ default: {
-+ if (seminfo)
-+ save_and_next(ls);
-+ else
-+ next(ls);
-+ }
-+ }
-+ }
-+
-+ endloop:
-+ if (seminfo)
-+ seminfo->ts = lex_newstring(ls, mbuff(ls->buff) + (2 + sep),
-+ mbuff_len(ls->buff) - 2*(2 + sep));
-+}
-+
-+static void escerror(ktap_lexstate *ls, int *c, int n, const char *msg)
-+{
-+ int i;
-+ mbuff_reset(ls->buff); /* prepare error message */
-+ save(ls, '\\');
-+ for (i = 0; i < n && c[i] != EOZ; i++)
-+ save(ls, c[i]);
-+ lexerror(ls, msg, TK_STRING);
-+}
-+
-+static int readhexaesc(ktap_lexstate *ls)
-+{
-+ int c[3], i; /* keep input for error message */
-+ int r = 0; /* result accumulator */
-+ c[0] = 'x'; /* for error message */
-+ for (i = 1; i < 3; i++) { /* read two hexa digits */
-+ c[i] = next(ls);
-+ if (!isxdigit(c[i]))
-+ escerror(ls, c, i + 1, "hexadecimal digit expected");
-+ r = (r << 4) + ktapc_hexavalue(c[i]);
-+ }
-+ return r;
-+}
-+
-+static int readdecesc(ktap_lexstate *ls)
-+{
-+ int c[3], i;
-+ int r = 0; /* result accumulator */
-+ for (i = 0; i < 3 && isdigit(ls->current); i++) { /* read up to 3 digits */
-+ c[i] = ls->current;
-+ r = 10*r + c[i] - '0';
-+ next(ls);
-+ }
-+ if (r > UCHAR_MAX)
-+ escerror(ls, c, i, "decimal escape too large");
-+ return r;
-+}
-+
-+static void read_string(ktap_lexstate *ls, int del, ktap_seminfo *seminfo)
-+{
-+ save_and_next(ls); /* keep delimiter (for error messages) */
-+ while (ls->current != del) {
-+ switch (ls->current) {
-+ case EOZ:
-+ lexerror(ls, "unfinished string", TK_EOS);
-+ break; /* to avoid warnings */
-+ case '\n':
-+ case '\r':
-+ lexerror(ls, "unfinished string", TK_STRING);
-+ break; /* to avoid warnings */
-+ case '\\': { /* escape sequences */
-+ int c; /* final character to be saved */
-+ next(ls); /* do not save the `\' */
-+ switch (ls->current) {
-+ case 'a': c = '\a'; goto read_save;
-+ case 'b': c = '\b'; goto read_save;
-+ case 'f': c = '\f'; goto read_save;
-+ case 'n': c = '\n'; goto read_save;
-+ case 'r': c = '\r'; goto read_save;
-+ case 't': c = '\t'; goto read_save;
-+ case 'v': c = '\v'; goto read_save;
-+ case 'x': c = readhexaesc(ls); goto read_save;
-+ case '\n': case '\r':
-+ inclinenumber(ls); c = '\n'; goto only_save;
-+ case '\\': case '\"': case '\'':
-+ c = ls->current; goto read_save;
-+ case EOZ: goto no_save; /* will raise an error next loop */
-+ case 'z': { /* zap following span of spaces */
-+ next(ls); /* skip the 'z' */
-+ while (isspace(ls->current)) {
-+ if (currIsNewline(ls))
-+ inclinenumber(ls);
-+ else
-+ next(ls);
-+ }
-+ goto no_save;
-+ }
-+ default: {
-+ if (!isdigit(ls->current))
-+ escerror(ls, &ls->current, 1, "invalid escape sequence");
-+ /* digital escape \ddd */
-+ c = readdecesc(ls);
-+ goto only_save;
-+ }
-+ }
-+ read_save:
-+ next(ls); /* read next character */
-+ only_save:
-+ save(ls, c); /* save 'c' */
-+ no_save:
-+ break;
-+ }
-+ default:
-+ save_and_next(ls);
-+ }
-+ }
-+ save_and_next(ls); /* skip delimiter */
-+ seminfo->ts = lex_newstring(ls, mbuff(ls->buff) + 1, mbuff_len(ls->buff) - 2);
-+}
-+
-+static int llex(ktap_lexstate *ls, ktap_seminfo *seminfo)
-+{
-+ mbuff_reset(ls->buff);
-+
-+ for (;;) {
-+ switch (ls->current) {
-+ case '\n': case '\r': { /* line breaks */
-+ inclinenumber(ls);
-+ break;
-+ }
-+ case ' ': case '\f': case '\t': case '\v': { /* spaces */
-+ next(ls);
-+ break;
-+ }
-+ case '#': {
-+ while (!currIsNewline(ls) && ls->current != EOZ)
-+ next(ls); /* skip until end of line (or end of file) */
-+ break;
-+ }
-+ #if 0
-+ case '-': { /* '-' or '--' (comment) */
-+ next(ls);
-+ if (ls->current != '-')
-+ return '-';
-+ /* else is a comment */
-+ next(ls);
-+ if (ls->current == '[') { /* long comment? */
-+ int sep = skip_sep(ls);
-+ mbuff_reset(ls->buff); /* `skip_sep' may dirty the buffer */
-+ if (sep >= 0) {
-+ read_long_string(ls, NULL, sep); /* skip long comment */
-+ mbuff_reset(ls->buff); /* previous call may dirty the buff. */
-+ break;
-+ }
-+ }
-+ /* else short comment */
-+ while (!currIsNewline(ls) && ls->current != EOZ)
-+ next(ls); /* skip until end of line (or end of file) */
-+ break;
-+ }
-+ #endif
-+ case '[': { /* long string or simply '[' */
-+ int sep = skip_sep(ls);
-+ if (sep >= 0) {
-+ read_long_string(ls, seminfo, sep);
-+ return TK_STRING;
-+ }
-+ else if (sep == -1)
-+ return '[';
-+ else
-+ lexerror(ls, "invalid long string delimiter", TK_STRING);
-+ }
-+ case '+': {
-+ next(ls);
-+ if (ls->current != '=')
-+ return '+';
-+ else {
-+ next(ls);
-+ return TK_INCR;
-+ }
-+ }
-+ case '=': {
-+ next(ls);
-+ if (ls->current != '=')
-+ return '=';
-+ else {
-+ next(ls);
-+ return TK_EQ;
-+ }
-+ }
-+ case '<': {
-+ next(ls);
-+ if (ls->current == '=')
-+ return TK_LE;
-+ else if (ls->current == '<') {
-+ next(ls);
-+ if (ls->current == '<') {
-+ next(ls);
-+ return TK_AGGR_ASSIGN;
-+ }
-+ } else {
-+ return '<';
-+ }
-+ }
-+ case '>': {
-+ next(ls);
-+ if (ls->current != '=')
-+ return '>';
-+ else {
-+ next(ls);
-+ return TK_GE;
-+ }
-+ }
-+ case '!': {
-+ next(ls);
-+ if (ls->current != '=')
-+ return TK_NOT;
-+ else {
-+ next(ls);
-+ return TK_NE;
-+ }
-+ }
-+ case ':': {
-+ next(ls);
-+ if (ls->current != ':')
-+ return ':';
-+ else {
-+ next(ls);
-+ return TK_DBCOLON;
-+ }
-+ }
-+ case '"': case '\'': { /* short literal strings */
-+ read_string(ls, ls->current, seminfo);
-+ return TK_STRING;
-+ }
-+ case '`': { /* short literal kernel symbol */
-+ read_string(ls, ls->current, seminfo);
-+ return TK_KSYM;
-+ }
-+ case '.': { /* '.', '..', '...', or number */
-+ save_and_next(ls);
-+ if (check_next(ls, ".")) {
-+ if (check_next(ls, "."))
-+ return TK_DOTS; /* '...' */
-+ else
-+ return TK_CONCAT; /* '..' */
-+ }
-+ else if (!isdigit(ls->current))
-+ return '.';
-+ /* else go through */
-+ }
-+ case '0': case '1': case '2': case '3': case '4':
-+ case '5': case '6': case '7': case '8': case '9': {
-+ read_numeral(ls, seminfo);
-+ return TK_NUMBER;
-+ }
-+ case EOZ: {
-+ return TK_EOS;
-+ }
-+ case '&': {
-+ next(ls);
-+ if (ls->current != '&')
-+ return '&';
-+ else {
-+ next(ls);
-+ return TK_AND;
-+ }
-+ }
-+ case '|': {
-+ next(ls);
-+ if (ls->current != '|')
-+ return '|';
-+ else {
-+ next(ls);
-+ return TK_OR;
-+ }
-+ }
-+ default: {
-+ if (islalpha(ls->current)) {
-+ /* identifier or reserved word? */
-+ ktap_string *ts;
-+ do {
-+ save_and_next(ls);
-+ } while (islalnum(ls->current));
-+ ts = lex_newstring(ls, mbuff(ls->buff),
-+ mbuff_len(ls->buff));
-+ seminfo->ts = ts;
-+ if (isreserved(ts)) /* reserved word? */
-+ return ts->tsv.extra - 1 +
-+ FIRST_RESERVED;
-+ else {
-+ return TK_NAME;
-+ }
-+ } else { /* single-char tokens (+ - / ...) */
-+ int c = ls->current;
-+ next(ls);
-+ return c;
-+ }
-+ }
-+ }
-+ }
-+}
-+
-+void lex_read_string_until(ktap_lexstate *ls, int c)
-+{
-+ ktap_string *ts;
-+ char errmsg[32];
-+
-+ mbuff_reset(ls->buff);
-+
-+ while (ls->current == ' ')
-+ next(ls);
-+
-+ do {
-+ save_and_next(ls);
-+ } while (ls->current != c && ls->current != EOZ);
-+
-+ if (ls->current != c) {
-+ sprintf(errmsg, "expect %c", c);
-+ lexerror(ls, errmsg, 0);
-+ }
-+
-+ ts = lex_newstring(ls, mbuff(ls->buff), mbuff_len(ls->buff));
-+ ls->t.seminfo.ts = ts;
-+ ls->t.token = TK_STRING;
-+}
-+
-+void lex_next(ktap_lexstate *ls)
-+{
-+ ls->lastline = ls->linenumber;
-+ if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */
-+ ls->t = ls->lookahead; /* use this one */
-+ ls->lookahead.token = TK_EOS; /* and discharge it */
-+ } else
-+ ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */
-+}
-+
-+int lex_lookahead(ktap_lexstate *ls)
-+{
-+ ktap_assert(ls->lookahead.token == TK_EOS);
-+ ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
-+ return ls->lookahead.token;
-+}
-+
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/main.c
-@@ -0,0 +1,727 @@
-+/*
-+ * main.c - ktap compiler and loader entry
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <sched.h>
-+#include <string.h>
-+#include <signal.h>
-+#include <stdarg.h>
-+#include <sys/mman.h>
-+#include <sys/stat.h>
-+#include <sys/ioctl.h>
-+#include <sys/types.h>
-+#include <unistd.h>
-+#include <fcntl.h>
-+#include <math.h>
-+
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_opcodes.h"
-+#include "ktapc.h"
-+#include "../runtime/kp_obj.h"
-+#include "../runtime/kp_str.h"
-+#include "../runtime/kp_tab.h"
-+#include "symbol.h"
-+#include "cparser.h"
-+
-+
-+/*******************************************************************/
-+
-+void *ktapc_reallocv(void *block, size_t osize, size_t nsize)
-+{
-+ return kp_reallocv(NULL, block, osize, nsize);
-+}
-+
-+ktap_closure *ktapc_newclosure(int n)
-+{
-+ return kp_newclosure(NULL, n);
-+}
-+
-+ktap_proto *ktapc_newproto()
-+{
-+ return kp_newproto(NULL);
-+}
-+
-+const ktap_value *ktapc_table_get(ktap_tab *t, const ktap_value *key)
-+{
-+ return kp_tab_get(t, key);
-+}
-+
-+void ktapc_table_setvalue(ktap_tab *t, const ktap_value *key, ktap_value *val)
-+{
-+ kp_tab_setvalue(NULL, t, key, val);
-+}
-+
-+ktap_tab *ktapc_table_new()
-+{
-+ return kp_tab_new(NULL);
-+}
-+
-+ktap_string *ktapc_ts_newlstr(const char *str, size_t l)
-+{
-+ return kp_tstring_newlstr(NULL, str, l);
-+}
-+
-+ktap_string *ktapc_ts_new(const char *str)
-+{
-+ return kp_tstring_new(NULL, str);
-+}
-+
-+int ktapc_ts_eqstr(ktap_string *a, ktap_string *b)
-+{
-+ return kp_tstring_eqstr(a, b);
-+}
-+
-+static void ktapc_runerror(const char *err_msg_fmt, ...)
-+{
-+ va_list ap;
-+
-+ fprintf(stderr, "ktapc_runerror\n");
-+
-+ va_start(ap, err_msg_fmt);
-+ vfprintf(stderr, err_msg_fmt, ap);
-+ va_end(ap);
-+
-+ exit(EXIT_FAILURE);
-+}
-+
-+/*
-+ * todo: memory leak here
-+ */
-+char *ktapc_sprintf(const char *fmt, ...)
-+{
-+ char *msg = malloc(128);
-+
-+ va_list argp;
-+ va_start(argp, fmt);
-+ vsprintf(msg, fmt, argp);
-+ va_end(argp);
-+ return msg;
-+}
-+
-+
-+#define MINSIZEARRAY 4
-+
-+void *ktapc_growaux(void *block, int *size, size_t size_elems, int limit,
-+ const char *what)
-+{
-+ void *newblock;
-+ int newsize;
-+
-+ if (*size >= limit/2) { /* cannot double it? */
-+ if (*size >= limit) /* cannot grow even a little? */
-+ ktapc_runerror("too many %s (limit is %d)\n",
-+ what, limit);
-+ newsize = limit; /* still have at least one free place */
-+ } else {
-+ newsize = (*size) * 2;
-+ if (newsize < MINSIZEARRAY)
-+ newsize = MINSIZEARRAY; /* minimum size */
-+ }
-+
-+ newblock = ktapc_reallocv(block, (*size) * size_elems, newsize * size_elems);
-+ *size = newsize; /* update only when everything else is OK */
-+ return newblock;
-+}
-+
-+/*************************************************************************/
-+
-+#define print_base(i) \
-+ do { \
-+ if (i < f->sizelocvars) /* it's a localvars */ \
-+ printf("%s", getstr(f->locvars[i].varname)); \
-+ else \
-+ printf("base + %d", i); \
-+ } while (0)
-+
-+#define print_RK(instr, _field) \
-+ do { \
-+ if (ISK(GETARG_##_field(instr))) \
-+ kp_showobj(NULL, k + INDEXK(GETARG_##_field(instr))); \
-+ else \
-+ print_base(GETARG_##_field(instr)); \
-+ } while (0)
-+
-+#define print_RKA(instr) print_RK(instr, A)
-+#define print_RKB(instr) print_RK(instr, B)
-+#define print_RKC(instr) print_RK(instr, C)
-+
-+#define print_upvalue(idx) \
-+ do { \
-+ if ((idx) == 0) \
-+ printf("global"); \
-+ else \
-+ printf("upvalues[%d]", (idx)); \
-+ } while (0)
-+
-+static void decode_instruction(ktap_proto *f, int instr)
-+{
-+ int opcode = GET_OPCODE(instr);
-+ ktap_value *k;
-+
-+ k = f->k;
-+
-+ printf("%.8x\t", instr);
-+ printf("%s\t", ktap_opnames[opcode]);
-+
-+ switch (opcode) {
-+ case OP_MOVE:
-+ printf("\t");
-+ print_base(GETARG_A(instr));
-+ printf(" <- ");
-+ print_base(GETARG_B(instr));
-+ break;
-+ case OP_GETTABUP:
-+ print_base(GETARG_A(instr));
-+ printf(" <- ");
-+ print_upvalue(GETARG_B(instr));
-+ printf("{"); print_RKC(instr); printf("}");
-+
-+ break;
-+ case OP_GETTABLE:
-+ print_base(GETARG_A(instr));
-+ printf(" <- ");
-+
-+ print_base(GETARG_B(instr));
-+
-+ printf("{");
-+ print_RKC(instr);
-+ printf("}");
-+ break;
-+ case OP_SETTABLE:
-+ print_base(GETARG_A(instr));
-+ printf("{");
-+ print_RKB(instr);
-+ printf("}");
-+ printf(" <- ");
-+ print_RKC(instr);
-+ break;
-+ case OP_LOADK:
-+ printf("\t");
-+ print_base(GETARG_A(instr));
-+ printf(" <- ");
-+
-+ kp_showobj(NULL, k + GETARG_Bx(instr));
-+ break;
-+ case OP_CALL:
-+ printf("\t");
-+ print_base(GETARG_A(instr));
-+ break;
-+ case OP_JMP:
-+ printf("\t%d", GETARG_sBx(instr));
-+ break;
-+ case OP_CLOSURE:
-+ printf("\t");
-+ print_base(GETARG_A(instr));
-+ printf(" <- closure(func starts from line %d)",
-+ f->p[GETARG_Bx(instr)]->lineinfo[0]);
-+ break;
-+ case OP_SETTABUP:
-+ print_upvalue(GETARG_A(instr));
-+ printf("{");
-+ print_RKB(instr);
-+ printf("} <- ");
-+
-+ print_RKC(instr);
-+ break;
-+ case OP_GETUPVAL:
-+ print_base(GETARG_A(instr));
-+ printf(" <- ");
-+
-+ print_upvalue(GETARG_B(instr));
-+ break;
-+ case OP_NEWTABLE:
-+ print_base(GETARG_A(instr));
-+ printf(" <- {}");
-+ default:
-+ break;
-+ }
-+
-+ printf("\n");
-+}
-+
-+static int function_nr = 0;
-+
-+/* this is a debug function used for check bytecode chunk file */
-+static void dump_function(int level, ktap_proto *f)
-+{
-+ int i;
-+
-+ printf("\n----------------------------------------------------\n");
-+ printf("function %d [level %d]:\n", function_nr++, level);
-+ printf("linedefined: %d\n", f->linedefined);
-+ printf("lastlinedefined: %d\n", f->lastlinedefined);
-+ printf("numparams: %d\n", f->numparams);
-+ printf("is_vararg: %d\n", f->is_vararg);
-+ printf("maxstacksize: %d\n", f->maxstacksize);
-+ printf("source: %s\n", getstr(f->source));
-+ printf("sizelineinfo: %d \t", f->sizelineinfo);
-+ for (i = 0; i < f->sizelineinfo; i++)
-+ printf("%d ", f->lineinfo[i]);
-+ printf("\n");
-+
-+ printf("sizek: %d\n", f->sizek);
-+ for (i = 0; i < f->sizek; i++) {
-+ switch(f->k[i].type) {
-+ case KTAP_TNIL:
-+ printf("\tNIL\n");
-+ break;
-+ case KTAP_TBOOLEAN:
-+ printf("\tBOOLEAN: ");
-+ printf("%d\n", f->k[i].val.b);
-+ break;
-+ case KTAP_TNUMBER:
-+ printf("\tTNUMBER: ");
-+ printf("%ld\n", f->k[i].val.n);
-+ break;
-+ case KTAP_TSHRSTR:
-+ case KTAP_TLNGSTR:
-+ printf("\tTSTRING: ");
-+ printf("%s\n", svalue(&(f->k[i])));
-+ break;
-+ default:
-+ printf("\tUnknow constant type %d: ", f->k[i].type);
-+ kp_showobj(NULL, &(f->k[i]));
-+ printf("\n");
-+ }
-+ }
-+
-+ printf("sizelocvars: %d\n", f->sizelocvars);
-+ for (i = 0; i < f->sizelocvars; i++) {
-+ printf("\tlocvars: %s startpc: %d endpc: %d\n",
-+ getstr(f->locvars[i].varname), f->locvars[i].startpc,
-+ f->locvars[i].endpc);
-+ }
-+
-+ printf("sizeupvalues: %d\n", f->sizeupvalues);
-+ for (i = 0; i < f->sizeupvalues; i++) {
-+ printf("\tname: %s instack: %d idx: %d\n",
-+ getstr(f->upvalues[i].name), f->upvalues[i].instack,
-+ f->upvalues[i].idx);
-+ }
-+
-+ printf("\n");
-+ printf("sizecode: %d\n", f->sizecode);
-+ for (i = 0; i < f->sizecode; i++)
-+ decode_instruction(f, f->code[i]);
-+
-+ printf("sizep: %d\n", f->sizep);
-+ for (i = 0; i < f->sizep; i++)
-+ dump_function(level + 1, f->p[i]);
-+
-+}
-+
-+static void usage(const char *msg_fmt, ...)
-+{
-+ va_list ap;
-+
-+ va_start(ap, msg_fmt);
-+ vfprintf(stderr, msg_fmt, ap);
-+ va_end(ap);
-+
-+ fprintf(stderr,
-+"Usage: ktap [options] file [script args] -- cmd [args]\n"
-+" or: ktap [options] -e one-liner -- cmd [args]\n"
-+"\n"
-+"Options and arguments:\n"
-+" -o file : send script output to file, instead of stderr\n"
-+" -p pid : specific tracing pid\n"
-+" -C cpu : cpu to monitor in system-wide\n"
-+" -T : show timestamp for event\n"
-+" -V : show version\n"
-+" -v : enable verbose mode\n"
-+" -q : suppress start tracing message\n"
-+" -s : simple event tracing\n"
-+" -b : list byte codes\n"
-+" -le [glob] : list pre-defined events in system\n"
-+#ifndef NO_LIBELF
-+" -lf DSO : list available functions from DSO\n"
-+" -lm DSO : list available sdt notes from DSO\n"
-+#endif
-+" file : program read from script file\n"
-+" -- cmd [args] : workload to tracing\n");
-+
-+ exit(EXIT_FAILURE);
-+}
-+
-+ktap_global_state dummy_global_state;
-+
-+static void init_dummy_global_state()
-+{
-+ memset(&dummy_global_state, 0, sizeof(ktap_global_state));
-+ dummy_global_state.seed = 201236;
-+
-+ kp_tstring_resize(NULL, 32); /* set inital string hashtable size */
-+}
-+
-+#define handle_error(str) do { perror(str); exit(-1); } while(0)
-+
-+static struct ktap_parm uparm;
-+static int ktap_trunk_mem_size = 1024;
-+
-+static int ktapc_writer(const void* p, size_t sz, void* ud)
-+{
-+ if (uparm.trunk_len + sz > ktap_trunk_mem_size) {
-+ int new_size = (uparm.trunk_len + sz) * 2;
-+ uparm.trunk = realloc(uparm.trunk, new_size);
-+ ktap_trunk_mem_size = new_size;
-+ }
-+
-+ memcpy(uparm.trunk + uparm.trunk_len, p, sz);
-+ uparm.trunk_len += sz;
-+
-+ return 0;
-+}
-+
-+
-+static int forks;
-+static char **workload_argv;
-+
-+static int fork_workload(int ktap_fd)
-+{
-+ int pid;
-+
-+ pid = fork();
-+ if (pid < 0)
-+ handle_error("failed to fork");
-+
-+ if (pid > 0)
-+ return pid;
-+
-+ signal(SIGTERM, SIG_DFL);
-+
-+ execvp("", workload_argv);
-+
-+ /*
-+ * waiting ktapvm prepare all tracing event
-+ * make it more robust in future.
-+ */
-+ pause();
-+
-+ execvp(workload_argv[0], workload_argv);
-+
-+ perror(workload_argv[0]);
-+ exit(-1);
-+
-+ return -1;
-+}
-+
-+#define KTAPVM_PATH "/sys/kernel/debug/ktap/ktapvm"
-+
-+static char *output_filename;
-+
-+static int run_ktapvm()
-+{
-+ int ktapvm_fd, ktap_fd;
-+ int ret;
-+
-+ ktapvm_fd = open(KTAPVM_PATH, O_RDONLY);
-+ if (ktapvm_fd < 0)
-+ handle_error("open " KTAPVM_PATH " failed");
-+
-+ ktap_fd = ioctl(ktapvm_fd, 0, NULL);
-+ if (ktap_fd < 0)
-+ handle_error("ioctl ktapvm failed");
-+
-+ ktapio_create(output_filename);
-+
-+ if (forks) {
-+ uparm.trace_pid = fork_workload(ktap_fd);
-+ uparm.workload = 1;
-+ }
-+
-+ ret = ioctl(ktap_fd, KTAP_CMD_IOC_RUN, &uparm);
-+
-+ close(ktap_fd);
-+ close(ktapvm_fd);
-+
-+ return ret;
-+}
-+
-+int verbose;
-+static int quiet;
-+static int dump_bytecode;
-+static char oneline_src[1024];
-+static int trace_pid = -1;
-+static int trace_cpu = -1;
-+static int print_timestamp;
-+
-+#define SIMPLE_ONE_LINER_FMT \
-+ "trace %s { print(cpu(), tid(), execname(), argevent) }"
-+
-+static const char *script_file;
-+static int script_args_start;
-+static int script_args_end;
-+
-+#ifndef NO_LIBELF
-+struct binary_base
-+{
-+ int type;
-+ const char *binary;
-+};
-+static int print_symbol(const char *name, vaddr_t addr, void *arg)
-+{
-+ struct binary_base *base = (struct binary_base *)arg;
-+ const char *type = base->type == FIND_SYMBOL ?
-+ "probe" : "sdt";
-+
-+ printf("%s:%s:%s\n", type, base->binary, name);
-+ return 0;
-+}
-+#endif
-+
-+static void parse_option(int argc, char **argv)
-+{
-+ char pid[32] = {0};
-+ char cpu_str[32] = {0};
-+ char *next_arg;
-+ int i, j;
-+
-+ for (i = 1; i < argc; i++) {
-+ if (argv[i][0] != '-') {
-+ script_file = argv[i];
-+ if (!script_file)
-+ usage("");
-+
-+ script_args_start = i + 1;
-+ script_args_end = argc;
-+
-+ for (j = i + 1; j < argc; j++) {
-+ if (argv[j][0] == '-' && argv[j][1] == '-')
-+ goto found_cmd;
-+ }
-+
-+ return;
-+ }
-+
-+ if (argv[i][0] == '-' && argv[i][1] == '-') {
-+ j = i;
-+ goto found_cmd;
-+ }
-+
-+ next_arg = argv[i + 1];
-+
-+ switch (argv[i][1]) {
-+ case 'o':
-+ output_filename = malloc(strlen(next_arg) + 1);
-+ if (!output_filename)
-+ return;
-+
-+ strncpy(output_filename, next_arg, strlen(next_arg));
-+ i++;
-+ break;
-+ case 'e':
-+ strncpy(oneline_src, next_arg, strlen(next_arg));
-+ i++;
-+ break;
-+ case 'p':
-+ strncpy(pid, next_arg, strlen(next_arg));
-+ trace_pid = atoi(pid);
-+ i++;
-+ break;
-+ case 'C':
-+ strncpy(cpu_str, next_arg, strlen(next_arg));
-+ trace_cpu = atoi(cpu_str);
-+ i++;
-+ break;
-+ case 'T':
-+ print_timestamp = 1;
-+ break;
-+ case 'v':
-+ verbose = 1;
-+ break;
-+ case 'q':
-+ quiet = 1;
-+ break;
-+ case 's':
-+ sprintf(oneline_src, SIMPLE_ONE_LINER_FMT, next_arg);
-+ i++;
-+ break;
-+ case 'b':
-+ dump_bytecode = 1;
-+ break;
-+ case 'l': /* list available events */
-+ switch (argv[i][2]) {
-+ case 'e': /* tracepoints */
-+ list_available_events(next_arg);
-+ exit(EXIT_SUCCESS);
-+#ifndef NO_LIBELF
-+ case 'f': /* functions in DSO */
-+ case 'm': /* static marks in DSO */ {
-+ const char *binary = next_arg;
-+ int type = argv[i][2] == 'f' ?
-+ FIND_SYMBOL : FIND_STAPSDT_NOTE;
-+ struct binary_base base = {
-+ .type = type,
-+ .binary = binary,
-+ };
-+ int ret;
-+
-+ ret = parse_dso_symbols(binary, type,
-+ print_symbol,
-+ (void *)&base);
-+ if (ret <= 0) {
-+ fprintf(stderr,
-+ "error: no symbols in binary %s\n",
-+ binary);
-+ exit(EXIT_FAILURE);
-+ }
-+ exit(EXIT_SUCCESS);
-+ }
-+#endif
-+ default:
-+ exit(EXIT_FAILURE);
-+ }
-+ break;
-+ case 'V':
-+#ifdef CONFIG_KTAP_FFI
-+ usage("%s (with FFI)\n\n", KTAP_VERSION);
-+#else
-+ usage("%s\n\n", KTAP_VERSION);
-+#endif
-+ break;
-+ case '?':
-+ case 'h':
-+ usage("");
-+ break;
-+ default:
-+ usage("wrong argument\n");
-+ break;
-+ }
-+ }
-+
-+ return;
-+
-+ found_cmd:
-+ script_args_end = j;
-+ forks = 1;
-+ workload_argv = &argv[j + 1];
-+}
-+
-+static void compile(const char *input)
-+{
-+ ktap_closure *cl;
-+ char *buff;
-+ struct stat sb;
-+ int fdin;
-+
-+ if (oneline_src[0] != '\0') {
-+ init_dummy_global_state();
-+ ffi_cparser_init();
-+ cl = ktapc_parser(oneline_src, input);
-+ goto dump;
-+ }
-+
-+ fdin = open(input, O_RDONLY);
-+ if (fdin < 0) {
-+ fprintf(stderr, "open file %s failed\n", input);
-+ exit(-1);
-+ }
-+
-+ if (fstat(fdin, &sb) == -1)
-+ handle_error("fstat failed");
-+
-+ buff = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fdin, 0);
-+ if (buff == MAP_FAILED)
-+ handle_error("mmap failed");
-+
-+ init_dummy_global_state();
-+ ffi_cparser_init();
-+ cl = ktapc_parser(buff, input);
-+
-+ munmap(buff, sb.st_size);
-+ close(fdin);
-+
-+ dump:
-+ if (dump_bytecode) {
-+ dump_function(1, cl->p);
-+ exit(0);
-+ }
-+
-+ /* ktapc output */
-+ uparm.trunk = malloc(ktap_trunk_mem_size);
-+ if (!uparm.trunk)
-+ handle_error("malloc failed");
-+
-+ ktapc_dump(cl->p, ktapc_writer, NULL, 0);
-+ ffi_cparser_free();
-+}
-+
-+int main(int argc, char **argv)
-+{
-+ char **ktapvm_argv;
-+ int new_index, i;
-+ int ret;
-+
-+ if (argc == 1)
-+ usage("");
-+
-+ parse_option(argc, argv);
-+
-+ if (oneline_src[0] != '\0')
-+ script_file = "one-liner";
-+
-+ compile(script_file);
-+
-+ ktapvm_argv = (char **)malloc(sizeof(char *)*(script_args_end -
-+ script_args_start + 1));
-+ if (!ktapvm_argv) {
-+ fprintf(stderr, "canno allocate ktapvm_argv\n");
-+ return -1;
-+ }
-+
-+ ktapvm_argv[0] = malloc(strlen(script_file) + 1);
-+ if (!ktapvm_argv[0]) {
-+ fprintf(stderr, "canno allocate memory\n");
-+ return -1;
-+ }
-+ strcpy(ktapvm_argv[0], script_file);
-+ ktapvm_argv[0][strlen(script_file)] = '\0';
-+
-+ /* pass rest argv into ktapvm */
-+ new_index = 1;
-+ for (i = script_args_start; i < script_args_end; i++) {
-+ ktapvm_argv[new_index] = malloc(strlen(argv[i]) + 1);
-+ if (!ktapvm_argv[new_index]) {
-+ fprintf(stderr, "canno allocate memory\n");
-+ return -1;
-+ }
-+ strcpy(ktapvm_argv[new_index], argv[i]);
-+ ktapvm_argv[new_index][strlen(argv[i])] = '\0';
-+ new_index++;
-+ }
-+
-+ uparm.argv = ktapvm_argv;
-+ uparm.argc = new_index;
-+ uparm.verbose = verbose;
-+ uparm.trace_pid = trace_pid;
-+ uparm.trace_cpu = trace_cpu;
-+ uparm.print_timestamp = print_timestamp;
-+ uparm.quiet = quiet;
-+
-+ /* start running into kernel ktapvm */
-+ ret = run_ktapvm();
-+
-+ cleanup_event_resources();
-+ return ret;
-+}
-+
-+
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/parser.c
-@@ -0,0 +1,1963 @@
-+/*
-+ * parser.c - ktap parser
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_opcodes.h"
-+#include "ktapc.h"
-+#include "cparser.h"
-+
-+/* maximum number of local variables per function (must be smaller
-+ than 250, due to the bytecode format) */
-+#define MAXVARS 200
-+
-+#define hasmultret(k) ((k) == VCALL || (k) == VVARARG)
-+
-+/*
-+ * nodes for block list (list of active blocks)
-+ */
-+typedef struct ktap_blockcnt {
-+ struct ktap_blockcnt *previous; /* chain */
-+ short firstlabel; /* index of first label in this block */
-+ short firstgoto; /* index of first pending goto in this block */
-+ u8 nactvar; /* # active locals outside the block */
-+ u8 upval; /* true if some variable in the block is an upvalue */
-+ u8 isloop; /* true if `block' is a loop */
-+} ktap_blockcnt;
-+
-+/*
-+ * prototypes for recursive non-terminal functions
-+ */
-+static void statement (ktap_lexstate *ls);
-+static void expr (ktap_lexstate *ls, ktap_expdesc *v);
-+
-+static void anchor_token(ktap_lexstate *ls)
-+{
-+ /* last token from outer function must be EOS */
-+ ktap_assert((int)(ls->fs != NULL) || ls->t.token == TK_EOS);
-+ if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) {
-+ ktap_string *ts = ls->t.seminfo.ts;
-+ lex_newstring(ls, getstr(ts), ts->tsv.len);
-+ }
-+}
-+
-+/* semantic error */
-+static void semerror(ktap_lexstate *ls, const char *msg)
-+{
-+ ls->t.token = 0; /* remove 'near to' from final message */
-+ lex_syntaxerror(ls, msg);
-+}
-+
-+static void error_expected(ktap_lexstate *ls, int token)
-+{
-+ lex_syntaxerror(ls,
-+ ktapc_sprintf("%s expected", lex_token2str(ls, token)));
-+}
-+
-+static void errorlimit(ktap_funcstate *fs, int limit, const char *what)
-+{
-+ const char *msg;
-+ int line = fs->f->linedefined;
-+ const char *where = (line == 0) ? "main function"
-+ : ktapc_sprintf("function at line %d", line);
-+
-+ msg = ktapc_sprintf("too many %s (limit is %d) in %s",
-+ what, limit, where);
-+ lex_syntaxerror(fs->ls, msg);
-+}
-+
-+static void checklimit(ktap_funcstate *fs, int v, int l, const char *what)
-+{
-+ if (v > l)
-+ errorlimit(fs, l, what);
-+}
-+
-+static int testnext(ktap_lexstate *ls, int c)
-+{
-+ if (ls->t.token == c) {
-+ lex_next(ls);
-+ return 1;
-+ }
-+ else
-+ return 0;
-+}
-+
-+static void check(ktap_lexstate *ls, int c)
-+{
-+ if (ls->t.token != c)
-+ error_expected(ls, c);
-+}
-+
-+static void checknext(ktap_lexstate *ls, int c)
-+{
-+ check(ls, c);
-+ lex_next(ls);
-+}
-+
-+#define check_condition(ls,c,msg) { if (!(c)) lex_syntaxerror(ls, msg); }
-+
-+static void check_match(ktap_lexstate *ls, int what, int who, int where)
-+{
-+ if (!testnext(ls, what)) {
-+ if (where == ls->linenumber)
-+ error_expected(ls, what);
-+ else {
-+ lex_syntaxerror(ls, ktapc_sprintf(
-+ "%s expected (to close %s at line %d)",
-+ lex_token2str(ls, what),
-+ lex_token2str(ls, who), where));
-+ }
-+ }
-+}
-+
-+static ktap_string *str_checkname(ktap_lexstate *ls)
-+{
-+ ktap_string *ts;
-+
-+ check(ls, TK_NAME);
-+ ts = ls->t.seminfo.ts;
-+ lex_next(ls);
-+ return ts;
-+}
-+
-+static void init_exp(ktap_expdesc *e, expkind k, int i)
-+{
-+ e->f = e->t = NO_JUMP;
-+ e->k = k;
-+ e->u.info = i;
-+}
-+
-+static void codestring(ktap_lexstate *ls, ktap_expdesc *e, ktap_string *s)
-+{
-+ init_exp(e, VK, codegen_stringK(ls->fs, s));
-+}
-+
-+static void codenumber(ktap_lexstate *ls, ktap_expdesc *e, ktap_number n)
-+{
-+ init_exp(e, VK, codegen_numberK(ls->fs, n));
-+}
-+
-+static void checkname(ktap_lexstate *ls, ktap_expdesc *e)
-+{
-+ codestring(ls, e, str_checkname(ls));
-+}
-+
-+static int registerlocalvar(ktap_lexstate *ls, ktap_string *varname)
-+{
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_proto *f = fs->f;
-+ int oldsize = f->sizelocvars;
-+
-+ ktapc_growvector(f->locvars, fs->nlocvars, f->sizelocvars,
-+ ktap_locvar, SHRT_MAX, "local variables");
-+
-+ while (oldsize < f->sizelocvars)
-+ f->locvars[oldsize++].varname = NULL;
-+
-+ f->locvars[fs->nlocvars].varname = varname;
-+ return fs->nlocvars++;
-+}
-+
-+static void new_localvar(ktap_lexstate *ls, ktap_string *name)
-+{
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_dyndata *dyd = ls->dyd;
-+ int reg = registerlocalvar(ls, name);
-+
-+ checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal,
-+ MAXVARS, "local variables");
-+ ktapc_growvector(dyd->actvar.arr, dyd->actvar.n + 1,
-+ dyd->actvar.size, ktap_vardesc, MAX_INT, "local variables");
-+ dyd->actvar.arr[dyd->actvar.n++].idx = (short)reg;
-+}
-+
-+static void new_localvarliteral_(ktap_lexstate *ls, const char *name, size_t sz)
-+{
-+ new_localvar(ls, lex_newstring(ls, name, sz));
-+}
-+
-+#define new_localvarliteral(ls,v) \
-+ new_localvarliteral_(ls, "" v, (sizeof(v)/sizeof(char))-1)
-+
-+static ktap_locvar *getlocvar(ktap_funcstate *fs, int i)
-+{
-+ int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx;
-+
-+ ktap_assert(idx < fs->nlocvars);
-+ return &fs->f->locvars[idx];
-+}
-+
-+static void adjustlocalvars(ktap_lexstate *ls, int nvars)
-+{
-+ ktap_funcstate *fs = ls->fs;
-+
-+ fs->nactvar = (u8)(fs->nactvar + nvars);
-+ for (; nvars; nvars--) {
-+ getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc;
-+ }
-+}
-+
-+static void removevars(ktap_funcstate *fs, int tolevel)
-+{
-+ fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel);
-+
-+ while (fs->nactvar > tolevel)
-+ getlocvar(fs, --fs->nactvar)->endpc = fs->pc;
-+}
-+
-+static int searchupvalue(ktap_funcstate *fs, ktap_string *name)
-+{
-+ int i;
-+ ktap_upvaldesc *up = fs->f->upvalues;
-+
-+ for (i = 0; i < fs->nups; i++) {
-+ if (ktapc_ts_eqstr(up[i].name, name))
-+ return i;
-+ }
-+ return -1; /* not found */
-+}
-+
-+static int newupvalue(ktap_funcstate *fs, ktap_string *name, ktap_expdesc *v)
-+{
-+ ktap_proto *f = fs->f;
-+ int oldsize = f->sizeupvalues;
-+
-+ checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues");
-+ ktapc_growvector(f->upvalues, fs->nups, f->sizeupvalues,
-+ ktap_upvaldesc, MAXUPVAL, "upvalues");
-+
-+ while (oldsize < f->sizeupvalues)
-+ f->upvalues[oldsize++].name = NULL;
-+ f->upvalues[(int)fs->nups].instack = (v->k == VLOCAL);
-+ f->upvalues[(int)fs->nups].idx = (u8)(v->u.info);
-+ f->upvalues[(int)fs->nups].name = name;
-+ return fs->nups++;
-+}
-+
-+static int searchvar(ktap_funcstate *fs, ktap_string *n)
-+{
-+ int i;
-+
-+ for (i = fs->nactvar-1; i >= 0; i--) {
-+ if (ktapc_ts_eqstr(n, getlocvar(fs, i)->varname))
-+ return i;
-+ }
-+ return -1; /* not found */
-+}
-+
-+/*
-+ * Mark block where variable at given level was defined
-+ * (to emit close instructions later).
-+ */
-+static void markupval(ktap_funcstate *fs, int level)
-+{
-+ ktap_blockcnt *bl = fs->bl;
-+
-+ while (bl->nactvar > level)
-+ bl = bl->previous;
-+ bl->upval = 1;
-+}
-+
-+/*
-+ * Find variable with given name 'n'. If it is an upvalue, add this
-+ * upvalue into all intermediate functions.
-+ */
-+static int singlevaraux(ktap_funcstate *fs, ktap_string *n, ktap_expdesc *var, int base)
-+{
-+ if (fs == NULL) /* no more levels? */
-+ return VVOID; /* default is global */
-+ else {
-+ int v = searchvar(fs, n); /* look up locals at current level */
-+ if (v >= 0) { /* found? */
-+ init_exp(var, VLOCAL, v); /* variable is local */
-+ if (!base)
-+ markupval(fs, v); /* local will be used as an upval */
-+ return VLOCAL;
-+ } else { /* not found as local at current level; try upvalues */
-+ int idx = searchupvalue(fs, n); /* try existing upvalues */
-+ if (idx < 0) { /* not found? */
-+ if (singlevaraux(fs->prev, n, var, 0) == VVOID) /* try upper levels */
-+ return VVOID; /* not found; is a global */
-+ /* else was LOCAL or UPVAL */
-+ idx = newupvalue(fs, n, var); /* will be a new upvalue */
-+ }
-+ init_exp(var, VUPVAL, idx);
-+ return VUPVAL;
-+ }
-+ }
-+}
-+
-+static void singlevar(ktap_lexstate *ls, ktap_expdesc *var)
-+{
-+ ktap_string *varname = str_checkname(ls);
-+ ktap_funcstate *fs = ls->fs;
-+
-+ if (singlevaraux(fs, varname, var, 1) == VVOID) { /* global name? */
-+ ktap_expdesc key;
-+ singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
-+ ktap_assert(var->k == VLOCAL || var->k == VUPVAL);
-+ codestring(ls, &key, varname); /* key is variable name */
-+ codegen_indexed(fs, var, &key); /* env[varname] */
-+ }
-+}
-+
-+static void adjust_assign(ktap_lexstate *ls, int nvars, int nexps, ktap_expdesc *e)
-+{
-+ ktap_funcstate *fs = ls->fs;
-+ int extra = nvars - nexps;
-+
-+ if (hasmultret(e->k)) {
-+ extra++; /* includes call itself */
-+ if (extra < 0)
-+ extra = 0;
-+ codegen_setreturns(fs, e, extra); /* last exp. provides the difference */
-+ if (extra > 1)
-+ codegen_reserveregs(fs, extra-1);
-+ } else {
-+ if (e->k != VVOID)
-+ codegen_exp2nextreg(fs, e); /* close last expression */
-+ if (extra > 0) {
-+ int reg = fs->freereg;
-+
-+ codegen_reserveregs(fs, extra);
-+ codegen_nil(fs, reg, extra);
-+ }
-+ }
-+}
-+
-+static void enterlevel(ktap_lexstate *ls)
-+{
-+ ++ls->nCcalls;
-+ checklimit(ls->fs, ls->nCcalls, KTAP_MAXCCALLS, "C levels");
-+}
-+
-+static void closegoto(ktap_lexstate *ls, int g, ktap_labeldesc *label)
-+{
-+ int i;
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_labellist *gl = &ls->dyd->gt;
-+ ktap_labeldesc *gt = &gl->arr[g];
-+
-+ ktap_assert(ktapc_ts_eqstr(gt->name, label->name));
-+ if (gt->nactvar < label->nactvar) {
-+ ktap_string *vname = getlocvar(fs, gt->nactvar)->varname;
-+ const char *msg = ktapc_sprintf(
-+ "<goto %s> at line %d jumps into the scope of local " KTAP_QS,
-+ getstr(gt->name), gt->line, getstr(vname));
-+ semerror(ls, msg);
-+ }
-+
-+ codegen_patchlist(fs, gt->pc, label->pc);
-+ /* remove goto from pending list */
-+ for (i = g; i < gl->n - 1; i++)
-+ gl->arr[i] = gl->arr[i + 1];
-+ gl->n--;
-+}
-+
-+/*
-+ * try to close a goto with existing labels; this solves backward jumps
-+ */
-+static int findlabel(ktap_lexstate *ls, int g)
-+{
-+ int i;
-+ ktap_blockcnt *bl = ls->fs->bl;
-+ ktap_dyndata *dyd = ls->dyd;
-+ ktap_labeldesc *gt = &dyd->gt.arr[g];
-+
-+ /* check labels in current block for a match */
-+ for (i = bl->firstlabel; i < dyd->label.n; i++) {
-+ ktap_labeldesc *lb = &dyd->label.arr[i];
-+ if (ktapc_ts_eqstr(lb->name, gt->name)) { /* correct label? */
-+ if (gt->nactvar > lb->nactvar &&
-+ (bl->upval || dyd->label.n > bl->firstlabel))
-+ codegen_patchclose(ls->fs, gt->pc, lb->nactvar);
-+ closegoto(ls, g, lb); /* close it */
-+ return 1;
-+ }
-+ }
-+ return 0; /* label not found; cannot close goto */
-+}
-+
-+static int newlabelentry(ktap_lexstate *ls, ktap_labellist *l, ktap_string *name,
-+ int line, int pc)
-+{
-+ int n = l->n;
-+
-+ ktapc_growvector(l->arr, n, l->size,
-+ ktap_labeldesc, SHRT_MAX, "labels/gotos");
-+ l->arr[n].name = name;
-+ l->arr[n].line = line;
-+ l->arr[n].nactvar = ls->fs->nactvar;
-+ l->arr[n].pc = pc;
-+ l->n++;
-+ return n;
-+}
-+
-+
-+/*
-+ * check whether new label 'lb' matches any pending gotos in current
-+ * block; solves forward jumps
-+ */
-+static void findgotos(ktap_lexstate *ls, ktap_labeldesc *lb)
-+{
-+ ktap_labellist *gl = &ls->dyd->gt;
-+ int i = ls->fs->bl->firstgoto;
-+
-+ while (i < gl->n) {
-+ if (ktapc_ts_eqstr(gl->arr[i].name, lb->name))
-+ closegoto(ls, i, lb);
-+ else
-+ i++;
-+ }
-+}
-+
-+/*
-+ * "export" pending gotos to outer level, to check them against
-+ * outer labels; if the block being exited has upvalues, and
-+ * the goto exits the scope of any variable (which can be the
-+ * upvalue), close those variables being exited.
-+ */
-+static void movegotosout(ktap_funcstate *fs, ktap_blockcnt *bl)
-+{
-+ int i = bl->firstgoto;
-+ ktap_labellist *gl = &fs->ls->dyd->gt;
-+
-+ /* correct pending gotos to current block and try to close it
-+ with visible labels */
-+ while (i < gl->n) {
-+ ktap_labeldesc *gt = &gl->arr[i];
-+
-+ if (gt->nactvar > bl->nactvar) {
-+ if (bl->upval)
-+ codegen_patchclose(fs, gt->pc, bl->nactvar);
-+ gt->nactvar = bl->nactvar;
-+ }
-+ if (!findlabel(fs->ls, i))
-+ i++; /* move to next one */
-+ }
-+}
-+
-+static void enterblock(ktap_funcstate *fs, ktap_blockcnt *bl, u8 isloop)
-+{
-+ bl->isloop = isloop;
-+ bl->nactvar = fs->nactvar;
-+ bl->firstlabel = fs->ls->dyd->label.n;
-+ bl->firstgoto = fs->ls->dyd->gt.n;
-+ bl->upval = 0;
-+ bl->previous = fs->bl;
-+ fs->bl = bl;
-+ ktap_assert(fs->freereg == fs->nactvar);
-+}
-+
-+
-+/*
-+ * create a label named "break" to resolve break statements
-+ */
-+static void breaklabel(ktap_lexstate *ls)
-+{
-+ ktap_string *n = ktapc_ts_new("break");
-+ int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc);
-+
-+ findgotos(ls, &ls->dyd->label.arr[l]);
-+}
-+
-+/*
-+ * generates an error for an undefined 'goto'; choose appropriate
-+ * message when label name is a reserved word (which can only be 'break')
-+ */
-+static void undefgoto(ktap_lexstate *ls, ktap_labeldesc *gt)
-+{
-+ const char *msg = isreserved(gt->name)
-+ ? "<%s> at line %d not inside a loop"
-+ : "no visible label " KTAP_QS " for <goto> at line %d";
-+
-+ msg = ktapc_sprintf(msg, getstr(gt->name), gt->line);
-+ semerror(ls, msg);
-+}
-+
-+static void leaveblock(ktap_funcstate *fs)
-+{
-+ ktap_blockcnt *bl = fs->bl;
-+ ktap_lexstate *ls = fs->ls;
-+ if (bl->previous && bl->upval) {
-+ /* create a 'jump to here' to close upvalues */
-+ int j = codegen_jump(fs);
-+
-+ codegen_patchclose(fs, j, bl->nactvar);
-+ codegen_patchtohere(fs, j);
-+ }
-+
-+ if (bl->isloop)
-+ breaklabel(ls); /* close pending breaks */
-+
-+ fs->bl = bl->previous;
-+ removevars(fs, bl->nactvar);
-+ ktap_assert(bl->nactvar == fs->nactvar);
-+ fs->freereg = fs->nactvar; /* free registers */
-+ ls->dyd->label.n = bl->firstlabel; /* remove local labels */
-+ if (bl->previous) /* inner block? */
-+ movegotosout(fs, bl); /* update pending gotos to outer block */
-+ else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */
-+ undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */
-+}
-+
-+/*
-+ * adds a new prototype into list of prototypes
-+ */
-+static ktap_proto *addprototype(ktap_lexstate *ls)
-+{
-+ ktap_proto *clp;
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_proto *f = fs->f; /* prototype of current function */
-+
-+ if (fs->np >= f->sizep) {
-+ int oldsize = f->sizep;
-+ ktapc_growvector(f->p, fs->np, f->sizep, ktap_proto *, MAXARG_Bx, "functions");
-+ while (oldsize < f->sizep)
-+ f->p[oldsize++] = NULL;
-+ }
-+ f->p[fs->np++] = clp = ktapc_newproto();
-+ return clp;
-+}
-+
-+/*
-+ * codes instruction to create new closure in parent function
-+ */
-+static void codeclosure(ktap_lexstate *ls, ktap_expdesc *v)
-+{
-+ ktap_funcstate *fs = ls->fs->prev;
-+ init_exp(v, VRELOCABLE, codegen_codeABx(fs, OP_CLOSURE, 0, fs->np - 1));
-+ codegen_exp2nextreg(fs, v); /* fix it at stack top (for GC) */
-+}
-+
-+static void open_func(ktap_lexstate *ls, ktap_funcstate *fs, ktap_blockcnt *bl)
-+{
-+ ktap_proto *f;
-+
-+ fs->prev = ls->fs; /* linked list of funcstates */
-+ fs->ls = ls;
-+ ls->fs = fs;
-+ fs->pc = 0;
-+ fs->lasttarget = 0;
-+ fs->jpc = NO_JUMP;
-+ fs->freereg = 0;
-+ fs->nk = 0;
-+ fs->np = 0;
-+ fs->nups = 0;
-+ fs->nlocvars = 0;
-+ fs->nactvar = 0;
-+ fs->firstlocal = ls->dyd->actvar.n;
-+ fs->bl = NULL;
-+ f = fs->f;
-+ f->source = ls->source;
-+ f->maxstacksize = 2; /* registers 0/1 are always valid */
-+ fs->h = ktapc_table_new();
-+ //table_resize(NULL, fs->h, 32, 32);
-+ enterblock(fs, bl, 0);
-+}
-+
-+static void close_func(ktap_lexstate *ls)
-+{
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_proto *f = fs->f;
-+
-+ codegen_ret(fs, 0, 0); /* final return */
-+ leaveblock(fs);
-+ ktapc_reallocvector(f->code, f->sizecode, fs->pc, ktap_instruction);
-+ f->sizecode = fs->pc;
-+ ktapc_reallocvector(f->lineinfo, f->sizelineinfo, fs->pc, int);
-+ f->sizelineinfo = fs->pc;
-+ ktapc_reallocvector(f->k, f->sizek, fs->nk, ktap_value);
-+ f->sizek = fs->nk;
-+ ktapc_reallocvector(f->p, f->sizep, fs->np, ktap_proto *);
-+ f->sizep = fs->np;
-+ ktapc_reallocvector(f->locvars, f->sizelocvars, fs->nlocvars, ktap_locvar);
-+ f->sizelocvars = fs->nlocvars;
-+ ktapc_reallocvector(f->upvalues, f->sizeupvalues, fs->nups, ktap_upvaldesc);
-+ f->sizeupvalues = fs->nups;
-+ ktap_assert((int)(fs->bl == NULL));
-+ ls->fs = fs->prev;
-+ /* last token read was anchored in defunct function; must re-anchor it */
-+ anchor_token(ls);
-+}
-+
-+
-+/*============================================================*/
-+/* GRAMMAR RULES */
-+/*============================================================*/
-+
-+/*
-+ * check whether current token is in the follow set of a block.
-+ * 'until' closes syntactical blocks, but do not close scope,
-+ * so it handled in separate.
-+ */
-+static int block_follow(ktap_lexstate *ls, int withuntil)
-+{
-+ switch (ls->t.token) {
-+ case TK_ELSE: case TK_ELSEIF:
-+ case TK_END: case TK_EOS:
-+ return 1;
-+ case TK_UNTIL:
-+ return withuntil;
-+ case '}':
-+ return 1;
-+ default:
-+ return 0;
-+ }
-+}
-+
-+static void statlist(ktap_lexstate *ls)
-+{
-+ /* statlist -> { stat [`;'] } */
-+ while (!block_follow(ls, 1)) {
-+ if (ls->t.token == TK_RETURN) {
-+ statement(ls);
-+ return; /* 'return' must be last statement */
-+ }
-+ statement(ls);
-+ }
-+}
-+
-+static void fieldsel(ktap_lexstate *ls, ktap_expdesc *v)
-+{
-+ /* fieldsel -> ['.' | ':'] NAME */
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_expdesc key;
-+
-+ codegen_exp2anyregup(fs, v);
-+ lex_next(ls); /* skip the dot or colon */
-+ checkname(ls, &key);
-+ codegen_indexed(fs, v, &key);
-+}
-+
-+static void yindex(ktap_lexstate *ls, ktap_expdesc *v)
-+{
-+ /* index -> '[' expr ']' */
-+ lex_next(ls); /* skip the '[' */
-+ expr(ls, v);
-+ codegen_exp2val(ls->fs, v);
-+ checknext(ls, ']');
-+}
-+
-+/*
-+ * {======================================================================
-+ * Rules for Constructors
-+ * =======================================================================
-+ */
-+struct ConsControl {
-+ ktap_expdesc v; /* last list item read */
-+ ktap_expdesc *t; /* table descriptor */
-+ int nh; /* total number of `record' elements */
-+ int na; /* total number of array elements */
-+ int tostore; /* number of array elements pending to be stored */
-+};
-+
-+static void recfield(ktap_lexstate *ls, struct ConsControl *cc)
-+{
-+ /* recfield -> (NAME | `['exp1`]') = exp1 */
-+ ktap_funcstate *fs = ls->fs;
-+ int reg = ls->fs->freereg;
-+ ktap_expdesc key, val;
-+ int rkkey;
-+
-+ if (ls->t.token == TK_NAME) {
-+ checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
-+ checkname(ls, &key);
-+ } else /* ls->t.token == '[' */
-+ yindex(ls, &key);
-+
-+ cc->nh++;
-+ checknext(ls, '=');
-+ rkkey = codegen_exp2RK(fs, &key);
-+ expr(ls, &val);
-+ codegen_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, codegen_exp2RK(fs, &val));
-+ fs->freereg = reg; /* free registers */
-+}
-+
-+static void closelistfield(ktap_funcstate *fs, struct ConsControl *cc)
-+{
-+ if (cc->v.k == VVOID)
-+ return; /* there is no list item */
-+ codegen_exp2nextreg(fs, &cc->v);
-+ cc->v.k = VVOID;
-+ if (cc->tostore == LFIELDS_PER_FLUSH) {
-+ codegen_setlist(fs, cc->t->u.info, cc->na, cc->tostore); /* flush */
-+ cc->tostore = 0; /* no more items pending */
-+ }
-+}
-+
-+static void lastlistfield(ktap_funcstate *fs, struct ConsControl *cc)
-+{
-+ if (cc->tostore == 0)
-+ return;
-+
-+ if (hasmultret(cc->v.k)) {
-+ codegen_setmultret(fs, &cc->v);
-+ codegen_setlist(fs, cc->t->u.info, cc->na, KTAP_MULTRET);
-+ cc->na--; /* do not count last expression (unknown number of elements) */
-+ } else {
-+ if (cc->v.k != VVOID)
-+ codegen_exp2nextreg(fs, &cc->v);
-+ codegen_setlist(fs, cc->t->u.info, cc->na, cc->tostore);
-+ }
-+}
-+
-+static void listfield(ktap_lexstate *ls, struct ConsControl *cc)
-+{
-+ /* listfield -> exp */
-+ expr(ls, &cc->v);
-+ checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor");
-+ cc->na++;
-+ cc->tostore++;
-+}
-+
-+static void field(ktap_lexstate *ls, struct ConsControl *cc)
-+{
-+ /* field -> listfield | recfield */
-+ switch(ls->t.token) {
-+ case TK_NAME: { /* may be 'listfield' or 'recfield' */
-+ if (lex_lookahead(ls) != '=') /* expression? */
-+ listfield(ls, cc);
-+ else
-+ recfield(ls, cc);
-+ break;
-+ }
-+ case '[': {
-+ recfield(ls, cc);
-+ break;
-+ }
-+ default:
-+ listfield(ls, cc);
-+ break;
-+ }
-+}
-+
-+static void constructor(ktap_lexstate *ls, ktap_expdesc *t)
-+{
-+ /* constructor -> '{' [ field { sep field } [sep] ] '}'
-+ sep -> ',' | ';' */
-+ ktap_funcstate *fs = ls->fs;
-+ int line = ls->linenumber;
-+ int pc = codegen_codeABC(fs, OP_NEWTABLE, 0, 0, 0);
-+ struct ConsControl cc;
-+
-+ cc.na = cc.nh = cc.tostore = 0;
-+ cc.t = t;
-+ init_exp(t, VRELOCABLE, pc);
-+ init_exp(&cc.v, VVOID, 0); /* no value (yet) */
-+ codegen_exp2nextreg(ls->fs, t); /* fix it at stack top */
-+ checknext(ls, '{');
-+ do {
-+ ktap_assert(cc.v.k == VVOID || cc.tostore > 0);
-+ if (ls->t.token == '}')
-+ break;
-+ closelistfield(fs, &cc);
-+ field(ls, &cc);
-+ } while (testnext(ls, ',') || testnext(ls, ';'));
-+ check_match(ls, '}', '{', line);
-+ lastlistfield(fs, &cc);
-+ SETARG_B(fs->f->code[pc], ktapc_int2fb(cc.na)); /* set initial array size */
-+ SETARG_C(fs->f->code[pc], ktapc_int2fb(cc.nh)); /* set initial table size */
-+}
-+
-+/* }====================================================================== */
-+
-+static void parlist(ktap_lexstate *ls)
-+{
-+ /* parlist -> [ param { `,' param } ] */
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_proto *f = fs->f;
-+ int nparams = 0;
-+ f->is_vararg = 0;
-+
-+ if (ls->t.token != ')') { /* is `parlist' not empty? */
-+ do {
-+ switch (ls->t.token) {
-+ case TK_NAME: { /* param -> NAME */
-+ new_localvar(ls, str_checkname(ls));
-+ nparams++;
-+ break;
-+ }
-+ case TK_DOTS: { /* param -> `...' */
-+ lex_next(ls);
-+ f->is_vararg = 1;
-+ break;
-+ }
-+ default:
-+ lex_syntaxerror(ls, "<name> or " KTAP_QL("...") " expected");
-+ }
-+ } while (!f->is_vararg && testnext(ls, ','));
-+ }
-+ adjustlocalvars(ls, nparams);
-+ f->numparams = (u8)(fs->nactvar);
-+ codegen_reserveregs(fs, fs->nactvar); /* reserve register for parameters */
-+}
-+
-+static void body(ktap_lexstate *ls, ktap_expdesc *e, int ismethod, int line)
-+{
-+ /* body -> `(' parlist `)' block END */
-+ ktap_funcstate new_fs;
-+ ktap_blockcnt bl;
-+
-+ new_fs.f = addprototype(ls);
-+ new_fs.f->linedefined = line;
-+ open_func(ls, &new_fs, &bl);
-+ checknext(ls, '(');
-+ if (ismethod) {
-+ new_localvarliteral(ls, "self"); /* create 'self' parameter */
-+ adjustlocalvars(ls, 1);
-+ }
-+ parlist(ls);
-+ checknext(ls, ')');
-+ checknext(ls, '{');
-+ statlist(ls);
-+ new_fs.f->lastlinedefined = ls->linenumber;
-+ checknext(ls, '}');
-+ //check_match(ls, TK_END, TK_FUNCTION, line);
-+ codeclosure(ls, e);
-+ close_func(ls);
-+}
-+
-+static void func_body_no_args(ktap_lexstate *ls, ktap_expdesc *e, int line)
-+{
-+ /* body -> `(' parlist `)' block END */
-+ ktap_funcstate new_fs;
-+ ktap_blockcnt bl;
-+
-+ new_fs.f = addprototype(ls);
-+ new_fs.f->linedefined = line;
-+ open_func(ls, &new_fs, &bl);
-+ checknext(ls, '{');
-+ statlist(ls);
-+ new_fs.f->lastlinedefined = ls->linenumber;
-+ checknext(ls, '}');
-+ //check_match(ls, TK_END, TK_FUNCTION, line);
-+ codeclosure(ls, e);
-+ close_func(ls);
-+}
-+
-+static int explist(ktap_lexstate *ls, ktap_expdesc *v)
-+{
-+ /* explist -> expr { `,' expr } */
-+ int n = 1; /* at least one expression */
-+
-+ expr(ls, v);
-+ while (testnext(ls, ',')) {
-+ codegen_exp2nextreg(ls->fs, v);
-+ expr(ls, v);
-+ n++;
-+ }
-+ return n;
-+}
-+
-+static void funcargs(ktap_lexstate *ls, ktap_expdesc *f, int line)
-+{
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_expdesc args;
-+ int base, nparams;
-+
-+ switch (ls->t.token) {
-+ case '(': { /* funcargs -> `(' [ explist ] `)' */
-+ lex_next(ls);
-+ if (ls->t.token == ')') /* arg list is empty? */
-+ args.k = VVOID;
-+ else {
-+ explist(ls, &args);
-+ codegen_setmultret(fs, &args);
-+ }
-+ check_match(ls, ')', '(', line);
-+ break;
-+ }
-+ case '{': { /* funcargs -> constructor */
-+ constructor(ls, &args);
-+ break;
-+ }
-+ case TK_STRING: { /* funcargs -> STRING */
-+ codestring(ls, &args, ls->t.seminfo.ts);
-+ lex_next(ls); /* must use `seminfo' before `next' */
-+ break;
-+ }
-+ default: {
-+ lex_syntaxerror(ls, "function arguments expected");
-+ }
-+ }
-+ ktap_assert(f->k == VNONRELOC);
-+ base = f->u.info; /* base register for call */
-+ if (hasmultret(args.k))
-+ nparams = KTAP_MULTRET; /* open call */
-+ else {
-+ if (args.k != VVOID)
-+ codegen_exp2nextreg(fs, &args); /* close last argument */
-+ nparams = fs->freereg - (base+1);
-+ }
-+ init_exp(f, VCALL, codegen_codeABC(fs, OP_CALL, base, nparams+1, 2));
-+ codegen_fixline(fs, line);
-+ fs->freereg = base+1; /* call remove function and arguments and leaves
-+ (unless changed) one result */
-+}
-+
-+/*
-+ * {======================================================================
-+ * Expression parsing
-+ * =======================================================================
-+ */
-+static void primaryexp(ktap_lexstate *ls, ktap_expdesc *v)
-+{
-+ /* primaryexp -> NAME | '(' expr ')' */
-+ switch (ls->t.token) {
-+ case '(': {
-+ int line = ls->linenumber;
-+
-+ lex_next(ls);
-+ expr(ls, v);
-+ check_match(ls, ')', '(', line);
-+ codegen_dischargevars(ls->fs, v);
-+ return;
-+ }
-+ case TK_NAME:
-+ singlevar(ls, v);
-+ return;
-+ default:
-+ lex_syntaxerror(ls, "unexpected symbol");
-+ }
-+}
-+
-+static void suffixedexp(ktap_lexstate *ls, ktap_expdesc *v)
-+{
-+ /* suffixedexp ->
-+ primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */
-+ ktap_funcstate *fs = ls->fs;
-+ int line = ls->linenumber;
-+
-+ primaryexp(ls, v);
-+ for (;;) {
-+ switch (ls->t.token) {
-+ case '.': { /* fieldsel */
-+ fieldsel(ls, v);
-+ break;
-+ }
-+ case '[': { /* `[' exp1 `]' */
-+ ktap_expdesc key;
-+ codegen_exp2anyregup(fs, v);
-+ yindex(ls, &key);
-+ codegen_indexed(fs, v, &key);
-+ break;
-+ }
-+ case ':': { /* `:' NAME funcargs */
-+ ktap_expdesc key;
-+ lex_next(ls);
-+ checkname(ls, &key);
-+ codegen_self(fs, v, &key);
-+ funcargs(ls, v, line);
-+ break;
-+ }
-+ case '(': case TK_STRING: case '{': { /* funcargs */
-+ codegen_exp2nextreg(fs, v);
-+ funcargs(ls, v, line);
-+ break;
-+ }
-+ default:
-+ return;
-+ }
-+ }
-+}
-+
-+static void simpleexp(ktap_lexstate *ls, ktap_expdesc *v)
-+{
-+ /* simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... |
-+ constructor | FUNCTION body | suffixedexp */
-+ switch (ls->t.token) {
-+ case TK_NUMBER: {
-+ init_exp(v, VKNUM, 0);
-+ v->u.nval = ls->t.seminfo.r;
-+ break;
-+ }
-+ case TK_STRING: {
-+ codestring(ls, v, ls->t.seminfo.ts);
-+ break;
-+ }
-+ case TK_KSYM: {
-+ init_exp(v, VKNUM, 0);
-+ v->u.nval =
-+ (ktap_number)find_kernel_symbol(getstr(ls->t.seminfo.ts));
-+ break;
-+ }
-+ case TK_NIL: {
-+ init_exp(v, VNIL, 0);
-+ break;
-+ }
-+ case TK_TRUE: {
-+ init_exp(v, VTRUE, 0);
-+ break;
-+ }
-+ case TK_FALSE: {
-+ init_exp(v, VFALSE, 0);
-+ break;
-+ }
-+ case TK_DOTS: { /* vararg */
-+ ktap_funcstate *fs = ls->fs;
-+ check_condition(ls, fs->f->is_vararg,
-+ "cannot use " KTAP_QL("...") " outside a vararg function");
-+ init_exp(v, VVARARG, codegen_codeABC(fs, OP_VARARG, 0, 1, 0));
-+ break;
-+ }
-+ case '{': { /* constructor */
-+ constructor(ls, v);
-+ return;
-+ }
-+ case TK_FUNCTION: {
-+ lex_next(ls);
-+ body(ls, v, 0, ls->linenumber);
-+ return;
-+ }
-+ case TK_ARGEVENT:
-+ init_exp(v, VEVENT, 0);
-+ break;
-+
-+ case TK_ARGNAME:
-+ init_exp(v, VEVENTNAME, 0);
-+ break;
-+ case TK_ARG1:
-+ case TK_ARG2:
-+ case TK_ARG3:
-+ case TK_ARG4:
-+ case TK_ARG5:
-+ case TK_ARG6:
-+ case TK_ARG7:
-+ case TK_ARG8:
-+ case TK_ARG9:
-+ init_exp(v, VEVENTARG, ls->t.token - TK_ARG1 + 1);
-+ break;
-+ default: {
-+ suffixedexp(ls, v);
-+ return;
-+ }
-+ }
-+ lex_next(ls);
-+}
-+
-+static UnOpr getunopr(int op)
-+{
-+ switch (op) {
-+ case TK_NOT: return OPR_NOT;
-+ case '-': return OPR_MINUS;
-+ case '#': return OPR_LEN;
-+ default: return OPR_NOUNOPR;
-+ }
-+}
-+
-+static BinOpr getbinopr(int op)
-+{
-+ switch (op) {
-+ case '+': return OPR_ADD;
-+ case '-': return OPR_SUB;
-+ case '*': return OPR_MUL;
-+ case '/': return OPR_DIV;
-+ case '%': return OPR_MOD;
-+ case '^': return OPR_POW;
-+ case TK_CONCAT: return OPR_CONCAT;
-+ case TK_NE: return OPR_NE;
-+ case TK_EQ: return OPR_EQ;
-+ case '<': return OPR_LT;
-+ case TK_LE: return OPR_LE;
-+ case '>': return OPR_GT;
-+ case TK_GE: return OPR_GE;
-+ case TK_AND: return OPR_AND;
-+ case TK_OR: return OPR_OR;
-+ default: return OPR_NOBINOPR;
-+ }
-+}
-+
-+static const struct {
-+ u8 left; /* left priority for each binary operator */
-+ u8 right; /* right priority */
-+} priority[] = { /* ORDER OPR */
-+ {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `*' `/' `%' */
-+ {10, 9}, {5, 4}, /* ^, .. (right associative) */
-+ {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */
-+ {3, 3}, {3, 3}, {3, 3}, /* !=, >, >= */
-+ {2, 2}, {1, 1} /* and, or */
-+};
-+
-+#define UNARY_PRIORITY 8 /* priority for unary operators */
-+
-+#define leavelevel(ls) (ls->nCcalls--)
-+
-+/*
-+ * subexpr -> (simpleexp | unop subexpr) { binop subexpr }
-+ * where `binop' is any binary operator with a priority higher than `limit'
-+ */
-+static BinOpr subexpr(ktap_lexstate *ls, ktap_expdesc *v, int limit)
-+{
-+ BinOpr op;
-+ UnOpr uop;
-+
-+ enterlevel(ls);
-+ uop = getunopr(ls->t.token);
-+ if (uop != OPR_NOUNOPR) {
-+ int line = ls->linenumber;
-+
-+ lex_next(ls);
-+ subexpr(ls, v, UNARY_PRIORITY);
-+ codegen_prefix(ls->fs, uop, v, line);
-+ } else
-+ simpleexp(ls, v);
-+
-+ /* expand while operators have priorities higher than `limit' */
-+ op = getbinopr(ls->t.token);
-+ while (op != OPR_NOBINOPR && priority[op].left > limit) {
-+ ktap_expdesc v2;
-+ BinOpr nextop;
-+ int line = ls->linenumber;
-+
-+ lex_next(ls);
-+ codegen_infix(ls->fs, op, v);
-+ /* read sub-expression with higher priority */
-+ nextop = subexpr(ls, &v2, priority[op].right);
-+ codegen_posfix(ls->fs, op, v, &v2, line);
-+ op = nextop;
-+ }
-+ leavelevel(ls);
-+ return op; /* return first untreated operator */
-+}
-+
-+static void expr(ktap_lexstate *ls, ktap_expdesc *v)
-+{
-+ subexpr(ls, v, 0);
-+}
-+
-+/* }==================================================================== */
-+
-+/*
-+ * {======================================================================
-+ * Rules for Statements
-+ * =======================================================================
-+ */
-+static void block(ktap_lexstate *ls)
-+{
-+ /* block -> statlist */
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_blockcnt bl;
-+
-+ enterblock(fs, &bl, 0);
-+ statlist(ls);
-+ leaveblock(fs);
-+}
-+
-+/*
-+ * structure to chain all variables in the left-hand side of an
-+ * assignment
-+ */
-+struct LHS_assign {
-+ struct LHS_assign *prev;
-+ ktap_expdesc v; /* variable (global, local, upvalue, or indexed) */
-+};
-+
-+/*
-+ * check whether, in an assignment to an upvalue/local variable, the
-+ * upvalue/local variable is begin used in a previous assignment to a
-+ * table. If so, save original upvalue/local value in a safe place and
-+ * use this safe copy in the previous assignment.
-+ */
-+static void check_conflict(ktap_lexstate *ls, struct LHS_assign *lh, ktap_expdesc *v)
-+{
-+ ktap_funcstate *fs = ls->fs;
-+ int extra = fs->freereg; /* eventual position to save local variable */
-+ int conflict = 0;
-+
-+ for (; lh; lh = lh->prev) { /* check all previous assignments */
-+ if (lh->v.k == VINDEXED) { /* assigning to a table? */
-+ /* table is the upvalue/local being assigned now? */
-+ if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) {
-+ conflict = 1;
-+ lh->v.u.ind.vt = VLOCAL;
-+ lh->v.u.ind.t = extra; /* previous assignment will use safe copy */
-+ }
-+ /* index is the local being assigned? (index cannot be upvalue) */
-+ if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) {
-+ conflict = 1;
-+ lh->v.u.ind.idx = extra; /* previous assignment will use safe copy */
-+ }
-+ }
-+ }
-+ if (conflict) {
-+ /* copy upvalue/local value to a temporary (in position 'extra') */
-+ OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL;
-+ codegen_codeABC(fs, op, extra, v->u.info, 0);
-+ codegen_reserveregs(fs, 1);
-+ }
-+}
-+
-+static void assignment(ktap_lexstate *ls, struct LHS_assign *lh, int nvars)
-+{
-+ ktap_expdesc e;
-+
-+ check_condition(ls, vkisvar(lh->v.k), "syntax error");
-+ if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */
-+ struct LHS_assign nv;
-+
-+ nv.prev = lh;
-+ suffixedexp(ls, &nv.v);
-+ if (nv.v.k != VINDEXED)
-+ check_conflict(ls, lh, &nv.v);
-+ checklimit(ls->fs, nvars + ls->nCcalls, KTAP_MAXCCALLS,
-+ "C levels");
-+ assignment(ls, &nv, nvars+1);
-+ } else if (testnext(ls, '=')) { /* assignment -> '=' explist */
-+ int nexps;
-+
-+ nexps = explist(ls, &e);
-+ if (nexps != nvars) {
-+ adjust_assign(ls, nvars, nexps, &e);
-+ /* remove extra values */
-+ if (nexps > nvars)
-+ ls->fs->freereg -= nexps - nvars;
-+ } else {
-+ /* close last expression */
-+ codegen_setoneret(ls->fs, &e);
-+ codegen_storevar(ls->fs, &lh->v, &e);
-+ return; /* avoid default */
-+ }
-+ } else if (testnext(ls, TK_INCR)) { /* assignment -> '+=' explist */
-+ int nexps;
-+
-+ nexps = explist(ls, &e);
-+ if (nexps != nvars) {
-+ lex_syntaxerror(ls, "don't allow multi-assign for +=");
-+ } else {
-+ /* close last expression */
-+ codegen_setoneret(ls->fs, &e);
-+ codegen_storeincr(ls->fs, &lh->v, &e);
-+ return; /* avoid default */
-+ }
-+ } else if (testnext(ls, TK_AGGR_ASSIGN)) { /* assignment -> '<<<' explist */
-+ int nexps;
-+
-+ nexps = explist(ls, &e);
-+ if (nexps != nvars) {
-+ lex_syntaxerror(ls, "don't allow multi-assign for <<<");
-+ } else {
-+ /* close last expression */
-+ codegen_setoneret(ls->fs, &e);
-+ codegen_store_aggr(ls->fs, &lh->v, &e);
-+ return; /* avoid default */
-+ }
-+ }
-+
-+ init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */
-+ codegen_storevar(ls->fs, &lh->v, &e);
-+}
-+
-+static int cond(ktap_lexstate *ls)
-+{
-+ /* cond -> exp */
-+ ktap_expdesc v;
-+ expr(ls, &v); /* read condition */
-+ if (v.k == VNIL)
-+ v.k = VFALSE; /* `falses' are all equal here */
-+ codegen_goiftrue(ls->fs, &v);
-+ return v.f;
-+}
-+
-+static void gotostat(ktap_lexstate *ls, int pc)
-+{
-+ int line = ls->linenumber;
-+ ktap_string *label;
-+ int g;
-+
-+ if (testnext(ls, TK_GOTO))
-+ label = str_checkname(ls);
-+ else {
-+ lex_next(ls); /* skip break */
-+ label = ktapc_ts_new("break");
-+ }
-+ g = newlabelentry(ls, &ls->dyd->gt, label, line, pc);
-+ findlabel(ls, g); /* close it if label already defined */
-+}
-+
-+/* check for repeated labels on the same block */
-+static void checkrepeated(ktap_funcstate *fs, ktap_labellist *ll, ktap_string *label)
-+{
-+ int i;
-+ for (i = fs->bl->firstlabel; i < ll->n; i++) {
-+ if (ktapc_ts_eqstr(label, ll->arr[i].name)) {
-+ const char *msg = ktapc_sprintf(
-+ "label " KTAP_QS " already defined on line %d",
-+ getstr(label), ll->arr[i].line);
-+ semerror(fs->ls, msg);
-+ }
-+ }
-+}
-+
-+/* skip no-op statements */
-+static void skipnoopstat(ktap_lexstate *ls)
-+{
-+ while (ls->t.token == ';' || ls->t.token == TK_DBCOLON)
-+ statement(ls);
-+}
-+
-+static void labelstat (ktap_lexstate *ls, ktap_string *label, int line)
-+{
-+ /* label -> '::' NAME '::' */
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_labellist *ll = &ls->dyd->label;
-+ int l; /* index of new label being created */
-+
-+ checkrepeated(fs, ll, label); /* check for repeated labels */
-+ checknext(ls, TK_DBCOLON); /* skip double colon */
-+ /* create new entry for this label */
-+ l = newlabelentry(ls, ll, label, line, fs->pc);
-+ skipnoopstat(ls); /* skip other no-op statements */
-+ if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */
-+ /* assume that locals are already out of scope */
-+ ll->arr[l].nactvar = fs->bl->nactvar;
-+ }
-+ findgotos(ls, &ll->arr[l]);
-+}
-+
-+static void whilestat(ktap_lexstate *ls, int line)
-+{
-+ /* whilestat -> WHILE cond DO block END */
-+ ktap_funcstate *fs = ls->fs;
-+ int whileinit;
-+ int condexit;
-+ ktap_blockcnt bl;
-+
-+ lex_next(ls); /* skip WHILE */
-+ whileinit = codegen_getlabel(fs);
-+ checknext(ls, '(');
-+ condexit = cond(ls);
-+ checknext(ls, ')');
-+
-+ enterblock(fs, &bl, 1);
-+ //checknext(ls, TK_DO);
-+ checknext(ls, '{');
-+ block(ls);
-+ codegen_jumpto(fs, whileinit);
-+ checknext(ls, '}');
-+ //check_match(ls, TK_END, TK_WHILE, line);
-+ leaveblock(fs);
-+ codegen_patchtohere(fs, condexit); /* false conditions finish the loop */
-+}
-+
-+static void repeatstat(ktap_lexstate *ls, int line)
-+{
-+ /* repeatstat -> REPEAT block UNTIL cond */
-+ int condexit;
-+ ktap_funcstate *fs = ls->fs;
-+ int repeat_init = codegen_getlabel(fs);
-+ ktap_blockcnt bl1, bl2;
-+
-+ enterblock(fs, &bl1, 1); /* loop block */
-+ enterblock(fs, &bl2, 0); /* scope block */
-+ lex_next(ls); /* skip REPEAT */
-+ statlist(ls);
-+ check_match(ls, TK_UNTIL, TK_REPEAT, line);
-+ condexit = cond(ls); /* read condition (inside scope block) */
-+ if (bl2.upval) /* upvalues? */
-+ codegen_patchclose(fs, condexit, bl2.nactvar);
-+ leaveblock(fs); /* finish scope */
-+ codegen_patchlist(fs, condexit, repeat_init); /* close the loop */
-+ leaveblock(fs); /* finish loop */
-+}
-+
-+static int exp1(ktap_lexstate *ls)
-+{
-+ ktap_expdesc e;
-+ int reg;
-+
-+ expr(ls, &e);
-+ codegen_exp2nextreg(ls->fs, &e);
-+ ktap_assert(e.k == VNONRELOC);
-+ reg = e.u.info;
-+ return reg;
-+}
-+
-+static void forbody(ktap_lexstate *ls, int base, int line, int nvars, int isnum)
-+{
-+ /* forbody -> DO block */
-+ ktap_blockcnt bl;
-+ ktap_funcstate *fs = ls->fs;
-+ int prep, endfor;
-+
-+ checknext(ls, ')');
-+
-+ adjustlocalvars(ls, 3); /* control variables */
-+ //checknext(ls, TK_DO);
-+ checknext(ls, '{');
-+ prep = isnum ? codegen_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : codegen_jump(fs);
-+ enterblock(fs, &bl, 0); /* scope for declared variables */
-+ adjustlocalvars(ls, nvars);
-+ codegen_reserveregs(fs, nvars);
-+ block(ls);
-+ leaveblock(fs); /* end of scope for declared variables */
-+ codegen_patchtohere(fs, prep);
-+ if (isnum) /* numeric for? */
-+ endfor = codegen_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP);
-+ else { /* generic for */
-+ codegen_codeABC(fs, OP_TFORCALL, base, 0, nvars);
-+ codegen_fixline(fs, line);
-+ endfor = codegen_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP);
-+ }
-+ codegen_patchlist(fs, endfor, prep + 1);
-+ codegen_fixline(fs, line);
-+}
-+
-+static void fornum(ktap_lexstate *ls, ktap_string *varname, int line)
-+{
-+ /* fornum -> NAME = exp1,exp1[,exp1] forbody */
-+ ktap_funcstate *fs = ls->fs;
-+ int base = fs->freereg;
-+
-+ new_localvarliteral(ls, "(for index)");
-+ new_localvarliteral(ls, "(for limit)");
-+ new_localvarliteral(ls, "(for step)");
-+ new_localvar(ls, varname);
-+ checknext(ls, '=');
-+ exp1(ls); /* initial value */
-+ checknext(ls, ',');
-+ exp1(ls); /* limit */
-+ if (testnext(ls, ','))
-+ exp1(ls); /* optional step */
-+ else { /* default step = 1 */
-+ codegen_codek(fs, fs->freereg, codegen_numberK(fs, 1));
-+ codegen_reserveregs(fs, 1);
-+ }
-+ forbody(ls, base, line, 1, 1);
-+}
-+
-+static void forlist(ktap_lexstate *ls, ktap_string *indexname)
-+{
-+ /* forlist -> NAME {,NAME} IN explist forbody */
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_expdesc e;
-+ int nvars = 4; /* gen, state, control, plus at least one declared var */
-+ int line;
-+ int base = fs->freereg;
-+
-+ /* create control variables */
-+ new_localvarliteral(ls, "(for generator)");
-+ new_localvarliteral(ls, "(for state)");
-+ new_localvarliteral(ls, "(for control)");
-+ /* create declared variables */
-+ new_localvar(ls, indexname);
-+ while (testnext(ls, ',')) {
-+ new_localvar(ls, str_checkname(ls));
-+ nvars++;
-+ }
-+ checknext(ls, TK_IN);
-+ line = ls->linenumber;
-+ adjust_assign(ls, 3, explist(ls, &e), &e);
-+ codegen_checkstack(fs, 3); /* extra space to call generator */
-+ forbody(ls, base, line, nvars - 3, 0);
-+}
-+
-+static void forstat(ktap_lexstate *ls, int line)
-+{
-+ /* forstat -> FOR (fornum | forlist) END */
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_string *varname;
-+ ktap_blockcnt bl;
-+
-+ enterblock(fs, &bl, 1); /* scope for loop and control variables */
-+ lex_next(ls); /* skip `for' */
-+
-+ checknext(ls, '(');
-+ varname = str_checkname(ls); /* first variable name */
-+ switch (ls->t.token) {
-+ case '=':
-+ fornum(ls, varname, line);
-+ break;
-+ case ',': case TK_IN:
-+ forlist(ls, varname);
-+ break;
-+ default:
-+ lex_syntaxerror(ls, KTAP_QL("=") " or " KTAP_QL("in") " expected");
-+ }
-+ //check_match(ls, TK_END, TK_FOR, line);
-+ checknext(ls, '}');
-+ leaveblock(fs); /* loop scope (`break' jumps to this point) */
-+}
-+
-+static void test_then_block(ktap_lexstate *ls, int *escapelist)
-+{
-+ /* test_then_block -> [IF | ELSEIF] cond THEN block */
-+ ktap_blockcnt bl;
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_expdesc v;
-+ int jf; /* instruction to skip 'then' code (if condition is false) */
-+
-+ lex_next(ls); /* skip IF or ELSEIF */
-+ checknext(ls, '(');
-+ expr(ls, &v); /* read condition */
-+ checknext(ls, ')');
-+ //checknext(ls, TK_THEN);
-+ checknext(ls, '{');
-+ if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) {
-+ codegen_goiffalse(ls->fs, &v); /* will jump to label if condition is true */
-+ enterblock(fs, &bl, 0); /* must enter block before 'goto' */
-+ gotostat(ls, v.t); /* handle goto/break */
-+ skipnoopstat(ls); /* skip other no-op statements */
-+ if (block_follow(ls, 0)) { /* 'goto' is the entire block? */
-+ leaveblock(fs);
-+ checknext(ls, '}');
-+ return; /* and that is it */
-+ } else /* must skip over 'then' part if condition is false */
-+ jf = codegen_jump(fs);
-+ } else { /* regular case (not goto/break) */
-+ codegen_goiftrue(ls->fs, &v); /* skip over block if condition is false */
-+ enterblock(fs, &bl, 0);
-+ jf = v.f;
-+ }
-+ statlist(ls); /* `then' part */
-+ checknext(ls, '}');
-+ leaveblock(fs);
-+ if (ls->t.token == TK_ELSE || ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */
-+ codegen_concat(fs, escapelist, codegen_jump(fs)); /* must jump over it */
-+ codegen_patchtohere(fs, jf);
-+}
-+
-+static void ifstat(ktap_lexstate *ls, int line)
-+{
-+ /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */
-+ ktap_funcstate *fs = ls->fs;
-+ int escapelist = NO_JUMP; /* exit list for finished parts */
-+
-+ test_then_block(ls, &escapelist); /* IF cond THEN block */
-+ while (ls->t.token == TK_ELSEIF)
-+ test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */
-+ if (testnext(ls, TK_ELSE)) {
-+ checknext(ls, '{');
-+ block(ls); /* `else' part */
-+ checknext(ls, '}');
-+ }
-+ //check_match(ls, TK_END, TK_IF, line);
-+ codegen_patchtohere(fs, escapelist); /* patch escape list to 'if' end */
-+}
-+
-+static void localfunc(ktap_lexstate *ls)
-+{
-+ ktap_expdesc b;
-+ ktap_funcstate *fs = ls->fs;
-+
-+ new_localvar(ls, str_checkname(ls)); /* new local variable */
-+ adjustlocalvars(ls, 1); /* enter its scope */
-+ body(ls, &b, 0, ls->linenumber); /* function created in next register */
-+ /* debug information will only see the variable after this point! */
-+ getlocvar(fs, b.u.info)->startpc = fs->pc;
-+}
-+
-+static void localstat(ktap_lexstate *ls)
-+{
-+ /* stat -> LOCAL NAME {`,' NAME} [`=' explist] */
-+ int nvars = 0;
-+ int nexps;
-+ ktap_expdesc e;
-+
-+ do {
-+ new_localvar(ls, str_checkname(ls));
-+ nvars++;
-+ } while (testnext(ls, ','));
-+ if (testnext(ls, '='))
-+ nexps = explist(ls, &e);
-+ else {
-+ e.k = VVOID;
-+ nexps = 0;
-+ }
-+ adjust_assign(ls, nvars, nexps, &e);
-+ adjustlocalvars(ls, nvars);
-+}
-+
-+static int funcname(ktap_lexstate *ls, ktap_expdesc *v)
-+{
-+ /* funcname -> NAME {fieldsel} [`:' NAME] */
-+ int ismethod = 0;
-+
-+ singlevar(ls, v);
-+ while (ls->t.token == '.')
-+ fieldsel(ls, v);
-+ if (ls->t.token == ':') {
-+ ismethod = 1;
-+ fieldsel(ls, v);
-+ }
-+ return ismethod;
-+}
-+
-+static void funcstat(ktap_lexstate *ls, int line)
-+{
-+ /* funcstat -> FUNCTION funcname body */
-+ int ismethod;
-+ ktap_expdesc v, b;
-+
-+ lex_next(ls); /* skip FUNCTION */
-+ ismethod = funcname(ls, &v);
-+ body(ls, &b, ismethod, line);
-+ codegen_storevar(ls->fs, &v, &b);
-+ codegen_fixline(ls->fs, line); /* definition `happens' in the first line */
-+}
-+
-+static void exprstat(ktap_lexstate *ls)
-+{
-+ /* stat -> func | assignment */
-+ ktap_funcstate *fs = ls->fs;
-+ struct LHS_assign v;
-+
-+ suffixedexp(ls, &v.v);
-+ /* stat -> assignment ? */
-+ if (ls->t.token == '=' || ls->t.token == ',' ||
-+ ls->t.token == TK_INCR || ls->t.token == TK_AGGR_ASSIGN) {
-+ v.prev = NULL;
-+ assignment(ls, &v, 1);
-+ } else { /* stat -> func */
-+ check_condition(ls, v.v.k == VCALL, "syntax error");
-+ SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */
-+ }
-+}
-+
-+static void retstat(ktap_lexstate *ls)
-+{
-+ /* stat -> RETURN [explist] [';'] */
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_expdesc e;
-+ int first, nret; /* registers with returned values */
-+
-+ if (block_follow(ls, 1) || ls->t.token == ';')
-+ first = nret = 0; /* return no values */
-+ else {
-+ nret = explist(ls, &e); /* optional return values */
-+ if (hasmultret(e.k)) {
-+ codegen_setmultret(fs, &e);
-+ if (e.k == VCALL && nret == 1) { /* tail call? */
-+ SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
-+ ktap_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
-+ }
-+ first = fs->nactvar;
-+ nret = KTAP_MULTRET; /* return all values */
-+ } else {
-+ if (nret == 1) /* only one single value? */
-+ first = codegen_exp2anyreg(fs, &e);
-+ else {
-+ codegen_exp2nextreg(fs, &e); /* values must go to the `stack' */
-+ first = fs->nactvar; /* return all `active' values */
-+ ktap_assert(nret == fs->freereg - first);
-+ }
-+ }
-+ }
-+ codegen_ret(fs, first, nret);
-+ testnext(ls, ';'); /* skip optional semicolon */
-+}
-+
-+static void tracestat(ktap_lexstate *ls)
-+{
-+ ktap_expdesc v0, key, args;
-+ ktap_expdesc *v = &v0;
-+ ktap_string *kdebug_str = ktapc_ts_new("kdebug");
-+ ktap_string *probe_str = ktapc_ts_new("probe_by_id");
-+ ktap_string *probe_end_str = ktapc_ts_new("probe_end");
-+ ktap_funcstate *fs = ls->fs;
-+ int token = ls->t.token;
-+ int line = ls->linenumber;
-+ int base, nparams;
-+
-+ if (token == TK_TRACE)
-+ lex_read_string_until(ls, '{');
-+ else
-+ lex_next(ls); /* skip "trace_end" keyword */
-+
-+ /* kdebug */
-+ singlevaraux(fs, ls->envn, v, 1); /* get environment variable */
-+ codestring(ls, &key, kdebug_str); /* key is variable name */
-+ codegen_indexed(fs, v, &key); /* env[varname] */
-+
-+ /* fieldsel: kdebug.probe */
-+ codegen_exp2anyregup(fs, v);
-+ if (token == TK_TRACE)
-+ codestring(ls, &key, probe_str);
-+ else if (token == TK_TRACE_END)
-+ codestring(ls, &key, probe_end_str);
-+ codegen_indexed(fs, v, &key);
-+
-+ /* funcargs*/
-+ codegen_exp2nextreg(fs, v);
-+
-+ if (token == TK_TRACE) {
-+ ktap_eventdef_info *evdef_info;
-+
-+ /* argument: EVENTDEF string */
-+ check(ls, TK_STRING);
-+ enterlevel(ls);
-+ evdef_info = ktapc_parse_eventdef(getstr(ls->t.seminfo.ts));
-+ check_condition(ls, evdef_info != NULL, "Cannot parse eventdef");
-+
-+ /* pass a userspace pointer to kernel */
-+ codenumber(ls, &args, (ktap_number)evdef_info);
-+ lex_next(ls); /* skip EVENTDEF string */
-+ leavelevel(ls);
-+
-+ codegen_exp2nextreg(fs, &args); /* for next argument */
-+ }
-+
-+ /* argument: callback function */
-+ enterlevel(ls);
-+ func_body_no_args(ls, &args, ls->linenumber);
-+ leavelevel(ls);
-+
-+ codegen_setmultret(fs, &args);
-+
-+ base = v->u.info; /* base register for call */
-+ if (hasmultret(args.k))
-+ nparams = KTAP_MULTRET; /* open call */
-+ else {
-+ codegen_exp2nextreg(fs, &args); /* close last argument */
-+ nparams = fs->freereg - (base+1);
-+ }
-+ init_exp(v, VCALL, codegen_codeABC(fs, OP_CALL, base, nparams+1, 2));
-+ codegen_fixline(fs, line);
-+ fs->freereg = base+1;
-+
-+ check_condition(ls, v->k == VCALL, "syntax error");
-+ SETARG_C(getcode(fs, v), 1); /* call statement uses no results */
-+}
-+
-+static void timerstat(ktap_lexstate *ls)
-+{
-+ ktap_expdesc v0, key, args;
-+ ktap_expdesc *v = &v0;
-+ ktap_funcstate *fs = ls->fs;
-+ ktap_string *token_str = ls->t.seminfo.ts;
-+ ktap_string *interval_str;
-+ int line = ls->linenumber;
-+ int base, nparams;
-+
-+ lex_next(ls); /* skip profile/tick keyword */
-+ check(ls, '-');
-+
-+ lex_read_string_until(ls, '{');
-+ interval_str = ls->t.seminfo.ts;
-+
-+ //printf("timerstat str: %s\n", getstr(interval_str));
-+ //exit(0);
-+
-+ /* timer */
-+ singlevaraux(fs, ls->envn, v, 1); /* get environment variable */
-+ codestring(ls, &key, ktapc_ts_new("timer")); /* key is variable name */
-+ codegen_indexed(fs, v, &key); /* env[varname] */
-+
-+ /* fieldsel: timer.profile, timer.tick */
-+ codegen_exp2anyregup(fs, v);
-+ codestring(ls, &key, token_str);
-+ codegen_indexed(fs, v, &key);
-+
-+ /* funcargs*/
-+ codegen_exp2nextreg(fs, v);
-+
-+ /* argument: interval string */
-+ check(ls, TK_STRING);
-+ enterlevel(ls);
-+ codestring(ls, &args, interval_str);
-+ lex_next(ls); /* skip interval string */
-+ leavelevel(ls);
-+
-+ codegen_exp2nextreg(fs, &args); /* for next argument */
-+
-+ /* argument: callback function */
-+ enterlevel(ls);
-+ func_body_no_args(ls, &args, ls->linenumber);
-+ leavelevel(ls);
-+
-+ codegen_setmultret(fs, &args);
-+
-+ base = v->u.info; /* base register for call */
-+ if (hasmultret(args.k))
-+ nparams = KTAP_MULTRET; /* open call */
-+ else {
-+ codegen_exp2nextreg(fs, &args); /* close last argument */
-+ nparams = fs->freereg - (base+1);
-+ }
-+ init_exp(v, VCALL, codegen_codeABC(fs, OP_CALL, base, nparams+1, 2));
-+ codegen_fixline(fs, line);
-+ fs->freereg = base+1;
-+
-+ check_condition(ls, v->k == VCALL, "syntax error");
-+ SETARG_C(getcode(fs, v), 1); /* call statement uses no results */
-+}
-+
-+/* we still keep cdef keyword even FFI feature is disabled, it just does
-+ * nothing and prints out a warning */
-+#ifdef CONFIG_KTAP_FFI
-+static void parsecdef(ktap_lexstate *ls)
-+{
-+ /* read long string cdef */
-+ lex_next(ls);
-+
-+ check(ls, TK_STRING);
-+ ffi_cdef(getstr(ls->t.seminfo.ts));
-+
-+ /* consume newline */
-+ lex_next(ls);
-+}
-+#else
-+static void parsecdef(ktap_lexstate *ls)
-+{
-+ printf("Please compile with FFI support to use cdef!\n");
-+ exit(EXIT_SUCCESS);
-+}
-+#endif
-+
-+
-+static void statement(ktap_lexstate *ls)
-+{
-+ int line = ls->linenumber; /* may be needed for error messages */
-+
-+ enterlevel(ls);
-+ switch (ls->t.token) {
-+ case ';': { /* stat -> ';' (empty statement) */
-+ lex_next(ls); /* skip ';' */
-+ break;
-+ }
-+ case TK_IF: { /* stat -> ifstat */
-+ ifstat(ls, line);
-+ break;
-+ }
-+ case TK_WHILE: { /* stat -> whilestat */
-+ whilestat(ls, line);
-+ break;
-+ }
-+ case TK_DO: { /* stat -> DO block END */
-+ lex_next(ls); /* skip DO */
-+ block(ls);
-+ check_match(ls, TK_END, TK_DO, line);
-+ break;
-+ }
-+ case TK_FOR: { /* stat -> forstat */
-+ forstat(ls, line);
-+ break;
-+ }
-+ case TK_REPEAT: { /* stat -> repeatstat */
-+ repeatstat(ls, line);
-+ break;
-+ }
-+ case TK_FUNCTION: { /* stat -> funcstat */
-+ funcstat(ls, line);
-+ break;
-+ }
-+ case TK_LOCAL: { /* stat -> localstat */
-+ lex_next(ls); /* skip LOCAL */
-+ if (testnext(ls, TK_FUNCTION)) /* local function? */
-+ localfunc(ls);
-+ else
-+ localstat(ls);
-+ break;
-+ }
-+ case TK_DBCOLON: { /* stat -> label */
-+ lex_next(ls); /* skip double colon */
-+ labelstat(ls, str_checkname(ls), line);
-+ break;
-+ }
-+ case TK_RETURN: { /* stat -> retstat */
-+ lex_next(ls); /* skip RETURN */
-+ retstat(ls);
-+ break;
-+ }
-+ case TK_BREAK: /* stat -> breakstat */
-+ case TK_GOTO: { /* stat -> 'goto' NAME */
-+ gotostat(ls, codegen_jump(ls->fs));
-+ break;
-+ }
-+
-+ case TK_TRACE:
-+ case TK_TRACE_END:
-+ tracestat(ls);
-+ break;
-+ case TK_PROFILE:
-+ case TK_TICK:
-+ timerstat(ls);
-+ break;
-+ case TK_FFI_CDEF:
-+ parsecdef(ls);
-+ break;
-+ default: { /* stat -> func | assignment */
-+ exprstat(ls);
-+ break;
-+ }
-+ }
-+ //ktap_assert(ls->fs->f->maxstacksize >= ls->fs->freereg &&
-+ // ls->fs->freereg >= ls->fs->nactvar);
-+ ls->fs->freereg = ls->fs->nactvar; /* free registers */
-+ leavelevel(ls);
-+}
-+/* }====================================================================== */
-+
-+/*
-+ * compiles the main function, which is a regular vararg function with an upvalue
-+ */
-+static void mainfunc(ktap_lexstate *ls, ktap_funcstate *fs)
-+{
-+ ktap_blockcnt bl;
-+ ktap_expdesc v;
-+
-+ open_func(ls, fs, &bl);
-+ fs->f->is_vararg = 1; /* main function is always vararg */
-+ init_exp(&v, VLOCAL, 0); /* create and... */
-+ newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */
-+ lex_next(ls); /* read first token */
-+ statlist(ls); /* parse main body */
-+ check(ls, TK_EOS);
-+ close_func(ls);
-+}
-+
-+ktap_closure *ktapc_parser(char *ptr, const char *name)
-+{
-+ ktap_lexstate lexstate;
-+ ktap_funcstate funcstate;
-+ ktap_dyndata dyd;
-+ ktap_mbuffer buff;
-+ int firstchar = *ptr++;
-+ ktap_closure *cl = ktapc_newclosure(1); /* create main closure */
-+
-+ memset(&lexstate, 0, sizeof(ktap_lexstate));
-+ memset(&funcstate, 0, sizeof(ktap_funcstate));
-+ funcstate.f = cl->p = ktapc_newproto();
-+ funcstate.f->source = ktapc_ts_new(name); /* create and anchor ktap_string */
-+
-+ lex_init();
-+
-+ mbuff_init(&buff);
-+ memset(&dyd, 0, sizeof(ktap_dyndata));
-+ lexstate.buff = &buff;
-+ lexstate.dyd = &dyd;
-+ lex_setinput(&lexstate, ptr, funcstate.f->source, firstchar);
-+
-+ mainfunc(&lexstate, &funcstate);
-+
-+ ktap_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs);
-+
-+ /* all scopes should be correctly finished */
-+ ktap_assert(dyd.actvar.n == 0 && dyd.gt.n == 0 && dyd.label.n == 0);
-+ return cl;
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/symbol.c
-@@ -0,0 +1,291 @@
-+/*
-+ * symbol.c
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2013 Azat Khuzhin <a3at.mail@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include "symbol.h"
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <unistd.h>
-+#include <fcntl.h>
-+#include <string.h>
-+
-+#include <libelf.h>
-+
-+static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
-+ GElf_Shdr *shp, const char *name)
-+{
-+ Elf_Scn *scn = NULL;
-+
-+ /* Elf is corrupted/truncated, avoid calling elf_strptr. */
-+ if (!elf_rawdata(elf_getscn(elf, ep->e_shstrndx), NULL))
-+ return NULL;
-+
-+ while ((scn = elf_nextscn(elf, scn)) != NULL) {
-+ char *str;
-+
-+ gelf_getshdr(scn, shp);
-+ str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name);
-+ if (!strcmp(name, str))
-+ break;
-+ }
-+
-+ return scn;
-+}
-+
-+/**
-+ * @return v_addr of "LOAD" program header, that have zero offset.
-+ */
-+static int find_load_address(Elf *elf, vaddr_t *load_address)
-+{
-+ GElf_Phdr phdr;
-+ size_t i, phdrnum;
-+
-+ if (elf_getphdrnum(elf, &phdrnum))
-+ return -1;
-+
-+ for (i = 0; i < phdrnum; i++) {
-+ if (gelf_getphdr(elf, i, &phdr) == NULL)
-+ return -1;
-+
-+ if (phdr.p_type != PT_LOAD || phdr.p_offset != 0)
-+ continue;
-+
-+ *load_address = phdr.p_vaddr;
-+ return 0;
-+ }
-+
-+ /* cannot found load address */
-+ return -1;
-+}
-+
-+static size_t elf_symbols(GElf_Shdr shdr)
-+{
-+ return shdr.sh_size / shdr.sh_entsize;
-+}
-+
-+static int dso_symbols(Elf *elf, symbol_actor actor, void *arg)
-+{
-+ Elf_Data *elf_data = NULL;
-+ Elf_Scn *scn = NULL;
-+ GElf_Sym sym;
-+ GElf_Shdr shdr;
-+ int symbols_count = 0;
-+ vaddr_t load_address;
-+
-+ if (find_load_address(elf, &load_address))
-+ return -1;
-+
-+ while ((scn = elf_nextscn(elf, scn))) {
-+ int i;
-+
-+ gelf_getshdr(scn, &shdr);
-+
-+ if (shdr.sh_type != SHT_SYMTAB)
-+ continue;
-+
-+ elf_data = elf_getdata(scn, elf_data);
-+
-+ for (i = 0; i < elf_symbols(shdr); i++) {
-+ char *name;
-+ vaddr_t addr;
-+ int ret;
-+
-+ gelf_getsym(elf_data, i, &sym);
-+
-+ if (GELF_ST_TYPE(sym.st_info) != STT_FUNC)
-+ continue;
-+
-+ name = elf_strptr(elf, shdr.sh_link, sym.st_name);
-+ addr = sym.st_value - load_address;
-+
-+ ret = actor(name, addr, arg);
-+ if (ret)
-+ return ret;
-+
-+ ++symbols_count;
-+ }
-+ }
-+
-+ return symbols_count;
-+}
-+
-+#define SDT_NOTE_TYPE 3
-+#define SDT_NOTE_COUNT 3
-+#define SDT_NOTE_SCN ".note.stapsdt"
-+#define SDT_NOTE_NAME "stapsdt"
-+
-+static vaddr_t sdt_note_addr(Elf *elf, const char *data, size_t len, int type)
-+{
-+ vaddr_t vaddr;
-+
-+ /*
-+ * Three addresses need to be obtained :
-+ * Marker location, address of base section and semaphore location
-+ */
-+ union {
-+ Elf64_Addr a64[3];
-+ Elf32_Addr a32[3];
-+ } buf;
-+
-+ /*
-+ * dst and src are required for translation from file to memory
-+ * representation
-+ */
-+ Elf_Data dst = {
-+ .d_buf = &buf, .d_type = ELF_T_ADDR, .d_version = EV_CURRENT,
-+ .d_size = gelf_fsize(elf, ELF_T_ADDR, SDT_NOTE_COUNT, EV_CURRENT),
-+ .d_off = 0, .d_align = 0
-+ };
-+
-+ Elf_Data src = {
-+ .d_buf = (void *) data, .d_type = ELF_T_ADDR,
-+ .d_version = EV_CURRENT, .d_size = dst.d_size, .d_off = 0,
-+ .d_align = 0
-+ };
-+
-+ /* Check the type of each of the notes */
-+ if (type != SDT_NOTE_TYPE)
-+ return 0;
-+
-+ if (len < dst.d_size + SDT_NOTE_COUNT)
-+ return 0;
-+
-+ /* Translation from file representation to memory representation */
-+ if (gelf_xlatetom(elf, &dst, &src,
-+ elf_getident(elf, NULL)[EI_DATA]) == NULL)
-+ return 0; /* TODO */
-+
-+ memcpy(&vaddr, &buf, sizeof(vaddr));
-+
-+ return vaddr;
-+}
-+
-+static const char *sdt_note_name(Elf *elf, GElf_Nhdr *nhdr, const char *data)
-+{
-+ const char *provider = data + gelf_fsize(elf,
-+ ELF_T_ADDR, SDT_NOTE_COUNT, EV_CURRENT);
-+ const char *name = (const char *)memchr(provider, '\0',
-+ data + nhdr->n_descsz - provider);
-+
-+ if (name++ == NULL)
-+ return NULL;
-+
-+ return name;
-+}
-+
-+static const char *sdt_note_data(const Elf_Data *data, size_t off)
-+{
-+ return ((data->d_buf) + off);
-+}
-+
-+static int dso_sdt_notes(Elf *elf, symbol_actor actor, void *arg)
-+{
-+ GElf_Ehdr ehdr;
-+ Elf_Scn *scn = NULL;
-+ Elf_Data *data;
-+ GElf_Shdr shdr;
-+ size_t shstrndx;
-+ size_t next;
-+ GElf_Nhdr nhdr;
-+ size_t name_off, desc_off, offset;
-+ vaddr_t vaddr = 0;
-+ int symbols_count = 0;
-+
-+ if (gelf_getehdr(elf, &ehdr) == NULL)
-+ return 0;
-+ if (elf_getshdrstrndx(elf, &shstrndx) != 0)
-+ return 0;
-+
-+ /*
-+ * Look for section type = SHT_NOTE, flags = no SHF_ALLOC
-+ * and name = .note.stapsdt
-+ */
-+ scn = elf_section_by_name(elf, &ehdr, &shdr, SDT_NOTE_SCN);
-+ if (!scn)
-+ return 0;
-+ if (!(shdr.sh_type == SHT_NOTE) || (shdr.sh_flags & SHF_ALLOC))
-+ return 0;
-+
-+ data = elf_getdata(scn, NULL);
-+
-+ for (offset = 0;
-+ (next = gelf_getnote(data, offset, &nhdr, &name_off, &desc_off)) > 0;
-+ offset = next) {
-+ const char *name;
-+ int ret;
-+
-+ if (nhdr.n_namesz != sizeof(SDT_NOTE_NAME) ||
-+ memcmp(data->d_buf + name_off, SDT_NOTE_NAME,
-+ sizeof(SDT_NOTE_NAME)))
-+ continue;
-+
-+ name = sdt_note_name(elf, &nhdr, sdt_note_data(data, desc_off));
-+ if (!name)
-+ continue;
-+
-+ vaddr = sdt_note_addr(elf, sdt_note_data(data, desc_off),
-+ nhdr.n_descsz, nhdr.n_type);
-+ if (!vaddr)
-+ continue;
-+
-+ ret = actor(name, vaddr, arg);
-+ if (ret)
-+ return ret;
-+
-+ ++symbols_count;
-+ }
-+
-+ return symbols_count;
-+}
-+
-+int parse_dso_symbols(const char *exec, int type, symbol_actor actor, void *arg)
-+{
-+ int symbols_count = 0;
-+ Elf *elf;
-+ int fd;
-+
-+ if (elf_version(EV_CURRENT) == EV_NONE)
-+ return -1;
-+
-+ fd = open(exec, O_RDONLY);
-+ if (fd < 0)
-+ return -1;
-+
-+ elf = elf_begin(fd, ELF_C_READ, NULL);
-+ if (elf) {
-+ switch (type) {
-+ case FIND_SYMBOL:
-+ symbols_count = dso_symbols(elf, actor, arg);
-+ break;
-+ case FIND_STAPSDT_NOTE:
-+ symbols_count = dso_sdt_notes(elf, actor, arg);
-+ break;
-+ }
-+
-+ elf_end(elf);
-+ }
-+
-+ close(fd);
-+ return symbols_count;
-+}
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/symbol.h
-@@ -0,0 +1,50 @@
-+/*
-+ * symbol.h - extract symbols from DSO.
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2013 Azat Khuzhin <a3at.mail@gmail.com>.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+
-+#define FIND_SYMBOL 1
-+#define FIND_STAPSDT_NOTE 2
-+
-+#ifndef NO_LIBELF
-+
-+#include <gelf.h>
-+#include <sys/queue.h>
-+
-+typedef GElf_Addr vaddr_t;
-+typedef int (*symbol_actor)(const char *name, vaddr_t addr, void *arg);
-+
-+/**
-+ * Parse all DSO symbols/sdt notes and all for every of them
-+ * an actor.
-+ *
-+ * @exec - path to DSO
-+ * @type - see FIND_*
-+ * @symbol_actor - actor to call (callback)
-+ * @arg - argument for @actor
-+ *
-+ * @return
-+ * If there have errors, return negative value;
-+ * No symbols found, return 0;
-+ * Otherwise return number of dso symbols found
-+ */
-+int
-+parse_dso_symbols(const char *exec, int type, symbol_actor actor, void *arg);
-+#endif
---- /dev/null
-+++ b/drivers/staging/ktap/userspace/util.c
-@@ -0,0 +1,381 @@
-+/*
-+ * util.c
-+ *
-+ * This file is part of ktap by Jovi Zhangwei.
-+ *
-+ * Copyright (C) 2012-2013 Jovi Zhangwei <jovi.zhangwei@gmail.com>.
-+ *
-+ * Copyright (C) 1994-2013 Lua.org, PUC-Rio.
-+ * - The part of code in this file is copied from lua initially.
-+ * - lua's MIT license is compatible with GPL.
-+ *
-+ * ktap is free software; you can redistribute it and/or modify it
-+ * under the terms and conditions of the GNU General Public License,
-+ * version 2, as published by the Free Software Foundation.
-+ *
-+ * ktap is distributed in the hope 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.
-+ *
-+ * You should have received a copy of the GNU General Public License along with
-+ * this program; if not, write to the Free Software Foundation, Inc.,
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-+ */
-+
-+#include <stdarg.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <math.h>
-+#include "../include/ktap_types.h"
-+#include "../include/ktap_opcodes.h"
-+#include "ktapc.h"
-+
-+/*
-+ * converts an integer to a "floating point byte", represented as
-+ * (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if
-+ * eeeee != 0 and (xxx) otherwise.
-+ */
-+int ktapc_int2fb(unsigned int x)
-+{
-+ int e = 0; /* exponent */
-+
-+ if (x < 8)
-+ return x;
-+ while (x >= 0x10) {
-+ x = (x+1) >> 1;
-+ e++;
-+ }
-+ return ((e+1) << 3) | ((int)x - 8);
-+}
-+
-+/* converts back */
-+int ktapc_fb2int(int x)
-+{
-+ int e = (x >> 3) & 0x1f;
-+
-+ if (e == 0)
-+ return x;
-+ else
-+ return ((x & 7) + 8) << (e - 1);
-+}
-+
-+int ktapc_ceillog2(unsigned int x)
-+{
-+ static const u8 log_2[256] = {
-+ 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
-+ };
-+ int l = 0;
-+
-+ x--;
-+ while (x >= 256) {
-+ l += 8;
-+ x >>= 8;
-+ }
-+ return l + log_2[x];
-+}
-+
-+ktap_number ktapc_arith(int op, ktap_number v1, ktap_number v2)
-+{
-+ switch (op) {
-+ case KTAP_OPADD: return NUMADD(v1, v2);
-+ case KTAP_OPSUB: return NUMSUB(v1, v2);
-+ case KTAP_OPMUL: return NUMMUL(v1, v2);
-+ case KTAP_OPDIV: return NUMDIV(v1, v2);
-+ case KTAP_OPMOD: return NUMMOD(v1, v2);
-+ //case KTAP_OPPOW: return NUMPOW(v1, v2);
-+ case KTAP_OPUNM: return NUMUNM(v1);
-+ default: ktap_assert(0); return 0;
-+ }
-+}
-+
-+int ktapc_hexavalue(int c)
-+{
-+ if (isdigit(c))
-+ return c - '0';
-+ else
-+ return tolower(c) - 'a' + 10;
-+}
-+
-+int ktapc_str2d(const char *s, size_t len, ktap_number *result)
-+{
-+ char *endptr;
-+
-+ if (strpbrk(s, "nN")) /* reject 'inf' and 'nan' */
-+ return 0;
-+ else
-+ *result = (long)strtoul(s, &endptr, 0);
-+
-+ if (endptr == s)
-+ return 0; /* nothing recognized */
-+ while (isspace((unsigned char)(*endptr)))
-+ endptr++;
-+ return (endptr == s + len); /* OK if no trailing characters */
-+}
-+
-+/* number of chars of a literal string without the ending \0 */
-+#define LL(x) (sizeof(x)/sizeof(char) - 1)
-+
-+#define RETS "..."
-+#define PRE "[string \""
-+#define POS "\"]"
-+
-+#define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) )
-+
-+void ktapc_chunkid(char *out, const char *source, size_t bufflen)
-+{
-+ size_t l = strlen(source);
-+
-+ if (*source == '=') { /* 'literal' source */
-+ if (l <= bufflen) /* small enough? */
-+ memcpy(out, source + 1, l * sizeof(char));
-+ else { /* truncate it */
-+ addstr(out, source + 1, bufflen - 1);
-+ *out = '\0';
-+ }
-+ } else if (*source == '@') { /* file name */
-+ if (l <= bufflen) /* small enough? */
-+ memcpy(out, source + 1, l * sizeof(char));
-+ else { /* add '...' before rest of name */
-+ addstr(out, RETS, LL(RETS));
-+ bufflen -= LL(RETS);
-+ memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char));
-+ }
-+ } else { /* string; format as [string "source"] */
-+ const char *nl = strchr(source, '\n'); /* find first new line (if any) */
-+ addstr(out, PRE, LL(PRE)); /* add prefix */
-+ bufflen -= LL(PRE RETS POS) + 1; /* save space for prefix+suffix+'\0' */
-+ if (l < bufflen && nl == NULL) { /* small one-line source? */
-+ addstr(out, source, l); /* keep it */
-+ } else {
-+ if (nl != NULL)
-+ l = nl - source; /* stop at first newline */
-+ if (l > bufflen)
-+ l = bufflen;
-+ addstr(out, source, l);
-+ addstr(out, RETS, LL(RETS));
-+ }
-+ memcpy(out, POS, (LL(POS) + 1) * sizeof(char));
-+ }
-+}
-+
-+
-+/*
-+ * strglobmatch is copyed from perf(linux/tools/perf/util/string.c)
-+ */
-+
-+/* Character class matching */
-+static bool __match_charclass(const char *pat, char c, const char **npat)
-+{
-+ bool complement = false, ret = true;
-+
-+ if (*pat == '!') {
-+ complement = true;
-+ pat++;
-+ }
-+ if (*pat++ == c) /* First character is special */
-+ goto end;
-+
-+ while (*pat && *pat != ']') { /* Matching */
-+ if (*pat == '-' && *(pat + 1) != ']') { /* Range */
-+ if (*(pat - 1) <= c && c <= *(pat + 1))
-+ goto end;
-+ if (*(pat - 1) > *(pat + 1))
-+ goto error;
-+ pat += 2;
-+ } else if (*pat++ == c)
-+ goto end;
-+ }
-+ if (!*pat)
-+ goto error;
-+ ret = false;
-+
-+end:
-+ while (*pat && *pat != ']') /* Searching closing */
-+ pat++;
-+ if (!*pat)
-+ goto error;
-+ *npat = pat + 1;
-+ return complement ? !ret : ret;
-+
-+error:
-+ return false;
-+}
-+
-+/* Glob/lazy pattern matching */
-+static bool __match_glob(const char *str, const char *pat, bool ignore_space)
-+{
-+ while (*str && *pat && *pat != '*') {
-+ if (ignore_space) {
-+ /* Ignore spaces for lazy matching */
-+ if (isspace(*str)) {
-+ str++;
-+ continue;
-+ }
-+ if (isspace(*pat)) {
-+ pat++;
-+ continue;
-+ }
-+ }
-+ if (*pat == '?') { /* Matches any single character */
-+ str++;
-+ pat++;
-+ continue;
-+ } else if (*pat == '[') /* Character classes/Ranges */
-+ if (__match_charclass(pat + 1, *str, &pat)) {
-+ str++;
-+ continue;
-+ } else
-+ return false;
-+ else if (*pat == '\\') /* Escaped char match as normal char */
-+ pat++;
-+ if (*str++ != *pat++)
-+ return false;
-+ }
-+ /* Check wild card */
-+ if (*pat == '*') {
-+ while (*pat == '*')
-+ pat++;
-+ if (!*pat) /* Tail wild card matches all */
-+ return true;
-+ while (*str)
-+ if (__match_glob(str++, pat, ignore_space))
-+ return true;
-+ }
-+ return !*str && !*pat;
-+}
-+
-+/**
-+ * strglobmatch - glob expression pattern matching
-+ * @str: the target string to match
-+ * @pat: the pattern string to match
-+ *
-+ * This returns true if the @str matches @pat. @pat can includes wildcards
-+ * ('*','?') and character classes ([CHARS], complementation and ranges are
-+ * also supported). Also, this supports escape character ('\') to use special
-+ * characters as normal character.
-+ *
-+ * Note: if @pat syntax is broken, this always returns false.
-+ */
-+bool strglobmatch(const char *str, const char *pat)
-+{
-+ return __match_glob(str, pat, false);
-+}
-+
-+#define handle_error(str) do { perror(str); exit(-1); } while(0)
-+
-+#define KALLSYMS_PATH "/proc/kallsyms"
-+/*
-+ * read kernel symbol from /proc/kallsyms
-+ */
-+int kallsyms_parse(void *arg,
-+ int(*process_symbol)(void *arg, const char *name,
-+ char type, unsigned long start))
-+{
-+ int ret = 0;
-+ FILE *file;
-+ char *line = NULL;
-+
-+ file = fopen(KALLSYMS_PATH, "r");
-+ if (file == NULL)
-+ handle_error("open " KALLSYMS_PATH " failed");
-+
-+ while (!feof(file)) {
-+ char *symbol_addr, *symbol_name;
-+ char symbol_type;
-+ unsigned long start;
-+ int line_len;
-+ size_t n;
-+
-+ line_len = getline(&line, &n, file);
-+ if (line_len < 0 || !line)
-+ break;
-+
-+ line[--line_len] = '\0'; /* \n */
-+
-+ symbol_addr = strtok(line, " \t");
-+ start = strtoul(symbol_addr, NULL, 16);
-+
-+ symbol_type = *strtok(NULL, " \t");
-+ symbol_name = strtok(NULL, " \t");
-+
-+ ret = process_symbol(arg, symbol_name, symbol_type, start);
-+ if (ret)
-+ break;
-+ }
-+
-+ free(line);
-+ fclose(file);
-+
-+ return ret;
-+}
-+
-+struct ksym_addr_t {
-+ const char *name;
-+ unsigned long addr;
-+};
-+
-+static int symbol_cmp(void *arg, const char *name, char type,
-+ unsigned long start)
-+{
-+ struct ksym_addr_t *base = arg;
-+
-+ if (strcmp(base->name, name) == 0) {
-+ base->addr = start;
-+ return 1;
-+ }
-+
-+ return 0;
-+}
-+
-+unsigned long find_kernel_symbol(const char *symbol)
-+{
-+ int ret;
-+ struct ksym_addr_t arg = {
-+ .name = symbol,
-+ .addr = 0
-+ };
-+
-+ ret = kallsyms_parse(&arg, symbol_cmp);
-+ if (ret < 0 || arg.addr == 0) {
-+ fprintf(stderr, "cannot read kernel symbol \"%s\" in %s\n",
-+ symbol, KALLSYMS_PATH);
-+ exit(EXIT_FAILURE);
-+ }
-+
-+ return arg.addr;
-+}
-+
-+
-+#define AVAILABLE_EVENTS_PATH "/sys/kernel/debug/tracing/available_events"
-+
-+void list_available_events(const char *match)
-+{
-+ FILE *file;
-+ char *line = NULL;
-+
-+ file = fopen(AVAILABLE_EVENTS_PATH, "r");
-+ if (file == NULL)
-+ handle_error("open " AVAILABLE_EVENTS_PATH " failed");
-+
-+ while (!feof(file)) {
-+ size_t n;
-+
-+ getline(&line, &n, file);
-+
-+ if (!match || strglobmatch(line, match))
-+ printf("%s", line);
-+ }
-+
-+ free(line);
-+ fclose(file);
-+}
-+
diff --git a/patches.ltsi/ltsi-makefile-addition.patch b/patches.ltsi/ltsi-makefile-addition.patch
index 7ece1962475aeb..1c591502825874 100644
--- a/patches.ltsi/ltsi-makefile-addition.patch
+++ b/patches.ltsi/ltsi-makefile-addition.patch
@@ -17,10 +17,10 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+++ b/Makefile
@@ -1,7 +1,7 @@
VERSION = 4
- PATCHLEVEL = 1
- SUBLEVEL = 42
+ PATCHLEVEL = 9
+ SUBLEVEL = 40
-EXTRAVERSION =
+EXTRAVERSION = -ltsi
- NAME = Series 4800
+ NAME = Roaring Lionus
# *DOCUMENTATION*
diff --git a/patches.misc/input-add-support-for-rohm-bu21023-24-touchscreen.patch b/patches.misc/input-add-support-for-rohm-bu21023-24-touchscreen.patch
deleted file mode 100644
index a3e8d06dee2240..00000000000000
--- a/patches.misc/input-add-support-for-rohm-bu21023-24-touchscreen.patch
+++ /dev/null
@@ -1,1262 +0,0 @@
-From c7efd123500b11568ce928a5cd91ad132ec36df5 Mon Sep 17 00:00:00 2001
-From: Yoichi Yuasa <yuasa@linux-mips.org>
-Date: Sat, 19 Sep 2015 11:34:30 -0700
-Subject: [PATCH] Input: add support for ROHM BU21023/24 touchscreen
-
-This adds support for ROHM BU21023/24 Dual touch resistive touchscreens.
-
-Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-
----
- drivers/input/touchscreen/Kconfig | 11
- drivers/input/touchscreen/Makefile | 1
- drivers/input/touchscreen/rohm_bu21023.c | 1218 +++++++++++++++++++++++++++++++
- 3 files changed, 1230 insertions(+)
-
---- a/drivers/input/touchscreen/Kconfig
-+++ b/drivers/input/touchscreen/Kconfig
-@@ -1027,4 +1027,15 @@ config TOUCHSCREEN_ZFORCE
- To compile this driver as a module, choose M here: the
- module will be called zforce_ts.
-
-+config TOUCHSCREEN_ROHM_BU21023
-+ tristate "ROHM BU21023/24 Dual touch support resistive touchscreens"
-+ depends on I2C
-+ help
-+ Say Y here if you have a touchscreen using ROHM BU21023/24.
-+
-+ If unsure, say N.
-+
-+ To compile this driver as a module, choose M here: the
-+ module will be called bu21023_ts.
-+
- endif
---- a/drivers/input/touchscreen/Makefile
-+++ b/drivers/input/touchscreen/Makefile
-@@ -84,3 +84,4 @@ obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90
- obj-$(CONFIG_TOUCHSCREEN_SX8654) += sx8654.o
- obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o
- obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o
-+obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o
---- /dev/null
-+++ b/drivers/input/touchscreen/rohm_bu21023.c
-@@ -0,0 +1,1218 @@
-+/*
-+ * ROHM BU21023/24 Dual touch support resistive touch screen driver
-+ * Copyright (C) 2012 ROHM CO.,LTD.
-+ *
-+ * This software is licensed under the terms of the GNU General Public
-+ * License version 2, as published by the Free Software Foundation, and
-+ * may be copied, distributed, and modified under those terms.
-+ *
-+ * 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/delay.h>
-+#include <linux/firmware.h>
-+#include <linux/i2c.h>
-+#include <linux/input.h>
-+#include <linux/input/mt.h>
-+#include <linux/interrupt.h>
-+#include <linux/module.h>
-+#include <linux/slab.h>
-+
-+#define BU21023_NAME "bu21023_ts"
-+#define BU21023_FIRMWARE_NAME "bu21023.bin"
-+
-+#define MAX_CONTACTS 2
-+
-+#define AXIS_ADJUST 4
-+#define AXIS_OFFSET 8
-+
-+#define FIRMWARE_BLOCK_SIZE 32U
-+#define FIRMWARE_RETRY_MAX 4
-+
-+#define SAMPLING_DELAY 12 /* msec */
-+
-+#define CALIBRATION_RETRY_MAX 6
-+
-+#define ROHM_TS_ABS_X_MIN 40
-+#define ROHM_TS_ABS_X_MAX 990
-+#define ROHM_TS_ABS_Y_MIN 160
-+#define ROHM_TS_ABS_Y_MAX 920
-+#define ROHM_TS_DISPLACEMENT_MAX 0 /* zero for infinite */
-+
-+/*
-+ * BU21023GUL/BU21023MUV/BU21024FV-M registers map
-+ */
-+#define VADOUT_YP_H 0x00
-+#define VADOUT_YP_L 0x01
-+#define VADOUT_XP_H 0x02
-+#define VADOUT_XP_L 0x03
-+#define VADOUT_YN_H 0x04
-+#define VADOUT_YN_L 0x05
-+#define VADOUT_XN_H 0x06
-+#define VADOUT_XN_L 0x07
-+
-+#define PRM1_X_H 0x08
-+#define PRM1_X_L 0x09
-+#define PRM1_Y_H 0x0a
-+#define PRM1_Y_L 0x0b
-+#define PRM2_X_H 0x0c
-+#define PRM2_X_L 0x0d
-+#define PRM2_Y_H 0x0e
-+#define PRM2_Y_L 0x0f
-+
-+#define MLT_PRM_MONI_X 0x10
-+#define MLT_PRM_MONI_Y 0x11
-+
-+#define DEBUG_MONI_1 0x12
-+#define DEBUG_MONI_2 0x13
-+
-+#define VADOUT_ZX_H 0x14
-+#define VADOUT_ZX_L 0x15
-+#define VADOUT_ZY_H 0x16
-+#define VADOUT_ZY_L 0x17
-+
-+#define Z_PARAM_H 0x18
-+#define Z_PARAM_L 0x19
-+
-+/*
-+ * Value for VADOUT_*_L
-+ */
-+#define VADOUT_L_MASK 0x01
-+
-+/*
-+ * Value for PRM*_*_L
-+ */
-+#define PRM_L_MASK 0x01
-+
-+#define POS_X1_H 0x20
-+#define POS_X1_L 0x21
-+#define POS_Y1_H 0x22
-+#define POS_Y1_L 0x23
-+#define POS_X2_H 0x24
-+#define POS_X2_L 0x25
-+#define POS_Y2_H 0x26
-+#define POS_Y2_L 0x27
-+
-+/*
-+ * Value for POS_*_L
-+ */
-+#define POS_L_MASK 0x01
-+
-+#define TOUCH 0x28
-+#define TOUCH_DETECT 0x01
-+
-+#define TOUCH_GESTURE 0x29
-+#define SINGLE_TOUCH 0x01
-+#define DUAL_TOUCH 0x03
-+#define TOUCH_MASK 0x03
-+#define CALIBRATION_REQUEST 0x04
-+#define CALIBRATION_STATUS 0x08
-+#define CALIBRATION_MASK 0x0c
-+#define GESTURE_SPREAD 0x10
-+#define GESTURE_PINCH 0x20
-+#define GESTURE_ROTATE_R 0x40
-+#define GESTURE_ROTATE_L 0x80
-+
-+#define INT_STATUS 0x2a
-+#define INT_MASK 0x3d
-+#define INT_CLEAR 0x3e
-+
-+/*
-+ * Values for INT_*
-+ */
-+#define COORD_UPDATE 0x01
-+#define CALIBRATION_DONE 0x02
-+#define SLEEP_IN 0x04
-+#define SLEEP_OUT 0x08
-+#define PROGRAM_LOAD_DONE 0x10
-+#define ERROR 0x80
-+#define INT_ALL 0x9f
-+
-+#define ERR_STATUS 0x2b
-+#define ERR_MASK 0x3f
-+
-+/*
-+ * Values for ERR_*
-+ */
-+#define ADC_TIMEOUT 0x01
-+#define CPU_TIMEOUT 0x02
-+#define CALIBRATION_ERR 0x04
-+#define PROGRAM_LOAD_ERR 0x10
-+
-+#define COMMON_SETUP1 0x30
-+#define PROGRAM_LOAD_HOST 0x02
-+#define PROGRAM_LOAD_EEPROM 0x03
-+#define CENSOR_4PORT 0x04
-+#define CENSOR_8PORT 0x00 /* Not supported by BU21023 */
-+#define CALIBRATION_TYPE_DEFAULT 0x08
-+#define CALIBRATION_TYPE_SPECIAL 0x00
-+#define INT_ACTIVE_HIGH 0x10
-+#define INT_ACTIVE_LOW 0x00
-+#define AUTO_CALIBRATION 0x40
-+#define MANUAL_CALIBRATION 0x00
-+#define COMMON_SETUP1_DEFAULT 0x4e
-+
-+#define COMMON_SETUP2 0x31
-+#define MAF_NONE 0x00
-+#define MAF_1SAMPLE 0x01
-+#define MAF_3SAMPLES 0x02
-+#define MAF_5SAMPLES 0x03
-+#define INV_Y 0x04
-+#define INV_X 0x08
-+#define SWAP_XY 0x10
-+
-+#define COMMON_SETUP3 0x32
-+#define EN_SLEEP 0x01
-+#define EN_MULTI 0x02
-+#define EN_GESTURE 0x04
-+#define EN_INTVL 0x08
-+#define SEL_STEP 0x10
-+#define SEL_MULTI 0x20
-+#define SEL_TBL_DEFAULT 0x40
-+
-+#define INTERVAL_TIME 0x33
-+#define INTERVAL_TIME_DEFAULT 0x10
-+
-+#define STEP_X 0x34
-+#define STEP_X_DEFAULT 0x41
-+
-+#define STEP_Y 0x35
-+#define STEP_Y_DEFAULT 0x8d
-+
-+#define OFFSET_X 0x38
-+#define OFFSET_X_DEFAULT 0x0c
-+
-+#define OFFSET_Y 0x39
-+#define OFFSET_Y_DEFAULT 0x0c
-+
-+#define THRESHOLD_TOUCH 0x3a
-+#define THRESHOLD_TOUCH_DEFAULT 0xa0
-+
-+#define THRESHOLD_GESTURE 0x3b
-+#define THRESHOLD_GESTURE_DEFAULT 0x17
-+
-+#define SYSTEM 0x40
-+#define ANALOG_POWER_ON 0x01
-+#define ANALOG_POWER_OFF 0x00
-+#define CPU_POWER_ON 0x02
-+#define CPU_POWER_OFF 0x00
-+
-+#define FORCE_CALIBRATION 0x42
-+#define FORCE_CALIBRATION_ON 0x01
-+#define FORCE_CALIBRATION_OFF 0x00
-+
-+#define CPU_FREQ 0x50 /* 10 / (reg + 1) MHz */
-+#define CPU_FREQ_10MHZ 0x00
-+#define CPU_FREQ_5MHZ 0x01
-+#define CPU_FREQ_1MHZ 0x09
-+
-+#define EEPROM_ADDR 0x51
-+
-+#define CALIBRATION_ADJUST 0x52
-+#define CALIBRATION_ADJUST_DEFAULT 0x00
-+
-+#define THRESHOLD_SLEEP_IN 0x53
-+
-+#define EVR_XY 0x56
-+#define EVR_XY_DEFAULT 0x10
-+
-+#define PRM_SWOFF_TIME 0x57
-+#define PRM_SWOFF_TIME_DEFAULT 0x04
-+
-+#define PROGRAM_VERSION 0x5f
-+
-+#define ADC_CTRL 0x60
-+#define ADC_DIV_MASK 0x1f /* The minimum value is 4 */
-+#define ADC_DIV_DEFAULT 0x08
-+
-+#define ADC_WAIT 0x61
-+#define ADC_WAIT_DEFAULT 0x0a
-+
-+#define SWCONT 0x62
-+#define SWCONT_DEFAULT 0x0f
-+
-+#define EVR_X 0x63
-+#define EVR_X_DEFAULT 0x86
-+
-+#define EVR_Y 0x64
-+#define EVR_Y_DEFAULT 0x64
-+
-+#define TEST1 0x65
-+#define DUALTOUCH_STABILIZE_ON 0x01
-+#define DUALTOUCH_STABILIZE_OFF 0x00
-+#define DUALTOUCH_REG_ON 0x20
-+#define DUALTOUCH_REG_OFF 0x00
-+
-+#define CALIBRATION_REG1 0x68
-+#define CALIBRATION_REG1_DEFAULT 0xd9
-+
-+#define CALIBRATION_REG2 0x69
-+#define CALIBRATION_REG2_DEFAULT 0x36
-+
-+#define CALIBRATION_REG3 0x6a
-+#define CALIBRATION_REG3_DEFAULT 0x32
-+
-+#define EX_ADDR_H 0x70
-+#define EX_ADDR_L 0x71
-+#define EX_WDAT 0x72
-+#define EX_RDAT 0x73
-+#define EX_CHK_SUM1 0x74
-+#define EX_CHK_SUM2 0x75
-+#define EX_CHK_SUM3 0x76
-+
-+struct rohm_ts_data {
-+ struct i2c_client *client;
-+ struct input_dev *input;
-+
-+ bool initialized;
-+
-+ unsigned int contact_count[MAX_CONTACTS + 1];
-+ int finger_count;
-+
-+ u8 setup2;
-+};
-+
-+/*
-+ * rohm_i2c_burst_read - execute combined I2C message for ROHM BU21023/24
-+ * @client: Handle to ROHM BU21023/24
-+ * @start: Where to start read address from ROHM BU21023/24
-+ * @buf: Where to store read data from ROHM BU21023/24
-+ * @len: How many bytes to read
-+ *
-+ * Returns negative errno, else zero on success.
-+ *
-+ * Note
-+ * In BU21023/24 burst read, stop condition is needed after "address write".
-+ * Therefore, transmission is performed in 2 steps.
-+ */
-+static int rohm_i2c_burst_read(struct i2c_client *client, u8 start, void *buf,
-+ size_t len)
-+{
-+ struct i2c_adapter *adap = client->adapter;
-+ struct i2c_msg msg[2];
-+ int i, ret = 0;
-+
-+ msg[0].addr = client->addr;
-+ msg[0].flags = 0;
-+ msg[0].len = 1;
-+ msg[0].buf = &start;
-+
-+ msg[1].addr = client->addr;
-+ msg[1].flags = I2C_M_RD;
-+ msg[1].len = len;
-+ msg[1].buf = buf;
-+
-+ i2c_lock_adapter(adap);
-+
-+ for (i = 0; i < 2; i++) {
-+ if (__i2c_transfer(adap, &msg[i], 1) < 0) {
-+ ret = -EIO;
-+ break;
-+ }
-+ }
-+
-+ i2c_unlock_adapter(adap);
-+
-+ return ret;
-+}
-+
-+static int rohm_ts_manual_calibration(struct rohm_ts_data *ts)
-+{
-+ struct i2c_client *client = ts->client;
-+ struct device *dev = &client->dev;
-+ u8 buf[33]; /* for PRM1_X_H(0x08)-TOUCH(0x28) */
-+
-+ int retry;
-+ bool success = false;
-+ bool first_time = true;
-+ bool calibration_done;
-+
-+ u8 reg1, reg2, reg3;
-+ s32 reg1_orig, reg2_orig, reg3_orig;
-+ s32 val;
-+
-+ int calib_x = 0, calib_y = 0;
-+ int reg_x, reg_y;
-+ int err_x, err_y;
-+
-+ int error, error2;
-+ int i;
-+
-+ reg1_orig = i2c_smbus_read_byte_data(client, CALIBRATION_REG1);
-+ if (reg1_orig < 0)
-+ return reg1_orig;
-+
-+ reg2_orig = i2c_smbus_read_byte_data(client, CALIBRATION_REG2);
-+ if (reg2_orig < 0)
-+ return reg2_orig;
-+
-+ reg3_orig = i2c_smbus_read_byte_data(client, CALIBRATION_REG3);
-+ if (reg3_orig < 0)
-+ return reg3_orig;
-+
-+ error = i2c_smbus_write_byte_data(client, INT_MASK,
-+ COORD_UPDATE | SLEEP_IN | SLEEP_OUT |
-+ PROGRAM_LOAD_DONE);
-+ if (error)
-+ goto out;
-+
-+ error = i2c_smbus_write_byte_data(client, TEST1,
-+ DUALTOUCH_STABILIZE_ON);
-+ if (error)
-+ goto out;
-+
-+ for (retry = 0; retry < CALIBRATION_RETRY_MAX; retry++) {
-+ /* wait 2 sampling for update */
-+ mdelay(2 * SAMPLING_DELAY);
-+
-+#define READ_CALIB_BUF(reg) buf[((reg) - PRM1_X_H)]
-+
-+ error = rohm_i2c_burst_read(client, PRM1_X_H, buf, sizeof(buf));
-+ if (error)
-+ goto out;
-+
-+ if (READ_CALIB_BUF(TOUCH) & TOUCH_DETECT)
-+ continue;
-+
-+ if (first_time) {
-+ /* generate calibration parameter */
-+ calib_x = ((int)READ_CALIB_BUF(PRM1_X_H) << 2 |
-+ READ_CALIB_BUF(PRM1_X_L)) - AXIS_OFFSET;
-+ calib_y = ((int)READ_CALIB_BUF(PRM1_Y_H) << 2 |
-+ READ_CALIB_BUF(PRM1_Y_L)) - AXIS_OFFSET;
-+
-+ error = i2c_smbus_write_byte_data(client, TEST1,
-+ DUALTOUCH_STABILIZE_ON | DUALTOUCH_REG_ON);
-+ if (error)
-+ goto out;
-+
-+ first_time = false;
-+ } else {
-+ /* generate adjustment parameter */
-+ err_x = (int)READ_CALIB_BUF(PRM1_X_H) << 2 |
-+ READ_CALIB_BUF(PRM1_X_L);
-+ err_y = (int)READ_CALIB_BUF(PRM1_Y_H) << 2 |
-+ READ_CALIB_BUF(PRM1_Y_L);
-+
-+ /* X axis ajust */
-+ if (err_x <= 4)
-+ calib_x -= AXIS_ADJUST;
-+ else if (err_x >= 60)
-+ calib_x += AXIS_ADJUST;
-+
-+ /* Y axis ajust */
-+ if (err_y <= 4)
-+ calib_y -= AXIS_ADJUST;
-+ else if (err_y >= 60)
-+ calib_y += AXIS_ADJUST;
-+ }
-+
-+ /* generate calibration setting value */
-+ reg_x = calib_x + ((calib_x & 0x200) << 1);
-+ reg_y = calib_y + ((calib_y & 0x200) << 1);
-+
-+ /* convert for register format */
-+ reg1 = reg_x >> 3;
-+ reg2 = (reg_y & 0x7) << 4 | (reg_x & 0x7);
-+ reg3 = reg_y >> 3;
-+
-+ error = i2c_smbus_write_byte_data(client,
-+ CALIBRATION_REG1, reg1);
-+ if (error)
-+ goto out;
-+
-+ error = i2c_smbus_write_byte_data(client,
-+ CALIBRATION_REG2, reg2);
-+ if (error)
-+ goto out;
-+
-+ error = i2c_smbus_write_byte_data(client,
-+ CALIBRATION_REG3, reg3);
-+ if (error)
-+ goto out;
-+
-+ /*
-+ * force calibration sequcence
-+ */
-+ error = i2c_smbus_write_byte_data(client, FORCE_CALIBRATION,
-+ FORCE_CALIBRATION_OFF);
-+ if (error)
-+ goto out;
-+
-+ error = i2c_smbus_write_byte_data(client, FORCE_CALIBRATION,
-+ FORCE_CALIBRATION_ON);
-+ if (error)
-+ goto out;
-+
-+ /* clear all interrupts */
-+ error = i2c_smbus_write_byte_data(client, INT_CLEAR, 0xff);
-+ if (error)
-+ goto out;
-+
-+ /*
-+ * Wait for the status change of calibration, max 10 sampling
-+ */
-+ calibration_done = false;
-+
-+ for (i = 0; i < 10; i++) {
-+ mdelay(SAMPLING_DELAY);
-+
-+ val = i2c_smbus_read_byte_data(client, TOUCH_GESTURE);
-+ if (!(val & CALIBRATION_MASK)) {
-+ calibration_done = true;
-+ break;
-+ } else if (val < 0) {
-+ error = val;
-+ goto out;
-+ }
-+ }
-+
-+ if (calibration_done) {
-+ val = i2c_smbus_read_byte_data(client, INT_STATUS);
-+ if (val == CALIBRATION_DONE) {
-+ success = true;
-+ break;
-+ } else if (val < 0) {
-+ error = val;
-+ goto out;
-+ }
-+ } else {
-+ dev_warn(dev, "calibration timeout\n");
-+ }
-+ }
-+
-+ if (!success) {
-+ error = i2c_smbus_write_byte_data(client, CALIBRATION_REG1,
-+ reg1_orig);
-+ if (error)
-+ goto out;
-+
-+ error = i2c_smbus_write_byte_data(client, CALIBRATION_REG2,
-+ reg2_orig);
-+ if (error)
-+ goto out;
-+
-+ error = i2c_smbus_write_byte_data(client, CALIBRATION_REG3,
-+ reg3_orig);
-+ if (error)
-+ goto out;
-+
-+ /* calibration data enable */
-+ error = i2c_smbus_write_byte_data(client, TEST1,
-+ DUALTOUCH_STABILIZE_ON |
-+ DUALTOUCH_REG_ON);
-+ if (error)
-+ goto out;
-+
-+ /* wait 10 sampling */
-+ mdelay(10 * SAMPLING_DELAY);
-+
-+ error = -EBUSY;
-+ }
-+
-+out:
-+ error2 = i2c_smbus_write_byte_data(client, INT_MASK, INT_ALL);
-+ if (!error2)
-+ /* Clear all interrupts */
-+ error2 = i2c_smbus_write_byte_data(client, INT_CLEAR, 0xff);
-+
-+ return error ? error : error2;
-+}
-+
-+static const unsigned int untouch_threshold[3] = { 0, 1, 5 };
-+static const unsigned int single_touch_threshold[3] = { 0, 0, 4 };
-+static const unsigned int dual_touch_threshold[3] = { 10, 8, 0 };
-+
-+static irqreturn_t rohm_ts_soft_irq(int irq, void *dev_id)
-+{
-+ struct rohm_ts_data *ts = dev_id;
-+ struct i2c_client *client = ts->client;
-+ struct input_dev *input_dev = ts->input;
-+ struct device *dev = &client->dev;
-+
-+ u8 buf[10]; /* for POS_X1_H(0x20)-TOUCH_GESTURE(0x29) */
-+
-+ struct input_mt_pos pos[MAX_CONTACTS];
-+ int slots[MAX_CONTACTS];
-+ u8 touch_flags;
-+ unsigned int threshold;
-+ int finger_count = -1;
-+ int prev_finger_count = ts->finger_count;
-+ int count;
-+ int error;
-+ int i;
-+
-+ error = i2c_smbus_write_byte_data(client, INT_MASK, INT_ALL);
-+ if (error)
-+ return IRQ_HANDLED;
-+
-+ /* Clear all interrupts */
-+ error = i2c_smbus_write_byte_data(client, INT_CLEAR, 0xff);
-+ if (error)
-+ return IRQ_HANDLED;
-+
-+#define READ_POS_BUF(reg) buf[((reg) - POS_X1_H)]
-+
-+ error = rohm_i2c_burst_read(client, POS_X1_H, buf, sizeof(buf));
-+ if (error)
-+ return IRQ_HANDLED;
-+
-+ touch_flags = READ_POS_BUF(TOUCH_GESTURE) & TOUCH_MASK;
-+ if (touch_flags) {
-+ /* generate coordinates */
-+ pos[0].x = ((s16)READ_POS_BUF(POS_X1_H) << 2) |
-+ READ_POS_BUF(POS_X1_L);
-+ pos[0].y = ((s16)READ_POS_BUF(POS_Y1_H) << 2) |
-+ READ_POS_BUF(POS_Y1_L);
-+ pos[1].x = ((s16)READ_POS_BUF(POS_X2_H) << 2) |
-+ READ_POS_BUF(POS_X2_L);
-+ pos[1].y = ((s16)READ_POS_BUF(POS_Y2_H) << 2) |
-+ READ_POS_BUF(POS_Y2_L);
-+ }
-+
-+ switch (touch_flags) {
-+ case 0:
-+ threshold = untouch_threshold[prev_finger_count];
-+ if (++ts->contact_count[0] >= threshold)
-+ finger_count = 0;
-+ break;
-+
-+ case SINGLE_TOUCH:
-+ threshold = single_touch_threshold[prev_finger_count];
-+ if (++ts->contact_count[1] >= threshold)
-+ finger_count = 1;
-+
-+ if (finger_count == 1) {
-+ if (pos[1].x != 0 && pos[1].y != 0) {
-+ pos[0].x = pos[1].x;
-+ pos[0].y = pos[1].y;
-+ pos[1].x = 0;
-+ pos[1].y = 0;
-+ }
-+ }
-+ break;
-+
-+ case DUAL_TOUCH:
-+ threshold = dual_touch_threshold[prev_finger_count];
-+ if (++ts->contact_count[2] >= threshold)
-+ finger_count = 2;
-+ break;
-+
-+ default:
-+ dev_dbg(dev,
-+ "Three or more touches are not supported\n");
-+ return IRQ_HANDLED;
-+ }
-+
-+ if (finger_count >= 0) {
-+ if (prev_finger_count != finger_count) {
-+ count = ts->contact_count[finger_count];
-+ memset(ts->contact_count, 0, sizeof(ts->contact_count));
-+ ts->contact_count[finger_count] = count;
-+ }
-+
-+ input_mt_assign_slots(input_dev, slots, pos,
-+ finger_count, ROHM_TS_DISPLACEMENT_MAX);
-+
-+ for (i = 0; i < finger_count; i++) {
-+ input_mt_slot(input_dev, slots[i]);
-+ input_mt_report_slot_state(input_dev,
-+ MT_TOOL_FINGER, true);
-+ input_report_abs(input_dev,
-+ ABS_MT_POSITION_X, pos[i].x);
-+ input_report_abs(input_dev,
-+ ABS_MT_POSITION_Y, pos[i].y);
-+ }
-+
-+ input_mt_sync_frame(input_dev);
-+ input_mt_report_pointer_emulation(input_dev, true);
-+ input_sync(input_dev);
-+
-+ ts->finger_count = finger_count;
-+ }
-+
-+ if (READ_POS_BUF(TOUCH_GESTURE) & CALIBRATION_REQUEST) {
-+ error = rohm_ts_manual_calibration(ts);
-+ if (error)
-+ dev_warn(dev, "manual calibration failed: %d\n",
-+ error);
-+ }
-+
-+ i2c_smbus_write_byte_data(client, INT_MASK,
-+ CALIBRATION_DONE | SLEEP_OUT | SLEEP_IN |
-+ PROGRAM_LOAD_DONE);
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static int rohm_ts_load_firmware(struct i2c_client *client,
-+ const char *firmware_name)
-+{
-+ struct device *dev = &client->dev;
-+ const struct firmware *fw;
-+ s32 status;
-+ unsigned int offset, len, xfer_len;
-+ unsigned int retry = 0;
-+ int error, error2;
-+
-+ error = request_firmware(&fw, firmware_name, dev);
-+ if (error) {
-+ dev_err(dev, "unable to retrieve firmware %s: %d\n",
-+ firmware_name, error);
-+ return error;
-+ }
-+
-+ error = i2c_smbus_write_byte_data(client, INT_MASK,
-+ COORD_UPDATE | CALIBRATION_DONE |
-+ SLEEP_IN | SLEEP_OUT);
-+ if (error)
-+ goto out;
-+
-+ do {
-+ if (retry) {
-+ dev_warn(dev, "retrying firmware load\n");
-+
-+ /* settings for retry */
-+ error = i2c_smbus_write_byte_data(client, EX_WDAT, 0);
-+ if (error)
-+ goto out;
-+ }
-+
-+ error = i2c_smbus_write_byte_data(client, EX_ADDR_H, 0);
-+ if (error)
-+ goto out;
-+
-+ error = i2c_smbus_write_byte_data(client, EX_ADDR_L, 0);
-+ if (error)
-+ goto out;
-+
-+ error = i2c_smbus_write_byte_data(client, COMMON_SETUP1,
-+ COMMON_SETUP1_DEFAULT);
-+ if (error)
-+ goto out;
-+
-+ /* firmware load to the device */
-+ offset = 0;
-+ len = fw->size;
-+
-+ while (len) {
-+ xfer_len = min(FIRMWARE_BLOCK_SIZE, len);
-+
-+ error = i2c_smbus_write_i2c_block_data(client, EX_WDAT,
-+ xfer_len, &fw->data[offset]);
-+ if (error)
-+ goto out;
-+
-+ len -= xfer_len;
-+ offset += xfer_len;
-+ }
-+
-+ /* check firmware load result */
-+ status = i2c_smbus_read_byte_data(client, INT_STATUS);
-+ if (status < 0) {
-+ error = status;
-+ goto out;
-+ }
-+
-+ /* clear all interrupts */
-+ error = i2c_smbus_write_byte_data(client, INT_CLEAR, 0xff);
-+ if (error)
-+ goto out;
-+
-+ if (status == PROGRAM_LOAD_DONE)
-+ break;
-+
-+ error = -EIO;
-+ } while (++retry >= FIRMWARE_RETRY_MAX);
-+
-+out:
-+ error2 = i2c_smbus_write_byte_data(client, INT_MASK, INT_ALL);
-+
-+ release_firmware(fw);
-+
-+ return error ? error : error2;
-+}
-+
-+static ssize_t swap_xy_show(struct device *dev, struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct i2c_client *client = to_i2c_client(dev);
-+ struct rohm_ts_data *ts = i2c_get_clientdata(client);
-+
-+ return sprintf(buf, "%d\n", !!(ts->setup2 & SWAP_XY));
-+}
-+
-+static ssize_t swap_xy_store(struct device *dev, struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct i2c_client *client = to_i2c_client(dev);
-+ struct rohm_ts_data *ts = i2c_get_clientdata(client);
-+ unsigned int val;
-+ int error;
-+
-+ error = kstrtouint(buf, 0, &val);
-+ if (error)
-+ return error;
-+
-+ error = mutex_lock_interruptible(&ts->input->mutex);
-+ if (error)
-+ return error;
-+
-+ if (val)
-+ ts->setup2 |= SWAP_XY;
-+ else
-+ ts->setup2 &= ~SWAP_XY;
-+
-+ if (ts->initialized)
-+ error = i2c_smbus_write_byte_data(ts->client, COMMON_SETUP2,
-+ ts->setup2);
-+
-+ mutex_unlock(&ts->input->mutex);
-+
-+ return error ? error : count;
-+}
-+
-+static ssize_t inv_x_show(struct device *dev, struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct i2c_client *client = to_i2c_client(dev);
-+ struct rohm_ts_data *ts = i2c_get_clientdata(client);
-+
-+ return sprintf(buf, "%d\n", !!(ts->setup2 & INV_X));
-+}
-+
-+static ssize_t inv_x_store(struct device *dev, struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct i2c_client *client = to_i2c_client(dev);
-+ struct rohm_ts_data *ts = i2c_get_clientdata(client);
-+ unsigned int val;
-+ int error;
-+
-+ error = kstrtouint(buf, 0, &val);
-+ if (error)
-+ return error;
-+
-+ error = mutex_lock_interruptible(&ts->input->mutex);
-+ if (error)
-+ return error;
-+
-+ if (val)
-+ ts->setup2 |= INV_X;
-+ else
-+ ts->setup2 &= ~INV_X;
-+
-+ if (ts->initialized)
-+ error = i2c_smbus_write_byte_data(ts->client, COMMON_SETUP2,
-+ ts->setup2);
-+
-+ mutex_unlock(&ts->input->mutex);
-+
-+ return error ? error : count;
-+}
-+
-+static ssize_t inv_y_show(struct device *dev, struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct i2c_client *client = to_i2c_client(dev);
-+ struct rohm_ts_data *ts = i2c_get_clientdata(client);
-+
-+ return sprintf(buf, "%d\n", !!(ts->setup2 & INV_Y));
-+}
-+
-+static ssize_t inv_y_store(struct device *dev, struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct i2c_client *client = to_i2c_client(dev);
-+ struct rohm_ts_data *ts = i2c_get_clientdata(client);
-+ unsigned int val;
-+ int error;
-+
-+ error = kstrtouint(buf, 0, &val);
-+ if (error)
-+ return error;
-+
-+ error = mutex_lock_interruptible(&ts->input->mutex);
-+ if (error)
-+ return error;
-+
-+ if (val)
-+ ts->setup2 |= INV_Y;
-+ else
-+ ts->setup2 &= ~INV_Y;
-+
-+ if (ts->initialized)
-+ error = i2c_smbus_write_byte_data(client, COMMON_SETUP2,
-+ ts->setup2);
-+
-+ mutex_unlock(&ts->input->mutex);
-+
-+ return error ? error : count;
-+}
-+
-+static DEVICE_ATTR_RW(swap_xy);
-+static DEVICE_ATTR_RW(inv_x);
-+static DEVICE_ATTR_RW(inv_y);
-+
-+static struct attribute *rohm_ts_attrs[] = {
-+ &dev_attr_swap_xy.attr,
-+ &dev_attr_inv_x.attr,
-+ &dev_attr_inv_y.attr,
-+ NULL,
-+};
-+
-+static const struct attribute_group rohm_ts_attr_group = {
-+ .attrs = rohm_ts_attrs,
-+};
-+
-+static int rohm_ts_device_init(struct i2c_client *client, u8 setup2)
-+{
-+ struct device *dev = &client->dev;
-+ int error;
-+
-+ disable_irq(client->irq);
-+
-+ /*
-+ * Wait 200usec for reset
-+ */
-+ udelay(200);
-+
-+ /* Release analog reset */
-+ error = i2c_smbus_write_byte_data(client, SYSTEM,
-+ ANALOG_POWER_ON | CPU_POWER_OFF);
-+ if (error)
-+ return error;
-+
-+ /* Waiting for the analog warm-up, max. 200usec */
-+ udelay(200);
-+
-+ /* clear all interrupts */
-+ error = i2c_smbus_write_byte_data(client, INT_CLEAR, 0xff);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, EX_WDAT, 0);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, COMMON_SETUP1, 0);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, COMMON_SETUP2, setup2);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, COMMON_SETUP3,
-+ SEL_TBL_DEFAULT | EN_MULTI);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, THRESHOLD_GESTURE,
-+ THRESHOLD_GESTURE_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, INTERVAL_TIME,
-+ INTERVAL_TIME_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, CPU_FREQ, CPU_FREQ_10MHZ);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, PRM_SWOFF_TIME,
-+ PRM_SWOFF_TIME_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, ADC_CTRL, ADC_DIV_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, ADC_WAIT, ADC_WAIT_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ /*
-+ * Panel setup, these values change with the panel.
-+ */
-+ error = i2c_smbus_write_byte_data(client, STEP_X, STEP_X_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, STEP_Y, STEP_Y_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, OFFSET_X, OFFSET_X_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, OFFSET_Y, OFFSET_Y_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, THRESHOLD_TOUCH,
-+ THRESHOLD_TOUCH_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, EVR_XY, EVR_XY_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, EVR_X, EVR_X_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, EVR_Y, EVR_Y_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ /* Fixed value settings */
-+ error = i2c_smbus_write_byte_data(client, CALIBRATION_ADJUST,
-+ CALIBRATION_ADJUST_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, SWCONT, SWCONT_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, TEST1,
-+ DUALTOUCH_STABILIZE_ON |
-+ DUALTOUCH_REG_ON);
-+ if (error)
-+ return error;
-+
-+ error = rohm_ts_load_firmware(client, BU21023_FIRMWARE_NAME);
-+ if (error) {
-+ dev_err(dev, "failed to load firmware: %d\n", error);
-+ return error;
-+ }
-+
-+ /*
-+ * Manual calibration results are not changed in same environment.
-+ * If the force calibration is performed,
-+ * the controller will not require calibration request interrupt
-+ * when the typical values are set to the calibration registers.
-+ */
-+ error = i2c_smbus_write_byte_data(client, CALIBRATION_REG1,
-+ CALIBRATION_REG1_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, CALIBRATION_REG2,
-+ CALIBRATION_REG2_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, CALIBRATION_REG3,
-+ CALIBRATION_REG3_DEFAULT);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, FORCE_CALIBRATION,
-+ FORCE_CALIBRATION_OFF);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, FORCE_CALIBRATION,
-+ FORCE_CALIBRATION_ON);
-+ if (error)
-+ return error;
-+
-+ /* Clear all interrupts */
-+ error = i2c_smbus_write_byte_data(client, INT_CLEAR, 0xff);
-+ if (error)
-+ return error;
-+
-+ /* Enable coordinates update interrupt */
-+ error = i2c_smbus_write_byte_data(client, INT_MASK,
-+ CALIBRATION_DONE | SLEEP_OUT |
-+ SLEEP_IN | PROGRAM_LOAD_DONE);
-+ if (error)
-+ return error;
-+
-+ error = i2c_smbus_write_byte_data(client, ERR_MASK,
-+ PROGRAM_LOAD_ERR | CPU_TIMEOUT |
-+ ADC_TIMEOUT);
-+ if (error)
-+ return error;
-+
-+ /* controller CPU power on */
-+ error = i2c_smbus_write_byte_data(client, SYSTEM,
-+ ANALOG_POWER_ON | CPU_POWER_ON);
-+
-+ enable_irq(client->irq);
-+
-+ return error;
-+}
-+
-+static int rohm_ts_power_off(struct i2c_client *client)
-+{
-+ int error;
-+
-+ error = i2c_smbus_write_byte_data(client, SYSTEM,
-+ ANALOG_POWER_ON | CPU_POWER_OFF);
-+ if (error) {
-+ dev_err(&client->dev,
-+ "failed to power off device CPU: %d\n", error);
-+ return error;
-+ }
-+
-+ error = i2c_smbus_write_byte_data(client, SYSTEM,
-+ ANALOG_POWER_OFF | CPU_POWER_OFF);
-+ if (error)
-+ dev_err(&client->dev,
-+ "failed to power off the device: %d\n", error);
-+
-+ return error;
-+}
-+
-+static int rohm_ts_open(struct input_dev *input_dev)
-+{
-+ struct rohm_ts_data *ts = input_get_drvdata(input_dev);
-+ struct i2c_client *client = ts->client;
-+ int error;
-+
-+ if (!ts->initialized) {
-+ error = rohm_ts_device_init(client, ts->setup2);
-+ if (error) {
-+ dev_err(&client->dev,
-+ "device initialization failed: %d\n", error);
-+ return error;
-+ }
-+
-+ ts->initialized = true;
-+ }
-+
-+ return 0;
-+}
-+
-+static void rohm_ts_close(struct input_dev *input_dev)
-+{
-+ struct rohm_ts_data *ts = input_get_drvdata(input_dev);
-+
-+ rohm_ts_power_off(ts->client);
-+
-+ ts->initialized = false;
-+}
-+
-+static void rohm_ts_remove_sysfs_group(void *_dev)
-+{
-+ struct device *dev = _dev;
-+
-+ sysfs_remove_group(&dev->kobj, &rohm_ts_attr_group);
-+}
-+
-+static int rohm_bu21023_i2c_probe(struct i2c_client *client,
-+ const struct i2c_device_id *id)
-+{
-+ struct device *dev = &client->dev;
-+ struct rohm_ts_data *ts;
-+ struct input_dev *input;
-+ int error;
-+
-+ if (!client->irq) {
-+ dev_err(dev, "IRQ is not assigned\n");
-+ return -EINVAL;
-+ }
-+
-+ if (!client->adapter->algo->master_xfer) {
-+ dev_err(dev, "I2C level transfers not supported\n");
-+ return -EOPNOTSUPP;
-+ }
-+
-+ /* Turn off CPU just in case */
-+ error = rohm_ts_power_off(client);
-+ if (error)
-+ return error;
-+
-+ ts = devm_kzalloc(dev, sizeof(struct rohm_ts_data), GFP_KERNEL);
-+ if (!ts)
-+ return -ENOMEM;
-+
-+ ts->client = client;
-+ ts->setup2 = MAF_1SAMPLE;
-+ i2c_set_clientdata(client, ts);
-+
-+ input = devm_input_allocate_device(dev);
-+ if (!input)
-+ return -ENOMEM;
-+
-+ input->name = BU21023_NAME;
-+ input->id.bustype = BUS_I2C;
-+ input->open = rohm_ts_open;
-+ input->close = rohm_ts_close;
-+
-+ ts->input = input;
-+ input_set_drvdata(input, ts);
-+
-+ input_set_abs_params(input, ABS_MT_POSITION_X,
-+ ROHM_TS_ABS_X_MIN, ROHM_TS_ABS_X_MAX, 0, 0);
-+ input_set_abs_params(input, ABS_MT_POSITION_Y,
-+ ROHM_TS_ABS_Y_MIN, ROHM_TS_ABS_Y_MAX, 0, 0);
-+
-+ error = input_mt_init_slots(input, MAX_CONTACTS,
-+ INPUT_MT_DIRECT | INPUT_MT_TRACK |
-+ INPUT_MT_DROP_UNUSED);
-+ if (error) {
-+ dev_err(dev, "failed to multi touch slots initialization\n");
-+ return error;
-+ }
-+
-+ error = devm_request_threaded_irq(dev, client->irq,
-+ NULL, rohm_ts_soft_irq,
-+ IRQF_ONESHOT, client->name, ts);
-+ if (error) {
-+ dev_err(dev, "failed to request IRQ: %d\n", error);
-+ return error;
-+ }
-+
-+ error = input_register_device(input);
-+ if (error) {
-+ dev_err(dev, "failed to register input device: %d\n", error);
-+ return error;
-+ }
-+
-+ error = sysfs_create_group(&dev->kobj, &rohm_ts_attr_group);
-+ if (error) {
-+ dev_err(dev, "failed to create sysfs group: %d\n", error);
-+ return error;
-+ }
-+
-+ error = devm_add_action(dev, rohm_ts_remove_sysfs_group, dev);
-+ if (error) {
-+ rohm_ts_remove_sysfs_group(dev);
-+ dev_err(&client->dev,
-+ "Failed to add sysfs cleanup action: %d\n",
-+ error);
-+ return error;
-+ }
-+
-+ return error;
-+}
-+
-+static const struct i2c_device_id rohm_bu21023_i2c_id[] = {
-+ { BU21023_NAME, 0 },
-+ { /* sentinel */ }
-+};
-+MODULE_DEVICE_TABLE(i2c, rohm_bu21023_i2c_id);
-+
-+static struct i2c_driver rohm_bu21023_i2c_driver = {
-+ .driver = {
-+ .name = BU21023_NAME,
-+ },
-+ .probe = rohm_bu21023_i2c_probe,
-+ .id_table = rohm_bu21023_i2c_id,
-+};
-+module_i2c_driver(rohm_bu21023_i2c_driver);
-+
-+MODULE_DESCRIPTION("ROHM BU21023/24 Touchscreen driver");
-+MODULE_LICENSE("GPL v2");
-+MODULE_AUTHOR("ROHM Co., Ltd.");
diff --git a/patches.misc/input-rohm_bu21023-fix-handling-of-retrying-firmware.patch b/patches.misc/input-rohm_bu21023-fix-handling-of-retrying-firmware.patch
deleted file mode 100644
index 4671575d41abec..00000000000000
--- a/patches.misc/input-rohm_bu21023-fix-handling-of-retrying-firmware.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 415a249f88fd263bed0f7cca86ecde8c57aba9dc Mon Sep 17 00:00:00 2001
-From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Date: Wed, 6 Jan 2016 14:44:02 -0800
-Subject: [PATCH] Input: rohm_bu21023 - fix handling of retrying firmware
- update
-
-Because of the wrong condition we'd never retry firmware update.
-
-Acked-by: Yoichi Yuasa <yuasa@linux-mips.org>
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-
----
- drivers/input/touchscreen/rohm_bu21023.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/input/touchscreen/rohm_bu21023.c
-+++ b/drivers/input/touchscreen/rohm_bu21023.c
-@@ -725,7 +725,7 @@ static int rohm_ts_load_firmware(struct
- break;
-
- error = -EIO;
-- } while (++retry >= FIRMWARE_RETRY_MAX);
-+ } while (++retry <= FIRMWARE_RETRY_MAX);
-
- out:
- error2 = i2c_smbus_write_byte_data(client, INT_MASK, INT_ALL);
diff --git a/patches.misc/mtd-nand-support-for-toshiba-benand-built-in-ecc-nand.patch b/patches.misc/mtd-nand-support-for-toshiba-benand-built-in-ecc-nand.patch
deleted file mode 100644
index 3be824b924b1c8..00000000000000
--- a/patches.misc/mtd-nand-support-for-toshiba-benand-built-in-ecc-nand.patch
+++ /dev/null
@@ -1,338 +0,0 @@
-From ltsi-dev-bounces@lists.linuxfoundation.org Thu Oct 22 12:51:02 2015
-From: KOBAYASHI Yoshitake <yoshitake.kobayashi@toshiba.co.jp>
-Date: Fri, 23 Oct 2015 04:50:50 +0900
-Subject: mtd: nand: support for Toshiba BENAND (Built-in ECC NAND)
-To: ltsi-dev@lists.linuxfoundation.org
-Message-ID: <1445543450-26077-1-git-send-email-yoshitake.kobayashi@toshiba.co.jp>
-
-
-Please consider adding the Toshiba BENAND patch for LTSI-4.1,
-This patch was posted as below, but it hasn't merged yet.
- https://lkml.org/lkml/2015/7/23/859
-
-This patch enables support for Toshiba BENAND. BENAND is a SLC NAND
-solution that automatically generates ECC inside NAND chip.
-
-Signed-off-by: KOBAYASHI Yoshitake <yoshitake.kobayashi@toshiba.co.jp>
----
- drivers/mtd/nand/Kconfig | 21 +++++
- drivers/mtd/nand/Makefile | 1
- drivers/mtd/nand/nand_base.c | 30 +++++++
- drivers/mtd/nand/nand_benand.c | 154 ++++++++++++++++++++++++++++++++++++++++
- include/linux/mtd/nand.h | 1
- include/linux/mtd/nand_benand.h | 48 ++++++++++++
- 6 files changed, 253 insertions(+), 2 deletions(-)
- create mode 100644 drivers/mtd/nand/nand_benand.c
- create mode 100644 include/linux/mtd/nand_benand.h
-
---- a/drivers/mtd/nand/Kconfig
-+++ b/drivers/mtd/nand/Kconfig
-@@ -22,6 +22,27 @@ menuconfig MTD_NAND
-
- if MTD_NAND
-
-+config MTD_NAND_BENAND
-+ tristate
-+ depends on MTD_NAND_BENAND_ENABLE
-+ default MTD_NAND
-+
-+config MTD_NAND_BENAND_ENABLE
-+ bool "Support for Toshiba BENAND (Built-in ECC NAND)"
-+ default y
-+ help
-+ This enables support for Toshiba BENAND.
-+ Toshiba BENAND is a SLC NAND solution that automatically
-+ generates ECC inside NAND chip.
-+
-+config MTD_NAND_BENAND_ECC_STATUS
-+ bool "Enable ECC Status Read Command(0x7A)"
-+ depends on MTD_NAND_BENAND_ENABLE
-+ help
-+ This enables support for ECC Status Read Command(0x7A) of BENAND.
-+ When this enables, report the real number of bitflips.
-+ In other cases, report the assumud number.
-+
- config MTD_NAND_BCH
- tristate
- select BCH
---- a/drivers/mtd/nand/Makefile
-+++ b/drivers/mtd/nand/Makefile
-@@ -3,6 +3,7 @@
- #
-
- obj-$(CONFIG_MTD_NAND) += nand.o
-+obj-$(CONFIG_MTD_NAND_BENAND) += nand_benand.o
- obj-$(CONFIG_MTD_NAND_ECC) += nand_ecc.o
- obj-$(CONFIG_MTD_NAND_BCH) += nand_bch.o
- obj-$(CONFIG_MTD_NAND_IDS) += nand_ids.o
---- a/drivers/mtd/nand/nand_base.c
-+++ b/drivers/mtd/nand/nand_base.c
-@@ -43,6 +43,7 @@
- #include <linux/mtd/nand.h>
- #include <linux/mtd/nand_ecc.h>
- #include <linux/mtd/nand_bch.h>
-+#include <linux/mtd/nand_benand.h>
- #include <linux/interrupt.h>
- #include <linux/bitops.h>
- #include <linux/leds.h>
-@@ -3526,8 +3527,13 @@ static void nand_decode_ext_id(struct mt
- if (id_len >= 6 && id_data[0] == NAND_MFR_TOSHIBA &&
- nand_is_slc(chip) &&
- (id_data[5] & 0x7) == 0x6 /* 24nm */ &&
-- !(id_data[4] & 0x80) /* !BENAND */) {
-- mtd->oobsize = 32 * mtd->writesize >> 9;
-+ (id_data[4] & 0x80) /* BENAND */) {
-+
-+ if (IS_ENABLED(CONFIG_MTD_NAND_BENAND))
-+ chip->ecc.mode = NAND_ECC_BENAND;
-+
-+ } else {
-+ mtd->oobsize = 32 * mtd->writesize >> 9; /* !BENAND */
- }
-
- }
-@@ -4075,6 +4081,26 @@ int nand_scan_tail(struct mtd_info *mtd)
- }
- break;
-
-+ case NAND_ECC_BENAND:
-+ if (!mtd_nand_has_benand()) {
-+ pr_warn("CONFIG_MTD_NAND_BENAND not enabled\n");
-+ BUG();
-+ }
-+ ecc->calculate = NULL;
-+ ecc->correct = NULL;
-+ ecc->read_page = nand_read_page_benand;
-+ ecc->read_subpage = nand_read_subpage_benand;
-+ ecc->write_page = nand_write_page_raw;
-+ ecc->read_page_raw = nand_read_page_raw;
-+ ecc->write_page_raw = nand_write_page_raw;
-+ ecc->read_oob = nand_read_oob_std;
-+ ecc->write_oob = nand_write_oob_std;
-+ ecc->size = mtd->writesize;
-+ ecc->strength = 8;
-+
-+ nand_benand_init(mtd);
-+ break;
-+
- case NAND_ECC_NONE:
- pr_warn("NAND_ECC_NONE selected by board driver. This is not recommended!\n");
- ecc->read_page = nand_read_page_raw;
---- /dev/null
-+++ b/drivers/mtd/nand/nand_benand.c
-@@ -0,0 +1,154 @@
-+/*
-+ * drivers/mtd/nand_benand.c
-+ *
-+ * (C) Copyright Toshiba Corporation
-+ * Semiconductor and Storage Products Company 2015
-+ *
-+ * This program supports BENAND.
-+ *
-+ * 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/module.h>
-+#include <linux/mtd/nand.h>
-+#include <linux/mtd/nand_benand.h>
-+
-+/* Recommended to rewrite for BENAND */
-+#define NAND_STATUS_RECOM_REWRT 0x08
-+
-+/* ECC Status Read Command */
-+#define NAND_CMD_ECC_STATUS 0x7A
-+
-+static struct nand_ecclayout benand_oob_64 = {
-+ .eccbytes = 0,
-+ .eccpos = {},
-+ .oobfree = {
-+ {.offset = 2, .length = 62}
-+ }
-+};
-+
-+static struct nand_ecclayout benand_oob_128 = {
-+ .eccbytes = 0,
-+ .eccpos = {},
-+ .oobfree = {
-+ {.offset = 2, .length = 126}
-+ }
-+};
-+
-+
-+static int nand_benand_status_chk(struct mtd_info *mtd, struct nand_chip *chip)
-+{
-+ unsigned int max_bitflips = 0;
-+ u8 status;
-+
-+ /* Check Read Status */
-+ chip->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
-+ status = chip->read_byte(mtd);
-+
-+ /* timeout */
-+ if (!(status & NAND_STATUS_READY)) {
-+ pr_debug("BENAND : Time Out!\n");
-+ return -EIO;
-+ }
-+
-+ /* uncorrectable */
-+ else if (status & NAND_STATUS_FAIL)
-+ mtd->ecc_stats.failed++;
-+
-+ /* correctable */
-+ else if (status & NAND_STATUS_RECOM_REWRT) {
-+ if (chip->cmd_ctrl &&
-+ IS_ENABLED(CONFIG_MTD_NAND_BENAND_ECC_STATUS)) {
-+
-+ int i;
-+ u8 ecc_status;
-+ unsigned int bitflips;
-+
-+ /* Check Read ECC Status */
-+ chip->cmd_ctrl(mtd, NAND_CMD_ECC_STATUS,
-+ NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE);
-+ /* Get bitflips info per 512Byte */
-+ for (i = 0; i < mtd->writesize >> 9; i++) {
-+ ecc_status = chip->read_byte(mtd);
-+ bitflips = ecc_status & 0x0f;
-+ max_bitflips = max_t(unsigned int,
-+ max_bitflips, bitflips);
-+ }
-+ mtd->ecc_stats.corrected += max_bitflips;
-+ } else {
-+ /*
-+ * If can't use chip->cmd_ctrl,
-+ * we can't get real number of bitflips.
-+ * So, we set max_bitflips mtd->bitflip_threshold.
-+ */
-+ max_bitflips = mtd->bitflip_threshold;
-+ mtd->ecc_stats.corrected += max_bitflips;
-+ }
-+ }
-+
-+ return max_bitflips;
-+}
-+
-+
-+void nand_benand_init(struct mtd_info *mtd)
-+{
-+ struct nand_chip *chip = mtd->priv;
-+
-+ chip->options |= NAND_SUBPAGE_READ;
-+
-+ switch (mtd->oobsize) {
-+ case 64:
-+ chip->ecc.layout = &benand_oob_64;
-+ break;
-+ case 128:
-+ chip->ecc.layout = &benand_oob_128;
-+ break;
-+ default:
-+ pr_warn("No oob scheme defined for oobsize %d\n",
-+ mtd->oobsize);
-+ BUG();
-+ }
-+
-+}
-+EXPORT_SYMBOL(nand_benand_init);
-+
-+int nand_read_page_benand(struct mtd_info *mtd, struct nand_chip *chip,
-+ uint8_t *buf, int oob_required, int page)
-+{
-+ unsigned int max_bitflips = 0;
-+
-+ chip->ecc.read_page_raw(mtd, chip, buf, oob_required, page);
-+ max_bitflips = nand_benand_status_chk(mtd, chip);
-+
-+ return max_bitflips;
-+}
-+EXPORT_SYMBOL(nand_read_page_benand);
-+
-+
-+int nand_read_subpage_benand(struct mtd_info *mtd, struct nand_chip *chip,
-+ uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi,
-+ int page)
-+{
-+ uint8_t *p;
-+ unsigned int max_bitflips = 0;
-+
-+ if (data_offs != 0)
-+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_offs, -1);
-+
-+ p = bufpoi + data_offs;
-+ chip->read_buf(mtd, p, readlen);
-+
-+ max_bitflips = nand_benand_status_chk(mtd, chip);
-+
-+ return max_bitflips;
-+}
-+EXPORT_SYMBOL(nand_read_subpage_benand);
-+
-+
-+MODULE_LICENSE("GPL v2");
-+MODULE_AUTHOR("Toshiba Corporation Semiconductor and Storage Products Company");
-+MODULE_DESCRIPTION("BENAND (Built-in ECC NAND) support");
---- a/include/linux/mtd/nand.h
-+++ b/include/linux/mtd/nand.h
-@@ -115,6 +115,7 @@ typedef enum {
- NAND_ECC_HW_SYNDROME,
- NAND_ECC_HW_OOB_FIRST,
- NAND_ECC_SOFT_BCH,
-+ NAND_ECC_BENAND,
- } nand_ecc_modes_t;
-
- /*
---- /dev/null
-+++ b/include/linux/mtd/nand_benand.h
-@@ -0,0 +1,48 @@
-+/*
-+ * linux/include/linux/mtd/nand_benand.h
-+ *
-+ * (C) Copyright Toshiba Corporation
-+ * Semiconductor and Storage Products Company 2015
-+ *
-+ * 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 __MTD_NAND_BENAND_H__
-+#define __MTD_NAND_BENAND_H__
-+
-+#if defined(CONFIG_MTD_NAND_BENAND_ENABLE)
-+
-+static inline int mtd_nand_has_benand(void) { return 1; }
-+
-+void nand_benand_init(struct mtd_info *mtd);
-+
-+int nand_read_page_benand(struct mtd_info *mtd, struct nand_chip *chip,
-+ uint8_t *buf, int oob_required, int page);
-+
-+int nand_read_subpage_benand(struct mtd_info *mtd, struct nand_chip *chip,
-+ uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi,
-+ int page);
-+
-+#else /* CONFIG_MTD_NAND_BENAND_ENABLE */
-+static inline int mtd_nand_has_benand(void) { return 0; }
-+
-+void nand_benand_init(struct mtd_info *mtd) {}
-+
-+int nand_read_page_benand(struct mtd_info *mtd, struct nand_chip *chip,
-+ uint8_t *buf, int oob_required, int page)
-+{
-+ return -1;
-+}
-+
-+int nand_read_subpage_benand(struct mtd_info *mtd, struct nand_chip *chip,
-+ uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi,
-+ int page)
-+{
-+ return -1;
-+}
-+
-+#endif /* CONFIG_MTD_NAND_BENAND_ENABLE */
-+#endif
diff --git a/patches.renesas/0001-ARM-shmobile-r8a73a4-Add-IRQC-clock-to-device-tree.patch b/patches.renesas/0001-ARM-shmobile-r8a73a4-Add-IRQC-clock-to-device-tree.patch
deleted file mode 100644
index 146a766cacd116..00000000000000
--- a/patches.renesas/0001-ARM-shmobile-r8a73a4-Add-IRQC-clock-to-device-tree.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 51952303042eb832c7c99fc9a3436a4033e989f9 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 18 Mar 2015 19:55:58 +0100
-Subject: [PATCH 001/129] ARM: shmobile: r8a73a4: Add IRQC clock to device tree
-
-Link the external IRQ controllers irqc0 and irqc1 to the IRQC module
-clock, so they can be power managed using that clock.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-[horms: corrected typo in changelog to refer to r8a73a4]
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-
-(cherry picked from commit 1c2a7eb7169b855f6c3e9db036c6767052528ffe)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a73a4.dtsi | 11 +++++++----
- include/dt-bindings/clock/r8a73a4-clock.h | 1 +
- 2 files changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
-index 0fd889f88109..7ee22a41c6c9 100644
---- a/arch/arm/boot/dts/r8a73a4.dtsi
-+++ b/arch/arm/boot/dts/r8a73a4.dtsi
-@@ -163,6 +163,7 @@
- <0 29 IRQ_TYPE_LEVEL_HIGH>,
- <0 30 IRQ_TYPE_LEVEL_HIGH>,
- <0 31 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp4_clks R8A73A4_CLK_IRQC>;
- power-domains = <&pd_c4>;
- };
-
-@@ -197,6 +198,7 @@
- <0 55 IRQ_TYPE_LEVEL_HIGH>,
- <0 56 IRQ_TYPE_LEVEL_HIGH>,
- <0 57 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp4_clks R8A73A4_CLK_IRQC>;
- power-domains = <&pd_c4>;
- };
-
-@@ -724,15 +726,16 @@
- mstp4_clks: mstp4_clks@e6150140 {
- compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
- reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-- clocks = <&main_div2_clk>, <&cpg_clocks R8A73A4_CLK_HP>,
-+ clocks = <&main_div2_clk>, <&main_div2_clk>,
-+ <&cpg_clocks R8A73A4_CLK_HP>,
- <&cpg_clocks R8A73A4_CLK_HP>;
- #clock-cells = <1>;
- clock-indices = <
-- R8A73A4_CLK_IIC5 R8A73A4_CLK_IIC4
-- R8A73A4_CLK_IIC3
-+ R8A73A4_CLK_IRQC R8A73A4_CLK_IIC5
-+ R8A73A4_CLK_IIC4 R8A73A4_CLK_IIC3
- >;
- clock-output-names =
-- "iic5", "iic4", "iic3";
-+ "irqc", "iic5", "iic4", "iic3";
- };
- mstp5_clks: mstp5_clks@e6150144 {
- compatible = "renesas,r8a73a4-mstp-clocks", "renesas,cpg-mstp-clocks";
-diff --git a/include/dt-bindings/clock/r8a73a4-clock.h b/include/dt-bindings/clock/r8a73a4-clock.h
-index 9a4b4c9ca44a..dd11ecdf837e 100644
---- a/include/dt-bindings/clock/r8a73a4-clock.h
-+++ b/include/dt-bindings/clock/r8a73a4-clock.h
-@@ -54,6 +54,7 @@
- #define R8A73A4_CLK_IIC3 11
- #define R8A73A4_CLK_IIC4 10
- #define R8A73A4_CLK_IIC5 9
-+#define R8A73A4_CLK_IRQC 7
-
- /* MSTP5 */
- #define R8A73A4_CLK_THERMAL 22
---
-2.6.2
-
diff --git a/patches.renesas/0002-ARM-shmobile-r8a7790-Add-IRQC-clock-to-device-tree.patch b/patches.renesas/0002-ARM-shmobile-r8a7790-Add-IRQC-clock-to-device-tree.patch
deleted file mode 100644
index dfa9109b1dbf52..00000000000000
--- a/patches.renesas/0002-ARM-shmobile-r8a7790-Add-IRQC-clock-to-device-tree.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 515b2ec08123ba99a6751ebd27e6687fd60eb372 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 18 Mar 2015 19:55:59 +0100
-Subject: [PATCH 002/129] ARM: shmobile: r8a7790: Add IRQC clock to device tree
-
-Link the external IRQ controller irqc0 to the IRQC module clock, so it
-can be power managed using that clock.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 61624caf2479732beb42ea88a6b6ca3c7ae59cd7)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 9 +++++++++
- include/dt-bindings/clock/r8a7790-clock.h | 3 +++
- 2 files changed, 12 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index 4bb2f4c17321..a81cfda0872f 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -252,6 +252,7 @@
- <0 1 IRQ_TYPE_LEVEL_HIGH>,
- <0 2 IRQ_TYPE_LEVEL_HIGH>,
- <0 3 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp4_clks R8A7790_CLK_IRQC>;
- };
-
- dmac0: dma-controller@e6700000 {
-@@ -1158,6 +1159,14 @@
- "iic0", "pciec", "iic1", "ssusb", "cmt1",
- "usbdmac0", "usbdmac1";
- };
-+ mstp4_clks: mstp4_clks@e6150140 {
-+ compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
-+ reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-+ clocks = <&cp_clk>;
-+ #clock-cells = <1>;
-+ clock-indices = <R8A7790_CLK_IRQC>;
-+ clock-output-names = "irqc";
-+ };
- mstp5_clks: mstp5_clks@e6150144 {
- compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
- reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>;
-diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
-index 3f2c6b198d4a..ff7ca3584e16 100644
---- a/include/dt-bindings/clock/r8a7790-clock.h
-+++ b/include/dt-bindings/clock/r8a7790-clock.h
-@@ -79,6 +79,9 @@
- #define R8A7790_CLK_USBDMAC0 30
- #define R8A7790_CLK_USBDMAC1 31
-
-+/* MSTP4 */
-+#define R8A7790_CLK_IRQC 7
-+
- /* MSTP5 */
- #define R8A7790_CLK_AUDIO_DMAC1 1
- #define R8A7790_CLK_AUDIO_DMAC0 2
---
-2.6.2
-
diff --git a/patches.renesas/0003-ARM-shmobile-r8a7791-Add-IRQC-clock-to-device-tree.patch b/patches.renesas/0003-ARM-shmobile-r8a7791-Add-IRQC-clock-to-device-tree.patch
deleted file mode 100644
index 13c79e6b81b761..00000000000000
--- a/patches.renesas/0003-ARM-shmobile-r8a7791-Add-IRQC-clock-to-device-tree.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From e4631c4d13aa7401241dade0f94fbc2ebb2eb8f8 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 18 Mar 2015 19:56:00 +0100
-Subject: [PATCH 003/129] ARM: shmobile: r8a7791: Add IRQC clock to device tree
-
-Link the external IRQ controller irqc0 to the IRQC module clock, so it
-can be power managed using that clock.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 62d386c04b1cb9df430c955b309406175d26b6b3)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 9 +++++++++
- include/dt-bindings/clock/r8a7791-clock.h | 3 +++
- 2 files changed, 12 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index 4696062f6dde..20ab76680884 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -239,6 +239,7 @@
- <0 15 IRQ_TYPE_LEVEL_HIGH>,
- <0 16 IRQ_TYPE_LEVEL_HIGH>,
- <0 17 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp4_clks R8A7791_CLK_IRQC>;
- };
-
- dmac0: dma-controller@e6700000 {
-@@ -1160,6 +1161,14 @@
- "mmcif0", "i2c7", "pciec", "i2c8", "ssusb", "cmt1",
- "usbdmac0", "usbdmac1";
- };
-+ mstp4_clks: mstp4_clks@e6150140 {
-+ compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
-+ reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-+ clocks = <&cp_clk>;
-+ #clock-cells = <1>;
-+ clock-indices = <R8A7791_CLK_IRQC>;
-+ clock-output-names = "irqc";
-+ };
- mstp5_clks: mstp5_clks@e6150144 {
- compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
- reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>;
-diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
-index 8fc5dc8faeea..402268384b99 100644
---- a/include/dt-bindings/clock/r8a7791-clock.h
-+++ b/include/dt-bindings/clock/r8a7791-clock.h
-@@ -70,6 +70,9 @@
- #define R8A7791_CLK_USBDMAC0 30
- #define R8A7791_CLK_USBDMAC1 31
-
-+/* MSTP4 */
-+#define R8A7791_CLK_IRQC 7
-+
- /* MSTP5 */
- #define R8A7791_CLK_AUDIO_DMAC1 1
- #define R8A7791_CLK_AUDIO_DMAC0 2
---
-2.6.2
-
diff --git a/patches.renesas/0004-ARM-shmobile-r8a7794-Add-IRQC-clock-to-device-tree.patch b/patches.renesas/0004-ARM-shmobile-r8a7794-Add-IRQC-clock-to-device-tree.patch
deleted file mode 100644
index 57a850bbea320c..00000000000000
--- a/patches.renesas/0004-ARM-shmobile-r8a7794-Add-IRQC-clock-to-device-tree.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 60fa35578b9e740ea4914bf7dde1d99f65a329a6 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 18 Mar 2015 19:56:01 +0100
-Subject: [PATCH 004/129] ARM: shmobile: r8a7794: Add IRQC clock to device tree
-
-Link the external IRQ controller irqc0 to the IRQC module clock, so it
-can be power managed using that clock.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 1c5ca5db11edd7ff27ad8a98ffb2ac61bfd520b6)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7794.dtsi | 9 +++++++++
- include/dt-bindings/clock/r8a7794-clock.h | 3 +++
- 2 files changed, 12 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
-index 7a3ffa51a8bf..01cf54f70501 100644
---- a/arch/arm/boot/dts/r8a7794.dtsi
-+++ b/arch/arm/boot/dts/r8a7794.dtsi
-@@ -105,6 +105,7 @@
- <0 15 IRQ_TYPE_LEVEL_HIGH>,
- <0 16 IRQ_TYPE_LEVEL_HIGH>,
- <0 17 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp4_clks R8A7794_CLK_IRQC>;
- };
-
- dmac0: dma-controller@e6700000 {
-@@ -625,6 +626,14 @@
- "sdhi2", "sdhi1", "sdhi0",
- "mmcif0", "cmt1", "usbdmac0", "usbdmac1";
- };
-+ mstp4_clks: mstp4_clks@e6150140 {
-+ compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
-+ reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-+ clocks = <&cp_clk>;
-+ #clock-cells = <1>;
-+ clock-indices = <R8A7794_CLK_IRQC>;
-+ clock-output-names = "irqc";
-+ };
- mstp7_clks: mstp7_clks@e615014c {
- compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
- reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>;
-diff --git a/include/dt-bindings/clock/r8a7794-clock.h b/include/dt-bindings/clock/r8a7794-clock.h
-index d63323032d6e..09da38a58776 100644
---- a/include/dt-bindings/clock/r8a7794-clock.h
-+++ b/include/dt-bindings/clock/r8a7794-clock.h
-@@ -60,6 +60,9 @@
- #define R8A7794_CLK_USBDMAC0 30
- #define R8A7794_CLK_USBDMAC1 31
-
-+/* MSTP4 */
-+#define R8A7794_CLK_IRQC 7
-+
- /* MSTP5 */
- #define R8A7794_CLK_THERMAL 22
- #define R8A7794_CLK_PWM 23
---
-2.6.2
-
diff --git a/patches.renesas/0005-clk-emev2-Silence-sparse-warnings.patch b/patches.renesas/0005-clk-emev2-Silence-sparse-warnings.patch
deleted file mode 100644
index 998dee0b1f6bd0..00000000000000
--- a/patches.renesas/0005-clk-emev2-Silence-sparse-warnings.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 99622ef7ea52673b884fad6223471817d0037483 Mon Sep 17 00:00:00 2001
-From: Stephen Boyd <sboyd@codeaurora.org>
-Date: Fri, 1 May 2015 12:33:49 -0700
-Subject: [PATCH 005/129] clk: emev2: Silence sparse warnings
-
-drivers/clk/shmobile/clk-emev2.c:37:14: warning: symbol 'smu_base' was not declared. Should it be static?
-
-Cc: Takashi Yoshii <takasi-y@ops.dti.ne.jp>
-Cc: Magnus Damm <damm@opensource.se>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-(cherry picked from commit 43f535702bb2c7b96091c0267fc105d44c18348c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/clk/shmobile/clk-emev2.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/clk/shmobile/clk-emev2.c b/drivers/clk/shmobile/clk-emev2.c
-index 6c7c929c7765..5b60beb7d0eb 100644
---- a/drivers/clk/shmobile/clk-emev2.c
-+++ b/drivers/clk/shmobile/clk-emev2.c
-@@ -34,7 +34,7 @@
- static DEFINE_SPINLOCK(lock);
-
- /* not pretty, but hey */
--void __iomem *smu_base;
-+static void __iomem *smu_base;
-
- static void __init emev2_smu_write(unsigned long value, int offs)
- {
---
-2.6.2
-
diff --git a/patches.renesas/0006-clk-shmobile-Add-r8a7778-SoC-to-MSTP-bindings.patch b/patches.renesas/0006-clk-shmobile-Add-r8a7778-SoC-to-MSTP-bindings.patch
deleted file mode 100644
index 816a917496e4df..00000000000000
--- a/patches.renesas/0006-clk-shmobile-Add-r8a7778-SoC-to-MSTP-bindings.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 4851c88cee58e39fc7cf2e329692314677ab54bc Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Thu, 26 Feb 2015 17:42:06 +0100
-Subject: [PATCH 006/129] clk: shmobile: Add r8a7778 SoC to MSTP bindings
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-(cherry picked from commit 31a0b5373c7562d5a24f973a2afec1785d72d9c4)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
-index 0a80fa70ca26..e163092348bf 100644
---- a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
-+++ b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
-@@ -13,6 +13,7 @@ Required Properties:
- - "renesas,r7s72100-mstp-clocks" for R7S72100 (RZ) MSTP gate clocks
- - "renesas,r8a73a4-mstp-clocks" for R8A73A4 (R-Mobile APE6) MSTP gate clocks
- - "renesas,r8a7740-mstp-clocks" for R8A7740 (R-Mobile A1) MSTP gate clocks
-+ - "renesas,r8a7778-mstp-clocks" for R8A7778 (R-Car M1) MSTP gate clocks
- - "renesas,r8a7779-mstp-clocks" for R8A7779 (R-Car H1) MSTP gate clocks
- - "renesas,r8a7790-mstp-clocks" for R8A7790 (R-Car H2) MSTP gate clocks
- - "renesas,r8a7791-mstp-clocks" for R8A7791 (R-Car M2) MSTP gate clocks
---
-2.6.2
-
diff --git a/patches.renesas/0007-clk-shmobile-Add-r8a7793-SoC-to-MSTP-bindings.patch b/patches.renesas/0007-clk-shmobile-Add-r8a7793-SoC-to-MSTP-bindings.patch
deleted file mode 100644
index bd7306f6a430b0..00000000000000
--- a/patches.renesas/0007-clk-shmobile-Add-r8a7793-SoC-to-MSTP-bindings.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From ae9663eb3e02af654e0710aca81f7028f05911f3 Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Thu, 28 May 2015 17:17:00 +0200
-Subject: [PATCH 007/129] clk: shmobile: Add r8a7793 SoC to MSTP bindings
-
-Also replaces "R-Car M2" with "R-Car M2-W" to avoid confusion.
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Cc: Michael Turquette <mturquette@linaro.org>
-Cc: devicetree@vger.kernel.org
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-(cherry picked from commit b5405db9df8ea71435336bea8295cc4aa84ee3fa)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
-index e163092348bf..c95f7d2db6bd 100644
---- a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
-+++ b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
-@@ -16,7 +16,8 @@ Required Properties:
- - "renesas,r8a7778-mstp-clocks" for R8A7778 (R-Car M1) MSTP gate clocks
- - "renesas,r8a7779-mstp-clocks" for R8A7779 (R-Car H1) MSTP gate clocks
- - "renesas,r8a7790-mstp-clocks" for R8A7790 (R-Car H2) MSTP gate clocks
-- - "renesas,r8a7791-mstp-clocks" for R8A7791 (R-Car M2) MSTP gate clocks
-+ - "renesas,r8a7791-mstp-clocks" for R8A7791 (R-Car M2-W) MSTP gate clocks
-+ - "renesas,r8a7793-mstp-clocks" for R8A7793 (R-Car M2-N) MSTP gate clocks
- - "renesas,r8a7794-mstp-clocks" for R8A7794 (R-Car E2) MSTP gate clocks
- - "renesas,sh73a0-mstp-clocks" for SH73A0 (SH-MobileAG5) MSTP gate clocks
- - "renesas,cpg-mstp-clock" for generic MSTP gate clocks
---
-2.6.2
-
diff --git a/patches.renesas/0008-clk-shmobile-mstp-Document-mandatory-compatible-fall.patch b/patches.renesas/0008-clk-shmobile-mstp-Document-mandatory-compatible-fall.patch
deleted file mode 100644
index e6314c7df149f0..00000000000000
--- a/patches.renesas/0008-clk-shmobile-mstp-Document-mandatory-compatible-fall.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 0f8561648a63896c717c9428b713549c43f23799 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 28 May 2015 11:28:10 +0200
-Subject: [PATCH 008/129] clk: shmobile: mstp: Document mandatory compatible
- fallback
-
-The generic MSTP gate clocks compatible value is mandatory, as the
-driver uses only this value for matching. Document that this is a
-fallback that must be present.
-
-Also fix a typo (missing plural "s") in the compatible value.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-(cherry picked from commit 17df1fb2e502371b63ea1b2110584e8a712d6c20)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
-index c95f7d2db6bd..16ed18155160 100644
---- a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
-+++ b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
-@@ -20,7 +20,7 @@ Required Properties:
- - "renesas,r8a7793-mstp-clocks" for R8A7793 (R-Car M2-N) MSTP gate clocks
- - "renesas,r8a7794-mstp-clocks" for R8A7794 (R-Car E2) MSTP gate clocks
- - "renesas,sh73a0-mstp-clocks" for SH73A0 (SH-MobileAG5) MSTP gate clocks
-- - "renesas,cpg-mstp-clock" for generic MSTP gate clocks
-+ and "renesas,cpg-mstp-clocks" as a fallback.
- - reg: Base address and length of the I/O mapped registers used by the MSTP
- clocks. The first register is the clock control register and is mandatory.
- The second register is the clock status register and is optional when not
---
-2.6.2
-
diff --git a/patches.renesas/0009-i2c-sh_mobile-add-errata-workaround.patch b/patches.renesas/0009-i2c-sh_mobile-add-errata-workaround.patch
deleted file mode 100644
index 03666e9ab5011a..00000000000000
--- a/patches.renesas/0009-i2c-sh_mobile-add-errata-workaround.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From 1aef2578075b8f30977492b7d3807e7ae8ab48c6 Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Tue, 9 Jun 2015 16:14:39 +0900
-Subject: [PATCH 009/129] i2c: sh_mobile: add errata workaround
-
-This used to be in platform init code. We want it to do in the driver
-now. This is basically a code move and a new compatible added.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit 3ded3743a026e0762fa74467eafc66ecc1c484cc)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/i2c/busses/i2c-sh_mobile.c | 40 ++++++++++++++++++++++++++++++++++++++
- 1 file changed, 40 insertions(+)
-
-diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
-index 007818b3e174..7193bcfdd940 100644
---- a/drivers/i2c/busses/i2c-sh_mobile.c
-+++ b/drivers/i2c/busses/i2c-sh_mobile.c
-@@ -150,6 +150,7 @@ struct sh_mobile_i2c_data {
-
- struct sh_mobile_dt_config {
- int clks_per_count;
-+ void (*setup)(struct sh_mobile_i2c_data *pd);
- };
-
- #define IIC_FLAG_HAS_ICIC67 (1 << 0)
-@@ -164,6 +165,7 @@ struct sh_mobile_dt_config {
- #define ICIC 0x0c
- #define ICCL 0x10
- #define ICCH 0x14
-+#define ICSTART 0x70
-
- /* Register bits */
- #define ICCR_ICE 0x80
-@@ -190,6 +192,8 @@ struct sh_mobile_dt_config {
- #define ICIC_WAITE 0x02
- #define ICIC_DTEE 0x01
-
-+#define ICSTART_ICSTART 0x10
-+
- static void iic_wr(struct sh_mobile_i2c_data *pd, int offs, unsigned char data)
- {
- if (offs == ICIC)
-@@ -782,6 +786,33 @@ static struct i2c_algorithm sh_mobile_i2c_algorithm = {
- .master_xfer = sh_mobile_i2c_xfer,
- };
-
-+/*
-+ * r8a7740 chip has lasting errata on I2C I/O pad reset.
-+ * this is work-around for it.
-+ */
-+static void sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd)
-+{
-+ iic_set_clr(pd, ICCR, ICCR_ICE, 0);
-+ iic_rd(pd, ICCR); /* dummy read */
-+
-+ iic_set_clr(pd, ICSTART, ICSTART_ICSTART, 0);
-+ iic_rd(pd, ICSTART); /* dummy read */
-+
-+ udelay(10);
-+
-+ iic_wr(pd, ICCR, ICCR_SCP);
-+ iic_wr(pd, ICSTART, 0);
-+
-+ udelay(10);
-+
-+ iic_wr(pd, ICCR, ICCR_TRS);
-+ udelay(10);
-+ iic_wr(pd, ICCR, 0);
-+ udelay(10);
-+ iic_wr(pd, ICCR, ICCR_TRS);
-+ udelay(10);
-+}
-+
- static const struct sh_mobile_dt_config default_dt_config = {
- .clks_per_count = 1,
- };
-@@ -790,9 +821,15 @@ static const struct sh_mobile_dt_config fast_clock_dt_config = {
- .clks_per_count = 2,
- };
-
-+static const struct sh_mobile_dt_config r8a7740_dt_config = {
-+ .clks_per_count = 1,
-+ .setup = sh_mobile_i2c_r8a7740_workaround,
-+};
-+
- static const struct of_device_id sh_mobile_i2c_dt_ids[] = {
- { .compatible = "renesas,rmobile-iic", .data = &default_dt_config },
- { .compatible = "renesas,iic-r8a73a4", .data = &fast_clock_dt_config },
-+ { .compatible = "renesas,iic-r8a7740", .data = &r8a7740_dt_config },
- { .compatible = "renesas,iic-r8a7790", .data = &fast_clock_dt_config },
- { .compatible = "renesas,iic-r8a7791", .data = &fast_clock_dt_config },
- { .compatible = "renesas,iic-r8a7792", .data = &fast_clock_dt_config },
-@@ -885,6 +922,9 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
-
- config = match->data;
- pd->clks_per_count = config->clks_per_count;
-+
-+ if (config->setup)
-+ config->setup(pd);
- }
- } else {
- if (pdata && pdata->bus_speed)
---
-2.6.2
-
diff --git a/patches.renesas/0010-i2c-sh_mobile-use-adapter-default-for-timeout.patch b/patches.renesas/0010-i2c-sh_mobile-use-adapter-default-for-timeout.patch
deleted file mode 100644
index 4a4272eb4c41ae..00000000000000
--- a/patches.renesas/0010-i2c-sh_mobile-use-adapter-default-for-timeout.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 91446decf89f8432214fed23dcbe912e978b3cc5 Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Sat, 20 Jun 2015 21:03:21 +0200
-Subject: [PATCH 010/129] i2c: sh_mobile: use adapter default for timeout
-
-5 seconds is a very large timeout, and it is hardcoded. Use the default
-timeout from 'struct adapter' which is 1 second. It can also be modified
-from userspace for specific workloads via i2c-dev.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit 41bdbd2887591a3fa586e71cd2b462c3525845a3)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/i2c/busses/i2c-sh_mobile.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
-index 7193bcfdd940..5490bfb58f3e 100644
---- a/drivers/i2c/busses/i2c-sh_mobile.c
-+++ b/drivers/i2c/busses/i2c-sh_mobile.c
-@@ -751,7 +751,7 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
- /* The interrupt handler takes care of the rest... */
- k = wait_event_timeout(pd->wait,
- pd->sr & (ICSR_TACK | SW_DONE),
-- 5 * HZ);
-+ adapter->timeout);
- if (!k) {
- dev_err(pd->dev, "Transfer request timed out\n");
- if (pd->dma_direction != DMA_NONE)
---
-2.6.2
-
diff --git a/patches.renesas/0011-i2c-sh_mobile-use-proper-type-for-timeout.patch b/patches.renesas/0011-i2c-sh_mobile-use-proper-type-for-timeout.patch
deleted file mode 100644
index c796f6364126e5..00000000000000
--- a/patches.renesas/0011-i2c-sh_mobile-use-proper-type-for-timeout.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 9485483919534a565810906835a347ba0ca3163f Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Sat, 20 Jun 2015 21:03:22 +0200
-Subject: [PATCH 011/129] i2c: sh_mobile: use proper type for timeout
-
-wait_event_timeout returns long, not int.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit 365322fb32e82b20758e8a18e3aa94692ce2a3d1)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/i2c/busses/i2c-sh_mobile.c | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
-index 5490bfb58f3e..47659a925e09 100644
---- a/drivers/i2c/busses/i2c-sh_mobile.c
-+++ b/drivers/i2c/busses/i2c-sh_mobile.c
-@@ -730,7 +730,8 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
- struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
- struct i2c_msg *msg;
- int err = 0;
-- int i, k;
-+ int i;
-+ long timeout;
-
- activate_ch(pd);
-
-@@ -749,10 +750,10 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
- i2c_op(pd, OP_START, 0);
-
- /* The interrupt handler takes care of the rest... */
-- k = wait_event_timeout(pd->wait,
-+ timeout = wait_event_timeout(pd->wait,
- pd->sr & (ICSR_TACK | SW_DONE),
- adapter->timeout);
-- if (!k) {
-+ if (!timeout) {
- dev_err(pd->dev, "Transfer request timed out\n");
- if (pd->dma_direction != DMA_NONE)
- sh_mobile_i2c_cleanup_dma(pd);
---
-2.6.2
-
diff --git a/patches.renesas/0012-irqchip-Constify-irq_domain_ops.patch b/patches.renesas/0012-irqchip-Constify-irq_domain_ops.patch
deleted file mode 100644
index f5ea6dbfd5b2a9..00000000000000
--- a/patches.renesas/0012-irqchip-Constify-irq_domain_ops.patch
+++ /dev/null
@@ -1,233 +0,0 @@
-From 01c70414f308dacf523d2efc309942abfe9a76b1 Mon Sep 17 00:00:00 2001
-From: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
-Date: Mon, 27 Apr 2015 21:54:24 +0900
-Subject: [PATCH 012/129] irqchip: Constify irq_domain_ops
-
-The irq_domain_ops are not modified by the driver and the irqdomain core
-code accepts pointer to a const data.
-
-Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
-Cc: Jason Cooper <jason@lakedaemon.net>
-Cc: Kukjin Kim <kgene@kernel.org>
-Cc: Stephen Warren <swarren@wwwdotorg.org>
-Cc: Lee Jones <lee@kernel.org>
-Cc: Matthias Brugger <matthias.bgg@gmail.com>
-Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
-Cc: linux-arm-kernel@lists.infradead.org
-Cc: linux-rpi-kernel@lists.infradead.org
-Cc: linux-mediatek@lists.infradead.org
-Link: http://lkml.kernel.org/r/1430139264-4362-2-git-send-email-k.kozlowski.k@gmail.com
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit 9600973656c697d742e31d202e6212216ea45a3e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/irqchip/exynos-combiner.c | 2 +-
- drivers/irqchip/irq-armada-370-xp.c | 2 +-
- drivers/irqchip/irq-bcm2835.c | 2 +-
- drivers/irqchip/irq-keystone.c | 2 +-
- drivers/irqchip/irq-mips-gic.c | 2 +-
- drivers/irqchip/irq-mtk-sysirq.c | 2 +-
- drivers/irqchip/irq-mxs.c | 2 +-
- drivers/irqchip/irq-renesas-intc-irqpin.c | 2 +-
- drivers/irqchip/irq-renesas-irqc.c | 2 +-
- drivers/irqchip/irq-s3c24xx.c | 4 ++--
- drivers/irqchip/irq-sun4i.c | 2 +-
- drivers/irqchip/irq-versatile-fpga.c | 2 +-
- drivers/irqchip/irq-vic.c | 2 +-
- drivers/irqchip/irq-vt8500.c | 2 +-
- 14 files changed, 15 insertions(+), 15 deletions(-)
-
-diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c
-index 5945223b73fa..a57a3a1f339f 100644
---- a/drivers/irqchip/exynos-combiner.c
-+++ b/drivers/irqchip/exynos-combiner.c
-@@ -164,7 +164,7 @@ static int combiner_irq_domain_map(struct irq_domain *d, unsigned int irq,
- return 0;
- }
-
--static struct irq_domain_ops combiner_irq_domain_ops = {
-+static const struct irq_domain_ops combiner_irq_domain_ops = {
- .xlate = combiner_irq_domain_xlate,
- .map = combiner_irq_domain_map,
- };
-diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
-index daccc8bdbb42..0d3b0fe2f175 100644
---- a/drivers/irqchip/irq-armada-370-xp.c
-+++ b/drivers/irqchip/irq-armada-370-xp.c
-@@ -409,7 +409,7 @@ static struct notifier_block mpic_cascaded_cpu_notifier = {
- };
- #endif /* CONFIG_SMP */
-
--static struct irq_domain_ops armada_370_xp_mpic_irq_ops = {
-+static const struct irq_domain_ops armada_370_xp_mpic_irq_ops = {
- .map = armada_370_xp_mpic_irq_map,
- .xlate = irq_domain_xlate_onecell,
- };
-diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c
-index 5916d6cdafa1..e68c3b60a681 100644
---- a/drivers/irqchip/irq-bcm2835.c
-+++ b/drivers/irqchip/irq-bcm2835.c
-@@ -135,7 +135,7 @@ static int armctrl_xlate(struct irq_domain *d, struct device_node *ctrlr,
- return 0;
- }
-
--static struct irq_domain_ops armctrl_ops = {
-+static const struct irq_domain_ops armctrl_ops = {
- .xlate = armctrl_xlate
- };
-
-diff --git a/drivers/irqchip/irq-keystone.c b/drivers/irqchip/irq-keystone.c
-index 78e8b3ce5252..5dc61655055a 100644
---- a/drivers/irqchip/irq-keystone.c
-+++ b/drivers/irqchip/irq-keystone.c
-@@ -131,7 +131,7 @@ static int keystone_irq_map(struct irq_domain *h, unsigned int virq,
- return 0;
- }
-
--static struct irq_domain_ops keystone_irq_ops = {
-+static const struct irq_domain_ops keystone_irq_ops = {
- .map = keystone_irq_map,
- .xlate = irq_domain_xlate_onecell,
- };
-diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
-index 269c2354c431..4400edd1a6c7 100644
---- a/drivers/irqchip/irq-mips-gic.c
-+++ b/drivers/irqchip/irq-mips-gic.c
-@@ -746,7 +746,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d, struct device_node *ctrlr,
- return 0;
- }
-
--static struct irq_domain_ops gic_irq_domain_ops = {
-+static const struct irq_domain_ops gic_irq_domain_ops = {
- .map = gic_irq_domain_map,
- .xlate = gic_irq_domain_xlate,
- };
-diff --git a/drivers/irqchip/irq-mtk-sysirq.c b/drivers/irqchip/irq-mtk-sysirq.c
-index eaf0a710e98a..04de2d4ca70f 100644
---- a/drivers/irqchip/irq-mtk-sysirq.c
-+++ b/drivers/irqchip/irq-mtk-sysirq.c
-@@ -111,7 +111,7 @@ static int mtk_sysirq_domain_alloc(struct irq_domain *domain, unsigned int virq,
- return irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &gic_data);
- }
-
--static struct irq_domain_ops sysirq_domain_ops = {
-+static const struct irq_domain_ops sysirq_domain_ops = {
- .xlate = mtk_sysirq_domain_xlate,
- .alloc = mtk_sysirq_domain_alloc,
- .free = irq_domain_free_irqs_common,
-diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c
-index e4acf1e3f8e3..04bf97b289cf 100644
---- a/drivers/irqchip/irq-mxs.c
-+++ b/drivers/irqchip/irq-mxs.c
-@@ -90,7 +90,7 @@ static int icoll_irq_domain_map(struct irq_domain *d, unsigned int virq,
- return 0;
- }
-
--static struct irq_domain_ops icoll_irq_domain_ops = {
-+static const struct irq_domain_ops icoll_irq_domain_ops = {
- .map = icoll_irq_domain_map,
- .xlate = irq_domain_xlate_onecell,
- };
-diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c
-index 9a0767b9c89d..0670ab4e3897 100644
---- a/drivers/irqchip/irq-renesas-intc-irqpin.c
-+++ b/drivers/irqchip/irq-renesas-intc-irqpin.c
-@@ -347,7 +347,7 @@ static int intc_irqpin_irq_domain_map(struct irq_domain *h, unsigned int virq,
- return 0;
- }
-
--static struct irq_domain_ops intc_irqpin_irq_domain_ops = {
-+static const struct irq_domain_ops intc_irqpin_irq_domain_ops = {
- .map = intc_irqpin_irq_domain_map,
- .xlate = irq_domain_xlate_twocell,
- };
-diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c
-index cdf80b7794cd..df5bf21a701f 100644
---- a/drivers/irqchip/irq-renesas-irqc.c
-+++ b/drivers/irqchip/irq-renesas-irqc.c
-@@ -168,7 +168,7 @@ static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq,
- return 0;
- }
-
--static struct irq_domain_ops irqc_irq_domain_ops = {
-+static const struct irq_domain_ops irqc_irq_domain_ops = {
- .map = irqc_irq_domain_map,
- .xlate = irq_domain_xlate_twocell,
- };
-diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
-index c8d373fcd823..e96717f45ea1 100644
---- a/drivers/irqchip/irq-s3c24xx.c
-+++ b/drivers/irqchip/irq-s3c24xx.c
-@@ -502,7 +502,7 @@ err:
- return -EINVAL;
- }
-
--static struct irq_domain_ops s3c24xx_irq_ops = {
-+static const struct irq_domain_ops s3c24xx_irq_ops = {
- .map = s3c24xx_irq_map,
- .xlate = irq_domain_xlate_twocell,
- };
-@@ -1228,7 +1228,7 @@ static int s3c24xx_irq_xlate_of(struct irq_domain *d, struct device_node *n,
- return 0;
- }
-
--static struct irq_domain_ops s3c24xx_irq_ops_of = {
-+static const struct irq_domain_ops s3c24xx_irq_ops_of = {
- .map = s3c24xx_irq_map_of,
- .xlate = s3c24xx_irq_xlate_of,
- };
-diff --git a/drivers/irqchip/irq-sun4i.c b/drivers/irqchip/irq-sun4i.c
-index 64155b686081..83d6aa6464ee 100644
---- a/drivers/irqchip/irq-sun4i.c
-+++ b/drivers/irqchip/irq-sun4i.c
-@@ -89,7 +89,7 @@ static int sun4i_irq_map(struct irq_domain *d, unsigned int virq,
- return 0;
- }
-
--static struct irq_domain_ops sun4i_irq_ops = {
-+static const struct irq_domain_ops sun4i_irq_ops = {
- .map = sun4i_irq_map,
- .xlate = irq_domain_xlate_onecell,
- };
-diff --git a/drivers/irqchip/irq-versatile-fpga.c b/drivers/irqchip/irq-versatile-fpga.c
-index 1ab451729a5c..888111b76ea0 100644
---- a/drivers/irqchip/irq-versatile-fpga.c
-+++ b/drivers/irqchip/irq-versatile-fpga.c
-@@ -132,7 +132,7 @@ static int fpga_irqdomain_map(struct irq_domain *d, unsigned int irq,
- return 0;
- }
-
--static struct irq_domain_ops fpga_irqdomain_ops = {
-+static const struct irq_domain_ops fpga_irqdomain_ops = {
- .map = fpga_irqdomain_map,
- .xlate = irq_domain_xlate_onetwocell,
- };
-diff --git a/drivers/irqchip/irq-vic.c b/drivers/irqchip/irq-vic.c
-index 54089debf2dc..d4ce331ea4a0 100644
---- a/drivers/irqchip/irq-vic.c
-+++ b/drivers/irqchip/irq-vic.c
-@@ -256,7 +256,7 @@ static void __exception_irq_entry vic_handle_irq(struct pt_regs *regs)
- } while (handled);
- }
-
--static struct irq_domain_ops vic_irqdomain_ops = {
-+static const struct irq_domain_ops vic_irqdomain_ops = {
- .map = vic_irqdomain_map,
- .xlate = irq_domain_xlate_onetwocell,
- };
-diff --git a/drivers/irqchip/irq-vt8500.c b/drivers/irqchip/irq-vt8500.c
-index b7af816f2769..0b297009b856 100644
---- a/drivers/irqchip/irq-vt8500.c
-+++ b/drivers/irqchip/irq-vt8500.c
-@@ -173,7 +173,7 @@ static int vt8500_irq_map(struct irq_domain *h, unsigned int virq,
- return 0;
- }
-
--static struct irq_domain_ops vt8500_irq_domain_ops = {
-+static const struct irq_domain_ops vt8500_irq_domain_ops = {
- .map = vt8500_irq_map,
- .xlate = irq_domain_xlate_onecell,
- };
---
-2.6.2
-
diff --git a/patches.renesas/0013-irqchip-renesas-intc-irqpin-Improve-binding-document.patch b/patches.renesas/0013-irqchip-renesas-intc-irqpin-Improve-binding-document.patch
deleted file mode 100644
index 75062d1e5c19b8..00000000000000
--- a/patches.renesas/0013-irqchip-renesas-intc-irqpin-Improve-binding-document.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From 8b32551e436e790c61d27f964f892f20a3edf27a Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Fri, 29 May 2015 11:27:43 +0200
-Subject: [PATCH 013/129] irqchip: renesas: intc-irqpin: Improve binding
- documentation
-
-Add missing documentation for required properties:
- - interrupt-controller,
- - parent interrupts (one entry per provided interrupt).
-
-Add missing documentation for optional properties:
- - functional clock (managed since commit 705bc96c2c15313c ("irqchip:
- renesas-intc-irqpin: Add minimal runtime PM support")),
- - power-domains.
-
-Add an example, taken from r8a7740.dtsi.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Cc: Jason Cooper <jason@lakedaemon.net>
-Link: http://lkml.kernel.org/r/1432891663-23641-1-git-send-email-geert%2Brenesas@glider.be
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit 496c28b13eb9d4f9c751b672daad8b110084cfd8)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../interrupt-controller/renesas,intc-irqpin.txt | 39 ++++++++++++++++++++--
- 1 file changed, 37 insertions(+), 2 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.txt b/Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.txt
-index 4f7946ae8adc..772c550d3b4b 100644
---- a/Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.txt
-+++ b/Documentation/devicetree/bindings/interrupt-controller/renesas,intc-irqpin.txt
-@@ -13,9 +13,12 @@ Required properties:
- - reg: Base address and length of each register bank used by the external
- IRQ pins driven by the interrupt controller hardware module. The base
- addresses, length and number of required register banks varies with soctype.
--
-+- interrupt-controller: Identifies the node as an interrupt controller.
- - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined in
-- interrupts.txt in this directory
-+ interrupts.txt in this directory.
-+- interrupts: Must contain a list of interrupt specifiers. For each interrupt
-+ provided by this irqpin controller instance, there must be one entry,
-+ referring to the corresponding parent interrupt.
-
- Optional properties:
-
-@@ -25,3 +28,35 @@ Optional properties:
- if different from the default 4 bits
- - control-parent: disable and enable interrupts on the parent interrupt
- controller, needed for some broken implementations
-+- clocks: Must contain a reference to the functional clock. This property is
-+ mandatory if the hardware implements a controllable functional clock for
-+ the irqpin controller instance.
-+- power-domains: Must contain a reference to the power domain. This property is
-+ mandatory if the irqpin controller instance is part of a controllable power
-+ domain.
-+
-+
-+Example
-+-------
-+
-+ irqpin1: interrupt-controller@e6900004 {
-+ compatible = "renesas,intc-irqpin-r8a7740",
-+ "renesas,intc-irqpin";
-+ #interrupt-cells = <2>;
-+ interrupt-controller;
-+ reg = <0xe6900004 4>,
-+ <0xe6900014 4>,
-+ <0xe6900024 1>,
-+ <0xe6900044 1>,
-+ <0xe6900064 1>;
-+ interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH
-+ 0 149 IRQ_TYPE_LEVEL_HIGH
-+ 0 149 IRQ_TYPE_LEVEL_HIGH
-+ 0 149 IRQ_TYPE_LEVEL_HIGH
-+ 0 149 IRQ_TYPE_LEVEL_HIGH
-+ 0 149 IRQ_TYPE_LEVEL_HIGH
-+ 0 149 IRQ_TYPE_LEVEL_HIGH
-+ 0 149 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp2_clks R8A7740_CLK_INTCA>;
-+ power-domains = <&pd_a4s>;
-+ };
---
-2.6.2
-
diff --git a/patches.renesas/0014-irqchip-irqc-Remove-platform-data-support.patch b/patches.renesas/0014-irqchip-irqc-Remove-platform-data-support.patch
deleted file mode 100644
index 0f33abaae00065..00000000000000
--- a/patches.renesas/0014-irqchip-irqc-Remove-platform-data-support.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-From 1ace3ec7f549b042502883aba16e5680e2061b0c Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:17:50 +0200
-Subject: [PATCH 014/129] irqchip: irqc: Remove platform data support
-
-As of commit 914d7d148411997c ("ARM: shmobile: r8a73a4: Remove legacy
-code"), the Renesas R-Mobile/R-Car interrupt controller is used with DT
-only, and interrupt numbers are thus always assigned automatically.
-
-Drop the platform data declaration and all related support code.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Cc: Jason Cooper <jason@lakedaemon.net>
-Link: http://lkml.kernel.org/r/1430216270-31929-1-git-send-email-geert%2Brenesas@glider.be
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit f31105347cc56c13d552b844ada04418769d875d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/irqchip/irq-renesas-irqc.c | 17 +---------------
- include/linux/platform_data/irq-renesas-irqc.h | 27 --------------------------
- 2 files changed, 1 insertion(+), 43 deletions(-)
- delete mode 100644 include/linux/platform_data/irq-renesas-irqc.h
-
-diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c
-index df5bf21a701f..778bd076aeea 100644
---- a/drivers/irqchip/irq-renesas-irqc.c
-+++ b/drivers/irqchip/irq-renesas-irqc.c
-@@ -29,7 +29,6 @@
- #include <linux/err.h>
- #include <linux/slab.h>
- #include <linux/module.h>
--#include <linux/platform_data/irq-renesas-irqc.h>
- #include <linux/pm_runtime.h>
-
- #define IRQC_IRQ_MAX 32 /* maximum 32 interrupts per driver instance */
-@@ -62,7 +61,6 @@ struct irqc_priv {
- void __iomem *iomem;
- void __iomem *cpu_int_base;
- struct irqc_irq irq[IRQC_IRQ_MAX];
-- struct renesas_irqc_config config;
- unsigned int number_of_irqs;
- struct platform_device *pdev;
- struct irq_chip irq_chip;
-@@ -175,7 +173,6 @@ static const struct irq_domain_ops irqc_irq_domain_ops = {
-
- static int irqc_probe(struct platform_device *pdev)
- {
-- struct renesas_irqc_config *pdata = pdev->dev.platform_data;
- struct irqc_priv *p;
- struct resource *io;
- struct resource *irq;
-@@ -191,10 +188,6 @@ static int irqc_probe(struct platform_device *pdev)
- goto err0;
- }
-
-- /* deal with driver instance configuration */
-- if (pdata)
-- memcpy(&p->config, pdata, sizeof(*pdata));
--
- p->pdev = pdev;
- platform_set_drvdata(pdev, p);
-
-@@ -251,8 +244,7 @@ static int irqc_probe(struct platform_device *pdev)
- irq_chip->flags = IRQCHIP_MASK_ON_SUSPEND;
-
- p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
-- p->number_of_irqs,
-- p->config.irq_base,
-+ p->number_of_irqs, 0,
- &irqc_irq_domain_ops, p);
- if (!p->irq_domain) {
- ret = -ENXIO;
-@@ -272,13 +264,6 @@ static int irqc_probe(struct platform_device *pdev)
-
- dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs);
-
-- /* warn in case of mismatch if irq base is specified */
-- if (p->config.irq_base) {
-- if (p->config.irq_base != p->irq[0].domain_irq)
-- dev_warn(&pdev->dev, "irq base mismatch (%d/%d)\n",
-- p->config.irq_base, p->irq[0].domain_irq);
-- }
--
- return 0;
- err3:
- while (--k >= 0)
-diff --git a/include/linux/platform_data/irq-renesas-irqc.h b/include/linux/platform_data/irq-renesas-irqc.h
-deleted file mode 100644
-index 3ae17b3e00ed..000000000000
---- a/include/linux/platform_data/irq-renesas-irqc.h
-+++ /dev/null
-@@ -1,27 +0,0 @@
--/*
-- * Renesas IRQC Driver
-- *
-- * Copyright (C) 2013 Magnus Damm
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License
-- *
-- * 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.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-- */
--
--#ifndef __IRQ_RENESAS_IRQC_H__
--#define __IRQ_RENESAS_IRQC_H__
--
--struct renesas_irqc_config {
-- unsigned int irq_base;
--};
--
--#endif /* __IRQ_RENESAS_IRQC_H__ */
---
-2.6.2
-
diff --git a/patches.renesas/0015-ARM-shmobile-r8a7790-Remove-MSIOF-address-from-devic.patch b/patches.renesas/0015-ARM-shmobile-r8a7790-Remove-MSIOF-address-from-devic.patch
deleted file mode 100644
index 44769f4276d26a..00000000000000
--- a/patches.renesas/0015-ARM-shmobile-r8a7790-Remove-MSIOF-address-from-devic.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 433577fad6a4919356d66a2aa5118937a41573dc Mon Sep 17 00:00:00 2001
-From: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
-Date: Sun, 5 Apr 2015 01:54:31 +0900
-Subject: [PATCH 015/129] ARM: shmobile: r8a7790: Remove MSIOF address from
- device tree
-
-MSIOF Base Address H'E6xx can be accessed by CPU and DMAC.
-MSIOF Base Address H'E7xx for DMAC was removed from H/W manual.
-
-Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
-Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit c7d1f08a0c91ad9796d6d1fac8eb913e8a6d4288)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index a81cfda0872f..22e73906ec88 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -1282,7 +1282,7 @@
-
- msiof0: spi@e6e20000 {
- compatible = "renesas,msiof-r8a7790";
-- reg = <0 0xe6e20000 0 0x0064>, <0 0xe7e20000 0 0x0064>;
-+ reg = <0 0xe6e20000 0 0x0064>;
- interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7790_CLK_MSIOF0>;
- dmas = <&dmac0 0x51>, <&dmac0 0x52>;
-@@ -1294,7 +1294,7 @@
-
- msiof1: spi@e6e10000 {
- compatible = "renesas,msiof-r8a7790";
-- reg = <0 0xe6e10000 0 0x0064>, <0 0xe7e10000 0 0x0064>;
-+ reg = <0 0xe6e10000 0 0x0064>;
- interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7790_CLK_MSIOF1>;
- dmas = <&dmac0 0x55>, <&dmac0 0x56>;
-@@ -1306,7 +1306,7 @@
-
- msiof2: spi@e6e00000 {
- compatible = "renesas,msiof-r8a7790";
-- reg = <0 0xe6e00000 0 0x0064>, <0 0xe7e00000 0 0x0064>;
-+ reg = <0 0xe6e00000 0 0x0064>;
- interrupts = <0 158 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7790_CLK_MSIOF2>;
- dmas = <&dmac0 0x41>, <&dmac0 0x42>;
-@@ -1318,7 +1318,7 @@
-
- msiof3: spi@e6c90000 {
- compatible = "renesas,msiof-r8a7790";
-- reg = <0 0xe6c90000 0 0x0064>, <0 0xe7c90000 0 0x0064>;
-+ reg = <0 0xe6c90000 0 0x0064>;
- interrupts = <0 159 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7790_CLK_MSIOF3>;
- dmas = <&dmac0 0x45>, <&dmac0 0x46>;
---
-2.6.2
-
diff --git a/patches.renesas/0016-ARM-shmobile-r8a7791-Remove-MSIOF-address-from-devic.patch b/patches.renesas/0016-ARM-shmobile-r8a7791-Remove-MSIOF-address-from-devic.patch
deleted file mode 100644
index 49ee0694e265e3..00000000000000
--- a/patches.renesas/0016-ARM-shmobile-r8a7791-Remove-MSIOF-address-from-devic.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 70340c23abe732d397b5c9ea926ca42519dc074c Mon Sep 17 00:00:00 2001
-From: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
-Date: Sun, 5 Apr 2015 01:55:12 +0900
-Subject: [PATCH 016/129] ARM: shmobile: r8a7791: Remove MSIOF address from
- device tree
-
-MSIOF Base Address H'E6xx can be accessed by CPU and DMAC.
-MSIOF Base Address H'E7xx for DMAC was removed from H/W manual.
-
-Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
-Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit cb6d08a2b61fc0025a0148d06b71b8a7d0920e98)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/spi/sh-msiof.txt | 2 +-
- arch/arm/boot/dts/r8a7791.dtsi | 6 +++---
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt b/Documentation/devicetree/bindings/spi/sh-msiof.txt
-index 4c388bb2f0a2..8f771441be60 100644
---- a/Documentation/devicetree/bindings/spi/sh-msiof.txt
-+++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt
-@@ -60,7 +60,7 @@ Example:
-
- msiof0: spi@e6e20000 {
- compatible = "renesas,msiof-r8a7791";
-- reg = <0 0xe6e20000 0 0x0064>, <0 0xe7e20000 0 0x0064>;
-+ reg = <0 0xe6e20000 0 0x0064>;
- interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>;
- dmas = <&dmac0 0x51>, <&dmac0 0x52>;
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index 20ab76680884..d2c41ad701cc 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -1297,7 +1297,7 @@
-
- msiof0: spi@e6e20000 {
- compatible = "renesas,msiof-r8a7791";
-- reg = <0 0xe6e20000 0 0x0064>, <0 0xe7e20000 0 0x0064>;
-+ reg = <0 0xe6e20000 0 0x0064>;
- interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>;
- dmas = <&dmac0 0x51>, <&dmac0 0x52>;
-@@ -1309,7 +1309,7 @@
-
- msiof1: spi@e6e10000 {
- compatible = "renesas,msiof-r8a7791";
-- reg = <0 0xe6e10000 0 0x0064>, <0 0xe7e10000 0 0x0064>;
-+ reg = <0 0xe6e10000 0 0x0064>;
- interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7791_CLK_MSIOF1>;
- dmas = <&dmac0 0x55>, <&dmac0 0x56>;
-@@ -1321,7 +1321,7 @@
-
- msiof2: spi@e6e00000 {
- compatible = "renesas,msiof-r8a7791";
-- reg = <0 0xe6e00000 0 0x0064>, <0 0xe7e00000 0 0x0064>;
-+ reg = <0 0xe6e00000 0 0x0064>;
- interrupts = <0 158 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7791_CLK_MSIOF2>;
- dmas = <&dmac0 0x41>, <&dmac0 0x42>;
---
-2.6.2
-
diff --git a/patches.renesas/0017-ARM-shmobile-r8a7740-dtsi-Fix-SCIFB-naming.patch b/patches.renesas/0017-ARM-shmobile-r8a7740-dtsi-Fix-SCIFB-naming.patch
deleted file mode 100644
index b5f931578ab591..00000000000000
--- a/patches.renesas/0017-ARM-shmobile-r8a7740-dtsi-Fix-SCIFB-naming.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 534bed2687d605e01175dfcd057d1f02c0a2c656 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 15:55:23 +0200
-Subject: [PATCH 017/129] ARM: shmobile: r8a7740 dtsi: Fix SCIFB naming
-
-The single SCIFB on R-Mobile A1 is called "scifb", not "scifb8".
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 50663822618670a1e6ea1dd9912790fd7ed3be0b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7740.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
-index 83c1c3ca1b8f..413590d6c316 100644
---- a/arch/arm/boot/dts/r8a7740.dtsi
-+++ b/arch/arm/boot/dts/r8a7740.dtsi
-@@ -275,7 +275,7 @@
- status = "disabled";
- };
-
-- scifb8: serial@e6c30000 {
-+ scifb: serial@e6c30000 {
- compatible = "renesas,scifb-r8a7740", "renesas,scifb";
- reg = <0xe6c30000 0x100>;
- interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>;
---
-2.6.2
-
diff --git a/patches.renesas/0018-ARM-shmobile-sh73a0-dtsi-Fix-SCIFB-naming.patch b/patches.renesas/0018-ARM-shmobile-sh73a0-dtsi-Fix-SCIFB-naming.patch
deleted file mode 100644
index 42f52c3cb02cc0..00000000000000
--- a/patches.renesas/0018-ARM-shmobile-sh73a0-dtsi-Fix-SCIFB-naming.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From b14ff4c4ec70c011f094585c616175765f582962 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 15:55:24 +0200
-Subject: [PATCH 018/129] ARM: shmobile: sh73a0 dtsi: Fix SCIFB naming
-
-The single SCIFB on SH-Mobile AG5 is called "scifb", not "scifb8".
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit dfaac7b7e4015ca2e690c7ea4421aec1405de966)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/sh73a0.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
-index 45b539ce4d35..cde61b463b6a 100644
---- a/arch/arm/boot/dts/sh73a0.dtsi
-+++ b/arch/arm/boot/dts/sh73a0.dtsi
-@@ -376,7 +376,7 @@
- status = "disabled";
- };
-
-- scifb8: serial@e6c30000 {
-+ scifb: serial@e6c30000 {
- compatible = "renesas,scifb-sh73a0", "renesas,scifb";
- reg = <0xe6c30000 0x100>;
- interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
---
-2.6.2
-
diff --git a/patches.renesas/0019-ARM-shmobile-defconfig-Replace-USB_RCAR_GEN2_PHY-by-.patch b/patches.renesas/0019-ARM-shmobile-defconfig-Replace-USB_RCAR_GEN2_PHY-by-.patch
deleted file mode 100644
index 0efeb8c2e08b99..00000000000000
--- a/patches.renesas/0019-ARM-shmobile-defconfig-Replace-USB_RCAR_GEN2_PHY-by-.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 341ad1683fe8a5ff4c2cf2df48501dc9f3bb6e94 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 14:08:03 +0200
-Subject: [PATCH 019/129] ARM: shmobile: defconfig: Replace USB_RCAR_GEN2_PHY
- by PHY_RCAR_GEN2
-
-The legacy-only USB_RCAR_GEN2_PHY driver was replaced by the DT-only
-PHY_RCAR_GEN2 driver.
-
-Refresh the defconfig using "make savedefconfig" while we're at it.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 90037558d5ed25a63499c3973cc1af25da02f673)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/configs/shmobile_defconfig | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
-index b58618e2d13c..9961fbd633f8 100644
---- a/arch/arm/configs/shmobile_defconfig
-+++ b/arch/arm/configs/shmobile_defconfig
-@@ -121,7 +121,6 @@ CONFIG_WATCHDOG=y
- CONFIG_DA9063_WATCHDOG=y
- CONFIG_MFD_AS3711=y
- CONFIG_MFD_DA9063=y
--CONFIG_REGULATOR=y
- CONFIG_REGULATOR_AS3711=y
- CONFIG_REGULATOR_DA9210=y
- CONFIG_REGULATOR_GPIO=y
-@@ -160,7 +159,6 @@ CONFIG_USB_OHCI_HCD=y
- CONFIG_USB_R8A66597_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
-@@ -182,6 +180,8 @@ CONFIG_IIO=y
- CONFIG_AK8975=y
- CONFIG_PWM=y
- CONFIG_PWM_RENESAS_TPU=y
-+CONFIG_GENERIC_PHY=y
-+CONFIG_PHY_RCAR_GEN2=y
- # CONFIG_DNOTIFY is not set
- CONFIG_MSDOS_FS=y
- CONFIG_VFAT_FS=y
---
-2.6.2
-
diff --git a/patches.renesas/0020-ARM-shmobile-r8a7740-dtsi-Use-generic-names-for-devi.patch b/patches.renesas/0020-ARM-shmobile-r8a7740-dtsi-Use-generic-names-for-devi.patch
deleted file mode 100644
index 6840b4b8121e66..00000000000000
--- a/patches.renesas/0020-ARM-shmobile-r8a7740-dtsi-Use-generic-names-for-devi.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 4cd871a72a3fc1dce6cffb91fe03721ac24b9b4d Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:25 +0200
-Subject: [PATCH 020/129] ARM: shmobile: r8a7740 dtsi: Use generic names for
- device nodes
-
-irqpin -> interrupt-controller
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 32e4094238f10dce95bf9f8eacdf84a880182db5)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7740.dtsi | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
-index 413590d6c316..d84714468cce 100644
---- a/arch/arm/boot/dts/r8a7740.dtsi
-+++ b/arch/arm/boot/dts/r8a7740.dtsi
-@@ -67,7 +67,7 @@
- };
-
- /* irqpin0: IRQ0 - IRQ7 */
-- irqpin0: irqpin@e6900000 {
-+ irqpin0: interrupt-controller@e6900000 {
- compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- interrupt-controller;
-@@ -89,7 +89,7 @@
- };
-
- /* irqpin1: IRQ8 - IRQ15 */
-- irqpin1: irqpin@e6900004 {
-+ irqpin1: interrupt-controller@e6900004 {
- compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- interrupt-controller;
-@@ -111,7 +111,7 @@
- };
-
- /* irqpin2: IRQ16 - IRQ23 */
-- irqpin2: irqpin@e6900008 {
-+ irqpin2: interrupt-controller@e6900008 {
- compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- interrupt-controller;
-@@ -133,7 +133,7 @@
- };
-
- /* irqpin3: IRQ24 - IRQ31 */
-- irqpin3: irqpin@e690000c {
-+ irqpin3: interrupt-controller@e690000c {
- compatible = "renesas,intc-irqpin-r8a7740", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- interrupt-controller;
---
-2.6.2
-
diff --git a/patches.renesas/0021-ARM-shmobile-r8a7778-dtsi-Use-generic-names-for-devi.patch b/patches.renesas/0021-ARM-shmobile-r8a7778-dtsi-Use-generic-names-for-devi.patch
deleted file mode 100644
index 05bde476ba1bd6..00000000000000
--- a/patches.renesas/0021-ARM-shmobile-r8a7778-dtsi-Use-generic-names-for-devi.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 892f198b9df52f8c9f4569c68250b58e7fc51909 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:26 +0200
-Subject: [PATCH 021/129] ARM: shmobile: r8a7778 dtsi: Use generic names for
- device nodes
-
-irqpin -> interrupt-controller
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit b38150fae0164d363c852d6b782ab7083697c6d2)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7778.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
-index 868f97309533..7ce9f5fd5865 100644
---- a/arch/arm/boot/dts/r8a7778.dtsi
-+++ b/arch/arm/boot/dts/r8a7778.dtsi
-@@ -68,7 +68,7 @@
- };
-
- /* irqpin: IRQ0 - IRQ3 */
-- irqpin: irqpin@fe78001c {
-+ irqpin: interrupt-controller@fe78001c {
- compatible = "renesas,intc-irqpin-r8a7778", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- interrupt-controller;
---
-2.6.2
-
diff --git a/patches.renesas/0022-ARM-shmobile-r8a7779-dtsi-Use-generic-names-for-devi.patch b/patches.renesas/0022-ARM-shmobile-r8a7779-dtsi-Use-generic-names-for-devi.patch
deleted file mode 100644
index 3c65780f06dbbe..00000000000000
--- a/patches.renesas/0022-ARM-shmobile-r8a7779-dtsi-Use-generic-names-for-devi.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From a66e6a237431eb6ef5450543a8f6ca9fa7363552 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:27 +0200
-Subject: [PATCH 022/129] ARM: shmobile: r8a7779 dtsi: Use generic names for
- device nodes
-
-irqpin -> interrupt-controller
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit a37771c6e36f2db84a67074d35d7519f75939b43)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7779.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
-index 5c2219b9f3eb..5c8071e87ae9 100644
---- a/arch/arm/boot/dts/r8a7779.dtsi
-+++ b/arch/arm/boot/dts/r8a7779.dtsi
-@@ -148,7 +148,7 @@
- interrupt-controller;
- };
-
-- irqpin0: irqpin@fe780010 {
-+ irqpin0: interrupt-controller@fe780010 {
- compatible = "renesas,intc-irqpin-r8a7779", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- status = "disabled";
---
-2.6.2
-
diff --git a/patches.renesas/0023-ARM-shmobile-r8a7790-dtsi-Use-generic-names-for-devi.patch b/patches.renesas/0023-ARM-shmobile-r8a7790-dtsi-Use-generic-names-for-devi.patch
deleted file mode 100644
index 1aba76b2c81a00..00000000000000
--- a/patches.renesas/0023-ARM-shmobile-r8a7790-dtsi-Use-generic-names-for-devi.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 706ff2b4e5f302387f26f828b2f8e476263f67a6 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:28 +0200
-Subject: [PATCH 023/129] ARM: shmobile: r8a7790 dtsi: Use generic names for
- device nodes
-
-rcar_sound -> sound
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit b694e3807b5b12273ba057e8cfcf82c2331606e0)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index 22e73906ec88..c9055e39b8bb 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -1451,7 +1451,7 @@
- status = "disabled";
- };
-
-- rcar_sound: rcar_sound@ec500000 {
-+ rcar_sound: sound@ec500000 {
- /*
- * #sound-dai-cells is required
- *
---
-2.6.2
-
diff --git a/patches.renesas/0024-ARM-shmobile-r8a7791-dtsi-Use-generic-names-for-devi.patch b/patches.renesas/0024-ARM-shmobile-r8a7791-dtsi-Use-generic-names-for-devi.patch
deleted file mode 100644
index f73ee5ed14cb2c..00000000000000
--- a/patches.renesas/0024-ARM-shmobile-r8a7791-dtsi-Use-generic-names-for-devi.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 4f8c205b0bdab2b1b545b5cb4c5cfc3942519b81 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:29 +0200
-Subject: [PATCH 024/129] ARM: shmobile: r8a7791 dtsi: Use generic names for
- device nodes
-
-rcar_sound -> sound
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 6c63e07dcc2e941288d18e3fe9b448265f9ca9d0)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index d2c41ad701cc..30e1e13a228f 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -1494,7 +1494,7 @@
- status = "disabled";
- };
-
-- rcar_sound: rcar_sound@ec500000 {
-+ rcar_sound: sound@ec500000 {
- /*
- * #sound-dai-cells is required
- *
---
-2.6.2
-
diff --git a/patches.renesas/0025-ARM-shmobile-sh73a0-dtsi-Use-generic-names-for-devic.patch b/patches.renesas/0025-ARM-shmobile-sh73a0-dtsi-Use-generic-names-for-devic.patch
deleted file mode 100644
index d59cea3fd364f5..00000000000000
--- a/patches.renesas/0025-ARM-shmobile-sh73a0-dtsi-Use-generic-names-for-devic.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 4bb5e8985d471d3e0aea62c50635733ba07882bc Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:30 +0200
-Subject: [PATCH 025/129] ARM: shmobile: sh73a0 dtsi: Use generic names for
- device nodes
-
-irqpin -> interrupt-controller
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 4239baee807bbd93e89eef184b2547f5ae902615)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/sh73a0.dtsi | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
-index cde61b463b6a..11e17c5f26e2 100644
---- a/arch/arm/boot/dts/sh73a0.dtsi
-+++ b/arch/arm/boot/dts/sh73a0.dtsi
-@@ -90,7 +90,7 @@
- status = "disabled";
- };
-
-- irqpin0: irqpin@e6900000 {
-+ irqpin0: interrupt-controller@e6900000 {
- compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- interrupt-controller;
-@@ -112,7 +112,7 @@
- control-parent;
- };
-
-- irqpin1: irqpin@e6900004 {
-+ irqpin1: interrupt-controller@e6900004 {
- compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- interrupt-controller;
-@@ -134,7 +134,7 @@
- control-parent;
- };
-
-- irqpin2: irqpin@e6900008 {
-+ irqpin2: interrupt-controller@e6900008 {
- compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- interrupt-controller;
-@@ -156,7 +156,7 @@
- control-parent;
- };
-
-- irqpin3: irqpin@e690000c {
-+ irqpin3: interrupt-controller@e690000c {
- compatible = "renesas,intc-irqpin-sh73a0", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- interrupt-controller;
---
-2.6.2
-
diff --git a/patches.renesas/0026-ARM-shmobile-ape6evm-dts-Use-generic-names-for-devic.patch b/patches.renesas/0026-ARM-shmobile-ape6evm-dts-Use-generic-names-for-devic.patch
deleted file mode 100644
index dae41e31d66de5..00000000000000
--- a/patches.renesas/0026-ARM-shmobile-ape6evm-dts-Use-generic-names-for-devic.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 07cfd9bc103e4cac10a03d5e9c674c0c643181e7 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:31 +0200
-Subject: [PATCH 026/129] ARM: shmobile: ape6evm dts: Use generic names for
- device nodes
-
-max8973 -> regulator
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit e8545be97479972346a1519412c5330b4223ca20)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a73a4-ape6evm.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a73a4-ape6evm.dts b/arch/arm/boot/dts/r8a73a4-ape6evm.dts
-index 81a38ceee098..a4c425923c05 100644
---- a/arch/arm/boot/dts/r8a73a4-ape6evm.dts
-+++ b/arch/arm/boot/dts/r8a73a4-ape6evm.dts
-@@ -147,7 +147,7 @@
-
- &i2c5 {
- status = "okay";
-- vdd_dvfs: max8973@1b {
-+ vdd_dvfs: regulator@1b {
- compatible = "maxim,max8973";
- reg = <0x1b>;
-
---
-2.6.2
-
diff --git a/patches.renesas/0027-ARM-shmobile-kzm9d-dts-Use-generic-names-for-device-.patch b/patches.renesas/0027-ARM-shmobile-kzm9d-dts-Use-generic-names-for-device-.patch
deleted file mode 100644
index ac982a5a92ac45..00000000000000
--- a/patches.renesas/0027-ARM-shmobile-kzm9d-dts-Use-generic-names-for-device-.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 28f203d7b86bf690814fa93fff09cb426fd37e27 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:33 +0200
-Subject: [PATCH 027/129] ARM: shmobile: kzm9d dts: Use generic names for
- device nodes
-
-lan9220 -> ethernet
-uart -> serial
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 69478b2093796860e3991db102ede97131b8d67a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/emev2-kzm9d.dts | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/boot/dts/emev2-kzm9d.dts b/arch/arm/boot/dts/emev2-kzm9d.dts
-index 19446273e4a7..1dee0aa4f40c 100644
---- a/arch/arm/boot/dts/emev2-kzm9d.dts
-+++ b/arch/arm/boot/dts/emev2-kzm9d.dts
-@@ -81,7 +81,7 @@
- regulator-boot-on;
- };
-
-- lan9220@20000000 {
-+ ethernet@20000000 {
- compatible = "smsc,lan9220", "smsc,lan9115";
- reg = <0x20000000 0x10000>;
- phy-mode = "mii";
-@@ -96,7 +96,7 @@
- };
-
- &pfc {
-- uart1_pins: uart@e1030000 {
-+ uart1_pins: serial@e1030000 {
- renesas,groups = "uart1_ctrl", "uart1_data";
- renesas,function = "uart1";
- };
---
-2.6.2
-
diff --git a/patches.renesas/0028-ARM-shmobile-marzen-dts-Use-generic-names-for-device.patch b/patches.renesas/0028-ARM-shmobile-marzen-dts-Use-generic-names-for-device.patch
deleted file mode 100644
index ffcd25ce94cfcc..00000000000000
--- a/patches.renesas/0028-ARM-shmobile-marzen-dts-Use-generic-names-for-device.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 5400a5cd96d0f7e15f3532ba61fd36c95cb6a925 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:34 +0200
-Subject: [PATCH 028/129] ARM: shmobile: marzen dts: Use generic names for
- device nodes
-
-lan0 -> ethernet
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit f92d9dc7e6cd15dcd096dc5a4d3e1fe0a034f659)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7779-marzen.dts | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/arch/arm/boot/dts/r8a7779-marzen.dts b/arch/arm/boot/dts/r8a7779-marzen.dts
-index 540756cdf391..20afea6f06ef 100644
---- a/arch/arm/boot/dts/r8a7779-marzen.dts
-+++ b/arch/arm/boot/dts/r8a7779-marzen.dts
-@@ -42,10 +42,10 @@
- regulator-always-on;
- };
-
-- lan0@18000000 {
-+ ethernet@18000000 {
- compatible = "smsc,lan9220", "smsc,lan9115";
- reg = <0x18000000 0x100>;
-- pinctrl-0 = <&lan0_pins>;
-+ pinctrl-0 = <&ethernet_pins>;
- pinctrl-names = "default";
-
- phy-mode = "mii";
-@@ -176,7 +176,7 @@
- };
- };
-
-- lan0_pins: lan0 {
-+ ethernet_pins: ethernet {
- intc {
- renesas,groups = "intc_irq1_b";
- renesas,function = "intc";
---
-2.6.2
-
diff --git a/patches.renesas/0029-ARM-shmobile-armadillo800eva-dts-Use-generic-names-f.patch b/patches.renesas/0029-ARM-shmobile-armadillo800eva-dts-Use-generic-names-f.patch
deleted file mode 100644
index 46fa098c4feeb0..00000000000000
--- a/patches.renesas/0029-ARM-shmobile-armadillo800eva-dts-Use-generic-names-f.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From e2a4b32b835b2773cc68ac885f89b15e12033bca Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:55:32 +0200
-Subject: [PATCH 029/129] ARM: shmobile: armadillo800eva dts: Use generic names
- for device nodes
-
-wm8978 -> codec
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 92d2434d8effe6160eb7f4fd0d01ef5b76930f2a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7740-armadillo800eva.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
-index 9bd0cb439f44..2e31d8c01cbf 100644
---- a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
-+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
-@@ -208,7 +208,7 @@
- gpios = <&pfc 166 GPIO_ACTIVE_LOW>;
- };
-
-- wm8978: wm8978@1a {
-+ wm8978: codec@1a {
- #sound-dai-cells = <0>;
- compatible = "wlf,wm8978";
- reg = <0x1a>;
---
-2.6.2
-
diff --git a/patches.renesas/0030-ARM-shmobile-henninger-dts-Add-nor-jedec-compatible-.patch b/patches.renesas/0030-ARM-shmobile-henninger-dts-Add-nor-jedec-compatible-.patch
deleted file mode 100644
index 4d95e48cd47180..00000000000000
--- a/patches.renesas/0030-ARM-shmobile-henninger-dts-Add-nor-jedec-compatible-.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 04272a6589af8828ca0df59a6d1f19a19573aa17 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:12:56 +0200
-Subject: [PATCH 030/129] ARM: shmobile: henninger dts: Add "nor-jedec"
- compatible value
-
-Spansion s25fl512s is compatible with "nor-jedec". Hence add the
-"nor-jedec" compatible value, so the driver can bind against the generic
-name, cfr. commit 8ff16cf77ce314c2 ("Documentation: devicetree: m25p80:
-add "nor-jedec" binding").
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 7aa4008133cc5c1dab7006c6f2773de2ce6e8786)
-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 e33e4047b0b0..bb80122b4113 100644
---- a/arch/arm/boot/dts/r8a7791-henninger.dts
-+++ b/arch/arm/boot/dts/r8a7791-henninger.dts
-@@ -226,7 +226,7 @@
- flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl512s";
-+ compatible = "spansion,s25fl512s", "nor-jedec";
- reg = <0>;
- spi-max-frequency = <30000000>;
- spi-tx-bus-width = <4>;
---
-2.6.2
-
diff --git a/patches.renesas/0031-ARM-shmobile-bockw-reference-dts-Add-nor-jedec-compa.patch b/patches.renesas/0031-ARM-shmobile-bockw-reference-dts-Add-nor-jedec-compa.patch
deleted file mode 100644
index fd0ff9501a4275..00000000000000
--- a/patches.renesas/0031-ARM-shmobile-bockw-reference-dts-Add-nor-jedec-compa.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From ed17bedc06c92c4346cbd27d658c8da8ebdce8fc Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:12:57 +0200
-Subject: [PATCH 031/129] ARM: shmobile: bockw-reference dts: Add "nor-jedec"
- compatible value
-
-Spansion s25fl008k is compatible with "nor-jedec". Hence add the
-"nor-jedec" compatible value, so the driver can bind against the generic
-name, cfr. commit 8ff16cf77ce314c2 ("Documentation: devicetree: m25p80:
-add "nor-jedec" binding").
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 97c5afdffaca5d549e5680a2e1264d74821c287c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7778-bockw-reference.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
-index 04c0c37bb784..f9422d887b44 100644
---- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
-+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
-@@ -119,7 +119,7 @@
- flash: flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl008k";
-+ compatible = "spansion,s25fl008k", "nor-jedec";
- reg = <0>;
- spi-max-frequency = <104000000>;
- m25p,fast-read;
---
-2.6.2
-
diff --git a/patches.renesas/0032-ARM-shmobile-lager-dts-Add-nor-jedec-compatible-valu.patch b/patches.renesas/0032-ARM-shmobile-lager-dts-Add-nor-jedec-compatible-valu.patch
deleted file mode 100644
index 355f213dd83a39..00000000000000
--- a/patches.renesas/0032-ARM-shmobile-lager-dts-Add-nor-jedec-compatible-valu.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From ea6c31e5140587282360b8a2958657bd5008ada5 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:12:55 +0200
-Subject: [PATCH 032/129] ARM: shmobile: lager dts: Add "nor-jedec" compatible
- value
-
-Spansion s25fl512s is compatible with "nor-jedec". Hence add the
-"nor-jedec" compatible value, so the driver can bind against the generic
-name, cfr. commit 8ff16cf77ce314c2 ("Documentation: devicetree: m25p80:
-add "nor-jedec" binding").
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 7821637c4da224bdcca54421d07a0bb43e6955a9)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790-lager.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
-index aaa4f258e279..a6c793de8d80 100644
---- a/arch/arm/boot/dts/r8a7790-lager.dts
-+++ b/arch/arm/boot/dts/r8a7790-lager.dts
-@@ -429,7 +429,7 @@
- flash: flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl512s";
-+ compatible = "spansion,s25fl512s", "nor-jedec";
- reg = <0>;
- spi-max-frequency = <30000000>;
- spi-tx-bus-width = <4>;
---
-2.6.2
-
diff --git a/patches.renesas/0033-ARM-shmobile-bockw-dts-Add-nor-jedec-compatible-valu.patch b/patches.renesas/0033-ARM-shmobile-bockw-dts-Add-nor-jedec-compatible-valu.patch
deleted file mode 100644
index a2dcc579630efb..00000000000000
--- a/patches.renesas/0033-ARM-shmobile-bockw-dts-Add-nor-jedec-compatible-valu.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From ee61923de182e40c892431e179afea0bd9a5f2b8 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:12:58 +0200
-Subject: [PATCH 033/129] ARM: shmobile: bockw dts: Add "nor-jedec" compatible
- value
-
-Spansion s25fl008k is compatible with "nor-jedec". Hence add the
-"nor-jedec" compatible value, so the driver can bind against the generic
-name, cfr. commit 8ff16cf77ce314c2 ("Documentation: devicetree: m25p80:
-add "nor-jedec" binding").
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit e31cc1e28791e73ae7f9fb382e25b60257790dc6)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7778-bockw.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7778-bockw.dts b/arch/arm/boot/dts/r8a7778-bockw.dts
-index 787fa6f9f46d..7ebc4a4f4608 100644
---- a/arch/arm/boot/dts/r8a7778-bockw.dts
-+++ b/arch/arm/boot/dts/r8a7778-bockw.dts
-@@ -186,7 +186,7 @@
- flash: flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl008k";
-+ compatible = "spansion,s25fl008k", "nor-jedec";
- reg = <0>;
- spi-max-frequency = <104000000>;
- m25p,fast-read;
---
-2.6.2
-
diff --git a/patches.renesas/0034-ARM-shmobile-koelsch-dts-Add-nor-jedec-compatible-va.patch b/patches.renesas/0034-ARM-shmobile-koelsch-dts-Add-nor-jedec-compatible-va.patch
deleted file mode 100644
index 6d8db50d8ebdf4..00000000000000
--- a/patches.renesas/0034-ARM-shmobile-koelsch-dts-Add-nor-jedec-compatible-va.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From cabe329bbd5f99fac948ef2a5d2fec5c2d274529 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:12:54 +0200
-Subject: [PATCH 034/129] ARM: shmobile: koelsch dts: Add "nor-jedec"
- compatible value
-
-Spansion s25fl512s is compatible with "nor-jedec". Hence add the
-"nor-jedec" compatible value, so the driver can bind against the generic
-name, cfr. commit 8ff16cf77ce314c2 ("Documentation: devicetree: m25p80:
-add "nor-jedec" binding").
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit b20cac26acb53a652b28efc5b94757fe2ef6178e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791-koelsch.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
-index 824ddab9c3ad..6163487289b3 100644
---- a/arch/arm/boot/dts/r8a7791-koelsch.dts
-+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
-@@ -474,7 +474,7 @@
- flash: flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl512s";
-+ compatible = "spansion,s25fl512s", "nor-jedec";
- reg = <0>;
- spi-max-frequency = <30000000>;
- spi-tx-bus-width = <4>;
---
-2.6.2
-
diff --git a/patches.renesas/0035-ARM-shmobile-bockw-dts-Use-generic-names-for-device-.patch b/patches.renesas/0035-ARM-shmobile-bockw-dts-Use-generic-names-for-device-.patch
deleted file mode 100644
index c2d927c1c474bd..00000000000000
--- a/patches.renesas/0035-ARM-shmobile-bockw-dts-Use-generic-names-for-device-.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 0a7a70d1b3627029140d5d369c33244606b9af45 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:29:21 +0200
-Subject: [PATCH 035/129] ARM: shmobile: bockw dts: Use generic names for
- device nodes
-
-sound-codec -> codec
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 61ffb5ca6c8e5246c7b257a733c33b94b19de3da)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7778-bockw.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7778-bockw.dts b/arch/arm/boot/dts/r8a7778-bockw.dts
-index 7ebc4a4f4608..dfbb12e4fef4 100644
---- a/arch/arm/boot/dts/r8a7778-bockw.dts
-+++ b/arch/arm/boot/dts/r8a7778-bockw.dts
-@@ -85,7 +85,7 @@
- &i2c0 {
- status = "okay";
-
-- ak4643: sound-codec@12 {
-+ ak4643: codec@12 {
- compatible = "asahi-kasei,ak4643";
- #sound-dai-cells = <0>;
- reg = <0x12>;
---
-2.6.2
-
diff --git a/patches.renesas/0036-ARM-shmobile-lager-dts-Use-generic-names-for-device-.patch b/patches.renesas/0036-ARM-shmobile-lager-dts-Use-generic-names-for-device-.patch
deleted file mode 100644
index d8c30be7cc6cbc..00000000000000
--- a/patches.renesas/0036-ARM-shmobile-lager-dts-Use-generic-names-for-device-.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From cd9a77bfb064a47348c700c4bb030701ca52994e Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:29:22 +0200
-Subject: [PATCH 036/129] ARM: shmobile: lager dts: Use generic names for
- device nodes
-
-sound-codec -> codec
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit d22b16876b62b4ffe2b4e31fb7a6e1af1a45fa25)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790-lager.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
-index a6c793de8d80..b6cffcedd116 100644
---- a/arch/arm/boot/dts/r8a7790-lager.dts
-+++ b/arch/arm/boot/dts/r8a7790-lager.dts
-@@ -525,7 +525,7 @@
-
- clock-frequency = <100000>;
-
-- ak4643: sound-codec@12 {
-+ ak4643: codec@12 {
- compatible = "asahi-kasei,ak4643";
- #sound-dai-cells = <0>;
- reg = <0x12>;
---
-2.6.2
-
diff --git a/patches.renesas/0037-ARM-shmobile-koelsch-dts-Use-generic-names-for-devic.patch b/patches.renesas/0037-ARM-shmobile-koelsch-dts-Use-generic-names-for-devic.patch
deleted file mode 100644
index 14fc0c8d6591aa..00000000000000
--- a/patches.renesas/0037-ARM-shmobile-koelsch-dts-Use-generic-names-for-devic.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From adebc612aa01d519f4d64124ba93ca66c2c062d8 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:29:23 +0200
-Subject: [PATCH 037/129] ARM: shmobile: koelsch dts: Use generic names for
- device nodes
-
-sound-codec -> codec
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 95cfb59a27360bbfd337d011676893f2726bfb42)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791-koelsch.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
-index 6163487289b3..e9c24036f000 100644
---- a/arch/arm/boot/dts/r8a7791-koelsch.dts
-+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
-@@ -522,7 +522,7 @@
- status = "okay";
- clock-frequency = <100000>;
-
-- ak4643: sound-codec@12 {
-+ ak4643: codec@12 {
- compatible = "asahi-kasei,ak4643";
- #sound-dai-cells = <0>;
- reg = <0x12>;
---
-2.6.2
-
diff --git a/patches.renesas/0038-ARM-shmobile-kzm9g-dts-Configure-the-HOME-key-as-wak.patch b/patches.renesas/0038-ARM-shmobile-kzm9g-dts-Configure-the-HOME-key-as-wak.patch
deleted file mode 100644
index 18f14e01e58bf2..00000000000000
--- a/patches.renesas/0038-ARM-shmobile-kzm9g-dts-Configure-the-HOME-key-as-wak.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From ff0714f5c9a4fbe68214e7566af21708ef5fc083 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 4 May 2015 19:36:09 +0200
-Subject: [PATCH 038/129] ARM: shmobile: kzm9g dts: Configure the HOME key as
- wake-up source
-
-Note that from now on any of the pfc8575 gpio keys will wake up the
-system, as the pfc8575 cannot mask individual interrupts.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit cab7562a92edb89668fe548f5d8c8300e7438c62)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/sh73a0-kzm9g.dts | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm/boot/dts/sh73a0-kzm9g.dts b/arch/arm/boot/dts/sh73a0-kzm9g.dts
-index 022ba505f573..24b4cd24dceb 100644
---- a/arch/arm/boot/dts/sh73a0-kzm9g.dts
-+++ b/arch/arm/boot/dts/sh73a0-kzm9g.dts
-@@ -147,6 +147,7 @@
- gpios = <&pcf8575 14 GPIO_ACTIVE_LOW>;
- linux,code = <KEY_HOME>;
- label = "SW1";
-+ gpio-key,wakeup;
- };
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0039-ARM-shmobile-r8a7790-add-USB-DMAC-device-nodes.patch b/patches.renesas/0039-ARM-shmobile-r8a7790-add-USB-DMAC-device-nodes.patch
deleted file mode 100644
index 9c85ea48cfb22f..00000000000000
--- a/patches.renesas/0039-ARM-shmobile-r8a7790-add-USB-DMAC-device-nodes.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 0042512348f5967bd65cb0d56a4d9dd53e3d2724 Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Fri, 8 May 2015 16:13:06 +0900
-Subject: [PATCH 039/129] ARM: shmobile: r8a7790: add USB-DMAC device nodes
-
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit a3ff2090dc2a358bfe9e3d4c50f3921a732feb30)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index c9055e39b8bb..c03a91506c2e 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -371,6 +371,28 @@
- dma-channels = <13>;
- };
-
-+ usb_dmac0: dma-controller@e65a0000 {
-+ compatible = "renesas,usb-dmac";
-+ reg = <0 0xe65a0000 0 0x100>;
-+ interrupts = <0 109 IRQ_TYPE_LEVEL_HIGH
-+ 0 109 IRQ_TYPE_LEVEL_HIGH>;
-+ interrupt-names = "ch0", "ch1";
-+ clocks = <&mstp3_clks R8A7790_CLK_USBDMAC0>;
-+ #dma-cells = <1>;
-+ dma-channels = <2>;
-+ };
-+
-+ usb_dmac1: dma-controller@e65b0000 {
-+ compatible = "renesas,usb-dmac";
-+ reg = <0 0xe65b0000 0 0x100>;
-+ interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH
-+ 0 110 IRQ_TYPE_LEVEL_HIGH>;
-+ interrupt-names = "ch0", "ch1";
-+ clocks = <&mstp3_clks R8A7790_CLK_USBDMAC1>;
-+ #dma-cells = <1>;
-+ dma-channels = <2>;
-+ };
-+
- i2c0: i2c@e6508000 {
- #address-cells = <1>;
- #size-cells = <0>;
---
-2.6.2
-
diff --git a/patches.renesas/0040-ARM-shmobile-r8a7790-Enable-DMA-for-HSUSB.patch b/patches.renesas/0040-ARM-shmobile-r8a7790-Enable-DMA-for-HSUSB.patch
deleted file mode 100644
index fbac55e63b30b8..00000000000000
--- a/patches.renesas/0040-ARM-shmobile-r8a7790-Enable-DMA-for-HSUSB.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 24342ebd276466e7addb6cadf6c38bacc55a3daa Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Fri, 8 May 2015 16:13:07 +0900
-Subject: [PATCH 040/129] ARM: shmobile: r8a7790: Enable DMA for HSUSB
-
-This patch adds DMA properties to the HSUSB node.
-
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit e8295dc39136a23b090885f43e13087cd460fc26)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index c03a91506c2e..62a9086b133d 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -673,6 +673,9 @@
- renesas,buswait = <4>;
- phys = <&usb0 1>;
- phy-names = "usb";
-+ dmas = <&usb_dmac0 0>, <&usb_dmac0 1>,
-+ <&usb_dmac1 0>, <&usb_dmac1 1>;
-+ dma-names = "ch0", "ch1", "ch2", "ch3";
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0041-ARM-shmobile-r8a7791-add-USB-DMAC-device-nodes.patch b/patches.renesas/0041-ARM-shmobile-r8a7791-add-USB-DMAC-device-nodes.patch
deleted file mode 100644
index 22778ffbc662d3..00000000000000
--- a/patches.renesas/0041-ARM-shmobile-r8a7791-add-USB-DMAC-device-nodes.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 5d028095da01eca25b6d185770818afbf65f8de3 Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Fri, 8 May 2015 16:13:33 +0900
-Subject: [PATCH 041/129] ARM: shmobile: r8a7791: add USB-DMAC device nodes
-
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit e3e25edc1116ebf44b1813aff03b02b7737d41ca)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index 30e1e13a228f..754c3f20f224 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -358,6 +358,28 @@
- dma-channels = <13>;
- };
-
-+ usb_dmac0: dma-controller@e65a0000 {
-+ compatible = "renesas,usb-dmac";
-+ reg = <0 0xe65a0000 0 0x100>;
-+ interrupts = <0 109 IRQ_TYPE_LEVEL_HIGH
-+ 0 109 IRQ_TYPE_LEVEL_HIGH>;
-+ interrupt-names = "ch0", "ch1";
-+ clocks = <&mstp3_clks R8A7791_CLK_USBDMAC0>;
-+ #dma-cells = <1>;
-+ dma-channels = <2>;
-+ };
-+
-+ usb_dmac1: dma-controller@e65b0000 {
-+ compatible = "renesas,usb-dmac";
-+ reg = <0 0xe65b0000 0 0x100>;
-+ interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH
-+ 0 110 IRQ_TYPE_LEVEL_HIGH>;
-+ interrupt-names = "ch0", "ch1";
-+ clocks = <&mstp3_clks R8A7791_CLK_USBDMAC1>;
-+ #dma-cells = <1>;
-+ dma-channels = <2>;
-+ };
-+
- /* The memory map in the User's Manual maps the cores to bus numbers */
- i2c0: i2c@e6508000 {
- #address-cells = <1>;
---
-2.6.2
-
diff --git a/patches.renesas/0042-ARM-shmobile-r8a7791-Enable-DMA-for-HSUSB.patch b/patches.renesas/0042-ARM-shmobile-r8a7791-Enable-DMA-for-HSUSB.patch
deleted file mode 100644
index 18066759fc7d3c..00000000000000
--- a/patches.renesas/0042-ARM-shmobile-r8a7791-Enable-DMA-for-HSUSB.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 6dad4acc84563723ad2a12dfd6fcdb9699fab746 Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Fri, 8 May 2015 16:13:34 +0900
-Subject: [PATCH 042/129] ARM: shmobile: r8a7791: Enable DMA for HSUSB
-
-This patch adds DMA properties to the HSUSB node.
-
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 7706993e2deb75022dbcfc3043890aa1a0020189)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index 754c3f20f224..7613abea13d7 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -723,6 +723,9 @@
- renesas,buswait = <4>;
- phys = <&usb0 1>;
- phy-names = "usb";
-+ dmas = <&usb_dmac0 0>, <&usb_dmac0 1>,
-+ <&usb_dmac1 0>, <&usb_dmac1 1>;
-+ dma-names = "ch0", "ch1", "ch2", "ch3";
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0043-ARM-shmobile-lager-dts-Replace-nor-jedec-by-jedec-sp.patch b/patches.renesas/0043-ARM-shmobile-lager-dts-Replace-nor-jedec-by-jedec-sp.patch
deleted file mode 100644
index 4fed0fd488b6c8..00000000000000
--- a/patches.renesas/0043-ARM-shmobile-lager-dts-Replace-nor-jedec-by-jedec-sp.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 9075eeacaefed852fd06c01a7407178cdc414cbd Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 20 May 2015 20:16:52 +0200
-Subject: [PATCH 043/129] ARM: shmobile: lager dts: Replace "nor-jedec" by
- "jedec,spi-nor"
-
-Cfr. commit 8947e396a8296c52 ('Documentation: dt: mtd: replace
-"nor-jedec" binding with "jedec, spi-nor"')
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Brian Norris <computersforpeace@gmail.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 755185b279171d78a12f879d06502866c6173b04)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790-lager.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
-index b6cffcedd116..2eb8a995ae9f 100644
---- a/arch/arm/boot/dts/r8a7790-lager.dts
-+++ b/arch/arm/boot/dts/r8a7790-lager.dts
-@@ -429,7 +429,7 @@
- flash: flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl512s", "nor-jedec";
-+ compatible = "spansion,s25fl512s", "jedec,spi-nor";
- reg = <0>;
- spi-max-frequency = <30000000>;
- spi-tx-bus-width = <4>;
---
-2.6.2
-
diff --git a/patches.renesas/0044-ARM-shmobile-koelsch-dts-Replace-nor-jedec-by-jedec-.patch b/patches.renesas/0044-ARM-shmobile-koelsch-dts-Replace-nor-jedec-by-jedec-.patch
deleted file mode 100644
index d5d0f2ea7c7164..00000000000000
--- a/patches.renesas/0044-ARM-shmobile-koelsch-dts-Replace-nor-jedec-by-jedec-.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From ebe0743a9b2be4f643c76852158c6fbb81022882 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 20 May 2015 20:16:54 +0200
-Subject: [PATCH 044/129] ARM: shmobile: koelsch dts: Replace "nor-jedec" by
- "jedec,spi-nor"
-
-Cfr. commit 8947e396a8296c52 ('Documentation: dt: mtd: replace
-"nor-jedec" binding with "jedec, spi-nor"')
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Brian Norris <computersforpeace@gmail.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit cc3db02c9c7cb0c322263b3a6983023b04e3944f)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791-koelsch.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
-index e9c24036f000..cffe33ff4d16 100644
---- a/arch/arm/boot/dts/r8a7791-koelsch.dts
-+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
-@@ -474,7 +474,7 @@
- flash: flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl512s", "nor-jedec";
-+ compatible = "spansion,s25fl512s", "jedec,spi-nor";
- reg = <0>;
- spi-max-frequency = <30000000>;
- spi-tx-bus-width = <4>;
---
-2.6.2
-
diff --git a/patches.renesas/0045-ARM-shmobile-bockw-reference-dts-Replace-nor-jedec-b.patch b/patches.renesas/0045-ARM-shmobile-bockw-reference-dts-Replace-nor-jedec-b.patch
deleted file mode 100644
index 89f0ed269f318e..00000000000000
--- a/patches.renesas/0045-ARM-shmobile-bockw-reference-dts-Replace-nor-jedec-b.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 9ee0d44a3b7231451f5f7ef9616354553536e045 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 20 May 2015 20:16:50 +0200
-Subject: [PATCH 045/129] ARM: shmobile: bockw-reference dts: Replace
- "nor-jedec" by "jedec,spi-nor"
-
-Cfr. commit 8947e396a8296c52 ('Documentation: dt: mtd: replace
-"nor-jedec" binding with "jedec, spi-nor"')
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Brian Norris <computersforpeace@gmail.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 49633bbbebcd2e398799389542d621bd9b8c5c56)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7778-bockw-reference.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
-index f9422d887b44..dffa6ff30360 100644
---- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
-+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
-@@ -119,7 +119,7 @@
- flash: flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl008k", "nor-jedec";
-+ compatible = "spansion,s25fl008k", "jedec,spi-nor";
- reg = <0>;
- spi-max-frequency = <104000000>;
- m25p,fast-read;
---
-2.6.2
-
diff --git a/patches.renesas/0046-ARM-shmobile-henninger-dts-Replace-nor-jedec-by-jede.patch b/patches.renesas/0046-ARM-shmobile-henninger-dts-Replace-nor-jedec-by-jede.patch
deleted file mode 100644
index b35a4646007343..00000000000000
--- a/patches.renesas/0046-ARM-shmobile-henninger-dts-Replace-nor-jedec-by-jede.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 5f9f8af0316c67e30eee3c41536d7cf95690ccf2 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 20 May 2015 20:16:53 +0200
-Subject: [PATCH 046/129] ARM: shmobile: henninger dts: Replace "nor-jedec" by
- "jedec,spi-nor"
-
-Cfr. commit 8947e396a8296c52 ('Documentation: dt: mtd: replace
-"nor-jedec" binding with "jedec, spi-nor"')
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Brian Norris <computersforpeace@gmail.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit aad8afc7ac3d9af6f7c43961fc6f41d401207b00)
-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 bb80122b4113..655d1804e5e9 100644
---- a/arch/arm/boot/dts/r8a7791-henninger.dts
-+++ b/arch/arm/boot/dts/r8a7791-henninger.dts
-@@ -226,7 +226,7 @@
- flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl512s", "nor-jedec";
-+ compatible = "spansion,s25fl512s", "jedec,spi-nor";
- reg = <0>;
- spi-max-frequency = <30000000>;
- spi-tx-bus-width = <4>;
---
-2.6.2
-
diff --git a/patches.renesas/0047-ARM-shmobile-bockw-dts-Replace-nor-jedec-by-jedec-sp.patch b/patches.renesas/0047-ARM-shmobile-bockw-dts-Replace-nor-jedec-by-jedec-sp.patch
deleted file mode 100644
index c656ebc53db425..00000000000000
--- a/patches.renesas/0047-ARM-shmobile-bockw-dts-Replace-nor-jedec-by-jedec-sp.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From cf4ddc0aed1368a0c77f9eed3619bf8d6d26d726 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 20 May 2015 20:16:51 +0200
-Subject: [PATCH 047/129] ARM: shmobile: bockw dts: Replace "nor-jedec" by
- "jedec,spi-nor"
-
-Cfr. commit 8947e396a8296c52 ('Documentation: dt: mtd: replace
-"nor-jedec" binding with "jedec, spi-nor"')
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Brian Norris <computersforpeace@gmail.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 9cc785702d9f6367fdecf0fba6e425198e0754c8)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7778-bockw.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7778-bockw.dts b/arch/arm/boot/dts/r8a7778-bockw.dts
-index dfbb12e4fef4..90543b12d7e2 100644
---- a/arch/arm/boot/dts/r8a7778-bockw.dts
-+++ b/arch/arm/boot/dts/r8a7778-bockw.dts
-@@ -186,7 +186,7 @@
- flash: flash@0 {
- #address-cells = <1>;
- #size-cells = <1>;
-- compatible = "spansion,s25fl008k", "nor-jedec";
-+ compatible = "spansion,s25fl008k", "jedec,spi-nor";
- reg = <0>;
- spi-max-frequency = <104000000>;
- m25p,fast-read;
---
-2.6.2
-
diff --git a/patches.renesas/0048-ARM-shmobile-r8a7790-add-MMCIF-max-frequency.patch b/patches.renesas/0048-ARM-shmobile-r8a7790-add-MMCIF-max-frequency.patch
deleted file mode 100644
index c703a5ee730a99..00000000000000
--- a/patches.renesas/0048-ARM-shmobile-r8a7790-add-MMCIF-max-frequency.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 609af72e289d40f7067b9eb026aed371f0e54ed0 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Thu, 14 May 2015 07:23:04 +0000
-Subject: [PATCH 048/129] ARM: shmobile: r8a7790: add MMCIF max-frequency
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 96370057bd47e8785312e151e3b32ad712693910)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index 62a9086b133d..70248df02342 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -490,6 +490,7 @@
- dma-names = "tx", "rx";
- reg-io-width = <4>;
- status = "disabled";
-+ max-frequency = <97500000>;
- };
-
- mmcif1: mmc@ee220000 {
-@@ -501,6 +502,7 @@
- dma-names = "tx", "rx";
- reg-io-width = <4>;
- status = "disabled";
-+ max-frequency = <97500000>;
- };
-
- pfc: pfc@e6060000 {
---
-2.6.2
-
diff --git a/patches.renesas/0049-ARM-shmobile-r8a7791-add-MMCIF-max-frequency.patch b/patches.renesas/0049-ARM-shmobile-r8a7791-add-MMCIF-max-frequency.patch
deleted file mode 100644
index 7769715ef279e2..00000000000000
--- a/patches.renesas/0049-ARM-shmobile-r8a7791-add-MMCIF-max-frequency.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 497508657af7ae9b4d8246307e5fb2b25c7b300b Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Thu, 14 May 2015 07:23:20 +0000
-Subject: [PATCH 049/129] ARM: shmobile: r8a7791: add MMCIF max-frequency
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit d957ab8dbd79ccd32f6f7c42651b956bb892858d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index 7613abea13d7..bbef666596e5 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -494,6 +494,7 @@
- dma-names = "tx", "rx";
- reg-io-width = <4>;
- status = "disabled";
-+ max-frequency = <97500000>;
- };
-
- sdhi0: sd@ee100000 {
---
-2.6.2
-
diff --git a/patches.renesas/0050-ARM-shmobile-only-select-sound-drivers-that-build.patch b/patches.renesas/0050-ARM-shmobile-only-select-sound-drivers-that-build.patch
deleted file mode 100644
index 557155a2ced9f2..00000000000000
--- a/patches.renesas/0050-ARM-shmobile-only-select-sound-drivers-that-build.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From cf4477018ef6d52f8ca4b34455667bfa70c6516b Mon Sep 17 00:00:00 2001
-From: Arnd Bergmann <arnd@arndb.de>
-Date: Tue, 19 May 2015 15:40:37 +0200
-Subject: [PATCH 050/129] ARM: shmobile: only select sound drivers that build
-
-A couple of codec drivers are selected by shmobile platform code,
-but depend on I2C, which results in a build error:
-
-sound/soc/codecs/ak4642.c:638:1: warning: data definition has no type or storage class
- module_i2c_driver(ak4642_i2c_driver);
- ^
-sound/soc/codecs/ak4642.c:638:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
-sound/soc/codecs/ak4642.c:638:1: warning: parameter names (without types) in function declaration
-sound/soc/codecs/ak4642.c:627:26: warning: 'ak4642_i2c_driver' defined but not used [-Wunused-variable]
-
-This ensures that we do not enable the respective drivers when I2C
-is disabled.
-
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 66f72f0c8e0d37339b6be1373c61d2a133c8b422)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/Kconfig | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index 0fb484221c90..45006479d461 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -139,7 +139,7 @@ config MACH_ARMADILLO800EVA
- select ARCH_REQUIRE_GPIOLIB
- select REGULATOR_FIXED_VOLTAGE if REGULATOR
- select SMSC_PHY if SH_ETH
-- select SND_SOC_WM8978 if SND_SIMPLE_CARD
-+ select SND_SOC_WM8978 if SND_SIMPLE_CARD && I2C
- select USE_OF
-
- config MACH_BOCKW
-@@ -148,7 +148,7 @@ config MACH_BOCKW
- select ARCH_REQUIRE_GPIOLIB
- select REGULATOR_FIXED_VOLTAGE if REGULATOR
- select SND_SOC_AK4554 if SND_SIMPLE_CARD
-- select SND_SOC_AK4642 if SND_SIMPLE_CARD
-+ select SND_SOC_AK4642 if SND_SIMPLE_CARD && I2C
- select USE_OF
-
- config MACH_BOCKW_REFERENCE
---
-2.6.2
-
diff --git a/patches.renesas/0051-ARM-shmobile-r8a7794-dtsi-Describe-DMA-for-the-seria.patch b/patches.renesas/0051-ARM-shmobile-r8a7794-dtsi-Describe-DMA-for-the-seria.patch
deleted file mode 100644
index b462504be4f3ad..00000000000000
--- a/patches.renesas/0051-ARM-shmobile-r8a7794-dtsi-Describe-DMA-for-the-seria.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From cd949bd80cdfdeb1acfc7710c626120904ad2e72 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 20 May 2015 19:46:27 +0200
-Subject: [PATCH 051/129] ARM: shmobile: r8a7794 dtsi: Describe DMA for the
- serial ports
-
-Add DMA properties to all SCIF, SCIFA, SCIFB, and HSCIF device nodes.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 8233a0dee931a9ba7eb3991682538234fbe2729b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7794.dtsi | 36 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 36 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
-index 01cf54f70501..b73819423311 100644
---- a/arch/arm/boot/dts/r8a7794.dtsi
-+++ b/arch/arm/boot/dts/r8a7794.dtsi
-@@ -174,6 +174,8 @@
- interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7794_CLK_SCIFA0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x21>, <&dmac0 0x22>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -183,6 +185,8 @@
- interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7794_CLK_SCIFA1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x25>, <&dmac0 0x26>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -192,6 +196,8 @@
- interrupts = <0 151 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7794_CLK_SCIFA2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x27>, <&dmac0 0x28>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -201,6 +207,8 @@
- interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp11_clks R8A7794_CLK_SCIFA3>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x1b>, <&dmac0 0x1c>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -210,6 +218,8 @@
- interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp11_clks R8A7794_CLK_SCIFA4>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x1f>, <&dmac0 0x20>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -219,6 +229,8 @@
- interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp11_clks R8A7794_CLK_SCIFA5>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x23>, <&dmac0 0x24>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -228,6 +240,8 @@
- interrupts = <0 148 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7794_CLK_SCIFB0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x3d>, <&dmac0 0x3e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -237,6 +251,8 @@
- interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7794_CLK_SCIFB1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x19>, <&dmac0 0x1a>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -246,6 +262,8 @@
- interrupts = <0 150 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7794_CLK_SCIFB2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x1d>, <&dmac0 0x1e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -255,6 +273,8 @@
- interrupts = <0 152 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7794_CLK_SCIF0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x29>, <&dmac0 0x2a>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -264,6 +284,8 @@
- interrupts = <0 153 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7794_CLK_SCIF1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x2d>, <&dmac0 0x2e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -273,6 +295,8 @@
- interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7794_CLK_SCIF2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x2b>, <&dmac0 0x2c>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -282,6 +306,8 @@
- interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7794_CLK_SCIF3>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x2f>, <&dmac0 0x30>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -291,6 +317,8 @@
- interrupts = <0 24 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7794_CLK_SCIF4>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0xfb>, <&dmac0 0xfc>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -300,6 +328,8 @@
- interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7794_CLK_SCIF5>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0xfd>, <&dmac0 0xfe>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -309,6 +339,8 @@
- interrupts = <0 154 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7794_CLK_HSCIF0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x39>, <&dmac0 0x3a>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -318,6 +350,8 @@
- interrupts = <0 155 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7794_CLK_HSCIF1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x4d>, <&dmac0 0x4e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -327,6 +361,8 @@
- interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7794_CLK_HSCIF2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x3b>, <&dmac0 0x3c>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0052-ARM-shmobile-r8a7791-dtsi-Describe-DMA-for-the-seria.patch b/patches.renesas/0052-ARM-shmobile-r8a7791-dtsi-Describe-DMA-for-the-seria.patch
deleted file mode 100644
index 9324426d417c9c..00000000000000
--- a/patches.renesas/0052-ARM-shmobile-r8a7791-dtsi-Describe-DMA-for-the-seria.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From c50a934834f3bc72e8226a4e57c57358669e1bbd Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 20 May 2015 19:46:26 +0200
-Subject: [PATCH 052/129] ARM: shmobile: r8a7791 dtsi: Describe DMA for the
- serial ports
-
-Add DMA properties to all SCIF, SCIFA, SCIFB, and HSCIF device nodes.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 558d656513cd481f65f492ab8685605aa85577cf)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 36 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 36 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index bbef666596e5..dc1cd3f16606 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -533,6 +533,8 @@
- interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7791_CLK_SCIFA0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x21>, <&dmac0 0x22>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -542,6 +544,8 @@
- interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7791_CLK_SCIFA1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x25>, <&dmac0 0x26>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -551,6 +555,8 @@
- interrupts = <0 151 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7791_CLK_SCIFA2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x27>, <&dmac0 0x28>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -560,6 +566,8 @@
- interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp11_clks R8A7791_CLK_SCIFA3>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x1b>, <&dmac0 0x1c>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -569,6 +577,8 @@
- interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp11_clks R8A7791_CLK_SCIFA4>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x1f>, <&dmac0 0x20>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -578,6 +588,8 @@
- interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp11_clks R8A7791_CLK_SCIFA5>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x23>, <&dmac0 0x24>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -587,6 +599,8 @@
- interrupts = <0 148 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7791_CLK_SCIFB0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x3d>, <&dmac0 0x3e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -596,6 +610,8 @@
- interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7791_CLK_SCIFB1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x19>, <&dmac0 0x1a>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -605,6 +621,8 @@
- interrupts = <0 150 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7791_CLK_SCIFB2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x1d>, <&dmac0 0x1e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -614,6 +632,8 @@
- interrupts = <0 152 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_SCIF0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x29>, <&dmac0 0x2a>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -623,6 +643,8 @@
- interrupts = <0 153 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_SCIF1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x2d>, <&dmac0 0x2e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -632,6 +654,8 @@
- interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_SCIF2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x2b>, <&dmac0 0x2c>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -641,6 +665,8 @@
- interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_SCIF3>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x2f>, <&dmac0 0x30>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -650,6 +676,8 @@
- interrupts = <0 24 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_SCIF4>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0xfb>, <&dmac0 0xfc>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -659,6 +687,8 @@
- interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_SCIF5>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0xfd>, <&dmac0 0xfe>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -668,6 +698,8 @@
- interrupts = <0 154 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_HSCIF0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x39>, <&dmac0 0x3a>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -677,6 +709,8 @@
- interrupts = <0 155 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_HSCIF1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x4d>, <&dmac0 0x4e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -686,6 +720,8 @@
- interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_HSCIF2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x3b>, <&dmac0 0x3c>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0053-ARM-shmobile-r8a7790-dtsi-Describe-DMA-for-the-seria.patch b/patches.renesas/0053-ARM-shmobile-r8a7790-dtsi-Describe-DMA-for-the-seria.patch
deleted file mode 100644
index 33ccd61440950b..00000000000000
--- a/patches.renesas/0053-ARM-shmobile-r8a7790-dtsi-Describe-DMA-for-the-seria.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 124bafc41647f7e1e2476da169f470792737a03d Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 20 May 2015 19:46:25 +0200
-Subject: [PATCH 053/129] ARM: shmobile: r8a7790 dtsi: Describe DMA for the
- serial ports
-
-Add DMA properties to all SCIF, SCIFA, SCIFB, and HSCIF device nodes.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit acea43fcb02746e907725c6dbd2eb95b32d79ea5)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 20 ++++++++++++++++++++
- 1 file changed, 20 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index 70248df02342..51ab8865ea37 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -556,6 +556,8 @@
- interrupts = <0 144 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7790_CLK_SCIFA0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x21>, <&dmac0 0x22>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -565,6 +567,8 @@
- interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7790_CLK_SCIFA1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x25>, <&dmac0 0x26>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -574,6 +578,8 @@
- interrupts = <0 151 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7790_CLK_SCIFA2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x27>, <&dmac0 0x28>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -583,6 +589,8 @@
- interrupts = <0 148 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7790_CLK_SCIFB0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x3d>, <&dmac0 0x3e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -592,6 +600,8 @@
- interrupts = <0 149 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7790_CLK_SCIFB1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x19>, <&dmac0 0x1a>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -601,6 +611,8 @@
- interrupts = <0 150 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp2_clks R8A7790_CLK_SCIFB2>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x1d>, <&dmac0 0x1e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -610,6 +622,8 @@
- interrupts = <0 152 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7790_CLK_SCIF0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x29>, <&dmac0 0x2a>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -619,6 +633,8 @@
- interrupts = <0 153 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7790_CLK_SCIF1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x2d>, <&dmac0 0x2e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -628,6 +644,8 @@
- interrupts = <0 154 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7790_CLK_HSCIF0>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x39>, <&dmac0 0x3a>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
-@@ -637,6 +655,8 @@
- interrupts = <0 155 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7790_CLK_HSCIF1>;
- clock-names = "sci_ick";
-+ dmas = <&dmac0 0x4d>, <&dmac0 0x4e>;
-+ dma-names = "tx", "rx";
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0055-ARM-shmobile-r8a7740-remove-I2C-errata-handling.patch b/patches.renesas/0055-ARM-shmobile-r8a7740-remove-I2C-errata-handling.patch
deleted file mode 100644
index 998e6021499153..00000000000000
--- a/patches.renesas/0055-ARM-shmobile-r8a7740-remove-I2C-errata-handling.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-From b456622171e2a171a5a929e6a4915b705387505b Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Tue, 9 Jun 2015 16:14:40 +0900
-Subject: [PATCH 055/129] ARM: shmobile: r8a7740: remove I2C errata handling
-
-This is now done in the I2C driver.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit b6eba5598dc69d1f3a79183d2521da53d336006e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/setup-r8a7740.c | 55 ----------------------------------
- 1 file changed, 55 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
-index 9832e48396a4..00291cc1772d 100644
---- a/arch/arm/mach-shmobile/setup-r8a7740.c
-+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
-@@ -13,7 +13,6 @@
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
--#include <linux/delay.h>
- #include <linux/dma-mapping.h>
- #include <linux/kernel.h>
- #include <linux/init.h>
-@@ -690,56 +689,6 @@ void __init r8a7740_meram_workaround(void)
- }
- }
-
--#define ICCR 0x0004
--#define ICSTART 0x0070
--
--#define i2c_read(reg, offset) ioread8(reg + offset)
--#define i2c_write(reg, offset, data) iowrite8(data, reg + offset)
--
--/*
-- * r8a7740 chip has lasting errata on I2C I/O pad reset.
-- * this is work-around for it.
-- */
--static void r8a7740_i2c_workaround(struct platform_device *pdev)
--{
-- struct resource *res;
-- void __iomem *reg;
--
-- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- if (unlikely(!res)) {
-- pr_err("r8a7740 i2c workaround fail (cannot find resource)\n");
-- return;
-- }
--
-- reg = ioremap(res->start, resource_size(res));
-- if (unlikely(!reg)) {
-- pr_err("r8a7740 i2c workaround fail (cannot map IO)\n");
-- return;
-- }
--
-- i2c_write(reg, ICCR, i2c_read(reg, ICCR) | 0x80);
-- i2c_read(reg, ICCR); /* dummy read */
--
-- i2c_write(reg, ICSTART, i2c_read(reg, ICSTART) | 0x10);
-- i2c_read(reg, ICSTART); /* dummy read */
--
-- udelay(10);
--
-- i2c_write(reg, ICCR, 0x01);
-- i2c_write(reg, ICSTART, 0x00);
--
-- udelay(10);
--
-- i2c_write(reg, ICCR, 0x10);
-- udelay(10);
-- i2c_write(reg, ICCR, 0x00);
-- udelay(10);
-- i2c_write(reg, ICCR, 0x10);
-- udelay(10);
--
-- iounmap(reg);
--}
--
- void __init r8a7740_add_standard_devices(void)
- {
- static struct pm_domain_device domain_devices[] __initdata = {
-@@ -766,10 +715,6 @@ void __init r8a7740_add_standard_devices(void)
- { "A3SP", &usb_dma_device },
- };
-
-- /* I2C work-around */
-- r8a7740_i2c_workaround(&i2c0_device);
-- r8a7740_i2c_workaround(&i2c1_device);
--
- r8a7740_init_pm_domains();
-
- /* add devices */
---
-2.6.2
-
diff --git a/patches.renesas/0056-phy-core-Check-requested-PHY-status-in-_of_phy_get.patch b/patches.renesas/0056-phy-core-Check-requested-PHY-status-in-_of_phy_get.patch
deleted file mode 100644
index 5916b99d884f3b..00000000000000
--- a/patches.renesas/0056-phy-core-Check-requested-PHY-status-in-_of_phy_get.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-From 96a1c11500ec358d8695ad5b77dad1d1b9601251 Mon Sep 17 00:00:00 2001
-From: Axel Lin <axel.lin@ingics.com>
-Date: Tue, 7 Apr 2015 12:23:38 +0800
-Subject: [PATCH 056/129] phy: core: Check requested PHY status in
- _of_phy_get()
-
-This is a common checking in various drivers, so move the checking to
-_of_phy_get().
-
-Signed-off-by: Axel Lin <axel.lin@ingics.com>
-Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
-(cherry picked from commit 33f434d283a27116fb358ae5bc3b42967c12f85a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/phy/phy-core.c | 12 ++++++++++--
- drivers/phy/phy-miphy28lp.c | 5 -----
- drivers/phy/phy-miphy365x.c | 5 -----
- drivers/phy/phy-rcar-gen2.c | 5 -----
- 4 files changed, 10 insertions(+), 17 deletions(-)
-
---- a/drivers/phy/phy-core.c
-+++ b/drivers/phy/phy-core.c
-@@ -369,13 +369,21 @@ static struct phy *_of_phy_get(struct de
- phy_provider = of_phy_provider_lookup(args.np);
- if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner)) {
- phy = ERR_PTR(-EPROBE_DEFER);
-- goto err0;
-+ goto out_unlock;
-+ }
-+
-+ if (!of_device_is_available(args.np)) {
-+ dev_warn(phy_provider->dev, "Requested PHY is disabled\n");
-+ phy = ERR_PTR(-ENODEV);
-+ goto out_put_module;
- }
-
- phy = phy_provider->of_xlate(phy_provider->dev, &args);
-+
-+out_put_module:
- module_put(phy_provider->owner);
-
--err0:
-+out_unlock:
- mutex_unlock(&phy_provider_mutex);
- of_node_put(args.np);
-
---- a/drivers/phy/phy-miphy28lp.c
-+++ b/drivers/phy/phy-miphy28lp.c
-@@ -1107,11 +1107,6 @@ static struct phy *miphy28lp_xlate(struc
- struct device_node *phynode = args->np;
- int ret, index = 0;
-
-- if (!of_device_is_available(phynode)) {
-- dev_warn(dev, "Requested PHY is disabled\n");
-- return ERR_PTR(-ENODEV);
-- }
--
- if (args->args_count != 1) {
- dev_err(dev, "Invalid number of cells in 'phy' property\n");
- return ERR_PTR(-EINVAL);
---- a/drivers/phy/phy-miphy365x.c
-+++ b/drivers/phy/phy-miphy365x.c
-@@ -476,11 +476,6 @@ static struct phy *miphy365x_xlate(struc
- struct device_node *phynode = args->np;
- int ret, index;
-
-- if (!of_device_is_available(phynode)) {
-- dev_warn(dev, "Requested PHY is disabled\n");
-- return ERR_PTR(-ENODEV);
-- }
--
- if (args->args_count != 1) {
- dev_err(dev, "Invalid number of cells in 'phy' property\n");
- return ERR_PTR(-EINVAL);
---- a/drivers/phy/phy-rcar-gen2.c
-+++ b/drivers/phy/phy-rcar-gen2.c
-@@ -206,11 +206,6 @@ static struct phy *rcar_gen2_phy_xlate(s
- struct device_node *np = args->np;
- int i;
-
-- if (!of_device_is_available(np)) {
-- dev_warn(dev, "Requested PHY is disabled\n");
-- return ERR_PTR(-ENODEV);
-- }
--
- drv = dev_get_drvdata(dev);
- if (!drv)
- return ERR_PTR(-EINVAL);
diff --git a/patches.renesas/0057-phy-rcar-gen2-Add-support-for-R-Car-E2.patch b/patches.renesas/0057-phy-rcar-gen2-Add-support-for-R-Car-E2.patch
deleted file mode 100644
index 5b6bed74aefb12..00000000000000
--- a/patches.renesas/0057-phy-rcar-gen2-Add-support-for-R-Car-E2.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 7cdbbecbf680db240868769543fcc634661b6f79 Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Mon, 18 May 2015 18:33:47 +0900
-Subject: [PATCH 057/129] phy: rcar-gen2: Add support for R-Car E2
-
-This patch adds a compatible string to support for R-Car E2.
-
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
-(cherry picked from commit 9d699bf4dbe29d8f26769ea81dec4a8c91edcd5a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/phy/rcar-gen2-phy.txt | 1 +
- drivers/phy/phy-rcar-gen2.c | 1 +
- 2 files changed, 2 insertions(+)
-
-diff --git a/Documentation/devicetree/bindings/phy/rcar-gen2-phy.txt b/Documentation/devicetree/bindings/phy/rcar-gen2-phy.txt
-index 00fc52a034b7..d564ba4f1cf6 100644
---- a/Documentation/devicetree/bindings/phy/rcar-gen2-phy.txt
-+++ b/Documentation/devicetree/bindings/phy/rcar-gen2-phy.txt
-@@ -6,6 +6,7 @@ This file provides information on what the device node for the R-Car generation
- Required properties:
- - compatible: "renesas,usb-phy-r8a7790" if the device is a part of R8A7790 SoC.
- "renesas,usb-phy-r8a7791" if the device is a part of R8A7791 SoC.
-+ "renesas,usb-phy-r8a7794" if the device is a part of R8A7794 SoC.
- - reg: offset and length of the register block.
- - #address-cells: number of address cells for the USB channel subnodes, must
- be <1>.
-diff --git a/drivers/phy/phy-rcar-gen2.c b/drivers/phy/phy-rcar-gen2.c
-index 0da62d45486a..39d9b2995435 100644
---- a/drivers/phy/phy-rcar-gen2.c
-+++ b/drivers/phy/phy-rcar-gen2.c
-@@ -195,6 +195,7 @@ static struct phy_ops rcar_gen2_phy_ops = {
- static const struct of_device_id rcar_gen2_phy_match_table[] = {
- { .compatible = "renesas,usb-phy-r8a7790" },
- { .compatible = "renesas,usb-phy-r8a7791" },
-+ { .compatible = "renesas,usb-phy-r8a7794" },
- { }
- };
- MODULE_DEVICE_TABLE(of, rcar_gen2_phy_match_table);
---
-2.6.2
-
diff --git a/patches.renesas/0058-usb-phy-Remove-the-phy-rcar-gen2-usb-driver.patch b/patches.renesas/0058-usb-phy-Remove-the-phy-rcar-gen2-usb-driver.patch
deleted file mode 100644
index 4001d9017e8779..00000000000000
--- a/patches.renesas/0058-usb-phy-Remove-the-phy-rcar-gen2-usb-driver.patch
+++ /dev/null
@@ -1,345 +0,0 @@
-From 5ece5493efff7d640b54caa55c12c2829ac961e3 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 14:04:07 +0200
-Subject: [PATCH 058/129] usb: phy: Remove the phy-rcar-gen2-usb driver
-
-The phy-rcar-gen2-usb driver, which supports legacy platform data only,
-is no longer used since commit a483dcbfa21f919c ("ARM: shmobile: lager:
-Remove legacy board support").
-
-This driver was superseded by the DT-only phy-rcar-gen2 driver, which
-was introduced in commit 1233f59f745b237d ("phy: Renesas R-Car Gen2 PHY
-driver").
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit 34ef33f7da6b00900d3a896d33522a035a930245)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/usb/phy/Kconfig | 13 --
- drivers/usb/phy/Makefile | 1 -
- drivers/usb/phy/phy-rcar-gen2-usb.c | 246 ------------------------
- include/linux/platform_data/usb-rcar-gen2-phy.h | 22 ---
- 4 files changed, 282 deletions(-)
- delete mode 100644 drivers/usb/phy/phy-rcar-gen2-usb.c
- delete mode 100644 include/linux/platform_data/usb-rcar-gen2-phy.h
-
-diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
-index 2175678e674e..3cd3bee54ca6 100644
---- a/drivers/usb/phy/Kconfig
-+++ b/drivers/usb/phy/Kconfig
-@@ -186,19 +186,6 @@ config USB_RCAR_PHY
- To compile this driver as a module, choose M here: the
- module will be called phy-rcar-usb.
-
--config USB_RCAR_GEN2_PHY
-- tristate "Renesas R-Car Gen2 USB PHY support"
-- depends on ARCH_R8A7790 || ARCH_R8A7791 || COMPILE_TEST
-- select USB_PHY
-- help
-- Say Y here to add support for the Renesas R-Car Gen2 USB PHY driver.
-- It is typically used to control internal USB PHY for USBHS,
-- and to configure shared USB channels 0 and 2.
-- This driver supports R8A7790 and R8A7791.
--
-- To compile this driver as a module, choose M here: the
-- module will be called phy-rcar-gen2-usb.
--
- config USB_ULPI
- bool "Generic ULPI Transceiver Driver"
- depends on ARM || ARM64
-diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
-index 75f2bba58c84..e36ab1d46d8b 100644
---- a/drivers/usb/phy/Makefile
-+++ b/drivers/usb/phy/Makefile
-@@ -23,7 +23,6 @@ obj-$(CONFIG_USB_MSM_OTG) += phy-msm-usb.o
- obj-$(CONFIG_USB_MV_OTG) += phy-mv-usb.o
- obj-$(CONFIG_USB_MXS_PHY) += phy-mxs-usb.o
- obj-$(CONFIG_USB_RCAR_PHY) += phy-rcar-usb.o
--obj-$(CONFIG_USB_RCAR_GEN2_PHY) += phy-rcar-gen2-usb.o
- obj-$(CONFIG_USB_ULPI) += phy-ulpi.o
- obj-$(CONFIG_USB_ULPI_VIEWPORT) += phy-ulpi-viewport.o
- obj-$(CONFIG_KEYSTONE_USB_PHY) += phy-keystone.o
-diff --git a/drivers/usb/phy/phy-rcar-gen2-usb.c b/drivers/usb/phy/phy-rcar-gen2-usb.c
-deleted file mode 100644
-index f81800b6562a..000000000000
---- a/drivers/usb/phy/phy-rcar-gen2-usb.c
-+++ /dev/null
-@@ -1,246 +0,0 @@
--/*
-- * Renesas R-Car Gen2 USB phy driver
-- *
-- * Copyright (C) 2013 Renesas Solutions Corp.
-- * Copyright (C) 2013 Cogent Embedded, Inc.
-- *
-- * 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/clk.h>
--#include <linux/delay.h>
--#include <linux/io.h>
--#include <linux/module.h>
--#include <linux/platform_data/usb-rcar-gen2-phy.h>
--#include <linux/platform_device.h>
--#include <linux/spinlock.h>
--#include <linux/usb/otg.h>
--
--struct rcar_gen2_usb_phy_priv {
-- struct usb_phy phy;
-- void __iomem *base;
-- struct clk *clk;
-- spinlock_t lock;
-- int usecount;
-- u32 ugctrl2;
--};
--
--#define usb_phy_to_priv(p) container_of(p, struct rcar_gen2_usb_phy_priv, phy)
--
--/* Low Power Status register */
--#define USBHS_LPSTS_REG 0x02
--#define USBHS_LPSTS_SUSPM (1 << 14)
--
--/* USB General control register */
--#define USBHS_UGCTRL_REG 0x80
--#define USBHS_UGCTRL_CONNECT (1 << 2)
--#define USBHS_UGCTRL_PLLRESET (1 << 0)
--
--/* USB General control register 2 */
--#define USBHS_UGCTRL2_REG 0x84
--#define USBHS_UGCTRL2_USB0_PCI (1 << 4)
--#define USBHS_UGCTRL2_USB0_HS (3 << 4)
--#define USBHS_UGCTRL2_USB2_PCI (0 << 31)
--#define USBHS_UGCTRL2_USB2_SS (1 << 31)
--
--/* USB General status register */
--#define USBHS_UGSTS_REG 0x88
--#define USBHS_UGSTS_LOCK (1 << 8)
--
--/* Enable USBHS internal phy */
--static int __rcar_gen2_usbhs_phy_enable(void __iomem *base)
--{
-- u32 val;
-- int i;
--
-- /* USBHS PHY power on */
-- val = ioread32(base + USBHS_UGCTRL_REG);
-- val &= ~USBHS_UGCTRL_PLLRESET;
-- iowrite32(val, base + USBHS_UGCTRL_REG);
--
-- val = ioread16(base + USBHS_LPSTS_REG);
-- val |= USBHS_LPSTS_SUSPM;
-- iowrite16(val, base + USBHS_LPSTS_REG);
--
-- for (i = 0; i < 20; i++) {
-- val = ioread32(base + USBHS_UGSTS_REG);
-- if ((val & USBHS_UGSTS_LOCK) == USBHS_UGSTS_LOCK) {
-- val = ioread32(base + USBHS_UGCTRL_REG);
-- val |= USBHS_UGCTRL_CONNECT;
-- iowrite32(val, base + USBHS_UGCTRL_REG);
-- return 0;
-- }
-- udelay(1);
-- }
--
-- /* Timed out waiting for the PLL lock */
-- return -ETIMEDOUT;
--}
--
--/* Disable USBHS internal phy */
--static int __rcar_gen2_usbhs_phy_disable(void __iomem *base)
--{
-- u32 val;
--
-- /* USBHS PHY power off */
-- val = ioread32(base + USBHS_UGCTRL_REG);
-- val &= ~USBHS_UGCTRL_CONNECT;
-- iowrite32(val, base + USBHS_UGCTRL_REG);
--
-- val = ioread16(base + USBHS_LPSTS_REG);
-- val &= ~USBHS_LPSTS_SUSPM;
-- iowrite16(val, base + USBHS_LPSTS_REG);
--
-- val = ioread32(base + USBHS_UGCTRL_REG);
-- val |= USBHS_UGCTRL_PLLRESET;
-- iowrite32(val, base + USBHS_UGCTRL_REG);
-- return 0;
--}
--
--/* Setup USB channels */
--static void __rcar_gen2_usb_phy_init(struct rcar_gen2_usb_phy_priv *priv)
--{
-- u32 val;
--
-- clk_prepare_enable(priv->clk);
--
-- /* Set USB channels in the USBHS UGCTRL2 register */
-- val = ioread32(priv->base + USBHS_UGCTRL2_REG);
-- val &= ~(USBHS_UGCTRL2_USB0_HS | USBHS_UGCTRL2_USB2_SS);
-- val |= priv->ugctrl2;
-- iowrite32(val, priv->base + USBHS_UGCTRL2_REG);
--}
--
--/* Shutdown USB channels */
--static void __rcar_gen2_usb_phy_shutdown(struct rcar_gen2_usb_phy_priv *priv)
--{
-- __rcar_gen2_usbhs_phy_disable(priv->base);
-- clk_disable_unprepare(priv->clk);
--}
--
--static int rcar_gen2_usb_phy_set_suspend(struct usb_phy *phy, int suspend)
--{
-- struct rcar_gen2_usb_phy_priv *priv = usb_phy_to_priv(phy);
-- unsigned long flags;
-- int retval;
--
-- spin_lock_irqsave(&priv->lock, flags);
-- retval = suspend ? __rcar_gen2_usbhs_phy_disable(priv->base) :
-- __rcar_gen2_usbhs_phy_enable(priv->base);
-- spin_unlock_irqrestore(&priv->lock, flags);
-- return retval;
--}
--
--static int rcar_gen2_usb_phy_init(struct usb_phy *phy)
--{
-- struct rcar_gen2_usb_phy_priv *priv = usb_phy_to_priv(phy);
-- unsigned long flags;
--
-- spin_lock_irqsave(&priv->lock, flags);
-- /*
-- * Enable the clock and setup USB channels
-- * if it's the first user
-- */
-- if (!priv->usecount++)
-- __rcar_gen2_usb_phy_init(priv);
-- spin_unlock_irqrestore(&priv->lock, flags);
-- return 0;
--}
--
--static void rcar_gen2_usb_phy_shutdown(struct usb_phy *phy)
--{
-- struct rcar_gen2_usb_phy_priv *priv = usb_phy_to_priv(phy);
-- unsigned long flags;
--
-- spin_lock_irqsave(&priv->lock, flags);
-- if (!priv->usecount) {
-- dev_warn(phy->dev, "Trying to disable phy with 0 usecount\n");
-- goto out;
-- }
--
-- /* Disable everything if it's the last user */
-- if (!--priv->usecount)
-- __rcar_gen2_usb_phy_shutdown(priv);
--out:
-- spin_unlock_irqrestore(&priv->lock, flags);
--}
--
--static int rcar_gen2_usb_phy_probe(struct platform_device *pdev)
--{
-- struct device *dev = &pdev->dev;
-- struct rcar_gen2_phy_platform_data *pdata;
-- struct rcar_gen2_usb_phy_priv *priv;
-- struct resource *res;
-- void __iomem *base;
-- struct clk *clk;
-- int retval;
--
-- pdata = dev_get_platdata(dev);
-- if (!pdata) {
-- dev_err(dev, "No platform data\n");
-- return -EINVAL;
-- }
--
-- clk = devm_clk_get(dev, "usbhs");
-- if (IS_ERR(clk)) {
-- dev_err(dev, "Can't get the clock\n");
-- return PTR_ERR(clk);
-- }
--
-- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- base = devm_ioremap_resource(dev, res);
-- if (IS_ERR(base))
-- return PTR_ERR(base);
--
-- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-- if (!priv)
-- return -ENOMEM;
--
-- spin_lock_init(&priv->lock);
-- priv->clk = clk;
-- priv->base = base;
-- priv->ugctrl2 = pdata->chan0_pci ?
-- USBHS_UGCTRL2_USB0_PCI : USBHS_UGCTRL2_USB0_HS;
-- priv->ugctrl2 |= pdata->chan2_pci ?
-- USBHS_UGCTRL2_USB2_PCI : USBHS_UGCTRL2_USB2_SS;
-- priv->phy.dev = dev;
-- priv->phy.label = dev_name(dev);
-- priv->phy.init = rcar_gen2_usb_phy_init;
-- priv->phy.shutdown = rcar_gen2_usb_phy_shutdown;
-- priv->phy.set_suspend = rcar_gen2_usb_phy_set_suspend;
--
-- retval = usb_add_phy_dev(&priv->phy);
-- if (retval < 0) {
-- dev_err(dev, "Failed to add USB phy\n");
-- return retval;
-- }
--
-- platform_set_drvdata(pdev, priv);
--
-- return retval;
--}
--
--static int rcar_gen2_usb_phy_remove(struct platform_device *pdev)
--{
-- struct rcar_gen2_usb_phy_priv *priv = platform_get_drvdata(pdev);
--
-- usb_remove_phy(&priv->phy);
--
-- return 0;
--}
--
--static struct platform_driver rcar_gen2_usb_phy_driver = {
-- .driver = {
-- .name = "usb_phy_rcar_gen2",
-- },
-- .probe = rcar_gen2_usb_phy_probe,
-- .remove = rcar_gen2_usb_phy_remove,
--};
--
--module_platform_driver(rcar_gen2_usb_phy_driver);
--
--MODULE_LICENSE("GPL v2");
--MODULE_DESCRIPTION("Renesas R-Car Gen2 USB phy");
--MODULE_AUTHOR("Valentine Barshak <valentine.barshak@cogentembedded.com>");
-diff --git a/include/linux/platform_data/usb-rcar-gen2-phy.h b/include/linux/platform_data/usb-rcar-gen2-phy.h
-deleted file mode 100644
-index dd3ba46c0d90..000000000000
---- a/include/linux/platform_data/usb-rcar-gen2-phy.h
-+++ /dev/null
-@@ -1,22 +0,0 @@
--/*
-- * Copyright (C) 2013 Renesas Solutions Corp.
-- * Copyright (C) 2013 Cogent Embedded, Inc.
-- *
-- * 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 __USB_RCAR_GEN2_PHY_H
--#define __USB_RCAR_GEN2_PHY_H
--
--#include <linux/types.h>
--
--struct rcar_gen2_phy_platform_data {
-- /* USB channel 0 configuration */
-- bool chan0_pci:1; /* true: PCI USB host 0, false: USBHS */
-- /* USB channel 2 configuration */
-- bool chan2_pci:1; /* true: PCI USB host 2, false: USBSS */
--};
--
--#endif
---
-2.6.2
-
diff --git a/patches.renesas/0059-pinctrl-allow-exlusive-GPIO-mux-pin-allocation.patch b/patches.renesas/0059-pinctrl-allow-exlusive-GPIO-mux-pin-allocation.patch
deleted file mode 100644
index 8190f81c6f1a3c..00000000000000
--- a/patches.renesas/0059-pinctrl-allow-exlusive-GPIO-mux-pin-allocation.patch
+++ /dev/null
@@ -1,135 +0,0 @@
-From 9cd02c86d8c78f512dc0f90d4fad25812da4695b Mon Sep 17 00:00:00 2001
-From: Sonic Zhang <sonic.zhang@analog.com>
-Date: Thu, 9 Apr 2015 11:13:07 +0800
-Subject: [PATCH 059/129] pinctrl: allow exlusive GPIO/mux pin allocation
-
-Disallow simultaneous use of the the GPIO and peripheral mux
-functions by setting a flag "strict" in struct pinctrl_desc.
-
-The blackfin pinmux and gpio controller doesn't allow user to
-set up a pin for both GPIO and peripheral function. So, add flag
-strict in struct pinctrl_desc to check both gpio_owner and
-mux_owner before approving the pin request.
-
-v2-changes:
-- if strict flag is set, check gpio_owner and mux_onwer in if and
- else clause
-
-v3-changes:
-- add kerneldoc for this struct
-- augment Documentation/pinctrl.txt
-
-Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit fa76a3db7093a527333c380df82a0f158d9b8299)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/pinctrl.txt | 11 +++++++++++
- drivers/pinctrl/pinctrl-adi2.c | 1 +
- drivers/pinctrl/pinmux.c | 13 +++++++++++++
- include/linux/pinctrl/pinctrl.h | 3 +++
- 4 files changed, 28 insertions(+)
-
-diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
-index a9b47163bb5d..d6b2bed94c43 100644
---- a/Documentation/pinctrl.txt
-+++ b/Documentation/pinctrl.txt
-@@ -73,6 +73,7 @@ static struct pinctrl_desc foo_desc = {
- .pins = foo_pins,
- .npins = ARRAY_SIZE(foo_pins),
- .owner = THIS_MODULE,
-+ .strict = true,
- };
-
- int __init foo_probe(void)
-@@ -830,6 +831,11 @@ separate memory range only intended for GPIO driving, and the register
- range dealing with pin config and pin multiplexing get placed into a
- different memory range and a separate section of the data sheet.
-
-+A flag "strict" in struct pinctrl_desc is available to check and deny
-+simultaneous access to the same pin from GPIO and pin multiplexing
-+consumers on hardware of this type. The pinctrl driver should set this flag
-+accordingly.
-+
- (B)
-
- pin config
-@@ -850,6 +856,11 @@ possible that the GPIO, pin config and pin multiplex registers are placed into
- the same memory range and the same section of the data sheet, although that
- need not be the case.
-
-+In some pin controllers, although the physical pins are designed in the same
-+way as (B), the GPIO function still can't be enabled at the same time as the
-+peripheral functions. So again the "strict" flag should be set, denying
-+simultaneous activation by GPIO and other muxed in devices.
-+
- From a kernel point of view, however, these are different aspects of the
- hardware and shall be put into different subsystems:
-
-diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
-index 8434439c5017..fbd492668da1 100644
---- a/drivers/pinctrl/pinctrl-adi2.c
-+++ b/drivers/pinctrl/pinctrl-adi2.c
-@@ -710,6 +710,7 @@ static struct pinctrl_desc adi_pinmux_desc = {
- .name = DRIVER_NAME,
- .pctlops = &adi_pctrl_ops,
- .pmxops = &adi_pinmux_ops,
-+ .strict = true,
- .owner = THIS_MODULE,
- };
-
-diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
-index b874458dcb88..2546fa783464 100644
---- a/drivers/pinctrl/pinmux.c
-+++ b/drivers/pinctrl/pinmux.c
-@@ -107,6 +107,13 @@ static int pin_request(struct pinctrl_dev *pctldev,
- desc->name, desc->gpio_owner, owner);
- goto out;
- }
-+ if (pctldev->desc->strict && desc->mux_usecount &&
-+ strcmp(desc->mux_owner, owner)) {
-+ dev_err(pctldev->dev,
-+ "pin %s already requested by %s; cannot claim for %s\n",
-+ desc->name, desc->mux_owner, owner);
-+ goto out;
-+ }
-
- desc->gpio_owner = owner;
- } else {
-@@ -116,6 +123,12 @@ static int pin_request(struct pinctrl_dev *pctldev,
- desc->name, desc->mux_owner, owner);
- goto out;
- }
-+ if (pctldev->desc->strict && desc->gpio_owner) {
-+ dev_err(pctldev->dev,
-+ "pin %s already requested by %s; cannot claim for %s\n",
-+ desc->name, desc->gpio_owner, owner);
-+ goto out;
-+ }
-
- desc->mux_usecount++;
- if (desc->mux_usecount > 1)
-diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
-index 66e4697516de..fc6b0348c375 100644
---- a/include/linux/pinctrl/pinctrl.h
-+++ b/include/linux/pinctrl/pinctrl.h
-@@ -114,6 +114,8 @@ struct pinctrl_ops {
- * of the pins field above
- * @pctlops: pin control operation vtable, to support global concepts like
- * grouping of pins, this is optional.
-+ * @strict: check both gpio_owner and mux_owner strictly before approving
-+ the pin request
- * @pmxops: pinmux operations vtable, if you support pinmuxing in your driver
- * @confops: pin config operations vtable, if you support pin configuration in
- * your driver
-@@ -132,6 +134,7 @@ struct pinctrl_desc {
- const struct pinctrl_ops *pctlops;
- const struct pinmux_ops *pmxops;
- const struct pinconf_ops *confops;
-+ bool strict;
- struct module *owner;
- #ifdef CONFIG_GENERIC_PINCONF
- unsigned int num_custom_params;
---
-2.6.2
-
diff --git a/patches.renesas/0060-pinctrl-move-strict-option-to-pinmux_ops.patch b/patches.renesas/0060-pinctrl-move-strict-option-to-pinmux_ops.patch
deleted file mode 100644
index 89c2485e9c2ff8..00000000000000
--- a/patches.renesas/0060-pinctrl-move-strict-option-to-pinmux_ops.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-From b42d4c0354afb44d8bb946f064e1a59af43fa856 Mon Sep 17 00:00:00 2001
-From: Linus Walleij <linus.walleij@linaro.org>
-Date: Wed, 6 May 2015 14:19:13 +0200
-Subject: [PATCH 060/129] pinctrl: move strict option to pinmux_ops
-
-While the pinmux_ops are ideally just a vtable for pin mux
-calls, the "strict" setting belongs so intuitively with the
-pin multiplexing that we should move it here anyway. Putting
-it in the top pinctrl_desc makes no sense.
-
-Cc: Sonic Zhang <sonic.zhang@analog.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 8c4c2016345feefcd289ce2479eb70286d30825a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/pinctrl.txt | 2 +-
- drivers/pinctrl/pinctrl-adi2.c | 2 +-
- drivers/pinctrl/pinmux.c | 4 ++--
- include/linux/pinctrl/pinctrl.h | 3 ---
- include/linux/pinctrl/pinmux.h | 4 ++++
- 5 files changed, 8 insertions(+), 7 deletions(-)
-
-diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
-index d6b2bed94c43..4976389e432d 100644
---- a/Documentation/pinctrl.txt
-+++ b/Documentation/pinctrl.txt
-@@ -73,7 +73,6 @@ static struct pinctrl_desc foo_desc = {
- .pins = foo_pins,
- .npins = ARRAY_SIZE(foo_pins),
- .owner = THIS_MODULE,
-- .strict = true,
- };
-
- int __init foo_probe(void)
-@@ -715,6 +714,7 @@ static struct pinmux_ops foo_pmxops = {
- .get_function_name = foo_get_fname,
- .get_function_groups = foo_get_groups,
- .set_mux = foo_set_mux,
-+ .strict = true,
- };
-
- /* Pinmux operations are handled by some pin controller */
-diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
-index fbd492668da1..49df9037b41e 100644
---- a/drivers/pinctrl/pinctrl-adi2.c
-+++ b/drivers/pinctrl/pinctrl-adi2.c
-@@ -703,6 +703,7 @@ static struct pinmux_ops adi_pinmux_ops = {
- .get_function_name = adi_pinmux_get_func_name,
- .get_function_groups = adi_pinmux_get_groups,
- .gpio_request_enable = adi_pinmux_request_gpio,
-+ .strict = true,
- };
-
-
-@@ -710,7 +711,6 @@ static struct pinctrl_desc adi_pinmux_desc = {
- .name = DRIVER_NAME,
- .pctlops = &adi_pctrl_ops,
- .pmxops = &adi_pinmux_ops,
-- .strict = true,
- .owner = THIS_MODULE,
- };
-
-diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
-index 2546fa783464..c58c168b06c2 100644
---- a/drivers/pinctrl/pinmux.c
-+++ b/drivers/pinctrl/pinmux.c
-@@ -107,7 +107,7 @@ static int pin_request(struct pinctrl_dev *pctldev,
- desc->name, desc->gpio_owner, owner);
- goto out;
- }
-- if (pctldev->desc->strict && desc->mux_usecount &&
-+ if (ops->strict && desc->mux_usecount &&
- strcmp(desc->mux_owner, owner)) {
- dev_err(pctldev->dev,
- "pin %s already requested by %s; cannot claim for %s\n",
-@@ -123,7 +123,7 @@ static int pin_request(struct pinctrl_dev *pctldev,
- desc->name, desc->mux_owner, owner);
- goto out;
- }
-- if (pctldev->desc->strict && desc->gpio_owner) {
-+ if (ops->strict && desc->gpio_owner) {
- dev_err(pctldev->dev,
- "pin %s already requested by %s; cannot claim for %s\n",
- desc->name, desc->gpio_owner, owner);
-diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
-index fc6b0348c375..66e4697516de 100644
---- a/include/linux/pinctrl/pinctrl.h
-+++ b/include/linux/pinctrl/pinctrl.h
-@@ -114,8 +114,6 @@ struct pinctrl_ops {
- * of the pins field above
- * @pctlops: pin control operation vtable, to support global concepts like
- * grouping of pins, this is optional.
-- * @strict: check both gpio_owner and mux_owner strictly before approving
-- the pin request
- * @pmxops: pinmux operations vtable, if you support pinmuxing in your driver
- * @confops: pin config operations vtable, if you support pin configuration in
- * your driver
-@@ -134,7 +132,6 @@ struct pinctrl_desc {
- const struct pinctrl_ops *pctlops;
- const struct pinmux_ops *pmxops;
- const struct pinconf_ops *confops;
-- bool strict;
- struct module *owner;
- #ifdef CONFIG_GENERIC_PINCONF
- unsigned int num_custom_params;
-diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
-index 511bda9ed4bf..d3740fa7073f 100644
---- a/include/linux/pinctrl/pinmux.h
-+++ b/include/linux/pinctrl/pinmux.h
-@@ -56,6 +56,9 @@ struct pinctrl_dev;
- * depending on whether the GPIO is configured as input or output,
- * a direction selector function may be implemented as a backing
- * to the GPIO controllers that need pin muxing.
-+ * @strict: do not allow simultaneous use of the same pin for GPIO and another
-+ * function. Check both gpio_owner and mux_owner strictly before approving
-+ * the pin request.
- */
- struct pinmux_ops {
- int (*request) (struct pinctrl_dev *pctldev, unsigned offset);
-@@ -79,6 +82,7 @@ struct pinmux_ops {
- struct pinctrl_gpio_range *range,
- unsigned offset,
- bool input);
-+ bool strict;
- };
-
- #endif /* CONFIG_PINMUX */
---
-2.6.2
-
diff --git a/patches.renesas/0061-pinctrl-use-ERR_CAST-instead-of-ERR_PTR-PTR_ERR.patch b/patches.renesas/0061-pinctrl-use-ERR_CAST-instead-of-ERR_PTR-PTR_ERR.patch
deleted file mode 100644
index a655ec38a2fac3..00000000000000
--- a/patches.renesas/0061-pinctrl-use-ERR_CAST-instead-of-ERR_PTR-PTR_ERR.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 1cf420ea0f8bde21be959898d7470561a8f0b73c Mon Sep 17 00:00:00 2001
-From: Fabian Frederick <fabf@skynet.be>
-Date: Mon, 27 Apr 2015 18:04:05 +0200
-Subject: [PATCH 061/129] pinctrl: use ERR_CAST instead of ERR_PTR/PTR_ERR
-
-Inspired by scripts/coccinelle/api/err_cast.cocci
-
-Signed-off-by: Fabian Frederick <fabf@skynet.be>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 66eb3bd857f5311f72c7c371f78ddc9c472befba)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- include/linux/pinctrl/consumer.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
-index 18eccefea06e..d7e5d608faa7 100644
---- a/include/linux/pinctrl/consumer.h
-+++ b/include/linux/pinctrl/consumer.h
-@@ -142,7 +142,7 @@ static inline struct pinctrl * __must_check pinctrl_get_select(
- s = pinctrl_lookup_state(p, name);
- if (IS_ERR(s)) {
- pinctrl_put(p);
-- return ERR_PTR(PTR_ERR(s));
-+ return ERR_CAST(s);
- }
-
- ret = pinctrl_select_state(p, s);
---
-2.6.2
-
diff --git a/patches.renesas/0062-pinctrl-Grammar-s-used-in-as-used-as.patch b/patches.renesas/0062-pinctrl-Grammar-s-used-in-as-used-as.patch
deleted file mode 100644
index b1868e091bf5bf..00000000000000
--- a/patches.renesas/0062-pinctrl-Grammar-s-used-in-as-used-as.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From ea6f7a13fb03cca4b5168e8ad5fbb5358f8fb1ce Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 4 May 2015 19:46:57 +0200
-Subject: [PATCH 062/129] pinctrl: Grammar s/used in as/used as/
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit b217e4385d7ae59d1628b0ecb4cffa10f16d5864)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/core.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
-index 18ee2089df4a..5b4e6897af22 100644
---- a/drivers/pinctrl/core.c
-+++ b/drivers/pinctrl/core.c
-@@ -558,7 +558,7 @@ int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
- }
-
- /**
-- * pinctrl_request_gpio() - request a single pin to be used in as GPIO
-+ * pinctrl_request_gpio() - request a single pin to be used as GPIO
- * @gpio: the GPIO pin number from the GPIO subsystem number space
- *
- * This function should *ONLY* be used from gpiolib-based GPIO drivers,
---
-2.6.2
-
diff --git a/patches.renesas/0063-pinctrl-improve-debugfs-for-strict-controllers.patch b/patches.renesas/0063-pinctrl-improve-debugfs-for-strict-controllers.patch
deleted file mode 100644
index 87763d76f9054b..00000000000000
--- a/patches.renesas/0063-pinctrl-improve-debugfs-for-strict-controllers.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From 9b81e78993fd7b2a3f3ab5c0348a266f471498fa Mon Sep 17 00:00:00 2001
-From: Linus Walleij <linus.walleij@linaro.org>
-Date: Thu, 28 May 2015 10:11:19 +0200
-Subject: [PATCH 063/129] pinctrl: improve debugfs for strict controllers
-
-If we know we are using a strict pin controller (one that cannot
-mix device functions+group use and GPIO) we can be a bit more
-specific in debugfs, just print either device-function-group
-or GPIO consumer for the pin. Let's do that to be helpful.
-
-Cc: Sonic Zhang <sonic.zhang@analog.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 815088550342904acd68f43436e1b4d1d78b77c1)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/pinmux.c | 41 +++++++++++++++++++++++++++++++++--------
- 1 file changed, 33 insertions(+), 8 deletions(-)
-
-diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
-index c58c168b06c2..77f82b23f7be 100644
---- a/drivers/pinctrl/pinmux.c
-+++ b/drivers/pinctrl/pinmux.c
-@@ -585,7 +585,12 @@ static int pinmux_pins_show(struct seq_file *s, void *what)
- return 0;
-
- seq_puts(s, "Pinmux settings per pin\n");
-- seq_puts(s, "Format: pin (name): mux_owner gpio_owner hog?\n");
-+ if (pmxops->strict)
-+ seq_puts(s,
-+ "Format: pin (name): mux_owner|gpio_owner (strict) hog?\n");
-+ else
-+ seq_puts(s,
-+ "Format: pin (name): mux_owner gpio_owner hog?\n");
-
- mutex_lock(&pctldev->mutex);
-
-@@ -604,14 +609,34 @@ static int pinmux_pins_show(struct seq_file *s, void *what)
- !strcmp(desc->mux_owner, pinctrl_dev_get_name(pctldev)))
- is_hog = true;
-
-- seq_printf(s, "pin %d (%s): %s %s%s", pin,
-- desc->name ? desc->name : "unnamed",
-- desc->mux_owner ? desc->mux_owner
-- : "(MUX UNCLAIMED)",
-- desc->gpio_owner ? desc->gpio_owner
-- : "(GPIO UNCLAIMED)",
-- is_hog ? " (HOG)" : "");
-+ if (pmxops->strict) {
-+ if (desc->mux_owner)
-+ seq_printf(s, "pin %d (%s): device %s%s",
-+ pin,
-+ desc->name ? desc->name : "unnamed",
-+ desc->mux_owner,
-+ is_hog ? " (HOG)" : "");
-+ else if (desc->gpio_owner)
-+ seq_printf(s, "pin %d (%s): GPIO %s",
-+ pin,
-+ desc->name ? desc->name : "unnamed",
-+ desc->gpio_owner);
-+ else
-+ seq_printf(s, "pin %d (%s): UNCLAIMED",
-+ pin,
-+ desc->name ? desc->name : "unnamed");
-+ } else {
-+ /* For non-strict controllers */
-+ seq_printf(s, "pin %d (%s): %s %s%s", pin,
-+ desc->name ? desc->name : "unnamed",
-+ desc->mux_owner ? desc->mux_owner
-+ : "(MUX UNCLAIMED)",
-+ desc->gpio_owner ? desc->gpio_owner
-+ : "(GPIO UNCLAIMED)",
-+ is_hog ? " (HOG)" : "");
-+ }
-
-+ /* If mux: print function+group claiming the pin */
- if (desc->mux_setting)
- seq_printf(s, " function %s group %s\n",
- pmxops->get_function_name(pctldev,
---
-2.6.2
-
diff --git a/patches.renesas/0064-pinctrl-remove-useless-const-qualifier.patch b/patches.renesas/0064-pinctrl-remove-useless-const-qualifier.patch
deleted file mode 100644
index d44200b696d633..00000000000000
--- a/patches.renesas/0064-pinctrl-remove-useless-const-qualifier.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 139e306e48f5a9fb1a9e912e3b5c8b76b9eefed8 Mon Sep 17 00:00:00 2001
-From: Masahiro Yamada <yamada.masahiro@socionext.com>
-Date: Fri, 22 May 2015 15:19:37 +0900
-Subject: [PATCH 064/129] pinctrl: remove useless const qualifier
-
-This "const" claims the get_function_groups callback never
-changes the given num_groups pointer. It is always true
-in C language, so not worth mentioning.
-
-Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 5fbf65d5c9c0fd2e5c6c48d69ce34b1c5415f2fd)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- include/linux/pinctrl/pinmux.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
-index d3740fa7073f..ace60d775b20 100644
---- a/include/linux/pinctrl/pinmux.h
-+++ b/include/linux/pinctrl/pinmux.h
-@@ -69,7 +69,7 @@ struct pinmux_ops {
- int (*get_function_groups) (struct pinctrl_dev *pctldev,
- unsigned selector,
- const char * const **groups,
-- unsigned * const num_groups);
-+ unsigned *num_groups);
- int (*set_mux) (struct pinctrl_dev *pctldev, unsigned func_selector,
- unsigned group_selector);
- int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
---
-2.6.2
-
diff --git a/patches.renesas/0065-pinctrl-use-const-struct-.-rather-than-struct-.-cons.patch b/patches.renesas/0065-pinctrl-use-const-struct-.-rather-than-struct-.-cons.patch
deleted file mode 100644
index 999ec15f4b02aa..00000000000000
--- a/patches.renesas/0065-pinctrl-use-const-struct-.-rather-than-struct-.-cons.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 2704f56af18f223f8314c7d08758f78baf18732e Mon Sep 17 00:00:00 2001
-From: Masahiro Yamada <yamada.masahiro@socionext.com>
-Date: Fri, 22 May 2015 15:25:50 +0900
-Subject: [PATCH 065/129] pinctrl: use "const struct ..." rather than "struct
- ... const"
-
-Only this member, pins, is defined as "struct ... const *", but the
-others in this struct, pinlops, pmxops, confops, etc. are defined as
-"const struct ... *".
-
-Swap the "struct pinctrl_pin_desc" and "const" for consistency.
-
-Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit b3da97ee581387cd42dafd76eb2ac23f2335cd92)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- include/linux/pinctrl/pinctrl.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
-index 66e4697516de..9ba59fcba549 100644
---- a/include/linux/pinctrl/pinctrl.h
-+++ b/include/linux/pinctrl/pinctrl.h
-@@ -127,7 +127,7 @@ struct pinctrl_ops {
- */
- struct pinctrl_desc {
- const char *name;
-- struct pinctrl_pin_desc const *pins;
-+ const struct pinctrl_pin_desc *pins;
- unsigned int npins;
- const struct pinctrl_ops *pctlops;
- const struct pinmux_ops *pmxops;
---
-2.6.2
-
diff --git a/patches.renesas/0066-pinctrl-fix-confusing-debug-message-in-pinctrl_regis.patch b/patches.renesas/0066-pinctrl-fix-confusing-debug-message-in-pinctrl_regis.patch
deleted file mode 100644
index a189024339e068..00000000000000
--- a/patches.renesas/0066-pinctrl-fix-confusing-debug-message-in-pinctrl_regis.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 02fbbbf691da07c819b2999ab3e30f55c63a8dcc Mon Sep 17 00:00:00 2001
-From: Masahiro Yamada <yamada.masahiro@socionext.com>
-Date: Thu, 28 May 2015 21:52:59 +0900
-Subject: [PATCH 066/129] pinctrl: fix confusing debug message in
- pinctrl_register_map()
-
-There are two types for pinctrl maps: pinmux and pinconfig
-This debug message shows the number of maps of both types.
-The string "pinmux map" is not precise. Let's say "pinctrl map"
-instead.
-
-Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-[also fixed %d -> %u]
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-
-(cherry picked from commit 7e9236ff3d92ec326f29a20d86add10f1ff4e9b3)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/core.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
-index 5b4e6897af22..700935097d03 100644
---- a/drivers/pinctrl/core.c
-+++ b/drivers/pinctrl/core.c
-@@ -1115,7 +1115,7 @@ int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps,
- int i, ret;
- struct pinctrl_maps *maps_node;
-
-- pr_debug("add %d pinmux maps\n", num_maps);
-+ pr_debug("add %u pinctrl maps\n", num_maps);
-
- /* First sanity check the new mapping */
- for (i = 0; i < num_maps; i++) {
---
-2.6.2
-
diff --git a/patches.renesas/0067-pinctrl-don-t-print-unavailable-function-groups.patch b/patches.renesas/0067-pinctrl-don-t-print-unavailable-function-groups.patch
deleted file mode 100644
index fdd834993c56b9..00000000000000
--- a/patches.renesas/0067-pinctrl-don-t-print-unavailable-function-groups.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From a569abe0e69467db2c07fe57de26551a979f2d2c Mon Sep 17 00:00:00 2001
-From: Ludovic Desroches <ludovic.desroches@atmel.com>
-Date: Mon, 8 Jun 2015 17:16:37 +0200
-Subject: [PATCH 067/129] pinctrl: don't print unavailable function groups
-
-There is no reason to try to print groups associated to a function if
-get_function_groups returns an error. Moreover, it can lead to a NULL
-pointer dereference error.
-
-Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 9d7ebbbf2264c4ad3c8d50fcb84952126184a7ad)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/pinmux.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
-index 77f82b23f7be..e7ae890dcf1a 100644
---- a/drivers/pinctrl/pinmux.c
-+++ b/drivers/pinctrl/pinmux.c
-@@ -557,9 +557,12 @@ static int pinmux_functions_show(struct seq_file *s, void *what)
-
- ret = pmxops->get_function_groups(pctldev, func_selector,
- &groups, &num_groups);
-- if (ret)
-+ if (ret) {
- seq_printf(s, "function %s: COULD NOT GET GROUPS\n",
- func);
-+ func_selector++;
-+ continue;
-+ }
-
- seq_printf(s, "function: %s, groups = [ ", func);
- for (i = 0; i < num_groups; i++)
---
-2.6.2
-
diff --git a/patches.renesas/0068-pinctrl-make-pinctrl_register-return-proper-error-co.patch b/patches.renesas/0068-pinctrl-make-pinctrl_register-return-proper-error-co.patch
deleted file mode 100644
index 23be313fcb2b1a..00000000000000
--- a/patches.renesas/0068-pinctrl-make-pinctrl_register-return-proper-error-co.patch
+++ /dev/null
@@ -1,713 +0,0 @@
-From f6d5123c26729824ef65e69fbe861a8a8aa5a80a Mon Sep 17 00:00:00 2001
-From: Masahiro Yamada <yamada.masahiro@socionext.com>
-Date: Tue, 9 Jun 2015 13:01:16 +0900
-Subject: [PATCH 068/129] pinctrl: make pinctrl_register() return proper error
- code
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Currently, pinctrl_register() just returns NULL on error, so the
-callers can not know the exact reason of the failure.
-
-Some of the pinctrl drivers return -EINVAL, some -ENODEV, and some
--ENOMEM on error of pinctrl_register(), although the error code
-might be different from the real cause of the error.
-
-This commit reworks pinctrl_register() to return the appropriate
-error code and modifies all of the pinctrl drivers to use IS_ERR()
-for the error checking and PTR_ERR() for getting the error code.
-
-Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-Acked-by: Patrice Chotard <patrice.chotard@st.com>
-Acked-by: Thierry Reding <treding@nvidia.com>
-Acked-by: Heiko Stuebner <heiko@sntech.de>
-Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-Acked-by: Lee Jones <lee@kernel.org>
-Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Acked-by: Ray Jui <rjui@broadcom.com>
-Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
-Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com>
-Acked-by: Wei Chen <Wei.Chen@csr.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 323de9efdf3e75d1dfb48003a52e59d6d9d4c7a5)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-
-Conflicts:
- drivers/pinctrl/pinctrl-lpc18xx.c
- drivers/pinctrl/pinctrl-pistachio.c
- drivers/pinctrl/sirf/pinctrl-atlas7.c
----
- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 4 ++--
- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 4 ++--
- drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c | 4 ++--
- drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 4 ++--
- drivers/pinctrl/berlin/berlin.c | 4 ++--
- drivers/pinctrl/core.c | 17 ++++++++++-------
- drivers/pinctrl/freescale/pinctrl-imx.c | 4 ++--
- drivers/pinctrl/freescale/pinctrl-imx1-core.c | 4 ++--
- drivers/pinctrl/freescale/pinctrl-mxs.c | 4 ++--
- drivers/pinctrl/intel/pinctrl-cherryview.c | 4 ++--
- drivers/pinctrl/intel/pinctrl-intel.c | 4 ++--
- drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 4 ++--
- drivers/pinctrl/meson/pinctrl-meson.c | 4 ++--
- drivers/pinctrl/mvebu/pinctrl-mvebu.c | 4 ++--
- drivers/pinctrl/nomadik/pinctrl-abx500.c | 4 ++--
- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 ++--
- drivers/pinctrl/pinctrl-adi2.c | 4 ++--
- drivers/pinctrl/pinctrl-amd.c | 4 ++--
- drivers/pinctrl/pinctrl-as3722.c | 4 ++--
- drivers/pinctrl/pinctrl-at91.c | 4 ++--
- drivers/pinctrl/pinctrl-lantiq.c | 4 ++--
- drivers/pinctrl/pinctrl-palmas.c | 4 ++--
- drivers/pinctrl/pinctrl-rockchip.c | 4 ++--
- drivers/pinctrl/pinctrl-single.c | 4 ++--
- drivers/pinctrl/pinctrl-st.c | 4 ++--
- drivers/pinctrl/pinctrl-tb10x.c | 4 ++--
- drivers/pinctrl/pinctrl-tegra-xusb.c | 4 ++--
- drivers/pinctrl/pinctrl-tegra.c | 4 ++--
- drivers/pinctrl/pinctrl-tz1090-pdc.c | 4 ++--
- drivers/pinctrl/pinctrl-tz1090.c | 4 ++--
- drivers/pinctrl/pinctrl-u300.c | 4 ++--
- drivers/pinctrl/pinctrl-zynq.c | 4 ++--
- drivers/pinctrl/qcom/pinctrl-msm.c | 4 ++--
- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 4 ++--
- drivers/pinctrl/qcom/pinctrl-spmi-mpp.c | 4 ++--
- drivers/pinctrl/samsung/pinctrl-exynos5440.c | 4 ++--
- drivers/pinctrl/samsung/pinctrl-samsung.c | 4 ++--
- drivers/pinctrl/sh-pfc/pinctrl.c | 4 ++--
- drivers/pinctrl/sirf/pinctrl-sirf.c | 4 ++--
- drivers/pinctrl/spear/pinctrl-spear.c | 4 ++--
- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 4 ++--
- drivers/pinctrl/vt8500/pinctrl-wmt.c | 4 ++--
- 42 files changed, 92 insertions(+), 89 deletions(-)
-
---- a/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
-+++ b/drivers/pinctrl/bcm/pinctrl-bcm281xx.c
-@@ -1425,9 +1425,9 @@ static int __init bcm281xx_pinctrl_probe
- pctl = pinctrl_register(&bcm281xx_pinctrl_desc,
- &pdev->dev,
- pdata);
-- if (!pctl) {
-+ if (IS_ERR(pctl)) {
- dev_err(&pdev->dev, "Failed to register pinctrl\n");
-- return -ENODEV;
-+ return PTR_ERR(pctl);
- }
-
- platform_set_drvdata(pdev, pdata);
---- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
-+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
-@@ -1036,9 +1036,9 @@ static int bcm2835_pinctrl_probe(struct
- }
-
- pc->pctl_dev = pinctrl_register(&bcm2835_pinctrl_desc, dev, pc);
-- if (!pc->pctl_dev) {
-+ if (IS_ERR(pc->pctl_dev)) {
- gpiochip_remove(&pc->gpio_chip);
-- return -EINVAL;
-+ return PTR_ERR(pc->pctl_dev);
- }
-
- pc->gpio_range = bcm2835_pinctrl_gpio_range;
---- a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
-+++ b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
-@@ -750,9 +750,9 @@ static int cygnus_gpio_register_pinconf(
- pctldesc->confops = &cygnus_pconf_ops;
-
- chip->pctl = pinctrl_register(pctldesc, chip->dev, chip);
-- if (!chip->pctl) {
-+ if (IS_ERR(chip->pctl)) {
- dev_err(chip->dev, "unable to register pinctrl device\n");
-- return -EINVAL;
-+ return PTR_ERR(chip->pctl);
- }
-
- return 0;
---- a/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c
-+++ b/drivers/pinctrl/bcm/pinctrl-cygnus-mux.c
-@@ -989,9 +989,9 @@ static int cygnus_pinmux_probe(struct pl
-
- pinctrl->pctl = pinctrl_register(&cygnus_pinctrl_desc, &pdev->dev,
- pinctrl);
-- if (!pinctrl->pctl) {
-+ if (IS_ERR(pinctrl->pctl)) {
- dev_err(&pdev->dev, "unable to register Cygnus IOMUX pinctrl\n");
-- return -EINVAL;
-+ return PTR_ERR(pinctrl->pctl);
- }
-
- return 0;
---- a/drivers/pinctrl/berlin/berlin.c
-+++ b/drivers/pinctrl/berlin/berlin.c
-@@ -320,9 +320,9 @@ int berlin_pinctrl_probe(struct platform
- }
-
- pctrl->pctrl_dev = pinctrl_register(&berlin_pctrl_desc, dev, pctrl);
-- if (!pctrl->pctrl_dev) {
-+ if (IS_ERR(pctrl->pctrl_dev)) {
- dev_err(dev, "failed to register pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(pctrl->pctrl_dev);
- }
-
- return 0;
---- a/drivers/pinctrl/core.c
-+++ b/drivers/pinctrl/core.c
-@@ -1704,14 +1704,14 @@ struct pinctrl_dev *pinctrl_register(str
- int ret;
-
- if (!pctldesc)
-- return NULL;
-+ return ERR_PTR(-EINVAL);
- if (!pctldesc->name)
-- return NULL;
-+ return ERR_PTR(-EINVAL);
-
- pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
- if (pctldev == NULL) {
- dev_err(dev, "failed to alloc struct pinctrl_dev\n");
-- return NULL;
-+ return ERR_PTR(-ENOMEM);
- }
-
- /* Initialize pin control device struct */
-@@ -1724,20 +1724,23 @@ struct pinctrl_dev *pinctrl_register(str
- mutex_init(&pctldev->mutex);
-
- /* check core ops for sanity */
-- if (pinctrl_check_ops(pctldev)) {
-+ ret = pinctrl_check_ops(pctldev);
-+ if (ret) {
- dev_err(dev, "pinctrl ops lacks necessary functions\n");
- goto out_err;
- }
-
- /* If we're implementing pinmuxing, check the ops for sanity */
- if (pctldesc->pmxops) {
-- if (pinmux_check_ops(pctldev))
-+ ret = pinmux_check_ops(pctldev);
-+ if (ret)
- goto out_err;
- }
-
- /* If we're implementing pinconfig, check the ops for sanity */
- if (pctldesc->confops) {
-- if (pinconf_check_ops(pctldev))
-+ ret = pinconf_check_ops(pctldev);
-+ if (ret)
- goto out_err;
- }
-
-@@ -1783,7 +1786,7 @@ struct pinctrl_dev *pinctrl_register(str
- out_err:
- mutex_destroy(&pctldev->mutex);
- kfree(pctldev);
-- return NULL;
-+ return ERR_PTR(ret);
- }
- EXPORT_SYMBOL_GPL(pinctrl_register);
-
---- a/drivers/pinctrl/freescale/pinctrl-imx.c
-+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
-@@ -690,9 +690,9 @@ int imx_pinctrl_probe(struct platform_de
- ipctl->dev = info->dev;
- platform_set_drvdata(pdev, ipctl);
- ipctl->pctl = pinctrl_register(&imx_pinctrl_desc, &pdev->dev, ipctl);
-- if (!ipctl->pctl) {
-+ if (IS_ERR(ipctl->pctl)) {
- dev_err(&pdev->dev, "could not register IMX pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(ipctl->pctl);
- }
-
- dev_info(&pdev->dev, "initialized IMX pinctrl driver\n");
---- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c
-+++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
-@@ -632,9 +632,9 @@ int imx1_pinctrl_core_probe(struct platf
- ipctl->dev = info->dev;
- platform_set_drvdata(pdev, ipctl);
- ipctl->pctl = pinctrl_register(pctl_desc, &pdev->dev, ipctl);
-- if (!ipctl->pctl) {
-+ if (IS_ERR(ipctl->pctl)) {
- dev_err(&pdev->dev, "could not register IMX pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(ipctl->pctl);
- }
-
- ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
---- a/drivers/pinctrl/freescale/pinctrl-mxs.c
-+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
-@@ -540,9 +540,9 @@ int mxs_pinctrl_probe(struct platform_de
- }
-
- d->pctl = pinctrl_register(&mxs_pinctrl_desc, &pdev->dev, d);
-- if (!d->pctl) {
-+ if (IS_ERR(d->pctl)) {
- dev_err(&pdev->dev, "Couldn't register MXS pinctrl driver\n");
-- ret = -EINVAL;
-+ ret = PTR_ERR(d->pctl);
- goto err;
- }
-
---- a/drivers/pinctrl/intel/pinctrl-cherryview.c
-+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
-@@ -1547,9 +1547,9 @@ static int chv_pinctrl_probe(struct plat
- pctrl->pctldesc.npins = pctrl->community->npins;
-
- pctrl->pctldev = pinctrl_register(&pctrl->pctldesc, &pdev->dev, pctrl);
-- if (!pctrl->pctldev) {
-+ if (IS_ERR(pctrl->pctldev)) {
- dev_err(&pdev->dev, "failed to register pinctrl driver\n");
-- return -ENODEV;
-+ return PTR_ERR(pctrl->pctldev);
- }
-
- ret = chv_gpio_probe(pctrl, irq);
---- a/drivers/pinctrl/intel/pinctrl-intel.c
-+++ b/drivers/pinctrl/intel/pinctrl-intel.c
-@@ -1021,9 +1021,9 @@ int intel_pinctrl_probe(struct platform_
- pctrl->pctldesc.npins = pctrl->soc->npins;
-
- pctrl->pctldev = pinctrl_register(&pctrl->pctldesc, &pdev->dev, pctrl);
-- if (!pctrl->pctldev) {
-+ if (IS_ERR(pctrl->pctldev)) {
- dev_err(&pdev->dev, "failed to register pinctrl driver\n");
-- return -ENODEV;
-+ return PTR_ERR(pctrl->pctldev);
- }
-
- ret = intel_gpio_probe(pctrl, irq);
---- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
-+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
-@@ -1167,9 +1167,9 @@ int mtk_pctrl_init(struct platform_devic
- mtk_pctrl_desc.npins = pctl->devdata->npins;
- pctl->dev = &pdev->dev;
- pctl->pctl_dev = pinctrl_register(&mtk_pctrl_desc, &pdev->dev, pctl);
-- if (!pctl->pctl_dev) {
-+ if (IS_ERR(pctl->pctl_dev)) {
- dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(pctl->pctl_dev);
- }
-
- pctl->chip = devm_kzalloc(&pdev->dev, sizeof(*pctl->chip), GFP_KERNEL);
---- a/drivers/pinctrl/meson/pinctrl-meson.c
-+++ b/drivers/pinctrl/meson/pinctrl-meson.c
-@@ -738,9 +738,9 @@ static int meson_pinctrl_probe(struct pl
- pc->desc.npins = pc->data->num_pins;
-
- pc->pcdev = pinctrl_register(&pc->desc, pc->dev, pc);
-- if (!pc->pcdev) {
-+ if (IS_ERR(pc->pcdev)) {
- dev_err(pc->dev, "can't register pinctrl device");
-- return -EINVAL;
-+ return PTR_ERR(pc->pcdev);
- }
-
- ret = meson_gpiolib_register(pc);
---- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
-+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
-@@ -706,9 +706,9 @@ int mvebu_pinctrl_probe(struct platform_
- }
-
- pctl->pctldev = pinctrl_register(&pctl->desc, &pdev->dev, pctl);
-- if (!pctl->pctldev) {
-+ if (IS_ERR(pctl->pctldev)) {
- dev_err(&pdev->dev, "unable to register pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(pctl->pctldev);
- }
-
- dev_info(&pdev->dev, "registered pinctrl driver\n");
---- a/drivers/pinctrl/nomadik/pinctrl-abx500.c
-+++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c
-@@ -1234,10 +1234,10 @@ static int abx500_gpio_probe(struct plat
- abx500_pinctrl_desc.pins = pct->soc->pins;
- abx500_pinctrl_desc.npins = pct->soc->npins;
- pct->pctldev = pinctrl_register(&abx500_pinctrl_desc, &pdev->dev, pct);
-- if (!pct->pctldev) {
-+ if (IS_ERR(pct->pctldev)) {
- dev_err(&pdev->dev,
- "could not register abx500 pinctrl driver\n");
-- ret = -EINVAL;
-+ ret = PTR_ERR(pct->pctldev);
- goto out_rem_chip;
- }
- dev_info(&pdev->dev, "registered pin controller\n");
---- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c
-+++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
-@@ -2029,9 +2029,9 @@ static int nmk_pinctrl_probe(struct plat
- npct->dev = &pdev->dev;
-
- npct->pctl = pinctrl_register(&nmk_pinctrl_desc, &pdev->dev, npct);
-- if (!npct->pctl) {
-+ if (IS_ERR(npct->pctl)) {
- dev_err(&pdev->dev, "could not register Nomadik pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(npct->pctl);
- }
-
- /* We will handle a range of GPIO pins */
---- a/drivers/pinctrl/pinctrl-adi2.c
-+++ b/drivers/pinctrl/pinctrl-adi2.c
-@@ -1070,9 +1070,9 @@ static int adi_pinctrl_probe(struct plat
-
- /* Now register the pin controller and all pins it handles */
- pinctrl->pctl = pinctrl_register(&adi_pinmux_desc, &pdev->dev, pinctrl);
-- if (!pinctrl->pctl) {
-+ if (IS_ERR(pinctrl->pctl)) {
- dev_err(&pdev->dev, "could not register pinctrl ADI2 driver\n");
-- return -EINVAL;
-+ return PTR_ERR(pinctrl->pctl);
- }
-
- platform_set_drvdata(pdev, pinctrl);
---- a/drivers/pinctrl/pinctrl-amd.c
-+++ b/drivers/pinctrl/pinctrl-amd.c
-@@ -769,9 +769,9 @@ static int amd_gpio_probe(struct platfor
- amd_pinctrl_desc.name = dev_name(&pdev->dev);
- gpio_dev->pctrl = pinctrl_register(&amd_pinctrl_desc,
- &pdev->dev, gpio_dev);
-- if (!gpio_dev->pctrl) {
-+ if (IS_ERR(gpio_dev->pctrl)) {
- dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-- return -ENODEV;
-+ return PTR_ERR(gpio_dev->pctrl);
- }
-
- ret = gpiochip_add(&gpio_dev->gc);
---- a/drivers/pinctrl/pinctrl-as3722.c
-+++ b/drivers/pinctrl/pinctrl-as3722.c
-@@ -586,9 +586,9 @@ static int as3722_pinctrl_probe(struct p
- as3722_pinctrl_desc.npins = ARRAY_SIZE(as3722_pins_desc);
- as_pci->pctl = pinctrl_register(&as3722_pinctrl_desc,
- &pdev->dev, as_pci);
-- if (!as_pci->pctl) {
-+ if (IS_ERR(as_pci->pctl)) {
- dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(as_pci->pctl);
- }
-
- as_pci->gpio_chip = as3722_gpio_chip;
---- a/drivers/pinctrl/pinctrl-at91.c
-+++ b/drivers/pinctrl/pinctrl-at91.c
-@@ -1253,9 +1253,9 @@ static int at91_pinctrl_probe(struct pla
- platform_set_drvdata(pdev, info);
- info->pctl = pinctrl_register(&at91_pinctrl_desc, &pdev->dev, info);
-
-- if (!info->pctl) {
-+ if (IS_ERR(info->pctl)) {
- dev_err(&pdev->dev, "could not register AT91 pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(info->pctl);
- }
-
- /* We will handle a range of GPIO pins */
---- a/drivers/pinctrl/pinctrl-lantiq.c
-+++ b/drivers/pinctrl/pinctrl-lantiq.c
-@@ -337,9 +337,9 @@ int ltq_pinctrl_register(struct platform
- info->dev = &pdev->dev;
-
- info->pctrl = pinctrl_register(desc, &pdev->dev, info);
-- if (!info->pctrl) {
-+ if (IS_ERR(info->pctrl)) {
- dev_err(&pdev->dev, "failed to register LTQ pinmux driver\n");
-- return -EINVAL;
-+ return PTR_ERR(info->pctrl);
- }
- platform_set_drvdata(pdev, info);
- return 0;
---- a/drivers/pinctrl/pinctrl-palmas.c
-+++ b/drivers/pinctrl/pinctrl-palmas.c
-@@ -1044,9 +1044,9 @@ static int palmas_pinctrl_probe(struct p
- palmas_pinctrl_desc.pins = palmas_pins_desc;
- palmas_pinctrl_desc.npins = ARRAY_SIZE(palmas_pins_desc);
- pci->pctl = pinctrl_register(&palmas_pinctrl_desc, &pdev->dev, pci);
-- if (!pci->pctl) {
-+ if (IS_ERR(pci->pctl)) {
- dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-- return -ENODEV;
-+ return PTR_ERR(pci->pctl);
- }
- return 0;
- }
---- a/drivers/pinctrl/pinctrl-rockchip.c
-+++ b/drivers/pinctrl/pinctrl-rockchip.c
-@@ -1274,9 +1274,9 @@ static int rockchip_pinctrl_register(str
- return ret;
-
- info->pctl_dev = pinctrl_register(ctrldesc, &pdev->dev, info);
-- if (!info->pctl_dev) {
-+ if (IS_ERR(info->pctl_dev)) {
- dev_err(&pdev->dev, "could not register pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(info->pctl_dev);
- }
-
- for (bank = 0; bank < info->ctrl->nr_banks; ++bank) {
---- a/drivers/pinctrl/pinctrl-single.c
-+++ b/drivers/pinctrl/pinctrl-single.c
-@@ -1924,9 +1924,9 @@ static int pcs_probe(struct platform_dev
- goto free;
-
- pcs->pctl = pinctrl_register(&pcs->desc, pcs->dev, pcs);
-- if (!pcs->pctl) {
-+ if (IS_ERR(pcs->pctl)) {
- dev_err(pcs->dev, "could not register single pinctrl driver\n");
-- ret = -EINVAL;
-+ ret = PTR_ERR(pcs->pctl);
- goto free;
- }
-
---- a/drivers/pinctrl/pinctrl-st.c
-+++ b/drivers/pinctrl/pinctrl-st.c
-@@ -1737,9 +1737,9 @@ static int st_pctl_probe(struct platform
- pctl_desc->name = dev_name(&pdev->dev);
-
- info->pctl = pinctrl_register(pctl_desc, &pdev->dev, info);
-- if (!info->pctl) {
-+ if (IS_ERR(info->pctl)) {
- dev_err(&pdev->dev, "Failed pinctrl registration\n");
-- return -EINVAL;
-+ return PTR_ERR(info->pctl);
- }
-
- for (i = 0; i < info->nbanks; i++)
---- a/drivers/pinctrl/pinctrl-tb10x.c
-+++ b/drivers/pinctrl/pinctrl-tb10x.c
-@@ -807,9 +807,9 @@ static int tb10x_pinctrl_probe(struct pl
- }
-
- state->pctl = pinctrl_register(&tb10x_pindesc, dev, state);
-- if (!state->pctl) {
-+ if (IS_ERR(state->pctl)) {
- dev_err(dev, "could not register TB10x pin driver\n");
-- ret = -EINVAL;
-+ ret = PTR_ERR(state->pctl);
- goto fail;
- }
-
---- a/drivers/pinctrl/pinctrl-tegra-xusb.c
-+++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
-@@ -909,9 +909,9 @@ static int tegra_xusb_padctl_probe(struc
- padctl->desc.owner = THIS_MODULE;
-
- padctl->pinctrl = pinctrl_register(&padctl->desc, &pdev->dev, padctl);
-- if (!padctl->pinctrl) {
-+ if (IS_ERR(padctl->pinctrl)) {
- dev_err(&pdev->dev, "failed to register pincontrol\n");
-- err = -ENODEV;
-+ err = PTR_ERR(padctl->pinctrl);
- goto reset;
- }
-
---- a/drivers/pinctrl/pinctrl-tegra.c
-+++ b/drivers/pinctrl/pinctrl-tegra.c
-@@ -703,9 +703,9 @@ int tegra_pinctrl_probe(struct platform_
- }
-
- pmx->pctl = pinctrl_register(&tegra_pinctrl_desc, &pdev->dev, pmx);
-- if (!pmx->pctl) {
-+ if (IS_ERR(pmx->pctl)) {
- dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-- return -ENODEV;
-+ return PTR_ERR(pmx->pctl);
- }
-
- pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
---- a/drivers/pinctrl/pinctrl-tz1090-pdc.c
-+++ b/drivers/pinctrl/pinctrl-tz1090-pdc.c
-@@ -948,9 +948,9 @@ static int tz1090_pdc_pinctrl_probe(stru
- return PTR_ERR(pmx->regs);
-
- pmx->pctl = pinctrl_register(&tz1090_pdc_pinctrl_desc, &pdev->dev, pmx);
-- if (!pmx->pctl) {
-+ if (IS_ERR(pmx->pctl)) {
- dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-- return -ENODEV;
-+ return PTR_ERR(pmx->pctl);
- }
-
- platform_set_drvdata(pdev, pmx);
---- a/drivers/pinctrl/pinctrl-tz1090.c
-+++ b/drivers/pinctrl/pinctrl-tz1090.c
-@@ -1963,9 +1963,9 @@ static int tz1090_pinctrl_probe(struct p
- return PTR_ERR(pmx->regs);
-
- pmx->pctl = pinctrl_register(&tz1090_pinctrl_desc, &pdev->dev, pmx);
-- if (!pmx->pctl) {
-+ if (IS_ERR(pmx->pctl)) {
- dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-- return -ENODEV;
-+ return PTR_ERR(pmx->pctl);
- }
-
- platform_set_drvdata(pdev, pmx);
---- a/drivers/pinctrl/pinctrl-u300.c
-+++ b/drivers/pinctrl/pinctrl-u300.c
-@@ -1068,9 +1068,9 @@ static int u300_pmx_probe(struct platfor
- return PTR_ERR(upmx->virtbase);
-
- upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx);
-- if (!upmx->pctl) {
-+ if (IS_ERR(upmx->pctl)) {
- dev_err(&pdev->dev, "could not register U300 pinmux driver\n");
-- return -EINVAL;
-+ return PTR_ERR(upmx->pctl);
- }
-
- platform_set_drvdata(pdev, upmx);
---- a/drivers/pinctrl/pinctrl-zynq.c
-+++ b/drivers/pinctrl/pinctrl-zynq.c
-@@ -1140,8 +1140,8 @@ static int zynq_pinctrl_probe(struct pla
- pctrl->nfuncs = ARRAY_SIZE(zynq_pmux_functions);
-
- pctrl->pctrl = pinctrl_register(&zynq_desc, &pdev->dev, pctrl);
-- if (!pctrl->pctrl)
-- return -ENOMEM;
-+ if (IS_ERR(pctrl->pctrl))
-+ return PTR_ERR(pctrl->pctrl);
-
- platform_set_drvdata(pdev, pctrl);
-
---- a/drivers/pinctrl/qcom/pinctrl-msm.c
-+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
-@@ -902,9 +902,9 @@ int msm_pinctrl_probe(struct platform_de
- msm_pinctrl_desc.pins = pctrl->soc->pins;
- msm_pinctrl_desc.npins = pctrl->soc->npins;
- pctrl->pctrl = pinctrl_register(&msm_pinctrl_desc, &pdev->dev, pctrl);
-- if (!pctrl->pctrl) {
-+ if (IS_ERR(pctrl->pctrl)) {
- dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-- return -ENODEV;
-+ return PTR_ERR(pctrl->pctrl);
- }
-
- ret = msm_gpio_init(pctrl);
---- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
-+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
-@@ -778,8 +778,8 @@ static int pmic_gpio_probe(struct platfo
- state->chip.can_sleep = false;
-
- state->ctrl = pinctrl_register(pctrldesc, dev, state);
-- if (!state->ctrl)
-- return -ENODEV;
-+ if (IS_ERR(state->ctrl))
-+ return PTR_ERR(state->ctrl);
-
- ret = gpiochip_add(&state->chip);
- if (ret) {
---- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
-+++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
-@@ -892,8 +892,8 @@ static int pmic_mpp_probe(struct platfor
- state->chip.can_sleep = false;
-
- state->ctrl = pinctrl_register(pctrldesc, dev, state);
-- if (!state->ctrl)
-- return -ENODEV;
-+ if (IS_ERR(state->ctrl))
-+ return PTR_ERR(state->ctrl);
-
- ret = gpiochip_add(&state->chip);
- if (ret) {
---- a/drivers/pinctrl/samsung/pinctrl-exynos5440.c
-+++ b/drivers/pinctrl/samsung/pinctrl-exynos5440.c
-@@ -823,9 +823,9 @@ static int exynos5440_pinctrl_register(s
- return ret;
-
- pctl_dev = pinctrl_register(ctrldesc, &pdev->dev, priv);
-- if (!pctl_dev) {
-+ if (IS_ERR(pctl_dev)) {
- dev_err(&pdev->dev, "could not register pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(pctl_dev);
- }
-
- priv->range.name = "exynos5440-pctrl-gpio-range";
---- a/drivers/pinctrl/samsung/pinctrl-samsung.c
-+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
-@@ -873,9 +873,9 @@ static int samsung_pinctrl_register(stru
- return ret;
-
- drvdata->pctl_dev = pinctrl_register(ctrldesc, &pdev->dev, drvdata);
-- if (!drvdata->pctl_dev) {
-+ if (IS_ERR(drvdata->pctl_dev)) {
- dev_err(&pdev->dev, "could not register pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(drvdata->pctl_dev);
- }
-
- for (bank = 0; bank < drvdata->nr_banks; ++bank) {
---- a/drivers/pinctrl/sh-pfc/pinctrl.c
-+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
-@@ -625,8 +625,8 @@ int sh_pfc_register_pinctrl(struct sh_pf
- pmx->pctl_desc.npins = pfc->info->nr_pins;
-
- pmx->pctl = pinctrl_register(&pmx->pctl_desc, pfc->dev, pmx);
-- if (pmx->pctl == NULL)
-- return -EINVAL;
-+ if (IS_ERR(pmx->pctl))
-+ return PTR_ERR(pmx->pctl);
-
- return 0;
- }
---- a/drivers/pinctrl/sirf/pinctrl-sirf.c
-+++ b/drivers/pinctrl/sirf/pinctrl-sirf.c
-@@ -310,9 +310,9 @@ static int sirfsoc_pinmux_probe(struct p
-
- /* Now register the pin controller and all pins it handles */
- spmx->pmx = pinctrl_register(&sirfsoc_pinmux_desc, &pdev->dev, spmx);
-- if (!spmx->pmx) {
-+ if (IS_ERR(spmx->pmx)) {
- dev_err(&pdev->dev, "could not register SIRFSOC pinmux driver\n");
-- ret = -EINVAL;
-+ ret = PTR_ERR(spmx->pmx);
- goto out_no_pmx;
- }
-
---- a/drivers/pinctrl/spear/pinctrl-spear.c
-+++ b/drivers/pinctrl/spear/pinctrl-spear.c
-@@ -396,9 +396,9 @@ int spear_pinctrl_probe(struct platform_
- spear_pinctrl_desc.npins = machdata->npins;
-
- pmx->pctl = pinctrl_register(&spear_pinctrl_desc, &pdev->dev, pmx);
-- if (!pmx->pctl) {
-+ if (IS_ERR(pmx->pctl)) {
- dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
-- return -ENODEV;
-+ return PTR_ERR(pmx->pctl);
- }
-
- return 0;
---- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
-+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
-@@ -911,9 +911,9 @@ int sunxi_pinctrl_init(struct platform_d
-
- pctl->pctl_dev = pinctrl_register(pctrl_desc,
- &pdev->dev, pctl);
-- if (!pctl->pctl_dev) {
-+ if (IS_ERR(pctl->pctl_dev)) {
- dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
-- return -EINVAL;
-+ return PTR_ERR(pctl->pctl_dev);
- }
-
- pctl->chip = devm_kzalloc(&pdev->dev, sizeof(*pctl->chip), GFP_KERNEL);
---- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
-+++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
-@@ -594,9 +594,9 @@ int wmt_pinctrl_probe(struct platform_de
- data->dev = &pdev->dev;
-
- data->pctl_dev = pinctrl_register(&wmt_desc, &pdev->dev, data);
-- if (!data->pctl_dev) {
-+ if (IS_ERR(data->pctl_dev)) {
- dev_err(&pdev->dev, "Failed to register pinctrl\n");
-- return -EINVAL;
-+ return PTR_ERR(data->pctl_dev);
- }
-
- err = gpiochip_add(&data->gpio_chip);
diff --git a/patches.renesas/0069-dmaengine-rcar-dmac-fixup-spinlock-in-rcar-dmac.patch b/patches.renesas/0069-dmaengine-rcar-dmac-fixup-spinlock-in-rcar-dmac.patch
deleted file mode 100644
index 1c42760257b648..00000000000000
--- a/patches.renesas/0069-dmaengine-rcar-dmac-fixup-spinlock-in-rcar-dmac.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-From 8eee16b07e04e1c440cf5298767959913d32aa0c Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Thu, 21 May 2015 03:48:38 +0000
-Subject: [PATCH 069/129] dmaengine: rcar-dmac: fixup spinlock in rcar-dmac
-
-Current rcar-dmac driver is using spin_lock_irq() / spin_unlock_irq()
-in some functions. But, some other driver might call DMAEngine API
-during interrupt disabled. In such case, rcar-dmac side spin_unlock_irq()
-forcefully allows all interrupts. Therefore, other driver receives
-unexpected interruption, and its exclusive access control will be broken.
-This patch replaces spin_lock_irq() to spin_lock_irqsave(),
-and spin_unlock_irq() to spin_unlock_irqrestore().
-
-Reported-by: Cao Minh Hiep <cm-hiep@jinso.co.jp>
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Acked-by: Vinod Koul <vinod.koul@intel.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit d23c9a0a5c237210bccb82a2e9dc0d26e75920ee)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/dma/sh/rcar-dmac.c | 37 +++++++++++++++++++++----------------
- 1 file changed, 21 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
-index a18d16cc4795..e0302c784ba4 100644
---- a/drivers/dma/sh/rcar-dmac.c
-+++ b/drivers/dma/sh/rcar-dmac.c
-@@ -465,6 +465,7 @@ static dma_cookie_t rcar_dmac_tx_submit(struct dma_async_tx_descriptor *tx)
- static int rcar_dmac_desc_alloc(struct rcar_dmac_chan *chan, gfp_t gfp)
- {
- struct rcar_dmac_desc_page *page;
-+ unsigned long flags;
- LIST_HEAD(list);
- unsigned int i;
-
-@@ -482,10 +483,10 @@ static int rcar_dmac_desc_alloc(struct rcar_dmac_chan *chan, gfp_t gfp)
- list_add_tail(&desc->node, &list);
- }
-
-- spin_lock_irq(&chan->lock);
-+ spin_lock_irqsave(&chan->lock, flags);
- list_splice_tail(&list, &chan->desc.free);
- list_add_tail(&page->node, &chan->desc.pages);
-- spin_unlock_irq(&chan->lock);
-+ spin_unlock_irqrestore(&chan->lock, flags);
-
- return 0;
- }
-@@ -516,6 +517,7 @@ static void rcar_dmac_desc_put(struct rcar_dmac_chan *chan,
- static void rcar_dmac_desc_recycle_acked(struct rcar_dmac_chan *chan)
- {
- struct rcar_dmac_desc *desc, *_desc;
-+ unsigned long flags;
- LIST_HEAD(list);
-
- /*
-@@ -524,9 +526,9 @@ static void rcar_dmac_desc_recycle_acked(struct rcar_dmac_chan *chan)
- * list_for_each_entry_safe, isn't safe if we release the channel lock
- * around the rcar_dmac_desc_put() call.
- */
-- spin_lock_irq(&chan->lock);
-+ spin_lock_irqsave(&chan->lock, flags);
- list_splice_init(&chan->desc.wait, &list);
-- spin_unlock_irq(&chan->lock);
-+ spin_unlock_irqrestore(&chan->lock, flags);
-
- list_for_each_entry_safe(desc, _desc, &list, node) {
- if (async_tx_test_ack(&desc->async_tx)) {
-@@ -539,9 +541,9 @@ static void rcar_dmac_desc_recycle_acked(struct rcar_dmac_chan *chan)
- return;
-
- /* Put the remaining descriptors back in the wait list. */
-- spin_lock_irq(&chan->lock);
-+ spin_lock_irqsave(&chan->lock, flags);
- list_splice(&list, &chan->desc.wait);
-- spin_unlock_irq(&chan->lock);
-+ spin_unlock_irqrestore(&chan->lock, flags);
- }
-
- /*
-@@ -556,12 +558,13 @@ static void rcar_dmac_desc_recycle_acked(struct rcar_dmac_chan *chan)
- static struct rcar_dmac_desc *rcar_dmac_desc_get(struct rcar_dmac_chan *chan)
- {
- struct rcar_dmac_desc *desc;
-+ unsigned long flags;
- int ret;
-
- /* Recycle acked descriptors before attempting allocation. */
- rcar_dmac_desc_recycle_acked(chan);
-
-- spin_lock_irq(&chan->lock);
-+ spin_lock_irqsave(&chan->lock, flags);
-
- while (list_empty(&chan->desc.free)) {
- /*
-@@ -570,17 +573,17 @@ static struct rcar_dmac_desc *rcar_dmac_desc_get(struct rcar_dmac_chan *chan)
- * allocated descriptors. If the allocation fails return an
- * error.
- */
-- spin_unlock_irq(&chan->lock);
-+ spin_unlock_irqrestore(&chan->lock, flags);
- ret = rcar_dmac_desc_alloc(chan, GFP_NOWAIT);
- if (ret < 0)
- return NULL;
-- spin_lock_irq(&chan->lock);
-+ spin_lock_irqsave(&chan->lock, flags);
- }
-
- desc = list_first_entry(&chan->desc.free, struct rcar_dmac_desc, node);
- list_del(&desc->node);
-
-- spin_unlock_irq(&chan->lock);
-+ spin_unlock_irqrestore(&chan->lock, flags);
-
- return desc;
- }
-@@ -593,6 +596,7 @@ static struct rcar_dmac_desc *rcar_dmac_desc_get(struct rcar_dmac_chan *chan)
- static int rcar_dmac_xfer_chunk_alloc(struct rcar_dmac_chan *chan, gfp_t gfp)
- {
- struct rcar_dmac_desc_page *page;
-+ unsigned long flags;
- LIST_HEAD(list);
- unsigned int i;
-
-@@ -606,10 +610,10 @@ static int rcar_dmac_xfer_chunk_alloc(struct rcar_dmac_chan *chan, gfp_t gfp)
- list_add_tail(&chunk->node, &list);
- }
-
-- spin_lock_irq(&chan->lock);
-+ spin_lock_irqsave(&chan->lock, flags);
- list_splice_tail(&list, &chan->desc.chunks_free);
- list_add_tail(&page->node, &chan->desc.pages);
-- spin_unlock_irq(&chan->lock);
-+ spin_unlock_irqrestore(&chan->lock, flags);
-
- return 0;
- }
-@@ -627,9 +631,10 @@ static struct rcar_dmac_xfer_chunk *
- rcar_dmac_xfer_chunk_get(struct rcar_dmac_chan *chan)
- {
- struct rcar_dmac_xfer_chunk *chunk;
-+ unsigned long flags;
- int ret;
-
-- spin_lock_irq(&chan->lock);
-+ spin_lock_irqsave(&chan->lock, flags);
-
- while (list_empty(&chan->desc.chunks_free)) {
- /*
-@@ -638,18 +643,18 @@ rcar_dmac_xfer_chunk_get(struct rcar_dmac_chan *chan)
- * allocated descriptors. If the allocation fails return an
- * error.
- */
-- spin_unlock_irq(&chan->lock);
-+ spin_unlock_irqrestore(&chan->lock, flags);
- ret = rcar_dmac_xfer_chunk_alloc(chan, GFP_NOWAIT);
- if (ret < 0)
- return NULL;
-- spin_lock_irq(&chan->lock);
-+ spin_lock_irqsave(&chan->lock, flags);
- }
-
- chunk = list_first_entry(&chan->desc.chunks_free,
- struct rcar_dmac_xfer_chunk, node);
- list_del(&chunk->node);
-
-- spin_unlock_irq(&chan->lock);
-+ spin_unlock_irqrestore(&chan->lock, flags);
-
- return chunk;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0070-dmaengine-rcar-dmac-Use-DECLARE_BITMAP.patch b/patches.renesas/0070-dmaengine-rcar-dmac-Use-DECLARE_BITMAP.patch
deleted file mode 100644
index e695cff615b764..00000000000000
--- a/patches.renesas/0070-dmaengine-rcar-dmac-Use-DECLARE_BITMAP.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From b5f0ba7b44fb4aceafca6fa704cdb325afb80b57 Mon Sep 17 00:00:00 2001
-From: Joe Perches <joe@perches.com>
-Date: Tue, 19 May 2015 18:37:50 -0700
-Subject: [PATCH 070/129] dmaengine: rcar-dmac: Use DECLARE_BITMAP
-
-Use the generic mechanism to declare a bitmap instead of unsigned long.
-
-Signed-off-by: Joe Perches <joe@perches.com>
-Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-(cherry picked from commit 08acf38e3615a5cf641d84f815f3f3ebd2953243)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/dma/sh/rcar-dmac.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
-index e0302c784ba4..7820d07e7bee 100644
---- a/drivers/dma/sh/rcar-dmac.c
-+++ b/drivers/dma/sh/rcar-dmac.c
-@@ -183,7 +183,7 @@ struct rcar_dmac {
- unsigned int n_channels;
- struct rcar_dmac_chan *channels;
-
-- unsigned long modules[256 / BITS_PER_LONG];
-+ DECLARE_BITMAP(modules, 256);
- };
-
- #define to_rcar_dmac(d) container_of(d, struct rcar_dmac, engine)
---
-2.6.2
-
diff --git a/patches.renesas/0071-drm-rcar-du-Document-the-rcar_du_crtc-structure.patch b/patches.renesas/0071-drm-rcar-du-Document-the-rcar_du_crtc-structure.patch
deleted file mode 100644
index 25eb59d9b2aedd..00000000000000
--- a/patches.renesas/0071-drm-rcar-du-Document-the-rcar_du_crtc-structure.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From f3d116226b4871e35b76bf657d36873c5cc9a3cd Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Wed, 29 Apr 2015 01:11:57 +0300
-Subject: [PATCH 071/129] drm: rcar-du: Document the rcar_du_crtc structure
-
-Document the structure fields using kerneldoc.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit bce9936a0d7f6570aaa64a41e6ff902716aabfa6)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 14 ++++++++++++++
- 1 file changed, 14 insertions(+)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
-index 5d9aa9b33769..4b95d9d08c49 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
-@@ -22,6 +22,20 @@
-
- struct rcar_du_group;
-
-+/**
-+ * struct rcar_du_crtc - the CRTC, representing a DU superposition processor
-+ * @crtc: base DRM CRTC
-+ * @clock: the CRTC functional clock
-+ * @extclock: external pixel dot clock (optional)
-+ * @mmio_offset: offset of the CRTC registers in the DU MMIO block
-+ * @index: CRTC software and hardware index
-+ * @started: whether the CRTC has been started and is running
-+ * @event: event to post when the pending page flip completes
-+ * @flip_wait: wait queue used to signal page flip completion
-+ * @outputs: bitmask of the outputs (enum rcar_du_output) driven by this CRTC
-+ * @enabled: whether the CRTC is enabled, used to control system resume
-+ * @group: CRTC group this CRTC belongs to
-+ */
- struct rcar_du_crtc {
- struct drm_crtc crtc;
-
---
-2.6.2
-
diff --git a/patches.renesas/0072-drm-rcar-du-Document-the-rcar_du_plane_state-structu.patch b/patches.renesas/0072-drm-rcar-du-Document-the-rcar_du_plane_state-structu.patch
deleted file mode 100644
index 338779061ff8a3..00000000000000
--- a/patches.renesas/0072-drm-rcar-du-Document-the-rcar_du_plane_state-structu.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 11c80836c0d931223d8d50e7eadc6ed913c096c0 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Wed, 29 Apr 2015 00:12:40 +0300
-Subject: [PATCH 072/129] drm: rcar-du: Document the rcar_du_plane_state
- structure
-
-Document the structure fields using kerneldoc.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 0855c6827f822b51b2b4fc86d1085f47463cb5c9)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-index abff0ebeb195..2beb67acdb38 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-@@ -46,11 +46,20 @@ struct rcar_du_planes {
- struct drm_property *zpos;
- };
-
-+/**
-+ * struct rcar_du_plane_state - Driver-specific plane state
-+ * @state: base DRM plane state
-+ * @format: information about the pixel format used by the plane
-+ * @hwindex: 0-based hardware plane index, -1 means unused
-+ * @alpha: value of the plane alpha property
-+ * @colorkey: value of the plane colorkey property
-+ * @zpos: value of the plane zpos property
-+ */
- struct rcar_du_plane_state {
- struct drm_plane_state state;
-
- const struct rcar_du_format_info *format;
-- int hwindex; /* 0-based, -1 means unused */
-+ int hwindex;
-
- unsigned int alpha;
- unsigned int colorkey;
---
-2.6.2
-
diff --git a/patches.renesas/0073-drm-rcar-du-Move-properties-from-rcar_du_planes-to-r.patch b/patches.renesas/0073-drm-rcar-du-Move-properties-from-rcar_du_planes-to-r.patch
deleted file mode 100644
index 811fee5979cf3e..00000000000000
--- a/patches.renesas/0073-drm-rcar-du-Move-properties-from-rcar_du_planes-to-r.patch
+++ /dev/null
@@ -1,189 +0,0 @@
-From b51a533b3f64b700e1f3d22453d483a6ac38a00b Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Tue, 28 Apr 2015 23:59:29 +0300
-Subject: [PATCH 073/129] drm: rcar-du: Move properties from rcar_du_planes to
- rcar_du_device
-
-The plane property objects are instantiated once per CRTC group, while
-they should be instantiated once globally for the device. Fix this and
-move them to the rcar_du_device structure.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 9f6aee952b18d9910912d7cedae9bd26bd901ac3)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 6 +++++
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 29 +++++++++++++++++++++
- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 46 +++++++++------------------------
- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 4 ---
- 4 files changed, 47 insertions(+), 38 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
-index c7c538dd2e68..9f34fc86436a 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
-@@ -83,6 +83,12 @@ struct rcar_du_device {
-
- struct rcar_du_group groups[RCAR_DU_MAX_GROUPS];
-
-+ struct {
-+ struct drm_property *alpha;
-+ struct drm_property *colorkey;
-+ struct drm_property *zpos;
-+ } props;
-+
- unsigned int dpad0_source;
- struct rcar_du_lvdsenc *lvds[RCAR_DU_MAX_LVDS];
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index 93117f159a3b..5fd6f8c07ec2 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -648,6 +648,31 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
- return num_encoders;
- }
-
-+static int rcar_du_properties_init(struct rcar_du_device *rcdu)
-+{
-+ rcdu->props.alpha =
-+ drm_property_create_range(rcdu->ddev, 0, "alpha", 0, 255);
-+ if (rcdu->props.alpha == NULL)
-+ return -ENOMEM;
-+
-+ /* The color key is expressed as an RGB888 triplet stored in a 32-bit
-+ * integer in XRGB8888 format. Bit 24 is used as a flag to disable (0)
-+ * or enable source color keying (1).
-+ */
-+ rcdu->props.colorkey =
-+ drm_property_create_range(rcdu->ddev, 0, "colorkey",
-+ 0, 0x01ffffff);
-+ if (rcdu->props.colorkey == NULL)
-+ return -ENOMEM;
-+
-+ rcdu->props.zpos =
-+ drm_property_create_range(rcdu->ddev, 0, "zpos", 1, 7);
-+ if (rcdu->props.zpos == NULL)
-+ return -ENOMEM;
-+
-+ return 0;
-+}
-+
- int rcar_du_modeset_init(struct rcar_du_device *rcdu)
- {
- static const unsigned int mmio_offsets[] = {
-@@ -672,6 +697,10 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
-
- rcdu->num_crtcs = rcdu->info->num_crtcs;
-
-+ ret = rcar_du_properties_init(rcdu);
-+ if (ret < 0)
-+ return ret;
-+
- /* Initialize the groups. */
- num_groups = DIV_ROUND_UP(rcdu->num_crtcs, 2);
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-index 210e5c3fd982..b5565417f673 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-@@ -328,14 +328,13 @@ static int rcar_du_plane_atomic_set_property(struct drm_plane *plane,
- uint64_t val)
- {
- struct rcar_du_plane_state *rstate = to_rcar_du_plane_state(state);
-- struct rcar_du_plane *rplane = to_rcar_plane(plane);
-- struct rcar_du_group *rgrp = rplane->group;
-+ struct rcar_du_device *rcdu = to_rcar_plane(plane)->group->dev;
-
-- if (property == rgrp->planes.alpha)
-+ if (property == rcdu->props.alpha)
- rstate->alpha = val;
-- else if (property == rgrp->planes.colorkey)
-+ else if (property == rcdu->props.colorkey)
- rstate->colorkey = val;
-- else if (property == rgrp->planes.zpos)
-+ else if (property == rcdu->props.zpos)
- rstate->zpos = val;
- else
- return -EINVAL;
-@@ -349,14 +348,13 @@ static int rcar_du_plane_atomic_get_property(struct drm_plane *plane,
- {
- const struct rcar_du_plane_state *rstate =
- container_of(state, const struct rcar_du_plane_state, state);
-- struct rcar_du_plane *rplane = to_rcar_plane(plane);
-- struct rcar_du_group *rgrp = rplane->group;
-+ struct rcar_du_device *rcdu = to_rcar_plane(plane)->group->dev;
-
-- if (property == rgrp->planes.alpha)
-+ if (property == rcdu->props.alpha)
- *val = rstate->alpha;
-- else if (property == rgrp->planes.colorkey)
-+ else if (property == rcdu->props.colorkey)
- *val = rstate->colorkey;
-- else if (property == rgrp->planes.zpos)
-+ else if (property == rcdu->props.zpos)
- *val = rstate->zpos;
- else
- return -EINVAL;
-@@ -399,27 +397,7 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
- unsigned int i;
- int ret;
-
-- planes->alpha =
-- drm_property_create_range(rcdu->ddev, 0, "alpha", 0, 255);
-- if (planes->alpha == NULL)
-- return -ENOMEM;
--
-- /* The color key is expressed as an RGB888 triplet stored in a 32-bit
-- * integer in XRGB8888 format. Bit 24 is used as a flag to disable (0)
-- * or enable source color keying (1).
-- */
-- planes->colorkey =
-- drm_property_create_range(rcdu->ddev, 0, "colorkey",
-- 0, 0x01ffffff);
-- if (planes->colorkey == NULL)
-- return -ENOMEM;
--
-- planes->zpos =
-- drm_property_create_range(rcdu->ddev, 0, "zpos", 1, 7);
-- if (planes->zpos == NULL)
-- return -ENOMEM;
--
-- /* Create one primary plane per in this group CRTC and seven overlay
-+ /* Create one primary plane per CRTC in this group and seven overlay
- * planes.
- */
- num_crtcs = min(rcdu->num_crtcs - 2 * rgrp->index, 2U);
-@@ -448,12 +426,12 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
- continue;
-
- drm_object_attach_property(&plane->plane.base,
-- planes->alpha, 255);
-+ rcdu->props.alpha, 255);
- drm_object_attach_property(&plane->plane.base,
-- planes->colorkey,
-+ rcdu->props.colorkey,
- RCAR_DU_COLORKEY_NONE);
- drm_object_attach_property(&plane->plane.base,
-- planes->zpos, 1);
-+ rcdu->props.zpos, 1);
- }
-
- return 0;
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-index 2beb67acdb38..6b17b1f4f414 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-@@ -40,10 +40,6 @@ static inline struct rcar_du_plane *to_rcar_plane(struct drm_plane *plane)
-
- struct rcar_du_planes {
- struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES];
--
-- struct drm_property *alpha;
-- struct drm_property *colorkey;
-- struct drm_property *zpos;
- };
-
- /**
---
-2.6.2
-
diff --git a/patches.renesas/0074-drm-rcar-du-Embed-rcar_du_planes-structure-into-rcar.patch b/patches.renesas/0074-drm-rcar-du-Embed-rcar_du_planes-structure-into-rcar.patch
deleted file mode 100644
index 492ac67b97fb30..00000000000000
--- a/patches.renesas/0074-drm-rcar-du-Embed-rcar_du_planes-structure-into-rcar.patch
+++ /dev/null
@@ -1,139 +0,0 @@
-From 6632cea8122ed41b9771539e7e2a116bffd71cd1 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Wed, 29 Apr 2015 00:05:56 +0300
-Subject: [PATCH 074/129] drm: rcar-du: Embed rcar_du_planes structure into
- rcar_du_group
-
-The rcar_du_planes structure contains a single field and is only
-instantiated in the rcar_du_group structure. Embed it directly and
-remove the rcar_du_planes structure.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 99caede11d84af4c0a16fd07f7d7ce9de94f6109)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 10 +++++-----
- drivers/gpu/drm/rcar-du/rcar_du_group.h | 2 +-
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 6 +++---
- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 3 +--
- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 4 ----
- 5 files changed, 10 insertions(+), 15 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-index 7d0b8ef9bea2..b5f66b78cbb2 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-@@ -213,8 +213,8 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc)
- u32 dptsr = 0;
- u32 dspr = 0;
-
-- for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes.planes); ++i) {
-- struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i];
-+ for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes); ++i) {
-+ struct rcar_du_plane *plane = &rcrtc->group->planes[i];
- unsigned int j;
-
- if (plane->plane.state->crtc != &rcrtc->crtc)
-@@ -427,8 +427,8 @@ void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc)
- rcar_du_crtc_start(rcrtc);
-
- /* Commit the planes state. */
-- for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes.planes); ++i) {
-- struct rcar_du_plane *plane = &rcrtc->group->planes.planes[i];
-+ for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes); ++i) {
-+ struct rcar_du_plane *plane = &rcrtc->group->planes[i];
-
- if (plane->plane.state->crtc != &rcrtc->crtc)
- continue;
-@@ -592,7 +592,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int index)
- rcrtc->enabled = false;
-
- ret = drm_crtc_init_with_planes(rcdu->ddev, crtc,
-- &rgrp->planes.planes[index % 2].plane,
-+ &rgrp->planes[index % 2].plane,
- NULL, &crtc_funcs);
- if (ret < 0)
- return ret;
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.h b/drivers/gpu/drm/rcar-du/rcar_du_group.h
-index ed36433fbe84..ea02bb02f3e1 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_group.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.h
-@@ -40,7 +40,7 @@ struct rcar_du_group {
-
- struct mutex lock;
-
-- struct rcar_du_planes planes;
-+ struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES];
- };
-
- u32 rcar_du_group_read(struct rcar_du_group *rgrp, u32 reg);
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index 5fd6f8c07ec2..4012afacab5f 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -291,7 +291,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- * plane(s) as freed.
- */
- if (!plane_state->format) {
-- index = plane - plane->group->planes.planes;
-+ index = plane - plane->group->planes;
- group_freed_planes[plane->group->index] |= 1 << index;
- plane_state->hwindex = -1;
- continue;
-@@ -304,7 +304,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- groups |= 1 << plane->group->index;
- needs_realloc = true;
-
-- index = plane - plane->group->planes.planes;
-+ index = plane - plane->group->planes;
- group_freed_planes[plane->group->index] |= 1 << index;
- plane_state->hwindex = -1;
- }
-@@ -327,7 +327,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- unsigned int used_planes = 0;
-
- for (i = 0; i < RCAR_DU_NUM_KMS_PLANES; ++i) {
-- struct rcar_du_plane *plane = &group->planes.planes[i];
-+ struct rcar_du_plane *plane = &group->planes[i];
- struct rcar_du_plane_state *plane_state;
- struct drm_plane_state *s;
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-index b5565417f673..99fefcaf6597 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-@@ -389,7 +389,6 @@ static const uint32_t formats[] = {
-
- int rcar_du_planes_init(struct rcar_du_group *rgrp)
- {
-- struct rcar_du_planes *planes = &rgrp->planes;
- struct rcar_du_device *rcdu = rgrp->dev;
- unsigned int num_planes;
- unsigned int num_crtcs;
-@@ -409,7 +408,7 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
- enum drm_plane_type type = i < num_crtcs
- ? DRM_PLANE_TYPE_PRIMARY
- : DRM_PLANE_TYPE_OVERLAY;
-- struct rcar_du_plane *plane = &planes->planes[i];
-+ struct rcar_du_plane *plane = &rgrp->planes[i];
-
- plane->group = rgrp;
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-index 6b17b1f4f414..d1fb9b16a060 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-@@ -38,10 +38,6 @@ static inline struct rcar_du_plane *to_rcar_plane(struct drm_plane *plane)
- return container_of(plane, struct rcar_du_plane, plane);
- }
-
--struct rcar_du_planes {
-- struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES];
--};
--
- /**
- * struct rcar_du_plane_state - Driver-specific plane state
- * @state: base DRM plane state
---
-2.6.2
-
diff --git a/patches.renesas/0075-drm-rcar-du-Rename-to_rcar_du_plane_state-to-to_rcar.patch b/patches.renesas/0075-drm-rcar-du-Rename-to_rcar_du_plane_state-to-to_rcar.patch
deleted file mode 100644
index 1e5caec5a4bafe..00000000000000
--- a/patches.renesas/0075-drm-rcar-du-Rename-to_rcar_du_plane_state-to-to_rcar.patch
+++ /dev/null
@@ -1,180 +0,0 @@
-From f3742ecfbc8bcb33752ccd0c1fe1948d7c7362d7 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Wed, 29 Apr 2015 00:48:17 +0300
-Subject: [PATCH 075/129] drm: rcar-du: Rename to_rcar_du_plane_state to
- to_rcar_plane_state
-
-All other cast functions are named without using "du", make the plane
-state cast consistent with them.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit ec69a40645c829fcec613b437f72451205ff601f)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 6 +++---
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 8 ++++----
- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 16 ++++++++--------
- drivers/gpu/drm/rcar-du/rcar_du_plane.h | 2 +-
- 4 files changed, 16 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-index b5f66b78cbb2..15f8d145a133 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-@@ -195,13 +195,13 @@ void rcar_du_crtc_route_output(struct drm_crtc *crtc,
-
- static unsigned int plane_zpos(struct rcar_du_plane *plane)
- {
-- return to_rcar_du_plane_state(plane->plane.state)->zpos;
-+ return to_rcar_plane_state(plane->plane.state)->zpos;
- }
-
- static const struct rcar_du_format_info *
- plane_format(struct rcar_du_plane *plane)
- {
-- return to_rcar_du_plane_state(plane->plane.state)->format;
-+ return to_rcar_plane_state(plane->plane.state)->format;
- }
-
- static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc)
-@@ -234,7 +234,7 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc)
- for (i = 0; i < num_planes; ++i) {
- struct rcar_du_plane *plane = planes[i];
- struct drm_plane_state *state = plane->plane.state;
-- unsigned int index = to_rcar_du_plane_state(state)->hwindex;
-+ unsigned int index = to_rcar_plane_state(state)->hwindex;
-
- prio -= 4;
- dspr |= (index + 1) << prio;
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index 4012afacab5f..14d457047c40 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -221,7 +221,7 @@ static bool rcar_du_plane_needs_realloc(struct rcar_du_plane *plane,
- {
- const struct rcar_du_format_info *cur_format;
-
-- cur_format = to_rcar_du_plane_state(plane->plane.state)->format;
-+ cur_format = to_rcar_plane_state(plane->plane.state)->format;
-
- /* Lowering the number of planes doesn't strictly require reallocation
- * as the extra hardware plane will be freed when committing, but doing
-@@ -284,7 +284,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- continue;
-
- plane = to_rcar_plane(state->planes[i]);
-- plane_state = to_rcar_du_plane_state(state->plane_states[i]);
-+ plane_state = to_rcar_plane_state(state->plane_states[i]);
-
- /* If the plane is being disabled we don't need to go through
- * the full reallocation procedure. Just mark the hardware
-@@ -345,7 +345,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- if (group_freed_planes[index] & (1 << i))
- continue;
-
-- plane_state = to_rcar_du_plane_state(plane->plane.state);
-+ plane_state = to_rcar_plane_state(plane->plane.state);
- used_planes |= rcar_du_plane_hwmask(plane_state);
- }
-
-@@ -363,7 +363,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- continue;
-
- plane = to_rcar_plane(state->planes[i]);
-- plane_state = to_rcar_du_plane_state(state->plane_states[i]);
-+ plane_state = to_rcar_plane_state(state->plane_states[i]);
-
- /* Skip planes that are being disabled or don't need to be
- * reallocated.
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-index 99fefcaf6597..d3ed528fa56d 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-@@ -45,7 +45,7 @@ static void rcar_du_plane_write(struct rcar_du_group *rgrp,
- static void rcar_du_plane_setup_fb(struct rcar_du_plane *plane)
- {
- struct rcar_du_plane_state *state =
-- to_rcar_du_plane_state(plane->plane.state);
-+ to_rcar_plane_state(plane->plane.state);
- struct drm_framebuffer *fb = plane->plane.state->fb;
- struct rcar_du_group *rgrp = plane->group;
- unsigned int src_x = state->state.src_x >> 16;
-@@ -109,7 +109,7 @@ static void rcar_du_plane_setup_mode(struct rcar_du_plane *plane,
- unsigned int index)
- {
- struct rcar_du_plane_state *state =
-- to_rcar_du_plane_state(plane->plane.state);
-+ to_rcar_plane_state(plane->plane.state);
- struct rcar_du_group *rgrp = plane->group;
- u32 colorkey;
- u32 pnmr;
-@@ -172,7 +172,7 @@ static void __rcar_du_plane_setup(struct rcar_du_plane *plane,
- unsigned int index)
- {
- struct rcar_du_plane_state *state =
-- to_rcar_du_plane_state(plane->plane.state);
-+ to_rcar_plane_state(plane->plane.state);
- struct rcar_du_group *rgrp = plane->group;
- u32 ddcr2 = PnDDCR2_CODE;
- u32 ddcr4;
-@@ -222,7 +222,7 @@ static void __rcar_du_plane_setup(struct rcar_du_plane *plane,
- void rcar_du_plane_setup(struct rcar_du_plane *plane)
- {
- struct rcar_du_plane_state *state =
-- to_rcar_du_plane_state(plane->plane.state);
-+ to_rcar_plane_state(plane->plane.state);
-
- __rcar_du_plane_setup(plane, state->hwindex);
- if (state->format->planes == 2)
-@@ -234,7 +234,7 @@ void rcar_du_plane_setup(struct rcar_du_plane *plane)
- static int rcar_du_plane_atomic_check(struct drm_plane *plane,
- struct drm_plane_state *state)
- {
-- struct rcar_du_plane_state *rstate = to_rcar_du_plane_state(state);
-+ struct rcar_du_plane_state *rstate = to_rcar_plane_state(state);
- struct rcar_du_plane *rplane = to_rcar_plane(plane);
- struct rcar_du_device *rcdu = rplane->group->dev;
-
-@@ -302,7 +302,7 @@ rcar_du_plane_atomic_duplicate_state(struct drm_plane *plane)
- struct rcar_du_plane_state *state;
- struct rcar_du_plane_state *copy;
-
-- state = to_rcar_du_plane_state(plane->state);
-+ state = to_rcar_plane_state(plane->state);
- copy = kmemdup(state, sizeof(*state), GFP_KERNEL);
- if (copy == NULL)
- return NULL;
-@@ -319,7 +319,7 @@ static void rcar_du_plane_atomic_destroy_state(struct drm_plane *plane,
- if (state->fb)
- drm_framebuffer_unreference(state->fb);
-
-- kfree(to_rcar_du_plane_state(state));
-+ kfree(to_rcar_plane_state(state));
- }
-
- static int rcar_du_plane_atomic_set_property(struct drm_plane *plane,
-@@ -327,7 +327,7 @@ static int rcar_du_plane_atomic_set_property(struct drm_plane *plane,
- struct drm_property *property,
- uint64_t val)
- {
-- struct rcar_du_plane_state *rstate = to_rcar_du_plane_state(state);
-+ struct rcar_du_plane_state *rstate = to_rcar_plane_state(state);
- struct rcar_du_device *rcdu = to_rcar_plane(plane)->group->dev;
-
- if (property == rcdu->props.alpha)
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-index d1fb9b16a060..9732bff1911b 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
-@@ -59,7 +59,7 @@ struct rcar_du_plane_state {
- };
-
- static inline struct rcar_du_plane_state *
--to_rcar_du_plane_state(struct drm_plane_state *state)
-+to_rcar_plane_state(struct drm_plane_state *state)
- {
- return container_of(state, struct rcar_du_plane_state, state);
- }
---
-2.6.2
-
diff --git a/patches.renesas/0076-drm-rcar-du-Add-plane-allocation-debugging.patch b/patches.renesas/0076-drm-rcar-du-Add-plane-allocation-debugging.patch
deleted file mode 100644
index 227a43dc9a4822..00000000000000
--- a/patches.renesas/0076-drm-rcar-du-Add-plane-allocation-debugging.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From 0642eeb0dd859099755ca9f9dfd84569af211a6e Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Wed, 25 Feb 2015 22:31:52 +0200
-Subject: [PATCH 076/129] drm: rcar-du: Add plane allocation debugging
-
-Plane allocation is a complex process, add debugging statements to help
-finding out what could might wrong.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 08058611958bc161b1de991b494373b8bce56e6b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 38 ++++++++++++++++++++++++++++++++++-
- 1 file changed, 37 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index 14d457047c40..ade135008e98 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -286,11 +286,16 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- plane = to_rcar_plane(state->planes[i]);
- plane_state = to_rcar_plane_state(state->plane_states[i]);
-
-+ dev_dbg(rcdu->dev, "%s: checking plane (%u,%u)\n", __func__,
-+ plane->group->index, plane - plane->group->planes);
-+
- /* If the plane is being disabled we don't need to go through
- * the full reallocation procedure. Just mark the hardware
- * plane(s) as freed.
- */
- if (!plane_state->format) {
-+ dev_dbg(rcdu->dev, "%s: plane is being disabled\n",
-+ __func__);
- index = plane - plane->group->planes;
- group_freed_planes[plane->group->index] |= 1 << index;
- plane_state->hwindex = -1;
-@@ -301,6 +306,8 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- * mark the hardware plane(s) as free.
- */
- if (rcar_du_plane_needs_realloc(plane, plane_state)) {
-+ dev_dbg(rcdu->dev, "%s: plane needs reallocation\n",
-+ __func__);
- groups |= 1 << plane->group->index;
- needs_realloc = true;
-
-@@ -326,6 +333,9 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- struct rcar_du_group *group = &rcdu->groups[index];
- unsigned int used_planes = 0;
-
-+ dev_dbg(rcdu->dev, "%s: finding free planes for group %u\n",
-+ __func__, index);
-+
- for (i = 0; i < RCAR_DU_NUM_KMS_PLANES; ++i) {
- struct rcar_du_plane *plane = &group->planes[i];
- struct rcar_du_plane_state *plane_state;
-@@ -342,15 +352,31 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- * above. Use the local freed planes list to check for
- * that condition instead.
- */
-- if (group_freed_planes[index] & (1 << i))
-+ if (group_freed_planes[index] & (1 << i)) {
-+ dev_dbg(rcdu->dev,
-+ "%s: plane (%u,%u) has been freed, skipping\n",
-+ __func__, plane->group->index,
-+ plane - plane->group->planes);
- continue;
-+ }
-
- plane_state = to_rcar_plane_state(plane->plane.state);
- used_planes |= rcar_du_plane_hwmask(plane_state);
-+
-+ dev_dbg(rcdu->dev,
-+ "%s: plane (%u,%u) uses %u hwplanes (index %d)\n",
-+ __func__, plane->group->index,
-+ plane - plane->group->planes,
-+ plane_state->format ?
-+ plane_state->format->planes : 0,
-+ plane_state->hwindex);
- }
-
- group_free_planes[index] = 0xff & ~used_planes;
- groups &= ~(1 << index);
-+
-+ dev_dbg(rcdu->dev, "%s: group %u free planes mask 0x%02x\n",
-+ __func__, index, group_free_planes[index]);
- }
-
- /* Reallocate hardware planes for each plane that needs it. */
-@@ -365,6 +391,9 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- plane = to_rcar_plane(state->planes[i]);
- plane_state = to_rcar_plane_state(state->plane_states[i]);
-
-+ dev_dbg(rcdu->dev, "%s: allocating plane (%u,%u)\n", __func__,
-+ plane->group->index, plane - plane->group->planes);
-+
- /* Skip planes that are being disabled or don't need to be
- * reallocated.
- */
-@@ -380,10 +409,17 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- return idx;
- }
-
-+ dev_dbg(rcdu->dev, "%s: allocated %u hwplanes (index %u)\n",
-+ __func__, plane_state->format->planes, idx);
-+
- plane_state->hwindex = idx;
-
- group_free_planes[plane->group->index] &=
- ~rcar_du_plane_hwmask(plane_state);
-+
-+ dev_dbg(rcdu->dev, "%s: group %u free planes mask 0x%02x\n",
-+ __func__, plane->group->index,
-+ group_free_planes[plane->group->index]);
- }
-
- return 0;
---
-2.6.2
-
diff --git a/patches.renesas/0077-drm-rcar-du-Keep-plane-to-CRTC-associations-when-dis.patch b/patches.renesas/0077-drm-rcar-du-Keep-plane-to-CRTC-associations-when-dis.patch
deleted file mode 100644
index 68f2bdca6a6405..00000000000000
--- a/patches.renesas/0077-drm-rcar-du-Keep-plane-to-CRTC-associations-when-dis.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-From bf0a123e3cdd8f1cd6be7370e5ed4639a5de16ab Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Tue, 28 Apr 2015 18:01:45 +0300
-Subject: [PATCH 077/129] drm: rcar-du: Keep plane to CRTC associations when
- disabling a plane
-
-Changing the plane to CRTC associations requires restarting the CRTC
-group, creating visible flicker. Mitigate the issue by changing plane
-association only when a plane becomes enabled, not when it get disabled.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 2a57e9b5af2b96c45d8c73d34416e5dfa5dd38d9)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 48 +++++++++++++++++++--------------
- drivers/gpu/drm/rcar-du/rcar_du_group.c | 6 +++++
- drivers/gpu/drm/rcar-du/rcar_du_group.h | 4 ++-
- 3 files changed, 37 insertions(+), 21 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-index 15f8d145a133..620a2c51185c 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-@@ -208,9 +208,10 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc)
- {
- struct rcar_du_plane *planes[RCAR_DU_NUM_HW_PLANES];
- unsigned int num_planes = 0;
-+ unsigned int dptsr_planes;
-+ unsigned int hwplanes = 0;
- unsigned int prio = 0;
- unsigned int i;
-- u32 dptsr = 0;
- u32 dspr = 0;
-
- for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes); ++i) {
-@@ -238,37 +239,44 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc)
-
- prio -= 4;
- dspr |= (index + 1) << prio;
-- dptsr |= DPTSR_PnDK(index) | DPTSR_PnTS(index);
-+ hwplanes |= 1 << index;
-
- if (plane_format(plane)->planes == 2) {
- index = (index + 1) % 8;
-
- prio -= 4;
- dspr |= (index + 1) << prio;
-- dptsr |= DPTSR_PnDK(index) | DPTSR_PnTS(index);
-+ hwplanes |= 1 << index;
- }
- }
-
-- /* Select display timing and dot clock generator 2 for planes associated
-- * with superposition controller 2.
-+ /* Update the planes to display timing and dot clock generator
-+ * associations.
-+ *
-+ * Updating the DPTSR register requires restarting the CRTC group,
-+ * resulting in visible flicker. To mitigate the issue only update the
-+ * association if needed by enabled planes. Planes being disabled will
-+ * keep their current association.
-+ *
-+ * To mitigate the issue further we could pre-associate planes with
-+ * CRTCs, either with a fixed 4/4 split, or through a module parameter.
- */
-- if (rcrtc->index % 2) {
-- /* The DPTSR register is updated when the display controller is
-- * stopped. We thus need to restart the DU. Once again, sorry
-- * for the flicker. One way to mitigate the issue would be to
-- * pre-associate planes with CRTCs (either with a fixed 4/4
-- * split, or through a module parameter). Flicker would then
-- * occur only if we need to break the pre-association.
-- */
-- mutex_lock(&rcrtc->group->lock);
-- if (rcar_du_group_read(rcrtc->group, DPTSR) != dptsr) {
-- rcar_du_group_write(rcrtc->group, DPTSR, dptsr);
-- if (rcrtc->group->used_crtcs)
-- rcar_du_group_restart(rcrtc->group);
-- }
-- mutex_unlock(&rcrtc->group->lock);
-+ mutex_lock(&rcrtc->group->lock);
-+
-+ dptsr_planes = rcrtc->index % 2 ? rcrtc->group->dptsr_planes | hwplanes
-+ : rcrtc->group->dptsr_planes & ~hwplanes;
-+
-+ if (dptsr_planes != rcrtc->group->dptsr_planes) {
-+ rcar_du_group_write(rcrtc->group, DPTSR,
-+ (dptsr_planes << 16) | dptsr_planes);
-+ rcrtc->group->dptsr_planes = dptsr_planes;
-+
-+ if (rcrtc->group->used_crtcs)
-+ rcar_du_group_restart(rcrtc->group);
- }
-
-+ mutex_unlock(&rcrtc->group->lock);
-+
- rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR,
- dspr);
- }
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c
-index 1bdc0ee0c248..7fd39a7d91c8 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
-@@ -85,6 +85,12 @@ static void rcar_du_group_setup(struct rcar_du_group *rgrp)
- * superposition 0 to DU0 pins. DU1 pins will be configured dynamically.
- */
- rcar_du_group_write(rgrp, DORCR, DORCR_PG1D_DS1 | DORCR_DPRS);
-+
-+ /* Apply planes to CRTCs association. */
-+ mutex_lock(&rgrp->lock);
-+ rcar_du_group_write(rgrp, DPTSR, (rgrp->dptsr_planes << 16) |
-+ rgrp->dptsr_planes);
-+ mutex_unlock(&rgrp->lock);
- }
-
- /*
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.h b/drivers/gpu/drm/rcar-du/rcar_du_group.h
-index ea02bb02f3e1..4f6c37c8d336 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_group.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.h
-@@ -27,7 +27,8 @@ struct rcar_du_device;
- * @index: group index
- * @use_count: number of users of the group (rcar_du_group_(get|put))
- * @used_crtcs: number of CRTCs currently in use
-- * @lock: protects the DPTSR register
-+ * @lock: protects the dptsr_planes field and the DPTSR register
-+ * @dptsr_planes: bitmask of planes driven by dot-clock and timing generator 1
- * @planes: planes handled by the group
- */
- struct rcar_du_group {
-@@ -39,6 +40,7 @@ struct rcar_du_group {
- unsigned int used_crtcs;
-
- struct mutex lock;
-+ unsigned int dptsr_planes;
-
- struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES];
- };
---
-2.6.2
-
diff --git a/patches.renesas/0078-drm-rcar-du-Consider-plane-to-CRTC-associations-in-t.patch b/patches.renesas/0078-drm-rcar-du-Consider-plane-to-CRTC-associations-in-t.patch
deleted file mode 100644
index 4501a49c765bb2..00000000000000
--- a/patches.renesas/0078-drm-rcar-du-Consider-plane-to-CRTC-associations-in-t.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 8b00002acbadfefefbdd34ee947f6139168c5865 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Wed, 29 Apr 2015 00:51:01 +0300
-Subject: [PATCH 078/129] drm: rcar-du: Consider plane to CRTC associations in
- the plane allocator
-
-Hardware planes are driven by the timing generator of the CRTC they are
-associated to. Changing the association requires restarting the CRTC
-group that the plane belongs to, resulting in flicker on the other CRTC.
-
-To avoid flicker as much as possible, try to allocate planes first from
-the free planes already associated with the target CRTC. If allocation
-fails then fall back to allocation from all free planes.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit c8af99b60421c184cab1c3a849debce1463ec792)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 22 +++++++++++++++++++++-
- 1 file changed, 21 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index ade135008e98..2c6cf691d163 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -383,6 +383,8 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- for (i = 0; i < dev->mode_config.num_total_plane; ++i) {
- struct rcar_du_plane_state *plane_state;
- struct rcar_du_plane *plane;
-+ unsigned int crtc_planes;
-+ unsigned int free;
- int idx;
-
- if (!state->planes[i])
-@@ -401,8 +403,21 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- !rcar_du_plane_needs_realloc(plane, plane_state))
- continue;
-
-+ /* Try to allocate the plane from the free planes currently
-+ * associated with the target CRTC to avoid restarting the CRTC
-+ * group and thus minimize flicker. If it fails fall back to
-+ * allocating from all free planes.
-+ */
-+ crtc_planes = to_rcar_crtc(plane_state->state.crtc)->index % 2
-+ ? plane->group->dptsr_planes
-+ : ~plane->group->dptsr_planes;
-+ free = group_free_planes[plane->group->index];
-+
- idx = rcar_du_plane_hwalloc(plane_state->format->planes,
-- group_free_planes[plane->group->index]);
-+ free & crtc_planes);
-+ if (idx < 0)
-+ idx = rcar_du_plane_hwalloc(plane_state->format->planes,
-+ free);
- if (idx < 0) {
- dev_dbg(rcdu->dev, "%s: no available hardware plane\n",
- __func__);
-@@ -749,6 +764,11 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
- rgrp->mmio_offset = mmio_offsets[i];
- rgrp->index = i;
-
-+ /* Pre-associate all hardware planes with the first CRTC in the
-+ * group.
-+ */
-+ rgrp->dptsr_planes = 0;
-+
- ret = rcar_du_planes_init(rgrp);
- if (ret < 0)
- return ret;
---
-2.6.2
-
diff --git a/patches.renesas/0079-drm-rcar-du-Store-the-number-of-CRTCs-per-group-in-t.patch b/patches.renesas/0079-drm-rcar-du-Store-the-number-of-CRTCs-per-group-in-t.patch
deleted file mode 100644
index e50032e635995c..00000000000000
--- a/patches.renesas/0079-drm-rcar-du-Store-the-number-of-CRTCs-per-group-in-t.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From 689e9b987f979ec215f653189b013c26958b8d8f Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Tue, 28 Apr 2015 17:36:33 +0300
-Subject: [PATCH 079/129] drm: rcar-du: Store the number of CRTCs per group in
- the group structure
-
-The number of CRTCs in a group is only used to implement plane
-initialization for now, but is also needed to implement pre-association
-of planes to CRTCs. Store it in the group structure instead of computing
-it on demand.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit fe6fbe9a024e149e4230a338700d24db8806183a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_group.h | 2 ++
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 1 +
- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 6 ++----
- 3 files changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.h b/drivers/gpu/drm/rcar-du/rcar_du_group.h
-index 4f6c37c8d336..7b414b31c3be 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_group.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.h
-@@ -25,6 +25,7 @@ struct rcar_du_device;
- * @dev: the DU device
- * @mmio_offset: registers offset in the device memory map
- * @index: group index
-+ * @num_crtcs: number of CRTCs in this group (1 or 2)
- * @use_count: number of users of the group (rcar_du_group_(get|put))
- * @used_crtcs: number of CRTCs currently in use
- * @lock: protects the dptsr_planes field and the DPTSR register
-@@ -36,6 +37,7 @@ struct rcar_du_group {
- unsigned int mmio_offset;
- unsigned int index;
-
-+ unsigned int num_crtcs;
- unsigned int use_count;
- unsigned int used_crtcs;
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index 2c6cf691d163..fec5f4d794da 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -763,6 +763,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
- rgrp->dev = rcdu;
- rgrp->mmio_offset = mmio_offsets[i];
- rgrp->index = i;
-+ rgrp->num_crtcs = min(rcdu->num_crtcs - 2 * i, 2U);
-
- /* Pre-associate all hardware planes with the first CRTC in the
- * group.
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-index d3ed528fa56d..3e30d84b798f 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-@@ -391,7 +391,6 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
- {
- struct rcar_du_device *rcdu = rgrp->dev;
- unsigned int num_planes;
-- unsigned int num_crtcs;
- unsigned int crtcs;
- unsigned int i;
- int ret;
-@@ -399,13 +398,12 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
- /* Create one primary plane per CRTC in this group and seven overlay
- * planes.
- */
-- num_crtcs = min(rcdu->num_crtcs - 2 * rgrp->index, 2U);
-- num_planes = num_crtcs + 7;
-+ num_planes = rgrp->num_crtcs + 7;
-
- crtcs = ((1 << rcdu->num_crtcs) - 1) & (3 << (2 * rgrp->index));
-
- for (i = 0; i < num_planes; ++i) {
-- enum drm_plane_type type = i < num_crtcs
-+ enum drm_plane_type type = i < rgrp->num_crtcs
- ? DRM_PLANE_TYPE_PRIMARY
- : DRM_PLANE_TYPE_OVERLAY;
- struct rcar_du_plane *plane = &rgrp->planes[i];
---
-2.6.2
-
diff --git a/patches.renesas/0080-drm-rcar-du-Split-planes-pre-association-4-4-between.patch b/patches.renesas/0080-drm-rcar-du-Split-planes-pre-association-4-4-between.patch
deleted file mode 100644
index 2c6cc1403c8534..00000000000000
--- a/patches.renesas/0080-drm-rcar-du-Split-planes-pre-association-4-4-between.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 5912b3065d2d83038e616827e9ccafaa8ef6aa11 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Tue, 28 Apr 2015 22:00:28 +0300
-Subject: [PATCH 080/129] drm: rcar-du: Split planes pre-association 4/4
- between CRTCs
-
-If we have more than one CRTCs in a group pre-associate planes 0-3 with
-CRTC 0 and planes 4-7 with CRTC 1 to minimize flicker occurring when the
-association is changed. The pre-association could be controlled by a
-module parameter if needed.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 2610abfb3a72f6e5444a710b695c9460138f9326)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 3 ---
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 7 ++++---
- 2 files changed, 4 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-index 620a2c51185c..e6a32c4e4040 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-@@ -257,9 +257,6 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc)
- * resulting in visible flicker. To mitigate the issue only update the
- * association if needed by enabled planes. Planes being disabled will
- * keep their current association.
-- *
-- * To mitigate the issue further we could pre-associate planes with
-- * CRTCs, either with a fixed 4/4 split, or through a module parameter.
- */
- mutex_lock(&rcrtc->group->lock);
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index fec5f4d794da..20859aae882e 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -765,10 +765,11 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
- rgrp->index = i;
- rgrp->num_crtcs = min(rcdu->num_crtcs - 2 * i, 2U);
-
-- /* Pre-associate all hardware planes with the first CRTC in the
-- * group.
-+ /* If we have more than one CRTCs in this group pre-associate
-+ * planes 0-3 with CRTC 0 and planes 4-7 with CRTC 1 to minimize
-+ * flicker occurring when the association is changed.
- */
-- rgrp->dptsr_planes = 0;
-+ rgrp->dptsr_planes = rgrp->num_crtcs > 1 ? 0xf0 : 0;
-
- ret = rcar_du_planes_init(rgrp);
- if (ret < 0)
---
-2.6.2
-
diff --git a/patches.renesas/0081-drm-rcar-du-Print-the-error-value-when-DRM-KMS-init-.patch b/patches.renesas/0081-drm-rcar-du-Print-the-error-value-when-DRM-KMS-init-.patch
deleted file mode 100644
index 7eebecd3228d2d..00000000000000
--- a/patches.renesas/0081-drm-rcar-du-Print-the-error-value-when-DRM-KMS-init-.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 064eec7dca6ec505062cf6d47806fd83d50e65f2 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Thu, 14 May 2015 01:08:34 +0300
-Subject: [PATCH 081/129] drm: rcar-du: Print the error value when DRM/KMS init
- fails
-
-This helps debugging probe failures.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 6e0c6e1895b9fff3cdb6ef746ee3d8dd4e852f40)
-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 da1216a73969..780ca11512ba 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
-@@ -190,7 +190,7 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags)
- /* DRM/KMS objects */
- ret = rcar_du_modeset_init(rcdu);
- if (ret < 0) {
-- dev_err(&pdev->dev, "failed to initialize DRM/KMS\n");
-+ dev_err(&pdev->dev, "failed to initialize DRM/KMS (%d)\n", ret);
- goto done;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0082-drm-rcar-du-Disable-all-planes-when-stopping-the-CRT.patch b/patches.renesas/0082-drm-rcar-du-Disable-all-planes-when-stopping-the-CRT.patch
deleted file mode 100644
index 1f2cc2afe44795..00000000000000
--- a/patches.renesas/0082-drm-rcar-du-Disable-all-planes-when-stopping-the-CRT.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From cd7950e2150adfc5b861a4c56242a824ce45767c Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Thu, 14 May 2015 15:01:47 +0300
-Subject: [PATCH 082/129] drm: rcar-du: Disable all planes when stopping the
- CRTC
-
-The DSnPR plane configuration registers are updated on vblank, and no
-vblank will occur once the CRTC is stopped. We thus can't only disable
-planes right before starting the CRTC as it would start scanning out
-immediately from old frame buffers until the next vblank.
-
-Fix the problem by disabling all planes when stopping the CRTC and wait
-for the change to take effect. This increases the CRTC stop delay,
-especially when multiple CRTCs are stopped in one operation as we now
-wait for one vblank per CRTC. Whether this can be improved needs to be
-researched.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 911316fe2f4113a096b9975f2467fc501864aef0)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-index e6a32c4e4040..a40085806f5b 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-@@ -398,6 +398,19 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
- if (!rcrtc->started)
- return;
-
-+ /* Disable all planes and wait for the change to take effect. This is
-+ * required as the DSnPR registers are updated on vblank, and no vblank
-+ * will occur once the CRTC is stopped. Disabling planes when starting
-+ * the CRTC thus wouldn't be enough as it would start scanning out
-+ * immediately from old frame buffers until the next vblank.
-+ *
-+ * This increases the CRTC stop delay, especially when multiple CRTCs
-+ * are stopped in one operation as we now wait for one vblank per CRTC.
-+ * Whether this can be improved needs to be researched.
-+ */
-+ rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR, 0);
-+ drm_crtc_wait_one_vblank(crtc);
-+
- /* Disable vertical blanking interrupt reporting. We first need to wait
- * for page flip completion before stopping the CRTC as userspace
- * expects page flips to eventually complete.
---
-2.6.2
-
diff --git a/patches.renesas/0083-drm-rcar-du-Fix-crash-with-groups-that-have-less-tha.patch b/patches.renesas/0083-drm-rcar-du-Fix-crash-with-groups-that-have-less-tha.patch
deleted file mode 100644
index 362c9b543ecec2..00000000000000
--- a/patches.renesas/0083-drm-rcar-du-Fix-crash-with-groups-that-have-less-tha.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From c61ebc248be76006c8712894ce767fe679339dfd Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Mon, 25 May 2015 16:32:45 +0300
-Subject: [PATCH 083/129] drm: rcar-du: Fix crash with groups that have less
- than 9 planes
-
-Commit 917de180379d ("drm: rcar-du: Implement universal plane support")
-made the number of planes per group dynamic, but didn't update all loops
-over the planes array, resulting in out-of-bound accesses on DU
-instances that have an odd number of CRTCs (such as the R8A7790). Fix
-it.
-
-Fixes: 917de180379d ("drm: rcar-du: Implement universal plane support")
-Cc: stable@vger.kernel.org
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit d6aed57481c5b746f91792c8a977f537c09e52c5)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 4 ++--
- drivers/gpu/drm/rcar-du/rcar_du_group.h | 2 ++
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +-
- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 5 ++---
- 4 files changed, 7 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-index a40085806f5b..65d6ba6621ac 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
-@@ -214,7 +214,7 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc)
- unsigned int i;
- u32 dspr = 0;
-
-- for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes); ++i) {
-+ for (i = 0; i < rcrtc->group->num_planes; ++i) {
- struct rcar_du_plane *plane = &rcrtc->group->planes[i];
- unsigned int j;
-
-@@ -445,7 +445,7 @@ void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc)
- rcar_du_crtc_start(rcrtc);
-
- /* Commit the planes state. */
-- for (i = 0; i < ARRAY_SIZE(rcrtc->group->planes); ++i) {
-+ for (i = 0; i < rcrtc->group->num_planes; ++i) {
- struct rcar_du_plane *plane = &rcrtc->group->planes[i];
-
- if (plane->plane.state->crtc != &rcrtc->crtc)
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.h b/drivers/gpu/drm/rcar-du/rcar_du_group.h
-index 7b414b31c3be..d7318e1a6b00 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_group.h
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.h
-@@ -30,6 +30,7 @@ struct rcar_du_device;
- * @used_crtcs: number of CRTCs currently in use
- * @lock: protects the dptsr_planes field and the DPTSR register
- * @dptsr_planes: bitmask of planes driven by dot-clock and timing generator 1
-+ * @num_planes: number of planes in the group
- * @planes: planes handled by the group
- */
- struct rcar_du_group {
-@@ -44,6 +45,7 @@ struct rcar_du_group {
- struct mutex lock;
- unsigned int dptsr_planes;
-
-+ unsigned int num_planes;
- struct rcar_du_plane planes[RCAR_DU_NUM_KMS_PLANES];
- };
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index 20859aae882e..4bb5af4bc474 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -336,7 +336,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
- dev_dbg(rcdu->dev, "%s: finding free planes for group %u\n",
- __func__, index);
-
-- for (i = 0; i < RCAR_DU_NUM_KMS_PLANES; ++i) {
-+ for (i = 0; i < group->num_planes; ++i) {
- struct rcar_du_plane *plane = &group->planes[i];
- struct rcar_du_plane_state *plane_state;
- struct drm_plane_state *s;
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-index 3e30d84b798f..d90dc428e3fd 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-@@ -390,7 +390,6 @@ static const uint32_t formats[] = {
- int rcar_du_planes_init(struct rcar_du_group *rgrp)
- {
- struct rcar_du_device *rcdu = rgrp->dev;
-- unsigned int num_planes;
- unsigned int crtcs;
- unsigned int i;
- int ret;
-@@ -398,11 +397,11 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
- /* Create one primary plane per CRTC in this group and seven overlay
- * planes.
- */
-- num_planes = rgrp->num_crtcs + 7;
-+ rgrp->num_planes = rgrp->num_crtcs + 7;
-
- crtcs = ((1 << rcdu->num_crtcs) - 1) & (3 << (2 * rgrp->index));
-
-- for (i = 0; i < num_planes; ++i) {
-+ for (i = 0; i < rgrp->num_planes; ++i) {
- enum drm_plane_type type = i < rgrp->num_crtcs
- ? DRM_PLANE_TYPE_PRIMARY
- : DRM_PLANE_TYPE_OVERLAY;
---
-2.6.2
-
diff --git a/patches.renesas/0084-drm-rcar-du-Clarify-error-message-when-encoder-initi.patch b/patches.renesas/0084-drm-rcar-du-Clarify-error-message-when-encoder-initi.patch
deleted file mode 100644
index d7b8d0d0b383de..00000000000000
--- a/patches.renesas/0084-drm-rcar-du-Clarify-error-message-when-encoder-initi.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 71e6e1617b0fd2d934a92579fbee89881fbf38c6 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Tue, 26 May 2015 14:59:42 +0300
-Subject: [PATCH 084/129] drm: rcar-du: Clarify error message when encoder
- initialization fails
-
-A failure to initialize an encoder currently prints an error message in
-the kernel log without mentioning which encoder failed to initialize. To
-help debugging initialization issues print the encoder DT node name.
-
-This requires moving the error message to the rcar_du_encoders_init_one
-function and refactoring it slightly.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 64549cdf85a113270729aa123aa475cec7249a0f)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 7 +++++--
- 1 file changed, 5 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 4bb5af4bc474..ab29c179d854 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -639,6 +639,11 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
- of_node_put(encoder);
- of_node_put(connector);
-
-+ if (ret && ret != -EPROBE_DEFER)
-+ dev_warn(rcdu->dev,
-+ "failed to initialize encoder %s (%d), skipping\n",
-+ encoder->full_name, ret);
-+
- return ret < 0 ? ret : 1;
- }
-
-@@ -688,8 +693,6 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
- return ret;
- }
-
-- dev_info(rcdu->dev,
-- "encoder initialization failed, skipping\n");
- continue;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0085-drm-rcar-du-Convert-rcar_du_encoders_init_one-return.patch b/patches.renesas/0085-drm-rcar-du-Convert-rcar_du_encoders_init_one-return.patch
deleted file mode 100644
index 41ba3812fb48fb..00000000000000
--- a/patches.renesas/0085-drm-rcar-du-Convert-rcar_du_encoders_init_one-return.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From afafe34d25acdfd625ab9d22d597258f89786434 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Tue, 26 May 2015 15:07:56 +0300
-Subject: [PATCH 085/129] drm: rcar-du: Convert rcar_du_encoders_init_one()
- return value to 0/<0
-
-The function returns 1 on success, and either 0 or a negative error code
-on failure. As the 0 and negative values don't need to be differentiated
-by the caller, convert it to the usual scheme of returning 0 on success
-and a negative error code on failure.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-(cherry picked from commit 898a2f387d1c663772c630e8f78ef60f1639077e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index ab29c179d854..fa185a450aea 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -573,7 +573,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
- if (!entity) {
- dev_dbg(rcdu->dev, "unconnected endpoint %s, skipping\n",
- ep->local_node->full_name);
-- return 0;
-+ return -ENODEV;
- }
-
- entity_ep_node = of_parse_phandle(ep->local_node, "remote-endpoint", 0);
-@@ -596,7 +596,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
- encoder->full_name);
- of_node_put(entity_ep_node);
- of_node_put(encoder);
-- return 0;
-+ return -ENODEV;
- }
-
- break;
-@@ -625,7 +625,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
- encoder->full_name);
- of_node_put(encoder);
- of_node_put(connector);
-- return 0;
-+ return -EINVAL;
- }
- } else {
- /*
-@@ -644,7 +644,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
- "failed to initialize encoder %s (%d), skipping\n",
- encoder->full_name, ret);
-
-- return ret < 0 ? ret : 1;
-+ return ret;
- }
-
- static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
-@@ -696,7 +696,7 @@ static int rcar_du_encoders_init(struct rcar_du_device *rcdu)
- continue;
- }
-
-- num_encoders += ret;
-+ num_encoders++;
- }
-
- return num_encoders;
---
-2.6.2
-
diff --git a/patches.renesas/0086-drm-rcar-du-Clean-up-planes-in-the-error-paths-of-.a.patch b/patches.renesas/0086-drm-rcar-du-Clean-up-planes-in-the-error-paths-of-.a.patch
deleted file mode 100644
index a079b17313e217..00000000000000
--- a/patches.renesas/0086-drm-rcar-du-Clean-up-planes-in-the-error-paths-of-.a.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From f5a3bc87acb2c4178e7ee3a9511f525cb274e388 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Date: Wed, 27 May 2015 02:14:37 +0300
-Subject: [PATCH 086/129] drm: rcar-du: Clean up planes in the error paths of
- .atomic_commit()
-
-When the .atomic_commit() handler fails, clean up planes previoulsy
-prepared by drm_atomic_helper_prepare_planes() with a call to
-drm_atomic_helper_cleanup_planes().
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-(cherry picked from commit 39a3d5706527615db2b7d121b64445e79ca1cc1f)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 12 +++++++++---
- 1 file changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-index fa185a450aea..56518eb1269a 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
-@@ -495,8 +495,10 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
-
- /* Allocate the commit object. */
- commit = kzalloc(sizeof(*commit), GFP_KERNEL);
-- if (commit == NULL)
-- return -ENOMEM;
-+ if (commit == NULL) {
-+ ret = -ENOMEM;
-+ goto error;
-+ }
-
- INIT_WORK(&commit->work, rcar_du_atomic_work);
- commit->dev = dev;
-@@ -519,7 +521,7 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
-
- if (ret) {
- kfree(commit);
-- return ret;
-+ goto error;
- }
-
- /* Swap the state, this is the point of no return. */
-@@ -531,6 +533,10 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
- rcar_du_atomic_complete(commit);
-
- return 0;
-+
-+error:
-+ drm_atomic_helper_cleanup_planes(dev, state);
-+ return ret;
- }
-
- /* -----------------------------------------------------------------------------
---
-2.6.2
-
diff --git a/patches.renesas/0087-drm-rcar-du-Use-the-drm-atomic-state-duplication-hel.patch b/patches.renesas/0087-drm-rcar-du-Use-the-drm-atomic-state-duplication-hel.patch
deleted file mode 100644
index b2f3133123c5df..00000000000000
--- a/patches.renesas/0087-drm-rcar-du-Use-the-drm-atomic-state-duplication-hel.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 1508e9935d880b7bd1304db10453f871821fd80a Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Date: Wed, 27 May 2015 16:36:29 +0300
-Subject: [PATCH 087/129] drm: rcar-du: Use the drm atomic state duplication
- helpers for planes
-
-Ensure that the duplicate and destroy plane state operations will always
-be in sync with the DRM core implementation of the plane state by using
-the __drm_atomic_helper_plane_duplicate_state() and
-__drm_atomic_helper_plane_destroy_state() functions designed especially
-for this purpose.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-(cherry picked from commit 263b39fe33d69da74ae61e594c94eddf75203f7d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-index d90dc428e3fd..c66986414bb4 100644
---- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
-@@ -302,13 +302,15 @@ rcar_du_plane_atomic_duplicate_state(struct drm_plane *plane)
- struct rcar_du_plane_state *state;
- struct rcar_du_plane_state *copy;
-
-+ if (WARN_ON(!plane->state))
-+ return NULL;
-+
- state = to_rcar_plane_state(plane->state);
- copy = kmemdup(state, sizeof(*state), GFP_KERNEL);
- if (copy == NULL)
- return NULL;
-
-- if (copy->state.fb)
-- drm_framebuffer_reference(copy->state.fb);
-+ __drm_atomic_helper_plane_duplicate_state(plane, &copy->state);
-
- return &copy->state;
- }
-@@ -316,9 +318,7 @@ rcar_du_plane_atomic_duplicate_state(struct drm_plane *plane)
- static void rcar_du_plane_atomic_destroy_state(struct drm_plane *plane,
- struct drm_plane_state *state)
- {
-- if (state->fb)
-- drm_framebuffer_unreference(state->fb);
--
-+ __drm_atomic_helper_plane_destroy_state(plane, state);
- kfree(to_rcar_plane_state(state));
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0088-i2c-add-FUNC-flag-for-slave-capabilities.patch b/patches.renesas/0088-i2c-add-FUNC-flag-for-slave-capabilities.patch
deleted file mode 100644
index 291df9a9dc39aa..00000000000000
--- a/patches.renesas/0088-i2c-add-FUNC-flag-for-slave-capabilities.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 96f636817fdfeedcf74a978e276dca5150636cbf Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Thu, 14 May 2015 14:40:02 +0200
-Subject: [PATCH 088/129] i2c: add FUNC flag for slave capabilities
-
-So users can check in advance if there is slave support.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit 83caf9896a48de5f838227162c25de405c61ea9d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- include/uapi/linux/i2c.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/include/uapi/linux/i2c.h b/include/uapi/linux/i2c.h
-index 0e949cbfd333..b0a7dd61eb35 100644
---- a/include/uapi/linux/i2c.h
-+++ b/include/uapi/linux/i2c.h
-@@ -87,6 +87,7 @@ struct i2c_msg {
- #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */
- #define I2C_FUNC_SMBUS_PEC 0x00000008
- #define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */
-+#define I2C_FUNC_SLAVE 0x00000020
- #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
- #define I2C_FUNC_SMBUS_QUICK 0x00010000
- #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
---
-2.6.2
-
diff --git a/patches.renesas/0089-i2c-constify-platform_device_id.patch b/patches.renesas/0089-i2c-constify-platform_device_id.patch
deleted file mode 100644
index ac3bfb310042e7..00000000000000
--- a/patches.renesas/0089-i2c-constify-platform_device_id.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From c6fa94db3edf9e716a0898399b98ac9592bd0be2 Mon Sep 17 00:00:00 2001
-From: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
-Date: Sat, 2 May 2015 00:54:25 +0900
-Subject: [PATCH 089/129] i2c: constify platform_device_id
-
-The platform_device_id is not modified by these drivers and core uses it
-as const.
-
-Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit e9a02a3d89b9d16eafc540d1dc78476a3bb5d4eb)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/i2c/busses/i2c-imx.c | 2 +-
- drivers/i2c/busses/i2c-mxs.c | 2 +-
- drivers/i2c/busses/i2c-rcar.c | 2 +-
- drivers/i2c/busses/i2c-s3c2410.c | 2 +-
- 4 files changed, 4 insertions(+), 4 deletions(-)
-
---- a/drivers/i2c/busses/i2c-imx.c
-+++ b/drivers/i2c/busses/i2c-imx.c
-@@ -241,7 +241,7 @@ static struct imx_i2c_hwdata vf610_i2c_h
-
- };
-
--static struct platform_device_id imx_i2c_devtype[] = {
-+static const struct platform_device_id imx_i2c_devtype[] = {
- {
- .name = "imx1-i2c",
- .driver_data = (kernel_ulong_t)&imx1_i2c_hwdata,
---- a/drivers/i2c/busses/i2c-mxs.c
-+++ b/drivers/i2c/busses/i2c-mxs.c
-@@ -784,7 +784,7 @@ static int mxs_i2c_get_ofdata(struct mxs
- return 0;
- }
-
--static struct platform_device_id mxs_i2c_devtype[] = {
-+static const struct platform_device_id mxs_i2c_devtype[] = {
- {
- .name = "imx23-i2c",
- .driver_data = MXS_I2C_V1,
---- a/drivers/i2c/busses/i2c-rcar.c
-+++ b/drivers/i2c/busses/i2c-rcar.c
-@@ -714,7 +714,7 @@ static int rcar_i2c_remove(struct platfo
- return 0;
- }
-
--static struct platform_device_id rcar_i2c_id_table[] = {
-+static const struct platform_device_id rcar_i2c_id_table[] = {
- { "i2c-rcar", I2C_RCAR_GEN1 },
- { "i2c-rcar_gen1", I2C_RCAR_GEN1 },
- { "i2c-rcar_gen2", I2C_RCAR_GEN2 },
---- a/drivers/i2c/busses/i2c-s3c2410.c
-+++ b/drivers/i2c/busses/i2c-s3c2410.c
-@@ -132,7 +132,7 @@ struct s3c24xx_i2c {
- unsigned int sys_i2c_cfg;
- };
-
--static struct platform_device_id s3c24xx_driver_ids[] = {
-+static const struct platform_device_id s3c24xx_driver_ids[] = {
- {
- .name = "s3c2410-i2c",
- .driver_data = 0,
diff --git a/patches.renesas/0090-i2c-rcar-report-slave-capabilities-to-users.patch b/patches.renesas/0090-i2c-rcar-report-slave-capabilities-to-users.patch
deleted file mode 100644
index cb51d8342abfaa..00000000000000
--- a/patches.renesas/0090-i2c-rcar-report-slave-capabilities-to-users.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 0fd4992443271d994525fcc6a143b6d404a181b9 Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Thu, 14 May 2015 14:40:03 +0200
-Subject: [PATCH 090/129] i2c: rcar: report slave capabilities to users
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit 1fb2ad9565be7149cf50d663f47f489a9fcda42d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/i2c/busses/i2c-rcar.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
-index 06f34d1c5121..9eef46254369 100644
---- a/drivers/i2c/busses/i2c-rcar.c
-+++ b/drivers/i2c/busses/i2c-rcar.c
-@@ -604,7 +604,8 @@ static int rcar_unreg_slave(struct i2c_client *slave)
- static u32 rcar_i2c_func(struct i2c_adapter *adap)
- {
- /* This HW can't do SMBUS_QUICK and NOSTART */
-- return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
-+ return I2C_FUNC_I2C | I2C_FUNC_SLAVE |
-+ (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
- }
-
- static const struct i2c_algorithm rcar_i2c_algo = {
---
-2.6.2
-
diff --git a/patches.renesas/0091-i2c-rcar-use-adapter-default-for-timeout.patch b/patches.renesas/0091-i2c-rcar-use-adapter-default-for-timeout.patch
deleted file mode 100644
index 296f06d6a730b8..00000000000000
--- a/patches.renesas/0091-i2c-rcar-use-adapter-default-for-timeout.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 0ff40493ee2e448b8494759c73ab73b3eaac7118 Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Sat, 20 Jun 2015 21:03:19 +0200
-Subject: [PATCH 091/129] i2c: rcar: use adapter default for timeout
-
-5 seconds is a very large timeout, and it is hardcoded. Use the default
-timeout from 'struct adapter' which is 1 second. It can also be modified
-from userspace for specific workloads via i2c-dev.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit efd2c6118e49152bea891706432ac3c9579836fe)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/i2c/busses/i2c-rcar.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
-index 9eef46254369..e57e520b4756 100644
---- a/drivers/i2c/busses/i2c-rcar.c
-+++ b/drivers/i2c/busses/i2c-rcar.c
-@@ -532,7 +532,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap,
-
- timeout = wait_event_timeout(priv->wait,
- rcar_i2c_flags_has(priv, ID_DONE),
-- 5 * HZ);
-+ adap->timeout);
- if (!timeout) {
- ret = -ETIMEDOUT;
- break;
---
-2.6.2
-
diff --git a/patches.renesas/0092-i2c-rcar-use-proper-type-for-timeout.patch b/patches.renesas/0092-i2c-rcar-use-proper-type-for-timeout.patch
deleted file mode 100644
index 3125c1b46cbc2a..00000000000000
--- a/patches.renesas/0092-i2c-rcar-use-proper-type-for-timeout.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 0bc42645d914210c386a55724bc59d3be4453ad1 Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Sat, 20 Jun 2015 21:03:20 +0200
-Subject: [PATCH 092/129] i2c: rcar: use proper type for timeout
-
-wait_event_timeout returns long, not int.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit b6763d0da5c16ea8770252c36ba2afca76aaedbd)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/i2c/busses/i2c-rcar.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
-index e57e520b4756..d8361dada584 100644
---- a/drivers/i2c/busses/i2c-rcar.c
-+++ b/drivers/i2c/busses/i2c-rcar.c
-@@ -490,7 +490,8 @@ 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;
-+ int i, ret;
-+ long timeout;
-
- pm_runtime_get_sync(dev);
-
---
-2.6.2
-
diff --git a/patches.renesas/0093-media-rcar-vin-use-monotonic-timestamps.patch b/patches.renesas/0093-media-rcar-vin-use-monotonic-timestamps.patch
deleted file mode 100644
index 3fd94c1909f92f..00000000000000
--- a/patches.renesas/0093-media-rcar-vin-use-monotonic-timestamps.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 7660575f41c5298a23c5062fa45ed7cf8f85416f Mon Sep 17 00:00:00 2001
-From: Hans Verkuil <hverkuil@xs4all.nl>
-Date: Thu, 7 May 2015 03:26:21 -0300
-Subject: [PATCH 093/129] [media] rcar-vin: use monotonic timestamps
-
-Even though the rcar-vin driver tells userspace that it will give a monotonic
-timestamp, it is actually using gettimeofday. Replace this with a proper
-monotonic timestamp.
-
-Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit b9143e5ac5089561e857e223f7750b85a1951547)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/soc_camera/rcar_vin.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
-index 6460f8e1b07f..918390b5a08a 100644
---- a/drivers/media/platform/soc_camera/rcar_vin.c
-+++ b/drivers/media/platform/soc_camera/rcar_vin.c
-@@ -899,7 +899,7 @@ static irqreturn_t rcar_vin_irq(int irq, void *data)
-
- priv->queue_buf[slot]->v4l2_buf.field = priv->field;
- priv->queue_buf[slot]->v4l2_buf.sequence = priv->sequence++;
-- do_gettimeofday(&priv->queue_buf[slot]->v4l2_buf.timestamp);
-+ v4l2_get_timestamp(&priv->queue_buf[slot]->v4l2_buf.timestamp);
- vb2_buffer_done(priv->queue_buf[slot], VB2_BUF_STATE_DONE);
- priv->queue_buf[slot] = NULL;
-
---
-2.6.2
-
diff --git a/patches.renesas/0094-sh-pfc-fix-sparse-GPIOs-for-R-Car-SoCs.patch b/patches.renesas/0094-sh-pfc-fix-sparse-GPIOs-for-R-Car-SoCs.patch
deleted file mode 100644
index 40c7c510508427..00000000000000
--- a/patches.renesas/0094-sh-pfc-fix-sparse-GPIOs-for-R-Car-SoCs.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 691ecc059b9774036fbcfd00faf3c9581c08f5ce Mon Sep 17 00:00:00 2001
-From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Date: Fri, 26 Jun 2015 01:40:56 +0300
-Subject: [PATCH 094/129] sh-pfc: fix sparse GPIOs for R-Car SoCs
-
-The PFC driver causes the kernel to hang on the R-Car gen2 SoC based boards
-when the CPU_ALL_PORT() macro is fixed to reflect the reality, i.e. when the
-GPIO space becomes actually sparse. This happens because the _GP_GPIO() macro
-includes an indexed initializer which causes the "holes" (array entries filled
-with all 0s) between the groups of the existing GPIOs; and the driver can't
-cope with that. There seems to be no reason to use the indexed initializer,
-so we can remove the index specifier and so avoid the "holes".
-
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 61bb3aef92a4d102382f399eafccd5c72be6fdf2)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/sh_pfc.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
-index c7508d5f6886..0874cfee6889 100644
---- a/drivers/pinctrl/sh-pfc/sh_pfc.h
-+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
-@@ -224,7 +224,7 @@ struct sh_pfc_soc_info {
-
- /* PINMUX_GPIO_GP_ALL - Expand to a list of sh_pfc_pin entries */
- #define _GP_GPIO(bank, _pin, _name, sfx) \
-- [(bank * 32) + _pin] = { \
-+ { \
- .pin = (bank * 32) + _pin, \
- .name = __stringify(_name), \
- .enum_id = _name##_DATA, \
---
-2.6.2
-
diff --git a/patches.renesas/0095-ASoC-soc-pcm-DPCM-cares-BE-format.patch b/patches.renesas/0095-ASoC-soc-pcm-DPCM-cares-BE-format.patch
deleted file mode 100644
index 35b48c6b861396..00000000000000
--- a/patches.renesas/0095-ASoC-soc-pcm-DPCM-cares-BE-format.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-From a6baf853cb512141ca208c9368baf2fd330f49a5 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 12 May 2015 02:03:33 +0000
-Subject: [PATCH 095/129] ASoC: soc-pcm: DPCM cares BE format
-
-Current DPCM is caring only FE format. but it will be no sound
-if FE/BE was below style, and user selects S24_LE format.
-
- FE: S16_LE/S24_LE
- BE: S16_LE
-
-DPCM can rewrite the format, so basically we don't want to
-constrain with the BE constraints. But sometimes it will be trouble.
-This patch adds new .dpcm_merged_format on struct snd_soc_dai_link.
-DPCM will use FE / BE merged format if .struct snd_soc_dai_link
-has it. We can have other .dpcm_merged_xxx in the future
-
- .dpcm_merged_foramt
- .dpcm_merged_rate
- .dpcm_merged_chan
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit b073ed4e21268da59c40a4fc5d56e3af808ecc4d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- include/sound/soc.h | 3 +++
- sound/soc/soc-pcm.c | 47 ++++++++++++++++++++++++++++++++++++++++++-----
- 2 files changed, 45 insertions(+), 5 deletions(-)
-
---- a/include/sound/soc.h
-+++ b/include/sound/soc.h
-@@ -984,6 +984,9 @@ struct snd_soc_dai_link {
- unsigned int dpcm_capture:1;
- unsigned int dpcm_playback:1;
-
-+ /* DPCM used FE & BE merged format */
-+ unsigned int dpcm_merged_format:1;
-+
- /* pmdown_time is ignored at stop */
- unsigned int ignore_pmdown_time:1;
-
---- a/sound/soc/soc-pcm.c
-+++ b/sound/soc/soc-pcm.c
-@@ -1485,30 +1485,67 @@ unwind:
- }
-
- static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime,
-- struct snd_soc_pcm_stream *stream)
-+ struct snd_soc_pcm_stream *stream,
-+ u64 formats)
- {
- runtime->hw.rate_min = stream->rate_min;
- runtime->hw.rate_max = stream->rate_max;
- runtime->hw.channels_min = stream->channels_min;
- runtime->hw.channels_max = stream->channels_max;
- if (runtime->hw.formats)
-- runtime->hw.formats &= stream->formats;
-+ runtime->hw.formats &= formats & stream->formats;
- else
-- runtime->hw.formats = stream->formats;
-+ runtime->hw.formats = formats & stream->formats;
- runtime->hw.rates = stream->rates;
- }
-
-+static u64 dpcm_runtime_base_format(struct snd_pcm_substream *substream)
-+{
-+ struct snd_soc_pcm_runtime *fe = substream->private_data;
-+ struct snd_soc_dpcm *dpcm;
-+ u64 formats = ULLONG_MAX;
-+ int stream = substream->stream;
-+
-+ if (!fe->dai_link->dpcm_merged_format)
-+ return formats;
-+
-+ /*
-+ * It returns merged BE codec format
-+ * if FE want to use it (= dpcm_merged_format)
-+ */
-+
-+ list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) {
-+ struct snd_soc_pcm_runtime *be = dpcm->be;
-+ struct snd_soc_dai_driver *codec_dai_drv;
-+ struct snd_soc_pcm_stream *codec_stream;
-+ int i;
-+
-+ for (i = 0; i < be->num_codecs; i++) {
-+ codec_dai_drv = be->codec_dais[i]->driver;
-+ if (stream == SNDRV_PCM_STREAM_PLAYBACK)
-+ codec_stream = &codec_dai_drv->playback;
-+ else
-+ codec_stream = &codec_dai_drv->capture;
-+
-+ formats &= codec_stream->formats;
-+ }
-+ }
-+
-+ return formats;
-+}
-+
- static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream)
- {
- struct snd_pcm_runtime *runtime = substream->runtime;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct snd_soc_dai_driver *cpu_dai_drv = cpu_dai->driver;
-+ u64 format = dpcm_runtime_base_format(substream);
-
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-- dpcm_init_runtime_hw(runtime, &cpu_dai_drv->playback);
-+ dpcm_init_runtime_hw(runtime, &cpu_dai_drv->playback, format);
- else
-- dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture);
-+ dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture, format);
- }
-
- static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd);
diff --git a/patches.renesas/0096-ASoC-rsnd-add-rsnd_dai_to_priv-macro.patch b/patches.renesas/0096-ASoC-rsnd-add-rsnd_dai_to_priv-macro.patch
deleted file mode 100644
index 9a442c2440c00b..00000000000000
--- a/patches.renesas/0096-ASoC-rsnd-add-rsnd_dai_to_priv-macro.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 7132d8339224503272ef9e96e335eed0c5d3bddc Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Fri, 10 Apr 2015 08:49:25 +0000
-Subject: [PATCH 096/129] ASoC: rsnd: add rsnd_dai_to_priv() macro
-
-Using standardized function/macro name is useful in driver
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit eb2535f542b4279b42518d6a312c6f7290434e55)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 9f48d75fa992..a2a0b5768c44 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -272,9 +272,10 @@ struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id)
- return priv->rdai + id;
- }
-
-+#define rsnd_dai_to_priv(dai) snd_soc_dai_get_drvdata(dai)
- static struct rsnd_dai *rsnd_dai_to_rdai(struct snd_soc_dai *dai)
- {
-- struct rsnd_priv *priv = snd_soc_dai_get_drvdata(dai);
-+ struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
-
- return rsnd_rdai_get(priv, dai->id);
- }
-@@ -351,7 +352,7 @@ struct rsnd_dai_stream *rsnd_rdai_to_io(struct rsnd_dai *rdai,
- static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
- struct snd_soc_dai *dai)
- {
-- struct rsnd_priv *priv = snd_soc_dai_get_drvdata(dai);
-+ struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
- struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
- struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
- int ssi_id = rsnd_mod_id(rsnd_io_to_mod_ssi(io));
---
-2.6.2
-
diff --git a/patches.renesas/0097-ASoC-rsnd-make-sure-it-uses-lock-when-it-calls-rsnd_.patch b/patches.renesas/0097-ASoC-rsnd-make-sure-it-uses-lock-when-it-calls-rsnd_.patch
deleted file mode 100644
index fd6d8ef2522160..00000000000000
--- a/patches.renesas/0097-ASoC-rsnd-make-sure-it-uses-lock-when-it-calls-rsnd_.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-From e80b87910f081ba59cc3954db2675c65f6d85cac Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Fri, 10 Apr 2015 08:49:49 +0000
-Subject: [PATCH 097/129] ASoC: rsnd: make sure it uses lock when it calls
- rsnd_dai_call
-
-rsnd_dai_call() should be called under rsnd_lock
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit e9c390df671fadc829550935ffb6b23549f26ded)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 27 ++++++++++++++++++++++-----
- 1 file changed, 22 insertions(+), 5 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index a2a0b5768c44..164653c0bc10 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -731,10 +731,15 @@ static int rsnd_hw_params(struct snd_pcm_substream *substream,
- {
- struct snd_soc_dai *dai = rsnd_substream_to_dai(substream);
- struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
-+ struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
- struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
-+ unsigned long flags;
- int ret;
-
-+ rsnd_lock(priv, flags);
- ret = rsnd_dai_call(hw_params, io, substream, hw_params);
-+ rsnd_unlock(priv, flags);
-+
- if (ret)
- return ret;
-
-@@ -919,14 +924,16 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod,
- static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd)
- {
- struct snd_soc_dai *dai = rtd->cpu_dai;
-+ struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
- struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
-- int ret;
-+ unsigned long flags;
-+ int ret = 0;
-
-- ret = rsnd_dai_call(pcm_new, &rdai->playback, rtd);
-- if (ret)
-- return ret;
-+ rsnd_lock(priv, flags);
-+ ret |= rsnd_dai_call(pcm_new, &rdai->playback, rtd);
-+ ret |= rsnd_dai_call(pcm_new, &rdai->capture, rtd);
-+ rsnd_unlock(priv, flags);
-
-- ret = rsnd_dai_call(pcm_new, &rdai->capture, rtd);
- if (ret)
- return ret;
-
-@@ -949,8 +956,11 @@ static const struct snd_soc_component_driver rsnd_soc_component = {
- static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
- struct rsnd_dai_stream *io)
- {
-+ unsigned long flags;
- int ret;
-
-+ rsnd_lock(priv, flags);
-+
- ret = rsnd_dai_call(probe, io, priv);
- if (ret == -EAGAIN) {
- /*
-@@ -983,6 +993,7 @@ static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
- */
- ret = rsnd_dai_call(probe, io, priv);
- }
-+ rsnd_unlock(priv, flags);
-
- return ret;
- }
-@@ -998,6 +1009,7 @@ static int rsnd_probe(struct platform_device *pdev)
- struct rsnd_dai *rdai;
- const struct of_device_id *of_id = of_match_device(rsnd_of_match, dev);
- const struct rsnd_of_data *of_data;
-+ unsigned long flags;
- int (*probe_func[])(struct platform_device *pdev,
- const struct rsnd_of_data *of_data,
- struct rsnd_priv *priv) = {
-@@ -1084,10 +1096,12 @@ static int rsnd_probe(struct platform_device *pdev)
- exit_snd_soc:
- snd_soc_unregister_platform(dev);
- exit_snd_probe:
-+ rsnd_lock(priv, flags);
- for_each_rsnd_dai(rdai, priv, i) {
- rsnd_dai_call(remove, &rdai->playback, priv);
- rsnd_dai_call(remove, &rdai->capture, priv);
- }
-+ rsnd_unlock(priv, flags);
-
- return ret;
- }
-@@ -1096,6 +1110,7 @@ static int rsnd_remove(struct platform_device *pdev)
- {
- struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev);
- struct rsnd_dai *rdai;
-+ unsigned long flags;
- void (*remove_func[])(struct platform_device *pdev,
- struct rsnd_priv *priv) = {
- rsnd_ssi_remove,
-@@ -1106,10 +1121,12 @@ static int rsnd_remove(struct platform_device *pdev)
-
- pm_runtime_disable(&pdev->dev);
-
-+ rsnd_lock(priv, flags);
- for_each_rsnd_dai(rdai, priv, i) {
- ret |= rsnd_dai_call(remove, &rdai->playback, priv);
- ret |= rsnd_dai_call(remove, &rdai->capture, priv);
- }
-+ rsnd_unlock(priv, flags);
-
- for (i = 0; i < ARRAY_SIZE(remove_func); i++)
- remove_func[i](pdev, priv);
---
-2.6.2
-
diff --git a/patches.renesas/0098-ASoC-rsnd-tidyup-SSI-parent-related-function-macro-n.patch b/patches.renesas/0098-ASoC-rsnd-tidyup-SSI-parent-related-function-macro-n.patch
deleted file mode 100644
index be404d01d9d5aa..00000000000000
--- a/patches.renesas/0098-ASoC-rsnd-tidyup-SSI-parent-related-function-macro-n.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From 0625166c1d275001f450dc67cccc9b91c2940f78 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Fri, 10 Apr 2015 08:50:12 +0000
-Subject: [PATCH 098/129] ASoC: rsnd: tidyup SSI parent related function/macro
- names
-
-Current rsnd driver is using SSI parent related function/macro as
-"clock" related. but it is not only clock related.
-tidyup function/macro naming.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 8c5c79a1cd51ce1b4fec8bbaecd17d599478bd27)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/ssi.c | 18 +++++++++++-------
- 1 file changed, 11 insertions(+), 7 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 7bb9c087f3dc..2ef48a44c4ab 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -80,7 +80,7 @@ struct rsnd_ssi {
- #define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod)
- #define rsnd_dma_to_ssi(dma) rsnd_mod_to_ssi(rsnd_dma_to_mod(dma))
- #define rsnd_ssi_pio_available(ssi) ((ssi)->info->irq > 0)
--#define rsnd_ssi_clk_from_parent(ssi) ((ssi)->parent)
-+#define rsnd_ssi_parent(ssi) ((ssi)->parent)
- #define rsnd_ssi_mode_flags(p) ((p)->info->flags)
- #define rsnd_ssi_dai_id(ssi) ((ssi)->info->dai_id)
- #define rsnd_ssi_of_node(priv) \
-@@ -189,8 +189,10 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
- rsnd_mod_hw_start(&ssi->mod);
-
- if (rsnd_rdai_is_clk_master(rdai)) {
-- if (rsnd_ssi_clk_from_parent(ssi))
-- rsnd_ssi_hw_start(ssi->parent, io);
-+ struct rsnd_ssi *ssi_parent = rsnd_ssi_parent(ssi);
-+
-+ if (ssi_parent)
-+ rsnd_ssi_hw_start(ssi_parent, io);
- else
- rsnd_ssi_master_clk_start(ssi, io);
- }
-@@ -253,8 +255,10 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi)
- rsnd_ssi_status_check(&ssi->mod, IIRQ);
-
- if (rsnd_rdai_is_clk_master(rdai)) {
-- if (rsnd_ssi_clk_from_parent(ssi))
-- rsnd_ssi_hw_stop(ssi->parent);
-+ struct rsnd_ssi *ssi_parent = rsnd_ssi_parent(ssi);
-+
-+ if (ssi_parent)
-+ rsnd_ssi_hw_stop(ssi_parent);
- else
- rsnd_ssi_master_clk_stop(ssi);
- }
-@@ -598,7 +602,7 @@ int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod)
- return !!(rsnd_ssi_mode_flags(ssi) & RSND_SSI_CLK_PIN_SHARE);
- }
-
--static void rsnd_ssi_parent_clk_setup(struct rsnd_priv *priv, struct rsnd_ssi *ssi)
-+static void rsnd_ssi_parent_setup(struct rsnd_priv *priv, struct rsnd_ssi *ssi)
- {
- if (!rsnd_ssi_is_pin_sharing(&ssi->mod))
- return;
-@@ -732,7 +736,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,
- if (ret)
- return ret;
-
-- rsnd_ssi_parent_clk_setup(priv, ssi);
-+ rsnd_ssi_parent_setup(priv, ssi);
- }
-
- return 0;
---
-2.6.2
-
diff --git a/patches.renesas/0099-ASoC-rsnd-make-sure-SSI-parent-child-uses-same-numbe.patch b/patches.renesas/0099-ASoC-rsnd-make-sure-SSI-parent-child-uses-same-numbe.patch
deleted file mode 100644
index 74efaaa00279d3..00000000000000
--- a/patches.renesas/0099-ASoC-rsnd-make-sure-SSI-parent-child-uses-same-numbe.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From bfe8aecc9388f82d1e70c5384582c7fbbf60d92b Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Fri, 10 Apr 2015 08:50:30 +0000
-Subject: [PATCH 099/129] ASoC: rsnd: make sure SSI parent/child uses same
- number of sound channel.
-
-SSI parent/child need to use same number of sound data channel
-if these are sharing clock/ws pin. this patch makes it sure.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 919567d914b3c134e60c01db72a03a0adc5f41b9)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/ssi.c | 34 ++++++++++++++++++++++++++++++++++
- 1 file changed, 34 insertions(+)
-
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 2ef48a44c4ab..5b89723c3206 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -66,6 +66,7 @@ struct rsnd_ssi {
-
- u32 cr_own;
- u32 cr_clk;
-+ int chan;
- int err;
- unsigned int usrcnt;
- };
-@@ -264,6 +265,8 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi)
- }
-
- rsnd_mod_hw_stop(&ssi->mod);
-+
-+ ssi->chan = 0;
- }
-
- dev_dbg(dev, "%s[%d] hw stopped\n",
-@@ -340,6 +343,35 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod,
- return 0;
- }
-
-+static int rsnd_ssi_hw_params(struct rsnd_mod *mod,
-+ struct snd_pcm_substream *substream,
-+ struct snd_pcm_hw_params *params)
-+{
-+ struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-+ struct rsnd_ssi *ssi_parent = rsnd_ssi_parent(ssi);
-+ int chan = params_channels(params);
-+
-+ /*
-+ * Already working.
-+ * It will happen if SSI has parent/child connection.
-+ */
-+ if (ssi->usrcnt) {
-+ /*
-+ * it is error if child <-> parent SSI uses
-+ * different channels.
-+ */
-+ if (ssi->chan != chan)
-+ return -EIO;
-+ }
-+
-+ /* It will be removed on rsnd_ssi_hw_stop */
-+ ssi->chan = chan;
-+ if (ssi_parent)
-+ return rsnd_ssi_hw_params(&ssi_parent->mod, substream, params);
-+
-+ return 0;
-+}
-+
- static void rsnd_ssi_record_error(struct rsnd_ssi *ssi, u32 status)
- {
- /* under/over flow error */
-@@ -460,6 +492,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
- .quit = rsnd_ssi_quit,
- .start = rsnd_ssi_start,
- .stop = rsnd_ssi_stop,
-+ .hw_params = rsnd_ssi_hw_params,
- };
-
- static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
-@@ -569,6 +602,7 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
- .start = rsnd_ssi_dma_start,
- .stop = rsnd_ssi_dma_stop,
- .fallback = rsnd_ssi_fallback,
-+ .hw_params = rsnd_ssi_hw_params,
- };
-
- int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod)
---
-2.6.2
-
diff --git a/patches.renesas/0100-ASoC-rsnd-care-snd_kcontrol-s-index.patch b/patches.renesas/0100-ASoC-rsnd-care-snd_kcontrol-s-index.patch
deleted file mode 100644
index 2813a2d149af82..00000000000000
--- a/patches.renesas/0100-ASoC-rsnd-care-snd_kcontrol-s-index.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From bb44ae377ffabaffd458843a5c8bdffa7fe2b514 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Fri, 10 Apr 2015 08:50:50 +0000
-Subject: [PATCH 100/129] ASoC: rsnd: care snd_kcontrol's index
-
-rsnd might be used in multi-codec sound card.
-Then, same name kcontrol will be registered many times, and it will
-be error. This patch fixes this issue by using .index
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit da620d722a7b7b16bf8571150acd7fd9e155809f)
-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 164653c0bc10..99eb1093c569 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -839,12 +839,14 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
- struct rsnd_kctrl_cfg *cfg,
- void (*update)(struct rsnd_mod *mod))
- {
-+ struct snd_soc_card *soc_card = rtd->card;
- struct snd_card *card = rtd->card->snd_card;
- struct snd_kcontrol *kctrl;
- struct snd_kcontrol_new knew = {
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = name,
- .info = rsnd_kctrl_info,
-+ .index = rtd - soc_card->rtd,
- .get = rsnd_kctrl_get,
- .put = rsnd_kctrl_put,
- .private_value = (unsigned long)cfg,
---
-2.6.2
-
diff --git a/patches.renesas/0101-ASoC-rsnd-Use-generic-names-for-device-nodes.patch b/patches.renesas/0101-ASoC-rsnd-Use-generic-names-for-device-nodes.patch
deleted file mode 100644
index d5c12d6fca94fd..00000000000000
--- a/patches.renesas/0101-ASoC-rsnd-Use-generic-names-for-device-nodes.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 9681e7afe7774e4d64fc7712d212bedc96bd0a0f Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 27 Apr 2015 14:49:09 +0200
-Subject: [PATCH 101/129] ASoC: rsnd: Use generic names for device nodes
-
-rcar_sound -> sound
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 596f74ec275b0ec608e9450c937c6a29ba91b352)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/sound/renesas,rsnd.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-index f316ce1f214a..62ece4c59da7 100644
---- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-@@ -47,7 +47,7 @@ DAI subnode properties:
-
- Example:
-
--rcar_sound: rcar_sound@ec500000 {
-+rcar_sound: sound@ec500000 {
- #sound-dai-cells = <1>;
- compatible = "renesas,rcar_sound-r8a7791", "renesas,rcar_sound-gen2";
- reg = <0 0xec500000 0 0x1000>, /* SCU */
---
-2.6.2
-
diff --git a/patches.renesas/0102-ASoC-rsnd-revert-lock-for-calls-to-rsnd_dai_call.patch b/patches.renesas/0102-ASoC-rsnd-revert-lock-for-calls-to-rsnd_dai_call.patch
deleted file mode 100644
index a0e2776cfa9acf..00000000000000
--- a/patches.renesas/0102-ASoC-rsnd-revert-lock-for-calls-to-rsnd_dai_call.patch
+++ /dev/null
@@ -1,126 +0,0 @@
-From 1e69be61914002bafd2e20c5237cf41d384ffd2c Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 12 May 2015 01:57:50 +0000
-Subject: [PATCH 102/129] ASoC: rsnd: revert lock for calls to rsnd_dai_call
-
-This reverts commit 'e9c390df671f ("ASoC: rsnd: make sure it uses lock when
-it calls rsnd_dai_call)' The additional locks make 1") lock issue when boot
-2) lock issue when unbind/rmmod. And there is no problem without these
-locks. This patch revert it.
-
-Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit ae11a9be5a9bfc085ab3e0b7d2ea7cd01bc1d477)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 27 +++++----------------------
- 1 file changed, 5 insertions(+), 22 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 99eb1093c569..405cacdbedfb 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -731,15 +731,10 @@ static int rsnd_hw_params(struct snd_pcm_substream *substream,
- {
- struct snd_soc_dai *dai = rsnd_substream_to_dai(substream);
- struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
-- struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
- struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream);
-- unsigned long flags;
- int ret;
-
-- rsnd_lock(priv, flags);
- ret = rsnd_dai_call(hw_params, io, substream, hw_params);
-- rsnd_unlock(priv, flags);
--
- if (ret)
- return ret;
-
-@@ -926,16 +921,14 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod,
- static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd)
- {
- struct snd_soc_dai *dai = rtd->cpu_dai;
-- struct rsnd_priv *priv = rsnd_dai_to_priv(dai);
- struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai);
-- unsigned long flags;
-- int ret = 0;
-+ int ret;
-
-- rsnd_lock(priv, flags);
-- ret |= rsnd_dai_call(pcm_new, &rdai->playback, rtd);
-- ret |= rsnd_dai_call(pcm_new, &rdai->capture, rtd);
-- rsnd_unlock(priv, flags);
-+ ret = rsnd_dai_call(pcm_new, &rdai->playback, rtd);
-+ if (ret)
-+ return ret;
-
-+ ret = rsnd_dai_call(pcm_new, &rdai->capture, rtd);
- if (ret)
- return ret;
-
-@@ -958,11 +951,8 @@ static const struct snd_soc_component_driver rsnd_soc_component = {
- static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
- struct rsnd_dai_stream *io)
- {
-- unsigned long flags;
- int ret;
-
-- rsnd_lock(priv, flags);
--
- ret = rsnd_dai_call(probe, io, priv);
- if (ret == -EAGAIN) {
- /*
-@@ -995,7 +985,6 @@ static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
- */
- ret = rsnd_dai_call(probe, io, priv);
- }
-- rsnd_unlock(priv, flags);
-
- return ret;
- }
-@@ -1011,7 +1000,6 @@ static int rsnd_probe(struct platform_device *pdev)
- struct rsnd_dai *rdai;
- const struct of_device_id *of_id = of_match_device(rsnd_of_match, dev);
- const struct rsnd_of_data *of_data;
-- unsigned long flags;
- int (*probe_func[])(struct platform_device *pdev,
- const struct rsnd_of_data *of_data,
- struct rsnd_priv *priv) = {
-@@ -1098,12 +1086,10 @@ static int rsnd_probe(struct platform_device *pdev)
- exit_snd_soc:
- snd_soc_unregister_platform(dev);
- exit_snd_probe:
-- rsnd_lock(priv, flags);
- for_each_rsnd_dai(rdai, priv, i) {
- rsnd_dai_call(remove, &rdai->playback, priv);
- rsnd_dai_call(remove, &rdai->capture, priv);
- }
-- rsnd_unlock(priv, flags);
-
- return ret;
- }
-@@ -1112,7 +1098,6 @@ static int rsnd_remove(struct platform_device *pdev)
- {
- struct rsnd_priv *priv = dev_get_drvdata(&pdev->dev);
- struct rsnd_dai *rdai;
-- unsigned long flags;
- void (*remove_func[])(struct platform_device *pdev,
- struct rsnd_priv *priv) = {
- rsnd_ssi_remove,
-@@ -1123,12 +1108,10 @@ static int rsnd_remove(struct platform_device *pdev)
-
- pm_runtime_disable(&pdev->dev);
-
-- rsnd_lock(priv, flags);
- for_each_rsnd_dai(rdai, priv, i) {
- ret |= rsnd_dai_call(remove, &rdai->playback, priv);
- ret |= rsnd_dai_call(remove, &rdai->capture, priv);
- }
-- rsnd_unlock(priv, flags);
-
- for (i = 0; i < ARRAY_SIZE(remove_func); i++)
- remove_func[i](pdev, priv);
---
-2.6.2
-
diff --git a/patches.renesas/0103-ASoC-rsnd-indicate-unknown-HW-start.patch b/patches.renesas/0103-ASoC-rsnd-indicate-unknown-HW-start.patch
deleted file mode 100644
index 1d73aa9c7838f3..00000000000000
--- a/patches.renesas/0103-ASoC-rsnd-indicate-unknown-HW-start.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 32a7c232b546c0e87184bc487bfff0be13e9ca91 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Thu, 21 May 2015 03:49:13 +0000
-Subject: [PATCH 103/129] ASoC: rsnd: indicate unknown HW start
-
-rsnd_ssi_hw_stop() should be called after rsnd_ssi_hw_start().
-This patch indicates unknown hw_stop as error
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Tested by: Cao Minh Hiep <cm-hiep@jinso.co.jp>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-
-(cherry picked from commit b847357979048f718aa7e218050982ec9c306285)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/ssi.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 5b89723c3206..927ac52a6d1e 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -232,8 +232,10 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi)
- struct device *dev = rsnd_priv_to_dev(priv);
- u32 cr;
-
-- if (0 == ssi->usrcnt) /* stop might be called without start */
-+ if (0 == ssi->usrcnt) {
-+ dev_err(dev, "%s called without starting\n", __func__);
- return;
-+ }
-
- ssi->usrcnt--;
-
---
-2.6.2
-
diff --git a/patches.renesas/0104-ASoC-rsnd-add-rsnd_dai_stream_quit.patch b/patches.renesas/0104-ASoC-rsnd-add-rsnd_dai_stream_quit.patch
deleted file mode 100644
index 22ca8536341de1..00000000000000
--- a/patches.renesas/0104-ASoC-rsnd-add-rsnd_dai_stream_quit.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From 51014374fd2333c386dcb48c5776bc0d125240c6 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Thu, 21 May 2015 03:49:54 +0000
-Subject: [PATCH 104/129] ASoC: rsnd: add rsnd_dai_stream_quit()
-
-Current Renesas R-Car sound driver calls rsnd_dai_stream_init() when
-start, but it didn't call paired function. This patch adds
-rsnd_dai_stream_quit() for it. This is prepare for interrupt error
-status check feature support.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Tested by: Cao Minh Hiep <cm-hiep@jinso.co.jp>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-
-(cherry picked from commit 5626ad0866657c4758958040589b395d2a58816d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 405cacdbedfb..2b7323c92994 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -315,7 +315,7 @@ void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int byte)
- }
- }
-
--static int rsnd_dai_stream_init(struct rsnd_dai_stream *io,
-+static void rsnd_dai_stream_init(struct rsnd_dai_stream *io,
- struct snd_pcm_substream *substream)
- {
- struct snd_pcm_runtime *runtime = substream->runtime;
-@@ -327,8 +327,11 @@ static int rsnd_dai_stream_init(struct rsnd_dai_stream *io,
- runtime->channels *
- samples_to_bytes(runtime, 1);
- io->next_period_byte = io->byte_per_period;
-+}
-
-- return 0;
-+static void rsnd_dai_stream_quit(struct rsnd_dai_stream *io)
-+{
-+ io->substream = NULL;
- }
-
- static
-@@ -363,9 +366,7 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
-
- switch (cmd) {
- case SNDRV_PCM_TRIGGER_START:
-- ret = rsnd_dai_stream_init(io, substream);
-- if (ret < 0)
-- goto dai_trigger_end;
-+ rsnd_dai_stream_init(io, substream);
-
- ret = rsnd_platform_call(priv, dai, start, ssi_id);
- if (ret < 0)
-@@ -391,6 +392,8 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
- ret = rsnd_platform_call(priv, dai, stop, ssi_id);
- if (ret < 0)
- goto dai_trigger_end;
-+
-+ rsnd_dai_stream_quit(io);
- break;
- default:
- ret = -EINVAL;
---
-2.6.2
-
diff --git a/patches.renesas/0105-ASoC-rsnd-rsrc-card-uses-FE-BE-merged-format-when-DP.patch b/patches.renesas/0105-ASoC-rsnd-rsrc-card-uses-FE-BE-merged-format-when-DP.patch
deleted file mode 100644
index 89c58db5fcf0bb..00000000000000
--- a/patches.renesas/0105-ASoC-rsnd-rsrc-card-uses-FE-BE-merged-format-when-DP.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 242092d5a8355e446ec47e0bc80586d666e3d676 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 12 May 2015 02:03:51 +0000
-Subject: [PATCH 105/129] ASoC: rsnd: rsrc-card uses FE/BE merged format when
- DPCM
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit b723550d7e84b6b59d427d560be49d8ab177ea89)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index a68517afe615..050b0dbcee65 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -232,6 +232,7 @@ rsrc_card_sub_parse_of(struct rsrc_card_priv *priv,
- if (args_count) {
- *args_count = args.args_count;
- dai_link->dynamic = 1;
-+ dai_link->dpcm_merged_format = 1;
- } else {
- dai_link->no_pcm = 1;
- priv->codec_conf.of_node = (*p_node);
---
-2.6.2
-
diff --git a/patches.renesas/0106-ASoC-rsnd-spin-lock-for-interrupt-handler.patch b/patches.renesas/0106-ASoC-rsnd-spin-lock-for-interrupt-handler.patch
deleted file mode 100644
index 88d6f41a542409..00000000000000
--- a/patches.renesas/0106-ASoC-rsnd-spin-lock-for-interrupt-handler.patch
+++ /dev/null
@@ -1,165 +0,0 @@
-From bed00860b77299f7ef2085554647aa83671d470b Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Thu, 21 May 2015 03:50:23 +0000
-Subject: [PATCH 106/129] ASoC: rsnd: spin lock for interrupt handler
-
-Renesas R-Car driver interrupt handler was not locked before.
-But now, SSI/SRC interrupt handler calls restart function
-which should be called under spin lock.
-Below error might happen witout this patch.
-
-Unable to handle kernel NULL pointer dereference at virtual address 00000048
-pgd = edfac000
-[00000048] *pgd=6e0f0831, *pte=00000000, *ppte=00000000
-Internal error: Oops: 17 [#1] SMP ARM
-CPU: 0 PID: 2009 Comm: aplay Not tainted 4.1.0-rc2-dirty #4
-Hardware name: Generic R8A7790 (Flattened Device Tree)
-task: eeac9040 ti: eebe8000 task.ti: eebe8000
-PC is at rsnd_get_adinr+0x28/0x60
-LR is at rsnd_src_ssiu_start+0xdc/0x19c
-pc : [<c0409790>] lr : [<c040c068>] psr: a0000193
-sp : eebe9e58 ip : eebe9e68 fp : eebe9e64
-r10: c06ed9d0 r9 : ee919d10 r8 : 00000001
-r7 : 00000001 r6 : ee1cb090 r5 : 00000000 r4 : edcaa418
-r3 : 00000000 r2 : eea8ce00 r1 : 80000193 r0 : edcaa418
-...
-
-Reported-by: Cao Minh Hiep <cm-hiep@jinso.co.jp>
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Tested by: Cao Minh Hiep <cm-hiep@jinso.co.jp>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-
-(cherry picked from commit 02299d9875bab5b1e9d87ce9ae4aecf537eb12a4)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 12 ++++++++++--
- sound/soc/sh/rcar/rsnd.h | 3 +--
- sound/soc/sh/rcar/src.c | 11 ++++++++---
- sound/soc/sh/rcar/ssi.c | 14 +++++++++++---
- 4 files changed, 30 insertions(+), 10 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 2b7323c92994..d460d2aa82ee 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -170,6 +170,14 @@ void rsnd_mod_quit(struct rsnd_mod *mod)
- clk_unprepare(mod->clk);
- }
-
-+int rsnd_mod_is_working(struct rsnd_mod *mod)
-+{
-+ struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-+
-+ /* see rsnd_dai_stream_init/quit() */
-+ return !!io->substream;
-+}
-+
- /*
- * settting function
- */
-@@ -362,7 +370,7 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
- int ret;
- unsigned long flags;
-
-- rsnd_lock(priv, flags);
-+ spin_lock_irqsave(&priv->lock, flags);
-
- switch (cmd) {
- case SNDRV_PCM_TRIGGER_START:
-@@ -400,7 +408,7 @@ static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd,
- }
-
- dai_trigger_end:
-- rsnd_unlock(priv, flags);
-+ spin_unlock_irqrestore(&priv->lock, flags);
-
- return ret;
- }
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 4e6de6804cfb..03ff071d012f 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -303,6 +303,7 @@ int rsnd_mod_init(struct rsnd_mod *mod,
- int id);
- void rsnd_mod_quit(struct rsnd_mod *mod);
- char *rsnd_mod_name(struct rsnd_mod *mod);
-+int rsnd_mod_is_working(struct rsnd_mod *mod);
- struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod);
-
- /*
-@@ -449,8 +450,6 @@ struct rsnd_priv {
- #define rsnd_priv_to_pdev(priv) ((priv)->pdev)
- #define rsnd_priv_to_dev(priv) (&(rsnd_priv_to_pdev(priv)->dev))
- #define rsnd_priv_to_info(priv) ((priv)->info)
--#define rsnd_lock(priv, flags) spin_lock_irqsave(&priv->lock, flags)
--#define rsnd_unlock(priv, flags) spin_unlock_irqrestore(&priv->lock, flags)
-
- /*
- * rsnd_kctrl
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 3beb32eb412a..fbe9166e26d1 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -673,10 +673,13 @@ static int _rsnd_src_stop_gen2(struct rsnd_mod *mod)
- static irqreturn_t rsnd_src_interrupt_gen2(int irq, void *data)
- {
- struct rsnd_mod *mod = data;
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-+ struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-+
-+ spin_lock(&priv->lock);
-
-- if (!io)
-- return IRQ_NONE;
-+ /* ignore all cases if not working */
-+ if (!rsnd_mod_is_working(mod))
-+ goto rsnd_src_interrupt_gen2_out;
-
- if (rsnd_src_error_record_gen2(mod)) {
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-@@ -692,6 +695,8 @@ static irqreturn_t rsnd_src_interrupt_gen2(int irq, void *data)
- else
- dev_warn(dev, "no more SRC restart\n");
- }
-+rsnd_src_interrupt_gen2_out:
-+ spin_unlock(&priv->lock);
-
- return IRQ_HANDLED;
- }
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 927ac52a6d1e..50fa3928a003 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -423,10 +423,15 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- int is_dma = rsnd_ssi_is_dma_mode(mod);
-- u32 status = rsnd_mod_read(mod, SSISR);
-+ u32 status;
-+
-+ spin_lock(&priv->lock);
-
-- if (!io)
-- return IRQ_NONE;
-+ /* ignore all cases if not working */
-+ if (!rsnd_mod_is_working(mod))
-+ goto rsnd_ssi_interrupt_out;
-+
-+ status = rsnd_mod_read(mod, SSISR);
-
- /* PIO only */
- if (!is_dma && (status & DIRQ)) {
-@@ -466,6 +471,9 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
-
- rsnd_ssi_record_error(ssi, status);
-
-+rsnd_ssi_interrupt_out:
-+ spin_unlock(&priv->lock);
-+
- return IRQ_HANDLED;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0107-ASoC-rsnd-Document-r8a7778-specific-binding.patch b/patches.renesas/0107-ASoC-rsnd-Document-r8a7778-specific-binding.patch
deleted file mode 100644
index 9ca36ffde8c088..00000000000000
--- a/patches.renesas/0107-ASoC-rsnd-Document-r8a7778-specific-binding.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From c5f298fe30184e1aa0ebd746368be28bdfdd7c7d Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 1 Jun 2015 12:44:15 +0200
-Subject: [PATCH 107/129] ASoC: rsnd: Document r8a7778-specific binding
-
-Add the missing r8a7778-specific compatible value, which is already in
-use since v4.1-rc1.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 7667f716e502f2b3e42085738b205ddc9abcff25)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/sound/renesas,rsnd.txt | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-index 62ece4c59da7..b6b3a786855f 100644
---- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-@@ -5,6 +5,7 @@ Required properties:
- "renesas,rcar_sound-gen1" if generation1, and
- "renesas,rcar_sound-gen2" if generation2
- Examples with soctypes are:
-+ - "renesas,rcar_sound-r8a7778" (R-Car M1A)
- - "renesas,rcar_sound-r8a7790" (R-Car H2)
- - "renesas,rcar_sound-r8a7791" (R-Car M2-W)
- - reg : Should contain the register physical address.
---
-2.6.2
-
diff --git a/patches.renesas/0108-ASoC-rsnd-don-t-care-under-over-run-error-when-PIO.patch b/patches.renesas/0108-ASoC-rsnd-don-t-care-under-over-run-error-when-PIO.patch
deleted file mode 100644
index 357e354c0a1b93..00000000000000
--- a/patches.renesas/0108-ASoC-rsnd-don-t-care-under-over-run-error-when-PIO.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 2fbc61a79fb010dcc53f3f5defbe83b76311a4d0 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:20:54 +0000
-Subject: [PATCH 108/129] ASoC: rsnd: don't care under/over run error when PIO
-
-PIO is used only for checking data path / codec settings. And underrun
-is very normal when PIO mode. Let's don't care about under/over run
-error when PIO case. Otherwise, 1) too many HW restart happens, 2) some
-sounds which need much data transfer can't play since it falls into
-error detection method which was created for DMA transfer
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 12927a8f80264256e6cb2d3241fe9d6f4ad7face)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/ssi.c | 16 +++++++++-------
- 1 file changed, 9 insertions(+), 7 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 50fa3928a003..856917392b79 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -199,15 +199,17 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
- }
- }
-
-- cr_mode = rsnd_ssi_is_dma_mode(&ssi->mod) ?
-- DMEN : /* DMA : enable DMA */
-- DIEN; /* PIO : enable Data interrupt */
--
-+ if (rsnd_ssi_is_dma_mode(&ssi->mod)) {
-+ cr_mode = UIEN | OIEN | /* over/under run */
-+ DMEN; /* DMA : enable DMA */
-+ } else {
-+ cr_mode = DIEN; /* PIO : enable Data interrupt */
-+ }
-
- cr = ssi->cr_own |
- ssi->cr_clk |
- cr_mode |
-- UIEN | OIEN | EN;
-+ EN;
-
- rsnd_mod_write(&ssi->mod, SSICR, cr);
-
-@@ -452,8 +454,8 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
- rsnd_dai_pointer_update(io, sizeof(*buf));
- }
-
-- /* PIO / DMA */
-- if (status & (UIRQ | OIRQ)) {
-+ /* DMA only */
-+ if (is_dma && (status & (UIRQ | OIRQ))) {
- struct device *dev = rsnd_priv_to_dev(priv);
-
- /*
---
-2.6.2
-
diff --git a/patches.renesas/0109-ASoC-rsnd-don-t-call-snd_pcm_period_elapsed-under-sp.patch b/patches.renesas/0109-ASoC-rsnd-don-t-call-snd_pcm_period_elapsed-under-sp.patch
deleted file mode 100644
index 03f1838753b2d8..00000000000000
--- a/patches.renesas/0109-ASoC-rsnd-don-t-call-snd_pcm_period_elapsed-under-sp.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-From 8ea1c6a4bcd03589fe3519d74d673198475d5271 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:21:15 +0000
-Subject: [PATCH 109/129] ASoC: rsnd: don't call snd_pcm_period_elapsed() under
- spin lock
-
-'a9e1ac1a9e4585b5("ASoC: rsnd: spin lock for interrupt handler")'
-added spin lock under interrupt handler to solve HW restart issue.
-
-OTOH, current rsnd driver calls snd_pcm_period_elapsed() from
-rsnd_dai_pointer_update(). but, it will be called under spin lock
-if SSI was PIO mode.
-
-If it was called under spin lock, it will call
-snd_pcm_update_state() -> snd_pcm_drain_done().
-Then, it calls rsnd_soc_dai_trigger() and will be dead-lock.
-This patch doesn't call rsnd_dai_pointer_update() under spin lock
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 75defee0f1b3fcd91d8a304d6444635a459b8249)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 20 ++++++++++++++++++--
- sound/soc/sh/rcar/dma.c | 11 ++++++++++-
- sound/soc/sh/rcar/rsnd.h | 3 ++-
- sound/soc/sh/rcar/ssi.c | 6 +++++-
- 4 files changed, 35 insertions(+), 5 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index d460d2aa82ee..027b04392674 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -302,7 +302,7 @@ int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional)
- return pos;
- }
-
--void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int byte)
-+bool rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int byte)
- {
- io->byte_pos += byte;
-
-@@ -319,8 +319,24 @@ void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int byte)
- io->next_period_byte = io->byte_per_period;
- }
-
-- snd_pcm_period_elapsed(substream);
-+ return true;
- }
-+
-+ return false;
-+}
-+
-+void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io)
-+{
-+ struct snd_pcm_substream *substream = io->substream;
-+
-+ /*
-+ * this function should be called...
-+ *
-+ * - if rsnd_dai_pointer_update() returns true
-+ * - without spin lock
-+ */
-+
-+ snd_pcm_period_elapsed(substream);
- }
-
- static void rsnd_dai_stream_init(struct rsnd_dai_stream *io,
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index 144308f15fb3..ac19ab161c63 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -36,7 +36,10 @@ static void rsnd_dmaen_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(mod);
- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-+ bool elapsed = false;
-+ unsigned long flags;
-
- /*
- * Renesas sound Gen1 needs 1 DMAC,
-@@ -49,8 +52,14 @@ static void rsnd_dmaen_complete(void *data)
- * rsnd_dai_pointer_update() will be called twice,
- * ant it will breaks io->byte_pos
- */
-+ spin_lock_irqsave(&priv->lock, flags);
-+
-+ elapsed = rsnd_dai_pointer_update(io, io->byte_per_period);
-+
-+ spin_unlock_irqrestore(&priv->lock, flags);
-
-- rsnd_dai_pointer_update(io, io->byte_per_period);
-+ if (elapsed)
-+ rsnd_dai_period_elapsed(io);
- }
-
- static void rsnd_dmaen_stop(struct rsnd_dma *dma)
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 03ff071d012f..e37234ea18e6 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -355,7 +355,8 @@ struct rsnd_dai {
-
- struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id);
-
--void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt);
-+bool rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt);
-+void rsnd_dai_period_elapsed(struct rsnd_dai_stream *io);
- int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);
-
- /*
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 856917392b79..25483211a349 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -426,6 +426,7 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- int is_dma = rsnd_ssi_is_dma_mode(mod);
- u32 status;
-+ bool elapsed = false;
-
- spin_lock(&priv->lock);
-
-@@ -451,7 +452,7 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
- else
- *buf = rsnd_mod_read(mod, SSIRDR);
-
-- rsnd_dai_pointer_update(io, sizeof(*buf));
-+ elapsed = rsnd_dai_pointer_update(io, sizeof(*buf));
- }
-
- /* DMA only */
-@@ -476,6 +477,9 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
- rsnd_ssi_interrupt_out:
- spin_unlock(&priv->lock);
-
-+ if (elapsed)
-+ rsnd_dai_period_elapsed(io);
-+
- return IRQ_HANDLED;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0110-ASoC-rsrc-card-used-fe.xxx-be.xxx-name-for-dai_link.patch b/patches.renesas/0110-ASoC-rsrc-card-used-fe.xxx-be.xxx-name-for-dai_link.patch
deleted file mode 100644
index 672de37750d086..00000000000000
--- a/patches.renesas/0110-ASoC-rsrc-card-used-fe.xxx-be.xxx-name-for-dai_link.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 10e9fe5f59d8eac66ca26f8f8b56693cc6a25286 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:21:34 +0000
-Subject: [PATCH 110/129] ASoC: rsrc-card: used "fe.xxx"/"be.xxx" name for
- dai_link
-
-Current dai_link name is using "cpu_dai_name + codec_dai_name",
-but one of them is always "snd-soc-dummy-dai" when DPCM.
-This patch uses "fe.xxx" for cpu, "be.xxx" for codec.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit d72f4a885e9c310e58f9a07ee17516e8328d224d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 20 +++++++-------------
- 1 file changed, 7 insertions(+), 13 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index 050b0dbcee65..9a1926f8d348 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -55,11 +55,13 @@ struct rsrc_card_dai {
- #define RSRC_FB_NUM 2 /* FE/BE */
- #define IDX_CPU 0
- #define IDX_CODEC 1
-+#define DAI_NAME_NUM 32
- struct rsrc_card_priv {
- struct snd_soc_card snd_card;
- struct rsrc_card_dai_props {
- struct rsrc_card_dai cpu_dai;
- struct rsrc_card_dai codec_dai;
-+ char dai_name[DAI_NAME_NUM];
- } dai_props[RSRC_FB_NUM];
- struct snd_soc_codec_conf codec_conf;
- struct snd_soc_dai_link dai_link[RSRC_FB_NUM];
-@@ -309,7 +311,7 @@ static int rsrc_card_dai_link_of(struct device_node *node,
- struct rsrc_card_dai_props *dai_props = rsrc_priv_to_props(priv, idx);
- struct device_node *cpu = NULL;
- struct device_node *codec = NULL;
-- char *name;
-+ char *name = dai_props->dai_name;
- char prop[128];
- int ret, cpu_args;
-
-@@ -348,18 +350,10 @@ static int rsrc_card_dai_link_of(struct device_node *node,
- /* Simple Card assumes platform == cpu */
- dai_link->platform_of_node = dai_link->cpu_of_node;
-
-- /* DAI link name is created from CPU/CODEC dai name */
-- name = devm_kzalloc(dev,
-- strlen(dai_link->cpu_dai_name) +
-- strlen(dai_link->codec_dai_name) + 2,
-- GFP_KERNEL);
-- if (!name) {
-- ret = -ENOMEM;
-- goto dai_link_of_err;
-- }
--
-- sprintf(name, "%s-%s", dai_link->cpu_dai_name,
-- dai_link->codec_dai_name);
-+ snprintf(name, DAI_NAME_NUM, "%s.%s",
-+ dai_link->dynamic ? "fe" : "be",
-+ dai_link->dynamic ? dai_link->cpu_dai_name :
-+ dai_link->codec_dai_name);
- dai_link->name = dai_link->stream_name = name;
- dai_link->ops = &rsrc_card_ops;
- dai_link->init = rsrc_card_dai_init;
---
-2.6.2
-
diff --git a/patches.renesas/0111-ASoC-rsrc-card-tidyup-priv-snd_card-setup-timing.patch b/patches.renesas/0111-ASoC-rsrc-card-tidyup-priv-snd_card-setup-timing.patch
deleted file mode 100644
index 34f2ff06fb890a..00000000000000
--- a/patches.renesas/0111-ASoC-rsrc-card-tidyup-priv-snd_card-setup-timing.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From c340e2e36415fb3cca8e0d03973f44c3f5b61bc5 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:22:05 +0000
-Subject: [PATCH 111/129] ASoC: rsrc-card: tidyup priv->snd_card setup timing
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 3c7e64dd89886af007cb0abbf4523253204c9079)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 24 ++++++++++--------------
- 1 file changed, 10 insertions(+), 14 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index 9a1926f8d348..cdd005b82660 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -391,9 +391,9 @@ dai_link_of_err:
- }
-
- static int rsrc_card_parse_of(struct device_node *node,
-- struct rsrc_card_priv *priv)
-+ struct rsrc_card_priv *priv,
-+ struct device *dev)
- {
-- struct device *dev = rsrc_priv_to_dev(priv);
- const struct rsrc_card_of_data *of_data = rsrc_dev_to_of_data(dev);
- int ret;
- int i;
-@@ -404,7 +404,13 @@ static int rsrc_card_parse_of(struct device_node *node,
- /* Parse the card name from DT */
- snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-
-- /* DAPM routes */
-+ /* Init snd_soc_card */
-+ priv->snd_card.owner = THIS_MODULE;
-+ priv->snd_card.dev = dev;
-+ priv->snd_card.dai_link = priv->dai_link;
-+ priv->snd_card.num_links = RSRC_FB_NUM;
-+ priv->snd_card.codec_conf = &priv->codec_conf;
-+ priv->snd_card.num_configs = 1;
- priv->snd_card.of_dapm_routes = of_data->routes;
- priv->snd_card.num_of_dapm_routes = of_data->num_routes;
-
-@@ -446,7 +452,6 @@ static int rsrc_card_unref(struct snd_soc_card *card)
- static int rsrc_card_probe(struct platform_device *pdev)
- {
- struct rsrc_card_priv *priv;
-- struct snd_soc_dai_link *dai_link;
- struct device_node *np = pdev->dev.of_node;
- struct device *dev = &pdev->dev;
- int ret;
-@@ -456,16 +461,7 @@ static int rsrc_card_probe(struct platform_device *pdev)
- if (!priv)
- return -ENOMEM;
-
-- /* Init snd_soc_card */
-- priv->snd_card.owner = THIS_MODULE;
-- priv->snd_card.dev = dev;
-- dai_link = priv->dai_link;
-- priv->snd_card.dai_link = dai_link;
-- priv->snd_card.num_links = RSRC_FB_NUM;
-- priv->snd_card.codec_conf = &priv->codec_conf;
-- priv->snd_card.num_configs = 1;
--
-- ret = rsrc_card_parse_of(np, priv);
-+ ret = rsrc_card_parse_of(np, priv, dev);
- if (ret < 0) {
- if (ret != -EPROBE_DEFER)
- dev_err(dev, "parse error %d\n", ret);
---
-2.6.2
-
diff --git a/patches.renesas/0112-ASoC-rsrc-card-enable-multi-cpu-codec-for-DPCM.patch b/patches.renesas/0112-ASoC-rsrc-card-enable-multi-cpu-codec-for-DPCM.patch
deleted file mode 100644
index 34dce581b15eea..00000000000000
--- a/patches.renesas/0112-ASoC-rsrc-card-enable-multi-cpu-codec-for-DPCM.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From aadde69240350f1272ef55c2d39c56e2a1443ff9 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:22:30 +0000
-Subject: [PATCH 112/129] ASoC: rsrc-card: enable multi cpu/codec for DPCM
-
-Current rsrc-card is assuming 1 FE (= CPU), 1 BE (= codec) on card.
-But, it will support multi FE/BE card. This is prepare for it.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 3433bf0798356abf2e8b6145ac5633a610c0a8ec)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 25 +++++++++++++++++++------
- 1 file changed, 19 insertions(+), 6 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index cdd005b82660..ae99b3612039 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -52,7 +52,6 @@ struct rsrc_card_dai {
- struct clk *clk;
- };
-
--#define RSRC_FB_NUM 2 /* FE/BE */
- #define IDX_CPU 0
- #define IDX_CODEC 1
- #define DAI_NAME_NUM 32
-@@ -62,9 +61,10 @@ struct rsrc_card_priv {
- struct rsrc_card_dai cpu_dai;
- struct rsrc_card_dai codec_dai;
- char dai_name[DAI_NAME_NUM];
-- } dai_props[RSRC_FB_NUM];
-+ } *dai_props;
- struct snd_soc_codec_conf codec_conf;
-- struct snd_soc_dai_link dai_link[RSRC_FB_NUM];
-+ struct snd_soc_dai_link *dai_link;
-+ int dai_num;
- u32 convert_rate;
- };
-
-@@ -395,12 +395,25 @@ static int rsrc_card_parse_of(struct device_node *node,
- struct device *dev)
- {
- const struct rsrc_card_of_data *of_data = rsrc_dev_to_of_data(dev);
-+ struct rsrc_card_dai_props *props;
-+ struct snd_soc_dai_link *links;
-+
- int ret;
-- int i;
-+ int i, num;
-
- if (!node)
- return -EINVAL;
-
-+ num = of_get_child_count(node);
-+ props = devm_kzalloc(dev, sizeof(*props) * num, GFP_KERNEL);
-+ links = devm_kzalloc(dev, sizeof(*links) * num, GFP_KERNEL);
-+ if (!props || !links)
-+ return -ENOMEM;
-+
-+ priv->dai_props = props;
-+ priv->dai_link = links;
-+ priv->dai_num = num;
-+
- /* Parse the card name from DT */
- snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-
-@@ -408,7 +421,7 @@ static int rsrc_card_parse_of(struct device_node *node,
- priv->snd_card.owner = THIS_MODULE;
- priv->snd_card.dev = dev;
- priv->snd_card.dai_link = priv->dai_link;
-- priv->snd_card.num_links = RSRC_FB_NUM;
-+ priv->snd_card.num_links = num;
- priv->snd_card.codec_conf = &priv->codec_conf;
- priv->snd_card.num_configs = 1;
- priv->snd_card.of_dapm_routes = of_data->routes;
-@@ -422,7 +435,7 @@ static int rsrc_card_parse_of(struct device_node *node,
- priv->convert_rate);
-
- /* FE/BE */
-- for (i = 0; i < RSRC_FB_NUM; i++) {
-+ for (i = 0; i < num; i++) {
- ret = rsrc_card_dai_link_of(node, priv, i);
- if (ret < 0)
- return ret;
---
-2.6.2
-
diff --git a/patches.renesas/0113-ASoC-rsrc-card-remove-unused-name.patch b/patches.renesas/0113-ASoC-rsrc-card-remove-unused-name.patch
deleted file mode 100644
index d4d118196c42c9..00000000000000
--- a/patches.renesas/0113-ASoC-rsrc-card-remove-unused-name.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 84acb093618d83bf76268221e3b1ac5d5cfefc74 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:22:47 +0000
-Subject: [PATCH 113/129] ASoC: rsrc-card: remove unused name
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 1683e1a4135862c9837b768b1e2ab27623f2161a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index ae99b3612039..8c74b089eb3c 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -46,7 +46,6 @@ static const struct of_device_id rsrc_card_of_match[] = {
- MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
-
- struct rsrc_card_dai {
-- const char *name;
- unsigned int fmt;
- unsigned int sysclk;
- struct clk *clk;
---
-2.6.2
-
diff --git a/patches.renesas/0114-ASoC-rsnd-card-tidyup-rsrc_priv_to_.patch b/patches.renesas/0114-ASoC-rsnd-card-tidyup-rsrc_priv_to_.patch
deleted file mode 100644
index 967a8687bbfac1..00000000000000
--- a/patches.renesas/0114-ASoC-rsnd-card-tidyup-rsrc_priv_to_.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From be6d04c8886d5318b859e1d63d1dde20cb8bfc97 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:23:08 +0000
-Subject: [PATCH 114/129] ASoC: rsnd-card: tidyup rsrc_priv_to_()
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 8bd616c4f7717d8049276acc329bf5bd3988ac3b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index 8c74b089eb3c..8162b7d66c4d 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -68,8 +68,8 @@ struct rsrc_card_priv {
- };
-
- #define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev)
--#define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
--#define rsrc_priv_to_props(priv, i) ((priv)->dai_props + i)
-+#define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
-+#define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i))
- #define rsrc_dev_to_of_data(dev) (of_match_device(rsrc_card_of_match, (dev))->data)
-
- static int rsrc_card_startup(struct snd_pcm_substream *substream)
-@@ -77,7 +77,7 @@ static int rsrc_card_startup(struct snd_pcm_substream *substream)
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
- struct rsrc_card_dai_props *dai_props =
-- &priv->dai_props[rtd - rtd->card->rtd];
-+ rsrc_priv_to_props(priv, rtd - rtd->card->rtd);
- int ret;
-
- ret = clk_prepare_enable(dai_props->cpu_dai.clk);
-@@ -96,7 +96,7 @@ static void rsrc_card_shutdown(struct snd_pcm_substream *substream)
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
- struct rsrc_card_dai_props *dai_props =
-- &priv->dai_props[rtd - rtd->card->rtd];
-+ rsrc_priv_to_props(priv, rtd - rtd->card->rtd);
-
- clk_disable_unprepare(dai_props->cpu_dai.clk);
-
---
-2.6.2
-
diff --git a/patches.renesas/0115-ASoC-rsrc-card-move-rsrc_card_parse_daifmt-to-upper-.patch b/patches.renesas/0115-ASoC-rsrc-card-move-rsrc_card_parse_daifmt-to-upper-.patch
deleted file mode 100644
index 3abe98b91e2e27..00000000000000
--- a/patches.renesas/0115-ASoC-rsrc-card-move-rsrc_card_parse_daifmt-to-upper-.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 997a8afcd940c4a487e1ba32852e4a56fb053507 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:23:30 +0000
-Subject: [PATCH 115/129] ASoC: rsrc-card: move rsrc_card_parse_daifmt() to
- upper side
-
-This is prepare for DPCM cleanup
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit fe3bd18432efd42642c77a1280a22551c6549040)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 70 +++++++++++++++++++++----------------------
- 1 file changed, 35 insertions(+), 35 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index 8162b7d66c4d..d0d74b52eb1d 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -171,6 +171,41 @@ static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- return 0;
- }
-
-+static int rsrc_card_parse_daifmt(struct device_node *node,
-+ struct rsrc_card_priv *priv,
-+ struct device_node *codec,
-+ int idx)
-+{
-+ struct device_node *bitclkmaster = NULL;
-+ struct device_node *framemaster = NULL;
-+ struct rsrc_card_dai_props *dai_props = rsrc_priv_to_props(priv, idx);
-+ struct rsrc_card_dai *cpu_dai = &dai_props->cpu_dai;
-+ struct rsrc_card_dai *codec_dai = &dai_props->codec_dai;
-+ unsigned int daifmt;
-+
-+ daifmt = snd_soc_of_parse_daifmt(node, NULL,
-+ &bitclkmaster, &framemaster);
-+ daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-+
-+ if (!bitclkmaster && !framemaster)
-+ return -EINVAL;
-+
-+ if (codec == bitclkmaster)
-+ daifmt |= (codec == framemaster) ?
-+ SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-+ else
-+ daifmt |= (codec == framemaster) ?
-+ SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-+
-+ cpu_dai->fmt = daifmt;
-+ codec_dai->fmt = daifmt;
-+
-+ of_node_put(bitclkmaster);
-+ of_node_put(framemaster);
-+
-+ return 0;
-+}
-+
- static int
- rsrc_card_sub_parse_of(struct rsrc_card_priv *priv,
- struct device_node *np,
-@@ -266,41 +301,6 @@ rsrc_card_sub_parse_of(struct rsrc_card_priv *priv,
- return 0;
- }
-
--static int rsrc_card_parse_daifmt(struct device_node *node,
-- struct rsrc_card_priv *priv,
-- struct device_node *codec,
-- int idx)
--{
-- struct device_node *bitclkmaster = NULL;
-- struct device_node *framemaster = NULL;
-- struct rsrc_card_dai_props *dai_props = rsrc_priv_to_props(priv, idx);
-- struct rsrc_card_dai *cpu_dai = &dai_props->cpu_dai;
-- struct rsrc_card_dai *codec_dai = &dai_props->codec_dai;
-- unsigned int daifmt;
--
-- daifmt = snd_soc_of_parse_daifmt(node, NULL,
-- &bitclkmaster, &framemaster);
-- daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
--
-- if (!bitclkmaster && !framemaster)
-- return -EINVAL;
--
-- if (codec == bitclkmaster)
-- daifmt |= (codec == framemaster) ?
-- SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-- else
-- daifmt |= (codec == framemaster) ?
-- SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
--
-- cpu_dai->fmt = daifmt;
-- codec_dai->fmt = daifmt;
--
-- of_node_put(bitclkmaster);
-- of_node_put(framemaster);
--
-- return 0;
--}
--
- static int rsrc_card_dai_link_of(struct device_node *node,
- struct rsrc_card_priv *priv,
- int idx)
---
-2.6.2
-
diff --git a/patches.renesas/0116-ASoC-rsrc-card-tidyup-return-value-of-clock-error.patch b/patches.renesas/0116-ASoC-rsrc-card-tidyup-return-value-of-clock-error.patch
deleted file mode 100644
index cca8f2047e601f..00000000000000
--- a/patches.renesas/0116-ASoC-rsrc-card-tidyup-return-value-of-clock-error.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 7a6d289a73c64caf9102dc92a01c6d371b67f8e7 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:23:52 +0000
-Subject: [PATCH 116/129] ASoC: rsrc-card: tidyup return value of clock error
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 061015f7bfe2e278243bcc9f04346cfc991a5342)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index d0d74b52eb1d..52123d6ceec5 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -283,10 +283,8 @@ rsrc_card_sub_parse_of(struct rsrc_card_priv *priv,
- */
- if (of_property_read_bool(np, "clocks")) {
- clk = of_clk_get(np, 0);
-- if (IS_ERR(clk)) {
-- ret = PTR_ERR(clk);
-- return ret;
-- }
-+ if (IS_ERR(clk))
-+ return PTR_ERR(clk);
-
- dai->sysclk = clk_get_rate(clk);
- dai->clk = clk;
---
-2.6.2
-
diff --git a/patches.renesas/0117-ASoC-rsrc-card-cleanup-for-DPCM.patch b/patches.renesas/0117-ASoC-rsrc-card-cleanup-for-DPCM.patch
deleted file mode 100644
index e40d0d6558c3a7..00000000000000
--- a/patches.renesas/0117-ASoC-rsrc-card-cleanup-for-DPCM.patch
+++ /dev/null
@@ -1,513 +0,0 @@
-From 67fba1e5a021d8830e07f94abc74fc04b1f39ee6 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:24:15 +0000
-Subject: [PATCH 117/129] ASoC: rsrc-card: cleanup for DPCM
-
-rsrc-card driver is based on simple-card driver which is caring about
-CPU / Codec connection. OTOH, rsrc-card is used for DPCM system.
-FE portion is constituted by CPU and dummy Codec, and BE is constituted
-by dummy CPU and Codec in DPCM system.
-Because of this, current rsrc-card is doing pointless method. It works well
-if FE/BE was 1:1, but not good for multi FE/BE.
-This patch cleanups rsrc-card driver for DPCM. and this is prepare for
-MIX support for Renesas sound driver.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 047000278da3a17f8cfd9b2662b47500ee84338f)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 324 ++++++++++++++++++------------------------
- 1 file changed, 135 insertions(+), 189 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index 52123d6ceec5..8caca2e180c3 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -45,23 +45,20 @@ static const struct of_device_id rsrc_card_of_match[] = {
- };
- MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
-
-+#define DAI_NAME_NUM 32
- struct rsrc_card_dai {
- unsigned int fmt;
- unsigned int sysclk;
- struct clk *clk;
-+ char dai_name[DAI_NAME_NUM];
- };
-
- #define IDX_CPU 0
- #define IDX_CODEC 1
--#define DAI_NAME_NUM 32
- struct rsrc_card_priv {
- struct snd_soc_card snd_card;
-- struct rsrc_card_dai_props {
-- struct rsrc_card_dai cpu_dai;
-- struct rsrc_card_dai codec_dai;
-- char dai_name[DAI_NAME_NUM];
-- } *dai_props;
- struct snd_soc_codec_conf codec_conf;
-+ struct rsrc_card_dai *dai_props;
- struct snd_soc_dai_link *dai_link;
- int dai_num;
- u32 convert_rate;
-@@ -76,31 +73,22 @@ static int rsrc_card_startup(struct snd_pcm_substream *substream)
- {
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
-- struct rsrc_card_dai_props *dai_props =
-+ struct rsrc_card_dai *dai_props =
- rsrc_priv_to_props(priv, rtd - rtd->card->rtd);
- int ret;
-
-- ret = clk_prepare_enable(dai_props->cpu_dai.clk);
-- if (ret)
-- return ret;
--
-- ret = clk_prepare_enable(dai_props->codec_dai.clk);
-- if (ret)
-- clk_disable_unprepare(dai_props->cpu_dai.clk);
-
-- return ret;
-+ return clk_prepare_enable(dai_props->clk);
- }
-
- static void rsrc_card_shutdown(struct snd_pcm_substream *substream)
- {
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
-- struct rsrc_card_dai_props *dai_props =
-+ struct rsrc_card_dai *dai_props =
- rsrc_priv_to_props(priv, rtd - rtd->card->rtd);
-
-- clk_disable_unprepare(dai_props->cpu_dai.clk);
--
-- clk_disable_unprepare(dai_props->codec_dai.clk);
-+ clk_disable_unprepare(dai_props->clk);
- }
-
- static struct snd_soc_ops rsrc_card_ops = {
-@@ -108,21 +96,31 @@ static struct snd_soc_ops rsrc_card_ops = {
- .shutdown = rsrc_card_shutdown,
- };
-
--static int __rsrc_card_dai_init(struct snd_soc_dai *dai,
-- struct rsrc_card_dai *set)
-+static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
- {
-+ struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
-+ struct snd_soc_dai *dai;
-+ struct snd_soc_dai_link *dai_link;
-+ struct rsrc_card_dai *dai_props;
-+ int num = rtd - rtd->card->rtd;
- int ret;
-
-- if (set->fmt) {
-- ret = snd_soc_dai_set_fmt(dai, set->fmt);
-+ dai_link = rsrc_priv_to_link(priv, num);
-+ dai_props = rsrc_priv_to_props(priv, num);
-+ dai = dai_link->dynamic ?
-+ rtd->cpu_dai :
-+ rtd->codec_dai;
-+
-+ if (dai_props->fmt) {
-+ ret = snd_soc_dai_set_fmt(dai, dai_props->fmt);
- if (ret && ret != -ENOTSUPP) {
- dev_err(dai->dev, "set_fmt error\n");
- goto err;
- }
- }
-
-- if (set->sysclk) {
-- ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
-+ if (dai_props->sysclk) {
-+ ret = snd_soc_dai_set_sysclk(dai, 0, dai_props->sysclk, 0);
- if (ret && ret != -ENOTSUPP) {
- dev_err(dai->dev, "set_sysclk error\n");
- goto err;
-@@ -135,27 +133,6 @@ err:
- return ret;
- }
-
--static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
--{
-- struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
-- struct snd_soc_dai *codec = rtd->codec_dai;
-- struct snd_soc_dai *cpu = rtd->cpu_dai;
-- struct rsrc_card_dai_props *dai_props;
-- int num, ret;
--
-- num = rtd - rtd->card->rtd;
-- dai_props = &priv->dai_props[num];
-- ret = __rsrc_card_dai_init(codec, &dai_props->codec_dai);
-- if (ret < 0)
-- return ret;
--
-- ret = __rsrc_card_dai_init(cpu, &dai_props->cpu_dai);
-- if (ret < 0)
-- return ret;
--
-- return 0;
--}
--
- static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params)
- {
-@@ -172,15 +149,14 @@ static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
- }
-
- static int rsrc_card_parse_daifmt(struct device_node *node,
-+ struct device_node *np,
- struct rsrc_card_priv *priv,
-- struct device_node *codec,
-- int idx)
-+ int idx, bool is_fe)
- {
-+ struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
- struct device_node *bitclkmaster = NULL;
- struct device_node *framemaster = NULL;
-- struct rsrc_card_dai_props *dai_props = rsrc_priv_to_props(priv, idx);
-- struct rsrc_card_dai *cpu_dai = &dai_props->cpu_dai;
-- struct rsrc_card_dai *codec_dai = &dai_props->codec_dai;
-+ struct device_node *codec = is_fe ? NULL : np;
- unsigned int daifmt;
-
- daifmt = snd_soc_of_parse_daifmt(node, NULL,
-@@ -197,8 +173,7 @@ static int rsrc_card_parse_daifmt(struct device_node *node,
- daifmt |= (codec == framemaster) ?
- SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-
-- cpu_dai->fmt = daifmt;
-- codec_dai->fmt = daifmt;
-+ dai_props->fmt = daifmt;
-
- of_node_put(bitclkmaster);
- of_node_put(framemaster);
-@@ -206,41 +181,15 @@ static int rsrc_card_parse_daifmt(struct device_node *node,
- return 0;
- }
-
--static int
--rsrc_card_sub_parse_of(struct rsrc_card_priv *priv,
-- struct device_node *np,
-- struct rsrc_card_dai *dai,
-- struct snd_soc_dai_link *dai_link,
-- int *args_count)
-+static int rsrc_card_parse_links(struct device_node *np,
-+ struct rsrc_card_priv *priv,
-+ int idx, bool is_fe)
- {
-- struct device *dev = rsrc_priv_to_dev(priv);
-- const struct rsrc_card_of_data *of_data = rsrc_dev_to_of_data(dev);
-+ struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-+ struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
- struct of_phandle_args args;
-- struct device_node **p_node;
-- struct clk *clk;
-- const char **dai_name;
-- const char **name;
-- u32 val;
- int ret;
-
-- if (args_count) {
-- p_node = &dai_link->cpu_of_node;
-- dai_name = &dai_link->cpu_dai_name;
-- name = &dai_link->cpu_name;
-- } else {
-- p_node = &dai_link->codec_of_node;
-- dai_name = &dai_link->codec_dai_name;
-- name = &dai_link->codec_name;
-- }
--
-- if (!np) {
-- /* use snd-soc-dummy */
-- *p_node = NULL;
-- *dai_name = "snd-soc-dummy-dai";
-- *name = "snd-soc-dummy";
-- return 0;
-- }
--
- /*
- * Get node via "sound-dai = <&phandle port>"
- * it will be used as xxx_of_node on soc_bind_dai_link()
-@@ -250,31 +199,82 @@ rsrc_card_sub_parse_of(struct rsrc_card_priv *priv,
- if (ret)
- return ret;
-
-- *p_node = args.np;
-+ if (is_fe) {
-+ /* BE is dummy */
-+ dai_link->codec_of_node = NULL;
-+ dai_link->codec_dai_name = "snd-soc-dummy-dai";
-+ dai_link->codec_name = "snd-soc-dummy";
-+
-+ /* FE settings */
-+ dai_link->dynamic = 1;
-+ dai_link->dpcm_merged_format = 1;
-+ dai_link->cpu_of_node = args.np;
-+ snd_soc_of_get_dai_name(np, &dai_link->cpu_dai_name);
-+
-+ /* set dai_name */
-+ snprintf(dai_props->dai_name, DAI_NAME_NUM, "fe.%s",
-+ dai_link->cpu_dai_name);
-+
-+ /*
-+ * In soc_bind_dai_link() will check cpu name after
-+ * of_node matching if dai_link has cpu_dai_name.
-+ * but, it will never match if name was created by
-+ * fmt_single_name() remove cpu_dai_name if cpu_args
-+ * was 0. See:
-+ * fmt_single_name()
-+ * fmt_multiple_name()
-+ */
-+ if (!args.args_count)
-+ dai_link->cpu_dai_name = NULL;
-+ } else {
-+ struct device *dev = rsrc_priv_to_dev(priv);
-+ const struct rsrc_card_of_data *of_data;
-
-- /* Get dai->name */
-- ret = snd_soc_of_get_dai_name(np, dai_name);
-- if (ret < 0)
-- return ret;
-+ of_data = rsrc_dev_to_of_data(dev);
-
-- /*
-- * FIXME
-- *
-- * rsrc assumes DPCM playback/capture
-- */
-- dai_link->dpcm_playback = 1;
-- dai_link->dpcm_capture = 1;
-+ /* FE is dummy */
-+ dai_link->cpu_of_node = NULL;
-+ dai_link->cpu_dai_name = "snd-soc-dummy-dai";
-+ dai_link->cpu_name = "snd-soc-dummy";
-
-- if (args_count) {
-- *args_count = args.args_count;
-- dai_link->dynamic = 1;
-- dai_link->dpcm_merged_format = 1;
-- } else {
-- dai_link->no_pcm = 1;
-- priv->codec_conf.of_node = (*p_node);
-- priv->codec_conf.name_prefix = of_data->prefix;
-+ /* BE settings */
-+ dai_link->no_pcm = 1;
-+ dai_link->be_hw_params_fixup = rsrc_card_be_hw_params_fixup;
-+ dai_link->codec_of_node = args.np;
-+ snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name);
-+
-+ /* additional name prefix */
-+ priv->codec_conf.of_node = dai_link->codec_of_node;
-+ priv->codec_conf.name_prefix = of_data->prefix;
-+
-+ /* set dai_name */
-+ snprintf(dai_props->dai_name, DAI_NAME_NUM, "be.%s",
-+ dai_link->codec_dai_name);
- }
-
-+ /* Simple Card assumes platform == cpu */
-+ dai_link->platform_of_node = dai_link->cpu_of_node;
-+ dai_link->dpcm_playback = 1;
-+ dai_link->dpcm_capture = 1;
-+ dai_link->name = dai_props->dai_name;
-+ dai_link->stream_name = dai_props->dai_name;
-+ dai_link->ops = &rsrc_card_ops;
-+ dai_link->init = rsrc_card_dai_init;
-+
-+ return 0;
-+}
-+
-+static int rsrc_card_parse_clk(struct device_node *np,
-+ struct rsrc_card_priv *priv,
-+ int idx, bool is_fe)
-+{
-+ struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-+ struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
-+ struct clk *clk;
-+ struct device_node *of_np = is_fe ? dai_link->cpu_of_node :
-+ dai_link->codec_of_node;
-+ u32 val;
-+
- /*
- * Parse dai->sysclk come from "clocks = <&xxx>"
- * (if system has common clock)
-@@ -286,103 +286,48 @@ rsrc_card_sub_parse_of(struct rsrc_card_priv *priv,
- if (IS_ERR(clk))
- return PTR_ERR(clk);
-
-- dai->sysclk = clk_get_rate(clk);
-- dai->clk = clk;
-+ dai_props->sysclk = clk_get_rate(clk);
-+ dai_props->clk = clk;
- } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
-- dai->sysclk = val;
-+ dai_props->sysclk = val;
- } else {
-- clk = of_clk_get(args.np, 0);
-+ clk = of_clk_get(of_np, 0);
- if (!IS_ERR(clk))
-- dai->sysclk = clk_get_rate(clk);
-+ dai_props->sysclk = clk_get_rate(clk);
- }
-
- return 0;
- }
-
- static int rsrc_card_dai_link_of(struct device_node *node,
-+ struct device_node *np,
- struct rsrc_card_priv *priv,
- int idx)
- {
- struct device *dev = rsrc_priv_to_dev(priv);
-- struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-- struct rsrc_card_dai_props *dai_props = rsrc_priv_to_props(priv, idx);
-- struct device_node *cpu = NULL;
-- struct device_node *codec = NULL;
-- char *name = dai_props->dai_name;
-- char prop[128];
-- int ret, cpu_args;
--
-- cpu = of_get_child_by_name(node, "cpu");
-- codec = of_get_child_by_name(node, "codec");
--
-- if (!cpu || !codec) {
-- ret = -EINVAL;
-- dev_err(dev, "%s: Can't find %s DT node\n", __func__, prop);
-- goto dai_link_of_err;
-- }
-+ struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
-+ bool is_fe = false;
-+ int ret;
-
-- ret = rsrc_card_parse_daifmt(node, priv, codec, idx);
-- if (ret < 0)
-- goto dai_link_of_err;
-+ if (0 == strcmp(np->name, "cpu"))
-+ is_fe = true;
-
-- ret = rsrc_card_sub_parse_of(priv, (idx == IDX_CPU) ? cpu : NULL,
-- &dai_props->cpu_dai,
-- dai_link,
-- &cpu_args);
-+ ret = rsrc_card_parse_daifmt(node, np, priv, idx, is_fe);
- if (ret < 0)
-- goto dai_link_of_err;
-+ return ret;
-
-- ret = rsrc_card_sub_parse_of(priv, (idx == IDX_CODEC) ? codec : NULL,
-- &dai_props->codec_dai,
-- dai_link,
-- NULL);
-+ ret = rsrc_card_parse_links(np, priv, idx, is_fe);
- if (ret < 0)
-- goto dai_link_of_err;
--
-- if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
-- ret = -EINVAL;
-- goto dai_link_of_err;
-- }
--
-- /* Simple Card assumes platform == cpu */
-- dai_link->platform_of_node = dai_link->cpu_of_node;
--
-- snprintf(name, DAI_NAME_NUM, "%s.%s",
-- dai_link->dynamic ? "fe" : "be",
-- dai_link->dynamic ? dai_link->cpu_dai_name :
-- dai_link->codec_dai_name);
-- dai_link->name = dai_link->stream_name = name;
-- dai_link->ops = &rsrc_card_ops;
-- dai_link->init = rsrc_card_dai_init;
--
-- if (idx == IDX_CODEC)
-- dai_link->be_hw_params_fixup = rsrc_card_be_hw_params_fixup;
--
-- dev_dbg(dev, "\tname : %s\n", dai_link->stream_name);
-- dev_dbg(dev, "\tcpu : %s / %04x / %d\n",
-- dai_link->cpu_dai_name,
-- dai_props->cpu_dai.fmt,
-- dai_props->cpu_dai.sysclk);
-- dev_dbg(dev, "\tcodec : %s / %04x / %d\n",
-- dai_link->codec_dai_name,
-- dai_props->codec_dai.fmt,
-- dai_props->codec_dai.sysclk);
-+ return ret;
-
-- /*
-- * In soc_bind_dai_link() will check cpu name after
-- * of_node matching if dai_link has cpu_dai_name.
-- * but, it will never match if name was created by
-- * fmt_single_name() remove cpu_dai_name if cpu_args
-- * was 0. See:
-- * fmt_single_name()
-- * fmt_multiple_name()
-- */
-- if (!cpu_args)
-- dai_link->cpu_dai_name = NULL;
-+ ret = rsrc_card_parse_clk(np, priv, idx, is_fe);
-+ if (ret < 0)
-+ return ret;
-
--dai_link_of_err:
-- of_node_put(cpu);
-- of_node_put(codec);
-+ dev_dbg(dev, "\t%s / %04x / %d\n",
-+ dai_props->dai_name,
-+ dai_props->fmt,
-+ dai_props->sysclk);
-
- return ret;
- }
-@@ -392,9 +337,9 @@ static int rsrc_card_parse_of(struct device_node *node,
- struct device *dev)
- {
- const struct rsrc_card_of_data *of_data = rsrc_dev_to_of_data(dev);
-- struct rsrc_card_dai_props *props;
-+ struct rsrc_card_dai *props;
- struct snd_soc_dai_link *links;
--
-+ struct device_node *np;
- int ret;
- int i, num;
-
-@@ -411,9 +356,6 @@ static int rsrc_card_parse_of(struct device_node *node,
- priv->dai_link = links;
- priv->dai_num = num;
-
-- /* Parse the card name from DT */
-- snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
--
- /* Init snd_soc_card */
- priv->snd_card.owner = THIS_MODULE;
- priv->snd_card.dev = dev;
-@@ -424,6 +366,9 @@ static int rsrc_card_parse_of(struct device_node *node,
- priv->snd_card.of_dapm_routes = of_data->routes;
- priv->snd_card.num_of_dapm_routes = of_data->num_routes;
-
-+ /* Parse the card name from DT */
-+ snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-+
- /* sampling rate convert */
- of_property_read_u32(node, "convert-rate", &priv->convert_rate);
-
-@@ -431,11 +376,12 @@ static int rsrc_card_parse_of(struct device_node *node,
- priv->snd_card.name ? priv->snd_card.name : "",
- priv->convert_rate);
-
-- /* FE/BE */
-- for (i = 0; i < num; i++) {
-- ret = rsrc_card_dai_link_of(node, priv, i);
-+ i = 0;
-+ for_each_child_of_node(node, np) {
-+ ret = rsrc_card_dai_link_of(node, np, priv, i);
- if (ret < 0)
- return ret;
-+ i++;
- }
-
- if (!priv->snd_card.name)
---
-2.6.2
-
diff --git a/patches.renesas/0118-ASoC-rsnd-count-each-mod-SSI-SRC-DVC.patch b/patches.renesas/0118-ASoC-rsnd-count-each-mod-SSI-SRC-DVC.patch
deleted file mode 100644
index 8ebc0db1532e0e..00000000000000
--- a/patches.renesas/0118-ASoC-rsnd-count-each-mod-SSI-SRC-DVC.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-From 48830323ccd0e2f6862a7036d3e7950b71c66a91 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:24:34 +0000
-Subject: [PATCH 118/129] ASoC: rsnd: count each mod (SSI/SRC/DVC)
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. Then, we don't need to re-call each mod function
-that had been called. This patch count each mod status.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 5451ea443bf8889a786ea394ac90a3de5af53e24)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 17 +++++++++++------
- sound/soc/sh/rcar/rsnd.h | 41 ++++++++++++++++++++++++++---------------
- 2 files changed, 37 insertions(+), 21 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 027b04392674..50ec28c24867 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -211,15 +211,20 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
- ({ \
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \
- struct device *dev = rsnd_priv_to_dev(priv); \
-- u32 mask = (1 << __rsnd_mod_shift_##func) & ~(1 << 31); \
-- u32 call = __rsnd_mod_call_##func << __rsnd_mod_shift_##func; \
-+ u32 mask = 0xF << __rsnd_mod_shift_##func; \
-+ u8 val = (mod->status >> __rsnd_mod_shift_##func) & 0xF; \
-+ u8 add = ((val + __rsnd_mod_add_##func) & 0xF); \
- int ret = 0; \
-- if ((mod->status & mask) == call) { \
-- dev_dbg(dev, "%s[%d] %s\n", \
-- rsnd_mod_name(mod), rsnd_mod_id(mod), #func); \
-+ int called = 0; \
-+ if (val == __rsnd_mod_call_##func) { \
-+ called = 1; \
- ret = (mod)->ops->func(mod, param); \
-- mod->status = (mod->status & ~mask) | (~call & mask); \
-+ mod->status = (mod->status & ~mask) + \
-+ (add << __rsnd_mod_shift_##func); \
- } \
-+ dev_dbg(dev, "%s[%d] 0x%08x %s\n", \
-+ rsnd_mod_name(mod), rsnd_mod_id(mod), mod->status, \
-+ called ? #func : ""); \
- ret; \
- })
-
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index e37234ea18e6..8a114cb41925 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -259,25 +259,36 @@ struct rsnd_mod {
- /*
- * status
- *
-- * bit
-- * 0 0: probe 1: remove
-- * 1 0: init 1: quit
-- * 2 0: start 1: stop
-- * 3 0: pcm_new
-- * 4 0: fallback
-+ * 0xH0000CBA
- *
-- * 31 bit is always called (see __rsnd_mod_call)
-- * 31 0: hw_params
-+ * A 0: probe 1: remove
-+ * B 0: init 1: quit
-+ * C 0: start 1: stop
-+ *
-+ * H is always called (see __rsnd_mod_call)
-+ * H 0: pcm_new
-+ * H 0: fallback
-+ * H 0: hw_params
- */
- #define __rsnd_mod_shift_probe 0
- #define __rsnd_mod_shift_remove 0
--#define __rsnd_mod_shift_init 1
--#define __rsnd_mod_shift_quit 1
--#define __rsnd_mod_shift_start 2
--#define __rsnd_mod_shift_stop 2
--#define __rsnd_mod_shift_pcm_new 3
--#define __rsnd_mod_shift_fallback 4
--#define __rsnd_mod_shift_hw_params 31 /* always called */
-+#define __rsnd_mod_shift_init 4
-+#define __rsnd_mod_shift_quit 4
-+#define __rsnd_mod_shift_start 8
-+#define __rsnd_mod_shift_stop 8
-+#define __rsnd_mod_shift_pcm_new 28 /* always called */
-+#define __rsnd_mod_shift_fallback 28 /* always called */
-+#define __rsnd_mod_shift_hw_params 28 /* always called */
-+
-+#define __rsnd_mod_add_probe 1
-+#define __rsnd_mod_add_remove -1
-+#define __rsnd_mod_add_init 1
-+#define __rsnd_mod_add_quit -1
-+#define __rsnd_mod_add_start 1
-+#define __rsnd_mod_add_stop -1
-+#define __rsnd_mod_add_pcm_new 0
-+#define __rsnd_mod_add_fallback 0
-+#define __rsnd_mod_add_hw_params 0
-
- #define __rsnd_mod_call_probe 0
- #define __rsnd_mod_call_remove 1
---
-2.6.2
-
diff --git a/patches.renesas/0119-ASoC-rsnd-rsnd_mod-has-rsnd_priv.patch b/patches.renesas/0119-ASoC-rsnd-rsnd_mod-has-rsnd_priv.patch
deleted file mode 100644
index d439f8da9fef4b..00000000000000
--- a/patches.renesas/0119-ASoC-rsnd-rsnd_mod-has-rsnd_priv.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From 2c93de8545b2a79eef277fde52032711cd589781 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:24:54 +0000
-Subject: [PATCH 119/129] ASoC: rsnd: rsnd_mod has rsnd_priv
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship. This means we can't use rsnd_mod_to_io() in SSI/SRC/DMA
-interrupt handler. In such case, we need to check all io in interrupt
-handler, and then, "priv" is needed.
-This patch adds rsnd_priv pointer in rsnd_mod for prepare it.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 2099bc8eb0b257196a8535fba343cb23a8a6807c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 4 +++-
- sound/soc/sh/rcar/dvc.c | 2 +-
- sound/soc/sh/rcar/rsnd.h | 6 ++++--
- sound/soc/sh/rcar/src.c | 2 +-
- sound/soc/sh/rcar/ssi.c | 2 +-
- 5 files changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 50ec28c24867..1e8d7e59998c 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -145,7 +145,8 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod)
- return mod->ops->dma_req(mod);
- }
-
--int rsnd_mod_init(struct rsnd_mod *mod,
-+int rsnd_mod_init(struct rsnd_priv *priv,
-+ struct rsnd_mod *mod,
- struct rsnd_mod_ops *ops,
- struct clk *clk,
- enum rsnd_mod_type type,
-@@ -160,6 +161,7 @@ int rsnd_mod_init(struct rsnd_mod *mod,
- mod->ops = ops;
- mod->type = type;
- mod->clk = clk;
-+ mod->priv = priv;
-
- return ret;
- }
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index e5fcb062ad77..2004bd00786b 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -366,7 +366,7 @@ int rsnd_dvc_probe(struct platform_device *pdev,
-
- dvc->info = &info->dvc_info[i];
-
-- ret = rsnd_mod_init(&dvc->mod, &rsnd_dvc_ops,
-+ ret = rsnd_mod_init(priv, &dvc->mod, &rsnd_dvc_ops,
- clk, RSND_MOD_DVC, i);
- if (ret)
- return ret;
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 8a114cb41925..4561b97d8834 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -253,6 +253,7 @@ struct rsnd_mod {
- struct rsnd_mod_ops *ops;
- struct rsnd_dma dma;
- struct rsnd_dai_stream *io;
-+ struct rsnd_priv *priv;
- struct clk *clk;
- u32 status;
- };
-@@ -300,14 +301,15 @@ struct rsnd_mod {
- #define __rsnd_mod_call_fallback 0
- #define __rsnd_mod_call_hw_params 0
-
--#define rsnd_mod_to_priv(mod) (rsnd_io_to_priv(rsnd_mod_to_io(mod)))
-+#define rsnd_mod_to_priv(mod) ((mod)->priv)
- #define rsnd_mod_to_dma(mod) (&(mod)->dma)
- #define rsnd_mod_to_io(mod) ((mod)->io)
- #define rsnd_mod_id(mod) ((mod)->id)
- #define rsnd_mod_hw_start(mod) clk_enable((mod)->clk)
- #define rsnd_mod_hw_stop(mod) clk_disable((mod)->clk)
-
--int rsnd_mod_init(struct rsnd_mod *mod,
-+int rsnd_mod_init(struct rsnd_priv *priv,
-+ struct rsnd_mod *mod,
- struct rsnd_mod_ops *ops,
- struct clk *clk,
- enum rsnd_mod_type type,
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index fbe9166e26d1..316d139b7176 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -1046,7 +1046,7 @@ int rsnd_src_probe(struct platform_device *pdev,
-
- src->info = &info->src_info[i];
-
-- ret = rsnd_mod_init(&src->mod, ops, clk, RSND_MOD_SRC, i);
-+ ret = rsnd_mod_init(priv, &src->mod, ops, clk, RSND_MOD_SRC, i);
- if (ret)
- return ret;
- }
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 25483211a349..16ced762aa0c 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -782,7 +782,7 @@ int rsnd_ssi_probe(struct platform_device *pdev,
- else if (rsnd_ssi_pio_available(ssi))
- ops = &rsnd_ssi_pio_ops;
-
-- ret = rsnd_mod_init(&ssi->mod, ops, clk, RSND_MOD_SSI, i);
-+ ret = rsnd_mod_init(priv, &ssi->mod, ops, clk, RSND_MOD_SSI, i);
- if (ret)
- return ret;
-
---
-2.6.2
-
diff --git a/patches.renesas/0120-ASoC-rsnd-adds-struct-rsnd_dai_stream-as-on-each-fuc.patch b/patches.renesas/0120-ASoC-rsnd-adds-struct-rsnd_dai_stream-as-on-each-fuc.patch
deleted file mode 100644
index 3d853a6b143d1d..00000000000000
--- a/patches.renesas/0120-ASoC-rsnd-adds-struct-rsnd_dai_stream-as-on-each-fuc.patch
+++ /dev/null
@@ -1,396 +0,0 @@
-From 89f7d62859f54a84b823493e99ac21fae728ab3c Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:25:20 +0000
-Subject: [PATCH 120/129] ASoC: rsnd: adds struct rsnd_dai_stream as on each
- fuction as parameter
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship. This means we can't call rsnd_mod_to_io() any more.
-This patch adds struct rsnd_dai_stream to each function as parameter.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 2c0fac19de2cd74181122f7e62f4ebffdd6f8fa3)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 10 +++++-----
- sound/soc/sh/rcar/dvc.c | 8 ++++++--
- sound/soc/sh/rcar/rsnd.h | 9 +++++++++
- sound/soc/sh/rcar/src.c | 12 +++++++++++-
- sound/soc/sh/rcar/ssi.c | 24 +++++++++++++++++-------
- 5 files changed, 48 insertions(+), 15 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 1e8d7e59998c..54297d74ea1f 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -209,7 +209,7 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
- /*
- * rsnd_dai functions
- */
--#define __rsnd_mod_call(mod, func, param...) \
-+#define __rsnd_mod_call(mod, io, func, param...) \
- ({ \
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \
- struct device *dev = rsnd_priv_to_dev(priv); \
-@@ -220,7 +220,7 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
- int called = 0; \
- if (val == __rsnd_mod_call_##func) { \
- called = 1; \
-- ret = (mod)->ops->func(mod, param); \
-+ ret = (mod)->ops->func(mod, io, param); \
- mod->status = (mod->status & ~mask) + \
- (add << __rsnd_mod_shift_##func); \
- } \
-@@ -230,10 +230,10 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
- ret; \
- })
-
--#define rsnd_mod_call(mod, func, param...) \
-+#define rsnd_mod_call(mod, io, func, param...) \
- (!(mod) ? -ENODEV : \
- !((mod)->ops->func) ? 0 : \
-- __rsnd_mod_call(mod, func, param))
-+ __rsnd_mod_call(mod, io, func, param))
-
- #define rsnd_dai_call(fn, io, param...) \
- ({ \
-@@ -243,7 +243,7 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
- mod = (io)->mod[i]; \
- if (!mod) \
- continue; \
-- ret = rsnd_mod_call(mod, fn, param); \
-+ ret = rsnd_mod_call(mod, io, fn, param); \
- if (ret < 0) \
- break; \
- } \
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index 2004bd00786b..52e75ebeb5b8 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -120,6 +120,7 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod)
- }
-
- static int rsnd_dvc_remove_gen2(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
-@@ -134,9 +135,9 @@ static int rsnd_dvc_remove_gen2(struct rsnd_mod *mod,
- }
-
- static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(dvc_mod);
- struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
- struct device *dev = rsnd_priv_to_dev(priv);
- int dvc_id = rsnd_mod_id(dvc_mod);
-@@ -181,6 +182,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
- }
-
- static int rsnd_dvc_quit(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- rsnd_mod_hw_stop(mod);
-@@ -189,6 +191,7 @@ static int rsnd_dvc_quit(struct rsnd_mod *mod,
- }
-
- static int rsnd_dvc_start(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- rsnd_mod_write(mod, CMD_CTRL, 0x10);
-@@ -197,6 +200,7 @@ static int rsnd_dvc_start(struct rsnd_mod *mod,
- }
-
- static int rsnd_dvc_stop(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- rsnd_mod_write(mod, CMD_CTRL, 0);
-@@ -205,9 +209,9 @@ static int rsnd_dvc_stop(struct rsnd_mod *mod,
- }
-
- static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- 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 is_play = rsnd_io_is_play(io);
- int ret;
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 4561b97d8834..fd93a6a25749 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -226,23 +226,32 @@ struct rsnd_mod_ops {
- char *name;
- struct dma_chan* (*dma_req)(struct rsnd_mod *mod);
- int (*probe)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv);
- int (*remove)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv);
- int (*init)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv);
- int (*quit)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv);
- int (*start)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv);
- int (*stop)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv);
- int (*pcm_new)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_soc_pcm_runtime *rtd);
- int (*hw_params)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *hw_params);
- int (*fallback)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv);
- };
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 316d139b7176..e28d9f6ddda6 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -316,6 +316,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod)
- }
-
- static int rsnd_src_hw_params(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *fe_params)
- {
-@@ -372,6 +373,7 @@ static int rsnd_src_init(struct rsnd_mod *mod,
- }
-
- static int rsnd_src_quit(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_src *src = rsnd_mod_to_src(mod);
-@@ -532,6 +534,7 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod)
- }
-
- static int rsnd_src_init_gen1(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- int ret;
-@@ -556,6 +559,7 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod,
- }
-
- static int rsnd_src_start_gen1(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- int id = rsnd_mod_id(mod);
-@@ -566,6 +570,7 @@ static int rsnd_src_start_gen1(struct rsnd_mod *mod,
- }
-
- static int rsnd_src_stop_gen1(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- int id = rsnd_mod_id(mod);
-@@ -781,6 +786,7 @@ static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod)
- }
-
- static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_src *src = rsnd_mod_to_src(mod);
-@@ -810,6 +816,7 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
- }
-
- static int rsnd_src_remove_gen2(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- rsnd_dma_quit(rsnd_mod_to_dma(mod));
-@@ -818,6 +825,7 @@ static int rsnd_src_remove_gen2(struct rsnd_mod *mod,
- }
-
- static int rsnd_src_init_gen2(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- int ret;
-@@ -838,6 +846,7 @@ static int rsnd_src_init_gen2(struct rsnd_mod *mod,
- }
-
- static int rsnd_src_start_gen2(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- rsnd_dma_start(rsnd_mod_to_dma(mod));
-@@ -846,6 +855,7 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
- }
-
- static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- int ret;
-@@ -878,10 +888,10 @@ static void rsnd_src_reconvert_update(struct rsnd_mod *mod)
- }
-
- static int rsnd_src_pcm_new(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_soc_pcm_runtime *rtd)
- {
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
- struct rsnd_src *src = rsnd_mod_to_src(mod);
- int ret;
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 16ced762aa0c..41ef475c4a57 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -281,10 +281,10 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi)
- * SSI mod common functions
- */
- static int rsnd_ssi_init(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
- struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
- u32 cr;
-@@ -332,6 +332,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
- }
-
- static int rsnd_ssi_quit(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-@@ -348,6 +349,7 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod,
- }
-
- static int rsnd_ssi_hw_params(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
- {
-@@ -371,7 +373,8 @@ static int rsnd_ssi_hw_params(struct rsnd_mod *mod,
- /* It will be removed on rsnd_ssi_hw_stop */
- ssi->chan = chan;
- if (ssi_parent)
-- return rsnd_ssi_hw_params(&ssi_parent->mod, substream, params);
-+ return rsnd_ssi_hw_params(&ssi_parent->mod, io,
-+ substream, params);
-
- return 0;
- }
-@@ -388,10 +391,10 @@ static void rsnd_ssi_record_error(struct rsnd_ssi *ssi, u32 status)
- }
-
- static int rsnd_ssi_start(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-
- rsnd_src_ssiu_start(mod, rsnd_ssi_use_busif(mod));
-
-@@ -403,6 +406,7 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
- }
-
- static int rsnd_ssi_stop(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-@@ -465,9 +469,9 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
- dev_dbg(dev, "%s[%d] restart\n",
- rsnd_mod_name(mod), rsnd_mod_id(mod));
-
-- rsnd_ssi_stop(mod, priv);
-+ rsnd_ssi_stop(mod, io, priv);
- if (ssi->err < 1024)
-- rsnd_ssi_start(mod, priv);
-+ rsnd_ssi_start(mod, io, priv);
- else
- dev_warn(dev, "no more SSI restart\n");
- }
-@@ -487,6 +491,7 @@ rsnd_ssi_interrupt_out:
- * SSI PIO
- */
- static int rsnd_ssi_pio_probe(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct device *dev = rsnd_priv_to_dev(priv);
-@@ -512,6 +517,7 @@ static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
- };
-
- static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-@@ -534,6 +540,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
- }
-
- static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-@@ -549,6 +556,7 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
- }
-
- static int rsnd_ssi_fallback(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct device *dev = rsnd_priv_to_dev(priv);
-@@ -569,23 +577,25 @@ static int rsnd_ssi_fallback(struct rsnd_mod *mod,
- }
-
- static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
-
- rsnd_dma_start(dma);
-
-- rsnd_ssi_start(mod, priv);
-+ rsnd_ssi_start(mod, io, priv);
-
- return 0;
- }
-
- static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
- struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
-
-- rsnd_ssi_stop(mod, priv);
-+ rsnd_ssi_stop(mod, io, priv);
-
- rsnd_dma_stop(dma);
-
---
-2.6.2
-
diff --git a/patches.renesas/0121-ASoC-rsnd-add-common-interrupt-handler-for-SSI-SRC-D.patch b/patches.renesas/0121-ASoC-rsnd-add-common-interrupt-handler-for-SSI-SRC-D.patch
deleted file mode 100644
index 9d5e3342cc437f..00000000000000
--- a/patches.renesas/0121-ASoC-rsnd-add-common-interrupt-handler-for-SSI-SRC-D.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-From 8fee8ad26cbd2382a06df16671aa03ee53082d9d Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:25:48 +0000
-Subject: [PATCH 121/129] ASoC: rsnd: add common interrupt handler for
- SSI/SRC/DMA
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship. Then, interrupt handler can't use rsnd_mod_to_io().
-This patch adds SSI/SRC/DMA common interrupt handler frame
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit f501b7a4e7ceb76a5d24cc0f75403072af5e85a0)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 23 +++++++++++++++++++++++
- sound/soc/sh/rcar/rsnd.h | 3 +++
- 2 files changed, 26 insertions(+)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 54297d74ea1f..424d1a31c471 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -172,6 +172,29 @@ void rsnd_mod_quit(struct rsnd_mod *mod)
- clk_unprepare(mod->clk);
- }
-
-+void rsnd_mod_interrupt(struct rsnd_mod *mod,
-+ void (*callback)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io))
-+{
-+ struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-+ struct rsnd_dai_stream *io;
-+ struct rsnd_dai *rdai;
-+ int i, j;
-+
-+ for_each_rsnd_dai(rdai, priv, j) {
-+
-+ for (i = 0; i < RSND_MOD_MAX; i++) {
-+ io = &rdai->playback;
-+ if (mod == io->mod[i])
-+ callback(mod, io);
-+
-+ io = &rdai->capture;
-+ if (mod == io->mod[i])
-+ callback(mod, io);
-+ }
-+ }
-+}
-+
- int rsnd_mod_is_working(struct rsnd_mod *mod)
- {
- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index fd93a6a25749..e6aad5e05fad 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -327,6 +327,9 @@ void rsnd_mod_quit(struct rsnd_mod *mod);
- char *rsnd_mod_name(struct rsnd_mod *mod);
- int rsnd_mod_is_working(struct rsnd_mod *mod);
- struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod);
-+void rsnd_mod_interrupt(struct rsnd_mod *mod,
-+ void (*callback)(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io));
-
- /*
- * R-Car sound DAI
---
-2.6.2
-
diff --git a/patches.renesas/0122-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_get_adinr.patch b/patches.renesas/0122-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_get_adinr.patch
deleted file mode 100644
index 586050b3a6bfec..00000000000000
--- a/patches.renesas/0122-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_get_adinr.patch
+++ /dev/null
@@ -1,215 +0,0 @@
-From a1e1f1684612ab3502bca93c4f4a7ed4ee3abde7 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:26:08 +0000
-Subject: [PATCH 122/129] ASoC: rsnd: don't use rsnd_mod_to_io() on
- rsnd_get_adinr()
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship. This patch removes rsnd_mod_to_io() from rsnd_get_adinr()
-and its related function
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 4e2639ff38d28dccdd8e7cf8f60181f0c17e10d3)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 3 +--
- sound/soc/sh/rcar/dvc.c | 2 +-
- sound/soc/sh/rcar/rsnd.h | 6 ++++--
- sound/soc/sh/rcar/src.c | 28 +++++++++++++++-------------
- sound/soc/sh/rcar/ssi.c | 4 ++--
- 5 files changed, 23 insertions(+), 20 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 424d1a31c471..e1d1b22f324f 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -206,10 +206,9 @@ int rsnd_mod_is_working(struct rsnd_mod *mod)
- /*
- * settting function
- */
--u32 rsnd_get_adinr(struct rsnd_mod *mod)
-+u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
- {
- 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 device *dev = rsnd_priv_to_dev(priv);
- u32 adinr = runtime->channels;
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index 52e75ebeb5b8..691bc632f0cb 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -169,7 +169,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
-
- rsnd_mod_write(dvc_mod, DVC_DVUIR, 1);
-
-- rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod));
-+ rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
-
- /* ch0/ch1 Volume */
- rsnd_dvc_volume_update(dvc_mod);
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index e6aad5e05fad..b40435d08757 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -165,7 +165,7 @@ void rsnd_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
- enum rsnd_reg reg, u32 data);
- void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
- u32 mask, u32 data);
--u32 rsnd_get_adinr(struct rsnd_mod *mod);
-+u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
-
- /*
- * R-Car DMA
-@@ -537,8 +537,10 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
- struct rsnd_dai_stream *io,
- struct snd_pcm_runtime *runtime);
- int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
-+ struct rsnd_dai_stream *io,
- int use_busif);
--int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod);
-+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
-+ struct rsnd_dai_stream *io);
- int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
- int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index e28d9f6ddda6..5693bb5c420b 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -129,9 +129,9 @@ static struct dma_chan *rsnd_src_dma_req(struct rsnd_mod *mod)
- }
-
- int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
-+ struct rsnd_dai_stream *io,
- int use_busif)
- {
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(ssi_mod);
- struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
- struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
- int ssi_id = rsnd_mod_id(ssi_mod);
-@@ -174,7 +174,7 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
- u32 mask = ~0;
-
- rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
-- rsnd_get_adinr(ssi_mod));
-+ rsnd_get_adinr(ssi_mod, io));
- rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE, 1);
- rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
-
-@@ -196,7 +196,8 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
- return 0;
- }
-
--int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod)
-+int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
-+ struct rsnd_dai_stream *io)
- {
- /*
- * DMA settings for SSIU
-@@ -283,9 +284,9 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
- return rate;
- }
-
--static int rsnd_src_set_convert_rate(struct rsnd_mod *mod)
-+static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io)
- {
-- 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);
- u32 convert_rate = rsnd_src_convert_rate(src);
-@@ -299,7 +300,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod)
- rsnd_mod_write(mod, SRC_SWRSR, 1);
-
- /* Set channel number and output bit length */
-- rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod));
-+ rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod, io));
-
- /* Enable the initial value of IFS */
- if (fsrate) {
-@@ -508,12 +509,13 @@ static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod)
- return 0;
- }
-
--static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod)
-+static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io)
- {
- struct rsnd_src *src = rsnd_mod_to_src(mod);
- int ret;
-
-- ret = rsnd_src_set_convert_rate(mod);
-+ ret = rsnd_src_set_convert_rate(mod, io);
- if (ret < 0)
- return ret;
-
-@@ -547,7 +549,7 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod,
- if (ret < 0)
- return ret;
-
-- ret = rsnd_src_set_convert_rate_gen1(mod);
-+ ret = rsnd_src_set_convert_rate_gen1(mod, io);
- if (ret < 0)
- return ret;
-
-@@ -706,11 +708,11 @@ rsnd_src_interrupt_gen2_out:
- return IRQ_HANDLED;
- }
-
--static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod)
-+static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io)
- {
- 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);
- u32 convert_rate = rsnd_src_convert_rate(src);
-@@ -731,7 +733,7 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod)
- return -EINVAL;
- }
-
-- ret = rsnd_src_set_convert_rate(mod);
-+ ret = rsnd_src_set_convert_rate(mod, io);
- if (ret < 0)
- return ret;
-
-@@ -834,7 +836,7 @@ static int rsnd_src_init_gen2(struct rsnd_mod *mod,
- if (ret < 0)
- return ret;
-
-- ret = rsnd_src_set_convert_rate_gen2(mod);
-+ ret = rsnd_src_set_convert_rate_gen2(mod, io);
- if (ret < 0)
- return ret;
-
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 41ef475c4a57..564e8290375c 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -396,7 +396,7 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
- {
- struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-
-- rsnd_src_ssiu_start(mod, rsnd_ssi_use_busif(mod));
-+ rsnd_src_ssiu_start(mod, io, rsnd_ssi_use_busif(mod));
-
- rsnd_ssi_hw_start(ssi, io);
-
-@@ -417,7 +417,7 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
-
- rsnd_ssi_hw_stop(ssi);
-
-- rsnd_src_ssiu_stop(mod);
-+ rsnd_src_ssiu_stop(mod, io);
-
- return 0;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0123-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_dma_xxx.patch b/patches.renesas/0123-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_dma_xxx.patch
deleted file mode 100644
index c5a43fc0450c74..00000000000000
--- a/patches.renesas/0123-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_dma_xxx.patch
+++ /dev/null
@@ -1,534 +0,0 @@
-From ed51f2a6b6acf891b352204b8981d0c77ba5354c Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:26:25 +0000
-Subject: [PATCH 123/129] ASoC: rsnd: don't use rsnd_mod_to_io() on
- rsnd_dma_xxx()
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship. This patch removes rsnd_mod_to_io() from rsnd_dma_xxx()
-and related function
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 9b99e9a7c5057684104178bb6c3815fcb2f13be4)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 5 ++-
- sound/soc/sh/rcar/dma.c | 102 ++++++++++++++++++++++++++---------------------
- sound/soc/sh/rcar/dvc.c | 3 +-
- sound/soc/sh/rcar/rsnd.h | 22 +++++-----
- sound/soc/sh/rcar/src.c | 12 +++---
- sound/soc/sh/rcar/ssi.c | 12 +++---
- 6 files changed, 85 insertions(+), 71 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index e1d1b22f324f..daa01e2aebb6 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -137,12 +137,13 @@ char *rsnd_mod_name(struct rsnd_mod *mod)
- return mod->ops->name;
- }
-
--struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod)
-+struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
- if (!mod || !mod->ops || !mod->ops->dma_req)
- return NULL;
-
-- return mod->ops->dma_req(mod);
-+ return mod->ops->dma_req(io, mod);
- }
-
- int rsnd_mod_init(struct rsnd_priv *priv,
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index ac19ab161c63..a4ac51003a57 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -32,12 +32,10 @@ struct rsnd_dma_ctrl {
- /*
- * Audio DMAC
- */
--static void rsnd_dmaen_complete(void *data)
-+static void __rsnd_dmaen_complete(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io)
- {
-- 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(mod);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- bool elapsed = false;
- unsigned long flags;
-
-@@ -54,7 +52,8 @@ static void rsnd_dmaen_complete(void *data)
- */
- spin_lock_irqsave(&priv->lock, flags);
-
-- elapsed = rsnd_dai_pointer_update(io, io->byte_per_period);
-+ if (rsnd_mod_is_working(mod))
-+ elapsed = rsnd_dai_pointer_update(io, io->byte_per_period);
-
- spin_unlock_irqrestore(&priv->lock, flags);
-
-@@ -62,19 +61,25 @@ static void rsnd_dmaen_complete(void *data)
- rsnd_dai_period_elapsed(io);
- }
-
--static void rsnd_dmaen_stop(struct rsnd_dma *dma)
-+static void rsnd_dmaen_complete(void *data)
-+{
-+ struct rsnd_mod *mod = data;
-+
-+ rsnd_mod_interrupt(mod, __rsnd_dmaen_complete);
-+}
-+
-+static void rsnd_dmaen_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
- {
- struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
-
- dmaengine_terminate_all(dmaen->chan);
- }
-
--static void rsnd_dmaen_start(struct rsnd_dma *dma)
-+static void rsnd_dmaen_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
- {
- struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(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_substream *substream = io->substream;
- struct device *dev = rsnd_priv_to_dev(priv);
- struct dma_async_tx_descriptor *desc;
-@@ -93,7 +98,7 @@ static void rsnd_dmaen_start(struct rsnd_dma *dma)
- }
-
- desc->callback = rsnd_dmaen_complete;
-- desc->callback_param = dma;
-+ desc->callback_param = mod;
-
- if (dmaengine_submit(desc) < 0) {
- dev_err(dev, "dmaengine_submit() fail\n");
-@@ -124,7 +129,8 @@ struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
- return chan;
- }
-
--static struct dma_chan *rsnd_dmaen_request_channel(struct rsnd_mod *mod_from,
-+static struct dma_chan *rsnd_dmaen_request_channel(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod_from,
- struct rsnd_mod *mod_to)
- {
- if ((!mod_from && !mod_to) ||
-@@ -132,19 +138,19 @@ static struct dma_chan *rsnd_dmaen_request_channel(struct rsnd_mod *mod_from,
- return NULL;
-
- if (mod_from)
-- return rsnd_mod_dma_req(mod_from);
-+ return rsnd_mod_dma_req(io, mod_from);
- else
-- return rsnd_mod_dma_req(mod_to);
-+ return rsnd_mod_dma_req(io, mod_to);
- }
-
--static int rsnd_dmaen_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id,
-+static int rsnd_dmaen_init(struct rsnd_dai_stream *io,
-+ struct rsnd_dma *dma, int id,
- struct rsnd_mod *mod_from, struct rsnd_mod *mod_to)
- {
- struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
-+ struct rsnd_priv *priv = rsnd_io_to_priv(io);
- struct device *dev = rsnd_priv_to_dev(priv);
- struct dma_slave_config cfg = {};
-- struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- int is_play = rsnd_io_is_play(io);
- int ret;
-
-@@ -154,7 +160,7 @@ static int rsnd_dmaen_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id,
- }
-
- if (dev->of_node) {
-- dmaen->chan = rsnd_dmaen_request_channel(mod_from, mod_to);
-+ dmaen->chan = rsnd_dmaen_request_channel(io, mod_from, mod_to);
- } else {
- dma_cap_mask_t mask;
-
-@@ -186,7 +192,7 @@ static int rsnd_dmaen_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id,
- return 0;
-
- rsnd_dma_init_err:
-- rsnd_dma_quit(dma);
-+ rsnd_dma_quit(io, dma);
- rsnd_dma_channel_err:
-
- /*
-@@ -198,7 +204,7 @@ rsnd_dma_channel_err:
- return -EAGAIN;
- }
-
--static void rsnd_dmaen_quit(struct rsnd_dma *dma)
-+static void rsnd_dmaen_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
- {
- struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
-
-@@ -247,9 +253,9 @@ static const u8 gen2_id_table_cmd[] = {
- 0x38, /* SCU_CMD1 */
- };
-
--static u32 rsnd_dmapp_get_id(struct rsnd_mod *mod)
-+static u32 rsnd_dmapp_get_id(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
- struct rsnd_mod *src = rsnd_io_to_mod_src(io);
- struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
-@@ -277,11 +283,12 @@ static u32 rsnd_dmapp_get_id(struct rsnd_mod *mod)
- return entry[id];
- }
-
--static u32 rsnd_dmapp_get_chcr(struct rsnd_mod *mod_from,
-+static u32 rsnd_dmapp_get_chcr(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod_from,
- struct rsnd_mod *mod_to)
- {
-- return (rsnd_dmapp_get_id(mod_from) << 24) +
-- (rsnd_dmapp_get_id(mod_to) << 16);
-+ return (rsnd_dmapp_get_id(io, mod_from) << 24) +
-+ (rsnd_dmapp_get_id(io, mod_to) << 16);
- }
-
- #define rsnd_dmapp_addr(dmac, dma, reg) \
-@@ -308,7 +315,7 @@ static u32 rsnd_dmapp_read(struct rsnd_dma *dma, u32 reg)
- return ioread32(rsnd_dmapp_addr(dmac, dma, reg));
- }
-
--static void rsnd_dmapp_stop(struct rsnd_dma *dma)
-+static void rsnd_dmapp_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
- {
- int i;
-
-@@ -321,7 +328,7 @@ static void rsnd_dmapp_stop(struct rsnd_dma *dma)
- }
- }
-
--static void rsnd_dmapp_start(struct rsnd_dma *dma)
-+static void rsnd_dmapp_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
- {
- struct rsnd_dmapp *dmapp = rsnd_dma_to_dmapp(dma);
-
-@@ -330,19 +337,21 @@ static void rsnd_dmapp_start(struct rsnd_dma *dma)
- rsnd_dmapp_write(dma, dmapp->chcr, PDMACHCR);
- }
-
--static int rsnd_dmapp_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id,
-+static int rsnd_dmapp_init(struct rsnd_dai_stream *io,
-+ struct rsnd_dma *dma, int id,
- struct rsnd_mod *mod_from, struct rsnd_mod *mod_to)
- {
- struct rsnd_dmapp *dmapp = rsnd_dma_to_dmapp(dma);
-+ struct rsnd_priv *priv = rsnd_io_to_priv(io);
- struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
- struct device *dev = rsnd_priv_to_dev(priv);
-
- dmapp->dmapp_id = dmac->dmapp_num;
-- dmapp->chcr = rsnd_dmapp_get_chcr(mod_from, mod_to) | PDMACHCR_DE;
-+ dmapp->chcr = rsnd_dmapp_get_chcr(io, mod_from, mod_to) | PDMACHCR_DE;
-
- dmac->dmapp_num++;
-
-- rsnd_dmapp_stop(dma);
-+ rsnd_dmapp_stop(io, dma);
-
- dev_dbg(dev, "id/src/dst/chcr = %d/%pad/%pad/%08x\n",
- dmapp->dmapp_id, &dma->src_addr, &dma->dst_addr, dmapp->chcr);
-@@ -395,12 +404,12 @@ static struct rsnd_dma_ops rsnd_dmapp_ops = {
- #define RDMA_CMD_O_P(addr, i) (addr ##_reg - 0x001f8000 + (0x400 * i))
-
- static dma_addr_t
--rsnd_gen2_dma_addr(struct rsnd_priv *priv,
-+rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
- struct rsnd_mod *mod,
- int is_play, int is_from)
- {
-+ struct rsnd_priv *priv = rsnd_io_to_priv(io);
- struct device *dev = rsnd_priv_to_dev(priv);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- phys_addr_t ssi_reg = rsnd_gen_get_phy_addr(priv, RSND_GEN2_SSI);
- phys_addr_t src_reg = rsnd_gen_get_phy_addr(priv, RSND_GEN2_SCU);
- int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
-@@ -455,10 +464,12 @@ rsnd_gen2_dma_addr(struct rsnd_priv *priv,
- dma_addrs[is_ssi][is_play][use_src + use_dvc].in_addr;
- }
-
--static dma_addr_t rsnd_dma_addr(struct rsnd_priv *priv,
-+static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream *io,
- struct rsnd_mod *mod,
- int is_play, int is_from)
- {
-+ struct rsnd_priv *priv = rsnd_io_to_priv(io);
-+
- /*
- * gen1 uses default DMA addr
- */
-@@ -468,17 +479,17 @@ static dma_addr_t rsnd_dma_addr(struct rsnd_priv *priv,
- if (!mod)
- return 0;
-
-- return rsnd_gen2_dma_addr(priv, mod, is_play, is_from);
-+ return rsnd_gen2_dma_addr(io, mod, is_play, is_from);
- }
-
- #define MOD_MAX 4 /* MEM/SSI/SRC/DVC */
- static void rsnd_dma_of_path(struct rsnd_dma *dma,
-+ struct rsnd_dai_stream *io,
- 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);
- struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
- struct rsnd_mod *src = rsnd_io_to_mod_src(io);
- struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
-@@ -533,17 +544,17 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
- }
- }
-
--void rsnd_dma_stop(struct rsnd_dma *dma)
-+void rsnd_dma_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
- {
-- dma->ops->stop(dma);
-+ dma->ops->stop(io, dma);
- }
-
--void rsnd_dma_start(struct rsnd_dma *dma)
-+void rsnd_dma_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
- {
-- dma->ops->start(dma);
-+ dma->ops->start(io, dma);
- }
-
--void rsnd_dma_quit(struct rsnd_dma *dma)
-+void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
- {
- struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-@@ -552,15 +563,14 @@ void rsnd_dma_quit(struct rsnd_dma *dma)
- if (!dmac)
- return;
-
-- dma->ops->quit(dma);
-+ dma->ops->quit(io, dma);
- }
-
--int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id)
-+int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
- {
-- struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
- struct rsnd_mod *mod_from;
- struct rsnd_mod *mod_to;
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
-+ struct rsnd_priv *priv = rsnd_io_to_priv(io);
- struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
- int is_play = rsnd_io_is_play(io);
-
-@@ -573,10 +583,10 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id)
- if (!dmac)
- return -EAGAIN;
-
-- rsnd_dma_of_path(dma, is_play, &mod_from, &mod_to);
-+ rsnd_dma_of_path(dma, io, is_play, &mod_from, &mod_to);
-
-- dma->src_addr = rsnd_dma_addr(priv, mod_from, is_play, 1);
-- dma->dst_addr = rsnd_dma_addr(priv, mod_to, is_play, 0);
-+ dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1);
-+ dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0);
-
- /* for Gen2 */
- if (mod_from && mod_to)
-@@ -588,7 +598,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id)
- if (rsnd_is_gen1(priv))
- dma->ops = &rsnd_dmaen_ops;
-
-- return dma->ops->init(priv, dma, id, mod_from, mod_to);
-+ return dma->ops->init(io, dma, id, mod_from, mod_to);
- }
-
- int rsnd_dma_probe(struct platform_device *pdev,
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index 691bc632f0cb..3aac790534f0 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -265,7 +265,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
- return 0;
- }
-
--static struct dma_chan *rsnd_dvc_dma_req(struct rsnd_mod *mod)
-+static struct dma_chan *rsnd_dvc_dma_req(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index b40435d08757..19d0d8b2b9af 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -172,11 +172,11 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
- */
- struct rsnd_dma;
- struct rsnd_dma_ops {
-- void (*start)(struct rsnd_dma *dma);
-- void (*stop)(struct rsnd_dma *dma);
-- int (*init)(struct rsnd_priv *priv, struct rsnd_dma *dma, int id,
-+ void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-+ void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-+ int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
- struct rsnd_mod *mod_from, struct rsnd_mod *mod_to);
-- void (*quit)(struct rsnd_dma *dma);
-+ void (*quit)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
- };
-
- struct rsnd_dmaen {
-@@ -200,10 +200,10 @@ struct rsnd_dma {
- #define rsnd_dma_to_dmaen(dma) (&(dma)->dma.en)
- #define rsnd_dma_to_dmapp(dma) (&(dma)->dma.pp)
-
--void rsnd_dma_start(struct rsnd_dma *dma);
--void rsnd_dma_stop(struct rsnd_dma *dma);
--int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id);
--void rsnd_dma_quit(struct rsnd_dma *dma);
-+void rsnd_dma_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-+void rsnd_dma_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-+int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id);
-+void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
- int rsnd_dma_probe(struct platform_device *pdev,
- const struct rsnd_of_data *of_data,
- struct rsnd_priv *priv);
-@@ -224,7 +224,8 @@ enum rsnd_mod_type {
-
- struct rsnd_mod_ops {
- char *name;
-- struct dma_chan* (*dma_req)(struct rsnd_mod *mod);
-+ struct dma_chan* (*dma_req)(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod);
- int (*probe)(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io,
- struct rsnd_priv *priv);
-@@ -326,7 +327,8 @@ int rsnd_mod_init(struct rsnd_priv *priv,
- void rsnd_mod_quit(struct rsnd_mod *mod);
- char *rsnd_mod_name(struct rsnd_mod *mod);
- int rsnd_mod_is_working(struct rsnd_mod *mod);
--struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod);
-+struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod);
- void rsnd_mod_interrupt(struct rsnd_mod *mod,
- void (*callback)(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io));
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 5693bb5c420b..62216196af9c 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -117,10 +117,10 @@ struct rsnd_src {
- /*
- * Gen1/Gen2 common functions
- */
--static struct dma_chan *rsnd_src_dma_req(struct rsnd_mod *mod)
-+static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- int is_play = rsnd_io_is_play(io);
-
- return rsnd_dma_request_channel(rsnd_src_of_node(priv),
-@@ -810,7 +810,7 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
- return ret;
- }
-
-- ret = rsnd_dma_init(priv,
-+ ret = rsnd_dma_init(io,
- rsnd_mod_to_dma(mod),
- src->info->dma_id);
-
-@@ -821,7 +821,7 @@ static int rsnd_src_remove_gen2(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
-- rsnd_dma_quit(rsnd_mod_to_dma(mod));
-+ rsnd_dma_quit(io, rsnd_mod_to_dma(mod));
-
- return 0;
- }
-@@ -851,7 +851,7 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
-- rsnd_dma_start(rsnd_mod_to_dma(mod));
-+ rsnd_dma_start(io, rsnd_mod_to_dma(mod));
-
- return _rsnd_src_start_gen2(mod);
- }
-@@ -864,7 +864,7 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
-
- ret = _rsnd_src_stop_gen2(mod);
-
-- rsnd_dma_stop(rsnd_mod_to_dma(mod));
-+ rsnd_dma_stop(io, rsnd_mod_to_dma(mod));
-
- return ret;
- }
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 564e8290375c..0a32544d6f75 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -533,7 +533,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
- return ret;
-
- ret = rsnd_dma_init(
-- priv, rsnd_mod_to_dma(mod),
-+ io, rsnd_mod_to_dma(mod),
- dma_id);
-
- return ret;
-@@ -547,7 +547,7 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
- struct device *dev = rsnd_priv_to_dev(priv);
- int irq = ssi->info->irq;
-
-- rsnd_dma_quit(rsnd_mod_to_dma(mod));
-+ rsnd_dma_quit(io, rsnd_mod_to_dma(mod));
-
- /* PIO will request IRQ again */
- devm_free_irq(dev, irq, ssi);
-@@ -582,7 +582,7 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
- {
- struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
-
-- rsnd_dma_start(dma);
-+ rsnd_dma_start(io, dma);
-
- rsnd_ssi_start(mod, io, priv);
-
-@@ -597,15 +597,15 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
-
- rsnd_ssi_stop(mod, io, priv);
-
-- rsnd_dma_stop(dma);
-+ rsnd_dma_stop(io, dma);
-
- return 0;
- }
-
--static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_mod *mod)
-+static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- int is_play = rsnd_io_is_play(io);
- char *name;
-
---
-2.6.2
-
diff --git a/patches.renesas/0124-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_ssi_xxx.patch b/patches.renesas/0124-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_ssi_xxx.patch
deleted file mode 100644
index 1c580ec95e9a34..00000000000000
--- a/patches.renesas/0124-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_ssi_xxx.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-From c094a04f53cbe99dcc698eba202b1f75ca98d249 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:26:56 +0000
-Subject: [PATCH 124/129] ASoC: rsnd: don't use rsnd_mod_to_io() on
- rsnd_ssi_xxx()
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship. This patch removes rsnd_mod_to_io() from rsnd_ssi_xxx()
-and related function.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit bfc0cfe6b7acb1d0c318f9bc41fcb895a941f83d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dma.c | 2 +-
- sound/soc/sh/rcar/rsnd.h | 2 +-
- sound/soc/sh/rcar/ssi.c | 32 ++++++++++++++++++--------------
- 3 files changed, 20 insertions(+), 16 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index a4ac51003a57..48b87bb10322 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -456,7 +456,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
- dev_err(dev, "DVC is selected without SRC\n");
-
- /* use SSIU or SSI ? */
-- if (is_ssi && rsnd_ssi_use_busif(mod))
-+ if (is_ssi && rsnd_ssi_use_busif(io, mod))
- is_ssi++;
-
- return (is_from) ?
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 19d0d8b2b9af..ac03d2008ee8 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -559,7 +559,7 @@ void rsnd_ssi_remove(struct platform_device *pdev,
- struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
- int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
- int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
--int rsnd_ssi_use_busif(struct rsnd_mod *mod);
-+int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
-
- /*
- * R-Car DVC
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 0a32544d6f75..fa1f2e5b9070 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -87,10 +87,9 @@ struct rsnd_ssi {
- #define rsnd_ssi_of_node(priv) \
- of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,ssi")
-
--int rsnd_ssi_use_busif(struct rsnd_mod *mod)
-+int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, 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_is_dma_mode(mod))
-@@ -226,10 +225,9 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
- rsnd_mod_name(&ssi->mod), rsnd_mod_id(&ssi->mod));
- }
-
--static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi)
-+static void rsnd_ssi_hw_stop(struct rsnd_dai_stream *io, struct rsnd_ssi *ssi)
- {
- struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(&ssi->mod);
- struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
- struct device *dev = rsnd_priv_to_dev(priv);
- u32 cr;
-@@ -263,7 +261,7 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi)
- struct rsnd_ssi *ssi_parent = rsnd_ssi_parent(ssi);
-
- if (ssi_parent)
-- rsnd_ssi_hw_stop(ssi_parent);
-+ rsnd_ssi_hw_stop(io, ssi_parent);
- else
- rsnd_ssi_master_clk_stop(ssi);
- }
-@@ -396,7 +394,7 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
- {
- struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-
-- rsnd_src_ssiu_start(mod, io, rsnd_ssi_use_busif(mod));
-+ rsnd_src_ssiu_start(mod, io, rsnd_ssi_use_busif(io, mod));
-
- rsnd_ssi_hw_start(ssi, io);
-
-@@ -415,19 +413,18 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
-
- rsnd_ssi_record_error(ssi, rsnd_mod_read(mod, SSISR));
-
-- rsnd_ssi_hw_stop(ssi);
-+ rsnd_ssi_hw_stop(io, ssi);
-
- rsnd_src_ssiu_stop(mod, io);
-
- return 0;
- }
-
--static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
-+static void __rsnd_ssi_interrupt(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io)
- {
-- struct rsnd_ssi *ssi = data;
-- struct rsnd_mod *mod = &ssi->mod;
-+ struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- int is_dma = rsnd_ssi_is_dma_mode(mod);
- u32 status;
- bool elapsed = false;
-@@ -483,6 +480,13 @@ rsnd_ssi_interrupt_out:
-
- if (elapsed)
- rsnd_dai_period_elapsed(io);
-+}
-+
-+static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
-+{
-+ struct rsnd_mod *mod = data;
-+
-+ rsnd_mod_interrupt(mod, __rsnd_ssi_interrupt);
-
- return IRQ_HANDLED;
- }
-@@ -501,7 +505,7 @@ static int rsnd_ssi_pio_probe(struct rsnd_mod *mod,
- ret = devm_request_irq(dev, ssi->info->irq,
- rsnd_ssi_interrupt,
- IRQF_SHARED,
-- dev_name(dev), ssi);
-+ dev_name(dev), mod);
-
- return ret;
- }
-@@ -528,7 +532,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
- ret = devm_request_irq(dev, ssi->info->irq,
- rsnd_ssi_interrupt,
- IRQF_SHARED,
-- dev_name(dev), ssi);
-+ dev_name(dev), mod);
- if (ret)
- return ret;
-
-@@ -609,7 +613,7 @@ static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io,
- int is_play = rsnd_io_is_play(io);
- char *name;
-
-- if (rsnd_ssi_use_busif(mod))
-+ if (rsnd_ssi_use_busif(io, mod))
- name = is_play ? "rxu" : "txu";
- else
- name = is_play ? "rx" : "tx";
---
-2.6.2
-
diff --git a/patches.renesas/0125-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_src_xxx.patch b/patches.renesas/0125-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_src_xxx.patch
deleted file mode 100644
index 3e747a34e11355..00000000000000
--- a/patches.renesas/0125-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_src_xxx.patch
+++ /dev/null
@@ -1,212 +0,0 @@
-From 46bde161596dbc769df6e8f60de78d3e4b0fedb1 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:27:13 +0000
-Subject: [PATCH 125/129] ASoC: rsnd: don't use rsnd_mod_to_io() on
- rsnd_src_xxx()
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship. This patch removes rsnd_mod_to_io() from rsnd_src_xxx()
-and related function.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 88c61cff4dab7c23a101b12041c99da61df305dd)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/src.c | 57 +++++++++++++++++++++++++++----------------------
- 1 file changed, 32 insertions(+), 25 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 62216196af9c..bc122ede3254 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -236,10 +236,9 @@ int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod)
- return 0;
- }
-
--static u32 rsnd_src_convert_rate(struct rsnd_src *src)
-+static u32 rsnd_src_convert_rate(struct rsnd_dai_stream *io,
-+ struct rsnd_src *src)
- {
-- struct rsnd_mod *mod = &src->mod;
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
- u32 convert_rate;
-
-@@ -275,7 +274,7 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
- * return convert rate if SRC is used,
- * otherwise, return runtime->rate as usual
- */
-- rate = rsnd_src_convert_rate(src);
-+ rate = rsnd_src_convert_rate(io, src);
- }
-
- if (!rate)
-@@ -289,7 +288,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
- {
- struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
- struct rsnd_src *src = rsnd_mod_to_src(mod);
-- u32 convert_rate = rsnd_src_convert_rate(src);
-+ u32 convert_rate = rsnd_src_convert_rate(io, src);
- u32 fsrate = 0;
-
- if (convert_rate)
-@@ -414,9 +413,9 @@ static int rsnd_src_stop(struct rsnd_mod *mod)
- /*
- * Gen1 functions
- */
--static int rsnd_src_set_route_gen1(struct rsnd_mod *mod)
-+static int rsnd_src_set_route_gen1(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- struct src_route_config {
- u32 mask;
- int shift;
-@@ -451,13 +450,13 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod)
- return 0;
- }
-
--static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod)
-+static int rsnd_src_set_convert_timing_gen1(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
- struct rsnd_src *src = rsnd_mod_to_src(mod);
- struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-- u32 convert_rate = rsnd_src_convert_rate(src);
-+ u32 convert_rate = rsnd_src_convert_rate(io, src);
- u32 mask;
- u32 val;
- int shift;
-@@ -527,7 +526,7 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
- rsnd_mod_read(mod, SRC_IFSVR) / 100 * 98);
-
- /* Gen1/Gen2 are not compatible */
-- if (rsnd_src_convert_rate(src))
-+ if (rsnd_src_convert_rate(io, src))
- rsnd_mod_write(mod, SRC_ROUTE_MODE0, 1);
-
- /* no SRC_BFSSR settings, since SRC_SRCCR::BUFMD is 0 */
-@@ -545,7 +544,7 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod,
- if (ret < 0)
- return ret;
-
-- ret = rsnd_src_set_route_gen1(mod);
-+ ret = rsnd_src_set_route_gen1(io, mod);
- if (ret < 0)
- return ret;
-
-@@ -553,7 +552,7 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod,
- if (ret < 0)
- return ret;
-
-- ret = rsnd_src_set_convert_timing_gen1(mod);
-+ ret = rsnd_src_set_convert_timing_gen1(io, mod);
- if (ret < 0)
- return ret;
-
-@@ -650,9 +649,9 @@ static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
- return ret;
- }
-
--static int _rsnd_src_start_gen2(struct rsnd_mod *mod)
-+static int _rsnd_src_start_gen2(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io)
- {
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
- u32 val = rsnd_io_to_mod_dvc(io) ? 0x01 : 0x11;
-
- rsnd_mod_write(mod, SRC_CTRL, val);
-@@ -677,9 +676,9 @@ static int _rsnd_src_stop_gen2(struct rsnd_mod *mod)
- return rsnd_src_stop(mod);
- }
-
--static irqreturn_t rsnd_src_interrupt_gen2(int irq, void *data)
-+static void __rsnd_src_interrupt_gen2(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io)
- {
-- struct rsnd_mod *mod = data;
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-
- spin_lock(&priv->lock);
-@@ -698,12 +697,20 @@ static irqreturn_t rsnd_src_interrupt_gen2(int irq, void *data)
-
- _rsnd_src_stop_gen2(mod);
- if (src->err < 1024)
-- _rsnd_src_start_gen2(mod);
-+ _rsnd_src_start_gen2(mod, io);
- else
- dev_warn(dev, "no more SRC restart\n");
- }
-+
- rsnd_src_interrupt_gen2_out:
- spin_unlock(&priv->lock);
-+}
-+
-+static irqreturn_t rsnd_src_interrupt_gen2(int irq, void *data)
-+{
-+ struct rsnd_mod *mod = data;
-+
-+ rsnd_mod_interrupt(mod, __rsnd_src_interrupt_gen2);
-
- return IRQ_HANDLED;
- }
-@@ -715,7 +722,7 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
- struct device *dev = rsnd_priv_to_dev(priv);
- struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
- struct rsnd_src *src = rsnd_mod_to_src(mod);
-- u32 convert_rate = rsnd_src_convert_rate(src);
-+ u32 convert_rate = rsnd_src_convert_rate(io, src);
- u32 cr, route;
- uint ratio;
- int ret;
-@@ -769,12 +776,12 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
- return 0;
- }
-
--static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod)
-+static int rsnd_src_set_convert_timing_gen2(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
-- 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);
-- u32 convert_rate = rsnd_src_convert_rate(src);
-+ u32 convert_rate = rsnd_src_convert_rate(io, src);
- int ret;
-
- if (convert_rate)
-@@ -840,7 +847,7 @@ static int rsnd_src_init_gen2(struct rsnd_mod *mod,
- if (ret < 0)
- return ret;
-
-- ret = rsnd_src_set_convert_timing_gen2(mod);
-+ ret = rsnd_src_set_convert_timing_gen2(io, mod);
- if (ret < 0)
- return ret;
-
-@@ -853,7 +860,7 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
- {
- rsnd_dma_start(io, rsnd_mod_to_dma(mod));
-
-- return _rsnd_src_start_gen2(mod);
-+ return _rsnd_src_start_gen2(mod, io);
- }
-
- static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
-@@ -874,7 +881,7 @@ static void rsnd_src_reconvert_update(struct rsnd_mod *mod)
- 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);
-- u32 convert_rate = rsnd_src_convert_rate(src);
-+ u32 convert_rate = rsnd_src_convert_rate(io, src);
- u32 fsrate;
-
- if (!runtime)
---
-2.6.2
-
diff --git a/patches.renesas/0126-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-snd_kcontrol.patch b/patches.renesas/0126-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-snd_kcontrol.patch
deleted file mode 100644
index c63b614ccbc1c3..00000000000000
--- a/patches.renesas/0126-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-snd_kcontrol.patch
+++ /dev/null
@@ -1,264 +0,0 @@
-From e076b76193833601a9517556a9ac4c7806e0394b Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:27:28 +0000
-Subject: [PATCH 126/129] ASoC: rsnd: don't use rsnd_mod_to_io() on
- snd_kcontrol
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship. This patch removes rsnd_mod_to_io() from snd_kcontrol
-and related function.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit b65a7cccb58ce5acfed579e1ca10f8a4d3d0dd04)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 25 +++++++++++++++++--------
- sound/soc/sh/rcar/dvc.c | 15 ++++++++-------
- sound/soc/sh/rcar/rsnd.h | 15 +++++++++++----
- sound/soc/sh/rcar/src.c | 8 ++++----
- 4 files changed, 40 insertions(+), 23 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index daa01e2aebb6..266b24ae621d 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -880,16 +880,18 @@ static int rsnd_kctrl_put(struct snd_kcontrol *kctrl,
- }
-
- if (change)
-- cfg->update(mod);
-+ cfg->update(cfg->io, mod);
-
- return change;
- }
-
- static int __rsnd_kctrl_new(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_soc_pcm_runtime *rtd,
- const unsigned char *name,
- struct rsnd_kctrl_cfg *cfg,
-- void (*update)(struct rsnd_mod *mod))
-+ void (*update)(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod))
- {
- struct snd_soc_card *soc_card = rtd->card;
- struct snd_card *card = rtd->card->snd_card;
-@@ -918,6 +920,7 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
- cfg->update = update;
- cfg->card = card;
- cfg->kctrl = kctrl;
-+ cfg->io = io;
-
- return 0;
- }
-@@ -928,36 +931,42 @@ void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg)
- }
-
- int rsnd_kctrl_new_m(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_soc_pcm_runtime *rtd,
- const unsigned char *name,
-- void (*update)(struct rsnd_mod *mod),
-+ void (*update)(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod),
- struct rsnd_kctrl_cfg_m *_cfg,
- u32 max)
- {
- _cfg->cfg.max = max;
- _cfg->cfg.size = RSND_DVC_CHANNELS;
- _cfg->cfg.val = _cfg->val;
-- return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update);
-+ return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update);
- }
-
- int rsnd_kctrl_new_s(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_soc_pcm_runtime *rtd,
- const unsigned char *name,
-- void (*update)(struct rsnd_mod *mod),
-+ void (*update)(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod),
- struct rsnd_kctrl_cfg_s *_cfg,
- u32 max)
- {
- _cfg->cfg.max = max;
- _cfg->cfg.size = 1;
- _cfg->cfg.val = &_cfg->val;
-- return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update);
-+ return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update);
- }
-
- int rsnd_kctrl_new_e(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_soc_pcm_runtime *rtd,
- const unsigned char *name,
- struct rsnd_kctrl_cfg_s *_cfg,
-- void (*update)(struct rsnd_mod *mod),
-+ void (*update)(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod),
- const char * const *texts,
- u32 max)
- {
-@@ -965,7 +974,7 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod,
- _cfg->cfg.size = 1;
- _cfg->cfg.val = &_cfg->val;
- _cfg->cfg.texts = texts;
-- return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update);
-+ return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update);
- }
-
- /*
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index 3aac790534f0..36fc020cbc18 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -63,7 +63,8 @@ static const char * const dvc_ramp_rate[] = {
- "0.125 dB/8192 steps", /* 10111 */
- };
-
--static void rsnd_dvc_volume_update(struct rsnd_mod *mod)
-+static void rsnd_dvc_volume_update(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
- struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
- u32 val[RSND_DVC_CHANNELS];
-@@ -172,7 +173,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
- rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
-
- /* ch0/ch1 Volume */
-- rsnd_dvc_volume_update(dvc_mod);
-+ rsnd_dvc_volume_update(io, dvc_mod);
-
- rsnd_mod_write(dvc_mod, DVC_DVUIR, 0);
-
-@@ -217,7 +218,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
- int ret;
-
- /* Volume */
-- ret = rsnd_kctrl_new_m(mod, rtd,
-+ ret = rsnd_kctrl_new_m(mod, io, rtd,
- is_play ?
- "DVC Out Playback Volume" : "DVC In Capture Volume",
- rsnd_dvc_volume_update,
-@@ -226,7 +227,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
- return ret;
-
- /* Mute */
-- ret = rsnd_kctrl_new_m(mod, rtd,
-+ ret = rsnd_kctrl_new_m(mod, io, rtd,
- is_play ?
- "DVC Out Mute Switch" : "DVC In Mute Switch",
- rsnd_dvc_volume_update,
-@@ -235,7 +236,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
- return ret;
-
- /* Ramp */
-- ret = rsnd_kctrl_new_s(mod, rtd,
-+ ret = rsnd_kctrl_new_s(mod, io, rtd,
- is_play ?
- "DVC Out Ramp Switch" : "DVC In Ramp Switch",
- rsnd_dvc_volume_update,
-@@ -243,7 +244,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
- if (ret < 0)
- return ret;
-
-- ret = rsnd_kctrl_new_e(mod, rtd,
-+ ret = rsnd_kctrl_new_e(mod, io, rtd,
- is_play ?
- "DVC Out Ramp Up Rate" : "DVC In Ramp Up Rate",
- &dvc->rup,
-@@ -252,7 +253,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
- if (ret < 0)
- return ret;
-
-- ret = rsnd_kctrl_new_e(mod, rtd,
-+ ret = rsnd_kctrl_new_e(mod, io, rtd,
- is_play ?
- "DVC Out Ramp Down Rate" : "DVC In Ramp Down Rate",
- &dvc->rdown,
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index ac03d2008ee8..fdb443b4f183 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -487,7 +487,8 @@ struct rsnd_kctrl_cfg {
- unsigned int size;
- u32 *val;
- const char * const *texts;
-- void (*update)(struct rsnd_mod *mod);
-+ void (*update)(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
-+ struct rsnd_dai_stream *io;
- struct snd_card *card;
- struct snd_kcontrol *kctrl;
- };
-@@ -507,22 +508,28 @@ void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg);
- #define rsnd_kctrl_remove(_cfg) _rsnd_kctrl_remove(&((_cfg).cfg))
-
- int rsnd_kctrl_new_m(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_soc_pcm_runtime *rtd,
- const unsigned char *name,
-- void (*update)(struct rsnd_mod *mod),
-+ void (*update)(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod),
- struct rsnd_kctrl_cfg_m *_cfg,
- u32 max);
- int rsnd_kctrl_new_s(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_soc_pcm_runtime *rtd,
- const unsigned char *name,
-- void (*update)(struct rsnd_mod *mod),
-+ void (*update)(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod),
- struct rsnd_kctrl_cfg_s *_cfg,
- u32 max);
- int rsnd_kctrl_new_e(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
- struct snd_soc_pcm_runtime *rtd,
- const unsigned char *name,
- struct rsnd_kctrl_cfg_s *_cfg,
-- void (*update)(struct rsnd_mod *mod),
-+ void (*update)(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod),
- const char * const *texts,
- u32 max);
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index bc122ede3254..67db69686515 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -876,9 +876,9 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
- return ret;
- }
-
--static void rsnd_src_reconvert_update(struct rsnd_mod *mod)
-+static void rsnd_src_reconvert_update(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
- {
-- 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);
- u32 convert_rate = rsnd_src_convert_rate(io, src);
-@@ -931,7 +931,7 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
- /*
- * enable sync convert
- */
-- ret = rsnd_kctrl_new_s(mod, rtd,
-+ ret = rsnd_kctrl_new_s(mod, io, rtd,
- rsnd_io_is_play(io) ?
- "SRC Out Rate Switch" :
- "SRC In Rate Switch",
-@@ -940,7 +940,7 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
- if (ret < 0)
- return ret;
-
-- ret = rsnd_kctrl_new_s(mod, rtd,
-+ ret = rsnd_kctrl_new_s(mod, io, rtd,
- rsnd_io_is_play(io) ?
- "SRC Out Rate" :
- "SRC In Rate",
---
-2.6.2
-
diff --git a/patches.renesas/0127-ASoC-rsnd-move-rsnd_mod_is_working-to-rsnd_io_is_wor.patch b/patches.renesas/0127-ASoC-rsnd-move-rsnd_mod_is_working-to-rsnd_io_is_wor.patch
deleted file mode 100644
index dcb39115e47832..00000000000000
--- a/patches.renesas/0127-ASoC-rsnd-move-rsnd_mod_is_working-to-rsnd_io_is_wor.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From b6037cfa54af64234384837621516a912f269996 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:27:47 +0000
-Subject: [PATCH 127/129] ASoC: rsnd: move rsnd_mod_is_working() to
- rsnd_io_is_working()
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship.
-This patch checks module working status via io instead of mod
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit d5bbe7de563ccce62765f1183561218b6dbdbe1e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 4 +---
- sound/soc/sh/rcar/dma.c | 2 +-
- sound/soc/sh/rcar/rsnd.h | 3 +--
- sound/soc/sh/rcar/src.c | 2 +-
- sound/soc/sh/rcar/ssi.c | 2 +-
- 5 files changed, 5 insertions(+), 8 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 266b24ae621d..1eca85ff3e91 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -196,10 +196,8 @@ void rsnd_mod_interrupt(struct rsnd_mod *mod,
- }
- }
-
--int rsnd_mod_is_working(struct rsnd_mod *mod)
-+int rsnd_io_is_working(struct rsnd_dai_stream *io)
- {
-- struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
--
- /* see rsnd_dai_stream_init/quit() */
- return !!io->substream;
- }
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index 48b87bb10322..d306e298c63d 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -52,7 +52,7 @@ static void __rsnd_dmaen_complete(struct rsnd_mod *mod,
- */
- spin_lock_irqsave(&priv->lock, flags);
-
-- if (rsnd_mod_is_working(mod))
-+ if (rsnd_io_is_working(io))
- elapsed = rsnd_dai_pointer_update(io, io->byte_per_period);
-
- spin_unlock_irqrestore(&priv->lock, flags);
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index fdb443b4f183..756930bc1914 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -326,7 +326,6 @@ int rsnd_mod_init(struct rsnd_priv *priv,
- int id);
- void rsnd_mod_quit(struct rsnd_mod *mod);
- char *rsnd_mod_name(struct rsnd_mod *mod);
--int rsnd_mod_is_working(struct rsnd_mod *mod);
- struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
- struct rsnd_mod *mod);
- void rsnd_mod_interrupt(struct rsnd_mod *mod,
-@@ -356,7 +355,7 @@ struct rsnd_dai_stream {
- #define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io)
- #define rsnd_io_to_runtime(io) ((io)->substream ? \
- (io)->substream->runtime : NULL)
--
-+int rsnd_io_is_working(struct rsnd_dai_stream *io);
-
- struct rsnd_dai {
- char name[RSND_DAI_NAME_SIZE];
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 67db69686515..c61c17180142 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -684,7 +684,7 @@ static void __rsnd_src_interrupt_gen2(struct rsnd_mod *mod,
- spin_lock(&priv->lock);
-
- /* ignore all cases if not working */
-- if (!rsnd_mod_is_working(mod))
-+ if (!rsnd_io_is_working(io))
- goto rsnd_src_interrupt_gen2_out;
-
- if (rsnd_src_error_record_gen2(mod)) {
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index fa1f2e5b9070..2fbe59f7f9b5 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -432,7 +432,7 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod,
- spin_lock(&priv->lock);
-
- /* ignore all cases if not working */
-- if (!rsnd_mod_is_working(mod))
-+ if (!rsnd_io_is_working(io))
- goto rsnd_ssi_interrupt_out;
-
- status = rsnd_mod_read(mod, SSISR);
---
-2.6.2
-
diff --git a/patches.renesas/0128-ASoC-rsnd-remove-io-from-rsnd_mod.patch b/patches.renesas/0128-ASoC-rsnd-remove-io-from-rsnd_mod.patch
deleted file mode 100644
index d0068f4d25cf8c..00000000000000
--- a/patches.renesas/0128-ASoC-rsnd-remove-io-from-rsnd_mod.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From fed80e396f6268d0659a221883da961483665c1d Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Mon, 15 Jun 2015 06:28:03 +0000
-Subject: [PATCH 128/129] ASoC: rsnd: remove io from rsnd_mod
-
-Each Renesas sound mod (= SSI/SRC/DVC) might be called from many path
-if it supports MIXer. In such case, mod <-> io is no longer 1:1
-relationship. rsnd_mod_to_io() is no longer needed. Let's remove it.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 8a4e379b54f8cf1180cfee8ad3bfe16beedac65b)
-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, 4 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 1eca85ff3e91..f1e5920654f6 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -288,7 +288,6 @@ static int rsnd_dai_connect(struct rsnd_mod *mod,
- }
-
- io->mod[mod->type] = mod;
-- mod->io = io;
-
- return 0;
- }
-@@ -296,7 +295,6 @@ static int rsnd_dai_connect(struct rsnd_mod *mod,
- static void rsnd_dai_disconnect(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io)
- {
-- mod->io = NULL;
- io->mod[mod->type] = NULL;
- }
-
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 756930bc1914..09fcc54a8ee0 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -262,7 +262,6 @@ struct rsnd_mod {
- enum rsnd_mod_type type;
- struct rsnd_mod_ops *ops;
- struct rsnd_dma dma;
-- struct rsnd_dai_stream *io;
- struct rsnd_priv *priv;
- struct clk *clk;
- u32 status;
-@@ -313,7 +312,6 @@ struct rsnd_mod {
-
- #define rsnd_mod_to_priv(mod) ((mod)->priv)
- #define rsnd_mod_to_dma(mod) (&(mod)->dma)
--#define rsnd_mod_to_io(mod) ((mod)->io)
- #define rsnd_mod_id(mod) ((mod)->id)
- #define rsnd_mod_hw_start(mod) clk_enable((mod)->clk)
- #define rsnd_mod_hw_stop(mod) clk_disable((mod)->clk)
---
-2.6.2
-
diff --git a/patches.renesas/0129-ASoC-rsrc-card-remove-unused-ret.patch b/patches.renesas/0129-ASoC-rsrc-card-remove-unused-ret.patch
deleted file mode 100644
index 0b2370e5540d30..00000000000000
--- a/patches.renesas/0129-ASoC-rsrc-card-remove-unused-ret.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From f0a3d14646566fece58c9aa912b8f690303d84ff Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 17 Jun 2015 00:36:48 +0000
-Subject: [PATCH 129/129] ASoC: rsrc-card: remove unused ret
-
-'047000278da3a17f8("ASoC: rsrc-card: cleanup for DPCM")'
-cleanuped rsrc-card driver, but then, unused ret was left.
-Below warning happen without this patch
-
-${LINUX}/sound/soc/sh/rcar/rsrc-card.c: In function 'rsrc_card_startup':
-${LINUX}/sound/soc/sh/rcar/rsrc-card.c:78:6: warning: unused variable \
- 'ret' [-Wunused-variable]
-
-Reported-by: kbuild test robot <fengguang.wu@intel.com>
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 329d0c0cf1be0ad711bc2f9853fdacc33c1f72b4)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsrc-card.c | 2 --
- 1 file changed, 2 deletions(-)
-
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -75,8 +75,6 @@ static int rsrc_card_startup(struct snd_
- struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
- struct rsrc_card_dai *dai_props =
- rsrc_priv_to_props(priv, rtd - rtd->card->rtd);
-- int ret;
--
-
- return clk_prepare_enable(dai_props->clk);
- }
diff --git a/patches.renesas/0130-clk-shmobile-Remove-unneeded-include-linux-clkdev.h.patch b/patches.renesas/0130-clk-shmobile-Remove-unneeded-include-linux-clkdev.h.patch
deleted file mode 100644
index 3104e230468ee6..00000000000000
--- a/patches.renesas/0130-clk-shmobile-Remove-unneeded-include-linux-clkdev.h.patch
+++ /dev/null
@@ -1,149 +0,0 @@
-From d3d10c1571835d1a74d8746d3c2d0f2c83fd35f3 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 23 Jun 2015 15:09:27 +0200
-Subject: [PATCH 130/326] clk: shmobile: Remove unneeded #include
- <linux/clkdev.h>
-
-The CCF implementations for the various shmobile SoCs don't use clkdev
-functionality, hence drop the inclusion of <linux/clkdev.h>.
-
-Add the missing #include <linux/slab.h>, which was included implicitly
-through <asm/clkdev.h> before.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-(cherry picked from commit 5a1cfafaeab5237523d43cd033e1fb42bf5c1933)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/clk/shmobile/clk-div6.c | 2 +-
- drivers/clk/shmobile/clk-r8a73a4.c | 2 +-
- drivers/clk/shmobile/clk-r8a7740.c | 2 +-
- drivers/clk/shmobile/clk-r8a7778.c | 2 +-
- drivers/clk/shmobile/clk-r8a7779.c | 2 +-
- drivers/clk/shmobile/clk-rcar-gen2.c | 2 +-
- drivers/clk/shmobile/clk-sh73a0.c | 2 +-
- 7 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/clk/shmobile/clk-div6.c b/drivers/clk/shmobile/clk-div6.c
-index 036a692c7219..6810bfb6ef5e 100644
---- a/drivers/clk/shmobile/clk-div6.c
-+++ b/drivers/clk/shmobile/clk-div6.c
-@@ -11,12 +11,12 @@
- */
-
- #include <linux/clk-provider.h>
--#include <linux/clkdev.h>
- #include <linux/init.h>
- #include <linux/io.h>
- #include <linux/kernel.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
-+#include <linux/slab.h>
-
- #define CPG_DIV6_CKSTP BIT(8)
- #define CPG_DIV6_DIV(d) ((d) & 0x3f)
-diff --git a/drivers/clk/shmobile/clk-r8a73a4.c b/drivers/clk/shmobile/clk-r8a73a4.c
-index 29b9a0b0012a..9326204bed9d 100644
---- a/drivers/clk/shmobile/clk-r8a73a4.c
-+++ b/drivers/clk/shmobile/clk-r8a73a4.c
-@@ -9,10 +9,10 @@
- */
-
- #include <linux/clk-provider.h>
--#include <linux/clkdev.h>
- #include <linux/clk/shmobile.h>
- #include <linux/init.h>
- #include <linux/kernel.h>
-+#include <linux/slab.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
- #include <linux/spinlock.h>
-diff --git a/drivers/clk/shmobile/clk-r8a7740.c b/drivers/clk/shmobile/clk-r8a7740.c
-index 1e2eaae21e01..1e6b1da58065 100644
---- a/drivers/clk/shmobile/clk-r8a7740.c
-+++ b/drivers/clk/shmobile/clk-r8a7740.c
-@@ -9,10 +9,10 @@
- */
-
- #include <linux/clk-provider.h>
--#include <linux/clkdev.h>
- #include <linux/clk/shmobile.h>
- #include <linux/init.h>
- #include <linux/kernel.h>
-+#include <linux/slab.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
- #include <linux/spinlock.h>
-diff --git a/drivers/clk/shmobile/clk-r8a7778.c b/drivers/clk/shmobile/clk-r8a7778.c
-index cb33b57274bf..e97e28fcfc13 100644
---- a/drivers/clk/shmobile/clk-r8a7778.c
-+++ b/drivers/clk/shmobile/clk-r8a7778.c
-@@ -9,9 +9,9 @@
- */
-
- #include <linux/clk-provider.h>
--#include <linux/clkdev.h>
- #include <linux/clk/shmobile.h>
- #include <linux/of_address.h>
-+#include <linux/slab.h>
-
- struct r8a7778_cpg {
- struct clk_onecell_data data;
-diff --git a/drivers/clk/shmobile/clk-r8a7779.c b/drivers/clk/shmobile/clk-r8a7779.c
-index 652ecacb6daf..af297963489f 100644
---- a/drivers/clk/shmobile/clk-r8a7779.c
-+++ b/drivers/clk/shmobile/clk-r8a7779.c
-@@ -11,12 +11,12 @@
- */
-
- #include <linux/clk-provider.h>
--#include <linux/clkdev.h>
- #include <linux/clk/shmobile.h>
- #include <linux/init.h>
- #include <linux/kernel.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
-+#include <linux/slab.h>
- #include <linux/spinlock.h>
-
- #include <dt-bindings/clock/r8a7779-clock.h>
-diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c b/drivers/clk/shmobile/clk-rcar-gen2.c
-index acfb6d7dbd6b..9233ebf8cc49 100644
---- a/drivers/clk/shmobile/clk-rcar-gen2.c
-+++ b/drivers/clk/shmobile/clk-rcar-gen2.c
-@@ -11,13 +11,13 @@
- */
-
- #include <linux/clk-provider.h>
--#include <linux/clkdev.h>
- #include <linux/clk/shmobile.h>
- #include <linux/init.h>
- #include <linux/kernel.h>
- #include <linux/math64.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
-+#include <linux/slab.h>
- #include <linux/spinlock.h>
-
- struct rcar_gen2_cpg {
-diff --git a/drivers/clk/shmobile/clk-sh73a0.c b/drivers/clk/shmobile/clk-sh73a0.c
-index cd529cfe412f..8966f8bbfd72 100644
---- a/drivers/clk/shmobile/clk-sh73a0.c
-+++ b/drivers/clk/shmobile/clk-sh73a0.c
-@@ -9,12 +9,12 @@
- */
-
- #include <linux/clk-provider.h>
--#include <linux/clkdev.h>
- #include <linux/clk/shmobile.h>
- #include <linux/init.h>
- #include <linux/kernel.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
-+#include <linux/slab.h>
- #include <linux/spinlock.h>
-
- struct sh73a0_cpg {
---
-2.6.2
-
diff --git a/patches.renesas/0131-clk-shmobile-emev2-deassert-reset-for-IIC0-1.patch b/patches.renesas/0131-clk-shmobile-emev2-deassert-reset-for-IIC0-1.patch
deleted file mode 100644
index 5aef8f7e985e67..00000000000000
--- a/patches.renesas/0131-clk-shmobile-emev2-deassert-reset-for-IIC0-1.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 6aaa9e5b42a4b3685cb43b47fecc9deafe0def0e Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Sat, 11 Jul 2015 09:46:22 +0200
-Subject: [PATCH 131/326] clk: shmobile: emev2: deassert reset for IIC0/1
-
-We have a driver now for IIC, so disable reset for them.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Acked-by: Stephen Boyd <sboyd@codeaurora.org>
-Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-(cherry picked from commit e1069878b957c5f6d0eb2f441a8372db8d6198b2)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/clk/shmobile/clk-emev2.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/drivers/clk/shmobile/clk-emev2.c b/drivers/clk/shmobile/clk-emev2.c
-index 5b60beb7d0eb..a91825471c79 100644
---- a/drivers/clk/shmobile/clk-emev2.c
-+++ b/drivers/clk/shmobile/clk-emev2.c
-@@ -28,6 +28,8 @@
- #define USIBU1_RSTCTRL 0x0ac
- #define USIBU2_RSTCTRL 0x0b0
- #define USIBU3_RSTCTRL 0x0b4
-+#define IIC0_RSTCTRL 0x0dc
-+#define IIC1_RSTCTRL 0x0e0
- #define STI_RSTCTRL 0x124
- #define STI_CLKSEL 0x688
-
-@@ -66,6 +68,10 @@ static void __init emev2_smu_init(void)
- emev2_smu_write(2, USIBU1_RSTCTRL);
- emev2_smu_write(2, USIBU2_RSTCTRL);
- emev2_smu_write(2, USIBU3_RSTCTRL);
-+
-+ /* deassert reset for IIC0->IIC1 */
-+ emev2_smu_write(1, IIC0_RSTCTRL);
-+ emev2_smu_write(1, IIC1_RSTCTRL);
- }
-
- static void __init emev2_smu_clkdiv_init(struct device_node *np)
---
-2.6.2
-
diff --git a/patches.renesas/0132-clk-shmobile-Add-CPG-MSTP-Clock-Domain-support.patch b/patches.renesas/0132-clk-shmobile-Add-CPG-MSTP-Clock-Domain-support.patch
deleted file mode 100644
index 69fe84a4c3aeb0..00000000000000
--- a/patches.renesas/0132-clk-shmobile-Add-CPG-MSTP-Clock-Domain-support.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-From a48d6af3298fb901cdae017fe804ce72299eca36 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:02 +0200
-Subject: [PATCH 132/326] clk: shmobile: Add CPG/MSTP Clock Domain support
-
-Add Clock Domain support to the Clock Pulse Generator (CPG) Module Stop
-(MSTP) Clocks driver using the generic PM Domain. This allows to
-power-manage the module clocks of SoC devices that are part of the
-CPG/MSTP Clock Domain using Runtime PM, or for system suspend/resume.
-
-SoC devices that are part of the CPG/MSTP Clock Domain and can be
-power-managed through an MSTP clock should be tagged in DT with a
-proper "power-domains" property.
-
-The CPG/MSTP Clock Domain code will scan such devices for clocks that
-are suitable for power-managing the device, by looking for a clock that
-is compatible with "renesas,cpg-mstp-clocks".
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Acked-by: Stephen Boyd <sboyd@codeaurora.org>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Reviewed-by: Kevin Hilman <khilman@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 752b5ed5f6998e118626feea7375782c4cf5aad6)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/clk/shmobile/clk-mstp.c | 87 +++++++++++++++++++++++++++++++++++++++++
- include/linux/clk/shmobile.h | 12 ++++++
- 2 files changed, 99 insertions(+)
-
-diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c
-index 2d2fe773ac81..b1df7b2f1e97 100644
---- a/drivers/clk/shmobile/clk-mstp.c
-+++ b/drivers/clk/shmobile/clk-mstp.c
-@@ -2,6 +2,7 @@
- * R-Car MSTP clocks
- *
- * Copyright (C) 2013 Ideas On Board SPRL
-+ * Copyright (C) 2015 Glider bvba
- *
- * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
- *
-@@ -10,11 +11,16 @@
- * the Free Software Foundation; version 2 of the License.
- */
-
-+#include <linux/clk.h>
- #include <linux/clk-provider.h>
- #include <linux/clkdev.h>
-+#include <linux/clk/shmobile.h>
-+#include <linux/device.h>
- #include <linux/io.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
-+#include <linux/pm_clock.h>
-+#include <linux/pm_domain.h>
- #include <linux/spinlock.h>
-
- /*
-@@ -236,3 +242,84 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
- of_clk_add_provider(np, of_clk_src_onecell_get, &group->data);
- }
- CLK_OF_DECLARE(cpg_mstp_clks, "renesas,cpg-mstp-clocks", cpg_mstp_clocks_init);
-+
-+
-+#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
-+int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev)
-+{
-+ struct device_node *np = dev->of_node;
-+ struct of_phandle_args clkspec;
-+ struct clk *clk;
-+ int i = 0;
-+ int error;
-+
-+ while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i,
-+ &clkspec)) {
-+ if (of_device_is_compatible(clkspec.np,
-+ "renesas,cpg-mstp-clocks"))
-+ goto found;
-+
-+ of_node_put(clkspec.np);
-+ i++;
-+ }
-+
-+ return 0;
-+
-+found:
-+ clk = of_clk_get_from_provider(&clkspec);
-+ of_node_put(clkspec.np);
-+
-+ if (IS_ERR(clk))
-+ return PTR_ERR(clk);
-+
-+ error = pm_clk_create(dev);
-+ if (error) {
-+ dev_err(dev, "pm_clk_create failed %d\n", error);
-+ goto fail_put;
-+ }
-+
-+ error = pm_clk_add_clk(dev, clk);
-+ if (error) {
-+ dev_err(dev, "pm_clk_add_clk %pC failed %d\n", clk, error);
-+ goto fail_destroy;
-+ }
-+
-+ return 0;
-+
-+fail_destroy:
-+ pm_clk_destroy(dev);
-+fail_put:
-+ clk_put(clk);
-+ return error;
-+}
-+
-+void cpg_mstp_detach_dev(struct generic_pm_domain *domain, struct device *dev)
-+{
-+ if (!list_empty(&dev->power.subsys_data->clock_list))
-+ pm_clk_destroy(dev);
-+}
-+
-+void __init cpg_mstp_add_clk_domain(struct device_node *np)
-+{
-+ struct generic_pm_domain *pd;
-+ u32 ncells;
-+
-+ if (of_property_read_u32(np, "#power-domain-cells", &ncells)) {
-+ pr_warn("%s lacks #power-domain-cells\n", np->full_name);
-+ return;
-+ }
-+
-+ pd = kzalloc(sizeof(*pd), GFP_KERNEL);
-+ if (!pd)
-+ return;
-+
-+ pd->name = np->name;
-+
-+ pd->flags = GENPD_FLAG_PM_CLK;
-+ pm_genpd_init(pd, &simple_qos_governor, false);
-+ pd->attach_dev = cpg_mstp_attach_dev;
-+ pd->detach_dev = cpg_mstp_detach_dev;
-+
-+ of_genpd_add_provider_simple(np, pd);
-+}
-+#endif /* !CONFIG_PM_GENERIC_DOMAINS_OF */
-diff --git a/include/linux/clk/shmobile.h b/include/linux/clk/shmobile.h
-index 63a8159c4e64..cb19cc1865ca 100644
---- a/include/linux/clk/shmobile.h
-+++ b/include/linux/clk/shmobile.h
-@@ -16,8 +16,20 @@
-
- #include <linux/types.h>
-
-+struct device;
-+struct device_node;
-+struct generic_pm_domain;
-+
- void r8a7778_clocks_init(u32 mode);
- void r8a7779_clocks_init(u32 mode);
- void rcar_gen2_clocks_init(u32 mode);
-
-+#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
-+void cpg_mstp_add_clk_domain(struct device_node *np);
-+int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev);
-+void cpg_mstp_detach_dev(struct generic_pm_domain *domain, struct device *dev);
-+#else
-+static inline void cpg_mstp_add_clk_domain(struct device_node *np) {}
-+#endif
-+
- #endif
---
-2.6.2
-
diff --git a/patches.renesas/0133-clk-shmobile-r8a7778-Add-CPG-MSTP-Clock-Domain-suppo.patch b/patches.renesas/0133-clk-shmobile-r8a7778-Add-CPG-MSTP-Clock-Domain-suppo.patch
deleted file mode 100644
index 220d4b198879bb..00000000000000
--- a/patches.renesas/0133-clk-shmobile-r8a7778-Add-CPG-MSTP-Clock-Domain-suppo.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-From 7de81b01075a4192386f6f1b4b66d9ec986d06d2 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:03 +0200
-Subject: [PATCH 133/326] clk: shmobile: r8a7778: Add CPG/MSTP Clock Domain
- support
-
-Add Clock Domain support to the R-Car M1A Clock Pulse Generator (CPG)
-driver using the generic PM Domain. This allows to power-manage the
-module clocks of SoC devices that are part of the CPG/MSTP Clock Domain
-using Runtime PM, or for system suspend/resume.
-
-SoC devices that are part of the CPG/MSTP Clock Domain and can be
-power-managed through an MSTP clock should be tagged in DT with a proper
-"power-domains" property.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Stephen Boyd <sboyd@codeaurora.org>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 8bc964aa25e56b7445ffebffccd455f959370a16)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../bindings/clock/renesas,r8a7778-cpg-clocks.txt | 29 +++++++++++++++++++---
- arch/arm/mach-shmobile/Kconfig | 1 +
- drivers/clk/shmobile/clk-r8a7778.c | 2 ++
- 3 files changed, 29 insertions(+), 3 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/clock/renesas,r8a7778-cpg-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,r8a7778-cpg-clocks.txt
-index 2f3747fdcf1c..e4cdaf1cb333 100644
---- a/Documentation/devicetree/bindings/clock/renesas,r8a7778-cpg-clocks.txt
-+++ b/Documentation/devicetree/bindings/clock/renesas,r8a7778-cpg-clocks.txt
-@@ -1,7 +1,9 @@
- * Renesas R8A7778 Clock Pulse Generator (CPG)
-
- The CPG generates core clocks for the R8A7778. It includes two PLLs and
--several fixed ratio dividers
-+several fixed ratio dividers.
-+The CPG also provides a Clock Domain for SoC devices, in combination with the
-+CPG Module Stop (MSTP) Clocks.
-
- Required Properties:
-
-@@ -10,10 +12,18 @@ Required Properties:
- - #clock-cells: Must be 1
- - clock-output-names: The names of the clocks. Supported clocks are
- "plla", "pllb", "b", "out", "p", "s", and "s1".
-+ - #power-domain-cells: Must be 0
-
-+SoC devices that are part of the CPG/MSTP Clock Domain and can be power-managed
-+through an MSTP clock should refer to the CPG device node in their
-+"power-domains" property, as documented by the generic PM domain bindings in
-+Documentation/devicetree/bindings/power/power_domain.txt.
-
--Example
---------
-+
-+Examples
-+--------
-+
-+ - CPG device node:
-
- cpg_clocks: cpg_clocks@ffc80000 {
- compatible = "renesas,r8a7778-cpg-clocks";
-@@ -22,4 +32,17 @@ Example
- clocks = <&extal_clk>;
- clock-output-names = "plla", "pllb", "b",
- "out", "p", "s", "s1";
-+ #power-domain-cells = <0>;
-+ };
-+
-+
-+ - CPG/MSTP Clock Domain member device node:
-+
-+ sdhi0: sd@ffe4c000 {
-+ compatible = "renesas,sdhi-r8a7778";
-+ reg = <0xffe4c000 0x100>;
-+ interrupts = <0 87 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp3_clks R8A7778_CLK_SDHI0>;
-+ power-domains = <&cpg_clocks>;
-+ status = "disabled";
- };
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index 45006479d461..e14fa5e87475 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -4,6 +4,7 @@ config ARCH_SHMOBILE
-
- config PM_RCAR
- bool
-+ select PM_GENERIC_DOMAINS if PM
-
- config PM_RMOBILE
- bool
-diff --git a/drivers/clk/shmobile/clk-r8a7778.c b/drivers/clk/shmobile/clk-r8a7778.c
-index e97e28fcfc13..87c1d2f2fb57 100644
---- a/drivers/clk/shmobile/clk-r8a7778.c
-+++ b/drivers/clk/shmobile/clk-r8a7778.c
-@@ -124,6 +124,8 @@ static void __init r8a7778_cpg_clocks_init(struct device_node *np)
- }
-
- of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
-+
-+ cpg_mstp_add_clk_domain(np);
- }
-
- CLK_OF_DECLARE(r8a7778_cpg_clks, "renesas,r8a7778-cpg-clocks",
---
-2.6.2
-
diff --git a/patches.renesas/0134-clk-shmobile-r8a7779-Add-CPG-MSTP-Clock-Domain-suppo.patch b/patches.renesas/0134-clk-shmobile-r8a7779-Add-CPG-MSTP-Clock-Domain-suppo.patch
deleted file mode 100644
index c6a8cfbe283ad3..00000000000000
--- a/patches.renesas/0134-clk-shmobile-r8a7779-Add-CPG-MSTP-Clock-Domain-suppo.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From 216ba3c27e290b48c78b4f4f33ba0266c6a78b67 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:04 +0200
-Subject: [PATCH 134/326] clk: shmobile: r8a7779: Add CPG/MSTP Clock Domain
- support
-
-Add Clock Domain support to the R-Car H1 Clock Pulse Generator (CPG)
-driver using the generic PM Domain. This allows to power-manage the
-module clocks of SoC devices that are part of the CPG/MSTP Clock Domain
-using Runtime PM, or for system suspend/resume.
-
-SoC devices that are part of the CPG/MSTP Clock Domain and can be
-power-managed through an MSTP clock should be tagged in DT with a proper
-"power-domains" property.
-
-Also update the reg property in the DT binding doc example to match the
-actual dtsi, which uses #address-cells and #size-cells == 1, not 2.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Stephen Boyd <sboyd@codeaurora.org>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit b31fc90c14d9e584ac19983686cecab3e0764289)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../bindings/clock/renesas,r8a7779-cpg-clocks.txt | 30 +++++++++++++++++++---
- drivers/clk/shmobile/clk-r8a7779.c | 2 ++
- 2 files changed, 28 insertions(+), 4 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/clock/renesas,r8a7779-cpg-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,r8a7779-cpg-clocks.txt
-index ed3c8cb12f4e..8c81547c29f5 100644
---- a/Documentation/devicetree/bindings/clock/renesas,r8a7779-cpg-clocks.txt
-+++ b/Documentation/devicetree/bindings/clock/renesas,r8a7779-cpg-clocks.txt
-@@ -1,7 +1,9 @@
- * Renesas R8A7779 Clock Pulse Generator (CPG)
-
- The CPG generates core clocks for the R8A7779. It includes one PLL and
--several fixed ratio dividers
-+several fixed ratio dividers.
-+The CPG also provides a Clock Domain for SoC devices, in combination with the
-+CPG Module Stop (MSTP) Clocks.
-
- Required Properties:
-
-@@ -12,16 +14,36 @@ Required Properties:
- - #clock-cells: Must be 1
- - clock-output-names: The names of the clocks. Supported clocks are "plla",
- "z", "zs", "s", "s1", "p", "b", "out".
-+ - #power-domain-cells: Must be 0
-
-+SoC devices that are part of the CPG/MSTP Clock Domain and can be power-managed
-+through an MSTP clock should refer to the CPG device node in their
-+"power-domains" property, as documented by the generic PM domain bindings in
-+Documentation/devicetree/bindings/power/power_domain.txt.
-
--Example
---------
-+
-+Examples
-+--------
-+
-+ - CPG device node:
-
- cpg_clocks: cpg_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", "s1", "p",
- "b", "out";
-+ #power-domain-cells = <0>;
-+ };
-+
-+
-+ - CPG/MSTP Clock Domain member device node:
-+
-+ sata: sata@fc600000 {
-+ compatible = "renesas,sata-r8a7779", "renesas,rcar-sata";
-+ reg = <0xfc600000 0x2000>;
-+ interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp1_clks R8A7779_CLK_SATA>;
-+ power-domains = <&cpg_clocks>;
- };
-diff --git a/drivers/clk/shmobile/clk-r8a7779.c b/drivers/clk/shmobile/clk-r8a7779.c
-index af297963489f..92275c5f2c60 100644
---- a/drivers/clk/shmobile/clk-r8a7779.c
-+++ b/drivers/clk/shmobile/clk-r8a7779.c
-@@ -168,6 +168,8 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np)
- }
-
- of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
-+
-+ cpg_mstp_add_clk_domain(np);
- }
- CLK_OF_DECLARE(r8a7779_cpg_clks, "renesas,r8a7779-cpg-clocks",
- r8a7779_cpg_clocks_init);
---
-2.6.2
-
diff --git a/patches.renesas/0135-clk-shmobile-rcar-gen2-Add-CPG-MSTP-Clock-Domain-sup.patch b/patches.renesas/0135-clk-shmobile-rcar-gen2-Add-CPG-MSTP-Clock-Domain-sup.patch
deleted file mode 100644
index 2fddc1e01a5808..00000000000000
--- a/patches.renesas/0135-clk-shmobile-rcar-gen2-Add-CPG-MSTP-Clock-Domain-sup.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From fbd31c4fb0ca3644a5f451a81244aae38115a16d Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:05 +0200
-Subject: [PATCH 135/326] clk: shmobile: rcar-gen2: Add CPG/MSTP Clock Domain
- support
-
-Add Clock Domain support to the R-Car Gen2 Clock Pulse Generator (CPG)
-driver using the generic PM Domain. This allows to power-manage the
-module clocks of SoC devices that are part of the CPG/MSTP Clock Domain
-using Runtime PM, or for system suspend/resume.
-
-SoC devices that are part of the CPG/MSTP Clock Domain and can be
-power-managed through an MSTP clock should be tagged in DT with a proper
-"power-domains" property.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Stephen Boyd <sboyd@codeaurora.org>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 63e05d9365dc25ae71bdde436b27c49daedf1977)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../clock/renesas,rcar-gen2-cpg-clocks.txt | 26 ++++++++++++++++++++--
- drivers/clk/shmobile/clk-rcar-gen2.c | 2 ++
- 2 files changed, 26 insertions(+), 2 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
-index b02944fba9de..6d49d35bee2c 100644
---- a/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
-+++ b/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
-@@ -2,6 +2,8 @@
-
- The CPG generates core clocks for the R-Car Gen2 SoCs. It includes three PLLs
- and several fixed ratio dividers.
-+The CPG also provides a Clock Domain for SoC devices, in combination with the
-+CPG Module Stop (MSTP) Clocks.
-
- Required Properties:
-
-@@ -20,10 +22,18 @@ Required Properties:
- - clock-output-names: The names of the clocks. Supported clocks are "main",
- "pll0", "pll1", "pll3", "lb", "qspi", "sdh", "sd0", "sd1", "z", "rcan", and
- "adsp"
-+ - #power-domain-cells: Must be 0
-
-+SoC devices that are part of the CPG/MSTP Clock Domain and can be power-managed
-+through an MSTP clock should refer to the CPG device node in their
-+"power-domains" property, as documented by the generic PM domain bindings in
-+Documentation/devicetree/bindings/power/power_domain.txt.
-
--Example
---------
-+
-+Examples
-+--------
-+
-+ - CPG device node:
-
- cpg_clocks: cpg_clocks@e6150000 {
- compatible = "renesas,r8a7790-cpg-clocks",
-@@ -34,4 +44,16 @@ Example
- clock-output-names = "main", "pll0, "pll1", "pll3",
- "lb", "qspi", "sdh", "sd0", "sd1", "z",
- "rcan", "adsp";
-+ #power-domain-cells = <0>;
-+ };
-+
-+
-+ - CPG/MSTP Clock Domain member device node:
-+
-+ thermal@e61f0000 {
-+ compatible = "renesas,thermal-r8a7790", "renesas,rcar-thermal";
-+ reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
-+ interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp5_clks R8A7790_CLK_THERMAL>;
-+ power-domains = <&cpg_clocks>;
- };
-diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c b/drivers/clk/shmobile/clk-rcar-gen2.c
-index 9233ebf8cc49..745496f7ee9c 100644
---- a/drivers/clk/shmobile/clk-rcar-gen2.c
-+++ b/drivers/clk/shmobile/clk-rcar-gen2.c
-@@ -415,6 +415,8 @@ static void __init rcar_gen2_cpg_clocks_init(struct device_node *np)
- }
-
- of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
-+
-+ cpg_mstp_add_clk_domain(np);
- }
- CLK_OF_DECLARE(rcar_gen2_cpg_clks, "renesas,rcar-gen2-cpg-clocks",
- rcar_gen2_cpg_clocks_init);
---
-2.6.2
-
diff --git a/patches.renesas/0136-clk-shmobile-rz-Add-CPG-MSTP-Clock-Domain-support.patch b/patches.renesas/0136-clk-shmobile-rz-Add-CPG-MSTP-Clock-Domain-support.patch
deleted file mode 100644
index 7481fc9eb357ea..00000000000000
--- a/patches.renesas/0136-clk-shmobile-rz-Add-CPG-MSTP-Clock-Domain-support.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-From bc699f83f546d9fc5a084aaf85dba3d0f606b286 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:06 +0200
-Subject: [PATCH 136/326] clk: shmobile: rz: Add CPG/MSTP Clock Domain support
-
-Add Clock Domain support to the RZ Clock Pulse Generator (CPG) driver
-using the generic PM Domain. This allows to power-manage the module
-clocks of SoC devices that are part of the CPG/MSTP Clock Domain using
-Runtime PM, or for system suspend/resume.
-
-SoC devices that are part of the CPG/MSTP Clock Domain and can be
-power-managed through an MSTP clock should be tagged in DT with a proper
-"power-domains" property.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Stephen Boyd <sboyd@codeaurora.org>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit f04b486d34ac6bab2aaa3988ee098b2bad3950de)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../bindings/clock/renesas,rz-cpg-clocks.txt | 29 ++++++++++++++++++++--
- arch/arm/mach-shmobile/Kconfig | 1 +
- drivers/clk/shmobile/clk-rz.c | 3 +++
- 3 files changed, 31 insertions(+), 2 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt
-index 98a257492522..72b738fc5600 100644
---- a/Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt
-+++ b/Documentation/devicetree/bindings/clock/renesas,rz-cpg-clocks.txt
-@@ -2,6 +2,8 @@
-
- The CPG generates core clocks for the RZ SoCs. It includes the PLL, variable
- CPU and GPU clocks, and several fixed ratio dividers.
-+The CPG also provides a Clock Domain for SoC devices, in combination with the
-+CPG Module Stop (MSTP) Clocks.
-
- Required Properties:
-
-@@ -14,10 +16,18 @@ Required Properties:
- - #clock-cells: Must be 1
- - clock-output-names: The names of the clocks. Supported clocks are "pll",
- "i", and "g"
-+ - #power-domain-cells: Must be 0
-
-+SoC devices that are part of the CPG/MSTP Clock Domain and can be power-managed
-+through an MSTP clock should refer to the CPG device node in their
-+"power-domains" property, as documented by the generic PM domain bindings in
-+Documentation/devicetree/bindings/power/power_domain.txt.
-
--Example
---------
-+
-+Examples
-+--------
-+
-+ - CPG device node:
-
- cpg_clocks: cpg_clocks@fcfe0000 {
- #clock-cells = <1>;
-@@ -26,4 +36,19 @@ Example
- reg = <0xfcfe0000 0x18>;
- clocks = <&extal_clk>, <&usb_x1_clk>;
- clock-output-names = "pll", "i", "g";
-+ #power-domain-cells = <0>;
-+ };
-+
-+
-+ - CPG/MSTP Clock Domain member device node:
-+
-+ mtu2: timer@fcff0000 {
-+ compatible = "renesas,mtu2-r7s72100", "renesas,mtu2";
-+ reg = <0xfcff0000 0x400>;
-+ interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
-+ interrupt-names = "tgi0a";
-+ clocks = <&mstp3_clks R7S72100_CLK_MTU2>;
-+ clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-+ status = "disabled";
- };
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index e14fa5e87475..34eac88a9889 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -51,6 +51,7 @@ config ARCH_EMEV2
-
- config ARCH_R7S72100
- bool "RZ/A1H (R7S72100)"
-+ select PM_GENERIC_DOMAINS if PM
- select SYS_SUPPORTS_SH_MTU2
-
- config ARCH_R8A73A4
-diff --git a/drivers/clk/shmobile/clk-rz.c b/drivers/clk/shmobile/clk-rz.c
-index 7e68e8630962..9766e3cb595f 100644
---- a/drivers/clk/shmobile/clk-rz.c
-+++ b/drivers/clk/shmobile/clk-rz.c
-@@ -10,6 +10,7 @@
- */
-
- #include <linux/clk-provider.h>
-+#include <linux/clk/shmobile.h>
- #include <linux/init.h>
- #include <linux/kernel.h>
- #include <linux/of.h>
-@@ -99,5 +100,7 @@ static void __init rz_cpg_clocks_init(struct device_node *np)
- }
-
- of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
-+
-+ cpg_mstp_add_clk_domain(np);
- }
- CLK_OF_DECLARE(rz_cpg_clks, "renesas,rz-cpg-clocks", rz_cpg_clocks_init);
---
-2.6.2
-
diff --git a/patches.renesas/0137-regulator-da9210-Add-optional-interrupt-support.patch b/patches.renesas/0137-regulator-da9210-Add-optional-interrupt-support.patch
deleted file mode 100644
index 4572969ec29a3a..00000000000000
--- a/patches.renesas/0137-regulator-da9210-Add-optional-interrupt-support.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From 0d2570a3cf4b90d6e029822245afe3986d716781 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 24 Jun 2015 14:14:21 +0200
-Subject: [PATCH 137/326] regulator: da9210: Add optional interrupt support
-
-Add optional interrupt support to the da9210 regulator driver, to handle
-over-current, under- and over-voltage, and over-temperature events.
-
-Only the interrupt sources for which we handle events are unmasked, to
-avoid interrupts we cannot handle.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 4245746037e379dc9f1388e422d52001cd431921)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../devicetree/bindings/regulator/da9210.txt | 4 ++
- drivers/regulator/da9210-regulator.c | 75 ++++++++++++++++++++++
- 2 files changed, 79 insertions(+)
-
-diff --git a/Documentation/devicetree/bindings/regulator/da9210.txt b/Documentation/devicetree/bindings/regulator/da9210.txt
-index 3297c53cb915..7aa9b1fa6b21 100644
---- a/Documentation/devicetree/bindings/regulator/da9210.txt
-+++ b/Documentation/devicetree/bindings/regulator/da9210.txt
-@@ -5,6 +5,10 @@ Required properties:
- - compatible: must be "dlg,da9210"
- - reg: the i2c slave address of the regulator. It should be 0x68.
-
-+Optional properties:
-+
-+- interrupts: a reference to the DA9210 interrupt, if available.
-+
- Any standard regulator properties can be used to configure the single da9210
- DCDC.
-
-diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c
-index f0489cb9018b..8e39f7457bc3 100644
---- a/drivers/regulator/da9210-regulator.c
-+++ b/drivers/regulator/da9210-regulator.c
-@@ -22,6 +22,8 @@
- #include <linux/i2c.h>
- #include <linux/module.h>
- #include <linux/init.h>
-+#include <linux/interrupt.h>
-+#include <linux/irq.h>
- #include <linux/slab.h>
- #include <linux/regulator/driver.h>
- #include <linux/regulator/machine.h>
-@@ -120,6 +122,55 @@ static int da9210_get_current_limit(struct regulator_dev *rdev)
- return da9210_buck_limits[sel];
- }
-
-+static irqreturn_t da9210_irq_handler(int irq, void *data)
-+{
-+ struct da9210 *chip = data;
-+ unsigned int val, handled = 0;
-+ int error, ret = IRQ_NONE;
-+
-+ error = regmap_read(chip->regmap, DA9210_REG_EVENT_B, &val);
-+ if (error < 0)
-+ goto error_i2c;
-+
-+ if (val & DA9210_E_OVCURR) {
-+ regulator_notifier_call_chain(chip->rdev,
-+ REGULATOR_EVENT_OVER_CURRENT,
-+ NULL);
-+ handled |= DA9210_E_OVCURR;
-+ }
-+ if (val & DA9210_E_NPWRGOOD) {
-+ regulator_notifier_call_chain(chip->rdev,
-+ REGULATOR_EVENT_UNDER_VOLTAGE,
-+ NULL);
-+ handled |= DA9210_E_NPWRGOOD;
-+ }
-+ if (val & (DA9210_E_TEMP_WARN | DA9210_E_TEMP_CRIT)) {
-+ regulator_notifier_call_chain(chip->rdev,
-+ REGULATOR_EVENT_OVER_TEMP, NULL);
-+ handled |= val & (DA9210_E_TEMP_WARN | DA9210_E_TEMP_CRIT);
-+ }
-+ if (val & DA9210_E_VMAX) {
-+ regulator_notifier_call_chain(chip->rdev,
-+ REGULATOR_EVENT_REGULATION_OUT,
-+ NULL);
-+ handled |= DA9210_E_VMAX;
-+ }
-+ if (handled) {
-+ /* Clear handled events */
-+ error = regmap_write(chip->regmap, DA9210_REG_EVENT_B, handled);
-+ if (error < 0)
-+ goto error_i2c;
-+
-+ ret = IRQ_HANDLED;
-+ }
-+
-+ return ret;
-+
-+error_i2c:
-+ dev_err(regmap_get_device(chip->regmap), "I2C error : %d\n", error);
-+ return ret;
-+}
-+
- /*
- * I2C driver interface functions
- */
-@@ -168,6 +219,30 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
- }
-
- chip->rdev = rdev;
-+ if (i2c->irq) {
-+ error = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,
-+ da9210_irq_handler,
-+ IRQF_TRIGGER_LOW |
-+ IRQF_ONESHOT | IRQF_SHARED,
-+ "da9210", chip);
-+ if (error) {
-+ dev_err(&i2c->dev, "Failed to request IRQ%u: %d\n",
-+ i2c->irq, error);
-+ return error;
-+ }
-+
-+ error = regmap_update_bits(chip->regmap, DA9210_REG_MASK_B,
-+ DA9210_M_OVCURR | DA9210_M_NPWRGOOD |
-+ DA9210_M_TEMP_WARN |
-+ DA9210_M_TEMP_CRIT | DA9210_M_VMAX, 0);
-+ if (error < 0) {
-+ dev_err(&i2c->dev, "Failed to update mask reg: %d\n",
-+ error);
-+ return error;
-+ }
-+ } else {
-+ dev_warn(&i2c->dev, "No IRQ configured\n");
-+ }
-
- i2c_set_clientdata(i2c, chip);
-
---
-2.6.2
-
diff --git a/patches.renesas/0138-gpio-rcar-Fine-grained-Runtime-PM-support.patch b/patches.renesas/0138-gpio-rcar-Fine-grained-Runtime-PM-support.patch
deleted file mode 100644
index cd6d500a1d07c1..00000000000000
--- a/patches.renesas/0138-gpio-rcar-Fine-grained-Runtime-PM-support.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 16ea8e361fb43dcdc02d2707bc75f078b1e3b9c4 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 25 Jun 2015 16:45:57 +0200
-Subject: [PATCH 138/326] gpio: rcar: Fine-grained Runtime PM support
-
-Currently gpio modules are runtime-resumed at probe time. This means the
-gpio module will be active all the time (except during system suspend,
-if not configured as a wake-up source).
-
-While an R-Car Gen2 gpio module retains pins configured for output at
-the requested level while put in standby mode, gpio registercannot be
-accessed while suspended. Unfortunately pm_runtime_get_sync() cannot be
-called from all contexts where gpio register access is needed. Hence
-move the Runtime PM handling from probe/remove time to gpio request/free
-time, which is probably the best we can do.
-
-On r8a7791/koelsch, gpio modules 0, 1, 3, and 4 are now suspended during
-normal use (gpio2 is used for LEDs and regulators, gpio5 for keys, gpio6
-for SD-Card CD & WP, gpio7 for keys and regulators).
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 65194cb174b873448b208eb6e04ecb72237af76e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/gpio/gpio-rcar.c | 20 ++++++++++++++++----
- 1 file changed, 16 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
-index 1e14a6c74ed1..4fc13ce9c60a 100644
---- a/drivers/gpio/gpio-rcar.c
-+++ b/drivers/gpio/gpio-rcar.c
-@@ -251,17 +251,32 @@ static void gpio_rcar_config_general_input_output_mode(struct gpio_chip *chip,
-
- static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
- {
-- return pinctrl_request_gpio(chip->base + offset);
-+ struct gpio_rcar_priv *p = gpio_to_priv(chip);
-+ int error;
-+
-+ error = pm_runtime_get_sync(&p->pdev->dev);
-+ if (error < 0)
-+ return error;
-+
-+ error = pinctrl_request_gpio(chip->base + offset);
-+ if (error)
-+ pm_runtime_put(&p->pdev->dev);
-+
-+ return error;
- }
-
- static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
- {
-+ struct gpio_rcar_priv *p = gpio_to_priv(chip);
-+
- pinctrl_free_gpio(chip->base + offset);
-
- /* Set the GPIO as an input to ensure that the next GPIO request won't
- * drive the GPIO pin as an output.
- */
- gpio_rcar_config_general_input_output_mode(chip, offset, false);
-+
-+ pm_runtime_put(&p->pdev->dev);
- }
-
- static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
-@@ -405,7 +420,6 @@ static int gpio_rcar_probe(struct platform_device *pdev)
- }
-
- pm_runtime_enable(dev);
-- pm_runtime_get_sync(dev);
-
- io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-@@ -487,7 +501,6 @@ static int gpio_rcar_probe(struct platform_device *pdev)
- err1:
- gpiochip_remove(gpio_chip);
- err0:
-- pm_runtime_put(dev);
- pm_runtime_disable(dev);
- return ret;
- }
-@@ -498,7 +511,6 @@ static int gpio_rcar_remove(struct platform_device *pdev)
-
- gpiochip_remove(&p->gpio_chip);
-
-- pm_runtime_put(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- return 0;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0139-gpio-rcar-Add-r8a7795-R-Car-H3-support.patch b/patches.renesas/0139-gpio-rcar-Add-r8a7795-R-Car-H3-support.patch
deleted file mode 100644
index b161605999874e..00000000000000
--- a/patches.renesas/0139-gpio-rcar-Add-r8a7795-R-Car-H3-support.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From afb2129c0479f584c84ee659be293b1ffc52ad70 Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Tue, 21 Jul 2015 11:08:50 +0200
-Subject: [PATCH 139/326] gpio: rcar: Add r8a7795 (R-Car H3) support
-
-R-Car Gen3's GPIO blocks are identical to Gen2's in every respect.
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 8cd14702be9bcb2ec45e1ec30af04aea9b965708)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt | 1 +
- drivers/gpio/gpio-rcar.c | 4 ++++
- 2 files changed, 5 insertions(+)
-
-diff --git a/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt b/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt
-index 38fb86f28ba2..f60e2f477e93 100644
---- a/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt
-+++ b/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt
-@@ -9,6 +9,7 @@ Required Properties:
- - "renesas,gpio-r8a7791": for R8A7791 (R-Car M2-W) compatible GPIO controller.
- - "renesas,gpio-r8a7793": for R8A7793 (R-Car M2-N) compatible GPIO controller.
- - "renesas,gpio-r8a7794": for R8A7794 (R-Car E2) compatible GPIO controller.
-+ - "renesas,gpio-r8a7795": for R8A7795 (R-Car H3) compatible GPIO controller.
- - "renesas,gpio-rcar": for generic R-Car GPIO controller.
-
- - reg: Base address and length of each memory resource used by the GPIO
-diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
-index 4fc13ce9c60a..2a8122444614 100644
---- a/drivers/gpio/gpio-rcar.c
-+++ b/drivers/gpio/gpio-rcar.c
-@@ -342,6 +342,10 @@ static const struct of_device_id gpio_rcar_of_table[] = {
- .compatible = "renesas,gpio-r8a7794",
- .data = &gpio_rcar_info_gen2,
- }, {
-+ .compatible = "renesas,gpio-r8a7795",
-+ /* Gen3 GPIO is identical to Gen2. */
-+ .data = &gpio_rcar_info_gen2,
-+ }, {
- .compatible = "renesas,gpio-rcar",
- .data = &gpio_rcar_info_gen1,
- }, {
---
-2.6.2
-
diff --git a/patches.renesas/0140-irqchip-renesas-irqc-Get-rid-of-IRQF_VALID.patch b/patches.renesas/0140-irqchip-renesas-irqc-Get-rid-of-IRQF_VALID.patch
deleted file mode 100644
index ac6e92e30a7802..00000000000000
--- a/patches.renesas/0140-irqchip-renesas-irqc-Get-rid-of-IRQF_VALID.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 628833e3c01289566e78ba8019d98f85901f8948 Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Mon, 20 Jul 2015 19:06:14 +0900
-Subject: [PATCH 140/326] irqchip/renesas-irqc: Get rid of IRQF_VALID
-
-IRQF_VALID is not needed on ARM anymore, so get rid of it.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Cc: jason@lakedaemon.net
-Cc: geert+renesas@glider.be
-Cc: horms@verge.net.au
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Link: http://lkml.kernel.org/r/20150720100614.2552.86867.sendpatchset@little-apple
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit 35c3f67f11849d80cc0e3cd3dd898977567c9c29)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/irqchip/irq-renesas-irqc.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c
-index 778bd076aeea..74e980fa7b4e 100644
---- a/drivers/irqchip/irq-renesas-irqc.c
-+++ b/drivers/irqchip/irq-renesas-irqc.c
-@@ -162,7 +162,6 @@ static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq,
- irqc_dbg(&p->irq[hw], "map");
- irq_set_chip_data(virq, h->host_data);
- irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq);
-- set_irq_flags(virq, IRQF_VALID); /* kill me now */
- return 0;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0141-irqchip-renesas-irqc-Use-linear-IRQ-domain.patch b/patches.renesas/0141-irqchip-renesas-irqc-Use-linear-IRQ-domain.patch
deleted file mode 100644
index 02ce826e3b50ef..00000000000000
--- a/patches.renesas/0141-irqchip-renesas-irqc-Use-linear-IRQ-domain.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 11a78319e3b2670e04d8b27e8b6c49db69169a07 Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Mon, 20 Jul 2015 19:06:25 +0900
-Subject: [PATCH 141/326] irqchip/renesas-irqc: Use linear IRQ domain
-
-Use linear IRQ domain instead of irq_domain_add_simple() that also
-handles non-DT cases. This reduces the delta between the IRQC code and
-the generic chip implementation.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Cc: jason@lakedaemon.net
-Cc: geert+renesas@glider.be
-Cc: horms@verge.net.au
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Link: http://lkml.kernel.org/r/20150720100625.2552.63939.sendpatchset@little-apple
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit 7d153751c79e84a88e8c80e82ee5293085b9081b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/irqchip/irq-renesas-irqc.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c
-index 74e980fa7b4e..7f750920ed90 100644
---- a/drivers/irqchip/irq-renesas-irqc.c
-+++ b/drivers/irqchip/irq-renesas-irqc.c
-@@ -242,8 +242,8 @@ static int irqc_probe(struct platform_device *pdev)
- irq_chip->irq_set_wake = irqc_irq_set_wake;
- irq_chip->flags = IRQCHIP_MASK_ON_SUSPEND;
-
-- p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
-- p->number_of_irqs, 0,
-+ p->irq_domain = irq_domain_add_linear(pdev->dev.of_node,
-+ p->number_of_irqs,
- &irqc_irq_domain_ops, p);
- if (!p->irq_domain) {
- ret = -ENXIO;
---
-2.6.2
-
diff --git a/patches.renesas/0142-irqchip-renesas-irqc-Make-use-of-irq_find_mapping.patch b/patches.renesas/0142-irqchip-renesas-irqc-Make-use-of-irq_find_mapping.patch
deleted file mode 100644
index b29265d87d1f9d..00000000000000
--- a/patches.renesas/0142-irqchip-renesas-irqc-Make-use-of-irq_find_mapping.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 7cefd8faf336b0299f069bba54efb675b8f879c3 Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Mon, 20 Jul 2015 19:06:35 +0900
-Subject: [PATCH 142/326] irqchip/renesas-irqc: Make use of irq_find_mapping()
-
-Instead of locally caching the virq as domain_irq simply rely on the
-IRQ domain code and irq_find_mapping(). This reduces the delta
-between the IRQC driver and the generic chip implementation.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Cc: jason@lakedaemon.net
-Cc: geert+renesas@glider.be
-Cc: horms@verge.net.au
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Link: http://lkml.kernel.org/r/20150720100635.2552.20906.sendpatchset@little-apple
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit e10fc03c4f89e5191f0ad2a3885d476f498bf131)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/irqchip/irq-renesas-irqc.c | 11 ++++-------
- 1 file changed, 4 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c
-index 7f750920ed90..2aa3add711a6 100644
---- a/drivers/irqchip/irq-renesas-irqc.c
-+++ b/drivers/irqchip/irq-renesas-irqc.c
-@@ -53,7 +53,6 @@
- struct irqc_irq {
- int hw_irq;
- int requested_irq;
-- int domain_irq;
- struct irqc_priv *p;
- };
-
-@@ -70,8 +69,8 @@ struct irqc_priv {
-
- static void irqc_dbg(struct irqc_irq *i, char *str)
- {
-- dev_dbg(&i->p->pdev->dev, "%s (%d:%d:%d)\n",
-- str, i->requested_irq, i->hw_irq, i->domain_irq);
-+ dev_dbg(&i->p->pdev->dev, "%s (%d:%d)\n",
-+ str, i->requested_irq, i->hw_irq);
- }
-
- static void irqc_irq_enable(struct irq_data *d)
-@@ -145,7 +144,7 @@ static irqreturn_t irqc_irq_handler(int irq, void *dev_id)
- if (ioread32(p->iomem + DETECT_STATUS) & bit) {
- iowrite32(bit, p->iomem + DETECT_STATUS);
- irqc_dbg(i, "demux2");
-- generic_handle_irq(i->domain_irq);
-+ generic_handle_irq(irq_find_mapping(p->irq_domain, i->hw_irq));
- return IRQ_HANDLED;
- }
- return IRQ_NONE;
-@@ -156,9 +155,6 @@ static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq,
- {
- struct irqc_priv *p = h->host_data;
-
-- p->irq[hw].domain_irq = virq;
-- p->irq[hw].hw_irq = hw;
--
- irqc_dbg(&p->irq[hw], "map");
- irq_set_chip_data(virq, h->host_data);
- irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq);
-@@ -214,6 +210,7 @@ static int irqc_probe(struct platform_device *pdev)
- break;
-
- p->irq[k].p = p;
-+ p->irq[k].hw_irq = k;
- p->irq[k].requested_irq = irq->start;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0143-ARM-shmobile-R-Mobile-Move-to_rmobile_pd-from-header.patch b/patches.renesas/0143-ARM-shmobile-R-Mobile-Move-to_rmobile_pd-from-header.patch
deleted file mode 100644
index 23d25e81c0c1bc..00000000000000
--- a/patches.renesas/0143-ARM-shmobile-R-Mobile-Move-to_rmobile_pd-from-header.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From ebd8253705e7a12c307b317f045801f85a590f49 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:25 +0200
-Subject: [PATCH 143/326] ARM: shmobile: R-Mobile: Move to_rmobile_pd from
- header to source file
-
-to_rmobile_pd() is only used inside pm-rmobile.c
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 23758258220c2fcdabb30a3c6fe0a3ce6c705550)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-rmobile.c | 6 ++++++
- arch/arm/mach-shmobile/pm-rmobile.h | 6 ------
- 2 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
-index 95018209ff0b..94161c9b1878 100644
---- a/arch/arm/mach-shmobile/pm-rmobile.c
-+++ b/arch/arm/mach-shmobile/pm-rmobile.c
-@@ -34,6 +34,12 @@
- #define PSTR_RETRIES 100
- #define PSTR_DELAY_US 10
-
-+static inline
-+struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d)
-+{
-+ return container_of(d, struct rmobile_pm_domain, genpd);
-+}
-+
- static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
- {
- struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd);
-diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
-index 53219786f539..3992b619c127 100644
---- a/arch/arm/mach-shmobile/pm-rmobile.h
-+++ b/arch/arm/mach-shmobile/pm-rmobile.h
-@@ -26,12 +26,6 @@ struct rmobile_pm_domain {
- bool no_debug;
- };
-
--static inline
--struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d)
--{
-- return container_of(d, struct rmobile_pm_domain, genpd);
--}
--
- struct pm_domain_device {
- const char *domain_name;
- struct platform_device *pdev;
---
-2.6.2
-
diff --git a/patches.renesas/0144-ARM-shmobile-R-Mobile-Use-BIT-macro-instead-of-open-.patch b/patches.renesas/0144-ARM-shmobile-R-Mobile-Use-BIT-macro-instead-of-open-.patch
deleted file mode 100644
index 81d9b149d06423..00000000000000
--- a/patches.renesas/0144-ARM-shmobile-R-Mobile-Use-BIT-macro-instead-of-open-.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 6773cf21d5f71b270b5aeb53821d6d6f73655e31 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:26 +0200
-Subject: [PATCH 144/326] ARM: shmobile: R-Mobile: Use BIT() macro instead of
- open coding
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 23e95fc2964de5a38c1c76109188756420268858)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-rmobile.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
-index 94161c9b1878..b9b494f5ca99 100644
---- a/arch/arm/mach-shmobile/pm-rmobile.c
-+++ b/arch/arm/mach-shmobile/pm-rmobile.c
-@@ -48,7 +48,7 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
- if (rmobile_pd->bit_shift == ~0)
- return -EBUSY;
-
-- mask = 1 << rmobile_pd->bit_shift;
-+ mask = BIT(rmobile_pd->bit_shift);
- if (rmobile_pd->suspend) {
- int ret = rmobile_pd->suspend();
-
-@@ -85,7 +85,7 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
- if (rmobile_pd->bit_shift == ~0)
- return 0;
-
-- mask = 1 << rmobile_pd->bit_shift;
-+ mask = BIT(rmobile_pd->bit_shift);
- if (__raw_readl(rmobile_pd->base + PSTR) & mask)
- goto out;
-
---
-2.6.2
-
diff --git a/patches.renesas/0145-ARM-shmobile-r8a7779-Remove-GENPD_FLAG_PM_CLK-flag.patch b/patches.renesas/0145-ARM-shmobile-r8a7779-Remove-GENPD_FLAG_PM_CLK-flag.patch
deleted file mode 100644
index 3be1507ba00be9..00000000000000
--- a/patches.renesas/0145-ARM-shmobile-r8a7779-Remove-GENPD_FLAG_PM_CLK-flag.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 0b1581f545b45cc0ac968f4db04ecc83662d2a1f Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:33 +0200
-Subject: [PATCH 145/326] ARM: shmobile: r8a7779: Remove GENPD_FLAG_PM_CLK flag
-
-The R-Car SYSC PM Domain only manages power domains for the main CPUs
-and for coprocessors. It does not fill in the genpd .{at,de}tach_dev()
-callbacks, and no power management clocks are registered for devices.
-Hence pm_clk_{suspend,resume}() are no-ops, and setting of the
-GENPD_FLAG_PM_CLK flag can be removed.
-
-Originally the clock handling was copied from the R-Mobile PM Domain
-code, which does manage a clock domain, in addition to device power
-domains.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 564ec128320b3a69e7be6bed938be5b78e5aac95)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-r8a7779.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
-index 44a74c4c5a01..d5f258e4d890 100644
---- a/arch/arm/mach-shmobile/pm-r8a7779.c
-+++ b/arch/arm/mach-shmobile/pm-r8a7779.c
-@@ -83,7 +83,6 @@ static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd)
- {
- struct generic_pm_domain *genpd = &r8a7779_pd->genpd;
-
-- genpd->flags = GENPD_FLAG_PM_CLK;
- pm_genpd_init(genpd, NULL, false);
- genpd->dev_ops.active_wakeup = pd_active_wakeup;
- genpd->power_off = pd_power_down;
---
-2.6.2
-
diff --git a/patches.renesas/0146-ARM-shmobile-Remove-legacy-board-code-for-KZM-A9-GT.patch b/patches.renesas/0146-ARM-shmobile-Remove-legacy-board-code-for-KZM-A9-GT.patch
deleted file mode 100644
index 3f4472339bdab9..00000000000000
--- a/patches.renesas/0146-ARM-shmobile-Remove-legacy-board-code-for-KZM-A9-GT.patch
+++ /dev/null
@@ -1,1775 +0,0 @@
-From 3902319f7130e4433017c608aedc70bc74370928 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:17 +0200
-Subject: [PATCH 146/326] ARM: shmobile: Remove legacy board code for KZM-A9-GT
-
-The KZM-A9-GT board is sufficiently supported by DT-based and board-less
-SH-Mobile AG5 (sh73a0) multiplatform kernels. Hence remove the legacy
-board code to reduce maintenance effort.
-
-Lacking areas are:
- - USB (it does't work in legacy, neither),
- - LCDC (the LCDC is wired to the legacy INTC, which is not planned to
- be supported with DT).
- - DMAC/IPMMU (no DT bindings are planned).
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 30f8925a57d8ad4990fca14bcf454abd91228afd)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/Kconfig | 8 -
- arch/arm/mach-shmobile/Makefile | 1 -
- arch/arm/mach-shmobile/Makefile.boot | 1 -
- arch/arm/mach-shmobile/board-kzm9g.c | 916 ---------------------
- arch/arm/mach-shmobile/include/mach/head-kzm9g.txt | 410 ---------
- arch/arm/mach-shmobile/include/mach/zboot.h | 5 -
- arch/arm/mach-shmobile/intc-sh73a0.c | 337 --------
- 7 files changed, 1678 deletions(-)
- delete mode 100644 arch/arm/mach-shmobile/board-kzm9g.c
- delete mode 100644 arch/arm/mach-shmobile/include/mach/head-kzm9g.txt
- delete mode 100644 arch/arm/mach-shmobile/intc-sh73a0.c
-
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index 34eac88a9889..b85b34c1d6e0 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -173,14 +173,6 @@ config MACH_MARZEN
- select REGULATOR_FIXED_VOLTAGE if REGULATOR
- select USE_OF
-
--config MACH_KZM9G
-- bool "KZM-A9-GT board"
-- depends on ARCH_SH73A0
-- select ARCH_REQUIRE_GPIOLIB
-- select REGULATOR_FIXED_VOLTAGE if REGULATOR
-- select SND_SOC_AK4642 if SND_SIMPLE_CARD
-- select USE_OF
--
- comment "Renesas ARM SoCs System Configuration"
-
- config CPU_HAS_INTEVT
-diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
-index 89e463de4479..a4d7f5734e91 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -58,7 +58,6 @@ obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
- obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
- obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
- obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
--obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o intc-sh73a0.o
- endif
-
- # Framework support
-diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
-index e1ef19cef89c..2269b1c3c30b 100644
---- a/arch/arm/mach-shmobile/Makefile.boot
-+++ b/arch/arm/mach-shmobile/Makefile.boot
-@@ -3,7 +3,6 @@ loadaddr-y :=
- loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
- loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
- loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000
--loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
- loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
-
- __ZRELADDR := $(sort $(loadaddr-y))
-diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
-deleted file mode 100644
-index 260d8319fd82..000000000000
---- a/arch/arm/mach-shmobile/board-kzm9g.c
-+++ /dev/null
-@@ -1,916 +0,0 @@
--/*
-- * KZM-A9-GT board support
-- *
-- * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; version 2 of the License.
-- *
-- * 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/delay.h>
--#include <linux/gpio.h>
--#include <linux/gpio_keys.h>
--#include <linux/io.h>
--#include <linux/irq.h>
--#include <linux/i2c.h>
--#include <linux/i2c/pcf857x.h>
--#include <linux/input.h>
--#include <linux/irqchip/arm-gic.h>
--#include <linux/mmc/host.h>
--#include <linux/mmc/sh_mmcif.h>
--#include <linux/mmc/sh_mobile_sdhi.h>
--#include <linux/mfd/as3711.h>
--#include <linux/mfd/tmio.h>
--#include <linux/pinctrl/machine.h>
--#include <linux/pinctrl/pinconf-generic.h>
--#include <linux/platform_device.h>
--#include <linux/reboot.h>
--#include <linux/regulator/fixed.h>
--#include <linux/regulator/machine.h>
--#include <linux/smsc911x.h>
--#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 <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 "intc.h"
--#include "irqs.h"
--#include "sh73a0.h"
--
--/*
-- * external GPIO
-- */
--#define GPIO_PCF8575_BASE (310)
--#define GPIO_PCF8575_PORT10 (GPIO_PCF8575_BASE + 8)
--#define GPIO_PCF8575_PORT11 (GPIO_PCF8575_BASE + 9)
--#define GPIO_PCF8575_PORT12 (GPIO_PCF8575_BASE + 10)
--#define GPIO_PCF8575_PORT13 (GPIO_PCF8575_BASE + 11)
--#define GPIO_PCF8575_PORT14 (GPIO_PCF8575_BASE + 12)
--#define GPIO_PCF8575_PORT15 (GPIO_PCF8575_BASE + 13)
--#define GPIO_PCF8575_PORT16 (GPIO_PCF8575_BASE + 14)
--
--/* Dummy supplies, where voltage doesn't matter */
--static struct regulator_consumer_supply dummy_supplies[] = {
-- REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
-- REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
--};
--
--/*
-- * FSI-AK4648
-- *
-- * this command is required when playback.
-- *
-- * # amixer set "LINEOUT Mixer DACL" on
-- */
--
--/* SMSC 9221 */
--static struct resource smsc9221_resources[] = {
-- [0] = {
-- .start = 0x10000000, /* CS4 */
-- .end = 0x100000ff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = irq_pin(3), /* IRQ3 */
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct smsc911x_platform_config smsc9221_platdata = {
-- .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
-- .phy_interface = PHY_INTERFACE_MODE_MII,
-- .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-- .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
--};
--
--static struct platform_device smsc_device = {
-- .name = "smsc911x",
-- .dev = {
-- .platform_data = &smsc9221_platdata,
-- },
-- .resource = smsc9221_resources,
-- .num_resources = ARRAY_SIZE(smsc9221_resources),
--};
--
--/* USB external chip */
--static struct r8a66597_platdata usb_host_data = {
-- .on_chip = 0,
-- .xtal = R8A66597_PLATDATA_XTAL_48MHZ,
--};
--
--static struct resource usb_resources[] = {
-- [0] = {
-- .start = 0x10010000,
-- .end = 0x1001ffff - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = irq_pin(1), /* IRQ1 */
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device usb_host_device = {
-- .name = "r8a66597_hcd",
-- .dev = {
-- .platform_data = &usb_host_data,
-- .dma_mask = NULL,
-- .coherent_dma_mask = 0xffffffff,
-- },
-- .num_resources = ARRAY_SIZE(usb_resources),
-- .resource = usb_resources,
--};
--
--/* USB Func CN17 */
--struct usbhs_private {
-- void __iomem *phy;
-- void __iomem *cr2;
-- struct renesas_usbhs_platform_info info;
--};
--
--#define IRQ15 irq_pin(15)
--#define USB_PHY_MODE (1 << 4)
--#define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
--#define USB_PHY_ON (1 << 1)
--#define USB_PHY_OFF (1 << 0)
--#define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF)
--
--#define usbhs_get_priv(pdev) \
-- container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info)
--
--static int usbhs_get_vbus(struct platform_device *pdev)
--{
-- struct usbhs_private *priv = usbhs_get_priv(pdev);
--
-- return !((1 << 7) & __raw_readw(priv->cr2));
--}
--
--static int usbhs_phy_reset(struct platform_device *pdev)
--{
-- struct usbhs_private *priv = usbhs_get_priv(pdev);
--
-- /* init phy */
-- __raw_writew(0x8a0a, priv->cr2);
--
-- return 0;
--}
--
--static int usbhs_get_id(struct platform_device *pdev)
--{
-- return USBHS_GADGET;
--}
--
--static irqreturn_t usbhs_interrupt(int irq, void *data)
--{
-- struct platform_device *pdev = data;
-- struct usbhs_private *priv = usbhs_get_priv(pdev);
--
-- renesas_usbhs_call_notify_hotplug(pdev);
--
-- /* clear status */
-- __raw_writew(__raw_readw(priv->phy) | USB_PHY_INT_CLR, priv->phy);
--
-- return IRQ_HANDLED;
--}
--
--static int usbhs_hardware_init(struct platform_device *pdev)
--{
-- struct usbhs_private *priv = usbhs_get_priv(pdev);
-- int ret;
--
-- /* clear interrupt status */
-- __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
--
-- ret = request_irq(IRQ15, usbhs_interrupt, IRQF_TRIGGER_HIGH,
-- dev_name(&pdev->dev), pdev);
-- if (ret) {
-- dev_err(&pdev->dev, "request_irq err\n");
-- return ret;
-- }
--
-- /* enable USB phy interrupt */
-- __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->phy);
--
-- return 0;
--}
--
--static int usbhs_hardware_exit(struct platform_device *pdev)
--{
-- struct usbhs_private *priv = usbhs_get_priv(pdev);
--
-- /* clear interrupt status */
-- __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
--
-- free_irq(IRQ15, pdev);
--
-- return 0;
--}
--
--static u32 usbhs_pipe_cfg[] = {
-- 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,
--};
--
--static struct usbhs_private usbhs_private = {
-- .phy = IOMEM(0xe60781e0), /* USBPHYINT */
-- .cr2 = IOMEM(0xe605810c), /* USBCR2 */
-- .info = {
-- .platform_callback = {
-- .hardware_init = usbhs_hardware_init,
-- .hardware_exit = usbhs_hardware_exit,
-- .get_id = usbhs_get_id,
-- .phy_reset = usbhs_phy_reset,
-- .get_vbus = usbhs_get_vbus,
-- },
-- .driver_param = {
-- .buswait_bwait = 4,
-- .has_otg = 1,
-- .pipe_type = usbhs_pipe_cfg,
-- .pipe_size = ARRAY_SIZE(usbhs_pipe_cfg),
-- },
-- },
--};
--
--static struct resource usbhs_resources[] = {
-- [0] = {
-- .start = 0xE6890000,
-- .end = 0xE68900e6 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(62),
-- .end = gic_spi(62),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device usbhs_device = {
-- .name = "renesas_usbhs",
-- .id = -1,
-- .dev = {
-- .dma_mask = NULL,
-- .coherent_dma_mask = 0xffffffff,
-- .platform_data = &usbhs_private.info,
-- },
-- .num_resources = ARRAY_SIZE(usbhs_resources),
-- .resource = usbhs_resources,
--};
--
--/* LCDC */
--static struct fb_videomode kzm_lcdc_mode = {
-- .name = "WVGA Panel",
-- .xres = 800,
-- .yres = 480,
-- .left_margin = 220,
-- .right_margin = 110,
-- .hsync_len = 70,
-- .upper_margin = 20,
-- .lower_margin = 5,
-- .vsync_len = 5,
-- .sync = 0,
--};
--
--static struct sh_mobile_lcdc_info lcdc_info = {
-- .clock_source = LCDC_CLK_BUS,
-- .ch[0] = {
-- .chan = LCDC_CHAN_MAINLCD,
-- .fourcc = V4L2_PIX_FMT_RGB565,
-- .interface_type = RGB24,
-- .lcd_modes = &kzm_lcdc_mode,
-- .num_modes = 1,
-- .clock_divider = 5,
-- .flags = 0,
-- .panel_cfg = {
-- .width = 152,
-- .height = 91,
-- },
-- }
--};
--
--static struct resource lcdc_resources[] = {
-- [0] = {
-- .name = "LCDC",
-- .start = 0xfe940000,
-- .end = 0xfe943fff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = intcs_evt2irq(0x580),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device lcdc_device = {
-- .name = "sh_mobile_lcdc_fb",
-- .num_resources = ARRAY_SIZE(lcdc_resources),
-- .resource = lcdc_resources,
-- .dev = {
-- .platform_data = &lcdc_info,
-- .coherent_dma_mask = DMA_BIT_MASK(32),
-- },
--};
--
--/* Fixed 1.8V regulator to be used by MMCIF */
--static struct regulator_consumer_supply fixed1v8_power_consumers[] =
--{
-- REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
-- REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
--};
--
--/* MMCIF */
--static struct resource sh_mmcif_resources[] = {
-- [0] = {
-- .name = "MMCIF",
-- .start = 0xe6bd0000,
-- .end = 0xe6bd00ff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(140),
-- .flags = IORESOURCE_IRQ,
-- },
-- [2] = {
-- .start = gic_spi(141),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct sh_mmcif_plat_data sh_mmcif_platdata = {
-- .ocr = MMC_VDD_165_195,
-- .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
-- .ccs_unsupported = true,
-- .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
-- .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
--};
--
--static struct platform_device mmc_device = {
-- .name = "sh_mmcif",
-- .dev = {
-- .dma_mask = NULL,
-- .coherent_dma_mask = 0xffffffff,
-- .platform_data = &sh_mmcif_platdata,
-- },
-- .num_resources = ARRAY_SIZE(sh_mmcif_resources),
-- .resource = sh_mmcif_resources,
--};
--
--/* Fixed 3.3V regulators to be used by SDHI0 */
--static struct regulator_consumer_supply vcc_sdhi0_consumers[] =
--{
-- REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
--};
--
--static struct regulator_init_data vcc_sdhi0_init_data = {
-- .constraints = {
-- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-- },
-- .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
-- .consumer_supplies = vcc_sdhi0_consumers,
--};
--
--static struct fixed_voltage_config vcc_sdhi0_info = {
-- .supply_name = "SDHI0 Vcc",
-- .microvolts = 3300000,
-- .gpio = 15,
-- .enable_high = 1,
-- .init_data = &vcc_sdhi0_init_data,
--};
--
--static struct platform_device vcc_sdhi0 = {
-- .name = "reg-fixed-voltage",
-- .id = 0,
-- .dev = {
-- .platform_data = &vcc_sdhi0_info,
-- },
--};
--
--/* Fixed 3.3V regulators to be used by SDHI2 */
--static struct regulator_consumer_supply vcc_sdhi2_consumers[] =
--{
-- REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
--};
--
--static struct regulator_init_data vcc_sdhi2_init_data = {
-- .constraints = {
-- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-- },
-- .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi2_consumers),
-- .consumer_supplies = vcc_sdhi2_consumers,
--};
--
--static struct fixed_voltage_config vcc_sdhi2_info = {
-- .supply_name = "SDHI2 Vcc",
-- .microvolts = 3300000,
-- .gpio = 14,
-- .enable_high = 1,
-- .init_data = &vcc_sdhi2_init_data,
--};
--
--static struct platform_device vcc_sdhi2 = {
-- .name = "reg-fixed-voltage",
-- .id = 1,
-- .dev = {
-- .platform_data = &vcc_sdhi2_info,
-- },
--};
--
--/* SDHI */
--static struct tmio_mmc_data sdhi0_info = {
-- .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
-- .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
-- .flags = TMIO_MMC_HAS_IDLE_WAIT,
-- .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
-- MMC_CAP_POWER_OFF_CARD,
--};
--
--static struct resource sdhi0_resources[] = {
-- [0] = {
-- .name = "SDHI0",
-- .start = 0xee100000,
-- .end = 0xee1000ff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
-- .start = gic_spi(83),
-- .flags = IORESOURCE_IRQ,
-- },
-- [2] = {
-- .name = SH_MOBILE_SDHI_IRQ_SDCARD,
-- .start = gic_spi(84),
-- .flags = IORESOURCE_IRQ,
-- },
-- [3] = {
-- .name = SH_MOBILE_SDHI_IRQ_SDIO,
-- .start = gic_spi(85),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device sdhi0_device = {
-- .name = "sh_mobile_sdhi",
-- .num_resources = ARRAY_SIZE(sdhi0_resources),
-- .resource = sdhi0_resources,
-- .dev = {
-- .platform_data = &sdhi0_info,
-- },
--};
--
--/* Micro SD */
--static struct tmio_mmc_data sdhi2_info = {
-- .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI2_TX,
-- .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI2_RX,
-- .flags = TMIO_MMC_HAS_IDLE_WAIT |
-- TMIO_MMC_USE_GPIO_CD |
-- TMIO_MMC_WRPROTECT_DISABLE,
-- .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_POWER_OFF_CARD,
-- .cd_gpio = 13,
--};
--
--static struct resource sdhi2_resources[] = {
-- [0] = {
-- .name = "SDHI2",
-- .start = 0xee140000,
-- .end = 0xee1400ff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
-- .start = gic_spi(103),
-- .flags = IORESOURCE_IRQ,
-- },
-- [2] = {
-- .name = SH_MOBILE_SDHI_IRQ_SDCARD,
-- .start = gic_spi(104),
-- .flags = IORESOURCE_IRQ,
-- },
-- [3] = {
-- .name = SH_MOBILE_SDHI_IRQ_SDIO,
-- .start = gic_spi(105),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device sdhi2_device = {
-- .name = "sh_mobile_sdhi",
-- .id = 2,
-- .num_resources = ARRAY_SIZE(sdhi2_resources),
-- .resource = sdhi2_resources,
-- .dev = {
-- .platform_data = &sdhi2_info,
-- },
--};
--
--/* KEY */
--#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
--
--static struct gpio_keys_button gpio_buttons[] = {
-- GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"),
-- GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"),
-- GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"),
-- GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"),
-- GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"),
-- GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"),
-- GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"),
--};
--
--static struct gpio_keys_platform_data gpio_key_info = {
-- .buttons = gpio_buttons,
-- .nbuttons = ARRAY_SIZE(gpio_buttons),
--};
--
--static struct platform_device gpio_keys_device = {
-- .name = "gpio-keys",
-- .dev = {
-- .platform_data = &gpio_key_info,
-- },
--};
--
--/* FSI-AK4648 */
--static struct sh_fsi_platform_info fsi_info = {
-- .port_a = {
-- .tx_id = SHDMA_SLAVE_FSI2A_TX,
-- },
--};
--
--static struct resource fsi_resources[] = {
-- [0] = {
-- .name = "FSI",
-- .start = 0xEC230000,
-- .end = 0xEC230400 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(146),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device fsi_device = {
-- .name = "sh_fsi2",
-- .id = -1,
-- .num_resources = ARRAY_SIZE(fsi_resources),
-- .resource = fsi_resources,
-- .dev = {
-- .platform_data = &fsi_info,
-- },
--};
--
--static struct asoc_simple_card_info fsi2_ak4648_info = {
-- .name = "AK4648",
-- .card = "FSI2A-AK4648",
-- .codec = "ak4642-codec.0-0012",
-- .platform = "sh_fsi2",
-- .daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
-- .cpu_dai = {
-- .name = "fsia-dai",
-- },
-- .codec_dai = {
-- .name = "ak4642-hifi",
-- .sysclk = 11289600,
-- },
--};
--
--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,
-- },
--};
--
--/* I2C */
--
--/* StepDown1 is used to supply 1.315V to the CPU */
--static struct regulator_init_data as3711_sd1 = {
-- .constraints = {
-- .name = "1.315V CPU",
-- .boot_on = 1,
-- .always_on = 1,
-- .min_uV = 1315000,
-- .max_uV = 1335000,
-- },
--};
--
--/* StepDown2 is used to supply 1.8V to the CPU and to the board */
--static struct regulator_init_data as3711_sd2 = {
-- .constraints = {
-- .name = "1.8V",
-- .boot_on = 1,
-- .always_on = 1,
-- .min_uV = 1800000,
-- .max_uV = 1800000,
-- },
--};
--
--/*
-- * StepDown3 is switched in parallel with StepDown2, seems to be off,
-- * according to read-back pre-set register values
-- */
--
--/* StepDown4 is used to supply 1.215V to the CPU and to the board */
--static struct regulator_init_data as3711_sd4 = {
-- .constraints = {
-- .name = "1.215V",
-- .boot_on = 1,
-- .always_on = 1,
-- .min_uV = 1215000,
-- .max_uV = 1235000,
-- },
--};
--
--/* LDO1 is unused and unconnected */
--
--/* LDO2 is used to supply 2.8V to the CPU */
--static struct regulator_init_data as3711_ldo2 = {
-- .constraints = {
-- .name = "2.8V CPU",
-- .boot_on = 1,
-- .always_on = 1,
-- .min_uV = 2800000,
-- .max_uV = 2800000,
-- },
--};
--
--/* LDO3 is used to supply 3.0V to the CPU */
--static struct regulator_init_data as3711_ldo3 = {
-- .constraints = {
-- .name = "3.0V CPU",
-- .boot_on = 1,
-- .always_on = 1,
-- .min_uV = 3000000,
-- .max_uV = 3000000,
-- },
--};
--
--/* LDO4 is used to supply 2.8V to the board */
--static struct regulator_init_data as3711_ldo4 = {
-- .constraints = {
-- .name = "2.8V",
-- .boot_on = 1,
-- .always_on = 1,
-- .min_uV = 2800000,
-- .max_uV = 2800000,
-- },
--};
--
--/* LDO5 is switched parallel to LDO4, also set to 2.8V */
--static struct regulator_init_data as3711_ldo5 = {
-- .constraints = {
-- .name = "2.8V #2",
-- .boot_on = 1,
-- .always_on = 1,
-- .min_uV = 2800000,
-- .max_uV = 2800000,
-- },
--};
--
--/* LDO6 is unused and unconnected */
--
--/* LDO7 is used to supply 1.15V to the CPU */
--static struct regulator_init_data as3711_ldo7 = {
-- .constraints = {
-- .name = "1.15V CPU",
-- .boot_on = 1,
-- .always_on = 1,
-- .min_uV = 1150000,
-- .max_uV = 1150000,
-- },
--};
--
--/* LDO8 is switched parallel to LDO7, also set to 1.15V */
--static struct regulator_init_data as3711_ldo8 = {
-- .constraints = {
-- .name = "1.15V CPU #2",
-- .boot_on = 1,
-- .always_on = 1,
-- .min_uV = 1150000,
-- .max_uV = 1150000,
-- },
--};
--
--static struct as3711_platform_data as3711_pdata = {
-- .regulator = {
-- .init_data = {
-- [AS3711_REGULATOR_SD_1] = &as3711_sd1,
-- [AS3711_REGULATOR_SD_2] = &as3711_sd2,
-- [AS3711_REGULATOR_SD_4] = &as3711_sd4,
-- [AS3711_REGULATOR_LDO_2] = &as3711_ldo2,
-- [AS3711_REGULATOR_LDO_3] = &as3711_ldo3,
-- [AS3711_REGULATOR_LDO_4] = &as3711_ldo4,
-- [AS3711_REGULATOR_LDO_5] = &as3711_ldo5,
-- [AS3711_REGULATOR_LDO_7] = &as3711_ldo7,
-- [AS3711_REGULATOR_LDO_8] = &as3711_ldo8,
-- },
-- },
-- .backlight = {
-- .su2_fb = "sh_mobile_lcdc_fb.0",
-- .su2_max_uA = 36000,
-- .su2_feedback = AS3711_SU2_CURR_AUTO,
-- .su2_fbprot = AS3711_SU2_GPIO4,
-- .su2_auto_curr1 = true,
-- .su2_auto_curr2 = true,
-- .su2_auto_curr3 = true,
-- },
--};
--
--static struct pcf857x_platform_data pcf8575_pdata = {
-- .gpio_base = GPIO_PCF8575_BASE,
--};
--
--static struct i2c_board_info i2c0_devices[] = {
-- {
-- I2C_BOARD_INFO("ak4648", 0x12),
-- },
-- {
-- I2C_BOARD_INFO("r2025sd", 0x32),
-- },
-- {
-- I2C_BOARD_INFO("ak8975", 0x0c),
-- .irq = irq_pin(28), /* IRQ28 */
-- },
-- {
-- I2C_BOARD_INFO("adxl34x", 0x1d),
-- .irq = irq_pin(26), /* IRQ26 */
-- },
-- {
-- I2C_BOARD_INFO("as3711", 0x40),
-- .irq = intcs_evt2irq(0x3300), /* IRQ24 */
-- .platform_data = &as3711_pdata,
-- },
--};
--
--static struct i2c_board_info i2c1_devices[] = {
-- {
-- I2C_BOARD_INFO("st1232-ts", 0x55),
-- .irq = irq_pin(8), /* IRQ8 */
-- },
--};
--
--static struct i2c_board_info i2c3_devices[] = {
-- {
-- I2C_BOARD_INFO("pcf8575", 0x20),
-- .irq = irq_pin(19), /* IRQ19 */
-- .platform_data = &pcf8575_pdata,
-- },
--};
--
--static struct platform_device *kzm_devices[] __initdata = {
-- &smsc_device,
-- &usb_host_device,
-- &usbhs_device,
-- &lcdc_device,
-- &mmc_device,
-- &vcc_sdhi0,
-- &vcc_sdhi2,
-- &sdhi0_device,
-- &sdhi2_device,
-- &gpio_keys_device,
-- &fsi_device,
-- &fsi_ak4648_device,
--};
--
--static unsigned long pin_pullup_conf[] = {
-- PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
--};
--
--static const struct pinctrl_map kzm_pinctrl_map[] = {
-- /* FSIA (AK4648) */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
-- "fsia_mclk_in", "fsia"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
-- "fsia_sclk_in", "fsia"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
-- "fsia_data_in", "fsia"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
-- "fsia_data_out", "fsia"),
-- /* I2C3 */
-- PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0",
-- "i2c3_1", "i2c3"),
-- /* LCD */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
-- "lcd_data24", "lcd"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
-- "lcd_sync", "lcd"),
-- /* MMCIF */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
-- "mmc0_data8_0", "mmc0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
-- "mmc0_ctrl_0", "mmc0"),
-- PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
-- "PORT279", pin_pullup_conf),
-- PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
-- "mmc0_data8_0", pin_pullup_conf),
-- /* SCIFA4 */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
-- "scifa4_data", "scifa4"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
-- "scifa4_ctrl", "scifa4"),
-- /* SDHI0 */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
-- "sdhi0_data4", "sdhi0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
-- "sdhi0_ctrl", "sdhi0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
-- "sdhi0_cd", "sdhi0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
-- "sdhi0_wp", "sdhi0"),
-- /* SDHI2 */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
-- "sdhi2_data4", "sdhi2"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
-- "sdhi2_ctrl", "sdhi2"),
-- /* SMSC */
-- PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
-- "bsc_cs4", "bsc"),
-- /* USB */
-- PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-sh73a0",
-- "usb_vbus", "usb"),
--};
--
--static void __init kzm_init(void)
--{
-- regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers,
-- ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
-- regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
--
-- pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map));
--
-- sh73a0_pinmux_init();
--
-- /* SMSC */
-- gpio_request_one(224, GPIOF_IN, NULL); /* IRQ3 */
--
-- /* LCDC */
-- gpio_request_one(222, GPIOF_OUT_INIT_HIGH, NULL); /* LCDCDON */
-- gpio_request_one(226, GPIOF_OUT_INIT_HIGH, NULL); /* SC */
--
-- /* Touchscreen */
-- gpio_request_one(223, GPIOF_IN, NULL); /* IRQ8 */
--
--#ifdef CONFIG_CACHE_L2X0
-- /* Shared attribute override enable, 64K*8way */
-- l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff);
--#endif
--
-- i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
-- i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices));
-- i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices));
--
-- sh73a0_add_standard_devices();
-- platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices));
--
-- sh73a0_pm_init();
--}
--
--static void kzm9g_restart(enum reboot_mode mode, const char *cmd)
--{
--#define RESCNT2 IOMEM(0xe6188020)
-- /* Do soft power on reset */
-- writel((1 << 31), RESCNT2);
--}
--
--static const char *kzm9g_boards_compat_dt[] __initdata = {
-- "renesas,kzm9g",
-- NULL,
--};
--
--DT_MACHINE_START(KZM9G_DT, "kzm9g")
-- .smp = smp_ops(sh73a0_smp_ops),
-- .map_io = sh73a0_map_io,
-- .init_early = sh73a0_add_early_devices,
-- .init_irq = sh73a0_init_irq,
-- .init_machine = kzm_init,
-- .init_late = shmobile_init_late,
-- .init_time = sh73a0_earlytimer_init,
-- .restart = kzm9g_restart,
-- .dt_compat = kzm9g_boards_compat_dt,
--MACHINE_END
-diff --git a/arch/arm/mach-shmobile/include/mach/head-kzm9g.txt b/arch/arm/mach-shmobile/include/mach/head-kzm9g.txt
-deleted file mode 100644
-index 9531f46a822a..000000000000
---- a/arch/arm/mach-shmobile/include/mach/head-kzm9g.txt
-+++ /dev/null
-@@ -1,410 +0,0 @@
--LIST "KZM9G low-level initialization routine."
--LIST "Adapted from u-boot KZM9G support code."
--
--LIST "Copyright (C) 2013 Ulrich Hecht"
--
--LIST "This program is free software; you can redistribute it and/or modify"
--LIST "it under the terms of the GNU General Public License version 2 as"
--LIST "published by the Free Software Foundation."
--
--LIST "This program is distributed in the hope that it will be useful,"
--LIST "but WITHOUT ANY WARRANTY; without even the implied warranty of"
--LIST "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
--LIST "GNU General Public License for more details."
--
--
--LIST "Register definitions:"
--
--LIST "Secure control register"
--#define LIFEC_SEC_SRC (0xE6110008)
--
--LIST "RWDT"
--#define RWDT_BASE (0xE6020000)
--#define RWTCSRA0 (RWDT_BASE + 0x04)
--
--LIST "HPB Semaphore Control Registers"
--#define HPBSCR_BASE (0xE6000000)
--#define HPBCTRL6 (HPBSCR_BASE + 0x1030)
--
--#define SBSC1_BASE (0xFE400000)
--#define SDCR0A (SBSC1_BASE + 0x0008)
--#define SDCR1A (SBSC1_BASE + 0x000C)
--#define SDPCRA (SBSC1_BASE + 0x0010)
--#define SDCR0SA (SBSC1_BASE + 0x0018)
--#define SDCR1SA (SBSC1_BASE + 0x001C)
--#define RTCSRA (SBSC1_BASE + 0x0020)
--#define RTCORA (SBSC1_BASE + 0x0028)
--#define RTCORHA (SBSC1_BASE + 0x002C)
--#define SDWCRC0A (SBSC1_BASE + 0x0040)
--#define SDWCRC1A (SBSC1_BASE + 0x0044)
--#define SDWCR00A (SBSC1_BASE + 0x0048)
--#define SDWCR01A (SBSC1_BASE + 0x004C)
--#define SDWCR10A (SBSC1_BASE + 0x0050)
--#define SDWCR11A (SBSC1_BASE + 0x0054)
--#define SDWCR2A (SBSC1_BASE + 0x0060)
--#define SDWCRC2A (SBSC1_BASE + 0x0064)
--#define ZQCCRA (SBSC1_BASE + 0x0068)
--#define SDMRACR0A (SBSC1_BASE + 0x0084)
--#define SDMRTMPCRA (SBSC1_BASE + 0x008C)
--#define SDMRTMPMSKA (SBSC1_BASE + 0x0094)
--#define SDGENCNTA (SBSC1_BASE + 0x009C)
--#define SDDRVCR0A (SBSC1_BASE + 0x00B4)
--#define DLLCNT0A (SBSC1_BASE + 0x0354)
--
--#define SDMRA1 (0xFE500000)
--#define SDMRA2 (0xFE5C0000)
--#define SDMRA3 (0xFE504000)
--
--#define SBSC2_BASE (0xFB400000)
--#define SDCR0B (SBSC2_BASE + 0x0008)
--#define SDCR1B (SBSC2_BASE + 0x000C)
--#define SDPCRB (SBSC2_BASE + 0x0010)
--#define SDCR0SB (SBSC2_BASE + 0x0018)
--#define SDCR1SB (SBSC2_BASE + 0x001C)
--#define RTCSRB (SBSC2_BASE + 0x0020)
--#define RTCORB (SBSC2_BASE + 0x0028)
--#define RTCORHB (SBSC2_BASE + 0x002C)
--#define SDWCRC0B (SBSC2_BASE + 0x0040)
--#define SDWCRC1B (SBSC2_BASE + 0x0044)
--#define SDWCR00B (SBSC2_BASE + 0x0048)
--#define SDWCR01B (SBSC2_BASE + 0x004C)
--#define SDWCR10B (SBSC2_BASE + 0x0050)
--#define SDWCR11B (SBSC2_BASE + 0x0054)
--#define SDPDCR0B (SBSC2_BASE + 0x0058)
--#define SDWCR2B (SBSC2_BASE + 0x0060)
--#define SDWCRC2B (SBSC2_BASE + 0x0064)
--#define ZQCCRB (SBSC2_BASE + 0x0068)
--#define SDMRACR0B (SBSC2_BASE + 0x0084)
--#define SDMRTMPCRB (SBSC2_BASE + 0x008C)
--#define SDMRTMPMSKB (SBSC2_BASE + 0x0094)
--#define SDGENCNTB (SBSC2_BASE + 0x009C)
--#define DPHYCNT0B (SBSC2_BASE + 0x00A0)
--#define DPHYCNT1B (SBSC2_BASE + 0x00A4)
--#define DPHYCNT2B (SBSC2_BASE + 0x00A8)
--#define SDDRVCR0B (SBSC2_BASE + 0x00B4)
--#define DLLCNT0B (SBSC2_BASE + 0x0354)
--
--#define SDMRB1 (0xFB500000)
--#define SDMRB2 (0xFB5C0000)
--#define SDMRB3 (0xFB504000)
--
--#define CPG_BASE (0xE6150000)
--#define FRQCRA (CPG_BASE + 0x0000)
--#define FRQCRB (CPG_BASE + 0x0004)
--#define FRQCRD (CPG_BASE + 0x00E4)
--#define VCLKCR1 (CPG_BASE + 0x0008)
--#define VCLKCR2 (CPG_BASE + 0x000C)
--#define VCLKCR3 (CPG_BASE + 0x001C)
--#define ZBCKCR (CPG_BASE + 0x0010)
--#define FLCKCR (CPG_BASE + 0x0014)
--#define SD0CKCR (CPG_BASE + 0x0074)
--#define SD1CKCR (CPG_BASE + 0x0078)
--#define SD2CKCR (CPG_BASE + 0x007C)
--#define FSIACKCR (CPG_BASE + 0x0018)
--#define SUBCKCR (CPG_BASE + 0x0080)
--#define SPUACKCR (CPG_BASE + 0x0084)
--#define SPUVCKCR (CPG_BASE + 0x0094)
--#define MSUCKCR (CPG_BASE + 0x0088)
--#define HSICKCR (CPG_BASE + 0x008C)
--#define FSIBCKCR (CPG_BASE + 0x0090)
--#define MFCK1CR (CPG_BASE + 0x0098)
--#define MFCK2CR (CPG_BASE + 0x009C)
--#define DSITCKCR (CPG_BASE + 0x0060)
--#define DSI0PCKCR (CPG_BASE + 0x0064)
--#define DSI1PCKCR (CPG_BASE + 0x0068)
--#define DSI0PHYCR (CPG_BASE + 0x006C)
--#define DVFSCR3 (CPG_BASE + 0x0174)
--#define DVFSCR4 (CPG_BASE + 0x0178)
--#define DVFSCR5 (CPG_BASE + 0x017C)
--#define MPMODE (CPG_BASE + 0x00CC)
--
--#define PLLECR (CPG_BASE + 0x00D0)
--#define PLL0CR (CPG_BASE + 0x00D8)
--#define PLL1CR (CPG_BASE + 0x0028)
--#define PLL2CR (CPG_BASE + 0x002C)
--#define PLL3CR (CPG_BASE + 0x00DC)
--#define PLL0STPCR (CPG_BASE + 0x00F0)
--#define PLL1STPCR (CPG_BASE + 0x00C8)
--#define PLL2STPCR (CPG_BASE + 0x00F8)
--#define PLL3STPCR (CPG_BASE + 0x00FC)
--#define RMSTPCR0 (CPG_BASE + 0x0110)
--#define RMSTPCR1 (CPG_BASE + 0x0114)
--#define RMSTPCR2 (CPG_BASE + 0x0118)
--#define RMSTPCR3 (CPG_BASE + 0x011C)
--#define RMSTPCR4 (CPG_BASE + 0x0120)
--#define RMSTPCR5 (CPG_BASE + 0x0124)
--#define SMSTPCR0 (CPG_BASE + 0x0130)
--#define SMSTPCR2 (CPG_BASE + 0x0138)
--#define SMSTPCR3 (CPG_BASE + 0x013C)
--#define CPGXXCR4 (CPG_BASE + 0x0150)
--#define SRCR0 (CPG_BASE + 0x80A0)
--#define SRCR2 (CPG_BASE + 0x80B0)
--#define SRCR3 (CPG_BASE + 0x80A8)
--#define VREFCR (CPG_BASE + 0x00EC)
--#define PCLKCR (CPG_BASE + 0x1020)
--
--#define PORT32CR (0xE6051020)
--#define PORT33CR (0xE6051021)
--#define PORT34CR (0xE6051022)
--#define PORT35CR (0xE6051023)
--
--LIST "DRAM initialization code:"
--
--EW RWTCSRA0, 0xA507
--
--ED_AND LIFEC_SEC_SRC, 0xFFFF7FFF
--
--ED_AND SMSTPCR3,0xFFFF7FFF
--ED_AND SRCR3, 0xFFFF7FFF
--ED_AND SMSTPCR2,0xFFFBFFFF
--ED_AND SRCR2, 0xFFFBFFFF
--ED PLLECR, 0x00000000
--
--WAIT_MASK PLLECR, 0x00000F00, 0x00000000
--WAIT_MASK FRQCRB, 0x80000000, 0x00000000
--
--ED PLL0CR, 0x2D000000
--ED PLL1CR, 0x17100000
--ED FRQCRB, 0x96235880
--WAIT_MASK FRQCRB, 0x80000000, 0x00000000
--
--ED FLCKCR, 0x0000000B
--ED_AND SMSTPCR0, 0xFFFFFFFD
--
--ED_AND SRCR0, 0xFFFFFFFD
--ED 0xE6001628, 0x514
--ED 0xE6001648, 0x514
--ED 0xE6001658, 0x514
--ED 0xE6001678, 0x514
--
--ED DVFSCR4, 0x00092000
--ED DVFSCR5, 0x000000DC
--ED PLLECR, 0x00000000
--WAIT_MASK PLLECR, 0x00000F00, 0x00000000
--
--ED FRQCRA, 0x0012453C
--ED FRQCRB, 0x80431350
--WAIT_MASK FRQCRB, 0x80000000, 0x00000000
--ED FRQCRD, 0x00000B0B
--WAIT_MASK FRQCRD, 0x80000000, 0x00000000
--
--ED PCLKCR, 0x00000003
--ED VCLKCR1, 0x0000012F
--ED VCLKCR2, 0x00000119
--ED VCLKCR3, 0x00000119
--ED ZBCKCR, 0x00000002
--ED FLCKCR, 0x00000005
--ED SD0CKCR, 0x00000080
--ED SD1CKCR, 0x00000080
--ED SD2CKCR, 0x00000080
--ED FSIACKCR, 0x0000003F
--ED FSIBCKCR, 0x0000003F
--ED SUBCKCR, 0x00000080
--ED SPUACKCR, 0x0000000B
--ED SPUVCKCR, 0x0000000B
--ED MSUCKCR, 0x0000013F
--ED HSICKCR, 0x00000080
--ED MFCK1CR, 0x0000003F
--ED MFCK2CR, 0x0000003F
--ED DSITCKCR, 0x00000107
--ED DSI0PCKCR, 0x00000313
--ED DSI1PCKCR, 0x0000130D
--ED DSI0PHYCR, 0x2A800E0E
--ED PLL0CR, 0x1E000000
--ED PLL0CR, 0x2D000000
--ED PLL1CR, 0x17100000
--ED PLL2CR, 0x27000080
--ED PLL3CR, 0x1D000000
--ED PLL0STPCR, 0x00080000
--ED PLL1STPCR, 0x000120C0
--ED PLL2STPCR, 0x00012000
--ED PLL3STPCR, 0x00000030
--ED PLLECR, 0x0000000B
--WAIT_MASK PLLECR, 0x00000B00, 0x00000B00
--
--ED DVFSCR3, 0x000120F0
--ED MPMODE, 0x00000020
--ED VREFCR, 0x0000028A
--ED RMSTPCR0, 0xE4628087
--ED RMSTPCR1, 0xFFFFFFFF
--ED RMSTPCR2, 0x53FFFFFF
--ED RMSTPCR3, 0xFFFFFFFF
--ED RMSTPCR4, 0x00800D3D
--ED RMSTPCR5, 0xFFFFF3FF
--ED SMSTPCR2, 0x00000000
--ED SRCR2, 0x00040000
--ED_AND PLLECR, 0xFFFFFFF7
--WAIT_MASK PLLECR, 0x00000800, 0x00000000
--
--LIST "set SBSC operational"
--ED HPBCTRL6, 0x00000001
--WAIT_MASK HPBCTRL6, 0x00000001, 0x00000001
--
--LIST "set SBSC operating frequency"
--ED FRQCRD, 0x00001414
--WAIT_MASK FRQCRD, 0x80000000, 0x00000000
--ED PLL3CR, 0x1D000000
--ED_OR PLLECR, 0x00000008
--WAIT_MASK PLLECR, 0x00000800, 0x00000800
--
--LIST "enable DLL oscillation in DDRPHY"
--ED_OR DLLCNT0A, 0x00000002
--
--LIST "wait >= 100 ns"
--ED SDGENCNTA, 0x00000005
--WAIT_MASK SDGENCNTA, 0xFFFFFFFF, 0x00000000
--
--LIST "target LPDDR2 device settings"
--ED SDCR0A, 0xACC90159
--ED SDCR1A, 0x00010059
--ED SDWCRC0A, 0x50874114
--ED SDWCRC1A, 0x33199B37
--ED SDWCRC2A, 0x008F2313
--ED SDWCR00A, 0x31020707
--ED SDWCR01A, 0x0017040A
--ED SDWCR10A, 0x31020707
--ED SDWCR11A, 0x0017040A
--
--ED SDDRVCR0A, 0x055557ff
--
--ED SDWCR2A, 0x30000000
--
--LIST "drive CKE high"
--ED_OR SDPCRA, 0x00000080
--WAIT_MASK SDPCRA, 0x00000080, 0x00000080
--
--LIST "wait >= 200 us"
--ED SDGENCNTA, 0x00002710
--WAIT_MASK SDGENCNTA, 0xFFFFFFFF, 0x00000000
--
--LIST "issue reset command to LPDDR2 device"
--ED SDMRACR0A, 0x0000003F
--ED SDMRA1, 0x00000000
--
--LIST "wait >= 10 (or 1) us (docs inconsistent)"
--ED SDGENCNTA, 0x000001F4
--WAIT_MASK SDGENCNTA, 0xFFFFFFFF, 0x00000000
--
--LIST "MRW ZS initialization calibration command"
--ED SDMRACR0A, 0x0000FF0A
--ED SDMRA3, 0x00000000
--
--LIST "wait >= 1 us"
--ED SDGENCNTA, 0x00000032
--WAIT_MASK SDGENCNTA, 0xFFFFFFFF, 0x00000000
--
--LIST "specify operating mode in LPDDR2"
--ED SDMRACR0A, 0x00002201
--ED SDMRA1, 0x00000000
--ED SDMRACR0A, 0x00000402
--ED SDMRA1, 0x00000000
--ED SDMRACR0A, 0x00000203
--ED SDMRA1, 0x00000000
--
--LIST "initialize DDR interface"
--ED SDMRA2, 0x00000000
--
--LIST "temperature sensor control"
--ED SDMRTMPCRA, 0x88800004
--ED SDMRTMPMSKA,0x00000004
--
--LIST "auto-refreshing control"
--ED RTCORA, 0xA55A0032
--ED RTCORHA, 0xA55A000C
--ED RTCSRA, 0xA55A2048
--
--ED_OR SDCR0A, 0x00000800
--ED_OR SDCR1A, 0x00000400
--
--LIST "auto ZQ calibration control"
--ED ZQCCRA, 0xFFF20000
--
--ED_OR DLLCNT0B, 0x00000002
--ED SDGENCNTB, 0x00000005
--WAIT_MASK SDGENCNTB, 0xFFFFFFFF, 0x00000000
--
--ED SDCR0B, 0xACC90159
--ED SDCR1B, 0x00010059
--ED SDWCRC0B, 0x50874114
--ED SDWCRC1B, 0x33199B37
--ED SDWCRC2B, 0x008F2313
--ED SDWCR00B, 0x31020707
--ED SDWCR01B, 0x0017040A
--ED SDWCR10B, 0x31020707
--ED SDWCR11B, 0x0017040A
--ED SDDRVCR0B, 0x055557ff
--ED SDWCR2B, 0x30000000
--ED_OR SDPCRB, 0x00000080
--WAIT_MASK SDPCRB, 0x00000080, 0x00000080
--
--ED SDGENCNTB, 0x00002710
--WAIT_MASK SDGENCNTB, 0xFFFFFFFF, 0x00000000
--ED SDMRACR0B, 0x0000003F
--
--LIST "upstream u-boot writes to SDMRA1A for both SBSC 1 and 2, which does"
--LIST "not seem to make a lot of sense..."
--ED SDMRB1, 0x00000000
--
--ED SDGENCNTB, 0x000001F4
--WAIT_MASK SDGENCNTB, 0xFFFFFFFF, 0x00000000
--
--ED SDMRACR0B, 0x0000FF0A
--ED SDMRB3, 0x00000000
--ED SDGENCNTB, 0x00000032
--WAIT_MASK SDGENCNTB, 0xFFFFFFFF, 0x00000000
--
--ED SDMRACR0B, 0x00002201
--ED SDMRB1, 0x00000000
--ED SDMRACR0B, 0x00000402
--ED SDMRB1, 0x00000000
--ED SDMRACR0B, 0x00000203
--ED SDMRB1, 0x00000000
--ED SDMRB2, 0x00000000
--ED SDMRTMPCRB, 0x88800004
--ED SDMRTMPMSKB, 0x00000004
--ED RTCORB, 0xA55A0032
--ED RTCORHB, 0xA55A000C
--ED RTCSRB, 0xA55A2048
--ED_OR SDCR0B, 0x00000800
--ED_OR SDCR1B, 0x00000400
--ED ZQCCRB, 0xFFF20000
--ED_OR SDPDCR0B, 0x00030000
--ED DPHYCNT1B, 0xA5390000
--ED DPHYCNT0B, 0x00001200
--ED DPHYCNT1B, 0x07CE0000
--ED DPHYCNT0B, 0x00001247
--WAIT_MASK DPHYCNT2B, 0xFFFFFFFF, 0x07CE0000
--
--ED_AND SDPDCR0B, 0xFFFCFFFF
--
--ED FRQCRD, 0x00000B0B
--WAIT_MASK FRQCRD, 0x80000000, 0x00000000
--
--ED CPGXXCR4, 0xfffffffc
--
--LIST "Setup SCIF4 / workaround"
--EB PORT32CR, 0x12
--EB PORT33CR, 0x22
--EB PORT34CR, 0x12
--EB PORT35CR, 0x22
--
--EW 0xE6C80000, 0
--EB 0xE6C80004, 0x19
--EW 0xE6C80008, 0x0030
--EW 0xE6C80018, 0
--EW 0xE6C80030, 0x0014
--
--LIST "Magic to avoid hangs and corruption on DRAM writes."
--
--LIST "It has been observed that the system would most often hang while"
--LIST "decompressing the kernel, and if it didn't it would always write"
--LIST "a corrupt image to DRAM."
--LIST "This problem does not occur in u-boot, and the reason is that"
--LIST "u-boot performs an additional cache invalidation after setting up"
--LIST "the DRAM controller. Such an invalidation should not be necessary at"
--LIST "this point, and attempts at removing parts of the routine to arrive"
--LIST "at the minimal snippet of code necessary to avoid the DRAM stability"
--LIST "problem yielded the following:"
--
--MRC p15, 0, r0, c1, c0, 0
--MCR p15, 0, r0, c1, c0, 0
-diff --git a/arch/arm/mach-shmobile/include/mach/zboot.h b/arch/arm/mach-shmobile/include/mach/zboot.h
-index 175ee05465da..80f599f4b5ab 100644
---- a/arch/arm/mach-shmobile/include/mach/zboot.h
-+++ b/arch/arm/mach-shmobile/include/mach/zboot.h
-@@ -9,11 +9,6 @@
- *
- **************************************************/
-
--#ifdef CONFIG_MACH_KZM9G
--#define MEMORY_START 0x43000000
--#include "mach/head-kzm9g.txt"
--#else
- #error "unsupported board."
--#endif
-
- #endif /* ZBOOT_H */
-diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
-deleted file mode 100644
-index fd63ae6532fc..000000000000
---- a/arch/arm/mach-shmobile/intc-sh73a0.c
-+++ /dev/null
-@@ -1,337 +0,0 @@
--/*
-- * sh73a0 processor support - INTC hardware block
-- *
-- * Copyright (C) 2010 Magnus Damm
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; version 2 of the License.
-- *
-- * 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/kernel.h>
--#include <linux/init.h>
--#include <linux/interrupt.h>
--#include <linux/module.h>
--#include <linux/irq.h>
--#include <linux/io.h>
--#include <linux/irqchip.h>
--#include <linux/irqchip/arm-gic.h>
--
--#include <asm/mach-types.h>
--#include <asm/mach/arch.h>
--
--#include "intc.h"
--#include "irqs.h"
--#include "sh73a0.h"
--
--enum {
-- UNUSED = 0,
--
-- /* interrupt sources INTCS */
-- PINTCS_PINT1, PINTCS_PINT2,
-- RTDMAC_0_DEI0, RTDMAC_0_DEI1, RTDMAC_0_DEI2, RTDMAC_0_DEI3,
-- CEU, MFI, BBIF2, VPU, TSIF1, _3DG_SGX543, _2DDMAC_2DDM0,
-- RTDMAC_1_DEI4, RTDMAC_1_DEI5, RTDMAC_1_DADERR,
-- KEYSC_KEY, VINT, MSIOF,
-- TMU0_TUNI00, TMU0_TUNI01, TMU0_TUNI02,
-- CMT0, TSIF0, CMT2, LMB, MSUG, MSU_MSU, MSU_MSU2,
-- CTI, RWDT0, ICB, PEP, ASA, JPU_JPEG, LCDC, LCRC,
-- RTDMAC_2_DEI6, RTDMAC_2_DEI7, RTDMAC_2_DEI8, RTDMAC_2_DEI9,
-- RTDMAC_3_DEI10, RTDMAC_3_DEI11,
-- FRC, GCU, LCDC1, CSIRX,
-- DSITX0_DSITX00, DSITX0_DSITX01,
-- SPU2_SPU0, SPU2_SPU1, FSI,
-- TMU1_TUNI10, TMU1_TUNI11, TMU1_TUNI12,
-- TSIF2, CMT4, MFIS2, CPORTS2R, TSG, DMASCH1, SCUW,
-- VIO60, VIO61, CEU21, CSI21, DSITX1_DSITX10, DSITX1_DSITX11,
-- DISP, DSRV, EMUX2_EMUX20I, EMUX2_EMUX21I,
-- MSTIF0_MST00I, MSTIF0_MST01I, MSTIF1_MST10I, MSTIF1_MST11I,
-- SPUV,
--
-- /* interrupt groups INTCS */
-- RTDMAC_0, RTDMAC_1, RTDMAC_2, RTDMAC_3,
-- DSITX0, SPU2, TMU1, MSU,
--};
--
--static struct intc_vect intcs_vectors[] = {
-- INTCS_VECT(PINTCS_PINT1, 0x0600), INTCS_VECT(PINTCS_PINT2, 0x0620),
-- INTCS_VECT(RTDMAC_0_DEI0, 0x0800), INTCS_VECT(RTDMAC_0_DEI1, 0x0820),
-- INTCS_VECT(RTDMAC_0_DEI2, 0x0840), INTCS_VECT(RTDMAC_0_DEI3, 0x0860),
-- INTCS_VECT(CEU, 0x0880), INTCS_VECT(MFI, 0x0900),
-- INTCS_VECT(BBIF2, 0x0960), INTCS_VECT(VPU, 0x0980),
-- INTCS_VECT(TSIF1, 0x09a0), INTCS_VECT(_3DG_SGX543, 0x09e0),
-- INTCS_VECT(_2DDMAC_2DDM0, 0x0a00),
-- INTCS_VECT(RTDMAC_1_DEI4, 0x0b80), INTCS_VECT(RTDMAC_1_DEI5, 0x0ba0),
-- INTCS_VECT(RTDMAC_1_DADERR, 0x0bc0),
-- INTCS_VECT(KEYSC_KEY, 0x0be0), INTCS_VECT(VINT, 0x0c80),
-- INTCS_VECT(MSIOF, 0x0d20),
-- INTCS_VECT(TMU0_TUNI00, 0x0e80), INTCS_VECT(TMU0_TUNI01, 0x0ea0),
-- INTCS_VECT(TMU0_TUNI02, 0x0ec0),
-- INTCS_VECT(CMT0, 0x0f00), INTCS_VECT(TSIF0, 0x0f20),
-- INTCS_VECT(CMT2, 0x0f40), INTCS_VECT(LMB, 0x0f60),
-- INTCS_VECT(MSUG, 0x0f80),
-- INTCS_VECT(MSU_MSU, 0x0fa0), INTCS_VECT(MSU_MSU2, 0x0fc0),
-- INTCS_VECT(CTI, 0x0400), INTCS_VECT(RWDT0, 0x0440),
-- INTCS_VECT(ICB, 0x0480), INTCS_VECT(PEP, 0x04a0),
-- INTCS_VECT(ASA, 0x04c0), INTCS_VECT(JPU_JPEG, 0x0560),
-- INTCS_VECT(LCDC, 0x0580), INTCS_VECT(LCRC, 0x05a0),
-- INTCS_VECT(RTDMAC_2_DEI6, 0x1300), INTCS_VECT(RTDMAC_2_DEI7, 0x1320),
-- INTCS_VECT(RTDMAC_2_DEI8, 0x1340), INTCS_VECT(RTDMAC_2_DEI9, 0x1360),
-- INTCS_VECT(RTDMAC_3_DEI10, 0x1380), INTCS_VECT(RTDMAC_3_DEI11, 0x13a0),
-- INTCS_VECT(FRC, 0x1700), INTCS_VECT(GCU, 0x1760),
-- INTCS_VECT(LCDC1, 0x1780), INTCS_VECT(CSIRX, 0x17a0),
-- INTCS_VECT(DSITX0_DSITX00, 0x17c0), INTCS_VECT(DSITX0_DSITX01, 0x17e0),
-- INTCS_VECT(SPU2_SPU0, 0x1800), INTCS_VECT(SPU2_SPU1, 0x1820),
-- INTCS_VECT(FSI, 0x1840),
-- INTCS_VECT(TMU1_TUNI10, 0x1900), INTCS_VECT(TMU1_TUNI11, 0x1920),
-- INTCS_VECT(TMU1_TUNI12, 0x1940),
-- INTCS_VECT(TSIF2, 0x1960), INTCS_VECT(CMT4, 0x1980),
-- INTCS_VECT(MFIS2, 0x1a00), INTCS_VECT(CPORTS2R, 0x1a20),
-- INTCS_VECT(TSG, 0x1ae0), INTCS_VECT(DMASCH1, 0x1b00),
-- INTCS_VECT(SCUW, 0x1b40),
-- INTCS_VECT(VIO60, 0x1b60), INTCS_VECT(VIO61, 0x1b80),
-- INTCS_VECT(CEU21, 0x1ba0), INTCS_VECT(CSI21, 0x1be0),
-- INTCS_VECT(DSITX1_DSITX10, 0x1c00), INTCS_VECT(DSITX1_DSITX11, 0x1c20),
-- INTCS_VECT(DISP, 0x1c40), INTCS_VECT(DSRV, 0x1c60),
-- INTCS_VECT(EMUX2_EMUX20I, 0x1c80), INTCS_VECT(EMUX2_EMUX21I, 0x1ca0),
-- INTCS_VECT(MSTIF0_MST00I, 0x1cc0), INTCS_VECT(MSTIF0_MST01I, 0x1ce0),
-- INTCS_VECT(MSTIF1_MST10I, 0x1d00), INTCS_VECT(MSTIF1_MST11I, 0x1d20),
-- INTCS_VECT(SPUV, 0x2300),
--};
--
--static struct intc_group intcs_groups[] __initdata = {
-- INTC_GROUP(RTDMAC_0, RTDMAC_0_DEI0, RTDMAC_0_DEI1,
-- RTDMAC_0_DEI2, RTDMAC_0_DEI3),
-- INTC_GROUP(RTDMAC_1, RTDMAC_1_DEI4, RTDMAC_1_DEI5, RTDMAC_1_DADERR),
-- INTC_GROUP(RTDMAC_2, RTDMAC_2_DEI6, RTDMAC_2_DEI7,
-- RTDMAC_2_DEI8, RTDMAC_2_DEI9),
-- INTC_GROUP(RTDMAC_3, RTDMAC_3_DEI10, RTDMAC_3_DEI11),
-- INTC_GROUP(TMU1, TMU1_TUNI12, TMU1_TUNI11, TMU1_TUNI10),
-- INTC_GROUP(DSITX0, DSITX0_DSITX00, DSITX0_DSITX01),
-- INTC_GROUP(SPU2, SPU2_SPU0, SPU2_SPU1),
-- INTC_GROUP(MSU, MSU_MSU, MSU_MSU2),
--};
--
--static struct intc_mask_reg intcs_mask_registers[] = {
-- { 0xffd20184, 0xffd201c4, 8, /* IMR1SA / IMCR1SA */
-- { 0, 0, 0, CEU,
-- 0, 0, 0, 0 } },
-- { 0xffd20188, 0xffd201c8, 8, /* IMR2SA / IMCR2SA */
-- { 0, 0, 0, VPU,
-- BBIF2, 0, 0, MFI } },
-- { 0xffd2018c, 0xffd201cc, 8, /* IMR3SA / IMCR3SA */
-- { 0, 0, 0, _2DDMAC_2DDM0,
-- 0, ASA, PEP, ICB } },
-- { 0xffd20190, 0xffd201d0, 8, /* IMR4SA / IMCR4SA */
-- { 0, 0, 0, CTI,
-- JPU_JPEG, 0, LCRC, LCDC } },
-- { 0xffd20194, 0xffd201d4, 8, /* IMR5SA / IMCR5SA */
-- { KEYSC_KEY, RTDMAC_1_DADERR, RTDMAC_1_DEI5, RTDMAC_1_DEI4,
-- RTDMAC_0_DEI3, RTDMAC_0_DEI2, RTDMAC_0_DEI1, RTDMAC_0_DEI0 } },
-- { 0xffd20198, 0xffd201d8, 8, /* IMR6SA / IMCR6SA */
-- { 0, 0, MSIOF, 0,
-- _3DG_SGX543, 0, 0, 0 } },
-- { 0xffd2019c, 0xffd201dc, 8, /* IMR7SA / IMCR7SA */
-- { 0, TMU0_TUNI02, TMU0_TUNI01, TMU0_TUNI00,
-- 0, 0, 0, 0 } },
-- { 0xffd201a0, 0xffd201e0, 8, /* IMR8SA / IMCR8SA */
-- { 0, 0, 0, 0,
-- 0, MSU_MSU, MSU_MSU2, MSUG } },
-- { 0xffd201a4, 0xffd201e4, 8, /* IMR9SA / IMCR9SA */
-- { 0, RWDT0, CMT2, CMT0,
-- 0, 0, 0, 0 } },
-- { 0xffd201ac, 0xffd201ec, 8, /* IMR11SA / IMCR11SA */
-- { 0, 0, 0, 0,
-- 0, TSIF1, LMB, TSIF0 } },
-- { 0xffd201b0, 0xffd201f0, 8, /* IMR12SA / IMCR12SA */
-- { 0, 0, 0, 0,
-- 0, 0, PINTCS_PINT2, PINTCS_PINT1 } },
-- { 0xffd50180, 0xffd501c0, 8, /* IMR0SA3 / IMCR0SA3 */
-- { RTDMAC_2_DEI6, RTDMAC_2_DEI7, RTDMAC_2_DEI8, RTDMAC_2_DEI9,
-- RTDMAC_3_DEI10, RTDMAC_3_DEI11, 0, 0 } },
-- { 0xffd50190, 0xffd501d0, 8, /* IMR4SA3 / IMCR4SA3 */
-- { FRC, 0, 0, GCU,
-- LCDC1, CSIRX, DSITX0_DSITX00, DSITX0_DSITX01 } },
-- { 0xffd50194, 0xffd501d4, 8, /* IMR5SA3 / IMCR5SA3 */
-- { SPU2_SPU0, SPU2_SPU1, FSI, 0,
-- 0, 0, 0, 0 } },
-- { 0xffd50198, 0xffd501d8, 8, /* IMR6SA3 / IMCR6SA3 */
-- { TMU1_TUNI10, TMU1_TUNI11, TMU1_TUNI12, 0,
-- TSIF2, CMT4, 0, 0 } },
-- { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */
-- { MFIS2, CPORTS2R, 0, 0,
-- 0, 0, 0, TSG } },
-- { 0xffd501a0, 0xffd501e0, 8, /* IMR8SA3 / IMCR8SA3 */
-- { DMASCH1, 0, SCUW, VIO60,
-- VIO61, CEU21, 0, CSI21 } },
-- { 0xffd501a4, 0xffd501e4, 8, /* IMR9SA3 / IMCR9SA3 */
-- { DSITX1_DSITX10, DSITX1_DSITX11, DISP, DSRV,
-- EMUX2_EMUX20I, EMUX2_EMUX21I, MSTIF0_MST00I, MSTIF0_MST01I } },
-- { 0xffd501a8, 0xffd501e8, 8, /* IMR10SA3 / IMCR10SA3 */
-- { MSTIF0_MST00I, MSTIF0_MST01I, 0, 0,
-- 0, 0, 0, 0 } },
-- { 0xffd60180, 0xffd601c0, 8, /* IMR0SA4 / IMCR0SA4 */
-- { SPUV, 0, 0, 0,
-- 0, 0, 0, 0 } },
--};
--
--/* Priority is needed for INTCA to receive the INTCS interrupt */
--static struct intc_prio_reg intcs_prio_registers[] = {
-- { 0xffd20000, 0, 16, 4, /* IPRAS */ { CTI, 0, _2DDMAC_2DDM0, ICB } },
-- { 0xffd20004, 0, 16, 4, /* IPRBS */ { JPU_JPEG, LCDC, 0, LCRC } },
-- { 0xffd20008, 0, 16, 4, /* IPRCS */ { BBIF2, 0, 0, 0 } },
-- { 0xffd2000c, 0, 16, 4, /* IPRDS */ { PINTCS_PINT1, PINTCS_PINT2,
-- 0, 0 } },
-- { 0xffd20010, 0, 16, 4, /* IPRES */ { RTDMAC_0, CEU, MFI, VPU } },
-- { 0xffd20014, 0, 16, 4, /* IPRFS */ { KEYSC_KEY, RTDMAC_1,
-- CMT2, CMT0 } },
-- { 0xffd20018, 0, 16, 4, /* IPRGS */ { TMU0_TUNI00, TMU0_TUNI01,
-- TMU0_TUNI02, TSIF1 } },
-- { 0xffd2001c, 0, 16, 4, /* IPRHS */ { VINT, 0, 0, 0 } },
-- { 0xffd20020, 0, 16, 4, /* IPRIS */ { 0, MSIOF, TSIF0, 0 } },
-- { 0xffd20024, 0, 16, 4, /* IPRJS */ { 0, _3DG_SGX543, MSUG, MSU } },
-- { 0xffd20028, 0, 16, 4, /* IPRKS */ { 0, ASA, LMB, PEP } },
-- { 0xffd20030, 0, 16, 4, /* IPRMS */ { 0, 0, 0, RWDT0 } },
-- { 0xffd50000, 0, 16, 4, /* IPRAS3 */ { RTDMAC_2, 0, 0, 0 } },
-- { 0xffd50004, 0, 16, 4, /* IPRBS3 */ { RTDMAC_3, 0, 0, 0 } },
-- { 0xffd50020, 0, 16, 4, /* IPRIS3 */ { FRC, 0, 0, 0 } },
-- { 0xffd50024, 0, 16, 4, /* IPRJS3 */ { LCDC1, CSIRX, DSITX0, 0 } },
-- { 0xffd50028, 0, 16, 4, /* IPRKS3 */ { SPU2, 0, FSI, 0 } },
-- { 0xffd50030, 0, 16, 4, /* IPRMS3 */ { TMU1, 0, 0, TSIF2 } },
-- { 0xffd50034, 0, 16, 4, /* IPRNS3 */ { CMT4, 0, 0, 0 } },
-- { 0xffd50038, 0, 16, 4, /* IPROS3 */ { MFIS2, CPORTS2R, 0, 0 } },
-- { 0xffd50040, 0, 16, 4, /* IPRQS3 */ { DMASCH1, 0, SCUW, VIO60 } },
-- { 0xffd50044, 0, 16, 4, /* IPRRS3 */ { VIO61, CEU21, 0, CSI21 } },
-- { 0xffd50048, 0, 16, 4, /* IPRSS3 */ { DSITX1_DSITX10, DSITX1_DSITX11,
-- DISP, DSRV } },
-- { 0xffd5004c, 0, 16, 4, /* IPRTS3 */ { EMUX2_EMUX20I, EMUX2_EMUX21I,
-- MSTIF0_MST00I, MSTIF0_MST01I } },
-- { 0xffd50050, 0, 16, 4, /* IPRUS3 */ { MSTIF1_MST10I, MSTIF1_MST11I,
-- 0, 0 } },
-- { 0xffd60000, 0, 16, 4, /* IPRAS4 */ { SPUV, 0, 0, 0 } },
--};
--
--static struct resource intcs_resources[] __initdata = {
-- [0] = {
-- .start = 0xffd20000,
-- .end = 0xffd201ff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = 0xffd50000,
-- .end = 0xffd501ff,
-- .flags = IORESOURCE_MEM,
-- },
-- [2] = {
-- .start = 0xffd60000,
-- .end = 0xffd601ff,
-- .flags = IORESOURCE_MEM,
-- }
--};
--
--static struct intc_desc intcs_desc __initdata = {
-- .name = "sh73a0-intcs",
-- .resource = intcs_resources,
-- .num_resources = ARRAY_SIZE(intcs_resources),
-- .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers,
-- intcs_prio_registers, NULL, NULL),
--};
--
--static struct irqaction sh73a0_intcs_cascade;
--
--static irqreturn_t sh73a0_intcs_demux(int irq, void *dev_id)
--{
-- unsigned int evtcodeas = ioread32((void __iomem *)dev_id);
--
-- generic_handle_irq(intcs_evt2irq(evtcodeas));
--
-- return IRQ_HANDLED;
--}
--
--#define PINTER0_PHYS 0xe69000a0
--#define PINTER1_PHYS 0xe69000a4
--#define PINTER0_VIRT IOMEM(0xe69000a0)
--#define PINTER1_VIRT IOMEM(0xe69000a4)
--#define PINTRR0 IOMEM(0xe69000d0)
--#define PINTRR1 IOMEM(0xe69000d4)
--
--#define PINT0A_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq))
--#define PINT0B_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 8))
--#define PINT0C_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 16))
--#define PINT0D_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 24))
--#define PINT1E_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT1_IRQ(irq))
--
--INTC_PINT(intc_pint0, PINTER0_PHYS, 0xe69000b0, "sh73a0-pint0", \
-- INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D), \
-- INTC_PINT_V(A, PINT0A_IRQ), INTC_PINT_V(B, PINT0B_IRQ), \
-- INTC_PINT_V(C, PINT0C_IRQ), INTC_PINT_V(D, PINT0D_IRQ), \
-- INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D), \
-- INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D));
--
--INTC_PINT(intc_pint1, PINTER1_PHYS, 0xe69000c0, "sh73a0-pint1", \
-- INTC_PINT_E(E), INTC_PINT_E_EMPTY, INTC_PINT_E_EMPTY, INTC_PINT_E_EMPTY, \
-- INTC_PINT_V(E, PINT1E_IRQ), INTC_PINT_V_NONE, \
-- INTC_PINT_V_NONE, INTC_PINT_V_NONE, \
-- INTC_PINT_E_NONE, INTC_PINT_E_NONE, INTC_PINT_E_NONE, INTC_PINT_E(E), \
-- INTC_PINT_E(E), INTC_PINT_E_NONE, INTC_PINT_E_NONE, INTC_PINT_E_NONE);
--
--static struct irqaction sh73a0_pint0_cascade;
--static struct irqaction sh73a0_pint1_cascade;
--
--static void pint_demux(void __iomem *rr, void __iomem *er, int base_irq)
--{
-- unsigned long value = ioread32(rr) & ioread32(er);
-- int k;
--
-- for (k = 0; k < 32; k++) {
-- if (value & (1 << (31 - k))) {
-- generic_handle_irq(base_irq + k);
-- iowrite32(~(1 << (31 - k)), rr);
-- }
-- }
--}
--
--static irqreturn_t sh73a0_pint0_demux(int irq, void *dev_id)
--{
-- pint_demux(PINTRR0, PINTER0_VIRT, SH73A0_PINT0_IRQ(0));
-- return IRQ_HANDLED;
--}
--
--static irqreturn_t sh73a0_pint1_demux(int irq, void *dev_id)
--{
-- pint_demux(PINTRR1, PINTER1_VIRT, SH73A0_PINT1_IRQ(0));
-- return IRQ_HANDLED;
--}
--
--void __init sh73a0_init_irq(void)
--{
-- void __iomem *gic_dist_base = IOMEM(0xf0001000);
-- void __iomem *gic_cpu_base = IOMEM(0xf0000100);
-- void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE);
--
-- gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE);
-- gic_init(0, 29, gic_dist_base, gic_cpu_base);
--
-- register_intc_controller(&intcs_desc);
-- register_intc_controller(&intc_pint0_desc);
-- register_intc_controller(&intc_pint1_desc);
--
-- /* demux using INTEVTSA */
-- sh73a0_intcs_cascade.name = "INTCS cascade";
-- sh73a0_intcs_cascade.handler = sh73a0_intcs_demux;
-- sh73a0_intcs_cascade.dev_id = intevtsa;
-- setup_irq(gic_spi(50), &sh73a0_intcs_cascade);
--
-- /* PINT pins are sanely tied to the GIC as SPI */
-- sh73a0_pint0_cascade.name = "PINT0 cascade";
-- sh73a0_pint0_cascade.handler = sh73a0_pint0_demux;
-- setup_irq(gic_spi(33), &sh73a0_pint0_cascade);
--
-- sh73a0_pint1_cascade.name = "PINT1 cascade";
-- sh73a0_pint1_cascade.handler = sh73a0_pint1_demux;
-- setup_irq(gic_spi(34), &sh73a0_pint1_cascade);
--}
---
-2.6.2
-
diff --git a/patches.renesas/0147-ARM-shmobile-Remove-legacy-kzm9g_defconfig.patch b/patches.renesas/0147-ARM-shmobile-Remove-legacy-kzm9g_defconfig.patch
deleted file mode 100644
index c7d4a725e4a622..00000000000000
--- a/patches.renesas/0147-ARM-shmobile-Remove-legacy-kzm9g_defconfig.patch
+++ /dev/null
@@ -1,192 +0,0 @@
-From 59083d469907cf5f2e758f59b688e74058667807 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:18 +0200
-Subject: [PATCH 147/326] ARM: shmobile: Remove legacy kzm9g_defconfig
-
-The legacy board code for KZM-A9-GT has been removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 04320ccfc11b9ca9b7cf933e221a765d78705cf8)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- MAINTAINERS | 1 -
- arch/arm/configs/kzm9g_defconfig | 154 ---------------------------------------
- 2 files changed, 155 deletions(-)
- delete mode 100644 arch/arm/configs/kzm9g_defconfig
-
-diff --git a/MAINTAINERS b/MAINTAINERS
-index d8afd2953678..77edd4bec210 100644
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -1442,7 +1442,6 @@ F: arch/arm/boot/dts/r8a*
- F: arch/arm/boot/dts/sh*
- F: arch/arm/configs/armadillo800eva_defconfig
- F: arch/arm/configs/bockw_defconfig
--F: arch/arm/configs/kzm9g_defconfig
- F: arch/arm/configs/marzen_defconfig
- F: arch/arm/configs/shmobile_defconfig
- F: arch/arm/include/debug/renesas-scif.S
-diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig
-deleted file mode 100644
-index 23e8d146dc16..000000000000
---- a/arch/arm/configs/kzm9g_defconfig
-+++ /dev/null
-@@ -1,154 +0,0 @@
--# CONFIG_ARM_PATCH_PHYS_VIRT is not set
--CONFIG_EXPERIMENTAL=y
--# CONFIG_LOCALVERSION_AUTO is not set
--CONFIG_SYSVIPC=y
--CONFIG_IKCONFIG=y
--CONFIG_IKCONFIG_PROC=y
--CONFIG_LOG_BUF_SHIFT=16
--CONFIG_NAMESPACES=y
--# CONFIG_UTS_NS is not set
--# CONFIG_IPC_NS is not set
--# CONFIG_USER_NS is not set
--# CONFIG_PID_NS is not set
--# CONFIG_NET_NS is not set
--CONFIG_CC_OPTIMIZE_FOR_SIZE=y
--CONFIG_SYSCTL_SYSCALL=y
--CONFIG_EMBEDDED=y
--CONFIG_PERF_EVENTS=y
--CONFIG_SLAB=y
--CONFIG_MODULES=y
--CONFIG_MODULE_FORCE_LOAD=y
--CONFIG_MODULE_UNLOAD=y
--# 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_SH73A0=y
--CONFIG_MACH_KZM9G=y
--CONFIG_MEMORY_START=0x41000000
--CONFIG_MEMORY_SIZE=0x1f000000
--CONFIG_ARM_ERRATA_743622=y
--CONFIG_ARM_ERRATA_754322=y
--CONFIG_NO_HZ=y
--CONFIG_HIGH_RES_TIMERS=y
--CONFIG_SMP=y
--CONFIG_SCHED_MC=y
--CONFIG_AEABI=y
--# CONFIG_OABI_COMPAT is not set
--CONFIG_HIGHMEM=y
--CONFIG_ZBOOT_ROM_TEXT=0x0
--CONFIG_ZBOOT_ROM_BSS=0x0
--CONFIG_ARM_APPENDED_DTB=y
--CONFIG_KEXEC=y
--CONFIG_VFP=y
--CONFIG_NEON=y
--# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
--CONFIG_PM=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_IRDA=y
--CONFIG_SH_IRDA=y
--# CONFIG_WIRELESS is not set
--CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
--CONFIG_DEVTMPFS=y
--CONFIG_DEVTMPFS_MOUNT=y
--CONFIG_SCSI=y
--CONFIG_BLK_DEV_SD=y
--CONFIG_NETDEVICES=y
--CONFIG_SMSC911X=y
--# CONFIG_WLAN is not set
--CONFIG_INPUT_SPARSEKMAP=y
--# CONFIG_INPUT_MOUSEDEV is not set
--CONFIG_INPUT_EVDEV=y
--# CONFIG_KEYBOARD_ATKBD is not set
--CONFIG_KEYBOARD_GPIO=y
--# CONFIG_INPUT_MOUSE is not set
--CONFIG_INPUT_TOUCHSCREEN=y
--CONFIG_TOUCHSCREEN_ST1232=y
--CONFIG_INPUT_MISC=y
--CONFIG_INPUT_ADXL34X=y
--# CONFIG_LEGACY_PTYS is not set
--CONFIG_SERIAL_SH_SCI=y
--CONFIG_SERIAL_SH_SCI_NR_UARTS=9
--CONFIG_SERIAL_SH_SCI_CONSOLE=y
--# CONFIG_HW_RANDOM is not set
--CONFIG_I2C_CHARDEV=y
--CONFIG_I2C_SH_MOBILE=y
--CONFIG_GPIO_PCF857X=y
--# CONFIG_HWMON is not set
--CONFIG_MFD_AS3711=y
--CONFIG_REGULATOR=y
--CONFIG_REGULATOR_AS3711=y
--CONFIG_FB=y
--CONFIG_FB_SH_MOBILE_LCDC=y
--CONFIG_BACKLIGHT_AS3711=y
--CONFIG_FRAMEBUFFER_CONSOLE=y
--CONFIG_LOGO=y
--CONFIG_FB_SH_MOBILE_MERAM=y
--CONFIG_SOUND=y
--CONFIG_SND=y
--# CONFIG_SND_SUPPORT_OLD_API is not set
--# CONFIG_SND_VERBOSE_PROCFS is not set
--# CONFIG_SND_DRIVERS is not set
--# CONFIG_SND_ARM is not set
--# CONFIG_SND_USB is not set
--CONFIG_SND_SOC=y
--CONFIG_SND_SOC_SH4_FSI=y
--# CONFIG_HID_SUPPORT is not set
--CONFIG_USB=y
--CONFIG_USB_R8A66597_HCD=y
--CONFIG_USB_RENESAS_USBHS=y
--CONFIG_USB_STORAGE=y
--CONFIG_USB_GADGET=y
--CONFIG_USB_RENESAS_USBHS_UDC=y
--CONFIG_USB_ETH=m
--CONFIG_USB_MASS_STORAGE=m
--CONFIG_MMC=y
--# CONFIG_MMC_BLOCK_BOUNCE is not set
--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_RS5C372=y
--CONFIG_DMADEVICES=y
--CONFIG_SH_DMAE=y
--CONFIG_ASYNC_TX_DMA=y
--CONFIG_STAGING=y
--CONFIG_IIO=y
--CONFIG_AK8975=y
--# CONFIG_DNOTIFY is not set
--CONFIG_VFAT_FS=y
--CONFIG_TMPFS=y
--# CONFIG_MISC_FILESYSTEMS is not set
--CONFIG_NFS_FS=y
--CONFIG_NFS_V3=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_SCHED_DEBUG is not set
--# CONFIG_DEBUG_PREEMPT is not set
--# CONFIG_DEBUG_BUGVERBOSE is not set
--# CONFIG_FTRACE is not set
--# CONFIG_ARM_UNWIND is not set
--CONFIG_CRYPTO=y
--CONFIG_CRYPTO_CBC=y
--CONFIG_CRYPTO_MD5=y
--CONFIG_CRYPTO_DES=y
--CONFIG_CRC16=y
---
-2.6.2
-
diff --git a/patches.renesas/0148-ARM-shmobile-Drop-sh73a0-kzm9g.dtb-for-legacy-builds.patch b/patches.renesas/0148-ARM-shmobile-Drop-sh73a0-kzm9g.dtb-for-legacy-builds.patch
deleted file mode 100644
index 02959f0e7f97ca..00000000000000
--- a/patches.renesas/0148-ARM-shmobile-Drop-sh73a0-kzm9g.dtb-for-legacy-builds.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From b1f84221c25fdcc690c6749a64d38e8227a3e3fd Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:19 +0200
-Subject: [PATCH 148/326] ARM: shmobile: Drop sh73a0-kzm9g.dtb for legacy
- builds
-
-The legacy board code for KZM-A9-GT has been removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit d99f70b9533dc355e0facbaee8a42dcd821a5e73)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/Makefile | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
-index 992736b5229b..b7b3f0fbb25b 100644
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -480,8 +480,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += \
- r8a7740-armadillo800eva.dtb \
- r8a7778-bockw.dtb \
- r8a7778-bockw-reference.dtb \
-- r8a7779-marzen.dtb \
-- sh73a0-kzm9g.dtb
-+ r8a7779-marzen.dtb
- dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += \
- emev2-kzm9d.dtb \
- r7s72100-genmai.dtb \
---
-2.6.2
-
diff --git a/patches.renesas/0149-ARM-shmobile-Remove-legacy-SoC-code-for-SH-Mobile-AG.patch b/patches.renesas/0149-ARM-shmobile-Remove-legacy-SoC-code-for-SH-Mobile-AG.patch
deleted file mode 100644
index 598ec43d586e65..00000000000000
--- a/patches.renesas/0149-ARM-shmobile-Remove-legacy-SoC-code-for-SH-Mobile-AG.patch
+++ /dev/null
@@ -1,1755 +0,0 @@
-From d6d88ed57d08894da1fc690b39ad67a3befc9635 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:20 +0200
-Subject: [PATCH 149/326] ARM: shmobile: Remove legacy SoC code for SH-Mobile
- AG5
-
-The last user of the SH-Mobile AG5 (sh73a0) legacy SoC code was the
-KZM-A9-GT legacy board code, which has been removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 9a9863987bf7307f619f1dbba678a3e6d65c901a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/Kconfig | 9 -
- arch/arm/mach-shmobile/Makefile | 3 +-
- arch/arm/mach-shmobile/clock-sh73a0.c | 752 ----------------------------------
- arch/arm/mach-shmobile/pm-sh73a0.c | 32 --
- arch/arm/mach-shmobile/setup-sh73a0.c | 739 +--------------------------------
- arch/arm/mach-shmobile/sh73a0.h | 83 ----
- arch/arm/mach-shmobile/smp-sh73a0.c | 8 -
- 7 files changed, 2 insertions(+), 1624 deletions(-)
- delete mode 100644 arch/arm/mach-shmobile/clock-sh73a0.c
- delete mode 100644 arch/arm/mach-shmobile/pm-sh73a0.c
-
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index b85b34c1d6e0..c506be27b610 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -105,15 +105,6 @@ if ARCH_SHMOBILE_LEGACY
-
- comment "Renesas ARM SoCs System Type"
-
--config ARCH_SH73A0
-- bool "SH-Mobile AG5 (R8A73A00)"
-- select ARCH_RMOBILE
-- select ARCH_WANT_OPTIONAL_GPIOLIB
-- select ARM_GIC
-- select I2C
-- select SH_INTC
-- select RENESAS_INTC_IRQPIN
--
- config ARCH_R8A7740
- bool "R-Mobile A1 (R8A77400)"
- select ARCH_RMOBILE
-diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
-index a4d7f5734e91..28e0f05a8577 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -6,7 +6,7 @@
- obj-y := timer.o console.o
-
- # CPU objects
--obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o pm-sh73a0.o
-+obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o
- obj-$(CONFIG_ARCH_R8A73A4) += setup-r8a73a4.o
- obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o pm-r8a7740.o
- obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
-@@ -20,7 +20,6 @@ obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
- # Clock objects
- ifndef CONFIG_COMMON_CLK
- obj-y += clock.o
--obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o
- obj-$(CONFIG_ARCH_R8A7740) += clock-r8a7740.o
- obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o
- obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
-diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
-deleted file mode 100644
-index 3855fb024fdb..000000000000
---- a/arch/arm/mach-shmobile/clock-sh73a0.c
-+++ /dev/null
-@@ -1,752 +0,0 @@
--/*
-- * sh73a0 clock framework support
-- *
-- * Copyright (C) 2010 Magnus Damm
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License
-- *
-- * 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/init.h>
--#include <linux/kernel.h>
--#include <linux/io.h>
--#include <linux/sh_clk.h>
--#include <linux/clkdev.h>
--#include <asm/processor.h>
--#include "clock.h"
--#include "common.h"
--
--#define FRQCRA IOMEM(0xe6150000)
--#define FRQCRB IOMEM(0xe6150004)
--#define FRQCRD IOMEM(0xe61500e4)
--#define VCLKCR1 IOMEM(0xe6150008)
--#define VCLKCR2 IOMEM(0xe615000C)
--#define VCLKCR3 IOMEM(0xe615001C)
--#define ZBCKCR IOMEM(0xe6150010)
--#define FLCKCR IOMEM(0xe6150014)
--#define SD0CKCR IOMEM(0xe6150074)
--#define SD1CKCR IOMEM(0xe6150078)
--#define SD2CKCR IOMEM(0xe615007C)
--#define FSIACKCR IOMEM(0xe6150018)
--#define FSIBCKCR IOMEM(0xe6150090)
--#define SUBCKCR IOMEM(0xe6150080)
--#define SPUACKCR IOMEM(0xe6150084)
--#define SPUVCKCR IOMEM(0xe6150094)
--#define MSUCKCR IOMEM(0xe6150088)
--#define HSICKCR IOMEM(0xe615008C)
--#define MFCK1CR IOMEM(0xe6150098)
--#define MFCK2CR IOMEM(0xe615009C)
--#define DSITCKCR IOMEM(0xe6150060)
--#define DSI0PCKCR IOMEM(0xe6150064)
--#define DSI1PCKCR IOMEM(0xe6150068)
--#define DSI0PHYCR 0xe615006C
--#define DSI1PHYCR 0xe6150070
--#define PLLECR IOMEM(0xe61500d0)
--#define PLL0CR IOMEM(0xe61500d8)
--#define PLL1CR IOMEM(0xe6150028)
--#define PLL2CR IOMEM(0xe615002c)
--#define PLL3CR IOMEM(0xe61500dc)
--#define SMSTPCR0 IOMEM(0xe6150130)
--#define SMSTPCR1 IOMEM(0xe6150134)
--#define SMSTPCR2 IOMEM(0xe6150138)
--#define SMSTPCR3 IOMEM(0xe615013c)
--#define SMSTPCR4 IOMEM(0xe6150140)
--#define SMSTPCR5 IOMEM(0xe6150144)
--#define CKSCR IOMEM(0xe61500c0)
--
--/* Fixed 32 KHz root clock from EXTALR pin */
--static struct clk r_clk = {
-- .rate = 32768,
--};
--
--/*
-- * 26MHz default rate for the EXTAL1 root input clock.
-- * If needed, reset this with clk_set_rate() from the platform code.
-- */
--struct clk sh73a0_extal1_clk = {
-- .rate = 26000000,
--};
--
--/*
-- * 48MHz default rate for the EXTAL2 root input clock.
-- * If needed, reset this with clk_set_rate() from the platform code.
-- */
--struct clk sh73a0_extal2_clk = {
-- .rate = 48000000,
--};
--
--static struct sh_clk_ops main_clk_ops = {
-- .recalc = followparent_recalc,
--};
--
--/* Main clock */
--static struct clk main_clk = {
-- /* .parent wll be set on sh73a0_clock_init() */
-- .ops = &main_clk_ops,
--};
--
--/* PLL0, PLL1, PLL2, PLL3 */
--static unsigned long pll_recalc(struct clk *clk)
--{
-- unsigned long mult = 1;
--
-- if (__raw_readl(PLLECR) & (1 << clk->enable_bit)) {
-- mult = (((__raw_readl(clk->enable_reg) >> 24) & 0x3f) + 1);
-- /* handle CFG bit for PLL1 and PLL2 */
-- switch (clk->enable_bit) {
-- case 1:
-- case 2:
-- if (__raw_readl(clk->enable_reg) & (1 << 20))
-- mult *= 2;
-- }
-- }
--
-- return clk->parent->rate * mult;
--}
--
--static struct sh_clk_ops pll_clk_ops = {
-- .recalc = pll_recalc,
--};
--
--static struct clk pll0_clk = {
-- .ops = &pll_clk_ops,
-- .flags = CLK_ENABLE_ON_INIT,
-- .parent = &main_clk,
-- .enable_reg = (void __iomem *)PLL0CR,
-- .enable_bit = 0,
--};
--
--static struct clk pll1_clk = {
-- .ops = &pll_clk_ops,
-- .flags = CLK_ENABLE_ON_INIT,
-- .parent = &main_clk,
-- .enable_reg = (void __iomem *)PLL1CR,
-- .enable_bit = 1,
--};
--
--static struct clk pll2_clk = {
-- .ops = &pll_clk_ops,
-- .flags = CLK_ENABLE_ON_INIT,
-- .parent = &main_clk,
-- .enable_reg = (void __iomem *)PLL2CR,
-- .enable_bit = 2,
--};
--
--static struct clk pll3_clk = {
-- .ops = &pll_clk_ops,
-- .flags = CLK_ENABLE_ON_INIT,
-- .parent = &main_clk,
-- .enable_reg = (void __iomem *)PLL3CR,
-- .enable_bit = 3,
--};
--
--/* A fixed divide block */
--SH_CLK_RATIO(div2, 1, 2);
--SH_CLK_RATIO(div7, 1, 7);
--SH_CLK_RATIO(div13, 1, 13);
--
--SH_FIXED_RATIO_CLK(extal1_div2_clk, sh73a0_extal1_clk, div2);
--SH_FIXED_RATIO_CLK(extal2_div2_clk, sh73a0_extal2_clk, div2);
--SH_FIXED_RATIO_CLK(main_div2_clk, main_clk, div2);
--SH_FIXED_RATIO_CLK(pll1_div2_clk, pll1_clk, div2);
--SH_FIXED_RATIO_CLK(pll1_div7_clk, pll1_clk, div7);
--SH_FIXED_RATIO_CLK(pll1_div13_clk, pll1_clk, div13);
--
--/* External input clock */
--struct clk sh73a0_extcki_clk = {
--};
--
--struct clk sh73a0_extalr_clk = {
--};
--
--static struct clk *main_clks[] = {
-- &r_clk,
-- &sh73a0_extal1_clk,
-- &sh73a0_extal2_clk,
-- &extal1_div2_clk,
-- &extal2_div2_clk,
-- &main_clk,
-- &main_div2_clk,
-- &pll0_clk,
-- &pll1_clk,
-- &pll2_clk,
-- &pll3_clk,
-- &pll1_div2_clk,
-- &pll1_div7_clk,
-- &pll1_div13_clk,
-- &sh73a0_extcki_clk,
-- &sh73a0_extalr_clk,
--};
--
--static int frqcr_kick(void)
--{
-- int i;
--
-- /* set KICK bit in FRQCRB to update hardware setting, check success */
-- __raw_writel(__raw_readl(FRQCRB) | (1 << 31), FRQCRB);
-- for (i = 1000; i; i--)
-- if (__raw_readl(FRQCRB) & (1 << 31))
-- cpu_relax();
-- else
-- return i;
--
-- return -ETIMEDOUT;
--}
--
--static void div4_kick(struct clk *clk)
--{
-- frqcr_kick();
--}
--
--static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18,
-- 24, 0, 36, 48, 7 };
--
--static struct clk_div_mult_table div4_div_mult_table = {
-- .divisors = divisors,
-- .nr_divisors = ARRAY_SIZE(divisors),
--};
--
--static struct clk_div4_table div4_table = {
-- .div_mult_table = &div4_div_mult_table,
-- .kick = div4_kick,
--};
--
--enum { DIV4_I, DIV4_ZG, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2,
-- DIV4_Z, DIV4_ZX, DIV4_HP, DIV4_NR };
--
--#define DIV4(_reg, _bit, _mask, _flags) \
-- SH_CLK_DIV4(&pll1_clk, _reg, _bit, _mask, _flags)
--
--static struct clk div4_clks[DIV4_NR] = {
-- [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT),
-- /*
-- * ZG clock is dividing PLL0 frequency to supply SGX. Make sure not to
-- * exceed maximum frequencies of 201.5MHz for VDD_DVFS=1.175 and
-- * 239.2MHz for VDD_DVFS=1.315V.
-- */
-- [DIV4_ZG] = SH_CLK_DIV4(&pll0_clk, FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT),
-- [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT),
-- [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT),
-- [DIV4_M1] = DIV4(FRQCRA, 4, 0x1dff, 0),
-- [DIV4_M2] = DIV4(FRQCRA, 0, 0x1dff, 0),
-- [DIV4_Z] = SH_CLK_DIV4(&pll0_clk, FRQCRB, 24, 0x97f, 0),
-- [DIV4_ZX] = DIV4(FRQCRB, 12, 0xdff, 0),
-- [DIV4_HP] = DIV4(FRQCRB, 4, 0xdff, 0),
--};
--
--static unsigned long twd_recalc(struct clk *clk)
--{
-- return clk_get_rate(clk->parent) / 4;
--}
--
--static struct sh_clk_ops twd_clk_ops = {
-- .recalc = twd_recalc,
--};
--
--static struct clk twd_clk = {
-- .parent = &div4_clks[DIV4_Z],
-- .ops = &twd_clk_ops,
--};
--
--static struct sh_clk_ops zclk_ops, kicker_ops;
--static const struct sh_clk_ops *div4_clk_ops;
--
--static int zclk_set_rate(struct clk *clk, unsigned long rate)
--{
-- int ret;
--
-- if (!clk->parent || !__clk_get(clk->parent))
-- return -ENODEV;
--
-- if (readl(FRQCRB) & (1 << 31))
-- return -EBUSY;
--
-- if (rate == clk_get_rate(clk->parent)) {
-- /* 1:1 - switch off divider */
-- __raw_writel(__raw_readl(FRQCRB) & ~(1 << 28), FRQCRB);
-- /* nullify the divider to prepare for the next time */
-- ret = div4_clk_ops->set_rate(clk, rate / 2);
-- if (!ret)
-- ret = frqcr_kick();
-- if (ret > 0)
-- ret = 0;
-- } else {
-- /* Enable the divider */
-- __raw_writel(__raw_readl(FRQCRB) | (1 << 28), FRQCRB);
--
-- ret = frqcr_kick();
-- if (ret >= 0)
-- /*
-- * set the divider - call the DIV4 method, it will kick
-- * FRQCRB too
-- */
-- ret = div4_clk_ops->set_rate(clk, rate);
-- if (ret < 0)
-- goto esetrate;
-- }
--
--esetrate:
-- __clk_put(clk->parent);
-- return ret;
--}
--
--static long zclk_round_rate(struct clk *clk, unsigned long rate)
--{
-- unsigned long div_freq = div4_clk_ops->round_rate(clk, rate),
-- parent_freq = clk_get_rate(clk->parent);
--
-- if (rate > div_freq && abs(parent_freq - rate) < rate - div_freq)
-- return parent_freq;
--
-- return div_freq;
--}
--
--static unsigned long zclk_recalc(struct clk *clk)
--{
-- /*
-- * Must recalculate frequencies in case PLL0 has been changed, even if
-- * the divisor is unused ATM!
-- */
-- unsigned long div_freq = div4_clk_ops->recalc(clk);
--
-- if (__raw_readl(FRQCRB) & (1 << 28))
-- return div_freq;
--
-- return clk_get_rate(clk->parent);
--}
--
--static int kicker_set_rate(struct clk *clk, unsigned long rate)
--{
-- if (__raw_readl(FRQCRB) & (1 << 31))
-- return -EBUSY;
--
-- return div4_clk_ops->set_rate(clk, rate);
--}
--
--static void div4_clk_extend(void)
--{
-- int i;
--
-- div4_clk_ops = div4_clks[0].ops;
--
-- /* Add a kicker-busy check before changing the rate */
-- kicker_ops = *div4_clk_ops;
-- /* We extend the DIV4 clock with a 1:1 pass-through case */
-- zclk_ops = *div4_clk_ops;
--
-- kicker_ops.set_rate = kicker_set_rate;
-- zclk_ops.set_rate = zclk_set_rate;
-- zclk_ops.round_rate = zclk_round_rate;
-- zclk_ops.recalc = zclk_recalc;
--
-- for (i = 0; i < DIV4_NR; i++)
-- div4_clks[i].ops = i == DIV4_Z ? &zclk_ops : &kicker_ops;
--}
--
--enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1,
-- DIV6_FLCTL, DIV6_SDHI0, DIV6_SDHI1, DIV6_SDHI2,
-- DIV6_FSIA, DIV6_FSIB, DIV6_SUB,
-- DIV6_SPUA, DIV6_SPUV, DIV6_MSU,
-- DIV6_HSI, DIV6_MFG1, DIV6_MFG2,
-- DIV6_DSIT, DIV6_DSI0P, DIV6_DSI1P,
-- DIV6_NR };
--
--static struct clk *vck_parent[8] = {
-- [0] = &pll1_div2_clk,
-- [1] = &pll2_clk,
-- [2] = &sh73a0_extcki_clk,
-- [3] = &sh73a0_extal2_clk,
-- [4] = &main_div2_clk,
-- [5] = &sh73a0_extalr_clk,
-- [6] = &main_clk,
--};
--
--static struct clk *pll_parent[4] = {
-- [0] = &pll1_div2_clk,
-- [1] = &pll2_clk,
-- [2] = &pll1_div13_clk,
--};
--
--static struct clk *hsi_parent[4] = {
-- [0] = &pll1_div2_clk,
-- [1] = &pll2_clk,
-- [2] = &pll1_div7_clk,
--};
--
--static struct clk *pll_extal2_parent[] = {
-- [0] = &pll1_div2_clk,
-- [1] = &pll2_clk,
-- [2] = &sh73a0_extal2_clk,
-- [3] = &sh73a0_extal2_clk,
--};
--
--static struct clk *dsi_parent[8] = {
-- [0] = &pll1_div2_clk,
-- [1] = &pll2_clk,
-- [2] = &main_clk,
-- [3] = &sh73a0_extal2_clk,
-- [4] = &sh73a0_extcki_clk,
--};
--
--static struct clk div6_clks[DIV6_NR] = {
-- [DIV6_VCK1] = SH_CLK_DIV6_EXT(VCLKCR1, 0,
-- vck_parent, ARRAY_SIZE(vck_parent), 12, 3),
-- [DIV6_VCK2] = SH_CLK_DIV6_EXT(VCLKCR2, 0,
-- vck_parent, ARRAY_SIZE(vck_parent), 12, 3),
-- [DIV6_VCK3] = SH_CLK_DIV6_EXT(VCLKCR3, 0,
-- vck_parent, ARRAY_SIZE(vck_parent), 12, 3),
-- [DIV6_ZB1] = SH_CLK_DIV6_EXT(ZBCKCR, CLK_ENABLE_ON_INIT,
-- pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
-- [DIV6_FLCTL] = SH_CLK_DIV6_EXT(FLCKCR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
-- [DIV6_SDHI0] = SH_CLK_DIV6_EXT(SD0CKCR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 6, 2),
-- [DIV6_SDHI1] = SH_CLK_DIV6_EXT(SD1CKCR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 6, 2),
-- [DIV6_SDHI2] = SH_CLK_DIV6_EXT(SD2CKCR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 6, 2),
-- [DIV6_FSIA] = SH_CLK_DIV6_EXT(FSIACKCR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 6, 1),
-- [DIV6_FSIB] = SH_CLK_DIV6_EXT(FSIBCKCR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 6, 1),
-- [DIV6_SUB] = SH_CLK_DIV6_EXT(SUBCKCR, 0,
-- pll_extal2_parent, ARRAY_SIZE(pll_extal2_parent), 6, 2),
-- [DIV6_SPUA] = SH_CLK_DIV6_EXT(SPUACKCR, 0,
-- pll_extal2_parent, ARRAY_SIZE(pll_extal2_parent), 6, 2),
-- [DIV6_SPUV] = SH_CLK_DIV6_EXT(SPUVCKCR, 0,
-- pll_extal2_parent, ARRAY_SIZE(pll_extal2_parent), 6, 2),
-- [DIV6_MSU] = SH_CLK_DIV6_EXT(MSUCKCR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
-- [DIV6_HSI] = SH_CLK_DIV6_EXT(HSICKCR, 0,
-- hsi_parent, ARRAY_SIZE(hsi_parent), 6, 2),
-- [DIV6_MFG1] = SH_CLK_DIV6_EXT(MFCK1CR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
-- [DIV6_MFG2] = SH_CLK_DIV6_EXT(MFCK2CR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
-- [DIV6_DSIT] = SH_CLK_DIV6_EXT(DSITCKCR, 0,
-- pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
-- [DIV6_DSI0P] = SH_CLK_DIV6_EXT(DSI0PCKCR, 0,
-- dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3),
-- [DIV6_DSI1P] = SH_CLK_DIV6_EXT(DSI1PCKCR, 0,
-- dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3),
--};
--
--/* DSI DIV */
--static unsigned long dsiphy_recalc(struct clk *clk)
--{
-- u32 value;
--
-- value = __raw_readl(clk->mapping->base);
--
-- /* FIXME */
-- if (!(value & 0x000B8000))
-- return clk->parent->rate;
--
-- value &= 0x3f;
-- value += 1;
--
-- if ((value < 12) ||
-- (value > 33)) {
-- pr_err("DSIPHY has wrong value (%d)", value);
-- return 0;
-- }
--
-- return clk->parent->rate / value;
--}
--
--static long dsiphy_round_rate(struct clk *clk, unsigned long rate)
--{
-- return clk_rate_mult_range_round(clk, 12, 33, rate);
--}
--
--static void dsiphy_disable(struct clk *clk)
--{
-- u32 value;
--
-- value = __raw_readl(clk->mapping->base);
-- value &= ~0x000B8000;
--
-- __raw_writel(value , clk->mapping->base);
--}
--
--static int dsiphy_enable(struct clk *clk)
--{
-- u32 value;
-- int multi;
--
-- value = __raw_readl(clk->mapping->base);
-- multi = (value & 0x3f) + 1;
--
-- if ((multi < 12) || (multi > 33))
-- return -EIO;
--
-- __raw_writel(value | 0x000B8000, clk->mapping->base);
--
-- return 0;
--}
--
--static int dsiphy_set_rate(struct clk *clk, unsigned long rate)
--{
-- u32 value;
-- int idx;
--
-- idx = rate / clk->parent->rate;
-- if ((idx < 12) || (idx > 33))
-- return -EINVAL;
--
-- idx += -1;
--
-- value = __raw_readl(clk->mapping->base);
-- value = (value & ~0x3f) + idx;
--
-- __raw_writel(value, clk->mapping->base);
--
-- return 0;
--}
--
--static struct sh_clk_ops dsiphy_clk_ops = {
-- .recalc = dsiphy_recalc,
-- .round_rate = dsiphy_round_rate,
-- .set_rate = dsiphy_set_rate,
-- .enable = dsiphy_enable,
-- .disable = dsiphy_disable,
--};
--
--static struct clk_mapping dsi0phy_clk_mapping = {
-- .phys = DSI0PHYCR,
-- .len = 4,
--};
--
--static struct clk_mapping dsi1phy_clk_mapping = {
-- .phys = DSI1PHYCR,
-- .len = 4,
--};
--
--static struct clk dsi0phy_clk = {
-- .ops = &dsiphy_clk_ops,
-- .parent = &div6_clks[DIV6_DSI0P], /* late install */
-- .mapping = &dsi0phy_clk_mapping,
--};
--
--static struct clk dsi1phy_clk = {
-- .ops = &dsiphy_clk_ops,
-- .parent = &div6_clks[DIV6_DSI1P], /* late install */
-- .mapping = &dsi1phy_clk_mapping,
--};
--
--static struct clk *late_main_clks[] = {
-- &dsi0phy_clk,
-- &dsi1phy_clk,
-- &twd_clk,
--};
--
--enum { MSTP001,
-- MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP112, MSTP100,
-- MSTP219, MSTP218, MSTP217,
-- MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
-- MSTP331, MSTP329, MSTP328, MSTP325, MSTP323, MSTP322,
-- MSTP314, MSTP313, MSTP312, MSTP311,
-- MSTP304, MSTP303, MSTP302, MSTP301, MSTP300,
-- MSTP411, MSTP410, MSTP403,
-- MSTP508,
-- MSTP_NR };
--
--#define MSTP(_parent, _reg, _bit, _flags) \
-- SH_CLK_MSTP32(_parent, _reg, _bit, _flags)
--
--static struct clk mstp_clks[MSTP_NR] = {
-- [MSTP001] = MSTP(&div4_clks[DIV4_HP], SMSTPCR0, 1, 0), /* IIC2 */
-- [MSTP129] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 29, 0), /* CEU1 */
-- [MSTP128] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 28, 0), /* CSI2-RX1 */
-- [MSTP127] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 27, 0), /* CEU0 */
-- [MSTP126] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 26, 0), /* CSI2-RX0 */
-- [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
-- [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */
-- [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */
-- [MSTP112] = MSTP(&div4_clks[DIV4_ZG], SMSTPCR1, 12, 0), /* SGX */
-- [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
-- [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */
-- [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* SY-DMAC */
-- [MSTP217] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* MP-DMAC */
-- [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */
-- [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */
-- [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */
-- [MSTP203] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 3, 0), /* SCIFA1 */
-- [MSTP202] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 2, 0), /* SCIFA2 */
-- [MSTP201] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */
-- [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */
-- [MSTP331] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 31, 0), /* SCIFA6 */
-- [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
-- [MSTP328] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 28, 0), /*FSI*/
-- [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */
-- [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */
-- [MSTP322] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 22, 0), /* USB */
-- [MSTP314] = MSTP(&div6_clks[DIV6_SDHI0], SMSTPCR3, 14, 0), /* SDHI0 */
-- [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */
-- [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */
-- [MSTP311] = MSTP(&div6_clks[DIV6_SDHI2], SMSTPCR3, 11, 0), /* SDHI2 */
-- [MSTP304] = MSTP(&main_div2_clk, SMSTPCR3, 4, 0), /* TPU0 */
-- [MSTP303] = MSTP(&main_div2_clk, SMSTPCR3, 3, 0), /* TPU1 */
-- [MSTP302] = MSTP(&main_div2_clk, SMSTPCR3, 2, 0), /* TPU2 */
-- [MSTP301] = MSTP(&main_div2_clk, SMSTPCR3, 1, 0), /* TPU3 */
-- [MSTP300] = MSTP(&main_div2_clk, SMSTPCR3, 0, 0), /* TPU4 */
-- [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */
-- [MSTP410] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 10, 0), /* IIC4 */
-- [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
-- [MSTP508] = MSTP(&div4_clks[DIV4_HP], SMSTPCR5, 8, 0), /* INTCA0 */
--};
--
--/* The lookups structure below includes duplicate entries for some clocks
-- * with alternate names.
-- * - The traditional name used when a device is initialised with platform data
-- * - The name used when a device is initialised using device tree
-- * The longer-term aim is to remove these duplicates, and indeed the
-- * lookups table entirely, by describing clocks using device tree.
-- */
--static struct clk_lookup lookups[] = {
-- /* main clocks */
-- CLKDEV_CON_ID("r_clk", &r_clk),
-- CLKDEV_DEV_ID("smp_twd", &twd_clk), /* smp_twd */
--
-- /* DIV4 clocks */
-- CLKDEV_DEV_ID("cpu0", &div4_clks[DIV4_Z]),
--
-- /* DIV6 clocks */
-- CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),
-- CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]),
-- CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]),
-- CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]),
-- CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]),
-- CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]),
--
-- /* MSTP32 clocks */
-- CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
-- CLKDEV_DEV_ID("e6824000.i2c", &mstp_clks[MSTP001]), /* I2C2 */
-- CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP129]), /* CEU1 */
-- CLKDEV_DEV_ID("sh-mobile-csi2.1", &mstp_clks[MSTP128]), /* CSI2-RX1 */
-- CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU0 */
-- CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2-RX0 */
-- CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */
-- CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */
-- 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("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 */
-- 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 */
-- CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */
-- CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */
-- CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */
-- CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
-- CLKDEV_DEV_ID("ee100000.sd", &mstp_clks[MSTP314]), /* SDHI0 */
-- CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
-- CLKDEV_DEV_ID("ee120000.sd", &mstp_clks[MSTP313]), /* SDHI1 */
-- CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */
-- CLKDEV_DEV_ID("e6bd0000.mmc", &mstp_clks[MSTP312]), /* MMCIF0 */
-- CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */
-- CLKDEV_DEV_ID("ee140000.sd", &mstp_clks[MSTP311]), /* SDHI2 */
-- CLKDEV_DEV_ID("renesas-tpu-pwm.0", &mstp_clks[MSTP304]), /* TPU0 */
-- CLKDEV_DEV_ID("renesas-tpu-pwm.1", &mstp_clks[MSTP303]), /* TPU1 */
-- CLKDEV_DEV_ID("renesas-tpu-pwm.2", &mstp_clks[MSTP302]), /* TPU2 */
-- CLKDEV_DEV_ID("renesas-tpu-pwm.3", &mstp_clks[MSTP301]), /* TPU3 */
-- CLKDEV_DEV_ID("renesas-tpu-pwm.4", &mstp_clks[MSTP300]), /* TPU4 */
-- CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */
-- CLKDEV_DEV_ID("e6826000.i2c", &mstp_clks[MSTP411]), /* I2C3 */
-- CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */
-- CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */
-- CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
-- CLKDEV_DEV_ID("renesas_intc_irqpin.0", &mstp_clks[MSTP508]), /* INTCA0 */
-- CLKDEV_DEV_ID("e6900000.irqpin", &mstp_clks[MSTP508]), /* INTCA0 */
-- CLKDEV_DEV_ID("renesas_intc_irqpin.1", &mstp_clks[MSTP508]), /* INTCA0 */
-- CLKDEV_DEV_ID("e6900004.irqpin", &mstp_clks[MSTP508]), /* INTCA0 */
-- CLKDEV_DEV_ID("renesas_intc_irqpin.2", &mstp_clks[MSTP508]), /* INTCA0 */
-- CLKDEV_DEV_ID("e6900008.irqpin", &mstp_clks[MSTP508]), /* INTCA0 */
-- CLKDEV_DEV_ID("renesas_intc_irqpin.3", &mstp_clks[MSTP508]), /* INTCA0 */
-- CLKDEV_DEV_ID("e690000c.irqpin", &mstp_clks[MSTP508]), /* INTCA0 */
--
-- /* ICK */
-- CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
-- CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
-- CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
-- CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
-- 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 */
--};
--
--void __init sh73a0_clock_init(void)
--{
-- int k, ret = 0;
--
-- /* Set SDHI clocks to a known state */
-- __raw_writel(0x108, SD0CKCR);
-- __raw_writel(0x108, SD1CKCR);
-- __raw_writel(0x108, SD2CKCR);
--
-- /* detect main clock parent */
-- switch ((__raw_readl(CKSCR) >> 28) & 0x03) {
-- case 0:
-- main_clk.parent = &sh73a0_extal1_clk;
-- break;
-- case 1:
-- main_clk.parent = &extal1_div2_clk;
-- break;
-- case 2:
-- main_clk.parent = &sh73a0_extal2_clk;
-- break;
-- case 3:
-- main_clk.parent = &extal2_div2_clk;
-- break;
-- }
--
-- for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
-- ret = clk_register(main_clks[k]);
--
-- if (!ret) {
-- ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
-- if (!ret)
-- div4_clk_extend();
-- }
--
-- if (!ret)
-- ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR);
--
-- if (!ret)
-- ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
--
-- for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++)
-- ret = clk_register(late_main_clks[k]);
--
-- clkdev_add_table(lookups, ARRAY_SIZE(lookups));
--
-- if (!ret)
-- shmobile_clk_init();
-- else
-- panic("failed to setup sh73a0 clocks\n");
--}
-diff --git a/arch/arm/mach-shmobile/pm-sh73a0.c b/arch/arm/mach-shmobile/pm-sh73a0.c
-deleted file mode 100644
-index a7e466817965..000000000000
---- a/arch/arm/mach-shmobile/pm-sh73a0.c
-+++ /dev/null
-@@ -1,32 +0,0 @@
--/*
-- * sh73a0 Power management support
-- *
-- * Copyright (C) 2012 Bastian Hecht <hechtb+renesas@gmail.com>
-- *
-- * 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/suspend.h>
--#include "common.h"
--
--#ifdef CONFIG_SUSPEND
--static int sh73a0_enter_suspend(suspend_state_t suspend_state)
--{
-- cpu_do_idle();
-- return 0;
--}
--
--static void sh73a0_suspend_init(void)
--{
-- shmobile_suspend_ops.enter = sh73a0_enter_suspend;
--}
--#else
--static void sh73a0_suspend_init(void) {}
--#endif
--
--void __init sh73a0_pm_init(void)
--{
-- sh73a0_suspend_init();
--}
-diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
-index fb2ab7590af8..a1e8e72e25b5 100644
---- a/arch/arm/mach-shmobile/setup-sh73a0.c
-+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
-@@ -18,28 +18,17 @@
- #include <linux/init.h>
- #include <linux/interrupt.h>
- #include <linux/irq.h>
--#include <linux/platform_device.h>
- #include <linux/of_platform.h>
- #include <linux/delay.h>
- #include <linux/input.h>
--#include <linux/i2c/i2c-sh_mobile.h>
- #include <linux/io.h>
--#include <linux/serial_sci.h>
--#include <linux/sh_dma.h>
--#include <linux/sh_timer.h>
--#include <linux/platform_data/sh_ipmmu.h>
--#include <linux/platform_data/irq-renesas-intc-irqpin.h>
-
- #include <asm/hardware/cache-l2x0.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 "intc.h"
--#include "irqs.h"
- #include "sh73a0.h"
-
- static struct map_desc sh73a0_io_desc[] __initdata = {
-@@ -54,737 +43,12 @@ static struct map_desc sh73a0_io_desc[] __initdata = {
- },
- };
-
--void __init sh73a0_map_io(void)
-+static void __init sh73a0_map_io(void)
- {
- debug_ll_io_init();
- iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
- }
-
--/* PFC */
--static struct resource pfc_resources[] __initdata = {
-- DEFINE_RES_MEM(0xe6050000, 0x8000),
-- DEFINE_RES_MEM(0xe605801c, 0x000c),
--};
--
--void __init sh73a0_pinmux_init(void)
--{
-- platform_device_register_simple("pfc-sh73a0", -1, pfc_resources,
-- ARRAY_SIZE(pfc_resources));
--}
--
--/* SCIF */
--#define SH73A0_SCIF(scif_type, index, baseaddr, irq) \
--static struct plat_sci_port scif##index##_platform_data = { \
-- .type = scif_type, \
-- .flags = UPF_BOOT_AUTOCONF, \
-- .scscr = SCSCR_RE | SCSCR_TE, \
--}; \
-- \
--static struct resource scif##index##_resources[] = { \
-- DEFINE_RES_MEM(baseaddr, 0x100), \
-- DEFINE_RES_IRQ(irq), \
--}; \
-- \
--static struct platform_device scif##index##_device = { \
-- .name = "sh-sci", \
-- .id = index, \
-- .resource = scif##index##_resources, \
-- .num_resources = ARRAY_SIZE(scif##index##_resources), \
-- .dev = { \
-- .platform_data = &scif##index##_platform_data, \
-- }, \
--}
--
--SH73A0_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(72));
--SH73A0_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(73));
--SH73A0_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(74));
--SH73A0_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(75));
--SH73A0_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(78));
--SH73A0_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(79));
--SH73A0_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(156));
--SH73A0_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(143));
--SH73A0_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(80));
--
--static struct sh_timer_config cmt1_platform_data = {
-- .channels_mask = 0x3f,
--};
--
--static struct resource cmt1_resources[] = {
-- DEFINE_RES_MEM(0xe6138000, 0x200),
-- DEFINE_RES_IRQ(gic_spi(65)),
--};
--
--static struct platform_device cmt1_device = {
-- .name = "sh-cmt-48",
-- .id = 1,
-- .dev = {
-- .platform_data = &cmt1_platform_data,
-- },
-- .resource = cmt1_resources,
-- .num_resources = ARRAY_SIZE(cmt1_resources),
--};
--
--/* TMU */
--static struct sh_timer_config tmu0_platform_data = {
-- .channels_mask = 7,
--};
--
--static struct resource tmu0_resources[] = {
-- DEFINE_RES_MEM(0xfff60000, 0x2c),
-- DEFINE_RES_IRQ(intcs_evt2irq(0xe80)),
-- DEFINE_RES_IRQ(intcs_evt2irq(0xea0)),
-- DEFINE_RES_IRQ(intcs_evt2irq(0xec0)),
--};
--
--static struct platform_device tmu0_device = {
-- .name = "sh-tmu",
-- .id = 0,
-- .dev = {
-- .platform_data = &tmu0_platform_data,
-- },
-- .resource = tmu0_resources,
-- .num_resources = ARRAY_SIZE(tmu0_resources),
--};
--
--static struct resource i2c0_resources[] = {
-- [0] = DEFINE_RES_MEM(0xe6820000, 0x426),
-- [1] = {
-- .start = gic_spi(167),
-- .end = gic_spi(170),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct resource i2c1_resources[] = {
-- [0] = DEFINE_RES_MEM(0xe6822000, 0x426),
-- [1] = {
-- .start = gic_spi(51),
-- .end = gic_spi(54),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct resource i2c2_resources[] = {
-- [0] = DEFINE_RES_MEM(0xe6824000, 0x426),
-- [1] = {
-- .start = gic_spi(171),
-- .end = gic_spi(174),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct resource i2c3_resources[] = {
-- [0] = DEFINE_RES_MEM(0xe6826000, 0x426),
-- [1] = {
-- .start = gic_spi(183),
-- .end = gic_spi(186),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct resource i2c4_resources[] = {
-- [0] = DEFINE_RES_MEM(0xe6828000, 0x426),
-- [1] = {
-- .start = gic_spi(187),
-- .end = gic_spi(190),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct i2c_sh_mobile_platform_data i2c_platform_data = {
-- .clks_per_count = 2,
--};
--
--static struct platform_device i2c0_device = {
-- .name = "i2c-sh_mobile",
-- .id = 0,
-- .resource = i2c0_resources,
-- .num_resources = ARRAY_SIZE(i2c0_resources),
-- .dev = {
-- .platform_data = &i2c_platform_data,
-- },
--};
--
--static struct platform_device i2c1_device = {
-- .name = "i2c-sh_mobile",
-- .id = 1,
-- .resource = i2c1_resources,
-- .num_resources = ARRAY_SIZE(i2c1_resources),
-- .dev = {
-- .platform_data = &i2c_platform_data,
-- },
--};
--
--static struct platform_device i2c2_device = {
-- .name = "i2c-sh_mobile",
-- .id = 2,
-- .resource = i2c2_resources,
-- .num_resources = ARRAY_SIZE(i2c2_resources),
-- .dev = {
-- .platform_data = &i2c_platform_data,
-- },
--};
--
--static struct platform_device i2c3_device = {
-- .name = "i2c-sh_mobile",
-- .id = 3,
-- .resource = i2c3_resources,
-- .num_resources = ARRAY_SIZE(i2c3_resources),
-- .dev = {
-- .platform_data = &i2c_platform_data,
-- },
--};
--
--static struct platform_device i2c4_device = {
-- .name = "i2c-sh_mobile",
-- .id = 4,
-- .resource = i2c4_resources,
-- .num_resources = ARRAY_SIZE(i2c4_resources),
-- .dev = {
-- .platform_data = &i2c_platform_data,
-- },
--};
--
--static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = {
-- {
-- .slave_id = SHDMA_SLAVE_SCIF0_TX,
-- .addr = 0xe6c40020,
-- .chcr = CHCR_TX(XMIT_SZ_8BIT),
-- .mid_rid = 0x21,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF0_RX,
-- .addr = 0xe6c40024,
-- .chcr = CHCR_RX(XMIT_SZ_8BIT),
-- .mid_rid = 0x22,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF1_TX,
-- .addr = 0xe6c50020,
-- .chcr = CHCR_TX(XMIT_SZ_8BIT),
-- .mid_rid = 0x25,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF1_RX,
-- .addr = 0xe6c50024,
-- .chcr = CHCR_RX(XMIT_SZ_8BIT),
-- .mid_rid = 0x26,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF2_TX,
-- .addr = 0xe6c60020,
-- .chcr = CHCR_TX(XMIT_SZ_8BIT),
-- .mid_rid = 0x29,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF2_RX,
-- .addr = 0xe6c60024,
-- .chcr = CHCR_RX(XMIT_SZ_8BIT),
-- .mid_rid = 0x2a,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF3_TX,
-- .addr = 0xe6c70020,
-- .chcr = CHCR_TX(XMIT_SZ_8BIT),
-- .mid_rid = 0x2d,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF3_RX,
-- .addr = 0xe6c70024,
-- .chcr = CHCR_RX(XMIT_SZ_8BIT),
-- .mid_rid = 0x2e,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF4_TX,
-- .addr = 0xe6c80020,
-- .chcr = CHCR_TX(XMIT_SZ_8BIT),
-- .mid_rid = 0x39,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF4_RX,
-- .addr = 0xe6c80024,
-- .chcr = CHCR_RX(XMIT_SZ_8BIT),
-- .mid_rid = 0x3a,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF5_TX,
-- .addr = 0xe6cb0020,
-- .chcr = CHCR_TX(XMIT_SZ_8BIT),
-- .mid_rid = 0x35,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF5_RX,
-- .addr = 0xe6cb0024,
-- .chcr = CHCR_RX(XMIT_SZ_8BIT),
-- .mid_rid = 0x36,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF6_TX,
-- .addr = 0xe6cc0020,
-- .chcr = CHCR_TX(XMIT_SZ_8BIT),
-- .mid_rid = 0x1d,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF6_RX,
-- .addr = 0xe6cc0024,
-- .chcr = CHCR_RX(XMIT_SZ_8BIT),
-- .mid_rid = 0x1e,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF7_TX,
-- .addr = 0xe6cd0020,
-- .chcr = CHCR_TX(XMIT_SZ_8BIT),
-- .mid_rid = 0x19,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF7_RX,
-- .addr = 0xe6cd0024,
-- .chcr = CHCR_RX(XMIT_SZ_8BIT),
-- .mid_rid = 0x1a,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF8_TX,
-- .addr = 0xe6c30040,
-- .chcr = CHCR_TX(XMIT_SZ_8BIT),
-- .mid_rid = 0x3d,
-- }, {
-- .slave_id = SHDMA_SLAVE_SCIF8_RX,
-- .addr = 0xe6c30060,
-- .chcr = CHCR_RX(XMIT_SZ_8BIT),
-- .mid_rid = 0x3e,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI0_TX,
-- .addr = 0xee100030,
-- .chcr = CHCR_TX(XMIT_SZ_16BIT),
-- .mid_rid = 0xc1,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI0_RX,
-- .addr = 0xee100030,
-- .chcr = CHCR_RX(XMIT_SZ_16BIT),
-- .mid_rid = 0xc2,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI1_TX,
-- .addr = 0xee120030,
-- .chcr = CHCR_TX(XMIT_SZ_16BIT),
-- .mid_rid = 0xc9,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI1_RX,
-- .addr = 0xee120030,
-- .chcr = CHCR_RX(XMIT_SZ_16BIT),
-- .mid_rid = 0xca,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI2_TX,
-- .addr = 0xee140030,
-- .chcr = CHCR_TX(XMIT_SZ_16BIT),
-- .mid_rid = 0xcd,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI2_RX,
-- .addr = 0xee140030,
-- .chcr = CHCR_RX(XMIT_SZ_16BIT),
-- .mid_rid = 0xce,
-- }, {
-- .slave_id = SHDMA_SLAVE_MMCIF_TX,
-- .addr = 0xe6bd0034,
-- .chcr = CHCR_TX(XMIT_SZ_32BIT),
-- .mid_rid = 0xd1,
-- }, {
-- .slave_id = SHDMA_SLAVE_MMCIF_RX,
-- .addr = 0xe6bd0034,
-- .chcr = CHCR_RX(XMIT_SZ_32BIT),
-- .mid_rid = 0xd2,
-- },
--};
--
--#define DMAE_CHANNEL(_offset) \
-- { \
-- .offset = _offset - 0x20, \
-- .dmars = _offset - 0x20 + 0x40, \
-- }
--
--static const struct sh_dmae_channel sh73a0_dmae_channels[] = {
-- DMAE_CHANNEL(0x8000),
-- DMAE_CHANNEL(0x8080),
-- DMAE_CHANNEL(0x8100),
-- DMAE_CHANNEL(0x8180),
-- DMAE_CHANNEL(0x8200),
-- DMAE_CHANNEL(0x8280),
-- DMAE_CHANNEL(0x8300),
-- DMAE_CHANNEL(0x8380),
-- DMAE_CHANNEL(0x8400),
-- DMAE_CHANNEL(0x8480),
-- DMAE_CHANNEL(0x8500),
-- DMAE_CHANNEL(0x8580),
-- DMAE_CHANNEL(0x8600),
-- DMAE_CHANNEL(0x8680),
-- DMAE_CHANNEL(0x8700),
-- DMAE_CHANNEL(0x8780),
-- DMAE_CHANNEL(0x8800),
-- DMAE_CHANNEL(0x8880),
-- DMAE_CHANNEL(0x8900),
-- DMAE_CHANNEL(0x8980),
--};
--
--static struct sh_dmae_pdata sh73a0_dmae_platform_data = {
-- .slave = sh73a0_dmae_slaves,
-- .slave_num = ARRAY_SIZE(sh73a0_dmae_slaves),
-- .channel = sh73a0_dmae_channels,
-- .channel_num = ARRAY_SIZE(sh73a0_dmae_channels),
-- .ts_low_shift = TS_LOW_SHIFT,
-- .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
-- .ts_high_shift = TS_HI_SHIFT,
-- .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
-- .ts_shift = dma_ts_shift,
-- .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
-- .dmaor_init = DMAOR_DME,
--};
--
--static struct resource sh73a0_dmae_resources[] = {
-- DEFINE_RES_MEM(0xfe000020, 0x89e0),
-- {
-- .name = "error_irq",
-- .start = gic_spi(129),
-- .end = gic_spi(129),
-- .flags = IORESOURCE_IRQ,
-- },
-- {
-- /* IRQ for channels 0-19 */
-- .start = gic_spi(109),
-- .end = gic_spi(128),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device dma0_device = {
-- .name = "sh-dma-engine",
-- .id = 0,
-- .resource = sh73a0_dmae_resources,
-- .num_resources = ARRAY_SIZE(sh73a0_dmae_resources),
-- .dev = {
-- .platform_data = &sh73a0_dmae_platform_data,
-- },
--};
--
--/* MPDMAC */
--static const struct sh_dmae_slave_config sh73a0_mpdma_slaves[] = {
-- {
-- .slave_id = SHDMA_SLAVE_FSI2A_RX,
-- .addr = 0xec230020,
-- .chcr = CHCR_RX(XMIT_SZ_32BIT),
-- .mid_rid = 0xd6, /* CHECK ME */
-- }, {
-- .slave_id = SHDMA_SLAVE_FSI2A_TX,
-- .addr = 0xec230024,
-- .chcr = CHCR_TX(XMIT_SZ_32BIT),
-- .mid_rid = 0xd5, /* CHECK ME */
-- }, {
-- .slave_id = SHDMA_SLAVE_FSI2C_RX,
-- .addr = 0xec230060,
-- .chcr = CHCR_RX(XMIT_SZ_32BIT),
-- .mid_rid = 0xda, /* CHECK ME */
-- }, {
-- .slave_id = SHDMA_SLAVE_FSI2C_TX,
-- .addr = 0xec230064,
-- .chcr = CHCR_TX(XMIT_SZ_32BIT),
-- .mid_rid = 0xd9, /* CHECK ME */
-- }, {
-- .slave_id = SHDMA_SLAVE_FSI2B_RX,
-- .addr = 0xec240020,
-- .chcr = CHCR_RX(XMIT_SZ_32BIT),
-- .mid_rid = 0x8e, /* CHECK ME */
-- }, {
-- .slave_id = SHDMA_SLAVE_FSI2B_TX,
-- .addr = 0xec240024,
-- .chcr = CHCR_RX(XMIT_SZ_32BIT),
-- .mid_rid = 0x8d, /* CHECK ME */
-- }, {
-- .slave_id = SHDMA_SLAVE_FSI2D_RX,
-- .addr = 0xec240060,
-- .chcr = CHCR_RX(XMIT_SZ_32BIT),
-- .mid_rid = 0x9a, /* CHECK ME */
-- },
--};
--
--#define MPDMA_CHANNEL(a, b, c) \
--{ \
-- .offset = a, \
-- .dmars = b, \
-- .dmars_bit = c, \
-- .chclr_offset = (0x220 - 0x20) + a \
--}
--
--static const struct sh_dmae_channel sh73a0_mpdma_channels[] = {
-- MPDMA_CHANNEL(0x00, 0, 0),
-- MPDMA_CHANNEL(0x10, 0, 8),
-- MPDMA_CHANNEL(0x20, 4, 0),
-- MPDMA_CHANNEL(0x30, 4, 8),
-- MPDMA_CHANNEL(0x50, 8, 0),
-- MPDMA_CHANNEL(0x70, 8, 8),
--};
--
--static struct sh_dmae_pdata sh73a0_mpdma_platform_data = {
-- .slave = sh73a0_mpdma_slaves,
-- .slave_num = ARRAY_SIZE(sh73a0_mpdma_slaves),
-- .channel = sh73a0_mpdma_channels,
-- .channel_num = ARRAY_SIZE(sh73a0_mpdma_channels),
-- .ts_low_shift = TS_LOW_SHIFT,
-- .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
-- .ts_high_shift = TS_HI_SHIFT,
-- .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
-- .ts_shift = dma_ts_shift,
-- .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
-- .dmaor_init = DMAOR_DME,
-- .chclr_present = 1,
--};
--
--/* Resource order important! */
--static struct resource sh73a0_mpdma_resources[] = {
-- /* Channel registers and DMAOR */
-- DEFINE_RES_MEM(0xec618020, 0x270),
-- /* DMARSx */
-- DEFINE_RES_MEM(0xec619000, 0xc),
-- {
-- .name = "error_irq",
-- .start = gic_spi(181),
-- .end = gic_spi(181),
-- .flags = IORESOURCE_IRQ,
-- },
-- {
-- /* IRQ for channels 0-5 */
-- .start = gic_spi(175),
-- .end = gic_spi(180),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device mpdma0_device = {
-- .name = "sh-dma-engine",
-- .id = 1,
-- .resource = sh73a0_mpdma_resources,
-- .num_resources = ARRAY_SIZE(sh73a0_mpdma_resources),
-- .dev = {
-- .platform_data = &sh73a0_mpdma_platform_data,
-- },
--};
--
--static struct resource pmu_resources[] = {
-- [0] = {
-- .start = gic_spi(55),
-- .end = gic_spi(55),
-- .flags = IORESOURCE_IRQ,
-- },
-- [1] = {
-- .start = gic_spi(56),
-- .end = gic_spi(56),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device pmu_device = {
-- .name = "armv7-pmu",
-- .id = -1,
-- .num_resources = ARRAY_SIZE(pmu_resources),
-- .resource = pmu_resources,
--};
--
--/* an IPMMU module for ICB */
--static struct resource ipmmu_resources[] = {
-- DEFINE_RES_MEM(0xfe951000, 0x100),
--};
--
--static const char * const ipmmu_dev_names[] = {
-- "sh_mobile_lcdc_fb.0",
--};
--
--static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
-- .dev_names = ipmmu_dev_names,
-- .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
--};
--
--static struct platform_device ipmmu_device = {
-- .name = "ipmmu",
-- .id = -1,
-- .dev = {
-- .platform_data = &ipmmu_platform_data,
-- },
-- .resource = ipmmu_resources,
-- .num_resources = ARRAY_SIZE(ipmmu_resources),
--};
--
--static struct renesas_intc_irqpin_config irqpin0_platform_data = {
-- .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */
-- .control_parent = true,
--};
--
--static struct resource irqpin0_resources[] = {
-- DEFINE_RES_MEM(0xe6900000, 4), /* ICR1A */
-- DEFINE_RES_MEM(0xe6900010, 4), /* INTPRI00A */
-- DEFINE_RES_MEM(0xe6900020, 1), /* INTREQ00A */
-- DEFINE_RES_MEM(0xe6900040, 1), /* INTMSK00A */
-- DEFINE_RES_MEM(0xe6900060, 1), /* INTMSKCLR00A */
-- DEFINE_RES_IRQ(gic_spi(1)), /* IRQ0 */
-- DEFINE_RES_IRQ(gic_spi(2)), /* IRQ1 */
-- DEFINE_RES_IRQ(gic_spi(3)), /* IRQ2 */
-- DEFINE_RES_IRQ(gic_spi(4)), /* IRQ3 */
-- DEFINE_RES_IRQ(gic_spi(5)), /* IRQ4 */
-- DEFINE_RES_IRQ(gic_spi(6)), /* IRQ5 */
-- DEFINE_RES_IRQ(gic_spi(7)), /* IRQ6 */
-- DEFINE_RES_IRQ(gic_spi(8)), /* IRQ7 */
--};
--
--static struct platform_device irqpin0_device = {
-- .name = "renesas_intc_irqpin",
-- .id = 0,
-- .resource = irqpin0_resources,
-- .num_resources = ARRAY_SIZE(irqpin0_resources),
-- .dev = {
-- .platform_data = &irqpin0_platform_data,
-- },
--};
--
--static struct renesas_intc_irqpin_config irqpin1_platform_data = {
-- .irq_base = irq_pin(8), /* IRQ8 -> IRQ15 */
-- .control_parent = true, /* Disable spurious IRQ10 */
--};
--
--static struct resource irqpin1_resources[] = {
-- DEFINE_RES_MEM(0xe6900004, 4), /* ICR2A */
-- DEFINE_RES_MEM(0xe6900014, 4), /* INTPRI10A */
-- DEFINE_RES_MEM(0xe6900024, 1), /* INTREQ10A */
-- DEFINE_RES_MEM(0xe6900044, 1), /* INTMSK10A */
-- DEFINE_RES_MEM(0xe6900064, 1), /* INTMSKCLR10A */
-- DEFINE_RES_IRQ(gic_spi(9)), /* IRQ8 */
-- DEFINE_RES_IRQ(gic_spi(10)), /* IRQ9 */
-- DEFINE_RES_IRQ(gic_spi(11)), /* IRQ10 */
-- DEFINE_RES_IRQ(gic_spi(12)), /* IRQ11 */
-- DEFINE_RES_IRQ(gic_spi(13)), /* IRQ12 */
-- DEFINE_RES_IRQ(gic_spi(14)), /* IRQ13 */
-- DEFINE_RES_IRQ(gic_spi(15)), /* IRQ14 */
-- DEFINE_RES_IRQ(gic_spi(16)), /* IRQ15 */
--};
--
--static struct platform_device irqpin1_device = {
-- .name = "renesas_intc_irqpin",
-- .id = 1,
-- .resource = irqpin1_resources,
-- .num_resources = ARRAY_SIZE(irqpin1_resources),
-- .dev = {
-- .platform_data = &irqpin1_platform_data,
-- },
--};
--
--static struct renesas_intc_irqpin_config irqpin2_platform_data = {
-- .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */
-- .control_parent = true,
--};
--
--static struct resource irqpin2_resources[] = {
-- DEFINE_RES_MEM(0xe6900008, 4), /* ICR3A */
-- DEFINE_RES_MEM(0xe6900018, 4), /* INTPRI20A */
-- DEFINE_RES_MEM(0xe6900028, 1), /* INTREQ20A */
-- DEFINE_RES_MEM(0xe6900048, 1), /* INTMSK20A */
-- DEFINE_RES_MEM(0xe6900068, 1), /* INTMSKCLR20A */
-- DEFINE_RES_IRQ(gic_spi(17)), /* IRQ16 */
-- DEFINE_RES_IRQ(gic_spi(18)), /* IRQ17 */
-- DEFINE_RES_IRQ(gic_spi(19)), /* IRQ18 */
-- DEFINE_RES_IRQ(gic_spi(20)), /* IRQ19 */
-- DEFINE_RES_IRQ(gic_spi(21)), /* IRQ20 */
-- DEFINE_RES_IRQ(gic_spi(22)), /* IRQ21 */
-- DEFINE_RES_IRQ(gic_spi(23)), /* IRQ22 */
-- DEFINE_RES_IRQ(gic_spi(24)), /* IRQ23 */
--};
--
--static struct platform_device irqpin2_device = {
-- .name = "renesas_intc_irqpin",
-- .id = 2,
-- .resource = irqpin2_resources,
-- .num_resources = ARRAY_SIZE(irqpin2_resources),
-- .dev = {
-- .platform_data = &irqpin2_platform_data,
-- },
--};
--
--static struct renesas_intc_irqpin_config irqpin3_platform_data = {
-- .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */
-- .control_parent = true,
--};
--
--static struct resource irqpin3_resources[] = {
-- DEFINE_RES_MEM(0xe690000c, 4), /* ICR4A */
-- DEFINE_RES_MEM(0xe690001c, 4), /* INTPRI30A */
-- DEFINE_RES_MEM(0xe690002c, 1), /* INTREQ30A */
-- DEFINE_RES_MEM(0xe690004c, 1), /* INTMSK30A */
-- DEFINE_RES_MEM(0xe690006c, 1), /* INTMSKCLR30A */
-- DEFINE_RES_IRQ(gic_spi(25)), /* IRQ24 */
-- DEFINE_RES_IRQ(gic_spi(26)), /* IRQ25 */
-- DEFINE_RES_IRQ(gic_spi(27)), /* IRQ26 */
-- DEFINE_RES_IRQ(gic_spi(28)), /* IRQ27 */
-- DEFINE_RES_IRQ(gic_spi(29)), /* IRQ28 */
-- DEFINE_RES_IRQ(gic_spi(30)), /* IRQ29 */
-- DEFINE_RES_IRQ(gic_spi(31)), /* IRQ30 */
-- DEFINE_RES_IRQ(gic_spi(32)), /* IRQ31 */
--};
--
--static struct platform_device irqpin3_device = {
-- .name = "renesas_intc_irqpin",
-- .id = 3,
-- .resource = irqpin3_resources,
-- .num_resources = ARRAY_SIZE(irqpin3_resources),
-- .dev = {
-- .platform_data = &irqpin3_platform_data,
-- },
--};
--
--static struct platform_device *sh73a0_early_devices[] __initdata = {
-- &scif0_device,
-- &scif1_device,
-- &scif2_device,
-- &scif3_device,
-- &scif4_device,
-- &scif5_device,
-- &scif6_device,
-- &scif7_device,
-- &scif8_device,
-- &tmu0_device,
-- &ipmmu_device,
-- &cmt1_device,
--};
--
--static struct platform_device *sh73a0_late_devices[] __initdata = {
-- &i2c0_device,
-- &i2c1_device,
-- &i2c2_device,
-- &i2c3_device,
-- &i2c4_device,
-- &dma0_device,
-- &mpdma0_device,
-- &pmu_device,
-- &irqpin0_device,
-- &irqpin1_device,
-- &irqpin2_device,
-- &irqpin3_device,
--};
--
--#define SRCR2 IOMEM(0xe61580b0)
--
--void __init sh73a0_add_standard_devices(void)
--{
-- /* Clear software reset bit on SY-DMAC module */
-- __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2);
--
-- platform_add_devices(sh73a0_early_devices,
-- ARRAY_SIZE(sh73a0_early_devices));
-- platform_add_devices(sh73a0_late_devices,
-- ARRAY_SIZE(sh73a0_late_devices));
--}
--
--/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
--void __init __weak sh73a0_register_twd(void) { }
--
--void __init sh73a0_earlytimer_init(void)
--{
-- shmobile_init_delay();
--#ifndef CONFIG_COMMON_CLK
-- sh73a0_clock_init();
--#endif
-- shmobile_earlytimer_init();
-- sh73a0_register_twd();
--}
--
--void __init sh73a0_add_early_devices(void)
--{
-- early_platform_add_devices(sh73a0_early_devices,
-- ARRAY_SIZE(sh73a0_early_devices));
--
-- /* setup early console here as well */
-- shmobile_setup_console();
--}
--
--#ifdef CONFIG_USE_OF
--
- static void __init sh73a0_generic_init(void)
- {
- #ifdef CONFIG_CACHE_L2X0
-@@ -807,4 +71,3 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
- .init_late = shmobile_init_late,
- .dt_compat = sh73a0_boards_compat_dt,
- MACHINE_END
--#endif /* CONFIG_USE_OF */
-diff --git a/arch/arm/mach-shmobile/sh73a0.h b/arch/arm/mach-shmobile/sh73a0.h
-index 5a80f18b4fa0..39646806cf64 100644
---- a/arch/arm/mach-shmobile/sh73a0.h
-+++ b/arch/arm/mach-shmobile/sh73a0.h
-@@ -1,89 +1,6 @@
- #ifndef __ASM_SH73A0_H__
- #define __ASM_SH73A0_H__
-
--/* DMA slave IDs */
--enum {
-- SHDMA_SLAVE_INVALID,
-- SHDMA_SLAVE_SCIF0_TX,
-- SHDMA_SLAVE_SCIF0_RX,
-- SHDMA_SLAVE_SCIF1_TX,
-- SHDMA_SLAVE_SCIF1_RX,
-- SHDMA_SLAVE_SCIF2_TX,
-- SHDMA_SLAVE_SCIF2_RX,
-- SHDMA_SLAVE_SCIF3_TX,
-- SHDMA_SLAVE_SCIF3_RX,
-- SHDMA_SLAVE_SCIF4_TX,
-- SHDMA_SLAVE_SCIF4_RX,
-- SHDMA_SLAVE_SCIF5_TX,
-- SHDMA_SLAVE_SCIF5_RX,
-- SHDMA_SLAVE_SCIF6_TX,
-- SHDMA_SLAVE_SCIF6_RX,
-- SHDMA_SLAVE_SCIF7_TX,
-- SHDMA_SLAVE_SCIF7_RX,
-- SHDMA_SLAVE_SCIF8_TX,
-- SHDMA_SLAVE_SCIF8_RX,
-- SHDMA_SLAVE_SDHI0_TX,
-- SHDMA_SLAVE_SDHI0_RX,
-- SHDMA_SLAVE_SDHI1_TX,
-- SHDMA_SLAVE_SDHI1_RX,
-- SHDMA_SLAVE_SDHI2_TX,
-- SHDMA_SLAVE_SDHI2_RX,
-- SHDMA_SLAVE_MMCIF_TX,
-- SHDMA_SLAVE_MMCIF_RX,
-- SHDMA_SLAVE_FSI2A_TX,
-- SHDMA_SLAVE_FSI2A_RX,
-- SHDMA_SLAVE_FSI2B_TX,
-- SHDMA_SLAVE_FSI2B_RX,
-- SHDMA_SLAVE_FSI2C_TX,
-- SHDMA_SLAVE_FSI2C_RX,
-- SHDMA_SLAVE_FSI2D_RX,
--};
--
--/*
-- * SH73A0 IRQ LOCATION TABLE
-- *
-- * 416 -----------------------------------------
-- * IRQ0-IRQ15
-- * 431 -----------------------------------------
-- * ...
-- * 448 -----------------------------------------
-- * sh73a0-intcs
-- * sh73a0-intca-irq-pins
-- * 680 -----------------------------------------
-- * ...
-- * 700 -----------------------------------------
-- * sh73a0-pint0
-- * 731 -----------------------------------------
-- * 732 -----------------------------------------
-- * sh73a0-pint1
-- * 739 -----------------------------------------
-- * ...
-- * 800 -----------------------------------------
-- * IRQ16-IRQ31
-- * 815 -----------------------------------------
-- * ...
-- * 928 -----------------------------------------
-- * sh73a0-intca-irq-pins
-- * 943 -----------------------------------------
-- */
--
--/* PINT interrupts are located at Linux IRQ 700 and up */
--#define SH73A0_PINT0_IRQ(irq) ((irq) + 700)
--#define SH73A0_PINT1_IRQ(irq) ((irq) + 732)
--
--extern void sh73a0_init_irq(void);
--extern void sh73a0_init_irq_dt(void);
--extern void sh73a0_map_io(void);
--extern void sh73a0_earlytimer_init(void);
--extern void sh73a0_add_early_devices(void);
--extern void sh73a0_add_standard_devices(void);
--extern void sh73a0_clock_init(void);
--extern void sh73a0_pinmux_init(void);
--extern void sh73a0_pm_init(void);
--extern struct clk sh73a0_extal1_clk;
--extern struct clk sh73a0_extal2_clk;
--extern struct clk sh73a0_extcki_clk;
--extern struct clk sh73a0_extalr_clk;
- extern struct smp_operations sh73a0_smp_ops;
-
- #endif /* __ASM_SH73A0_H__ */
-diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
-index 2106d6b76a06..d03aa11fb46d 100644
---- a/arch/arm/mach-shmobile/smp-sh73a0.c
-+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
-@@ -33,14 +33,6 @@
-
- #define SH73A0_SCU_BASE 0xf0000000
-
--#if defined(CONFIG_HAVE_ARM_TWD) && !defined(CONFIG_ARCH_MULTIPLATFORM)
--static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, SH73A0_SCU_BASE + 0x600, 29);
--void __init sh73a0_register_twd(void)
--{
-- twd_local_timer_register(&twd_local_timer);
--}
--#endif
--
- static int sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle)
- {
- unsigned int lcpu = cpu_logical_map(cpu);
---
-2.6.2
-
diff --git a/patches.renesas/0150-ARM-shmobile-Remove-legacy-board-code-for-Armadillo-.patch b/patches.renesas/0150-ARM-shmobile-Remove-legacy-board-code-for-Armadillo-.patch
deleted file mode 100644
index 16c3d237c29384..00000000000000
--- a/patches.renesas/0150-ARM-shmobile-Remove-legacy-board-code-for-Armadillo-.patch
+++ /dev/null
@@ -1,1446 +0,0 @@
-From d70869329e4608ec6351016075ef2567b377123f Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:21 +0200
-Subject: [PATCH 150/326] ARM: shmobile: Remove legacy board code for
- Armadillo-800 EVA
-
-The Armadillo-800 EVA board is sufficiently supported by DT-based and
-board-less R-Mobile A1 (r8a7740) multiplatform kernels, and board
-staging code. Hence remove the legacy board code to reduce maintenance
-effort.
-
-Lacking areas are:
- - USB (it doesn't work in legacy, neither),
- - HDMI (it doesn't work in legacy, neither),
- - Camera (we don't care),
- - DMAC/IPMMU (no DT bindings are planned).
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 1fa59bda21c7fa3644e374be0547395975286599)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/Kconfig | 9 -
- arch/arm/mach-shmobile/Makefile | 1 -
- arch/arm/mach-shmobile/Makefile.boot | 1 -
- arch/arm/mach-shmobile/board-armadillo800eva.c | 1365 ------------------------
- 4 files changed, 1376 deletions(-)
- delete mode 100644 arch/arm/mach-shmobile/board-armadillo800eva.c
-
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index c506be27b610..9e916fafc77d 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -126,15 +126,6 @@ config ARCH_R8A7779
-
- comment "Renesas ARM SoCs Board Type"
-
--config MACH_ARMADILLO800EVA
-- bool "Armadillo-800 EVA board"
-- depends on ARCH_R8A7740
-- select ARCH_REQUIRE_GPIOLIB
-- select REGULATOR_FIXED_VOLTAGE if REGULATOR
-- select SMSC_PHY if SH_ETH
-- select SND_SOC_WM8978 if SND_SIMPLE_CARD && I2C
-- select USE_OF
--
- config MACH_BOCKW
- bool "BOCK-W platform"
- depends on ARCH_R8A7778
-diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
-index 28e0f05a8577..548536fcb3b1 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -56,7 +56,6 @@ else
- obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
- obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
- obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
--obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
- endif
-
- # Framework support
-diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
-index 2269b1c3c30b..14cdfc0ed075 100644
---- a/arch/arm/mach-shmobile/Makefile.boot
-+++ b/arch/arm/mach-shmobile/Makefile.boot
-@@ -1,6 +1,5 @@
- # per-board load address for uImage
- loadaddr-y :=
--loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
- loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
- loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000
- loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
-diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
-deleted file mode 100644
-index bf37e3c532f6..000000000000
---- a/arch/arm/mach-shmobile/board-armadillo800eva.c
-+++ /dev/null
-@@ -1,1365 +0,0 @@
--/*
-- * armadillo 800 eva board support
-- *
-- * Copyright (C) 2012 Renesas Solutions Corp.
-- * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; version 2 of the License.
-- *
-- * 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/clk.h>
--#include <linux/delay.h>
--#include <linux/err.h>
--#include <linux/gpio.h>
--#include <linux/gpio_keys.h>
--#include <linux/i2c-gpio.h>
--#include <linux/input.h>
--#include <linux/irq.h>
--#include <linux/kernel.h>
--#include <linux/mfd/tmio.h>
--#include <linux/mmc/host.h>
--#include <linux/mmc/sh_mmcif.h>
--#include <linux/mmc/sh_mobile_sdhi.h>
--#include <linux/pinctrl/machine.h>
--#include <linux/platform_data/st1232_pdata.h>
--#include <linux/platform_device.h>
--#include <linux/pwm.h>
--#include <linux/pwm_backlight.h>
--#include <linux/reboot.h>
--#include <linux/regulator/driver.h>
--#include <linux/regulator/fixed.h>
--#include <linux/regulator/gpio-regulator.h>
--#include <linux/regulator/machine.h>
--#include <linux/sh_eth.h>
--#include <linux/usb/renesas_usbhs.h>
--#include <linux/videodev2.h>
--
--#include <asm/hardware/cache-l2x0.h>
--#include <asm/mach-types.h>
--#include <asm/mach/arch.h>
--#include <asm/mach/map.h>
--#include <asm/mach/time.h>
--#include <asm/page.h>
--#include <media/mt9t112.h>
--#include <media/sh_mobile_ceu.h>
--#include <media/soc_camera.h>
--#include <sound/sh_fsi.h>
--#include <sound/simple_card.h>
--#include <video/sh_mobile_hdmi.h>
--#include <video/sh_mobile_lcdc.h>
--
--#include "common.h"
--#include "irqs.h"
--#include "pm-rmobile.h"
--#include "r8a7740.h"
--#include "sh-gpio.h"
--
--/*
-- * CON1 Camera Module
-- * CON2 Extension Bus
-- * CON3 HDMI Output
-- * CON4 Composite Video Output
-- * CON5 H-UDI JTAG
-- * CON6 ARM JTAG
-- * CON7 SD1
-- * CON8 SD2
-- * CON9 RTC BackUp
-- * CON10 Monaural Mic Input
-- * CON11 Stereo Headphone Output
-- * CON12 Audio Line Output(L)
-- * CON13 Audio Line Output(R)
-- * CON14 AWL13 Module
-- * CON15 Extension
-- * CON16 LCD1
-- * CON17 LCD2
-- * CON19 Power Input
-- * CON20 USB1
-- * CON21 USB2
-- * CON22 Serial
-- * CON23 LAN
-- * CON24 USB3
-- * LED1 Camera LED(Yellow)
-- * LED2 Power LED (Green)
-- * ED3-LED6 User LED(Yellow)
-- * LED7 LAN link LED(Green)
-- * LED8 LAN activity LED(Yellow)
-- */
--
--/*
-- * DipSwitch
-- *
-- * SW1
-- *
-- * -12345678-+---------------+----------------------------
-- * 1 | boot | hermit
-- * 0 | boot | OS auto boot
-- * -12345678-+---------------+----------------------------
-- * 00 | boot device | eMMC
-- * 10 | boot device | SDHI0 (CON7)
-- * 01 | boot device | -
-- * 11 | boot device | Extension Buss (CS0)
-- * -12345678-+---------------+----------------------------
-- * 0 | Extension Bus | D8-D15 disable, eMMC enable
-- * 1 | Extension Bus | D8-D15 enable, eMMC disable
-- * -12345678-+---------------+----------------------------
-- * 0 | SDHI1 | COM8 disable, COM14 enable
-- * 1 | SDHI1 | COM8 enable, COM14 disable
-- * -12345678-+---------------+----------------------------
-- * 0 | USB0 | COM20 enable, COM24 disable
-- * 1 | USB0 | COM20 disable, COM24 enable
-- * -12345678-+---------------+----------------------------
-- * 00 | JTAG | SH-X2
-- * 10 | JTAG | ARM
-- * 01 | JTAG | -
-- * 11 | JTAG | Boundary Scan
-- *-----------+---------------+----------------------------
-- */
--
--/*
-- * FSI-WM8978
-- *
-- * this command is required when playback.
-- *
-- * # amixer set "Headphone" 50
-- *
-- * this command is required when capture.
-- *
-- * # amixer set "Input PGA" 15
-- * # amixer set "Left Input Mixer MicP" on
-- * # amixer set "Left Input Mixer MicN" on
-- * # amixer set "Right Input Mixer MicN" on
-- * # amixer set "Right Input Mixer MicP" on
-- */
--
--/*
-- * USB function
-- *
-- * When you use USB Function,
-- * set SW1.6 ON, and connect cable to CN24.
-- *
-- * USBF needs workaround on R8A7740 chip.
-- * These are a little bit complex.
-- * see
-- * usbhsf_power_ctrl()
-- */
--#define IRQ7 irq_pin(7)
--#define USBCR1 IOMEM(0xe605810a)
--#define USBH 0xC6700000
--#define USBH_USBCTR 0x10834
--
--struct usbhsf_private {
-- struct clk *phy;
-- struct clk *usb24;
-- struct clk *pci;
-- struct clk *func;
-- struct clk *host;
-- void __iomem *usbh_base;
-- struct renesas_usbhs_platform_info info;
--};
--
--#define usbhsf_get_priv(pdev) \
-- container_of(renesas_usbhs_get_info(pdev), \
-- struct usbhsf_private, info)
--
--static int usbhsf_get_id(struct platform_device *pdev)
--{
-- return USBHS_GADGET;
--}
--
--static int usbhsf_power_ctrl(struct platform_device *pdev,
-- void __iomem *base, int enable)
--{
-- struct usbhsf_private *priv = usbhsf_get_priv(pdev);
--
-- /*
-- * Work around for USB Function.
-- * It needs USB host clock, and settings
-- */
-- if (enable) {
-- /*
-- * enable all the related usb clocks
-- * for usb workaround
-- */
-- clk_enable(priv->usb24);
-- clk_enable(priv->pci);
-- clk_enable(priv->host);
-- clk_enable(priv->func);
-- clk_enable(priv->phy);
--
-- /*
-- * set USBCR1
-- *
-- * Port1 is driven by USB function,
-- * Port2 is driven by USB HOST
-- * One HOST (Port1 or Port2 is HOST)
-- * USB PLL input clock = 24MHz
-- */
-- __raw_writew(0xd750, USBCR1);
-- mdelay(1);
--
-- /*
-- * start USB Host
-- */
-- __raw_writel(0x0000000c, priv->usbh_base + USBH_USBCTR);
-- __raw_writel(0x00000008, priv->usbh_base + USBH_USBCTR);
-- mdelay(10);
--
-- /*
-- * USB PHY Power ON
-- */
-- __raw_writew(0xd770, USBCR1);
-- __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
--
-- } else {
-- __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
-- __raw_writew(0xd7c0, USBCR1); /* GPIO */
--
-- clk_disable(priv->phy);
-- clk_disable(priv->func); /* usb work around */
-- clk_disable(priv->host); /* usb work around */
-- clk_disable(priv->pci); /* usb work around */
-- clk_disable(priv->usb24); /* usb work around */
-- }
--
-- return 0;
--}
--
--static int usbhsf_get_vbus(struct platform_device *pdev)
--{
-- return gpio_get_value(209);
--}
--
--static irqreturn_t usbhsf_interrupt(int irq, void *data)
--{
-- struct platform_device *pdev = data;
--
-- renesas_usbhs_call_notify_hotplug(pdev);
--
-- return IRQ_HANDLED;
--}
--
--static int usbhsf_hardware_exit(struct platform_device *pdev)
--{
-- struct usbhsf_private *priv = usbhsf_get_priv(pdev);
--
-- if (!IS_ERR(priv->phy))
-- clk_put(priv->phy);
-- if (!IS_ERR(priv->usb24))
-- clk_put(priv->usb24);
-- if (!IS_ERR(priv->pci))
-- clk_put(priv->pci);
-- if (!IS_ERR(priv->host))
-- clk_put(priv->host);
-- if (!IS_ERR(priv->func))
-- clk_put(priv->func);
-- if (priv->usbh_base)
-- iounmap(priv->usbh_base);
--
-- priv->phy = NULL;
-- priv->usb24 = NULL;
-- priv->pci = NULL;
-- priv->host = NULL;
-- priv->func = NULL;
-- priv->usbh_base = NULL;
--
-- free_irq(IRQ7, pdev);
--
-- return 0;
--}
--
--static int usbhsf_hardware_init(struct platform_device *pdev)
--{
-- struct usbhsf_private *priv = usbhsf_get_priv(pdev);
-- int ret;
--
-- priv->phy = clk_get(&pdev->dev, "phy");
-- priv->usb24 = clk_get(&pdev->dev, "usb24");
-- priv->pci = clk_get(&pdev->dev, "pci");
-- priv->func = clk_get(&pdev->dev, "func");
-- priv->host = clk_get(&pdev->dev, "host");
-- priv->usbh_base = ioremap_nocache(USBH, 0x20000);
--
-- if (IS_ERR(priv->phy) ||
-- IS_ERR(priv->usb24) ||
-- IS_ERR(priv->pci) ||
-- IS_ERR(priv->host) ||
-- IS_ERR(priv->func) ||
-- !priv->usbh_base) {
-- dev_err(&pdev->dev, "USB clock setting failed\n");
-- usbhsf_hardware_exit(pdev);
-- return -EIO;
-- }
--
-- ret = request_irq(IRQ7, usbhsf_interrupt, IRQF_TRIGGER_NONE,
-- dev_name(&pdev->dev), pdev);
-- if (ret) {
-- dev_err(&pdev->dev, "request_irq err\n");
-- return ret;
-- }
-- irq_set_irq_type(IRQ7, IRQ_TYPE_EDGE_BOTH);
--
-- /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
-- clk_set_rate(priv->usb24,
-- clk_get_rate(clk_get_parent(priv->usb24)));
--
-- return 0;
--}
--
--static struct usbhsf_private usbhsf_private = {
-- .info = {
-- .platform_callback = {
-- .get_id = usbhsf_get_id,
-- .get_vbus = usbhsf_get_vbus,
-- .hardware_init = usbhsf_hardware_init,
-- .hardware_exit = usbhsf_hardware_exit,
-- .power_ctrl = usbhsf_power_ctrl,
-- },
-- .driver_param = {
-- .buswait_bwait = 5,
-- .detection_delay = 5,
-- .d0_rx_id = SHDMA_SLAVE_USBHS_RX,
-- .d1_tx_id = SHDMA_SLAVE_USBHS_TX,
-- },
-- }
--};
--
--static struct resource usbhsf_resources[] = {
-- {
-- .name = "USBHS",
-- .start = 0xe6890000,
-- .end = 0xe6890104 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- {
-- .start = gic_spi(51),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device usbhsf_device = {
-- .name = "renesas_usbhs",
-- .dev = {
-- .platform_data = &usbhsf_private.info,
-- },
-- .id = -1,
-- .num_resources = ARRAY_SIZE(usbhsf_resources),
-- .resource = usbhsf_resources,
--};
--
--/* Ether */
--static struct sh_eth_plat_data sh_eth_platdata = {
-- .phy = 0x00, /* LAN8710A */
-- .edmac_endian = EDMAC_LITTLE_ENDIAN,
-- .phy_interface = PHY_INTERFACE_MODE_MII,
--};
--
--static struct resource sh_eth_resources[] = {
-- {
-- .start = 0xe9a00000,
-- .end = 0xe9a00800 - 1,
-- .flags = IORESOURCE_MEM,
-- }, {
-- .start = 0xe9a01800,
-- .end = 0xe9a02000 - 1,
-- .flags = IORESOURCE_MEM,
-- }, {
-- .start = gic_spi(110),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device sh_eth_device = {
-- .name = "r8a7740-gether",
-- .id = -1,
-- .dev = {
-- .platform_data = &sh_eth_platdata,
-- .dma_mask = &sh_eth_device.dev.coherent_dma_mask,
-- .coherent_dma_mask = DMA_BIT_MASK(32),
-- },
-- .resource = sh_eth_resources,
-- .num_resources = ARRAY_SIZE(sh_eth_resources),
--};
--
--/* PWM */
--static struct resource pwm_resources[] = {
-- [0] = {
-- .start = 0xe6600000,
-- .end = 0xe66000ff,
-- .flags = IORESOURCE_MEM,
-- },
--};
--
--static struct platform_device pwm_device = {
-- .name = "renesas-tpu-pwm",
-- .id = -1,
-- .num_resources = ARRAY_SIZE(pwm_resources),
-- .resource = pwm_resources,
--};
--
--static struct pwm_lookup pwm_lookup[] = {
-- PWM_LOOKUP("renesas-tpu-pwm", 2, "pwm-backlight.0", NULL,
-- 33333, PWM_POLARITY_INVERSED),
--};
--
--/* LCDC and backlight */
--static struct platform_pwm_backlight_data pwm_backlight_data = {
-- .lth_brightness = 50,
-- .max_brightness = 255,
-- .dft_brightness = 255,
-- .pwm_period_ns = 33333, /* 30kHz */
-- .enable_gpio = 61,
--};
--
--static struct platform_device pwm_backlight_device = {
-- .name = "pwm-backlight",
-- .dev = {
-- .platform_data = &pwm_backlight_data,
-- },
--};
--
--static struct fb_videomode lcdc0_mode = {
-- .name = "AMPIER/AM-800480",
-- .xres = 800,
-- .yres = 480,
-- .left_margin = 88,
-- .right_margin = 40,
-- .hsync_len = 128,
-- .upper_margin = 20,
-- .lower_margin = 5,
-- .vsync_len = 5,
-- .sync = 0,
--};
--
--static struct sh_mobile_lcdc_info lcdc0_info = {
-- .clock_source = LCDC_CLK_BUS,
-- .ch[0] = {
-- .chan = LCDC_CHAN_MAINLCD,
-- .fourcc = V4L2_PIX_FMT_RGB565,
-- .interface_type = RGB24,
-- .clock_divider = 5,
-- .flags = 0,
-- .lcd_modes = &lcdc0_mode,
-- .num_modes = 1,
-- .panel_cfg = {
-- .width = 111,
-- .height = 68,
-- },
-- },
--};
--
--static struct resource lcdc0_resources[] = {
-- [0] = {
-- .name = "LCD0",
-- .start = 0xfe940000,
-- .end = 0xfe943fff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(177),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device lcdc0_device = {
-- .name = "sh_mobile_lcdc_fb",
-- .num_resources = ARRAY_SIZE(lcdc0_resources),
-- .resource = lcdc0_resources,
-- .id = 0,
-- .dev = {
-- .platform_data = &lcdc0_info,
-- .coherent_dma_mask = DMA_BIT_MASK(32),
-- },
--};
--
--/*
-- * LCDC1/HDMI
-- */
--static struct sh_mobile_hdmi_info hdmi_info = {
-- .flags = HDMI_OUTPUT_PUSH_PULL |
-- HDMI_OUTPUT_POLARITY_HI |
-- HDMI_32BIT_REG |
-- HDMI_HAS_HTOP1 |
-- HDMI_SND_SRC_SPDIF,
--};
--
--static struct resource hdmi_resources[] = {
-- [0] = {
-- .name = "HDMI",
-- .start = 0xe6be0000,
-- .end = 0xe6be03ff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(131),
-- .flags = IORESOURCE_IRQ,
-- },
-- [2] = {
-- .name = "HDMI emma3pf",
-- .start = 0xe6be4000,
-- .end = 0xe6be43ff,
-- .flags = IORESOURCE_MEM,
-- },
--};
--
--static struct platform_device hdmi_device = {
-- .name = "sh-mobile-hdmi",
-- .num_resources = ARRAY_SIZE(hdmi_resources),
-- .resource = hdmi_resources,
-- .id = -1,
-- .dev = {
-- .platform_data = &hdmi_info,
-- },
--};
--
--static const struct fb_videomode lcdc1_mode = {
-- .name = "HDMI 720p",
-- .xres = 1280,
-- .yres = 720,
-- .pixclock = 13468,
-- .left_margin = 220,
-- .right_margin = 110,
-- .hsync_len = 40,
-- .upper_margin = 20,
-- .lower_margin = 5,
-- .vsync_len = 5,
-- .refresh = 60,
-- .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
--};
--
--static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
-- .clock_source = LCDC_CLK_PERIPHERAL, /* HDMI clock */
-- .ch[0] = {
-- .chan = LCDC_CHAN_MAINLCD,
-- .fourcc = V4L2_PIX_FMT_RGB565,
-- .interface_type = RGB24,
-- .clock_divider = 1,
-- .flags = LCDC_FLAGS_DWPOL,
-- .lcd_modes = &lcdc1_mode,
-- .num_modes = 1,
-- .tx_dev = &hdmi_device,
-- .panel_cfg = {
-- .width = 1280,
-- .height = 720,
-- },
-- },
--};
--
--static struct resource hdmi_lcdc_resources[] = {
-- [0] = {
-- .name = "LCDC1",
-- .start = 0xfe944000,
-- .end = 0xfe948000 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(178),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device hdmi_lcdc_device = {
-- .name = "sh_mobile_lcdc_fb",
-- .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
-- .resource = hdmi_lcdc_resources,
-- .id = 1,
-- .dev = {
-- .platform_data = &hdmi_lcdc_info,
-- .coherent_dma_mask = DMA_BIT_MASK(32),
-- },
--};
--
--/* 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__ }
--
--static struct gpio_keys_button gpio_buttons[] = {
-- GPIO_KEY(KEY_POWER, 99, "SW3", .wakeup = 1),
-- GPIO_KEY(KEY_BACK, 100, "SW4"),
-- GPIO_KEY(KEY_MENU, 97, "SW5"),
-- GPIO_KEY(KEY_HOME, 98, "SW6"),
--};
--
--static struct gpio_keys_platform_data gpio_key_info = {
-- .buttons = gpio_buttons,
-- .nbuttons = ARRAY_SIZE(gpio_buttons),
--};
--
--static struct platform_device gpio_keys_device = {
-- .name = "gpio-keys",
-- .id = -1,
-- .dev = {
-- .platform_data = &gpio_key_info,
-- },
--};
--
--/* Fixed 3.3V regulator to be used by SDHI1, MMCIF */
--static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
-- REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
-- REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
--};
--
--/* Fixed 3.3V regulator used by LCD backlight */
--static struct regulator_consumer_supply fixed5v0_power_consumers[] = {
-- REGULATOR_SUPPLY("power", "pwm-backlight.0"),
--};
--
--/* Fixed 3.3V regulator to be used by SDHI0 */
--static struct regulator_consumer_supply vcc_sdhi0_consumers[] = {
-- REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
--};
--
--static struct regulator_init_data vcc_sdhi0_init_data = {
-- .constraints = {
-- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-- },
-- .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
-- .consumer_supplies = vcc_sdhi0_consumers,
--};
--
--static struct fixed_voltage_config vcc_sdhi0_info = {
-- .supply_name = "SDHI0 Vcc",
-- .microvolts = 3300000,
-- .gpio = 75,
-- .enable_high = 1,
-- .init_data = &vcc_sdhi0_init_data,
--};
--
--static struct platform_device vcc_sdhi0 = {
-- .name = "reg-fixed-voltage",
-- .id = 1,
-- .dev = {
-- .platform_data = &vcc_sdhi0_info,
-- },
--};
--
--/* 1.8 / 3.3V SDHI0 VccQ regulator */
--static struct regulator_consumer_supply vccq_sdhi0_consumers[] = {
-- REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
--};
--
--static struct regulator_init_data vccq_sdhi0_init_data = {
-- .constraints = {
-- .input_uV = 3300000,
-- .min_uV = 1800000,
-- .max_uV = 3300000,
-- .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
-- REGULATOR_CHANGE_STATUS,
-- },
-- .num_consumer_supplies = ARRAY_SIZE(vccq_sdhi0_consumers),
-- .consumer_supplies = vccq_sdhi0_consumers,
--};
--
--static struct gpio vccq_sdhi0_gpios[] = {
-- {17, GPIOF_OUT_INIT_LOW, "vccq-sdhi0" },
--};
--
--static struct gpio_regulator_state vccq_sdhi0_states[] = {
-- { .value = 3300000, .gpios = (0 << 0) },
-- { .value = 1800000, .gpios = (1 << 0) },
--};
--
--static struct gpio_regulator_config vccq_sdhi0_info = {
-- .supply_name = "vqmmc",
--
-- .enable_gpio = 74,
-- .enable_high = 1,
-- .enabled_at_boot = 0,
--
-- .gpios = vccq_sdhi0_gpios,
-- .nr_gpios = ARRAY_SIZE(vccq_sdhi0_gpios),
--
-- .states = vccq_sdhi0_states,
-- .nr_states = ARRAY_SIZE(vccq_sdhi0_states),
--
-- .type = REGULATOR_VOLTAGE,
-- .init_data = &vccq_sdhi0_init_data,
--};
--
--static struct platform_device vccq_sdhi0 = {
-- .name = "gpio-regulator",
-- .id = -1,
-- .dev = {
-- .platform_data = &vccq_sdhi0_info,
-- },
--};
--
--/* Fixed 3.3V regulator to be used by SDHI1 */
--static struct regulator_consumer_supply vcc_sdhi1_consumers[] = {
-- REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
--};
--
--static struct regulator_init_data vcc_sdhi1_init_data = {
-- .constraints = {
-- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
-- },
-- .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi1_consumers),
-- .consumer_supplies = vcc_sdhi1_consumers,
--};
--
--static struct fixed_voltage_config vcc_sdhi1_info = {
-- .supply_name = "SDHI1 Vcc",
-- .microvolts = 3300000,
-- .gpio = 16,
-- .enable_high = 1,
-- .init_data = &vcc_sdhi1_init_data,
--};
--
--static struct platform_device vcc_sdhi1 = {
-- .name = "reg-fixed-voltage",
-- .id = 2,
-- .dev = {
-- .platform_data = &vcc_sdhi1_info,
-- },
--};
--
--/* SDHI0 */
--static struct tmio_mmc_data sdhi0_info = {
-- .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
-- .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
-- .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
-- MMC_CAP_POWER_OFF_CARD,
-- .flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
-- .cd_gpio = 167,
--};
--
--static struct resource sdhi0_resources[] = {
-- {
-- .name = "SDHI0",
-- .start = 0xe6850000,
-- .end = 0xe6850100 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- /*
-- * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
-- */
-- {
-- .name = SH_MOBILE_SDHI_IRQ_SDCARD,
-- .start = gic_spi(118),
-- .flags = IORESOURCE_IRQ,
-- },
-- {
-- .name = SH_MOBILE_SDHI_IRQ_SDIO,
-- .start = gic_spi(119),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device sdhi0_device = {
-- .name = "sh_mobile_sdhi",
-- .id = 0,
-- .dev = {
-- .platform_data = &sdhi0_info,
-- },
-- .num_resources = ARRAY_SIZE(sdhi0_resources),
-- .resource = sdhi0_resources,
--};
--
--/* SDHI1 */
--static struct tmio_mmc_data sdhi1_info = {
-- .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI1_TX,
-- .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI1_RX,
-- .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
-- MMC_CAP_POWER_OFF_CARD,
-- .flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
-- /* Port72 cannot generate IRQs, will be used in polling mode. */
-- .cd_gpio = 72,
--};
--
--static struct resource sdhi1_resources[] = {
-- [0] = {
-- .name = "SDHI1",
-- .start = 0xe6860000,
-- .end = 0xe6860100 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(121),
-- .flags = IORESOURCE_IRQ,
-- },
-- [2] = {
-- .start = gic_spi(122),
-- .flags = IORESOURCE_IRQ,
-- },
-- [3] = {
-- .start = gic_spi(123),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device sdhi1_device = {
-- .name = "sh_mobile_sdhi",
-- .id = 1,
-- .dev = {
-- .platform_data = &sdhi1_info,
-- },
-- .num_resources = ARRAY_SIZE(sdhi1_resources),
-- .resource = sdhi1_resources,
--};
--
--static const struct pinctrl_map eva_sdhi1_pinctrl_map[] = {
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
-- "sdhi1_data4", "sdhi1"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
-- "sdhi1_ctrl", "sdhi1"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
-- "sdhi1_cd", "sdhi1"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
-- "sdhi1_wp", "sdhi1"),
--};
--
--/* MMCIF */
--static struct sh_mmcif_plat_data sh_mmcif_plat = {
-- .sup_pclk = 0,
-- .caps = MMC_CAP_4_BIT_DATA |
-- MMC_CAP_8_BIT_DATA |
-- MMC_CAP_NONREMOVABLE,
-- .ccs_unsupported = true,
-- .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
-- .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
--};
--
--static struct resource sh_mmcif_resources[] = {
-- [0] = {
-- .name = "MMCIF",
-- .start = 0xe6bd0000,
-- .end = 0xe6bd0100 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- /* MMC ERR */
-- .start = gic_spi(56),
-- .flags = IORESOURCE_IRQ,
-- },
-- [2] = {
-- /* MMC NOR */
-- .start = gic_spi(57),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device sh_mmcif_device = {
-- .name = "sh_mmcif",
-- .id = -1,
-- .dev = {
-- .platform_data = &sh_mmcif_plat,
-- },
-- .num_resources = ARRAY_SIZE(sh_mmcif_resources),
-- .resource = sh_mmcif_resources,
--};
--
--/* Camera */
--static int mt9t111_power(struct device *dev, int mode)
--{
-- struct clk *mclk = clk_get(NULL, "video1");
--
-- if (IS_ERR(mclk)) {
-- dev_err(dev, "can't get video1 clock\n");
-- return -EINVAL;
-- }
--
-- if (mode) {
-- /* video1 (= CON1 camera) expect 24MHz */
-- clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
-- clk_enable(mclk);
-- gpio_set_value(158, 1);
-- } else {
-- gpio_set_value(158, 0);
-- clk_disable(mclk);
-- }
--
-- clk_put(mclk);
--
-- return 0;
--}
--
--static struct i2c_board_info i2c_camera_mt9t111 = {
-- I2C_BOARD_INFO("mt9t112", 0x3d),
--};
--
--static struct mt9t112_camera_info mt9t111_info = {
-- .divider = { 16, 0, 0, 7, 0, 10, 14, 7, 7 },
--};
--
--static struct soc_camera_link mt9t111_link = {
-- .i2c_adapter_id = 0,
-- .bus_id = 0,
-- .board_info = &i2c_camera_mt9t111,
-- .power = mt9t111_power,
-- .priv = &mt9t111_info,
--};
--
--static struct platform_device camera_device = {
-- .name = "soc-camera-pdrv",
-- .id = 0,
-- .dev = {
-- .platform_data = &mt9t111_link,
-- },
--};
--
--/* CEU0 */
--static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
-- .flags = SH_CEU_FLAG_LOWER_8BIT,
--};
--
--static struct resource ceu0_resources[] = {
-- [0] = {
-- .name = "CEU",
-- .start = 0xfe910000,
-- .end = 0xfe91009f,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(160),
-- .flags = IORESOURCE_IRQ,
-- },
-- [2] = {
-- /* place holder for contiguous memory */
-- },
--};
--
--static struct platform_device ceu0_device = {
-- .name = "sh_mobile_ceu",
-- .id = 0,
-- .num_resources = ARRAY_SIZE(ceu0_resources),
-- .resource = ceu0_resources,
-- .dev = {
-- .platform_data = &sh_mobile_ceu0_info,
-- .coherent_dma_mask = 0xffffffff,
-- },
--};
--
--/* FSI */
--static struct sh_fsi_platform_info fsi_info = {
-- /* FSI-WM8978 */
-- .port_a = {
-- .tx_id = SHDMA_SLAVE_FSIA_TX,
-- },
-- /* FSI-HDMI */
-- .port_b = {
-- .flags = SH_FSI_FMT_SPDIF |
-- SH_FSI_ENABLE_STREAM_MODE |
-- SH_FSI_CLK_CPG,
-- .tx_id = SHDMA_SLAVE_FSIB_TX,
-- }
--};
--
--static struct resource fsi_resources[] = {
-- [0] = {
-- .name = "FSI",
-- .start = 0xfe1f0000,
-- .end = 0xfe1f0400 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(9),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device fsi_device = {
-- .name = "sh_fsi2",
-- .id = -1,
-- .num_resources = ARRAY_SIZE(fsi_resources),
-- .resource = fsi_resources,
-- .dev = {
-- .platform_data = &fsi_info,
-- },
--};
--
--/* FSI-WM8978 */
--static struct asoc_simple_card_info fsi_wm8978_info = {
-- .name = "wm8978",
-- .card = "FSI2A-WM8978",
-- .codec = "wm8978.0-001a",
-- .platform = "sh_fsi2",
-- .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
-- .cpu_dai = {
-- .name = "fsia-dai",
-- },
-- .codec_dai = {
-- .name = "wm8978-hifi",
-- .sysclk = 12288000,
-- },
--};
--
--static struct platform_device fsi_wm8978_device = {
-- .name = "asoc-simple-card",
-- .id = 0,
-- .dev = {
-- .platform_data = &fsi_wm8978_info,
-- .coherent_dma_mask = DMA_BIT_MASK(32),
-- .dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask,
-- },
--};
--
--/* FSI-HDMI */
--static struct asoc_simple_card_info fsi2_hdmi_info = {
-- .name = "HDMI",
-- .card = "FSI2B-HDMI",
-- .codec = "sh-mobile-hdmi",
-- .platform = "sh_fsi2",
-- .daifmt = SND_SOC_DAIFMT_CBS_CFS,
-- .cpu_dai = {
-- .name = "fsib-dai",
-- },
-- .codec_dai = {
-- .name = "sh_mobile_hdmi-hifi",
-- },
--};
--
--static struct platform_device fsi_hdmi_device = {
-- .name = "asoc-simple-card",
-- .id = 1,
-- .dev = {
-- .platform_data = &fsi2_hdmi_info,
-- .coherent_dma_mask = DMA_BIT_MASK(32),
-- .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
-- },
--};
--
--/* RTC: RTC connects i2c-gpio. */
--static struct i2c_gpio_platform_data i2c_gpio_data = {
-- .sda_pin = 208,
-- .scl_pin = 91,
-- .udelay = 5, /* 100 kHz */
--};
--
--static struct platform_device i2c_gpio_device = {
-- .name = "i2c-gpio",
-- .id = 2,
-- .dev = {
-- .platform_data = &i2c_gpio_data,
-- },
--};
--
--/* I2C */
--static struct st1232_pdata st1232_i2c0_pdata = {
-- .reset_gpio = 166,
--};
--
--static struct i2c_board_info i2c0_devices[] = {
-- {
-- I2C_BOARD_INFO("st1232-ts", 0x55),
-- .irq = irq_pin(10),
-- .platform_data = &st1232_i2c0_pdata,
-- },
-- {
-- I2C_BOARD_INFO("wm8978", 0x1a),
-- },
--};
--
--static struct i2c_board_info i2c2_devices[] = {
-- {
-- I2C_BOARD_INFO("s35390a", 0x30),
-- .type = "s35390a",
-- },
--};
--
--/*
-- * board devices
-- */
--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,
-- &vccq_sdhi0,
-- &sdhi0_device,
-- &sh_mmcif_device,
-- &hdmi_device,
-- &hdmi_lcdc_device,
-- &camera_device,
-- &ceu0_device,
-- &fsi_device,
-- &fsi_wm8978_device,
-- &fsi_hdmi_device,
-- &i2c_gpio_device,
--};
--
--static const struct pinctrl_map eva_pinctrl_map[] = {
-- /* CEU0 */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
-- "ceu0_data_0_7", "ceu0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
-- "ceu0_clk_0", "ceu0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
-- "ceu0_sync", "ceu0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
-- "ceu0_field", "ceu0"),
-- /* FSIA */
-- PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
-- "fsia_sclk_in", "fsia"),
-- PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
-- "fsia_mclk_out", "fsia"),
-- PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
-- "fsia_data_in_1", "fsia"),
-- PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
-- "fsia_data_out_0", "fsia"),
-- /* FSIB */
-- PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.1", "pfc-r8a7740",
-- "fsib_mclk_in", "fsib"),
-- /* GETHER */
-- PIN_MAP_MUX_GROUP_DEFAULT("r8a7740-gether", "pfc-r8a7740",
-- "gether_mii", "gether"),
-- PIN_MAP_MUX_GROUP_DEFAULT("r8a7740-gether", "pfc-r8a7740",
-- "gether_int", "gether"),
-- /* HDMI */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh-mobile-hdmi", "pfc-r8a7740",
-- "hdmi", "hdmi"),
-- /* LCD0 */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
-- "lcd0_data24_0", "lcd0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
-- "lcd0_lclk_1", "lcd0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
-- "lcd0_sync", "lcd0"),
-- /* MMCIF */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740",
-- "mmc0_data8_1", "mmc0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740",
-- "mmc0_ctrl_1", "mmc0"),
-- /* SCIFA1 */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.1", "pfc-r8a7740",
-- "scifa1_data", "scifa1"),
-- /* SDHI0 */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
-- "sdhi0_data4", "sdhi0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
-- "sdhi0_ctrl", "sdhi0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
-- "sdhi0_wp", "sdhi0"),
-- /* ST1232 */
-- PIN_MAP_MUX_GROUP_DEFAULT("0-0055", "pfc-r8a7740",
-- "intc_irq10", "intc"),
-- /* TPU0 */
-- PIN_MAP_MUX_GROUP_DEFAULT("renesas-tpu-pwm", "pfc-r8a7740",
-- "tpu0_to2_1", "tpu0"),
-- /* USBHS */
-- PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7740",
-- "intc_irq7_1", "intc"),
--};
--
--static void __init eva_clock_init(void)
--{
-- struct clk *system = clk_get(NULL, "system_clk");
-- struct clk *xtal1 = clk_get(NULL, "extal1");
-- struct clk *usb24s = clk_get(NULL, "usb24s");
-- struct clk *fsibck = clk_get(NULL, "fsibck");
--
-- if (IS_ERR(system) ||
-- IS_ERR(xtal1) ||
-- IS_ERR(usb24s) ||
-- IS_ERR(fsibck)) {
-- pr_err("armadillo800eva board clock init failed\n");
-- goto clock_error;
-- }
--
-- /* armadillo 800 eva extal1 is 24MHz */
-- clk_set_rate(xtal1, 24000000);
--
-- /* usb24s use extal1 (= system) clock (= 24MHz) */
-- clk_set_parent(usb24s, system);
--
-- /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
-- clk_set_rate(fsibck, 12288000);
--
--clock_error:
-- if (!IS_ERR(system))
-- clk_put(system);
-- if (!IS_ERR(xtal1))
-- clk_put(xtal1);
-- if (!IS_ERR(usb24s))
-- clk_put(usb24s);
-- if (!IS_ERR(fsibck))
-- clk_put(fsibck);
--}
--
--/*
-- * board init
-- */
--#define GPIO_PORT7CR IOMEM(0xe6050007)
--#define GPIO_PORT8CR IOMEM(0xe6050008)
--static void __init eva_init(void)
--{
-- static struct pm_domain_device domain_devices[] __initdata = {
-- { "A4LC", &lcdc0_device },
-- { "A4LC", &hdmi_lcdc_device },
-- { "A4MP", &hdmi_device },
-- { "A4MP", &fsi_device },
-- { "A4R", &ceu0_device },
-- { "A4S", &sh_eth_device },
-- { "A3SP", &pwm_device },
-- { "A3SP", &sdhi0_device },
-- { "A3SP", &sh_mmcif_device },
-- };
-- struct platform_device *usb = NULL, *sdhi1 = NULL;
--
-- regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
-- ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
-- regulator_register_always_on(3, "fixed-5.0V", fixed5v0_power_consumers,
-- ARRAY_SIZE(fixed5v0_power_consumers), 5000000);
--
-- pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
-- pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
--
-- r8a7740_pinmux_init();
-- r8a7740_meram_workaround();
--
-- /* GETHER */
-- gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */
--
-- /* USB */
-- gpio_request_one(159, GPIOF_IN, NULL); /* USB_DEVICE_MODE */
--
-- if (gpio_get_value(159)) {
-- /* USB Host */
-- } else {
-- /* USB Func */
-- /*
-- * The USBHS interrupt handlers needs to read the IRQ pin value
-- * (HI/LOW) to diffentiate USB connection and disconnection
-- * events (usbhsf_get_vbus()). We thus need to select both the
-- * intc_irq7_1 pin group and GPIO 209 here.
-- */
-- gpio_request_one(209, GPIOF_IN, NULL);
--
-- platform_device_register(&usbhsf_device);
-- usb = &usbhsf_device;
-- }
--
-- /* CON1/CON15 Camera */
-- gpio_request_one(173, GPIOF_OUT_INIT_LOW, NULL); /* STANDBY */
-- gpio_request_one(172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */
-- /* see mt9t111_power() */
-- gpio_request_one(158, GPIOF_OUT_INIT_LOW, NULL); /* CAM_PON */
--
-- /* FSI-WM8978 */
-- gpio_request(7, NULL);
-- gpio_request(8, NULL);
-- gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
-- gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
--
-- /*
-- * CAUTION
-- *
-- * DBGMD/LCDC0/FSIA MUX
-- * DBGMD_SELECT_B should be set after setting PFC Function.
-- */
-- gpio_request_one(176, GPIOF_OUT_INIT_HIGH, NULL);
--
-- /*
-- * We can switch CON8/CON14 by SW1.5,
-- * but it needs after DBGMD_SELECT_B
-- */
-- gpio_request_one(6, GPIOF_IN, NULL);
-- if (gpio_get_value(6)) {
-- /* CON14 enable */
-- } else {
-- /* CON8 (SDHI1) enable */
-- pinctrl_register_mappings(eva_sdhi1_pinctrl_map,
-- ARRAY_SIZE(eva_sdhi1_pinctrl_map));
--
-- platform_device_register(&vcc_sdhi1);
-- platform_device_register(&sdhi1_device);
-- sdhi1 = &sdhi1_device;
-- }
--
--
--#ifdef CONFIG_CACHE_L2X0
-- /* Shared attribute override enable, 32K*8way */
-- l2x0_init(IOMEM(0xf0002000), 0x00400000, 0xc20f0fff);
--#endif
--
-- i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
-- i2c_register_board_info(2, i2c2_devices, ARRAY_SIZE(i2c2_devices));
--
-- r8a7740_add_standard_devices();
--
-- platform_add_devices(eva_devices,
-- ARRAY_SIZE(eva_devices));
--
-- rmobile_add_devices_to_domains(domain_devices,
-- ARRAY_SIZE(domain_devices));
-- if (usb)
-- rmobile_add_device_to_domain("A3SP", usb);
-- if (sdhi1)
-- rmobile_add_device_to_domain("A3SP", sdhi1);
--
-- r8a7740_pm_init();
--}
--
--static void __init eva_earlytimer_init(void)
--{
-- r8a7740_clock_init(MD_CK0 | MD_CK2);
-- shmobile_earlytimer_init();
--
-- /* the rate of extal1 clock must be set before late_time_init */
-- eva_clock_init();
--}
--
--#define RESCNT2 IOMEM(0xe6188020)
--static void eva_restart(enum reboot_mode mode, const char *cmd)
--{
-- /* Do soft power on reset */
-- writel((1 << 31), RESCNT2);
--}
--
--static const char *eva_boards_compat_dt[] __initdata = {
-- "renesas,armadillo800eva",
-- NULL,
--};
--
--DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
-- .map_io = r8a7740_map_io,
-- .init_early = r8a7740_add_early_devices,
-- .init_irq = r8a7740_init_irq_of,
-- .init_machine = eva_init,
-- .init_late = shmobile_init_late,
-- .init_time = eva_earlytimer_init,
-- .dt_compat = eva_boards_compat_dt,
-- .restart = eva_restart,
--MACHINE_END
---
-2.6.2
-
diff --git a/patches.renesas/0151-ARM-shmobile-Remove-legacy-armadillo800eva_defconfig.patch b/patches.renesas/0151-ARM-shmobile-Remove-legacy-armadillo800eva_defconfig.patch
deleted file mode 100644
index 32be4b1c664de8..00000000000000
--- a/patches.renesas/0151-ARM-shmobile-Remove-legacy-armadillo800eva_defconfig.patch
+++ /dev/null
@@ -1,201 +0,0 @@
-From e0fce73651e512a9d208ef0c044679dc63d230ad Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:22 +0200
-Subject: [PATCH 151/326] ARM: shmobile: Remove legacy
- armadillo800eva_defconfig
-
-The legacy board code for Armadillo-800 EVA has been removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 4e7115ad44d544847a294d7d634f5974e344708e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- MAINTAINERS | 1 -
- arch/arm/configs/armadillo800eva_defconfig | 162 -----------------------------
- 2 files changed, 163 deletions(-)
- delete mode 100644 arch/arm/configs/armadillo800eva_defconfig
-
-diff --git a/MAINTAINERS b/MAINTAINERS
-index 77edd4bec210..b4d93bf4be0c 100644
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -1440,7 +1440,6 @@ F: arch/arm/boot/dts/emev2*
- F: arch/arm/boot/dts/r7s*
- F: arch/arm/boot/dts/r8a*
- F: arch/arm/boot/dts/sh*
--F: arch/arm/configs/armadillo800eva_defconfig
- F: arch/arm/configs/bockw_defconfig
- F: arch/arm/configs/marzen_defconfig
- F: arch/arm/configs/shmobile_defconfig
-diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
-deleted file mode 100644
-index 5666e3700a82..000000000000
---- a/arch/arm/configs/armadillo800eva_defconfig
-+++ /dev/null
-@@ -1,162 +0,0 @@
--CONFIG_EXPERIMENTAL=y
--CONFIG_SYSVIPC=y
--CONFIG_IKCONFIG=y
--CONFIG_IKCONFIG_PROC=y
--CONFIG_LOG_BUF_SHIFT=16
--# CONFIG_UTS_NS is not set
--# CONFIG_IPC_NS is not set
--# CONFIG_PID_NS is not set
--CONFIG_CC_OPTIMIZE_FOR_SIZE=y
--CONFIG_PERF_EVENTS=y
--CONFIG_SLAB=y
--CONFIG_MODULES=y
--CONFIG_MODULE_UNLOAD=y
--CONFIG_MODULE_FORCE_UNLOAD=y
--# 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_R8A7740=y
--CONFIG_MACH_ARMADILLO800EVA=y
--# CONFIG_SH_TIMER_TMU is not set
--CONFIG_ARM_THUMB=y
--CONFIG_CACHE_L2X0=y
--CONFIG_ARM_ERRATA_430973=y
--CONFIG_ARM_ERRATA_458693=y
--CONFIG_ARM_ERRATA_460075=y
--CONFIG_PL310_ERRATA_588369=y
--CONFIG_ARM_ERRATA_720789=y
--CONFIG_PL310_ERRATA_727915=y
--CONFIG_ARM_ERRATA_743622=y
--CONFIG_ARM_ERRATA_751472=y
--CONFIG_PL310_ERRATA_753970=y
--CONFIG_ARM_ERRATA_754322=y
--CONFIG_PL310_ERRATA_769419=y
--CONFIG_ARM_ERRATA_775420=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_VFP=y
--CONFIG_NEON=y
--# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
--CONFIG_PM=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_SCSI=y
--CONFIG_BLK_DEV_SD=y
--CONFIG_MD=y
--CONFIG_BLK_DEV_DM=y
--CONFIG_NETDEVICES=y
--# CONFIG_NET_VENDOR_BROADCOM is not set
--# CONFIG_NET_VENDOR_CHELSIO 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_WLAN is not set
--# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
--CONFIG_INPUT_EVDEV=y
--# CONFIG_KEYBOARD_ATKBD is not set
--CONFIG_KEYBOARD_GPIO=y
--# CONFIG_INPUT_MOUSE is not set
--CONFIG_INPUT_TOUCHSCREEN=y
--CONFIG_TOUCHSCREEN_ST1232=y
--# CONFIG_SERIO is not set
--# CONFIG_LEGACY_PTYS is not set
--CONFIG_SERIAL_SH_SCI=y
--CONFIG_SERIAL_SH_SCI_NR_UARTS=9
--CONFIG_SERIAL_SH_SCI_CONSOLE=y
--# CONFIG_HW_RANDOM is not set
--CONFIG_I2C=y
--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
--CONFIG_V4L_PLATFORM_DRIVERS=y
--CONFIG_SOC_CAMERA=y
--CONFIG_SOC_CAMERA_MT9T112=y
--CONFIG_VIDEO_SH_MOBILE_CEU=y
--CONFIG_FB=y
--CONFIG_FB_SH_MOBILE_LCDC=y
--CONFIG_FB_SH_MOBILE_HDMI=y
--CONFIG_LCD_CLASS_DEVICE=y
--CONFIG_BACKLIGHT_PWM=y
--CONFIG_FRAMEBUFFER_CONSOLE=y
--CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
--CONFIG_LOGO=y
--# CONFIG_LOGO_LINUX_MONO is not set
--# CONFIG_LOGO_LINUX_VGA16 is not set
--# CONFIG_SND_SUPPORT_OLD_API is not set
--# CONFIG_SND_VERBOSE_PROCFS is not set
--# CONFIG_SND_DRIVERS is not set
--# CONFIG_SND_ARM is not set
--CONFIG_SND_SOC_SH4_FSI=y
--# CONFIG_HID_SUPPORT is not set
--CONFIG_USB=y
--CONFIG_USB_RENESAS_USBHS=y
--CONFIG_USB_GADGET=y
--CONFIG_USB_RENESAS_USBHS_UDC=y
--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
--CONFIG_SH_DMAE=y
--CONFIG_UIO=y
--CONFIG_UIO_PDRV_GENIRQ=y
--CONFIG_PWM=y
--CONFIG_PWM_RENESAS_TPU=y
--# CONFIG_DNOTIFY is not set
--CONFIG_MSDOS_FS=y
--CONFIG_VFAT_FS=y
--CONFIG_TMPFS=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=y
--CONFIG_CRYPTO_CBC=y
--CONFIG_CRYPTO_MD5=y
--CONFIG_CRYPTO_DES=y
--CONFIG_CRYPTO_ANSI_CPRNG=y
--CONFIG_XZ_DEC=y
---
-2.6.2
-
diff --git a/patches.renesas/0152-ARM-shmobile-Drop-r8a7740-armadillo800eva.dtb-for-le.patch b/patches.renesas/0152-ARM-shmobile-Drop-r8a7740-armadillo800eva.dtb-for-le.patch
deleted file mode 100644
index fd7f44cfbd2f8e..00000000000000
--- a/patches.renesas/0152-ARM-shmobile-Drop-r8a7740-armadillo800eva.dtb-for-le.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 923f28e7866e4019f8a3a79ab1e61a8ba64a4648 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:23 +0200
-Subject: [PATCH 152/326] ARM: shmobile: Drop r8a7740-armadillo800eva.dtb for
- legacy builds
-
-The legacy board code for Armadillo-800 EVA has been removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 6a902a2ea1ffe432ce46bb562b9dcae8f396b3b4)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/Makefile | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
-index b7b3f0fbb25b..e13fff1bfa97 100644
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -477,7 +477,6 @@ dtb-$(CONFIG_ARCH_S5PV210) += \
- s5pv210-smdkv210.dtb \
- s5pv210-torbreck.dtb
- dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += \
-- r8a7740-armadillo800eva.dtb \
- r8a7778-bockw.dtb \
- r8a7778-bockw-reference.dtb \
- r8a7779-marzen.dtb
---
-2.6.2
-
diff --git a/patches.renesas/0153-ARM-shmobile-Remove-legacy-SoC-code-for-R-Mobile-A1.patch b/patches.renesas/0153-ARM-shmobile-Remove-legacy-SoC-code-for-R-Mobile-A1.patch
deleted file mode 100644
index b67182fe7a1f6c..00000000000000
--- a/patches.renesas/0153-ARM-shmobile-Remove-legacy-SoC-code-for-R-Mobile-A1.patch
+++ /dev/null
@@ -1,1686 +0,0 @@
-From 0ba1c1fe1858630b03accdc129869466a604fe16 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:24 +0200
-Subject: [PATCH 153/326] ARM: shmobile: Remove legacy SoC code for R-Mobile A1
-
-The last user of the R-Mobile A1 (r8a7740) legacy SoC code was the
-Armadillo-800 EVA legacy board code, which has been removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-[horms: resolved trivial conflicts with v4.2-rc1]
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-
-(cherry picked from commit 44d88c754e57a6d9d7ae6ac7540b9596f9b61902)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/Kconfig | 7 -
- arch/arm/mach-shmobile/Makefile | 3 +-
- arch/arm/mach-shmobile/clock-r8a7740.c | 675 --------------------------------
- arch/arm/mach-shmobile/pm-r8a7740.c | 129 -------
- arch/arm/mach-shmobile/r8a7740.h | 58 ---
- arch/arm/mach-shmobile/setup-r8a7740.c | 678 +--------------------------------
- 6 files changed, 4 insertions(+), 1546 deletions(-)
- delete mode 100644 arch/arm/mach-shmobile/clock-r8a7740.c
- delete mode 100644 arch/arm/mach-shmobile/pm-r8a7740.c
- delete mode 100644 arch/arm/mach-shmobile/r8a7740.h
-
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index 9e916fafc77d..9725f442d566 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -105,13 +105,6 @@ if ARCH_SHMOBILE_LEGACY
-
- comment "Renesas ARM SoCs System Type"
-
--config ARCH_R8A7740
-- bool "R-Mobile A1 (R8A77400)"
-- select ARCH_RMOBILE
-- select ARCH_WANT_OPTIONAL_GPIOLIB
-- select ARM_GIC
-- select RENESAS_INTC_IRQPIN
--
- config ARCH_R8A7778
- bool "R-Car M1A (R8A77781)"
- select ARCH_RCAR_GEN1
-diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
-index 548536fcb3b1..726c219e5b13 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -8,7 +8,7 @@ obj-y := timer.o console.o
- # CPU objects
- obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o
- obj-$(CONFIG_ARCH_R8A73A4) += setup-r8a73a4.o
--obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o pm-r8a7740.o
-+obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o
- obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
- obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o
- obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o
-@@ -20,7 +20,6 @@ obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
- # Clock objects
- ifndef CONFIG_COMMON_CLK
- obj-y += clock.o
--obj-$(CONFIG_ARCH_R8A7740) += clock-r8a7740.o
- obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o
- obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
- endif
-diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
-deleted file mode 100644
-index 9cac8247c72b..000000000000
---- a/arch/arm/mach-shmobile/clock-r8a7740.c
-+++ /dev/null
-@@ -1,675 +0,0 @@
--/*
-- * R8A7740 processor support
-- *
-- * Copyright (C) 2011 Renesas Solutions Corp.
-- * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License
-- *
-- * 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/init.h>
--#include <linux/kernel.h>
--#include <linux/io.h>
--#include <linux/sh_clk.h>
--#include <linux/clkdev.h>
--
--#include "clock.h"
--#include "common.h"
--#include "r8a7740.h"
--
--/*
-- * | MDx | XTAL1/EXTAL1 | System | EXTALR |
-- * Clock |-------+-----------------+ clock | 32.768 | RCLK
-- * Mode | 2/1/0 | src MHz | source | KHz | source
-- * -------+-------+-----------------+-----------+--------+----------
-- * 0 | 0 0 0 | External 20~50 | XTAL1 | O | EXTALR
-- * 1 | 0 0 1 | Crystal 20~30 | XTAL1 | O | EXTALR
-- * 2 | 0 1 0 | External 40~50 | XTAL1 / 2 | O | EXTALR
-- * 3 | 0 1 1 | Crystal 40~50 | XTAL1 / 2 | O | EXTALR
-- * 4 | 1 0 0 | External 20~50 | XTAL1 | x | XTAL1 / 1024
-- * 5 | 1 0 1 | Crystal 20~30 | XTAL1 | x | XTAL1 / 1024
-- * 6 | 1 1 0 | External 40~50 | XTAL1 / 2 | x | XTAL1 / 2048
-- * 7 | 1 1 1 | Crystal 40~50 | XTAL1 / 2 | x | XTAL1 / 2048
-- */
--
--/* CPG registers */
--#define FRQCRA IOMEM(0xe6150000)
--#define FRQCRB IOMEM(0xe6150004)
--#define VCLKCR1 IOMEM(0xE6150008)
--#define VCLKCR2 IOMEM(0xE615000c)
--#define FRQCRC IOMEM(0xe61500e0)
--#define FSIACKCR IOMEM(0xe6150018)
--#define PLLC01CR IOMEM(0xe6150028)
--
--#define SUBCKCR IOMEM(0xe6150080)
--#define USBCKCR IOMEM(0xe615008c)
--
--#define MSTPSR0 IOMEM(0xe6150030)
--#define MSTPSR1 IOMEM(0xe6150038)
--#define MSTPSR2 IOMEM(0xe6150040)
--#define MSTPSR3 IOMEM(0xe6150048)
--#define MSTPSR4 IOMEM(0xe615004c)
--#define FSIBCKCR IOMEM(0xe6150090)
--#define HDMICKCR IOMEM(0xe6150094)
--#define SMSTPCR0 IOMEM(0xe6150130)
--#define SMSTPCR1 IOMEM(0xe6150134)
--#define SMSTPCR2 IOMEM(0xe6150138)
--#define SMSTPCR3 IOMEM(0xe615013c)
--#define SMSTPCR4 IOMEM(0xe6150140)
--
--#define FSIDIVA IOMEM(0xFE1F8000)
--#define FSIDIVB IOMEM(0xFE1F8008)
--
--/* Fixed 32 KHz root clock from EXTALR pin */
--static struct clk extalr_clk = {
-- .rate = 32768,
--};
--
--/*
-- * 25MHz default rate for the EXTAL1 root input clock.
-- * If needed, reset this with clk_set_rate() from the platform code.
-- */
--static struct clk extal1_clk = {
-- .rate = 25000000,
--};
--
--/*
-- * 48MHz default rate for the EXTAL2 root input clock.
-- * If needed, reset this with clk_set_rate() from the platform code.
-- */
--static struct clk extal2_clk = {
-- .rate = 48000000,
--};
--
--/*
-- * 27MHz default rate for the DV_CLKI root input clock.
-- * If needed, reset this with clk_set_rate() from the platform code.
-- */
--static struct clk dv_clk = {
-- .rate = 27000000,
--};
--
--SH_CLK_RATIO(div2, 1, 2);
--SH_CLK_RATIO(div1k, 1, 1024);
--
--SH_FIXED_RATIO_CLK(extal1_div2_clk, extal1_clk, div2);
--SH_FIXED_RATIO_CLK(extal1_div1024_clk, extal1_clk, div1k);
--SH_FIXED_RATIO_CLK(extal1_div2048_clk, extal1_div2_clk, div1k);
--SH_FIXED_RATIO_CLK(extal2_div2_clk, extal2_clk, div2);
--
--static struct sh_clk_ops followparent_clk_ops = {
-- .recalc = followparent_recalc,
--};
--
--/* Main clock */
--static struct clk system_clk = {
-- .ops = &followparent_clk_ops,
--};
--
--SH_FIXED_RATIO_CLK(system_div2_clk, system_clk, div2);
--
--/* r_clk */
--static struct clk r_clk = {
-- .ops = &followparent_clk_ops,
--};
--
--/* PLLC0/PLLC1 */
--static unsigned long pllc01_recalc(struct clk *clk)
--{
-- unsigned long mult = 1;
--
-- if (__raw_readl(PLLC01CR) & (1 << 14))
-- mult = ((__raw_readl(clk->enable_reg) >> 24) & 0x7f) + 1;
--
-- return clk->parent->rate * mult;
--}
--
--static struct sh_clk_ops pllc01_clk_ops = {
-- .recalc = pllc01_recalc,
--};
--
--static struct clk pllc0_clk = {
-- .ops = &pllc01_clk_ops,
-- .flags = CLK_ENABLE_ON_INIT,
-- .parent = &system_clk,
-- .enable_reg = (void __iomem *)FRQCRC,
--};
--
--static struct clk pllc1_clk = {
-- .ops = &pllc01_clk_ops,
-- .flags = CLK_ENABLE_ON_INIT,
-- .parent = &system_div2_clk,
-- .enable_reg = (void __iomem *)FRQCRA,
--};
--
--/* PLLC1 / 2 */
--SH_FIXED_RATIO_CLK(pllc1_div2_clk, pllc1_clk, div2);
--
--/* USB clock */
--/*
-- * USBCKCR is controlling usb24 clock
-- * bit[7] : parent clock
-- * bit[6] : clock divide rate
-- * And this bit[7] is used as a "usb24s" from other devices.
-- * (Video clock / Sub clock / SPU clock)
-- * You can controll this clock as a below.
-- *
-- * struct clk *usb24 = clk_get(dev, "usb24");
-- * struct clk *usb24s = clk_get(NULL, "usb24s");
-- * struct clk *system = clk_get(NULL, "system_clk");
-- * int rate = clk_get_rate(system);
-- *
-- * clk_set_parent(usb24s, system); // for bit[7]
-- * clk_set_rate(usb24, rate / 2); // for bit[6]
-- */
--static struct clk *usb24s_parents[] = {
-- [0] = &system_clk,
-- [1] = &extal2_clk
--};
--
--static int usb24s_enable(struct clk *clk)
--{
-- __raw_writel(__raw_readl(USBCKCR) & ~(1 << 8), USBCKCR);
--
-- return 0;
--}
--
--static void usb24s_disable(struct clk *clk)
--{
-- __raw_writel(__raw_readl(USBCKCR) | (1 << 8), USBCKCR);
--}
--
--static int usb24s_set_parent(struct clk *clk, struct clk *parent)
--{
-- int i, ret;
-- u32 val;
--
-- if (!clk->parent_table || !clk->parent_num)
-- return -EINVAL;
--
-- /* Search the parent */
-- for (i = 0; i < clk->parent_num; i++)
-- if (clk->parent_table[i] == parent)
-- break;
--
-- if (i == clk->parent_num)
-- return -ENODEV;
--
-- ret = clk_reparent(clk, parent);
-- if (ret < 0)
-- return ret;
--
-- val = __raw_readl(USBCKCR);
-- val &= ~(1 << 7);
-- val |= i << 7;
-- __raw_writel(val, USBCKCR);
--
-- return 0;
--}
--
--static struct sh_clk_ops usb24s_clk_ops = {
-- .recalc = followparent_recalc,
-- .enable = usb24s_enable,
-- .disable = usb24s_disable,
-- .set_parent = usb24s_set_parent,
--};
--
--static struct clk usb24s_clk = {
-- .ops = &usb24s_clk_ops,
-- .parent_table = usb24s_parents,
-- .parent_num = ARRAY_SIZE(usb24s_parents),
-- .parent = &system_clk,
--};
--
--static unsigned long usb24_recalc(struct clk *clk)
--{
-- return clk->parent->rate /
-- ((__raw_readl(USBCKCR) & (1 << 6)) ? 1 : 2);
--};
--
--static int usb24_set_rate(struct clk *clk, unsigned long rate)
--{
-- u32 val;
--
-- /* closer to which ? parent->rate or parent->rate/2 */
-- val = __raw_readl(USBCKCR);
-- val &= ~(1 << 6);
-- val |= (rate > (clk->parent->rate / 4) * 3) << 6;
-- __raw_writel(val, USBCKCR);
--
-- return 0;
--}
--
--static struct sh_clk_ops usb24_clk_ops = {
-- .recalc = usb24_recalc,
-- .set_rate = usb24_set_rate,
--};
--
--static struct clk usb24_clk = {
-- .ops = &usb24_clk_ops,
-- .parent = &usb24s_clk,
--};
--
--/* External FSIACK/FSIBCK clock */
--static struct clk fsiack_clk = {
--};
--
--static struct clk fsibck_clk = {
--};
--
--static struct clk *main_clks[] = {
-- &extalr_clk,
-- &extal1_clk,
-- &extal2_clk,
-- &extal1_div2_clk,
-- &extal1_div1024_clk,
-- &extal1_div2048_clk,
-- &extal2_div2_clk,
-- &dv_clk,
-- &system_clk,
-- &system_div2_clk,
-- &r_clk,
-- &pllc0_clk,
-- &pllc1_clk,
-- &pllc1_div2_clk,
-- &usb24s_clk,
-- &usb24_clk,
-- &fsiack_clk,
-- &fsibck_clk,
--};
--
--/* DIV4 clocks */
--static void div4_kick(struct clk *clk)
--{
-- unsigned long value;
--
-- /* set KICK bit in FRQCRB to update hardware setting */
-- value = __raw_readl(FRQCRB);
-- value |= (1 << 31);
-- __raw_writel(value, FRQCRB);
--}
--
--static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18,
-- 24, 32, 36, 48, 0, 72, 96, 0 };
--
--static struct clk_div_mult_table div4_div_mult_table = {
-- .divisors = divisors,
-- .nr_divisors = ARRAY_SIZE(divisors),
--};
--
--static struct clk_div4_table div4_table = {
-- .div_mult_table = &div4_div_mult_table,
-- .kick = div4_kick,
--};
--
--enum {
-- DIV4_I, DIV4_ZG, DIV4_B, DIV4_M1, DIV4_HP,
-- DIV4_HPP, DIV4_USBP, DIV4_S, DIV4_ZB, DIV4_M3, DIV4_CP,
-- DIV4_NR
--};
--
--static struct clk div4_clks[DIV4_NR] = {
-- [DIV4_I] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 20, 0x6fff, CLK_ENABLE_ON_INIT),
-- [DIV4_ZG] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 16, 0x6fff, CLK_ENABLE_ON_INIT),
-- [DIV4_B] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 8, 0x6fff, CLK_ENABLE_ON_INIT),
-- [DIV4_M1] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 4, 0x6fff, CLK_ENABLE_ON_INIT),
-- [DIV4_HP] = SH_CLK_DIV4(&pllc1_clk, FRQCRB, 4, 0x6fff, 0),
-- [DIV4_HPP] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 20, 0x6fff, 0),
-- [DIV4_USBP] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 16, 0x6fff, 0),
-- [DIV4_S] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 12, 0x6fff, 0),
-- [DIV4_ZB] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 8, 0x6fff, 0),
-- [DIV4_M3] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 4, 0x6fff, 0),
-- [DIV4_CP] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 0, 0x6fff, 0),
--};
--
--/* DIV6 reparent */
--enum {
-- DIV6_HDMI,
-- DIV6_VCLK1, DIV6_VCLK2,
-- DIV6_FSIA, DIV6_FSIB,
-- DIV6_REPARENT_NR,
--};
--
--static struct clk *hdmi_parent[] = {
-- [0] = &pllc1_div2_clk,
-- [1] = &system_clk,
-- [2] = &dv_clk
--};
--
--static struct clk *vclk_parents[8] = {
-- [0] = &pllc1_div2_clk,
-- [2] = &dv_clk,
-- [3] = &usb24s_clk,
-- [4] = &extal1_div2_clk,
-- [5] = &extalr_clk,
--};
--
--static struct clk *fsia_parents[] = {
-- [0] = &pllc1_div2_clk,
-- [1] = &fsiack_clk, /* external clock */
--};
--
--static struct clk *fsib_parents[] = {
-- [0] = &pllc1_div2_clk,
-- [1] = &fsibck_clk, /* external clock */
--};
--
--static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
-- [DIV6_HDMI] = SH_CLK_DIV6_EXT(HDMICKCR, 0,
-- hdmi_parent, ARRAY_SIZE(hdmi_parent), 6, 2),
-- [DIV6_VCLK1] = SH_CLK_DIV6_EXT(VCLKCR1, 0,
-- vclk_parents, ARRAY_SIZE(vclk_parents), 12, 3),
-- [DIV6_VCLK2] = SH_CLK_DIV6_EXT(VCLKCR2, 0,
-- vclk_parents, ARRAY_SIZE(vclk_parents), 12, 3),
-- [DIV6_FSIA] = SH_CLK_DIV6_EXT(FSIACKCR, 0,
-- fsia_parents, ARRAY_SIZE(fsia_parents), 6, 2),
-- [DIV6_FSIB] = SH_CLK_DIV6_EXT(FSIBCKCR, 0,
-- fsib_parents, ARRAY_SIZE(fsib_parents), 6, 2),
--};
--
--/* DIV6 clocks */
--enum {
-- DIV6_SUB,
-- DIV6_NR
--};
--
--static struct clk div6_clks[DIV6_NR] = {
-- [DIV6_SUB] = SH_CLK_DIV6(&pllc1_div2_clk, SUBCKCR, 0),
--};
--
--/* HDMI1/2 clock */
--static unsigned long hdmi12_recalc(struct clk *clk)
--{
-- u32 val = __raw_readl(HDMICKCR);
-- int shift = (int)clk->priv;
--
-- val >>= shift;
-- val &= 0x3;
--
-- return clk->parent->rate / (1 << val);
--};
--
--static int hdmi12_set_rate(struct clk *clk, unsigned long rate)
--{
-- u32 val, mask;
-- int i, shift;
--
-- for (i = 0; i < 3; i++)
-- if (rate == clk->parent->rate / (1 << i))
-- goto find;
-- return -ENODEV;
--
--find:
-- shift = (int)clk->priv;
--
-- val = __raw_readl(HDMICKCR);
-- mask = ~(0x3 << shift);
-- val = (val & mask) | i << shift;
-- __raw_writel(val, HDMICKCR);
--
-- return 0;
--};
--
--static struct sh_clk_ops hdmi12_clk_ops = {
-- .recalc = hdmi12_recalc,
-- .set_rate = hdmi12_set_rate,
--};
--
--static struct clk hdmi1_clk = {
-- .ops = &hdmi12_clk_ops,
-- .priv = (void *)9,
-- .parent = &div6_reparent_clks[DIV6_HDMI], /* late install */
--};
--
--static struct clk hdmi2_clk = {
-- .ops = &hdmi12_clk_ops,
-- .priv = (void *)11,
-- .parent = &div6_reparent_clks[DIV6_HDMI], /* late install */
--};
--
--static struct clk *late_main_clks[] = {
-- &hdmi1_clk,
-- &hdmi2_clk,
--};
--
--/* FSI DIV */
--enum { FSIDIV_A, FSIDIV_B, FSIDIV_REPARENT_NR };
--
--static struct clk fsidivs[] = {
-- [FSIDIV_A] = SH_CLK_FSIDIV(FSIDIVA, &div6_reparent_clks[DIV6_FSIA]),
-- [FSIDIV_B] = SH_CLK_FSIDIV(FSIDIVB, &div6_reparent_clks[DIV6_FSIB]),
--};
--
--/* MSTP */
--enum {
-- MSTP128, MSTP127, MSTP125,
-- MSTP116, MSTP111, MSTP100, MSTP117,
--
-- MSTP230, MSTP229,
-- MSTP222,
-- MSTP218, MSTP217, MSTP216, MSTP214,
-- MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
--
-- MSTP329, MSTP328, MSTP323, MSTP320,
-- MSTP314, MSTP313, MSTP312,
-- MSTP309, MSTP304,
--
-- MSTP416, MSTP415, MSTP407, MSTP406,
--
-- MSTP_NR
--};
--
--static struct clk mstp_clks[MSTP_NR] = {
-- [MSTP128] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 28, 0), /* CEU21 */
-- [MSTP127] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 27, 0), /* CEU20 */
-- [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
-- [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */
-- [MSTP116] = SH_CLK_MSTP32(&div4_clks[DIV4_HPP], SMSTPCR1, 16, 0), /* IIC0 */
-- [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */
-- [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
--
-- [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */
-- [MSTP229] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 29, 0), /* INTCA */
-- [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */
-- [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */
-- [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */
-- [MSTP216] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 16, 0), /* DMAC3 */
-- [MSTP214] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 14, 0), /* USBDMAC */
-- [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */
-- [MSTP206] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */
-- [MSTP204] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */
-- [MSTP203] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 3, 0), /* SCIFA1 */
-- [MSTP202] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 2, 0), /* SCIFA2 */
-- [MSTP201] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */
-- [MSTP200] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */
--
-- [MSTP329] = SH_CLK_MSTP32(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
-- [MSTP328] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 28, 0), /* FSI */
-- [MSTP323] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */
-- [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 20, 0), /* USBF */
-- [MSTP314] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */
-- [MSTP313] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */
-- [MSTP312] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */
-- [MSTP309] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 9, 0), /* GEther */
-- [MSTP304] = SH_CLK_MSTP32(&div4_clks[DIV4_CP], SMSTPCR3, 4, 0), /* TPU0 */
--
-- [MSTP416] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 16, 0), /* USBHOST */
-- [MSTP415] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 15, 0), /* SDHI2 */
-- [MSTP407] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 7, 0), /* USB-Func */
-- [MSTP406] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 6, 0), /* USB Phy */
--};
--
--static struct clk_lookup lookups[] = {
-- /* main clocks */
-- CLKDEV_CON_ID("extalr", &extalr_clk),
-- CLKDEV_CON_ID("extal1", &extal1_clk),
-- CLKDEV_CON_ID("extal2", &extal2_clk),
-- CLKDEV_CON_ID("extal1_div2", &extal1_div2_clk),
-- CLKDEV_CON_ID("extal1_div1024", &extal1_div1024_clk),
-- CLKDEV_CON_ID("extal1_div2048", &extal1_div2048_clk),
-- CLKDEV_CON_ID("extal2_div2", &extal2_div2_clk),
-- CLKDEV_CON_ID("dv_clk", &dv_clk),
-- CLKDEV_CON_ID("system_clk", &system_clk),
-- CLKDEV_CON_ID("system_div2_clk", &system_div2_clk),
-- CLKDEV_CON_ID("r_clk", &r_clk),
-- CLKDEV_CON_ID("pllc0_clk", &pllc0_clk),
-- CLKDEV_CON_ID("pllc1_clk", &pllc1_clk),
-- CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk),
-- CLKDEV_CON_ID("usb24s", &usb24s_clk),
-- CLKDEV_CON_ID("hdmi1", &hdmi1_clk),
-- CLKDEV_CON_ID("hdmi2", &hdmi2_clk),
-- CLKDEV_CON_ID("video1", &div6_reparent_clks[DIV6_VCLK1]),
-- CLKDEV_CON_ID("video2", &div6_reparent_clks[DIV6_VCLK2]),
-- CLKDEV_CON_ID("fsiack", &fsiack_clk),
-- CLKDEV_CON_ID("fsibck", &fsibck_clk),
--
-- /* DIV4 clocks */
-- CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]),
-- CLKDEV_CON_ID("zg_clk", &div4_clks[DIV4_ZG]),
-- CLKDEV_CON_ID("b_clk", &div4_clks[DIV4_B]),
-- CLKDEV_CON_ID("m1_clk", &div4_clks[DIV4_M1]),
-- CLKDEV_CON_ID("hp_clk", &div4_clks[DIV4_HP]),
-- CLKDEV_CON_ID("hpp_clk", &div4_clks[DIV4_HPP]),
-- CLKDEV_CON_ID("s_clk", &div4_clks[DIV4_S]),
-- CLKDEV_CON_ID("zb_clk", &div4_clks[DIV4_ZB]),
-- CLKDEV_CON_ID("m3_clk", &div4_clks[DIV4_M3]),
-- CLKDEV_CON_ID("cp_clk", &div4_clks[DIV4_CP]),
--
-- /* DIV6 clocks */
-- CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]),
--
-- /* MSTP32 clocks */
-- CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]),
-- CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]),
-- CLKDEV_DEV_ID("fff20000.i2c", &mstp_clks[MSTP116]),
-- CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]),
-- CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]),
-- CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]),
--
-- CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),
-- CLKDEV_DEV_ID("e6c80000.serial", &mstp_clks[MSTP200]),
-- CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]),
-- CLKDEV_DEV_ID("e6c70000.serial", &mstp_clks[MSTP201]),
-- CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]),
-- CLKDEV_DEV_ID("e6c60000.serial", &mstp_clks[MSTP202]),
-- CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
-- CLKDEV_DEV_ID("e6c50000.serial", &mstp_clks[MSTP203]),
-- CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
-- CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]),
-- CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]),
-- CLKDEV_DEV_ID("e6c30000.serial", &mstp_clks[MSTP206]),
-- CLKDEV_DEV_ID("sh-sci.5", &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.serial", &mstp_clks[MSTP222]),
-- CLKDEV_DEV_ID("renesas_intc_irqpin.0", &mstp_clks[MSTP229]),
-- CLKDEV_DEV_ID("renesas_intc_irqpin.1", &mstp_clks[MSTP229]),
-- CLKDEV_DEV_ID("renesas_intc_irqpin.2", &mstp_clks[MSTP229]),
-- CLKDEV_DEV_ID("renesas_intc_irqpin.3", &mstp_clks[MSTP229]),
-- CLKDEV_DEV_ID("sh-sci.6", &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]),
-- CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]),
-- CLKDEV_DEV_ID("e6c20000.i2c", &mstp_clks[MSTP323]),
-- CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]),
-- CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
-- CLKDEV_DEV_ID("e6850000.sd", &mstp_clks[MSTP314]),
-- CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
-- CLKDEV_DEV_ID("e6860000.sd", &mstp_clks[MSTP313]),
-- CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
-- CLKDEV_DEV_ID("e6bd0000.mmc", &mstp_clks[MSTP312]),
-- CLKDEV_DEV_ID("r8a7740-gether", &mstp_clks[MSTP309]),
-- CLKDEV_DEV_ID("e9a00000.ethernet", &mstp_clks[MSTP309]),
-- CLKDEV_DEV_ID("renesas-tpu-pwm", &mstp_clks[MSTP304]),
-- CLKDEV_DEV_ID("e6600000.pwm", &mstp_clks[MSTP304]),
--
-- CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]),
-- CLKDEV_DEV_ID("e6870000.sd", &mstp_clks[MSTP415]),
--
-- /* 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("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]),
-- CLKDEV_ICK_ID("pci", "renesas_usbhs", &div4_clks[DIV4_USBP]),
-- CLKDEV_ICK_ID("usb24", "renesas_usbhs", &usb24_clk),
-- CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]),
--
-- CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]),
-- CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]),
-- CLKDEV_ICK_ID("diva", "sh_fsi2", &fsidivs[FSIDIV_A]),
-- CLKDEV_ICK_ID("divb", "sh_fsi2", &fsidivs[FSIDIV_B]),
-- CLKDEV_ICK_ID("xcka", "sh_fsi2", &fsiack_clk),
-- CLKDEV_ICK_ID("xckb", "sh_fsi2", &fsibck_clk),
--};
--
--void __init r8a7740_clock_init(u8 md_ck)
--{
-- int k, ret = 0;
--
-- /* detect system clock parent */
-- if (md_ck & MD_CK1)
-- system_clk.parent = &extal1_div2_clk;
-- else
-- system_clk.parent = &extal1_clk;
--
-- /* detect RCLK parent */
-- switch (md_ck & (MD_CK2 | MD_CK1)) {
-- case MD_CK2 | MD_CK1:
-- r_clk.parent = &extal1_div2048_clk;
-- break;
-- case MD_CK2:
-- r_clk.parent = &extal1_div1024_clk;
-- break;
-- case MD_CK1:
-- default:
-- r_clk.parent = &extalr_clk;
-- break;
-- }
--
-- for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
-- ret = clk_register(main_clks[k]);
--
-- if (!ret)
-- ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
--
-- if (!ret)
-- ret = sh_clk_div6_register(div6_clks, DIV6_NR);
--
-- if (!ret)
-- ret = sh_clk_div6_reparent_register(div6_reparent_clks,
-- DIV6_REPARENT_NR);
--
-- if (!ret)
-- ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
--
-- for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++)
-- ret = clk_register(late_main_clks[k]);
--
-- if (!ret)
-- ret = sh_clk_fsidiv_register(fsidivs, FSIDIV_REPARENT_NR);
--
-- clkdev_add_table(lookups, ARRAY_SIZE(lookups));
--
-- if (!ret)
-- shmobile_clk_init();
-- else
-- panic("failed to setup r8a7740 clocks\n");
--}
-diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
-deleted file mode 100644
-index 34608fcf0648..000000000000
---- a/arch/arm/mach-shmobile/pm-r8a7740.c
-+++ /dev/null
-@@ -1,129 +0,0 @@
--/*
-- * r8a7740 power management support
-- *
-- * Copyright (C) 2012 Renesas Solutions Corp.
-- * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-- *
-- * 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/console.h>
--#include <linux/io.h>
--#include <linux/suspend.h>
--
--#include "common.h"
--#include "pm-rmobile.h"
--
--#define SYSC_BASE IOMEM(0xe6180000)
--
--#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
--static int r8a7740_pd_a3sm_suspend(void)
--{
-- /*
-- * The A3SM domain contains the CPU core and therefore it should
-- * only be turned off if the CPU is not in use.
-- */
-- return -EBUSY;
--}
--
--static int r8a7740_pd_a3sp_suspend(void)
--{
-- /*
-- * Serial consoles make use of SCIF hardware located in A3SP,
-- * keep such power domain on if "no_console_suspend" is set.
-- */
-- return console_suspend_enabled ? 0 : -EBUSY;
--}
--
--static int r8a7740_pd_d4_suspend(void)
--{
-- /*
-- * The D4 domain contains the Coresight-ETM hardware block and
-- * therefore it should only be turned off if the debug module is
-- * not in use.
-- */
-- return -EBUSY;
--}
--
--static struct rmobile_pm_domain r8a7740_pm_domains[] = {
-- {
-- .genpd.name = "A4LC",
-- .base = SYSC_BASE,
-- .bit_shift = 1,
-- }, {
-- .genpd.name = "A4MP",
-- .base = SYSC_BASE,
-- .bit_shift = 2,
-- }, {
-- .genpd.name = "D4",
-- .base = SYSC_BASE,
-- .bit_shift = 3,
-- .gov = &pm_domain_always_on_gov,
-- .suspend = r8a7740_pd_d4_suspend,
-- }, {
-- .genpd.name = "A4R",
-- .base = SYSC_BASE,
-- .bit_shift = 5,
-- }, {
-- .genpd.name = "A3RV",
-- .base = SYSC_BASE,
-- .bit_shift = 6,
-- }, {
-- .genpd.name = "A4S",
-- .base = SYSC_BASE,
-- .bit_shift = 10,
-- .no_debug = true,
-- }, {
-- .genpd.name = "A3SP",
-- .base = SYSC_BASE,
-- .bit_shift = 11,
-- .gov = &pm_domain_always_on_gov,
-- .no_debug = true,
-- .suspend = r8a7740_pd_a3sp_suspend,
-- }, {
-- .genpd.name = "A3SM",
-- .base = SYSC_BASE,
-- .bit_shift = 12,
-- .gov = &pm_domain_always_on_gov,
-- .suspend = r8a7740_pd_a3sm_suspend,
-- }, {
-- .genpd.name = "A3SG",
-- .base = SYSC_BASE,
-- .bit_shift = 13,
-- }, {
-- .genpd.name = "A4SU",
-- .base = SYSC_BASE,
-- .bit_shift = 20,
-- },
--};
--
--void __init r8a7740_init_pm_domains(void)
--{
-- rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
-- pm_genpd_add_subdomain_names("A4R", "A3RV");
-- pm_genpd_add_subdomain_names("A4S", "A3SP");
-- pm_genpd_add_subdomain_names("A4S", "A3SM");
-- pm_genpd_add_subdomain_names("A4S", "A3SG");
--}
--#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
--
--#ifdef CONFIG_SUSPEND
--static int r8a7740_enter_suspend(suspend_state_t suspend_state)
--{
-- cpu_do_idle();
-- return 0;
--}
--
--static void r8a7740_suspend_init(void)
--{
-- shmobile_suspend_ops.enter = r8a7740_enter_suspend;
--}
--#else
--static void r8a7740_suspend_init(void) {}
--#endif
--
--void __init r8a7740_pm_init(void)
--{
-- r8a7740_suspend_init();
--}
-diff --git a/arch/arm/mach-shmobile/r8a7740.h b/arch/arm/mach-shmobile/r8a7740.h
-deleted file mode 100644
-index ca7805ad7ea3..000000000000
---- a/arch/arm/mach-shmobile/r8a7740.h
-+++ /dev/null
-@@ -1,58 +0,0 @@
--/*
-- * Copyright (C) 2011 Renesas Solutions Corp.
-- * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; version 2 of the License.
-- *
-- * 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 __ASM_R8A7740_H__
--#define __ASM_R8A7740_H__
--
--/*
-- * MD_CKx pin
-- */
--#define MD_CK2 (1 << 2)
--#define MD_CK1 (1 << 1)
--#define MD_CK0 (1 << 0)
--
--/* DMA slave IDs */
--enum {
-- SHDMA_SLAVE_INVALID,
-- SHDMA_SLAVE_SDHI0_RX,
-- SHDMA_SLAVE_SDHI0_TX,
-- SHDMA_SLAVE_SDHI1_RX,
-- SHDMA_SLAVE_SDHI1_TX,
-- SHDMA_SLAVE_SDHI2_RX,
-- SHDMA_SLAVE_SDHI2_TX,
-- SHDMA_SLAVE_FSIA_RX,
-- SHDMA_SLAVE_FSIA_TX,
-- SHDMA_SLAVE_FSIB_TX,
-- SHDMA_SLAVE_USBHS_TX,
-- SHDMA_SLAVE_USBHS_RX,
-- SHDMA_SLAVE_MMCIF_TX,
-- SHDMA_SLAVE_MMCIF_RX,
--};
--
--extern void r8a7740_meram_workaround(void);
--extern void r8a7740_init_irq_of(void);
--extern void r8a7740_map_io(void);
--extern void r8a7740_add_early_devices(void);
--extern void r8a7740_add_standard_devices(void);
--extern void r8a7740_clock_init(u8 md_ck);
--extern void r8a7740_pinmux_init(void);
--extern void r8a7740_pm_init(void);
--
--#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
--extern void __init r8a7740_init_pm_domains(void);
--#else
--static inline void r8a7740_init_pm_domains(void) {}
--#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
--
--#endif /* __ASM_R8A7740_H__ */
-diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
-index 00291cc1772d..a158b0bf7762 100644
---- a/arch/arm/mach-shmobile/setup-r8a7740.c
-+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
-@@ -13,31 +13,19 @@
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
--#include <linux/dma-mapping.h>
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/io.h>
- #include <linux/irqchip.h>
- #include <linux/irqchip/arm-gic.h>
--#include <linux/platform_data/irq-renesas-intc-irqpin.h>
--#include <linux/platform_device.h>
- #include <linux/of_platform.h>
--#include <linux/serial_sci.h>
--#include <linux/sh_dma.h>
--#include <linux/sh_timer.h>
--#include <linux/platform_data/sh_ipmmu.h>
-
--#include <asm/mach-types.h>
- #include <asm/mach/map.h>
- #include <asm/mach/arch.h>
- #include <asm/mach/time.h>
- #include <asm/hardware/cache-l2x0.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 = {
- /*
-@@ -64,613 +52,12 @@ static struct map_desc r8a7740_io_desc[] __initdata = {
- #endif
- };
-
--void __init r8a7740_map_io(void)
-+static void __init r8a7740_map_io(void)
- {
- debug_ll_io_init();
- iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
- }
-
--/* PFC */
--static const struct resource pfc_resources[] = {
-- DEFINE_RES_MEM(0xe6050000, 0x8000),
-- DEFINE_RES_MEM(0xe605800c, 0x0020),
--};
--
--void __init r8a7740_pinmux_init(void)
--{
-- platform_device_register_simple("pfc-r8a7740", -1, pfc_resources,
-- ARRAY_SIZE(pfc_resources));
--}
--
--static struct renesas_intc_irqpin_config irqpin0_platform_data = {
-- .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */
--};
--
--static struct resource irqpin0_resources[] = {
-- DEFINE_RES_MEM(0xe6900000, 4), /* ICR1A */
-- DEFINE_RES_MEM(0xe6900010, 4), /* INTPRI00A */
-- DEFINE_RES_MEM(0xe6900020, 1), /* INTREQ00A */
-- DEFINE_RES_MEM(0xe6900040, 1), /* INTMSK00A */
-- DEFINE_RES_MEM(0xe6900060, 1), /* INTMSKCLR00A */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ0 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ1 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ2 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ3 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ4 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ5 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ6 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ7 */
--};
--
--static struct platform_device irqpin0_device = {
-- .name = "renesas_intc_irqpin",
-- .id = 0,
-- .resource = irqpin0_resources,
-- .num_resources = ARRAY_SIZE(irqpin0_resources),
-- .dev = {
-- .platform_data = &irqpin0_platform_data,
-- },
--};
--
--static struct renesas_intc_irqpin_config irqpin1_platform_data = {
-- .irq_base = irq_pin(8), /* IRQ8 -> IRQ15 */
--};
--
--static struct resource irqpin1_resources[] = {
-- DEFINE_RES_MEM(0xe6900004, 4), /* ICR2A */
-- DEFINE_RES_MEM(0xe6900014, 4), /* INTPRI10A */
-- DEFINE_RES_MEM(0xe6900024, 1), /* INTREQ10A */
-- DEFINE_RES_MEM(0xe6900044, 1), /* INTMSK10A */
-- DEFINE_RES_MEM(0xe6900064, 1), /* INTMSKCLR10A */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ8 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ9 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ10 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ11 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ12 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ13 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ14 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ15 */
--};
--
--static struct platform_device irqpin1_device = {
-- .name = "renesas_intc_irqpin",
-- .id = 1,
-- .resource = irqpin1_resources,
-- .num_resources = ARRAY_SIZE(irqpin1_resources),
-- .dev = {
-- .platform_data = &irqpin1_platform_data,
-- },
--};
--
--static struct renesas_intc_irqpin_config irqpin2_platform_data = {
-- .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */
--};
--
--static struct resource irqpin2_resources[] = {
-- DEFINE_RES_MEM(0xe6900008, 4), /* ICR3A */
-- DEFINE_RES_MEM(0xe6900018, 4), /* INTPRI30A */
-- DEFINE_RES_MEM(0xe6900028, 1), /* INTREQ30A */
-- DEFINE_RES_MEM(0xe6900048, 1), /* INTMSK30A */
-- DEFINE_RES_MEM(0xe6900068, 1), /* INTMSKCLR30A */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ16 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ17 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ18 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ19 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ20 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ21 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ22 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ23 */
--};
--
--static struct platform_device irqpin2_device = {
-- .name = "renesas_intc_irqpin",
-- .id = 2,
-- .resource = irqpin2_resources,
-- .num_resources = ARRAY_SIZE(irqpin2_resources),
-- .dev = {
-- .platform_data = &irqpin2_platform_data,
-- },
--};
--
--static struct renesas_intc_irqpin_config irqpin3_platform_data = {
-- .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */
--};
--
--static struct resource irqpin3_resources[] = {
-- DEFINE_RES_MEM(0xe690000c, 4), /* ICR3A */
-- DEFINE_RES_MEM(0xe690001c, 4), /* INTPRI30A */
-- DEFINE_RES_MEM(0xe690002c, 1), /* INTREQ30A */
-- DEFINE_RES_MEM(0xe690004c, 1), /* INTMSK30A */
-- DEFINE_RES_MEM(0xe690006c, 1), /* INTMSKCLR30A */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ24 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ25 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ26 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ27 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ28 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ29 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ30 */
-- DEFINE_RES_IRQ(gic_spi(149)), /* IRQ31 */
--};
--
--static struct platform_device irqpin3_device = {
-- .name = "renesas_intc_irqpin",
-- .id = 3,
-- .resource = irqpin3_resources,
-- .num_resources = ARRAY_SIZE(irqpin3_resources),
-- .dev = {
-- .platform_data = &irqpin3_platform_data,
-- },
--};
--
--/* SCIF */
--#define R8A7740_SCIF(scif_type, index, baseaddr, irq) \
--static struct plat_sci_port scif##index##_platform_data = { \
-- .type = scif_type, \
-- .flags = UPF_BOOT_AUTOCONF, \
-- .scscr = SCSCR_RE | SCSCR_TE, \
--}; \
-- \
--static struct resource scif##index##_resources[] = { \
-- DEFINE_RES_MEM(baseaddr, 0x100), \
-- DEFINE_RES_IRQ(irq), \
--}; \
-- \
--static struct platform_device scif##index##_device = { \
-- .name = "sh-sci", \
-- .id = index, \
-- .resource = scif##index##_resources, \
-- .num_resources = ARRAY_SIZE(scif##index##_resources), \
-- .dev = { \
-- .platform_data = &scif##index##_platform_data, \
-- }, \
--}
--
--R8A7740_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(100));
--R8A7740_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(101));
--R8A7740_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(102));
--R8A7740_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(103));
--R8A7740_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(104));
--R8A7740_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(105));
--R8A7740_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(106));
--R8A7740_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(107));
--R8A7740_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(108));
--
--/* CMT */
--static struct sh_timer_config cmt1_platform_data = {
-- .channels_mask = 0x3f,
--};
--
--static struct resource cmt1_resources[] = {
-- DEFINE_RES_MEM(0xe6138000, 0x170),
-- DEFINE_RES_IRQ(gic_spi(58)),
--};
--
--static struct platform_device cmt1_device = {
-- .name = "sh-cmt-48",
-- .id = 1,
-- .dev = {
-- .platform_data = &cmt1_platform_data,
-- },
-- .resource = cmt1_resources,
-- .num_resources = ARRAY_SIZE(cmt1_resources),
--};
--
--/* TMU */
--static struct sh_timer_config tmu0_platform_data = {
-- .channels_mask = 7,
--};
--
--static struct resource tmu0_resources[] = {
-- DEFINE_RES_MEM(0xfff80000, 0x2c),
-- DEFINE_RES_IRQ(gic_spi(198)),
-- DEFINE_RES_IRQ(gic_spi(199)),
-- DEFINE_RES_IRQ(gic_spi(200)),
--};
--
--static struct platform_device tmu0_device = {
-- .name = "sh-tmu",
-- .id = 0,
-- .dev = {
-- .platform_data = &tmu0_platform_data,
-- },
-- .resource = tmu0_resources,
-- .num_resources = ARRAY_SIZE(tmu0_resources),
--};
--
--/* IPMMUI (an IPMMU module for ICB/LMB) */
--static struct resource ipmmu_resources[] = {
-- [0] = {
-- .name = "IPMMUI",
-- .start = 0xfe951000,
-- .end = 0xfe9510ff,
-- .flags = IORESOURCE_MEM,
-- },
--};
--
--static const char * const ipmmu_dev_names[] = {
-- "sh_mobile_lcdc_fb.0",
-- "sh_mobile_lcdc_fb.1",
-- "sh_mobile_ceu.0",
--};
--
--static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
-- .dev_names = ipmmu_dev_names,
-- .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
--};
--
--static struct platform_device ipmmu_device = {
-- .name = "ipmmu",
-- .id = -1,
-- .dev = {
-- .platform_data = &ipmmu_platform_data,
-- },
-- .resource = ipmmu_resources,
-- .num_resources = ARRAY_SIZE(ipmmu_resources),
--};
--
--static struct platform_device *r8a7740_early_devices[] __initdata = {
-- &scif0_device,
-- &scif1_device,
-- &scif2_device,
-- &scif3_device,
-- &scif4_device,
-- &scif5_device,
-- &scif6_device,
-- &scif7_device,
-- &scif8_device,
-- &irqpin0_device,
-- &irqpin1_device,
-- &irqpin2_device,
-- &irqpin3_device,
-- &tmu0_device,
-- &ipmmu_device,
-- &cmt1_device,
--};
--
--/* DMA */
--static const struct sh_dmae_slave_config r8a7740_dmae_slaves[] = {
-- {
-- .slave_id = SHDMA_SLAVE_SDHI0_TX,
-- .addr = 0xe6850030,
-- .chcr = CHCR_TX(XMIT_SZ_16BIT),
-- .mid_rid = 0xc1,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI0_RX,
-- .addr = 0xe6850030,
-- .chcr = CHCR_RX(XMIT_SZ_16BIT),
-- .mid_rid = 0xc2,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI1_TX,
-- .addr = 0xe6860030,
-- .chcr = CHCR_TX(XMIT_SZ_16BIT),
-- .mid_rid = 0xc9,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI1_RX,
-- .addr = 0xe6860030,
-- .chcr = CHCR_RX(XMIT_SZ_16BIT),
-- .mid_rid = 0xca,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI2_TX,
-- .addr = 0xe6870030,
-- .chcr = CHCR_TX(XMIT_SZ_16BIT),
-- .mid_rid = 0xcd,
-- }, {
-- .slave_id = SHDMA_SLAVE_SDHI2_RX,
-- .addr = 0xe6870030,
-- .chcr = CHCR_RX(XMIT_SZ_16BIT),
-- .mid_rid = 0xce,
-- }, {
-- .slave_id = SHDMA_SLAVE_FSIA_TX,
-- .addr = 0xfe1f0024,
-- .chcr = CHCR_TX(XMIT_SZ_32BIT),
-- .mid_rid = 0xb1,
-- }, {
-- .slave_id = SHDMA_SLAVE_FSIA_RX,
-- .addr = 0xfe1f0020,
-- .chcr = CHCR_RX(XMIT_SZ_32BIT),
-- .mid_rid = 0xb2,
-- }, {
-- .slave_id = SHDMA_SLAVE_FSIB_TX,
-- .addr = 0xfe1f0064,
-- .chcr = CHCR_TX(XMIT_SZ_32BIT),
-- .mid_rid = 0xb5,
-- }, {
-- .slave_id = SHDMA_SLAVE_MMCIF_TX,
-- .addr = 0xe6bd0034,
-- .chcr = CHCR_TX(XMIT_SZ_32BIT),
-- .mid_rid = 0xd1,
-- }, {
-- .slave_id = SHDMA_SLAVE_MMCIF_RX,
-- .addr = 0xe6bd0034,
-- .chcr = CHCR_RX(XMIT_SZ_32BIT),
-- .mid_rid = 0xd2,
-- },
--};
--
--#define DMA_CHANNEL(a, b, c) \
--{ \
-- .offset = a, \
-- .dmars = b, \
-- .dmars_bit = c, \
-- .chclr_offset = (0x220 - 0x20) + a \
--}
--
--static const struct sh_dmae_channel r8a7740_dmae_channels[] = {
-- DMA_CHANNEL(0x00, 0, 0),
-- DMA_CHANNEL(0x10, 0, 8),
-- DMA_CHANNEL(0x20, 4, 0),
-- DMA_CHANNEL(0x30, 4, 8),
-- DMA_CHANNEL(0x50, 8, 0),
-- DMA_CHANNEL(0x60, 8, 8),
--};
--
--static struct sh_dmae_pdata dma_platform_data = {
-- .slave = r8a7740_dmae_slaves,
-- .slave_num = ARRAY_SIZE(r8a7740_dmae_slaves),
-- .channel = r8a7740_dmae_channels,
-- .channel_num = ARRAY_SIZE(r8a7740_dmae_channels),
-- .ts_low_shift = TS_LOW_SHIFT,
-- .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
-- .ts_high_shift = TS_HI_SHIFT,
-- .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
-- .ts_shift = dma_ts_shift,
-- .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
-- .dmaor_init = DMAOR_DME,
-- .chclr_present = 1,
--};
--
--/* Resource order important! */
--static struct resource r8a7740_dmae0_resources[] = {
-- {
-- /* Channel registers and DMAOR */
-- .start = 0xfe008020,
-- .end = 0xfe00828f,
-- .flags = IORESOURCE_MEM,
-- },
-- {
-- /* DMARSx */
-- .start = 0xfe009000,
-- .end = 0xfe00900b,
-- .flags = IORESOURCE_MEM,
-- },
-- {
-- .name = "error_irq",
-- .start = gic_spi(34),
-- .end = gic_spi(34),
-- .flags = IORESOURCE_IRQ,
-- },
-- {
-- /* IRQ for channels 0-5 */
-- .start = gic_spi(28),
-- .end = gic_spi(33),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--/* Resource order important! */
--static struct resource r8a7740_dmae1_resources[] = {
-- {
-- /* Channel registers and DMAOR */
-- .start = 0xfe018020,
-- .end = 0xfe01828f,
-- .flags = IORESOURCE_MEM,
-- },
-- {
-- /* DMARSx */
-- .start = 0xfe019000,
-- .end = 0xfe01900b,
-- .flags = IORESOURCE_MEM,
-- },
-- {
-- .name = "error_irq",
-- .start = gic_spi(41),
-- .end = gic_spi(41),
-- .flags = IORESOURCE_IRQ,
-- },
-- {
-- /* IRQ for channels 0-5 */
-- .start = gic_spi(35),
-- .end = gic_spi(40),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--/* Resource order important! */
--static struct resource r8a7740_dmae2_resources[] = {
-- {
-- /* Channel registers and DMAOR */
-- .start = 0xfe028020,
-- .end = 0xfe02828f,
-- .flags = IORESOURCE_MEM,
-- },
-- {
-- /* DMARSx */
-- .start = 0xfe029000,
-- .end = 0xfe02900b,
-- .flags = IORESOURCE_MEM,
-- },
-- {
-- .name = "error_irq",
-- .start = gic_spi(48),
-- .end = gic_spi(48),
-- .flags = IORESOURCE_IRQ,
-- },
-- {
-- /* IRQ for channels 0-5 */
-- .start = gic_spi(42),
-- .end = gic_spi(47),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device dma0_device = {
-- .name = "sh-dma-engine",
-- .id = 0,
-- .resource = r8a7740_dmae0_resources,
-- .num_resources = ARRAY_SIZE(r8a7740_dmae0_resources),
-- .dev = {
-- .platform_data = &dma_platform_data,
-- },
--};
--
--static struct platform_device dma1_device = {
-- .name = "sh-dma-engine",
-- .id = 1,
-- .resource = r8a7740_dmae1_resources,
-- .num_resources = ARRAY_SIZE(r8a7740_dmae1_resources),
-- .dev = {
-- .platform_data = &dma_platform_data,
-- },
--};
--
--static struct platform_device dma2_device = {
-- .name = "sh-dma-engine",
-- .id = 2,
-- .resource = r8a7740_dmae2_resources,
-- .num_resources = ARRAY_SIZE(r8a7740_dmae2_resources),
-- .dev = {
-- .platform_data = &dma_platform_data,
-- },
--};
--
--/* USB-DMAC */
--static const struct sh_dmae_channel r8a7740_usb_dma_channels[] = {
-- {
-- .offset = 0,
-- }, {
-- .offset = 0x20,
-- },
--};
--
--static const struct sh_dmae_slave_config r8a7740_usb_dma_slaves[] = {
-- {
-- .slave_id = SHDMA_SLAVE_USBHS_TX,
-- .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
-- }, {
-- .slave_id = SHDMA_SLAVE_USBHS_RX,
-- .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
-- },
--};
--
--static struct sh_dmae_pdata usb_dma_platform_data = {
-- .slave = r8a7740_usb_dma_slaves,
-- .slave_num = ARRAY_SIZE(r8a7740_usb_dma_slaves),
-- .channel = r8a7740_usb_dma_channels,
-- .channel_num = ARRAY_SIZE(r8a7740_usb_dma_channels),
-- .ts_low_shift = USBTS_LOW_SHIFT,
-- .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
-- .ts_high_shift = USBTS_HI_SHIFT,
-- .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
-- .ts_shift = dma_usbts_shift,
-- .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
-- .dmaor_init = DMAOR_DME,
-- .chcr_offset = 0x14,
-- .chcr_ie_bit = 1 << 5,
-- .dmaor_is_32bit = 1,
-- .needs_tend_set = 1,
-- .no_dmars = 1,
-- .slave_only = 1,
--};
--
--static struct resource r8a7740_usb_dma_resources[] = {
-- {
-- /* Channel registers and DMAOR */
-- .start = 0xe68a0020,
-- .end = 0xe68a0064 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- {
-- /* VCR/SWR/DMICR */
-- .start = 0xe68a0000,
-- .end = 0xe68a0014 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- {
-- /* IRQ for channels */
-- .start = gic_spi(49),
-- .end = gic_spi(49),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device usb_dma_device = {
-- .name = "sh-dma-engine",
-- .id = 3,
-- .resource = r8a7740_usb_dma_resources,
-- .num_resources = ARRAY_SIZE(r8a7740_usb_dma_resources),
-- .dev = {
-- .platform_data = &usb_dma_platform_data,
-- },
--};
--
--/* I2C */
--static struct resource i2c0_resources[] = {
-- [0] = {
-- .name = "IIC0",
-- .start = 0xfff20000,
-- .end = 0xfff20425 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(201),
-- .end = gic_spi(204),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct resource i2c1_resources[] = {
-- [0] = {
-- .name = "IIC1",
-- .start = 0xe6c20000,
-- .end = 0xe6c20425 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_spi(70), /* IIC1_ALI1 */
-- .end = gic_spi(73), /* IIC1_DTEI1 */
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device i2c0_device = {
-- .name = "i2c-sh_mobile",
-- .id = 0,
-- .resource = i2c0_resources,
-- .num_resources = ARRAY_SIZE(i2c0_resources),
--};
--
--static struct platform_device i2c1_device = {
-- .name = "i2c-sh_mobile",
-- .id = 1,
-- .resource = i2c1_resources,
-- .num_resources = ARRAY_SIZE(i2c1_resources),
--};
--
--static struct resource pmu_resources[] = {
-- [0] = {
-- .start = gic_spi(83),
-- .end = gic_spi(83),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device pmu_device = {
-- .name = "armv7-pmu",
-- .id = -1,
-- .num_resources = ARRAY_SIZE(pmu_resources),
-- .resource = pmu_resources,
--};
--
--static struct platform_device *r8a7740_late_devices[] __initdata = {
-- &i2c0_device,
-- &i2c1_device,
-- &dma0_device,
-- &dma1_device,
-- &dma2_device,
-- &usb_dma_device,
-- &pmu_device,
--};
--
- /*
- * r8a7740 chip has lasting errata on MERAM buffer.
- * this is work-around for it.
-@@ -678,7 +65,7 @@ static struct platform_device *r8a7740_late_devices[] __initdata = {
- * "Media RAM (MERAM)" on r8a7740 documentation
- */
- #define MEBUFCNTR 0xFE950098
--void __init r8a7740_meram_workaround(void)
-+static void __init r8a7740_meram_workaround(void)
- {
- void __iomem *reg;
-
-@@ -689,70 +76,13 @@ void __init r8a7740_meram_workaround(void)
- }
- }
-
--void __init r8a7740_add_standard_devices(void)
--{
-- static struct pm_domain_device domain_devices[] __initdata = {
-- { "A4R", &tmu0_device },
-- { "A4R", &i2c0_device },
-- { "A4S", &irqpin0_device },
-- { "A4S", &irqpin1_device },
-- { "A4S", &irqpin2_device },
-- { "A4S", &irqpin3_device },
-- { "A3SP", &scif0_device },
-- { "A3SP", &scif1_device },
-- { "A3SP", &scif2_device },
-- { "A3SP", &scif3_device },
-- { "A3SP", &scif4_device },
-- { "A3SP", &scif5_device },
-- { "A3SP", &scif6_device },
-- { "A3SP", &scif7_device },
-- { "A3SP", &scif8_device },
-- { "A3SP", &i2c1_device },
-- { "A3SP", &ipmmu_device },
-- { "A3SP", &dma0_device },
-- { "A3SP", &dma1_device },
-- { "A3SP", &dma2_device },
-- { "A3SP", &usb_dma_device },
-- };
--
-- r8a7740_init_pm_domains();
--
-- /* add devices */
-- platform_add_devices(r8a7740_early_devices,
-- ARRAY_SIZE(r8a7740_early_devices));
-- platform_add_devices(r8a7740_late_devices,
-- ARRAY_SIZE(r8a7740_late_devices));
--
-- /* add devices to PM domain */
-- rmobile_add_devices_to_domains(domain_devices,
-- ARRAY_SIZE(domain_devices));
--}
--
--void __init r8a7740_add_early_devices(void)
--{
-- early_platform_add_devices(r8a7740_early_devices,
-- ARRAY_SIZE(r8a7740_early_devices));
--
-- /* setup early console here as well */
-- shmobile_setup_console();
--}
--
--#ifdef CONFIG_USE_OF
--
--void __init r8a7740_init_irq_of(void)
-+static void __init r8a7740_init_irq_of(void)
- {
- void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
- void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10);
- void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4);
-
--#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
-- void __iomem *gic_dist_base = ioremap_nocache(0xc2800000, 0x1000);
-- void __iomem *gic_cpu_base = ioremap_nocache(0xc2000000, 0x1000);
--
-- gic_init(0, 29, gic_dist_base, gic_cpu_base);
--#else
- irqchip_init();
--#endif
-
- /* route signals to GIC */
- iowrite32(0x0, pfc_inta_ctrl);
-@@ -800,5 +130,3 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
- .init_late = shmobile_init_late,
- .dt_compat = r8a7740_boards_compat_dt,
- MACHINE_END
--
--#endif /* CONFIG_USE_OF */
---
-2.6.2
-
diff --git a/patches.renesas/0154-ARM-shmobile-Remove-unused-dma-register.h.patch b/patches.renesas/0154-ARM-shmobile-Remove-unused-dma-register.h.patch
deleted file mode 100644
index bcc9b4fdd6569a..00000000000000
--- a/patches.renesas/0154-ARM-shmobile-Remove-unused-dma-register.h.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From dee14fe6975facca1f7e475f8064fac63845ba63 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:25 +0200
-Subject: [PATCH 154/326] ARM: shmobile: Remove unused dma-register.h
-
-The last users of "dma-register.h" were the sh73a0 and r8a7740 legacy
-SoC code, which have been removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 68a31785697c6292e4de3f54914a6ff5ebd0a82d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/dma-register.h | 84 -----------------------------------
- 1 file changed, 84 deletions(-)
- delete mode 100644 arch/arm/mach-shmobile/dma-register.h
-
-diff --git a/arch/arm/mach-shmobile/dma-register.h b/arch/arm/mach-shmobile/dma-register.h
-deleted file mode 100644
-index 52a2f66e600f..000000000000
---- a/arch/arm/mach-shmobile/dma-register.h
-+++ /dev/null
-@@ -1,84 +0,0 @@
--/*
-- * SH-ARM CPU-specific DMA definitions, used by both DMA drivers
-- *
-- * Copyright (C) 2012 Renesas Solutions Corp
-- *
-- * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-- *
-- * Based on arch/sh/include/cpu-sh4/cpu/dma-register.h
-- * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
-- *
-- * 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 DMA_REGISTER_H
--#define DMA_REGISTER_H
--
--/*
-- * Direct Memory Access Controller
-- */
--
--/* Transmit sizes and respective CHCR register values */
--enum {
-- XMIT_SZ_8BIT = 0,
-- XMIT_SZ_16BIT = 1,
-- XMIT_SZ_32BIT = 2,
-- XMIT_SZ_64BIT = 7,
-- XMIT_SZ_128BIT = 3,
-- XMIT_SZ_256BIT = 4,
-- XMIT_SZ_512BIT = 5,
--};
--
--/* log2(size / 8) - used to calculate number of transfers */
--static const unsigned int dma_ts_shift[] = {
-- [XMIT_SZ_8BIT] = 0,
-- [XMIT_SZ_16BIT] = 1,
-- [XMIT_SZ_32BIT] = 2,
-- [XMIT_SZ_64BIT] = 3,
-- [XMIT_SZ_128BIT] = 4,
-- [XMIT_SZ_256BIT] = 5,
-- [XMIT_SZ_512BIT] = 6,
--};
--
--#define TS_LOW_BIT 0x3 /* --xx */
--#define TS_HI_BIT 0xc /* xx-- */
--
--#define TS_LOW_SHIFT (3)
--#define TS_HI_SHIFT (20 - 2) /* 2 bits for shifted low TS */
--
--#define TS_INDEX2VAL(i) \
-- ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\
-- (((i) & TS_HI_BIT) << TS_HI_SHIFT))
--
--#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)))
--
--
--/*
-- * USB High-Speed DMAC
-- */
--/* Transmit sizes and respective CHCR register values */
--enum {
-- USBTS_XMIT_SZ_8BYTE = 0,
-- USBTS_XMIT_SZ_16BYTE = 1,
-- USBTS_XMIT_SZ_32BYTE = 2,
--};
--
--/* log2(size / 8) - used to calculate number of transfers */
--static const unsigned int dma_usbts_shift[] = {
-- [USBTS_XMIT_SZ_8BYTE] = 3,
-- [USBTS_XMIT_SZ_16BYTE] = 4,
-- [USBTS_XMIT_SZ_32BYTE] = 5,
--};
--
--#define USBTS_LOW_BIT 0x3 /* --xx */
--#define USBTS_HI_BIT 0x0 /* ---- */
--
--#define USBTS_LOW_SHIFT 6
--#define USBTS_HI_SHIFT 0
--
--#define USBTS_INDEX2VAL(i) (((i) & 3) << 6)
--
--#endif /* DMA_REGISTER_H */
---
-2.6.2
-
diff --git a/patches.renesas/0155-ARM-shmobile-R-Mobile-Remove-legacy-PM-Domain-code.patch b/patches.renesas/0155-ARM-shmobile-R-Mobile-Remove-legacy-PM-Domain-code.patch
deleted file mode 100644
index 8bdb52790aaa15..00000000000000
--- a/patches.renesas/0155-ARM-shmobile-R-Mobile-Remove-legacy-PM-Domain-code.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-From f1e59faef0dd121685243126eece19b7873bcec4 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:26 +0200
-Subject: [PATCH 155/326] ARM: shmobile: R-Mobile: Remove legacy PM Domain code
-
-The last user of the legacy R-Mobile PM Domain code was the r8a7740
-legacy SoC code, which has been removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit b587288001f05c0e6b4bdb5a5f0e7a28594cbf0d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-rmobile.c | 39 -------------------------------------
- arch/arm/mach-shmobile/pm-rmobile.h | 24 -----------------------
- 2 files changed, 63 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
-index b9b494f5ca99..a5b96b990aea 100644
---- a/arch/arm/mach-shmobile/pm-rmobile.c
-+++ b/arch/arm/mach-shmobile/pm-rmobile.c
-@@ -169,43 +169,6 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
- __rmobile_pd_power_up(rmobile_pd, false);
- }
-
--#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
--
--void rmobile_init_domains(struct rmobile_pm_domain domains[], int num)
--{
-- int j;
--
-- for (j = 0; j < num; j++)
-- rmobile_init_pm_domain(&domains[j]);
--}
--
--void rmobile_add_device_to_domain_td(const char *domain_name,
-- struct platform_device *pdev,
-- struct gpd_timing_data *td)
--{
-- struct device *dev = &pdev->dev;
--
-- __pm_genpd_name_add_device(domain_name, dev, td);
--}
--
--void rmobile_add_devices_to_domains(struct pm_domain_device data[],
-- int size)
--{
-- struct gpd_timing_data latencies = {
-- .stop_latency_ns = DEFAULT_DEV_LATENCY_NS,
-- .start_latency_ns = DEFAULT_DEV_LATENCY_NS,
-- .save_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
-- .restore_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
-- };
-- int j;
--
-- for (j = 0; j < size; j++)
-- rmobile_add_device_to_domain_td(data[j].domain_name,
-- data[j].pdev, &latencies);
--}
--
--#else /* !CONFIG_ARCH_SHMOBILE_LEGACY */
--
- static int rmobile_pd_suspend_busy(void)
- {
- /*
-@@ -436,5 +399,3 @@ static int __init rmobile_init_pm_domains(void)
- }
-
- core_initcall(rmobile_init_pm_domains);
--
--#endif /* !CONFIG_ARCH_SHMOBILE_LEGACY */
-diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
-index 3992b619c127..30a4a421ee31 100644
---- a/arch/arm/mach-shmobile/pm-rmobile.h
-+++ b/arch/arm/mach-shmobile/pm-rmobile.h
-@@ -31,28 +31,4 @@ struct pm_domain_device {
- struct platform_device *pdev;
- };
-
--#if defined(CONFIG_PM_RMOBILE) && defined(CONFIG_ARCH_SHMOBILE_LEGACY)
--extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
--extern void rmobile_add_device_to_domain_td(const char *domain_name,
-- struct platform_device *pdev,
-- struct gpd_timing_data *td);
--
--static inline void rmobile_add_device_to_domain(const char *domain_name,
-- struct platform_device *pdev)
--{
-- rmobile_add_device_to_domain_td(domain_name, pdev, NULL);
--}
--
--extern void rmobile_add_devices_to_domains(struct pm_domain_device data[],
-- int size);
--#else
--
--#define rmobile_init_domains(domains, num) do { } while (0)
--#define rmobile_add_device_to_domain_td(name, pdev, td) do { } while (0)
--#define rmobile_add_device_to_domain(name, pdev) do { } while (0)
--
--static inline void rmobile_add_devices_to_domains(struct pm_domain_device d[],
-- int size) {}
--#endif /* CONFIG_PM_RMOBILE */
--
- #endif /* PM_RMOBILE_H */
---
-2.6.2
-
diff --git a/patches.renesas/0156-ARM-shmobile-Remove-obsolete-zboot-support.patch b/patches.renesas/0156-ARM-shmobile-Remove-obsolete-zboot-support.patch
deleted file mode 100644
index ed2094afabb958..00000000000000
--- a/patches.renesas/0156-ARM-shmobile-Remove-obsolete-zboot-support.patch
+++ /dev/null
@@ -1,251 +0,0 @@
-From ae4cb5379077dae79c77ae96d235e01096990578 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:31:27 +0200
-Subject: [PATCH 156/326] ARM: shmobile: Remove obsolete zboot support
-
-The last user of the zboot code was the KZM-A9-GT legacy board code,
-which has been removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 11e386719b08606502477cddf10c832b6658bb55)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/compressed/Makefile | 4 -
- arch/arm/boot/compressed/head-shmobile.S | 71 --------------
- arch/arm/mach-shmobile/include/mach/zboot.h | 14 ---
- arch/arm/mach-shmobile/include/mach/zboot_macros.h | 108 ---------------------
- 4 files changed, 197 deletions(-)
- delete mode 100644 arch/arm/boot/compressed/head-shmobile.S
- delete mode 100644 arch/arm/mach-shmobile/include/mach/zboot.h
- delete mode 100644 arch/arm/mach-shmobile/include/mach/zboot_macros.h
-
-diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
-index 6e1fb2b2ecc7..8be2cdec87a8 100644
---- a/arch/arm/boot/compressed/Makefile
-+++ b/arch/arm/boot/compressed/Makefile
-@@ -51,10 +51,6 @@ else
- endif
- endif
-
--ifeq ($(CONFIG_ARCH_SHMOBILE_LEGACY),y)
--OBJS += head-shmobile.o
--endif
--
- #
- # We now have a PIC decompressor implementation. Decompressors running
- # from RAM should not define ZTEXTADDR. Decompressors running directly
-diff --git a/arch/arm/boot/compressed/head-shmobile.S b/arch/arm/boot/compressed/head-shmobile.S
-deleted file mode 100644
-index 22a75259faa3..000000000000
---- a/arch/arm/boot/compressed/head-shmobile.S
-+++ /dev/null
-@@ -1,71 +0,0 @@
--/*
-- * The head-file for SH-Mobile ARM platforms
-- *
-- * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-- * Simon Horman <horms@verge.net.au>
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; version 2 of the License.
-- *
-- * 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.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software
-- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-- */
--
--#ifdef CONFIG_ZBOOT_ROM
--
-- .section ".start", "ax"
--
-- /* load board-specific initialization code */
--#include <mach/zboot.h>
--
-- adr r0, dtb_info
-- ldmia r0, {r1, r3, r4, r5, r7}
--
-- sub r0, r0, r1 @ calculate the delta offset
-- add r5, r5, r0 @ _edata
--
-- ldr lr, [r5, #0] @ check if valid DTB is present
-- cmp lr, r3
-- bne 0f
--
-- add r9, r7, #31 @ rounded up to a multiple
-- bic r9, r9, #31 @ ... of 32 bytes
--
-- add r6, r9, r5 @ copy from _edata
-- add r9, r9, r4 @ to MEMORY_START
--
--1: ldmdb r6!, {r0 - r3, r10 - r12, lr}
-- cmp r6, r5
-- stmdb r9!, {r0 - r3, r10 - r12, lr}
-- bhi 1b
--
-- /* Success: Zero board ID, pointer to start of memory for atag/dtb */
-- mov r7, #0
-- mov r8, r4
-- b 2f
--
-- .align 2
--dtb_info:
-- .word dtb_info
--#ifndef __ARMEB__
-- .word 0xedfe0dd0 @ sig is 0xd00dfeed big endian
--#else
-- .word 0xd00dfeed
--#endif
-- .word MEMORY_START
-- .word _edata
-- .word 0x4000 @ maximum DTB size
--0:
-- /* Failure: Zero board ID, NULL atag/dtb */
-- mov r7, #0
-- mov r8, #0 @ pass null pointer as atag
--2 :
--
--#endif /* CONFIG_ZBOOT_ROM */
-diff --git a/arch/arm/mach-shmobile/include/mach/zboot.h b/arch/arm/mach-shmobile/include/mach/zboot.h
-deleted file mode 100644
-index 80f599f4b5ab..000000000000
---- a/arch/arm/mach-shmobile/include/mach/zboot.h
-+++ /dev/null
-@@ -1,14 +0,0 @@
--#ifndef ZBOOT_H
--#define ZBOOT_H
--
--#include <mach/zboot_macros.h>
--
--/**************************************************
-- *
-- * board specific settings
-- *
-- **************************************************/
--
--#error "unsupported board."
--
--#endif /* ZBOOT_H */
-diff --git a/arch/arm/mach-shmobile/include/mach/zboot_macros.h b/arch/arm/mach-shmobile/include/mach/zboot_macros.h
-deleted file mode 100644
-index 14fd3d538e9a..000000000000
---- a/arch/arm/mach-shmobile/include/mach/zboot_macros.h
-+++ /dev/null
-@@ -1,108 +0,0 @@
--#ifndef __ZBOOT_MACRO_H
--#define __ZBOOT_MACRO_H
--
--/* The LIST command is used to include comments in the script */
--.macro LIST comment
--.endm
--
--/* The ED command is used to write a 32-bit word */
--.macro ED, addr, data
-- LDR r0, 1f
-- LDR r1, 2f
-- STR r1, [r0]
-- B 3f
--1 : .long \addr
--2 : .long \data
--3 :
--.endm
--
--/* The EW command is used to write a 16-bit word */
--.macro EW, addr, data
-- LDR r0, 1f
-- LDR r1, 2f
-- STRH r1, [r0]
-- B 3f
--1 : .long \addr
--2 : .long \data
--3 :
--.endm
--
--/* The EB command is used to write an 8-bit word */
--.macro EB, addr, data
-- LDR r0, 1f
-- LDR r1, 2f
-- STRB r1, [r0]
-- B 3f
--1 : .long \addr
--2 : .long \data
--3 :
--.endm
--
--/* The WAIT command is used to delay the execution */
--.macro WAIT, time, reg
-- LDR r1, 1f
-- LDR r0, 2f
-- STR r0, [r1]
--10 :
-- LDR r0, [r1]
-- CMP r0, #0x00000000
-- BNE 10b
-- NOP
-- B 3f
--1 : .long \reg
--2 : .long \time * 100
--3 :
--.endm
--
--/* The DD command is used to read a 32-bit word */
--.macro DD, start, end
-- LDR r1, 1f
-- B 2f
--1 : .long \start
--2 :
--.endm
--
--/* loop until a given value has been read (with mask) */
--.macro WAIT_MASK, addr, data, cmp
-- LDR r0, 2f
-- LDR r1, 3f
-- LDR r2, 4f
--1:
-- LDR r3, [r0, #0]
-- AND r3, r1, r3
-- CMP r2, r3
-- BNE 1b
-- B 5f
--2: .long \addr
--3: .long \data
--4: .long \cmp
--5:
--.endm
--
--/* read 32-bit value from addr, "or" an immediate and write back */
--.macro ED_OR, addr, data
-- LDR r4, 1f
-- LDR r5, 2f
-- LDR r6, [r4]
-- ORR r5, r6, r5
-- STR r5, [r4]
-- B 3f
--1: .long \addr
--2: .long \data
--3:
--.endm
--
--/* read 32-bit value from addr, "and" an immediate and write back */
--.macro ED_AND, addr, data
-- LDR r4, 1f
-- LDR r5, 2f
-- LDR r6, [r4]
-- AND r5, r6, r5
-- STR r5, [r4]
-- B 3f
--1: .long \addr
--2: .long \data
--3:
--.endm
--
--#endif /* __ZBOOT_MACRO_H */
---
-2.6.2
-
diff --git a/patches.renesas/0157-ARM-shmobile-R-Car-Gen2-CONFIG_ARCH_SHMOBILE_MULTI-i.patch b/patches.renesas/0157-ARM-shmobile-R-Car-Gen2-CONFIG_ARCH_SHMOBILE_MULTI-i.patch
deleted file mode 100644
index 5d2ede710d4a79..00000000000000
--- a/patches.renesas/0157-ARM-shmobile-R-Car-Gen2-CONFIG_ARCH_SHMOBILE_MULTI-i.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From f3b32d2dca3eac73844700d1e4e50a9a75cb52f3 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:34:20 +0200
-Subject: [PATCH 157/326] ARM: shmobile: R-Car Gen2: CONFIG_ARCH_SHMOBILE_MULTI
- is always set
-
-Since commit e042681894b62d60 ("ARM: shmobile: r8a7790: Remove legacy
-code"), all R-Car Gen2 SoCs are supported by multiplatform kernels only.
-As CONFIG_ARCH_SHMOBILE_MULTI is always set for shmobile multiplatform
-kernels, we can remove related #ifdefs in code specific to R-Car Gen2
-SoCs.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit d62ba10c31ac16aaa16f5b49308658ea2f1e71a9)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/setup-rcar-gen2.c | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
-index 5d13595aa027..aa3339258d9c 100644
---- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
-+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
-@@ -128,9 +128,7 @@ void __init rcar_gen2_timer_init(void)
- #endif /* CONFIG_ARM_ARCH_TIMER */
-
- rcar_gen2_clocks_init(mode);
--#ifdef CONFIG_ARCH_SHMOBILE_MULTI
- clocksource_of_init();
--#endif
- }
-
- struct memory_reserve_config {
---
-2.6.2
-
diff --git a/patches.renesas/0158-ARM-shmobile-timer-r8a73a4-and-r8a7790-are-multi-pla.patch b/patches.renesas/0158-ARM-shmobile-timer-r8a73a4-and-r8a7790-are-multi-pla.patch
deleted file mode 100644
index d290e725891b41..00000000000000
--- a/patches.renesas/0158-ARM-shmobile-timer-r8a73a4-and-r8a7790-are-multi-pla.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 31eb9518c561d5e995f7c9ce22d0ae134403d983 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 11:34:21 +0200
-Subject: [PATCH 158/326] ARM: shmobile: timer: r8a73a4 and r8a7790 are
- multi-platform only
-
-Since commits e042681894b62d60 ("ARM: shmobile: r8a7790: Remove legacy
-code") and 9d07d414d4c33d86 ("ARM: shmobile: r8a73a4: ape6evm: Remove
-legacy platform"), the R-Mobile APE6 and R-Car H2 SoCs are supported by
-multiplatform kernels only.
-Hence we can drop checks for these SoCs in legacy kernel builds.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 20834a406ee20b57c796f9911f06600b71c75788)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/timer.c | 12 ------------
- 1 file changed, 12 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
-index 0edf2a6d2bbe..f1d027aa7a81 100644
---- a/arch/arm/mach-shmobile/timer.c
-+++ b/arch/arm/mach-shmobile/timer.c
-@@ -70,18 +70,6 @@ void __init shmobile_init_delay(void)
- if (!max_freq)
- return;
-
--#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
-- /* Non-multiplatform r8a73a4 SoC cannot use arch timer due
-- * to GIC being initialized from C and arch timer via DT */
-- if (of_machine_is_compatible("renesas,r8a73a4"))
-- has_arch_timer = false;
--
-- /* Non-multiplatform r8a7790 SoC cannot use arch timer due
-- * to GIC being initialized from C and arch timer via DT */
-- if (of_machine_is_compatible("renesas,r8a7790"))
-- has_arch_timer = false;
--#endif
--
- if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) {
- if (is_a7_a8_a9)
- shmobile_setup_delay_hz(max_freq, 1, 3);
---
-2.6.2
-
diff --git a/patches.renesas/0159-ARM-shmobile-Enable-gose-board-in-multiplatform-defc.patch b/patches.renesas/0159-ARM-shmobile-Enable-gose-board-in-multiplatform-defc.patch
deleted file mode 100644
index 85dd4a5c37f0e6..00000000000000
--- a/patches.renesas/0159-ARM-shmobile-Enable-gose-board-in-multiplatform-defc.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 4bf4188fa15a2cba131b42a836f0542fdc2fb233 Mon Sep 17 00:00:00 2001
-From: Simon Horman <horms+renesas@verge.net.au>
-Date: Tue, 2 Jun 2015 10:34:36 +0900
-Subject: [PATCH 159/326] ARM: shmobile: Enable gose board in multiplatform
- defconfig
-
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit b059be7ecfa80550f635194f7c12578423177729)
-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 9961fbd633f8..c8e9caeb1c02 100644
---- a/arch/arm/configs/shmobile_defconfig
-+++ b/arch/arm/configs/shmobile_defconfig
-@@ -18,6 +18,7 @@ CONFIG_ARCH_R8A7778=y
- CONFIG_ARCH_R8A7779=y
- CONFIG_ARCH_R8A7790=y
- CONFIG_ARCH_R8A7791=y
-+CONFIG_ARCH_R8A7793=y
- CONFIG_ARCH_R8A7794=y
- CONFIG_ARCH_SH73A0=y
- CONFIG_MACH_MARZEN=y
---
-2.6.2
-
diff --git a/patches.renesas/0160-ARM-shmobile-add-r8a7793-minimal-SoC-device-tree.patch b/patches.renesas/0160-ARM-shmobile-add-r8a7793-minimal-SoC-device-tree.patch
deleted file mode 100644
index edf91420df4163..00000000000000
--- a/patches.renesas/0160-ARM-shmobile-add-r8a7793-minimal-SoC-device-tree.patch
+++ /dev/null
@@ -1,567 +0,0 @@
-From 02214f50f6f4bf271bee3776bdb8b4532eb186cd Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Mon, 1 Jun 2015 16:22:55 +0200
-Subject: [PATCH 160/326] ARM: shmobile: add r8a7793 minimal SoC device tree
-
-Minimal r8a7793 device tree including one CPU core, interrupt controllers,
-timers, two serial ports, and the Ethernet controller, plus the required
-clock descriptions.
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 0e03e8aed92ce4757a9dbfbf2b7f4edce6380f92)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7793.dtsi | 367 ++++++++++++++++++++++++++++++
- include/dt-bindings/clock/r8a7793-clock.h | 164 +++++++++++++
- 2 files changed, 531 insertions(+)
- create mode 100644 arch/arm/boot/dts/r8a7793.dtsi
- create mode 100644 include/dt-bindings/clock/r8a7793-clock.h
-
-diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
-new file mode 100644
-index 000000000000..c50c5f65388a
---- /dev/null
-+++ b/arch/arm/boot/dts/r8a7793.dtsi
-@@ -0,0 +1,367 @@
-+/*
-+ * Device Tree Source for the r8a7793 SoC
-+ *
-+ * Copyright (C) 2014-2015 Renesas Electronics Corporation
-+ *
-+ * 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.
-+ */
-+
-+#include <dt-bindings/clock/r8a7793-clock.h>
-+#include <dt-bindings/interrupt-controller/arm-gic.h>
-+#include <dt-bindings/interrupt-controller/irq.h>
-+
-+/ {
-+ compatible = "renesas,r8a7793";
-+ interrupt-parent = <&gic>;
-+ #address-cells = <2>;
-+ #size-cells = <2>;
-+
-+ cpus {
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+
-+ cpu0: cpu@0 {
-+ device_type = "cpu";
-+ compatible = "arm,cortex-a15";
-+ reg = <0>;
-+ clock-frequency = <1500000000>;
-+ voltage-tolerance = <1>; /* 1% */
-+ clocks = <&cpg_clocks R8A7793_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>;
-+ };
-+ };
-+
-+ gic: interrupt-controller@f1001000 {
-+ compatible = "arm,cortex-a15-gic";
-+ #interrupt-cells = <3>;
-+ #address-cells = <0>;
-+ interrupt-controller;
-+ reg = <0 0xf1001000 0 0x1000>,
-+ <0 0xf1002000 0 0x1000>,
-+ <0 0xf1004000 0 0x2000>,
-+ <0 0xf1006000 0 0x2000>;
-+ interrupts = <1 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
-+ };
-+
-+ timer {
-+ compatible = "arm,armv7-timer";
-+ interrupts = <1 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
-+ <1 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
-+ <1 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
-+ <1 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>;
-+ };
-+
-+ cmt0: timer@ffca0000 {
-+ compatible = "renesas,cmt-48-r8a7793", "renesas,cmt-48-gen2";
-+ reg = <0 0xffca0000 0 0x1004>;
-+ interrupts = <0 142 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 143 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp1_clks R8A7793_CLK_CMT0>;
-+ clock-names = "fck";
-+
-+ renesas,channels-mask = <0x60>;
-+
-+ status = "disabled";
-+ };
-+
-+ cmt1: timer@e6130000 {
-+ compatible = "renesas,cmt-48-r8a7793", "renesas,cmt-48-gen2";
-+ reg = <0 0xe6130000 0 0x1004>;
-+ interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 121 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 122 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 123 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 124 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 125 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 126 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 127 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp3_clks R8A7793_CLK_CMT1>;
-+ clock-names = "fck";
-+
-+ renesas,channels-mask = <0xff>;
-+
-+ status = "disabled";
-+ };
-+
-+ irqc0: interrupt-controller@e61c0000 {
-+ compatible = "renesas,irqc-r8a7793", "renesas,irqc";
-+ #interrupt-cells = <2>;
-+ interrupt-controller;
-+ reg = <0 0xe61c0000 0 0x200>;
-+ interrupts = <0 0 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 1 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 2 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 3 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 12 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 13 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 14 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 15 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 16 IRQ_TYPE_LEVEL_HIGH>,
-+ <0 17 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp4_clks R8A7793_CLK_IRQC>;
-+ };
-+
-+ scif0: serial@e6e60000 {
-+ compatible = "renesas,scif-r8a7793", "renesas,scif";
-+ reg = <0 0xe6e60000 0 64>;
-+ interrupts = <0 152 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp7_clks R8A7793_CLK_SCIF0>;
-+ clock-names = "sci_ick";
-+ status = "disabled";
-+ };
-+
-+ scif1: serial@e6e68000 {
-+ compatible = "renesas,scif-r8a7793", "renesas,scif";
-+ reg = <0 0xe6e68000 0 64>;
-+ interrupts = <0 153 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp7_clks R8A7793_CLK_SCIF1>;
-+ clock-names = "sci_ick";
-+ status = "disabled";
-+ };
-+
-+ ether: ethernet@ee700000 {
-+ compatible = "renesas,ether-r8a7793";
-+ reg = <0 0xee700000 0 0x400>;
-+ interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp8_clks R8A7793_CLK_ETHER>;
-+ phy-mode = "rmii";
-+ #address-cells = <1>;
-+ #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 overridden by the board. */
-+ clock-frequency = <0>;
-+ clock-output-names = "extal";
-+ };
-+
-+ /* Special CPG clocks */
-+ cpg_clocks: cpg_clocks@e6150000 {
-+ compatible = "renesas,r8a7793-cpg-clocks",
-+ "renesas,rcar-gen2-cpg-clocks";
-+ reg = <0 0xe6150000 0 0x1000>;
-+ clocks = <&extal_clk>;
-+ #clock-cells = <1>;
-+ clock-output-names = "main", "pll0", "pll1", "pll3",
-+ "lb", "qspi", "sdh", "sd0", "z",
-+ "rcan", "adsp";
-+ };
-+
-+ /* Variable factor clocks */
-+ sd2_clk: sd2_clk@e6150078 {
-+ compatible = "renesas,r8a7793-div6-clock",
-+ "renesas,cpg-div6-clock";
-+ reg = <0 0xe6150078 0 4>;
-+ clocks = <&pll1_div2_clk>;
-+ #clock-cells = <0>;
-+ clock-output-names = "sd2";
-+ };
-+ sd3_clk: sd3_clk@e615026c {
-+ compatible = "renesas,r8a7793-div6-clock",
-+ "renesas,cpg-div6-clock";
-+ reg = <0 0xe615026c 0 4>;
-+ clocks = <&pll1_div2_clk>;
-+ #clock-cells = <0>;
-+ clock-output-names = "sd3";
-+ };
-+ mmc0_clk: mmc0_clk@e6150240 {
-+ compatible = "renesas,r8a7793-div6-clock",
-+ "renesas,cpg-div6-clock";
-+ reg = <0 0xe6150240 0 4>;
-+ clocks = <&pll1_div2_clk>;
-+ #clock-cells = <0>;
-+ clock-output-names = "mmc0";
-+ };
-+
-+ /* Fixed factor clocks */
-+ pll1_div2_clk: pll1_div2_clk {
-+ compatible = "fixed-factor-clock";
-+ clocks = <&cpg_clocks R8A7793_CLK_PLL1>;
-+ #clock-cells = <0>;
-+ clock-div = <2>;
-+ clock-mult = <1>;
-+ clock-output-names = "pll1_div2";
-+ };
-+ zg_clk: zg_clk {
-+ compatible = "fixed-factor-clock";
-+ clocks = <&cpg_clocks R8A7793_CLK_PLL1>;
-+ #clock-cells = <0>;
-+ clock-div = <5>;
-+ clock-mult = <1>;
-+ clock-output-names = "zg";
-+ };
-+ zx_clk: zx_clk {
-+ compatible = "fixed-factor-clock";
-+ clocks = <&cpg_clocks R8A7793_CLK_PLL1>;
-+ #clock-cells = <0>;
-+ clock-div = <3>;
-+ clock-mult = <1>;
-+ clock-output-names = "zx";
-+ };
-+ zs_clk: zs_clk {
-+ compatible = "fixed-factor-clock";
-+ clocks = <&cpg_clocks R8A7793_CLK_PLL1>;
-+ #clock-cells = <0>;
-+ clock-div = <6>;
-+ clock-mult = <1>;
-+ clock-output-names = "zs";
-+ };
-+ hp_clk: hp_clk {
-+ compatible = "fixed-factor-clock";
-+ clocks = <&cpg_clocks R8A7793_CLK_PLL1>;
-+ #clock-cells = <0>;
-+ clock-div = <12>;
-+ clock-mult = <1>;
-+ clock-output-names = "hp";
-+ };
-+ p_clk: p_clk {
-+ compatible = "fixed-factor-clock";
-+ clocks = <&cpg_clocks R8A7793_CLK_PLL1>;
-+ #clock-cells = <0>;
-+ clock-div = <24>;
-+ clock-mult = <1>;
-+ clock-output-names = "p";
-+ };
-+ rclk_clk: rclk_clk {
-+ compatible = "fixed-factor-clock";
-+ clocks = <&cpg_clocks R8A7793_CLK_PLL1>;
-+ #clock-cells = <0>;
-+ clock-div = <(48 * 1024)>;
-+ clock-mult = <1>;
-+ clock-output-names = "rclk";
-+ };
-+ mp_clk: mp_clk {
-+ compatible = "fixed-factor-clock";
-+ clocks = <&pll1_div2_clk>;
-+ #clock-cells = <0>;
-+ clock-div = <15>;
-+ clock-mult = <1>;
-+ clock-output-names = "mp";
-+ };
-+ cp_clk: cp_clk {
-+ compatible = "fixed-factor-clock";
-+ clocks = <&extal_clk>;
-+ #clock-cells = <0>;
-+ clock-div = <2>;
-+ clock-mult = <1>;
-+ clock-output-names = "cp";
-+ };
-+
-+ /* Gate clocks */
-+ mstp1_clks: mstp1_clks@e6150134 {
-+ compatible = "renesas,r8a7793-mstp-clocks",
-+ "renesas,cpg-mstp-clocks";
-+ reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>;
-+ clocks = <&zs_clk>, <&zs_clk>, <&zs_clk>, <&p_clk>,
-+ <&zg_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>,
-+ <&p_clk>, <&p_clk>, <&rclk_clk>, <&cp_clk>,
-+ <&zs_clk>, <&zs_clk>, <&zs_clk>;
-+ #clock-cells = <1>;
-+ clock-indices = <
-+ R8A7793_CLK_VCP0 R8A7793_CLK_VPC0
-+ R8A7793_CLK_SSP1 R8A7793_CLK_TMU1
-+ R8A7793_CLK_3DG R8A7793_CLK_2DDMAC
-+ R8A7793_CLK_FDP1_1 R8A7793_CLK_FDP1_0
-+ R8A7793_CLK_TMU3 R8A7793_CLK_TMU2
-+ R8A7793_CLK_CMT0 R8A7793_CLK_TMU0
-+ R8A7793_CLK_VSP1_DU1 R8A7793_CLK_VSP1_DU0
-+ R8A7793_CLK_VSP1_S
-+ >;
-+ clock-output-names =
-+ "vcp0", "vpc0", "ssp_dev", "tmu1",
-+ "pvrsrvkm", "tddmac", "fdp1", "fdp0",
-+ "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1",
-+ "vsp1-du0", "vsps";
-+ };
-+ mstp3_clks: mstp3_clks@e615013c {
-+ compatible = "renesas,r8a7793-mstp-clocks",
-+ "renesas,cpg-mstp-clocks";
-+ reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
-+ clocks = <&cp_clk>, <&sd3_clk>, <&sd2_clk>,
-+ <&cpg_clocks R8A7793_CLK_SD0>, <&mmc0_clk>,
-+ <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>,
-+ <&rclk_clk>, <&hp_clk>, <&hp_clk>;
-+ #clock-cells = <1>;
-+ clock-indices = <
-+ R8A7793_CLK_TPU0 R8A7793_CLK_SDHI2
-+ R8A7793_CLK_SDHI1 R8A7793_CLK_SDHI0
-+ R8A7793_CLK_MMCIF0 R8A7793_CLK_IIC0
-+ R8A7793_CLK_PCIEC R8A7793_CLK_IIC1
-+ R8A7793_CLK_SSUSB R8A7793_CLK_CMT1
-+ R8A7793_CLK_USBDMAC0 R8A7793_CLK_USBDMAC1
-+ >;
-+ clock-output-names =
-+ "tpu0", "sdhi2", "sdhi1", "sdhi0", "mmcif0",
-+ "i2c7", "pciec", "i2c8", "ssusb", "cmt1",
-+ "usbdmac0", "usbdmac1";
-+ };
-+ mstp4_clks: mstp4_clks@e6150140 {
-+ compatible = "renesas,r8a7793-mstp-clocks", "renesas,cpg-mstp-clocks";
-+ reg = <0 0xe6150140 0 4>, <0 0xe615004c 0 4>;
-+ clocks = <&cp_clk>;
-+ #clock-cells = <1>;
-+ clock-indices = <R8A7793_CLK_IRQC>;
-+ clock-output-names = "irqc";
-+ };
-+ mstp7_clks: mstp7_clks@e615014c {
-+ compatible = "renesas,r8a7793-mstp-clocks",
-+ "renesas,cpg-mstp-clocks";
-+ reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>;
-+ clocks = <&mp_clk>, <&hp_clk>, <&zs_clk>, <&p_clk>,
-+ <&p_clk>, <&zs_clk>, <&zs_clk>, <&p_clk>,
-+ <&p_clk>, <&p_clk>, <&p_clk>, <&zx_clk>,
-+ <&zx_clk>, <&zx_clk>;
-+ #clock-cells = <1>;
-+ clock-indices = <
-+ R8A7793_CLK_EHCI R8A7793_CLK_HSUSB
-+ R8A7793_CLK_HSCIF2 R8A7793_CLK_SCIF5
-+ R8A7793_CLK_SCIF4 R8A7793_CLK_HSCIF1
-+ R8A7793_CLK_HSCIF0 R8A7793_CLK_SCIF3
-+ R8A7793_CLK_SCIF2 R8A7793_CLK_SCIF1
-+ R8A7793_CLK_SCIF0 R8A7793_CLK_DU1
-+ R8A7793_CLK_DU0 R8A7793_CLK_LVDS0
-+ >;
-+ clock-output-names =
-+ "ehci", "hsusb", "hscif2", "scif5", "scif4",
-+ "hscif1", "hscif0", "scif3", "scif2",
-+ "scif1", "scif0", "du1", "du0", "lvds0";
-+ };
-+ mstp8_clks: mstp8_clks@e6150990 {
-+ compatible = "renesas,r8a7793-mstp-clocks",
-+ "renesas,cpg-mstp-clocks";
-+ reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>;
-+ clocks = <&zx_clk>, <&zg_clk>, <&zg_clk>, <&zg_clk>,
-+ <&p_clk>, <&zs_clk>, <&zs_clk>;
-+ #clock-cells = <1>;
-+ clock-indices = <
-+ R8A7793_CLK_IPMMU_SGX R8A7793_CLK_VIN2
-+ R8A7793_CLK_VIN1 R8A7793_CLK_VIN0
-+ R8A7793_CLK_ETHER R8A7793_CLK_SATA1
-+ R8A7793_CLK_SATA0
-+ >;
-+ clock-output-names =
-+ "ipmmu_sgx", "vin2", "vin1", "vin0", "ether",
-+ "sata1", "sata0";
-+ };
-+ };
-+
-+};
-diff --git a/include/dt-bindings/clock/r8a7793-clock.h b/include/dt-bindings/clock/r8a7793-clock.h
-new file mode 100644
-index 000000000000..1579e07f96a3
---- /dev/null
-+++ b/include/dt-bindings/clock/r8a7793-clock.h
-@@ -0,0 +1,164 @@
-+/*
-+ * r8a7793 clock definition
-+ *
-+ * 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 as published by
-+ * the Free Software Foundation; version 2 of the License.
-+ *
-+ * 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 __DT_BINDINGS_CLOCK_R8A7793_H__
-+#define __DT_BINDINGS_CLOCK_R8A7793_H__
-+
-+/* CPG */
-+#define R8A7793_CLK_MAIN 0
-+#define R8A7793_CLK_PLL0 1
-+#define R8A7793_CLK_PLL1 2
-+#define R8A7793_CLK_PLL3 3
-+#define R8A7793_CLK_LB 4
-+#define R8A7793_CLK_QSPI 5
-+#define R8A7793_CLK_SDH 6
-+#define R8A7793_CLK_SD0 7
-+#define R8A7793_CLK_Z 8
-+#define R8A7793_CLK_RCAN 9
-+#define R8A7793_CLK_ADSP 10
-+
-+/* MSTP0 */
-+#define R8A7793_CLK_MSIOF0 0
-+
-+/* MSTP1 */
-+#define R8A7793_CLK_VCP0 1
-+#define R8A7793_CLK_VPC0 3
-+#define R8A7793_CLK_SSP1 9
-+#define R8A7793_CLK_TMU1 11
-+#define R8A7793_CLK_3DG 12
-+#define R8A7793_CLK_2DDMAC 15
-+#define R8A7793_CLK_FDP1_1 18
-+#define R8A7793_CLK_FDP1_0 19
-+#define R8A7793_CLK_TMU3 21
-+#define R8A7793_CLK_TMU2 22
-+#define R8A7793_CLK_CMT0 24
-+#define R8A7793_CLK_TMU0 25
-+#define R8A7793_CLK_VSP1_DU1 27
-+#define R8A7793_CLK_VSP1_DU0 28
-+#define R8A7793_CLK_VSP1_S 31
-+
-+/* MSTP2 */
-+#define R8A7793_CLK_SCIFA2 2
-+#define R8A7793_CLK_SCIFA1 3
-+#define R8A7793_CLK_SCIFA0 4
-+#define R8A7793_CLK_MSIOF2 5
-+#define R8A7793_CLK_SCIFB0 6
-+#define R8A7793_CLK_SCIFB1 7
-+#define R8A7793_CLK_MSIOF1 8
-+#define R8A7793_CLK_SCIFB2 16
-+#define R8A7793_CLK_SYS_DMAC1 18
-+#define R8A7793_CLK_SYS_DMAC0 19
-+
-+/* MSTP3 */
-+#define R8A7793_CLK_TPU0 4
-+#define R8A7793_CLK_SDHI2 11
-+#define R8A7793_CLK_SDHI1 12
-+#define R8A7793_CLK_SDHI0 14
-+#define R8A7793_CLK_MMCIF0 15
-+#define R8A7793_CLK_IIC0 18
-+#define R8A7793_CLK_PCIEC 19
-+#define R8A7793_CLK_IIC1 23
-+#define R8A7793_CLK_SSUSB 28
-+#define R8A7793_CLK_CMT1 29
-+#define R8A7793_CLK_USBDMAC0 30
-+#define R8A7793_CLK_USBDMAC1 31
-+
-+/* MSTP4 */
-+#define R8A7793_CLK_IRQC 7
-+
-+/* MSTP5 */
-+#define R8A7793_CLK_AUDIO_DMAC1 1
-+#define R8A7793_CLK_AUDIO_DMAC0 2
-+#define R8A7793_CLK_ADSP_MOD 6
-+#define R8A7793_CLK_THERMAL 22
-+#define R8A7793_CLK_PWM 23
-+
-+/* MSTP7 */
-+#define R8A7793_CLK_EHCI 3
-+#define R8A7793_CLK_HSUSB 4
-+#define R8A7793_CLK_HSCIF2 13
-+#define R8A7793_CLK_SCIF5 14
-+#define R8A7793_CLK_SCIF4 15
-+#define R8A7793_CLK_HSCIF1 16
-+#define R8A7793_CLK_HSCIF0 17
-+#define R8A7793_CLK_SCIF3 18
-+#define R8A7793_CLK_SCIF2 19
-+#define R8A7793_CLK_SCIF1 20
-+#define R8A7793_CLK_SCIF0 21
-+#define R8A7793_CLK_DU1 23
-+#define R8A7793_CLK_DU0 24
-+#define R8A7793_CLK_LVDS0 26
-+
-+/* MSTP8 */
-+#define R8A7793_CLK_IPMMU_SGX 0
-+#define R8A7793_CLK_VIN2 9
-+#define R8A7793_CLK_VIN1 10
-+#define R8A7793_CLK_VIN0 11
-+#define R8A7793_CLK_ETHER 13
-+#define R8A7793_CLK_SATA1 14
-+#define R8A7793_CLK_SATA0 15
-+
-+/* MSTP9 */
-+#define R8A7793_CLK_GPIO7 4
-+#define R8A7793_CLK_GPIO6 5
-+#define R8A7793_CLK_GPIO5 7
-+#define R8A7793_CLK_GPIO4 8
-+#define R8A7793_CLK_GPIO3 9
-+#define R8A7793_CLK_GPIO2 10
-+#define R8A7793_CLK_GPIO1 11
-+#define R8A7793_CLK_GPIO0 12
-+#define R8A7793_CLK_RCAN1 15
-+#define R8A7793_CLK_RCAN0 16
-+#define R8A7793_CLK_QSPI_MOD 17
-+#define R8A7793_CLK_I2C5 25
-+#define R8A7793_CLK_IICDVFS 26
-+#define R8A7793_CLK_I2C4 27
-+#define R8A7793_CLK_I2C3 28
-+#define R8A7793_CLK_I2C2 29
-+#define R8A7793_CLK_I2C1 30
-+#define R8A7793_CLK_I2C0 31
-+
-+/* MSTP10 */
-+#define R8A7793_CLK_SSI_ALL 5
-+#define R8A7793_CLK_SSI9 6
-+#define R8A7793_CLK_SSI8 7
-+#define R8A7793_CLK_SSI7 8
-+#define R8A7793_CLK_SSI6 9
-+#define R8A7793_CLK_SSI5 10
-+#define R8A7793_CLK_SSI4 11
-+#define R8A7793_CLK_SSI3 12
-+#define R8A7793_CLK_SSI2 13
-+#define R8A7793_CLK_SSI1 14
-+#define R8A7793_CLK_SSI0 15
-+#define R8A7793_CLK_SCU_ALL 17
-+#define R8A7793_CLK_SCU_DVC1 18
-+#define R8A7793_CLK_SCU_DVC0 19
-+#define R8A7793_CLK_SCU_SRC9 22
-+#define R8A7793_CLK_SCU_SRC8 23
-+#define R8A7793_CLK_SCU_SRC7 24
-+#define R8A7793_CLK_SCU_SRC6 25
-+#define R8A7793_CLK_SCU_SRC5 26
-+#define R8A7793_CLK_SCU_SRC4 27
-+#define R8A7793_CLK_SCU_SRC3 28
-+#define R8A7793_CLK_SCU_SRC2 29
-+#define R8A7793_CLK_SCU_SRC1 30
-+#define R8A7793_CLK_SCU_SRC0 31
-+
-+/* MSTP11 */
-+#define R8A7793_CLK_SCIFA3 6
-+#define R8A7793_CLK_SCIFA4 7
-+#define R8A7793_CLK_SCIFA5 8
-+
-+#endif /* __DT_BINDINGS_CLOCK_R8A7793_H__ */
---
-2.6.2
-
diff --git a/patches.renesas/0161-ARM-shmobile-r8a7793-add-minimal-Gose-board-device-t.patch b/patches.renesas/0161-ARM-shmobile-r8a7793-add-minimal-Gose-board-device-t.patch
deleted file mode 100644
index 65a61875e18d41..00000000000000
--- a/patches.renesas/0161-ARM-shmobile-r8a7793-add-minimal-Gose-board-device-t.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 3c1f622d64c4dfee3bcc26f5f4a0b8ba594ca4a9 Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Mon, 1 Jun 2015 16:22:56 +0200
-Subject: [PATCH 161/326] ARM: shmobile: r8a7793: add minimal Gose board device
- tree
-
-Minimal DT description and Makefile entry for the Gose eval board.
-Support for console, timer, and Ethernet.
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit b8af4591db5bb0529b7f56d25b2e7db3eb71fdf6)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/Makefile | 1 +
- arch/arm/boot/dts/r8a7793-gose.dts | 63 ++++++++++++++++++++++++++++++++++++++
- 2 files changed, 64 insertions(+)
- create mode 100644 arch/arm/boot/dts/r8a7793-gose.dts
-
-diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
-index e13fff1bfa97..908fcbf656c1 100644
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -490,6 +490,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += \
- r8a7790-lager.dtb \
- r8a7791-henninger.dtb \
- r8a7791-koelsch.dtb \
-+ r8a7793-gose.dtb \
- r8a7794-alt.dtb \
- sh73a0-kzm9g.dtb
- dtb-$(CONFIG_ARCH_SOCFPGA) += \
-diff --git a/arch/arm/boot/dts/r8a7793-gose.dts b/arch/arm/boot/dts/r8a7793-gose.dts
-new file mode 100644
-index 000000000000..96443ec5f6ab
---- /dev/null
-+++ b/arch/arm/boot/dts/r8a7793-gose.dts
-@@ -0,0 +1,63 @@
-+/*
-+ * Device Tree Source for the Gose board
-+ *
-+ * Copyright (C) 2014-2015 Renesas Electronics Corporation
-+ *
-+ * 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 "r8a7793.dtsi"
-+#include <dt-bindings/gpio/gpio.h>
-+#include <dt-bindings/input/input.h>
-+
-+/ {
-+ model = "Gose";
-+ compatible = "renesas,gose", "renesas,r8a7793";
-+
-+ aliases {
-+ serial0 = &scif0;
-+ serial1 = &scif1;
-+ };
-+
-+ chosen {
-+ bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
-+ stdout-path = &scif0;
-+ };
-+
-+ memory@40000000 {
-+ device_type = "memory";
-+ reg = <0 0x40000000 0 0x40000000>;
-+ };
-+};
-+
-+&extal_clk {
-+ clock-frequency = <20000000>;
-+};
-+
-+&ether {
-+ phy-handle = <&phy1>;
-+ renesas,ether-link-active-low;
-+ status = "okay";
-+
-+ phy1: ethernet-phy@1 {
-+ reg = <1>;
-+ interrupt-parent = <&irqc0>;
-+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-+ micrel,led-mode = <1>;
-+ };
-+};
-+
-+&cmt0 {
-+ status = "okay";
-+};
-+
-+&scif0 {
-+ status = "okay";
-+};
-+
-+&scif1 {
-+ status = "okay";
-+};
---
-2.6.2
-
diff --git a/patches.renesas/0162-ARM-shmobile-r8a7790-add-EtherAVB-clocks.patch b/patches.renesas/0162-ARM-shmobile-r8a7790-add-EtherAVB-clocks.patch
deleted file mode 100644
index e8b01c0717ed93..00000000000000
--- a/patches.renesas/0162-ARM-shmobile-r8a7790-add-EtherAVB-clocks.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 72f66f2497ba6fbfd4c0dd4522b5eab8da8f3a16 Mon Sep 17 00:00:00 2001
-From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Date: Tue, 16 Jun 2015 02:42:42 +0300
-Subject: [PATCH 162/326] ARM: shmobile: r8a7790: add EtherAVB clocks
-
-Add the EtherAVB clock to the R8A7790 device tree.
-
-Based on original patch by Mitsuhiro Kimura <mitsuhiro.kimura.kc@renesas.com>.
-
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 63d2d750c902dec77439f12b2eac9709468298ce)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 10 ++++++----
- include/dt-bindings/clock/r8a7790-clock.h | 1 +
- 2 files changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index 51ab8865ea37..feb4652ed4b2 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -1249,16 +1249,18 @@
- compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
- reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>;
- clocks = <&hp_clk>, <&zg_clk>, <&zg_clk>, <&zg_clk>,
-- <&zg_clk>, <&p_clk>, <&zs_clk>, <&zs_clk>;
-+ <&zg_clk>, <&hp_clk>, <&p_clk>, <&zs_clk>,
-+ <&zs_clk>;
- #clock-cells = <1>;
- clock-indices = <
- R8A7790_CLK_MLB R8A7790_CLK_VIN3 R8A7790_CLK_VIN2
-- R8A7790_CLK_VIN1 R8A7790_CLK_VIN0 R8A7790_CLK_ETHER
-+ R8A7790_CLK_VIN1 R8A7790_CLK_VIN0
-+ R8A7790_CLK_ETHERAVB R8A7790_CLK_ETHER
- R8A7790_CLK_SATA1 R8A7790_CLK_SATA0
- >;
- clock-output-names =
-- "mlb", "vin3", "vin2", "vin1", "vin0", "ether",
-- "sata1", "sata0";
-+ "mlb", "vin3", "vin2", "vin1", "vin0",
-+ "etheravb", "ether", "sata1", "sata0";
- };
- mstp9_clks: mstp9_clks@e6150994 {
- 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 ff7ca3584e16..e119ef372ba3 100644
---- a/include/dt-bindings/clock/r8a7790-clock.h
-+++ b/include/dt-bindings/clock/r8a7790-clock.h
-@@ -108,6 +108,7 @@
- #define R8A7790_CLK_VIN2 9
- #define R8A7790_CLK_VIN1 10
- #define R8A7790_CLK_VIN0 11
-+#define R8A7790_CLK_ETHERAVB 12
- #define R8A7790_CLK_ETHER 13
- #define R8A7790_CLK_SATA1 14
- #define R8A7790_CLK_SATA0 15
---
-2.6.2
-
diff --git a/patches.renesas/0163-ARM-shmobile-r8a7790-add-EtherAVB-DT-support.patch b/patches.renesas/0163-ARM-shmobile-r8a7790-add-EtherAVB-DT-support.patch
deleted file mode 100644
index 63a290bd677124..00000000000000
--- a/patches.renesas/0163-ARM-shmobile-r8a7790-add-EtherAVB-DT-support.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 6ae35daadb510f5735c918fcbe1e474fb89b7c19 Mon Sep 17 00:00:00 2001
-From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Date: Tue, 16 Jun 2015 02:43:51 +0300
-Subject: [PATCH 163/326] ARM: shmobile: r8a7790: add EtherAVB DT support
-
-Define the generic R8A7790 part of the EtherAVB device node.
-
-Based on original patch by Mitsuhiro Kimura <mitsuhiro.kimura.kc@renesas.com>.
-
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit f25d6b977240117eb4b6e3111f4eb41f968d28fb)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index feb4652ed4b2..c9aae06319c0 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -671,6 +671,16 @@
- status = "disabled";
- };
-
-+ avb: ethernet@e6800000 {
-+ compatible = "renesas,etheravb-r8a7790";
-+ reg = <0 0xe6800000 0 0x800>, <0 0xee0e8000 0 0x4000>;
-+ interrupts = <0 163 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp8_clks R8A7790_CLK_ETHERAVB>;
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ };
-+
- sata0: sata@ee300000 {
- compatible = "renesas,sata-r8a7790";
- reg = <0 0xee300000 0 0x2000>;
---
-2.6.2
-
diff --git a/patches.renesas/0164-ARM-shmobile-armadillo800eva-dts-Add-pinctrl-and-gpi.patch b/patches.renesas/0164-ARM-shmobile-armadillo800eva-dts-Add-pinctrl-and-gpi.patch
deleted file mode 100644
index a57732348f2ea2..00000000000000
--- a/patches.renesas/0164-ARM-shmobile-armadillo800eva-dts-Add-pinctrl-and-gpi.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 51bcd06769df2338b4624611d8bbf5ef14a7afde Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 10:38:56 +0200
-Subject: [PATCH 164/326] ARM: shmobile: armadillo800eva dts: Add pinctrl and
- gpio-hog for lcdc0
-
-Configure pinctrl and a GPIO-controller board mux for LCD use.
-This allows the armadillo800eva board staging code to enable lcdc0.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit ffd2f9a5afb730b9f6c1d1938934213c3cfcf249)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7740-armadillo800eva.dts | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
-index 2e31d8c01cbf..105d9c95de4a 100644
---- a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
-+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
-@@ -224,6 +224,9 @@
- };
-
- &pfc {
-+ pinctrl-0 = <&lcd0_pins>;
-+ pinctrl-names = "default";
-+
- ether_pins: ether {
- renesas,groups = "gether_mii", "gether_int";
- renesas,function = "gether";
-@@ -259,6 +262,16 @@
- "fsia_data_in_1", "fsia_data_out_0";
- renesas,function = "fsia";
- };
-+
-+ lcd0_pins: lcd0 {
-+ renesas,groups = "lcd0_data24_0", "lcd0_lclk_1", "lcd0_sync";
-+ renesas,function = "lcd0";
-+
-+ /* DBGMD/LCDC0/FSIA MUX */
-+ gpio-hog;
-+ gpios = <176 0>;
-+ output-high;
-+ };
- };
-
- &tpu {
---
-2.6.2
-
diff --git a/patches.renesas/0165-ARM-shmobile-r8a73a4-dtsi-Use-arm-gic-400-for-GIC.patch b/patches.renesas/0165-ARM-shmobile-r8a73a4-dtsi-Use-arm-gic-400-for-GIC.patch
deleted file mode 100644
index a8a661d8501a41..00000000000000
--- a/patches.renesas/0165-ARM-shmobile-r8a73a4-dtsi-Use-arm-gic-400-for-GIC.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 337411a2e28f983c61aa7138fd36abfe87434337 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 15:03:32 +0200
-Subject: [PATCH 165/326] ARM: shmobile: r8a73a4 dtsi: Use "arm,gic-400" for
- GIC
-
-Replace the "arm,cortex-a15-gic" compatible value for the GIC by
-"arm,gic-400", as the documentation states it's a GIC-400.
-This has been confirmed by reading the GICD_IIDR register, which reports
-0x0200043b (GIC-400 = 0x02, ARM = 0x43b).
-
-This has no effect on runtime behavior, as currently the GIC driver
-treats both compatible values the same.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit eaec1d675c194965081297014503938a9f58e2f7)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a73a4.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
-index 7ee22a41c6c9..5090d1a8f652 100644
---- a/arch/arm/boot/dts/r8a73a4.dtsi
-+++ b/arch/arm/boot/dts/r8a73a4.dtsi
-@@ -434,7 +434,7 @@
- };
-
- gic: interrupt-controller@f1001000 {
-- compatible = "arm,cortex-a15-gic";
-+ compatible = "arm,gic-400";
- #interrupt-cells = <3>;
- #address-cells = <0>;
- interrupt-controller;
---
-2.6.2
-
diff --git a/patches.renesas/0166-ARM-shmobile-r8a7790-dtsi-Use-arm-gic-400-for-GIC.patch b/patches.renesas/0166-ARM-shmobile-r8a7790-dtsi-Use-arm-gic-400-for-GIC.patch
deleted file mode 100644
index 0be55508fb568c..00000000000000
--- a/patches.renesas/0166-ARM-shmobile-r8a7790-dtsi-Use-arm-gic-400-for-GIC.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From e9ddf1d690f61c3c4c8a0165f9c7979873ecdab4 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 15:03:33 +0200
-Subject: [PATCH 166/326] ARM: shmobile: r8a7790 dtsi: Use "arm,gic-400" for
- GIC
-
-Replace the "arm,cortex-a15-gic" compatible value for the GIC by
-"arm,gic-400", as the R-Car Gen2 GIC is assumed to be a GIC-400.
-This has been confirmed by reading the GICD_IIDR register (on r8a7791),
-which reports 0x0200043b (GIC-400 = 0x02, ARM = 0x43b).
-
-This has no effect on runtime behavior, as currently the GIC driver
-treats both compatible values the same.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit e715e9c57826cc3370fc5fcdb9d57602d52bba9a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index c9aae06319c0..3ae0c3bfb9b9 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -113,7 +113,7 @@
- };
-
- gic: interrupt-controller@f1001000 {
-- compatible = "arm,cortex-a15-gic";
-+ compatible = "arm,gic-400";
- #interrupt-cells = <3>;
- #address-cells = <0>;
- interrupt-controller;
---
-2.6.2
-
diff --git a/patches.renesas/0167-ARM-shmobile-r8a7791-dtsi-Use-arm-gic-400-for-GIC.patch b/patches.renesas/0167-ARM-shmobile-r8a7791-dtsi-Use-arm-gic-400-for-GIC.patch
deleted file mode 100644
index 7516c9bcdc12cc..00000000000000
--- a/patches.renesas/0167-ARM-shmobile-r8a7791-dtsi-Use-arm-gic-400-for-GIC.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 03dc21d17cd0f8389fc8f0151fe3f065eebdd797 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 15:03:34 +0200
-Subject: [PATCH 167/326] ARM: shmobile: r8a7791 dtsi: Use "arm,gic-400" for
- GIC
-
-Replace the "arm,cortex-a15-gic" compatible value for the GIC by
-"arm,gic-400", as the R-Car Gen2 GIC is assumed to be a GIC-400.
-This has been confirmed by reading the GICD_IIDR register, which reports
-0x0200043b (GIC-400 = 0x02, ARM = 0x43b).
-
-This has no effect on runtime behavior, as currently the GIC driver
-treats both compatible values the same.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit d238b5e628c98c39fe669610e6ab8e06a6f00b5b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index dc1cd3f16606..07ea2bebe496 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -70,7 +70,7 @@
- };
-
- gic: interrupt-controller@f1001000 {
-- compatible = "arm,cortex-a15-gic";
-+ compatible = "arm,gic-400";
- #interrupt-cells = <3>;
- #address-cells = <0>;
- interrupt-controller;
---
-2.6.2
-
diff --git a/patches.renesas/0168-ARM-shmobile-r8a7793-dtsi-Use-arm-gic-400-for-GIC.patch b/patches.renesas/0168-ARM-shmobile-r8a7793-dtsi-Use-arm-gic-400-for-GIC.patch
deleted file mode 100644
index a52070d9bfbe4e..00000000000000
--- a/patches.renesas/0168-ARM-shmobile-r8a7793-dtsi-Use-arm-gic-400-for-GIC.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 3d8fecf49965104f90237a51f42a2afea8d6df8a Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 15:03:35 +0200
-Subject: [PATCH 168/326] ARM: shmobile: r8a7793 dtsi: Use "arm,gic-400" for
- GIC
-
-Replace the "arm,cortex-a15-gic" compatible value for the GIC by
-"arm,gic-400", as the R-Car Gen2 GIC is assumed to be a GIC-400.
-This has been confirmed by reading the GICD_IIDR register (on r8a7791),
-which reports 0x0200043b (GIC-400 = 0x02, ARM = 0x43b).
-
-This has no effect on runtime behavior, as currently the GIC driver
-treats both compatible values the same.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 5b3b3268518fb67c7accf83d786909b2a8cbee63)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7793.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
-index c50c5f65388a..3355c487d108 100644
---- a/arch/arm/boot/dts/r8a7793.dtsi
-+++ b/arch/arm/boot/dts/r8a7793.dtsi
-@@ -42,7 +42,7 @@
- };
-
- gic: interrupt-controller@f1001000 {
-- compatible = "arm,cortex-a15-gic";
-+ compatible = "arm,gic-400";
- #interrupt-cells = <3>;
- #address-cells = <0>;
- interrupt-controller;
---
-2.6.2
-
diff --git a/patches.renesas/0169-ARM-shmobile-r8a7794-dtsi-Use-arm-gic-400-for-GIC.patch b/patches.renesas/0169-ARM-shmobile-r8a7794-dtsi-Use-arm-gic-400-for-GIC.patch
deleted file mode 100644
index f1c5d4bbaedbfd..00000000000000
--- a/patches.renesas/0169-ARM-shmobile-r8a7794-dtsi-Use-arm-gic-400-for-GIC.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 712df600e9b78d7d724daa483b8a2d329d3d36c3 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 15:03:36 +0200
-Subject: [PATCH 169/326] ARM: shmobile: r8a7794 dtsi: Use "arm,gic-400" for
- GIC
-
-Replace the "arm,cortex-a15-gic" compatible value for the GIC by
-"arm,gic-400", as the R-Car Gen2 GIC is assumed to be a GIC-400.
-This has been confirmed by reading the GICD_IIDR register (on r8a7791),
-which reports 0x0200043b (GIC-400 = 0x02, ARM = 0x43b).
-
-This has no effect on runtime behavior, as currently the GIC driver
-treats both compatible values the same.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit c73ddf42e7a93dabf918b22d3cc2ce02b90d4155)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7794.dtsi | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
-index b73819423311..8824dbd5dbb4 100644
---- a/arch/arm/boot/dts/r8a7794.dtsi
-+++ b/arch/arm/boot/dts/r8a7794.dtsi
-@@ -39,7 +39,7 @@
- };
-
- gic: interrupt-controller@f1001000 {
-- compatible = "arm,cortex-a7-gic";
-+ compatible = "arm,gic-400";
- #interrupt-cells = <3>;
- #address-cells = <0>;
- interrupt-controller;
---
-2.6.2
-
diff --git a/patches.renesas/0170-ARM-shmobile-r8a7779-Configure-IRLM-mode-via-DT.patch b/patches.renesas/0170-ARM-shmobile-r8a7779-Configure-IRLM-mode-via-DT.patch
deleted file mode 100644
index a6e209e28ee858..00000000000000
--- a/patches.renesas/0170-ARM-shmobile-r8a7779-Configure-IRLM-mode-via-DT.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From da3d4b074d7a77846fc37cad2f777aac83e2a9db Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Thu, 25 Jun 2015 17:57:28 +0900
-Subject: [PATCH 170/326] ARM: shmobile: r8a7779: Configure IRLM mode via DT
-
-Adjust the r8a7779 SoC DTS and the Marzen Reference
-C board code to use DTS only for INTC-IRQPIN IRLM setup.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 7bf46d0be278a3586c78322c65ceff5fd03bb95d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7779.dtsi | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
-index 5c8071e87ae9..a2b5430d3257 100644
---- a/arch/arm/boot/dts/r8a7779.dtsi
-+++ b/arch/arm/boot/dts/r8a7779.dtsi
-@@ -148,7 +148,7 @@
- interrupt-controller;
- };
-
-- irqpin0: interrupt-controller@fe780010 {
-+ irqpin0: interrupt-controller@fe78001c {
- compatible = "renesas,intc-irqpin-r8a7779", "renesas,intc-irqpin";
- #interrupt-cells = <2>;
- status = "disabled";
-@@ -157,7 +157,8 @@
- <0xfe780010 4>,
- <0xfe780024 4>,
- <0xfe780044 4>,
-- <0xfe780064 4>;
-+ <0xfe780064 4>,
-+ <0xfe780000 4>;
- interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH
- 0 28 IRQ_TYPE_LEVEL_HIGH
- 0 29 IRQ_TYPE_LEVEL_HIGH
---
-2.6.2
-
diff --git a/patches.renesas/0171-ARM-shmobile-R-Car-Improve-documentation.patch b/patches.renesas/0171-ARM-shmobile-R-Car-Improve-documentation.patch
deleted file mode 100644
index 823fa3b800dd07..00000000000000
--- a/patches.renesas/0171-ARM-shmobile-R-Car-Improve-documentation.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From a04ef1ce6d66704579c743fa379ab88f43468ffe Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:27 +0200
-Subject: [PATCH 171/326] ARM: shmobile: R-Car: Improve documentation
-
-Add more SYSC register documentation.
-Use definitions instead of hardcoded numbers.
-Comment important operations.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 577d104d85f05c1de6e56784a5da3e0fb4746f3a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-rcar.c | 46 ++++++++++++++++++++++++++++------------
- 1 file changed, 32 insertions(+), 14 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
-index 00022ee56f80..56ea82a851cb 100644
---- a/arch/arm/mach-shmobile/pm-rcar.c
-+++ b/arch/arm/mach-shmobile/pm-rcar.c
-@@ -15,21 +15,35 @@
- #include <asm/io.h>
- #include "pm-rcar.h"
-
--/* SYSC */
--#define SYSCSR 0x00
--#define SYSCISR 0x04
--#define SYSCISCR 0x08
-+/* SYSC Common */
-+#define SYSCSR 0x00 /* SYSC Status Register */
-+#define SYSCISR 0x04 /* Interrupt Status Register */
-+#define SYSCISCR 0x08 /* Interrupt Status Clear Register */
-+#define SYSCIER 0x0c /* Interrupt Enable Register */
-+#define SYSCIMR 0x10 /* Interrupt Mask Register */
-
--#define PWRSR_OFFS 0x00
--#define PWROFFCR_OFFS 0x04
--#define PWRONCR_OFFS 0x0c
--#define PWRER_OFFS 0x14
-+/* SYSC Status Register */
-+#define SYSCSR_PONENB 1 /* Ready for power resume requests */
-+#define SYSCSR_POFFENB 0 /* Ready for power shutoff requests */
-
--#define SYSCSR_RETRIES 100
--#define SYSCSR_DELAY_US 1
-+/*
-+ * Power Control Register Offsets inside the register block for each domain
-+ * Note: The "CR" registers for ARM cores exist on H1 only
-+ * Use WFI to power off, CPG/APMU to resume ARM cores on R-Car Gen2
-+ */
-+#define PWRSR_OFFS 0x00 /* Power Status Register */
-+#define PWROFFCR_OFFS 0x04 /* Power Shutoff Control Register */
-+#define PWROFFSR_OFFS 0x08 /* Power Shutoff Status Register */
-+#define PWRONCR_OFFS 0x0c /* Power Resume Control Register */
-+#define PWRONSR_OFFS 0x10 /* Power Resume Status Register */
-+#define PWRER_OFFS 0x14 /* Power Shutoff/Resume Error */
-+
-+
-+#define SYSCSR_RETRIES 100
-+#define SYSCSR_DELAY_US 1
-
--#define SYSCISR_RETRIES 1000
--#define SYSCISR_DELAY_US 1
-+#define SYSCISR_RETRIES 1000
-+#define SYSCISR_DELAY_US 1
-
- static void __iomem *rcar_sysc_base;
- static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
-@@ -39,6 +53,7 @@ static int rcar_sysc_pwr_on_off(struct rcar_sysc_ch *sysc_ch,
- {
- int k;
-
-+ /* Wait until SYSC is ready to accept a power request */
- for (k = 0; k < SYSCSR_RETRIES; k++) {
- if (ioread32(rcar_sysc_base + SYSCSR) & (1 << sr_bit))
- break;
-@@ -48,6 +63,7 @@ static int rcar_sysc_pwr_on_off(struct rcar_sysc_ch *sysc_ch,
- if (k == SYSCSR_RETRIES)
- return -EAGAIN;
-
-+ /* Submit power shutoff or power resume request */
- iowrite32(1 << sysc_ch->chan_bit,
- rcar_sysc_base + sysc_ch->chan_offs + reg_offs);
-
-@@ -56,12 +72,12 @@ static int rcar_sysc_pwr_on_off(struct rcar_sysc_ch *sysc_ch,
-
- static int rcar_sysc_pwr_off(struct rcar_sysc_ch *sysc_ch)
- {
-- return rcar_sysc_pwr_on_off(sysc_ch, 0, PWROFFCR_OFFS);
-+ return rcar_sysc_pwr_on_off(sysc_ch, SYSCSR_POFFENB, PWROFFCR_OFFS);
- }
-
- static int rcar_sysc_pwr_on(struct rcar_sysc_ch *sysc_ch)
- {
-- return rcar_sysc_pwr_on_off(sysc_ch, 1, PWRONCR_OFFS);
-+ return rcar_sysc_pwr_on_off(sysc_ch, SYSCSR_PONENB, PWRONCR_OFFS);
- }
-
- static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
-@@ -78,6 +94,7 @@ static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
-
- iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
-
-+ /* Submit power shutoff or resume request until it was accepted */
- do {
- ret = on_off_fn(sysc_ch);
- if (ret)
-@@ -87,6 +104,7 @@ static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
- sysc_ch->chan_offs + PWRER_OFFS);
- } while (status & chan_mask);
-
-+ /* Wait until the power shutoff or resume request has completed * */
- for (k = 0; k < SYSCISR_RETRIES; k++) {
- if (ioread32(rcar_sysc_base + SYSCISR) & isr_mask)
- break;
---
-2.6.2
-
diff --git a/patches.renesas/0172-ARM-shmobile-R-Car-Shrink-rcar_sysc_ch-size.patch b/patches.renesas/0172-ARM-shmobile-R-Car-Shrink-rcar_sysc_ch-size.patch
deleted file mode 100644
index 3e85d6ea967a5d..00000000000000
--- a/patches.renesas/0172-ARM-shmobile-R-Car-Shrink-rcar_sysc_ch-size.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 2bda62352aa85d11082301494c663684a716fcd5 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:28 +0200
-Subject: [PATCH 172/326] ARM: shmobile: R-Car: Shrink rcar_sysc_ch size
-
-Shrink the individual fields in struct rcar_sysc_ch, as unsigned long or
-int is overkill:
- - chan_offs contains a register offset relative to a base value
- (< 512),
- - chan_bit and isr_bit contain bit indices (0-31).
-
-This reduces the size of each instance from 3 (4 on 64-bit) 32-bit words
-to 1 32-bit word.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 6fd2242e60e89a26e731e57dbf8f88d6639e09de)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-rcar.h | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-rcar.h b/arch/arm/mach-shmobile/pm-rcar.h
-index ef3a1ef628f1..06ebf00a6a5a 100644
---- a/arch/arm/mach-shmobile/pm-rcar.h
-+++ b/arch/arm/mach-shmobile/pm-rcar.h
-@@ -2,9 +2,9 @@
- #define PM_RCAR_H
-
- struct rcar_sysc_ch {
-- unsigned long chan_offs;
-- unsigned int chan_bit;
-- unsigned int isr_bit;
-+ u16 chan_offs;
-+ u8 chan_bit;
-+ u8 isr_bit;
- };
-
- int rcar_sysc_power_down(struct rcar_sysc_ch *sysc_ch);
---
-2.6.2
-
diff --git a/patches.renesas/0173-ARM-shmobile-R-Car-Break-infinite-loop.patch b/patches.renesas/0173-ARM-shmobile-R-Car-Break-infinite-loop.patch
deleted file mode 100644
index 78d0b349c04c72..00000000000000
--- a/patches.renesas/0173-ARM-shmobile-R-Car-Break-infinite-loop.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From c0ed352b2786ae5da793bdbb8c33f8a44ee216b2 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:29 +0200
-Subject: [PATCH 173/326] ARM: shmobile: R-Car: Break infinite loop
-
-rcar_sysc_update() loops (with interrupts disabled and while holding a
-spinlock) until submitting a power shutoff or resume request fails, or
-until the submitted request was accepted.
-If none of these conditions becomes true, this forms an infinite loop.
-
-Put a limit on the maximum number of loop iterations, and add a small
-delay to each iteration, to fix this.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 2f575fcff1fad24e97b8e7d793ad9af9ae5b8a17)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-rcar.c | 16 ++++++++++++++--
- 1 file changed, 14 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
-index 56ea82a851cb..a5e4c3a88ec4 100644
---- a/arch/arm/mach-shmobile/pm-rcar.c
-+++ b/arch/arm/mach-shmobile/pm-rcar.c
-@@ -42,6 +42,9 @@
- #define SYSCSR_RETRIES 100
- #define SYSCSR_DELAY_US 1
-
-+#define PWRER_RETRIES 100
-+#define PWRER_DELAY_US 1
-+
- #define SYSCISR_RETRIES 1000
- #define SYSCISR_DELAY_US 1
-
-@@ -95,14 +98,23 @@ static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
- iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
-
- /* Submit power shutoff or resume request until it was accepted */
-- do {
-+ for (k = 0; k < PWRER_RETRIES; k++) {
- ret = on_off_fn(sysc_ch);
- if (ret)
- goto out;
-
- status = ioread32(rcar_sysc_base +
- sysc_ch->chan_offs + PWRER_OFFS);
-- } while (status & chan_mask);
-+ if (!(status & chan_mask))
-+ break;
-+
-+ udelay(PWRER_DELAY_US);
-+ }
-+
-+ if (k == PWRER_RETRIES) {
-+ ret = -EIO;
-+ goto out;
-+ }
-
- /* Wait until the power shutoff or resume request has completed * */
- for (k = 0; k < SYSCISR_RETRIES; k++) {
---
-2.6.2
-
diff --git a/patches.renesas/0174-ARM-shmobile-R-Car-Make-struct-rcar_sysc_ch-paramete.patch b/patches.renesas/0174-ARM-shmobile-R-Car-Make-struct-rcar_sysc_ch-paramete.patch
deleted file mode 100644
index 13f59966f231ff..00000000000000
--- a/patches.renesas/0174-ARM-shmobile-R-Car-Make-struct-rcar_sysc_ch-paramete.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From 488804a26d9f2e5257f65ba3bf6fff9e09cf4bc0 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:30 +0200
-Subject: [PATCH 174/326] ARM: shmobile: R-Car: Make struct rcar_sysc_ch *
- parameters const
-
-The passed struct rcar_sysc_ch is never modified, so it can be const.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 624deb39a1c684b42569a3ec6a0fdcc74b950ed3)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-rcar.c | 16 ++++++++--------
- arch/arm/mach-shmobile/pm-rcar.h | 6 +++---
- 2 files changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
-index a5e4c3a88ec4..b1a7f2a7f757 100644
---- a/arch/arm/mach-shmobile/pm-rcar.c
-+++ b/arch/arm/mach-shmobile/pm-rcar.c
-@@ -51,7 +51,7 @@
- static void __iomem *rcar_sysc_base;
- static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
-
--static int rcar_sysc_pwr_on_off(struct rcar_sysc_ch *sysc_ch,
-+static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch,
- int sr_bit, int reg_offs)
- {
- int k;
-@@ -73,18 +73,18 @@ static int rcar_sysc_pwr_on_off(struct rcar_sysc_ch *sysc_ch,
- return 0;
- }
-
--static int rcar_sysc_pwr_off(struct rcar_sysc_ch *sysc_ch)
-+static int rcar_sysc_pwr_off(const struct rcar_sysc_ch *sysc_ch)
- {
- return rcar_sysc_pwr_on_off(sysc_ch, SYSCSR_POFFENB, PWROFFCR_OFFS);
- }
-
--static int rcar_sysc_pwr_on(struct rcar_sysc_ch *sysc_ch)
-+static int rcar_sysc_pwr_on(const struct rcar_sysc_ch *sysc_ch)
- {
- return rcar_sysc_pwr_on_off(sysc_ch, SYSCSR_PONENB, PWRONCR_OFFS);
- }
-
--static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
-- int (*on_off_fn)(struct rcar_sysc_ch *))
-+static int rcar_sysc_update(const struct rcar_sysc_ch *sysc_ch,
-+ int (*on_off_fn)(const struct rcar_sysc_ch *))
- {
- unsigned int isr_mask = 1 << sysc_ch->isr_bit;
- unsigned int chan_mask = 1 << sysc_ch->chan_bit;
-@@ -136,17 +136,17 @@ static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
- return ret;
- }
-
--int rcar_sysc_power_down(struct rcar_sysc_ch *sysc_ch)
-+int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch)
- {
- return rcar_sysc_update(sysc_ch, rcar_sysc_pwr_off);
- }
-
--int rcar_sysc_power_up(struct rcar_sysc_ch *sysc_ch)
-+int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch)
- {
- return rcar_sysc_update(sysc_ch, rcar_sysc_pwr_on);
- }
-
--bool rcar_sysc_power_is_off(struct rcar_sysc_ch *sysc_ch)
-+bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch)
- {
- unsigned int st;
-
-diff --git a/arch/arm/mach-shmobile/pm-rcar.h b/arch/arm/mach-shmobile/pm-rcar.h
-index 06ebf00a6a5a..1b901db4a24c 100644
---- a/arch/arm/mach-shmobile/pm-rcar.h
-+++ b/arch/arm/mach-shmobile/pm-rcar.h
-@@ -7,9 +7,9 @@ struct rcar_sysc_ch {
- u8 isr_bit;
- };
-
--int rcar_sysc_power_down(struct rcar_sysc_ch *sysc_ch);
--int rcar_sysc_power_up(struct rcar_sysc_ch *sysc_ch);
--bool rcar_sysc_power_is_off(struct rcar_sysc_ch *sysc_ch);
-+int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch);
-+int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch);
-+bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch);
- void __iomem *rcar_sysc_init(phys_addr_t base);
-
- #endif /* PM_RCAR_H */
---
-2.6.2
-
diff --git a/patches.renesas/0175-ARM-shmobile-R-Car-Use-BIT-macro-instead-of-open-cod.patch b/patches.renesas/0175-ARM-shmobile-R-Car-Use-BIT-macro-instead-of-open-cod.patch
deleted file mode 100644
index 807e9232a0c6ce..00000000000000
--- a/patches.renesas/0175-ARM-shmobile-R-Car-Use-BIT-macro-instead-of-open-cod.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 59880f19d1a261647e375ccb6f373fca7d509a31 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:31 +0200
-Subject: [PATCH 175/326] ARM: shmobile: R-Car: Use BIT() macro instead of open
- coding
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 21437c53f3dc2e1e52ccb8aed0a65dd3879ca671)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-rcar.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
-index b1a7f2a7f757..7adf9ce5fc1d 100644
---- a/arch/arm/mach-shmobile/pm-rcar.c
-+++ b/arch/arm/mach-shmobile/pm-rcar.c
-@@ -58,7 +58,7 @@ static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch,
-
- /* Wait until SYSC is ready to accept a power request */
- for (k = 0; k < SYSCSR_RETRIES; k++) {
-- if (ioread32(rcar_sysc_base + SYSCSR) & (1 << sr_bit))
-+ if (ioread32(rcar_sysc_base + SYSCSR) & BIT(sr_bit))
- break;
- udelay(SYSCSR_DELAY_US);
- }
-@@ -67,7 +67,7 @@ static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch,
- return -EAGAIN;
-
- /* Submit power shutoff or power resume request */
-- iowrite32(1 << sysc_ch->chan_bit,
-+ iowrite32(BIT(sysc_ch->chan_bit),
- rcar_sysc_base + sysc_ch->chan_offs + reg_offs);
-
- return 0;
-@@ -86,8 +86,8 @@ static int rcar_sysc_pwr_on(const struct rcar_sysc_ch *sysc_ch)
- static int rcar_sysc_update(const struct rcar_sysc_ch *sysc_ch,
- int (*on_off_fn)(const struct rcar_sysc_ch *))
- {
-- unsigned int isr_mask = 1 << sysc_ch->isr_bit;
-- unsigned int chan_mask = 1 << sysc_ch->chan_bit;
-+ unsigned int isr_mask = BIT(sysc_ch->isr_bit);
-+ unsigned int chan_mask = BIT(sysc_ch->chan_bit);
- unsigned int status;
- unsigned long flags;
- int ret = 0;
-@@ -151,7 +151,7 @@ bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch)
- unsigned int st;
-
- st = ioread32(rcar_sysc_base + sysc_ch->chan_offs + PWRSR_OFFS);
-- if (st & (1 << sysc_ch->chan_bit))
-+ if (st & BIT(sysc_ch->chan_bit))
- return true;
-
- return false;
---
-2.6.2
-
diff --git a/patches.renesas/0176-ARM-shmobile-R-Car-Get-rid-of-on_off_fn-function-poi.patch b/patches.renesas/0176-ARM-shmobile-R-Car-Get-rid-of-on_off_fn-function-poi.patch
deleted file mode 100644
index dbca0fb91cadaa..00000000000000
--- a/patches.renesas/0176-ARM-shmobile-R-Car-Get-rid-of-on_off_fn-function-poi.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From ef2015a1b01f8308a1f764faf2e192350a26f855 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:32 +0200
-Subject: [PATCH 176/326] ARM: shmobile: R-Car: Get rid of on_off_fn() function
- pointer
-
-Simplify the power request code by passing an "on" flag, and picking the
-right status bit and register offset in the innermost function, based on
-this flag.
-This allows to remove the rcar_sysc_pwr_{off,on}() helper functions, and
-the function pointer through which they were called.
-
-Make sr_bit and reg_offs unsigned while we're at it.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit bcb8243792eaa855a51c96bfeaa5dbca19f48d07)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-rcar.c | 31 ++++++++++++++-----------------
- 1 file changed, 14 insertions(+), 17 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
-index 7adf9ce5fc1d..4092ad16e0a4 100644
---- a/arch/arm/mach-shmobile/pm-rcar.c
-+++ b/arch/arm/mach-shmobile/pm-rcar.c
-@@ -51,11 +51,19 @@
- static void __iomem *rcar_sysc_base;
- static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
-
--static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch,
-- int sr_bit, int reg_offs)
-+static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch, bool on)
- {
-+ unsigned int sr_bit, reg_offs;
- int k;
-
-+ if (on) {
-+ sr_bit = SYSCSR_PONENB;
-+ reg_offs = PWRONCR_OFFS;
-+ } else {
-+ sr_bit = SYSCSR_POFFENB;
-+ reg_offs = PWROFFCR_OFFS;
-+ }
-+
- /* Wait until SYSC is ready to accept a power request */
- for (k = 0; k < SYSCSR_RETRIES; k++) {
- if (ioread32(rcar_sysc_base + SYSCSR) & BIT(sr_bit))
-@@ -73,18 +81,7 @@ static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch,
- return 0;
- }
-
--static int rcar_sysc_pwr_off(const struct rcar_sysc_ch *sysc_ch)
--{
-- return rcar_sysc_pwr_on_off(sysc_ch, SYSCSR_POFFENB, PWROFFCR_OFFS);
--}
--
--static int rcar_sysc_pwr_on(const struct rcar_sysc_ch *sysc_ch)
--{
-- return rcar_sysc_pwr_on_off(sysc_ch, SYSCSR_PONENB, PWRONCR_OFFS);
--}
--
--static int rcar_sysc_update(const struct rcar_sysc_ch *sysc_ch,
-- int (*on_off_fn)(const struct rcar_sysc_ch *))
-+static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
- {
- unsigned int isr_mask = BIT(sysc_ch->isr_bit);
- unsigned int chan_mask = BIT(sysc_ch->chan_bit);
-@@ -99,7 +96,7 @@ static int rcar_sysc_update(const struct rcar_sysc_ch *sysc_ch,
-
- /* Submit power shutoff or resume request until it was accepted */
- for (k = 0; k < PWRER_RETRIES; k++) {
-- ret = on_off_fn(sysc_ch);
-+ ret = rcar_sysc_pwr_on_off(sysc_ch, on);
- if (ret)
- goto out;
-
-@@ -138,12 +135,12 @@ static int rcar_sysc_update(const struct rcar_sysc_ch *sysc_ch,
-
- int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch)
- {
-- return rcar_sysc_update(sysc_ch, rcar_sysc_pwr_off);
-+ return rcar_sysc_power(sysc_ch, false);
- }
-
- int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch)
- {
-- return rcar_sysc_update(sysc_ch, rcar_sysc_pwr_on);
-+ return rcar_sysc_power(sysc_ch, true);
- }
-
- bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch)
---
-2.6.2
-
diff --git a/patches.renesas/0177-ARM-shmobile-r8a7779-Make-struct-rcar_sysc_ch-const.patch b/patches.renesas/0177-ARM-shmobile-r8a7779-Make-struct-rcar_sysc_ch-const.patch
deleted file mode 100644
index 99f370682650b1..00000000000000
--- a/patches.renesas/0177-ARM-shmobile-r8a7779-Make-struct-rcar_sysc_ch-const.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 1aaf7a059d863841059481783255e526b66ba7ce Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:34 +0200
-Subject: [PATCH 177/326] ARM: shmobile: r8a7779: Make struct rcar_sysc_ch
- const
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 5afcd90f65ac990ca08b101a0e0fd9eac4e0dcde)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/pm-r8a7779.c | 3 ++-
- arch/arm/mach-shmobile/smp-r8a7779.c | 12 ++++++------
- 2 files changed, 8 insertions(+), 7 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
-index d5f258e4d890..47a862e7f8ba 100644
---- a/arch/arm/mach-shmobile/pm-r8a7779.c
-+++ b/arch/arm/mach-shmobile/pm-r8a7779.c
-@@ -35,7 +35,8 @@ struct r8a7779_pm_domain {
- struct rcar_sysc_ch ch;
- };
-
--static inline struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
-+static inline
-+const struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
- {
- return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
- }
-diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
-index 01f792fcb220..9122216df060 100644
---- a/arch/arm/mach-shmobile/smp-r8a7779.c
-+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
-@@ -32,25 +32,25 @@
- #define AVECR IOMEM(0xfe700040)
- #define R8A7779_SCU_BASE 0xf0000000
-
--static struct rcar_sysc_ch r8a7779_ch_cpu1 = {
-+static const struct rcar_sysc_ch r8a7779_ch_cpu1 = {
- .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
- .chan_bit = 1, /* ARM1 */
- .isr_bit = 1, /* ARM1 */
- };
-
--static struct rcar_sysc_ch r8a7779_ch_cpu2 = {
-+static const struct rcar_sysc_ch r8a7779_ch_cpu2 = {
- .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
- .chan_bit = 2, /* ARM2 */
- .isr_bit = 2, /* ARM2 */
- };
-
--static struct rcar_sysc_ch r8a7779_ch_cpu3 = {
-+static const struct rcar_sysc_ch r8a7779_ch_cpu3 = {
- .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
- .chan_bit = 3, /* ARM3 */
- .isr_bit = 3, /* ARM3 */
- };
-
--static struct rcar_sysc_ch *r8a7779_ch_cpu[4] = {
-+static const struct rcar_sysc_ch * const r8a7779_ch_cpu[4] = {
- [1] = &r8a7779_ch_cpu1,
- [2] = &r8a7779_ch_cpu2,
- [3] = &r8a7779_ch_cpu3,
-@@ -66,7 +66,7 @@ void __init r8a7779_register_twd(void)
-
- static int r8a7779_platform_cpu_kill(unsigned int cpu)
- {
-- struct rcar_sysc_ch *ch = NULL;
-+ const struct rcar_sysc_ch *ch = NULL;
- int ret = -EIO;
-
- cpu = cpu_logical_map(cpu);
-@@ -82,7 +82,7 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
-
- static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle)
- {
-- struct rcar_sysc_ch *ch = NULL;
-+ const struct rcar_sysc_ch *ch = NULL;
- unsigned int lcpu = cpu_logical_map(cpu);
- int ret;
-
---
-2.6.2
-
diff --git a/patches.renesas/0178-ARM-shmobile-r8a7790-Make-struct-rcar_sysc_ch-const.patch b/patches.renesas/0178-ARM-shmobile-r8a7790-Make-struct-rcar_sysc_ch-const.patch
deleted file mode 100644
index f77ef8da8d0cec..00000000000000
--- a/patches.renesas/0178-ARM-shmobile-r8a7790-Make-struct-rcar_sysc_ch-const.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 369e962a8edf5dc5c840731d836b1201d2bab1e5 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 4 Jun 2015 20:22:35 +0200
-Subject: [PATCH 178/326] ARM: shmobile: r8a7790: Make struct rcar_sysc_ch
- const
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit bd82aff9192dad2bfd3cb3fc19fdf741c2f6028e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/smp-r8a7790.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
-index 930f45cbc08a..2ef0054ce934 100644
---- a/arch/arm/mach-shmobile/smp-r8a7790.c
-+++ b/arch/arm/mach-shmobile/smp-r8a7790.c
-@@ -26,12 +26,12 @@
- #include "rcar-gen2.h"
- #include "r8a7790.h"
-
--static struct rcar_sysc_ch r8a7790_ca15_scu = {
-+static const struct rcar_sysc_ch r8a7790_ca15_scu = {
- .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
- .isr_bit = 12, /* CA15-SCU */
- };
-
--static struct rcar_sysc_ch r8a7790_ca7_scu = {
-+static const struct rcar_sysc_ch r8a7790_ca7_scu = {
- .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
- .isr_bit = 21, /* CA7-SCU */
- };
---
-2.6.2
-
diff --git a/patches.renesas/0179-ARM-shmobile-Basic-r8a7793-SoC-support.patch b/patches.renesas/0179-ARM-shmobile-Basic-r8a7793-SoC-support.patch
deleted file mode 100644
index b5295451fdc708..00000000000000
--- a/patches.renesas/0179-ARM-shmobile-Basic-r8a7793-SoC-support.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-From 83c7d421c01c2002b1971871039198a7795ccfee Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Mon, 1 Jun 2015 16:22:54 +0200
-Subject: [PATCH 179/326] ARM: shmobile: Basic r8a7793 SoC support
-
-Minimal support without power management or SMP.
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit ec60d95b4faccd61c7ce10316ebc9333f2d7674a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/Kconfig | 4 ++++
- arch/arm/mach-shmobile/Makefile | 1 +
- arch/arm/mach-shmobile/setup-r8a7793.c | 33 +++++++++++++++++++++++++++++++++
- 3 files changed, 38 insertions(+)
- create mode 100644 arch/arm/mach-shmobile/setup-r8a7793.c
-
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index 9725f442d566..4a93a6eade14 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -82,6 +82,10 @@ config ARCH_R8A7791
- select ARCH_RCAR_GEN2
- select I2C
-
-+config ARCH_R8A7793
-+ bool "R-Car M2-N (R8A7793)"
-+ select ARCH_RCAR_GEN2
-+
- config ARCH_R8A7794
- bool "R-Car E2 (R8A77940)"
- select ARCH_RCAR_GEN2
-diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
-index 726c219e5b13..3a85ca3a6cb1 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -13,6 +13,7 @@ obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
- obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o
- obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o
- obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o
-+obj-$(CONFIG_ARCH_R8A7793) += setup-r8a7793.o
- obj-$(CONFIG_ARCH_R8A7794) += setup-r8a7794.o
- obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o
- obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
-diff --git a/arch/arm/mach-shmobile/setup-r8a7793.c b/arch/arm/mach-shmobile/setup-r8a7793.c
-new file mode 100644
-index 000000000000..1d2825cb7a65
---- /dev/null
-+++ b/arch/arm/mach-shmobile/setup-r8a7793.c
-@@ -0,0 +1,33 @@
-+/*
-+ * r8a7793 processor support
-+ *
-+ * Copyright (C) 2015 Ulrich Hecht
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; version 2 of the License.
-+ *
-+ * 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/init.h>
-+#include <asm/mach/arch.h>
-+
-+#include "common.h"
-+#include "rcar-gen2.h"
-+
-+static const char *r8a7793_boards_compat_dt[] __initconst = {
-+ "renesas,r8a7793",
-+ NULL,
-+};
-+
-+DT_MACHINE_START(R8A7793_DT, "Generic R8A7793 (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 = r8a7793_boards_compat_dt,
-+MACHINE_END
---
-2.6.2
-
diff --git a/patches.renesas/0180-ARM-shmobile-gose-enable-R-Car-Gen2-regulator-quirk.patch b/patches.renesas/0180-ARM-shmobile-gose-enable-R-Car-Gen2-regulator-quirk.patch
deleted file mode 100644
index 78ac3106187d39..00000000000000
--- a/patches.renesas/0180-ARM-shmobile-gose-enable-R-Car-Gen2-regulator-quirk.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From dcfa56131a12fc1e69870904b508e43a152011ad Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Mon, 1 Jun 2015 16:22:57 +0200
-Subject: [PATCH 180/326] ARM: shmobile: gose: enable R-Car Gen2 regulator
- quirk
-
-Regulator setup seems identical to Koelsch.
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 765b50030c218f65ee4ffd2eeb07045aa79fd5ee)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/Kconfig | 1 +
- arch/arm/mach-shmobile/Makefile | 1 +
- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 3 ++-
- 3 files changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index 4a93a6eade14..d57bbf1beb70 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -85,6 +85,7 @@ config ARCH_R8A7791
- config ARCH_R8A7793
- bool "R-Car M2-N (R8A7793)"
- select ARCH_RCAR_GEN2
-+ select I2C
-
- config ARCH_R8A7794
- bool "R-Car E2 (R8A77940)"
-diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
-index 3a85ca3a6cb1..6cb095107f90 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -33,6 +33,7 @@ obj-$(CONFIG_ARCH_RCAR_GEN2) += setup-rcar-gen2.o platsmp-apmu.o $(cpu-y)
- CFLAGS_setup-rcar-gen2.o += -march=armv7-a
- obj-$(CONFIG_ARCH_R8A7790) += regulator-quirk-rcar-gen2.o
- obj-$(CONFIG_ARCH_R8A7791) += regulator-quirk-rcar-gen2.o
-+obj-$(CONFIG_ARCH_R8A7793) += regulator-quirk-rcar-gen2.o
-
- # SMP objects
- smp-y := $(cpu-y)
-diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
-index 384e6e934b87..62437b57813e 100644
---- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
-+++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
-@@ -123,7 +123,8 @@ static int __init rcar_gen2_regulator_quirk(void)
- u32 mon;
-
- if (!of_machine_is_compatible("renesas,koelsch") &&
-- !of_machine_is_compatible("renesas,lager"))
-+ !of_machine_is_compatible("renesas,lager") &&
-+ !of_machine_is_compatible("renesas,gose"))
- return -ENODEV;
-
- irqc = ioremap(IRQC_BASE, PAGE_SIZE);
---
-2.6.2
-
diff --git a/patches.renesas/0181-ARM-shmobile-apmu-silence-build-warnings.patch b/patches.renesas/0181-ARM-shmobile-apmu-silence-build-warnings.patch
deleted file mode 100644
index c483ba85b94f1d..00000000000000
--- a/patches.renesas/0181-ARM-shmobile-apmu-silence-build-warnings.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From df157aae98efae424913b24fe0a291bff7480abd Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Fri, 10 Jul 2015 22:48:16 +0200
-Subject: [PATCH 181/326] ARM: shmobile: apmu: silence build warnings
-
-With shmobile_defconfig but SMP=n && SUSPEND=n, I get:
-
-arch/arm/mach-shmobile/platsmp-apmu.c:49:12: warning: 'apmu_power_off' defined but not used [-Wunused-function]
-arch/arm/mach-shmobile/platsmp-apmu.c:70:12: warning: 'apmu_wrap' defined but not used [-Wunused-function]
-
-Annotate those functions like the functions around it.
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 151dd346a2dadaa151d5110553e3fb08774c888e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/platsmp-apmu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
-index b0790fc32282..4e54512bee30 100644
---- a/arch/arm/mach-shmobile/platsmp-apmu.c
-+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
-@@ -46,7 +46,7 @@ static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
- return 0;
- }
-
--static int apmu_power_off(void __iomem *p, int bit)
-+static int __maybe_unused apmu_power_off(void __iomem *p, int bit)
- {
- /* request Core Standby for next WFI */
- writel_relaxed(3, p + CPUNCR_OFFS(bit));
-@@ -67,7 +67,7 @@ static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
- return 0;
- }
-
--static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
-+static int __maybe_unused apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
- {
- void __iomem *p = apmu_cpus[cpu].iomem;
-
---
-2.6.2
-
diff --git a/patches.renesas/0182-ARM-shmobile-r8a7779-Generic-CCF-and-timer-support.patch b/patches.renesas/0182-ARM-shmobile-r8a7779-Generic-CCF-and-timer-support.patch
deleted file mode 100644
index 6b21ede687de0d..00000000000000
--- a/patches.renesas/0182-ARM-shmobile-r8a7779-Generic-CCF-and-timer-support.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From ded8096707335030772202b48198140a2a6fc248 Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Thu, 25 Jun 2015 17:57:39 +0900
-Subject: [PATCH 182/326] ARM: shmobile: r8a7779: Generic CCF and timer support
-
-Add a r8a7779-specific callback to initialize CCF and
-clocksources. With this in place we are one step closer
-to be able to use r8a7779 without C board code.
-
-Also add a multiplatform wrapper to avoid breaking the
-r8a7779 marzen legacy case.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 131c2e0480b0f7afefbc9a46cc4e158e17caa844)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/setup-r8a7779.c | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
-index c03e562be12b..5625fd1c89c0 100644
---- a/arch/arm/mach-shmobile/setup-r8a7779.c
-+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
-@@ -14,6 +14,8 @@
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-+#include <linux/clk/shmobile.h>
-+#include <linux/clocksource.h>
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/interrupt.h>
-@@ -756,6 +758,14 @@ u32 __init r8a7779_read_mode_pins(void)
- return mode;
- }
-
-+#ifdef CONFIG_ARCH_SHMOBILE_MULTI
-+
-+static void __init r8a7779_init_time(void)
-+{
-+ r8a7779_clocks_init(r8a7779_read_mode_pins());
-+ clocksource_of_init();
-+}
-+
- static const char *r8a7779_compat_dt[] __initdata = {
- "renesas,r8a7779",
- NULL,
-@@ -764,8 +774,10 @@ static const char *r8a7779_compat_dt[] __initdata = {
- DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
- .map_io = r8a7779_map_io,
- .init_early = shmobile_init_delay,
-+ .init_time = r8a7779_init_time,
- .init_irq = r8a7779_init_irq_dt,
- .init_late = shmobile_init_late,
- .dt_compat = r8a7779_compat_dt,
- MACHINE_END
-+#endif /* CONFIG_ARCH_SHMOBILE_MULTI */
- #endif /* CONFIG_USE_OF */
---
-2.6.2
-
diff --git a/patches.renesas/0183-ARM-shmobile-r8a7779-Generic-SMP-ops.patch b/patches.renesas/0183-ARM-shmobile-r8a7779-Generic-SMP-ops.patch
deleted file mode 100644
index 907c4cd48c625d..00000000000000
--- a/patches.renesas/0183-ARM-shmobile-r8a7779-Generic-SMP-ops.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 6171117b3c7f2b7d396194077c35405379a65ef8 Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Mon, 13 Jul 2015 15:15:02 +0900
-Subject: [PATCH 183/326] ARM: shmobile: r8a7779: Generic SMP ops
-
-Add a r8a7779-specific SMP operation pointer to support
-all 4 CPU cores through SMP on r8a7779 without C board code.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 44ade5edf90ccd38efa741240efb2586239c9751)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/setup-r8a7779.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
-index 5625fd1c89c0..2c3e433f84ca 100644
---- a/arch/arm/mach-shmobile/setup-r8a7779.c
-+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
-@@ -772,6 +772,7 @@ static const char *r8a7779_compat_dt[] __initdata = {
- };
-
- DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
-+ .smp = smp_ops(r8a7779_smp_ops),
- .map_io = r8a7779_map_io,
- .init_early = shmobile_init_delay,
- .init_time = r8a7779_init_time,
---
-2.6.2
-
diff --git a/patches.renesas/0184-ARM-shmobile-emev2-add-IIC-cores-to-dtsi.patch b/patches.renesas/0184-ARM-shmobile-emev2-add-IIC-cores-to-dtsi.patch
deleted file mode 100644
index 3141645e1bf038..00000000000000
--- a/patches.renesas/0184-ARM-shmobile-emev2-add-IIC-cores-to-dtsi.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From cdb340241b2be103eb10598b60dbf7551bdfd872 Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Sat, 11 Jul 2015 09:46:25 +0200
-Subject: [PATCH 184/326] ARM: shmobile: emev2: add IIC cores to dtsi
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit cd42d042a2e712a7f9880f860075815539ce4baf)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/emev2.dtsi | 48 ++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 48 insertions(+)
-
-diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
-index bb45694d91bc..edad0c4eea35 100644
---- a/arch/arm/boot/dts/emev2.dtsi
-+++ b/arch/arm/boot/dts/emev2.dtsi
-@@ -21,6 +21,8 @@
- gpio2 = &gpio2;
- gpio3 = &gpio3;
- gpio4 = &gpio4;
-+ i2c0 = &iic0;
-+ i2c1 = &iic1;
- };
-
- cpus {
-@@ -66,6 +68,30 @@
- clock-frequency = <32768>;
- #clock-cells = <0>;
- };
-+ iic0_sclkdiv: iic0_sclkdiv {
-+ compatible = "renesas,emev2-smu-clkdiv";
-+ reg = <0x624 0>;
-+ clocks = <&pll3_fo>;
-+ #clock-cells = <0>;
-+ };
-+ iic0_sclk: iic0_sclk {
-+ compatible = "renesas,emev2-smu-gclk";
-+ reg = <0x48c 1>;
-+ clocks = <&iic0_sclkdiv>;
-+ #clock-cells = <0>;
-+ };
-+ iic1_sclkdiv: iic1_sclkdiv {
-+ compatible = "renesas,emev2-smu-clkdiv";
-+ reg = <0x624 16>;
-+ clocks = <&pll3_fo>;
-+ #clock-cells = <0>;
-+ };
-+ iic1_sclk: iic1_sclk {
-+ compatible = "renesas,emev2-smu-gclk";
-+ reg = <0x490 1>;
-+ clocks = <&iic1_sclkdiv>;
-+ #clock-cells = <0>;
-+ };
- pll3_fo: pll3_fo {
- compatible = "fixed-factor-clock";
- clocks = <&c32ki>;
-@@ -234,4 +260,26 @@
- interrupt-controller;
- #interrupt-cells = <2>;
- };
-+
-+ iic0: i2c@e0070000 {
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ compatible = "renesas,iic-emev2";
-+ reg = <0xe0070000 0x28>;
-+ interrupts = <0 32 IRQ_TYPE_EDGE_RISING>;
-+ clocks = <&iic0_sclk>;
-+ clock-names = "sclk";
-+ status = "disabled";
-+ };
-+
-+ iic1: i2c@e10a0000 {
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ compatible = "renesas,iic-emev2";
-+ reg = <0xe10a0000 0x28>;
-+ interrupts = <0 33 IRQ_TYPE_EDGE_RISING>;
-+ clocks = <&iic1_sclk>;
-+ clock-names = "sclk";
-+ status = "disabled";
-+ };
- };
---
-2.6.2
-
diff --git a/patches.renesas/0185-ARM-shmobile-emev2-kzm9d-enable-IIC-busses.patch b/patches.renesas/0185-ARM-shmobile-emev2-kzm9d-enable-IIC-busses.patch
deleted file mode 100644
index 3bb94319523a92..00000000000000
--- a/patches.renesas/0185-ARM-shmobile-emev2-kzm9d-enable-IIC-busses.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 0700261389e7651ee9a47698e6fa57ca7a7a3b43 Mon Sep 17 00:00:00 2001
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Date: Sat, 11 Jul 2015 09:46:26 +0200
-Subject: [PATCH 185/326] ARM: shmobile: emev2: kzm9d: enable IIC busses
-
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit c53b0c92a829fe804f2f5f749ebc907658ebcf75)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/emev2-kzm9d.dts | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/arch/arm/boot/dts/emev2-kzm9d.dts b/arch/arm/boot/dts/emev2-kzm9d.dts
-index 1dee0aa4f40c..955c24ee4a8c 100644
---- a/arch/arm/boot/dts/emev2-kzm9d.dts
-+++ b/arch/arm/boot/dts/emev2-kzm9d.dts
-@@ -95,6 +95,14 @@
- };
- };
-
-+&iic0 {
-+ status = "okay";
-+};
-+
-+&iic1 {
-+ status = "okay";
-+};
-+
- &pfc {
- uart1_pins: serial@e1030000 {
- renesas,groups = "uart1_ctrl", "uart1_data";
---
-2.6.2
-
diff --git a/patches.renesas/0186-ARM-shmobile-lager-add-sound-label-on-DTS.patch b/patches.renesas/0186-ARM-shmobile-lager-add-sound-label-on-DTS.patch
deleted file mode 100644
index 8b55f515c5f814..00000000000000
--- a/patches.renesas/0186-ARM-shmobile-lager-add-sound-label-on-DTS.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From bd9250e04e1bb6dcea8aa8100b96ce707f2a6064 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 14 Jul 2015 04:56:10 +0000
-Subject: [PATCH 186/326] ARM: shmobile: lager: add sound label on DTS
-
-It is easy to modify settings for Test or other purpose if sound has label
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 30be0ba5f92c9a728bf3b3f41dbf3240eb3bbc11)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790-lager.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
-index 2eb8a995ae9f..5ae07a8385c5 100644
---- a/arch/arm/boot/dts/r8a7790-lager.dts
-+++ b/arch/arm/boot/dts/r8a7790-lager.dts
-@@ -174,7 +174,7 @@
- 1800000 0>;
- };
-
-- sound {
-+ rsnd_ak4643: sound {
- compatible = "simple-audio-card";
-
- simple-audio-card,format = "left_j";
---
-2.6.2
-
diff --git a/patches.renesas/0187-ARM-shmobile-koelsch-add-sound-label-on-DTS.patch b/patches.renesas/0187-ARM-shmobile-koelsch-add-sound-label-on-DTS.patch
deleted file mode 100644
index f427f5c34ac41a..00000000000000
--- a/patches.renesas/0187-ARM-shmobile-koelsch-add-sound-label-on-DTS.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From a2f835f0dc52005a777830a38a1917c990166cb1 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 14 Jul 2015 04:57:05 +0000
-Subject: [PATCH 187/326] ARM: shmobile: koelsch: add sound label on DTS
-
-It is easy to modify settings for Test or other purpose if sound has label
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 18f88d22e4167a658091fe020beef723cefe86dd)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791-koelsch.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
-index cffe33ff4d16..dc158845afdc 100644
---- a/arch/arm/boot/dts/r8a7791-koelsch.dts
-+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
-@@ -242,7 +242,7 @@
- 1800000 0>;
- };
-
-- sound {
-+ rsnd_ak4643: sound {
- compatible = "simple-audio-card";
-
- simple-audio-card,format = "left_j";
---
-2.6.2
-
diff --git a/patches.renesas/0188-ARM-shmobile-defconfig-add-Renesas-DPCM-Sound-Card.patch b/patches.renesas/0188-ARM-shmobile-defconfig-add-Renesas-DPCM-Sound-Card.patch
deleted file mode 100644
index 48778b3f42221f..00000000000000
--- a/patches.renesas/0188-ARM-shmobile-defconfig-add-Renesas-DPCM-Sound-Card.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 6ac0c725617f1ab99178e061d090a7641de04e12 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 14 Jul 2015 04:57:34 +0000
-Subject: [PATCH 188/326] ARM: shmobile: defconfig: add Renesas DPCM Sound Card
-
-This patch enables DPCM related sound card.
-It is used for...
- - Sampline rate convert
- - CTU/MIXer
-
-Note: you need to enable these settings on DTS file
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 6cec276808bc0a4ac5fc3ab9e42a1b5d1e3e9cc4)
-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 c8e9caeb1c02..8da509327265 100644
---- a/arch/arm/configs/shmobile_defconfig
-+++ b/arch/arm/configs/shmobile_defconfig
-@@ -152,6 +152,7 @@ CONFIG_SND=y
- CONFIG_SND_SOC=y
- CONFIG_SND_SOC_SH4_FSI=y
- CONFIG_SND_SOC_RCAR=y
-+CONFIG_SND_SOC_RSRC_CARD=y
- CONFIG_SND_SOC_AK4642=y
- CONFIG_SND_SOC_WM8978=y
- CONFIG_USB=y
---
-2.6.2
-
diff --git a/patches.renesas/0189-ARM-shmobile-Remove-marzen_defconfig.patch b/patches.renesas/0189-ARM-shmobile-Remove-marzen_defconfig.patch
deleted file mode 100644
index fc17c047750c4b..00000000000000
--- a/patches.renesas/0189-ARM-shmobile-Remove-marzen_defconfig.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-From d67c030cc7edbd58d0ab20115720d3090d5d95f8 Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Thu, 16 Jul 2015 16:54:14 +0900
-Subject: [PATCH 189/326] ARM: shmobile: Remove marzen_defconfig
-
-Now when the Marzen legacy board code is removed also
-get rid of the marzen_defconfig file. Existing users
-shall move over to shmobile_defconfig.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 821e79cb5686695f0adaef61587a184e953a937e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/configs/marzen_defconfig | 124 --------------------------------------
- 1 file changed, 124 deletions(-)
- delete mode 100644 arch/arm/configs/marzen_defconfig
-
-diff --git a/arch/arm/configs/marzen_defconfig b/arch/arm/configs/marzen_defconfig
-deleted file mode 100644
-index 3c8b6d823189..000000000000
---- a/arch/arm/configs/marzen_defconfig
-+++ /dev/null
-@@ -1,124 +0,0 @@
--# CONFIG_ARM_PATCH_PHYS_VIRT is not set
--CONFIG_EXPERIMENTAL=y
--CONFIG_KERNEL_LZMA=y
--CONFIG_NO_HZ=y
--CONFIG_IKCONFIG=y
--CONFIG_IKCONFIG_PROC=y
--CONFIG_LOG_BUF_SHIFT=16
--CONFIG_SYSCTL_SYSCALL=y
--CONFIG_EMBEDDED=y
--CONFIG_SLAB=y
--# CONFIG_IOSCHED_CFQ is not set
--CONFIG_ARCH_SHMOBILE_LEGACY=y
--CONFIG_ARCH_R8A7779=y
--CONFIG_MACH_MARZEN=y
--CONFIG_MEMORY_START=0x60000000
--CONFIG_MEMORY_SIZE=0x10000000
--CONFIG_SHMOBILE_TIMER_HZ=1024
--# CONFIG_SH_TIMER_CMT is not set
--# CONFIG_SWP_EMULATE 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_SMP=y
--# CONFIG_ARM_CPU_TOPOLOGY is not set
--CONFIG_AEABI=y
--# CONFIG_OABI_COMPAT is not set
--CONFIG_HIGHMEM=y
--CONFIG_ZBOOT_ROM_TEXT=0x0
--CONFIG_ZBOOT_ROM_BSS=0x0
--CONFIG_ARM_APPENDED_DTB=y
--CONFIG_VFP=y
--CONFIG_KEXEC=y
--# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
--CONFIG_PM=y
--CONFIG_NET=y
--CONFIG_PACKET=y
--CONFIG_UNIX=y
--CONFIG_INET=y
--CONFIG_IP_PNP=y
--CONFIG_IP_PNP_DHCP=y
--# CONFIG_IPV6 is not set
--# CONFIG_WIRELESS is not set
--CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
--CONFIG_DEVTMPFS=y
--CONFIG_DEVTMPFS_MOUNT=y
--# CONFIG_STANDALONE is not set
--# CONFIG_PREVENT_FIRMWARE_BUILD is not set
--# CONFIG_FW_LOADER is not set
--CONFIG_SCSI=y
--CONFIG_BLK_DEV_SD=y
--CONFIG_ATA=y
--CONFIG_ATA_SFF=y
--CONFIG_ATA_BMDMA=y
--CONFIG_SATA_RCAR=y
--CONFIG_NETDEVICES=y
--# CONFIG_NET_VENDOR_BROADCOM is not set
--# CONFIG_NET_VENDOR_FARADAY is not set
--# CONFIG_NET_VENDOR_INTEL is not set
--# CONFIG_NET_VENDOR_MICREL is not set
--# CONFIG_NET_VENDOR_NATSEMI is not set
--# CONFIG_NET_VENDOR_SEEQ is not set
--CONFIG_SMSC911X=y
--# CONFIG_NET_VENDOR_STMICRO is not set
--# CONFIG_WLAN is not set
--# CONFIG_INPUT_MOUSEDEV is not set
--CONFIG_INPUT_EVDEV=y
--# CONFIG_INPUT_MOUSE is not set
--# CONFIG_VT is not set
--# CONFIG_LEGACY_PTYS is not set
--# CONFIG_DEVKMEM is not set
--CONFIG_SERIAL_SH_SCI=y
--CONFIG_SERIAL_SH_SCI_NR_UARTS=6
--CONFIG_SERIAL_SH_SCI_CONSOLE=y
--# CONFIG_HW_RANDOM is not set
--CONFIG_I2C=y
--CONFIG_I2C_RCAR=y
--CONFIG_SPI=y
--CONFIG_SPI_SH_HSPI=y
--CONFIG_GPIO_SYSFS=y
--CONFIG_GPIO_RCAR=y
--# CONFIG_HWMON is not set
--CONFIG_THERMAL=y
--CONFIG_RCAR_THERMAL=y
--CONFIG_SSB=y
--CONFIG_REGULATOR=y
--CONFIG_MEDIA_SUPPORT=y
--CONFIG_MEDIA_CAMERA_SUPPORT=y
--CONFIG_V4L_PLATFORM_DRIVERS=y
--CONFIG_SOC_CAMERA=y
--CONFIG_VIDEO_RCAR_VIN=y
--# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
--CONFIG_VIDEO_ADV7180=y
--CONFIG_DRM=y
--CONFIG_DRM_RCAR_DU=y
--CONFIG_USB=y
--CONFIG_USB_RCAR_PHY=y
--CONFIG_MMC=y
--CONFIG_MMC_SDHI=y
--CONFIG_USB_EHCI_HCD=y
--CONFIG_USB_OHCI_HCD=y
--CONFIG_USB_OHCI_HCD_PLATFORM=y
--CONFIG_USB_EHCI_HCD_PLATFORM=y
--CONFIG_USB_STORAGE=y
--CONFIG_NEW_LEDS=y
--CONFIG_LEDS_CLASS=y
--CONFIG_LEDS_GPIO=y
--CONFIG_DMADEVICES=y
--CONFIG_RCAR_HPB_DMAE=y
--CONFIG_UIO=y
--CONFIG_UIO_PDRV_GENIRQ=y
--# CONFIG_IOMMU_SUPPORT is not set
--# CONFIG_DNOTIFY is not set
--CONFIG_TMPFS=y
--# CONFIG_MISC_FILESYSTEMS is not set
--CONFIG_NFS_FS=y
--CONFIG_ROOT_NFS=y
--CONFIG_MAGIC_SYSRQ=y
--CONFIG_DEBUG_INFO=y
--CONFIG_DEBUG_INFO_REDUCED=y
--# CONFIG_FTRACE is not set
--CONFIG_DEBUG_USER=y
--CONFIG_AVERAGE=y
---
-2.6.2
-
diff --git a/patches.renesas/0190-ARM-shmobile-lager-Fix-adv7511-IRQ-sensing.patch b/patches.renesas/0190-ARM-shmobile-lager-Fix-adv7511-IRQ-sensing.patch
deleted file mode 100644
index ee776bfd7c87e6..00000000000000
--- a/patches.renesas/0190-ARM-shmobile-lager-Fix-adv7511-IRQ-sensing.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 97aeae46796625c54b9b215800319e6ef0040582 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Wed, 6 May 2015 07:05:31 +0300
-Subject: [PATCH 190/326] ARM: shmobile: lager: Fix adv7511 IRQ sensing
-
-The adv7511 IRQ is low level triggered, not falling edge triggered. The
-wrong sense configuration results in no interrupt being triggered at
-all, breaking hotplug detection. Fix it.
-
-Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Tested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 850346eccc2d32dd6d0a3b08e6ac127b8982c067)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790-lager.dts | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts
-index 5ae07a8385c5..37dec5269491 100644
---- a/arch/arm/boot/dts/r8a7790-lager.dts
-+++ b/arch/arm/boot/dts/r8a7790-lager.dts
-@@ -548,7 +548,7 @@
- compatible = "adi,adv7511w";
- reg = <0x39>;
- interrupt-parent = <&gpio1>;
-- interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
-+ interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
-
- adi,input-depth = <8>;
- adi,input-colorspace = "rgb";
---
-2.6.2
-
diff --git a/patches.renesas/0191-ARM-shmobile-r8a7790-Add-Audio-CTU-support-on-DTSI.patch b/patches.renesas/0191-ARM-shmobile-r8a7790-Add-Audio-CTU-support-on-DTSI.patch
deleted file mode 100644
index 856516a919f21b..00000000000000
--- a/patches.renesas/0191-ARM-shmobile-r8a7790-Add-Audio-CTU-support-on-DTSI.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From e7001c8034fa4a46448dbb5805772d6c4421606d Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 21 Jul 2015 00:26:20 +0000
-Subject: [PATCH 191/326] ARM: shmobile: r8a7790: Add Audio CTU support on DTSI
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit a7163784961e513a6d8c60b264737af623d1f33c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 16 ++++++++++++++++
- include/dt-bindings/clock/r8a7790-clock.h | 2 ++
- 2 files changed, 18 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index 3ae0c3bfb9b9..6aa1d759690b 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -1303,6 +1303,7 @@
- <&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>;
-@@ -1312,6 +1313,7 @@
- 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_CTU1_MIX1 R8A7790_CLK_SCU_CTU0_MIX0
- 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
- >;
-@@ -1321,6 +1323,7 @@
- "ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
- "scu-all",
- "scu-dvc1", "scu-dvc0",
-+ "scu-ctu1-mix1", "scu-ctu0-mix0",
- "scu-src9", "scu-src8", "scu-src7", "scu-src6", "scu-src5",
- "scu-src4", "scu-src3", "scu-src2", "scu-src1", "scu-src0";
- };
-@@ -1536,6 +1539,7 @@
- <&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_CTU0_MIX0>, <&mstp10_clks R8A7790_CLK_SCU_CTU1_MIX1>,
- <&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",
-@@ -1543,6 +1547,7 @@
- "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",
-+ "ctu.0", "ctu.1",
- "dvc.0", "dvc.1",
- "clk_a", "clk_b", "clk_c", "clk_i";
-
-@@ -1559,6 +1564,17 @@
- };
- };
-
-+ rcar_sound,ctu {
-+ ctu00: ctu@0 { };
-+ ctu01: ctu@1 { };
-+ ctu02: ctu@2 { };
-+ ctu03: ctu@3 { };
-+ ctu10: ctu@4 { };
-+ ctu11: ctu@5 { };
-+ ctu12: ctu@6 { };
-+ ctu13: ctu@7 { };
-+ };
-+
- rcar_sound,src {
- src0: src@0 {
- interrupts = <0 352 IRQ_TYPE_LEVEL_HIGH>;
-diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
-index e119ef372ba3..7b1ad8922eec 100644
---- a/include/dt-bindings/clock/r8a7790-clock.h
-+++ b/include/dt-bindings/clock/r8a7790-clock.h
-@@ -144,6 +144,8 @@
- #define R8A7790_CLK_SCU_ALL 17
- #define R8A7790_CLK_SCU_DVC1 18
- #define R8A7790_CLK_SCU_DVC0 19
-+#define R8A7790_CLK_SCU_CTU1_MIX1 20
-+#define R8A7790_CLK_SCU_CTU0_MIX0 21
- #define R8A7790_CLK_SCU_SRC9 22
- #define R8A7790_CLK_SCU_SRC8 23
- #define R8A7790_CLK_SCU_SRC7 24
---
-2.6.2
-
diff --git a/patches.renesas/0192-ARM-shmobile-r8a7790-Add-Audio-MIX-support-on-DTSI.patch b/patches.renesas/0192-ARM-shmobile-r8a7790-Add-Audio-MIX-support-on-DTSI.patch
deleted file mode 100644
index b7211a41f047ac..00000000000000
--- a/patches.renesas/0192-ARM-shmobile-r8a7790-Add-Audio-MIX-support-on-DTSI.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From d3e031652483d16a210a8a50233bf8ac55a41000 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 21 Jul 2015 00:26:42 +0000
-Subject: [PATCH 192/326] ARM: shmobile: r8a7790: Add Audio MIX support on DTSI
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit fc67bf42fa9a3e7c891e6318475f9c4d81a1d44e)
-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 6aa1d759690b..f1cdccc0a8c8 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -1540,6 +1540,7 @@
- <&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_CTU0_MIX0>, <&mstp10_clks R8A7790_CLK_SCU_CTU1_MIX1>,
-+ <&mstp10_clks R8A7790_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7790_CLK_SCU_CTU1_MIX1>,
- <&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",
-@@ -1548,6 +1549,7 @@
- "src.9", "src.8", "src.7", "src.6", "src.5",
- "src.4", "src.3", "src.2", "src.1", "src.0",
- "ctu.0", "ctu.1",
-+ "mix.0", "mix.1",
- "dvc.0", "dvc.1",
- "clk_a", "clk_b", "clk_c", "clk_i";
-
-@@ -1564,6 +1566,11 @@
- };
- };
-
-+ rcar_sound,mix {
-+ mix0: mix@0 { };
-+ mix1: mix@1 { };
-+ };
-+
- rcar_sound,ctu {
- ctu00: ctu@0 { };
- ctu01: ctu@1 { };
---
-2.6.2
-
diff --git a/patches.renesas/0193-ARM-shmobile-r8a7791-Add-Audio-CTU-support-on-DTSI.patch b/patches.renesas/0193-ARM-shmobile-r8a7791-Add-Audio-CTU-support-on-DTSI.patch
deleted file mode 100644
index 4efe0345a3214b..00000000000000
--- a/patches.renesas/0193-ARM-shmobile-r8a7791-Add-Audio-CTU-support-on-DTSI.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 8640cfa02fad88d729a096f2c99f2911cd6ae45e Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 21 Jul 2015 00:27:03 +0000
-Subject: [PATCH 193/326] ARM: shmobile: r8a7791: Add Audio CTU support 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 88401702fe395880bb03c9d17720185c1d89b43f)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 16 ++++++++++++++++
- include/dt-bindings/clock/r8a7791-clock.h | 2 ++
- 2 files changed, 18 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index 07ea2bebe496..cdd55b82ba4e 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -1311,6 +1311,7 @@
- <&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>;
-@@ -1320,6 +1321,7 @@
- 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_CTU1_MIX1 R8A7791_CLK_SCU_CTU0_MIX0
- 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
- >;
-@@ -1329,6 +1331,7 @@
- "ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
- "scu-all",
- "scu-dvc1", "scu-dvc0",
-+ "scu-ctu1-mix1", "scu-ctu0-mix0",
- "scu-src9", "scu-src8", "scu-src7", "scu-src6", "scu-src5",
- "scu-src4", "scu-src3", "scu-src2", "scu-src1", "scu-src0";
- };
-@@ -1582,6 +1585,7 @@
- <&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_CTU0_MIX0>, <&mstp10_clks R8A7791_CLK_SCU_CTU1_MIX1>,
- <&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",
-@@ -1589,6 +1593,7 @@
- "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",
-+ "ctu.0", "ctu.1",
- "dvc.0", "dvc.1",
- "clk_a", "clk_b", "clk_c", "clk_i";
-
-@@ -1605,6 +1610,17 @@
- };
- };
-
-+ rcar_sound,ctu {
-+ ctu00: ctu@0 { };
-+ ctu01: ctu@1 { };
-+ ctu02: ctu@2 { };
-+ ctu03: ctu@3 { };
-+ ctu10: ctu@4 { };
-+ ctu11: ctu@5 { };
-+ ctu12: ctu@6 { };
-+ ctu13: ctu@7 { };
-+ };
-+
- rcar_sound,src {
- src0: src@0 {
- interrupts = <0 352 IRQ_TYPE_LEVEL_HIGH>;
-diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
-index 402268384b99..dd09b73c4aaf 100644
---- a/include/dt-bindings/clock/r8a7791-clock.h
-+++ b/include/dt-bindings/clock/r8a7791-clock.h
-@@ -141,6 +141,8 @@
- #define R8A7791_CLK_SCU_ALL 17
- #define R8A7791_CLK_SCU_DVC1 18
- #define R8A7791_CLK_SCU_DVC0 19
-+#define R8A7791_CLK_SCU_CTU1_MIX1 20
-+#define R8A7791_CLK_SCU_CTU0_MIX0 21
- #define R8A7791_CLK_SCU_SRC9 22
- #define R8A7791_CLK_SCU_SRC8 23
- #define R8A7791_CLK_SCU_SRC7 24
---
-2.6.2
-
diff --git a/patches.renesas/0194-ARM-shmobile-r8a7791-Add-Audio-MIX-support-on-DTSI.patch b/patches.renesas/0194-ARM-shmobile-r8a7791-Add-Audio-MIX-support-on-DTSI.patch
deleted file mode 100644
index adddb66fe812de..00000000000000
--- a/patches.renesas/0194-ARM-shmobile-r8a7791-Add-Audio-MIX-support-on-DTSI.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 927714095d241026132ab3e55895d9db5eaaeee4 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 21 Jul 2015 00:27:24 +0000
-Subject: [PATCH 194/326] ARM: shmobile: r8a7791: Add Audio MIX support 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 7fd6e11dca09b21efbe2b9db4eff08c8f4a16125)
-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 cdd55b82ba4e..d37339bd7cdb 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -1586,6 +1586,7 @@
- <&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_CTU0_MIX0>, <&mstp10_clks R8A7791_CLK_SCU_CTU1_MIX1>,
-+ <&mstp10_clks R8A7791_CLK_SCU_CTU0_MIX0>, <&mstp10_clks R8A7791_CLK_SCU_CTU1_MIX1>,
- <&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",
-@@ -1594,6 +1595,7 @@
- "src.9", "src.8", "src.7", "src.6", "src.5",
- "src.4", "src.3", "src.2", "src.1", "src.0",
- "ctu.0", "ctu.1",
-+ "mix.0", "mix.1",
- "dvc.0", "dvc.1",
- "clk_a", "clk_b", "clk_c", "clk_i";
-
-@@ -1610,6 +1612,11 @@
- };
- };
-
-+ rcar_sound,mix {
-+ mix0: mix@0 { };
-+ mix1: mix@1 { };
-+ };
-+
- rcar_sound,ctu {
- ctu00: ctu@0 { };
- ctu01: ctu@1 { };
---
-2.6.2
-
diff --git a/patches.renesas/0195-ARM-shmobile-Enable-fixed-voltage-regulator-in-shmob.patch b/patches.renesas/0195-ARM-shmobile-Enable-fixed-voltage-regulator-in-shmob.patch
deleted file mode 100644
index fbef06eebf4c21..00000000000000
--- a/patches.renesas/0195-ARM-shmobile-Enable-fixed-voltage-regulator-in-shmob.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 3ab274297fd2bf39a2b59e4a1338cb38404cb10b Mon Sep 17 00:00:00 2001
-From: Simon Horman <horms+renesas@verge.net.au>
-Date: Wed, 15 Jul 2015 15:42:35 +0900
-Subject: [PATCH 195/326] ARM: shmobile: Enable fixed voltage regulator in
- shmobile_defconfig
-
-This is selected by MACH_MARZEN which is enabled in shmobile_defconfig,
-however, MACH_MARZEN is going away along with the board code it enables.
-
-Acked-by: Magnus Damm <damm@opensource.se>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 4055a722d260ca30610fc52238d0aa49ff5bffa9)
-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 8da509327265..89bf31ccfbfa 100644
---- a/arch/arm/configs/shmobile_defconfig
-+++ b/arch/arm/configs/shmobile_defconfig
-@@ -122,6 +122,7 @@ CONFIG_WATCHDOG=y
- CONFIG_DA9063_WATCHDOG=y
- CONFIG_MFD_AS3711=y
- CONFIG_MFD_DA9063=y
-+CONFIG_REGULATOR_FIXED_VOLTAGE=y
- CONFIG_REGULATOR_AS3711=y
- CONFIG_REGULATOR_DA9210=y
- CONFIG_REGULATOR_GPIO=y
---
-2.6.2
-
diff --git a/patches.renesas/0196-ARM-shmobile-marzen-reference-Remove-C-board-code.patch b/patches.renesas/0196-ARM-shmobile-marzen-reference-Remove-C-board-code.patch
deleted file mode 100644
index af467b5677990e..00000000000000
--- a/patches.renesas/0196-ARM-shmobile-marzen-reference-Remove-C-board-code.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-From 41a11fa59dfc6dccafcac5788ed0464b36e6cbd2 Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Mon, 13 Jul 2015 15:15:12 +0900
-Subject: [PATCH 196/326] ARM: shmobile: marzen-reference: Remove C board code
-
-The generic r8a7779 machine vector is now feature-wise equivalent
-to the Marzen-reference case, so simply remove the Marzen C board
-code to fall over on the generic r8a7779 machine vector.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 26f9e03fb1c8b8b5dd2f1ad34da775cc129df98a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/Kconfig | 7 ----
- arch/arm/mach-shmobile/Makefile | 4 +-
- arch/arm/mach-shmobile/board-marzen-reference.c | 56 -------------------------
- 3 files changed, 1 insertion(+), 66 deletions(-)
- delete mode 100644 arch/arm/mach-shmobile/board-marzen-reference.c
-
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index d57bbf1beb70..6f3713f3cb36 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -96,13 +96,6 @@ config ARCH_SH73A0
- select ARCH_RMOBILE
- select RENESAS_INTC_IRQPIN
-
--comment "Renesas ARM SoCs Board Type"
--
--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 6cb095107f90..b180eafb0b87 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -51,9 +51,7 @@ obj-$(CONFIG_PM_RMOBILE) += pm-rmobile.o
- obj-$(CONFIG_ARCH_RCAR_GEN2) += pm-rcar-gen2.o
-
- # Board objects
--ifdef CONFIG_ARCH_SHMOBILE_MULTI
--obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o
--else
-+ifndef CONFIG_ARCH_SHMOBILE_MULTI
- obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
- obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
- obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
-diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
-deleted file mode 100644
-index b15eb923263f..000000000000
---- a/arch/arm/mach-shmobile/board-marzen-reference.c
-+++ /dev/null
-@@ -1,56 +0,0 @@
--/*
-- * marzen board support - Reference DT implementation
-- *
-- * Copyright (C) 2011 Renesas Solutions Corp.
-- * Copyright (C) 2011 Magnus Damm
-- * Copyright (C) 2013 Simon Horman
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; version 2 of the License.
-- *
-- * 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/clk/shmobile.h>
--#include <linux/clocksource.h>
--#include <linux/of_platform.h>
--
--#include <asm/irq.h>
--#include <asm/mach/arch.h>
--
--#include "common.h"
--#include "irqs.h"
--#include "r8a7779.h"
--
--static void __init marzen_init_timer(void)
--{
-- r8a7779_clocks_init(r8a7779_read_mode_pins());
-- clocksource_of_init();
--}
--
--static void __init marzen_init(void)
--{
-- of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-- r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
--}
--
--static const char *marzen_boards_compat_dt[] __initdata = {
-- "renesas,marzen",
-- "renesas,marzen-reference",
-- NULL,
--};
--
--DT_MACHINE_START(MARZEN, "marzen")
-- .smp = smp_ops(r8a7779_smp_ops),
-- .map_io = r8a7779_map_io,
-- .init_early = shmobile_init_delay,
-- .init_time = marzen_init_timer,
-- .init_irq = r8a7779_init_irq_dt,
-- .init_machine = marzen_init,
-- .init_late = shmobile_init_late,
-- .dt_compat = marzen_boards_compat_dt,
--MACHINE_END
---
-2.6.2
-
diff --git a/patches.renesas/0197-ARM-shmobile-r8a7779-Cleanup-header-file.patch b/patches.renesas/0197-ARM-shmobile-r8a7779-Cleanup-header-file.patch
deleted file mode 100644
index b00b97d44f9e15..00000000000000
--- a/patches.renesas/0197-ARM-shmobile-r8a7779-Cleanup-header-file.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From b450e449dbed0aad40d9560c4b1143c9982b1c7f Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Mon, 13 Jul 2015 15:15:33 +0900
-Subject: [PATCH 197/326] ARM: shmobile: r8a7779: Cleanup header file
-
-Remove unused function prototypes from r8a7779.h and
-make the functions static.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 640780efdd97eefd9ee78e1cd03ba97b1a1e1d9a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/clock-r8a7779.c | 2 +-
- arch/arm/mach-shmobile/r8a7779.h | 2 --
- arch/arm/mach-shmobile/setup-r8a7779.c | 2 +-
- 3 files changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
-index fa8ab2cc9187..a376ba3b67c0 100644
---- a/arch/arm/mach-shmobile/clock-r8a7779.c
-+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
-@@ -201,7 +201,7 @@ static struct clk_lookup lookups[] = {
- CLKDEV_DEV_ID("rcar-du-r8a7779", &mstp_clks[MSTP103]), /* DU */
- };
-
--void __init r8a7779_clock_init(void)
-+static void __init r8a7779_clock_init(void)
- {
- u32 mode = r8a7779_read_mode_pins();
- int k, ret = 0;
-diff --git a/arch/arm/mach-shmobile/r8a7779.h b/arch/arm/mach-shmobile/r8a7779.h
-index 19f97046dd70..f69c7477178b 100644
---- a/arch/arm/mach-shmobile/r8a7779.h
-+++ b/arch/arm/mach-shmobile/r8a7779.h
-@@ -11,7 +11,6 @@ enum {
- };
-
- extern void r8a7779_init_irq_extpin(int irlm);
--extern void r8a7779_init_irq_extpin_dt(int irlm);
- extern void r8a7779_init_irq_dt(void);
- extern void r8a7779_map_io(void);
- extern void r8a7779_earlytimer_init(void);
-@@ -19,7 +18,6 @@ extern void r8a7779_add_early_devices(void);
- extern void r8a7779_add_standard_devices(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);
- extern void r8a7779_register_twd(void);
-diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
-index 2c3e433f84ca..f436cba958fa 100644
---- a/arch/arm/mach-shmobile/setup-r8a7779.c
-+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
-@@ -99,7 +99,7 @@ static struct resource irqpin0_resources[] __initdata = {
- DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */
- };
-
--void __init r8a7779_init_irq_extpin_dt(int irlm)
-+static void __init r8a7779_init_irq_extpin_dt(int irlm)
- {
- void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
- u32 tmp;
---
-2.6.2
-
diff --git a/patches.renesas/0198-ARM-shmobile-marzen-Remove-legacy-board-code.patch b/patches.renesas/0198-ARM-shmobile-marzen-Remove-legacy-board-code.patch
deleted file mode 100644
index f398ff9395ffd8..00000000000000
--- a/patches.renesas/0198-ARM-shmobile-marzen-Remove-legacy-board-code.patch
+++ /dev/null
@@ -1,441 +0,0 @@
-From 1e3facf4f962aa7cf5a085c6242f06124770f1c6 Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Thu, 16 Jul 2015 16:53:52 +0900
-Subject: [PATCH 198/326] ARM: shmobile: marzen: Remove legacy board code
-
-Remove Marzen legacy board code written in C. Instead
-board support expressed in DT shall be used together
-with Multiplatform and shmobile_defconfig.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit b97fdb836a36df53de5685278c0126a222903c5e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-
-Conflicts:
- arch/arm/boot/dts/Makefile
- arch/arm/mach-shmobile/Kconfig
- arch/arm/mach-shmobile/Makefile
- arch/arm/mach-shmobile/Makefile.boot
----
- arch/arm/boot/dts/Makefile | 3 +-
- arch/arm/mach-shmobile/Kconfig | 7 -
- arch/arm/mach-shmobile/Makefile | 1 -
- arch/arm/mach-shmobile/Makefile.boot | 1 -
- arch/arm/mach-shmobile/board-marzen.c | 347 ----------------------------------
- 5 files changed, 1 insertion(+), 358 deletions(-)
- delete mode 100644 arch/arm/mach-shmobile/board-marzen.c
-
-diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
-index 908fcbf656c1..964ae0041a67 100644
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -478,8 +478,7 @@ dtb-$(CONFIG_ARCH_S5PV210) += \
- s5pv210-torbreck.dtb
- dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += \
- r8a7778-bockw.dtb \
-- r8a7778-bockw-reference.dtb \
-- r8a7779-marzen.dtb
-+ r8a7778-bockw-reference.dtb
- dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += \
- emev2-kzm9d.dtb \
- r7s72100-genmai.dtb \
-diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
-index 6f3713f3cb36..926e336d6aeb 100644
---- a/arch/arm/mach-shmobile/Kconfig
-+++ b/arch/arm/mach-shmobile/Kconfig
-@@ -139,13 +139,6 @@ config MACH_BOCKW_REFERENCE
-
- This is intended to aid developers
-
--config MACH_MARZEN
-- bool "MARZEN board"
-- depends on ARCH_R8A7779
-- select ARCH_REQUIRE_GPIOLIB
-- select REGULATOR_FIXED_VOLTAGE if REGULATOR
-- select USE_OF
--
- comment "Renesas ARM SoCs System Configuration"
-
- config CPU_HAS_INTEVT
-diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
-index b180eafb0b87..7bdb3ca099e1 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -54,7 +54,6 @@ obj-$(CONFIG_ARCH_RCAR_GEN2) += pm-rcar-gen2.o
- ifndef CONFIG_ARCH_SHMOBILE_MULTI
- obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
- obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
--obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
- endif
-
- # Framework support
-diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
-index 14cdfc0ed075..a489fe9a76cd 100644
---- a/arch/arm/mach-shmobile/Makefile.boot
-+++ b/arch/arm/mach-shmobile/Makefile.boot
-@@ -2,7 +2,6 @@
- loadaddr-y :=
- loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
- loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000
--loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
-
- __ZRELADDR := $(sort $(loadaddr-y))
- zreladdr-y += $(__ZRELADDR)
-diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
-deleted file mode 100644
-index 51db288f192a..000000000000
---- a/arch/arm/mach-shmobile/board-marzen.c
-+++ /dev/null
-@@ -1,347 +0,0 @@
--/*
-- * marzen board support
-- *
-- * Copyright (C) 2011, 2013 Renesas Solutions Corp.
-- * Copyright (C) 2011 Magnus Damm
-- * Copyright (C) 2013 Cogent Embedded, Inc.
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; version 2 of the License.
-- *
-- * 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/kernel.h>
--#include <linux/init.h>
--#include <linux/interrupt.h>
--#include <linux/irq.h>
--#include <linux/platform_device.h>
--#include <linux/delay.h>
--#include <linux/io.h>
--#include <linux/leds.h>
--#include <linux/dma-mapping.h>
--#include <linux/pinctrl/machine.h>
--#include <linux/platform_data/camera-rcar.h>
--#include <linux/platform_data/gpio-rcar.h>
--#include <linux/platform_data/usb-rcar-phy.h>
--#include <linux/regulator/fixed.h>
--#include <linux/regulator/machine.h>
--#include <linux/smsc911x.h>
--#include <linux/spi/spi.h>
--#include <linux/spi/sh_hspi.h>
--#include <linux/mmc/host.h>
--#include <linux/mmc/sh_mobile_sdhi.h>
--#include <linux/mfd/tmio.h>
--
--#include <media/soc_camera.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[] = {
-- REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
-- REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
--};
--
--/* Dummy supplies, where voltage doesn't matter */
--static struct regulator_consumer_supply dummy_supplies[] = {
-- REGULATOR_SUPPLY("vddvario", "smsc911x"),
-- REGULATOR_SUPPLY("vdd33a", "smsc911x"),
--};
--
--/* USB PHY */
--static struct resource usb_phy_resources[] = {
-- [0] = {
-- .start = 0xffe70800,
-- .end = 0xffe70900 - 1,
-- .flags = IORESOURCE_MEM,
-- },
--};
--
--static struct rcar_phy_platform_data usb_phy_platform_data;
--
--static struct platform_device usb_phy = {
-- .name = "rcar_usb_phy",
-- .id = -1,
-- .dev = {
-- .platform_data = &usb_phy_platform_data,
-- },
-- .resource = usb_phy_resources,
-- .num_resources = ARRAY_SIZE(usb_phy_resources),
--};
--
--/* SMSC LAN89218 */
--static struct resource smsc911x_resources[] = {
-- [0] = {
-- .start = 0x18000000, /* ExCS0 */
-- .end = 0x180000ff, /* A1->A7 */
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = irq_pin(1), /* IRQ 1 */
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct smsc911x_platform_config smsc911x_platdata = {
-- .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
-- .phy_interface = PHY_INTERFACE_MODE_MII,
-- .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
-- .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
--};
--
--static struct platform_device eth_device = {
-- .name = "smsc911x",
-- .id = -1,
-- .dev = {
-- .platform_data = &smsc911x_platdata,
-- },
-- .resource = smsc911x_resources,
-- .num_resources = ARRAY_SIZE(smsc911x_resources),
--};
--
--static struct resource sdhi0_resources[] = {
-- [0] = {
-- .name = "sdhi0",
-- .start = 0xffe4c000,
-- .end = 0xffe4c0ff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_iid(0x88),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct tmio_mmc_data sdhi0_platform_data = {
-- .chan_priv_tx = (void *)HPBDMA_SLAVE_SDHI0_TX,
-- .chan_priv_rx = (void *)HPBDMA_SLAVE_SDHI0_RX,
-- .flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
-- .capabilities = MMC_CAP_SD_HIGHSPEED,
--};
--
--static struct platform_device sdhi0_device = {
-- .name = "sh_mobile_sdhi",
-- .num_resources = ARRAY_SIZE(sdhi0_resources),
-- .resource = sdhi0_resources,
-- .id = 0,
-- .dev = {
-- .platform_data = &sdhi0_platform_data,
-- }
--};
--
--/* Thermal */
--static struct resource thermal_resources[] = {
-- [0] = {
-- .start = 0xFFC48000,
-- .end = 0xFFC48038 - 1,
-- .flags = IORESOURCE_MEM,
-- },
--};
--
--static struct platform_device thermal_device = {
-- .name = "rcar_thermal",
-- .resource = thermal_resources,
-- .num_resources = ARRAY_SIZE(thermal_resources),
--};
--
--/* HSPI */
--static struct resource hspi_resources[] = {
-- [0] = {
-- .start = 0xFFFC7000,
-- .end = 0xFFFC7018 - 1,
-- .flags = IORESOURCE_MEM,
-- },
--};
--
--static struct platform_device hspi_device = {
-- .name = "sh-hspi",
-- .id = 0,
-- .resource = hspi_resources,
-- .num_resources = ARRAY_SIZE(hspi_resources),
--};
--
--/* LEDS */
--static struct gpio_led marzen_leds[] = {
-- {
-- .name = "led2",
-- .gpio = RCAR_GP_PIN(4, 29),
-- .default_state = LEDS_GPIO_DEFSTATE_ON,
-- }, {
-- .name = "led3",
-- .gpio = RCAR_GP_PIN(4, 30),
-- .default_state = LEDS_GPIO_DEFSTATE_ON,
-- }, {
-- .name = "led4",
-- .gpio = RCAR_GP_PIN(4, 31),
-- .default_state = LEDS_GPIO_DEFSTATE_ON,
-- },
--};
--
--static struct gpio_led_platform_data marzen_leds_pdata = {
-- .leds = marzen_leds,
-- .num_leds = ARRAY_SIZE(marzen_leds),
--};
--
--static struct platform_device leds_device = {
-- .name = "leds-gpio",
-- .id = 0,
-- .dev = {
-- .platform_data = &marzen_leds_pdata,
-- },
--};
--
--/* VIN */
--static struct rcar_vin_platform_data vin_platform_data __initdata = {
-- .flags = RCAR_VIN_BT656,
--};
--
--#define MARZEN_VIN(idx) \
--static struct resource vin##idx##_resources[] __initdata = { \
-- DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \
-- DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \
--}; \
-- \
--static struct platform_device_info vin##idx##_info __initdata = { \
-- .name = "r8a7779-vin", \
-- .id = idx, \
-- .res = vin##idx##_resources, \
-- .num_res = ARRAY_SIZE(vin##idx##_resources), \
-- .dma_mask = DMA_BIT_MASK(32), \
-- .data = &vin_platform_data, \
-- .size_data = sizeof(vin_platform_data), \
--}
--MARZEN_VIN(1);
--MARZEN_VIN(3);
--
--#define MARZEN_CAMERA(idx) \
--static struct i2c_board_info camera##idx##_info = { \
-- I2C_BOARD_INFO("adv7180", 0x20 + (idx)), \
--}; \
-- \
--static struct soc_camera_link iclink##idx##_adv7180 = { \
-- .bus_id = 1 + 2 * (idx), \
-- .i2c_adapter_id = 0, \
-- .board_info = &camera##idx##_info, \
--}; \
-- \
--static struct platform_device camera##idx##_device = { \
-- .name = "soc-camera-pdrv", \
-- .id = idx, \
-- .dev = { \
-- .platform_data = &iclink##idx##_adv7180, \
-- }, \
--};
--
--MARZEN_CAMERA(0);
--MARZEN_CAMERA(1);
--
--static struct platform_device *marzen_devices[] __initdata = {
-- &eth_device,
-- &sdhi0_device,
-- &thermal_device,
-- &hspi_device,
-- &leds_device,
-- &usb_phy,
-- &camera0_device,
-- &camera1_device,
--};
--
--static const struct pinctrl_map marzen_pinctrl_map[] = {
-- /* DU (CN10: ARGB0, CN13: LVDS) */
-- PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
-- "du0_rgb888", "du0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
-- "du0_sync_1", "du0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
-- "du0_clk_out_0", "du0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
-- "du1_rgb666", "du1"),
-- PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
-- "du1_sync_1", "du1"),
-- PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
-- "du1_clk_out", "du1"),
-- /* HSPI0 */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
-- "hspi0", "hspi0"),
-- /* SCIF2 (CN18: DEBUG0) */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-r8a7779",
-- "scif2_data_c", "scif2"),
-- /* SCIF4 (CN19: DEBUG1) */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-r8a7779",
-- "scif4_data", "scif4"),
-- /* SDHI0 */
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
-- "sdhi0_data4", "sdhi0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
-- "sdhi0_ctrl", "sdhi0"),
-- PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
-- "sdhi0_cd", "sdhi0"),
-- /* SMSC */
-- PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
-- "intc_irq1_b", "intc"),
-- PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
-- "lbsc_ex_cs0", "lbsc"),
-- /* USB0 */
-- PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
-- "usb0", "usb0"),
-- /* USB1 */
-- PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
-- "usb1", "usb1"),
-- /* USB2 */
-- PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.1", "pfc-r8a7779",
-- "usb2", "usb2"),
-- /* VIN1 */
-- PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.1", "pfc-r8a7779",
-- "vin1_clk", "vin1"),
-- PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.1", "pfc-r8a7779",
-- "vin1_data8", "vin1"),
-- /* VIN3 */
-- PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.3", "pfc-r8a7779",
-- "vin3_clk", "vin3"),
-- PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.3", "pfc-r8a7779",
-- "vin3_data8", "vin3"),
--};
--
--static void __init marzen_init(void)
--{
-- regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
-- ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
-- regulator_register_fixed(1, dummy_supplies,
-- ARRAY_SIZE(dummy_supplies));
--
-- pinctrl_register_mappings(marzen_pinctrl_map,
-- ARRAY_SIZE(marzen_pinctrl_map));
-- r8a7779_pinmux_init();
-- r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */
--
-- r8a7779_add_standard_devices();
-- platform_device_register_full(&vin1_info);
-- platform_device_register_full(&vin3_info);
-- platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
--}
--
--static const char *marzen_boards_compat_dt[] __initdata = {
-- "renesas,marzen",
-- NULL,
--};
--
--DT_MACHINE_START(MARZEN, "marzen")
-- .smp = smp_ops(r8a7779_smp_ops),
-- .map_io = r8a7779_map_io,
-- .init_early = r8a7779_add_early_devices,
-- .init_irq = r8a7779_init_irq_dt,
-- .init_machine = marzen_init,
-- .init_late = r8a7779_init_late,
-- .dt_compat = marzen_boards_compat_dt,
-- .init_time = r8a7779_earlytimer_init,
--MACHINE_END
---
-2.6.2
-
diff --git a/patches.renesas/0199-ARM-shmobile-r8a7779-Remove-legacy-SoC-code.patch b/patches.renesas/0199-ARM-shmobile-r8a7779-Remove-legacy-SoC-code.patch
deleted file mode 100644
index a06ca8d1010800..00000000000000
--- a/patches.renesas/0199-ARM-shmobile-r8a7779-Remove-legacy-SoC-code.patch
+++ /dev/null
@@ -1,1100 +0,0 @@
-From 30e3fa9cf63b7a65e10142a03e79697651a24574 Mon Sep 17 00:00:00 2001
-From: Magnus Damm <damm+renesas@opensource.se>
-Date: Thu, 16 Jul 2015 16:54:03 +0900
-Subject: [PATCH 199/326] ARM: shmobile: r8a7779: Remove legacy SoC code
-
-Now when the Marzen legacy board code is gone this patch
-removes the unused r8a7779 legacy SoC code.
-
-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit c99cd90d98a98aa101b169e44d249e5cd71f46f2)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/mach-shmobile/Makefile | 1 -
- arch/arm/mach-shmobile/clock-r8a7779.c | 271 -------------
- arch/arm/mach-shmobile/r8a7779.h | 17 -
- arch/arm/mach-shmobile/setup-r8a7779.c | 674 +--------------------------------
- arch/arm/mach-shmobile/smp-r8a7779.c | 9 -
- 5 files changed, 4 insertions(+), 968 deletions(-)
- delete mode 100644 arch/arm/mach-shmobile/clock-r8a7779.c
-
-diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
-index 7bdb3ca099e1..476de30798d7 100644
---- a/arch/arm/mach-shmobile/Makefile
-+++ b/arch/arm/mach-shmobile/Makefile
-@@ -22,7 +22,6 @@ obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
- ifndef CONFIG_COMMON_CLK
- obj-y += clock.o
- obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o
--obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
- endif
-
- # CPU reset vector handling objects
-diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
-deleted file mode 100644
-index a376ba3b67c0..000000000000
---- a/arch/arm/mach-shmobile/clock-r8a7779.c
-+++ /dev/null
-@@ -1,271 +0,0 @@
--/*
-- * r8a7779 clock framework support
-- *
-- * Copyright (C) 2011 Renesas Solutions Corp.
-- * Copyright (C) 2011 Magnus Damm
-- *
-- * This program is free software; you can redistribute it and/or modify
-- * it under the terms of the GNU General Public License as published by
-- * the Free Software Foundation; either version 2 of the License
-- *
-- * 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/bitops.h>
--#include <linux/init.h>
--#include <linux/kernel.h>
--#include <linux/io.h>
--#include <linux/sh_clk.h>
--#include <linux/clkdev.h>
--#include <linux/sh_timer.h>
--
--#include "clock.h"
--#include "common.h"
--#include "r8a7779.h"
--
--/*
-- * MD1 = 1 MD1 = 0
-- * (PLLA = 1500) (PLLA = 1600)
-- * (MHz) (MHz)
-- *------------------------------------------------+--------------------
-- * clkz 1000 (2/3) 800 (1/2)
-- * clkzs 250 (1/6) 200 (1/8)
-- * clki 750 (1/2) 800 (1/2)
-- * clks 250 (1/6) 200 (1/8)
-- * clks1 125 (1/12) 100 (1/16)
-- * clks3 187.5 (1/8) 200 (1/8)
-- * clks4 93.7 (1/16) 100 (1/16)
-- * clkp 62.5 (1/24) 50 (1/32)
-- * clkg 62.5 (1/24) 66.6 (1/24)
-- * clkb, CLKOUT
-- * (MD2 = 0) 62.5 (1/24) 66.6 (1/24)
-- * (MD2 = 1) 41.6 (1/36) 50 (1/32)
--*/
--
--#define MD(nr) BIT(nr)
--
--#define MSTPCR0 IOMEM(0xffc80030)
--#define MSTPCR1 IOMEM(0xffc80034)
--#define MSTPCR3 IOMEM(0xffc8003c)
--#define MSTPSR1 IOMEM(0xffc80044)
--
--/* ioremap() through clock mapping mandatory to avoid
-- * collision with ARM coherent DMA virtual memory range.
-- */
--
--static struct clk_mapping cpg_mapping = {
-- .phys = 0xffc80000,
-- .len = 0x80,
--};
--
--/*
-- * Default rate for the root input clock, reset this with clk_set_rate()
-- * from the platform code.
-- */
--static struct clk plla_clk = {
-- /* .rate will be updated on r8a7779_clock_init() */
-- .mapping = &cpg_mapping,
--};
--
--/*
-- * clock ratio of these clock will be updated
-- * on r8a7779_clock_init()
-- */
--SH_FIXED_RATIO_CLK_SET(clkz_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clkzs_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clki_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clks_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clks1_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clks3_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clks4_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clkb_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clkout_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clkp_clk, plla_clk, 1, 1);
--SH_FIXED_RATIO_CLK_SET(clkg_clk, plla_clk, 1, 1);
--
--static struct clk *main_clks[] = {
-- &plla_clk,
-- &clkz_clk,
-- &clkzs_clk,
-- &clki_clk,
-- &clks_clk,
-- &clks1_clk,
-- &clks3_clk,
-- &clks4_clk,
-- &clkb_clk,
-- &clkout_clk,
-- &clkp_clk,
-- &clkg_clk,
--};
--
--enum { MSTP323, MSTP322, MSTP321, MSTP320,
-- MSTP120,
-- MSTP116, MSTP115, MSTP114,
-- MSTP110, MSTP109, MSTP108,
-- MSTP103, MSTP101, MSTP100,
-- MSTP030,
-- MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
-- MSTP016, MSTP015, MSTP014,
-- MSTP007,
-- MSTP_NR };
--
--static struct clk mstp_clks[MSTP_NR] = {
-- [MSTP323] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 23, 0), /* SDHI0 */
-- [MSTP322] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 22, 0), /* SDHI1 */
-- [MSTP321] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 21, 0), /* SDHI2 */
-- [MSTP320] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 20, 0), /* SDHI3 */
-- [MSTP120] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 20, MSTPSR1, 0), /* VIN3 */
-- [MSTP116] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 16, MSTPSR1, 0), /* PCIe */
-- [MSTP115] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 15, MSTPSR1, 0), /* SATA */
-- [MSTP114] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 14, MSTPSR1, 0), /* Ether */
-- [MSTP110] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 10, MSTPSR1, 0), /* VIN0 */
-- [MSTP109] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 9, MSTPSR1, 0), /* VIN1 */
-- [MSTP108] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 8, MSTPSR1, 0), /* VIN2 */
-- [MSTP103] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 3, MSTPSR1, 0), /* DU */
-- [MSTP101] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 1, MSTPSR1, 0), /* USB2 */
-- [MSTP100] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 0, MSTPSR1, 0), /* USB0/1 */
-- [MSTP030] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 30, 0), /* I2C0 */
-- [MSTP029] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 29, 0), /* I2C1 */
-- [MSTP028] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 28, 0), /* I2C2 */
-- [MSTP027] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 27, 0), /* I2C3 */
-- [MSTP026] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 26, 0), /* SCIF0 */
-- [MSTP025] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 25, 0), /* SCIF1 */
-- [MSTP024] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 24, 0), /* SCIF2 */
-- [MSTP023] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 23, 0), /* SCIF3 */
-- [MSTP022] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 22, 0), /* SCIF4 */
-- [MSTP021] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 21, 0), /* SCIF5 */
-- [MSTP016] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 16, 0), /* TMU0 */
-- [MSTP015] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 15, 0), /* TMU1 */
-- [MSTP014] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 14, 0), /* TMU2 */
-- [MSTP007] = SH_CLK_MSTP32(&clks_clk, MSTPCR0, 7, 0), /* HSPI */
--};
--
--static struct clk_lookup lookups[] = {
-- /* main clocks */
-- CLKDEV_CON_ID("plla_clk", &plla_clk),
-- CLKDEV_CON_ID("clkz_clk", &clkz_clk),
-- CLKDEV_CON_ID("clkzs_clk", &clkzs_clk),
--
-- /* DIV4 clocks */
-- CLKDEV_CON_ID("shyway_clk", &clks_clk),
-- CLKDEV_CON_ID("bus_clk", &clkout_clk),
-- CLKDEV_CON_ID("shyway4_clk", &clks4_clk),
-- CLKDEV_CON_ID("shyway3_clk", &clks3_clk),
-- CLKDEV_CON_ID("shyway1_clk", &clks1_clk),
-- CLKDEV_CON_ID("peripheral_clk", &clkp_clk),
--
-- /* MSTP32 clocks */
-- CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
-- CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
-- CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
-- CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
-- CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
-- CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
-- CLKDEV_DEV_ID("r8a7779-vin.1", &mstp_clks[MSTP109]), /* VIN1 */
-- CLKDEV_DEV_ID("r8a7779-vin.2", &mstp_clks[MSTP108]), /* VIN2 */
-- CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */
-- CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */
-- CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
-- CLKDEV_DEV_ID("ohci-platform.0", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
-- CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP016]), /* TMU0 */
-- CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
-- CLKDEV_DEV_ID("ffc70000.i2c", &mstp_clks[MSTP030]), /* I2C0 */
-- CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
-- CLKDEV_DEV_ID("ffc71000.i2c", &mstp_clks[MSTP029]), /* I2C1 */
-- CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
-- CLKDEV_DEV_ID("ffc72000.i2c", &mstp_clks[MSTP028]), /* I2C2 */
-- 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("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
-- CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
-- CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP023]), /* SCIF3 */
-- CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */
-- CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */
-- 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 */
-- CLKDEV_DEV_ID("fffc8000.spi", &mstp_clks[MSTP007]), /* HSPI1 */
-- CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */
-- CLKDEV_DEV_ID("fffc6000.spi", &mstp_clks[MSTP007]), /* HSPI2 */
-- CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
-- CLKDEV_DEV_ID("ffe4c000.sd", &mstp_clks[MSTP323]), /* SDHI0 */
-- CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
-- CLKDEV_DEV_ID("ffe4d000.sd", &mstp_clks[MSTP322]), /* SDHI1 */
-- CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
-- CLKDEV_DEV_ID("ffe4e000.sd", &mstp_clks[MSTP321]), /* SDHI2 */
-- CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */
-- CLKDEV_DEV_ID("ffe4f000.sd", &mstp_clks[MSTP320]), /* SDHI3 */
-- CLKDEV_DEV_ID("rcar-du-r8a7779", &mstp_clks[MSTP103]), /* DU */
--};
--
--static void __init r8a7779_clock_init(void)
--{
-- u32 mode = r8a7779_read_mode_pins();
-- int k, ret = 0;
--
-- if (mode & MD(1)) {
-- plla_clk.rate = 1500000000;
--
-- SH_CLK_SET_RATIO(&clkz_clk_ratio, 2, 3);
-- SH_CLK_SET_RATIO(&clkzs_clk_ratio, 1, 6);
-- SH_CLK_SET_RATIO(&clki_clk_ratio, 1, 2);
-- SH_CLK_SET_RATIO(&clks_clk_ratio, 1, 6);
-- SH_CLK_SET_RATIO(&clks1_clk_ratio, 1, 12);
-- SH_CLK_SET_RATIO(&clks3_clk_ratio, 1, 8);
-- SH_CLK_SET_RATIO(&clks4_clk_ratio, 1, 16);
-- SH_CLK_SET_RATIO(&clkp_clk_ratio, 1, 24);
-- SH_CLK_SET_RATIO(&clkg_clk_ratio, 1, 24);
-- if (mode & MD(2)) {
-- SH_CLK_SET_RATIO(&clkb_clk_ratio, 1, 36);
-- SH_CLK_SET_RATIO(&clkout_clk_ratio, 1, 36);
-- } else {
-- SH_CLK_SET_RATIO(&clkb_clk_ratio, 1, 24);
-- SH_CLK_SET_RATIO(&clkout_clk_ratio, 1, 24);
-- }
-- } else {
-- plla_clk.rate = 1600000000;
--
-- SH_CLK_SET_RATIO(&clkz_clk_ratio, 1, 2);
-- SH_CLK_SET_RATIO(&clkzs_clk_ratio, 1, 8);
-- SH_CLK_SET_RATIO(&clki_clk_ratio, 1, 2);
-- SH_CLK_SET_RATIO(&clks_clk_ratio, 1, 8);
-- SH_CLK_SET_RATIO(&clks1_clk_ratio, 1, 16);
-- SH_CLK_SET_RATIO(&clks3_clk_ratio, 1, 8);
-- SH_CLK_SET_RATIO(&clks4_clk_ratio, 1, 16);
-- SH_CLK_SET_RATIO(&clkp_clk_ratio, 1, 32);
-- SH_CLK_SET_RATIO(&clkg_clk_ratio, 1, 24);
-- if (mode & MD(2)) {
-- SH_CLK_SET_RATIO(&clkb_clk_ratio, 1, 32);
-- SH_CLK_SET_RATIO(&clkout_clk_ratio, 1, 32);
-- } else {
-- SH_CLK_SET_RATIO(&clkb_clk_ratio, 1, 24);
-- SH_CLK_SET_RATIO(&clkout_clk_ratio, 1, 24);
-- }
-- }
--
-- for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
-- ret = clk_register(main_clks[k]);
--
-- if (!ret)
-- ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
--
-- clkdev_add_table(lookups, ARRAY_SIZE(lookups));
--
-- if (!ret)
-- shmobile_clk_init();
-- 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/r8a7779.h b/arch/arm/mach-shmobile/r8a7779.h
-index f69c7477178b..db303f76704e 100644
---- a/arch/arm/mach-shmobile/r8a7779.h
-+++ b/arch/arm/mach-shmobile/r8a7779.h
-@@ -3,24 +3,7 @@
-
- #include <linux/sh_clk.h>
-
--/* HPB-DMA slave IDs */
--enum {
-- HPBDMA_SLAVE_DUMMY,
-- HPBDMA_SLAVE_SDHI0_TX,
-- HPBDMA_SLAVE_SDHI0_RX,
--};
--
--extern void r8a7779_init_irq_extpin(int irlm);
--extern void r8a7779_init_irq_dt(void);
--extern void r8a7779_map_io(void);
--extern void r8a7779_earlytimer_init(void);
--extern void r8a7779_add_early_devices(void);
--extern void r8a7779_add_standard_devices(void);
--extern void r8a7779_init_late(void);
--extern u32 r8a7779_read_mode_pins(void);
--extern void r8a7779_pinmux_init(void);
- extern void r8a7779_pm_init(void);
--extern void r8a7779_register_twd(void);
-
- #ifdef CONFIG_PM
- extern void __init r8a7779_init_pm_domains(void);
-diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
-index f436cba958fa..c18d85a96c67 100644
---- a/arch/arm/mach-shmobile/setup-r8a7779.c
-+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
-@@ -16,37 +16,15 @@
- */
- #include <linux/clk/shmobile.h>
- #include <linux/clocksource.h>
--#include <linux/kernel.h>
- #include <linux/init.h>
--#include <linux/interrupt.h>
- #include <linux/irq.h>
- #include <linux/irqchip.h>
- #include <linux/irqchip/arm-gic.h>
--#include <linux/of_platform.h>
--#include <linux/platform_data/dma-rcar-hpbdma.h>
--#include <linux/platform_data/gpio-rcar.h>
--#include <linux/platform_data/irq-renesas-intc-irqpin.h>
--#include <linux/platform_device.h>
--#include <linux/delay.h>
--#include <linux/input.h>
--#include <linux/io.h>
--#include <linux/serial_sci.h>
--#include <linux/sh_timer.h>
--#include <linux/dma-mapping.h>
--#include <linux/usb/otg.h>
--#include <linux/usb/hcd.h>
--#include <linux/usb/ehci_pdriver.h>
--#include <linux/usb/ohci_pdriver.h>
--#include <linux/pm_runtime.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 = {
-@@ -66,7 +44,7 @@ static struct map_desc r8a7779_io_desc[] __initdata = {
- },
- };
-
--void __init r8a7779_map_io(void)
-+static void __init r8a7779_map_io(void)
- {
- debug_ll_io_init();
- iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));
-@@ -82,652 +60,12 @@ void __init r8a7779_map_io(void)
- #define INT2NTSR0 IOMEM(0xfe700060)
- #define INT2NTSR1 IOMEM(0xfe700064)
-
--static struct renesas_intc_irqpin_config irqpin0_platform_data __initdata = {
-- .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
-- .sense_bitfield_width = 2,
--};
--
--static struct resource irqpin0_resources[] __initdata = {
-- DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */
-- DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */
-- DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */
-- DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */
-- DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */
-- DEFINE_RES_IRQ(gic_spi(27)), /* IRQ0 */
-- DEFINE_RES_IRQ(gic_spi(28)), /* IRQ1 */
-- DEFINE_RES_IRQ(gic_spi(29)), /* IRQ2 */
-- DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */
--};
--
--static void __init r8a7779_init_irq_extpin_dt(int irlm)
--{
-- void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
-- u32 tmp;
--
-- if (!icr0) {
-- pr_warn("r8a7779: unable to setup external irq pin mode\n");
-- return;
-- }
--
-- tmp = ioread32(icr0);
-- if (irlm)
-- tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */
-- else
-- tmp &= ~(1 << 23); /* IRL mode - not supported */
-- tmp |= (1 << 21); /* LVLMODE = 1 */
-- iowrite32(tmp, icr0);
-- iounmap(icr0);
--}
--
--void __init r8a7779_init_irq_extpin(int irlm)
--{
-- r8a7779_init_irq_extpin_dt(irlm);
-- if (irlm)
-- platform_device_register_resndata(
-- NULL, "renesas_intc_irqpin", -1,
-- irqpin0_resources, ARRAY_SIZE(irqpin0_resources),
-- &irqpin0_platform_data, sizeof(irqpin0_platform_data));
--}
--
--/* PFC/GPIO */
--static struct resource r8a7779_pfc_resources[] = {
-- DEFINE_RES_MEM(0xfffc0000, 0x023c),
--};
--
--static struct platform_device r8a7779_pfc_device = {
-- .name = "pfc-r8a7779",
-- .id = -1,
-- .resource = r8a7779_pfc_resources,
-- .num_resources = ARRAY_SIZE(r8a7779_pfc_resources),
--};
--
--#define R8A7779_GPIO(idx, npins) \
--static struct resource r8a7779_gpio##idx##_resources[] = { \
-- DEFINE_RES_MEM(0xffc40000 + (0x1000 * (idx)), 0x002c), \
-- DEFINE_RES_IRQ(gic_iid(0xad + (idx))), \
--}; \
-- \
--static struct gpio_rcar_config r8a7779_gpio##idx##_platform_data = { \
-- .gpio_base = 32 * (idx), \
-- .irq_base = 0, \
-- .number_of_pins = npins, \
-- .pctl_name = "pfc-r8a7779", \
--}; \
-- \
--static struct platform_device r8a7779_gpio##idx##_device = { \
-- .name = "gpio_rcar", \
-- .id = idx, \
-- .resource = r8a7779_gpio##idx##_resources, \
-- .num_resources = ARRAY_SIZE(r8a7779_gpio##idx##_resources), \
-- .dev = { \
-- .platform_data = &r8a7779_gpio##idx##_platform_data, \
-- }, \
--}
--
--R8A7779_GPIO(0, 32);
--R8A7779_GPIO(1, 32);
--R8A7779_GPIO(2, 32);
--R8A7779_GPIO(3, 32);
--R8A7779_GPIO(4, 32);
--R8A7779_GPIO(5, 32);
--R8A7779_GPIO(6, 9);
--
--static struct platform_device *r8a7779_pinctrl_devices[] __initdata = {
-- &r8a7779_pfc_device,
-- &r8a7779_gpio0_device,
-- &r8a7779_gpio1_device,
-- &r8a7779_gpio2_device,
-- &r8a7779_gpio3_device,
-- &r8a7779_gpio4_device,
-- &r8a7779_gpio5_device,
-- &r8a7779_gpio6_device,
--};
--
--void __init r8a7779_pinmux_init(void)
--{
-- platform_add_devices(r8a7779_pinctrl_devices,
-- ARRAY_SIZE(r8a7779_pinctrl_devices));
--}
--
--/* SCIF */
--#define R8A7779_SCIF(index, baseaddr, irq) \
--static struct plat_sci_port scif##index##_platform_data = { \
-- .type = PORT_SCIF, \
-- .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
-- .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, \
--}; \
-- \
--static struct resource scif##index##_resources[] = { \
-- DEFINE_RES_MEM(baseaddr, 0x100), \
-- DEFINE_RES_IRQ(irq), \
--}; \
-- \
--static struct platform_device scif##index##_device = { \
-- .name = "sh-sci", \
-- .id = index, \
-- .resource = scif##index##_resources, \
-- .num_resources = ARRAY_SIZE(scif##index##_resources), \
-- .dev = { \
-- .platform_data = &scif##index##_platform_data, \
-- }, \
--}
--
--R8A7779_SCIF(0, 0xffe40000, gic_iid(0x78));
--R8A7779_SCIF(1, 0xffe41000, gic_iid(0x79));
--R8A7779_SCIF(2, 0xffe42000, gic_iid(0x7a));
--R8A7779_SCIF(3, 0xffe43000, gic_iid(0x7b));
--R8A7779_SCIF(4, 0xffe44000, gic_iid(0x7c));
--R8A7779_SCIF(5, 0xffe45000, gic_iid(0x7d));
--
--/* TMU */
--static struct sh_timer_config tmu0_platform_data = {
-- .channels_mask = 7,
--};
--
--static struct resource tmu0_resources[] = {
-- DEFINE_RES_MEM(0xffd80000, 0x30),
-- DEFINE_RES_IRQ(gic_iid(0x40)),
-- DEFINE_RES_IRQ(gic_iid(0x41)),
-- DEFINE_RES_IRQ(gic_iid(0x42)),
--};
--
--static struct platform_device tmu0_device = {
-- .name = "sh-tmu",
-- .id = 0,
-- .dev = {
-- .platform_data = &tmu0_platform_data,
-- },
-- .resource = tmu0_resources,
-- .num_resources = ARRAY_SIZE(tmu0_resources),
--};
--
--/* I2C */
--static struct resource rcar_i2c0_res[] = {
-- {
-- .start = 0xffc70000,
-- .end = 0xffc70fff,
-- .flags = IORESOURCE_MEM,
-- }, {
-- .start = gic_iid(0x6f),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device i2c0_device = {
-- .name = "i2c-rcar",
-- .id = 0,
-- .resource = rcar_i2c0_res,
-- .num_resources = ARRAY_SIZE(rcar_i2c0_res),
--};
--
--static struct resource rcar_i2c1_res[] = {
-- {
-- .start = 0xffc71000,
-- .end = 0xffc71fff,
-- .flags = IORESOURCE_MEM,
-- }, {
-- .start = gic_iid(0x72),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device i2c1_device = {
-- .name = "i2c-rcar",
-- .id = 1,
-- .resource = rcar_i2c1_res,
-- .num_resources = ARRAY_SIZE(rcar_i2c1_res),
--};
--
--static struct resource rcar_i2c2_res[] = {
-- {
-- .start = 0xffc72000,
-- .end = 0xffc72fff,
-- .flags = IORESOURCE_MEM,
-- }, {
-- .start = gic_iid(0x70),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device i2c2_device = {
-- .name = "i2c-rcar",
-- .id = 2,
-- .resource = rcar_i2c2_res,
-- .num_resources = ARRAY_SIZE(rcar_i2c2_res),
--};
--
--static struct resource rcar_i2c3_res[] = {
-- {
-- .start = 0xffc73000,
-- .end = 0xffc73fff,
-- .flags = IORESOURCE_MEM,
-- }, {
-- .start = gic_iid(0x71),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device i2c3_device = {
-- .name = "i2c-rcar",
-- .id = 3,
-- .resource = rcar_i2c3_res,
-- .num_resources = ARRAY_SIZE(rcar_i2c3_res),
--};
--
--static struct resource sata_resources[] = {
-- [0] = {
-- .name = "rcar-sata",
-- .start = 0xfc600000,
-- .end = 0xfc601fff,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_iid(0x84),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device sata_device = {
-- .name = "sata_rcar",
-- .id = -1,
-- .resource = sata_resources,
-- .num_resources = ARRAY_SIZE(sata_resources),
-- .dev = {
-- .dma_mask = &sata_device.dev.coherent_dma_mask,
-- .coherent_dma_mask = DMA_BIT_MASK(32),
-- },
--};
--
--/* USB */
--static struct usb_phy *phy;
--
--static int usb_power_on(struct platform_device *pdev)
-+static void __init r8a7779_init_irq_dt(void)
- {
-- if (IS_ERR(phy))
-- return PTR_ERR(phy);
--
-- pm_runtime_enable(&pdev->dev);
-- pm_runtime_get_sync(&pdev->dev);
--
-- usb_phy_init(phy);
--
-- return 0;
--}
--
--static void usb_power_off(struct platform_device *pdev)
--{
-- if (IS_ERR(phy))
-- return;
--
-- usb_phy_shutdown(phy);
--
-- pm_runtime_put_sync(&pdev->dev);
-- pm_runtime_disable(&pdev->dev);
--}
--
--static int ehci_init_internal_buffer(struct usb_hcd *hcd)
--{
-- /*
-- * Below are recommended values from the datasheet;
-- * see [USB :: Setting of EHCI Internal Buffer].
-- */
-- /* EHCI IP internal buffer setting */
-- iowrite32(0x00ff0040, hcd->regs + 0x0094);
-- /* EHCI IP internal buffer enable */
-- iowrite32(0x00000001, hcd->regs + 0x009C);
--
-- return 0;
--}
--
--static struct usb_ehci_pdata ehcix_pdata = {
-- .power_on = usb_power_on,
-- .power_off = usb_power_off,
-- .power_suspend = usb_power_off,
-- .pre_setup = ehci_init_internal_buffer,
--};
--
--static struct resource ehci0_resources[] = {
-- [0] = {
-- .start = 0xffe70000,
-- .end = 0xffe70400 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_iid(0x4c),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device ehci0_device = {
-- .name = "ehci-platform",
-- .id = 0,
-- .dev = {
-- .dma_mask = &ehci0_device.dev.coherent_dma_mask,
-- .coherent_dma_mask = 0xffffffff,
-- .platform_data = &ehcix_pdata,
-- },
-- .num_resources = ARRAY_SIZE(ehci0_resources),
-- .resource = ehci0_resources,
--};
--
--static struct resource ehci1_resources[] = {
-- [0] = {
-- .start = 0xfff70000,
-- .end = 0xfff70400 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_iid(0x4d),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device ehci1_device = {
-- .name = "ehci-platform",
-- .id = 1,
-- .dev = {
-- .dma_mask = &ehci1_device.dev.coherent_dma_mask,
-- .coherent_dma_mask = 0xffffffff,
-- .platform_data = &ehcix_pdata,
-- },
-- .num_resources = ARRAY_SIZE(ehci1_resources),
-- .resource = ehci1_resources,
--};
--
--static struct usb_ohci_pdata ohcix_pdata = {
-- .power_on = usb_power_on,
-- .power_off = usb_power_off,
-- .power_suspend = usb_power_off,
--};
--
--static struct resource ohci0_resources[] = {
-- [0] = {
-- .start = 0xffe70400,
-- .end = 0xffe70800 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_iid(0x4c),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device ohci0_device = {
-- .name = "ohci-platform",
-- .id = 0,
-- .dev = {
-- .dma_mask = &ohci0_device.dev.coherent_dma_mask,
-- .coherent_dma_mask = 0xffffffff,
-- .platform_data = &ohcix_pdata,
-- },
-- .num_resources = ARRAY_SIZE(ohci0_resources),
-- .resource = ohci0_resources,
--};
--
--static struct resource ohci1_resources[] = {
-- [0] = {
-- .start = 0xfff70400,
-- .end = 0xfff70800 - 1,
-- .flags = IORESOURCE_MEM,
-- },
-- [1] = {
-- .start = gic_iid(0x4d),
-- .flags = IORESOURCE_IRQ,
-- },
--};
--
--static struct platform_device ohci1_device = {
-- .name = "ohci-platform",
-- .id = 1,
-- .dev = {
-- .dma_mask = &ohci1_device.dev.coherent_dma_mask,
-- .coherent_dma_mask = 0xffffffff,
-- .platform_data = &ohcix_pdata,
-- },
-- .num_resources = ARRAY_SIZE(ohci1_resources),
-- .resource = ohci1_resources,
--};
--
--/* HPB-DMA */
--
--/* Asynchronous mode register bits */
--#define HPB_DMAE_ASYNCMDR_ASMD43_MASK BIT(23) /* MMC1 */
--#define HPB_DMAE_ASYNCMDR_ASMD43_SINGLE BIT(23) /* MMC1 */
--#define HPB_DMAE_ASYNCMDR_ASMD43_MULTI 0 /* MMC1 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD43_MASK BIT(22) /* MMC1 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD43_BURST BIT(22) /* MMC1 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD43_NBURST 0 /* MMC1 */
--#define HPB_DMAE_ASYNCMDR_ASMD24_MASK BIT(21) /* MMC0 */
--#define HPB_DMAE_ASYNCMDR_ASMD24_SINGLE BIT(21) /* MMC0 */
--#define HPB_DMAE_ASYNCMDR_ASMD24_MULTI 0 /* MMC0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD24_MASK BIT(20) /* MMC0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD24_BURST BIT(20) /* MMC0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD24_NBURST 0 /* MMC0 */
--#define HPB_DMAE_ASYNCMDR_ASMD41_MASK BIT(19) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASMD41_SINGLE BIT(19) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASMD41_MULTI 0 /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD41_MASK BIT(18) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD41_BURST BIT(18) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD41_NBURST 0 /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASMD40_MASK BIT(17) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASMD40_SINGLE BIT(17) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASMD40_MULTI 0 /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD40_MASK BIT(16) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD40_BURST BIT(16) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD40_NBURST 0 /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASMD39_MASK BIT(15) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASMD39_SINGLE BIT(15) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASMD39_MULTI 0 /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD39_MASK BIT(14) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD39_BURST BIT(14) /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD39_NBURST 0 /* SDHI3 */
--#define HPB_DMAE_ASYNCMDR_ASMD27_MASK BIT(13) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASMD27_SINGLE BIT(13) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASMD27_MULTI 0 /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD27_MASK BIT(12) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD27_BURST BIT(12) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD27_NBURST 0 /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASMD26_MASK BIT(11) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASMD26_SINGLE BIT(11) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASMD26_MULTI 0 /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD26_MASK BIT(10) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD26_BURST BIT(10) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD26_NBURST 0 /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASMD25_MASK BIT(9) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASMD25_SINGLE BIT(9) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASMD25_MULTI 0 /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD25_MASK BIT(8) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD25_BURST BIT(8) /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD25_NBURST 0 /* SDHI2 */
--#define HPB_DMAE_ASYNCMDR_ASMD23_MASK BIT(7) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASMD23_SINGLE BIT(7) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASMD23_MULTI 0 /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD23_MASK BIT(6) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD23_BURST BIT(6) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD23_NBURST 0 /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASMD22_MASK BIT(5) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE BIT(5) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASMD22_MULTI 0 /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD22_MASK BIT(4) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD22_BURST BIT(4) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST 0 /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASMD21_MASK BIT(3) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(3) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD21_MASK BIT(2) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD21_BURST BIT(2) /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST 0 /* SDHI0 */
--#define HPB_DMAE_ASYNCMDR_ASMD20_MASK BIT(1) /* SDHI1 */
--#define HPB_DMAE_ASYNCMDR_ASMD20_SINGLE BIT(1) /* SDHI1 */
--#define HPB_DMAE_ASYNCMDR_ASMD20_MULTI 0 /* SDHI1 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD20_MASK BIT(0) /* SDHI1 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD20_BURST BIT(0) /* SDHI1 */
--#define HPB_DMAE_ASYNCMDR_ASBTMD20_NBURST 0 /* SDHI1 */
--
--static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
-- {
-- .id = HPBDMA_SLAVE_SDHI0_TX,
-- .addr = 0xffe4c000 + 0x30,
-- .dcr = HPB_DMAE_DCR_SPDS_16BIT |
-- HPB_DMAE_DCR_DMDL |
-- HPB_DMAE_DCR_DPDS_16BIT,
-- .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
-- HPB_DMAE_ASYNCRSTR_ASRST22 |
-- HPB_DMAE_ASYNCRSTR_ASRST23,
-- .mdr = HPB_DMAE_ASYNCMDR_ASMD21_SINGLE |
-- HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST,
-- .mdm = HPB_DMAE_ASYNCMDR_ASMD21_MASK |
-- HPB_DMAE_ASYNCMDR_ASBTMD21_MASK,
-- .port = 0x0D0C,
-- .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
-- .dma_ch = 21,
-- }, {
-- .id = HPBDMA_SLAVE_SDHI0_RX,
-- .addr = 0xffe4c000 + 0x30,
-- .dcr = HPB_DMAE_DCR_SMDL |
-- HPB_DMAE_DCR_SPDS_16BIT |
-- HPB_DMAE_DCR_DPDS_16BIT,
-- .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
-- HPB_DMAE_ASYNCRSTR_ASRST22 |
-- HPB_DMAE_ASYNCRSTR_ASRST23,
-- .mdr = HPB_DMAE_ASYNCMDR_ASMD22_SINGLE |
-- HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST,
-- .mdm = HPB_DMAE_ASYNCMDR_ASMD22_MASK |
-- HPB_DMAE_ASYNCMDR_ASBTMD22_MASK,
-- .port = 0x0D0C,
-- .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
-- .dma_ch = 22,
-- },
--};
--
--static const struct hpb_dmae_channel hpb_dmae_channels[] = {
-- HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
-- HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
--};
--
--static struct hpb_dmae_pdata dma_platform_data __initdata = {
-- .slaves = hpb_dmae_slaves,
-- .num_slaves = ARRAY_SIZE(hpb_dmae_slaves),
-- .channels = hpb_dmae_channels,
-- .num_channels = ARRAY_SIZE(hpb_dmae_channels),
-- .ts_shift = {
-- [XMIT_SZ_8BIT] = 0,
-- [XMIT_SZ_16BIT] = 1,
-- [XMIT_SZ_32BIT] = 2,
-- },
-- .num_hw_channels = 44,
--};
--
--static struct resource hpb_dmae_resources[] __initdata = {
-- /* Channel registers */
-- DEFINE_RES_MEM(0xffc08000, 0x1000),
-- /* Common registers */
-- DEFINE_RES_MEM(0xffc09000, 0x170),
-- /* Asynchronous reset registers */
-- DEFINE_RES_MEM(0xffc00300, 4),
-- /* Asynchronous mode registers */
-- DEFINE_RES_MEM(0xffc00400, 4),
-- /* IRQ for DMA channels */
-- DEFINE_RES_NAMED(gic_iid(0x8e), 12, NULL, IORESOURCE_IRQ),
--};
--
--static void __init r8a7779_register_hpb_dmae(void)
--{
-- platform_device_register_resndata(NULL, "hpb-dma-engine",
-- -1, hpb_dmae_resources,
-- ARRAY_SIZE(hpb_dmae_resources),
-- &dma_platform_data,
-- sizeof(dma_platform_data));
--}
--
--static struct platform_device *r8a7779_early_devices[] __initdata = {
-- &tmu0_device,
--};
--
--static struct platform_device *r8a7779_standard_devices[] __initdata = {
-- &scif0_device,
-- &scif1_device,
-- &scif2_device,
-- &scif3_device,
-- &scif4_device,
-- &scif5_device,
-- &i2c0_device,
-- &i2c1_device,
-- &i2c2_device,
-- &i2c3_device,
-- &sata_device,
--};
--
--void __init r8a7779_add_standard_devices(void)
--{
--#ifdef CONFIG_CACHE_L2X0
-- /* Shared attribute override enable, 64K*16way */
-- l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff);
--#endif
-- r8a7779_pm_init();
--
-- r8a7779_init_pm_domains();
--
-- platform_add_devices(r8a7779_early_devices,
-- ARRAY_SIZE(r8a7779_early_devices));
-- platform_add_devices(r8a7779_standard_devices,
-- ARRAY_SIZE(r8a7779_standard_devices));
-- r8a7779_register_hpb_dmae();
--}
--
--void __init r8a7779_add_early_devices(void)
--{
-- early_platform_add_devices(r8a7779_early_devices,
-- ARRAY_SIZE(r8a7779_early_devices));
--
-- /* Early serial console setup is not included here due to
-- * memory map collisions. The SCIF serial ports in r8a7779
-- * are difficult to identity map 1:1 due to collision with the
-- * virtual memory range used by the coherent DMA code on ARM.
-- *
-- * Anyone wanting to debug early can remove UPF_IOREMAP from
-- * the sh-sci serial console platform data, adjust mapbase
-- * to a static M:N virt:phys mapping that needs to be added to
-- * the mappings passed with iotable_init() above.
-- *
-- * Then add a call to shmobile_setup_console() from this function.
-- *
-- * As a final step pass earlyprint=sh-sci.2,115200 on the kernel
-- * command line in case of the marzen board.
-- */
--}
--
--static struct platform_device *r8a7779_late_devices[] __initdata = {
-- &ehci0_device,
-- &ehci1_device,
-- &ohci0_device,
-- &ohci1_device,
--};
--
--void __init r8a7779_init_late(void)
--{
-- /* get USB PHY */
-- phy = usb_get_phy(USB_PHY_TYPE_USB2);
--
-- shmobile_init_late();
-- platform_add_devices(r8a7779_late_devices,
-- ARRAY_SIZE(r8a7779_late_devices));
--}
--
--#ifdef CONFIG_USE_OF
--void __init r8a7779_init_irq_dt(void)
--{
--#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
-- void __iomem *gic_dist_base = ioremap_nocache(0xf0001000, 0x1000);
-- void __iomem *gic_cpu_base = ioremap_nocache(0xf0000100, 0x1000);
--#endif
- gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE);
-
--#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
-- gic_init(0, 29, gic_dist_base, gic_cpu_base);
--#else
- irqchip_init();
--#endif
-+
- /* route all interrupts to ARM */
- __raw_writel(0xffffffff, INT2NTSR0);
- __raw_writel(0x3fffffff, INT2NTSR1);
-@@ -742,7 +80,7 @@ void __init r8a7779_init_irq_dt(void)
-
- #define MODEMR 0xffcc0020
-
--u32 __init r8a7779_read_mode_pins(void)
-+static u32 __init r8a7779_read_mode_pins(void)
- {
- static u32 mode;
- static bool mode_valid;
-@@ -758,8 +96,6 @@ u32 __init r8a7779_read_mode_pins(void)
- return mode;
- }
-
--#ifdef CONFIG_ARCH_SHMOBILE_MULTI
--
- static void __init r8a7779_init_time(void)
- {
- r8a7779_clocks_init(r8a7779_read_mode_pins());
-@@ -780,5 +116,3 @@ DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
- .init_late = shmobile_init_late,
- .dt_compat = r8a7779_compat_dt,
- MACHINE_END
--#endif /* CONFIG_ARCH_SHMOBILE_MULTI */
--#endif /* CONFIG_USE_OF */
-diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
-index 9122216df060..353562b8a5ee 100644
---- a/arch/arm/mach-shmobile/smp-r8a7779.c
-+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
-@@ -23,7 +23,6 @@
- #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"
-@@ -56,14 +55,6 @@ static const struct rcar_sysc_ch * const r8a7779_ch_cpu[4] = {
- [3] = &r8a7779_ch_cpu3,
- };
-
--#if defined(CONFIG_HAVE_ARM_TWD) && !defined(CONFIG_ARCH_MULTIPLATFORM)
--static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, R8A7779_SCU_BASE + 0x600, 29);
--void __init r8a7779_register_twd(void)
--{
-- twd_local_timer_register(&twd_local_timer);
--}
--#endif
--
- static int r8a7779_platform_cpu_kill(unsigned int cpu)
- {
- const struct rcar_sysc_ch *ch = NULL;
---
-2.6.2
-
diff --git a/patches.renesas/0200-ARM-shmobile-r8a7790-Add-JPU-device-node.patch b/patches.renesas/0200-ARM-shmobile-r8a7790-Add-JPU-device-node.patch
deleted file mode 100644
index 974189f380144b..00000000000000
--- a/patches.renesas/0200-ARM-shmobile-r8a7790-Add-JPU-device-node.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 452a41833a980c7ef37a6d8d1a382ca92a6fb05e Mon Sep 17 00:00:00 2001
-From: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
-Date: Fri, 24 Jul 2015 16:25:45 +0300
-Subject: [PATCH 200/326] ARM: shmobile: r8a7790: Add JPU device node.
-
-This patch contains device tree node definition for JPEG codec peripheral
-found in the Renesas R-Car r8a7790 SoC.
-
-Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit fb847575f8f5a9580c26bdc3e08fe49639144619)
-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 f1cdccc0a8c8..5b2952d5c700 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -872,6 +872,13 @@
- status = "disabled";
- };
-
-+ jpu: jpeg-codec@fe980000 {
-+ compatible = "renesas,jpu-r8a7790";
-+ reg = <0 0xfe980000 0 0x10300>;
-+ interrupts = <0 272 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp1_clks R8A7790_CLK_JPU>;
-+ };
-+
- clocks {
- #address-cells = <2>;
- #size-cells = <2>;
---
-2.6.2
-
diff --git a/patches.renesas/0201-ARM-shmobile-r8a7791-Add-JPU-device-node.patch b/patches.renesas/0201-ARM-shmobile-r8a7791-Add-JPU-device-node.patch
deleted file mode 100644
index 09450db85c41f4..00000000000000
--- a/patches.renesas/0201-ARM-shmobile-r8a7791-Add-JPU-device-node.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From eef190746809edb78c716b38efbec4ac92dfbc1b Mon Sep 17 00:00:00 2001
-From: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
-Date: Fri, 24 Jul 2015 16:25:46 +0300
-Subject: [PATCH 201/326] ARM: shmobile: r8a7791: Add JPU device node.
-
-This patch contains device tree node definition for JPEG codec peripheral
-found in the Renesas R-Car r8a7791 SoC.
-
-Signed-off-by: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 0caa36603300dd4ff4841227cf372e91e940c8bd)
-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 d37339bd7cdb..1cb6c2d07933 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -898,6 +898,13 @@
- status = "disabled";
- };
-
-+ jpu: jpeg-codec@fe980000 {
-+ compatible = "renesas,jpu-r8a7791";
-+ reg = <0 0xfe980000 0 0x10300>;
-+ interrupts = <0 272 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp1_clks R8A7791_CLK_JPU>;
-+ };
-+
- clocks {
- #address-cells = <2>;
- #size-cells = <2>;
---
-2.6.2
-
diff --git a/patches.renesas/0202-ARM-shmobile-r8a7794-add-PFC-DT-support.patch b/patches.renesas/0202-ARM-shmobile-r8a7794-add-PFC-DT-support.patch
deleted file mode 100644
index 7923d4ff9e94c4..00000000000000
--- a/patches.renesas/0202-ARM-shmobile-r8a7794-add-PFC-DT-support.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From ec9f559d75f825e28e65c55f7b1a9007a16041ee Mon Sep 17 00:00:00 2001
-From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Date: Tue, 28 Jul 2015 01:29:31 +0300
-Subject: [PATCH 202/326] ARM: shmobile: r8a7794: add PFC DT support
-
-Define the generic R8A7794 part of the PFC device node.
-
-Based on original patch by Hisashi Nakamura <hisashi.nakamura.ak@renesas.com>.
-
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Acked-by: by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit fd1683c18c372d51aeeeb25efa8b451f922c9c52)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7794.dtsi | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
-index 8824dbd5dbb4..51cc2b975c3f 100644
---- a/arch/arm/boot/dts/r8a7794.dtsi
-+++ b/arch/arm/boot/dts/r8a7794.dtsi
-@@ -108,6 +108,12 @@
- clocks = <&mstp4_clks R8A7794_CLK_IRQC>;
- };
-
-+ pfc: pin-controller@e6060000 {
-+ compatible = "renesas,pfc-r8a7794";
-+ reg = <0 0xe6060000 0 0x11c>;
-+ #gpio-range-cells = <3>;
-+ };
-+
- dmac0: dma-controller@e6700000 {
- compatible = "renesas,rcar-dmac";
- reg = <0 0xe6700000 0 0x20000>;
---
-2.6.2
-
diff --git a/patches.renesas/0203-ARM-shmobile-silk-initial-device-tree.patch b/patches.renesas/0203-ARM-shmobile-silk-initial-device-tree.patch
deleted file mode 100644
index 45fd5a40c8df00..00000000000000
--- a/patches.renesas/0203-ARM-shmobile-silk-initial-device-tree.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 489844a218c6f46e4ef35ee708d36a63694ac495 Mon Sep 17 00:00:00 2001
-From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Date: Wed, 29 Jul 2015 01:14:59 +0300
-Subject: [PATCH 203/326] ARM: shmobile: silk: initial device tree
-
-Add the initial device tree for the R8A7794 SoC based SILK low cost board.
-SCIF2 serial port support is included, so that the serial console can work.
-
-Based on the original patch by Vladimir Barinov
-<vladimir.barinov@cogentembedded.com>.
-
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit a42fc57a9e9d1dbb1d8cc0c3ccf2d7ea1a939559)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/Makefile | 1 +
- arch/arm/boot/dts/r8a7794-silk.dts | 51 ++++++++++++++++++++++++++++++++++++++
- 2 files changed, 52 insertions(+)
- create mode 100644 arch/arm/boot/dts/r8a7794-silk.dts
-
-diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
-index 964ae0041a67..e494ddc34319 100644
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -491,6 +491,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += \
- r8a7791-koelsch.dtb \
- r8a7793-gose.dtb \
- r8a7794-alt.dtb \
-+ r8a7794-silk.dtb \
- sh73a0-kzm9g.dtb
- dtb-$(CONFIG_ARCH_SOCFPGA) += \
- socfpga_arria5_socdk.dtb \
-diff --git a/arch/arm/boot/dts/r8a7794-silk.dts b/arch/arm/boot/dts/r8a7794-silk.dts
-new file mode 100644
-index 000000000000..f3da95b1dedd
---- /dev/null
-+++ b/arch/arm/boot/dts/r8a7794-silk.dts
-@@ -0,0 +1,51 @@
-+/*
-+ * Device Tree Source for the SILK board
-+ *
-+ * Copyright (C) 2014 Renesas Electronics Corporation
-+ * Copyright (C) 2014-2015 Renesas Solutions Corp.
-+ * Copyright (C) 2014-2015 Cogent Embedded, Inc.
-+ *
-+ * 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 "r8a7794.dtsi"
-+
-+/ {
-+ model = "SILK";
-+ compatible = "renesas,silk", "renesas,r8a7794";
-+
-+ aliases {
-+ serial0 = &scif2;
-+ };
-+
-+ chosen {
-+ bootargs = "ignore_loglevel";
-+ stdout-path = &scif2;
-+ };
-+
-+ memory@40000000 {
-+ device_type = "memory";
-+ reg = <0 0x40000000 0 0x40000000>;
-+ };
-+};
-+
-+&extal_clk {
-+ clock-frequency = <20000000>;
-+};
-+
-+&pfc {
-+ scif2_pins: serial2 {
-+ renesas,groups = "scif2_data";
-+ renesas,function = "scif2";
-+ };
-+};
-+
-+&scif2 {
-+ pinctrl-0 = <&scif2_pins>;
-+ pinctrl-names = "default";
-+
-+ status = "okay";
-+};
---
-2.6.2
-
diff --git a/patches.renesas/0204-ARM-shmobile-r8a7794-add-MMCIF-DT-support.patch b/patches.renesas/0204-ARM-shmobile-r8a7794-add-MMCIF-DT-support.patch
deleted file mode 100644
index 2a64c0919f4aef..00000000000000
--- a/patches.renesas/0204-ARM-shmobile-r8a7794-add-MMCIF-DT-support.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 09e340e3c76ca26385d2cb35a03c6ac7ead56b3b Mon Sep 17 00:00:00 2001
-From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Date: Fri, 31 Jul 2015 00:54:05 +0300
-Subject: [PATCH 204/326] ARM: shmobile: r8a7794: add MMCIF DT support
-
-Define the generic R8A7794 part of the MMCIF0 device node.
-
-Based on the orginal patch by Shinobu Uehara <shinobu.uehara.xc@renesas.com>.
-
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 6cdf6ba19c8b9a386ef882206b29d97a49271317)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7794.dtsi | 11 +++++++++++
- 1 file changed, 11 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
-index 51cc2b975c3f..43acf185ecc4 100644
---- a/arch/arm/boot/dts/r8a7794.dtsi
-+++ b/arch/arm/boot/dts/r8a7794.dtsi
-@@ -383,6 +383,17 @@
- status = "disabled";
- };
-
-+ mmcif0: mmc@ee200000 {
-+ compatible = "renesas,mmcif-r8a7794", "renesas,sh-mmcif";
-+ reg = <0 0xee200000 0 0x80>;
-+ interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp3_clks R8A7794_CLK_MMCIF0>;
-+ dmas = <&dmac0 0xd1>, <&dmac0 0xd2>;
-+ dma-names = "tx", "rx";
-+ reg-io-width = <4>;
-+ status = "disabled";
-+ };
-+
- sdhi0: sd@ee100000 {
- compatible = "renesas,sdhi-r8a7794";
- reg = <0 0xee100000 0 0x200>;
---
-2.6.2
-
diff --git a/patches.renesas/0205-ARM-shmobile-r8a73a4-dtsi-Add-missing-gpio-ranges-to.patch b/patches.renesas/0205-ARM-shmobile-r8a73a4-dtsi-Add-missing-gpio-ranges-to.patch
deleted file mode 100644
index 75b39deebb084e..00000000000000
--- a/patches.renesas/0205-ARM-shmobile-r8a73a4-dtsi-Add-missing-gpio-ranges-to.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From 097d29a9c165e7bc6db328caaf2631f123057d9a Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 15:55:14 +0200
-Subject: [PATCH 205/326] ARM: shmobile: r8a73a4 dtsi: Add missing
- "gpio-ranges" to gpio node
-
-If a GPIO driver uses gpiochip_add_pin_range() (which is usually the
-case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT
-doesn't work:
-
- requesting hog GPIO led1-high (chip r8a73a4_pfc, offset 28) failed
-
-The actual error code is -517 == -EPROBE_DEFER.
-
-The problem is that PFC+GPIO registration is handled in multiple steps:
- 1. pinctrl_register(),
- 2. gpiochip_add(),
- 3. gpiochip_add_pin_range().
-
-Configuration of the hogs is handled in gpiochip_add():
-
- gpiochip_add
- of_gpiochip_add
- of_gpiochip_scan_hogs
- gpiod_hog
- gpiochip_request_own_desc
- __gpiod_request
- chip->request
- pinctrl_request_gpio
- pinctrl_get_device_gpio_range
-
-However, at this point the GPIO controller hasn't been added to
-pinctrldev_list yet, so the range can't be found, and the operation fails
-with -EPROBE_DEFER.
-
-To fix this, add a "gpio-ranges" property to the gpio device node, so
-the ranges are added by of_gpiochip_add_pin_range(), which is called by
-of_gpiochip_add() before the call to of_gpiochip_scan_hogs().
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Acked-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 17ccec50cc40bef00b26d506d483e928804cb20e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a73a4.dtsi | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
-index 5090d1a8f652..cb4f7b2798fe 100644
---- a/arch/arm/boot/dts/r8a73a4.dtsi
-+++ b/arch/arm/boot/dts/r8a73a4.dtsi
-@@ -207,6 +207,13 @@
- reg = <0 0xe6050000 0 0x9000>;
- gpio-controller;
- #gpio-cells = <2>;
-+ gpio-ranges =
-+ <&pfc 0 0 31>, <&pfc 32 32 9>,
-+ <&pfc 64 64 22>, <&pfc 96 96 31>,
-+ <&pfc 128 128 7>, <&pfc 160 160 19>,
-+ <&pfc 192 192 31>, <&pfc 224 224 27>,
-+ <&pfc 256 256 28>, <&pfc 288 288 21>,
-+ <&pfc 320 320 10>;
- interrupts-extended =
- <&irqc0 0 0>, <&irqc0 1 0>, <&irqc0 2 0>, <&irqc0 3 0>,
- <&irqc0 4 0>, <&irqc0 5 0>, <&irqc0 6 0>, <&irqc0 7 0>,
---
-2.6.2
-
diff --git a/patches.renesas/0206-ARM-shmobile-r8a7740-dtsi-Add-missing-gpio-ranges-to.patch b/patches.renesas/0206-ARM-shmobile-r8a7740-dtsi-Add-missing-gpio-ranges-to.patch
deleted file mode 100644
index 86f26bab2d4fab..00000000000000
--- a/patches.renesas/0206-ARM-shmobile-r8a7740-dtsi-Add-missing-gpio-ranges-to.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From b2b691e4954725d909adda858caa561b780a154a Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 15:55:15 +0200
-Subject: [PATCH 206/326] ARM: shmobile: r8a7740 dtsi: Add missing
- "gpio-ranges" to gpio node
-
-If a GPIO driver uses gpiochip_add_pin_range() (which is usually the
-case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT
-doesn't work:
-
- requesting hog GPIO lcd0 (chip r8a7740_pfc, offset 176) failed
-
-The actual error code is -517 == -EPROBE_DEFER.
-
-The problem is that PFC+GPIO registration is handled in multiple steps:
- 1. pinctrl_register(),
- 2. gpiochip_add(),
- 3. gpiochip_add_pin_range().
-
-Configuration of the hogs is handled in gpiochip_add():
-
- gpiochip_add
- of_gpiochip_add
- of_gpiochip_scan_hogs
- gpiod_hog
- gpiochip_request_own_desc
- __gpiod_request
- chip->request
- pinctrl_request_gpio
- pinctrl_get_device_gpio_range
-
-However, at this point the GPIO controller hasn't been added to
-pinctrldev_list yet, so the range can't be found, and the operation fails
-with -EPROBE_DEFER.
-
-To fix this, add a "gpio-ranges" property to the gpio device node, so
-the range is added by of_gpiochip_add_pin_range(), which is called by
-of_gpiochip_add() before the call to of_gpiochip_scan_hogs().
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Acked-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 09d1c7b4babd3ef9bfc0a148931e5e5702db5e1b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7740.dtsi | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
-index d84714468cce..e14cb1438216 100644
---- a/arch/arm/boot/dts/r8a7740.dtsi
-+++ b/arch/arm/boot/dts/r8a7740.dtsi
-@@ -291,6 +291,7 @@
- <0xe605800c 0x20>;
- gpio-controller;
- #gpio-cells = <2>;
-+ gpio-ranges = <&pfc 0 0 212>;
- interrupts-extended =
- <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>,
- <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
---
-2.6.2
-
diff --git a/patches.renesas/0207-ARM-shmobile-sh73a0-dtsi-Add-missing-gpio-ranges-to-.patch b/patches.renesas/0207-ARM-shmobile-sh73a0-dtsi-Add-missing-gpio-ranges-to-.patch
deleted file mode 100644
index 1b6d035c1b6b08..00000000000000
--- a/patches.renesas/0207-ARM-shmobile-sh73a0-dtsi-Add-missing-gpio-ranges-to-.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 3d1eab6268135e4101b816a2146351093ccbb36b Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 15:55:16 +0200
-Subject: [PATCH 207/326] ARM: shmobile: sh73a0 dtsi: Add missing "gpio-ranges"
- to gpio node
-
-If a GPIO driver uses gpiochip_add_pin_range() (which is usually the
-case for GPIO/PFC combos), the GPIO hogging mechanism configured from DT
-doesn't work:
-
- requesting hog GPIO led1-high (chip sh73a0_pfc, offset 20) failed
-
-The actual error code is -517 == -EPROBE_DEFER.
-
-The problem is that PFC+GPIO registration is handled in multiple steps:
- 1. pinctrl_register(),
- 2. gpiochip_add(),
- 3. gpiochip_add_pin_range().
-
-Configuration of the hogs is handled in gpiochip_add():
-
- gpiochip_add
- of_gpiochip_add
- of_gpiochip_scan_hogs
- gpiod_hog
- gpiochip_request_own_desc
- __gpiod_request
- chip->request
- pinctrl_request_gpio
- pinctrl_get_device_gpio_range
-
-However, at this point the GPIO controller hasn't been added to
-pinctrldev_list yet, so the range can't be found, and the operation fails
-with -EPROBE_DEFER.
-
-To fix this, add a "gpio-ranges" property to the gpio device node, so
-the ranges are added by of_gpiochip_add_pin_range(), which is called by
-of_gpiochip_add() before the call to of_gpiochip_scan_hogs().
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Acked-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 94bdc48d55ca10f90b4a625f0e443197e0013557)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/sh73a0.dtsi | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
-index 11e17c5f26e2..ff7c8f298f30 100644
---- a/arch/arm/boot/dts/sh73a0.dtsi
-+++ b/arch/arm/boot/dts/sh73a0.dtsi
-@@ -392,6 +392,9 @@
- <0xe605801c 0x1c>;
- gpio-controller;
- #gpio-cells = <2>;
-+ gpio-ranges =
-+ <&pfc 0 0 119>, <&pfc 128 128 37>, <&pfc 192 192 91>,
-+ <&pfc 288 288 22>;
- interrupts-extended =
- <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>,
- <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>,
---
-2.6.2
-
diff --git a/patches.renesas/0208-ARM-shmobile-r7s72100-dtsi-Add-CPG-MSTP-Clock-Domain.patch b/patches.renesas/0208-ARM-shmobile-r7s72100-dtsi-Add-CPG-MSTP-Clock-Domain.patch
deleted file mode 100644
index c6c68c60648d5e..00000000000000
--- a/patches.renesas/0208-ARM-shmobile-r7s72100-dtsi-Add-CPG-MSTP-Clock-Domain.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-From 313654a787fd6c06de61841556eea929d15696e3 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:07 +0200
-Subject: [PATCH 208/326] ARM: shmobile: r7s72100 dtsi: Add CPG/MSTP Clock
- Domain
-
-Add an appropriate "#power-domain-cells" property to the cpg_clocks
-device node, to create the CPG/MSTP Clock Domain.
-
-Add "power-domains" properties to all device nodes for devices that are
-part of the CPG/MSTP Clock Domain and can be power-managed through an
-MSTP clock. This applies to most on-SoC devices, which have a
-one-to-one mapping from SoC device to DT device node.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit cbe1f83818c6e2c05fca5045fcc4807177988d61)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r7s72100.dtsi | 19 +++++++++++++++++++
- 1 file changed, 19 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
-index 277e73c110e5..060c32cbd669 100644
---- a/arch/arm/boot/dts/r7s72100.dtsi
-+++ b/arch/arm/boot/dts/r7s72100.dtsi
-@@ -86,6 +86,7 @@
- reg = <0xfcfe0000 0x18>;
- clocks = <&extal_clk>, <&usb_x1_clk>;
- clock-output-names = "pll", "i", "g";
-+ #power-domain-cells = <0>;
- };
-
- /* MSTP clocks */
-@@ -157,6 +158,7 @@
- <0 189 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R7S72100_CLK_SCIF0>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -169,6 +171,7 @@
- <0 193 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R7S72100_CLK_SCIF1>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -181,6 +184,7 @@
- <0 197 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R7S72100_CLK_SCIF2>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -193,6 +197,7 @@
- <0 201 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R7S72100_CLK_SCIF3>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -205,6 +210,7 @@
- <0 205 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R7S72100_CLK_SCIF4>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -217,6 +223,7 @@
- <0 209 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R7S72100_CLK_SCIF5>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -229,6 +236,7 @@
- <0 213 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R7S72100_CLK_SCIF6>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -241,6 +249,7 @@
- <0 217 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R7S72100_CLK_SCIF7>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -252,6 +261,7 @@
- <0 240 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "error", "rx", "tx";
- clocks = <&mstp10_clks R7S72100_CLK_SPI0>;
-+ power-domains = <&cpg_clocks>;
- num-cs = <1>;
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -266,6 +276,7 @@
- <0 243 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "error", "rx", "tx";
- clocks = <&mstp10_clks R7S72100_CLK_SPI1>;
-+ power-domains = <&cpg_clocks>;
- num-cs = <1>;
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -280,6 +291,7 @@
- <0 246 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "error", "rx", "tx";
- clocks = <&mstp10_clks R7S72100_CLK_SPI2>;
-+ power-domains = <&cpg_clocks>;
- num-cs = <1>;
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -294,6 +306,7 @@
- <0 249 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "error", "rx", "tx";
- clocks = <&mstp10_clks R7S72100_CLK_SPI3>;
-+ power-domains = <&cpg_clocks>;
- num-cs = <1>;
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -308,6 +321,7 @@
- <0 252 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "error", "rx", "tx";
- clocks = <&mstp10_clks R7S72100_CLK_SPI4>;
-+ power-domains = <&cpg_clocks>;
- num-cs = <1>;
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -338,6 +352,7 @@
- <0 164 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R7S72100_CLK_I2C0>;
- clock-frequency = <100000>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -356,6 +371,7 @@
- <0 172 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R7S72100_CLK_I2C1>;
- clock-frequency = <100000>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -374,6 +390,7 @@
- <0 180 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R7S72100_CLK_I2C2>;
- clock-frequency = <100000>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -392,6 +409,7 @@
- <0 188 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R7S72100_CLK_I2C3>;
- clock-frequency = <100000>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -402,6 +420,7 @@
- interrupt-names = "tgi0a";
- clocks = <&mstp3_clks R7S72100_CLK_MTU2>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
- };
---
-2.6.2
-
diff --git a/patches.renesas/0209-ARM-shmobile-r8a7778-dtsi-Add-CPG-MSTP-Clock-Domain.patch b/patches.renesas/0209-ARM-shmobile-r8a7778-dtsi-Add-CPG-MSTP-Clock-Domain.patch
deleted file mode 100644
index 607c835d9b3e05..00000000000000
--- a/patches.renesas/0209-ARM-shmobile-r8a7778-dtsi-Add-CPG-MSTP-Clock-Domain.patch
+++ /dev/null
@@ -1,208 +0,0 @@
-From f71a7af29f31ce505ea817914738b14aa3786f67 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:08 +0200
-Subject: [PATCH 209/326] ARM: shmobile: r8a7778 dtsi: Add CPG/MSTP Clock
- Domain
-
-Add an appropriate "#power-domain-cells" property to the cpg_clocks
-device node, to create the CPG/MSTP Clock Domain.
-
-Add "power-domains" properties to all device nodes for devices that are
-part of the CPG/MSTP Clock Domain and can be power-managed through an
-MSTP clock. This applies to most on-SoC devices, which have a
-one-to-one mapping from SoC device to DT device node. A notable
-exception is the "sound" node, which represents multiple SoC devices,
-each having their own MSTP clocks.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit a670f3667a0ad53eef1f66fde41acca890462ec9)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7778.dtsi | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
-index 7ce9f5fd5865..4b1fa9f42ad5 100644
---- a/arch/arm/boot/dts/r8a7778.dtsi
-+++ b/arch/arm/boot/dts/r8a7778.dtsi
-@@ -53,6 +53,7 @@
- reg = <0xfde00000 0x400>;
- interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7778_CLK_ETHER>;
-+ power-domains = <&cpg_clocks>;
- phy-mode = "rmii";
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -152,6 +153,7 @@
- reg = <0xffc70000 0x1000>;
- interrupts = <0 67 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_I2C0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -162,6 +164,7 @@
- reg = <0xffc71000 0x1000>;
- interrupts = <0 78 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_I2C1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -172,6 +175,7 @@
- reg = <0xffc72000 0x1000>;
- interrupts = <0 76 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_I2C2>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -182,6 +186,7 @@
- reg = <0xffc73000 0x1000>;
- interrupts = <0 77 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_I2C3>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -193,6 +198,7 @@
- <0 34 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_TMU0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- #renesas,channels = <3>;
-
-@@ -207,6 +213,7 @@
- <0 38 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_TMU1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- #renesas,channels = <3>;
-
-@@ -221,6 +228,7 @@
- <0 42 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_TMU2>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- #renesas,channels = <3>;
-
-@@ -288,6 +296,7 @@
- interrupts = <0 70 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_SCIF0>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -297,6 +306,7 @@
- interrupts = <0 71 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_SCIF1>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -306,6 +316,7 @@
- interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_SCIF2>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -315,6 +326,7 @@
- interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_SCIF3>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -324,6 +336,7 @@
- interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_SCIF4>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -333,6 +346,7 @@
- interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_SCIF5>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -341,6 +355,7 @@
- reg = <0xffe4e000 0x100>;
- interrupts = <0 61 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7778_CLK_MMC>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -349,6 +364,7 @@
- reg = <0xffe4c000 0x100>;
- interrupts = <0 87 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7778_CLK_SDHI0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -357,6 +373,7 @@
- reg = <0xffe4d000 0x100>;
- interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7778_CLK_SDHI1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -365,6 +382,7 @@
- reg = <0xffe4f000 0x100>;
- interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7778_CLK_SDHI2>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -373,6 +391,7 @@
- reg = <0xfffc7000 0x18>;
- interrupts = <0 63 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_HSPI>;
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -383,6 +402,7 @@
- reg = <0xfffc8000 0x18>;
- interrupts = <0 84 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_HSPI>;
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -393,6 +413,7 @@
- reg = <0xfffc6000 0x18>;
- interrupts = <0 85 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7778_CLK_HSPI>;
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -419,6 +440,7 @@
- clocks = <&extal_clk>;
- clock-output-names = "plla", "pllb", "b",
- "out", "p", "s", "s1";
-+ #power-domain-cells = <0>;
- };
-
- /* Audio clocks; frequencies are set by boards if applicable. */
---
-2.6.2
-
diff --git a/patches.renesas/0210-ARM-shmobile-r8a7779-dtsi-Add-CPG-MSTP-Clock-Domain.patch b/patches.renesas/0210-ARM-shmobile-r8a7779-dtsi-Add-CPG-MSTP-Clock-Domain.patch
deleted file mode 100644
index ddec0b556d1369..00000000000000
--- a/patches.renesas/0210-ARM-shmobile-r8a7779-dtsi-Add-CPG-MSTP-Clock-Domain.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From 84523f3bc1df9cc33bb1a0c33a73219cc85da9f4 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:09 +0200
-Subject: [PATCH 210/326] ARM: shmobile: r8a7779 dtsi: Add CPG/MSTP Clock
- Domain
-
-Add an appropriate "#power-domain-cells" property to the cpg_clocks
-device node, to create the CPG/MSTP Clock Domain.
-
-Add "power-domains" properties to all device nodes for devices that are
-part of the CPG/MSTP Clock Domain and can be power-managed through an
-MSTP clock. This applies to most on-SoC devices, which have a
-one-to-one mapping from SoC device to DT device node.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 33c3632a3f692d82ee0d080350bcd6d1c4cd151f)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7779.dtsi | 23 +++++++++++++++++++++++
- 1 file changed, 23 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
-index a2b5430d3257..6afa909865b5 100644
---- a/arch/arm/boot/dts/r8a7779.dtsi
-+++ b/arch/arm/boot/dts/r8a7779.dtsi
-@@ -173,6 +173,7 @@
- reg = <0xffc70000 0x1000>;
- interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_I2C0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -183,6 +184,7 @@
- reg = <0xffc71000 0x1000>;
- interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_I2C1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -193,6 +195,7 @@
- reg = <0xffc72000 0x1000>;
- interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_I2C2>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -203,6 +206,7 @@
- reg = <0xffc73000 0x1000>;
- interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_I2C3>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -212,6 +216,7 @@
- interrupts = <0 88 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_SCIF0>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -221,6 +226,7 @@
- interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_SCIF1>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -230,6 +236,7 @@
- interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_SCIF2>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -239,6 +246,7 @@
- interrupts = <0 91 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_SCIF3>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -248,6 +256,7 @@
- interrupts = <0 92 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_SCIF4>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -257,6 +266,7 @@
- interrupts = <0 93 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_SCIF5>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -278,6 +288,7 @@
- <0 34 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_TMU0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- #renesas,channels = <3>;
-
-@@ -292,6 +303,7 @@
- <0 38 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_TMU1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- #renesas,channels = <3>;
-
-@@ -306,6 +318,7 @@
- <0 42 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp0_clks R8A7779_CLK_TMU2>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- #renesas,channels = <3>;
-
-@@ -317,6 +330,7 @@
- reg = <0xfc600000 0x2000>;
- interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7779_CLK_SATA>;
-+ power-domains = <&cpg_clocks>;
- };
-
- sdhi0: sd@ffe4c000 {
-@@ -324,6 +338,7 @@
- reg = <0xffe4c000 0x100>;
- interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7779_CLK_SDHI0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -332,6 +347,7 @@
- reg = <0xffe4d000 0x100>;
- interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7779_CLK_SDHI1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -340,6 +356,7 @@
- reg = <0xffe4e000 0x100>;
- interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7779_CLK_SDHI2>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -348,6 +365,7 @@
- reg = <0xffe4f000 0x100>;
- interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7779_CLK_SDHI3>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -358,6 +376,7 @@
- #address-cells = <1>;
- #size-cells = <0>;
- clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -368,6 +387,7 @@
- #address-cells = <1>;
- #size-cells = <0>;
- clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -378,6 +398,7 @@
- #address-cells = <1>;
- #size-cells = <0>;
- clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -386,6 +407,7 @@
- reg = <0 0xfff80000 0 0x40000>;
- interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7779_CLK_DU>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
-
- ports {
-@@ -427,6 +449,7 @@
- #clock-cells = <1>;
- clock-output-names = "plla", "z", "zs", "s",
- "s1", "p", "b", "out";
-+ #power-domain-cells = <0>;
- };
-
- /* Fixed factor clocks */
---
-2.6.2
-
diff --git a/patches.renesas/0211-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain.patch b/patches.renesas/0211-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain.patch
deleted file mode 100644
index c17afcd4284a7c..00000000000000
--- a/patches.renesas/0211-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain.patch
+++ /dev/null
@@ -1,605 +0,0 @@
-From 76bf2c3947b1619e21d1eccde9884eda1f05eab7 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:10 +0200
-Subject: [PATCH 211/326] ARM: shmobile: r8a7790 dtsi: Add CPG/MSTP Clock
- Domain
-
-Add an appropriate "#power-domain-cells" property to the cpg_clocks
-device node, to create the CPG/MSTP Clock Domain.
-
-Add "power-domains" properties to all device nodes for devices that are
-part of the CPG/MSTP Clock Domain and can be power-managed through an
-MSTP clock. This applies to most on-SoC devices, which have a
-one-to-one mapping from SoC device to DT device node. Notable
-exceptions are the "display" and "sound" nodes, which represent multiple
-SoC devices, each having their own MSTP clocks.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 484adb005886b1db79050afc7074d2356618b0c2)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 86 +++++++++++++++++++++++++++++++++++++-----
- 1 file changed, 77 insertions(+), 9 deletions(-)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index 5b2952d5c700..a0b2a79cbfbd 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -134,6 +134,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7790_CLK_GPIO0>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio1: gpio@e6051000 {
-@@ -146,6 +147,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7790_CLK_GPIO1>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio2: gpio@e6052000 {
-@@ -158,6 +160,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7790_CLK_GPIO2>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio3: gpio@e6053000 {
-@@ -170,6 +173,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7790_CLK_GPIO3>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio4: gpio@e6054000 {
-@@ -182,6 +186,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7790_CLK_GPIO4>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio5: gpio@e6055000 {
-@@ -194,6 +199,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7790_CLK_GPIO5>;
-+ power-domains = <&cpg_clocks>;
- };
-
- thermal@e61f0000 {
-@@ -201,6 +207,7 @@
- reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
- interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp5_clks R8A7790_CLK_THERMAL>;
-+ power-domains = <&cpg_clocks>;
- };
-
- timer {
-@@ -218,6 +225,7 @@
- <0 143 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7790_CLK_CMT0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- renesas,channels-mask = <0x60>;
-
-@@ -237,6 +245,7 @@
- <0 127 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7790_CLK_CMT1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- renesas,channels-mask = <0xff>;
-
-@@ -253,6 +262,7 @@
- <0 2 IRQ_TYPE_LEVEL_HIGH>,
- <0 3 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R8A7790_CLK_IRQC>;
-+ power-domains = <&cpg_clocks>;
- };
-
- dmac0: dma-controller@e6700000 {
-@@ -281,6 +291,7 @@
- "ch12", "ch13", "ch14";
- clocks = <&mstp2_clks R8A7790_CLK_SYS_DMAC0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <15>;
- };
-@@ -311,6 +322,7 @@
- "ch12", "ch13", "ch14";
- clocks = <&mstp2_clks R8A7790_CLK_SYS_DMAC1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <15>;
- };
-@@ -339,6 +351,7 @@
- "ch12";
- clocks = <&mstp5_clks R8A7790_CLK_AUDIO_DMAC0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <13>;
- };
-@@ -367,6 +380,7 @@
- "ch12";
- clocks = <&mstp5_clks R8A7790_CLK_AUDIO_DMAC1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <13>;
- };
-@@ -378,6 +392,7 @@
- 0 109 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "ch0", "ch1";
- clocks = <&mstp3_clks R8A7790_CLK_USBDMAC0>;
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <2>;
- };
-@@ -389,6 +404,7 @@
- 0 110 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "ch0", "ch1";
- clocks = <&mstp3_clks R8A7790_CLK_USBDMAC1>;
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <2>;
- };
-@@ -400,6 +416,7 @@
- reg = <0 0xe6508000 0 0x40>;
- interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7790_CLK_I2C0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -410,6 +427,7 @@
- reg = <0 0xe6518000 0 0x40>;
- interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7790_CLK_I2C1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -420,6 +438,7 @@
- reg = <0 0xe6530000 0 0x40>;
- interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7790_CLK_I2C2>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -430,6 +449,7 @@
- reg = <0 0xe6540000 0 0x40>;
- interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7790_CLK_I2C3>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -442,6 +462,7 @@
- clocks = <&mstp3_clks R8A7790_CLK_IIC0>;
- dmas = <&dmac0 0x61>, <&dmac0 0x62>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -454,6 +475,7 @@
- clocks = <&mstp3_clks R8A7790_CLK_IIC1>;
- dmas = <&dmac0 0x65>, <&dmac0 0x66>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -466,6 +488,7 @@
- clocks = <&mstp3_clks R8A7790_CLK_IIC2>;
- dmas = <&dmac0 0x69>, <&dmac0 0x6a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -478,6 +501,7 @@
- clocks = <&mstp9_clks R8A7790_CLK_IICDVFS>;
- dmas = <&dmac0 0x77>, <&dmac0 0x78>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -488,6 +512,7 @@
- clocks = <&mstp3_clks R8A7790_CLK_MMCIF0>;
- dmas = <&dmac0 0xd1>, <&dmac0 0xd2>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- reg-io-width = <4>;
- status = "disabled";
- max-frequency = <97500000>;
-@@ -500,6 +525,7 @@
- clocks = <&mstp3_clks R8A7790_CLK_MMCIF1>;
- dmas = <&dmac0 0xe1>, <&dmac0 0xe2>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- reg-io-width = <4>;
- status = "disabled";
- max-frequency = <97500000>;
-@@ -517,6 +543,7 @@
- clocks = <&mstp3_clks R8A7790_CLK_SDHI0>;
- dmas = <&dmac1 0xcd>, <&dmac1 0xce>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -527,6 +554,7 @@
- clocks = <&mstp3_clks R8A7790_CLK_SDHI1>;
- dmas = <&dmac1 0xc9>, <&dmac1 0xca>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -537,6 +565,7 @@
- clocks = <&mstp3_clks R8A7790_CLK_SDHI2>;
- dmas = <&dmac1 0xc1>, <&dmac1 0xc2>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -547,6 +576,7 @@
- clocks = <&mstp3_clks R8A7790_CLK_SDHI3>;
- dmas = <&dmac1 0xd3>, <&dmac1 0xd4>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -558,6 +588,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x21>, <&dmac0 0x22>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -569,6 +600,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x25>, <&dmac0 0x26>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -580,6 +612,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x27>, <&dmac0 0x28>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -591,6 +624,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x3d>, <&dmac0 0x3e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -602,6 +636,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x19>, <&dmac0 0x1a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -613,6 +648,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x1d>, <&dmac0 0x1e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -624,6 +660,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x29>, <&dmac0 0x2a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -635,6 +672,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x2d>, <&dmac0 0x2e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -646,6 +684,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x39>, <&dmac0 0x3a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -657,6 +696,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x4d>, <&dmac0 0x4e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -665,6 +705,7 @@
- reg = <0 0xee700000 0 0x400>;
- interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp8_clks R8A7790_CLK_ETHER>;
-+ power-domains = <&cpg_clocks>;
- phy-mode = "rmii";
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -676,6 +717,7 @@
- reg = <0 0xe6800000 0 0x800>, <0 0xee0e8000 0 0x4000>;
- interrupts = <0 163 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp8_clks R8A7790_CLK_ETHERAVB>;
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -686,6 +728,7 @@
- reg = <0 0xee300000 0 0x2000>;
- interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp8_clks R8A7790_CLK_SATA0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -694,6 +737,7 @@
- reg = <0 0xee500000 0 0x2000>;
- interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp8_clks R8A7790_CLK_SATA1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -702,12 +746,13 @@
- reg = <0 0xe6590000 0 0x100>;
- interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7790_CLK_HSUSB>;
-- renesas,buswait = <4>;
-- phys = <&usb0 1>;
-- phy-names = "usb";
- dmas = <&usb_dmac0 0>, <&usb_dmac0 1>,
- <&usb_dmac1 0>, <&usb_dmac1 1>;
- dma-names = "ch0", "ch1", "ch2", "ch3";
-+ power-domains = <&cpg_clocks>;
-+ renesas,buswait = <4>;
-+ phys = <&usb0 1>;
-+ phy-names = "usb";
- status = "disabled";
- };
-
-@@ -718,6 +763,7 @@
- #size-cells = <0>;
- clocks = <&mstp7_clks R8A7790_CLK_HSUSB>;
- clock-names = "usbhs";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
-
- usb0: usb-channel@0 {
-@@ -732,33 +778,37 @@
-
- vin0: video@e6ef0000 {
- compatible = "renesas,vin-r8a7790";
-- clocks = <&mstp8_clks R8A7790_CLK_VIN0>;
- reg = <0 0xe6ef0000 0 0x1000>;
- interrupts = <0 188 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp8_clks R8A7790_CLK_VIN0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
- vin1: video@e6ef1000 {
- compatible = "renesas,vin-r8a7790";
-- clocks = <&mstp8_clks R8A7790_CLK_VIN1>;
- reg = <0 0xe6ef1000 0 0x1000>;
- interrupts = <0 189 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp8_clks R8A7790_CLK_VIN1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
- vin2: video@e6ef2000 {
- compatible = "renesas,vin-r8a7790";
-- clocks = <&mstp8_clks R8A7790_CLK_VIN2>;
- reg = <0 0xe6ef2000 0 0x1000>;
- interrupts = <0 190 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp8_clks R8A7790_CLK_VIN2>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
- vin3: video@e6ef3000 {
- compatible = "renesas,vin-r8a7790";
-- clocks = <&mstp8_clks R8A7790_CLK_VIN3>;
- reg = <0 0xe6ef3000 0 0x1000>;
- interrupts = <0 191 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp8_clks R8A7790_CLK_VIN3>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -767,6 +817,7 @@
- reg = <0 0xfe920000 0 0x8000>;
- interrupts = <0 266 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7790_CLK_VSP1_R>;
-+ power-domains = <&cpg_clocks>;
-
- renesas,has-sru;
- renesas,#rpf = <5>;
-@@ -779,6 +830,7 @@
- reg = <0 0xfe928000 0 0x8000>;
- interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7790_CLK_VSP1_S>;
-+ power-domains = <&cpg_clocks>;
-
- renesas,has-lut;
- renesas,has-sru;
-@@ -792,6 +844,7 @@
- reg = <0 0xfe930000 0 0x8000>;
- interrupts = <0 246 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7790_CLK_VSP1_DU0>;
-+ power-domains = <&cpg_clocks>;
-
- renesas,has-lif;
- renesas,has-lut;
-@@ -805,6 +858,7 @@
- reg = <0 0xfe938000 0 0x8000>;
- interrupts = <0 247 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7790_CLK_VSP1_DU1>;
-+ power-domains = <&cpg_clocks>;
-
- renesas,has-lif;
- renesas,has-lut;
-@@ -859,6 +913,7 @@
- clocks = <&mstp9_clks R8A7790_CLK_RCAN0>,
- <&cpg_clocks R8A7790_CLK_RCAN>, <&can_clk>;
- clock-names = "clkp1", "clkp2", "can_clk";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -869,6 +924,7 @@
- clocks = <&mstp9_clks R8A7790_CLK_RCAN1>,
- <&cpg_clocks R8A7790_CLK_RCAN>, <&can_clk>;
- clock-names = "clkp1", "clkp2", "can_clk";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -877,6 +933,7 @@
- reg = <0 0xfe980000 0 0x10300>;
- interrupts = <0 272 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7790_CLK_JPU>;
-+ power-domains = <&cpg_clocks>;
- };
-
- clocks {
-@@ -953,6 +1010,7 @@
- clock-output-names = "main", "pll0", "pll1", "pll3",
- "lb", "qspi", "sdh", "sd0", "sd1",
- "z", "rcan", "adsp";
-+ #power-domain-cells = <0>;
- };
-
- /* Variable factor clocks */
-@@ -1343,6 +1401,7 @@
- clocks = <&mstp9_clks R8A7790_CLK_QSPI_MOD>;
- dmas = <&dmac0 0x17>, <&dmac0 0x18>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- num-cs = <1>;
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -1356,6 +1415,7 @@
- clocks = <&mstp0_clks R8A7790_CLK_MSIOF0>;
- dmas = <&dmac0 0x51>, <&dmac0 0x52>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -1368,6 +1428,7 @@
- clocks = <&mstp2_clks R8A7790_CLK_MSIOF1>;
- dmas = <&dmac0 0x55>, <&dmac0 0x56>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -1380,6 +1441,7 @@
- clocks = <&mstp2_clks R8A7790_CLK_MSIOF2>;
- dmas = <&dmac0 0x41>, <&dmac0 0x42>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -1392,6 +1454,7 @@
- clocks = <&mstp2_clks R8A7790_CLK_MSIOF3>;
- dmas = <&dmac0 0x45>, <&dmac0 0x46>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -1402,6 +1465,7 @@
- reg = <0 0xee000000 0 0xc00>;
- interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7790_CLK_SSUSB>;
-+ power-domains = <&cpg_clocks>;
- phys = <&usb2 1>;
- phy-names = "usb";
- status = "disabled";
-@@ -1410,10 +1474,11 @@
- 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>;
-+ clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
-
- bus-range = <0 0>;
-@@ -1444,10 +1509,11 @@
- 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>;
-+ clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
-
- bus-range = <1 1>;
-@@ -1465,6 +1531,7 @@
- compatible = "renesas,pci-r8a7790";
- device_type = "pci";
- clocks = <&mstp7_clks R8A7790_CLK_EHCI>;
-+ power-domains = <&cpg_clocks>;
- reg = <0 0xee0d0000 0 0xc00>,
- <0 0xee0c0000 0 0x1100>;
- interrupts = <0 113 IRQ_TYPE_LEVEL_HIGH>;
-@@ -1517,6 +1584,7 @@
- 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";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0212-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain.patch b/patches.renesas/0212-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain.patch
deleted file mode 100644
index 3276d8e0f5254d..00000000000000
--- a/patches.renesas/0212-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain.patch
+++ /dev/null
@@ -1,635 +0,0 @@
-From 60334da9cc98f3baa96de8bef4a4b152d337d302 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:11 +0200
-Subject: [PATCH 212/326] ARM: shmobile: r8a7791 dtsi: Add CPG/MSTP Clock
- Domain
-
-Add an appropriate "#power-domain-cells" property to the cpg_clocks
-device node, to create the CPG/MSTP Clock Domain.
-
-Add "power-domains" properties to all device nodes for devices that are
-part of the CPG/MSTP Clock Domain and can be power-managed through an
-MSTP clock. This applies to most on-SoC devices, which have a
-one-to-one mapping from SoC device to DT device node. Notable
-exceptions are the "display" and "sound" nodes, which represent multiple
-SoC devices, each having their own MSTP clocks.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 797a0626e08ca4af539cd4888ebbc8c5aacc993d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 88 ++++++++++++++++++++++++++++++++++++++----
- 1 file changed, 80 insertions(+), 8 deletions(-)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index 1cb6c2d07933..831525dd39a6 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -91,6 +91,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7791_CLK_GPIO0>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio1: gpio@e6051000 {
-@@ -103,6 +104,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7791_CLK_GPIO1>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio2: gpio@e6052000 {
-@@ -115,6 +117,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7791_CLK_GPIO2>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio3: gpio@e6053000 {
-@@ -127,6 +130,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7791_CLK_GPIO3>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio4: gpio@e6054000 {
-@@ -139,6 +143,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7791_CLK_GPIO4>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio5: gpio@e6055000 {
-@@ -151,6 +156,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7791_CLK_GPIO5>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio6: gpio@e6055400 {
-@@ -163,6 +169,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7791_CLK_GPIO6>;
-+ power-domains = <&cpg_clocks>;
- };
-
- gpio7: gpio@e6055800 {
-@@ -175,6 +182,7 @@
- #interrupt-cells = <2>;
- interrupt-controller;
- clocks = <&mstp9_clks R8A7791_CLK_GPIO7>;
-+ power-domains = <&cpg_clocks>;
- };
-
- thermal@e61f0000 {
-@@ -182,6 +190,7 @@
- reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
- interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp5_clks R8A7791_CLK_THERMAL>;
-+ power-domains = <&cpg_clocks>;
- };
-
- timer {
-@@ -199,6 +208,7 @@
- <0 143 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7791_CLK_CMT0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- renesas,channels-mask = <0x60>;
-
-@@ -218,6 +228,7 @@
- <0 127 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7791_CLK_CMT1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- renesas,channels-mask = <0xff>;
-
-@@ -240,6 +251,7 @@
- <0 16 IRQ_TYPE_LEVEL_HIGH>,
- <0 17 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R8A7791_CLK_IRQC>;
-+ power-domains = <&cpg_clocks>;
- };
-
- dmac0: dma-controller@e6700000 {
-@@ -268,6 +280,7 @@
- "ch12", "ch13", "ch14";
- clocks = <&mstp2_clks R8A7791_CLK_SYS_DMAC0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <15>;
- };
-@@ -298,6 +311,7 @@
- "ch12", "ch13", "ch14";
- clocks = <&mstp2_clks R8A7791_CLK_SYS_DMAC1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <15>;
- };
-@@ -326,6 +340,7 @@
- "ch12";
- clocks = <&mstp5_clks R8A7791_CLK_AUDIO_DMAC0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <13>;
- };
-@@ -354,6 +369,7 @@
- "ch12";
- clocks = <&mstp5_clks R8A7791_CLK_AUDIO_DMAC1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <13>;
- };
-@@ -365,6 +381,7 @@
- 0 109 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "ch0", "ch1";
- clocks = <&mstp3_clks R8A7791_CLK_USBDMAC0>;
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <2>;
- };
-@@ -376,6 +393,7 @@
- 0 110 IRQ_TYPE_LEVEL_HIGH>;
- interrupt-names = "ch0", "ch1";
- clocks = <&mstp3_clks R8A7791_CLK_USBDMAC1>;
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <2>;
- };
-@@ -388,6 +406,7 @@
- reg = <0 0xe6508000 0 0x40>;
- interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7791_CLK_I2C0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -398,6 +417,7 @@
- reg = <0 0xe6518000 0 0x40>;
- interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7791_CLK_I2C1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -408,6 +428,7 @@
- reg = <0 0xe6530000 0 0x40>;
- interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7791_CLK_I2C2>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -418,6 +439,7 @@
- reg = <0 0xe6540000 0 0x40>;
- interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7791_CLK_I2C3>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -428,6 +450,7 @@
- reg = <0 0xe6520000 0 0x40>;
- interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7791_CLK_I2C4>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -439,6 +462,7 @@
- reg = <0 0xe6528000 0 0x40>;
- interrupts = <0 20 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp9_clks R8A7791_CLK_I2C5>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -452,6 +476,7 @@
- clocks = <&mstp9_clks R8A7791_CLK_IICDVFS>;
- dmas = <&dmac0 0x77>, <&dmac0 0x78>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -464,6 +489,7 @@
- clocks = <&mstp3_clks R8A7791_CLK_IIC0>;
- dmas = <&dmac0 0x61>, <&dmac0 0x62>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -476,6 +502,7 @@
- clocks = <&mstp3_clks R8A7791_CLK_IIC1>;
- dmas = <&dmac0 0x65>, <&dmac0 0x66>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -492,6 +519,7 @@
- clocks = <&mstp3_clks R8A7791_CLK_MMCIF0>;
- dmas = <&dmac0 0xd1>, <&dmac0 0xd2>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- reg-io-width = <4>;
- status = "disabled";
- max-frequency = <97500000>;
-@@ -504,6 +532,7 @@
- clocks = <&mstp3_clks R8A7791_CLK_SDHI0>;
- dmas = <&dmac1 0xcd>, <&dmac1 0xce>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -514,6 +543,7 @@
- clocks = <&mstp3_clks R8A7791_CLK_SDHI1>;
- dmas = <&dmac1 0xc1>, <&dmac1 0xc2>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -524,6 +554,7 @@
- clocks = <&mstp3_clks R8A7791_CLK_SDHI2>;
- dmas = <&dmac1 0xd3>, <&dmac1 0xd4>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -535,6 +566,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x21>, <&dmac0 0x22>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -546,6 +578,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x25>, <&dmac0 0x26>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -557,6 +590,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x27>, <&dmac0 0x28>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -568,6 +602,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x1b>, <&dmac0 0x1c>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -579,6 +614,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x1f>, <&dmac0 0x20>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -590,6 +626,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x23>, <&dmac0 0x24>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -601,6 +638,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x3d>, <&dmac0 0x3e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -612,6 +650,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x19>, <&dmac0 0x1a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -623,6 +662,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x1d>, <&dmac0 0x1e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -634,6 +674,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x29>, <&dmac0 0x2a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -645,6 +686,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x2d>, <&dmac0 0x2e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -656,6 +698,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x2b>, <&dmac0 0x2c>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -667,6 +710,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x2f>, <&dmac0 0x30>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -678,6 +722,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0xfb>, <&dmac0 0xfc>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -689,6 +734,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0xfd>, <&dmac0 0xfe>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -700,6 +746,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x39>, <&dmac0 0x3a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -711,6 +758,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x4d>, <&dmac0 0x4e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -722,6 +770,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x3b>, <&dmac0 0x3c>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -730,6 +779,7 @@
- reg = <0 0xee700000 0 0x400>;
- interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp8_clks R8A7791_CLK_ETHER>;
-+ power-domains = <&cpg_clocks>;
- phy-mode = "rmii";
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -741,6 +791,7 @@
- reg = <0 0xee300000 0 0x2000>;
- interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp8_clks R8A7791_CLK_SATA0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -749,6 +800,7 @@
- reg = <0 0xee500000 0 0x2000>;
- interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp8_clks R8A7791_CLK_SATA1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -757,12 +809,13 @@
- reg = <0 0xe6590000 0 0x100>;
- interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7791_CLK_HSUSB>;
-- renesas,buswait = <4>;
-- phys = <&usb0 1>;
-- phy-names = "usb";
- dmas = <&usb_dmac0 0>, <&usb_dmac0 1>,
- <&usb_dmac1 0>, <&usb_dmac1 1>;
- dma-names = "ch0", "ch1", "ch2", "ch3";
-+ power-domains = <&cpg_clocks>;
-+ renesas,buswait = <4>;
-+ phys = <&usb0 1>;
-+ phy-names = "usb";
- status = "disabled";
- };
-
-@@ -773,6 +826,7 @@
- #size-cells = <0>;
- clocks = <&mstp7_clks R8A7791_CLK_HSUSB>;
- clock-names = "usbhs";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
-
- usb0: usb-channel@0 {
-@@ -787,25 +841,28 @@
-
- vin0: video@e6ef0000 {
- compatible = "renesas,vin-r8a7791";
-- clocks = <&mstp8_clks R8A7791_CLK_VIN0>;
- reg = <0 0xe6ef0000 0 0x1000>;
- interrupts = <0 188 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp8_clks R8A7791_CLK_VIN0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
- vin1: video@e6ef1000 {
- compatible = "renesas,vin-r8a7791";
-- clocks = <&mstp8_clks R8A7791_CLK_VIN1>;
- reg = <0 0xe6ef1000 0 0x1000>;
- interrupts = <0 189 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp8_clks R8A7791_CLK_VIN1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
- vin2: video@e6ef2000 {
- compatible = "renesas,vin-r8a7791";
-- clocks = <&mstp8_clks R8A7791_CLK_VIN2>;
- reg = <0 0xe6ef2000 0 0x1000>;
- interrupts = <0 190 IRQ_TYPE_LEVEL_HIGH>;
-+ clocks = <&mstp8_clks R8A7791_CLK_VIN2>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -814,6 +871,7 @@
- reg = <0 0xfe928000 0 0x8000>;
- interrupts = <0 267 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7791_CLK_VSP1_S>;
-+ power-domains = <&cpg_clocks>;
-
- renesas,has-lut;
- renesas,has-sru;
-@@ -827,6 +885,7 @@
- reg = <0 0xfe930000 0 0x8000>;
- interrupts = <0 246 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7791_CLK_VSP1_DU0>;
-+ power-domains = <&cpg_clocks>;
-
- renesas,has-lif;
- renesas,has-lut;
-@@ -840,6 +899,7 @@
- reg = <0 0xfe938000 0 0x8000>;
- interrupts = <0 247 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7791_CLK_VSP1_DU1>;
-+ power-domains = <&cpg_clocks>;
-
- renesas,has-lif;
- renesas,has-lut;
-@@ -885,6 +945,7 @@
- clocks = <&mstp9_clks R8A7791_CLK_RCAN0>,
- <&cpg_clocks R8A7791_CLK_RCAN>, <&can_clk>;
- clock-names = "clkp1", "clkp2", "can_clk";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -895,6 +956,7 @@
- clocks = <&mstp9_clks R8A7791_CLK_RCAN1>,
- <&cpg_clocks R8A7791_CLK_RCAN>, <&can_clk>;
- clock-names = "clkp1", "clkp2", "can_clk";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -903,6 +965,7 @@
- reg = <0 0xfe980000 0 0x10300>;
- interrupts = <0 272 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7791_CLK_JPU>;
-+ power-domains = <&cpg_clocks>;
- };
-
- clocks {
-@@ -979,6 +1042,7 @@
- clock-output-names = "main", "pll0", "pll1", "pll3",
- "lb", "qspi", "sdh", "sd0", "z",
- "rcan", "adsp";
-+ #power-domain-cells = <0>;
- };
-
- /* Variable factor clocks */
-@@ -1361,6 +1425,7 @@
- clocks = <&mstp9_clks R8A7791_CLK_QSPI_MOD>;
- dmas = <&dmac0 0x17>, <&dmac0 0x18>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- num-cs = <1>;
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -1374,6 +1439,7 @@
- clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>;
- dmas = <&dmac0 0x51>, <&dmac0 0x52>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -1386,6 +1452,7 @@
- clocks = <&mstp2_clks R8A7791_CLK_MSIOF1>;
- dmas = <&dmac0 0x55>, <&dmac0 0x56>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -1398,6 +1465,7 @@
- clocks = <&mstp2_clks R8A7791_CLK_MSIOF2>;
- dmas = <&dmac0 0x41>, <&dmac0 0x42>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- #address-cells = <1>;
- #size-cells = <0>;
- status = "disabled";
-@@ -1408,6 +1476,7 @@
- reg = <0 0xee000000 0 0xc00>;
- interrupts = <0 101 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7791_CLK_SSUSB>;
-+ power-domains = <&cpg_clocks>;
- phys = <&usb2 1>;
- phy-names = "usb";
- status = "disabled";
-@@ -1416,10 +1485,11 @@
- 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>;
-+ clocks = <&mstp7_clks R8A7791_CLK_EHCI>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
-
- bus-range = <0 0>;
-@@ -1450,10 +1520,11 @@
- 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>;
-+ clocks = <&mstp7_clks R8A7791_CLK_EHCI>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
-
- bus-range = <1 1>;
-@@ -1503,6 +1574,7 @@
- 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";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0213-ARM-shmobile-r8a7793-dtsi-Add-CPG-MSTP-Clock-Domain.patch b/patches.renesas/0213-ARM-shmobile-r8a7793-dtsi-Add-CPG-MSTP-Clock-Domain.patch
deleted file mode 100644
index 4b2699dd840f29..00000000000000
--- a/patches.renesas/0213-ARM-shmobile-r8a7793-dtsi-Add-CPG-MSTP-Clock-Domain.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From 12de21984a47aadcd7ed83d59ebe2d097ee2a6e1 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:12 +0200
-Subject: [PATCH 213/326] ARM: shmobile: r8a7793 dtsi: Add CPG/MSTP Clock
- Domain
-
-Add an appropriate "#power-domain-cells" property to the cpg_clocks
-device node, to create the CPG/MSTP Clock Domain.
-
-Add "power-domains" properties to all device nodes for devices that are
-part of the CPG/MSTP Clock Domain and can be power-managed through an
-MSTP clock. This applies to most on-SoC devices, which have a
-one-to-one mapping from SoC device to DT device node.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 4b31bad51f83bcce039e43f1659ffcb4bff454dc)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7793.dtsi | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
-index 3355c487d108..c4654047e684 100644
---- a/arch/arm/boot/dts/r8a7793.dtsi
-+++ b/arch/arm/boot/dts/r8a7793.dtsi
-@@ -68,6 +68,7 @@
- <0 143 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7793_CLK_CMT0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- renesas,channels-mask = <0x60>;
-
-@@ -87,6 +88,7 @@
- <0 127 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7793_CLK_CMT1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- renesas,channels-mask = <0xff>;
-
-@@ -109,6 +111,7 @@
- <0 16 IRQ_TYPE_LEVEL_HIGH>,
- <0 17 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R8A7793_CLK_IRQC>;
-+ power-domains = <&cpg_clocks>;
- };
-
- scif0: serial@e6e60000 {
-@@ -117,6 +120,7 @@
- interrupts = <0 152 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7793_CLK_SCIF0>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -126,6 +130,7 @@
- interrupts = <0 153 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp7_clks R8A7793_CLK_SCIF1>;
- clock-names = "sci_ick";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -134,6 +139,7 @@
- reg = <0 0xee700000 0 0x400>;
- interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp8_clks R8A7793_CLK_ETHER>;
-+ power-domains = <&cpg_clocks>;
- phy-mode = "rmii";
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -164,6 +170,7 @@
- clock-output-names = "main", "pll0", "pll1", "pll3",
- "lb", "qspi", "sdh", "sd0", "z",
- "rcan", "adsp";
-+ #power-domain-cells = <0>;
- };
-
- /* Variable factor clocks */
---
-2.6.2
-
diff --git a/patches.renesas/0214-ARM-shmobile-r8a7794-dtsi-Add-CPG-MSTP-Clock-Domain.patch b/patches.renesas/0214-ARM-shmobile-r8a7794-dtsi-Add-CPG-MSTP-Clock-Domain.patch
deleted file mode 100644
index 7c990d67a36d63..00000000000000
--- a/patches.renesas/0214-ARM-shmobile-r8a7794-dtsi-Add-CPG-MSTP-Clock-Domain.patch
+++ /dev/null
@@ -1,262 +0,0 @@
-From 8fd2495a33b375a03c172a627d06bfa4119f761b Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:13 +0200
-Subject: [PATCH 214/326] ARM: shmobile: r8a7794 dtsi: Add CPG/MSTP Clock
- Domain
-
-Add an appropriate "#power-domain-cells" property to the cpg_clocks
-device node, to create the CPG/MSTP Clock Domain.
-
-Add "power-domains" properties to all device nodes for devices that are
-part of the CPG/MSTP Clock Domain and can be power-managed through an
-MSTP clock. This applies to most on-SoC devices, which have a
-one-to-one mapping from SoC device to DT device node.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 60c0745a80be075bbd4e0925e4b740b3e588a445)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7794.dtsi | 29 +++++++++++++++++++++++++++++
- 1 file changed, 29 insertions(+)
-
-diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
-index 43acf185ecc4..97c8e9ace5eb 100644
---- a/arch/arm/boot/dts/r8a7794.dtsi
-+++ b/arch/arm/boot/dts/r8a7794.dtsi
-@@ -57,6 +57,7 @@
- <0 143 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp1_clks R8A7794_CLK_CMT0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- renesas,channels-mask = <0x60>;
-
-@@ -76,6 +77,7 @@
- <0 127 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7794_CLK_CMT1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
-
- renesas,channels-mask = <0xff>;
-
-@@ -106,6 +108,7 @@
- <0 16 IRQ_TYPE_LEVEL_HIGH>,
- <0 17 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp4_clks R8A7794_CLK_IRQC>;
-+ power-domains = <&cpg_clocks>;
- };
-
- pfc: pin-controller@e6060000 {
-@@ -140,6 +143,7 @@
- "ch12", "ch13", "ch14";
- clocks = <&mstp2_clks R8A7794_CLK_SYS_DMAC0>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <15>;
- };
-@@ -170,6 +174,7 @@
- "ch12", "ch13", "ch14";
- clocks = <&mstp2_clks R8A7794_CLK_SYS_DMAC1>;
- clock-names = "fck";
-+ power-domains = <&cpg_clocks>;
- #dma-cells = <1>;
- dma-channels = <15>;
- };
-@@ -182,6 +187,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x21>, <&dmac0 0x22>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -193,6 +199,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x25>, <&dmac0 0x26>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -204,6 +211,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x27>, <&dmac0 0x28>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -215,6 +223,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x1b>, <&dmac0 0x1c>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -226,6 +235,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x1f>, <&dmac0 0x20>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -237,6 +247,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x23>, <&dmac0 0x24>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -248,6 +259,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x3d>, <&dmac0 0x3e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -259,6 +271,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x19>, <&dmac0 0x1a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -270,6 +283,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x1d>, <&dmac0 0x1e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -281,6 +295,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x29>, <&dmac0 0x2a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -292,6 +307,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x2d>, <&dmac0 0x2e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -303,6 +319,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x2b>, <&dmac0 0x2c>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -314,6 +331,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x2f>, <&dmac0 0x30>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -325,6 +343,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0xfb>, <&dmac0 0xfc>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -336,6 +355,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0xfd>, <&dmac0 0xfe>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -347,6 +367,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x39>, <&dmac0 0x3a>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -358,6 +379,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x4d>, <&dmac0 0x4e>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -369,6 +391,7 @@
- clock-names = "sci_ick";
- dmas = <&dmac0 0x3b>, <&dmac0 0x3c>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -377,6 +400,7 @@
- reg = <0 0xee700000 0 0x400>;
- interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp8_clks R8A7794_CLK_ETHER>;
-+ power-domains = <&cpg_clocks>;
- phy-mode = "rmii";
- #address-cells = <1>;
- #size-cells = <0>;
-@@ -390,6 +414,7 @@
- clocks = <&mstp3_clks R8A7794_CLK_MMCIF0>;
- dmas = <&dmac0 0xd1>, <&dmac0 0xd2>;
- dma-names = "tx", "rx";
-+ power-domains = <&cpg_clocks>;
- reg-io-width = <4>;
- status = "disabled";
- };
-@@ -399,6 +424,7 @@
- reg = <0 0xee100000 0 0x200>;
- interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7794_CLK_SDHI0>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -407,6 +433,7 @@
- reg = <0 0xee140000 0 0x100>;
- interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7794_CLK_SDHI1>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -415,6 +442,7 @@
- reg = <0 0xee160000 0 0x100>;
- interrupts = <0 168 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&mstp3_clks R8A7794_CLK_SDHI2>;
-+ power-domains = <&cpg_clocks>;
- status = "disabled";
- };
-
-@@ -441,6 +469,7 @@
- #clock-cells = <1>;
- clock-output-names = "main", "pll0", "pll1", "pll3",
- "lb", "qspi", "sdh", "sd0", "z";
-+ #power-domain-cells = <0>;
- };
- /* Variable factor clocks */
- sd2_clk: sd2_clk@e6150078 {
---
-2.6.2
-
diff --git a/patches.renesas/0215-pinctrl-simplify-of_pinctrl_get.patch b/patches.renesas/0215-pinctrl-simplify-of_pinctrl_get.patch
deleted file mode 100644
index ae2d592a2a64d2..00000000000000
--- a/patches.renesas/0215-pinctrl-simplify-of_pinctrl_get.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From daa8152cf6936a0fad6fb2ed78bd59aa3c063ebe Mon Sep 17 00:00:00 2001
-From: Masahiro Yamada <yamada.masahiro@socionext.com>
-Date: Thu, 18 Jun 2015 14:42:45 +0900
-Subject: [PATCH 215/326] pinctrl: simplify of_pinctrl_get()
-
-This commit does not change the logic at all.
-
-Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit fb00de771b0c35fc42212272596ddb07bf120b21)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/devicetree.c | 8 +-------
- 1 file changed, 1 insertion(+), 7 deletions(-)
-
-diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
-index 0bbf7d71b281..fe04e748dfe4 100644
---- a/drivers/pinctrl/devicetree.c
-+++ b/drivers/pinctrl/devicetree.c
-@@ -97,13 +97,7 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename,
-
- struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
- {
-- struct pinctrl_dev *pctldev;
--
-- pctldev = get_pinctrl_dev_from_of_node(np);
-- if (!pctldev)
-- return NULL;
--
-- return pctldev;
-+ return get_pinctrl_dev_from_of_node(np);
- }
-
- static int dt_to_map_one_config(struct pinctrl *p, const char *statename,
---
-2.6.2
-
diff --git a/patches.renesas/0216-pinctrl-pinconf-Allow-groups-to-be-configured-via-de.patch b/patches.renesas/0216-pinctrl-pinconf-Allow-groups-to-be-configured-via-de.patch
deleted file mode 100644
index fec5c1f6bea75d..00000000000000
--- a/patches.renesas/0216-pinctrl-pinconf-Allow-groups-to-be-configured-via-de.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From 7187a35b9cfb037af585b064ec5c733189d86b68 Mon Sep 17 00:00:00 2001
-From: Jon Hunter <jonathanh@nvidia.com>
-Date: Tue, 14 Jul 2015 11:17:58 +0100
-Subject: [PATCH 216/326] pinctrl: pinconf: Allow groups to be configured via
- debugfs
-
-The function pinconf_dbg_config_write() currently only supports configuring
-a pin configuration mapping via the debugfs. Allow group mappings to also
-be configured via the debugfs.
-
-Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 75629981069cf194336426bbbfb03f9c93d7ad67)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/pinconf.c | 20 ++++++++++++++------
- 1 file changed, 14 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
-index 1fc09dc20199..4744d6363dfb 100644
---- a/drivers/pinctrl/pinconf.c
-+++ b/drivers/pinctrl/pinconf.c
-@@ -470,10 +470,12 @@ exit:
- * pinconf_dbg_config_write() - modify the pinctrl config in the pinctrl
- * map, of a dev/pin/state entry based on user entries to pinconf-config
- * @user_buf: contains the modification request with expected format:
-- * modify config_pin <devicename> <state> <pinname> <newvalue>
-+ * modify <config> <devicename> <state> <name> <newvalue>
- * modify is literal string, alternatives like add/delete not supported yet
-- * config_pin is literal, alternatives like config_mux not supported yet
-- * <devicename> <state> <pinname> are values that should match the pinctrl-maps
-+ * <config> is the configuration to be changed. Supported configs are
-+ * "config_pin" or "config_group", alternatives like config_mux are not
-+ * supported yet.
-+ * <devicename> <state> <name> are values that should match the pinctrl-maps
- * <newvalue> reflects the new config and is driver dependant
- */
- static ssize_t pinconf_dbg_config_write(struct file *file,
-@@ -511,13 +513,19 @@ static ssize_t pinconf_dbg_config_write(struct file *file,
- if (strcmp(token, "modify"))
- return -EINVAL;
-
-- /* Get arg type: "config_pin" type supported so far */
-+ /*
-+ * Get arg type: "config_pin" and "config_group"
-+ * types are supported so far
-+ */
- token = strsep(&b, " ");
- if (!token)
- return -EINVAL;
-- if (strcmp(token, "config_pin"))
-+ if (!strcmp(token, "config_pin"))
-+ dbg->map_type = PIN_MAP_TYPE_CONFIGS_PIN;
-+ else if (!strcmp(token, "config_group"))
-+ dbg->map_type = PIN_MAP_TYPE_CONFIGS_GROUP;
-+ else
- return -EINVAL;
-- dbg->map_type = PIN_MAP_TYPE_CONFIGS_PIN;
-
- /* get arg 'device_name' */
- token = strsep(&b, " ");
---
-2.6.2
-
diff --git a/patches.renesas/0217-pinctrl-pinconf-Fix-display-of-configs.patch b/patches.renesas/0217-pinctrl-pinconf-Fix-display-of-configs.patch
deleted file mode 100644
index 16c88771c141a0..00000000000000
--- a/patches.renesas/0217-pinctrl-pinconf-Fix-display-of-configs.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From 95b6a0e83bc5f021b0a5548d9af043dd140e7c34 Mon Sep 17 00:00:00 2001
-From: Jon Hunter <jonathanh@nvidia.com>
-Date: Tue, 14 Jul 2015 11:17:59 +0100
-Subject: [PATCH 217/326] pinctrl: pinconf: Fix display of configs
-
-The function pinconf_dbg_config_print() only prints the configuration of
-the 1st pin config in an array of pin configurations. Fix this so that
-all pin configurations in the array are displayed.
-
-There are a few places in the code where the pin configs are displayed
-and so add a helper function to display the pin configs to simplify the
-code.
-
-Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit d96310aeddc692cf1f06861cf722c4843e0a3f28)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/pinconf.c | 64 ++++++++++++++++++++---------------------------
- 1 file changed, 27 insertions(+), 37 deletions(-)
-
-diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
-index 4744d6363dfb..cbf26a6992a0 100644
---- a/drivers/pinctrl/pinconf.c
-+++ b/drivers/pinctrl/pinconf.c
-@@ -202,18 +202,34 @@ int pinconf_apply_setting(struct pinctrl_setting const *setting)
-
- #ifdef CONFIG_DEBUG_FS
-
--void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map)
-+void pinconf_show_config(struct seq_file *s, struct pinctrl_dev *pctldev,
-+ unsigned long *configs, unsigned num_configs)
- {
-- struct pinctrl_dev *pctldev;
- const struct pinconf_ops *confops;
- int i;
-
-- pctldev = get_pinctrl_dev_from_devname(map->ctrl_dev_name);
- if (pctldev)
- confops = pctldev->desc->confops;
- else
- confops = NULL;
-
-+ for (i = 0; i < num_configs; i++) {
-+ seq_puts(s, "config ");
-+ if (confops && confops->pin_config_config_dbg_show)
-+ confops->pin_config_config_dbg_show(pctldev, s,
-+ configs[i]);
-+ else
-+ seq_printf(s, "%08lx", configs[i]);
-+ seq_puts(s, "\n");
-+ }
-+}
-+
-+void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map)
-+{
-+ struct pinctrl_dev *pctldev;
-+
-+ pctldev = get_pinctrl_dev_from_devname(map->ctrl_dev_name);
-+
- switch (map->type) {
- case PIN_MAP_TYPE_CONFIGS_PIN:
- seq_printf(s, "pin ");
-@@ -227,15 +243,8 @@ void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map)
-
- seq_printf(s, "%s\n", map->data.configs.group_or_pin);
-
-- for (i = 0; i < map->data.configs.num_configs; i++) {
-- seq_printf(s, "config ");
-- if (confops && confops->pin_config_config_dbg_show)
-- confops->pin_config_config_dbg_show(pctldev, s,
-- map->data.configs.configs[i]);
-- else
-- seq_printf(s, "%08lx", map->data.configs.configs[i]);
-- seq_printf(s, "\n");
-- }
-+ pinconf_show_config(s, pctldev, map->data.configs.configs,
-+ map->data.configs.num_configs);
- }
-
- void pinconf_show_setting(struct seq_file *s,
-@@ -243,9 +252,7 @@ void pinconf_show_setting(struct seq_file *s,
- {
- struct pinctrl_dev *pctldev = setting->pctldev;
- const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
-- const struct pinconf_ops *confops = pctldev->desc->confops;
- struct pin_desc *desc;
-- int i;
-
- switch (setting->type) {
- case PIN_MAP_TYPE_CONFIGS_PIN:
-@@ -269,17 +276,8 @@ void pinconf_show_setting(struct seq_file *s,
- * FIXME: We should really get the pin controler to dump the config
- * values, so they can be decoded to something meaningful.
- */
-- for (i = 0; i < setting->data.configs.num_configs; i++) {
-- seq_printf(s, " ");
-- if (confops && confops->pin_config_config_dbg_show)
-- confops->pin_config_config_dbg_show(pctldev, s,
-- setting->data.configs.configs[i]);
-- else
-- seq_printf(s, "%08lx",
-- setting->data.configs.configs[i]);
-- }
--
-- seq_printf(s, "\n");
-+ pinconf_show_config(s, pctldev, setting->data.configs.configs,
-+ setting->data.configs.num_configs);
- }
-
- static void pinconf_dump_pin(struct pinctrl_dev *pctldev,
-@@ -412,10 +410,8 @@ static int pinconf_dbg_config_print(struct seq_file *s, void *d)
- const struct pinctrl_map *map;
- const struct pinctrl_map *found = NULL;
- struct pinctrl_dev *pctldev;
-- const struct pinconf_ops *confops = NULL;
- struct dbg_cfg *dbg = &pinconf_dbg_conf;
- int i, j;
-- unsigned long config;
-
- mutex_lock(&pinctrl_maps_mutex);
-
-@@ -449,16 +445,10 @@ static int pinconf_dbg_config_print(struct seq_file *s, void *d)
- }
-
- pctldev = get_pinctrl_dev_from_devname(found->ctrl_dev_name);
-- config = *found->data.configs.configs;
-- seq_printf(s, "Dev %s has config of %s in state %s: 0x%08lX\n",
-- dbg->dev_name, dbg->pin_name,
-- dbg->state_name, config);
--
-- if (pctldev)
-- confops = pctldev->desc->confops;
--
-- if (confops && confops->pin_config_config_dbg_show)
-- confops->pin_config_config_dbg_show(pctldev, s, config);
-+ seq_printf(s, "Dev %s has config of %s in state %s:\n",
-+ dbg->dev_name, dbg->pin_name, dbg->state_name);
-+ pinconf_show_config(s, pctldev, found->data.configs.configs,
-+ found->data.configs.num_configs);
-
- exit:
- mutex_unlock(&pinctrl_maps_mutex);
---
-2.6.2
-
diff --git a/patches.renesas/0218-pinctrl-pinconf-pinconf_show_config-can-be-static.patch b/patches.renesas/0218-pinctrl-pinconf-pinconf_show_config-can-be-static.patch
deleted file mode 100644
index b7a39a4cd8459e..00000000000000
--- a/patches.renesas/0218-pinctrl-pinconf-pinconf_show_config-can-be-static.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 193be519143e7b5584250604c6c790d492e06303 Mon Sep 17 00:00:00 2001
-From: kbuild test robot <fengguang.wu@intel.com>
-Date: Fri, 17 Jul 2015 21:37:09 +0800
-Subject: [PATCH 218/326] pinctrl: pinconf: pinconf_show_config() can be static
-
-Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 6de52c15132f6b86030bf3159020e3314ec14952)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/pinconf.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
-index cbf26a6992a0..078e58d74fc0 100644
---- a/drivers/pinctrl/pinconf.c
-+++ b/drivers/pinctrl/pinconf.c
-@@ -202,7 +202,7 @@ int pinconf_apply_setting(struct pinctrl_setting const *setting)
-
- #ifdef CONFIG_DEBUG_FS
-
--void pinconf_show_config(struct seq_file *s, struct pinctrl_dev *pctldev,
-+static void pinconf_show_config(struct seq_file *s, struct pinctrl_dev *pctldev,
- unsigned long *configs, unsigned num_configs)
- {
- const struct pinconf_ops *confops;
---
-2.6.2
-
diff --git a/patches.renesas/0219-pinctrl-use-dev_err-to-show-message-in-pinctrl_regis.patch b/patches.renesas/0219-pinctrl-use-dev_err-to-show-message-in-pinctrl_regis.patch
deleted file mode 100644
index bd8edae216e95d..00000000000000
--- a/patches.renesas/0219-pinctrl-use-dev_err-to-show-message-in-pinctrl_regis.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 0099f9a36bf6bacf41d1e1da68d6f73d3bcbcf33 Mon Sep 17 00:00:00 2001
-From: Masahiro Yamada <yamada.masahiro@socionext.com>
-Date: Tue, 21 Jul 2015 15:25:26 +0900
-Subject: [PATCH 219/326] pinctrl: use dev_err() to show message in
- pinctrl_register_one_pin()
-
-Use dev_err() rather than pr_err() to display the error message.
-(Besides, dev_err() is already used 7 lines below in this function.)
-
-Also, drop the redundant information "on %s" because dev_err() shows
-which device the message is related to.
-
-Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 2b38ca6d1aaf9149f1286c93b131f3e62c3ac63b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/core.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
-index 8b8f3a04c353..69723e07036b 100644
---- a/drivers/pinctrl/core.c
-+++ b/drivers/pinctrl/core.c
-@@ -231,8 +231,7 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
-
- pindesc = pin_desc_get(pctldev, number);
- if (pindesc != NULL) {
-- pr_err("pin %d already registered on %s\n", number,
-- pctldev->desc->name);
-+ dev_err(pctldev->dev, "pin %d already registered\n", number);
- return -EINVAL;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0220-pinctrl-use-dev_err-to-show-message-in-pinmux_func_n.patch b/patches.renesas/0220-pinctrl-use-dev_err-to-show-message-in-pinmux_func_n.patch
deleted file mode 100644
index 0590f7c2ba40e7..00000000000000
--- a/patches.renesas/0220-pinctrl-use-dev_err-to-show-message-in-pinmux_func_n.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 524aeecdf7903da0701283cda59419d0ae080ebc Mon Sep 17 00:00:00 2001
-From: Masahiro Yamada <yamada.masahiro@socionext.com>
-Date: Tue, 21 Jul 2015 15:25:27 +0900
-Subject: [PATCH 220/326] pinctrl: use dev_err() to show message in
- pinmux_func_name_to_selector()
-
-Use dev_err() rather than pr_err() to display the error message.
-
-pinctrl_dev_get_name(pctldev) is no longer necessary because
-dev_err() shows which device the message is related to.
-
-Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit e324957096dbf5bbf1491231c9912c3f5d0bc216)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/pinmux.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
-index e7ae890dcf1a..67e08cb315c4 100644
---- a/drivers/pinctrl/pinmux.c
-+++ b/drivers/pinctrl/pinmux.c
-@@ -322,8 +322,7 @@ static int pinmux_func_name_to_selector(struct pinctrl_dev *pctldev,
- selector++;
- }
-
-- pr_err("%s does not support function %s\n",
-- pinctrl_dev_get_name(pctldev), function);
-+ dev_err(pctldev->dev, "function '%s' not supported\n", function);
- return -EINVAL;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0221-pinctrl-join-dev_dbg-strings-into-a-single-line.patch b/patches.renesas/0221-pinctrl-join-dev_dbg-strings-into-a-single-line.patch
deleted file mode 100644
index 96809034a77daa..00000000000000
--- a/patches.renesas/0221-pinctrl-join-dev_dbg-strings-into-a-single-line.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From da31db9522c067f4efe37fdb1d04646c6ac8282c Mon Sep 17 00:00:00 2001
-From: Masahiro Yamada <yamada.masahiro@socionext.com>
-Date: Thu, 30 Jul 2015 17:27:44 +0900
-Subject: [PATCH 221/326] pinctrl: join dev_dbg strings into a single line
-
-These are user-visible strings, so can exceed 80 columns.
-
-Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit ca67f10f27b6aace4a87713f038577994ec578af)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/pinconf.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
-index 078e58d74fc0..29a7bb17a42f 100644
---- a/drivers/pinctrl/pinconf.c
-+++ b/drivers/pinctrl/pinconf.c
-@@ -61,8 +61,8 @@ int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
- const struct pinconf_ops *ops = pctldev->desc->confops;
-
- if (!ops || !ops->pin_config_get) {
-- dev_dbg(pctldev->dev, "cannot get pin configuration, missing "
-- "pin_config_get() function in driver\n");
-+ dev_dbg(pctldev->dev,
-+ "cannot get pin configuration, .pin_config_get missing in driver\n");
- return -ENOTSUPP;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0222-media-media-soc_camera-rcar_vin-Add-BT.709-24-bit-RG.patch b/patches.renesas/0222-media-media-soc_camera-rcar_vin-Add-BT.709-24-bit-RG.patch
deleted file mode 100644
index 20494f578988e5..00000000000000
--- a/patches.renesas/0222-media-media-soc_camera-rcar_vin-Add-BT.709-24-bit-RG.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-From 425682df33f34e74d40c3adc386c17ee8280b0a2 Mon Sep 17 00:00:00 2001
-From: William Towle <william.towle@codethink.co.uk>
-Date: Thu, 23 Jul 2015 09:21:36 -0300
-Subject: [PATCH 222/326] [media] media: soc_camera: rcar_vin: Add BT.709
- 24-bit RGB888 input support
-
-This adds V4L2_MBUS_FMT_RGB888_1X24 input format support
-which is used by the ADV7612 chip.
-
-Modified to use MEDIA_BUS_FMT_* constants
-
-Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
-Signed-off-by: William Towle <william.towle@codethink.co.uk>
-Reviewed-by: Rob Taylor <rob.taylor@codethink.co.uk>
-Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 920a1bf30a361fc2c6d713a26deb3a488639def3)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/soc_camera/rcar_vin.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
-index 918390b5a08a..942247fc2ae6 100644
---- a/drivers/media/platform/soc_camera/rcar_vin.c
-+++ b/drivers/media/platform/soc_camera/rcar_vin.c
-@@ -98,6 +98,7 @@
- #define VNMC_INF_YUV10_BT656 (2 << 16)
- #define VNMC_INF_YUV10_BT601 (3 << 16)
- #define VNMC_INF_YUV16 (5 << 16)
-+#define VNMC_INF_RGB888 (6 << 16)
- #define VNMC_VUP (1 << 10)
- #define VNMC_IM_ODD (0 << 3)
- #define VNMC_IM_ODD_EVEN (1 << 3)
-@@ -589,7 +590,7 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
- struct soc_camera_device *icd = priv->ici.icd;
- struct rcar_vin_cam *cam = icd->host_priv;
- u32 vnmc, dmr, interrupts;
-- bool progressive = false, output_is_yuv = false;
-+ bool progressive = false, output_is_yuv = false, input_is_yuv = false;
-
- switch (priv->field) {
- case V4L2_FIELD_TOP:
-@@ -623,16 +624,22 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
- case MEDIA_BUS_FMT_YUYV8_1X16:
- /* BT.601/BT.1358 16bit YCbCr422 */
- vnmc |= VNMC_INF_YUV16;
-+ input_is_yuv = true;
- break;
- case MEDIA_BUS_FMT_YUYV8_2X8:
- /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */
- vnmc |= priv->pdata_flags & RCAR_VIN_BT656 ?
- VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601;
-+ input_is_yuv = true;
-+ break;
-+ case MEDIA_BUS_FMT_RGB888_1X24:
-+ vnmc |= VNMC_INF_RGB888;
- break;
- case MEDIA_BUS_FMT_YUYV10_2X10:
- /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */
- vnmc |= priv->pdata_flags & RCAR_VIN_BT656 ?
- VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601;
-+ input_is_yuv = true;
- break;
- default:
- break;
-@@ -676,7 +683,7 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
- vnmc |= VNMC_VUP;
-
- /* If input and output use the same colorspace, use bypass mode */
-- if (output_is_yuv)
-+ if (input_is_yuv == output_is_yuv)
- vnmc |= VNMC_BPS;
-
- /* progressive or interlaced mode */
-@@ -1417,6 +1424,7 @@ static int rcar_vin_get_formats(struct soc_camera_device *icd, unsigned int idx,
- case MEDIA_BUS_FMT_YUYV8_1X16:
- case MEDIA_BUS_FMT_YUYV8_2X8:
- case MEDIA_BUS_FMT_YUYV10_2X10:
-+ case MEDIA_BUS_FMT_RGB888_1X24:
- if (cam->extra_fmt)
- break;
-
---
-2.6.2
-
diff --git a/patches.renesas/0223-media-media-rcar_vin-fill-in-bus_info-field.patch b/patches.renesas/0223-media-media-rcar_vin-fill-in-bus_info-field.patch
deleted file mode 100644
index 3b75bd83838edb..00000000000000
--- a/patches.renesas/0223-media-media-rcar_vin-fill-in-bus_info-field.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From bf5dfa6e2175af33ca1e2653189bea227c79754a Mon Sep 17 00:00:00 2001
-From: Rob Taylor <rob.taylor@codethink.co.uk>
-Date: Thu, 23 Jul 2015 09:21:42 -0300
-Subject: [PATCH 223/326] [media] media: rcar_vin: fill in bus_info field
-
-Adapt rcar_vin_querycap() so that cap->bus_info is populated with
-something meaningful/unique.
-
-Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
-Signed-off-by: William Towle <william.towle@codethink.co.uk>
-Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 734f3f238587ffb6938700c4495dd5b5a54c4125)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/soc_camera/rcar_vin.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
-index 942247fc2ae6..1f080241c2e0 100644
---- a/drivers/media/platform/soc_camera/rcar_vin.c
-+++ b/drivers/media/platform/soc_camera/rcar_vin.c
-@@ -1778,6 +1778,7 @@ static int rcar_vin_querycap(struct soc_camera_host *ici,
- strlcpy(cap->card, "R_Car_VIN", sizeof(cap->card));
- cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
-+ snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s%d", DRV_NAME, ici->nr);
-
- return 0;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0224-media-media-rcar_vin-Reject-videobufs-that-are-too-s.patch b/patches.renesas/0224-media-media-rcar_vin-Reject-videobufs-that-are-too-s.patch
deleted file mode 100644
index 5c3bdbda6d07fa..00000000000000
--- a/patches.renesas/0224-media-media-rcar_vin-Reject-videobufs-that-are-too-s.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From d53f96c8a5fc89ee531ece2913391cd45f1a13c0 Mon Sep 17 00:00:00 2001
-From: Rob Taylor <rob.taylor@codethink.co.uk>
-Date: Thu, 23 Jul 2015 09:21:43 -0300
-Subject: [PATCH 224/326] [media] media: rcar_vin: Reject videobufs that are
- too small for current format
-
-In videobuf_setup reject buffers that are too small for the configured
-format. Fixes v4l2-compliance issue.
-
-Signed-off-by: Rob Taylor <rob.taylor@codethink.co.uk>
-Reviewed-by: William Towle <william.towle@codethink.co.uk>
-Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 4284118058b2b4f217a050908a555d0e1ed58641)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/soc_camera/rcar_vin.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
-index 1f080241c2e0..2d8cb52188e6 100644
---- a/drivers/media/platform/soc_camera/rcar_vin.c
-+++ b/drivers/media/platform/soc_camera/rcar_vin.c
-@@ -541,6 +541,9 @@ static int rcar_vin_videobuf_setup(struct vb2_queue *vq,
- unsigned int bytes_per_line;
- int ret;
-
-+ if (fmt->fmt.pix.sizeimage < icd->sizeimage)
-+ return -EINVAL;
-+
- xlate = soc_camera_xlate_by_fourcc(icd,
- fmt->fmt.pix.pixelformat);
- if (!xlate)
---
-2.6.2
-
diff --git a/patches.renesas/0225-spi-rspi-Drop-variable-error-in-qspi_trigger_transfe.patch b/patches.renesas/0225-spi-rspi-Drop-variable-error-in-qspi_trigger_transfe.patch
deleted file mode 100644
index 0ce94f24321cc5..00000000000000
--- a/patches.renesas/0225-spi-rspi-Drop-variable-error-in-qspi_trigger_transfe.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 7d89b40c489978bd2548c582a53b1f6cd47ce649 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 23 Jun 2015 15:04:28 +0200
-Subject: [PATCH 225/326] spi: rspi: Drop variable "error" in
- qspi_trigger_transfer_out_in()
-
-Just use "ret" instead, for consistency with other similar functions.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 5d4db691ed978080435f4e5aad2ce707294a75b4)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/spi/spi-rspi.c | 13 ++++++-------
- 1 file changed, 6 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
-index f6bac9e77d06..d780deb45c3d 100644
---- a/drivers/spi/spi-rspi.c
-+++ b/drivers/spi/spi-rspi.c
-@@ -728,24 +728,23 @@ static int qspi_trigger_transfer_out_int(struct rspi_data *rspi, const u8 *tx,
- u8 *rx, unsigned int len)
- {
- int i, n, ret;
-- int error;
-
- while (len > 0) {
- n = qspi_set_send_trigger(rspi, len);
- qspi_set_receive_trigger(rspi, len);
- if (n == QSPI_BUFFER_SIZE) {
-- error = rspi_wait_for_tx_empty(rspi);
-- if (error < 0) {
-+ ret = rspi_wait_for_tx_empty(rspi);
-+ if (ret < 0) {
- dev_err(&rspi->master->dev, "transmit timeout\n");
-- return error;
-+ return ret;
- }
- for (i = 0; i < n; i++)
- rspi_write_data(rspi, *tx++);
-
-- error = rspi_wait_for_rx_full(rspi);
-- if (error < 0) {
-+ ret = rspi_wait_for_rx_full(rspi);
-+ if (ret < 0) {
- dev_err(&rspi->master->dev, "receive timeout\n");
-- return error;
-+ return ret;
- }
- for (i = 0; i < n; i++)
- *rx++ = rspi_read_data(rspi);
---
-2.6.2
-
diff --git a/patches.renesas/0226-spi-rspi-Make-qspi_set_send_trigger-return-unsigned-.patch b/patches.renesas/0226-spi-rspi-Make-qspi_set_send_trigger-return-unsigned-.patch
deleted file mode 100644
index 626a38c8e106f6..00000000000000
--- a/patches.renesas/0226-spi-rspi-Make-qspi_set_send_trigger-return-unsigned-.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 4dc574faf235f624d77472e459fb6a71fcb506e5 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 23 Jun 2015 15:04:29 +0200
-Subject: [PATCH 226/326] spi: rspi: Make qspi_set_send_trigger() return
- "unsigned int"
-
-qspi_set_send_trigger() returns an unsigned value, so make it return
-"unsigned int".
-Update the loop variables qspi_trigger_transfer_out_int() to match the
-above.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit cb76b1ca9174aa29d4c7c0f4aef113be203b600c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/spi/spi-rspi.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
-index d780deb45c3d..5bdacf752ae3 100644
---- a/drivers/spi/spi-rspi.c
-+++ b/drivers/spi/spi-rspi.c
-@@ -383,7 +383,8 @@ static void qspi_update(const struct rspi_data *rspi, u8 mask, u8 val, u8 reg)
- rspi_write8(rspi, data, reg);
- }
-
--static int qspi_set_send_trigger(struct rspi_data *rspi, unsigned int len)
-+static unsigned int qspi_set_send_trigger(struct rspi_data *rspi,
-+ unsigned int len)
- {
- unsigned int n;
-
-@@ -727,7 +728,8 @@ static int rspi_rz_transfer_one(struct spi_master *master,
- static int qspi_trigger_transfer_out_int(struct rspi_data *rspi, const u8 *tx,
- u8 *rx, unsigned int len)
- {
-- int i, n, ret;
-+ unsigned int i, n;
-+ int ret;
-
- while (len > 0) {
- n = qspi_set_send_trigger(rspi, len);
---
-2.6.2
-
diff --git a/patches.renesas/0227-ata-sata_rcar-Remove-obsolete-sata-r8a779-platform_d.patch b/patches.renesas/0227-ata-sata_rcar-Remove-obsolete-sata-r8a779-platform_d.patch
deleted file mode 100644
index f1d5943d3c5b20..00000000000000
--- a/patches.renesas/0227-ata-sata_rcar-Remove-obsolete-sata-r8a779-platform_d.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From a4eaac03d13315d2eed8505e93fd9b2605e3edc3 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 23 Jun 2015 14:55:13 +0200
-Subject: [PATCH 227/326] ata: sata_rcar: Remove obsolete sata-r8a779*
- platform_device_id entries
-
-Since commit a483dcbfa21f919c ("ARM: shmobile: lager: Remove legacy
-board support"), R-Car Gen2 SoCs are only supported in generic DT-only
-ARM multi-platform builds. The driver doesn't need to match platform
-devices by name anymore, hence remove the corresponding
-platform_device_id entry.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Tejun Heo <tj@kernel.org>
-(cherry picked from commit 5dbc247c2a11f6b9febb854a55be5ae6be720df6)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/ata/sata_rcar.c | 4 ----
- 1 file changed, 4 deletions(-)
-
-diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
-index d49a5193b7de..8804127b108c 100644
---- a/drivers/ata/sata_rcar.c
-+++ b/drivers/ata/sata_rcar.c
-@@ -861,10 +861,6 @@ MODULE_DEVICE_TABLE(of, sata_rcar_match);
- static const struct platform_device_id sata_rcar_id_table[] = {
- { "sata_rcar", RCAR_GEN1_SATA }, /* Deprecated by "sata-r8a7779" */
- { "sata-r8a7779", RCAR_GEN1_SATA },
-- { "sata-r8a7790", RCAR_GEN2_SATA },
-- { "sata-r8a7790-es1", RCAR_R8A7790_ES1_SATA },
-- { "sata-r8a7791", RCAR_GEN2_SATA },
-- { "sata-r8a7793", RCAR_GEN2_SATA },
- { },
- };
- MODULE_DEVICE_TABLE(platform, sata_rcar_id_table);
---
-2.6.2
-
diff --git a/patches.renesas/0228-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-32.patch b/patches.renesas/0228-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-32.patch
deleted file mode 100644
index 9067ff22156922..00000000000000
--- a/patches.renesas/0228-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-32.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From bac0249b3c86b4824c67186aff5daef5b41ab7b6 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 23 Jun 2015 14:56:28 +0200
-Subject: [PATCH 228/326] clockevents/drivers/sh_cmt: Remove obsolete
- sh-cmt-32-fast platform_device_id entry
-
-Since commit 59b89af1d5551c12 ("ARM: shmobile: sh7372: Remove Legacy C
-SoC code"), there are no more users left of the "sh-cmt-32-fast"
-platform device name. Hence remove the corresponding platform_device_id
-entry from the driver.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 59252d187763ef3675fba1623be6996761fc2400)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/clocksource/sh_cmt.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
-index b8ff3c64cc45..0aa6293f6317 100644
---- a/drivers/clocksource/sh_cmt.c
-+++ b/drivers/clocksource/sh_cmt.c
-@@ -929,7 +929,6 @@ static int sh_cmt_map_memory(struct sh_cmt_device *cmt)
- 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] },
- { }
---
-2.6.2
-
diff --git a/patches.renesas/0229-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch b/patches.renesas/0229-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch
deleted file mode 100644
index f478b201a6c552..00000000000000
--- a/patches.renesas/0229-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From fe008d73112202c75ecd57076a5e9d395fde566a Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 23 Jun 2015 14:56:29 +0200
-Subject: [PATCH 229/326] clockevents/drivers/sh_cmt: Remove obsolete
- sh-cmt-48-gen2 platform_device_id entry
-
-Since commit 914d7d148411997c ("ARM: shmobile: r8a73a4: Remove legacy
-code"), all former users of the "sh-cmt-48-gen2" platform device name
-are only supported in generic DT-only ARM multi-platform builds. The
-driver doesn't need to match platform devices by name anymore, hence
-remove the corresponding platform_device_id entry.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 0fae62eafec3c033d49160344228a4fa7d6303bc)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/clocksource/sh_cmt.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
-index 0aa6293f6317..d56d4e0e3fb3 100644
---- a/drivers/clocksource/sh_cmt.c
-+++ b/drivers/clocksource/sh_cmt.c
-@@ -930,7 +930,6 @@ 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-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);
---
-2.6.2
-
diff --git a/patches.renesas/0230-sh-irq-Use-irq-accessor-functions-instead-of-open-co.patch b/patches.renesas/0230-sh-irq-Use-irq-accessor-functions-instead-of-open-co.patch
deleted file mode 100644
index 1865143de205c8..00000000000000
--- a/patches.renesas/0230-sh-irq-Use-irq-accessor-functions-instead-of-open-co.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From d4433926560b9259ed00eb82693f0b23bbb83ad2 Mon Sep 17 00:00:00 2001
-From: Jiang Liu <jiang.liu@linux.intel.com>
-Date: Mon, 13 Jul 2015 20:51:22 +0000
-Subject: [PATCH 230/326] sh/irq: Use irq accessor functions instead of open
- coded access
-
-This is a preparatory patch for refactoring the internals if irq_data.
-
-Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
-Cc: Simon Horman <horms@verge.net.au>
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Link: http://lkml.kernel.org/r/20150713151626.616384365@linutronix.de
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-(cherry picked from commit d0abe2f3a9a541ded2e30ef7275f057fb7f0335a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/sh/intc/virq.c | 12 +++++++-----
- 1 file changed, 7 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
-index f30ac9354ff2..bc0601cf0f8f 100644
---- a/drivers/sh/intc/virq.c
-+++ b/drivers/sh/intc/virq.c
-@@ -83,12 +83,11 @@ EXPORT_SYMBOL_GPL(intc_irq_lookup);
-
- static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
- {
-- struct intc_virq_list **last, *entry;
-- struct irq_data *data = irq_get_irq_data(irq);
-+ struct intc_virq_list *entry;
-+ struct intc_virq_list **last = NULL;
-
- /* scan for duplicates */
-- last = (struct intc_virq_list **)&data->handler_data;
-- for_each_virq(entry, data->handler_data) {
-+ for_each_virq(entry, irq_get_handler_data(irq)) {
- if (entry->irq == virq)
- return 0;
- last = &entry->next;
-@@ -102,7 +101,10 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
-
- entry->irq = virq;
-
-- *last = entry;
-+ if (last)
-+ *last = entry;
-+ else
-+ irq_set_handler_data(irq, entry);
-
- return 0;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0231-sh-intc-Use-irq_desc_get_xxx-to-avoid-redundant-look.patch b/patches.renesas/0231-sh-intc-Use-irq_desc_get_xxx-to-avoid-redundant-look.patch
deleted file mode 100644
index 2781b67d1d71fc..00000000000000
--- a/patches.renesas/0231-sh-intc-Use-irq_desc_get_xxx-to-avoid-redundant-look.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From 85a5c449cc90a0a04354bef7023097696ea9a909 Mon Sep 17 00:00:00 2001
-From: Jiang Liu <jiang.liu@linux.intel.com>
-Date: Mon, 13 Jul 2015 20:51:25 +0000
-Subject: [PATCH 231/326] sh/intc: Use irq_desc_get_xxx() to avoid redundant
- lookup of irq_desc
-
-Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we
-already have a pointer to corresponding irq_desc.
-
-Also replace generic_handle_irq with generic_handle_irq_desc() to avoid
-looking up irq_desc again.
-
-Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
-Cc: Simon Horman <horms@verge.net.au>
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Link: http://lkml.kernel.org/r/20150713151626.792845830@linutronix.de
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-(cherry picked from commit 8228a048961a93e871779c658eaa801f747e6c1d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/sh/boards/mach-se/7343/irq.c | 2 +-
- arch/sh/boards/mach-se/7722/irq.c | 2 +-
- arch/sh/boards/mach-x3proto/gpio.c | 2 +-
- drivers/sh/intc/core.c | 2 +-
- drivers/sh/intc/virq.c | 14 ++++++++------
- 5 files changed, 12 insertions(+), 10 deletions(-)
-
-diff --git a/arch/sh/boards/mach-se/7343/irq.c b/arch/sh/boards/mach-se/7343/irq.c
-index 1087dba9b015..6f97a8f0d0d6 100644
---- a/arch/sh/boards/mach-se/7343/irq.c
-+++ b/arch/sh/boards/mach-se/7343/irq.c
-@@ -31,7 +31,7 @@ struct irq_domain *se7343_irq_domain;
-
- static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
- {
-- struct irq_data *data = irq_get_irq_data(irq);
-+ struct irq_data *data = irq_desc_get_irq_data(desc);
- struct irq_chip *chip = irq_data_get_irq_chip(data);
- unsigned long mask;
- int bit;
-diff --git a/arch/sh/boards/mach-se/7722/irq.c b/arch/sh/boards/mach-se/7722/irq.c
-index 00e699232621..60aebd14ccf8 100644
---- a/arch/sh/boards/mach-se/7722/irq.c
-+++ b/arch/sh/boards/mach-se/7722/irq.c
-@@ -30,7 +30,7 @@ struct irq_domain *se7722_irq_domain;
-
- static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
- {
-- struct irq_data *data = irq_get_irq_data(irq);
-+ struct irq_data *data = irq_desc_get_irq_data(desc);
- struct irq_chip *chip = irq_data_get_irq_chip(data);
- unsigned long mask;
- int bit;
-diff --git a/arch/sh/boards/mach-x3proto/gpio.c b/arch/sh/boards/mach-x3proto/gpio.c
-index f035a7ac6456..24555c364d5b 100644
---- a/arch/sh/boards/mach-x3proto/gpio.c
-+++ b/arch/sh/boards/mach-x3proto/gpio.c
-@@ -62,7 +62,7 @@ static int x3proto_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
-
- static void x3proto_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
- {
-- struct irq_data *data = irq_get_irq_data(irq);
-+ struct irq_data *data = irq_desc_get_irq_data(desc);
- struct irq_chip *chip = irq_data_get_irq_chip(data);
- unsigned long mask;
- int pin;
-diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
-index 81f22980b2de..6dc0361aeeeb 100644
---- a/drivers/sh/intc/core.c
-+++ b/drivers/sh/intc/core.c
-@@ -67,7 +67,7 @@ void intc_set_prio_level(unsigned int irq, unsigned int level)
-
- static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
- {
-- generic_handle_irq((unsigned int)irq_get_handler_data(irq));
-+ generic_handle_irq((unsigned int)irq_desc_get_handler_data(desc));
- }
-
- static void __init intc_register_irq(struct intc_desc *desc,
-diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
-index bc0601cf0f8f..bb7e745d4266 100644
---- a/drivers/sh/intc/virq.c
-+++ b/drivers/sh/intc/virq.c
-@@ -111,7 +111,7 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
-
- static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
- {
-- struct irq_data *data = irq_get_irq_data(irq);
-+ struct irq_data *data = irq_desc_get_irq_data(desc);
- struct irq_chip *chip = irq_data_get_irq_chip(data);
- struct intc_virq_list *entry, *vlist = irq_data_get_irq_handler_data(data);
- struct intc_desc_int *d = get_intc_desc(irq);
-@@ -120,12 +120,14 @@ static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
-
- for_each_virq(entry, vlist) {
- unsigned long addr, handle;
-+ struct irq_desc *vdesc = irq_to_desc(entry->irq);
-
-- handle = (unsigned long)irq_get_handler_data(entry->irq);
-- addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
--
-- if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
-- generic_handle_irq(entry->irq);
-+ if (vdesc) {
-+ handle = (unsigned long)irq_desc_get_handler_data(vdesc);
-+ addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
-+ if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
-+ generic_handle_irq_desc(entry->irq, vdesc);
-+ }
- }
-
- chip->irq_unmask(data);
---
-2.6.2
-
diff --git a/patches.renesas/0232-sh_eth-propagate-platform_get_irq-error-upstream.patch b/patches.renesas/0232-sh_eth-propagate-platform_get_irq-error-upstream.patch
deleted file mode 100644
index 9bfbfa2dac21e9..00000000000000
--- a/patches.renesas/0232-sh_eth-propagate-platform_get_irq-error-upstream.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 193b9d726959dff8c8cffcacf69ed0c6ad2b4f92 Mon Sep 17 00:00:00 2001
-From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Date: Fri, 28 Aug 2015 16:56:01 +0300
-Subject: [PATCH 232/326] sh_eth: propagate platform_get_irq() error upstream
-
-The driver overrides the error returned by platform_get_irq() with -ENODEV
-which e.g. precludes the deferred probing from working. Propagate the real
-error code to the driver core instead.
-
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-(cherry picked from commit 7a468ac624c80bda76957d8cbc28024f4f68e316)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/net/ethernet/renesas/sh_eth.c | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
---- a/drivers/net/ethernet/renesas/sh_eth.c
-+++ b/drivers/net/ethernet/renesas/sh_eth.c
-@@ -3090,10 +3090,8 @@ static int sh_eth_drv_probe(struct platf
-
- ndev->dma = -1;
- ret = platform_get_irq(pdev, 0);
-- if (ret < 0) {
-- ret = -ENODEV;
-+ if (ret < 0)
- goto out_release;
-- }
- ndev->irq = ret;
-
- SET_NETDEV_DEV(ndev, &pdev->dev);
diff --git a/patches.renesas/0233-mmc-sh_mmcif-Fix-suspend-process.patch b/patches.renesas/0233-mmc-sh_mmcif-Fix-suspend-process.patch
deleted file mode 100644
index 04d65b1154a00f..00000000000000
--- a/patches.renesas/0233-mmc-sh_mmcif-Fix-suspend-process.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 32e9182e48324d08a7da5435c907d83009d77987 Mon Sep 17 00:00:00 2001
-From: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
-Date: Sun, 23 Aug 2015 21:58:08 +0900
-Subject: [PATCH 233/326] mmc: sh_mmcif: Fix suspend process
-
-The clock should be enable when SDHI registers are accessed.
-
-Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
-Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-(cherry picked from commit 5afc30fc666165c1c37c246e08b4282bc8c31d98)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/mmc/host/sh_mmcif.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
-index 7eff087cf515..f9f93bf5e8fe 100644
---- a/drivers/mmc/host/sh_mmcif.c
-+++ b/drivers/mmc/host/sh_mmcif.c
-@@ -1532,7 +1532,9 @@ static int sh_mmcif_suspend(struct device *dev)
- {
- struct sh_mmcif_host *host = dev_get_drvdata(dev);
-
-+ pm_runtime_get_sync(dev);
- sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);
-+ pm_runtime_put(dev);
-
- return 0;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0234-mmc-tmio-Fix-timeout-value-for-command-request.patch b/patches.renesas/0234-mmc-tmio-Fix-timeout-value-for-command-request.patch
deleted file mode 100644
index 568f625416e9df..00000000000000
--- a/patches.renesas/0234-mmc-tmio-Fix-timeout-value-for-command-request.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 6befad9e7d49b61a69cf921496211fcdbed39a24 Mon Sep 17 00:00:00 2001
-From: Takeshi Kihara <takeshi.kihara.df@renesas.com>
-Date: Mon, 20 Jul 2015 01:39:59 +0900
-Subject: [PATCH 234/326] mmc: tmio: Fix timeout value for command request
-
-Fix the problem which timeout occurs at the time of command request with
-several cards.
-
-The timeout value was insufficient as a verification of several cards,
-so it was changed 5 seconds from 2 seconds.
-
-Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
-Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-(cherry picked from commit 0df9d2eae5e1092b07eaab6b989c2ff14115cab5)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/mmc/host/tmio_mmc_pio.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
-index dba7e1c19dd7..988e498467df 100644
---- a/drivers/mmc/host/tmio_mmc_pio.c
-+++ b/drivers/mmc/host/tmio_mmc_pio.c
-@@ -83,6 +83,8 @@ static int tmio_mmc_next_sg(struct tmio_mmc_host *host)
- return --host->sg_len;
- }
-
-+#define CMDREQ_TIMEOUT 5000
-+
- #ifdef CONFIG_MMC_DEBUG
-
- #define STATUS_TO_TEXT(a, status, i) \
-@@ -230,7 +232,7 @@ static void tmio_mmc_reset_work(struct work_struct *work)
- */
- if (IS_ERR_OR_NULL(mrq)
- || time_is_after_jiffies(host->last_req_ts +
-- msecs_to_jiffies(2000))) {
-+ msecs_to_jiffies(CMDREQ_TIMEOUT))) {
- spin_unlock_irqrestore(&host->lock, flags);
- return;
- }
-@@ -818,7 +820,7 @@ static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
- ret = tmio_mmc_start_command(host, mrq->cmd);
- if (!ret) {
- schedule_delayed_work(&host->delayed_reset_work,
-- msecs_to_jiffies(2000));
-+ msecs_to_jiffies(CMDREQ_TIMEOUT));
- return;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0235-spi-sh-msiof-Remove-obsolete-spi_r8a779x_msiof-platf.patch b/patches.renesas/0235-spi-sh-msiof-Remove-obsolete-spi_r8a779x_msiof-platf.patch
deleted file mode 100644
index 23ecf6bbb1075f..00000000000000
--- a/patches.renesas/0235-spi-sh-msiof-Remove-obsolete-spi_r8a779x_msiof-platf.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 433124ce4e3529152af35969cbfbe338462a16a4 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 23 Jun 2015 15:02:44 +0200
-Subject: [PATCH 235/326] spi: sh-msiof: Remove obsolete spi_r8a779x_msiof
- platform_device_id entries
-
-Since commit a483dcbfa21f919c ("ARM: shmobile: lager: Remove legacy
-board support"), R-Car Gen2 SoCs are only supported in generic DT-only
-ARM multi-platform builds. The driver doesn't need to match platform
-devices by name anymore, hence remove the corresponding
-platform_device_id entry.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit f6d1b3e20a840a7201ae400a970f42cca96aa17b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/spi/spi-sh-msiof.c | 5 -----
- 1 file changed, 5 deletions(-)
-
---- a/drivers/spi/spi-sh-msiof.c
-+++ b/drivers/spi/spi-sh-msiof.c
-@@ -1268,11 +1268,6 @@ static int sh_msiof_spi_remove(struct pl
-
- static struct platform_device_id spi_driver_ids[] = {
- { "spi_sh_msiof", (kernel_ulong_t)&sh_data },
-- { "spi_r8a7790_msiof", (kernel_ulong_t)&r8a779x_data },
-- { "spi_r8a7791_msiof", (kernel_ulong_t)&r8a779x_data },
-- { "spi_r8a7792_msiof", (kernel_ulong_t)&r8a779x_data },
-- { "spi_r8a7793_msiof", (kernel_ulong_t)&r8a779x_data },
-- { "spi_r8a7794_msiof", (kernel_ulong_t)&r8a779x_data },
- {},
- };
- MODULE_DEVICE_TABLE(platform, spi_driver_ids);
diff --git a/patches.renesas/0237-pinctrl-sh-pfc-Remove-r8a73a4-platform_device_id-ent.patch b/patches.renesas/0237-pinctrl-sh-pfc-Remove-r8a73a4-platform_device_id-ent.patch
deleted file mode 100644
index 8105d58dd89579..00000000000000
--- a/patches.renesas/0237-pinctrl-sh-pfc-Remove-r8a73a4-platform_device_id-ent.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From d99fe937bc4a3989ba03ba0430bef233dd52aad6 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:15:07 +0200
-Subject: [PATCH 237/326] pinctrl: sh-pfc: Remove r8a73a4 platform_device_id
- entry
-
-As of commit 9d07d414d4c33d86 ("ARM: shmobile: r8a73a4: ape6evm: Remove
-legacy platform"), r8a73a4 is only supported in generic DT-only ARM
-multi-platform builds. The driver doesn't need to match platform
-devices by name anymore, hence remove the corresponding
-platform_device_id entry.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 592be8d3c1110ae12082399c39eef18ec15c0d1d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/core.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
-index 7b2c9495c383..287a3d048a5e 100644
---- a/drivers/pinctrl/sh-pfc/core.c
-+++ b/drivers/pinctrl/sh-pfc/core.c
-@@ -579,9 +579,6 @@ static int sh_pfc_remove(struct platform_device *pdev)
- }
-
- static const struct platform_device_id sh_pfc_id_table[] = {
--#ifdef CONFIG_PINCTRL_PFC_R8A73A4
-- { "pfc-r8a73a4", (kernel_ulong_t)&r8a73a4_pinmux_info },
--#endif
- #ifdef CONFIG_PINCTRL_PFC_R8A7740
- { "pfc-r8a7740", (kernel_ulong_t)&r8a7740_pinmux_info },
- #endif
---
-2.6.2
-
diff --git a/patches.renesas/0238-pinctrl-sh-pfc-r8a7740-Fix-typo-SCIFAB-in-comment.patch b/patches.renesas/0238-pinctrl-sh-pfc-r8a7740-Fix-typo-SCIFAB-in-comment.patch
deleted file mode 100644
index 22aa6d488aa2e9..00000000000000
--- a/patches.renesas/0238-pinctrl-sh-pfc-r8a7740-Fix-typo-SCIFAB-in-comment.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 417df6f5c589c0d3e8d770b30cf5dce7cff4fd8c Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 4 May 2015 16:40:46 +0200
-Subject: [PATCH 238/326] pinctrl: sh-pfc: r8a7740: Fix typo SCIFAB in comment
-
-The last serial port is called "SCIFB", not "SCIFAB".
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 992161965f60c4f19176026045f82749f30dafa2)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/pfc-r8a7740.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
-index b486e9d20cc2..d0bb1459783a 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
-@@ -258,7 +258,7 @@ enum {
- /* SCIFA7 */
- SCIFA7_TXD_MARK, SCIFA7_RXD_MARK,
-
-- /* SCIFAB */
-+ /* SCIFB */
- SCIFB_SCK_PORT190_MARK, /* MSEL5CR_17_0 */
- SCIFB_RXD_PORT191_MARK,
- SCIFB_TXD_PORT192_MARK,
---
-2.6.2
-
diff --git a/patches.renesas/0239-pinctrl-sh-pfc-Add-r8a7793-support.patch b/patches.renesas/0239-pinctrl-sh-pfc-Add-r8a7793-support.patch
deleted file mode 100644
index 8f62256a166d51..00000000000000
--- a/patches.renesas/0239-pinctrl-sh-pfc-Add-r8a7793-support.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-From 767fc9fd1a1675f7621ed100705804993503c5af Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Tue, 12 May 2015 11:13:19 +0200
-Subject: [PATCH 239/326] pinctrl: sh-pfc: Add r8a7793 support
-
-Regarding pin control, r8a7791 and r8a7793 are identical, so it is
-sufficient to add an sh_pfc_soc_info structure to enable r8a7793 support.
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-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 19e1e98fbf68d398bab944244f883ae14535b196)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/core.c | 6 ++++++
- drivers/pinctrl/sh-pfc/core.h | 1 +
- drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 23 +++++++++++++++++++++++
- 3 files changed, 30 insertions(+)
-
-diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
-index 287a3d048a5e..96556362b28f 100644
---- a/drivers/pinctrl/sh-pfc/core.c
-+++ b/drivers/pinctrl/sh-pfc/core.c
-@@ -481,6 +481,12 @@ static const struct of_device_id sh_pfc_of_table[] = {
- .data = &r8a7791_pinmux_info,
- },
- #endif
-+#ifdef CONFIG_PINCTRL_PFC_R8A7793
-+ {
-+ .compatible = "renesas,pfc-r8a7793",
-+ .data = &r8a7793_pinmux_info,
-+ },
-+#endif
- #ifdef CONFIG_PINCTRL_PFC_SH73A0
- {
- .compatible = "renesas,pfc-sh73a0",
-diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
-index 6dc8a6fc2746..b151b771e876 100644
---- a/drivers/pinctrl/sh-pfc/core.h
-+++ b/drivers/pinctrl/sh-pfc/core.h
-@@ -71,6 +71,7 @@ extern const struct sh_pfc_soc_info r8a7778_pinmux_info;
- extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
- extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
- extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
-+extern const struct sh_pfc_soc_info r8a7793_pinmux_info;
- extern const struct sh_pfc_soc_info sh7203_pinmux_info;
- extern const struct sh_pfc_soc_info sh7264_pinmux_info;
- extern const struct sh_pfc_soc_info sh7269_pinmux_info;
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-index fdd2c8729791..cbf8ec3ae8ab 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-@@ -6181,6 +6181,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- { },
- };
-
-+#ifdef CONFIG_PINCTRL_PFC_R8A7791
- const struct sh_pfc_soc_info r8a7791_pinmux_info = {
- .name = "r8a77910_pfc",
- .unlock_reg = 0xe6060000, /* PMMR */
-@@ -6199,3 +6200,25 @@ const struct sh_pfc_soc_info r8a7791_pinmux_info = {
- .gpio_data = pinmux_data,
- .gpio_data_size = ARRAY_SIZE(pinmux_data),
- };
-+#endif
-+
-+#ifdef CONFIG_PINCTRL_PFC_R8A7793
-+const struct sh_pfc_soc_info r8a7793_pinmux_info = {
-+ .name = "r8a77930_pfc",
-+ .unlock_reg = 0xe6060000, /* PMMR */
-+
-+ .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
-+
-+ .pins = pinmux_pins,
-+ .nr_pins = ARRAY_SIZE(pinmux_pins),
-+ .groups = pinmux_groups,
-+ .nr_groups = ARRAY_SIZE(pinmux_groups),
-+ .functions = pinmux_functions,
-+ .nr_functions = ARRAY_SIZE(pinmux_functions),
-+
-+ .cfg_regs = pinmux_config_regs,
-+
-+ .gpio_data = pinmux_data,
-+ .gpio_data_size = ARRAY_SIZE(pinmux_data),
-+};
-+#endif
---
-2.6.2
-
diff --git a/patches.renesas/0240-pinctrl-sh-pfc-Enable-building-of-r8a7793-PFC-suppor.patch b/patches.renesas/0240-pinctrl-sh-pfc-Enable-building-of-r8a7793-PFC-suppor.patch
deleted file mode 100644
index 463a0cbc249d3a..00000000000000
--- a/patches.renesas/0240-pinctrl-sh-pfc-Enable-building-of-r8a7793-PFC-suppor.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From e0c6d4042510ebf8d525c0ac22d625bd487151fa Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Tue, 12 May 2015 11:13:20 +0200
-Subject: [PATCH 240/326] pinctrl: sh-pfc: Enable building of r8a7793 PFC
- support
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-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 cb0ba73d09a0deb03b292c39b1c39e1d622e66df)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/Kconfig | 5 +++++
- drivers/pinctrl/sh-pfc/Makefile | 1 +
- 2 files changed, 6 insertions(+)
-
-diff --git a/drivers/pinctrl/sh-pfc/Kconfig b/drivers/pinctrl/sh-pfc/Kconfig
-index 8c4b3d391823..5d570fdf6065 100644
---- a/drivers/pinctrl/sh-pfc/Kconfig
-+++ b/drivers/pinctrl/sh-pfc/Kconfig
-@@ -55,6 +55,11 @@ config PINCTRL_PFC_R8A7791
- depends on ARCH_R8A7791
- select PINCTRL_SH_PFC
-
-+config PINCTRL_PFC_R8A7793
-+ def_bool y
-+ depends on ARCH_R8A7793
-+ select PINCTRL_SH_PFC
-+
- config PINCTRL_PFC_SH7203
- def_bool y
- depends on CPU_SUBTYPE_SH7203
-diff --git a/drivers/pinctrl/sh-pfc/Makefile b/drivers/pinctrl/sh-pfc/Makefile
-index f4074e166bcf..11eefcb71ec9 100644
---- a/drivers/pinctrl/sh-pfc/Makefile
-+++ b/drivers/pinctrl/sh-pfc/Makefile
-@@ -10,6 +10,7 @@ obj-$(CONFIG_PINCTRL_PFC_R8A7778) += pfc-r8a7778.o
- obj-$(CONFIG_PINCTRL_PFC_R8A7779) += pfc-r8a7779.o
- obj-$(CONFIG_PINCTRL_PFC_R8A7790) += pfc-r8a7790.o
- obj-$(CONFIG_PINCTRL_PFC_R8A7791) += pfc-r8a7791.o
-+obj-$(CONFIG_PINCTRL_PFC_R8A7793) += pfc-r8a7791.o
- obj-$(CONFIG_PINCTRL_PFC_SH7203) += pfc-sh7203.o
- obj-$(CONFIG_PINCTRL_PFC_SH7264) += pfc-sh7264.o
- obj-$(CONFIG_PINCTRL_PFC_SH7269) += pfc-sh7269.o
---
-2.6.2
-
diff --git a/patches.renesas/0241-pinctrl-sh-pfc-Add-renesas-pfc-r8a7793-to-binding-do.patch b/patches.renesas/0241-pinctrl-sh-pfc-Add-renesas-pfc-r8a7793-to-binding-do.patch
deleted file mode 100644
index 8481bc332b406f..00000000000000
--- a/patches.renesas/0241-pinctrl-sh-pfc-Add-renesas-pfc-r8a7793-to-binding-do.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 9b43dd3a23896dc1ab667372d4d8de7de9b05aba Mon Sep 17 00:00:00 2001
-From: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Date: Tue, 12 May 2015 11:13:21 +0200
-Subject: [PATCH 241/326] pinctrl: sh-pfc: Add renesas,pfc-r8a7793 to binding
- documentation
-
-Also renames "R-Car M2" to "R-Car M2-W" to avoid confusion.
-
-Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Cc: devicetree@vger.kernel.org
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 7e15a967a2d686bc959a268fd12c50e39d705416)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-index bfe72ec055e3..6bcf851b6779 100644
---- a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-+++ b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-@@ -16,7 +16,8 @@ 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-r8a7791": for R8A7791 (R-Car M2-W) compatible pin-controller.
-+ - "renesas,pfc-r8a7793": for R8A7793 (R-Car M2-N) compatible pin-controller.
- - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible pin-controller.
-
- - reg: Base address and length of each memory resource used by the pin
---
-2.6.2
-
diff --git a/patches.renesas/0242-pinctrl-sh-pfc-r8a73a4-Remove-obsolete-multi-platfor.patch b/patches.renesas/0242-pinctrl-sh-pfc-r8a73a4-Remove-obsolete-multi-platfor.patch
deleted file mode 100644
index 626e21b47406ed..00000000000000
--- a/patches.renesas/0242-pinctrl-sh-pfc-r8a73a4-Remove-obsolete-multi-platfor.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From e00ef28265b261e0aa1aabd9a4dde82004268b76 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 28 Apr 2015 12:15:06 +0200
-Subject: [PATCH 242/326] pinctrl: sh-pfc: r8a73a4: Remove obsolete
- multi-platform check
-
-As of commit 9d07d414d4c33d86 ("ARM: shmobile: r8a73a4: ape6evm: Remove
-legacy platform"), r8a73a4 is only supported in generic ARM
-multi-platform builds. Hence CONFIG_ARCH_MULTIPLATFORM is always set,
-and the check can be removed.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit e8e36d2f1873218a2fdaf0b7cd335b84e8be6112)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/pfc-r8a73a4.c | 4 ----
- 1 file changed, 4 deletions(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
-index 280a56f97786..ba18d2e65e67 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c
-@@ -21,10 +21,6 @@
- #include <linux/kernel.h>
- #include <linux/pinctrl/pinconf-generic.h>
-
--#ifndef CONFIG_ARCH_MULTIPLATFORM
--#include <mach/irqs.h>
--#endif
--
- #include "core.h"
- #include "sh_pfc.h"
-
---
-2.6.2
-
diff --git a/patches.renesas/0243-pinctrl-sh-pfc-r8a7790-Add-PWM-pin-groups-and-functi.patch b/patches.renesas/0243-pinctrl-sh-pfc-r8a7790-Add-PWM-pin-groups-and-functi.patch
deleted file mode 100644
index 84cc0c34cc4406..00000000000000
--- a/patches.renesas/0243-pinctrl-sh-pfc-r8a7790-Add-PWM-pin-groups-and-functi.patch
+++ /dev/null
@@ -1,152 +0,0 @@
-From 9414dc604a8eda379e5c0546a2c47a5e4771976e Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Thu, 14 May 2015 19:48:54 +0900
-Subject: [PATCH 243/326] pinctrl: sh-pfc: r8a7790: Add PWM pin groups and
- functions
-
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Reviewed-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 5c89c15b748c011332d855d13f4159d3e06378d9)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/pfc-r8a7790.c | 101 +++++++++++++++++++++++++++++++++++
- 1 file changed, 101 insertions(+)
-
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
-index 22a5470889f5..baab81ead9ff 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
-@@ -2664,6 +2664,61 @@ static const unsigned int msiof3_tx_b_pins[] = {
- static const unsigned int msiof3_tx_b_mux[] = {
- MSIOF3_TXD_B_MARK,
- };
-+/* - PWM -------------------------------------------------------------------- */
-+static const unsigned int pwm0_pins[] = {
-+ RCAR_GP_PIN(5, 29),
-+};
-+static const unsigned int pwm0_mux[] = {
-+ PWM0_MARK,
-+};
-+static const unsigned int pwm0_b_pins[] = {
-+ RCAR_GP_PIN(4, 30),
-+};
-+static const unsigned int pwm0_b_mux[] = {
-+ PWM0_B_MARK,
-+};
-+static const unsigned int pwm1_pins[] = {
-+ RCAR_GP_PIN(5, 30),
-+};
-+static const unsigned int pwm1_mux[] = {
-+ PWM1_MARK,
-+};
-+static const unsigned int pwm1_b_pins[] = {
-+ RCAR_GP_PIN(4, 31),
-+};
-+static const unsigned int pwm1_b_mux[] = {
-+ PWM1_B_MARK,
-+};
-+static const unsigned int pwm2_pins[] = {
-+ RCAR_GP_PIN(5, 31),
-+};
-+static const unsigned int pwm2_mux[] = {
-+ PWM2_MARK,
-+};
-+static const unsigned int pwm3_pins[] = {
-+ RCAR_GP_PIN(0, 16),
-+};
-+static const unsigned int pwm3_mux[] = {
-+ PWM3_MARK,
-+};
-+static const unsigned int pwm4_pins[] = {
-+ RCAR_GP_PIN(0, 17),
-+};
-+static const unsigned int pwm4_mux[] = {
-+ PWM4_MARK,
-+};
-+static const unsigned int pwm5_pins[] = {
-+ RCAR_GP_PIN(0, 18),
-+};
-+static const unsigned int pwm5_mux[] = {
-+ PWM5_MARK,
-+};
-+static const unsigned int pwm6_pins[] = {
-+ RCAR_GP_PIN(0, 19),
-+};
-+static const unsigned int pwm6_mux[] = {
-+ PWM6_MARK,
-+};
- /* - QSPI ------------------------------------------------------------------- */
- static const unsigned int qspi_ctrl_pins[] = {
- /* SPCLK, SSL */
-@@ -4008,6 +4063,15 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
- SH_PFC_PIN_GROUP(msiof3_sync_b),
- SH_PFC_PIN_GROUP(msiof3_rx_b),
- SH_PFC_PIN_GROUP(msiof3_tx_b),
-+ SH_PFC_PIN_GROUP(pwm0),
-+ SH_PFC_PIN_GROUP(pwm0_b),
-+ SH_PFC_PIN_GROUP(pwm1),
-+ SH_PFC_PIN_GROUP(pwm1_b),
-+ SH_PFC_PIN_GROUP(pwm2),
-+ SH_PFC_PIN_GROUP(pwm3),
-+ SH_PFC_PIN_GROUP(pwm4),
-+ SH_PFC_PIN_GROUP(pwm5),
-+ SH_PFC_PIN_GROUP(pwm6),
- SH_PFC_PIN_GROUP(qspi_ctrl),
- SH_PFC_PIN_GROUP(qspi_data2),
- SH_PFC_PIN_GROUP(qspi_data4),
-@@ -4364,6 +4428,36 @@ static const char * const msiof3_groups[] = {
- "msiof3_tx_b",
- };
-
-+static const char * const pwm0_groups[] = {
-+ "pwm0",
-+ "pwm0_b",
-+};
-+
-+static const char * const pwm1_groups[] = {
-+ "pwm1",
-+ "pwm1_b",
-+};
-+
-+static const char * const pwm2_groups[] = {
-+ "pwm2",
-+};
-+
-+static const char * const pwm3_groups[] = {
-+ "pwm3",
-+};
-+
-+static const char * const pwm4_groups[] = {
-+ "pwm4",
-+};
-+
-+static const char * const pwm5_groups[] = {
-+ "pwm5",
-+};
-+
-+static const char * const pwm6_groups[] = {
-+ "pwm6",
-+};
-+
- static const char * const qspi_groups[] = {
- "qspi_ctrl",
- "qspi_data2",
-@@ -4621,6 +4715,13 @@ static const struct sh_pfc_function pinmux_functions[] = {
- SH_PFC_FUNCTION(msiof1),
- SH_PFC_FUNCTION(msiof2),
- SH_PFC_FUNCTION(msiof3),
-+ SH_PFC_FUNCTION(pwm0),
-+ SH_PFC_FUNCTION(pwm1),
-+ SH_PFC_FUNCTION(pwm2),
-+ SH_PFC_FUNCTION(pwm3),
-+ SH_PFC_FUNCTION(pwm4),
-+ SH_PFC_FUNCTION(pwm5),
-+ SH_PFC_FUNCTION(pwm6),
- SH_PFC_FUNCTION(qspi),
- SH_PFC_FUNCTION(scif0),
- SH_PFC_FUNCTION(scif1),
---
-2.6.2
-
diff --git a/patches.renesas/0244-pinctrl-sh-pfc-r8a7791-Add-PWM-pin-groups-and-functi.patch b/patches.renesas/0244-pinctrl-sh-pfc-r8a7791-Add-PWM-pin-groups-and-functi.patch
deleted file mode 100644
index a6a0265db19ac1..00000000000000
--- a/patches.renesas/0244-pinctrl-sh-pfc-r8a7791-Add-PWM-pin-groups-and-functi.patch
+++ /dev/null
@@ -1,176 +0,0 @@
-From 0afae3a50ab99253e917a673400f6738edb6e32d Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Mon, 18 May 2015 10:41:05 +0900
-Subject: [PATCH 244/326] pinctrl: sh-pfc: r8a7791: Add PWM pin groups and
- functions
-
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Acked-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 f9784298e2b4a95be3bd7200075a2fdc61fd9f3b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 125 +++++++++++++++++++++++++++++++++++
- 1 file changed, 125 insertions(+)
-
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-index cbf8ec3ae8ab..6e9ed6fb087c 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-@@ -2928,6 +2928,79 @@ static const unsigned int msiof2_tx_e_pins[] = {
- static const unsigned int msiof2_tx_e_mux[] = {
- MSIOF2_TXD_E_MARK,
- };
-+/* - PWM -------------------------------------------------------------------- */
-+static const unsigned int pwm0_pins[] = {
-+ RCAR_GP_PIN(6, 14),
-+};
-+static const unsigned int pwm0_mux[] = {
-+ PWM0_MARK,
-+};
-+static const unsigned int pwm0_b_pins[] = {
-+ RCAR_GP_PIN(5, 30),
-+};
-+static const unsigned int pwm0_b_mux[] = {
-+ PWM0_B_MARK,
-+};
-+static const unsigned int pwm1_pins[] = {
-+ RCAR_GP_PIN(1, 17),
-+};
-+static const unsigned int pwm1_mux[] = {
-+ PWM1_MARK,
-+};
-+static const unsigned int pwm1_b_pins[] = {
-+ RCAR_GP_PIN(6, 15),
-+};
-+static const unsigned int pwm1_b_mux[] = {
-+ PWM1_B_MARK,
-+};
-+static const unsigned int pwm2_pins[] = {
-+ RCAR_GP_PIN(1, 18),
-+};
-+static const unsigned int pwm2_mux[] = {
-+ PWM2_MARK,
-+};
-+static const unsigned int pwm2_b_pins[] = {
-+ RCAR_GP_PIN(0, 16),
-+};
-+static const unsigned int pwm2_b_mux[] = {
-+ PWM2_B_MARK,
-+};
-+static const unsigned int pwm3_pins[] = {
-+ RCAR_GP_PIN(1, 24),
-+};
-+static const unsigned int pwm3_mux[] = {
-+ PWM3_MARK,
-+};
-+static const unsigned int pwm4_pins[] = {
-+ RCAR_GP_PIN(3, 26),
-+};
-+static const unsigned int pwm4_mux[] = {
-+ PWM4_MARK,
-+};
-+static const unsigned int pwm4_b_pins[] = {
-+ RCAR_GP_PIN(3, 31),
-+};
-+static const unsigned int pwm4_b_mux[] = {
-+ PWM4_B_MARK,
-+};
-+static const unsigned int pwm5_pins[] = {
-+ RCAR_GP_PIN(7, 21),
-+};
-+static const unsigned int pwm5_mux[] = {
-+ PWM5_MARK,
-+};
-+static const unsigned int pwm5_b_pins[] = {
-+ RCAR_GP_PIN(7, 20),
-+};
-+static const unsigned int pwm5_b_mux[] = {
-+ PWM5_B_MARK,
-+};
-+static const unsigned int pwm6_pins[] = {
-+ RCAR_GP_PIN(7, 22),
-+};
-+static const unsigned int pwm6_mux[] = {
-+ PWM6_MARK,
-+};
- /* - QSPI ------------------------------------------------------------------- */
- static const unsigned int qspi_ctrl_pins[] = {
- /* SPCLK, SSL */
-@@ -4348,6 +4421,18 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
- SH_PFC_PIN_GROUP(msiof2_sync_e),
- SH_PFC_PIN_GROUP(msiof2_rx_e),
- SH_PFC_PIN_GROUP(msiof2_tx_e),
-+ SH_PFC_PIN_GROUP(pwm0),
-+ SH_PFC_PIN_GROUP(pwm0_b),
-+ SH_PFC_PIN_GROUP(pwm1),
-+ SH_PFC_PIN_GROUP(pwm1_b),
-+ SH_PFC_PIN_GROUP(pwm2),
-+ SH_PFC_PIN_GROUP(pwm2_b),
-+ SH_PFC_PIN_GROUP(pwm3),
-+ SH_PFC_PIN_GROUP(pwm4),
-+ SH_PFC_PIN_GROUP(pwm4_b),
-+ SH_PFC_PIN_GROUP(pwm5),
-+ SH_PFC_PIN_GROUP(pwm5_b),
-+ SH_PFC_PIN_GROUP(pwm6),
- SH_PFC_PIN_GROUP(qspi_ctrl),
- SH_PFC_PIN_GROUP(qspi_data2),
- SH_PFC_PIN_GROUP(qspi_data4),
-@@ -4745,6 +4830,39 @@ static const char * const msiof2_groups[] = {
- "msiof2_tx_e",
- };
-
-+static const char * const pwm0_groups[] = {
-+ "pwm0",
-+ "pwm0_b",
-+};
-+
-+static const char * const pwm1_groups[] = {
-+ "pwm1",
-+ "pwm1_b",
-+};
-+
-+static const char * const pwm2_groups[] = {
-+ "pwm2",
-+ "pwm2_b",
-+};
-+
-+static const char * const pwm3_groups[] = {
-+ "pwm3",
-+};
-+
-+static const char * const pwm4_groups[] = {
-+ "pwm4",
-+ "pwm4_b",
-+};
-+
-+static const char * const pwm5_groups[] = {
-+ "pwm5",
-+ "pwm5_b",
-+};
-+
-+static const char * const pwm6_groups[] = {
-+ "pwm6",
-+};
-+
- static const char * const qspi_groups[] = {
- "qspi_ctrl",
- "qspi_data2",
-@@ -4989,6 +5107,13 @@ static const struct sh_pfc_function pinmux_functions[] = {
- SH_PFC_FUNCTION(msiof0),
- SH_PFC_FUNCTION(msiof1),
- SH_PFC_FUNCTION(msiof2),
-+ SH_PFC_FUNCTION(pwm0),
-+ SH_PFC_FUNCTION(pwm1),
-+ SH_PFC_FUNCTION(pwm2),
-+ SH_PFC_FUNCTION(pwm3),
-+ SH_PFC_FUNCTION(pwm4),
-+ SH_PFC_FUNCTION(pwm5),
-+ SH_PFC_FUNCTION(pwm6),
- SH_PFC_FUNCTION(qspi),
- SH_PFC_FUNCTION(scif0),
- SH_PFC_FUNCTION(scif1),
---
-2.6.2
-
diff --git a/patches.renesas/0245-pinctrl-Spelling-s-reseved-reserved.patch b/patches.renesas/0245-pinctrl-Spelling-s-reseved-reserved.patch
deleted file mode 100644
index 55aee1f5dd2892..00000000000000
--- a/patches.renesas/0245-pinctrl-Spelling-s-reseved-reserved.patch
+++ /dev/null
@@ -1,169 +0,0 @@
-From 0c448d5588d89d0b0dc3152c9cf672379a086599 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 21 May 2015 14:05:10 +0200
-Subject: [PATCH 245/326] pinctrl: Spelling s/reseved/reserved/
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 5b441eba3ab928ad1a2e9478fae6aa1397048860)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/nomadik/pinctrl-ab8505.c | 2 +-
- drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 38 ++++++++++++++++----------------
- 2 files changed, 20 insertions(+), 20 deletions(-)
-
-diff --git a/drivers/pinctrl/nomadik/pinctrl-ab8505.c b/drivers/pinctrl/nomadik/pinctrl-ab8505.c
-index bf0ef4ac376f..42c6e1f7886b 100644
---- a/drivers/pinctrl/nomadik/pinctrl-ab8505.c
-+++ b/drivers/pinctrl/nomadik/pinctrl-ab8505.c
-@@ -286,7 +286,7 @@ alternate_functions ab8505_alternate_functions[AB8505_GPIO_MAX_NUMBER + 1] = {
- ALTERNATE_FUNCTIONS(9, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO9, bit 0 reserved */
- ALTERNATE_FUNCTIONS(10, 1, 0, UNUSED, 1, 0, 0), /* GPIO10, altA and altB controlled by bit 0 */
- ALTERNATE_FUNCTIONS(11, 2, 1, UNUSED, 0, 0, 0), /* GPIO11, altA controlled by bit 2 */
-- ALTERNATE_FUNCTIONS(12, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO12, bit3 reseved */
-+ ALTERNATE_FUNCTIONS(12, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO12, bit3 reserved */
- ALTERNATE_FUNCTIONS(13, 4, 3, 4, 1, 0, 2), /* GPIO13, altA altB and altC controlled by bit 3 and 4 */
- ALTERNATE_FUNCTIONS(14, 5, UNUSED, UNUSED, 0, 0, 0), /* GPIO14, altA controlled by bit 5 */
- ALTERNATE_FUNCTIONS(15, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO15, bit 6 reserved */
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-index 6e9ed6fb087c..3ddf23ec9f0b 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-@@ -6125,7 +6125,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- { PINMUX_CFG_REG_VAR("MOD_SEL", 0xE6060090, 32,
- 1, 2, 2, 2, 3, 2, 1, 1, 1, 1,
- 3, 2, 2, 2, 1, 2, 2, 2) {
-- /* RESEVED [1] */
-+ /* RESERVED [1] */
- 0, 0,
- /* SEL_SCIF1 [2] */
- FN_SEL_SCIF1_0, FN_SEL_SCIF1_1, FN_SEL_SCIF1_2, FN_SEL_SCIF1_3,
-@@ -6152,11 +6152,11 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- FN_SEL_HSCIF1_0, FN_SEL_HSCIF1_1, FN_SEL_HSCIF1_2,
- FN_SEL_HSCIF1_3, FN_SEL_HSCIF1_4,
- 0, 0, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
- /* SEL_VI1 [2] */
- FN_SEL_VI1_0, FN_SEL_VI1_1, FN_SEL_VI1_2, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
- /* SEL_TMU [1] */
- FN_SEL_TMU1_0, FN_SEL_TMU1_1,
-@@ -6174,7 +6174,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- FN_SEL_SCIF0_0, FN_SEL_SCIF0_1, FN_SEL_SCIF0_2,
- FN_SEL_SCIF0_3, FN_SEL_SCIF0_4,
- 0, 0, 0,
-- /* RESEVED [1] */
-+ /* RESERVED [1] */
- 0, 0,
- /* SEL_SCIF [1] */
- FN_SEL_SCIF_0, FN_SEL_SCIF_1,
-@@ -6184,13 +6184,13 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- 0, 0,
- /* SEL_CAN1 [2] */
- FN_SEL_CAN1_0, FN_SEL_CAN1_1, FN_SEL_CAN1_2, FN_SEL_CAN1_3,
-- /* RESEVED [1] */
-+ /* RESERVED [1] */
- 0, 0,
- /* SEL_SCIFA2 [1] */
- FN_SEL_SCIFA2_0, FN_SEL_SCIFA2_1,
- /* SEL_SCIF4 [2] */
- FN_SEL_SCIF4_0, FN_SEL_SCIF4_1, FN_SEL_SCIF4_2, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
- /* SEL_ADG [1] */
- FN_SEL_ADG_0, FN_SEL_ADG_1,
-@@ -6200,7 +6200,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- 0, 0, 0,
- /* SEL_SCIFA5 [2] */
- FN_SEL_SCIFA5_0, FN_SEL_SCIFA5_1, FN_SEL_SCIFA5_2, 0,
-- /* RESEVED [1] */
-+ /* RESERVED [1] */
- 0, 0,
- /* SEL_GPS [2] */
- FN_SEL_GPS_0, FN_SEL_GPS_1, FN_SEL_GPS_2, FN_SEL_GPS_3,
-@@ -6210,7 +6210,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- FN_SEL_SCIFA3_0, FN_SEL_SCIFA3_1, FN_SEL_SCIFA3_2, 0,
- /* SEL_SIM [1] */
- FN_SEL_SIM_0, FN_SEL_SIM_1,
-- /* RESEVED [1] */
-+ /* RESERVED [1] */
- 0, 0,
- /* SEL_SSI8 [1] */
- FN_SEL_SSI8_0, FN_SEL_SSI8_1, }
-@@ -6240,7 +6240,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- FN_SEL_MMC_0, FN_SEL_MMC_1,
- /* SEL_SCIF5 [1] */
- FN_SEL_SCIF5_0, FN_SEL_SCIF5_1,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
- /* SEL_IIC2 [2] */
- FN_SEL_IIC2_0, FN_SEL_IIC2_1, FN_SEL_IIC2_2, FN_SEL_IIC2_3,
-@@ -6250,11 +6250,11 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- 0, 0, 0,
- /* SEL_IIC0 [2] */
- FN_SEL_IIC0_0, FN_SEL_IIC0_1, FN_SEL_IIC0_2, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
-- /* RESEVED [1] */
-+ /* RESERVED [1] */
- 0, 0, }
- },
- { PINMUX_CFG_REG_VAR("MOD_SEL4", 0xE606009C, 32,
-@@ -6268,7 +6268,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- FN_SEL_HSCIF0_0, FN_SEL_HSCIF0_1, FN_SEL_HSCIF0_2, 0,
- /* SEL_DIS [2] */
- FN_SEL_DIS_0, FN_SEL_DIS_1, FN_SEL_DIS_2, 0,
-- /* RESEVED [1] */
-+ /* RESERVED [1] */
- 0, 0,
- /* SEL_RAD [1] */
- FN_SEL_RAD_0, FN_SEL_RAD_1,
-@@ -6280,15 +6280,15 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- FN_SEL_SCIF2_0, FN_SEL_SCIF2_1, FN_SEL_SCIF2_2,
- FN_SEL_SCIF2_3, FN_SEL_SCIF2_4,
- 0, 0, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
- /* SEL_SOF2 [3] */
- FN_SEL_SOF2_0, FN_SEL_SOF2_1, FN_SEL_SOF2_2,
- FN_SEL_SOF2_3, FN_SEL_SOF2_4,
- 0, 0, 0,
-- /* RESEVED [1] */
-+ /* RESERVED [1] */
- 0, 0,
- /* SEL_SSI1 [1] */
- FN_SEL_SSI1_0, FN_SEL_SSI1_1,
-@@ -6296,11 +6296,11 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
- FN_SEL_SSI0_0, FN_SEL_SSI0_1,
- /* SEL_SSP [2] */
- FN_SEL_SSP_0, FN_SEL_SSP_1, FN_SEL_SSP_2, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0,
-- /* RESEVED [2] */
-+ /* RESERVED [2] */
- 0, 0, 0, 0, }
- },
- { },
---
-2.6.2
-
diff --git a/patches.renesas/0246-pinctrl-sh-pfc-add-R8A7794-PFC-support.patch b/patches.renesas/0246-pinctrl-sh-pfc-add-R8A7794-PFC-support.patch
deleted file mode 100644
index aa1331713956db..00000000000000
--- a/patches.renesas/0246-pinctrl-sh-pfc-add-R8A7794-PFC-support.patch
+++ /dev/null
@@ -1,4133 +0,0 @@
-From 68d94f21b84092bca9c33025fa0c0cc0cd751144 Mon Sep 17 00:00:00 2001
-From: Hisashi Nakamura <hisashi.nakamura.ak@renesas.com>
-Date: Sat, 6 Jun 2015 01:34:48 +0300
-Subject: [PATCH 246/326] pinctrl: sh-pfc: add R8A7794 PFC support
-
-Add PFC support for the R8A7794 SoC including pin groups for some
-on-chip devices such as ETH, I2C, INTC, MSIOF, QSPI, [H]SCIF...
-
-Sergei: squashed together several patches, fixed the MLB_CLK typo,
-added IRQ4.. IRQ9 pin groups, fixed IRQn comments, added ETH B pin
-group names, removed stray new line and fixed typos in the comments
-in the pinmux_config_regs[] initializer, removed the platform device
-ID, took into account limited number of signals in the GPIO1/5/6
-controllers, added reasonable and removed unreasonable
-copyrights, modified the bindings document, renamed, added changelog.
-
-Changes in version 5:
-- resolved rejects, refreshed the patch;
-- added Laurent Pinchart's ACK.
-
-Changes in version 4:
-- reused the PORT_GP_26() macro to #define PORT_GP_28().
-
-Changes in version 3:
-- removed the platform device ID;
-- added PORT_GP_26() and PORT_GP_28() macros, used them for GPIO1/5/6 in the
- CPU_ALL_PORT() macro.
-
-Changes in version 2:
-- rebased the patch.
-
-Signed-off-by: Hisashi Nakamura <hisashi.nakamura.ak@renesas.com>
-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 43c4436e2f1890a7b28dc0f0d901866cda99a08c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../bindings/pinctrl/renesas,pfc-pinctrl.txt | 1 +
- drivers/pinctrl/sh-pfc/Kconfig | 5 +
- drivers/pinctrl/sh-pfc/Makefile | 1 +
- drivers/pinctrl/sh-pfc/core.c | 6 +
- drivers/pinctrl/sh-pfc/core.h | 1 +
- drivers/pinctrl/sh-pfc/pfc-r8a7794.c | 4008 ++++++++++++++++++++
- 6 files changed, 4022 insertions(+)
- create mode 100644 drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-
-diff --git a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-index 6bcf851b6779..51cee44fc140 100644
---- a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-+++ b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-@@ -18,6 +18,7 @@ Required Properties:
- - "renesas,pfc-r8a7790": for R8A7790 (R-Car H2) compatible pin-controller.
- - "renesas,pfc-r8a7791": for R8A7791 (R-Car M2-W) compatible pin-controller.
- - "renesas,pfc-r8a7793": for R8A7793 (R-Car M2-N) compatible pin-controller.
-+ - "renesas,pfc-r8a7794": for R8A7794 (R-Car E2) compatible pin-controller.
- - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible pin-controller.
-
- - reg: Base address and length of each memory resource used by the pin
-diff --git a/drivers/pinctrl/sh-pfc/Kconfig b/drivers/pinctrl/sh-pfc/Kconfig
-index 5d570fdf6065..8e024c9c9115 100644
---- a/drivers/pinctrl/sh-pfc/Kconfig
-+++ b/drivers/pinctrl/sh-pfc/Kconfig
-@@ -60,6 +60,11 @@ config PINCTRL_PFC_R8A7793
- depends on ARCH_R8A7793
- select PINCTRL_SH_PFC
-
-+config PINCTRL_PFC_R8A7794
-+ def_bool y
-+ depends on ARCH_R8A7794
-+ select PINCTRL_SH_PFC
-+
- config PINCTRL_PFC_SH7203
- def_bool y
- depends on CPU_SUBTYPE_SH7203
-diff --git a/drivers/pinctrl/sh-pfc/Makefile b/drivers/pinctrl/sh-pfc/Makefile
-index 11eefcb71ec9..ea2a60ef122a 100644
---- a/drivers/pinctrl/sh-pfc/Makefile
-+++ b/drivers/pinctrl/sh-pfc/Makefile
-@@ -11,6 +11,7 @@ obj-$(CONFIG_PINCTRL_PFC_R8A7779) += pfc-r8a7779.o
- obj-$(CONFIG_PINCTRL_PFC_R8A7790) += pfc-r8a7790.o
- obj-$(CONFIG_PINCTRL_PFC_R8A7791) += pfc-r8a7791.o
- obj-$(CONFIG_PINCTRL_PFC_R8A7793) += pfc-r8a7791.o
-+obj-$(CONFIG_PINCTRL_PFC_R8A7794) += pfc-r8a7794.o
- obj-$(CONFIG_PINCTRL_PFC_SH7203) += pfc-sh7203.o
- obj-$(CONFIG_PINCTRL_PFC_SH7264) += pfc-sh7264.o
- obj-$(CONFIG_PINCTRL_PFC_SH7269) += pfc-sh7269.o
-diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
-index 96556362b28f..865d235612c5 100644
---- a/drivers/pinctrl/sh-pfc/core.c
-+++ b/drivers/pinctrl/sh-pfc/core.c
-@@ -487,6 +487,12 @@ static const struct of_device_id sh_pfc_of_table[] = {
- .data = &r8a7793_pinmux_info,
- },
- #endif
-+#ifdef CONFIG_PINCTRL_PFC_R8A7794
-+ {
-+ .compatible = "renesas,pfc-r8a7794",
-+ .data = &r8a7794_pinmux_info,
-+ },
-+#endif
- #ifdef CONFIG_PINCTRL_PFC_SH73A0
- {
- .compatible = "renesas,pfc-sh73a0",
-diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
-index b151b771e876..4c3c37bf7161 100644
---- a/drivers/pinctrl/sh-pfc/core.h
-+++ b/drivers/pinctrl/sh-pfc/core.h
-@@ -72,6 +72,7 @@ extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
- extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
- extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
- extern const struct sh_pfc_soc_info r8a7793_pinmux_info;
-+extern const struct sh_pfc_soc_info r8a7794_pinmux_info;
- extern const struct sh_pfc_soc_info sh7203_pinmux_info;
- extern const struct sh_pfc_soc_info sh7264_pinmux_info;
- extern const struct sh_pfc_soc_info sh7269_pinmux_info;
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-new file mode 100644
-index 000000000000..0e2686a2093c
---- /dev/null
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-@@ -0,0 +1,4008 @@
-+/*
-+ * r8a7794 processor support - PFC hardware block.
-+ *
-+ * Copyright (C) 2014 Renesas Electronics Corporation
-+ * Copyright (C) 2015 Renesas Solutions Corp.
-+ * Copyright (C) 2015 Cogent Embedded, Inc., <source@cogentembedded.com>
-+ *
-+ * 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/kernel.h>
-+#include <linux/platform_data/gpio-rcar.h>
-+
-+#include "core.h"
-+#include "sh_pfc.h"
-+
-+#define PORT_GP_26(bank, fn, sfx) \
-+ PORT_GP_1(bank, 0, fn, sfx), PORT_GP_1(bank, 1, fn, sfx), \
-+ PORT_GP_1(bank, 2, fn, sfx), PORT_GP_1(bank, 3, fn, sfx), \
-+ PORT_GP_1(bank, 4, fn, sfx), PORT_GP_1(bank, 5, fn, sfx), \
-+ PORT_GP_1(bank, 6, fn, sfx), PORT_GP_1(bank, 7, fn, sfx), \
-+ PORT_GP_1(bank, 8, fn, sfx), PORT_GP_1(bank, 9, fn, sfx), \
-+ PORT_GP_1(bank, 10, fn, sfx), PORT_GP_1(bank, 11, fn, sfx), \
-+ PORT_GP_1(bank, 12, fn, sfx), PORT_GP_1(bank, 13, fn, sfx), \
-+ PORT_GP_1(bank, 14, fn, sfx), PORT_GP_1(bank, 15, fn, sfx), \
-+ PORT_GP_1(bank, 16, fn, sfx), PORT_GP_1(bank, 17, fn, sfx), \
-+ PORT_GP_1(bank, 18, fn, sfx), PORT_GP_1(bank, 19, fn, sfx), \
-+ PORT_GP_1(bank, 20, fn, sfx), PORT_GP_1(bank, 21, fn, sfx), \
-+ PORT_GP_1(bank, 22, fn, sfx), PORT_GP_1(bank, 23, fn, sfx), \
-+ PORT_GP_1(bank, 24, fn, sfx), PORT_GP_1(bank, 25, fn, sfx)
-+
-+#define PORT_GP_28(bank, fn, sfx) \
-+ PORT_GP_26(bank, fn, sfx), \
-+ PORT_GP_1(bank, 26, fn, sfx), PORT_GP_1(bank, 27, fn, sfx)
-+
-+#define CPU_ALL_PORT(fn, sfx) \
-+ PORT_GP_32(0, fn, sfx), \
-+ PORT_GP_26(1, fn, sfx), \
-+ PORT_GP_32(2, fn, sfx), \
-+ PORT_GP_32(3, fn, sfx), \
-+ PORT_GP_32(4, fn, sfx), \
-+ PORT_GP_28(5, fn, sfx), \
-+ PORT_GP_26(6, fn, sfx)
-+
-+enum {
-+ PINMUX_RESERVED = 0,
-+
-+ PINMUX_DATA_BEGIN,
-+ GP_ALL(DATA),
-+ PINMUX_DATA_END,
-+
-+ PINMUX_FUNCTION_BEGIN,
-+ GP_ALL(FN),
-+
-+ /* GPSR0 */
-+ FN_IP0_23_22, FN_IP0_24, FN_IP0_25, FN_IP0_27_26, FN_IP0_29_28,
-+ FN_IP0_31_30, FN_IP1_1_0, FN_IP1_3_2, FN_IP1_5_4, FN_IP1_7_6,
-+ FN_IP1_10_8, FN_IP1_12_11, FN_IP1_14_13, FN_IP1_17_15, FN_IP1_19_18,
-+ FN_IP1_21_20, FN_IP1_23_22, FN_IP1_24, FN_A2, FN_IP1_26, FN_IP1_27,
-+ FN_IP1_29_28, FN_IP1_31_30, FN_IP2_1_0, FN_IP2_3_2, FN_IP2_5_4,
-+ FN_IP2_7_6, FN_IP2_9_8, FN_IP2_11_10, FN_IP2_13_12, FN_IP2_15_14,
-+ FN_IP2_17_16,
-+
-+ /* GPSR1 */
-+ FN_IP2_20_18, FN_IP2_23_21, FN_IP2_26_24, FN_IP2_29_27, FN_IP2_31_30,
-+ FN_IP3_1_0, FN_IP3_3_2, FN_IP3_5_4, FN_IP3_7_6, FN_IP3_9_8, FN_IP3_10,
-+ FN_IP3_11, FN_IP3_12, FN_IP3_14_13, FN_IP3_17_15, FN_IP3_20_18,
-+ FN_IP3_23_21, FN_IP3_26_24, FN_IP3_29_27, FN_IP3_30, FN_IP3_31,
-+ FN_WE0_N, FN_WE1_N, FN_IP4_1_0 , FN_IP7_31, FN_DACK0,
-+
-+ /* GPSR2 */
-+ FN_IP4_4_2, FN_IP4_7_5, FN_IP4_9_8, FN_IP4_11_10, FN_IP4_13_12,
-+ FN_IP4_15_14, FN_IP4_17_16, FN_IP4_19_18, FN_IP4_22_20, FN_IP4_25_23,
-+ FN_IP4_27_26, FN_IP4_29_28, FN_IP4_31_30, FN_IP5_1_0, FN_IP5_3_2,
-+ FN_IP5_5_4, FN_IP5_8_6, FN_IP5_11_9, FN_IP5_13_12, FN_IP5_15_14,
-+ FN_IP5_17_16, FN_IP5_19_18, FN_IP5_21_20, FN_IP5_23_22, FN_IP5_25_24,
-+ FN_IP5_27_26, FN_IP5_29_28, FN_IP5_31_30, FN_IP6_1_0, FN_IP6_3_2,
-+ FN_IP6_5_4, FN_IP6_7_6,
-+
-+ /* GPSR3 */
-+ FN_IP6_8, FN_IP6_9, FN_IP6_10, FN_IP6_11, FN_IP6_12, FN_IP6_13,
-+ FN_IP6_14, FN_IP6_15, FN_IP6_16, FN_IP6_19_17, FN_IP6_22_20,
-+ FN_IP6_25_23, FN_IP6_28_26, FN_IP6_31_29, FN_IP7_2_0, FN_IP7_5_3,
-+ FN_IP7_8_6, FN_IP7_11_9, FN_IP7_14_12, FN_IP7_17_15, FN_IP7_20_18,
-+ FN_IP7_23_21, FN_IP7_26_24, FN_IP7_29_27, FN_IP8_2_0, FN_IP8_5_3,
-+ FN_IP8_8_6, FN_IP8_11_9, FN_IP8_14_12, FN_IP8_16_15, FN_IP8_19_17,
-+ FN_IP8_22_20,
-+
-+ /* GPSR4 */
-+ FN_IP8_25_23, FN_IP8_28_26, FN_IP8_31_29, FN_IP9_2_0, FN_IP9_5_3,
-+ FN_IP9_8_6, FN_IP9_11_9, FN_IP9_14_12, FN_IP9_16_15, FN_IP9_18_17,
-+ FN_IP9_21_19, FN_IP9_24_22, FN_IP9_27_25, FN_IP9_30_28, FN_IP10_2_0,
-+ FN_IP10_5_3, FN_IP10_8_6, FN_IP10_11_9, FN_IP10_14_12, FN_IP10_17_15,
-+ FN_IP10_20_18, FN_IP10_23_21, FN_IP10_26_24, FN_IP10_29_27,
-+ FN_IP10_31_30, FN_IP11_2_0, FN_IP11_5_3, FN_IP11_7_6, FN_IP11_10_8,
-+ FN_IP11_13_11, FN_IP11_15_14, FN_IP11_17_16,
-+
-+ /* GPSR5 */
-+ FN_IP11_20_18, FN_IP11_23_21, FN_IP11_26_24, FN_IP11_29_27, FN_IP12_2_0,
-+ FN_IP12_5_3, FN_IP12_8_6, FN_IP12_10_9, FN_IP12_12_11, FN_IP12_14_13,
-+ FN_IP12_17_15, FN_IP12_20_18, FN_IP12_23_21, FN_IP12_26_24,
-+ FN_IP12_29_27, FN_IP13_2_0, FN_IP13_5_3, FN_IP13_8_6, FN_IP13_11_9,
-+ FN_IP13_14_12, FN_IP13_17_15, FN_IP13_20_18, FN_IP13_23_21,
-+ FN_IP13_26_24, FN_USB0_PWEN, FN_USB0_OVC, FN_USB1_PWEN, FN_USB1_OVC,
-+
-+ /* GPSR6 */
-+ FN_SD0_CLK, FN_SD0_CMD, FN_SD0_DATA0, FN_SD0_DATA1, FN_SD0_DATA2,
-+ FN_SD0_DATA3, FN_SD0_CD, FN_SD0_WP, FN_SD1_CLK, FN_SD1_CMD,
-+ FN_SD1_DATA0, FN_SD1_DATA1, FN_SD1_DATA2, FN_SD1_DATA3, FN_IP0_0,
-+ FN_IP0_9_8, FN_IP0_10, FN_IP0_11, FN_IP0_12, FN_IP0_13, FN_IP0_14,
-+ FN_IP0_15, FN_IP0_16, FN_IP0_17, FN_IP0_19_18, FN_IP0_21_20,
-+
-+ /* IPSR0 */
-+ FN_SD1_CD, FN_CAN0_RX, FN_SD1_WP, FN_IRQ7, FN_CAN0_TX, FN_MMC_CLK,
-+ FN_SD2_CLK, FN_MMC_CMD, FN_SD2_CMD, FN_MMC_D0, FN_SD2_DATA0, FN_MMC_D1,
-+ FN_SD2_DATA1, FN_MMC_D2, FN_SD2_DATA2, FN_MMC_D3, FN_SD2_DATA3,
-+ FN_MMC_D4, FN_SD2_CD, FN_MMC_D5, FN_SD2_WP, FN_MMC_D6, FN_SCIF0_RXD,
-+ FN_I2C2_SCL_B, FN_CAN1_RX, FN_MMC_D7, FN_SCIF0_TXD, FN_I2C2_SDA_B,
-+ FN_CAN1_TX, FN_D0, FN_SCIFA3_SCK_B, FN_IRQ4, FN_D1, FN_SCIFA3_RXD_B,
-+ FN_D2, FN_SCIFA3_TXD_B, FN_D3, FN_I2C3_SCL_B, FN_SCIF5_RXD_B, FN_D4,
-+ FN_I2C3_SDA_B, FN_SCIF5_TXD_B, FN_D5, FN_SCIF4_RXD_B, FN_I2C0_SCL_D,
-+
-+ /* IPSR1 */
-+ FN_D6, FN_SCIF4_TXD_B, FN_I2C0_SDA_D, FN_D7, FN_IRQ3, FN_TCLK1,
-+ FN_PWM6_B, FN_D8, FN_HSCIF2_HRX, FN_I2C1_SCL_B, FN_D9, FN_HSCIF2_HTX,
-+ FN_I2C1_SDA_B, FN_D10, FN_HSCIF2_HSCK, FN_SCIF1_SCK_C, FN_IRQ6,
-+ FN_PWM5_C, FN_D11, FN_HSCIF2_HCTS_N, FN_SCIF1_RXD_C, FN_I2C1_SCL_D,
-+ FN_D12, FN_HSCIF2_HRTS_N, FN_SCIF1_TXD_C, FN_I2C1_SDA_D, FN_D13,
-+ FN_SCIFA1_SCK, FN_TANS1, FN_PWM2_C, FN_TCLK2_B, FN_D14, FN_SCIFA1_RXD,
-+ FN_IIC0_SCL_B, FN_D15, FN_SCIFA1_TXD, FN_IIC0_SDA_B, FN_A0,
-+ FN_SCIFB1_SCK, FN_PWM3_B, FN_A1, FN_SCIFB1_TXD, FN_A3, FN_SCIFB0_SCK,
-+ FN_A4, FN_SCIFB0_TXD, FN_A5, FN_SCIFB0_RXD, FN_PWM4_B, FN_TPUTO3_C,
-+ FN_A6, FN_SCIFB0_CTS_N, FN_SCIFA4_RXD_B, FN_TPUTO2_C,
-+
-+ /* IPSR2 */
-+ FN_A7, FN_SCIFB0_RTS_N, FN_SCIFA4_TXD_B, FN_A8, FN_MSIOF1_RXD,
-+ FN_SCIFA0_RXD_B, FN_A9, FN_MSIOF1_TXD, FN_SCIFA0_TXD_B, FN_A10,
-+ FN_MSIOF1_SCK, FN_IIC1_SCL_B, FN_A11, FN_MSIOF1_SYNC, FN_IIC1_SDA_B,
-+ FN_A12, FN_MSIOF1_SS1, FN_SCIFA5_RXD_B, FN_A13, FN_MSIOF1_SS2,
-+ FN_SCIFA5_TXD_B, FN_A14, FN_MSIOF2_RXD, FN_HSCIF0_HRX_B, FN_DREQ1_N,
-+ FN_A15, FN_MSIOF2_TXD, FN_HSCIF0_HTX_B, FN_DACK1, FN_A16,
-+ FN_MSIOF2_SCK, FN_HSCIF0_HSCK_B, FN_SPEEDIN, FN_VSP, FN_CAN_CLK_C,
-+ FN_TPUTO2_B, FN_A17, FN_MSIOF2_SYNC, FN_SCIF4_RXD_E, FN_CAN1_RX_B,
-+ FN_AVB_AVTP_CAPTURE_B, FN_A18, FN_MSIOF2_SS1, FN_SCIF4_TXD_E,
-+ FN_CAN1_TX_B, FN_AVB_AVTP_MATCH_B, FN_A19, FN_MSIOF2_SS2, FN_PWM4,
-+ FN_TPUTO2, FN_MOUT0, FN_A20, FN_SPCLK, FN_MOUT1,
-+
-+ /* IPSR3 */
-+ FN_A21, FN_MOSI_IO0, FN_MOUT2, FN_A22, FN_MISO_IO1, FN_MOUT5,
-+ FN_ATADIR1_N, FN_A23, FN_IO2, FN_MOUT6, FN_ATAWR1_N, FN_A24, FN_IO3,
-+ FN_EX_WAIT2, FN_A25, FN_SSL, FN_ATARD1_N, FN_CS0_N, FN_VI1_DATA8,
-+ FN_CS1_N_A26, FN_VI1_DATA9, FN_EX_CS0_N, FN_VI1_DATA10, FN_EX_CS1_N,
-+ FN_TPUTO3_B, FN_SCIFB2_RXD, FN_VI1_DATA11, FN_EX_CS2_N, FN_PWM0,
-+ FN_SCIF4_RXD_C, FN_TS_SDATA_B, FN_RIF0_SYNC, FN_TPUTO3, FN_SCIFB2_TXD,
-+ FN_SDATA_B, FN_EX_CS3_N, FN_SCIFA2_SCK, FN_SCIF4_TXD_C, FN_TS_SCK_B,
-+ FN_RIF0_CLK, FN_BPFCLK, FN_SCIFB2_SCK, FN_MDATA_B, FN_EX_CS4_N,
-+ FN_SCIFA2_RXD, FN_I2C2_SCL_E, FN_TS_SDEN_B, FN_RIF0_D0, FN_FMCLK,
-+ FN_SCIFB2_CTS_N, FN_SCKZ_B, FN_EX_CS5_N, FN_SCIFA2_TXD, FN_I2C2_SDA_E,
-+ FN_TS_SPSYNC_B, FN_RIF0_D1, FN_FMIN, FN_SCIFB2_RTS_N, FN_STM_N_B,
-+ FN_BS_N, FN_DRACK0, FN_PWM1_C, FN_TPUTO0_C, FN_ATACS01_N, FN_MTS_N_B,
-+ FN_RD_N, FN_ATACS11_N, FN_RD_WR_N, FN_ATAG1_N,
-+
-+ /* IPSR4 */
-+ FN_EX_WAIT0, FN_CAN_CLK_B, FN_SCIF_CLK, FN_PWMFSW0, FN_DU0_DR0,
-+ FN_LCDOUT16, FN_SCIF5_RXD_C, FN_I2C2_SCL_D, FN_CC50_STATE0,
-+ FN_DU0_DR1, FN_LCDOUT17, FN_SCIF5_TXD_C, FN_I2C2_SDA_D, FN_CC50_STATE1,
-+ FN_DU0_DR2, FN_LCDOUT18, FN_CC50_STATE2, FN_DU0_DR3, FN_LCDOUT19,
-+ FN_CC50_STATE3, FN_DU0_DR4, FN_LCDOUT20, FN_CC50_STATE4, FN_DU0_DR5,
-+ FN_LCDOUT21, FN_CC50_STATE5, FN_DU0_DR6, FN_LCDOUT22, FN_CC50_STATE6,
-+ FN_DU0_DR7, FN_LCDOUT23, FN_CC50_STATE7, FN_DU0_DG0, FN_LCDOUT8,
-+ FN_SCIFA0_RXD_C, FN_I2C3_SCL_D, FN_CC50_STATE8, FN_DU0_DG1, FN_LCDOUT9,
-+ FN_SCIFA0_TXD_C, FN_I2C3_SDA_D, FN_CC50_STATE9, FN_DU0_DG2, FN_LCDOUT10,
-+ FN_CC50_STATE10, FN_DU0_DG3, FN_LCDOUT11, FN_CC50_STATE11, FN_DU0_DG4,
-+ FN_LCDOUT12, FN_CC50_STATE12,
-+
-+ /* IPSR5 */
-+ FN_DU0_DG5, FN_LCDOUT13, FN_CC50_STATE13, FN_DU0_DG6, FN_LCDOUT14,
-+ FN_CC50_STATE14, FN_DU0_DG7, FN_LCDOUT15, FN_CC50_STATE15, FN_DU0_DB0,
-+ FN_LCDOUT0, FN_SCIFA4_RXD_C, FN_I2C4_SCL_D, FN_CAN0_RX_C,
-+ FN_CC50_STATE16, FN_DU0_DB1, FN_LCDOUT1, FN_SCIFA4_TXD_C, FN_I2C4_SDA_D,
-+ FN_CAN0_TX_C, FN_CC50_STATE17, FN_DU0_DB2, FN_LCDOUT2, FN_CC50_STATE18,
-+ FN_DU0_DB3, FN_LCDOUT3, FN_CC50_STATE19, FN_DU0_DB4, FN_LCDOUT4,
-+ FN_CC50_STATE20, FN_DU0_DB5, FN_LCDOUT5, FN_CC50_STATE21, FN_DU0_DB6,
-+ FN_LCDOUT6, FN_CC50_STATE22, FN_DU0_DB7, FN_LCDOUT7, FN_CC50_STATE23,
-+ FN_DU0_DOTCLKIN, FN_QSTVA_QVS, FN_CC50_STATE24, FN_DU0_DOTCLKOUT0,
-+ FN_QCLK, FN_CC50_STATE25, FN_DU0_DOTCLKOUT1, FN_QSTVB_QVE,
-+ FN_CC50_STATE26, FN_DU0_EXHSYNC_DU0_HSYNC, FN_QSTH_QHS, FN_CC50_STATE27,
-+
-+ /* IPSR6 */
-+ FN_DU0_EXVSYNC_DU0_VSYNC, FN_QSTB_QHE, FN_CC50_STATE28,
-+ FN_DU0_EXODDF_DU0_ODDF_DISP_CDE, FN_QCPV_QDE, FN_CC50_STATE29,
-+ FN_DU0_DISP, FN_QPOLA, FN_CC50_STATE30, FN_DU0_CDE, FN_QPOLB,
-+ FN_CC50_STATE31, FN_VI0_CLK, FN_AVB_RX_CLK, FN_VI0_DATA0_VI0_B0,
-+ FN_AVB_RX_DV, FN_VI0_DATA1_VI0_B1, FN_AVB_RXD0, FN_VI0_DATA2_VI0_B2,
-+ FN_AVB_RXD1, FN_VI0_DATA3_VI0_B3, FN_AVB_RXD2, FN_VI0_DATA4_VI0_B4,
-+ FN_AVB_RXD3, FN_VI0_DATA5_VI0_B5, FN_AVB_RXD4, FN_VI0_DATA6_VI0_B6,
-+ FN_AVB_RXD5, FN_VI0_DATA7_VI0_B7, FN_AVB_RXD6, FN_VI0_CLKENB,
-+ FN_I2C3_SCL, FN_SCIFA5_RXD_C, FN_IETX_C, FN_AVB_RXD7, FN_VI0_FIELD,
-+ FN_I2C3_SDA, FN_SCIFA5_TXD_C, FN_IECLK_C, FN_AVB_RX_ER, FN_VI0_HSYNC_N,
-+ FN_SCIF0_RXD_B, FN_I2C0_SCL_C, FN_IERX_C, FN_AVB_COL, FN_VI0_VSYNC_N,
-+ FN_SCIF0_TXD_B, FN_I2C0_SDA_C, FN_AUDIO_CLKOUT_B, FN_AVB_TX_EN,
-+ FN_ETH_MDIO, FN_VI0_G0, FN_MSIOF2_RXD_B, FN_IIC0_SCL_D, FN_AVB_TX_CLK,
-+ FN_ADIDATA, FN_AD_DI,
-+
-+ /* IPSR7 */
-+ FN_ETH_CRS_DV, FN_VI0_G1, FN_MSIOF2_TXD_B, FN_IIC0_SDA_D, FN_AVB_TXD0,
-+ FN_ADICS_SAMP, FN_AD_DO, FN_ETH_RX_ER, FN_VI0_G2, FN_MSIOF2_SCK_B,
-+ FN_CAN0_RX_B, FN_AVB_TXD1, FN_ADICLK, FN_AD_CLK, FN_ETH_RXD0, FN_VI0_G3,
-+ FN_MSIOF2_SYNC_B, FN_CAN0_TX_B, FN_AVB_TXD2, FN_ADICHS0, FN_AD_NCS_N,
-+ FN_ETH_RXD1, FN_VI0_G4, FN_MSIOF2_SS1_B, FN_SCIF4_RXD_D, FN_AVB_TXD3,
-+ FN_ADICHS1, FN_ETH_LINK, FN_VI0_G5, FN_MSIOF2_SS2_B, FN_SCIF4_TXD_D,
-+ FN_AVB_TXD4, FN_ADICHS2, FN_ETH_REFCLK, FN_VI0_G6, FN_SCIF2_SCK_C,
-+ FN_AVB_TXD5, FN_SSI_SCK5_B, FN_ETH_TXD1, FN_VI0_G7, FN_SCIF2_RXD_C,
-+ FN_IIC1_SCL_D, FN_AVB_TXD6, FN_SSI_WS5_B, FN_ETH_TX_EN, FN_VI0_R0,
-+ FN_SCIF2_TXD_C, FN_IIC1_SDA_D, FN_AVB_TXD7, FN_SSI_SDATA5_B,
-+ FN_ETH_MAGIC, FN_VI0_R1, FN_SCIF3_SCK_B, FN_AVB_TX_ER, FN_SSI_SCK6_B,
-+ FN_ETH_TXD0, FN_VI0_R2, FN_SCIF3_RXD_B, FN_I2C4_SCL_E, FN_AVB_GTX_CLK,
-+ FN_SSI_WS6_B, FN_DREQ0_N, FN_SCIFB1_RXD,
-+
-+ /* IPSR8 */
-+ FN_ETH_MDC, FN_VI0_R3, FN_SCIF3_TXD_B, FN_I2C4_SDA_E, FN_AVB_MDC,
-+ FN_SSI_SDATA6_B, FN_HSCIF0_HRX, FN_VI0_R4, FN_I2C1_SCL_C,
-+ FN_AUDIO_CLKA_B, FN_AVB_MDIO, FN_SSI_SCK78_B, FN_HSCIF0_HTX,
-+ FN_VI0_R5, FN_I2C1_SDA_C, FN_AUDIO_CLKB_B, FN_AVB_LINK, FN_SSI_WS78_B,
-+ FN_HSCIF0_HCTS_N, FN_VI0_R6, FN_SCIF0_RXD_D, FN_I2C0_SCL_E,
-+ FN_AVB_MAGIC, FN_SSI_SDATA7_B, FN_HSCIF0_HRTS_N, FN_VI0_R7,
-+ FN_SCIF0_TXD_D, FN_I2C0_SDA_E, FN_AVB_PHY_INT, FN_SSI_SDATA8_B,
-+ FN_HSCIF0_HSCK, FN_SCIF_CLK_B, FN_AVB_CRS, FN_AUDIO_CLKC_B,
-+ FN_I2C0_SCL, FN_SCIF0_RXD_C, FN_PWM5, FN_TCLK1_B, FN_AVB_GTXREFCLK,
-+ FN_CAN1_RX_D, FN_TPUTO0_B, FN_I2C0_SDA, FN_SCIF0_TXD_C, FN_TPUTO0,
-+ FN_CAN_CLK, FN_DVC_MUTE, FN_CAN1_TX_D, FN_I2C1_SCL, FN_SCIF4_RXD,
-+ FN_PWM5_B, FN_DU1_DR0, FN_RIF1_SYNC_B, FN_TS_SDATA_D, FN_TPUTO1_B,
-+ FN_I2C1_SDA, FN_SCIF4_TXD, FN_IRQ5, FN_DU1_DR1, FN_RIF1_CLK_B,
-+ FN_TS_SCK_D, FN_BPFCLK_C, FN_MSIOF0_RXD, FN_SCIF5_RXD, FN_I2C2_SCL_C,
-+ FN_DU1_DR2, FN_RIF1_D0_B, FN_TS_SDEN_D, FN_FMCLK_C, FN_RDS_CLK,
-+
-+ /* IPSR9 */
-+ FN_MSIOF0_TXD, FN_SCIF5_TXD, FN_I2C2_SDA_C, FN_DU1_DR3, FN_RIF1_D1_B,
-+ FN_TS_SPSYNC_D, FN_FMIN_C, FN_RDS_DATA, FN_MSIOF0_SCK, FN_IRQ0,
-+ FN_TS_SDATA, FN_DU1_DR4, FN_RIF1_SYNC, FN_TPUTO1_C, FN_MSIOF0_SYNC,
-+ FN_PWM1, FN_TS_SCK, FN_DU1_DR5, FN_RIF1_CLK, FN_BPFCLK_B, FN_MSIOF0_SS1,
-+ FN_SCIFA0_RXD, FN_TS_SDEN, FN_DU1_DR6, FN_RIF1_D0, FN_FMCLK_B,
-+ FN_RDS_CLK_B, FN_MSIOF0_SS2, FN_SCIFA0_TXD, FN_TS_SPSYNC, FN_DU1_DR7,
-+ FN_RIF1_D1, FN_FMIN_B, FN_RDS_DATA_B, FN_HSCIF1_HRX, FN_I2C4_SCL,
-+ FN_PWM6, FN_DU1_DG0, FN_HSCIF1_HTX, FN_I2C4_SDA, FN_TPUTO1, FN_DU1_DG1,
-+ FN_HSCIF1_HSCK, FN_PWM2, FN_IETX, FN_DU1_DG2, FN_REMOCON_B,
-+ FN_SPEEDIN_B, FN_VSP_B, FN_HSCIF1_HCTS_N, FN_SCIFA4_RXD, FN_IECLK,
-+ FN_DU1_DG3, FN_SSI_SCK1_B, FN_CAN_DEBUG_HW_TRIGGER, FN_CC50_STATE32,
-+ FN_HSCIF1_HRTS_N, FN_SCIFA4_TXD, FN_IERX, FN_DU1_DG4, FN_SSI_WS1_B,
-+ FN_CAN_STEP0, FN_CC50_STATE33, FN_SCIF1_SCK, FN_PWM3, FN_TCLK2,
-+ FN_DU1_DG5, FN_SSI_SDATA1_B, FN_CAN_TXCLK, FN_CC50_STATE34,
-+
-+ /* IPSR10 */
-+ FN_SCIF1_RXD, FN_IIC0_SCL, FN_DU1_DG6, FN_SSI_SCK2_B, FN_CAN_DEBUGOUT0,
-+ FN_CC50_STATE35, FN_SCIF1_TXD, FN_IIC0_SDA, FN_DU1_DG7, FN_SSI_WS2_B,
-+ FN_CAN_DEBUGOUT1, FN_CC50_STATE36, FN_SCIF2_RXD, FN_IIC1_SCL,
-+ FN_DU1_DB0, FN_SSI_SDATA2_B, FN_USB0_EXTLP, FN_CAN_DEBUGOUT2,
-+ FN_CC50_STATE37, FN_SCIF2_TXD, FN_IIC1_SDA, FN_DU1_DB1, FN_SSI_SCK9_B,
-+ FN_USB0_OVC1, FN_CAN_DEBUGOUT3, FN_CC50_STATE38, FN_SCIF2_SCK, FN_IRQ1,
-+ FN_DU1_DB2, FN_SSI_WS9_B, FN_USB0_IDIN, FN_CAN_DEBUGOUT4,
-+ FN_CC50_STATE39, FN_SCIF3_SCK, FN_IRQ2, FN_BPFCLK_D, FN_DU1_DB3,
-+ FN_SSI_SDATA9_B, FN_TANS2, FN_CAN_DEBUGOUT5, FN_CC50_OSCOUT,
-+ FN_SCIF3_RXD, FN_I2C1_SCL_E, FN_FMCLK_D, FN_DU1_DB4, FN_AUDIO_CLKA_C,
-+ FN_SSI_SCK4_B, FN_CAN_DEBUGOUT6, FN_RDS_CLK_C, FN_SCIF3_TXD,
-+ FN_I2C1_SDA_E, FN_FMIN_D, FN_DU1_DB5, FN_AUDIO_CLKB_C, FN_SSI_WS4_B,
-+ FN_CAN_DEBUGOUT7, FN_RDS_DATA_C, FN_I2C2_SCL, FN_SCIFA5_RXD, FN_DU1_DB6,
-+ FN_AUDIO_CLKC_C, FN_SSI_SDATA4_B, FN_CAN_DEBUGOUT8, FN_I2C2_SDA,
-+ FN_SCIFA5_TXD, FN_DU1_DB7, FN_AUDIO_CLKOUT_C, FN_CAN_DEBUGOUT9,
-+ FN_SSI_SCK5, FN_SCIFA3_SCK, FN_DU1_DOTCLKIN, FN_CAN_DEBUGOUT10,
-+
-+ /* IPSR11 */
-+ FN_SSI_WS5, FN_SCIFA3_RXD, FN_I2C3_SCL_C, FN_DU1_DOTCLKOUT0,
-+ FN_CAN_DEBUGOUT11, FN_SSI_SDATA5, FN_SCIFA3_TXD, FN_I2C3_SDA_C,
-+ FN_DU1_DOTCLKOUT1, FN_CAN_DEBUGOUT12, FN_SSI_SCK6, FN_SCIFA1_SCK_B,
-+ FN_DU1_EXHSYNC_DU1_HSYNC, FN_CAN_DEBUGOUT13, FN_SSI_WS6,
-+ FN_SCIFA1_RXD_B, FN_I2C4_SCL_C, FN_DU1_EXVSYNC_DU1_VSYNC,
-+ FN_CAN_DEBUGOUT14, FN_SSI_SDATA6, FN_SCIFA1_TXD_B, FN_I2C4_SDA_C,
-+ FN_DU1_EXODDF_DU1_ODDF_DISP_CDE, FN_CAN_DEBUGOUT15, FN_SSI_SCK78,
-+ FN_SCIFA2_SCK_B, FN_IIC0_SDA_C, FN_DU1_DISP, FN_SSI_WS78,
-+ FN_SCIFA2_RXD_B, FN_IIC0_SCL_C, FN_DU1_CDE, FN_SSI_SDATA7,
-+ FN_SCIFA2_TXD_B, FN_IRQ8, FN_AUDIO_CLKA_D, FN_CAN_CLK_D, FN_PCMOE_N,
-+ FN_SSI_SCK0129, FN_MSIOF1_RXD_B, FN_SCIF5_RXD_D, FN_ADIDATA_B,
-+ FN_AD_DI_B, FN_PCMWE_N, FN_SSI_WS0129, FN_MSIOF1_TXD_B, FN_SCIF5_TXD_D,
-+ FN_ADICS_SAMP_B, FN_AD_DO_B, FN_SSI_SDATA0, FN_MSIOF1_SCK_B, FN_PWM0_B,
-+ FN_ADICLK_B, FN_AD_CLK_B,
-+
-+ /* IPSR12 */
-+ FN_SSI_SCK34, FN_MSIOF1_SYNC_B, FN_SCIFA1_SCK_C, FN_ADICHS0_B,
-+ FN_AD_NCS_N_B, FN_DREQ1_N_B, FN_SSI_WS34, FN_MSIOF1_SS1_B,
-+ FN_SCIFA1_RXD_C, FN_ADICHS1_B, FN_CAN1_RX_C, FN_DACK1_B, FN_SSI_SDATA3,
-+ FN_MSIOF1_SS2_B, FN_SCIFA1_TXD_C, FN_ADICHS2_B, FN_CAN1_TX_C,
-+ FN_DREQ2_N, FN_SSI_SCK4, FN_MLB_CLK, FN_IETX_B, FN_IRD_TX, FN_SSI_WS4,
-+ FN_MLB_SIG, FN_IECLK_B, FN_IRD_RX, FN_SSI_SDATA4, FN_MLB_DAT,
-+ FN_IERX_B, FN_IRD_SCK, FN_SSI_SDATA8, FN_SCIF1_SCK_B,
-+ FN_PWM1_B, FN_IRQ9, FN_REMOCON, FN_DACK2, FN_ETH_MDIO_B, FN_SSI_SCK1,
-+ FN_SCIF1_RXD_B, FN_IIC1_SCL_C, FN_VI1_CLK, FN_CAN0_RX_D,
-+ FN_AVB_AVTP_CAPTURE, FN_ETH_CRS_DV_B, FN_SSI_WS1, FN_SCIF1_TXD_B,
-+ FN_IIC1_SDA_C, FN_VI1_DATA0, FN_CAN0_TX_D, FN_AVB_AVTP_MATCH,
-+ FN_ETH_RX_ER_B, FN_SSI_SDATA1, FN_HSCIF1_HRX_B, FN_SDATA, FN_VI1_DATA1,
-+ FN_ATAG0_N, FN_ETH_RXD0_B, FN_SSI_SCK2, FN_HSCIF1_HTX_B, FN_VI1_DATA2,
-+ FN_MDATA, FN_ATAWR0_N, FN_ETH_RXD1_B,
-+
-+ /* IPSR13 */
-+ FN_SSI_WS2, FN_HSCIF1_HCTS_N_B, FN_SCIFA0_RXD_D, FN_VI1_DATA3, FN_SCKZ,
-+ FN_ATACS00_N, FN_ETH_LINK_B, FN_SSI_SDATA2, FN_HSCIF1_HRTS_N_B,
-+ FN_SCIFA0_TXD_D, FN_VI1_DATA4, FN_STM_N, FN_ATACS10_N, FN_ETH_REFCLK_B,
-+ FN_SSI_SCK9, FN_SCIF2_SCK_B, FN_PWM2_B, FN_VI1_DATA5, FN_MTS_N,
-+ FN_EX_WAIT1, FN_ETH_TXD1_B, FN_SSI_WS9, FN_SCIF2_RXD_B, FN_I2C3_SCL_E,
-+ FN_VI1_DATA6, FN_ATARD0_N, FN_ETH_TX_EN_B, FN_SSI_SDATA9,
-+ FN_SCIF2_TXD_B, FN_I2C3_SDA_E, FN_VI1_DATA7, FN_ATADIR0_N,
-+ FN_ETH_MAGIC_B, FN_AUDIO_CLKA, FN_I2C0_SCL_B, FN_SCIFA4_RXD_D,
-+ FN_VI1_CLKENB, FN_TS_SDATA_C, FN_RIF0_SYNC_B, FN_ETH_TXD0_B,
-+ FN_AUDIO_CLKB, FN_I2C0_SDA_B, FN_SCIFA4_TXD_D, FN_VI1_FIELD,
-+ FN_TS_SCK_C, FN_RIF0_CLK_B, FN_BPFCLK_E, FN_ETH_MDC_B, FN_AUDIO_CLKC,
-+ FN_I2C4_SCL_B, FN_SCIFA5_RXD_D, FN_VI1_HSYNC_N, FN_TS_SDEN_C,
-+ FN_RIF0_D0_B, FN_FMCLK_E, FN_RDS_CLK_D, FN_AUDIO_CLKOUT, FN_I2C4_SDA_B,
-+ FN_SCIFA5_TXD_D, FN_VI1_VSYNC_N, FN_TS_SPSYNC_C, FN_RIF0_D1_B,
-+ FN_FMIN_E, FN_RDS_DATA_D,
-+
-+ /* MOD_SEL */
-+ FN_SEL_ADG_0, FN_SEL_ADG_1, FN_SEL_ADG_2, FN_SEL_ADG_3,
-+ FN_SEL_ADI_0, FN_SEL_ADI_1, FN_SEL_CAN_0, FN_SEL_CAN_1,
-+ FN_SEL_CAN_2, FN_SEL_CAN_3, FN_SEL_DARC_0, FN_SEL_DARC_1,
-+ FN_SEL_DARC_2, FN_SEL_DARC_3, FN_SEL_DARC_4, FN_SEL_DR0_0,
-+ FN_SEL_DR0_1, FN_SEL_DR1_0, FN_SEL_DR1_1, FN_SEL_DR2_0, FN_SEL_DR2_1,
-+ FN_SEL_DR3_0, FN_SEL_DR3_1, FN_SEL_ETH_0, FN_SEL_ETH_1, FN_SEL_FSN_0,
-+ FN_SEL_FSN_1, FN_SEL_I2C00_0, FN_SEL_I2C00_1, FN_SEL_I2C00_2,
-+ FN_SEL_I2C00_3, FN_SEL_I2C00_4, FN_SEL_I2C01_0, FN_SEL_I2C01_1,
-+ FN_SEL_I2C01_2, FN_SEL_I2C01_3, FN_SEL_I2C01_4, FN_SEL_I2C02_0,
-+ FN_SEL_I2C02_1, FN_SEL_I2C02_2, FN_SEL_I2C02_3, FN_SEL_I2C02_4,
-+ FN_SEL_I2C03_0, FN_SEL_I2C03_1, FN_SEL_I2C03_2, FN_SEL_I2C03_3,
-+ FN_SEL_I2C03_4, FN_SEL_I2C04_0, FN_SEL_I2C04_1, FN_SEL_I2C04_2,
-+ FN_SEL_I2C04_3, FN_SEL_I2C04_4, FN_SEL_IIC00_0, FN_SEL_IIC00_1,
-+ FN_SEL_IIC00_2, FN_SEL_IIC00_3, FN_SEL_AVB_0, FN_SEL_AVB_1,
-+
-+ /* MOD_SEL2 */
-+ FN_SEL_IEB_0, FN_SEL_IEB_1, FN_SEL_IEB_2, FN_SEL_IIC01_0,
-+ FN_SEL_IIC01_1, FN_SEL_IIC01_2, FN_SEL_IIC01_3, FN_SEL_LBS_0,
-+ FN_SEL_LBS_1, FN_SEL_MSI1_0, FN_SEL_MSI1_1, FN_SEL_MSI2_0,
-+ FN_SEL_MSI2_1, FN_SEL_RAD_0, FN_SEL_RAD_1, FN_SEL_RCN_0,
-+ FN_SEL_RCN_1, FN_SEL_RSP_0, FN_SEL_RSP_1, FN_SEL_SCIFA0_0,
-+ FN_SEL_SCIFA0_1, FN_SEL_SCIFA0_2, FN_SEL_SCIFA0_3, FN_SEL_SCIFA1_0,
-+ FN_SEL_SCIFA1_1, FN_SEL_SCIFA1_2, FN_SEL_SCIFA2_0, FN_SEL_SCIFA2_1,
-+ FN_SEL_SCIFA3_0, FN_SEL_SCIFA3_1, FN_SEL_SCIFA4_0, FN_SEL_SCIFA4_1,
-+ FN_SEL_SCIFA4_2, FN_SEL_SCIFA4_3, FN_SEL_SCIFA5_0, FN_SEL_SCIFA5_1,
-+ FN_SEL_SCIFA5_2, FN_SEL_SCIFA5_3, FN_SEL_SPDM_0, FN_SEL_SPDM_1,
-+ FN_SEL_TMU_0, FN_SEL_TMU_1, FN_SEL_TSIF0_0, FN_SEL_TSIF0_1,
-+ FN_SEL_TSIF0_2, FN_SEL_TSIF0_3, FN_SEL_CAN0_0, FN_SEL_CAN0_1,
-+ FN_SEL_CAN0_2, FN_SEL_CAN0_3, FN_SEL_CAN1_0, FN_SEL_CAN1_1,
-+ FN_SEL_CAN1_2, FN_SEL_CAN1_3, FN_SEL_HSCIF0_0, FN_SEL_HSCIF0_1,
-+ FN_SEL_HSCIF1_0, FN_SEL_HSCIF1_1, FN_SEL_RDS_0, FN_SEL_RDS_1,
-+ FN_SEL_RDS_2, FN_SEL_RDS_3,
-+
-+ /* MOD_SEL3 */
-+ FN_SEL_SCIF0_0, FN_SEL_SCIF0_1, FN_SEL_SCIF0_2, FN_SEL_SCIF0_3,
-+ FN_SEL_SCIF1_0, FN_SEL_SCIF1_1, FN_SEL_SCIF1_2, FN_SEL_SCIF2_0,
-+ FN_SEL_SCIF2_1, FN_SEL_SCIF2_2, FN_SEL_SCIF3_0, FN_SEL_SCIF3_1,
-+ FN_SEL_SCIF4_0, FN_SEL_SCIF4_1, FN_SEL_SCIF4_2, FN_SEL_SCIF4_3,
-+ FN_SEL_SCIF4_4, FN_SEL_SCIF5_0, FN_SEL_SCIF5_1, FN_SEL_SCIF5_2,
-+ FN_SEL_SCIF5_3, FN_SEL_SSI1_0, FN_SEL_SSI1_1, FN_SEL_SSI2_0,
-+ FN_SEL_SSI2_1, FN_SEL_SSI4_0, FN_SEL_SSI4_1, FN_SEL_SSI5_0,
-+ FN_SEL_SSI5_1, FN_SEL_SSI6_0, FN_SEL_SSI6_1, FN_SEL_SSI7_0,
-+ FN_SEL_SSI7_1, FN_SEL_SSI8_0, FN_SEL_SSI8_1, FN_SEL_SSI9_0,
-+ FN_SEL_SSI9_1,
-+ PINMUX_FUNCTION_END,
-+
-+ PINMUX_MARK_BEGIN,
-+ A2_MARK, WE0_N_MARK, WE1_N_MARK, DACK0_MARK,
-+
-+ USB0_PWEN_MARK, USB0_OVC_MARK, USB1_PWEN_MARK, USB1_OVC_MARK,
-+
-+ SD0_CLK_MARK, SD0_CMD_MARK, SD0_DATA0_MARK, SD0_DATA1_MARK,
-+ SD0_DATA2_MARK, SD0_DATA3_MARK, SD0_CD_MARK, SD0_WP_MARK,
-+
-+ SD1_CLK_MARK, SD1_CMD_MARK, SD1_DATA0_MARK, SD1_DATA1_MARK,
-+ SD1_DATA2_MARK, SD1_DATA3_MARK,
-+
-+ /* IPSR0 */
-+ SD1_CD_MARK, CAN0_RX_MARK, SD1_WP_MARK, IRQ7_MARK, CAN0_TX_MARK,
-+ MMC_CLK_MARK, SD2_CLK_MARK, MMC_CMD_MARK, SD2_CMD_MARK, MMC_D0_MARK,
-+ SD2_DATA0_MARK, MMC_D1_MARK, SD2_DATA1_MARK, MMC_D2_MARK,
-+ SD2_DATA2_MARK, MMC_D3_MARK, SD2_DATA3_MARK, MMC_D4_MARK, SD2_CD_MARK,
-+ MMC_D5_MARK, SD2_WP_MARK, MMC_D6_MARK, SCIF0_RXD_MARK, I2C2_SCL_B_MARK,
-+ CAN1_RX_MARK, MMC_D7_MARK, SCIF0_TXD_MARK, I2C2_SDA_B_MARK,
-+ CAN1_TX_MARK, D0_MARK, SCIFA3_SCK_B_MARK, IRQ4_MARK, D1_MARK,
-+ SCIFA3_RXD_B_MARK, D2_MARK, SCIFA3_TXD_B_MARK, D3_MARK, I2C3_SCL_B_MARK,
-+ SCIF5_RXD_B_MARK, D4_MARK, I2C3_SDA_B_MARK, SCIF5_TXD_B_MARK, D5_MARK,
-+ SCIF4_RXD_B_MARK, I2C0_SCL_D_MARK,
-+
-+ /* IPSR1 */
-+ D6_MARK, SCIF4_TXD_B_MARK, I2C0_SDA_D_MARK, D7_MARK, IRQ3_MARK,
-+ TCLK1_MARK, PWM6_B_MARK, D8_MARK, HSCIF2_HRX_MARK, I2C1_SCL_B_MARK,
-+ D9_MARK, HSCIF2_HTX_MARK, I2C1_SDA_B_MARK, D10_MARK,
-+ HSCIF2_HSCK_MARK, SCIF1_SCK_C_MARK, IRQ6_MARK, PWM5_C_MARK,
-+ D11_MARK, HSCIF2_HCTS_N_MARK, SCIF1_RXD_C_MARK, I2C1_SCL_D_MARK,
-+ D12_MARK, HSCIF2_HRTS_N_MARK, SCIF1_TXD_C_MARK, I2C1_SDA_D_MARK,
-+ D13_MARK, SCIFA1_SCK_MARK, TANS1_MARK, PWM2_C_MARK, TCLK2_B_MARK,
-+ D14_MARK, SCIFA1_RXD_MARK, IIC0_SCL_B_MARK, D15_MARK, SCIFA1_TXD_MARK,
-+ IIC0_SDA_B_MARK, A0_MARK, SCIFB1_SCK_MARK, PWM3_B_MARK, A1_MARK,
-+ SCIFB1_TXD_MARK, A3_MARK, SCIFB0_SCK_MARK, A4_MARK, SCIFB0_TXD_MARK,
-+ A5_MARK, SCIFB0_RXD_MARK, PWM4_B_MARK, TPUTO3_C_MARK, A6_MARK,
-+ SCIFB0_CTS_N_MARK, SCIFA4_RXD_B_MARK, TPUTO2_C_MARK,
-+
-+ /* IPSR2 */
-+ A7_MARK, SCIFB0_RTS_N_MARK, SCIFA4_TXD_B_MARK, A8_MARK, MSIOF1_RXD_MARK,
-+ SCIFA0_RXD_B_MARK, A9_MARK, MSIOF1_TXD_MARK, SCIFA0_TXD_B_MARK,
-+ A10_MARK, MSIOF1_SCK_MARK, IIC1_SCL_B_MARK, A11_MARK, MSIOF1_SYNC_MARK,
-+ IIC1_SDA_B_MARK, A12_MARK, MSIOF1_SS1_MARK, SCIFA5_RXD_B_MARK,
-+ A13_MARK, MSIOF1_SS2_MARK, SCIFA5_TXD_B_MARK, A14_MARK, MSIOF2_RXD_MARK,
-+ HSCIF0_HRX_B_MARK, DREQ1_N_MARK, A15_MARK, MSIOF2_TXD_MARK,
-+ HSCIF0_HTX_B_MARK, DACK1_MARK, A16_MARK, MSIOF2_SCK_MARK,
-+ HSCIF0_HSCK_B_MARK, SPEEDIN_MARK, VSP_MARK, CAN_CLK_C_MARK,
-+ TPUTO2_B_MARK, A17_MARK, MSIOF2_SYNC_MARK, SCIF4_RXD_E_MARK,
-+ CAN1_RX_B_MARK, AVB_AVTP_CAPTURE_B_MARK, A18_MARK, MSIOF2_SS1_MARK,
-+ SCIF4_TXD_E_MARK, CAN1_TX_B_MARK, AVB_AVTP_MATCH_B_MARK, A19_MARK,
-+ MSIOF2_SS2_MARK, PWM4_MARK, TPUTO2_MARK, MOUT0_MARK, A20_MARK,
-+ SPCLK_MARK, MOUT1_MARK,
-+
-+ /* IPSR3 */
-+ A21_MARK, MOSI_IO0_MARK, MOUT2_MARK, A22_MARK, MISO_IO1_MARK,
-+ MOUT5_MARK, ATADIR1_N_MARK, A23_MARK, IO2_MARK, MOUT6_MARK,
-+ ATAWR1_N_MARK, A24_MARK, IO3_MARK, EX_WAIT2_MARK, A25_MARK, SSL_MARK,
-+ ATARD1_N_MARK, CS0_N_MARK, VI1_DATA8_MARK, CS1_N_A26_MARK,
-+ VI1_DATA9_MARK, EX_CS0_N_MARK, VI1_DATA10_MARK, EX_CS1_N_MARK,
-+ TPUTO3_B_MARK, SCIFB2_RXD_MARK, VI1_DATA11_MARK, EX_CS2_N_MARK,
-+ PWM0_MARK, SCIF4_RXD_C_MARK, TS_SDATA_B_MARK, RIF0_SYNC_MARK,
-+ TPUTO3_MARK, SCIFB2_TXD_MARK, SDATA_B_MARK, EX_CS3_N_MARK,
-+ SCIFA2_SCK_MARK, SCIF4_TXD_C_MARK, TS_SCK_B_MARK, RIF0_CLK_MARK,
-+ BPFCLK_MARK, SCIFB2_SCK_MARK, MDATA_B_MARK, EX_CS4_N_MARK,
-+ SCIFA2_RXD_MARK, I2C2_SCL_E_MARK, TS_SDEN_B_MARK, RIF0_D0_MARK,
-+ FMCLK_MARK, SCIFB2_CTS_N_MARK, SCKZ_B_MARK, EX_CS5_N_MARK,
-+ SCIFA2_TXD_MARK, I2C2_SDA_E_MARK, TS_SPSYNC_B_MARK, RIF0_D1_MARK,
-+ FMIN_MARK, SCIFB2_RTS_N_MARK, STM_N_B_MARK, BS_N_MARK, DRACK0_MARK,
-+ PWM1_C_MARK, TPUTO0_C_MARK, ATACS01_N_MARK, MTS_N_B_MARK, RD_N_MARK,
-+ ATACS11_N_MARK, RD_WR_N_MARK, ATAG1_N_MARK,
-+
-+ /* IPSR4 */
-+ EX_WAIT0_MARK, CAN_CLK_B_MARK, SCIF_CLK_MARK, PWMFSW0_MARK,
-+ DU0_DR0_MARK, LCDOUT16_MARK, SCIF5_RXD_C_MARK, I2C2_SCL_D_MARK,
-+ CC50_STATE0_MARK, DU0_DR1_MARK, LCDOUT17_MARK, SCIF5_TXD_C_MARK,
-+ I2C2_SDA_D_MARK, CC50_STATE1_MARK, DU0_DR2_MARK, LCDOUT18_MARK,
-+ CC50_STATE2_MARK, DU0_DR3_MARK, LCDOUT19_MARK, CC50_STATE3_MARK,
-+ DU0_DR4_MARK, LCDOUT20_MARK, CC50_STATE4_MARK, DU0_DR5_MARK,
-+ LCDOUT21_MARK, CC50_STATE5_MARK, DU0_DR6_MARK, LCDOUT22_MARK,
-+ CC50_STATE6_MARK, DU0_DR7_MARK, LCDOUT23_MARK, CC50_STATE7_MARK,
-+ DU0_DG0_MARK, LCDOUT8_MARK, SCIFA0_RXD_C_MARK, I2C3_SCL_D_MARK,
-+ CC50_STATE8_MARK, DU0_DG1_MARK, LCDOUT9_MARK, SCIFA0_TXD_C_MARK,
-+ I2C3_SDA_D_MARK, CC50_STATE9_MARK, DU0_DG2_MARK, LCDOUT10_MARK,
-+ CC50_STATE10_MARK, DU0_DG3_MARK, LCDOUT11_MARK, CC50_STATE11_MARK,
-+ DU0_DG4_MARK, LCDOUT12_MARK, CC50_STATE12_MARK,
-+
-+ /* IPSR5 */
-+ DU0_DG5_MARK, LCDOUT13_MARK, CC50_STATE13_MARK, DU0_DG6_MARK,
-+ LCDOUT14_MARK, CC50_STATE14_MARK, DU0_DG7_MARK, LCDOUT15_MARK,
-+ CC50_STATE15_MARK, DU0_DB0_MARK, LCDOUT0_MARK, SCIFA4_RXD_C_MARK,
-+ I2C4_SCL_D_MARK, CAN0_RX_C_MARK, CC50_STATE16_MARK, DU0_DB1_MARK,
-+ LCDOUT1_MARK, SCIFA4_TXD_C_MARK, I2C4_SDA_D_MARK, CAN0_TX_C_MARK,
-+ CC50_STATE17_MARK, DU0_DB2_MARK, LCDOUT2_MARK, CC50_STATE18_MARK,
-+ DU0_DB3_MARK, LCDOUT3_MARK, CC50_STATE19_MARK, DU0_DB4_MARK,
-+ LCDOUT4_MARK, CC50_STATE20_MARK, DU0_DB5_MARK, LCDOUT5_MARK,
-+ CC50_STATE21_MARK, DU0_DB6_MARK, LCDOUT6_MARK, CC50_STATE22_MARK,
-+ DU0_DB7_MARK, LCDOUT7_MARK, CC50_STATE23_MARK, DU0_DOTCLKIN_MARK,
-+ QSTVA_QVS_MARK, CC50_STATE24_MARK, DU0_DOTCLKOUT0_MARK,
-+ QCLK_MARK, CC50_STATE25_MARK, DU0_DOTCLKOUT1_MARK, QSTVB_QVE_MARK,
-+ CC50_STATE26_MARK, DU0_EXHSYNC_DU0_HSYNC_MARK, QSTH_QHS_MARK,
-+ CC50_STATE27_MARK,
-+
-+ /* IPSR6 */
-+ DU0_EXVSYNC_DU0_VSYNC_MARK, QSTB_QHE_MARK, CC50_STATE28_MARK,
-+ DU0_EXODDF_DU0_ODDF_DISP_CDE_MARK, QCPV_QDE_MARK, CC50_STATE29_MARK,
-+ DU0_DISP_MARK, QPOLA_MARK, CC50_STATE30_MARK, DU0_CDE_MARK, QPOLB_MARK,
-+ CC50_STATE31_MARK, VI0_CLK_MARK, AVB_RX_CLK_MARK, VI0_DATA0_VI0_B0_MARK,
-+ AVB_RX_DV_MARK, VI0_DATA1_VI0_B1_MARK, AVB_RXD0_MARK,
-+ VI0_DATA2_VI0_B2_MARK, AVB_RXD1_MARK, VI0_DATA3_VI0_B3_MARK,
-+ AVB_RXD2_MARK, VI0_DATA4_VI0_B4_MARK, AVB_RXD3_MARK,
-+ VI0_DATA5_VI0_B5_MARK, AVB_RXD4_MARK, VI0_DATA6_VI0_B6_MARK,
-+ AVB_RXD5_MARK, VI0_DATA7_VI0_B7_MARK, AVB_RXD6_MARK, VI0_CLKENB_MARK,
-+ I2C3_SCL_MARK, SCIFA5_RXD_C_MARK, IETX_C_MARK, AVB_RXD7_MARK,
-+ VI0_FIELD_MARK, I2C3_SDA_MARK, SCIFA5_TXD_C_MARK, IECLK_C_MARK,
-+ AVB_RX_ER_MARK, VI0_HSYNC_N_MARK, SCIF0_RXD_B_MARK, I2C0_SCL_C_MARK,
-+ IERX_C_MARK, AVB_COL_MARK, VI0_VSYNC_N_MARK, SCIF0_TXD_B_MARK,
-+ I2C0_SDA_C_MARK, AUDIO_CLKOUT_B_MARK, AVB_TX_EN_MARK, ETH_MDIO_MARK,
-+ VI0_G0_MARK, MSIOF2_RXD_B_MARK, IIC0_SCL_D_MARK, AVB_TX_CLK_MARK,
-+ ADIDATA_MARK, AD_DI_MARK,
-+
-+ /* IPSR7 */
-+ ETH_CRS_DV_MARK, VI0_G1_MARK, MSIOF2_TXD_B_MARK, IIC0_SDA_D_MARK,
-+ AVB_TXD0_MARK, ADICS_SAMP_MARK, AD_DO_MARK, ETH_RX_ER_MARK, VI0_G2_MARK,
-+ MSIOF2_SCK_B_MARK, CAN0_RX_B_MARK, AVB_TXD1_MARK, ADICLK_MARK,
-+ AD_CLK_MARK, ETH_RXD0_MARK, VI0_G3_MARK, MSIOF2_SYNC_B_MARK,
-+ CAN0_TX_B_MARK, AVB_TXD2_MARK, ADICHS0_MARK, AD_NCS_N_MARK,
-+ ETH_RXD1_MARK, VI0_G4_MARK, MSIOF2_SS1_B_MARK, SCIF4_RXD_D_MARK,
-+ AVB_TXD3_MARK, ADICHS1_MARK, ETH_LINK_MARK, VI0_G5_MARK,
-+ MSIOF2_SS2_B_MARK, SCIF4_TXD_D_MARK, AVB_TXD4_MARK, ADICHS2_MARK,
-+ ETH_REFCLK_MARK, VI0_G6_MARK, SCIF2_SCK_C_MARK, AVB_TXD5_MARK,
-+ SSI_SCK5_B_MARK, ETH_TXD1_MARK, VI0_G7_MARK, SCIF2_RXD_C_MARK,
-+ IIC1_SCL_D_MARK, AVB_TXD6_MARK, SSI_WS5_B_MARK, ETH_TX_EN_MARK,
-+ VI0_R0_MARK, SCIF2_TXD_C_MARK, IIC1_SDA_D_MARK, AVB_TXD7_MARK,
-+ SSI_SDATA5_B_MARK, ETH_MAGIC_MARK, VI0_R1_MARK, SCIF3_SCK_B_MARK,
-+ AVB_TX_ER_MARK, SSI_SCK6_B_MARK, ETH_TXD0_MARK, VI0_R2_MARK,
-+ SCIF3_RXD_B_MARK, I2C4_SCL_E_MARK, AVB_GTX_CLK_MARK, SSI_WS6_B_MARK,
-+ DREQ0_N_MARK, SCIFB1_RXD_MARK,
-+
-+ /* IPSR8 */
-+ ETH_MDC_MARK, VI0_R3_MARK, SCIF3_TXD_B_MARK, I2C4_SDA_E_MARK,
-+ AVB_MDC_MARK, SSI_SDATA6_B_MARK, HSCIF0_HRX_MARK, VI0_R4_MARK,
-+ I2C1_SCL_C_MARK, AUDIO_CLKA_B_MARK, AVB_MDIO_MARK, SSI_SCK78_B_MARK,
-+ HSCIF0_HTX_MARK, VI0_R5_MARK, I2C1_SDA_C_MARK, AUDIO_CLKB_B_MARK,
-+ AVB_LINK_MARK, SSI_WS78_B_MARK, HSCIF0_HCTS_N_MARK, VI0_R6_MARK,
-+ SCIF0_RXD_D_MARK, I2C0_SCL_E_MARK, AVB_MAGIC_MARK, SSI_SDATA7_B_MARK,
-+ HSCIF0_HRTS_N_MARK, VI0_R7_MARK, SCIF0_TXD_D_MARK, I2C0_SDA_E_MARK,
-+ AVB_PHY_INT_MARK, SSI_SDATA8_B_MARK,
-+ HSCIF0_HSCK_MARK, SCIF_CLK_B_MARK, AVB_CRS_MARK, AUDIO_CLKC_B_MARK,
-+ I2C0_SCL_MARK, SCIF0_RXD_C_MARK, PWM5_MARK, TCLK1_B_MARK,
-+ AVB_GTXREFCLK_MARK, CAN1_RX_D_MARK, TPUTO0_B_MARK, I2C0_SDA_MARK,
-+ SCIF0_TXD_C_MARK, TPUTO0_MARK, CAN_CLK_MARK, DVC_MUTE_MARK,
-+ CAN1_TX_D_MARK, I2C1_SCL_MARK, SCIF4_RXD_MARK, PWM5_B_MARK,
-+ DU1_DR0_MARK, RIF1_SYNC_B_MARK, TS_SDATA_D_MARK, TPUTO1_B_MARK,
-+ I2C1_SDA_MARK, SCIF4_TXD_MARK, IRQ5_MARK, DU1_DR1_MARK, RIF1_CLK_B_MARK,
-+ TS_SCK_D_MARK, BPFCLK_C_MARK, MSIOF0_RXD_MARK, SCIF5_RXD_MARK,
-+ I2C2_SCL_C_MARK, DU1_DR2_MARK, RIF1_D0_B_MARK, TS_SDEN_D_MARK,
-+ FMCLK_C_MARK, RDS_CLK_MARK,
-+
-+ /* IPSR9 */
-+ MSIOF0_TXD_MARK, SCIF5_TXD_MARK, I2C2_SDA_C_MARK, DU1_DR3_MARK,
-+ RIF1_D1_B_MARK, TS_SPSYNC_D_MARK, FMIN_C_MARK, RDS_DATA_MARK,
-+ MSIOF0_SCK_MARK, IRQ0_MARK, TS_SDATA_MARK, DU1_DR4_MARK, RIF1_SYNC_MARK,
-+ TPUTO1_C_MARK, MSIOF0_SYNC_MARK, PWM1_MARK, TS_SCK_MARK, DU1_DR5_MARK,
-+ RIF1_CLK_MARK, BPFCLK_B_MARK, MSIOF0_SS1_MARK, SCIFA0_RXD_MARK,
-+ TS_SDEN_MARK, DU1_DR6_MARK, RIF1_D0_MARK, FMCLK_B_MARK, RDS_CLK_B_MARK,
-+ MSIOF0_SS2_MARK, SCIFA0_TXD_MARK, TS_SPSYNC_MARK, DU1_DR7_MARK,
-+ RIF1_D1_MARK, FMIN_B_MARK, RDS_DATA_B_MARK, HSCIF1_HRX_MARK,
-+ I2C4_SCL_MARK, PWM6_MARK, DU1_DG0_MARK, HSCIF1_HTX_MARK,
-+ I2C4_SDA_MARK, TPUTO1_MARK, DU1_DG1_MARK, HSCIF1_HSCK_MARK,
-+ PWM2_MARK, IETX_MARK, DU1_DG2_MARK, REMOCON_B_MARK, SPEEDIN_B_MARK,
-+ VSP_B_MARK, HSCIF1_HCTS_N_MARK, SCIFA4_RXD_MARK, IECLK_MARK,
-+ DU1_DG3_MARK, SSI_SCK1_B_MARK, CAN_DEBUG_HW_TRIGGER_MARK,
-+ CC50_STATE32_MARK, HSCIF1_HRTS_N_MARK, SCIFA4_TXD_MARK, IERX_MARK,
-+ DU1_DG4_MARK, SSI_WS1_B_MARK, CAN_STEP0_MARK, CC50_STATE33_MARK,
-+ SCIF1_SCK_MARK, PWM3_MARK, TCLK2_MARK, DU1_DG5_MARK, SSI_SDATA1_B_MARK,
-+ CAN_TXCLK_MARK, CC50_STATE34_MARK,
-+
-+ /* IPSR10 */
-+ SCIF1_RXD_MARK, IIC0_SCL_MARK, DU1_DG6_MARK, SSI_SCK2_B_MARK,
-+ CAN_DEBUGOUT0_MARK, CC50_STATE35_MARK, SCIF1_TXD_MARK, IIC0_SDA_MARK,
-+ DU1_DG7_MARK, SSI_WS2_B_MARK, CAN_DEBUGOUT1_MARK, CC50_STATE36_MARK,
-+ SCIF2_RXD_MARK, IIC1_SCL_MARK, DU1_DB0_MARK, SSI_SDATA2_B_MARK,
-+ USB0_EXTLP_MARK, CAN_DEBUGOUT2_MARK, CC50_STATE37_MARK, SCIF2_TXD_MARK,
-+ IIC1_SDA_MARK, DU1_DB1_MARK, SSI_SCK9_B_MARK, USB0_OVC1_MARK,
-+ CAN_DEBUGOUT3_MARK, CC50_STATE38_MARK, SCIF2_SCK_MARK, IRQ1_MARK,
-+ DU1_DB2_MARK, SSI_WS9_B_MARK, USB0_IDIN_MARK, CAN_DEBUGOUT4_MARK,
-+ CC50_STATE39_MARK, SCIF3_SCK_MARK, IRQ2_MARK, BPFCLK_D_MARK,
-+ DU1_DB3_MARK, SSI_SDATA9_B_MARK, TANS2_MARK, CAN_DEBUGOUT5_MARK,
-+ CC50_OSCOUT_MARK, SCIF3_RXD_MARK, I2C1_SCL_E_MARK, FMCLK_D_MARK,
-+ DU1_DB4_MARK, AUDIO_CLKA_C_MARK, SSI_SCK4_B_MARK, CAN_DEBUGOUT6_MARK,
-+ RDS_CLK_C_MARK, SCIF3_TXD_MARK, I2C1_SDA_E_MARK, FMIN_D_MARK,
-+ DU1_DB5_MARK, AUDIO_CLKB_C_MARK, SSI_WS4_B_MARK, CAN_DEBUGOUT7_MARK,
-+ RDS_DATA_C_MARK, I2C2_SCL_MARK, SCIFA5_RXD_MARK, DU1_DB6_MARK,
-+ AUDIO_CLKC_C_MARK, SSI_SDATA4_B_MARK, CAN_DEBUGOUT8_MARK, I2C2_SDA_MARK,
-+ SCIFA5_TXD_MARK, DU1_DB7_MARK, AUDIO_CLKOUT_C_MARK, CAN_DEBUGOUT9_MARK,
-+ SSI_SCK5_MARK, SCIFA3_SCK_MARK, DU1_DOTCLKIN_MARK, CAN_DEBUGOUT10_MARK,
-+
-+ /* IPSR11 */
-+ SSI_WS5_MARK, SCIFA3_RXD_MARK, I2C3_SCL_C_MARK, DU1_DOTCLKOUT0_MARK,
-+ CAN_DEBUGOUT11_MARK, SSI_SDATA5_MARK, SCIFA3_TXD_MARK, I2C3_SDA_C_MARK,
-+ DU1_DOTCLKOUT1_MARK, CAN_DEBUGOUT12_MARK, SSI_SCK6_MARK,
-+ SCIFA1_SCK_B_MARK, DU1_EXHSYNC_DU1_HSYNC_MARK, CAN_DEBUGOUT13_MARK,
-+ SSI_WS6_MARK, SCIFA1_RXD_B_MARK, I2C4_SCL_C_MARK,
-+ DU1_EXVSYNC_DU1_VSYNC_MARK, CAN_DEBUGOUT14_MARK, SSI_SDATA6_MARK,
-+ SCIFA1_TXD_B_MARK, I2C4_SDA_C_MARK, DU1_EXODDF_DU1_ODDF_DISP_CDE_MARK,
-+ CAN_DEBUGOUT15_MARK, SSI_SCK78_MARK, SCIFA2_SCK_B_MARK, IIC0_SDA_C_MARK,
-+ DU1_DISP_MARK, SSI_WS78_MARK, SCIFA2_RXD_B_MARK, IIC0_SCL_C_MARK,
-+ DU1_CDE_MARK, SSI_SDATA7_MARK, SCIFA2_TXD_B_MARK, IRQ8_MARK,
-+ AUDIO_CLKA_D_MARK, CAN_CLK_D_MARK, PCMOE_N_MARK, SSI_SCK0129_MARK,
-+ MSIOF1_RXD_B_MARK, SCIF5_RXD_D_MARK, ADIDATA_B_MARK, AD_DI_B_MARK,
-+ PCMWE_N_MARK, SSI_WS0129_MARK, MSIOF1_TXD_B_MARK, SCIF5_TXD_D_MARK,
-+ ADICS_SAMP_B_MARK, AD_DO_B_MARK, SSI_SDATA0_MARK, MSIOF1_SCK_B_MARK,
-+ PWM0_B_MARK, ADICLK_B_MARK, AD_CLK_B_MARK,
-+
-+ /* IPSR12 */
-+ SSI_SCK34_MARK, MSIOF1_SYNC_B_MARK, SCIFA1_SCK_C_MARK, ADICHS0_B_MARK,
-+ AD_NCS_N_B_MARK, DREQ1_N_B_MARK, SSI_WS34_MARK, MSIOF1_SS1_B_MARK,
-+ SCIFA1_RXD_C_MARK, ADICHS1_B_MARK, CAN1_RX_C_MARK, DACK1_B_MARK,
-+ SSI_SDATA3_MARK, MSIOF1_SS2_B_MARK, SCIFA1_TXD_C_MARK, ADICHS2_B_MARK,
-+ CAN1_TX_C_MARK, DREQ2_N_MARK, SSI_SCK4_MARK, MLB_CLK_MARK, IETX_B_MARK,
-+ IRD_TX_MARK, SSI_WS4_MARK, MLB_SIG_MARK, IECLK_B_MARK, IRD_RX_MARK,
-+ SSI_SDATA4_MARK, MLB_DAT_MARK, IERX_B_MARK, IRD_SCK_MARK,
-+ SSI_SDATA8_MARK, SCIF1_SCK_B_MARK, PWM1_B_MARK, IRQ9_MARK, REMOCON_MARK,
-+ DACK2_MARK, ETH_MDIO_B_MARK, SSI_SCK1_MARK, SCIF1_RXD_B_MARK,
-+ IIC1_SCL_C_MARK, VI1_CLK_MARK, CAN0_RX_D_MARK, AVB_AVTP_CAPTURE_MARK,
-+ ETH_CRS_DV_B_MARK, SSI_WS1_MARK, SCIF1_TXD_B_MARK, IIC1_SDA_C_MARK,
-+ VI1_DATA0_MARK, CAN0_TX_D_MARK, AVB_AVTP_MATCH_MARK, ETH_RX_ER_B_MARK,
-+ SSI_SDATA1_MARK, HSCIF1_HRX_B_MARK, VI1_DATA1_MARK, SDATA_MARK,
-+ ATAG0_N_MARK, ETH_RXD0_B_MARK, SSI_SCK2_MARK, HSCIF1_HTX_B_MARK,
-+ VI1_DATA2_MARK, MDATA_MARK, ATAWR0_N_MARK, ETH_RXD1_B_MARK,
-+
-+ /* IPSR13 */
-+ SSI_WS2_MARK, HSCIF1_HCTS_N_B_MARK, SCIFA0_RXD_D_MARK, VI1_DATA3_MARK,
-+ SCKZ_MARK, ATACS00_N_MARK, ETH_LINK_B_MARK, SSI_SDATA2_MARK,
-+ HSCIF1_HRTS_N_B_MARK, SCIFA0_TXD_D_MARK, VI1_DATA4_MARK, STM_N_MARK,
-+ ATACS10_N_MARK, ETH_REFCLK_B_MARK, SSI_SCK9_MARK, SCIF2_SCK_B_MARK,
-+ PWM2_B_MARK, VI1_DATA5_MARK, MTS_N_MARK, EX_WAIT1_MARK,
-+ ETH_TXD1_B_MARK, SSI_WS9_MARK, SCIF2_RXD_B_MARK, I2C3_SCL_E_MARK,
-+ VI1_DATA6_MARK, ATARD0_N_MARK, ETH_TX_EN_B_MARK, SSI_SDATA9_MARK,
-+ SCIF2_TXD_B_MARK, I2C3_SDA_E_MARK, VI1_DATA7_MARK, ATADIR0_N_MARK,
-+ ETH_MAGIC_B_MARK, AUDIO_CLKA_MARK, I2C0_SCL_B_MARK, SCIFA4_RXD_D_MARK,
-+ VI1_CLKENB_MARK, TS_SDATA_C_MARK, RIF0_SYNC_B_MARK, ETH_TXD0_B_MARK,
-+ AUDIO_CLKB_MARK, I2C0_SDA_B_MARK, SCIFA4_TXD_D_MARK, VI1_FIELD_MARK,
-+ TS_SCK_C_MARK, RIF0_CLK_B_MARK, BPFCLK_E_MARK, ETH_MDC_B_MARK,
-+ AUDIO_CLKC_MARK, I2C4_SCL_B_MARK, SCIFA5_RXD_D_MARK, VI1_HSYNC_N_MARK,
-+ TS_SDEN_C_MARK, RIF0_D0_B_MARK, FMCLK_E_MARK, RDS_CLK_D_MARK,
-+ AUDIO_CLKOUT_MARK, I2C4_SDA_B_MARK, SCIFA5_TXD_D_MARK, VI1_VSYNC_N_MARK,
-+ TS_SPSYNC_C_MARK, RIF0_D1_B_MARK, FMIN_E_MARK, RDS_DATA_D_MARK,
-+ PINMUX_MARK_END,
-+};
-+
-+static const u16 pinmux_data[] = {
-+ PINMUX_DATA_GP_ALL(), /* PINMUX_DATA(GP_M_N_DATA, GP_M_N_FN...), */
-+
-+ PINMUX_DATA(A2_MARK, FN_A2),
-+ PINMUX_DATA(WE0_N_MARK, FN_WE0_N),
-+ PINMUX_DATA(WE1_N_MARK, FN_WE1_N),
-+ PINMUX_DATA(DACK0_MARK, FN_DACK0),
-+ PINMUX_DATA(USB0_PWEN_MARK, FN_USB0_PWEN),
-+ PINMUX_DATA(USB0_OVC_MARK, FN_USB0_OVC),
-+ PINMUX_DATA(USB1_PWEN_MARK, FN_USB1_PWEN),
-+ PINMUX_DATA(USB1_OVC_MARK, FN_USB1_OVC),
-+ PINMUX_DATA(SD0_CLK_MARK, FN_SD0_CLK),
-+ PINMUX_DATA(SD0_CMD_MARK, FN_SD0_CMD),
-+ PINMUX_DATA(SD0_DATA0_MARK, FN_SD0_DATA0),
-+ PINMUX_DATA(SD0_DATA1_MARK, FN_SD0_DATA1),
-+ PINMUX_DATA(SD0_DATA2_MARK, FN_SD0_DATA2),
-+ PINMUX_DATA(SD0_DATA3_MARK, FN_SD0_DATA3),
-+ PINMUX_DATA(SD0_CD_MARK, FN_SD0_CD),
-+ PINMUX_DATA(SD0_WP_MARK, FN_SD0_WP),
-+ PINMUX_DATA(SD1_CLK_MARK, FN_SD1_CLK),
-+ PINMUX_DATA(SD1_CMD_MARK, FN_SD1_CMD),
-+ PINMUX_DATA(SD1_DATA0_MARK, FN_SD1_DATA0),
-+ PINMUX_DATA(SD1_DATA1_MARK, FN_SD1_DATA1),
-+ PINMUX_DATA(SD1_DATA2_MARK, FN_SD1_DATA2),
-+ PINMUX_DATA(SD1_DATA3_MARK, FN_SD1_DATA3),
-+
-+ /* IPSR0 */
-+ PINMUX_IPSR_DATA(IP0_0, SD1_CD),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_0, CAN0_RX, SEL_CAN0_0),
-+ PINMUX_IPSR_DATA(IP0_9_8, SD1_WP),
-+ PINMUX_IPSR_DATA(IP0_9_8, IRQ7),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_9_8, CAN0_TX, SEL_CAN0_0),
-+ PINMUX_IPSR_DATA(IP0_10, MMC_CLK),
-+ PINMUX_IPSR_DATA(IP0_10, SD2_CLK),
-+ PINMUX_IPSR_DATA(IP0_11, MMC_CMD),
-+ PINMUX_IPSR_DATA(IP0_11, SD2_CMD),
-+ PINMUX_IPSR_DATA(IP0_12, MMC_D0),
-+ PINMUX_IPSR_DATA(IP0_12, SD2_DATA0),
-+ PINMUX_IPSR_DATA(IP0_13, MMC_D1),
-+ PINMUX_IPSR_DATA(IP0_13, SD2_DATA1),
-+ PINMUX_IPSR_DATA(IP0_14, MMC_D2),
-+ PINMUX_IPSR_DATA(IP0_14, SD2_DATA2),
-+ PINMUX_IPSR_DATA(IP0_15, MMC_D3),
-+ PINMUX_IPSR_DATA(IP0_15, SD2_DATA3),
-+ PINMUX_IPSR_DATA(IP0_16, MMC_D4),
-+ PINMUX_IPSR_DATA(IP0_16, SD2_CD),
-+ PINMUX_IPSR_DATA(IP0_17, MMC_D5),
-+ PINMUX_IPSR_DATA(IP0_17, SD2_WP),
-+ PINMUX_IPSR_DATA(IP0_19_18, MMC_D6),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_19_18, SCIF0_RXD, SEL_SCIF0_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_19_18, I2C2_SCL_B, SEL_I2C02_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_19_18, CAN1_RX, SEL_CAN1_0),
-+ PINMUX_IPSR_DATA(IP0_21_20, MMC_D7),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_21_20, SCIF0_TXD, SEL_SCIF0_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_21_20, I2C2_SDA_B, SEL_I2C02_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_21_20, CAN1_TX, SEL_CAN1_0),
-+ PINMUX_IPSR_DATA(IP0_23_22, D0),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_23_22, SCIFA3_SCK_B, SEL_SCIFA3_1),
-+ PINMUX_IPSR_DATA(IP0_23_22, IRQ4),
-+ PINMUX_IPSR_DATA(IP0_24, D1),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_24, SCIFA3_RXD_B, SEL_SCIFA3_1),
-+ PINMUX_IPSR_DATA(IP0_25, D2),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_25, SCIFA3_TXD_B, SEL_SCIFA3_1),
-+ PINMUX_IPSR_DATA(IP0_27_26, D3),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_27_26, I2C3_SCL_B, SEL_I2C03_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_27_26, SCIF5_RXD_B, SEL_SCIF5_1),
-+ PINMUX_IPSR_DATA(IP0_29_28, D4),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_29_28, I2C3_SDA_B, SEL_I2C03_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_29_28, SCIF5_TXD_B, SEL_SCIF5_1),
-+ PINMUX_IPSR_DATA(IP0_31_30, D5),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_31_30, SCIF4_RXD_B, SEL_SCIF4_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP0_31_30, I2C0_SCL_D, SEL_I2C00_3),
-+
-+ /* IPSR1 */
-+ PINMUX_IPSR_DATA(IP1_1_0, D6),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_1_0, SCIF4_TXD_B, SEL_SCIF4_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_1_0, I2C0_SDA_D, SEL_I2C00_3),
-+ PINMUX_IPSR_DATA(IP1_3_2, D7),
-+ PINMUX_IPSR_DATA(IP1_3_2, IRQ3),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_3_2, TCLK1, SEL_TMU_0),
-+ PINMUX_IPSR_DATA(IP1_3_2, PWM6_B),
-+ PINMUX_IPSR_DATA(IP1_5_4, D8),
-+ PINMUX_IPSR_DATA(IP1_5_4, HSCIF2_HRX),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_5_4, I2C1_SCL_B, SEL_I2C01_1),
-+ PINMUX_IPSR_DATA(IP1_7_6, D9),
-+ PINMUX_IPSR_DATA(IP1_7_6, HSCIF2_HTX),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_7_6, I2C1_SDA_B, SEL_I2C01_1),
-+ PINMUX_IPSR_DATA(IP1_10_8, D10),
-+ PINMUX_IPSR_DATA(IP1_10_8, HSCIF2_HSCK),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_10_8, SCIF1_SCK_C, SEL_SCIF1_2),
-+ PINMUX_IPSR_DATA(IP1_10_8, IRQ6),
-+ PINMUX_IPSR_DATA(IP1_10_8, PWM5_C),
-+ PINMUX_IPSR_DATA(IP1_12_11, D11),
-+ PINMUX_IPSR_DATA(IP1_12_11, HSCIF2_HCTS_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_12_11, SCIF1_RXD_C, SEL_SCIF1_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_12_11, I2C1_SCL_D, SEL_I2C01_3),
-+ PINMUX_IPSR_DATA(IP1_14_13, D12),
-+ PINMUX_IPSR_DATA(IP1_14_13, HSCIF2_HRTS_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_14_13, SCIF1_TXD_C, SEL_SCIF1_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_14_13, I2C1_SDA_D, SEL_I2C01_3),
-+ PINMUX_IPSR_DATA(IP1_17_15, D13),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_17_15, SCIFA1_SCK, SEL_SCIFA1_0),
-+ PINMUX_IPSR_DATA(IP1_17_15, TANS1),
-+ PINMUX_IPSR_DATA(IP1_17_15, PWM2_C),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_17_15, TCLK2_B, SEL_TMU_1),
-+ PINMUX_IPSR_DATA(IP1_19_18, D14),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_19_18, SCIFA1_RXD, SEL_SCIFA1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_19_18, IIC0_SCL_B, SEL_IIC00_1),
-+ PINMUX_IPSR_DATA(IP1_21_20, D15),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_21_20, SCIFA1_TXD, SEL_SCIFA1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_21_20, IIC0_SDA_B, SEL_IIC00_1),
-+ PINMUX_IPSR_DATA(IP1_23_22, A0),
-+ PINMUX_IPSR_DATA(IP1_23_22, SCIFB1_SCK),
-+ PINMUX_IPSR_DATA(IP1_23_22, PWM3_B),
-+ PINMUX_IPSR_DATA(IP1_24, A1),
-+ PINMUX_IPSR_DATA(IP1_24, SCIFB1_TXD),
-+ PINMUX_IPSR_DATA(IP1_26, A3),
-+ PINMUX_IPSR_DATA(IP1_26, SCIFB0_SCK),
-+ PINMUX_IPSR_DATA(IP1_27, A4),
-+ PINMUX_IPSR_DATA(IP1_27, SCIFB0_TXD),
-+ PINMUX_IPSR_DATA(IP1_29_28, A5),
-+ PINMUX_IPSR_DATA(IP1_29_28, SCIFB0_RXD),
-+ PINMUX_IPSR_DATA(IP1_29_28, PWM4_B),
-+ PINMUX_IPSR_DATA(IP1_29_28, TPUTO3_C),
-+ PINMUX_IPSR_DATA(IP1_31_30, A6),
-+ PINMUX_IPSR_DATA(IP1_31_30, SCIFB0_CTS_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP1_31_30, SCIFA4_RXD_B, SEL_SCIFA4_1),
-+ PINMUX_IPSR_DATA(IP1_31_30, TPUTO2_C),
-+
-+ /* IPSR2 */
-+ PINMUX_IPSR_DATA(IP2_1_0, A7),
-+ PINMUX_IPSR_DATA(IP2_1_0, SCIFB0_RTS_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_1_0, SCIFA4_TXD_B, SEL_SCIFA4_1),
-+ PINMUX_IPSR_DATA(IP2_3_2, A8),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_3_2, MSIOF1_RXD, SEL_MSI1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_3_2, SCIFA0_RXD_B, SEL_SCIFA0_1),
-+ PINMUX_IPSR_DATA(IP2_5_4, A9),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_5_4, MSIOF1_TXD, SEL_MSI1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_5_4, SCIFA0_TXD_B, SEL_SCIFA0_1),
-+ PINMUX_IPSR_DATA(IP2_7_6, A10),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_7_6, MSIOF1_SCK, SEL_MSI1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_7_6, IIC1_SCL_B, SEL_IIC01_1),
-+ PINMUX_IPSR_DATA(IP2_9_8, A11),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_9_8, MSIOF1_SYNC, SEL_MSI1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_9_8, IIC1_SDA_B, SEL_IIC01_1),
-+ PINMUX_IPSR_DATA(IP2_11_10, A12),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_11_10, MSIOF1_SS1, SEL_MSI1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_11_10, SCIFA5_RXD_B, SEL_SCIFA5_1),
-+ PINMUX_IPSR_DATA(IP2_13_12, A13),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_13_12, MSIOF1_SS2, SEL_MSI1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_13_12, SCIFA5_TXD_B, SEL_SCIFA5_1),
-+ PINMUX_IPSR_DATA(IP2_15_14, A14),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_15_14, MSIOF2_RXD, SEL_MSI2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_15_14, HSCIF0_HRX_B, SEL_HSCIF0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_15_14, DREQ1_N, SEL_LBS_0),
-+ PINMUX_IPSR_DATA(IP2_17_16, A15),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_17_16, MSIOF2_TXD, SEL_MSI2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_17_16, HSCIF0_HTX_B, SEL_HSCIF0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_17_16, DACK1, SEL_LBS_0),
-+ PINMUX_IPSR_DATA(IP2_20_18, A16),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_20_18, MSIOF2_SCK, SEL_MSI2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_20_18, HSCIF0_HSCK_B, SEL_HSCIF0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_20_18, SPEEDIN, SEL_RSP_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_20_18, VSP, SEL_SPDM_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_20_18, CAN_CLK_C, SEL_CAN_2),
-+ PINMUX_IPSR_DATA(IP2_20_18, TPUTO2_B),
-+ PINMUX_IPSR_DATA(IP2_23_21, A17),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_23_21, MSIOF2_SYNC, SEL_MSI2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_23_21, SCIF4_RXD_E, SEL_SCIF4_4),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_23_21, CAN1_RX_B, SEL_CAN1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_23_21, AVB_AVTP_CAPTURE_B, SEL_AVB_1),
-+ PINMUX_IPSR_DATA(IP2_26_24, A18),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_26_24, MSIOF2_SS1, SEL_MSI2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_26_24, SCIF4_TXD_E, SEL_SCIF4_4),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_26_24, CAN1_TX_B, SEL_CAN1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_26_24, AVB_AVTP_MATCH_B, SEL_AVB_1),
-+ PINMUX_IPSR_DATA(IP2_29_27, A19),
-+ PINMUX_IPSR_MODSEL_DATA(IP2_29_27, MSIOF2_SS2, SEL_MSI2_0),
-+ PINMUX_IPSR_DATA(IP2_29_27, PWM4),
-+ PINMUX_IPSR_DATA(IP2_29_27, TPUTO2),
-+ PINMUX_IPSR_DATA(IP2_29_27, MOUT0),
-+ PINMUX_IPSR_DATA(IP2_31_30, A20),
-+ PINMUX_IPSR_DATA(IP2_31_30, SPCLK),
-+ PINMUX_IPSR_DATA(IP2_29_27, MOUT1),
-+
-+ /* IPSR3 */
-+ PINMUX_IPSR_DATA(IP3_1_0, A21),
-+ PINMUX_IPSR_DATA(IP3_1_0, MOSI_IO0),
-+ PINMUX_IPSR_DATA(IP3_1_0, MOUT2),
-+ PINMUX_IPSR_DATA(IP3_3_2, A22),
-+ PINMUX_IPSR_DATA(IP3_3_2, MISO_IO1),
-+ PINMUX_IPSR_DATA(IP3_3_2, MOUT5),
-+ PINMUX_IPSR_DATA(IP3_3_2, ATADIR1_N),
-+ PINMUX_IPSR_DATA(IP3_5_4, A23),
-+ PINMUX_IPSR_DATA(IP3_5_4, IO2),
-+ PINMUX_IPSR_DATA(IP3_5_4, MOUT6),
-+ PINMUX_IPSR_DATA(IP3_5_4, ATAWR1_N),
-+ PINMUX_IPSR_DATA(IP3_7_6, A24),
-+ PINMUX_IPSR_DATA(IP3_7_6, IO3),
-+ PINMUX_IPSR_DATA(IP3_7_6, EX_WAIT2),
-+ PINMUX_IPSR_DATA(IP3_9_8, A25),
-+ PINMUX_IPSR_DATA(IP3_9_8, SSL),
-+ PINMUX_IPSR_DATA(IP3_9_8, ATARD1_N),
-+ PINMUX_IPSR_DATA(IP3_10, CS0_N),
-+ PINMUX_IPSR_DATA(IP3_10, VI1_DATA8),
-+ PINMUX_IPSR_DATA(IP3_11, CS1_N_A26),
-+ PINMUX_IPSR_DATA(IP3_11, VI1_DATA9),
-+ PINMUX_IPSR_DATA(IP3_12, EX_CS0_N),
-+ PINMUX_IPSR_DATA(IP3_12, VI1_DATA10),
-+ PINMUX_IPSR_DATA(IP3_14_13, EX_CS1_N),
-+ PINMUX_IPSR_DATA(IP3_14_13, TPUTO3_B),
-+ PINMUX_IPSR_DATA(IP3_14_13, SCIFB2_RXD),
-+ PINMUX_IPSR_DATA(IP3_14_13, VI1_DATA11),
-+ PINMUX_IPSR_DATA(IP3_17_15, EX_CS2_N),
-+ PINMUX_IPSR_DATA(IP3_17_15, PWM0),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_17_15, SCIF4_RXD_C, SEL_SCIF4_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_17_15, TS_SDATA_B, SEL_TSIF0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_17_15, RIF0_SYNC, SEL_DR0_0),
-+ PINMUX_IPSR_DATA(IP3_17_15, TPUTO3),
-+ PINMUX_IPSR_DATA(IP3_17_15, SCIFB2_TXD),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_17_15, SDATA_B, SEL_FSN_1),
-+ PINMUX_IPSR_DATA(IP3_20_18, EX_CS3_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_20_18, SCIFA2_SCK, SEL_SCIFA2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_20_18, SCIF4_TXD_C, SEL_SCIF4_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_20_18, TS_SCK_B, SEL_TSIF0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_20_18, RIF0_CLK, SEL_DR0_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_20_18, BPFCLK, SEL_DARC_0),
-+ PINMUX_IPSR_DATA(IP3_20_18, SCIFB2_SCK),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_20_18, MDATA_B, SEL_FSN_1),
-+ PINMUX_IPSR_DATA(IP3_23_21, EX_CS4_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_23_21, SCIFA2_RXD, SEL_SCIFA2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_23_21, I2C2_SCL_E, SEL_I2C02_4),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_23_21, TS_SDEN_B, SEL_TSIF0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_23_21, RIF0_D0, SEL_DR0_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_23_21, FMCLK, SEL_DARC_0),
-+ PINMUX_IPSR_DATA(IP3_23_21, SCIFB2_CTS_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_23_21, SCKZ_B, SEL_FSN_1),
-+ PINMUX_IPSR_DATA(IP3_26_24, EX_CS5_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_26_24, SCIFA2_TXD, SEL_SCIFA2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_26_24, I2C2_SDA_E, SEL_I2C02_4),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_26_24, TS_SPSYNC_B, SEL_TSIF0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_26_24, RIF0_D1, SEL_DR1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_26_24, FMIN, SEL_DARC_0),
-+ PINMUX_IPSR_DATA(IP3_26_24, SCIFB2_RTS_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_26_24, STM_N_B, SEL_FSN_1),
-+ PINMUX_IPSR_DATA(IP3_29_27, BS_N),
-+ PINMUX_IPSR_DATA(IP3_29_27, DRACK0),
-+ PINMUX_IPSR_DATA(IP3_29_27, PWM1_C),
-+ PINMUX_IPSR_DATA(IP3_29_27, TPUTO0_C),
-+ PINMUX_IPSR_DATA(IP3_29_27, ATACS01_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP3_29_27, MTS_N_B, SEL_FSN_1),
-+ PINMUX_IPSR_DATA(IP3_30, RD_N),
-+ PINMUX_IPSR_DATA(IP3_30, ATACS11_N),
-+ PINMUX_IPSR_DATA(IP3_31, RD_WR_N),
-+ PINMUX_IPSR_DATA(IP3_31, ATAG1_N),
-+
-+ /* IPSR4 */
-+ PINMUX_IPSR_DATA(IP4_1_0, EX_WAIT0),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_1_0, CAN_CLK_B, SEL_CAN_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_1_0, SCIF_CLK, SEL_SCIF0_0),
-+ PINMUX_IPSR_DATA(IP4_1_0, PWMFSW0),
-+ PINMUX_IPSR_DATA(IP4_4_2, DU0_DR0),
-+ PINMUX_IPSR_DATA(IP4_4_2, LCDOUT16),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_4_2, SCIF5_RXD_C, SEL_SCIF5_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_4_2, I2C2_SCL_D, SEL_I2C02_3),
-+ PINMUX_IPSR_DATA(IP4_4_2, CC50_STATE0),
-+ PINMUX_IPSR_DATA(IP4_7_5, DU0_DR1),
-+ PINMUX_IPSR_DATA(IP4_7_5, LCDOUT17),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_7_5, SCIF5_TXD_C, SEL_SCIF5_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_7_5, I2C2_SDA_D, SEL_I2C02_3),
-+ PINMUX_IPSR_DATA(IP4_9_8, CC50_STATE1),
-+ PINMUX_IPSR_DATA(IP4_9_8, DU0_DR2),
-+ PINMUX_IPSR_DATA(IP4_9_8, LCDOUT18),
-+ PINMUX_IPSR_DATA(IP4_9_8, CC50_STATE2),
-+ PINMUX_IPSR_DATA(IP4_11_10, DU0_DR3),
-+ PINMUX_IPSR_DATA(IP4_11_10, LCDOUT19),
-+ PINMUX_IPSR_DATA(IP4_11_10, CC50_STATE3),
-+ PINMUX_IPSR_DATA(IP4_13_12, DU0_DR4),
-+ PINMUX_IPSR_DATA(IP4_13_12, LCDOUT20),
-+ PINMUX_IPSR_DATA(IP4_13_12, CC50_STATE4),
-+ PINMUX_IPSR_DATA(IP4_15_14, DU0_DR5),
-+ PINMUX_IPSR_DATA(IP4_15_14, LCDOUT21),
-+ PINMUX_IPSR_DATA(IP4_15_14, CC50_STATE5),
-+ PINMUX_IPSR_DATA(IP4_17_16, DU0_DR6),
-+ PINMUX_IPSR_DATA(IP4_17_16, LCDOUT22),
-+ PINMUX_IPSR_DATA(IP4_17_16, CC50_STATE6),
-+ PINMUX_IPSR_DATA(IP4_19_18, DU0_DR7),
-+ PINMUX_IPSR_DATA(IP4_19_18, LCDOUT23),
-+ PINMUX_IPSR_DATA(IP4_19_18, CC50_STATE7),
-+ PINMUX_IPSR_DATA(IP4_22_20, DU0_DG0),
-+ PINMUX_IPSR_DATA(IP4_22_20, LCDOUT8),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_22_20, SCIFA0_RXD_C, SEL_SCIFA0_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_22_20, I2C3_SCL_D, SEL_I2C03_3),
-+ PINMUX_IPSR_DATA(IP4_22_20, CC50_STATE8),
-+ PINMUX_IPSR_DATA(IP4_25_23, DU0_DG1),
-+ PINMUX_IPSR_DATA(IP4_25_23, LCDOUT9),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_25_23, SCIFA0_TXD_C, SEL_SCIFA0_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP4_25_23, I2C3_SDA_D, SEL_I2C03_3),
-+ PINMUX_IPSR_DATA(IP4_25_23, CC50_STATE9),
-+ PINMUX_IPSR_DATA(IP4_27_26, DU0_DG2),
-+ PINMUX_IPSR_DATA(IP4_27_26, LCDOUT10),
-+ PINMUX_IPSR_DATA(IP4_27_26, CC50_STATE10),
-+ PINMUX_IPSR_DATA(IP4_29_28, DU0_DG3),
-+ PINMUX_IPSR_DATA(IP4_29_28, LCDOUT11),
-+ PINMUX_IPSR_DATA(IP4_29_28, CC50_STATE11),
-+ PINMUX_IPSR_DATA(IP4_31_30, DU0_DG4),
-+ PINMUX_IPSR_DATA(IP4_31_30, LCDOUT12),
-+ PINMUX_IPSR_DATA(IP4_31_30, CC50_STATE12),
-+
-+ /* IPSR5 */
-+ PINMUX_IPSR_DATA(IP5_1_0, DU0_DG5),
-+ PINMUX_IPSR_DATA(IP5_1_0, LCDOUT13),
-+ PINMUX_IPSR_DATA(IP5_1_0, CC50_STATE13),
-+ PINMUX_IPSR_DATA(IP5_3_2, DU0_DG6),
-+ PINMUX_IPSR_DATA(IP5_3_2, LCDOUT14),
-+ PINMUX_IPSR_DATA(IP5_3_2, CC50_STATE14),
-+ PINMUX_IPSR_DATA(IP5_5_4, DU0_DG7),
-+ PINMUX_IPSR_DATA(IP5_5_4, LCDOUT15),
-+ PINMUX_IPSR_DATA(IP5_5_4, CC50_STATE15),
-+ PINMUX_IPSR_DATA(IP5_8_6, DU0_DB0),
-+ PINMUX_IPSR_DATA(IP5_8_6, LCDOUT0),
-+ PINMUX_IPSR_MODSEL_DATA(IP5_8_6, SCIFA4_RXD_C, SEL_SCIFA4_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP5_8_6, I2C4_SCL_D, SEL_I2C04_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_8_6, CAN0_RX_C, SEL_CAN0_2),
-+ PINMUX_IPSR_DATA(IP5_8_6, CC50_STATE16),
-+ PINMUX_IPSR_DATA(IP5_11_9, DU0_DB1),
-+ PINMUX_IPSR_DATA(IP5_11_9, LCDOUT1),
-+ PINMUX_IPSR_MODSEL_DATA(IP5_11_9, SCIFA4_TXD_C, SEL_SCIFA4_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP5_11_9, I2C4_SDA_D, SEL_I2C04_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP5_11_9, CAN0_TX_C, SEL_CAN0_2),
-+ PINMUX_IPSR_DATA(IP5_11_9, CC50_STATE17),
-+ PINMUX_IPSR_DATA(IP5_13_12, DU0_DB2),
-+ PINMUX_IPSR_DATA(IP5_13_12, LCDOUT2),
-+ PINMUX_IPSR_DATA(IP5_13_12, CC50_STATE18),
-+ PINMUX_IPSR_DATA(IP5_15_14, DU0_DB3),
-+ PINMUX_IPSR_DATA(IP5_15_14, LCDOUT3),
-+ PINMUX_IPSR_DATA(IP5_15_14, CC50_STATE19),
-+ PINMUX_IPSR_DATA(IP5_17_16, DU0_DB4),
-+ PINMUX_IPSR_DATA(IP5_17_16, LCDOUT4),
-+ PINMUX_IPSR_DATA(IP5_17_16, CC50_STATE20),
-+ PINMUX_IPSR_DATA(IP5_19_18, DU0_DB5),
-+ PINMUX_IPSR_DATA(IP5_19_18, LCDOUT5),
-+ PINMUX_IPSR_DATA(IP5_19_18, CC50_STATE21),
-+ PINMUX_IPSR_DATA(IP5_21_20, DU0_DB6),
-+ PINMUX_IPSR_DATA(IP5_21_20, LCDOUT6),
-+ PINMUX_IPSR_DATA(IP5_21_20, CC50_STATE22),
-+ PINMUX_IPSR_DATA(IP5_23_22, DU0_DB7),
-+ PINMUX_IPSR_DATA(IP5_23_22, LCDOUT7),
-+ PINMUX_IPSR_DATA(IP5_23_22, CC50_STATE23),
-+ PINMUX_IPSR_DATA(IP5_25_24, DU0_DOTCLKIN),
-+ PINMUX_IPSR_DATA(IP5_25_24, QSTVA_QVS),
-+ PINMUX_IPSR_DATA(IP5_25_24, CC50_STATE24),
-+ PINMUX_IPSR_DATA(IP5_27_26, DU0_DOTCLKOUT0),
-+ PINMUX_IPSR_DATA(IP5_27_26, QCLK),
-+ PINMUX_IPSR_DATA(IP5_27_26, CC50_STATE25),
-+ PINMUX_IPSR_DATA(IP5_29_28, DU0_DOTCLKOUT1),
-+ PINMUX_IPSR_DATA(IP5_29_28, QSTVB_QVE),
-+ PINMUX_IPSR_DATA(IP5_29_28, CC50_STATE26),
-+ PINMUX_IPSR_DATA(IP5_31_30, DU0_EXHSYNC_DU0_HSYNC),
-+ PINMUX_IPSR_DATA(IP5_31_30, QSTH_QHS),
-+ PINMUX_IPSR_DATA(IP5_31_30, CC50_STATE27),
-+
-+ /* IPSR6 */
-+ PINMUX_IPSR_DATA(IP6_1_0, DU0_EXVSYNC_DU0_VSYNC),
-+ PINMUX_IPSR_DATA(IP6_1_0, QSTB_QHE),
-+ PINMUX_IPSR_DATA(IP6_1_0, CC50_STATE28),
-+ PINMUX_IPSR_DATA(IP6_3_2, DU0_EXODDF_DU0_ODDF_DISP_CDE),
-+ PINMUX_IPSR_DATA(IP6_3_2, QCPV_QDE),
-+ PINMUX_IPSR_DATA(IP6_3_2, CC50_STATE29),
-+ PINMUX_IPSR_DATA(IP6_5_4, DU0_DISP),
-+ PINMUX_IPSR_DATA(IP6_5_4, QPOLA),
-+ PINMUX_IPSR_DATA(IP6_5_4, CC50_STATE30),
-+ PINMUX_IPSR_DATA(IP6_7_6, DU0_CDE),
-+ PINMUX_IPSR_DATA(IP6_7_6, QPOLB),
-+ PINMUX_IPSR_DATA(IP6_7_6, CC50_STATE31),
-+ PINMUX_IPSR_DATA(IP6_8, VI0_CLK),
-+ PINMUX_IPSR_DATA(IP6_8, AVB_RX_CLK),
-+ PINMUX_IPSR_DATA(IP6_9, VI0_DATA0_VI0_B0),
-+ PINMUX_IPSR_DATA(IP6_9, AVB_RX_DV),
-+ PINMUX_IPSR_DATA(IP6_10, VI0_DATA1_VI0_B1),
-+ PINMUX_IPSR_DATA(IP6_10, AVB_RXD0),
-+ PINMUX_IPSR_DATA(IP6_11, VI0_DATA2_VI0_B2),
-+ PINMUX_IPSR_DATA(IP6_11, AVB_RXD1),
-+ PINMUX_IPSR_DATA(IP6_12, VI0_DATA3_VI0_B3),
-+ PINMUX_IPSR_DATA(IP6_12, AVB_RXD2),
-+ PINMUX_IPSR_DATA(IP6_13, VI0_DATA4_VI0_B4),
-+ PINMUX_IPSR_DATA(IP6_13, AVB_RXD3),
-+ PINMUX_IPSR_DATA(IP6_14, VI0_DATA5_VI0_B5),
-+ PINMUX_IPSR_DATA(IP6_14, AVB_RXD4),
-+ PINMUX_IPSR_DATA(IP6_15, VI0_DATA6_VI0_B6),
-+ PINMUX_IPSR_DATA(IP6_15, AVB_RXD5),
-+ PINMUX_IPSR_DATA(IP6_16, VI0_DATA7_VI0_B7),
-+ PINMUX_IPSR_DATA(IP6_16, AVB_RXD6),
-+ PINMUX_IPSR_DATA(IP6_19_17, VI0_CLKENB),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_19_17, I2C3_SCL, SEL_I2C03_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_19_17, SCIFA5_RXD_C, SEL_SCIFA5_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_19_17, IETX_C, SEL_IEB_2),
-+ PINMUX_IPSR_DATA(IP6_19_17, AVB_RXD7),
-+ PINMUX_IPSR_DATA(IP6_22_20, VI0_FIELD),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_22_20, I2C3_SDA, SEL_I2C03_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_22_20, SCIFA5_TXD_C, SEL_SCIFA5_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_22_20, IECLK_C, SEL_IEB_2),
-+ PINMUX_IPSR_DATA(IP6_22_20, AVB_RX_ER),
-+ PINMUX_IPSR_DATA(IP6_25_23, VI0_HSYNC_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_25_23, SCIF0_RXD_B, SEL_SCIF0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_25_23, I2C0_SCL_C, SEL_I2C00_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_25_23, IERX_C, SEL_IEB_2),
-+ PINMUX_IPSR_DATA(IP6_25_23, AVB_COL),
-+ PINMUX_IPSR_DATA(IP6_28_26, VI0_VSYNC_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_28_26, SCIF0_TXD_B, SEL_SCIF0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_28_26, I2C0_SDA_C, SEL_I2C00_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_28_26, AUDIO_CLKOUT_B, SEL_ADG_1),
-+ PINMUX_IPSR_DATA(IP6_28_26, AVB_TX_EN),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_31_29, ETH_MDIO, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP6_31_29, VI0_G0),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_31_29, MSIOF2_RXD_B, SEL_MSI2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_31_29, IIC0_SCL_D, SEL_IIC00_3),
-+ PINMUX_IPSR_DATA(IP6_31_29, AVB_TX_CLK),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_31_29, ADIDATA, SEL_RAD_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP6_31_29, AD_DI, SEL_ADI_0),
-+
-+ /* IPSR7 */
-+ PINMUX_IPSR_MODSEL_DATA(IP7_2_0, ETH_CRS_DV, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_2_0, VI0_G1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_2_0, MSIOF2_TXD_B, SEL_MSI2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_2_0, IIC0_SDA_D, SEL_IIC00_3),
-+ PINMUX_IPSR_DATA(IP7_2_0, AVB_TXD0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_2_0, ADICS_SAMP, SEL_RAD_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_2_0, AD_DO, SEL_ADI_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_5_3, ETH_RX_ER, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_5_3, VI0_G2),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_5_3, MSIOF2_SCK_B, SEL_MSI2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_5_3, CAN0_RX_B, SEL_CAN0_1),
-+ PINMUX_IPSR_DATA(IP7_5_3, AVB_TXD1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_5_3, ADICLK, SEL_RAD_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_5_3, AD_CLK, SEL_ADI_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_8_6, ETH_RXD0, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_8_6, VI0_G3),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_8_6, MSIOF2_SYNC_B, SEL_MSI2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_8_6, CAN0_TX_B, SEL_CAN0_1),
-+ PINMUX_IPSR_DATA(IP7_8_6, AVB_TXD2),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_8_6, ADICHS0, SEL_RAD_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_8_6, AD_NCS_N, SEL_ADI_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_11_9, ETH_RXD1, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_11_9, VI0_G4),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_11_9, MSIOF2_SS1_B, SEL_MSI2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_11_9, SCIF4_RXD_D, SEL_SCIF4_3),
-+ PINMUX_IPSR_DATA(IP7_11_9, AVB_TXD3),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_11_9, ADICHS1, SEL_RAD_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_14_12, ETH_LINK, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_14_12, VI0_G5),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_14_12, MSIOF2_SS2_B, SEL_MSI2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_14_12, SCIF4_TXD_D, SEL_SCIF4_3),
-+ PINMUX_IPSR_DATA(IP7_14_12, AVB_TXD4),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_14_12, ADICHS2, SEL_RAD_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_17_15, ETH_REFCLK, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_17_15, VI0_G6),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_17_15, SCIF2_SCK_C, SEL_SCIF2_2),
-+ PINMUX_IPSR_DATA(IP7_17_15, AVB_TXD5),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_17_15, SSI_SCK5_B, SEL_SSI5_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_20_18, ETH_TXD1, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_20_18, VI0_G7),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_20_18, SCIF2_RXD_C, SEL_SCIF2_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_20_18, IIC1_SCL_D, SEL_IIC01_3),
-+ PINMUX_IPSR_DATA(IP7_20_18, AVB_TXD6),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_20_18, SSI_WS5_B, SEL_SSI5_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_23_21, ETH_TX_EN, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_23_21, VI0_R0),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_23_21, SCIF2_TXD_C, SEL_SCIF2_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_23_21, IIC1_SDA_D, SEL_IIC01_3),
-+ PINMUX_IPSR_DATA(IP7_23_21, AVB_TXD7),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_23_21, SSI_SDATA5_B, SEL_SSI5_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_26_24, ETH_MAGIC, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_26_24, VI0_R1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_26_24, SCIF3_SCK_B, SEL_SCIF3_1),
-+ PINMUX_IPSR_DATA(IP7_26_24, AVB_TX_ER),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_26_24, SSI_SCK6_B, SEL_SSI6_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_29_27, ETH_TXD0, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP7_29_27, VI0_R2),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_29_27, SCIF3_RXD_B, SEL_SCIF3_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_29_27, I2C4_SCL_E, SEL_I2C04_4),
-+ PINMUX_IPSR_DATA(IP7_29_27, AVB_GTX_CLK),
-+ PINMUX_IPSR_MODSEL_DATA(IP7_29_27, SSI_WS6_B, SEL_SSI6_1),
-+ PINMUX_IPSR_DATA(IP7_31, DREQ0_N),
-+ PINMUX_IPSR_DATA(IP7_31, SCIFB1_RXD),
-+
-+ /* IPSR8 */
-+ PINMUX_IPSR_MODSEL_DATA(IP8_2_0, ETH_MDC, SEL_ETH_0),
-+ PINMUX_IPSR_DATA(IP8_2_0, VI0_R3),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_2_0, SCIF3_TXD_B, SEL_SCIF3_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_2_0, I2C4_SDA_E, SEL_I2C04_4),
-+ PINMUX_IPSR_DATA(IP8_2_0, AVB_MDC),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_2_0, SSI_SDATA6_B, SEL_SSI6_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_5_3, HSCIF0_HRX, SEL_HSCIF0_0),
-+ PINMUX_IPSR_DATA(IP8_5_3, VI0_R4),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_5_3, I2C1_SCL_C, SEL_I2C01_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_5_3, AUDIO_CLKA_B, SEL_ADG_1),
-+ PINMUX_IPSR_DATA(IP8_5_3, AVB_MDIO),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_5_3, SSI_SCK78_B, SEL_SSI7_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_8_6, HSCIF0_HTX, SEL_HSCIF0_0),
-+ PINMUX_IPSR_DATA(IP8_8_6, VI0_R5),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_8_6, I2C1_SDA_C, SEL_I2C01_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_8_6, AUDIO_CLKB_B, SEL_ADG_1),
-+ PINMUX_IPSR_DATA(IP8_5_3, AVB_LINK),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_8_6, SSI_WS78_B, SEL_SSI7_1),
-+ PINMUX_IPSR_DATA(IP8_11_9, HSCIF0_HCTS_N),
-+ PINMUX_IPSR_DATA(IP8_11_9, VI0_R6),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_11_9, SCIF0_RXD_D, SEL_SCIF0_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_11_9, I2C0_SCL_E, SEL_I2C00_4),
-+ PINMUX_IPSR_DATA(IP8_11_9, AVB_MAGIC),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_11_9, SSI_SDATA7_B, SEL_SSI7_1),
-+ PINMUX_IPSR_DATA(IP8_14_12, HSCIF0_HRTS_N),
-+ PINMUX_IPSR_DATA(IP8_14_12, VI0_R7),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_14_12, SCIF0_TXD_D, SEL_SCIF0_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_14_12, I2C0_SDA_E, SEL_I2C00_4),
-+ PINMUX_IPSR_DATA(IP8_14_12, AVB_PHY_INT),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_14_12, SSI_SDATA8_B, SEL_SSI8_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_16_15, HSCIF0_HSCK, SEL_HSCIF0_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_16_15, SCIF_CLK_B, SEL_SCIF0_1),
-+ PINMUX_IPSR_DATA(IP8_16_15, AVB_CRS),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_16_15, AUDIO_CLKC_B, SEL_ADG_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_19_17, I2C0_SCL, SEL_I2C00_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_19_17, SCIF0_RXD_C, SEL_SCIF0_2),
-+ PINMUX_IPSR_DATA(IP8_19_17, PWM5),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_19_17, TCLK1_B, SEL_TMU_1),
-+ PINMUX_IPSR_DATA(IP8_19_17, AVB_GTXREFCLK),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_19_17, CAN1_RX_D, SEL_CAN1_3),
-+ PINMUX_IPSR_DATA(IP8_19_17, TPUTO0_B),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_22_20, I2C0_SDA, SEL_I2C00_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_22_20, SCIF0_TXD_C, SEL_SCIF0_2),
-+ PINMUX_IPSR_DATA(IP8_22_20, TPUTO0),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_22_20, CAN_CLK, SEL_CAN_0),
-+ PINMUX_IPSR_DATA(IP8_22_20, DVC_MUTE),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_22_20, CAN1_TX_D, SEL_CAN1_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_25_23, I2C1_SCL, SEL_I2C01_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_25_23, SCIF4_RXD, SEL_SCIF4_0),
-+ PINMUX_IPSR_DATA(IP8_25_23, PWM5_B),
-+ PINMUX_IPSR_DATA(IP8_25_23, DU1_DR0),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_25_23, RIF1_SYNC_B, SEL_DR2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_25_23, TS_SDATA_D, SEL_TSIF0_3),
-+ PINMUX_IPSR_DATA(IP8_25_23, TPUTO1_B),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_28_26, I2C1_SDA, SEL_I2C01_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_28_26, SCIF4_TXD, SEL_SCIF4_0),
-+ PINMUX_IPSR_DATA(IP8_28_26, IRQ5),
-+ PINMUX_IPSR_DATA(IP8_28_26, DU1_DR1),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_28_26, RIF1_CLK_B, SEL_DR2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_28_26, TS_SCK_D, SEL_TSIF0_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_28_26, BPFCLK_C, SEL_DARC_2),
-+ PINMUX_IPSR_DATA(IP8_31_29, MSIOF0_RXD),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_31_29, SCIF5_RXD, SEL_SCIF5_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_31_29, I2C2_SCL_C, SEL_I2C02_2),
-+ PINMUX_IPSR_DATA(IP8_31_29, DU1_DR2),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_31_29, RIF1_D0_B, SEL_DR2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_31_29, TS_SDEN_D, SEL_TSIF0_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_31_29, FMCLK_C, SEL_DARC_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP8_31_29, RDS_CLK, SEL_RDS_0),
-+
-+ /* IPSR9 */
-+ PINMUX_IPSR_DATA(IP9_2_0, MSIOF0_TXD),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_2_0, SCIF5_TXD, SEL_SCIF5_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_2_0, I2C2_SDA_C, SEL_I2C02_2),
-+ PINMUX_IPSR_DATA(IP9_2_0, DU1_DR3),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_2_0, RIF1_D1_B, SEL_DR3_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_2_0, TS_SPSYNC_D, SEL_TSIF0_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_2_0, FMIN_C, SEL_DARC_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_2_0, RDS_DATA, SEL_RDS_0),
-+ PINMUX_IPSR_DATA(IP9_5_3, MSIOF0_SCK),
-+ PINMUX_IPSR_DATA(IP9_5_3, IRQ0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_5_3, TS_SDATA, SEL_TSIF0_0),
-+ PINMUX_IPSR_DATA(IP9_5_3, DU1_DR4),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_5_3, RIF1_SYNC, SEL_DR2_0),
-+ PINMUX_IPSR_DATA(IP9_5_3, TPUTO1_C),
-+ PINMUX_IPSR_DATA(IP9_8_6, MSIOF0_SYNC),
-+ PINMUX_IPSR_DATA(IP9_8_6, PWM1),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_8_6, TS_SCK, SEL_TSIF0_0),
-+ PINMUX_IPSR_DATA(IP9_8_6, DU1_DR5),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_8_6, RIF1_CLK, SEL_DR2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_8_6, BPFCLK_B, SEL_DARC_1),
-+ PINMUX_IPSR_DATA(IP9_11_9, MSIOF0_SS1),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_11_9, SCIFA0_RXD, SEL_SCIFA0_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_11_9, TS_SDEN, SEL_TSIF0_0),
-+ PINMUX_IPSR_DATA(IP9_11_9, DU1_DR6),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_11_9, RIF1_D0, SEL_DR2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_11_9, FMCLK_B, SEL_DARC_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_11_9, RDS_CLK_B, SEL_RDS_1),
-+ PINMUX_IPSR_DATA(IP9_14_12, MSIOF0_SS2),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_14_12, SCIFA0_TXD, SEL_SCIFA0_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_14_12, TS_SPSYNC, SEL_TSIF0_0),
-+ PINMUX_IPSR_DATA(IP9_14_12, DU1_DR7),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_14_12, RIF1_D1, SEL_DR3_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_14_12, FMIN_B, SEL_DARC_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_14_12, RDS_DATA_B, SEL_RDS_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_16_15, HSCIF1_HRX, SEL_HSCIF1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_16_15, I2C4_SCL, SEL_I2C04_0),
-+ PINMUX_IPSR_DATA(IP9_16_15, PWM6),
-+ PINMUX_IPSR_DATA(IP9_16_15, DU1_DG0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_18_17, HSCIF1_HTX, SEL_HSCIF1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_18_17, I2C4_SDA, SEL_I2C04_0),
-+ PINMUX_IPSR_DATA(IP9_18_17, TPUTO1),
-+ PINMUX_IPSR_DATA(IP9_18_17, DU1_DG1),
-+ PINMUX_IPSR_DATA(IP9_21_19, HSCIF1_HSCK),
-+ PINMUX_IPSR_DATA(IP9_21_19, PWM2),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_21_19, IETX, SEL_IEB_0),
-+ PINMUX_IPSR_DATA(IP9_21_19, DU1_DG2),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_21_19, REMOCON_B, SEL_RCN_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_21_19, SPEEDIN_B, SEL_RSP_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_21_19, VSP_B, SEL_SPDM_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_24_22, HSCIF1_HCTS_N, SEL_HSCIF1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_24_22, SCIFA4_RXD, SEL_SCIFA4_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_24_22, IECLK, SEL_IEB_0),
-+ PINMUX_IPSR_DATA(IP9_24_22, DU1_DG3),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_24_22, SSI_SCK1_B, SEL_SSI1_1),
-+ PINMUX_IPSR_DATA(IP9_24_22, CAN_DEBUG_HW_TRIGGER),
-+ PINMUX_IPSR_DATA(IP9_24_22, CC50_STATE32),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_27_25, HSCIF1_HRTS_N, SEL_HSCIF1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_27_25, SCIFA4_TXD, SEL_SCIFA4_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_27_25, IERX, SEL_IEB_0),
-+ PINMUX_IPSR_DATA(IP9_27_25, DU1_DG4),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_27_25, SSI_WS1_B, SEL_SSI1_1),
-+ PINMUX_IPSR_DATA(IP9_27_25, CAN_STEP0),
-+ PINMUX_IPSR_DATA(IP9_27_25, CC50_STATE33),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_30_28, SCIF1_SCK, SEL_SCIF1_0),
-+ PINMUX_IPSR_DATA(IP9_30_28, PWM3),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_30_28, TCLK2, SEL_TMU_0),
-+ PINMUX_IPSR_DATA(IP9_30_28, DU1_DG5),
-+ PINMUX_IPSR_MODSEL_DATA(IP9_30_28, SSI_SDATA1_B, SEL_SSI1_1),
-+ PINMUX_IPSR_DATA(IP9_30_28, CAN_TXCLK),
-+ PINMUX_IPSR_DATA(IP9_30_28, CC50_STATE34),
-+
-+ /* IPSR10 */
-+ PINMUX_IPSR_MODSEL_DATA(IP10_2_0, SCIF1_RXD, SEL_SCIF1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_2_0, IIC0_SCL, SEL_IIC00_0),
-+ PINMUX_IPSR_DATA(IP10_2_0, DU1_DG6),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_2_0, SSI_SCK2_B, SEL_SSI2_1),
-+ PINMUX_IPSR_DATA(IP10_2_0, CAN_DEBUGOUT0),
-+ PINMUX_IPSR_DATA(IP10_2_0, CC50_STATE35),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_5_3, SCIF1_TXD, SEL_SCIF1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_5_3, IIC0_SDA, SEL_IIC00_0),
-+ PINMUX_IPSR_DATA(IP10_5_3, DU1_DG7),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_5_3, SSI_WS2_B, SEL_SSI2_1),
-+ PINMUX_IPSR_DATA(IP10_5_3, CAN_DEBUGOUT1),
-+ PINMUX_IPSR_DATA(IP10_5_3, CC50_STATE36),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_8_6, SCIF2_RXD, SEL_SCIF2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_8_6, IIC1_SCL, SEL_IIC01_0),
-+ PINMUX_IPSR_DATA(IP10_8_6, DU1_DB0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_8_6, SSI_SDATA2_B, SEL_SSI2_1),
-+ PINMUX_IPSR_DATA(IP10_8_6, USB0_EXTLP),
-+ PINMUX_IPSR_DATA(IP10_8_6, CAN_DEBUGOUT2),
-+ PINMUX_IPSR_DATA(IP10_8_6, CC50_STATE37),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_11_9, SCIF2_TXD, SEL_SCIF2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_11_9, IIC1_SDA, SEL_IIC01_0),
-+ PINMUX_IPSR_DATA(IP10_11_9, DU1_DB1),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_11_9, SSI_SCK9_B, SEL_SSI9_1),
-+ PINMUX_IPSR_DATA(IP10_11_9, USB0_OVC1),
-+ PINMUX_IPSR_DATA(IP10_11_9, CAN_DEBUGOUT3),
-+ PINMUX_IPSR_DATA(IP10_11_9, CC50_STATE38),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_14_12, SCIF2_SCK, SEL_SCIF2_0),
-+ PINMUX_IPSR_DATA(IP10_14_12, IRQ1),
-+ PINMUX_IPSR_DATA(IP10_14_12, DU1_DB2),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_14_12, SSI_WS9_B, SEL_SSI9_1),
-+ PINMUX_IPSR_DATA(IP10_14_12, USB0_IDIN),
-+ PINMUX_IPSR_DATA(IP10_14_12, CAN_DEBUGOUT4),
-+ PINMUX_IPSR_DATA(IP10_14_12, CC50_STATE39),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_17_15, SCIF3_SCK, SEL_SCIF3_0),
-+ PINMUX_IPSR_DATA(IP10_17_15, IRQ2),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_17_15, BPFCLK_D, SEL_DARC_3),
-+ PINMUX_IPSR_DATA(IP10_17_15, DU1_DB3),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_17_15, SSI_SDATA9_B, SEL_SSI9_1),
-+ PINMUX_IPSR_DATA(IP10_17_15, TANS2),
-+ PINMUX_IPSR_DATA(IP10_17_15, CAN_DEBUGOUT5),
-+ PINMUX_IPSR_DATA(IP10_17_15, CC50_OSCOUT),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_20_18, SCIF3_RXD, SEL_SCIF3_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_20_18, I2C1_SCL_E, SEL_I2C01_4),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_20_18, FMCLK_D, SEL_DARC_3),
-+ PINMUX_IPSR_DATA(IP10_20_18, DU1_DB4),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_20_18, AUDIO_CLKA_C, SEL_ADG_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_20_18, SSI_SCK4_B, SEL_SSI4_1),
-+ PINMUX_IPSR_DATA(IP10_20_18, CAN_DEBUGOUT6),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_20_18, RDS_CLK_C, SEL_RDS_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_23_21, SCIF3_TXD, SEL_SCIF3_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_23_21, I2C1_SDA_E, SEL_I2C01_4),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_23_21, FMIN_D, SEL_DARC_3),
-+ PINMUX_IPSR_DATA(IP10_23_21, DU1_DB5),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_23_21, AUDIO_CLKB_C, SEL_ADG_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_23_21, SSI_WS4_B, SEL_SSI4_1),
-+ PINMUX_IPSR_DATA(IP10_23_21, CAN_DEBUGOUT7),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_23_21, RDS_DATA_C, SEL_RDS_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_26_24, I2C2_SCL, SEL_I2C02_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_26_24, SCIFA5_RXD, SEL_SCIFA5_0),
-+ PINMUX_IPSR_DATA(IP10_26_24, DU1_DB6),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_26_24, AUDIO_CLKC_C, SEL_ADG_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_26_24, SSI_SDATA4_B, SEL_SSI4_1),
-+ PINMUX_IPSR_DATA(IP10_26_24, CAN_DEBUGOUT8),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_29_27, I2C2_SDA, SEL_I2C02_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_29_27, SCIFA5_TXD, SEL_SCIFA5_0),
-+ PINMUX_IPSR_DATA(IP10_29_27, DU1_DB7),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_29_27, AUDIO_CLKOUT_C, SEL_ADG_2),
-+ PINMUX_IPSR_DATA(IP10_29_27, CAN_DEBUGOUT9),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_31_30, SSI_SCK5, SEL_SSI5_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP10_31_30, SCIFA3_SCK, SEL_SCIFA3_0),
-+ PINMUX_IPSR_DATA(IP10_31_30, DU1_DOTCLKIN),
-+ PINMUX_IPSR_DATA(IP10_31_30, CAN_DEBUGOUT10),
-+
-+ /* IPSR11 */
-+ PINMUX_IPSR_MODSEL_DATA(IP11_2_0, SSI_WS5, SEL_SSI5_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_2_0, SCIFA3_RXD, SEL_SCIFA3_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_2_0, I2C3_SCL_C, SEL_I2C03_2),
-+ PINMUX_IPSR_DATA(IP11_2_0, DU1_DOTCLKOUT0),
-+ PINMUX_IPSR_DATA(IP11_2_0, CAN_DEBUGOUT11),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_5_3, SSI_SDATA5, SEL_SSI5_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_5_3, SCIFA3_TXD, SEL_SCIFA3_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_5_3, I2C3_SDA_C, SEL_I2C03_2),
-+ PINMUX_IPSR_DATA(IP11_5_3, DU1_DOTCLKOUT1),
-+ PINMUX_IPSR_DATA(IP11_5_3, CAN_DEBUGOUT12),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_7_6, SSI_SCK6, SEL_SSI6_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_7_6, SCIFA1_SCK_B, SEL_SCIFA1_1),
-+ PINMUX_IPSR_DATA(IP11_7_6, DU1_EXHSYNC_DU1_HSYNC),
-+ PINMUX_IPSR_DATA(IP11_7_6, CAN_DEBUGOUT13),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_10_8, SSI_WS6, SEL_SSI6_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_10_8, SCIFA1_RXD_B, SEL_SCIFA1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_10_8, I2C4_SCL_C, SEL_I2C04_2),
-+ PINMUX_IPSR_DATA(IP11_10_8, DU1_EXVSYNC_DU1_VSYNC),
-+ PINMUX_IPSR_DATA(IP11_10_8, CAN_DEBUGOUT14),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_13_11, SSI_SDATA6, SEL_SSI6_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_13_11, SCIFA1_TXD_B, SEL_SCIFA1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_13_11, I2C4_SDA_C, SEL_I2C04_2),
-+ PINMUX_IPSR_DATA(IP11_13_11, DU1_EXODDF_DU1_ODDF_DISP_CDE),
-+ PINMUX_IPSR_DATA(IP11_13_11, CAN_DEBUGOUT15),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_15_14, SSI_SCK78, SEL_SSI7_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_15_14, SCIFA2_SCK_B, SEL_SCIFA2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_15_14, IIC0_SDA_C, SEL_IIC00_2),
-+ PINMUX_IPSR_DATA(IP11_15_14, DU1_DISP),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_17_16, SSI_WS78, SEL_SSI7_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_17_16, SCIFA2_RXD_B, SEL_SCIFA2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_17_16, IIC0_SCL_C, SEL_IIC00_2),
-+ PINMUX_IPSR_DATA(IP11_17_16, DU1_CDE),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_20_18, SSI_SDATA7, SEL_SSI7_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_20_18, SCIFA2_TXD_B, SEL_SCIFA2_1),
-+ PINMUX_IPSR_DATA(IP11_20_18, IRQ8),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_20_18, AUDIO_CLKA_D, SEL_ADG_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_20_18, CAN_CLK_D, SEL_CAN_3),
-+ PINMUX_IPSR_DATA(IP11_20_18, PCMOE_N),
-+ PINMUX_IPSR_DATA(IP11_23_21, SSI_SCK0129),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_23_21, MSIOF1_RXD_B, SEL_MSI1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_23_21, SCIF5_RXD_D, SEL_SCIF5_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_23_21, ADIDATA_B, SEL_RAD_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_23_21, AD_DI_B, SEL_ADI_1),
-+ PINMUX_IPSR_DATA(IP11_23_21, PCMWE_N),
-+ PINMUX_IPSR_DATA(IP11_26_24, SSI_WS0129),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_26_24, MSIOF1_TXD_B, SEL_MSI1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_26_24, SCIF5_TXD_D, SEL_SCIF5_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_26_24, ADICS_SAMP_B, SEL_RAD_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_26_24, AD_DO_B, SEL_ADI_1),
-+ PINMUX_IPSR_DATA(IP11_29_27, SSI_SDATA0),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_29_27, MSIOF1_SCK_B, SEL_MSI1_1),
-+ PINMUX_IPSR_DATA(IP11_29_27, PWM0_B),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_29_27, ADICLK_B, SEL_RAD_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP11_29_27, AD_CLK_B, SEL_ADI_1),
-+
-+ /* IPSR12 */
-+ PINMUX_IPSR_DATA(IP12_2_0, SSI_SCK34),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_2_0, MSIOF1_SYNC_B, SEL_MSI1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_2_0, SCIFA1_SCK_C, SEL_SCIFA1_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_2_0, ADICHS0_B, SEL_RAD_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_2_0, AD_NCS_N_B, SEL_ADI_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_2_0, DREQ1_N_B, SEL_LBS_1),
-+ PINMUX_IPSR_DATA(IP12_5_3, SSI_WS34),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_5_3, MSIOF1_SS1_B, SEL_MSI1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_5_3, SCIFA1_RXD_C, SEL_SCIFA1_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_5_3, ADICHS1_B, SEL_RAD_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_5_3, CAN1_RX_C, SEL_CAN1_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_5_3, DACK1_B, SEL_LBS_1),
-+ PINMUX_IPSR_DATA(IP12_8_6, SSI_SDATA3),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_8_6, MSIOF1_SS2_B, SEL_MSI1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_8_6, SCIFA1_TXD_C, SEL_SCIFA1_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_8_6, ADICHS2_B, SEL_RAD_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_8_6, CAN1_TX_C, SEL_CAN1_2),
-+ PINMUX_IPSR_DATA(IP12_8_6, DREQ2_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_10_9, SSI_SCK4, SEL_SSI4_0),
-+ PINMUX_IPSR_DATA(IP12_10_9, MLB_CLK),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_10_9, IETX_B, SEL_IEB_1),
-+ PINMUX_IPSR_DATA(IP12_10_9, IRD_TX),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_12_11, SSI_WS4, SEL_SSI4_0),
-+ PINMUX_IPSR_DATA(IP12_12_11, MLB_SIG),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_12_11, IECLK_B, SEL_IEB_1),
-+ PINMUX_IPSR_DATA(IP12_12_11, IRD_RX),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_14_13, SSI_SDATA4, SEL_SSI4_0),
-+ PINMUX_IPSR_DATA(IP12_14_13, MLB_DAT),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_14_13, IERX_B, SEL_IEB_1),
-+ PINMUX_IPSR_DATA(IP12_14_13, IRD_SCK),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_17_15, SSI_SDATA8, SEL_SSI8_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_17_15, SCIF1_SCK_B, SEL_SCIF1_1),
-+ PINMUX_IPSR_DATA(IP12_17_15, PWM1_B),
-+ PINMUX_IPSR_DATA(IP12_17_15, IRQ9),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_17_15, REMOCON, SEL_RCN_0),
-+ PINMUX_IPSR_DATA(IP12_17_15, DACK2),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_17_15, ETH_MDIO_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_20_18, SSI_SCK1, SEL_SSI1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_20_18, SCIF1_RXD_B, SEL_SCIF1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_20_18, IIC1_SCL_C, SEL_IIC01_2),
-+ PINMUX_IPSR_DATA(IP12_20_18, VI1_CLK),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_20_18, CAN0_RX_D, SEL_CAN0_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_20_18, AVB_AVTP_CAPTURE, SEL_AVB_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_20_18, ETH_CRS_DV_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_23_21, SSI_WS1, SEL_SSI1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_23_21, SCIF1_TXD_B, SEL_SCIF1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_23_21, IIC1_SDA_C, SEL_IIC01_2),
-+ PINMUX_IPSR_DATA(IP12_23_21, VI1_DATA0),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_23_21, CAN0_TX_D, SEL_CAN0_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_23_21, AVB_AVTP_MATCH, SEL_AVB_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_23_21, ETH_RX_ER_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_26_24, SSI_SDATA1, SEL_SSI1_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_26_24, HSCIF1_HRX_B, SEL_HSCIF1_1),
-+ PINMUX_IPSR_DATA(IP12_26_24, VI1_DATA1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_26_24, SDATA, SEL_FSN_0),
-+ PINMUX_IPSR_DATA(IP12_26_24, ATAG0_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_26_24, ETH_RXD0_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_29_27, SSI_SCK2, SEL_SSI2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_29_27, HSCIF1_HTX_B, SEL_HSCIF1_1),
-+ PINMUX_IPSR_DATA(IP12_29_27, VI1_DATA2),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_29_27, MDATA, SEL_FSN_0),
-+ PINMUX_IPSR_DATA(IP12_29_27, ATAWR0_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP12_29_27, ETH_RXD1_B, SEL_ETH_1),
-+
-+ /* IPSR13 */
-+ PINMUX_IPSR_MODSEL_DATA(IP13_2_0, SSI_WS2, SEL_SSI2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_2_0, HSCIF1_HCTS_N_B, SEL_HSCIF1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_2_0, SCIFA0_RXD_D, SEL_SCIFA0_3),
-+ PINMUX_IPSR_DATA(IP13_2_0, VI1_DATA3),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_2_0, SCKZ, SEL_FSN_0),
-+ PINMUX_IPSR_DATA(IP13_2_0, ATACS00_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_2_0, ETH_LINK_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_5_3, SSI_SDATA2, SEL_SSI2_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_5_3, HSCIF1_HRTS_N_B, SEL_HSCIF1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_5_3, SCIFA0_TXD_D, SEL_SCIFA0_3),
-+ PINMUX_IPSR_DATA(IP13_5_3, VI1_DATA4),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_5_3, STM_N, SEL_FSN_0),
-+ PINMUX_IPSR_DATA(IP13_5_3, ATACS10_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_5_3, ETH_REFCLK_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_8_6, SSI_SCK9, SEL_SSI9_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_8_6, SCIF2_SCK_B, SEL_SCIF2_1),
-+ PINMUX_IPSR_DATA(IP13_8_6, PWM2_B),
-+ PINMUX_IPSR_DATA(IP13_8_6, VI1_DATA5),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_8_6, MTS_N, SEL_FSN_0),
-+ PINMUX_IPSR_DATA(IP13_8_6, EX_WAIT1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_8_6, ETH_TXD1_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_11_9, SSI_WS9, SEL_SSI9_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_11_9, SCIF2_RXD_B, SEL_SCIF2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_11_9, I2C3_SCL_E, SEL_I2C03_4),
-+ PINMUX_IPSR_DATA(IP13_11_9, VI1_DATA6),
-+ PINMUX_IPSR_DATA(IP13_11_9, ATARD0_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_11_9, ETH_TX_EN_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_14_12, SSI_SDATA9, SEL_SSI9_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_14_12, SCIF2_TXD_B, SEL_SCIF2_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_14_12, I2C3_SDA_E, SEL_I2C03_4),
-+ PINMUX_IPSR_DATA(IP13_14_12, VI1_DATA7),
-+ PINMUX_IPSR_DATA(IP13_14_12, ATADIR0_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_14_12, ETH_MAGIC_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_17_15, AUDIO_CLKA, SEL_ADG_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_17_15, I2C0_SCL_B, SEL_I2C00_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_17_15, SCIFA4_RXD_D, SEL_SCIFA4_3),
-+ PINMUX_IPSR_DATA(IP13_17_15, VI1_CLKENB),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_17_15, TS_SDATA_C, SEL_TSIF0_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_17_15, RIF0_SYNC_B, SEL_DR0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_17_15, ETH_TXD0_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_20_18, AUDIO_CLKB, SEL_ADG_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_20_18, I2C0_SDA_B, SEL_I2C00_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_20_18, SCIFA4_TXD_D, SEL_SCIFA4_3),
-+ PINMUX_IPSR_DATA(IP13_20_18, VI1_FIELD),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_20_18, TS_SCK_C, SEL_TSIF0_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_20_18, RIF0_CLK_B, SEL_DR0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_20_18, BPFCLK_E, SEL_DARC_4),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_20_18, ETH_MDC_B, SEL_ETH_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_23_21, AUDIO_CLKC, SEL_ADG_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_23_21, I2C4_SCL_B, SEL_I2C04_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_23_21, SCIFA5_RXD_D, SEL_SCIFA5_3),
-+ PINMUX_IPSR_DATA(IP13_23_21, VI1_HSYNC_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_23_21, TS_SDEN_C, SEL_TSIF0_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_23_21, RIF0_D0_B, SEL_DR0_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_23_21, FMCLK_E, SEL_DARC_4),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_23_21, RDS_CLK_D, SEL_RDS_3),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_26_24, AUDIO_CLKOUT, SEL_ADG_0),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_26_24, I2C4_SDA_B, SEL_I2C04_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_26_24, SCIFA5_TXD_D, SEL_SCIFA5_3),
-+ PINMUX_IPSR_DATA(IP13_26_24, VI1_VSYNC_N),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_26_24, TS_SPSYNC_C, SEL_TSIF0_2),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_26_24, RIF0_D1_B, SEL_DR1_1),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_26_24, FMIN_E, SEL_DARC_4),
-+ PINMUX_IPSR_MODSEL_DATA(IP13_26_24, RDS_DATA_D, SEL_RDS_3),
-+};
-+
-+static const struct sh_pfc_pin pinmux_pins[] = {
-+ PINMUX_GPIO_GP_ALL(),
-+};
-+
-+/* - ETH -------------------------------------------------------------------- */
-+static const unsigned int eth_link_pins[] = {
-+ /* LINK */
-+ RCAR_GP_PIN(3, 18),
-+};
-+static const unsigned int eth_link_mux[] = {
-+ ETH_LINK_MARK,
-+};
-+static const unsigned int eth_magic_pins[] = {
-+ /* MAGIC */
-+ RCAR_GP_PIN(3, 22),
-+};
-+static const unsigned int eth_magic_mux[] = {
-+ ETH_MAGIC_MARK,
-+};
-+static const unsigned int eth_mdio_pins[] = {
-+ /* MDC, MDIO */
-+ RCAR_GP_PIN(3, 24), RCAR_GP_PIN(3, 13),
-+};
-+static const unsigned int eth_mdio_mux[] = {
-+ ETH_MDC_MARK, ETH_MDIO_MARK,
-+};
-+static const unsigned int eth_rmii_pins[] = {
-+ /* RXD[0:1], RX_ER, CRS_DV, TXD[0:1], TX_EN, REF_CLK */
-+ RCAR_GP_PIN(3, 16), RCAR_GP_PIN(3, 17), RCAR_GP_PIN(3, 15),
-+ RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 23), RCAR_GP_PIN(3, 20),
-+ RCAR_GP_PIN(3, 21), RCAR_GP_PIN(3, 19),
-+};
-+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,
-+};
-+static const unsigned int eth_link_b_pins[] = {
-+ /* LINK */
-+ RCAR_GP_PIN(5, 15),
-+};
-+static const unsigned int eth_link_b_mux[] = {
-+ ETH_LINK_B_MARK,
-+};
-+static const unsigned int eth_magic_b_pins[] = {
-+ /* MAGIC */
-+ RCAR_GP_PIN(5, 19),
-+};
-+static const unsigned int eth_magic_b_mux[] = {
-+ ETH_MAGIC_B_MARK,
-+};
-+static const unsigned int eth_mdio_b_pins[] = {
-+ /* MDC, MDIO */
-+ RCAR_GP_PIN(5, 21), RCAR_GP_PIN(5, 10),
-+};
-+static const unsigned int eth_mdio_b_mux[] = {
-+ ETH_MDC_B_MARK, ETH_MDIO_B_MARK,
-+};
-+static const unsigned int eth_rmii_b_pins[] = {
-+ /* RXD[0:1], RX_ER, CRS_DV, TXD[0:1], TX_EN, REF_CLK */
-+ RCAR_GP_PIN(5, 13), RCAR_GP_PIN(5, 14), RCAR_GP_PIN(5, 12),
-+ RCAR_GP_PIN(5, 11), RCAR_GP_PIN(5, 20), RCAR_GP_PIN(5, 17),
-+ RCAR_GP_PIN(5, 18), RCAR_GP_PIN(5, 16),
-+};
-+static const unsigned int eth_rmii_b_mux[] = {
-+ ETH_RXD0_B_MARK, ETH_RXD1_B_MARK, ETH_RX_ER_B_MARK, ETH_CRS_DV_B_MARK,
-+ ETH_TXD0_B_MARK, ETH_TXD1_B_MARK, ETH_TX_EN_B_MARK, ETH_REFCLK_B_MARK,
-+};
-+/* - HSCIF0 ----------------------------------------------------------------- */
-+static const unsigned int hscif0_data_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(3, 25), RCAR_GP_PIN(3, 26),
-+};
-+static const unsigned int hscif0_data_mux[] = {
-+ HSCIF0_HRX_MARK, HSCIF0_HTX_MARK,
-+};
-+static const unsigned int hscif0_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(3, 29),
-+};
-+static const unsigned int hscif0_clk_mux[] = {
-+ HSCIF0_HSCK_MARK,
-+};
-+static const unsigned int hscif0_ctrl_pins[] = {
-+ /* RTS, CTS */
-+ RCAR_GP_PIN(3, 28), RCAR_GP_PIN(3, 27),
-+};
-+static const unsigned int hscif0_ctrl_mux[] = {
-+ HSCIF0_HRTS_N_MARK, HSCIF0_HCTS_N_MARK,
-+};
-+static const unsigned int hscif0_data_b_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(0, 30), RCAR_GP_PIN(0, 31),
-+};
-+static const unsigned int hscif0_data_b_mux[] = {
-+ HSCIF0_HRX_B_MARK, HSCIF0_HTX_B_MARK,
-+};
-+static const unsigned int hscif0_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(1, 0),
-+};
-+static const unsigned int hscif0_clk_b_mux[] = {
-+ HSCIF0_HSCK_B_MARK,
-+};
-+/* - HSCIF1 ----------------------------------------------------------------- */
-+static const unsigned int hscif1_data_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(4, 8), RCAR_GP_PIN(4, 9),
-+};
-+static const unsigned int hscif1_data_mux[] = {
-+ HSCIF1_HRX_MARK, HSCIF1_HTX_MARK,
-+};
-+static const unsigned int hscif1_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(4, 10),
-+};
-+static const unsigned int hscif1_clk_mux[] = {
-+ HSCIF1_HSCK_MARK,
-+};
-+static const unsigned int hscif1_ctrl_pins[] = {
-+ /* RTS, CTS */
-+ RCAR_GP_PIN(4, 12), RCAR_GP_PIN(4, 11),
-+};
-+static const unsigned int hscif1_ctrl_mux[] = {
-+ HSCIF1_HRTS_N_MARK, HSCIF1_HCTS_N_MARK,
-+};
-+static const unsigned int hscif1_data_b_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(5, 13), RCAR_GP_PIN(5, 14),
-+};
-+static const unsigned int hscif1_data_b_mux[] = {
-+ HSCIF1_HRX_B_MARK, HSCIF1_HTX_B_MARK,
-+};
-+static const unsigned int hscif1_ctrl_b_pins[] = {
-+ /* RTS, CTS */
-+ RCAR_GP_PIN(5, 16), RCAR_GP_PIN(5, 15),
-+};
-+static const unsigned int hscif1_ctrl_b_mux[] = {
-+ HSCIF1_HRTS_N_B_MARK, HSCIF1_HCTS_N_B_MARK,
-+};
-+/* - HSCIF2 ----------------------------------------------------------------- */
-+static const unsigned int hscif2_data_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
-+};
-+static const unsigned int hscif2_data_mux[] = {
-+ HSCIF2_HRX_MARK, HSCIF2_HTX_MARK,
-+};
-+static const unsigned int hscif2_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(0, 10),
-+};
-+static const unsigned int hscif2_clk_mux[] = {
-+ HSCIF2_HSCK_MARK,
-+};
-+static const unsigned int hscif2_ctrl_pins[] = {
-+ /* RTS, CTS */
-+ RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 11),
-+};
-+static const unsigned int hscif2_ctrl_mux[] = {
-+ HSCIF2_HRTS_N_MARK, HSCIF2_HCTS_N_MARK,
-+};
-+/* - I2C0 ------------------------------------------------------------------- */
-+static const unsigned int i2c0_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(3, 30), RCAR_GP_PIN(3, 31),
-+};
-+static const unsigned int i2c0_mux[] = {
-+ I2C0_SCL_MARK, I2C0_SDA_MARK,
-+};
-+static const unsigned int i2c0_b_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(5, 20), RCAR_GP_PIN(5, 21),
-+};
-+static const unsigned int i2c0_b_mux[] = {
-+ I2C0_SCL_B_MARK, I2C0_SDA_B_MARK,
-+};
-+static const unsigned int i2c0_c_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(3, 11), RCAR_GP_PIN(3, 12),
-+};
-+static const unsigned int i2c0_c_mux[] = {
-+ I2C0_SCL_C_MARK, I2C0_SDA_C_MARK,
-+};
-+static const unsigned int i2c0_d_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(0, 5), RCAR_GP_PIN(0, 6),
-+};
-+static const unsigned int i2c0_d_mux[] = {
-+ I2C0_SCL_D_MARK, I2C0_SDA_D_MARK,
-+};
-+static const unsigned int i2c0_e_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(3, 27), RCAR_GP_PIN(3, 28),
-+};
-+static const unsigned int i2c0_e_mux[] = {
-+ I2C0_SCL_E_MARK, I2C0_SDA_E_MARK,
-+};
-+/* - I2C1 ------------------------------------------------------------------- */
-+static const unsigned int i2c1_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(4, 0), RCAR_GP_PIN(4, 1),
-+};
-+static const unsigned int i2c1_mux[] = {
-+ I2C1_SCL_MARK, I2C1_SDA_MARK,
-+};
-+static const unsigned int i2c1_b_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
-+};
-+static const unsigned int i2c1_b_mux[] = {
-+ I2C1_SCL_B_MARK, I2C1_SDA_B_MARK,
-+};
-+static const unsigned int i2c1_c_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(3, 25), RCAR_GP_PIN(3, 26),
-+};
-+static const unsigned int i2c1_c_mux[] = {
-+ I2C1_SCL_C_MARK, I2C1_SDA_C_MARK,
-+};
-+static const unsigned int i2c1_d_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(0, 11), RCAR_GP_PIN(0, 12),
-+};
-+static const unsigned int i2c1_d_mux[] = {
-+ I2C1_SCL_D_MARK, I2C1_SDA_D_MARK,
-+};
-+static const unsigned int i2c1_e_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(4, 20), RCAR_GP_PIN(4, 21),
-+};
-+static const unsigned int i2c1_e_mux[] = {
-+ I2C1_SCL_E_MARK, I2C1_SDA_E_MARK,
-+};
-+/* - I2C2 ------------------------------------------------------------------- */
-+static const unsigned int i2c2_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(4, 22), RCAR_GP_PIN(4, 23),
-+};
-+static const unsigned int i2c2_mux[] = {
-+ I2C2_SCL_MARK, I2C2_SDA_MARK,
-+};
-+static const unsigned int i2c2_b_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25),
-+};
-+static const unsigned int i2c2_b_mux[] = {
-+ I2C2_SCL_B_MARK, I2C2_SDA_B_MARK,
-+};
-+static const unsigned int i2c2_c_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
-+};
-+static const unsigned int i2c2_c_mux[] = {
-+ I2C2_SCL_C_MARK, I2C2_SDA_C_MARK,
-+};
-+static const unsigned int i2c2_d_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1),
-+};
-+static const unsigned int i2c2_d_mux[] = {
-+ I2C2_SCL_D_MARK, I2C2_SDA_D_MARK,
-+};
-+static const unsigned int i2c2_e_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(1, 16), RCAR_GP_PIN(1, 17),
-+};
-+static const unsigned int i2c2_e_mux[] = {
-+ I2C2_SCL_E_MARK, I2C2_SDA_E_MARK,
-+};
-+/* - I2C3 ------------------------------------------------------------------- */
-+static const unsigned int i2c3_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(3, 9), RCAR_GP_PIN(3, 10),
-+};
-+static const unsigned int i2c3_mux[] = {
-+ I2C3_SCL_MARK, I2C3_SDA_MARK,
-+};
-+static const unsigned int i2c3_b_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(0, 3), RCAR_GP_PIN(0, 4),
-+};
-+static const unsigned int i2c3_b_mux[] = {
-+ I2C3_SCL_B_MARK, I2C3_SDA_B_MARK,
-+};
-+static const unsigned int i2c3_c_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(4, 25), RCAR_GP_PIN(4, 26),
-+};
-+static const unsigned int i2c3_c_mux[] = {
-+ I2C3_SCL_C_MARK, I2C3_SDA_C_MARK,
-+};
-+static const unsigned int i2c3_d_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(2, 8), RCAR_GP_PIN(2, 9),
-+};
-+static const unsigned int i2c3_d_mux[] = {
-+ I2C3_SCL_D_MARK, I2C3_SDA_D_MARK,
-+};
-+static const unsigned int i2c3_e_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(5, 18), RCAR_GP_PIN(5, 19),
-+};
-+static const unsigned int i2c3_e_mux[] = {
-+ I2C3_SCL_E_MARK, I2C3_SDA_E_MARK,
-+};
-+/* - I2C4 ------------------------------------------------------------------- */
-+static const unsigned int i2c4_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(4, 8), RCAR_GP_PIN(4, 9),
-+};
-+static const unsigned int i2c4_mux[] = {
-+ I2C4_SCL_MARK, I2C4_SDA_MARK,
-+};
-+static const unsigned int i2c4_b_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(5, 22), RCAR_GP_PIN(5, 23),
-+};
-+static const unsigned int i2c4_b_mux[] = {
-+ I2C4_SCL_B_MARK, I2C4_SDA_B_MARK,
-+};
-+static const unsigned int i2c4_c_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(4, 28), RCAR_GP_PIN(4, 29),
-+};
-+static const unsigned int i2c4_c_mux[] = {
-+ I2C4_SCL_C_MARK, I2C4_SDA_C_MARK,
-+};
-+static const unsigned int i2c4_d_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(2, 16), RCAR_GP_PIN(2, 17),
-+};
-+static const unsigned int i2c4_d_mux[] = {
-+ I2C4_SCL_D_MARK, I2C4_SDA_D_MARK,
-+};
-+static const unsigned int i2c4_e_pins[] = {
-+ /* SCL, SDA */
-+ RCAR_GP_PIN(3, 23), RCAR_GP_PIN(3, 24),
-+};
-+static const unsigned int i2c4_e_mux[] = {
-+ I2C4_SCL_E_MARK, I2C4_SDA_E_MARK,
-+};
-+/* - INTC ------------------------------------------------------------------- */
-+static const unsigned int intc_irq0_pins[] = {
-+ /* IRQ0 */
-+ RCAR_GP_PIN(4, 4),
-+};
-+static const unsigned int intc_irq0_mux[] = {
-+ IRQ0_MARK,
-+};
-+static const unsigned int intc_irq1_pins[] = {
-+ /* IRQ1 */
-+ RCAR_GP_PIN(4, 18),
-+};
-+static const unsigned int intc_irq1_mux[] = {
-+ IRQ1_MARK,
-+};
-+static const unsigned int intc_irq2_pins[] = {
-+ /* IRQ2 */
-+ RCAR_GP_PIN(4, 19),
-+};
-+static const unsigned int intc_irq2_mux[] = {
-+ IRQ2_MARK,
-+};
-+static const unsigned int intc_irq3_pins[] = {
-+ /* IRQ3 */
-+ RCAR_GP_PIN(0, 7),
-+};
-+static const unsigned int intc_irq3_mux[] = {
-+ IRQ3_MARK,
-+};
-+static const unsigned int intc_irq4_pins[] = {
-+ /* IRQ4 */
-+ RCAR_GP_PIN(0, 0),
-+};
-+static const unsigned int intc_irq4_mux[] = {
-+ IRQ4_MARK,
-+};
-+static const unsigned int intc_irq5_pins[] = {
-+ /* IRQ5 */
-+ RCAR_GP_PIN(4, 1),
-+};
-+static const unsigned int intc_irq5_mux[] = {
-+ IRQ5_MARK,
-+};
-+static const unsigned int intc_irq6_pins[] = {
-+ /* IRQ6 */
-+ RCAR_GP_PIN(0, 10),
-+};
-+static const unsigned int intc_irq6_mux[] = {
-+ IRQ6_MARK,
-+};
-+static const unsigned int intc_irq7_pins[] = {
-+ /* IRQ7 */
-+ RCAR_GP_PIN(6, 15),
-+};
-+static const unsigned int intc_irq7_mux[] = {
-+ IRQ7_MARK,
-+};
-+static const unsigned int intc_irq8_pins[] = {
-+ /* IRQ8 */
-+ RCAR_GP_PIN(5, 0),
-+};
-+static const unsigned int intc_irq8_mux[] = {
-+ IRQ8_MARK,
-+};
-+static const unsigned int intc_irq9_pins[] = {
-+ /* IRQ9 */
-+ RCAR_GP_PIN(5, 10),
-+};
-+static const unsigned int intc_irq9_mux[] = {
-+ IRQ9_MARK,
-+};
-+/* - MSIOF0 ----------------------------------------------------------------- */
-+static const unsigned int msiof0_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(4, 4),
-+};
-+static const unsigned int msiof0_clk_mux[] = {
-+ MSIOF0_SCK_MARK,
-+};
-+static const unsigned int msiof0_sync_pins[] = {
-+ /* SYNC */
-+ RCAR_GP_PIN(4, 5),
-+};
-+static const unsigned int msiof0_sync_mux[] = {
-+ MSIOF0_SYNC_MARK,
-+};
-+static const unsigned int msiof0_ss1_pins[] = {
-+ /* SS1 */
-+ RCAR_GP_PIN(4, 6),
-+};
-+static const unsigned int msiof0_ss1_mux[] = {
-+ MSIOF0_SS1_MARK,
-+};
-+static const unsigned int msiof0_ss2_pins[] = {
-+ /* SS2 */
-+ RCAR_GP_PIN(4, 7),
-+};
-+static const unsigned int msiof0_ss2_mux[] = {
-+ MSIOF0_SS2_MARK,
-+};
-+static const unsigned int msiof0_rx_pins[] = {
-+ /* RXD */
-+ RCAR_GP_PIN(4, 2),
-+};
-+static const unsigned int msiof0_rx_mux[] = {
-+ MSIOF0_RXD_MARK,
-+};
-+static const unsigned int msiof0_tx_pins[] = {
-+ /* TXD */
-+ RCAR_GP_PIN(4, 3),
-+};
-+static const unsigned int msiof0_tx_mux[] = {
-+ MSIOF0_TXD_MARK,
-+};
-+/* - MSIOF1 ----------------------------------------------------------------- */
-+static const unsigned int msiof1_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(0, 26),
-+};
-+static const unsigned int msiof1_clk_mux[] = {
-+ MSIOF1_SCK_MARK,
-+};
-+static const unsigned int msiof1_sync_pins[] = {
-+ /* SYNC */
-+ RCAR_GP_PIN(0, 27),
-+};
-+static const unsigned int msiof1_sync_mux[] = {
-+ MSIOF1_SYNC_MARK,
-+};
-+static const unsigned int msiof1_ss1_pins[] = {
-+ /* SS1 */
-+ RCAR_GP_PIN(0, 28),
-+};
-+static const unsigned int msiof1_ss1_mux[] = {
-+ MSIOF1_SS1_MARK,
-+};
-+static const unsigned int msiof1_ss2_pins[] = {
-+ /* SS2 */
-+ RCAR_GP_PIN(0, 29),
-+};
-+static const unsigned int msiof1_ss2_mux[] = {
-+ MSIOF1_SS2_MARK,
-+};
-+static const unsigned int msiof1_rx_pins[] = {
-+ /* RXD */
-+ RCAR_GP_PIN(0, 24),
-+};
-+static const unsigned int msiof1_rx_mux[] = {
-+ MSIOF1_RXD_MARK,
-+};
-+static const unsigned int msiof1_tx_pins[] = {
-+ /* TXD */
-+ RCAR_GP_PIN(0, 25),
-+};
-+static const unsigned int msiof1_tx_mux[] = {
-+ MSIOF1_TXD_MARK,
-+};
-+static const unsigned int msiof1_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(5, 3),
-+};
-+static const unsigned int msiof1_clk_b_mux[] = {
-+ MSIOF1_SCK_B_MARK,
-+};
-+static const unsigned int msiof1_sync_b_pins[] = {
-+ /* SYNC */
-+ RCAR_GP_PIN(5, 4),
-+};
-+static const unsigned int msiof1_sync_b_mux[] = {
-+ MSIOF1_SYNC_B_MARK,
-+};
-+static const unsigned int msiof1_ss1_b_pins[] = {
-+ /* SS1 */
-+ RCAR_GP_PIN(5, 5),
-+};
-+static const unsigned int msiof1_ss1_b_mux[] = {
-+ MSIOF1_SS1_B_MARK,
-+};
-+static const unsigned int msiof1_ss2_b_pins[] = {
-+ /* SS2 */
-+ RCAR_GP_PIN(5, 6),
-+};
-+static const unsigned int msiof1_ss2_b_mux[] = {
-+ MSIOF1_SS2_B_MARK,
-+};
-+static const unsigned int msiof1_rx_b_pins[] = {
-+ /* RXD */
-+ RCAR_GP_PIN(5, 1),
-+};
-+static const unsigned int msiof1_rx_b_mux[] = {
-+ MSIOF1_RXD_B_MARK,
-+};
-+static const unsigned int msiof1_tx_b_pins[] = {
-+ /* TXD */
-+ RCAR_GP_PIN(5, 2),
-+};
-+static const unsigned int msiof1_tx_b_mux[] = {
-+ MSIOF1_TXD_B_MARK,
-+};
-+/* - MSIOF2 ----------------------------------------------------------------- */
-+static const unsigned int msiof2_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(1, 0),
-+};
-+static const unsigned int msiof2_clk_mux[] = {
-+ MSIOF2_SCK_MARK,
-+};
-+static const unsigned int msiof2_sync_pins[] = {
-+ /* SYNC */
-+ RCAR_GP_PIN(1, 1),
-+};
-+static const unsigned int msiof2_sync_mux[] = {
-+ MSIOF2_SYNC_MARK,
-+};
-+static const unsigned int msiof2_ss1_pins[] = {
-+ /* SS1 */
-+ RCAR_GP_PIN(1, 2),
-+};
-+static const unsigned int msiof2_ss1_mux[] = {
-+ MSIOF2_SS1_MARK,
-+};
-+static const unsigned int msiof2_ss2_pins[] = {
-+ /* SS2 */
-+ RCAR_GP_PIN(1, 3),
-+};
-+static const unsigned int msiof2_ss2_mux[] = {
-+ MSIOF2_SS2_MARK,
-+};
-+static const unsigned int msiof2_rx_pins[] = {
-+ /* RXD */
-+ RCAR_GP_PIN(0, 30),
-+};
-+static const unsigned int msiof2_rx_mux[] = {
-+ MSIOF2_RXD_MARK,
-+};
-+static const unsigned int msiof2_tx_pins[] = {
-+ /* TXD */
-+ RCAR_GP_PIN(0, 31),
-+};
-+static const unsigned int msiof2_tx_mux[] = {
-+ MSIOF2_TXD_MARK,
-+};
-+static const unsigned int msiof2_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(3, 15),
-+};
-+static const unsigned int msiof2_clk_b_mux[] = {
-+ MSIOF2_SCK_B_MARK,
-+};
-+static const unsigned int msiof2_sync_b_pins[] = {
-+ /* SYNC */
-+ RCAR_GP_PIN(3, 16),
-+};
-+static const unsigned int msiof2_sync_b_mux[] = {
-+ MSIOF2_SYNC_B_MARK,
-+};
-+static const unsigned int msiof2_ss1_b_pins[] = {
-+ /* SS1 */
-+ RCAR_GP_PIN(3, 17),
-+};
-+static const unsigned int msiof2_ss1_b_mux[] = {
-+ MSIOF2_SS1_B_MARK,
-+};
-+static const unsigned int msiof2_ss2_b_pins[] = {
-+ /* SS2 */
-+ RCAR_GP_PIN(3, 18),
-+};
-+static const unsigned int msiof2_ss2_b_mux[] = {
-+ MSIOF2_SS2_B_MARK,
-+};
-+static const unsigned int msiof2_rx_b_pins[] = {
-+ /* RXD */
-+ RCAR_GP_PIN(3, 13),
-+};
-+static const unsigned int msiof2_rx_b_mux[] = {
-+ MSIOF2_RXD_B_MARK,
-+};
-+static const unsigned int msiof2_tx_b_pins[] = {
-+ /* TXD */
-+ RCAR_GP_PIN(3, 14),
-+};
-+static const unsigned int msiof2_tx_b_mux[] = {
-+ MSIOF2_TXD_B_MARK,
-+};
-+/* - QSPI ------------------------------------------------------------------- */
-+static const unsigned int qspi_ctrl_pins[] = {
-+ /* SPCLK, SSL */
-+ RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 9),
-+};
-+static const unsigned int qspi_ctrl_mux[] = {
-+ SPCLK_MARK, SSL_MARK,
-+};
-+static const unsigned int qspi_data2_pins[] = {
-+ /* MOSI_IO0, MISO_IO1 */
-+ RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6),
-+};
-+static const unsigned int qspi_data2_mux[] = {
-+ MOSI_IO0_MARK, MISO_IO1_MARK,
-+};
-+static const unsigned int qspi_data4_pins[] = {
-+ /* MOSI_IO0, MISO_IO1, IO2, IO3 */
-+ RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
-+ RCAR_GP_PIN(1, 8),
-+};
-+static const unsigned int qspi_data4_mux[] = {
-+ MOSI_IO0_MARK, MISO_IO1_MARK, IO2_MARK, IO3_MARK,
-+};
-+/* - SCIF0 ------------------------------------------------------------------ */
-+static const unsigned int scif0_data_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25),
-+};
-+static const unsigned int scif0_data_mux[] = {
-+ SCIF0_RXD_MARK, SCIF0_TXD_MARK,
-+};
-+static const unsigned int scif0_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(1, 23),
-+};
-+static const unsigned int scif0_clk_mux[] = {
-+ SCIF_CLK_MARK,
-+};
-+static const unsigned int scif0_data_b_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(3, 11), RCAR_GP_PIN(3, 12),
-+};
-+static const unsigned int scif0_data_b_mux[] = {
-+ SCIF0_RXD_B_MARK, SCIF0_TXD_B_MARK,
-+};
-+static const unsigned int scif0_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(3, 29),
-+};
-+static const unsigned int scif0_clk_b_mux[] = {
-+ SCIF_CLK_B_MARK,
-+};
-+static const unsigned int scif0_data_c_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(3, 30), RCAR_GP_PIN(3, 31),
-+};
-+static const unsigned int scif0_data_c_mux[] = {
-+ SCIF0_RXD_C_MARK, SCIF0_TXD_C_MARK,
-+};
-+static const unsigned int scif0_data_d_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(3, 27), RCAR_GP_PIN(3, 28),
-+};
-+static const unsigned int scif0_data_d_mux[] = {
-+ SCIF0_RXD_D_MARK, SCIF0_TXD_D_MARK,
-+};
-+/* - SCIF1 ------------------------------------------------------------------ */
-+static const unsigned int scif1_data_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(4, 14), RCAR_GP_PIN(4, 15),
-+};
-+static const unsigned int scif1_data_mux[] = {
-+ SCIF1_RXD_MARK, SCIF1_TXD_MARK,
-+};
-+static const unsigned int scif1_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(4, 13),
-+};
-+static const unsigned int scif1_clk_mux[] = {
-+ SCIF1_SCK_MARK,
-+};
-+static const unsigned int scif1_data_b_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(5, 11), RCAR_GP_PIN(5, 12),
-+};
-+static const unsigned int scif1_data_b_mux[] = {
-+ SCIF1_RXD_B_MARK, SCIF1_TXD_B_MARK,
-+};
-+static const unsigned int scif1_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(5, 10),
-+};
-+static const unsigned int scif1_clk_b_mux[] = {
-+ SCIF1_SCK_B_MARK,
-+};
-+static const unsigned int scif1_data_c_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(0, 11), RCAR_GP_PIN(0, 12),
-+};
-+static const unsigned int scif1_data_c_mux[] = {
-+ SCIF1_RXD_C_MARK, SCIF1_TXD_C_MARK,
-+};
-+static const unsigned int scif1_clk_c_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(0, 10),
-+};
-+static const unsigned int scif1_clk_c_mux[] = {
-+ SCIF1_SCK_C_MARK,
-+};
-+/* - SCIF2 ------------------------------------------------------------------ */
-+static const unsigned int scif2_data_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(4, 16), RCAR_GP_PIN(4, 17),
-+};
-+static const unsigned int scif2_data_mux[] = {
-+ SCIF2_RXD_MARK, SCIF2_TXD_MARK,
-+};
-+static const unsigned int scif2_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(4, 18),
-+};
-+static const unsigned int scif2_clk_mux[] = {
-+ SCIF2_SCK_MARK,
-+};
-+static const unsigned int scif2_data_b_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(5, 18), RCAR_GP_PIN(5, 19),
-+};
-+static const unsigned int scif2_data_b_mux[] = {
-+ SCIF2_RXD_B_MARK, SCIF2_TXD_B_MARK,
-+};
-+static const unsigned int scif2_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(5, 17),
-+};
-+static const unsigned int scif2_clk_b_mux[] = {
-+ SCIF2_SCK_B_MARK,
-+};
-+static const unsigned int scif2_data_c_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(3, 20), RCAR_GP_PIN(3, 21),
-+};
-+static const unsigned int scif2_data_c_mux[] = {
-+ SCIF2_RXD_C_MARK, SCIF2_TXD_C_MARK,
-+};
-+static const unsigned int scif2_clk_c_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(3, 19),
-+};
-+static const unsigned int scif2_clk_c_mux[] = {
-+ SCIF2_SCK_C_MARK,
-+};
-+/* - SCIF3 ------------------------------------------------------------------ */
-+static const unsigned int scif3_data_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(4, 20), RCAR_GP_PIN(4, 21),
-+};
-+static const unsigned int scif3_data_mux[] = {
-+ SCIF3_RXD_MARK, SCIF3_TXD_MARK,
-+};
-+static const unsigned int scif3_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(4, 19),
-+};
-+static const unsigned int scif3_clk_mux[] = {
-+ SCIF3_SCK_MARK,
-+};
-+static const unsigned int scif3_data_b_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(3, 23), RCAR_GP_PIN(3, 24),
-+};
-+static const unsigned int scif3_data_b_mux[] = {
-+ SCIF3_RXD_B_MARK, SCIF3_TXD_B_MARK,
-+};
-+static const unsigned int scif3_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(3, 22),
-+};
-+static const unsigned int scif3_clk_b_mux[] = {
-+ SCIF3_SCK_B_MARK,
-+};
-+/* - SCIF4 ------------------------------------------------------------------ */
-+static const unsigned int scif4_data_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(4, 0), RCAR_GP_PIN(4, 1),
-+};
-+static const unsigned int scif4_data_mux[] = {
-+ SCIF4_RXD_MARK, SCIF4_TXD_MARK,
-+};
-+static const unsigned int scif4_data_b_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(0, 5), RCAR_GP_PIN(0, 6),
-+};
-+static const unsigned int scif4_data_b_mux[] = {
-+ SCIF4_RXD_B_MARK, SCIF4_TXD_B_MARK,
-+};
-+static const unsigned int scif4_data_c_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
-+};
-+static const unsigned int scif4_data_c_mux[] = {
-+ SCIF4_RXD_C_MARK, SCIF4_TXD_C_MARK,
-+};
-+static const unsigned int scif4_data_d_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(3, 17), RCAR_GP_PIN(3, 18),
-+};
-+static const unsigned int scif4_data_d_mux[] = {
-+ SCIF4_RXD_D_MARK, SCIF4_TXD_D_MARK,
-+};
-+static const unsigned int scif4_data_e_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(1, 1), RCAR_GP_PIN(1, 2),
-+};
-+static const unsigned int scif4_data_e_mux[] = {
-+ SCIF4_RXD_E_MARK, SCIF4_TXD_E_MARK,
-+};
-+/* - SCIF5 ------------------------------------------------------------------ */
-+static const unsigned int scif5_data_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
-+};
-+static const unsigned int scif5_data_mux[] = {
-+ SCIF5_RXD_MARK, SCIF5_TXD_MARK,
-+};
-+static const unsigned int scif5_data_b_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(0, 3), RCAR_GP_PIN(0, 4),
-+};
-+static const unsigned int scif5_data_b_mux[] = {
-+ SCIF5_RXD_B_MARK, SCIF5_TXD_B_MARK,
-+};
-+static const unsigned int scif5_data_c_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 11),
-+};
-+static const unsigned int scif5_data_c_mux[] = {
-+ SCIF5_RXD_C_MARK, SCIF5_TXD_C_MARK,
-+};
-+static const unsigned int scif5_data_d_pins[] = {
-+ /* RX, TX */
-+ RCAR_GP_PIN(5, 1), RCAR_GP_PIN(5, 2),
-+};
-+static const unsigned int scif5_data_d_mux[] = {
-+ SCIF5_RXD_D_MARK, SCIF5_TXD_D_MARK,
-+};
-+/* - SCIFA0 ----------------------------------------------------------------- */
-+static const unsigned int scifa0_data_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(4, 6), RCAR_GP_PIN(4, 7),
-+};
-+static const unsigned int scifa0_data_mux[] = {
-+ SCIFA0_RXD_MARK, SCIFA0_TXD_MARK,
-+};
-+static const unsigned int scifa0_data_b_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(0, 24), RCAR_GP_PIN(0, 25),
-+};
-+static const unsigned int scifa0_data_b_mux[] = {
-+ SCIFA0_RXD_B_MARK, SCIFA0_TXD_B_MARK
-+};
-+static const unsigned int scifa0_data_c_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(2, 8), RCAR_GP_PIN(2, 9),
-+};
-+static const unsigned int scifa0_data_c_mux[] = {
-+ SCIFA0_RXD_C_MARK, SCIFA0_TXD_C_MARK
-+};
-+static const unsigned int scifa0_data_d_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(5, 15), RCAR_GP_PIN(5, 16),
-+};
-+static const unsigned int scifa0_data_d_mux[] = {
-+ SCIFA0_RXD_D_MARK, SCIFA0_TXD_D_MARK
-+};
-+/* - SCIFA1 ----------------------------------------------------------------- */
-+static const unsigned int scifa1_data_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
-+};
-+static const unsigned int scifa1_data_mux[] = {
-+ SCIFA1_RXD_MARK, SCIFA1_TXD_MARK,
-+};
-+static const unsigned int scifa1_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(0, 13),
-+};
-+static const unsigned int scifa1_clk_mux[] = {
-+ SCIFA1_SCK_MARK,
-+};
-+static const unsigned int scifa1_data_b_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(4, 28), RCAR_GP_PIN(4, 29),
-+};
-+static const unsigned int scifa1_data_b_mux[] = {
-+ SCIFA1_RXD_B_MARK, SCIFA1_TXD_B_MARK,
-+};
-+static const unsigned int scifa1_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(4, 27),
-+};
-+static const unsigned int scifa1_clk_b_mux[] = {
-+ SCIFA1_SCK_B_MARK,
-+};
-+static const unsigned int scifa1_data_c_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(5, 5), RCAR_GP_PIN(5, 6),
-+};
-+static const unsigned int scifa1_data_c_mux[] = {
-+ SCIFA1_RXD_C_MARK, SCIFA1_TXD_C_MARK,
-+};
-+static const unsigned int scifa1_clk_c_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(5, 4),
-+};
-+static const unsigned int scifa1_clk_c_mux[] = {
-+ SCIFA1_SCK_C_MARK,
-+};
-+/* - SCIFA2 ----------------------------------------------------------------- */
-+static const unsigned int scifa2_data_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(1, 16), RCAR_GP_PIN(1, 17),
-+};
-+static const unsigned int scifa2_data_mux[] = {
-+ SCIFA2_RXD_MARK, SCIFA2_TXD_MARK,
-+};
-+static const unsigned int scifa2_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(1, 15),
-+};
-+static const unsigned int scifa2_clk_mux[] = {
-+ SCIFA2_SCK_MARK,
-+};
-+static const unsigned int scifa2_data_b_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(4, 31), RCAR_GP_PIN(5, 0),
-+};
-+static const unsigned int scifa2_data_b_mux[] = {
-+ SCIFA2_RXD_B_MARK, SCIFA2_TXD_B_MARK,
-+};
-+static const unsigned int scifa2_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(4, 30),
-+};
-+static const unsigned int scifa2_clk_b_mux[] = {
-+ SCIFA2_SCK_B_MARK,
-+};
-+/* - SCIFA3 ----------------------------------------------------------------- */
-+static const unsigned int scifa3_data_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(4, 25), RCAR_GP_PIN(4, 26),
-+};
-+static const unsigned int scifa3_data_mux[] = {
-+ SCIFA3_RXD_MARK, SCIFA3_TXD_MARK,
-+};
-+static const unsigned int scifa3_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(4, 24),
-+};
-+static const unsigned int scifa3_clk_mux[] = {
-+ SCIFA3_SCK_MARK,
-+};
-+static const unsigned int scifa3_data_b_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(0, 1), RCAR_GP_PIN(0, 2),
-+};
-+static const unsigned int scifa3_data_b_mux[] = {
-+ SCIFA3_RXD_B_MARK, SCIFA3_TXD_B_MARK,
-+};
-+static const unsigned int scifa3_clk_b_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(0, 0),
-+};
-+static const unsigned int scifa3_clk_b_mux[] = {
-+ SCIFA3_SCK_B_MARK,
-+};
-+/* - SCIFA4 ----------------------------------------------------------------- */
-+static const unsigned int scifa4_data_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(4, 12), RCAR_GP_PIN(4, 12),
-+};
-+static const unsigned int scifa4_data_mux[] = {
-+ SCIFA4_RXD_MARK, SCIFA4_TXD_MARK,
-+};
-+static const unsigned int scifa4_data_b_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(0, 22), RCAR_GP_PIN(0, 23),
-+};
-+static const unsigned int scifa4_data_b_mux[] = {
-+ SCIFA4_RXD_B_MARK, SCIFA4_TXD_B_MARK,
-+};
-+static const unsigned int scifa4_data_c_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(2, 16), RCAR_GP_PIN(2, 17),
-+};
-+static const unsigned int scifa4_data_c_mux[] = {
-+ SCIFA4_RXD_C_MARK, SCIFA4_TXD_C_MARK,
-+};
-+static const unsigned int scifa4_data_d_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(5, 20), RCAR_GP_PIN(5, 21),
-+};
-+static const unsigned int scifa4_data_d_mux[] = {
-+ SCIFA4_RXD_D_MARK, SCIFA4_TXD_D_MARK,
-+};
-+/* - SCIFA5 ----------------------------------------------------------------- */
-+static const unsigned int scifa5_data_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(4, 22), RCAR_GP_PIN(4, 23),
-+};
-+static const unsigned int scifa5_data_mux[] = {
-+ SCIFA5_RXD_MARK, SCIFA5_TXD_MARK,
-+};
-+static const unsigned int scifa5_data_b_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(0, 28), RCAR_GP_PIN(0, 29),
-+};
-+static const unsigned int scifa5_data_b_mux[] = {
-+ SCIFA5_RXD_B_MARK, SCIFA5_TXD_B_MARK,
-+};
-+static const unsigned int scifa5_data_c_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(3, 9), RCAR_GP_PIN(3, 10),
-+};
-+static const unsigned int scifa5_data_c_mux[] = {
-+ SCIFA5_RXD_C_MARK, SCIFA5_TXD_C_MARK,
-+};
-+static const unsigned int scifa5_data_d_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(5, 22), RCAR_GP_PIN(5, 23),
-+};
-+static const unsigned int scifa5_data_d_mux[] = {
-+ SCIFA5_RXD_D_MARK, SCIFA5_TXD_D_MARK,
-+};
-+/* - SCIFB0 ----------------------------------------------------------------- */
-+static const unsigned int scifb0_data_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(0, 21), RCAR_GP_PIN(0, 20),
-+};
-+static const unsigned int scifb0_data_mux[] = {
-+ SCIFB0_RXD_MARK, SCIFB0_TXD_MARK,
-+};
-+static const unsigned int scifb0_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(0, 19),
-+};
-+static const unsigned int scifb0_clk_mux[] = {
-+ SCIFB0_SCK_MARK,
-+};
-+static const unsigned int scifb0_ctrl_pins[] = {
-+ /* RTS, CTS */
-+ RCAR_GP_PIN(0, 23), RCAR_GP_PIN(0, 22),
-+};
-+static const unsigned int scifb0_ctrl_mux[] = {
-+ SCIFB0_RTS_N_MARK, SCIFB0_CTS_N_MARK,
-+};
-+/* - SCIFB1 ----------------------------------------------------------------- */
-+static const unsigned int scifb1_data_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(1, 24), RCAR_GP_PIN(0, 17),
-+};
-+static const unsigned int scifb1_data_mux[] = {
-+ SCIFB1_RXD_MARK, SCIFB1_TXD_MARK,
-+};
-+static const unsigned int scifb1_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(0, 16),
-+};
-+static const unsigned int scifb1_clk_mux[] = {
-+ SCIFB1_SCK_MARK,
-+};
-+/* - SCIFB2 ----------------------------------------------------------------- */
-+static const unsigned int scifb2_data_pins[] = {
-+ /* RXD, TXD */
-+ RCAR_GP_PIN(1, 13), RCAR_GP_PIN(1, 14),
-+};
-+static const unsigned int scifb2_data_mux[] = {
-+ SCIFB2_RXD_MARK, SCIFB2_TXD_MARK,
-+};
-+static const unsigned int scifb2_clk_pins[] = {
-+ /* SCK */
-+ RCAR_GP_PIN(1, 15),
-+};
-+static const unsigned int scifb2_clk_mux[] = {
-+ SCIFB2_SCK_MARK,
-+};
-+static const unsigned int scifb2_ctrl_pins[] = {
-+ /* RTS, CTS */
-+ RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 16),
-+};
-+static const unsigned int scifb2_ctrl_mux[] = {
-+ SCIFB2_RTS_N_MARK, SCIFB2_CTS_N_MARK,
-+};
-+
-+static const struct sh_pfc_pin_group pinmux_groups[] = {
-+ SH_PFC_PIN_GROUP(eth_link),
-+ SH_PFC_PIN_GROUP(eth_magic),
-+ SH_PFC_PIN_GROUP(eth_mdio),
-+ SH_PFC_PIN_GROUP(eth_rmii),
-+ SH_PFC_PIN_GROUP(eth_link_b),
-+ SH_PFC_PIN_GROUP(eth_magic_b),
-+ SH_PFC_PIN_GROUP(eth_mdio_b),
-+ SH_PFC_PIN_GROUP(eth_rmii_b),
-+ 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_clk_b),
-+ 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_ctrl_b),
-+ SH_PFC_PIN_GROUP(hscif2_data),
-+ SH_PFC_PIN_GROUP(hscif2_clk),
-+ SH_PFC_PIN_GROUP(hscif2_ctrl),
-+ SH_PFC_PIN_GROUP(i2c0),
-+ SH_PFC_PIN_GROUP(i2c0_b),
-+ SH_PFC_PIN_GROUP(i2c0_c),
-+ SH_PFC_PIN_GROUP(i2c0_d),
-+ SH_PFC_PIN_GROUP(i2c0_e),
-+ SH_PFC_PIN_GROUP(i2c1),
-+ SH_PFC_PIN_GROUP(i2c1_b),
-+ SH_PFC_PIN_GROUP(i2c1_c),
-+ SH_PFC_PIN_GROUP(i2c1_d),
-+ SH_PFC_PIN_GROUP(i2c1_e),
-+ SH_PFC_PIN_GROUP(i2c2),
-+ SH_PFC_PIN_GROUP(i2c2_b),
-+ SH_PFC_PIN_GROUP(i2c2_c),
-+ SH_PFC_PIN_GROUP(i2c2_d),
-+ SH_PFC_PIN_GROUP(i2c2_e),
-+ SH_PFC_PIN_GROUP(i2c3),
-+ SH_PFC_PIN_GROUP(i2c3_b),
-+ SH_PFC_PIN_GROUP(i2c3_c),
-+ SH_PFC_PIN_GROUP(i2c3_d),
-+ SH_PFC_PIN_GROUP(i2c3_e),
-+ SH_PFC_PIN_GROUP(i2c4),
-+ SH_PFC_PIN_GROUP(i2c4_b),
-+ SH_PFC_PIN_GROUP(i2c4_c),
-+ SH_PFC_PIN_GROUP(i2c4_d),
-+ SH_PFC_PIN_GROUP(i2c4_e),
-+ SH_PFC_PIN_GROUP(intc_irq0),
-+ SH_PFC_PIN_GROUP(intc_irq1),
-+ SH_PFC_PIN_GROUP(intc_irq2),
-+ SH_PFC_PIN_GROUP(intc_irq3),
-+ SH_PFC_PIN_GROUP(intc_irq4),
-+ SH_PFC_PIN_GROUP(intc_irq5),
-+ SH_PFC_PIN_GROUP(intc_irq6),
-+ SH_PFC_PIN_GROUP(intc_irq7),
-+ SH_PFC_PIN_GROUP(intc_irq8),
-+ SH_PFC_PIN_GROUP(intc_irq9),
-+ SH_PFC_PIN_GROUP(msiof0_clk),
-+ SH_PFC_PIN_GROUP(msiof0_sync),
-+ SH_PFC_PIN_GROUP(msiof0_ss1),
-+ SH_PFC_PIN_GROUP(msiof0_ss2),
-+ SH_PFC_PIN_GROUP(msiof0_rx),
-+ SH_PFC_PIN_GROUP(msiof0_tx),
-+ SH_PFC_PIN_GROUP(msiof1_clk),
-+ SH_PFC_PIN_GROUP(msiof1_sync),
-+ SH_PFC_PIN_GROUP(msiof1_ss1),
-+ SH_PFC_PIN_GROUP(msiof1_ss2),
-+ SH_PFC_PIN_GROUP(msiof1_rx),
-+ SH_PFC_PIN_GROUP(msiof1_tx),
-+ SH_PFC_PIN_GROUP(msiof1_clk_b),
-+ SH_PFC_PIN_GROUP(msiof1_sync_b),
-+ SH_PFC_PIN_GROUP(msiof1_ss1_b),
-+ SH_PFC_PIN_GROUP(msiof1_ss2_b),
-+ SH_PFC_PIN_GROUP(msiof1_rx_b),
-+ SH_PFC_PIN_GROUP(msiof1_tx_b),
-+ SH_PFC_PIN_GROUP(msiof2_clk),
-+ SH_PFC_PIN_GROUP(msiof2_sync),
-+ SH_PFC_PIN_GROUP(msiof2_ss1),
-+ SH_PFC_PIN_GROUP(msiof2_ss2),
-+ SH_PFC_PIN_GROUP(msiof2_rx),
-+ SH_PFC_PIN_GROUP(msiof2_tx),
-+ SH_PFC_PIN_GROUP(msiof2_clk_b),
-+ SH_PFC_PIN_GROUP(msiof2_sync_b),
-+ SH_PFC_PIN_GROUP(msiof2_ss1_b),
-+ SH_PFC_PIN_GROUP(msiof2_ss2_b),
-+ SH_PFC_PIN_GROUP(msiof2_rx_b),
-+ SH_PFC_PIN_GROUP(msiof2_tx_b),
-+ SH_PFC_PIN_GROUP(qspi_ctrl),
-+ SH_PFC_PIN_GROUP(qspi_data2),
-+ SH_PFC_PIN_GROUP(qspi_data4),
-+ SH_PFC_PIN_GROUP(scif0_data),
-+ SH_PFC_PIN_GROUP(scif0_clk),
-+ SH_PFC_PIN_GROUP(scif0_data_b),
-+ SH_PFC_PIN_GROUP(scif0_clk_b),
-+ SH_PFC_PIN_GROUP(scif0_data_c),
-+ SH_PFC_PIN_GROUP(scif0_data_d),
-+ SH_PFC_PIN_GROUP(scif1_data),
-+ SH_PFC_PIN_GROUP(scif1_clk),
-+ SH_PFC_PIN_GROUP(scif1_data_b),
-+ SH_PFC_PIN_GROUP(scif1_clk_b),
-+ SH_PFC_PIN_GROUP(scif1_data_c),
-+ SH_PFC_PIN_GROUP(scif1_clk_c),
-+ SH_PFC_PIN_GROUP(scif2_data),
-+ SH_PFC_PIN_GROUP(scif2_clk),
-+ SH_PFC_PIN_GROUP(scif2_data_b),
-+ SH_PFC_PIN_GROUP(scif2_clk_b),
-+ SH_PFC_PIN_GROUP(scif2_data_c),
-+ SH_PFC_PIN_GROUP(scif2_clk_c),
-+ SH_PFC_PIN_GROUP(scif3_data),
-+ SH_PFC_PIN_GROUP(scif3_clk),
-+ SH_PFC_PIN_GROUP(scif3_data_b),
-+ SH_PFC_PIN_GROUP(scif3_clk_b),
-+ SH_PFC_PIN_GROUP(scif4_data),
-+ SH_PFC_PIN_GROUP(scif4_data_b),
-+ SH_PFC_PIN_GROUP(scif4_data_c),
-+ SH_PFC_PIN_GROUP(scif4_data_d),
-+ SH_PFC_PIN_GROUP(scif4_data_e),
-+ SH_PFC_PIN_GROUP(scif5_data),
-+ SH_PFC_PIN_GROUP(scif5_data_b),
-+ SH_PFC_PIN_GROUP(scif5_data_c),
-+ SH_PFC_PIN_GROUP(scif5_data_d),
-+ SH_PFC_PIN_GROUP(scifa0_data),
-+ SH_PFC_PIN_GROUP(scifa0_data_b),
-+ SH_PFC_PIN_GROUP(scifa0_data_c),
-+ SH_PFC_PIN_GROUP(scifa0_data_d),
-+ SH_PFC_PIN_GROUP(scifa1_data),
-+ SH_PFC_PIN_GROUP(scifa1_clk),
-+ SH_PFC_PIN_GROUP(scifa1_data_b),
-+ SH_PFC_PIN_GROUP(scifa1_clk_b),
-+ SH_PFC_PIN_GROUP(scifa1_data_c),
-+ SH_PFC_PIN_GROUP(scifa1_clk_c),
-+ SH_PFC_PIN_GROUP(scifa2_data),
-+ SH_PFC_PIN_GROUP(scifa2_clk),
-+ SH_PFC_PIN_GROUP(scifa2_data_b),
-+ SH_PFC_PIN_GROUP(scifa2_clk_b),
-+ SH_PFC_PIN_GROUP(scifa3_data),
-+ SH_PFC_PIN_GROUP(scifa3_clk),
-+ SH_PFC_PIN_GROUP(scifa3_data_b),
-+ SH_PFC_PIN_GROUP(scifa3_clk_b),
-+ SH_PFC_PIN_GROUP(scifa4_data),
-+ SH_PFC_PIN_GROUP(scifa4_data_b),
-+ SH_PFC_PIN_GROUP(scifa4_data_c),
-+ SH_PFC_PIN_GROUP(scifa4_data_d),
-+ SH_PFC_PIN_GROUP(scifa5_data),
-+ SH_PFC_PIN_GROUP(scifa5_data_b),
-+ SH_PFC_PIN_GROUP(scifa5_data_c),
-+ SH_PFC_PIN_GROUP(scifa5_data_d),
-+ SH_PFC_PIN_GROUP(scifb0_data),
-+ SH_PFC_PIN_GROUP(scifb0_clk),
-+ SH_PFC_PIN_GROUP(scifb0_ctrl),
-+ SH_PFC_PIN_GROUP(scifb1_data),
-+ SH_PFC_PIN_GROUP(scifb1_clk),
-+ SH_PFC_PIN_GROUP(scifb2_data),
-+ SH_PFC_PIN_GROUP(scifb2_clk),
-+ SH_PFC_PIN_GROUP(scifb2_ctrl),
-+};
-+
-+static const char * const eth_groups[] = {
-+ "eth_link",
-+ "eth_magic",
-+ "eth_mdio",
-+ "eth_rmii",
-+ "eth_link_b",
-+ "eth_magic_b",
-+ "eth_mdio_b",
-+ "eth_rmii_b",
-+};
-+
-+static const char * const hscif0_groups[] = {
-+ "hscif0_data",
-+ "hscif0_clk",
-+ "hscif0_ctrl",
-+ "hscif0_data_b",
-+ "hscif0_clk_b",
-+};
-+
-+static const char * const hscif1_groups[] = {
-+ "hscif1_data",
-+ "hscif1_clk",
-+ "hscif1_ctrl",
-+ "hscif1_data_b",
-+ "hscif1_ctrl_b",
-+};
-+
-+static const char * const hscif2_groups[] = {
-+ "hscif2_data",
-+ "hscif2_clk",
-+ "hscif2_ctrl",
-+};
-+
-+static const char * const i2c0_groups[] = {
-+ "i2c0",
-+ "i2c0_b",
-+ "i2c0_c",
-+ "i2c0_d",
-+ "i2c0_e",
-+};
-+
-+static const char * const i2c1_groups[] = {
-+ "i2c1",
-+ "i2c1_b",
-+ "i2c1_c",
-+ "i2c1_d",
-+ "i2c1_e",
-+};
-+
-+static const char * const i2c2_groups[] = {
-+ "i2c2",
-+ "i2c2_b",
-+ "i2c2_c",
-+ "i2c2_d",
-+ "i2c2_e",
-+};
-+
-+static const char * const i2c3_groups[] = {
-+ "i2c3",
-+ "i2c3_b",
-+ "i2c3_c",
-+ "i2c3_d",
-+ "i2c3_e",
-+};
-+
-+static const char * const i2c4_groups[] = {
-+ "i2c4",
-+ "i2c4_b",
-+ "i2c4_c",
-+ "i2c4_d",
-+ "i2c4_e",
-+};
-+
-+static const char * const intc_groups[] = {
-+ "intc_irq0",
-+ "intc_irq1",
-+ "intc_irq2",
-+ "intc_irq3",
-+ "intc_irq4",
-+ "intc_irq5",
-+ "intc_irq6",
-+ "intc_irq7",
-+ "intc_irq8",
-+ "intc_irq9",
-+};
-+
-+static const char * const msiof0_groups[] = {
-+ "msiof0_clk",
-+ "msiof0_sync",
-+ "msiof0_ss1",
-+ "msiof0_ss2",
-+ "msiof0_rx",
-+ "msiof0_tx",
-+};
-+
-+static const char * const msiof1_groups[] = {
-+ "msiof1_clk",
-+ "msiof1_sync",
-+ "msiof1_ss1",
-+ "msiof1_ss2",
-+ "msiof1_rx",
-+ "msiof1_tx",
-+ "msiof1_clk_b",
-+ "msiof1_sync_b",
-+ "msiof1_ss1_b",
-+ "msiof1_ss2_b",
-+ "msiof1_rx_b",
-+ "msiof1_tx_b",
-+};
-+
-+static const char * const msiof2_groups[] = {
-+ "msiof2_clk",
-+ "msiof2_sync",
-+ "msiof2_ss1",
-+ "msiof2_ss2",
-+ "msiof2_rx",
-+ "msiof2_tx",
-+ "msiof2_clk_b",
-+ "msiof2_sync_b",
-+ "msiof2_ss1_b",
-+ "msiof2_ss2_b",
-+ "msiof2_rx_b",
-+ "msiof2_tx_b",
-+};
-+
-+static const char * const qspi_groups[] = {
-+ "qspi_ctrl",
-+ "qspi_data2",
-+ "qspi_data4",
-+};
-+
-+static const char * const scif0_groups[] = {
-+ "scif0_data",
-+ "scif0_clk",
-+ "scif0_data_b",
-+ "scif0_clk_b",
-+ "scif0_data_c",
-+ "scif0_data_d",
-+};
-+
-+static const char * const scif1_groups[] = {
-+ "scif1_data",
-+ "scif1_clk",
-+ "scif1_data_b",
-+ "scif1_clk_b",
-+ "scif1_data_c",
-+ "scif1_clk_c",
-+};
-+
-+static const char * const scif2_groups[] = {
-+ "scif2_data",
-+ "scif2_clk",
-+ "scif2_data_b",
-+ "scif2_clk_b",
-+ "scif2_data_c",
-+ "scif2_clk_c",
-+};
-+
-+static const char * const scif3_groups[] = {
-+ "scif3_data",
-+ "scif3_clk",
-+ "scif3_data_b",
-+ "scif3_clk_b",
-+};
-+
-+static const char * const scif4_groups[] = {
-+ "scif4_data",
-+ "scif4_data_b",
-+ "scif4_data_c",
-+ "scif4_data_d",
-+ "scif4_data_e",
-+};
-+
-+static const char * const scif5_groups[] = {
-+ "scif5_data",
-+ "scif5_data_b",
-+ "scif5_data_c",
-+ "scif5_data_d",
-+};
-+
-+static const char * const scifa0_groups[] = {
-+ "scifa0_data",
-+ "scifa0_data_b",
-+ "scifa0_data_c",
-+ "scifa0_data_d",
-+};
-+
-+static const char * const scifa1_groups[] = {
-+ "scifa1_data",
-+ "scifa1_clk",
-+ "scifa1_data_b",
-+ "scifa1_clk_b",
-+ "scifa1_data_c",
-+ "scifa1_clk_c",
-+};
-+
-+static const char * const scifa2_groups[] = {
-+ "scifa2_data",
-+ "scifa2_clk",
-+ "scifa2_data_b",
-+ "scifa2_clk_b",
-+};
-+
-+static const char * const scifa3_groups[] = {
-+ "scifa3_data",
-+ "scifa3_clk",
-+ "scifa3_data_b",
-+ "scifa3_clk_b",
-+};
-+
-+static const char * const scifa4_groups[] = {
-+ "scifa4_data",
-+ "scifa4_data_b",
-+ "scifa4_data_c",
-+ "scifa4_data_d",
-+};
-+
-+static const char * const scifa5_groups[] = {
-+ "scifa5_data",
-+ "scifa5_data_b",
-+ "scifa5_data_c",
-+ "scifa5_data_d",
-+};
-+
-+static const char * const scifb0_groups[] = {
-+ "scifb0_data",
-+ "scifb0_clk",
-+ "scifb0_ctrl",
-+};
-+
-+static const char * const scifb1_groups[] = {
-+ "scifb1_data",
-+ "scifb1_clk",
-+};
-+
-+static const char * const scifb2_groups[] = {
-+ "scifb2_data",
-+ "scifb2_clk",
-+ "scifb2_ctrl",
-+};
-+
-+static const struct sh_pfc_function pinmux_functions[] = {
-+ 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),
-+ SH_PFC_FUNCTION(i2c3),
-+ SH_PFC_FUNCTION(i2c4),
-+ SH_PFC_FUNCTION(intc),
-+ SH_PFC_FUNCTION(msiof0),
-+ SH_PFC_FUNCTION(msiof1),
-+ SH_PFC_FUNCTION(msiof2),
-+ SH_PFC_FUNCTION(qspi),
-+ SH_PFC_FUNCTION(scif0),
-+ SH_PFC_FUNCTION(scif1),
-+ SH_PFC_FUNCTION(scif2),
-+ SH_PFC_FUNCTION(scif3),
-+ SH_PFC_FUNCTION(scif4),
-+ SH_PFC_FUNCTION(scif5),
-+ SH_PFC_FUNCTION(scifa0),
-+ SH_PFC_FUNCTION(scifa1),
-+ SH_PFC_FUNCTION(scifa2),
-+ SH_PFC_FUNCTION(scifa3),
-+ SH_PFC_FUNCTION(scifa4),
-+ SH_PFC_FUNCTION(scifa5),
-+ SH_PFC_FUNCTION(scifb0),
-+ SH_PFC_FUNCTION(scifb1),
-+ SH_PFC_FUNCTION(scifb2),
-+};
-+
-+static const struct pinmux_cfg_reg pinmux_config_regs[] = {
-+ { PINMUX_CFG_REG("GPSR0", 0xE6060004, 32, 1) {
-+ GP_0_31_FN, FN_IP2_17_16,
-+ GP_0_30_FN, FN_IP2_15_14,
-+ GP_0_29_FN, FN_IP2_13_12,
-+ GP_0_28_FN, FN_IP2_11_10,
-+ GP_0_27_FN, FN_IP2_9_8,
-+ GP_0_26_FN, FN_IP2_7_6,
-+ GP_0_25_FN, FN_IP2_5_4,
-+ GP_0_24_FN, FN_IP2_3_2,
-+ GP_0_23_FN, FN_IP2_1_0,
-+ GP_0_22_FN, FN_IP1_31_30,
-+ GP_0_21_FN, FN_IP1_29_28,
-+ GP_0_20_FN, FN_IP1_27,
-+ GP_0_19_FN, FN_IP1_26,
-+ GP_0_18_FN, FN_A2,
-+ GP_0_17_FN, FN_IP1_24,
-+ GP_0_16_FN, FN_IP1_23_22,
-+ GP_0_15_FN, FN_IP1_21_20,
-+ GP_0_14_FN, FN_IP1_19_18,
-+ GP_0_13_FN, FN_IP1_17_15,
-+ GP_0_12_FN, FN_IP1_14_13,
-+ GP_0_11_FN, FN_IP1_12_11,
-+ GP_0_10_FN, FN_IP1_10_8,
-+ GP_0_9_FN, FN_IP1_7_6,
-+ GP_0_8_FN, FN_IP1_5_4,
-+ GP_0_7_FN, FN_IP1_3_2,
-+ GP_0_6_FN, FN_IP1_1_0,
-+ GP_0_5_FN, FN_IP0_31_30,
-+ GP_0_4_FN, FN_IP0_29_28,
-+ GP_0_3_FN, FN_IP0_27_26,
-+ GP_0_2_FN, FN_IP0_25,
-+ GP_0_1_FN, FN_IP0_24,
-+ GP_0_0_FN, FN_IP0_23_22, }
-+ },
-+ { PINMUX_CFG_REG("GPSR1", 0xE6060008, 32, 1) {
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ GP_1_25_FN, FN_DACK0,
-+ GP_1_24_FN, FN_IP7_31,
-+ GP_1_23_FN, FN_IP4_1_0,
-+ GP_1_22_FN, FN_WE1_N,
-+ GP_1_21_FN, FN_WE0_N,
-+ GP_1_20_FN, FN_IP3_31,
-+ GP_1_19_FN, FN_IP3_30,
-+ GP_1_18_FN, FN_IP3_29_27,
-+ GP_1_17_FN, FN_IP3_26_24,
-+ GP_1_16_FN, FN_IP3_23_21,
-+ GP_1_15_FN, FN_IP3_20_18,
-+ GP_1_14_FN, FN_IP3_17_15,
-+ GP_1_13_FN, FN_IP3_14_13,
-+ GP_1_12_FN, FN_IP3_12,
-+ GP_1_11_FN, FN_IP3_11,
-+ GP_1_10_FN, FN_IP3_10,
-+ GP_1_9_FN, FN_IP3_9_8,
-+ GP_1_8_FN, FN_IP3_7_6,
-+ GP_1_7_FN, FN_IP3_5_4,
-+ GP_1_6_FN, FN_IP3_3_2,
-+ GP_1_5_FN, FN_IP3_1_0,
-+ GP_1_4_FN, FN_IP2_31_30,
-+ GP_1_3_FN, FN_IP2_29_27,
-+ GP_1_2_FN, FN_IP2_26_24,
-+ GP_1_1_FN, FN_IP2_23_21,
-+ GP_1_0_FN, FN_IP2_20_18, }
-+ },
-+ { PINMUX_CFG_REG("GPSR2", 0xE606000C, 32, 1) {
-+ GP_2_31_FN, FN_IP6_7_6,
-+ GP_2_30_FN, FN_IP6_5_4,
-+ GP_2_29_FN, FN_IP6_3_2,
-+ GP_2_28_FN, FN_IP6_1_0,
-+ GP_2_27_FN, FN_IP5_31_30,
-+ GP_2_26_FN, FN_IP5_29_28,
-+ GP_2_25_FN, FN_IP5_27_26,
-+ GP_2_24_FN, FN_IP5_25_24,
-+ GP_2_23_FN, FN_IP5_23_22,
-+ GP_2_22_FN, FN_IP5_21_20,
-+ GP_2_21_FN, FN_IP5_19_18,
-+ GP_2_20_FN, FN_IP5_17_16,
-+ GP_2_19_FN, FN_IP5_15_14,
-+ GP_2_18_FN, FN_IP5_13_12,
-+ GP_2_17_FN, FN_IP5_11_9,
-+ GP_2_16_FN, FN_IP5_8_6,
-+ GP_2_15_FN, FN_IP5_5_4,
-+ GP_2_14_FN, FN_IP5_3_2,
-+ GP_2_13_FN, FN_IP5_1_0,
-+ GP_2_12_FN, FN_IP4_31_30,
-+ GP_2_11_FN, FN_IP4_29_28,
-+ GP_2_10_FN, FN_IP4_27_26,
-+ GP_2_9_FN, FN_IP4_25_23,
-+ GP_2_8_FN, FN_IP4_22_20,
-+ GP_2_7_FN, FN_IP4_19_18,
-+ GP_2_6_FN, FN_IP4_17_16,
-+ GP_2_5_FN, FN_IP4_15_14,
-+ GP_2_4_FN, FN_IP4_13_12,
-+ GP_2_3_FN, FN_IP4_11_10,
-+ GP_2_2_FN, FN_IP4_9_8,
-+ GP_2_1_FN, FN_IP4_7_5,
-+ GP_2_0_FN, FN_IP4_4_2 }
-+ },
-+ { PINMUX_CFG_REG("GPSR3", 0xE6060010, 32, 1) {
-+ GP_3_31_FN, FN_IP8_22_20,
-+ GP_3_30_FN, FN_IP8_19_17,
-+ GP_3_29_FN, FN_IP8_16_15,
-+ GP_3_28_FN, FN_IP8_14_12,
-+ GP_3_27_FN, FN_IP8_11_9,
-+ GP_3_26_FN, FN_IP8_8_6,
-+ GP_3_25_FN, FN_IP8_5_3,
-+ GP_3_24_FN, FN_IP8_2_0,
-+ GP_3_23_FN, FN_IP7_29_27,
-+ GP_3_22_FN, FN_IP7_26_24,
-+ GP_3_21_FN, FN_IP7_23_21,
-+ GP_3_20_FN, FN_IP7_20_18,
-+ GP_3_19_FN, FN_IP7_17_15,
-+ GP_3_18_FN, FN_IP7_14_12,
-+ GP_3_17_FN, FN_IP7_11_9,
-+ GP_3_16_FN, FN_IP7_8_6,
-+ GP_3_15_FN, FN_IP7_5_3,
-+ GP_3_14_FN, FN_IP7_2_0,
-+ GP_3_13_FN, FN_IP6_31_29,
-+ GP_3_12_FN, FN_IP6_28_26,
-+ GP_3_11_FN, FN_IP6_25_23,
-+ GP_3_10_FN, FN_IP6_22_20,
-+ GP_3_9_FN, FN_IP6_19_17,
-+ GP_3_8_FN, FN_IP6_16,
-+ GP_3_7_FN, FN_IP6_15,
-+ GP_3_6_FN, FN_IP6_14,
-+ GP_3_5_FN, FN_IP6_13,
-+ GP_3_4_FN, FN_IP6_12,
-+ GP_3_3_FN, FN_IP6_11,
-+ GP_3_2_FN, FN_IP6_10,
-+ GP_3_1_FN, FN_IP6_9,
-+ GP_3_0_FN, FN_IP6_8 }
-+ },
-+ { PINMUX_CFG_REG("GPSR4", 0xE6060014, 32, 1) {
-+ GP_4_31_FN, FN_IP11_17_16,
-+ GP_4_30_FN, FN_IP11_15_14,
-+ GP_4_29_FN, FN_IP11_13_11,
-+ GP_4_28_FN, FN_IP11_10_8,
-+ GP_4_27_FN, FN_IP11_7_6,
-+ GP_4_26_FN, FN_IP11_5_3,
-+ GP_4_25_FN, FN_IP11_2_0,
-+ GP_4_24_FN, FN_IP10_31_30,
-+ GP_4_23_FN, FN_IP10_29_27,
-+ GP_4_22_FN, FN_IP10_26_24,
-+ GP_4_21_FN, FN_IP10_23_21,
-+ GP_4_20_FN, FN_IP10_20_18,
-+ GP_4_19_FN, FN_IP10_17_15,
-+ GP_4_18_FN, FN_IP10_14_12,
-+ GP_4_17_FN, FN_IP10_11_9,
-+ GP_4_16_FN, FN_IP10_8_6,
-+ GP_4_15_FN, FN_IP10_5_3,
-+ GP_4_14_FN, FN_IP10_2_0,
-+ GP_4_13_FN, FN_IP9_30_28,
-+ GP_4_12_FN, FN_IP9_27_25,
-+ GP_4_11_FN, FN_IP9_24_22,
-+ GP_4_10_FN, FN_IP9_21_19,
-+ GP_4_9_FN, FN_IP9_18_17,
-+ GP_4_8_FN, FN_IP9_16_15,
-+ GP_4_7_FN, FN_IP9_14_12,
-+ GP_4_6_FN, FN_IP9_11_9,
-+ GP_4_5_FN, FN_IP9_8_6,
-+ GP_4_4_FN, FN_IP9_5_3,
-+ GP_4_3_FN, FN_IP9_2_0,
-+ GP_4_2_FN, FN_IP8_31_29,
-+ GP_4_1_FN, FN_IP8_28_26,
-+ GP_4_0_FN, FN_IP8_25_23 }
-+ },
-+ { PINMUX_CFG_REG("GPSR5", 0xE6060018, 32, 1) {
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ GP_5_27_FN, FN_USB1_OVC,
-+ GP_5_26_FN, FN_USB1_PWEN,
-+ GP_5_25_FN, FN_USB0_OVC,
-+ GP_5_24_FN, FN_USB0_PWEN,
-+ GP_5_23_FN, FN_IP13_26_24,
-+ GP_5_22_FN, FN_IP13_23_21,
-+ GP_5_21_FN, FN_IP13_20_18,
-+ GP_5_20_FN, FN_IP13_17_15,
-+ GP_5_19_FN, FN_IP13_14_12,
-+ GP_5_18_FN, FN_IP13_11_9,
-+ GP_5_17_FN, FN_IP13_8_6,
-+ GP_5_16_FN, FN_IP13_5_3,
-+ GP_5_15_FN, FN_IP13_2_0,
-+ GP_5_14_FN, FN_IP12_29_27,
-+ GP_5_13_FN, FN_IP12_26_24,
-+ GP_5_12_FN, FN_IP12_23_21,
-+ GP_5_11_FN, FN_IP12_20_18,
-+ GP_5_10_FN, FN_IP12_17_15,
-+ GP_5_9_FN, FN_IP12_14_13,
-+ GP_5_8_FN, FN_IP12_12_11,
-+ GP_5_7_FN, FN_IP12_10_9,
-+ GP_5_6_FN, FN_IP12_8_6,
-+ GP_5_5_FN, FN_IP12_5_3,
-+ GP_5_4_FN, FN_IP12_2_0,
-+ GP_5_3_FN, FN_IP11_29_27,
-+ GP_5_2_FN, FN_IP11_26_24,
-+ GP_5_1_FN, FN_IP11_23_21,
-+ GP_5_0_FN, FN_IP11_20_18 }
-+ },
-+ { PINMUX_CFG_REG("GPSR6", 0xE606001C, 32, 1) {
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ 0, 0,
-+ GP_6_25_FN, FN_IP0_21_20,
-+ GP_6_24_FN, FN_IP0_19_18,
-+ GP_6_23_FN, FN_IP0_17,
-+ GP_6_22_FN, FN_IP0_16,
-+ GP_6_21_FN, FN_IP0_15,
-+ GP_6_20_FN, FN_IP0_14,
-+ GP_6_19_FN, FN_IP0_13,
-+ GP_6_18_FN, FN_IP0_12,
-+ GP_6_17_FN, FN_IP0_11,
-+ GP_6_16_FN, FN_IP0_10,
-+ GP_6_15_FN, FN_IP0_9_8,
-+ GP_6_14_FN, FN_IP0_0,
-+ GP_6_13_FN, FN_SD1_DATA3,
-+ GP_6_12_FN, FN_SD1_DATA2,
-+ GP_6_11_FN, FN_SD1_DATA1,
-+ GP_6_10_FN, FN_SD1_DATA0,
-+ GP_6_9_FN, FN_SD1_CMD,
-+ GP_6_8_FN, FN_SD1_CLK,
-+ GP_6_7_FN, FN_SD0_WP,
-+ GP_6_6_FN, FN_SD0_CD,
-+ GP_6_5_FN, FN_SD0_DATA3,
-+ GP_6_4_FN, FN_SD0_DATA2,
-+ GP_6_3_FN, FN_SD0_DATA1,
-+ GP_6_2_FN, FN_SD0_DATA0,
-+ GP_6_1_FN, FN_SD0_CMD,
-+ GP_6_0_FN, FN_SD0_CLK }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR0", 0xE6060020, 32,
-+ 2, 2, 2, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
-+ 2, 1, 1, 1, 1, 1, 1, 1, 1) {
-+ /* IP0_31_30 [2] */
-+ FN_D5, FN_SCIF4_RXD_B, FN_I2C0_SCL_D, 0,
-+ /* IP0_29_28 [2] */
-+ FN_D4, FN_I2C3_SDA_B, FN_SCIF5_TXD_B, 0,
-+ /* IP0_27_26 [2] */
-+ FN_D3, FN_I2C3_SCL_B, FN_SCIF5_RXD_B, 0,
-+ /* IP0_25 [1] */
-+ FN_D2, FN_SCIFA3_TXD_B,
-+ /* IP0_24 [1] */
-+ FN_D1, FN_SCIFA3_RXD_B,
-+ /* IP0_23_22 [2] */
-+ FN_D0, FN_SCIFA3_SCK_B, FN_IRQ4, 0,
-+ /* IP0_21_20 [2] */
-+ FN_MMC_D7, FN_SCIF0_TXD, FN_I2C2_SDA_B, FN_CAN1_TX,
-+ /* IP0_19_18 [2] */
-+ FN_MMC_D6, FN_SCIF0_RXD, FN_I2C2_SCL_B, FN_CAN1_RX,
-+ /* IP0_17 [1] */
-+ FN_MMC_D5, FN_SD2_WP,
-+ /* IP0_16 [1] */
-+ FN_MMC_D4, FN_SD2_CD,
-+ /* IP0_15 [1] */
-+ FN_MMC_D3, FN_SD2_DATA3,
-+ /* IP0_14 [1] */
-+ FN_MMC_D2, FN_SD2_DATA2,
-+ /* IP0_13 [1] */
-+ FN_MMC_D1, FN_SD2_DATA1,
-+ /* IP0_12 [1] */
-+ FN_MMC_D0, FN_SD2_DATA0,
-+ /* IP0_11 [1] */
-+ FN_MMC_CMD, FN_SD2_CMD,
-+ /* IP0_10 [1] */
-+ FN_MMC_CLK, FN_SD2_CLK,
-+ /* IP0_9_8 [2] */
-+ FN_SD1_WP, FN_IRQ7, FN_CAN0_TX, 0,
-+ /* IP0_7 [1] */
-+ 0, 0,
-+ /* IP0_6 [1] */
-+ 0, 0,
-+ /* IP0_5 [1] */
-+ 0, 0,
-+ /* IP0_4 [1] */
-+ 0, 0,
-+ /* IP0_3 [1] */
-+ 0, 0,
-+ /* IP0_2 [1] */
-+ 0, 0,
-+ /* IP0_1 [1] */
-+ 0, 0,
-+ /* IP0_0 [1] */
-+ FN_SD1_CD, FN_CAN0_RX, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR1", 0xE6060024, 32,
-+ 2, 2, 1, 1, 1, 1, 2, 2, 2, 3, 2, 2, 3, 2, 2,
-+ 2, 2) {
-+ /* IP1_31_30 [2] */
-+ FN_A6, FN_SCIFB0_CTS_N, FN_SCIFA4_RXD_B, FN_TPUTO2_C,
-+ /* IP1_29_28 [2] */
-+ FN_A5, FN_SCIFB0_RXD, FN_PWM4_B, FN_TPUTO3_C,
-+ /* IP1_27 [1] */
-+ FN_A4, FN_SCIFB0_TXD,
-+ /* IP1_26 [1] */
-+ FN_A3, FN_SCIFB0_SCK,
-+ /* IP1_25 [1] */
-+ 0, 0,
-+ /* IP1_24 [1] */
-+ FN_A1, FN_SCIFB1_TXD,
-+ /* IP1_23_22 [2] */
-+ FN_A0, FN_SCIFB1_SCK, FN_PWM3_B, 0,
-+ /* IP1_21_20 [2] */
-+ FN_D15, FN_SCIFA1_TXD, FN_IIC0_SDA_B, 0,
-+ /* IP1_19_18 [2] */
-+ FN_D14, FN_SCIFA1_RXD, FN_IIC0_SCL_B, 0,
-+ /* IP1_17_15 [3] */
-+ FN_D13, FN_SCIFA1_SCK, FN_TANS1, FN_PWM2_C, FN_TCLK2_B,
-+ 0, 0, 0,
-+ /* IP1_14_13 [2] */
-+ FN_D12, FN_HSCIF2_HRTS_N, FN_SCIF1_TXD_C, FN_I2C1_SDA_D,
-+ /* IP1_12_11 [2] */
-+ FN_D11, FN_HSCIF2_HCTS_N, FN_SCIF1_RXD_C, FN_I2C1_SCL_D,
-+ /* IP1_10_8 [3] */
-+ FN_D10, FN_HSCIF2_HSCK, FN_SCIF1_SCK_C, FN_IRQ6, FN_PWM5_C,
-+ 0, 0, 0,
-+ /* IP1_7_6 [2] */
-+ FN_D9, FN_HSCIF2_HTX, FN_I2C1_SDA_B, 0,
-+ /* IP1_5_4 [2] */
-+ FN_D8, FN_HSCIF2_HRX, FN_I2C1_SCL_B, 0,
-+ /* IP1_3_2 [2] */
-+ FN_D7, FN_IRQ3, FN_TCLK1, FN_PWM6_B,
-+ /* IP1_1_0 [2] */
-+ FN_D6, FN_SCIF4_TXD_B, FN_I2C0_SDA_D, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR2", 0xE6060028, 32,
-+ 2, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2) {
-+ /* IP2_31_30 [2] */
-+ FN_A20, FN_SPCLK, FN_MOUT1, 0,
-+ /* IP2_29_27 [3] */
-+ FN_A19, FN_MSIOF2_SS2, FN_PWM4, FN_TPUTO2,
-+ FN_MOUT0, 0, 0, 0,
-+ /* IP2_26_24 [3] */
-+ FN_A18, FN_MSIOF2_SS1, FN_SCIF4_TXD_E, FN_CAN1_TX_B,
-+ FN_AVB_AVTP_MATCH_B, 0, 0, 0,
-+ /* IP2_23_21 [3] */
-+ FN_A17, FN_MSIOF2_SYNC, FN_SCIF4_RXD_E, FN_CAN1_RX_B,
-+ FN_AVB_AVTP_CAPTURE_B, 0, 0, 0,
-+ /* IP2_20_18 [3] */
-+ FN_A16, FN_MSIOF2_SCK, FN_HSCIF0_HSCK_B, FN_SPEEDIN,
-+ FN_VSP, FN_CAN_CLK_C, FN_TPUTO2_B, 0,
-+ /* IP2_17_16 [2] */
-+ FN_A15, FN_MSIOF2_TXD, FN_HSCIF0_HTX_B, FN_DACK1,
-+ /* IP2_15_14 [2] */
-+ FN_A14, FN_MSIOF2_RXD, FN_HSCIF0_HRX_B, FN_DREQ1_N,
-+ /* IP2_13_12 [2] */
-+ FN_A13, FN_MSIOF1_SS2, FN_SCIFA5_TXD_B, 0,
-+ /* IP2_11_10 [2] */
-+ FN_A12, FN_MSIOF1_SS1, FN_SCIFA5_RXD_B, 0,
-+ /* IP2_9_8 [2] */
-+ FN_A11, FN_MSIOF1_SYNC, FN_IIC1_SDA_B, 0,
-+ /* IP2_7_6 [2] */
-+ FN_A10, FN_MSIOF1_SCK, FN_IIC1_SCL_B, 0,
-+ /* IP2_5_4 [2] */
-+ FN_A9, FN_MSIOF1_TXD, FN_SCIFA0_TXD_B, 0,
-+ /* IP2_3_2 [2] */
-+ FN_A8, FN_MSIOF1_RXD, FN_SCIFA0_RXD_B, 0,
-+ /* IP2_1_0 [2] */
-+ FN_A7, FN_SCIFB0_RTS_N, FN_SCIFA4_TXD_B, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR3", 0xE606002C, 32,
-+ 1, 1, 3, 3, 3, 3, 3, 2, 1, 1, 1, 2, 2, 2, 2, 2) {
-+ /* IP3_31 [1] */
-+ FN_RD_WR_N, FN_ATAG1_N,
-+ /* IP3_30 [1] */
-+ FN_RD_N, FN_ATACS11_N,
-+ /* IP3_29_27 [3] */
-+ FN_BS_N, FN_DRACK0, FN_PWM1_C, FN_TPUTO0_C, FN_ATACS01_N,
-+ FN_MTS_N_B, 0, 0,
-+ /* IP3_26_24 [3] */
-+ FN_EX_CS5_N, FN_SCIFA2_TXD, FN_I2C2_SDA_E, FN_TS_SPSYNC_B,
-+ FN_RIF0_D1, FN_FMIN, FN_SCIFB2_RTS_N, FN_STM_N_B,
-+ /* IP3_23_21 [3] */
-+ FN_EX_CS4_N, FN_SCIFA2_RXD, FN_I2C2_SCL_E, FN_TS_SDEN_B,
-+ FN_RIF0_D0, FN_FMCLK, FN_SCIFB2_CTS_N, FN_SCKZ_B,
-+ /* IP3_20_18 [3] */
-+ FN_EX_CS3_N, FN_SCIFA2_SCK, FN_SCIF4_TXD_C, FN_TS_SCK_B,
-+ FN_RIF0_CLK, FN_BPFCLK, FN_SCIFB2_SCK, FN_MDATA_B,
-+ /* IP3_17_15 [3] */
-+ FN_EX_CS2_N, FN_PWM0, FN_SCIF4_RXD_C, FN_TS_SDATA_B,
-+ FN_RIF0_SYNC, FN_TPUTO3, FN_SCIFB2_TXD, FN_SDATA_B,
-+ /* IP3_14_13 [2] */
-+ FN_EX_CS1_N, FN_TPUTO3_B, FN_SCIFB2_RXD, FN_VI1_DATA11,
-+ /* IP3_12 [1] */
-+ FN_EX_CS0_N, FN_VI1_DATA10,
-+ /* IP3_11 [1] */
-+ FN_CS1_N_A26, FN_VI1_DATA9,
-+ /* IP3_10 [1] */
-+ FN_CS0_N, FN_VI1_DATA8,
-+ /* IP3_9_8 [2] */
-+ FN_A25, FN_SSL, FN_ATARD1_N, 0,
-+ /* IP3_7_6 [2] */
-+ FN_A24, FN_IO3, FN_EX_WAIT2, 0,
-+ /* IP3_5_4 [2] */
-+ FN_A23, FN_IO2, FN_MOUT6, FN_ATAWR1_N,
-+ /* IP3_3_2 [2] */
-+ FN_A22, FN_MISO_IO1, FN_MOUT5, FN_ATADIR1_N,
-+ /* IP3_1_0 [2] */
-+ FN_A21, FN_MOSI_IO0, FN_MOUT2, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR4", 0xE6060030, 32,
-+ 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 2) {
-+ /* IP4_31_30 [2] */
-+ FN_DU0_DG4, FN_LCDOUT12, FN_CC50_STATE12, 0,
-+ /* IP4_29_28 [2] */
-+ FN_DU0_DG3, FN_LCDOUT11, FN_CC50_STATE11, 0,
-+ /* IP4_27_26 [2] */
-+ FN_DU0_DG2, FN_LCDOUT10, FN_CC50_STATE10, 0,
-+ /* IP4_25_23 [3] */
-+ FN_DU0_DG1, FN_LCDOUT9, FN_SCIFA0_TXD_C, FN_I2C3_SDA_D,
-+ FN_CC50_STATE9, 0, 0, 0,
-+ /* IP4_22_20 [3] */
-+ FN_DU0_DG0, FN_LCDOUT8, FN_SCIFA0_RXD_C, FN_I2C3_SCL_D,
-+ FN_CC50_STATE8, 0, 0, 0,
-+ /* IP4_19_18 [2] */
-+ FN_DU0_DR7, FN_LCDOUT23, FN_CC50_STATE7, 0,
-+ /* IP4_17_16 [2] */
-+ FN_DU0_DR6, FN_LCDOUT22, FN_CC50_STATE6, 0,
-+ /* IP4_15_14 [2] */
-+ FN_DU0_DR5, FN_LCDOUT21, FN_CC50_STATE5, 0,
-+ /* IP4_13_12 [2] */
-+ FN_DU0_DR4, FN_LCDOUT20, FN_CC50_STATE4, 0,
-+ /* IP4_11_10 [2] */
-+ FN_DU0_DR3, FN_LCDOUT19, FN_CC50_STATE3, 0,
-+ /* IP4_9_8 [2] */
-+ FN_DU0_DR2, FN_LCDOUT18, FN_CC50_STATE2, 0,
-+ /* IP4_7_5 [3] */
-+ FN_DU0_DR1, FN_LCDOUT17, FN_SCIF5_TXD_C, FN_I2C2_SDA_D,
-+ FN_CC50_STATE1, 0, 0, 0,
-+ /* IP4_4_2 [3] */
-+ FN_DU0_DR0, FN_LCDOUT16, FN_SCIF5_RXD_C, FN_I2C2_SCL_D,
-+ FN_CC50_STATE0, 0, 0, 0,
-+ /* IP4_1_0 [2] */
-+ FN_EX_WAIT0, FN_CAN_CLK_B, FN_SCIF_CLK, FN_PWMFSW0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR5", 0xE6060034, 32,
-+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2) {
-+ /* IP5_31_30 [2] */
-+ FN_DU0_EXHSYNC_DU0_HSYNC, FN_QSTH_QHS, FN_CC50_STATE27, 0,
-+ /* IP5_29_28 [2] */
-+ FN_DU0_DOTCLKOUT1, FN_QSTVB_QVE, FN_CC50_STATE26, 0,
-+ /* IP5_27_26 [2] */
-+ FN_DU0_DOTCLKOUT0, FN_QCLK, FN_CC50_STATE25, 0,
-+ /* IP5_25_24 [2] */
-+ FN_DU0_DOTCLKIN, FN_QSTVA_QVS, FN_CC50_STATE24, 0,
-+ /* IP5_23_22 [2] */
-+ FN_DU0_DB7, FN_LCDOUT7, FN_CC50_STATE23, 0,
-+ /* IP5_21_20 [2] */
-+ FN_DU0_DB6, FN_LCDOUT6, FN_CC50_STATE22, 0,
-+ /* IP5_19_18 [2] */
-+ FN_DU0_DB5, FN_LCDOUT5, FN_CC50_STATE21, 0,
-+ /* IP5_17_16 [2] */
-+ FN_DU0_DB4, FN_LCDOUT4, FN_CC50_STATE20, 0,
-+ /* IP5_15_14 [2] */
-+ FN_DU0_DB3, FN_LCDOUT3, FN_CC50_STATE19, 0,
-+ /* IP5_13_12 [2] */
-+ FN_DU0_DB2, FN_LCDOUT2, FN_CC50_STATE18, 0,
-+ /* IP5_11_9 [3] */
-+ FN_DU0_DB1, FN_LCDOUT1, FN_SCIFA4_TXD_C, FN_I2C4_SDA_D,
-+ FN_CAN0_TX_C, FN_CC50_STATE17, 0, 0,
-+ /* IP5_8_6 [3] */
-+ FN_DU0_DB0, FN_LCDOUT0, FN_SCIFA4_RXD_C, FN_I2C4_SCL_D,
-+ FN_CAN0_RX_C, FN_CC50_STATE16, 0, 0,
-+ /* IP5_5_4 [2] */
-+ FN_DU0_DG7, FN_LCDOUT15, FN_CC50_STATE15, 0,
-+ /* IP5_3_2 [2] */
-+ FN_DU0_DG6, FN_LCDOUT14, FN_CC50_STATE14, 0,
-+ /* IP5_1_0 [2] */
-+ FN_DU0_DG5, FN_LCDOUT13, FN_CC50_STATE13, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR6", 0xE6060038, 32,
-+ 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
-+ 2, 2) {
-+ /* IP6_31_29 [3] */
-+ FN_ETH_MDIO, FN_VI0_G0, FN_MSIOF2_RXD_B, FN_IIC0_SCL_D,
-+ FN_AVB_TX_CLK, FN_ADIDATA, FN_AD_DI, 0,
-+ /* IP6_28_26 [3] */
-+ FN_VI0_VSYNC_N, FN_SCIF0_TXD_B, FN_I2C0_SDA_C,
-+ FN_AUDIO_CLKOUT_B, FN_AVB_TX_EN, 0, 0, 0,
-+ /* IP6_25_23 [3] */
-+ FN_VI0_HSYNC_N, FN_SCIF0_RXD_B, FN_I2C0_SCL_C, FN_IERX_C,
-+ FN_AVB_COL, 0, 0, 0,
-+ /* IP6_22_20 [3] */
-+ FN_VI0_FIELD, FN_I2C3_SDA, FN_SCIFA5_TXD_C, FN_IECLK_C,
-+ FN_AVB_RX_ER, 0, 0, 0,
-+ /* IP6_19_17 [3] */
-+ FN_VI0_CLKENB, FN_I2C3_SCL, FN_SCIFA5_RXD_C, FN_IETX_C,
-+ FN_AVB_RXD7, 0, 0, 0,
-+ /* IP6_16 [1] */
-+ FN_VI0_DATA7_VI0_B7, FN_AVB_RXD6,
-+ /* IP6_15 [1] */
-+ FN_VI0_DATA6_VI0_B6, FN_AVB_RXD5,
-+ /* IP6_14 [1] */
-+ FN_VI0_DATA5_VI0_B5, FN_AVB_RXD4,
-+ /* IP6_13 [1] */
-+ FN_VI0_DATA4_VI0_B4, FN_AVB_RXD3,
-+ /* IP6_12 [1] */
-+ FN_VI0_DATA3_VI0_B3, FN_AVB_RXD2,
-+ /* IP6_11 [1] */
-+ FN_VI0_DATA2_VI0_B2, FN_AVB_RXD1,
-+ /* IP6_10 [1] */
-+ FN_VI0_DATA1_VI0_B1, FN_AVB_RXD0,
-+ /* IP6_9 [1] */
-+ FN_VI0_DATA0_VI0_B0, FN_AVB_RX_DV,
-+ /* IP6_8 [1] */
-+ FN_VI0_CLK, FN_AVB_RX_CLK,
-+ /* IP6_7_6 [2] */
-+ FN_DU0_CDE, FN_QPOLB, FN_CC50_STATE31, 0,
-+ /* IP6_5_4 [2] */
-+ FN_DU0_DISP, FN_QPOLA, FN_CC50_STATE30, 0,
-+ /* IP6_3_2 [2] */
-+ FN_DU0_EXODDF_DU0_ODDF_DISP_CDE, FN_QCPV_QDE, FN_CC50_STATE29,
-+ /* IP6_1_0 [2] */
-+ FN_DU0_EXVSYNC_DU0_VSYNC, FN_QSTB_QHE, FN_CC50_STATE28, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR7", 0xE606003C, 32,
-+ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3) {
-+ /* IP7_31 [1] */
-+ FN_DREQ0_N, FN_SCIFB1_RXD,
-+ /* IP7_30 [1] */
-+ 0, 0,
-+ /* IP7_29_27 [3] */
-+ FN_ETH_TXD0, FN_VI0_R2, FN_SCIF3_RXD_B, FN_I2C4_SCL_E,
-+ FN_AVB_GTX_CLK, FN_SSI_WS6_B, 0, 0,
-+ /* IP7_26_24 [3] */
-+ FN_ETH_MAGIC, FN_VI0_R1, FN_SCIF3_SCK_B, FN_AVB_TX_ER,
-+ FN_SSI_SCK6_B, 0, 0, 0,
-+ /* IP7_23_21 [3] */
-+ FN_ETH_TX_EN, FN_VI0_R0, FN_SCIF2_TXD_C, FN_IIC1_SDA_D,
-+ FN_AVB_TXD7, FN_SSI_SDATA5_B, 0, 0,
-+ /* IP7_20_18 [3] */
-+ FN_ETH_TXD1, FN_VI0_G7, FN_SCIF2_RXD_C, FN_IIC1_SCL_D,
-+ FN_AVB_TXD6, FN_SSI_WS5_B, 0, 0,
-+ /* IP7_17_15 [3] */
-+ FN_ETH_REFCLK, FN_VI0_G6, FN_SCIF2_SCK_C, FN_AVB_TXD5,
-+ FN_SSI_SCK5_B, 0, 0, 0,
-+ /* IP7_14_12 [3] */
-+ FN_ETH_LINK, FN_VI0_G5, FN_MSIOF2_SS2_B, FN_SCIF4_TXD_D,
-+ FN_AVB_TXD4, FN_ADICHS2, 0, 0,
-+ /* IP7_11_9 [3] */
-+ FN_ETH_RXD1, FN_VI0_G4, FN_MSIOF2_SS1_B, FN_SCIF4_RXD_D,
-+ FN_AVB_TXD3, FN_ADICHS1, 0, 0,
-+ /* IP7_8_6 [3] */
-+ FN_ETH_RXD0, FN_VI0_G3, FN_MSIOF2_SYNC_B, FN_CAN0_TX_B,
-+ FN_AVB_TXD2, FN_ADICHS0, FN_AD_NCS_N, 0,
-+ /* IP7_5_3 [3] */
-+ FN_ETH_RX_ER, FN_VI0_G2, FN_MSIOF2_SCK_B, FN_CAN0_RX_B,
-+ FN_AVB_TXD1, FN_ADICLK, FN_AD_CLK, 0,
-+ /* IP7_2_0 [3] */
-+ FN_ETH_CRS_DV, FN_VI0_G1, FN_MSIOF2_TXD_B, FN_IIC0_SDA_D,
-+ FN_AVB_TXD0, FN_ADICS_SAMP, FN_AD_DO, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR8", 0xE6060040, 32,
-+ 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3) {
-+ /* IP8_31_29 [3] */
-+ FN_MSIOF0_RXD, FN_SCIF5_RXD, FN_I2C2_SCL_C, FN_DU1_DR2,
-+ FN_RIF1_D0_B, FN_TS_SDEN_D, FN_FMCLK_C, FN_RDS_CLK,
-+ /* IP8_28_26 [3] */
-+ FN_I2C1_SDA, FN_SCIF4_TXD, FN_IRQ5, FN_DU1_DR1,
-+ FN_RIF1_CLK_B, FN_TS_SCK_D, FN_BPFCLK_C, 0,
-+ /* IP8_25_23 [3] */
-+ FN_I2C1_SCL, FN_SCIF4_RXD, FN_PWM5_B, FN_DU1_DR0,
-+ FN_RIF1_SYNC_B, FN_TS_SDATA_D, FN_TPUTO1_B, 0,
-+ /* IP8_22_20 [3] */
-+ FN_I2C0_SDA, FN_SCIF0_TXD_C, FN_TPUTO0, FN_CAN_CLK,
-+ FN_DVC_MUTE, FN_CAN1_TX_D, 0, 0,
-+ /* IP8_19_17 [3] */
-+ FN_I2C0_SCL, FN_SCIF0_RXD_C, FN_PWM5, FN_TCLK1_B,
-+ FN_AVB_GTXREFCLK, FN_CAN1_RX_D, FN_TPUTO0_B, 0,
-+ /* IP8_16_15 [2] */
-+ FN_HSCIF0_HSCK, FN_SCIF_CLK_B, FN_AVB_CRS, FN_AUDIO_CLKC_B,
-+ /* IP8_14_12 [3] */
-+ FN_HSCIF0_HRTS_N, FN_VI0_R7, FN_SCIF0_TXD_D, FN_I2C0_SDA_E,
-+ FN_AVB_PHY_INT, FN_SSI_SDATA8_B, 0, 0,
-+ /* IP8_11_9 [3] */
-+ FN_HSCIF0_HCTS_N, FN_VI0_R6, FN_SCIF0_RXD_D, FN_I2C0_SCL_E,
-+ FN_AVB_MAGIC, FN_SSI_SDATA7_B, 0, 0,
-+ /* IP8_8_6 [3] */
-+ FN_HSCIF0_HTX, FN_VI0_R5, FN_I2C1_SDA_C, FN_AUDIO_CLKB_B,
-+ FN_AVB_LINK, FN_SSI_WS78_B, 0, 0,
-+ /* IP8_5_3 [3] */
-+ FN_HSCIF0_HRX, FN_VI0_R4, FN_I2C1_SCL_C, FN_AUDIO_CLKA_B,
-+ FN_AVB_MDIO, FN_SSI_SCK78_B, 0, 0,
-+ /* IP8_2_0 [3] */
-+ FN_ETH_MDC, FN_VI0_R3, FN_SCIF3_TXD_B, FN_I2C4_SDA_E,
-+ FN_AVB_MDC, FN_SSI_SDATA6_B, 0, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR9", 0xE6060044, 32,
-+ 1, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3) {
-+ /* IP9_31 [1] */
-+ 0, 0,
-+ /* IP9_30_28 [3] */
-+ FN_SCIF1_SCK, FN_PWM3, FN_TCLK2, FN_DU1_DG5,
-+ FN_SSI_SDATA1_B, FN_CAN_TXCLK, FN_CC50_STATE34, 0,
-+ /* IP9_27_25 [3] */
-+ FN_HSCIF1_HRTS_N, FN_SCIFA4_TXD, FN_IERX, FN_DU1_DG4,
-+ FN_SSI_WS1_B, FN_CAN_STEP0, FN_CC50_STATE33, 0,
-+ /* IP9_24_22 [3] */
-+ FN_HSCIF1_HCTS_N, FN_SCIFA4_RXD, FN_IECLK, FN_DU1_DG3,
-+ FN_SSI_SCK1_B, FN_CAN_DEBUG_HW_TRIGGER, FN_CC50_STATE32, 0,
-+ /* IP9_21_19 [3] */
-+ FN_HSCIF1_HSCK, FN_PWM2, FN_IETX, FN_DU1_DG2,
-+ FN_REMOCON_B, FN_SPEEDIN_B, FN_VSP_B, 0,
-+ /* IP9_18_17 [2] */
-+ FN_HSCIF1_HTX, FN_I2C4_SDA, FN_TPUTO1, FN_DU1_DG1,
-+ /* IP9_16_15 [2] */
-+ FN_HSCIF1_HRX, FN_I2C4_SCL, FN_PWM6, FN_DU1_DG0,
-+ /* IP9_14_12 [3] */
-+ FN_MSIOF0_SS2, FN_SCIFA0_TXD, FN_TS_SPSYNC, FN_DU1_DR7,
-+ FN_RIF1_D1, FN_FMIN_B, FN_RDS_DATA_B, 0,
-+ /* IP9_11_9 [3] */
-+ FN_MSIOF0_SS1, FN_SCIFA0_RXD, FN_TS_SDEN, FN_DU1_DR6,
-+ FN_RIF1_D0, FN_FMCLK_B, FN_RDS_CLK_B, 0,
-+ /* IP9_8_6 [3] */
-+ FN_MSIOF0_SYNC, FN_PWM1, FN_TS_SCK, FN_DU1_DR5,
-+ FN_RIF1_CLK, FN_BPFCLK_B, 0, 0,
-+ /* IP9_5_3 [3] */
-+ FN_MSIOF0_SCK, FN_IRQ0, FN_TS_SDATA, FN_DU1_DR4,
-+ FN_RIF1_SYNC, FN_TPUTO1_C, 0, 0,
-+ /* IP9_2_0 [3] */
-+ FN_MSIOF0_TXD, FN_SCIF5_TXD, FN_I2C2_SDA_C, FN_DU1_DR3,
-+ FN_RIF1_D1_B, FN_TS_SPSYNC_D, FN_FMIN_C, FN_RDS_DATA, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR10", 0xE6060048, 32,
-+ 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3) {
-+ /* IP10_31_30 [2] */
-+ FN_SSI_SCK5, FN_SCIFA3_SCK, FN_DU1_DOTCLKIN, FN_CAN_DEBUGOUT10,
-+ /* IP10_29_27 [3] */
-+ FN_I2C2_SDA, FN_SCIFA5_TXD, FN_DU1_DB7, FN_AUDIO_CLKOUT_C,
-+ FN_CAN_DEBUGOUT9, 0, 0, 0,
-+ /* IP10_26_24 [3] */
-+ FN_I2C2_SCL, FN_SCIFA5_RXD, FN_DU1_DB6, FN_AUDIO_CLKC_C,
-+ FN_SSI_SDATA4_B, FN_CAN_DEBUGOUT8, 0, 0,
-+ /* IP10_23_21 [3] */
-+ FN_SCIF3_TXD, FN_I2C1_SDA_E, FN_FMIN_D, FN_DU1_DB5,
-+ FN_AUDIO_CLKB_C, FN_SSI_WS4_B, FN_CAN_DEBUGOUT7, FN_RDS_DATA_C,
-+ /* IP10_20_18 [3] */
-+ FN_SCIF3_RXD, FN_I2C1_SCL_E, FN_FMCLK_D, FN_DU1_DB4,
-+ FN_AUDIO_CLKA_C, FN_SSI_SCK4_B, FN_CAN_DEBUGOUT6, FN_RDS_CLK_C,
-+ /* IP10_17_15 [3] */
-+ FN_SCIF3_SCK, FN_IRQ2, FN_BPFCLK_D, FN_DU1_DB3,
-+ FN_SSI_SDATA9_B, FN_TANS2, FN_CAN_DEBUGOUT5, FN_CC50_OSCOUT,
-+ /* IP10_14_12 [3] */
-+ FN_SCIF2_SCK, FN_IRQ1, FN_DU1_DB2, FN_SSI_WS9_B,
-+ FN_USB0_IDIN, FN_CAN_DEBUGOUT4, FN_CC50_STATE39, 0,
-+ /* IP10_11_9 [3] */
-+ FN_SCIF2_TXD, FN_IIC1_SDA, FN_DU1_DB1, FN_SSI_SCK9_B,
-+ FN_USB0_OVC1, FN_CAN_DEBUGOUT3, FN_CC50_STATE38, 0,
-+ /* IP10_8_6 [3] */
-+ FN_SCIF2_RXD, FN_IIC1_SCL, FN_DU1_DB0, FN_SSI_SDATA2_B,
-+ FN_USB0_EXTLP, FN_CAN_DEBUGOUT2, FN_CC50_STATE37, 0,
-+ /* IP10_5_3 [3] */
-+ FN_SCIF1_TXD, FN_IIC0_SDA, FN_DU1_DG7, FN_SSI_WS2_B,
-+ FN_CAN_DEBUGOUT1, FN_CC50_STATE36, 0, 0,
-+ /* IP10_2_0 [3] */
-+ FN_SCIF1_RXD, FN_IIC0_SCL, FN_DU1_DG6, FN_SSI_SCK2_B,
-+ FN_CAN_DEBUGOUT0, FN_CC50_STATE35, 0, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR11", 0xE606004C, 32,
-+ 2, 3, 3, 3, 3, 2, 2, 3, 3, 2, 3, 3) {
-+ /* IP11_31_30 [2] */
-+ 0, 0, 0, 0,
-+ /* IP11_29_27 [3] */
-+ FN_SSI_SDATA0, FN_MSIOF1_SCK_B, FN_PWM0_B, FN_ADICLK_B,
-+ FN_AD_CLK_B, 0, 0, 0,
-+ /* IP11_26_24 [3] */
-+ FN_SSI_WS0129, FN_MSIOF1_TXD_B, FN_SCIF5_TXD_D, FN_ADICS_SAMP_B,
-+ FN_AD_DO_B, 0, 0, 0,
-+ /* IP11_23_21 [3] */
-+ FN_SSI_SCK0129, FN_MSIOF1_RXD_B, FN_SCIF5_RXD_D, FN_ADIDATA_B,
-+ FN_AD_DI_B, FN_PCMWE_N, 0, 0,
-+ /* IP11_20_18 [3] */
-+ FN_SSI_SDATA7, FN_SCIFA2_TXD_B, FN_IRQ8, FN_AUDIO_CLKA_D,
-+ FN_CAN_CLK_D, FN_PCMOE_N, 0, 0,
-+ /* IP11_17_16 [2] */
-+ FN_SSI_WS78, FN_SCIFA2_RXD_B, FN_IIC0_SCL_C, FN_DU1_CDE,
-+ /* IP11_15_14 [2] */
-+ FN_SSI_SCK78, FN_SCIFA2_SCK_B, FN_IIC0_SDA_C, FN_DU1_DISP,
-+ /* IP11_13_11 [3] */
-+ FN_SSI_SDATA6, FN_SCIFA1_TXD_B, FN_I2C4_SDA_C,
-+ FN_DU1_EXODDF_DU1_ODDF_DISP_CDE, FN_CAN_DEBUGOUT15, 0, 0, 0,
-+ /* IP11_10_8 [3] */
-+ FN_SSI_WS6, FN_SCIFA1_RXD_B, FN_I2C4_SCL_C,
-+ FN_DU1_EXVSYNC_DU1_VSYNC, FN_CAN_DEBUGOUT14, 0, 0, 0,
-+ /* IP11_7_6 [2] */
-+ FN_SSI_SCK6, FN_SCIFA1_SCK_B, FN_DU1_EXHSYNC_DU1_HSYNC,
-+ FN_CAN_DEBUGOUT13,
-+ /* IP11_5_3 [3] */
-+ FN_SSI_SDATA5, FN_SCIFA3_TXD, FN_I2C3_SDA_C, FN_DU1_DOTCLKOUT1,
-+ FN_CAN_DEBUGOUT12, 0, 0, 0,
-+ /* IP11_2_0 [3] */
-+ FN_SSI_WS5, FN_SCIFA3_RXD, FN_I2C3_SCL_C, FN_DU1_DOTCLKOUT0,
-+ FN_CAN_DEBUGOUT11, 0, 0, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR12", 0xE6060050, 32,
-+ 2, 3, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3) {
-+ /* IP12_31_30 [2] */
-+ 0, 0, 0, 0,
-+ /* IP12_29_27 [3] */
-+ FN_SSI_SCK2, FN_HSCIF1_HTX_B, FN_VI1_DATA2, FN_MDATA,
-+ FN_ATAWR0_N, FN_ETH_RXD1_B, 0, 0,
-+ /* IP12_26_24 [3] */
-+ FN_SSI_SDATA1, FN_HSCIF1_HRX_B, FN_VI1_DATA1, FN_SDATA,
-+ FN_ATAG0_N, FN_ETH_RXD0_B, 0, 0,
-+ /* IP12_23_21 [3] */
-+ FN_SSI_WS1, FN_SCIF1_TXD_B, FN_IIC1_SDA_C, FN_VI1_DATA0,
-+ FN_CAN0_TX_D, FN_AVB_AVTP_MATCH, FN_ETH_RX_ER_B, 0,
-+ /* IP12_20_18 [3] */
-+ FN_SSI_SCK1, FN_SCIF1_RXD_B, FN_IIC1_SCL_C, FN_VI1_CLK,
-+ FN_CAN0_RX_D, FN_AVB_AVTP_CAPTURE, FN_ETH_CRS_DV_B, 0,
-+ /* IP12_17_15 [3] */
-+ FN_SSI_SDATA8, FN_SCIF1_SCK_B, FN_PWM1_B, FN_IRQ9,
-+ FN_REMOCON, FN_DACK2, FN_ETH_MDIO_B, 0,
-+ /* IP12_14_13 [2] */
-+ FN_SSI_SDATA4, FN_MLB_DAT, FN_IERX_B, FN_IRD_SCK,
-+ /* IP12_12_11 [2] */
-+ FN_SSI_WS4, FN_MLB_SIG, FN_IECLK_B, FN_IRD_RX,
-+ /* IP12_10_9 [2] */
-+ FN_SSI_SCK4, FN_MLB_CLK, FN_IETX_B, FN_IRD_TX,
-+ /* IP12_8_6 [3] */
-+ FN_SSI_SDATA3, FN_MSIOF1_SS2_B, FN_SCIFA1_TXD_C, FN_ADICHS2_B,
-+ FN_CAN1_TX_C, FN_DREQ2_N, 0, 0,
-+ /* IP12_5_3 [3] */
-+ FN_SSI_WS34, FN_MSIOF1_SS1_B, FN_SCIFA1_RXD_C, FN_ADICHS1_B,
-+ FN_CAN1_RX_C, FN_DACK1_B, 0, 0,
-+ /* IP12_2_0 [3] */
-+ FN_SSI_SCK34, FN_MSIOF1_SYNC_B, FN_SCIFA1_SCK_C, FN_ADICHS0_B,
-+ FN_AD_NCS_N_B, FN_DREQ1_N_B, 0, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("IPSR13", 0xE6060054, 32,
-+ 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3) {
-+ /* IP13_31 [1] */
-+ 0, 0,
-+ /* IP13_30 [1] */
-+ 0, 0,
-+ /* IP13_29 [1] */
-+ 0, 0,
-+ /* IP13_28 [1] */
-+ 0, 0,
-+ /* IP13_27 [1] */
-+ 0, 0,
-+ /* IP13_26_24 [3] */
-+ FN_AUDIO_CLKOUT, FN_I2C4_SDA_B, FN_SCIFA5_TXD_D, FN_VI1_VSYNC_N,
-+ FN_TS_SPSYNC_C, FN_RIF0_D1_B, FN_FMIN_E, FN_RDS_DATA_D,
-+ /* IP13_23_21 [3] */
-+ FN_AUDIO_CLKC, FN_I2C4_SCL_B, FN_SCIFA5_RXD_D, FN_VI1_HSYNC_N,
-+ FN_TS_SDEN_C, FN_RIF0_D0_B, FN_FMCLK_E, FN_RDS_CLK_D,
-+ /* IP13_20_18 [3] */
-+ FN_AUDIO_CLKB, FN_I2C0_SDA_B, FN_SCIFA4_TXD_D, FN_VI1_FIELD,
-+ FN_TS_SCK_C, FN_RIF0_CLK_B, FN_BPFCLK_E, FN_ETH_MDC_B,
-+ /* IP13_17_15 [3] */
-+ FN_AUDIO_CLKA, FN_I2C0_SCL_B, FN_SCIFA4_RXD_D, FN_VI1_CLKENB,
-+ FN_TS_SDATA_C, FN_RIF0_SYNC_B, FN_ETH_TXD0_B, 0,
-+ /* IP13_14_12 [3] */
-+ FN_SSI_SDATA9, FN_SCIF2_TXD_B, FN_I2C3_SDA_E, FN_VI1_DATA7,
-+ FN_ATADIR0_N, FN_ETH_MAGIC_B, 0, 0,
-+ /* IP13_11_9 [3] */
-+ FN_SSI_WS9, FN_SCIF2_RXD_B, FN_I2C3_SCL_E, FN_VI1_DATA6,
-+ FN_ATARD0_N, FN_ETH_TX_EN_B, 0, 0,
-+ /* IP13_8_6 [3] */
-+ FN_SSI_SCK9, FN_SCIF2_SCK_B, FN_PWM2_B, FN_VI1_DATA5,
-+ FN_MTS_N, FN_EX_WAIT1, FN_ETH_TXD1_B, 0,
-+ /* IP13_5_3 [2] */
-+ FN_SSI_SDATA2, FN_HSCIF1_HRTS_N_B, FN_SCIFA0_TXD_D,
-+ FN_VI1_DATA4, FN_STM_N, FN_ATACS10_N, FN_ETH_REFCLK_B, 0,
-+ /* IP13_2_0 [3] */
-+ FN_SSI_WS2, FN_HSCIF1_HCTS_N_B, FN_SCIFA0_RXD_D, FN_VI1_DATA3,
-+ FN_SCKZ, FN_ATACS00_N, FN_ETH_LINK_B, 0, }
-+ },
-+ { PINMUX_CFG_REG_VAR("MOD_SEL", 0xE6060090, 32,
-+ 2, 1, 2, 3, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
-+ 2, 1) {
-+ /* SEL_ADG [2] */
-+ FN_SEL_ADG_0, FN_SEL_ADG_1, FN_SEL_ADG_2, FN_SEL_ADG_3,
-+ /* SEL_ADI [1] */
-+ FN_SEL_ADI_0, FN_SEL_ADI_1,
-+ /* SEL_CAN [2] */
-+ FN_SEL_CAN_0, FN_SEL_CAN_1, FN_SEL_CAN_2, FN_SEL_CAN_3,
-+ /* SEL_DARC [3] */
-+ FN_SEL_DARC_0, FN_SEL_DARC_1, FN_SEL_DARC_2, FN_SEL_DARC_3,
-+ FN_SEL_DARC_4, 0, 0, 0,
-+ /* SEL_DR0 [1] */
-+ FN_SEL_DR0_0, FN_SEL_DR0_1,
-+ /* SEL_DR1 [1] */
-+ FN_SEL_DR1_0, FN_SEL_DR1_1,
-+ /* SEL_DR2 [1] */
-+ FN_SEL_DR2_0, FN_SEL_DR2_1,
-+ /* SEL_DR3 [1] */
-+ FN_SEL_DR3_0, FN_SEL_DR3_1,
-+ /* SEL_ETH [1] */
-+ FN_SEL_ETH_0, FN_SEL_ETH_1,
-+ /* SLE_FSN [1] */
-+ FN_SEL_FSN_0, FN_SEL_FSN_1,
-+ /* SEL_IC200 [3] */
-+ FN_SEL_I2C00_0, FN_SEL_I2C00_1, FN_SEL_I2C00_2, FN_SEL_I2C00_3,
-+ FN_SEL_I2C00_4, 0, 0, 0,
-+ /* SEL_I2C01 [3] */
-+ FN_SEL_I2C01_0, FN_SEL_I2C01_1, FN_SEL_I2C01_2, FN_SEL_I2C01_3,
-+ FN_SEL_I2C01_4, 0, 0, 0,
-+ /* SEL_I2C02 [3] */
-+ FN_SEL_I2C02_0, FN_SEL_I2C02_1, FN_SEL_I2C02_2, FN_SEL_I2C02_3,
-+ FN_SEL_I2C02_4, 0, 0, 0,
-+ /* SEL_I2C03 [3] */
-+ FN_SEL_I2C03_0, FN_SEL_I2C03_1, FN_SEL_I2C03_2, FN_SEL_I2C03_3,
-+ FN_SEL_I2C03_4, 0, 0, 0,
-+ /* SEL_I2C04 [3] */
-+ FN_SEL_I2C04_0, FN_SEL_I2C04_1, FN_SEL_I2C04_2, FN_SEL_I2C04_3,
-+ FN_SEL_I2C04_4, 0, 0, 0,
-+ /* SEL_IIC00 [2] */
-+ FN_SEL_IIC00_0, FN_SEL_IIC00_1, FN_SEL_IIC00_2, FN_SEL_IIC00_3,
-+ /* SEL_AVB [1] */
-+ FN_SEL_AVB_0, FN_SEL_AVB_1, }
-+ },
-+ { PINMUX_CFG_REG_VAR("MOD_SEL2", 0xE6060094, 32,
-+ 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1,
-+ 2, 2, 2, 1, 1, 2) {
-+ /* SEL_IEB [2] */
-+ FN_SEL_IEB_0, FN_SEL_IEB_1, FN_SEL_IEB_2, 0,
-+ /* SEL_IIC0 [2] */
-+ FN_SEL_IIC01_0, FN_SEL_IIC01_1, FN_SEL_IIC01_2, FN_SEL_IIC01_3,
-+ /* SEL_LBS [1] */
-+ FN_SEL_LBS_0, FN_SEL_LBS_1,
-+ /* SEL_MSI1 [1] */
-+ FN_SEL_MSI1_0, FN_SEL_MSI1_1,
-+ /* SEL_MSI2 [1] */
-+ FN_SEL_MSI2_0, FN_SEL_MSI2_1,
-+ /* SEL_RAD [1] */
-+ FN_SEL_RAD_0, FN_SEL_RAD_1,
-+ /* SEL_RCN [1] */
-+ FN_SEL_RCN_0, FN_SEL_RCN_1,
-+ /* SEL_RSP [1] */
-+ FN_SEL_RSP_0, FN_SEL_RSP_1,
-+ /* SEL_SCIFA0 [2] */
-+ FN_SEL_SCIFA0_0, FN_SEL_SCIFA0_1, FN_SEL_SCIFA0_2,
-+ FN_SEL_SCIFA0_3,
-+ /* SEL_SCIFA1 [2] */
-+ FN_SEL_SCIFA1_0, FN_SEL_SCIFA1_1, FN_SEL_SCIFA1_2, 0,
-+ /* SEL_SCIFA2 [1] */
-+ FN_SEL_SCIFA2_0, FN_SEL_SCIFA2_1,
-+ /* SEL_SCIFA3 [1] */
-+ FN_SEL_SCIFA3_0, FN_SEL_SCIFA3_1,
-+ /* SEL_SCIFA4 [2] */
-+ FN_SEL_SCIFA4_0, FN_SEL_SCIFA4_1, FN_SEL_SCIFA4_2,
-+ FN_SEL_SCIFA4_3,
-+ /* SEL_SCIFA5 [2] */
-+ FN_SEL_SCIFA5_0, FN_SEL_SCIFA5_1, FN_SEL_SCIFA5_2,
-+ FN_SEL_SCIFA5_3,
-+ /* SEL_SPDM [1] */
-+ FN_SEL_SPDM_0, FN_SEL_SPDM_1,
-+ /* SEL_TMU [1] */
-+ FN_SEL_TMU_0, FN_SEL_TMU_1,
-+ /* SEL_TSIF0 [2] */
-+ FN_SEL_TSIF0_0, FN_SEL_TSIF0_1, FN_SEL_TSIF0_2, FN_SEL_TSIF0_3,
-+ /* SEL_CAN0 [2] */
-+ FN_SEL_CAN0_0, FN_SEL_CAN0_1, FN_SEL_CAN0_2, FN_SEL_CAN0_3,
-+ /* SEL_CAN1 [2] */
-+ FN_SEL_CAN1_0, FN_SEL_CAN1_1, FN_SEL_CAN1_2, FN_SEL_CAN1_3,
-+ /* SEL_HSCIF0 [1] */
-+ FN_SEL_HSCIF0_0, FN_SEL_HSCIF0_1,
-+ /* SEL_HSCIF1 [1] */
-+ FN_SEL_HSCIF1_0, FN_SEL_HSCIF1_1,
-+ /* SEL_RDS [2] */
-+ FN_SEL_RDS_0, FN_SEL_RDS_1, FN_SEL_RDS_2, FN_SEL_RDS_3, }
-+ },
-+ { PINMUX_CFG_REG_VAR("MOD_SEL3", 0xE6060098, 32,
-+ 2, 2, 2, 1, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1,
-+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) {
-+ /* SEL_SCIF0 [2] */
-+ FN_SEL_SCIF0_0, FN_SEL_SCIF0_1, FN_SEL_SCIF0_2, FN_SEL_SCIF0_3,
-+ /* SEL_SCIF1 [2] */
-+ FN_SEL_SCIF1_0, FN_SEL_SCIF1_1, FN_SEL_SCIF1_2, 0,
-+ /* SEL_SCIF2 [2] */
-+ FN_SEL_SCIF2_0, FN_SEL_SCIF2_1, FN_SEL_SCIF2_2, 0,
-+ /* SEL_SCIF3 [1] */
-+ FN_SEL_SCIF3_0, FN_SEL_SCIF3_1,
-+ /* SEL_SCIF4 [3] */
-+ FN_SEL_SCIF4_0, FN_SEL_SCIF4_1, FN_SEL_SCIF4_2, FN_SEL_SCIF4_3,
-+ FN_SEL_SCIF4_4, 0, 0, 0,
-+ /* SEL_SCIF5 [2] */
-+ FN_SEL_SCIF5_0, FN_SEL_SCIF5_1, FN_SEL_SCIF5_2, FN_SEL_SCIF5_3,
-+ /* SEL_SSI1 [1] */
-+ FN_SEL_SSI1_0, FN_SEL_SSI1_1,
-+ /* SEL_SSI2 [1] */
-+ FN_SEL_SSI2_0, FN_SEL_SSI2_1,
-+ /* SEL_SSI4 [1] */
-+ FN_SEL_SSI4_0, FN_SEL_SSI4_1,
-+ /* SEL_SSI5 [1] */
-+ FN_SEL_SSI5_0, FN_SEL_SSI5_1,
-+ /* SEL_SSI6 [1] */
-+ FN_SEL_SSI6_0, FN_SEL_SSI6_1,
-+ /* SEL_SSI7 [1] */
-+ FN_SEL_SSI7_0, FN_SEL_SSI7_1,
-+ /* SEL_SSI8 [1] */
-+ FN_SEL_SSI8_0, FN_SEL_SSI8_1,
-+ /* SEL_SSI9 [1] */
-+ FN_SEL_SSI9_0, FN_SEL_SSI9_1,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0,
-+ /* RESERVED [1] */
-+ 0, 0, }
-+ },
-+ { },
-+};
-+
-+const struct sh_pfc_soc_info r8a7794_pinmux_info = {
-+ .name = "r8a77940_pfc",
-+ .unlock_reg = 0xe6060000, /* PMMR */
-+
-+ .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
-+
-+ .pins = pinmux_pins,
-+ .nr_pins = ARRAY_SIZE(pinmux_pins),
-+ .groups = pinmux_groups,
-+ .nr_groups = ARRAY_SIZE(pinmux_groups),
-+ .functions = pinmux_functions,
-+ .nr_functions = ARRAY_SIZE(pinmux_functions),
-+
-+ .cfg_regs = pinmux_config_regs,
-+
-+ .gpio_data = pinmux_data,
-+ .gpio_data_size = ARRAY_SIZE(pinmux_data),
-+};
---
-2.6.2
-
diff --git a/patches.renesas/0247-pinctrl-sh-pfc-r8a7794-add-MMCIF-pin-groups.patch b/patches.renesas/0247-pinctrl-sh-pfc-r8a7794-add-MMCIF-pin-groups.patch
deleted file mode 100644
index d89bb834546865..00000000000000
--- a/patches.renesas/0247-pinctrl-sh-pfc-r8a7794-add-MMCIF-pin-groups.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From afc12d8a8d3d452212d13bb4f6d47a3033b37901 Mon Sep 17 00:00:00 2001
-From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
-Date: Sat, 6 Jun 2015 01:35:54 +0300
-Subject: [PATCH 247/326] pinctrl: sh-pfc: r8a7794: add MMCIF pin groups
-
-Add MMCIF pin groups to R8A7794 PFC driver.
-
-Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
-[Sergei: rebased, renamed, added changelog.]
-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 f1f74b640c952e311aebaa594d9d81fecb72cc17)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/pfc-r8a7794.c | 46 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 46 insertions(+)
-
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-index 0e2686a2093c..4679ca01f976 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-@@ -1919,6 +1919,40 @@ static const unsigned int intc_irq9_pins[] = {
- static const unsigned int intc_irq9_mux[] = {
- IRQ9_MARK,
- };
-+/* - MMCIF ------------------------------------------------------------------ */
-+static const unsigned int mmc_data1_pins[] = {
-+ /* D[0] */
-+ RCAR_GP_PIN(6, 18),
-+};
-+static const unsigned int mmc_data1_mux[] = {
-+ MMC_D0_MARK,
-+};
-+static const unsigned int mmc_data4_pins[] = {
-+ /* D[0:3] */
-+ RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
-+ RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
-+};
-+static const unsigned int mmc_data4_mux[] = {
-+ MMC_D0_MARK, MMC_D1_MARK, MMC_D2_MARK, MMC_D3_MARK,
-+};
-+static const unsigned int mmc_data8_pins[] = {
-+ /* D[0:7] */
-+ RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
-+ RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
-+ RCAR_GP_PIN(6, 22), RCAR_GP_PIN(6, 23),
-+ RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25),
-+};
-+static const unsigned int mmc_data8_mux[] = {
-+ MMC_D0_MARK, MMC_D1_MARK, MMC_D2_MARK, MMC_D3_MARK,
-+ MMC_D4_MARK, MMC_D5_MARK, MMC_D6_MARK, MMC_D7_MARK,
-+};
-+static const unsigned int mmc_ctrl_pins[] = {
-+ /* CLK, CMD */
-+ RCAR_GP_PIN(6, 16), RCAR_GP_PIN(6, 17),
-+};
-+static const unsigned int mmc_ctrl_mux[] = {
-+ MMC_CLK_MARK, MMC_CMD_MARK,
-+};
- /* - MSIOF0 ----------------------------------------------------------------- */
- static const unsigned int msiof0_clk_pins[] = {
- /* SCK */
-@@ -2683,6 +2717,10 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
- SH_PFC_PIN_GROUP(intc_irq7),
- SH_PFC_PIN_GROUP(intc_irq8),
- SH_PFC_PIN_GROUP(intc_irq9),
-+ SH_PFC_PIN_GROUP(mmc_data1),
-+ SH_PFC_PIN_GROUP(mmc_data4),
-+ SH_PFC_PIN_GROUP(mmc_data8),
-+ SH_PFC_PIN_GROUP(mmc_ctrl),
- SH_PFC_PIN_GROUP(msiof0_clk),
- SH_PFC_PIN_GROUP(msiof0_sync),
- SH_PFC_PIN_GROUP(msiof0_ss1),
-@@ -2869,6 +2907,13 @@ static const char * const intc_groups[] = {
- "intc_irq9",
- };
-
-+static const char * const mmc_groups[] = {
-+ "mmc_data1",
-+ "mmc_data4",
-+ "mmc_data8",
-+ "mmc_ctrl",
-+};
-+
- static const char * const msiof0_groups[] = {
- "msiof0_clk",
- "msiof0_sync",
-@@ -3035,6 +3080,7 @@ static const struct sh_pfc_function pinmux_functions[] = {
- SH_PFC_FUNCTION(i2c3),
- SH_PFC_FUNCTION(i2c4),
- SH_PFC_FUNCTION(intc),
-+ SH_PFC_FUNCTION(mmc),
- SH_PFC_FUNCTION(msiof0),
- SH_PFC_FUNCTION(msiof1),
- SH_PFC_FUNCTION(msiof2),
---
-2.6.2
-
diff --git a/patches.renesas/0248-pinctrl-sh-pfc-r8a7794-add-SDHI-pin-groups.patch b/patches.renesas/0248-pinctrl-sh-pfc-r8a7794-add-SDHI-pin-groups.patch
deleted file mode 100644
index 99c1f14dade28e..00000000000000
--- a/patches.renesas/0248-pinctrl-sh-pfc-r8a7794-add-SDHI-pin-groups.patch
+++ /dev/null
@@ -1,208 +0,0 @@
-From 05fe9248049638e329bf3a7c929baf992126b1fd Mon Sep 17 00:00:00 2001
-From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
-Date: Sat, 6 Jun 2015 01:36:50 +0300
-Subject: [PATCH 248/326] pinctrl: sh-pfc: r8a7794: add SDHI pin groups
-
-Add SDHI0/1/2 pin groups to R8A7794 PFC driver.
-
-Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
-[Sergei: renamed SD data pins to match the driver, rebased, renamed, added
-changelog.]
-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 7ac91bda80a05122ca86240b1da3a68a4cdaa982)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/pfc-r8a7794.c | 153 +++++++++++++++++++++++++++++++++++
- 1 file changed, 153 insertions(+)
-
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-index 4679ca01f976..bfdcac4b3bc4 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-@@ -2659,6 +2659,117 @@ static const unsigned int scifb2_ctrl_pins[] = {
- static const unsigned int scifb2_ctrl_mux[] = {
- SCIFB2_RTS_N_MARK, SCIFB2_CTS_N_MARK,
- };
-+/* - SDHI0 ------------------------------------------------------------------ */
-+static const unsigned int sdhi0_data1_pins[] = {
-+ /* D0 */
-+ RCAR_GP_PIN(6, 2),
-+};
-+static const unsigned int sdhi0_data1_mux[] = {
-+ SD0_DATA0_MARK,
-+};
-+static const unsigned int sdhi0_data4_pins[] = {
-+ /* D[0:3] */
-+ RCAR_GP_PIN(6, 2), RCAR_GP_PIN(6, 3),
-+ RCAR_GP_PIN(6, 4), RCAR_GP_PIN(6, 5),
-+};
-+static const unsigned int sdhi0_data4_mux[] = {
-+ SD0_DATA0_MARK, SD0_DATA1_MARK, SD0_DATA2_MARK, SD0_DATA3_MARK,
-+};
-+static const unsigned int sdhi0_ctrl_pins[] = {
-+ /* CLK, CMD */
-+ RCAR_GP_PIN(6, 0), RCAR_GP_PIN(6, 1),
-+};
-+static const unsigned int sdhi0_ctrl_mux[] = {
-+ SD0_CLK_MARK, SD0_CMD_MARK,
-+};
-+static const unsigned int sdhi0_cd_pins[] = {
-+ /* CD */
-+ RCAR_GP_PIN(6, 6),
-+};
-+static const unsigned int sdhi0_cd_mux[] = {
-+ SD0_CD_MARK,
-+};
-+static const unsigned int sdhi0_wp_pins[] = {
-+ /* WP */
-+ RCAR_GP_PIN(6, 7),
-+};
-+static const unsigned int sdhi0_wp_mux[] = {
-+ SD0_WP_MARK,
-+};
-+/* - SDHI1 ------------------------------------------------------------------ */
-+static const unsigned int sdhi1_data1_pins[] = {
-+ /* D0 */
-+ RCAR_GP_PIN(6, 10),
-+};
-+static const unsigned int sdhi1_data1_mux[] = {
-+ SD1_DATA0_MARK,
-+};
-+static const unsigned int sdhi1_data4_pins[] = {
-+ /* D[0:3] */
-+ RCAR_GP_PIN(6, 10), RCAR_GP_PIN(6, 11),
-+ RCAR_GP_PIN(6, 12), RCAR_GP_PIN(6, 13),
-+};
-+static const unsigned int sdhi1_data4_mux[] = {
-+ SD1_DATA0_MARK, SD1_DATA1_MARK, SD1_DATA2_MARK, SD1_DATA3_MARK,
-+};
-+static const unsigned int sdhi1_ctrl_pins[] = {
-+ /* CLK, CMD */
-+ RCAR_GP_PIN(6, 8), RCAR_GP_PIN(6, 9),
-+};
-+static const unsigned int sdhi1_ctrl_mux[] = {
-+ SD1_CLK_MARK, SD1_CMD_MARK,
-+};
-+static const unsigned int sdhi1_cd_pins[] = {
-+ /* CD */
-+ RCAR_GP_PIN(6, 14),
-+};
-+static const unsigned int sdhi1_cd_mux[] = {
-+ SD1_CD_MARK,
-+};
-+static const unsigned int sdhi1_wp_pins[] = {
-+ /* WP */
-+ RCAR_GP_PIN(6, 15),
-+};
-+static const unsigned int sdhi1_wp_mux[] = {
-+ SD1_WP_MARK,
-+};
-+/* - SDHI2 ------------------------------------------------------------------ */
-+static const unsigned int sdhi2_data1_pins[] = {
-+ /* D0 */
-+ RCAR_GP_PIN(6, 18),
-+};
-+static const unsigned int sdhi2_data1_mux[] = {
-+ SD2_DATA0_MARK,
-+};
-+static const unsigned int sdhi2_data4_pins[] = {
-+ /* D[0:3] */
-+ RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
-+ RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
-+};
-+static const unsigned int sdhi2_data4_mux[] = {
-+ SD2_DATA0_MARK, SD2_DATA1_MARK, SD2_DATA2_MARK, SD2_DATA3_MARK,
-+};
-+static const unsigned int sdhi2_ctrl_pins[] = {
-+ /* CLK, CMD */
-+ RCAR_GP_PIN(6, 16), RCAR_GP_PIN(6, 17),
-+};
-+static const unsigned int sdhi2_ctrl_mux[] = {
-+ SD2_CLK_MARK, SD2_CMD_MARK,
-+};
-+static const unsigned int sdhi2_cd_pins[] = {
-+ /* CD */
-+ RCAR_GP_PIN(6, 22),
-+};
-+static const unsigned int sdhi2_cd_mux[] = {
-+ SD2_CD_MARK,
-+};
-+static const unsigned int sdhi2_wp_pins[] = {
-+ /* WP */
-+ RCAR_GP_PIN(6, 23),
-+};
-+static const unsigned int sdhi2_wp_mux[] = {
-+ SD2_WP_MARK,
-+};
-
- static const struct sh_pfc_pin_group pinmux_groups[] = {
- SH_PFC_PIN_GROUP(eth_link),
-@@ -2819,6 +2930,21 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
- SH_PFC_PIN_GROUP(scifb2_data),
- SH_PFC_PIN_GROUP(scifb2_clk),
- SH_PFC_PIN_GROUP(scifb2_ctrl),
-+ SH_PFC_PIN_GROUP(sdhi0_data1),
-+ SH_PFC_PIN_GROUP(sdhi0_data4),
-+ SH_PFC_PIN_GROUP(sdhi0_ctrl),
-+ SH_PFC_PIN_GROUP(sdhi0_cd),
-+ SH_PFC_PIN_GROUP(sdhi0_wp),
-+ SH_PFC_PIN_GROUP(sdhi1_data1),
-+ SH_PFC_PIN_GROUP(sdhi1_data4),
-+ SH_PFC_PIN_GROUP(sdhi1_ctrl),
-+ SH_PFC_PIN_GROUP(sdhi1_cd),
-+ SH_PFC_PIN_GROUP(sdhi1_wp),
-+ SH_PFC_PIN_GROUP(sdhi2_data1),
-+ SH_PFC_PIN_GROUP(sdhi2_data4),
-+ SH_PFC_PIN_GROUP(sdhi2_ctrl),
-+ SH_PFC_PIN_GROUP(sdhi2_cd),
-+ SH_PFC_PIN_GROUP(sdhi2_wp),
- };
-
- static const char * const eth_groups[] = {
-@@ -3069,6 +3195,30 @@ static const char * const scifb2_groups[] = {
- "scifb2_ctrl",
- };
-
-+static const char * const sdhi0_groups[] = {
-+ "sdhi0_data1",
-+ "sdhi0_data4",
-+ "sdhi0_ctrl",
-+ "sdhi0_cd",
-+ "sdhi0_wp",
-+};
-+
-+static const char * const sdhi1_groups[] = {
-+ "sdhi1_data1",
-+ "sdhi1_data4",
-+ "sdhi1_ctrl",
-+ "sdhi1_cd",
-+ "sdhi1_wp",
-+};
-+
-+static const char * const sdhi2_groups[] = {
-+ "sdhi2_data1",
-+ "sdhi2_data4",
-+ "sdhi2_ctrl",
-+ "sdhi2_cd",
-+ "sdhi2_wp",
-+};
-+
- static const struct sh_pfc_function pinmux_functions[] = {
- SH_PFC_FUNCTION(eth),
- SH_PFC_FUNCTION(hscif0),
-@@ -3100,6 +3250,9 @@ static const struct sh_pfc_function pinmux_functions[] = {
- SH_PFC_FUNCTION(scifb0),
- SH_PFC_FUNCTION(scifb1),
- SH_PFC_FUNCTION(scifb2),
-+ SH_PFC_FUNCTION(sdhi0),
-+ SH_PFC_FUNCTION(sdhi1),
-+ SH_PFC_FUNCTION(sdhi2),
- };
-
- static const struct pinmux_cfg_reg pinmux_config_regs[] = {
---
-2.6.2
-
diff --git a/patches.renesas/0249-sh-pfc-r8a7790-remove-non-existing-GPIO-pins.patch b/patches.renesas/0249-sh-pfc-r8a7790-remove-non-existing-GPIO-pins.patch
deleted file mode 100644
index 958b18155a72ba..00000000000000
--- a/patches.renesas/0249-sh-pfc-r8a7790-remove-non-existing-GPIO-pins.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 0a137085a31097b4a7991c8e6b114117600f9e20 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Fri, 26 Jun 2015 01:42:04 +0300
-Subject: [PATCH 249/326] sh-pfc: r8a7790: remove non-existing GPIO pins
-
-GPIO banks 1 and 2 are missing pins 30 and 31. Remove them.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit b5599df20f1ee45cef811a7ab1c7358d9faf7bf8)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/pfc-r8a7790.c | 21 +++++++++++++++++++--
- 1 file changed, 19 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
-index baab81ead9ff..fc344a7c2b53 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c
-@@ -27,10 +27,27 @@
- #include "core.h"
- #include "sh_pfc.h"
-
-+#define PORT_GP_30(bank, fn, sfx) \
-+ PORT_GP_1(bank, 0, fn, sfx), PORT_GP_1(bank, 1, fn, sfx), \
-+ PORT_GP_1(bank, 2, fn, sfx), PORT_GP_1(bank, 3, fn, sfx), \
-+ PORT_GP_1(bank, 4, fn, sfx), PORT_GP_1(bank, 5, fn, sfx), \
-+ PORT_GP_1(bank, 6, fn, sfx), PORT_GP_1(bank, 7, fn, sfx), \
-+ PORT_GP_1(bank, 8, fn, sfx), PORT_GP_1(bank, 9, fn, sfx), \
-+ PORT_GP_1(bank, 10, fn, sfx), PORT_GP_1(bank, 11, fn, sfx), \
-+ PORT_GP_1(bank, 12, fn, sfx), PORT_GP_1(bank, 13, fn, sfx), \
-+ PORT_GP_1(bank, 14, fn, sfx), PORT_GP_1(bank, 15, fn, sfx), \
-+ PORT_GP_1(bank, 16, fn, sfx), PORT_GP_1(bank, 17, fn, sfx), \
-+ PORT_GP_1(bank, 18, fn, sfx), PORT_GP_1(bank, 19, fn, sfx), \
-+ PORT_GP_1(bank, 20, fn, sfx), PORT_GP_1(bank, 21, fn, sfx), \
-+ PORT_GP_1(bank, 22, fn, sfx), PORT_GP_1(bank, 23, fn, sfx), \
-+ PORT_GP_1(bank, 24, fn, sfx), PORT_GP_1(bank, 25, fn, sfx), \
-+ PORT_GP_1(bank, 26, fn, sfx), PORT_GP_1(bank, 27, fn, sfx), \
-+ PORT_GP_1(bank, 28, fn, sfx), PORT_GP_1(bank, 29, fn, sfx)
-+
- #define CPU_ALL_PORT(fn, sfx) \
- PORT_GP_32(0, fn, sfx), \
-- PORT_GP_32(1, fn, sfx), \
-- PORT_GP_32(2, fn, sfx), \
-+ PORT_GP_30(1, fn, sfx), \
-+ PORT_GP_30(2, fn, sfx), \
- PORT_GP_32(3, fn, sfx), \
- PORT_GP_32(4, fn, sfx), \
- PORT_GP_32(5, fn, sfx)
---
-2.6.2
-
diff --git a/patches.renesas/0250-sh-pfc-r8a7791-remove-non-existing-GPIO-pins.patch b/patches.renesas/0250-sh-pfc-r8a7791-remove-non-existing-GPIO-pins.patch
deleted file mode 100644
index 6514008af7fcbb..00000000000000
--- a/patches.renesas/0250-sh-pfc-r8a7791-remove-non-existing-GPIO-pins.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 765c8732dd68dbdbf43b67f548c769ce213f1abb Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Fri, 26 Jun 2015 01:43:07 +0300
-Subject: [PATCH 250/326] sh-pfc: r8a7791: remove non-existing GPIO pins
-
-GPIO banks 1 and 7 are missing pins 26 to 31. Remove them.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 441f77dcf8defcebb4477fea6db03624259fef42)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/pfc-r8a7791.c | 19 +++++++++++++++++--
- 1 file changed, 17 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-index 3ddf23ec9f0b..25e8117f5a1a 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
-@@ -14,15 +14,30 @@
- #include "core.h"
- #include "sh_pfc.h"
-
-+#define PORT_GP_26(bank, fn, sfx) \
-+ PORT_GP_1(bank, 0, fn, sfx), PORT_GP_1(bank, 1, fn, sfx), \
-+ PORT_GP_1(bank, 2, fn, sfx), PORT_GP_1(bank, 3, fn, sfx), \
-+ PORT_GP_1(bank, 4, fn, sfx), PORT_GP_1(bank, 5, fn, sfx), \
-+ PORT_GP_1(bank, 6, fn, sfx), PORT_GP_1(bank, 7, fn, sfx), \
-+ PORT_GP_1(bank, 8, fn, sfx), PORT_GP_1(bank, 9, fn, sfx), \
-+ PORT_GP_1(bank, 10, fn, sfx), PORT_GP_1(bank, 11, fn, sfx), \
-+ PORT_GP_1(bank, 12, fn, sfx), PORT_GP_1(bank, 13, fn, sfx), \
-+ PORT_GP_1(bank, 14, fn, sfx), PORT_GP_1(bank, 15, fn, sfx), \
-+ PORT_GP_1(bank, 16, fn, sfx), PORT_GP_1(bank, 17, fn, sfx), \
-+ PORT_GP_1(bank, 18, fn, sfx), PORT_GP_1(bank, 19, fn, sfx), \
-+ PORT_GP_1(bank, 20, fn, sfx), PORT_GP_1(bank, 21, fn, sfx), \
-+ PORT_GP_1(bank, 22, fn, sfx), PORT_GP_1(bank, 23, fn, sfx), \
-+ PORT_GP_1(bank, 24, fn, sfx), PORT_GP_1(bank, 25, fn, sfx)
-+
- #define CPU_ALL_PORT(fn, sfx) \
- PORT_GP_32(0, fn, sfx), \
-- PORT_GP_32(1, fn, sfx), \
-+ PORT_GP_26(1, fn, sfx), \
- PORT_GP_32(2, fn, sfx), \
- PORT_GP_32(3, fn, sfx), \
- PORT_GP_32(4, fn, sfx), \
- PORT_GP_32(5, fn, sfx), \
- PORT_GP_32(6, fn, sfx), \
-- PORT_GP_32(7, fn, sfx)
-+ PORT_GP_26(7, fn, sfx)
-
- enum {
- PINMUX_RESERVED = 0,
---
-2.6.2
-
diff --git a/patches.renesas/0251-pinctrl-sh-pfc-Accept-standard-function-pins-and-gro.patch b/patches.renesas/0251-pinctrl-sh-pfc-Accept-standard-function-pins-and-gro.patch
deleted file mode 100644
index 5d10442caaa69d..00000000000000
--- a/patches.renesas/0251-pinctrl-sh-pfc-Accept-standard-function-pins-and-gro.patch
+++ /dev/null
@@ -1,188 +0,0 @@
-From 5e438426ea20f62967e4c63343d4f332e0bb6429 Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Tue, 30 Jun 2015 11:29:57 +0300
-Subject: [PATCH 251/326] pinctrl: sh-pfc: Accept standard function, pins and
- groups properties
-
-The "function", "pins" and "groups" pinmux and pinctrl properties have
-been standardized. Support them in addition to the custom "renesas,*"
-properties. New-style and old-style properties can't be mixed in DT.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 16ccaf5bb5a52372bfebd3dfbb79dd810ad49c09)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../bindings/pinctrl/renesas,pfc-pinctrl.txt | 20 +++++------
- drivers/pinctrl/sh-pfc/pinctrl.c | 42 +++++++++++++++++-----
- 2 files changed, 44 insertions(+), 18 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-index 51cee44fc140..e089142cfb14 100644
---- a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-+++ b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-@@ -58,12 +58,12 @@ are parsed through phandles and processed purely based on their content.
-
- Pin Configuration Node Properties:
-
--- renesas,pins : An array of strings, each string containing the name of a pin.
--- renesas,groups : An array of strings, each string containing the name of a pin
-+- pins : An array of strings, each string containing the name of a pin.
-+- groups : An array of strings, each string containing the name of a pin
- group.
-
--- renesas,function: A string containing the name of the function to mux to the
-- pin group(s) specified by the renesas,groups property
-+- function: A string containing the name of the function to mux to the pin
-+ group(s) specified by the groups property.
-
- Valid values for pin, group and function names can be found in the group and
- function arrays of the PFC data file corresponding to the SoC
-@@ -141,19 +141,19 @@ Example 3: KZM-A9-GT (SH-Mobile AG5) default pin state hog and pin control maps
-
- mmcif_pins: mmcif {
- mux {
-- renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0";
-- renesas,function = "mmc0";
-+ groups = "mmc0_data8_0", "mmc0_ctrl_0";
-+ function = "mmc0";
- };
- cfg {
-- renesas,groups = "mmc0_data8_0";
-- renesas,pins = "PORT279";
-+ groups = "mmc0_data8_0";
-+ pins = "PORT279";
- bias-pull-up;
- };
- };
-
- scifa4_pins: scifa4 {
-- renesas,groups = "scifa4_data", "scifa4_ctrl";
-- renesas,function = "scifa4";
-+ groups = "scifa4_data", "scifa4_ctrl";
-+ function = "scifa4";
- };
- };
-
-diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
-index ff678966008b..6fe7459f0ccb 100644
---- a/drivers/pinctrl/sh-pfc/pinctrl.c
-+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
-@@ -40,6 +40,10 @@ struct sh_pfc_pinctrl {
-
- struct pinctrl_pin_desc *pins;
- struct sh_pfc_pin_config *configs;
-+
-+ const char *func_prop_name;
-+ const char *groups_prop_name;
-+ const char *pins_prop_name;
- };
-
- static int sh_pfc_get_groups_count(struct pinctrl_dev *pctldev)
-@@ -96,10 +100,13 @@ static int sh_pfc_map_add_config(struct pinctrl_map *map,
- return 0;
- }
-
--static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np,
-+static int sh_pfc_dt_subnode_to_map(struct pinctrl_dev *pctldev,
-+ struct device_node *np,
- struct pinctrl_map **map,
- unsigned int *num_maps, unsigned int *index)
- {
-+ struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
-+ struct device *dev = pmx->pfc->dev;
- struct pinctrl_map *maps = *map;
- unsigned int nmaps = *num_maps;
- unsigned int idx = *index;
-@@ -113,10 +120,27 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np,
- const char *pin;
- int ret;
-
-+ /* Support both the old Renesas-specific properties and the new standard
-+ * properties. Mixing old and new properties isn't allowed, neither
-+ * inside a subnode nor across subnodes.
-+ */
-+ if (!pmx->func_prop_name) {
-+ if (of_find_property(np, "groups", NULL) ||
-+ of_find_property(np, "pins", NULL)) {
-+ pmx->func_prop_name = "function";
-+ pmx->groups_prop_name = "groups";
-+ pmx->pins_prop_name = "pins";
-+ } else {
-+ pmx->func_prop_name = "renesas,function";
-+ pmx->groups_prop_name = "renesas,groups";
-+ pmx->pins_prop_name = "renesas,pins";
-+ }
-+ }
-+
- /* Parse the function and configuration properties. At least a function
- * or one configuration must be specified.
- */
-- ret = of_property_read_string(np, "renesas,function", &function);
-+ ret = of_property_read_string(np, pmx->func_prop_name, &function);
- if (ret < 0 && ret != -EINVAL) {
- dev_err(dev, "Invalid function in DT\n");
- return ret;
-@@ -129,11 +153,12 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np,
- if (!function && num_configs == 0) {
- dev_err(dev,
- "DT node must contain at least a function or config\n");
-+ ret = -ENODEV;
- goto done;
- }
-
- /* Count the number of pins and groups and reallocate mappings. */
-- ret = of_property_count_strings(np, "renesas,pins");
-+ ret = of_property_count_strings(np, pmx->pins_prop_name);
- if (ret == -EINVAL) {
- num_pins = 0;
- } else if (ret < 0) {
-@@ -143,7 +168,7 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np,
- num_pins = ret;
- }
-
-- ret = of_property_count_strings(np, "renesas,groups");
-+ ret = of_property_count_strings(np, pmx->groups_prop_name);
- if (ret == -EINVAL) {
- num_groups = 0;
- } else if (ret < 0) {
-@@ -174,7 +199,7 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np,
- *num_maps = nmaps;
-
- /* Iterate over pins and groups and create the mappings. */
-- of_property_for_each_string(np, "renesas,groups", prop, group) {
-+ of_property_for_each_string(np, pmx->groups_prop_name, prop, group) {
- if (function) {
- maps[idx].type = PIN_MAP_TYPE_MUX_GROUP;
- maps[idx].data.mux.group = group;
-@@ -198,7 +223,7 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np,
- goto done;
- }
-
-- of_property_for_each_string(np, "renesas,pins", prop, pin) {
-+ of_property_for_each_string(np, pmx->pins_prop_name, prop, pin) {
- ret = sh_pfc_map_add_config(&maps[idx], pin,
- PIN_MAP_TYPE_CONFIGS_PIN,
- configs, num_configs);
-@@ -246,7 +271,7 @@ static int sh_pfc_dt_node_to_map(struct pinctrl_dev *pctldev,
- index = 0;
-
- for_each_child_of_node(np, child) {
-- ret = sh_pfc_dt_subnode_to_map(dev, child, map, num_maps,
-+ ret = sh_pfc_dt_subnode_to_map(pctldev, child, map, num_maps,
- &index);
- if (ret < 0)
- goto done;
-@@ -254,7 +279,8 @@ static int sh_pfc_dt_node_to_map(struct pinctrl_dev *pctldev,
-
- /* If no mapping has been found in child nodes try the config node. */
- if (*num_maps == 0) {
-- ret = sh_pfc_dt_subnode_to_map(dev, np, map, num_maps, &index);
-+ ret = sh_pfc_dt_subnode_to_map(pctldev, np, map, num_maps,
-+ &index);
- if (ret < 0)
- goto done;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0252-pinctrl-sh-pfc-Convert-to-platform_get_.patch b/patches.renesas/0252-pinctrl-sh-pfc-Convert-to-platform_get_.patch
deleted file mode 100644
index 7626a0e37534ea..00000000000000
--- a/patches.renesas/0252-pinctrl-sh-pfc-Convert-to-platform_get_.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From 1941ea8aac7287ea40ab9d1a266fe4e3206a84c9 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 25 Jun 2015 11:39:53 +0200
-Subject: [PATCH 252/326] pinctrl: sh-pfc: Convert to platform_get_*()
-
-If the pin function controller (which can be a GPIO controller) is
-instantiated before the interrupt controllers, due to the ordering in
-the DTS, the irq domains for the interrupt controllers referenced by its
-"interrupts-extended" property cannot be found yet:
-
- irq: no irq domain found for /interrupt-controller@e61c0000 !
-
-As the sh-pfc driver accesses the platform device's resources directly,
-it cannot find the (optional) IRQ resources, and thinks no interrupts
-are available. This may lead to failures later, when GPIOs are used as
-interupts:
-
- gpio-keys keyboard: Unable to claim irq 0; error -22
- gpio-keys: probe of keyboard failed with error -22
-
-To fix this, add support for deferred probing to sh-pfc, by converting
-the driver from direct platform device resource access to using the
-platform_get_resource() and platform_get_irq() helpers.
-
-Note that while this fixes the root cause worked around by commit
-e4ba0a9bddff3ba5 ("ARM: shmobile: r8a73a4: Move pfc node to work around
-probe ordering bug"), I strongly recommend against reverting the
-workaround now, as this would lead to lots of probe deferrals in drivers
-relying on pinctrl. This may be reconsidered once the DT code starts
-taking into account phandle dependencies during device instantation.
-
-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 c7977ec4a33633c8e8d9267dd014356cf857351c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/core.c | 46 ++++++++++++++++++++-----------------------
- 1 file changed, 21 insertions(+), 25 deletions(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
-index 865d235612c5..979623895904 100644
---- a/drivers/pinctrl/sh-pfc/core.c
-+++ b/drivers/pinctrl/sh-pfc/core.c
-@@ -29,24 +29,25 @@
- static int sh_pfc_map_resources(struct sh_pfc *pfc,
- struct platform_device *pdev)
- {
-- unsigned int num_windows = 0;
-- unsigned int num_irqs = 0;
-+ unsigned int num_windows, num_irqs;
- struct sh_pfc_window *windows;
- unsigned int *irqs = NULL;
- struct resource *res;
- unsigned int i;
-+ int irq;
-
- /* Count the MEM and IRQ resources. */
-- for (i = 0; i < pdev->num_resources; ++i) {
-- switch (resource_type(&pdev->resource[i])) {
-- case IORESOURCE_MEM:
-- num_windows++;
-+ for (num_windows = 0;; num_windows++) {
-+ res = platform_get_resource(pdev, IORESOURCE_MEM, num_windows);
-+ if (!res)
- break;
--
-- case IORESOURCE_IRQ:
-- num_irqs++;
-+ }
-+ for (num_irqs = 0;; num_irqs++) {
-+ irq = platform_get_irq(pdev, num_irqs);
-+ if (irq == -EPROBE_DEFER)
-+ return irq;
-+ if (irq < 0)
- break;
-- }
- }
-
- if (num_windows == 0)
-@@ -72,22 +73,17 @@ static int sh_pfc_map_resources(struct sh_pfc *pfc,
- }
-
- /* Fill them. */
-- for (i = 0, res = pdev->resource; i < pdev->num_resources; i++, res++) {
-- switch (resource_type(res)) {
-- case IORESOURCE_MEM:
-- windows->phys = res->start;
-- windows->size = resource_size(res);
-- windows->virt = devm_ioremap_resource(pfc->dev, res);
-- if (IS_ERR(windows->virt))
-- return -ENOMEM;
-- windows++;
-- break;
--
-- case IORESOURCE_IRQ:
-- *irqs++ = res->start;
-- break;
-- }
-+ for (i = 0; i < num_windows; i++) {
-+ res = platform_get_resource(pdev, IORESOURCE_MEM, i);
-+ windows->phys = res->start;
-+ windows->size = resource_size(res);
-+ windows->virt = devm_ioremap_resource(pfc->dev, res);
-+ if (IS_ERR(windows->virt))
-+ return -ENOMEM;
-+ windows++;
- }
-+ for (i = 0; i < num_irqs; i++)
-+ *irqs++ = platform_get_irq(pdev, i);
-
- return 0;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0253-dmaengine-shdma-Make-dummy-shdma_chan_filter-always-.patch b/patches.renesas/0253-dmaengine-shdma-Make-dummy-shdma_chan_filter-always-.patch
deleted file mode 100644
index 0f5194cc947f21..00000000000000
--- a/patches.renesas/0253-dmaengine-shdma-Make-dummy-shdma_chan_filter-always-.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 4b83c965ad8e2d2bfc84fe2abbea9a7fac7ee117 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Fri, 10 Jul 2015 12:07:25 +0200
-Subject: [PATCH 253/326] dmaengine: shdma: Make dummy shdma_chan_filter()
- always return false
-
-If CONFIG_SH_DMAE_BASE (which is required for DMA engine support for
-legacy SH, SH/R-Mobile, and R-Car Gen1, but not for R-Car Gen2) is not
-enabled, but CONFIG_RCAR_DMAC (for R-Car Gen2 DMA engine support) is,
-and the DTS doesn't provide a "dmas" property for a device,
-dma_request_slave_channel_compat() incorrectly succeeds, and returns a
-DMA channel.
-
-However, when trying to use that DMA channel later, it fails with:
-
- rcar-dmac e6700000.dma-controller: rcar_dmac_prep_slave_sg: bad parameter: len=1, id=-22
-
-(Fortunately most drivers can handle this failure, and fall back to
-PIO)
-
-The reason for this is that a NULL legacy filter function is used, which
-actually means "all channels are OK", not "do not match".
-If CONFIG_SH_DMAE_BASE is enabled (like in shmobile_defconfig, which
-supports other SoCs besides R-Car Gen2), shdma_chan_filter() correctly
-returns false, as no available channel on R-Car Gen2 matches a
-shdma-base channel.
-If the DTS does provide a "dmas" property, dma_request_slave_channel()
-succeeds, and legacy filter-based matching is not used.
-
-To fix this, change shdma_chan_filter from being NULL to a dummy
-function that always returns false, like is done on other platforms.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-(cherry picked from commit 056f6c87028544de934f27caf95aa1545d585767)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- include/linux/shdma-base.h | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
-index dd0ba502ccb3..d927647e6350 100644
---- a/include/linux/shdma-base.h
-+++ b/include/linux/shdma-base.h
-@@ -128,7 +128,10 @@ void shdma_cleanup(struct shdma_dev *sdev);
- #if IS_ENABLED(CONFIG_SH_DMAE_BASE)
- bool shdma_chan_filter(struct dma_chan *chan, void *arg);
- #else
--#define shdma_chan_filter NULL
-+static inline bool shdma_chan_filter(struct dma_chan *chan, void *arg)
-+{
-+ return false;
-+}
- #endif
-
- #endif
---
-2.6.2
-
diff --git a/patches.renesas/0254-dmaengine-sort-the-sh-Makefile.patch b/patches.renesas/0254-dmaengine-sort-the-sh-Makefile.patch
deleted file mode 100644
index 757cfe31b5a2b1..00000000000000
--- a/patches.renesas/0254-dmaengine-sort-the-sh-Makefile.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 9032ceae4e9ccafcd76d62de563081913318c67d Mon Sep 17 00:00:00 2001
-From: Vinod Koul <vinod.koul@intel.com>
-Date: Mon, 24 Aug 2015 13:43:14 +0530
-Subject: [PATCH 254/326] dmaengine: sort the sh Makefile
-
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-(cherry picked from commit 8a4ce226b9061fe3ab04f6db34d4b2ae645b9f65)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/dma/sh/Makefile | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/dma/sh/Makefile b/drivers/dma/sh/Makefile
-index b8a598066ce2..0133e4658196 100644
---- a/drivers/dma/sh/Makefile
-+++ b/drivers/dma/sh/Makefile
-@@ -13,7 +13,7 @@ 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_DMAC) += rcar-dmac.o
-+obj-$(CONFIG_RCAR_HPB_DMAE) += rcar-hpbdma.o
- obj-$(CONFIG_RENESAS_USB_DMAC) += usb-dmac.o
-+obj-$(CONFIG_SUDMAC) += sudmac.o
---
-2.6.2
-
diff --git a/patches.renesas/0255-usb-renesas_usbhs-Replace-deprecated-API-of-extcon.patch b/patches.renesas/0255-usb-renesas_usbhs-Replace-deprecated-API-of-extcon.patch
deleted file mode 100644
index 7ab0f2fee1879d..00000000000000
--- a/patches.renesas/0255-usb-renesas_usbhs-Replace-deprecated-API-of-extcon.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 9727315afa9175a86fd0c338f42ff2eeca17e9e7 Mon Sep 17 00:00:00 2001
-From: Chanwoo Choi <cw00.choi@samsung.com>
-Date: Wed, 1 Jul 2015 13:11:33 +0900
-Subject: [PATCH 255/326] usb: renesas_usbhs: Replace deprecated API of extcon
-
-This patch removes the deprecated API of extcon and then use the new extcon API
-with the unique id to indicate the each external connector (USB-HOST).
-- extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)
-
-Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Cc: Felipe Balbi <balbi@ti.com>
-Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Cc: Peter Chen <peter.chen@freescale.com>
-Cc: Varka Bhadram <varkab@cdac.in>
-Cc: Takeshi Kihara <takeshi.kihara.df@renesas.com>
-Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
-Signed-off-by: Felipe Balbi <balbi@ti.com>
-(cherry picked from commit 50297b79b8fd426f678431a8e9dcee59afd33ec8)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/usb/renesas_usbhs/common.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
-index 0f7e850fd4aa..da321f034e3c 100644
---- a/drivers/usb/renesas_usbhs/common.c
-+++ b/drivers/usb/renesas_usbhs/common.c
-@@ -388,7 +388,7 @@ static void usbhsc_hotplug(struct usbhs_priv *priv)
-
- if (enable && !mod) {
- if (priv->edev) {
-- cable = extcon_get_cable_state(priv->edev, "USB-HOST");
-+ cable = extcon_get_cable_state_(priv->edev, EXTCON_USB_HOST);
- if ((cable > 0 && id != USBHS_HOST) ||
- (!cable && id != USBHS_GADGET)) {
- dev_info(&pdev->dev,
---
-2.6.2
-
diff --git a/patches.renesas/0256-usb-renesas_usbhs-Allow-an-OTG-PHY-driver-to-provide.patch b/patches.renesas/0256-usb-renesas_usbhs-Allow-an-OTG-PHY-driver-to-provide.patch
deleted file mode 100644
index 1558201f99a3e1..00000000000000
--- a/patches.renesas/0256-usb-renesas_usbhs-Allow-an-OTG-PHY-driver-to-provide.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 7cd47cd5c2de2bcb94d5b04daf808c0b2662294c Mon Sep 17 00:00:00 2001
-From: Phil Edworthy <phil.edworthy@renesas.com>
-Date: Mon, 13 Jul 2015 16:30:18 +0100
-Subject: [PATCH 256/326] usb: renesas_usbhs: Allow an OTG PHY driver to
- provide VBUS
-
-These changes allow a PHY driver to trigger a VBUS interrupt and
-to provide the value of VBUS.
-
-Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
-Signed-off-by: Felipe Balbi <balbi@ti.com>
-(cherry picked from commit b5a2875605cac14a7d7744ec8254547a26c02612)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/usb/renesas_usbhs/mod_gadget.c | 62 +++++++++++++++++++++++++++++++++
- 1 file changed, 62 insertions(+)
-
---- a/drivers/usb/renesas_usbhs/mod_gadget.c
-+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
-@@ -21,6 +21,7 @@
- #include <linux/platform_device.h>
- #include <linux/usb/ch9.h>
- #include <linux/usb/gadget.h>
-+#include <linux/usb/otg.h>
- #include "common.h"
-
- /*
-@@ -50,6 +51,8 @@ struct usbhsg_gpriv {
- int uep_size;
-
- struct usb_gadget_driver *driver;
-+ struct usb_phy *transceiver;
-+ bool vbus_active;
-
- u32 status;
- #define USBHSG_STATUS_STARTED (1 << 0)
-@@ -887,6 +890,27 @@ static int usbhsg_try_stop(struct usbhs_
- }
-
- /*
-+ * VBUS provided by the PHY
-+ */
-+static int usbhsm_phy_get_vbus(struct platform_device *pdev)
-+{
-+ struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
-+ struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv);
-+
-+ return gpriv->vbus_active;
-+}
-+
-+static void usbhs_mod_phy_mode(struct usbhs_priv *priv)
-+{
-+ struct usbhs_mod_info *info = &priv->mod_info;
-+
-+ info->irq_vbus = NULL;
-+ priv->pfunc.get_vbus = usbhsm_phy_get_vbus;
-+
-+ usbhs_irq_callback_update(priv, NULL);
-+}
-+
-+/*
- *
- * linux usb function
- *
-@@ -896,12 +920,28 @@ static int usbhsg_gadget_start(struct us
- {
- struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget);
- struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv);
-+ struct device *dev = usbhs_priv_to_dev(priv);
-+ int ret;
-
- if (!driver ||
- !driver->setup ||
- driver->max_speed < USB_SPEED_FULL)
- return -EINVAL;
-
-+ /* connect to bus through transceiver */
-+ if (!IS_ERR_OR_NULL(gpriv->transceiver)) {
-+ ret = otg_set_peripheral(gpriv->transceiver->otg,
-+ &gpriv->gadget);
-+ if (ret) {
-+ dev_err(dev, "%s: can't bind to transceiver\n",
-+ gpriv->gadget.name);
-+ return ret;
-+ }
-+
-+ /* get vbus using phy versions */
-+ usbhs_mod_phy_mode(priv);
-+ }
-+
- /* first hook up the driver ... */
- gpriv->driver = driver;
-
-@@ -914,6 +954,10 @@ static int usbhsg_gadget_stop(struct usb
- struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv);
-
- usbhsg_try_stop(priv, USBHSG_STATUS_REGISTERD);
-+
-+ if (!IS_ERR_OR_NULL(gpriv->transceiver))
-+ otg_set_peripheral(gpriv->transceiver->otg, NULL);
-+
- gpriv->driver = NULL;
-
- return 0;
-@@ -961,12 +1005,26 @@ static int usbhsg_set_selfpowered(struct
- return 0;
- }
-
-+static int usbhsg_vbus_session(struct usb_gadget *gadget, int is_active)
-+{
-+ struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget);
-+ struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv);
-+ struct platform_device *pdev = usbhs_priv_to_pdev(priv);
-+
-+ gpriv->vbus_active = !!is_active;
-+
-+ renesas_usbhs_call_notify_hotplug(pdev);
-+
-+ return 0;
-+}
-+
- static const struct usb_gadget_ops usbhsg_gadget_ops = {
- .get_frame = usbhsg_get_frame,
- .set_selfpowered = usbhsg_set_selfpowered,
- .udc_start = usbhsg_gadget_start,
- .udc_stop = usbhsg_gadget_stop,
- .pullup = usbhsg_pullup,
-+ .vbus_session = usbhsg_vbus_session,
- };
-
- static int usbhsg_start(struct usbhs_priv *priv)
-@@ -1008,6 +1066,10 @@ int usbhs_mod_gadget_probe(struct usbhs_
- goto usbhs_mod_gadget_probe_err_gpriv;
- }
-
-+ gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED);
-+ dev_info(dev, "%stransceiver found\n",
-+ gpriv->transceiver ? "" : "no ");
-+
- /*
- * CAUTION
- *
diff --git a/patches.renesas/0257-media-media-uapi-vsp1-Use-__u32-instead-of-u32.patch b/patches.renesas/0257-media-media-uapi-vsp1-Use-__u32-instead-of-u32.patch
deleted file mode 100644
index 9cfcd8c0535b78..00000000000000
--- a/patches.renesas/0257-media-media-uapi-vsp1-Use-__u32-instead-of-u32.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 98291c30a87ffe6aa4bd2ddff8455e7c276261bd Mon Sep 17 00:00:00 2001
-From: Joe Perches <joe@perches.com>
-Date: Sat, 16 May 2015 15:11:40 -0300
-Subject: [PATCH 257/326] [media] media: uapi: vsp1: Use __u32 instead of u32
-
-Don't use the kernel types in uapi headers.
-
-Signed-off-by: Joe Perches <joe@perches.com>
-Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 9aee1ae3312daf0de4c9c614680d06d557133317)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- include/uapi/linux/vsp1.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/include/uapi/linux/vsp1.h b/include/uapi/linux/vsp1.h
-index e18858f6e865..9a823696d816 100644
---- a/include/uapi/linux/vsp1.h
-+++ b/include/uapi/linux/vsp1.h
-@@ -28,7 +28,7 @@
- _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct vsp1_lut_config)
-
- struct vsp1_lut_config {
-- u32 lut[256];
-+ __u32 lut[256];
- };
-
- #endif /* __VSP1_USER_H__ */
---
-2.6.2
-
diff --git a/patches.renesas/0258-media-v4l-vsp1-Fix-VI6_WPF_SZCLIP_SIZE_MASK-macro.patch b/patches.renesas/0258-media-v4l-vsp1-Fix-VI6_WPF_SZCLIP_SIZE_MASK-macro.patch
deleted file mode 100644
index 5357d9534bff9c..00000000000000
--- a/patches.renesas/0258-media-v4l-vsp1-Fix-VI6_WPF_SZCLIP_SIZE_MASK-macro.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 4df2e189033ee6b474a2a1589a6041644c0f9915 Mon Sep 17 00:00:00 2001
-From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
-Date: Wed, 28 Jan 2015 22:53:53 -0200
-Subject: [PATCH 258/326] [media] v4l: vsp1: Fix VI6_WPF_SZCLIP_SIZE_MASK macro
-
-Clipping size bit of VI6_WPFn _HSZCLIP and VI6_WPFn _VSZCLIP register are from
-0 bit to 11 bit. But VI6_WPF_SZCLIP_SIZE_MASK is set to 0x1FFF, this will mask
-until the reserve bits. This fixes size for VI6_WPF_SZCLIP_SIZE_MASK.
-
-Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 03b36e4dcf422a10da8b67bce2ed00b34ec58aac)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/vsp1/vsp1_regs.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h
-index da3c573e1efc..f61e1096f9fc 100644
---- a/drivers/media/platform/vsp1/vsp1_regs.h
-+++ b/drivers/media/platform/vsp1/vsp1_regs.h
-@@ -238,7 +238,7 @@
- #define VI6_WPF_SZCLIP_EN (1 << 28)
- #define VI6_WPF_SZCLIP_OFST_MASK (0xff << 16)
- #define VI6_WPF_SZCLIP_OFST_SHIFT 16
--#define VI6_WPF_SZCLIP_SIZE_MASK (0x1fff << 0)
-+#define VI6_WPF_SZCLIP_SIZE_MASK (0xfff << 0)
- #define VI6_WPF_SZCLIP_SIZE_SHIFT 0
-
- #define VI6_WPF_OUTFMT 0x100c
---
-2.6.2
-
diff --git a/patches.renesas/0259-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FP_MASK-macro.patch b/patches.renesas/0259-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FP_MASK-macro.patch
deleted file mode 100644
index 7992d84558b1e8..00000000000000
--- a/patches.renesas/0259-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FP_MASK-macro.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 084b25c7b5d3bd1341277c03fc876c3fb387a13c Mon Sep 17 00:00:00 2001
-From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
-Date: Wed, 28 Jan 2015 22:53:54 -0200
-Subject: [PATCH 259/326] [media] v4l: vsp1: Fix VI6_DPR_ROUTE_FP_MASK macro
-
-FP bit of VI6_DPR_mod_ROUTE register is 6bit. But VI6_DPR_ROUTE_FP_MASK is set
-to 0xFF, this will mask until the reserve bit.
-This fixes size for VI6_DPR_ROUTE_FP_MASK.
-
-Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 1aa7890324b497f96f07c20673fae58f26fabfe7)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/vsp1/vsp1_regs.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h
-index f61e1096f9fc..4177f98968d6 100644
---- a/drivers/media/platform/vsp1/vsp1_regs.h
-+++ b/drivers/media/platform/vsp1/vsp1_regs.h
-@@ -306,7 +306,7 @@
- #define VI6_DPR_BRU_ROUTE 0x204c
- #define VI6_DPR_ROUTE_FXA_MASK (0xff << 8)
- #define VI6_DPR_ROUTE_FXA_SHIFT 16
--#define VI6_DPR_ROUTE_FP_MASK (0xff << 8)
-+#define VI6_DPR_ROUTE_FP_MASK (0x3f << 8)
- #define VI6_DPR_ROUTE_FP_SHIFT 8
- #define VI6_DPR_ROUTE_RT_MASK (0x3f << 0)
- #define VI6_DPR_ROUTE_RT_SHIFT 0
---
-2.6.2
-
diff --git a/patches.renesas/0260-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FXA_MASK-macro.patch b/patches.renesas/0260-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FXA_MASK-macro.patch
deleted file mode 100644
index 00a947fa452e52..00000000000000
--- a/patches.renesas/0260-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FXA_MASK-macro.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From f7203d401175a2ea67ae1afc405c94025644f7df Mon Sep 17 00:00:00 2001
-From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
-Date: Wed, 28 Jan 2015 22:53:55 -0200
-Subject: [PATCH 260/326] [media] v4l: vsp1: Fix VI6_DPR_ROUTE_FXA_MASK macro
-
-FXA bit of VI6_DPR_mod_ROUTE register starts from 16bit. But VI6_DPR_ROUTE_FXA_MASK
-is set to become start from 8bit. This fixes shift size for VI6_DPR_ROUTE_FXA_MASK.
-
-Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 45008ee9295b3ae96d7413ab91871907a671ca82)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/vsp1/vsp1_regs.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h
-index 4177f98968d6..25b48738b147 100644
---- a/drivers/media/platform/vsp1/vsp1_regs.h
-+++ b/drivers/media/platform/vsp1/vsp1_regs.h
-@@ -304,7 +304,7 @@
- #define VI6_DPR_HST_ROUTE 0x2044
- #define VI6_DPR_HSI_ROUTE 0x2048
- #define VI6_DPR_BRU_ROUTE 0x204c
--#define VI6_DPR_ROUTE_FXA_MASK (0xff << 8)
-+#define VI6_DPR_ROUTE_FXA_MASK (0xff << 16)
- #define VI6_DPR_ROUTE_FXA_SHIFT 16
- #define VI6_DPR_ROUTE_FP_MASK (0x3f << 8)
- #define VI6_DPR_ROUTE_FP_SHIFT 8
---
-2.6.2
-
diff --git a/patches.renesas/0261-media-v4l-vsp1-Fix-Suspend-to-RAM.patch b/patches.renesas/0261-media-v4l-vsp1-Fix-Suspend-to-RAM.patch
deleted file mode 100644
index 14ae84f53258af..00000000000000
--- a/patches.renesas/0261-media-v4l-vsp1-Fix-Suspend-to-RAM.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-From b2c629e61e960d8a17163f25268b1f757ad8ed94 Mon Sep 17 00:00:00 2001
-From: Sei Fumizono <sei.fumizono.jw@hitachi-solutions.com>
-Date: Sun, 15 Mar 2015 11:33:07 -0300
-Subject: [PATCH 261/326] [media] v4l: vsp1: Fix Suspend-to-RAM
-
-Fix Suspend-to-RAM so that VSP1 driver continues to work after resuming.
-
-In detail,
- - Fix the judgment of ref count in resuming.
- - Add stopping VSP1 during suspend.
-
-[Refactor the suspend and resume code to lower suspend delay]
-
-Signed-off-by: Sei Fumizono <sei.fumizono.jw@hitachi-solutions.com>
-Signed-off-by: Yoshifumi Hosoya <yoshifumi.hosoya.wj@renesas.com>
-Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 139c92866e34bfa4897e644b36147fc86cc7a7a1)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/vsp1/vsp1_drv.c | 13 ++++--
- drivers/media/platform/vsp1/vsp1_video.c | 70 +++++++++++++++++++++++++++++++-
- drivers/media/platform/vsp1/vsp1_video.h | 5 ++-
- 3 files changed, 83 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
-index 913485a90e97..4e61886384e3 100644
---- a/drivers/media/platform/vsp1/vsp1_drv.c
-+++ b/drivers/media/platform/vsp1/vsp1_drv.c
-@@ -1,7 +1,7 @@
- /*
- * vsp1_drv.c -- R-Car VSP1 Driver
- *
-- * Copyright (C) 2013-2014 Renesas Electronics Corporation
-+ * Copyright (C) 2013-2015 Renesas Electronics Corporation
- *
- * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- *
-@@ -403,7 +403,10 @@ static int vsp1_pm_suspend(struct device *dev)
- if (vsp1->ref_count == 0)
- return 0;
-
-+ vsp1_pipelines_suspend(vsp1);
-+
- clk_disable_unprepare(vsp1->clock);
-+
- return 0;
- }
-
-@@ -413,10 +416,14 @@ static int vsp1_pm_resume(struct device *dev)
-
- WARN_ON(mutex_is_locked(&vsp1->lock));
-
-- if (vsp1->ref_count)
-+ if (vsp1->ref_count == 0)
- return 0;
-
-- return clk_prepare_enable(vsp1->clock);
-+ clk_prepare_enable(vsp1->clock);
-+
-+ vsp1_pipelines_resume(vsp1);
-+
-+ return 0;
- }
- #endif
-
-diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
-index d91f19a9e1c1..c4b06214b6c1 100644
---- a/drivers/media/platform/vsp1/vsp1_video.c
-+++ b/drivers/media/platform/vsp1/vsp1_video.c
-@@ -1,7 +1,7 @@
- /*
- * vsp1_video.c -- R-Car VSP1 Video Node
- *
-- * Copyright (C) 2013-2014 Renesas Electronics Corporation
-+ * Copyright (C) 2013-2015 Renesas Electronics Corporation
- *
- * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- *
-@@ -703,6 +703,74 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
- }
- }
-
-+void vsp1_pipelines_suspend(struct vsp1_device *vsp1)
-+{
-+ unsigned long flags;
-+ unsigned int i;
-+ int ret;
-+
-+ /* To avoid increasing the system suspend time needlessly, loop over the
-+ * pipelines twice, first to set them all to the stopping state, and then
-+ * to wait for the stop to complete.
-+ */
-+ for (i = 0; i < vsp1->pdata.wpf_count; ++i) {
-+ struct vsp1_rwpf *wpf = vsp1->wpf[i];
-+ struct vsp1_pipeline *pipe;
-+
-+ if (wpf == NULL)
-+ continue;
-+
-+ pipe = to_vsp1_pipeline(&wpf->entity.subdev.entity);
-+ if (pipe == NULL)
-+ continue;
-+
-+ spin_lock_irqsave(&pipe->irqlock, flags);
-+ if (pipe->state == VSP1_PIPELINE_RUNNING)
-+ pipe->state = VSP1_PIPELINE_STOPPING;
-+ spin_unlock_irqrestore(&pipe->irqlock, flags);
-+ }
-+
-+ for (i = 0; i < vsp1->pdata.wpf_count; ++i) {
-+ struct vsp1_rwpf *wpf = vsp1->wpf[i];
-+ struct vsp1_pipeline *pipe;
-+
-+ if (wpf == NULL)
-+ continue;
-+
-+ pipe = to_vsp1_pipeline(&wpf->entity.subdev.entity);
-+ if (pipe == NULL)
-+ continue;
-+
-+ ret = wait_event_timeout(pipe->wq,
-+ pipe->state == VSP1_PIPELINE_STOPPED,
-+ msecs_to_jiffies(500));
-+ if (ret == 0)
-+ dev_warn(vsp1->dev, "pipeline %u stop timeout\n",
-+ wpf->entity.index);
-+ }
-+}
-+
-+void vsp1_pipelines_resume(struct vsp1_device *vsp1)
-+{
-+ unsigned int i;
-+
-+ /* Resume pipeline all running pipelines. */
-+ for (i = 0; i < vsp1->pdata.wpf_count; ++i) {
-+ struct vsp1_rwpf *wpf = vsp1->wpf[i];
-+ struct vsp1_pipeline *pipe;
-+
-+ if (wpf == NULL)
-+ continue;
-+
-+ pipe = to_vsp1_pipeline(&wpf->entity.subdev.entity);
-+ if (pipe == NULL)
-+ continue;
-+
-+ if (vsp1_pipeline_ready(pipe))
-+ vsp1_pipeline_run(pipe);
-+ }
-+}
-+
- /* -----------------------------------------------------------------------------
- * videobuf2 Queue Operations
- */
-diff --git a/drivers/media/platform/vsp1/vsp1_video.h b/drivers/media/platform/vsp1/vsp1_video.h
-index fd2851a82e00..0887a4d2742c 100644
---- a/drivers/media/platform/vsp1/vsp1_video.h
-+++ b/drivers/media/platform/vsp1/vsp1_video.h
-@@ -1,7 +1,7 @@
- /*
- * vsp1_video.h -- R-Car VSP1 Video Node
- *
-- * Copyright (C) 2013-2014 Renesas Electronics Corporation
-+ * Copyright (C) 2013-2015 Renesas Electronics Corporation
- *
- * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
- *
-@@ -149,4 +149,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline *pipe,
- struct vsp1_entity *input,
- unsigned int alpha);
-
-+void vsp1_pipelines_suspend(struct vsp1_device *vsp1);
-+void vsp1_pipelines_resume(struct vsp1_device *vsp1);
-+
- #endif /* __VSP1_VIDEO_H__ */
---
-2.6.2
-
diff --git a/patches.renesas/0262-media-v4l-vsp1-Fix-race-condition-when-stopping-pipe.patch b/patches.renesas/0262-media-v4l-vsp1-Fix-race-condition-when-stopping-pipe.patch
deleted file mode 100644
index b100fe4b12b45e..00000000000000
--- a/patches.renesas/0262-media-v4l-vsp1-Fix-race-condition-when-stopping-pipe.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From dfb59febd3e731b2dabb46135491cde31105e13f Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Wed, 29 Apr 2015 16:54:39 -0300
-Subject: [PATCH 262/326] [media] v4l: vsp1: Fix race condition when stopping
- pipeline
-
-When stopping the pipeline the driver waits for the pipeline state to be
-set to VSP1_PIPELINE_STOPPED but fails to lock the pipe irqlock to read
-the state variable protected by the lock. Fix it.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 1c991fee30c72ff49bb96558d5f1c14a60230677)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/vsp1/vsp1_video.c | 17 ++++++++++++++---
- 1 file changed, 14 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
-index c4b06214b6c1..c1b5a09b8331 100644
---- a/drivers/media/platform/vsp1/vsp1_video.c
-+++ b/drivers/media/platform/vsp1/vsp1_video.c
-@@ -514,6 +514,18 @@ static void vsp1_pipeline_run(struct vsp1_pipeline *pipe)
- pipe->buffers_ready = 0;
- }
-
-+bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe)
-+{
-+ unsigned long flags;
-+ bool stopped;
-+
-+ spin_lock_irqsave(&pipe->irqlock, flags);
-+ stopped = pipe->state == VSP1_PIPELINE_STOPPED,
-+ spin_unlock_irqrestore(&pipe->irqlock, flags);
-+
-+ return stopped;
-+}
-+
- static int vsp1_pipeline_stop(struct vsp1_pipeline *pipe)
- {
- struct vsp1_entity *entity;
-@@ -525,7 +537,7 @@ static int vsp1_pipeline_stop(struct vsp1_pipeline *pipe)
- pipe->state = VSP1_PIPELINE_STOPPING;
- spin_unlock_irqrestore(&pipe->irqlock, flags);
-
-- ret = wait_event_timeout(pipe->wq, pipe->state == VSP1_PIPELINE_STOPPED,
-+ ret = wait_event_timeout(pipe->wq, vsp1_pipeline_stopped(pipe),
- msecs_to_jiffies(500));
- ret = ret == 0 ? -ETIMEDOUT : 0;
-
-@@ -741,8 +753,7 @@ void vsp1_pipelines_suspend(struct vsp1_device *vsp1)
- if (pipe == NULL)
- continue;
-
-- ret = wait_event_timeout(pipe->wq,
-- pipe->state == VSP1_PIPELINE_STOPPED,
-+ ret = wait_event_timeout(pipe->wq, vsp1_pipeline_stopped(pipe),
- msecs_to_jiffies(500));
- if (ret == 0)
- dev_warn(vsp1->dev, "pipeline %u stop timeout\n",
---
-2.6.2
-
diff --git a/patches.renesas/0263-media-v4l-vsp1-Align-crop-rectangle-to-even-boundary.patch b/patches.renesas/0263-media-v4l-vsp1-Align-crop-rectangle-to-even-boundary.patch
deleted file mode 100644
index 2d1fd88e58715b..00000000000000
--- a/patches.renesas/0263-media-v4l-vsp1-Align-crop-rectangle-to-even-boundary.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 6e58b0ae1af6429948f60894db34d64f28f2c4ce Mon Sep 17 00:00:00 2001
-From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-Date: Thu, 28 May 2015 09:59:39 -0300
-Subject: [PATCH 263/326] [media] v4l: vsp1: Align crop rectangle to even
- boundary for YUV formats
-
-Make sure that there are valid values in the crop rectangle to ensure
-that the color plane doesn't get shifted when cropping.
-Since there is no distinction between 12bit and 16bit YUV formats in
-at the subdev level, use the more restrictive 12bit limits for all YUV
-formats.
-
-Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 85a0638b7855dfb00dc9b66bc2fdd4276d7dc87c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/vsp1/vsp1_rwpf.c | 11 +++++++++++
- 1 file changed, 11 insertions(+)
-
-diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c b/drivers/media/platform/vsp1/vsp1_rwpf.c
-index fa71f4695e16..9688c219b30e 100644
---- a/drivers/media/platform/vsp1/vsp1_rwpf.c
-+++ b/drivers/media/platform/vsp1/vsp1_rwpf.c
-@@ -197,6 +197,17 @@ int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev,
- */
- format = vsp1_entity_get_pad_format(&rwpf->entity, cfg, RWPF_PAD_SINK,
- sel->which);
-+
-+ /* Restrict the crop rectangle coordinates to multiples of 2 to avoid
-+ * shifting the color plane.
-+ */
-+ if (format->code == MEDIA_BUS_FMT_AYUV8_1X32) {
-+ sel->r.left = ALIGN(sel->r.left, 2);
-+ sel->r.top = ALIGN(sel->r.top, 2);
-+ sel->r.width = round_down(sel->r.width, 2);
-+ sel->r.height = round_down(sel->r.height, 2);
-+ }
-+
- sel->r.left = min_t(unsigned int, sel->r.left, format->width - 2);
- sel->r.top = min_t(unsigned int, sel->r.top, format->height - 2);
- if (rwpf->entity.type == VSP1_ENTITY_WPF) {
---
-2.6.2
-
diff --git a/patches.renesas/0264-media-vsp1-declar-vsp1_pipeline_stopped-as-static.patch b/patches.renesas/0264-media-vsp1-declar-vsp1_pipeline_stopped-as-static.patch
deleted file mode 100644
index ae081024cd3b21..00000000000000
--- a/patches.renesas/0264-media-vsp1-declar-vsp1_pipeline_stopped-as-static.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 7925353d63560e02f3947dd65a247e0ac315e133 Mon Sep 17 00:00:00 2001
-From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-Date: Fri, 3 Jul 2015 08:35:51 -0300
-Subject: [PATCH 264/326] [media] vsp1: declar vsp1_pipeline_stopped() as
- static
-
-drivers/media/platform/vsp1/vsp1_video.c:517:6: warning: no previous prototype for 'vsp1_pipeline_stopped' [-Wmissing-prototypes]
- bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe)
- ^
-
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit 41bdc3cf81c4d0f0dfe09f06ff203dd59d422f37)
-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 c1b5a09b8331..770e08dc03f1 100644
---- a/drivers/media/platform/vsp1/vsp1_video.c
-+++ b/drivers/media/platform/vsp1/vsp1_video.c
-@@ -514,7 +514,7 @@ static void vsp1_pipeline_run(struct vsp1_pipeline *pipe)
- pipe->buffers_ready = 0;
- }
-
--bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe)
-+static bool vsp1_pipeline_stopped(struct vsp1_pipeline *pipe)
- {
- unsigned long flags;
- bool stopped;
---
-2.6.2
-
diff --git a/patches.renesas/0265-media-v4l-vsp1-Fix-plane-stride-and-size-checks.patch b/patches.renesas/0265-media-v4l-vsp1-Fix-plane-stride-and-size-checks.patch
deleted file mode 100644
index ab91929e3db959..00000000000000
--- a/patches.renesas/0265-media-v4l-vsp1-Fix-plane-stride-and-size-checks.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From a54ffb63d059f1c3f39b86feb2f73bda9c73c45e Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Fri, 19 Jun 2015 08:51:22 -0300
-Subject: [PATCH 265/326] [media] v4l: vsp1: Fix plane stride and size checks
-
-The checks need to be performed on up to two planes, as the third plane,
-if present, must have the same stride and size as the second plane.
-
-The code incorrectly performs the checks on at least two planes instead
-of at most two planes, fix it.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit df5c3e7c8a87a4384ff7a0adba16baae9a40a566)
-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 770e08dc03f1..3c124c14ce14 100644
---- a/drivers/media/platform/vsp1/vsp1_video.c
-+++ b/drivers/media/platform/vsp1/vsp1_video.c
-@@ -245,7 +245,7 @@ static int __vsp1_video_try_format(struct vsp1_video *video,
- * the datasheet, strides not aligned to a multiple of 128 bytes result
- * in image corruption.
- */
-- for (i = 0; i < max(info->planes, 2U); ++i) {
-+ for (i = 0; i < min(info->planes, 2U); ++i) {
- unsigned int hsub = i > 0 ? info->hsub : 1;
- unsigned int vsub = i > 0 ? info->vsub : 1;
- unsigned int align = 128;
---
-2.6.2
-
diff --git a/patches.renesas/0266-media-v4l-vsp1-Don-t-sleep-in-atomic-context.patch b/patches.renesas/0266-media-v4l-vsp1-Don-t-sleep-in-atomic-context.patch
deleted file mode 100644
index 8c2357a71af6c1..00000000000000
--- a/patches.renesas/0266-media-v4l-vsp1-Don-t-sleep-in-atomic-context.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-From 7d00fef15d5b02f05a6a3d77b8c3eb35a747194f Mon Sep 17 00:00:00 2001
-From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Date: Mon, 13 Apr 2015 11:43:40 -0300
-Subject: [PATCH 266/326] [media] v4l: vsp1: Don't sleep in atomic context
-
-The vsp1_entity_is_streaming() function is called in atomic context when
-queuing buffers, and sleeps due to a mutex. As the mutex just protects
-access to one structure field, fix this by replace the mutex with a
-spinlock.
-
-Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-(cherry picked from commit adb8963f27e00273c912a53f28f7af5d14cfd32e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/media/platform/vsp1/vsp1_entity.c | 18 +++++++++---------
- drivers/media/platform/vsp1/vsp1_entity.h | 4 ++--
- 2 files changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
-index a453bb4ddd37..fd95a75b04f4 100644
---- a/drivers/media/platform/vsp1/vsp1_entity.c
-+++ b/drivers/media/platform/vsp1/vsp1_entity.c
-@@ -24,22 +24,24 @@
-
- bool vsp1_entity_is_streaming(struct vsp1_entity *entity)
- {
-+ unsigned long flags;
- bool streaming;
-
-- mutex_lock(&entity->lock);
-+ spin_lock_irqsave(&entity->lock, flags);
- streaming = entity->streaming;
-- mutex_unlock(&entity->lock);
-+ spin_unlock_irqrestore(&entity->lock, flags);
-
- return streaming;
- }
-
- int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming)
- {
-+ unsigned long flags;
- int ret;
-
-- mutex_lock(&entity->lock);
-+ spin_lock_irqsave(&entity->lock, flags);
- entity->streaming = streaming;
-- mutex_unlock(&entity->lock);
-+ spin_unlock_irqrestore(&entity->lock, flags);
-
- if (!streaming)
- return 0;
-@@ -49,9 +51,9 @@ int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming)
-
- ret = v4l2_ctrl_handler_setup(entity->subdev.ctrl_handler);
- if (ret < 0) {
-- mutex_lock(&entity->lock);
-+ spin_lock_irqsave(&entity->lock, flags);
- entity->streaming = false;
-- mutex_unlock(&entity->lock);
-+ spin_unlock_irqrestore(&entity->lock, flags);
- }
-
- return ret;
-@@ -193,7 +195,7 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity,
- if (i == ARRAY_SIZE(vsp1_routes))
- return -EINVAL;
-
-- mutex_init(&entity->lock);
-+ spin_lock_init(&entity->lock);
-
- entity->vsp1 = vsp1;
- entity->source_pad = num_pads - 1;
-@@ -228,6 +230,4 @@ 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 62c768d1c6aa..8867a5787c28 100644
---- a/drivers/media/platform/vsp1/vsp1_entity.h
-+++ b/drivers/media/platform/vsp1/vsp1_entity.h
-@@ -14,7 +14,7 @@
- #define __VSP1_ENTITY_H__
-
- #include <linux/list.h>
--#include <linux/mutex.h>
-+#include <linux/spinlock.h>
-
- #include <media/v4l2-subdev.h>
-
-@@ -73,7 +73,7 @@ struct vsp1_entity {
-
- struct vsp1_video *video;
-
-- struct mutex lock; /* Protects the streaming field */
-+ spinlock_t lock; /* Protects the streaming field */
- bool streaming;
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0267-regmap-add-force_write-option-on-_regmap_update_bits.patch b/patches.renesas/0267-regmap-add-force_write-option-on-_regmap_update_bits.patch
deleted file mode 100644
index 9c3939afc597f7..00000000000000
--- a/patches.renesas/0267-regmap-add-force_write-option-on-_regmap_update_bits.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From cbd44540cf6a79e65bc3d169395331cb56cd4bdf Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 16 Jun 2015 08:52:22 +0000
-Subject: [PATCH 267/326] regmap: add force_write option on
- _regmap_update_bits()
-
-Sometimes we want to write data even though it doesn't change value.
-Then, force_write option on _regmap_update_bits() helps this purpose.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 7ff0589c7bff4ca31b255ac2028f633f14047762)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/base/regmap/regmap.c | 16 ++++++++--------
- 1 file changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
-index 1c76dcb502cf..7ede8165485b 100644
---- a/drivers/base/regmap/regmap.c
-+++ b/drivers/base/regmap/regmap.c
-@@ -34,7 +34,7 @@
-
- static int _regmap_update_bits(struct regmap *map, unsigned int reg,
- unsigned int mask, unsigned int val,
-- bool *change);
-+ bool *change, bool force_write);
-
- static int _regmap_bus_reg_read(void *context, unsigned int reg,
- unsigned int *val);
-@@ -1178,7 +1178,7 @@ static int _regmap_select_page(struct regmap *map, unsigned int *reg,
- ret = _regmap_update_bits(map, range->selector_reg,
- range->selector_mask,
- win_page << range->selector_shift,
-- &page_chg);
-+ &page_chg, false);
-
- map->work_buf = orig_work_buf;
-
-@@ -2327,7 +2327,7 @@ EXPORT_SYMBOL_GPL(regmap_bulk_read);
-
- static int _regmap_update_bits(struct regmap *map, unsigned int reg,
- unsigned int mask, unsigned int val,
-- bool *change)
-+ bool *change, bool force_write)
- {
- int ret;
- unsigned int tmp, orig;
-@@ -2339,7 +2339,7 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
- tmp = orig & ~mask;
- tmp |= val & mask;
-
-- if (tmp != orig) {
-+ if (force_write || (tmp != orig)) {
- ret = _regmap_write(map, reg, tmp);
- if (change)
- *change = true;
-@@ -2367,7 +2367,7 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
- int ret;
-
- map->lock(map->lock_arg);
-- ret = _regmap_update_bits(map, reg, mask, val, NULL);
-+ ret = _regmap_update_bits(map, reg, mask, val, NULL, false);
- map->unlock(map->lock_arg);
-
- return ret;
-@@ -2398,7 +2398,7 @@ int regmap_update_bits_async(struct regmap *map, unsigned int reg,
-
- map->async = true;
-
-- ret = _regmap_update_bits(map, reg, mask, val, NULL);
-+ ret = _regmap_update_bits(map, reg, mask, val, NULL, false);
-
- map->async = false;
-
-@@ -2427,7 +2427,7 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,
- int ret;
-
- map->lock(map->lock_arg);
-- ret = _regmap_update_bits(map, reg, mask, val, change);
-+ ret = _regmap_update_bits(map, reg, mask, val, change, false);
- map->unlock(map->lock_arg);
- return ret;
- }
-@@ -2460,7 +2460,7 @@ int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
-
- map->async = true;
-
-- ret = _regmap_update_bits(map, reg, mask, val, change);
-+ ret = _regmap_update_bits(map, reg, mask, val, change, false);
-
- map->async = false;
-
---
-2.6.2
-
diff --git a/patches.renesas/0268-regmap-add-regmap_fields_force_write.patch b/patches.renesas/0268-regmap-add-regmap_fields_force_write.patch
deleted file mode 100644
index 329d1df1f90004..00000000000000
--- a/patches.renesas/0268-regmap-add-regmap_fields_force_write.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 0a22f2d62bcbc5759d9e3a9faa2a0a4c31454a21 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 16 Jun 2015 08:52:55 +0000
-Subject: [PATCH 268/326] regmap: add regmap_fields_force_write()
-
-regmap_fields_force_write() is similar to regmap_fields_write(),
-but regmap_fields_force_write() write data to register even though
-it is same value.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit e874e6c7edc43436f73cf84157d9221f8b807c36)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/base/regmap/regmap.c | 12 ++++++++++++
- include/linux/regmap.h | 2 ++
- 2 files changed, 14 insertions(+)
-
-diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
-index 7ede8165485b..35b05c2efc16 100644
---- a/drivers/base/regmap/regmap.c
-+++ b/drivers/base/regmap/regmap.c
-@@ -1624,6 +1624,18 @@ int regmap_fields_write(struct regmap_field *field, unsigned int id,
- }
- EXPORT_SYMBOL_GPL(regmap_fields_write);
-
-+int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
-+ unsigned int val)
-+{
-+ if (id >= field->id_size)
-+ return -EINVAL;
-+
-+ return regmap_write_bits(field->regmap,
-+ field->reg + (field->id_offset * id),
-+ field->mask, val << field->shift);
-+}
-+EXPORT_SYMBOL_GPL(regmap_fields_force_write);
-+
- /**
- * regmap_fields_update_bits(): Perform a read/modify/write cycle
- * on the register field
-diff --git a/include/linux/regmap.h b/include/linux/regmap.h
-index 116655d92269..a4b13b4405f1 100644
---- a/include/linux/regmap.h
-+++ b/include/linux/regmap.h
-@@ -501,6 +501,8 @@ int regmap_field_update_bits(struct regmap_field *field,
-
- int regmap_fields_write(struct regmap_field *field, unsigned int id,
- unsigned int val);
-+int regmap_fields_force_write(struct regmap_field *field, unsigned int id,
-+ unsigned int val);
- int regmap_fields_read(struct regmap_field *field, unsigned int id,
- unsigned int *val);
- int regmap_fields_update_bits(struct regmap_field *field, unsigned int id,
---
-2.6.2
-
diff --git a/patches.renesas/0269-regmap-add-regmap_write_bits.patch b/patches.renesas/0269-regmap-add-regmap_write_bits.patch
deleted file mode 100644
index 9800ebca2f0496..00000000000000
--- a/patches.renesas/0269-regmap-add-regmap_write_bits.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From 42b5e4f23e2df4314c297bf0b7a0a20385ce4198 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 16 Jun 2015 08:52:39 +0000
-Subject: [PATCH 269/326] regmap: add regmap_write_bits()
-
-regmap_write_bits() is similar to regmap_update_bits(),
-but regmap_write_bits() write data to register even though
-it is same value.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit fd4b7286ccc469bf5dde22db6b8fcc455c3c4a66)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/base/regmap/regmap.c | 23 +++++++++++++++++++++++
- include/linux/regmap.h | 9 +++++++++
- 2 files changed, 32 insertions(+)
-
-diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
-index 35b05c2efc16..fc26b61eba6a 100644
---- a/drivers/base/regmap/regmap.c
-+++ b/drivers/base/regmap/regmap.c
-@@ -2387,6 +2387,29 @@ int regmap_update_bits(struct regmap *map, unsigned int reg,
- EXPORT_SYMBOL_GPL(regmap_update_bits);
-
- /**
-+ * regmap_write_bits: Perform a read/modify/write cycle on the register map
-+ *
-+ * @map: Register map to update
-+ * @reg: Register to update
-+ * @mask: Bitmask to change
-+ * @val: New value for bitmask
-+ *
-+ * Returns zero for success, a negative number on error.
-+ */
-+int regmap_write_bits(struct regmap *map, unsigned int reg,
-+ unsigned int mask, unsigned int val)
-+{
-+ int ret;
-+
-+ map->lock(map->lock_arg);
-+ ret = _regmap_update_bits(map, reg, mask, val, NULL, true);
-+ map->unlock(map->lock_arg);
-+
-+ return ret;
-+}
-+EXPORT_SYMBOL_GPL(regmap_write_bits);
-+
-+/**
- * regmap_update_bits_async: Perform a read/modify/write cycle on the register
- * map asynchronously
- *
-diff --git a/include/linux/regmap.h b/include/linux/regmap.h
-index a4b13b4405f1..06206311b1af 100644
---- a/include/linux/regmap.h
-+++ b/include/linux/regmap.h
-@@ -424,6 +424,8 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
- size_t val_count);
- int regmap_update_bits(struct regmap *map, unsigned int reg,
- unsigned int mask, unsigned int val);
-+int regmap_write_bits(struct regmap *map, unsigned int reg,
-+ unsigned int mask, unsigned int val);
- int regmap_update_bits_async(struct regmap *map, unsigned int reg,
- unsigned int mask, unsigned int val);
- int regmap_update_bits_check(struct regmap *map, unsigned int reg,
-@@ -645,6 +647,13 @@ static inline int regmap_update_bits(struct regmap *map, unsigned int reg,
- return -EINVAL;
- }
-
-+static inline int regmap_write_bits(struct regmap *map, unsigned int reg,
-+ unsigned int mask, unsigned int val)
-+{
-+ WARN_ONCE(1, "regmap API is disabled");
-+ return -EINVAL;
-+}
-+
- static inline int regmap_update_bits_async(struct regmap *map,
- unsigned int reg,
- unsigned int mask, unsigned int val)
---
-2.6.2
-
diff --git a/patches.renesas/0270-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch b/patches.renesas/0270-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch
deleted file mode 100644
index 3347a61bb88780..00000000000000
--- a/patches.renesas/0270-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 0309bdd92b8e90e9913cda5c01b53b994708c5ed Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 14 Jul 2015 14:00:47 +0200
-Subject: [PATCH 270/326] clockevents/drivers/sh_cmt: Remove obsolete sh-cmt-48
- platform_device_id entry
-
-Since the removal of the r8a7740 legacy SoC code in commit
-44d88c754e57a6d9 ("ARM: shmobile: Remove legacy SoC code for R-Mobile
-A1"), all former users of the "sh-cmt-48-gen2" platform device name are
-only supported in generic DT-only ARM multi-platform builds. The driver
-doesn't need to match platform devices by name anymore, hence remove the
-corresponding platform_device_id entry.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 8c436f84800c570ecde517dcd8709258bb34e498)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/clocksource/sh_cmt.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
-index d56d4e0e3fb3..7e4cd3473c72 100644
---- a/drivers/clocksource/sh_cmt.c
-+++ b/drivers/clocksource/sh_cmt.c
-@@ -929,7 +929,6 @@ static int sh_cmt_map_memory(struct sh_cmt_device *cmt)
- 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-48", (kernel_ulong_t)&sh_cmt_info[SH_CMT_48BIT] },
- { }
- };
- MODULE_DEVICE_TABLE(platform, sh_cmt_id_table);
---
-2.6.2
-
diff --git a/patches.renesas/0271-pinctrl-sh-pfc-Remove-obsolete-sh73a0-platform_devic.patch b/patches.renesas/0271-pinctrl-sh-pfc-Remove-obsolete-sh73a0-platform_devic.patch
deleted file mode 100644
index a399d0b663c4a5..00000000000000
--- a/patches.renesas/0271-pinctrl-sh-pfc-Remove-obsolete-sh73a0-platform_devic.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 92f0fccd7d36a6ca7732cb1dc462ef2b5e8804b8 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 14 Jul 2015 13:56:53 +0200
-Subject: [PATCH 271/326] pinctrl: sh-pfc: Remove obsolete sh73a0
- platform_device_id entry
-
-Since the removal of the sh73a0 legacy SoC code in commit
-9a9863987bf7307f ("ARM: shmobile: Remove legacy SoC code for SH-Mobile
-AG5"), sh73a0 is only supported in generic DT-only ARM multi-platform
-builds. The driver doesn't need to match platform devices by name
-anymore, hence remove the corresponding platform_device_id entry.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 39ad6ff12cd54607b64642562ad850bb09176734)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/core.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
-index 979623895904..23b2b3be26fd 100644
---- a/drivers/pinctrl/sh-pfc/core.c
-+++ b/drivers/pinctrl/sh-pfc/core.c
-@@ -605,9 +605,6 @@ static const struct platform_device_id sh_pfc_id_table[] = {
- #ifdef CONFIG_PINCTRL_PFC_SH7269
- { "pfc-sh7269", (kernel_ulong_t)&sh7269_pinmux_info },
- #endif
--#ifdef CONFIG_PINCTRL_PFC_SH73A0
-- { "pfc-sh73a0", (kernel_ulong_t)&sh73a0_pinmux_info },
--#endif
- #ifdef CONFIG_PINCTRL_PFC_SH7720
- { "pfc-sh7720", (kernel_ulong_t)&sh7720_pinmux_info },
- #endif
---
-2.6.2
-
diff --git a/patches.renesas/0272-pinctrl-sh-pfc-Remove-obsolete-r8a7740-platform_devi.patch b/patches.renesas/0272-pinctrl-sh-pfc-Remove-obsolete-r8a7740-platform_devi.patch
deleted file mode 100644
index 38d66fdcbae952..00000000000000
--- a/patches.renesas/0272-pinctrl-sh-pfc-Remove-obsolete-r8a7740-platform_devi.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From b98300166176e11d1b3b5e3c14d021e91ddd1187 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 14 Jul 2015 13:56:55 +0200
-Subject: [PATCH 272/326] pinctrl: sh-pfc: Remove obsolete r8a7740
- platform_device_id entry
-
-Since the removal of the r8a7740 legacy SoC code in commit
-44d88c754e57a6d9 ("ARM: shmobile: Remove legacy SoC code for R-Mobile
-A1"), r8a7740 is only supported in generic DT-only ARM multi-platform
-builds. The driver doesn't need to match platform devices by name
-anymore, hence remove the corresponding platform_device_id entry.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 03c42c3e5216e2777f8ae819d6a076e94dcdfbdd)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/core.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
-index 23b2b3be26fd..fb9c44805234 100644
---- a/drivers/pinctrl/sh-pfc/core.c
-+++ b/drivers/pinctrl/sh-pfc/core.c
-@@ -587,9 +587,6 @@ static int sh_pfc_remove(struct platform_device *pdev)
- }
-
- static const struct platform_device_id sh_pfc_id_table[] = {
--#ifdef CONFIG_PINCTRL_PFC_R8A7740
-- { "pfc-r8a7740", (kernel_ulong_t)&r8a7740_pinmux_info },
--#endif
- #ifdef CONFIG_PINCTRL_PFC_R8A7778
- { "pfc-r8a7778", (kernel_ulong_t)&r8a7778_pinmux_info },
- #endif
---
-2.6.2
-
diff --git a/patches.renesas/0273-pinctrl-sh-pfc-Implement-pinconf-power-source-param-.patch b/patches.renesas/0273-pinctrl-sh-pfc-Implement-pinconf-power-source-param-.patch
deleted file mode 100644
index e3977e9a55353b..00000000000000
--- a/patches.renesas/0273-pinctrl-sh-pfc-Implement-pinconf-power-source-param-.patch
+++ /dev/null
@@ -1,156 +0,0 @@
-From b82cf411b6fcd84540d9ecf45da2bfca76e23290 Mon Sep 17 00:00:00 2001
-From: Ben Hutchings <ben.hutchings@codethink.co.uk>
-Date: Tue, 30 Jun 2015 17:53:59 +0100
-Subject: [PATCH 273/326] pinctrl: sh-pfc: Implement pinconf power-source param
- for voltage switching
-
-The pfc in the R8A7790 (and probably others in the R-Car gen 2 family)
-supports switching SDHI signals between 3.3V and 1.8V nominal voltage,
-and the SD driver should do that when switching to and from UHS modes.
-
-Add a flag for pins that have configurable I/O voltage and SoC
-operations to get and set the nominal voltage. Implement the pinconf
-power-source parameter using these operations.
-
-Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 5b9eaa5659b32cf6c85a492d2e3bfa7a3a413144)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../bindings/pinctrl/renesas,pfc-pinctrl.txt | 4 +-
- drivers/pinctrl/sh-pfc/pinctrl.c | 44 +++++++++++++++++++++-
- drivers/pinctrl/sh-pfc/sh_pfc.h | 5 +++
- 3 files changed, 50 insertions(+), 3 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-index e089142cfb14..9496934528bd 100644
---- a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-+++ b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
-@@ -71,7 +71,9 @@ Pin Configuration Node Properties:
-
- The pin configuration parameters use the generic pinconf bindings defined in
- pinctrl-bindings.txt in this directory. The supported parameters are
--bias-disable, bias-pull-up and bias-pull-down.
-+bias-disable, bias-pull-up, bias-pull-down and power-source. For pins that
-+have a configurable I/O voltage, the power-source value should be the
-+nominal I/O voltage in millivolts.
-
-
- GPIO
-diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c
-index 6fe7459f0ccb..863c3e30ce05 100644
---- a/drivers/pinctrl/sh-pfc/pinctrl.c
-+++ b/drivers/pinctrl/sh-pfc/pinctrl.c
-@@ -491,6 +491,9 @@ static bool sh_pfc_pinconf_validate(struct sh_pfc *pfc, unsigned int _pin,
- case PIN_CONFIG_BIAS_PULL_DOWN:
- return pin->configs & SH_PFC_PIN_CFG_PULL_DOWN;
-
-+ case PIN_CONFIG_POWER_SOURCE:
-+ return pin->configs & SH_PFC_PIN_CFG_IO_VOLTAGE;
-+
- default:
- return false;
- }
-@@ -503,7 +506,6 @@ static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned _pin,
- struct sh_pfc *pfc = pmx->pfc;
- enum pin_config_param param = pinconf_to_config_param(*config);
- unsigned long flags;
-- unsigned int bias;
-
- if (!sh_pfc_pinconf_validate(pfc, _pin, param))
- return -ENOTSUPP;
-@@ -511,7 +513,9 @@ static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned _pin,
- switch (param) {
- case PIN_CONFIG_BIAS_DISABLE:
- case PIN_CONFIG_BIAS_PULL_UP:
-- case PIN_CONFIG_BIAS_PULL_DOWN:
-+ case PIN_CONFIG_BIAS_PULL_DOWN: {
-+ unsigned int bias;
-+
- if (!pfc->info->ops || !pfc->info->ops->get_bias)
- return -ENOTSUPP;
-
-@@ -524,6 +528,24 @@ static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned _pin,
-
- *config = 0;
- break;
-+ }
-+
-+ case PIN_CONFIG_POWER_SOURCE: {
-+ int ret;
-+
-+ if (!pfc->info->ops || !pfc->info->ops->get_io_voltage)
-+ return -ENOTSUPP;
-+
-+ spin_lock_irqsave(&pfc->lock, flags);
-+ ret = pfc->info->ops->get_io_voltage(pfc, _pin);
-+ spin_unlock_irqrestore(&pfc->lock, flags);
-+
-+ if (ret < 0)
-+ return ret;
-+
-+ *config = ret;
-+ break;
-+ }
-
- default:
- return -ENOTSUPP;
-@@ -560,6 +582,24 @@ static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned _pin,
-
- break;
-
-+ case PIN_CONFIG_POWER_SOURCE: {
-+ unsigned int arg =
-+ pinconf_to_config_argument(configs[i]);
-+ int ret;
-+
-+ if (!pfc->info->ops || !pfc->info->ops->set_io_voltage)
-+ return -ENOTSUPP;
-+
-+ spin_lock_irqsave(&pfc->lock, flags);
-+ ret = pfc->info->ops->set_io_voltage(pfc, _pin, arg);
-+ spin_unlock_irqrestore(&pfc->lock, flags);
-+
-+ if (ret)
-+ return ret;
-+
-+ break;
-+ }
-+
- default:
- return -ENOTSUPP;
- }
-diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
-index 0874cfee6889..15afd49fd4e3 100644
---- a/drivers/pinctrl/sh-pfc/sh_pfc.h
-+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
-@@ -12,6 +12,7 @@
- #define __SH_PFC_H
-
- #include <linux/bug.h>
-+#include <linux/pinctrl/pinconf-generic.h>
- #include <linux/stringify.h>
-
- enum {
-@@ -26,6 +27,7 @@ enum {
- #define SH_PFC_PIN_CFG_OUTPUT (1 << 1)
- #define SH_PFC_PIN_CFG_PULL_UP (1 << 2)
- #define SH_PFC_PIN_CFG_PULL_DOWN (1 << 3)
-+#define SH_PFC_PIN_CFG_IO_VOLTAGE (1 << 4)
- #define SH_PFC_PIN_CFG_NO_GPIO (1 << 31)
-
- struct sh_pfc_pin {
-@@ -121,6 +123,9 @@ struct sh_pfc_soc_operations {
- unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
- void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
- unsigned int bias);
-+ int (*get_io_voltage)(struct sh_pfc *pfc, unsigned int pin);
-+ int (*set_io_voltage)(struct sh_pfc *pfc, unsigned int pin,
-+ u16 voltage_mV);
- };
-
- struct sh_pfc_soc_info {
---
-2.6.2
-
diff --git a/patches.renesas/0274-pinctrl-sh-pfc-r8a7794-add-USB-pin-groups.patch b/patches.renesas/0274-pinctrl-sh-pfc-r8a7794-add-USB-pin-groups.patch
deleted file mode 100644
index d8128e394b976e..00000000000000
--- a/patches.renesas/0274-pinctrl-sh-pfc-r8a7794-add-USB-pin-groups.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 576bc8579c4d0f4e2693071a5c368f6b9d86db44 Mon Sep 17 00:00:00 2001
-From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
-Date: Wed, 19 Aug 2015 01:26:55 +0300
-Subject: [PATCH 274/326] pinctrl: sh-pfc: r8a7794: add USB pin groups
-
-Add USB0/1 pin groups to R8A7794 PFC driver.
-
-Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
-[Sergei: rebased, renamed, added changelog.]
-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 580a7ee93317b901358f497c2de34f7a66066963)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/sh-pfc/pfc-r8a7794.c | 30 ++++++++++++++++++++++++++++++
- 1 file changed, 30 insertions(+)
-
-diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-index bfdcac4b3bc4..5248685dbb4e 100644
---- a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c
-@@ -2770,6 +2770,24 @@ static const unsigned int sdhi2_wp_pins[] = {
- static const unsigned int sdhi2_wp_mux[] = {
- SD2_WP_MARK,
- };
-+/* - USB0 ------------------------------------------------------------------- */
-+static const unsigned int usb0_pins[] = {
-+ RCAR_GP_PIN(5, 24), /* PWEN */
-+ RCAR_GP_PIN(5, 25), /* OVC */
-+};
-+static const unsigned int usb0_mux[] = {
-+ USB0_PWEN_MARK,
-+ USB0_OVC_MARK,
-+};
-+/* - USB1 ------------------------------------------------------------------- */
-+static const unsigned int usb1_pins[] = {
-+ RCAR_GP_PIN(5, 26), /* PWEN */
-+ RCAR_GP_PIN(5, 27), /* OVC */
-+};
-+static const unsigned int usb1_mux[] = {
-+ USB1_PWEN_MARK,
-+ USB1_OVC_MARK,
-+};
-
- static const struct sh_pfc_pin_group pinmux_groups[] = {
- SH_PFC_PIN_GROUP(eth_link),
-@@ -2945,6 +2963,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
- SH_PFC_PIN_GROUP(sdhi2_ctrl),
- SH_PFC_PIN_GROUP(sdhi2_cd),
- SH_PFC_PIN_GROUP(sdhi2_wp),
-+ SH_PFC_PIN_GROUP(usb0),
-+ SH_PFC_PIN_GROUP(usb1),
- };
-
- static const char * const eth_groups[] = {
-@@ -3219,6 +3239,14 @@ static const char * const sdhi2_groups[] = {
- "sdhi2_wp",
- };
-
-+static const char * const usb0_groups[] = {
-+ "usb0",
-+};
-+
-+static const char * const usb1_groups[] = {
-+ "usb1",
-+};
-+
- static const struct sh_pfc_function pinmux_functions[] = {
- SH_PFC_FUNCTION(eth),
- SH_PFC_FUNCTION(hscif0),
-@@ -3253,6 +3281,8 @@ static const struct sh_pfc_function pinmux_functions[] = {
- SH_PFC_FUNCTION(sdhi0),
- SH_PFC_FUNCTION(sdhi1),
- SH_PFC_FUNCTION(sdhi2),
-+ SH_PFC_FUNCTION(usb0),
-+ SH_PFC_FUNCTION(usb1),
- };
-
- static const struct pinmux_cfg_reg pinmux_config_regs[] = {
---
-2.6.2
-
diff --git a/patches.renesas/0275-ASoC-core-add-snd_soc_of_parse_audio_prefix.patch b/patches.renesas/0275-ASoC-core-add-snd_soc_of_parse_audio_prefix.patch
deleted file mode 100644
index 4788d63fc7caaf..00000000000000
--- a/patches.renesas/0275-ASoC-core-add-snd_soc_of_parse_audio_prefix.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 081296bb8980bb9ec6484d20fc92b2e74a8fae8a Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:07:42 +0000
-Subject: [PATCH 275/326] ASoC: core: add snd_soc_of_parse_audio_prefix()
-
-Current ASoC can add name_prefix for DAPM, and it is necessary for
-route settings. This patch adds snd_soc_of_parse_audio_prefix() for
-this purpose. It will be used with snd_soc_of_parse_audio_routing().
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 5e3cdaa20816dd2fe4dc17d06a9f0dae0abc930c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- include/sound/soc.h | 4 ++++
- sound/soc/soc-core.c | 20 ++++++++++++++++++++
- 2 files changed, 24 insertions(+)
-
---- a/include/sound/soc.h
-+++ b/include/sound/soc.h
-@@ -1533,6 +1533,10 @@ int snd_soc_of_parse_audio_simple_widget
- int snd_soc_of_parse_tdm_slot(struct device_node *np,
- unsigned int *slots,
- unsigned int *slot_width);
-+void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
-+ struct snd_soc_codec_conf *codec_conf,
-+ struct device_node *of_node,
-+ const char *propname);
- int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
- const char *propname);
- unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
---- a/sound/soc/soc-core.c
-+++ b/sound/soc/soc-core.c
-@@ -3316,6 +3316,26 @@ int snd_soc_of_parse_tdm_slot(struct dev
- }
- EXPORT_SYMBOL_GPL(snd_soc_of_parse_tdm_slot);
-
-+void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
-+ struct snd_soc_codec_conf *codec_conf,
-+ struct device_node *of_node,
-+ const char *propname)
-+{
-+ struct device_node *np = card->dev->of_node;
-+ const char *str;
-+ int ret;
-+
-+ ret = of_property_read_string(np, propname, &str);
-+ if (ret < 0) {
-+ /* no prefix is not error */
-+ return;
-+ }
-+
-+ codec_conf->of_node = of_node;
-+ codec_conf->name_prefix = str;
-+}
-+EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_prefix);
-+
- int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
- const char *propname)
- {
diff --git a/patches.renesas/0276-ASoC-rsnd-gen-add-rsnd_force_write.patch b/patches.renesas/0276-ASoC-rsnd-gen-add-rsnd_force_write.patch
deleted file mode 100644
index 619259f42cee82..00000000000000
--- a/patches.renesas/0276-ASoC-rsnd-gen-add-rsnd_force_write.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From a1afd3650ad69f5e5ed1711a2d33d5e443b1c24b Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 16 Jun 2015 08:53:11 +0000
-Subject: [PATCH 276/326] ASoC: rsnd: gen: add rsnd_force_write()
-
-rsnd_force_write() is similar to rsnd_write(),
-but rsnd_force_write() write data to register even though
-it is same value.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 7b47ab47b3938e2274834dbde7915df98fc74368)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/gen.c | 16 ++++++++++++++++
- sound/soc/sh/rcar/rsnd.h | 4 ++++
- 2 files changed, 20 insertions(+)
-
-diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
-index 8c7dc51b1c4f..48f704b1d80e 100644
---- a/sound/soc/sh/rcar/gen.c
-+++ b/sound/soc/sh/rcar/gen.c
-@@ -103,6 +103,22 @@ void rsnd_write(struct rsnd_priv *priv,
- regmap_fields_write(gen->regs[reg], rsnd_mod_id(mod), data);
- }
-
-+void rsnd_force_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;
-+
-+ dev_dbg(dev, "w %s[%d] - %4d : %08x\n",
-+ rsnd_mod_name(mod), rsnd_mod_id(mod), reg, data);
-+
-+ regmap_fields_force_write(gen->regs[reg], rsnd_mod_id(mod), data);
-+}
-+
- void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,
- enum rsnd_reg reg, u32 mask, u32 data)
- {
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 09fcc54a8ee0..f729646e3d18 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -157,12 +157,16 @@ struct rsnd_dai_stream;
- rsnd_read(rsnd_mod_to_priv(m), m, RSND_REG_##r)
- #define rsnd_mod_write(m, r, d) \
- rsnd_write(rsnd_mod_to_priv(m), m, RSND_REG_##r, d)
-+#define rsnd_mod_force_write(m, r, d) \
-+ rsnd_force_write(rsnd_mod_to_priv(m), m, RSND_REG_##r, d)
- #define rsnd_mod_bset(m, r, s, d) \
- rsnd_bset(rsnd_mod_to_priv(m), m, RSND_REG_##r, s, d)
-
- u32 rsnd_read(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg);
- void rsnd_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
- enum rsnd_reg reg, u32 data);
-+void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
-+ enum rsnd_reg reg, u32 data);
- void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
- u32 mask, u32 data);
- u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
---
-2.6.2
-
diff --git a/patches.renesas/0277-ASoC-rsrc-card-use-snd_soc_of_parse_audio_route-pref.patch b/patches.renesas/0277-ASoC-rsrc-card-use-snd_soc_of_parse_audio_route-pref.patch
deleted file mode 100644
index 7cbc4cf368b958..00000000000000
--- a/patches.renesas/0277-ASoC-rsrc-card-use-snd_soc_of_parse_audio_route-pref.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From 4769738e07a981f356df3b1c212049ade0171e00 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:08:05 +0000
-Subject: [PATCH 277/326] ASoC: rsrc-card: use
- snd_soc_of_parse_audio_route/prefix for routing
-
-using common audio routing path method makes sense.
-Let's use snd_soc_of_parse_audio_route/prefix.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit b7419dd73606118b8797d49b53a9fbe2e2dfa863)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../bindings/sound/renesas,rsrc-card.txt | 7 +++++++
- sound/soc/sh/rcar/rsrc-card.c | 22 ++++++++++++++++++----
- 2 files changed, 25 insertions(+), 4 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
-index c64155027288..962748a8d919 100644
---- a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
-+++ b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
-@@ -6,6 +6,7 @@ Required properties:
-
- - compatible : "renesas,rsrc-card,<board>"
- Examples with soctypes are:
-+ - "renesas,rsrc-card"
- - "renesas,rsrc-card,lager"
- - "renesas,rsrc-card,koelsch"
- Optional properties:
-@@ -29,6 +30,12 @@ Optional subnode properties:
- - frame-inversion : bool property. Add this if the
- dai-link uses frame clock inversion.
- - convert-rate : platform specified sampling rate convert
-+- audio-prefix : see audio-routing
-+- audio-routing : A list of the connections between audio components.
-+ Each entry is a pair of strings, the first being the connection's sink,
-+ the second being the connection's source. Valid names for sources.
-+ use audio-prefix if some components is using same sink/sources naming.
-+ it can be used if compatible was "renesas,rsrc-card";
-
- Required CPU/CODEC subnodes properties:
-
-diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
-index 84e935711e29..d61db9c385ea 100644
---- a/sound/soc/sh/rcar/rsrc-card.c
-+++ b/sound/soc/sh/rcar/rsrc-card.c
-@@ -41,6 +41,7 @@ static const struct rsrc_card_of_data routes_of_ssi0_ak4642 = {
- static const struct of_device_id rsrc_card_of_match[] = {
- { .compatible = "renesas,rsrc-card,lager", .data = &routes_of_ssi0_ak4642 },
- { .compatible = "renesas,rsrc-card,koelsch", .data = &routes_of_ssi0_ak4642 },
-+ { .compatible = "renesas,rsrc-card", },
- {},
- };
- MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
-@@ -242,8 +243,15 @@ static int rsrc_card_parse_links(struct device_node *np,
- snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name);
-
- /* additional name prefix */
-- priv->codec_conf.of_node = dai_link->codec_of_node;
-- priv->codec_conf.name_prefix = of_data->prefix;
-+ if (of_data) {
-+ priv->codec_conf.of_node = dai_link->codec_of_node;
-+ priv->codec_conf.name_prefix = of_data->prefix;
-+ } else {
-+ snd_soc_of_parse_audio_prefix(&priv->snd_card,
-+ &priv->codec_conf,
-+ dai_link->codec_of_node,
-+ "audio-prefix");
-+ }
-
- /* set dai_name */
- snprintf(dai_props->dai_name, DAI_NAME_NUM, "be.%s",
-@@ -361,8 +369,14 @@ static int rsrc_card_parse_of(struct device_node *node,
- priv->snd_card.num_links = num;
- priv->snd_card.codec_conf = &priv->codec_conf;
- priv->snd_card.num_configs = 1;
-- priv->snd_card.of_dapm_routes = of_data->routes;
-- priv->snd_card.num_of_dapm_routes = of_data->num_routes;
-+
-+ if (of_data) {
-+ priv->snd_card.of_dapm_routes = of_data->routes;
-+ priv->snd_card.num_of_dapm_routes = of_data->num_routes;
-+ } else {
-+ snd_soc_of_parse_audio_routing(&priv->snd_card,
-+ "audio-routing");
-+ }
-
- /* Parse the card name from DT */
- snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
---
-2.6.2
-
diff --git a/patches.renesas/0278-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch b/patches.renesas/0278-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch
deleted file mode 100644
index 7eb6e33a51dc2a..00000000000000
--- a/patches.renesas/0278-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 0dedb39e95a50153ad5397183c8af479030adc46 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:08:24 +0000
-Subject: [PATCH 278/326] ASoC: rsnd: remove unnecessary 'out of memory'
- message from SSI
-
-Current checkpatch.pl indicates 'out of memory' message is unnecessary.
-Let's remove it
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit afa700729646761f58cc068d86a37e09a70e4cf6)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/ssi.c | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
-index 2fbe59f7f9b5..d45b9a7e324e 100644
---- a/sound/soc/sh/rcar/ssi.c
-+++ b/sound/soc/sh/rcar/ssi.c
-@@ -770,10 +770,8 @@ int rsnd_ssi_probe(struct platform_device *pdev,
- */
- nr = info->ssi_info_nr;
- ssi = devm_kzalloc(dev, sizeof(*ssi) * nr, GFP_KERNEL);
-- if (!ssi) {
-- dev_err(dev, "SSI allocate failed\n");
-+ if (!ssi)
- return -ENOMEM;
-- }
-
- priv->ssi = ssi;
- priv->ssi_nr = nr;
---
-2.6.2
-
diff --git a/patches.renesas/0279-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch b/patches.renesas/0279-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch
deleted file mode 100644
index e7f32016ecf48b..00000000000000
--- a/patches.renesas/0279-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From bb5d029371c27570d35d17509296e98af9d26f4f Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:08:44 +0000
-Subject: [PATCH 279/326] ASoC: rsnd: remove unnecessary 'out of memory'
- message from SRC
-
-Current checkpatch.pl indicates 'out of memory' message is unnecessary.
-Let's remove it
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 33363f7a18f3baaa04b678aac8819c43296c8c9c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/src.c | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index c61c17180142..37927ca66162 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -1047,10 +1047,8 @@ int rsnd_src_probe(struct platform_device *pdev,
- return 0;
-
- src = devm_kzalloc(dev, sizeof(*src) * nr, GFP_KERNEL);
-- if (!src) {
-- dev_err(dev, "SRC allocate failed\n");
-+ if (!src)
- return -ENOMEM;
-- }
-
- priv->src_nr = nr;
- priv->src = src;
---
-2.6.2
-
diff --git a/patches.renesas/0280-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch b/patches.renesas/0280-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch
deleted file mode 100644
index 07d99c719f8b97..00000000000000
--- a/patches.renesas/0280-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 8dd0d6fa9fa8248aeb47f15b4aaad4d3f9d5174a Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:09:07 +0000
-Subject: [PATCH 280/326] ASoC: rsnd: remove unnecessary 'out of memory'
- message from DVC
-
-Current checkpatch.pl indicates 'out of memory' message is unnecessary.
-Let's remove it
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 6abcae32ea68899bfd4b770433860a71f8c3500b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dvc.c | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index 36fc020cbc18..dbf0da6ce8a5 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -354,10 +354,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
- }
-
- dvc = devm_kzalloc(dev, sizeof(*dvc) * nr, GFP_KERNEL);
-- if (!dvc) {
-- dev_err(dev, "CMD allocate failed\n");
-+ if (!dvc)
- return -ENOMEM;
-- }
-
- priv->dvc_nr = nr;
- priv->dvc = dvc;
---
-2.6.2
-
diff --git a/patches.renesas/0281-ASoC-rsnd-rename-BUSIF_DALIGN-to-SSI_BUSIF_DALIGN.patch b/patches.renesas/0281-ASoC-rsnd-rename-BUSIF_DALIGN-to-SSI_BUSIF_DALIGN.patch
deleted file mode 100644
index 7612e437183ade..00000000000000
--- a/patches.renesas/0281-ASoC-rsnd-rename-BUSIF_DALIGN-to-SSI_BUSIF_DALIGN.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From a15f8dc9a529a48fa6c8cc4bfa0668f39f16be8d Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:09:27 +0000
-Subject: [PATCH 281/326] ASoC: rsnd: rename BUSIF_DALIGN to SSI_BUSIF_DALIGN
-
-based on datasheet
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit cdde84d10d3cb4d35051bc5fdb268f6faf33d1c8)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/gen.c | 2 +-
- sound/soc/sh/rcar/rsnd.h | 2 +-
- sound/soc/sh/rcar/src.c | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
-index 48f704b1d80e..9dc1968d6f37 100644
---- a/sound/soc/sh/rcar/gen.c
-+++ b/sound/soc/sh/rcar/gen.c
-@@ -216,7 +216,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_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 f729646e3d18..f49b0cb1f5a2 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -136,7 +136,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
-+#define RSND_REG_SSI_BUSIF_DALIGN RSND_REG_SHARE22
- #define RSND_REG_DVC_VRCTR RSND_REG_SHARE23
- #define RSND_REG_DVC_VRPDR RSND_REG_SHARE24
- #define RSND_REG_DVC_VRDBR RSND_REG_SHARE25
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 37927ca66162..3f6f4df7318d 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -189,7 +189,7 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
- val |= 0x76543210 & ~mask;
- break;
- }
-- rsnd_mod_write(ssi_mod, BUSIF_DALIGN, val);
-+ rsnd_mod_write(ssi_mod, SSI_BUSIF_DALIGN, val);
-
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0282-ASoC-rsnd-rename-INT_ENABLE-to-SSI_INT_ENABLE.patch b/patches.renesas/0282-ASoC-rsnd-rename-INT_ENABLE-to-SSI_INT_ENABLE.patch
deleted file mode 100644
index e322cf4214b7a3..00000000000000
--- a/patches.renesas/0282-ASoC-rsnd-rename-INT_ENABLE-to-SSI_INT_ENABLE.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 89d31675d0c645ae1192ff570ae22a25f0c9928f Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:09:47 +0000
-Subject: [PATCH 282/326] ASoC: rsnd: rename INT_ENABLE to SSI_INT_ENABLE
-
-based on datasheet
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit efa991dc9143815179fd55a88e846cc39792608c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/gen.c | 2 +-
- sound/soc/sh/rcar/rsnd.h | 2 +-
- sound/soc/sh/rcar/src.c | 9 ++++-----
- 3 files changed, 6 insertions(+), 7 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
-index 9dc1968d6f37..5d3592dfc382 100644
---- a/sound/soc/sh/rcar/gen.c
-+++ b/sound/soc/sh/rcar/gen.c
-@@ -218,7 +218,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
- RSND_GEN_M_REG(SSI_BUSIF_ADINR, 0x4, 0x80),
- RSND_GEN_M_REG(SSI_BUSIF_DALIGN,0x8, 0x80),
- RSND_GEN_M_REG(SSI_CTRL, 0x10, 0x80),
-- RSND_GEN_M_REG(INT_ENABLE, 0x18, 0x80),
-+ RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80),
- };
- struct rsnd_regmap_field_conf conf_scu[] = {
- RSND_GEN_M_REG(SRC_BUSIF_MODE, 0x0, 0x20),
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index f49b0cb1f5a2..9ecd15180184 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -119,7 +119,7 @@ enum rsnd_reg {
- #define RSND_REG_SSI_CTRL RSND_REG_SHARE02
- #define RSND_REG_SSI_BUSIF_MODE RSND_REG_SHARE03
- #define RSND_REG_SSI_BUSIF_ADINR RSND_REG_SHARE04
--#define RSND_REG_INT_ENABLE RSND_REG_SHARE05
-+#define RSND_REG_SSI_INT_ENABLE RSND_REG_SHARE05
- #define RSND_REG_SRC_BSDSR RSND_REG_SHARE06
- #define RSND_REG_SRC_BSISR RSND_REG_SHARE07
- #define RSND_REG_DIV_EN RSND_REG_SHARE08
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 3f6f4df7318d..9e11f731a3a1 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -215,10 +215,9 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod)
- return 0;
-
- /* enable SSI interrupt if Gen2 */
-- if (rsnd_ssi_is_dma_mode(ssi_mod))
-- rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0e000000);
-- else
-- rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0f000000);
-+ rsnd_mod_write(ssi_mod, SSI_INT_ENABLE,
-+ rsnd_ssi_is_dma_mode(ssi_mod) ?
-+ 0x0e000000 : 0x0f000000);
-
- return 0;
- }
-@@ -231,7 +230,7 @@ int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod)
- return 0;
-
- /* disable SSI interrupt if Gen2 */
-- rsnd_mod_write(ssi_mod, INT_ENABLE, 0x00000000);
-+ rsnd_mod_write(ssi_mod, SSI_INT_ENABLE, 0x00000000);
-
- return 0;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0283-ASoC-rsnd-fixup-each-module-counter-on-__rsnd_mod_ca.patch b/patches.renesas/0283-ASoC-rsnd-fixup-each-module-counter-on-__rsnd_mod_ca.patch
deleted file mode 100644
index 34a3752ee7bea4..00000000000000
--- a/patches.renesas/0283-ASoC-rsnd-fixup-each-module-counter-on-__rsnd_mod_ca.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 3fc3d2bc9f51ff30072a653dff18267fc306cda4 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:10:04 +0000
-Subject: [PATCH 283/326] ASoC: rsnd: fixup each module counter on
- __rsnd_mod_call()
-
-'5451ea443b ("ASoC: rsnd: count each mod (SSI/SRC/DVC)")' counts each
-module's callback status, but counts 1st callback only.
-This patch fixup it. Otherwise, multi-called function will be trouble
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit a48e3f9747fd62b385221a892cd4726b82dacd11)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index f1e5920654f6..d44bfb79779a 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -242,9 +242,9 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
- if (val == __rsnd_mod_call_##func) { \
- called = 1; \
- ret = (mod)->ops->func(mod, io, param); \
-- mod->status = (mod->status & ~mask) + \
-- (add << __rsnd_mod_shift_##func); \
- } \
-+ mod->status = (mod->status & ~mask) + \
-+ (add << __rsnd_mod_shift_##func); \
- dev_dbg(dev, "%s[%d] 0x%08x %s\n", \
- rsnd_mod_name(mod), rsnd_mod_id(mod), mod->status, \
- called ? #func : ""); \
---
-2.6.2
-
diff --git a/patches.renesas/0284-ASoC-rsnd-add-workaround-for-SRC-sync-convert-DVC.patch b/patches.renesas/0284-ASoC-rsnd-add-workaround-for-SRC-sync-convert-DVC.patch
deleted file mode 100644
index dca5297b1427a8..00000000000000
--- a/patches.renesas/0284-ASoC-rsnd-add-workaround-for-SRC-sync-convert-DVC.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From d44f36d0a157dd765daac616c6936aa0c89ee944 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:10:22 +0000
-Subject: [PATCH 284/326] ASoC: rsnd: add workaround for SRC sync convert + DVC
-
-We couldn't use SRC sync convert mode together with DVC,
-but we can use workaround for it.
-This patch adds workaround and can use SRC sync convert + DVC
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 1a1bf58aafd09b3cb148eead3d709e2d7974a1f3)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/src.c | 43 ++++++++++++++++++++++++++++++++-----------
- 1 file changed, 32 insertions(+), 11 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 9e11f731a3a1..38d0aba7426e 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -616,6 +616,14 @@ static void rsnd_src_irq_ctrol_gen2(struct rsnd_mod *mod, int enable)
- int_val = 0;
- }
-
-+ /*
-+ * WORKAROUND
-+ *
-+ * ignore over flow error when rsnd_enable_sync_convert()
-+ */
-+ if (rsnd_enable_sync_convert(src))
-+ sys_int_val = sys_int_val & 0xffff;
-+
- rsnd_mod_write(mod, SRC_INT_ENABLE0, int_val);
- rsnd_mod_bset(mod, SCU_SYS_INT_EN0, sys_int_mask, sys_int_val);
- rsnd_mod_bset(mod, SCU_SYS_INT_EN1, sys_int_mask, sys_int_val);
-@@ -631,11 +639,22 @@ static void rsnd_src_error_clear_gen2(struct rsnd_mod *mod)
-
- static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
- {
-- u32 val = OUF_SRC(rsnd_mod_id(mod));
-+ struct rsnd_src *src = rsnd_mod_to_src(mod);
-+ u32 val0, val1;
- bool ret = false;
-
-- if ((rsnd_mod_read(mod, SCU_SYS_STATUS0) & val) ||
-- (rsnd_mod_read(mod, SCU_SYS_STATUS1) & val)) {
-+ val0 = val1 = OUF_SRC(rsnd_mod_id(mod));
-+
-+ /*
-+ * WORKAROUND
-+ *
-+ * ignore over flow error when rsnd_enable_sync_convert()
-+ */
-+ if (rsnd_enable_sync_convert(src))
-+ val0 = val0 & 0xffff;
-+
-+ if ((rsnd_mod_read(mod, SCU_SYS_STATUS0) & val0) ||
-+ (rsnd_mod_read(mod, SCU_SYS_STATUS1) & val1)) {
- struct rsnd_src *src = rsnd_mod_to_src(mod);
-
- src->err++;
-@@ -651,7 +670,16 @@ static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
- static int _rsnd_src_start_gen2(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io)
- {
-- u32 val = rsnd_io_to_mod_dvc(io) ? 0x01 : 0x11;
-+ struct rsnd_src *src = rsnd_mod_to_src(mod);
-+ u32 val;
-+
-+ /*
-+ * WORKAROUND
-+ *
-+ * Enable SRC output if you want to use sync convert together with DVC
-+ */
-+ val = (rsnd_io_to_mod_dvc(io) && !rsnd_enable_sync_convert(src)) ?
-+ 0x01 : 0x11;
-
- rsnd_mod_write(mod, SRC_CTRL, val);
-
-@@ -921,13 +949,6 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
- return 0;
-
- /*
-- * We can't use SRC sync convert
-- * if it has DVC
-- */
-- if (rsnd_io_to_mod_dvc(io))
-- return 0;
--
-- /*
- * enable sync convert
- */
- ret = rsnd_kctrl_new_s(mod, io, rtd,
---
-2.6.2
-
diff --git a/patches.renesas/0285-ASoC-rsnd-rsnd_mod_id-return-1-if-mod-was-NULL.patch b/patches.renesas/0285-ASoC-rsnd-rsnd_mod_id-return-1-if-mod-was-NULL.patch
deleted file mode 100644
index 28dd3654556f0f..00000000000000
--- a/patches.renesas/0285-ASoC-rsnd-rsnd_mod_id-return-1-if-mod-was-NULL.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 9bc0157fd67b201f2a54ff97d0ddaa8fd68366dd Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:10:43 +0000
-Subject: [PATCH 285/326] ASoC: rsnd: rsnd_mod_id() return -1 if mod was NULL
-
-enabling to use same method for exception case is useful.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 72413c107e81386a7da438bcf888ee2af5d3b72f)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsnd.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 9ecd15180184..46eb4daa1461 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -316,7 +316,7 @@ struct rsnd_mod {
-
- #define rsnd_mod_to_priv(mod) ((mod)->priv)
- #define rsnd_mod_to_dma(mod) (&(mod)->dma)
--#define rsnd_mod_id(mod) ((mod)->id)
-+#define rsnd_mod_id(mod) ((mod) ? (mod)->id : -1)
- #define rsnd_mod_hw_start(mod) clk_enable((mod)->clk)
- #define rsnd_mod_hw_stop(mod) clk_disable((mod)->clk)
-
---
-2.6.2
-
diff --git a/patches.renesas/0286-ASoC-rsnd-move-DVC-specific-macro-into-dvc.c.patch b/patches.renesas/0286-ASoC-rsnd-move-DVC-specific-macro-into-dvc.c.patch
deleted file mode 100644
index adfea51f892a4e..00000000000000
--- a/patches.renesas/0286-ASoC-rsnd-move-DVC-specific-macro-into-dvc.c.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 9fa24f866a1faee4925231114d4327e0243d6903 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:11:02 +0000
-Subject: [PATCH 286/326] ASoC: rsnd: move DVC specific macro into dvc.c
-
-rsnd_dvc_nr() is used only from dvc.c
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 4f35fabaa30b116d549d95fe7dae907510c71862)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dvc.c | 1 +
- sound/soc/sh/rcar/rsnd.h | 3 ---
- 2 files changed, 1 insertion(+), 3 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index dbf0da6ce8a5..8a61aa396306 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -24,6 +24,7 @@ struct rsnd_dvc {
- struct rsnd_kctrl_cfg_s rdown; /* Ramp Rate Down */
- };
-
-+#define rsnd_dvc_nr(priv) ((priv)->dvc_nr)
- #define rsnd_dvc_of_node(priv) \
- of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,dvc")
-
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 46eb4daa1461..8f793f020b08 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -579,7 +579,4 @@ void rsnd_dvc_remove(struct platform_device *pdev,
- struct rsnd_priv *priv);
- struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id);
-
--#define rsnd_dvc_nr(priv) ((priv)->dvc_nr)
--
--
- #endif
---
-2.6.2
-
diff --git a/patches.renesas/0287-ASoC-rsnd-move-SRC-specific-macro-into-src.c.patch b/patches.renesas/0287-ASoC-rsnd-move-SRC-specific-macro-into-src.c.patch
deleted file mode 100644
index 65d06a5d983174..00000000000000
--- a/patches.renesas/0287-ASoC-rsnd-move-SRC-specific-macro-into-src.c.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 1242f2f30e8acefb31e374e5b9c7e7c5d58edee6 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:11:21 +0000
-Subject: [PATCH 287/326] ASoC: rsnd: move SRC specific macro into src.c
-
-rsnd_src_nr() is used only from src.c
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit da599fd34b1f2f14f2c387e6b3a909f9ff519c8a)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsnd.h | 2 --
- sound/soc/sh/rcar/src.c | 1 +
- 2 files changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 8f793f020b08..c8d202939e25 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -554,8 +554,6 @@ int rsnd_src_ssiu_stop(struct rsnd_mod *ssi_mod,
- int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
- int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
-
--#define rsnd_src_nr(priv) ((priv)->src_nr)
--
- /*
- * R-Car SSI
- */
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 38d0aba7426e..0b06ac8dbeec 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -30,6 +30,7 @@ struct rsnd_src {
-
- #define RSND_SRC_NAME_SIZE 16
-
-+#define rsnd_src_nr(priv) ((priv)->src_nr)
- #define rsnd_enable_sync_convert(src) ((src)->sen.val)
- #define rsnd_src_of_node(priv) \
- of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,src")
---
-2.6.2
-
diff --git a/patches.renesas/0288-ASoC-rsnd-dvc-make-sure-DVC-soft-reset.patch b/patches.renesas/0288-ASoC-rsnd-dvc-make-sure-DVC-soft-reset.patch
deleted file mode 100644
index 3f81cb56f2f882..00000000000000
--- a/patches.renesas/0288-ASoC-rsnd-dvc-make-sure-DVC-soft-reset.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 80b546eb89d7e1660e5c5c6e65beed6f80708a87 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:12:00 +0000
-Subject: [PATCH 288/326] ASoC: rsnd: dvc: make sure DVC soft reset
-
-Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
-and these have similar register. xxxRSR (Software reset Register) is one
-of them. These xxxRSR need be set to 1 to 0 when software reset.
-Current rsnd driver has src.c / dvc.c, and we will have mix.c.
-It is readable if these have same named function.
-This patch adds rsnd_dvc_soft_reset() and make sure it
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 636e4bad5cca947839c09d3e13ad6feeb7fa45da)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dvc.c | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index 8a61aa396306..24d07634c749 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -64,6 +64,12 @@ static const char * const dvc_ramp_rate[] = {
- "0.125 dB/8192 steps", /* 10111 */
- };
-
-+static void rsnd_dvc_soft_reset(struct rsnd_mod *mod)
-+{
-+ rsnd_mod_write(mod, DVC_SWRSR, 0);
-+ rsnd_mod_write(mod, DVC_SWRSR, 1);
-+}
-+
- static void rsnd_dvc_volume_update(struct rsnd_dai_stream *io,
- struct rsnd_mod *mod)
- {
-@@ -160,15 +166,14 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
-
- rsnd_mod_hw_start(dvc_mod);
-
-+ rsnd_dvc_soft_reset(dvc_mod);
-+
- /*
- * fixme
- * it doesn't support CTU/MIX
- */
- rsnd_mod_write(dvc_mod, CMD_ROUTE_SLCT, route[src_id]);
-
-- rsnd_mod_write(dvc_mod, DVC_SWRSR, 0);
-- rsnd_mod_write(dvc_mod, DVC_SWRSR, 1);
--
- rsnd_mod_write(dvc_mod, DVC_DVUIR, 1);
-
- rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
---
-2.6.2
-
diff --git a/patches.renesas/0289-ASoC-rsnd-src-make-sure-SRC-soft-reset.patch b/patches.renesas/0289-ASoC-rsnd-src-make-sure-SRC-soft-reset.patch
deleted file mode 100644
index 263dc739b636db..00000000000000
--- a/patches.renesas/0289-ASoC-rsnd-src-make-sure-SRC-soft-reset.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 99c52014387512a1383f9b08a7b41921e97dd623 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:12:18 +0000
-Subject: [PATCH 289/326] ASoC: rsnd: src: make sure SRC soft reset
-
-Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
-and these have similar register. xxxRSR (Software reset Register) is one
-of them. These xxxRSR need be set to 1 to 0 when software reset.
-Current rsnd driver has src.c / dvc.c, and we will have mix.c.
-It is readable if these have same named function.
-This patch adds rsnd_src_soft_reset() and make sure it
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 379febfd2e30ec8db5baccd9f9403bf650c6afa1)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/src.c | 12 ++++++++----
- 1 file changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 0b06ac8dbeec..74ab644c688e 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -118,6 +118,12 @@ struct rsnd_src {
- /*
- * Gen1/Gen2 common functions
- */
-+static void rsnd_src_soft_reset(struct rsnd_mod *mod)
-+{
-+ rsnd_mod_write(mod, SRC_SWRSR, 0);
-+ rsnd_mod_write(mod, SRC_SWRSR, 1);
-+}
-+
- static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
- struct rsnd_mod *mod)
- {
-@@ -294,10 +300,6 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
- if (convert_rate)
- fsrate = 0x0400000 / convert_rate * runtime->rate;
-
-- /* set/clear soft reset */
-- rsnd_mod_write(mod, SRC_SWRSR, 0);
-- rsnd_mod_write(mod, SRC_SWRSR, 1);
--
- /* Set channel number and output bit length */
- rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod, io));
-
-@@ -358,6 +360,8 @@ static int rsnd_src_init(struct rsnd_mod *mod,
-
- rsnd_mod_hw_start(mod);
-
-+ rsnd_src_soft_reset(mod);
-+
- src->err = 0;
-
- /* reset sync convert_rate */
---
-2.6.2
-
diff --git a/patches.renesas/0290-ASoC-rsnd-enable-module-multi-connection.patch b/patches.renesas/0290-ASoC-rsnd-enable-module-multi-connection.patch
deleted file mode 100644
index 04a7b82fdd6582..00000000000000
--- a/patches.renesas/0290-ASoC-rsnd-enable-module-multi-connection.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From aa61b2d3709ecccdb8e42e3b9de879b30d4b5d8e Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:12:36 +0000
-Subject: [PATCH 290/326] ASoC: rsnd: enable module multi connection
-
-'8a4e379b54f8("ASoC: rsnd: remove io from rsnd_mod")' removed mod/io
-relationship. rsnd_dai_connect() mod/io check is no longer needed
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit d6f8d5b4422a5a391c02df97af9ef7da5a929d71)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 10 ----------
- 1 file changed, 10 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index d44bfb79779a..ff4f15a2666a 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -277,16 +277,6 @@ static int rsnd_dai_connect(struct rsnd_mod *mod,
- if (!mod)
- return -EIO;
-
-- if (io->mod[mod->type]) {
-- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-- struct device *dev = rsnd_priv_to_dev(priv);
--
-- dev_err(dev, "%s[%d] is not empty\n",
-- rsnd_mod_name(mod),
-- rsnd_mod_id(mod));
-- return -EIO;
-- }
--
- io->mod[mod->type] = mod;
-
- return 0;
---
-2.6.2
-
diff --git a/patches.renesas/0291-ASoC-rsnd-rename-rsnd_path_parse-break-into-add-remo.patch b/patches.renesas/0291-ASoC-rsnd-rename-rsnd_path_parse-break-into-add-remo.patch
deleted file mode 100644
index 109e1f25f811b9..00000000000000
--- a/patches.renesas/0291-ASoC-rsnd-rename-rsnd_path_parse-break-into-add-remo.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 3e786be716fd39acb0660d38d30609e60bd62812 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:12:52 +0000
-Subject: [PATCH 291/326] ASoC: rsnd: rename rsnd_path_parse/break() into
- add/remove
-
-parse/break is a little ambiguous/confusable name for rsnd module path.
-Especially for CTU/MIX support. It was renamed to add/remove
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit c8cf15f64f8ddb3169987c2f26df3341b8556296)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index ff4f15a2666a..93fed5031c69 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -507,7 +507,7 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
- .set_fmt = rsnd_soc_dai_set_fmt,
- };
-
--#define rsnd_path_parse(priv, io, type) \
-+#define rsnd_path_add(priv, io, type) \
- ({ \
- struct rsnd_mod *mod; \
- int ret = 0; \
-@@ -523,7 +523,7 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
- ret; \
- })
-
--#define rsnd_path_break(priv, io, type) \
-+#define rsnd_path_remove(priv, io, type) \
- { \
- struct rsnd_mod *mod; \
- int id = -1; \
-@@ -555,17 +555,17 @@ static int rsnd_path_init(struct rsnd_priv *priv,
- */
-
- /* SRC */
-- ret = rsnd_path_parse(priv, io, src);
-+ ret = rsnd_path_add(priv, io, src);
- if (ret < 0)
- return ret;
-
- /* SSI */
-- ret = rsnd_path_parse(priv, io, ssi);
-+ ret = rsnd_path_add(priv, io, ssi);
- if (ret < 0)
- return ret;
-
- /* DVC */
-- ret = rsnd_path_parse(priv, io, dvc);
-+ ret = rsnd_path_add(priv, io, dvc);
- if (ret < 0)
- return ret;
-
-@@ -1023,8 +1023,8 @@ static int rsnd_rdai_continuance_probe(struct rsnd_priv *priv,
- /*
- * remove SRC/DVC from DAI,
- */
-- rsnd_path_break(priv, io, src);
-- rsnd_path_break(priv, io, dvc);
-+ rsnd_path_remove(priv, io, src);
-+ rsnd_path_remove(priv, io, dvc);
-
- /*
- * fallback
---
-2.6.2
-
diff --git a/patches.renesas/0292-ASoC-rsnd-add-rsnd_path_parse-for-CTU-MIX-DVC-route-.patch b/patches.renesas/0292-ASoC-rsnd-add-rsnd_path_parse-for-CTU-MIX-DVC-route-.patch
deleted file mode 100644
index 5946fb45f863f5..00000000000000
--- a/patches.renesas/0292-ASoC-rsnd-add-rsnd_path_parse-for-CTU-MIX-DVC-route-.patch
+++ /dev/null
@@ -1,135 +0,0 @@
-From 8a980b6c938573e4c69509f0801aec0992ac27b2 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:13:10 +0000
-Subject: [PATCH 292/326] ASoC: rsnd: add rsnd_path_parse() for CTU/MIX/DVC
- route setting
-
-Current sound data route settings is done in dvc.c, and it doesn't care
-about CTU/MIX at this poinnt, but we need to care about these.
-OTOH, rsnd driver already has rsnd_path_xxx() functions for data path which
-are good match for CTU/MIX/DVC path selectio.
-This patch adds new rsnd_path_parse() to select sound data route which will
-care about CTU/MIX/DVC path.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit e2c08416196bd10a6575057fdd1347a307ce3a15)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 22 ++++++++++++++++++++++
- sound/soc/sh/rcar/dvc.c | 40 +++++++++-------------------------------
- sound/soc/sh/rcar/rsnd.h | 2 ++
- 3 files changed, 33 insertions(+), 31 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 93fed5031c69..cb8206721283 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -537,6 +537,28 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
- } \
- }
-
-+void rsnd_path_parse(struct rsnd_priv *priv,
-+ struct rsnd_dai_stream *io)
-+{
-+ struct rsnd_mod *src = rsnd_io_to_mod_src(io);
-+ struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
-+ int src_id = rsnd_mod_id(src);
-+ u32 path[] = {
-+ [0] = 0x30000,
-+ [1] = 0x30001,
-+ [2] = 0x40000,
-+ [3] = 0x10000,
-+ [4] = 0x20000,
-+ [5] = 0x40100
-+ };
-+
-+ /* Gen1 is not supported */
-+ if (rsnd_is_gen1(priv))
-+ return;
-+
-+ rsnd_mod_write(dvc, CMD_ROUTE_SLCT, path[src_id]);
-+}
-+
- static int rsnd_path_init(struct rsnd_priv *priv,
- struct rsnd_dai *rdai,
- struct rsnd_dai_stream *io)
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index 24d07634c749..9392507b5651 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -142,48 +142,26 @@ static int rsnd_dvc_remove_gen2(struct rsnd_mod *mod,
- return 0;
- }
-
--static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
-+static int rsnd_dvc_init(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
-- struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
-- struct device *dev = rsnd_priv_to_dev(priv);
-- int dvc_id = rsnd_mod_id(dvc_mod);
-- int src_id = rsnd_mod_id(src_mod);
-- u32 route[] = {
-- [0] = 0x30000,
-- [1] = 0x30001,
-- [2] = 0x40000,
-- [3] = 0x10000,
-- [4] = 0x20000,
-- [5] = 0x40100
-- };
--
-- if (src_id >= ARRAY_SIZE(route)) {
-- dev_err(dev, "DVC%d isn't connected to SRC%d\n", dvc_id, src_id);
-- return -EINVAL;
-- }
--
-- rsnd_mod_hw_start(dvc_mod);
-+ rsnd_mod_hw_start(mod);
-
-- rsnd_dvc_soft_reset(dvc_mod);
-+ rsnd_dvc_soft_reset(mod);
-
-- /*
-- * fixme
-- * it doesn't support CTU/MIX
-- */
-- rsnd_mod_write(dvc_mod, CMD_ROUTE_SLCT, route[src_id]);
-+ rsnd_path_parse(priv, io);
-
-- rsnd_mod_write(dvc_mod, DVC_DVUIR, 1);
-+ rsnd_mod_write(mod, DVC_DVUIR, 1);
-
-- rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io));
-+ rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
-
- /* ch0/ch1 Volume */
-- rsnd_dvc_volume_update(io, dvc_mod);
-+ rsnd_dvc_volume_update(io, mod);
-
-- rsnd_mod_write(dvc_mod, DVC_DVUIR, 0);
-+ rsnd_mod_write(mod, DVC_DVUIR, 0);
-
-- rsnd_adg_set_cmd_timsel_gen2(dvc_mod, io);
-+ rsnd_adg_set_cmd_timsel_gen2(mod, io);
-
- return 0;
- }
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index c8d202939e25..6a8775787919 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -170,6 +170,8 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
- void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
- u32 mask, u32 data);
- u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
-+void rsnd_path_parse(struct rsnd_priv *priv,
-+ struct rsnd_dai_stream *io);
-
- /*
- * R-Car DMA
---
-2.6.2
-
diff --git a/patches.renesas/0293-ASoC-rsnd-add-rsnd_dvc_initialize_lock-unlock.patch b/patches.renesas/0293-ASoC-rsnd-add-rsnd_dvc_initialize_lock-unlock.patch
deleted file mode 100644
index 5b084c7f38f603..00000000000000
--- a/patches.renesas/0293-ASoC-rsnd-add-rsnd_dvc_initialize_lock-unlock.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 73998d8e58a110d0f791977e35498c6261191de8 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:13:29 +0000
-Subject: [PATCH 293/326] ASoC: rsnd: add rsnd_dvc_initialize_lock/unlock()
-
-Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
-and these have similar register. xxxIR (Initialization Register) is one
-of them. These xxxIR need be set to 1 during initialization.
-Current rsnd driver has src.c / dvc.c, and we will have mix.c.
-It is readable if these have same named function.
-This patch adds rsnd_dvc_initialize_lock/unlock() and make sure it
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 3bb3d363e50d371289f0bd63b48da771ea807c02)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dvc.c | 15 +++++++++++----
- 1 file changed, 11 insertions(+), 4 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index 9392507b5651..343d44625fa5 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -70,6 +70,13 @@ static void rsnd_dvc_soft_reset(struct rsnd_mod *mod)
- rsnd_mod_write(mod, DVC_SWRSR, 1);
- }
-
-+#define rsnd_dvc_initialize_lock(mod) __rsnd_dvc_initialize_lock(mod, 1)
-+#define rsnd_dvc_initialize_unlock(mod) __rsnd_dvc_initialize_lock(mod, 0)
-+static void __rsnd_dvc_initialize_lock(struct rsnd_mod *mod, u32 enable)
-+{
-+ rsnd_mod_write(mod, DVC_DVUIR, enable);
-+}
-+
- static void rsnd_dvc_volume_update(struct rsnd_dai_stream *io,
- struct rsnd_mod *mod)
- {
-@@ -150,17 +157,15 @@ static int rsnd_dvc_init(struct rsnd_mod *mod,
-
- rsnd_dvc_soft_reset(mod);
-
-- rsnd_path_parse(priv, io);
-+ rsnd_dvc_initialize_lock(mod);
-
-- rsnd_mod_write(mod, DVC_DVUIR, 1);
-+ rsnd_path_parse(priv, io);
-
- rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
-
- /* ch0/ch1 Volume */
- rsnd_dvc_volume_update(io, mod);
-
-- rsnd_mod_write(mod, DVC_DVUIR, 0);
--
- rsnd_adg_set_cmd_timsel_gen2(mod, io);
-
- return 0;
-@@ -179,6 +184,8 @@ static int rsnd_dvc_start(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io,
- struct rsnd_priv *priv)
- {
-+ rsnd_dvc_initialize_unlock(mod);
-+
- rsnd_mod_write(mod, CMD_CTRL, 0x10);
-
- return 0;
---
-2.6.2
-
diff --git a/patches.renesas/0294-ASoC-rsnd-add-rsnd_src_initialize_lock-unlock.patch b/patches.renesas/0294-ASoC-rsnd-add-rsnd_src_initialize_lock-unlock.patch
deleted file mode 100644
index fa209a27e14278..00000000000000
--- a/patches.renesas/0294-ASoC-rsnd-add-rsnd_src_initialize_lock-unlock.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-From c030113054a22dc16df944d5aae90fc5c524bab0 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:13:47 +0000
-Subject: [PATCH 294/326] ASoC: rsnd: add rsnd_src_initialize_lock/unlock()
-
-Renesas SCU (Sampling Rate Convert Unit) includes SRC/CTU/MIX/DVC,
-and these have similar register. xxxIR (Initialization Register) is one
-of them. These xxxIR need be set to 1 during initialization.
-Current rsnd driver has src.c / dvc.c, and we will have mix.c.
-It is readable if these have same named function.
-This patch adds rsnd_src_initialize_lock/unlock() and make sure it
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit d1ade514e84ea55cba999edb04cb88daa4da94b8)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/src.c | 22 +++++++++++-----------
- 1 file changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index 74ab644c688e..b3d965ee9b77 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -124,6 +124,14 @@ static void rsnd_src_soft_reset(struct rsnd_mod *mod)
- rsnd_mod_write(mod, SRC_SWRSR, 1);
- }
-
-+
-+#define rsnd_src_initialize_lock(mod) __rsnd_src_initialize_lock(mod, 1)
-+#define rsnd_src_initialize_unlock(mod) __rsnd_src_initialize_lock(mod, 0)
-+static void __rsnd_src_initialize_lock(struct rsnd_mod *mod, u32 enable)
-+{
-+ rsnd_mod_write(mod, SRC_SRCIR, enable);
-+}
-+
- static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
- struct rsnd_mod *mod)
- {
-@@ -362,17 +370,13 @@ static int rsnd_src_init(struct rsnd_mod *mod,
-
- rsnd_src_soft_reset(mod);
-
-+ rsnd_src_initialize_lock(mod);
-+
- src->err = 0;
-
- /* reset sync convert_rate */
- src->sync.val = 0;
-
-- /*
-- * Initialize the operation of the SRC internal circuits
-- * see rsnd_src_start()
-- */
-- rsnd_mod_write(mod, SRC_SRCIR, 1);
--
- return 0;
- }
-
-@@ -399,11 +403,7 @@ static int rsnd_src_quit(struct rsnd_mod *mod,
-
- static int rsnd_src_start(struct rsnd_mod *mod)
- {
-- /*
-- * Cancel the initialization and operate the SRC function
-- * see rsnd_src_init()
-- */
-- rsnd_mod_write(mod, SRC_SRCIR, 0);
-+ rsnd_src_initialize_unlock(mod);
-
- return 0;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0295-ASoC-rsnd-tidyup-ADINR-function-name.patch b/patches.renesas/0295-ASoC-rsnd-tidyup-ADINR-function-name.patch
deleted file mode 100644
index 37af5915d35544..00000000000000
--- a/patches.renesas/0295-ASoC-rsnd-tidyup-ADINR-function-name.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From c2aacd6deb084a00f3cddbab9ba38f99f5c68eae Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:14:05 +0000
-Subject: [PATCH 295/326] ASoC: rsnd: tidyup ADINR function name
-
-Renesas sound IP (= SSIU/SRC/CTU/MIX/DVC) have ADINR
-(= Audio Information Register), but some of them (= SSIU/SRC/DVC)
-are for audio data bits, some of them (= CTU/MIX) are for audio data
-channels.
-Current rsnd driver is supporting SSIU/SRC/DVC, and these ADINR were
-for bits. This patch rename rsnd_get_adinr() to rsnd_get_adinr_bit(),
-and we will have rsnd_get_adinr_chan() for CTU/MIX.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 3023b384d0c9da49028131b91fe64b24b5b84e6d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 4 ++--
- sound/soc/sh/rcar/dvc.c | 2 +-
- sound/soc/sh/rcar/rsnd.h | 2 +-
- sound/soc/sh/rcar/src.c | 4 ++--
- 4 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index cb8206721283..0ca6d0268b56 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -203,9 +203,9 @@ int rsnd_io_is_working(struct rsnd_dai_stream *io)
- }
-
- /*
-- * settting function
-+ * ADINR function
- */
--u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
-+u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
- {
- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
- struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index 343d44625fa5..d06e4ee91f8d 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -161,7 +161,7 @@ static int rsnd_dvc_init(struct rsnd_mod *mod,
-
- rsnd_path_parse(priv, io);
-
-- rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr(mod, io));
-+ rsnd_mod_write(mod, DVC_ADINR, rsnd_get_adinr_bit(mod, io));
-
- /* ch0/ch1 Volume */
- rsnd_dvc_volume_update(io, mod);
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 6a8775787919..224a4a9eabd7 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -169,7 +169,7 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
- enum rsnd_reg reg, u32 data);
- void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
- u32 mask, u32 data);
--u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
-+u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
- void rsnd_path_parse(struct rsnd_priv *priv,
- struct rsnd_dai_stream *io);
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index b3d965ee9b77..c45da610feda 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -189,7 +189,7 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
- u32 mask = ~0;
-
- rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
-- rsnd_get_adinr(ssi_mod, io));
-+ rsnd_get_adinr_bit(ssi_mod, io));
- rsnd_mod_write(ssi_mod, SSI_BUSIF_MODE, 1);
- rsnd_mod_write(ssi_mod, SSI_CTRL, 0x1);
-
-@@ -309,7 +309,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
- fsrate = 0x0400000 / convert_rate * runtime->rate;
-
- /* Set channel number and output bit length */
-- rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr(mod, io));
-+ rsnd_mod_write(mod, SRC_ADINR, rsnd_get_adinr_bit(mod, io));
-
- /* Enable the initial value of IFS */
- if (fsrate) {
---
-2.6.2
-
diff --git a/patches.renesas/0296-ASoC-rsnd-add-rsnd_get_adinr_chan.patch b/patches.renesas/0296-ASoC-rsnd-add-rsnd_get_adinr_chan.patch
deleted file mode 100644
index 429d1a2a3324bc..00000000000000
--- a/patches.renesas/0296-ASoC-rsnd-add-rsnd_get_adinr_chan.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From df02acace53f5fbcf496d6d0ba1ccc797d2c3c54 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:14:29 +0000
-Subject: [PATCH 296/326] ASoC: rsnd: add rsnd_get_adinr_chan()
-
-Current rsnd driver has rsnd_get_adinr_bit() to get bit settings for
-ADINR (= Audio Information Register) of SSIU/SRC/DVC.
-This patch adds rsnd_get_adinr_chan() to get channel settings for
-ADINR (= Audio Information Register) of CTU/MIX.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit bfe1360d79210f9c1d330a07c26a8d5cb202159d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 22 ++++++++++++++++++++++
- sound/soc/sh/rcar/rsnd.h | 1 +
- 2 files changed, 23 insertions(+)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 0ca6d0268b56..a3637b92b187 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -227,6 +227,28 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
- return adinr;
- }
-
-+u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
-+{
-+ struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-+ struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-+ struct device *dev = rsnd_priv_to_dev(priv);
-+ u32 chan = runtime->channels;
-+
-+ switch (chan) {
-+ case 1:
-+ case 2:
-+ case 4:
-+ case 6:
-+ case 8:
-+ break;
-+ default:
-+ dev_warn(dev, "not supported channel\n");
-+ chan = 0;
-+ break;
-+ }
-+
-+ return chan;
-+}
- /*
- * rsnd_dai functions
- */
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 224a4a9eabd7..1296b3525fa6 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -170,6 +170,7 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod,
- void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
- u32 mask, u32 data);
- u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
-+u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
- void rsnd_path_parse(struct rsnd_priv *priv,
- struct rsnd_dai_stream *io);
-
---
-2.6.2
-
diff --git a/patches.renesas/0297-ASoC-rsnd-tidyup-data-align-position.patch b/patches.renesas/0297-ASoC-rsnd-tidyup-data-align-position.patch
deleted file mode 100644
index 34dc2fdb84091a..00000000000000
--- a/patches.renesas/0297-ASoC-rsnd-tidyup-data-align-position.patch
+++ /dev/null
@@ -1,169 +0,0 @@
-From 742e8653d61715a65cfec6a179f922eb260b199d Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:14:47 +0000
-Subject: [PATCH 297/326] ASoC: rsnd: tidyup data align position
-
-Sound L/R order of SSI is different from Linux sound data order.
-So current rsnd driver is using DALIGN (= data align) to exchange data
-align on SSIU. OTOH, CMD/SRC/SSIU have DALIGN register. Now inverted
-sound volume will be exchanged if user used volume control on DVC.
-Because SSIU which exchanges data align is located after DVC.
-
- MEM -> SRC -> DVC -> SSI
-
-This patch exchanges data align SRC if possible
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 4689032b11d1af10e5eb755eb575f9761a455a72)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 36 ++++++++++++++++++++++++++++++++++++
- sound/soc/sh/rcar/gen.c | 1 +
- sound/soc/sh/rcar/rsnd.h | 3 +++
- sound/soc/sh/rcar/src.c | 20 +++++---------------
- 4 files changed, 45 insertions(+), 15 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index a3637b92b187..0f9323f2c049 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -249,6 +249,42 @@ u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
-
- return chan;
- }
-+
-+/*
-+ * DALIGN function
-+ */
-+u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
-+{
-+ struct rsnd_mod *src = rsnd_io_to_mod_src(io);
-+ struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
-+ struct rsnd_mod *target = src ? src : ssi;
-+ struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-+ u32 val = 0x76543210;
-+ u32 mask = ~0;
-+
-+ mask <<= runtime->channels * 4;
-+ val = val & mask;
-+
-+ switch (runtime->sample_bits) {
-+ case 16:
-+ val |= 0x67452301 & ~mask;
-+ break;
-+ case 32:
-+ val |= 0x76543210 & ~mask;
-+ break;
-+ }
-+
-+ /*
-+ * exchange channeles on SRC if possible,
-+ * otherwise, R/L volume settings on DVC
-+ * changes inverted channels
-+ */
-+ if (mod == target)
-+ return val;
-+ else
-+ return 0x76543210;
-+}
-+
- /*
- * rsnd_dai functions
- */
-diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
-index 5d3592dfc382..a2d5df4d5d17 100644
---- a/sound/soc/sh/rcar/gen.c
-+++ b/sound/soc/sh/rcar/gen.c
-@@ -222,6 +222,7 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
- };
- struct rsnd_regmap_field_conf conf_scu[] = {
- RSND_GEN_M_REG(SRC_BUSIF_MODE, 0x0, 0x20),
-+ RSND_GEN_M_REG(SRC_BUSIF_DALIGN,0x8, 0x20),
- RSND_GEN_M_REG(SRC_ROUTE_MODE0, 0xc, 0x20),
- RSND_GEN_M_REG(SRC_CTRL, 0x10, 0x20),
- RSND_GEN_M_REG(SRC_INT_ENABLE0, 0x18, 0x20),
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 1296b3525fa6..6c10a8b9210e 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -99,6 +99,7 @@ enum rsnd_reg {
- RSND_REG_SHARE26,
- RSND_REG_SHARE27,
- RSND_REG_SHARE28,
-+ RSND_REG_SHARE29,
-
- RSND_REG_MAX,
- };
-@@ -143,6 +144,7 @@ enum rsnd_reg {
- #define RSND_REG_SCU_SYS_STATUS1 RSND_REG_SHARE26
- #define RSND_REG_SCU_SYS_INT_EN1 RSND_REG_SHARE27
- #define RSND_REG_SRC_INT_ENABLE0 RSND_REG_SHARE28
-+#define RSND_REG_SRC_BUSIF_DALIGN RSND_REG_SHARE29
-
- struct rsnd_of_data;
- struct rsnd_priv;
-@@ -171,6 +173,7 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg,
- u32 mask, u32 data);
- u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
- u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
-+u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
- void rsnd_path_parse(struct rsnd_priv *priv,
- struct rsnd_dai_stream *io);
-
-diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
-index c45da610feda..89a18e102feb 100644
---- a/sound/soc/sh/rcar/src.c
-+++ b/sound/soc/sh/rcar/src.c
-@@ -148,7 +148,6 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
- int use_busif)
- {
- struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
-- struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
- int ssi_id = rsnd_mod_id(ssi_mod);
-
- /*
-@@ -185,27 +184,14 @@ int rsnd_src_ssiu_start(struct rsnd_mod *ssi_mod,
- * DMA settings for SSIU
- */
- if (use_busif) {
-- u32 val = 0x76543210;
-- u32 mask = ~0;
-+ u32 val = rsnd_get_dalign(ssi_mod, io);
-
- rsnd_mod_write(ssi_mod, SSI_BUSIF_ADINR,
- rsnd_get_adinr_bit(ssi_mod, io));
- 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, SSI_BUSIF_DALIGN, val);
--
- }
-
- return 0;
-@@ -678,6 +664,10 @@ static int _rsnd_src_start_gen2(struct rsnd_mod *mod,
- struct rsnd_src *src = rsnd_mod_to_src(mod);
- u32 val;
-
-+ val = rsnd_get_dalign(mod, io);
-+
-+ rsnd_mod_write(mod, SRC_BUSIF_DALIGN, val);
-+
- /*
- * WORKAROUND
- *
---
-2.6.2
-
diff --git a/patches.renesas/0298-ASoC-rsnd-show-debug-message-for-SSI-SRC-DVC-connect.patch b/patches.renesas/0298-ASoC-rsnd-show-debug-message-for-SSI-SRC-DVC-connect.patch
deleted file mode 100644
index db3996cfc013eb..00000000000000
--- a/patches.renesas/0298-ASoC-rsnd-show-debug-message-for-SSI-SRC-DVC-connect.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 51f78d3b9110f678c0cb08c550758849dd357edb Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:15:10 +0000
-Subject: [PATCH 298/326] ASoC: rsnd: show debug message for SSI/SRC/DVC
- connection
-
-It can help for connection debug
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 84e95355602c59865be8a3bd18cd2f0b3863b4cb)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 0f9323f2c049..8919afabe48f 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -332,11 +332,18 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
- static int rsnd_dai_connect(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io)
- {
-+ struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-+ struct device *dev = rsnd_priv_to_dev(priv);
-+
- if (!mod)
- return -EIO;
-
- io->mod[mod->type] = mod;
-
-+ dev_dbg(dev, "%s[%d] is connected to io (%s)\n",
-+ rsnd_mod_name(mod), rsnd_mod_id(mod),
-+ rsnd_io_is_play(io) ? "Playback" : "Capture");
-+
- return 0;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0299-ASoC-rsnd-tidyup-rsnd_dma_ops-definition-place.patch b/patches.renesas/0299-ASoC-rsnd-tidyup-rsnd_dma_ops-definition-place.patch
deleted file mode 100644
index 558abba34a7b0f..00000000000000
--- a/patches.renesas/0299-ASoC-rsnd-tidyup-rsnd_dma_ops-definition-place.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 56c93fb6527be379fa747678bca4936353ad5adc Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:15:27 +0000
-Subject: [PATCH 299/326] ASoC: rsnd: tidyup rsnd_dma_ops definition place
-
-rsnd_dma_ops is used only from dma.c, rsnd.h doesn't need it.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 98d358af07aa6fc4cd6cdfd3256ab792eb3675cd)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dma.c | 8 ++++++++
- sound/soc/sh/rcar/rsnd.h | 7 -------
- 2 files changed, 8 insertions(+), 7 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index d306e298c63d..943106136d99 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -27,6 +27,14 @@ struct rsnd_dma_ctrl {
- int dmapp_num;
- };
-
-+struct rsnd_dma_ops {
-+ void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-+ void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-+ int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
-+ struct rsnd_mod *mod_from, struct rsnd_mod *mod_to);
-+ void (*quit)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-+};
-+
- #define rsnd_priv_to_dmac(p) ((struct rsnd_dma_ctrl *)(p)->dma)
-
- /*
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 6c10a8b9210e..705e66f66ab8 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -181,13 +181,6 @@ void rsnd_path_parse(struct rsnd_priv *priv,
- * R-Car DMA
- */
- struct rsnd_dma;
--struct rsnd_dma_ops {
-- void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-- void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
-- int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
-- struct rsnd_mod *mod_from, struct rsnd_mod *mod_to);
-- void (*quit)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
--};
-
- struct rsnd_dmaen {
- struct dma_chan *chan;
---
-2.6.2
-
diff --git a/patches.renesas/0300-ASoC-rsnd-check-the-Gen1-at-the-beginning-of-DVC-pro.patch b/patches.renesas/0300-ASoC-rsnd-check-the-Gen1-at-the-beginning-of-DVC-pro.patch
deleted file mode 100644
index 7fa06e7990186d..00000000000000
--- a/patches.renesas/0300-ASoC-rsnd-check-the-Gen1-at-the-beginning-of-DVC-pro.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 4355c6b82f1ecaf653080b0c656fe8976bdd508d Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:15:47 +0000
-Subject: [PATCH 300/326] ASoC: rsnd: check the Gen1 at the beginning of DVC
- probe
-
-DVC doesn't support Gen1, check it beginning of probe
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 9469b8b6092d347ef8a5fa9d2d7dde4c857a0994)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dvc.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
-index d06e4ee91f8d..57796387d482 100644
---- a/sound/soc/sh/rcar/dvc.c
-+++ b/sound/soc/sh/rcar/dvc.c
-@@ -332,18 +332,18 @@ int rsnd_dvc_probe(struct platform_device *pdev,
- char name[RSND_DVC_NAME_SIZE];
- int i, nr, ret;
-
-- rsnd_of_parse_dvc(pdev, of_data, priv);
--
-- nr = info->dvc_info_nr;
-- if (!nr)
-- return 0;
--
- /* This driver doesn't support Gen1 at this point */
- if (rsnd_is_gen1(priv)) {
- dev_warn(dev, "CMD is not supported on Gen1\n");
- return -EINVAL;
- }
-
-+ rsnd_of_parse_dvc(pdev, of_data, priv);
-+
-+ nr = info->dvc_info_nr;
-+ if (!nr)
-+ return 0;
-+
- dvc = devm_kzalloc(dev, sizeof(*dvc) * nr, GFP_KERNEL);
- if (!dvc)
- return -ENOMEM;
---
-2.6.2
-
diff --git a/patches.renesas/0301-ASoC-rsnd-dma-add-DMA-name-on-.ops.patch b/patches.renesas/0301-ASoC-rsnd-dma-add-DMA-name-on-.ops.patch
deleted file mode 100644
index 2d5dfe2e7af969..00000000000000
--- a/patches.renesas/0301-ASoC-rsnd-dma-add-DMA-name-on-.ops.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 2acccd224bbb28a8b136d8ea4c96334e3f6052d5 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:16:03 +0000
-Subject: [PATCH 301/326] ASoC: rsnd: dma: add DMA name on .ops
-
-Current rsnd driver is using Audio DMAC (via DMAEngine) and
-Audio DMAC peri peri (via original method), and usage of these DMAC
-are different. Indicates its naming is useful for debugging.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit ddea1b2e83c379840aa54fadc587e418cf986ccb)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dma.c | 12 +++++++++++-
- 1 file changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index 943106136d99..a175863d239c 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -28,6 +28,7 @@ struct rsnd_dma_ctrl {
- };
-
- struct rsnd_dma_ops {
-+ char *name;
- void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
- void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
- int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
-@@ -190,7 +191,8 @@ static int rsnd_dmaen_init(struct rsnd_dai_stream *io,
- cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
- cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
-
-- dev_dbg(dev, "dma : %pad -> %pad\n",
-+ dev_dbg(dev, "%s %pad -> %pad\n",
-+ dma->ops->name,
- &cfg.src_addr, &cfg.dst_addr);
-
- ret = dmaengine_slave_config(dmaen->chan, &cfg);
-@@ -223,6 +225,7 @@ static void rsnd_dmaen_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
- }
-
- static struct rsnd_dma_ops rsnd_dmaen_ops = {
-+ .name = "audmac",
- .start = rsnd_dmaen_start,
- .stop = rsnd_dmaen_stop,
- .init = rsnd_dmaen_init,
-@@ -368,6 +371,7 @@ static int rsnd_dmapp_init(struct rsnd_dai_stream *io,
- }
-
- static struct rsnd_dma_ops rsnd_dmapp_ops = {
-+ .name = "audmac-pp",
- .start = rsnd_dmapp_start,
- .stop = rsnd_dmapp_stop,
- .init = rsnd_dmapp_init,
-@@ -580,6 +584,7 @@ int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
- struct rsnd_mod *mod_to;
- struct rsnd_priv *priv = rsnd_io_to_priv(io);
- struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
-+ struct device *dev = rsnd_priv_to_dev(priv);
- int is_play = rsnd_io_is_play(io);
-
- /*
-@@ -606,6 +611,11 @@ int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
- if (rsnd_is_gen1(priv))
- dma->ops = &rsnd_dmaen_ops;
-
-+ dev_dbg(dev, "%s %s[%d] -> %s[%d]\n",
-+ dma->ops->name,
-+ rsnd_mod_name(mod_from), rsnd_mod_id(mod_from),
-+ rsnd_mod_name(mod_to), rsnd_mod_id(mod_to));
-+
- return dma->ops->init(io, dma, id, mod_from, mod_to);
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0302-ASoC-rsnd-add-rsnd_io_to_mod.patch b/patches.renesas/0302-ASoC-rsnd-add-rsnd_io_to_mod.patch
deleted file mode 100644
index 9e2c35ac9991ec..00000000000000
--- a/patches.renesas/0302-ASoC-rsnd-add-rsnd_io_to_mod.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From f6a50d0ff3a6c5aa9cb7bef8d9a3899e1adfaca9 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:16:19 +0000
-Subject: [PATCH 302/326] ASoC: rsnd: add rsnd_io_to_mod()
-
-Sometimes we would like to get each module directly, especially data path
-searching. this patch adds rsnd_io_to_mod() macro, and existing
-rsnd_io_to_mod_xxx() use it.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 5cbbadd3d507eeb7711266e3932f4c427cbcbd61)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/rsnd.h | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 705e66f66ab8..5f5b8b1118b2 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -348,9 +348,10 @@ struct rsnd_dai_stream {
- int byte_per_period;
- int next_period_byte;
- };
--#define rsnd_io_to_mod_ssi(io) ((io)->mod[RSND_MOD_SSI])
--#define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC])
--#define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC])
-+#define rsnd_io_to_mod(io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
-+#define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI)
-+#define rsnd_io_to_mod_src(io) rsnd_io_to_mod((io), RSND_MOD_SRC)
-+#define rsnd_io_to_mod_dvc(io) rsnd_io_to_mod((io), RSND_MOD_DVC)
- #define rsnd_io_to_rdai(io) ((io)->rdai)
- #define rsnd_io_to_priv(io) (rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
- #define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io)
---
-2.6.2
-
diff --git a/patches.renesas/0303-ASoC-rsnd-tidyup-SRC-position-on-each-code.patch b/patches.renesas/0303-ASoC-rsnd-tidyup-SRC-position-on-each-code.patch
deleted file mode 100644
index 2207e1b1d1f037..00000000000000
--- a/patches.renesas/0303-ASoC-rsnd-tidyup-SRC-position-on-each-code.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-From c5e57c13b158c62aa7ed172f8ef43482cf75e216 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:16:37 +0000
-Subject: [PATCH 303/326] ASoC: rsnd: tidyup SRC position on each code
-
-This is cleanup for CTU/MIX support
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 78edead4494219640d9fdf37d76beae24f79de9e)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/Makefile | 2 +-
- sound/soc/sh/rcar/core.c | 8 ++++----
- sound/soc/sh/rcar/rsnd.h | 38 +++++++++++++++++++-------------------
- 3 files changed, 24 insertions(+), 24 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
-index f1b445173fba..3a274fd3593c 100644
---- a/sound/soc/sh/rcar/Makefile
-+++ b/sound/soc/sh/rcar/Makefile
-@@ -1,4 +1,4 @@
--snd-soc-rcar-objs := core.o gen.o dma.o src.o adg.o ssi.o dvc.o
-+snd-soc-rcar-objs := core.o gen.o dma.o adg.o ssi.o src.o dvc.o
- obj-$(CONFIG_SND_SOC_RCAR) += snd-soc-rcar.o
-
- snd-soc-rsrc-card-objs := rsrc-card.o
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 8919afabe48f..e20d8ea0aafe 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -641,13 +641,13 @@ static int rsnd_path_init(struct rsnd_priv *priv,
- * using fixed path.
- */
-
-- /* SRC */
-- ret = rsnd_path_add(priv, io, src);
-+ /* SSI */
-+ ret = rsnd_path_add(priv, io, ssi);
- if (ret < 0)
- return ret;
-
-- /* SSI */
-- ret = rsnd_path_add(priv, io, ssi);
-+ /* SRC */
-+ ret = rsnd_path_add(priv, io, src);
- if (ret < 0)
- return ret;
-
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 5f5b8b1118b2..7fee2079ba5a 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -441,12 +441,6 @@ struct rsnd_priv {
- void *gen;
-
- /*
-- * below value will be filled on rsnd_src_probe()
-- */
-- void *src;
-- int src_nr;
--
-- /*
- * below value will be filled on rsnd_adg_probe()
- */
- void *adg;
-@@ -463,6 +457,12 @@ struct rsnd_priv {
- int ssi_nr;
-
- /*
-+ * below value will be filled on rsnd_src_probe()
-+ */
-+ void *src;
-+ int src_nr;
-+
-+ /*
- * below value will be filled on rsnd_dvc_probe()
- */
- void *dvc;
-@@ -535,6 +535,19 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod,
- u32 max);
-
- /*
-+ * R-Car SSI
-+ */
-+int rsnd_ssi_probe(struct platform_device *pdev,
-+ const struct rsnd_of_data *of_data,
-+ struct rsnd_priv *priv);
-+void rsnd_ssi_remove(struct platform_device *pdev,
-+ struct rsnd_priv *priv);
-+struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
-+int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
-+int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
-+int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
-+
-+/*
- * R-Car SRC
- */
- int rsnd_src_probe(struct platform_device *pdev,
-@@ -555,19 +568,6 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
- int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
-
- /*
-- * R-Car SSI
-- */
--int rsnd_ssi_probe(struct platform_device *pdev,
-- const struct rsnd_of_data *of_data,
-- struct rsnd_priv *priv);
--void rsnd_ssi_remove(struct platform_device *pdev,
-- struct rsnd_priv *priv);
--struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
--int rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
--int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
--int rsnd_ssi_use_busif(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
--
--/*
- * R-Car DVC
- */
- int rsnd_dvc_probe(struct platform_device *pdev,
---
-2.6.2
-
diff --git a/patches.renesas/0304-ASoC-rsnd-update-Audio-DMA-path-search-method.patch b/patches.renesas/0304-ASoC-rsnd-update-Audio-DMA-path-search-method.patch
deleted file mode 100644
index 001c37eaf84f89..00000000000000
--- a/patches.renesas/0304-ASoC-rsnd-update-Audio-DMA-path-search-method.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-From dd7acd3130abc9664ae6bd2a00517b3b82c16c05 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:16:56 +0000
-Subject: [PATCH 304/326] ASoC: rsnd: update Audio DMA path search method
-
-Current rsnd driver is assuming Audio DMAC / Audio DMAC peri peri
-are used from SSI/SSIU/SRC/DVC. But we will add CTU/MIX to this driver.
-Then, current DMA path searching method is not understandable, and good
-enough for this purpose. This patch update DMA path search method, more
-simply.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 7dfb49194557ccf27ab99c8c04c021320e7ae458)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dma.c | 88 +++++++++++++++++++++++++++++--------------------
- 1 file changed, 53 insertions(+), 35 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index a175863d239c..23282f48f71f 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -494,7 +494,7 @@ static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream *io,
- return rsnd_gen2_dma_addr(io, mod, is_play, is_from);
- }
-
--#define MOD_MAX 4 /* MEM/SSI/SRC/DVC */
-+#define MOD_MAX (RSND_MOD_MAX + 1) /* +Memory */
- static void rsnd_dma_of_path(struct rsnd_dma *dma,
- struct rsnd_dai_stream *io,
- int is_play,
-@@ -506,53 +506,71 @@ static void rsnd_dma_of_path(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];
-- int i, index;
-+ struct rsnd_mod *mod_start, *mod_end;
-+ struct rsnd_priv *priv = rsnd_mod_to_priv(this);
-+ struct device *dev = rsnd_priv_to_dev(priv);
-+ int nr, i;
-
-+ if (!ssi)
-+ return;
-
-- for (i = 0; i < MOD_MAX; i++)
-+ nr = 0;
-+ for (i = 0; i < MOD_MAX; i++) {
- mod[i] = NULL;
-+ nr += !!rsnd_io_to_mod(io, i);
-+ }
-
- /*
-- * in play case...
-+ * [S] -*-> [E]
-+ * [S] -*-> SRC -o-> [E]
-+ * [S] -*-> SRC -> DVC -o-> [E]
-+ * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E]
-+ *
-+ * playback [S] = mem
-+ * [E] = SSI
- *
-- * src -> dst
-+ * capture [S] = SSI
-+ * [E] = mem
- *
-- * mem -> SSI
-- * mem -> SRC -> SSI
-- * mem -> SRC -> DVC -> SSI
-+ * -*-> Audio DMAC
-+ * -o-> Audio DMAC peri peri
- */
-- mod[0] = NULL; /* for "mem" */
-- index = 1;
-- for (i = 1; i < MOD_MAX; i++) {
-- if (!src) {
-- mod[i] = ssi;
-- } else if (!dvc) {
-- mod[i] = src;
-- src = NULL;
-- } else {
-- if ((!is_play) && (this == src))
-- this = dvc;
-+ mod_start = (is_play) ? NULL : ssi;
-+ mod_end = (is_play) ? ssi : NULL;
-
-- mod[i] = (is_play) ? src : dvc;
-- i++;
-- mod[i] = (is_play) ? dvc : src;
-+ mod[0] = mod_start;
-+ for (i = 1; i < nr; i++) {
-+ if (src) {
-+ mod[i] = src;
- src = NULL;
-+ } else if (dvc) {
-+ mod[i] = dvc;
- dvc = NULL;
- }
--
-- if (mod[i] == this)
-- index = i;
--
-- if (mod[i] == ssi)
-- break;
- }
-+ mod[i] = mod_end;
-
-- if (is_play) {
-- *mod_from = mod[index - 1];
-- *mod_to = mod[index];
-+ /*
-+ * | SSI | SRC |
-+ * -------------+-----+-----+
-+ * is_play | o | * |
-+ * !is_play | * | o |
-+ */
-+ if ((this == ssi) == (is_play)) {
-+ *mod_from = mod[nr - 1];
-+ *mod_to = mod[nr];
- } else {
-- *mod_from = mod[index];
-- *mod_to = mod[index - 1];
-+ *mod_from = mod[0];
-+ *mod_to = mod[1];
-+ }
-+
-+ dev_dbg(dev, "module connection (this is %s[%d])\n",
-+ rsnd_mod_name(this), rsnd_mod_id(this));
-+ for (i = 0; i <= nr; i++) {
-+ dev_dbg(dev, " %s[%d]%s\n",
-+ rsnd_mod_name(mod[i]), rsnd_mod_id(mod[i]),
-+ (mod[i] == *mod_from) ? " from" :
-+ (mod[i] == *mod_to) ? " to" : "");
- }
- }
-
-@@ -580,8 +598,8 @@ void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
-
- int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
- {
-- struct rsnd_mod *mod_from;
-- struct rsnd_mod *mod_to;
-+ struct rsnd_mod *mod_from = NULL;
-+ struct rsnd_mod *mod_to = NULL;
- struct rsnd_priv *priv = rsnd_io_to_priv(io);
- struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
- struct device *dev = rsnd_priv_to_dev(priv);
---
-2.6.2
-
diff --git a/patches.renesas/0305-ASoC-rsnd-add-CTU-Channel-Transfer-Unit-prototype-su.patch b/patches.renesas/0305-ASoC-rsnd-add-CTU-Channel-Transfer-Unit-prototype-su.patch
deleted file mode 100644
index be3327220b71b4..00000000000000
--- a/patches.renesas/0305-ASoC-rsnd-add-CTU-Channel-Transfer-Unit-prototype-su.patch
+++ /dev/null
@@ -1,474 +0,0 @@
-From 0aad802f0729d249b1b54b23aa2ccde06dbedd7d Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:17:17 +0000
-Subject: [PATCH 305/326] ASoC: rsnd: add CTU (Channel Transfer Unit) prototype
- support
-
-This patch adds CTU (Channel Transfer Unit) support for rsnd driver.
-But, it does nothing to data at this point, but is required for MIX
-support.
-
-CTU design is a little different from other IPs (CTU0 is including
-CTU00 - CTU03, and CTU1 is including CTU10 - CTU13, these have different
-register mapping) We need to care about it on this driver.
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 9269e3c3cfac277a49b485e27ac6850f9a11a259)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../devicetree/bindings/sound/renesas,rsnd.txt | 14 ++
- include/sound/rcar_snd.h | 7 +
- sound/soc/sh/rcar/Makefile | 2 +-
- sound/soc/sh/rcar/core.c | 12 +-
- sound/soc/sh/rcar/ctu.c | 171 +++++++++++++++++++++
- sound/soc/sh/rcar/dma.c | 13 +-
- sound/soc/sh/rcar/gen.c | 2 +
- sound/soc/sh/rcar/rsnd.h | 21 +++
- 8 files changed, 236 insertions(+), 6 deletions(-)
- create mode 100644 sound/soc/sh/rcar/ctu.c
-
-diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-index b6b3a786855f..278607de05de 100644
---- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-@@ -18,6 +18,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,ctu : Should contain CTU feature.
-+ The number of CTU 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.
-@@ -90,6 +93,17 @@ rcar_sound: sound@ec500000 {
- };
- };
-
-+ rcar_sound,ctu {
-+ ctu00: ctu@0 { };
-+ ctu01: ctu@1 { };
-+ ctu02: ctu@2 { };
-+ ctu03: ctu@3 { };
-+ ctu10: ctu@4 { };
-+ ctu11: ctu@5 { };
-+ ctu12: ctu@6 { };
-+ ctu13: ctu@7 { };
-+ };
-+
- rcar_sound,src {
- src0: src@0 {
- interrupts = <0 352 IRQ_TYPE_LEVEL_HIGH>;
-diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
-index 4cecd0c175f6..8f9303093ab9 100644
---- a/include/sound/rcar_snd.h
-+++ b/include/sound/rcar_snd.h
-@@ -61,6 +61,10 @@ struct rsnd_src_platform_info {
- /*
- * flags
- */
-+struct rsnd_ctu_platform_info {
-+ u32 flags;
-+};
-+
- struct rsnd_dvc_platform_info {
- u32 flags;
- };
-@@ -68,6 +72,7 @@ struct rsnd_dvc_platform_info {
- struct rsnd_dai_path_info {
- struct rsnd_ssi_platform_info *ssi;
- struct rsnd_src_platform_info *src;
-+ struct rsnd_ctu_platform_info *ctu;
- struct rsnd_dvc_platform_info *dvc;
- };
-
-@@ -93,6 +98,8 @@ struct rcar_snd_info {
- int ssi_info_nr;
- struct rsnd_src_platform_info *src_info;
- int src_info_nr;
-+ struct rsnd_ctu_platform_info *ctu_info;
-+ int ctu_info_nr;
- struct rsnd_dvc_platform_info *dvc_info;
- int dvc_info_nr;
- struct rsnd_dai_platform_info *dai_info;
-diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
-index 3a274fd3593c..7c4730a81c4a 100644
---- a/sound/soc/sh/rcar/Makefile
-+++ b/sound/soc/sh/rcar/Makefile
-@@ -1,4 +1,4 @@
--snd-soc-rcar-objs := core.o gen.o dma.o adg.o ssi.o src.o dvc.o
-+snd-soc-rcar-objs := core.o gen.o dma.o adg.o ssi.o src.o ctu.o dvc.o
- obj-$(CONFIG_SND_SOC_RCAR) += snd-soc-rcar.o
-
- snd-soc-rsrc-card-objs := rsrc-card.o
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index e20d8ea0aafe..63ae7bbfd1dc 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -651,6 +651,11 @@ static int rsnd_path_init(struct rsnd_priv *priv,
- if (ret < 0)
- return ret;
-
-+ /* CTU */
-+ ret = rsnd_path_add(priv, io, ctu);
-+ if (ret < 0)
-+ return ret;
-+
- /* DVC */
- ret = rsnd_path_add(priv, io, dvc);
- if (ret < 0)
-@@ -666,13 +671,14 @@ 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 *ctu_node, *ctu_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, dvc_i;
-+ int dai_i, ssi_i, src_i, ctu_i, dvc_i;
-
- if (!of_data)
- return;
-@@ -698,6 +704,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");
-+ ctu_node = of_get_child_by_name(dev->of_node, "rcar_sound,ctu");
- dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
-
- #define mod_parse(name) \
-@@ -734,6 +741,7 @@ if (name##_node) { \
-
- mod_parse(ssi);
- mod_parse(src);
-+ mod_parse(ctu);
- mod_parse(dvc);
-
- of_node_put(playback);
-@@ -1146,6 +1154,7 @@ static int rsnd_probe(struct platform_device *pdev)
- rsnd_dma_probe,
- rsnd_ssi_probe,
- rsnd_src_probe,
-+ rsnd_ctu_probe,
- rsnd_dvc_probe,
- rsnd_adg_probe,
- rsnd_dai_probe,
-@@ -1241,6 +1250,7 @@ static int rsnd_remove(struct platform_device *pdev)
- struct rsnd_priv *priv) = {
- rsnd_ssi_remove,
- rsnd_src_remove,
-+ rsnd_ctu_remove,
- rsnd_dvc_remove,
- };
- int ret = 0, i;
-diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c
-new file mode 100644
-index 000000000000..05edd2009b81
---- /dev/null
-+++ b/sound/soc/sh/rcar/ctu.c
-@@ -0,0 +1,171 @@
-+/*
-+ * ctu.c
-+ *
-+ * Copyright (c) 2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-+ *
-+ * 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 "rsnd.h"
-+
-+#define CTU_NAME_SIZE 16
-+#define CTU_NAME "ctu"
-+
-+struct rsnd_ctu {
-+ struct rsnd_ctu_platform_info *info; /* rcar_snd.h */
-+ struct rsnd_mod mod;
-+};
-+
-+#define rsnd_ctu_nr(priv) ((priv)->ctu_nr)
-+#define for_each_rsnd_ctu(pos, priv, i) \
-+ for ((i) = 0; \
-+ ((i) < rsnd_ctu_nr(priv)) && \
-+ ((pos) = (struct rsnd_ctu *)(priv)->ctu + i); \
-+ i++)
-+
-+#define rsnd_ctu_initialize_lock(mod) __rsnd_ctu_initialize_lock(mod, 1)
-+#define rsnd_ctu_initialize_unlock(mod) __rsnd_ctu_initialize_lock(mod, 0)
-+static void __rsnd_ctu_initialize_lock(struct rsnd_mod *mod, u32 enable)
-+{
-+ rsnd_mod_write(mod, CTU_CTUIR, enable);
-+}
-+
-+static int rsnd_ctu_init(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
-+ struct rsnd_priv *priv)
-+{
-+ rsnd_mod_hw_start(mod);
-+
-+ rsnd_ctu_initialize_lock(mod);
-+
-+ rsnd_mod_write(mod, CTU_ADINR, rsnd_get_adinr_chan(mod, io));
-+
-+ rsnd_ctu_initialize_unlock(mod);
-+
-+ return 0;
-+}
-+
-+static int rsnd_ctu_quit(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
-+ struct rsnd_priv *priv)
-+{
-+ rsnd_mod_hw_stop(mod);
-+
-+ return 0;
-+}
-+
-+static struct rsnd_mod_ops rsnd_ctu_ops = {
-+ .name = CTU_NAME,
-+ .init = rsnd_ctu_init,
-+ .quit = rsnd_ctu_quit,
-+};
-+
-+struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id)
-+{
-+ if (WARN_ON(id < 0 || id >= rsnd_ctu_nr(priv)))
-+ id = 0;
-+
-+ return &((struct rsnd_ctu *)(priv->ctu) + id)->mod;
-+}
-+
-+void rsnd_of_parse_ctu(struct platform_device *pdev,
-+ const struct rsnd_of_data *of_data,
-+ struct rsnd_priv *priv)
-+{
-+ struct device_node *node;
-+ struct rsnd_ctu_platform_info *ctu_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,ctu");
-+ if (!node)
-+ return;
-+
-+ nr = of_get_child_count(node);
-+ if (!nr)
-+ goto rsnd_of_parse_ctu_end;
-+
-+ ctu_info = devm_kzalloc(dev,
-+ sizeof(struct rsnd_ctu_platform_info) * nr,
-+ GFP_KERNEL);
-+ if (!ctu_info) {
-+ dev_err(dev, "ctu info allocation error\n");
-+ goto rsnd_of_parse_ctu_end;
-+ }
-+
-+ info->ctu_info = ctu_info;
-+ info->ctu_info_nr = nr;
-+
-+rsnd_of_parse_ctu_end:
-+ of_node_put(node);
-+
-+}
-+
-+int rsnd_ctu_probe(struct platform_device *pdev,
-+ const struct rsnd_of_data *of_data,
-+ struct rsnd_priv *priv)
-+{
-+ struct rcar_snd_info *info = rsnd_priv_to_info(priv);
-+ struct device *dev = rsnd_priv_to_dev(priv);
-+ struct rsnd_ctu *ctu;
-+ struct clk *clk;
-+ char name[CTU_NAME_SIZE];
-+ int i, nr, ret;
-+
-+ /* This driver doesn't support Gen1 at this point */
-+ if (rsnd_is_gen1(priv)) {
-+ dev_warn(dev, "CTU is not supported on Gen1\n");
-+ return -EINVAL;
-+ }
-+
-+ rsnd_of_parse_ctu(pdev, of_data, priv);
-+
-+ nr = info->ctu_info_nr;
-+ if (!nr)
-+ return 0;
-+
-+ ctu = devm_kzalloc(dev, sizeof(*ctu) * nr, GFP_KERNEL);
-+ if (!ctu)
-+ return -ENOMEM;
-+
-+ priv->ctu_nr = nr;
-+ priv->ctu = ctu;
-+
-+ for_each_rsnd_ctu(ctu, priv, i) {
-+ /*
-+ * CTU00, CTU01, CTU02, CTU03 => CTU0
-+ * CTU10, CTU11, CTU12, CTU13 => CTU1
-+ */
-+ snprintf(name, CTU_NAME_SIZE, "%s.%d",
-+ CTU_NAME, i / 4);
-+
-+ clk = devm_clk_get(dev, name);
-+ if (IS_ERR(clk))
-+ return PTR_ERR(clk);
-+
-+ ctu->info = &info->ctu_info[i];
-+
-+ ret = rsnd_mod_init(priv, &ctu->mod, &rsnd_ctu_ops,
-+ clk, RSND_MOD_CTU, i);
-+ if (ret)
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
-+void rsnd_ctu_remove(struct platform_device *pdev,
-+ struct rsnd_priv *priv)
-+{
-+ struct rsnd_ctu *ctu;
-+ int i;
-+
-+ for_each_rsnd_ctu(ctu, priv, i) {
-+ rsnd_mod_quit(&ctu->mod);
-+ }
-+}
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index 23282f48f71f..229b68d2cf70 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -426,7 +426,8 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
- phys_addr_t src_reg = rsnd_gen_get_phy_addr(priv, RSND_GEN2_SCU);
- int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
- int use_src = !!rsnd_io_to_mod_src(io);
-- int use_dvc = !!rsnd_io_to_mod_dvc(io);
-+ int use_cmd = !!rsnd_io_to_mod_dvc(io) ||
-+ !!rsnd_io_to_mod_ctu(io);
- int id = rsnd_mod_id(mod);
- struct dma_addr {
- dma_addr_t out_addr;
-@@ -464,7 +465,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
- };
-
- /* it shouldn't happen */
-- if (use_dvc && !use_src)
-+ if (use_cmd && !use_src)
- dev_err(dev, "DVC is selected without SRC\n");
-
- /* use SSIU or SSI ? */
-@@ -472,8 +473,8 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
- is_ssi++;
-
- 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;
-+ dma_addrs[is_ssi][is_play][use_src + use_cmd].out_addr :
-+ dma_addrs[is_ssi][is_play][use_src + use_cmd].in_addr;
- }
-
- static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream *io,
-@@ -504,6 +505,7 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
- struct rsnd_mod *this = rsnd_dma_to_mod(dma);
- struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
- struct rsnd_mod *src = rsnd_io_to_mod_src(io);
-+ struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io);
- struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
- struct rsnd_mod *mod[MOD_MAX];
- struct rsnd_mod *mod_start, *mod_end;
-@@ -543,6 +545,9 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
- if (src) {
- mod[i] = src;
- src = NULL;
-+ } else if (ctu) {
-+ mod[i] = ctu;
-+ ctu = NULL;
- } else if (dvc) {
- mod[i] = dvc;
- dvc = NULL;
-diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
-index a2d5df4d5d17..41b75cd4e09b 100644
---- a/sound/soc/sh/rcar/gen.c
-+++ b/sound/soc/sh/rcar/gen.c
-@@ -240,6 +240,8 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
- 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(CTU_CTUIR, 0x504, 0x100),
-+ RSND_GEN_M_REG(CTU_ADINR, 0x508, 0x100),
- RSND_GEN_M_REG(DVC_SWRSR, 0xe00, 0x100),
- RSND_GEN_M_REG(DVC_DVUIR, 0xe04, 0x100),
- RSND_GEN_M_REG(DVC_ADINR, 0xe08, 0x100),
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index 7fee2079ba5a..f2128a7cf259 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -47,6 +47,8 @@ enum rsnd_reg {
- RSND_REG_SCU_SYS_STATUS0,
- RSND_REG_SCU_SYS_INT_EN0,
- RSND_REG_CMD_ROUTE_SLCT,
-+ RSND_REG_CTU_CTUIR,
-+ RSND_REG_CTU_ADINR,
- RSND_REG_DVC_SWRSR,
- RSND_REG_DVC_DVUIR,
- RSND_REG_DVC_ADINR,
-@@ -220,6 +222,7 @@ struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
- */
- enum rsnd_mod_type {
- RSND_MOD_DVC = 0,
-+ RSND_MOD_CTU,
- RSND_MOD_SRC,
- RSND_MOD_SSI,
- RSND_MOD_MAX,
-@@ -351,6 +354,7 @@ struct rsnd_dai_stream {
- #define rsnd_io_to_mod(io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
- #define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI)
- #define rsnd_io_to_mod_src(io) rsnd_io_to_mod((io), RSND_MOD_SRC)
-+#define rsnd_io_to_mod_ctu(io) rsnd_io_to_mod((io), RSND_MOD_CTU)
- #define rsnd_io_to_mod_dvc(io) rsnd_io_to_mod((io), RSND_MOD_DVC)
- #define rsnd_io_to_rdai(io) ((io)->rdai)
- #define rsnd_io_to_priv(io) (rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
-@@ -463,6 +467,12 @@ struct rsnd_priv {
- int src_nr;
-
- /*
-+ * below value will be filled on rsnd_ctu_probe()
-+ */
-+ void *ctu;
-+ int ctu_nr;
-+
-+ /*
- * below value will be filled on rsnd_dvc_probe()
- */
- void *dvc;
-@@ -568,6 +578,17 @@ int rsnd_src_ssi_irq_enable(struct rsnd_mod *ssi_mod);
- int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod);
-
- /*
-+ * R-Car CTU
-+ */
-+int rsnd_ctu_probe(struct platform_device *pdev,
-+ const struct rsnd_of_data *of_data,
-+ struct rsnd_priv *priv);
-+
-+void rsnd_ctu_remove(struct platform_device *pdev,
-+ struct rsnd_priv *priv);
-+struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
-+
-+/*
- * R-Car DVC
- */
- int rsnd_dvc_probe(struct platform_device *pdev,
---
-2.6.2
-
diff --git a/patches.renesas/0306-ASoC-rsnd-add-MIX-Mixer-support.patch b/patches.renesas/0306-ASoC-rsnd-add-MIX-Mixer-support.patch
deleted file mode 100644
index 595bca2be5696f..00000000000000
--- a/patches.renesas/0306-ASoC-rsnd-add-MIX-Mixer-support.patch
+++ /dev/null
@@ -1,611 +0,0 @@
-From 91949d91db62cb7b7ce9704d37c4b24453d5afc5 Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Wed, 15 Jul 2015 07:17:36 +0000
-Subject: [PATCH 306/326] ASoC: rsnd: add MIX (Mixer) support
-
-This patch adds MIX (Mixer) initial support for rsnd driver.
-It is assuming that this MIX is used via DPCM.
-
-This is sample code for playback.
-
- CPU0 : [MEM] -> [SRC1] -> [CTU02] -+
- |
- +-> [MIX0] -> [DVC0] -> [SSI0]
- |
- CPU1 : [MEM] -> [SRC2] -> [CTU03] -+
-
- sound {
- compatible = "renesas,rsrc-card";
-
- ...
-
- cpu@0 {
- sound-dai = <&rcar_sound 0>;
- };
-
- cpu@1 {
- sound-dai = <&rcar_sound 1>;
- };
-
- codec {
- ...
- };
- };
-
- rcar_sound {
-
- ...
-
- rcar_sound,dai {
- dai0 {
- playback = <&src1 &ctu02 &mix0 &dvc0 &ssi0>;
- };
- dai1 {
- playback = <&src2 &ctu03 &mix0 &dvc0 &ssi0>;
- };
- };
- };
-
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 70fb10529f61c31c26397a02091177bedd23217d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- .../devicetree/bindings/sound/renesas,rsnd.txt | 8 +
- include/sound/rcar_snd.h | 7 +
- sound/soc/sh/rcar/Makefile | 2 +-
- sound/soc/sh/rcar/core.c | 85 +++++++--
- sound/soc/sh/rcar/dma.c | 5 +
- sound/soc/sh/rcar/gen.c | 10 ++
- sound/soc/sh/rcar/mix.c | 200 +++++++++++++++++++++
- sound/soc/sh/rcar/rsnd.h | 29 +++
- 8 files changed, 333 insertions(+), 13 deletions(-)
- create mode 100644 sound/soc/sh/rcar/mix.c
-
-diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-index 278607de05de..1173395b5e5c 100644
---- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
-@@ -21,6 +21,9 @@ Required properties:
- - rcar_sound,ctu : Should contain CTU feature.
- The number of CTU subnode should be same as HW.
- see below for detail.
-+- rcar_sound,mix : Should contain MIX feature.
-+ The number of MIX 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.
-@@ -93,6 +96,11 @@ rcar_sound: sound@ec500000 {
- };
- };
-
-+ rcar_sound,mix {
-+ mix0: mix@0 { };
-+ mix1: mix@1 { };
-+ };
-+
- rcar_sound,ctu {
- ctu00: ctu@0 { };
- ctu01: ctu@1 { };
-diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
-index 8f9303093ab9..bb7b2ebfee7b 100644
---- a/include/sound/rcar_snd.h
-+++ b/include/sound/rcar_snd.h
-@@ -65,6 +65,10 @@ struct rsnd_ctu_platform_info {
- u32 flags;
- };
-
-+struct rsnd_mix_platform_info {
-+ u32 flags;
-+};
-+
- struct rsnd_dvc_platform_info {
- u32 flags;
- };
-@@ -73,6 +77,7 @@ struct rsnd_dai_path_info {
- struct rsnd_ssi_platform_info *ssi;
- struct rsnd_src_platform_info *src;
- struct rsnd_ctu_platform_info *ctu;
-+ struct rsnd_mix_platform_info *mix;
- struct rsnd_dvc_platform_info *dvc;
- };
-
-@@ -100,6 +105,8 @@ struct rcar_snd_info {
- int src_info_nr;
- struct rsnd_ctu_platform_info *ctu_info;
- int ctu_info_nr;
-+ struct rsnd_mix_platform_info *mix_info;
-+ int mix_info_nr;
- struct rsnd_dvc_platform_info *dvc_info;
- int dvc_info_nr;
- struct rsnd_dai_platform_info *dai_info;
-diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
-index 7c4730a81c4a..8b258501aa35 100644
---- a/sound/soc/sh/rcar/Makefile
-+++ b/sound/soc/sh/rcar/Makefile
-@@ -1,4 +1,4 @@
--snd-soc-rcar-objs := core.o gen.o dma.o adg.o ssi.o src.o ctu.o dvc.o
-+snd-soc-rcar-objs := core.o gen.o dma.o adg.o ssi.o src.o ctu.o mix.o dvc.o
- obj-$(CONFIG_SND_SOC_RCAR) += snd-soc-rcar.o
-
- snd-soc-rsrc-card-objs := rsrc-card.o
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 63ae7bbfd1dc..927a7b02123b 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -605,23 +605,74 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
- void rsnd_path_parse(struct rsnd_priv *priv,
- struct rsnd_dai_stream *io)
- {
-- struct rsnd_mod *src = rsnd_io_to_mod_src(io);
- struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
-- int src_id = rsnd_mod_id(src);
-- u32 path[] = {
-- [0] = 0x30000,
-- [1] = 0x30001,
-- [2] = 0x40000,
-- [3] = 0x10000,
-- [4] = 0x20000,
-- [5] = 0x40100
-- };
-+ struct rsnd_mod *mix = rsnd_io_to_mod_mix(io);
-+ struct rsnd_mod *src = rsnd_io_to_mod_src(io);
-+ struct rsnd_mod *cmd;
-+ struct device *dev = rsnd_priv_to_dev(priv);
-+ u32 data;
-
- /* Gen1 is not supported */
- if (rsnd_is_gen1(priv))
- return;
-
-- rsnd_mod_write(dvc, CMD_ROUTE_SLCT, path[src_id]);
-+ if (!mix && !dvc)
-+ return;
-+
-+ if (mix) {
-+ struct rsnd_dai *rdai;
-+ int i;
-+ u32 path[] = {
-+ [0] = 0,
-+ [1] = 1 << 0,
-+ [2] = 0,
-+ [3] = 0,
-+ [4] = 0,
-+ [5] = 1 << 8
-+ };
-+
-+ /*
-+ * it is assuming that integrater is well understanding about
-+ * data path. Here doesn't check impossible connection,
-+ * like src2 + src5
-+ */
-+ data = 0;
-+ for_each_rsnd_dai(rdai, priv, i) {
-+ io = &rdai->playback;
-+ if (mix == rsnd_io_to_mod_mix(io))
-+ data |= path[rsnd_mod_id(src)];
-+
-+ io = &rdai->capture;
-+ if (mix == rsnd_io_to_mod_mix(io))
-+ data |= path[rsnd_mod_id(src)];
-+ }
-+
-+ /*
-+ * We can't use ctu = rsnd_io_ctu() here.
-+ * Since, ID of dvc/mix are 0 or 1 (= same as CMD number)
-+ * but ctu IDs are 0 - 7 (= CTU00 - CTU13)
-+ */
-+ cmd = mix;
-+ } else {
-+ u32 path[] = {
-+ [0] = 0x30000,
-+ [1] = 0x30001,
-+ [2] = 0x40000,
-+ [3] = 0x10000,
-+ [4] = 0x20000,
-+ [5] = 0x40100
-+ };
-+
-+ data = path[rsnd_mod_id(src)];
-+
-+ cmd = dvc;
-+ }
-+
-+ dev_dbg(dev, "ctu/mix path = 0x%08x", data);
-+
-+ rsnd_mod_write(cmd, CMD_ROUTE_SLCT, data);
-+
-+ rsnd_mod_write(cmd, CMD_CTRL, 0x10);
- }
-
- static int rsnd_path_init(struct rsnd_priv *priv,
-@@ -656,6 +707,11 @@ static int rsnd_path_init(struct rsnd_priv *priv,
- if (ret < 0)
- return ret;
-
-+ /* MIX */
-+ ret = rsnd_path_add(priv, io, mix);
-+ if (ret < 0)
-+ return ret;
-+
- /* DVC */
- ret = rsnd_path_add(priv, io, dvc);
- if (ret < 0)
-@@ -672,13 +728,14 @@ static void rsnd_of_parse_dai(struct platform_device *pdev,
- struct device_node *ssi_node, *ssi_np;
- struct device_node *src_node, *src_np;
- struct device_node *ctu_node, *ctu_np;
-+ struct device_node *mix_node, *mix_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, ctu_i, dvc_i;
-+ int dai_i, ssi_i, src_i, ctu_i, mix_i, dvc_i;
-
- if (!of_data)
- return;
-@@ -705,6 +762,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");
- ctu_node = of_get_child_by_name(dev->of_node, "rcar_sound,ctu");
-+ mix_node = of_get_child_by_name(dev->of_node, "rcar_sound,mix");
- dvc_node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc");
-
- #define mod_parse(name) \
-@@ -742,6 +800,7 @@ if (name##_node) { \
- mod_parse(ssi);
- mod_parse(src);
- mod_parse(ctu);
-+ mod_parse(mix);
- mod_parse(dvc);
-
- of_node_put(playback);
-@@ -1155,6 +1214,7 @@ static int rsnd_probe(struct platform_device *pdev)
- rsnd_ssi_probe,
- rsnd_src_probe,
- rsnd_ctu_probe,
-+ rsnd_mix_probe,
- rsnd_dvc_probe,
- rsnd_adg_probe,
- rsnd_dai_probe,
-@@ -1251,6 +1311,7 @@ static int rsnd_remove(struct platform_device *pdev)
- rsnd_ssi_remove,
- rsnd_src_remove,
- rsnd_ctu_remove,
-+ rsnd_mix_remove,
- rsnd_dvc_remove,
- };
- int ret = 0, i;
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index 229b68d2cf70..305b12929853 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -427,6 +427,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
- int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
- int use_src = !!rsnd_io_to_mod_src(io);
- int use_cmd = !!rsnd_io_to_mod_dvc(io) ||
-+ !!rsnd_io_to_mod_mix(io) ||
- !!rsnd_io_to_mod_ctu(io);
- int id = rsnd_mod_id(mod);
- struct dma_addr {
-@@ -506,6 +507,7 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
- struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
- struct rsnd_mod *src = rsnd_io_to_mod_src(io);
- struct rsnd_mod *ctu = rsnd_io_to_mod_ctu(io);
-+ struct rsnd_mod *mix = rsnd_io_to_mod_mix(io);
- struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
- struct rsnd_mod *mod[MOD_MAX];
- struct rsnd_mod *mod_start, *mod_end;
-@@ -548,6 +550,9 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
- } else if (ctu) {
- mod[i] = ctu;
- ctu = NULL;
-+ } else if (mix) {
-+ mod[i] = mix;
-+ mix = NULL;
- } else if (dvc) {
- mod[i] = dvc;
- dvc = NULL;
-diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
-index 41b75cd4e09b..f04d17bc6e3d 100644
---- a/sound/soc/sh/rcar/gen.c
-+++ b/sound/soc/sh/rcar/gen.c
-@@ -242,6 +242,16 @@ static int rsnd_gen2_probe(struct platform_device *pdev,
- RSND_GEN_M_REG(SRC_BSISR, 0x238, 0x40),
- RSND_GEN_M_REG(CTU_CTUIR, 0x504, 0x100),
- RSND_GEN_M_REG(CTU_ADINR, 0x508, 0x100),
-+ RSND_GEN_M_REG(MIX_SWRSR, 0xd00, 0x40),
-+ RSND_GEN_M_REG(MIX_MIXIR, 0xd04, 0x40),
-+ RSND_GEN_M_REG(MIX_ADINR, 0xd08, 0x40),
-+ RSND_GEN_M_REG(MIX_MIXMR, 0xd10, 0x40),
-+ RSND_GEN_M_REG(MIX_MVPDR, 0xd14, 0x40),
-+ RSND_GEN_M_REG(MIX_MDBAR, 0xd18, 0x40),
-+ RSND_GEN_M_REG(MIX_MDBBR, 0xd1c, 0x40),
-+ RSND_GEN_M_REG(MIX_MDBCR, 0xd20, 0x40),
-+ RSND_GEN_M_REG(MIX_MDBDR, 0xd24, 0x40),
-+ RSND_GEN_M_REG(MIX_MDBER, 0xd28, 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),
-diff --git a/sound/soc/sh/rcar/mix.c b/sound/soc/sh/rcar/mix.c
-new file mode 100644
-index 000000000000..0d5c102db6f5
---- /dev/null
-+++ b/sound/soc/sh/rcar/mix.c
-@@ -0,0 +1,200 @@
-+/*
-+ * mix.c
-+ *
-+ * Copyright (c) 2015 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-+ *
-+ * 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 "rsnd.h"
-+
-+#define MIX_NAME_SIZE 16
-+#define MIX_NAME "mix"
-+
-+struct rsnd_mix {
-+ struct rsnd_mix_platform_info *info; /* rcar_snd.h */
-+ struct rsnd_mod mod;
-+};
-+
-+#define rsnd_mix_nr(priv) ((priv)->mix_nr)
-+#define for_each_rsnd_mix(pos, priv, i) \
-+ for ((i) = 0; \
-+ ((i) < rsnd_mix_nr(priv)) && \
-+ ((pos) = (struct rsnd_mix *)(priv)->mix + i); \
-+ i++)
-+
-+
-+static void rsnd_mix_soft_reset(struct rsnd_mod *mod)
-+{
-+ rsnd_mod_write(mod, MIX_SWRSR, 0);
-+ rsnd_mod_write(mod, MIX_SWRSR, 1);
-+}
-+
-+#define rsnd_mix_initialize_lock(mod) __rsnd_mix_initialize_lock(mod, 1)
-+#define rsnd_mix_initialize_unlock(mod) __rsnd_mix_initialize_lock(mod, 0)
-+static void __rsnd_mix_initialize_lock(struct rsnd_mod *mod, u32 enable)
-+{
-+ rsnd_mod_write(mod, MIX_MIXIR, enable);
-+}
-+
-+static void rsnd_mix_volume_update(struct rsnd_dai_stream *io,
-+ struct rsnd_mod *mod)
-+{
-+
-+ /* Disable MIX dB setting */
-+ rsnd_mod_write(mod, MIX_MDBER, 0);
-+
-+ rsnd_mod_write(mod, MIX_MDBAR, 0);
-+ rsnd_mod_write(mod, MIX_MDBBR, 0);
-+ rsnd_mod_write(mod, MIX_MDBCR, 0);
-+ rsnd_mod_write(mod, MIX_MDBDR, 0);
-+
-+ /* Enable MIX dB setting */
-+ rsnd_mod_write(mod, MIX_MDBER, 1);
-+}
-+
-+static int rsnd_mix_init(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
-+ struct rsnd_priv *priv)
-+{
-+ rsnd_mod_hw_start(mod);
-+
-+ rsnd_mix_soft_reset(mod);
-+
-+ rsnd_mix_initialize_lock(mod);
-+
-+ rsnd_mod_write(mod, MIX_ADINR, rsnd_get_adinr_chan(mod, io));
-+
-+ rsnd_path_parse(priv, io);
-+
-+ /* volume step */
-+ rsnd_mod_write(mod, MIX_MIXMR, 0);
-+ rsnd_mod_write(mod, MIX_MVPDR, 0);
-+
-+ rsnd_mix_volume_update(io, mod);
-+
-+ rsnd_mix_initialize_unlock(mod);
-+
-+ return 0;
-+}
-+
-+static int rsnd_mix_quit(struct rsnd_mod *mod,
-+ struct rsnd_dai_stream *io,
-+ struct rsnd_priv *priv)
-+{
-+ rsnd_mod_hw_stop(mod);
-+
-+ return 0;
-+}
-+
-+static struct rsnd_mod_ops rsnd_mix_ops = {
-+ .name = MIX_NAME,
-+ .init = rsnd_mix_init,
-+ .quit = rsnd_mix_quit,
-+};
-+
-+struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id)
-+{
-+ if (WARN_ON(id < 0 || id >= rsnd_mix_nr(priv)))
-+ id = 0;
-+
-+ return &((struct rsnd_mix *)(priv->mix) + id)->mod;
-+}
-+
-+static void rsnd_of_parse_mix(struct platform_device *pdev,
-+ const struct rsnd_of_data *of_data,
-+ struct rsnd_priv *priv)
-+{
-+ struct device_node *node;
-+ struct rsnd_mix_platform_info *mix_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,mix");
-+ if (!node)
-+ return;
-+
-+ nr = of_get_child_count(node);
-+ if (!nr)
-+ goto rsnd_of_parse_mix_end;
-+
-+ mix_info = devm_kzalloc(dev,
-+ sizeof(struct rsnd_mix_platform_info) * nr,
-+ GFP_KERNEL);
-+ if (!mix_info) {
-+ dev_err(dev, "mix info allocation error\n");
-+ goto rsnd_of_parse_mix_end;
-+ }
-+
-+ info->mix_info = mix_info;
-+ info->mix_info_nr = nr;
-+
-+rsnd_of_parse_mix_end:
-+ of_node_put(node);
-+
-+}
-+
-+int rsnd_mix_probe(struct platform_device *pdev,
-+ const struct rsnd_of_data *of_data,
-+ struct rsnd_priv *priv)
-+{
-+ struct rcar_snd_info *info = rsnd_priv_to_info(priv);
-+ struct device *dev = rsnd_priv_to_dev(priv);
-+ struct rsnd_mix *mix;
-+ struct clk *clk;
-+ char name[MIX_NAME_SIZE];
-+ int i, nr, ret;
-+
-+ /* This driver doesn't support Gen1 at this point */
-+ if (rsnd_is_gen1(priv)) {
-+ dev_warn(dev, "MIX is not supported on Gen1\n");
-+ return -EINVAL;
-+ }
-+
-+ rsnd_of_parse_mix(pdev, of_data, priv);
-+
-+ nr = info->mix_info_nr;
-+ if (!nr)
-+ return 0;
-+
-+ mix = devm_kzalloc(dev, sizeof(*mix) * nr, GFP_KERNEL);
-+ if (!mix)
-+ return -ENOMEM;
-+
-+ priv->mix_nr = nr;
-+ priv->mix = mix;
-+
-+ for_each_rsnd_mix(mix, priv, i) {
-+ snprintf(name, MIX_NAME_SIZE, "%s.%d",
-+ MIX_NAME, i);
-+
-+ clk = devm_clk_get(dev, name);
-+ if (IS_ERR(clk))
-+ return PTR_ERR(clk);
-+
-+ mix->info = &info->mix_info[i];
-+
-+ ret = rsnd_mod_init(priv, &mix->mod, &rsnd_mix_ops,
-+ clk, RSND_MOD_MIX, i);
-+ if (ret)
-+ return ret;
-+ }
-+
-+ return 0;
-+}
-+
-+void rsnd_mix_remove(struct platform_device *pdev,
-+ struct rsnd_priv *priv)
-+{
-+ struct rsnd_mix *mix;
-+ int i;
-+
-+ for_each_rsnd_mix(mix, priv, i) {
-+ rsnd_mod_quit(&mix->mod);
-+ }
-+}
-diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
-index f2128a7cf259..7a0e52b4640a 100644
---- a/sound/soc/sh/rcar/rsnd.h
-+++ b/sound/soc/sh/rcar/rsnd.h
-@@ -49,6 +49,16 @@ enum rsnd_reg {
- RSND_REG_CMD_ROUTE_SLCT,
- RSND_REG_CTU_CTUIR,
- RSND_REG_CTU_ADINR,
-+ RSND_REG_MIX_SWRSR,
-+ RSND_REG_MIX_MIXIR,
-+ RSND_REG_MIX_ADINR,
-+ RSND_REG_MIX_MIXMR,
-+ RSND_REG_MIX_MVPDR,
-+ RSND_REG_MIX_MDBAR,
-+ RSND_REG_MIX_MDBBR,
-+ RSND_REG_MIX_MDBCR,
-+ RSND_REG_MIX_MDBDR,
-+ RSND_REG_MIX_MDBER,
- RSND_REG_DVC_SWRSR,
- RSND_REG_DVC_DVUIR,
- RSND_REG_DVC_ADINR,
-@@ -222,6 +232,7 @@ struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
- */
- enum rsnd_mod_type {
- RSND_MOD_DVC = 0,
-+ RSND_MOD_MIX,
- RSND_MOD_CTU,
- RSND_MOD_SRC,
- RSND_MOD_SSI,
-@@ -355,6 +366,7 @@ struct rsnd_dai_stream {
- #define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI)
- #define rsnd_io_to_mod_src(io) rsnd_io_to_mod((io), RSND_MOD_SRC)
- #define rsnd_io_to_mod_ctu(io) rsnd_io_to_mod((io), RSND_MOD_CTU)
-+#define rsnd_io_to_mod_mix(io) rsnd_io_to_mod((io), RSND_MOD_MIX)
- #define rsnd_io_to_mod_dvc(io) rsnd_io_to_mod((io), RSND_MOD_DVC)
- #define rsnd_io_to_rdai(io) ((io)->rdai)
- #define rsnd_io_to_priv(io) (rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
-@@ -473,6 +485,12 @@ struct rsnd_priv {
- int ctu_nr;
-
- /*
-+ * below value will be filled on rsnd_mix_probe()
-+ */
-+ void *mix;
-+ int mix_nr;
-+
-+ /*
- * below value will be filled on rsnd_dvc_probe()
- */
- void *dvc;
-@@ -589,6 +607,17 @@ void rsnd_ctu_remove(struct platform_device *pdev,
- struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id);
-
- /*
-+ * R-Car MIX
-+ */
-+int rsnd_mix_probe(struct platform_device *pdev,
-+ const struct rsnd_of_data *of_data,
-+ struct rsnd_priv *priv);
-+
-+void rsnd_mix_remove(struct platform_device *pdev,
-+ struct rsnd_priv *priv);
-+struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id);
-+
-+/*
- * R-Car DVC
- */
- int rsnd_dvc_probe(struct platform_device *pdev,
---
-2.6.2
-
diff --git a/patches.renesas/0307-ASoC-rsnd-tidyup-parameter-assignment-position.patch b/patches.renesas/0307-ASoC-rsnd-tidyup-parameter-assignment-position.patch
deleted file mode 100644
index 19ad692365d2f6..00000000000000
--- a/patches.renesas/0307-ASoC-rsnd-tidyup-parameter-assignment-position.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From e9ce9c88e7154850b8b37cc8268c5f28e419aa3f Mon Sep 17 00:00:00 2001
-From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Date: Tue, 21 Jul 2015 00:03:35 +0000
-Subject: [PATCH 307/326] ASoC: rsnd: tidyup parameter assignment position
-
-84e95355602c("ASoC: rsnd: show debug message for SSI/SRC/DVC connection")
-added debug message on rsnd_dai_connect(), but the relationship of
-parameter check was absurdity. This patch tidyup it.
-It is reported via Smatch/Dan
-
-Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
-Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 48725e9cc841da395bfd74e7691bba91613d3517)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/core.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
-index 927a7b02123b..f3feed5ce9b6 100644
---- a/sound/soc/sh/rcar/core.c
-+++ b/sound/soc/sh/rcar/core.c
-@@ -332,12 +332,15 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
- static int rsnd_dai_connect(struct rsnd_mod *mod,
- struct rsnd_dai_stream *io)
- {
-- struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-- struct device *dev = rsnd_priv_to_dev(priv);
-+ struct rsnd_priv *priv;
-+ struct device *dev;
-
- if (!mod)
- return -EIO;
-
-+ priv = rsnd_mod_to_priv(mod);
-+ dev = rsnd_priv_to_dev(priv);
-+
- io->mod[mod->type] = mod;
-
- dev_dbg(dev, "%s[%d] is connected to io (%s)\n",
---
-2.6.2
-
diff --git a/patches.renesas/0308-ASoC-rcar-ctu-Staticise-local-symbols.patch b/patches.renesas/0308-ASoC-rcar-ctu-Staticise-local-symbols.patch
deleted file mode 100644
index 3e6e6054ebfdf1..00000000000000
--- a/patches.renesas/0308-ASoC-rcar-ctu-Staticise-local-symbols.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 3e353550ddf056f120fba29e81953635a9c5c84f Mon Sep 17 00:00:00 2001
-From: Lars-Peter Clausen <lars@metafoo.de>
-Date: Mon, 27 Jul 2015 10:56:25 +0200
-Subject: [PATCH 308/326] ASoC: rcar ctu: Staticise local symbols
-
-rsnd_of_parse_ctu() is not used outside this file so it can be static.
-Fixes the following sparse warning:
-
- sound/soc/sh/rcar/ctu.c:72:6: warning: symbol 'rsnd_of_parse_ctu' was
- not declared. Should it be static?
-
-Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
-Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit e773c2f964640e103cc75a45aa4555c73ba55c29)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/ctu.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c
-index 05edd2009b81..05498bba5874 100644
---- a/sound/soc/sh/rcar/ctu.c
-+++ b/sound/soc/sh/rcar/ctu.c
-@@ -69,7 +69,7 @@ struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id)
- return &((struct rsnd_ctu *)(priv->ctu) + id)->mod;
- }
-
--void rsnd_of_parse_ctu(struct platform_device *pdev,
-+static void rsnd_of_parse_ctu(struct platform_device *pdev,
- const struct rsnd_of_data *of_data,
- struct rsnd_priv *priv)
- {
---
-2.6.2
-
diff --git a/patches.renesas/0309-ASoC-rsnd-Silence-DMA-slave-ID-compile-warning-on-64.patch b/patches.renesas/0309-ASoC-rsnd-Silence-DMA-slave-ID-compile-warning-on-64.patch
deleted file mode 100644
index c86a2504f203c7..00000000000000
--- a/patches.renesas/0309-ASoC-rsnd-Silence-DMA-slave-ID-compile-warning-on-64.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From d12dbf8129638d3f5426818403af3c6298a7872b Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 11 Aug 2015 14:47:18 +0200
-Subject: [PATCH 309/326] ASoC: rsnd: Silence DMA slave ID compile warning on
- 64-bit
-
-On arm64:
-
- sound/soc/sh/rcar/dma.c: In function 'rsnd_dmaen_init':
- sound/soc/sh/rcar/dma.c:180:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
- (void *)id);
- ^
- include/linux/dmaengine.h:1185:75: note: in definition of macro 'dma_request_channel'
- #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
- ^
-
-Add an intermediate cast to "uintptr_t" to kill the compile warning.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit 1af2cc64b18c29f1d774caa7e592c781bee6a7eb)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- sound/soc/sh/rcar/dma.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
-index 305b12929853..bfbb8a5e93bd 100644
---- a/sound/soc/sh/rcar/dma.c
-+++ b/sound/soc/sh/rcar/dma.c
-@@ -177,7 +177,7 @@ static int rsnd_dmaen_init(struct rsnd_dai_stream *io,
- dma_cap_set(DMA_SLAVE, mask);
-
- dmaen->chan = dma_request_channel(mask, shdma_chan_filter,
-- (void *)id);
-+ (void *)(uintptr_t)id);
- }
- if (IS_ERR_OR_NULL(dmaen->chan)) {
- dmaen->chan = NULL;
---
-2.6.2
-
diff --git a/patches.renesas/0310-irqchip-renesas-intc-irqpin-Use-a-separate-lockdep-c.patch b/patches.renesas/0310-irqchip-renesas-intc-irqpin-Use-a-separate-lockdep-c.patch
deleted file mode 100644
index 8accfb6493e8e5..00000000000000
--- a/patches.renesas/0310-irqchip-renesas-intc-irqpin-Use-a-separate-lockdep-c.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-From cda7c40ef23b4f86f4d0abb807344b22bdf9ca7e Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 9 Sep 2015 13:42:54 +0200
-Subject: [PATCH 310/326] irqchip/renesas-intc-irqpin: Use a separate lockdep
- class
-
-The renesas-intc-irqpin interrupt controller is cascaded to the GIC.
-Hence when propagating wake-up settings to its parent interrupt
-controller, the following lockdep warning is printed:
-
- =============================================
- [ INFO: possible recursive locking detected ]
- 4.2.0-armadillo-10725-g50fcd7643c034198 #781 Not tainted
- ---------------------------------------------
- s2ram/1179 is trying to acquire lock:
- (&irq_desc_lock_class){-.-...}, at: [<c005bb54>] __irq_get_desc_lock+0x78/0x94
-
- but task is already holding lock:
- (&irq_desc_lock_class){-.-...}, at: [<c005bb54>] __irq_get_desc_lock+0x78/0x94
-
- other info that might help us debug this:
- Possible unsafe locking scenario:
-
- CPU0
- ----
- lock(&irq_desc_lock_class);
- lock(&irq_desc_lock_class);
-
- *** DEADLOCK ***
-
- May be due to missing lock nesting notation
-
- 7 locks held by s2ram/1179:
- #0: (sb_writers#7){.+.+.+}, at: [<c00c9708>] __sb_start_write+0x64/0xb8
- #1: (&of->mutex){+.+.+.}, at: [<c0125a00>] kernfs_fop_write+0x78/0x1a0
- #2: (s_active#23){.+.+.+}, at: [<c0125a08>] kernfs_fop_write+0x80/0x1a0
- #3: (autosleep_lock){+.+.+.}, at: [<c0058244>] pm_autosleep_lock+0x18/0x20
- #4: (pm_mutex){+.+.+.}, at: [<c0057e50>] pm_suspend+0x54/0x248
- #5: (&dev->mutex){......}, at: [<c0243a20>] __device_suspend+0xdc/0x240
- #6: (&irq_desc_lock_class){-.-...}, at: [<c005bb54>] __irq_get_desc_lock+0x78/0x94
-
- stack backtrace:
- CPU: 0 PID: 1179 Comm: s2ram Not tainted 4.2.0-armadillo-10725-g50fcd7643c034198
-
- Hardware name: Generic R8A7740 (Flattened Device Tree)
- [<c00129f4>] (dump_backtrace) from [<c0012bec>] (show_stack+0x18/0x1c)
- [<c0012bd4>] (show_stack) from [<c03f5d94>] (dump_stack+0x20/0x28)
- [<c03f5d74>] (dump_stack) from [<c00514d4>] (__lock_acquire+0x67c/0x1b88)
- [<c0050e58>] (__lock_acquire) from [<c0052df8>] (lock_acquire+0x9c/0xbc)
- [<c0052d5c>] (lock_acquire) from [<c03fb068>] (_raw_spin_lock_irqsave+0x44/0x58)
- [<c03fb024>] (_raw_spin_lock_irqsave) from [<c005bb54>] (__irq_get_desc_lock+0x78/0x94
- [<c005badc>] (__irq_get_desc_lock) from [<c005c3d8>] (irq_set_irq_wake+0x28/0x100)
- [<c005c3b0>] (irq_set_irq_wake) from [<c01e50d0>] (intc_irqpin_irq_set_wake+0x24/0x4c)
- [<c01e50ac>] (intc_irqpin_irq_set_wake) from [<c005c17c>] (set_irq_wake_real+0x3c/0x50
- [<c005c140>] (set_irq_wake_real) from [<c005c414>] (irq_set_irq_wake+0x64/0x100)
- [<c005c3b0>] (irq_set_irq_wake) from [<c02a19b4>] (gpio_keys_suspend+0x60/0xa0)
- [<c02a1954>] (gpio_keys_suspend) from [<c023b750>] (platform_pm_suspend+0x3c/0x5c)
-
-Avoid this false positive by using a separate lockdep class for INTC
-External IRQ Pin interrupts.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Cc: Grygorii Strashko <grygorii.strashko@ti.com>
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Cc: Jason Cooper <jason@lakedaemon.net>
-Link: http://lkml.kernel.org/r/1441798974-25716-3-git-send-email-geert%2Brenesas@glider.be
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit 769b5cf78e6c653c2f513649ee6c4e7a06723872)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/irqchip/irq-renesas-intc-irqpin.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c
-index 0670ab4e3897..67797eebbd5e 100644
---- a/drivers/irqchip/irq-renesas-intc-irqpin.c
-+++ b/drivers/irqchip/irq-renesas-intc-irqpin.c
-@@ -332,6 +332,12 @@ static irqreturn_t intc_irqpin_shared_irq_handler(int irq, void *dev_id)
- return status;
- }
-
-+/*
-+ * This lock class tells lockdep that INTC External IRQ Pin irqs are in a
-+ * different category than their parents, so it won't report false recursion.
-+ */
-+static struct lock_class_key intc_irqpin_irq_lock_class;
-+
- static int intc_irqpin_irq_domain_map(struct irq_domain *h, unsigned int virq,
- irq_hw_number_t hw)
- {
-@@ -342,6 +348,7 @@ static int intc_irqpin_irq_domain_map(struct irq_domain *h, unsigned int virq,
-
- intc_irqpin_dbg(&p->irq[hw], "map");
- irq_set_chip_data(virq, h->host_data);
-+ irq_set_lockdep_class(virq, &intc_irqpin_irq_lock_class);
- irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq);
- set_irq_flags(virq, IRQF_VALID); /* kill me now */
- return 0;
---
-2.6.2
-
diff --git a/patches.renesas/0311-irqchip-renesas-intc-irqpin-Propagate-wake-up-settin.patch b/patches.renesas/0311-irqchip-renesas-intc-irqpin-Propagate-wake-up-settin.patch
deleted file mode 100644
index 0f6c5cbcebe6ee..00000000000000
--- a/patches.renesas/0311-irqchip-renesas-intc-irqpin-Propagate-wake-up-settin.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From b456c0fc8d6e0aa4d1fdddbefc83b240074b5c42 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 8 Sep 2015 19:00:35 +0200
-Subject: [PATCH 311/326] irqchip/renesas-intc-irqpin: Propagate wake-up
- settings to parent
-
-The renesas-intc-irqpin interrupt controller is cascaded to the GIC, but
-its driver doesn't propagate wake-up settings to the parent interrupt
-controller.
-
-Since commit aec89ef72ba6c944 ("irqchip/gic: Enable SKIP_SET_WAKE and
-MASK_ON_SUSPEND"), the GIC driver masks interrupts during suspend, and
-wake-up through gpio-keys now fails on r8a7740/armadillo and
-sh73a0/kzm9g.
-
-Fix this by propagating wake-up settings to the parent interrupt
-controller. There's no need to handle irq_set_irq_wake() failures, as
-the renesas-intc-irqpin interrupt controller is always cascaded to a
-GIC, and the GIC driver always sets SKIP_SET_WAKE since the
-aforementioned commit.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Cc: Sudeep Holla <sudeep.holla@arm.com>
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Cc: Jason Cooper <jason@lakedaemon.net>
-Cc: Marc Zyngier <marc.zyngier@arm.com>
-Link: http://lkml.kernel.org/r/1441731636-17610-2-git-send-email-geert%2Brenesas@glider.be
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit f4e209cdc7a00f934007f40cf885471799073b0d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/irqchip/irq-renesas-intc-irqpin.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c
-index 67797eebbd5e..d3546a6f4978 100644
---- a/drivers/irqchip/irq-renesas-intc-irqpin.c
-+++ b/drivers/irqchip/irq-renesas-intc-irqpin.c
-@@ -283,6 +283,9 @@ static int intc_irqpin_irq_set_type(struct irq_data *d, unsigned int type)
- static int intc_irqpin_irq_set_wake(struct irq_data *d, unsigned int on)
- {
- struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d);
-+ int hw_irq = irqd_to_hwirq(d);
-+
-+ irq_set_irq_wake(p->irq[hw_irq].requested_irq, on);
-
- if (!p->clk)
- return 0;
---
-2.6.2
-
diff --git a/patches.renesas/0312-irqchip-renesas-irqc-Use-a-separate-lockdep-class.patch b/patches.renesas/0312-irqchip-renesas-irqc-Use-a-separate-lockdep-class.patch
deleted file mode 100644
index 09bea28fb81c0f..00000000000000
--- a/patches.renesas/0312-irqchip-renesas-irqc-Use-a-separate-lockdep-class.patch
+++ /dev/null
@@ -1,97 +0,0 @@
-From b861d48955a0aaf81f0a20e750c1c9c1bb414adb Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 9 Sep 2015 13:42:53 +0200
-Subject: [PATCH 312/326] irqchip/renesas-irqc: Use a separate lockdep class
-
-The renesas-irqc interrupt controller is cascaded to the GIC. Hence when
-propagating wake-up settings to its parent interrupt controller, the
-following lockdep warning is printed:
-
- =============================================
- [ INFO: possible recursive locking detected ]
- 4.2.0-ape6evm-10725-g50fcd7643c034198 #280 Not tainted
- ---------------------------------------------
- s2ram/1072 is trying to acquire lock:
- (&irq_desc_lock_class){-.-...}, at: [<c008d3fc>] __irq_get_desc_lock+0x58/0x98
-
- but task is already holding lock:
- (&irq_desc_lock_class){-.-...}, at: [<c008d3fc>] __irq_get_desc_lock+0x58/0x98
-
- other info that might help us debug this:
- Possible unsafe locking scenario:
-
- CPU0
- ----
- lock(&irq_desc_lock_class);
- lock(&irq_desc_lock_class);
-
- *** DEADLOCK ***
-
- May be due to missing lock nesting notation
-
- 6 locks held by s2ram/1072:
- #0: (sb_writers#7){.+.+.+}, at: [<c012eb14>] __sb_start_write+0xa0/0xa8
- #1: (&of->mutex){+.+.+.}, at: [<c019396c>] kernfs_fop_write+0x4c/0x1bc
- #2: (s_active#24){.+.+.+}, at: [<c0193974>] kernfs_fop_write+0x54/0x1bc
- #3: (pm_mutex){+.+.+.}, at: [<c008213c>] pm_suspend+0x10c/0x510
- #4: (&dev->mutex){......}, at: [<c02af3c4>] __device_suspend+0xdc/0x2cc
- #5: (&irq_desc_lock_class){-.-...}, at: [<c008d3fc>] __irq_get_desc_lock+0x58/0x98
-
- stack backtrace:
- CPU: 0 PID: 1072 Comm: s2ram Not tainted 4.2.0-ape6evm-10725-g50fcd7643c034198 #280
- Hardware name: Generic R8A73A4 (Flattened Device Tree)
- [<c0018078>] (unwind_backtrace) from [<c00144f0>] (show_stack+0x10/0x14)
- [<c00144f0>] (show_stack) from [<c0451f14>] (dump_stack+0x88/0x98)
- [<c0451f14>] (dump_stack) from [<c007b29c>] (__lock_acquire+0x15cc/0x20e4)
- [<c007b29c>] (__lock_acquire) from [<c007c6e0>] (lock_acquire+0xac/0x12c)
- [<c007c6e0>] (lock_acquire) from [<c0457c00>] (_raw_spin_lock_irqsave+0x40/0x54)
- [<c0457c00>] (_raw_spin_lock_irqsave) from [<c008d3fc>] (__irq_get_desc_lock+0x58/0x98)
- [<c008d3fc>] (__irq_get_desc_lock) from [<c008ebbc>] (irq_set_irq_wake+0x20/0xf8)
- [<c008ebbc>] (irq_set_irq_wake) from [<c0260770>] (irqc_irq_set_wake+0x20/0x4c)
- [<c0260770>] (irqc_irq_set_wake) from [<c008ec28>] (irq_set_irq_wake+0x8c/0xf8)
- [<c008ec28>] (irq_set_irq_wake) from [<c02cb8c0>] (gpio_keys_suspend+0x74/0xc0)
- [<c02cb8c0>] (gpio_keys_suspend) from [<c02ae8cc>] (dpm_run_callback+0x54/0x124)
-
-Avoid this false positive by using a separate lockdep class for IRQC
-interrupts.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Cc: Grygorii Strashko <grygorii.strashko@ti.com>
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Cc: Jason Cooper <jason@lakedaemon.net>
-Link: http://lkml.kernel.org/r/1441798974-25716-2-git-send-email-geert%2Brenesas@glider.be
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit b1370658804510f6a1c0517a8ff1c9534d371edd)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/irqchip/irq-renesas-irqc.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c
-index 2aa3add711a6..4652cc385d39 100644
---- a/drivers/irqchip/irq-renesas-irqc.c
-+++ b/drivers/irqchip/irq-renesas-irqc.c
-@@ -150,6 +150,12 @@ static irqreturn_t irqc_irq_handler(int irq, void *dev_id)
- return IRQ_NONE;
- }
-
-+/*
-+ * This lock class tells lockdep that IRQC irqs are in a different
-+ * category than their parents, so it won't report false recursion.
-+ */
-+static struct lock_class_key irqc_irq_lock_class;
-+
- static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq,
- irq_hw_number_t hw)
- {
-@@ -157,6 +163,7 @@ static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq,
-
- irqc_dbg(&p->irq[hw], "map");
- irq_set_chip_data(virq, h->host_data);
-+ irq_set_lockdep_class(virq, &irqc_irq_lock_class);
- irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq);
- return 0;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0313-irqchip-renesas-irqc-Propagate-wake-up-settings-to-p.patch b/patches.renesas/0313-irqchip-renesas-irqc-Propagate-wake-up-settings-to-p.patch
deleted file mode 100644
index d2b0e95cf79c1b..00000000000000
--- a/patches.renesas/0313-irqchip-renesas-irqc-Propagate-wake-up-settings-to-p.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From e2a4578679bd975f2f010f3eb5f1f8cd99026825 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 8 Sep 2015 19:00:36 +0200
-Subject: [PATCH 313/326] irqchip/renesas-irqc: Propagate wake-up settings to
- parent
-
-The renesas-irqc interrupt controller is cascaded to the GIC, but its
-driver doesn't propagate wake-up settings to the parent interrupt
-controller.
-
-Since commit aec89ef72ba6c944 ("irqchip/gic: Enable SKIP_SET_WAKE and
-MASK_ON_SUSPEND"), the GIC driver masks interrupts during suspend, and
-wake-up through gpio-keys now fails on r8a73a4/ape6evm.
-
-Fix this by propagating wake-up settings to the parent interrupt
-controller. There's no need to handle irq_set_irq_wake() failures, as
-the renesas-irqc interrupt controller is always cascaded to a GIC, and
-the GIC driver always sets SKIP_SET_WAKE since the aforementioned
-commit.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Cc: Sudeep Holla <sudeep.holla@arm.com>
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Cc: Jason Cooper <jason@lakedaemon.net>
-Cc: Marc Zyngier <marc.zyngier@arm.com>
-Link: http://lkml.kernel.org/r/1441731636-17610-3-git-send-email-geert%2Brenesas@glider.be
-Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-(cherry picked from commit 4cd7863ecb90010533c178fba6ecc84d5529b402)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/irqchip/irq-renesas-irqc.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c
-index 4652cc385d39..35bf97ba4a3d 100644
---- a/drivers/irqchip/irq-renesas-irqc.c
-+++ b/drivers/irqchip/irq-renesas-irqc.c
-@@ -121,6 +121,9 @@ static int irqc_irq_set_type(struct irq_data *d, unsigned int type)
- static int irqc_irq_set_wake(struct irq_data *d, unsigned int on)
- {
- struct irqc_priv *p = irq_data_get_irq_chip_data(d);
-+ int hw_irq = irqd_to_hwirq(d);
-+
-+ irq_set_irq_wake(p->irq[hw_irq].requested_irq, on);
-
- if (!p->clk)
- return 0;
---
-2.6.2
-
diff --git a/patches.renesas/0314-pinctrl-join-lines-that-can-be-a-single-line-within-.patch b/patches.renesas/0314-pinctrl-join-lines-that-can-be-a-single-line-within-.patch
deleted file mode 100644
index 265a9721aeab52..00000000000000
--- a/patches.renesas/0314-pinctrl-join-lines-that-can-be-a-single-line-within-.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From cb9fdeee0ddeba1195c20a17679a1f4b30258d89 Mon Sep 17 00:00:00 2001
-From: Masahiro Yamada <yamada.masahiro@socionext.com>
-Date: Sat, 1 Aug 2015 13:22:38 +0900
-Subject: [PATCH 314/326] pinctrl: join lines that can be a single line within
- 80 columns
-
-There is no reason to break a line shorter than 80 columns.
-
-Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 163dc9f39a26b41fc49319fce4145b35f9705789)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/pinmux.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
-index 67e08cb315c4..29984b36926a 100644
---- a/drivers/pinctrl/pinmux.c
-+++ b/drivers/pinctrl/pinmux.c
-@@ -313,8 +313,7 @@ static int pinmux_func_name_to_selector(struct pinctrl_dev *pctldev,
-
- /* See if this pctldev has this function */
- while (selector < nfuncs) {
-- const char *fname = ops->get_function_name(pctldev,
-- selector);
-+ const char *fname = ops->get_function_name(pctldev, selector);
-
- if (!strcmp(function, fname))
- return selector;
---
-2.6.2
-
diff --git a/patches.renesas/0315-pinctrl-core-Warn-about-NULL-gpio_chip-in-pinctrl_re.patch b/patches.renesas/0315-pinctrl-core-Warn-about-NULL-gpio_chip-in-pinctrl_re.patch
deleted file mode 100644
index be28a1e1bb9e2b..00000000000000
--- a/patches.renesas/0315-pinctrl-core-Warn-about-NULL-gpio_chip-in-pinctrl_re.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 47ff9e7421632c0dbcf57caecd96f81aa4d1de6e Mon Sep 17 00:00:00 2001
-From: Tony Lindgren <tony@atomide.com>
-Date: Thu, 3 Sep 2015 10:34:30 -0700
-Subject: [PATCH 315/326] pinctrl: core: Warn about NULL gpio_chip in
- pinctrl_ready_for_gpio_range()
-
-If the gpio driver is confused about the numbers for gpio-ranges,
-pinctrl_ready_for_gpio_range() may get called with invalid GPIO
-causing a NULL pointer exception. Let's instead provide a warning
-that allows fixing the problem and return with error.
-
-Signed-off-by: Tony Lindgren <tony@atomide.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-(cherry picked from commit 942cde724075f840ded89390b10dce1a47a4d712)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/pinctrl/core.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
-index 69723e07036b..9638a00c67c2 100644
---- a/drivers/pinctrl/core.c
-+++ b/drivers/pinctrl/core.c
-@@ -349,6 +349,9 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio)
- struct pinctrl_gpio_range *range = NULL;
- struct gpio_chip *chip = gpio_to_chip(gpio);
-
-+ if (WARN(!chip, "no gpio_chip for gpio%i?", gpio))
-+ return false;
-+
- mutex_lock(&pinctrldev_list_mutex);
-
- /* Loop over the pin controllers */
---
-2.6.2
-
diff --git a/patches.renesas/0316-PCI-rcar-Add-R8A7794-support.patch b/patches.renesas/0316-PCI-rcar-Add-R8A7794-support.patch
deleted file mode 100644
index 0c3fa97f421d35..00000000000000
--- a/patches.renesas/0316-PCI-rcar-Add-R8A7794-support.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 3da2201e3f77db03f49d3f6b132265100ec8d3e0 Mon Sep 17 00:00:00 2001
-From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Date: Sat, 12 Sep 2015 02:06:09 +0300
-Subject: [PATCH 316/326] PCI: rcar: Add R8A7794 support
-
-Add Renesas R8A7794 SoC support to the Renesas R-Car gen2 PCI driver.
-
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit de24c18c0faca5ebd618e1cb87f5489745e40475)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt | 3 ++-
- drivers/pci/host/pci-rcar-gen2.c | 1 +
- 2 files changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt b/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt
-index d8ef5bf50f11..7fab84b33531 100644
---- a/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt
-+++ b/Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt
-@@ -7,7 +7,8 @@ OHCI and EHCI controllers.
-
- Required properties:
- - compatible: "renesas,pci-r8a7790" for the R8A7790 SoC;
-- "renesas,pci-r8a7791" for the R8A7791 SoC.
-+ "renesas,pci-r8a7791" for the R8A7791 SoC;
-+ "renesas,pci-r8a7794" for the R8A7794 SoC.
- - reg: A list of physical regions to access the device: the first is
- the operational registers for the OHCI/EHCI controllers and the
- second is for the bridge configuration and control registers.
-diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
-index 367e28fa7564..c4f64bfee551 100644
---- a/drivers/pci/host/pci-rcar-gen2.c
-+++ b/drivers/pci/host/pci-rcar-gen2.c
-@@ -362,6 +362,7 @@ static int rcar_pci_probe(struct platform_device *pdev)
- static struct of_device_id rcar_pci_of_match[] = {
- { .compatible = "renesas,pci-r8a7790", },
- { .compatible = "renesas,pci-r8a7791", },
-+ { .compatible = "renesas,pci-r8a7794", },
- { },
- };
-
---
-2.6.2
-
diff --git a/patches.renesas/0317-drivers-sh-Disable-legacy-default-PM-Domain-on-emev2.patch b/patches.renesas/0317-drivers-sh-Disable-legacy-default-PM-Domain-on-emev2.patch
deleted file mode 100644
index bfeabee7f75def..00000000000000
--- a/patches.renesas/0317-drivers-sh-Disable-legacy-default-PM-Domain-on-emev2.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From b06dbb5126c9dc4317fc1dae1924513618559705 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:14 +0200
-Subject: [PATCH 317/326] drivers: sh: Disable legacy default PM Domain on
- emev2
-
-EMMA Mobile EV2 doesn't have MSTP clocks. All its device drivers manage
-clocks explicitly, without relying on Runtime PM, so it doesn't need the
-legacy default PM Domain.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit 9b302c1acf4114d51b7f0962df0b0ddee0dc75cd)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/sh/pm_runtime.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
-index fe8875f0d7be..c1e7f26c143f 100644
---- a/drivers/sh/pm_runtime.c
-+++ b/drivers/sh/pm_runtime.c
-@@ -78,8 +78,7 @@ static struct pm_clk_notifier_block platform_bus_notifier = {
- static int __init sh_pm_runtime_init(void)
- {
- if (IS_ENABLED(CONFIG_ARCH_SHMOBILE_MULTI)) {
-- if (!of_machine_is_compatible("renesas,emev2") &&
-- !of_machine_is_compatible("renesas,r7s72100") &&
-+ if (!of_machine_is_compatible("renesas,r7s72100") &&
- #ifndef CONFIG_PM_GENERIC_DOMAINS_OF
- !of_machine_is_compatible("renesas,r8a73a4") &&
- !of_machine_is_compatible("renesas,r8a7740") &&
---
-2.6.2
-
diff --git a/patches.renesas/0318-drivers-sh-Disable-PM-runtime-for-multi-platform-ARM.patch b/patches.renesas/0318-drivers-sh-Disable-PM-runtime-for-multi-platform-ARM.patch
deleted file mode 100644
index 62517460d3d705..00000000000000
--- a/patches.renesas/0318-drivers-sh-Disable-PM-runtime-for-multi-platform-ARM.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From 7afde3c3cc889fed813fd62159eae19078b799d9 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 4 Aug 2015 14:28:15 +0200
-Subject: [PATCH 318/326] drivers: sh: Disable PM runtime for multi-platform
- ARM with genpd
-
-If the default PM Domain using PM_CLK is used for PM runtime, the real
-Clock Domain cannot be registered from DT later.
-
-Hence do not enable it when running a multi-platform kernel with genpd
-support on R-Car or RZ. The CPG/MSTP Clock Domain driver will take care
-of PM runtime management of the module clocks.
-
-Now most multi-platform ARM shmobile platforms (SH-Mobile, R-Mobile,
-R-Car, RZ) use DT-based PM Domains to take care of PM runtime management
-of the module clocks, simplify the platform logic by replacing the
-explicit SoC checks by a single check for the presence of MSTP clocks in
-DT.
-
-Backwards-compatiblity with old DTs (mainly for R-Car Gen2) is provided
-by checking for the presence of a "#power-domain-cells" property in DT.
-
-The default PM Domain is still needed for:
- - backwards-compatibility with old DTs that lack PM Domain properties,
- - the CONFIG_PM=n case,
- - legacy (non-DT) ARM/shmobile platforms without genpd support
- (r8a7778, r8a7779),
- - legacy SuperH.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-(cherry picked from commit cbc41d0a761bffb3166a413a3c77100a737c0cd7)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/sh/pm_runtime.c | 18 +++++-------------
- 1 file changed, 5 insertions(+), 13 deletions(-)
-
-diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
-index c1e7f26c143f..4612b73ba321 100644
---- a/drivers/sh/pm_runtime.c
-+++ b/drivers/sh/pm_runtime.c
-@@ -78,19 +78,11 @@ static struct pm_clk_notifier_block platform_bus_notifier = {
- static int __init sh_pm_runtime_init(void)
- {
- if (IS_ENABLED(CONFIG_ARCH_SHMOBILE_MULTI)) {
-- if (!of_machine_is_compatible("renesas,r7s72100") &&
--#ifndef CONFIG_PM_GENERIC_DOMAINS_OF
-- !of_machine_is_compatible("renesas,r8a73a4") &&
-- !of_machine_is_compatible("renesas,r8a7740") &&
-- !of_machine_is_compatible("renesas,sh73a0") &&
--#endif
-- !of_machine_is_compatible("renesas,r8a7778") &&
-- !of_machine_is_compatible("renesas,r8a7779") &&
-- !of_machine_is_compatible("renesas,r8a7790") &&
-- !of_machine_is_compatible("renesas,r8a7791") &&
-- !of_machine_is_compatible("renesas,r8a7792") &&
-- !of_machine_is_compatible("renesas,r8a7793") &&
-- !of_machine_is_compatible("renesas,r8a7794"))
-+ if (!of_find_compatible_node(NULL, NULL,
-+ "renesas,cpg-mstp-clocks"))
-+ return 0;
-+ if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS_OF) &&
-+ of_find_node_with_property(NULL, "#power-domain-cells"))
- return 0;
- }
-
---
-2.6.2
-
diff --git a/patches.renesas/0319-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain-.patch b/patches.renesas/0319-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain-.patch
deleted file mode 100644
index eeb656ecad23ea..00000000000000
--- a/patches.renesas/0319-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain-.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From d9033ddef1ceec512f60c64e74044be59b9bb117 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 20 Aug 2015 01:24:44 +0000
-Subject: [PATCH 319/326] ARM: shmobile: r8a7790 dtsi: Add CPG/MSTP Clock
- Domain for sound
-
-484adb005886 ("ARM: shmobile: r8a7790 dtsi: Add CPG/MSTP Clock Domain")
-added CPG/MSTP clock-cells domain support, but it was missing sound
-support. This patch adds it.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-[horms: Updated commit id referred to in changelog]
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-
-(cherry picked from commit 6507c4efd2ca4a3dccedbc5b4724f9faabf97fca)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7790.dtsi | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
-index a0b2a79cbfbd..4624d0f2a754 100644
---- a/arch/arm/boot/dts/r8a7790.dtsi
-+++ b/arch/arm/boot/dts/r8a7790.dtsi
-@@ -1627,6 +1627,7 @@
- "mix.0", "mix.1",
- "dvc.0", "dvc.1",
- "clk_a", "clk_b", "clk_c", "clk_i";
-+ power-domains = <&cpg_clocks>;
-
- status = "disabled";
-
---
-2.6.2
-
diff --git a/patches.renesas/0320-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain-.patch b/patches.renesas/0320-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain-.patch
deleted file mode 100644
index 1e6564b5352807..00000000000000
--- a/patches.renesas/0320-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain-.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From cf1db7fc10c892fffa517dee9f4c4e7f26eaacb1 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Thu, 20 Aug 2015 01:25:20 +0000
-Subject: [PATCH 320/326] ARM: shmobile: r8a7791 dtsi: Add CPG/MSTP Clock
- Domain for sound
-
-797a0626e08c ("ARM: shmobile: r8a7791 dtsi: Add CPG/MSTP Clock Domain")
-added CPG/MSTP clock-cells domain support, but it was missing sound
-support. This patch adds it.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-[horms: updated commit id referred to in changelog]
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-
-(cherry picked from commit 56e86dd4bbeb66a7ad67e20fa045c6f51b4da571)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- arch/arm/boot/dts/r8a7791.dtsi | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
-index 831525dd39a6..1666c8a6b143 100644
---- a/arch/arm/boot/dts/r8a7791.dtsi
-+++ b/arch/arm/boot/dts/r8a7791.dtsi
-@@ -1677,6 +1677,7 @@
- "mix.0", "mix.1",
- "dvc.0", "dvc.1",
- "clk_a", "clk_b", "clk_c", "clk_i";
-+ power-domains = <&cpg_clocks>;
-
- status = "disabled";
-
---
-2.6.2
-
diff --git a/patches.renesas/0321-spi-sh-msiof-Match-renesas-rx-fifo-size-in-DT-bindin.patch b/patches.renesas/0321-spi-sh-msiof-Match-renesas-rx-fifo-size-in-DT-bindin.patch
deleted file mode 100644
index 4b120127608140..00000000000000
--- a/patches.renesas/0321-spi-sh-msiof-Match-renesas-rx-fifo-size-in-DT-bindin.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From ea4f9cecacff1adb8f3ee0c85f2cdcc6ef5579d6 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Mon, 28 Sep 2015 15:28:03 +0200
-Subject: [PATCH 321/326] spi: sh-msiof: Match renesas,rx-fifo-size in DT
- bindings doc with driver
-
-Commit fe78d0b7691c0274 ("spi: sh-msiof: Fix FIFO size to 64 word from
-256 word") changed the default RX FIFO size on R-Car Gen2 SoCs in the
-driver code, but forgot to update the DT bindings documentation.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Mark Brown <broonie@kernel.org>
-(cherry picked from commit eb8d0ac4afd8b15ac88f8a50342b32774ff881ed)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/spi/sh-msiof.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt b/Documentation/devicetree/bindings/spi/sh-msiof.txt
-index 8f771441be60..705075da2f10 100644
---- a/Documentation/devicetree/bindings/spi/sh-msiof.txt
-+++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt
-@@ -51,7 +51,7 @@ Optional properties, deprecated for soctype-specific bindings:
- - renesas,tx-fifo-size : Overrides the default tx fifo size given in words
- (default is 64)
- - renesas,rx-fifo-size : Overrides the default rx fifo size given in words
-- (default is 64, or 256 on R-Car Gen2)
-+ (default is 64)
-
- Pinctrl properties might be needed, too. See
- Documentation/devicetree/bindings/pinctrl/renesas,*.
---
-2.6.2
-
diff --git a/patches.renesas/0322-usb-renesas_usbhs-Change-USBHS_TYPE_R8A779x-to-USBHS.patch b/patches.renesas/0322-usb-renesas_usbhs-Change-USBHS_TYPE_R8A779x-to-USBHS.patch
deleted file mode 100644
index 75d1d72d1caf90..00000000000000
--- a/patches.renesas/0322-usb-renesas_usbhs-Change-USBHS_TYPE_R8A779x-to-USBHS.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From ded3e9a9ab6dfd1f41079ba20955bcbc2f84f3a7 Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Mon, 18 May 2015 20:04:14 +0900
-Subject: [PATCH 322/326] usb: renesas_usbhs: Change USBHS_TYPE_R8A779x to
- USBHS_TYPE_RCAR_GEN2
-
-Since the HSUSB controllers of R-Car Gen2 are the same specification
-(they have 16 pipes and usb-dmac), this patch changes USBHS_TYPE_R8A7790
-and USBHS_TYPE_R8A7791 to USBHS_TYPE_RCAR_GEN2.
-
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Signed-off-by: Felipe Balbi <balbi@ti.com>
-(cherry picked from commit e0213bc5467ca5fe44ab04527f0e47998f30c046)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/usb/renesas_usbhs/common.c | 15 ++++-----------
- include/linux/usb/renesas_usbhs.h | 3 +--
- 2 files changed, 5 insertions(+), 13 deletions(-)
-
-diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
-index da321f034e3c..8442805b3753 100644
---- a/drivers/usb/renesas_usbhs/common.c
-+++ b/drivers/usb/renesas_usbhs/common.c
-@@ -466,11 +466,11 @@ static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
- static const struct of_device_id usbhs_of_match[] = {
- {
- .compatible = "renesas,usbhs-r8a7790",
-- .data = (void *)USBHS_TYPE_R8A7790,
-+ .data = (void *)USBHS_TYPE_RCAR_GEN2,
- },
- {
- .compatible = "renesas,usbhs-r8a7791",
-- .data = (void *)USBHS_TYPE_R8A7791,
-+ .data = (void *)USBHS_TYPE_RCAR_GEN2,
- },
- { },
- };
-@@ -497,14 +497,8 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
- if (gpio > 0)
- dparam->enable_gpio = gpio;
-
-- switch (dparam->type) {
-- case USBHS_TYPE_R8A7790:
-- case USBHS_TYPE_R8A7791:
-+ if (dparam->type == USBHS_TYPE_RCAR_GEN2)
- dparam->has_usb_dmac = 1;
-- break;
-- default:
-- break;
-- }
-
- return info;
- }
-@@ -559,8 +553,7 @@ static int usbhs_probe(struct platform_device *pdev)
- sizeof(struct renesas_usbhs_driver_param));
-
- switch (priv->dparam.type) {
-- case USBHS_TYPE_R8A7790:
-- case USBHS_TYPE_R8A7791:
-+ case USBHS_TYPE_RCAR_GEN2:
- priv->pfunc = usbhs_rcar2_ops;
- if (!priv->dparam.pipe_type) {
- priv->dparam.pipe_type = usbhsc_new_pipe_type;
-diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
-index f06529c14141..3dd5a781da99 100644
---- a/include/linux/usb/renesas_usbhs.h
-+++ b/include/linux/usb/renesas_usbhs.h
-@@ -169,8 +169,7 @@ struct renesas_usbhs_driver_param {
- #define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */
- };
-
--#define USBHS_TYPE_R8A7790 1
--#define USBHS_TYPE_R8A7791 2
-+#define USBHS_TYPE_RCAR_GEN2 1
-
- /*
- * option:
---
-2.6.2
-
diff --git a/patches.renesas/0323-usb-renesas_usbhs-Add-support-for-R-Car-E2.patch b/patches.renesas/0323-usb-renesas_usbhs-Add-support-for-R-Car-E2.patch
deleted file mode 100644
index 81ebedb6dd453c..00000000000000
--- a/patches.renesas/0323-usb-renesas_usbhs-Add-support-for-R-Car-E2.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 6c53f7bb78f7ad02a0ee42a62d895de89b2fea28 Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Mon, 18 May 2015 20:04:15 +0900
-Subject: [PATCH 323/326] usb: renesas_usbhs: Add support for R-Car E2
-
-This patch adds a compatible string to support for R-Car E2.
-
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>" in patch 2
-Signed-off-by: Felipe Balbi <balbi@ti.com>
-(cherry picked from commit af6e613bb1b60fcbfe48c893b76c104c8952b599)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 1 +
- drivers/usb/renesas_usbhs/common.c | 4 ++++
- 2 files changed, 5 insertions(+)
-
-diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
-index ddbe304beb21..64a4ca6cf96f 100644
---- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
-+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
-@@ -4,6 +4,7 @@ Required properties:
- - compatible: Must contain one of the following:
- - "renesas,usbhs-r8a7790"
- - "renesas,usbhs-r8a7791"
-+ - "renesas,usbhs-r8a7794"
- - reg: Base address and length of the register for the USBHS
- - interrupts: Interrupt specifier for the USBHS
- - clocks: A list of phandle + clock specifier pairs
-diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
-index 8442805b3753..7b98e1d9194c 100644
---- a/drivers/usb/renesas_usbhs/common.c
-+++ b/drivers/usb/renesas_usbhs/common.c
-@@ -472,6 +472,10 @@ static const struct of_device_id usbhs_of_match[] = {
- .compatible = "renesas,usbhs-r8a7791",
- .data = (void *)USBHS_TYPE_RCAR_GEN2,
- },
-+ {
-+ .compatible = "renesas,usbhs-r8a7794",
-+ .data = (void *)USBHS_TYPE_RCAR_GEN2,
-+ },
- { },
- };
- MODULE_DEVICE_TABLE(of, usbhs_of_match);
---
-2.6.2
-
diff --git a/patches.renesas/0324-usb-renesas_usbhs-fix-build-warning-if-64-bit-archit.patch b/patches.renesas/0324-usb-renesas_usbhs-fix-build-warning-if-64-bit-archit.patch
deleted file mode 100644
index f8b7b34d360440..00000000000000
--- a/patches.renesas/0324-usb-renesas_usbhs-fix-build-warning-if-64-bit-archit.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 77d3b0683e752579dabc75fc243bc6ab85d8c0a0 Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Tue, 29 Sep 2015 18:21:18 +0900
-Subject: [PATCH 324/326] usb: renesas_usbhs: fix build warning if 64-bit
- architecture
-
-This patch fixes the following warning if 64-bit architecture environment:
-
-./drivers/usb/renesas_usbhs/common.c:496:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
- dparam->type = of_id ? (u32)of_id->data : 0;
-
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Signed-off-by: Felipe Balbi <balbi@ti.com>
-(cherry picked from commit 9ae7ce00cc1353155b1914bfc40e8362efef7d1c)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/usb/renesas_usbhs/common.c | 2 +-
- include/linux/usb/renesas_usbhs.h | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
-index 7b98e1d9194c..0ce398c5482e 100644
---- a/drivers/usb/renesas_usbhs/common.c
-+++ b/drivers/usb/renesas_usbhs/common.c
-@@ -493,7 +493,7 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
- return NULL;
-
- dparam = &info->driver_param;
-- dparam->type = of_id ? (u32)of_id->data : 0;
-+ dparam->type = of_id ? (uintptr_t)of_id->data : 0;
- if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp))
- dparam->buswait_bwait = tmp;
- gpio = of_get_named_gpio_flags(dev->of_node, "renesas,enable-gpio", 0,
-diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
-index 3dd5a781da99..bfb74723f151 100644
---- a/include/linux/usb/renesas_usbhs.h
-+++ b/include/linux/usb/renesas_usbhs.h
-@@ -157,7 +157,7 @@ struct renesas_usbhs_driver_param {
- */
- int pio_dma_border; /* default is 64byte */
-
-- u32 type;
-+ uintptr_t type;
- u32 enable_gpio;
-
- /*
---
-2.6.2
-
diff --git a/patches.renesas/0325-usb-renesas_usbhs-Add-support-for-R-Car-H3.patch b/patches.renesas/0325-usb-renesas_usbhs-Add-support-for-R-Car-H3.patch
deleted file mode 100644
index 234a39a5180173..00000000000000
--- a/patches.renesas/0325-usb-renesas_usbhs-Add-support-for-R-Car-H3.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 7da7809999ed59bd003299ce718e1d98992713bf Mon Sep 17 00:00:00 2001
-From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Date: Tue, 29 Sep 2015 18:21:19 +0900
-Subject: [PATCH 325/326] usb: renesas_usbhs: Add support for R-Car H3
-
-This patch adds a compatible string to support for R-Car H3.
-
-Since the HS-USB controller of R-Car H3 is almost the same specification
-with R-Car Gen2 (these have 16 pipes and usb-dmac), this patch
-sets the "type" of renesas_usbhs_driver_param to USBHS_TYPE_RCAR_GEN2.
-
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
-Signed-off-by: Felipe Balbi <balbi@ti.com>
-(cherry picked from commit f5f6afa85aa82a8ee59072f2d09f2b381f24c871)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 1 +
- drivers/usb/renesas_usbhs/common.c | 5 +++++
- 2 files changed, 6 insertions(+)
-
---- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
-+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
-@@ -5,6 +5,7 @@ Required properties:
- - "renesas,usbhs-r8a7790"
- - "renesas,usbhs-r8a7791"
- - "renesas,usbhs-r8a7794"
-+ - "renesas,usbhs-r8a7795"
- - reg: Base address and length of the register for the USBHS
- - interrupts: Interrupt specifier for the USBHS
- - clocks: A list of phandle + clock specifier pairs
---- a/drivers/usb/renesas_usbhs/common.c
-+++ b/drivers/usb/renesas_usbhs/common.c
-@@ -476,6 +476,11 @@ static const struct of_device_id usbhs_o
- .compatible = "renesas,usbhs-r8a7794",
- .data = (void *)USBHS_TYPE_RCAR_GEN2,
- },
-+ {
-+ /* Gen3 is compatible with Gen2 */
-+ .compatible = "renesas,usbhs-r8a7795",
-+ .data = (void *)USBHS_TYPE_RCAR_GEN2,
-+ },
- { },
- };
- MODULE_DEVICE_TABLE(of, usbhs_of_match);
diff --git a/patches.renesas/0328-sh_eth-fix-RX-buffer-size-calculation.patch b/patches.renesas/0328-sh_eth-fix-RX-buffer-size-calculation.patch
deleted file mode 100644
index 674600c3451ea3..00000000000000
--- a/patches.renesas/0328-sh_eth-fix-RX-buffer-size-calculation.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 21811e3266aef210fa36e2d86491eafb3769937e Mon Sep 17 00:00:00 2001
-From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Date: Sat, 24 Oct 2015 00:46:40 +0300
-Subject: [PATCH 328/337] sh_eth: fix RX buffer size calculation
-
-The RX buffer size calulation failed to account for the length granularity
-(which is now 32 bytes)...
-
-Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-(cherry picked from commit cb3685958dd4c46d7646d244063ea3ec8adf3618)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/net/ethernet/renesas/sh_eth.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/net/ethernet/renesas/sh_eth.c
-+++ b/drivers/net/ethernet/renesas/sh_eth.c
-@@ -1127,7 +1127,7 @@ static void sh_eth_ring_format(struct ne
- struct sh_eth_txdesc *txdesc = NULL;
- int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring;
- int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring;
-- int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;
-+ int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;
- dma_addr_t dma_addr;
-
- mdp->cur_rx = 0;
-@@ -1451,7 +1451,7 @@ static int sh_eth_rx(struct net_device *
- struct sk_buff *skb;
- u16 pkt_len = 0;
- u32 desc_status;
-- int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;
-+ int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;
- dma_addr_t dma_addr;
-
- boguscnt = min(boguscnt, *quota);
diff --git a/patches.renesas/0329-Revert-staging-board-disable-as-it-breaks-the-build.patch b/patches.renesas/0329-Revert-staging-board-disable-as-it-breaks-the-build.patch
deleted file mode 100644
index 58a89c8655c360..00000000000000
--- a/patches.renesas/0329-Revert-staging-board-disable-as-it-breaks-the-build.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 1b98da6943b450d58df53614e70287e63a64af4e Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 10:38:50 +0200
-Subject: [PATCH 329/337] Revert "staging: board: disable as it breaks the
- build"
-
-This reverts commit d13778d537a0ed6115d2a79a942af999cfb8eec6.
-
-Commit 13c11072536f2613 ("staging:board: remove unnecessary function")
-fixed the build of drivers/staging/board/board.c.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit d4f4708ae0d0e7e99d5d5c42b3b4a317dab3c01b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/staging/board/Kconfig | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/drivers/staging/board/Kconfig b/drivers/staging/board/Kconfig
-index 0a89ad16371f..b8ee81840666 100644
---- a/drivers/staging/board/Kconfig
-+++ b/drivers/staging/board/Kconfig
-@@ -1,7 +1,6 @@
- config STAGING_BOARD
- bool "Staging Board Support"
- depends on OF_ADDRESS
-- depends on BROKEN
- help
- Select to enable per-board staging support code.
-
---
-2.6.2
-
diff --git a/patches.renesas/0330-staging-board-Initialize-staging-board-code-earlier.patch b/patches.renesas/0330-staging-board-Initialize-staging-board-code-earlier.patch
deleted file mode 100644
index b0ed09ba589b97..00000000000000
--- a/patches.renesas/0330-staging-board-Initialize-staging-board-code-earlier.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From ab6532189bffe6d6f4d419bc061f88dd3c4fd588 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 10:38:51 +0200
-Subject: [PATCH 330/337] staging: board: Initialize staging board code earlier
-
-Currently the staging board code is initialized from a late_initcall().
-However, unused PM domains are also disabled from a late_initcall(),
-which happens before due to link order.
-
-Change the initialization of staging board code from using
-late_initcall() to device_initcall() to fix this.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit b0c750f74e10fd30a363bfa3467639f12954effa)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/staging/board/board.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
-index 2390ed6c31a4..e9c914985d4a 100644
---- a/drivers/staging/board/board.h
-+++ b/drivers/staging/board/board.h
-@@ -15,6 +15,6 @@ static int __init runtime_board_check(void) \
- return 0; \
- } \
- \
--late_initcall(runtime_board_check)
-+device_initcall(runtime_board_check)
-
- #endif /* __BOARD_H__ */
---
-2.6.2
-
diff --git a/patches.renesas/0331-staging-board-Add-support-for-translating-hwirq-to-v.patch b/patches.renesas/0331-staging-board-Add-support-for-translating-hwirq-to-v.patch
deleted file mode 100644
index 2152bbcc7909db..00000000000000
--- a/patches.renesas/0331-staging-board-Add-support-for-translating-hwirq-to-v.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From 8dac4c40c97b07db9da18446405626d593d4df3e Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 10:38:52 +0200
-Subject: [PATCH 331/337] staging: board: Add support for translating hwirq to
- virq numbers
-
-As of commit 9a1091ef0017c40a ("irqchip: gic: Support hierarchy irq
-domain."), GIC IRQ numbers are virtual, breaking hardcoded hardware IRQ
-numbers in platform device resources.
-
-Add support for translating hardware IRQ numbers to virtual IRQ numbers,
-and fixing up platform device resources with hardcoded IRQ numbers.
-
-Add a copyright header, including the original author.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit 72ee8626eeb121587d2e3a57d06611d2e0c3cc1b)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/staging/board/board.c | 80 +++++++++++++++++++++++++++++++++++++++++++
- drivers/staging/board/board.h | 5 +++
- 2 files changed, 85 insertions(+)
-
-diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
-index d5a6abc84519..8712f566b311 100644
---- a/drivers/staging/board/board.c
-+++ b/drivers/staging/board/board.c
-@@ -1,10 +1,27 @@
-+/*
-+ * Copyright (C) 2014 Magnus Damm
-+ * Copyright (C) 2015 Glider bvba
-+ *
-+ * 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.
-+ */
-+
-+#define pr_fmt(fmt) "board_staging: " fmt
-+
- #include <linux/init.h>
-+#include <linux/irq.h>
- #include <linux/device.h>
- #include <linux/kernel.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
-+#include <linux/of_irq.h>
-+
- #include "board.h"
-
-+static struct device_node *irqc_node __initdata;
-+static unsigned int irqc_base __initdata;
-+
- static bool find_by_address(u64 base_address)
- {
- struct device_node *dn = of_find_all_nodes(NULL);
-@@ -38,3 +55,66 @@ bool __init board_staging_dt_node_available(const struct resource *resource,
-
- return false; /* Nothing found */
- }
-+
-+int __init board_staging_gic_setup_xlate(const char *gic_match,
-+ unsigned int base)
-+{
-+ WARN_ON(irqc_node);
-+
-+ irqc_node = of_find_compatible_node(NULL, NULL, gic_match);
-+
-+ WARN_ON(!irqc_node);
-+ if (!irqc_node)
-+ return -ENOENT;
-+
-+ irqc_base = base;
-+ return 0;
-+}
-+
-+static void __init gic_fixup_resource(struct resource *res)
-+{
-+ struct of_phandle_args irq_data;
-+ unsigned int hwirq = res->start;
-+ unsigned int virq;
-+
-+ if (resource_type(res) != IORESOURCE_IRQ || !irqc_node)
-+ return;
-+
-+ irq_data.np = irqc_node;
-+ irq_data.args_count = 3;
-+ irq_data.args[0] = 0;
-+ irq_data.args[1] = hwirq - irqc_base;
-+ switch (res->flags &
-+ (IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE |
-+ IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_HIGHLEVEL)) {
-+ case IORESOURCE_IRQ_LOWEDGE:
-+ irq_data.args[2] = IRQ_TYPE_EDGE_FALLING;
-+ break;
-+ case IORESOURCE_IRQ_HIGHEDGE:
-+ irq_data.args[2] = IRQ_TYPE_EDGE_RISING;
-+ break;
-+ case IORESOURCE_IRQ_LOWLEVEL:
-+ irq_data.args[2] = IRQ_TYPE_LEVEL_LOW;
-+ break;
-+ case IORESOURCE_IRQ_HIGHLEVEL:
-+ default:
-+ irq_data.args[2] = IRQ_TYPE_LEVEL_HIGH;
-+ break;
-+ }
-+
-+ virq = irq_create_of_mapping(&irq_data);
-+ if (WARN_ON(!virq))
-+ return;
-+
-+ pr_debug("hwirq %u -> virq %u\n", hwirq, virq);
-+ res->start = virq;
-+}
-+
-+void __init board_staging_gic_fixup_resources(struct resource *res,
-+ unsigned int nres)
-+{
-+ unsigned int i;
-+
-+ for (i = 0; i < nres; i++)
-+ gic_fixup_resource(&res[i]);
-+}
-diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
-index e9c914985d4a..3af6dbe22f91 100644
---- a/drivers/staging/board/board.h
-+++ b/drivers/staging/board/board.h
-@@ -1,10 +1,15 @@
- #ifndef __BOARD_H__
- #define __BOARD_H__
-+
- #include <linux/init.h>
- #include <linux/of.h>
-
-+struct resource;
-+
- bool board_staging_dt_node_available(const struct resource *resource,
- unsigned int num_resources);
-+int board_staging_gic_setup_xlate(const char *gic_match, unsigned int base);
-+void board_staging_gic_fixup_resources(struct resource *res, unsigned int nres);
-
- #define board_staging(str, fn) \
- static int __init runtime_board_check(void) \
---
-2.6.2
-
diff --git a/patches.renesas/0332-staging-board-kzm9d-Translate-hwirq-numbers-to-virq-.patch b/patches.renesas/0332-staging-board-kzm9d-Translate-hwirq-numbers-to-virq-.patch
deleted file mode 100644
index 1efa5fc54f95c1..00000000000000
--- a/patches.renesas/0332-staging-board-kzm9d-Translate-hwirq-numbers-to-virq-.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 7d0ff64bb221d198ac545bac7eabc4002714d362 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 10:38:53 +0200
-Subject: [PATCH 332/337] staging: board: kzm9d: Translate hwirq numbers to
- virq numbers
-
-As of commit 9a1091ef0017c40a ("irqchip: gic: Support hierarchy irq
-domain."), GIC IRQ numbers are virtual, breaking hardcoded hardware IRQ
-numbers in platform device resources.
-
-Translate the hardware IRQ numbers to virtual IRQ numbers to fix this.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit a85890883e18d9b1ab6e500584ee5a4db7d1e39f)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/staging/board/kzm9d.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/staging/board/kzm9d.c b/drivers/staging/board/kzm9d.c
-index 533f3026e17a..8d1eb09bc66e 100644
---- a/drivers/staging/board/kzm9d.c
-+++ b/drivers/staging/board/kzm9d.c
-@@ -4,16 +4,22 @@
- #include <linux/platform_device.h>
- #include "board.h"
-
--static const struct resource usbs1_res[] __initconst = {
-+static struct resource usbs1_res[] __initdata = {
- DEFINE_RES_MEM(0xe2800000, 0x2000),
- DEFINE_RES_IRQ(159),
- };
-
- static void __init kzm9d_init(void)
- {
-- if (!board_staging_dt_node_available(usbs1_res, ARRAY_SIZE(usbs1_res)))
-+ board_staging_gic_setup_xlate("arm,cortex-a9-gic", 32);
-+
-+ if (!board_staging_dt_node_available(usbs1_res,
-+ ARRAY_SIZE(usbs1_res))) {
-+ board_staging_gic_fixup_resources(usbs1_res,
-+ ARRAY_SIZE(usbs1_res));
- platform_device_register_simple("emxx_udc", -1, usbs1_res,
- ARRAY_SIZE(usbs1_res));
-+ }
- }
-
- board_staging("renesas,kzm9d", kzm9d_init);
---
-2.6.2
-
diff --git a/patches.renesas/0333-staging-board-Add-support-for-devices-with-complex-d.patch b/patches.renesas/0333-staging-board-Add-support-for-devices-with-complex-d.patch
deleted file mode 100644
index 890d767a63ed2d..00000000000000
--- a/patches.renesas/0333-staging-board-Add-support-for-devices-with-complex-d.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-From 21051c7ca0f3955ee2242d377c0aa0e9ce6138e3 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 10:38:54 +0200
-Subject: [PATCH 333/337] staging: board: Add support for devices with complex
- dependencies
-
-Add support for easy registering of one ore more platform devices that
-may:
- - need clocks that are described in DT,
- - be part of a PM Domain.
-
-All these dependencies are optional.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit 225d68d852f16369c1f9e61f7aa58cfffcaaff5d)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/staging/board/board.c | 56 +++++++++++++++++++++++++++++++++++++++++++
- drivers/staging/board/board.h | 20 ++++++++++++++++
- 2 files changed, 76 insertions(+)
-
-diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
-index 8712f566b311..29d456e29f38 100644
---- a/drivers/staging/board/board.c
-+++ b/drivers/staging/board/board.c
-@@ -9,6 +9,7 @@
-
- #define pr_fmt(fmt) "board_staging: " fmt
-
-+#include <linux/clkdev.h>
- #include <linux/init.h>
- #include <linux/irq.h>
- #include <linux/device.h>
-@@ -16,6 +17,8 @@
- #include <linux/of.h>
- #include <linux/of_address.h>
- #include <linux/of_irq.h>
-+#include <linux/platform_device.h>
-+#include <linux/pm_domain.h>
-
- #include "board.h"
-
-@@ -118,3 +121,56 @@ void __init board_staging_gic_fixup_resources(struct resource *res,
- for (i = 0; i < nres; i++)
- gic_fixup_resource(&res[i]);
- }
-+
-+int __init board_staging_register_clock(const struct board_staging_clk *bsc)
-+{
-+ int error;
-+
-+ pr_debug("Aliasing clock %s for con_id %s dev_id %s\n", bsc->clk,
-+ bsc->con_id, bsc->dev_id);
-+ error = clk_add_alias(bsc->con_id, bsc->dev_id, bsc->clk, NULL);
-+ if (error)
-+ pr_err("Failed to alias clock %s (%d)\n", bsc->clk, error);
-+
-+ return error;
-+}
-+
-+int __init board_staging_register_device(const struct board_staging_dev *dev)
-+{
-+ struct platform_device *pdev = dev->pdev;
-+ unsigned int i;
-+ int error;
-+
-+ pr_debug("Trying to register device %s\n", pdev->name);
-+ if (board_staging_dt_node_available(pdev->resource,
-+ pdev->num_resources)) {
-+ pr_warn("Skipping %s, already in DT\n", pdev->name);
-+ return -EEXIST;
-+ }
-+
-+ board_staging_gic_fixup_resources(pdev->resource, pdev->num_resources);
-+
-+ for (i = 0; i < dev->nclocks; i++)
-+ board_staging_register_clock(&dev->clocks[i]);
-+
-+ error = platform_device_register(pdev);
-+ if (error) {
-+ pr_err("Failed to register device %s (%d)\n", pdev->name,
-+ error);
-+ return error;
-+ }
-+
-+ if (dev->domain)
-+ __pm_genpd_name_add_device(dev->domain, &pdev->dev, NULL);
-+
-+ return error;
-+}
-+
-+void __init board_staging_register_devices(const struct board_staging_dev *devs,
-+ unsigned int ndevs)
-+{
-+ unsigned int i;
-+
-+ for (i = 0; i < ndevs; i++)
-+ board_staging_register_device(&devs[i]);
-+}
-diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
-index 3af6dbe22f91..42ed12513220 100644
---- a/drivers/staging/board/board.h
-+++ b/drivers/staging/board/board.h
-@@ -4,12 +4,32 @@
- #include <linux/init.h>
- #include <linux/of.h>
-
-+struct board_staging_clk {
-+ const char *clk;
-+ const char *con_id;
-+ const char *dev_id;
-+};
-+
-+struct board_staging_dev {
-+ /* Platform Device */
-+ struct platform_device *pdev;
-+ /* Clocks (optional) */
-+ const struct board_staging_clk *clocks;
-+ unsigned int nclocks;
-+ /* Generic PM Domain (optional) */
-+ const char *domain;
-+};
-+
- struct resource;
-
- bool board_staging_dt_node_available(const struct resource *resource,
- unsigned int num_resources);
- int board_staging_gic_setup_xlate(const char *gic_match, unsigned int base);
- void board_staging_gic_fixup_resources(struct resource *res, unsigned int nres);
-+int board_staging_register_clock(const struct board_staging_clk *bsc);
-+int board_staging_register_device(const struct board_staging_dev *dev);
-+void board_staging_register_devices(const struct board_staging_dev *devs,
-+ unsigned int ndevs);
-
- #define board_staging(str, fn) \
- static int __init runtime_board_check(void) \
---
-2.6.2
-
diff --git a/patches.renesas/0334-staging-board-armadillo800eva-Board-staging-for-sh_m.patch b/patches.renesas/0334-staging-board-armadillo800eva-Board-staging-for-sh_m.patch
deleted file mode 100644
index 60565aa6848629..00000000000000
--- a/patches.renesas/0334-staging-board-armadillo800eva-Board-staging-for-sh_m.patch
+++ /dev/null
@@ -1,152 +0,0 @@
-From 562753b7837e1176fd7762cc8987f33ea7fa9f4f Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Wed, 17 Jun 2015 10:38:55 +0200
-Subject: [PATCH 334/337] staging: board: armadillo800eva: Board staging for
- sh_mobile_lcdc_fb
-
-Add staging board support for the r8a7740-based armadillo800eva board
-and add platform devices to allow in-tree continuous development of the
-drivers on the armadillo800eva board.
-
-When DT bindings are ready for theses drivers then the platform devices
-in the armadillo800eva staging board code can easily be removed. Until
-then we use platform devices to continuously improve the driver and
-integrate code.
-
-Added platform devices:
- - sh_mobile_lcdc_fb for the on-board LCD.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Simon Horman <horms+renesas@verge.net.au>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit 1bbf29ab8f89d2a804e075c4f226a08c1cb7f915)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/staging/board/Makefile | 3 +-
- drivers/staging/board/armadillo800eva.c | 105 ++++++++++++++++++++++++++++++++
- 2 files changed, 107 insertions(+), 1 deletion(-)
- create mode 100644 drivers/staging/board/armadillo800eva.c
-
-diff --git a/drivers/staging/board/Makefile b/drivers/staging/board/Makefile
-index 65d39ecfad63..6842745feb94 100644
---- a/drivers/staging/board/Makefile
-+++ b/drivers/staging/board/Makefile
-@@ -1,2 +1,3 @@
- obj-y := board.o
--obj-$(CONFIG_ARCH_EMEV2) += kzm9d.o
-+obj-$(CONFIG_ARCH_EMEV2) += kzm9d.o
-+obj-$(CONFIG_ARCH_R8A7740) += armadillo800eva.o
-diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c
-new file mode 100644
-index 000000000000..81df77bd55cc
---- /dev/null
-+++ b/drivers/staging/board/armadillo800eva.c
-@@ -0,0 +1,105 @@
-+/*
-+ * Staging board support for Armadillo 800 eva.
-+ * Enable not-yet-DT-capable devices here.
-+ *
-+ * Based on board-armadillo800eva.c
-+ *
-+ * Copyright (C) 2012 Renesas Solutions Corp.
-+ * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; version 2 of the License.
-+ *
-+ * 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/dma-mapping.h>
-+#include <linux/fb.h>
-+#include <linux/kernel.h>
-+#include <linux/platform_device.h>
-+#include <linux/videodev2.h>
-+
-+#include <video/sh_mobile_lcdc.h>
-+
-+#include "board.h"
-+
-+
-+static struct fb_videomode lcdc0_mode = {
-+ .name = "AMPIER/AM-800480",
-+ .xres = 800,
-+ .yres = 480,
-+ .left_margin = 88,
-+ .right_margin = 40,
-+ .hsync_len = 128,
-+ .upper_margin = 20,
-+ .lower_margin = 5,
-+ .vsync_len = 5,
-+ .sync = 0,
-+};
-+
-+static struct sh_mobile_lcdc_info lcdc0_info = {
-+ .clock_source = LCDC_CLK_BUS,
-+ .ch[0] = {
-+ .chan = LCDC_CHAN_MAINLCD,
-+ .fourcc = V4L2_PIX_FMT_RGB565,
-+ .interface_type = RGB24,
-+ .clock_divider = 5,
-+ .flags = 0,
-+ .lcd_modes = &lcdc0_mode,
-+ .num_modes = 1,
-+ .panel_cfg = {
-+ .width = 111,
-+ .height = 68,
-+ },
-+ },
-+};
-+
-+static struct resource lcdc0_resources[] = {
-+ [0] = {
-+ .name = "LCD0",
-+ .start = 0xfe940000,
-+ .end = 0xfe943fff,
-+ .flags = IORESOURCE_MEM,
-+ },
-+ [1] = {
-+ .start = 177 + 32,
-+ .flags = IORESOURCE_IRQ,
-+ },
-+};
-+
-+static struct platform_device lcdc0_device = {
-+ .name = "sh_mobile_lcdc_fb",
-+ .num_resources = ARRAY_SIZE(lcdc0_resources),
-+ .resource = lcdc0_resources,
-+ .id = 0,
-+ .dev = {
-+ .platform_data = &lcdc0_info,
-+ .coherent_dma_mask = DMA_BIT_MASK(32),
-+ },
-+};
-+
-+static const struct board_staging_clk lcdc0_clocks[] __initconst = {
-+ { "lcdc0", NULL, "sh_mobile_lcdc_fb.0" },
-+};
-+
-+static const struct board_staging_dev armadillo800eva_devices[] __initconst = {
-+ {
-+ .pdev = &lcdc0_device,
-+ .clocks = lcdc0_clocks,
-+ .nclocks = ARRAY_SIZE(lcdc0_clocks),
-+ .domain = "a4lc",
-+ },
-+};
-+
-+static void __init armadillo800eva_init(void)
-+{
-+ board_staging_gic_setup_xlate("arm,cortex-a9-gic", 32);
-+ board_staging_register_devices(armadillo800eva_devices,
-+ ARRAY_SIZE(armadillo800eva_devices));
-+}
-+
-+board_staging("renesas,armadillo800eva", armadillo800eva_init);
---
-2.6.2
-
diff --git a/patches.renesas/0335-staging-make-board-support-depend-on-OF_IRQ-and-CLKD.patch b/patches.renesas/0335-staging-make-board-support-depend-on-OF_IRQ-and-CLKD.patch
deleted file mode 100644
index 09764bf23f38dc..00000000000000
--- a/patches.renesas/0335-staging-make-board-support-depend-on-OF_IRQ-and-CLKD.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 143fd1b12eac7db92e323b220dbbc15772991243 Mon Sep 17 00:00:00 2001
-From: Paul Gortmaker <paul.gortmaker@windriver.com>
-Date: Sat, 20 Jun 2015 19:28:23 -0400
-Subject: [PATCH 335/337] staging: make board support depend on OF_IRQ and
- CLKDEV_LOOKUP
-
-Building allmodconfig for arch/cris currently fails with:
-
-drivers/built-in.o: In function `board_staging_register_clock':
-drivers/staging/board/board.c:131: undefined reference to `clk_add_alias'
-make: *** [vmlinux] Error 1
-
-The clk_add_alias lives in drivers/clk/clkdev.c and that file
-is only compiled for CONFIG_CLKDEV_LOOKUP, so it would seem
-we need to add a dependency on that.
-
-Geert also reported seeing this in his build coverage:
-
- There seems to be another missing dependency on OF_IRQ:
-
- drivers/built-in.o: In function `board_staging_gic_fixup_resources':
- (.init.text+0x21c2): undefined reference to `irq_create_of_mapping'
-
-so we might as well fix that at the same time since it is
-on the same line.
-
-Cc: Magnus Damm <damm+renesas@opensource.se>
-Cc: Simon Horman <horms+renesas@verge.net.au>
-Cc: Geert Uytterhoeven <geert+renesas@glider.be>
-Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
-Cc: Stephen Rothwell <sfr@canb.auug.org.au>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-(cherry picked from commit 59b750006ae252b90aaab1fc6efcdb64976baa24)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/staging/board/Kconfig | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/staging/board/Kconfig b/drivers/staging/board/Kconfig
-index b8ee81840666..3f287c48e082 100644
---- a/drivers/staging/board/Kconfig
-+++ b/drivers/staging/board/Kconfig
-@@ -1,6 +1,6 @@
- config STAGING_BOARD
- bool "Staging Board Support"
-- depends on OF_ADDRESS
-+ depends on OF_ADDRESS && OF_IRQ && CLKDEV_LOOKUP
- help
- Select to enable per-board staging support code.
-
---
-2.6.2
-
diff --git a/patches.renesas/0336-staging-board-Migrate-away-from-__pm_genpd_name_add_.patch b/patches.renesas/0336-staging-board-Migrate-away-from-__pm_genpd_name_add_.patch
deleted file mode 100644
index c373c8c7d0e9e9..00000000000000
--- a/patches.renesas/0336-staging-board-Migrate-away-from-__pm_genpd_name_add_.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From ad7f6a9882c65821cb2fec380d7509da3bbd2ba6 Mon Sep 17 00:00:00 2001
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 8 Sep 2015 19:06:03 +0200
-Subject: [PATCH 336/337] staging: board: Migrate away from
- __pm_genpd_name_add_device()
-
-The named genpd APIs are deprecated. Hence convert the board staging
-code from using genpd names to DT node paths.
-
-For now this supports PM domains with "#power-domain-cells = <0>" only.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-(cherry picked from commit f33b77408a91d4427374010897b90af678dc47be)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
----
- drivers/staging/board/armadillo800eva.c | 2 +-
- drivers/staging/board/board.c | 36 ++++++++++++++++++++++++++++++++-
- 2 files changed, 36 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c
-index 81df77bd55cc..9c41652ee908 100644
---- a/drivers/staging/board/armadillo800eva.c
-+++ b/drivers/staging/board/armadillo800eva.c
-@@ -91,7 +91,7 @@ static const struct board_staging_dev armadillo800eva_devices[] __initconst = {
- .pdev = &lcdc0_device,
- .clocks = lcdc0_clocks,
- .nclocks = ARRAY_SIZE(lcdc0_clocks),
-- .domain = "a4lc",
-+ .domain = "/system-controller@e6180000/pm-domains/c5/a4lc@1"
- },
- };
-
-diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
-index 29d456e29f38..3eb5eb8f069c 100644
---- a/drivers/staging/board/board.c
-+++ b/drivers/staging/board/board.c
-@@ -135,6 +135,40 @@ int __init board_staging_register_clock(const struct board_staging_clk *bsc)
- return error;
- }
-
-+#ifdef CONFIG_PM_GENERIC_DOMAINS_OF
-+static int board_staging_add_dev_domain(struct platform_device *pdev,
-+ const char *domain)
-+{
-+ struct of_phandle_args pd_args;
-+ struct generic_pm_domain *pd;
-+ struct device_node *np;
-+
-+ np = of_find_node_by_path(domain);
-+ if (!np) {
-+ pr_err("Cannot find domain node %s\n", domain);
-+ return -ENOENT;
-+ }
-+
-+ pd_args.np = np;
-+ pd_args.args_count = 0;
-+ pd = of_genpd_get_from_provider(&pd_args);
-+ if (IS_ERR(pd)) {
-+ pr_err("Cannot find genpd %s (%ld)\n", domain, PTR_ERR(pd));
-+ return PTR_ERR(pd);
-+
-+ }
-+ pr_debug("Found genpd %s for device %s\n", pd->name, pdev->name);
-+
-+ return pm_genpd_add_device(pd, &pdev->dev);
-+}
-+#else
-+static inline int board_staging_add_dev_domain(struct platform_device *pdev,
-+ const char *domain)
-+{
-+ return 0;
-+}
-+#endif
-+
- int __init board_staging_register_device(const struct board_staging_dev *dev)
- {
- struct platform_device *pdev = dev->pdev;
-@@ -161,7 +195,7 @@ int __init board_staging_register_device(const struct board_staging_dev *dev)
- }
-
- if (dev->domain)
-- __pm_genpd_name_add_device(dev->domain, &pdev->dev, NULL);
-+ board_staging_add_dev_domain(pdev, dev->domain);
-
- return error;
- }
---
-2.6.2
-
diff --git a/patches.renesas/0337-ARM-dts-fix-gpio-keys-wakeup-source-property.patch b/patches.renesas/0337-ARM-dts-fix-gpio-keys-wakeup-source-property.patch
deleted file mode 100644
index 3e7670af10095b..00000000000000
--- a/patches.renesas/0337-ARM-dts-fix-gpio-keys-wakeup-source-property.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-From 8155a2adb0f00e3cead8fbb2ca00f91e7bbdc63d Mon Sep 17 00:00:00 2001
-From: Sudeep Holla <sudeep.holla@arm.com>
-Date: Fri, 16 Oct 2015 17:01:36 +0100
-Subject: [PATCH 337/337] ARM: dts: fix gpio-keys wakeup-source property
-
-The keyboard driver for GPIO buttons(gpio-keys) checks for one of the
-two boolean properties to enable gpio buttons as wakeup source:
-1. "wakeup-source" or
-2. the legacy "gpio-key,wakeup"
-
-However juno, ste-snowball and emev2-kzm9d dts file have a undetected
-"wakeup" property to indictate the wakeup source.
-
-This patch fixes it by making use of "wakeup-source" property.
-
-Cc: Magnus Damm <magnus.damm@gmail.com>
-Acked-by: Simon Horman <horms@verge.net.au>
-Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
-Signed-off-by: Olof Johansson <olof@lixom.net>
-(cherry picked from commit 4db7062c9a8bff92137bb2f381d81dd1bb5b7872)
-Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-
-Conflicts:
- arch/arm64/boot/dts/arm/juno-motherboard.dtsi
----
- arch/arm/boot/dts/emev2-kzm9d.dts | 8 ++++----
- arch/arm/boot/dts/ste-snowball.dts | 10 +++++-----
- 2 files changed, 9 insertions(+), 9 deletions(-)
-
-diff --git a/arch/arm/boot/dts/emev2-kzm9d.dts b/arch/arm/boot/dts/emev2-kzm9d.dts
-index 955c24ee4a8c..8c24975e8f9d 100644
---- a/arch/arm/boot/dts/emev2-kzm9d.dts
-+++ b/arch/arm/boot/dts/emev2-kzm9d.dts
-@@ -35,28 +35,28 @@
-
- button@1 {
- debounce_interval = <50>;
-- wakeup = <1>;
-+ wakeup-source;
- label = "DSW2-1";
- linux,code = <KEY_1>;
- gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
- };
- button@2 {
- debounce_interval = <50>;
-- wakeup = <1>;
-+ wakeup-source;
- label = "DSW2-2";
- linux,code = <KEY_2>;
- gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
- };
- button@3 {
- debounce_interval = <50>;
-- wakeup = <1>;
-+ wakeup-source;
- label = "DSW2-3";
- linux,code = <KEY_3>;
- gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
- };
- button@4 {
- debounce_interval = <50>;
-- wakeup = <1>;
-+ wakeup-source;
- label = "DSW2-4";
- linux,code = <KEY_4>;
- gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
-diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
-index 1bc84ebdccaa..66ec8bc48891 100644
---- a/arch/arm/boot/dts/ste-snowball.dts
-+++ b/arch/arm/boot/dts/ste-snowball.dts
-@@ -40,35 +40,35 @@
-
- button@1 {
- debounce_interval = <50>;
-- wakeup = <1>;
-+ wakeup-source;
- linux,code = <2>;
- label = "userpb";
- gpios = <&gpio1 0 0x4>;
- };
- button@2 {
- debounce_interval = <50>;
-- wakeup = <1>;
-+ wakeup-source;
- linux,code = <3>;
- label = "extkb1";
- gpios = <&gpio4 23 0x4>;
- };
- button@3 {
- debounce_interval = <50>;
-- wakeup = <1>;
-+ wakeup-source;
- linux,code = <4>;
- label = "extkb2";
- gpios = <&gpio4 24 0x4>;
- };
- button@4 {
- debounce_interval = <50>;
-- wakeup = <1>;
-+ wakeup-source;
- linux,code = <5>;
- label = "extkb3";
- gpios = <&gpio5 1 0x4>;
- };
- button@5 {
- debounce_interval = <50>;
-- wakeup = <1>;
-+ wakeup-source;
- linux,code = <6>;
- label = "extkb4";
- gpios = <&gpio5 2 0x4>;
---
-2.6.2
-
diff --git a/patches.renesas/clkdev-const-ify-connection-id-to-clk_add_alias.patch b/patches.renesas/clkdev-const-ify-connection-id-to-clk_add_alias.patch
deleted file mode 100644
index 8fc80e2d89cb2a..00000000000000
--- a/patches.renesas/clkdev-const-ify-connection-id-to-clk_add_alias.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From geert@linux-m68k.org Tue Dec 8 09:38:03 2015
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 8 Dec 2015 18:37:39 +0100
-Subject: [PATCH 3/5] clkdev: const-ify connection id to clk_add_alias()
-To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Cc: Simon Horman <horms@verge.net.au>, Magnus Damm <magnus.damm@gmail.com>, ltsi-dev@lists.linuxfoundation.org, Russell King <rmk+kernel@arm.linux.org.uk>, Geert Uytterhoeven <geert+renesas@glider.be>
-Message-ID: <1449596261-31005-4-git-send-email-geert+renesas@glider.be>
-
-
-From: Russell King <rmk+kernel@arm.linux.org.uk>
-
-The connection id is only passed to clk_get() which is already const.
-Const-ify this argument too.
-
-Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-(cherry picked from commit b3d8d7e89fab374d731dfb46fe048f09766ca9c8)
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
----
- drivers/clk/clkdev.c | 6 +++---
- include/linux/clkdev.h | 2 +-
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
---- a/drivers/clk/clkdev.c
-+++ b/drivers/clk/clkdev.c
-@@ -288,10 +288,10 @@ clkdev_alloc(struct clk *clk, const char
- }
- EXPORT_SYMBOL(clkdev_alloc);
-
--int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
-- struct device *dev)
-+int clk_add_alias(const char *alias, const char *alias_dev_name,
-+ const char *con_id, struct device *dev)
- {
-- struct clk *r = clk_get(dev, id);
-+ struct clk *r = clk_get(dev, con_id);
- struct clk_lookup *l;
-
- if (IS_ERR(r))
---- a/include/linux/clkdev.h
-+++ b/include/linux/clkdev.h
-@@ -39,7 +39,7 @@ void clkdev_add(struct clk_lookup *cl);
- void clkdev_drop(struct clk_lookup *cl);
-
- void clkdev_add_table(struct clk_lookup *, size_t);
--int clk_add_alias(const char *, const char *, char *, struct device *);
-+int clk_add_alias(const char *, const char *, const char *, struct device *);
-
- int clk_register_clkdev(struct clk *, const char *, const char *, ...);
- int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t);
diff --git a/patches.renesas/clkdev-get-rid-of-redundant-clk_add_alias-prototype-in-linux-clk.h.patch b/patches.renesas/clkdev-get-rid-of-redundant-clk_add_alias-prototype-in-linux-clk.h.patch
deleted file mode 100644
index 251052df5854ad..00000000000000
--- a/patches.renesas/clkdev-get-rid-of-redundant-clk_add_alias-prototype-in-linux-clk.h.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From geert@linux-m68k.org Tue Dec 8 09:38:05 2015
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 8 Dec 2015 18:37:40 +0100
-Subject: [PATCH 4/5] clkdev: get rid of redundant clk_add_alias() prototype in linux/clk.h
-To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Cc: Simon Horman <horms@verge.net.au>, Magnus Damm <magnus.damm@gmail.com>, ltsi-dev@lists.linuxfoundation.org, Russell King <rmk+kernel@arm.linux.org.uk>, Geert Uytterhoeven <geert+renesas@glider.be>
-Message-ID: <1449596261-31005-5-git-send-email-geert+renesas@glider.be>
-
-
-From: Russell King <rmk+kernel@arm.linux.org.uk>
-
-clk_add_alias() is provided by clkdev, and is not part of the clk API.
-Howver, it is prototyped in two locations: linux/clkdev.h and
-linux/clk.h. This is a mess. Get rid of the redundant and unnecessary
-version in linux/clk.h.
-
-Acked-by: Tony Lindgren <tony@atomide.com>
-Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
-Acked-by: Sekhar Nori <nsekhar@ti.com>
-Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-(cherry picked from commit 2d34e507293102f29ee94d9a9c5b890696d42452)
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
----
- arch/arm/mach-davinci/da850.c | 1 +
- arch/arm/mach-omap1/board-nokia770.c | 2 +-
- arch/arm/mach-pxa/eseries.c | 1 +
- arch/arm/mach-pxa/lubbock.c | 1 +
- arch/arm/mach-pxa/tosa.c | 1 +
- include/linux/clk.h | 13 -------------
- 6 files changed, 5 insertions(+), 14 deletions(-)
-
---- a/arch/arm/mach-davinci/da850.c
-+++ b/arch/arm/mach-davinci/da850.c
-@@ -11,6 +11,7 @@
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-+#include <linux/clkdev.h>
- #include <linux/gpio.h>
- #include <linux/init.h>
- #include <linux/clk.h>
---- a/arch/arm/mach-omap1/board-nokia770.c
-+++ b/arch/arm/mach-omap1/board-nokia770.c
-@@ -7,6 +7,7 @@
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-+#include <linux/clkdev.h>
- #include <linux/irq.h>
- #include <linux/gpio.h>
- #include <linux/kernel.h>
-@@ -14,7 +15,6 @@
- #include <linux/mutex.h>
- #include <linux/platform_device.h>
- #include <linux/input.h>
--#include <linux/clk.h>
- #include <linux/omapfb.h>
-
- #include <linux/spi/spi.h>
---- a/arch/arm/mach-pxa/eseries.c
-+++ b/arch/arm/mach-pxa/eseries.c
-@@ -10,6 +10,7 @@
- *
- */
-
-+#include <linux/clkdev.h>
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/gpio.h>
---- a/arch/arm/mach-pxa/lubbock.c
-+++ b/arch/arm/mach-pxa/lubbock.c
-@@ -11,6 +11,7 @@
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-+#include <linux/clkdev.h>
- #include <linux/gpio.h>
- #include <linux/gpio/machine.h>
- #include <linux/module.h>
---- a/arch/arm/mach-pxa/tosa.c
-+++ b/arch/arm/mach-pxa/tosa.c
-@@ -12,6 +12,7 @@
- *
- */
-
-+#include <linux/clkdev.h>
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/platform_device.h>
---- a/include/linux/clk.h
-+++ b/include/linux/clk.h
-@@ -471,19 +471,6 @@ static inline void clk_disable_unprepare
- clk_unprepare(clk);
- }
-
--/**
-- * clk_add_alias - add a new clock alias
-- * @alias: name for clock alias
-- * @alias_dev_name: device name
-- * @id: platform specific clock name
-- * @dev: device
-- *
-- * Allows using generic clock names for drivers by adding a new alias.
-- * Assumes clkdev, see clkdev.h for more info.
-- */
--int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
-- struct device *dev);
--
- struct device_node;
- struct of_phandle_args;
-
diff --git a/patches.renesas/clkdev-use-clk_hw-internally.patch b/patches.renesas/clkdev-use-clk_hw-internally.patch
deleted file mode 100644
index 30849357726b19..00000000000000
--- a/patches.renesas/clkdev-use-clk_hw-internally.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From geert@linux-m68k.org Tue Dec 8 09:38:00 2015
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 8 Dec 2015 18:37:38 +0100
-Subject: [PATCH 2/5] clkdev: use clk_hw internally
-To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Cc: Simon Horman <horms@verge.net.au>, Magnus Damm <magnus.damm@gmail.com>, ltsi-dev@lists.linuxfoundation.org, Russell King <rmk+kernel@arm.linux.org.uk>, Geert Uytterhoeven <geert+renesas@glider.be>
-Message-ID: <1449596261-31005-3-git-send-email-geert+renesas@glider.be>
-
-
-From: Russell King <rmk+kernel@arm.linux.org.uk>
-
-clk_add_alias() calls clk_get() followed by clk_put() but in between
-those two calls it saves away the struct clk pointer to a clk_lookup
-structure. This leaves the 'clk' member of the clk_lookup pointing at
-freed memory on configurations where CONFIG_COMMON_CLK=y. This is a
-problem because clk_get_sys() will eventually try to dereference the
-freed pointer by calling __clk_get_hw() on it. Fix this by saving away
-the struct clk_hw pointer instead of the struct clk pointer so that when
-we try to create a per-user struct clk in clk_get_sys() we don't
-dereference a junk pointer.
-
-Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-(cherry picked from commit d5622a9c13752be46e6fcde9d31391ce0bb0598b)
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
----
- drivers/clk/clkdev.c | 24 ++++++++++++++++--------
- include/linux/clkdev.h | 1 +
- 2 files changed, 17 insertions(+), 8 deletions(-)
-
---- a/drivers/clk/clkdev.c
-+++ b/drivers/clk/clkdev.c
-@@ -177,7 +177,7 @@ struct clk *clk_get_sys(const char *dev_
- if (!cl)
- goto out;
-
-- clk = __clk_create_clk(__clk_get_hw(cl->clk), dev_id, con_id);
-+ clk = __clk_create_clk(cl->clk_hw, dev_id, con_id);
- if (IS_ERR(clk))
- goto out;
-
-@@ -215,18 +215,26 @@ void clk_put(struct clk *clk)
- }
- EXPORT_SYMBOL(clk_put);
-
--void clkdev_add(struct clk_lookup *cl)
-+static void __clkdev_add(struct clk_lookup *cl)
- {
- mutex_lock(&clocks_mutex);
- list_add_tail(&cl->node, &clocks);
- mutex_unlock(&clocks_mutex);
- }
-+
-+void clkdev_add(struct clk_lookup *cl)
-+{
-+ if (!cl->clk_hw)
-+ cl->clk_hw = __clk_get_hw(cl->clk);
-+ __clkdev_add(cl);
-+}
- EXPORT_SYMBOL(clkdev_add);
-
- void __init clkdev_add_table(struct clk_lookup *cl, size_t num)
- {
- mutex_lock(&clocks_mutex);
- while (num--) {
-+ cl->clk_hw = __clk_get_hw(cl->clk);
- list_add_tail(&cl->node, &clocks);
- cl++;
- }
-@@ -243,7 +251,7 @@ struct clk_lookup_alloc {
- };
-
- static struct clk_lookup * __init_refok
--vclkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt,
-+vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
- va_list ap)
- {
- struct clk_lookup_alloc *cla;
-@@ -252,7 +260,7 @@ vclkdev_alloc(struct clk *clk, const cha
- if (!cla)
- return NULL;
-
-- cla->cl.clk = clk;
-+ cla->cl.clk_hw = hw;
- if (con_id) {
- strlcpy(cla->con_id, con_id, sizeof(cla->con_id));
- cla->cl.con_id = cla->con_id;
-@@ -273,7 +281,7 @@ clkdev_alloc(struct clk *clk, const char
- va_list ap;
-
- va_start(ap, dev_fmt);
-- cl = vclkdev_alloc(clk, con_id, dev_fmt, ap);
-+ cl = vclkdev_alloc(__clk_get_hw(clk), con_id, dev_fmt, ap);
- va_end(ap);
-
- return cl;
-@@ -334,7 +342,7 @@ int clk_register_clkdev(struct clk *clk,
- return PTR_ERR(clk);
-
- va_start(ap, dev_fmt);
-- cl = vclkdev_alloc(clk, con_id, dev_fmt, ap);
-+ cl = vclkdev_alloc(__clk_get_hw(clk), con_id, dev_fmt, ap);
- va_end(ap);
-
- if (!cl)
-@@ -365,8 +373,8 @@ int clk_register_clkdevs(struct clk *clk
- return PTR_ERR(clk);
-
- for (i = 0; i < num; i++, cl++) {
-- cl->clk = clk;
-- clkdev_add(cl);
-+ cl->clk_hw = __clk_get_hw(clk);
-+ __clkdev_add(cl);
- }
-
- return 0;
---- a/include/linux/clkdev.h
-+++ b/include/linux/clkdev.h
-@@ -22,6 +22,7 @@ struct clk_lookup {
- const char *dev_id;
- const char *con_id;
- struct clk *clk;
-+ struct clk_hw *clk_hw;
- };
-
- #define CLKDEV_INIT(d, n, c) \
diff --git a/patches.renesas/clockevents-drivers-sh_cmt-only-perform-clocksource-suspend-resume-if-enabled.patch b/patches.renesas/clockevents-drivers-sh_cmt-only-perform-clocksource-suspend-resume-if-enabled.patch
deleted file mode 100644
index c92f0a2c2b8d56..00000000000000
--- a/patches.renesas/clockevents-drivers-sh_cmt-only-perform-clocksource-suspend-resume-if-enabled.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-From geert@linux-m68k.org Tue Dec 8 09:38:00 2015
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 8 Dec 2015 18:37:37 +0100
-Subject: [PATCH 1/5] clockevents/drivers/sh_cmt: Only perform clocksource suspend/resume if enabled
-To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Cc: Simon Horman <horms@verge.net.au>, Magnus Damm <magnus.damm@gmail.com>, ltsi-dev@lists.linuxfoundation.org, Geert Uytterhoeven <geert+renesas@glider.be>, Daniel Lezcano <daniel.lezcano@linaro.org>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>
-Message-ID: <1449596261-31005-2-git-send-email-geert+renesas@glider.be>
-
-
-Currently the sh_cmt clocksource timer is disabled or enabled
-unconditionally on clocksource suspend resp. resume, even if a
-better clocksource is present (e.g. arch_sys_counter) and the
-sh_cmt clocksource is not enabled.
-
-As sh_cmt is a syscore device when its timer is enabled, this
-may lead to a genpd.prepared_count imbalance in the presence of
-PM Domains, which may cause a lock-up during reboot after s2ram.
-
-During suspend:
- - pm_genpd_prepare() is called for all non-syscore devices (incl.
- sh_cmt), increasing genpd.prepared_count for each device,
- - clocksource.suspend() is called for all clocksource devices,
- - sh_cmt_clocksource_suspend() calls sh_cmt_stop(), which is a no-op
- as the clocksource was not enabled.
-
-During resume:
- - clocksource.resume() is called for all clocksource devices,
- - sh_cmt_clocksource_resume() calls sh_cmt_start(), which enables the
- clocksource timer, and turns sh_cmt into a syscore device,
- - pm_genpd_complete() is called for all non-syscore devices (excl.
- sh_cmt now!), decreasing genpd.prepared_count for each device but
- sh_cmt.
-
-Now genpd.prepared_count of the PM Domain containing sh_cmt is
-still 1 instead of zero. On subsequent suspend/resume cycles,
-sh_cmt is still a syscore device, hence it's skipped for
-pm_genpd_{prepare,complete}(), keeping the imbalance of
-genpd.prepared_count at 1.
-
-During reboot:
-
- - platform_drv_shutdown() is called for any platform device that has
- a driver with a .shutdown() method (only rcar-dmac on R-Car Gen2),
-
- - platform_drv_shutdown() calls dev_pm_domain_detach(), which
- calls genpd_dev_pm_detach(),
-
- - genpd_dev_pm_detach() keeps calling pm_genpd_remove_device() until
- it doesn't return -EAGAIN[*],
-
- - If the device is part of the same PM Domain as sh_cmt,
- pm_genpd_remove_device() always fails with -EAGAIN due to
- genpd.prepared_count > 0.
-
- - Infinite loop in genpd_dev_pm_detach()[*].
-
-[*] Commit 93af5e9354432828 ("PM / Domains: Avoid infinite loops in
- attach/detach code") already limited the number of loop iterations,
- avoiding the lock-up.
-
-To fix this, only disable or enable the clocksource timer on
-clocksource suspend resp. resume if the clocksource was enabled.
-
-This was tested on r8a7791/koelsch with the CPG Clock Domain:
-
- - using arch_sys_counter as the clocksource, which is the default, and
- which showed the problem,
-
- - using sh_cmt as a clocksource ("echo ffca0000.timer > \
- /sys/devices/system/clocksource/clocksource0/current_clocksource"),
- which behaves the same as before.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Link: http://lkml.kernel.org/r/1438875126-12596-2-git-send-email-daniel.lezcano@linaro.org
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-(cherry picked from commit 54d46b7fbcbd00fe4b20a27208e5909facc714e3)
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
----
- drivers/clocksource/sh_cmt.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
---- a/drivers/clocksource/sh_cmt.c
-+++ b/drivers/clocksource/sh_cmt.c
-@@ -661,6 +661,9 @@ static void sh_cmt_clocksource_suspend(s
- {
- struct sh_cmt_channel *ch = cs_to_sh_cmt(cs);
-
-+ if (!ch->cs_enabled)
-+ return;
-+
- sh_cmt_stop(ch, FLAG_CLOCKSOURCE);
- pm_genpd_syscore_poweroff(&ch->cmt->pdev->dev);
- }
-@@ -669,6 +672,9 @@ static void sh_cmt_clocksource_resume(st
- {
- struct sh_cmt_channel *ch = cs_to_sh_cmt(cs);
-
-+ if (!ch->cs_enabled)
-+ return;
-+
- pm_genpd_syscore_poweron(&ch->cmt->pdev->dev);
- sh_cmt_start(ch, FLAG_CLOCKSOURCE);
- }
diff --git a/patches.renesas/pm-domains-skip-timings-during-syscore-suspend-resume.patch b/patches.renesas/pm-domains-skip-timings-during-syscore-suspend-resume.patch
deleted file mode 100644
index 46f5eedd3c77a9..00000000000000
--- a/patches.renesas/pm-domains-skip-timings-during-syscore-suspend-resume.patch
+++ /dev/null
@@ -1,215 +0,0 @@
-From geert@linux-m68k.org Tue Dec 8 09:38:07 2015
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-Date: Tue, 8 Dec 2015 18:37:41 +0100
-Subject: [PATCH 5/5] PM / Domains: Skip timings during syscore suspend/resume
-To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Cc: Simon Horman <horms@verge.net.au>, Magnus Damm <magnus.damm@gmail.com>, ltsi-dev@lists.linuxfoundation.org, Geert Uytterhoeven <geert+renesas@glider.be>, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
-Message-ID: <1449596261-31005-6-git-send-email-geert+renesas@glider.be>
-
-
-The PM Domain code uses ktime_get() to perform various latency
-measurements. However, if ktime_get() is called while timekeeping is
-suspended, the following warning is printed:
-
- WARNING: CPU: 0 PID: 1340 at kernel/time/timekeeping.c:576 ktime_get+0x3
-
-This happens when resuming the PM Domain that contains the clock events
-source, which calls pm_genpd_syscore_poweron(). Chain of operations is:
-
- timekeeping_resume()
- {
- clockevents_resume()
- sh_cmt_clock_event_resume()
- pm_genpd_syscore_poweron()
- pm_genpd_sync_poweron()
- genpd_syscore_switch()
- genpd_power_on()
- ktime_get(), but timekeeping_suspended == 1
- ...
- timekeeping_suspended = 0;
- }
-
-Fix this by adding a "timed" parameter to genpd_power_{on,off}() and
-pm_genpd_sync_power{off,on}(), to indicate whether latency measurements
-are allowed. This parameter is passed as false in
-genpd_syscore_switch() (i.e. during syscore suspend/resume), and true in
-all other cases.
-
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-(cherry picked from commit a4630c61274322eda7c4a4d17051f7c72a9e03b1)
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
----
- drivers/base/power/domain.c | 42 ++++++++++++++++++++++++++----------------
- 1 file changed, 26 insertions(+), 16 deletions(-)
-
---- a/drivers/base/power/domain.c
-+++ b/drivers/base/power/domain.c
-@@ -181,7 +181,7 @@ static void genpd_recalc_cpu_exit_latenc
- genpd->cpuidle_data->idle_state->exit_latency = usecs64;
- }
-
--static int genpd_power_on(struct generic_pm_domain *genpd)
-+static int genpd_power_on(struct generic_pm_domain *genpd, bool timed)
- {
- ktime_t time_start;
- s64 elapsed_ns;
-@@ -190,6 +190,9 @@ static int genpd_power_on(struct generic
- if (!genpd->power_on)
- return 0;
-
-+ if (!timed)
-+ return genpd->power_on(genpd);
-+
- time_start = ktime_get();
- ret = genpd->power_on(genpd);
- if (ret)
-@@ -208,7 +211,7 @@ static int genpd_power_on(struct generic
- return ret;
- }
-
--static int genpd_power_off(struct generic_pm_domain *genpd)
-+static int genpd_power_off(struct generic_pm_domain *genpd, bool timed)
- {
- ktime_t time_start;
- s64 elapsed_ns;
-@@ -217,6 +220,9 @@ static int genpd_power_off(struct generi
- if (!genpd->power_off)
- return 0;
-
-+ if (!timed)
-+ return genpd->power_off(genpd);
-+
- time_start = ktime_get();
- ret = genpd->power_off(genpd);
- if (ret == -EBUSY)
-@@ -305,7 +311,7 @@ static int __pm_genpd_poweron(struct gen
- }
- }
-
-- ret = genpd_power_on(genpd);
-+ ret = genpd_power_on(genpd, true);
- if (ret)
- goto err;
-
-@@ -615,7 +621,7 @@ static int pm_genpd_poweroff(struct gene
- * the pm_genpd_poweron() restore power for us (this shouldn't
- * happen very often).
- */
-- ret = genpd_power_off(genpd);
-+ ret = genpd_power_off(genpd, true);
- if (ret == -EBUSY) {
- genpd_set_active(genpd);
- goto out;
-@@ -827,6 +833,7 @@ static bool genpd_dev_active_wakeup(stru
- /**
- * pm_genpd_sync_poweroff - Synchronously power off a PM domain and its masters.
- * @genpd: PM domain to power off, if possible.
-+ * @timed: True if latency measurements are allowed.
- *
- * Check if the given PM domain can be powered off (during system suspend or
- * hibernation) and do that if so. Also, in that case propagate to its masters.
-@@ -836,7 +843,8 @@ static bool genpd_dev_active_wakeup(stru
- * executed sequentially, so it is guaranteed that it will never run twice in
- * parallel).
- */
--static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd)
-+static void pm_genpd_sync_poweroff(struct generic_pm_domain *genpd,
-+ bool timed)
- {
- struct gpd_link *link;
-
-@@ -847,26 +855,28 @@ static void pm_genpd_sync_poweroff(struc
- || atomic_read(&genpd->sd_count) > 0)
- return;
-
-- genpd_power_off(genpd);
-+ genpd_power_off(genpd, timed);
-
- genpd->status = GPD_STATE_POWER_OFF;
-
- list_for_each_entry(link, &genpd->slave_links, slave_node) {
- genpd_sd_counter_dec(link->master);
-- pm_genpd_sync_poweroff(link->master);
-+ pm_genpd_sync_poweroff(link->master, timed);
- }
- }
-
- /**
- * pm_genpd_sync_poweron - Synchronously power on a PM domain and its masters.
- * @genpd: PM domain to power on.
-+ * @timed: True if latency measurements are allowed.
- *
- * This function is only called in "noirq" and "syscore" stages of system power
- * transitions, so it need not acquire locks (all of the "noirq" callbacks are
- * executed sequentially, so it is guaranteed that it will never run twice in
- * parallel).
- */
--static void pm_genpd_sync_poweron(struct generic_pm_domain *genpd)
-+static void pm_genpd_sync_poweron(struct generic_pm_domain *genpd,
-+ bool timed)
- {
- struct gpd_link *link;
-
-@@ -874,11 +884,11 @@ static void pm_genpd_sync_poweron(struct
- return;
-
- list_for_each_entry(link, &genpd->slave_links, slave_node) {
-- pm_genpd_sync_poweron(link->master);
-+ pm_genpd_sync_poweron(link->master, timed);
- genpd_sd_counter_inc(link->master);
- }
-
-- genpd_power_on(genpd);
-+ genpd_power_on(genpd, timed);
-
- genpd->status = GPD_STATE_ACTIVE;
- }
-@@ -1056,7 +1066,7 @@ static int pm_genpd_suspend_noirq(struct
- * the same PM domain, so it is not necessary to use locking here.
- */
- genpd->suspended_count++;
-- pm_genpd_sync_poweroff(genpd);
-+ pm_genpd_sync_poweroff(genpd, true);
-
- return 0;
- }
-@@ -1086,7 +1096,7 @@ static int pm_genpd_resume_noirq(struct
- * guaranteed that this function will never run twice in parallel for
- * the same PM domain, so it is not necessary to use locking here.
- */
-- pm_genpd_sync_poweron(genpd);
-+ pm_genpd_sync_poweron(genpd, true);
- genpd->suspended_count--;
-
- return genpd_start_dev(genpd, dev);
-@@ -1300,7 +1310,7 @@ static int pm_genpd_restore_noirq(struct
- * If the domain was off before the hibernation, make
- * sure it will be off going forward.
- */
-- genpd_power_off(genpd);
-+ genpd_power_off(genpd, true);
-
- return 0;
- }
-@@ -1309,7 +1319,7 @@ static int pm_genpd_restore_noirq(struct
- if (genpd->suspend_power_off)
- return 0;
-
-- pm_genpd_sync_poweron(genpd);
-+ pm_genpd_sync_poweron(genpd, true);
-
- return genpd_start_dev(genpd, dev);
- }
-@@ -1367,9 +1377,9 @@ static void genpd_syscore_switch(struct
-
- if (suspend) {
- genpd->suspended_count++;
-- pm_genpd_sync_poweroff(genpd);
-+ pm_genpd_sync_poweroff(genpd, false);
- } else {
-- pm_genpd_sync_poweron(genpd);
-+ pm_genpd_sync_poweron(genpd, false);
- genpd->suspended_count--;
- }
- }
diff --git a/series b/series
index cce7d0dc7e87e2..8353aaed25cae9 100644
--- a/series
+++ b/series
@@ -20,417 +20,9 @@ patches.ltsi/ltsi-makefile-addition.patch
#############################################################################
# Renesas patches
#
-patches.renesas/0001-ARM-shmobile-r8a73a4-Add-IRQC-clock-to-device-tree.patch
-patches.renesas/0002-ARM-shmobile-r8a7790-Add-IRQC-clock-to-device-tree.patch
-patches.renesas/0003-ARM-shmobile-r8a7791-Add-IRQC-clock-to-device-tree.patch
-patches.renesas/0004-ARM-shmobile-r8a7794-Add-IRQC-clock-to-device-tree.patch
-patches.renesas/0005-clk-emev2-Silence-sparse-warnings.patch
-patches.renesas/0006-clk-shmobile-Add-r8a7778-SoC-to-MSTP-bindings.patch
-patches.renesas/0007-clk-shmobile-Add-r8a7793-SoC-to-MSTP-bindings.patch
-patches.renesas/0008-clk-shmobile-mstp-Document-mandatory-compatible-fall.patch
-patches.renesas/0009-i2c-sh_mobile-add-errata-workaround.patch
-patches.renesas/0010-i2c-sh_mobile-use-adapter-default-for-timeout.patch
-patches.renesas/0011-i2c-sh_mobile-use-proper-type-for-timeout.patch
-patches.renesas/0012-irqchip-Constify-irq_domain_ops.patch
-patches.renesas/0013-irqchip-renesas-intc-irqpin-Improve-binding-document.patch
-patches.renesas/0014-irqchip-irqc-Remove-platform-data-support.patch
-patches.renesas/0015-ARM-shmobile-r8a7790-Remove-MSIOF-address-from-devic.patch
-patches.renesas/0016-ARM-shmobile-r8a7791-Remove-MSIOF-address-from-devic.patch
-patches.renesas/0017-ARM-shmobile-r8a7740-dtsi-Fix-SCIFB-naming.patch
-patches.renesas/0018-ARM-shmobile-sh73a0-dtsi-Fix-SCIFB-naming.patch
-patches.renesas/0019-ARM-shmobile-defconfig-Replace-USB_RCAR_GEN2_PHY-by-.patch
-patches.renesas/0020-ARM-shmobile-r8a7740-dtsi-Use-generic-names-for-devi.patch
-patches.renesas/0021-ARM-shmobile-r8a7778-dtsi-Use-generic-names-for-devi.patch
-patches.renesas/0022-ARM-shmobile-r8a7779-dtsi-Use-generic-names-for-devi.patch
-patches.renesas/0023-ARM-shmobile-r8a7790-dtsi-Use-generic-names-for-devi.patch
-patches.renesas/0024-ARM-shmobile-r8a7791-dtsi-Use-generic-names-for-devi.patch
-patches.renesas/0025-ARM-shmobile-sh73a0-dtsi-Use-generic-names-for-devic.patch
-patches.renesas/0026-ARM-shmobile-ape6evm-dts-Use-generic-names-for-devic.patch
-patches.renesas/0027-ARM-shmobile-kzm9d-dts-Use-generic-names-for-device-.patch
-patches.renesas/0028-ARM-shmobile-marzen-dts-Use-generic-names-for-device.patch
-patches.renesas/0029-ARM-shmobile-armadillo800eva-dts-Use-generic-names-f.patch
-patches.renesas/0030-ARM-shmobile-henninger-dts-Add-nor-jedec-compatible-.patch
-patches.renesas/0031-ARM-shmobile-bockw-reference-dts-Add-nor-jedec-compa.patch
-patches.renesas/0032-ARM-shmobile-lager-dts-Add-nor-jedec-compatible-valu.patch
-patches.renesas/0033-ARM-shmobile-bockw-dts-Add-nor-jedec-compatible-valu.patch
-patches.renesas/0034-ARM-shmobile-koelsch-dts-Add-nor-jedec-compatible-va.patch
-patches.renesas/0035-ARM-shmobile-bockw-dts-Use-generic-names-for-device-.patch
-patches.renesas/0036-ARM-shmobile-lager-dts-Use-generic-names-for-device-.patch
-patches.renesas/0037-ARM-shmobile-koelsch-dts-Use-generic-names-for-devic.patch
-patches.renesas/0038-ARM-shmobile-kzm9g-dts-Configure-the-HOME-key-as-wak.patch
-patches.renesas/0039-ARM-shmobile-r8a7790-add-USB-DMAC-device-nodes.patch
-patches.renesas/0040-ARM-shmobile-r8a7790-Enable-DMA-for-HSUSB.patch
-patches.renesas/0041-ARM-shmobile-r8a7791-add-USB-DMAC-device-nodes.patch
-patches.renesas/0042-ARM-shmobile-r8a7791-Enable-DMA-for-HSUSB.patch
-patches.renesas/0043-ARM-shmobile-lager-dts-Replace-nor-jedec-by-jedec-sp.patch
-patches.renesas/0044-ARM-shmobile-koelsch-dts-Replace-nor-jedec-by-jedec-.patch
-patches.renesas/0045-ARM-shmobile-bockw-reference-dts-Replace-nor-jedec-b.patch
-patches.renesas/0046-ARM-shmobile-henninger-dts-Replace-nor-jedec-by-jede.patch
-patches.renesas/0047-ARM-shmobile-bockw-dts-Replace-nor-jedec-by-jedec-sp.patch
-patches.renesas/0048-ARM-shmobile-r8a7790-add-MMCIF-max-frequency.patch
-patches.renesas/0049-ARM-shmobile-r8a7791-add-MMCIF-max-frequency.patch
-patches.renesas/0050-ARM-shmobile-only-select-sound-drivers-that-build.patch
-patches.renesas/0051-ARM-shmobile-r8a7794-dtsi-Describe-DMA-for-the-seria.patch
-patches.renesas/0052-ARM-shmobile-r8a7791-dtsi-Describe-DMA-for-the-seria.patch
-patches.renesas/0053-ARM-shmobile-r8a7790-dtsi-Describe-DMA-for-the-seria.patch
-patches.renesas/0055-ARM-shmobile-r8a7740-remove-I2C-errata-handling.patch
-patches.renesas/0056-phy-core-Check-requested-PHY-status-in-_of_phy_get.patch
-patches.renesas/0057-phy-rcar-gen2-Add-support-for-R-Car-E2.patch
-patches.renesas/0058-usb-phy-Remove-the-phy-rcar-gen2-usb-driver.patch
-patches.renesas/0059-pinctrl-allow-exlusive-GPIO-mux-pin-allocation.patch
-patches.renesas/0060-pinctrl-move-strict-option-to-pinmux_ops.patch
-patches.renesas/0061-pinctrl-use-ERR_CAST-instead-of-ERR_PTR-PTR_ERR.patch
-patches.renesas/0062-pinctrl-Grammar-s-used-in-as-used-as.patch
-patches.renesas/0063-pinctrl-improve-debugfs-for-strict-controllers.patch
-patches.renesas/0064-pinctrl-remove-useless-const-qualifier.patch
-patches.renesas/0065-pinctrl-use-const-struct-.-rather-than-struct-.-cons.patch
-patches.renesas/0066-pinctrl-fix-confusing-debug-message-in-pinctrl_regis.patch
-patches.renesas/0067-pinctrl-don-t-print-unavailable-function-groups.patch
-patches.renesas/0068-pinctrl-make-pinctrl_register-return-proper-error-co.patch
-patches.renesas/0069-dmaengine-rcar-dmac-fixup-spinlock-in-rcar-dmac.patch
-patches.renesas/0070-dmaengine-rcar-dmac-Use-DECLARE_BITMAP.patch
-patches.renesas/0071-drm-rcar-du-Document-the-rcar_du_crtc-structure.patch
-patches.renesas/0072-drm-rcar-du-Document-the-rcar_du_plane_state-structu.patch
-patches.renesas/0073-drm-rcar-du-Move-properties-from-rcar_du_planes-to-r.patch
-patches.renesas/0074-drm-rcar-du-Embed-rcar_du_planes-structure-into-rcar.patch
-patches.renesas/0075-drm-rcar-du-Rename-to_rcar_du_plane_state-to-to_rcar.patch
-patches.renesas/0076-drm-rcar-du-Add-plane-allocation-debugging.patch
-patches.renesas/0077-drm-rcar-du-Keep-plane-to-CRTC-associations-when-dis.patch
-patches.renesas/0078-drm-rcar-du-Consider-plane-to-CRTC-associations-in-t.patch
-patches.renesas/0079-drm-rcar-du-Store-the-number-of-CRTCs-per-group-in-t.patch
-patches.renesas/0080-drm-rcar-du-Split-planes-pre-association-4-4-between.patch
-patches.renesas/0081-drm-rcar-du-Print-the-error-value-when-DRM-KMS-init-.patch
-patches.renesas/0082-drm-rcar-du-Disable-all-planes-when-stopping-the-CRT.patch
-patches.renesas/0083-drm-rcar-du-Fix-crash-with-groups-that-have-less-tha.patch
-patches.renesas/0084-drm-rcar-du-Clarify-error-message-when-encoder-initi.patch
-patches.renesas/0085-drm-rcar-du-Convert-rcar_du_encoders_init_one-return.patch
-patches.renesas/0086-drm-rcar-du-Clean-up-planes-in-the-error-paths-of-.a.patch
-patches.renesas/0087-drm-rcar-du-Use-the-drm-atomic-state-duplication-hel.patch
-patches.renesas/0088-i2c-add-FUNC-flag-for-slave-capabilities.patch
-patches.renesas/0089-i2c-constify-platform_device_id.patch
-patches.renesas/0090-i2c-rcar-report-slave-capabilities-to-users.patch
-patches.renesas/0091-i2c-rcar-use-adapter-default-for-timeout.patch
-patches.renesas/0092-i2c-rcar-use-proper-type-for-timeout.patch
-patches.renesas/0093-media-rcar-vin-use-monotonic-timestamps.patch
-patches.renesas/0094-sh-pfc-fix-sparse-GPIOs-for-R-Car-SoCs.patch
-patches.renesas/0095-ASoC-soc-pcm-DPCM-cares-BE-format.patch
-patches.renesas/0096-ASoC-rsnd-add-rsnd_dai_to_priv-macro.patch
-patches.renesas/0097-ASoC-rsnd-make-sure-it-uses-lock-when-it-calls-rsnd_.patch
-patches.renesas/0098-ASoC-rsnd-tidyup-SSI-parent-related-function-macro-n.patch
-patches.renesas/0099-ASoC-rsnd-make-sure-SSI-parent-child-uses-same-numbe.patch
-patches.renesas/0100-ASoC-rsnd-care-snd_kcontrol-s-index.patch
-patches.renesas/0101-ASoC-rsnd-Use-generic-names-for-device-nodes.patch
-patches.renesas/0102-ASoC-rsnd-revert-lock-for-calls-to-rsnd_dai_call.patch
-patches.renesas/0103-ASoC-rsnd-indicate-unknown-HW-start.patch
-patches.renesas/0104-ASoC-rsnd-add-rsnd_dai_stream_quit.patch
-patches.renesas/0105-ASoC-rsnd-rsrc-card-uses-FE-BE-merged-format-when-DP.patch
-patches.renesas/0106-ASoC-rsnd-spin-lock-for-interrupt-handler.patch
-patches.renesas/0107-ASoC-rsnd-Document-r8a7778-specific-binding.patch
-patches.renesas/0108-ASoC-rsnd-don-t-care-under-over-run-error-when-PIO.patch
-patches.renesas/0109-ASoC-rsnd-don-t-call-snd_pcm_period_elapsed-under-sp.patch
-patches.renesas/0110-ASoC-rsrc-card-used-fe.xxx-be.xxx-name-for-dai_link.patch
-patches.renesas/0111-ASoC-rsrc-card-tidyup-priv-snd_card-setup-timing.patch
-patches.renesas/0112-ASoC-rsrc-card-enable-multi-cpu-codec-for-DPCM.patch
-patches.renesas/0113-ASoC-rsrc-card-remove-unused-name.patch
-patches.renesas/0114-ASoC-rsnd-card-tidyup-rsrc_priv_to_.patch
-patches.renesas/0115-ASoC-rsrc-card-move-rsrc_card_parse_daifmt-to-upper-.patch
-patches.renesas/0116-ASoC-rsrc-card-tidyup-return-value-of-clock-error.patch
-patches.renesas/0117-ASoC-rsrc-card-cleanup-for-DPCM.patch
-patches.renesas/0118-ASoC-rsnd-count-each-mod-SSI-SRC-DVC.patch
-patches.renesas/0119-ASoC-rsnd-rsnd_mod-has-rsnd_priv.patch
-patches.renesas/0120-ASoC-rsnd-adds-struct-rsnd_dai_stream-as-on-each-fuc.patch
-patches.renesas/0121-ASoC-rsnd-add-common-interrupt-handler-for-SSI-SRC-D.patch
-patches.renesas/0122-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_get_adinr.patch
-patches.renesas/0123-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_dma_xxx.patch
-patches.renesas/0124-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_ssi_xxx.patch
-patches.renesas/0125-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-rsnd_src_xxx.patch
-patches.renesas/0126-ASoC-rsnd-don-t-use-rsnd_mod_to_io-on-snd_kcontrol.patch
-patches.renesas/0127-ASoC-rsnd-move-rsnd_mod_is_working-to-rsnd_io_is_wor.patch
-patches.renesas/0128-ASoC-rsnd-remove-io-from-rsnd_mod.patch
-patches.renesas/0129-ASoC-rsrc-card-remove-unused-ret.patch
-patches.renesas/0130-clk-shmobile-Remove-unneeded-include-linux-clkdev.h.patch
-patches.renesas/0131-clk-shmobile-emev2-deassert-reset-for-IIC0-1.patch
-patches.renesas/0132-clk-shmobile-Add-CPG-MSTP-Clock-Domain-support.patch
-patches.renesas/0133-clk-shmobile-r8a7778-Add-CPG-MSTP-Clock-Domain-suppo.patch
-patches.renesas/0134-clk-shmobile-r8a7779-Add-CPG-MSTP-Clock-Domain-suppo.patch
-patches.renesas/0135-clk-shmobile-rcar-gen2-Add-CPG-MSTP-Clock-Domain-sup.patch
-patches.renesas/0136-clk-shmobile-rz-Add-CPG-MSTP-Clock-Domain-support.patch
-patches.renesas/0137-regulator-da9210-Add-optional-interrupt-support.patch
-patches.renesas/0138-gpio-rcar-Fine-grained-Runtime-PM-support.patch
-patches.renesas/0139-gpio-rcar-Add-r8a7795-R-Car-H3-support.patch
-patches.renesas/0140-irqchip-renesas-irqc-Get-rid-of-IRQF_VALID.patch
-patches.renesas/0141-irqchip-renesas-irqc-Use-linear-IRQ-domain.patch
-patches.renesas/0142-irqchip-renesas-irqc-Make-use-of-irq_find_mapping.patch
-patches.renesas/0143-ARM-shmobile-R-Mobile-Move-to_rmobile_pd-from-header.patch
-patches.renesas/0144-ARM-shmobile-R-Mobile-Use-BIT-macro-instead-of-open-.patch
-patches.renesas/0145-ARM-shmobile-r8a7779-Remove-GENPD_FLAG_PM_CLK-flag.patch
-patches.renesas/0146-ARM-shmobile-Remove-legacy-board-code-for-KZM-A9-GT.patch
-patches.renesas/0147-ARM-shmobile-Remove-legacy-kzm9g_defconfig.patch
-patches.renesas/0148-ARM-shmobile-Drop-sh73a0-kzm9g.dtb-for-legacy-builds.patch
-patches.renesas/0149-ARM-shmobile-Remove-legacy-SoC-code-for-SH-Mobile-AG.patch
-patches.renesas/0150-ARM-shmobile-Remove-legacy-board-code-for-Armadillo-.patch
-patches.renesas/0151-ARM-shmobile-Remove-legacy-armadillo800eva_defconfig.patch
-patches.renesas/0152-ARM-shmobile-Drop-r8a7740-armadillo800eva.dtb-for-le.patch
-patches.renesas/0153-ARM-shmobile-Remove-legacy-SoC-code-for-R-Mobile-A1.patch
-patches.renesas/0154-ARM-shmobile-Remove-unused-dma-register.h.patch
-patches.renesas/0155-ARM-shmobile-R-Mobile-Remove-legacy-PM-Domain-code.patch
-patches.renesas/0156-ARM-shmobile-Remove-obsolete-zboot-support.patch
-patches.renesas/0157-ARM-shmobile-R-Car-Gen2-CONFIG_ARCH_SHMOBILE_MULTI-i.patch
-patches.renesas/0158-ARM-shmobile-timer-r8a73a4-and-r8a7790-are-multi-pla.patch
-patches.renesas/0159-ARM-shmobile-Enable-gose-board-in-multiplatform-defc.patch
-patches.renesas/0160-ARM-shmobile-add-r8a7793-minimal-SoC-device-tree.patch
-patches.renesas/0161-ARM-shmobile-r8a7793-add-minimal-Gose-board-device-t.patch
-patches.renesas/0162-ARM-shmobile-r8a7790-add-EtherAVB-clocks.patch
-patches.renesas/0163-ARM-shmobile-r8a7790-add-EtherAVB-DT-support.patch
-patches.renesas/0164-ARM-shmobile-armadillo800eva-dts-Add-pinctrl-and-gpi.patch
-patches.renesas/0165-ARM-shmobile-r8a73a4-dtsi-Use-arm-gic-400-for-GIC.patch
-patches.renesas/0166-ARM-shmobile-r8a7790-dtsi-Use-arm-gic-400-for-GIC.patch
-patches.renesas/0167-ARM-shmobile-r8a7791-dtsi-Use-arm-gic-400-for-GIC.patch
-patches.renesas/0168-ARM-shmobile-r8a7793-dtsi-Use-arm-gic-400-for-GIC.patch
-patches.renesas/0169-ARM-shmobile-r8a7794-dtsi-Use-arm-gic-400-for-GIC.patch
-patches.renesas/0170-ARM-shmobile-r8a7779-Configure-IRLM-mode-via-DT.patch
-patches.renesas/0171-ARM-shmobile-R-Car-Improve-documentation.patch
-patches.renesas/0172-ARM-shmobile-R-Car-Shrink-rcar_sysc_ch-size.patch
-patches.renesas/0173-ARM-shmobile-R-Car-Break-infinite-loop.patch
-patches.renesas/0174-ARM-shmobile-R-Car-Make-struct-rcar_sysc_ch-paramete.patch
-patches.renesas/0175-ARM-shmobile-R-Car-Use-BIT-macro-instead-of-open-cod.patch
-patches.renesas/0176-ARM-shmobile-R-Car-Get-rid-of-on_off_fn-function-poi.patch
-patches.renesas/0177-ARM-shmobile-r8a7779-Make-struct-rcar_sysc_ch-const.patch
-patches.renesas/0178-ARM-shmobile-r8a7790-Make-struct-rcar_sysc_ch-const.patch
-patches.renesas/0179-ARM-shmobile-Basic-r8a7793-SoC-support.patch
-patches.renesas/0180-ARM-shmobile-gose-enable-R-Car-Gen2-regulator-quirk.patch
-patches.renesas/0181-ARM-shmobile-apmu-silence-build-warnings.patch
-patches.renesas/0182-ARM-shmobile-r8a7779-Generic-CCF-and-timer-support.patch
-patches.renesas/0183-ARM-shmobile-r8a7779-Generic-SMP-ops.patch
-patches.renesas/0184-ARM-shmobile-emev2-add-IIC-cores-to-dtsi.patch
-patches.renesas/0185-ARM-shmobile-emev2-kzm9d-enable-IIC-busses.patch
-patches.renesas/0186-ARM-shmobile-lager-add-sound-label-on-DTS.patch
-patches.renesas/0187-ARM-shmobile-koelsch-add-sound-label-on-DTS.patch
-patches.renesas/0188-ARM-shmobile-defconfig-add-Renesas-DPCM-Sound-Card.patch
-patches.renesas/0189-ARM-shmobile-Remove-marzen_defconfig.patch
-patches.renesas/0190-ARM-shmobile-lager-Fix-adv7511-IRQ-sensing.patch
-patches.renesas/0191-ARM-shmobile-r8a7790-Add-Audio-CTU-support-on-DTSI.patch
-patches.renesas/0192-ARM-shmobile-r8a7790-Add-Audio-MIX-support-on-DTSI.patch
-patches.renesas/0193-ARM-shmobile-r8a7791-Add-Audio-CTU-support-on-DTSI.patch
-patches.renesas/0194-ARM-shmobile-r8a7791-Add-Audio-MIX-support-on-DTSI.patch
-patches.renesas/0195-ARM-shmobile-Enable-fixed-voltage-regulator-in-shmob.patch
-patches.renesas/0196-ARM-shmobile-marzen-reference-Remove-C-board-code.patch
-patches.renesas/0197-ARM-shmobile-r8a7779-Cleanup-header-file.patch
-patches.renesas/0198-ARM-shmobile-marzen-Remove-legacy-board-code.patch
-patches.renesas/0199-ARM-shmobile-r8a7779-Remove-legacy-SoC-code.patch
-patches.renesas/0200-ARM-shmobile-r8a7790-Add-JPU-device-node.patch
-patches.renesas/0201-ARM-shmobile-r8a7791-Add-JPU-device-node.patch
-patches.renesas/0202-ARM-shmobile-r8a7794-add-PFC-DT-support.patch
-patches.renesas/0203-ARM-shmobile-silk-initial-device-tree.patch
-patches.renesas/0204-ARM-shmobile-r8a7794-add-MMCIF-DT-support.patch
-patches.renesas/0205-ARM-shmobile-r8a73a4-dtsi-Add-missing-gpio-ranges-to.patch
-patches.renesas/0206-ARM-shmobile-r8a7740-dtsi-Add-missing-gpio-ranges-to.patch
-patches.renesas/0207-ARM-shmobile-sh73a0-dtsi-Add-missing-gpio-ranges-to-.patch
-patches.renesas/0208-ARM-shmobile-r7s72100-dtsi-Add-CPG-MSTP-Clock-Domain.patch
-patches.renesas/0209-ARM-shmobile-r8a7778-dtsi-Add-CPG-MSTP-Clock-Domain.patch
-patches.renesas/0210-ARM-shmobile-r8a7779-dtsi-Add-CPG-MSTP-Clock-Domain.patch
-patches.renesas/0211-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain.patch
-patches.renesas/0212-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain.patch
-patches.renesas/0213-ARM-shmobile-r8a7793-dtsi-Add-CPG-MSTP-Clock-Domain.patch
-patches.renesas/0214-ARM-shmobile-r8a7794-dtsi-Add-CPG-MSTP-Clock-Domain.patch
-patches.renesas/0215-pinctrl-simplify-of_pinctrl_get.patch
-patches.renesas/0216-pinctrl-pinconf-Allow-groups-to-be-configured-via-de.patch
-patches.renesas/0217-pinctrl-pinconf-Fix-display-of-configs.patch
-patches.renesas/0218-pinctrl-pinconf-pinconf_show_config-can-be-static.patch
-patches.renesas/0219-pinctrl-use-dev_err-to-show-message-in-pinctrl_regis.patch
-patches.renesas/0220-pinctrl-use-dev_err-to-show-message-in-pinmux_func_n.patch
-patches.renesas/0221-pinctrl-join-dev_dbg-strings-into-a-single-line.patch
-patches.renesas/0222-media-media-soc_camera-rcar_vin-Add-BT.709-24-bit-RG.patch
-patches.renesas/0223-media-media-rcar_vin-fill-in-bus_info-field.patch
-patches.renesas/0224-media-media-rcar_vin-Reject-videobufs-that-are-too-s.patch
-patches.renesas/0225-spi-rspi-Drop-variable-error-in-qspi_trigger_transfe.patch
-patches.renesas/0226-spi-rspi-Make-qspi_set_send_trigger-return-unsigned-.patch
-patches.renesas/0227-ata-sata_rcar-Remove-obsolete-sata-r8a779-platform_d.patch
-patches.renesas/0228-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-32.patch
-patches.renesas/0229-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch
-patches.renesas/0230-sh-irq-Use-irq-accessor-functions-instead-of-open-co.patch
-patches.renesas/0231-sh-intc-Use-irq_desc_get_xxx-to-avoid-redundant-look.patch
-patches.renesas/0232-sh_eth-propagate-platform_get_irq-error-upstream.patch
-patches.renesas/0233-mmc-sh_mmcif-Fix-suspend-process.patch
-patches.renesas/0234-mmc-tmio-Fix-timeout-value-for-command-request.patch
-patches.renesas/0235-spi-sh-msiof-Remove-obsolete-spi_r8a779x_msiof-platf.patch
-patches.renesas/0237-pinctrl-sh-pfc-Remove-r8a73a4-platform_device_id-ent.patch
-patches.renesas/0238-pinctrl-sh-pfc-r8a7740-Fix-typo-SCIFAB-in-comment.patch
-patches.renesas/0239-pinctrl-sh-pfc-Add-r8a7793-support.patch
-patches.renesas/0240-pinctrl-sh-pfc-Enable-building-of-r8a7793-PFC-suppor.patch
-patches.renesas/0241-pinctrl-sh-pfc-Add-renesas-pfc-r8a7793-to-binding-do.patch
-patches.renesas/0242-pinctrl-sh-pfc-r8a73a4-Remove-obsolete-multi-platfor.patch
-patches.renesas/0243-pinctrl-sh-pfc-r8a7790-Add-PWM-pin-groups-and-functi.patch
-patches.renesas/0244-pinctrl-sh-pfc-r8a7791-Add-PWM-pin-groups-and-functi.patch
-patches.renesas/0245-pinctrl-Spelling-s-reseved-reserved.patch
-patches.renesas/0246-pinctrl-sh-pfc-add-R8A7794-PFC-support.patch
-patches.renesas/0247-pinctrl-sh-pfc-r8a7794-add-MMCIF-pin-groups.patch
-patches.renesas/0248-pinctrl-sh-pfc-r8a7794-add-SDHI-pin-groups.patch
-patches.renesas/0249-sh-pfc-r8a7790-remove-non-existing-GPIO-pins.patch
-patches.renesas/0250-sh-pfc-r8a7791-remove-non-existing-GPIO-pins.patch
-patches.renesas/0251-pinctrl-sh-pfc-Accept-standard-function-pins-and-gro.patch
-patches.renesas/0252-pinctrl-sh-pfc-Convert-to-platform_get_.patch
-patches.renesas/0253-dmaengine-shdma-Make-dummy-shdma_chan_filter-always-.patch
-patches.renesas/0254-dmaengine-sort-the-sh-Makefile.patch
-patches.renesas/0255-usb-renesas_usbhs-Replace-deprecated-API-of-extcon.patch
-patches.renesas/0256-usb-renesas_usbhs-Allow-an-OTG-PHY-driver-to-provide.patch
-patches.renesas/0257-media-media-uapi-vsp1-Use-__u32-instead-of-u32.patch
-patches.renesas/0258-media-v4l-vsp1-Fix-VI6_WPF_SZCLIP_SIZE_MASK-macro.patch
-patches.renesas/0259-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FP_MASK-macro.patch
-patches.renesas/0260-media-v4l-vsp1-Fix-VI6_DPR_ROUTE_FXA_MASK-macro.patch
-patches.renesas/0261-media-v4l-vsp1-Fix-Suspend-to-RAM.patch
-patches.renesas/0262-media-v4l-vsp1-Fix-race-condition-when-stopping-pipe.patch
-patches.renesas/0263-media-v4l-vsp1-Align-crop-rectangle-to-even-boundary.patch
-patches.renesas/0264-media-vsp1-declar-vsp1_pipeline_stopped-as-static.patch
-patches.renesas/0265-media-v4l-vsp1-Fix-plane-stride-and-size-checks.patch
-patches.renesas/0266-media-v4l-vsp1-Don-t-sleep-in-atomic-context.patch
-patches.renesas/0267-regmap-add-force_write-option-on-_regmap_update_bits.patch
-patches.renesas/0268-regmap-add-regmap_fields_force_write.patch
-patches.renesas/0269-regmap-add-regmap_write_bits.patch
-patches.renesas/0270-clockevents-drivers-sh_cmt-Remove-obsolete-sh-cmt-48.patch
-patches.renesas/0271-pinctrl-sh-pfc-Remove-obsolete-sh73a0-platform_devic.patch
-patches.renesas/0272-pinctrl-sh-pfc-Remove-obsolete-r8a7740-platform_devi.patch
-patches.renesas/0273-pinctrl-sh-pfc-Implement-pinconf-power-source-param-.patch
-patches.renesas/0274-pinctrl-sh-pfc-r8a7794-add-USB-pin-groups.patch
-patches.renesas/0275-ASoC-core-add-snd_soc_of_parse_audio_prefix.patch
-patches.renesas/0276-ASoC-rsnd-gen-add-rsnd_force_write.patch
-patches.renesas/0277-ASoC-rsrc-card-use-snd_soc_of_parse_audio_route-pref.patch
-patches.renesas/0278-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch
-patches.renesas/0279-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch
-patches.renesas/0280-ASoC-rsnd-remove-unnecessary-out-of-memory-message-f.patch
-patches.renesas/0281-ASoC-rsnd-rename-BUSIF_DALIGN-to-SSI_BUSIF_DALIGN.patch
-patches.renesas/0282-ASoC-rsnd-rename-INT_ENABLE-to-SSI_INT_ENABLE.patch
-patches.renesas/0283-ASoC-rsnd-fixup-each-module-counter-on-__rsnd_mod_ca.patch
-patches.renesas/0284-ASoC-rsnd-add-workaround-for-SRC-sync-convert-DVC.patch
-patches.renesas/0285-ASoC-rsnd-rsnd_mod_id-return-1-if-mod-was-NULL.patch
-patches.renesas/0286-ASoC-rsnd-move-DVC-specific-macro-into-dvc.c.patch
-patches.renesas/0287-ASoC-rsnd-move-SRC-specific-macro-into-src.c.patch
-patches.renesas/0288-ASoC-rsnd-dvc-make-sure-DVC-soft-reset.patch
-patches.renesas/0289-ASoC-rsnd-src-make-sure-SRC-soft-reset.patch
-patches.renesas/0290-ASoC-rsnd-enable-module-multi-connection.patch
-patches.renesas/0291-ASoC-rsnd-rename-rsnd_path_parse-break-into-add-remo.patch
-patches.renesas/0292-ASoC-rsnd-add-rsnd_path_parse-for-CTU-MIX-DVC-route-.patch
-patches.renesas/0293-ASoC-rsnd-add-rsnd_dvc_initialize_lock-unlock.patch
-patches.renesas/0294-ASoC-rsnd-add-rsnd_src_initialize_lock-unlock.patch
-patches.renesas/0295-ASoC-rsnd-tidyup-ADINR-function-name.patch
-patches.renesas/0296-ASoC-rsnd-add-rsnd_get_adinr_chan.patch
-patches.renesas/0297-ASoC-rsnd-tidyup-data-align-position.patch
-patches.renesas/0298-ASoC-rsnd-show-debug-message-for-SSI-SRC-DVC-connect.patch
-patches.renesas/0299-ASoC-rsnd-tidyup-rsnd_dma_ops-definition-place.patch
-patches.renesas/0300-ASoC-rsnd-check-the-Gen1-at-the-beginning-of-DVC-pro.patch
-patches.renesas/0301-ASoC-rsnd-dma-add-DMA-name-on-.ops.patch
-patches.renesas/0302-ASoC-rsnd-add-rsnd_io_to_mod.patch
-patches.renesas/0303-ASoC-rsnd-tidyup-SRC-position-on-each-code.patch
-patches.renesas/0304-ASoC-rsnd-update-Audio-DMA-path-search-method.patch
-patches.renesas/0305-ASoC-rsnd-add-CTU-Channel-Transfer-Unit-prototype-su.patch
-patches.renesas/0306-ASoC-rsnd-add-MIX-Mixer-support.patch
-patches.renesas/0307-ASoC-rsnd-tidyup-parameter-assignment-position.patch
-patches.renesas/0308-ASoC-rcar-ctu-Staticise-local-symbols.patch
-patches.renesas/0309-ASoC-rsnd-Silence-DMA-slave-ID-compile-warning-on-64.patch
-patches.renesas/0310-irqchip-renesas-intc-irqpin-Use-a-separate-lockdep-c.patch
-patches.renesas/0311-irqchip-renesas-intc-irqpin-Propagate-wake-up-settin.patch
-patches.renesas/0312-irqchip-renesas-irqc-Use-a-separate-lockdep-class.patch
-patches.renesas/0313-irqchip-renesas-irqc-Propagate-wake-up-settings-to-p.patch
-patches.renesas/0314-pinctrl-join-lines-that-can-be-a-single-line-within-.patch
-patches.renesas/0315-pinctrl-core-Warn-about-NULL-gpio_chip-in-pinctrl_re.patch
-patches.renesas/0316-PCI-rcar-Add-R8A7794-support.patch
-patches.renesas/0317-drivers-sh-Disable-legacy-default-PM-Domain-on-emev2.patch
-patches.renesas/0318-drivers-sh-Disable-PM-runtime-for-multi-platform-ARM.patch
-patches.renesas/0319-ARM-shmobile-r8a7790-dtsi-Add-CPG-MSTP-Clock-Domain-.patch
-patches.renesas/0320-ARM-shmobile-r8a7791-dtsi-Add-CPG-MSTP-Clock-Domain-.patch
-patches.renesas/0321-spi-sh-msiof-Match-renesas-rx-fifo-size-in-DT-bindin.patch
-patches.renesas/0322-usb-renesas_usbhs-Change-USBHS_TYPE_R8A779x-to-USBHS.patch
-patches.renesas/0323-usb-renesas_usbhs-Add-support-for-R-Car-E2.patch
-patches.renesas/0324-usb-renesas_usbhs-fix-build-warning-if-64-bit-archit.patch
-patches.renesas/0325-usb-renesas_usbhs-Add-support-for-R-Car-H3.patch
-patches.renesas/0328-sh_eth-fix-RX-buffer-size-calculation.patch
-patches.renesas/0329-Revert-staging-board-disable-as-it-breaks-the-build.patch
-patches.renesas/0330-staging-board-Initialize-staging-board-code-earlier.patch
-patches.renesas/0331-staging-board-Add-support-for-translating-hwirq-to-v.patch
-patches.renesas/0332-staging-board-kzm9d-Translate-hwirq-numbers-to-virq-.patch
-patches.renesas/0333-staging-board-Add-support-for-devices-with-complex-d.patch
-patches.renesas/0334-staging-board-armadillo800eva-Board-staging-for-sh_m.patch
-patches.renesas/0335-staging-make-board-support-depend-on-OF_IRQ-and-CLKD.patch
-patches.renesas/0336-staging-board-Migrate-away-from-__pm_genpd_name_add_.patch
-patches.renesas/0337-ARM-dts-fix-gpio-keys-wakeup-source-property.patch
-patches.renesas/clockevents-drivers-sh_cmt-only-perform-clocksource-suspend-resume-if-enabled.patch
-patches.renesas/clkdev-use-clk_hw-internally.patch
-patches.renesas/clkdev-const-ify-connection-id-to-clk_add_alias.patch
-patches.renesas/clkdev-get-rid-of-redundant-clk_add_alias-prototype-in-linux-clk.h.patch
-patches.renesas/pm-domains-skip-timings-during-syscore-suspend-resume.patch
-
-#############################################################################
-# Altera patches
-#
-patches.altera/0001-ARM-socfpga-dts-add-cpu1-start-addr-for-Arria-10.patch
-patches.altera/0002-ARM-socfpga-dts-disable-the-sdmmc-and-uart-nodes-in-.patch
-patches.altera/0003-ARM-socfpga-dts-enable-UART1-for-the-debug-uart.patch
-patches.altera/0004-ARM-socfpga-dts-rename-socdk-board-file-to-socdk_sdm.patch
-patches.altera/0005-ARM-socfpga-dts-Add-a-clock-node-for-sdmmc-CIU.patch
-patches.altera/0006-ARM-socfpga-dts-Add-multicast-bins-and-unicast-filte.patch
-patches.altera/0007-ARM-socfpga-dts-Add-tx-fifo-depth-and-rx-fifo-depth-.patch
-patches.altera/0008-ARM-socfpga-dts-add-clocks-to-the-Arria10-platform.patch
-patches.altera/0009-ARM-socfpga-Add-support-for-UART1-debug-uart-for-ear.patch
-patches.altera/0010-ARM-socfpga-remove-the-need-to-map-uart_io_desc.patch
-patches.altera/0011-ARM-socfpga-dts-add-the-a9-scu-node.patch
-patches.altera/0012-ARM-socfpga-use-of_iomap-to-map-the-SCU.patch
-patches.altera/0013-clk-socfpga-update-clk.h-so-for-Arria10-platform-to-.patch
-patches.altera/0014-clk-socfpga-add-a-clock-driver-for-the-Arria-10-plat.patch
-patches.altera/0015-ARM-socfpga-dts-add-the-a9-scu-node-for-arria10.patch
-patches.altera/0016-ARM-socfpga-dts-add-enable-method-property-for-cpu-n.patch
-patches.altera/0017-clk-of-helper-for-filling-parent-clock-array-and-ret.patch
-patches.altera/0018-clk-socfpga-make-use-of-of_clk_parent_fill-helper-fu.patch
-patches.altera/0019-ARM-socfpga-use-CPU_METHOD_OF_DECLARE-for-socfpga_cy.patch
-patches.altera/0020-ARM-socfpga-add-CPU_METHOD_OF_DECLARE-for-Arria-10.patch
-patches.altera/0021-ARM-socfpga-dts-enable-ethernet-for-Arria10-devkit.patch
-patches.altera/0022-ARM-socfpga-support-suspend-to-ram.patch
-patches.altera/0023-ARM-dts-socfpga-enable-the-data-and-instruction-pref.patch
-patches.altera/0024-ARM-dts-socfpga-use-stdout-path-for-chosen-node.patch
-patches.altera/0025-ARM-socfpga-add-reset-for-the-Arria-10-platform.patch
-patches.altera/0026-ARM-socfpga-dts-Correct-the-parent-clock-for-l3_sp_c.patch
-patches.altera/0027-ARM-socfpga-dts-Fix-gpio-dts-entry-for-the-correct-c.patch
-patches.altera/0028-ARM-socfpga-dts-add-osc1-as-a-possible-parent-for-db.patch
-patches.altera/0029-reset-socfpga-Update-reset-socfpga-to-read-the-altr-.patch
-patches.altera/0030-dt-bindings-Add-reset-manager-offsets-for-Arria10.patch
-patches.altera/0031-ARM-socfpga-dts-add-altr-modrst-offset-property.patch
-patches.altera/0032-ARM-socfpga-dts-Add-resets-for-EMACs-on-Arria10.patch
-patches.altera/0033-clk-socfpga-Add-a-second-parent-option-for-the-dbg_b.patch
-patches.altera/0034-EDAC-altera-Generalize-driver-to-use-DT-Memory-size.patch
-patches.altera/0035-EDAC-altera-Refactor-for-Altera-CycloneV-SoC.patch
-patches.altera/0036-EDAC-altera-Add-Arria10-EDAC-support.patch
-patches.altera/0037-arm-socfpga-dts-Add-Arria10-SDRAM-EDAC-DTS-support.patch
-patches.altera/0038-EDAC-altera-Do-not-allow-suspend-when-EDAC-is-enable.patch
-patches.altera/0039-ARM-dts-socfpga-Add-support-of-Terasic-DE0-Atlas-boa.patch
-patches.altera/0001-usage-documentation-for-FPGA-manager-core.patch
-patches.altera/0002-fpga-manager-add-sysfs-interface-document.patch
-patches.altera/0003-add-FPGA-manager-core.patch
-patches.altera/0004-fpga-manager-add-driver-for-socfpga-fpga-manager.patch
-patches.altera/0005-MAINTAINERS-add-fpga-manager-framework.patch
-patches.altera/0006-ARM-socfpga_defconfig-enable-fpga-manager.patch
-patches.altera/0007-ARM-socfpga-dts-add-fpga-manager.patch
-patches.altera/0001-nios2-Export-get_cycles.patch
-patches.altera/0002-nios2-check-number-of-timer-instances.patch
-patches.altera/0003-nios2-time-Migrate-to-new-set-state-interface.patch
-patches.altera/0004-nios2-fixed-variable-imm16-to-s16.patch
-patches.altera/0005-nios2-remove-unused-statistic-counters.patch
-patches.altera/0006-nios2-Add-Max10-device-tree.patch
-patches.altera/0007-nios2-add-Max10-defconfig.patch
-patches.altera/0008-nios2-Fix-unused-variable-warning.patch
-patches.altera/0009-nios2-Switch-to-generic-__xchg.patch
-patches.altera/0001-ARM-Add-msi.h-to-Kbuild.patch
-patches.altera/0002-PCI-altera-Add-Altera-PCIe-host-controller-driver.patch
-patches.altera/0003-PCI-altera-Add-Altera-PCIe-MSI-driver.patch
-patches.altera/0004-PCI-altera-Fix-loop-in-tlp_read_packet.patch
-patches.altera/0005-PCI-altera-Fix-Requester-ID-for-config-accesses.patch
-patches.altera/0006-PCI-altera-Check-TLP-completion-status.patch
-patches.altera/0007-PCI-altera-Fix-error-when-INTx-is-4.patch
-patches.altera/arm-socfpga-fix-build-error-due-to-secondary_startup.patch
#############################################################################
# Misc patches
-patches.misc/input-add-support-for-rohm-bu21023-24-touchscreen.patch
-patches.misc/input-rohm_bu21023-fix-handling-of-retrying-firmware.patch
-patches.misc/mtd-nand-support-for-toshiba-benand-built-in-ecc-nand.patch
##############################################################################
# fixes that go after all of the above