aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-26 10:38:54 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-26 10:38:54 -0700
commit21706592e1a0f8287092cbe9d4af2473529a8f8e (patch)
tree4b5cf699b82aa536f8b0e27f4e36f8ce84e9bf98
parent29ec9a84a9dd42d5d04c8deb12bdd6598c64241b (diff)
downloadltsi-kernel-21706592e1a0f8287092cbe9d4af2473529a8f8e.tar.gz
Add armadillo800eva patches to the build
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--patches.armadillo800eva/0001-module.h-split-out-the-EXPORT_SYMBOL-into-export.h.patch247
-rw-r--r--patches.armadillo800eva/0002-arm-Add-export.h-to-ARM-specific-files-as-required.patch460
-rw-r--r--patches.armadillo800eva/0003-ARM-mach-shmobile-cpuidle-single-global-and-last_sta.patch177
-rw-r--r--patches.armadillo800eva/0004-ARM-entry-re-allocate-registers-in-irq-entry-assembl.patch92
-rw-r--r--patches.armadillo800eva/0005-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch108
-rw-r--r--patches.armadillo800eva/0006-ARM-mach-shmobile-add-shmobile_earlytimer_init.patch55
-rw-r--r--patches.armadillo800eva/0007-ARM-mach-shmobile-default-to-no-earlytimer.patch34
-rw-r--r--patches.armadillo800eva/0008-ARM-shmobile-Consolidate-time-keeping-and-irq-enable.patch79
-rw-r--r--patches.armadillo800eva/0009-sh-pfc-get_config_reg-shift-clean-up.patch33
-rw-r--r--patches.armadillo800eva/0010-sh-pfc-Remove-unused-gpio_in_use-member.patch31
-rw-r--r--patches.armadillo800eva/0011-sh-pfc-Add-GPIO-IRQ-support.patch101
-rw-r--r--patches.armadillo800eva/0012-ARM-mach-shmobile-move-helper-macro-PORT_DATA_xx-to-.patch443
-rw-r--r--patches.armadillo800eva/0013-ARM-mach-shmobile-move-helper-macro-PORT_xx-to-sh_pf.patch509
-rw-r--r--patches.armadillo800eva/0014-ARM-mach-shmobile-move-helper-macro-PORTCR-to-sh_pfc.patch153
-rw-r--r--patches.armadillo800eva/0015-sh-pfc-ioremap-support.patch350
-rw-r--r--patches.armadillo800eva/0016-sh-pfc-Add-gpio_read_bit-for-data-register-access.patch56
-rw-r--r--patches.armadillo800eva/0017-sh-pfc-Convert-index-to-field-and-value-pair.patch133
-rw-r--r--patches.armadillo800eva/0018-sh-pfc-Add-config_reg_helper-function.patch140
-rw-r--r--patches.armadillo800eva/0019-sh-pfc-Variable-bitfield-width-config-register-suppo.patch121
-rw-r--r--patches.armadillo800eva/0020-sh-pfc-Unlock-register-support.patch74
-rw-r--r--patches.armadillo800eva/0021-ARM-mach-shmobile-Break-out-INTC-IRQ-code.patch223
-rw-r--r--patches.armadillo800eva/0022-sh-intc-enable-both-edges-GPIO-interrupts-on-sh7372.patch35
-rw-r--r--patches.armadillo800eva/0023-sh-intc-Add-IRQ-trigger-bit-field-check.patch45
-rw-r--r--patches.armadillo800eva/0024-sh-userimask.c-needs-linux-stat.h.patch41
-rw-r--r--patches.armadillo800eva/0025-sh-fix-implicit-use-of-stat.h-in-arch-sh-specific-fi.patch41
-rw-r--r--patches.armadillo800eva/0026-sh-Add-module.h-to-arch-sh-specific-files-as-require.patch32
-rw-r--r--patches.armadillo800eva/0027-sh-Add-export.h-to-arch-sh-specific-files-as-require.patch36
-rw-r--r--patches.armadillo800eva/0028-drivers-sh-Add-export.h-for-EXPORT_SYMBOL-to-intc-vi.patch31
-rw-r--r--patches.armadillo800eva/0029-driver-core-implement-sysdev-functionality-for-regul.patch892
-rw-r--r--patches.armadillo800eva/0030-sh-intc-Allow-triggering-on-both-edges-for-ARM-SoCs.patch34
-rw-r--r--patches.armadillo800eva/0031-sh-intc-convert-sysdev_class-to-a-regular-subsystem.patch183
-rw-r--r--patches.armadillo800eva/0032-PM-shmobile-Don-t-include-SH7372-s-INTCS-in-syscore-.patch103
-rw-r--r--patches.armadillo800eva/0033-sh-intc-unify-evt2irq-irq2evt-macros-for-sh-and-arm.patch103
-rw-r--r--patches.armadillo800eva/0034-sh-intc-Make-global-intc-controller-counter-static.patch44
-rw-r--r--patches.armadillo800eva/0035-genirq-Add-IRQCHIP_SKIP_SET_WAKE-flag.patch56
-rw-r--r--patches.armadillo800eva/0036-sh-intc-Prefer-IRQCHIP_SKIP_SET_WAKE-over-a-dummy-se.patch47
-rw-r--r--patches.armadillo800eva/0037-sh-intc-Kill-off-superfluous-irq_shutdown-hooking.patch30
-rw-r--r--patches.armadillo800eva/0038-sh-intc-Use-IRQ_SET_MASK_OK_NOCOPY-for-intc_set_affi.patch32
-rw-r--r--patches.armadillo800eva/0039-sh-intc-optimize-intc-IRQ-lookup.patch135
-rw-r--r--patches.armadillo800eva/0040-sh-intc-remove-dependency-on-NR_IRQS.patch93
-rw-r--r--patches.armadillo800eva/0041-sh-intc-Fix-up-section-mismatch-for-intc_ack_data.patch44
-rw-r--r--patches.armadillo800eva/0042-drivers-sh-late-disabling-of-clocks-V2.patch80
-rw-r--r--patches.armadillo800eva/0043-sh-clkfwk-Convert-to-IS_ERR_OR_NULL.patch31
-rw-r--r--patches.armadillo800eva/0044-sh-move-CLKDEV_xxx_ID-macro-to-sh_clk.h.patch174
-rw-r--r--patches.armadillo800eva/0045-switch-assorted-clock-drivers-to-debugfs_remove_recu.patch193
-rw-r--r--patches.armadillo800eva/0046-sh-clkfwk-add-clk_rate_mult_range_round.patch67
-rw-r--r--patches.armadillo800eva/0047-sh-clkfwk-Kill-off-remaining-debugfs-cruft.patch146
-rw-r--r--patches.armadillo800eva/0048-sh-clkfwk-setup-clock-parent-from-current-register-v.patch143
-rw-r--r--patches.armadillo800eva/0049-sh-extend-clock-struct-with-mapped_reg-member.patch70
-rw-r--r--patches.armadillo800eva/0050-sh-use-ioread32-iowrite32-and-mapped_reg-for-mstp32.patch44
-rw-r--r--patches.armadillo800eva/0051-sh-use-ioread32-iowrite32-and-mapped_reg-for-div4.patch81
-rw-r--r--patches.armadillo800eva/0052-sh-use-ioread32-iowrite32-and-mapped_reg-for-div6.patch93
-rw-r--r--patches.armadillo800eva/0053-sh-clkfwk-sh_clk_init_parent-should-be-called-after-.patch39
-rw-r--r--patches.armadillo800eva/0054-sh-clkfwk-bugfix-use-clk_reparent-for-div6-clocks.patch33
-rw-r--r--patches.armadillo800eva/0055-sh-introduce-sh_clk_ops-in-parallel-with-clk_ops.patch32
-rw-r--r--patches.armadillo800eva/0056-sh-convert-cpg-code-to-sh_clk_ops.patch93
-rw-r--r--patches.armadillo800eva/0057-ARM-mach-shmobile-R-Mobile-A1-support.patch1378
-rw-r--r--patches.armadillo800eva/0058-ARM-mach-shmobile-r8a7740-add-PFC-support.patch2602
-rw-r--r--patches.armadillo800eva/0059-ARM-mach-shmobile-r8a7740-add-i2c-support.patch151
-rw-r--r--patches.armadillo800eva/0060-ARM-mach-shmobile-r8a7740-add-INTC-support.patch804
-rw-r--r--patches.armadillo800eva/0061-ARM-mach-shmobile-bonito-Add-LCDC0-support.patch56
-rw-r--r--patches.armadillo800eva/0062-ARM-mach-shmobile-r8a7740-sh_clk_ops-rename.patch50
-rw-r--r--patches.armadillo800eva/0063-ARM-mach-shmobile-r8a7740-map_io-and-init_early-upda.patch91
-rw-r--r--patches.armadillo800eva/0064-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch37
-rw-r--r--patches.armadillo800eva/0065-ARM-mach-shmobile-r8a7740-and-Bonito-timer-rework.patch59
-rw-r--r--patches.armadillo800eva/0066-ARM-mach-shmobile-pfc-r8a7740-add-gpio_irq-support.patch82
-rw-r--r--patches.armadillo800eva/0067-net-sh_eth-tidyup-compile-warning.patch45
-rw-r--r--patches.armadillo800eva/0068-net-sh_eth-remove-__flush_purge_region.patch58
-rw-r--r--patches.armadillo800eva/0069-sh_eth-Move-the-Renesas-SuperH-driver.patch290
-rw-r--r--patches.armadillo800eva/0070-net-sh_eth-Fix-build-by-forgot-including-linux-inter.patch43
-rw-r--r--patches.armadillo800eva/0071-net-remove-use-of-ndo_set_multicast_list-in-drivers.patch283
-rw-r--r--patches.armadillo800eva/0072-net-sh_eth-fix-the-compile-error.patch45
-rw-r--r--patches.armadillo800eva/0073-net-sh_eth-use-ioremap.patch172
-rw-r--r--patches.armadillo800eva/0074-sh-modify-prototype-in-sh_eth.h.patch30
-rw-r--r--patches.armadillo800eva/0075-net-sh_eth-move-the-asm-sh_eth.h-to-include-linux.patch55
-rw-r--r--patches.armadillo800eva/0076-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-some.patch86
-rw-r--r--patches.armadillo800eva/0077-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-sh77.patch31
-rw-r--r--patches.armadillo800eva/0078-net-sh_eth-fix-build-failure.patch55
-rw-r--r--patches.armadillo800eva/0079-net-ethernet-convert-drivers-net-ethernet-to-use-mod.patch101
-rw-r--r--patches.armadillo800eva/0080-net-make-ethtool_ops-const.patch49
-rw-r--r--patches.armadillo800eva/0081-sh-eth-use-an-unique-MDIO-bus-name.patch31
-rw-r--r--patches.armadillo800eva/0082-net-sh-eth-Fix-build-error-by-the-value-which-is-not.patch38
-rw-r--r--patches.armadillo800eva/0083-drivers-net-Remove-alloc_etherdev-error-messages.patch120
-rw-r--r--patches.armadillo800eva/0084-net-sh_eth-fix-skb_over_panic-happen.patch64
-rw-r--r--patches.armadillo800eva/0085-sh-eth-use-netdev-stats-structure-and-fix-dma_map_si.patch229
-rw-r--r--patches.armadillo800eva/0086-netdev-ethernet-dev_alloc_skb-to-netdev_alloc_skb.patch89
-rw-r--r--patches.armadillo800eva/0087-renesas-sh_eth.c-fix-linux-interrupt.h-included-twic.patch31
-rw-r--r--patches.armadillo800eva/0088-net-sh_eth-add-the-value-of-tsu-to-the-SH7757-s-GETH.patch32
-rw-r--r--patches.armadillo800eva/0089-net-sh_eth-change-the-condition-of-initialization.patch50
-rw-r--r--patches.armadillo800eva/0090-net-sh_eth-modify-a-condition-of-ioremap-for-TSU.patch65
-rw-r--r--patches.armadillo800eva/0091-net-sh_eth-add-support-for-multicast-filtering.patch362
-rw-r--r--patches.armadillo800eva/0092-net-sh_eth-add-support-for-VLAN-tag-filtering.patch130
-rw-r--r--patches.armadillo800eva/0093-net-sh_eth-Add-support-SH7734.patch163
-rw-r--r--patches.armadillo800eva/0094-net-sh_eth-fix-endian-check-for-architecture-indepen.patch56
-rw-r--r--patches.armadillo800eva/0095-net-sh_eth-add-support-R8A7740.patch211
-rw-r--r--patches.armadillo800eva/0096-atomic-use-linux-atomic.h.patch480
-rw-r--r--patches.armadillo800eva/0097-fbdev-sh_mobile_meram-Enable-runtime-PM.patch46
-rw-r--r--patches.armadillo800eva/0098-fbdev-sh_mobile_meram-Enable-disable-MERAM-along-wit.patch41
-rw-r--r--patches.armadillo800eva/0099-fbdev-sh_mobile_meram-Move-private-data-from-.h-to-..patch58
-rw-r--r--patches.armadillo800eva/0100-fbdev-sh_mobile_meram-Backup-restore-device-register.patch122
-rw-r--r--patches.armadillo800eva/0101-drivercore-Add-helper-macro-for-platform_driver-boil.patch83
-rw-r--r--patches.armadillo800eva/0102-drivercore-Generalize-module_platform_driver.patch85
-rw-r--r--patches.armadillo800eva/0103-fbdev-sh_mobile_lcdc-Turn-dot-clock-on-before-resumi.patch53
-rw-r--r--patches.armadillo800eva/0104-fbdev-sh_mobile_lcdc-Replace-hardcoded-register-valu.patch573
-rw-r--r--patches.armadillo800eva/0105-fbdev-sh_mobile_lcdc-Don-t-acknowlege-interrupts-uni.patch73
-rw-r--r--patches.armadillo800eva/0106-fbdev-sh_mobile_lcdc-Compute-clock-pattern-using-div.patch50
-rw-r--r--patches.armadillo800eva/0107-fbdev-sh_mobile_lcdc-Split-LCDC-start-code-from-sh_m.patch443
-rw-r--r--patches.armadillo800eva/0108-fbdev-sh_mobile_lcdc-Store-the-frame-buffer-base-add.patch67
-rw-r--r--patches.armadillo800eva/0109-fbdev-sh_mobile_lcdc-Restart-LCDC-in-runtime-PM-resu.patch120
-rw-r--r--patches.armadillo800eva/0110-fbdev-sh_mobile_meram-Replace-hardcoded-register-val.patch162
-rw-r--r--patches.armadillo800eva/0111-fbdev-sh_mobile_meram-Validate-ICB-configuration-out.patch56
-rw-r--r--patches.armadillo800eva/0112-fbdev-sh_mobile_meram-Fix-MExxCTL-register-save-on-r.patch36
-rw-r--r--patches.armadillo800eva/0113-fbdev-sh_mobile_meram-Remove-unneeded-sh_mobile_mera.patch101
-rw-r--r--patches.armadillo800eva/0114-sh_mobile_meram-Reset-ICBs-at-unregistration-time.patch38
-rw-r--r--patches.armadillo800eva/0115-fbdev-sh_mobile_lcdc-Adjust-requested-parameters-in-.patch142
-rw-r--r--patches.armadillo800eva/0116-fbdev-sh_mobile_lcdc-Add-support-for-format-changes-.patch51
-rw-r--r--patches.armadillo800eva/0117-fbdev-sh_mobile_lcdc-use-display-information-in-info.patch71
-rw-r--r--patches.armadillo800eva/0118-fbdev-sh_mobile_lcdc-Update-fix.line_length-in-.fb_s.patch61
-rw-r--r--patches.armadillo800eva/0119-fbdev-sh_mobile_lcdc-Avoid-forward-declarations.patch139
-rw-r--r--patches.armadillo800eva/0120-fbdev-sh_mobile_lcdc-Split-channel-initialization-fr.patch332
-rw-r--r--patches.armadillo800eva/0121-fbdev-sh_mobile_lcdc-Remove-sh_mobile_lcdc_set_bpp.patch169
-rw-r--r--patches.armadillo800eva/0122-video-irq-Remove-IRQF_DISABLED.patch59
-rw-r--r--patches.armadillo800eva/0123-video-Add-module.h-to-drivers-video-files-who-really.patch72
-rw-r--r--patches.armadillo800eva/0124-fbdev-sh_mobile_lcdcfb-fixup-LDHAJR-HSYNPAJ-needs-ma.patch33
-rw-r--r--patches.armadillo800eva/0125-fbdev-sh_mipi_dsi-tidyup-dsip_clk.patch75
-rw-r--r--patches.armadillo800eva/0126-fbdev-sh_mipi_dsi-typo-fix-of-SH_MIPI_DSI_HBPBM.patch45
-rw-r--r--patches.armadillo800eva/0127-fbdev-sh_mipi_dsi-tidyup-VMCTR2-parameter-expression.patch37
-rw-r--r--patches.armadillo800eva/0128-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_HFPBM-flag.patch44
-rw-r--r--patches.armadillo800eva/0129-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_BL2E-flag.patch44
-rw-r--r--patches.armadillo800eva/0130-fbdev-sh_mipi_dsi-add-lane-control-support.patch101
-rw-r--r--patches.armadillo800eva/0131-fbdev-sh_mipi_dsi-add-sync_pulses-sync_events-burst-.patch94
-rw-r--r--patches.armadillo800eva/0132-fbdev-sh_mipi_dsi-add-VMLEN1-VMLEN2-calculation.patch106
-rw-r--r--patches.armadillo800eva/0133-fbdev-sh_mipi_dsi-add-set_dot_clock-for-each-platfor.patch147
-rw-r--r--patches.armadillo800eva/0134-fbdev-sh_mipi_dsi-add-HSxxCLK-support.patch84
-rw-r--r--patches.armadillo800eva/0135-fbdev-sh_mipi_dsi-sh_mipi-has-pdata-instead-of-dev.patch58
-rw-r--r--patches.armadillo800eva/0136-fbdev-sh_mipi_dsi-fixup-setup-timing-of-sh_mipi_setu.patch138
-rw-r--r--patches.armadillo800eva/0137-fbdev-sh_mipi_dsi-fixup-setup-timing-of-SYSCONF.patch61
-rw-r--r--patches.armadillo800eva/0138-fbdev-sh_mipi_dsi-fixup-setup-timing-DSICTRL.patch43
-rw-r--r--patches.armadillo800eva/0139-video-convert-drivers-video-to-use-module_platform_d.patch386
-rw-r--r--patches.armadillo800eva/0140-fbdev-Add-FOURCC-based-format-configuration-API.patch423
-rw-r--r--patches.armadillo800eva/0141-v4l-Add-V4L2_PIX_FMT_NV24-and-V4L2_PIX_FMT_NV42-form.patch167
-rw-r--r--patches.armadillo800eva/0142-arm-fix-compile-failure-in-mach-shmobile-board-ag5ev.patch33
-rw-r--r--patches.armadillo800eva/0143-sh-se7724-fix-compile-breakage.patch99
-rw-r--r--patches.armadillo800eva/0144-fbdev-sh_mobile_lcdc-Support-FOURCC-based-format-API.patch731
-rw-r--r--patches.armadillo800eva/0145-fbdev-sh_mobile_lcdc-Reorder-code-into-sections.patch547
-rw-r--r--patches.armadillo800eva/0146-fbdev-sh_mobile_lcdc-Mark-init-only-symbols-with-__d.patch42
-rw-r--r--patches.armadillo800eva/0147-fbdev-sh_mobile_lcdc-Move-pm-runtime-enable-to-probe.patch96
-rw-r--r--patches.armadillo800eva/0148-fbdev-sh_mobile_lcdc-Don-t-pass-struct-device-around.patch149
-rw-r--r--patches.armadillo800eva/0149-fbdev-sh_mobile_lcdc-Create-functions-to-turn-the-di.patch144
-rw-r--r--patches.armadillo800eva/0150-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-channel-in-no.patch47
-rw-r--r--patches.armadillo800eva/0151-sh_mobile_hdmi-Remove-platform-data-lcd_dev-field.patch112
-rw-r--r--patches.armadillo800eva/0152-fbdev-sh_mobile_lcdc-Add-sh_mobile_lcdc_entity-defin.patch49
-rw-r--r--patches.armadillo800eva/0153-fbdev-sh_mobile_hdmi-Implement-sh_mobile_lcdc_entity.patch134
-rw-r--r--patches.armadillo800eva/0154-fbdev-sh_mipi_dsi-Implement-sh_mobile_lcdc_entity-in.patch173
-rw-r--r--patches.armadillo800eva/0155-fbdev-sh_mobile_lcdc-Handle-HDMI-MIPI-transmitter-de.patch118
-rw-r--r--patches.armadillo800eva/0156-fbdev-sh_mipi_dsi-Don-t-hook-up-into-board_cfg-displ.patch129
-rw-r--r--patches.armadillo800eva/0157-fbdev-sh_mobile_hdmi-Don-t-hook-up-into-board_cfg-di.patch120
-rw-r--r--patches.armadillo800eva/0158-arm-mach-shmobile-Don-t-initialize-the-hdmi_info-lcd.patch47
-rw-r--r--patches.armadillo800eva/0159-fbdev-sh_mobile_hdmi-Remove-sh_mobile_hdmi_info-lcd_.patch30
-rw-r--r--patches.armadillo800eva/0160-fbdev-sh_mobile_lcdc-Remove-board-configuration-owne.patch60
-rw-r--r--patches.armadillo800eva/0161-fbdev-sh_mobile_lcdc-Remove-board-configuration-boar.patch344
-rw-r--r--patches.armadillo800eva/0162-fbdev-sh_mobile_lcdc-Move-brightness-ops-to-sh_mobil.patch132
-rw-r--r--patches.armadillo800eva/0163-fbdev-sh_mobile_lcdc-Merge-board_cfg-and-lcd_size_cf.patch314
-rw-r--r--patches.armadillo800eva/0164-sh_mobile_lcdc-Add-an-lcdc-channel-pointer-to-sh_mob.patch64
-rw-r--r--patches.armadillo800eva/0165-sh_mobile_hdmi-Use-sh_mobile_lcdc_entity-channel-to-.patch240
-rw-r--r--patches.armadillo800eva/0166-fbdev-sh_mobile_lcdc-Remove-fb_info-parameter-to-dis.patch95
-rw-r--r--patches.armadillo800eva/0167-fbdev-sh_mobile_lcdc-Return-display-connection-state.patch102
-rw-r--r--patches.armadillo800eva/0168-sh_mobile_lcdc-Add-display-notify-callback-to-sh_mob.patch156
-rw-r--r--patches.armadillo800eva/0169-sh_mobile_hdmi-Use-LCDC-notification-callback.patch158
-rw-r--r--patches.armadillo800eva/0170-fbdev-sh_mobile_lcdc-Pass-a-video-mode-to-the-notify.patch296
-rw-r--r--patches.armadillo800eva/0171-fbdev-sh_mobile_hdmi-Don-t-set-sh_hdmi-mode-in-the-d.patch50
-rw-r--r--patches.armadillo800eva/0172-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-fb_info.patch145
-rw-r--r--patches.armadillo800eva/0173-fbdev-sh_mobile_lcdc-Store-display-mode-in-a-struct-.patch193
-rw-r--r--patches.armadillo800eva/0174-fbdev-sh_mobile_lcdc-Rename-lcd-num-_cfg-lcd-num-_mo.patch405
-rw-r--r--patches.armadillo800eva/0175-fbdev-sh_mobile_lcdc-Reorganize-the-sh_mobile_lcdc_c.patch84
-rw-r--r--patches.armadillo800eva/0176-fbdev-sh_mobile_lcdc-Add-sh_mobile_format_info-funct.patch277
-rw-r--r--patches.armadillo800eva/0177-fbdev-sh_mobile_lcdc-Store-the-format-in-struct-sh_m.patch126
-rw-r--r--patches.armadillo800eva/0178-fbdev-sh_mobile_lcdc-Split-fb-init-cleanup-from-chan.patch396
-rw-r--r--patches.armadillo800eva/0179-fbdev-sh_mobile_lcdc-Pass-physical-device-pointer-to.patch38
-rw-r--r--patches.armadillo800eva/0180-fbdev-sh_mobile_lcdc-Store-configuration-in-channel-.patch278
-rw-r--r--patches.armadillo800eva/0181-fbdev-sh_mobile_lcdc-Pass-channel-pointer-to-sh_mobi.patch100
-rw-r--r--patches.armadillo800eva/0182-fbdev-sh_mobile_meram-Request-memory-regions-for-mem.patch127
-rw-r--r--patches.armadillo800eva/0183-fbdev-sh_mobile_meram-Add-_cfg-suffix-to-struct-sh_m.patch102
-rw-r--r--patches.armadillo800eva/0184-fbdev-sh_mobile_meram-Make-variables-unsigned-where-.patch219
-rw-r--r--patches.armadillo800eva/0185-fbdev-sh_mobile_meram-Make-current_reg-field-store-t.patch34
-rw-r--r--patches.armadillo800eva/0186-fbdev-sh_mobile_meram-Add-struct-sh_mobile_meram_icb.patch444
-rw-r--r--patches.armadillo800eva/0187-fbdev-sh_mobile_meram-Don-t-inline-everything.patch108
-rw-r--r--patches.armadillo800eva/0188-fbdev-sh_mobile_meram-Divide-the-code-into-sections.patch263
-rw-r--r--patches.armadillo800eva/0189-fbdev-sh_mobile_meram-Use-genalloc-to-manage-MERAM-a.patch366
-rw-r--r--patches.armadillo800eva/0190-fbdev-sh_mobile_meram-Allocate-ICBs-automatically.patch740
-rw-r--r--patches.armadillo800eva/0191-arm-mach-shmobile-Don-t-set-MERAM-ICB-numbers-in-pla.patch88
-rw-r--r--patches.armadillo800eva/0192-fbdev-sh_mobile_meram-Remove-unused-sh_mobile_meram_.patch31
-rw-r--r--patches.armadillo800eva/0193-fbdev-sh_mobile_lcdc-Don-t-store-copy-of-platform-da.patch315
-rw-r--r--patches.armadillo800eva/0194-fbdev-sh_mobile_meram-Don-t-perform-update-in-regist.patch97
-rw-r--r--patches.armadillo800eva/0195-fbdev-sh_mobile_meram-Remove-unneeded-sanity-checks.patch155
-rw-r--r--patches.armadillo800eva/0196-fbdev-sh_mobile_meram-Implement-system-suspend-resum.patch56
-rw-r--r--patches.armadillo800eva/0197-fbdev-sh_mipi_dsi-add-extra-phyctrl-for-sh_mipi_dsi_.patch64
-rw-r--r--patches.armadillo800eva/0198-serial-sh-sci-Kill-off-bitrotted-H8-300-support.patch263
-rw-r--r--patches.armadillo800eva/0199-serial-sh-sci-Tidy-up-ioread-write-wrappers-kill-off.patch87
-rw-r--r--patches.armadillo800eva/0200-serial-sh-sci-Kill-off-some-more-unused-definitions.patch38
-rw-r--r--patches.armadillo800eva/0201-serial-sh-sci-Generalize-overrun-handling.patch304
-rw-r--r--patches.armadillo800eva/0202-serial-sh-sci-Consolidate-RXD-pin-handling.patch108
-rw-r--r--patches.armadillo800eva/0203-serial-sh-sci-More-unused-define-purging.patch80
-rw-r--r--patches.armadillo800eva/0204-serial-sh-sci-Abstract-register-maps.patch766
-rw-r--r--patches.armadillo800eva/0205-serial-sh-sci-FIFO-sizing-helper-consolidation.patch255
-rw-r--r--patches.armadillo800eva/0206-serial-sh-sci-Support-generic-SCLSR-overrun-detectio.patch44
-rw-r--r--patches.armadillo800eva/0207-serial-sh-sci-Regtype-probing-doesn-t-need-to-be-fat.patch45
-rw-r--r--patches.armadillo800eva/0208-serial-sh-sci-Add-missing-module-description-author-.patch26
-rw-r--r--patches.armadillo800eva/0209-serial-sh-sci-Kill-off-per-port-enable-disable-callb.patch194
-rw-r--r--patches.armadillo800eva/0210-serial-sh-sci-Fix-up-pretty-name-printing-for-port-I.patch203
-rw-r--r--patches.armadillo800eva/0211-serial-sh-sci-Fix-up-default-regtype-probing.patch34
-rw-r--r--patches.armadillo800eva/0212-serial-sh-sci-fix-DMA-build-by-including-dma-mapping.patch46
-rw-r--r--patches.armadillo800eva/0213-serial-sh-sci-console-Runtime-PM-support.patch145
-rw-r--r--patches.armadillo800eva/0214-sh-sci-PM-Use-power.irq_safe.patch35
-rw-r--r--patches.armadillo800eva/0215-serial-sh-sci-report-CTS-as-active-for-get_mctrl.patch43
-rw-r--r--patches.armadillo800eva/0216-serial-sh-sci-don-t-filter-on-DMA-device-use-only-ch.patch108
-rw-r--r--patches.armadillo800eva/0217-TTY-irq-Remove-IRQF_DISABLED.patch60
-rw-r--r--patches.armadillo800eva/0218-serial-sh-sci-Fix-up-SH-2A-SCIF-support.patch71
-rw-r--r--patches.armadillo800eva/0219-serial-sh-sci-Fix-up-SCFCR-handling.patch111
-rw-r--r--patches.armadillo800eva/0220-serial-sh-sci-Support-icount-statistics-for-error-ca.patch99
-rw-r--r--patches.armadillo800eva/0221-serial-sh-sci-Clarify-enable_ms-break_ctl-comments.patch44
-rw-r--r--patches.armadillo800eva/0222-serial-sh-sci-Fix-up-modem-control-handling.patch60
-rw-r--r--patches.armadillo800eva/0223-serial-sh-sci-Add-support-for-loopback-mode.patch48
-rw-r--r--patches.armadillo800eva/0224-serial-sh-sci-per-port-modem-control.patch110
-rw-r--r--patches.armadillo800eva/0225-serial-sh-sci-Avoid-FIFO-clear-for-MCE-toggle.patch56
-rw-r--r--patches.armadillo800eva/0226-serial-sh-sci-Handle-GPIO-function-requests.patch177
-rw-r--r--patches.armadillo800eva/0227-Input-gpio_keys-switch-to-using-threaded-IRQs.patch42
-rw-r--r--patches.armadillo800eva/0228-Input-gpio_keys-move-to-late_initcall.patch38
-rw-r--r--patches.armadillo800eva/0229-Input-gpio_keys-fix-a-memory-leak.patch29
-rw-r--r--patches.armadillo800eva/0230-Input-gpio_keys-add-support-for-device-tree-platform.patch305
-rw-r--r--patches.armadillo800eva/0231-Input-gpio_keys-switch-to-using-SIMPLE_DEV_PM_OPS.patch56
-rw-r--r--patches.armadillo800eva/0232-Input-gpio_keys-return-proper-error-code-if-memory-a.patch33
-rw-r--r--patches.armadillo800eva/0233-Input-gpio_keys-fix-two-typos-in-devicetree-document.patch30
-rw-r--r--patches.armadillo800eva/0234-Input-gpio_keys-use-of_property_read_u32.patch78
-rw-r--r--patches.armadillo800eva/0235-Input-gpio_keys-fix-struct-device-declared-inside-pa.patch36
-rw-r--r--patches.armadillo800eva/0236-Input-gpio_keys-constify-platform-data.patch139
-rw-r--r--patches.armadillo800eva/0237-Input-revert-gpio_keys-switch-to-using-threaded-IRQs.patch33
-rw-r--r--patches.armadillo800eva/0238-Input-gpio_keys-consolidate-key-destructor-code.patch78
-rw-r--r--patches.armadillo800eva/0239-Input-gpio_keys-add-support-for-interrupt-only-keys.patch395
-rw-r--r--patches.armadillo800eva/0240-Input-sh_keysc-fix-compile-warning.patch36
-rw-r--r--patches.armadillo800eva/0241-Input-keyboard-use-macro-module_platform_driver.patch73
-rw-r--r--patches.armadillo800eva/0242-Update-Nook-Color-machine-3284-to-common-Encore-name.patch34
-rw-r--r--patches.armadillo800eva/0243-ARM-7051-1-cpuimx-boards-fix-mach-types-errors.patch90
-rw-r--r--patches.armadillo800eva/0244-ARM-Add-a-few-machine-types-to-mach-types.patch122
-rw-r--r--patches.armadillo800eva/0245-ARM-Update-mach-types-to-fix-mxs-build-breakage.patch41
-rw-r--r--patches.armadillo800eva/0246-ARM-7193-1-Fix-machine_is_xxx-naming-for-eSata-Sheev.patch90
-rw-r--r--patches.armadillo800eva/0247-ARM-Update-mach-types.patch828
-rw-r--r--patches.armadillo800eva/0248-ARM-mach-shmobile-add-armadillo800eva-board-support.patch235
-rw-r--r--patches.armadillo800eva/0249-ARM-mach-shmobile-armadillo800eva-add-defconfig.patch168
-rw-r--r--patches.armadillo800eva/0250-ARM-mach-shmobile-armadillo800eva-add-support-LCDC0.patch159
-rw-r--r--patches.armadillo800eva/0251-ARM-mach-shmobile-armadillo800eva-add-support-ST1232.patch58
-rw-r--r--patches.armadillo800eva/0252-ARM-mach-shmobile-armadillo800eva-add-support-gpio_k.patch69
-rw-r--r--patches.armadillo800eva/0253-ARM-mach-shmobile-armadillo800eva-add-support-sh_eth.patch108
-rw-r--r--series266
254 files changed, 38577 insertions, 2 deletions
diff --git a/patches.armadillo800eva/0001-module.h-split-out-the-EXPORT_SYMBOL-into-export.h.patch b/patches.armadillo800eva/0001-module.h-split-out-the-EXPORT_SYMBOL-into-export.h.patch
new file mode 100644
index 00000000000000..eae58477b86ed3
--- /dev/null
+++ b/patches.armadillo800eva/0001-module.h-split-out-the-EXPORT_SYMBOL-into-export.h.patch
@@ -0,0 +1,247 @@
+From b85971d89c5269f427fe46aa9336f2f18cf82b8e Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Mon, 23 May 2011 14:11:39 -0400
+Subject: module.h: split out the EXPORT_SYMBOL into export.h
+
+A lot of files pull in module.h when all they are really
+looking for is the basic EXPORT_SYMBOL functionality. The
+recent data from Ingo[1] shows that this is one of several
+instances that has a significant impact on compile times,
+and it should be targeted for factoring out (as done here).
+
+Note that several commonly used header files in include/*
+directly include <linux/module.h> themselves (some 34 of them!)
+The most commonly used ones of these will have to be made
+independent of module.h before the full benefit of this change
+can be realized.
+
+We also transition THIS_MODULE from module.h to export.h,
+since there are lots of files with subsystem structs that
+in turn will have a struct module *owner and only be doing:
+
+ .owner = THIS_MODULE;
+
+and absolutely nothing else modular. So, we also want to have
+the THIS_MODULE definition present in the lightweight header.
+
+[1] https://lkml.org/lkml/2011/5/23/76
+
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+(cherry picked from commit f50169324df4ad942e544386d136216c8617636a)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ include/linux/export.h | 89 ++++++++++++++++++++++++++++++++++++++++++++++++
+ include/linux/module.h | 68 +-----------------------------------
+ 2 files changed, 90 insertions(+), 67 deletions(-)
+ create mode 100644 include/linux/export.h
+
+diff --git a/include/linux/export.h b/include/linux/export.h
+new file mode 100644
+index 0000000..696c0f4
+--- /dev/null
++++ b/include/linux/export.h
+@@ -0,0 +1,89 @@
++#ifndef _LINUX_EXPORT_H
++#define _LINUX_EXPORT_H
++/*
++ * Export symbols from the kernel to modules. Forked from module.h
++ * to reduce the amount of pointless cruft we feed to gcc when only
++ * exporting a simple symbol or two.
++ *
++ * If you feel the need to add #include <linux/foo.h> to this file
++ * then you are doing something wrong and should go away silently.
++ */
++
++/* Some toolchains use a `_' prefix for all user symbols. */
++#ifdef CONFIG_SYMBOL_PREFIX
++#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
++#else
++#define MODULE_SYMBOL_PREFIX ""
++#endif
++
++struct kernel_symbol
++{
++ unsigned long value;
++ const char *name;
++};
++
++#ifdef MODULE
++extern struct module __this_module;
++#define THIS_MODULE (&__this_module)
++#else
++#define THIS_MODULE ((struct module *)0)
++#endif
++
++#ifdef CONFIG_MODULES
++
++#ifndef __GENKSYMS__
++#ifdef CONFIG_MODVERSIONS
++/* Mark the CRC weak since genksyms apparently decides not to
++ * generate a checksums for some symbols */
++#define __CRC_SYMBOL(sym, sec) \
++ extern void *__crc_##sym __attribute__((weak)); \
++ static const unsigned long __kcrctab_##sym \
++ __used \
++ __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
++ = (unsigned long) &__crc_##sym;
++#else
++#define __CRC_SYMBOL(sym, sec)
++#endif
++
++/* For every exported symbol, place a struct in the __ksymtab section */
++#define __EXPORT_SYMBOL(sym, sec) \
++ extern typeof(sym) sym; \
++ __CRC_SYMBOL(sym, sec) \
++ static const char __kstrtab_##sym[] \
++ __attribute__((section("__ksymtab_strings"), aligned(1))) \
++ = MODULE_SYMBOL_PREFIX #sym; \
++ static const struct kernel_symbol __ksymtab_##sym \
++ __used \
++ __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
++ = { (unsigned long)&sym, __kstrtab_##sym }
++
++#define EXPORT_SYMBOL(sym) \
++ __EXPORT_SYMBOL(sym, "")
++
++#define EXPORT_SYMBOL_GPL(sym) \
++ __EXPORT_SYMBOL(sym, "_gpl")
++
++#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
++ __EXPORT_SYMBOL(sym, "_gpl_future")
++
++#ifdef CONFIG_UNUSED_SYMBOLS
++#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
++#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
++#else
++#define EXPORT_UNUSED_SYMBOL(sym)
++#define EXPORT_UNUSED_SYMBOL_GPL(sym)
++#endif
++
++#endif /* __GENKSYMS__ */
++
++#else /* !CONFIG_MODULES... */
++
++#define EXPORT_SYMBOL(sym)
++#define EXPORT_SYMBOL_GPL(sym)
++#define EXPORT_SYMBOL_GPL_FUTURE(sym)
++#define EXPORT_UNUSED_SYMBOL(sym)
++#define EXPORT_UNUSED_SYMBOL_GPL(sym)
++
++#endif /* CONFIG_MODULES */
++
++#endif /* _LINUX_EXPORT_H */
+diff --git a/include/linux/module.h b/include/linux/module.h
+index d9ca2d5..e91cc65 100644
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -16,6 +16,7 @@
+ #include <linux/kobject.h>
+ #include <linux/moduleparam.h>
+ #include <linux/tracepoint.h>
++#include <linux/export.h>
+
+ #include <linux/percpu.h>
+ #include <asm/module.h>
+@@ -25,21 +26,8 @@
+ /* Not Yet Implemented */
+ #define MODULE_SUPPORTED_DEVICE(name)
+
+-/* Some toolchains use a `_' prefix for all user symbols. */
+-#ifdef CONFIG_SYMBOL_PREFIX
+-#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
+-#else
+-#define MODULE_SYMBOL_PREFIX ""
+-#endif
+-
+ #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
+
+-struct kernel_symbol
+-{
+- unsigned long value;
+- const char *name;
+-};
+-
+ struct modversion_info
+ {
+ unsigned long crc;
+@@ -96,11 +84,8 @@ void trim_init_extable(struct module *m);
+ extern const struct gtype##_id __mod_##gtype##_table \
+ __attribute__ ((unused, alias(__stringify(name))))
+
+-extern struct module __this_module;
+-#define THIS_MODULE (&__this_module)
+ #else /* !MODULE */
+ #define MODULE_GENERIC_TABLE(gtype,name)
+-#define THIS_MODULE ((struct module *)0)
+ #endif
+
+ /* Generic info of form tag = "info" */
+@@ -216,52 +201,6 @@ struct module_use {
+ struct module *source, *target;
+ };
+
+-#ifndef __GENKSYMS__
+-#ifdef CONFIG_MODVERSIONS
+-/* Mark the CRC weak since genksyms apparently decides not to
+- * generate a checksums for some symbols */
+-#define __CRC_SYMBOL(sym, sec) \
+- extern void *__crc_##sym __attribute__((weak)); \
+- static const unsigned long __kcrctab_##sym \
+- __used \
+- __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
+- = (unsigned long) &__crc_##sym;
+-#else
+-#define __CRC_SYMBOL(sym, sec)
+-#endif
+-
+-/* For every exported symbol, place a struct in the __ksymtab section */
+-#define __EXPORT_SYMBOL(sym, sec) \
+- extern typeof(sym) sym; \
+- __CRC_SYMBOL(sym, sec) \
+- static const char __kstrtab_##sym[] \
+- __attribute__((section("__ksymtab_strings"), aligned(1))) \
+- = MODULE_SYMBOL_PREFIX #sym; \
+- static const struct kernel_symbol __ksymtab_##sym \
+- __used \
+- __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
+- = { (unsigned long)&sym, __kstrtab_##sym }
+-
+-#define EXPORT_SYMBOL(sym) \
+- __EXPORT_SYMBOL(sym, "")
+-
+-#define EXPORT_SYMBOL_GPL(sym) \
+- __EXPORT_SYMBOL(sym, "_gpl")
+-
+-#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
+- __EXPORT_SYMBOL(sym, "_gpl_future")
+-
+-
+-#ifdef CONFIG_UNUSED_SYMBOLS
+-#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
+-#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
+-#else
+-#define EXPORT_UNUSED_SYMBOL(sym)
+-#define EXPORT_UNUSED_SYMBOL_GPL(sym)
+-#endif
+-
+-#endif
+-
+ enum module_state
+ {
+ MODULE_STATE_LIVE,
+@@ -582,11 +521,6 @@ extern void module_update_tracepoints(void);
+ extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
+
+ #else /* !CONFIG_MODULES... */
+-#define EXPORT_SYMBOL(sym)
+-#define EXPORT_SYMBOL_GPL(sym)
+-#define EXPORT_SYMBOL_GPL_FUTURE(sym)
+-#define EXPORT_UNUSED_SYMBOL(sym)
+-#define EXPORT_UNUSED_SYMBOL_GPL(sym)
+
+ /* Given an address, look for it in the exception tables. */
+ static inline const struct exception_table_entry *
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0002-arm-Add-export.h-to-ARM-specific-files-as-required.patch b/patches.armadillo800eva/0002-arm-Add-export.h-to-ARM-specific-files-as-required.patch
new file mode 100644
index 00000000000000..ed49702aec16aa
--- /dev/null
+++ b/patches.armadillo800eva/0002-arm-Add-export.h-to-ARM-specific-files-as-required.patch
@@ -0,0 +1,460 @@
+From 37e7a4e1eddd663a2c5fddaabf80598f204fea62 Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Sun, 31 Jul 2011 16:17:29 -0400
+Subject: arm: Add export.h to ARM specific files as required.
+
+These files all make use of one of the EXPORT_SYMBOL variants
+or the THIS_MODULE macro. So they will need <linux/export.h>
+
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+(cherry picked from commit dc28094b905a872f8884f1f1c48ca86b3b78583a)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/common/it8152.c | 1 +
+ arch/arm/common/scoop.c | 1 +
+ arch/arm/mach-at91/cpuidle.c | 1 +
+ arch/arm/mach-davinci/board-dm644x-evm.c | 1 +
+ arch/arm/mach-davinci/board-dm646x-evm.c | 1 +
+ arch/arm/mach-davinci/cpufreq.c | 1 +
+ arch/arm/mach-davinci/cpuidle.c | 1 +
+ arch/arm/mach-ep93xx/core.c | 1 +
+ arch/arm/mach-exynos4/dev-sysmmu.c | 1 +
+ arch/arm/mach-iop13xx/pci.c | 1 +
+ arch/arm/mach-ixp2000/core.c | 1 +
+ arch/arm/mach-ixp4xx/common-pci.c | 1 +
+ arch/arm/mach-ixp4xx/common.c | 1 +
+ arch/arm/mach-kirkwood/cpuidle.c | 1 +
+ arch/arm/mach-msm/io.c | 1 +
+ arch/arm/mach-netx/xc.c | 1 +
+ arch/arm/mach-omap1/board-ams-delta.c | 1 +
+ arch/arm/mach-omap1/board-sx1.c | 1 +
+ arch/arm/mach-omap1/board-voiceblue.c | 1 +
+ arch/arm/mach-omap2/board-omap3evm.c | 1 +
+ arch/arm/mach-omap2/pm.c | 1 +
+ arch/arm/mach-omap2/prcm.c | 1 +
+ arch/arm/mach-omap2/usb-tusb6010.c | 1 +
+ arch/arm/mach-omap2/voltage.c | 1 +
+ arch/arm/mach-pxa/poodle.c | 1 +
+ arch/arm/mach-pxa/trizeps4.c | 1 +
+ arch/arm/mach-s3c2410/mach-h1940.c | 1 +
+ arch/arm/mach-s3c64xx/dev-audio.c | 1 +
+ arch/arm/mach-shmobile/clock.c | 1 +
+ arch/arm/mach-tegra/pcie.c | 1 +
+ arch/arm/mm/init.c | 1 +
+ arch/arm/plat-iop/gpio.c | 1 +
+ arch/arm/plat-iop/time.c | 1 +
+ arch/arm/plat-omap/clock.c | 1 +
+ 34 files changed, 34 insertions(+)
+
+diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
+index 7a21927..f8524ac 100644
+--- a/arch/arm/common/it8152.c
++++ b/arch/arm/common/it8152.c
+@@ -25,6 +25,7 @@
+ #include <linux/ioport.h>
+ #include <linux/irq.h>
+ #include <linux/io.h>
++#include <linux/export.h>
+
+ #include <asm/mach/pci.h>
+ #include <asm/hardware/it8152.h>
+diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
+index c11af1e..67685fd 100644
+--- a/arch/arm/common/scoop.c
++++ b/arch/arm/common/scoop.c
+@@ -15,6 +15,7 @@
+ #include <linux/string.h>
+ #include <linux/slab.h>
+ #include <linux/platform_device.h>
++#include <linux/export.h>
+ #include <linux/io.h>
+ #include <asm/gpio.h>
+ #include <asm/hardware/scoop.h>
+diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
+index 1cfeac1..f474272 100644
+--- a/arch/arm/mach-at91/cpuidle.c
++++ b/arch/arm/mach-at91/cpuidle.c
+@@ -19,6 +19,7 @@
+ #include <linux/cpuidle.h>
+ #include <asm/proc-fns.h>
+ #include <linux/io.h>
++#include <linux/export.h>
+
+ #include "pm.h"
+
+diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
+index 556bbd4..6b1760f 100644
+--- a/arch/arm/mach-davinci/board-dm644x-evm.c
++++ b/arch/arm/mach-davinci/board-dm644x-evm.c
+@@ -23,6 +23,7 @@
+ #include <linux/phy.h>
+ #include <linux/clk.h>
+ #include <linux/videodev2.h>
++#include <linux/export.h>
+
+ #include <media/tvp514x.h>
+
+diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
+index 3cdd237..f28a884 100644
+--- a/arch/arm/mach-davinci/board-dm646x-evm.c
++++ b/arch/arm/mach-davinci/board-dm646x-evm.c
+@@ -31,6 +31,7 @@
+ #include <linux/mtd/nand.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/clk.h>
++#include <linux/export.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
+index 41669ec..5bba707 100644
+--- a/arch/arm/mach-davinci/cpufreq.c
++++ b/arch/arm/mach-davinci/cpufreq.c
+@@ -24,6 +24,7 @@
+ #include <linux/err.h>
+ #include <linux/clk.h>
+ #include <linux/platform_device.h>
++#include <linux/export.h>
+
+ #include <mach/hardware.h>
+ #include <mach/cpufreq.h>
+diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c
+index bd59f31..85cc399 100644
+--- a/arch/arm/mach-davinci/cpuidle.c
++++ b/arch/arm/mach-davinci/cpuidle.c
+@@ -16,6 +16,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/cpuidle.h>
+ #include <linux/io.h>
++#include <linux/export.h>
+ #include <asm/proc-fns.h>
+
+ #include <mach/cpuidle.h>
+diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
+index 6659a0d..a946b20 100644
+--- a/arch/arm/mach-ep93xx/core.c
++++ b/arch/arm/mach-ep93xx/core.c
+@@ -33,6 +33,7 @@
+ #include <linux/i2c.h>
+ #include <linux/i2c-gpio.h>
+ #include <linux/spi/spi.h>
++#include <linux/export.h>
+
+ #include <mach/hardware.h>
+ #include <mach/fb.h>
+diff --git a/arch/arm/mach-exynos4/dev-sysmmu.c b/arch/arm/mach-exynos4/dev-sysmmu.c
+index 3b7cae0..781563f 100644
+--- a/arch/arm/mach-exynos4/dev-sysmmu.c
++++ b/arch/arm/mach-exynos4/dev-sysmmu.c
+@@ -12,6 +12,7 @@
+
+ #include <linux/platform_device.h>
+ #include <linux/dma-mapping.h>
++#include <linux/export.h>
+
+ #include <mach/map.h>
+ #include <mach/irqs.h>
+diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
+index ba3dae3..0de7ad2 100644
+--- a/arch/arm/mach-iop13xx/pci.c
++++ b/arch/arm/mach-iop13xx/pci.c
+@@ -21,6 +21,7 @@
+ #include <linux/slab.h>
+ #include <linux/delay.h>
+ #include <linux/jiffies.h>
++#include <linux/export.h>
+ #include <asm/irq.h>
+ #include <mach/hardware.h>
+ #include <asm/sizes.h>
+diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
+index 4068166..276391e 100644
+--- a/arch/arm/mach-ixp2000/core.c
++++ b/arch/arm/mach-ixp2000/core.c
+@@ -25,6 +25,7 @@
+ #include <linux/bitops.h>
+ #include <linux/serial_8250.h>
+ #include <linux/mm.h>
++#include <linux/export.h>
+
+ #include <asm/types.h>
+ #include <asm/setup.h>
+diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
+index e9a5893..98bebd1 100644
+--- a/arch/arm/mach-ixp4xx/common-pci.c
++++ b/arch/arm/mach-ixp4xx/common-pci.c
+@@ -26,6 +26,7 @@
+ #include <linux/delay.h>
+ #include <linux/device.h>
+ #include <linux/io.h>
++#include <linux/export.h>
+ #include <asm/dma-mapping.h>
+
+ #include <asm/cputype.h>
+diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
+index 0777257..b86a005 100644
+--- a/arch/arm/mach-ixp4xx/common.c
++++ b/arch/arm/mach-ixp4xx/common.c
+@@ -28,6 +28,7 @@
+ #include <linux/clocksource.h>
+ #include <linux/clockchips.h>
+ #include <linux/io.h>
++#include <linux/export.h>
+
+ #include <mach/udc.h>
+ #include <mach/hardware.h>
+diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
+index f68d33f..864e569 100644
+--- a/arch/arm/mach-kirkwood/cpuidle.c
++++ b/arch/arm/mach-kirkwood/cpuidle.c
+@@ -18,6 +18,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/cpuidle.h>
+ #include <linux/io.h>
++#include <linux/export.h>
+ #include <asm/proc-fns.h>
+ #include <mach/kirkwood.h>
+
+diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
+index cec6ed1..8bf34bc 100644
+--- a/arch/arm/mach-msm/io.c
++++ b/arch/arm/mach-msm/io.c
+@@ -20,6 +20,7 @@
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/io.h>
++#include <linux/export.h>
+
+ #include <mach/hardware.h>
+ #include <asm/page.h>
+diff --git a/arch/arm/mach-netx/xc.c b/arch/arm/mach-netx/xc.c
+index f009b54..e4cfb7e 100644
+--- a/arch/arm/mach-netx/xc.c
++++ b/arch/arm/mach-netx/xc.c
+@@ -23,6 +23,7 @@
+ #include <linux/mutex.h>
+ #include <linux/slab.h>
+ #include <linux/io.h>
++#include <linux/export.h>
+
+ #include <mach/hardware.h>
+ #include <mach/irqs.h>
+diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
+index f49ce85..be8fe81 100644
+--- a/arch/arm/mach-omap1/board-ams-delta.c
++++ b/arch/arm/mach-omap1/board-ams-delta.c
+@@ -19,6 +19,7 @@
+ #include <linux/leds.h>
+ #include <linux/platform_device.h>
+ #include <linux/serial_8250.h>
++#include <linux/export.h>
+
+ #include <media/soc_camera.h>
+
+diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
+index 0ad781d..63c550c 100644
+--- a/arch/arm/mach-omap1/board-sx1.c
++++ b/arch/arm/mach-omap1/board-sx1.c
+@@ -26,6 +26,7 @@
+ #include <linux/types.h>
+ #include <linux/i2c.h>
+ #include <linux/errno.h>
++#include <linux/export.h>
+
+ #include <mach/hardware.h>
+ #include <asm/mach-types.h>
+diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
+index 65d2420..f2e5eed 100644
+--- a/arch/arm/mach-omap1/board-voiceblue.c
++++ b/arch/arm/mach-omap1/board-voiceblue.c
+@@ -24,6 +24,7 @@
+ #include <linux/serial_8250.h>
+ #include <linux/serial_reg.h>
+ #include <linux/smc91x.h>
++#include <linux/export.h>
+
+ #include <mach/hardware.h>
+ #include <mach/system.h>
+diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
+index b4d4346..0661686 100644
+--- a/arch/arm/mach-omap2/board-omap3evm.c
++++ b/arch/arm/mach-omap2/board-omap3evm.c
+@@ -34,6 +34,7 @@
+ #include <linux/regulator/fixed.h>
+ #include <linux/regulator/machine.h>
+ #include <linux/mmc/host.h>
++#include <linux/export.h>
+
+ #include <mach/hardware.h>
+ #include <asm/mach-types.h>
+diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
+index 49486f5..39ce26c 100644
+--- a/arch/arm/mach-omap2/pm.c
++++ b/arch/arm/mach-omap2/pm.c
+@@ -14,6 +14,7 @@
+ #include <linux/io.h>
+ #include <linux/err.h>
+ #include <linux/opp.h>
++#include <linux/export.h>
+
+ #include <plat/omap-pm.h>
+ #include <plat/omap_device.h>
+diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
+index 6be1438..1a5054e 100644
+--- a/arch/arm/mach-omap2/prcm.c
++++ b/arch/arm/mach-omap2/prcm.c
+@@ -23,6 +23,7 @@
+ #include <linux/clk.h>
+ #include <linux/io.h>
+ #include <linux/delay.h>
++#include <linux/export.h>
+
+ #include <mach/system.h>
+ #include <plat/common.h>
+diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
+index 8dd26b7..d7f4a00 100644
+--- a/arch/arm/mach-omap2/usb-tusb6010.c
++++ b/arch/arm/mach-omap2/usb-tusb6010.c
+@@ -13,6 +13,7 @@
+ #include <linux/delay.h>
+ #include <linux/platform_device.h>
+ #include <linux/gpio.h>
++#include <linux/export.h>
+
+ #include <linux/usb/musb.h>
+
+diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
+index 9ef3789..e964cfd 100644
+--- a/arch/arm/mach-omap2/voltage.c
++++ b/arch/arm/mach-omap2/voltage.c
+@@ -23,6 +23,7 @@
+ #include <linux/io.h>
+ #include <linux/clk.h>
+ #include <linux/err.h>
++#include <linux/export.h>
+ #include <linux/debugfs.h>
+ #include <linux/slab.h>
+
+diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
+index 16d14fd..46db441 100644
+--- a/arch/arm/mach-pxa/poodle.c
++++ b/arch/arm/mach-pxa/poodle.c
+@@ -16,6 +16,7 @@
+ */
+ #include <linux/kernel.h>
+ #include <linux/init.h>
++#include <linux/export.h>
+ #include <linux/platform_device.h>
+ #include <linux/fb.h>
+ #include <linux/pm.h>
+diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
+index 687417a..3f1a258 100644
+--- a/arch/arm/mach-pxa/trizeps4.c
++++ b/arch/arm/mach-pxa/trizeps4.c
+@@ -16,6 +16,7 @@
+ #include <linux/kernel.h>
+ #include <linux/platform_device.h>
+ #include <linux/interrupt.h>
++#include <linux/export.h>
+ #include <linux/sched.h>
+ #include <linux/bitops.h>
+ #include <linux/fb.h>
+diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
+index 2a2fa06..810a992 100644
+--- a/arch/arm/mach-s3c2410/mach-h1940.c
++++ b/arch/arm/mach-s3c2410/mach-h1940.c
+@@ -35,6 +35,7 @@
+ #include <video/platform_lcd.h>
+
+ #include <linux/mmc/host.h>
++#include <linux/export.h>
+
+ #include <asm/mach/arch.h>
+ #include <asm/mach/map.h>
+diff --git a/arch/arm/mach-s3c64xx/dev-audio.c b/arch/arm/mach-s3c64xx/dev-audio.c
+index cad6702..93470b1 100644
+--- a/arch/arm/mach-s3c64xx/dev-audio.c
++++ b/arch/arm/mach-s3c64xx/dev-audio.c
+@@ -13,6 +13,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/gpio.h>
++#include <linux/export.h>
+
+ #include <mach/irqs.h>
+ #include <mach/map.h>
+diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
+index 6b7c7c4..31654d7 100644
+--- a/arch/arm/mach-shmobile/clock.c
++++ b/arch/arm/mach-shmobile/clock.c
+@@ -22,6 +22,7 @@
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/sh_clk.h>
++#include <linux/export.h>
+
+ int __init clk_init(void)
+ {
+diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
+index 2941212..c75df9c 100644
+--- a/arch/arm/mach-tegra/pcie.c
++++ b/arch/arm/mach-tegra/pcie.c
+@@ -32,6 +32,7 @@
+ #include <linux/irq.h>
+ #include <linux/clk.h>
+ #include <linux/delay.h>
++#include <linux/export.h>
+
+ #include <asm/sizes.h>
+ #include <asm/mach/pci.h>
+diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
+index 4a4eba5..e038b49 100644
+--- a/arch/arm/mm/init.c
++++ b/arch/arm/mm/init.c
+@@ -13,6 +13,7 @@
+ #include <linux/init.h>
+ #include <linux/bootmem.h>
+ #include <linux/mman.h>
++#include <linux/export.h>
+ #include <linux/nodemask.h>
+ #include <linux/initrd.h>
+ #include <linux/of_fdt.h>
+diff --git a/arch/arm/plat-iop/gpio.c b/arch/arm/plat-iop/gpio.c
+index 640e498..e4de9be 100644
+--- a/arch/arm/plat-iop/gpio.c
++++ b/arch/arm/plat-iop/gpio.c
+@@ -15,6 +15,7 @@
+ #include <linux/types.h>
+ #include <linux/errno.h>
+ #include <linux/gpio.h>
++#include <linux/export.h>
+ #include <asm/hardware/iop3xx.h>
+
+ void gpio_line_config(int line, int direction)
+diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
+index 7cdc516..568dd02 100644
+--- a/arch/arm/plat-iop/time.c
++++ b/arch/arm/plat-iop/time.c
+@@ -22,6 +22,7 @@
+ #include <linux/io.h>
+ #include <linux/clocksource.h>
+ #include <linux/clockchips.h>
++#include <linux/export.h>
+ #include <mach/hardware.h>
+ #include <asm/irq.h>
+ #include <asm/sched_clock.h>
+diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
+index c9122dd..4910bc0 100644
+--- a/arch/arm/plat-omap/clock.c
++++ b/arch/arm/plat-omap/clock.c
+@@ -14,6 +14,7 @@
+ #include <linux/init.h>
+ #include <linux/list.h>
+ #include <linux/errno.h>
++#include <linux/export.h>
+ #include <linux/err.h>
+ #include <linux/string.h>
+ #include <linux/clk.h>
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0003-ARM-mach-shmobile-cpuidle-single-global-and-last_sta.patch b/patches.armadillo800eva/0003-ARM-mach-shmobile-cpuidle-single-global-and-last_sta.patch
new file mode 100644
index 00000000000000..4ee713f15b2915
--- /dev/null
+++ b/patches.armadillo800eva/0003-ARM-mach-shmobile-cpuidle-single-global-and-last_sta.patch
@@ -0,0 +1,177 @@
+From 5682eb0543203ca520e407300fb8a1c0a39bfeaf Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Fri, 11 Nov 2011 14:01:30 +0900
+Subject: ARM: mach-shmobile: cpuidle single/global and last_state fixes
+
+The following commits break cpuidle on SH-Mobile ARM:
+
+46bcfad cpuidle: Single/Global registration of idle states
+e978aa7 cpuidle: Move dev->last_residency update to driver enter routine; remove dev->last_state
+
+This patch remedies these issues by up-porting the SH-Mobile
+code to fit with the above introduced framework changes.
+
+It is worth noting that the new code becomes significantly cleaner,
+so these framework changes are very welcome. At the same time this
+breakage could probably have been avoided by grepping for "last_state"
+and "cpuidle_register_driver".
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit b73b5c493ac001870bd9faf565a61908c82f52d8)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/pm-sh7372.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/cpuidle.c | 52 ++++++++++++--------------
+ arch/arm/mach-shmobile/include/mach/common.h | 4 +-
+ arch/arm/mach-shmobile/pm-sh7372.c | 14 +++----
+ 3 files changed, 30 insertions(+), 40 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c
+index 2e44f11..1b23342 100644
+--- a/arch/arm/mach-shmobile/cpuidle.c
++++ b/arch/arm/mach-shmobile/cpuidle.c
+@@ -26,65 +26,59 @@ void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void) = {
+ };
+
+ static int shmobile_cpuidle_enter(struct cpuidle_device *dev,
+- struct cpuidle_state *state)
++ struct cpuidle_driver *drv,
++ int index)
+ {
+ ktime_t before, after;
+- int requested_state = state - &dev->states[0];
+
+- dev->last_state = &dev->states[requested_state];
+ before = ktime_get();
+
+ local_irq_disable();
+ local_fiq_disable();
+
+- shmobile_cpuidle_modes[requested_state]();
++ shmobile_cpuidle_modes[index]();
+
+ local_irq_enable();
+ local_fiq_enable();
+
+ after = ktime_get();
+- return ktime_to_ns(ktime_sub(after, before)) >> 10;
++ dev->last_residency = ktime_to_ns(ktime_sub(after, before)) >> 10;
++
++ return index;
+ }
+
+ static struct cpuidle_device shmobile_cpuidle_dev;
+ static struct cpuidle_driver shmobile_cpuidle_driver = {
+ .name = "shmobile_cpuidle",
+ .owner = THIS_MODULE,
++ .states[0] = {
++ .name = "C1",
++ .desc = "WFI",
++ .exit_latency = 1,
++ .target_residency = 1 * 2,
++ .flags = CPUIDLE_FLAG_TIME_VALID,
++ },
++ .safe_state_index = 0, /* C1 */
++ .state_count = 1,
+ };
+
+-void (*shmobile_cpuidle_setup)(struct cpuidle_device *dev);
++void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);
+
+ static int shmobile_cpuidle_init(void)
+ {
+ struct cpuidle_device *dev = &shmobile_cpuidle_dev;
+- struct cpuidle_state *state;
++ struct cpuidle_driver *drv = &shmobile_cpuidle_driver;
+ int i;
+
+- cpuidle_register_driver(&shmobile_cpuidle_driver);
+-
+- for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
+- dev->states[i].name[0] = '\0';
+- dev->states[i].desc[0] = '\0';
+- dev->states[i].enter = shmobile_cpuidle_enter;
+- }
+-
+- i = CPUIDLE_DRIVER_STATE_START;
+-
+- state = &dev->states[i++];
+- snprintf(state->name, CPUIDLE_NAME_LEN, "C1");
+- strncpy(state->desc, "WFI", CPUIDLE_DESC_LEN);
+- state->exit_latency = 1;
+- state->target_residency = 1 * 2;
+- state->power_usage = 3;
+- state->flags = 0;
+- state->flags |= CPUIDLE_FLAG_TIME_VALID;
+-
+- dev->safe_state = state;
+- dev->state_count = i;
++ for (i = 0; i < CPUIDLE_STATE_MAX; i++)
++ drv->states[i].enter = shmobile_cpuidle_enter;
+
+ if (shmobile_cpuidle_setup)
+- shmobile_cpuidle_setup(dev);
++ shmobile_cpuidle_setup(drv);
++
++ cpuidle_register_driver(drv);
+
++ dev->state_count = drv->state_count;
+ cpuidle_register_device(dev);
+
+ return 0;
+diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
+index 06aecb3..37c05ac 100644
+--- a/arch/arm/mach-shmobile/include/mach/common.h
++++ b/arch/arm/mach-shmobile/include/mach/common.h
+@@ -9,9 +9,9 @@ extern int clk_init(void);
+ extern void shmobile_handle_irq_intc(struct pt_regs *);
+ extern void shmobile_handle_irq_gic(struct pt_regs *);
+ extern struct platform_suspend_ops shmobile_suspend_ops;
+-struct cpuidle_device;
++struct cpuidle_driver;
+ extern void (*shmobile_cpuidle_modes[])(void);
+-extern void (*shmobile_cpuidle_setup)(struct cpuidle_device *dev);
++extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);
+
+ extern void sh7367_init_irq(void);
+ extern void sh7367_add_early_devices(void);
+diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
+index 8e4aadf..b516069 100644
+--- a/arch/arm/mach-shmobile/pm-sh7372.c
++++ b/arch/arm/mach-shmobile/pm-sh7372.c
+@@ -52,22 +52,18 @@ static void sh7372_enter_core_standby(void)
+ }
+
+ #ifdef CONFIG_CPU_IDLE
+-static void sh7372_cpuidle_setup(struct cpuidle_device *dev)
++static void sh7372_cpuidle_setup(struct cpuidle_driver *dev)
+ {
+- struct cpuidle_state *state;
+- int i = dev->state_count;
++ struct cpuidle_state *state = &drv->states[drv->state_count];
+
+- state = &dev->states[i];
+ snprintf(state->name, CPUIDLE_NAME_LEN, "C2");
+ strncpy(state->desc, "Core Standby Mode", CPUIDLE_DESC_LEN);
+ state->exit_latency = 10;
+ state->target_residency = 20 + 10;
+- state->power_usage = 1; /* perhaps not */
+- state->flags = 0;
+- state->flags |= CPUIDLE_FLAG_TIME_VALID;
+- shmobile_cpuidle_modes[i] = sh7372_enter_core_standby;
++ state->flags = CPUIDLE_FLAG_TIME_VALID;
++ shmobile_cpuidle_modes[drv->state_count] = sh7372_enter_core_standby;
+
+- dev->state_count = i + 1;
++ drv->state_count++;
+ }
+
+ static void sh7372_cpuidle_init(void)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0004-ARM-entry-re-allocate-registers-in-irq-entry-assembl.patch b/patches.armadillo800eva/0004-ARM-entry-re-allocate-registers-in-irq-entry-assembl.patch
new file mode 100644
index 00000000000000..a5b8cf3d73a6ae
--- /dev/null
+++ b/patches.armadillo800eva/0004-ARM-entry-re-allocate-registers-in-irq-entry-assembl.patch
@@ -0,0 +1,92 @@
+From 0f8d4eb817d031882d348f61acdab92be7863533 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@arm.linux.org.uk>
+Date: Sun, 26 Jun 2011 10:34:02 +0100
+Subject: ARM: entry: re-allocate registers in irq entry assembly macros
+
+This avoids the irq entry assembly corrupting r5, thereby allowing it
+to be preserved through to the svc exit code.
+
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+(cherry picked from commit d9600c99c549732a501cb727157800623a06175d)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/include/asm/entry-macro-multi.S | 14 +++++++-------
+ arch/arm/kernel/entry-armv.S | 10 +++++-----
+ 2 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/arch/arm/include/asm/entry-macro-multi.S b/arch/arm/include/asm/entry-macro-multi.S
+index 2da8547..2f1e209 100644
+--- a/arch/arm/include/asm/entry-macro-multi.S
++++ b/arch/arm/include/asm/entry-macro-multi.S
+@@ -4,8 +4,8 @@
+ * Interrupt handling. Preserves r7, r8, r9
+ */
+ .macro arch_irq_handler_default
+- get_irqnr_preamble r5, lr
+-1: get_irqnr_and_base r0, r6, r5, lr
++ get_irqnr_preamble r6, lr
++1: get_irqnr_and_base r0, r2, r6, lr
+ movne r1, sp
+ @
+ @ routine called with r0 = irq number, r1 = struct pt_regs *
+@@ -17,17 +17,17 @@
+ /*
+ * XXX
+ *
+- * this macro assumes that irqstat (r6) and base (r5) are
++ * this macro assumes that irqstat (r2) and base (r6) are
+ * preserved from get_irqnr_and_base above
+ */
+- ALT_SMP(test_for_ipi r0, r6, r5, lr)
++ ALT_SMP(test_for_ipi r0, r2, r6, lr)
+ ALT_UP_B(9997f)
+ movne r1, sp
+ adrne lr, BSYM(1b)
+ bne do_IPI
+
+ #ifdef CONFIG_LOCAL_TIMERS
+- test_for_ltirq r0, r6, r5, lr
++ test_for_ltirq r0, r2, r6, lr
+ movne r0, sp
+ adrne lr, BSYM(1b)
+ bne do_local_timer
+@@ -40,7 +40,7 @@
+ .align 5
+ .global \symbol_name
+ \symbol_name:
+- mov r4, lr
++ mov r8, lr
+ arch_irq_handler_default
+- mov pc, r4
++ mov pc, r8
+ .endm
+diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
+index 90c62cd..f901c4a 100644
+--- a/arch/arm/kernel/entry-armv.S
++++ b/arch/arm/kernel/entry-armv.S
+@@ -29,16 +29,16 @@
+ #include <asm/entry-macro-multi.S>
+
+ /*
+- * Interrupt handling. Preserves r7, r8, r9
++ * Interrupt handling.
+ */
+ .macro irq_handler
+ #ifdef CONFIG_MULTI_IRQ_HANDLER
+- ldr r5, =handle_arch_irq
++ ldr r1, =handle_arch_irq
+ mov r0, sp
+- ldr r5, [r5]
++ ldr r1, [r1]
+ adr lr, BSYM(9997f)
+- teq r5, #0
+- movne pc, r5
++ teq r1, #0
++ movne pc, r1
+ #endif
+ arch_irq_handler_default
+ 9997:
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0005-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch b/patches.armadillo800eva/0005-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch
new file mode 100644
index 00000000000000..a980580f7c0b2a
--- /dev/null
+++ b/patches.armadillo800eva/0005-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch
@@ -0,0 +1,108 @@
+From 3411576376a113c3a7616495508d3219b18f90d4 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 29 Feb 2012 21:41:30 +0900
+Subject: ARM: mach-shmobile: rename clk_init() to shmobile_clk_init()
+
+Rename clk_init() to shmobile_clk_init() to avoid a potential
+future name space collision with the common clock framework.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+(cherry picked from commit 6b6a4c067cefe04eb0a0e7d1cace16ae727c6295)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/clock-r8a7740.c
+ arch/arm/mach-shmobile/clock-r8a7779.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-sh7367.c | 2 +-
+ arch/arm/mach-shmobile/clock-sh7372.c | 2 +-
+ arch/arm/mach-shmobile/clock-sh7377.c | 2 +-
+ arch/arm/mach-shmobile/clock-sh73a0.c | 2 +-
+ arch/arm/mach-shmobile/clock.c | 2 +-
+ arch/arm/mach-shmobile/include/mach/common.h | 2 +-
+ 6 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
+index 6b186ae..414a3e7 100644
+--- a/arch/arm/mach-shmobile/clock-sh7367.c
++++ b/arch/arm/mach-shmobile/clock-sh7367.c
+@@ -352,7 +352,7 @@ void __init sh7367_clock_init(void)
+ clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
+ if (!ret)
+- clk_init();
++ shmobile_clk_init();
+ else
+ panic("failed to setup sh7367 clocks\n");
+ }
+diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
+index c0800d8..24e0cac 100644
+--- a/arch/arm/mach-shmobile/clock-sh7372.c
++++ b/arch/arm/mach-shmobile/clock-sh7372.c
+@@ -696,7 +696,7 @@ void __init sh7372_clock_init(void)
+ clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
+ if (!ret)
+- clk_init();
++ shmobile_clk_init();
+ else
+ panic("failed to setup sh7372 clocks\n");
+
+diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c
+index 9594246..b88ebd8 100644
+--- a/arch/arm/mach-shmobile/clock-sh7377.c
++++ b/arch/arm/mach-shmobile/clock-sh7377.c
+@@ -363,7 +363,7 @@ void __init sh7377_clock_init(void)
+ clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
+ if (!ret)
+- clk_init();
++ shmobile_clk_init();
+ else
+ panic("failed to setup sh7377 clocks\n");
+ }
+diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
+index bcacb1e..8d4b5db 100644
+--- a/arch/arm/mach-shmobile/clock-sh73a0.c
++++ b/arch/arm/mach-shmobile/clock-sh73a0.c
+@@ -399,7 +399,7 @@ void __init sh73a0_clock_init(void)
+ clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
+ if (!ret)
+- clk_init();
++ shmobile_clk_init();
+ else
+ panic("failed to setup sh73a0 clocks\n");
+ }
+diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
+index 31654d7..e816ca9 100644
+--- a/arch/arm/mach-shmobile/clock.c
++++ b/arch/arm/mach-shmobile/clock.c
+@@ -24,7 +24,7 @@
+ #include <linux/sh_clk.h>
+ #include <linux/export.h>
+
+-int __init clk_init(void)
++int __init shmobile_clk_init(void)
+ {
+ /* Kick the child clocks.. */
+ recalculate_root_clocks();
+diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
+index 37c05ac..df9c771 100644
+--- a/arch/arm/mach-shmobile/include/mach/common.h
++++ b/arch/arm/mach-shmobile/include/mach/common.h
+@@ -5,7 +5,7 @@ extern struct sys_timer shmobile_timer;
+ extern void shmobile_setup_console(void);
+ extern void shmobile_secondary_vector(void);
+ struct clk;
+-extern int clk_init(void);
++extern int shmobile_clk_init(void);
+ extern void shmobile_handle_irq_intc(struct pt_regs *);
+ extern void shmobile_handle_irq_gic(struct pt_regs *);
+ extern struct platform_suspend_ops shmobile_suspend_ops;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0006-ARM-mach-shmobile-add-shmobile_earlytimer_init.patch b/patches.armadillo800eva/0006-ARM-mach-shmobile-add-shmobile_earlytimer_init.patch
new file mode 100644
index 00000000000000..f889bb411954b2
--- /dev/null
+++ b/patches.armadillo800eva/0006-ARM-mach-shmobile-add-shmobile_earlytimer_init.patch
@@ -0,0 +1,55 @@
+From 6b04d564a5743c0c719fb3f78e1c41332a23f911 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Tue, 6 Mar 2012 17:36:14 +0900
+Subject: ARM: mach-shmobile: add shmobile_earlytimer_init()
+
+Add shmobile_earlytimer_init() that can be used to
+enable the earlytimer probing from the SoC code.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+(cherry picked from commit 08ad42fb7702ee2968b5b837e245ca8fd2175223)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/include/mach/common.h | 1 +
+ arch/arm/mach-shmobile/timer.c | 7 ++++++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
+index df9c771..0e37fd5 100644
+--- a/arch/arm/mach-shmobile/include/mach/common.h
++++ b/arch/arm/mach-shmobile/include/mach/common.h
+@@ -1,6 +1,7 @@
+ #ifndef __ARCH_MACH_COMMON_H
+ #define __ARCH_MACH_COMMON_H
+
++extern void shmobile_earlytimer_init(void);
+ extern struct sys_timer shmobile_timer;
+ extern void shmobile_setup_console(void);
+ extern void shmobile_secondary_vector(void);
+diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
+index 895794b..e510643 100644
+--- a/arch/arm/mach-shmobile/timer.c
++++ b/arch/arm/mach-shmobile/timer.c
+@@ -36,11 +36,16 @@ static void __init shmobile_late_time_init(void)
+ early_platform_driver_probe("earlytimer", 2, 0);
+ }
+
+-static void __init shmobile_timer_init(void)
++void __init shmobile_earlytimer_init(void)
+ {
+ late_time_init = shmobile_late_time_init;
+ }
+
++static void __init shmobile_timer_init(void)
++{
++ shmobile_earlytimer_init();
++}
++
+ struct sys_timer shmobile_timer = {
+ .init = shmobile_timer_init,
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0007-ARM-mach-shmobile-default-to-no-earlytimer.patch b/patches.armadillo800eva/0007-ARM-mach-shmobile-default-to-no-earlytimer.patch
new file mode 100644
index 00000000000000..cc1fc147983323
--- /dev/null
+++ b/patches.armadillo800eva/0007-ARM-mach-shmobile-default-to-no-earlytimer.patch
@@ -0,0 +1,34 @@
+From 7a7be0a20ac8e4a536f3797e98bd46ffb9b396ab Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Tue, 6 Mar 2012 17:37:09 +0900
+Subject: ARM: mach-shmobile: default to no earlytimer
+
+Now when all SoCs and boards are converted to use
+shmobile_earlytimer_init(), change the default behavior
+of shmobile_timer.init() from using early timer to
+do nothing which is suitable for upcoming DT support.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+(cherry picked from commit 2854903ad1329d09d7ec35639fff0949e45d496d)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/timer.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
+index e510643..be1ad70 100644
+--- a/arch/arm/mach-shmobile/timer.c
++++ b/arch/arm/mach-shmobile/timer.c
+@@ -43,7 +43,6 @@ void __init shmobile_earlytimer_init(void)
+
+ static void __init shmobile_timer_init(void)
+ {
+- shmobile_earlytimer_init();
+ }
+
+ struct sys_timer shmobile_timer = {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0008-ARM-shmobile-Consolidate-time-keeping-and-irq-enable.patch b/patches.armadillo800eva/0008-ARM-shmobile-Consolidate-time-keeping-and-irq-enable.patch
new file mode 100644
index 00000000000000..69f358a6e20d76
--- /dev/null
+++ b/patches.armadillo800eva/0008-ARM-shmobile-Consolidate-time-keeping-and-irq-enable.patch
@@ -0,0 +1,79 @@
+From bfff9fdccdee8f8073db730e3de9f6a44506cae3 Mon Sep 17 00:00:00 2001
+From: Robert Lee <rob.lee@linaro.org>
+Date: Tue, 20 Mar 2012 15:22:48 -0500
+Subject: ARM: shmobile: Consolidate time keeping and irq enable
+
+Enable core cpuidle timekeeping and irq enabling and remove that
+handling from this code.
+
+Signed-off-by: Robert Lee <rob.lee@linaro.org>
+Reviewed-by: Kevin Hilman <khilman@ti.com>
+Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
+Acked-by: Jean Pihet <j-pihet@ti.com>
+Signed-off-by: Len Brown <len.brown@intel.com>
+(cherry picked from commit ee807dd89c0003a5cc0ec961132cd83542e5c30c)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/cpuidle.c | 31 +++++++------------------------
+ 1 file changed, 7 insertions(+), 24 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c
+index 1b23342..ca23b20 100644
+--- a/arch/arm/mach-shmobile/cpuidle.c
++++ b/arch/arm/mach-shmobile/cpuidle.c
+@@ -14,6 +14,7 @@
+ #include <linux/module.h>
+ #include <linux/err.h>
+ #include <asm/system.h>
++#include <asm/cpuidle.h>
+ #include <asm/io.h>
+
+ static void shmobile_enter_wfi(void)
+@@ -29,37 +30,19 @@ static int shmobile_cpuidle_enter(struct cpuidle_device *dev,
+ struct cpuidle_driver *drv,
+ int index)
+ {
+- ktime_t before, after;
+-
+- before = ktime_get();
+-
+- local_irq_disable();
+- local_fiq_disable();
+-
+ shmobile_cpuidle_modes[index]();
+
+- local_irq_enable();
+- local_fiq_enable();
+-
+- after = ktime_get();
+- dev->last_residency = ktime_to_ns(ktime_sub(after, before)) >> 10;
+-
+ return index;
+ }
+
+ static struct cpuidle_device shmobile_cpuidle_dev;
+ static struct cpuidle_driver shmobile_cpuidle_driver = {
+- .name = "shmobile_cpuidle",
+- .owner = THIS_MODULE,
+- .states[0] = {
+- .name = "C1",
+- .desc = "WFI",
+- .exit_latency = 1,
+- .target_residency = 1 * 2,
+- .flags = CPUIDLE_FLAG_TIME_VALID,
+- },
+- .safe_state_index = 0, /* C1 */
+- .state_count = 1,
++ .name = "shmobile_cpuidle",
++ .owner = THIS_MODULE,
++ .en_core_tk_irqen = 1,
++ .states[0] = ARM_CPUIDLE_WFI_STATE,
++ .safe_state_index = 0, /* C1 */
++ .state_count = 1,
+ };
+
+ void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0009-sh-pfc-get_config_reg-shift-clean-up.patch b/patches.armadillo800eva/0009-sh-pfc-get_config_reg-shift-clean-up.patch
new file mode 100644
index 00000000000000..caefc059337bf6
--- /dev/null
+++ b/patches.armadillo800eva/0009-sh-pfc-get_config_reg-shift-clean-up.patch
@@ -0,0 +1,33 @@
+From 811361798c18763f34b352aebd167eaf01a30b86 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Mon, 17 Oct 2011 18:01:19 +0900
+Subject: sh: pfc: get_config_reg() shift clean up
+
+Clean up the f_width shift code in get_config_reg().
+
+Reported-by: Ryusuke Sakato <ryusuke.sakato.bx@renesas.com>
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit c63bcc6ff135397b38cdb510c173e4a6629cede5)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/pfc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
+index 75934e3..de5e3d6 100644
+--- a/drivers/sh/pfc.c
++++ b/drivers/sh/pfc.c
+@@ -217,7 +217,7 @@ static int get_config_reg(struct pinmux_info *gpioc, pinmux_enum_t enum_id,
+
+ if (!r_width)
+ break;
+- for (n = 0; n < (r_width / f_width) * 1 << f_width; n++) {
++ for (n = 0; n < (r_width / f_width) * (1 << f_width); n++) {
+ if (config_reg->enum_ids[n] == enum_id) {
+ *crp = config_reg;
+ *indexp = n;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0010-sh-pfc-Remove-unused-gpio_in_use-member.patch b/patches.armadillo800eva/0010-sh-pfc-Remove-unused-gpio_in_use-member.patch
new file mode 100644
index 00000000000000..efd5b8a0dcf76f
--- /dev/null
+++ b/patches.armadillo800eva/0010-sh-pfc-Remove-unused-gpio_in_use-member.patch
@@ -0,0 +1,31 @@
+From 3d57900896786b299b6a2e7a3c0514f8b74063dc Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 28 Sep 2011 16:47:06 +0900
+Subject: sh: pfc: Remove unused gpio_in_use member
+
+Remove unused member gpio_in_use from struct pinmux_info.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 2854aedd05255f3142167f4ac715ab67ee569004)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ include/linux/sh_pfc.h | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
+index 30cae70..12f3519 100644
+--- a/include/linux/sh_pfc.h
++++ b/include/linux/sh_pfc.h
+@@ -87,7 +87,6 @@ struct pinmux_info {
+ pinmux_enum_t *gpio_data;
+ unsigned int gpio_data_size;
+
+- unsigned long *gpio_in_use;
+ struct gpio_chip chip;
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0011-sh-pfc-Add-GPIO-IRQ-support.patch b/patches.armadillo800eva/0011-sh-pfc-Add-GPIO-IRQ-support.patch
new file mode 100644
index 00000000000000..84d4066256f6f9
--- /dev/null
+++ b/patches.armadillo800eva/0011-sh-pfc-Add-GPIO-IRQ-support.patch
@@ -0,0 +1,101 @@
+From 8baa9a6e15ed242d3900b8c0caff14f85a0d3f8a Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 28 Sep 2011 16:50:58 +0900
+Subject: sh: pfc: Add GPIO IRQ support
+
+Add GPIO IRQ support to the shared PFC code in drivers/sh/pfc.c
+
+The enums pointed out by a certain GPIO will be matched against
+a table for IRQ to enum mappings.
+
+Only the shared PFC code is updated by this patch. SoC specific
+changes are also needed to allow platforms to make use of this
+feature.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit ad2a8e7ea4128af984a98537b1b9484722b6b4bb)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/pfc.c | 27 +++++++++++++++++++++++++++
+ include/linux/sh_pfc.h | 11 +++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
+index de5e3d6..e67fe17 100644
+--- a/drivers/sh/pfc.c
++++ b/drivers/sh/pfc.c
+@@ -577,6 +577,32 @@ static void sh_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+ sh_gpio_set_value(chip_to_pinmux(chip), offset, value);
+ }
+
++static int sh_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
++{
++ struct pinmux_info *gpioc = chip_to_pinmux(chip);
++ pinmux_enum_t enum_id;
++ pinmux_enum_t *enum_ids;
++ int i, k, pos;
++
++ pos = 0;
++ enum_id = 0;
++ while (1) {
++ pos = get_gpio_enum_id(gpioc, offset, pos, &enum_id);
++ if (pos <= 0 || !enum_id)
++ break;
++
++ for (i = 0; i < gpioc->gpio_irq_size; i++) {
++ enum_ids = gpioc->gpio_irq[i].enum_ids;
++ for (k = 0; enum_ids[k]; k++) {
++ if (enum_ids[k] == enum_id)
++ return gpioc->gpio_irq[i].irq;
++ }
++ }
++ }
++
++ return -ENOSYS;
++}
++
+ int register_pinmux(struct pinmux_info *pip)
+ {
+ struct gpio_chip *chip = &pip->chip;
+@@ -592,6 +618,7 @@ int register_pinmux(struct pinmux_info *pip)
+ chip->get = sh_gpio_get;
+ chip->direction_output = sh_gpio_direction_output;
+ chip->set = sh_gpio_set;
++ chip->to_irq = sh_gpio_to_irq;
+
+ WARN_ON(pip->first_gpio != 0); /* needs testing */
+
+diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
+index 12f3519..bc8c920 100644
+--- a/include/linux/sh_pfc.h
++++ b/include/linux/sh_pfc.h
+@@ -61,6 +61,14 @@ struct pinmux_data_reg {
+ .reg = r, .reg_width = r_width, \
+ .enum_ids = (pinmux_enum_t [r_width]) \
+
++struct pinmux_irq {
++ int irq;
++ pinmux_enum_t *enum_ids;
++};
++
++#define PINMUX_IRQ(irq_nr, ids...) \
++ { .irq = irq_nr, .enum_ids = (pinmux_enum_t []) { ids, 0 } } \
++
+ struct pinmux_range {
+ pinmux_enum_t begin;
+ pinmux_enum_t end;
+@@ -87,6 +95,9 @@ struct pinmux_info {
+ pinmux_enum_t *gpio_data;
+ unsigned int gpio_data_size;
+
++ struct pinmux_irq *gpio_irq;
++ unsigned int gpio_irq_size;
++
+ struct gpio_chip chip;
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0012-ARM-mach-shmobile-move-helper-macro-PORT_DATA_xx-to-.patch b/patches.armadillo800eva/0012-ARM-mach-shmobile-move-helper-macro-PORT_DATA_xx-to-.patch
new file mode 100644
index 00000000000000..211d8ab21c0598
--- /dev/null
+++ b/patches.armadillo800eva/0012-ARM-mach-shmobile-move-helper-macro-PORT_DATA_xx-to-.patch
@@ -0,0 +1,443 @@
+From 18177d90d34aaeb37d44df01b374cc2d5419e832 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 10 Nov 2011 18:45:23 -0800
+Subject: ARM: mach-shmobile: move helper macro PORT_DATA_xx to sh_pfc.h
+
+This patch move PORT_DATA_xx helper macro to sh_pfc.h.
+and pfc-sh7372.c used it
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit bd8d0cbaa00883c84741b98264f8318cdade9c71)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/pfc-sh7367.c | 35 ------
+ arch/arm/mach-shmobile/pfc-sh7372.c | 214 +++++++++++++++++++----------------
+ arch/arm/mach-shmobile/pfc-sh7377.c | 39 -------
+ arch/arm/mach-shmobile/pfc-sh73a0.c | 39 -------
+ include/linux/sh_pfc.h | 36 ++++++
+ 5 files changed, 151 insertions(+), 212 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/pfc-sh7367.c b/arch/arm/mach-shmobile/pfc-sh7367.c
+index 128555e..2518116 100644
+--- a/arch/arm/mach-shmobile/pfc-sh7367.c
++++ b/arch/arm/mach-shmobile/pfc-sh7367.c
+@@ -327,41 +327,6 @@ enum {
+ PINMUX_MARK_END,
+ };
+
+-#define PORT_DATA_I(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)
+-
+-#define PORT_DATA_I_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PD)
+-
+-#define PORT_DATA_I_PU(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PU)
+-
+-#define PORT_DATA_I_PU_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
+-
+-#define PORT_DATA_O(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT)
+-
+-#define PORT_DATA_IO(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
+- PORT##nr##_IN)
+-
+-#define PORT_DATA_IO_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
+- PORT##nr##_IN, PORT##nr##_IN_PD)
+-
+-#define PORT_DATA_IO_PU(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
+- PORT##nr##_IN, PORT##nr##_IN_PU)
+-
+-#define PORT_DATA_IO_PU_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
+- PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
+-
+-
+ static pinmux_enum_t pinmux_data[] = {
+
+ /* specify valid pin states for each pin in GPIO mode */
+diff --git a/arch/arm/mach-shmobile/pfc-sh7372.c b/arch/arm/mach-shmobile/pfc-sh7372.c
+index 9c265da..34d6d76 100644
+--- a/arch/arm/mach-shmobile/pfc-sh7372.c
++++ b/arch/arm/mach-shmobile/pfc-sh7372.c
+@@ -381,108 +381,124 @@ enum {
+ PINMUX_MARK_END,
+ };
+
+-/* PORT_DATA_I_PD(nr) */
+-#define _I___D(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PD)
+-
+-/* PORT_DATA_I_PU(nr) */
+-#define _I__U_(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PU)
+-
+-/* PORT_DATA_I_PU_PD(nr) */
+-#define _I__UD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
+-
+-/* PORT_DATA_O(nr) */
+-#define __O___(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT)
+-
+-/* PORT_DATA_IO(nr) */
+-#define _IO___(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
+- PORT##nr##_IN)
+-
+-/* PORT_DATA_IO_PD(nr) */
+-#define _IO__D(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
+- PORT##nr##_IN, PORT##nr##_IN_PD)
+-
+-/* PORT_DATA_IO_PU(nr) */
+-#define _IO_U_(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
+- PORT##nr##_IN, PORT##nr##_IN_PU)
+-
+-/* PORT_DATA_IO_PU_PD(nr) */
+-#define _IO_UD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
+- PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
+-
+-
+ static pinmux_enum_t pinmux_data[] = {
+
+ /* specify valid pin states for each pin in GPIO mode */
+-
+- _IO__D(0), _IO__D(1), __O___(2), _I___D(3), _I___D(4),
+- _I___D(5), _IO_UD(6), _I___D(7), _IO__D(8), __O___(9),
+-
+- __O___(10), __O___(11), _IO_UD(12), _IO__D(13), _IO__D(14),
+- __O___(15), _IO__D(16), _IO__D(17), _I___D(18), _IO___(19),
+-
+- _IO___(20), _IO___(21), _IO___(22), _IO___(23), _IO___(24),
+- _IO___(25), _IO___(26), _IO___(27), _IO___(28), _IO___(29),
+-
+- _IO___(30), _IO___(31), _IO___(32), _IO___(33), _IO___(34),
+- _IO___(35), _IO___(36), _IO___(37), _IO___(38), _IO___(39),
+-
+- _IO___(40), _IO___(41), _IO___(42), _IO___(43), _IO___(44),
+- _IO___(45), _IO_U_(46), _IO_U_(47), _IO_U_(48), _IO_U_(49),
+-
+- _IO_U_(50), _IO_U_(51), _IO_U_(52), _IO_U_(53), _IO_U_(54),
+- _IO_U_(55), _IO_U_(56), _IO_U_(57), _IO_U_(58), _IO_U_(59),
+-
+- _IO_U_(60), _IO_U_(61), _IO___(62), __O___(63), __O___(64),
+- _IO_U_(65), __O___(66), _IO_U_(67), __O___(68), _IO___(69), /*66?*/
+-
+- _IO___(70), _IO___(71), __O___(72), _I__U_(73), _I__UD(74),
+- _IO_UD(75), _IO_UD(76), _IO_UD(77), _IO_UD(78), _IO_UD(79),
+-
+- _IO_UD(80), _IO_UD(81), _IO_UD(82), _IO_UD(83), _IO_UD(84),
+- _IO_UD(85), _IO_UD(86), _IO_UD(87), _IO_UD(88), _IO_UD(89),
+-
+- _IO_UD(90), _IO_UD(91), _IO_UD(92), _IO_UD(93), _IO_UD(94),
+- _IO_UD(95), _IO_U_(96), _IO_UD(97), _IO_UD(98), __O___(99), /*99?*/
+-
+- _IO__D(100), _IO__D(101), _IO__D(102), _IO__D(103), _IO__D(104),
+- _IO__D(105), _IO_U_(106), _IO_U_(107), _IO_U_(108), _IO_U_(109),
+-
+- _IO_U_(110), _IO_U_(111), _IO__D(112), _IO__D(113), _IO_U_(114),
+- _IO_U_(115), _IO_U_(116), _IO_U_(117), _IO_U_(118), _IO_U_(119),
+-
+- _IO_U_(120), _IO__D(121), _IO__D(122), _IO__D(123), _IO__D(124),
+- _IO__D(125), _IO__D(126), _IO__D(127), _IO__D(128), _IO_UD(129),
+-
+- _IO_UD(130), _IO_UD(131), _IO_UD(132), _IO_UD(133), _IO_UD(134),
+- _IO_UD(135), _IO__D(136), _IO__D(137), _IO__D(138), _IO__D(139),
+-
+- _IO__D(140), _IO__D(141), _IO__D(142), _IO_UD(143), _IO__D(144),
+- _IO__D(145), _IO__D(146), _IO__D(147), _IO__D(148), _IO__D(149),
+-
+- _IO__D(150), _IO__D(151), _IO_UD(152), _I___D(153), _IO_UD(154),
+- _I___D(155), _IO__D(156), _IO__D(157), _I___D(158), _IO__D(159),
+-
+- __O___(160), _IO__D(161), _IO__D(162), _IO__D(163), _I___D(164),
+- _IO__D(165), _I___D(166), _I___D(167), _I___D(168), _I___D(169),
+-
+- _I___D(170), __O___(171), _IO_UD(172), _IO_UD(173), _IO_UD(174),
+- _IO_UD(175), _IO_UD(176), _IO_UD(177), _IO_UD(178), __O___(179),
+-
+- _IO_UD(180), _IO_UD(181), _IO_UD(182), _IO_UD(183), _IO_UD(184),
+- __O___(185), _IO_UD(186), _IO_UD(187), _IO_UD(188), _IO_UD(189),
+-
+- _IO_UD(190),
++ PORT_DATA_IO_PD(0), PORT_DATA_IO_PD(1),
++ PORT_DATA_O(2), PORT_DATA_I_PD(3),
++ PORT_DATA_I_PD(4), PORT_DATA_I_PD(5),
++ PORT_DATA_IO_PU_PD(6), PORT_DATA_I_PD(7),
++ PORT_DATA_IO_PD(8), PORT_DATA_O(9),
++
++ PORT_DATA_O(10), PORT_DATA_O(11),
++ PORT_DATA_IO_PU_PD(12), PORT_DATA_IO_PD(13),
++ PORT_DATA_IO_PD(14), PORT_DATA_O(15),
++ PORT_DATA_IO_PD(16), PORT_DATA_IO_PD(17),
++ PORT_DATA_I_PD(18), PORT_DATA_IO(19),
++
++ PORT_DATA_IO(20), PORT_DATA_IO(21),
++ PORT_DATA_IO(22), PORT_DATA_IO(23),
++ PORT_DATA_IO(24), PORT_DATA_IO(25),
++ PORT_DATA_IO(26), PORT_DATA_IO(27),
++ PORT_DATA_IO(28), PORT_DATA_IO(29),
++
++ PORT_DATA_IO(30), PORT_DATA_IO(31),
++ PORT_DATA_IO(32), PORT_DATA_IO(33),
++ PORT_DATA_IO(34), PORT_DATA_IO(35),
++ PORT_DATA_IO(36), PORT_DATA_IO(37),
++ PORT_DATA_IO(38), PORT_DATA_IO(39),
++
++ PORT_DATA_IO(40), PORT_DATA_IO(41),
++ PORT_DATA_IO(42), PORT_DATA_IO(43),
++ PORT_DATA_IO(44), PORT_DATA_IO(45),
++ PORT_DATA_IO_PU(46), PORT_DATA_IO_PU(47),
++ PORT_DATA_IO_PU(48), PORT_DATA_IO_PU(49),
++
++ PORT_DATA_IO_PU(50), PORT_DATA_IO_PU(51),
++ PORT_DATA_IO_PU(52), PORT_DATA_IO_PU(53),
++ PORT_DATA_IO_PU(54), PORT_DATA_IO_PU(55),
++ PORT_DATA_IO_PU(56), PORT_DATA_IO_PU(57),
++ PORT_DATA_IO_PU(58), PORT_DATA_IO_PU(59),
++
++ PORT_DATA_IO_PU(60), PORT_DATA_IO_PU(61),
++ PORT_DATA_IO(62), PORT_DATA_O(63),
++ PORT_DATA_O(64), PORT_DATA_IO_PU(65),
++ PORT_DATA_O(66), PORT_DATA_IO_PU(67), /*66?*/
++ PORT_DATA_O(68), PORT_DATA_IO(69),
++
++ PORT_DATA_IO(70), PORT_DATA_IO(71),
++ PORT_DATA_O(72), PORT_DATA_I_PU(73),
++ PORT_DATA_I_PU_PD(74), PORT_DATA_IO_PU_PD(75),
++ PORT_DATA_IO_PU_PD(76), PORT_DATA_IO_PU_PD(77),
++ PORT_DATA_IO_PU_PD(78), PORT_DATA_IO_PU_PD(79),
++
++ PORT_DATA_IO_PU_PD(80), PORT_DATA_IO_PU_PD(81),
++ PORT_DATA_IO_PU_PD(82), PORT_DATA_IO_PU_PD(83),
++ PORT_DATA_IO_PU_PD(84), PORT_DATA_IO_PU_PD(85),
++ PORT_DATA_IO_PU_PD(86), PORT_DATA_IO_PU_PD(87),
++ PORT_DATA_IO_PU_PD(88), PORT_DATA_IO_PU_PD(89),
++
++ PORT_DATA_IO_PU_PD(90), PORT_DATA_IO_PU_PD(91),
++ PORT_DATA_IO_PU_PD(92), PORT_DATA_IO_PU_PD(93),
++ PORT_DATA_IO_PU_PD(94), PORT_DATA_IO_PU_PD(95),
++ PORT_DATA_IO_PU(96), PORT_DATA_IO_PU_PD(97),
++ PORT_DATA_IO_PU_PD(98), PORT_DATA_O(99), /*99?*/
++
++ PORT_DATA_IO_PD(100), PORT_DATA_IO_PD(101),
++ PORT_DATA_IO_PD(102), PORT_DATA_IO_PD(103),
++ PORT_DATA_IO_PD(104), PORT_DATA_IO_PD(105),
++ PORT_DATA_IO_PU(106), PORT_DATA_IO_PU(107),
++ PORT_DATA_IO_PU(108), PORT_DATA_IO_PU(109),
++
++ PORT_DATA_IO_PU(110), PORT_DATA_IO_PU(111),
++ PORT_DATA_IO_PD(112), PORT_DATA_IO_PD(113),
++ PORT_DATA_IO_PU(114), PORT_DATA_IO_PU(115),
++ PORT_DATA_IO_PU(116), PORT_DATA_IO_PU(117),
++ PORT_DATA_IO_PU(118), PORT_DATA_IO_PU(119),
++
++ PORT_DATA_IO_PU(120), PORT_DATA_IO_PD(121),
++ PORT_DATA_IO_PD(122), PORT_DATA_IO_PD(123),
++ PORT_DATA_IO_PD(124), PORT_DATA_IO_PD(125),
++ PORT_DATA_IO_PD(126), PORT_DATA_IO_PD(127),
++ PORT_DATA_IO_PD(128), PORT_DATA_IO_PU_PD(129),
++
++ PORT_DATA_IO_PU_PD(130), PORT_DATA_IO_PU_PD(131),
++ PORT_DATA_IO_PU_PD(132), PORT_DATA_IO_PU_PD(133),
++ PORT_DATA_IO_PU_PD(134), PORT_DATA_IO_PU_PD(135),
++ PORT_DATA_IO_PD(136), PORT_DATA_IO_PD(137),
++ PORT_DATA_IO_PD(138), PORT_DATA_IO_PD(139),
++
++ PORT_DATA_IO_PD(140), PORT_DATA_IO_PD(141),
++ PORT_DATA_IO_PD(142), PORT_DATA_IO_PU_PD(143),
++ PORT_DATA_IO_PD(144), PORT_DATA_IO_PD(145),
++ PORT_DATA_IO_PD(146), PORT_DATA_IO_PD(147),
++ PORT_DATA_IO_PD(148), PORT_DATA_IO_PD(149),
++
++ PORT_DATA_IO_PD(150), PORT_DATA_IO_PD(151),
++ PORT_DATA_IO_PU_PD(152), PORT_DATA_I_PD(153),
++ PORT_DATA_IO_PU_PD(154), PORT_DATA_I_PD(155),
++ PORT_DATA_IO_PD(156), PORT_DATA_IO_PD(157),
++ PORT_DATA_I_PD(158), PORT_DATA_IO_PD(159),
++
++ PORT_DATA_O(160), PORT_DATA_IO_PD(161),
++ PORT_DATA_IO_PD(162), PORT_DATA_IO_PD(163),
++ PORT_DATA_I_PD(164), PORT_DATA_IO_PD(165),
++ PORT_DATA_I_PD(166), PORT_DATA_I_PD(167),
++ PORT_DATA_I_PD(168), PORT_DATA_I_PD(169),
++
++ PORT_DATA_I_PD(170), PORT_DATA_O(171),
++ PORT_DATA_IO_PU_PD(172), PORT_DATA_IO_PU_PD(173),
++ PORT_DATA_IO_PU_PD(174), PORT_DATA_IO_PU_PD(175),
++ PORT_DATA_IO_PU_PD(176), PORT_DATA_IO_PU_PD(177),
++ PORT_DATA_IO_PU_PD(178), PORT_DATA_O(179),
++
++ PORT_DATA_IO_PU_PD(180), PORT_DATA_IO_PU_PD(181),
++ PORT_DATA_IO_PU_PD(182), PORT_DATA_IO_PU_PD(183),
++ PORT_DATA_IO_PU_PD(184), PORT_DATA_O(185),
++ PORT_DATA_IO_PU_PD(186), PORT_DATA_IO_PU_PD(187),
++ PORT_DATA_IO_PU_PD(188), PORT_DATA_IO_PU_PD(189),
++
++ PORT_DATA_IO_PU_PD(190),
+
+ /* IRQ */
+ PINMUX_DATA(IRQ0_6_MARK, PORT6_FN0, MSEL1CR_0_0),
+diff --git a/arch/arm/mach-shmobile/pfc-sh7377.c b/arch/arm/mach-shmobile/pfc-sh7377.c
+index 613e684..e4c7018 100644
+--- a/arch/arm/mach-shmobile/pfc-sh7377.c
++++ b/arch/arm/mach-shmobile/pfc-sh7377.c
+@@ -360,45 +360,6 @@ enum {
+ PINMUX_MARK_END,
+ };
+
+-#define PORT_DATA_I(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)
+-
+-#define PORT_DATA_I_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PD)
+-
+-#define PORT_DATA_I_PU(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PU)
+-
+-#define PORT_DATA_I_PU_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PD, \
+- PORT##nr##_IN_PU)
+-
+-#define PORT_DATA_O(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT)
+-
+-#define PORT_DATA_IO(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT, PORT##nr##_IN)
+-
+-#define PORT_DATA_IO_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT, PORT##nr##_IN, \
+- PORT##nr##_IN_PD)
+-
+-#define PORT_DATA_IO_PU(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT, PORT##nr##_IN, \
+- PORT##nr##_IN_PU)
+-
+-#define PORT_DATA_IO_PU_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT, PORT##nr##_IN, \
+- PORT##nr##_IN_PD, PORT##nr##_IN_PU)
+-
+ static pinmux_enum_t pinmux_data[] = {
+ /* specify valid pin states for each pin in GPIO mode */
+ /* 55-1 (GPIO) */
+diff --git a/arch/arm/mach-shmobile/pfc-sh73a0.c b/arch/arm/mach-shmobile/pfc-sh73a0.c
+index 3eed44e..37467ab 100644
+--- a/arch/arm/mach-shmobile/pfc-sh73a0.c
++++ b/arch/arm/mach-shmobile/pfc-sh73a0.c
+@@ -503,45 +503,6 @@ enum {
+ PINMUX_MARK_END,
+ };
+
+-#define PORT_DATA_I(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)
+-
+-#define PORT_DATA_I_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PD)
+-
+-#define PORT_DATA_I_PU(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PU)
+-
+-#define PORT_DATA_I_PU_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_IN, PORT##nr##_IN_PD, \
+- PORT##nr##_IN_PU)
+-
+-#define PORT_DATA_O(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT)
+-
+-#define PORT_DATA_IO(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT, PORT##nr##_IN)
+-
+-#define PORT_DATA_IO_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT, PORT##nr##_IN, \
+- PORT##nr##_IN_PD)
+-
+-#define PORT_DATA_IO_PU(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT, PORT##nr##_IN, \
+- PORT##nr##_IN_PU)
+-
+-#define PORT_DATA_IO_PU_PD(nr) \
+- PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
+- PORT##nr##_OUT, PORT##nr##_IN, \
+- PORT##nr##_IN_PD, PORT##nr##_IN_PU)
+-
+ static pinmux_enum_t pinmux_data[] = {
+ /* specify valid pin states for each pin in GPIO mode */
+
+diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
+index bc8c920..5585f28 100644
+--- a/include/linux/sh_pfc.h
++++ b/include/linux/sh_pfc.h
+@@ -104,4 +104,40 @@ struct pinmux_info {
+ int register_pinmux(struct pinmux_info *pip);
+ int unregister_pinmux(struct pinmux_info *pip);
+
++/* helper macro for pinmux_enum_t */
++#define PORT_DATA_I(nr) \
++ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)
++
++#define PORT_DATA_I_PD(nr) \
++ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
++ PORT##nr##_IN, PORT##nr##_IN_PD)
++
++#define PORT_DATA_I_PU(nr) \
++ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
++ PORT##nr##_IN, PORT##nr##_IN_PU)
++
++#define PORT_DATA_I_PU_PD(nr) \
++ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, \
++ PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
++
++#define PORT_DATA_O(nr) \
++ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT)
++
++#define PORT_DATA_IO(nr) \
++ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
++ PORT##nr##_IN)
++
++#define PORT_DATA_IO_PD(nr) \
++ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
++ PORT##nr##_IN, PORT##nr##_IN_PD)
++
++#define PORT_DATA_IO_PU(nr) \
++ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
++ PORT##nr##_IN, PORT##nr##_IN_PU)
++
++#define PORT_DATA_IO_PU_PD(nr) \
++ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
++ PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
++
++
+ #endif /* __SH_PFC_H */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0013-ARM-mach-shmobile-move-helper-macro-PORT_xx-to-sh_pf.patch b/patches.armadillo800eva/0013-ARM-mach-shmobile-move-helper-macro-PORT_xx-to-sh_pf.patch
new file mode 100644
index 00000000000000..66c1744c4a4964
--- /dev/null
+++ b/patches.armadillo800eva/0013-ARM-mach-shmobile-move-helper-macro-PORT_xx-to-sh_pf.patch
@@ -0,0 +1,509 @@
+From d97e47700f5315b5636f66afb3bf50c1310def2f Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 10 Nov 2011 18:45:33 -0800
+Subject: ARM: mach-shmobile: move helper macro PORT_xx to sh_pfc.h
+
+This patch moves PORT_xx helper macro to sh_pfc.h,
+and it expects CPU_ALL_PORT() macro for each CPU
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 972c3fb69cd1cd8d549b8a06ce42611eab405c20)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/pfc-sh7367.c | 71 ++++++++---------------
+ arch/arm/mach-shmobile/pfc-sh7372.c | 32 +++--------
+ arch/arm/mach-shmobile/pfc-sh7377.c | 103 +++++++++++++--------------------
+ arch/arm/mach-shmobile/pfc-sh73a0.c | 108 +++++++++++++++--------------------
+ include/linux/sh_pfc.h | 23 ++++++++
+ 5 files changed, 140 insertions(+), 197 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/pfc-sh7367.c b/arch/arm/mach-shmobile/pfc-sh7367.c
+index 2518116..32fbf02 100644
+--- a/arch/arm/mach-shmobile/pfc-sh7367.c
++++ b/arch/arm/mach-shmobile/pfc-sh7367.c
+@@ -21,68 +21,49 @@
+ #include <linux/gpio.h>
+ #include <mach/sh7367.h>
+
+-#define _1(fn, pfx, sfx) fn(pfx, sfx)
+-
+-#define _10(fn, pfx, sfx) \
+- _1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \
+- _1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \
+- _1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \
+- _1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \
+- _1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx)
+-
+-#define _90(fn, pfx, sfx) \
+- _10(fn, pfx##1, sfx), _10(fn, pfx##2, sfx), \
+- _10(fn, pfx##3, sfx), _10(fn, pfx##4, sfx), \
+- _10(fn, pfx##5, sfx), _10(fn, pfx##6, sfx), \
+- _10(fn, pfx##7, sfx), _10(fn, pfx##8, sfx), \
+- _10(fn, pfx##9, sfx)
+-
+-#define _273(fn, pfx, sfx) \
+- _10(fn, pfx, sfx), _90(fn, pfx, sfx), \
+- _10(fn, pfx##10, sfx), _90(fn, pfx##1, sfx), \
+- _10(fn, pfx##20, sfx), _10(fn, pfx##21, sfx), \
+- _10(fn, pfx##22, sfx), _10(fn, pfx##23, sfx), \
+- _10(fn, pfx##24, sfx), _10(fn, pfx##25, sfx), \
+- _10(fn, pfx##26, sfx), _1(fn, pfx##270, sfx), \
+- _1(fn, pfx##271, sfx), _1(fn, pfx##272, sfx)
+-
+-#define _PORT(pfx, sfx) pfx##_##sfx
+-#define PORT_273(str) _273(_PORT, PORT, str)
++#define CPU_ALL_PORT(fn, pfx, sfx) \
++ PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
++ PORT_10(fn, pfx##10, sfx), PORT_90(fn, pfx##1, sfx), \
++ PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \
++ PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \
++ PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \
++ PORT_10(fn, pfx##26, sfx), PORT_1(fn, pfx##270, sfx), \
++ PORT_1(fn, pfx##271, sfx), PORT_1(fn, pfx##272, sfx)
+
+ enum {
+ PINMUX_RESERVED = 0,
+
+ PINMUX_DATA_BEGIN,
+- PORT_273(DATA), /* PORT0_DATA -> PORT272_DATA */
++ PORT_ALL(DATA), /* PORT0_DATA -> PORT272_DATA */
+ PINMUX_DATA_END,
+
+ PINMUX_INPUT_BEGIN,
+- PORT_273(IN), /* PORT0_IN -> PORT272_IN */
++ PORT_ALL(IN), /* PORT0_IN -> PORT272_IN */
+ PINMUX_INPUT_END,
+
+ PINMUX_INPUT_PULLUP_BEGIN,
+- PORT_273(IN_PU), /* PORT0_IN_PU -> PORT272_IN_PU */
++ PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT272_IN_PU */
+ PINMUX_INPUT_PULLUP_END,
+
+ PINMUX_INPUT_PULLDOWN_BEGIN,
+- PORT_273(IN_PD), /* PORT0_IN_PD -> PORT272_IN_PD */
++ PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT272_IN_PD */
+ PINMUX_INPUT_PULLDOWN_END,
+
+ PINMUX_OUTPUT_BEGIN,
+- PORT_273(OUT), /* PORT0_OUT -> PORT272_OUT */
++ PORT_ALL(OUT), /* PORT0_OUT -> PORT272_OUT */
+ PINMUX_OUTPUT_END,
+
+ PINMUX_FUNCTION_BEGIN,
+- PORT_273(FN_IN), /* PORT0_FN_IN -> PORT272_FN_IN */
+- PORT_273(FN_OUT), /* PORT0_FN_OUT -> PORT272_FN_OUT */
+- PORT_273(FN0), /* PORT0_FN0 -> PORT272_FN0 */
+- PORT_273(FN1), /* PORT0_FN1 -> PORT272_FN1 */
+- PORT_273(FN2), /* PORT0_FN2 -> PORT272_FN2 */
+- PORT_273(FN3), /* PORT0_FN3 -> PORT272_FN3 */
+- PORT_273(FN4), /* PORT0_FN4 -> PORT272_FN4 */
+- PORT_273(FN5), /* PORT0_FN5 -> PORT272_FN5 */
+- PORT_273(FN6), /* PORT0_FN6 -> PORT272_FN6 */
+- PORT_273(FN7), /* PORT0_FN7 -> PORT272_FN7 */
++ PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT272_FN_IN */
++ PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT272_FN_OUT */
++ PORT_ALL(FN0), /* PORT0_FN0 -> PORT272_FN0 */
++ PORT_ALL(FN1), /* PORT0_FN1 -> PORT272_FN1 */
++ PORT_ALL(FN2), /* PORT0_FN2 -> PORT272_FN2 */
++ PORT_ALL(FN3), /* PORT0_FN3 -> PORT272_FN3 */
++ PORT_ALL(FN4), /* PORT0_FN4 -> PORT272_FN4 */
++ PORT_ALL(FN5), /* PORT0_FN5 -> PORT272_FN5 */
++ PORT_ALL(FN6), /* PORT0_FN6 -> PORT272_FN6 */
++ PORT_ALL(FN7), /* PORT0_FN7 -> PORT272_FN7 */
+
+ MSELBCR_MSEL2_1, MSELBCR_MSEL2_0,
+ PINMUX_FUNCTION_END,
+@@ -1063,13 +1044,9 @@ static pinmux_enum_t pinmux_data[] = {
+ PINMUX_DATA(DIVLOCK_MARK, PORT272_FN1),
+ };
+
+-#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
+-#define GPIO_PORT_273() _273(_GPIO_PORT, , unused)
+-#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
+-
+ static struct pinmux_gpio pinmux_gpios[] = {
+ /* 49-1 -> 49-6 (GPIO) */
+- GPIO_PORT_273(),
++ GPIO_PORT_ALL(),
+
+ /* Special Pull-up / Pull-down Functions */
+ GPIO_FN(PORT48_KEYIN0_PU), GPIO_FN(PORT49_KEYIN1_PU),
+diff --git a/arch/arm/mach-shmobile/pfc-sh7372.c b/arch/arm/mach-shmobile/pfc-sh7372.c
+index 34d6d76..4b43626 100644
+--- a/arch/arm/mach-shmobile/pfc-sh7372.c
++++ b/arch/arm/mach-shmobile/pfc-sh7372.c
+@@ -25,27 +25,13 @@
+ #include <linux/gpio.h>
+ #include <mach/sh7372.h>
+
+-#define _1(fn, pfx, sfx) fn(pfx, sfx)
+-
+-#define _10(fn, pfx, sfx) \
+- _1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \
+- _1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \
+- _1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \
+- _1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \
+- _1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx)
+-
+-#define _80(fn, pfx, sfx) \
+- _10(fn, pfx##1, sfx), _10(fn, pfx##2, sfx), \
+- _10(fn, pfx##3, sfx), _10(fn, pfx##4, sfx), \
+- _10(fn, pfx##5, sfx), _10(fn, pfx##6, sfx), \
+- _10(fn, pfx##7, sfx), _10(fn, pfx##8, sfx)
+-
+-#define _190(fn, pfx, sfx) \
+- _10(fn, pfx, sfx), _80(fn, pfx, sfx), _10(fn, pfx##9, sfx), \
+- _10(fn, pfx##10, sfx), _80(fn, pfx##1, sfx), _1(fn, pfx##190, sfx)
+-
+-#define _PORT(pfx, sfx) pfx##_##sfx
+-#define PORT_ALL(str) _190(_PORT, PORT, str)
++#define CPU_ALL_PORT(fn, pfx, sfx) \
++ PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
++ PORT_10(fn, pfx##10, sfx), PORT_10(fn, pfx##11, sfx), \
++ PORT_10(fn, pfx##12, sfx), PORT_10(fn, pfx##13, sfx), \
++ PORT_10(fn, pfx##14, sfx), PORT_10(fn, pfx##15, sfx), \
++ PORT_10(fn, pfx##16, sfx), PORT_10(fn, pfx##17, sfx), \
++ PORT_10(fn, pfx##18, sfx), PORT_1(fn, pfx##190, sfx)
+
+ enum {
+ PINMUX_RESERVED = 0,
+@@ -942,10 +928,6 @@ static pinmux_enum_t pinmux_data[] = {
+ PINMUX_DATA(MFIv4_MARK, MSEL4CR_6_1),
+ };
+
+-#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
+-#define GPIO_PORT_ALL() _190(_GPIO_PORT, , unused)
+-#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
+-
+ static struct pinmux_gpio pinmux_gpios[] = {
+
+ /* PORT */
+diff --git a/arch/arm/mach-shmobile/pfc-sh7377.c b/arch/arm/mach-shmobile/pfc-sh7377.c
+index e4c7018..fb3cfd3 100644
+--- a/arch/arm/mach-shmobile/pfc-sh7377.c
++++ b/arch/arm/mach-shmobile/pfc-sh7377.c
+@@ -22,84 +22,65 @@
+ #include <linux/gpio.h>
+ #include <mach/sh7377.h>
+
+-#define _1(fn, pfx, sfx) fn(pfx, sfx)
+-
+-#define _10(fn, pfx, sfx) \
+- _1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \
+- _1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \
+- _1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \
+- _1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \
+- _1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx)
+-
+-#define _90(fn, pfx, sfx) \
+- _10(fn, pfx##1, sfx), _10(fn, pfx##2, sfx), \
+- _10(fn, pfx##3, sfx), _10(fn, pfx##4, sfx), \
+- _10(fn, pfx##5, sfx), _10(fn, pfx##6, sfx), \
+- _10(fn, pfx##7, sfx), _10(fn, pfx##8, sfx), \
+- _10(fn, pfx##9, sfx)
+-
+-#define _265(fn, pfx, sfx) \
+- _10(fn, pfx, sfx), _90(fn, pfx, sfx), \
+- _10(fn, pfx##10, sfx), \
+- _1(fn, pfx##110, sfx), _1(fn, pfx##111, sfx), \
+- _1(fn, pfx##112, sfx), _1(fn, pfx##113, sfx), \
+- _1(fn, pfx##114, sfx), _1(fn, pfx##115, sfx), \
+- _1(fn, pfx##116, sfx), _1(fn, pfx##117, sfx), \
+- _1(fn, pfx##118, sfx), \
+- _1(fn, pfx##128, sfx), _1(fn, pfx##129, sfx), \
+- _10(fn, pfx##13, sfx), _10(fn, pfx##14, sfx), \
+- _10(fn, pfx##15, sfx), \
+- _1(fn, pfx##160, sfx), _1(fn, pfx##161, sfx), \
+- _1(fn, pfx##162, sfx), _1(fn, pfx##163, sfx), \
+- _1(fn, pfx##164, sfx), \
+- _1(fn, pfx##192, sfx), _1(fn, pfx##193, sfx), \
+- _1(fn, pfx##194, sfx), _1(fn, pfx##195, sfx), \
+- _1(fn, pfx##196, sfx), _1(fn, pfx##197, sfx), \
+- _1(fn, pfx##198, sfx), _1(fn, pfx##199, sfx), \
+- _10(fn, pfx##20, sfx), _10(fn, pfx##21, sfx), \
+- _10(fn, pfx##22, sfx), _10(fn, pfx##23, sfx), \
+- _10(fn, pfx##24, sfx), _10(fn, pfx##25, sfx), \
+- _1(fn, pfx##260, sfx), _1(fn, pfx##261, sfx), \
+- _1(fn, pfx##262, sfx), _1(fn, pfx##263, sfx), \
+- _1(fn, pfx##264, sfx)
+-
+-#define _PORT(pfx, sfx) pfx##_##sfx
+-#define PORT_265(str) _265(_PORT, PORT, str)
++#define CPU_ALL_PORT(fn, pfx, sfx) \
++ PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
++ PORT_10(fn, pfx##10, sfx), \
++ PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \
++ PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \
++ PORT_1(fn, pfx##114, sfx), PORT_1(fn, pfx##115, sfx), \
++ PORT_1(fn, pfx##116, sfx), PORT_1(fn, pfx##117, sfx), \
++ PORT_1(fn, pfx##118, sfx), \
++ PORT_1(fn, pfx##128, sfx), PORT_1(fn, pfx##129, sfx), \
++ PORT_10(fn, pfx##13, sfx), PORT_10(fn, pfx##14, sfx), \
++ PORT_10(fn, pfx##15, sfx), \
++ PORT_1(fn, pfx##160, sfx), PORT_1(fn, pfx##161, sfx), \
++ PORT_1(fn, pfx##162, sfx), PORT_1(fn, pfx##163, sfx), \
++ PORT_1(fn, pfx##164, sfx), \
++ PORT_1(fn, pfx##192, sfx), PORT_1(fn, pfx##193, sfx), \
++ PORT_1(fn, pfx##194, sfx), PORT_1(fn, pfx##195, sfx), \
++ PORT_1(fn, pfx##196, sfx), PORT_1(fn, pfx##197, sfx), \
++ PORT_1(fn, pfx##198, sfx), PORT_1(fn, pfx##199, sfx), \
++ PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \
++ PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \
++ PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \
++ PORT_1(fn, pfx##260, sfx), PORT_1(fn, pfx##261, sfx), \
++ PORT_1(fn, pfx##262, sfx), PORT_1(fn, pfx##263, sfx), \
++ PORT_1(fn, pfx##264, sfx)
+
+ enum {
+ PINMUX_RESERVED = 0,
+
+ PINMUX_DATA_BEGIN,
+- PORT_265(DATA), /* PORT0_DATA -> PORT264_DATA */
++ PORT_ALL(DATA), /* PORT0_DATA -> PORT264_DATA */
+ PINMUX_DATA_END,
+
+ PINMUX_INPUT_BEGIN,
+- PORT_265(IN), /* PORT0_IN -> PORT264_IN */
++ PORT_ALL(IN), /* PORT0_IN -> PORT264_IN */
+ PINMUX_INPUT_END,
+
+ PINMUX_INPUT_PULLUP_BEGIN,
+- PORT_265(IN_PU), /* PORT0_IN_PU -> PORT264_IN_PU */
++ PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT264_IN_PU */
+ PINMUX_INPUT_PULLUP_END,
+
+ PINMUX_INPUT_PULLDOWN_BEGIN,
+- PORT_265(IN_PD), /* PORT0_IN_PD -> PORT264_IN_PD */
++ PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT264_IN_PD */
+ PINMUX_INPUT_PULLDOWN_END,
+
+ PINMUX_OUTPUT_BEGIN,
+- PORT_265(OUT), /* PORT0_OUT -> PORT264_OUT */
++ PORT_ALL(OUT), /* PORT0_OUT -> PORT264_OUT */
+ PINMUX_OUTPUT_END,
+
+ PINMUX_FUNCTION_BEGIN,
+- PORT_265(FN_IN), /* PORT0_FN_IN -> PORT264_FN_IN */
+- PORT_265(FN_OUT), /* PORT0_FN_OUT -> PORT264_FN_OUT */
+- PORT_265(FN0), /* PORT0_FN0 -> PORT264_FN0 */
+- PORT_265(FN1), /* PORT0_FN1 -> PORT264_FN1 */
+- PORT_265(FN2), /* PORT0_FN2 -> PORT264_FN2 */
+- PORT_265(FN3), /* PORT0_FN3 -> PORT264_FN3 */
+- PORT_265(FN4), /* PORT0_FN4 -> PORT264_FN4 */
+- PORT_265(FN5), /* PORT0_FN5 -> PORT264_FN5 */
+- PORT_265(FN6), /* PORT0_FN6 -> PORT264_FN6 */
+- PORT_265(FN7), /* PORT0_FN7 -> PORT264_FN7 */
++ PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT264_FN_IN */
++ PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT264_FN_OUT */
++ PORT_ALL(FN0), /* PORT0_FN0 -> PORT264_FN0 */
++ PORT_ALL(FN1), /* PORT0_FN1 -> PORT264_FN1 */
++ PORT_ALL(FN2), /* PORT0_FN2 -> PORT264_FN2 */
++ PORT_ALL(FN3), /* PORT0_FN3 -> PORT264_FN3 */
++ PORT_ALL(FN4), /* PORT0_FN4 -> PORT264_FN4 */
++ PORT_ALL(FN5), /* PORT0_FN5 -> PORT264_FN5 */
++ PORT_ALL(FN6), /* PORT0_FN6 -> PORT264_FN6 */
++ PORT_ALL(FN7), /* PORT0_FN7 -> PORT264_FN7 */
+
+ MSELBCR_MSEL17_1, MSELBCR_MSEL17_0,
+ MSELBCR_MSEL16_1, MSELBCR_MSEL16_0,
+@@ -1039,13 +1020,9 @@ static pinmux_enum_t pinmux_data[] = {
+ PINMUX_DATA(RESETOUTS_MARK, PORT264_FN1),
+ };
+
+-#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
+-#define GPIO_PORT_265() _265(_GPIO_PORT, , unused)
+-#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
+-
+ static struct pinmux_gpio pinmux_gpios[] = {
+ /* 55-1 -> 55-5 (GPIO) */
+- GPIO_PORT_265(),
++ GPIO_PORT_ALL(),
+
+ /* Special Pull-up / Pull-down Functions */
+ GPIO_FN(PORT66_KEYIN0_PU), GPIO_FN(PORT67_KEYIN1_PU),
+diff --git a/arch/arm/mach-shmobile/pfc-sh73a0.c b/arch/arm/mach-shmobile/pfc-sh73a0.c
+index 37467ab..9d68569 100644
+--- a/arch/arm/mach-shmobile/pfc-sh73a0.c
++++ b/arch/arm/mach-shmobile/pfc-sh73a0.c
+@@ -23,83 +23,71 @@
+ #include <linux/gpio.h>
+ #include <mach/sh73a0.h>
+
+-#define _1(fn, pfx, sfx) fn(pfx, sfx)
+-
+-#define _10(fn, pfx, sfx) \
+- _1(fn, pfx##0, sfx), _1(fn, pfx##1, sfx), \
+- _1(fn, pfx##2, sfx), _1(fn, pfx##3, sfx), \
+- _1(fn, pfx##4, sfx), _1(fn, pfx##5, sfx), \
+- _1(fn, pfx##6, sfx), _1(fn, pfx##7, sfx), \
+- _1(fn, pfx##8, sfx), _1(fn, pfx##9, sfx)
+-
+-#define _310(fn, pfx, sfx) \
+- _10(fn, pfx, sfx), _10(fn, pfx##1, sfx), \
+- _10(fn, pfx##2, sfx), _10(fn, pfx##3, sfx), \
+- _10(fn, pfx##4, sfx), _10(fn, pfx##5, sfx), \
+- _10(fn, pfx##6, sfx), _10(fn, pfx##7, sfx), \
+- _10(fn, pfx##8, sfx), _10(fn, pfx##9, sfx), \
+- _10(fn, pfx##10, sfx), \
+- _1(fn, pfx##110, sfx), _1(fn, pfx##111, sfx), \
+- _1(fn, pfx##112, sfx), _1(fn, pfx##113, sfx), \
+- _1(fn, pfx##114, sfx), _1(fn, pfx##115, sfx), \
+- _1(fn, pfx##116, sfx), _1(fn, pfx##117, sfx), \
+- _1(fn, pfx##118, sfx), \
+- _1(fn, pfx##128, sfx), _1(fn, pfx##129, sfx), \
+- _10(fn, pfx##13, sfx), _10(fn, pfx##14, sfx), \
+- _10(fn, pfx##15, sfx), \
+- _1(fn, pfx##160, sfx), _1(fn, pfx##161, sfx), \
+- _1(fn, pfx##162, sfx), _1(fn, pfx##163, sfx), \
+- _1(fn, pfx##164, sfx), \
+- _1(fn, pfx##192, sfx), _1(fn, pfx##193, sfx), \
+- _1(fn, pfx##194, sfx), _1(fn, pfx##195, sfx), \
+- _1(fn, pfx##196, sfx), _1(fn, pfx##197, sfx), \
+- _1(fn, pfx##198, sfx), _1(fn, pfx##199, sfx), \
+- _10(fn, pfx##20, sfx), _10(fn, pfx##21, sfx), \
+- _10(fn, pfx##22, sfx), _10(fn, pfx##23, sfx), \
+- _10(fn, pfx##24, sfx), _10(fn, pfx##25, sfx), \
+- _10(fn, pfx##26, sfx), _10(fn, pfx##27, sfx), \
+- _1(fn, pfx##280, sfx), _1(fn, pfx##281, sfx), \
+- _1(fn, pfx##282, sfx), \
+- _1(fn, pfx##288, sfx), _1(fn, pfx##289, sfx), \
+- _10(fn, pfx##29, sfx), _10(fn, pfx##30, sfx)
+-
+-#define _PORT(pfx, sfx) pfx##_##sfx
+-#define PORT_310(str) _310(_PORT, PORT, str)
++#define CPU_ALL_PORT(fn, pfx, sfx) \
++ PORT_10(fn, pfx, sfx), PORT_10(fn, pfx##1, sfx), \
++ PORT_10(fn, pfx##2, sfx), PORT_10(fn, pfx##3, sfx), \
++ PORT_10(fn, pfx##4, sfx), PORT_10(fn, pfx##5, sfx), \
++ PORT_10(fn, pfx##6, sfx), PORT_10(fn, pfx##7, sfx), \
++ PORT_10(fn, pfx##8, sfx), PORT_10(fn, pfx##9, sfx), \
++ PORT_10(fn, pfx##10, sfx), \
++ PORT_1(fn, pfx##110, sfx), PORT_1(fn, pfx##111, sfx), \
++ PORT_1(fn, pfx##112, sfx), PORT_1(fn, pfx##113, sfx), \
++ PORT_1(fn, pfx##114, sfx), PORT_1(fn, pfx##115, sfx), \
++ PORT_1(fn, pfx##116, sfx), PORT_1(fn, pfx##117, sfx), \
++ PORT_1(fn, pfx##118, sfx), \
++ PORT_1(fn, pfx##128, sfx), PORT_1(fn, pfx##129, sfx), \
++ PORT_10(fn, pfx##13, sfx), PORT_10(fn, pfx##14, sfx), \
++ PORT_10(fn, pfx##15, sfx), \
++ PORT_1(fn, pfx##160, sfx), PORT_1(fn, pfx##161, sfx), \
++ PORT_1(fn, pfx##162, sfx), PORT_1(fn, pfx##163, sfx), \
++ PORT_1(fn, pfx##164, sfx), \
++ PORT_1(fn, pfx##192, sfx), PORT_1(fn, pfx##193, sfx), \
++ PORT_1(fn, pfx##194, sfx), PORT_1(fn, pfx##195, sfx), \
++ PORT_1(fn, pfx##196, sfx), PORT_1(fn, pfx##197, sfx), \
++ PORT_1(fn, pfx##198, sfx), PORT_1(fn, pfx##199, sfx), \
++ PORT_10(fn, pfx##20, sfx), PORT_10(fn, pfx##21, sfx), \
++ PORT_10(fn, pfx##22, sfx), PORT_10(fn, pfx##23, sfx), \
++ PORT_10(fn, pfx##24, sfx), PORT_10(fn, pfx##25, sfx), \
++ PORT_10(fn, pfx##26, sfx), PORT_10(fn, pfx##27, sfx), \
++ PORT_1(fn, pfx##280, sfx), PORT_1(fn, pfx##281, sfx), \
++ PORT_1(fn, pfx##282, sfx), \
++ PORT_1(fn, pfx##288, sfx), PORT_1(fn, pfx##289, sfx), \
++ PORT_10(fn, pfx##29, sfx), PORT_10(fn, pfx##30, sfx)
+
+ enum {
+ PINMUX_RESERVED = 0,
+
+ PINMUX_DATA_BEGIN,
+- PORT_310(DATA), /* PORT0_DATA -> PORT309_DATA */
++ PORT_ALL(DATA), /* PORT0_DATA -> PORT309_DATA */
+ PINMUX_DATA_END,
+
+ PINMUX_INPUT_BEGIN,
+- PORT_310(IN), /* PORT0_IN -> PORT309_IN */
++ PORT_ALL(IN), /* PORT0_IN -> PORT309_IN */
+ PINMUX_INPUT_END,
+
+ PINMUX_INPUT_PULLUP_BEGIN,
+- PORT_310(IN_PU), /* PORT0_IN_PU -> PORT309_IN_PU */
++ PORT_ALL(IN_PU), /* PORT0_IN_PU -> PORT309_IN_PU */
+ PINMUX_INPUT_PULLUP_END,
+
+ PINMUX_INPUT_PULLDOWN_BEGIN,
+- PORT_310(IN_PD), /* PORT0_IN_PD -> PORT309_IN_PD */
++ PORT_ALL(IN_PD), /* PORT0_IN_PD -> PORT309_IN_PD */
+ PINMUX_INPUT_PULLDOWN_END,
+
+ PINMUX_OUTPUT_BEGIN,
+- PORT_310(OUT), /* PORT0_OUT -> PORT309_OUT */
++ PORT_ALL(OUT), /* PORT0_OUT -> PORT309_OUT */
+ PINMUX_OUTPUT_END,
+
+ PINMUX_FUNCTION_BEGIN,
+- PORT_310(FN_IN), /* PORT0_FN_IN -> PORT309_FN_IN */
+- PORT_310(FN_OUT), /* PORT0_FN_OUT -> PORT309_FN_OUT */
+- PORT_310(FN0), /* PORT0_FN0 -> PORT309_FN0 */
+- PORT_310(FN1), /* PORT0_FN1 -> PORT309_FN1 */
+- PORT_310(FN2), /* PORT0_FN2 -> PORT309_FN2 */
+- PORT_310(FN3), /* PORT0_FN3 -> PORT309_FN3 */
+- PORT_310(FN4), /* PORT0_FN4 -> PORT309_FN4 */
+- PORT_310(FN5), /* PORT0_FN5 -> PORT309_FN5 */
+- PORT_310(FN6), /* PORT0_FN6 -> PORT309_FN6 */
+- PORT_310(FN7), /* PORT0_FN7 -> PORT309_FN7 */
++ PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT309_FN_IN */
++ PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT309_FN_OUT */
++ PORT_ALL(FN0), /* PORT0_FN0 -> PORT309_FN0 */
++ PORT_ALL(FN1), /* PORT0_FN1 -> PORT309_FN1 */
++ PORT_ALL(FN2), /* PORT0_FN2 -> PORT309_FN2 */
++ PORT_ALL(FN3), /* PORT0_FN3 -> PORT309_FN3 */
++ PORT_ALL(FN4), /* PORT0_FN4 -> PORT309_FN4 */
++ PORT_ALL(FN5), /* PORT0_FN5 -> PORT309_FN5 */
++ PORT_ALL(FN6), /* PORT0_FN6 -> PORT309_FN6 */
++ PORT_ALL(FN7), /* PORT0_FN7 -> PORT309_FN7 */
+
+ MSEL2CR_MSEL19_0, MSEL2CR_MSEL19_1,
+ MSEL2CR_MSEL18_0, MSEL2CR_MSEL18_1,
+@@ -1493,12 +1481,8 @@ static pinmux_enum_t pinmux_data[] = {
+ PINMUX_DATA(FSIAISLD_PU_MARK, PORT55_FN1, PORT55_IN_PU),
+ };
+
+-#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
+-#define GPIO_PORT_310() _310(_GPIO_PORT, , unused)
+-#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
+-
+ static struct pinmux_gpio pinmux_gpios[] = {
+- GPIO_PORT_310(),
++ GPIO_PORT_ALL(),
+
+ /* Table 25-1 (Functions 0-7) */
+ GPIO_FN(VBUS_0),
+diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
+index 5585f28..5f6322a 100644
+--- a/include/linux/sh_pfc.h
++++ b/include/linux/sh_pfc.h
+@@ -104,6 +104,29 @@ struct pinmux_info {
+ int register_pinmux(struct pinmux_info *pip);
+ int unregister_pinmux(struct pinmux_info *pip);
+
++/* helper macro for port */
++#define PORT_1(fn, pfx, sfx) fn(pfx, sfx)
++
++#define PORT_10(fn, pfx, sfx) \
++ PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \
++ PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \
++ PORT_1(fn, pfx##4, sfx), PORT_1(fn, pfx##5, sfx), \
++ PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \
++ PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx)
++
++#define PORT_90(fn, pfx, sfx) \
++ PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \
++ PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \
++ PORT_10(fn, pfx##5, sfx), PORT_10(fn, pfx##6, sfx), \
++ PORT_10(fn, pfx##7, sfx), PORT_10(fn, pfx##8, sfx), \
++ PORT_10(fn, pfx##9, sfx)
++
++#define _PORT_ALL(pfx, sfx) pfx##_##sfx
++#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
++#define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str)
++#define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused)
++#define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
++
+ /* helper macro for pinmux_enum_t */
+ #define PORT_DATA_I(nr) \
+ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0014-ARM-mach-shmobile-move-helper-macro-PORTCR-to-sh_pfc.patch b/patches.armadillo800eva/0014-ARM-mach-shmobile-move-helper-macro-PORTCR-to-sh_pfc.patch
new file mode 100644
index 00000000000000..c35159a483e15e
--- /dev/null
+++ b/patches.armadillo800eva/0014-ARM-mach-shmobile-move-helper-macro-PORTCR-to-sh_pfc.patch
@@ -0,0 +1,153 @@
+From 7ba3680133620f65d0c5edb2ebcdd1bc744a724c Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 10 Nov 2011 18:45:43 -0800
+Subject: ARM: mach-shmobile: move helper macro PORTCR to sh_pfc.h
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 9b49139b34a66907662e0be8efe79316dc63f8e0)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/pfc-sh7367.c | 16 ----------------
+ arch/arm/mach-shmobile/pfc-sh7372.c | 16 ----------------
+ arch/arm/mach-shmobile/pfc-sh7377.c | 17 -----------------
+ arch/arm/mach-shmobile/pfc-sh73a0.c | 12 ------------
+ include/linux/sh_pfc.h | 17 +++++++++++++++++
+ 5 files changed, 17 insertions(+), 61 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/pfc-sh7367.c b/arch/arm/mach-shmobile/pfc-sh7367.c
+index 32fbf02..e6e5246 100644
+--- a/arch/arm/mach-shmobile/pfc-sh7367.c
++++ b/arch/arm/mach-shmobile/pfc-sh7367.c
+@@ -1287,22 +1287,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
+ GPIO_FN(DIVLOCK),
+ };
+
+-/* helper for top 4 bits in PORTnCR */
+-#define PCRH(in, in_pd, in_pu, out) \
+- 0, (out), (in), 0, \
+- 0, 0, 0, 0, \
+- 0, 0, (in_pd), 0, \
+- 0, 0, (in_pu), 0
+-
+-#define PORTCR(nr, reg) \
+- { PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \
+- PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \
+- PORT##nr##_IN_PU, PORT##nr##_OUT), \
+- PORT##nr##_FN0, PORT##nr##_FN1, PORT##nr##_FN2, \
+- PORT##nr##_FN3, PORT##nr##_FN4, PORT##nr##_FN5, \
+- PORT##nr##_FN6, PORT##nr##_FN7 } \
+- }
+-
+ static struct pinmux_cfg_reg pinmux_config_regs[] = {
+ PORTCR(0, 0xe6050000), /* PORT0CR */
+ PORTCR(1, 0xe6050001), /* PORT1CR */
+diff --git a/arch/arm/mach-shmobile/pfc-sh7372.c b/arch/arm/mach-shmobile/pfc-sh7372.c
+index 4b43626..1bd6585 100644
+--- a/arch/arm/mach-shmobile/pfc-sh7372.c
++++ b/arch/arm/mach-shmobile/pfc-sh7372.c
+@@ -1199,22 +1199,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
+ GPIO_FN(SDENC_DV_CLKI),
+ };
+
+-/* helper for top 4 bits in PORTnCR */
+-#define PCRH(in, in_pd, in_pu, out) \
+- 0, (out), (in), 0, \
+- 0, 0, 0, 0, \
+- 0, 0, (in_pd), 0, \
+- 0, 0, (in_pu), 0
+-
+-#define PORTCR(nr, reg) \
+- { PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \
+- PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \
+- PORT##nr##_IN_PU, PORT##nr##_OUT), \
+- PORT##nr##_FN0, PORT##nr##_FN1, PORT##nr##_FN2, \
+- PORT##nr##_FN3, PORT##nr##_FN4, PORT##nr##_FN5, \
+- PORT##nr##_FN6, PORT##nr##_FN7 } \
+- }
+-
+ static struct pinmux_cfg_reg pinmux_config_regs[] = {
+ PORTCR(0, 0xE6051000), /* PORT0CR */
+ PORTCR(1, 0xE6051001), /* PORT1CR */
+diff --git a/arch/arm/mach-shmobile/pfc-sh7377.c b/arch/arm/mach-shmobile/pfc-sh7377.c
+index fb3cfd3..2f10511 100644
+--- a/arch/arm/mach-shmobile/pfc-sh7377.c
++++ b/arch/arm/mach-shmobile/pfc-sh7377.c
+@@ -1300,23 +1300,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
+ GPIO_FN(RESETOUTS),
+ };
+
+-/* helper for top 4 bits in PORTnCR */
+-#define PCRH(in, in_pd, in_pu, out) \
+- 0, (out), (in), 0, \
+- 0, 0, 0, 0, \
+- 0, 0, (in_pd), 0, \
+- 0, 0, (in_pu), 0
+-
+-#define PORTCR(nr, reg) \
+- { PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \
+- PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \
+- PORT##nr##_IN_PU, PORT##nr##_OUT), \
+- PORT##nr##_FN0, PORT##nr##_FN1, \
+- PORT##nr##_FN2, PORT##nr##_FN3, \
+- PORT##nr##_FN4, PORT##nr##_FN5, \
+- PORT##nr##_FN6, PORT##nr##_FN7 } \
+- }
+-
+ static struct pinmux_cfg_reg pinmux_config_regs[] = {
+ PORTCR(0, 0xe6050000), /* PORT0CR */
+ PORTCR(1, 0xe6050001), /* PORT1CR */
+diff --git a/arch/arm/mach-shmobile/pfc-sh73a0.c b/arch/arm/mach-shmobile/pfc-sh73a0.c
+index 9d68569..d8915c6 100644
+--- a/arch/arm/mach-shmobile/pfc-sh73a0.c
++++ b/arch/arm/mach-shmobile/pfc-sh73a0.c
+@@ -2139,18 +2139,6 @@ static struct pinmux_gpio pinmux_gpios[] = {
+ GPIO_FN(FSIAISLD_PU),
+ };
+
+-#define PORTCR(nr, reg) \
+- { PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \
+- 0, \
+- /*0001*/ PORT##nr##_OUT , \
+- /*0010*/ PORT##nr##_IN , 0, 0, 0, 0, 0, 0, 0, \
+- /*1010*/ PORT##nr##_IN_PD, 0, 0, 0, \
+- /*1110*/ PORT##nr##_IN_PU, 0, \
+- PORT##nr##_FN0, PORT##nr##_FN1, PORT##nr##_FN2, \
+- PORT##nr##_FN3, PORT##nr##_FN4, PORT##nr##_FN5, \
+- PORT##nr##_FN6, PORT##nr##_FN7, 0, 0, 0, 0, 0, 0, 0, 0 } \
+- }
+-
+ static struct pinmux_cfg_reg pinmux_config_regs[] = {
+ PORTCR(0, 0xe6050000), /* PORT0CR */
+ PORTCR(1, 0xe6050001), /* PORT1CR */
+diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
+index 5f6322a..8446789 100644
+--- a/include/linux/sh_pfc.h
++++ b/include/linux/sh_pfc.h
+@@ -162,5 +162,22 @@ int unregister_pinmux(struct pinmux_info *pip);
+ PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
+ PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)
+
++/* helper macro for top 4 bits in PORTnCR */
++#define _PCRH(in, in_pd, in_pu, out) \
++ 0, (out), (in), 0, \
++ 0, 0, 0, 0, \
++ 0, 0, (in_pd), 0, \
++ 0, 0, (in_pu), 0
++
++#define PORTCR(nr, reg) \
++ { \
++ PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \
++ _PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \
++ PORT##nr##_IN_PU, PORT##nr##_OUT), \
++ PORT##nr##_FN0, PORT##nr##_FN1, \
++ PORT##nr##_FN2, PORT##nr##_FN3, \
++ PORT##nr##_FN4, PORT##nr##_FN5, \
++ PORT##nr##_FN6, PORT##nr##_FN7 } \
++ }
+
+ #endif /* __SH_PFC_H */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0015-sh-pfc-ioremap-support.patch b/patches.armadillo800eva/0015-sh-pfc-ioremap-support.patch
new file mode 100644
index 00000000000000..2d2b930cdb0b9f
--- /dev/null
+++ b/patches.armadillo800eva/0015-sh-pfc-ioremap-support.patch
@@ -0,0 +1,350 @@
+From 4fb7ac69b4e065f02ccada9a8ebe1fc11ca9c4e6 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Fri, 9 Dec 2011 12:14:27 +0900
+Subject: sh: pfc: ioremap() support
+
+Add support for non-entity mapped PFC registers through
+the use of struct resource and ioremap()/iounmap().
+
+The PFC main data structure gets updated with a pointer
+to a struct resources array that point out all register
+windows used by the PFC instance. The register definitions
+are kept as physical addresses but the PFC code will do
+transparent conversion into virtual addresses whenever
+register windows are specified using with struct resource.
+
+To introduce as little performance penalty as possible the
+virtual address of each data register is cached in memory.
+The virtual address of each configuration register is however
+calculated during run time. This because the configuration
+is considered slow path so focus is instead put on keeping
+memory foot print as small as possible.
+
+The PFC register access code is in this patch updated from
+__raw_readN() / __raw_writeN() into ioreadN() / iowriteN().
+
+This patch is needed to support the PFC block in r8a7779.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit b0e10211cba1629e2e534ca9cb3d87cfc7e389ea)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/pfc.c | 137 +++++++++++++++++++++++++++++++++++++++---------
+ include/linux/sh_pfc.h | 11 ++++
+ 2 files changed, 124 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
+index e67fe17..e7d127a 100644
+--- a/drivers/sh/pfc.c
++++ b/drivers/sh/pfc.c
+@@ -19,6 +19,75 @@
+ #include <linux/irq.h>
+ #include <linux/bitops.h>
+ #include <linux/gpio.h>
++#include <linux/slab.h>
++#include <linux/ioport.h>
++
++static void pfc_iounmap(struct pinmux_info *pip)
++{
++ int k;
++
++ for (k = 0; k < pip->num_resources; k++)
++ if (pip->window[k].virt)
++ iounmap(pip->window[k].virt);
++
++ kfree(pip->window);
++ pip->window = NULL;
++}
++
++static int pfc_ioremap(struct pinmux_info *pip)
++{
++ struct resource *res;
++ int k;
++
++ if (!pip->num_resources)
++ return 0;
++
++ pip->window = kzalloc(pip->num_resources * sizeof(*pip->window),
++ GFP_NOWAIT);
++ if (!pip->window)
++ goto err1;
++
++ for (k = 0; k < pip->num_resources; k++) {
++ res = pip->resource + k;
++ WARN_ON(resource_type(res) != IORESOURCE_MEM);
++ pip->window[k].phys = res->start;
++ pip->window[k].size = resource_size(res);
++ pip->window[k].virt = ioremap_nocache(res->start,
++ resource_size(res));
++ if (!pip->window[k].virt)
++ goto err2;
++ }
++
++ return 0;
++
++err2:
++ pfc_iounmap(pip);
++err1:
++ return -1;
++}
++
++static void __iomem *pfc_phys_to_virt(struct pinmux_info *pip,
++ unsigned long address)
++{
++ struct pfc_window *window;
++ int k;
++
++ /* scan through physical windows and convert address */
++ for (k = 0; k < pip->num_resources; k++) {
++ window = pip->window + k;
++
++ if (address < window->phys)
++ continue;
++
++ if (address >= (window->phys + window->size))
++ continue;
++
++ return window->virt + (address - window->phys);
++ }
++
++ /* no windows defined, register must be 1:1 mapped virt:phys */
++ return (void __iomem *)address;
++}
+
+ static int enum_in_range(pinmux_enum_t enum_id, struct pinmux_range *r)
+ {
+@@ -31,35 +100,35 @@ static int enum_in_range(pinmux_enum_t enum_id, struct pinmux_range *r)
+ return 1;
+ }
+
+-static unsigned long gpio_read_raw_reg(unsigned long reg,
++static unsigned long gpio_read_raw_reg(void __iomem *mapped_reg,
+ unsigned long reg_width)
+ {
+ switch (reg_width) {
+ case 8:
+- return __raw_readb(reg);
++ return ioread8(mapped_reg);
+ case 16:
+- return __raw_readw(reg);
++ return ioread16(mapped_reg);
+ case 32:
+- return __raw_readl(reg);
++ return ioread32(mapped_reg);
+ }
+
+ BUG();
+ return 0;
+ }
+
+-static void gpio_write_raw_reg(unsigned long reg,
++static void gpio_write_raw_reg(void __iomem *mapped_reg,
+ unsigned long reg_width,
+ unsigned long data)
+ {
+ switch (reg_width) {
+ case 8:
+- __raw_writeb(data, reg);
++ iowrite8(data, mapped_reg);
+ return;
+ case 16:
+- __raw_writew(data, reg);
++ iowrite16(data, mapped_reg);
+ return;
+ case 32:
+- __raw_writel(data, reg);
++ iowrite32(data, mapped_reg);
+ return;
+ }
+
+@@ -82,11 +151,12 @@ static void gpio_write_bit(struct pinmux_data_reg *dr,
+ else
+ clear_bit(pos, &dr->reg_shadow);
+
+- gpio_write_raw_reg(dr->reg, dr->reg_width, dr->reg_shadow);
++ gpio_write_raw_reg(dr->mapped_reg, dr->reg_width, dr->reg_shadow);
+ }
+
+-static int gpio_read_reg(unsigned long reg, unsigned long reg_width,
+- unsigned long field_width, unsigned long in_pos)
++static int gpio_read_reg(void __iomem *mapped_reg, unsigned long reg_width,
++ unsigned long field_width, unsigned long in_pos,
++ unsigned long reg)
+ {
+ unsigned long data, mask, pos;
+
+@@ -98,13 +168,13 @@ static int gpio_read_reg(unsigned long reg, unsigned long reg_width,
+ "r_width = %ld, f_width = %ld\n",
+ reg, pos, reg_width, field_width);
+
+- data = gpio_read_raw_reg(reg, reg_width);
++ data = gpio_read_raw_reg(mapped_reg, reg_width);
+ return (data >> pos) & mask;
+ }
+
+-static void gpio_write_reg(unsigned long reg, unsigned long reg_width,
++static void gpio_write_reg(void __iomem *mapped_reg, unsigned long reg_width,
+ unsigned long field_width, unsigned long in_pos,
+- unsigned long value)
++ unsigned long value, unsigned long reg)
+ {
+ unsigned long mask, pos;
+
+@@ -120,13 +190,13 @@ static void gpio_write_reg(unsigned long reg, unsigned long reg_width,
+
+ switch (reg_width) {
+ case 8:
+- __raw_writeb((__raw_readb(reg) & mask) | value, reg);
++ iowrite8((ioread8(mapped_reg) & mask) | value, mapped_reg);
+ break;
+ case 16:
+- __raw_writew((__raw_readw(reg) & mask) | value, reg);
++ iowrite16((ioread16(mapped_reg) & mask) | value, mapped_reg);
+ break;
+ case 32:
+- __raw_writel((__raw_readl(reg) & mask) | value, reg);
++ iowrite32((ioread32(mapped_reg) & mask) | value, mapped_reg);
+ break;
+ }
+ }
+@@ -147,6 +217,8 @@ static int setup_data_reg(struct pinmux_info *gpioc, unsigned gpio)
+ if (!data_reg->reg_width)
+ break;
+
++ data_reg->mapped_reg = pfc_phys_to_virt(gpioc, data_reg->reg);
++
+ for (n = 0; n < data_reg->reg_width; n++) {
+ if (data_reg->enum_ids[n] == gpiop->enum_id) {
+ gpiop->flags &= ~PINMUX_FLAG_DREG;
+@@ -179,7 +251,8 @@ static void setup_data_regs(struct pinmux_info *gpioc)
+ if (!drp->reg_width)
+ break;
+
+- drp->reg_shadow = gpio_read_raw_reg(drp->reg, drp->reg_width);
++ drp->reg_shadow = gpio_read_raw_reg(drp->mapped_reg,
++ drp->reg_width);
+ k++;
+ }
+ }
+@@ -266,12 +339,16 @@ static void write_config_reg(struct pinmux_info *gpioc,
+ int index)
+ {
+ unsigned long ncomb, pos, value;
++ void __iomem *mapped_reg;
+
+ ncomb = 1 << crp->field_width;
+ pos = index / ncomb;
+ value = index % ncomb;
+
+- gpio_write_reg(crp->reg, crp->reg_width, crp->field_width, pos, value);
++ mapped_reg = pfc_phys_to_virt(gpioc, crp->reg);
++
++ gpio_write_reg(mapped_reg, crp->reg_width, crp->field_width,
++ pos, value, crp->reg);
+ }
+
+ static int check_config_reg(struct pinmux_info *gpioc,
+@@ -279,13 +356,16 @@ static int check_config_reg(struct pinmux_info *gpioc,
+ int index)
+ {
+ unsigned long ncomb, pos, value;
++ void __iomem *mapped_reg;
+
+ ncomb = 1 << crp->field_width;
+ pos = index / ncomb;
+ value = index % ncomb;
+
+- if (gpio_read_reg(crp->reg, crp->reg_width,
+- crp->field_width, pos) == value)
++ mapped_reg = pfc_phys_to_virt(gpioc, crp->reg);
++
++ if (gpio_read_reg(mapped_reg, crp->reg_width,
++ crp->field_width, pos, crp->reg) == value)
+ return 0;
+
+ return -1;
+@@ -564,7 +644,7 @@ static int sh_gpio_get_value(struct pinmux_info *gpioc, unsigned gpio)
+ if (!gpioc || get_data_reg(gpioc, gpio, &dr, &bit) != 0)
+ return -EINVAL;
+
+- return gpio_read_reg(dr->reg, dr->reg_width, 1, bit);
++ return gpio_read_reg(dr->mapped_reg, dr->reg_width, 1, bit, dr->reg);
+ }
+
+ static int sh_gpio_get(struct gpio_chip *chip, unsigned offset)
+@@ -606,10 +686,15 @@ static int sh_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+ int register_pinmux(struct pinmux_info *pip)
+ {
+ struct gpio_chip *chip = &pip->chip;
++ int ret;
+
+ pr_info("%s handling gpio %d -> %d\n",
+ pip->name, pip->first_gpio, pip->last_gpio);
+
++ ret = pfc_ioremap(pip);
++ if (ret < 0)
++ return ret;
++
+ setup_data_regs(pip);
+
+ chip->request = sh_gpio_request;
+@@ -627,12 +712,16 @@ int register_pinmux(struct pinmux_info *pip)
+ chip->base = pip->first_gpio;
+ chip->ngpio = (pip->last_gpio - pip->first_gpio) + 1;
+
+- return gpiochip_add(chip);
++ ret = gpiochip_add(chip);
++ if (ret < 0)
++ pfc_iounmap(pip);
++
++ return ret;
+ }
+
+ int unregister_pinmux(struct pinmux_info *pip)
+ {
+ pr_info("%s deregistering\n", pip->name);
+-
++ pfc_iounmap(pip);
+ return gpiochip_remove(&pip->chip);
+ }
+diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
+index 8446789..91666a5 100644
+--- a/include/linux/sh_pfc.h
++++ b/include/linux/sh_pfc.h
+@@ -55,6 +55,7 @@ struct pinmux_cfg_reg {
+ struct pinmux_data_reg {
+ unsigned long reg, reg_width, reg_shadow;
+ pinmux_enum_t *enum_ids;
++ void __iomem *mapped_reg;
+ };
+
+ #define PINMUX_DATA_REG(name, r, r_width) \
+@@ -75,6 +76,12 @@ struct pinmux_range {
+ pinmux_enum_t force;
+ };
+
++struct pfc_window {
++ phys_addr_t phys;
++ void __iomem *virt;
++ unsigned long size;
++};
++
+ struct pinmux_info {
+ char *name;
+ pinmux_enum_t reserved_id;
+@@ -98,6 +105,10 @@ struct pinmux_info {
+ struct pinmux_irq *gpio_irq;
+ unsigned int gpio_irq_size;
+
++ struct resource *resource;
++ unsigned int num_resources;
++ struct pfc_window *window;
++
+ struct gpio_chip chip;
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0016-sh-pfc-Add-gpio_read_bit-for-data-register-access.patch b/patches.armadillo800eva/0016-sh-pfc-Add-gpio_read_bit-for-data-register-access.patch
new file mode 100644
index 00000000000000..87df55096c476c
--- /dev/null
+++ b/patches.armadillo800eva/0016-sh-pfc-Add-gpio_read_bit-for-data-register-access.patch
@@ -0,0 +1,56 @@
+From d378246a650f3297ce7639fcc56ba76a510d0b6d Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 14 Dec 2011 01:00:37 +0900
+Subject: sh: pfc: Add gpio_read_bit() for data register access
+
+Introduce gpio_read_bit() for data register read access
+and modify sh_gpio_get_value() to make use of the new
+function instead of gpio_read_reg(). The purpose of
+this change is to update the code to only use the
+gpio_read_reg() function for config register access.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 92554d97c6dcc448afd56f96bbe933998868be74)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/pfc.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
+index e7d127a..cfca0aa 100644
+--- a/drivers/sh/pfc.c
++++ b/drivers/sh/pfc.c
+@@ -135,6 +135,19 @@ static void gpio_write_raw_reg(void __iomem *mapped_reg,
+ BUG();
+ }
+
++static int gpio_read_bit(struct pinmux_data_reg *dr,
++ unsigned long in_pos)
++{
++ unsigned long pos;
++
++ pos = dr->reg_width - (in_pos + 1);
++
++ pr_debug("read_bit: addr = %lx, pos = %ld, "
++ "r_width = %ld\n", dr->reg, pos, dr->reg_width);
++
++ return (gpio_read_raw_reg(dr->mapped_reg, dr->reg_width) >> pos) & 1;
++}
++
+ static void gpio_write_bit(struct pinmux_data_reg *dr,
+ unsigned long in_pos, unsigned long value)
+ {
+@@ -644,7 +657,7 @@ static int sh_gpio_get_value(struct pinmux_info *gpioc, unsigned gpio)
+ if (!gpioc || get_data_reg(gpioc, gpio, &dr, &bit) != 0)
+ return -EINVAL;
+
+- return gpio_read_reg(dr->mapped_reg, dr->reg_width, 1, bit, dr->reg);
++ return gpio_read_bit(dr, bit);
+ }
+
+ static int sh_gpio_get(struct gpio_chip *chip, unsigned offset)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0017-sh-pfc-Convert-index-to-field-and-value-pair.patch b/patches.armadillo800eva/0017-sh-pfc-Convert-index-to-field-and-value-pair.patch
new file mode 100644
index 00000000000000..cbc135cbfc7b8d
--- /dev/null
+++ b/patches.armadillo800eva/0017-sh-pfc-Convert-index-to-field-and-value-pair.patch
@@ -0,0 +1,133 @@
+From 07bd1464d6c99fc50ed64a6f29bbd23ad868528f Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 14 Dec 2011 01:00:46 +0900
+Subject: sh: pfc: Convert index to field and value pair
+
+Update the way the PFC code is passing bitfield
+selection between configure register functions.
+
+Convert the code from using index only to bitfield
+number and selected value. First step towards future
+variable bitfield width support.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit ad4a07ff8da7147b391f1ff0034f313a8b9da9e5)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/pfc.c | 45 ++++++++++++++++++---------------------------
+ 1 file changed, 18 insertions(+), 27 deletions(-)
+
+diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
+index cfca0aa..41e7c8f 100644
+--- a/drivers/sh/pfc.c
++++ b/drivers/sh/pfc.c
+@@ -287,7 +287,8 @@ static int get_data_reg(struct pinmux_info *gpioc, unsigned gpio,
+ }
+
+ static int get_config_reg(struct pinmux_info *gpioc, pinmux_enum_t enum_id,
+- struct pinmux_cfg_reg **crp, int *indexp,
++ struct pinmux_cfg_reg **crp,
++ int *fieldp, int *valuep,
+ unsigned long **cntp)
+ {
+ struct pinmux_cfg_reg *config_reg;
+@@ -306,7 +307,8 @@ static int get_config_reg(struct pinmux_info *gpioc, pinmux_enum_t enum_id,
+ for (n = 0; n < (r_width / f_width) * (1 << f_width); n++) {
+ if (config_reg->enum_ids[n] == enum_id) {
+ *crp = config_reg;
+- *indexp = n;
++ *fieldp = n / (1 << f_width);
++ *valuep = n % (1 << f_width);
+ *cntp = &config_reg->cnt[n / (1 << f_width)];
+ return 0;
+ }
+@@ -349,36 +351,22 @@ static int get_gpio_enum_id(struct pinmux_info *gpioc, unsigned gpio,
+
+ static void write_config_reg(struct pinmux_info *gpioc,
+ struct pinmux_cfg_reg *crp,
+- int index)
++ int field, int value)
+ {
+- unsigned long ncomb, pos, value;
+- void __iomem *mapped_reg;
+-
+- ncomb = 1 << crp->field_width;
+- pos = index / ncomb;
+- value = index % ncomb;
+-
+- mapped_reg = pfc_phys_to_virt(gpioc, crp->reg);
++ void __iomem *mapped_reg = pfc_phys_to_virt(gpioc, crp->reg);
+
+ gpio_write_reg(mapped_reg, crp->reg_width, crp->field_width,
+- pos, value, crp->reg);
++ field, value, crp->reg);
+ }
+
+ static int check_config_reg(struct pinmux_info *gpioc,
+ struct pinmux_cfg_reg *crp,
+- int index)
++ int field, int value)
+ {
+- unsigned long ncomb, pos, value;
+- void __iomem *mapped_reg;
+-
+- ncomb = 1 << crp->field_width;
+- pos = index / ncomb;
+- value = index % ncomb;
+-
+- mapped_reg = pfc_phys_to_virt(gpioc, crp->reg);
++ void __iomem *mapped_reg = pfc_phys_to_virt(gpioc, crp->reg);
+
+ if (gpio_read_reg(mapped_reg, crp->reg_width,
+- crp->field_width, pos, crp->reg) == value)
++ crp->field_width, field, crp->reg) == value)
+ return 0;
+
+ return -1;
+@@ -392,7 +380,7 @@ static int pinmux_config_gpio(struct pinmux_info *gpioc, unsigned gpio,
+ struct pinmux_cfg_reg *cr = NULL;
+ pinmux_enum_t enum_id;
+ struct pinmux_range *range;
+- int in_range, pos, index;
++ int in_range, pos, field, value;
+ unsigned long *cntp;
+
+ switch (pinmux_type) {
+@@ -423,7 +411,8 @@ static int pinmux_config_gpio(struct pinmux_info *gpioc, unsigned gpio,
+
+ pos = 0;
+ enum_id = 0;
+- index = 0;
++ field = 0;
++ value = 0;
+ while (1) {
+ pos = get_gpio_enum_id(gpioc, gpio, pos, &enum_id);
+ if (pos <= 0)
+@@ -470,17 +459,19 @@ static int pinmux_config_gpio(struct pinmux_info *gpioc, unsigned gpio,
+ if (!in_range)
+ continue;
+
+- if (get_config_reg(gpioc, enum_id, &cr, &index, &cntp) != 0)
++ if (get_config_reg(gpioc, enum_id, &cr,
++ &field, &value, &cntp) != 0)
+ goto out_err;
+
+ switch (cfg_mode) {
+ case GPIO_CFG_DRYRUN:
+- if (!*cntp || !check_config_reg(gpioc, cr, index))
++ if (!*cntp || !check_config_reg(gpioc, cr,
++ field, value))
+ continue;
+ break;
+
+ case GPIO_CFG_REQ:
+- write_config_reg(gpioc, cr, index);
++ write_config_reg(gpioc, cr, field, value);
+ *cntp = *cntp + 1;
+ break;
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0018-sh-pfc-Add-config_reg_helper-function.patch b/patches.armadillo800eva/0018-sh-pfc-Add-config_reg_helper-function.patch
new file mode 100644
index 00000000000000..33006ebed79500
--- /dev/null
+++ b/patches.armadillo800eva/0018-sh-pfc-Add-config_reg_helper-function.patch
@@ -0,0 +1,140 @@
+From 1ff569d694245d09213108a6cfb69b405c1afeb3 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 14 Dec 2011 01:00:55 +0900
+Subject: sh: pfc: Add config_reg_helper() function
+
+Add a helper function for shared config reg access
+calculations. This allows us to reduce the amount
+of duplicated code, and at the same time prepare
+for a common place for future variable bitwidth
+config reg support.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 18925e118b3b4d55b45711218cd3c3c4360e5cd1)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/pfc.c | 76 +++++++++++++++++++++++-------------------------------
+ 1 file changed, 32 insertions(+), 44 deletions(-)
+
+diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
+index 41e7c8f..5481d19 100644
+--- a/drivers/sh/pfc.c
++++ b/drivers/sh/pfc.c
+@@ -167,41 +167,52 @@ static void gpio_write_bit(struct pinmux_data_reg *dr,
+ gpio_write_raw_reg(dr->mapped_reg, dr->reg_width, dr->reg_shadow);
+ }
+
+-static int gpio_read_reg(void __iomem *mapped_reg, unsigned long reg_width,
+- unsigned long field_width, unsigned long in_pos,
+- unsigned long reg)
++static void config_reg_helper(struct pinmux_info *gpioc,
++ struct pinmux_cfg_reg *crp,
++ unsigned long in_pos,
++ void __iomem **mapped_regp,
++ unsigned long *maskp,
++ unsigned long *posp)
+ {
+- unsigned long data, mask, pos;
++ *mapped_regp = pfc_phys_to_virt(gpioc, crp->reg);
+
+- data = 0;
+- mask = (1 << field_width) - 1;
+- pos = reg_width - ((in_pos + 1) * field_width);
++ *maskp = (1 << crp->field_width) - 1;
++ *posp = crp->reg_width - ((in_pos + 1) * crp->field_width);
++}
++
++static int read_config_reg(struct pinmux_info *gpioc,
++ struct pinmux_cfg_reg *crp,
++ unsigned long field)
++{
++ void __iomem *mapped_reg;
++ unsigned long mask, pos;
++
++ config_reg_helper(gpioc, crp, field, &mapped_reg, &mask, &pos);
+
+- pr_debug("read_reg: addr = %lx, pos = %ld, "
++ pr_debug("read_reg: addr = %lx, field = %ld, "
+ "r_width = %ld, f_width = %ld\n",
+- reg, pos, reg_width, field_width);
++ crp->reg, field, crp->reg_width, crp->field_width);
+
+- data = gpio_read_raw_reg(mapped_reg, reg_width);
+- return (data >> pos) & mask;
++ return (gpio_read_raw_reg(mapped_reg, crp->reg_width) >> pos) & mask;
+ }
+
+-static void gpio_write_reg(void __iomem *mapped_reg, unsigned long reg_width,
+- unsigned long field_width, unsigned long in_pos,
+- unsigned long value, unsigned long reg)
++static void write_config_reg(struct pinmux_info *gpioc,
++ struct pinmux_cfg_reg *crp,
++ unsigned long field, unsigned long value)
+ {
++ void __iomem *mapped_reg;
+ unsigned long mask, pos;
+
+- mask = (1 << field_width) - 1;
+- pos = reg_width - ((in_pos + 1) * field_width);
++ config_reg_helper(gpioc, crp, field, &mapped_reg, &mask, &pos);
+
+- pr_debug("write_reg addr = %lx, value = %ld, pos = %ld, "
++ pr_debug("write_reg addr = %lx, value = %ld, field = %ld, "
+ "r_width = %ld, f_width = %ld\n",
+- reg, value, pos, reg_width, field_width);
++ crp->reg, value, field, crp->reg_width, crp->field_width);
+
+ mask = ~(mask << pos);
+ value = value << pos;
+
+- switch (reg_width) {
++ switch (crp->reg_width) {
+ case 8:
+ iowrite8((ioread8(mapped_reg) & mask) | value, mapped_reg);
+ break;
+@@ -349,29 +360,6 @@ static int get_gpio_enum_id(struct pinmux_info *gpioc, unsigned gpio,
+ return -1;
+ }
+
+-static void write_config_reg(struct pinmux_info *gpioc,
+- struct pinmux_cfg_reg *crp,
+- int field, int value)
+-{
+- void __iomem *mapped_reg = pfc_phys_to_virt(gpioc, crp->reg);
+-
+- gpio_write_reg(mapped_reg, crp->reg_width, crp->field_width,
+- field, value, crp->reg);
+-}
+-
+-static int check_config_reg(struct pinmux_info *gpioc,
+- struct pinmux_cfg_reg *crp,
+- int field, int value)
+-{
+- void __iomem *mapped_reg = pfc_phys_to_virt(gpioc, crp->reg);
+-
+- if (gpio_read_reg(mapped_reg, crp->reg_width,
+- crp->field_width, field, crp->reg) == value)
+- return 0;
+-
+- return -1;
+-}
+-
+ enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE };
+
+ static int pinmux_config_gpio(struct pinmux_info *gpioc, unsigned gpio,
+@@ -465,8 +453,8 @@ static int pinmux_config_gpio(struct pinmux_info *gpioc, unsigned gpio,
+
+ switch (cfg_mode) {
+ case GPIO_CFG_DRYRUN:
+- if (!*cntp || !check_config_reg(gpioc, cr,
+- field, value))
++ if (!*cntp ||
++ (read_config_reg(gpioc, cr, field) != value))
+ continue;
+ break;
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0019-sh-pfc-Variable-bitfield-width-config-register-suppo.patch b/patches.armadillo800eva/0019-sh-pfc-Variable-bitfield-width-config-register-suppo.patch
new file mode 100644
index 00000000000000..f29ef5273821b2
--- /dev/null
+++ b/patches.armadillo800eva/0019-sh-pfc-Variable-bitfield-width-config-register-suppo.patch
@@ -0,0 +1,121 @@
+From 0326f83e93ea7731f457acdbc3280bb69e3c0e78 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 14 Dec 2011 01:01:05 +0900
+Subject: sh: pfc: Variable bitfield width config register support
+
+Add support for variable config reg hardware by adding
+the macro PINMUX_CFG_REG_VAR(). The width of each bitfield
+needs to be passed to the macro, and the correct space must
+be consumed by each bitfield in the enum table following the
+macro. Data registers still need to have fixed bitfields.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit f78a26f55b2438c439609fc90b473f7f08f5b697)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/pfc.c | 44 +++++++++++++++++++++++++++++++++-----------
+ include/linux/sh_pfc.h | 9 ++++++++-
+ 2 files changed, 41 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
+index 5481d19..f975f4a 100644
+--- a/drivers/sh/pfc.c
++++ b/drivers/sh/pfc.c
+@@ -174,10 +174,19 @@ static void config_reg_helper(struct pinmux_info *gpioc,
+ unsigned long *maskp,
+ unsigned long *posp)
+ {
++ int k;
++
+ *mapped_regp = pfc_phys_to_virt(gpioc, crp->reg);
+
+- *maskp = (1 << crp->field_width) - 1;
+- *posp = crp->reg_width - ((in_pos + 1) * crp->field_width);
++ if (crp->field_width) {
++ *maskp = (1 << crp->field_width) - 1;
++ *posp = crp->reg_width - ((in_pos + 1) * crp->field_width);
++ } else {
++ *maskp = (1 << crp->var_field_width[in_pos]) - 1;
++ *posp = crp->reg_width;
++ for (k = 0; k <= in_pos; k++)
++ *posp -= crp->var_field_width[k];
++ }
+ }
+
+ static int read_config_reg(struct pinmux_info *gpioc,
+@@ -303,8 +312,8 @@ static int get_config_reg(struct pinmux_info *gpioc, pinmux_enum_t enum_id,
+ unsigned long **cntp)
+ {
+ struct pinmux_cfg_reg *config_reg;
+- unsigned long r_width, f_width;
+- int k, n;
++ unsigned long r_width, f_width, curr_width, ncomb;
++ int k, m, n, pos, bit_pos;
+
+ k = 0;
+ while (1) {
+@@ -315,14 +324,27 @@ static int get_config_reg(struct pinmux_info *gpioc, pinmux_enum_t enum_id,
+
+ if (!r_width)
+ break;
+- for (n = 0; n < (r_width / f_width) * (1 << f_width); n++) {
+- if (config_reg->enum_ids[n] == enum_id) {
+- *crp = config_reg;
+- *fieldp = n / (1 << f_width);
+- *valuep = n % (1 << f_width);
+- *cntp = &config_reg->cnt[n / (1 << f_width)];
+- return 0;
++
++ pos = 0;
++ m = 0;
++ for (bit_pos = 0; bit_pos < r_width; bit_pos += curr_width) {
++ if (f_width)
++ curr_width = f_width;
++ else
++ curr_width = config_reg->var_field_width[m];
++
++ ncomb = 1 << curr_width;
++ for (n = 0; n < ncomb; n++) {
++ if (config_reg->enum_ids[pos + n] == enum_id) {
++ *crp = config_reg;
++ *fieldp = m;
++ *valuep = n;
++ *cntp = &config_reg->cnt[m];
++ return 0;
++ }
+ }
++ pos += ncomb;
++ m++;
+ }
+ k++;
+ }
+diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
+index 91666a5..84538c4 100644
+--- a/include/linux/sh_pfc.h
++++ b/include/linux/sh_pfc.h
+@@ -45,12 +45,19 @@ struct pinmux_cfg_reg {
+ unsigned long reg, reg_width, field_width;
+ unsigned long *cnt;
+ pinmux_enum_t *enum_ids;
++ unsigned long *var_field_width;
+ };
+
+ #define PINMUX_CFG_REG(name, r, r_width, f_width) \
+ .reg = r, .reg_width = r_width, .field_width = f_width, \
+ .cnt = (unsigned long [r_width / f_width]) {}, \
+- .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \
++ .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)])
++
++#define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...) \
++ .reg = r, .reg_width = r_width, \
++ .cnt = (unsigned long [r_width]) {}, \
++ .var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \
++ .enum_ids = (pinmux_enum_t [])
+
+ struct pinmux_data_reg {
+ unsigned long reg, reg_width, reg_shadow;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0020-sh-pfc-Unlock-register-support.patch b/patches.armadillo800eva/0020-sh-pfc-Unlock-register-support.patch
new file mode 100644
index 00000000000000..0508aa0a862f3d
--- /dev/null
+++ b/patches.armadillo800eva/0020-sh-pfc-Unlock-register-support.patch
@@ -0,0 +1,74 @@
+From 6749dc26121059478d004099fd6e17334cfe4523 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 14 Dec 2011 01:01:14 +0900
+Subject: sh: pfc: Unlock register support
+
+Add PFC support for a 32-bit unlock register. Needed to
+drive the r8a7779 PFC that comes with a funky PMMR register.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit e499ada829cf769ac6f16627cd9f09b855a7fd6d)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/pfc.c | 22 ++++++++++------------
+ include/linux/sh_pfc.h | 2 ++
+ 2 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c
+index f975f4a..522c6c4 100644
+--- a/drivers/sh/pfc.c
++++ b/drivers/sh/pfc.c
+@@ -210,7 +210,7 @@ static void write_config_reg(struct pinmux_info *gpioc,
+ unsigned long field, unsigned long value)
+ {
+ void __iomem *mapped_reg;
+- unsigned long mask, pos;
++ unsigned long mask, pos, data;
+
+ config_reg_helper(gpioc, crp, field, &mapped_reg, &mask, &pos);
+
+@@ -221,17 +221,15 @@ static void write_config_reg(struct pinmux_info *gpioc,
+ mask = ~(mask << pos);
+ value = value << pos;
+
+- switch (crp->reg_width) {
+- case 8:
+- iowrite8((ioread8(mapped_reg) & mask) | value, mapped_reg);
+- break;
+- case 16:
+- iowrite16((ioread16(mapped_reg) & mask) | value, mapped_reg);
+- break;
+- case 32:
+- iowrite32((ioread32(mapped_reg) & mask) | value, mapped_reg);
+- break;
+- }
++ data = gpio_read_raw_reg(mapped_reg, crp->reg_width);
++ data &= mask;
++ data |= value;
++
++ if (gpioc->unlock_reg)
++ gpio_write_raw_reg(pfc_phys_to_virt(gpioc, gpioc->unlock_reg),
++ 32, ~data);
++
++ gpio_write_raw_reg(mapped_reg, crp->reg_width, data);
+ }
+
+ static int setup_data_reg(struct pinmux_info *gpioc, unsigned gpio)
+diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
+index 84538c4..5c15aed 100644
+--- a/include/linux/sh_pfc.h
++++ b/include/linux/sh_pfc.h
+@@ -116,6 +116,8 @@ struct pinmux_info {
+ unsigned int num_resources;
+ struct pfc_window *window;
+
++ unsigned long unlock_reg;
++
+ struct gpio_chip chip;
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0021-ARM-mach-shmobile-Break-out-INTC-IRQ-code.patch b/patches.armadillo800eva/0021-ARM-mach-shmobile-Break-out-INTC-IRQ-code.patch
new file mode 100644
index 00000000000000..59195515f28073
--- /dev/null
+++ b/patches.armadillo800eva/0021-ARM-mach-shmobile-Break-out-INTC-IRQ-code.patch
@@ -0,0 +1,223 @@
+From e861be67e97d0646794cd5d478b3b25019a73543 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 12 Oct 2011 16:21:00 +0900
+Subject: ARM: mach-shmobile: Break out INTC IRQ code
+
+Add INTC_IRQ_PINS_16() and INTC_IRQ_PINS_32() to mach/intc.h.
+These macros define 16 or 32 external IRQ pins on a certain
+memory base address. Can be used with INTCA or INTCS.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit d6e15eefcb334deac3e877fce80ace3b91b0ab69)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/include/mach/intc.h | 195 ++++++++++++++++++++++++++++
+ 1 file changed, 195 insertions(+)
+ create mode 100644 arch/arm/mach-shmobile/include/mach/intc.h
+
+diff --git a/arch/arm/mach-shmobile/include/mach/intc.h b/arch/arm/mach-shmobile/include/mach/intc.h
+new file mode 100644
+index 0000000..1cd8b36
+--- /dev/null
++++ b/arch/arm/mach-shmobile/include/mach/intc.h
+@@ -0,0 +1,195 @@
++#ifndef __ASM_MACH_INTC_H
++#define __ASM_MACH_INTC_H
++#include <linux/sh_intc.h>
++
++#define INTC_IRQ_PINS_ENUM_16L(p) \
++ p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
++ p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7, \
++ p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
++ p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15
++
++#define INTC_IRQ_PINS_ENUM_16H(p) \
++ p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
++ p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23, \
++ p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
++ p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31
++
++#define INTC_IRQ_PINS_VECT_16L(p, vect) \
++ vect(p ## _IRQ0, 0x0200), vect(p ## _IRQ1, 0x0220), \
++ vect(p ## _IRQ2, 0x0240), vect(p ## _IRQ3, 0x0260), \
++ vect(p ## _IRQ4, 0x0280), vect(p ## _IRQ5, 0x02a0), \
++ vect(p ## _IRQ6, 0x02c0), vect(p ## _IRQ7, 0x02e0), \
++ vect(p ## _IRQ8, 0x0300), vect(p ## _IRQ9, 0x0320), \
++ vect(p ## _IRQ10, 0x0340), vect(p ## _IRQ11, 0x0360), \
++ vect(p ## _IRQ12, 0x0380), vect(p ## _IRQ13, 0x03a0), \
++ vect(p ## _IRQ14, 0x03c0), vect(p ## _IRQ15, 0x03e0)
++
++#define INTC_IRQ_PINS_VECT_16H(p, vect) \
++ vect(p ## _IRQ16, 0x3200), vect(p ## _IRQ17, 0x3220), \
++ vect(p ## _IRQ18, 0x3240), vect(p ## _IRQ19, 0x3260), \
++ vect(p ## _IRQ20, 0x3280), vect(p ## _IRQ21, 0x32a0), \
++ vect(p ## _IRQ22, 0x32c0), vect(p ## _IRQ23, 0x32e0), \
++ vect(p ## _IRQ24, 0x3300), vect(p ## _IRQ25, 0x3320), \
++ vect(p ## _IRQ26, 0x3340), vect(p ## _IRQ27, 0x3360), \
++ vect(p ## _IRQ28, 0x3380), vect(p ## _IRQ29, 0x33a0), \
++ vect(p ## _IRQ30, 0x33c0), vect(p ## _IRQ31, 0x33e0)
++
++#define INTC_IRQ_PINS_MASK_16L(p, base) \
++ { base + 0x40, base + 0x60, 8, /* INTMSK00A / INTMSKCLR00A */ \
++ { p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
++ p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7 } }, \
++ { base + 0x44, base + 0x64, 8, /* INTMSK10A / INTMSKCLR10A */ \
++ { p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
++ p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15 } }
++
++#define INTC_IRQ_PINS_MASK_16H(p, base) \
++ { base + 0x48, base + 0x68, 8, /* INTMSK20A / INTMSKCLR20A */ \
++ { p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
++ p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23 } }, \
++ { base + 0x4c, base + 0x6c, 8, /* INTMSK30A / INTMSKCLR30A */ \
++ { p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
++ p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31 } }
++
++#define INTC_IRQ_PINS_PRIO_16L(p, base) \
++ { base + 0x10, 0, 32, 4, /* INTPRI00A */ \
++ { p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
++ p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7 } }, \
++ { base + 0x14, 0, 32, 4, /* INTPRI10A */ \
++ { p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
++ p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15 } }
++
++#define INTC_IRQ_PINS_PRIO_16H(p, base) \
++ { base + 0x18, 0, 32, 4, /* INTPRI20A */ \
++ { p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
++ p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23 } }, \
++ { base + 0x1c, 0, 32, 4, /* INTPRI30A */ \
++ { p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
++ p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31 } }
++
++#define INTC_IRQ_PINS_SENSE_16L(p, base) \
++ { base + 0x00, 32, 4, /* ICR1A */ \
++ { p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
++ p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7 } }, \
++ { base + 0x04, 32, 4, /* ICR2A */ \
++ { p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
++ p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15 } }
++
++#define INTC_IRQ_PINS_SENSE_16H(p, base) \
++ { base + 0x08, 32, 4, /* ICR3A */ \
++ { p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
++ p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23 } }, \
++ { base + 0x0c, 32, 4, /* ICR4A */ \
++ { p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
++ p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31 } }
++
++#define INTC_IRQ_PINS_ACK_16L(p, base) \
++ { base + 0x20, 0, 8, /* INTREQ00A */ \
++ { p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
++ p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7 } }, \
++ { base + 0x24, 0, 8, /* INTREQ10A */ \
++ { p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
++ p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15 } }
++
++#define INTC_IRQ_PINS_ACK_16H(p, base) \
++ { base + 0x28, 0, 8, /* INTREQ20A */ \
++ { p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
++ p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23 } }, \
++ { base + 0x2c, 0, 8, /* INTREQ30A */ \
++ { p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
++ p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31 } }
++
++#define INTC_IRQ_PINS_16(p, base, vect, str) \
++ \
++static struct resource p ## _resources[] __initdata = { \
++ [0] = { \
++ .start = base, \
++ .end = base + 0x64, \
++ .flags = IORESOURCE_MEM, \
++ }, \
++}; \
++ \
++enum { \
++ p ## _UNUSED = 0, \
++ INTC_IRQ_PINS_ENUM_16L(p), \
++}; \
++ \
++static struct intc_vect p ## _vectors[] __initdata = { \
++ INTC_IRQ_PINS_VECT_16L(p, vect), \
++}; \
++ \
++static struct intc_mask_reg p ## _mask_registers[] __initdata = { \
++ INTC_IRQ_PINS_MASK_16L(p, base), \
++}; \
++ \
++static struct intc_prio_reg p ## _prio_registers[] __initdata = { \
++ INTC_IRQ_PINS_PRIO_16L(p, base), \
++}; \
++ \
++static struct intc_sense_reg p ## _sense_registers[] __initdata = { \
++ INTC_IRQ_PINS_SENSE_16L(p, base), \
++}; \
++ \
++static struct intc_mask_reg p ## _ack_registers[] __initdata = { \
++ INTC_IRQ_PINS_ACK_16L(p, base), \
++}; \
++ \
++static struct intc_desc p ## _desc __initdata = { \
++ .name = str, \
++ .resource = p ## _resources, \
++ .num_resources = ARRAY_SIZE(p ## _resources), \
++ .hw = INTC_HW_DESC(p ## _vectors, NULL, \
++ p ## _mask_registers, p ## _prio_registers, \
++ p ## _sense_registers, p ## _ack_registers) \
++}
++
++#define INTC_IRQ_PINS_32(p, base, vect, str) \
++ \
++static struct resource p ## _resources[] __initdata = { \
++ [0] = { \
++ .start = base, \
++ .end = base + 0x6c, \
++ .flags = IORESOURCE_MEM, \
++ }, \
++}; \
++ \
++enum { \
++ p ## _UNUSED = 0, \
++ INTC_IRQ_PINS_ENUM_16L(p), \
++ INTC_IRQ_PINS_ENUM_16H(p), \
++}; \
++ \
++static struct intc_vect p ## _vectors[] __initdata = { \
++ INTC_IRQ_PINS_VECT_16L(p, vect), \
++ INTC_IRQ_PINS_VECT_16H(p, vect), \
++}; \
++ \
++static struct intc_mask_reg p ## _mask_registers[] __initdata = { \
++ INTC_IRQ_PINS_MASK_16L(p, base), \
++ INTC_IRQ_PINS_MASK_16H(p, base), \
++}; \
++ \
++static struct intc_prio_reg p ## _prio_registers[] __initdata = { \
++ INTC_IRQ_PINS_PRIO_16L(p, base), \
++ INTC_IRQ_PINS_PRIO_16H(p, base), \
++}; \
++ \
++static struct intc_sense_reg p ## _sense_registers[] __initdata = { \
++ INTC_IRQ_PINS_SENSE_16L(p, base), \
++ INTC_IRQ_PINS_SENSE_16H(p, base), \
++}; \
++ \
++static struct intc_mask_reg p ## _ack_registers[] __initdata = { \
++ INTC_IRQ_PINS_ACK_16L(p, base), \
++ INTC_IRQ_PINS_ACK_16H(p, base), \
++}; \
++ \
++static struct intc_desc p ## _desc __initdata = { \
++ .name = str, \
++ .resource = p ## _resources, \
++ .num_resources = ARRAY_SIZE(p ## _resources), \
++ .hw = INTC_HW_DESC(p ## _vectors, NULL, \
++ p ## _mask_registers, p ## _prio_registers, \
++ p ## _sense_registers, p ## _ack_registers) \
++}
++
++#endif /* __ASM_MACH_INTC_H */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0022-sh-intc-enable-both-edges-GPIO-interrupts-on-sh7372.patch b/patches.armadillo800eva/0022-sh-intc-enable-both-edges-GPIO-interrupts-on-sh7372.patch
new file mode 100644
index 00000000000000..171f0784a3ff8b
--- /dev/null
+++ b/patches.armadillo800eva/0022-sh-intc-enable-both-edges-GPIO-interrupts-on-sh7372.patch
@@ -0,0 +1,35 @@
+From 2348ecf8f9c27a15eaa50e0df57d1626d3913ad4 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Fri, 15 Jul 2011 10:58:55 +0000
+Subject: sh: intc: enable both edges GPIO interrupts on sh7372
+
+IRQ-capable GPIOs on sh7372 can be configured to produce interrupts on
+both edges.
+
+Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 9a14a92c939aea1aaf27f5ad37b26b235acc2a65)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/chip.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
+index f33e2dd..33b2ed4 100644
+--- a/drivers/sh/intc/chip.c
++++ b/drivers/sh/intc/chip.c
+@@ -186,6 +186,9 @@ static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = {
+ !defined(CONFIG_CPU_SUBTYPE_SH7709)
+ [IRQ_TYPE_LEVEL_HIGH] = VALID(3),
+ #endif
++#if defined(CONFIG_ARCH_SH7372)
++ [IRQ_TYPE_EDGE_BOTH] = VALID(4),
++#endif
+ };
+
+ static int intc_set_type(struct irq_data *data, unsigned int type)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0023-sh-intc-Add-IRQ-trigger-bit-field-check.patch b/patches.armadillo800eva/0023-sh-intc-Add-IRQ-trigger-bit-field-check.patch
new file mode 100644
index 00000000000000..573787d277e81f
--- /dev/null
+++ b/patches.armadillo800eva/0023-sh-intc-Add-IRQ-trigger-bit-field-check.patch
@@ -0,0 +1,45 @@
+From 3187b8ff897a3181b941621878f72fb6ee219b34 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Mon, 17 Oct 2011 17:59:54 +0900
+Subject: sh: intc: Add IRQ trigger bit field check
+
+R-Mobile SoCs such as sh73a0 include PINT blocks in INTC
+that come with 2-bit IRQ trigger support. Add code to make
+sure the bit width is checked so 4-bit only modes like for
+instance EDGE_BOTH will fail for PINT.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 52e3124f248e9ada990cd2aeafe250a53713c6f0)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/chip.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
+index 33b2ed4..e0ada37 100644
+--- a/drivers/sh/intc/chip.c
++++ b/drivers/sh/intc/chip.c
+@@ -202,11 +202,16 @@ static int intc_set_type(struct irq_data *data, unsigned int type)
+ if (!value)
+ return -EINVAL;
+
++ value &= ~SENSE_VALID_FLAG;
++
+ ihp = intc_find_irq(d->sense, d->nr_sense, irq);
+ if (ihp) {
++ /* PINT has 2-bit sense registers, should fail on EDGE_BOTH */
++ if (value >= (1 << _INTC_WIDTH(ihp->handle)))
++ return -EINVAL;
++
+ addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0);
+- intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle,
+- value & ~SENSE_VALID_FLAG);
++ intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value);
+ }
+
+ return 0;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0024-sh-userimask.c-needs-linux-stat.h.patch b/patches.armadillo800eva/0024-sh-userimask.c-needs-linux-stat.h.patch
new file mode 100644
index 00000000000000..5c9d14e7f6b49f
--- /dev/null
+++ b/patches.armadillo800eva/0024-sh-userimask.c-needs-linux-stat.h.patch
@@ -0,0 +1,41 @@
+From 8a11831bfe1cfac1af9f51759cdf9e7033b05a02 Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Tue, 4 Oct 2011 10:17:21 +0900
+Subject: sh: userimask.c needs linux/stat.h
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fix the problem that S_IRUSR and S_IWUSR are not solved in userimask.c.
+
+-----
+CC drivers/usb/host/r8a66597-hcd.o
+drivers/sh/intc/userimask.c:57: error: ‘S_IRUSR’ undeclared here (not in a function)
+drivers/sh/intc/userimask.c:57: error: ‘S_IWUSR’ undeclared here (not in a function)
+CC drivers/watchdog/shwdt.o
+-----
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit a102a0888799d389c033fe22db3f1e153390fcc5)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/userimask.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/sh/intc/userimask.c b/drivers/sh/intc/userimask.c
+index e32304b..56bf933 100644
+--- a/drivers/sh/intc/userimask.c
++++ b/drivers/sh/intc/userimask.c
+@@ -13,6 +13,7 @@
+ #include <linux/sysdev.h>
+ #include <linux/init.h>
+ #include <linux/io.h>
++#include <linux/stat.h>
+ #include <asm/sizes.h>
+ #include "internals.h"
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0025-sh-fix-implicit-use-of-stat.h-in-arch-sh-specific-fi.patch b/patches.armadillo800eva/0025-sh-fix-implicit-use-of-stat.h-in-arch-sh-specific-fi.patch
new file mode 100644
index 00000000000000..d59cf058669ee8
--- /dev/null
+++ b/patches.armadillo800eva/0025-sh-fix-implicit-use-of-stat.h-in-arch-sh-specific-fi.patch
@@ -0,0 +1,41 @@
+From 9efd02e76527f0bd54f13c5c10aa02dee83a5de1 Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Sun, 31 Jul 2011 17:40:26 -0400
+Subject: sh: fix implicit use of stat.h in arch/sh specific files
+
+To fix:
+
+arch/sh/drivers/dma/dma-sysfs.c:45:8: error: 'S_IRUGO' undeclared here (not in a function)
+arch/sh/drivers/dma/dma-sysfs.c:75:8: error: 'S_IWUSR' undeclared here (not in a function)
+make[4]: *** [arch/sh/drivers/dma/dma-sysfs.o] Error 1
+
+drivers/sh/intc/core.c:449: error: 'S_IRUGO' undeclared here (not in a function)
+make[5]: *** [drivers/sh/intc/core.o] Error 1
+
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+(cherry picked from commit 0c43871b4036444b8734d06ab9ec0bb9046aada4)
+
+Conflicts:
+
+ arch/sh/drivers/dma/dma-sysfs.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
+index c6ca115..f892529 100644
+--- a/drivers/sh/intc/core.c
++++ b/drivers/sh/intc/core.c
+@@ -22,6 +22,7 @@
+ #include <linux/irq.h>
+ #include <linux/io.h>
+ #include <linux/slab.h>
++#include <linux/stat.h>
+ #include <linux/interrupt.h>
+ #include <linux/sh_intc.h>
+ #include <linux/sysdev.h>
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0026-sh-Add-module.h-to-arch-sh-specific-files-as-require.patch b/patches.armadillo800eva/0026-sh-Add-module.h-to-arch-sh-specific-files-as-require.patch
new file mode 100644
index 00000000000000..b4e336afec0e1c
--- /dev/null
+++ b/patches.armadillo800eva/0026-sh-Add-module.h-to-arch-sh-specific-files-as-require.patch
@@ -0,0 +1,32 @@
+From d3a14f95c6aec6919dce9359f0e4f31aa5364976 Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Sun, 31 Jul 2011 19:18:02 -0400
+Subject: sh: Add module.h to arch/sh specific files as required.
+
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+(cherry picked from commit db4e83957f961f9053282409c5062c6baef857a4)
+
+Conflicts:
+
+ drivers/sh/maple/maple.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/dynamic.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/sh/intc/dynamic.c b/drivers/sh/intc/dynamic.c
+index a3677c9..5fea1ee 100644
+--- a/drivers/sh/intc/dynamic.c
++++ b/drivers/sh/intc/dynamic.c
+@@ -14,6 +14,7 @@
+ #include <linux/irq.h>
+ #include <linux/bitmap.h>
+ #include <linux/spinlock.h>
++#include <linux/module.h>
+ #include "internals.h" /* only for activate_irq() damage.. */
+
+ /*
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0027-sh-Add-export.h-to-arch-sh-specific-files-as-require.patch b/patches.armadillo800eva/0027-sh-Add-export.h-to-arch-sh-specific-files-as-require.patch
new file mode 100644
index 00000000000000..2b3196a709de58
--- /dev/null
+++ b/patches.armadillo800eva/0027-sh-Add-export.h-to-arch-sh-specific-files-as-require.patch
@@ -0,0 +1,36 @@
+From 93b6afc62d174759ab0f9ebf5539fed48c9e3973 Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Sun, 31 Jul 2011 19:20:02 -0400
+Subject: sh: Add export.h to arch/sh specific files as required.
+
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+(cherry picked from commit f7be345515ab6d5c3a0973bb2b32510fcb7c0481)
+
+Conflicts:
+
+ arch/sh/drivers/pci/pci.c
+ arch/sh/kernel/cpu/shmobile/cpuidle.c
+ arch/sh/kernel/perf_event.c
+ arch/sh/kernel/topology.c
+ arch/sh/mm/init.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
+index f892529..8b7a141 100644
+--- a/drivers/sh/intc/core.c
++++ b/drivers/sh/intc/core.c
+@@ -30,6 +30,7 @@
+ #include <linux/list.h>
+ #include <linux/spinlock.h>
+ #include <linux/radix-tree.h>
++#include <linux/export.h>
+ #include "internals.h"
+
+ LIST_HEAD(intc_list);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0028-drivers-sh-Add-export.h-for-EXPORT_SYMBOL-to-intc-vi.patch b/patches.armadillo800eva/0028-drivers-sh-Add-export.h-for-EXPORT_SYMBOL-to-intc-vi.patch
new file mode 100644
index 00000000000000..b7b7deec6348e2
--- /dev/null
+++ b/patches.armadillo800eva/0028-drivers-sh-Add-export.h-for-EXPORT_SYMBOL-to-intc-vi.patch
@@ -0,0 +1,31 @@
+From e92a630648d73850796db1c5fedece4937699378 Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Sun, 10 Jul 2011 12:57:12 -0400
+Subject: drivers/sh: Add export.h for EXPORT_SYMBOL to intc/virq.c
+
+This is exporting symbols and will fail to build once we remove
+the implicit presence of module.h
+
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+(cherry picked from commit 07c92739455520541c22f6529683467aa3058b7c)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/virq.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
+index 1e6e2d0..c7ec49f 100644
+--- a/drivers/sh/intc/virq.c
++++ b/drivers/sh/intc/virq.c
+@@ -14,6 +14,7 @@
+ #include <linux/list.h>
+ #include <linux/radix-tree.h>
+ #include <linux/spinlock.h>
++#include <linux/export.h>
+ #include "internals.h"
+
+ static struct intc_map_entry intc_irq_xlate[NR_IRQS];
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0029-driver-core-implement-sysdev-functionality-for-regul.patch b/patches.armadillo800eva/0029-driver-core-implement-sysdev-functionality-for-regul.patch
new file mode 100644
index 00000000000000..3f767707ec7fe2
--- /dev/null
+++ b/patches.armadillo800eva/0029-driver-core-implement-sysdev-functionality-for-regul.patch
@@ -0,0 +1,892 @@
+From 3a44eab5cb01520d708aa6316ac636e02af5eda4 Mon Sep 17 00:00:00 2001
+From: Kay Sievers <kay.sievers@vrfy.org>
+Date: Wed, 14 Dec 2011 14:29:38 -0800
+Subject: driver-core: implement 'sysdev' functionality for regular devices
+ and buses
+
+All sysdev classes and sysdev devices will converted to regular devices
+and buses to properly hook userspace into the event processing.
+
+There is no interesting difference between a 'sysdev' and 'device' which
+would justify to roll an entire own subsystem with different userspace
+export semantics. Userspace relies on events and generic sysfs subsystem
+infrastructure from sysdev devices, which are currently not properly
+available.
+
+Every converted sysdev class will create a regular device with the class
+name in /sys/devices/system and all registered devices will becom a children
+of theses devices.
+
+For compatibility reasons, the sysdev class-wide attributes are created
+at this parent device. (Do not copy that logic for anything new, subsystem-
+wide properties belong to the subsystem, not to some fake parent device
+created in /sys/devices.)
+
+Every sysdev driver is implemented as a simple subsystem interface now,
+and no longer called a driver.
+
+After all sysdev classes are ported to regular driver core entities, the
+sysdev implementation will be entirely removed from the kernel.
+
+Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+(cherry picked from commit ca22e56debc57b47c422b749c93217ba62644be2)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+(cherry picked from commit c74f76e28635bb48b4c70ef51faa36d6aa19ef2f)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/base/base.h | 12 +-
+ drivers/base/bus.c | 293 ++++++++++++++++++++++++++++++++++++++++++++----
+ drivers/base/class.c | 14 +--
+ drivers/base/core.c | 85 +++++++++++---
+ drivers/base/init.c | 1 -
+ drivers/base/sys.c | 10 +-
+ include/linux/device.h | 78 ++++++++++++-
+ 7 files changed, 431 insertions(+), 62 deletions(-)
+
+diff --git a/drivers/base/base.h b/drivers/base/base.h
+index a34dca0..9798835 100644
+--- a/drivers/base/base.h
++++ b/drivers/base/base.h
+@@ -3,7 +3,9 @@
+ * struct subsys_private - structure to hold the private to the driver core portions of the bus_type/class structure.
+ *
+ * @subsys - the struct kset that defines this subsystem
+- * @devices_kset - the list of devices associated
++ * @devices_kset - the subsystem's 'devices' directory
++ * @interfaces - list of subsystem interfaces associated
++ * @mutex - protect the devices, and interfaces lists.
+ *
+ * @drivers_kset - the list of drivers associated
+ * @klist_devices - the klist to iterate over the @devices_kset
+@@ -13,10 +15,8 @@
+ * @bus - pointer back to the struct bus_type that this structure is associated
+ * with.
+ *
+- * @class_interfaces - list of class_interfaces associated
+ * @glue_dirs - "glue" directory to put in-between the parent device to
+ * avoid namespace conflicts
+- * @class_mutex - mutex to protect the children, devices, and interfaces lists.
+ * @class - pointer back to the struct class that this structure is associated
+ * with.
+ *
+@@ -27,6 +27,8 @@
+ struct subsys_private {
+ struct kset subsys;
+ struct kset *devices_kset;
++ struct list_head interfaces;
++ struct mutex mutex;
+
+ struct kset *drivers_kset;
+ struct klist klist_devices;
+@@ -35,9 +37,7 @@ struct subsys_private {
+ unsigned int drivers_autoprobe:1;
+ struct bus_type *bus;
+
+- struct list_head class_interfaces;
+ struct kset glue_dirs;
+- struct mutex class_mutex;
+ struct class *class;
+ };
+ #define to_subsys_private(obj) container_of(obj, struct subsys_private, subsys.kobj)
+@@ -93,7 +93,6 @@ extern int hypervisor_init(void);
+ static inline int hypervisor_init(void) { return 0; }
+ #endif
+ extern int platform_bus_init(void);
+-extern int system_bus_init(void);
+ extern int cpu_dev_init(void);
+
+ extern int bus_add_device(struct device *dev);
+@@ -115,6 +114,7 @@ extern char *make_class_name(const char *name, struct kobject *kobj);
+
+ extern int devres_release_all(struct device *dev);
+
++/* /sys/devices directory */
+ extern struct kset *devices_kset;
+
+ #if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS)
+diff --git a/drivers/base/bus.c b/drivers/base/bus.c
+index 000e7b2..99dc592 100644
+--- a/drivers/base/bus.c
++++ b/drivers/base/bus.c
+@@ -16,9 +16,14 @@
+ #include <linux/slab.h>
+ #include <linux/init.h>
+ #include <linux/string.h>
++#include <linux/mutex.h>
+ #include "base.h"
+ #include "power/power.h"
+
++/* /sys/devices/system */
++/* FIXME: make static after drivers/base/sys.c is deleted */
++struct kset *system_kset;
++
+ #define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
+
+ /*
+@@ -360,6 +365,47 @@ struct device *bus_find_device_by_name(struct bus_type *bus,
+ }
+ EXPORT_SYMBOL_GPL(bus_find_device_by_name);
+
++/**
++ * subsys_find_device_by_id - find a device with a specific enumeration number
++ * @subsys: subsystem
++ * @id: index 'id' in struct device
++ * @hint: device to check first
++ *
++ * Check the hint's next object and if it is a match return it directly,
++ * otherwise, fall back to a full list search. Either way a reference for
++ * the returned object is taken.
++ */
++struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id,
++ struct device *hint)
++{
++ struct klist_iter i;
++ struct device *dev;
++
++ if (!subsys)
++ return NULL;
++
++ if (hint) {
++ klist_iter_init_node(&subsys->p->klist_devices, &i, &hint->p->knode_bus);
++ dev = next_device(&i);
++ if (dev && dev->id == id && get_device(dev)) {
++ klist_iter_exit(&i);
++ return dev;
++ }
++ klist_iter_exit(&i);
++ }
++
++ klist_iter_init_node(&subsys->p->klist_devices, &i, NULL);
++ while ((dev = next_device(&i))) {
++ if (dev->id == id && get_device(dev)) {
++ klist_iter_exit(&i);
++ return dev;
++ }
++ }
++ klist_iter_exit(&i);
++ return NULL;
++}
++EXPORT_SYMBOL_GPL(subsys_find_device_by_id);
++
+ static struct device_driver *next_driver(struct klist_iter *i)
+ {
+ struct klist_node *n = klist_next(i);
+@@ -487,38 +533,59 @@ out_put:
+ void bus_probe_device(struct device *dev)
+ {
+ struct bus_type *bus = dev->bus;
++ struct subsys_interface *sif;
+ int ret;
+
+- if (bus && bus->p->drivers_autoprobe) {
++ if (!bus)
++ return;
++
++ if (bus->p->drivers_autoprobe) {
+ ret = device_attach(dev);
+ WARN_ON(ret < 0);
+ }
++
++ mutex_lock(&bus->p->mutex);
++ list_for_each_entry(sif, &bus->p->interfaces, node)
++ if (sif->add_dev)
++ sif->add_dev(dev, sif);
++ mutex_unlock(&bus->p->mutex);
+ }
+
+ /**
+ * bus_remove_device - remove device from bus
+ * @dev: device to be removed
+ *
+- * - Remove symlink from bus's directory.
++ * - Remove device from all interfaces.
++ * - Remove symlink from bus' directory.
+ * - Delete device from bus's list.
+ * - Detach from its driver.
+ * - Drop reference taken in bus_add_device().
+ */
+ void bus_remove_device(struct device *dev)
+ {
+- if (dev->bus) {
+- sysfs_remove_link(&dev->kobj, "subsystem");
+- sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
+- dev_name(dev));
+- device_remove_attrs(dev->bus, dev);
+- if (klist_node_attached(&dev->p->knode_bus))
+- klist_del(&dev->p->knode_bus);
+-
+- pr_debug("bus: '%s': remove device %s\n",
+- dev->bus->name, dev_name(dev));
+- device_release_driver(dev);
+- bus_put(dev->bus);
+- }
++ struct bus_type *bus = dev->bus;
++ struct subsys_interface *sif;
++
++ if (!bus)
++ return;
++
++ mutex_lock(&bus->p->mutex);
++ list_for_each_entry(sif, &bus->p->interfaces, node)
++ if (sif->remove_dev)
++ sif->remove_dev(dev, sif);
++ mutex_unlock(&bus->p->mutex);
++
++ sysfs_remove_link(&dev->kobj, "subsystem");
++ sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
++ dev_name(dev));
++ device_remove_attrs(dev->bus, dev);
++ if (klist_node_attached(&dev->p->knode_bus))
++ klist_del(&dev->p->knode_bus);
++
++ pr_debug("bus: '%s': remove device %s\n",
++ dev->bus->name, dev_name(dev));
++ device_release_driver(dev);
++ bus_put(dev->bus);
+ }
+
+ static int driver_add_attrs(struct bus_type *bus, struct device_driver *drv)
+@@ -847,14 +914,14 @@ static ssize_t bus_uevent_store(struct bus_type *bus,
+ static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store);
+
+ /**
+- * bus_register - register a bus with the system.
++ * __bus_register - register a driver-core subsystem
+ * @bus: bus.
+ *
+ * Once we have that, we registered the bus with the kobject
+ * infrastructure, then register the children subsystems it has:
+- * the devices and drivers that belong to the bus.
++ * the devices and drivers that belong to the subsystem.
+ */
+-int bus_register(struct bus_type *bus)
++int __bus_register(struct bus_type *bus, struct lock_class_key *key)
+ {
+ int retval;
+ struct subsys_private *priv;
+@@ -898,6 +965,8 @@ int bus_register(struct bus_type *bus)
+ goto bus_drivers_fail;
+ }
+
++ INIT_LIST_HEAD(&priv->interfaces);
++ __mutex_init(&priv->mutex, "subsys mutex", key);
+ klist_init(&priv->klist_devices, klist_devices_get, klist_devices_put);
+ klist_init(&priv->klist_drivers, NULL, NULL);
+
+@@ -927,7 +996,7 @@ out:
+ bus->p = NULL;
+ return retval;
+ }
+-EXPORT_SYMBOL_GPL(bus_register);
++EXPORT_SYMBOL_GPL(__bus_register);
+
+ /**
+ * bus_unregister - remove a bus from the system
+@@ -939,6 +1008,8 @@ EXPORT_SYMBOL_GPL(bus_register);
+ void bus_unregister(struct bus_type *bus)
+ {
+ pr_debug("bus: '%s': unregistering\n", bus->name);
++ if (bus->dev_root)
++ device_unregister(bus->dev_root);
+ bus_remove_attrs(bus);
+ remove_probe_files(bus);
+ kset_unregister(bus->p->drivers_kset);
+@@ -1028,10 +1099,194 @@ void bus_sort_breadthfirst(struct bus_type *bus,
+ }
+ EXPORT_SYMBOL_GPL(bus_sort_breadthfirst);
+
++/**
++ * subsys_dev_iter_init - initialize subsys device iterator
++ * @iter: subsys iterator to initialize
++ * @subsys: the subsys we wanna iterate over
++ * @start: the device to start iterating from, if any
++ * @type: device_type of the devices to iterate over, NULL for all
++ *
++ * Initialize subsys iterator @iter such that it iterates over devices
++ * of @subsys. If @start is set, the list iteration will start there,
++ * otherwise if it is NULL, the iteration starts at the beginning of
++ * the list.
++ */
++void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys,
++ struct device *start, const struct device_type *type)
++{
++ struct klist_node *start_knode = NULL;
++
++ if (start)
++ start_knode = &start->p->knode_bus;
++ klist_iter_init_node(&subsys->p->klist_devices, &iter->ki, start_knode);
++ iter->type = type;
++}
++EXPORT_SYMBOL_GPL(subsys_dev_iter_init);
++
++/**
++ * subsys_dev_iter_next - iterate to the next device
++ * @iter: subsys iterator to proceed
++ *
++ * Proceed @iter to the next device and return it. Returns NULL if
++ * iteration is complete.
++ *
++ * The returned device is referenced and won't be released till
++ * iterator is proceed to the next device or exited. The caller is
++ * free to do whatever it wants to do with the device including
++ * calling back into subsys code.
++ */
++struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
++{
++ struct klist_node *knode;
++ struct device *dev;
++
++ for (;;) {
++ knode = klist_next(&iter->ki);
++ if (!knode)
++ return NULL;
++ dev = container_of(knode, struct device_private, knode_bus)->device;
++ if (!iter->type || iter->type == dev->type)
++ return dev;
++ }
++}
++EXPORT_SYMBOL_GPL(subsys_dev_iter_next);
++
++/**
++ * subsys_dev_iter_exit - finish iteration
++ * @iter: subsys iterator to finish
++ *
++ * Finish an iteration. Always call this function after iteration is
++ * complete whether the iteration ran till the end or not.
++ */
++void subsys_dev_iter_exit(struct subsys_dev_iter *iter)
++{
++ klist_iter_exit(&iter->ki);
++}
++EXPORT_SYMBOL_GPL(subsys_dev_iter_exit);
++
++int subsys_interface_register(struct subsys_interface *sif)
++{
++ struct bus_type *subsys;
++ struct subsys_dev_iter iter;
++ struct device *dev;
++
++ if (!sif || !sif->subsys)
++ return -ENODEV;
++
++ subsys = bus_get(sif->subsys);
++ if (!subsys)
++ return -EINVAL;
++
++ mutex_lock(&subsys->p->mutex);
++ list_add_tail(&sif->node, &subsys->p->interfaces);
++ if (sif->add_dev) {
++ subsys_dev_iter_init(&iter, subsys, NULL, NULL);
++ while ((dev = subsys_dev_iter_next(&iter)))
++ sif->add_dev(dev, sif);
++ subsys_dev_iter_exit(&iter);
++ }
++ mutex_unlock(&subsys->p->mutex);
++
++ return 0;
++}
++EXPORT_SYMBOL_GPL(subsys_interface_register);
++
++void subsys_interface_unregister(struct subsys_interface *sif)
++{
++ struct bus_type *subsys = sif->subsys;
++ struct subsys_dev_iter iter;
++ struct device *dev;
++
++ if (!sif)
++ return;
++
++ mutex_lock(&subsys->p->mutex);
++ list_del_init(&sif->node);
++ if (sif->remove_dev) {
++ subsys_dev_iter_init(&iter, subsys, NULL, NULL);
++ while ((dev = subsys_dev_iter_next(&iter)))
++ sif->remove_dev(dev, sif);
++ subsys_dev_iter_exit(&iter);
++ }
++ mutex_unlock(&subsys->p->mutex);
++
++ bus_put(subsys);
++}
++EXPORT_SYMBOL_GPL(subsys_interface_unregister);
++
++static void system_root_device_release(struct device *dev)
++{
++ kfree(dev);
++}
++/**
++ * subsys_system_register - register a subsystem at /sys/devices/system/
++ * @subsys - system subsystem
++ * @groups - default attributes for the root device
++ *
++ * All 'system' subsystems have a /sys/devices/system/<name> root device
++ * with the name of the subsystem. The root device can carry subsystem-
++ * wide attributes. All registered devices are below this single root
++ * device and are named after the subsystem with a simple enumeration
++ * number appended. The registered devices are not explicitely named;
++ * only 'id' in the device needs to be set.
++ *
++ * Do not use this interface for anything new, it exists for compatibility
++ * with bad ideas only. New subsystems should use plain subsystems; and
++ * add the subsystem-wide attributes should be added to the subsystem
++ * directory itself and not some create fake root-device placed in
++ * /sys/devices/system/<name>.
++ */
++int subsys_system_register(struct bus_type *subsys,
++ const struct attribute_group **groups)
++{
++ struct device *dev;
++ int err;
++
++ err = bus_register(subsys);
++ if (err < 0)
++ return err;
++
++ dev = kzalloc(sizeof(struct device), GFP_KERNEL);
++ if (!dev) {
++ err = -ENOMEM;
++ goto err_dev;
++ }
++
++ err = dev_set_name(dev, "%s", subsys->name);
++ if (err < 0)
++ goto err_name;
++
++ dev->kobj.parent = &system_kset->kobj;
++ dev->groups = groups;
++ dev->release = system_root_device_release;
++
++ err = device_register(dev);
++ if (err < 0)
++ goto err_dev_reg;
++
++ subsys->dev_root = dev;
++ return 0;
++
++err_dev_reg:
++ put_device(dev);
++ dev = NULL;
++err_name:
++ kfree(dev);
++err_dev:
++ bus_unregister(subsys);
++ return err;
++}
++EXPORT_SYMBOL_GPL(subsys_system_register);
++
+ int __init buses_init(void)
+ {
+ bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL);
+ if (!bus_kset)
+ return -ENOMEM;
++
++ system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj);
++ if (!system_kset)
++ return -ENOMEM;
++
+ return 0;
+ }
+diff --git a/drivers/base/class.c b/drivers/base/class.c
+index 4f1df2e..7dd06d7 100644
+--- a/drivers/base/class.c
++++ b/drivers/base/class.c
+@@ -171,9 +171,9 @@ int __class_register(struct class *cls, struct lock_class_key *key)
+ if (!cp)
+ return -ENOMEM;
+ klist_init(&cp->klist_devices, klist_class_dev_get, klist_class_dev_put);
+- INIT_LIST_HEAD(&cp->class_interfaces);
++ INIT_LIST_HEAD(&cp->interfaces);
+ kset_init(&cp->glue_dirs);
+- __mutex_init(&cp->class_mutex, "struct class mutex", key);
++ __mutex_init(&cp->mutex, "subsys mutex", key);
+ error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name);
+ if (error) {
+ kfree(cp);
+@@ -447,15 +447,15 @@ int class_interface_register(struct class_interface *class_intf)
+ if (!parent)
+ return -EINVAL;
+
+- mutex_lock(&parent->p->class_mutex);
+- list_add_tail(&class_intf->node, &parent->p->class_interfaces);
++ mutex_lock(&parent->p->mutex);
++ list_add_tail(&class_intf->node, &parent->p->interfaces);
+ if (class_intf->add_dev) {
+ class_dev_iter_init(&iter, parent, NULL, NULL);
+ while ((dev = class_dev_iter_next(&iter)))
+ class_intf->add_dev(dev, class_intf);
+ class_dev_iter_exit(&iter);
+ }
+- mutex_unlock(&parent->p->class_mutex);
++ mutex_unlock(&parent->p->mutex);
+
+ return 0;
+ }
+@@ -469,7 +469,7 @@ void class_interface_unregister(struct class_interface *class_intf)
+ if (!parent)
+ return;
+
+- mutex_lock(&parent->p->class_mutex);
++ mutex_lock(&parent->p->mutex);
+ list_del_init(&class_intf->node);
+ if (class_intf->remove_dev) {
+ class_dev_iter_init(&iter, parent, NULL, NULL);
+@@ -477,7 +477,7 @@ void class_interface_unregister(struct class_interface *class_intf)
+ class_intf->remove_dev(dev, class_intf);
+ class_dev_iter_exit(&iter);
+ }
+- mutex_unlock(&parent->p->class_mutex);
++ mutex_unlock(&parent->p->mutex);
+
+ class_put(parent);
+ }
+diff --git a/drivers/base/core.c b/drivers/base/core.c
+index d13851c..25f4192 100644
+--- a/drivers/base/core.c
++++ b/drivers/base/core.c
+@@ -118,6 +118,56 @@ static const struct sysfs_ops dev_sysfs_ops = {
+ .store = dev_attr_store,
+ };
+
++#define to_ext_attr(x) container_of(x, struct dev_ext_attribute, attr)
++
++ssize_t device_store_ulong(struct device *dev,
++ struct device_attribute *attr,
++ const char *buf, size_t size)
++{
++ struct dev_ext_attribute *ea = to_ext_attr(attr);
++ char *end;
++ unsigned long new = simple_strtoul(buf, &end, 0);
++ if (end == buf)
++ return -EINVAL;
++ *(unsigned long *)(ea->var) = new;
++ /* Always return full write size even if we didn't consume all */
++ return size;
++}
++EXPORT_SYMBOL_GPL(device_store_ulong);
++
++ssize_t device_show_ulong(struct device *dev,
++ struct device_attribute *attr,
++ char *buf)
++{
++ struct dev_ext_attribute *ea = to_ext_attr(attr);
++ return snprintf(buf, PAGE_SIZE, "%lx\n", *(unsigned long *)(ea->var));
++}
++EXPORT_SYMBOL_GPL(device_show_ulong);
++
++ssize_t device_store_int(struct device *dev,
++ struct device_attribute *attr,
++ const char *buf, size_t size)
++{
++ struct dev_ext_attribute *ea = to_ext_attr(attr);
++ char *end;
++ long new = simple_strtol(buf, &end, 0);
++ if (end == buf || new > INT_MAX || new < INT_MIN)
++ return -EINVAL;
++ *(int *)(ea->var) = new;
++ /* Always return full write size even if we didn't consume all */
++ return size;
++}
++EXPORT_SYMBOL_GPL(device_store_int);
++
++ssize_t device_show_int(struct device *dev,
++ struct device_attribute *attr,
++ char *buf)
++{
++ struct dev_ext_attribute *ea = to_ext_attr(attr);
++
++ return snprintf(buf, PAGE_SIZE, "%d\n", *(int *)(ea->var));
++}
++EXPORT_SYMBOL_GPL(device_show_int);
+
+ /**
+ * device_release - free device structure.
+@@ -464,7 +514,7 @@ static ssize_t show_dev(struct device *dev, struct device_attribute *attr,
+ static struct device_attribute devt_attr =
+ __ATTR(dev, S_IRUGO, show_dev, NULL);
+
+-/* kset to create /sys/devices/ */
++/* /sys/devices/ */
+ struct kset *devices_kset;
+
+ /**
+@@ -711,6 +761,10 @@ static struct kobject *get_device_parent(struct device *dev,
+ return k;
+ }
+
++ /* subsystems can specify a default root directory for their devices */
++ if (!parent && dev->bus && dev->bus->dev_root)
++ return &dev->bus->dev_root->kobj;
++
+ if (parent)
+ return &parent->kobj;
+ return NULL;
+@@ -731,14 +785,6 @@ static void cleanup_device_parent(struct device *dev)
+ cleanup_glue_dir(dev, dev->kobj.parent);
+ }
+
+-static void setup_parent(struct device *dev, struct device *parent)
+-{
+- struct kobject *kobj;
+- kobj = get_device_parent(dev, parent);
+- if (kobj)
+- dev->kobj.parent = kobj;
+-}
+-
+ static int device_add_class_symlinks(struct device *dev)
+ {
+ int error;
+@@ -891,6 +937,7 @@ int device_private_init(struct device *dev)
+ int device_add(struct device *dev)
+ {
+ struct device *parent = NULL;
++ struct kobject *kobj;
+ struct class_interface *class_intf;
+ int error = -EINVAL;
+
+@@ -914,6 +961,10 @@ int device_add(struct device *dev)
+ dev->init_name = NULL;
+ }
+
++ /* subsystems can specify simple device enumeration */
++ if (!dev_name(dev) && dev->bus && dev->bus->dev_name)
++ dev_set_name(dev, "%s%u", dev->bus->dev_name, dev->id);
++
+ if (!dev_name(dev)) {
+ error = -EINVAL;
+ goto name_error;
+@@ -922,7 +973,9 @@ int device_add(struct device *dev)
+ pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
+
+ parent = get_device(dev->parent);
+- setup_parent(dev, parent);
++ kobj = get_device_parent(dev, parent);
++ if (kobj)
++ dev->kobj.parent = kobj;
+
+ /* use parent numa_node */
+ if (parent)
+@@ -982,17 +1035,17 @@ int device_add(struct device *dev)
+ &parent->p->klist_children);
+
+ if (dev->class) {
+- mutex_lock(&dev->class->p->class_mutex);
++ mutex_lock(&dev->class->p->mutex);
+ /* tie the class to the device */
+ klist_add_tail(&dev->knode_class,
+ &dev->class->p->klist_devices);
+
+ /* notify any interfaces that the device is here */
+ list_for_each_entry(class_intf,
+- &dev->class->p->class_interfaces, node)
++ &dev->class->p->interfaces, node)
+ if (class_intf->add_dev)
+ class_intf->add_dev(dev, class_intf);
+- mutex_unlock(&dev->class->p->class_mutex);
++ mutex_unlock(&dev->class->p->mutex);
+ }
+ done:
+ put_device(dev);
+@@ -1107,15 +1160,15 @@ void device_del(struct device *dev)
+ if (dev->class) {
+ device_remove_class_symlinks(dev);
+
+- mutex_lock(&dev->class->p->class_mutex);
++ mutex_lock(&dev->class->p->mutex);
+ /* notify any interfaces that the device is now gone */
+ list_for_each_entry(class_intf,
+- &dev->class->p->class_interfaces, node)
++ &dev->class->p->interfaces, node)
+ if (class_intf->remove_dev)
+ class_intf->remove_dev(dev, class_intf);
+ /* remove the device from the class list */
+ klist_del(&dev->knode_class);
+- mutex_unlock(&dev->class->p->class_mutex);
++ mutex_unlock(&dev->class->p->mutex);
+ }
+ device_remove_file(dev, &uevent_attr);
+ device_remove_attrs(dev);
+diff --git a/drivers/base/init.c b/drivers/base/init.c
+index c8a934e..c16f0b8 100644
+--- a/drivers/base/init.c
++++ b/drivers/base/init.c
+@@ -31,7 +31,6 @@ void __init driver_init(void)
+ * core core pieces.
+ */
+ platform_bus_init();
+- system_bus_init();
+ cpu_dev_init();
+ memory_dev_init();
+ }
+diff --git a/drivers/base/sys.c b/drivers/base/sys.c
+index 9dff77b..409f5ce 100644
+--- a/drivers/base/sys.c
++++ b/drivers/base/sys.c
+@@ -126,7 +126,7 @@ void sysdev_class_remove_file(struct sysdev_class *c,
+ }
+ EXPORT_SYMBOL_GPL(sysdev_class_remove_file);
+
+-static struct kset *system_kset;
++extern struct kset *system_kset;
+
+ int sysdev_class_register(struct sysdev_class *cls)
+ {
+@@ -331,14 +331,6 @@ void sysdev_unregister(struct sys_device *sysdev)
+ EXPORT_SYMBOL_GPL(sysdev_register);
+ EXPORT_SYMBOL_GPL(sysdev_unregister);
+
+-int __init system_bus_init(void)
+-{
+- system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj);
+- if (!system_kset)
+- return -ENOMEM;
+- return 0;
+-}
+-
+ #define to_ext_attr(x) container_of(x, struct sysdev_ext_attribute, attr)
+
+ ssize_t sysdev_store_ulong(struct sys_device *sysdev,
+diff --git a/include/linux/device.h b/include/linux/device.h
+index e4f62d8..0aa0b62 100644
+--- a/include/linux/device.h
++++ b/include/linux/device.h
+@@ -51,6 +51,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
+ * struct bus_type - The bus type of the device
+ *
+ * @name: The name of the bus.
++ * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
++ * @dev_root: Default device to use as the parent.
+ * @bus_attrs: Default attributes of the bus.
+ * @dev_attrs: Default attributes of the devices on the bus.
+ * @drv_attrs: Default attributes of the device drivers on the bus.
+@@ -81,6 +83,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
+ */
+ struct bus_type {
+ const char *name;
++ const char *dev_name;
++ struct device *dev_root;
+ struct bus_attribute *bus_attrs;
+ struct device_attribute *dev_attrs;
+ struct driver_attribute *drv_attrs;
+@@ -99,12 +103,30 @@ struct bus_type {
+ struct subsys_private *p;
+ };
+
+-extern int __must_check bus_register(struct bus_type *bus);
++/* This is a #define to keep the compiler from merging different
++ * instances of the __key variable */
++#define bus_register(subsys) \
++({ \
++ static struct lock_class_key __key; \
++ __bus_register(subsys, &__key); \
++})
++extern int __must_check __bus_register(struct bus_type *bus,
++ struct lock_class_key *key);
+ extern void bus_unregister(struct bus_type *bus);
+
+ extern int __must_check bus_rescan_devices(struct bus_type *bus);
+
+ /* iterator helpers for buses */
++struct subsys_dev_iter {
++ struct klist_iter ki;
++ const struct device_type *type;
++};
++void subsys_dev_iter_init(struct subsys_dev_iter *iter,
++ struct bus_type *subsys,
++ struct device *start,
++ const struct device_type *type);
++struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
++void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
+
+ int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
+ int (*fn)(struct device *dev, void *data));
+@@ -114,10 +136,10 @@ struct device *bus_find_device(struct bus_type *bus, struct device *start,
+ struct device *bus_find_device_by_name(struct bus_type *bus,
+ struct device *start,
+ const char *name);
+-
++struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
++ struct device *hint);
+ int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
+ void *data, int (*fn)(struct device_driver *, void *));
+-
+ void bus_sort_breadthfirst(struct bus_type *bus,
+ int (*compare)(const struct device *a,
+ const struct device *b));
+@@ -249,6 +271,33 @@ struct device *driver_find_device(struct device_driver *drv,
+ int (*match)(struct device *dev, void *data));
+
+ /**
++ * struct subsys_interface - interfaces to device functions
++ * @name name of the device function
++ * @subsystem subsytem of the devices to attach to
++ * @node the list of functions registered at the subsystem
++ * @add device hookup to device function handler
++ * @remove device hookup to device function handler
++ *
++ * Simple interfaces attached to a subsystem. Multiple interfaces can
++ * attach to a subsystem and its devices. Unlike drivers, they do not
++ * exclusively claim or control devices. Interfaces usually represent
++ * a specific functionality of a subsystem/class of devices.
++ */
++struct subsys_interface {
++ const char *name;
++ struct bus_type *subsys;
++ struct list_head node;
++ int (*add_dev)(struct device *dev, struct subsys_interface *sif);
++ int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
++};
++
++int subsys_interface_register(struct subsys_interface *sif);
++void subsys_interface_unregister(struct subsys_interface *sif);
++
++int subsys_system_register(struct bus_type *subsys,
++ const struct attribute_group **groups);
++
++/**
+ * struct class - device classes
+ * @name: Name of the class.
+ * @owner: The module owner.
+@@ -429,8 +478,28 @@ struct device_attribute {
+ const char *buf, size_t count);
+ };
+
++struct dev_ext_attribute {
++ struct device_attribute attr;
++ void *var;
++};
++
++ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
++ char *buf);
++ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
++ const char *buf, size_t count);
++ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
++ char *buf);
++ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
++ const char *buf, size_t count);
++
+ #define DEVICE_ATTR(_name, _mode, _show, _store) \
+-struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
++ struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
++#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
++ struct dev_ext_attribute dev_attr_##_name = \
++ { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
++#define DEVICE_INT_ATTR(_name, _mode, _var) \
++ struct dev_ext_attribute dev_attr_##_name = \
++ { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
+
+ extern int __must_check device_create_file(struct device *device,
+ const struct device_attribute *entry);
+@@ -591,6 +660,7 @@ struct device {
+ struct device_node *of_node; /* associated device tree node */
+
+ dev_t devt; /* dev_t, creates the sysfs "dev" */
++ u32 id; /* device instance */
+
+ spinlock_t devres_lock;
+ struct list_head devres_head;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0030-sh-intc-Allow-triggering-on-both-edges-for-ARM-SoCs.patch b/patches.armadillo800eva/0030-sh-intc-Allow-triggering-on-both-edges-for-ARM-SoCs.patch
new file mode 100644
index 00000000000000..ec13f1f4925a56
--- /dev/null
+++ b/patches.armadillo800eva/0030-sh-intc-Allow-triggering-on-both-edges-for-ARM-SoCs.patch
@@ -0,0 +1,34 @@
+From 5550b1a3a4608fddc90dcb515bf6d37d2b583444 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 12 Oct 2011 16:21:08 +0900
+Subject: sh: intc: Allow triggering on both edges for ARM SoCs
+
+Enable IRQ_TYPE_EDGE_BOTH on all R/SH-Mobile ARM SoCs.
+This hardware feature is supported by sh7367, sh7377,
+sh7372 and sh73a0.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 7d377b170ae0d4df7692f50c9609bea385fe87cc)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/chip.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
+index e0ada37..7b246ef 100644
+--- a/drivers/sh/intc/chip.c
++++ b/drivers/sh/intc/chip.c
+@@ -186,7 +186,7 @@ static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = {
+ !defined(CONFIG_CPU_SUBTYPE_SH7709)
+ [IRQ_TYPE_LEVEL_HIGH] = VALID(3),
+ #endif
+-#if defined(CONFIG_ARCH_SH7372)
++#if defined(CONFIG_ARM) /* all recent SH-Mobile / R-Mobile ARM support this */
+ [IRQ_TYPE_EDGE_BOTH] = VALID(4),
+ #endif
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0031-sh-intc-convert-sysdev_class-to-a-regular-subsystem.patch b/patches.armadillo800eva/0031-sh-intc-convert-sysdev_class-to-a-regular-subsystem.patch
new file mode 100644
index 00000000000000..18a9257da60825
--- /dev/null
+++ b/patches.armadillo800eva/0031-sh-intc-convert-sysdev_class-to-a-regular-subsystem.patch
@@ -0,0 +1,183 @@
+From 8d126bb8929dba08753fdc1acb217f20a3c4ae43 Mon Sep 17 00:00:00 2001
+From: Kay Sievers <kay.sievers@vrfy.org>
+Date: Wed, 21 Dec 2011 15:09:52 -0800
+Subject: sh: intc - convert sysdev_class to a regular subsystem
+
+After all sysdev classes are ported to regular driver core entities, the
+sysdev implementation will be entirely removed from the kernel.
+
+Cc: Paul Mundt <lethal@linux-sh.org>
+Cc: Magnus Damm <magnus.damm@gmail.com>
+Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
+Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+(cherry picked from commit f4e73bfcd9cca0b64cc8096175852936fb1d111f)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/core.c | 29 +++++++++++++++--------------
+ drivers/sh/intc/internals.h | 6 +++---
+ drivers/sh/intc/userimask.c | 16 ++++++++--------
+ 3 files changed, 26 insertions(+), 25 deletions(-)
+
+diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
+index 8b7a141..e85512d 100644
+--- a/drivers/sh/intc/core.c
++++ b/drivers/sh/intc/core.c
+@@ -25,7 +25,7 @@
+ #include <linux/stat.h>
+ #include <linux/interrupt.h>
+ #include <linux/sh_intc.h>
+-#include <linux/sysdev.h>
++#include <linux/device.h>
+ #include <linux/syscore_ops.h>
+ #include <linux/list.h>
+ #include <linux/spinlock.h>
+@@ -434,46 +434,47 @@ struct syscore_ops intc_syscore_ops = {
+ .resume = intc_resume,
+ };
+
+-struct sysdev_class intc_sysdev_class = {
++struct bus_type intc_subsys = {
+ .name = "intc",
++ .dev_name = "intc",
+ };
+
+ static ssize_t
+-show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf)
++show_intc_name(struct device *dev, struct device_attribute *attr, char *buf)
+ {
+ struct intc_desc_int *d;
+
+- d = container_of(dev, struct intc_desc_int, sysdev);
++ d = container_of(dev, struct intc_desc_int, dev);
+
+ return sprintf(buf, "%s\n", d->chip.name);
+ }
+
+-static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL);
++static DEVICE_ATTR(name, S_IRUGO, show_intc_name, NULL);
+
+-static int __init register_intc_sysdevs(void)
++static int __init register_intc_devs(void)
+ {
+ struct intc_desc_int *d;
+ int error;
+
+ register_syscore_ops(&intc_syscore_ops);
+
+- error = sysdev_class_register(&intc_sysdev_class);
++ error = subsys_system_register(&intc_subsys, NULL);
+ if (!error) {
+ list_for_each_entry(d, &intc_list, list) {
+- d->sysdev.id = d->index;
+- d->sysdev.cls = &intc_sysdev_class;
+- error = sysdev_register(&d->sysdev);
++ d->dev.id = d->index;
++ d->dev.bus = &intc_subsys;
++ error = device_register(&d->dev);
+ if (error == 0)
+- error = sysdev_create_file(&d->sysdev,
+- &attr_name);
++ error = device_create_file(&d->dev,
++ &dev_attr_name);
+ if (error)
+ break;
+ }
+ }
+
+ if (error)
+- pr_err("sysdev registration error\n");
++ pr_err("device registration error\n");
+
+ return error;
+ }
+-device_initcall(register_intc_sysdevs);
++device_initcall(register_intc_devs);
+diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
+index 5b93485..1c2722e 100644
+--- a/drivers/sh/intc/internals.h
++++ b/drivers/sh/intc/internals.h
+@@ -4,7 +4,7 @@
+ #include <linux/kernel.h>
+ #include <linux/types.h>
+ #include <linux/radix-tree.h>
+-#include <linux/sysdev.h>
++#include <linux/device.h>
+
+ #define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
+ ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
+@@ -51,7 +51,7 @@ struct intc_subgroup_entry {
+
+ struct intc_desc_int {
+ struct list_head list;
+- struct sys_device sysdev;
++ struct device dev;
+ struct radix_tree_root tree;
+ raw_spinlock_t lock;
+ unsigned int index;
+@@ -157,7 +157,7 @@ void _intc_enable(struct irq_data *data, unsigned long handle);
+ extern struct list_head intc_list;
+ extern raw_spinlock_t intc_big_lock;
+ extern unsigned int nr_intc_controllers;
+-extern struct sysdev_class intc_sysdev_class;
++extern struct bus_type intc_subsys;
+
+ unsigned int intc_get_dfl_prio_level(void);
+ unsigned int intc_get_prio_level(unsigned int irq);
+diff --git a/drivers/sh/intc/userimask.c b/drivers/sh/intc/userimask.c
+index 56bf933..e649cea 100644
+--- a/drivers/sh/intc/userimask.c
++++ b/drivers/sh/intc/userimask.c
+@@ -10,7 +10,7 @@
+ #define pr_fmt(fmt) "intc: " fmt
+
+ #include <linux/errno.h>
+-#include <linux/sysdev.h>
++#include <linux/device.h>
+ #include <linux/init.h>
+ #include <linux/io.h>
+ #include <linux/stat.h>
+@@ -20,15 +20,15 @@
+ static void __iomem *uimask;
+
+ static ssize_t
+-show_intc_userimask(struct sysdev_class *cls,
+- struct sysdev_class_attribute *attr, char *buf)
++show_intc_userimask(struct device *dev,
++ struct device_attribute *attr, char *buf)
+ {
+ return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf);
+ }
+
+ static ssize_t
+-store_intc_userimask(struct sysdev_class *cls,
+- struct sysdev_class_attribute *attr,
++store_intc_userimask(struct device *dev,
++ struct device_attribute *attr,
+ const char *buf, size_t count)
+ {
+ unsigned long level;
+@@ -55,8 +55,8 @@ store_intc_userimask(struct sysdev_class *cls,
+ return count;
+ }
+
+-static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR,
+- show_intc_userimask, store_intc_userimask);
++static DEVICE_ATTR(userimask, S_IRUSR | S_IWUSR,
++ show_intc_userimask, store_intc_userimask);
+
+
+ static int __init userimask_sysdev_init(void)
+@@ -64,7 +64,7 @@ static int __init userimask_sysdev_init(void)
+ if (unlikely(!uimask))
+ return -ENXIO;
+
+- return sysdev_class_create_file(&intc_sysdev_class, &attr_userimask);
++ return device_create_file(intc_subsys.dev_root, &dev_attr_userimask);
+ }
+ late_initcall(userimask_sysdev_init);
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0032-PM-shmobile-Don-t-include-SH7372-s-INTCS-in-syscore-.patch b/patches.armadillo800eva/0032-PM-shmobile-Don-t-include-SH7372-s-INTCS-in-syscore-.patch
new file mode 100644
index 00000000000000..e7a2221556cda6
--- /dev/null
+++ b/patches.armadillo800eva/0032-PM-shmobile-Don-t-include-SH7372-s-INTCS-in-syscore-.patch
@@ -0,0 +1,103 @@
+From 7e0208976896549c601b52ee1125ab1e5c036841 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rjw@sisk.pl>
+Date: Fri, 23 Dec 2011 01:23:30 +0100
+Subject: PM / shmobile: Don't include SH7372's INTCS in syscore
+ suspend/resume
+
+Since the SH7372's INTCS in included into syscore suspend/resume,
+which causes the chip to be accessed when PM domains have been
+turned off during system suspend, the A4R domain containing the
+INTCS has to stay on during system sleep, which is suboptimal
+from the power consumption point of view.
+
+For this reason, add a new INTC flag, skip_syscore_suspend, to mark
+the INTCS for intc_suspend() and intc_resume(), so that they don't
+touch it. This allows the A4R domain to be turned off during
+system suspend and the INTCS state is resrored during system
+resume by the A4R's "power on" code.
+
+Suggested-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+Acked-by: Magnus Damm <damm@opensource.se>
+(cherry picked from commit 0f966d74cf77a9140a025464a287e1d2fee8a1fc)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/intc-sh7372.c | 1 +
+ drivers/sh/intc/core.c | 8 ++++++++
+ drivers/sh/intc/internals.h | 1 +
+ include/linux/sh_intc.h | 1 +
+ 4 files changed, 11 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
+index 3b28743..1d4c332 100644
+--- a/arch/arm/mach-shmobile/intc-sh7372.c
++++ b/arch/arm/mach-shmobile/intc-sh7372.c
+@@ -593,6 +593,7 @@ static struct resource intcs_resources[] __initdata = {
+ static struct intc_desc intcs_desc __initdata = {
+ .name = "sh7372-intcs",
+ .force_enable = ENABLED_INTCS,
++ .skip_syscore_suspend = true,
+ .resource = intcs_resources,
+ .num_resources = ARRAY_SIZE(intcs_resources),
+ .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers,
+diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
+index e85512d..e53e449 100644
+--- a/drivers/sh/intc/core.c
++++ b/drivers/sh/intc/core.c
+@@ -354,6 +354,8 @@ int __init register_intc_controller(struct intc_desc *desc)
+ if (desc->force_enable)
+ intc_enable_disable_enum(desc, d, desc->force_enable, 1);
+
++ d->skip_suspend = desc->skip_syscore_suspend;
++
+ nr_intc_controllers++;
+
+ return 0;
+@@ -386,6 +388,9 @@ static int intc_suspend(void)
+ list_for_each_entry(d, &intc_list, list) {
+ int irq;
+
++ if (d->skip_suspend)
++ continue;
++
+ /* enable wakeup irqs belonging to this intc controller */
+ for_each_active_irq(irq) {
+ struct irq_data *data;
+@@ -409,6 +414,9 @@ static void intc_resume(void)
+ list_for_each_entry(d, &intc_list, list) {
+ int irq;
+
++ if (d->skip_suspend)
++ continue;
++
+ for_each_active_irq(irq) {
+ struct irq_data *data;
+ struct irq_chip *chip;
+diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
+index 1c2722e..b0e9155 100644
+--- a/drivers/sh/intc/internals.h
++++ b/drivers/sh/intc/internals.h
+@@ -67,6 +67,7 @@ struct intc_desc_int {
+ struct intc_window *window;
+ unsigned int nr_windows;
+ struct irq_chip chip;
++ bool skip_suspend;
+ };
+
+
+diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
+index 5812fef..b160645 100644
+--- a/include/linux/sh_intc.h
++++ b/include/linux/sh_intc.h
+@@ -95,6 +95,7 @@ struct intc_desc {
+ unsigned int num_resources;
+ intc_enum force_enable;
+ intc_enum force_disable;
++ bool skip_syscore_suspend;
+ struct intc_hw_desc hw;
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0033-sh-intc-unify-evt2irq-irq2evt-macros-for-sh-and-arm.patch b/patches.armadillo800eva/0033-sh-intc-unify-evt2irq-irq2evt-macros-for-sh-and-arm.patch
new file mode 100644
index 00000000000000..dee5878f0e23a5
--- /dev/null
+++ b/patches.armadillo800eva/0033-sh-intc-unify-evt2irq-irq2evt-macros-for-sh-and-arm.patch
@@ -0,0 +1,103 @@
+From ebb93e3de0af2a5240e6e427ed43bd74d8220da3 Mon Sep 17 00:00:00 2001
+From: Rob Herring <rob.herring@calxeda.com>
+Date: Tue, 17 Jan 2012 11:20:23 -0600
+Subject: sh: intc: unify evt2irq/irq2evt macros for sh and arm
+
+Move evt2irq and irq2evt macros definitions out of sh and arm includes
+into a common location.
+
+Signed-off-by: Rob Herring <rob.herring@calxeda.com>
+(cherry picked from commit 7f1e76370b717be264f0af54719182a96fb8f36d)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/Kconfig | 4 ++++
+ arch/arm/mach-shmobile/include/mach/irqs.h | 6 ++----
+ arch/sh/include/asm/irq.h | 11 -----------
+ include/linux/sh_intc.h | 11 +++++++++++
+ 4 files changed, 17 insertions(+), 15 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index 0c8f6cf..5dc5393 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -71,6 +71,10 @@ config MACH_MACKEREL
+
+ comment "SH-Mobile System Configuration"
+
++config CPU_HAS_INTEVT
++ bool
++ default y
++
+ menu "Memory configuration"
+
+ config MEMORY_START
+diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
+index dcb714f..828807d 100644
+--- a/arch/arm/mach-shmobile/include/mach/irqs.h
++++ b/arch/arm/mach-shmobile/include/mach/irqs.h
+@@ -1,15 +1,13 @@
+ #ifndef __ASM_MACH_IRQS_H
+ #define __ASM_MACH_IRQS_H
+
++#include <linux/sh_intc.h>
++
+ #define NR_IRQS 1024
+
+ /* GIC */
+ #define gic_spi(nr) ((nr) + 32)
+
+-/* INTCA */
+-#define evt2irq(evt) (((evt) >> 5) - 16)
+-#define irq2evt(irq) (((irq) + 16) << 5)
+-
+ /* INTCS */
+ #define INTCS_VECT_BASE 0x2200
+ #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
+diff --git a/arch/sh/include/asm/irq.h b/arch/sh/include/asm/irq.h
+index 45d08b6..2a62017 100644
+--- a/arch/sh/include/asm/irq.h
++++ b/arch/sh/include/asm/irq.h
+@@ -21,17 +21,6 @@
+ #define NO_IRQ_IGNORE ((unsigned int)-1)
+
+ /*
+- * Convert back and forth between INTEVT and IRQ values.
+- */
+-#ifdef CONFIG_CPU_HAS_INTEVT
+-#define evt2irq(evt) (((evt) >> 5) - 16)
+-#define irq2evt(irq) (((irq) + 16) << 5)
+-#else
+-#define evt2irq(evt) (evt)
+-#define irq2evt(irq) (irq)
+-#endif
+-
+-/*
+ * Simple Mask Register Support
+ */
+ extern void make_maskreg_irq(unsigned int irq);
+diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
+index b160645..e1a2ac5 100644
+--- a/include/linux/sh_intc.h
++++ b/include/linux/sh_intc.h
+@@ -3,6 +3,17 @@
+
+ #include <linux/ioport.h>
+
++/*
++ * Convert back and forth between INTEVT and IRQ values.
++ */
++#ifdef CONFIG_CPU_HAS_INTEVT
++#define evt2irq(evt) (((evt) >> 5) - 16)
++#define irq2evt(irq) (((irq) + 16) << 5)
++#else
++#define evt2irq(evt) (evt)
++#define irq2evt(irq) (irq)
++#endif
++
+ typedef unsigned char intc_enum;
+
+ struct intc_vect {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0034-sh-intc-Make-global-intc-controller-counter-static.patch b/patches.armadillo800eva/0034-sh-intc-Make-global-intc-controller-counter-static.patch
new file mode 100644
index 00000000000000..73fdf1f06fe874
--- /dev/null
+++ b/patches.armadillo800eva/0034-sh-intc-Make-global-intc-controller-counter-static.patch
@@ -0,0 +1,44 @@
+From 244c93c2981f90963867b50a8ab5abd6d2206c02 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 24 Jan 2012 14:07:18 +0900
+Subject: sh: intc: Make global intc controller counter static.
+
+No need to expose this globally since it's only used for core accounting.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 5fbebcbdb3730666c0d1d22021a90d8483fc8e02)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/core.c | 2 +-
+ drivers/sh/intc/internals.h | 1 -
+ 2 files changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
+index e53e449..c64690d 100644
+--- a/drivers/sh/intc/core.c
++++ b/drivers/sh/intc/core.c
+@@ -35,7 +35,7 @@
+
+ LIST_HEAD(intc_list);
+ DEFINE_RAW_SPINLOCK(intc_big_lock);
+-unsigned int nr_intc_controllers;
++static unsigned int nr_intc_controllers;
+
+ /*
+ * Default priority level
+diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
+index b0e9155..422b72d 100644
+--- a/drivers/sh/intc/internals.h
++++ b/drivers/sh/intc/internals.h
+@@ -157,7 +157,6 @@ void _intc_enable(struct irq_data *data, unsigned long handle);
+ /* core.c */
+ extern struct list_head intc_list;
+ extern raw_spinlock_t intc_big_lock;
+-extern unsigned int nr_intc_controllers;
+ extern struct bus_type intc_subsys;
+
+ unsigned int intc_get_dfl_prio_level(void);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0035-genirq-Add-IRQCHIP_SKIP_SET_WAKE-flag.patch b/patches.armadillo800eva/0035-genirq-Add-IRQCHIP_SKIP_SET_WAKE-flag.patch
new file mode 100644
index 00000000000000..b2be35f6aeded5
--- /dev/null
+++ b/patches.armadillo800eva/0035-genirq-Add-IRQCHIP_SKIP_SET_WAKE-flag.patch
@@ -0,0 +1,56 @@
+From 50a1e187e9f7fda82dcdcc323fc794b6c233cea2 Mon Sep 17 00:00:00 2001
+From: Santosh Shilimkar <santosh.shilimkar@ti.com>
+Date: Fri, 9 Sep 2011 13:59:35 +0530
+Subject: genirq: Add IRQCHIP_SKIP_SET_WAKE flag
+
+Some irq chips need the irq_set_wake() functionality, but do not
+require a irq_set_wake() callback. Instead of forcing an empty
+callback to be implemented add a flag which notes this fact. Check for
+the flag in set_irq_wake_real() and return success when set.
+
+Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+(cherry picked from commit 60f96b41f71d2a13d1c0a457b8b77958f77142d1)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ include/linux/irq.h | 2 ++
+ kernel/irq/manage.c | 3 +++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/include/linux/irq.h b/include/linux/irq.h
+index baa397e..094c211 100644
+--- a/include/linux/irq.h
++++ b/include/linux/irq.h
+@@ -334,12 +334,14 @@ struct irq_chip {
+ * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path
+ * IRQCHIP_ONOFFLINE_ENABLED: Only call irq_on/off_line callbacks
+ * when irq enabled
++ * IRQCHIP_SKIP_SET_WAKE: Skip chip.irq_set_wake(), for this irq chip
+ */
+ enum {
+ IRQCHIP_SET_TYPE_MASKED = (1 << 0),
+ IRQCHIP_EOI_IF_HANDLED = (1 << 1),
+ IRQCHIP_MASK_ON_SUSPEND = (1 << 2),
+ IRQCHIP_ONOFFLINE_ENABLED = (1 << 3),
++ IRQCHIP_SKIP_SET_WAKE = (1 << 4),
+ };
+
+ /* This include will go away once we isolated irq_desc usage to core code */
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
+index df8136f..bbc6a35 100644
+--- a/kernel/irq/manage.c
++++ b/kernel/irq/manage.c
+@@ -467,6 +467,9 @@ static int set_irq_wake_real(unsigned int irq, unsigned int on)
+ struct irq_desc *desc = irq_to_desc(irq);
+ int ret = -ENXIO;
+
++ if (irq_desc_get_chip(desc)->flags & IRQCHIP_SKIP_SET_WAKE)
++ return 0;
++
+ if (desc->irq_data.chip->irq_set_wake)
+ ret = desc->irq_data.chip->irq_set_wake(&desc->irq_data, on);
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0036-sh-intc-Prefer-IRQCHIP_SKIP_SET_WAKE-over-a-dummy-se.patch b/patches.armadillo800eva/0036-sh-intc-Prefer-IRQCHIP_SKIP_SET_WAKE-over-a-dummy-se.patch
new file mode 100644
index 00000000000000..95b94958c5fe36
--- /dev/null
+++ b/patches.armadillo800eva/0036-sh-intc-Prefer-IRQCHIP_SKIP_SET_WAKE-over-a-dummy-se.patch
@@ -0,0 +1,47 @@
+From 75ffa33fd0ae04b4c8a3c7684934993ae1c9a4af Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 24 Jan 2012 14:54:10 +0900
+Subject: sh: intc: Prefer IRQCHIP_SKIP_SET_WAKE over a dummy set_wake
+ callback.
+
+It's possible to use IRQCHIP_SKIP_SET_WAKE to get the behaviour that
+we're after, without having to bother with a dummy ->set_wake() callback
+for the IRQ chip.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 5bbda4e4aca4591c85ee53dea157ca5fc9a23306)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/chip.c | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
+index 7b246ef..3679645 100644
+--- a/drivers/sh/intc/chip.c
++++ b/drivers/sh/intc/chip.c
+@@ -58,11 +58,6 @@ static void intc_disable(struct irq_data *data)
+ }
+ }
+
+-static int intc_set_wake(struct irq_data *data, unsigned int on)
+-{
+- return 0; /* allow wakeup, but setup hardware in intc_suspend() */
+-}
+-
+ #ifdef CONFIG_SMP
+ /*
+ * This is held with the irq desc lock held, so we don't require any
+@@ -225,8 +220,8 @@ struct irq_chip intc_irq_chip = {
+ .irq_disable = intc_disable,
+ .irq_shutdown = intc_disable,
+ .irq_set_type = intc_set_type,
+- .irq_set_wake = intc_set_wake,
+ #ifdef CONFIG_SMP
+ .irq_set_affinity = intc_set_affinity,
+ #endif
++ .flags = IRQCHIP_SKIP_SET_WAKE,
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0037-sh-intc-Kill-off-superfluous-irq_shutdown-hooking.patch b/patches.armadillo800eva/0037-sh-intc-Kill-off-superfluous-irq_shutdown-hooking.patch
new file mode 100644
index 00000000000000..65638e676efbdd
--- /dev/null
+++ b/patches.armadillo800eva/0037-sh-intc-Kill-off-superfluous-irq_shutdown-hooking.patch
@@ -0,0 +1,30 @@
+From 2b12bb0269cb912d1a28d026e64d9f3d217529b3 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 24 Jan 2012 15:38:57 +0900
+Subject: sh: intc: Kill off superfluous irq_shutdown hooking.
+
+This already gets handled via disable, as per the notes in linux/irq.h.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 29775df10f02f614db870ff4acaf0b07dbed1547)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/chip.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
+index 3679645..d90cb7e 100644
+--- a/drivers/sh/intc/chip.c
++++ b/drivers/sh/intc/chip.c
+@@ -218,7 +218,6 @@ struct irq_chip intc_irq_chip = {
+ .irq_mask_ack = intc_mask_ack,
+ .irq_enable = intc_enable,
+ .irq_disable = intc_disable,
+- .irq_shutdown = intc_disable,
+ .irq_set_type = intc_set_type,
+ #ifdef CONFIG_SMP
+ .irq_set_affinity = intc_set_affinity,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0038-sh-intc-Use-IRQ_SET_MASK_OK_NOCOPY-for-intc_set_affi.patch b/patches.armadillo800eva/0038-sh-intc-Use-IRQ_SET_MASK_OK_NOCOPY-for-intc_set_affi.patch
new file mode 100644
index 00000000000000..7a520be80c991b
--- /dev/null
+++ b/patches.armadillo800eva/0038-sh-intc-Use-IRQ_SET_MASK_OK_NOCOPY-for-intc_set_affi.patch
@@ -0,0 +1,32 @@
+From a0cf2545f99677aff9d787a55ed16cd6aca479ba Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 24 Jan 2012 16:55:57 +0900
+Subject: sh: intc: Use IRQ_SET_MASK_OK_NOCOPY for intc_set_affinity.
+
+intc_set_affinity() updates the cpumask in place, so there's no need for
+the upper layer to do this itself.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 30377642138aadeef35a31c2f90dba0b6fa7b91a)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/chip.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
+index d90cb7e..db10adf 100644
+--- a/drivers/sh/intc/chip.c
++++ b/drivers/sh/intc/chip.c
+@@ -73,7 +73,7 @@ static int intc_set_affinity(struct irq_data *data,
+
+ cpumask_copy(data->affinity, cpumask);
+
+- return 0;
++ return IRQ_SET_MASK_OK_NOCOPY;
+ }
+ #endif
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0039-sh-intc-optimize-intc-IRQ-lookup.patch b/patches.armadillo800eva/0039-sh-intc-optimize-intc-IRQ-lookup.patch
new file mode 100644
index 00000000000000..5679c638fc891e
--- /dev/null
+++ b/patches.armadillo800eva/0039-sh-intc-optimize-intc-IRQ-lookup.patch
@@ -0,0 +1,135 @@
+From 61a82ab6b88ee55c811cecf0868713c3387e3ca3 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 24 Jan 2012 17:41:55 +0900
+Subject: sh: intc: optimize intc IRQ lookup
+
+This ensures that the sense/prio lists are sorted at registration time,
+enabling us to use a simple binary search for an optimized lookup
+(something that had been on the TODO for some time).
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit b59f9f9775e643435bba76e30e59e47c19c56dee)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/chip.c | 27 ++++++---------------------
+ drivers/sh/intc/core.c | 9 ++++++++-
+ drivers/sh/intc/internals.h | 8 ++++++++
+ 3 files changed, 22 insertions(+), 22 deletions(-)
+
+diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
+index db10adf..012df26 100644
+--- a/drivers/sh/intc/chip.c
++++ b/drivers/sh/intc/chip.c
+@@ -2,13 +2,14 @@
+ * IRQ chip definitions for INTC IRQs.
+ *
+ * Copyright (C) 2007, 2008 Magnus Damm
+- * Copyright (C) 2009, 2010 Paul Mundt
++ * Copyright (C) 2009 - 2012 Paul Mundt
+ *
+ * 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/cpumask.h>
++#include <linux/bsearch.h>
+ #include <linux/io.h>
+ #include "internals.h"
+
+@@ -117,28 +118,12 @@ static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp,
+ unsigned int nr_hp,
+ unsigned int irq)
+ {
+- int i;
+-
+- /*
+- * this doesn't scale well, but...
+- *
+- * this function should only be used for cerain uncommon
+- * operations such as intc_set_priority() and intc_set_type()
+- * and in those rare cases performance doesn't matter that much.
+- * keeping the memory footprint low is more important.
+- *
+- * one rather simple way to speed this up and still keep the
+- * memory footprint down is to make sure the array is sorted
+- * and then perform a bisect to lookup the irq.
+- */
+- for (i = 0; i < nr_hp; i++) {
+- if ((hp + i)->irq != irq)
+- continue;
++ struct intc_handle_int key;
+
+- return hp + i;
+- }
++ key.irq = irq;
++ key.handle = 0;
+
+- return NULL;
++ return bsearch(&key, hp, nr_hp, sizeof(*hp), intc_handle_int_cmp);
+ }
+
+ int intc_set_priority(unsigned int irq, unsigned int prio)
+diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
+index c64690d..8e1fcd5 100644
+--- a/drivers/sh/intc/core.c
++++ b/drivers/sh/intc/core.c
+@@ -2,7 +2,7 @@
+ * Shared interrupt handling code for IPR and INTC2 types of IRQs.
+ *
+ * Copyright (C) 2007, 2008 Magnus Damm
+- * Copyright (C) 2009, 2010 Paul Mundt
++ * Copyright (C) 2009 - 2012 Paul Mundt
+ *
+ * Based on intc2.c and ipr.c
+ *
+@@ -31,6 +31,7 @@
+ #include <linux/spinlock.h>
+ #include <linux/radix-tree.h>
+ #include <linux/export.h>
++#include <linux/sort.h>
+ #include "internals.h"
+
+ LIST_HEAD(intc_list);
+@@ -267,6 +268,9 @@ int __init register_intc_controller(struct intc_desc *desc)
+ k += save_reg(d, k, hw->prio_regs[i].set_reg, smp);
+ k += save_reg(d, k, hw->prio_regs[i].clr_reg, smp);
+ }
++
++ sort(d->prio, hw->nr_prio_regs, sizeof(*d->prio),
++ intc_handle_int_cmp, NULL);
+ }
+
+ if (hw->sense_regs) {
+@@ -277,6 +281,9 @@ int __init register_intc_controller(struct intc_desc *desc)
+
+ for (i = 0; i < hw->nr_sense_regs; i++)
+ k += save_reg(d, k, hw->sense_regs[i].reg, 0);
++
++ sort(d->sense, hw->nr_sense_regs, sizeof(*d->sense),
++ intc_handle_int_cmp, NULL);
+ }
+
+ if (hw->subgroups)
+diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
+index 422b72d..f034a97 100644
+--- a/drivers/sh/intc/internals.h
++++ b/drivers/sh/intc/internals.h
+@@ -108,6 +108,14 @@ static inline void activate_irq(int irq)
+ #endif
+ }
+
++static inline int intc_handle_int_cmp(const void *a, const void *b)
++{
++ const struct intc_handle_int *_a = a;
++ const struct intc_handle_int *_b = b;
++
++ return _a->irq - _b->irq;
++}
++
+ /* access.c */
+ extern unsigned long
+ (*intc_reg_fns[])(unsigned long addr, unsigned long h, unsigned long data);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0040-sh-intc-remove-dependency-on-NR_IRQS.patch b/patches.armadillo800eva/0040-sh-intc-remove-dependency-on-NR_IRQS.patch
new file mode 100644
index 00000000000000..38872ef01485c0
--- /dev/null
+++ b/patches.armadillo800eva/0040-sh-intc-remove-dependency-on-NR_IRQS.patch
@@ -0,0 +1,93 @@
+From f6e4e54e9b72195a1a6e84e2e3a779db164c8f60 Mon Sep 17 00:00:00 2001
+From: Rob Herring <rob.herring@calxeda.com>
+Date: Tue, 17 Jan 2012 13:10:25 -0600
+Subject: sh: intc: remove dependency on NR_IRQS
+
+SH intc has a compile time dependency on NR_IRQS. Make this dependency a
+local define so that shmobile (and ARM in general) can have run-time
+NR_IRQS setting.
+
+Signed-off-by: Rob Herring <rob.herring@calxeda.com>
+(cherry picked from commit 0f55239348aa85021d8bf8b63d84a796fcc142a4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/balancing.c | 2 +-
+ drivers/sh/intc/core.c | 2 +-
+ drivers/sh/intc/handle.c | 2 +-
+ drivers/sh/intc/virq.c | 2 +-
+ include/linux/sh_intc.h | 6 ++++++
+ 5 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/sh/intc/balancing.c b/drivers/sh/intc/balancing.c
+index cec7a96..bc78080 100644
+--- a/drivers/sh/intc/balancing.c
++++ b/drivers/sh/intc/balancing.c
+@@ -9,7 +9,7 @@
+ */
+ #include "internals.h"
+
+-static unsigned long dist_handle[NR_IRQS];
++static unsigned long dist_handle[INTC_NR_IRQS];
+
+ void intc_balancing_enable(unsigned int irq)
+ {
+diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
+index 8e1fcd5..7e562cc 100644
+--- a/drivers/sh/intc/core.c
++++ b/drivers/sh/intc/core.c
+@@ -43,7 +43,7 @@ static unsigned int nr_intc_controllers;
+ * - this needs to be at least 2 for 5-bit priorities on 7780
+ */
+ static unsigned int default_prio_level = 2; /* 2 - 16 */
+-static unsigned int intc_prio_level[NR_IRQS]; /* for now */
++static unsigned int intc_prio_level[INTC_NR_IRQS]; /* for now */
+
+ unsigned int intc_get_dfl_prio_level(void)
+ {
+diff --git a/drivers/sh/intc/handle.c b/drivers/sh/intc/handle.c
+index 057ce56..f461d53 100644
+--- a/drivers/sh/intc/handle.c
++++ b/drivers/sh/intc/handle.c
+@@ -13,7 +13,7 @@
+ #include <linux/spinlock.h>
+ #include "internals.h"
+
+-static unsigned long ack_handle[NR_IRQS];
++static unsigned long ack_handle[INTC_NR_IRQS];
+
+ static intc_enum __init intc_grp_id(struct intc_desc *desc,
+ intc_enum enum_id)
+diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
+index c7ec49f..93cec21 100644
+--- a/drivers/sh/intc/virq.c
++++ b/drivers/sh/intc/virq.c
+@@ -17,7 +17,7 @@
+ #include <linux/export.h>
+ #include "internals.h"
+
+-static struct intc_map_entry intc_irq_xlate[NR_IRQS];
++static struct intc_map_entry intc_irq_xlate[INTC_NR_IRQS];
+
+ struct intc_virq_list {
+ unsigned int irq;
+diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
+index e1a2ac5..6aed080 100644
+--- a/include/linux/sh_intc.h
++++ b/include/linux/sh_intc.h
+@@ -3,6 +3,12 @@
+
+ #include <linux/ioport.h>
+
++#ifdef CONFIG_SUPERH
++#define INTC_NR_IRQS 512
++#else
++#define INTC_NR_IRQS 1024
++#endif
++
+ /*
+ * Convert back and forth between INTEVT and IRQ values.
+ */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0041-sh-intc-Fix-up-section-mismatch-for-intc_ack_data.patch b/patches.armadillo800eva/0041-sh-intc-Fix-up-section-mismatch-for-intc_ack_data.patch
new file mode 100644
index 00000000000000..6623ab8a059219
--- /dev/null
+++ b/patches.armadillo800eva/0041-sh-intc-Fix-up-section-mismatch-for-intc_ack_data.patch
@@ -0,0 +1,44 @@
+From c71a753d25dfdfde9288975e60f6390570bcdd2d Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Thu, 29 Mar 2012 00:28:19 +0900
+Subject: sh: intc: Fix up section mismatch for intc_ack_data
+
+intc_ack_data is flagged as __init when it shouldn't be, causing section
+mismatches in non-init paths like intc_set_ack_handle():
+
+WARNING: drivers/built-in.o(.text+0x5d760):
+Section mismatch in reference from the function
+intc_set_ack_handle() to the function .init.text:intc_ack_data()
+The function intc_set_ack_handle()
+references the function __init intc_ack_data().
+This is often because intc_set_ack_handle lacks a __init
+annotation or the annotation of intc_ack_data is wrong.
+
+Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit b448d6adf733cc130339685531940f28902f2b75)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/intc/handle.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/sh/intc/handle.c b/drivers/sh/intc/handle.c
+index f461d53..7863a44 100644
+--- a/drivers/sh/intc/handle.c
++++ b/drivers/sh/intc/handle.c
+@@ -172,9 +172,8 @@ intc_get_prio_handle(struct intc_desc *desc, struct intc_desc_int *d,
+ return 0;
+ }
+
+-static unsigned int __init intc_ack_data(struct intc_desc *desc,
+- struct intc_desc_int *d,
+- intc_enum enum_id)
++static unsigned int intc_ack_data(struct intc_desc *desc,
++ struct intc_desc_int *d, intc_enum enum_id)
+ {
+ struct intc_mask_reg *mr = desc->hw.ack_regs;
+ unsigned int i, j, fn, mode;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0042-drivers-sh-late-disabling-of-clocks-V2.patch b/patches.armadillo800eva/0042-drivers-sh-late-disabling-of-clocks-V2.patch
new file mode 100644
index 00000000000000..0422cfe3656fcc
--- /dev/null
+++ b/patches.armadillo800eva/0042-drivers-sh-late-disabling-of-clocks-V2.patch
@@ -0,0 +1,80 @@
+From ac77c0529d45314d4fa2e56fc1607a228e0acedf Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Tue, 21 Jun 2011 07:55:12 +0000
+Subject: drivers: sh: late disabling of clocks V2
+
+This V2 patch changes the clock disabling behavior during boot.
+Two different changes are made:
+
+1) Delay disabling of clocks until late in the boot process.
+ This fixes an existing issue where in-use clocks without
+ software reference are disabled by mistake during boot.
+ One example of this is the handling of the Mackerel serial
+ console output that shares clock with the I2C controller.
+
+2) Write out the "disabled" state to the hardware for clocks
+ that not have been used by the kernel. In other words,
+ make sure so far unused clocks actually get turned off.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Acked-by: Simon Horman <horms@verge.net.au>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 794d78fea51504bad3880d14f354a9847f318f25)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/core.c | 27 ++++++++++++++++++++++++++-
+ 1 file changed, 26 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
+index 7e9c399..ebeaa9e 100644
+--- a/drivers/sh/clk/core.c
++++ b/drivers/sh/clk/core.c
+@@ -34,6 +34,9 @@ static LIST_HEAD(clock_list);
+ static DEFINE_SPINLOCK(clock_lock);
+ static DEFINE_MUTEX(clock_list_sem);
+
++/* clock disable operations are not passed on to hardware during boot */
++static int allow_disable;
++
+ void clk_rate_table_build(struct clk *clk,
+ struct cpufreq_frequency_table *freq_table,
+ int nr_freqs,
+@@ -228,7 +231,7 @@ static void __clk_disable(struct clk *clk)
+ return;
+
+ if (!(--clk->usecount)) {
+- if (likely(clk->ops && clk->ops->disable))
++ if (likely(allow_disable && clk->ops && clk->ops->disable))
+ clk->ops->disable(clk);
+ if (likely(clk->parent))
+ __clk_disable(clk->parent);
+@@ -747,3 +750,25 @@ err_out:
+ return err;
+ }
+ late_initcall(clk_debugfs_init);
++
++static int __init clk_late_init(void)
++{
++ unsigned long flags;
++ struct clk *clk;
++
++ /* disable all clocks with zero use count */
++ mutex_lock(&clock_list_sem);
++ spin_lock_irqsave(&clock_lock, flags);
++
++ list_for_each_entry(clk, &clock_list, node)
++ if (!clk->usecount && clk->ops && clk->ops->disable)
++ clk->ops->disable(clk);
++
++ /* from now on allow clock disable operations */
++ allow_disable = 1;
++
++ spin_unlock_irqrestore(&clock_lock, flags);
++ mutex_unlock(&clock_list_sem);
++ return 0;
++}
++late_initcall(clk_late_init);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0043-sh-clkfwk-Convert-to-IS_ERR_OR_NULL.patch b/patches.armadillo800eva/0043-sh-clkfwk-Convert-to-IS_ERR_OR_NULL.patch
new file mode 100644
index 00000000000000..cb0f1cdb804a5d
--- /dev/null
+++ b/patches.armadillo800eva/0043-sh-clkfwk-Convert-to-IS_ERR_OR_NULL.patch
@@ -0,0 +1,31 @@
+From d6aec47736b767c45be4c88daa8312fe8be7223b Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Fri, 24 Jun 2011 17:35:40 +0900
+Subject: sh: clkfwk: Convert to IS_ERR_OR_NULL.
+
+Trivial cleanup.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 225ca45c3c64964163ea1fa85e2081af85956eed)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
+index ebeaa9e..229ad09 100644
+--- a/drivers/sh/clk/core.c
++++ b/drivers/sh/clk/core.c
+@@ -396,7 +396,7 @@ int clk_register(struct clk *clk)
+ {
+ int ret;
+
+- if (clk == NULL || IS_ERR(clk))
++ if (IS_ERR_OR_NULL(clk))
+ return -EINVAL;
+
+ /*
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0044-sh-move-CLKDEV_xxx_ID-macro-to-sh_clk.h.patch b/patches.armadillo800eva/0044-sh-move-CLKDEV_xxx_ID-macro-to-sh_clk.h.patch
new file mode 100644
index 00000000000000..166240ecab2144
--- /dev/null
+++ b/patches.armadillo800eva/0044-sh-move-CLKDEV_xxx_ID-macro-to-sh_clk.h.patch
@@ -0,0 +1,174 @@
+From 8cb8f6ca3df19dffae930308e5ccc76ff11686f7 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 6 Jul 2011 02:54:11 +0000
+Subject: sh: move CLKDEV_xxx_ID macro to sh_clk.h
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 1522043bf73ef0e9e61dc512a0f3cdbec1cbf89f)
+
+Conflicts:
+
+ arch/sh/kernel/cpu/sh4a/clock-sh7343.c
+ arch/sh/kernel/cpu/sh4a/clock-sh7366.c
+ arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+ arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+ arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+ arch/sh/kernel/cpu/sh4a/clock-sh7757.c
+ arch/sh/kernel/cpu/sh4a/clock-sh7785.c
+ arch/sh/kernel/cpu/sh4a/clock-sh7786.c
+ arch/sh/kernel/cpu/sh4a/clock-shx3.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-sh7367.c | 3 ---
+ arch/arm/mach-shmobile/clock-sh7372.c | 4 ----
+ arch/arm/mach-shmobile/clock-sh7377.c | 3 ---
+ arch/arm/mach-shmobile/clock-sh73a0.c | 4 ----
+ arch/sh/boards/mach-highlander/setup.c | 2 --
+ arch/sh/kernel/cpu/clock-cpg.c | 2 --
+ arch/sh/kernel/cpu/sh4/clock-sh4-202.c | 2 --
+ arch/sh/kernel/cpu/sh4a/clock-sh7763.c | 2 --
+ arch/sh/kernel/cpu/sh4a/clock-sh7780.c | 2 --
+ include/linux/sh_clk.h | 4 ++++
+ 10 files changed, 4 insertions(+), 24 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
+index 414a3e7..fb85a38 100644
+--- a/arch/arm/mach-shmobile/clock-sh7367.c
++++ b/arch/arm/mach-shmobile/clock-sh7367.c
+@@ -259,9 +259,6 @@ static struct clk mstp_clks[MSTP_NR] = {
+ [CMMSTP003] = MSTP(&r_clk, CMMSTPCR0, 3, 0), /* KEYSC */
+ };
+
+-#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+-#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
+-
+ static struct clk_lookup lookups[] = {
+ /* main clocks */
+ CLKDEV_CON_ID("r_clk", &r_clk),
+diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
+index 24e0cac..84ba36f 100644
+--- a/arch/arm/mach-shmobile/clock-sh7372.c
++++ b/arch/arm/mach-shmobile/clock-sh7372.c
+@@ -561,10 +561,6 @@ static struct clk mstp_clks[MSTP_NR] = {
+ [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
+ };
+
+-#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+-#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
+-#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
+-
+ static struct clk_lookup lookups[] = {
+ /* main clocks */
+ CLKDEV_CON_ID("dv_clki_div2_clk", &sh7372_dv_clki_div2_clk),
+diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c
+index b88ebd8..5f1e325 100644
+--- a/arch/arm/mach-shmobile/clock-sh7377.c
++++ b/arch/arm/mach-shmobile/clock-sh7377.c
+@@ -267,9 +267,6 @@ static struct clk mstp_clks[] = {
+ [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
+ };
+
+-#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+-#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
+-
+ static struct clk_lookup lookups[] = {
+ /* main clocks */
+ CLKDEV_CON_ID("r_clk", &r_clk),
+diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
+index 8d4b5db..c4bef73 100644
+--- a/arch/arm/mach-shmobile/clock-sh73a0.c
++++ b/arch/arm/mach-shmobile/clock-sh73a0.c
+@@ -306,10 +306,6 @@ static struct clk mstp_clks[MSTP_NR] = {
+ [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
+ };
+
+-#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+-#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
+-#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
+-
+ static struct clk_lookup lookups[] = {
+ /* main clocks */
+ CLKDEV_CON_ID("r_clk", &r_clk),
+diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c
+index 87618c9..74b8db1 100644
+--- a/arch/sh/boards/mach-highlander/setup.c
++++ b/arch/sh/boards/mach-highlander/setup.c
+@@ -335,8 +335,6 @@ static struct clk *r7780rp_clocks[] = {
+ &ivdr_clk,
+ };
+
+-#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+-
+ static struct clk_lookup lookups[] = {
+ /* main clocks */
+ CLKDEV_CON_ID("ivdr_clk", &ivdr_clk),
+diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c
+index 8f63a26..f59b1f3 100644
+--- a/arch/sh/kernel/cpu/clock-cpg.c
++++ b/arch/sh/kernel/cpu/clock-cpg.c
+@@ -35,8 +35,6 @@ static struct clk *onchip_clocks[] = {
+ &cpu_clk,
+ };
+
+-#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+-
+ static struct clk_lookup lookups[] = {
+ /* main clocks */
+ CLKDEV_CON_ID("master_clk", &master_clk),
+diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
+index 3f6f8e9..f4e262a 100644
+--- a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
++++ b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
+@@ -147,8 +147,6 @@ static struct clk *sh4202_onchip_clocks[] = {
+ &sh4202_shoc_clk,
+ };
+
+-#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+-
+ static struct clk_lookup lookups[] = {
+ /* main clocks */
+ CLKDEV_CON_ID("emi_clk", &sh4202_emi_clk),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
+index 599630f..2d4c7fd 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7763.c
+@@ -91,8 +91,6 @@ static struct clk *sh7763_onchip_clocks[] = {
+ &sh7763_shyway_clk,
+ };
+
+-#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+-
+ static struct clk_lookup lookups[] = {
+ /* main clocks */
+ CLKDEV_CON_ID("shyway_clk", &sh7763_shyway_clk),
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
+index 8894926..3b53348 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7780.c
+@@ -97,8 +97,6 @@ static struct clk *sh7780_onchip_clocks[] = {
+ &sh7780_shyway_clk,
+ };
+
+-#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
+-
+ static struct clk_lookup lookups[] = {
+ /* main clocks */
+ CLKDEV_CON_ID("shyway_clk", &sh7780_shyway_clk),
+diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
+index 9a52f72..3ccf186 100644
+--- a/include/linux/sh_clk.h
++++ b/include/linux/sh_clk.h
+@@ -147,4 +147,8 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
+ int sh_clk_div6_register(struct clk *clks, int nr);
+ int sh_clk_div6_reparent_register(struct clk *clks, int nr);
+
++#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
++#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
++#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
++
+ #endif /* __SH_CLOCK_H */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0045-switch-assorted-clock-drivers-to-debugfs_remove_recu.patch b/patches.armadillo800eva/0045-switch-assorted-clock-drivers-to-debugfs_remove_recu.patch
new file mode 100644
index 00000000000000..81ae421a2a1f05
--- /dev/null
+++ b/patches.armadillo800eva/0045-switch-assorted-clock-drivers-to-debugfs_remove_recu.patch
@@ -0,0 +1,193 @@
+From 8ecbe6b16788ab61bc6fccd8eac8985ccc3cee11 Mon Sep 17 00:00:00 2001
+From: Al Viro <viro@zeniv.linux.org.uk>
+Date: Sat, 16 Jul 2011 12:37:57 -0400
+Subject: switch assorted clock drivers to debugfs_remove_recursive()
+
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+(cherry picked from commit 12520c438f48113593130d210eba821a532c893b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-tegra/clock.c | 7 ++-----
+ arch/arm/mach-ux500/clock.c | 20 +++-----------------
+ arch/arm/plat-omap/clock.c | 6 ++----
+ arch/arm/plat-samsung/clock.c | 7 ++-----
+ arch/arm/plat-spear/clock.c | 7 ++-----
+ drivers/sh/clk/core.c | 7 ++-----
+ 6 files changed, 13 insertions(+), 41 deletions(-)
+
+diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
+index e028320..f8d41ff 100644
+--- a/arch/arm/mach-tegra/clock.c
++++ b/arch/arm/mach-tegra/clock.c
+@@ -585,7 +585,7 @@ static const struct file_operations possible_parents_fops = {
+
+ static int clk_debugfs_register_one(struct clk *c)
+ {
+- struct dentry *d, *child, *child_tmp;
++ struct dentry *d;
+
+ d = debugfs_create_dir(c->name, clk_debugfs_root);
+ if (!d)
+@@ -614,10 +614,7 @@ static int clk_debugfs_register_one(struct clk *c)
+ return 0;
+
+ err_out:
+- d = c->dent;
+- list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
+- debugfs_remove(child);
+- debugfs_remove(c->dent);
++ debugfs_remove_recursive(c->dent);
+ return -ENOMEM;
+ }
+
+diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c
+index 32ce908..1d8509d 100644
+--- a/arch/arm/mach-ux500/clock.c
++++ b/arch/arm/mach-ux500/clock.c
+@@ -635,7 +635,7 @@ static const struct file_operations set_rate_fops = {
+ static struct dentry *clk_debugfs_register_dir(struct clk *c,
+ struct dentry *p_dentry)
+ {
+- struct dentry *d, *clk_d, *child, *child_tmp;
++ struct dentry *d, *clk_d;
+ char s[255];
+ char *p = s;
+
+@@ -666,24 +666,10 @@ static struct dentry *clk_debugfs_register_dir(struct clk *c,
+ return clk_d;
+
+ err_out:
+- d = clk_d;
+- list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
+- debugfs_remove(child);
+- debugfs_remove(clk_d);
++ debugfs_remove_recursive(clk_d);
+ return NULL;
+ }
+
+-static void clk_debugfs_remove_dir(struct dentry *cdentry)
+-{
+- struct dentry *d, *child, *child_tmp;
+-
+- d = cdentry;
+- list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
+- debugfs_remove(child);
+- debugfs_remove(cdentry);
+- return ;
+-}
+-
+ static int clk_debugfs_register_one(struct clk *c)
+ {
+ struct clk *pa = c->parent_periph;
+@@ -700,7 +686,7 @@ static int clk_debugfs_register_one(struct clk *c)
+ c->dent_bus = clk_debugfs_register_dir(c,
+ bpa->dent_bus ? bpa->dent_bus : bpa->dent);
+ if ((!c->dent_bus) && (c->dent)) {
+- clk_debugfs_remove_dir(c->dent);
++ debugfs_remove_recursive(c->dent);
+ c->dent = NULL;
+ return -ENOMEM;
+ }
+diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
+index 4910bc0..b85f628 100644
+--- a/arch/arm/plat-omap/clock.c
++++ b/arch/arm/plat-omap/clock.c
+@@ -481,7 +481,7 @@ static struct dentry *clk_debugfs_root;
+ static int clk_debugfs_register_one(struct clk *c)
+ {
+ int err;
+- struct dentry *d, *child, *child_tmp;
++ struct dentry *d;
+ struct clk *pa = c->parent;
+ char s[255];
+ char *p = s;
+@@ -511,9 +511,7 @@ static int clk_debugfs_register_one(struct clk *c)
+
+ err_out:
+ d = c->dent;
+- list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
+- debugfs_remove(child);
+- debugfs_remove(c->dent);
++ debugfs_remove_recursive(c->dent);
+ return err;
+ }
+
+diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
+index 7728928..0c9f95d 100644
+--- a/arch/arm/plat-samsung/clock.c
++++ b/arch/arm/plat-samsung/clock.c
+@@ -458,7 +458,7 @@ static struct dentry *clk_debugfs_root;
+ static int clk_debugfs_register_one(struct clk *c)
+ {
+ int err;
+- struct dentry *d, *child, *child_tmp;
++ struct dentry *d;
+ struct clk *pa = c->parent;
+ char s[255];
+ char *p = s;
+@@ -488,10 +488,7 @@ static int clk_debugfs_register_one(struct clk *c)
+ return 0;
+
+ err_out:
+- d = c->dent;
+- list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
+- debugfs_remove(child);
+- debugfs_remove(c->dent);
++ debugfs_remove_recursive(c->dent);
+ return err;
+ }
+
+diff --git a/arch/arm/plat-spear/clock.c b/arch/arm/plat-spear/clock.c
+index 6fa474c..67dd003 100644
+--- a/arch/arm/plat-spear/clock.c
++++ b/arch/arm/plat-spear/clock.c
+@@ -916,7 +916,7 @@ static struct dentry *clk_debugfs_root;
+ static int clk_debugfs_register_one(struct clk *c)
+ {
+ int err;
+- struct dentry *d, *child;
++ struct dentry *d;
+ struct clk *pa = c->pclk;
+ char s[255];
+ char *p = s;
+@@ -951,10 +951,7 @@ static int clk_debugfs_register_one(struct clk *c)
+ return 0;
+
+ err_out:
+- d = c->dent;
+- list_for_each_entry(child, &d->d_subdirs, d_u.d_child)
+- debugfs_remove(child);
+- debugfs_remove(c->dent);
++ debugfs_remove_recursive(c->dent);
+ return err;
+ }
+
+diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
+index 229ad09..dc8d022 100644
+--- a/drivers/sh/clk/core.c
++++ b/drivers/sh/clk/core.c
+@@ -673,7 +673,7 @@ static struct dentry *clk_debugfs_root;
+ static int clk_debugfs_register_one(struct clk *c)
+ {
+ int err;
+- struct dentry *d, *child, *child_tmp;
++ struct dentry *d;
+ struct clk *pa = c->parent;
+ char s[255];
+ char *p = s;
+@@ -702,10 +702,7 @@ static int clk_debugfs_register_one(struct clk *c)
+ return 0;
+
+ err_out:
+- d = c->dentry;
+- list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
+- debugfs_remove(child);
+- debugfs_remove(c->dentry);
++ debugfs_remove_recursive(c->dentry);
+ return err;
+ }
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0046-sh-clkfwk-add-clk_rate_mult_range_round.patch b/patches.armadillo800eva/0046-sh-clkfwk-add-clk_rate_mult_range_round.patch
new file mode 100644
index 00000000000000..19c474bdcf4736
--- /dev/null
+++ b/patches.armadillo800eva/0046-sh-clkfwk-add-clk_rate_mult_range_round.patch
@@ -0,0 +1,67 @@
+From 7464212984b7f9d2c2d3d08a0fa78b07cf2d2295 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Mon, 19 Sep 2011 18:51:13 -0700
+Subject: sh: clkfwk: add clk_rate_mult_range_round()
+
+This provides a clk_rate_mult_range_round() helper for use by some of the
+CPG PLL ranged multipliers, following the same approach as used by the
+div ranges.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit dd2c0ca1b153b555c09fd8e08f6842e12cf8e87b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/core.c | 20 ++++++++++++++++++++
+ include/linux/sh_clk.h | 3 +++
+ 2 files changed, 23 insertions(+)
+
+diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
+index dc8d022..352036b 100644
+--- a/drivers/sh/clk/core.c
++++ b/drivers/sh/clk/core.c
+@@ -173,6 +173,26 @@ long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
+ return clk_rate_round_helper(&div_range_round);
+ }
+
++static long clk_rate_mult_range_iter(unsigned int pos,
++ struct clk_rate_round_data *rounder)
++{
++ return clk_get_rate(rounder->arg) * pos;
++}
++
++long clk_rate_mult_range_round(struct clk *clk, unsigned int mult_min,
++ unsigned int mult_max, unsigned long rate)
++{
++ struct clk_rate_round_data mult_range_round = {
++ .min = mult_min,
++ .max = mult_max,
++ .func = clk_rate_mult_range_iter,
++ .arg = clk_get_parent(clk),
++ .rate = rate,
++ };
++
++ return clk_rate_round_helper(&mult_range_round);
++}
++
+ int clk_rate_table_find(struct clk *clk,
+ struct cpufreq_frequency_table *freq_table,
+ unsigned long rate)
+diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
+index 3ccf186..9237c29 100644
+--- a/include/linux/sh_clk.h
++++ b/include/linux/sh_clk.h
+@@ -94,6 +94,9 @@ int clk_rate_table_find(struct clk *clk,
+ long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
+ unsigned int div_max, unsigned long rate);
+
++long clk_rate_mult_range_round(struct clk *clk, unsigned int mult_min,
++ unsigned int mult_max, unsigned long rate);
++
+ long clk_round_parent(struct clk *clk, unsigned long target,
+ unsigned long *best_freq, unsigned long *parent_freq,
+ unsigned int div_min, unsigned int div_max);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0047-sh-clkfwk-Kill-off-remaining-debugfs-cruft.patch b/patches.armadillo800eva/0047-sh-clkfwk-Kill-off-remaining-debugfs-cruft.patch
new file mode 100644
index 00000000000000..3fa80812ef5248
--- /dev/null
+++ b/patches.armadillo800eva/0047-sh-clkfwk-Kill-off-remaining-debugfs-cruft.patch
@@ -0,0 +1,146 @@
+From 5c5ed4b6eae9439a0dc51d26269cfcd99261b06d Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Fri, 11 Nov 2011 16:11:41 +0900
+Subject: sh: clkfwk: Kill off remaining debugfs cruft.
+
+Now that all of the named string association with clocks has been
+migrated to clkdev lookups there's no meaningful named topology that can
+be constructed for a debugfs tree view. Get rid of the left over bits,
+and shrink struct clk a bit in the process.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 79e7066415a8b12adbeacc41b3dc44423534b8be)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/core.c | 87 ------------------------------------------------
+ include/linux/sh_clk.h | 1 -
+ 2 files changed, 88 deletions(-)
+
+diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
+index 352036b..db257a3 100644
+--- a/drivers/sh/clk/core.c
++++ b/drivers/sh/clk/core.c
+@@ -25,7 +25,6 @@
+ #include <linux/seq_file.h>
+ #include <linux/err.h>
+ #include <linux/io.h>
+-#include <linux/debugfs.h>
+ #include <linux/cpufreq.h>
+ #include <linux/clk.h>
+ #include <linux/sh_clk.h>
+@@ -225,9 +224,6 @@ int clk_reparent(struct clk *child, struct clk *parent)
+ list_add(&child->sibling, &parent->children);
+ child->parent = parent;
+
+- /* now do the debugfs renaming to reattach the child
+- to the proper parent */
+-
+ return 0;
+ }
+
+@@ -685,89 +681,6 @@ static int __init clk_syscore_init(void)
+ subsys_initcall(clk_syscore_init);
+ #endif
+
+-/*
+- * debugfs support to trace clock tree hierarchy and attributes
+- */
+-static struct dentry *clk_debugfs_root;
+-
+-static int clk_debugfs_register_one(struct clk *c)
+-{
+- int err;
+- struct dentry *d;
+- struct clk *pa = c->parent;
+- char s[255];
+- char *p = s;
+-
+- p += sprintf(p, "%p", c);
+- d = debugfs_create_dir(s, pa ? pa->dentry : clk_debugfs_root);
+- if (!d)
+- return -ENOMEM;
+- c->dentry = d;
+-
+- d = debugfs_create_u8("usecount", S_IRUGO, c->dentry, (u8 *)&c->usecount);
+- if (!d) {
+- err = -ENOMEM;
+- goto err_out;
+- }
+- d = debugfs_create_u32("rate", S_IRUGO, c->dentry, (u32 *)&c->rate);
+- if (!d) {
+- err = -ENOMEM;
+- goto err_out;
+- }
+- d = debugfs_create_x32("flags", S_IRUGO, c->dentry, (u32 *)&c->flags);
+- if (!d) {
+- err = -ENOMEM;
+- goto err_out;
+- }
+- return 0;
+-
+-err_out:
+- debugfs_remove_recursive(c->dentry);
+- return err;
+-}
+-
+-static int clk_debugfs_register(struct clk *c)
+-{
+- int err;
+- struct clk *pa = c->parent;
+-
+- if (pa && !pa->dentry) {
+- err = clk_debugfs_register(pa);
+- if (err)
+- return err;
+- }
+-
+- if (!c->dentry) {
+- err = clk_debugfs_register_one(c);
+- if (err)
+- return err;
+- }
+- return 0;
+-}
+-
+-static int __init clk_debugfs_init(void)
+-{
+- struct clk *c;
+- struct dentry *d;
+- int err;
+-
+- d = debugfs_create_dir("clock", NULL);
+- if (!d)
+- return -ENOMEM;
+- clk_debugfs_root = d;
+-
+- list_for_each_entry(c, &clock_list, node) {
+- err = clk_debugfs_register(c);
+- if (err)
+- goto err_out;
+- }
+- return 0;
+-err_out:
+- debugfs_remove_recursive(clk_debugfs_root);
+- return err;
+-}
+-late_initcall(clk_debugfs_init);
+-
+ static int __init clk_late_init(void)
+ {
+ unsigned long flags;
+diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
+index 9237c29..a20831c 100644
+--- a/include/linux/sh_clk.h
++++ b/include/linux/sh_clk.h
+@@ -52,7 +52,6 @@ struct clk {
+
+ unsigned long arch_flags;
+ void *priv;
+- struct dentry *dentry;
+ struct clk_mapping *mapping;
+ struct cpufreq_frequency_table *freq_table;
+ unsigned int nr_freqs;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0048-sh-clkfwk-setup-clock-parent-from-current-register-v.patch b/patches.armadillo800eva/0048-sh-clkfwk-setup-clock-parent-from-current-register-v.patch
new file mode 100644
index 00000000000000..ca3a93b2e05cf2
--- /dev/null
+++ b/patches.armadillo800eva/0048-sh-clkfwk-setup-clock-parent-from-current-register-v.patch
@@ -0,0 +1,143 @@
+From 98e40d27dae7c4cff546a17ce221677fcf629f77 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Mon, 21 Nov 2011 21:33:18 -0800
+Subject: sh: clkfwk: setup clock parent from current register value
+
+Some clocks can select its parent clock by CPG register.
+But it might have been modified by boot-loader or something.
+This patch removed fixed initial parent clock,
+and setup it from their current register settings.
+It works on div6 reparent clocks for now.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 56242a1fc595d158eddefbb4d6d76e82c2535f55)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-sh7372.c | 6 +++---
+ arch/sh/kernel/cpu/sh4a/clock-sh7724.c | 4 ++--
+ drivers/sh/clk/cpg.c | 35 ++++++++++++++++++++++++++++++++
+ include/linux/sh_clk.h | 9 +++++---
+ 4 files changed, 46 insertions(+), 8 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
+index 84ba36f..e116a95 100644
+--- a/arch/arm/mach-shmobile/clock-sh7372.c
++++ b/arch/arm/mach-shmobile/clock-sh7372.c
+@@ -411,11 +411,11 @@ static struct clk *fsibckcr_parent[] = {
+ };
+
+ static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
+- [DIV6_HDMI] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, HDMICKCR, 0,
++ [DIV6_HDMI] = SH_CLK_DIV6_EXT(HDMICKCR, 0,
+ hdmi_parent, ARRAY_SIZE(hdmi_parent), 6, 2),
+- [DIV6_FSIA] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, FSIACKCR, 0,
++ [DIV6_FSIA] = SH_CLK_DIV6_EXT(FSIACKCR, 0,
+ fsiackcr_parent, ARRAY_SIZE(fsiackcr_parent), 6, 2),
+- [DIV6_FSIB] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, FSIBCKCR, 0,
++ [DIV6_FSIB] = SH_CLK_DIV6_EXT(FSIBCKCR, 0,
+ fsibckcr_parent, ARRAY_SIZE(fsibckcr_parent), 6, 2),
+ };
+
+diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+index d08fa95..3a4b76c 100644
+--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
++++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+@@ -189,9 +189,9 @@ static struct clk *fclkbcr_parent[] = {
+ };
+
+ static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
+- [DIV6_FA] = SH_CLK_DIV6_EXT(&div3_clk, FCLKACR, 0,
++ [DIV6_FA] = SH_CLK_DIV6_EXT(FCLKACR, 0,
+ fclkacr_parent, ARRAY_SIZE(fclkacr_parent), 6, 2),
+- [DIV6_FB] = SH_CLK_DIV6_EXT(&div3_clk, FCLKBCR, 0,
++ [DIV6_FB] = SH_CLK_DIV6_EXT(FCLKBCR, 0,
+ fclkbcr_parent, ARRAY_SIZE(fclkbcr_parent), 6, 2),
+ };
+
+diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
+index 82dd6fb..5e4301b 100644
+--- a/drivers/sh/clk/cpg.c
++++ b/drivers/sh/clk/cpg.c
+@@ -167,6 +167,38 @@ static struct clk_ops sh_clk_div6_reparent_clk_ops = {
+ .set_parent = sh_clk_div6_set_parent,
+ };
+
++static int __init sh_clk_init_parent(struct clk *clk)
++{
++ u32 val;
++
++ if (clk->parent)
++ return 0;
++
++ if (!clk->parent_table || !clk->parent_num)
++ return 0;
++
++ if (!clk->src_width) {
++ pr_err("sh_clk_init_parent: cannot select parent clock\n");
++ return -EINVAL;
++ }
++
++ val = (__raw_readl(clk->enable_reg) >> clk->src_shift);
++ val &= (1 << clk->src_width) - 1;
++
++ if (val >= clk->parent_num) {
++ pr_err("sh_clk_init_parent: parent table size failed\n");
++ return -EINVAL;
++ }
++
++ clk->parent = clk->parent_table[val];
++ if (!clk->parent) {
++ pr_err("sh_clk_init_parent: unable to set parent");
++ return -EINVAL;
++ }
++
++ return 0;
++}
++
+ static int __init sh_clk_div6_register_ops(struct clk *clks, int nr,
+ struct clk_ops *ops)
+ {
+@@ -190,6 +222,9 @@ static int __init sh_clk_div6_register_ops(struct clk *clks, int nr,
+ clkp->ops = ops;
+ clkp->freq_table = freq_table + (k * freq_table_size);
+ clkp->freq_table[nr_divs].frequency = CPUFREQ_TABLE_END;
++ ret = sh_clk_init_parent(clkp);
++ if (ret < 0)
++ break;
+
+ ret = clk_register(clkp);
+ }
+diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
+index a20831c..e834304 100644
+--- a/include/linux/sh_clk.h
++++ b/include/linux/sh_clk.h
+@@ -131,10 +131,9 @@ int sh_clk_div4_enable_register(struct clk *clks, int nr,
+ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
+ struct clk_div4_table *table);
+
+-#define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents, \
++#define SH_CLK_DIV6_EXT(_reg, _flags, _parents, \
+ _num_parents, _src_shift, _src_width) \
+ { \
+- .parent = _parent, \
+ .enable_reg = (void __iomem *)_reg, \
+ .flags = _flags, \
+ .parent_table = _parents, \
+@@ -144,7 +143,11 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
+ }
+
+ #define SH_CLK_DIV6(_parent, _reg, _flags) \
+- SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0)
++{ \
++ .parent = _parent, \
++ .enable_reg = (void __iomem *)_reg, \
++ .flags = _flags, \
++}
+
+ int sh_clk_div6_register(struct clk *clks, int nr);
+ int sh_clk_div6_reparent_register(struct clk *clks, int nr);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0049-sh-extend-clock-struct-with-mapped_reg-member.patch b/patches.armadillo800eva/0049-sh-extend-clock-struct-with-mapped_reg-member.patch
new file mode 100644
index 00000000000000..a360d3d3fbc55d
--- /dev/null
+++ b/patches.armadillo800eva/0049-sh-extend-clock-struct-with-mapped_reg-member.patch
@@ -0,0 +1,70 @@
+From 4e6b2a45eda3e4eb6f569d0dd46589b62f29ff5b Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Thu, 8 Dec 2011 22:58:54 +0900
+Subject: sh: extend clock struct with mapped_reg member
+
+Add a "mapped_reg" member to struct clk and use that
+to keep the ioremapped register based on enable_reg.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit eda2030a5b60bb818f062adacbcfb6fd2d366fb9)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/core.c | 9 +++++++--
+ include/linux/sh_clk.h | 1 +
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
+index db257a3..7715de2 100644
+--- a/drivers/sh/clk/core.c
++++ b/drivers/sh/clk/core.c
+@@ -355,7 +355,7 @@ static int clk_establish_mapping(struct clk *clk)
+ */
+ if (!clk->parent) {
+ clk->mapping = &dummy_mapping;
+- return 0;
++ goto out;
+ }
+
+ /*
+@@ -384,6 +384,9 @@ static int clk_establish_mapping(struct clk *clk)
+ }
+
+ clk->mapping = mapping;
++out:
++ clk->mapped_reg = clk->mapping->base;
++ clk->mapped_reg += (phys_addr_t)clk->enable_reg - clk->mapping->phys;
+ return 0;
+ }
+
+@@ -402,10 +405,12 @@ static void clk_teardown_mapping(struct clk *clk)
+
+ /* Nothing to do */
+ if (mapping == &dummy_mapping)
+- return;
++ goto out;
+
+ kref_put(&mapping->ref, clk_destroy_mapping);
+ clk->mapping = NULL;
++out:
++ clk->mapped_reg = NULL;
+ }
+
+ int clk_register(struct clk *clk)
+diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
+index e834304..54341d8 100644
+--- a/include/linux/sh_clk.h
++++ b/include/linux/sh_clk.h
+@@ -49,6 +49,7 @@ struct clk {
+
+ void __iomem *enable_reg;
+ unsigned int enable_bit;
++ void __iomem *mapped_reg;
+
+ unsigned long arch_flags;
+ void *priv;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0050-sh-use-ioread32-iowrite32-and-mapped_reg-for-mstp32.patch b/patches.armadillo800eva/0050-sh-use-ioread32-iowrite32-and-mapped_reg-for-mstp32.patch
new file mode 100644
index 00000000000000..3f8bb6df4e6cfa
--- /dev/null
+++ b/patches.armadillo800eva/0050-sh-use-ioread32-iowrite32-and-mapped_reg-for-mstp32.patch
@@ -0,0 +1,44 @@
+From ac1c87d981dc955e1fc47efb6e1ef9e721478c6d Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Thu, 8 Dec 2011 22:59:03 +0900
+Subject: sh: use ioread32/iowrite32 and mapped_reg for mstp32
+
+Convert the CPG MSTP32 helper code to use the new mapped_reg
+together with ioread32() and iowrite32().
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit b3ab82b3eb191ad2cd8110cb5de0afb790337000)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/cpg.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
+index 5e4301b..ed8bc70 100644
+--- a/drivers/sh/clk/cpg.c
++++ b/drivers/sh/clk/cpg.c
+@@ -15,15 +15,15 @@
+
+ static int sh_clk_mstp32_enable(struct clk *clk)
+ {
+- __raw_writel(__raw_readl(clk->enable_reg) & ~(1 << clk->enable_bit),
+- clk->enable_reg);
++ iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
++ clk->mapped_reg);
+ return 0;
+ }
+
+ static void sh_clk_mstp32_disable(struct clk *clk)
+ {
+- __raw_writel(__raw_readl(clk->enable_reg) | (1 << clk->enable_bit),
+- clk->enable_reg);
++ iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
++ clk->mapped_reg);
+ }
+
+ static struct clk_ops sh_clk_mstp32_clk_ops = {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0051-sh-use-ioread32-iowrite32-and-mapped_reg-for-div4.patch b/patches.armadillo800eva/0051-sh-use-ioread32-iowrite32-and-mapped_reg-for-div4.patch
new file mode 100644
index 00000000000000..8ea658640c997a
--- /dev/null
+++ b/patches.armadillo800eva/0051-sh-use-ioread32-iowrite32-and-mapped_reg-for-div4.patch
@@ -0,0 +1,81 @@
+From a6c833e8b5ddaab4228fe180e6ef9903b58b1868 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Thu, 8 Dec 2011 22:59:13 +0900
+Subject: sh: use ioread32/iowrite32 and mapped_reg for div4
+
+Convert the CPG DIV4 helper code to use the new mapped_reg
+together with ioread32() and iowrite32().
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 0e027376f896e5dda293ffc8e6e7332d26d2ffc4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/cpg.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
+index ed8bc70..e4a2edf 100644
+--- a/drivers/sh/clk/cpg.c
++++ b/drivers/sh/clk/cpg.c
+@@ -252,7 +252,7 @@ static unsigned long sh_clk_div4_recalc(struct clk *clk)
+ clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
+ table, &clk->arch_flags);
+
+- idx = (__raw_readl(clk->enable_reg) >> clk->enable_bit) & 0x000f;
++ idx = (ioread32(clk->mapped_reg) >> clk->enable_bit) & 0x000f;
+
+ return clk->freq_table[idx].frequency;
+ }
+@@ -270,15 +270,15 @@ static int sh_clk_div4_set_parent(struct clk *clk, struct clk *parent)
+ */
+
+ if (parent->flags & CLK_ENABLE_ON_INIT)
+- value = __raw_readl(clk->enable_reg) & ~(1 << 7);
++ value = ioread32(clk->mapped_reg) & ~(1 << 7);
+ else
+- value = __raw_readl(clk->enable_reg) | (1 << 7);
++ value = ioread32(clk->mapped_reg) | (1 << 7);
+
+ ret = clk_reparent(clk, parent);
+ if (ret < 0)
+ return ret;
+
+- __raw_writel(value, clk->enable_reg);
++ iowrite32(value, clk->mapped_reg);
+
+ /* Rebiuld the frequency table */
+ clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
+@@ -295,10 +295,10 @@ static int sh_clk_div4_set_rate(struct clk *clk, unsigned long rate)
+ if (idx < 0)
+ return idx;
+
+- value = __raw_readl(clk->enable_reg);
++ value = ioread32(clk->mapped_reg);
+ value &= ~(0xf << clk->enable_bit);
+ value |= (idx << clk->enable_bit);
+- __raw_writel(value, clk->enable_reg);
++ iowrite32(value, clk->mapped_reg);
+
+ if (d4t->kick)
+ d4t->kick(clk);
+@@ -308,13 +308,13 @@ static int sh_clk_div4_set_rate(struct clk *clk, unsigned long rate)
+
+ static int sh_clk_div4_enable(struct clk *clk)
+ {
+- __raw_writel(__raw_readl(clk->enable_reg) & ~(1 << 8), clk->enable_reg);
++ iowrite32(ioread32(clk->mapped_reg) & ~(1 << 8), clk->mapped_reg);
+ return 0;
+ }
+
+ static void sh_clk_div4_disable(struct clk *clk)
+ {
+- __raw_writel(__raw_readl(clk->enable_reg) | (1 << 8), clk->enable_reg);
++ iowrite32(ioread32(clk->mapped_reg) | (1 << 8), clk->mapped_reg);
+ }
+
+ static struct clk_ops sh_clk_div4_clk_ops = {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0052-sh-use-ioread32-iowrite32-and-mapped_reg-for-div6.patch b/patches.armadillo800eva/0052-sh-use-ioread32-iowrite32-and-mapped_reg-for-div6.patch
new file mode 100644
index 00000000000000..6cd546440e8c2f
--- /dev/null
+++ b/patches.armadillo800eva/0052-sh-use-ioread32-iowrite32-and-mapped_reg-for-div6.patch
@@ -0,0 +1,93 @@
+From 23a236a9fb89e2c59949843d44388d483d598558 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Thu, 8 Dec 2011 22:59:22 +0900
+Subject: sh: use ioread32/iowrite32 and mapped_reg for div6
+
+Convert the CPG DIV6 helper code to use the new mapped_reg
+together with ioread32() and iowrite32().
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 2dacb97d9269e303ed761937a0e9db8711515e08)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/cpg.c | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
+index e4a2edf..a0d8faa 100644
+--- a/drivers/sh/clk/cpg.c
++++ b/drivers/sh/clk/cpg.c
+@@ -72,7 +72,7 @@ static unsigned long sh_clk_div6_recalc(struct clk *clk)
+ clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
+ table, NULL);
+
+- idx = __raw_readl(clk->enable_reg) & 0x003f;
++ idx = ioread32(clk->mapped_reg) & 0x003f;
+
+ return clk->freq_table[idx].frequency;
+ }
+@@ -98,10 +98,10 @@ static int sh_clk_div6_set_parent(struct clk *clk, struct clk *parent)
+ if (ret < 0)
+ return ret;
+
+- value = __raw_readl(clk->enable_reg) &
++ value = ioread32(clk->mapped_reg) &
+ ~(((1 << clk->src_width) - 1) << clk->src_shift);
+
+- __raw_writel(value | (i << clk->src_shift), clk->enable_reg);
++ iowrite32(value | (i << clk->src_shift), clk->mapped_reg);
+
+ /* Rebuild the frequency table */
+ clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
+@@ -119,10 +119,10 @@ static int sh_clk_div6_set_rate(struct clk *clk, unsigned long rate)
+ if (idx < 0)
+ return idx;
+
+- value = __raw_readl(clk->enable_reg);
++ value = ioread32(clk->mapped_reg);
+ value &= ~0x3f;
+ value |= idx;
+- __raw_writel(value, clk->enable_reg);
++ iowrite32(value, clk->mapped_reg);
+ return 0;
+ }
+
+@@ -133,9 +133,9 @@ static int sh_clk_div6_enable(struct clk *clk)
+
+ ret = sh_clk_div6_set_rate(clk, clk->rate);
+ if (ret == 0) {
+- value = __raw_readl(clk->enable_reg);
++ value = ioread32(clk->mapped_reg);
+ value &= ~0x100; /* clear stop bit to enable clock */
+- __raw_writel(value, clk->enable_reg);
++ iowrite32(value, clk->mapped_reg);
+ }
+ return ret;
+ }
+@@ -144,10 +144,10 @@ static void sh_clk_div6_disable(struct clk *clk)
+ {
+ unsigned long value;
+
+- value = __raw_readl(clk->enable_reg);
++ value = ioread32(clk->mapped_reg);
+ value |= 0x100; /* stop clock */
+ value |= 0x3f; /* VDIV bits must be non-zero, overwrite divider */
+- __raw_writel(value, clk->enable_reg);
++ iowrite32(value, clk->mapped_reg);
+ }
+
+ static struct clk_ops sh_clk_div6_clk_ops = {
+@@ -182,7 +182,7 @@ static int __init sh_clk_init_parent(struct clk *clk)
+ return -EINVAL;
+ }
+
+- val = (__raw_readl(clk->enable_reg) >> clk->src_shift);
++ val = (ioread32(clk->mapped_reg) >> clk->src_shift);
+ val &= (1 << clk->src_width) - 1;
+
+ if (val >= clk->parent_num) {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0053-sh-clkfwk-sh_clk_init_parent-should-be-called-after-.patch b/patches.armadillo800eva/0053-sh-clkfwk-sh_clk_init_parent-should-be-called-after-.patch
new file mode 100644
index 00000000000000..78eef5fe26e74e
--- /dev/null
+++ b/patches.armadillo800eva/0053-sh-clkfwk-sh_clk_init_parent-should-be-called-after-.patch
@@ -0,0 +1,39 @@
+From 5e231164bb186fd4b9630626ebeaed78da2e2f4a Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Sun, 11 Dec 2011 19:02:09 -0800
+Subject: sh: clkfwk: sh_clk_init_parent() should be called after
+ clk_register()
+
+sh_clk_init_parent() are using clk->mapped_reg
+which is mapped in clk_register()
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 7784f4da1a1b8b2519e008551fc4f69713451f89)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/cpg.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
+index a0d8faa..45fee36 100644
+--- a/drivers/sh/clk/cpg.c
++++ b/drivers/sh/clk/cpg.c
+@@ -222,11 +222,11 @@ static int __init sh_clk_div6_register_ops(struct clk *clks, int nr,
+ clkp->ops = ops;
+ clkp->freq_table = freq_table + (k * freq_table_size);
+ clkp->freq_table[nr_divs].frequency = CPUFREQ_TABLE_END;
+- ret = sh_clk_init_parent(clkp);
++ ret = clk_register(clkp);
+ if (ret < 0)
+ break;
+
+- ret = clk_register(clkp);
++ ret = sh_clk_init_parent(clkp);
+ }
+
+ return ret;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0054-sh-clkfwk-bugfix-use-clk_reparent-for-div6-clocks.patch b/patches.armadillo800eva/0054-sh-clkfwk-bugfix-use-clk_reparent-for-div6-clocks.patch
new file mode 100644
index 00000000000000..7e90e62696681e
--- /dev/null
+++ b/patches.armadillo800eva/0054-sh-clkfwk-bugfix-use-clk_reparent-for-div6-clocks.patch
@@ -0,0 +1,33 @@
+From 7f39fac87a1c14c1d6b6321423f9d10157a3132a Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 19 Jan 2012 01:00:40 -0800
+Subject: sh: clkfwk: bugfix: use clk_reparent() for div6 clocks
+
+Various problems will happen if clk parent was set up directly.
+it should use clk_reparent()
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 64dea57588f49736c2a7778292f3967c7984ab94)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/cpg.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
+index 45fee36..92d314a 100644
+--- a/drivers/sh/clk/cpg.c
++++ b/drivers/sh/clk/cpg.c
+@@ -190,7 +190,7 @@ static int __init sh_clk_init_parent(struct clk *clk)
+ return -EINVAL;
+ }
+
+- clk->parent = clk->parent_table[val];
++ clk_reparent(clk, clk->parent_table[val]);
+ if (!clk->parent) {
+ pr_err("sh_clk_init_parent: unable to set parent");
+ return -EINVAL;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0055-sh-introduce-sh_clk_ops-in-parallel-with-clk_ops.patch b/patches.armadillo800eva/0055-sh-introduce-sh_clk_ops-in-parallel-with-clk_ops.patch
new file mode 100644
index 00000000000000..0e42b025d39091
--- /dev/null
+++ b/patches.armadillo800eva/0055-sh-introduce-sh_clk_ops-in-parallel-with-clk_ops.patch
@@ -0,0 +1,32 @@
+From 195e6b5d4719d699278545f9127975f41b7ce8e9 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 29 Feb 2012 22:16:13 +0900
+Subject: sh: introduce sh_clk_ops in parallel with clk_ops
+
+Introduce sh_clk_ops in parallel with clk_ops.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+(cherry picked from commit e34828298ec542294f4b798606ee73e462d322f5)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ include/linux/sh_clk.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
+index 54341d8..706c005 100644
+--- a/include/linux/sh_clk.h
++++ b/include/linux/sh_clk.h
+@@ -18,6 +18,8 @@ struct clk_mapping {
+ struct kref ref;
+ };
+
++#define sh_clk_ops clk_ops
++
+ struct clk_ops {
+ #ifdef CONFIG_SH_CLK_CPG_LEGACY
+ void (*init)(struct clk *clk);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0056-sh-convert-cpg-code-to-sh_clk_ops.patch b/patches.armadillo800eva/0056-sh-convert-cpg-code-to-sh_clk_ops.patch
new file mode 100644
index 00000000000000..eee6997aba00c2
--- /dev/null
+++ b/patches.armadillo800eva/0056-sh-convert-cpg-code-to-sh_clk_ops.patch
@@ -0,0 +1,93 @@
+From d26f5a57a1cd5703436d60947b543038e5c71677 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 29 Feb 2012 22:16:21 +0900
+Subject: sh: convert cpg code to sh_clk_ops
+
+Convert the CPG code to use sh_clk_ops.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+(cherry picked from commit a0ec360f6b83146fa4ba1a681bdd751382f9f90e)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/sh/clk/cpg.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
+index 92d314a..91b6d52 100644
+--- a/drivers/sh/clk/cpg.c
++++ b/drivers/sh/clk/cpg.c
+@@ -26,7 +26,7 @@ static void sh_clk_mstp32_disable(struct clk *clk)
+ clk->mapped_reg);
+ }
+
+-static struct clk_ops sh_clk_mstp32_clk_ops = {
++static struct sh_clk_ops sh_clk_mstp32_clk_ops = {
+ .enable = sh_clk_mstp32_enable,
+ .disable = sh_clk_mstp32_disable,
+ .recalc = followparent_recalc,
+@@ -150,7 +150,7 @@ static void sh_clk_div6_disable(struct clk *clk)
+ iowrite32(value, clk->mapped_reg);
+ }
+
+-static struct clk_ops sh_clk_div6_clk_ops = {
++static struct sh_clk_ops sh_clk_div6_clk_ops = {
+ .recalc = sh_clk_div6_recalc,
+ .round_rate = sh_clk_div_round_rate,
+ .set_rate = sh_clk_div6_set_rate,
+@@ -158,7 +158,7 @@ static struct clk_ops sh_clk_div6_clk_ops = {
+ .disable = sh_clk_div6_disable,
+ };
+
+-static struct clk_ops sh_clk_div6_reparent_clk_ops = {
++static struct sh_clk_ops sh_clk_div6_reparent_clk_ops = {
+ .recalc = sh_clk_div6_recalc,
+ .round_rate = sh_clk_div_round_rate,
+ .set_rate = sh_clk_div6_set_rate,
+@@ -200,7 +200,7 @@ static int __init sh_clk_init_parent(struct clk *clk)
+ }
+
+ static int __init sh_clk_div6_register_ops(struct clk *clks, int nr,
+- struct clk_ops *ops)
++ struct sh_clk_ops *ops)
+ {
+ struct clk *clkp;
+ void *freq_table;
+@@ -317,13 +317,13 @@ static void sh_clk_div4_disable(struct clk *clk)
+ iowrite32(ioread32(clk->mapped_reg) | (1 << 8), clk->mapped_reg);
+ }
+
+-static struct clk_ops sh_clk_div4_clk_ops = {
++static struct sh_clk_ops sh_clk_div4_clk_ops = {
+ .recalc = sh_clk_div4_recalc,
+ .set_rate = sh_clk_div4_set_rate,
+ .round_rate = sh_clk_div_round_rate,
+ };
+
+-static struct clk_ops sh_clk_div4_enable_clk_ops = {
++static struct sh_clk_ops sh_clk_div4_enable_clk_ops = {
+ .recalc = sh_clk_div4_recalc,
+ .set_rate = sh_clk_div4_set_rate,
+ .round_rate = sh_clk_div_round_rate,
+@@ -331,7 +331,7 @@ static struct clk_ops sh_clk_div4_enable_clk_ops = {
+ .disable = sh_clk_div4_disable,
+ };
+
+-static struct clk_ops sh_clk_div4_reparent_clk_ops = {
++static struct sh_clk_ops sh_clk_div4_reparent_clk_ops = {
+ .recalc = sh_clk_div4_recalc,
+ .set_rate = sh_clk_div4_set_rate,
+ .round_rate = sh_clk_div_round_rate,
+@@ -341,7 +341,7 @@ static struct clk_ops sh_clk_div4_reparent_clk_ops = {
+ };
+
+ static int __init sh_clk_div4_register_ops(struct clk *clks, int nr,
+- struct clk_div4_table *table, struct clk_ops *ops)
++ struct clk_div4_table *table, struct sh_clk_ops *ops)
+ {
+ struct clk *clkp;
+ void *freq_table;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0057-ARM-mach-shmobile-R-Mobile-A1-support.patch b/patches.armadillo800eva/0057-ARM-mach-shmobile-R-Mobile-A1-support.patch
new file mode 100644
index 00000000000000..d767cf01177a60
--- /dev/null
+++ b/patches.armadillo800eva/0057-ARM-mach-shmobile-R-Mobile-A1-support.patch
@@ -0,0 +1,1378 @@
+From daca17b2fcb739100c4d73867f3142238a7b1f29 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 10 Nov 2011 18:45:52 -0800
+Subject: ARM: mach-shmobile: R-Mobile A1 support.
+
+This adds preliminary support for the R8A7740 (R-Mobile A1) CPU
+
+Timer, serial, gic, clock are supported at this point.
+This patch is based on v0.1 manual
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 6c01ba445cecb2d8085cf0b5a6ddfb170ad22616)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/Kconfig | 7 +
+ arch/arm/mach-shmobile/Makefile | 2 +
+ arch/arm/mach-shmobile/clock-r8a7740.c | 378 ++++++++++++++++
+ arch/arm/mach-shmobile/include/mach/common.h | 6 +
+ arch/arm/mach-shmobile/include/mach/r8a7740.h | 584 +++++++++++++++++++++++++
+ arch/arm/mach-shmobile/intc-r8a7740.c | 45 ++
+ arch/arm/mach-shmobile/setup-r8a7740.c | 246 +++++++++++
+ drivers/tty/serial/sh-sci.h | 4 +-
+ 8 files changed, 1271 insertions(+), 1 deletion(-)
+ create mode 100644 arch/arm/mach-shmobile/clock-r8a7740.c
+ create mode 100644 arch/arm/mach-shmobile/include/mach/r8a7740.h
+ create mode 100644 arch/arm/mach-shmobile/intc-r8a7740.c
+ create mode 100644 arch/arm/mach-shmobile/setup-r8a7740.c
+
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index 5dc5393..2ce88de 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -27,6 +27,13 @@ config ARCH_SH73A0
+ select ARCH_WANT_OPTIONAL_GPIOLIB
+ select ARM_GIC
+
++config ARCH_R8A7740
++ bool "R-Mobile A1 (R8A77400)"
++ select CPU_V7
++ select SH_CLK_CPG
++ select ARCH_WANT_OPTIONAL_GPIOLIB
++ select ARM_GIC
++
+ comment "SH-Mobile Board Type"
+
+ config MACH_G3EVM
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index 612b270..fdbae05 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -10,6 +10,7 @@ obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o
+ obj-$(CONFIG_ARCH_SH7377) += setup-sh7377.o clock-sh7377.o intc-sh7377.o
+ obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o clock-sh7372.o intc-sh7372.o
+ obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o clock-sh73a0.o intc-sh73a0.o
++obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o
+
+ # SMP objects
+ smp-y := platsmp.o headsmp.o
+@@ -29,6 +30,7 @@ obj-$(CONFIG_ARCH_SH7367) += entry-intc.o
+ obj-$(CONFIG_ARCH_SH7377) += entry-intc.o
+ obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
+ obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o
++obj-$(CONFIG_ARCH_R8A7740) += entry-gic.o
+
+ # PM objects
+ obj-$(CONFIG_SUSPEND) += suspend.o
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+new file mode 100644
+index 0000000..5bb02f2
+--- /dev/null
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -0,0 +1,378 @@
++/*
++ * 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.
++ *
++ * 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
++ */
++#include <linux/init.h>
++#include <linux/kernel.h>
++#include <linux/io.h>
++#include <linux/sh_clk.h>
++#include <linux/clkdev.h>
++#include <mach/common.h>
++#include <mach/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 0xe6150000
++#define FRQCRB 0xe6150004
++#define FRQCRC 0xe61500e0
++#define PLLC01CR 0xe6150028
++
++#define SUBCKCR 0xe6150080
++
++#define MSTPSR0 0xe6150030
++#define MSTPSR1 0xe6150038
++#define MSTPSR2 0xe6150040
++#define MSTPSR3 0xe6150048
++#define MSTPSR4 0xe615004c
++#define SMSTPCR0 0xe6150130
++#define SMSTPCR1 0xe6150134
++#define SMSTPCR2 0xe6150138
++#define SMSTPCR3 0xe615013c
++#define SMSTPCR4 0xe6150140
++
++/* 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,
++};
++
++static unsigned long div_recalc(struct clk *clk)
++{
++ return clk->parent->rate / (int)(clk->priv);
++}
++
++static struct clk_ops div_clk_ops = {
++ .recalc = div_recalc,
++};
++
++/* extal1 / 2 */
++static struct clk extal1_div2_clk = {
++ .ops = &div_clk_ops,
++ .priv = (void *)2,
++ .parent = &extal1_clk,
++};
++
++/* extal1 / 1024 */
++static struct clk extal1_div1024_clk = {
++ .ops = &div_clk_ops,
++ .priv = (void *)1024,
++ .parent = &extal1_clk,
++};
++
++/* extal1 / 2 / 1024 */
++static struct clk extal1_div2048_clk = {
++ .ops = &div_clk_ops,
++ .priv = (void *)1024,
++ .parent = &extal1_div2_clk,
++};
++
++/* extal2 / 2 */
++static struct clk extal2_div2_clk = {
++ .ops = &div_clk_ops,
++ .priv = (void *)2,
++ .parent = &extal2_clk,
++};
++
++static struct clk_ops followparent_clk_ops = {
++ .recalc = followparent_recalc,
++};
++
++/* Main clock */
++static struct clk system_clk = {
++ .ops = &followparent_clk_ops,
++};
++
++static struct clk system_div2_clk = {
++ .ops = &div_clk_ops,
++ .priv = (void *)2,
++ .parent = &system_clk,
++};
++
++/* 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 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 */
++static struct clk pllc1_div2_clk = {
++ .ops = &div_clk_ops,
++ .priv = (void *)2,
++ .parent = &pllc1_clk,
++};
++
++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,
++};
++
++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_S, DIV4_ZB, DIV4_M3, DIV4_CP,
++ DIV4_NR
++};
++
++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_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),
++};
++
++enum {
++ DIV6_SUB,
++ DIV6_NR
++};
++
++static struct clk div6_clks[DIV6_NR] = {
++ [DIV6_SUB] = SH_CLK_DIV6(&pllc1_div2_clk, SUBCKCR, 0),
++};
++
++enum {
++ MSTP125,
++ MSTP116, MSTP111,
++
++ MSTP230,
++ MSTP222,
++ MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
++
++ MSTP329, MSTP323,
++
++ MSTP_NR
++};
++
++static struct clk mstp_clks[MSTP_NR] = {
++ [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
++ [MSTP116] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */
++ [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */
++
++ [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */
++ [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */
++ [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 */
++ [MSTP323] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */
++};
++
++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),
++
++ /* 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_tmu.1", &mstp_clks[MSTP111]),
++ CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]),
++ CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]),
++
++ CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),
++ CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]),
++ CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]),
++ CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
++ CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
++ CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]),
++ CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]),
++
++ CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]),
++ CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]),
++
++ CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]),
++ CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]),
++};
++
++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_mstp32_register(mstp_clks, MSTP_NR);
++
++ clkdev_add_table(lookups, ARRAY_SIZE(lookups));
++
++ if (!ret)
++ clk_init();
++ else
++ panic("failed to setup r8a7740 clocks\n");
++}
+diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
+index 0e37fd5..d821f63 100644
+--- a/arch/arm/mach-shmobile/include/mach/common.h
++++ b/arch/arm/mach-shmobile/include/mach/common.h
+@@ -54,4 +54,10 @@ extern void sh73a0_secondary_init(unsigned int cpu);
+ extern int sh73a0_boot_secondary(unsigned int cpu);
+ extern void sh73a0_smp_prepare_cpus(void);
+
++extern void r8a7740_init_irq(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);
++
+ #endif /* __ARCH_MACH_COMMON_H */
+diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h
+new file mode 100644
+index 0000000..9d447ab
+--- /dev/null
++++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h
+@@ -0,0 +1,584 @@
++/*
++ * 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.
++ *
++ * 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
++ */
++
++#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)
++
++/*
++ * Pin Function Controller:
++ * GPIO_FN_xx - GPIO used to select pin function
++ * GPIO_PORTxx - GPIO mapped to real I/O pin on CPU
++ */
++enum {
++ /* PORT */
++ GPIO_PORT0, GPIO_PORT1, GPIO_PORT2, GPIO_PORT3, GPIO_PORT4,
++ GPIO_PORT5, GPIO_PORT6, GPIO_PORT7, GPIO_PORT8, GPIO_PORT9,
++
++ GPIO_PORT10, GPIO_PORT11, GPIO_PORT12, GPIO_PORT13, GPIO_PORT14,
++ GPIO_PORT15, GPIO_PORT16, GPIO_PORT17, GPIO_PORT18, GPIO_PORT19,
++
++ GPIO_PORT20, GPIO_PORT21, GPIO_PORT22, GPIO_PORT23, GPIO_PORT24,
++ GPIO_PORT25, GPIO_PORT26, GPIO_PORT27, GPIO_PORT28, GPIO_PORT29,
++
++ GPIO_PORT30, GPIO_PORT31, GPIO_PORT32, GPIO_PORT33, GPIO_PORT34,
++ GPIO_PORT35, GPIO_PORT36, GPIO_PORT37, GPIO_PORT38, GPIO_PORT39,
++
++ GPIO_PORT40, GPIO_PORT41, GPIO_PORT42, GPIO_PORT43, GPIO_PORT44,
++ GPIO_PORT45, GPIO_PORT46, GPIO_PORT47, GPIO_PORT48, GPIO_PORT49,
++
++ GPIO_PORT50, GPIO_PORT51, GPIO_PORT52, GPIO_PORT53, GPIO_PORT54,
++ GPIO_PORT55, GPIO_PORT56, GPIO_PORT57, GPIO_PORT58, GPIO_PORT59,
++
++ GPIO_PORT60, GPIO_PORT61, GPIO_PORT62, GPIO_PORT63, GPIO_PORT64,
++ GPIO_PORT65, GPIO_PORT66, GPIO_PORT67, GPIO_PORT68, GPIO_PORT69,
++
++ GPIO_PORT70, GPIO_PORT71, GPIO_PORT72, GPIO_PORT73, GPIO_PORT74,
++ GPIO_PORT75, GPIO_PORT76, GPIO_PORT77, GPIO_PORT78, GPIO_PORT79,
++
++ GPIO_PORT80, GPIO_PORT81, GPIO_PORT82, GPIO_PORT83, GPIO_PORT84,
++ GPIO_PORT85, GPIO_PORT86, GPIO_PORT87, GPIO_PORT88, GPIO_PORT89,
++
++ GPIO_PORT90, GPIO_PORT91, GPIO_PORT92, GPIO_PORT93, GPIO_PORT94,
++ GPIO_PORT95, GPIO_PORT96, GPIO_PORT97, GPIO_PORT98, GPIO_PORT99,
++
++ GPIO_PORT100, GPIO_PORT101, GPIO_PORT102, GPIO_PORT103, GPIO_PORT104,
++ GPIO_PORT105, GPIO_PORT106, GPIO_PORT107, GPIO_PORT108, GPIO_PORT109,
++
++ GPIO_PORT110, GPIO_PORT111, GPIO_PORT112, GPIO_PORT113, GPIO_PORT114,
++ GPIO_PORT115, GPIO_PORT116, GPIO_PORT117, GPIO_PORT118, GPIO_PORT119,
++
++ GPIO_PORT120, GPIO_PORT121, GPIO_PORT122, GPIO_PORT123, GPIO_PORT124,
++ GPIO_PORT125, GPIO_PORT126, GPIO_PORT127, GPIO_PORT128, GPIO_PORT129,
++
++ GPIO_PORT130, GPIO_PORT131, GPIO_PORT132, GPIO_PORT133, GPIO_PORT134,
++ GPIO_PORT135, GPIO_PORT136, GPIO_PORT137, GPIO_PORT138, GPIO_PORT139,
++
++ GPIO_PORT140, GPIO_PORT141, GPIO_PORT142, GPIO_PORT143, GPIO_PORT144,
++ GPIO_PORT145, GPIO_PORT146, GPIO_PORT147, GPIO_PORT148, GPIO_PORT149,
++
++ GPIO_PORT150, GPIO_PORT151, GPIO_PORT152, GPIO_PORT153, GPIO_PORT154,
++ GPIO_PORT155, GPIO_PORT156, GPIO_PORT157, GPIO_PORT158, GPIO_PORT159,
++
++ GPIO_PORT160, GPIO_PORT161, GPIO_PORT162, GPIO_PORT163, GPIO_PORT164,
++ GPIO_PORT165, GPIO_PORT166, GPIO_PORT167, GPIO_PORT168, GPIO_PORT169,
++
++ GPIO_PORT170, GPIO_PORT171, GPIO_PORT172, GPIO_PORT173, GPIO_PORT174,
++ GPIO_PORT175, GPIO_PORT176, GPIO_PORT177, GPIO_PORT178, GPIO_PORT179,
++
++ GPIO_PORT180, GPIO_PORT181, GPIO_PORT182, GPIO_PORT183, GPIO_PORT184,
++ GPIO_PORT185, GPIO_PORT186, GPIO_PORT187, GPIO_PORT188, GPIO_PORT189,
++
++ GPIO_PORT190, GPIO_PORT191, GPIO_PORT192, GPIO_PORT193, GPIO_PORT194,
++ GPIO_PORT195, GPIO_PORT196, GPIO_PORT197, GPIO_PORT198, GPIO_PORT199,
++
++ GPIO_PORT200, GPIO_PORT201, GPIO_PORT202, GPIO_PORT203, GPIO_PORT204,
++ GPIO_PORT205, GPIO_PORT206, GPIO_PORT207, GPIO_PORT208, GPIO_PORT209,
++
++ GPIO_PORT210, GPIO_PORT211,
++
++ /* IRQ */
++ GPIO_FN_IRQ0_PORT2, GPIO_FN_IRQ0_PORT13,
++ GPIO_FN_IRQ1,
++ GPIO_FN_IRQ2_PORT11, GPIO_FN_IRQ2_PORT12,
++ GPIO_FN_IRQ3_PORT10, GPIO_FN_IRQ3_PORT14,
++ GPIO_FN_IRQ4_PORT15, GPIO_FN_IRQ4_PORT172,
++ GPIO_FN_IRQ5_PORT0, GPIO_FN_IRQ5_PORT1,
++ GPIO_FN_IRQ6_PORT121, GPIO_FN_IRQ6_PORT173,
++ GPIO_FN_IRQ7_PORT120, GPIO_FN_IRQ7_PORT209,
++ GPIO_FN_IRQ8,
++ GPIO_FN_IRQ9_PORT118, GPIO_FN_IRQ9_PORT210,
++ GPIO_FN_IRQ10,
++ GPIO_FN_IRQ11,
++ GPIO_FN_IRQ12_PORT42, GPIO_FN_IRQ12_PORT97,
++ GPIO_FN_IRQ13_PORT64, GPIO_FN_IRQ13_PORT98,
++ GPIO_FN_IRQ14_PORT63, GPIO_FN_IRQ14_PORT99,
++ GPIO_FN_IRQ15_PORT62, GPIO_FN_IRQ15_PORT100,
++ GPIO_FN_IRQ16_PORT68, GPIO_FN_IRQ16_PORT211,
++ GPIO_FN_IRQ17,
++ GPIO_FN_IRQ18,
++ GPIO_FN_IRQ19,
++ GPIO_FN_IRQ20,
++ GPIO_FN_IRQ21,
++ GPIO_FN_IRQ22,
++ GPIO_FN_IRQ23,
++ GPIO_FN_IRQ24,
++ GPIO_FN_IRQ25,
++ GPIO_FN_IRQ26_PORT58, GPIO_FN_IRQ26_PORT81,
++ GPIO_FN_IRQ27_PORT57, GPIO_FN_IRQ27_PORT168,
++ GPIO_FN_IRQ28_PORT56, GPIO_FN_IRQ28_PORT169,
++ GPIO_FN_IRQ29_PORT50, GPIO_FN_IRQ29_PORT170,
++ GPIO_FN_IRQ30_PORT49, GPIO_FN_IRQ30_PORT171,
++ GPIO_FN_IRQ31_PORT41, GPIO_FN_IRQ31_PORT167,
++
++ /* Function */
++
++ /* DBGT */
++ GPIO_FN_DBGMDT2, GPIO_FN_DBGMDT1, GPIO_FN_DBGMDT0,
++ GPIO_FN_DBGMD10, GPIO_FN_DBGMD11, GPIO_FN_DBGMD20,
++ GPIO_FN_DBGMD21,
++
++ /* FSI */
++ GPIO_FN_FSIAISLD_PORT0, /* FSIAISLD Port 0/5 */
++ GPIO_FN_FSIAISLD_PORT5,
++ GPIO_FN_FSIASPDIF_PORT9, /* FSIASPDIF Port 9/18 */
++ GPIO_FN_FSIASPDIF_PORT18,
++ GPIO_FN_FSIAOSLD1, GPIO_FN_FSIAOSLD2,
++ GPIO_FN_FSIAOLR, GPIO_FN_FSIAOBT,
++ GPIO_FN_FSIAOSLD, GPIO_FN_FSIAOMC,
++ GPIO_FN_FSIACK, GPIO_FN_FSIAILR,
++ GPIO_FN_FSIAIBT,
++
++ /* FMSI */
++ GPIO_FN_FMSISLD_PORT1, /* FMSISLD Port 1/6 */
++ GPIO_FN_FMSISLD_PORT6,
++ GPIO_FN_FMSIILR, GPIO_FN_FMSIIBT,
++ GPIO_FN_FMSIOLR, GPIO_FN_FMSIOBT,
++ GPIO_FN_FMSICK, GPIO_FN_FMSOILR,
++ GPIO_FN_FMSOIBT, GPIO_FN_FMSOOLR,
++ GPIO_FN_FMSOOBT, GPIO_FN_FMSOSLD,
++ GPIO_FN_FMSOCK,
++
++ /* SCIFA0 */
++ GPIO_FN_SCIFA0_SCK, GPIO_FN_SCIFA0_CTS,
++ GPIO_FN_SCIFA0_RTS, GPIO_FN_SCIFA0_RXD,
++ GPIO_FN_SCIFA0_TXD,
++
++ /* SCIFA1 */
++ GPIO_FN_SCIFA1_CTS, GPIO_FN_SCIFA1_SCK,
++ GPIO_FN_SCIFA1_RXD, GPIO_FN_SCIFA1_TXD,
++ GPIO_FN_SCIFA1_RTS,
++
++ /* SCIFA2 */
++ GPIO_FN_SCIFA2_SCK_PORT22, /* SCIFA2_SCK Port 22/199 */
++ GPIO_FN_SCIFA2_SCK_PORT199,
++ GPIO_FN_SCIFA2_RXD, GPIO_FN_SCIFA2_TXD,
++ GPIO_FN_SCIFA2_CTS, GPIO_FN_SCIFA2_RTS,
++
++ /* SCIFA3 */
++ GPIO_FN_SCIFA3_RTS_PORT105, /* MSEL5CR_8_0 */
++ GPIO_FN_SCIFA3_SCK_PORT116,
++ GPIO_FN_SCIFA3_CTS_PORT117,
++ GPIO_FN_SCIFA3_RXD_PORT174,
++ GPIO_FN_SCIFA3_TXD_PORT175,
++
++ GPIO_FN_SCIFA3_RTS_PORT161, /* MSEL5CR_8_1 */
++ GPIO_FN_SCIFA3_SCK_PORT158,
++ GPIO_FN_SCIFA3_CTS_PORT162,
++ GPIO_FN_SCIFA3_RXD_PORT159,
++ GPIO_FN_SCIFA3_TXD_PORT160,
++
++ /* SCIFA4 */
++ GPIO_FN_SCIFA4_RXD_PORT12, /* MSEL5CR[12:11] = 00 */
++ GPIO_FN_SCIFA4_TXD_PORT13,
++
++ GPIO_FN_SCIFA4_RXD_PORT204, /* MSEL5CR[12:11] = 01 */
++ GPIO_FN_SCIFA4_TXD_PORT203,
++
++ GPIO_FN_SCIFA4_RXD_PORT94, /* MSEL5CR[12:11] = 10 */
++ GPIO_FN_SCIFA4_TXD_PORT93,
++
++ GPIO_FN_SCIFA4_SCK_PORT21, /* SCIFA4_SCK Port 21/205 */
++ GPIO_FN_SCIFA4_SCK_PORT205,
++
++ /* SCIFA5 */
++ GPIO_FN_SCIFA5_TXD_PORT20, /* MSEL5CR[15:14] = 00 */
++ GPIO_FN_SCIFA5_RXD_PORT10,
++
++ GPIO_FN_SCIFA5_RXD_PORT207, /* MSEL5CR[15:14] = 01 */
++ GPIO_FN_SCIFA5_TXD_PORT208,
++
++ GPIO_FN_SCIFA5_TXD_PORT91, /* MSEL5CR[15:14] = 10 */
++ GPIO_FN_SCIFA5_RXD_PORT92,
++
++ GPIO_FN_SCIFA5_SCK_PORT23, /* SCIFA5_SCK Port 23/206 */
++ GPIO_FN_SCIFA5_SCK_PORT206,
++
++ /* SCIFA6 */
++ GPIO_FN_SCIFA6_SCK, GPIO_FN_SCIFA6_RXD, GPIO_FN_SCIFA6_TXD,
++
++ /* SCIFA7 */
++ GPIO_FN_SCIFA7_TXD, GPIO_FN_SCIFA7_RXD,
++
++ /* SCIFAB */
++ GPIO_FN_SCIFB_SCK_PORT190, /* MSEL5CR_17_0 */
++ GPIO_FN_SCIFB_RXD_PORT191,
++ GPIO_FN_SCIFB_TXD_PORT192,
++ GPIO_FN_SCIFB_RTS_PORT186,
++ GPIO_FN_SCIFB_CTS_PORT187,
++
++ GPIO_FN_SCIFB_SCK_PORT2, /* MSEL5CR_17_1 */
++ GPIO_FN_SCIFB_RXD_PORT3,
++ GPIO_FN_SCIFB_TXD_PORT4,
++ GPIO_FN_SCIFB_RTS_PORT172,
++ GPIO_FN_SCIFB_CTS_PORT173,
++
++ /* LCD0 */
++ GPIO_FN_LCDC0_SELECT,
++ GPIO_FN_LCD0_D0, GPIO_FN_LCD0_D1, GPIO_FN_LCD0_D2,
++ GPIO_FN_LCD0_D3, GPIO_FN_LCD0_D4, GPIO_FN_LCD0_D5,
++ GPIO_FN_LCD0_D6, GPIO_FN_LCD0_D7, GPIO_FN_LCD0_D8,
++ GPIO_FN_LCD0_D9, GPIO_FN_LCD0_D10, GPIO_FN_LCD0_D11,
++ GPIO_FN_LCD0_D12, GPIO_FN_LCD0_D13, GPIO_FN_LCD0_D14,
++ GPIO_FN_LCD0_D15, GPIO_FN_LCD0_D16, GPIO_FN_LCD0_D17,
++ GPIO_FN_LCD0_DON, GPIO_FN_LCD0_VCPWC, GPIO_FN_LCD0_VEPWC,
++
++ GPIO_FN_LCD0_DCK, GPIO_FN_LCD0_VSYN, /* for RGB */
++ GPIO_FN_LCD0_HSYN, GPIO_FN_LCD0_DISP, /* for RGB */
++
++ GPIO_FN_LCD0_WR, GPIO_FN_LCD0_RD, /* for SYS */
++ GPIO_FN_LCD0_CS, GPIO_FN_LCD0_RS, /* for SYS */
++
++ GPIO_FN_LCD0_D18_PORT163, GPIO_FN_LCD0_D19_PORT162,
++ GPIO_FN_LCD0_D20_PORT161, GPIO_FN_LCD0_D21_PORT158,
++ GPIO_FN_LCD0_D22_PORT160, GPIO_FN_LCD0_D23_PORT159,
++ GPIO_FN_LCD0_LCLK_PORT165, /* MSEL5CR_6_1 */
++
++ GPIO_FN_LCD0_D18_PORT40, GPIO_FN_LCD0_D19_PORT4,
++ GPIO_FN_LCD0_D20_PORT3, GPIO_FN_LCD0_D21_PORT2,
++ GPIO_FN_LCD0_D22_PORT0, GPIO_FN_LCD0_D23_PORT1,
++ GPIO_FN_LCD0_LCLK_PORT102, /* MSEL5CR_6_0 */
++
++ /* LCD1 */
++ GPIO_FN_LCDC1_SELECT,
++ GPIO_FN_LCD1_D0, GPIO_FN_LCD1_D1, GPIO_FN_LCD1_D2,
++ GPIO_FN_LCD1_D3, GPIO_FN_LCD1_D4, GPIO_FN_LCD1_D5,
++ GPIO_FN_LCD1_D6, GPIO_FN_LCD1_D7, GPIO_FN_LCD1_D8,
++ GPIO_FN_LCD1_D9, GPIO_FN_LCD1_D10, GPIO_FN_LCD1_D11,
++ GPIO_FN_LCD1_D12, GPIO_FN_LCD1_D13, GPIO_FN_LCD1_D14,
++ GPIO_FN_LCD1_D15, GPIO_FN_LCD1_D16, GPIO_FN_LCD1_D17,
++ GPIO_FN_LCD1_D18, GPIO_FN_LCD1_D19, GPIO_FN_LCD1_D20,
++ GPIO_FN_LCD1_D21, GPIO_FN_LCD1_D22, GPIO_FN_LCD1_D23,
++ GPIO_FN_LCD1_DON, GPIO_FN_LCD1_VCPWC,
++ GPIO_FN_LCD1_LCLK, GPIO_FN_LCD1_VEPWC,
++
++ GPIO_FN_LCD1_DCK, GPIO_FN_LCD1_VSYN, /* for RGB */
++ GPIO_FN_LCD1_HSYN, GPIO_FN_LCD1_DISP, /* for RGB */
++
++ GPIO_FN_LCD1_WR, GPIO_FN_LCD1_RD, /* for SYS */
++ GPIO_FN_LCD1_CS, GPIO_FN_LCD1_RS, /* for SYS */
++
++ /* RSPI */
++ GPIO_FN_RSPI_SSL0_A, GPIO_FN_RSPI_SSL1_A,
++ GPIO_FN_RSPI_SSL2_A, GPIO_FN_RSPI_SSL3_A,
++ GPIO_FN_RSPI_MOSI_A, GPIO_FN_RSPI_MISO_A,
++ GPIO_FN_RSPI_CK_A,
++
++ /* VIO CKO */
++ GPIO_FN_VIO_CKO1,
++ GPIO_FN_VIO_CKO2,
++ GPIO_FN_VIO_CKO_1,
++ GPIO_FN_VIO_CKO,
++
++ /* VIO0 */
++ GPIO_FN_VIO0_D0, GPIO_FN_VIO0_D1, GPIO_FN_VIO0_D2,
++ GPIO_FN_VIO0_D3, GPIO_FN_VIO0_D4, GPIO_FN_VIO0_D5,
++ GPIO_FN_VIO0_D6, GPIO_FN_VIO0_D7, GPIO_FN_VIO0_D8,
++ GPIO_FN_VIO0_D9, GPIO_FN_VIO0_D10, GPIO_FN_VIO0_D11,
++ GPIO_FN_VIO0_D12, GPIO_FN_VIO0_VD, GPIO_FN_VIO0_HD,
++ GPIO_FN_VIO0_CLK, GPIO_FN_VIO0_FIELD,
++
++ GPIO_FN_VIO0_D13_PORT26, /* MSEL5CR_27_0 */
++ GPIO_FN_VIO0_D14_PORT25,
++ GPIO_FN_VIO0_D15_PORT24,
++
++ GPIO_FN_VIO0_D13_PORT22, /* MSEL5CR_27_1 */
++ GPIO_FN_VIO0_D14_PORT95,
++ GPIO_FN_VIO0_D15_PORT96,
++
++ /* VIO1 */
++ GPIO_FN_VIO1_D0, GPIO_FN_VIO1_D1, GPIO_FN_VIO1_D2,
++ GPIO_FN_VIO1_D3, GPIO_FN_VIO1_D4, GPIO_FN_VIO1_D5,
++ GPIO_FN_VIO1_D6, GPIO_FN_VIO1_D7, GPIO_FN_VIO1_VD,
++ GPIO_FN_VIO1_HD, GPIO_FN_VIO1_CLK, GPIO_FN_VIO1_FIELD,
++
++ /* TPU0 */
++ GPIO_FN_TPU0TO0, GPIO_FN_TPU0TO1,
++ GPIO_FN_TPU0TO3,
++ GPIO_FN_TPU0TO2_PORT66, /* TPU0TO2 Port 66/202 */
++ GPIO_FN_TPU0TO2_PORT202,
++
++ /* SSP1 0 */
++ GPIO_FN_STP0_IPD0, GPIO_FN_STP0_IPD1, GPIO_FN_STP0_IPD2,
++ GPIO_FN_STP0_IPD3, GPIO_FN_STP0_IPD4, GPIO_FN_STP0_IPD5,
++ GPIO_FN_STP0_IPD6, GPIO_FN_STP0_IPD7, GPIO_FN_STP0_IPEN,
++ GPIO_FN_STP0_IPCLK, GPIO_FN_STP0_IPSYNC,
++
++ /* SSP1 1 */
++ GPIO_FN_STP1_IPD1, GPIO_FN_STP1_IPD2, GPIO_FN_STP1_IPD3,
++ GPIO_FN_STP1_IPD4, GPIO_FN_STP1_IPD5, GPIO_FN_STP1_IPD6,
++ GPIO_FN_STP1_IPD7, GPIO_FN_STP1_IPCLK, GPIO_FN_STP1_IPSYNC,
++
++ GPIO_FN_STP1_IPD0_PORT186, /* MSEL5CR_23_0 */
++ GPIO_FN_STP1_IPEN_PORT187,
++
++ GPIO_FN_STP1_IPD0_PORT194, /* MSEL5CR_23_1 */
++ GPIO_FN_STP1_IPEN_PORT193,
++
++ /* SIM */
++ GPIO_FN_SIM_RST, GPIO_FN_SIM_CLK,
++ GPIO_FN_SIM_D_PORT22, /* SIM_D Port 22/199 */
++ GPIO_FN_SIM_D_PORT199,
++
++ /* SDHI0 */
++ GPIO_FN_SDHI0_D0, GPIO_FN_SDHI0_D1, GPIO_FN_SDHI0_D2,
++ GPIO_FN_SDHI0_D3, GPIO_FN_SDHI0_CD, GPIO_FN_SDHI0_WP,
++ GPIO_FN_SDHI0_CMD, GPIO_FN_SDHI0_CLK,
++
++ /* SDHI1 */
++ GPIO_FN_SDHI1_D0, GPIO_FN_SDHI1_D1, GPIO_FN_SDHI1_D2,
++ GPIO_FN_SDHI1_D3, GPIO_FN_SDHI1_CD, GPIO_FN_SDHI1_WP,
++ GPIO_FN_SDHI1_CMD, GPIO_FN_SDHI1_CLK,
++
++ /* SDHI2 */
++ GPIO_FN_SDHI2_D0, GPIO_FN_SDHI2_D1, GPIO_FN_SDHI2_D2,
++ GPIO_FN_SDHI2_D3, GPIO_FN_SDHI2_CLK, GPIO_FN_SDHI2_CMD,
++
++ GPIO_FN_SDHI2_CD_PORT24, /* MSEL5CR_19_0 */
++ GPIO_FN_SDHI2_WP_PORT25,
++
++ GPIO_FN_SDHI2_WP_PORT177, /* MSEL5CR_19_1 */
++ GPIO_FN_SDHI2_CD_PORT202,
++
++ /* MSIOF2 */
++ GPIO_FN_MSIOF2_TXD, GPIO_FN_MSIOF2_RXD, GPIO_FN_MSIOF2_TSCK,
++ GPIO_FN_MSIOF2_SS2, GPIO_FN_MSIOF2_TSYNC, GPIO_FN_MSIOF2_SS1,
++ GPIO_FN_MSIOF2_MCK1, GPIO_FN_MSIOF2_MCK0, GPIO_FN_MSIOF2_RSYNC,
++ GPIO_FN_MSIOF2_RSCK,
++
++ /* KEYSC */
++ GPIO_FN_KEYIN4, GPIO_FN_KEYIN5,
++ GPIO_FN_KEYIN6, GPIO_FN_KEYIN7,
++ GPIO_FN_KEYOUT0, GPIO_FN_KEYOUT1, GPIO_FN_KEYOUT2,
++ GPIO_FN_KEYOUT3, GPIO_FN_KEYOUT4, GPIO_FN_KEYOUT5,
++ GPIO_FN_KEYOUT6, GPIO_FN_KEYOUT7,
++
++ GPIO_FN_KEYIN0_PORT43, /* MSEL4CR_18_0 */
++ GPIO_FN_KEYIN1_PORT44,
++ GPIO_FN_KEYIN2_PORT45,
++ GPIO_FN_KEYIN3_PORT46,
++
++ GPIO_FN_KEYIN0_PORT58, /* MSEL4CR_18_1 */
++ GPIO_FN_KEYIN1_PORT57,
++ GPIO_FN_KEYIN2_PORT56,
++ GPIO_FN_KEYIN3_PORT55,
++
++ /* VOU */
++ GPIO_FN_DV_D0, GPIO_FN_DV_D1, GPIO_FN_DV_D2, GPIO_FN_DV_D3,
++ GPIO_FN_DV_D4, GPIO_FN_DV_D5, GPIO_FN_DV_D6, GPIO_FN_DV_D7,
++ GPIO_FN_DV_D8, GPIO_FN_DV_D9, GPIO_FN_DV_D10, GPIO_FN_DV_D11,
++ GPIO_FN_DV_D12, GPIO_FN_DV_D13, GPIO_FN_DV_D14, GPIO_FN_DV_D15,
++ GPIO_FN_DV_CLK,
++ GPIO_FN_DV_VSYNC,
++ GPIO_FN_DV_HSYNC,
++
++ /* MEMC */
++ GPIO_FN_MEMC_AD0, GPIO_FN_MEMC_AD1, GPIO_FN_MEMC_AD2,
++ GPIO_FN_MEMC_AD3, GPIO_FN_MEMC_AD4, GPIO_FN_MEMC_AD5,
++ GPIO_FN_MEMC_AD6, GPIO_FN_MEMC_AD7, GPIO_FN_MEMC_AD8,
++ GPIO_FN_MEMC_AD9, GPIO_FN_MEMC_AD10, GPIO_FN_MEMC_AD11,
++ GPIO_FN_MEMC_AD12, GPIO_FN_MEMC_AD13, GPIO_FN_MEMC_AD14,
++ GPIO_FN_MEMC_AD15, GPIO_FN_MEMC_CS0, GPIO_FN_MEMC_INT,
++ GPIO_FN_MEMC_NWE, GPIO_FN_MEMC_NOE,
++
++ GPIO_FN_MEMC_CS1, /* MSEL4CR_6_0 */
++ GPIO_FN_MEMC_ADV,
++ GPIO_FN_MEMC_WAIT,
++ GPIO_FN_MEMC_BUSCLK,
++
++ GPIO_FN_MEMC_A1, /* MSEL4CR_6_1 */
++ GPIO_FN_MEMC_DREQ0,
++ GPIO_FN_MEMC_DREQ1,
++ GPIO_FN_MEMC_A0,
++
++ /* MMC */
++ GPIO_FN_MMC0_D0_PORT68, GPIO_FN_MMC0_D1_PORT69,
++ GPIO_FN_MMC0_D2_PORT70, GPIO_FN_MMC0_D3_PORT71,
++ GPIO_FN_MMC0_D4_PORT72, GPIO_FN_MMC0_D5_PORT73,
++ GPIO_FN_MMC0_D6_PORT74, GPIO_FN_MMC0_D7_PORT75,
++ GPIO_FN_MMC0_CLK_PORT66,
++ GPIO_FN_MMC0_CMD_PORT67, /* MSEL4CR_15_0 */
++
++ GPIO_FN_MMC1_D0_PORT149, GPIO_FN_MMC1_D1_PORT148,
++ GPIO_FN_MMC1_D2_PORT147, GPIO_FN_MMC1_D3_PORT146,
++ GPIO_FN_MMC1_D4_PORT145, GPIO_FN_MMC1_D5_PORT144,
++ GPIO_FN_MMC1_D6_PORT143, GPIO_FN_MMC1_D7_PORT142,
++ GPIO_FN_MMC1_CLK_PORT103,
++ GPIO_FN_MMC1_CMD_PORT104, /* MSEL4CR_15_1 */
++
++ /* MSIOF0 */
++ GPIO_FN_MSIOF0_SS1, GPIO_FN_MSIOF0_SS2,
++ GPIO_FN_MSIOF0_RXD, GPIO_FN_MSIOF0_TXD,
++ GPIO_FN_MSIOF0_MCK0, GPIO_FN_MSIOF0_MCK1,
++ GPIO_FN_MSIOF0_RSYNC, GPIO_FN_MSIOF0_RSCK,
++ GPIO_FN_MSIOF0_TSCK, GPIO_FN_MSIOF0_TSYNC,
++
++ /* MSIOF1 */
++ GPIO_FN_MSIOF1_RSCK, GPIO_FN_MSIOF1_RSYNC,
++ GPIO_FN_MSIOF1_MCK0, GPIO_FN_MSIOF1_MCK1,
++
++ GPIO_FN_MSIOF1_SS2_PORT116, GPIO_FN_MSIOF1_SS1_PORT117,
++ GPIO_FN_MSIOF1_RXD_PORT118, GPIO_FN_MSIOF1_TXD_PORT119,
++ GPIO_FN_MSIOF1_TSYNC_PORT120,
++ GPIO_FN_MSIOF1_TSCK_PORT121, /* MSEL4CR_10_0 */
++
++ GPIO_FN_MSIOF1_SS1_PORT67, GPIO_FN_MSIOF1_TSCK_PORT72,
++ GPIO_FN_MSIOF1_TSYNC_PORT73, GPIO_FN_MSIOF1_TXD_PORT74,
++ GPIO_FN_MSIOF1_RXD_PORT75,
++ GPIO_FN_MSIOF1_SS2_PORT202, /* MSEL4CR_10_1 */
++
++ /* GPIO */
++ GPIO_FN_GPO0, GPIO_FN_GPI0,
++ GPIO_FN_GPO1, GPIO_FN_GPI1,
++
++ /* USB0 */
++ GPIO_FN_USB0_OCI, GPIO_FN_USB0_PPON, GPIO_FN_VBUS,
++
++ /* USB1 */
++ GPIO_FN_USB1_OCI, GPIO_FN_USB1_PPON,
++
++ /* BBIF1 */
++ GPIO_FN_BBIF1_RXD, GPIO_FN_BBIF1_TXD, GPIO_FN_BBIF1_TSYNC,
++ GPIO_FN_BBIF1_TSCK, GPIO_FN_BBIF1_RSCK, GPIO_FN_BBIF1_RSYNC,
++ GPIO_FN_BBIF1_FLOW, GPIO_FN_BBIF1_RX_FLOW_N,
++
++ /* BBIF2 */
++ GPIO_FN_BBIF2_TXD2_PORT5, /* MSEL5CR_0_0 */
++ GPIO_FN_BBIF2_RXD2_PORT60,
++ GPIO_FN_BBIF2_TSYNC2_PORT6,
++ GPIO_FN_BBIF2_TSCK2_PORT59,
++
++ GPIO_FN_BBIF2_RXD2_PORT90, /* MSEL5CR_0_1 */
++ GPIO_FN_BBIF2_TXD2_PORT183,
++ GPIO_FN_BBIF2_TSCK2_PORT89,
++ GPIO_FN_BBIF2_TSYNC2_PORT184,
++
++ /* BSC / FLCTL / PCMCIA */
++ GPIO_FN_CS0, GPIO_FN_CS2, GPIO_FN_CS4,
++ GPIO_FN_CS5B, GPIO_FN_CS6A,
++ GPIO_FN_CS5A_PORT105, /* CS5A PORT 19/105 */
++ GPIO_FN_CS5A_PORT19,
++ GPIO_FN_IOIS16, /* ? */
++
++ GPIO_FN_A0, GPIO_FN_A1, GPIO_FN_A2, GPIO_FN_A3,
++ GPIO_FN_A4_FOE, /* share with FLCTL */
++ GPIO_FN_A5_FCDE, /* share with FLCTL */
++ GPIO_FN_A6, GPIO_FN_A7, GPIO_FN_A8, GPIO_FN_A9,
++ GPIO_FN_A10, GPIO_FN_A11, GPIO_FN_A12, GPIO_FN_A13,
++ GPIO_FN_A14, GPIO_FN_A15, GPIO_FN_A16, GPIO_FN_A17,
++ GPIO_FN_A18, GPIO_FN_A19, GPIO_FN_A20, GPIO_FN_A21,
++ GPIO_FN_A22, GPIO_FN_A23, GPIO_FN_A24, GPIO_FN_A25,
++ GPIO_FN_A26,
++
++ GPIO_FN_D0_NAF0, GPIO_FN_D1_NAF1, /* share with FLCTL */
++ GPIO_FN_D2_NAF2, GPIO_FN_D3_NAF3, /* share with FLCTL */
++ GPIO_FN_D4_NAF4, GPIO_FN_D5_NAF5, /* share with FLCTL */
++ GPIO_FN_D6_NAF6, GPIO_FN_D7_NAF7, /* share with FLCTL */
++ GPIO_FN_D8_NAF8, GPIO_FN_D9_NAF9, /* share with FLCTL */
++ GPIO_FN_D10_NAF10, GPIO_FN_D11_NAF11, /* share with FLCTL */
++ GPIO_FN_D12_NAF12, GPIO_FN_D13_NAF13, /* share with FLCTL */
++ GPIO_FN_D14_NAF14, GPIO_FN_D15_NAF15, /* share with FLCTL */
++
++ GPIO_FN_D16, GPIO_FN_D17, GPIO_FN_D18, GPIO_FN_D19,
++ GPIO_FN_D20, GPIO_FN_D21, GPIO_FN_D22, GPIO_FN_D23,
++ GPIO_FN_D24, GPIO_FN_D25, GPIO_FN_D26, GPIO_FN_D27,
++ GPIO_FN_D28, GPIO_FN_D29, GPIO_FN_D30, GPIO_FN_D31,
++
++ GPIO_FN_WE0_FWE, /* share with FLCTL */
++ GPIO_FN_WE1,
++ GPIO_FN_WE2_ICIORD, /* share with PCMCIA */
++ GPIO_FN_WE3_ICIOWR, /* share with PCMCIA */
++ GPIO_FN_CKO, GPIO_FN_BS, GPIO_FN_RDWR,
++ GPIO_FN_RD_FSC, /* share with FLCTL */
++ GPIO_FN_WAIT_PORT177, /* WAIT Port 90/177 */
++ GPIO_FN_WAIT_PORT90,
++
++ GPIO_FN_FCE0, GPIO_FN_FCE1, GPIO_FN_FRB, /* FLCTL */
++
++ /* IRDA */
++ GPIO_FN_IRDA_FIRSEL, GPIO_FN_IRDA_IN, GPIO_FN_IRDA_OUT,
++
++ /* ATAPI */
++ GPIO_FN_IDE_D0, GPIO_FN_IDE_D1, GPIO_FN_IDE_D2,
++ GPIO_FN_IDE_D3, GPIO_FN_IDE_D4, GPIO_FN_IDE_D5,
++ GPIO_FN_IDE_D6, GPIO_FN_IDE_D7, GPIO_FN_IDE_D8,
++ GPIO_FN_IDE_D9, GPIO_FN_IDE_D10, GPIO_FN_IDE_D11,
++ GPIO_FN_IDE_D12, GPIO_FN_IDE_D13, GPIO_FN_IDE_D14,
++ GPIO_FN_IDE_D15, GPIO_FN_IDE_A0, GPIO_FN_IDE_A1,
++ GPIO_FN_IDE_A2, GPIO_FN_IDE_CS0, GPIO_FN_IDE_CS1,
++ GPIO_FN_IDE_IOWR, GPIO_FN_IDE_IORD, GPIO_FN_IDE_IORDY,
++ GPIO_FN_IDE_INT, GPIO_FN_IDE_RST, GPIO_FN_IDE_DIRECTION,
++ GPIO_FN_IDE_EXBUF_ENB, GPIO_FN_IDE_IODACK, GPIO_FN_IDE_IODREQ,
++
++ /* RMII */
++ GPIO_FN_RMII_CRS_DV, GPIO_FN_RMII_RX_ER, GPIO_FN_RMII_RXD0,
++ GPIO_FN_RMII_RXD1, GPIO_FN_RMII_TX_EN, GPIO_FN_RMII_TXD0,
++ GPIO_FN_RMII_MDC, GPIO_FN_RMII_TXD1, GPIO_FN_RMII_MDIO,
++ GPIO_FN_RMII_REF50CK, /* for RMII */
++ GPIO_FN_RMII_REF125CK, /* for GMII */
++
++ /* GEther */
++ GPIO_FN_ET_TX_CLK, GPIO_FN_ET_TX_EN, GPIO_FN_ET_ETXD0,
++ GPIO_FN_ET_ETXD1, GPIO_FN_ET_ETXD2, GPIO_FN_ET_ETXD3,
++ GPIO_FN_ET_ETXD4, GPIO_FN_ET_ETXD5, /* for GEther */
++ GPIO_FN_ET_ETXD6, GPIO_FN_ET_ETXD7, /* for GEther */
++ GPIO_FN_ET_COL, GPIO_FN_ET_TX_ER,
++ GPIO_FN_ET_RX_CLK, GPIO_FN_ET_RX_DV,
++ GPIO_FN_ET_ERXD0, GPIO_FN_ET_ERXD1,
++ GPIO_FN_ET_ERXD2, GPIO_FN_ET_ERXD3,
++ GPIO_FN_ET_ERXD4, GPIO_FN_ET_ERXD5, /* for GEther */
++ GPIO_FN_ET_ERXD6, GPIO_FN_ET_ERXD7, /* for GEther */
++ GPIO_FN_ET_RX_ER, GPIO_FN_ET_CRS,
++ GPIO_FN_ET_MDC, GPIO_FN_ET_MDIO,
++ GPIO_FN_ET_LINK, GPIO_FN_ET_PHY_INT,
++ GPIO_FN_ET_WOL, GPIO_FN_ET_GTX_CLK,
++
++ /* DMA0 */
++ GPIO_FN_DREQ0, GPIO_FN_DACK0,
++
++ /* DMA1 */
++ GPIO_FN_DREQ1, GPIO_FN_DACK1,
++
++ /* SYSC */
++ GPIO_FN_RESETOUTS,
++ GPIO_FN_RESETP_PULLUP,
++ GPIO_FN_RESETP_PLAIN,
++
++ /* SDENC */
++ GPIO_FN_SDENC_CPG,
++ GPIO_FN_SDENC_DV_CLKI,
++
++ /* IRREM */
++ GPIO_FN_IROUT,
++
++ /* DEBUG */
++ GPIO_FN_EDEBGREQ_PULLDOWN,
++ GPIO_FN_EDEBGREQ_PULLUP,
++
++ GPIO_FN_TRACEAUD_FROM_VIO,
++ GPIO_FN_TRACEAUD_FROM_LCDC0,
++ GPIO_FN_TRACEAUD_FROM_MEMC,
++};
++
++#endif /* __ASM_R8A7740_H__ */
+diff --git a/arch/arm/mach-shmobile/intc-r8a7740.c b/arch/arm/mach-shmobile/intc-r8a7740.c
+new file mode 100644
+index 0000000..c62a205
+--- /dev/null
++++ b/arch/arm/mach-shmobile/intc-r8a7740.c
+@@ -0,0 +1,45 @@
++/*
++ * 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; 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
++ */
++
++#include <linux/irq.h>
++#include <linux/io.h>
++#include <asm/hardware/gic.h>
++
++#define INTA_CTRL 0xe605807c
++
++static int r8a7740_set_wake(struct irq_data *data, unsigned int on)
++{
++ return 0; /* always allow wakeup */
++}
++
++void __init r8a7740_init_irq(void)
++{
++ void __iomem *gic_dist_base = __io(0xf0001000);
++ void __iomem *gic_cpu_base = __io(0xf0000000);
++
++ /*
++ * Change INT_SEL INTCA->GIC
++ * (on GPIO)
++ */
++ __raw_writel(__raw_readl(INTA_CTRL) & ~(1 << 1), INTA_CTRL);
++
++ gic_init(0, 29, gic_dist_base, gic_cpu_base);
++ gic_arch_extn.irq_set_wake = r8a7740_set_wake;
++}
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+new file mode 100644
+index 0000000..5548518
+--- /dev/null
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -0,0 +1,246 @@
++/*
++ * 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; 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
++ */
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/serial_sci.h>
++#include <linux/sh_timer.h>
++#include <mach/r8a7740.h>
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
++
++/* SCIFA0 */
++static struct plat_sci_port scif0_platform_data = {
++ .mapbase = 0xe6c40000,
++ .flags = UPF_BOOT_AUTOCONF,
++ .scscr = SCSCR_RE | SCSCR_TE,
++ .scbrr_algo_id = SCBRR_ALGO_4,
++ .type = PORT_SCIFA,
++ .irqs = SCIx_IRQ_MUXED(gic_spi(100)),
++};
++
++static struct platform_device scif0_device = {
++ .name = "sh-sci",
++ .id = 0,
++ .dev = {
++ .platform_data = &scif0_platform_data,
++ },
++};
++
++/* SCIFA1 */
++static struct plat_sci_port scif1_platform_data = {
++ .mapbase = 0xe6c50000,
++ .flags = UPF_BOOT_AUTOCONF,
++ .scscr = SCSCR_RE | SCSCR_TE,
++ .scbrr_algo_id = SCBRR_ALGO_4,
++ .type = PORT_SCIFA,
++ .irqs = SCIx_IRQ_MUXED(gic_spi(101)),
++};
++
++static struct platform_device scif1_device = {
++ .name = "sh-sci",
++ .id = 1,
++ .dev = {
++ .platform_data = &scif1_platform_data,
++ },
++};
++
++/* SCIFA2 */
++static struct plat_sci_port scif2_platform_data = {
++ .mapbase = 0xe6c60000,
++ .flags = UPF_BOOT_AUTOCONF,
++ .scscr = SCSCR_RE | SCSCR_TE,
++ .scbrr_algo_id = SCBRR_ALGO_4,
++ .type = PORT_SCIFA,
++ .irqs = SCIx_IRQ_MUXED(gic_spi(102)),
++};
++
++static struct platform_device scif2_device = {
++ .name = "sh-sci",
++ .id = 2,
++ .dev = {
++ .platform_data = &scif2_platform_data,
++ },
++};
++
++/* SCIFA3 */
++static struct plat_sci_port scif3_platform_data = {
++ .mapbase = 0xe6c70000,
++ .flags = UPF_BOOT_AUTOCONF,
++ .scscr = SCSCR_RE | SCSCR_TE,
++ .scbrr_algo_id = SCBRR_ALGO_4,
++ .type = PORT_SCIFA,
++ .irqs = SCIx_IRQ_MUXED(gic_spi(103)),
++};
++
++static struct platform_device scif3_device = {
++ .name = "sh-sci",
++ .id = 3,
++ .dev = {
++ .platform_data = &scif3_platform_data,
++ },
++};
++
++/* SCIFA4 */
++static struct plat_sci_port scif4_platform_data = {
++ .mapbase = 0xe6c80000,
++ .flags = UPF_BOOT_AUTOCONF,
++ .scscr = SCSCR_RE | SCSCR_TE,
++ .scbrr_algo_id = SCBRR_ALGO_4,
++ .type = PORT_SCIFA,
++ .irqs = SCIx_IRQ_MUXED(gic_spi(104)),
++};
++
++static struct platform_device scif4_device = {
++ .name = "sh-sci",
++ .id = 4,
++ .dev = {
++ .platform_data = &scif4_platform_data,
++ },
++};
++
++/* SCIFA5 */
++static struct plat_sci_port scif5_platform_data = {
++ .mapbase = 0xe6cb0000,
++ .flags = UPF_BOOT_AUTOCONF,
++ .scscr = SCSCR_RE | SCSCR_TE,
++ .scbrr_algo_id = SCBRR_ALGO_4,
++ .type = PORT_SCIFA,
++ .irqs = SCIx_IRQ_MUXED(gic_spi(105)),
++};
++
++static struct platform_device scif5_device = {
++ .name = "sh-sci",
++ .id = 5,
++ .dev = {
++ .platform_data = &scif5_platform_data,
++ },
++};
++
++/* SCIFA6 */
++static struct plat_sci_port scif6_platform_data = {
++ .mapbase = 0xe6cc0000,
++ .flags = UPF_BOOT_AUTOCONF,
++ .scscr = SCSCR_RE | SCSCR_TE,
++ .scbrr_algo_id = SCBRR_ALGO_4,
++ .type = PORT_SCIFA,
++ .irqs = SCIx_IRQ_MUXED(gic_spi(106)),
++};
++
++static struct platform_device scif6_device = {
++ .name = "sh-sci",
++ .id = 6,
++ .dev = {
++ .platform_data = &scif6_platform_data,
++ },
++};
++
++/* SCIFA7 */
++static struct plat_sci_port scif7_platform_data = {
++ .mapbase = 0xe6cd0000,
++ .flags = UPF_BOOT_AUTOCONF,
++ .scscr = SCSCR_RE | SCSCR_TE,
++ .scbrr_algo_id = SCBRR_ALGO_4,
++ .type = PORT_SCIFA,
++ .irqs = SCIx_IRQ_MUXED(gic_spi(107)),
++};
++
++static struct platform_device scif7_device = {
++ .name = "sh-sci",
++ .id = 7,
++ .dev = {
++ .platform_data = &scif7_platform_data,
++ },
++};
++
++/* SCIFB */
++static struct plat_sci_port scifb_platform_data = {
++ .mapbase = 0xe6c30000,
++ .flags = UPF_BOOT_AUTOCONF,
++ .scscr = SCSCR_RE | SCSCR_TE,
++ .scbrr_algo_id = SCBRR_ALGO_4,
++ .type = PORT_SCIFB,
++ .irqs = SCIx_IRQ_MUXED(gic_spi(108)),
++};
++
++static struct platform_device scifb_device = {
++ .name = "sh-sci",
++ .id = 8,
++ .dev = {
++ .platform_data = &scifb_platform_data,
++ },
++};
++
++/* CMT */
++static struct sh_timer_config cmt10_platform_data = {
++ .name = "CMT10",
++ .channel_offset = 0x10,
++ .timer_bit = 0,
++ .clockevent_rating = 125,
++ .clocksource_rating = 125,
++};
++
++static struct resource cmt10_resources[] = {
++ [0] = {
++ .name = "CMT10",
++ .start = 0xe6138010,
++ .end = 0xe613801b,
++ .flags = IORESOURCE_MEM,
++ },
++ [1] = {
++ .start = gic_spi(58),
++ .flags = IORESOURCE_IRQ,
++ },
++};
++
++static struct platform_device cmt10_device = {
++ .name = "sh_cmt",
++ .id = 10,
++ .dev = {
++ .platform_data = &cmt10_platform_data,
++ },
++ .resource = cmt10_resources,
++ .num_resources = ARRAY_SIZE(cmt10_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,
++ &scifb_device,
++ &cmt10_device,
++};
++
++void __init r8a7740_add_standard_devices(void)
++{
++ platform_add_devices(r8a7740_early_devices,
++ ARRAY_SIZE(r8a7740_early_devices));
++}
++
++void __init r8a7740_add_early_devices(void)
++{
++ early_platform_add_devices(r8a7740_early_devices,
++ ARRAY_SIZE(r8a7740_early_devices));
++}
+diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
+index b04d937..1bb7130 100644
+--- a/drivers/tty/serial/sh-sci.h
++++ b/drivers/tty/serial/sh-sci.h
+@@ -172,7 +172,9 @@
+ defined(CONFIG_ARCH_SH73A0) || \
+ defined(CONFIG_ARCH_SH7367) || \
+ defined(CONFIG_ARCH_SH7377) || \
+- defined(CONFIG_ARCH_SH7372)
++ defined(CONFIG_ARCH_SH7372) || \
++ defined(CONFIG_ARCH_R8A7740)
++
+ # define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc)
+ # define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73)
+ # define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0058-ARM-mach-shmobile-r8a7740-add-PFC-support.patch b/patches.armadillo800eva/0058-ARM-mach-shmobile-r8a7740-add-PFC-support.patch
new file mode 100644
index 00000000000000..a1467cab10783b
--- /dev/null
+++ b/patches.armadillo800eva/0058-ARM-mach-shmobile-r8a7740-add-PFC-support.patch
@@ -0,0 +1,2602 @@
+From 4aae9084b4e456530984ae916fcd3c21f81c3e9b Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 10 Nov 2011 18:46:08 -0800
+Subject: ARM: mach-shmobile: r8a7740: add PFC support.
+
+This adds PFC support for the R8A7740 (R-Mobile A1) CPU
+This patch is based on v0.1 manual
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 5ade0672f2a2142de216ca705692c9d3238ee650)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/Makefile | 1 +
+ arch/arm/mach-shmobile/pfc-r8a7740.c | 2562 ++++++++++++++++++++++++++++++++++
+ 2 files changed, 2563 insertions(+)
+ create mode 100644 arch/arm/mach-shmobile/pfc-r8a7740.c
+
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index fdbae05..8c2067d 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -24,6 +24,7 @@ pfc-$(CONFIG_ARCH_SH7367) += pfc-sh7367.o
+ pfc-$(CONFIG_ARCH_SH7377) += pfc-sh7377.o
+ pfc-$(CONFIG_ARCH_SH7372) += pfc-sh7372.o
+ pfc-$(CONFIG_ARCH_SH73A0) += pfc-sh73a0.o
++pfc-$(CONFIG_ARCH_R8A7740) += pfc-r8a7740.o
+
+ # IRQ objects
+ obj-$(CONFIG_ARCH_SH7367) += entry-intc.o
+diff --git a/arch/arm/mach-shmobile/pfc-r8a7740.c b/arch/arm/mach-shmobile/pfc-r8a7740.c
+new file mode 100644
+index 0000000..a4fff69
+--- /dev/null
++++ b/arch/arm/mach-shmobile/pfc-r8a7740.c
+@@ -0,0 +1,2562 @@
++/*
++ * 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; 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
++ */
++#include <linux/init.h>
++#include <linux/kernel.h>
++#include <linux/gpio.h>
++#include <mach/r8a7740.h>
++
++#define CPU_ALL_PORT(fn, pfx, sfx) \
++ PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
++ PORT_10(fn, pfx##10, sfx), PORT_90(fn, pfx##1, sfx), \
++ PORT_10(fn, pfx##20, sfx), \
++ PORT_1(fn, pfx##210, sfx), PORT_1(fn, pfx##211, sfx)
++
++enum {
++ PINMUX_RESERVED = 0,
++
++ /* PORT0_DATA -> PORT211_DATA */
++ PINMUX_DATA_BEGIN,
++ PORT_ALL(DATA),
++ PINMUX_DATA_END,
++
++ /* PORT0_IN -> PORT211_IN */
++ PINMUX_INPUT_BEGIN,
++ PORT_ALL(IN),
++ PINMUX_INPUT_END,
++
++ /* PORT0_IN_PU -> PORT211_IN_PU */
++ PINMUX_INPUT_PULLUP_BEGIN,
++ PORT_ALL(IN_PU),
++ PINMUX_INPUT_PULLUP_END,
++
++ /* PORT0_IN_PD -> PORT211_IN_PD */
++ PINMUX_INPUT_PULLDOWN_BEGIN,
++ PORT_ALL(IN_PD),
++ PINMUX_INPUT_PULLDOWN_END,
++
++ /* PORT0_OUT -> PORT211_OUT */
++ PINMUX_OUTPUT_BEGIN,
++ PORT_ALL(OUT),
++ PINMUX_OUTPUT_END,
++
++ PINMUX_FUNCTION_BEGIN,
++ PORT_ALL(FN_IN), /* PORT0_FN_IN -> PORT211_FN_IN */
++ PORT_ALL(FN_OUT), /* PORT0_FN_OUT -> PORT211_FN_OUT */
++ PORT_ALL(FN0), /* PORT0_FN0 -> PORT211_FN0 */
++ PORT_ALL(FN1), /* PORT0_FN1 -> PORT211_FN1 */
++ PORT_ALL(FN2), /* PORT0_FN2 -> PORT211_FN2 */
++ PORT_ALL(FN3), /* PORT0_FN3 -> PORT211_FN3 */
++ PORT_ALL(FN4), /* PORT0_FN4 -> PORT211_FN4 */
++ PORT_ALL(FN5), /* PORT0_FN5 -> PORT211_FN5 */
++ PORT_ALL(FN6), /* PORT0_FN6 -> PORT211_FN6 */
++ PORT_ALL(FN7), /* PORT0_FN7 -> PORT211_FN7 */
++
++ MSEL1CR_31_0, MSEL1CR_31_1,
++ MSEL1CR_30_0, MSEL1CR_30_1,
++ MSEL1CR_29_0, MSEL1CR_29_1,
++ MSEL1CR_28_0, MSEL1CR_28_1,
++ MSEL1CR_27_0, MSEL1CR_27_1,
++ MSEL1CR_26_0, MSEL1CR_26_1,
++ MSEL1CR_16_0, MSEL1CR_16_1,
++ MSEL1CR_15_0, MSEL1CR_15_1,
++ MSEL1CR_14_0, MSEL1CR_14_1,
++ MSEL1CR_13_0, MSEL1CR_13_1,
++ MSEL1CR_12_0, MSEL1CR_12_1,
++ MSEL1CR_9_0, MSEL1CR_9_1,
++ MSEL1CR_7_0, MSEL1CR_7_1,
++ MSEL1CR_6_0, MSEL1CR_6_1,
++ MSEL1CR_5_0, MSEL1CR_5_1,
++ MSEL1CR_4_0, MSEL1CR_4_1,
++ MSEL1CR_3_0, MSEL1CR_3_1,
++ MSEL1CR_2_0, MSEL1CR_2_1,
++ MSEL1CR_0_0, MSEL1CR_0_1,
++
++ MSEL3CR_15_0, MSEL3CR_15_1, /* Trace / Debug ? */
++ MSEL3CR_6_0, MSEL3CR_6_1,
++
++ MSEL4CR_19_0, MSEL4CR_19_1,
++ MSEL4CR_18_0, MSEL4CR_18_1,
++ MSEL4CR_15_0, MSEL4CR_15_1,
++ MSEL4CR_10_0, MSEL4CR_10_1,
++ MSEL4CR_6_0, MSEL4CR_6_1,
++ MSEL4CR_4_0, MSEL4CR_4_1,
++ MSEL4CR_1_0, MSEL4CR_1_1,
++
++ MSEL5CR_31_0, MSEL5CR_31_1, /* irq/fiq output */
++ MSEL5CR_30_0, MSEL5CR_30_1,
++ MSEL5CR_29_0, MSEL5CR_29_1,
++ MSEL5CR_27_0, MSEL5CR_27_1,
++ MSEL5CR_25_0, MSEL5CR_25_1,
++ MSEL5CR_23_0, MSEL5CR_23_1,
++ MSEL5CR_21_0, MSEL5CR_21_1,
++ MSEL5CR_19_0, MSEL5CR_19_1,
++ MSEL5CR_17_0, MSEL5CR_17_1,
++ MSEL5CR_15_0, MSEL5CR_15_1,
++ MSEL5CR_14_0, MSEL5CR_14_1,
++ MSEL5CR_13_0, MSEL5CR_13_1,
++ MSEL5CR_12_0, MSEL5CR_12_1,
++ MSEL5CR_11_0, MSEL5CR_11_1,
++ MSEL5CR_10_0, MSEL5CR_10_1,
++ MSEL5CR_8_0, MSEL5CR_8_1,
++ MSEL5CR_7_0, MSEL5CR_7_1,
++ MSEL5CR_6_0, MSEL5CR_6_1,
++ MSEL5CR_5_0, MSEL5CR_5_1,
++ MSEL5CR_4_0, MSEL5CR_4_1,
++ MSEL5CR_3_0, MSEL5CR_3_1,
++ MSEL5CR_2_0, MSEL5CR_2_1,
++ MSEL5CR_0_0, MSEL5CR_0_1,
++ PINMUX_FUNCTION_END,
++
++ PINMUX_MARK_BEGIN,
++
++ /* IRQ */
++ IRQ0_PORT2_MARK, IRQ0_PORT13_MARK,
++ IRQ1_MARK,
++ IRQ2_PORT11_MARK, IRQ2_PORT12_MARK,
++ IRQ3_PORT10_MARK, IRQ3_PORT14_MARK,
++ IRQ4_PORT15_MARK, IRQ4_PORT172_MARK,
++ IRQ5_PORT0_MARK, IRQ5_PORT1_MARK,
++ IRQ6_PORT121_MARK, IRQ6_PORT173_MARK,
++ IRQ7_PORT120_MARK, IRQ7_PORT209_MARK,
++ IRQ8_MARK,
++ IRQ9_PORT118_MARK, IRQ9_PORT210_MARK,
++ IRQ10_MARK,
++ IRQ11_MARK,
++ IRQ12_PORT42_MARK, IRQ12_PORT97_MARK,
++ IRQ13_PORT64_MARK, IRQ13_PORT98_MARK,
++ IRQ14_PORT63_MARK, IRQ14_PORT99_MARK,
++ IRQ15_PORT62_MARK, IRQ15_PORT100_MARK,
++ IRQ16_PORT68_MARK, IRQ16_PORT211_MARK,
++ IRQ17_MARK,
++ IRQ18_MARK,
++ IRQ19_MARK,
++ IRQ20_MARK,
++ IRQ21_MARK,
++ IRQ22_MARK,
++ IRQ23_MARK,
++ IRQ24_MARK,
++ IRQ25_MARK,
++ IRQ26_PORT58_MARK, IRQ26_PORT81_MARK,
++ IRQ27_PORT57_MARK, IRQ27_PORT168_MARK,
++ IRQ28_PORT56_MARK, IRQ28_PORT169_MARK,
++ IRQ29_PORT50_MARK, IRQ29_PORT170_MARK,
++ IRQ30_PORT49_MARK, IRQ30_PORT171_MARK,
++ IRQ31_PORT41_MARK, IRQ31_PORT167_MARK,
++
++ /* Function */
++
++ /* DBGT */
++ DBGMDT2_MARK, DBGMDT1_MARK, DBGMDT0_MARK,
++ DBGMD10_MARK, DBGMD11_MARK, DBGMD20_MARK,
++ DBGMD21_MARK,
++
++ /* FSI */
++ FSIAISLD_PORT0_MARK, /* FSIAISLD Port 0/5 */
++ FSIAISLD_PORT5_MARK,
++ FSIASPDIF_PORT9_MARK, /* FSIASPDIF Port 9/18 */
++ FSIASPDIF_PORT18_MARK,
++ FSIAOSLD1_MARK, FSIAOSLD2_MARK, FSIAOLR_MARK,
++ FSIAOBT_MARK, FSIAOSLD_MARK, FSIAOMC_MARK,
++ FSIACK_MARK, FSIAILR_MARK, FSIAIBT_MARK,
++
++ /* FMSI */
++ FMSISLD_PORT1_MARK, /* FMSISLD Port 1/6 */
++ FMSISLD_PORT6_MARK,
++ FMSIILR_MARK, FMSIIBT_MARK, FMSIOLR_MARK, FMSIOBT_MARK,
++ FMSICK_MARK, FMSOILR_MARK, FMSOIBT_MARK, FMSOOLR_MARK,
++ FMSOOBT_MARK, FMSOSLD_MARK, FMSOCK_MARK,
++
++ /* SCIFA0 */
++ SCIFA0_SCK_MARK, SCIFA0_CTS_MARK, SCIFA0_RTS_MARK,
++ SCIFA0_RXD_MARK, SCIFA0_TXD_MARK,
++
++ /* SCIFA1 */
++ SCIFA1_CTS_MARK, SCIFA1_SCK_MARK, SCIFA1_RXD_MARK,
++ SCIFA1_TXD_MARK, SCIFA1_RTS_MARK,
++
++ /* SCIFA2 */
++ SCIFA2_SCK_PORT22_MARK, /* SCIFA2_SCK Port 22/199 */
++ SCIFA2_SCK_PORT199_MARK,
++ SCIFA2_RXD_MARK, SCIFA2_TXD_MARK,
++ SCIFA2_CTS_MARK, SCIFA2_RTS_MARK,
++
++ /* SCIFA3 */
++ SCIFA3_RTS_PORT105_MARK, /* MSEL5CR_8_0 */
++ SCIFA3_SCK_PORT116_MARK,
++ SCIFA3_CTS_PORT117_MARK,
++ SCIFA3_RXD_PORT174_MARK,
++ SCIFA3_TXD_PORT175_MARK,
++
++ SCIFA3_RTS_PORT161_MARK, /* MSEL5CR_8_1 */
++ SCIFA3_SCK_PORT158_MARK,
++ SCIFA3_CTS_PORT162_MARK,
++ SCIFA3_RXD_PORT159_MARK,
++ SCIFA3_TXD_PORT160_MARK,
++
++ /* SCIFA4 */
++ SCIFA4_RXD_PORT12_MARK, /* MSEL5CR[12:11] = 00 */
++ SCIFA4_TXD_PORT13_MARK,
++
++ SCIFA4_RXD_PORT204_MARK, /* MSEL5CR[12:11] = 01 */
++ SCIFA4_TXD_PORT203_MARK,
++
++ SCIFA4_RXD_PORT94_MARK, /* MSEL5CR[12:11] = 10 */
++ SCIFA4_TXD_PORT93_MARK,
++
++ SCIFA4_SCK_PORT21_MARK, /* SCIFA4_SCK Port 21/205 */
++ SCIFA4_SCK_PORT205_MARK,
++
++ /* SCIFA5 */
++ SCIFA5_TXD_PORT20_MARK, /* MSEL5CR[15:14] = 00 */
++ SCIFA5_RXD_PORT10_MARK,
++
++ SCIFA5_RXD_PORT207_MARK, /* MSEL5CR[15:14] = 01 */
++ SCIFA5_TXD_PORT208_MARK,
++
++ SCIFA5_TXD_PORT91_MARK, /* MSEL5CR[15:14] = 10 */
++ SCIFA5_RXD_PORT92_MARK,
++
++ SCIFA5_SCK_PORT23_MARK, /* SCIFA5_SCK Port 23/206 */
++ SCIFA5_SCK_PORT206_MARK,
++
++ /* SCIFA6 */
++ SCIFA6_SCK_MARK, SCIFA6_RXD_MARK, SCIFA6_TXD_MARK,
++
++ /* SCIFA7 */
++ SCIFA7_TXD_MARK, SCIFA7_RXD_MARK,
++
++ /* SCIFAB */
++ SCIFB_SCK_PORT190_MARK, /* MSEL5CR_17_0 */
++ SCIFB_RXD_PORT191_MARK,
++ SCIFB_TXD_PORT192_MARK,
++ SCIFB_RTS_PORT186_MARK,
++ SCIFB_CTS_PORT187_MARK,
++
++ SCIFB_SCK_PORT2_MARK, /* MSEL5CR_17_1 */
++ SCIFB_RXD_PORT3_MARK,
++ SCIFB_TXD_PORT4_MARK,
++ SCIFB_RTS_PORT172_MARK,
++ SCIFB_CTS_PORT173_MARK,
++
++ /* LCD0 */
++ LCDC0_SELECT_MARK,
++
++ LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
++ LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
++ LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
++ LCD0_D12_MARK, LCD0_D13_MARK, LCD0_D14_MARK, LCD0_D15_MARK,
++ LCD0_D16_MARK, LCD0_D17_MARK,
++ LCD0_DON_MARK, LCD0_VCPWC_MARK, LCD0_VEPWC_MARK,
++ LCD0_DCK_MARK, LCD0_VSYN_MARK, /* for RGB */
++ LCD0_HSYN_MARK, LCD0_DISP_MARK, /* for RGB */
++ LCD0_WR_MARK, LCD0_RD_MARK, /* for SYS */
++ LCD0_CS_MARK, LCD0_RS_MARK, /* for SYS */
++
++ LCD0_D21_PORT158_MARK, LCD0_D23_PORT159_MARK, /* MSEL5CR_6_1 */
++ LCD0_D22_PORT160_MARK, LCD0_D20_PORT161_MARK,
++ LCD0_D19_PORT162_MARK, LCD0_D18_PORT163_MARK,
++ LCD0_LCLK_PORT165_MARK,
++
++ LCD0_D18_PORT40_MARK, LCD0_D22_PORT0_MARK, /* MSEL5CR_6_0 */
++ LCD0_D23_PORT1_MARK, LCD0_D21_PORT2_MARK,
++ LCD0_D20_PORT3_MARK, LCD0_D19_PORT4_MARK,
++ LCD0_LCLK_PORT102_MARK,
++
++ /* LCD1 */
++ LCDC1_SELECT_MARK,
++
++ LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
++ LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
++ LCD1_D8_MARK, LCD1_D9_MARK, LCD1_D10_MARK, LCD1_D11_MARK,
++ LCD1_D12_MARK, LCD1_D13_MARK, LCD1_D14_MARK, LCD1_D15_MARK,
++ LCD1_D16_MARK, LCD1_D17_MARK, LCD1_D18_MARK, LCD1_D19_MARK,
++ LCD1_D20_MARK, LCD1_D21_MARK, LCD1_D22_MARK, LCD1_D23_MARK,
++ LCD1_DON_MARK, LCD1_VCPWC_MARK,
++ LCD1_LCLK_MARK, LCD1_VEPWC_MARK,
++
++ LCD1_DCK_MARK, LCD1_VSYN_MARK, /* for RGB */
++ LCD1_HSYN_MARK, LCD1_DISP_MARK, /* for RGB */
++ LCD1_RS_MARK, LCD1_CS_MARK, /* for SYS */
++ LCD1_RD_MARK, LCD1_WR_MARK, /* for SYS */
++
++ /* RSPI */
++ RSPI_SSL0_A_MARK, RSPI_SSL1_A_MARK, RSPI_SSL2_A_MARK,
++ RSPI_SSL3_A_MARK, RSPI_CK_A_MARK, RSPI_MOSI_A_MARK,
++ RSPI_MISO_A_MARK,
++
++ /* VIO CKO */
++ VIO_CKO1_MARK, /* needs fixup */
++ VIO_CKO2_MARK,
++ VIO_CKO_1_MARK,
++ VIO_CKO_MARK,
++
++ /* VIO0 */
++ VIO0_D0_MARK, VIO0_D1_MARK, VIO0_D2_MARK, VIO0_D3_MARK,
++ VIO0_D4_MARK, VIO0_D5_MARK, VIO0_D6_MARK, VIO0_D7_MARK,
++ VIO0_D8_MARK, VIO0_D9_MARK, VIO0_D10_MARK, VIO0_D11_MARK,
++ VIO0_D12_MARK, VIO0_VD_MARK, VIO0_HD_MARK, VIO0_CLK_MARK,
++ VIO0_FIELD_MARK,
++
++ VIO0_D13_PORT26_MARK, /* MSEL5CR_27_0 */
++ VIO0_D14_PORT25_MARK,
++ VIO0_D15_PORT24_MARK,
++
++ VIO0_D13_PORT22_MARK, /* MSEL5CR_27_1 */
++ VIO0_D14_PORT95_MARK,
++ VIO0_D15_PORT96_MARK,
++
++ /* VIO1 */
++ VIO1_D0_MARK, VIO1_D1_MARK, VIO1_D2_MARK, VIO1_D3_MARK,
++ VIO1_D4_MARK, VIO1_D5_MARK, VIO1_D6_MARK, VIO1_D7_MARK,
++ VIO1_VD_MARK, VIO1_HD_MARK, VIO1_CLK_MARK, VIO1_FIELD_MARK,
++
++ /* TPU0 */
++ TPU0TO0_MARK, TPU0TO1_MARK, TPU0TO3_MARK,
++ TPU0TO2_PORT66_MARK, /* TPU0TO2 Port 66/202 */
++ TPU0TO2_PORT202_MARK,
++
++ /* SSP1 0 */
++ STP0_IPD0_MARK, STP0_IPD1_MARK, STP0_IPD2_MARK, STP0_IPD3_MARK,
++ STP0_IPD4_MARK, STP0_IPD5_MARK, STP0_IPD6_MARK, STP0_IPD7_MARK,
++ STP0_IPEN_MARK, STP0_IPCLK_MARK, STP0_IPSYNC_MARK,
++
++ /* SSP1 1 */
++ STP1_IPD1_MARK, STP1_IPD2_MARK, STP1_IPD3_MARK, STP1_IPD4_MARK,
++ STP1_IPD5_MARK, STP1_IPD6_MARK, STP1_IPD7_MARK, STP1_IPCLK_MARK,
++ STP1_IPSYNC_MARK,
++
++ STP1_IPD0_PORT186_MARK, /* MSEL5CR_23_0 */
++ STP1_IPEN_PORT187_MARK,
++
++ STP1_IPD0_PORT194_MARK, /* MSEL5CR_23_1 */
++ STP1_IPEN_PORT193_MARK,
++
++ /* SIM */
++ SIM_RST_MARK, SIM_CLK_MARK,
++ SIM_D_PORT22_MARK, /* SIM_D Port 22/199 */
++ SIM_D_PORT199_MARK,
++
++ /* SDHI0 */
++ SDHI0_D0_MARK, SDHI0_D1_MARK, SDHI0_D2_MARK, SDHI0_D3_MARK,
++ SDHI0_CD_MARK, SDHI0_WP_MARK, SDHI0_CMD_MARK, SDHI0_CLK_MARK,
++
++ /* SDHI1 */
++ SDHI1_D0_MARK, SDHI1_D1_MARK, SDHI1_D2_MARK, SDHI1_D3_MARK,
++ SDHI1_CD_MARK, SDHI1_WP_MARK, SDHI1_CMD_MARK, SDHI1_CLK_MARK,
++
++ /* SDHI2 */
++ SDHI2_D0_MARK, SDHI2_D1_MARK, SDHI2_D2_MARK, SDHI2_D3_MARK,
++ SDHI2_CLK_MARK, SDHI2_CMD_MARK,
++
++ SDHI2_CD_PORT24_MARK, /* MSEL5CR_19_0 */
++ SDHI2_WP_PORT25_MARK,
++
++ SDHI2_WP_PORT177_MARK, /* MSEL5CR_19_1 */
++ SDHI2_CD_PORT202_MARK,
++
++ /* MSIOF2 */
++ MSIOF2_TXD_MARK, MSIOF2_RXD_MARK, MSIOF2_TSCK_MARK,
++ MSIOF2_SS2_MARK, MSIOF2_TSYNC_MARK, MSIOF2_SS1_MARK,
++ MSIOF2_MCK1_MARK, MSIOF2_MCK0_MARK, MSIOF2_RSYNC_MARK,
++ MSIOF2_RSCK_MARK,
++
++ /* KEYSC */
++ KEYIN4_MARK, KEYIN5_MARK, KEYIN6_MARK, KEYIN7_MARK,
++ KEYOUT0_MARK, KEYOUT1_MARK, KEYOUT2_MARK, KEYOUT3_MARK,
++ KEYOUT4_MARK, KEYOUT5_MARK, KEYOUT6_MARK, KEYOUT7_MARK,
++
++ KEYIN0_PORT43_MARK, /* MSEL4CR_18_0 */
++ KEYIN1_PORT44_MARK,
++ KEYIN2_PORT45_MARK,
++ KEYIN3_PORT46_MARK,
++
++ KEYIN0_PORT58_MARK, /* MSEL4CR_18_1 */
++ KEYIN1_PORT57_MARK,
++ KEYIN2_PORT56_MARK,
++ KEYIN3_PORT55_MARK,
++
++ /* VOU */
++ DV_D0_MARK, DV_D1_MARK, DV_D2_MARK, DV_D3_MARK,
++ DV_D4_MARK, DV_D5_MARK, DV_D6_MARK, DV_D7_MARK,
++ DV_D8_MARK, DV_D9_MARK, DV_D10_MARK, DV_D11_MARK,
++ DV_D12_MARK, DV_D13_MARK, DV_D14_MARK, DV_D15_MARK,
++ DV_CLK_MARK, DV_VSYNC_MARK, DV_HSYNC_MARK,
++
++ /* MEMC */
++ MEMC_AD0_MARK, MEMC_AD1_MARK, MEMC_AD2_MARK, MEMC_AD3_MARK,
++ MEMC_AD4_MARK, MEMC_AD5_MARK, MEMC_AD6_MARK, MEMC_AD7_MARK,
++ MEMC_AD8_MARK, MEMC_AD9_MARK, MEMC_AD10_MARK, MEMC_AD11_MARK,
++ MEMC_AD12_MARK, MEMC_AD13_MARK, MEMC_AD14_MARK, MEMC_AD15_MARK,
++ MEMC_CS0_MARK, MEMC_INT_MARK, MEMC_NWE_MARK, MEMC_NOE_MARK,
++
++ MEMC_CS1_MARK, /* MSEL4CR_6_0 */
++ MEMC_ADV_MARK,
++ MEMC_WAIT_MARK,
++ MEMC_BUSCLK_MARK,
++
++ MEMC_A1_MARK, /* MSEL4CR_6_1 */
++ MEMC_DREQ0_MARK,
++ MEMC_DREQ1_MARK,
++ MEMC_A0_MARK,
++
++ /* MMC */
++ MMC0_D0_PORT68_MARK, MMC0_D1_PORT69_MARK, MMC0_D2_PORT70_MARK,
++ MMC0_D3_PORT71_MARK, MMC0_D4_PORT72_MARK, MMC0_D5_PORT73_MARK,
++ MMC0_D6_PORT74_MARK, MMC0_D7_PORT75_MARK, MMC0_CLK_PORT66_MARK,
++ MMC0_CMD_PORT67_MARK, /* MSEL4CR_15_0 */
++
++ MMC1_D0_PORT149_MARK, MMC1_D1_PORT148_MARK, MMC1_D2_PORT147_MARK,
++ MMC1_D3_PORT146_MARK, MMC1_D4_PORT145_MARK, MMC1_D5_PORT144_MARK,
++ MMC1_D6_PORT143_MARK, MMC1_D7_PORT142_MARK, MMC1_CLK_PORT103_MARK,
++ MMC1_CMD_PORT104_MARK, /* MSEL4CR_15_1 */
++
++ /* MSIOF0 */
++ MSIOF0_SS1_MARK, MSIOF0_SS2_MARK, MSIOF0_RXD_MARK,
++ MSIOF0_TXD_MARK, MSIOF0_MCK0_MARK, MSIOF0_MCK1_MARK,
++ MSIOF0_RSYNC_MARK, MSIOF0_RSCK_MARK, MSIOF0_TSCK_MARK,
++ MSIOF0_TSYNC_MARK,
++
++ /* MSIOF1 */
++ MSIOF1_RSCK_MARK, MSIOF1_RSYNC_MARK,
++ MSIOF1_MCK0_MARK, MSIOF1_MCK1_MARK,
++
++ MSIOF1_SS2_PORT116_MARK, MSIOF1_SS1_PORT117_MARK,
++ MSIOF1_RXD_PORT118_MARK, MSIOF1_TXD_PORT119_MARK,
++ MSIOF1_TSYNC_PORT120_MARK,
++ MSIOF1_TSCK_PORT121_MARK, /* MSEL4CR_10_0 */
++
++ MSIOF1_SS1_PORT67_MARK, MSIOF1_TSCK_PORT72_MARK,
++ MSIOF1_TSYNC_PORT73_MARK, MSIOF1_TXD_PORT74_MARK,
++ MSIOF1_RXD_PORT75_MARK,
++ MSIOF1_SS2_PORT202_MARK, /* MSEL4CR_10_1 */
++
++ /* GPIO */
++ GPO0_MARK, GPI0_MARK, GPO1_MARK, GPI1_MARK,
++
++ /* USB0 */
++ USB0_OCI_MARK, USB0_PPON_MARK, VBUS_MARK,
++
++ /* USB1 */
++ USB1_OCI_MARK, USB1_PPON_MARK,
++
++ /* BBIF1 */
++ BBIF1_RXD_MARK, BBIF1_TXD_MARK, BBIF1_TSYNC_MARK,
++ BBIF1_TSCK_MARK, BBIF1_RSCK_MARK, BBIF1_RSYNC_MARK,
++ BBIF1_FLOW_MARK, BBIF1_RX_FLOW_N_MARK,
++
++ /* BBIF2 */
++ BBIF2_TXD2_PORT5_MARK, /* MSEL5CR_0_0 */
++ BBIF2_RXD2_PORT60_MARK,
++ BBIF2_TSYNC2_PORT6_MARK,
++ BBIF2_TSCK2_PORT59_MARK,
++
++ BBIF2_RXD2_PORT90_MARK, /* MSEL5CR_0_1 */
++ BBIF2_TXD2_PORT183_MARK,
++ BBIF2_TSCK2_PORT89_MARK,
++ BBIF2_TSYNC2_PORT184_MARK,
++
++ /* BSC / FLCTL / PCMCIA */
++ CS0_MARK, CS2_MARK, CS4_MARK,
++ CS5B_MARK, CS6A_MARK,
++ CS5A_PORT105_MARK, /* CS5A PORT 19/105 */
++ CS5A_PORT19_MARK,
++ IOIS16_MARK, /* ? */
++
++ A0_MARK, A1_MARK, A2_MARK, A3_MARK,
++ A4_FOE_MARK, /* share with FLCTL */
++ A5_FCDE_MARK, /* share with FLCTL */
++ A6_MARK, A7_MARK, A8_MARK, A9_MARK,
++ A10_MARK, A11_MARK, A12_MARK, A13_MARK,
++ A14_MARK, A15_MARK, A16_MARK, A17_MARK,
++ A18_MARK, A19_MARK, A20_MARK, A21_MARK,
++ A22_MARK, A23_MARK, A24_MARK, A25_MARK,
++ A26_MARK,
++
++ D0_NAF0_MARK, D1_NAF1_MARK, D2_NAF2_MARK, /* share with FLCTL */
++ D3_NAF3_MARK, D4_NAF4_MARK, D5_NAF5_MARK, /* share with FLCTL */
++ D6_NAF6_MARK, D7_NAF7_MARK, D8_NAF8_MARK, /* share with FLCTL */
++ D9_NAF9_MARK, D10_NAF10_MARK, D11_NAF11_MARK, /* share with FLCTL */
++ D12_NAF12_MARK, D13_NAF13_MARK, D14_NAF14_MARK, /* share with FLCTL */
++ D15_NAF15_MARK, /* share with FLCTL */
++ D16_MARK, D17_MARK, D18_MARK, D19_MARK,
++ D20_MARK, D21_MARK, D22_MARK, D23_MARK,
++ D24_MARK, D25_MARK, D26_MARK, D27_MARK,
++ D28_MARK, D29_MARK, D30_MARK, D31_MARK,
++
++ WE0_FWE_MARK, /* share with FLCTL */
++ WE1_MARK,
++ WE2_ICIORD_MARK, /* share with PCMCIA */
++ WE3_ICIOWR_MARK, /* share with PCMCIA */
++ CKO_MARK, BS_MARK, RDWR_MARK,
++ RD_FSC_MARK, /* share with FLCTL */
++ WAIT_PORT177_MARK, /* WAIT Port 90/177 */
++ WAIT_PORT90_MARK,
++
++ FCE0_MARK, FCE1_MARK, FRB_MARK, /* FLCTL */
++
++ /* IRDA */
++ IRDA_FIRSEL_MARK, IRDA_IN_MARK, IRDA_OUT_MARK,
++
++ /* ATAPI */
++ IDE_D0_MARK, IDE_D1_MARK, IDE_D2_MARK, IDE_D3_MARK,
++ IDE_D4_MARK, IDE_D5_MARK, IDE_D6_MARK, IDE_D7_MARK,
++ IDE_D8_MARK, IDE_D9_MARK, IDE_D10_MARK, IDE_D11_MARK,
++ IDE_D12_MARK, IDE_D13_MARK, IDE_D14_MARK, IDE_D15_MARK,
++ IDE_A0_MARK, IDE_A1_MARK, IDE_A2_MARK, IDE_CS0_MARK,
++ IDE_CS1_MARK, IDE_IOWR_MARK, IDE_IORD_MARK, IDE_IORDY_MARK,
++ IDE_INT_MARK, IDE_RST_MARK, IDE_DIRECTION_MARK,
++ IDE_EXBUF_ENB_MARK, IDE_IODACK_MARK, IDE_IODREQ_MARK,
++
++ /* RMII */
++ RMII_CRS_DV_MARK, RMII_RX_ER_MARK, RMII_RXD0_MARK,
++ RMII_RXD1_MARK, RMII_TX_EN_MARK, RMII_TXD0_MARK,
++ RMII_MDC_MARK, RMII_TXD1_MARK, RMII_MDIO_MARK,
++ RMII_REF50CK_MARK, /* for RMII */
++ RMII_REF125CK_MARK, /* for GMII */
++
++ /* GEther */
++ ET_TX_CLK_MARK, ET_TX_EN_MARK, ET_ETXD0_MARK, ET_ETXD1_MARK,
++ ET_ETXD2_MARK, ET_ETXD3_MARK,
++ ET_ETXD4_MARK, ET_ETXD5_MARK, /* for GEther */
++ ET_ETXD6_MARK, ET_ETXD7_MARK, /* for GEther */
++ ET_COL_MARK, ET_TX_ER_MARK, ET_RX_CLK_MARK, ET_RX_DV_MARK,
++ ET_ERXD0_MARK, ET_ERXD1_MARK, ET_ERXD2_MARK, ET_ERXD3_MARK,
++ ET_ERXD4_MARK, ET_ERXD5_MARK, /* for GEther */
++ ET_ERXD6_MARK, ET_ERXD7_MARK, /* for GEther */
++ ET_RX_ER_MARK, ET_CRS_MARK, ET_MDC_MARK, ET_MDIO_MARK,
++ ET_LINK_MARK, ET_PHY_INT_MARK, ET_WOL_MARK, ET_GTX_CLK_MARK,
++
++ /* DMA0 */
++ DREQ0_MARK, DACK0_MARK,
++
++ /* DMA1 */
++ DREQ1_MARK, DACK1_MARK,
++
++ /* SYSC */
++ RESETOUTS_MARK, RESETP_PULLUP_MARK, RESETP_PLAIN_MARK,
++
++ /* IRREM */
++ IROUT_MARK,
++
++ /* SDENC */
++ SDENC_CPG_MARK, SDENC_DV_CLKI_MARK,
++
++ /* DEBUG */
++ EDEBGREQ_PULLUP_MARK, /* for JTAG */
++ EDEBGREQ_PULLDOWN_MARK,
++
++ TRACEAUD_FROM_VIO_MARK, /* for TRACE/AUD */
++ TRACEAUD_FROM_LCDC0_MARK,
++ TRACEAUD_FROM_MEMC_MARK,
++
++ PINMUX_MARK_END,
++};
++
++static pinmux_enum_t pinmux_data[] = {
++ /* specify valid pin states for each pin in GPIO mode */
++
++ /* I/O and Pull U/D */
++ PORT_DATA_IO_PD(0), PORT_DATA_IO_PD(1),
++ PORT_DATA_IO_PD(2), PORT_DATA_IO_PD(3),
++ PORT_DATA_IO_PD(4), PORT_DATA_IO_PD(5),
++ PORT_DATA_IO_PD(6), PORT_DATA_IO(7),
++ PORT_DATA_IO(8), PORT_DATA_IO(9),
++
++ PORT_DATA_IO_PD(10), PORT_DATA_IO_PD(11),
++ PORT_DATA_IO_PD(12), PORT_DATA_IO_PU_PD(13),
++ PORT_DATA_IO_PD(14), PORT_DATA_IO_PD(15),
++ PORT_DATA_IO_PD(16), PORT_DATA_IO_PD(17),
++ PORT_DATA_IO(18), PORT_DATA_IO_PU(19),
++
++ PORT_DATA_IO_PU_PD(20), PORT_DATA_IO_PD(21),
++ PORT_DATA_IO_PU_PD(22), PORT_DATA_IO(23),
++ PORT_DATA_IO_PU(24), PORT_DATA_IO_PU(25),
++ PORT_DATA_IO_PU(26), PORT_DATA_IO_PU(27),
++ PORT_DATA_IO_PU(28), PORT_DATA_IO_PU(29),
++
++ PORT_DATA_IO_PU(30), PORT_DATA_IO_PD(31),
++ PORT_DATA_IO_PD(32), PORT_DATA_IO_PD(33),
++ PORT_DATA_IO_PD(34), PORT_DATA_IO_PU(35),
++ PORT_DATA_IO_PU(36), PORT_DATA_IO_PD(37),
++ PORT_DATA_IO_PU(38), PORT_DATA_IO_PD(39),
++
++ PORT_DATA_IO_PU_PD(40), PORT_DATA_IO_PD(41),
++ PORT_DATA_IO_PD(42), PORT_DATA_IO_PU_PD(43),
++ PORT_DATA_IO_PU_PD(44), PORT_DATA_IO_PU_PD(45),
++ PORT_DATA_IO_PU_PD(46), PORT_DATA_IO_PU_PD(47),
++ PORT_DATA_IO_PU_PD(48), PORT_DATA_IO_PU_PD(49),
++
++ PORT_DATA_IO_PU_PD(50), PORT_DATA_IO_PD(51),
++ PORT_DATA_IO_PD(52), PORT_DATA_IO_PD(53),
++ PORT_DATA_IO_PD(54), PORT_DATA_IO_PU_PD(55),
++ PORT_DATA_IO_PU_PD(56), PORT_DATA_IO_PU_PD(57),
++ PORT_DATA_IO_PU_PD(58), PORT_DATA_IO_PU_PD(59),
++
++ PORT_DATA_IO_PU_PD(60), PORT_DATA_IO_PD(61),
++ PORT_DATA_IO_PD(62), PORT_DATA_IO_PD(63),
++ PORT_DATA_IO_PD(64), PORT_DATA_IO_PD(65),
++ PORT_DATA_IO_PU_PD(66), PORT_DATA_IO_PU_PD(67),
++ PORT_DATA_IO_PU_PD(68), PORT_DATA_IO_PU_PD(69),
++
++ PORT_DATA_IO_PU_PD(70), PORT_DATA_IO_PU_PD(71),
++ PORT_DATA_IO_PU_PD(72), PORT_DATA_IO_PU_PD(73),
++ PORT_DATA_IO_PU_PD(74), PORT_DATA_IO_PU_PD(75),
++ PORT_DATA_IO_PU_PD(76), PORT_DATA_IO_PU_PD(77),
++ PORT_DATA_IO_PU_PD(78), PORT_DATA_IO_PU_PD(79),
++
++ PORT_DATA_IO_PU_PD(80), PORT_DATA_IO_PU_PD(81),
++ PORT_DATA_IO(82), PORT_DATA_IO_PU_PD(83),
++ PORT_DATA_IO(84), PORT_DATA_IO_PD(85),
++ PORT_DATA_IO_PD(86), PORT_DATA_IO_PD(87),
++ PORT_DATA_IO_PD(88), PORT_DATA_IO_PD(89),
++
++ PORT_DATA_IO_PD(90), PORT_DATA_IO_PU_PD(91),
++ PORT_DATA_IO_PU_PD(92), PORT_DATA_IO_PU_PD(93),
++ PORT_DATA_IO_PU_PD(94), PORT_DATA_IO_PU_PD(95),
++ PORT_DATA_IO_PU_PD(96), PORT_DATA_IO_PU_PD(97),
++ PORT_DATA_IO_PU_PD(98), PORT_DATA_IO_PU_PD(99),
++
++ PORT_DATA_IO_PU_PD(100), PORT_DATA_IO(101),
++ PORT_DATA_IO_PU(102), PORT_DATA_IO_PU_PD(103),
++ PORT_DATA_IO_PU(104), PORT_DATA_IO_PU(105),
++ PORT_DATA_IO_PU_PD(106), PORT_DATA_IO(107),
++ PORT_DATA_IO(108), PORT_DATA_IO(109),
++
++ PORT_DATA_IO(110), PORT_DATA_IO(111),
++ PORT_DATA_IO(112), PORT_DATA_IO(113),
++ PORT_DATA_IO_PU_PD(114), PORT_DATA_IO(115),
++ PORT_DATA_IO_PD(116), PORT_DATA_IO_PD(117),
++ PORT_DATA_IO_PD(118), PORT_DATA_IO_PD(119),
++
++ PORT_DATA_IO_PD(120), PORT_DATA_IO_PD(121),
++ PORT_DATA_IO_PD(122), PORT_DATA_IO_PD(123),
++ PORT_DATA_IO_PD(124), PORT_DATA_IO(125),
++ PORT_DATA_IO(126), PORT_DATA_IO(127),
++ PORT_DATA_IO(128), PORT_DATA_IO(129),
++
++ PORT_DATA_IO(130), PORT_DATA_IO(131),
++ PORT_DATA_IO(132), PORT_DATA_IO(133),
++ PORT_DATA_IO(134), PORT_DATA_IO(135),
++ PORT_DATA_IO(136), PORT_DATA_IO(137),
++ PORT_DATA_IO(138), PORT_DATA_IO(139),
++
++ PORT_DATA_IO(140), PORT_DATA_IO(141),
++ PORT_DATA_IO_PU(142), PORT_DATA_IO_PU(143),
++ PORT_DATA_IO_PU(144), PORT_DATA_IO_PU(145),
++ PORT_DATA_IO_PU(146), PORT_DATA_IO_PU(147),
++ PORT_DATA_IO_PU(148), PORT_DATA_IO_PU(149),
++
++ PORT_DATA_IO_PU(150), PORT_DATA_IO_PU(151),
++ PORT_DATA_IO_PU(152), PORT_DATA_IO_PU(153),
++ PORT_DATA_IO_PU(154), PORT_DATA_IO_PU(155),
++ PORT_DATA_IO_PU(156), PORT_DATA_IO_PU(157),
++ PORT_DATA_IO_PD(158), PORT_DATA_IO_PD(159),
++
++ PORT_DATA_IO_PU_PD(160), PORT_DATA_IO_PD(161),
++ PORT_DATA_IO_PD(162), PORT_DATA_IO_PD(163),
++ PORT_DATA_IO_PD(164), PORT_DATA_IO_PD(165),
++ PORT_DATA_IO_PU(166), PORT_DATA_IO_PU(167),
++ PORT_DATA_IO_PU(168), PORT_DATA_IO_PU(169),
++
++ PORT_DATA_IO_PU(170), PORT_DATA_IO_PU(171),
++ PORT_DATA_IO_PD(172), PORT_DATA_IO_PD(173),
++ PORT_DATA_IO_PD(174), PORT_DATA_IO_PD(175),
++ PORT_DATA_IO_PU(176), PORT_DATA_IO_PU_PD(177),
++ PORT_DATA_IO_PU(178), PORT_DATA_IO_PD(179),
++
++ PORT_DATA_IO_PD(180), PORT_DATA_IO_PU(181),
++ PORT_DATA_IO_PU(182), PORT_DATA_IO(183),
++ PORT_DATA_IO_PD(184), PORT_DATA_IO_PD(185),
++ PORT_DATA_IO_PD(186), PORT_DATA_IO_PD(187),
++ PORT_DATA_IO_PD(188), PORT_DATA_IO_PD(189),
++
++ PORT_DATA_IO_PD(190), PORT_DATA_IO_PD(191),
++ PORT_DATA_IO_PD(192), PORT_DATA_IO_PU_PD(193),
++ PORT_DATA_IO_PU_PD(194), PORT_DATA_IO_PD(195),
++ PORT_DATA_IO_PU_PD(196), PORT_DATA_IO_PD(197),
++ PORT_DATA_IO_PU_PD(198), PORT_DATA_IO_PU_PD(199),
++
++ PORT_DATA_IO_PU_PD(200), PORT_DATA_IO_PU(201),
++ PORT_DATA_IO_PU_PD(202), PORT_DATA_IO(203),
++ PORT_DATA_IO_PU_PD(204), PORT_DATA_IO_PU_PD(205),
++ PORT_DATA_IO_PU_PD(206), PORT_DATA_IO_PU_PD(207),
++ PORT_DATA_IO_PU_PD(208), PORT_DATA_IO_PD(209),
++
++ PORT_DATA_IO_PD(210), PORT_DATA_IO_PD(211),
++
++ /* Port0 */
++ PINMUX_DATA(DBGMDT2_MARK, PORT0_FN1),
++ PINMUX_DATA(FSIAISLD_PORT0_MARK, PORT0_FN2, MSEL5CR_3_0),
++ PINMUX_DATA(FSIAOSLD1_MARK, PORT0_FN3),
++ PINMUX_DATA(LCD0_D22_PORT0_MARK, PORT0_FN4, MSEL5CR_6_0),
++ PINMUX_DATA(SCIFA7_RXD_MARK, PORT0_FN6),
++ PINMUX_DATA(LCD1_D4_MARK, PORT0_FN7),
++ PINMUX_DATA(IRQ5_PORT0_MARK, PORT0_FN0, MSEL1CR_5_0),
++
++ /* Port1 */
++ PINMUX_DATA(DBGMDT1_MARK, PORT1_FN1),
++ PINMUX_DATA(FMSISLD_PORT1_MARK, PORT1_FN2, MSEL5CR_5_0),
++ PINMUX_DATA(FSIAOSLD2_MARK, PORT1_FN3),
++ PINMUX_DATA(LCD0_D23_PORT1_MARK, PORT1_FN4, MSEL5CR_6_0),
++ PINMUX_DATA(SCIFA7_TXD_MARK, PORT1_FN6),
++ PINMUX_DATA(LCD1_D3_MARK, PORT1_FN7),
++ PINMUX_DATA(IRQ5_PORT1_MARK, PORT1_FN0, MSEL1CR_5_1),
++
++ /* Port2 */
++ PINMUX_DATA(DBGMDT0_MARK, PORT2_FN1),
++ PINMUX_DATA(SCIFB_SCK_PORT2_MARK, PORT2_FN2, MSEL5CR_17_1),
++ PINMUX_DATA(LCD0_D21_PORT2_MARK, PORT2_FN4, MSEL5CR_6_0),
++ PINMUX_DATA(LCD1_D2_MARK, PORT2_FN7),
++ PINMUX_DATA(IRQ0_PORT2_MARK, PORT2_FN0, MSEL1CR_0_1),
++
++ /* Port3 */
++ PINMUX_DATA(DBGMD21_MARK, PORT3_FN1),
++ PINMUX_DATA(SCIFB_RXD_PORT3_MARK, PORT3_FN2, MSEL5CR_17_1),
++ PINMUX_DATA(LCD0_D20_PORT3_MARK, PORT3_FN4, MSEL5CR_6_0),
++ PINMUX_DATA(LCD1_D1_MARK, PORT3_FN7),
++
++ /* Port4 */
++ PINMUX_DATA(DBGMD20_MARK, PORT4_FN1),
++ PINMUX_DATA(SCIFB_TXD_PORT4_MARK, PORT4_FN2, MSEL5CR_17_1),
++ PINMUX_DATA(LCD0_D19_PORT4_MARK, PORT4_FN4, MSEL5CR_6_0),
++ PINMUX_DATA(LCD1_D0_MARK, PORT4_FN7),
++
++ /* Port5 */
++ PINMUX_DATA(DBGMD11_MARK, PORT5_FN1),
++ PINMUX_DATA(BBIF2_TXD2_PORT5_MARK, PORT5_FN2, MSEL5CR_0_0),
++ PINMUX_DATA(FSIAISLD_PORT5_MARK, PORT5_FN4, MSEL5CR_3_1),
++ PINMUX_DATA(RSPI_SSL0_A_MARK, PORT5_FN6),
++ PINMUX_DATA(LCD1_VCPWC_MARK, PORT5_FN7),
++
++ /* Port6 */
++ PINMUX_DATA(DBGMD10_MARK, PORT6_FN1),
++ PINMUX_DATA(BBIF2_TSYNC2_PORT6_MARK, PORT6_FN2, MSEL5CR_0_0),
++ PINMUX_DATA(FMSISLD_PORT6_MARK, PORT6_FN4, MSEL5CR_5_1),
++ PINMUX_DATA(RSPI_SSL1_A_MARK, PORT6_FN6),
++ PINMUX_DATA(LCD1_VEPWC_MARK, PORT6_FN7),
++
++ /* Port7 */
++ PINMUX_DATA(FSIAOLR_MARK, PORT7_FN1),
++
++ /* Port8 */
++ PINMUX_DATA(FSIAOBT_MARK, PORT8_FN1),
++
++ /* Port9 */
++ PINMUX_DATA(FSIAOSLD_MARK, PORT9_FN1),
++ PINMUX_DATA(FSIASPDIF_PORT9_MARK, PORT9_FN2, MSEL5CR_4_0),
++
++ /* Port10 */
++ PINMUX_DATA(FSIAOMC_MARK, PORT10_FN1),
++ PINMUX_DATA(SCIFA5_RXD_PORT10_MARK, PORT10_FN3, MSEL5CR_14_0, MSEL5CR_15_0),
++ PINMUX_DATA(IRQ3_PORT10_MARK, PORT10_FN0, MSEL1CR_3_0),
++
++ /* Port11 */
++ PINMUX_DATA(FSIACK_MARK, PORT11_FN1),
++ PINMUX_DATA(IRQ2_PORT11_MARK, PORT11_FN0, MSEL1CR_2_0),
++
++ /* Port12 */
++ PINMUX_DATA(FSIAILR_MARK, PORT12_FN1),
++ PINMUX_DATA(SCIFA4_RXD_PORT12_MARK, PORT12_FN2, MSEL5CR_12_0, MSEL5CR_11_0),
++ PINMUX_DATA(LCD1_RS_MARK, PORT12_FN6),
++ PINMUX_DATA(LCD1_DISP_MARK, PORT12_FN7),
++ PINMUX_DATA(IRQ2_PORT12_MARK, PORT12_FN0, MSEL1CR_2_1),
++
++ /* Port13 */
++ PINMUX_DATA(FSIAIBT_MARK, PORT13_FN1),
++ PINMUX_DATA(SCIFA4_TXD_PORT13_MARK, PORT13_FN2, MSEL5CR_12_0, MSEL5CR_11_0),
++ PINMUX_DATA(LCD1_RD_MARK, PORT13_FN7),
++ PINMUX_DATA(IRQ0_PORT13_MARK, PORT13_FN0, MSEL1CR_0_0),
++
++ /* Port14 */
++ PINMUX_DATA(FMSOILR_MARK, PORT14_FN1),
++ PINMUX_DATA(FMSIILR_MARK, PORT14_FN2),
++ PINMUX_DATA(VIO_CKO1_MARK, PORT14_FN3),
++ PINMUX_DATA(LCD1_D23_MARK, PORT14_FN7),
++ PINMUX_DATA(IRQ3_PORT14_MARK, PORT14_FN0, MSEL1CR_3_1),
++
++ /* Port15 */
++ PINMUX_DATA(FMSOIBT_MARK, PORT15_FN1),
++ PINMUX_DATA(FMSIIBT_MARK, PORT15_FN2),
++ PINMUX_DATA(VIO_CKO2_MARK, PORT15_FN3),
++ PINMUX_DATA(LCD1_D22_MARK, PORT15_FN7),
++ PINMUX_DATA(IRQ4_PORT15_MARK, PORT15_FN0, MSEL1CR_4_0),
++
++ /* Port16 */
++ PINMUX_DATA(FMSOOLR_MARK, PORT16_FN1),
++ PINMUX_DATA(FMSIOLR_MARK, PORT16_FN2),
++
++ /* Port17 */
++ PINMUX_DATA(FMSOOBT_MARK, PORT17_FN1),
++ PINMUX_DATA(FMSIOBT_MARK, PORT17_FN2),
++
++ /* Port18 */
++ PINMUX_DATA(FMSOSLD_MARK, PORT18_FN1),
++ PINMUX_DATA(FSIASPDIF_PORT18_MARK, PORT18_FN2, MSEL5CR_4_1),
++
++ /* Port19 */
++ PINMUX_DATA(FMSICK_MARK, PORT19_FN1),
++ PINMUX_DATA(CS5A_PORT19_MARK, PORT19_FN7, MSEL5CR_2_1),
++ PINMUX_DATA(IRQ10_MARK, PORT19_FN0),
++
++ /* Port20 */
++ PINMUX_DATA(FMSOCK_MARK, PORT20_FN1),
++ PINMUX_DATA(SCIFA5_TXD_PORT20_MARK, PORT20_FN3, MSEL5CR_15_0, MSEL5CR_14_0),
++ PINMUX_DATA(IRQ1_MARK, PORT20_FN0),
++
++ /* Port21 */
++ PINMUX_DATA(SCIFA1_CTS_MARK, PORT21_FN1),
++ PINMUX_DATA(SCIFA4_SCK_PORT21_MARK, PORT21_FN2, MSEL5CR_10_0),
++ PINMUX_DATA(TPU0TO1_MARK, PORT21_FN4),
++ PINMUX_DATA(VIO1_FIELD_MARK, PORT21_FN5),
++ PINMUX_DATA(STP0_IPD5_MARK, PORT21_FN6),
++ PINMUX_DATA(LCD1_D10_MARK, PORT21_FN7),
++
++ /* Port22 */
++ PINMUX_DATA(SCIFA2_SCK_PORT22_MARK, PORT22_FN1, MSEL5CR_7_0),
++ PINMUX_DATA(SIM_D_PORT22_MARK, PORT22_FN4, MSEL5CR_21_0),
++ PINMUX_DATA(VIO0_D13_PORT22_MARK, PORT22_FN7, MSEL5CR_27_1),
++
++ /* Port23 */
++ PINMUX_DATA(SCIFA1_RTS_MARK, PORT23_FN1),
++ PINMUX_DATA(SCIFA5_SCK_PORT23_MARK, PORT23_FN3, MSEL5CR_13_0),
++ PINMUX_DATA(TPU0TO0_MARK, PORT23_FN4),
++ PINMUX_DATA(VIO_CKO_1_MARK, PORT23_FN5),
++ PINMUX_DATA(STP0_IPD2_MARK, PORT23_FN6),
++ PINMUX_DATA(LCD1_D7_MARK, PORT23_FN7),
++
++ /* Port24 */
++ PINMUX_DATA(VIO0_D15_PORT24_MARK, PORT24_FN1, MSEL5CR_27_0),
++ PINMUX_DATA(VIO1_D7_MARK, PORT24_FN5),
++ PINMUX_DATA(SCIFA6_SCK_MARK, PORT24_FN6),
++ PINMUX_DATA(SDHI2_CD_PORT24_MARK, PORT24_FN7, MSEL5CR_19_0),
++
++ /* Port25 */
++ PINMUX_DATA(VIO0_D14_PORT25_MARK, PORT25_FN1, MSEL5CR_27_0),
++ PINMUX_DATA(VIO1_D6_MARK, PORT25_FN5),
++ PINMUX_DATA(SCIFA6_RXD_MARK, PORT25_FN6),
++ PINMUX_DATA(SDHI2_WP_PORT25_MARK, PORT25_FN7, MSEL5CR_19_0),
++
++ /* Port26 */
++ PINMUX_DATA(VIO0_D13_PORT26_MARK, PORT26_FN1, MSEL5CR_27_0),
++ PINMUX_DATA(VIO1_D5_MARK, PORT26_FN5),
++ PINMUX_DATA(SCIFA6_TXD_MARK, PORT26_FN6),
++
++ /* Port27 - Port39 Function */
++ PINMUX_DATA(VIO0_D7_MARK, PORT27_FN1),
++ PINMUX_DATA(VIO0_D6_MARK, PORT28_FN1),
++ PINMUX_DATA(VIO0_D5_MARK, PORT29_FN1),
++ PINMUX_DATA(VIO0_D4_MARK, PORT30_FN1),
++ PINMUX_DATA(VIO0_D3_MARK, PORT31_FN1),
++ PINMUX_DATA(VIO0_D2_MARK, PORT32_FN1),
++ PINMUX_DATA(VIO0_D1_MARK, PORT33_FN1),
++ PINMUX_DATA(VIO0_D0_MARK, PORT34_FN1),
++ PINMUX_DATA(VIO0_CLK_MARK, PORT35_FN1),
++ PINMUX_DATA(VIO_CKO_MARK, PORT36_FN1),
++ PINMUX_DATA(VIO0_HD_MARK, PORT37_FN1),
++ PINMUX_DATA(VIO0_FIELD_MARK, PORT38_FN1),
++ PINMUX_DATA(VIO0_VD_MARK, PORT39_FN1),
++
++ /* Port38 IRQ */
++ PINMUX_DATA(IRQ25_MARK, PORT38_FN0),
++
++ /* Port40 */
++ PINMUX_DATA(LCD0_D18_PORT40_MARK, PORT40_FN4, MSEL5CR_6_0),
++ PINMUX_DATA(RSPI_CK_A_MARK, PORT40_FN6),
++ PINMUX_DATA(LCD1_LCLK_MARK, PORT40_FN7),
++
++ /* Port41 */
++ PINMUX_DATA(LCD0_D17_MARK, PORT41_FN1),
++ PINMUX_DATA(MSIOF2_SS1_MARK, PORT41_FN2),
++ PINMUX_DATA(IRQ31_PORT41_MARK, PORT41_FN0, MSEL1CR_31_1),
++
++ /* Port42 */
++ PINMUX_DATA(LCD0_D16_MARK, PORT42_FN1),
++ PINMUX_DATA(MSIOF2_MCK1_MARK, PORT42_FN2),
++ PINMUX_DATA(IRQ12_PORT42_MARK, PORT42_FN0, MSEL1CR_12_1),
++
++ /* Port43 */
++ PINMUX_DATA(LCD0_D15_MARK, PORT43_FN1),
++ PINMUX_DATA(MSIOF2_MCK0_MARK, PORT43_FN2),
++ PINMUX_DATA(KEYIN0_PORT43_MARK, PORT43_FN3, MSEL4CR_18_0),
++ PINMUX_DATA(DV_D15_MARK, PORT43_FN6),
++
++ /* Port44 */
++ PINMUX_DATA(LCD0_D14_MARK, PORT44_FN1),
++ PINMUX_DATA(MSIOF2_RSYNC_MARK, PORT44_FN2),
++ PINMUX_DATA(KEYIN1_PORT44_MARK, PORT44_FN3, MSEL4CR_18_0),
++ PINMUX_DATA(DV_D14_MARK, PORT44_FN6),
++
++ /* Port45 */
++ PINMUX_DATA(LCD0_D13_MARK, PORT45_FN1),
++ PINMUX_DATA(MSIOF2_RSCK_MARK, PORT45_FN2),
++ PINMUX_DATA(KEYIN2_PORT45_MARK, PORT45_FN3, MSEL4CR_18_0),
++ PINMUX_DATA(DV_D13_MARK, PORT45_FN6),
++
++ /* Port46 */
++ PINMUX_DATA(LCD0_D12_MARK, PORT46_FN1),
++ PINMUX_DATA(KEYIN3_PORT46_MARK, PORT46_FN3, MSEL4CR_18_0),
++ PINMUX_DATA(DV_D12_MARK, PORT46_FN6),
++
++ /* Port47 */
++ PINMUX_DATA(LCD0_D11_MARK, PORT47_FN1),
++ PINMUX_DATA(KEYIN4_MARK, PORT47_FN3),
++ PINMUX_DATA(DV_D11_MARK, PORT47_FN6),
++
++ /* Port48 */
++ PINMUX_DATA(LCD0_D10_MARK, PORT48_FN1),
++ PINMUX_DATA(KEYIN5_MARK, PORT48_FN3),
++ PINMUX_DATA(DV_D10_MARK, PORT48_FN6),
++
++ /* Port49 */
++ PINMUX_DATA(LCD0_D9_MARK, PORT49_FN1),
++ PINMUX_DATA(KEYIN6_MARK, PORT49_FN3),
++ PINMUX_DATA(DV_D9_MARK, PORT49_FN6),
++ PINMUX_DATA(IRQ30_PORT49_MARK, PORT49_FN0, MSEL1CR_30_1),
++
++ /* Port50 */
++ PINMUX_DATA(LCD0_D8_MARK, PORT50_FN1),
++ PINMUX_DATA(KEYIN7_MARK, PORT50_FN3),
++ PINMUX_DATA(DV_D8_MARK, PORT50_FN6),
++ PINMUX_DATA(IRQ29_PORT50_MARK, PORT50_FN0, MSEL1CR_29_1),
++
++ /* Port51 */
++ PINMUX_DATA(LCD0_D7_MARK, PORT51_FN1),
++ PINMUX_DATA(KEYOUT0_MARK, PORT51_FN3),
++ PINMUX_DATA(DV_D7_MARK, PORT51_FN6),
++
++ /* Port52 */
++ PINMUX_DATA(LCD0_D6_MARK, PORT52_FN1),
++ PINMUX_DATA(KEYOUT1_MARK, PORT52_FN3),
++ PINMUX_DATA(DV_D6_MARK, PORT52_FN6),
++
++ /* Port53 */
++ PINMUX_DATA(LCD0_D5_MARK, PORT53_FN1),
++ PINMUX_DATA(KEYOUT2_MARK, PORT53_FN3),
++ PINMUX_DATA(DV_D5_MARK, PORT53_FN6),
++
++ /* Port54 */
++ PINMUX_DATA(LCD0_D4_MARK, PORT54_FN1),
++ PINMUX_DATA(KEYOUT3_MARK, PORT54_FN3),
++ PINMUX_DATA(DV_D4_MARK, PORT54_FN6),
++
++ /* Port55 */
++ PINMUX_DATA(LCD0_D3_MARK, PORT55_FN1),
++ PINMUX_DATA(KEYOUT4_MARK, PORT55_FN3),
++ PINMUX_DATA(KEYIN3_PORT55_MARK, PORT55_FN4, MSEL4CR_18_1),
++ PINMUX_DATA(DV_D3_MARK, PORT55_FN6),
++
++ /* Port56 */
++ PINMUX_DATA(LCD0_D2_MARK, PORT56_FN1),
++ PINMUX_DATA(KEYOUT5_MARK, PORT56_FN3),
++ PINMUX_DATA(KEYIN2_PORT56_MARK, PORT56_FN4, MSEL4CR_18_1),
++ PINMUX_DATA(DV_D2_MARK, PORT56_FN6),
++ PINMUX_DATA(IRQ28_PORT56_MARK, PORT56_FN0, MSEL1CR_28_1),
++
++ /* Port57 */
++ PINMUX_DATA(LCD0_D1_MARK, PORT57_FN1),
++ PINMUX_DATA(KEYOUT6_MARK, PORT57_FN3),
++ PINMUX_DATA(KEYIN1_PORT57_MARK, PORT57_FN4, MSEL4CR_18_1),
++ PINMUX_DATA(DV_D1_MARK, PORT57_FN6),
++ PINMUX_DATA(IRQ27_PORT57_MARK, PORT57_FN0, MSEL1CR_27_1),
++
++ /* Port58 */
++ PINMUX_DATA(LCD0_D0_MARK, PORT58_FN1),
++ PINMUX_DATA(KEYOUT7_MARK, PORT58_FN3),
++ PINMUX_DATA(KEYIN0_PORT58_MARK, PORT58_FN4, MSEL4CR_18_1),
++ PINMUX_DATA(DV_D0_MARK, PORT58_FN6),
++ PINMUX_DATA(IRQ26_PORT58_MARK, PORT58_FN0, MSEL1CR_26_1),
++
++ /* Port59 */
++ PINMUX_DATA(LCD0_VCPWC_MARK, PORT59_FN1),
++ PINMUX_DATA(BBIF2_TSCK2_PORT59_MARK, PORT59_FN2, MSEL5CR_0_0),
++ PINMUX_DATA(RSPI_MOSI_A_MARK, PORT59_FN6),
++
++ /* Port60 */
++ PINMUX_DATA(LCD0_VEPWC_MARK, PORT60_FN1),
++ PINMUX_DATA(BBIF2_RXD2_PORT60_MARK, PORT60_FN2, MSEL5CR_0_0),
++ PINMUX_DATA(RSPI_MISO_A_MARK, PORT60_FN6),
++
++ /* Port61 */
++ PINMUX_DATA(LCD0_DON_MARK, PORT61_FN1),
++ PINMUX_DATA(MSIOF2_TXD_MARK, PORT61_FN2),
++
++ /* Port62 */
++ PINMUX_DATA(LCD0_DCK_MARK, PORT62_FN1),
++ PINMUX_DATA(LCD0_WR_MARK, PORT62_FN4),
++ PINMUX_DATA(DV_CLK_MARK, PORT62_FN6),
++ PINMUX_DATA(IRQ15_PORT62_MARK, PORT62_FN0, MSEL1CR_15_1),
++
++ /* Port63 */
++ PINMUX_DATA(LCD0_VSYN_MARK, PORT63_FN1),
++ PINMUX_DATA(DV_VSYNC_MARK, PORT63_FN6),
++ PINMUX_DATA(IRQ14_PORT63_MARK, PORT63_FN0, MSEL1CR_14_1),
++
++ /* Port64 */
++ PINMUX_DATA(LCD0_HSYN_MARK, PORT64_FN1),
++ PINMUX_DATA(LCD0_CS_MARK, PORT64_FN4),
++ PINMUX_DATA(DV_HSYNC_MARK, PORT64_FN6),
++ PINMUX_DATA(IRQ13_PORT64_MARK, PORT64_FN0, MSEL1CR_13_1),
++
++ /* Port65 */
++ PINMUX_DATA(LCD0_DISP_MARK, PORT65_FN1),
++ PINMUX_DATA(MSIOF2_TSCK_MARK, PORT65_FN2),
++ PINMUX_DATA(LCD0_RS_MARK, PORT65_FN4),
++
++ /* Port66 */
++ PINMUX_DATA(MEMC_INT_MARK, PORT66_FN1),
++ PINMUX_DATA(TPU0TO2_PORT66_MARK, PORT66_FN3, MSEL5CR_25_0),
++ PINMUX_DATA(MMC0_CLK_PORT66_MARK, PORT66_FN4, MSEL4CR_15_0),
++ PINMUX_DATA(SDHI1_CLK_MARK, PORT66_FN6),
++
++ /* Port67 - Port73 Function1 */
++ PINMUX_DATA(MEMC_CS0_MARK, PORT67_FN1),
++ PINMUX_DATA(MEMC_AD8_MARK, PORT68_FN1),
++ PINMUX_DATA(MEMC_AD9_MARK, PORT69_FN1),
++ PINMUX_DATA(MEMC_AD10_MARK, PORT70_FN1),
++ PINMUX_DATA(MEMC_AD11_MARK, PORT71_FN1),
++ PINMUX_DATA(MEMC_AD12_MARK, PORT72_FN1),
++ PINMUX_DATA(MEMC_AD13_MARK, PORT73_FN1),
++
++ /* Port67 - Port73 Function2 */
++ PINMUX_DATA(MSIOF1_SS1_PORT67_MARK, PORT67_FN2, MSEL4CR_10_1),
++ PINMUX_DATA(MSIOF1_RSCK_MARK, PORT68_FN2),
++ PINMUX_DATA(MSIOF1_RSYNC_MARK, PORT69_FN2),
++ PINMUX_DATA(MSIOF1_MCK0_MARK, PORT70_FN2),
++ PINMUX_DATA(MSIOF1_MCK1_MARK, PORT71_FN2),
++ PINMUX_DATA(MSIOF1_TSCK_PORT72_MARK, PORT72_FN2, MSEL4CR_10_1),
++ PINMUX_DATA(MSIOF1_TSYNC_PORT73_MARK, PORT73_FN2, MSEL4CR_10_1),
++
++ /* Port67 - Port73 Function4 */
++ PINMUX_DATA(MMC0_CMD_PORT67_MARK, PORT67_FN4, MSEL4CR_15_0),
++ PINMUX_DATA(MMC0_D0_PORT68_MARK, PORT68_FN4, MSEL4CR_15_0),
++ PINMUX_DATA(MMC0_D1_PORT69_MARK, PORT69_FN4, MSEL4CR_15_0),
++ PINMUX_DATA(MMC0_D2_PORT70_MARK, PORT70_FN4, MSEL4CR_15_0),
++ PINMUX_DATA(MMC0_D3_PORT71_MARK, PORT71_FN4, MSEL4CR_15_0),
++ PINMUX_DATA(MMC0_D4_PORT72_MARK, PORT72_FN4, MSEL4CR_15_0),
++ PINMUX_DATA(MMC0_D5_PORT73_MARK, PORT73_FN4, MSEL4CR_15_0),
++
++ /* Port67 - Port73 Function6 */
++ PINMUX_DATA(SDHI1_CMD_MARK, PORT67_FN6),
++ PINMUX_DATA(SDHI1_D0_MARK, PORT68_FN6),
++ PINMUX_DATA(SDHI1_D1_MARK, PORT69_FN6),
++ PINMUX_DATA(SDHI1_D2_MARK, PORT70_FN6),
++ PINMUX_DATA(SDHI1_D3_MARK, PORT71_FN6),
++ PINMUX_DATA(SDHI1_CD_MARK, PORT72_FN6),
++ PINMUX_DATA(SDHI1_WP_MARK, PORT73_FN6),
++
++ /* Port67 - Port71 IRQ */
++ PINMUX_DATA(IRQ20_MARK, PORT67_FN0),
++ PINMUX_DATA(IRQ16_PORT68_MARK, PORT68_FN0, MSEL1CR_16_0),
++ PINMUX_DATA(IRQ17_MARK, PORT69_FN0),
++ PINMUX_DATA(IRQ18_MARK, PORT70_FN0),
++ PINMUX_DATA(IRQ19_MARK, PORT71_FN0),
++
++ /* Port74 */
++ PINMUX_DATA(MEMC_AD14_MARK, PORT74_FN1),
++ PINMUX_DATA(MSIOF1_TXD_PORT74_MARK, PORT74_FN2, MSEL4CR_10_1),
++ PINMUX_DATA(MMC0_D6_PORT74_MARK, PORT74_FN4, MSEL4CR_15_0),
++ PINMUX_DATA(STP1_IPD7_MARK, PORT74_FN6),
++ PINMUX_DATA(LCD1_D21_MARK, PORT74_FN7),
++
++ /* Port75 */
++ PINMUX_DATA(MEMC_AD15_MARK, PORT75_FN1),
++ PINMUX_DATA(MSIOF1_RXD_PORT75_MARK, PORT75_FN2, MSEL4CR_10_1),
++ PINMUX_DATA(MMC0_D7_PORT75_MARK, PORT75_FN4, MSEL4CR_15_0),
++ PINMUX_DATA(STP1_IPD6_MARK, PORT75_FN6),
++ PINMUX_DATA(LCD1_D20_MARK, PORT75_FN7),
++
++ /* Port76 - Port80 Function */
++ PINMUX_DATA(SDHI0_CMD_MARK, PORT76_FN1),
++ PINMUX_DATA(SDHI0_D0_MARK, PORT77_FN1),
++ PINMUX_DATA(SDHI0_D1_MARK, PORT78_FN1),
++ PINMUX_DATA(SDHI0_D2_MARK, PORT79_FN1),
++ PINMUX_DATA(SDHI0_D3_MARK, PORT80_FN1),
++
++ /* Port81 */
++ PINMUX_DATA(SDHI0_CD_MARK, PORT81_FN1),
++ PINMUX_DATA(IRQ26_PORT81_MARK, PORT81_FN0, MSEL1CR_26_0),
++
++ /* Port82 - Port88 Function */
++ PINMUX_DATA(SDHI0_CLK_MARK, PORT82_FN1),
++ PINMUX_DATA(SDHI0_WP_MARK, PORT83_FN1),
++ PINMUX_DATA(RESETOUTS_MARK, PORT84_FN1),
++ PINMUX_DATA(USB0_PPON_MARK, PORT85_FN1),
++ PINMUX_DATA(USB0_OCI_MARK, PORT86_FN1),
++ PINMUX_DATA(USB1_PPON_MARK, PORT87_FN1),
++ PINMUX_DATA(USB1_OCI_MARK, PORT88_FN1),
++
++ /* Port89 */
++ PINMUX_DATA(DREQ0_MARK, PORT89_FN1),
++ PINMUX_DATA(BBIF2_TSCK2_PORT89_MARK, PORT89_FN2, MSEL5CR_0_1),
++ PINMUX_DATA(RSPI_SSL3_A_MARK, PORT89_FN6),
++
++ /* Port90 */
++ PINMUX_DATA(DACK0_MARK, PORT90_FN1),
++ PINMUX_DATA(BBIF2_RXD2_PORT90_MARK, PORT90_FN2, MSEL5CR_0_1),
++ PINMUX_DATA(RSPI_SSL2_A_MARK, PORT90_FN6),
++ PINMUX_DATA(WAIT_PORT90_MARK, PORT90_FN7, MSEL5CR_2_1),
++
++ /* Port91 */
++ PINMUX_DATA(MEMC_AD0_MARK, PORT91_FN1),
++ PINMUX_DATA(BBIF1_RXD_MARK, PORT91_FN2),
++ PINMUX_DATA(SCIFA5_TXD_PORT91_MARK, PORT91_FN3, MSEL5CR_15_1, MSEL5CR_14_0),
++ PINMUX_DATA(LCD1_D5_MARK, PORT91_FN7),
++
++ /* Port92 */
++ PINMUX_DATA(MEMC_AD1_MARK, PORT92_FN1),
++ PINMUX_DATA(BBIF1_TSYNC_MARK, PORT92_FN2),
++ PINMUX_DATA(SCIFA5_RXD_PORT92_MARK, PORT92_FN3, MSEL5CR_15_1, MSEL5CR_14_0),
++ PINMUX_DATA(STP0_IPD1_MARK, PORT92_FN6),
++ PINMUX_DATA(LCD1_D6_MARK, PORT92_FN7),
++
++ /* Port93 */
++ PINMUX_DATA(MEMC_AD2_MARK, PORT93_FN1),
++ PINMUX_DATA(BBIF1_TSCK_MARK, PORT93_FN2),
++ PINMUX_DATA(SCIFA4_TXD_PORT93_MARK, PORT93_FN3, MSEL5CR_12_1, MSEL5CR_11_0),
++ PINMUX_DATA(STP0_IPD3_MARK, PORT93_FN6),
++ PINMUX_DATA(LCD1_D8_MARK, PORT93_FN7),
++
++ /* Port94 */
++ PINMUX_DATA(MEMC_AD3_MARK, PORT94_FN1),
++ PINMUX_DATA(BBIF1_TXD_MARK, PORT94_FN2),
++ PINMUX_DATA(SCIFA4_RXD_PORT94_MARK, PORT94_FN3, MSEL5CR_12_1, MSEL5CR_11_0),
++ PINMUX_DATA(STP0_IPD4_MARK, PORT94_FN6),
++ PINMUX_DATA(LCD1_D9_MARK, PORT94_FN7),
++
++ /* Port95 */
++ PINMUX_DATA(MEMC_CS1_MARK, PORT95_FN1, MSEL4CR_6_0),
++ PINMUX_DATA(MEMC_A1_MARK, PORT95_FN1, MSEL4CR_6_1),
++
++ PINMUX_DATA(SCIFA2_CTS_MARK, PORT95_FN2),
++ PINMUX_DATA(SIM_RST_MARK, PORT95_FN4),
++ PINMUX_DATA(VIO0_D14_PORT95_MARK, PORT95_FN7, MSEL5CR_27_1),
++ PINMUX_DATA(IRQ22_MARK, PORT95_FN0),
++
++ /* Port96 */
++ PINMUX_DATA(MEMC_ADV_MARK, PORT96_FN1, MSEL4CR_6_0),
++ PINMUX_DATA(MEMC_DREQ0_MARK, PORT96_FN1, MSEL4CR_6_1),
++
++ PINMUX_DATA(SCIFA2_RTS_MARK, PORT96_FN2),
++ PINMUX_DATA(SIM_CLK_MARK, PORT96_FN4),
++ PINMUX_DATA(VIO0_D15_PORT96_MARK, PORT96_FN7, MSEL5CR_27_1),
++ PINMUX_DATA(IRQ23_MARK, PORT96_FN0),
++
++ /* Port97 */
++ PINMUX_DATA(MEMC_AD4_MARK, PORT97_FN1),
++ PINMUX_DATA(BBIF1_RSCK_MARK, PORT97_FN2),
++ PINMUX_DATA(LCD1_CS_MARK, PORT97_FN6),
++ PINMUX_DATA(LCD1_HSYN_MARK, PORT97_FN7),
++ PINMUX_DATA(IRQ12_PORT97_MARK, PORT97_FN0, MSEL1CR_12_0),
++
++ /* Port98 */
++ PINMUX_DATA(MEMC_AD5_MARK, PORT98_FN1),
++ PINMUX_DATA(BBIF1_RSYNC_MARK, PORT98_FN2),
++ PINMUX_DATA(LCD1_VSYN_MARK, PORT98_FN7),
++ PINMUX_DATA(IRQ13_PORT98_MARK, PORT98_FN0, MSEL1CR_13_0),
++
++ /* Port99 */
++ PINMUX_DATA(MEMC_AD6_MARK, PORT99_FN1),
++ PINMUX_DATA(BBIF1_FLOW_MARK, PORT99_FN2),
++ PINMUX_DATA(LCD1_WR_MARK, PORT99_FN6),
++ PINMUX_DATA(LCD1_DCK_MARK, PORT99_FN7),
++ PINMUX_DATA(IRQ14_PORT99_MARK, PORT99_FN0, MSEL1CR_14_0),
++
++ /* Port100 */
++ PINMUX_DATA(MEMC_AD7_MARK, PORT100_FN1),
++ PINMUX_DATA(BBIF1_RX_FLOW_N_MARK, PORT100_FN2),
++ PINMUX_DATA(LCD1_DON_MARK, PORT100_FN7),
++ PINMUX_DATA(IRQ15_PORT100_MARK, PORT100_FN0, MSEL1CR_15_0),
++
++ /* Port101 */
++ PINMUX_DATA(FCE0_MARK, PORT101_FN1),
++
++ /* Port102 */
++ PINMUX_DATA(FRB_MARK, PORT102_FN1),
++ PINMUX_DATA(LCD0_LCLK_PORT102_MARK, PORT102_FN4, MSEL5CR_6_0),
++
++ /* Port103 */
++ PINMUX_DATA(CS5B_MARK, PORT103_FN1),
++ PINMUX_DATA(FCE1_MARK, PORT103_FN2),
++ PINMUX_DATA(MMC1_CLK_PORT103_MARK, PORT103_FN3, MSEL4CR_15_1),
++
++ /* Port104 */
++ PINMUX_DATA(CS6A_MARK, PORT104_FN1),
++ PINMUX_DATA(MMC1_CMD_PORT104_MARK, PORT104_FN3, MSEL4CR_15_1),
++ PINMUX_DATA(IRQ11_MARK, PORT104_FN0),
++
++ /* Port105 */
++ PINMUX_DATA(CS5A_PORT105_MARK, PORT105_FN1, MSEL5CR_2_0),
++ PINMUX_DATA(SCIFA3_RTS_PORT105_MARK, PORT105_FN4, MSEL5CR_8_0),
++
++ /* Port106 */
++ PINMUX_DATA(IOIS16_MARK, PORT106_FN1),
++ PINMUX_DATA(IDE_EXBUF_ENB_MARK, PORT106_FN6),
++
++ /* Port107 - Port115 Function */
++ PINMUX_DATA(WE3_ICIOWR_MARK, PORT107_FN1),
++ PINMUX_DATA(WE2_ICIORD_MARK, PORT108_FN1),
++ PINMUX_DATA(CS0_MARK, PORT109_FN1),
++ PINMUX_DATA(CS2_MARK, PORT110_FN1),
++ PINMUX_DATA(CS4_MARK, PORT111_FN1),
++ PINMUX_DATA(WE1_MARK, PORT112_FN1),
++ PINMUX_DATA(WE0_FWE_MARK, PORT113_FN1),
++ PINMUX_DATA(RDWR_MARK, PORT114_FN1),
++ PINMUX_DATA(RD_FSC_MARK, PORT115_FN1),
++
++ /* Port116 */
++ PINMUX_DATA(A25_MARK, PORT116_FN1),
++ PINMUX_DATA(MSIOF0_SS2_MARK, PORT116_FN2),
++ PINMUX_DATA(MSIOF1_SS2_PORT116_MARK, PORT116_FN3, MSEL4CR_10_0),
++ PINMUX_DATA(SCIFA3_SCK_PORT116_MARK, PORT116_FN4, MSEL5CR_8_0),
++ PINMUX_DATA(GPO1_MARK, PORT116_FN5),
++
++ /* Port117 */
++ PINMUX_DATA(A24_MARK, PORT117_FN1),
++ PINMUX_DATA(MSIOF0_SS1_MARK, PORT117_FN2),
++ PINMUX_DATA(MSIOF1_SS1_PORT117_MARK, PORT117_FN3, MSEL4CR_10_0),
++ PINMUX_DATA(SCIFA3_CTS_PORT117_MARK, PORT117_FN4, MSEL5CR_8_0),
++ PINMUX_DATA(GPO0_MARK, PORT117_FN5),
++
++ /* Port118 */
++ PINMUX_DATA(A23_MARK, PORT118_FN1),
++ PINMUX_DATA(MSIOF0_MCK1_MARK, PORT118_FN2),
++ PINMUX_DATA(MSIOF1_RXD_PORT118_MARK, PORT118_FN3, MSEL4CR_10_0),
++ PINMUX_DATA(GPI1_MARK, PORT118_FN5),
++ PINMUX_DATA(IRQ9_PORT118_MARK, PORT118_FN0, MSEL1CR_9_0),
++
++ /* Port119 */
++ PINMUX_DATA(A22_MARK, PORT119_FN1),
++ PINMUX_DATA(MSIOF0_MCK0_MARK, PORT119_FN2),
++ PINMUX_DATA(MSIOF1_TXD_PORT119_MARK, PORT119_FN3, MSEL4CR_10_0),
++ PINMUX_DATA(GPI0_MARK, PORT119_FN5),
++ PINMUX_DATA(IRQ8_MARK, PORT119_FN0),
++
++ /* Port120 */
++ PINMUX_DATA(A21_MARK, PORT120_FN1),
++ PINMUX_DATA(MSIOF0_RSYNC_MARK, PORT120_FN2),
++ PINMUX_DATA(MSIOF1_TSYNC_PORT120_MARK, PORT120_FN3, MSEL4CR_10_0),
++ PINMUX_DATA(IRQ7_PORT120_MARK, PORT120_FN0, MSEL1CR_7_0),
++
++ /* Port121 */
++ PINMUX_DATA(A20_MARK, PORT121_FN1),
++ PINMUX_DATA(MSIOF0_RSCK_MARK, PORT121_FN2),
++ PINMUX_DATA(MSIOF1_TSCK_PORT121_MARK, PORT121_FN3, MSEL4CR_10_0),
++ PINMUX_DATA(IRQ6_PORT121_MARK, PORT121_FN0, MSEL1CR_6_0),
++
++ /* Port122 */
++ PINMUX_DATA(A19_MARK, PORT122_FN1),
++ PINMUX_DATA(MSIOF0_RXD_MARK, PORT122_FN2),
++
++ /* Port123 */
++ PINMUX_DATA(A18_MARK, PORT123_FN1),
++ PINMUX_DATA(MSIOF0_TSCK_MARK, PORT123_FN2),
++
++ /* Port124 */
++ PINMUX_DATA(A17_MARK, PORT124_FN1),
++ PINMUX_DATA(MSIOF0_TSYNC_MARK, PORT124_FN2),
++
++ /* Port125 - Port141 Function */
++ PINMUX_DATA(A16_MARK, PORT125_FN1),
++ PINMUX_DATA(A15_MARK, PORT126_FN1),
++ PINMUX_DATA(A14_MARK, PORT127_FN1),
++ PINMUX_DATA(A13_MARK, PORT128_FN1),
++ PINMUX_DATA(A12_MARK, PORT129_FN1),
++ PINMUX_DATA(A11_MARK, PORT130_FN1),
++ PINMUX_DATA(A10_MARK, PORT131_FN1),
++ PINMUX_DATA(A9_MARK, PORT132_FN1),
++ PINMUX_DATA(A8_MARK, PORT133_FN1),
++ PINMUX_DATA(A7_MARK, PORT134_FN1),
++ PINMUX_DATA(A6_MARK, PORT135_FN1),
++ PINMUX_DATA(A5_FCDE_MARK, PORT136_FN1),
++ PINMUX_DATA(A4_FOE_MARK, PORT137_FN1),
++ PINMUX_DATA(A3_MARK, PORT138_FN1),
++ PINMUX_DATA(A2_MARK, PORT139_FN1),
++ PINMUX_DATA(A1_MARK, PORT140_FN1),
++ PINMUX_DATA(CKO_MARK, PORT141_FN1),
++
++ /* Port142 - Port157 Function1 */
++ PINMUX_DATA(D15_NAF15_MARK, PORT142_FN1),
++ PINMUX_DATA(D14_NAF14_MARK, PORT143_FN1),
++ PINMUX_DATA(D13_NAF13_MARK, PORT144_FN1),
++ PINMUX_DATA(D12_NAF12_MARK, PORT145_FN1),
++ PINMUX_DATA(D11_NAF11_MARK, PORT146_FN1),
++ PINMUX_DATA(D10_NAF10_MARK, PORT147_FN1),
++ PINMUX_DATA(D9_NAF9_MARK, PORT148_FN1),
++ PINMUX_DATA(D8_NAF8_MARK, PORT149_FN1),
++ PINMUX_DATA(D7_NAF7_MARK, PORT150_FN1),
++ PINMUX_DATA(D6_NAF6_MARK, PORT151_FN1),
++ PINMUX_DATA(D5_NAF5_MARK, PORT152_FN1),
++ PINMUX_DATA(D4_NAF4_MARK, PORT153_FN1),
++ PINMUX_DATA(D3_NAF3_MARK, PORT154_FN1),
++ PINMUX_DATA(D2_NAF2_MARK, PORT155_FN1),
++ PINMUX_DATA(D1_NAF1_MARK, PORT156_FN1),
++ PINMUX_DATA(D0_NAF0_MARK, PORT157_FN1),
++
++ /* Port142 - Port149 Function3 */
++ PINMUX_DATA(MMC1_D7_PORT142_MARK, PORT142_FN3, MSEL4CR_15_1),
++ PINMUX_DATA(MMC1_D6_PORT143_MARK, PORT143_FN3, MSEL4CR_15_1),
++ PINMUX_DATA(MMC1_D5_PORT144_MARK, PORT144_FN3, MSEL4CR_15_1),
++ PINMUX_DATA(MMC1_D4_PORT145_MARK, PORT145_FN3, MSEL4CR_15_1),
++ PINMUX_DATA(MMC1_D3_PORT146_MARK, PORT146_FN3, MSEL4CR_15_1),
++ PINMUX_DATA(MMC1_D2_PORT147_MARK, PORT147_FN3, MSEL4CR_15_1),
++ PINMUX_DATA(MMC1_D1_PORT148_MARK, PORT148_FN3, MSEL4CR_15_1),
++ PINMUX_DATA(MMC1_D0_PORT149_MARK, PORT149_FN3, MSEL4CR_15_1),
++
++ /* Port158 */
++ PINMUX_DATA(D31_MARK, PORT158_FN1),
++ PINMUX_DATA(SCIFA3_SCK_PORT158_MARK, PORT158_FN2, MSEL5CR_8_1),
++ PINMUX_DATA(RMII_REF125CK_MARK, PORT158_FN3),
++ PINMUX_DATA(LCD0_D21_PORT158_MARK, PORT158_FN4, MSEL5CR_6_1),
++ PINMUX_DATA(IRDA_FIRSEL_MARK, PORT158_FN5),
++ PINMUX_DATA(IDE_D15_MARK, PORT158_FN6),
++
++ /* Port159 */
++ PINMUX_DATA(D30_MARK, PORT159_FN1),
++ PINMUX_DATA(SCIFA3_RXD_PORT159_MARK, PORT159_FN2, MSEL5CR_8_1),
++ PINMUX_DATA(RMII_REF50CK_MARK, PORT159_FN3),
++ PINMUX_DATA(LCD0_D23_PORT159_MARK, PORT159_FN4, MSEL5CR_6_1),
++ PINMUX_DATA(IDE_D14_MARK, PORT159_FN6),
++
++ /* Port160 */
++ PINMUX_DATA(D29_MARK, PORT160_FN1),
++ PINMUX_DATA(SCIFA3_TXD_PORT160_MARK, PORT160_FN2, MSEL5CR_8_1),
++ PINMUX_DATA(LCD0_D22_PORT160_MARK, PORT160_FN4, MSEL5CR_6_1),
++ PINMUX_DATA(VIO1_HD_MARK, PORT160_FN5),
++ PINMUX_DATA(IDE_D13_MARK, PORT160_FN6),
++
++ /* Port161 */
++ PINMUX_DATA(D28_MARK, PORT161_FN1),
++ PINMUX_DATA(SCIFA3_RTS_PORT161_MARK, PORT161_FN2, MSEL5CR_8_1),
++ PINMUX_DATA(ET_RX_DV_MARK, PORT161_FN3),
++ PINMUX_DATA(LCD0_D20_PORT161_MARK, PORT161_FN4, MSEL5CR_6_1),
++ PINMUX_DATA(IRDA_IN_MARK, PORT161_FN5),
++ PINMUX_DATA(IDE_D12_MARK, PORT161_FN6),
++
++ /* Port162 */
++ PINMUX_DATA(D27_MARK, PORT162_FN1),
++ PINMUX_DATA(SCIFA3_CTS_PORT162_MARK, PORT162_FN2, MSEL5CR_8_1),
++ PINMUX_DATA(LCD0_D19_PORT162_MARK, PORT162_FN4, MSEL5CR_6_1),
++ PINMUX_DATA(IRDA_OUT_MARK, PORT162_FN5),
++ PINMUX_DATA(IDE_D11_MARK, PORT162_FN6),
++
++ /* Port163 */
++ PINMUX_DATA(D26_MARK, PORT163_FN1),
++ PINMUX_DATA(MSIOF2_SS2_MARK, PORT163_FN2),
++ PINMUX_DATA(ET_COL_MARK, PORT163_FN3),
++ PINMUX_DATA(LCD0_D18_PORT163_MARK, PORT163_FN4, MSEL5CR_6_1),
++ PINMUX_DATA(IROUT_MARK, PORT163_FN5),
++ PINMUX_DATA(IDE_D10_MARK, PORT163_FN6),
++
++ /* Port164 */
++ PINMUX_DATA(D25_MARK, PORT164_FN1),
++ PINMUX_DATA(MSIOF2_TSYNC_MARK, PORT164_FN2),
++ PINMUX_DATA(ET_PHY_INT_MARK, PORT164_FN3),
++ PINMUX_DATA(LCD0_RD_MARK, PORT164_FN4),
++ PINMUX_DATA(IDE_D9_MARK, PORT164_FN6),
++
++ /* Port165 */
++ PINMUX_DATA(D24_MARK, PORT165_FN1),
++ PINMUX_DATA(MSIOF2_RXD_MARK, PORT165_FN2),
++ PINMUX_DATA(LCD0_LCLK_PORT165_MARK, PORT165_FN4, MSEL5CR_6_1),
++ PINMUX_DATA(IDE_D8_MARK, PORT165_FN6),
++
++ /* Port166 - Port171 Function1 */
++ PINMUX_DATA(D21_MARK, PORT166_FN1),
++ PINMUX_DATA(D20_MARK, PORT167_FN1),
++ PINMUX_DATA(D19_MARK, PORT168_FN1),
++ PINMUX_DATA(D18_MARK, PORT169_FN1),
++ PINMUX_DATA(D17_MARK, PORT170_FN1),
++ PINMUX_DATA(D16_MARK, PORT171_FN1),
++
++ /* Port166 - Port171 Function3 */
++ PINMUX_DATA(ET_ETXD5_MARK, PORT166_FN3),
++ PINMUX_DATA(ET_ETXD4_MARK, PORT167_FN3),
++ PINMUX_DATA(ET_ETXD3_MARK, PORT168_FN3),
++ PINMUX_DATA(ET_ETXD2_MARK, PORT169_FN3),
++ PINMUX_DATA(ET_ETXD1_MARK, PORT170_FN3),
++ PINMUX_DATA(ET_ETXD0_MARK, PORT171_FN3),
++
++ /* Port166 - Port171 Function6 */
++ PINMUX_DATA(IDE_D5_MARK, PORT166_FN6),
++ PINMUX_DATA(IDE_D4_MARK, PORT167_FN6),
++ PINMUX_DATA(IDE_D3_MARK, PORT168_FN6),
++ PINMUX_DATA(IDE_D2_MARK, PORT169_FN6),
++ PINMUX_DATA(IDE_D1_MARK, PORT170_FN6),
++ PINMUX_DATA(IDE_D0_MARK, PORT171_FN6),
++
++ /* Port167 - Port171 IRQ */
++ PINMUX_DATA(IRQ31_PORT167_MARK, PORT167_FN0, MSEL1CR_31_0),
++ PINMUX_DATA(IRQ27_PORT168_MARK, PORT168_FN0, MSEL1CR_27_0),
++ PINMUX_DATA(IRQ28_PORT169_MARK, PORT169_FN0, MSEL1CR_28_0),
++ PINMUX_DATA(IRQ29_PORT170_MARK, PORT170_FN0, MSEL1CR_29_0),
++ PINMUX_DATA(IRQ30_PORT171_MARK, PORT171_FN0, MSEL1CR_30_0),
++
++ /* Port172 */
++ PINMUX_DATA(D23_MARK, PORT172_FN1),
++ PINMUX_DATA(SCIFB_RTS_PORT172_MARK, PORT172_FN2, MSEL5CR_17_1),
++ PINMUX_DATA(ET_ETXD7_MARK, PORT172_FN3),
++ PINMUX_DATA(IDE_D7_MARK, PORT172_FN6),
++ PINMUX_DATA(IRQ4_PORT172_MARK, PORT172_FN0, MSEL1CR_4_1),
++
++ /* Port173 */
++ PINMUX_DATA(D22_MARK, PORT173_FN1),
++ PINMUX_DATA(SCIFB_CTS_PORT173_MARK, PORT173_FN2, MSEL5CR_17_1),
++ PINMUX_DATA(ET_ETXD6_MARK, PORT173_FN3),
++ PINMUX_DATA(IDE_D6_MARK, PORT173_FN6),
++ PINMUX_DATA(IRQ6_PORT173_MARK, PORT173_FN0, MSEL1CR_6_1),
++
++ /* Port174 */
++ PINMUX_DATA(A26_MARK, PORT174_FN1),
++ PINMUX_DATA(MSIOF0_TXD_MARK, PORT174_FN2),
++ PINMUX_DATA(ET_RX_CLK_MARK, PORT174_FN3),
++ PINMUX_DATA(SCIFA3_RXD_PORT174_MARK, PORT174_FN4, MSEL5CR_8_0),
++
++ /* Port175 */
++ PINMUX_DATA(A0_MARK, PORT175_FN1),
++ PINMUX_DATA(BS_MARK, PORT175_FN2),
++ PINMUX_DATA(ET_WOL_MARK, PORT175_FN3),
++ PINMUX_DATA(SCIFA3_TXD_PORT175_MARK, PORT175_FN4, MSEL5CR_8_0),
++
++ /* Port176 */
++ PINMUX_DATA(ET_GTX_CLK_MARK, PORT176_FN3),
++
++ /* Port177 */
++ PINMUX_DATA(WAIT_PORT177_MARK, PORT177_FN1, MSEL5CR_2_0),
++ PINMUX_DATA(ET_LINK_MARK, PORT177_FN3),
++ PINMUX_DATA(IDE_IOWR_MARK, PORT177_FN6),
++ PINMUX_DATA(SDHI2_WP_PORT177_MARK, PORT177_FN7, MSEL5CR_19_1),
++
++ /* Port178 */
++ PINMUX_DATA(VIO0_D12_MARK, PORT178_FN1),
++ PINMUX_DATA(VIO1_D4_MARK, PORT178_FN5),
++ PINMUX_DATA(IDE_IORD_MARK, PORT178_FN6),
++
++ /* Port179 */
++ PINMUX_DATA(VIO0_D11_MARK, PORT179_FN1),
++ PINMUX_DATA(VIO1_D3_MARK, PORT179_FN5),
++ PINMUX_DATA(IDE_IORDY_MARK, PORT179_FN6),
++
++ /* Port180 */
++ PINMUX_DATA(VIO0_D10_MARK, PORT180_FN1),
++ PINMUX_DATA(TPU0TO3_MARK, PORT180_FN4),
++ PINMUX_DATA(VIO1_D2_MARK, PORT180_FN5),
++ PINMUX_DATA(IDE_INT_MARK, PORT180_FN6),
++ PINMUX_DATA(IRQ24_MARK, PORT180_FN0),
++
++ /* Port181 */
++ PINMUX_DATA(VIO0_D9_MARK, PORT181_FN1),
++ PINMUX_DATA(VIO1_D1_MARK, PORT181_FN5),
++ PINMUX_DATA(IDE_RST_MARK, PORT181_FN6),
++
++ /* Port182 */
++ PINMUX_DATA(VIO0_D8_MARK, PORT182_FN1),
++ PINMUX_DATA(VIO1_D0_MARK, PORT182_FN5),
++ PINMUX_DATA(IDE_DIRECTION_MARK, PORT182_FN6),
++
++ /* Port183 */
++ PINMUX_DATA(DREQ1_MARK, PORT183_FN1),
++ PINMUX_DATA(BBIF2_TXD2_PORT183_MARK, PORT183_FN2, MSEL5CR_0_1),
++ PINMUX_DATA(ET_TX_EN_MARK, PORT183_FN3),
++
++ /* Port184 */
++ PINMUX_DATA(DACK1_MARK, PORT184_FN1),
++ PINMUX_DATA(BBIF2_TSYNC2_PORT184_MARK, PORT184_FN2, MSEL5CR_0_1),
++ PINMUX_DATA(ET_TX_CLK_MARK, PORT184_FN3),
++
++ /* Port185 - Port192 Function1 */
++ PINMUX_DATA(SCIFA1_SCK_MARK, PORT185_FN1),
++ PINMUX_DATA(SCIFB_RTS_PORT186_MARK, PORT186_FN1, MSEL5CR_17_0),
++ PINMUX_DATA(SCIFB_CTS_PORT187_MARK, PORT187_FN1, MSEL5CR_17_0),
++ PINMUX_DATA(SCIFA0_SCK_MARK, PORT188_FN1),
++ PINMUX_DATA(SCIFB_SCK_PORT190_MARK, PORT190_FN1, MSEL5CR_17_0),
++ PINMUX_DATA(SCIFB_RXD_PORT191_MARK, PORT191_FN1, MSEL5CR_17_0),
++ PINMUX_DATA(SCIFB_TXD_PORT192_MARK, PORT192_FN1, MSEL5CR_17_0),
++
++ /* Port185 - Port192 Function3 */
++ PINMUX_DATA(ET_ERXD0_MARK, PORT185_FN3),
++ PINMUX_DATA(ET_ERXD1_MARK, PORT186_FN3),
++ PINMUX_DATA(ET_ERXD2_MARK, PORT187_FN3),
++ PINMUX_DATA(ET_ERXD3_MARK, PORT188_FN3),
++ PINMUX_DATA(ET_ERXD4_MARK, PORT189_FN3),
++ PINMUX_DATA(ET_ERXD5_MARK, PORT190_FN3),
++ PINMUX_DATA(ET_ERXD6_MARK, PORT191_FN3),
++ PINMUX_DATA(ET_ERXD7_MARK, PORT192_FN3),
++
++ /* Port185 - Port192 Function6 */
++ PINMUX_DATA(STP1_IPCLK_MARK, PORT185_FN6),
++ PINMUX_DATA(STP1_IPD0_PORT186_MARK, PORT186_FN6, MSEL5CR_23_0),
++ PINMUX_DATA(STP1_IPEN_PORT187_MARK, PORT187_FN6, MSEL5CR_23_0),
++ PINMUX_DATA(STP1_IPSYNC_MARK, PORT188_FN6),
++ PINMUX_DATA(STP0_IPCLK_MARK, PORT189_FN6),
++ PINMUX_DATA(STP0_IPD0_MARK, PORT190_FN6),
++ PINMUX_DATA(STP0_IPEN_MARK, PORT191_FN6),
++ PINMUX_DATA(STP0_IPSYNC_MARK, PORT192_FN6),
++
++ /* Port193 */
++ PINMUX_DATA(SCIFA0_CTS_MARK, PORT193_FN1),
++ PINMUX_DATA(RMII_CRS_DV_MARK, PORT193_FN3),
++ PINMUX_DATA(STP1_IPEN_PORT193_MARK, PORT193_FN6, MSEL5CR_23_1), /* ? */
++ PINMUX_DATA(LCD1_D17_MARK, PORT193_FN7),
++
++ /* Port194 */
++ PINMUX_DATA(SCIFA0_RTS_MARK, PORT194_FN1),
++ PINMUX_DATA(RMII_RX_ER_MARK, PORT194_FN3),
++ PINMUX_DATA(STP1_IPD0_PORT194_MARK, PORT194_FN6, MSEL5CR_23_1), /* ? */
++ PINMUX_DATA(LCD1_D16_MARK, PORT194_FN7),
++
++ /* Port195 */
++ PINMUX_DATA(SCIFA1_RXD_MARK, PORT195_FN1),
++ PINMUX_DATA(RMII_RXD0_MARK, PORT195_FN3),
++ PINMUX_DATA(STP1_IPD3_MARK, PORT195_FN6),
++ PINMUX_DATA(LCD1_D15_MARK, PORT195_FN7),
++
++ /* Port196 */
++ PINMUX_DATA(SCIFA1_TXD_MARK, PORT196_FN1),
++ PINMUX_DATA(RMII_RXD1_MARK, PORT196_FN3),
++ PINMUX_DATA(STP1_IPD2_MARK, PORT196_FN6),
++ PINMUX_DATA(LCD1_D14_MARK, PORT196_FN7),
++
++ /* Port197 */
++ PINMUX_DATA(SCIFA0_RXD_MARK, PORT197_FN1),
++ PINMUX_DATA(VIO1_CLK_MARK, PORT197_FN5),
++ PINMUX_DATA(STP1_IPD5_MARK, PORT197_FN6),
++ PINMUX_DATA(LCD1_D19_MARK, PORT197_FN7),
++
++ /* Port198 */
++ PINMUX_DATA(SCIFA0_TXD_MARK, PORT198_FN1),
++ PINMUX_DATA(VIO1_VD_MARK, PORT198_FN5),
++ PINMUX_DATA(STP1_IPD4_MARK, PORT198_FN6),
++ PINMUX_DATA(LCD1_D18_MARK, PORT198_FN7),
++
++ /* Port199 */
++ PINMUX_DATA(MEMC_NWE_MARK, PORT199_FN1),
++ PINMUX_DATA(SCIFA2_SCK_PORT199_MARK, PORT199_FN2, MSEL5CR_7_1),
++ PINMUX_DATA(RMII_TX_EN_MARK, PORT199_FN3),
++ PINMUX_DATA(SIM_D_PORT199_MARK, PORT199_FN4, MSEL5CR_21_1),
++ PINMUX_DATA(STP1_IPD1_MARK, PORT199_FN6),
++ PINMUX_DATA(LCD1_D13_MARK, PORT199_FN7),
++
++ /* Port200 */
++ PINMUX_DATA(MEMC_NOE_MARK, PORT200_FN1),
++ PINMUX_DATA(SCIFA2_RXD_MARK, PORT200_FN2),
++ PINMUX_DATA(RMII_TXD0_MARK, PORT200_FN3),
++ PINMUX_DATA(STP0_IPD7_MARK, PORT200_FN6),
++ PINMUX_DATA(LCD1_D12_MARK, PORT200_FN7),
++
++ /* Port201 */
++ PINMUX_DATA(MEMC_WAIT_MARK, PORT201_FN1, MSEL4CR_6_0),
++ PINMUX_DATA(MEMC_DREQ1_MARK, PORT201_FN1, MSEL4CR_6_1),
++
++ PINMUX_DATA(SCIFA2_TXD_MARK, PORT201_FN2),
++ PINMUX_DATA(RMII_TXD1_MARK, PORT201_FN3),
++ PINMUX_DATA(STP0_IPD6_MARK, PORT201_FN6),
++ PINMUX_DATA(LCD1_D11_MARK, PORT201_FN7),
++
++ /* Port202 */
++ PINMUX_DATA(MEMC_BUSCLK_MARK, PORT202_FN1, MSEL4CR_6_0),
++ PINMUX_DATA(MEMC_A0_MARK, PORT202_FN1, MSEL4CR_6_1),
++
++ PINMUX_DATA(MSIOF1_SS2_PORT202_MARK, PORT202_FN2, MSEL4CR_10_1),
++ PINMUX_DATA(RMII_MDC_MARK, PORT202_FN3),
++ PINMUX_DATA(TPU0TO2_PORT202_MARK, PORT202_FN4, MSEL5CR_25_1),
++ PINMUX_DATA(IDE_CS0_MARK, PORT202_FN6),
++ PINMUX_DATA(SDHI2_CD_PORT202_MARK, PORT202_FN7, MSEL5CR_19_1),
++ PINMUX_DATA(IRQ21_MARK, PORT202_FN0),
++
++ /* Port203 - Port208 Function1 */
++ PINMUX_DATA(SDHI2_CLK_MARK, PORT203_FN1),
++ PINMUX_DATA(SDHI2_CMD_MARK, PORT204_FN1),
++ PINMUX_DATA(SDHI2_D0_MARK, PORT205_FN1),
++ PINMUX_DATA(SDHI2_D1_MARK, PORT206_FN1),
++ PINMUX_DATA(SDHI2_D2_MARK, PORT207_FN1),
++ PINMUX_DATA(SDHI2_D3_MARK, PORT208_FN1),
++
++ /* Port203 - Port208 Function3 */
++ PINMUX_DATA(ET_TX_ER_MARK, PORT203_FN3),
++ PINMUX_DATA(ET_RX_ER_MARK, PORT204_FN3),
++ PINMUX_DATA(ET_CRS_MARK, PORT205_FN3),
++ PINMUX_DATA(ET_MDC_MARK, PORT206_FN3),
++ PINMUX_DATA(ET_MDIO_MARK, PORT207_FN3),
++ PINMUX_DATA(RMII_MDIO_MARK, PORT208_FN3),
++
++ /* Port203 - Port208 Function6 */
++ PINMUX_DATA(IDE_A2_MARK, PORT203_FN6),
++ PINMUX_DATA(IDE_A1_MARK, PORT204_FN6),
++ PINMUX_DATA(IDE_A0_MARK, PORT205_FN6),
++ PINMUX_DATA(IDE_IODACK_MARK, PORT206_FN6),
++ PINMUX_DATA(IDE_IODREQ_MARK, PORT207_FN6),
++ PINMUX_DATA(IDE_CS1_MARK, PORT208_FN6),
++
++ /* Port203 - Port208 Function7 */
++ PINMUX_DATA(SCIFA4_TXD_PORT203_MARK, PORT203_FN7, MSEL5CR_12_0, MSEL5CR_11_1),
++ PINMUX_DATA(SCIFA4_RXD_PORT204_MARK, PORT204_FN7, MSEL5CR_12_0, MSEL5CR_11_1),
++ PINMUX_DATA(SCIFA4_SCK_PORT205_MARK, PORT205_FN7, MSEL5CR_10_1),
++ PINMUX_DATA(SCIFA5_SCK_PORT206_MARK, PORT206_FN7, MSEL5CR_13_1),
++ PINMUX_DATA(SCIFA5_RXD_PORT207_MARK, PORT207_FN7, MSEL5CR_15_0, MSEL5CR_14_1),
++ PINMUX_DATA(SCIFA5_TXD_PORT208_MARK, PORT208_FN7, MSEL5CR_15_0, MSEL5CR_14_1),
++
++ /* Port209 */
++ PINMUX_DATA(VBUS_MARK, PORT209_FN1),
++ PINMUX_DATA(IRQ7_PORT209_MARK, PORT209_FN0, MSEL1CR_7_1),
++
++ /* Port210 */
++ PINMUX_DATA(IRQ9_PORT210_MARK, PORT210_FN0, MSEL1CR_9_1),
++
++ /* Port211 */
++ PINMUX_DATA(IRQ16_PORT211_MARK, PORT211_FN0, MSEL1CR_16_1),
++
++ /* LCDC select */
++ PINMUX_DATA(LCDC0_SELECT_MARK, MSEL3CR_6_0),
++ PINMUX_DATA(LCDC1_SELECT_MARK, MSEL3CR_6_1),
++
++ /* SDENC */
++ PINMUX_DATA(SDENC_CPG_MARK, MSEL4CR_19_0),
++ PINMUX_DATA(SDENC_DV_CLKI_MARK, MSEL4CR_19_1),
++
++ /* SYSC */
++ PINMUX_DATA(RESETP_PULLUP_MARK, MSEL4CR_4_0),
++ PINMUX_DATA(RESETP_PLAIN_MARK, MSEL4CR_4_1),
++
++ /* DEBUG */
++ PINMUX_DATA(EDEBGREQ_PULLDOWN_MARK, MSEL4CR_1_0),
++ PINMUX_DATA(EDEBGREQ_PULLUP_MARK, MSEL4CR_1_1),
++
++ PINMUX_DATA(TRACEAUD_FROM_VIO_MARK, MSEL5CR_30_0, MSEL5CR_29_0),
++ PINMUX_DATA(TRACEAUD_FROM_LCDC0_MARK, MSEL5CR_30_0, MSEL5CR_29_1),
++ PINMUX_DATA(TRACEAUD_FROM_MEMC_MARK, MSEL5CR_30_1, MSEL5CR_29_0),
++};
++
++static struct pinmux_gpio pinmux_gpios[] = {
++
++ /* PORT */
++ GPIO_PORT_ALL(),
++
++ /* IRQ */
++ GPIO_FN(IRQ0_PORT2), GPIO_FN(IRQ0_PORT13),
++ GPIO_FN(IRQ1),
++ GPIO_FN(IRQ2_PORT11), GPIO_FN(IRQ2_PORT12),
++ GPIO_FN(IRQ3_PORT10), GPIO_FN(IRQ3_PORT14),
++ GPIO_FN(IRQ4_PORT15), GPIO_FN(IRQ4_PORT172),
++ GPIO_FN(IRQ5_PORT0), GPIO_FN(IRQ5_PORT1),
++ GPIO_FN(IRQ6_PORT121), GPIO_FN(IRQ6_PORT173),
++ GPIO_FN(IRQ7_PORT120), GPIO_FN(IRQ7_PORT209),
++ GPIO_FN(IRQ8),
++ GPIO_FN(IRQ9_PORT118), GPIO_FN(IRQ9_PORT210),
++ GPIO_FN(IRQ10),
++ GPIO_FN(IRQ11),
++ GPIO_FN(IRQ12_PORT42), GPIO_FN(IRQ12_PORT97),
++ GPIO_FN(IRQ13_PORT64), GPIO_FN(IRQ13_PORT98),
++ GPIO_FN(IRQ14_PORT63), GPIO_FN(IRQ14_PORT99),
++ GPIO_FN(IRQ15_PORT62), GPIO_FN(IRQ15_PORT100),
++ GPIO_FN(IRQ16_PORT68), GPIO_FN(IRQ16_PORT211),
++ GPIO_FN(IRQ17),
++ GPIO_FN(IRQ18),
++ GPIO_FN(IRQ19),
++ GPIO_FN(IRQ20),
++ GPIO_FN(IRQ21),
++ GPIO_FN(IRQ22),
++ GPIO_FN(IRQ23),
++ GPIO_FN(IRQ24),
++ GPIO_FN(IRQ25),
++ GPIO_FN(IRQ26_PORT58), GPIO_FN(IRQ26_PORT81),
++ GPIO_FN(IRQ27_PORT57), GPIO_FN(IRQ27_PORT168),
++ GPIO_FN(IRQ28_PORT56), GPIO_FN(IRQ28_PORT169),
++ GPIO_FN(IRQ29_PORT50), GPIO_FN(IRQ29_PORT170),
++ GPIO_FN(IRQ30_PORT49), GPIO_FN(IRQ30_PORT171),
++ GPIO_FN(IRQ31_PORT41), GPIO_FN(IRQ31_PORT167),
++
++ /* Function */
++
++ /* DBGT */
++ GPIO_FN(DBGMDT2), GPIO_FN(DBGMDT1), GPIO_FN(DBGMDT0),
++ GPIO_FN(DBGMD10), GPIO_FN(DBGMD11), GPIO_FN(DBGMD20),
++ GPIO_FN(DBGMD21),
++
++ /* FSI */
++ GPIO_FN(FSIAISLD_PORT0), /* FSIAISLD Port 0/5 */
++ GPIO_FN(FSIAISLD_PORT5),
++ GPIO_FN(FSIASPDIF_PORT9), /* FSIASPDIF Port 9/18 */
++ GPIO_FN(FSIASPDIF_PORT18),
++ GPIO_FN(FSIAOSLD1), GPIO_FN(FSIAOSLD2), GPIO_FN(FSIAOLR),
++ GPIO_FN(FSIAOBT), GPIO_FN(FSIAOSLD), GPIO_FN(FSIAOMC),
++ GPIO_FN(FSIACK), GPIO_FN(FSIAILR), GPIO_FN(FSIAIBT),
++
++ /* FMSI */
++ GPIO_FN(FMSISLD_PORT1), /* FMSISLD Port 1/6 */
++ GPIO_FN(FMSISLD_PORT6),
++ GPIO_FN(FMSIILR), GPIO_FN(FMSIIBT), GPIO_FN(FMSIOLR),
++ GPIO_FN(FMSIOBT), GPIO_FN(FMSICK), GPIO_FN(FMSOILR),
++ GPIO_FN(FMSOIBT), GPIO_FN(FMSOOLR), GPIO_FN(FMSOOBT),
++ GPIO_FN(FMSOSLD), GPIO_FN(FMSOCK),
++
++ /* SCIFA0 */
++ GPIO_FN(SCIFA0_SCK), GPIO_FN(SCIFA0_CTS), GPIO_FN(SCIFA0_RTS),
++ GPIO_FN(SCIFA0_RXD), GPIO_FN(SCIFA0_TXD),
++
++ /* SCIFA1 */
++ GPIO_FN(SCIFA1_CTS), GPIO_FN(SCIFA1_SCK),
++ GPIO_FN(SCIFA1_RXD), GPIO_FN(SCIFA1_TXD), GPIO_FN(SCIFA1_RTS),
++
++ /* SCIFA2 */
++ GPIO_FN(SCIFA2_SCK_PORT22), /* SCIFA2_SCK Port 22/199 */
++ GPIO_FN(SCIFA2_SCK_PORT199),
++ GPIO_FN(SCIFA2_RXD), GPIO_FN(SCIFA2_TXD),
++ GPIO_FN(SCIFA2_CTS), GPIO_FN(SCIFA2_RTS),
++
++ /* SCIFA3 */
++ GPIO_FN(SCIFA3_RTS_PORT105), /* MSEL5CR_8_0 */
++ GPIO_FN(SCIFA3_SCK_PORT116),
++ GPIO_FN(SCIFA3_CTS_PORT117),
++ GPIO_FN(SCIFA3_RXD_PORT174),
++ GPIO_FN(SCIFA3_TXD_PORT175),
++
++ GPIO_FN(SCIFA3_RTS_PORT161), /* MSEL5CR_8_1 */
++ GPIO_FN(SCIFA3_SCK_PORT158),
++ GPIO_FN(SCIFA3_CTS_PORT162),
++ GPIO_FN(SCIFA3_RXD_PORT159),
++ GPIO_FN(SCIFA3_TXD_PORT160),
++
++ /* SCIFA4 */
++ GPIO_FN(SCIFA4_RXD_PORT12), /* MSEL5CR[12:11] = 00 */
++ GPIO_FN(SCIFA4_TXD_PORT13),
++
++ GPIO_FN(SCIFA4_RXD_PORT204), /* MSEL5CR[12:11] = 01 */
++ GPIO_FN(SCIFA4_TXD_PORT203),
++
++ GPIO_FN(SCIFA4_RXD_PORT94), /* MSEL5CR[12:11] = 10 */
++ GPIO_FN(SCIFA4_TXD_PORT93),
++
++ GPIO_FN(SCIFA4_SCK_PORT21), /* SCIFA4_SCK Port 21/205 */
++ GPIO_FN(SCIFA4_SCK_PORT205),
++
++ /* SCIFA5 */
++ GPIO_FN(SCIFA5_TXD_PORT20), /* MSEL5CR[15:14] = 00 */
++ GPIO_FN(SCIFA5_RXD_PORT10),
++
++ GPIO_FN(SCIFA5_RXD_PORT207), /* MSEL5CR[15:14] = 01 */
++ GPIO_FN(SCIFA5_TXD_PORT208),
++
++ GPIO_FN(SCIFA5_TXD_PORT91), /* MSEL5CR[15:14] = 10 */
++ GPIO_FN(SCIFA5_RXD_PORT92),
++
++ GPIO_FN(SCIFA5_SCK_PORT23), /* SCIFA5_SCK Port 23/206 */
++ GPIO_FN(SCIFA5_SCK_PORT206),
++
++ /* SCIFA6 */
++ GPIO_FN(SCIFA6_SCK), GPIO_FN(SCIFA6_RXD), GPIO_FN(SCIFA6_TXD),
++
++ /* SCIFA7 */
++ GPIO_FN(SCIFA7_TXD), GPIO_FN(SCIFA7_RXD),
++
++ /* SCIFAB */
++ GPIO_FN(SCIFB_SCK_PORT190), /* MSEL5CR_17_0 */
++ GPIO_FN(SCIFB_RXD_PORT191),
++ GPIO_FN(SCIFB_TXD_PORT192),
++ GPIO_FN(SCIFB_RTS_PORT186),
++ GPIO_FN(SCIFB_CTS_PORT187),
++
++ GPIO_FN(SCIFB_SCK_PORT2), /* MSEL5CR_17_1 */
++ GPIO_FN(SCIFB_RXD_PORT3),
++ GPIO_FN(SCIFB_TXD_PORT4),
++ GPIO_FN(SCIFB_RTS_PORT172),
++ GPIO_FN(SCIFB_CTS_PORT173),
++
++ /* LCD0 */
++ GPIO_FN(LCD0_D0), GPIO_FN(LCD0_D1), GPIO_FN(LCD0_D2),
++ GPIO_FN(LCD0_D3), GPIO_FN(LCD0_D4), GPIO_FN(LCD0_D5),
++ GPIO_FN(LCD0_D6), GPIO_FN(LCD0_D7), GPIO_FN(LCD0_D8),
++ GPIO_FN(LCD0_D9), GPIO_FN(LCD0_D10), GPIO_FN(LCD0_D11),
++ GPIO_FN(LCD0_D12), GPIO_FN(LCD0_D13), GPIO_FN(LCD0_D14),
++ GPIO_FN(LCD0_D15), GPIO_FN(LCD0_D16), GPIO_FN(LCD0_D17),
++ GPIO_FN(LCD0_DON), GPIO_FN(LCD0_VCPWC), GPIO_FN(LCD0_VEPWC),
++ GPIO_FN(LCD0_DCK), GPIO_FN(LCD0_VSYN),
++ GPIO_FN(LCD0_HSYN), GPIO_FN(LCD0_DISP),
++ GPIO_FN(LCD0_WR), GPIO_FN(LCD0_RD),
++ GPIO_FN(LCD0_CS), GPIO_FN(LCD0_RS),
++
++ GPIO_FN(LCD0_D18_PORT163), GPIO_FN(LCD0_D19_PORT162),
++ GPIO_FN(LCD0_D20_PORT161), GPIO_FN(LCD0_D21_PORT158),
++ GPIO_FN(LCD0_D22_PORT160), GPIO_FN(LCD0_D23_PORT159),
++ GPIO_FN(LCD0_LCLK_PORT165), /* MSEL5CR_6_1 */
++
++ GPIO_FN(LCD0_D18_PORT40), GPIO_FN(LCD0_D19_PORT4),
++ GPIO_FN(LCD0_D20_PORT3), GPIO_FN(LCD0_D21_PORT2),
++ GPIO_FN(LCD0_D22_PORT0), GPIO_FN(LCD0_D23_PORT1),
++ GPIO_FN(LCD0_LCLK_PORT102), /* MSEL5CR_6_0 */
++
++ /* LCD1 */
++ GPIO_FN(LCD1_D0), GPIO_FN(LCD1_D1), GPIO_FN(LCD1_D2),
++ GPIO_FN(LCD1_D3), GPIO_FN(LCD1_D4), GPIO_FN(LCD1_D5),
++ GPIO_FN(LCD1_D6), GPIO_FN(LCD1_D7), GPIO_FN(LCD1_D8),
++ GPIO_FN(LCD1_D9), GPIO_FN(LCD1_D10), GPIO_FN(LCD1_D11),
++ GPIO_FN(LCD1_D12), GPIO_FN(LCD1_D13), GPIO_FN(LCD1_D14),
++ GPIO_FN(LCD1_D15), GPIO_FN(LCD1_D16), GPIO_FN(LCD1_D17),
++ GPIO_FN(LCD1_D18), GPIO_FN(LCD1_D19), GPIO_FN(LCD1_D20),
++ GPIO_FN(LCD1_D21), GPIO_FN(LCD1_D22), GPIO_FN(LCD1_D23),
++ GPIO_FN(LCD1_RS), GPIO_FN(LCD1_RD), GPIO_FN(LCD1_CS),
++ GPIO_FN(LCD1_WR), GPIO_FN(LCD1_DCK), GPIO_FN(LCD1_DON),
++ GPIO_FN(LCD1_VCPWC), GPIO_FN(LCD1_LCLK), GPIO_FN(LCD1_HSYN),
++ GPIO_FN(LCD1_VSYN), GPIO_FN(LCD1_VEPWC), GPIO_FN(LCD1_DISP),
++
++ /* RSPI */
++ GPIO_FN(RSPI_SSL0_A), GPIO_FN(RSPI_SSL1_A), GPIO_FN(RSPI_SSL2_A),
++ GPIO_FN(RSPI_SSL3_A), GPIO_FN(RSPI_CK_A), GPIO_FN(RSPI_MOSI_A),
++ GPIO_FN(RSPI_MISO_A),
++
++ /* VIO CKO */
++ GPIO_FN(VIO_CKO1),
++ GPIO_FN(VIO_CKO2),
++ GPIO_FN(VIO_CKO_1),
++ GPIO_FN(VIO_CKO),
++
++ /* VIO0 */
++ GPIO_FN(VIO0_D0), GPIO_FN(VIO0_D1), GPIO_FN(VIO0_D2),
++ GPIO_FN(VIO0_D3), GPIO_FN(VIO0_D4), GPIO_FN(VIO0_D5),
++ GPIO_FN(VIO0_D6), GPIO_FN(VIO0_D7), GPIO_FN(VIO0_D8),
++ GPIO_FN(VIO0_D9), GPIO_FN(VIO0_D10), GPIO_FN(VIO0_D11),
++ GPIO_FN(VIO0_D12), GPIO_FN(VIO0_VD), GPIO_FN(VIO0_HD),
++ GPIO_FN(VIO0_CLK), GPIO_FN(VIO0_FIELD),
++
++ GPIO_FN(VIO0_D13_PORT26), /* MSEL5CR_27_0 */
++ GPIO_FN(VIO0_D14_PORT25),
++ GPIO_FN(VIO0_D15_PORT24),
++
++ GPIO_FN(VIO0_D13_PORT22), /* MSEL5CR_27_1 */
++ GPIO_FN(VIO0_D14_PORT95),
++ GPIO_FN(VIO0_D15_PORT96),
++
++ /* VIO1 */
++ GPIO_FN(VIO1_D0), GPIO_FN(VIO1_D1), GPIO_FN(VIO1_D2),
++ GPIO_FN(VIO1_D3), GPIO_FN(VIO1_D4), GPIO_FN(VIO1_D5),
++ GPIO_FN(VIO1_D6), GPIO_FN(VIO1_D7), GPIO_FN(VIO1_VD),
++ GPIO_FN(VIO1_HD), GPIO_FN(VIO1_CLK), GPIO_FN(VIO1_FIELD),
++
++ /* TPU0 */
++ GPIO_FN(TPU0TO0), GPIO_FN(TPU0TO1), GPIO_FN(TPU0TO3),
++ GPIO_FN(TPU0TO2_PORT66), /* TPU0TO2 Port 66/202 */
++ GPIO_FN(TPU0TO2_PORT202),
++
++ /* SSP1 0 */
++ GPIO_FN(STP0_IPD0), GPIO_FN(STP0_IPD1), GPIO_FN(STP0_IPD2),
++ GPIO_FN(STP0_IPD3), GPIO_FN(STP0_IPD4), GPIO_FN(STP0_IPD5),
++ GPIO_FN(STP0_IPD6), GPIO_FN(STP0_IPD7), GPIO_FN(STP0_IPEN),
++ GPIO_FN(STP0_IPCLK), GPIO_FN(STP0_IPSYNC),
++
++ /* SSP1 1 */
++ GPIO_FN(STP1_IPD1), GPIO_FN(STP1_IPD2), GPIO_FN(STP1_IPD3),
++ GPIO_FN(STP1_IPD4), GPIO_FN(STP1_IPD5), GPIO_FN(STP1_IPD6),
++ GPIO_FN(STP1_IPD7), GPIO_FN(STP1_IPCLK), GPIO_FN(STP1_IPSYNC),
++
++ GPIO_FN(STP1_IPD0_PORT186), /* MSEL5CR_23_0 */
++ GPIO_FN(STP1_IPEN_PORT187),
++
++ GPIO_FN(STP1_IPD0_PORT194), /* MSEL5CR_23_1 */
++ GPIO_FN(STP1_IPEN_PORT193),
++
++ /* SIM */
++ GPIO_FN(SIM_RST), GPIO_FN(SIM_CLK),
++ GPIO_FN(SIM_D_PORT22), /* SIM_D Port 22/199 */
++ GPIO_FN(SIM_D_PORT199),
++
++ /* SDHI0 */
++ GPIO_FN(SDHI0_D0), GPIO_FN(SDHI0_D1), GPIO_FN(SDHI0_D2),
++ GPIO_FN(SDHI0_D3), GPIO_FN(SDHI0_CD), GPIO_FN(SDHI0_WP),
++ GPIO_FN(SDHI0_CMD), GPIO_FN(SDHI0_CLK),
++
++ /* SDHI1 */
++ GPIO_FN(SDHI1_D0), GPIO_FN(SDHI1_D1), GPIO_FN(SDHI1_D2),
++ GPIO_FN(SDHI1_D3), GPIO_FN(SDHI1_CD), GPIO_FN(SDHI1_WP),
++ GPIO_FN(SDHI1_CMD), GPIO_FN(SDHI1_CLK),
++
++ /* SDHI2 */
++ GPIO_FN(SDHI2_D0), GPIO_FN(SDHI2_D1), GPIO_FN(SDHI2_D2),
++ GPIO_FN(SDHI2_D3), GPIO_FN(SDHI2_CLK), GPIO_FN(SDHI2_CMD),
++
++ GPIO_FN(SDHI2_CD_PORT24), /* MSEL5CR_19_0 */
++ GPIO_FN(SDHI2_WP_PORT25),
++
++ GPIO_FN(SDHI2_WP_PORT177), /* MSEL5CR_19_1 */
++ GPIO_FN(SDHI2_CD_PORT202),
++
++ /* MSIOF2 */
++ GPIO_FN(MSIOF2_TXD), GPIO_FN(MSIOF2_RXD), GPIO_FN(MSIOF2_TSCK),
++ GPIO_FN(MSIOF2_SS2), GPIO_FN(MSIOF2_TSYNC), GPIO_FN(MSIOF2_SS1),
++ GPIO_FN(MSIOF2_MCK1), GPIO_FN(MSIOF2_MCK0), GPIO_FN(MSIOF2_RSYNC),
++ GPIO_FN(MSIOF2_RSCK),
++
++ /* KEYSC */
++ GPIO_FN(KEYIN4), GPIO_FN(KEYIN5),
++ GPIO_FN(KEYIN6), GPIO_FN(KEYIN7),
++ GPIO_FN(KEYOUT0), GPIO_FN(KEYOUT1), GPIO_FN(KEYOUT2),
++ GPIO_FN(KEYOUT3), GPIO_FN(KEYOUT4), GPIO_FN(KEYOUT5),
++ GPIO_FN(KEYOUT6), GPIO_FN(KEYOUT7),
++
++ GPIO_FN(KEYIN0_PORT43), /* MSEL4CR_18_0 */
++ GPIO_FN(KEYIN1_PORT44),
++ GPIO_FN(KEYIN2_PORT45),
++ GPIO_FN(KEYIN3_PORT46),
++
++ GPIO_FN(KEYIN0_PORT58), /* MSEL4CR_18_1 */
++ GPIO_FN(KEYIN1_PORT57),
++ GPIO_FN(KEYIN2_PORT56),
++ GPIO_FN(KEYIN3_PORT55),
++
++ /* VOU */
++ GPIO_FN(DV_D0), GPIO_FN(DV_D1), GPIO_FN(DV_D2),
++ GPIO_FN(DV_D3), GPIO_FN(DV_D4), GPIO_FN(DV_D5),
++ GPIO_FN(DV_D6), GPIO_FN(DV_D7), GPIO_FN(DV_D8),
++ GPIO_FN(DV_D9), GPIO_FN(DV_D10), GPIO_FN(DV_D11),
++ GPIO_FN(DV_D12), GPIO_FN(DV_D13), GPIO_FN(DV_D14),
++ GPIO_FN(DV_D15), GPIO_FN(DV_CLK),
++ GPIO_FN(DV_VSYNC), GPIO_FN(DV_HSYNC),
++
++ /* MEMC */
++ GPIO_FN(MEMC_AD0), GPIO_FN(MEMC_AD1), GPIO_FN(MEMC_AD2),
++ GPIO_FN(MEMC_AD3), GPIO_FN(MEMC_AD4), GPIO_FN(MEMC_AD5),
++ GPIO_FN(MEMC_AD6), GPIO_FN(MEMC_AD7), GPIO_FN(MEMC_AD8),
++ GPIO_FN(MEMC_AD9), GPIO_FN(MEMC_AD10), GPIO_FN(MEMC_AD11),
++ GPIO_FN(MEMC_AD12), GPIO_FN(MEMC_AD13), GPIO_FN(MEMC_AD14),
++ GPIO_FN(MEMC_AD15), GPIO_FN(MEMC_CS0), GPIO_FN(MEMC_INT),
++ GPIO_FN(MEMC_NWE), GPIO_FN(MEMC_NOE), GPIO_FN(MEMC_CS1),
++ GPIO_FN(MEMC_A1), GPIO_FN(MEMC_ADV), GPIO_FN(MEMC_DREQ0),
++ GPIO_FN(MEMC_WAIT), GPIO_FN(MEMC_DREQ1), GPIO_FN(MEMC_BUSCLK),
++ GPIO_FN(MEMC_A0),
++
++ /* MMC */
++ GPIO_FN(MMC0_D0_PORT68), GPIO_FN(MMC0_D1_PORT69),
++ GPIO_FN(MMC0_D2_PORT70), GPIO_FN(MMC0_D3_PORT71),
++ GPIO_FN(MMC0_D4_PORT72), GPIO_FN(MMC0_D5_PORT73),
++ GPIO_FN(MMC0_D6_PORT74), GPIO_FN(MMC0_D7_PORT75),
++ GPIO_FN(MMC0_CLK_PORT66),
++ GPIO_FN(MMC0_CMD_PORT67), /* MSEL4CR_15_0 */
++
++ GPIO_FN(MMC1_D0_PORT149), GPIO_FN(MMC1_D1_PORT148),
++ GPIO_FN(MMC1_D2_PORT147), GPIO_FN(MMC1_D3_PORT146),
++ GPIO_FN(MMC1_D4_PORT145), GPIO_FN(MMC1_D5_PORT144),
++ GPIO_FN(MMC1_D6_PORT143), GPIO_FN(MMC1_D7_PORT142),
++ GPIO_FN(MMC1_CLK_PORT103),
++ GPIO_FN(MMC1_CMD_PORT104), /* MSEL4CR_15_1 */
++
++ /* MSIOF0 */
++ GPIO_FN(MSIOF0_SS1), GPIO_FN(MSIOF0_SS2), GPIO_FN(MSIOF0_RXD),
++ GPIO_FN(MSIOF0_TXD), GPIO_FN(MSIOF0_MCK0), GPIO_FN(MSIOF0_MCK1),
++ GPIO_FN(MSIOF0_RSYNC), GPIO_FN(MSIOF0_RSCK), GPIO_FN(MSIOF0_TSCK),
++ GPIO_FN(MSIOF0_TSYNC),
++
++ /* MSIOF1 */
++ GPIO_FN(MSIOF1_RSCK), GPIO_FN(MSIOF1_RSYNC),
++ GPIO_FN(MSIOF1_MCK0), GPIO_FN(MSIOF1_MCK1),
++
++ GPIO_FN(MSIOF1_SS2_PORT116), GPIO_FN(MSIOF1_SS1_PORT117),
++ GPIO_FN(MSIOF1_RXD_PORT118), GPIO_FN(MSIOF1_TXD_PORT119),
++ GPIO_FN(MSIOF1_TSYNC_PORT120),
++ GPIO_FN(MSIOF1_TSCK_PORT121), /* MSEL4CR_10_0 */
++
++ GPIO_FN(MSIOF1_SS1_PORT67), GPIO_FN(MSIOF1_TSCK_PORT72),
++ GPIO_FN(MSIOF1_TSYNC_PORT73), GPIO_FN(MSIOF1_TXD_PORT74),
++ GPIO_FN(MSIOF1_RXD_PORT75),
++ GPIO_FN(MSIOF1_SS2_PORT202), /* MSEL4CR_10_1 */
++
++ /* GPIO */
++ GPIO_FN(GPO0), GPIO_FN(GPI0),
++ GPIO_FN(GPO1), GPIO_FN(GPI1),
++
++ /* USB0 */
++ GPIO_FN(USB0_OCI), GPIO_FN(USB0_PPON), GPIO_FN(VBUS),
++
++ /* USB1 */
++ GPIO_FN(USB1_OCI), GPIO_FN(USB1_PPON),
++
++ /* BBIF1 */
++ GPIO_FN(BBIF1_RXD), GPIO_FN(BBIF1_TXD), GPIO_FN(BBIF1_TSYNC),
++ GPIO_FN(BBIF1_TSCK), GPIO_FN(BBIF1_RSCK), GPIO_FN(BBIF1_RSYNC),
++ GPIO_FN(BBIF1_FLOW), GPIO_FN(BBIF1_RX_FLOW_N),
++
++ /* BBIF2 */
++ GPIO_FN(BBIF2_TXD2_PORT5), /* MSEL5CR_0_0 */
++ GPIO_FN(BBIF2_RXD2_PORT60),
++ GPIO_FN(BBIF2_TSYNC2_PORT6),
++ GPIO_FN(BBIF2_TSCK2_PORT59),
++
++ GPIO_FN(BBIF2_RXD2_PORT90), /* MSEL5CR_0_1 */
++ GPIO_FN(BBIF2_TXD2_PORT183),
++ GPIO_FN(BBIF2_TSCK2_PORT89),
++ GPIO_FN(BBIF2_TSYNC2_PORT184),
++
++ /* BSC / FLCTL / PCMCIA */
++ GPIO_FN(CS0), GPIO_FN(CS2), GPIO_FN(CS4),
++ GPIO_FN(CS5B), GPIO_FN(CS6A),
++ GPIO_FN(CS5A_PORT105), /* CS5A PORT 19/105 */
++ GPIO_FN(CS5A_PORT19),
++ GPIO_FN(IOIS16), /* ? */
++
++ GPIO_FN(A0), GPIO_FN(A1), GPIO_FN(A2), GPIO_FN(A3),
++ GPIO_FN(A4_FOE), GPIO_FN(A5_FCDE), /* share with FLCTL */
++ GPIO_FN(A6), GPIO_FN(A7), GPIO_FN(A8), GPIO_FN(A9),
++ GPIO_FN(A10), GPIO_FN(A11), GPIO_FN(A12), GPIO_FN(A13),
++ GPIO_FN(A14), GPIO_FN(A15), GPIO_FN(A16), GPIO_FN(A17),
++ GPIO_FN(A18), GPIO_FN(A19), GPIO_FN(A20), GPIO_FN(A21),
++ GPIO_FN(A22), GPIO_FN(A23), GPIO_FN(A24), GPIO_FN(A25),
++ GPIO_FN(A26),
++
++ GPIO_FN(D0_NAF0), GPIO_FN(D1_NAF1), /* share with FLCTL */
++ GPIO_FN(D2_NAF2), GPIO_FN(D3_NAF3), /* share with FLCTL */
++ GPIO_FN(D4_NAF4), GPIO_FN(D5_NAF5), /* share with FLCTL */
++ GPIO_FN(D6_NAF6), GPIO_FN(D7_NAF7), /* share with FLCTL */
++ GPIO_FN(D8_NAF8), GPIO_FN(D9_NAF9), /* share with FLCTL */
++ GPIO_FN(D10_NAF10), GPIO_FN(D11_NAF11), /* share with FLCTL */
++ GPIO_FN(D12_NAF12), GPIO_FN(D13_NAF13), /* share with FLCTL */
++ GPIO_FN(D14_NAF14), GPIO_FN(D15_NAF15), /* share with FLCTL */
++ GPIO_FN(D16), GPIO_FN(D17), GPIO_FN(D18), GPIO_FN(D19),
++ GPIO_FN(D20), GPIO_FN(D21), GPIO_FN(D22), GPIO_FN(D23),
++ GPIO_FN(D24), GPIO_FN(D25), GPIO_FN(D26), GPIO_FN(D27),
++ GPIO_FN(D28), GPIO_FN(D29), GPIO_FN(D30), GPIO_FN(D31),
++
++ GPIO_FN(WE0_FWE), /* share with FLCTL */
++ GPIO_FN(WE1),
++ GPIO_FN(WE2_ICIORD), /* share with PCMCIA */
++ GPIO_FN(WE3_ICIOWR), /* share with PCMCIA */
++ GPIO_FN(CKO), GPIO_FN(BS), GPIO_FN(RDWR),
++ GPIO_FN(RD_FSC), /* share with FLCTL */
++ GPIO_FN(WAIT_PORT177), /* WAIT Port 90/177 */
++ GPIO_FN(WAIT_PORT90),
++
++ GPIO_FN(FCE0), GPIO_FN(FCE1), GPIO_FN(FRB), /* FLCTL */
++
++ /* IRDA */
++ GPIO_FN(IRDA_FIRSEL), GPIO_FN(IRDA_IN), GPIO_FN(IRDA_OUT),
++
++ /* ATAPI */
++ GPIO_FN(IDE_D0), GPIO_FN(IDE_D1), GPIO_FN(IDE_D2),
++ GPIO_FN(IDE_D3), GPIO_FN(IDE_D4), GPIO_FN(IDE_D5),
++ GPIO_FN(IDE_D6), GPIO_FN(IDE_D7), GPIO_FN(IDE_D8),
++ GPIO_FN(IDE_D9), GPIO_FN(IDE_D10), GPIO_FN(IDE_D11),
++ GPIO_FN(IDE_D12), GPIO_FN(IDE_D13), GPIO_FN(IDE_D14),
++ GPIO_FN(IDE_D15), GPIO_FN(IDE_A0), GPIO_FN(IDE_A1),
++ GPIO_FN(IDE_A2), GPIO_FN(IDE_CS0), GPIO_FN(IDE_CS1),
++ GPIO_FN(IDE_IOWR), GPIO_FN(IDE_IORD), GPIO_FN(IDE_IORDY),
++ GPIO_FN(IDE_INT), GPIO_FN(IDE_RST), GPIO_FN(IDE_DIRECTION),
++ GPIO_FN(IDE_EXBUF_ENB), GPIO_FN(IDE_IODACK), GPIO_FN(IDE_IODREQ),
++
++ /* RMII */
++ GPIO_FN(RMII_CRS_DV), GPIO_FN(RMII_RX_ER), GPIO_FN(RMII_RXD0),
++ GPIO_FN(RMII_RXD1), GPIO_FN(RMII_TX_EN), GPIO_FN(RMII_TXD0),
++ GPIO_FN(RMII_MDC), GPIO_FN(RMII_TXD1), GPIO_FN(RMII_MDIO),
++ GPIO_FN(RMII_REF50CK), GPIO_FN(RMII_REF125CK), /* for GMII */
++
++ /* GEther */
++ GPIO_FN(ET_TX_CLK), GPIO_FN(ET_TX_EN), GPIO_FN(ET_ETXD0),
++ GPIO_FN(ET_ETXD1), GPIO_FN(ET_ETXD2), GPIO_FN(ET_ETXD3),
++ GPIO_FN(ET_ETXD4), GPIO_FN(ET_ETXD5), /* for GEther */
++ GPIO_FN(ET_ETXD6), GPIO_FN(ET_ETXD7), /* for GEther */
++ GPIO_FN(ET_COL), GPIO_FN(ET_TX_ER), GPIO_FN(ET_RX_CLK),
++ GPIO_FN(ET_RX_DV), GPIO_FN(ET_ERXD0), GPIO_FN(ET_ERXD1),
++ GPIO_FN(ET_ERXD2), GPIO_FN(ET_ERXD3),
++ GPIO_FN(ET_ERXD4), GPIO_FN(ET_ERXD5), /* for GEther */
++ GPIO_FN(ET_ERXD6), GPIO_FN(ET_ERXD7), /* for GEther */
++ GPIO_FN(ET_RX_ER), GPIO_FN(ET_CRS), GPIO_FN(ET_MDC),
++ GPIO_FN(ET_MDIO), GPIO_FN(ET_LINK), GPIO_FN(ET_PHY_INT),
++ GPIO_FN(ET_WOL), GPIO_FN(ET_GTX_CLK),
++
++ /* DMA0 */
++ GPIO_FN(DREQ0), GPIO_FN(DACK0),
++
++ /* DMA1 */
++ GPIO_FN(DREQ1), GPIO_FN(DACK1),
++
++ /* SYSC */
++ GPIO_FN(RESETOUTS),
++
++ /* IRREM */
++ GPIO_FN(IROUT),
++
++ /* LCDC */
++ GPIO_FN(LCDC0_SELECT),
++ GPIO_FN(LCDC1_SELECT),
++
++ /* SDENC */
++ GPIO_FN(SDENC_CPG),
++ GPIO_FN(SDENC_DV_CLKI),
++
++ /* SYSC */
++ GPIO_FN(RESETP_PULLUP),
++ GPIO_FN(RESETP_PLAIN),
++
++ /* DEBUG */
++ GPIO_FN(EDEBGREQ_PULLDOWN),
++ GPIO_FN(EDEBGREQ_PULLUP),
++
++ GPIO_FN(TRACEAUD_FROM_VIO),
++ GPIO_FN(TRACEAUD_FROM_LCDC0),
++ GPIO_FN(TRACEAUD_FROM_MEMC),
++};
++
++static struct pinmux_cfg_reg pinmux_config_regs[] = {
++ PORTCR(0, 0xe6050000), /* PORT0CR */
++ PORTCR(1, 0xe6050001), /* PORT1CR */
++ PORTCR(2, 0xe6050002), /* PORT2CR */
++ PORTCR(3, 0xe6050003), /* PORT3CR */
++ PORTCR(4, 0xe6050004), /* PORT4CR */
++ PORTCR(5, 0xe6050005), /* PORT5CR */
++ PORTCR(6, 0xe6050006), /* PORT6CR */
++ PORTCR(7, 0xe6050007), /* PORT7CR */
++ PORTCR(8, 0xe6050008), /* PORT8CR */
++ PORTCR(9, 0xe6050009), /* PORT9CR */
++ PORTCR(10, 0xe605000a), /* PORT10CR */
++ PORTCR(11, 0xe605000b), /* PORT11CR */
++ PORTCR(12, 0xe605000c), /* PORT12CR */
++ PORTCR(13, 0xe605000d), /* PORT13CR */
++ PORTCR(14, 0xe605000e), /* PORT14CR */
++ PORTCR(15, 0xe605000f), /* PORT15CR */
++ PORTCR(16, 0xe6050010), /* PORT16CR */
++ PORTCR(17, 0xe6050011), /* PORT17CR */
++ PORTCR(18, 0xe6050012), /* PORT18CR */
++ PORTCR(19, 0xe6050013), /* PORT19CR */
++ PORTCR(20, 0xe6050014), /* PORT20CR */
++ PORTCR(21, 0xe6050015), /* PORT21CR */
++ PORTCR(22, 0xe6050016), /* PORT22CR */
++ PORTCR(23, 0xe6050017), /* PORT23CR */
++ PORTCR(24, 0xe6050018), /* PORT24CR */
++ PORTCR(25, 0xe6050019), /* PORT25CR */
++ PORTCR(26, 0xe605001a), /* PORT26CR */
++ PORTCR(27, 0xe605001b), /* PORT27CR */
++ PORTCR(28, 0xe605001c), /* PORT28CR */
++ PORTCR(29, 0xe605001d), /* PORT29CR */
++ PORTCR(30, 0xe605001e), /* PORT30CR */
++ PORTCR(31, 0xe605001f), /* PORT31CR */
++ PORTCR(32, 0xe6050020), /* PORT32CR */
++ PORTCR(33, 0xe6050021), /* PORT33CR */
++ PORTCR(34, 0xe6050022), /* PORT34CR */
++ PORTCR(35, 0xe6050023), /* PORT35CR */
++ PORTCR(36, 0xe6050024), /* PORT36CR */
++ PORTCR(37, 0xe6050025), /* PORT37CR */
++ PORTCR(38, 0xe6050026), /* PORT38CR */
++ PORTCR(39, 0xe6050027), /* PORT39CR */
++ PORTCR(40, 0xe6050028), /* PORT40CR */
++ PORTCR(41, 0xe6050029), /* PORT41CR */
++ PORTCR(42, 0xe605002a), /* PORT42CR */
++ PORTCR(43, 0xe605002b), /* PORT43CR */
++ PORTCR(44, 0xe605002c), /* PORT44CR */
++ PORTCR(45, 0xe605002d), /* PORT45CR */
++ PORTCR(46, 0xe605002e), /* PORT46CR */
++ PORTCR(47, 0xe605002f), /* PORT47CR */
++ PORTCR(48, 0xe6050030), /* PORT48CR */
++ PORTCR(49, 0xe6050031), /* PORT49CR */
++ PORTCR(50, 0xe6050032), /* PORT50CR */
++ PORTCR(51, 0xe6050033), /* PORT51CR */
++ PORTCR(52, 0xe6050034), /* PORT52CR */
++ PORTCR(53, 0xe6050035), /* PORT53CR */
++ PORTCR(54, 0xe6050036), /* PORT54CR */
++ PORTCR(55, 0xe6050037), /* PORT55CR */
++ PORTCR(56, 0xe6050038), /* PORT56CR */
++ PORTCR(57, 0xe6050039), /* PORT57CR */
++ PORTCR(58, 0xe605003a), /* PORT58CR */
++ PORTCR(59, 0xe605003b), /* PORT59CR */
++ PORTCR(60, 0xe605003c), /* PORT60CR */
++ PORTCR(61, 0xe605003d), /* PORT61CR */
++ PORTCR(62, 0xe605003e), /* PORT62CR */
++ PORTCR(63, 0xe605003f), /* PORT63CR */
++ PORTCR(64, 0xe6050040), /* PORT64CR */
++ PORTCR(65, 0xe6050041), /* PORT65CR */
++ PORTCR(66, 0xe6050042), /* PORT66CR */
++ PORTCR(67, 0xe6050043), /* PORT67CR */
++ PORTCR(68, 0xe6050044), /* PORT68CR */
++ PORTCR(69, 0xe6050045), /* PORT69CR */
++ PORTCR(70, 0xe6050046), /* PORT70CR */
++ PORTCR(71, 0xe6050047), /* PORT71CR */
++ PORTCR(72, 0xe6050048), /* PORT72CR */
++ PORTCR(73, 0xe6050049), /* PORT73CR */
++ PORTCR(74, 0xe605004a), /* PORT74CR */
++ PORTCR(75, 0xe605004b), /* PORT75CR */
++ PORTCR(76, 0xe605004c), /* PORT76CR */
++ PORTCR(77, 0xe605004d), /* PORT77CR */
++ PORTCR(78, 0xe605004e), /* PORT78CR */
++ PORTCR(79, 0xe605004f), /* PORT79CR */
++ PORTCR(80, 0xe6050050), /* PORT80CR */
++ PORTCR(81, 0xe6050051), /* PORT81CR */
++ PORTCR(82, 0xe6050052), /* PORT82CR */
++ PORTCR(83, 0xe6050053), /* PORT83CR */
++
++ PORTCR(84, 0xe6051054), /* PORT84CR */
++ PORTCR(85, 0xe6051055), /* PORT85CR */
++ PORTCR(86, 0xe6051056), /* PORT86CR */
++ PORTCR(87, 0xe6051057), /* PORT87CR */
++ PORTCR(88, 0xe6051058), /* PORT88CR */
++ PORTCR(89, 0xe6051059), /* PORT89CR */
++ PORTCR(90, 0xe605105a), /* PORT90CR */
++ PORTCR(91, 0xe605105b), /* PORT91CR */
++ PORTCR(92, 0xe605105c), /* PORT92CR */
++ PORTCR(93, 0xe605105d), /* PORT93CR */
++ PORTCR(94, 0xe605105e), /* PORT94CR */
++ PORTCR(95, 0xe605105f), /* PORT95CR */
++ PORTCR(96, 0xe6051060), /* PORT96CR */
++ PORTCR(97, 0xe6051061), /* PORT97CR */
++ PORTCR(98, 0xe6051062), /* PORT98CR */
++ PORTCR(99, 0xe6051063), /* PORT99CR */
++ PORTCR(100, 0xe6051064), /* PORT100CR */
++ PORTCR(101, 0xe6051065), /* PORT101CR */
++ PORTCR(102, 0xe6051066), /* PORT102CR */
++ PORTCR(103, 0xe6051067), /* PORT103CR */
++ PORTCR(104, 0xe6051068), /* PORT104CR */
++ PORTCR(105, 0xe6051069), /* PORT105CR */
++ PORTCR(106, 0xe605106a), /* PORT106CR */
++ PORTCR(107, 0xe605106b), /* PORT107CR */
++ PORTCR(108, 0xe605106c), /* PORT108CR */
++ PORTCR(109, 0xe605106d), /* PORT109CR */
++ PORTCR(110, 0xe605106e), /* PORT110CR */
++ PORTCR(111, 0xe605106f), /* PORT111CR */
++ PORTCR(112, 0xe6051070), /* PORT112CR */
++ PORTCR(113, 0xe6051071), /* PORT113CR */
++ PORTCR(114, 0xe6051072), /* PORT114CR */
++
++ PORTCR(115, 0xe6052073), /* PORT115CR */
++ PORTCR(116, 0xe6052074), /* PORT116CR */
++ PORTCR(117, 0xe6052075), /* PORT117CR */
++ PORTCR(118, 0xe6052076), /* PORT118CR */
++ PORTCR(119, 0xe6052077), /* PORT119CR */
++ PORTCR(120, 0xe6052078), /* PORT120CR */
++ PORTCR(121, 0xe6052079), /* PORT121CR */
++ PORTCR(122, 0xe605207a), /* PORT122CR */
++ PORTCR(123, 0xe605207b), /* PORT123CR */
++ PORTCR(124, 0xe605207c), /* PORT124CR */
++ PORTCR(125, 0xe605207d), /* PORT125CR */
++ PORTCR(126, 0xe605207e), /* PORT126CR */
++ PORTCR(127, 0xe605207f), /* PORT127CR */
++ PORTCR(128, 0xe6052080), /* PORT128CR */
++ PORTCR(129, 0xe6052081), /* PORT129CR */
++ PORTCR(130, 0xe6052082), /* PORT130CR */
++ PORTCR(131, 0xe6052083), /* PORT131CR */
++ PORTCR(132, 0xe6052084), /* PORT132CR */
++ PORTCR(133, 0xe6052085), /* PORT133CR */
++ PORTCR(134, 0xe6052086), /* PORT134CR */
++ PORTCR(135, 0xe6052087), /* PORT135CR */
++ PORTCR(136, 0xe6052088), /* PORT136CR */
++ PORTCR(137, 0xe6052089), /* PORT137CR */
++ PORTCR(138, 0xe605208a), /* PORT138CR */
++ PORTCR(139, 0xe605208b), /* PORT139CR */
++ PORTCR(140, 0xe605208c), /* PORT140CR */
++ PORTCR(141, 0xe605208d), /* PORT141CR */
++ PORTCR(142, 0xe605208e), /* PORT142CR */
++ PORTCR(143, 0xe605208f), /* PORT143CR */
++ PORTCR(144, 0xe6052090), /* PORT144CR */
++ PORTCR(145, 0xe6052091), /* PORT145CR */
++ PORTCR(146, 0xe6052092), /* PORT146CR */
++ PORTCR(147, 0xe6052093), /* PORT147CR */
++ PORTCR(148, 0xe6052094), /* PORT148CR */
++ PORTCR(149, 0xe6052095), /* PORT149CR */
++ PORTCR(150, 0xe6052096), /* PORT150CR */
++ PORTCR(151, 0xe6052097), /* PORT151CR */
++ PORTCR(152, 0xe6052098), /* PORT152CR */
++ PORTCR(153, 0xe6052099), /* PORT153CR */
++ PORTCR(154, 0xe605209a), /* PORT154CR */
++ PORTCR(155, 0xe605209b), /* PORT155CR */
++ PORTCR(156, 0xe605209c), /* PORT156CR */
++ PORTCR(157, 0xe605209d), /* PORT157CR */
++ PORTCR(158, 0xe605209e), /* PORT158CR */
++ PORTCR(159, 0xe605209f), /* PORT159CR */
++ PORTCR(160, 0xe60520a0), /* PORT160CR */
++ PORTCR(161, 0xe60520a1), /* PORT161CR */
++ PORTCR(162, 0xe60520a2), /* PORT162CR */
++ PORTCR(163, 0xe60520a3), /* PORT163CR */
++ PORTCR(164, 0xe60520a4), /* PORT164CR */
++ PORTCR(165, 0xe60520a5), /* PORT165CR */
++ PORTCR(166, 0xe60520a6), /* PORT166CR */
++ PORTCR(167, 0xe60520a7), /* PORT167CR */
++ PORTCR(168, 0xe60520a8), /* PORT168CR */
++ PORTCR(169, 0xe60520a9), /* PORT169CR */
++ PORTCR(170, 0xe60520aa), /* PORT170CR */
++ PORTCR(171, 0xe60520ab), /* PORT171CR */
++ PORTCR(172, 0xe60520ac), /* PORT172CR */
++ PORTCR(173, 0xe60520ad), /* PORT173CR */
++ PORTCR(174, 0xe60520ae), /* PORT174CR */
++ PORTCR(175, 0xe60520af), /* PORT175CR */
++ PORTCR(176, 0xe60520b0), /* PORT176CR */
++ PORTCR(177, 0xe60520b1), /* PORT177CR */
++ PORTCR(178, 0xe60520b2), /* PORT178CR */
++ PORTCR(179, 0xe60520b3), /* PORT179CR */
++ PORTCR(180, 0xe60520b4), /* PORT180CR */
++ PORTCR(181, 0xe60520b5), /* PORT181CR */
++ PORTCR(182, 0xe60520b6), /* PORT182CR */
++ PORTCR(183, 0xe60520b7), /* PORT183CR */
++ PORTCR(184, 0xe60520b8), /* PORT184CR */
++ PORTCR(185, 0xe60520b9), /* PORT185CR */
++ PORTCR(186, 0xe60520ba), /* PORT186CR */
++ PORTCR(187, 0xe60520bb), /* PORT187CR */
++ PORTCR(188, 0xe60520bc), /* PORT188CR */
++ PORTCR(189, 0xe60520bd), /* PORT189CR */
++ PORTCR(190, 0xe60520be), /* PORT190CR */
++ PORTCR(191, 0xe60520bf), /* PORT191CR */
++ PORTCR(192, 0xe60520c0), /* PORT192CR */
++ PORTCR(193, 0xe60520c1), /* PORT193CR */
++ PORTCR(194, 0xe60520c2), /* PORT194CR */
++ PORTCR(195, 0xe60520c3), /* PORT195CR */
++ PORTCR(196, 0xe60520c4), /* PORT196CR */
++ PORTCR(197, 0xe60520c5), /* PORT197CR */
++ PORTCR(198, 0xe60520c6), /* PORT198CR */
++ PORTCR(199, 0xe60520c7), /* PORT199CR */
++ PORTCR(200, 0xe60520c8), /* PORT200CR */
++ PORTCR(201, 0xe60520c9), /* PORT201CR */
++ PORTCR(202, 0xe60520ca), /* PORT202CR */
++ PORTCR(203, 0xe60520cb), /* PORT203CR */
++ PORTCR(204, 0xe60520cc), /* PORT204CR */
++ PORTCR(205, 0xe60520cd), /* PORT205CR */
++ PORTCR(206, 0xe60520ce), /* PORT206CR */
++ PORTCR(207, 0xe60520cf), /* PORT207CR */
++ PORTCR(208, 0xe60520d0), /* PORT208CR */
++ PORTCR(209, 0xe60520d1), /* PORT209CR */
++
++ PORTCR(210, 0xe60530d2), /* PORT210CR */
++ PORTCR(211, 0xe60530d3), /* PORT211CR */
++
++ { PINMUX_CFG_REG("MSEL1CR", 0xe605800c, 32, 1) {
++ MSEL1CR_31_0, MSEL1CR_31_1,
++ MSEL1CR_30_0, MSEL1CR_30_1,
++ MSEL1CR_29_0, MSEL1CR_29_1,
++ MSEL1CR_28_0, MSEL1CR_28_1,
++ MSEL1CR_27_0, MSEL1CR_27_1,
++ MSEL1CR_26_0, MSEL1CR_26_1,
++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ MSEL1CR_16_0, MSEL1CR_16_1,
++ MSEL1CR_15_0, MSEL1CR_15_1,
++ MSEL1CR_14_0, MSEL1CR_14_1,
++ MSEL1CR_13_0, MSEL1CR_13_1,
++ MSEL1CR_12_0, MSEL1CR_12_1,
++ 0, 0, 0, 0,
++ MSEL1CR_9_0, MSEL1CR_9_1,
++ 0, 0,
++ MSEL1CR_7_0, MSEL1CR_7_1,
++ MSEL1CR_6_0, MSEL1CR_6_1,
++ MSEL1CR_5_0, MSEL1CR_5_1,
++ MSEL1CR_4_0, MSEL1CR_4_1,
++ MSEL1CR_3_0, MSEL1CR_3_1,
++ MSEL1CR_2_0, MSEL1CR_2_1,
++ 0, 0,
++ MSEL1CR_0_0, MSEL1CR_0_1,
++ }
++ },
++ { PINMUX_CFG_REG("MSEL3CR", 0xE6058020, 32, 1) {
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ MSEL3CR_15_0, MSEL3CR_15_1,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ MSEL3CR_6_0, MSEL3CR_6_1,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ }
++ },
++ { PINMUX_CFG_REG("MSEL4CR", 0xE6058024, 32, 1) {
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ MSEL4CR_19_0, MSEL4CR_19_1,
++ MSEL4CR_18_0, MSEL4CR_18_1,
++ 0, 0, 0, 0,
++ MSEL4CR_15_0, MSEL4CR_15_1,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ MSEL4CR_10_0, MSEL4CR_10_1,
++ 0, 0, 0, 0, 0, 0,
++ MSEL4CR_6_0, MSEL4CR_6_1,
++ 0, 0,
++ MSEL4CR_4_0, MSEL4CR_4_1,
++ 0, 0, 0, 0,
++ MSEL4CR_1_0, MSEL4CR_1_1,
++ 0, 0,
++ }
++ },
++ { PINMUX_CFG_REG("MSEL5CR", 0xE6058028, 32, 1) {
++ MSEL5CR_31_0, MSEL5CR_31_1,
++ MSEL5CR_30_0, MSEL5CR_30_1,
++ MSEL5CR_29_0, MSEL5CR_29_1,
++ 0, 0,
++ MSEL5CR_27_0, MSEL5CR_27_1,
++ 0, 0,
++ MSEL5CR_25_0, MSEL5CR_25_1,
++ 0, 0,
++ MSEL5CR_23_0, MSEL5CR_23_1,
++ 0, 0,
++ MSEL5CR_21_0, MSEL5CR_21_1,
++ 0, 0,
++ MSEL5CR_19_0, MSEL5CR_19_1,
++ 0, 0,
++ MSEL5CR_17_0, MSEL5CR_17_1,
++ 0, 0,
++ MSEL5CR_15_0, MSEL5CR_15_1,
++ MSEL5CR_14_0, MSEL5CR_14_1,
++ MSEL5CR_13_0, MSEL5CR_13_1,
++ MSEL5CR_12_0, MSEL5CR_12_1,
++ MSEL5CR_11_0, MSEL5CR_11_1,
++ MSEL5CR_10_0, MSEL5CR_10_1,
++ 0, 0,
++ MSEL5CR_8_0, MSEL5CR_8_1,
++ MSEL5CR_7_0, MSEL5CR_7_1,
++ MSEL5CR_6_0, MSEL5CR_6_1,
++ MSEL5CR_5_0, MSEL5CR_5_1,
++ MSEL5CR_4_0, MSEL5CR_4_1,
++ MSEL5CR_3_0, MSEL5CR_3_1,
++ MSEL5CR_2_0, MSEL5CR_2_1,
++ 0, 0,
++ MSEL5CR_0_0, MSEL5CR_0_1,
++ }
++ },
++ { },
++};
++
++static struct pinmux_data_reg pinmux_data_regs[] = {
++ { PINMUX_DATA_REG("PORTL031_000DR", 0xe6054800, 32) {
++ PORT31_DATA, PORT30_DATA, PORT29_DATA, PORT28_DATA,
++ PORT27_DATA, PORT26_DATA, PORT25_DATA, PORT24_DATA,
++ PORT23_DATA, PORT22_DATA, PORT21_DATA, PORT20_DATA,
++ PORT19_DATA, PORT18_DATA, PORT17_DATA, PORT16_DATA,
++ PORT15_DATA, PORT14_DATA, PORT13_DATA, PORT12_DATA,
++ PORT11_DATA, PORT10_DATA, PORT9_DATA, PORT8_DATA,
++ PORT7_DATA, PORT6_DATA, PORT5_DATA, PORT4_DATA,
++ PORT3_DATA, PORT2_DATA, PORT1_DATA, PORT0_DATA }
++ },
++ { PINMUX_DATA_REG("PORTL063_032DR", 0xe6054804, 32) {
++ PORT63_DATA, PORT62_DATA, PORT61_DATA, PORT60_DATA,
++ PORT59_DATA, PORT58_DATA, PORT57_DATA, PORT56_DATA,
++ PORT55_DATA, PORT54_DATA, PORT53_DATA, PORT52_DATA,
++ PORT51_DATA, PORT50_DATA, PORT49_DATA, PORT48_DATA,
++ PORT47_DATA, PORT46_DATA, PORT45_DATA, PORT44_DATA,
++ PORT43_DATA, PORT42_DATA, PORT41_DATA, PORT40_DATA,
++ PORT39_DATA, PORT38_DATA, PORT37_DATA, PORT36_DATA,
++ PORT35_DATA, PORT34_DATA, PORT33_DATA, PORT32_DATA }
++ },
++ { PINMUX_DATA_REG("PORTL095_064DR", 0xe6054808, 32) {
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ PORT83_DATA, PORT82_DATA, PORT81_DATA, PORT80_DATA,
++ PORT79_DATA, PORT78_DATA, PORT77_DATA, PORT76_DATA,
++ PORT75_DATA, PORT74_DATA, PORT73_DATA, PORT72_DATA,
++ PORT71_DATA, PORT70_DATA, PORT69_DATA, PORT68_DATA,
++ PORT67_DATA, PORT66_DATA, PORT65_DATA, PORT64_DATA }
++ },
++ { PINMUX_DATA_REG("PORTD095_064DR", 0xe6055808, 32) {
++ PORT95_DATA, PORT94_DATA, PORT93_DATA, PORT92_DATA,
++ PORT91_DATA, PORT90_DATA, PORT89_DATA, PORT88_DATA,
++ PORT87_DATA, PORT86_DATA, PORT85_DATA, PORT84_DATA,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0 }
++ },
++ { PINMUX_DATA_REG("PORTD127_096DR", 0xe605580c, 32) {
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, PORT114_DATA, PORT113_DATA, PORT112_DATA,
++ PORT111_DATA, PORT110_DATA, PORT109_DATA, PORT108_DATA,
++ PORT107_DATA, PORT106_DATA, PORT105_DATA, PORT104_DATA,
++ PORT103_DATA, PORT102_DATA, PORT101_DATA, PORT100_DATA,
++ PORT99_DATA, PORT98_DATA, PORT97_DATA, PORT96_DATA }
++ },
++ { PINMUX_DATA_REG("PORTR127_096DR", 0xe605680C, 32) {
++ PORT127_DATA, PORT126_DATA, PORT125_DATA, PORT124_DATA,
++ PORT123_DATA, PORT122_DATA, PORT121_DATA, PORT120_DATA,
++ PORT119_DATA, PORT118_DATA, PORT117_DATA, PORT116_DATA,
++ PORT115_DATA, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0 }
++ },
++ { PINMUX_DATA_REG("PORTR159_128DR", 0xe6056810, 32) {
++ PORT159_DATA, PORT158_DATA, PORT157_DATA, PORT156_DATA,
++ PORT155_DATA, PORT154_DATA, PORT153_DATA, PORT152_DATA,
++ PORT151_DATA, PORT150_DATA, PORT149_DATA, PORT148_DATA,
++ PORT147_DATA, PORT146_DATA, PORT145_DATA, PORT144_DATA,
++ PORT143_DATA, PORT142_DATA, PORT141_DATA, PORT140_DATA,
++ PORT139_DATA, PORT138_DATA, PORT137_DATA, PORT136_DATA,
++ PORT135_DATA, PORT134_DATA, PORT133_DATA, PORT132_DATA,
++ PORT131_DATA, PORT130_DATA, PORT129_DATA, PORT128_DATA }
++ },
++ { PINMUX_DATA_REG("PORTR191_160DR", 0xe6056814, 32) {
++ PORT191_DATA, PORT190_DATA, PORT189_DATA, PORT188_DATA,
++ PORT187_DATA, PORT186_DATA, PORT185_DATA, PORT184_DATA,
++ PORT183_DATA, PORT182_DATA, PORT181_DATA, PORT180_DATA,
++ PORT179_DATA, PORT178_DATA, PORT177_DATA, PORT176_DATA,
++ PORT175_DATA, PORT174_DATA, PORT173_DATA, PORT172_DATA,
++ PORT171_DATA, PORT170_DATA, PORT169_DATA, PORT168_DATA,
++ PORT167_DATA, PORT166_DATA, PORT165_DATA, PORT164_DATA,
++ PORT163_DATA, PORT162_DATA, PORT161_DATA, PORT160_DATA }
++ },
++ { PINMUX_DATA_REG("PORTR223_192DR", 0xe6056818, 32) {
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, PORT209_DATA, PORT208_DATA,
++ PORT207_DATA, PORT206_DATA, PORT205_DATA, PORT204_DATA,
++ PORT203_DATA, PORT202_DATA, PORT201_DATA, PORT200_DATA,
++ PORT199_DATA, PORT198_DATA, PORT197_DATA, PORT196_DATA,
++ PORT195_DATA, PORT194_DATA, PORT193_DATA, PORT192_DATA }
++ },
++ { PINMUX_DATA_REG("PORTU223_192DR", 0xe6057818, 32) {
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ PORT211_DATA, PORT210_DATA, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0,
++ 0, 0, 0, 0 }
++ },
++ { },
++};
++
++static struct pinmux_info r8a7740_pinmux_info = {
++ .name = "r8a7740_pfc",
++ .reserved_id = PINMUX_RESERVED,
++ .data = { PINMUX_DATA_BEGIN,
++ PINMUX_DATA_END },
++ .input = { PINMUX_INPUT_BEGIN,
++ PINMUX_INPUT_END },
++ .input_pu = { PINMUX_INPUT_PULLUP_BEGIN,
++ PINMUX_INPUT_PULLUP_END },
++ .input_pd = { PINMUX_INPUT_PULLDOWN_BEGIN,
++ PINMUX_INPUT_PULLDOWN_END },
++ .output = { PINMUX_OUTPUT_BEGIN,
++ PINMUX_OUTPUT_END },
++ .mark = { PINMUX_MARK_BEGIN,
++ PINMUX_MARK_END },
++ .function = { PINMUX_FUNCTION_BEGIN,
++ PINMUX_FUNCTION_END },
++
++ .first_gpio = GPIO_PORT0,
++ .last_gpio = GPIO_FN_TRACEAUD_FROM_MEMC,
++
++ .gpios = pinmux_gpios,
++ .cfg_regs = pinmux_config_regs,
++ .data_regs = pinmux_data_regs,
++
++ .gpio_data = pinmux_data,
++ .gpio_data_size = ARRAY_SIZE(pinmux_data),
++};
++
++void r8a7740_pinmux_init(void)
++{
++ register_pinmux(&r8a7740_pinmux_info);
++}
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0059-ARM-mach-shmobile-r8a7740-add-i2c-support.patch b/patches.armadillo800eva/0059-ARM-mach-shmobile-r8a7740-add-i2c-support.patch
new file mode 100644
index 00000000000000..1394d8a4c095e1
--- /dev/null
+++ b/patches.armadillo800eva/0059-ARM-mach-shmobile-r8a7740-add-i2c-support.patch
@@ -0,0 +1,151 @@
+From c2217fad0cedabc607ac175a24d1c8594035022d Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 10 Nov 2011 18:46:23 -0800
+Subject: ARM: mach-shmobile: r8a7740: add i2c support
+
+This patch adds I2C support to r8a7740 CPU
+which has lasting errata on I2C I/O pad reset.
+This patch is including work-around.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 6831f3a9184a1c5400e4fa2f2d3172b6dfb2c805)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-r8a7740.c | 106 ++++++++++++++++++++++++++++++++
+ 1 file changed, 106 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index 5548518..e16860f 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -17,8 +17,10 @@
+ * 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/delay.h>
+ #include <linux/kernel.h>
+ #include <linux/init.h>
++#include <linux/io.h>
+ #include <linux/platform_device.h>
+ #include <linux/serial_sci.h>
+ #include <linux/sh_timer.h>
+@@ -233,10 +235,114 @@ static struct platform_device *r8a7740_early_devices[] __initdata = {
+ &cmt10_device,
+ };
+
++/* 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),
++ .end = gic_spi(73),
++ .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 platform_device *r8a7740_late_devices[] __initdata = {
++ &i2c0_device,
++ &i2c1_device,
++};
++
++#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 */
++
++ mdelay(100);
++
++ i2c_write(reg, ICCR, 0x01);
++ i2c_read(reg, ICCR);
++ i2c_write(reg, ICSTART, 0x00);
++ i2c_read(reg, ICSTART);
++
++ i2c_write(reg, ICCR, 0x10);
++ mdelay(100);
++ i2c_write(reg, ICCR, 0x00);
++ mdelay(100);
++ i2c_write(reg, ICCR, 0x10);
++ mdelay(100);
++
++ iounmap(reg);
++}
++
+ void __init r8a7740_add_standard_devices(void)
+ {
++ /* I2C work-around */
++ r8a7740_i2c_workaround(&i2c0_device);
++ r8a7740_i2c_workaround(&i2c1_device);
++
+ platform_add_devices(r8a7740_early_devices,
+ ARRAY_SIZE(r8a7740_early_devices));
++ platform_add_devices(r8a7740_late_devices,
++ ARRAY_SIZE(r8a7740_late_devices));
+ }
+
+ void __init r8a7740_add_early_devices(void)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0060-ARM-mach-shmobile-r8a7740-add-INTC-support.patch b/patches.armadillo800eva/0060-ARM-mach-shmobile-r8a7740-add-INTC-support.patch
new file mode 100644
index 00000000000000..016c954982906a
--- /dev/null
+++ b/patches.armadillo800eva/0060-ARM-mach-shmobile-r8a7740-add-INTC-support.patch
@@ -0,0 +1,804 @@
+From c860bfd0606674dde926e2eb48112b65678bc943 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 10 Nov 2011 18:46:35 -0800
+Subject: ARM: mach-shmobile: r8a7740: add INTC support
+
+R8A7740 GIC can not get external IRQx interrupt directly
+without GIC - INTC demux support.
+
+Current AG5 is using GIC - INTCS demux with
+special irq relocation. but GIC - INTCA demux
+is still not supported and it needs irq number re-mapping.
+
+OTOH, normal INTC support as before is very enough for R8A7740,
+because it is not SMP CPU.
+This patch adds INTCA/INTCS support instead of GIC.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 215d6cc9230c2a42a643c4cd296680040eeb1f49)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/Kconfig | 1 -
+ arch/arm/mach-shmobile/Makefile | 2 +-
+ arch/arm/mach-shmobile/intc-r8a7740.c | 612 +++++++++++++++++++++++++++++++-
+ arch/arm/mach-shmobile/setup-r8a7740.c | 28 +-
+ 4 files changed, 614 insertions(+), 29 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index 2ce88de..193f011 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -32,7 +32,6 @@ config ARCH_R8A7740
+ select CPU_V7
+ select SH_CLK_CPG
+ select ARCH_WANT_OPTIONAL_GPIOLIB
+- select ARM_GIC
+
+ comment "SH-Mobile Board Type"
+
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index 8c2067d..d76ad60 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -31,7 +31,7 @@ obj-$(CONFIG_ARCH_SH7367) += entry-intc.o
+ obj-$(CONFIG_ARCH_SH7377) += entry-intc.o
+ obj-$(CONFIG_ARCH_SH7372) += entry-intc.o
+ obj-$(CONFIG_ARCH_SH73A0) += entry-gic.o
+-obj-$(CONFIG_ARCH_R8A7740) += entry-gic.o
++obj-$(CONFIG_ARCH_R8A7740) += entry-intc.o
+
+ # PM objects
+ obj-$(CONFIG_SUSPEND) += suspend.o
+diff --git a/arch/arm/mach-shmobile/intc-r8a7740.c b/arch/arm/mach-shmobile/intc-r8a7740.c
+index c62a205..272c84c 100644
+--- a/arch/arm/mach-shmobile/intc-r8a7740.c
++++ b/arch/arm/mach-shmobile/intc-r8a7740.c
+@@ -18,28 +18,614 @@
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/interrupt.h>
+ #include <linux/irq.h>
+ #include <linux/io.h>
+-#include <asm/hardware/gic.h>
++#include <linux/sh_intc.h>
++#include <mach/intc.h>
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
+
+-#define INTA_CTRL 0xe605807c
++/*
++ * INTCA
++ */
++enum {
++ UNUSED_INTCA = 0,
++
++ /* interrupt sources INTCA */
++ DIRC,
++ ATAPI,
++ IIC1_ALI, IIC1_TACKI, IIC1_WAITI, IIC1_DTEI,
++ AP_ARM_COMMTX, AP_ARM_COMMRX,
++ MFI, MFIS,
++ BBIF1, BBIF2,
++ USBHSDMAC,
++ USBF_OUL_SOF, USBF_IXL_INT,
++ SGX540,
++ CMT1_0, CMT1_1, CMT1_2, CMT1_3,
++ CMT2,
++ CMT3,
++ KEYSC,
++ SCIFA0, SCIFA1, SCIFA2, SCIFA3,
++ MSIOF2, MSIOF1,
++ SCIFA4, SCIFA5, SCIFB,
++ FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
++ SDHI0_0, SDHI0_1, SDHI0_2, SDHI0_3,
++ SDHI1_0, SDHI1_1, SDHI1_2, SDHI1_3,
++ AP_ARM_L2CINT,
++ IRDA,
++ TPU0,
++ SCIFA6, SCIFA7,
++ GbEther,
++ ICBS0,
++ DDM,
++ SDHI2_0, SDHI2_1, SDHI2_2, SDHI2_3,
++ RWDT0,
++ DMAC1_1_DEI0, DMAC1_1_DEI1, DMAC1_1_DEI2, DMAC1_1_DEI3,
++ DMAC1_2_DEI4, DMAC1_2_DEI5, DMAC1_2_DADERR,
++ DMAC2_1_DEI0, DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3,
++ DMAC2_2_DEI4, DMAC2_2_DEI5, DMAC2_2_DADERR,
++ DMAC3_1_DEI0, DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3,
++ DMAC3_2_DEI4, DMAC3_2_DEI5, DMAC3_2_DADERR,
++ SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM,
++ USBH_INT, USBH_OHCI, USBH_EHCI, USBH_PME, USBH_BIND,
++ RSPI_OVRF, RSPI_SPTEF, RSPI_SPRF,
++ SPU2_0, SPU2_1,
++ FSI, FMSI,
++ IPMMU,
++ AP_ARM_CTIIRQ, AP_ARM_PMURQ,
++ MFIS2,
++ CPORTR2S,
++ CMT14, CMT15,
++ MMCIF_0, MMCIF_1, MMCIF_2,
++ SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI,
++ STPRO_0, STPRO_1, STPRO_2, STPRO_3, STPRO_4,
++
++ /* interrupt groups INTCA */
++ DMAC1_1, DMAC1_2,
++ DMAC2_1, DMAC2_2,
++ DMAC3_1, DMAC3_2,
++ AP_ARM1, AP_ARM2,
++ SDHI0, SDHI1, SDHI2,
++ SHWYSTAT,
++ USBF, USBH1, USBH2,
++ RSPI, SPU2, FLCTL, IIC1,
++};
++
++static struct intc_vect intca_vectors[] __initdata = {
++ INTC_VECT(DIRC, 0x0560),
++ INTC_VECT(ATAPI, 0x05E0),
++ INTC_VECT(IIC1_ALI, 0x0780),
++ INTC_VECT(IIC1_TACKI, 0x07A0),
++ INTC_VECT(IIC1_WAITI, 0x07C0),
++ INTC_VECT(IIC1_DTEI, 0x07E0),
++ INTC_VECT(AP_ARM_COMMTX, 0x0840),
++ INTC_VECT(AP_ARM_COMMRX, 0x0860),
++ INTC_VECT(MFI, 0x0900),
++ INTC_VECT(MFIS, 0x0920),
++ INTC_VECT(BBIF1, 0x0940),
++ INTC_VECT(BBIF2, 0x0960),
++ INTC_VECT(USBHSDMAC, 0x0A00),
++ INTC_VECT(USBF_OUL_SOF, 0x0A20),
++ INTC_VECT(USBF_IXL_INT, 0x0A40),
++ INTC_VECT(SGX540, 0x0A60),
++ INTC_VECT(CMT1_0, 0x0B00),
++ INTC_VECT(CMT1_1, 0x0B20),
++ INTC_VECT(CMT1_2, 0x0B40),
++ INTC_VECT(CMT1_3, 0x0B60),
++ INTC_VECT(CMT2, 0x0B80),
++ INTC_VECT(CMT3, 0x0BA0),
++ INTC_VECT(KEYSC, 0x0BE0),
++ INTC_VECT(SCIFA0, 0x0C00),
++ INTC_VECT(SCIFA1, 0x0C20),
++ INTC_VECT(SCIFA2, 0x0C40),
++ INTC_VECT(SCIFA3, 0x0C60),
++ INTC_VECT(MSIOF2, 0x0C80),
++ INTC_VECT(MSIOF1, 0x0D00),
++ INTC_VECT(SCIFA4, 0x0D20),
++ INTC_VECT(SCIFA5, 0x0D40),
++ INTC_VECT(SCIFB, 0x0D60),
++ INTC_VECT(FLCTL_FLSTEI, 0x0D80),
++ INTC_VECT(FLCTL_FLTENDI, 0x0DA0),
++ INTC_VECT(FLCTL_FLTREQ0I, 0x0DC0),
++ INTC_VECT(FLCTL_FLTREQ1I, 0x0DE0),
++ INTC_VECT(SDHI0_0, 0x0E00),
++ INTC_VECT(SDHI0_1, 0x0E20),
++ INTC_VECT(SDHI0_2, 0x0E40),
++ INTC_VECT(SDHI0_3, 0x0E60),
++ INTC_VECT(SDHI1_0, 0x0E80),
++ INTC_VECT(SDHI1_1, 0x0EA0),
++ INTC_VECT(SDHI1_2, 0x0EC0),
++ INTC_VECT(SDHI1_3, 0x0EE0),
++ INTC_VECT(AP_ARM_L2CINT, 0x0FA0),
++ INTC_VECT(IRDA, 0x0480),
++ INTC_VECT(TPU0, 0x04A0),
++ INTC_VECT(SCIFA6, 0x04C0),
++ INTC_VECT(SCIFA7, 0x04E0),
++ INTC_VECT(GbEther, 0x0500),
++ INTC_VECT(ICBS0, 0x0540),
++ INTC_VECT(DDM, 0x1140),
++ INTC_VECT(SDHI2_0, 0x1200),
++ INTC_VECT(SDHI2_1, 0x1220),
++ INTC_VECT(SDHI2_2, 0x1240),
++ INTC_VECT(SDHI2_3, 0x1260),
++ INTC_VECT(RWDT0, 0x1280),
++ INTC_VECT(DMAC1_1_DEI0, 0x2000),
++ INTC_VECT(DMAC1_1_DEI1, 0x2020),
++ INTC_VECT(DMAC1_1_DEI2, 0x2040),
++ INTC_VECT(DMAC1_1_DEI3, 0x2060),
++ INTC_VECT(DMAC1_2_DEI4, 0x2080),
++ INTC_VECT(DMAC1_2_DEI5, 0x20A0),
++ INTC_VECT(DMAC1_2_DADERR, 0x20C0),
++ INTC_VECT(DMAC2_1_DEI0, 0x2100),
++ INTC_VECT(DMAC2_1_DEI1, 0x2120),
++ INTC_VECT(DMAC2_1_DEI2, 0x2140),
++ INTC_VECT(DMAC2_1_DEI3, 0x2160),
++ INTC_VECT(DMAC2_2_DEI4, 0x2180),
++ INTC_VECT(DMAC2_2_DEI5, 0x21A0),
++ INTC_VECT(DMAC2_2_DADERR, 0x21C0),
++ INTC_VECT(DMAC3_1_DEI0, 0x2200),
++ INTC_VECT(DMAC3_1_DEI1, 0x2220),
++ INTC_VECT(DMAC3_1_DEI2, 0x2240),
++ INTC_VECT(DMAC3_1_DEI3, 0x2260),
++ INTC_VECT(DMAC3_2_DEI4, 0x2280),
++ INTC_VECT(DMAC3_2_DEI5, 0x22A0),
++ INTC_VECT(DMAC3_2_DADERR, 0x22C0),
++ INTC_VECT(SHWYSTAT_RT, 0x1300),
++ INTC_VECT(SHWYSTAT_HS, 0x1320),
++ INTC_VECT(SHWYSTAT_COM, 0x1340),
++ INTC_VECT(USBH_INT, 0x1540),
++ INTC_VECT(USBH_OHCI, 0x1560),
++ INTC_VECT(USBH_EHCI, 0x1580),
++ INTC_VECT(USBH_PME, 0x15A0),
++ INTC_VECT(USBH_BIND, 0x15C0),
++ INTC_VECT(RSPI_OVRF, 0x1780),
++ INTC_VECT(RSPI_SPTEF, 0x17A0),
++ INTC_VECT(RSPI_SPRF, 0x17C0),
++ INTC_VECT(SPU2_0, 0x1800),
++ INTC_VECT(SPU2_1, 0x1820),
++ INTC_VECT(FSI, 0x1840),
++ INTC_VECT(FMSI, 0x1860),
++ INTC_VECT(IPMMU, 0x1920),
++ INTC_VECT(AP_ARM_CTIIRQ, 0x1980),
++ INTC_VECT(AP_ARM_PMURQ, 0x19A0),
++ INTC_VECT(MFIS2, 0x1A00),
++ INTC_VECT(CPORTR2S, 0x1A20),
++ INTC_VECT(CMT14, 0x1A40),
++ INTC_VECT(CMT15, 0x1A60),
++ INTC_VECT(MMCIF_0, 0x1AA0),
++ INTC_VECT(MMCIF_1, 0x1AC0),
++ INTC_VECT(MMCIF_2, 0x1AE0),
++ INTC_VECT(SIM_ERI, 0x1C00),
++ INTC_VECT(SIM_RXI, 0x1C20),
++ INTC_VECT(SIM_TXI, 0x1C40),
++ INTC_VECT(SIM_TEI, 0x1C60),
++ INTC_VECT(STPRO_0, 0x1C80),
++ INTC_VECT(STPRO_1, 0x1CA0),
++ INTC_VECT(STPRO_2, 0x1CC0),
++ INTC_VECT(STPRO_3, 0x1CE0),
++ INTC_VECT(STPRO_4, 0x1D00),
++};
++
++static struct intc_group intca_groups[] __initdata = {
++ INTC_GROUP(DMAC1_1,
++ DMAC1_1_DEI0, DMAC1_1_DEI1, DMAC1_1_DEI2, DMAC1_1_DEI3),
++ INTC_GROUP(DMAC1_2,
++ DMAC1_2_DEI4, DMAC1_2_DEI5, DMAC1_2_DADERR),
++ INTC_GROUP(DMAC2_1,
++ DMAC2_1_DEI0, DMAC2_1_DEI1, DMAC2_1_DEI2, DMAC2_1_DEI3),
++ INTC_GROUP(DMAC2_2,
++ DMAC2_2_DEI4, DMAC2_2_DEI5, DMAC2_2_DADERR),
++ INTC_GROUP(DMAC3_1,
++ DMAC3_1_DEI0, DMAC3_1_DEI1, DMAC3_1_DEI2, DMAC3_1_DEI3),
++ INTC_GROUP(DMAC3_2,
++ DMAC3_2_DEI4, DMAC3_2_DEI5, DMAC3_2_DADERR),
++ INTC_GROUP(AP_ARM1,
++ AP_ARM_COMMTX, AP_ARM_COMMRX),
++ INTC_GROUP(AP_ARM2,
++ AP_ARM_CTIIRQ, AP_ARM_PMURQ),
++ INTC_GROUP(USBF,
++ USBF_OUL_SOF, USBF_IXL_INT),
++ INTC_GROUP(SDHI0,
++ SDHI0_0, SDHI0_1, SDHI0_2, SDHI0_3),
++ INTC_GROUP(SDHI1,
++ SDHI1_0, SDHI1_1, SDHI1_2, SDHI1_3),
++ INTC_GROUP(SDHI2,
++ SDHI2_0, SDHI2_1, SDHI2_2, SDHI2_3),
++ INTC_GROUP(SHWYSTAT,
++ SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM),
++ INTC_GROUP(USBH1, /* FIXME */
++ USBH_INT, USBH_OHCI),
++ INTC_GROUP(USBH2, /* FIXME */
++ USBH_EHCI,
++ USBH_PME, USBH_BIND),
++ INTC_GROUP(RSPI,
++ RSPI_OVRF, RSPI_SPTEF, RSPI_SPRF),
++ INTC_GROUP(SPU2,
++ SPU2_0, SPU2_1),
++ INTC_GROUP(FLCTL,
++ FLCTL_FLSTEI, FLCTL_FLTENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
++ INTC_GROUP(IIC1,
++ IIC1_ALI, IIC1_TACKI, IIC1_WAITI, IIC1_DTEI),
++};
++
++static struct intc_mask_reg intca_mask_registers[] __initdata = {
++ { /* IMR0A / IMCR0A */ 0xe6940080, 0xe69400c0, 8,
++ { DMAC2_1_DEI3, DMAC2_1_DEI2, DMAC2_1_DEI1, DMAC2_1_DEI0,
++ 0, 0, AP_ARM_COMMTX, AP_ARM_COMMRX } },
++ { /* IMR1A / IMCR1A */ 0xe6940084, 0xe69400c4, 8,
++ { ATAPI, 0, DIRC, 0,
++ DMAC1_1_DEI3, DMAC1_1_DEI2, DMAC1_1_DEI1, DMAC1_1_DEI0 } },
++ { /* IMR2A / IMCR2A */ 0xe6940088, 0xe69400c8, 8,
++ { 0, 0, 0, 0,
++ BBIF1, BBIF2, MFIS, MFI } },
++ { /* IMR3A / IMCR3A */ 0xe694008c, 0xe69400cc, 8,
++ { DMAC3_1_DEI3, DMAC3_1_DEI2, DMAC3_1_DEI1, DMAC3_1_DEI0,
++ DMAC3_2_DADERR, DMAC3_2_DEI5, DMAC3_2_DEI4, IRDA } },
++ { /* IMR4A / IMCR4A */ 0xe6940090, 0xe69400d0, 8,
++ { DDM, 0, 0, 0,
++ 0, 0, 0, 0 } },
++ { /* IMR5A / IMCR5A */ 0xe6940094, 0xe69400d4, 8,
++ { KEYSC, DMAC1_2_DADERR, DMAC1_2_DEI5, DMAC1_2_DEI4,
++ SCIFA3, SCIFA2, SCIFA1, SCIFA0 } },
++ { /* IMR6A / IMCR6A */ 0xe6940098, 0xe69400d8, 8,
++ { SCIFB, SCIFA5, SCIFA4, MSIOF1,
++ 0, 0, MSIOF2, 0 } },
++ { /* IMR7A / IMCR7A */ 0xe694009c, 0xe69400dc, 8,
++ { SDHI0_3, SDHI0_2, SDHI0_1, SDHI0_0,
++ FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLTENDI, FLCTL_FLSTEI } },
++ { /* IMR8A / IMCR8A */ 0xe69400a0, 0xe69400e0, 8,
++ { SDHI1_3, SDHI1_2, SDHI1_1, SDHI1_0,
++ 0, USBHSDMAC, 0, AP_ARM_L2CINT } },
++ { /* IMR9A / IMCR9A */ 0xe69400a4, 0xe69400e4, 8,
++ { CMT1_3, CMT1_2, CMT1_1, CMT1_0,
++ CMT2, USBF_IXL_INT, USBF_OUL_SOF, SGX540 } },
++ { /* IMR10A / IMCR10A */ 0xe69400a8, 0xe69400e8, 8,
++ { 0, DMAC2_2_DADERR, DMAC2_2_DEI5, DMAC2_2_DEI4,
++ 0, 0, 0, 0 } },
++ { /* IMR11A / IMCR11A */ 0xe69400ac, 0xe69400ec, 8,
++ { IIC1_DTEI, IIC1_WAITI, IIC1_TACKI, IIC1_ALI,
++ ICBS0, 0, 0, 0 } },
++ { /* IMR12A / IMCR12A */ 0xe69400b0, 0xe69400f0, 8,
++ { 0, 0, TPU0, SCIFA6,
++ SCIFA7, GbEther, 0, 0 } },
++ { /* IMR13A / IMCR13A */ 0xe69400b4, 0xe69400f4, 8,
++ { SDHI2_3, SDHI2_2, SDHI2_1, SDHI2_0,
++ 0, CMT3, 0, RWDT0 } },
++ { /* IMR0A3 / IMCR0A3 */ 0xe6950080, 0xe69500c0, 8,
++ { SHWYSTAT_RT, SHWYSTAT_HS, SHWYSTAT_COM, 0,
++ 0, 0, 0, 0 } },
++ /* IMR1A3 / IMCR1A3 */
++ { /* IMR2A3 / IMCR2A3 */ 0xe6950088, 0xe69500c8, 8,
++ { 0, 0, USBH_INT, USBH_OHCI,
++ USBH_EHCI, USBH_PME, USBH_BIND, 0 } },
++ /* IMR3A3 / IMCR3A3 */
++ { /* IMR4A3 / IMCR4A3 */ 0xe6950090, 0xe69500d0, 8,
++ { 0, 0, 0, 0,
++ RSPI_OVRF, RSPI_SPTEF, RSPI_SPRF, 0 } },
++ { /* IMR5A3 / IMCR5A3 */ 0xe6950094, 0xe69500d4, 8,
++ { SPU2_0, SPU2_1, FSI, FMSI,
++ 0, 0, 0, 0 } },
++ { /* IMR6A3 / IMCR6A3 */ 0xe6950098, 0xe69500d8, 8,
++ { 0, IPMMU, 0, 0,
++ AP_ARM_CTIIRQ, AP_ARM_PMURQ, 0, 0 } },
++ { /* IMR7A3 / IMCR7A3 */ 0xe695009c, 0xe69500dc, 8,
++ { MFIS2, CPORTR2S, CMT14, CMT15,
++ 0, MMCIF_0, MMCIF_1, MMCIF_2 } },
++ /* IMR8A3 / IMCR8A3 */
++ { /* IMR9A3 / IMCR9A3 */ 0xe69500a4, 0xe69500e4, 8,
++ { SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEI,
++ STPRO_0, STPRO_1, STPRO_2, STPRO_3 } },
++ { /* IMR10A3 / IMCR10A3 */ 0xe69500a8, 0xe69500e8, 8,
++ { STPRO_4, 0, 0, 0,
++ 0, 0, 0, 0 } },
++};
++
++static struct intc_prio_reg intca_prio_registers[] __initdata = {
++ { 0xe6940000, 0, 16, 4, /* IPRAA */ { DMAC3_1, DMAC3_2, CMT2, ICBS0 } },
++ { 0xe6940004, 0, 16, 4, /* IPRBA */ { IRDA, 0, BBIF1, BBIF2 } },
++ { 0xe6940008, 0, 16, 4, /* IPRCA */ { ATAPI, 0, CMT1_1, AP_ARM1 } },
++ { 0xe694000c, 0, 16, 4, /* IPRDA */ { 0, 0, CMT1_2, 0 } },
++ { 0xe6940010, 0, 16, 4, /* IPREA */ { DMAC1_1, MFIS, MFI, USBF } },
++ { 0xe6940014, 0, 16, 4, /* IPRFA */ { KEYSC, DMAC1_2,
++ SGX540, CMT1_0 } },
++ { 0xe6940018, 0, 16, 4, /* IPRGA */ { SCIFA0, SCIFA1,
++ SCIFA2, SCIFA3 } },
++ { 0xe694001c, 0, 16, 4, /* IPRGH */ { MSIOF2, USBHSDMAC,
++ FLCTL, SDHI0 } },
++ { 0xe6940020, 0, 16, 4, /* IPRIA */ { MSIOF1, SCIFA4, 0, IIC1 } },
++ { 0xe6940024, 0, 16, 4, /* IPRJA */ { DMAC2_1, DMAC2_2,
++ AP_ARM_L2CINT, 0 } },
++ { 0xe6940028, 0, 16, 4, /* IPRKA */ { 0, CMT1_3, 0, SDHI1 } },
++ { 0xe694002c, 0, 16, 4, /* IPRLA */ { TPU0, SCIFA6,
++ SCIFA7, GbEther } },
++ { 0xe6940030, 0, 16, 4, /* IPRMA */ { 0, CMT3, 0, RWDT0 } },
++ { 0xe6940034, 0, 16, 4, /* IPRNA */ { SCIFB, SCIFA5, 0, DDM } },
++ { 0xe6940038, 0, 16, 4, /* IPROA */ { 0, 0, DIRC, SDHI2 } },
++ { 0xe6950000, 0, 16, 4, /* IPRAA3 */ { SHWYSTAT, 0, 0, 0 } },
++ /* IPRBA3 */
++ /* IPRCA3 */
++ /* IPRDA3 */
++ { 0xe6950010, 0, 16, 4, /* IPREA3 */ { USBH1, 0, 0, 0 } },
++ { 0xe6950014, 0, 16, 4, /* IPRFA3 */ { USBH2, 0, 0, 0 } },
++ /* IPRGA3 */
++ /* IPRHA3 */
++ /* IPRIA3 */
++ { 0xe6950024, 0, 16, 4, /* IPRJA3 */ { RSPI, 0, 0, 0 } },
++ { 0xe6950028, 0, 16, 4, /* IPRKA3 */ { SPU2, 0, FSI, FMSI } },
++ /* IPRLA3 */
++ { 0xe6950030, 0, 16, 4, /* IPRMA3 */ { IPMMU, 0, 0, 0 } },
++ { 0xe6950034, 0, 16, 4, /* IPRNA3 */ { AP_ARM2, 0, 0, 0 } },
++ { 0xe6950038, 0, 16, 4, /* IPROA3 */ { MFIS2, CPORTR2S,
++ CMT14, CMT15 } },
++ { 0xe695003c, 0, 16, 4, /* IPRPA3 */ { 0, MMCIF_0, MMCIF_1, MMCIF_2 } },
++ /* IPRQA3 */
++ /* IPRRA3 */
++ { 0xe6950048, 0, 16, 4, /* IPRSA3 */ { SIM_ERI, SIM_RXI,
++ SIM_TXI, SIM_TEI } },
++ { 0xe695004c, 0, 16, 4, /* IPRTA3 */ { STPRO_0, STPRO_1,
++ STPRO_2, STPRO_3 } },
++ { 0xe6950050, 0, 16, 4, /* IPRUA3 */ { STPRO_4, 0, 0, 0 } },
++};
++
++static DECLARE_INTC_DESC(intca_desc, "r8a7740-intca",
++ intca_vectors, intca_groups,
++ intca_mask_registers, intca_prio_registers,
++ NULL);
++
++INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000,
++ INTC_VECT, "r8a7740-intca-irq-pins");
++
++
++/*
++ * INTCS
++ */
++enum {
++ UNUSED_INTCS = 0,
++
++ INTCS,
++
++ /* interrupt sources INTCS */
++
++ /* HUDI */
++ /* STPRO */
++ /* RTDMAC(1) */
++ VPU5HA2,
++ _2DG_TRAP, _2DG_GPM_INT, _2DG_CER_INT,
++ /* MFI */
++ /* BBIF2 */
++ VPU5F,
++ _2DG_BRK_INT,
++ /* SGX540 */
++ /* 2DDMAC */
++ /* IPMMU */
++ /* RTDMAC 2 */
++ /* KEYSC */
++ /* MSIOF */
++ IIC0_ALI, IIC0_TACKI, IIC0_WAITI, IIC0_DTEI,
++ TMU0_0, TMU0_1, TMU0_2,
++ CMT0,
++ /* CMT2 */
++ LMB,
++ CTI,
++ VOU,
++ /* RWDT0 */
++ ICB,
++ VIO6C,
++ CEU20, CEU21,
++ JPU,
++ LCDC0,
++ LCRC,
++ /* RTDMAC2(1) */
++ /* RTDMAC2(2) */
++ LCDC1,
++ /* SPU2 */
++ /* FSI */
++ /* FMSI */
++ TMU1_0, TMU1_1, TMU1_2,
++ CMT4,
++ DISP,
++ DSRV,
++ /* MFIS2 */
++ CPORTS2R,
++
++ /* interrupt groups INTCS */
++ _2DG1,
++ IIC0, TMU1,
++};
++
++static struct intc_vect intcs_vectors[] = {
++ /* HUDI */
++ /* STPRO */
++ /* RTDMAC(1) */
++ INTCS_VECT(VPU5HA2, 0x0880),
++ INTCS_VECT(_2DG_TRAP, 0x08A0),
++ INTCS_VECT(_2DG_GPM_INT, 0x08C0),
++ INTCS_VECT(_2DG_CER_INT, 0x08E0),
++ /* MFI */
++ /* BBIF2 */
++ INTCS_VECT(VPU5F, 0x0980),
++ INTCS_VECT(_2DG_BRK_INT, 0x09A0),
++ /* SGX540 */
++ /* 2DDMAC */
++ /* IPMMU */
++ /* RTDMAC(2) */
++ /* KEYSC */
++ /* MSIOF */
++ INTCS_VECT(IIC0_ALI, 0x0E00),
++ INTCS_VECT(IIC0_TACKI, 0x0E20),
++ INTCS_VECT(IIC0_WAITI, 0x0E40),
++ INTCS_VECT(IIC0_DTEI, 0x0E60),
++ INTCS_VECT(TMU0_0, 0x0E80),
++ INTCS_VECT(TMU0_1, 0x0EA0),
++ INTCS_VECT(TMU0_2, 0x0EC0),
++ INTCS_VECT(CMT0, 0x0F00),
++ /* CMT2 */
++ INTCS_VECT(LMB, 0x0F60),
++ INTCS_VECT(CTI, 0x0400),
++ INTCS_VECT(VOU, 0x0420),
++ /* RWDT0 */
++ INTCS_VECT(ICB, 0x0480),
++ INTCS_VECT(VIO6C, 0x04E0),
++ INTCS_VECT(CEU20, 0x0500),
++ INTCS_VECT(CEU21, 0x0520),
++ INTCS_VECT(JPU, 0x0560),
++ INTCS_VECT(LCDC0, 0x0580),
++ INTCS_VECT(LCRC, 0x05A0),
++ /* RTDMAC2(1) */
++ /* RTDMAC2(2) */
++ INTCS_VECT(LCDC1, 0x1780),
++ /* SPU2 */
++ /* FSI */
++ /* FMSI */
++ INTCS_VECT(TMU1_0, 0x1900),
++ INTCS_VECT(TMU1_1, 0x1920),
++ INTCS_VECT(TMU1_2, 0x1940),
++ INTCS_VECT(CMT4, 0x1980),
++ INTCS_VECT(DISP, 0x19A0),
++ INTCS_VECT(DSRV, 0x19C0),
++ /* MFIS2 */
++ INTCS_VECT(CPORTS2R, 0x1A20),
++
++ INTC_VECT(INTCS, 0xf80),
++};
+
+-static int r8a7740_set_wake(struct irq_data *data, unsigned int on)
++static struct intc_group intcs_groups[] __initdata = {
++ INTC_GROUP(_2DG1, /*FIXME*/
++ _2DG_CER_INT, _2DG_GPM_INT, _2DG_TRAP),
++ INTC_GROUP(IIC0,
++ IIC0_DTEI, IIC0_WAITI, IIC0_TACKI, IIC0_ALI),
++ INTC_GROUP(TMU1,
++ TMU1_0, TMU1_1, TMU1_2),
++};
++
++static struct intc_mask_reg intcs_mask_registers[] = {
++ /* IMR0SA / IMCR0SA */ /* all 0 */
++ { /* IMR1SA / IMCR1SA */ 0xffd20184, 0xffd201c4, 8,
++ { _2DG_CER_INT, _2DG_GPM_INT, _2DG_TRAP, VPU5HA2,
++ 0, 0, 0, 0 /*STPRO*/ } },
++ { /* IMR2SA / IMCR2SA */ 0xffd20188, 0xffd201c8, 8,
++ { 0/*STPRO*/, 0, CEU21, VPU5F,
++ 0/*BBIF2*/, 0, 0, 0/*MFI*/ } },
++ { /* IMR3SA / IMCR3SA */ 0xffd2018c, 0xffd201cc, 8,
++ { 0, 0, 0, 0, /*2DDMAC*/
++ VIO6C, 0, 0, ICB } },
++ { /* IMR4SA / IMCR4SA */ 0xffd20190, 0xffd201d0, 8,
++ { 0, 0, VOU, CTI,
++ JPU, 0, LCRC, LCDC0 } },
++ /* IMR5SA / IMCR5SA */ /*KEYSC/RTDMAC2/RTDMAC1*/
++ /* IMR6SA / IMCR6SA */ /*MSIOF/SGX540*/
++ { /* IMR7SA / IMCR7SA */ 0xffd2019c, 0xffd201dc, 8,
++ { 0, TMU0_2, TMU0_1, TMU0_0,
++ 0, 0, 0, 0 } },
++ { /* IMR8SA / IMCR8SA */ 0xffd201a0, 0xffd201e0, 8,
++ { 0, 0, 0, 0,
++ CEU20, 0, 0, 0 } },
++ { /* IMR9SA / IMCR9SA */ 0xffd201a4, 0xffd201e4, 8,
++ { 0, 0/*RWDT0*/, 0/*CMT2*/, CMT0,
++ 0, 0, 0, 0 } },
++ /* IMR10SA / IMCR10SA */ /*IPMMU*/
++ { /* IMR11SA / IMCR11SA */ 0xffd201ac, 0xffd201ec, 8,
++ { IIC0_DTEI, IIC0_WAITI, IIC0_TACKI, IIC0_ALI,
++ 0, _2DG_BRK_INT, LMB, 0 } },
++ /* IMR12SA / IMCR12SA */
++ /* IMR13SA / IMCR13SA */
++ /* IMR0SA3 / IMCR0SA3 */ /*RTDMAC2(1)/RTDMAC2(2)*/
++ /* IMR1SA3 / IMCR1SA3 */
++ /* IMR2SA3 / IMCR2SA3 */
++ /* IMR3SA3 / IMCR3SA3 */
++ { /* IMR4SA3 / IMCR4SA3 */ 0xffd50190, 0xffd501d0, 8,
++ { 0, 0, 0, 0,
++ LCDC1, 0, 0, 0 } },
++ /* IMR5SA3 / IMCR5SA3 */ /* SPU2/FSI/FMSI */
++ { /* IMR6SA3 / IMCR6SA3 */ 0xffd50198, 0xffd501d8, 8,
++ { TMU1_0, TMU1_1, TMU1_2, 0,
++ CMT4, DISP, DSRV, 0 } },
++ { /* IMR7SA3 / IMCR7SA3 */ 0xffd5019c, 0xffd501dc, 8,
++ { 0/*MFIS2*/, CPORTS2R, 0, 0,
++ 0, 0, 0, 0 } },
++ { /* INTAMASK */ 0xffd20104, 0, 16,
++ { 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, INTCS } },
++};
++
++/* Priority is needed for INTCA to receive the INTCS interrupt */
++static struct intc_prio_reg intcs_prio_registers[] = {
++ { 0xffd20000, 0, 16, 4, /* IPRAS */ { CTI, VOU, 0/*2DDMAC*/, ICB } },
++ { 0xffd20004, 0, 16, 4, /* IPRBS */ { JPU, LCDC0, 0, LCRC } },
++ /* IPRCS */ /*BBIF2*/
++ /* IPRDS */
++ { 0xffd20010, 0, 16, 4, /* IPRES */ { 0/*RTDMAC(1)*/, VPU5HA2,
++ 0/*MFI*/, VPU5F } },
++ { 0xffd20014, 0, 16, 4, /* IPRFS */ { 0/*KEYSC*/, 0/*RTDMAC(2)*/,
++ 0/*CMT2*/, CMT0 } },
++ { 0xffd20018, 0, 16, 4, /* IPRGS */ { TMU0_0, TMU0_1,
++ TMU0_2, _2DG1 } },
++ { 0xffd2001c, 0, 16, 4, /* IPRHS */ { 0, 0/*STPRO*/, 0/*STPRO*/,
++ _2DG_BRK_INT/*FIXME*/ } },
++ { 0xffd20020, 0, 16, 4, /* IPRIS */ { 0, 0/*MSIOF*/, 0, IIC0 } },
++ { 0xffd20024, 0, 16, 4, /* IPRJS */ { CEU20, 0/*SGX540*/, 0, 0 } },
++ { 0xffd20028, 0, 16, 4, /* IPRKS */ { VIO6C, 0, LMB, 0 } },
++ { 0xffd2002c, 0, 16, 4, /* IPRLS */ { 0/*IPMMU*/, 0, CEU21, 0 } },
++ /* IPRMS */ /*RWDT0*/
++ /* IPRAS3 */ /*RTDMAC2(1)*/
++ /* IPRBS3 */ /*RTDMAC2(2)*/
++ /* IPRCS3 */
++ /* IPRDS3 */
++ /* IPRES3 */
++ /* IPRFS3 */
++ /* IPRGS3 */
++ /* IPRHS3 */
++ /* IPRIS3 */
++ { 0xffd50024, 0, 16, 4, /* IPRJS3 */ { LCDC1, 0, 0, 0 } },
++ /* IPRKS3 */ /*SPU2/FSI/FMSi*/
++ /* IPRLS3 */
++ { 0xffd50030, 0, 16, 4, /* IPRMS3 */ { TMU1, 0, 0, 0 } },
++ { 0xffd50034, 0, 16, 4, /* IPRNS3 */ { CMT4, DISP, DSRV, 0 } },
++ { 0xffd50038, 0, 16, 4, /* IPROS3 */ { 0/*MFIS2*/, CPORTS2R, 0, 0 } },
++ /* IPRPS3 */
++};
++
++static struct resource intcs_resources[] __initdata = {
++ [0] = {
++ .start = 0xffd20000,
++ .end = 0xffd201ff,
++ .flags = IORESOURCE_MEM,
++ },
++ [1] = {
++ .start = 0xffd50000,
++ .end = 0xffd501ff,
++ .flags = IORESOURCE_MEM,
++ }
++};
++
++static struct intc_desc intcs_desc __initdata = {
++ .name = "r8a7740-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 void intcs_demux(unsigned int irq, struct irq_desc *desc)
+ {
+- return 0; /* always allow wakeup */
++ void __iomem *reg = (void *)irq_get_handler_data(irq);
++ unsigned int evtcodeas = ioread32(reg);
++
++ generic_handle_irq(intcs_evt2irq(evtcodeas));
+ }
+
+ void __init r8a7740_init_irq(void)
+ {
+- void __iomem *gic_dist_base = __io(0xf0001000);
+- void __iomem *gic_cpu_base = __io(0xf0000000);
++ void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE);
+
+- /*
+- * Change INT_SEL INTCA->GIC
+- * (on GPIO)
+- */
+- __raw_writel(__raw_readl(INTA_CTRL) & ~(1 << 1), INTA_CTRL);
++ register_intc_controller(&intca_desc);
++ register_intc_controller(&intca_irq_pins_desc);
++ register_intc_controller(&intcs_desc);
+
+- gic_init(0, 29, gic_dist_base, gic_cpu_base);
+- gic_arch_extn.irq_set_wake = r8a7740_set_wake;
++ /* demux using INTEVTSA */
++ irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa);
++ irq_set_chained_handler(evt2irq(0xf80), intcs_demux);
+ }
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index e16860f..986dca6 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -35,7 +35,7 @@ static struct plat_sci_port scif0_platform_data = {
+ .scscr = SCSCR_RE | SCSCR_TE,
+ .scbrr_algo_id = SCBRR_ALGO_4,
+ .type = PORT_SCIFA,
+- .irqs = SCIx_IRQ_MUXED(gic_spi(100)),
++ .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c00)),
+ };
+
+ static struct platform_device scif0_device = {
+@@ -53,7 +53,7 @@ static struct plat_sci_port scif1_platform_data = {
+ .scscr = SCSCR_RE | SCSCR_TE,
+ .scbrr_algo_id = SCBRR_ALGO_4,
+ .type = PORT_SCIFA,
+- .irqs = SCIx_IRQ_MUXED(gic_spi(101)),
++ .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c20)),
+ };
+
+ static struct platform_device scif1_device = {
+@@ -71,7 +71,7 @@ static struct plat_sci_port scif2_platform_data = {
+ .scscr = SCSCR_RE | SCSCR_TE,
+ .scbrr_algo_id = SCBRR_ALGO_4,
+ .type = PORT_SCIFA,
+- .irqs = SCIx_IRQ_MUXED(gic_spi(102)),
++ .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c40)),
+ };
+
+ static struct platform_device scif2_device = {
+@@ -89,7 +89,7 @@ static struct plat_sci_port scif3_platform_data = {
+ .scscr = SCSCR_RE | SCSCR_TE,
+ .scbrr_algo_id = SCBRR_ALGO_4,
+ .type = PORT_SCIFA,
+- .irqs = SCIx_IRQ_MUXED(gic_spi(103)),
++ .irqs = SCIx_IRQ_MUXED(evt2irq(0x0c60)),
+ };
+
+ static struct platform_device scif3_device = {
+@@ -107,7 +107,7 @@ static struct plat_sci_port scif4_platform_data = {
+ .scscr = SCSCR_RE | SCSCR_TE,
+ .scbrr_algo_id = SCBRR_ALGO_4,
+ .type = PORT_SCIFA,
+- .irqs = SCIx_IRQ_MUXED(gic_spi(104)),
++ .irqs = SCIx_IRQ_MUXED(evt2irq(0x0d20)),
+ };
+
+ static struct platform_device scif4_device = {
+@@ -125,7 +125,7 @@ static struct plat_sci_port scif5_platform_data = {
+ .scscr = SCSCR_RE | SCSCR_TE,
+ .scbrr_algo_id = SCBRR_ALGO_4,
+ .type = PORT_SCIFA,
+- .irqs = SCIx_IRQ_MUXED(gic_spi(105)),
++ .irqs = SCIx_IRQ_MUXED(evt2irq(0x0d40)),
+ };
+
+ static struct platform_device scif5_device = {
+@@ -143,7 +143,7 @@ static struct plat_sci_port scif6_platform_data = {
+ .scscr = SCSCR_RE | SCSCR_TE,
+ .scbrr_algo_id = SCBRR_ALGO_4,
+ .type = PORT_SCIFA,
+- .irqs = SCIx_IRQ_MUXED(gic_spi(106)),
++ .irqs = SCIx_IRQ_MUXED(evt2irq(0x04c0)),
+ };
+
+ static struct platform_device scif6_device = {
+@@ -161,7 +161,7 @@ static struct plat_sci_port scif7_platform_data = {
+ .scscr = SCSCR_RE | SCSCR_TE,
+ .scbrr_algo_id = SCBRR_ALGO_4,
+ .type = PORT_SCIFA,
+- .irqs = SCIx_IRQ_MUXED(gic_spi(107)),
++ .irqs = SCIx_IRQ_MUXED(evt2irq(0x04e0)),
+ };
+
+ static struct platform_device scif7_device = {
+@@ -179,7 +179,7 @@ static struct plat_sci_port scifb_platform_data = {
+ .scscr = SCSCR_RE | SCSCR_TE,
+ .scbrr_algo_id = SCBRR_ALGO_4,
+ .type = PORT_SCIFB,
+- .irqs = SCIx_IRQ_MUXED(gic_spi(108)),
++ .irqs = SCIx_IRQ_MUXED(evt2irq(0x0d60)),
+ };
+
+ static struct platform_device scifb_device = {
+@@ -207,7 +207,7 @@ static struct resource cmt10_resources[] = {
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+- .start = gic_spi(58),
++ .start = evt2irq(0x0b00),
+ .flags = IORESOURCE_IRQ,
+ },
+ };
+@@ -244,8 +244,8 @@ static struct resource i2c0_resources[] = {
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+- .start = gic_spi(201),
+- .end = gic_spi(204),
++ .start = intcs_evt2irq(0xe00),
++ .end = intcs_evt2irq(0xe60),
+ .flags = IORESOURCE_IRQ,
+ },
+ };
+@@ -258,8 +258,8 @@ static struct resource i2c1_resources[] = {
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+- .start = gic_spi(70),
+- .end = gic_spi(73),
++ .start = evt2irq(0x780), /* IIC1_ALI1 */
++ .end = evt2irq(0x7e0), /* IIC1_DTEI1 */
+ .flags = IORESOURCE_IRQ,
+ },
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0061-ARM-mach-shmobile-bonito-Add-LCDC0-support.patch b/patches.armadillo800eva/0061-ARM-mach-shmobile-bonito-Add-LCDC0-support.patch
new file mode 100644
index 00000000000000..ccb19973122a87
--- /dev/null
+++ b/patches.armadillo800eva/0061-ARM-mach-shmobile-bonito-Add-LCDC0-support.patch
@@ -0,0 +1,56 @@
+From a312fff23bc9b15c9896061c837a35edf027780b Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 10 Nov 2011 18:47:16 -0800
+Subject: ARM: mach-shmobile: bonito: Add LCDC0 support
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 665ccfa0904cc0a05aa882d193f9506081824d7c)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-bonito.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7740.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+index 5bb02f2..3b35b9a 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7740.c
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -251,7 +251,7 @@ static struct clk div6_clks[DIV6_NR] = {
+
+ enum {
+ MSTP125,
+- MSTP116, MSTP111,
++ MSTP116, MSTP111, MSTP100, MSTP117,
+
+ MSTP230,
+ MSTP222,
+@@ -264,8 +264,10 @@ enum {
+
+ static struct clk mstp_clks[MSTP_NR] = {
+ [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(&div6_clks[DIV6_SUB], 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 */
+ [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */
+@@ -314,8 +316,10 @@ static struct clk_lookup lookups[] = {
+ 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("sh_tmu.1", &mstp_clks[MSTP111]),
+ CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]),
++ CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]),
+ CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]),
+
+ CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0062-ARM-mach-shmobile-r8a7740-sh_clk_ops-rename.patch b/patches.armadillo800eva/0062-ARM-mach-shmobile-r8a7740-sh_clk_ops-rename.patch
new file mode 100644
index 00000000000000..efbae90aed2e76
--- /dev/null
+++ b/patches.armadillo800eva/0062-ARM-mach-shmobile-r8a7740-sh_clk_ops-rename.patch
@@ -0,0 +1,50 @@
+From 9ea780bd6745d2432f607d442035256ed93fc0e7 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 29 Feb 2012 22:17:00 +0900
+Subject: ARM: mach-shmobile: r8a7740 sh_clk_ops rename
+
+Convert r8a7740 to use sh_clk_ops.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+(cherry picked from commit d9f8670df8c6eb4c0726ea3fa8ff8bc712702500)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7740.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+index 3b35b9a..6a40684 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7740.c
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -93,7 +93,7 @@ static unsigned long div_recalc(struct clk *clk)
+ return clk->parent->rate / (int)(clk->priv);
+ }
+
+-static struct clk_ops div_clk_ops = {
++static struct sh_clk_ops div_clk_ops = {
+ .recalc = div_recalc,
+ };
+
+@@ -125,7 +125,7 @@ static struct clk extal2_div2_clk = {
+ .parent = &extal2_clk,
+ };
+
+-static struct clk_ops followparent_clk_ops = {
++static struct sh_clk_ops followparent_clk_ops = {
+ .recalc = followparent_recalc,
+ };
+
+@@ -156,7 +156,7 @@ static unsigned long pllc01_recalc(struct clk *clk)
+ return clk->parent->rate * mult;
+ }
+
+-static struct clk_ops pllc01_clk_ops = {
++static struct sh_clk_ops pllc01_clk_ops = {
+ .recalc = pllc01_recalc,
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0063-ARM-mach-shmobile-r8a7740-map_io-and-init_early-upda.patch b/patches.armadillo800eva/0063-ARM-mach-shmobile-r8a7740-map_io-and-init_early-upda.patch
new file mode 100644
index 00000000000000..05d247f82c56bb
--- /dev/null
+++ b/patches.armadillo800eva/0063-ARM-mach-shmobile-r8a7740-map_io-and-init_early-upda.patch
@@ -0,0 +1,91 @@
+From 5e344935b55c044d754627cb8d38720c19181662 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 29 Feb 2012 21:37:35 +0900
+Subject: ARM: mach-shmobile: r8a7740 map_io and init_early update
+
+Update the r8a7740 SoC and the Bonito board to make use of
+the functions r8a7740_map_io() and r8a7740_add_early_devices().
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+(cherry picked from commit d3ab7221489fa188b0e1e9bfe2cc4ecd1d7da933)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-bonito.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/include/mach/common.h | 1 +
+ arch/arm/mach-shmobile/setup-r8a7740.c | 35 ++++++++++++++++++++++++++
+ 2 files changed, 36 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
+index d821f63..2e21a77 100644
+--- a/arch/arm/mach-shmobile/include/mach/common.h
++++ b/arch/arm/mach-shmobile/include/mach/common.h
+@@ -55,6 +55,7 @@ extern int sh73a0_boot_secondary(unsigned int cpu);
+ extern void sh73a0_smp_prepare_cpus(void);
+
+ extern void r8a7740_init_irq(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);
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index 986dca6..dbc3067 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -25,9 +25,41 @@
+ #include <linux/serial_sci.h>
+ #include <linux/sh_timer.h>
+ #include <mach/r8a7740.h>
++#include <mach/common.h>
+ #include <asm/mach-types.h>
++#include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
+
++static struct map_desc r8a7740_io_desc[] __initdata = {
++ /*
++ * for CPGA/INTC/PFC
++ * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff
++ */
++ {
++ .virtual = 0xe6000000,
++ .pfn = __phys_to_pfn(0xe6000000),
++ .length = 160 << 20,
++ .type = MT_DEVICE_NONSHARED
++ },
++#ifdef CONFIG_CACHE_L2X0
++ /*
++ * for l2x0_init()
++ * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000
++ */
++ {
++ .virtual = 0xf0002000,
++ .pfn = __phys_to_pfn(0xf0100000),
++ .length = PAGE_SIZE,
++ .type = MT_DEVICE_NONSHARED
++ },
++#endif
++};
++
++void __init r8a7740_map_io(void)
++{
++ iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
++}
++
+ /* SCIFA0 */
+ static struct plat_sci_port scif0_platform_data = {
+ .mapbase = 0xe6c40000,
+@@ -349,4 +381,7 @@ 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();
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0064-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch b/patches.armadillo800eva/0064-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch
new file mode 100644
index 00000000000000..777f99a63b0d1d
--- /dev/null
+++ b/patches.armadillo800eva/0064-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch
@@ -0,0 +1,37 @@
+From c5cbdbce8978b5b8baf3cd96a10ea6ce76e2decd Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 29 Feb 2012 21:41:30 +0900
+Subject: ARM: mach-shmobile: rename clk_init() to shmobile_clk_init()
+
+Rename clk_init() to shmobile_clk_init() to avoid a potential
+future name space collision with the common clock framework.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+(cherry picked from commit 6b6a4c067cefe04eb0a0e7d1cace16ae727c6295)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/clock-r8a7779.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-r8a7740.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
+index 6a40684..99c4d74 100644
+--- a/arch/arm/mach-shmobile/clock-r8a7740.c
++++ b/arch/arm/mach-shmobile/clock-r8a7740.c
+@@ -376,7 +376,7 @@ void __init r8a7740_clock_init(u8 md_ck)
+ clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
+ if (!ret)
+- clk_init();
++ shmobile_clk_init();
+ else
+ panic("failed to setup r8a7740 clocks\n");
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0065-ARM-mach-shmobile-r8a7740-and-Bonito-timer-rework.patch b/patches.armadillo800eva/0065-ARM-mach-shmobile-r8a7740-and-Bonito-timer-rework.patch
new file mode 100644
index 00000000000000..051129a38c3959
--- /dev/null
+++ b/patches.armadillo800eva/0065-ARM-mach-shmobile-r8a7740-and-Bonito-timer-rework.patch
@@ -0,0 +1,59 @@
+From 61ff43d82e7561e42ec05781acf017d65368bfee Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Tue, 6 Mar 2012 17:36:53 +0900
+Subject: ARM: mach-shmobile: r8a7740 and Bonito timer rework
+
+Copy the SoC specific timer code from Bonito board code
+to r8a7740 setup code. This makes is possible to share
+the SoC specific timer code across boards. The Bonito
+specific timer setup code tied to the FPGA is kept as-is.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+(cherry picked from commit 23e5bc03e3b07185d61c212bf39aaf126cc958e3)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-bonito.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/setup-r8a7740.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
+index dbc3067..74e5234 100644
+--- a/arch/arm/mach-shmobile/setup-r8a7740.c
++++ b/arch/arm/mach-shmobile/setup-r8a7740.c
+@@ -29,6 +29,7 @@
+ #include <asm/mach-types.h>
+ #include <asm/mach/map.h>
+ #include <asm/mach/arch.h>
++#include <asm/mach/time.h>
+
+ static struct map_desc r8a7740_io_desc[] __initdata = {
+ /*
+@@ -377,6 +378,12 @@ void __init r8a7740_add_standard_devices(void)
+ ARRAY_SIZE(r8a7740_late_devices));
+ }
+
++static void __init r8a7740_earlytimer_init(void)
++{
++ r8a7740_clock_init(0);
++ shmobile_earlytimer_init();
++}
++
+ void __init r8a7740_add_early_devices(void)
+ {
+ early_platform_add_devices(r8a7740_early_devices,
+@@ -384,4 +391,7 @@ void __init r8a7740_add_early_devices(void)
+
+ /* setup early console here as well */
+ shmobile_setup_console();
++
++ /* override timer setup with soc-specific code */
++ shmobile_timer.init = r8a7740_earlytimer_init;
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0066-ARM-mach-shmobile-pfc-r8a7740-add-gpio_irq-support.patch b/patches.armadillo800eva/0066-ARM-mach-shmobile-pfc-r8a7740-add-gpio_irq-support.patch
new file mode 100644
index 00000000000000..c5a7f1d72e1664
--- /dev/null
+++ b/patches.armadillo800eva/0066-ARM-mach-shmobile-pfc-r8a7740-add-gpio_irq-support.patch
@@ -0,0 +1,82 @@
+From b9aaa6ed8c90707a7161bc602aa2353fafde4551 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Fri, 6 Apr 2012 01:28:14 -0700
+Subject: ARM: mach-shmobile: pfc-r8a7740: add gpio_irq support
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+(cherry picked from commit c8ad89c21540fd58acaec22f984bb5e8775d0e59)
+
+N.B: this commit is not present in mainline yet
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/pfc-r8a7740.c | 39 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 39 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/pfc-r8a7740.c b/arch/arm/mach-shmobile/pfc-r8a7740.c
+index a4fff69..670fe18 100644
+--- a/arch/arm/mach-shmobile/pfc-r8a7740.c
++++ b/arch/arm/mach-shmobile/pfc-r8a7740.c
+@@ -22,6 +22,7 @@
+ #include <linux/kernel.h>
+ #include <linux/gpio.h>
+ #include <mach/r8a7740.h>
++#include <mach/irqs.h>
+
+ #define CPU_ALL_PORT(fn, pfx, sfx) \
+ PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
+@@ -2527,6 +2528,41 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
+ { },
+ };
+
++static struct pinmux_irq pinmux_irqs[] = {
++ PINMUX_IRQ(evt2irq(0x0200), PORT2_FN0, PORT13_FN0), /* IRQ0A */
++ PINMUX_IRQ(evt2irq(0x0220), PORT20_FN0), /* IRQ1A */
++ PINMUX_IRQ(evt2irq(0x0240), PORT11_FN0, PORT12_FN0), /* IRQ2A */
++ PINMUX_IRQ(evt2irq(0x0260), PORT10_FN0, PORT14_FN0), /* IRQ3A */
++ PINMUX_IRQ(evt2irq(0x0280), PORT15_FN0, PORT172_FN0), /* IRQ4A */
++ PINMUX_IRQ(evt2irq(0x02A0), PORT0_FN0, PORT1_FN0), /* IRQ5A */
++ PINMUX_IRQ(evt2irq(0x02C0), PORT121_FN0, PORT173_FN0), /* IRQ6A */
++ PINMUX_IRQ(evt2irq(0x02E0), PORT120_FN0, PORT209_FN0), /* IRQ7A */
++ PINMUX_IRQ(evt2irq(0x0300), PORT119_FN0), /* IRQ8A */
++ PINMUX_IRQ(evt2irq(0x0320), PORT118_FN0, PORT210_FN0), /* IRQ9A */
++ PINMUX_IRQ(evt2irq(0x0340), PORT19_FN0), /* IRQ10A */
++ PINMUX_IRQ(evt2irq(0x0360), PORT104_FN0), /* IRQ11A */
++ PINMUX_IRQ(evt2irq(0x0380), PORT42_FN0, PORT97_FN0), /* IRQ12A */
++ PINMUX_IRQ(evt2irq(0x03A0), PORT64_FN0, PORT98_FN0), /* IRQ13A */
++ PINMUX_IRQ(evt2irq(0x03C0), PORT63_FN0, PORT99_FN0), /* IRQ14A */
++ PINMUX_IRQ(evt2irq(0x03E0), PORT62_FN0, PORT100_FN0), /* IRQ15A */
++ PINMUX_IRQ(evt2irq(0x3200), PORT68_FN0, PORT211_FN0), /* IRQ16A */
++ PINMUX_IRQ(evt2irq(0x3220), PORT69_FN0), /* IRQ17A */
++ PINMUX_IRQ(evt2irq(0x3240), PORT70_FN0), /* IRQ18A */
++ PINMUX_IRQ(evt2irq(0x3260), PORT71_FN0), /* IRQ19A */
++ PINMUX_IRQ(evt2irq(0x3280), PORT67_FN0), /* IRQ20A */
++ PINMUX_IRQ(evt2irq(0x32A0), PORT202_FN0), /* IRQ21A */
++ PINMUX_IRQ(evt2irq(0x32C0), PORT95_FN0), /* IRQ22A */
++ PINMUX_IRQ(evt2irq(0x32E0), PORT96_FN0), /* IRQ23A */
++ PINMUX_IRQ(evt2irq(0x3300), PORT180_FN0), /* IRQ24A */
++ PINMUX_IRQ(evt2irq(0x3320), PORT38_FN0), /* IRQ25A */
++ PINMUX_IRQ(evt2irq(0x3340), PORT58_FN0, PORT81_FN0), /* IRQ26A */
++ PINMUX_IRQ(evt2irq(0x3360), PORT57_FN0, PORT168_FN0), /* IRQ27A */
++ PINMUX_IRQ(evt2irq(0x3380), PORT56_FN0, PORT169_FN0), /* IRQ28A */
++ PINMUX_IRQ(evt2irq(0x33A0), PORT50_FN0, PORT170_FN0), /* IRQ29A */
++ PINMUX_IRQ(evt2irq(0x33C0), PORT49_FN0, PORT171_FN0), /* IRQ30A */
++ PINMUX_IRQ(evt2irq(0x33E0), PORT41_FN0, PORT167_FN0), /* IRQ31A */
++};
++
+ static struct pinmux_info r8a7740_pinmux_info = {
+ .name = "r8a7740_pfc",
+ .reserved_id = PINMUX_RESERVED,
+@@ -2554,6 +2590,9 @@ static struct pinmux_info r8a7740_pinmux_info = {
+
+ .gpio_data = pinmux_data,
+ .gpio_data_size = ARRAY_SIZE(pinmux_data),
++
++ .gpio_irq = pinmux_irqs,
++ .gpio_irq_size = ARRAY_SIZE(pinmux_irqs),
+ };
+
+ void r8a7740_pinmux_init(void)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0067-net-sh_eth-tidyup-compile-warning.patch b/patches.armadillo800eva/0067-net-sh_eth-tidyup-compile-warning.patch
new file mode 100644
index 00000000000000..ed039c39f417bb
--- /dev/null
+++ b/patches.armadillo800eva/0067-net-sh_eth-tidyup-compile-warning.patch
@@ -0,0 +1,45 @@
+From a9e3730dc28fd56cdb9f0b898bd05c099020efb4 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Thu, 23 Jun 2011 16:02:38 +0000
+Subject: net: sh_eth: tidyup compile warning
+
+This patch tidyup below warning
+
+${LINUX}/drivers/net/sh_eth.c:1773: warning:
+'mdp' may be used uninitialized in this function
+
+Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit ec0d75518cb06261f1823fa2713fe52b9b26455e)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/sh_eth.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
+index 1f3f7b4..3a7a6a5 100644
+--- a/drivers/net/sh_eth.c
++++ b/drivers/net/sh_eth.c
+@@ -1772,7 +1772,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
+ int ret, devno = 0;
+ struct resource *res;
+ struct net_device *ndev = NULL;
+- struct sh_eth_private *mdp;
++ struct sh_eth_private *mdp = NULL;
+ struct sh_eth_plat_data *pd;
+
+ /* get base addr */
+@@ -1890,7 +1890,7 @@ out_unregister:
+
+ out_release:
+ /* net_dev free */
+- if (mdp->tsu_addr)
++ if (mdp && mdp->tsu_addr)
+ iounmap(mdp->tsu_addr);
+ if (ndev)
+ free_netdev(ndev);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0068-net-sh_eth-remove-__flush_purge_region.patch b/patches.armadillo800eva/0068-net-sh_eth-remove-__flush_purge_region.patch
new file mode 100644
index 00000000000000..c787b08ac39853
--- /dev/null
+++ b/patches.armadillo800eva/0068-net-sh_eth-remove-__flush_purge_region.patch
@@ -0,0 +1,58 @@
+From a7514fd245d399bbd56a4465f0c651ce78c6f19e Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Thu, 30 Jun 2011 22:52:13 +0000
+Subject: net: sh_eth: remove __flush_purge_region
+
+It is a function of SuperH architecture. There is no good to use
+the function on a driver generally. So, the driver uses
+dma_map_single() instead of __flush_purge_region.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 31fcb99d9958bdf04e84224e202f69e6cdac893b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/sh_eth.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
+index 3a7a6a5..ad35c21 100644
+--- a/drivers/net/sh_eth.c
++++ b/drivers/net/sh_eth.c
+@@ -33,7 +33,6 @@
+ #include <linux/pm_runtime.h>
+ #include <linux/slab.h>
+ #include <linux/ethtool.h>
+-#include <asm/cacheflush.h>
+
+ #include "sh_eth.h"
+
+@@ -866,6 +865,8 @@ static int sh_eth_txfree(struct net_device *ndev)
+ break;
+ /* Free the original skb. */
+ if (mdp->tx_skbuff[entry]) {
++ dma_unmap_single(&ndev->dev, txdesc->addr,
++ txdesc->buffer_length, DMA_TO_DEVICE);
+ dev_kfree_skb_irq(mdp->tx_skbuff[entry]);
+ mdp->tx_skbuff[entry] = NULL;
+ freeNum++;
+@@ -1489,13 +1490,12 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
+ entry = mdp->cur_tx % TX_RING_SIZE;
+ mdp->tx_skbuff[entry] = skb;
+ txdesc = &mdp->tx_ring[entry];
+- txdesc->addr = virt_to_phys(skb->data);
+ /* soft swap. */
+ if (!mdp->cd->hw_swap)
+ sh_eth_soft_swap(phys_to_virt(ALIGN(txdesc->addr, 4)),
+ skb->len + 2);
+- /* write back */
+- __flush_purge_region(skb->data, skb->len);
++ txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len,
++ DMA_TO_DEVICE);
+ if (skb->len < ETHERSMALL)
+ txdesc->buffer_length = ETHERSMALL;
+ else
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0069-sh_eth-Move-the-Renesas-SuperH-driver.patch b/patches.armadillo800eva/0069-sh_eth-Move-the-Renesas-SuperH-driver.patch
new file mode 100644
index 00000000000000..de00744ce1d9ac
--- /dev/null
+++ b/patches.armadillo800eva/0069-sh_eth-Move-the-Renesas-SuperH-driver.patch
@@ -0,0 +1,290 @@
+From aac0e941122849b587798822e4dd5a62facfcd9a Mon Sep 17 00:00:00 2001
+From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+Date: Sat, 25 Jun 2011 03:53:13 -0700
+Subject: sh_eth: Move the Renesas SuperH driver
+
+Move the Renesas driver into drivers/net/ethernet/renesas/ and make
+the necessary Kconfig and Makefile changes.
+
+CC: Yoshihiro Shimoda <yoshihiro.shirmoda.uh@renesas.com>
+Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+(cherry picked from commit 37b937575b5a93a8fcbd4e1d553415f99381f650)
+
+Conflicts:
+
+ drivers/net/Kconfig
+ drivers/net/Makefile
+ drivers/net/ethernet/Kconfig
+ drivers/net/ethernet/Makefile
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/Kconfig | 15 +--
+ drivers/net/Makefile | 2 +-
+ drivers/net/ethernet/Kconfig | 164 +++++++++++++++++++++++++++
+ drivers/net/ethernet/renesas/Kconfig | 18 +++
+ drivers/net/ethernet/renesas/Makefile | 5 +
+ drivers/net/{ => ethernet/renesas}/sh_eth.c | 0
+ drivers/net/{ => ethernet/renesas}/sh_eth.h | 0
+ 7 files changed, 189 insertions(+), 15 deletions(-)
+ create mode 100644 drivers/net/ethernet/Kconfig
+ create mode 100644 drivers/net/ethernet/renesas/Kconfig
+ create mode 100644 drivers/net/ethernet/renesas/Makefile
+ rename drivers/net/{ => ethernet/renesas}/sh_eth.c (100%)
+ rename drivers/net/{ => ethernet/renesas}/sh_eth.h (100%)
+
+diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
+index 93359fa..bc75f35 100644
+--- a/drivers/net/Kconfig
++++ b/drivers/net/Kconfig
+@@ -528,20 +528,7 @@ config STNIC
+
+ If unsure, say N.
+
+-config SH_ETH
+- tristate "Renesas SuperH Ethernet support"
+- depends on SUPERH && \
+- (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \
+- CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \
+- CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7757)
+- select CRC32
+- select MII
+- select MDIO_BITBANG
+- select PHYLIB
+- help
+- Renesas SuperH Ethernet device driver.
+- This driver supporting CPUs are:
+- - SH7710, SH7712, SH7763, SH7619, SH7724, and SH7757.
++source "drivers/net/ethernet/renesas/Kconfig"
+
+ config SUNLANCE
+ tristate "Sun LANCE support"
+diff --git a/drivers/net/Makefile b/drivers/net/Makefile
+index d5ce011..45ae508 100644
+--- a/drivers/net/Makefile
++++ b/drivers/net/Makefile
+@@ -106,7 +106,7 @@ obj-$(CONFIG_VIA_RHINE) += via-rhine.o
+ obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o
+ obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o
+ obj-$(CONFIG_RIONET) += rionet.o
+-obj-$(CONFIG_SH_ETH) += sh_eth.o
++obj-$(CONFIG_SH_ETH) += ethernet/renesas/
+ obj-$(CONFIG_STMMAC_ETH) += stmmac/
+
+ #
+diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
+new file mode 100644
+index 0000000..df8940d
+--- /dev/null
++++ b/drivers/net/ethernet/Kconfig
+@@ -0,0 +1,164 @@
++#
++# Ethernet LAN device configuration
++#
++
++menuconfig ETHERNET
++ bool "Ethernet driver support"
++ depends on NET
++ default y
++ ---help---
++ This section contains all the Ethernet device drivers.
++
++if ETHERNET
++
++source "drivers/net/ethernet/3com/Kconfig"
++source "drivers/net/ethernet/adaptec/Kconfig"
++source "drivers/net/ethernet/aeroflex/Kconfig"
++source "drivers/net/ethernet/amd/Kconfig"
++source "drivers/net/ethernet/apple/Kconfig"
++source "drivers/net/ethernet/atheros/Kconfig"
++source "drivers/net/ethernet/cadence/Kconfig"
++source "drivers/net/ethernet/adi/Kconfig"
++source "drivers/net/ethernet/broadcom/Kconfig"
++source "drivers/net/ethernet/brocade/Kconfig"
++source "drivers/net/ethernet/chelsio/Kconfig"
++source "drivers/net/ethernet/cirrus/Kconfig"
++source "drivers/net/ethernet/cisco/Kconfig"
++source "drivers/net/ethernet/davicom/Kconfig"
++
++config DNET
++ tristate "Dave ethernet support (DNET)"
++ depends on HAS_IOMEM
++ select PHYLIB
++ ---help---
++ The Dave ethernet interface (DNET) is found on Qong Board FPGA.
++ Say Y to include support for the DNET chip.
++
++ To compile this driver as a module, choose M here: the module
++ will be called dnet.
++
++source "drivers/net/ethernet/dec/Kconfig"
++source "drivers/net/ethernet/dlink/Kconfig"
++source "drivers/net/ethernet/emulex/Kconfig"
++source "drivers/net/ethernet/neterion/Kconfig"
++source "drivers/net/ethernet/faraday/Kconfig"
++source "drivers/net/ethernet/freescale/Kconfig"
++source "drivers/net/ethernet/fujitsu/Kconfig"
++source "drivers/net/ethernet/hp/Kconfig"
++source "drivers/net/ethernet/ibm/Kconfig"
++source "drivers/net/ethernet/intel/Kconfig"
++source "drivers/net/ethernet/i825xx/Kconfig"
++source "drivers/net/ethernet/xscale/Kconfig"
++source "drivers/net/ethernet/icplus/Kconfig"
++
++config JME
++ tristate "JMicron(R) PCI-Express Gigabit Ethernet support"
++ depends on PCI
++ select CRC32
++ select MII
++ ---help---
++ This driver supports the PCI-Express gigabit ethernet adapters
++ based on JMicron JMC250 chipset.
++
++ To compile this driver as a module, choose M here. The module
++ will be called jme.
++
++config KORINA
++ tristate "Korina (IDT RC32434) Ethernet support"
++ depends on MIKROTIK_RB532
++ ---help---
++ If you have a Mikrotik RouterBoard 500 or IDT RC32434
++ based system say Y. Otherwise say N.
++
++config LANTIQ_ETOP
++ tristate "Lantiq SoC ETOP driver"
++ depends on SOC_TYPE_XWAY
++ ---help---
++ Support for the MII0 inside the Lantiq SoC
++
++source "drivers/net/ethernet/marvell/Kconfig"
++source "drivers/net/ethernet/mellanox/Kconfig"
++source "drivers/net/ethernet/micrel/Kconfig"
++source "drivers/net/ethernet/microchip/Kconfig"
++
++config MIPS_SIM_NET
++ tristate "MIPS simulator Network device"
++ depends on MIPS_SIM
++ ---help---
++ The MIPSNET device is a simple Ethernet network device which is
++ emulated by the MIPS Simulator.
++ If you are not using a MIPSsim or are unsure, say N.
++
++source "drivers/net/ethernet/myricom/Kconfig"
++
++config FEALNX
++ tristate "Myson MTD-8xx PCI Ethernet support"
++ depends on PCI
++ select CRC32
++ select MII
++ ---help---
++ Say Y here to support the Myson MTD-800 family of PCI-based Ethernet
++ cards. <http://www.myson.com.tw/>
++
++source "drivers/net/ethernet/natsemi/Kconfig"
++source "drivers/net/ethernet/8390/Kconfig"
++
++config NET_NETX
++ tristate "NetX Ethernet support"
++ select MII
++ depends on ARCH_NETX
++ ---help---
++ This is support for the Hilscher netX builtin Ethernet ports
++
++ To compile this driver as a module, choose M here. The module
++ will be called netx-eth.
++
++source "drivers/net/ethernet/nuvoton/Kconfig"
++source "drivers/net/ethernet/nvidia/Kconfig"
++source "drivers/net/ethernet/octeon/Kconfig"
++source "drivers/net/ethernet/oki-semi/Kconfig"
++
++config ETHOC
++ tristate "OpenCores 10/100 Mbps Ethernet MAC support"
++ depends on HAS_IOMEM && HAS_DMA
++ select MII
++ select PHYLIB
++ select CRC32
++ select BITREVERSE
++ ---help---
++ Say Y here if you want to use the OpenCores 10/100 Mbps Ethernet MAC.
++
++source "drivers/net/ethernet/packetengines/Kconfig"
++source "drivers/net/ethernet/pasemi/Kconfig"
++source "drivers/net/ethernet/qlogic/Kconfig"
++source "drivers/net/ethernet/racal/Kconfig"
++source "drivers/net/ethernet/realtek/Kconfig"
++source "drivers/net/ethernet/renesas/Kconfig"
++source "drivers/net/ethernet/rdc/Kconfig"
++
++config S6GMAC
++ tristate "S6105 GMAC ethernet support"
++ depends on XTENSA_VARIANT_S6000
++ select PHYLIB
++ ---help---
++ This driver supports the on chip ethernet device on the
++ S6105 xtensa processor.
++
++ To compile this driver as a module, choose M here. The module
++ will be called s6gmac.
++
++source "drivers/net/ethernet/seeq/Kconfig"
++source "drivers/net/ethernet/sis/Kconfig"
++source "drivers/net/ethernet/sfc/Kconfig"
++source "drivers/net/ethernet/sgi/Kconfig"
++source "drivers/net/ethernet/smsc/Kconfig"
++source "drivers/net/ethernet/stmicro/Kconfig"
++source "drivers/net/ethernet/sun/Kconfig"
++source "drivers/net/ethernet/tehuti/Kconfig"
++source "drivers/net/ethernet/ti/Kconfig"
++source "drivers/net/ethernet/toshiba/Kconfig"
++source "drivers/net/ethernet/tundra/Kconfig"
++source "drivers/net/ethernet/via/Kconfig"
++source "drivers/net/ethernet/xilinx/Kconfig"
++
++endif # ETHERNET
+diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig
+new file mode 100644
+index 0000000..f57ae23
+--- /dev/null
++++ b/drivers/net/ethernet/renesas/Kconfig
+@@ -0,0 +1,18 @@
++#
++# Renesas device configuration
++#
++
++config SH_ETH
++ tristate "Renesas SuperH Ethernet support"
++ depends on SUPERH && \
++ (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \
++ CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \
++ CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7757)
++ select CRC32
++ select MII
++ select MDIO_BITBANG
++ select PHYLIB
++ ---help---
++ Renesas SuperH Ethernet device driver.
++ This driver supporting CPUs are:
++ - SH7710, SH7712, SH7763, SH7619, SH7724, and SH7757.
+diff --git a/drivers/net/ethernet/renesas/Makefile b/drivers/net/ethernet/renesas/Makefile
+new file mode 100644
+index 0000000..1c278a8
+--- /dev/null
++++ b/drivers/net/ethernet/renesas/Makefile
+@@ -0,0 +1,5 @@
++#
++# Makefile for the Renesas device drivers.
++#
++
++obj-$(CONFIG_SH_ETH) += sh_eth.o
+diff --git a/drivers/net/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+similarity index 100%
+rename from drivers/net/sh_eth.c
+rename to drivers/net/ethernet/renesas/sh_eth.c
+diff --git a/drivers/net/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+similarity index 100%
+rename from drivers/net/sh_eth.h
+rename to drivers/net/ethernet/renesas/sh_eth.h
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0070-net-sh_eth-Fix-build-by-forgot-including-linux-inter.patch b/patches.armadillo800eva/0070-net-sh_eth-Fix-build-by-forgot-including-linux-inter.patch
new file mode 100644
index 00000000000000..c3165737c33120
--- /dev/null
+++ b/patches.armadillo800eva/0070-net-sh_eth-Fix-build-by-forgot-including-linux-inter.patch
@@ -0,0 +1,43 @@
+From 3eb257177788daf38fe43663ca9b96556138f973 Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Tue, 9 Aug 2011 20:15:50 +0000
+Subject: net: sh_eth: Fix build by forgot including linux/interrupt.h
+
+By a6b7a407865aab9f849dd99a71072b7cd1175116, remove interrupt.h
+from netdevice.h. But this forget to revise sh_eth.
+
+This fix the build failure.
+
+error: expected '=', ',', ';', 'asm' or '__attribute__' before 'sh_eth_interrupt'
+error: implicit declaration of function 'request_irq'
+error: 'sh_eth_interrupt' undeclared (first use in this function)
+error: (Each undeclared identifier is reported only once
+ drivers/net/sh_eth.c:1386: error: for each function it appears in.)
+error: 'IRQF_SHARED' undeclared (first use in this function)
+error: implicit declaration of function 'free_irq'
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+CC: Alexey Dobriyan <adobriyan@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 6a27cdeddf48858089e3672f844615cbf0877ebf)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index ad35c21..190f619 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -21,6 +21,7 @@
+ */
+
+ #include <linux/init.h>
++#include <linux/interrupt.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/etherdevice.h>
+ #include <linux/delay.h>
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0071-net-remove-use-of-ndo_set_multicast_list-in-drivers.patch b/patches.armadillo800eva/0071-net-remove-use-of-ndo_set_multicast_list-in-drivers.patch
new file mode 100644
index 00000000000000..560bf1334cb957
--- /dev/null
+++ b/patches.armadillo800eva/0071-net-remove-use-of-ndo_set_multicast_list-in-drivers.patch
@@ -0,0 +1,283 @@
+From 69db4921cc9c0997a22f4815c552235a0de0bd2a Mon Sep 17 00:00:00 2001
+From: Jiri Pirko <jpirko@redhat.com>
+Date: Tue, 16 Aug 2011 06:29:01 +0000
+Subject: net: remove use of ndo_set_multicast_list in drivers
+
+replace it by ndo_set_rx_mode
+
+Signed-off-by: Jiri Pirko <jpirko@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from afc4b13df143122f99a0eb10bfefb216c2806de0)
+
+ arch/ia64/hp/sim/simeth.c
+ arch/um/drivers/net_kern.c
+ arch/xtensa/platforms/iss/network.c
+ drivers/infiniband/hw/nes/nes_nic.c
+ drivers/infiniband/ulp/ipoib/ipoib_main.c
+ drivers/media/dvb/dvb-core/dvb_net.c
+ drivers/net/appletalk/cops.c
+ drivers/net/appletalk/ltpc.c
+ drivers/net/arcnet/com20020.c
+ drivers/net/bonding/bond_main.c
+ drivers/net/cris/eth_v10.c
+ drivers/net/defxx.c
+ drivers/net/dummy.c
+ drivers/net/ethernet/3com/3c501.c
+ drivers/net/ethernet/3com/3c509.c
+ drivers/net/ethernet/3com/3c515.c
+ drivers/net/ethernet/3com/3c574_cs.c
+ drivers/net/ethernet/3com/3c589_cs.c
+ drivers/net/ethernet/3com/3c59x.c
+ drivers/net/ethernet/3com/typhoon.c
+ drivers/net/ethernet/8390/3c503.c
+ drivers/net/ethernet/8390/8390.c
+ drivers/net/ethernet/8390/8390p.c
+ drivers/net/ethernet/8390/ac3200.c
+ drivers/net/ethernet/8390/ax88796.c
+ drivers/net/ethernet/8390/axnet_cs.c
+ drivers/net/ethernet/8390/e2100.c
+ drivers/net/ethernet/8390/etherh.c
+ drivers/net/ethernet/8390/hp-plus.c
+ drivers/net/ethernet/8390/hydra.c
+ drivers/net/ethernet/8390/mac8390.c
+ drivers/net/ethernet/8390/ne-h8300.c
+ drivers/net/ethernet/8390/ne2k-pci.c
+ drivers/net/ethernet/8390/pcnet_cs.c
+ drivers/net/ethernet/8390/smc-mca.c
+ drivers/net/ethernet/8390/smc-ultra.c
+ drivers/net/ethernet/8390/smc-ultra32.c
+ drivers/net/ethernet/8390/wd.c
+ drivers/net/ethernet/8390/zorro8390.c
+ drivers/net/ethernet/adaptec/starfire.c
+ drivers/net/ethernet/adi/bfin_mac.c
+ drivers/net/ethernet/aeroflex/greth.c
+ drivers/net/ethernet/alteon/acenic.c
+ drivers/net/ethernet/amd/a2065.c
+ drivers/net/ethernet/amd/am79c961a.c
+ drivers/net/ethernet/amd/amd8111e.c
+ drivers/net/ethernet/amd/ariadne.c
+ drivers/net/ethernet/amd/atarilance.c
+ drivers/net/ethernet/amd/au1000_eth.c
+ drivers/net/ethernet/amd/declance.c
+ drivers/net/ethernet/amd/depca.c
+ drivers/net/ethernet/amd/hplance.c
+ drivers/net/ethernet/amd/lance.c
+ drivers/net/ethernet/amd/mvme147.c
+ drivers/net/ethernet/amd/ni65.c
+ drivers/net/ethernet/amd/nmclan_cs.c
+ drivers/net/ethernet/amd/pcnet32.c
+ drivers/net/ethernet/amd/sun3lance.c
+ drivers/net/ethernet/amd/sunlance.c
+ drivers/net/ethernet/apple/bmac.c
+ drivers/net/ethernet/apple/cs89x0.c
+ drivers/net/ethernet/apple/mac89x0.c
+ drivers/net/ethernet/apple/mace.c
+ drivers/net/ethernet/apple/macmace.c
+ drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+ drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+ drivers/net/ethernet/atheros/atlx/atl1.c
+ drivers/net/ethernet/atheros/atlx/atl2.c
+ drivers/net/ethernet/broadcom/b44.c
+ drivers/net/ethernet/broadcom/bcm63xx_enet.c
+ drivers/net/ethernet/broadcom/sb1250-mac.c
+ drivers/net/ethernet/broadcom/tg3.c
+ drivers/net/ethernet/brocade/bna/bnad.c
+ drivers/net/ethernet/cadence/at91_ether.c
+ drivers/net/ethernet/cadence/macb.c
+ drivers/net/ethernet/chelsio/cxgb/cxgb2.c
+ drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+ drivers/net/ethernet/cisco/enic/enic_main.c
+ drivers/net/ethernet/davicom/dm9000.c
+ drivers/net/ethernet/dec/ewrk3.c
+ drivers/net/ethernet/dec/tulip/de2104x.c
+ drivers/net/ethernet/dec/tulip/de4x5.c
+ drivers/net/ethernet/dec/tulip/dmfe.c
+ drivers/net/ethernet/dec/tulip/tulip_core.c
+ drivers/net/ethernet/dec/tulip/uli526x.c
+ drivers/net/ethernet/dec/tulip/winbond-840.c
+ drivers/net/ethernet/dlink/de620.c
+ drivers/net/ethernet/dlink/dl2k.c
+ drivers/net/ethernet/dlink/sundance.c
+ drivers/net/ethernet/ethoc.c
+ drivers/net/ethernet/fealnx.c
+ drivers/net/ethernet/freescale/fec.c
+ drivers/net/ethernet/freescale/fec_mpc52xx.c
+ .../net/ethernet/freescale/fs_enet/fs_enet-main.c
+ drivers/net/ethernet/freescale/gianfar.c
+ drivers/net/ethernet/freescale/ucc_geth.c
+ drivers/net/ethernet/fujitsu/at1700.c
+ drivers/net/ethernet/fujitsu/eth16i.c
+ drivers/net/ethernet/fujitsu/fmvj18x_cs.c
+ drivers/net/ethernet/hp/hp100.c
+ drivers/net/ethernet/i825xx/3c505.c
+ drivers/net/ethernet/i825xx/3c523.c
+ drivers/net/ethernet/i825xx/3c527.c
+ drivers/net/ethernet/i825xx/82596.c
+ drivers/net/ethernet/i825xx/eepro.c
+ drivers/net/ethernet/i825xx/eexpress.c
+ drivers/net/ethernet/i825xx/ether1.c
+ drivers/net/ethernet/i825xx/lib82596.c
+ drivers/net/ethernet/i825xx/lp486e.c
+ drivers/net/ethernet/i825xx/ni52.c
+ drivers/net/ethernet/i825xx/sun3_82586.c
+ drivers/net/ethernet/i825xx/znet.c
+ drivers/net/ethernet/ibm/ehea/ehea_main.c
+ drivers/net/ethernet/ibm/emac/core.c
+ drivers/net/ethernet/ibm/ibmveth.c
+ drivers/net/ethernet/ibm/iseries_veth.c
+ drivers/net/ethernet/icplus/ipg.c
+ drivers/net/ethernet/intel/e100.c
+ drivers/net/ethernet/intel/e1000e/netdev.c
+ drivers/net/ethernet/intel/igb/igb_main.c
+ drivers/net/ethernet/intel/igbvf/netdev.c
+ drivers/net/ethernet/intel/ixgb/ixgb_main.c
+ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+ drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+ drivers/net/ethernet/jme.c
+ drivers/net/ethernet/korina.c
+ drivers/net/ethernet/lantiq_etop.c
+ drivers/net/ethernet/marvell/skge.c
+ drivers/net/ethernet/marvell/sky2.c
+ drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+ drivers/net/ethernet/micrel/ks8695net.c
+ drivers/net/ethernet/microchip/enc28j60.c
+ drivers/net/ethernet/mipsnet.c
+ drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+ drivers/net/ethernet/natsemi/ibmlana.c
+ drivers/net/ethernet/natsemi/jazzsonic.c
+ drivers/net/ethernet/natsemi/macsonic.c
+ drivers/net/ethernet/natsemi/natsemi.c
+ drivers/net/ethernet/natsemi/ns83820.c
+ drivers/net/ethernet/natsemi/xtsonic.c
+ drivers/net/ethernet/neterion/s2io.c
+ drivers/net/ethernet/neterion/vxge/vxge-main.c
+ drivers/net/ethernet/netx-eth.c
+ drivers/net/ethernet/nuvoton/w90p910_ether.c
+ drivers/net/ethernet/nvidia/forcedeth.c
+ drivers/net/ethernet/octeon/octeon_mgmt.c
+ drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+ drivers/net/ethernet/packetengines/hamachi.c
+ drivers/net/ethernet/packetengines/yellowfin.c
+ drivers/net/ethernet/pasemi/pasemi_mac.c
+ drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+ drivers/net/ethernet/qlogic/qla3xxx.c
+ drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+ drivers/net/ethernet/qlogic/qlge/qlge_main.c
+ drivers/net/ethernet/racal/ni5010.c
+ drivers/net/ethernet/rdc/r6040.c
+ drivers/net/ethernet/realtek/8139cp.c
+ drivers/net/ethernet/realtek/8139too.c
+ drivers/net/ethernet/realtek/atp.c
+ drivers/net/ethernet/realtek/r8169.c
+ drivers/net/ethernet/realtek/sc92031.c
+ drivers/net/ethernet/seeq/ether3.c
+ drivers/net/ethernet/seeq/seeq8005.c
+ drivers/net/ethernet/seeq/sgiseeq.c
+ drivers/net/ethernet/sfc/efx.c
+ drivers/net/ethernet/sgi/ioc3-eth.c
+ drivers/net/ethernet/sis/sis190.c
+ drivers/net/ethernet/sis/sis900.c
+ drivers/net/ethernet/smsc/epic100.c
+ drivers/net/ethernet/smsc/smc911x.c
+ drivers/net/ethernet/smsc/smc9194.c
+ drivers/net/ethernet/smsc/smc91c92_cs.c
+ drivers/net/ethernet/smsc/smc91x.c
+ drivers/net/ethernet/smsc/smsc911x.c
+ drivers/net/ethernet/smsc/smsc9420.c
+ drivers/net/ethernet/sun/cassini.c
+ drivers/net/ethernet/sun/sunbmac.c
+ drivers/net/ethernet/sun/sungem.c
+ drivers/net/ethernet/sun/sunhme.c
+ drivers/net/ethernet/sun/sunqe.c
+ drivers/net/ethernet/sun/sunvnet.c
+ drivers/net/ethernet/tehuti/tehuti.c
+ drivers/net/ethernet/ti/cpmac.c
+ drivers/net/ethernet/ti/davinci_emac.c
+ drivers/net/ethernet/ti/tlan.c
+ drivers/net/ethernet/toshiba/ps3_gelic_net.c
+ drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
+ drivers/net/ethernet/toshiba/spider_net.c
+ drivers/net/ethernet/toshiba/tc35815.c
+ drivers/net/ethernet/tundra/tsi108_eth.c
+ drivers/net/ethernet/via/via-rhine.c
+ drivers/net/ethernet/via/via-velocity.c
+ drivers/net/ethernet/xilinx/ll_temac_main.c
+ drivers/net/ethernet/xircom/xirc2ps_cs.c
+ drivers/net/ethernet/xscale/ixp4xx_eth.c
+ drivers/net/macvlan.c
+ drivers/net/skfp/skfddi.c
+ drivers/net/tokenring/3c359.c
+ drivers/net/tokenring/ibmtr.c
+ drivers/net/tokenring/lanstreamer.c
+ drivers/net/tokenring/olympic.c
+ drivers/net/tokenring/smctr.c
+ drivers/net/tokenring/tms380tr.c
+ drivers/net/tun.c
+ drivers/net/usb/asix.c
+ drivers/net/usb/catc.c
+ drivers/net/usb/dm9601.c
+ drivers/net/usb/int51x1.c
+ drivers/net/usb/kaweth.c
+ drivers/net/usb/mcs7830.c
+ drivers/net/usb/pegasus.c
+ drivers/net/usb/rtl8150.c
+ drivers/net/usb/smsc75xx.c
+ drivers/net/usb/smsc95xx.c
+ drivers/net/vmxnet3/vmxnet3_drv.c
+ drivers/net/wan/sbni.c
+ drivers/net/wireless/airo.c
+ drivers/net/wireless/hostap/hostap_main.c
+ drivers/net/wireless/ipw2x00/ipw2200.c
+ drivers/net/wireless/libertas/main.c
+ drivers/net/wireless/libertas/mesh.c
+ drivers/net/wireless/mwifiex/main.c
+ drivers/net/wireless/orinoco/main.c
+ drivers/net/wireless/orinoco/orinoco_usb.c
+ drivers/net/wireless/ray_cs.c
+ drivers/net/wireless/rndis_wlan.c
+ drivers/net/wireless/zd1201.c
+ drivers/s390/net/lcs.c
+ drivers/s390/net/qeth_l2_main.c
+ drivers/s390/net/qeth_l3_main.c
+ drivers/staging/ath6kl/os/linux/ar6000_drv.c
+ drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+ drivers/staging/et131x/et131x_netdev.c
+ drivers/staging/hv/netvsc_drv.c
+ drivers/staging/octeon/ethernet.c
+ drivers/staging/rtl8187se/r8180_core.c
+ drivers/staging/rtl8192e/r8192E_core.c
+ drivers/staging/rtl8192u/r8192U_core.c
+ drivers/staging/slicoss/slicoss.c
+ drivers/staging/vt6655/device_main.c
+ drivers/staging/vt6656/main_usb.c
+ drivers/staging/wlags49_h2/wl_netdev.c
+ drivers/staging/wlan-ng/p80211netdev.c
+ net/8021q/vlan_dev.c
+ net/atm/lec.c
+ net/bluetooth/bnep/netdev.c
+ net/bridge/br_device.c
+ net/dsa/slave.c
+ net/irda/irlan/irlan_eth.c
+ net/mac80211/iface.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 190f619..bf2404a 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1759,7 +1759,7 @@ static const struct net_device_ops sh_eth_netdev_ops = {
+ .ndo_start_xmit = sh_eth_start_xmit,
+ .ndo_get_stats = sh_eth_get_stats,
+ #if defined(SH_ETH_HAS_TSU)
+- .ndo_set_multicast_list = sh_eth_set_multicast_list,
++ .ndo_set_rx_mode = sh_eth_set_multicast_list,
+ #endif
+ .ndo_tx_timeout = sh_eth_tx_timeout,
+ .ndo_do_ioctl = sh_eth_do_ioctl,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0072-net-sh_eth-fix-the-compile-error.patch b/patches.armadillo800eva/0072-net-sh_eth-fix-the-compile-error.patch
new file mode 100644
index 00000000000000..c591b17b57c343
--- /dev/null
+++ b/patches.armadillo800eva/0072-net-sh_eth-fix-the-compile-error.patch
@@ -0,0 +1,45 @@
+From 28e67372504cee9f9ed9356081c9408df9492325 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Mon, 22 Aug 2011 23:26:33 +0000
+Subject: net: sh_eth: fix the compile error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fix the following build error:
+
+ CC drivers/net/sh_eth.o
+drivers/net/sh_eth.c:1115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘sh_eth_interrupt’
+drivers/net/sh_eth.c: In function ‘sh_eth_open’:
+drivers/net/sh_eth.c:1387: error: implicit declaration of function ‘request_irq’
+drivers/net/sh_eth.c:1387: error: ‘sh_eth_interrupt’ undeclared (first use in this function)
+drivers/net/sh_eth.c:1387: error: (Each undeclared identifier is reported only once
+drivers/net/sh_eth.c:1387: error: for each function it appears in.)
+drivers/net/sh_eth.c:1391: error: ‘IRQF_SHARED’ undeclared (first use in this function)
+drivers/net/sh_eth.c:1424: error: implicit declaration of function ‘free_irq’
+make[2]: *** [drivers/net/sh_eth.o] Error 1
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 69558eeeaba7d79364bb9ac4743dc1ad209508b7)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index bf2404a..4479a45 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -31,6 +31,7 @@
+ #include <linux/phy.h>
+ #include <linux/cache.h>
+ #include <linux/io.h>
++#include <linux/interrupt.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/slab.h>
+ #include <linux/ethtool.h>
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0073-net-sh_eth-use-ioremap.patch b/patches.armadillo800eva/0073-net-sh_eth-use-ioremap.patch
new file mode 100644
index 00000000000000..8753f1d06d69e6
--- /dev/null
+++ b/patches.armadillo800eva/0073-net-sh_eth-use-ioremap.patch
@@ -0,0 +1,172 @@
+From 5fd3f7efdf369ae6e886de441d342c9dc8b7f7ef Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Tue, 27 Sep 2011 21:48:58 +0000
+Subject: net: sh_eth: use ioremap()
+
+This patch also changes writel/readl to iowrite32/ioread32.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit ae70644df780c0e87f1705fda932e7cb1bdb2074)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 38 +++++++++++++++++++++------------
+ drivers/net/ethernet/renesas/sh_eth.h | 9 ++++----
+ 2 files changed, 29 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 4479a45..38ccda5 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -155,18 +155,18 @@ static void sh_eth_chip_reset_giga(struct net_device *ndev)
+
+ /* save MAHR and MALR */
+ for (i = 0; i < 2; i++) {
+- malr[i] = readl(GIGA_MALR(i));
+- mahr[i] = readl(GIGA_MAHR(i));
++ malr[i] = ioread32((void *)GIGA_MALR(i));
++ mahr[i] = ioread32((void *)GIGA_MAHR(i));
+ }
+
+ /* reset device */
+- writel(ARSTR_ARSTR, SH_GIGA_ETH_BASE + 0x1800);
++ iowrite32(ARSTR_ARSTR, (void *)(SH_GIGA_ETH_BASE + 0x1800));
+ mdelay(1);
+
+ /* restore MAHR and MALR */
+ for (i = 0; i < 2; i++) {
+- writel(malr[i], GIGA_MALR(i));
+- writel(mahr[i], GIGA_MAHR(i));
++ iowrite32(malr[i], (void *)GIGA_MALR(i));
++ iowrite32(mahr[i], (void *)GIGA_MAHR(i));
+ }
+ }
+
+@@ -515,9 +515,9 @@ static unsigned long sh_eth_get_edtrr_trns(struct sh_eth_private *mdp)
+ }
+
+ struct bb_info {
+- void (*set_gate)(unsigned long addr);
++ void (*set_gate)(void *addr);
+ struct mdiobb_ctrl ctrl;
+- u32 addr;
++ void *addr;
+ u32 mmd_msk;/* MMD */
+ u32 mdo_msk;
+ u32 mdi_msk;
+@@ -525,21 +525,21 @@ struct bb_info {
+ };
+
+ /* PHY bit set */
+-static void bb_set(u32 addr, u32 msk)
++static void bb_set(void *addr, u32 msk)
+ {
+- writel(readl(addr) | msk, addr);
++ iowrite32(ioread32(addr) | msk, addr);
+ }
+
+ /* PHY bit clear */
+-static void bb_clr(u32 addr, u32 msk)
++static void bb_clr(void *addr, u32 msk)
+ {
+- writel((readl(addr) & ~msk), addr);
++ iowrite32((ioread32(addr) & ~msk), addr);
+ }
+
+ /* PHY bit read */
+-static int bb_read(u32 addr, u32 msk)
++static int bb_read(void *addr, u32 msk)
+ {
+- return (readl(addr) & msk) != 0;
++ return (ioread32(addr) & msk) != 0;
+ }
+
+ /* Data I/O pin control */
+@@ -1680,7 +1680,7 @@ static int sh_mdio_init(struct net_device *ndev, int id,
+ }
+
+ /* bitbang init */
+- bitbang->addr = ndev->base_addr + mdp->reg_offset[PIR];
++ bitbang->addr = mdp->addr + mdp->reg_offset[PIR];
+ bitbang->set_gate = pd->set_mdio_gate;
+ bitbang->mdi_msk = 0x08;
+ bitbang->mdo_msk = 0x04;
+@@ -1812,6 +1812,13 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
+ ether_setup(ndev);
+
+ mdp = netdev_priv(ndev);
++ mdp->addr = ioremap(res->start, resource_size(res));
++ if (mdp->addr == NULL) {
++ ret = -ENOMEM;
++ dev_err(&pdev->dev, "ioremap failed.\n");
++ goto out_release;
++ }
++
+ spin_lock_init(&mdp->lock);
+ mdp->pdev = pdev;
+ pm_runtime_enable(&pdev->dev);
+@@ -1892,6 +1899,8 @@ out_unregister:
+
+ out_release:
+ /* net_dev free */
++ if (mdp && mdp->addr)
++ iounmap(mdp->addr);
+ if (mdp && mdp->tsu_addr)
+ iounmap(mdp->tsu_addr);
+ if (ndev)
+@@ -1910,6 +1919,7 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
+ sh_mdio_release(ndev);
+ unregister_netdev(ndev);
+ pm_runtime_disable(&pdev->dev);
++ iounmap(mdp->addr);
+ free_netdev(ndev);
+ platform_set_drvdata(pdev, NULL);
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+index c3048a6..78e586e 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.h
++++ b/drivers/net/ethernet/renesas/sh_eth.h
+@@ -762,6 +762,7 @@ struct sh_eth_private {
+ struct platform_device *pdev;
+ struct sh_eth_cpu_data *cd;
+ const u16 *reg_offset;
++ void __iomem *addr;
+ void __iomem *tsu_addr;
+ dma_addr_t rx_desc_dma;
+ dma_addr_t tx_desc_dma;
+@@ -811,7 +812,7 @@ static inline void sh_eth_write(struct net_device *ndev, unsigned long data,
+ {
+ struct sh_eth_private *mdp = netdev_priv(ndev);
+
+- writel(data, ndev->base_addr + mdp->reg_offset[enum_index]);
++ iowrite32(data, mdp->addr + mdp->reg_offset[enum_index]);
+ }
+
+ static inline unsigned long sh_eth_read(struct net_device *ndev,
+@@ -819,19 +820,19 @@ static inline unsigned long sh_eth_read(struct net_device *ndev,
+ {
+ struct sh_eth_private *mdp = netdev_priv(ndev);
+
+- return readl(ndev->base_addr + mdp->reg_offset[enum_index]);
++ return ioread32(mdp->addr + mdp->reg_offset[enum_index]);
+ }
+
+ static inline void sh_eth_tsu_write(struct sh_eth_private *mdp,
+ unsigned long data, int enum_index)
+ {
+- writel(data, mdp->tsu_addr + mdp->reg_offset[enum_index]);
++ iowrite32(data, mdp->tsu_addr + mdp->reg_offset[enum_index]);
+ }
+
+ static inline unsigned long sh_eth_tsu_read(struct sh_eth_private *mdp,
+ int enum_index)
+ {
+- return readl(mdp->tsu_addr + mdp->reg_offset[enum_index]);
++ return ioread32(mdp->tsu_addr + mdp->reg_offset[enum_index]);
+ }
+
+ #endif /* #ifndef __SH_ETH_H__ */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0074-sh-modify-prototype-in-sh_eth.h.patch b/patches.armadillo800eva/0074-sh-modify-prototype-in-sh_eth.h.patch
new file mode 100644
index 00000000000000..21052ddf30d44e
--- /dev/null
+++ b/patches.armadillo800eva/0074-sh-modify-prototype-in-sh_eth.h.patch
@@ -0,0 +1,30 @@
+From e3801d21072f471de604508fb6a62ceec50152cf Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Tue, 27 Sep 2011 21:49:05 +0000
+Subject: sh: modify prototype in sh_eth.h
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 8eac3f60acad6e05a938a3d5feef01cb367bde4a)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/sh/include/asm/sh_eth.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/sh/include/asm/sh_eth.h b/arch/sh/include/asm/sh_eth.h
+index 0f325da..2076acf 100644
+--- a/arch/sh/include/asm/sh_eth.h
++++ b/arch/sh/include/asm/sh_eth.h
+@@ -15,7 +15,7 @@ struct sh_eth_plat_data {
+ int edmac_endian;
+ int register_type;
+ phy_interface_t phy_interface;
+- void (*set_mdio_gate)(unsigned long addr);
++ void (*set_mdio_gate)(void *addr);
+
+ unsigned char mac_addr[6];
+ unsigned no_ether_link:1;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0075-net-sh_eth-move-the-asm-sh_eth.h-to-include-linux.patch b/patches.armadillo800eva/0075-net-sh_eth-move-the-asm-sh_eth.h-to-include-linux.patch
new file mode 100644
index 00000000000000..bfa649b8669054
--- /dev/null
+++ b/patches.armadillo800eva/0075-net-sh_eth-move-the-asm-sh_eth.h-to-include-linux.patch
@@ -0,0 +1,55 @@
+From f4685e7e984fd49d5d4b5099aa0d02452f39cda3 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Tue, 27 Sep 2011 21:49:12 +0000
+Subject: net: sh_eth: move the asm/sh_eth.h to include/linux/
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit d4fa0e35fdbd54acf791fa3793d6d17f7795f7ae)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 1 +
+ drivers/net/ethernet/renesas/sh_eth.h | 8 --------
+ {arch/sh/include/asm => include/linux}/sh_eth.h | 0
+ 3 files changed, 1 insertion(+), 8 deletions(-)
+ rename {arch/sh/include/asm => include/linux}/sh_eth.h (100%)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 38ccda5..6aa0704 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -35,6 +35,7 @@
+ #include <linux/pm_runtime.h>
+ #include <linux/slab.h>
+ #include <linux/ethtool.h>
++#include <linux/sh_eth.h>
+
+ #include "sh_eth.h"
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+index 78e586e..47877b1 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.h
++++ b/drivers/net/ethernet/renesas/sh_eth.h
+@@ -23,14 +23,6 @@
+ #ifndef __SH_ETH_H__
+ #define __SH_ETH_H__
+
+-#include <linux/module.h>
+-#include <linux/kernel.h>
+-#include <linux/spinlock.h>
+-#include <linux/netdevice.h>
+-#include <linux/phy.h>
+-
+-#include <asm/sh_eth.h>
+-
+ #define CARDNAME "sh-eth"
+ #define TX_TIMEOUT (5*HZ)
+ #define TX_RING_SIZE 64 /* Tx ring size */
+diff --git a/arch/sh/include/asm/sh_eth.h b/include/linux/sh_eth.h
+similarity index 100%
+rename from arch/sh/include/asm/sh_eth.h
+rename to include/linux/sh_eth.h
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0076-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-some.patch b/patches.armadillo800eva/0076-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-some.patch
new file mode 100644
index 00000000000000..a59dd8265fa6ec
--- /dev/null
+++ b/patches.armadillo800eva/0076-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-some.patch
@@ -0,0 +1,86 @@
+From 9503ab0bc933df9d4ca43f2f89c4a30735a5537b Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 28 Sep 2011 16:49:14 +0900
+Subject: sh: modify the asm/sh_eth.h to linux/sh_eth.h in some boards
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit cf8e56bf5b60dba5ba11db83ca7f1df884e568e5)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/sh/boards/board-espt.c | 2 +-
+ arch/sh/boards/mach-ecovec24/setup.c | 2 +-
+ arch/sh/boards/mach-se/7724/setup.c | 2 +-
+ arch/sh/boards/mach-sh7763rdp/setup.c | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/arch/sh/boards/board-espt.c b/arch/sh/boards/board-espt.c
+index 9da92ac..b3ae9d3 100644
+--- a/arch/sh/boards/board-espt.c
++++ b/arch/sh/boards/board-espt.c
+@@ -13,9 +13,9 @@
+ #include <linux/interrupt.h>
+ #include <linux/mtd/physmap.h>
+ #include <linux/io.h>
++#include <linux/sh_eth.h>
+ #include <asm/machvec.h>
+ #include <asm/sizes.h>
+-#include <asm/sh_eth.h>
+
+ /* NOR Flash */
+ static struct mtd_partition espt_nor_flash_partitions[] = {
+diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
+index 513cb1a..4fd83c4 100644
+--- a/arch/sh/boards/mach-ecovec24/setup.c
++++ b/arch/sh/boards/mach-ecovec24/setup.c
+@@ -28,13 +28,13 @@
+ #include <linux/spi/mmc_spi.h>
+ #include <linux/input.h>
+ #include <linux/input/sh_keysc.h>
++#include <linux/sh_eth.h>
+ #include <video/sh_mobile_lcdc.h>
+ #include <sound/sh_fsi.h>
+ #include <media/sh_mobile_ceu.h>
+ #include <media/tw9910.h>
+ #include <media/mt9t112.h>
+ #include <asm/heartbeat.h>
+-#include <asm/sh_eth.h>
+ #include <asm/clock.h>
+ #include <asm/suspend.h>
+ #include <cpu/sh7724.h>
+diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
+index 1235767..631da7d 100644
+--- a/arch/sh/boards/mach-se/7724/setup.c
++++ b/arch/sh/boards/mach-se/7724/setup.c
+@@ -23,12 +23,12 @@
+ #include <linux/input.h>
+ #include <linux/input/sh_keysc.h>
+ #include <linux/usb/r8a66597.h>
++#include <linux/sh_eth.h>
+ #include <video/sh_mobile_lcdc.h>
+ #include <media/sh_mobile_ceu.h>
+ #include <sound/sh_fsi.h>
+ #include <asm/io.h>
+ #include <asm/heartbeat.h>
+-#include <asm/sh_eth.h>
+ #include <asm/clock.h>
+ #include <asm/suspend.h>
+ #include <cpu/sh7724.h>
+diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c b/arch/sh/boards/mach-sh7763rdp/setup.c
+index f3d828f..dd036f1 100644
+--- a/arch/sh/boards/mach-sh7763rdp/setup.c
++++ b/arch/sh/boards/mach-sh7763rdp/setup.c
+@@ -17,8 +17,8 @@
+ #include <linux/mtd/physmap.h>
+ #include <linux/fb.h>
+ #include <linux/io.h>
++#include <linux/sh_eth.h>
+ #include <mach/sh7763rdp.h>
+-#include <asm/sh_eth.h>
+ #include <asm/sh7760fb.h>
+
+ /* NOR Flash */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0077-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-sh77.patch b/patches.armadillo800eva/0077-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-sh77.patch
new file mode 100644
index 00000000000000..79db017293b504
--- /dev/null
+++ b/patches.armadillo800eva/0077-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-sh77.patch
@@ -0,0 +1,31 @@
+From 918b4fb00c28358daa5ff5263d552e591088cf0e Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Tue, 1 Nov 2011 14:54:38 +0900
+Subject: sh: modify the asm/sh_eth.h to linux/sh_eth.h in sh7757lcr
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 389cc10cbdde1a9225eac51318fb30e2039135ad)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/sh/boards/board-sh7757lcr.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
+index fa2a208..ec8c84c 100644
+--- a/arch/sh/boards/board-sh7757lcr.c
++++ b/arch/sh/boards/board-sh7757lcr.c
+@@ -18,8 +18,8 @@
+ #include <linux/mmc/host.h>
+ #include <linux/mmc/sh_mmcif.h>
+ #include <linux/mmc/sh_mobile_sdhi.h>
++#include <linux/sh_eth.h>
+ #include <cpu/sh7757.h>
+-#include <asm/sh_eth.h>
+ #include <asm/heartbeat.h>
+
+ static struct resource heartbeat_resource = {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0078-net-sh_eth-fix-build-failure.patch b/patches.armadillo800eva/0078-net-sh_eth-fix-build-failure.patch
new file mode 100644
index 00000000000000..09091d4940746a
--- /dev/null
+++ b/patches.armadillo800eva/0078-net-sh_eth-fix-build-failure.patch
@@ -0,0 +1,55 @@
+From cedc32557ee5304a1364df9e21e69848ac880861 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Thu, 29 Sep 2011 17:16:57 +0000
+Subject: net: sh_eth: fix build failure
+
+The following commit removed some including headers:
+ "net: sh_eth: move the asm/sh_eth.h to include/linux/"
+ (commit id: d4fa0e35fdbd54acf791fa3793d6d17f7795f7ae)
+
+Then, the build failure happened on the linux-next:
+
+drivers/net/ethernet/renesas/sh_eth.c:601: error: 'THIS_MODULE' undeclared here (not in a function)
+drivers/net/ethernet/renesas/sh_eth.c:1970: error: expected declaration specifiers or '...' before string constant
+drivers/net/ethernet/renesas/sh_eth.c:1970: warning: data definition has no type or storage class
+drivers/net/ethernet/renesas/sh_eth.c:1970: warning: type defaults to 'int' in declaration of 'MODULE_AUTHOR'
+drivers/net/ethernet/renesas/sh_eth.c:1970: warning: function declaration isn't a prototype
+drivers/net/ethernet/renesas/sh_eth.c:1971: error: expected declaration specifiers or '...' before string constant
+drivers/net/ethernet/renesas/sh_eth.c:1971: warning: data definition has no type or storage class
+drivers/net/ethernet/renesas/sh_eth.c:1971: warning: type defaults to 'int' in declaration of 'MODULE_DESCRIPTION'
+drivers/net/ethernet/renesas/sh_eth.c:1971: warning: function declaration isn't a prototype
+drivers/net/ethernet/renesas/sh_eth.c:1972: error: expected declaration specifiers or '...' before string constant
+drivers/net/ethernet/renesas/sh_eth.c:1972: warning: data definition has no type or storage class
+drivers/net/ethernet/renesas/sh_eth.c:1972: warning: type defaults to 'int' in declaration of 'MODULE_LICENSE'
+drivers/net/ethernet/renesas/sh_eth.c:1972: warning: function declaration isn't a prototype
+
+This patch fixes the issue. This patch also get back include/kernel.h
+and linux/spinlock.h.
+
+Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 0654011d900670884197d9a06ad17b378dfde831)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 6aa0704..9b23074 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -21,6 +21,9 @@
+ */
+
+ #include <linux/init.h>
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/spinlock.h>
+ #include <linux/interrupt.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/etherdevice.h>
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0079-net-ethernet-convert-drivers-net-ethernet-to-use-mod.patch b/patches.armadillo800eva/0079-net-ethernet-convert-drivers-net-ethernet-to-use-mod.patch
new file mode 100644
index 00000000000000..435ad6f6d20bdf
--- /dev/null
+++ b/patches.armadillo800eva/0079-net-ethernet-convert-drivers-net-ethernet-to-use-mod.patch
@@ -0,0 +1,101 @@
+From 1f6d3ca609bee2bd730ec3654e088d28f324af07 Mon Sep 17 00:00:00 2001
+From: Axel Lin <axel.lin@gmail.com>
+Date: Sun, 27 Nov 2011 16:44:17 +0000
+Subject: net/ethernet: convert drivers/net/ethernet/* to use
+ module_platform_driver()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This patch converts the drivers in drivers/net/ethernet/* to use the
+module_platform_driver() macro which makes the code smaller and a bit
+simpler.
+
+Cc: "David S. Miller" <davem@davemloft.net>
+Cc: Pantelis Antoniou <pantelis.antoniou@gmail.com>
+Cc: Vitaly Bordug <vbordug@ru.mvista.com>
+Cc: Wan ZongShun <mcuos.com@gmail.com>
+Cc: Nicolas Pitre <nico@fluxnic.net>
+Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+Cc: Marc Kleine-Budde <mkl@pengutronix.de>
+Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+Cc: Jiri Pirko <jpirko@redhat.com>
+Cc: Daniel Hellstrom <daniel@gaisler.com>
+Cc: Alexey Dobriyan <adobriyan@gmail.com>
+Cc: Tobias Klauser <tklauser@distanz.ch>
+Cc: Grant Likely <grant.likely@secretlab.ca>
+Cc: Jiri Kosina <jkosina@suse.cz>
+Cc: Richard Cochran <richard.cochran@omicron.at>
+Cc: Jonas Bonn <jonas@southpole.se>
+Cc: Sebastian Poehn <sebastian.poehn@belden.com>
+Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
+Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
+Signed-off-by: Axel Lin <axel.lin@gmail.com>
+Acked-by: Wan ZongShun <mcuos.com@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit db62f684deeb291ab2533b99843d5df9a36b1f19)
+
+ drivers/net/ethernet/8390/ax88796.c
+ drivers/net/ethernet/aeroflex/greth.c
+ drivers/net/ethernet/amd/au1000_eth.c
+ drivers/net/ethernet/amd/sunlance.c
+ drivers/net/ethernet/broadcom/sb1250-mac.c
+ drivers/net/ethernet/dnet.c
+ drivers/net/ethernet/ethoc.c
+ drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+ drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
+ drivers/net/ethernet/freescale/fs_enet/mii-fec.c
+ drivers/net/ethernet/freescale/fsl_pq_mdio.c
+ drivers/net/ethernet/freescale/gianfar.c
+ drivers/net/ethernet/freescale/gianfar_ptp.c
+ drivers/net/ethernet/korina.c
+ drivers/net/ethernet/marvell/pxa168_eth.c
+ drivers/net/ethernet/micrel/ks8842.c
+ drivers/net/ethernet/micrel/ks8851_mll.c
+ drivers/net/ethernet/natsemi/jazzsonic.c
+ drivers/net/ethernet/natsemi/macsonic.c
+ drivers/net/ethernet/natsemi/xtsonic.c
+ drivers/net/ethernet/nuvoton/w90p910_ether.c
+ drivers/net/ethernet/seeq/sgiseeq.c
+ drivers/net/ethernet/sgi/meth.c
+ drivers/net/ethernet/smsc/smc911x.c
+ drivers/net/ethernet/smsc/smc91x.c
+ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+ drivers/net/ethernet/sun/sunbmac.c
+ drivers/net/ethernet/tundra/tsi108_eth.c
+ drivers/net/ethernet/xilinx/ll_temac_main.c
+ drivers/net/ethernet/xilinx/xilinx_emaclite.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 13 +------------
+ 1 file changed, 1 insertion(+), 12 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 9b23074..ebfb682 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1957,18 +1957,7 @@ static struct platform_driver sh_eth_driver = {
+ },
+ };
+
+-static int __init sh_eth_init(void)
+-{
+- return platform_driver_register(&sh_eth_driver);
+-}
+-
+-static void __exit sh_eth_cleanup(void)
+-{
+- platform_driver_unregister(&sh_eth_driver);
+-}
+-
+-module_init(sh_eth_init);
+-module_exit(sh_eth_cleanup);
++module_platform_driver(sh_eth_driver);
+
+ MODULE_AUTHOR("Nobuhiro Iwamatsu, Yoshihiro Shimoda");
+ MODULE_DESCRIPTION("Renesas SuperH Ethernet driver");
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0080-net-make-ethtool_ops-const.patch b/patches.armadillo800eva/0080-net-make-ethtool_ops-const.patch
new file mode 100644
index 00000000000000..454117ad08f234
--- /dev/null
+++ b/patches.armadillo800eva/0080-net-make-ethtool_ops-const.patch
@@ -0,0 +1,49 @@
+From 039e8360c642702e9e06b707d15dacc1027ce559 Mon Sep 17 00:00:00 2001
+From: stephen hemminger <shemminger@vyatta.com>
+Date: Wed, 4 Jan 2012 12:59:49 +0000
+Subject: net: make ethtool_ops const
+
+Auditing all usage of ethtool_ops found several drivers that
+are not declaring the struct const when it should be.
+
+Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 9b07be4b2a78166bc54c8eedf18da8a8aafacfab)
+
+Conflicts:
+
+ drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+ drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+ drivers/net/ethernet/freescale/fec.c
+ drivers/net/ethernet/micrel/ksz884x.c
+ drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+
+Signed-off-by: Simon Horman <horms@verge.ent.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index ebfb682..fc9bda9 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1369,13 +1369,13 @@ static void sh_eth_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
+ }
+ }
+
+-static struct ethtool_ops sh_eth_ethtool_ops = {
++static const struct ethtool_ops sh_eth_ethtool_ops = {
+ .get_settings = sh_eth_get_settings,
+ .set_settings = sh_eth_set_settings,
+- .nway_reset = sh_eth_nway_reset,
++ .nway_reset = sh_eth_nway_reset,
+ .get_msglevel = sh_eth_get_msglevel,
+ .set_msglevel = sh_eth_set_msglevel,
+- .get_link = ethtool_op_get_link,
++ .get_link = ethtool_op_get_link,
+ .get_strings = sh_eth_get_strings,
+ .get_ethtool_stats = sh_eth_get_ethtool_stats,
+ .get_sset_count = sh_eth_get_sset_count,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0081-sh-eth-use-an-unique-MDIO-bus-name.patch b/patches.armadillo800eva/0081-sh-eth-use-an-unique-MDIO-bus-name.patch
new file mode 100644
index 00000000000000..7ac20cb3372012
--- /dev/null
+++ b/patches.armadillo800eva/0081-sh-eth-use-an-unique-MDIO-bus-name.patch
@@ -0,0 +1,31 @@
+From 95b8b9d5077a0ce33b4a7c5be721f4513b2aa975 Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <florian@openwrt.org>
+Date: Mon, 9 Jan 2012 23:59:17 +0000
+Subject: sh-eth: use an unique MDIO bus name.
+
+Signed-off-by: Florian Fainelli <florian@openwrt.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 5278fb547076ad6768d16c8b4df45c086470c163)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index fc9bda9..6ece429 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1702,7 +1702,8 @@ static int sh_mdio_init(struct net_device *ndev, int id,
+ /* Hook up MII support for ethtool */
+ mdp->mii_bus->name = "sh_mii";
+ mdp->mii_bus->parent = &ndev->dev;
+- snprintf(mdp->mii_bus->id, MII_BUS_ID_SIZE, "%x", id);
++ snprintf(mdp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
++ mdp->pdev->name, pdid);
+
+ /* PHY IRQ */
+ mdp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0082-net-sh-eth-Fix-build-error-by-the-value-which-is-not.patch b/patches.armadillo800eva/0082-net-sh-eth-Fix-build-error-by-the-value-which-is-not.patch
new file mode 100644
index 00000000000000..795bcaee5bfa65
--- /dev/null
+++ b/patches.armadillo800eva/0082-net-sh-eth-Fix-build-error-by-the-value-which-is-not.patch
@@ -0,0 +1,38 @@
+From 0c859269808e5372a6ef7239f18912dac0cca6c3 Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Mon, 16 Jan 2012 16:50:16 +0000
+Subject: net: sh-eth: Fix build error by the value which is not defined
+
+-----
+drivers/net/ethernet/renesas/sh_eth.c:1706: error: 'pdid' undeclared (first use in this function)
+drivers/net/ethernet/renesas/sh_eth.c:1706: error: (Each undeclared identifier is reported only once
+drivers/net/ethernet/renesas/sh_eth.c:1706: error: for each function it appears in.)
+make[5]: *** [drivers/net/ethernet/renesas/sh_eth.o] Error 1
+-----
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+CC: Florian Fainelli <florian@openwrt.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 34aa6f1400810890636ba0b170effbfa71eacec7)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 6ece429..813d41c 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1703,7 +1703,7 @@ static int sh_mdio_init(struct net_device *ndev, int id,
+ mdp->mii_bus->name = "sh_mii";
+ mdp->mii_bus->parent = &ndev->dev;
+ snprintf(mdp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
+- mdp->pdev->name, pdid);
++ mdp->pdev->name, id);
+
+ /* PHY IRQ */
+ mdp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0083-drivers-net-Remove-alloc_etherdev-error-messages.patch b/patches.armadillo800eva/0083-drivers-net-Remove-alloc_etherdev-error-messages.patch
new file mode 100644
index 00000000000000..e4565f5e6b36ca
--- /dev/null
+++ b/patches.armadillo800eva/0083-drivers-net-Remove-alloc_etherdev-error-messages.patch
@@ -0,0 +1,120 @@
+From 42aebb28332e0bdae20b449c6de19d9e363c40a3 Mon Sep 17 00:00:00 2001
+From: Joe Perches <joe@perches.com>
+Date: Sun, 29 Jan 2012 13:47:52 +0000
+Subject: drivers/net: Remove alloc_etherdev error messages
+
+alloc_etherdev has a generic OOM/unable to alloc message.
+Remove the duplicative messages after alloc_etherdev calls.
+
+Signed-off-by: Joe Perches <joe@perches.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 41de8d4cff21a2e81e3d9ff66f5f7c903f9c3ab1)
+
+Conflicts:
+
+ drivers/net/ethernet/3com/3c59x.c
+ drivers/net/ethernet/adaptec/starfire.c
+ drivers/net/ethernet/adi/bfin_mac.c
+ drivers/net/ethernet/alteon/acenic.c
+ drivers/net/ethernet/amd/amd8111e.c
+ drivers/net/ethernet/amd/au1000_eth.c
+ drivers/net/ethernet/amd/declance.c
+ drivers/net/ethernet/amd/pcnet32.c
+ drivers/net/ethernet/apple/bmac.c
+ drivers/net/ethernet/apple/mace.c
+ drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+ drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+ drivers/net/ethernet/broadcom/b44.c
+ drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+ drivers/net/ethernet/broadcom/sb1250-mac.c
+ drivers/net/ethernet/broadcom/tg3.c
+ drivers/net/ethernet/brocade/bna/bnad.c
+ drivers/net/ethernet/cadence/macb.c
+ drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+ drivers/net/ethernet/cisco/enic/enic_main.c
+ drivers/net/ethernet/davicom/dm9000.c
+ drivers/net/ethernet/dec/tulip/tulip_core.c
+ drivers/net/ethernet/dnet.c
+ drivers/net/ethernet/ethoc.c
+ drivers/net/ethernet/hp/hp100.c
+ drivers/net/ethernet/ibm/ehea/ehea_main.c
+ drivers/net/ethernet/ibm/emac/core.c
+ drivers/net/ethernet/ibm/iseries_veth.c
+ drivers/net/ethernet/icplus/ipg.c
+ drivers/net/ethernet/intel/e100.c
+ drivers/net/ethernet/jme.c
+ drivers/net/ethernet/korina.c
+ drivers/net/ethernet/lantiq_etop.c
+ drivers/net/ethernet/marvell/skge.c
+ drivers/net/ethernet/marvell/sky2.c
+ drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+ drivers/net/ethernet/micrel/ks8695net.c
+ drivers/net/ethernet/micrel/ks8851.c
+ drivers/net/ethernet/microchip/enc28j60.c
+ drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+ drivers/net/ethernet/neterion/s2io.c
+ drivers/net/ethernet/netx-eth.c
+ drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+ drivers/net/ethernet/packetengines/yellowfin.c
+ drivers/net/ethernet/pasemi/pasemi_mac.c
+ drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+ drivers/net/ethernet/qlogic/qla3xxx.c
+ drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+ drivers/net/ethernet/rdc/r6040.c
+ drivers/net/ethernet/realtek/8139too.c
+ drivers/net/ethernet/realtek/r8169.c
+ drivers/net/ethernet/s6gmac.c
+ drivers/net/ethernet/seeq/sgiseeq.c
+ drivers/net/ethernet/sis/sis190.c
+ drivers/net/ethernet/smsc/epic100.c
+ drivers/net/ethernet/smsc/smc911x.c
+ drivers/net/ethernet/smsc/smc91x.c
+ drivers/net/ethernet/smsc/smsc911x.c
+ drivers/net/ethernet/smsc/smsc9420.c
+ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+ drivers/net/ethernet/sun/cassini.c
+ drivers/net/ethernet/sun/niu.c
+ drivers/net/ethernet/sun/sungem.c
+ drivers/net/ethernet/sun/sunvnet.c
+ drivers/net/ethernet/tehuti/tehuti.c
+ drivers/net/ethernet/ti/cpmac.c
+ drivers/net/ethernet/ti/davinci_emac.c
+ drivers/net/ethernet/ti/tlan.c
+ drivers/net/ethernet/toshiba/tc35815.c
+ drivers/net/ethernet/tundra/tsi108_eth.c
+ drivers/net/ethernet/via/via-rhine.c
+ drivers/net/ethernet/via/via-velocity.c
+ drivers/net/ethernet/xilinx/ll_temac_main.c
+ drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+ drivers/net/ethernet/xilinx/xilinx_emaclite.c
+ drivers/net/plip/plip.c
+ drivers/net/rionet.c
+ drivers/net/tulip/xircom_cb.c
+ drivers/net/usb/pegasus.c
+ drivers/net/usb/rtl8150.c
+ drivers/net/usb/usbnet.c
+ drivers/net/vmxnet3/vmxnet3_drv.c
+ drivers/net/wireless/atmel.c
+ drivers/net/wireless/ipw2x00/libipw_module.c
+ drivers/net/xen-netfront.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 813d41c..1cb5a34 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1792,7 +1792,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
+
+ ndev = alloc_etherdev(sizeof(struct sh_eth_private));
+ if (!ndev) {
+- dev_err(&pdev->dev, "Could not allocate device.\n");
+ ret = -ENOMEM;
+ goto out;
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0084-net-sh_eth-fix-skb_over_panic-happen.patch b/patches.armadillo800eva/0084-net-sh_eth-fix-skb_over_panic-happen.patch
new file mode 100644
index 00000000000000..57140494326227
--- /dev/null
+++ b/patches.armadillo800eva/0084-net-sh_eth-fix-skb_over_panic-happen.patch
@@ -0,0 +1,64 @@
+From e65e32c14f4b953af76267facf47249d1648338a Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Mon, 6 Feb 2012 23:55:15 +0000
+Subject: net: sh_eth: fix skb_over_panic happen
+
+When this GETHER controller received a large frame (about 1800 bytes
+or more), skb_over_panic() happened. This is because the previous
+driver set the RFLR to 0x1000 (4096 bytes) and the skb allocate size
+is smaller than 4096 bytes. So, the controller accepted such a frame.
+
+The controller can discard a large frame by the RFLR setting.
+So, the patch modifies the value of RFLR to mtu + ETH_HLEN +
+VLAN_HLEN + ETH_FCS_LEN.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Cc: Eric Dumazet <eric.dumazet@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit fdb37a7f84a58ccad24abffd54ad46d23b763e13)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 4 +++-
+ drivers/net/ethernet/renesas/sh_eth.h | 3 ---
+ 2 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 1cb5a34..557736d 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -38,6 +38,7 @@
+ #include <linux/pm_runtime.h>
+ #include <linux/slab.h>
+ #include <linux/ethtool.h>
++#include <linux/if_vlan.h>
+ #include <linux/sh_eth.h>
+
+ #include "sh_eth.h"
+@@ -817,7 +818,8 @@ static int sh_eth_dev_init(struct net_device *ndev)
+ sh_eth_write(ndev, 0, TRIMD);
+
+ /* Recv frame limit set register */
+- sh_eth_write(ndev, RFLR_VALUE, RFLR);
++ sh_eth_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN,
++ RFLR);
+
+ sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR);
+ sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
+diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+index 47877b1..cdbd844 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.h
++++ b/drivers/net/ethernet/renesas/sh_eth.h
+@@ -575,9 +575,6 @@ enum RPADIR_BIT {
+ RPADIR_PADR = 0x0003f,
+ };
+
+-/* RFLR */
+-#define RFLR_VALUE 0x1000
+-
+ /* FDR */
+ #define DEFAULT_FDR_INIT 0x00000707
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0085-sh-eth-use-netdev-stats-structure-and-fix-dma_map_si.patch b/patches.armadillo800eva/0085-sh-eth-use-netdev-stats-structure-and-fix-dma_map_si.patch
new file mode 100644
index 00000000000000..2c25f8cfb8b96d
--- /dev/null
+++ b/patches.armadillo800eva/0085-sh-eth-use-netdev-stats-structure-and-fix-dma_map_si.patch
@@ -0,0 +1,229 @@
+From 259213094bcbc4680f972fc8ec8030306327f25d Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <eric.dumazet@gmail.com>
+Date: Mon, 6 Feb 2012 22:17:21 +0000
+Subject: sh-eth: use netdev stats structure and fix dma_map_single
+
+No need to maintain a parallel net_device_stats structure in
+sh_eth_private, since we have a generic one in netdev
+
+Fix two dma_map_single() incorrect parameters, passing skb->tail instead
+of skb->data. Seems that there is no corresponding dmap_unmap_single()
+calls for the moment in this driver.
+
+Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
+Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit bb7d92e3e3049e22b5807ac559a72b38fad5f499)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 62 ++++++++++++++++-----------------
+ drivers/net/ethernet/renesas/sh_eth.h | 1 -
+ 2 files changed, 31 insertions(+), 32 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 557736d..1fe9541 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -658,7 +658,7 @@ static void sh_eth_ring_format(struct net_device *ndev)
+ mdp->rx_skbuff[i] = skb;
+ if (skb == NULL)
+ break;
+- dma_map_single(&ndev->dev, skb->tail, mdp->rx_buf_sz,
++ dma_map_single(&ndev->dev, skb->data, mdp->rx_buf_sz,
+ DMA_FROM_DEVICE);
+ skb->dev = ndev; /* Mark as being used by this device. */
+ sh_eth_set_receive_align(skb);
+@@ -883,8 +883,8 @@ static int sh_eth_txfree(struct net_device *ndev)
+ if (entry >= TX_RING_SIZE - 1)
+ txdesc->status |= cpu_to_edmac(mdp, TD_TDLE);
+
+- mdp->stats.tx_packets++;
+- mdp->stats.tx_bytes += txdesc->buffer_length;
++ ndev->stats.tx_packets++;
++ ndev->stats.tx_bytes += txdesc->buffer_length;
+ }
+ return freeNum;
+ }
+@@ -910,23 +910,23 @@ static int sh_eth_rx(struct net_device *ndev)
+ break;
+
+ if (!(desc_status & RDFEND))
+- mdp->stats.rx_length_errors++;
++ ndev->stats.rx_length_errors++;
+
+ if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 |
+ RD_RFS5 | RD_RFS6 | RD_RFS10)) {
+- mdp->stats.rx_errors++;
++ ndev->stats.rx_errors++;
+ if (desc_status & RD_RFS1)
+- mdp->stats.rx_crc_errors++;
++ ndev->stats.rx_crc_errors++;
+ if (desc_status & RD_RFS2)
+- mdp->stats.rx_frame_errors++;
++ ndev->stats.rx_frame_errors++;
+ if (desc_status & RD_RFS3)
+- mdp->stats.rx_length_errors++;
++ ndev->stats.rx_length_errors++;
+ if (desc_status & RD_RFS4)
+- mdp->stats.rx_length_errors++;
++ ndev->stats.rx_length_errors++;
+ if (desc_status & RD_RFS6)
+- mdp->stats.rx_missed_errors++;
++ ndev->stats.rx_missed_errors++;
+ if (desc_status & RD_RFS10)
+- mdp->stats.rx_over_errors++;
++ ndev->stats.rx_over_errors++;
+ } else {
+ if (!mdp->cd->hw_swap)
+ sh_eth_soft_swap(
+@@ -939,8 +939,8 @@ static int sh_eth_rx(struct net_device *ndev)
+ skb_put(skb, pkt_len);
+ skb->protocol = eth_type_trans(skb, ndev);
+ netif_rx(skb);
+- mdp->stats.rx_packets++;
+- mdp->stats.rx_bytes += pkt_len;
++ ndev->stats.rx_packets++;
++ ndev->stats.rx_bytes += pkt_len;
+ }
+ rxdesc->status |= cpu_to_edmac(mdp, RD_RACT);
+ entry = (++mdp->cur_rx) % RX_RING_SIZE;
+@@ -959,7 +959,7 @@ static int sh_eth_rx(struct net_device *ndev)
+ mdp->rx_skbuff[entry] = skb;
+ if (skb == NULL)
+ break; /* Better luck next round. */
+- dma_map_single(&ndev->dev, skb->tail, mdp->rx_buf_sz,
++ dma_map_single(&ndev->dev, skb->data, mdp->rx_buf_sz,
+ DMA_FROM_DEVICE);
+ skb->dev = ndev;
+ sh_eth_set_receive_align(skb);
+@@ -1009,7 +1009,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
+ felic_stat = sh_eth_read(ndev, ECSR);
+ sh_eth_write(ndev, felic_stat, ECSR); /* clear int */
+ if (felic_stat & ECSR_ICD)
+- mdp->stats.tx_carrier_errors++;
++ ndev->stats.tx_carrier_errors++;
+ if (felic_stat & ECSR_LCHNG) {
+ /* Link Changed */
+ if (mdp->cd->no_psr || mdp->no_ether_link) {
+@@ -1042,7 +1042,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
+ if (intr_status & EESR_TWB) {
+ /* Write buck end. unused write back interrupt */
+ if (intr_status & EESR_TABT) /* Transmit Abort int */
+- mdp->stats.tx_aborted_errors++;
++ ndev->stats.tx_aborted_errors++;
+ if (netif_msg_tx_err(mdp))
+ dev_err(&ndev->dev, "Transmit Abort\n");
+ }
+@@ -1051,7 +1051,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
+ /* Receive Abort int */
+ if (intr_status & EESR_RFRMER) {
+ /* Receive Frame Overflow int */
+- mdp->stats.rx_frame_errors++;
++ ndev->stats.rx_frame_errors++;
+ if (netif_msg_rx_err(mdp))
+ dev_err(&ndev->dev, "Receive Abort\n");
+ }
+@@ -1059,21 +1059,21 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
+
+ if (intr_status & EESR_TDE) {
+ /* Transmit Descriptor Empty int */
+- mdp->stats.tx_fifo_errors++;
++ ndev->stats.tx_fifo_errors++;
+ if (netif_msg_tx_err(mdp))
+ dev_err(&ndev->dev, "Transmit Descriptor Empty\n");
+ }
+
+ if (intr_status & EESR_TFE) {
+ /* FIFO under flow */
+- mdp->stats.tx_fifo_errors++;
++ ndev->stats.tx_fifo_errors++;
+ if (netif_msg_tx_err(mdp))
+ dev_err(&ndev->dev, "Transmit FIFO Under flow\n");
+ }
+
+ if (intr_status & EESR_RDE) {
+ /* Receive Descriptor Empty int */
+- mdp->stats.rx_over_errors++;
++ ndev->stats.rx_over_errors++;
+
+ if (sh_eth_read(ndev, EDRRR) ^ EDRRR_R)
+ sh_eth_write(ndev, EDRRR_R, EDRRR);
+@@ -1083,14 +1083,14 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
+
+ if (intr_status & EESR_RFE) {
+ /* Receive FIFO Overflow int */
+- mdp->stats.rx_fifo_errors++;
++ ndev->stats.rx_fifo_errors++;
+ if (netif_msg_rx_err(mdp))
+ dev_err(&ndev->dev, "Receive FIFO Overflow\n");
+ }
+
+ if (!mdp->cd->no_ade && (intr_status & EESR_ADE)) {
+ /* Address Error */
+- mdp->stats.tx_fifo_errors++;
++ ndev->stats.tx_fifo_errors++;
+ if (netif_msg_tx_err(mdp))
+ dev_err(&ndev->dev, "Address Error\n");
+ }
+@@ -1447,7 +1447,7 @@ static void sh_eth_tx_timeout(struct net_device *ndev)
+ " resetting...\n", ndev->name, (int)sh_eth_read(ndev, EESR));
+
+ /* tx_errors count up */
+- mdp->stats.tx_errors++;
++ ndev->stats.tx_errors++;
+
+ /* timer off */
+ del_timer_sync(&mdp->timer);
+@@ -1569,27 +1569,27 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev)
+
+ pm_runtime_get_sync(&mdp->pdev->dev);
+
+- mdp->stats.tx_dropped += sh_eth_read(ndev, TROCR);
++ ndev->stats.tx_dropped += sh_eth_read(ndev, TROCR);
+ sh_eth_write(ndev, 0, TROCR); /* (write clear) */
+- mdp->stats.collisions += sh_eth_read(ndev, CDCR);
++ ndev->stats.collisions += sh_eth_read(ndev, CDCR);
+ sh_eth_write(ndev, 0, CDCR); /* (write clear) */
+- mdp->stats.tx_carrier_errors += sh_eth_read(ndev, LCCR);
++ ndev->stats.tx_carrier_errors += sh_eth_read(ndev, LCCR);
+ sh_eth_write(ndev, 0, LCCR); /* (write clear) */
+ if (sh_eth_is_gether(mdp)) {
+- mdp->stats.tx_carrier_errors += sh_eth_read(ndev, CERCR);
++ ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CERCR);
+ sh_eth_write(ndev, 0, CERCR); /* (write clear) */
+- mdp->stats.tx_carrier_errors += sh_eth_read(ndev, CEECR);
++ ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CEECR);
+ sh_eth_write(ndev, 0, CEECR); /* (write clear) */
+ } else {
+- mdp->stats.tx_carrier_errors += sh_eth_read(ndev, CNDCR);
++ ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CNDCR);
+ sh_eth_write(ndev, 0, CNDCR); /* (write clear) */
+ }
+ pm_runtime_put_sync(&mdp->pdev->dev);
+
+- return &mdp->stats;
++ return &ndev->stats;
+ }
+
+-/* ioctl to device funciotn*/
++/* ioctl to device function */
+ static int sh_eth_do_ioctl(struct net_device *ndev, struct ifreq *rq,
+ int cmd)
+ {
+diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+index cdbd844..cb07add 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.h
++++ b/drivers/net/ethernet/renesas/sh_eth.h
+@@ -759,7 +759,6 @@ struct sh_eth_private {
+ struct sh_eth_txdesc *tx_ring;
+ struct sk_buff **rx_skbuff;
+ struct sk_buff **tx_skbuff;
+- struct net_device_stats stats;
+ struct timer_list timer;
+ spinlock_t lock;
+ u32 cur_rx, dirty_rx; /* Producer/consumer ring indices */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0086-netdev-ethernet-dev_alloc_skb-to-netdev_alloc_skb.patch b/patches.armadillo800eva/0086-netdev-ethernet-dev_alloc_skb-to-netdev_alloc_skb.patch
new file mode 100644
index 00000000000000..4f270468e8c6b1
--- /dev/null
+++ b/patches.armadillo800eva/0086-netdev-ethernet-dev_alloc_skb-to-netdev_alloc_skb.patch
@@ -0,0 +1,89 @@
+From c45262499db9ff6ad6f32765b6fe0c9433443f91 Mon Sep 17 00:00:00 2001
+From: "Pradeep A. Dalvi" <netdev@pradeepdalvi.com>
+Date: Mon, 6 Feb 2012 11:16:13 +0000
+Subject: netdev: ethernet dev_alloc_skb to netdev_alloc_skb
+
+Replaced deprecating dev_alloc_skb with netdev_alloc_skb in drivers/net/ethernet
+ - Removed extra skb->dev = dev after netdev_alloc_skb
+
+Signed-off-by: Pradeep A Dalvi <netdev@pradeepdalvi.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit dae2e9f430c46c29e3f771110094bd3da3625aa4)
+
+Conflicts:
+
+ drivers/net/ethernet/netx-eth.c
+ drivers/net/ethernet/nuvoton/w90p910_ether.c
+ drivers/net/ethernet/nvidia/forcedeth.c
+ drivers/net/ethernet/packetengines/hamachi.c
+ drivers/net/ethernet/packetengines/yellowfin.c
+ drivers/net/ethernet/pasemi/pasemi_mac.c
+ drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+ drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+ drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
+ drivers/net/ethernet/racal/ni5010.c
+ drivers/net/ethernet/realtek/atp.c
+ drivers/net/ethernet/seeq/ether3.c
+ drivers/net/ethernet/seeq/seeq8005.c
+ drivers/net/ethernet/sis/sis900.c
+ drivers/net/ethernet/smsc/epic100.c
+ drivers/net/ethernet/smsc/smc911x.c
+ drivers/net/ethernet/smsc/smc9194.c
+ drivers/net/ethernet/smsc/smc91c92_cs.c
+ drivers/net/ethernet/smsc/smc91x.c
+ drivers/net/ethernet/smsc/smsc9420.c
+ drivers/net/ethernet/sun/cassini.c
+ drivers/net/ethernet/sun/sunbmac.c
+ drivers/net/ethernet/sun/sunhme.c
+ drivers/net/ethernet/sun/sunqe.c
+ drivers/net/ethernet/tehuti/tehuti.c
+ drivers/net/ethernet/ti/davinci_emac.c
+ drivers/net/ethernet/tile/tilepro.c
+ drivers/net/ethernet/toshiba/tc35815.c
+ drivers/net/ethernet/via/via-rhine.c
+ drivers/net/ethernet/via/via-velocity.c
+ drivers/net/ethernet/xilinx/xilinx_emaclite.c
+ drivers/net/ethernet/xircom/xirc2ps_cs.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 1fe9541..cfad091 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -654,13 +654,12 @@ static void sh_eth_ring_format(struct net_device *ndev)
+ for (i = 0; i < RX_RING_SIZE; i++) {
+ /* skb */
+ mdp->rx_skbuff[i] = NULL;
+- skb = dev_alloc_skb(mdp->rx_buf_sz);
++ skb = netdev_alloc_skb(ndev, mdp->rx_buf_sz);
+ mdp->rx_skbuff[i] = skb;
+ if (skb == NULL)
+ break;
+ dma_map_single(&ndev->dev, skb->data, mdp->rx_buf_sz,
+ DMA_FROM_DEVICE);
+- skb->dev = ndev; /* Mark as being used by this device. */
+ sh_eth_set_receive_align(skb);
+
+ /* RX descriptor */
+@@ -955,13 +954,12 @@ static int sh_eth_rx(struct net_device *ndev)
+ rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);
+
+ if (mdp->rx_skbuff[entry] == NULL) {
+- skb = dev_alloc_skb(mdp->rx_buf_sz);
++ skb = netdev_alloc_skb(ndev, mdp->rx_buf_sz);
+ mdp->rx_skbuff[entry] = skb;
+ if (skb == NULL)
+ break; /* Better luck next round. */
+ dma_map_single(&ndev->dev, skb->data, mdp->rx_buf_sz,
+ DMA_FROM_DEVICE);
+- skb->dev = ndev;
+ sh_eth_set_receive_align(skb);
+
+ skb_checksum_none_assert(skb);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0087-renesas-sh_eth.c-fix-linux-interrupt.h-included-twic.patch b/patches.armadillo800eva/0087-renesas-sh_eth.c-fix-linux-interrupt.h-included-twic.patch
new file mode 100644
index 00000000000000..de17d264bbf7cc
--- /dev/null
+++ b/patches.armadillo800eva/0087-renesas-sh_eth.c-fix-linux-interrupt.h-included-twic.patch
@@ -0,0 +1,31 @@
+From 82b348082b3bca174a3e7c53a64214f06cb36f2e Mon Sep 17 00:00:00 2001
+From: Danny Kukawka <danny.kukawka@bisect.de>
+Date: Wed, 15 Feb 2012 07:54:43 +0000
+Subject: renesas/sh_eth.c: fix linux/interrupt.h included twice
+
+Remove double include of linux/interrupt.h.
+
+Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 16387605a503a5462c79b740f9696ad4f5a960e5)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index cfad091..98062bf 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -34,7 +34,6 @@
+ #include <linux/phy.h>
+ #include <linux/cache.h>
+ #include <linux/io.h>
+-#include <linux/interrupt.h>
+ #include <linux/pm_runtime.h>
+ #include <linux/slab.h>
+ #include <linux/ethtool.h>
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0088-net-sh_eth-add-the-value-of-tsu-to-the-SH7757-s-GETH.patch b/patches.armadillo800eva/0088-net-sh_eth-add-the-value-of-tsu-to-the-SH7757-s-GETH.patch
new file mode 100644
index 00000000000000..72fbf7974c1cdf
--- /dev/null
+++ b/patches.armadillo800eva/0088-net-sh_eth-add-the-value-of-tsu-to-the-SH7757-s-GETH.patch
@@ -0,0 +1,32 @@
+From 44eccf7d2cf65f09b4412927d0105cb6777eba4a Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 15 Feb 2012 17:54:51 +0000
+Subject: net: sh_eth: add the value of tsu to the SH7757's GETHER
+
+The SH7757's GETHER has TSU registers. So, this patch adds the value
+of ".tsu = 1" in the sh_eth_cpu_data.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 3acbc9715a5ac8a2534a69eb3488b63b7c9fb1e2)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 98062bf..8f53b5a 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -268,6 +268,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data_giga = {
+ .rpadir_value = 2 << 16,
+ .no_trimd = 1,
+ .no_ade = 1,
++ .tsu = 1,
+ };
+
+ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0089-net-sh_eth-change-the-condition-of-initialization.patch b/patches.armadillo800eva/0089-net-sh_eth-change-the-condition-of-initialization.patch
new file mode 100644
index 00000000000000..a2e45364a9444d
--- /dev/null
+++ b/patches.armadillo800eva/0089-net-sh_eth-change-the-condition-of-initialization.patch
@@ -0,0 +1,50 @@
+From 6d4f5594a3cd8dd552204374f76b42b6eafc3931 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 15 Feb 2012 17:54:56 +0000
+Subject: net: sh_eth: change the condition of initialization
+
+The SH7757 has 2 Fast Ethernet and 2 Gigabit Ethernet, and the first
+Gigabit channel needs the initialization. So, this patch adds the
+parameter of "needs_init", and if the sh_eth_plat_data is set it
+to 1, the driver will initialize the channel.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 150647fb2c313d7c5184fca3fa0829a4a7d6f7bc)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 4 ++--
+ include/linux/sh_eth.h | 1 +
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 8f53b5a..5a5afbc 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1859,8 +1859,8 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
+ /* read and set MAC address */
+ read_mac_address(ndev, pd->mac_addr);
+
+- /* First device only init */
+- if (!devno) {
++ /* initialize first or needed device */
++ if (!devno || pd->needs_init) {
+ if (mdp->cd->tsu) {
+ struct resource *rtsu;
+ rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h
+index 2076acf..b17d765d 100644
+--- a/include/linux/sh_eth.h
++++ b/include/linux/sh_eth.h
+@@ -20,6 +20,7 @@ struct sh_eth_plat_data {
+ unsigned char mac_addr[6];
+ unsigned no_ether_link:1;
+ unsigned ether_link_active_low:1;
++ unsigned needs_init:1;
+ };
+
+ #endif
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0090-net-sh_eth-modify-a-condition-of-ioremap-for-TSU.patch b/patches.armadillo800eva/0090-net-sh_eth-modify-a-condition-of-ioremap-for-TSU.patch
new file mode 100644
index 00000000000000..a16070a74e595c
--- /dev/null
+++ b/patches.armadillo800eva/0090-net-sh_eth-modify-a-condition-of-ioremap-for-TSU.patch
@@ -0,0 +1,65 @@
+From d0ff01f0ef5c7a64604619a50a2ec3cd1160e43b Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 15 Feb 2012 17:55:01 +0000
+Subject: net: sh_eth: modify a condition of ioremap for TSU
+
+If the controller has TSU, the each channel needs TSU registers.
+This patch also fixes the iounmap condition in the sh_eth_drv_remove().
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 6ba88021c36516c26c11eff8c6d7d9a045faecd3)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 25 ++++++++++++++-----------
+ 1 file changed, 14 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 5a5afbc..8bd0e58 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1859,18 +1859,20 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
+ /* read and set MAC address */
+ read_mac_address(ndev, pd->mac_addr);
+
++ /* ioremap the TSU registers */
++ if (mdp->cd->tsu) {
++ struct resource *rtsu;
++ rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);
++ if (!rtsu) {
++ dev_err(&pdev->dev, "Not found TSU resource\n");
++ goto out_release;
++ }
++ mdp->tsu_addr = ioremap(rtsu->start,
++ resource_size(rtsu));
++ }
++
+ /* initialize first or needed device */
+ if (!devno || pd->needs_init) {
+- if (mdp->cd->tsu) {
+- struct resource *rtsu;
+- rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+- if (!rtsu) {
+- dev_err(&pdev->dev, "Not found TSU resource\n");
+- goto out_release;
+- }
+- mdp->tsu_addr = ioremap(rtsu->start,
+- resource_size(rtsu));
+- }
+ if (mdp->cd->chip_reset)
+ mdp->cd->chip_reset(ndev);
+
+@@ -1919,7 +1921,8 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
+ struct net_device *ndev = platform_get_drvdata(pdev);
+ struct sh_eth_private *mdp = netdev_priv(ndev);
+
+- iounmap(mdp->tsu_addr);
++ if (mdp->cd->tsu)
++ iounmap(mdp->tsu_addr);
+ sh_mdio_release(ndev);
+ unregister_netdev(ndev);
+ pm_runtime_disable(&pdev->dev);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0091-net-sh_eth-add-support-for-multicast-filtering.patch b/patches.armadillo800eva/0091-net-sh_eth-add-support-for-multicast-filtering.patch
new file mode 100644
index 00000000000000..17682df7ec6ad0
--- /dev/null
+++ b/patches.armadillo800eva/0091-net-sh_eth-add-support-for-multicast-filtering.patch
@@ -0,0 +1,362 @@
+From e0ebdb700d3dcdf618b281aa0b2355399048cd71 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 15 Feb 2012 17:55:03 +0000
+Subject: net: sh_eth: add support for multicast filtering
+
+Some controllers have TSU. It can filter multicast by hardware.
+This patch supports it.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 6743fe6df43b4dc5950f605edfeee086d0a80f06)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 282 ++++++++++++++++++++++++++++++++-
+ drivers/net/ethernet/renesas/sh_eth.h | 9 ++
+ 2 files changed, 286 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 8bd0e58..99d8ce8 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1604,18 +1604,289 @@ static int sh_eth_do_ioctl(struct net_device *ndev, struct ifreq *rq,
+ }
+
+ #if defined(SH_ETH_HAS_TSU)
++/* For TSU_POSTn. Please refer to the manual about this (strange) bitfields */
++static void *sh_eth_tsu_get_post_reg_offset(struct sh_eth_private *mdp,
++ int entry)
++{
++ return sh_eth_tsu_get_offset(mdp, TSU_POST1) + (entry / 8 * 4);
++}
++
++static u32 sh_eth_tsu_get_post_mask(int entry)
++{
++ return 0x0f << (28 - ((entry % 8) * 4));
++}
++
++static u32 sh_eth_tsu_get_post_bit(struct sh_eth_private *mdp, int entry)
++{
++ return (0x08 >> (mdp->port << 1)) << (28 - ((entry % 8) * 4));
++}
++
++static void sh_eth_tsu_enable_cam_entry_post(struct net_device *ndev,
++ int entry)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ u32 tmp;
++ void *reg_offset;
++
++ reg_offset = sh_eth_tsu_get_post_reg_offset(mdp, entry);
++ tmp = ioread32(reg_offset);
++ iowrite32(tmp | sh_eth_tsu_get_post_bit(mdp, entry), reg_offset);
++}
++
++static bool sh_eth_tsu_disable_cam_entry_post(struct net_device *ndev,
++ int entry)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ u32 post_mask, ref_mask, tmp;
++ void *reg_offset;
++
++ reg_offset = sh_eth_tsu_get_post_reg_offset(mdp, entry);
++ post_mask = sh_eth_tsu_get_post_mask(entry);
++ ref_mask = sh_eth_tsu_get_post_bit(mdp, entry) & ~post_mask;
++
++ tmp = ioread32(reg_offset);
++ iowrite32(tmp & ~post_mask, reg_offset);
++
++ /* If other port enables, the function returns "true" */
++ return tmp & ref_mask;
++}
++
++static int sh_eth_tsu_busy(struct net_device *ndev)
++{
++ int timeout = SH_ETH_TSU_TIMEOUT_MS * 100;
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++
++ while ((sh_eth_tsu_read(mdp, TSU_ADSBSY) & TSU_ADSBSY_0)) {
++ udelay(10);
++ timeout--;
++ if (timeout <= 0) {
++ dev_err(&ndev->dev, "%s: timeout\n", __func__);
++ return -ETIMEDOUT;
++ }
++ }
++
++ return 0;
++}
++
++static int sh_eth_tsu_write_entry(struct net_device *ndev, void *reg,
++ const u8 *addr)
++{
++ u32 val;
++
++ val = addr[0] << 24 | addr[1] << 16 | addr[2] << 8 | addr[3];
++ iowrite32(val, reg);
++ if (sh_eth_tsu_busy(ndev) < 0)
++ return -EBUSY;
++
++ val = addr[4] << 8 | addr[5];
++ iowrite32(val, reg + 4);
++ if (sh_eth_tsu_busy(ndev) < 0)
++ return -EBUSY;
++
++ return 0;
++}
++
++static void sh_eth_tsu_read_entry(void *reg, u8 *addr)
++{
++ u32 val;
++
++ val = ioread32(reg);
++ addr[0] = (val >> 24) & 0xff;
++ addr[1] = (val >> 16) & 0xff;
++ addr[2] = (val >> 8) & 0xff;
++ addr[3] = val & 0xff;
++ val = ioread32(reg + 4);
++ addr[4] = (val >> 8) & 0xff;
++ addr[5] = val & 0xff;
++}
++
++
++static int sh_eth_tsu_find_entry(struct net_device *ndev, const u8 *addr)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ void *reg_offset = sh_eth_tsu_get_offset(mdp, TSU_ADRH0);
++ int i;
++ u8 c_addr[ETH_ALEN];
++
++ for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++, reg_offset += 8) {
++ sh_eth_tsu_read_entry(reg_offset, c_addr);
++ if (memcmp(addr, c_addr, ETH_ALEN) == 0)
++ return i;
++ }
++
++ return -ENOENT;
++}
++
++static int sh_eth_tsu_find_empty(struct net_device *ndev)
++{
++ u8 blank[ETH_ALEN];
++ int entry;
++
++ memset(blank, 0, sizeof(blank));
++ entry = sh_eth_tsu_find_entry(ndev, blank);
++ return (entry < 0) ? -ENOMEM : entry;
++}
++
++static int sh_eth_tsu_disable_cam_entry_table(struct net_device *ndev,
++ int entry)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ void *reg_offset = sh_eth_tsu_get_offset(mdp, TSU_ADRH0);
++ int ret;
++ u8 blank[ETH_ALEN];
++
++ sh_eth_tsu_write(mdp, sh_eth_tsu_read(mdp, TSU_TEN) &
++ ~(1 << (31 - entry)), TSU_TEN);
++
++ memset(blank, 0, sizeof(blank));
++ ret = sh_eth_tsu_write_entry(ndev, reg_offset + entry * 8, blank);
++ if (ret < 0)
++ return ret;
++ return 0;
++}
++
++static int sh_eth_tsu_add_entry(struct net_device *ndev, const u8 *addr)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ void *reg_offset = sh_eth_tsu_get_offset(mdp, TSU_ADRH0);
++ int i, ret;
++
++ if (!mdp->cd->tsu)
++ return 0;
++
++ i = sh_eth_tsu_find_entry(ndev, addr);
++ if (i < 0) {
++ /* No entry found, create one */
++ i = sh_eth_tsu_find_empty(ndev);
++ if (i < 0)
++ return -ENOMEM;
++ ret = sh_eth_tsu_write_entry(ndev, reg_offset + i * 8, addr);
++ if (ret < 0)
++ return ret;
++
++ /* Enable the entry */
++ sh_eth_tsu_write(mdp, sh_eth_tsu_read(mdp, TSU_TEN) |
++ (1 << (31 - i)), TSU_TEN);
++ }
++
++ /* Entry found or created, enable POST */
++ sh_eth_tsu_enable_cam_entry_post(ndev, i);
++
++ return 0;
++}
++
++static int sh_eth_tsu_del_entry(struct net_device *ndev, const u8 *addr)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ int i, ret;
++
++ if (!mdp->cd->tsu)
++ return 0;
++
++ i = sh_eth_tsu_find_entry(ndev, addr);
++ if (i) {
++ /* Entry found */
++ if (sh_eth_tsu_disable_cam_entry_post(ndev, i))
++ goto done;
++
++ /* Disable the entry if both ports was disabled */
++ ret = sh_eth_tsu_disable_cam_entry_table(ndev, i);
++ if (ret < 0)
++ return ret;
++ }
++done:
++ return 0;
++}
++
++static int sh_eth_tsu_purge_all(struct net_device *ndev)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ int i, ret;
++
++ if (unlikely(!mdp->cd->tsu))
++ return 0;
++
++ for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++) {
++ if (sh_eth_tsu_disable_cam_entry_post(ndev, i))
++ continue;
++
++ /* Disable the entry if both ports was disabled */
++ ret = sh_eth_tsu_disable_cam_entry_table(ndev, i);
++ if (ret < 0)
++ return ret;
++ }
++
++ return 0;
++}
++
++static void sh_eth_tsu_purge_mcast(struct net_device *ndev)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ u8 addr[ETH_ALEN];
++ void *reg_offset = sh_eth_tsu_get_offset(mdp, TSU_ADRH0);
++ int i;
++
++ if (unlikely(!mdp->cd->tsu))
++ return;
++
++ for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES; i++, reg_offset += 8) {
++ sh_eth_tsu_read_entry(reg_offset, addr);
++ if (is_multicast_ether_addr(addr))
++ sh_eth_tsu_del_entry(ndev, addr);
++ }
++}
++
+ /* Multicast reception directions set */
+ static void sh_eth_set_multicast_list(struct net_device *ndev)
+ {
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ u32 ecmr_bits;
++ int mcast_all = 0;
++ unsigned long flags;
++
++ spin_lock_irqsave(&mdp->lock, flags);
++ /*
++ * Initial condition is MCT = 1, PRM = 0.
++ * Depending on ndev->flags, set PRM or clear MCT
++ */
++ ecmr_bits = (sh_eth_read(ndev, ECMR) & ~ECMR_PRM) | ECMR_MCT;
++
++ if (!(ndev->flags & IFF_MULTICAST)) {
++ sh_eth_tsu_purge_mcast(ndev);
++ mcast_all = 1;
++ }
++ if (ndev->flags & IFF_ALLMULTI) {
++ sh_eth_tsu_purge_mcast(ndev);
++ ecmr_bits &= ~ECMR_MCT;
++ mcast_all = 1;
++ }
++
+ if (ndev->flags & IFF_PROMISC) {
+- /* Set promiscuous. */
+- sh_eth_write(ndev, (sh_eth_read(ndev, ECMR) & ~ECMR_MCT) |
+- ECMR_PRM, ECMR);
++ sh_eth_tsu_purge_all(ndev);
++ ecmr_bits = (ecmr_bits & ~ECMR_MCT) | ECMR_PRM;
++ } else if (mdp->cd->tsu) {
++ struct netdev_hw_addr *ha;
++ netdev_for_each_mc_addr(ha, ndev) {
++ if (mcast_all && is_multicast_ether_addr(ha->addr))
++ continue;
++
++ if (sh_eth_tsu_add_entry(ndev, ha->addr) < 0) {
++ if (!mcast_all) {
++ sh_eth_tsu_purge_mcast(ndev);
++ ecmr_bits &= ~ECMR_MCT;
++ mcast_all = 1;
++ }
++ }
++ }
+ } else {
+ /* Normal, unicast/broadcast-only mode. */
+- sh_eth_write(ndev, (sh_eth_read(ndev, ECMR) & ~ECMR_PRM) |
+- ECMR_MCT, ECMR);
++ ecmr_bits = (ecmr_bits & ~ECMR_PRM) | ECMR_MCT;
+ }
++
++ /* update the ethernet mode */
++ sh_eth_write(ndev, ecmr_bits, ECMR);
++
++ spin_unlock_irqrestore(&mdp->lock, flags);
+ }
+ #endif /* SH_ETH_HAS_TSU */
+
+@@ -1869,6 +2140,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
+ }
+ mdp->tsu_addr = ioremap(rtsu->start,
+ resource_size(rtsu));
++ mdp->port = devno % 2;
+ }
+
+ /* initialize first or needed device */
+diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+index cb07add..86b392e 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.h
++++ b/drivers/net/ethernet/renesas/sh_eth.h
+@@ -29,6 +29,8 @@
+ #define RX_RING_SIZE 64 /* Rx ring size */
+ #define ETHERSMALL 60
+ #define PKT_BUF_SZ 1538
++#define SH_ETH_TSU_TIMEOUT_MS 500
++#define SH_ETH_TSU_CAM_ENTRIES 32
+
+ enum {
+ /* E-DMAC registers */
+@@ -778,6 +780,7 @@ struct sh_eth_private {
+ char post_rx; /* POST receive */
+ char post_fw; /* POST forward */
+ struct net_device_stats tsu_stats; /* TSU forward status */
++ int port; /* for TSU */
+
+ unsigned no_ether_link:1;
+ unsigned ether_link_active_low:1;
+@@ -811,6 +814,12 @@ static inline unsigned long sh_eth_read(struct net_device *ndev,
+ return ioread32(mdp->addr + mdp->reg_offset[enum_index]);
+ }
+
++static inline void *sh_eth_tsu_get_offset(struct sh_eth_private *mdp,
++ int enum_index)
++{
++ return mdp->tsu_addr + mdp->reg_offset[enum_index];
++}
++
+ static inline void sh_eth_tsu_write(struct sh_eth_private *mdp,
+ unsigned long data, int enum_index)
+ {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0092-net-sh_eth-add-support-for-VLAN-tag-filtering.patch b/patches.armadillo800eva/0092-net-sh_eth-add-support-for-VLAN-tag-filtering.patch
new file mode 100644
index 00000000000000..78e57fc310acbb
--- /dev/null
+++ b/patches.armadillo800eva/0092-net-sh_eth-add-support-for-VLAN-tag-filtering.patch
@@ -0,0 +1,130 @@
+From 88005e464c36fa68e0bb15937f5ea1373191782e Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 15 Feb 2012 17:55:06 +0000
+Subject: net: sh_eth: add support for VLAN tag filtering
+
+Some controllers have TSU. It can register one VLAN tag, and it can
+filter other VLAN tag by hardware.
+If vlan_rx_add_vid() is called twice or more, the driver will disable
+the filtering.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 71cc7c37af71b497698f7f8a68e46a458071fcef)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 59 +++++++++++++++++++++++++++++++++
+ drivers/net/ethernet/renesas/sh_eth.h | 5 +++
+ 2 files changed, 64 insertions(+)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 99d8ce8..8615961 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1888,6 +1888,62 @@ static void sh_eth_set_multicast_list(struct net_device *ndev)
+
+ spin_unlock_irqrestore(&mdp->lock, flags);
+ }
++
++static int sh_eth_get_vtag_index(struct sh_eth_private *mdp)
++{
++ if (!mdp->port)
++ return TSU_VTAG0;
++ else
++ return TSU_VTAG1;
++}
++
++static int sh_eth_vlan_rx_add_vid(struct net_device *ndev, u16 vid)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ int vtag_reg_index = sh_eth_get_vtag_index(mdp);
++
++ if (unlikely(!mdp->cd->tsu))
++ return -EPERM;
++
++ /* No filtering if vid = 0 */
++ if (!vid)
++ return 0;
++
++ mdp->vlan_num_ids++;
++
++ /*
++ * The controller has one VLAN tag HW filter. So, if the filter is
++ * already enabled, the driver disables it and the filte
++ */
++ if (mdp->vlan_num_ids > 1) {
++ /* disable VLAN filter */
++ sh_eth_tsu_write(mdp, 0, vtag_reg_index);
++ return 0;
++ }
++
++ sh_eth_tsu_write(mdp, TSU_VTAG_ENABLE | (vid & TSU_VTAG_VID_MASK),
++ vtag_reg_index);
++
++ return 0;
++}
++
++static int sh_eth_vlan_rx_kill_vid(struct net_device *ndev, u16 vid)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ int vtag_reg_index = sh_eth_get_vtag_index(mdp);
++
++ if (unlikely(!mdp->cd->tsu))
++ return -EPERM;
++
++ /* No filtering if vid = 0 */
++ if (!vid)
++ return 0;
++
++ mdp->vlan_num_ids--;
++ sh_eth_tsu_write(mdp, 0, vtag_reg_index);
++
++ return 0;
++}
+ #endif /* SH_ETH_HAS_TSU */
+
+ /* SuperH's TSU register init function */
+@@ -2037,6 +2093,8 @@ static const struct net_device_ops sh_eth_netdev_ops = {
+ .ndo_get_stats = sh_eth_get_stats,
+ #if defined(SH_ETH_HAS_TSU)
+ .ndo_set_rx_mode = sh_eth_set_multicast_list,
++ .ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid,
++ .ndo_vlan_rx_kill_vid = sh_eth_vlan_rx_kill_vid,
+ #endif
+ .ndo_tx_timeout = sh_eth_tx_timeout,
+ .ndo_do_ioctl = sh_eth_do_ioctl,
+@@ -2141,6 +2199,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
+ mdp->tsu_addr = ioremap(rtsu->start,
+ resource_size(rtsu));
+ mdp->port = devno % 2;
++ ndev->features = NETIF_F_HW_VLAN_FILTER;
+ }
+
+ /* initialize first or needed device */
+diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+index 86b392e..57dc262 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.h
++++ b/drivers/net/ethernet/renesas/sh_eth.h
+@@ -679,6 +679,10 @@ enum TSU_FWSLC_BIT {
+ TSU_FWSLC_CAMSEL11 = 0x0002, TSU_FWSLC_CAMSEL10 = 0x0001,
+ };
+
++/* TSU_VTAGn */
++#define TSU_VTAG_ENABLE 0x80000000
++#define TSU_VTAG_VID_MASK 0x00000fff
++
+ /*
+ * The sh ether Tx buffer descriptors.
+ * This structure should be 20 bytes.
+@@ -781,6 +785,7 @@ struct sh_eth_private {
+ char post_fw; /* POST forward */
+ struct net_device_stats tsu_stats; /* TSU forward status */
+ int port; /* for TSU */
++ int vlan_num_ids; /* for VLAN tag filter */
+
+ unsigned no_ether_link:1;
+ unsigned ether_link_active_low:1;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0093-net-sh_eth-Add-support-SH7734.patch b/patches.armadillo800eva/0093-net-sh_eth-Add-support-SH7734.patch
new file mode 100644
index 00000000000000..5139197b08785d
--- /dev/null
+++ b/patches.armadillo800eva/0093-net-sh_eth-Add-support-SH7734.patch
@@ -0,0 +1,163 @@
+From 3b43f34993772ee505d5cf82d6f67f8ab8630e55 Mon Sep 17 00:00:00 2001
+From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Date: Sun, 25 Mar 2012 18:59:51 +0000
+Subject: net: sh_eth: Add support SH7734
+
+Add define of SH7734 register and sh_eth_reset_hw_crc function.
+
+V3: Rebase net/HEAD.
+V2: Do not split line of #if defined.
+
+Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit f0e81fecd4f83de7854262c8a6b3af19dfa99bf9)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/Kconfig | 5 +++--
+ drivers/net/ethernet/renesas/sh_eth.c | 20 +++++++++++++++++---
+ drivers/net/ethernet/renesas/sh_eth.h | 11 ++++++++---
+ 3 files changed, 28 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig
+index f57ae23..20cbf26 100644
+--- a/drivers/net/ethernet/renesas/Kconfig
++++ b/drivers/net/ethernet/renesas/Kconfig
+@@ -7,7 +7,8 @@ config SH_ETH
+ depends on SUPERH && \
+ (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \
+ CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \
+- CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7757)
++ CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7734 || \
++ CPU_SUBTYPE_SH7757)
+ select CRC32
+ select MII
+ select MDIO_BITBANG
+@@ -15,4 +16,4 @@ config SH_ETH
+ ---help---
+ Renesas SuperH Ethernet device driver.
+ This driver supporting CPUs are:
+- - SH7710, SH7712, SH7763, SH7619, SH7724, and SH7757.
++ - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763 and SH7757.
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 8615961..8bdf070 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1,8 +1,8 @@
+ /*
+ * SuperH Ethernet device driver
+ *
+- * Copyright (C) 2006-2008 Nobuhiro Iwamatsu
+- * Copyright (C) 2008-2009 Renesas Solutions Corp.
++ * Copyright (C) 2006-2012 Nobuhiro Iwamatsu
++ * Copyright (C) 2008-2012 Renesas Solutions Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+@@ -38,6 +38,7 @@
+ #include <linux/slab.h>
+ #include <linux/ethtool.h>
+ #include <linux/if_vlan.h>
++#include <linux/clk.h>
+ #include <linux/sh_eth.h>
+
+ #include "sh_eth.h"
+@@ -279,8 +280,9 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp)
+ return &sh_eth_my_cpu_data;
+ }
+
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
++#elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
+ #define SH_ETH_HAS_TSU 1
++static void sh_eth_reset_hw_crc(struct net_device *ndev);
+ static void sh_eth_chip_reset(struct net_device *ndev)
+ {
+ struct sh_eth_private *mdp = netdev_priv(ndev);
+@@ -314,6 +316,9 @@ static void sh_eth_reset(struct net_device *ndev)
+ sh_eth_write(ndev, 0x0, RDFAR);
+ sh_eth_write(ndev, 0x0, RDFXR);
+ sh_eth_write(ndev, 0x0, RDFFR);
++
++ /* Reset HW CRC register */
++ sh_eth_reset_hw_crc(ndev);
+ }
+
+ static void sh_eth_set_duplex(struct net_device *ndev)
+@@ -370,8 +375,17 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
+ .no_trimd = 1,
+ .no_ade = 1,
+ .tsu = 1,
++#if defined(CONFIG_CPU_SUBTYPE_SH7734)
++ .hw_crc = 1,
++#endif
+ };
+
++static void sh_eth_reset_hw_crc(struct net_device *ndev)
++{
++ if (sh_eth_my_cpu_data.hw_crc)
++ sh_eth_write(ndev, 0x0, CSMR);
++}
++
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7619)
+ #define SH_ETH_RESET_DEFAULT 1
+ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
+diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+index 57dc262..e66de18 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.h
++++ b/drivers/net/ethernet/renesas/sh_eth.h
+@@ -1,8 +1,8 @@
+ /*
+ * SuperH Ethernet device driver
+ *
+- * Copyright (C) 2006-2008 Nobuhiro Iwamatsu
+- * Copyright (C) 2008-2011 Renesas Solutions Corp.
++ * Copyright (C) 2006-2012 Nobuhiro Iwamatsu
++ * Copyright (C) 2008-2012 Renesas Solutions Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+@@ -98,6 +98,8 @@ enum {
+ CEECR,
+ MAFCR,
+ RTRATE,
++ CSMR,
++ RMII_MII,
+
+ /* TSU Absolute address */
+ ARSTR,
+@@ -172,6 +174,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
+ [RMCR] = 0x0458,
+ [RPADIR] = 0x0460,
+ [FCFTR] = 0x0468,
++ [CSMR] = 0x04E4,
+
+ [ECMR] = 0x0500,
+ [ECSR] = 0x0510,
+@@ -200,6 +203,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
+ [CERCR] = 0x0768,
+ [CEECR] = 0x0770,
+ [MAFCR] = 0x0778,
++ [RMII_MII] = 0x0790,
+
+ [ARSTR] = 0x0000,
+ [TSU_CTRST] = 0x0004,
+@@ -377,7 +381,7 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
+ /*
+ * Register's bits
+ */
+-#ifdef CONFIG_CPU_SUBTYPE_SH7763
++#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
+ /* EDSR */
+ enum EDSR_BIT {
+ EDSR_ENT = 0x01, EDSR_ENR = 0x02,
+@@ -751,6 +755,7 @@ struct sh_eth_cpu_data {
+ unsigned rpadir:1; /* E-DMAC have RPADIR */
+ unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */
+ unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */
++ unsigned hw_crc:1; /* E-DMAC have CSMR */
+ };
+
+ struct sh_eth_private {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0094-net-sh_eth-fix-endian-check-for-architecture-indepen.patch b/patches.armadillo800eva/0094-net-sh_eth-fix-endian-check-for-architecture-indepen.patch
new file mode 100644
index 00000000000000..a98c2c88fb53fe
--- /dev/null
+++ b/patches.armadillo800eva/0094-net-sh_eth-fix-endian-check-for-architecture-indepen.patch
@@ -0,0 +1,56 @@
+From acb273eabf0abf90201a06494f6b2b11c7caf605 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Thu, 29 Mar 2012 19:32:08 +0000
+Subject: net: sh_eth: fix endian check for architecture independent
+
+SuperH has the "CONFIG_CPU_LITTLE_ENDIAN" and the "__LITTLE_ENDIAN__".
+But, other architecture doesn't have them. So, this patch fixes it.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 10b9194f959608368ed89df1937f17cfe6bd6d84)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/sh_eth.c | 2 +-
+ drivers/net/ethernet/renesas/sh_eth.h | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index 8bdf070..d63e09b 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -804,7 +804,7 @@ static int sh_eth_dev_init(struct net_device *ndev)
+ /* all sh_eth int mask */
+ sh_eth_write(ndev, 0, EESIPR);
+
+-#if defined(__LITTLE_ENDIAN__)
++#if defined(__LITTLE_ENDIAN)
+ if (mdp->cd->hw_swap)
+ sh_eth_write(ndev, EDMR_EL, EDMR);
+ else
+diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+index e66de18..0fa14af 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.h
++++ b/drivers/net/ethernet/renesas/sh_eth.h
+@@ -693,7 +693,7 @@ enum TSU_FWSLC_BIT {
+ */
+ struct sh_eth_txdesc {
+ u32 status; /* TD0 */
+-#if defined(CONFIG_CPU_LITTLE_ENDIAN)
++#if defined(__LITTLE_ENDIAN)
+ u16 pad0; /* TD1 */
+ u16 buffer_length; /* TD1 */
+ #else
+@@ -710,7 +710,7 @@ struct sh_eth_txdesc {
+ */
+ struct sh_eth_rxdesc {
+ u32 status; /* RD0 */
+-#if defined(CONFIG_CPU_LITTLE_ENDIAN)
++#if defined(__LITTLE_ENDIAN)
+ u16 frame_length; /* RD1 */
+ u16 buffer_length; /* RD1 */
+ #else
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0095-net-sh_eth-add-support-R8A7740.patch b/patches.armadillo800eva/0095-net-sh_eth-add-support-R8A7740.patch
new file mode 100644
index 00000000000000..779e9e6e1a2f5e
--- /dev/null
+++ b/patches.armadillo800eva/0095-net-sh_eth-add-support-R8A7740.patch
@@ -0,0 +1,211 @@
+From 96f83b7e39c9f99d4436562b1e0abe12c9c2f9c0 Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 4 Apr 2012 18:37:10 +0000
+Subject: net: sh_eth: add support R8A7740
+
+The R8A7740 has a Gigabit Ethernet MAC. This patch supports it.
+
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+(cherry picked from commit 73a0d907301ece200d32b4e8ba2da2ca296b507f)
+
+N.B: This patch is not present upstream yet
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/net/ethernet/renesas/Kconfig | 7 +-
+ drivers/net/ethernet/renesas/sh_eth.c | 114 ++++++++++++++++++++++++++++++++-
+ drivers/net/ethernet/renesas/sh_eth.h | 5 +-
+ 3 files changed, 120 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig
+index 20cbf26..cdac706 100644
+--- a/drivers/net/ethernet/renesas/Kconfig
++++ b/drivers/net/ethernet/renesas/Kconfig
+@@ -4,11 +4,11 @@
+
+ config SH_ETH
+ tristate "Renesas SuperH Ethernet support"
+- depends on SUPERH && \
++ depends on (SUPERH || ARCH_SHMOBILE) && \
+ (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \
+ CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \
+ CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7734 || \
+- CPU_SUBTYPE_SH7757)
++ CPU_SUBTYPE_SH7757 || ARCH_R8A7740)
+ select CRC32
+ select MII
+ select MDIO_BITBANG
+@@ -16,4 +16,5 @@ config SH_ETH
+ ---help---
+ Renesas SuperH Ethernet device driver.
+ This driver supporting CPUs are:
+- - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763 and SH7757.
++ - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763, SH7757,
++ and R8A7740.
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
+index d63e09b..be3c221 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -386,6 +386,114 @@ static void sh_eth_reset_hw_crc(struct net_device *ndev)
+ sh_eth_write(ndev, 0x0, CSMR);
+ }
+
++#elif defined(CONFIG_ARCH_R8A7740)
++#define SH_ETH_HAS_TSU 1
++static void sh_eth_chip_reset(struct net_device *ndev)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++ unsigned long mii;
++
++ /* reset device */
++ sh_eth_tsu_write(mdp, ARSTR_ARSTR, ARSTR);
++ mdelay(1);
++
++ switch (mdp->phy_interface) {
++ case PHY_INTERFACE_MODE_GMII:
++ mii = 2;
++ break;
++ case PHY_INTERFACE_MODE_MII:
++ mii = 1;
++ break;
++ case PHY_INTERFACE_MODE_RMII:
++ default:
++ mii = 0;
++ break;
++ }
++ sh_eth_write(ndev, mii, RMII_MII);
++}
++
++static void sh_eth_reset(struct net_device *ndev)
++{
++ int cnt = 100;
++
++ sh_eth_write(ndev, EDSR_ENALL, EDSR);
++ sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER, EDMR);
++ while (cnt > 0) {
++ if (!(sh_eth_read(ndev, EDMR) & 0x3))
++ break;
++ mdelay(1);
++ cnt--;
++ }
++ if (cnt == 0)
++ printk(KERN_ERR "Device reset fail\n");
++
++ /* Table Init */
++ sh_eth_write(ndev, 0x0, TDLAR);
++ sh_eth_write(ndev, 0x0, TDFAR);
++ sh_eth_write(ndev, 0x0, TDFXR);
++ sh_eth_write(ndev, 0x0, TDFFR);
++ sh_eth_write(ndev, 0x0, RDLAR);
++ sh_eth_write(ndev, 0x0, RDFAR);
++ sh_eth_write(ndev, 0x0, RDFXR);
++ sh_eth_write(ndev, 0x0, RDFFR);
++}
++
++static void sh_eth_set_duplex(struct net_device *ndev)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++
++ if (mdp->duplex) /* Full */
++ sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | ECMR_DM, ECMR);
++ else /* Half */
++ sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_DM, ECMR);
++}
++
++static void sh_eth_set_rate(struct net_device *ndev)
++{
++ struct sh_eth_private *mdp = netdev_priv(ndev);
++
++ switch (mdp->speed) {
++ case 10: /* 10BASE */
++ sh_eth_write(ndev, GECMR_10, GECMR);
++ break;
++ case 100:/* 100BASE */
++ sh_eth_write(ndev, GECMR_100, GECMR);
++ break;
++ case 1000: /* 1000BASE */
++ sh_eth_write(ndev, GECMR_1000, GECMR);
++ break;
++ default:
++ break;
++ }
++}
++
++/* R8A7740 */
++static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
++ .chip_reset = sh_eth_chip_reset,
++ .set_duplex = sh_eth_set_duplex,
++ .set_rate = sh_eth_set_rate,
++
++ .ecsr_value = ECSR_ICD | ECSR_MPD,
++ .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP,
++ .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
++
++ .tx_check = EESR_TC1 | EESR_FTC,
++ .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | \
++ EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | \
++ EESR_ECI,
++ .tx_error_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_TDE | \
++ EESR_TFE,
++
++ .apr = 1,
++ .mpr = 1,
++ .tpauser = 1,
++ .bculr = 1,
++ .hw_swap = 1,
++ .no_trimd = 1,
++ .no_ade = 1,
++ .tsu = 1,
++};
++
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7619)
+ #define SH_ETH_RESET_DEFAULT 1
+ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
+@@ -443,7 +551,7 @@ static void sh_eth_reset(struct net_device *ndev)
+ }
+ #endif
+
+-#if defined(CONFIG_CPU_SH4)
++#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
+ static void sh_eth_set_receive_align(struct sk_buff *skb)
+ {
+ int reserve;
+@@ -919,6 +1027,10 @@ static int sh_eth_rx(struct net_device *ndev)
+ desc_status = edmac_to_cpu(mdp, rxdesc->status);
+ pkt_len = rxdesc->frame_length;
+
++#if defined(CONFIG_ARCH_R8A7740)
++ desc_status >>= 16;
++#endif
++
+ if (--boguscnt < 0)
+ break;
+
+diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
+index 0fa14af..57b8e1f 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.h
++++ b/drivers/net/ethernet/renesas/sh_eth.h
+@@ -372,7 +372,7 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
+ };
+
+ /* Driver's parameters */
+-#if defined(CONFIG_CPU_SH4)
++#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
+ #define SH4_SKB_RX_ALIGN 32
+ #else
+ #define SH2_SH3_SKB_RX_ALIGN 2
+@@ -381,7 +381,8 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
+ /*
+ * Register's bits
+ */
+-#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
++#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) ||\
++ defined(CONFIG_ARCH_R8A7740)
+ /* EDSR */
+ enum EDSR_BIT {
+ EDSR_ENT = 0x01, EDSR_ENR = 0x02,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0096-atomic-use-linux-atomic.h.patch b/patches.armadillo800eva/0096-atomic-use-linux-atomic.h.patch
new file mode 100644
index 00000000000000..9f0d056935e4aa
--- /dev/null
+++ b/patches.armadillo800eva/0096-atomic-use-linux-atomic.h.patch
@@ -0,0 +1,480 @@
+From 70f3283955786c63da5b5003986805f6b74ad5d4 Mon Sep 17 00:00:00 2001
+From: Arun Sharma <asharma@fb.com>
+Date: Tue, 26 Jul 2011 16:09:06 -0700
+Subject: atomic: use <linux/atomic.h>
+
+This allows us to move duplicated code in <asm/atomic.h>
+(atomic_inc_not_zero() for now) to <linux/atomic.h>
+
+Signed-off-by: Arun Sharma <asharma@fb.com>
+Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
+Cc: Ingo Molnar <mingo@elte.hu>
+Cc: David Miller <davem@davemloft.net>
+Cc: Eric Dumazet <eric.dumazet@gmail.com>
+Acked-by: Mike Frysinger <vapier@gentoo.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+(cherry picked from commit 60063497a95e716c9a689af3be2687d261f115b4)
+
+Conflicts:
+
+ arch/alpha/include/asm/atomic.h
+ arch/alpha/include/asm/local.h
+ arch/alpha/kernel/perf_event.c
+ arch/alpha/kernel/smp.c
+ arch/alpha/lib/dec_and_lock.c
+ arch/arm/include/asm/atomic.h
+ arch/arm/kernel/smp.c
+ arch/arm/kernel/traps.c
+ arch/arm/mach-at91/pm.c
+ arch/arm/mach-bcmring/dma.c
+ arch/arm/mach-cns3xxx/include/mach/pm.h
+ arch/arm/mach-cns3xxx/pm.c
+ arch/arm/mach-omap1/pm.c
+ arch/arm/mach-s3c2440/clock.c
+ arch/arm/mach-s3c2440/s3c2442.c
+ arch/arm/mach-s3c2440/s3c244x-clock.c
+ arch/avr32/include/asm/atomic.h
+ arch/blackfin/include/asm/atomic.h
+ arch/blackfin/include/asm/dma.h
+ arch/blackfin/include/asm/ipipe.h
+ arch/blackfin/include/asm/spinlock.h
+ arch/blackfin/kernel/ftrace.c
+ arch/blackfin/kernel/ipipe.c
+ arch/blackfin/kernel/nmi.c
+ arch/blackfin/mach-common/smp.c
+ arch/cris/arch-v32/drivers/cryptocop.c
+ arch/cris/arch-v32/kernel/smp.c
+ arch/cris/include/asm/atomic.h
+ arch/cris/include/asm/bitops.h
+ arch/cris/kernel/process.c
+ arch/frv/include/asm/atomic.h
+ arch/frv/include/asm/hardirq.h
+ arch/frv/kernel/irq.c
+ arch/h8300/include/asm/atomic.h
+ arch/ia64/include/asm/atomic.h
+ arch/ia64/include/asm/processor.h
+ arch/ia64/include/asm/spinlock.h
+ arch/ia64/kernel/smp.c
+ arch/ia64/kernel/smpboot.c
+ arch/ia64/kernel/uncached.c
+ arch/m32r/include/asm/atomic.h
+ arch/m32r/include/asm/mmu_context.h
+ arch/m32r/include/asm/spinlock.h
+ arch/m32r/kernel/smp.c
+ arch/m32r/kernel/traps.c
+ arch/m68k/include/asm/atomic.h
+ arch/microblaze/include/asm/mmu_context_mm.h
+ arch/microblaze/include/asm/prom.h
+ arch/mips/include/asm/atomic.h
+ arch/mips/include/asm/hw_irq.h
+ arch/mips/include/asm/local.h
+ arch/mips/include/asm/smp.h
+ arch/mips/kernel/irq.c
+ arch/mips/kernel/mips-mt.c
+ arch/mips/kernel/rtlx.c
+ arch/mips/kernel/smp-cmp.c
+ arch/mips/kernel/smp-mt.c
+ arch/mips/kernel/smp.c
+ arch/mips/kernel/smtc-proc.c
+ arch/mips/kernel/smtc.c
+ arch/mips/kernel/sync-r4k.c
+ arch/mips/kernel/vpe.c
+ arch/mips/mipssim/sim_smtc.c
+ arch/mips/sgi-ip27/ip27-nmi.c
+ arch/mn10300/include/asm/atomic.h
+ arch/mn10300/include/asm/mmu_context.h
+ arch/mn10300/include/asm/spinlock.h
+ arch/mn10300/include/asm/system.h
+ arch/mn10300/kernel/mn10300-watchdog.c
+ arch/mn10300/kernel/traps.c
+ arch/mn10300/mm/misalignment.c
+ arch/mn10300/proc-mn2ws0050/proc-init.c
+ arch/parisc/include/asm/atomic.h
+ arch/parisc/include/asm/bitops.h
+ arch/parisc/include/asm/mmu_context.h
+ arch/parisc/kernel/parisc_ksyms.c
+ arch/parisc/kernel/smp.c
+ arch/parisc/kernel/traps.c
+ arch/parisc/lib/bitops.c
+ arch/powerpc/include/asm/atomic.h
+ arch/powerpc/include/asm/emulated_ops.h
+ arch/powerpc/include/asm/irq.h
+ arch/powerpc/include/asm/local.h
+ arch/powerpc/include/asm/prom.h
+ arch/powerpc/kernel/of_platform.c
+ arch/powerpc/kernel/ppc_ksyms.c
+ arch/powerpc/kernel/rtas.c
+ arch/powerpc/kernel/rtasd.c
+ arch/powerpc/kernel/smp-tbsync.c
+ arch/powerpc/kernel/smp.c
+ arch/powerpc/platforms/83xx/km83xx.c
+ arch/powerpc/platforms/83xx/mpc832x_mds.c
+ arch/powerpc/platforms/83xx/mpc834x_itx.c
+ arch/powerpc/platforms/83xx/mpc834x_mds.c
+ arch/powerpc/platforms/83xx/mpc836x_mds.c
+ arch/powerpc/platforms/83xx/sbc834x.c
+ arch/powerpc/platforms/85xx/mpc85xx_cds.c
+ arch/powerpc/platforms/85xx/mpc85xx_mds.c
+ arch/powerpc/platforms/85xx/sbc8548.c
+ arch/powerpc/platforms/cell/cpufreq_spudemand.c
+ arch/powerpc/platforms/cell/smp.c
+ arch/powerpc/platforms/cell/spufs/context.c
+ arch/powerpc/platforms/chrp/smp.c
+ arch/powerpc/platforms/iseries/smp.c
+ arch/powerpc/platforms/powermac/backlight.c
+ arch/powerpc/platforms/powermac/smp.c
+ arch/powerpc/platforms/pseries/eeh.c
+ arch/powerpc/platforms/pseries/eeh_cache.c
+ arch/powerpc/platforms/pseries/smp.c
+ arch/powerpc/sysdev/fsl_soc.c
+ arch/powerpc/sysdev/tsi108_dev.c
+ arch/s390/include/asm/atomic.h
+ arch/s390/kernel/dis.c
+ arch/s390/kernel/traps.c
+ arch/sh/include/asm/atomic.h
+ arch/sh/include/asm/hw_irq.h
+ arch/sh/include/asm/smp.h
+ arch/sh/kernel/idle.c
+ arch/sh/kernel/smp.c
+ arch/sh/kernel/traps_64.c
+ arch/sh/kernel/unwinder.c
+ arch/sparc/include/asm/atomic_32.h
+ arch/sparc/include/asm/atomic_64.h
+ arch/sparc/include/asm/prom.h
+ arch/sparc/include/asm/smp_32.h
+ arch/sparc/include/asm/smp_64.h
+ arch/sparc/kernel/irq_64.c
+ arch/sparc/kernel/leon_smp.c
+ arch/sparc/kernel/perf_event.c
+ arch/sparc/kernel/smp_32.c
+ arch/sparc/kernel/smp_64.c
+ arch/sparc/lib/atomic32.c
+ arch/tile/include/asm/atomic.h
+ arch/tile/include/asm/atomic_32.h
+ arch/tile/include/asm/atomic_64.h
+ arch/tile/include/asm/bitops_32.h
+ arch/tile/include/asm/bitops_64.h
+ arch/tile/include/asm/spinlock_32.h
+ arch/tile/kernel/intvec_32.S
+ arch/tile/lib/atomic_32.c
+ arch/tile/lib/atomic_asm_32.S
+ arch/x86/ia32/sys_ia32.c
+ arch/x86/include/asm/apic.h
+ arch/x86/include/asm/atomic.h
+ arch/x86/include/asm/hw_irq.h
+ arch/x86/include/asm/local.h
+ arch/x86/include/asm/mce.h
+ arch/x86/include/asm/mmu_context.h
+ arch/x86/include/asm/prom.h
+ arch/x86/include/asm/spinlock.h
+ arch/x86/include/asm/thread_info.h
+ arch/x86/kernel/amd_gart_64.c
+ arch/x86/kernel/apic/apic.c
+ arch/x86/kernel/apic/es7000_32.c
+ arch/x86/kernel/cpu/common.c
+ arch/x86/kernel/i8259.c
+ arch/x86/kernel/irqinit.c
+ arch/x86/kernel/traps.c
+ arch/x86/kvm/lapic.c
+ arch/x86/kvm/timer.c
+ arch/x86/lib/atomic64_32.c
+ arch/x86/mm/mmio-mod.c
+ arch/xtensa/include/asm/atomic.h
+ arch/xtensa/kernel/process.c
+ crypto/af_alg.c
+ crypto/proc.c
+ crypto/rng.c
+ drivers/atm/ambassador.c
+ drivers/atm/atmtcp.c
+ drivers/atm/eni.c
+ drivers/atm/eni.h
+ drivers/atm/firestream.c
+ drivers/atm/fore200e.c
+ drivers/atm/horizon.c
+ drivers/atm/idt77252.c
+ drivers/atm/iphase.c
+ drivers/atm/nicstar.c
+ drivers/atm/suni.c
+ drivers/atm/uPD98402.c
+ drivers/atm/zatm.c
+ drivers/base/memory.c
+ drivers/base/power/sysfs.c
+ drivers/block/cciss_scsi.c
+ drivers/char/ipmi/ipmi_watchdog.c
+ drivers/char/mspec.c
+ drivers/connector/cn_proc.c
+ drivers/edac/edac_stub.c
+ drivers/firewire/core-card.c
+ drivers/firewire/core-device.c
+ drivers/firewire/core-topology.c
+ drivers/firewire/core.h
+ drivers/firewire/nosy.c
+ drivers/gpu/drm/radeon/radeon.h
+ drivers/gpu/drm/radeon/radeon_fence.c
+ drivers/gpu/drm/ttm/ttm_bo.c
+ drivers/gpu/drm/ttm/ttm_lock.c
+ drivers/gpu/drm/ttm/ttm_object.c
+ drivers/gpu/drm/ttm/ttm_page_alloc.c
+ drivers/hwmon/sht15.c
+ drivers/infiniband/hw/cxgb4/mem.c
+ drivers/infiniband/hw/ehca/ehca_tools.h
+ drivers/infiniband/hw/nes/nes_cm.c
+ drivers/infiniband/ulp/ipoib/ipoib.h
+ drivers/infiniband/ulp/srp/ib_srp.c
+ drivers/isdn/gigaset/gigaset.h
+ drivers/md/dm-crypt.c
+ drivers/md/dm-kcopyd.c
+ drivers/md/dm-mpath.c
+ drivers/md/dm-queue-length.c
+ drivers/md/dm-table.c
+ drivers/media/video/hdpvr/hdpvr-core.c
+ drivers/media/video/tlg2300/pd-dvb.c
+ drivers/media/video/uvc/uvc_ctrl.c
+ drivers/media/video/uvc/uvc_queue.c
+ drivers/media/video/uvc/uvc_v4l2.c
+ drivers/media/video/uvc/uvc_video.c
+ drivers/message/i2o/i2o_scsi.c
+ drivers/misc/phantom.c
+ drivers/net/atlx/atl1.c
+ drivers/net/atlx/atl2.c
+ drivers/net/atlx/atl2.h
+ drivers/net/cassini.c
+ drivers/net/cpmac.c
+ drivers/net/cxgb3/cxgb3_offload.c
+ drivers/net/cxgb3/l2t.h
+ drivers/net/cxgb3/t3cdev.h
+ drivers/net/cxgb4/cxgb4_uld.h
+ drivers/net/cxgb4/l2t.h
+ drivers/net/hamradio/6pack.c
+ drivers/net/hamradio/dmascc.c
+ drivers/net/ibmveth.c
+ drivers/net/phy/phy.c
+ drivers/net/ppp_generic.c
+ drivers/net/wimax/i2400m/i2400m.h
+ drivers/net/wireless/b43legacy/b43legacy.h
+ drivers/net/wireless/b43legacy/dma.h
+ drivers/oprofile/oprofile_stats.h
+ drivers/pci/hotplug/cpci_hotplug_core.c
+ drivers/pci/xen-pcifront.c
+ drivers/s390/block/dasd_eer.c
+ drivers/s390/char/sclp_quiesce.c
+ drivers/s390/char/vmlogrdr.c
+ drivers/s390/cio/device.h
+ drivers/s390/cio/qdio_main.c
+ drivers/s390/cio/qdio_thinint.c
+ drivers/s390/crypto/ap_bus.c
+ drivers/s390/crypto/zcrypt_api.c
+ drivers/s390/crypto/zcrypt_cex2a.c
+ drivers/s390/crypto/zcrypt_mono.c
+ drivers/s390/crypto/zcrypt_pcica.c
+ drivers/s390/crypto/zcrypt_pcicc.c
+ drivers/s390/crypto/zcrypt_pcixcc.c
+ drivers/s390/net/fsm.h
+ drivers/s390/scsi/zfcp_scsi.c
+ drivers/sbus/char/display7seg.c
+ drivers/scsi/dpt/dpti_i2o.h
+ drivers/scsi/hpsa.c
+ drivers/scsi/pm8001/pm8001_sas.h
+ drivers/staging/octeon/ethernet-rx.c
+ drivers/staging/octeon/ethernet-tx.c
+ drivers/staging/solo6x10/solo6x10.h
+ drivers/staging/tidspbridge/include/dspbridge/host_os.h
+ drivers/staging/winbond/mds_s.h
+ drivers/staging/winbond/wb35reg_s.h
+ drivers/tty/bfin_jtag_comm.c
+ drivers/tty/rocket.c
+ drivers/tty/serial/dz.c
+ drivers/tty/serial/sb1250-duart.c
+ drivers/tty/serial/zs.c
+ drivers/usb/gadget/f_audio.c
+ drivers/usb/gadget/f_rndis.c
+ drivers/usb/gadget/uvc_queue.c
+ drivers/usb/image/microtek.c
+ drivers/usb/misc/appledisplay.c
+ drivers/usb/serial/garmin_gps.c
+ drivers/usb/wusbcore/wa-rpipe.c
+ drivers/vhost/vhost.h
+ drivers/video/vermilion/vermilion.h
+ drivers/w1/masters/matrox_w1.c
+ drivers/w1/w1.c
+ drivers/w1/w1_family.h
+ drivers/watchdog/intel_scu_watchdog.c
+ drivers/watchdog/sbc7240_wdt.c
+ fs/btrfs/delayed-inode.h
+ fs/direct-io.c
+ fs/eventpoll.c
+ fs/file_table.c
+ fs/gfs2/main.c
+ fs/nfs/cache_lib.h
+ fs/nfs/direct.c
+ fs/notify/group.c
+ fs/notify/inode_mark.c
+ fs/notify/mark.c
+ fs/notify/notification.c
+ fs/notify/vfsmount_mark.c
+ fs/ntfs/inode.h
+ fs/posix_acl.c
+ fs/proc/meminfo.c
+ include/acpi/platform/aclinux.h
+ include/asm-generic/atomic.h
+ include/asm-generic/local.h
+ include/asm-generic/local64.h
+ include/drm/ttm/ttm_lock.h
+ include/linux/aio.h
+ include/linux/atmdev.h
+ include/linux/atomic.h
+ include/linux/backing-dev.h
+ include/linux/bit_spinlock.h
+ include/linux/buffer_head.h
+ include/linux/configfs.h
+ include/linux/connector.h
+ include/linux/cred.h
+ include/linux/crypto.h
+ include/linux/dcache.h
+ include/linux/debug_locks.h
+ include/linux/device.h
+ include/linux/edac.h
+ include/linux/fault-inject.h
+ include/linux/fdtable.h
+ include/linux/filter.h
+ include/linux/firewire.h
+ include/linux/fsnotify_backend.h
+ include/linux/interrupt.h
+ include/linux/jump_label.h
+ include/linux/kdb.h
+ include/linux/key.h
+ include/linux/kgdb.h
+ include/linux/kobject.h
+ include/linux/mlx4/device.h
+ include/linux/mman.h
+ include/linux/mmzone.h
+ include/linux/mount.h
+ include/linux/mutex.h
+ include/linux/netdevice.h
+ include/linux/nfs_fs_sb.h
+ include/linux/oprofile.h
+ include/linux/pci.h
+ include/linux/perf_event.h
+ include/linux/phy.h
+ include/linux/proc_fs.h
+ include/linux/quota.h
+ include/linux/rwsem.h
+ include/linux/sem.h
+ include/linux/skbuff.h
+ include/linux/sonet.h
+ include/linux/spinlock.h
+ include/linux/sunrpc/auth.h
+ include/linux/sunrpc/cache.h
+ include/linux/sunrpc/timer.h
+ include/linux/swap.h
+ include/linux/sysfs.h
+ include/linux/vmstat.h
+ include/linux/workqueue.h
+ include/net/ax25.h
+ include/net/cipso_ipv4.h
+ include/net/flow.h
+ include/net/inet_hashtables.h
+ include/net/inet_timewait_sock.h
+ include/net/inetpeer.h
+ include/net/ip_vs.h
+ include/net/lib80211.h
+ include/net/llc.h
+ include/net/neighbour.h
+ include/net/net_namespace.h
+ include/net/netfilter/nf_conntrack.h
+ include/net/netlabel.h
+ include/net/netns/conntrack.h
+ include/net/sctp/structs.h
+ include/pcmcia/ds.h
+ include/rdma/ib_sa.h
+ include/rdma/ib_verbs.h
+ include/rxrpc/types.h
+ include/scsi/scsi_device.h
+ kernel/audit.c
+ kernel/auditsc.c
+ kernel/cgroup.c
+ kernel/cpuset.c
+ kernel/debug/debug_core.c
+ kernel/rcupdate.c
+ kernel/rcutorture.c
+ kernel/rcutree_trace.c
+ kernel/rwsem.c
+ kernel/stop_machine.c
+ kernel/taskstats.c
+ kernel/trace/trace.h
+ kernel/trace/trace_mmiotrace.c
+ lib/atomic64.c
+ lib/atomic64_test.c
+ lib/crc32.c
+ lib/dec_and_lock.c
+ mm/init-mm.c
+ mm/kmemleak.c
+ mm/slob.c
+ mm/vmalloc.c
+ net/atm/atm_misc.c
+ net/atm/clip.c
+ net/atm/common.c
+ net/atm/lec.c
+ net/atm/proc.c
+ net/bridge/br_fdb.c
+ net/core/flow.c
+ net/decnet/dn_fib.c
+ net/decnet/dn_neigh.c
+ net/decnet/dn_table.c
+ net/decnet/dn_timer.c
+ net/ipv4/cipso_ipv4.c
+ net/ipv4/raw.c
+ net/ipv6/ip6_tunnel.c
+ net/iucv/iucv.c
+ net/l2tp/l2tp_core.c
+ net/l2tp/l2tp_ppp.c
+ net/netfilter/nfnetlink_log.c
+ net/netfilter/nfnetlink_queue.c
+ net/netlabel/netlabel_cipso_v4.c
+ net/netlabel/netlabel_kapi.c
+ net/netlabel/netlabel_mgmt.c
+ net/netlabel/netlabel_mgmt.h
+ net/netlabel/netlabel_unlabeled.c
+ net/sunrpc/xprtrdma/xprt_rdma.h
+ net/tipc/core.h
+ security/selinux/hooks.c
+ security/selinux/xfrm.c
+ sound/pci/echoaudio/darla20.c
+ sound/pci/echoaudio/darla24.c
+ sound/pci/echoaudio/echo3g.c
+ sound/pci/echoaudio/gina20.c
+ sound/pci/echoaudio/gina24.c
+ sound/pci/echoaudio/indigo.c
+ sound/pci/echoaudio/indigodj.c
+ sound/pci/echoaudio/indigodjx.c
+ sound/pci/echoaudio/indigoio.c
+ sound/pci/echoaudio/indigoiox.c
+ sound/pci/echoaudio/layla20.c
+ sound/pci/echoaudio/layla24.c
+ sound/pci/echoaudio/mia.c
+ sound/pci/echoaudio/mona.c
+ sound/pci/lx6464es/lx6464es.h
+ sound/sparc/dbri.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 019dbd3..b048417 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -24,7 +24,7 @@
+ #include <linux/backlight.h>
+ #include <linux/gpio.h>
+ #include <video/sh_mobile_lcdc.h>
+-#include <asm/atomic.h>
++#include <linux/atomic.h>
+
+ #include "sh_mobile_lcdcfb.h"
+ #include "sh_mobile_meram.h"
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0097-fbdev-sh_mobile_meram-Enable-runtime-PM.patch b/patches.armadillo800eva/0097-fbdev-sh_mobile_meram-Enable-runtime-PM.patch
new file mode 100644
index 00000000000000..c7b9dd69b88a2e
--- /dev/null
+++ b/patches.armadillo800eva/0097-fbdev-sh_mobile_meram-Enable-runtime-PM.patch
@@ -0,0 +1,46 @@
+From 2e680868e989715d2893a5a256c0a8339dd55d67 Mon Sep 17 00:00:00 2001
+From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+Date: Mon, 4 Jul 2011 08:06:11 +0200
+Subject: fbdev: sh_mobile_meram: Enable runtime PM
+
+Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+(cherry picked from commit 176737782e8360f1e577264c7aaeb691a7cbbfdd)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index cc7d732..34efd8a 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -12,6 +12,7 @@
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/device.h>
++#include <linux/pm_runtime.h>
+ #include <linux/io.h>
+ #include <linux/slab.h>
+ #include <linux/platform_device.h>
+@@ -515,6 +516,8 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+ if (pdata->addr_mode == SH_MOBILE_MERAM_MODE1)
+ meram_write_reg(priv->base, MEVCR1, 1 << 29);
+
++ pm_runtime_enable(&pdev->dev);
++
+ dev_info(&pdev->dev, "sh_mobile_meram initialized.");
+
+ return 0;
+@@ -530,6 +533,8 @@ static int sh_mobile_meram_remove(struct platform_device *pdev)
+ {
+ struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
+
++ pm_runtime_disable(&pdev->dev);
++
+ if (priv->base)
+ iounmap(priv->base);
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0098-fbdev-sh_mobile_meram-Enable-disable-MERAM-along-wit.patch b/patches.armadillo800eva/0098-fbdev-sh_mobile_meram-Enable-disable-MERAM-along-wit.patch
new file mode 100644
index 00000000000000..60241d6688ace0
--- /dev/null
+++ b/patches.armadillo800eva/0098-fbdev-sh_mobile_meram-Enable-disable-MERAM-along-wit.patch
@@ -0,0 +1,41 @@
+From 08c7a79e11d3a62dc42e836d9c167c1645f0b14e Mon Sep 17 00:00:00 2001
+From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+Date: Mon, 4 Jul 2011 08:06:47 +0200
+Subject: fbdev: sh_mobile_meram: Enable/disable MERAM along with LCDC
+
+The MERAM reference counts should be tied to the two LCDC devices (LCD/HDMI)
+so that when they are enable/disabled, the MERAM is as well.
+
+Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+(cherry picked from commit ec19b9e0fa808d82ad996d73358a5b06a565b78b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index b048417..2f921ad 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -259,6 +259,8 @@ static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
+ pm_runtime_get_sync(priv->dev);
+ if (priv->dot_clk)
+ clk_enable(priv->dot_clk);
++ if (priv->meram_dev && priv->meram_dev->pdev)
++ pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
+ }
+ }
+
+@@ -267,6 +269,8 @@ static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
+ if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
+ if (priv->dot_clk)
+ clk_disable(priv->dot_clk);
++ if (priv->meram_dev && priv->meram_dev->pdev)
++ pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
+ pm_runtime_put(priv->dev);
+ }
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0099-fbdev-sh_mobile_meram-Move-private-data-from-.h-to-..patch b/patches.armadillo800eva/0099-fbdev-sh_mobile_meram-Move-private-data-from-.h-to-..patch
new file mode 100644
index 00000000000000..9b6c63877dd4f7
--- /dev/null
+++ b/patches.armadillo800eva/0099-fbdev-sh_mobile_meram-Move-private-data-from-.h-to-..patch
@@ -0,0 +1,58 @@
+From 7468303594359b92b0beaa4fd090cb7875ba156e Mon Sep 17 00:00:00 2001
+From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+Date: Wed, 22 Jun 2011 07:49:50 +0200
+Subject: fbdev: sh_mobile_meram: Move private data from .h to .c
+
+There is no reason for sh_mobile_meram_priv to be in the .h file
+since it should be private to sh_mobile_meram.c
+
+Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+(cherry picked from commit 0aa492be88b10b7b7621101df5fbf79f9236aecb)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 8 ++++++++
+ drivers/video/sh_mobile_meram.h | 8 --------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 34efd8a..cfa1a78 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -37,6 +37,14 @@
+ #define MEQSEL1 0x40
+ #define MEQSEL2 0x44
+
++struct sh_mobile_meram_priv {
++ void __iomem *base;
++ struct mutex lock;
++ unsigned long used_icb;
++ int used_meram_cache_regions;
++ unsigned long used_meram_cache[SH_MOBILE_MERAM_ICB_NUM];
++};
++
+ /* settings */
+ #define MERAM_SEC_LINE 15
+ #define MERAM_LINE_WIDTH 2048
+diff --git a/drivers/video/sh_mobile_meram.h b/drivers/video/sh_mobile_meram.h
+index 82c54fb..1615204b 100644
+--- a/drivers/video/sh_mobile_meram.h
++++ b/drivers/video/sh_mobile_meram.h
+@@ -17,14 +17,6 @@
+ #define SH_MOBILE_MERAM_CACHE_OFFSET(p) ((p) >> 16)
+ #define SH_MOBILE_MERAM_CACHE_SIZE(p) ((p) & 0xffff)
+
+-struct sh_mobile_meram_priv {
+- void __iomem *base;
+- struct mutex lock;
+- unsigned long used_icb;
+- int used_meram_cache_regions;
+- unsigned long used_meram_cache[SH_MOBILE_MERAM_ICB_NUM];
+-};
+-
+ int sh_mobile_meram_alloc_icb(const struct sh_mobile_meram_cfg *cfg,
+ int xres,
+ int yres,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0100-fbdev-sh_mobile_meram-Backup-restore-device-register.patch b/patches.armadillo800eva/0100-fbdev-sh_mobile_meram-Backup-restore-device-register.patch
new file mode 100644
index 00000000000000..1c5fe16c2eabfc
--- /dev/null
+++ b/patches.armadillo800eva/0100-fbdev-sh_mobile_meram-Backup-restore-device-register.patch
@@ -0,0 +1,122 @@
+From 07eb0d7f0b84da3bf41c145f3aa555ca6a4ed7b2 Mon Sep 17 00:00:00 2001
+From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+Date: Wed, 22 Jun 2011 07:49:51 +0200
+Subject: fbdev: sh_mobile_meram: Backup/restore device registers on
+ shutdown/resume
+
+Save and reconfigure the MERAM registers when the MERAM is powered down
+and restored
+
+Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+(cherry picked from commit 0b3bb77c3a07a94d878fd3219302c46209f7d71c)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 71 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 71 insertions(+)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index cfa1a78..39f28a1 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -37,12 +37,31 @@
+ #define MEQSEL1 0x40
+ #define MEQSEL2 0x44
+
++static unsigned long common_regs[] = {
++ MEVCR1,
++ MEQSEL1,
++ MEQSEL2,
++};
++#define CMN_REGS_SIZE ARRAY_SIZE(common_regs)
++
++static unsigned long icb_regs[] = {
++ MExxCTL,
++ MExxBSIZE,
++ MExxMNCF,
++ MExxSARA,
++ MExxSARB,
++ MExxSBSIZE,
++};
++#define ICB_REGS_SIZE ARRAY_SIZE(icb_regs)
++
+ struct sh_mobile_meram_priv {
+ void __iomem *base;
+ struct mutex lock;
+ unsigned long used_icb;
+ int used_meram_cache_regions;
+ unsigned long used_meram_cache[SH_MOBILE_MERAM_ICB_NUM];
++ unsigned long cmn_saved_regs[CMN_REGS_SIZE];
++ unsigned long icb_saved_regs[ICB_REGS_SIZE * SH_MOBILE_MERAM_ICB_NUM];
+ };
+
+ /* settings */
+@@ -469,6 +488,57 @@ static int sh_mobile_meram_update(struct sh_mobile_meram_info *pdata,
+ return 0;
+ }
+
++static int sh_mobile_meram_runtime_suspend(struct device *dev)
++{
++ struct platform_device *pdev = to_platform_device(dev);
++ struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
++ int k, j;
++
++ for (k = 0; k < CMN_REGS_SIZE; k++)
++ priv->cmn_saved_regs[k] = meram_read_reg(priv->base,
++ common_regs[k]);
++
++ for (j = 0; j < 32; j++) {
++ if (!test_bit(j, &priv->used_icb))
++ continue;
++ for (k = 0; k < ICB_REGS_SIZE; k++) {
++ priv->icb_saved_regs[j * ICB_REGS_SIZE + k] =
++ meram_read_icb(priv->base, j, icb_regs[k]);
++ /* Reset ICB on resume */
++ if (icb_regs[k] == MExxCTL)
++ priv->icb_saved_regs[j * ICB_REGS_SIZE + k] =
++ 0x70;
++ }
++ }
++ return 0;
++}
++
++static int sh_mobile_meram_runtime_resume(struct device *dev)
++{
++ struct platform_device *pdev = to_platform_device(dev);
++ struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
++ int k, j;
++
++ for (j = 0; j < 32; j++) {
++ if (!test_bit(j, &priv->used_icb))
++ continue;
++ for (k = 0; k < ICB_REGS_SIZE; k++) {
++ meram_write_icb(priv->base, j, icb_regs[k],
++ priv->icb_saved_regs[j * ICB_REGS_SIZE + k]);
++ }
++ }
++
++ for (k = 0; k < CMN_REGS_SIZE; k++)
++ meram_write_reg(priv->base, common_regs[k],
++ priv->cmn_saved_regs[k]);
++ return 0;
++}
++
++static const struct dev_pm_ops sh_mobile_meram_dev_pm_ops = {
++ .runtime_suspend = sh_mobile_meram_runtime_suspend,
++ .runtime_resume = sh_mobile_meram_runtime_resume,
++};
++
+ static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
+ .module = THIS_MODULE,
+ .meram_register = sh_mobile_meram_register,
+@@ -557,6 +627,7 @@ static struct platform_driver sh_mobile_meram_driver = {
+ .driver = {
+ .name = "sh_mobile_meram",
+ .owner = THIS_MODULE,
++ .pm = &sh_mobile_meram_dev_pm_ops,
+ },
+ .probe = sh_mobile_meram_probe,
+ .remove = sh_mobile_meram_remove,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0101-drivercore-Add-helper-macro-for-platform_driver-boil.patch b/patches.armadillo800eva/0101-drivercore-Add-helper-macro-for-platform_driver-boil.patch
new file mode 100644
index 00000000000000..5600f7a31fadae
--- /dev/null
+++ b/patches.armadillo800eva/0101-drivercore-Add-helper-macro-for-platform_driver-boil.patch
@@ -0,0 +1,83 @@
+From 497218122305ec6f9c2db85774b6f3bd2c24fee2 Mon Sep 17 00:00:00 2001
+From: Grant Likely <grant.likely@secretlab.ca>
+Date: Wed, 5 Oct 2011 11:29:49 -0600
+Subject: drivercore: Add helper macro for platform_driver boilerplate
+
+For simple modules that contain a single platform_driver without any
+additional setup code then ends up being a block of duplicated
+boilerplate. This patch adds a new macro, module_platform_driver(),
+which replaces the module_init()/module_exit() registrations with
+template functions.
+
+Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
+Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
+Reviewed-by: Magnus Damm <magnus.damm@gmail.com>
+Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
+(cherry picked from commit 940ab88962bc1aff3273a8356d64577a6e386736)
+
+Conflicts:
+
+ drivers/spi/spi-altera.c
+ drivers/spi/spi-ath79.c
+ drivers/spi/spi-atmel.c
+ drivers/spi/spi-bfin-sport.c
+ drivers/spi/spi-coldfire-qspi.c
+ drivers/spi/spi-davinci.c
+ drivers/spi/spi-dw-mmio.c
+ drivers/spi/spi-ep93xx.c
+ drivers/spi/spi-fsl-espi.c
+ drivers/spi/spi-gpio.c
+ drivers/spi/spi-imx.c
+ drivers/spi/spi-mpc512x-psc.c
+ drivers/spi/spi-mpc52xx-psc.c
+ drivers/spi/spi-mpc52xx.c
+ drivers/spi/spi-nuc900.c
+ drivers/spi/spi-oc-tiny.c
+ drivers/spi/spi-ppc4xx.c
+ drivers/spi/spi-s3c24xx.c
+ drivers/spi/spi-sh-msiof.c
+ drivers/spi/spi-sh-sci.c
+ drivers/spi/spi-sh.c
+ drivers/spi/spi-stmp.c
+ drivers/spi/spi-tegra.c
+ drivers/spi/spi-ti-ssp.c
+ drivers/spi/spi-xilinx.c
+ drivers/tty/serial/of_serial.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ include/linux/platform_device.h | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
+index ede1a80..279f87d 100644
+--- a/include/linux/platform_device.h
++++ b/include/linux/platform_device.h
+@@ -145,6 +145,23 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
+ dev_set_drvdata(&pdev->dev, data);
+ }
+
++/* module_platform_driver() - Helper macro for drivers that don't do
++ * anything special in module init/exit. This eliminates a lot of
++ * boilerplate. Each module may only use this macro once, and
++ * calling it replaces module_init() and module_exit()
++ */
++#define module_platform_driver(__platform_driver) \
++static int __init __platform_driver##_init(void) \
++{ \
++ return platform_driver_register(&(__platform_driver)); \
++} \
++module_init(__platform_driver##_init); \
++static void __exit __platform_driver##_exit(void) \
++{ \
++ platform_driver_unregister(&(__platform_driver)); \
++} \
++module_exit(__platform_driver##_exit);
++
+ extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
+ int (*probe)(struct platform_device *),
+ struct resource *res, unsigned int n_res,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0102-drivercore-Generalize-module_platform_driver.patch b/patches.armadillo800eva/0102-drivercore-Generalize-module_platform_driver.patch
new file mode 100644
index 00000000000000..20cddbc99d5af8
--- /dev/null
+++ b/patches.armadillo800eva/0102-drivercore-Generalize-module_platform_driver.patch
@@ -0,0 +1,85 @@
+From 73339a0d323e34694c75f09eaaf21584c3732829 Mon Sep 17 00:00:00 2001
+From: Lars-Peter Clausen <lars@metafoo.de>
+Date: Wed, 16 Nov 2011 10:13:35 +0100
+Subject: drivercore: Generalize module_platform_driver
+
+This patch generalizes the module_platform_driver macro and introduces a new
+module_driver macro. The module_driver macro takes a driver name, a register
+and a unregister function for this driver type. Using these it construct the
+module init and exit sections which register and unregister the driver. Since
+such init/exit sections are commonly found in drivers this macro can be used
+to eliminate a lot of boilerplate code.
+
+The macro is not intended to be used by driver modules directly, instead it
+should be used to generate bus specific macros for registering drivers like
+the module_platform_driver macro.
+
+Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
+Acked-by: Grant Likely <grant.likely@secretlab.ca>
+Acked-by: Jonathan Cameron <jic23@kernel.org>
+Acked-by: Wolfram Sang <w.sang@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+(cherry picked from commit 907d0ed1c84114d4e8dafd66af982515d3739c90)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ include/linux/device.h | 21 +++++++++++++++++++++
+ include/linux/platform_device.h | 12 ++----------
+ 2 files changed, 23 insertions(+), 10 deletions(-)
+
+diff --git a/include/linux/device.h b/include/linux/device.h
+index 0aa0b62..680656e 100644
+--- a/include/linux/device.h
++++ b/include/linux/device.h
+@@ -974,4 +974,25 @@ extern long sysfs_deprecated;
+ #define sysfs_deprecated 0
+ #endif
+
++/**
++ * module_driver() - Helper macro for drivers that don't do anything
++ * special in module init/exit. This eliminates a lot of boilerplate.
++ * Each module may only use this macro once, and calling it replaces
++ * module_init() and module_exit().
++ *
++ * Use this macro to construct bus specific macros for registering
++ * drivers, and do not use it on its own.
++ */
++#define module_driver(__driver, __register, __unregister) \
++static int __init __driver##_init(void) \
++{ \
++ return __register(&(__driver)); \
++} \
++module_init(__driver##_init); \
++static void __exit __driver##_exit(void) \
++{ \
++ __unregister(&(__driver)); \
++} \
++module_exit(__driver##_exit);
++
+ #endif /* _DEVICE_H_ */
+diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
+index 279f87d..a72760d 100644
+--- a/include/linux/platform_device.h
++++ b/include/linux/platform_device.h
+@@ -151,16 +151,8 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
+ * calling it replaces module_init() and module_exit()
+ */
+ #define module_platform_driver(__platform_driver) \
+-static int __init __platform_driver##_init(void) \
+-{ \
+- return platform_driver_register(&(__platform_driver)); \
+-} \
+-module_init(__platform_driver##_init); \
+-static void __exit __platform_driver##_exit(void) \
+-{ \
+- platform_driver_unregister(&(__platform_driver)); \
+-} \
+-module_exit(__platform_driver##_exit);
++ module_driver(__platform_driver, platform_driver_register, \
++ platform_driver_unregister)
+
+ extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
+ int (*probe)(struct platform_device *),
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0103-fbdev-sh_mobile_lcdc-Turn-dot-clock-on-before-resumi.patch b/patches.armadillo800eva/0103-fbdev-sh_mobile_lcdc-Turn-dot-clock-on-before-resumi.patch
new file mode 100644
index 00000000000000..8ce6a317b3f5fc
--- /dev/null
+++ b/patches.armadillo800eva/0103-fbdev-sh_mobile_lcdc-Turn-dot-clock-on-before-resumi.patch
@@ -0,0 +1,53 @@
+From 08b64fd8ad32aabbe1d838d156b7353518a91f31 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 11 Jul 2011 11:05:49 +0200
+Subject: fbdev: sh_mobile_lcdc: Turn dot clock on before resuming from
+ runtime PM
+
+Resuming from runtime PM restores all LCDC registers. If the dot clock
+is off at that time display panning information will be corrupted.
+
+Turn the dot clock on before resuming from runtime PM. Similarly,
+turn the clock off after suspending the LCDC.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+(cherry picked from commit f1ad90da5c0fcb8841cc5e6d66c56f4005d8c960)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 2f921ad..9135159 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -256,9 +256,9 @@ struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
+ static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
+ {
+ if (atomic_inc_and_test(&priv->hw_usecnt)) {
+- pm_runtime_get_sync(priv->dev);
+ if (priv->dot_clk)
+ clk_enable(priv->dot_clk);
++ pm_runtime_get_sync(priv->dev);
+ if (priv->meram_dev && priv->meram_dev->pdev)
+ pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
+ }
+@@ -267,11 +267,11 @@ static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
+ static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
+ {
+ if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
+- if (priv->dot_clk)
+- clk_disable(priv->dot_clk);
+ if (priv->meram_dev && priv->meram_dev->pdev)
+ pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
+ pm_runtime_put(priv->dev);
++ if (priv->dot_clk)
++ clk_disable(priv->dot_clk);
+ }
+ }
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0104-fbdev-sh_mobile_lcdc-Replace-hardcoded-register-valu.patch b/patches.armadillo800eva/0104-fbdev-sh_mobile_lcdc-Replace-hardcoded-register-valu.patch
new file mode 100644
index 00000000000000..520648818de949
--- /dev/null
+++ b/patches.armadillo800eva/0104-fbdev-sh_mobile_lcdc-Replace-hardcoded-register-valu.patch
@@ -0,0 +1,573 @@
+From 627c7703563e65c2b5b3ca339b325af3deee25a0 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_lcdc: Replace hardcoded register values with macros
+
+Instead of hardcoding register values through the driver, define macros
+for individual register bits using the register name and the bit name,
+and use the macros.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit ce1c0b0873bf4e970970a49612105cf6c36d81e3)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 204 +++++++++++++++++---------------------
+ include/video/sh_mobile_lcdc.h | 135 +++++++++++++++++++++----
+ 2 files changed, 209 insertions(+), 130 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 9135159..84504d5 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -32,20 +32,6 @@
+ #define SIDE_B_OFFSET 0x1000
+ #define MIRROR_OFFSET 0x2000
+
+-/* shared registers */
+-#define _LDDCKR 0x410
+-#define _LDDCKSTPR 0x414
+-#define _LDINTR 0x468
+-#define _LDSR 0x46c
+-#define _LDCNT1R 0x470
+-#define _LDCNT2R 0x474
+-#define _LDRCNTR 0x478
+-#define _LDDDSR 0x47c
+-#define _LDDWD0R 0x800
+-#define _LDDRDR 0x840
+-#define _LDDWAR 0x900
+-#define _LDDRAR 0x904
+-
+ /* shared registers and their order for context save/restore */
+ static int lcdc_shared_regs[] = {
+ _LDDCKR,
+@@ -98,22 +84,6 @@ static unsigned long lcdc_offs_sublcd[NR_CH_REGS] = {
+ [LDPMR] = 0x63c,
+ };
+
+-#define START_LCDC 0x00000001
+-#define LCDC_RESET 0x00000100
+-#define DISPLAY_BEU 0x00000008
+-#define LCDC_ENABLE 0x00000001
+-#define LDINTR_FE 0x00000400
+-#define LDINTR_VSE 0x00000200
+-#define LDINTR_VEE 0x00000100
+-#define LDINTR_FS 0x00000004
+-#define LDINTR_VSS 0x00000002
+-#define LDINTR_VES 0x00000001
+-#define LDRCNTR_SRS 0x00020000
+-#define LDRCNTR_SRC 0x00010000
+-#define LDRCNTR_MRS 0x00000002
+-#define LDRCNTR_MRC 0x00000001
+-#define LDSR_MRS 0x00000100
+-
+ static const struct fb_videomode default_720p = {
+ .name = "HDMI 720p",
+ .xres = 1280,
+@@ -218,33 +188,36 @@ static void lcdc_sys_write_index(void *handle, unsigned long data)
+ {
+ struct sh_mobile_lcdc_chan *ch = handle;
+
+- lcdc_write(ch->lcdc, _LDDWD0R, data | 0x10000000);
+- lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
+- lcdc_write(ch->lcdc, _LDDWAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0));
+- lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
++ lcdc_write(ch->lcdc, _LDDWD0R, data | LDDWDxR_WDACT);
++ lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
++ lcdc_write(ch->lcdc, _LDDWAR, LDDWAR_WA |
++ (lcdc_chan_is_sublcd(ch) ? 2 : 0));
++ lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
+ }
+
+ static void lcdc_sys_write_data(void *handle, unsigned long data)
+ {
+ struct sh_mobile_lcdc_chan *ch = handle;
+
+- lcdc_write(ch->lcdc, _LDDWD0R, data | 0x11000000);
+- lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
+- lcdc_write(ch->lcdc, _LDDWAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0));
+- lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
++ lcdc_write(ch->lcdc, _LDDWD0R, data | LDDWDxR_WDACT | LDDWDxR_RSW);
++ lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
++ lcdc_write(ch->lcdc, _LDDWAR, LDDWAR_WA |
++ (lcdc_chan_is_sublcd(ch) ? 2 : 0));
++ lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
+ }
+
+ static unsigned long lcdc_sys_read_data(void *handle)
+ {
+ struct sh_mobile_lcdc_chan *ch = handle;
+
+- lcdc_write(ch->lcdc, _LDDRDR, 0x01000000);
+- lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
+- lcdc_write(ch->lcdc, _LDDRAR, 1 | (lcdc_chan_is_sublcd(ch) ? 2 : 0));
++ lcdc_write(ch->lcdc, _LDDRDR, LDDRDR_RSR);
++ lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
++ lcdc_write(ch->lcdc, _LDDRAR, LDDRAR_RA |
++ (lcdc_chan_is_sublcd(ch) ? 2 : 0));
+ udelay(1);
+- lcdc_wait_bit(ch->lcdc, _LDSR, 2, 0);
++ lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
+
+- return lcdc_read(ch->lcdc, _LDDRDR) & 0x3ffff;
++ return lcdc_read(ch->lcdc, _LDDRDR) & LDDRDR_DRD_MASK;
+ }
+
+ struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
+@@ -323,13 +296,13 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info,
+ if (bcfg->start_transfer)
+ bcfg->start_transfer(bcfg->board_data, ch,
+ &sh_mobile_lcdc_sys_bus_ops);
+- lcdc_write_chan(ch, LDSM2R, 1);
++ lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
+ dma_unmap_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
+ } else {
+ if (bcfg->start_transfer)
+ bcfg->start_transfer(bcfg->board_data, ch,
+ &sh_mobile_lcdc_sys_bus_ops);
+- lcdc_write_chan(ch, LDSM2R, 1);
++ lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
+ }
+ }
+
+@@ -356,11 +329,11 @@ static irqreturn_t sh_mobile_lcdc_irq(int irq, void *data)
+ * disable further VSYNC End IRQs, preserve all other enabled IRQs,
+ * write 0 to bits 0-6 to ack all triggered IRQs.
+ */
+- tmp &= 0xffffff00 & ~LDINTR_VEE;
++ tmp &= ~LDINTR_STATUS_MASK & ~LDINTR_VEE;
+ lcdc_write(priv, _LDINTR, tmp);
+
+ /* figure out if this interrupt is for main or sub lcd */
+- is_sub = (lcdc_read(priv, _LDSR) & (1 << 10)) ? 1 : 0;
++ is_sub = (lcdc_read(priv, _LDSR) & LDSR_MSS) ? 1 : 0;
+
+ /* wake up channel and disable clocks */
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+@@ -395,16 +368,17 @@ static void sh_mobile_lcdc_start_stop(struct sh_mobile_lcdc_priv *priv,
+
+ /* start or stop the lcdc */
+ if (start)
+- lcdc_write(priv, _LDCNT2R, tmp | START_LCDC);
++ lcdc_write(priv, _LDCNT2R, tmp | LDCNT2R_DO);
+ else
+- lcdc_write(priv, _LDCNT2R, tmp & ~START_LCDC);
++ lcdc_write(priv, _LDCNT2R, tmp & ~LDCNT2R_DO);
+
+ /* wait until power is applied/stopped on all channels */
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++)
+ if (lcdc_read(priv, _LDCNT2R) & priv->ch[k].enabled)
+ while (1) {
+- tmp = lcdc_read_chan(&priv->ch[k], LDPMR) & 3;
+- if (start && tmp == 3)
++ tmp = lcdc_read_chan(&priv->ch[k], LDPMR)
++ & LDPMR_LPS;
++ if (start && tmp == LDPMR_LPS)
+ break;
+ if (!start && tmp == 0)
+ break;
+@@ -422,13 +396,13 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
+ u32 tmp;
+
+ tmp = ch->ldmt1r_value;
+- tmp |= (var->sync & FB_SYNC_VERT_HIGH_ACT) ? 0 : 1 << 28;
+- tmp |= (var->sync & FB_SYNC_HOR_HIGH_ACT) ? 0 : 1 << 27;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_DWPOL) ? 1 << 26 : 0;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_DIPOL) ? 1 << 25 : 0;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_DAPOL) ? 1 << 24 : 0;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_HSCNT) ? 1 << 17 : 0;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_DWCNT) ? 1 << 16 : 0;
++ tmp |= (var->sync & FB_SYNC_VERT_HIGH_ACT) ? 0 : LDMT1R_VPOL;
++ tmp |= (var->sync & FB_SYNC_HOR_HIGH_ACT) ? 0 : LDMT1R_HPOL;
++ tmp |= (ch->cfg.flags & LCDC_FLAGS_DWPOL) ? LDMT1R_DWPOL : 0;
++ tmp |= (ch->cfg.flags & LCDC_FLAGS_DIPOL) ? LDMT1R_DIPOL : 0;
++ tmp |= (ch->cfg.flags & LCDC_FLAGS_DAPOL) ? LDMT1R_DAPOL : 0;
++ tmp |= (ch->cfg.flags & LCDC_FLAGS_HSCNT) ? LDMT1R_HSCNT : 0;
++ tmp |= (ch->cfg.flags & LCDC_FLAGS_DWCNT) ? LDMT1R_DWCNT : 0;
+ lcdc_write_chan(ch, LDMT1R, tmp);
+
+ /* setup SYS bus */
+@@ -486,8 +460,8 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ }
+
+ /* reset */
+- lcdc_write(priv, _LDCNT2R, lcdc_read(priv, _LDCNT2R) | LCDC_RESET);
+- lcdc_wait_bit(priv, _LDCNT2R, LCDC_RESET, 0);
++ lcdc_write(priv, _LDCNT2R, lcdc_read(priv, _LDCNT2R) | LDCNT2R_BR);
++ lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
+
+ /* enable LCDC channels */
+ tmp = lcdc_read(priv, _LDCNT2R);
+@@ -496,7 +470,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ lcdc_write(priv, _LDCNT2R, tmp);
+
+ /* read data from external memory, avoid using the BEU for now */
+- lcdc_write(priv, _LDCNT2R, lcdc_read(priv, _LDCNT2R) & ~DISPLAY_BEU);
++ lcdc_write(priv, _LDCNT2R, lcdc_read(priv, _LDCNT2R) & ~LDCNT2R_MD);
+
+ /* stop the lcdc first */
+ sh_mobile_lcdc_start_stop(priv, 0);
+@@ -514,7 +488,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ continue;
+
+ if (m == 1)
+- m = 1 << 6;
++ m = LDDCKR_MOSEL;
+ tmp |= m << (lcdc_chan_is_sublcd(ch) ? 8 : 0);
+
+ /* FIXME: sh7724 can only use 42, 48, 54 and 60 for the divider denominator */
+@@ -554,20 +528,21 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ /* word and long word swap */
+ ldddsr = lcdc_read(priv, _LDDDSR);
+ if (priv->ch[0].info->var.nonstd)
+- lcdc_write(priv, _LDDDSR, ldddsr | 7);
++ ldddsr |= LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
+ else {
+ switch (bpp) {
+ case 16:
+- lcdc_write(priv, _LDDDSR, ldddsr | 6);
++ ldddsr |= LDDDSR_LS | LDDDSR_WS;
+ break;
+ case 24:
+- lcdc_write(priv, _LDDDSR, ldddsr | 7);
++ ldddsr |= LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
+ break;
+ case 32:
+- lcdc_write(priv, _LDDDSR, ldddsr | 4);
++ ldddsr |= LDDDSR_LS;
+ break;
+ }
+ }
++ lcdc_write(priv, _LDDDSR, ldddsr);
+
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+ unsigned long base_addr_y;
+@@ -580,28 +555,29 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+
+ /* set bpp format in PKF[4:0] */
+ tmp = lcdc_read_chan(ch, LDDFR);
+- tmp &= ~0x0003031f;
++ tmp &= ~(LDDFR_CF0 | LDDFR_CC | LDDFR_YF_MASK | LDDFR_PKF_MASK);
+ if (ch->info->var.nonstd) {
+ tmp |= (ch->info->var.nonstd << 16);
+ switch (ch->info->var.bits_per_pixel) {
+ case 12:
+ break;
+ case 16:
+- tmp |= (0x1 << 8);
++ tmp |= LDDFR_YF_422;
+ break;
+ case 24:
+- tmp |= (0x2 << 8);
++ tmp |= LDDFR_YF_444;
+ break;
+ }
+ } else {
+ switch (ch->info->var.bits_per_pixel) {
+ case 16:
+- tmp |= 0x03;
++ tmp |= LDDFR_PKF_RGB16;
+ break;
+ case 24:
+- tmp |= 0x0b;
++ tmp |= LDDFR_PKF_RGB24;
+ break;
+ case 32:
++ tmp |= LDDFR_PKF_ARGB32;
+ break;
+ }
+ }
+@@ -672,14 +648,14 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+
+ /* setup deferred io if SYS bus */
+ tmp = ch->cfg.sys_bus_cfg.deferred_io_msec;
+- if (ch->ldmt1r_value & (1 << 12) && tmp) {
++ if (ch->ldmt1r_value & LDMT1R_IFM && tmp) {
+ ch->defio.deferred_io = sh_mobile_lcdc_deferred_io;
+ ch->defio.delay = msecs_to_jiffies(tmp);
+ ch->info->fbdefio = &ch->defio;
+ fb_deferred_io_init(ch->info);
+
+ /* one-shot mode */
+- lcdc_write_chan(ch, LDSM1R, 1);
++ lcdc_write_chan(ch, LDSM1R, LDSM1R_OS);
+
+ /* enable "Frame End Interrupt Enable" bit */
+ lcdc_write(priv, _LDINTR, LDINTR_FE);
+@@ -691,7 +667,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ }
+
+ /* display output */
+- lcdc_write(priv, _LDCNT1R, LCDC_ENABLE);
++ lcdc_write(priv, _LDCNT1R, LDCNT1R_DE);
+
+ /* start the lcdc */
+ sh_mobile_lcdc_start_stop(priv, 1);
+@@ -780,42 +756,42 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
+
+ static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
+ {
+- int ifm, miftyp;
+-
+- switch (ch->cfg.interface_type) {
+- case RGB8: ifm = 0; miftyp = 0; break;
+- case RGB9: ifm = 0; miftyp = 4; break;
+- case RGB12A: ifm = 0; miftyp = 5; break;
+- case RGB12B: ifm = 0; miftyp = 6; break;
+- case RGB16: ifm = 0; miftyp = 7; break;
+- case RGB18: ifm = 0; miftyp = 10; break;
+- case RGB24: ifm = 0; miftyp = 11; break;
+- case SYS8A: ifm = 1; miftyp = 0; break;
+- case SYS8B: ifm = 1; miftyp = 1; break;
+- case SYS8C: ifm = 1; miftyp = 2; break;
+- case SYS8D: ifm = 1; miftyp = 3; break;
+- case SYS9: ifm = 1; miftyp = 4; break;
+- case SYS12: ifm = 1; miftyp = 5; break;
+- case SYS16A: ifm = 1; miftyp = 7; break;
+- case SYS16B: ifm = 1; miftyp = 8; break;
+- case SYS16C: ifm = 1; miftyp = 9; break;
+- case SYS18: ifm = 1; miftyp = 10; break;
+- case SYS24: ifm = 1; miftyp = 11; break;
+- default: goto bad;
++ int interface_type = ch->cfg.interface_type;
++
++ switch (interface_type) {
++ case RGB8:
++ case RGB9:
++ case RGB12A:
++ case RGB12B:
++ case RGB16:
++ case RGB18:
++ case RGB24:
++ case SYS8A:
++ case SYS8B:
++ case SYS8C:
++ case SYS8D:
++ case SYS9:
++ case SYS12:
++ case SYS16A:
++ case SYS16B:
++ case SYS16C:
++ case SYS18:
++ case SYS24:
++ break;
++ default:
++ return -EINVAL;
+ }
+
+ /* SUBLCD only supports SYS interface */
+ if (lcdc_chan_is_sublcd(ch)) {
+- if (ifm == 0)
+- goto bad;
+- else
+- ifm = 0;
++ if (!(interface_type & LDMT1R_IFM))
++ return -EINVAL;
++
++ interface_type &= ~LDMT1R_IFM;
+ }
+
+- ch->ldmt1r_value = (ifm << 12) | miftyp;
++ ch->ldmt1r_value = interface_type;
+ return 0;
+- bad:
+- return -EINVAL;
+ }
+
+ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
+@@ -823,18 +799,24 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
+ struct sh_mobile_lcdc_priv *priv)
+ {
+ char *str;
+- int icksel;
+
+ switch (clock_source) {
+- case LCDC_CLK_BUS: str = "bus_clk"; icksel = 0; break;
+- case LCDC_CLK_PERIPHERAL: str = "peripheral_clk"; icksel = 1; break;
+- case LCDC_CLK_EXTERNAL: str = NULL; icksel = 2; break;
++ case LCDC_CLK_BUS:
++ str = "bus_clk";
++ priv->lddckr = LDDCKR_ICKSEL_BUS;
++ break;
++ case LCDC_CLK_PERIPHERAL:
++ str = "peripheral_clk";
++ priv->lddckr = LDDCKR_ICKSEL_MIPI;
++ break;
++ case LCDC_CLK_EXTERNAL:
++ str = NULL;
++ priv->lddckr = LDDCKR_ICKSEL_HDMI;
++ break;
+ default:
+ return -EINVAL;
+ }
+
+- priv->lddckr = icksel << 16;
+-
+ if (str) {
+ priv->dot_clk = clk_get(&pdev->dev, str);
+ if (IS_ERR(priv->dot_clk)) {
+@@ -1476,12 +1458,12 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+
+ switch (pdata->ch[i].chan) {
+ case LCDC_CHAN_MAINLCD:
+- ch->enabled = 1 << 1;
++ ch->enabled = LDCNT2R_ME;
+ ch->reg_offs = lcdc_offs_mainlcd;
+ j++;
+ break;
+ case LCDC_CHAN_SUBLCD:
+- ch->enabled = 1 << 2;
++ ch->enabled = LDCNT2R_SE;
+ ch->reg_offs = lcdc_offs_sublcd;
+ j++;
+ break;
+diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
+index d964e68..8101b72 100644
+--- a/include/video/sh_mobile_lcdc.h
++++ b/include/video/sh_mobile_lcdc.h
+@@ -4,26 +4,123 @@
+ #include <linux/fb.h>
+ #include <video/sh_mobile_meram.h>
+
++/* Register definitions */
++#define _LDDCKR 0x410
++#define LDDCKR_ICKSEL_BUS (0 << 16)
++#define LDDCKR_ICKSEL_MIPI (1 << 16)
++#define LDDCKR_ICKSEL_HDMI (2 << 16)
++#define LDDCKR_ICKSEL_EXT (3 << 16)
++#define LDDCKR_ICKSEL_MASK (7 << 16)
++#define LDDCKR_MOSEL (1 << 6)
++#define _LDDCKSTPR 0x414
++#define _LDINTR 0x468
++#define LDINTR_FE (1 << 10)
++#define LDINTR_VSE (1 << 9)
++#define LDINTR_VEE (1 << 8)
++#define LDINTR_FS (1 << 2)
++#define LDINTR_VSS (1 << 1)
++#define LDINTR_VES (1 << 0)
++#define LDINTR_STATUS_MASK (0xff << 0)
++#define _LDSR 0x46c
++#define LDSR_MSS (1 << 10)
++#define LDSR_MRS (1 << 8)
++#define LDSR_AS (1 << 1)
++#define _LDCNT1R 0x470
++#define LDCNT1R_DE (1 << 0)
++#define _LDCNT2R 0x474
++#define LDCNT2R_BR (1 << 8)
++#define LDCNT2R_MD (1 << 3)
++#define LDCNT2R_SE (1 << 2)
++#define LDCNT2R_ME (1 << 1)
++#define LDCNT2R_DO (1 << 0)
++#define _LDRCNTR 0x478
++#define LDRCNTR_SRS (1 << 17)
++#define LDRCNTR_SRC (1 << 16)
++#define LDRCNTR_MRS (1 << 1)
++#define LDRCNTR_MRC (1 << 0)
++#define _LDDDSR 0x47c
++#define LDDDSR_LS (1 << 2)
++#define LDDDSR_WS (1 << 1)
++#define LDDDSR_BS (1 << 0)
++
++#define LDMT1R_VPOL (1 << 28)
++#define LDMT1R_HPOL (1 << 27)
++#define LDMT1R_DWPOL (1 << 26)
++#define LDMT1R_DIPOL (1 << 25)
++#define LDMT1R_DAPOL (1 << 24)
++#define LDMT1R_HSCNT (1 << 17)
++#define LDMT1R_DWCNT (1 << 16)
++#define LDMT1R_IFM (1 << 12)
++#define LDMT1R_MIFTYP_RGB8 (0x0 << 0)
++#define LDMT1R_MIFTYP_RGB9 (0x4 << 0)
++#define LDMT1R_MIFTYP_RGB12A (0x5 << 0)
++#define LDMT1R_MIFTYP_RGB12B (0x6 << 0)
++#define LDMT1R_MIFTYP_RGB16 (0x7 << 0)
++#define LDMT1R_MIFTYP_RGB18 (0xa << 0)
++#define LDMT1R_MIFTYP_RGB24 (0xb << 0)
++#define LDMT1R_MIFTYP_YCBCR (0xf << 0)
++#define LDMT1R_MIFTYP_SYS8A (0x0 << 0)
++#define LDMT1R_MIFTYP_SYS8B (0x1 << 0)
++#define LDMT1R_MIFTYP_SYS8C (0x2 << 0)
++#define LDMT1R_MIFTYP_SYS8D (0x3 << 0)
++#define LDMT1R_MIFTYP_SYS9 (0x4 << 0)
++#define LDMT1R_MIFTYP_SYS12 (0x5 << 0)
++#define LDMT1R_MIFTYP_SYS16A (0x7 << 0)
++#define LDMT1R_MIFTYP_SYS16B (0x8 << 0)
++#define LDMT1R_MIFTYP_SYS16C (0x9 << 0)
++#define LDMT1R_MIFTYP_SYS18 (0xa << 0)
++#define LDMT1R_MIFTYP_SYS24 (0xb << 0)
++#define LDMT1R_MIFTYP_MASK (0xf << 0)
++
++#define LDDFR_CF1 (1 << 18)
++#define LDDFR_CF0 (1 << 17)
++#define LDDFR_CC (1 << 16)
++#define LDDFR_YF_420 (0 << 8)
++#define LDDFR_YF_422 (1 << 8)
++#define LDDFR_YF_444 (2 << 8)
++#define LDDFR_YF_MASK (3 << 8)
++#define LDDFR_PKF_ARGB32 (0x00 << 0)
++#define LDDFR_PKF_RGB16 (0x03 << 0)
++#define LDDFR_PKF_RGB24 (0x0b << 0)
++#define LDDFR_PKF_MASK (0x1f << 0)
++
++#define LDSM1R_OS (1 << 0)
++
++#define LDSM2R_OSTRG (1 << 0)
++
++#define LDPMR_LPS (3 << 0)
++
++#define _LDDWD0R 0x800
++#define LDDWDxR_WDACT (1 << 28)
++#define LDDWDxR_RSW (1 << 24)
++#define _LDDRDR 0x840
++#define LDDRDR_RSR (1 << 24)
++#define LDDRDR_DRD_MASK (0x3ffff << 0)
++#define _LDDWAR 0x900
++#define LDDWAR_WA (1 << 0)
++#define _LDDRAR 0x904
++#define LDDRAR_RA (1 << 0)
++
+ enum {
+- RGB8, /* 24bpp, 8:8:8 */
+- RGB9, /* 18bpp, 9:9 */
+- RGB12A, /* 24bpp, 12:12 */
+- RGB12B, /* 12bpp */
+- RGB16, /* 16bpp */
+- RGB18, /* 18bpp */
+- RGB24, /* 24bpp */
+- YUV422, /* 16bpp */
+- SYS8A, /* 24bpp, 8:8:8 */
+- SYS8B, /* 18bpp, 8:8:2 */
+- SYS8C, /* 18bpp, 2:8:8 */
+- SYS8D, /* 16bpp, 8:8 */
+- SYS9, /* 18bpp, 9:9 */
+- SYS12, /* 24bpp, 12:12 */
+- SYS16A, /* 16bpp */
+- SYS16B, /* 18bpp, 16:2 */
+- SYS16C, /* 18bpp, 2:16 */
+- SYS18, /* 18bpp */
+- SYS24, /* 24bpp */
++ RGB8 = LDMT1R_MIFTYP_RGB8, /* 24bpp, 8:8:8 */
++ RGB9 = LDMT1R_MIFTYP_RGB9, /* 18bpp, 9:9 */
++ RGB12A = LDMT1R_MIFTYP_RGB12A, /* 24bpp, 12:12 */
++ RGB12B = LDMT1R_MIFTYP_RGB12B, /* 12bpp */
++ RGB16 = LDMT1R_MIFTYP_RGB16, /* 16bpp */
++ RGB18 = LDMT1R_MIFTYP_RGB18, /* 18bpp */
++ RGB24 = LDMT1R_MIFTYP_RGB24, /* 24bpp */
++ YUV422 = LDMT1R_MIFTYP_YCBCR, /* 16bpp */
++ SYS8A = LDMT1R_IFM | LDMT1R_MIFTYP_SYS8A, /* 24bpp, 8:8:8 */
++ SYS8B = LDMT1R_IFM | LDMT1R_MIFTYP_SYS8B, /* 18bpp, 8:8:2 */
++ SYS8C = LDMT1R_IFM | LDMT1R_MIFTYP_SYS8C, /* 18bpp, 2:8:8 */
++ SYS8D = LDMT1R_IFM | LDMT1R_MIFTYP_SYS8D, /* 16bpp, 8:8 */
++ SYS9 = LDMT1R_IFM | LDMT1R_MIFTYP_SYS9, /* 18bpp, 9:9 */
++ SYS12 = LDMT1R_IFM | LDMT1R_MIFTYP_SYS12, /* 24bpp, 12:12 */
++ SYS16A = LDMT1R_IFM | LDMT1R_MIFTYP_SYS16A, /* 16bpp */
++ SYS16B = LDMT1R_IFM | LDMT1R_MIFTYP_SYS16B, /* 18bpp, 16:2 */
++ SYS16C = LDMT1R_IFM | LDMT1R_MIFTYP_SYS16C, /* 18bpp, 2:16 */
++ SYS18 = LDMT1R_IFM | LDMT1R_MIFTYP_SYS18, /* 18bpp */
++ SYS24 = LDMT1R_IFM | LDMT1R_MIFTYP_SYS24, /* 24bpp */
+ };
+
+ enum { LCDC_CHAN_DISABLED = 0,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0105-fbdev-sh_mobile_lcdc-Don-t-acknowlege-interrupts-uni.patch b/patches.armadillo800eva/0105-fbdev-sh_mobile_lcdc-Don-t-acknowlege-interrupts-uni.patch
new file mode 100644
index 00000000000000..607aea7c66d275
--- /dev/null
+++ b/patches.armadillo800eva/0105-fbdev-sh_mobile_lcdc-Don-t-acknowlege-interrupts-uni.patch
@@ -0,0 +1,73 @@
+From c28345871c5662edc793e88be1d57a259cb86391 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_lcdc: Don't acknowlege interrupts unintentionally
+
+The LDINTR register caries both interrupt enable and interrupt status
+bits. When setting or clearing interrupt enable bits, write all status
+bits to 1 to avoid acknowledging interrupts by mistake.
+
+When acknowledging interrupts, write 1 to all non-triggered interrupt
+bits to avoid losing interrupts.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit dc48665fae5aa360e80dfdb2d6cab4fa58b27ee4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 20 ++++++++------------
+ 1 file changed, 8 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 84504d5..99656f5 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -318,19 +318,13 @@ static irqreturn_t sh_mobile_lcdc_irq(int irq, void *data)
+ {
+ struct sh_mobile_lcdc_priv *priv = data;
+ struct sh_mobile_lcdc_chan *ch;
+- unsigned long tmp;
+ unsigned long ldintr;
+ int is_sub;
+ int k;
+
+- /* acknowledge interrupt */
+- ldintr = tmp = lcdc_read(priv, _LDINTR);
+- /*
+- * disable further VSYNC End IRQs, preserve all other enabled IRQs,
+- * write 0 to bits 0-6 to ack all triggered IRQs.
+- */
+- tmp &= ~LDINTR_STATUS_MASK & ~LDINTR_VEE;
+- lcdc_write(priv, _LDINTR, tmp);
++ /* Acknowledge interrupts and disable further VSYNC End IRQs. */
++ ldintr = lcdc_read(priv, _LDINTR);
++ lcdc_write(priv, _LDINTR, (ldintr ^ LDINTR_STATUS_MASK) & ~LDINTR_VEE);
+
+ /* figure out if this interrupt is for main or sub lcd */
+ is_sub = (lcdc_read(priv, _LDSR) & LDSR_MSS) ? 1 : 0;
+@@ -342,7 +336,7 @@ static irqreturn_t sh_mobile_lcdc_irq(int irq, void *data)
+ if (!ch->enabled)
+ continue;
+
+- /* Frame Start */
++ /* Frame End */
+ if (ldintr & LDINTR_FS) {
+ if (is_sub == lcdc_chan_is_sublcd(ch)) {
+ ch->frame_end = 1;
+@@ -971,9 +965,11 @@ static int sh_mobile_wait_for_vsync(struct fb_info *info)
+ unsigned long ldintr;
+ int ret;
+
+- /* Enable VSync End interrupt */
++ /* Enable VSync End interrupt and be careful not to acknowledge any
++ * pending interrupt.
++ */
+ ldintr = lcdc_read(ch->lcdc, _LDINTR);
+- ldintr |= LDINTR_VEE;
++ ldintr |= LDINTR_VEE | LDINTR_STATUS_MASK;
+ lcdc_write(ch->lcdc, _LDINTR, ldintr);
+
+ ret = wait_for_completion_interruptible_timeout(&ch->vsync_completion,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0106-fbdev-sh_mobile_lcdc-Compute-clock-pattern-using-div.patch b/patches.armadillo800eva/0106-fbdev-sh_mobile_lcdc-Compute-clock-pattern-using-div.patch
new file mode 100644
index 00000000000000..c07a77c544326a
--- /dev/null
+++ b/patches.armadillo800eva/0106-fbdev-sh_mobile_lcdc-Compute-clock-pattern-using-div.patch
@@ -0,0 +1,50 @@
+From 6bb3f4d8de6da233738c058f3fb0016fffd5d81b Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_lcdc: Compute clock pattern using divider
+ denominator
+
+The clock divider pattern is computed based on the dot clock register
+value which stores the divider denumerator. However, when using a 1:1
+divider ratio, the register is programmed with a value that must not be
+interpreted as a denominator. This results in a shift left operation
+with a value of 32, which produces undefined behaviour.
+
+Compute the clock pattern using the divider denominator, not the dot
+clock register value.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 505c7de51fe5ebb81fac096cb8cebd7cb45b7955)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 99656f5..2d935db 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -481,13 +481,15 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ if (!m)
+ continue;
+
++ /* FIXME: sh7724 can only use 42, 48, 54 and 60 for the divider
++ * denominator.
++ */
++ lcdc_write_chan(ch, LDDCKPAT1R, 0);
++ lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1);
++
+ if (m == 1)
+ m = LDDCKR_MOSEL;
+ tmp |= m << (lcdc_chan_is_sublcd(ch) ? 8 : 0);
+-
+- /* FIXME: sh7724 can only use 42, 48, 54 and 60 for the divider denominator */
+- lcdc_write_chan(ch, LDDCKPAT1R, 0);
+- lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1);
+ }
+
+ lcdc_write(priv, _LDDCKR, tmp);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0107-fbdev-sh_mobile_lcdc-Split-LCDC-start-code-from-sh_m.patch b/patches.armadillo800eva/0107-fbdev-sh_mobile_lcdc-Split-LCDC-start-code-from-sh_m.patch
new file mode 100644
index 00000000000000..b157c59059102e
--- /dev/null
+++ b/patches.armadillo800eva/0107-fbdev-sh_mobile_lcdc-Split-LCDC-start-code-from-sh_m.patch
@@ -0,0 +1,443 @@
+From 10c7583e1d260cb9e66c6060c4c7608e317353a4 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_lcdc: Split LCDC start code from
+ sh_mobile_lcdc_start
+
+Splitting the LCDC start code from clock, MERAM and panel management
+will make the code usable by runtime PM.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 9a217e3444ec0c3a0dba35f7b4221af6671da67b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 309 +++++++++++++++++++-------------------
+ drivers/video/sh_mobile_lcdcfb.h | 11 ++
+ 2 files changed, 162 insertions(+), 158 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 2d935db..292cfc0 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -435,48 +435,42 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
+ lcdc_write_chan(ch, LDHAJR, tmp);
+ }
+
+-static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
++/*
++ * __sh_mobile_lcdc_start - Configure and tart the LCDC
++ * @priv: LCDC device
++ *
++ * Configure all enabled channels and start the LCDC device. All external
++ * devices (clocks, MERAM, panels, ...) are not touched by this function.
++ */
++static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ {
+ struct sh_mobile_lcdc_chan *ch;
+- struct sh_mobile_lcdc_board_cfg *board_cfg;
+ unsigned long tmp;
+ int bpp = 0;
+- unsigned long ldddsr;
+- int k, m, ret;
++ int k, m;
+
+- /* enable clocks before accessing the hardware */
+- for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+- if (priv->ch[k].enabled) {
+- sh_mobile_lcdc_clk_on(priv);
+- if (!bpp)
+- bpp = priv->ch[k].info->var.bits_per_pixel;
+- }
+- }
+-
+- /* reset */
+- lcdc_write(priv, _LDCNT2R, lcdc_read(priv, _LDCNT2R) | LDCNT2R_BR);
+- lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
+-
+- /* enable LCDC channels */
+- tmp = lcdc_read(priv, _LDCNT2R);
+- tmp |= priv->ch[0].enabled;
+- tmp |= priv->ch[1].enabled;
+- lcdc_write(priv, _LDCNT2R, tmp);
+-
+- /* read data from external memory, avoid using the BEU for now */
+- lcdc_write(priv, _LDCNT2R, lcdc_read(priv, _LDCNT2R) & ~LDCNT2R_MD);
++ /* Enable LCDC channels. Read data from external memory, avoid using the
++ * BEU for now.
++ */
++ lcdc_write(priv, _LDCNT2R, priv->ch[0].enabled | priv->ch[1].enabled);
+
+- /* stop the lcdc first */
++ /* Stop the LCDC first and disable all interrupts. */
+ sh_mobile_lcdc_start_stop(priv, 0);
++ lcdc_write(priv, _LDINTR, 0);
+
+- /* configure clocks */
++ /* Configure power supply, dot clocks and start them. */
+ tmp = priv->lddckr;
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+ ch = &priv->ch[k];
+-
+- if (!priv->ch[k].enabled)
++ if (!ch->enabled)
+ continue;
+
++ if (!bpp)
++ bpp = ch->info->var.bits_per_pixel;
++
++ /* Power supply */
++ lcdc_write_chan(ch, LDPMR, 0);
++
+ m = ch->cfg.clock_divider;
+ if (!m)
+ continue;
+@@ -493,188 +487,187 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ }
+
+ lcdc_write(priv, _LDDCKR, tmp);
+-
+- /* start dotclock again */
+ lcdc_write(priv, _LDDCKSTPR, 0);
+ lcdc_wait_bit(priv, _LDDCKSTPR, ~0, 0);
+
+- /* interrupts are disabled to begin with */
+- lcdc_write(priv, _LDINTR, 0);
+-
++ /* Setup geometry, format, frame buffer memory and operation mode. */
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+ ch = &priv->ch[k];
+-
+ if (!ch->enabled)
+ continue;
+
+ sh_mobile_lcdc_geometry(ch);
+
+- /* power supply */
+- lcdc_write_chan(ch, LDPMR, 0);
+-
+- board_cfg = &ch->cfg.board_cfg;
+- if (board_cfg->setup_sys) {
+- ret = board_cfg->setup_sys(board_cfg->board_data,
+- ch, &sh_mobile_lcdc_sys_bus_ops);
+- if (ret)
+- return ret;
+- }
+- }
+-
+- /* word and long word swap */
+- ldddsr = lcdc_read(priv, _LDDDSR);
+- if (priv->ch[0].info->var.nonstd)
+- ldddsr |= LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
+- else {
+- switch (bpp) {
+- case 16:
+- ldddsr |= LDDDSR_LS | LDDDSR_WS;
+- break;
+- case 24:
+- ldddsr |= LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
+- break;
+- case 32:
+- ldddsr |= LDDDSR_LS;
+- break;
+- }
+- }
+- lcdc_write(priv, _LDDDSR, ldddsr);
+-
+- for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+- unsigned long base_addr_y;
+- unsigned long base_addr_c = 0;
+- int pitch;
+- ch = &priv->ch[k];
+-
+- if (!priv->ch[k].enabled)
+- continue;
+-
+- /* set bpp format in PKF[4:0] */
+- tmp = lcdc_read_chan(ch, LDDFR);
+- tmp &= ~(LDDFR_CF0 | LDDFR_CC | LDDFR_YF_MASK | LDDFR_PKF_MASK);
+ if (ch->info->var.nonstd) {
+- tmp |= (ch->info->var.nonstd << 16);
++ tmp = (ch->info->var.nonstd << 16);
+ switch (ch->info->var.bits_per_pixel) {
+ case 12:
++ tmp |= LDDFR_YF_420;
+ break;
+ case 16:
+ tmp |= LDDFR_YF_422;
+ break;
+ case 24:
++ default:
+ tmp |= LDDFR_YF_444;
+ break;
+ }
+ } else {
+ switch (ch->info->var.bits_per_pixel) {
+ case 16:
+- tmp |= LDDFR_PKF_RGB16;
++ tmp = LDDFR_PKF_RGB16;
+ break;
+ case 24:
+- tmp |= LDDFR_PKF_RGB24;
++ tmp = LDDFR_PKF_RGB24;
+ break;
+ case 32:
+- tmp |= LDDFR_PKF_ARGB32;
++ default:
++ tmp = LDDFR_PKF_ARGB32;
+ break;
+ }
+ }
++
+ lcdc_write_chan(ch, LDDFR, tmp);
++ lcdc_write_chan(ch, LDMLSR, ch->pitch);
++ lcdc_write_chan(ch, LDSA1R, ch->base_addr_y);
++ if (ch->info->var.nonstd)
++ lcdc_write_chan(ch, LDSA2R, ch->base_addr_c);
+
+- base_addr_y = ch->info->fix.smem_start;
+- base_addr_c = base_addr_y +
+- ch->info->var.xres *
+- ch->info->var.yres_virtual;
+- pitch = ch->info->fix.line_length;
++ /* When using deferred I/O mode, configure the LCDC for one-shot
++ * operation and enable the frame end interrupt. Otherwise use
++ * continuous read mode.
++ */
++ if (ch->ldmt1r_value & LDMT1R_IFM &&
++ ch->cfg.sys_bus_cfg.deferred_io_msec) {
++ lcdc_write_chan(ch, LDSM1R, LDSM1R_OS);
++ lcdc_write(priv, _LDINTR, LDINTR_FE);
++ } else {
++ lcdc_write_chan(ch, LDSM1R, 0);
++ }
++ }
+
+- /* test if we can enable meram */
+- if (ch->cfg.meram_cfg && priv->meram_dev &&
+- priv->meram_dev->ops) {
+- struct sh_mobile_meram_cfg *cfg;
+- struct sh_mobile_meram_info *mdev;
+- unsigned long icb_addr_y, icb_addr_c;
+- int icb_pitch;
+- int pf;
++ /* Word and long word swap. */
++ if (priv->ch[0].info->var.nonstd)
++ tmp = LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
++ else {
++ switch (bpp) {
++ case 16:
++ tmp = LDDDSR_LS | LDDDSR_WS;
++ break;
++ case 24:
++ tmp = LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
++ break;
++ case 32:
++ default:
++ tmp = LDDDSR_LS;
++ break;
++ }
++ }
++ lcdc_write(priv, _LDDDSR, tmp);
+
+- cfg = ch->cfg.meram_cfg;
+- mdev = priv->meram_dev;
+- /* we need to de-init configured ICBs before we
+- * we can re-initialize them.
+- */
+- if (ch->meram_enabled)
+- mdev->ops->meram_unregister(mdev, cfg);
++ /* Enable the display output. */
++ lcdc_write(priv, _LDCNT1R, LDCNT1R_DE);
++ sh_mobile_lcdc_start_stop(priv, 1);
++ priv->started = 1;
++}
+
+- ch->meram_enabled = 0;
++static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
++{
++ struct sh_mobile_meram_info *mdev = priv->meram_dev;
++ struct sh_mobile_lcdc_board_cfg *board_cfg;
++ struct sh_mobile_lcdc_chan *ch;
++ unsigned long tmp;
++ int ret;
++ int k;
+
+- if (ch->info->var.nonstd) {
+- if (ch->info->var.bits_per_pixel == 24)
+- pf = SH_MOBILE_MERAM_PF_NV24;
+- else
+- pf = SH_MOBILE_MERAM_PF_NV;
+- } else {
+- pf = SH_MOBILE_MERAM_PF_RGB;
+- }
++ /* enable clocks before accessing the hardware */
++ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
++ if (priv->ch[k].enabled)
++ sh_mobile_lcdc_clk_on(priv);
++ }
+
+- ret = mdev->ops->meram_register(mdev, cfg, pitch,
+- ch->info->var.yres,
+- pf,
+- base_addr_y,
+- base_addr_c,
+- &icb_addr_y,
+- &icb_addr_c,
+- &icb_pitch);
+- if (!ret) {
+- /* set LDSA1R value */
+- base_addr_y = icb_addr_y;
+- pitch = icb_pitch;
+-
+- /* set LDSA2R value if required */
+- if (base_addr_c)
+- base_addr_c = icb_addr_c;
+-
+- ch->meram_enabled = 1;
+- }
+- }
++ /* reset */
++ lcdc_write(priv, _LDCNT2R, lcdc_read(priv, _LDCNT2R) | LDCNT2R_BR);
++ lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
+
+- /* point out our frame buffer */
+- lcdc_write_chan(ch, LDSA1R, base_addr_y);
+- if (ch->info->var.nonstd)
+- lcdc_write_chan(ch, LDSA2R, base_addr_c);
++ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
++ ch = &priv->ch[k];
+
+- /* set line size */
+- lcdc_write_chan(ch, LDMLSR, pitch);
++ if (!ch->enabled)
++ continue;
+
+- /* setup deferred io if SYS bus */
+- tmp = ch->cfg.sys_bus_cfg.deferred_io_msec;
+- if (ch->ldmt1r_value & LDMT1R_IFM && tmp) {
+- ch->defio.deferred_io = sh_mobile_lcdc_deferred_io;
+- ch->defio.delay = msecs_to_jiffies(tmp);
+- ch->info->fbdefio = &ch->defio;
+- fb_deferred_io_init(ch->info);
++ board_cfg = &ch->cfg.board_cfg;
++ if (board_cfg->setup_sys) {
++ ret = board_cfg->setup_sys(board_cfg->board_data, ch,
++ &sh_mobile_lcdc_sys_bus_ops);
++ if (ret)
++ return ret;
++ }
++ }
+
+- /* one-shot mode */
+- lcdc_write_chan(ch, LDSM1R, LDSM1R_OS);
++ /* Compute frame buffer base address and pitch for each channel. */
++ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
++ struct sh_mobile_meram_cfg *cfg;
++ int pixelformat;
+
+- /* enable "Frame End Interrupt Enable" bit */
+- lcdc_write(priv, _LDINTR, LDINTR_FE);
++ ch = &priv->ch[k];
++ if (!ch->enabled)
++ continue;
+
+- } else {
+- /* continuous read mode */
+- lcdc_write_chan(ch, LDSM1R, 0);
++ ch->base_addr_y = ch->info->fix.smem_start;
++ ch->base_addr_c = ch->base_addr_y
++ + ch->info->var.xres
++ * ch->info->var.yres_virtual;
++ ch->pitch = ch->info->fix.line_length;
++
++ /* Enable MERAM if possible. */
++ cfg = ch->cfg.meram_cfg;
++ if (mdev == NULL || mdev->ops == NULL || cfg == NULL)
++ continue;
++
++ /* we need to de-init configured ICBs before we can
++ * re-initialize them.
++ */
++ if (ch->meram_enabled) {
++ mdev->ops->meram_unregister(mdev, cfg);
++ ch->meram_enabled = 0;
+ }
+- }
+
+- /* display output */
+- lcdc_write(priv, _LDCNT1R, LDCNT1R_DE);
++ if (!ch->info->var.nonstd)
++ pixelformat = SH_MOBILE_MERAM_PF_RGB;
++ else if (ch->info->var.bits_per_pixel == 24)
++ pixelformat = SH_MOBILE_MERAM_PF_NV24;
++ else
++ pixelformat = SH_MOBILE_MERAM_PF_NV;
++
++ ret = mdev->ops->meram_register(mdev, cfg, ch->pitch,
++ ch->info->var.yres, pixelformat,
++ ch->base_addr_y, ch->base_addr_c,
++ &ch->base_addr_y, &ch->base_addr_c,
++ &ch->pitch);
++ if (!ret)
++ ch->meram_enabled = 1;
++ }
+
+- /* start the lcdc */
+- sh_mobile_lcdc_start_stop(priv, 1);
+- priv->started = 1;
++ /* Start the LCDC. */
++ __sh_mobile_lcdc_start(priv);
+
+- /* tell the board code to enable the panel */
++ /* Setup deferred I/O, tell the board code to enable the panels, and
++ * turn backlight on.
++ */
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+ ch = &priv->ch[k];
+ if (!ch->enabled)
+ continue;
+
++ tmp = ch->cfg.sys_bus_cfg.deferred_io_msec;
++ if (ch->ldmt1r_value & LDMT1R_IFM && tmp) {
++ ch->defio.deferred_io = sh_mobile_lcdc_deferred_io;
++ ch->defio.delay = msecs_to_jiffies(tmp);
++ ch->info->fbdefio = &ch->defio;
++ fb_deferred_io_init(ch->info);
++ }
++
+ board_cfg = &ch->cfg.board_cfg;
+ if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
+ board_cfg->display_on(board_cfg->board_data, ch->info);
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index aeed668..a06219b 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -18,6 +18,13 @@ struct sh_mobile_lcdc_priv;
+ struct fb_info;
+ struct backlight_device;
+
++/*
++ * struct sh_mobile_lcdc_chan - LCDC display channel
++ *
++ * @base_addr_y: Frame buffer viewport base address (luma component)
++ * @base_addr_c: Frame buffer viewport base address (chroma component)
++ * @pitch: Frame buffer line pitch
++ */
+ struct sh_mobile_lcdc_chan {
+ struct sh_mobile_lcdc_priv *lcdc;
+ unsigned long *reg_offs;
+@@ -40,6 +47,10 @@ struct sh_mobile_lcdc_chan {
+ int blank_status;
+ struct mutex open_lock; /* protects the use counter */
+ int meram_enabled;
++
++ unsigned long base_addr_y;
++ unsigned long base_addr_c;
++ unsigned int pitch;
+ };
+
+ #endif
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0108-fbdev-sh_mobile_lcdc-Store-the-frame-buffer-base-add.patch b/patches.armadillo800eva/0108-fbdev-sh_mobile_lcdc-Store-the-frame-buffer-base-add.patch
new file mode 100644
index 00000000000000..dabd84d33aa510
--- /dev/null
+++ b/patches.armadillo800eva/0108-fbdev-sh_mobile_lcdc-Store-the-frame-buffer-base-add.patch
@@ -0,0 +1,67 @@
+From c751b099194544ec0ff1e0e12a8a0b5afd14c8a9 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_lcdc: Store the frame buffer base address when
+ panning
+
+When the frame buffer base address is changed by a panning operation,
+store it in the channel structure. It will be reused when runtime PM
+code will use __sh_mobile_lcdc_start().
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 49d79ba2e39b5d3346e9e3ddf894eda72c743c85)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 22 +++++++++-------------
+ 1 file changed, 9 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 292cfc0..69c267a 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -915,32 +915,28 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ base_addr_c += 2 * var->xoffset;
+ else
+ base_addr_c += var->xoffset;
+- } else
+- base_addr_c = 0;
++ }
+
+- if (!ch->meram_enabled) {
+- lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y);
+- if (base_addr_c)
+- lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c);
+- } else {
++ if (ch->meram_enabled) {
+ struct sh_mobile_meram_cfg *cfg;
+ struct sh_mobile_meram_info *mdev;
+- unsigned long icb_addr_y, icb_addr_c;
+ int ret;
+
+ cfg = ch->cfg.meram_cfg;
+ mdev = priv->meram_dev;
+ ret = mdev->ops->meram_update(mdev, cfg,
+ base_addr_y, base_addr_c,
+- &icb_addr_y, &icb_addr_c);
++ &base_addr_y, &base_addr_c);
+ if (ret)
+ return ret;
++ }
+
+- lcdc_write_chan_mirror(ch, LDSA1R, icb_addr_y);
+- if (icb_addr_c)
+- lcdc_write_chan_mirror(ch, LDSA2R, icb_addr_c);
++ ch->base_addr_y = base_addr_y;
++ ch->base_addr_c = base_addr_c;
+
+- }
++ lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y);
++ if (var->nonstd)
++ lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c);
+
+ if (lcdc_chan_is_sublcd(ch))
+ lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_SRS);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0109-fbdev-sh_mobile_lcdc-Restart-LCDC-in-runtime-PM-resu.patch b/patches.armadillo800eva/0109-fbdev-sh_mobile_lcdc-Restart-LCDC-in-runtime-PM-resu.patch
new file mode 100644
index 00000000000000..0d109b804c51b3
--- /dev/null
+++ b/patches.armadillo800eva/0109-fbdev-sh_mobile_lcdc-Restart-LCDC-in-runtime-PM-resu.patch
@@ -0,0 +1,120 @@
+From a5c2ad5d6ffebc6230d9a50263cff48b22e87ebd Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_lcdc: Restart LCDC in runtime PM resume handler
+
+Instead of restoring registers blindly, restart the LCDC by going
+through the startup sequence when resuming from runtime PM suspend. All
+registers are now correctly initialized in the right order.
+
+As a side effect, this also gets rid fo a possible panning restore issue
+caused by always saving the frame buffer base address registers from set
+A instead of the currently active set.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 2427bb241b1db35c6e699ad55adf4a30083b79cd)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 49 ++++----------------------------------
+ drivers/video/sh_mobile_lcdcfb.h | 1 -
+ 2 files changed, 5 insertions(+), 45 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 69c267a..0b7b492 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -32,17 +32,6 @@
+ #define SIDE_B_OFFSET 0x1000
+ #define MIRROR_OFFSET 0x2000
+
+-/* shared registers and their order for context save/restore */
+-static int lcdc_shared_regs[] = {
+- _LDDCKR,
+- _LDDCKSTPR,
+- _LDINTR,
+- _LDDDSR,
+- _LDCNT1R,
+- _LDCNT2R,
+-};
+-#define NR_SHARED_REGS ARRAY_SIZE(lcdc_shared_regs)
+-
+ #define MAX_XRES 1920
+ #define MAX_YRES 1080
+
+@@ -111,7 +100,6 @@ struct sh_mobile_lcdc_priv {
+ unsigned long lddckr;
+ struct sh_mobile_lcdc_chan ch[2];
+ struct notifier_block notifier;
+- unsigned long saved_shared_regs[NR_SHARED_REGS];
+ int started;
+ int forced_bpp; /* 2 channel LCDC must share bpp setting */
+ struct sh_mobile_meram_info *meram_dev;
+@@ -1289,47 +1277,20 @@ static int sh_mobile_lcdc_resume(struct device *dev)
+ static int sh_mobile_lcdc_runtime_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+- struct sh_mobile_lcdc_priv *p = platform_get_drvdata(pdev);
+- struct sh_mobile_lcdc_chan *ch;
+- int k, n;
+-
+- /* save per-channel registers */
+- for (k = 0; k < ARRAY_SIZE(p->ch); k++) {
+- ch = &p->ch[k];
+- if (!ch->enabled)
+- continue;
+- for (n = 0; n < NR_CH_REGS; n++)
+- ch->saved_ch_regs[n] = lcdc_read_chan(ch, n);
+- }
+-
+- /* save shared registers */
+- for (n = 0; n < NR_SHARED_REGS; n++)
+- p->saved_shared_regs[n] = lcdc_read(p, lcdc_shared_regs[n]);
++ struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
+
+ /* turn off LCDC hardware */
+- lcdc_write(p, _LDCNT1R, 0);
++ lcdc_write(priv, _LDCNT1R, 0);
++
+ return 0;
+ }
+
+ static int sh_mobile_lcdc_runtime_resume(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+- struct sh_mobile_lcdc_priv *p = platform_get_drvdata(pdev);
+- struct sh_mobile_lcdc_chan *ch;
+- int k, n;
+-
+- /* restore per-channel registers */
+- for (k = 0; k < ARRAY_SIZE(p->ch); k++) {
+- ch = &p->ch[k];
+- if (!ch->enabled)
+- continue;
+- for (n = 0; n < NR_CH_REGS; n++)
+- lcdc_write_chan(ch, n, ch->saved_ch_regs[n]);
+- }
++ struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
+
+- /* restore shared registers */
+- for (n = 0; n < NR_SHARED_REGS; n++)
+- lcdc_write(p, lcdc_shared_regs[n], p->saved_shared_regs[n]);
++ __sh_mobile_lcdc_start(priv);
+
+ return 0;
+ }
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index a06219b..a58a0f3 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -32,7 +32,6 @@ struct sh_mobile_lcdc_chan {
+ unsigned long enabled; /* ME and SE in LDCNT2R */
+ struct sh_mobile_lcdc_chan_cfg cfg;
+ u32 pseudo_palette[PALETTE_NR];
+- unsigned long saved_ch_regs[NR_CH_REGS];
+ struct fb_info *info;
+ struct backlight_device *bl;
+ dma_addr_t dma_handle;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0110-fbdev-sh_mobile_meram-Replace-hardcoded-register-val.patch b/patches.armadillo800eva/0110-fbdev-sh_mobile_meram-Replace-hardcoded-register-val.patch
new file mode 100644
index 00000000000000..af8ccd51c463f1
--- /dev/null
+++ b/patches.armadillo800eva/0110-fbdev-sh_mobile_meram-Replace-hardcoded-register-val.patch
@@ -0,0 +1,162 @@
+From a49f66a7d8b886c5e47a3af179e386b87204a693 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_meram: Replace hardcoded register values with
+ macros
+
+Instead of hardcoding register values through the driver, define macros
+for individual register bits using the register name and the bit name,
+and use the macros.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit f0a260fef6943c60bae65ae52fc4fa52e7f078b1)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 97 ++++++++++++++++++++++++++++-----------
+ 1 file changed, 71 insertions(+), 26 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 39f28a1..85577cf 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -20,22 +20,67 @@
+ #include "sh_mobile_meram.h"
+
+ /* meram registers */
+-#define MExxCTL 0x0
+-#define MExxBSIZE 0x4
+-#define MExxMNCF 0x8
+-#define MExxSARA 0x10
+-#define MExxSARB 0x14
+-#define MExxSBSIZE 0x18
+-
+-#define MERAM_MExxCTL_VAL(ctl, next_icb, addr) \
+- ((ctl) | (((next_icb) & 0x1f) << 11) | (((addr) & 0x7ff) << 16))
+-#define MERAM_MExxBSIZE_VAL(a, b, c) \
+- (((a) << 28) | ((b) << 16) | (c))
+-
+-#define MEVCR1 0x4
+-#define MEACTS 0x10
+-#define MEQSEL1 0x40
+-#define MEQSEL2 0x44
++#define MEVCR1 0x4
++#define MEVCR1_RST (1 << 31)
++#define MEVCR1_WD (1 << 30)
++#define MEVCR1_AMD1 (1 << 29)
++#define MEVCR1_AMD0 (1 << 28)
++#define MEQSEL1 0x40
++#define MEQSEL2 0x44
++
++#define MExxCTL 0x400
++#define MExxCTL_BV (1 << 31)
++#define MExxCTL_BSZ_SHIFT 28
++#define MExxCTL_MSAR_MASK (0x7ff << MExxCTL_MSAR_SHIFT)
++#define MExxCTL_MSAR_SHIFT 16
++#define MExxCTL_NXT_MASK (0x1f << MExxCTL_NXT_SHIFT)
++#define MExxCTL_NXT_SHIFT 11
++#define MExxCTL_WD1 (1 << 10)
++#define MExxCTL_WD0 (1 << 9)
++#define MExxCTL_WS (1 << 8)
++#define MExxCTL_CB (1 << 7)
++#define MExxCTL_WBF (1 << 6)
++#define MExxCTL_WF (1 << 5)
++#define MExxCTL_RF (1 << 4)
++#define MExxCTL_CM (1 << 3)
++#define MExxCTL_MD_READ (1 << 0)
++#define MExxCTL_MD_WRITE (2 << 0)
++#define MExxCTL_MD_ICB_WB (3 << 0)
++#define MExxCTL_MD_ICB (4 << 0)
++#define MExxCTL_MD_FB (7 << 0)
++#define MExxCTL_MD_MASK (7 << 0)
++#define MExxBSIZE 0x404
++#define MExxBSIZE_RCNT_SHIFT 28
++#define MExxBSIZE_YSZM1_SHIFT 16
++#define MExxBSIZE_XSZM1_SHIFT 0
++#define MExxMNCF 0x408
++#define MExxMNCF_KWBNM_SHIFT 28
++#define MExxMNCF_KRBNM_SHIFT 24
++#define MExxMNCF_BNM_SHIFT 16
++#define MExxMNCF_XBV (1 << 15)
++#define MExxMNCF_CPL_YCBCR444 (1 << 12)
++#define MExxMNCF_CPL_YCBCR420 (2 << 12)
++#define MExxMNCF_CPL_YCBCR422 (3 << 12)
++#define MExxMNCF_CPL_MSK (3 << 12)
++#define MExxMNCF_BL (1 << 2)
++#define MExxMNCF_LNM_SHIFT 0
++#define MExxSARA 0x410
++#define MExxSARB 0x414
++#define MExxSBSIZE 0x418
++#define MExxSBSIZE_HDV (1 << 31)
++#define MExxSBSIZE_HSZ16 (0 << 28)
++#define MExxSBSIZE_HSZ32 (1 << 28)
++#define MExxSBSIZE_HSZ64 (2 << 28)
++#define MExxSBSIZE_HSZ128 (3 << 28)
++#define MExxSBSIZE_SBSIZZ_SHIFT 0
++
++#define MERAM_MExxCTL_VAL(next, addr) \
++ ((((next) << MExxCTL_NXT_SHIFT) & MExxCTL_NXT_MASK) | \
++ (((addr) << MExxCTL_MSAR_SHIFT) & MExxCTL_MSAR_MASK))
++#define MERAM_MExxBSIZE_VAL(rcnt, yszm1, xszm1) \
++ (((rcnt) << MExxBSIZE_RCNT_SHIFT) | \
++ ((yszm1) << MExxBSIZE_YSZM1_SHIFT) | \
++ ((xszm1) << MExxBSIZE_XSZM1_SHIFT))
+
+ static unsigned long common_regs[] = {
+ MEVCR1,
+@@ -72,8 +117,7 @@ struct sh_mobile_meram_priv {
+ * MERAM/ICB access functions
+ */
+
+-#define MERAM_ICB_OFFSET(base, idx, off) \
+- ((base) + (0x400 + ((idx) * 0x20) + (off)))
++#define MERAM_ICB_OFFSET(base, idx, off) ((base) + (off) + (idx) * 0x20)
+
+ static inline void meram_write_icb(void __iomem *base, int idx, int off,
+ unsigned long val)
+@@ -308,17 +352,18 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ /*
+ * Set MERAM for framebuffer
+ *
+- * 0x70f: WD = 0x3, WS=0x1, CM=0x1, MD=FB mode
+ * we also chain the cache_icb and the marker_icb.
+ * we also split the allocated MERAM buffer between two ICBs.
+ */
+ meram_write_icb(priv->base, icb->cache_icb, MExxCTL,
+- MERAM_MExxCTL_VAL(0x70f, icb->marker_icb,
+- icb->meram_offset));
++ MERAM_MExxCTL_VAL(icb->marker_icb, icb->meram_offset) |
++ MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM |
++ MExxCTL_MD_FB);
+ meram_write_icb(priv->base, icb->marker_icb, MExxCTL,
+- MERAM_MExxCTL_VAL(0x70f, icb->cache_icb,
+- icb->meram_offset +
+- icb->meram_size / 2));
++ MERAM_MExxCTL_VAL(icb->cache_icb, icb->meram_offset +
++ icb->meram_size / 2) |
++ MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM |
++ MExxCTL_MD_FB);
+
+ return 0;
+ }
+@@ -507,7 +552,7 @@ static int sh_mobile_meram_runtime_suspend(struct device *dev)
+ /* Reset ICB on resume */
+ if (icb_regs[k] == MExxCTL)
+ priv->icb_saved_regs[j * ICB_REGS_SIZE + k] =
+- 0x70;
++ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF;
+ }
+ }
+ return 0;
+@@ -592,7 +637,7 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+
+ /* initialize ICB addressing mode */
+ if (pdata->addr_mode == SH_MOBILE_MERAM_MODE1)
+- meram_write_reg(priv->base, MEVCR1, 1 << 29);
++ meram_write_reg(priv->base, MEVCR1, MEVCR1_AMD1);
+
+ pm_runtime_enable(&pdev->dev);
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0111-fbdev-sh_mobile_meram-Validate-ICB-configuration-out.patch b/patches.armadillo800eva/0111-fbdev-sh_mobile_meram-Validate-ICB-configuration-out.patch
new file mode 100644
index 00000000000000..015b03fb2aba66
--- /dev/null
+++ b/patches.armadillo800eva/0111-fbdev-sh_mobile_meram-Validate-ICB-configuration-out.patch
@@ -0,0 +1,56 @@
+From 89b84aedbe39e0e31c4a5d289527b207657e6bc0 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_meram: Validate ICB configuration outside mutex
+
+Validate as much of the requested ICB configuration as possible outside
+of the mutex-protected region when registering ICBs.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 7963e21e50c8e712553347f900f0d0afaf5be2aa)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 18 ++++++++----------
+ 1 file changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 85577cf..25a7118 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -410,24 +410,22 @@ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ xres, yres, (!pixelformat) ? "yuv" : "rgb",
+ base_addr_y, base_addr_c);
+
+- mutex_lock(&priv->lock);
+-
+ /* we can't handle wider than 8192px */
+ if (xres > 8192) {
+ dev_err(&pdev->dev, "width exceeding the limit (> 8192).");
+- error = -EINVAL;
+- goto err;
+- }
+-
+- if (priv->used_meram_cache_regions + 2 > SH_MOBILE_MERAM_ICB_NUM) {
+- dev_err(&pdev->dev, "no more ICB available.");
+- error = -EINVAL;
+- goto err;
++ return -EINVAL;
+ }
+
+ /* do we have at least one ICB config? */
+ if (cfg->icb[0].marker_icb < 0 || cfg->icb[0].cache_icb < 0) {
+ dev_err(&pdev->dev, "at least one ICB is required.");
++ return -EINVAL;
++ }
++
++ mutex_lock(&priv->lock);
++
++ if (priv->used_meram_cache_regions + 2 > SH_MOBILE_MERAM_ICB_NUM) {
++ dev_err(&pdev->dev, "no more ICB available.");
+ error = -EINVAL;
+ goto err;
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0112-fbdev-sh_mobile_meram-Fix-MExxCTL-register-save-on-r.patch b/patches.armadillo800eva/0112-fbdev-sh_mobile_meram-Fix-MExxCTL-register-save-on-r.patch
new file mode 100644
index 00000000000000..398dfa31351275
--- /dev/null
+++ b/patches.armadillo800eva/0112-fbdev-sh_mobile_meram-Fix-MExxCTL-register-save-on-r.patch
@@ -0,0 +1,36 @@
+From 09bd9eb3222ee896966878de283d90ebfc686ab5 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_meram: Fix MExxCTL register save on runtime PM
+ suspend
+
+To reset the ICB on resume the MExxCTL register needs to be OR'ed with
+MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF, no set to that value. Fix this.
+
+This fixes corruption at the bottom of the display when resuming from
+runtime PM.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit d86d29df57adf9258f56939e59cdd70932845885)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 25a7118..7ba6dce 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -549,7 +549,7 @@ static int sh_mobile_meram_runtime_suspend(struct device *dev)
+ meram_read_icb(priv->base, j, icb_regs[k]);
+ /* Reset ICB on resume */
+ if (icb_regs[k] == MExxCTL)
+- priv->icb_saved_regs[j * ICB_REGS_SIZE + k] =
++ priv->icb_saved_regs[j * ICB_REGS_SIZE + k] |=
+ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF;
+ }
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0113-fbdev-sh_mobile_meram-Remove-unneeded-sh_mobile_mera.patch b/patches.armadillo800eva/0113-fbdev-sh_mobile_meram-Remove-unneeded-sh_mobile_mera.patch
new file mode 100644
index 00000000000000..63eb7142d59013
--- /dev/null
+++ b/patches.armadillo800eva/0113-fbdev-sh_mobile_meram-Remove-unneeded-sh_mobile_mera.patch
@@ -0,0 +1,101 @@
+From 7f44def1067de547be05419f7d765d4f373c015a Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 13 Jul 2011 12:13:47 +0200
+Subject: fbdev: sh_mobile_meram: Remove unneeded sh_mobile_meram.h
+
+The drivers/video/sh_mobile_meram.h header contains unused definitions
+and declarations. Move the only used macro to sh_mobile_meram.c, and
+remove the header.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 8a20974f0370fe1b924704399e7ba327d894ef72)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 2 +-
+ drivers/video/sh_mobile_meram.c | 5 +++--
+ drivers/video/sh_mobile_meram.h | 33 ---------------------------------
+ 3 files changed, 4 insertions(+), 36 deletions(-)
+ delete mode 100644 drivers/video/sh_mobile_meram.h
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 0b7b492..088cb17 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -24,10 +24,10 @@
+ #include <linux/backlight.h>
+ #include <linux/gpio.h>
+ #include <video/sh_mobile_lcdc.h>
++#include <video/sh_mobile_meram.h>
+ #include <linux/atomic.h>
+
+ #include "sh_mobile_lcdcfb.h"
+-#include "sh_mobile_meram.h"
+
+ #define SIDE_B_OFFSET 0x1000
+ #define MIRROR_OFFSET 0x2000
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 7ba6dce..f632970 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -16,8 +16,7 @@
+ #include <linux/io.h>
+ #include <linux/slab.h>
+ #include <linux/platform_device.h>
+-
+-#include "sh_mobile_meram.h"
++#include <video/sh_mobile_meram.h>
+
+ /* meram registers */
+ #define MEVCR1 0x4
+@@ -82,6 +81,8 @@
+ ((yszm1) << MExxBSIZE_YSZM1_SHIFT) | \
+ ((xszm1) << MExxBSIZE_XSZM1_SHIFT))
+
++#define SH_MOBILE_MERAM_ICB_NUM 32
++
+ static unsigned long common_regs[] = {
+ MEVCR1,
+ MEQSEL1,
+diff --git a/drivers/video/sh_mobile_meram.h b/drivers/video/sh_mobile_meram.h
+deleted file mode 100644
+index 1615204b..0000000
+--- a/drivers/video/sh_mobile_meram.h
++++ /dev/null
+@@ -1,33 +0,0 @@
+-#ifndef __sh_mobile_meram_h__
+-#define __sh_mobile_meram_h__
+-
+-#include <linux/mutex.h>
+-#include <video/sh_mobile_meram.h>
+-
+-/*
+- * MERAM private
+- */
+-
+-#define MERAM_ICB_Y 0x1
+-#define MERAM_ICB_C 0x2
+-
+-/* MERAM cache size */
+-#define SH_MOBILE_MERAM_ICB_NUM 32
+-
+-#define SH_MOBILE_MERAM_CACHE_OFFSET(p) ((p) >> 16)
+-#define SH_MOBILE_MERAM_CACHE_SIZE(p) ((p) & 0xffff)
+-
+-int sh_mobile_meram_alloc_icb(const struct sh_mobile_meram_cfg *cfg,
+- int xres,
+- int yres,
+- unsigned int base_addr,
+- int yuv_mode,
+- int *marker_icb,
+- int *out_pitch);
+-
+-void sh_mobile_meram_free_icb(int marker_icb);
+-
+-#define SH_MOBILE_MERAM_START(ind, ab) \
+- (0xC0000000 | ((ab & 0x1) << 23) | ((ind & 0x1F) << 24))
+-
+-#endif /* !__sh_mobile_meram_h__ */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0114-sh_mobile_meram-Reset-ICBs-at-unregistration-time.patch b/patches.armadillo800eva/0114-sh_mobile_meram-Reset-ICBs-at-unregistration-time.patch
new file mode 100644
index 00000000000000..e30ec617658c50
--- /dev/null
+++ b/patches.armadillo800eva/0114-sh_mobile_meram-Reset-ICBs-at-unregistration-time.patch
@@ -0,0 +1,38 @@
+From a3d7fb0249ed6db32c6d99fc726e9cc919fdfd38 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 31 Aug 2011 13:00:52 +0200
+Subject: sh_mobile_meram: Reset ICBs at unregistration time
+
+When ICBs are unregistered and later reused they need to be reset to
+avoid data corruption. Set the WBF, WF and RF bits to make sure ICBs get
+reset properly.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit da6cf5125f66ed1810616937777884cea021e66a)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index f632970..4d63490 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -373,8 +373,10 @@ static void meram_deinit(struct sh_mobile_meram_priv *priv,
+ struct sh_mobile_meram_icb *icb)
+ {
+ /* disable ICB */
+- meram_write_icb(priv->base, icb->cache_icb, MExxCTL, 0);
+- meram_write_icb(priv->base, icb->marker_icb, MExxCTL, 0);
++ meram_write_icb(priv->base, icb->cache_icb, MExxCTL,
++ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF);
++ meram_write_icb(priv->base, icb->marker_icb, MExxCTL,
++ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF);
+ icb->cache_unit = 0;
+ }
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0115-fbdev-sh_mobile_lcdc-Adjust-requested-parameters-in-.patch b/patches.armadillo800eva/0115-fbdev-sh_mobile_lcdc-Adjust-requested-parameters-in-.patch
new file mode 100644
index 00000000000000..a9828594352308
--- /dev/null
+++ b/patches.armadillo800eva/0115-fbdev-sh_mobile_lcdc-Adjust-requested-parameters-in-.patch
@@ -0,0 +1,142 @@
+From c37da1d84d5fa1c39e811adf761f274d2789131f Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 31 Aug 2011 13:00:53 +0200
+Subject: fbdev: sh_mobile_lcdc: Adjust requested parameters in .fb_check_var
+
+Instead of failing when the requested fb_var_screeninfo parameters are
+not supported, adjust the parameters according to the hardware
+capabilities.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 0386219441d48e0f0902e9f145f0d75ad952d753)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 103 ++++++++++++++++++++++++++++++++------
+ 1 file changed, 88 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 088cb17..33b0ff8 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1055,28 +1055,101 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ {
+ struct sh_mobile_lcdc_chan *ch = info->par;
+ struct sh_mobile_lcdc_priv *p = ch->lcdc;
++ unsigned int best_dist = (unsigned int)-1;
++ unsigned int best_xres = 0;
++ unsigned int best_yres = 0;
++ unsigned int i;
+
+- if (var->xres > MAX_XRES || var->yres > MAX_YRES ||
+- var->xres * var->yres * (ch->cfg.bpp / 8) * 2 > info->fix.smem_len) {
+- dev_warn(info->dev, "Invalid info: %u-%u-%u-%u x %u-%u-%u-%u @ %lukHz!\n",
+- var->left_margin, var->xres, var->right_margin, var->hsync_len,
+- var->upper_margin, var->yres, var->lower_margin, var->vsync_len,
+- PICOS2KHZ(var->pixclock));
++ if (var->xres > MAX_XRES || var->yres > MAX_YRES)
+ return -EINVAL;
++
++ /* If board code provides us with a list of available modes, make sure
++ * we use one of them. Find the mode closest to the requested one. The
++ * distance between two modes is defined as the size of the
++ * non-overlapping parts of the two rectangles.
++ */
++ for (i = 0; i < ch->cfg.num_cfg; ++i) {
++ const struct fb_videomode *mode = &ch->cfg.lcd_cfg[i];
++ unsigned int dist;
++
++ /* We can only round up. */
++ if (var->xres > mode->xres || var->yres > mode->yres)
++ continue;
++
++ dist = var->xres * var->yres + mode->xres * mode->yres
++ - 2 * min(var->xres, mode->xres)
++ * min(var->yres, mode->yres);
++
++ if (dist < best_dist) {
++ best_xres = mode->xres;
++ best_yres = mode->yres;
++ best_dist = dist;
++ }
+ }
+
+- /* only accept the forced_bpp for dual channel configurations */
+- if (p->forced_bpp && p->forced_bpp != var->bits_per_pixel)
++ /* If no available mode can be used, return an error. */
++ if (ch->cfg.num_cfg != 0) {
++ if (best_dist == (unsigned int)-1)
++ return -EINVAL;
++
++ var->xres = best_xres;
++ var->yres = best_yres;
++ }
++
++ /* Make sure the virtual resolution is at least as big as the visible
++ * resolution.
++ */
++ if (var->xres_virtual < var->xres)
++ var->xres_virtual = var->xres;
++ if (var->yres_virtual < var->yres)
++ var->yres_virtual = var->yres;
++
++ if (var->bits_per_pixel <= 16) { /* RGB 565 */
++ var->bits_per_pixel = 16;
++ var->red.offset = 11;
++ var->red.length = 5;
++ var->green.offset = 5;
++ var->green.length = 6;
++ var->blue.offset = 0;
++ var->blue.length = 5;
++ var->transp.offset = 0;
++ var->transp.length = 0;
++ } else if (var->bits_per_pixel <= 24) { /* RGB 888 */
++ var->bits_per_pixel = 24;
++ var->red.offset = 16;
++ var->red.length = 8;
++ var->green.offset = 8;
++ var->green.length = 8;
++ var->blue.offset = 0;
++ var->blue.length = 8;
++ var->transp.offset = 0;
++ var->transp.length = 0;
++ } else if (var->bits_per_pixel <= 32) { /* RGBA 888 */
++ var->bits_per_pixel = 32;
++ var->red.offset = 16;
++ var->red.length = 8;
++ var->green.offset = 8;
++ var->green.length = 8;
++ var->blue.offset = 0;
++ var->blue.length = 8;
++ var->transp.offset = 24;
++ var->transp.length = 8;
++ } else
+ return -EINVAL;
+
+- switch (var->bits_per_pixel) {
+- case 16: /* PKF[4:0] = 00011 - RGB 565 */
+- case 24: /* PKF[4:0] = 01011 - RGB 888 */
+- case 32: /* PKF[4:0] = 00000 - RGBA 888 */
+- break;
+- default:
++ var->red.msb_right = 0;
++ var->green.msb_right = 0;
++ var->blue.msb_right = 0;
++ var->transp.msb_right = 0;
++
++ /* Make sure we don't exceed our allocated memory. */
++ if (var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8 >
++ info->fix.smem_len)
++ return -EINVAL;
++
++ /* only accept the forced_bpp for dual channel configurations */
++ if (p->forced_bpp && p->forced_bpp != var->bits_per_pixel)
+ return -EINVAL;
+- }
+
+ return 0;
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0116-fbdev-sh_mobile_lcdc-Add-support-for-format-changes-.patch b/patches.armadillo800eva/0116-fbdev-sh_mobile_lcdc-Add-support-for-format-changes-.patch
new file mode 100644
index 00000000000000..ff92ebff1b7c25
--- /dev/null
+++ b/patches.armadillo800eva/0116-fbdev-sh_mobile_lcdc-Add-support-for-format-changes-.patch
@@ -0,0 +1,51 @@
+From e2d64963daac294aedfa4d8a08ad5761e5fbf846 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 31 Aug 2011 13:00:54 +0200
+Subject: fbdev: sh_mobile_lcdc: Add support for format changes at runtime
+
+Implement .fb_set_par to support frame buffer format changes at runtime.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit ed5bebf29e82beab3456901e26a495ae0a49ebad)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 33b0ff8..f9f420d 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1154,6 +1154,19 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ return 0;
+ }
+
++static int sh_mobile_set_par(struct fb_info *info)
++{
++ struct sh_mobile_lcdc_chan *ch = info->par;
++ int ret;
++
++ sh_mobile_lcdc_stop(ch->lcdc);
++ ret = sh_mobile_lcdc_start(ch->lcdc);
++ if (ret < 0)
++ dev_err(info->dev, "%s: unable to restart LCDC\n", __func__);
++
++ return ret;
++}
++
+ /*
+ * Screen blanking. Behavior is as follows:
+ * FB_BLANK_UNBLANK: screen unblanked, clocks enabled
+@@ -1211,6 +1224,7 @@ static struct fb_ops sh_mobile_lcdc_ops = {
+ .fb_open = sh_mobile_open,
+ .fb_release = sh_mobile_release,
+ .fb_check_var = sh_mobile_check_var,
++ .fb_set_par = sh_mobile_set_par,
+ };
+
+ static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0117-fbdev-sh_mobile_lcdc-use-display-information-in-info.patch b/patches.armadillo800eva/0117-fbdev-sh_mobile_lcdc-use-display-information-in-info.patch
new file mode 100644
index 00000000000000..bc96908b8a0f53
--- /dev/null
+++ b/patches.armadillo800eva/0117-fbdev-sh_mobile_lcdc-use-display-information-in-info.patch
@@ -0,0 +1,71 @@
+From 08eb10f68bdd1e24a58aee50502b81a861a14308 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 31 Aug 2011 13:00:55 +0200
+Subject: fbdev: sh_mobile_lcdc: use display information in info for panning
+
+We must not use any information in the passed var besides xoffset,
+yoffset and vmode as otherwise applications might abuse it.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit dc1d5adab5cc57eb732407d80c9e7ae48891ffca)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index f9f420d..1ff215c 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -877,12 +877,12 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ unsigned long base_addr_y, base_addr_c;
+ unsigned long c_offset;
+
+- if (!var->nonstd)
+- new_pan_offset = (var->yoffset * info->fix.line_length) +
+- (var->xoffset * (info->var.bits_per_pixel / 8));
++ if (!info->var.nonstd)
++ new_pan_offset = var->yoffset * info->fix.line_length
++ + var->xoffset * (info->var.bits_per_pixel / 8);
+ else
+- new_pan_offset = (var->yoffset * info->fix.line_length) +
+- (var->xoffset);
++ new_pan_offset = var->yoffset * info->fix.line_length
++ + var->xoffset;
+
+ if (new_pan_offset == ch->pan_offset)
+ return 0; /* No change, do nothing */
+@@ -891,13 +891,13 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+
+ /* Set the source address for the next refresh */
+ base_addr_y = ch->dma_handle + new_pan_offset;
+- if (var->nonstd) {
++ if (info->var.nonstd) {
+ /* Set y offset */
+- c_offset = (var->yoffset *
+- info->fix.line_length *
+- (info->var.bits_per_pixel - 8)) / 8;
+- base_addr_c = ch->dma_handle + var->xres * var->yres_virtual +
+- c_offset;
++ c_offset = var->yoffset * info->fix.line_length
++ * (info->var.bits_per_pixel - 8) / 8;
++ base_addr_c = ch->dma_handle
++ + info->var.xres * info->var.yres_virtual
++ + c_offset;
+ /* Set x offset */
+ if (info->var.bits_per_pixel == 24)
+ base_addr_c += 2 * var->xoffset;
+@@ -923,7 +923,7 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ ch->base_addr_c = base_addr_c;
+
+ lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y);
+- if (var->nonstd)
++ if (info->var.nonstd)
+ lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c);
+
+ if (lcdc_chan_is_sublcd(ch))
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0118-fbdev-sh_mobile_lcdc-Update-fix.line_length-in-.fb_s.patch b/patches.armadillo800eva/0118-fbdev-sh_mobile_lcdc-Update-fix.line_length-in-.fb_s.patch
new file mode 100644
index 00000000000000..1ed2d2a568455e
--- /dev/null
+++ b/patches.armadillo800eva/0118-fbdev-sh_mobile_lcdc-Update-fix.line_length-in-.fb_s.patch
@@ -0,0 +1,61 @@
+From 9b846f132ae1db5220b7d92a59f599d167df3c01 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 31 Aug 2011 13:00:56 +0200
+Subject: fbdev: sh_mobile_lcdc: Update fix.line_length in .fb_set_par()
+
+Instead of updating the fixed screen information line length manually
+after calling fb_set_var() in sh_mobile_fb_reconfig(), update the field
+in the .fb_set_par() operation handler.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 91fba48d59666718e3d3e86964755b80d39cdbdd)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 1ff215c..b6da1d6 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -998,11 +998,6 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
+ /* Couldn't reconfigure, hopefully, can continue as before */
+ return;
+
+- if (info->var.nonstd)
+- info->fix.line_length = mode1.xres;
+- else
+- info->fix.line_length = mode1.xres * (ch->cfg.bpp / 8);
+-
+ /*
+ * fb_set_var() calls the notifier change internally, only if
+ * FBINFO_MISC_USEREVENT flag is set. Since we do not want to fake a
+@@ -1157,12 +1152,22 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ static int sh_mobile_set_par(struct fb_info *info)
+ {
+ struct sh_mobile_lcdc_chan *ch = info->par;
++ u32 line_length = info->fix.line_length;
+ int ret;
+
+ sh_mobile_lcdc_stop(ch->lcdc);
++
++ if (info->var.nonstd)
++ info->fix.line_length = info->var.xres;
++ else
++ info->fix.line_length = info->var.xres
++ * info->var.bits_per_pixel / 8;
++
+ ret = sh_mobile_lcdc_start(ch->lcdc);
+- if (ret < 0)
++ if (ret < 0) {
+ dev_err(info->dev, "%s: unable to restart LCDC\n", __func__);
++ info->fix.line_length = line_length;
++ }
+
+ return ret;
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0119-fbdev-sh_mobile_lcdc-Avoid-forward-declarations.patch b/patches.armadillo800eva/0119-fbdev-sh_mobile_lcdc-Avoid-forward-declarations.patch
new file mode 100644
index 00000000000000..c9f24ecad1bdcb
--- /dev/null
+++ b/patches.armadillo800eva/0119-fbdev-sh_mobile_lcdc-Avoid-forward-declarations.patch
@@ -0,0 +1,139 @@
+From 2a1254b8c2db1dff2f38c6ebc6cc92965ba077c6 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 31 Aug 2011 13:00:57 +0200
+Subject: fbdev: sh_mobile_lcdc: Avoid forward declarations
+
+Reorder probe/remove functions to avoid forward declarations.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit b4bee692e5d5a3beb5b59ca7967c0a98e3efcc26)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 102 +++++++++++++++++++-------------------
+ 1 file changed, 50 insertions(+), 52 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index b6da1d6..366315b 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1434,7 +1434,56 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
+ return NOTIFY_OK;
+ }
+
+-static int sh_mobile_lcdc_remove(struct platform_device *pdev);
++static int sh_mobile_lcdc_remove(struct platform_device *pdev)
++{
++ struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
++ struct fb_info *info;
++ int i;
++
++ fb_unregister_client(&priv->notifier);
++
++ for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
++ if (priv->ch[i].info && priv->ch[i].info->dev)
++ unregister_framebuffer(priv->ch[i].info);
++
++ sh_mobile_lcdc_stop(priv);
++
++ for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
++ info = priv->ch[i].info;
++
++ if (!info || !info->device)
++ continue;
++
++ if (priv->ch[i].sglist)
++ vfree(priv->ch[i].sglist);
++
++ if (info->screen_base)
++ dma_free_coherent(&pdev->dev, info->fix.smem_len,
++ info->screen_base,
++ priv->ch[i].dma_handle);
++ fb_dealloc_cmap(&info->cmap);
++ framebuffer_release(info);
++ }
++
++ for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
++ if (priv->ch[i].bl)
++ sh_mobile_lcdc_bl_remove(priv->ch[i].bl);
++ }
++
++ if (priv->dot_clk)
++ clk_put(priv->dot_clk);
++
++ if (priv->dev)
++ pm_runtime_disable(priv->dev);
++
++ if (priv->base)
++ iounmap(priv->base);
++
++ if (priv->irq)
++ free_irq(priv->irq, priv);
++ kfree(priv);
++ return 0;
++}
+
+ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ {
+@@ -1691,57 +1740,6 @@ err1:
+ return error;
+ }
+
+-static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+-{
+- struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
+- struct fb_info *info;
+- int i;
+-
+- fb_unregister_client(&priv->notifier);
+-
+- for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
+- if (priv->ch[i].info && priv->ch[i].info->dev)
+- unregister_framebuffer(priv->ch[i].info);
+-
+- sh_mobile_lcdc_stop(priv);
+-
+- for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
+- info = priv->ch[i].info;
+-
+- if (!info || !info->device)
+- continue;
+-
+- if (priv->ch[i].sglist)
+- vfree(priv->ch[i].sglist);
+-
+- if (info->screen_base)
+- dma_free_coherent(&pdev->dev, info->fix.smem_len,
+- info->screen_base,
+- priv->ch[i].dma_handle);
+- fb_dealloc_cmap(&info->cmap);
+- framebuffer_release(info);
+- }
+-
+- for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
+- if (priv->ch[i].bl)
+- sh_mobile_lcdc_bl_remove(priv->ch[i].bl);
+- }
+-
+- if (priv->dot_clk)
+- clk_put(priv->dot_clk);
+-
+- if (priv->dev)
+- pm_runtime_disable(priv->dev);
+-
+- if (priv->base)
+- iounmap(priv->base);
+-
+- if (priv->irq)
+- free_irq(priv->irq, priv);
+- kfree(priv);
+- return 0;
+-}
+-
+ static struct platform_driver sh_mobile_lcdc_driver = {
+ .driver = {
+ .name = "sh_mobile_lcdc_fb",
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0120-fbdev-sh_mobile_lcdc-Split-channel-initialization-fr.patch b/patches.armadillo800eva/0120-fbdev-sh_mobile_lcdc-Split-channel-initialization-fr.patch
new file mode 100644
index 00000000000000..83d8c557eaf0a3
--- /dev/null
+++ b/patches.armadillo800eva/0120-fbdev-sh_mobile_lcdc-Split-channel-initialization-fr.patch
@@ -0,0 +1,332 @@
+From 0a9d12c3d05cb18e74e8f03614af9d779928998b Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 31 Aug 2011 13:00:58 +0200
+Subject: fbdev: sh_mobile_lcdc: Split channel initialization from probe
+ function
+
+Move channel initialization to sh_mobile_lcdc_channel_init() and call
+the function from sh_mobile_lcdc_probe(). This makes the code more
+readable and prepares it for fix/var initialization rework.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 3ce05599907c604a8af9cefe8c5e0702a30d1112)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 247 ++++++++++++++++++++------------------
+ 1 file changed, 129 insertions(+), 118 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 366315b..d1576e2 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1485,15 +1485,129 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+ return 0;
+ }
+
+-static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
++static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
++ struct device *dev)
+ {
++ struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg;
++ const struct fb_videomode *max_mode;
++ const struct fb_videomode *mode;
++ struct fb_var_screeninfo *var;
+ struct fb_info *info;
+- struct sh_mobile_lcdc_priv *priv;
++ unsigned int max_size;
++ int num_cfg;
++ void *buf;
++ int ret;
++ int i;
++
++ ch->info = framebuffer_alloc(0, dev);
++ if (!ch->info) {
++ dev_err(dev, "unable to allocate fb_info\n");
++ return -ENOMEM;
++ }
++
++ info = ch->info;
++ var = &info->var;
++ info->fbops = &sh_mobile_lcdc_ops;
++ info->par = ch;
++
++ mutex_init(&ch->open_lock);
++
++ /* Iterate through the modes to validate them and find the highest
++ * resolution.
++ */
++ max_mode = NULL;
++ max_size = 0;
++
++ for (i = 0, mode = cfg->lcd_cfg; i < cfg->num_cfg; i++, mode++) {
++ unsigned int size = mode->yres * mode->xres;
++
++ /* NV12 buffers must have even number of lines */
++ if ((cfg->nonstd) && cfg->bpp == 12 &&
++ (mode->yres & 0x1)) {
++ dev_err(dev, "yres must be multiple of 2 for YCbCr420 "
++ "mode.\n");
++ return -EINVAL;
++ }
++
++ if (size > max_size) {
++ max_mode = mode;
++ max_size = size;
++ }
++ }
++
++ if (!max_size)
++ max_size = MAX_XRES * MAX_YRES;
++ else
++ dev_dbg(dev, "Found largest videomode %ux%u\n",
++ max_mode->xres, max_mode->yres);
++
++ info->fix = sh_mobile_lcdc_fix;
++ info->fix.smem_len = max_size * 2 * cfg->bpp / 8;
++
++ /* Only pan in 2 line steps for NV12 */
++ if (cfg->nonstd && cfg->bpp == 12)
++ info->fix.ypanstep = 2;
++
++ if (cfg->lcd_cfg == NULL) {
++ mode = &default_720p;
++ num_cfg = 1;
++ } else {
++ mode = cfg->lcd_cfg;
++ num_cfg = cfg->num_cfg;
++ }
++
++ fb_videomode_to_modelist(mode, num_cfg, &info->modelist);
++
++ fb_videomode_to_var(var, mode);
++ var->width = cfg->lcd_size_cfg.width;
++ var->height = cfg->lcd_size_cfg.height;
++ /* Default Y virtual resolution is 2x panel size */
++ var->yres_virtual = var->yres * 2;
++ var->activate = FB_ACTIVATE_NOW;
++
++ ret = sh_mobile_lcdc_set_bpp(var, cfg->bpp, cfg->nonstd);
++ if (ret)
++ return ret;
++
++ buf = dma_alloc_coherent(dev, info->fix.smem_len, &ch->dma_handle,
++ GFP_KERNEL);
++ if (!buf) {
++ dev_err(dev, "unable to allocate buffer\n");
++ return -ENOMEM;
++ }
++
++ info->pseudo_palette = &ch->pseudo_palette;
++ info->flags = FBINFO_FLAG_DEFAULT;
++
++ ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
++ if (ret < 0) {
++ dev_err(dev, "unable to allocate cmap\n");
++ dma_free_coherent(dev, info->fix.smem_len,
++ buf, ch->dma_handle);
++ return ret;
++ }
++
++ info->fix.smem_start = ch->dma_handle;
++ if (var->nonstd)
++ info->fix.line_length = var->xres;
++ else
++ info->fix.line_length = var->xres * (cfg->bpp / 8);
++
++ info->screen_base = buf;
++ info->device = dev;
++ ch->display_var = *var;
++
++ return 0;
++}
++
++static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
++{
+ struct sh_mobile_lcdc_info *pdata = pdev->dev.platform_data;
++ struct sh_mobile_lcdc_priv *priv;
+ struct resource *res;
++ int num_channels;
+ int error;
+- void *buf;
+- int i, j;
++ int i;
+
+ if (!pdata) {
+ dev_err(&pdev->dev, "no platform data defined\n");
+@@ -1525,9 +1639,8 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ priv->irq = i;
+ atomic_set(&priv->hw_usecnt, -1);
+
+- j = 0;
+- for (i = 0; i < ARRAY_SIZE(pdata->ch); i++) {
+- struct sh_mobile_lcdc_chan *ch = priv->ch + j;
++ for (i = 0, num_channels = 0; i < ARRAY_SIZE(pdata->ch); i++) {
++ struct sh_mobile_lcdc_chan *ch = priv->ch + num_channels;
+
+ ch->lcdc = priv;
+ memcpy(&ch->cfg, &pdata->ch[i], sizeof(pdata->ch[i]));
+@@ -1549,24 +1662,24 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ case LCDC_CHAN_MAINLCD:
+ ch->enabled = LDCNT2R_ME;
+ ch->reg_offs = lcdc_offs_mainlcd;
+- j++;
++ num_channels++;
+ break;
+ case LCDC_CHAN_SUBLCD:
+ ch->enabled = LDCNT2R_SE;
+ ch->reg_offs = lcdc_offs_sublcd;
+- j++;
++ num_channels++;
+ break;
+ }
+ }
+
+- if (!j) {
++ if (!num_channels) {
+ dev_err(&pdev->dev, "no channels defined\n");
+ error = -EINVAL;
+ goto err1;
+ }
+
+ /* for dual channel LCDC (MAIN + SUB) force shared bpp setting */
+- if (j == 2)
++ if (num_channels == 2)
+ priv->forced_bpp = pdata->ch[0].bpp;
+
+ priv->base = ioremap_nocache(res->start, resource_size(res));
+@@ -1581,125 +1694,23 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+
+ priv->meram_dev = pdata->meram_dev;
+
+- for (i = 0; i < j; i++) {
+- struct fb_var_screeninfo *var;
+- const struct fb_videomode *lcd_cfg, *max_cfg = NULL;
++ for (i = 0; i < num_channels; i++) {
+ struct sh_mobile_lcdc_chan *ch = priv->ch + i;
+- struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg;
+- const struct fb_videomode *mode = cfg->lcd_cfg;
+- unsigned long max_size = 0;
+- int k;
+- int num_cfg;
+-
+- ch->info = framebuffer_alloc(0, &pdev->dev);
+- if (!ch->info) {
+- dev_err(&pdev->dev, "unable to allocate fb_info\n");
+- error = -ENOMEM;
+- break;
+- }
+-
+- info = ch->info;
+- var = &info->var;
+- info->fbops = &sh_mobile_lcdc_ops;
+- info->par = ch;
+-
+- mutex_init(&ch->open_lock);
+-
+- for (k = 0, lcd_cfg = mode;
+- k < cfg->num_cfg && lcd_cfg;
+- k++, lcd_cfg++) {
+- unsigned long size = lcd_cfg->yres * lcd_cfg->xres;
+- /* NV12 buffers must have even number of lines */
+- if ((cfg->nonstd) && cfg->bpp == 12 &&
+- (lcd_cfg->yres & 0x1)) {
+- dev_err(&pdev->dev, "yres must be multiple of 2"
+- " for YCbCr420 mode.\n");
+- error = -EINVAL;
+- goto err1;
+- }
+-
+- if (size > max_size) {
+- max_cfg = lcd_cfg;
+- max_size = size;
+- }
+- }
+-
+- if (!mode)
+- max_size = MAX_XRES * MAX_YRES;
+- else if (max_cfg)
+- dev_dbg(&pdev->dev, "Found largest videomode %ux%u\n",
+- max_cfg->xres, max_cfg->yres);
+-
+- info->fix = sh_mobile_lcdc_fix;
+- info->fix.smem_len = max_size * 2 * cfg->bpp / 8;
+-
+- /* Only pan in 2 line steps for NV12 */
+- if (cfg->nonstd && cfg->bpp == 12)
+- info->fix.ypanstep = 2;
+-
+- if (!mode) {
+- mode = &default_720p;
+- num_cfg = 1;
+- } else {
+- num_cfg = cfg->num_cfg;
+- }
+-
+- fb_videomode_to_modelist(mode, num_cfg, &info->modelist);
+
+- fb_videomode_to_var(var, mode);
+- var->width = cfg->lcd_size_cfg.width;
+- var->height = cfg->lcd_size_cfg.height;
+- /* Default Y virtual resolution is 2x panel size */
+- var->yres_virtual = var->yres * 2;
+- var->activate = FB_ACTIVATE_NOW;
+-
+- error = sh_mobile_lcdc_set_bpp(var, cfg->bpp, cfg->nonstd);
++ error = sh_mobile_lcdc_channel_init(ch, &pdev->dev);
+ if (error)
+- break;
+-
+- buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len,
+- &ch->dma_handle, GFP_KERNEL);
+- if (!buf) {
+- dev_err(&pdev->dev, "unable to allocate buffer\n");
+- error = -ENOMEM;
+- break;
+- }
+-
+- info->pseudo_palette = &ch->pseudo_palette;
+- info->flags = FBINFO_FLAG_DEFAULT;
+-
+- error = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
+- if (error < 0) {
+- dev_err(&pdev->dev, "unable to allocate cmap\n");
+- dma_free_coherent(&pdev->dev, info->fix.smem_len,
+- buf, ch->dma_handle);
+- break;
+- }
+-
+- info->fix.smem_start = ch->dma_handle;
+- if (var->nonstd)
+- info->fix.line_length = var->xres;
+- else
+- info->fix.line_length = var->xres * (cfg->bpp / 8);
+-
+- info->screen_base = buf;
+- info->device = &pdev->dev;
+- ch->display_var = *var;
++ goto err1;
+ }
+
+- if (error)
+- goto err1;
+-
+ error = sh_mobile_lcdc_start(priv);
+ if (error) {
+ dev_err(&pdev->dev, "unable to start hardware\n");
+ goto err1;
+ }
+
+- for (i = 0; i < j; i++) {
++ for (i = 0; i < num_channels; i++) {
+ struct sh_mobile_lcdc_chan *ch = priv->ch + i;
+-
+- info = ch->info;
++ struct fb_info *info = ch->info;
+
+ if (info->fbdefio) {
+ ch->sglist = vmalloc(sizeof(struct scatterlist) *
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0121-fbdev-sh_mobile_lcdc-Remove-sh_mobile_lcdc_set_bpp.patch b/patches.armadillo800eva/0121-fbdev-sh_mobile_lcdc-Remove-sh_mobile_lcdc_set_bpp.patch
new file mode 100644
index 00000000000000..8f1ce97e59f1b9
--- /dev/null
+++ b/patches.armadillo800eva/0121-fbdev-sh_mobile_lcdc-Remove-sh_mobile_lcdc_set_bpp.patch
@@ -0,0 +1,169 @@
+From f8912387b109a237c5978755d20a1b3ae7dbcb94 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 31 Aug 2011 13:00:59 +0200
+Subject: fbdev: sh_mobile_lcdc: Remove sh_mobile_lcdc_set_bpp()
+
+The function duplicates code found in sh_mobile_check_var(). Remove
+sh_mobile_lcdc_set_bpp() and call sh_mobile_check_var() instead.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit a67472ad1ae040f073e45048cbc5a01195f2e3f5)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 87 ++++++++------------------------------
+ 1 file changed, 17 insertions(+), 70 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index d1576e2..97ab8ba 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1291,66 +1291,6 @@ static void sh_mobile_lcdc_bl_remove(struct backlight_device *bdev)
+ backlight_device_unregister(bdev);
+ }
+
+-static int sh_mobile_lcdc_set_bpp(struct fb_var_screeninfo *var, int bpp,
+- int nonstd)
+-{
+- if (nonstd) {
+- switch (bpp) {
+- case 12:
+- case 16:
+- case 24:
+- var->bits_per_pixel = bpp;
+- var->nonstd = nonstd;
+- return 0;
+- default:
+- return -EINVAL;
+- }
+- }
+-
+- switch (bpp) {
+- case 16: /* PKF[4:0] = 00011 - RGB 565 */
+- var->red.offset = 11;
+- var->red.length = 5;
+- var->green.offset = 5;
+- var->green.length = 6;
+- var->blue.offset = 0;
+- var->blue.length = 5;
+- var->transp.offset = 0;
+- var->transp.length = 0;
+- break;
+-
+- case 24: /* PKF[4:0] = 01011 - RGB 888 */
+- var->red.offset = 16;
+- var->red.length = 8;
+- var->green.offset = 8;
+- var->green.length = 8;
+- var->blue.offset = 0;
+- var->blue.length = 8;
+- var->transp.offset = 0;
+- var->transp.length = 0;
+- break;
+-
+- case 32: /* PKF[4:0] = 00000 - RGBA 888 */
+- var->red.offset = 16;
+- var->red.length = 8;
+- var->green.offset = 8;
+- var->green.length = 8;
+- var->blue.offset = 0;
+- var->blue.length = 8;
+- var->transp.offset = 24;
+- var->transp.length = 8;
+- break;
+- default:
+- return -EINVAL;
+- }
+- var->bits_per_pixel = bpp;
+- var->red.msb_right = 0;
+- var->green.msb_right = 0;
+- var->blue.msb_right = 0;
+- var->transp.msb_right = 0;
+- return 0;
+-}
+-
+ static int sh_mobile_lcdc_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+@@ -1499,6 +1439,9 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ int ret;
+ int i;
+
++ mutex_init(&ch->open_lock);
++
++ /* Allocate the frame buffer device. */
+ ch->info = framebuffer_alloc(0, dev);
+ if (!ch->info) {
+ dev_err(dev, "unable to allocate fb_info\n");
+@@ -1506,11 +1449,10 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ }
+
+ info = ch->info;
+- var = &info->var;
+ info->fbops = &sh_mobile_lcdc_ops;
+ info->par = ch;
+-
+- mutex_init(&ch->open_lock);
++ info->pseudo_palette = &ch->pseudo_palette;
++ info->flags = FBINFO_FLAG_DEFAULT;
+
+ /* Iterate through the modes to validate them and find the highest
+ * resolution.
+@@ -1541,13 +1483,15 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ dev_dbg(dev, "Found largest videomode %ux%u\n",
+ max_mode->xres, max_mode->yres);
+
++ /* Initialize fixed screen information. Restrict pan to 2 lines steps
++ * for NV12.
++ */
+ info->fix = sh_mobile_lcdc_fix;
+ info->fix.smem_len = max_size * 2 * cfg->bpp / 8;
+-
+- /* Only pan in 2 line steps for NV12 */
+ if (cfg->nonstd && cfg->bpp == 12)
+ info->fix.ypanstep = 2;
+
++ /* Create the mode list. */
+ if (cfg->lcd_cfg == NULL) {
+ mode = &default_720p;
+ num_cfg = 1;
+@@ -1558,17 +1502,23 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+
+ fb_videomode_to_modelist(mode, num_cfg, &info->modelist);
+
++ /* Initialize variable screen information using the first mode as
++ * default. The default Y virtual resolution is twice the panel size to
++ * allow for double-buffering.
++ */
++ var = &info->var;
+ fb_videomode_to_var(var, mode);
++ var->bits_per_pixel = cfg->bpp;
+ var->width = cfg->lcd_size_cfg.width;
+ var->height = cfg->lcd_size_cfg.height;
+- /* Default Y virtual resolution is 2x panel size */
+ var->yres_virtual = var->yres * 2;
+ var->activate = FB_ACTIVATE_NOW;
+
+- ret = sh_mobile_lcdc_set_bpp(var, cfg->bpp, cfg->nonstd);
++ ret = sh_mobile_check_var(var, info);
+ if (ret)
+ return ret;
+
++ /* Allocate frame buffer memory and color map. */
+ buf = dma_alloc_coherent(dev, info->fix.smem_len, &ch->dma_handle,
+ GFP_KERNEL);
+ if (!buf) {
+@@ -1576,9 +1526,6 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ return -ENOMEM;
+ }
+
+- info->pseudo_palette = &ch->pseudo_palette;
+- info->flags = FBINFO_FLAG_DEFAULT;
+-
+ ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
+ if (ret < 0) {
+ dev_err(dev, "unable to allocate cmap\n");
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0122-video-irq-Remove-IRQF_DISABLED.patch b/patches.armadillo800eva/0122-video-irq-Remove-IRQF_DISABLED.patch
new file mode 100644
index 00000000000000..8c333139d8c06f
--- /dev/null
+++ b/patches.armadillo800eva/0122-video-irq-Remove-IRQF_DISABLED.patch
@@ -0,0 +1,59 @@
+From a74921402cead64d227baab172fb9d52a552f89d Mon Sep 17 00:00:00 2001
+From: Yong Zhang <yong.zhang0@gmail.com>
+Date: Thu, 22 Sep 2011 16:59:16 +0800
+Subject: video: irq: Remove IRQF_DISABLED
+
+Since commit [e58aa3d2: genirq: Run irq handlers with interrupts disabled],
+We run all interrupt handlers with interrupts disabled
+and we even check and yell when an interrupt handler
+returns with interrupts enabled (see commit [b738a50a:
+genirq: Warn when handler enables interrupts]).
+
+So now this flag is a NOOP and can be removed.
+
+Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
+Acked-by: David Brown <davidb@codeaurora.org>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit f8798ccbefc0e4ef7438c080b7ba0410738c8cfa)
+
+Conflicts:
+
+ drivers/video/au1200fb.c
+ drivers/video/bf54x-lq043fb.c
+ drivers/video/bfin-lq035q1-fb.c
+ drivers/video/bfin-t350mcqb-fb.c
+ drivers/video/bfin_adv7393fb.c
+ drivers/video/mb862xx/mb862xxfbdrv.c
+ drivers/video/msm/mddi.c
+ drivers/video/msm/mdp.c
+ drivers/video/nuc900fb.c
+ drivers/video/omap2/displays/panel-taal.c
+ drivers/video/ps3fb.c
+ drivers/video/pxa3xx-gcu.c
+ drivers/video/pxafb.c
+ drivers/video/s3c2410fb.c
+ drivers/video/sa1100fb.c
+ drivers/video/tmiofb.c
+ drivers/video/vt8500lcdfb.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 97ab8ba..3a41c01 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1576,7 +1576,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+
+ platform_set_drvdata(pdev, priv);
+
+- error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED,
++ error = request_irq(i, sh_mobile_lcdc_irq, 0,
+ dev_name(&pdev->dev), priv);
+ if (error) {
+ dev_err(&pdev->dev, "unable to request irq\n");
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0123-video-Add-module.h-to-drivers-video-files-who-really.patch b/patches.armadillo800eva/0123-video-Add-module.h-to-drivers-video-files-who-really.patch
new file mode 100644
index 00000000000000..989d4272ff23c9
--- /dev/null
+++ b/patches.armadillo800eva/0123-video-Add-module.h-to-drivers-video-files-who-really.patch
@@ -0,0 +1,72 @@
+From c1078a8a456c56536478ee66109fbbbca07ef90e Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Sun, 3 Jul 2011 16:17:28 -0400
+Subject: video: Add module.h to drivers/video files who really use it.
+
+They were getting this implicitly by an include of module.h
+from device.h -- but we are going to clean that up and break
+that include chain, so include module.h explicitly now.
+
+[ with contributions from Axel Lin <axel.lin@gmail.com> ]
+
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+(cherry picked from commit 355b200bacdb6017669cdc5bc9e7b1037aac42a2)
+
+Conflicts:
+
+ drivers/video/atmel_lcdfb.c
+ drivers/video/backlight/88pm860x_bl.c
+ drivers/video/backlight/adp5520_bl.c
+ drivers/video/backlight/ams369fg06.c
+ drivers/video/backlight/da903x_bl.c
+ drivers/video/backlight/ep93xx_bl.c
+ drivers/video/backlight/l4f00242t03.c
+ drivers/video/backlight/ld9040.c
+ drivers/video/backlight/lms283gf05.c
+ drivers/video/backlight/max8925_bl.c
+ drivers/video/backlight/s6e63m0.c
+ drivers/video/backlight/wm831x_bl.c
+ drivers/video/carminefb.c
+ drivers/video/cobalt_lcdfb.c
+ drivers/video/ep93xx-fb.c
+ drivers/video/fb_ddc.c
+ drivers/video/mb862xx/mb862xxfbdrv.c
+ drivers/video/omap/lcd_mipid.c
+ drivers/video/omap/omapfb_main.c
+ drivers/video/omap2/dss/dsi.c
+ drivers/video/savage/savagefb_accel.c
+ drivers/video/w100fb.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 1 +
+ drivers/video/sh_mobile_lcdcfb.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 24640c8..72ee96b 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -17,6 +17,7 @@
+ #include <linux/slab.h>
+ #include <linux/string.h>
+ #include <linux/types.h>
++#include <linux/module.h>
+
+ #include <video/mipi_display.h>
+ #include <video/sh_mipi_dsi.h>
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 3a41c01..facffc2 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -23,6 +23,7 @@
+ #include <linux/console.h>
+ #include <linux/backlight.h>
+ #include <linux/gpio.h>
++#include <linux/module.h>
+ #include <video/sh_mobile_lcdc.h>
+ #include <video/sh_mobile_meram.h>
+ #include <linux/atomic.h>
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0124-fbdev-sh_mobile_lcdcfb-fixup-LDHAJR-HSYNPAJ-needs-ma.patch b/patches.armadillo800eva/0124-fbdev-sh_mobile_lcdcfb-fixup-LDHAJR-HSYNPAJ-needs-ma.patch
new file mode 100644
index 00000000000000..e92d978a44e22e
--- /dev/null
+++ b/patches.armadillo800eva/0124-fbdev-sh_mobile_lcdcfb-fixup-LDHAJR-HSYNPAJ-needs-ma.patch
@@ -0,0 +1,33 @@
+From 99dfaab457ce1a4ccb35e74a5142aae11f5912df Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:33:29 -0800
+Subject: fbdev: sh_mobile_lcdcfb: fixup LDHAJR :: HSYNPAJ needs mask
+
+LDHAJR register will be broken by hsync_pos without this patch
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 41e583c22c3f907e46e329764b4606117040a1ae)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index facffc2..1f49ab4 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -420,7 +420,7 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
+ tmp = ((display_var->xres & 7) << 24) |
+ ((display_h_total & 7) << 16) |
+ ((display_var->hsync_len & 7) << 8) |
+- hsync_pos;
++ (hsync_pos & 7);
+ lcdc_write_chan(ch, LDHAJR, tmp);
+ }
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0125-fbdev-sh_mipi_dsi-tidyup-dsip_clk.patch b/patches.armadillo800eva/0125-fbdev-sh_mipi_dsi-tidyup-dsip_clk.patch
new file mode 100644
index 00000000000000..30c65ff45cbdb7
--- /dev/null
+++ b/patches.armadillo800eva/0125-fbdev-sh_mipi_dsi-tidyup-dsip_clk.patch
@@ -0,0 +1,75 @@
+From 883693112270305ab4d371a5f4924ea325691ec1 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:33:47 -0800
+Subject: fbdev: sh_mipi_dsi: tidyup dsip_clk
+
+dsipck clock is controled by CLKDEV_ICK_ID() in clock-shxxx.
+dsi0p_clk/dsi1p_clk naming is not needed.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 9250741e5feedb6a5273683a940b339af59a1086)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/clock-sh7372.c | 4 ++--
+ arch/arm/mach-shmobile/clock-sh73a0.c | 4 ++--
+ drivers/video/sh_mipi_dsi.c | 4 +---
+ 3 files changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
+index e116a95..7336bce 100644
+--- a/arch/arm/mach-shmobile/clock-sh7372.c
++++ b/arch/arm/mach-shmobile/clock-sh7372.c
+@@ -604,8 +604,8 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]),
+ 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("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
+- CLKDEV_ICK_ID("dsi1p_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
++ 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]),
+
+ /* MSTP32 clocks */
+ CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */
+diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
+index c4bef73..9fc2830 100644
+--- a/arch/arm/mach-shmobile/clock-sh73a0.c
++++ b/arch/arm/mach-shmobile/clock-sh73a0.c
+@@ -319,8 +319,8 @@ static struct clk_lookup lookups[] = {
+ CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]),
+ 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("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
+- CLKDEV_ICK_ID("dsi1p_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
++ 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]),
+
+ /* MSTP32 clocks */
+ CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 72ee96b..4aa5053 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -363,7 +363,6 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ unsigned long rate, f_current;
+ int idx = pdev->id, ret;
+- char dsip_clk[] = "dsi.p_clk";
+
+ if (!res || !res2 || idx >= ARRAY_SIZE(mipi_dsi) || !pdata)
+ return -ENODEV;
+@@ -428,8 +427,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+
+ dev_dbg(&pdev->dev, "DSI-T clk %lu -> %lu\n", f_current, rate);
+
+- sprintf(dsip_clk, "dsi%1.1dp_clk", idx);
+- mipi->dsip_clk = clk_get(&pdev->dev, dsip_clk);
++ mipi->dsip_clk = clk_get(&pdev->dev, "dsip_clk");
+ if (IS_ERR(mipi->dsip_clk)) {
+ ret = PTR_ERR(mipi->dsip_clk);
+ goto eclkpget;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0126-fbdev-sh_mipi_dsi-typo-fix-of-SH_MIPI_DSI_HBPBM.patch b/patches.armadillo800eva/0126-fbdev-sh_mipi_dsi-typo-fix-of-SH_MIPI_DSI_HBPBM.patch
new file mode 100644
index 00000000000000..812a5901a33770
--- /dev/null
+++ b/patches.armadillo800eva/0126-fbdev-sh_mipi_dsi-typo-fix-of-SH_MIPI_DSI_HBPBM.patch
@@ -0,0 +1,45 @@
+From ae293d490cb59082a9cebdcf1f31703fe1cb99bc Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:34:01 -0800
+Subject: fbdev: sh_mipi_dsi: typo fix of SH_MIPI_DSI_HBPBM
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 32ba95c69f33126e297466dc706db73cc7e7a543)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 2 +-
+ include/video/sh_mipi_dsi.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 4aa5053..94bb1bb 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -318,7 +318,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ */
+ if (pdata->flags & SH_MIPI_DSI_HSABM)
+ vmctr2 |= 0x20;
+- if (pdata->flags & SH_MIPI_DSI_HSPBM)
++ if (pdata->flags & SH_MIPI_DSI_HBPBM)
+ vmctr2 |= 0x10;
+ iowrite32(vmctr2, mipi->linkbase + VMCTR2);
+
+diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
+index 6cb95c9..4e2bcb5 100644
+--- a/include/video/sh_mipi_dsi.h
++++ b/include/video/sh_mipi_dsi.h
+@@ -28,7 +28,7 @@ enum sh_mipi_dsi_data_fmt {
+ struct sh_mobile_lcdc_chan_cfg;
+
+ #define SH_MIPI_DSI_HSABM (1 << 0)
+-#define SH_MIPI_DSI_HSPBM (1 << 1)
++#define SH_MIPI_DSI_HBPBM (1 << 1)
+
+ struct sh_mipi_dsi_info {
+ enum sh_mipi_dsi_data_fmt data_format;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0127-fbdev-sh_mipi_dsi-tidyup-VMCTR2-parameter-expression.patch b/patches.armadillo800eva/0127-fbdev-sh_mipi_dsi-tidyup-VMCTR2-parameter-expression.patch
new file mode 100644
index 00000000000000..e8c750753646ea
--- /dev/null
+++ b/patches.armadillo800eva/0127-fbdev-sh_mipi_dsi-tidyup-VMCTR2-parameter-expression.patch
@@ -0,0 +1,37 @@
+From 58f65adecdc4b62a84325391c9adee322336c713 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:34:12 -0800
+Subject: fbdev: sh_mipi_dsi: tidyup VMCTR2 parameter expression
+
+VMCTR2 parameter will be supported more in the future.
+1 << xx style is easy to understand.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 3c2a659936ba1e3bbd7e5eca89255c134fafb506)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 94bb1bb..20ccc23 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -317,9 +317,9 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ * HSA period allowed, no commands in LP
+ */
+ if (pdata->flags & SH_MIPI_DSI_HSABM)
+- vmctr2 |= 0x20;
++ vmctr2 |= 1 << 5;
+ if (pdata->flags & SH_MIPI_DSI_HBPBM)
+- vmctr2 |= 0x10;
++ vmctr2 |= 1 << 4;
+ iowrite32(vmctr2, mipi->linkbase + VMCTR2);
+
+ /*
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0128-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_HFPBM-flag.patch b/patches.armadillo800eva/0128-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_HFPBM-flag.patch
new file mode 100644
index 00000000000000..951971d2232c4e
--- /dev/null
+++ b/patches.armadillo800eva/0128-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_HFPBM-flag.patch
@@ -0,0 +1,44 @@
+From 201a9816caf85e7306d0482d230e496ceb45adbc Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:34:24 -0800
+Subject: fbdev: sh_mipi_dsi: add SH_MIPI_DSI_HFPBM flag
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit f7b0af68bc9f5eb5291996706951661d57909137)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 2 ++
+ include/video/sh_mipi_dsi.h | 1 +
+ 2 files changed, 3 insertions(+)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 20ccc23..c9fac13 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -320,6 +320,8 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ vmctr2 |= 1 << 5;
+ if (pdata->flags & SH_MIPI_DSI_HBPBM)
+ vmctr2 |= 1 << 4;
++ if (pdata->flags & SH_MIPI_DSI_HFPBM)
++ vmctr2 |= 1 << 3;
+ iowrite32(vmctr2, mipi->linkbase + VMCTR2);
+
+ /*
+diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
+index 4e2bcb5..86a72c0 100644
+--- a/include/video/sh_mipi_dsi.h
++++ b/include/video/sh_mipi_dsi.h
+@@ -29,6 +29,7 @@ struct sh_mobile_lcdc_chan_cfg;
+
+ #define SH_MIPI_DSI_HSABM (1 << 0)
+ #define SH_MIPI_DSI_HBPBM (1 << 1)
++#define SH_MIPI_DSI_HFPBM (1 << 2)
+
+ struct sh_mipi_dsi_info {
+ enum sh_mipi_dsi_data_fmt data_format;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0129-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_BL2E-flag.patch b/patches.armadillo800eva/0129-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_BL2E-flag.patch
new file mode 100644
index 00000000000000..9e5c4054d2d8bc
--- /dev/null
+++ b/patches.armadillo800eva/0129-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_BL2E-flag.patch
@@ -0,0 +1,44 @@
+From a8bbb7d8e03ba80f4e3bbf24464dcf6567617747 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:34:33 -0800
+Subject: fbdev: sh_mipi_dsi: add SH_MIPI_DSI_BL2E flag
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit d07a9d2a5e82ed677971b2e9f3e4cbd49b9ec34e)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 2 ++
+ include/video/sh_mipi_dsi.h | 1 +
+ 2 files changed, 3 insertions(+)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index c9fac13..dfd5154 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -316,6 +316,8 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ * Non-burst mode with sync pulses: VSE and HSE are output,
+ * HSA period allowed, no commands in LP
+ */
++ if (pdata->flags & SH_MIPI_DSI_BL2E)
++ vmctr2 |= 1 << 17;
+ if (pdata->flags & SH_MIPI_DSI_HSABM)
+ vmctr2 |= 1 << 5;
+ if (pdata->flags & SH_MIPI_DSI_HBPBM)
+diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
+index 86a72c0..58b78f8 100644
+--- a/include/video/sh_mipi_dsi.h
++++ b/include/video/sh_mipi_dsi.h
+@@ -30,6 +30,7 @@ struct sh_mobile_lcdc_chan_cfg;
+ #define SH_MIPI_DSI_HSABM (1 << 0)
+ #define SH_MIPI_DSI_HBPBM (1 << 1)
+ #define SH_MIPI_DSI_HFPBM (1 << 2)
++#define SH_MIPI_DSI_BL2E (1 << 3)
+
+ struct sh_mipi_dsi_info {
+ enum sh_mipi_dsi_data_fmt data_format;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0130-fbdev-sh_mipi_dsi-add-lane-control-support.patch b/patches.armadillo800eva/0130-fbdev-sh_mipi_dsi-add-lane-control-support.patch
new file mode 100644
index 00000000000000..09257ccc66fedd
--- /dev/null
+++ b/patches.armadillo800eva/0130-fbdev-sh_mipi_dsi-add-lane-control-support.patch
@@ -0,0 +1,101 @@
+From 4c15c6a3e5916682a8545836816f52ac4dc8be57 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:34:43 -0800
+Subject: fbdev: sh_mipi_dsi: add lane control support
+
+SH MIPI DSI can use 0-4 lane
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 26c3d7ac219e74ab3939048a32d6bd3b4a16798a)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ag5evm.c | 1 +
+ arch/arm/mach-shmobile/board-ap4evb.c | 1 +
+ drivers/video/sh_mipi_dsi.c | 10 +++++++++-
+ include/video/sh_mipi_dsi.h | 1 +
+ 4 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
+index ce5c251..70beba2 100644
+--- a/arch/arm/mach-shmobile/board-ag5evm.c
++++ b/arch/arm/mach-shmobile/board-ag5evm.c
+@@ -323,6 +323,7 @@ static struct resource mipidsi0_resources[] = {
+ static struct sh_mipi_dsi_info mipidsi0_info = {
+ .data_format = MIPI_RGB888,
+ .lcd_chan = &lcdc0_info.ch[0],
++ .lane = 2,
+ .vsynw_offset = 20,
+ .clksrc = 1,
+ .flags = SH_MIPI_DSI_HSABM,
+diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
+index 803bc6e..1cf6040 100644
+--- a/arch/arm/mach-shmobile/board-ap4evb.c
++++ b/arch/arm/mach-shmobile/board-ap4evb.c
+@@ -578,6 +578,7 @@ static struct resource mipidsi0_resources[] = {
+ static struct sh_mipi_dsi_info mipidsi0_info = {
+ .data_format = MIPI_RGB888,
+ .lcd_chan = &lcdc_info.ch[0],
++ .lane = 2,
+ .vsynw_offset = 17,
+ };
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index dfd5154..af6bec2 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -8,6 +8,7 @@
+ * published by the Free Software Foundation.
+ */
+
++#include <linux/bitmap.h>
+ #include <linux/clk.h>
+ #include <linux/delay.h>
+ #include <linux/init.h>
+@@ -153,6 +154,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan;
+ u32 pctype, datatype, pixfmt, linelength, vmctr2 = 0x00e00000;
+ bool yuv;
++ u32 tmp;
+
+ /*
+ * Select data format. MIPI DSI is not hot-pluggable, so, we just use
+@@ -253,6 +255,9 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ (!yuv && ch->interface_type != RGB24))
+ return -EINVAL;
+
++ if (!pdata->lane)
++ return -EINVAL;
++
+ /* reset DSI link */
+ iowrite32(0x00000001, base + SYSCTRL);
+ /* Hold reset for 100 cycles of the slowest of bus, HS byte and LP clock */
+@@ -269,7 +274,10 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ * ECC check enable
+ * additionally enable first two lanes
+ */
+- iowrite32(0x00003703, base + SYSCONF);
++ bitmap_fill((unsigned long *)&tmp, pdata->lane);
++ tmp |= 0x00003700;
++ iowrite32(tmp, base + SYSCONF);
++
+ /*
+ * T_wakeup = 0x7000
+ * T_hs-trail = 3
+diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
+index 58b78f8..3d0ec50 100644
+--- a/include/video/sh_mipi_dsi.h
++++ b/include/video/sh_mipi_dsi.h
+@@ -35,6 +35,7 @@ struct sh_mobile_lcdc_chan_cfg;
+ struct sh_mipi_dsi_info {
+ enum sh_mipi_dsi_data_fmt data_format;
+ struct sh_mobile_lcdc_chan_cfg *lcd_chan;
++ int lane;
+ unsigned long flags;
+ u32 clksrc;
+ unsigned int vsynw_offset;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0131-fbdev-sh_mipi_dsi-add-sync_pulses-sync_events-burst-.patch b/patches.armadillo800eva/0131-fbdev-sh_mipi_dsi-add-sync_pulses-sync_events-burst-.patch
new file mode 100644
index 00000000000000..cbeafc5acddd64
--- /dev/null
+++ b/patches.armadillo800eva/0131-fbdev-sh_mipi_dsi-add-sync_pulses-sync_events-burst-.patch
@@ -0,0 +1,94 @@
+From 140ac3e8915cfd48cda5cd305136597b3c19ff29 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:34:55 -0800
+Subject: fbdev: sh_mipi_dsi: add sync_pulses/sync_events/burst mode
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit f832906a56bcf9c597589e9a7898c1dd2f0513b9)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ag5evm.c | 3 ++-
+ arch/arm/mach-shmobile/board-ap4evb.c | 1 +
+ drivers/video/sh_mipi_dsi.c | 9 ++++++++-
+ include/video/sh_mipi_dsi.h | 9 +++++++++
+ 4 files changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
+index 70beba2..87e9091 100644
+--- a/arch/arm/mach-shmobile/board-ag5evm.c
++++ b/arch/arm/mach-shmobile/board-ag5evm.c
+@@ -326,7 +326,8 @@ static struct sh_mipi_dsi_info mipidsi0_info = {
+ .lane = 2,
+ .vsynw_offset = 20,
+ .clksrc = 1,
+- .flags = SH_MIPI_DSI_HSABM,
++ .flags = SH_MIPI_DSI_HSABM |
++ SH_MIPI_DSI_SYNC_PULSES_MODE,
+ };
+
+ static struct platform_device mipidsi0_device = {
+diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
+index 1cf6040..5db88ba 100644
+--- a/arch/arm/mach-shmobile/board-ap4evb.c
++++ b/arch/arm/mach-shmobile/board-ap4evb.c
+@@ -580,6 +580,7 @@ static struct sh_mipi_dsi_info mipidsi0_info = {
+ .lcd_chan = &lcdc_info.ch[0],
+ .lane = 2,
+ .vsynw_offset = 17,
++ .flags = SH_MIPI_DSI_SYNC_PULSES_MODE,
+ };
+
+ static struct platform_device mipidsi0_device = {
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index af6bec2..b8c4873 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -152,7 +152,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ {
+ void __iomem *base = mipi->base;
+ struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan;
+- u32 pctype, datatype, pixfmt, linelength, vmctr2 = 0x00e00000;
++ u32 pctype, datatype, pixfmt, linelength, vmctr2;
+ bool yuv;
+ u32 tmp;
+
+@@ -324,6 +324,13 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ * Non-burst mode with sync pulses: VSE and HSE are output,
+ * HSA period allowed, no commands in LP
+ */
++ vmctr2 = 0;
++ if (pdata->flags & SH_MIPI_DSI_VSEE)
++ vmctr2 |= 1 << 23;
++ if (pdata->flags & SH_MIPI_DSI_HSEE)
++ vmctr2 |= 1 << 22;
++ if (pdata->flags & SH_MIPI_DSI_HSAE)
++ vmctr2 |= 1 << 21;
+ if (pdata->flags & SH_MIPI_DSI_BL2E)
+ vmctr2 |= 1 << 17;
+ if (pdata->flags & SH_MIPI_DSI_HSABM)
+diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
+index 3d0ec50..c8225b4 100644
+--- a/include/video/sh_mipi_dsi.h
++++ b/include/video/sh_mipi_dsi.h
+@@ -31,6 +31,15 @@ struct sh_mobile_lcdc_chan_cfg;
+ #define SH_MIPI_DSI_HBPBM (1 << 1)
+ #define SH_MIPI_DSI_HFPBM (1 << 2)
+ #define SH_MIPI_DSI_BL2E (1 << 3)
++#define SH_MIPI_DSI_VSEE (1 << 4)
++#define SH_MIPI_DSI_HSEE (1 << 5)
++#define SH_MIPI_DSI_HSAE (1 << 6)
++
++#define SH_MIPI_DSI_SYNC_PULSES_MODE (SH_MIPI_DSI_VSEE | \
++ SH_MIPI_DSI_HSEE | \
++ SH_MIPI_DSI_HSAE)
++#define SH_MIPI_DSI_SYNC_EVENTS_MODE (0)
++#define SH_MIPI_DSI_SYNC_BURST_MODE (SH_MIPI_DSI_BL2E)
+
+ struct sh_mipi_dsi_info {
+ enum sh_mipi_dsi_data_fmt data_format;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0132-fbdev-sh_mipi_dsi-add-VMLEN1-VMLEN2-calculation.patch b/patches.armadillo800eva/0132-fbdev-sh_mipi_dsi-add-VMLEN1-VMLEN2-calculation.patch
new file mode 100644
index 00000000000000..38bbd2df7c19d2
--- /dev/null
+++ b/patches.armadillo800eva/0132-fbdev-sh_mipi_dsi-add-VMLEN1-VMLEN2-calculation.patch
@@ -0,0 +1,106 @@
+From d9f07c596acae1663a208454d970fd7e5c6eddff Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:35:05 -0800
+Subject: fbdev: sh_mipi_dsi: add VMLEN1/VMLEN2 calculation
+
+VMLEN1/VMLEN2 needs blanking length which is calculated from
+video image size.
+
+The calculation methods are explained on
+[SH MIPI] - [Video Mode] - [Blanking Packet setting]
+But HFPLEN (= VMLEN2) is un-understandable.
+
+For example, if SH-MIPI input was RGB888 (3byte),
+output was RGB888 (3byte)
+and 3lane connection, the date goes straight.
+
+But if SH-MIPI input was RGB888 (3byte),
+output was RGB565 (2byte)
+and 4lane connection, it needs delay in HFPLEN.
+Then (input cycle - output cycle) * lane is necessary the delay
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 08750617badd03fd95f33921a5213a5632022178)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 45 ++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 40 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index b8c4873..190e941 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -42,6 +42,7 @@
+ #define VMCTR1 0x0020
+ #define VMCTR2 0x0024
+ #define VMLEN1 0x0028
++#define VMLEN2 0x002c
+ #define CMTSRTREQ 0x0070
+ #define CMTSRTCTR 0x00d0
+
+@@ -153,8 +154,9 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ void __iomem *base = mipi->base;
+ struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan;
+ u32 pctype, datatype, pixfmt, linelength, vmctr2;
++ u32 tmp, top, bottom, delay;
+ bool yuv;
+- u32 tmp;
++ int bpp;
+
+ /*
+ * Select data format. MIPI DSI is not hot-pluggable, so, we just use
+@@ -342,11 +344,44 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ iowrite32(vmctr2, mipi->linkbase + VMCTR2);
+
+ /*
+- * 0x660 = 1632 bytes per line (RGB24, 544 pixels: see
+- * sh_mobile_lcdc_info.ch[0].lcd_cfg[0].xres), HSALEN = 1 - default
+- * (unused if VMCTR2[HSABM] = 0)
++ * VMLEN1 = RGBLEN | HSALEN
++ *
++ * see
++ * Video mode - Blanking Packet setting
+ */
+- iowrite32(1 | (linelength << 16), mipi->linkbase + VMLEN1);
++ top = linelength << 16; /* RGBLEN */
++ bottom = 0x00000001;
++ if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */
++ bottom = (pdata->lane * ch->lcd_cfg[0].hsync_len) - 10;
++ iowrite32(top | bottom , mipi->linkbase + VMLEN1);
++
++ /*
++ * VMLEN2 = HBPLEN | HFPLEN
++ *
++ * see
++ * Video mode - Blanking Packet setting
++ */
++ top = 0x00010000;
++ bottom = 0x00000001;
++ delay = 0;
++
++ if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */
++ top = ch->lcd_cfg[0].hsync_len + ch->lcd_cfg[0].left_margin;
++ top = ((pdata->lane * top) - 10) << 16;
++ }
++ if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */
++ bottom = ch->lcd_cfg[0].right_margin;
++ bottom = (pdata->lane * bottom) - 12;
++ }
++
++ bpp = linelength / ch->lcd_cfg[0].xres; /* byte / pixel */
++ if (pdata->lane > bpp) {
++ tmp = ch->lcd_cfg[0].xres / bpp; /* output cycle */
++ tmp = ch->lcd_cfg[0].xres - tmp; /* (input - output) cycle */
++ delay = (pdata->lane * tmp);
++ }
++
++ iowrite32(top | (bottom + delay) , mipi->linkbase + VMLEN2);
+
+ msleep(5);
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0133-fbdev-sh_mipi_dsi-add-set_dot_clock-for-each-platfor.patch b/patches.armadillo800eva/0133-fbdev-sh_mipi_dsi-add-set_dot_clock-for-each-platfor.patch
new file mode 100644
index 00000000000000..4ca0b27ec2b631
--- /dev/null
+++ b/patches.armadillo800eva/0133-fbdev-sh_mipi_dsi-add-set_dot_clock-for-each-platfor.patch
@@ -0,0 +1,147 @@
+From 72fb7f1eb9dae522c75c2805a61cc38882791f03 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:35:14 -0800
+Subject: fbdev: sh_mipi_dsi: add set_dot_clock() for each platform
+
+Dot clock of SH MIPI are depends on each platform board.
+This patch adds set_dot_clock() function for it.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 5e47431aabf716c9ad9eacf1a966e1fc1469c809)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-ag5evm.c
+ arch/arm/mach-shmobile/board-ap4evb.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 45 +++++++++++--------------------------------
+ include/video/sh_mipi_dsi.h | 3 +++
+ 2 files changed, 14 insertions(+), 34 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 190e941..77743f4 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -53,7 +53,6 @@ struct sh_mipi {
+ void __iomem *base;
+ void __iomem *linkbase;
+ struct clk *dsit_clk;
+- struct clk *dsip_clk;
+ struct device *dev;
+
+ void *next_board_data;
+@@ -307,8 +306,8 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ /* DSI-Tx bias on */
+ iowrite32(0x00000001, base + PHYCTRL);
+ udelay(200);
+- /* Deassert resets, power on, set multiplier */
+- iowrite32(0x03070b01, base + PHYCTRL);
++ /* Deassert resets, power on */
++ iowrite32(0x03070001, base + PHYCTRL);
+
+ /* setup l-bridge */
+
+@@ -421,6 +420,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ if (!res || !res2 || idx >= ARRAY_SIZE(mipi_dsi) || !pdata)
+ return -ENODEV;
+
++ if (!pdata->set_dot_clock)
++ return -EINVAL;
++
+ mutex_lock(&array_lock);
+ if (idx < 0)
+ for (idx = 0; idx < ARRAY_SIZE(mipi_dsi) && mipi_dsi[idx]; idx++)
+@@ -481,34 +483,10 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+
+ dev_dbg(&pdev->dev, "DSI-T clk %lu -> %lu\n", f_current, rate);
+
+- mipi->dsip_clk = clk_get(&pdev->dev, "dsip_clk");
+- if (IS_ERR(mipi->dsip_clk)) {
+- ret = PTR_ERR(mipi->dsip_clk);
+- goto eclkpget;
+- }
+-
+- f_current = clk_get_rate(mipi->dsip_clk);
+- /* Between 10 and 50MHz */
+- rate = clk_round_rate(mipi->dsip_clk, 24000000);
+- if (rate > 0 && rate != f_current)
+- ret = clk_set_rate(mipi->dsip_clk, rate);
+- else
+- ret = rate;
+- if (ret < 0)
+- goto esetprate;
+-
+- dev_dbg(&pdev->dev, "DSI-P clk %lu -> %lu\n", f_current, rate);
+-
+- msleep(10);
+-
+ ret = clk_enable(mipi->dsit_clk);
+ if (ret < 0)
+ goto eclkton;
+
+- ret = clk_enable(mipi->dsip_clk);
+- if (ret < 0)
+- goto eclkpon;
+-
+ mipi_dsi[idx] = mipi;
+
+ pm_runtime_enable(&pdev->dev);
+@@ -518,6 +496,10 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ if (ret < 0)
+ goto emipisetup;
+
++ ret = pdata->set_dot_clock(pdev, mipi->base, 1);
++ if (ret < 0)
++ goto emipisetup;
++
+ mutex_unlock(&array_lock);
+ platform_set_drvdata(pdev, mipi);
+
+@@ -537,13 +519,8 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ emipisetup:
+ mipi_dsi[idx] = NULL;
+ pm_runtime_disable(&pdev->dev);
+- clk_disable(mipi->dsip_clk);
+-eclkpon:
+ clk_disable(mipi->dsit_clk);
+ eclkton:
+-esetprate:
+- clk_put(mipi->dsip_clk);
+-eclkpget:
+ esettrate:
+ clk_put(mipi->dsit_clk);
+ eclktget:
+@@ -594,10 +571,10 @@ static int __exit sh_mipi_remove(struct platform_device *pdev)
+ pdata->lcd_chan->board_cfg.board_data = NULL;
+
+ pm_runtime_disable(&pdev->dev);
+- clk_disable(mipi->dsip_clk);
+ clk_disable(mipi->dsit_clk);
+ clk_put(mipi->dsit_clk);
+- clk_put(mipi->dsip_clk);
++ pdata->set_dot_clock(pdev, mipi->base, 0);
++
+ iounmap(mipi->linkbase);
+ if (res2)
+ release_mem_region(res2->start, resource_size(res2));
+diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
+index c8225b4..310b883 100644
+--- a/include/video/sh_mipi_dsi.h
++++ b/include/video/sh_mipi_dsi.h
+@@ -48,6 +48,9 @@ struct sh_mipi_dsi_info {
+ unsigned long flags;
+ u32 clksrc;
+ unsigned int vsynw_offset;
++ int (*set_dot_clock)(struct platform_device *pdev,
++ void __iomem *base,
++ int enable);
+ };
+
+ #endif
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0134-fbdev-sh_mipi_dsi-add-HSxxCLK-support.patch b/patches.armadillo800eva/0134-fbdev-sh_mipi_dsi-add-HSxxCLK-support.patch
new file mode 100644
index 00000000000000..bcbf07b0b8c73c
--- /dev/null
+++ b/patches.armadillo800eva/0134-fbdev-sh_mipi_dsi-add-HSxxCLK-support.patch
@@ -0,0 +1,84 @@
+From 3e92ce8c74c424c9641d078d20bb16dd879df9fe Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:35:27 -0800
+Subject: fbdev: sh_mipi_dsi: add HSxxCLK support
+
+SH MIPI manual explains the calculation method of HBP/HFP.
+it is based on HSbyteCLK settings.
+SH73a0 chip can use HS6divCLK/HS4divCLK for it.
+This patch has compatibility to SH7372 mipi
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit a2e6297153f8fc7185d119c59d8eed1ee7d4c74f)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-ag5evm.c
+ arch/arm/mach-shmobile/board-ap4evb.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 14 ++++++++++----
+ include/video/sh_mipi_dsi.h | 4 ++++
+ 2 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 77743f4..b8aea8c 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -153,7 +153,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ void __iomem *base = mipi->base;
+ struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan;
+ u32 pctype, datatype, pixfmt, linelength, vmctr2;
+- u32 tmp, top, bottom, delay;
++ u32 tmp, top, bottom, delay, div;
+ bool yuv;
+ int bpp;
+
+@@ -364,17 +364,23 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ bottom = 0x00000001;
+ delay = 0;
+
++ div = 1; /* HSbyteCLK is calculation base
++ * HS4divCLK = HSbyteCLK/2
++ * HS6divCLK is not supported for now */
++ if (pdata->flags & SH_MIPI_DSI_HS4divCLK)
++ div = 2;
++
+ if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */
+ top = ch->lcd_cfg[0].hsync_len + ch->lcd_cfg[0].left_margin;
+- top = ((pdata->lane * top) - 10) << 16;
++ top = ((pdata->lane * top / div) - 10) << 16;
+ }
+ if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */
+ bottom = ch->lcd_cfg[0].right_margin;
+- bottom = (pdata->lane * bottom) - 12;
++ bottom = (pdata->lane * bottom / div) - 12;
+ }
+
+ bpp = linelength / ch->lcd_cfg[0].xres; /* byte / pixel */
+- if (pdata->lane > bpp) {
++ if ((pdata->lane / div) > bpp) {
+ tmp = ch->lcd_cfg[0].xres / bpp; /* output cycle */
+ tmp = ch->lcd_cfg[0].xres - tmp; /* (input - output) cycle */
+ delay = (pdata->lane * tmp);
+diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
+index 310b883..434d56b 100644
+--- a/include/video/sh_mipi_dsi.h
++++ b/include/video/sh_mipi_dsi.h
+@@ -35,6 +35,10 @@ struct sh_mobile_lcdc_chan_cfg;
+ #define SH_MIPI_DSI_HSEE (1 << 5)
+ #define SH_MIPI_DSI_HSAE (1 << 6)
+
++#define SH_MIPI_DSI_HSbyteCLK (1 << 24)
++#define SH_MIPI_DSI_HS6divCLK (1 << 25)
++#define SH_MIPI_DSI_HS4divCLK (1 << 26)
++
+ #define SH_MIPI_DSI_SYNC_PULSES_MODE (SH_MIPI_DSI_VSEE | \
+ SH_MIPI_DSI_HSEE | \
+ SH_MIPI_DSI_HSAE)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0135-fbdev-sh_mipi_dsi-sh_mipi-has-pdata-instead-of-dev.patch b/patches.armadillo800eva/0135-fbdev-sh_mipi_dsi-sh_mipi-has-pdata-instead-of-dev.patch
new file mode 100644
index 00000000000000..b232427867bd4d
--- /dev/null
+++ b/patches.armadillo800eva/0135-fbdev-sh_mipi_dsi-sh_mipi-has-pdata-instead-of-dev.patch
@@ -0,0 +1,58 @@
+From e4b43eae56dea01d88026bc9e915c4bfd1847fe6 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:35:36 -0800
+Subject: fbdev: sh_mipi_dsi: sh_mipi has pdata instead of dev
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 7d9f88b4f427df6dab7ff92ea81f1ddb7e9c95e4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index b8aea8c..7e46505 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -53,7 +53,7 @@ struct sh_mipi {
+ void __iomem *base;
+ void __iomem *linkbase;
+ struct clk *dsit_clk;
+- struct device *dev;
++ struct platform_device *pdev;
+
+ void *next_board_data;
+ void (*next_display_on)(void *board_data, struct fb_info *info);
+@@ -129,7 +129,7 @@ static void mipi_display_on(void *arg, struct fb_info *info)
+ {
+ struct sh_mipi *mipi = arg;
+
+- pm_runtime_get_sync(mipi->dev);
++ pm_runtime_get_sync(&mipi->pdev->dev);
+ sh_mipi_dsi_enable(mipi, true);
+
+ if (mipi->next_display_on)
+@@ -144,7 +144,7 @@ static void mipi_display_off(void *arg)
+ mipi->next_display_off(mipi->next_board_data);
+
+ sh_mipi_dsi_enable(mipi, false);
+- pm_runtime_put(mipi->dev);
++ pm_runtime_put(&mipi->pdev->dev);
+ }
+
+ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+@@ -469,7 +469,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ goto emap2;
+ }
+
+- mipi->dev = &pdev->dev;
++ mipi->pdev = pdev;
+
+ mipi->dsit_clk = clk_get(&pdev->dev, "dsit_clk");
+ if (IS_ERR(mipi->dsit_clk)) {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0136-fbdev-sh_mipi_dsi-fixup-setup-timing-of-sh_mipi_setu.patch b/patches.armadillo800eva/0136-fbdev-sh_mipi_dsi-fixup-setup-timing-of-sh_mipi_setu.patch
new file mode 100644
index 00000000000000..250317d66536a8
--- /dev/null
+++ b/patches.armadillo800eva/0136-fbdev-sh_mipi_dsi-fixup-setup-timing-of-sh_mipi_setu.patch
@@ -0,0 +1,138 @@
+From d642b03d416c201afb2e557c6c5bc181621cbcbd Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:35:45 -0800
+Subject: fbdev: sh_mipi_dsi: fixup setup timing of sh_mipi_setup()
+
+sh_mipi_setup() should be called after setting of CPG
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit c2658b70f06108361aa5024798f9c1bf47c73374)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 79 ++++++++++++++++++++++++-------------------
+ 1 file changed, 44 insertions(+), 35 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 7e46505..f2c3f94 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -125,28 +125,6 @@ static void sh_mipi_shutdown(struct platform_device *pdev)
+ sh_mipi_dsi_enable(mipi, false);
+ }
+
+-static void mipi_display_on(void *arg, struct fb_info *info)
+-{
+- struct sh_mipi *mipi = arg;
+-
+- pm_runtime_get_sync(&mipi->pdev->dev);
+- sh_mipi_dsi_enable(mipi, true);
+-
+- if (mipi->next_display_on)
+- mipi->next_display_on(mipi->next_board_data, info);
+-}
+-
+-static void mipi_display_off(void *arg)
+-{
+- struct sh_mipi *mipi = arg;
+-
+- if (mipi->next_display_off)
+- mipi->next_display_off(mipi->next_board_data);
+-
+- sh_mipi_dsi_enable(mipi, false);
+- pm_runtime_put(&mipi->pdev->dev);
+-}
+-
+ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ struct sh_mipi_dsi_info *pdata)
+ {
+@@ -414,6 +392,50 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ return 0;
+ }
+
++static void mipi_display_on(void *arg, struct fb_info *info)
++{
++ struct sh_mipi *mipi = arg;
++ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
++ int ret;
++
++ pm_runtime_get_sync(&mipi->pdev->dev);
++
++ ret = pdata->set_dot_clock(mipi->pdev, mipi->base, 1);
++ if (ret < 0)
++ goto mipi_display_on_fail1;
++
++ ret = sh_mipi_setup(mipi, pdata);
++ if (ret < 0)
++ goto mipi_display_on_fail2;
++
++ sh_mipi_dsi_enable(mipi, true);
++
++ if (mipi->next_display_on)
++ mipi->next_display_on(mipi->next_board_data, info);
++
++ return;
++
++mipi_display_on_fail1:
++ pm_runtime_put_sync(&mipi->pdev->dev);
++mipi_display_on_fail2:
++ pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
++}
++
++static void mipi_display_off(void *arg)
++{
++ struct sh_mipi *mipi = arg;
++ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
++
++ if (mipi->next_display_off)
++ mipi->next_display_off(mipi->next_board_data);
++
++ sh_mipi_dsi_enable(mipi, false);
++
++ pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
++
++ pm_runtime_put_sync(&mipi->pdev->dev);
++}
++
+ static int __init sh_mipi_probe(struct platform_device *pdev)
+ {
+ struct sh_mipi *mipi;
+@@ -498,14 +520,6 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ pm_runtime_enable(&pdev->dev);
+ pm_runtime_resume(&pdev->dev);
+
+- ret = sh_mipi_setup(mipi, pdata);
+- if (ret < 0)
+- goto emipisetup;
+-
+- ret = pdata->set_dot_clock(pdev, mipi->base, 1);
+- if (ret < 0)
+- goto emipisetup;
+-
+ mutex_unlock(&array_lock);
+ platform_set_drvdata(pdev, mipi);
+
+@@ -522,10 +536,6 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+
+ return 0;
+
+-emipisetup:
+- mipi_dsi[idx] = NULL;
+- pm_runtime_disable(&pdev->dev);
+- clk_disable(mipi->dsit_clk);
+ eclkton:
+ esettrate:
+ clk_put(mipi->dsit_clk);
+@@ -579,7 +589,6 @@ static int __exit sh_mipi_remove(struct platform_device *pdev)
+ pm_runtime_disable(&pdev->dev);
+ clk_disable(mipi->dsit_clk);
+ clk_put(mipi->dsit_clk);
+- pdata->set_dot_clock(pdev, mipi->base, 0);
+
+ iounmap(mipi->linkbase);
+ if (res2)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0137-fbdev-sh_mipi_dsi-fixup-setup-timing-of-SYSCONF.patch b/patches.armadillo800eva/0137-fbdev-sh_mipi_dsi-fixup-setup-timing-of-SYSCONF.patch
new file mode 100644
index 00000000000000..b06c5de74371f4
--- /dev/null
+++ b/patches.armadillo800eva/0137-fbdev-sh_mipi_dsi-fixup-setup-timing-of-SYSCONF.patch
@@ -0,0 +1,61 @@
+From c504438caf59f330b34db335804a9ceca7e1fabf Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:35:56 -0800
+Subject: fbdev: sh_mipi_dsi: fixup setup timing of SYSCONF
+
+SYSCONF should be set after PHYCTRL
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit a2065a368cc2539d6a48450f367f5033c699cdc4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 23 +++++++++++------------
+ 1 file changed, 11 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index f2c3f94..187e127 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -246,18 +246,6 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ /* setup DSI link */
+
+ /*
+- * Default = ULPS enable |
+- * Contention detection enabled |
+- * EoT packet transmission enable |
+- * CRC check enable |
+- * ECC check enable
+- * additionally enable first two lanes
+- */
+- bitmap_fill((unsigned long *)&tmp, pdata->lane);
+- tmp |= 0x00003700;
+- iowrite32(tmp, base + SYSCONF);
+-
+- /*
+ * T_wakeup = 0x7000
+ * T_hs-trail = 3
+ * T_hs-prepare = 3
+@@ -287,6 +275,17 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ /* Deassert resets, power on */
+ iowrite32(0x03070001, base + PHYCTRL);
+
++ /*
++ * Default = ULPS enable |
++ * Contention detection enabled |
++ * EoT packet transmission enable |
++ * CRC check enable |
++ * ECC check enable
++ */
++ bitmap_fill((unsigned long *)&tmp, pdata->lane);
++ tmp |= 0x00003700;
++ iowrite32(tmp, base + SYSCONF);
++
+ /* setup l-bridge */
+
+ /*
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0138-fbdev-sh_mipi_dsi-fixup-setup-timing-DSICTRL.patch b/patches.armadillo800eva/0138-fbdev-sh_mipi_dsi-fixup-setup-timing-DSICTRL.patch
new file mode 100644
index 00000000000000..5568035b7955de
--- /dev/null
+++ b/patches.armadillo800eva/0138-fbdev-sh_mipi_dsi-fixup-setup-timing-DSICTRL.patch
@@ -0,0 +1,43 @@
+From 228f32c1dd653d1624fdb1e7ad2a5ae15c3a3313 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 8 Nov 2011 20:36:07 -0800
+Subject: fbdev: sh_mipi_dsi: fixup setup timing DSICTRL
+
+DSICTRL should be called after all mipi settings
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Acked-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 97cab45583f75428773547f3bbe59fece05420d3)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 187e127..05151b8 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -265,8 +265,6 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ iowrite32(0x0fffffff, base + TATOVSET);
+ /* Peripheral reset timeout, default 0xffffffff */
+ iowrite32(0x0fffffff, base + PRTOVSET);
+- /* Enable timeout counters */
+- iowrite32(0x00000f00, base + DSICTRL);
+ /* Interrupts not used, disable all */
+ iowrite32(0, base + DSIINTE);
+ /* DSI-Tx bias on */
+@@ -388,6 +386,9 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ pixfmt << 4);
+ sh_mipi_dcs(ch->chan, MIPI_DCS_SET_DISPLAY_ON);
+
++ /* Enable timeout counters */
++ iowrite32(0x00000f00, base + DSICTRL);
++
+ return 0;
+ }
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0139-video-convert-drivers-video-to-use-module_platform_d.patch b/patches.armadillo800eva/0139-video-convert-drivers-video-to-use-module_platform_d.patch
new file mode 100644
index 00000000000000..bc4ab4d834382a
--- /dev/null
+++ b/patches.armadillo800eva/0139-video-convert-drivers-video-to-use-module_platform_d.patch
@@ -0,0 +1,386 @@
+From f6feb296d6b1a27441b3776be80ba86f6be4c95a Mon Sep 17 00:00:00 2001
+From: Axel Lin <axel.lin@gmail.com>
+Date: Sat, 26 Nov 2011 10:25:54 +0800
+Subject: video: convert drivers/video/* to use module_platform_driver()
+
+This patch converts the drivers in drivers/video/* to use the
+module_platform_driver() macro which makes the code smaller and a bit
+simpler.
+
+Cc: Ben Dooks <ben@simtec.co.uk>
+Cc: Manuel Lauss <mano@roarinelk.homelinux.net>
+Signed-off-by: Axel Lin <axel.lin@gmail.com>
+Acked-by: Wan ZongShun <mcuos.com@gmail.com>
+Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
+Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
+Acked-by: Alexey Charkov <alchark@gmail.com>
+Acked-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+Acked-by: Jingoo Han <jg1.han@samsung.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 4277f2c4667187cbbdd3da3be31ee681bc6b8300)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/mxsfb.c | 13 +------------
+ drivers/video/nuc900fb.c | 13 +------------
+ drivers/video/pxa168fb.c | 12 +-----------
+ drivers/video/pxa3xx-gcu.c | 15 +--------------
+ drivers/video/s3c-fb.c | 13 +------------
+ drivers/video/sh7760fb.c | 13 +------------
+ drivers/video/sh_mobile_lcdcfb.c | 13 +------------
+ drivers/video/sh_mobile_meram.c | 13 +------------
+ drivers/video/sm501fb.c | 13 +------------
+ drivers/video/vt8500lcdfb.c | 13 +------------
+ drivers/video/w100fb.c | 13 +------------
+ drivers/video/wm8505fb.c | 13 +------------
+ drivers/video/wmt_ge_rops.c | 13 +------------
+ drivers/video/xilinxfb.c | 20 +-------------------
+ 14 files changed, 14 insertions(+), 176 deletions(-)
+
+diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
+index 0b2f2dd..55e6680 100644
+--- a/drivers/video/mxsfb.c
++++ b/drivers/video/mxsfb.c
+@@ -901,18 +901,7 @@ static struct platform_driver mxsfb_driver = {
+ },
+ };
+
+-static int __init mxsfb_init(void)
+-{
+- return platform_driver_register(&mxsfb_driver);
+-}
+-
+-static void __exit mxsfb_exit(void)
+-{
+- platform_driver_unregister(&mxsfb_driver);
+-}
+-
+-module_init(mxsfb_init);
+-module_exit(mxsfb_exit);
++module_platform_driver(mxsfb_devtype);
+
+ MODULE_DESCRIPTION("Freescale mxs framebuffer driver");
+ MODULE_AUTHOR("Sascha Hauer, Pengutronix");
+diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c
+index f838d9e..675255e 100644
+--- a/drivers/video/nuc900fb.c
++++ b/drivers/video/nuc900fb.c
+@@ -763,18 +763,7 @@ static struct platform_driver nuc900fb_driver = {
+ },
+ };
+
+-int __devinit nuc900fb_init(void)
+-{
+- return platform_driver_register(&nuc900fb_driver);
+-}
+-
+-static void __exit nuc900fb_cleanup(void)
+-{
+- platform_driver_unregister(&nuc900fb_driver);
+-}
+-
+-module_init(nuc900fb_init);
+-module_exit(nuc900fb_cleanup);
++module_platform_driver(nuc900fb_driver);
+
+ MODULE_DESCRIPTION("Framebuffer driver for the NUC900");
+ MODULE_LICENSE("GPL");
+diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c
+index bb95ec5..53d575e 100644
+--- a/drivers/video/pxa168fb.c
++++ b/drivers/video/pxa168fb.c
+@@ -832,17 +832,7 @@ static struct platform_driver pxa168fb_driver = {
+ .remove = __devexit_p(pxa168fb_remove),
+ };
+
+-static int __init pxa168fb_init(void)
+-{
+- return platform_driver_register(&pxa168fb_driver);
+-}
+-module_init(pxa168fb_init);
+-
+-static void __exit pxa168fb_exit(void)
+-{
+- platform_driver_unregister(&pxa168fb_driver);
+-}
+-module_exit(pxa168fb_exit);
++module_platform_driver(pxa168fb_driver);
+
+ MODULE_AUTHOR("Lennert Buytenhek <buytenh@marvell.com> "
+ "Green Wan <gwan@marvell.com>");
+diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c
+index 0283c70..68b8ced 100644
+--- a/drivers/video/pxa3xx-gcu.c
++++ b/drivers/video/pxa3xx-gcu.c
+@@ -749,20 +749,7 @@ static struct platform_driver pxa3xx_gcu_driver = {
+ },
+ };
+
+-static int __init
+-pxa3xx_gcu_init(void)
+-{
+- return platform_driver_register(&pxa3xx_gcu_driver);
+-}
+-
+-static void __exit
+-pxa3xx_gcu_exit(void)
+-{
+- platform_driver_unregister(&pxa3xx_gcu_driver);
+-}
+-
+-module_init(pxa3xx_gcu_init);
+-module_exit(pxa3xx_gcu_exit);
++module_platform_driver(pxa3xx_gcu_driver);
+
+ MODULE_DESCRIPTION("PXA3xx graphics controller unit driver");
+ MODULE_LICENSE("GPL");
+diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
+index 4aecf21..296e005 100644
+--- a/drivers/video/s3c-fb.c
++++ b/drivers/video/s3c-fb.c
+@@ -1895,18 +1895,7 @@ static struct platform_driver s3c_fb_driver = {
+ },
+ };
+
+-static int __init s3c_fb_init(void)
+-{
+- return platform_driver_register(&s3c_fb_driver);
+-}
+-
+-static void __exit s3c_fb_cleanup(void)
+-{
+- platform_driver_unregister(&s3c_fb_driver);
+-}
+-
+-module_init(s3c_fb_init);
+-module_exit(s3c_fb_cleanup);
++module_platform_driver(s3c_fb_driver);
+
+ MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
+ MODULE_DESCRIPTION("Samsung S3C SoC Framebuffer driver");
+diff --git a/drivers/video/sh7760fb.c b/drivers/video/sh7760fb.c
+index 45e47d8..83b16e2 100644
+--- a/drivers/video/sh7760fb.c
++++ b/drivers/video/sh7760fb.c
+@@ -585,18 +585,7 @@ static struct platform_driver sh7760_lcdc_driver = {
+ .remove = __devexit_p(sh7760fb_remove),
+ };
+
+-static int __init sh7760fb_init(void)
+-{
+- return platform_driver_register(&sh7760_lcdc_driver);
+-}
+-
+-static void __exit sh7760fb_exit(void)
+-{
+- platform_driver_unregister(&sh7760_lcdc_driver);
+-}
+-
+-module_init(sh7760fb_init);
+-module_exit(sh7760fb_exit);
++module_platform_driver(sh7760_lcdc_driver);
+
+ MODULE_AUTHOR("Nobuhiro Iwamatsu, Manuel Lauss");
+ MODULE_DESCRIPTION("FBdev for SH7760/63 integrated LCD Controller");
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 1f49ab4..a264ebf 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1709,18 +1709,7 @@ static struct platform_driver sh_mobile_lcdc_driver = {
+ .remove = sh_mobile_lcdc_remove,
+ };
+
+-static int __init sh_mobile_lcdc_init(void)
+-{
+- return platform_driver_register(&sh_mobile_lcdc_driver);
+-}
+-
+-static void __exit sh_mobile_lcdc_exit(void)
+-{
+- platform_driver_unregister(&sh_mobile_lcdc_driver);
+-}
+-
+-module_init(sh_mobile_lcdc_init);
+-module_exit(sh_mobile_lcdc_exit);
++module_platform_driver(sh_mobile_lcdc_driver);
+
+ MODULE_DESCRIPTION("SuperH Mobile LCDC Framebuffer driver");
+ MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 4d63490..f45d83e 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -679,18 +679,7 @@ static struct platform_driver sh_mobile_meram_driver = {
+ .remove = sh_mobile_meram_remove,
+ };
+
+-static int __init sh_mobile_meram_init(void)
+-{
+- return platform_driver_register(&sh_mobile_meram_driver);
+-}
+-
+-static void __exit sh_mobile_meram_exit(void)
+-{
+- platform_driver_unregister(&sh_mobile_meram_driver);
+-}
+-
+-module_init(sh_mobile_meram_init);
+-module_exit(sh_mobile_meram_exit);
++module_platform_driver(sh_mobile_meram_driver);
+
+ MODULE_DESCRIPTION("SuperH Mobile MERAM driver");
+ MODULE_AUTHOR("Damian Hobson-Garcia / Takanari Hayama");
+diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
+index 6294dca..420ba8d 100644
+--- a/drivers/video/sm501fb.c
++++ b/drivers/video/sm501fb.c
+@@ -2230,18 +2230,7 @@ static struct platform_driver sm501fb_driver = {
+ },
+ };
+
+-static int __devinit sm501fb_init(void)
+-{
+- return platform_driver_register(&sm501fb_driver);
+-}
+-
+-static void __exit sm501fb_cleanup(void)
+-{
+- platform_driver_unregister(&sm501fb_driver);
+-}
+-
+-module_init(sm501fb_init);
+-module_exit(sm501fb_cleanup);
++module_platform_driver(sm501fb_driver);
+
+ module_param_named(mode, fb_mode, charp, 0);
+ MODULE_PARM_DESC(mode,
+diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
+index 0e120d6..aeea1c1 100644
+--- a/drivers/video/vt8500lcdfb.c
++++ b/drivers/video/vt8500lcdfb.c
+@@ -457,18 +457,7 @@ static struct platform_driver vt8500lcd_driver = {
+ },
+ };
+
+-static int __init vt8500lcd_init(void)
+-{
+- return platform_driver_register(&vt8500lcd_driver);
+-}
+-
+-static void __exit vt8500lcd_exit(void)
+-{
+- platform_driver_unregister(&vt8500lcd_driver);
+-}
+-
+-module_init(vt8500lcd_init);
+-module_exit(vt8500lcd_exit);
++module_platform_driver(vt8500lcd_driver);
+
+ MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com>");
+ MODULE_DESCRIPTION("LCD controller driver for VIA VT8500");
+diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c
+index c8be8af..1fce2dc 100644
+--- a/drivers/video/w100fb.c
++++ b/drivers/video/w100fb.c
+@@ -1619,18 +1619,7 @@ static struct platform_driver w100fb_driver = {
+ },
+ };
+
+-int __init w100fb_init(void)
+-{
+- return platform_driver_register(&w100fb_driver);
+-}
+-
+-void __exit w100fb_cleanup(void)
+-{
+- platform_driver_unregister(&w100fb_driver);
+-}
+-
+-module_init(w100fb_init);
+-module_exit(w100fb_cleanup);
++module_platform_driver(w100fb_driver);
+
+ MODULE_DESCRIPTION("ATI Imageon w100 framebuffer driver");
+ MODULE_LICENSE("GPL");
+diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
+index 96e34a5..c8703bd 100644
+--- a/drivers/video/wm8505fb.c
++++ b/drivers/video/wm8505fb.c
+@@ -404,18 +404,7 @@ static struct platform_driver wm8505fb_driver = {
+ },
+ };
+
+-static int __init wm8505fb_init(void)
+-{
+- return platform_driver_register(&wm8505fb_driver);
+-}
+-
+-static void __exit wm8505fb_exit(void)
+-{
+- platform_driver_unregister(&wm8505fb_driver);
+-}
+-
+-module_init(wm8505fb_init);
+-module_exit(wm8505fb_exit);
++module_platform_driver(wm8505fb_driver);
+
+ MODULE_AUTHOR("Ed Spiridonov <edo.rus@gmail.com>");
+ MODULE_DESCRIPTION("Framebuffer driver for WMT WM8505");
+diff --git a/drivers/video/wmt_ge_rops.c b/drivers/video/wmt_ge_rops.c
+index 45832b7..55be386 100644
+--- a/drivers/video/wmt_ge_rops.c
++++ b/drivers/video/wmt_ge_rops.c
+@@ -167,18 +167,7 @@ static struct platform_driver wmt_ge_rops_driver = {
+ },
+ };
+
+-static int __init wmt_ge_rops_init(void)
+-{
+- return platform_driver_register(&wmt_ge_rops_driver);
+-}
+-
+-static void __exit wmt_ge_rops_exit(void)
+-{
+- platform_driver_unregister(&wmt_ge_rops_driver);
+-}
+-
+-module_init(wmt_ge_rops_init);
+-module_exit(wmt_ge_rops_exit);
++module_platform_driver(wmt_ge_rops_driver);
+
+ MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com");
+ MODULE_DESCRIPTION("Accelerators for raster operations using "
+diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
+index 77dea01..e44e1f0 100644
+--- a/drivers/video/xilinxfb.c
++++ b/drivers/video/xilinxfb.c
+@@ -512,25 +512,7 @@ static struct platform_driver xilinxfb_of_driver = {
+ },
+ };
+
+-
+-/* ---------------------------------------------------------------------
+- * Module setup and teardown
+- */
+-
+-static int __init
+-xilinxfb_init(void)
+-{
+- return platform_driver_register(&xilinxfb_of_driver);
+-}
+-
+-static void __exit
+-xilinxfb_cleanup(void)
+-{
+- platform_driver_unregister(&xilinxfb_of_driver);
+-}
+-
+-module_init(xilinxfb_init);
+-module_exit(xilinxfb_cleanup);
++module_platform_driver(xilinxfb_of_driver);
+
+ MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>");
+ MODULE_DESCRIPTION("Xilinx TFT frame buffer driver");
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0140-fbdev-Add-FOURCC-based-format-configuration-API.patch b/patches.armadillo800eva/0140-fbdev-Add-FOURCC-based-format-configuration-API.patch
new file mode 100644
index 00000000000000..620a6770b92c6d
--- /dev/null
+++ b/patches.armadillo800eva/0140-fbdev-Add-FOURCC-based-format-configuration-API.patch
@@ -0,0 +1,423 @@
+From 75c33faaf0d531af322d0cab6f50a6456fdfbcd5 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 13 Dec 2011 14:02:26 +0100
+Subject: fbdev: Add FOURCC-based format configuration API
+
+This API will be used to support YUV frame buffer formats in a standard
+way.
+
+Last but not least, create a much needed fbdev API documentation and
+document the format setting APIs.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit fb21c2f42879c05c76ea9e249b6905fc729f8529)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ Documentation/fb/api.txt | 306 ++++++++++++++++++++++++++++++++++++++++++++++
+ drivers/video/fbmem.c | 14 +++
+ include/linux/fb.h | 14 ++-
+ 3 files changed, 330 insertions(+), 4 deletions(-)
+ create mode 100644 Documentation/fb/api.txt
+
+diff --git a/Documentation/fb/api.txt b/Documentation/fb/api.txt
+new file mode 100644
+index 0000000..d4ff7de
+--- /dev/null
++++ b/Documentation/fb/api.txt
+@@ -0,0 +1,306 @@
++ The Frame Buffer Device API
++ ---------------------------
++
++Last revised: June 21, 2011
++
++
++0. Introduction
++---------------
++
++This document describes the frame buffer API used by applications to interact
++with frame buffer devices. In-kernel APIs between device drivers and the frame
++buffer core are not described.
++
++Due to a lack of documentation in the original frame buffer API, drivers
++behaviours differ in subtle (and not so subtle) ways. This document describes
++the recommended API implementation, but applications should be prepared to
++deal with different behaviours.
++
++
++1. Capabilities
++---------------
++
++Device and driver capabilities are reported in the fixed screen information
++capabilities field.
++
++struct fb_fix_screeninfo {
++ ...
++ __u16 capabilities; /* see FB_CAP_* */
++ ...
++};
++
++Application should use those capabilities to find out what features they can
++expect from the device and driver.
++
++- FB_CAP_FOURCC
++
++The driver supports the four character code (FOURCC) based format setting API.
++When supported, formats are configured using a FOURCC instead of manually
++specifying color components layout.
++
++
++2. Types and visuals
++--------------------
++
++Pixels are stored in memory in hardware-dependent formats. Applications need
++to be aware of the pixel storage format in order to write image data to the
++frame buffer memory in the format expected by the hardware.
++
++Formats are described by frame buffer types and visuals. Some visuals require
++additional information, which are stored in the variable screen information
++bits_per_pixel, grayscale, red, green, blue and transp fields.
++
++Visuals describe how color information is encoded and assembled to create
++macropixels. Types describe how macropixels are stored in memory. The following
++types and visuals are supported.
++
++- FB_TYPE_PACKED_PIXELS
++
++Macropixels are stored contiguously in a single plane. If the number of bits
++per macropixel is not a multiple of 8, whether macropixels are padded to the
++next multiple of 8 bits or packed together into bytes depends on the visual.
++
++Padding at end of lines may be present and is then reported through the fixed
++screen information line_length field.
++
++- FB_TYPE_PLANES
++
++Macropixels are split across multiple planes. The number of planes is equal to
++the number of bits per macropixel, with plane i'th storing i'th bit from all
++macropixels.
++
++Planes are located contiguously in memory.
++
++- FB_TYPE_INTERLEAVED_PLANES
++
++Macropixels are split across multiple planes. The number of planes is equal to
++the number of bits per macropixel, with plane i'th storing i'th bit from all
++macropixels.
++
++Planes are interleaved in memory. The interleave factor, defined as the
++distance in bytes between the beginning of two consecutive interleaved blocks
++belonging to different planes, is stored in the fixed screen information
++type_aux field.
++
++- FB_TYPE_FOURCC
++
++Macropixels are stored in memory as described by the format FOURCC identifier
++stored in the variable screen information grayscale field.
++
++- FB_VISUAL_MONO01
++
++Pixels are black or white and stored on a number of bits (typically one)
++specified by the variable screen information bpp field.
++
++Black pixels are represented by all bits set to 1 and white pixels by all bits
++set to 0. When the number of bits per pixel is smaller than 8, several pixels
++are packed together in a byte.
++
++FB_VISUAL_MONO01 is currently used with FB_TYPE_PACKED_PIXELS only.
++
++- FB_VISUAL_MONO10
++
++Pixels are black or white and stored on a number of bits (typically one)
++specified by the variable screen information bpp field.
++
++Black pixels are represented by all bits set to 0 and white pixels by all bits
++set to 1. When the number of bits per pixel is smaller than 8, several pixels
++are packed together in a byte.
++
++FB_VISUAL_MONO01 is currently used with FB_TYPE_PACKED_PIXELS only.
++
++- FB_VISUAL_TRUECOLOR
++
++Pixels are broken into red, green and blue components, and each component
++indexes a read-only lookup table for the corresponding value. Lookup tables
++are device-dependent, and provide linear or non-linear ramps.
++
++Each component is stored in a macropixel according to the variable screen
++information red, green, blue and transp fields.
++
++- FB_VISUAL_PSEUDOCOLOR and FB_VISUAL_STATIC_PSEUDOCOLOR
++
++Pixel values are encoded as indices into a colormap that stores red, green and
++blue components. The colormap is read-only for FB_VISUAL_STATIC_PSEUDOCOLOR
++and read-write for FB_VISUAL_PSEUDOCOLOR.
++
++Each pixel value is stored in the number of bits reported by the variable
++screen information bits_per_pixel field.
++
++- FB_VISUAL_DIRECTCOLOR
++
++Pixels are broken into red, green and blue components, and each component
++indexes a programmable lookup table for the corresponding value.
++
++Each component is stored in a macropixel according to the variable screen
++information red, green, blue and transp fields.
++
++- FB_VISUAL_FOURCC
++
++Pixels are encoded and interpreted as described by the format FOURCC
++identifier stored in the variable screen information grayscale field.
++
++
++3. Screen information
++---------------------
++
++Screen information are queried by applications using the FBIOGET_FSCREENINFO
++and FBIOGET_VSCREENINFO ioctls. Those ioctls take a pointer to a
++fb_fix_screeninfo and fb_var_screeninfo structure respectively.
++
++struct fb_fix_screeninfo stores device independent unchangeable information
++about the frame buffer device and the current format. Those information can't
++be directly modified by applications, but can be changed by the driver when an
++application modifies the format.
++
++struct fb_fix_screeninfo {
++ char id[16]; /* identification string eg "TT Builtin" */
++ unsigned long smem_start; /* Start of frame buffer mem */
++ /* (physical address) */
++ __u32 smem_len; /* Length of frame buffer mem */
++ __u32 type; /* see FB_TYPE_* */
++ __u32 type_aux; /* Interleave for interleaved Planes */
++ __u32 visual; /* see FB_VISUAL_* */
++ __u16 xpanstep; /* zero if no hardware panning */
++ __u16 ypanstep; /* zero if no hardware panning */
++ __u16 ywrapstep; /* zero if no hardware ywrap */
++ __u32 line_length; /* length of a line in bytes */
++ unsigned long mmio_start; /* Start of Memory Mapped I/O */
++ /* (physical address) */
++ __u32 mmio_len; /* Length of Memory Mapped I/O */
++ __u32 accel; /* Indicate to driver which */
++ /* specific chip/card we have */
++ __u16 capabilities; /* see FB_CAP_* */
++ __u16 reserved[2]; /* Reserved for future compatibility */
++};
++
++struct fb_var_screeninfo stores device independent changeable information
++about a frame buffer device, its current format and video mode, as well as
++other miscellaneous parameters.
++
++struct fb_var_screeninfo {
++ __u32 xres; /* visible resolution */
++ __u32 yres;
++ __u32 xres_virtual; /* virtual resolution */
++ __u32 yres_virtual;
++ __u32 xoffset; /* offset from virtual to visible */
++ __u32 yoffset; /* resolution */
++
++ __u32 bits_per_pixel; /* guess what */
++ __u32 grayscale; /* 0 = color, 1 = grayscale, */
++ /* >1 = FOURCC */
++ struct fb_bitfield red; /* bitfield in fb mem if true color, */
++ struct fb_bitfield green; /* else only length is significant */
++ struct fb_bitfield blue;
++ struct fb_bitfield transp; /* transparency */
++
++ __u32 nonstd; /* != 0 Non standard pixel format */
++
++ __u32 activate; /* see FB_ACTIVATE_* */
++
++ __u32 height; /* height of picture in mm */
++ __u32 width; /* width of picture in mm */
++
++ __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */
++
++ /* Timing: All values in pixclocks, except pixclock (of course) */
++ __u32 pixclock; /* pixel clock in ps (pico seconds) */
++ __u32 left_margin; /* time from sync to picture */
++ __u32 right_margin; /* time from picture to sync */
++ __u32 upper_margin; /* time from sync to picture */
++ __u32 lower_margin;
++ __u32 hsync_len; /* length of horizontal sync */
++ __u32 vsync_len; /* length of vertical sync */
++ __u32 sync; /* see FB_SYNC_* */
++ __u32 vmode; /* see FB_VMODE_* */
++ __u32 rotate; /* angle we rotate counter clockwise */
++ __u32 colorspace; /* colorspace for FOURCC-based modes */
++ __u32 reserved[4]; /* Reserved for future compatibility */
++};
++
++To modify variable information, applications call the FBIOPUT_VSCREENINFO
++ioctl with a pointer to a fb_var_screeninfo structure. If the call is
++successful, the driver will update the fixed screen information accordingly.
++
++Instead of filling the complete fb_var_screeninfo structure manually,
++applications should call the FBIOGET_VSCREENINFO ioctl and modify only the
++fields they care about.
++
++
++4. Format configuration
++-----------------------
++
++Frame buffer devices offer two ways to configure the frame buffer format: the
++legacy API and the FOURCC-based API.
++
++
++The legacy API has been the only frame buffer format configuration API for a
++long time and is thus widely used by application. It is the recommended API
++for applications when using RGB and grayscale formats, as well as legacy
++non-standard formats.
++
++To select a format, applications set the fb_var_screeninfo bits_per_pixel field
++to the desired frame buffer depth. Values up to 8 will usually map to
++monochrome, grayscale or pseudocolor visuals, although this is not required.
++
++- For grayscale formats, applications set the grayscale field to one. The red,
++ blue, green and transp fields must be set to 0 by applications and ignored by
++ drivers. Drivers must fill the red, blue and green offsets to 0 and lengths
++ to the bits_per_pixel value.
++
++- For pseudocolor formats, applications set the grayscale field to zero. The
++ red, blue, green and transp fields must be set to 0 by applications and
++ ignored by drivers. Drivers must fill the red, blue and green offsets to 0
++ and lengths to the bits_per_pixel value.
++
++- For truecolor and directcolor formats, applications set the grayscale field
++ to zero, and the red, blue, green and transp fields to describe the layout of
++ color components in memory.
++
++struct fb_bitfield {
++ __u32 offset; /* beginning of bitfield */
++ __u32 length; /* length of bitfield */
++ __u32 msb_right; /* != 0 : Most significant bit is */
++ /* right */
++};
++
++ Pixel values are bits_per_pixel wide and are split in non-overlapping red,
++ green, blue and alpha (transparency) components. Location and size of each
++ component in the pixel value are described by the fb_bitfield offset and
++ length fields. Offset are computed from the right.
++
++ Pixels are always stored in an integer number of bytes. If the number of
++ bits per pixel is not a multiple of 8, pixel values are padded to the next
++ multiple of 8 bits.
++
++Upon successful format configuration, drivers update the fb_fix_screeninfo
++type, visual and line_length fields depending on the selected format.
++
++
++The FOURCC-based API replaces format descriptions by four character codes
++(FOURCC). FOURCCs are abstract identifiers that uniquely define a format
++without explicitly describing it. This is the only API that supports YUV
++formats. Drivers are also encouraged to implement the FOURCC-based API for RGB
++and grayscale formats.
++
++Drivers that support the FOURCC-based API report this capability by setting
++the FB_CAP_FOURCC bit in the fb_fix_screeninfo capabilities field.
++
++FOURCC definitions are located in the linux/videodev2.h header. However, and
++despite starting with the V4L2_PIX_FMT_prefix, they are not restricted to V4L2
++and don't require usage of the V4L2 subsystem. FOURCC documentation is
++available in Documentation/DocBook/v4l/pixfmt.xml.
++
++To select a format, applications set the grayscale field to the desired FOURCC.
++For YUV formats, they should also select the appropriate colorspace by setting
++the colorspace field to one of the colorspaces listed in linux/videodev2.h and
++documented in Documentation/DocBook/v4l/colorspaces.xml.
++
++The red, green, blue and transp fields are not used with the FOURCC-based API.
++For forward compatibility reasons applications must zero those fields, and
++drivers must ignore them. Values other than 0 may get a meaning in future
++extensions.
++
++Upon successful format configuration, drivers update the fb_fix_screeninfo
++type, visual and line_length fields depending on the selected format. The type
++and visual fields are set to FB_TYPE_FOURCC and FB_VISUAL_FOURCC respectively.
+diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
+index 7a41220..c6ce416 100644
+--- a/drivers/video/fbmem.c
++++ b/drivers/video/fbmem.c
+@@ -967,6 +967,20 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
+ memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) {
+ u32 activate = var->activate;
+
++ /* When using FOURCC mode, make sure the red, green, blue and
++ * transp fields are set to 0.
++ */
++ if ((info->fix.capabilities & FB_CAP_FOURCC) &&
++ var->grayscale > 1) {
++ if (var->red.offset || var->green.offset ||
++ var->blue.offset || var->transp.offset ||
++ var->red.length || var->green.length ||
++ var->blue.length || var->transp.length ||
++ var->red.msb_right || var->green.msb_right ||
++ var->blue.msb_right || var->transp.msb_right)
++ return -EINVAL;
++ }
++
+ if (!info->fbops->fb_check_var) {
+ *var = info->var;
+ goto done;
+diff --git a/include/linux/fb.h b/include/linux/fb.h
+index f9d013d..1bcc94d 100644
+--- a/include/linux/fb.h
++++ b/include/linux/fb.h
+@@ -45,6 +45,7 @@
+ #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
+ #define FB_TYPE_TEXT 3 /* Text/attributes */
+ #define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */
++#define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */
+
+ #define FB_AUX_TEXT_MDA 0 /* Monochrome text */
+ #define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */
+@@ -69,6 +70,7 @@
+ #define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
+ #define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
+ #define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
++#define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */
+
+ #define FB_ACCEL_NONE 0 /* no hardware accelerator */
+ #define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */
+@@ -154,6 +156,8 @@
+
+ #define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */
+
++#define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */
++
+ struct fb_fix_screeninfo {
+ char id[16]; /* identification string eg "TT Builtin" */
+ unsigned long smem_start; /* Start of frame buffer mem */
+@@ -171,7 +175,8 @@ struct fb_fix_screeninfo {
+ __u32 mmio_len; /* Length of Memory Mapped I/O */
+ __u32 accel; /* Indicate to driver which */
+ /* specific chip/card we have */
+- __u16 reserved[3]; /* Reserved for future compatibility */
++ __u16 capabilities; /* see FB_CAP_* */
++ __u16 reserved[2]; /* Reserved for future compatibility */
+ };
+
+ /* Interpretation of offset for color fields: All offsets are from the right,
+@@ -246,8 +251,8 @@ struct fb_var_screeninfo {
+ __u32 yoffset; /* resolution */
+
+ __u32 bits_per_pixel; /* guess what */
+- __u32 grayscale; /* != 0 Graylevels instead of colors */
+-
++ __u32 grayscale; /* 0 = color, 1 = grayscale, */
++ /* >1 = FOURCC */
+ struct fb_bitfield red; /* bitfield in fb mem if true color, */
+ struct fb_bitfield green; /* else only length is significant */
+ struct fb_bitfield blue;
+@@ -273,7 +278,8 @@ struct fb_var_screeninfo {
+ __u32 sync; /* see FB_SYNC_* */
+ __u32 vmode; /* see FB_VMODE_* */
+ __u32 rotate; /* angle we rotate counter clockwise */
+- __u32 reserved[5]; /* Reserved for future compatibility */
++ __u32 colorspace; /* colorspace for FOURCC-based modes */
++ __u32 reserved[4]; /* Reserved for future compatibility */
+ };
+
+ struct fb_cmap {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0141-v4l-Add-V4L2_PIX_FMT_NV24-and-V4L2_PIX_FMT_NV42-form.patch b/patches.armadillo800eva/0141-v4l-Add-V4L2_PIX_FMT_NV24-and-V4L2_PIX_FMT_NV42-form.patch
new file mode 100644
index 00000000000000..847fe3beaa31ff
--- /dev/null
+++ b/patches.armadillo800eva/0141-v4l-Add-V4L2_PIX_FMT_NV24-and-V4L2_PIX_FMT_NV42-form.patch
@@ -0,0 +1,167 @@
+From 4df32b1d27fb25846739684fff2da3dee4f9353f Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 13 Dec 2011 14:02:27 +0100
+Subject: v4l: Add V4L2_PIX_FMT_NV24 and V4L2_PIX_FMT_NV42 formats
+
+NV24 and NV42 are planar YCbCr 4:4:4 and YCrCb 4:4:4 formats with a
+luma plane followed by an interleaved chroma plane.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 0b9eabd77f4867232a9ac6ca54fa39607b0c9bc7)
+
+Conflicts:
+
+ Documentation/DocBook/media/v4l/pixfmt.xml
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ Documentation/DocBook/media/v4l/pixfmt-nv24.xml | 121 +++++++++++++++++++++++
+ include/linux/videodev2.h | 2 +
+ 2 files changed, 123 insertions(+)
+ create mode 100644 Documentation/DocBook/media/v4l/pixfmt-nv24.xml
+
+diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv24.xml b/Documentation/DocBook/media/v4l/pixfmt-nv24.xml
+new file mode 100644
+index 0000000..fb255f2
+--- /dev/null
++++ b/Documentation/DocBook/media/v4l/pixfmt-nv24.xml
+@@ -0,0 +1,121 @@
++ <refentry>
++ <refmeta>
++ <refentrytitle>V4L2_PIX_FMT_NV24 ('NV24'), V4L2_PIX_FMT_NV42 ('NV42')</refentrytitle>
++ &manvol;
++ </refmeta>
++ <refnamediv>
++ <refname id="V4L2-PIX-FMT-NV24"><constant>V4L2_PIX_FMT_NV24</constant></refname>
++ <refname id="V4L2-PIX-FMT-NV42"><constant>V4L2_PIX_FMT_NV42</constant></refname>
++ <refpurpose>Formats with full horizontal and vertical
++chroma resolutions, also known as YUV 4:4:4. One luminance and one
++chrominance plane with alternating chroma samples as opposed to
++<constant>V4L2_PIX_FMT_YVU420</constant></refpurpose>
++ </refnamediv>
++ <refsect1>
++ <title>Description</title>
++
++ <para>These are two-plane versions of the YUV 4:4:4 format. The three
++ components are separated into two sub-images or planes. The Y plane is
++ first, with each Y sample stored in one byte per pixel. For
++ <constant>V4L2_PIX_FMT_NV24</constant>, a combined CbCr plane
++ immediately follows the Y plane in memory. The CbCr plane has the same
++ width and height, in pixels, as the Y plane (and the image). Each line
++ contains one CbCr pair per pixel, with each Cb and Cr sample stored in
++ one byte. <constant>V4L2_PIX_FMT_NV42</constant> is the same except that
++ the Cb and Cr samples are swapped, the CrCb plane starts with a Cr
++ sample.</para>
++
++ <para>If the Y plane has pad bytes after each row, then the CbCr plane
++ has twice as many pad bytes after its rows.</para>
++
++ <example>
++ <title><constant>V4L2_PIX_FMT_NV24</constant> 4 &times; 4
++pixel image</title>
++
++ <formalpara>
++ <title>Byte Order.</title>
++ <para>Each cell is one byte.
++ <informaltable frame="none">
++ <tgroup cols="9" align="center">
++ <colspec align="left" colwidth="2*" />
++ <tbody valign="top">
++ <row>
++ <entry>start&nbsp;+&nbsp;0:</entry>
++ <entry>Y'<subscript>00</subscript></entry>
++ <entry>Y'<subscript>01</subscript></entry>
++ <entry>Y'<subscript>02</subscript></entry>
++ <entry>Y'<subscript>03</subscript></entry>
++ </row>
++ <row>
++ <entry>start&nbsp;+&nbsp;4:</entry>
++ <entry>Y'<subscript>10</subscript></entry>
++ <entry>Y'<subscript>11</subscript></entry>
++ <entry>Y'<subscript>12</subscript></entry>
++ <entry>Y'<subscript>13</subscript></entry>
++ </row>
++ <row>
++ <entry>start&nbsp;+&nbsp;8:</entry>
++ <entry>Y'<subscript>20</subscript></entry>
++ <entry>Y'<subscript>21</subscript></entry>
++ <entry>Y'<subscript>22</subscript></entry>
++ <entry>Y'<subscript>23</subscript></entry>
++ </row>
++ <row>
++ <entry>start&nbsp;+&nbsp;12:</entry>
++ <entry>Y'<subscript>30</subscript></entry>
++ <entry>Y'<subscript>31</subscript></entry>
++ <entry>Y'<subscript>32</subscript></entry>
++ <entry>Y'<subscript>33</subscript></entry>
++ </row>
++ <row>
++ <entry>start&nbsp;+&nbsp;16:</entry>
++ <entry>Cb<subscript>00</subscript></entry>
++ <entry>Cr<subscript>00</subscript></entry>
++ <entry>Cb<subscript>01</subscript></entry>
++ <entry>Cr<subscript>01</subscript></entry>
++ <entry>Cb<subscript>02</subscript></entry>
++ <entry>Cr<subscript>02</subscript></entry>
++ <entry>Cb<subscript>03</subscript></entry>
++ <entry>Cr<subscript>03</subscript></entry>
++ </row>
++ <row>
++ <entry>start&nbsp;+&nbsp;24:</entry>
++ <entry>Cb<subscript>10</subscript></entry>
++ <entry>Cr<subscript>10</subscript></entry>
++ <entry>Cb<subscript>11</subscript></entry>
++ <entry>Cr<subscript>11</subscript></entry>
++ <entry>Cb<subscript>12</subscript></entry>
++ <entry>Cr<subscript>12</subscript></entry>
++ <entry>Cb<subscript>13</subscript></entry>
++ <entry>Cr<subscript>13</subscript></entry>
++ </row>
++ <row>
++ <entry>start&nbsp;+&nbsp;32:</entry>
++ <entry>Cb<subscript>20</subscript></entry>
++ <entry>Cr<subscript>20</subscript></entry>
++ <entry>Cb<subscript>21</subscript></entry>
++ <entry>Cr<subscript>21</subscript></entry>
++ <entry>Cb<subscript>22</subscript></entry>
++ <entry>Cr<subscript>22</subscript></entry>
++ <entry>Cb<subscript>23</subscript></entry>
++ <entry>Cr<subscript>23</subscript></entry>
++ </row>
++ <row>
++ <entry>start&nbsp;+&nbsp;40:</entry>
++ <entry>Cb<subscript>30</subscript></entry>
++ <entry>Cr<subscript>30</subscript></entry>
++ <entry>Cb<subscript>31</subscript></entry>
++ <entry>Cr<subscript>31</subscript></entry>
++ <entry>Cb<subscript>32</subscript></entry>
++ <entry>Cr<subscript>32</subscript></entry>
++ <entry>Cb<subscript>33</subscript></entry>
++ <entry>Cr<subscript>33</subscript></entry>
++ </row>
++ </tbody>
++ </tgroup>
++ </informaltable>
++ </para>
++ </formalpara>
++ </example>
++ </refsect1>
++ </refentry>
+diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
+index eeeda13..bd0ab98 100644
+--- a/include/linux/videodev2.h
++++ b/include/linux/videodev2.h
+@@ -343,6 +343,8 @@ struct v4l2_pix_format {
+ #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
+ #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
+ #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
++#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
++#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
+
+ /* two non contiguous planes - one Y, one Cr + Cb interleaved */
+ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0142-arm-fix-compile-failure-in-mach-shmobile-board-ag5ev.patch b/patches.armadillo800eva/0142-arm-fix-compile-failure-in-mach-shmobile-board-ag5ev.patch
new file mode 100644
index 00000000000000..8a74c02fae02fe
--- /dev/null
+++ b/patches.armadillo800eva/0142-arm-fix-compile-failure-in-mach-shmobile-board-ag5ev.patch
@@ -0,0 +1,33 @@
+From ec6cb263d29985e3a9750d14a8ffd1e9d096419c Mon Sep 17 00:00:00 2001
+From: Paul Gortmaker <paul.gortmaker@windriver.com>
+Date: Sun, 22 Jan 2012 14:57:25 -0500
+Subject: arm: fix compile failure in mach-shmobile/board-ag5evm.c
+
+Add videodev2 header which provides V4L2_PIX_FMT_RGB565 to fix:
+
+arch/arm/mach-shmobile/board-ag5evm.c:274: error: 'V4L2_PIX_FMT_RGB565' undeclared here (not in a function)
+
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 04f47a03c51c9f02fa27b0ecf4207e25c0741804)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ag5evm.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
+index 87e9091..5f5a8bb 100644
+--- a/arch/arm/mach-shmobile/board-ag5evm.c
++++ b/arch/arm/mach-shmobile/board-ag5evm.c
+@@ -30,6 +30,7 @@
+ #include <linux/serial_sci.h>
+ #include <linux/smsc911x.h>
+ #include <linux/gpio.h>
++#include <linux/videodev2.h>
+ #include <linux/input.h>
+ #include <linux/input/sh_keysc.h>
+ #include <linux/mmc/host.h>
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0143-sh-se7724-fix-compile-breakage.patch b/patches.armadillo800eva/0143-sh-se7724-fix-compile-breakage.patch
new file mode 100644
index 00000000000000..d81a4fffac5bb1
--- /dev/null
+++ b/patches.armadillo800eva/0143-sh-se7724-fix-compile-breakage.patch
@@ -0,0 +1,99 @@
+From c8673f13e0fa8797e793291a52449d98bdd44662 Mon Sep 17 00:00:00 2001
+From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+Date: Wed, 25 Jan 2012 22:07:05 +0100
+Subject: sh: se7724: fix compile breakage
+
+Fix compilation breakage
+
+arch/sh/boards/mach-se/7724/setup.c:182: error: 'V4L2_PIX_FMT_RGB565' undeclared here (not in a function)
+make[3]: *** [arch/sh/boards/mach-se/7724/setup.o] Error 1
+
+caused by commit "fbdev: sh_mobile_lcdc: Support FOURCC-based format API"
+Also add other missing headers, even if compilation currently succeeds
+because of their indirect inclusion via other headers.
+
+Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit a1ad803322a904a250fa901020b4a4dfaf51a829)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/sh/boards/mach-ap325rxa/setup.c | 1 +
+ arch/sh/boards/mach-ecovec24/setup.c | 2 ++
+ arch/sh/boards/mach-kfr2r09/setup.c | 1 +
+ arch/sh/boards/mach-migor/setup.c | 2 ++
+ arch/sh/boards/mach-se/7724/setup.c | 1 +
+ 5 files changed, 7 insertions(+)
+
+diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
+index 969421f..069cf26 100644
+--- a/arch/sh/boards/mach-ap325rxa/setup.c
++++ b/arch/sh/boards/mach-ap325rxa/setup.c
+@@ -22,6 +22,7 @@
+ #include <linux/i2c.h>
+ #include <linux/smsc911x.h>
+ #include <linux/gpio.h>
++#include <linux/videodev2.h>
+ #include <media/ov772x.h>
+ #include <media/soc_camera.h>
+ #include <media/soc_camera_platform.h>
+diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
+index 4fd83c4..4e8db96 100644
+--- a/arch/sh/boards/mach-ecovec24/setup.c
++++ b/arch/sh/boards/mach-ecovec24/setup.c
+@@ -29,9 +29,11 @@
+ #include <linux/input.h>
+ #include <linux/input/sh_keysc.h>
+ #include <linux/sh_eth.h>
++#include <linux/videodev2.h>
+ #include <video/sh_mobile_lcdc.h>
+ #include <sound/sh_fsi.h>
+ #include <media/sh_mobile_ceu.h>
++#include <media/soc_camera.h>
+ #include <media/tw9910.h>
+ #include <media/mt9t112.h>
+ #include <asm/heartbeat.h>
+diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
+index 8b4abbb..ca6df46 100644
+--- a/arch/sh/boards/mach-kfr2r09/setup.c
++++ b/arch/sh/boards/mach-kfr2r09/setup.c
+@@ -22,6 +22,7 @@
+ #include <linux/input/sh_keysc.h>
+ #include <linux/i2c.h>
+ #include <linux/usb/r8a66597.h>
++#include <linux/videodev2.h>
+ #include <media/rj54n1cb0c.h>
+ #include <media/soc_camera.h>
+ #include <media/sh_mobile_ceu.h>
+diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
+index 184fde1..67f4e4f 100644
+--- a/arch/sh/boards/mach-migor/setup.c
++++ b/arch/sh/boards/mach-migor/setup.c
+@@ -21,9 +21,11 @@
+ #include <linux/delay.h>
+ #include <linux/clk.h>
+ #include <linux/gpio.h>
++#include <linux/videodev2.h>
+ #include <video/sh_mobile_lcdc.h>
+ #include <media/sh_mobile_ceu.h>
+ #include <media/ov772x.h>
++#include <media/soc_camera.h>
+ #include <media/tw9910.h>
+ #include <asm/clock.h>
+ #include <asm/machvec.h>
+diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
+index 631da7d..ecb64e0 100644
+--- a/arch/sh/boards/mach-se/7724/setup.c
++++ b/arch/sh/boards/mach-se/7724/setup.c
+@@ -24,6 +24,7 @@
+ #include <linux/input/sh_keysc.h>
+ #include <linux/usb/r8a66597.h>
+ #include <linux/sh_eth.h>
++#include <linux/videodev2.h>
+ #include <video/sh_mobile_lcdc.h>
+ #include <media/sh_mobile_ceu.h>
+ #include <sound/sh_fsi.h>
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0144-fbdev-sh_mobile_lcdc-Support-FOURCC-based-format-API.patch b/patches.armadillo800eva/0144-fbdev-sh_mobile_lcdc-Support-FOURCC-based-format-API.patch
new file mode 100644
index 00000000000000..8b97700e746e6e
--- /dev/null
+++ b/patches.armadillo800eva/0144-fbdev-sh_mobile_lcdc-Support-FOURCC-based-format-API.patch
@@ -0,0 +1,731 @@
+From e2f763d7daf34ed70175d30f2059a9be348681f9 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 13 Dec 2011 14:02:28 +0100
+Subject: fbdev: sh_mobile_lcdc: Support FOURCC-based format API
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit edd153a3e4f7346551f98014b3ccf0494219a9d1)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ag5evm.c | 2 +-
+ arch/arm/mach-shmobile/board-ap4evb.c | 4 +-
+ arch/arm/mach-shmobile/board-mackerel.c | 4 +-
+ arch/sh/boards/mach-ap325rxa/setup.c | 2 +-
+ arch/sh/boards/mach-ecovec24/setup.c | 2 +-
+ arch/sh/boards/mach-kfr2r09/setup.c | 2 +-
+ arch/sh/boards/mach-migor/setup.c | 4 +-
+ arch/sh/boards/mach-se/7724/setup.c | 2 +-
+ drivers/video/sh_mobile_lcdcfb.c | 360 ++++++++++++++++++++-----------
+ include/video/sh_mobile_lcdc.h | 4 +-
+ 10 files changed, 253 insertions(+), 133 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
+index 5f5a8bb..14501ec 100644
+--- a/arch/arm/mach-shmobile/board-ag5evm.c
++++ b/arch/arm/mach-shmobile/board-ag5evm.c
+@@ -271,7 +271,7 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
+ .flags = LCDC_FLAGS_DWPOL,
+ .lcd_size_cfg.width = 44,
+ .lcd_size_cfg.height = 79,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .lcd_cfg = lcdc0_modes,
+ .num_cfg = ARRAY_SIZE(lcdc0_modes),
+ .board_cfg = {
+diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
+index 5db88ba..305dcd7 100644
+--- a/arch/arm/mach-shmobile/board-ap4evb.c
++++ b/arch/arm/mach-shmobile/board-ap4evb.c
+@@ -489,7 +489,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .meram_dev = &meram_info,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .lcd_cfg = ap4evb_lcdc_modes,
+ .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
+ .meram_cfg = &lcd_meram_cfg,
+@@ -785,7 +785,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
+ .meram_dev = &meram_info,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .interface_type = RGB24,
+ .clock_divider = 1,
+ .flags = LCDC_FLAGS_DWPOL,
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 3802f2a..28d98da 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -387,7 +387,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .clock_source = LCDC_CLK_BUS,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .lcd_cfg = mackerel_lcdc_modes,
+ .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes),
+ .interface_type = RGB24,
+@@ -450,7 +450,7 @@ static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
+ .clock_source = LCDC_CLK_EXTERNAL,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .interface_type = RGB24,
+ .clock_divider = 1,
+ .flags = LCDC_FLAGS_DWPOL,
+diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
+index 069cf26..4fde884 100644
+--- a/arch/sh/boards/mach-ap325rxa/setup.c
++++ b/arch/sh/boards/mach-ap325rxa/setup.c
+@@ -208,7 +208,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .clock_source = LCDC_CLK_EXTERNAL,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .interface_type = RGB18,
+ .clock_divider = 1,
+ .lcd_cfg = ap325rxa_lcdc_modes,
+diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
+index 4e8db96..67c2ee8 100644
+--- a/arch/sh/boards/mach-ecovec24/setup.c
++++ b/arch/sh/boards/mach-ecovec24/setup.c
+@@ -328,7 +328,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .ch[0] = {
+ .interface_type = RGB18,
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .lcd_size_cfg = { /* 7.0 inch */
+ .width = 152,
+ .height = 91,
+diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
+index ca6df46..7a35a5c 100644
+--- a/arch/sh/boards/mach-kfr2r09/setup.c
++++ b/arch/sh/boards/mach-kfr2r09/setup.c
+@@ -147,7 +147,7 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
+ .clock_source = LCDC_CLK_BUS,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .interface_type = SYS18,
+ .clock_divider = 6,
+ .flags = LCDC_FLAGS_DWPOL,
+diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
+index 67f4e4f..55ea682 100644
+--- a/arch/sh/boards/mach-migor/setup.c
++++ b/arch/sh/boards/mach-migor/setup.c
+@@ -246,7 +246,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
+ .clock_source = LCDC_CLK_BUS,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .interface_type = RGB16,
+ .clock_divider = 2,
+ .lcd_cfg = migor_lcd_modes,
+@@ -260,7 +260,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
+ .clock_source = LCDC_CLK_PERIPHERAL,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .interface_type = SYS16A,
+ .clock_divider = 10,
+ .lcd_cfg = migor_lcd_modes,
+diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
+index ecb64e0..65ff79d 100644
+--- a/arch/sh/boards/mach-se/7724/setup.c
++++ b/arch/sh/boards/mach-se/7724/setup.c
+@@ -180,7 +180,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .clock_source = LCDC_CLK_EXTERNAL,
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+- .bpp = 16,
++ .fourcc = V4L2_PIX_FMT_RGB565,
+ .clock_divider = 1,
+ .lcd_size_cfg = { /* 7.0 inch */
+ .width = 152,
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index a264ebf..aac5b36 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -17,6 +17,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/interrupt.h>
++#include <linux/videodev2.h>
+ #include <linux/vmalloc.h>
+ #include <linux/ioctl.h>
+ #include <linux/slab.h>
+@@ -102,7 +103,7 @@ struct sh_mobile_lcdc_priv {
+ struct sh_mobile_lcdc_chan ch[2];
+ struct notifier_block notifier;
+ int started;
+- int forced_bpp; /* 2 channel LCDC must share bpp setting */
++ int forced_fourcc; /* 2 channel LCDC must share fourcc setting */
+ struct sh_mobile_meram_info *meram_dev;
+ };
+
+@@ -215,6 +216,47 @@ struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
+ lcdc_sys_read_data,
+ };
+
++static int sh_mobile_format_fourcc(const struct fb_var_screeninfo *var)
++{
++ if (var->grayscale > 1)
++ return var->grayscale;
++
++ switch (var->bits_per_pixel) {
++ case 16:
++ return V4L2_PIX_FMT_RGB565;
++ case 24:
++ return V4L2_PIX_FMT_BGR24;
++ case 32:
++ return V4L2_PIX_FMT_BGR32;
++ default:
++ return 0;
++ }
++}
++
++static int sh_mobile_format_is_fourcc(const struct fb_var_screeninfo *var)
++{
++ return var->grayscale > 1;
++}
++
++static bool sh_mobile_format_is_yuv(const struct fb_var_screeninfo *var)
++{
++ if (var->grayscale <= 1)
++ return false;
++
++ switch (var->grayscale) {
++ case V4L2_PIX_FMT_NV12:
++ case V4L2_PIX_FMT_NV21:
++ case V4L2_PIX_FMT_NV16:
++ case V4L2_PIX_FMT_NV61:
++ case V4L2_PIX_FMT_NV24:
++ case V4L2_PIX_FMT_NV42:
++ return true;
++
++ default:
++ return false;
++ }
++}
++
+ static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
+ {
+ if (atomic_inc_and_test(&priv->hw_usecnt)) {
+@@ -435,7 +477,6 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ {
+ struct sh_mobile_lcdc_chan *ch;
+ unsigned long tmp;
+- int bpp = 0;
+ int k, m;
+
+ /* Enable LCDC channels. Read data from external memory, avoid using the
+@@ -454,9 +495,6 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ if (!ch->enabled)
+ continue;
+
+- if (!bpp)
+- bpp = ch->info->var.bits_per_pixel;
+-
+ /* Power supply */
+ lcdc_write_chan(ch, LDPMR, 0);
+
+@@ -487,31 +525,37 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+
+ sh_mobile_lcdc_geometry(ch);
+
+- if (ch->info->var.nonstd) {
+- tmp = (ch->info->var.nonstd << 16);
+- switch (ch->info->var.bits_per_pixel) {
+- case 12:
+- tmp |= LDDFR_YF_420;
+- break;
+- case 16:
+- tmp |= LDDFR_YF_422;
+- break;
+- case 24:
+- default:
+- tmp |= LDDFR_YF_444;
+- break;
+- }
+- } else {
+- switch (ch->info->var.bits_per_pixel) {
+- case 16:
+- tmp = LDDFR_PKF_RGB16;
+- break;
+- case 24:
+- tmp = LDDFR_PKF_RGB24;
++ switch (sh_mobile_format_fourcc(&ch->info->var)) {
++ case V4L2_PIX_FMT_RGB565:
++ tmp = LDDFR_PKF_RGB16;
++ break;
++ case V4L2_PIX_FMT_BGR24:
++ tmp = LDDFR_PKF_RGB24;
++ break;
++ case V4L2_PIX_FMT_BGR32:
++ tmp = LDDFR_PKF_ARGB32;
++ break;
++ case V4L2_PIX_FMT_NV12:
++ case V4L2_PIX_FMT_NV21:
++ tmp = LDDFR_CC | LDDFR_YF_420;
++ break;
++ case V4L2_PIX_FMT_NV16:
++ case V4L2_PIX_FMT_NV61:
++ tmp = LDDFR_CC | LDDFR_YF_422;
++ break;
++ case V4L2_PIX_FMT_NV24:
++ case V4L2_PIX_FMT_NV42:
++ tmp = LDDFR_CC | LDDFR_YF_444;
++ break;
++ }
++
++ if (sh_mobile_format_is_yuv(&ch->info->var)) {
++ switch (ch->info->var.colorspace) {
++ case V4L2_COLORSPACE_REC709:
++ tmp |= LDDFR_CF1;
+ break;
+- case 32:
+- default:
+- tmp = LDDFR_PKF_ARGB32;
++ case V4L2_COLORSPACE_JPEG:
++ tmp |= LDDFR_CF0;
+ break;
+ }
+ }
+@@ -519,7 +563,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ lcdc_write_chan(ch, LDDFR, tmp);
+ lcdc_write_chan(ch, LDMLSR, ch->pitch);
+ lcdc_write_chan(ch, LDSA1R, ch->base_addr_y);
+- if (ch->info->var.nonstd)
++ if (sh_mobile_format_is_yuv(&ch->info->var))
+ lcdc_write_chan(ch, LDSA2R, ch->base_addr_c);
+
+ /* When using deferred I/O mode, configure the LCDC for one-shot
+@@ -536,21 +580,23 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ }
+
+ /* Word and long word swap. */
+- if (priv->ch[0].info->var.nonstd)
++ switch (sh_mobile_format_fourcc(&priv->ch[0].info->var)) {
++ case V4L2_PIX_FMT_RGB565:
++ case V4L2_PIX_FMT_NV21:
++ case V4L2_PIX_FMT_NV61:
++ case V4L2_PIX_FMT_NV42:
++ tmp = LDDDSR_LS | LDDDSR_WS;
++ break;
++ case V4L2_PIX_FMT_BGR24:
++ case V4L2_PIX_FMT_NV12:
++ case V4L2_PIX_FMT_NV16:
++ case V4L2_PIX_FMT_NV24:
+ tmp = LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
+- else {
+- switch (bpp) {
+- case 16:
+- tmp = LDDDSR_LS | LDDDSR_WS;
+- break;
+- case 24:
+- tmp = LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
+- break;
+- case 32:
+- default:
+- tmp = LDDDSR_LS;
+- break;
+- }
++ break;
++ case V4L2_PIX_FMT_BGR32:
++ default:
++ tmp = LDDDSR_LS;
++ break;
+ }
+ lcdc_write(priv, _LDDDSR, tmp);
+
+@@ -622,12 +668,24 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ ch->meram_enabled = 0;
+ }
+
+- if (!ch->info->var.nonstd)
+- pixelformat = SH_MOBILE_MERAM_PF_RGB;
+- else if (ch->info->var.bits_per_pixel == 24)
+- pixelformat = SH_MOBILE_MERAM_PF_NV24;
+- else
++ switch (sh_mobile_format_fourcc(&ch->info->var)) {
++ case V4L2_PIX_FMT_NV12:
++ case V4L2_PIX_FMT_NV21:
++ case V4L2_PIX_FMT_NV16:
++ case V4L2_PIX_FMT_NV61:
+ pixelformat = SH_MOBILE_MERAM_PF_NV;
++ break;
++ case V4L2_PIX_FMT_NV24:
++ case V4L2_PIX_FMT_NV42:
++ pixelformat = SH_MOBILE_MERAM_PF_NV24;
++ break;
++ case V4L2_PIX_FMT_RGB565:
++ case V4L2_PIX_FMT_BGR24:
++ case V4L2_PIX_FMT_BGR32:
++ default:
++ pixelformat = SH_MOBILE_MERAM_PF_RGB;
++ break;
++ }
+
+ ret = mdev->ops->meram_register(mdev, cfg, ch->pitch,
+ ch->info->var.yres, pixelformat,
+@@ -845,6 +903,7 @@ static struct fb_fix_screeninfo sh_mobile_lcdc_fix = {
+ .xpanstep = 0,
+ .ypanstep = 1,
+ .ywrapstep = 0,
++ .capabilities = FB_CAP_FOURCC,
+ };
+
+ static void sh_mobile_lcdc_fillrect(struct fb_info *info,
+@@ -877,8 +936,9 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ unsigned long new_pan_offset;
+ unsigned long base_addr_y, base_addr_c;
+ unsigned long c_offset;
++ bool yuv = sh_mobile_format_is_yuv(&info->var);
+
+- if (!info->var.nonstd)
++ if (!yuv)
+ new_pan_offset = var->yoffset * info->fix.line_length
+ + var->xoffset * (info->var.bits_per_pixel / 8);
+ else
+@@ -892,7 +952,7 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+
+ /* Set the source address for the next refresh */
+ base_addr_y = ch->dma_handle + new_pan_offset;
+- if (info->var.nonstd) {
++ if (yuv) {
+ /* Set y offset */
+ c_offset = var->yoffset * info->fix.line_length
+ * (info->var.bits_per_pixel - 8) / 8;
+@@ -900,7 +960,7 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ + info->var.xres * info->var.yres_virtual
+ + c_offset;
+ /* Set x offset */
+- if (info->var.bits_per_pixel == 24)
++ if (sh_mobile_format_fourcc(&info->var) == V4L2_PIX_FMT_NV24)
+ base_addr_c += 2 * var->xoffset;
+ else
+ base_addr_c += var->xoffset;
+@@ -924,7 +984,7 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ ch->base_addr_c = base_addr_c;
+
+ lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y);
+- if (info->var.nonstd)
++ if (yuv)
+ lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c);
+
+ if (lcdc_chan_is_sublcd(ch))
+@@ -1100,51 +1160,84 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ if (var->yres_virtual < var->yres)
+ var->yres_virtual = var->yres;
+
+- if (var->bits_per_pixel <= 16) { /* RGB 565 */
+- var->bits_per_pixel = 16;
+- var->red.offset = 11;
+- var->red.length = 5;
+- var->green.offset = 5;
+- var->green.length = 6;
+- var->blue.offset = 0;
+- var->blue.length = 5;
+- var->transp.offset = 0;
+- var->transp.length = 0;
+- } else if (var->bits_per_pixel <= 24) { /* RGB 888 */
+- var->bits_per_pixel = 24;
+- var->red.offset = 16;
+- var->red.length = 8;
+- var->green.offset = 8;
+- var->green.length = 8;
+- var->blue.offset = 0;
+- var->blue.length = 8;
+- var->transp.offset = 0;
+- var->transp.length = 0;
+- } else if (var->bits_per_pixel <= 32) { /* RGBA 888 */
+- var->bits_per_pixel = 32;
+- var->red.offset = 16;
+- var->red.length = 8;
+- var->green.offset = 8;
+- var->green.length = 8;
+- var->blue.offset = 0;
+- var->blue.length = 8;
+- var->transp.offset = 24;
+- var->transp.length = 8;
+- } else
+- return -EINVAL;
++ if (sh_mobile_format_is_fourcc(var)) {
++ switch (var->grayscale) {
++ case V4L2_PIX_FMT_NV12:
++ case V4L2_PIX_FMT_NV21:
++ var->bits_per_pixel = 12;
++ break;
++ case V4L2_PIX_FMT_RGB565:
++ case V4L2_PIX_FMT_NV16:
++ case V4L2_PIX_FMT_NV61:
++ var->bits_per_pixel = 16;
++ break;
++ case V4L2_PIX_FMT_BGR24:
++ case V4L2_PIX_FMT_NV24:
++ case V4L2_PIX_FMT_NV42:
++ var->bits_per_pixel = 24;
++ break;
++ case V4L2_PIX_FMT_BGR32:
++ var->bits_per_pixel = 32;
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ /* Default to RGB and JPEG color-spaces for RGB and YUV formats
++ * respectively.
++ */
++ if (!sh_mobile_format_is_yuv(var))
++ var->colorspace = V4L2_COLORSPACE_SRGB;
++ else if (var->colorspace != V4L2_COLORSPACE_REC709)
++ var->colorspace = V4L2_COLORSPACE_JPEG;
++ } else {
++ if (var->bits_per_pixel <= 16) { /* RGB 565 */
++ var->bits_per_pixel = 16;
++ var->red.offset = 11;
++ var->red.length = 5;
++ var->green.offset = 5;
++ var->green.length = 6;
++ var->blue.offset = 0;
++ var->blue.length = 5;
++ var->transp.offset = 0;
++ var->transp.length = 0;
++ } else if (var->bits_per_pixel <= 24) { /* RGB 888 */
++ var->bits_per_pixel = 24;
++ var->red.offset = 16;
++ var->red.length = 8;
++ var->green.offset = 8;
++ var->green.length = 8;
++ var->blue.offset = 0;
++ var->blue.length = 8;
++ var->transp.offset = 0;
++ var->transp.length = 0;
++ } else if (var->bits_per_pixel <= 32) { /* RGBA 888 */
++ var->bits_per_pixel = 32;
++ var->red.offset = 16;
++ var->red.length = 8;
++ var->green.offset = 8;
++ var->green.length = 8;
++ var->blue.offset = 0;
++ var->blue.length = 8;
++ var->transp.offset = 24;
++ var->transp.length = 8;
++ } else
++ return -EINVAL;
+
+- var->red.msb_right = 0;
+- var->green.msb_right = 0;
+- var->blue.msb_right = 0;
+- var->transp.msb_right = 0;
++ var->red.msb_right = 0;
++ var->green.msb_right = 0;
++ var->blue.msb_right = 0;
++ var->transp.msb_right = 0;
++ }
+
+ /* Make sure we don't exceed our allocated memory. */
+ if (var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8 >
+ info->fix.smem_len)
+ return -EINVAL;
+
+- /* only accept the forced_bpp for dual channel configurations */
+- if (p->forced_bpp && p->forced_bpp != var->bits_per_pixel)
++ /* only accept the forced_fourcc for dual channel configurations */
++ if (p->forced_fourcc &&
++ p->forced_fourcc != sh_mobile_format_fourcc(var))
+ return -EINVAL;
+
+ return 0;
+@@ -1158,7 +1251,7 @@ static int sh_mobile_set_par(struct fb_info *info)
+
+ sh_mobile_lcdc_stop(ch->lcdc);
+
+- if (info->var.nonstd)
++ if (sh_mobile_format_is_yuv(&info->var))
+ info->fix.line_length = info->var.xres;
+ else
+ info->fix.line_length = info->var.xres
+@@ -1170,6 +1263,14 @@ static int sh_mobile_set_par(struct fb_info *info)
+ info->fix.line_length = line_length;
+ }
+
++ if (sh_mobile_format_is_fourcc(&info->var)) {
++ info->fix.type = FB_TYPE_FOURCC;
++ info->fix.visual = FB_VISUAL_FOURCC;
++ } else {
++ info->fix.type = FB_TYPE_PACKED_PIXELS;
++ info->fix.visual = FB_VISUAL_TRUECOLOR;
++ }
++
+ return ret;
+ }
+
+@@ -1464,9 +1565,9 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ for (i = 0, mode = cfg->lcd_cfg; i < cfg->num_cfg; i++, mode++) {
+ unsigned int size = mode->yres * mode->xres;
+
+- /* NV12 buffers must have even number of lines */
+- if ((cfg->nonstd) && cfg->bpp == 12 &&
+- (mode->yres & 0x1)) {
++ /* NV12/NV21 buffers must have even number of lines */
++ if ((cfg->fourcc == V4L2_PIX_FMT_NV12 ||
++ cfg->fourcc == V4L2_PIX_FMT_NV21) && (mode->yres & 0x1)) {
+ dev_err(dev, "yres must be multiple of 2 for YCbCr420 "
+ "mode.\n");
+ return -EINVAL;
+@@ -1484,14 +1585,6 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ dev_dbg(dev, "Found largest videomode %ux%u\n",
+ max_mode->xres, max_mode->yres);
+
+- /* Initialize fixed screen information. Restrict pan to 2 lines steps
+- * for NV12.
+- */
+- info->fix = sh_mobile_lcdc_fix;
+- info->fix.smem_len = max_size * 2 * cfg->bpp / 8;
+- if (cfg->nonstd && cfg->bpp == 12)
+- info->fix.ypanstep = 2;
+-
+ /* Create the mode list. */
+ if (cfg->lcd_cfg == NULL) {
+ mode = &default_720p;
+@@ -1509,19 +1602,38 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ */
+ var = &info->var;
+ fb_videomode_to_var(var, mode);
+- var->bits_per_pixel = cfg->bpp;
+ var->width = cfg->lcd_size_cfg.width;
+ var->height = cfg->lcd_size_cfg.height;
+ var->yres_virtual = var->yres * 2;
+ var->activate = FB_ACTIVATE_NOW;
+
++ switch (cfg->fourcc) {
++ case V4L2_PIX_FMT_RGB565:
++ var->bits_per_pixel = 16;
++ break;
++ case V4L2_PIX_FMT_BGR24:
++ var->bits_per_pixel = 24;
++ break;
++ case V4L2_PIX_FMT_BGR32:
++ var->bits_per_pixel = 32;
++ break;
++ default:
++ var->grayscale = cfg->fourcc;
++ break;
++ }
++
++ /* Make sure the memory size check won't fail. smem_len is initialized
++ * later based on var.
++ */
++ info->fix.smem_len = UINT_MAX;
+ ret = sh_mobile_check_var(var, info);
+ if (ret)
+ return ret;
+
++ max_size = max_size * var->bits_per_pixel / 8 * 2;
++
+ /* Allocate frame buffer memory and color map. */
+- buf = dma_alloc_coherent(dev, info->fix.smem_len, &ch->dma_handle,
+- GFP_KERNEL);
++ buf = dma_alloc_coherent(dev, max_size, &ch->dma_handle, GFP_KERNEL);
+ if (!buf) {
+ dev_err(dev, "unable to allocate buffer\n");
+ return -ENOMEM;
+@@ -1530,16 +1642,27 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
+ if (ret < 0) {
+ dev_err(dev, "unable to allocate cmap\n");
+- dma_free_coherent(dev, info->fix.smem_len,
+- buf, ch->dma_handle);
++ dma_free_coherent(dev, max_size, buf, ch->dma_handle);
+ return ret;
+ }
+
++ /* Initialize fixed screen information. Restrict pan to 2 lines steps
++ * for NV12 and NV21.
++ */
++ info->fix = sh_mobile_lcdc_fix;
+ info->fix.smem_start = ch->dma_handle;
+- if (var->nonstd)
++ info->fix.smem_len = max_size;
++ if (cfg->fourcc == V4L2_PIX_FMT_NV12 ||
++ cfg->fourcc == V4L2_PIX_FMT_NV21)
++ info->fix.ypanstep = 2;
++
++ if (sh_mobile_format_is_yuv(var)) {
+ info->fix.line_length = var->xres;
+- else
+- info->fix.line_length = var->xres * (cfg->bpp / 8);
++ info->fix.visual = FB_VISUAL_FOURCC;
++ } else {
++ info->fix.line_length = var->xres * var->bits_per_pixel / 8;
++ info->fix.visual = FB_VISUAL_TRUECOLOR;
++ }
+
+ info->screen_base = buf;
+ info->device = dev;
+@@ -1626,9 +1749,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ goto err1;
+ }
+
+- /* for dual channel LCDC (MAIN + SUB) force shared bpp setting */
++ /* for dual channel LCDC (MAIN + SUB) force shared format setting */
+ if (num_channels == 2)
+- priv->forced_bpp = pdata->ch[0].bpp;
++ priv->forced_fourcc = pdata->ch[0].fourcc;
+
+ priv->base = ioremap_nocache(res->start, resource_size(res));
+ if (!priv->base)
+@@ -1675,13 +1798,10 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ if (error < 0)
+ goto err1;
+
+- dev_info(info->dev,
+- "registered %s/%s as %dx%d %dbpp.\n",
+- pdev->name,
+- (ch->cfg.chan == LCDC_CHAN_MAINLCD) ?
+- "mainlcd" : "sublcd",
+- info->var.xres, info->var.yres,
+- ch->cfg.bpp);
++ dev_info(info->dev, "registered %s/%s as %dx%d %dbpp.\n",
++ pdev->name, (ch->cfg.chan == LCDC_CHAN_MAINLCD) ?
++ "mainlcd" : "sublcd", info->var.xres, info->var.yres,
++ info->var.bits_per_pixel);
+
+ /* deferred io mode: disable clock to save power */
+ if (info->fbdefio || info->state == FBINFO_STATE_SUSPENDED)
+diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
+index 8101b72..fe30b75 100644
+--- a/include/video/sh_mobile_lcdc.h
++++ b/include/video/sh_mobile_lcdc.h
+@@ -174,7 +174,8 @@ struct sh_mobile_lcdc_bl_info {
+
+ struct sh_mobile_lcdc_chan_cfg {
+ int chan;
+- int bpp;
++ int fourcc;
++ int colorspace;
+ int interface_type; /* selects RGBn or SYSn I/F, see above */
+ int clock_divider;
+ unsigned long flags; /* LCDC_FLAGS_... */
+@@ -184,7 +185,6 @@ struct sh_mobile_lcdc_chan_cfg {
+ struct sh_mobile_lcdc_board_cfg board_cfg;
+ struct sh_mobile_lcdc_bl_info bl_info;
+ struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
+- int nonstd;
+ struct sh_mobile_meram_cfg *meram_cfg;
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0145-fbdev-sh_mobile_lcdc-Reorder-code-into-sections.patch b/patches.armadillo800eva/0145-fbdev-sh_mobile_lcdc-Reorder-code-into-sections.patch
new file mode 100644
index 00000000000000..9fcf01f3696165
--- /dev/null
+++ b/patches.armadillo800eva/0145-fbdev-sh_mobile_lcdc-Reorder-code-into-sections.patch
@@ -0,0 +1,547 @@
+From 4256e90e66526555938a4f071320bbab2e942abe Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 7 Sep 2011 11:09:26 +0200
+Subject: fbdev: sh_mobile_lcdc: Reorder code into sections
+
+Make the driver more readable by reordering code and splitting it into
+logical sections. Reorder the headers alphabetically.
+
+No modification to the code have been performed.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit f1f60b5f55099a658a5f79cc453b371a439864e6)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 421 +++++++++++++++++++++-----------------
+ 1 file changed, 231 insertions(+), 190 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index aac5b36..8b18360 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -8,26 +8,27 @@
+ * for more details.
+ */
+
+-#include <linux/kernel.h>
+-#include <linux/init.h>
+-#include <linux/delay.h>
+-#include <linux/mm.h>
++#include <linux/atomic.h>
++#include <linux/backlight.h>
+ #include <linux/clk.h>
+-#include <linux/pm_runtime.h>
+-#include <linux/platform_device.h>
++#include <linux/console.h>
+ #include <linux/dma-mapping.h>
++#include <linux/delay.h>
++#include <linux/gpio.h>
++#include <linux/init.h>
+ #include <linux/interrupt.h>
+-#include <linux/videodev2.h>
+-#include <linux/vmalloc.h>
+ #include <linux/ioctl.h>
+-#include <linux/slab.h>
+-#include <linux/console.h>
+-#include <linux/backlight.h>
+-#include <linux/gpio.h>
++#include <linux/kernel.h>
++#include <linux/mm.h>
+ #include <linux/module.h>
++#include <linux/platform_device.h>
++#include <linux/pm_runtime.h>
++#include <linux/slab.h>
++#include <linux/videodev2.h>
++#include <linux/vmalloc.h>
++
+ #include <video/sh_mobile_lcdc.h>
+ #include <video/sh_mobile_meram.h>
+-#include <linux/atomic.h>
+
+ #include "sh_mobile_lcdcfb.h"
+
+@@ -37,6 +38,24 @@
+ #define MAX_XRES 1920
+ #define MAX_YRES 1080
+
++struct sh_mobile_lcdc_priv {
++ void __iomem *base;
++ int irq;
++ atomic_t hw_usecnt;
++ struct device *dev;
++ struct clk *dot_clk;
++ unsigned long lddckr;
++ struct sh_mobile_lcdc_chan ch[2];
++ struct notifier_block notifier;
++ int started;
++ int forced_fourcc; /* 2 channel LCDC must share fourcc setting */
++ struct sh_mobile_meram_info *meram_dev;
++};
++
++/* -----------------------------------------------------------------------------
++ * Registers access
++ */
++
+ static unsigned long lcdc_offs_mainlcd[NR_CH_REGS] = {
+ [LDDCKPAT1R] = 0x400,
+ [LDDCKPAT2R] = 0x404,
+@@ -75,38 +94,6 @@ static unsigned long lcdc_offs_sublcd[NR_CH_REGS] = {
+ [LDPMR] = 0x63c,
+ };
+
+-static const struct fb_videomode default_720p = {
+- .name = "HDMI 720p",
+- .xres = 1280,
+- .yres = 720,
+-
+- .left_margin = 220,
+- .right_margin = 110,
+- .hsync_len = 40,
+-
+- .upper_margin = 20,
+- .lower_margin = 5,
+- .vsync_len = 5,
+-
+- .pixclock = 13468,
+- .refresh = 60,
+- .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+-};
+-
+-struct sh_mobile_lcdc_priv {
+- void __iomem *base;
+- int irq;
+- atomic_t hw_usecnt;
+- struct device *dev;
+- struct clk *dot_clk;
+- unsigned long lddckr;
+- struct sh_mobile_lcdc_chan ch[2];
+- struct notifier_block notifier;
+- int started;
+- int forced_fourcc; /* 2 channel LCDC must share fourcc setting */
+- struct sh_mobile_meram_info *meram_dev;
+-};
+-
+ static bool banked(int reg_nr)
+ {
+ switch (reg_nr) {
+@@ -127,6 +114,11 @@ static bool banked(int reg_nr)
+ return false;
+ }
+
++static int lcdc_chan_is_sublcd(struct sh_mobile_lcdc_chan *chan)
++{
++ return chan->cfg.chan == LCDC_CHAN_SUBLCD;
++}
++
+ static void lcdc_write_chan(struct sh_mobile_lcdc_chan *chan,
+ int reg_nr, unsigned long data)
+ {
+@@ -169,11 +161,77 @@ static void lcdc_wait_bit(struct sh_mobile_lcdc_priv *priv,
+ cpu_relax();
+ }
+
+-static int lcdc_chan_is_sublcd(struct sh_mobile_lcdc_chan *chan)
++/* -----------------------------------------------------------------------------
++ * Clock management
++ */
++
++static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
+ {
+- return chan->cfg.chan == LCDC_CHAN_SUBLCD;
++ if (atomic_inc_and_test(&priv->hw_usecnt)) {
++ if (priv->dot_clk)
++ clk_enable(priv->dot_clk);
++ pm_runtime_get_sync(priv->dev);
++ if (priv->meram_dev && priv->meram_dev->pdev)
++ pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
++ }
+ }
+
++static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
++{
++ if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
++ if (priv->meram_dev && priv->meram_dev->pdev)
++ pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
++ pm_runtime_put(priv->dev);
++ if (priv->dot_clk)
++ clk_disable(priv->dot_clk);
++ }
++}
++
++static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
++ int clock_source,
++ struct sh_mobile_lcdc_priv *priv)
++{
++ char *str;
++
++ switch (clock_source) {
++ case LCDC_CLK_BUS:
++ str = "bus_clk";
++ priv->lddckr = LDDCKR_ICKSEL_BUS;
++ break;
++ case LCDC_CLK_PERIPHERAL:
++ str = "peripheral_clk";
++ priv->lddckr = LDDCKR_ICKSEL_MIPI;
++ break;
++ case LCDC_CLK_EXTERNAL:
++ str = NULL;
++ priv->lddckr = LDDCKR_ICKSEL_HDMI;
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ if (str) {
++ priv->dot_clk = clk_get(&pdev->dev, str);
++ if (IS_ERR(priv->dot_clk)) {
++ dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
++ return PTR_ERR(priv->dot_clk);
++ }
++ }
++
++ /* Runtime PM support involves two step for this driver:
++ * 1) Enable Runtime PM
++ * 2) Force Runtime PM Resume since hardware is accessed from probe()
++ */
++ priv->dev = &pdev->dev;
++ pm_runtime_enable(priv->dev);
++ pm_runtime_resume(priv->dev);
++ return 0;
++}
++
++/* -----------------------------------------------------------------------------
++ * Sys panel and deferred I/O
++ */
++
+ static void lcdc_sys_write_index(void *handle, unsigned long data)
+ {
+ struct sh_mobile_lcdc_chan *ch = handle;
+@@ -216,69 +274,6 @@ struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
+ lcdc_sys_read_data,
+ };
+
+-static int sh_mobile_format_fourcc(const struct fb_var_screeninfo *var)
+-{
+- if (var->grayscale > 1)
+- return var->grayscale;
+-
+- switch (var->bits_per_pixel) {
+- case 16:
+- return V4L2_PIX_FMT_RGB565;
+- case 24:
+- return V4L2_PIX_FMT_BGR24;
+- case 32:
+- return V4L2_PIX_FMT_BGR32;
+- default:
+- return 0;
+- }
+-}
+-
+-static int sh_mobile_format_is_fourcc(const struct fb_var_screeninfo *var)
+-{
+- return var->grayscale > 1;
+-}
+-
+-static bool sh_mobile_format_is_yuv(const struct fb_var_screeninfo *var)
+-{
+- if (var->grayscale <= 1)
+- return false;
+-
+- switch (var->grayscale) {
+- case V4L2_PIX_FMT_NV12:
+- case V4L2_PIX_FMT_NV21:
+- case V4L2_PIX_FMT_NV16:
+- case V4L2_PIX_FMT_NV61:
+- case V4L2_PIX_FMT_NV24:
+- case V4L2_PIX_FMT_NV42:
+- return true;
+-
+- default:
+- return false;
+- }
+-}
+-
+-static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
+-{
+- if (atomic_inc_and_test(&priv->hw_usecnt)) {
+- if (priv->dot_clk)
+- clk_enable(priv->dot_clk);
+- pm_runtime_get_sync(priv->dev);
+- if (priv->meram_dev && priv->meram_dev->pdev)
+- pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
+- }
+-}
+-
+-static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
+-{
+- if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
+- if (priv->meram_dev && priv->meram_dev->pdev)
+- pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
+- pm_runtime_put(priv->dev);
+- if (priv->dot_clk)
+- clk_disable(priv->dot_clk);
+- }
+-}
+-
+ static int sh_mobile_lcdc_sginit(struct fb_info *info,
+ struct list_head *pagelist)
+ {
+@@ -345,6 +340,55 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
+ schedule_delayed_work(&info->deferred_work, fbdefio->delay);
+ }
+
++/* -----------------------------------------------------------------------------
++ * Format helpers
++ */
++
++static int sh_mobile_format_fourcc(const struct fb_var_screeninfo *var)
++{
++ if (var->grayscale > 1)
++ return var->grayscale;
++
++ switch (var->bits_per_pixel) {
++ case 16:
++ return V4L2_PIX_FMT_RGB565;
++ case 24:
++ return V4L2_PIX_FMT_BGR24;
++ case 32:
++ return V4L2_PIX_FMT_BGR32;
++ default:
++ return 0;
++ }
++}
++
++static int sh_mobile_format_is_fourcc(const struct fb_var_screeninfo *var)
++{
++ return var->grayscale > 1;
++}
++
++static bool sh_mobile_format_is_yuv(const struct fb_var_screeninfo *var)
++{
++ if (var->grayscale <= 1)
++ return false;
++
++ switch (var->grayscale) {
++ case V4L2_PIX_FMT_NV12:
++ case V4L2_PIX_FMT_NV21:
++ case V4L2_PIX_FMT_NV16:
++ case V4L2_PIX_FMT_NV61:
++ case V4L2_PIX_FMT_NV24:
++ case V4L2_PIX_FMT_NV42:
++ return true;
++
++ default:
++ return false;
++ }
++}
++
++/* -----------------------------------------------------------------------------
++ * Start, stop and IRQ
++ */
++
+ static irqreturn_t sh_mobile_lcdc_irq(int irq, void *data)
+ {
+ struct sh_mobile_lcdc_priv *priv = data;
+@@ -790,86 +834,9 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
+ sh_mobile_lcdc_clk_off(priv);
+ }
+
+-static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
+-{
+- int interface_type = ch->cfg.interface_type;
+-
+- switch (interface_type) {
+- case RGB8:
+- case RGB9:
+- case RGB12A:
+- case RGB12B:
+- case RGB16:
+- case RGB18:
+- case RGB24:
+- case SYS8A:
+- case SYS8B:
+- case SYS8C:
+- case SYS8D:
+- case SYS9:
+- case SYS12:
+- case SYS16A:
+- case SYS16B:
+- case SYS16C:
+- case SYS18:
+- case SYS24:
+- break;
+- default:
+- return -EINVAL;
+- }
+-
+- /* SUBLCD only supports SYS interface */
+- if (lcdc_chan_is_sublcd(ch)) {
+- if (!(interface_type & LDMT1R_IFM))
+- return -EINVAL;
+-
+- interface_type &= ~LDMT1R_IFM;
+- }
+-
+- ch->ldmt1r_value = interface_type;
+- return 0;
+-}
+-
+-static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
+- int clock_source,
+- struct sh_mobile_lcdc_priv *priv)
+-{
+- char *str;
+-
+- switch (clock_source) {
+- case LCDC_CLK_BUS:
+- str = "bus_clk";
+- priv->lddckr = LDDCKR_ICKSEL_BUS;
+- break;
+- case LCDC_CLK_PERIPHERAL:
+- str = "peripheral_clk";
+- priv->lddckr = LDDCKR_ICKSEL_MIPI;
+- break;
+- case LCDC_CLK_EXTERNAL:
+- str = NULL;
+- priv->lddckr = LDDCKR_ICKSEL_HDMI;
+- break;
+- default:
+- return -EINVAL;
+- }
+-
+- if (str) {
+- priv->dot_clk = clk_get(&pdev->dev, str);
+- if (IS_ERR(priv->dot_clk)) {
+- dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
+- return PTR_ERR(priv->dot_clk);
+- }
+- }
+-
+- /* Runtime PM support involves two step for this driver:
+- * 1) Enable Runtime PM
+- * 2) Force Runtime PM Resume since hardware is accessed from probe()
+- */
+- priv->dev = &pdev->dev;
+- pm_runtime_enable(priv->dev);
+- pm_runtime_resume(priv->dev);
+- return 0;
+-}
++/* -----------------------------------------------------------------------------
++ * Frame buffer operations
++ */
+
+ static int sh_mobile_lcdc_setcolreg(u_int regno,
+ u_int red, u_int green, u_int blue,
+@@ -1334,6 +1301,10 @@ static struct fb_ops sh_mobile_lcdc_ops = {
+ .fb_set_par = sh_mobile_set_par,
+ };
+
++/* -----------------------------------------------------------------------------
++ * Backlight
++ */
++
+ static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
+ {
+ struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
+@@ -1393,6 +1364,10 @@ static void sh_mobile_lcdc_bl_remove(struct backlight_device *bdev)
+ backlight_device_unregister(bdev);
+ }
+
++/* -----------------------------------------------------------------------------
++ * Power management
++ */
++
+ static int sh_mobile_lcdc_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+@@ -1436,6 +1411,10 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = {
+ .runtime_resume = sh_mobile_lcdc_runtime_resume,
+ };
+
++/* -----------------------------------------------------------------------------
++ * Framebuffer notifier
++ */
++
+ /* locking: called with info->lock held */
+ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
+ unsigned long action, void *data)
+@@ -1476,6 +1455,28 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
+ return NOTIFY_OK;
+ }
+
++/* -----------------------------------------------------------------------------
++ * Probe/remove and driver init/exit
++ */
++
++static const struct fb_videomode default_720p = {
++ .name = "HDMI 720p",
++ .xres = 1280,
++ .yres = 720,
++
++ .left_margin = 220,
++ .right_margin = 110,
++ .hsync_len = 40,
++
++ .upper_margin = 20,
++ .lower_margin = 5,
++ .vsync_len = 5,
++
++ .pixclock = 13468,
++ .refresh = 60,
++ .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
++};
++
+ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+ {
+ struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
+@@ -1527,6 +1528,46 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+ return 0;
+ }
+
++static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
++{
++ int interface_type = ch->cfg.interface_type;
++
++ switch (interface_type) {
++ case RGB8:
++ case RGB9:
++ case RGB12A:
++ case RGB12B:
++ case RGB16:
++ case RGB18:
++ case RGB24:
++ case SYS8A:
++ case SYS8B:
++ case SYS8C:
++ case SYS8D:
++ case SYS9:
++ case SYS12:
++ case SYS16A:
++ case SYS16B:
++ case SYS16C:
++ case SYS18:
++ case SYS24:
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ /* SUBLCD only supports SYS interface */
++ if (lcdc_chan_is_sublcd(ch)) {
++ if (!(interface_type & LDMT1R_IFM))
++ return -EINVAL;
++
++ interface_type &= ~LDMT1R_IFM;
++ }
++
++ ch->ldmt1r_value = interface_type;
++ return 0;
++}
++
+ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ struct device *dev)
+ {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0146-fbdev-sh_mobile_lcdc-Mark-init-only-symbols-with-__d.patch b/patches.armadillo800eva/0146-fbdev-sh_mobile_lcdc-Mark-init-only-symbols-with-__d.patch
new file mode 100644
index 00000000000000..28627dc920f65b
--- /dev/null
+++ b/patches.armadillo800eva/0146-fbdev-sh_mobile_lcdc-Mark-init-only-symbols-with-__d.patch
@@ -0,0 +1,42 @@
+From 944c754ccfe91d14fc6f94618841fdb9b0d4a6e3 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 7 Sep 2011 11:59:00 +0200
+Subject: fbdev: sh_mobile_lcdc: Mark init-only symbols with __devinit(const)
+
+default_720p and sh_mobile_lcdc_check_interface are used at device
+initialization time only. Mark them as __devinitconst and __devinit
+respectively.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 217e9c4353aa86f0c7eeb4c275bca73ea8b53be1)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 8b18360..d9f394e 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1459,7 +1459,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
+ * Probe/remove and driver init/exit
+ */
+
+-static const struct fb_videomode default_720p = {
++static const struct fb_videomode default_720p __devinitconst = {
+ .name = "HDMI 720p",
+ .xres = 1280,
+ .yres = 720,
+@@ -1528,7 +1528,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+ return 0;
+ }
+
+-static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
++static int __devinit sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
+ {
+ int interface_type = ch->cfg.interface_type;
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0147-fbdev-sh_mobile_lcdc-Move-pm-runtime-enable-to-probe.patch b/patches.armadillo800eva/0147-fbdev-sh_mobile_lcdc-Move-pm-runtime-enable-to-probe.patch
new file mode 100644
index 00000000000000..6b545e8c94e5b5
--- /dev/null
+++ b/patches.armadillo800eva/0147-fbdev-sh_mobile_lcdc-Move-pm-runtime-enable-to-probe.patch
@@ -0,0 +1,96 @@
+From 8abe9070ac0df6222c5aa238ff8ea107da4b79af Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 7 Sep 2011 15:47:07 +0200
+Subject: fbdev: sh_mobile_lcdc: Move pm runtime enable to probe()
+
+The pm_runtime_enable() and pm_runtime_resume() calls don't belong to
+sh_mobile_lcdc_setup_clocks(). Move them to the probe function. Remove
+the unneeded pm_runtime_resume() call.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 4774c12aacafc0b8be81b1d159be5a761889e2d7)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 34 ++++++++++++++++------------------
+ 1 file changed, 16 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index d9f394e..75f613b 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -191,6 +191,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
+ int clock_source,
+ struct sh_mobile_lcdc_priv *priv)
+ {
++ struct clk *clk;
+ char *str;
+
+ switch (clock_source) {
+@@ -210,21 +211,16 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
+ return -EINVAL;
+ }
+
+- if (str) {
+- priv->dot_clk = clk_get(&pdev->dev, str);
+- if (IS_ERR(priv->dot_clk)) {
+- dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
+- return PTR_ERR(priv->dot_clk);
+- }
++ if (str == NULL)
++ return 0;
++
++ clk = clk_get(&pdev->dev, str);
++ if (IS_ERR(clk)) {
++ dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
++ return PTR_ERR(clk);
+ }
+
+- /* Runtime PM support involves two step for this driver:
+- * 1) Enable Runtime PM
+- * 2) Force Runtime PM Resume since hardware is accessed from probe()
+- */
+- priv->dev = &pdev->dev;
+- pm_runtime_enable(priv->dev);
+- pm_runtime_resume(priv->dev);
++ priv->dot_clk = clk;
+ return 0;
+ }
+
+@@ -1513,11 +1509,10 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+ sh_mobile_lcdc_bl_remove(priv->ch[i].bl);
+ }
+
+- if (priv->dot_clk)
++ if (priv->dot_clk) {
++ pm_runtime_disable(&pdev->dev);
+ clk_put(priv->dot_clk);
+-
+- if (priv->dev)
+- pm_runtime_disable(priv->dev);
++ }
+
+ if (priv->base)
+ iounmap(priv->base);
+@@ -1739,6 +1734,8 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ return -ENOMEM;
+ }
+
++ priv->dev = &pdev->dev;
++ priv->meram_dev = pdata->meram_dev;
+ platform_set_drvdata(pdev, priv);
+
+ error = request_irq(i, sh_mobile_lcdc_irq, 0,
+@@ -1804,7 +1801,8 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ goto err1;
+ }
+
+- priv->meram_dev = pdata->meram_dev;
++ /* Enable runtime PM. */
++ pm_runtime_enable(&pdev->dev);
+
+ for (i = 0; i < num_channels; i++) {
+ struct sh_mobile_lcdc_chan *ch = priv->ch + i;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0148-fbdev-sh_mobile_lcdc-Don-t-pass-struct-device-around.patch b/patches.armadillo800eva/0148-fbdev-sh_mobile_lcdc-Don-t-pass-struct-device-around.patch
new file mode 100644
index 00000000000000..25b141f5ab78f3
--- /dev/null
+++ b/patches.armadillo800eva/0148-fbdev-sh_mobile_lcdc-Don-t-pass-struct-device-around.patch
@@ -0,0 +1,149 @@
+From a5021ecc0d61923f6a09e5dc04b86f96526a5cc3 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 7 Sep 2011 16:02:31 +0200
+Subject: fbdev: sh_mobile_lcdc: Don't pass struct device around
+
+Pass a pointer to a struct sh_mobile_lcdc_priv instead, which stores a
+pointer to the device.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 0a7f17aa3d6b693700af2e1cbf8cfdd28e18aebb)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 41 +++++++++++++++++++-------------------
+ 1 file changed, 21 insertions(+), 20 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 75f613b..a805f96 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -187,9 +187,8 @@ static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
+ }
+ }
+
+-static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
+- int clock_source,
+- struct sh_mobile_lcdc_priv *priv)
++static int sh_mobile_lcdc_setup_clocks(struct sh_mobile_lcdc_priv *priv,
++ int clock_source)
+ {
+ struct clk *clk;
+ char *str;
+@@ -214,9 +213,9 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
+ if (str == NULL)
+ return 0;
+
+- clk = clk_get(&pdev->dev, str);
++ clk = clk_get(priv->dev, str);
+ if (IS_ERR(clk)) {
+- dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
++ dev_err(priv->dev, "cannot get dot clock %s\n", str);
+ return PTR_ERR(clk);
+ }
+
+@@ -1563,8 +1562,9 @@ static int __devinit sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *
+ return 0;
+ }
+
+-static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+- struct device *dev)
++static int __devinit
++sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
++ struct sh_mobile_lcdc_chan *ch)
+ {
+ struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg;
+ const struct fb_videomode *max_mode;
+@@ -1580,9 +1580,9 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ mutex_init(&ch->open_lock);
+
+ /* Allocate the frame buffer device. */
+- ch->info = framebuffer_alloc(0, dev);
++ ch->info = framebuffer_alloc(0, priv->dev);
+ if (!ch->info) {
+- dev_err(dev, "unable to allocate fb_info\n");
++ dev_err(priv->dev, "unable to allocate fb_info\n");
+ return -ENOMEM;
+ }
+
+@@ -1604,8 +1604,8 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ /* NV12/NV21 buffers must have even number of lines */
+ if ((cfg->fourcc == V4L2_PIX_FMT_NV12 ||
+ cfg->fourcc == V4L2_PIX_FMT_NV21) && (mode->yres & 0x1)) {
+- dev_err(dev, "yres must be multiple of 2 for YCbCr420 "
+- "mode.\n");
++ dev_err(priv->dev, "yres must be multiple of 2 for "
++ "YCbCr420 mode.\n");
+ return -EINVAL;
+ }
+
+@@ -1618,7 +1618,7 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ if (!max_size)
+ max_size = MAX_XRES * MAX_YRES;
+ else
+- dev_dbg(dev, "Found largest videomode %ux%u\n",
++ dev_dbg(priv->dev, "Found largest videomode %ux%u\n",
+ max_mode->xres, max_mode->yres);
+
+ /* Create the mode list. */
+@@ -1669,16 +1669,17 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ max_size = max_size * var->bits_per_pixel / 8 * 2;
+
+ /* Allocate frame buffer memory and color map. */
+- buf = dma_alloc_coherent(dev, max_size, &ch->dma_handle, GFP_KERNEL);
++ buf = dma_alloc_coherent(priv->dev, max_size, &ch->dma_handle,
++ GFP_KERNEL);
+ if (!buf) {
+- dev_err(dev, "unable to allocate buffer\n");
++ dev_err(priv->dev, "unable to allocate buffer\n");
+ return -ENOMEM;
+ }
+
+ ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
+ if (ret < 0) {
+- dev_err(dev, "unable to allocate cmap\n");
+- dma_free_coherent(dev, max_size, buf, ch->dma_handle);
++ dev_err(priv->dev, "unable to allocate cmap\n");
++ dma_free_coherent(priv->dev, max_size, buf, ch->dma_handle);
+ return ret;
+ }
+
+@@ -1701,7 +1702,7 @@ static int __devinit sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch,
+ }
+
+ info->screen_base = buf;
+- info->device = dev;
++ info->device = priv->dev;
+ ch->display_var = *var;
+
+ return 0;
+@@ -1795,7 +1796,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ if (!priv->base)
+ goto err1;
+
+- error = sh_mobile_lcdc_setup_clocks(pdev, pdata->clock_source, priv);
++ error = sh_mobile_lcdc_setup_clocks(priv, pdata->clock_source);
+ if (error) {
+ dev_err(&pdev->dev, "unable to setup clocks\n");
+ goto err1;
+@@ -1807,7 +1808,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ for (i = 0; i < num_channels; i++) {
+ struct sh_mobile_lcdc_chan *ch = priv->ch + i;
+
+- error = sh_mobile_lcdc_channel_init(ch, &pdev->dev);
++ error = sh_mobile_lcdc_channel_init(priv, ch);
+ if (error)
+ goto err1;
+ }
+@@ -1837,7 +1838,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ if (error < 0)
+ goto err1;
+
+- dev_info(info->dev, "registered %s/%s as %dx%d %dbpp.\n",
++ dev_info(&pdev->dev, "registered %s/%s as %dx%d %dbpp.\n",
+ pdev->name, (ch->cfg.chan == LCDC_CHAN_MAINLCD) ?
+ "mainlcd" : "sublcd", info->var.xres, info->var.yres,
+ info->var.bits_per_pixel);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0149-fbdev-sh_mobile_lcdc-Create-functions-to-turn-the-di.patch b/patches.armadillo800eva/0149-fbdev-sh_mobile_lcdc-Create-functions-to-turn-the-di.patch
new file mode 100644
index 00000000000000..302f8474653c16
--- /dev/null
+++ b/patches.armadillo800eva/0149-fbdev-sh_mobile_lcdc-Create-functions-to-turn-the-di.patch
@@ -0,0 +1,144 @@
+From b0d650961680a7480c79d5468b273cfdb494e7ed Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Fri, 9 Sep 2011 15:45:43 +0200
+Subject: fbdev: sh_mobile_lcdc: Create functions to turn the display on/off
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 37c5dcc21ddaa9f946c4d691996bb3076598b813)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 53 ++++++++++++++++++++------------------
+ 1 file changed, 28 insertions(+), 25 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index a805f96..bd725a4 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -224,7 +224,7 @@ static int sh_mobile_lcdc_setup_clocks(struct sh_mobile_lcdc_priv *priv,
+ }
+
+ /* -----------------------------------------------------------------------------
+- * Sys panel and deferred I/O
++ * Display, panel and deferred I/O
+ */
+
+ static void lcdc_sys_write_index(void *handle, unsigned long data)
+@@ -335,6 +335,27 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
+ schedule_delayed_work(&info->deferred_work, fbdefio->delay);
+ }
+
++static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
++{
++ struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
++
++ /* HDMI must be enabled before LCDC configuration */
++ if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
++ board_cfg->display_on(board_cfg->board_data, ch->info);
++ module_put(board_cfg->owner);
++ }
++}
++
++static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
++{
++ struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
++
++ if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
++ board_cfg->display_off(board_cfg->board_data);
++ module_put(board_cfg->owner);
++ }
++}
++
+ /* -----------------------------------------------------------------------------
+ * Format helpers
+ */
+@@ -648,7 +669,6 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ {
+ struct sh_mobile_meram_info *mdev = priv->meram_dev;
+- struct sh_mobile_lcdc_board_cfg *board_cfg;
+ struct sh_mobile_lcdc_chan *ch;
+ unsigned long tmp;
+ int ret;
+@@ -665,8 +685,9 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
+
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+- ch = &priv->ch[k];
++ struct sh_mobile_lcdc_board_cfg *board_cfg;
+
++ ch = &priv->ch[k];
+ if (!ch->enabled)
+ continue;
+
+@@ -754,11 +775,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ fb_deferred_io_init(ch->info);
+ }
+
+- board_cfg = &ch->cfg.board_cfg;
+- if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
+- board_cfg->display_on(board_cfg->board_data, ch->info);
+- module_put(board_cfg->owner);
+- }
++ sh_mobile_lcdc_display_on(ch);
+
+ if (ch->bl) {
+ ch->bl->props.power = FB_BLANK_UNBLANK;
+@@ -772,7 +789,6 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
+ {
+ struct sh_mobile_lcdc_chan *ch;
+- struct sh_mobile_lcdc_board_cfg *board_cfg;
+ int k;
+
+ /* clean up deferred io and ask board code to disable panel */
+@@ -799,11 +815,7 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
+ backlight_update_status(ch->bl);
+ }
+
+- board_cfg = &ch->cfg.board_cfg;
+- if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
+- board_cfg->display_off(board_cfg->board_data);
+- module_put(board_cfg->owner);
+- }
++ sh_mobile_lcdc_display_off(ch);
+
+ /* disable the meram */
+ if (ch->meram_enabled) {
+@@ -1417,7 +1429,6 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
+ struct fb_event *event = data;
+ struct fb_info *info = event->info;
+ struct sh_mobile_lcdc_chan *ch = info->par;
+- struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
+
+ if (&ch->lcdc->notifier != nb)
+ return NOTIFY_DONE;
+@@ -1427,10 +1438,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
+
+ switch(action) {
+ case FB_EVENT_SUSPEND:
+- if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
+- board_cfg->display_off(board_cfg->board_data);
+- module_put(board_cfg->owner);
+- }
++ sh_mobile_lcdc_display_off(ch);
+ sh_mobile_lcdc_stop(ch->lcdc);
+ break;
+ case FB_EVENT_RESUME:
+@@ -1438,12 +1446,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
+ sh_mobile_fb_reconfig(info);
+ mutex_unlock(&ch->open_lock);
+
+- /* HDMI must be enabled before LCDC configuration */
+- if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
+- board_cfg->display_on(board_cfg->board_data, info);
+- module_put(board_cfg->owner);
+- }
+-
++ sh_mobile_lcdc_display_on(ch);
+ sh_mobile_lcdc_start(ch->lcdc);
+ }
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0150-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-channel-in-no.patch b/patches.armadillo800eva/0150-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-channel-in-no.patch
new file mode 100644
index 00000000000000..89450cbc1a093d
--- /dev/null
+++ b/patches.armadillo800eva/0150-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-channel-in-no.patch
@@ -0,0 +1,47 @@
+From 20719471f5f65096346f478923583334bd56998d Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Thu, 24 Nov 2011 11:53:47 +0100
+Subject: fbdev: sh_mobile_hdmi: Don't access LCDC channel in notifier
+ callback
+
+Instead of relying on info->par being a pointer to an LCDC channel, cast
+the notifier block pointer to an sh_hdmi pointer.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 12ee2502c0503c484a7df052d356e39c40b02400)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_hdmi.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index 647ba98..a77bbc3 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -225,6 +225,8 @@ struct sh_hdmi {
+ struct notifier_block notifier;
+ };
+
++#define notifier_to_hdmi(n) container_of(n, struct sh_hdmi, notifier)
++
+ static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg)
+ {
+ iowrite8(data, hdmi->base + reg);
+@@ -1204,11 +1206,9 @@ static int sh_hdmi_notify(struct notifier_block *nb,
+ {
+ struct fb_event *event = data;
+ struct fb_info *info = event->info;
+- struct sh_mobile_lcdc_chan *ch = info->par;
+- struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
+- struct sh_hdmi *hdmi = board_cfg->board_data;
++ struct sh_hdmi *hdmi = notifier_to_hdmi(nb);
+
+- if (!hdmi || nb != &hdmi->notifier || hdmi->info != info)
++ if (hdmi->info != info)
+ return NOTIFY_DONE;
+
+ switch(action) {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0151-sh_mobile_hdmi-Remove-platform-data-lcd_dev-field.patch b/patches.armadillo800eva/0151-sh_mobile_hdmi-Remove-platform-data-lcd_dev-field.patch
new file mode 100644
index 00000000000000..d3319220fe4a2e
--- /dev/null
+++ b/patches.armadillo800eva/0151-sh_mobile_hdmi-Remove-platform-data-lcd_dev-field.patch
@@ -0,0 +1,112 @@
+From 84d3c145adf7360dd17cd51b1747f7225064101d Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Fri, 9 Sep 2011 16:08:02 +0200
+Subject: sh_mobile_hdmi: Remove platform data lcd_dev field
+
+The field is used to print debug messages only. Remove it.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 134d22eb58b72c4fe5e6ca3ebcaccd4975f06842)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ap4evb.c | 1 -
+ arch/arm/mach-shmobile/board-mackerel.c | 1 -
+ drivers/video/sh_mobile_hdmi.c | 17 +++++------------
+ include/video/sh_mobile_hdmi.h | 1 -
+ 4 files changed, 5 insertions(+), 15 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
+index 305dcd7..5330b68 100644
+--- a/arch/arm/mach-shmobile/board-ap4evb.c
++++ b/arch/arm/mach-shmobile/board-ap4evb.c
+@@ -823,7 +823,6 @@ static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
+
+ static struct sh_mobile_hdmi_info hdmi_info = {
+ .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
+- .lcd_dev = &lcdc1_device.dev,
+ .flags = HDMI_SND_SRC_SPDIF,
+ .clk_optimize_parent = ap4evb_clk_optimize,
+ };
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 28d98da..45a608b 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -484,7 +484,6 @@ static struct platform_device hdmi_lcdc_device = {
+
+ static struct sh_mobile_hdmi_info hdmi_info = {
+ .lcd_chan = &hdmi_lcdc_info.ch[0],
+- .lcd_dev = &hdmi_lcdc_device.dev,
+ .flags = HDMI_SND_SRC_SPDIF,
+ };
+
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index a77bbc3..ebd0651 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -1008,11 +1008,9 @@ static void sh_hdmi_display_on(void *arg, struct fb_info *info)
+ * FB_EVENT_FB_UNBIND notify is also called with info->lock held
+ */
+ struct sh_hdmi *hdmi = arg;
+- struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
+ struct sh_mobile_lcdc_chan *ch = info->par;
+
+- dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__,
+- pdata->lcd_dev, info->state);
++ dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state);
+
+ /* No need to lock */
+ hdmi->info = info;
+@@ -1040,9 +1038,8 @@ static void sh_hdmi_display_on(void *arg, struct fb_info *info)
+ static void sh_hdmi_display_off(void *arg)
+ {
+ struct sh_hdmi *hdmi = arg;
+- struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
+
+- dev_dbg(hdmi->dev, "%s(%p)\n", __func__, pdata->lcd_dev);
++ dev_dbg(hdmi->dev, "%s(%p)\n", __func__, hdmi);
+ /* PS mode e->a */
+ hdmi_write(hdmi, 0x10, HDMI_SYSTEM_CTRL);
+ }
+@@ -1114,15 +1111,11 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ {
+ struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work);
+ struct fb_info *info;
+- struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
+ struct sh_mobile_lcdc_chan *ch;
+ int ret;
+
+- dev_dbg(hdmi->dev, "%s(%p): begin, hotplug status %d\n", __func__,
+- pdata->lcd_dev, hdmi->hp_state);
+-
+- if (!pdata->lcd_dev)
+- return;
++ dev_dbg(hdmi->dev, "%s(%p): begin, hotplug status %d\n", __func__, hdmi,
++ hdmi->hp_state);
+
+ mutex_lock(&hdmi->mutex);
+
+@@ -1198,7 +1191,7 @@ out:
+ hdmi->hp_state = HDMI_HOTPLUG_DISCONNECTED;
+ mutex_unlock(&hdmi->mutex);
+
+- dev_dbg(hdmi->dev, "%s(%p): end\n", __func__, pdata->lcd_dev);
++ dev_dbg(hdmi->dev, "%s(%p): end\n", __func__, hdmi);
+ }
+
+ static int sh_hdmi_notify(struct notifier_block *nb,
+diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h
+index b569329..0b8d2cf 100644
+--- a/include/video/sh_mobile_hdmi.h
++++ b/include/video/sh_mobile_hdmi.h
+@@ -32,7 +32,6 @@ struct clk;
+
+ struct sh_mobile_hdmi_info {
+ struct sh_mobile_lcdc_chan_cfg *lcd_chan;
+- struct device *lcd_dev;
+ unsigned int flags;
+ long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq,
+ unsigned long *parent_freq);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0152-fbdev-sh_mobile_lcdc-Add-sh_mobile_lcdc_entity-defin.patch b/patches.armadillo800eva/0152-fbdev-sh_mobile_lcdc-Add-sh_mobile_lcdc_entity-defin.patch
new file mode 100644
index 00000000000000..aec56ab5aeeb63
--- /dev/null
+++ b/patches.armadillo800eva/0152-fbdev-sh_mobile_lcdc-Add-sh_mobile_lcdc_entity-defin.patch
@@ -0,0 +1,49 @@
+From b9adc06ac68d46790bb530b0f5b2fb606b2915fa Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 18:15:36 +0200
+Subject: fbdev: sh_mobile_lcdc: Add sh_mobile_lcdc_entity definition
+
+The sh_mobile_lcdc_entity structure will be used to abstract operations
+performed by transceivers (such as MIPI/DSI and HDMI).
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit d2ccdc807baa38a6487a25099c939a82f4698953)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.h | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index a58a0f3..d79e5aa 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -14,9 +14,23 @@ enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,
+
+ #define PALETTE_NR 16
+
+-struct sh_mobile_lcdc_priv;
+-struct fb_info;
+ struct backlight_device;
++struct fb_info;
++struct module;
++struct sh_mobile_lcdc_entity;
++struct sh_mobile_lcdc_priv;
++
++struct sh_mobile_lcdc_entity_ops {
++ /* Display */
++ int (*display_on)(struct sh_mobile_lcdc_entity *entity,
++ struct fb_info *info);
++ void (*display_off)(struct sh_mobile_lcdc_entity *entity);
++};
++
++struct sh_mobile_lcdc_entity {
++ struct module *owner;
++ const struct sh_mobile_lcdc_entity_ops *ops;
++};
+
+ /*
+ * struct sh_mobile_lcdc_chan - LCDC display channel
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0153-fbdev-sh_mobile_hdmi-Implement-sh_mobile_lcdc_entity.patch b/patches.armadillo800eva/0153-fbdev-sh_mobile_hdmi-Implement-sh_mobile_lcdc_entity.patch
new file mode 100644
index 00000000000000..9bc856abe8b103
--- /dev/null
+++ b/patches.armadillo800eva/0153-fbdev-sh_mobile_hdmi-Implement-sh_mobile_lcdc_entity.patch
@@ -0,0 +1,134 @@
+From 8e8ced18a284a9ce45e5e3d9e696127119bd07a6 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 18:27:50 +0200
+Subject: fbdev: sh_mobile_hdmi: Implement sh_mobile_lcdc_entity interface
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 8511ea4ad39e351767167280b0b0ac716a8f2986)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_hdmi.c | 39 +++++++++++++++++++++++++++++++--------
+ 1 file changed, 31 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index ebd0651..5e5f83c 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -208,6 +208,8 @@ enum hotplug_state {
+ };
+
+ struct sh_hdmi {
++ struct sh_mobile_lcdc_entity entity;
++
+ void __iomem *base;
+ enum hotplug_state hp_state; /* hot-plug status */
+ u8 preprogrammed_vic; /* use a pre-programmed VIC or
+@@ -225,6 +227,7 @@ struct sh_hdmi {
+ struct notifier_block notifier;
+ };
+
++#define entity_to_sh_hdmi(e) container_of(e, struct sh_hdmi, entity)
+ #define notifier_to_hdmi(n) container_of(n, struct sh_hdmi, notifier)
+
+ static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg)
+@@ -1001,13 +1004,14 @@ static irqreturn_t sh_hdmi_hotplug(int irq, void *dev_id)
+ }
+
+ /* locking: called with info->lock held, or before register_framebuffer() */
+-static void sh_hdmi_display_on(void *arg, struct fb_info *info)
++static int __sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
++ struct fb_info *info)
+ {
+ /*
+ * info is guaranteed to be valid, when we are called, because our
+ * FB_EVENT_FB_UNBIND notify is also called with info->lock held
+ */
+- struct sh_hdmi *hdmi = arg;
++ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
+ struct sh_mobile_lcdc_chan *ch = info->par;
+
+ dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state);
+@@ -1032,18 +1036,35 @@ static void sh_hdmi_display_on(void *arg, struct fb_info *info)
+ default:
+ hdmi->var = ch->display_var;
+ }
++
++ return 0;
++}
++
++static void sh_hdmi_display_on(void *arg, struct fb_info *info)
++{
++ __sh_hdmi_display_on(arg, info);
+ }
+
+ /* locking: called with info->lock held */
+-static void sh_hdmi_display_off(void *arg)
++static void __sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
+ {
+- struct sh_hdmi *hdmi = arg;
++ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
+
+ dev_dbg(hdmi->dev, "%s(%p)\n", __func__, hdmi);
+ /* PS mode e->a */
+ hdmi_write(hdmi, 0x10, HDMI_SYSTEM_CTRL);
+ }
+
++static void sh_hdmi_display_off(void *arg)
++{
++ __sh_hdmi_display_off(arg);
++}
++
++static const struct sh_mobile_lcdc_entity_ops sh_hdmi_ops = {
++ .display_on = __sh_hdmi_display_on,
++ .display_off = __sh_hdmi_display_off,
++};
++
+ static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi)
+ {
+ struct fb_info *info = hdmi->info;
+@@ -1157,7 +1178,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ */
+ info->var.width = hdmi->var.width;
+ info->var.height = hdmi->var.height;
+- sh_hdmi_display_on(hdmi, info);
++ __sh_hdmi_display_on(&hdmi->entity, info);
+ } else {
+ /* New monitor or have to wake up */
+ fb_set_suspend(info, 0);
+@@ -1251,6 +1272,8 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
+ mutex_init(&hdmi->mutex);
+
+ hdmi->dev = &pdev->dev;
++ hdmi->entity.owner = THIS_MODULE;
++ hdmi->entity.ops = &sh_hdmi_ops;
+
+ hdmi->hdmi_clk = clk_get(&pdev->dev, "ick");
+ if (IS_ERR(hdmi->hdmi_clk)) {
+@@ -1290,12 +1313,12 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
+ goto emap;
+ }
+
+- platform_set_drvdata(pdev, hdmi);
++ platform_set_drvdata(pdev, &hdmi->entity);
+
+ /* Set up LCDC callbacks */
+ board_cfg = &pdata->lcd_chan->board_cfg;
+ board_cfg->owner = THIS_MODULE;
+- board_cfg->board_data = hdmi;
++ board_cfg->board_data = &hdmi->entity;
+ board_cfg->display_on = sh_hdmi_display_on;
+ board_cfg->display_off = sh_hdmi_display_off;
+
+@@ -1349,7 +1372,7 @@ egetclk:
+ static int __exit sh_hdmi_remove(struct platform_device *pdev)
+ {
+ struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data;
+- struct sh_hdmi *hdmi = platform_get_drvdata(pdev);
++ struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev));
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ struct sh_mobile_lcdc_board_cfg *board_cfg = &pdata->lcd_chan->board_cfg;
+ int irq = platform_get_irq(pdev, 0);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0154-fbdev-sh_mipi_dsi-Implement-sh_mobile_lcdc_entity-in.patch b/patches.armadillo800eva/0154-fbdev-sh_mipi_dsi-Implement-sh_mobile_lcdc_entity-in.patch
new file mode 100644
index 00000000000000..92ed67242f56b8
--- /dev/null
+++ b/patches.armadillo800eva/0154-fbdev-sh_mipi_dsi-Implement-sh_mobile_lcdc_entity-in.patch
@@ -0,0 +1,173 @@
+From 1ed16de331bc8d40027b299ddeac6ab2f0d3b3be Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 18:27:50 +0200
+Subject: fbdev: sh_mipi_dsi: Implement sh_mobile_lcdc_entity interface
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 732bbcc46c31dea5bb6dd27de331d8767e9e8530)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 66 +++++++++++++++++++++++++++++++++----------
+ 1 file changed, 51 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 05151b8..58744fe 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -24,6 +24,8 @@
+ #include <video/sh_mipi_dsi.h>
+ #include <video/sh_mobile_lcdc.h>
+
++#include "sh_mobile_lcdcfb.h"
++
+ #define SYSCTRL 0x0000
+ #define SYSCONF 0x0004
+ #define TIMSET 0x0008
+@@ -50,6 +52,8 @@
+ #define MAX_SH_MIPI_DSI 2
+
+ struct sh_mipi {
++ struct sh_mobile_lcdc_entity entity;
++
+ void __iomem *base;
+ void __iomem *linkbase;
+ struct clk *dsit_clk;
+@@ -60,6 +64,8 @@ struct sh_mipi {
+ void (*next_display_off)(void *board_data);
+ };
+
++#define to_sh_mipi(e) container_of(e, struct sh_mipi, entity)
++
+ static struct sh_mipi *mipi_dsi[MAX_SH_MIPI_DSI];
+
+ /* Protect the above array */
+@@ -120,7 +126,7 @@ static void sh_mipi_dsi_enable(struct sh_mipi *mipi, bool enable)
+
+ static void sh_mipi_shutdown(struct platform_device *pdev)
+ {
+- struct sh_mipi *mipi = platform_get_drvdata(pdev);
++ struct sh_mipi *mipi = to_sh_mipi(platform_get_drvdata(pdev));
+
+ sh_mipi_dsi_enable(mipi, false);
+ }
+@@ -392,9 +398,10 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ return 0;
+ }
+
+-static void mipi_display_on(void *arg, struct fb_info *info)
++static int __mipi_display_on(struct sh_mobile_lcdc_entity *entity,
++ struct fb_info *info)
+ {
+- struct sh_mipi *mipi = arg;
++ struct sh_mipi *mipi = to_sh_mipi(entity);
+ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+ int ret;
+
+@@ -410,24 +417,34 @@ static void mipi_display_on(void *arg, struct fb_info *info)
+
+ sh_mipi_dsi_enable(mipi, true);
+
+- if (mipi->next_display_on)
+- mipi->next_display_on(mipi->next_board_data, info);
+-
+- return;
++ return 0;
+
+ mipi_display_on_fail1:
+ pm_runtime_put_sync(&mipi->pdev->dev);
+ mipi_display_on_fail2:
+ pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
++
++ return ret;
+ }
+
+-static void mipi_display_off(void *arg)
++static void mipi_display_on(void *arg, struct fb_info *info)
+ {
+- struct sh_mipi *mipi = arg;
+- struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
++ struct sh_mobile_lcdc_entity *entity = arg;
++ struct sh_mipi *mipi = to_sh_mipi(entity);
++ int ret;
+
+- if (mipi->next_display_off)
+- mipi->next_display_off(mipi->next_board_data);
++ ret = __mipi_display_on(entity, info);
++ if (ret < 0)
++ return;
++
++ if (mipi->next_display_on)
++ mipi->next_display_on(mipi->next_board_data, info);
++}
++
++static void __mipi_display_off(struct sh_mobile_lcdc_entity *entity)
++{
++ struct sh_mipi *mipi = to_sh_mipi(entity);
++ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+
+ sh_mipi_dsi_enable(mipi, false);
+
+@@ -436,6 +453,22 @@ static void mipi_display_off(void *arg)
+ pm_runtime_put_sync(&mipi->pdev->dev);
+ }
+
++static void mipi_display_off(void *arg)
++{
++ struct sh_mobile_lcdc_entity *entity = arg;
++ struct sh_mipi *mipi = to_sh_mipi(entity);
++
++ if (mipi->next_display_off)
++ mipi->next_display_off(mipi->next_board_data);
++
++ __mipi_display_off(entity);
++}
++
++static const struct sh_mobile_lcdc_entity_ops mipi_ops = {
++ .display_on = __mipi_display_on,
++ .display_off = __mipi_display_off,
++};
++
+ static int __init sh_mipi_probe(struct platform_device *pdev)
+ {
+ struct sh_mipi *mipi;
+@@ -467,6 +500,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ goto ealloc;
+ }
+
++ mipi->entity.owner = THIS_MODULE;
++ mipi->entity.ops = &mipi_ops;
++
+ if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
+ dev_err(&pdev->dev, "MIPI register region already claimed\n");
+ ret = -EBUSY;
+@@ -521,7 +557,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ pm_runtime_resume(&pdev->dev);
+
+ mutex_unlock(&array_lock);
+- platform_set_drvdata(pdev, mipi);
++ platform_set_drvdata(pdev, &mipi->entity);
+
+ /* Save original LCDC callbacks */
+ mipi->next_board_data = pdata->lcd_chan->board_cfg.board_data;
+@@ -529,7 +565,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ mipi->next_display_off = pdata->lcd_chan->board_cfg.display_off;
+
+ /* Set up LCDC callbacks */
+- pdata->lcd_chan->board_cfg.board_data = mipi;
++ pdata->lcd_chan->board_cfg.board_data = &mipi->entity;
+ pdata->lcd_chan->board_cfg.display_on = mipi_display_on;
+ pdata->lcd_chan->board_cfg.display_off = mipi_display_off;
+ pdata->lcd_chan->board_cfg.owner = THIS_MODULE;
+@@ -561,7 +597,7 @@ static int __exit sh_mipi_remove(struct platform_device *pdev)
+ struct sh_mipi_dsi_info *pdata = pdev->dev.platform_data;
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+- struct sh_mipi *mipi = platform_get_drvdata(pdev);
++ struct sh_mipi *mipi = to_sh_mipi(platform_get_drvdata(pdev));
+ int i, ret;
+
+ mutex_lock(&array_lock);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0155-fbdev-sh_mobile_lcdc-Handle-HDMI-MIPI-transmitter-de.patch b/patches.armadillo800eva/0155-fbdev-sh_mobile_lcdc-Handle-HDMI-MIPI-transmitter-de.patch
new file mode 100644
index 00000000000000..883a0c33de5380
--- /dev/null
+++ b/patches.armadillo800eva/0155-fbdev-sh_mobile_lcdc-Handle-HDMI-MIPI-transmitter-de.patch
@@ -0,0 +1,118 @@
+From c9a39a89bc6d2b75c156f057fa8316ff11f46435 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 22:59:04 +0200
+Subject: fbdev: sh_mobile_lcdc: Handle HDMI/MIPI transmitter device directly
+
+Pass a pointer to the transmitter device through platform data, retrieve
+the corresponding sh_mobile_lcdc_entity structure in the probe method
+and call the transmitter display_on/off methods directly.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 9a2985e7f943678154f5761dad753f1987c2fdd0)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 31 ++++++++++++++++++++++++++-----
+ drivers/video/sh_mobile_lcdcfb.h | 2 ++
+ include/video/sh_mobile_lcdc.h | 2 ++
+ 3 files changed, 30 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index bd725a4..a2e0903 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -339,6 +339,11 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+ {
+ struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
+
++ if (ch->tx_dev) {
++ if (ch->tx_dev->ops->display_on(ch->tx_dev, ch->info) < 0)
++ return;
++ }
++
+ /* HDMI must be enabled before LCDC configuration */
+ if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
+ board_cfg->display_on(board_cfg->board_data, ch->info);
+@@ -354,6 +359,9 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
+ board_cfg->display_off(board_cfg->board_data);
+ module_put(board_cfg->owner);
+ }
++
++ if (ch->tx_dev)
++ ch->tx_dev->ops->display_off(ch->tx_dev);
+ }
+
+ /* -----------------------------------------------------------------------------
+@@ -1490,18 +1498,21 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+ sh_mobile_lcdc_stop(priv);
+
+ for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
+- info = priv->ch[i].info;
++ struct sh_mobile_lcdc_chan *ch = &priv->ch[i];
+
++ info = ch->info;
+ if (!info || !info->device)
+ continue;
+
+- if (priv->ch[i].sglist)
+- vfree(priv->ch[i].sglist);
++ if (ch->tx_dev)
++ module_put(ch->cfg.tx_dev->dev.driver->owner);
++
++ if (ch->sglist)
++ vfree(ch->sglist);
+
+ if (info->screen_base)
+ dma_free_coherent(&pdev->dev, info->fix.smem_len,
+- info->screen_base,
+- priv->ch[i].dma_handle);
++ info->screen_base, ch->dma_handle);
+ fb_dealloc_cmap(&info->cmap);
+ framebuffer_release(info);
+ }
+@@ -1595,6 +1606,16 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ info->pseudo_palette = &ch->pseudo_palette;
+ info->flags = FBINFO_FLAG_DEFAULT;
+
++ if (cfg->tx_dev) {
++ if (!cfg->tx_dev->dev.driver ||
++ !try_module_get(cfg->tx_dev->dev.driver->owner)) {
++ dev_warn(priv->dev,
++ "unable to get transmitter device\n");
++ return -EINVAL;
++ }
++ ch->tx_dev = platform_get_drvdata(cfg->tx_dev);
++ }
++
+ /* Iterate through the modes to validate them and find the highest
+ * resolution.
+ */
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index d79e5aa..9601b92 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -41,6 +41,8 @@ struct sh_mobile_lcdc_entity {
+ */
+ struct sh_mobile_lcdc_chan {
+ struct sh_mobile_lcdc_priv *lcdc;
++ struct sh_mobile_lcdc_entity *tx_dev;
++
+ unsigned long *reg_offs;
+ unsigned long ldmt1r_value;
+ unsigned long enabled; /* ME and SE in LDCNT2R */
+diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
+index fe30b75..3681cf6 100644
+--- a/include/video/sh_mobile_lcdc.h
++++ b/include/video/sh_mobile_lcdc.h
+@@ -186,6 +186,8 @@ struct sh_mobile_lcdc_chan_cfg {
+ struct sh_mobile_lcdc_bl_info bl_info;
+ struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
+ struct sh_mobile_meram_cfg *meram_cfg;
++
++ struct platform_device *tx_dev; /* HDMI/DSI transmitter device */
+ };
+
+ struct sh_mobile_lcdc_info {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0156-fbdev-sh_mipi_dsi-Don-t-hook-up-into-board_cfg-displ.patch b/patches.armadillo800eva/0156-fbdev-sh_mipi_dsi-Don-t-hook-up-into-board_cfg-displ.patch
new file mode 100644
index 00000000000000..e16e66d29dbf64
--- /dev/null
+++ b/patches.armadillo800eva/0156-fbdev-sh_mipi_dsi-Don-t-hook-up-into-board_cfg-displ.patch
@@ -0,0 +1,129 @@
+From b287fffd8e9c2a4931c1b7ec3464f7b25cf68505 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 18:27:50 +0200
+Subject: fbdev: sh_mipi_dsi: Don't hook up into board_cfg display operations
+
+The display_on/off operations are now accessed through the
+sh_mobile_lcdc_entity operations.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit d2c594a014563175b54115d1a73b607aaeb650ec)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 56 ++++---------------------------------------
+ 1 file changed, 5 insertions(+), 51 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 58744fe..ad09a05 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -58,10 +58,6 @@ struct sh_mipi {
+ void __iomem *linkbase;
+ struct clk *dsit_clk;
+ struct platform_device *pdev;
+-
+- void *next_board_data;
+- void (*next_display_on)(void *board_data, struct fb_info *info);
+- void (*next_display_off)(void *board_data);
+ };
+
+ #define to_sh_mipi(e) container_of(e, struct sh_mipi, entity)
+@@ -398,8 +394,8 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ return 0;
+ }
+
+-static int __mipi_display_on(struct sh_mobile_lcdc_entity *entity,
+- struct fb_info *info)
++static int mipi_display_on(struct sh_mobile_lcdc_entity *entity,
++ struct fb_info *info)
+ {
+ struct sh_mipi *mipi = to_sh_mipi(entity);
+ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+@@ -427,21 +423,7 @@ mipi_display_on_fail2:
+ return ret;
+ }
+
+-static void mipi_display_on(void *arg, struct fb_info *info)
+-{
+- struct sh_mobile_lcdc_entity *entity = arg;
+- struct sh_mipi *mipi = to_sh_mipi(entity);
+- int ret;
+-
+- ret = __mipi_display_on(entity, info);
+- if (ret < 0)
+- return;
+-
+- if (mipi->next_display_on)
+- mipi->next_display_on(mipi->next_board_data, info);
+-}
+-
+-static void __mipi_display_off(struct sh_mobile_lcdc_entity *entity)
++static void mipi_display_off(struct sh_mobile_lcdc_entity *entity)
+ {
+ struct sh_mipi *mipi = to_sh_mipi(entity);
+ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+@@ -453,20 +435,9 @@ static void __mipi_display_off(struct sh_mobile_lcdc_entity *entity)
+ pm_runtime_put_sync(&mipi->pdev->dev);
+ }
+
+-static void mipi_display_off(void *arg)
+-{
+- struct sh_mobile_lcdc_entity *entity = arg;
+- struct sh_mipi *mipi = to_sh_mipi(entity);
+-
+- if (mipi->next_display_off)
+- mipi->next_display_off(mipi->next_board_data);
+-
+- __mipi_display_off(entity);
+-}
+-
+ static const struct sh_mobile_lcdc_entity_ops mipi_ops = {
+- .display_on = __mipi_display_on,
+- .display_off = __mipi_display_off,
++ .display_on = mipi_display_on,
++ .display_off = mipi_display_off,
+ };
+
+ static int __init sh_mipi_probe(struct platform_device *pdev)
+@@ -559,17 +530,6 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
+ mutex_unlock(&array_lock);
+ platform_set_drvdata(pdev, &mipi->entity);
+
+- /* Save original LCDC callbacks */
+- mipi->next_board_data = pdata->lcd_chan->board_cfg.board_data;
+- mipi->next_display_on = pdata->lcd_chan->board_cfg.display_on;
+- mipi->next_display_off = pdata->lcd_chan->board_cfg.display_off;
+-
+- /* Set up LCDC callbacks */
+- pdata->lcd_chan->board_cfg.board_data = &mipi->entity;
+- pdata->lcd_chan->board_cfg.display_on = mipi_display_on;
+- pdata->lcd_chan->board_cfg.display_off = mipi_display_off;
+- pdata->lcd_chan->board_cfg.owner = THIS_MODULE;
+-
+ return 0;
+
+ eclkton:
+@@ -594,7 +554,6 @@ efindslot:
+
+ static int __exit sh_mipi_remove(struct platform_device *pdev)
+ {
+- struct sh_mipi_dsi_info *pdata = pdev->dev.platform_data;
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ struct sh_mipi *mipi = to_sh_mipi(platform_get_drvdata(pdev));
+@@ -617,11 +576,6 @@ static int __exit sh_mipi_remove(struct platform_device *pdev)
+ if (ret < 0)
+ return ret;
+
+- pdata->lcd_chan->board_cfg.owner = NULL;
+- pdata->lcd_chan->board_cfg.display_on = NULL;
+- pdata->lcd_chan->board_cfg.display_off = NULL;
+- pdata->lcd_chan->board_cfg.board_data = NULL;
+-
+ pm_runtime_disable(&pdev->dev);
+ clk_disable(mipi->dsit_clk);
+ clk_put(mipi->dsit_clk);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0157-fbdev-sh_mobile_hdmi-Don-t-hook-up-into-board_cfg-di.patch b/patches.armadillo800eva/0157-fbdev-sh_mobile_hdmi-Don-t-hook-up-into-board_cfg-di.patch
new file mode 100644
index 00000000000000..67159884dac06e
--- /dev/null
+++ b/patches.armadillo800eva/0157-fbdev-sh_mobile_hdmi-Don-t-hook-up-into-board_cfg-di.patch
@@ -0,0 +1,120 @@
+From 02296809ddb7264f9480319cc0ed1114f7e87fe3 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 18:27:50 +0200
+Subject: fbdev: sh_mobile_hdmi: Don't hook up into board_cfg display
+ operations
+
+The display_on/off operations are now accessed through the
+sh_mobile_lcdc_entity operations.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit db85905ad95b090941dc894b7f93f9f3818bdc07)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_hdmi.c | 37 ++++++-------------------------------
+ 1 file changed, 6 insertions(+), 31 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index 5e5f83c..3f4e4a4 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -1004,8 +1004,8 @@ static irqreturn_t sh_hdmi_hotplug(int irq, void *dev_id)
+ }
+
+ /* locking: called with info->lock held, or before register_framebuffer() */
+-static int __sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
+- struct fb_info *info)
++static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
++ struct fb_info *info)
+ {
+ /*
+ * info is guaranteed to be valid, when we are called, because our
+@@ -1040,13 +1040,8 @@ static int __sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
+ return 0;
+ }
+
+-static void sh_hdmi_display_on(void *arg, struct fb_info *info)
+-{
+- __sh_hdmi_display_on(arg, info);
+-}
+-
+ /* locking: called with info->lock held */
+-static void __sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
++static void sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
+ {
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
+
+@@ -1055,14 +1050,9 @@ static void __sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
+ hdmi_write(hdmi, 0x10, HDMI_SYSTEM_CTRL);
+ }
+
+-static void sh_hdmi_display_off(void *arg)
+-{
+- __sh_hdmi_display_off(arg);
+-}
+-
+ static const struct sh_mobile_lcdc_entity_ops sh_hdmi_ops = {
+- .display_on = __sh_hdmi_display_on,
+- .display_off = __sh_hdmi_display_off,
++ .display_on = sh_hdmi_display_on,
++ .display_off = sh_hdmi_display_off,
+ };
+
+ static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi)
+@@ -1178,7 +1168,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ */
+ info->var.width = hdmi->var.width;
+ info->var.height = hdmi->var.height;
+- __sh_hdmi_display_on(&hdmi->entity, info);
++ sh_hdmi_display_on(&hdmi->entity, info);
+ } else {
+ /* New monitor or have to wake up */
+ fb_set_suspend(info, 0);
+@@ -1255,7 +1245,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
+ {
+ struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data;
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- struct sh_mobile_lcdc_board_cfg *board_cfg;
+ int irq = platform_get_irq(pdev, 0), ret;
+ struct sh_hdmi *hdmi;
+ long rate;
+@@ -1315,13 +1304,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
+
+ platform_set_drvdata(pdev, &hdmi->entity);
+
+- /* Set up LCDC callbacks */
+- board_cfg = &pdata->lcd_chan->board_cfg;
+- board_cfg->owner = THIS_MODULE;
+- board_cfg->board_data = &hdmi->entity;
+- board_cfg->display_on = sh_hdmi_display_on;
+- board_cfg->display_off = sh_hdmi_display_off;
+-
+ INIT_DELAYED_WORK(&hdmi->edid_work, sh_hdmi_edid_work_fn);
+
+ pm_runtime_enable(&pdev->dev);
+@@ -1371,21 +1353,14 @@ egetclk:
+
+ static int __exit sh_hdmi_remove(struct platform_device *pdev)
+ {
+- struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data;
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(platform_get_drvdata(pdev));
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- struct sh_mobile_lcdc_board_cfg *board_cfg = &pdata->lcd_chan->board_cfg;
+ int irq = platform_get_irq(pdev, 0);
+
+ snd_soc_unregister_codec(&pdev->dev);
+
+ fb_unregister_client(&hdmi->notifier);
+
+- board_cfg->display_on = NULL;
+- board_cfg->display_off = NULL;
+- board_cfg->board_data = NULL;
+- board_cfg->owner = NULL;
+-
+ /* No new work will be scheduled, wait for running ISR */
+ free_irq(irq, hdmi);
+ /* Wait for already scheduled work */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0158-arm-mach-shmobile-Don-t-initialize-the-hdmi_info-lcd.patch b/patches.armadillo800eva/0158-arm-mach-shmobile-Don-t-initialize-the-hdmi_info-lcd.patch
new file mode 100644
index 00000000000000..12669b55dfc989
--- /dev/null
+++ b/patches.armadillo800eva/0158-arm-mach-shmobile-Don-t-initialize-the-hdmi_info-lcd.patch
@@ -0,0 +1,47 @@
+From 9e74e33fa2c40dc0db376afc44e3c865418fc4d5 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 23:30:45 +0200
+Subject: arm: mach-shmobile: Don't initialize the hdmi_info lcd_chan field
+
+The field is unused and will be removed. Don't initialize it.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit e2543c5ab299c67ddfb73a36eca4da6574259ab9)
+
+Conflicts:
+ arch/arm/mach-shmobile/board-ap4evb.c
+ arch/arm/mach-shmobile/board-mackerel.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ap4evb.c | 1 -
+ arch/arm/mach-shmobile/board-mackerel.c | 1 -
+ 2 files changed, 2 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
+index 5330b68..488bd13 100644
+--- a/arch/arm/mach-shmobile/board-ap4evb.c
++++ b/arch/arm/mach-shmobile/board-ap4evb.c
+@@ -822,7 +822,6 @@ static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
+
+
+ static struct sh_mobile_hdmi_info hdmi_info = {
+- .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
+ .flags = HDMI_SND_SRC_SPDIF,
+ .clk_optimize_parent = ap4evb_clk_optimize,
+ };
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 45a608b..42ad34e 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -483,7 +483,6 @@ static struct platform_device hdmi_lcdc_device = {
+ };
+
+ static struct sh_mobile_hdmi_info hdmi_info = {
+- .lcd_chan = &hdmi_lcdc_info.ch[0],
+ .flags = HDMI_SND_SRC_SPDIF,
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0159-fbdev-sh_mobile_hdmi-Remove-sh_mobile_hdmi_info-lcd_.patch b/patches.armadillo800eva/0159-fbdev-sh_mobile_hdmi-Remove-sh_mobile_hdmi_info-lcd_.patch
new file mode 100644
index 00000000000000..340c320ef8144a
--- /dev/null
+++ b/patches.armadillo800eva/0159-fbdev-sh_mobile_hdmi-Remove-sh_mobile_hdmi_info-lcd_.patch
@@ -0,0 +1,30 @@
+From 38b973cfee458255242f5d7ae5c6bd79033d3ed3 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 18:27:50 +0200
+Subject: fbdev: sh_mobile_hdmi: Remove sh_mobile_hdmi_info lcd_chan field
+
+The field is unused, remove it.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit ca0a0cd7986e1704d5c60be9ae096ba51b2084f7)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ include/video/sh_mobile_hdmi.h | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h
+index 0b8d2cf..728f9de 100644
+--- a/include/video/sh_mobile_hdmi.h
++++ b/include/video/sh_mobile_hdmi.h
+@@ -31,7 +31,6 @@ struct clk;
+ #define HDMI_SND_SRC_HBR (3 << 0)
+
+ struct sh_mobile_hdmi_info {
+- struct sh_mobile_lcdc_chan_cfg *lcd_chan;
+ unsigned int flags;
+ long (*clk_optimize_parent)(unsigned long target, unsigned long *best_freq,
+ unsigned long *parent_freq);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0160-fbdev-sh_mobile_lcdc-Remove-board-configuration-owne.patch b/patches.armadillo800eva/0160-fbdev-sh_mobile_lcdc-Remove-board-configuration-owne.patch
new file mode 100644
index 00000000000000..9857e74b4f0b57
--- /dev/null
+++ b/patches.armadillo800eva/0160-fbdev-sh_mobile_lcdc-Remove-board-configuration-owne.patch
@@ -0,0 +1,60 @@
+From 45096137bd1cda24dd66df4661078baab18f0c74 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 22:59:04 +0200
+Subject: fbdev: sh_mobile_lcdc: Remove board configuration owner field
+
+The field is unused, remove it.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit aa7b5b0b2db6d33a8104e411cb74c15a4983b286)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 8 ++------
+ include/video/sh_mobile_lcdc.h | 2 --
+ 2 files changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index a2e0903..a899b6d 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -345,20 +345,16 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+ }
+
+ /* HDMI must be enabled before LCDC configuration */
+- if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
++ if (board_cfg->display_on)
+ board_cfg->display_on(board_cfg->board_data, ch->info);
+- module_put(board_cfg->owner);
+- }
+ }
+
+ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
+ {
+ struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
+
+- if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
++ if (board_cfg->display_off)
+ board_cfg->display_off(board_cfg->board_data);
+- module_put(board_cfg->owner);
+- }
+
+ if (ch->tx_dev)
+ ch->tx_dev->ops->display_off(ch->tx_dev);
+diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
+index 3681cf6..163f4b7 100644
+--- a/include/video/sh_mobile_lcdc.h
++++ b/include/video/sh_mobile_lcdc.h
+@@ -147,9 +147,7 @@ struct sh_mobile_lcdc_sys_bus_ops {
+ unsigned long (*read_data)(void *handle);
+ };
+
+-struct module;
+ struct sh_mobile_lcdc_board_cfg {
+- struct module *owner;
+ void *board_data;
+ int (*setup_sys)(void *board_data, void *sys_ops_handle,
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0161-fbdev-sh_mobile_lcdc-Remove-board-configuration-boar.patch b/patches.armadillo800eva/0161-fbdev-sh_mobile_lcdc-Remove-board-configuration-boar.patch
new file mode 100644
index 00000000000000..7de62237dff607
--- /dev/null
+++ b/patches.armadillo800eva/0161-fbdev-sh_mobile_lcdc-Remove-board-configuration-boar.patch
@@ -0,0 +1,344 @@
+From 8e1b4a2c4460a50bcffcb5ab517330608a4d7e2e Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 22:59:04 +0200
+Subject: fbdev: sh_mobile_lcdc: Remove board configuration board_data field
+
+The field is unused, remove it. Update board code accordingly.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 018882aa66f5110478edc14e6c3fecc2b46ca0c0)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ag5evm.c | 14 ++------------
+ arch/arm/mach-shmobile/board-mackerel.c | 4 ++--
+ arch/sh/boards/mach-ap325rxa/setup.c | 8 ++++----
+ arch/sh/boards/mach-ecovec24/setup.c | 4 ++--
+ arch/sh/boards/mach-kfr2r09/lcd_wqvga.c | 10 ++++------
+ arch/sh/boards/mach-migor/lcd_qvga.c | 3 +--
+ arch/sh/boards/mach-se/7724/setup.c | 2 --
+ arch/sh/include/mach-kfr2r09/mach/kfr2r09.h | 16 ++++++++--------
+ arch/sh/include/mach-migor/mach/migor.h | 2 +-
+ drivers/video/sh_mobile_lcdcfb.c | 16 +++++++---------
+ include/video/sh_mobile_lcdc.h | 13 ++++++-------
+ 11 files changed, 37 insertions(+), 55 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
+index 14501ec..9865d97 100644
+--- a/arch/arm/mach-shmobile/board-ag5evm.c
++++ b/arch/arm/mach-shmobile/board-ag5evm.c
+@@ -236,16 +236,6 @@ static void lcd_backlight_reset(void)
+ gpio_set_value(GPIO_PORT235, 1);
+ }
+
+-static void lcd_on(void *board_data, struct fb_info *info)
+-{
+- lcd_backlight_on();
+-}
+-
+-static void lcd_off(void *board_data)
+-{
+- lcd_backlight_reset();
+-}
+-
+ /* LCDC0 */
+ static const struct fb_videomode lcdc0_modes[] = {
+ {
+@@ -275,8 +265,8 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
+ .lcd_cfg = lcdc0_modes,
+ .num_cfg = ARRAY_SIZE(lcdc0_modes),
+ .board_cfg = {
+- .display_on = lcd_on,
+- .display_off = lcd_off,
++ .display_on = lcd_backlight_on,
++ .display_off = lcd_backlight_reset,
+ },
+ }
+ };
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 42ad34e..7937c7a 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -355,14 +355,14 @@ static struct fb_videomode mackerel_lcdc_modes[] = {
+ },
+ };
+
+-static int mackerel_set_brightness(void *board_data, int brightness)
++static int mackerel_set_brightness(int brightness)
+ {
+ gpio_set_value(GPIO_PORT31, brightness);
+
+ return 0;
+ }
+
+-static int mackerel_get_brightness(void *board_data)
++static int mackerel_get_brightness(void)
+ {
+ return gpio_get_value(GPIO_PORT31);
+ }
+diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
+index 4fde884..ab632fc 100644
+--- a/arch/sh/boards/mach-ap325rxa/setup.c
++++ b/arch/sh/boards/mach-ap325rxa/setup.c
+@@ -157,7 +157,7 @@ static struct platform_device nand_flash_device = {
+ #define PORT_DRVCRA 0xA405018A
+ #define PORT_DRVCRB 0xA405018C
+
+-static int ap320_wvga_set_brightness(void *board_data, int brightness)
++static int ap320_wvga_set_brightness(int brightness)
+ {
+ if (brightness) {
+ gpio_set_value(GPIO_PTS3, 0);
+@@ -170,12 +170,12 @@ static int ap320_wvga_set_brightness(void *board_data, int brightness)
+ return 0;
+ }
+
+-static int ap320_wvga_get_brightness(void *board_data)
++static int ap320_wvga_get_brightness(void)
+ {
+ return gpio_get_value(GPIO_PTS3);
+ }
+
+-static void ap320_wvga_power_on(void *board_data, struct fb_info *info)
++static void ap320_wvga_power_on(void)
+ {
+ msleep(100);
+
+@@ -183,7 +183,7 @@ static void ap320_wvga_power_on(void *board_data, struct fb_info *info)
+ __raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG);
+ }
+
+-static void ap320_wvga_power_off(void *board_data)
++static void ap320_wvga_power_off(void)
+ {
+ /* ASD AP-320/325 LCD OFF */
+ __raw_writew(0, FPGA_LCDREG);
+diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
+index 67c2ee8..ccbc7d6 100644
+--- a/arch/sh/boards/mach-ecovec24/setup.c
++++ b/arch/sh/boards/mach-ecovec24/setup.c
+@@ -312,14 +312,14 @@ const static struct fb_videomode ecovec_dvi_modes[] = {
+ },
+ };
+
+-static int ecovec24_set_brightness(void *board_data, int brightness)
++static int ecovec24_set_brightness(int brightness)
+ {
+ gpio_set_value(GPIO_PTR1, brightness);
+
+ return 0;
+ }
+
+-static int ecovec24_get_brightness(void *board_data)
++static int ecovec24_get_brightness(void)
+ {
+ return gpio_get_value(GPIO_PTR1);
+ }
+diff --git a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
+index 25e145f..c148b36 100644
+--- a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
++++ b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
+@@ -251,8 +251,7 @@ static void display_on(void *sohandle,
+ write_memory_start(sohandle, so);
+ }
+
+-int kfr2r09_lcd_setup(void *board_data, void *sohandle,
+- struct sh_mobile_lcdc_sys_bus_ops *so)
++int kfr2r09_lcd_setup(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
+ {
+ /* power on */
+ gpio_set_value(GPIO_PTF4, 0); /* PROTECT/ -> L */
+@@ -273,8 +272,7 @@ int kfr2r09_lcd_setup(void *board_data, void *sohandle,
+ return 0;
+ }
+
+-void kfr2r09_lcd_start(void *board_data, void *sohandle,
+- struct sh_mobile_lcdc_sys_bus_ops *so)
++void kfr2r09_lcd_start(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
+ {
+ write_memory_start(sohandle, so);
+ }
+@@ -327,12 +325,12 @@ static int kfr2r09_lcd_backlight(int on)
+ return 0;
+ }
+
+-void kfr2r09_lcd_on(void *board_data, struct fb_info *info)
++void kfr2r09_lcd_on(void)
+ {
+ kfr2r09_lcd_backlight(1);
+ }
+
+-void kfr2r09_lcd_off(void *board_data)
++void kfr2r09_lcd_off(void)
+ {
+ kfr2r09_lcd_backlight(0);
+ }
+diff --git a/arch/sh/boards/mach-migor/lcd_qvga.c b/arch/sh/boards/mach-migor/lcd_qvga.c
+index de9014a..8bccd34 100644
+--- a/arch/sh/boards/mach-migor/lcd_qvga.c
++++ b/arch/sh/boards/mach-migor/lcd_qvga.c
+@@ -113,8 +113,7 @@ static const unsigned short magic3_data[] = {
+ 0x0010, 0x16B0, 0x0011, 0x0111, 0x0007, 0x0061,
+ };
+
+-int migor_lcd_qvga_setup(void *board_data, void *sohandle,
+- struct sh_mobile_lcdc_sys_bus_ops *so)
++int migor_lcd_qvga_setup(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
+ {
+ unsigned long xres = 320;
+ unsigned long yres = 240;
+diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
+index 65ff79d..93d53ec 100644
+--- a/arch/sh/boards/mach-se/7724/setup.c
++++ b/arch/sh/boards/mach-se/7724/setup.c
+@@ -186,8 +186,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .width = 152,
+ .height = 91,
+ },
+- .board_cfg = {
+- },
+ }
+ };
+
+diff --git a/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
+index 07e635b..ba3d93d 100644
+--- a/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
++++ b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
+@@ -4,21 +4,21 @@
+ #include <video/sh_mobile_lcdc.h>
+
+ #if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE)
+-void kfr2r09_lcd_on(void *board_data, struct fb_info *info);
+-void kfr2r09_lcd_off(void *board_data);
+-int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle,
++void kfr2r09_lcd_on(void);
++void kfr2r09_lcd_off(void);
++int kfr2r09_lcd_setup(void *sys_ops_handle,
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+-void kfr2r09_lcd_start(void *board_data, void *sys_ops_handle,
++void kfr2r09_lcd_start(void *sys_ops_handle,
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+ #else
+-static void kfr2r09_lcd_on(void *board_data) {}
+-static void kfr2r09_lcd_off(void *board_data) {}
+-static int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle,
++static void kfr2r09_lcd_on(void) {}
++static void kfr2r09_lcd_off(void) {}
++static int kfr2r09_lcd_setup(void *sys_ops_handle,
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
+ {
+ return -ENODEV;
+ }
+-static void kfr2r09_lcd_start(void *board_data, void *sys_ops_handle,
++static void kfr2r09_lcd_start(void *sys_ops_handle,
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
+ {
+ }
+diff --git a/arch/sh/include/mach-migor/mach/migor.h b/arch/sh/include/mach-migor/mach/migor.h
+index 42fccf9..7de7bb7 100644
+--- a/arch/sh/include/mach-migor/mach/migor.h
++++ b/arch/sh/include/mach-migor/mach/migor.h
+@@ -9,7 +9,7 @@
+
+ #include <video/sh_mobile_lcdc.h>
+
+-int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle,
++int migor_lcd_qvga_setup(void *sys_ops_handle,
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+
+ #endif /* __ASM_SH_MIGOR_H */
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index a899b6d..c54eb97 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -315,14 +315,12 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info,
+ /* trigger panel update */
+ dma_map_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
+ if (bcfg->start_transfer)
+- bcfg->start_transfer(bcfg->board_data, ch,
+- &sh_mobile_lcdc_sys_bus_ops);
++ bcfg->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
+ lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
+ dma_unmap_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
+ } else {
+ if (bcfg->start_transfer)
+- bcfg->start_transfer(bcfg->board_data, ch,
+- &sh_mobile_lcdc_sys_bus_ops);
++ bcfg->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
+ lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
+ }
+ }
+@@ -346,7 +344,7 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+
+ /* HDMI must be enabled before LCDC configuration */
+ if (board_cfg->display_on)
+- board_cfg->display_on(board_cfg->board_data, ch->info);
++ board_cfg->display_on();
+ }
+
+ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
+@@ -354,7 +352,7 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
+ struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
+
+ if (board_cfg->display_off)
+- board_cfg->display_off(board_cfg->board_data);
++ board_cfg->display_off();
+
+ if (ch->tx_dev)
+ ch->tx_dev->ops->display_off(ch->tx_dev);
+@@ -697,7 +695,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+
+ board_cfg = &ch->cfg.board_cfg;
+ if (board_cfg->setup_sys) {
+- ret = board_cfg->setup_sys(board_cfg->board_data, ch,
++ ret = board_cfg->setup_sys(ch,
+ &sh_mobile_lcdc_sys_bus_ops);
+ if (ret)
+ return ret;
+@@ -1326,7 +1324,7 @@ static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
+ bdev->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+ brightness = 0;
+
+- return cfg->set_brightness(cfg->board_data, brightness);
++ return cfg->set_brightness(brightness);
+ }
+
+ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
+@@ -1334,7 +1332,7 @@ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
+ struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
+ struct sh_mobile_lcdc_board_cfg *cfg = &ch->cfg.board_cfg;
+
+- return cfg->get_brightness(cfg->board_data);
++ return cfg->get_brightness();
+ }
+
+ static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev,
+diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
+index 163f4b7..62be2c9 100644
+--- a/include/video/sh_mobile_lcdc.h
++++ b/include/video/sh_mobile_lcdc.h
+@@ -148,15 +148,14 @@ struct sh_mobile_lcdc_sys_bus_ops {
+ };
+
+ struct sh_mobile_lcdc_board_cfg {
+- void *board_data;
+- int (*setup_sys)(void *board_data, void *sys_ops_handle,
++ int (*setup_sys)(void *sys_ops_handle,
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+- void (*start_transfer)(void *board_data, void *sys_ops_handle,
++ void (*start_transfer)(void *sys_ops_handle,
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+- void (*display_on)(void *board_data, struct fb_info *info);
+- void (*display_off)(void *board_data);
+- int (*set_brightness)(void *board_data, int brightness);
+- int (*get_brightness)(void *board_data);
++ void (*display_on)(void);
++ void (*display_off)(void);
++ int (*set_brightness)(int brightness);
++ int (*get_brightness)(void);
+ };
+
+ struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0162-fbdev-sh_mobile_lcdc-Move-brightness-ops-to-sh_mobil.patch b/patches.armadillo800eva/0162-fbdev-sh_mobile_lcdc-Move-brightness-ops-to-sh_mobil.patch
new file mode 100644
index 00000000000000..1527310125d9c1
--- /dev/null
+++ b/patches.armadillo800eva/0162-fbdev-sh_mobile_lcdc-Move-brightness-ops-to-sh_mobil.patch
@@ -0,0 +1,132 @@
+From 206dd980ded59158a5fc2108f69d4b63a0c0f94c Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 22:59:04 +0200
+Subject: fbdev: sh_mobile_lcdc: Move brightness ops to sh_mobile_lcdc_bl_info
+
+Update board code accordingly.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 43059b0f46f814b4152f327c701d079253904540)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-mackerel.c | 6 ++----
+ arch/sh/boards/mach-ap325rxa/setup.c | 4 ++--
+ arch/sh/boards/mach-ecovec24/setup.c | 6 ++----
+ drivers/video/sh_mobile_lcdcfb.c | 6 ++----
+ include/video/sh_mobile_lcdc.h | 4 ++--
+ 5 files changed, 10 insertions(+), 16 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 7937c7a..40d61de 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -395,13 +395,11 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .flags = 0,
+ .lcd_size_cfg.width = 152,
+ .lcd_size_cfg.height = 91,
+- .board_cfg = {
+- .set_brightness = mackerel_set_brightness,
+- .get_brightness = mackerel_get_brightness,
+- },
+ .bl_info = {
+ .name = "sh_mobile_lcdc_bl",
+ .max_brightness = 1,
++ .set_brightness = mackerel_set_brightness,
++ .get_brightness = mackerel_get_brightness,
+ },
+ .meram_cfg = &lcd_meram_cfg,
+ }
+diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
+index ab632fc..514968a 100644
+--- a/arch/sh/boards/mach-ap325rxa/setup.c
++++ b/arch/sh/boards/mach-ap325rxa/setup.c
+@@ -220,12 +220,12 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .board_cfg = {
+ .display_on = ap320_wvga_power_on,
+ .display_off = ap320_wvga_power_off,
+- .set_brightness = ap320_wvga_set_brightness,
+- .get_brightness = ap320_wvga_get_brightness,
+ },
+ .bl_info = {
+ .name = "sh_mobile_lcdc_bl",
+ .max_brightness = 1,
++ .set_brightness = ap320_wvga_set_brightness,
++ .get_brightness = ap320_wvga_get_brightness,
+ },
+ }
+ };
+diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
+index ccbc7d6..5c2b2fc 100644
+--- a/arch/sh/boards/mach-ecovec24/setup.c
++++ b/arch/sh/boards/mach-ecovec24/setup.c
+@@ -333,13 +333,11 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .width = 152,
+ .height = 91,
+ },
+- .board_cfg = {
+- .set_brightness = ecovec24_set_brightness,
+- .get_brightness = ecovec24_get_brightness,
+- },
+ .bl_info = {
+ .name = "sh_mobile_lcdc_bl",
+ .max_brightness = 1,
++ .set_brightness = ecovec24_set_brightness,
++ .get_brightness = ecovec24_get_brightness,
+ },
+ }
+ };
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index c54eb97..adfffd6 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1317,22 +1317,20 @@ static struct fb_ops sh_mobile_lcdc_ops = {
+ static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
+ {
+ struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
+- struct sh_mobile_lcdc_board_cfg *cfg = &ch->cfg.board_cfg;
+ int brightness = bdev->props.brightness;
+
+ if (bdev->props.power != FB_BLANK_UNBLANK ||
+ bdev->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+ brightness = 0;
+
+- return cfg->set_brightness(brightness);
++ return ch->cfg.bl_info.set_brightness(brightness);
+ }
+
+ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
+ {
+ struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
+- struct sh_mobile_lcdc_board_cfg *cfg = &ch->cfg.board_cfg;
+
+- return cfg->get_brightness();
++ return ch->cfg.bl_info.get_brightness();
+ }
+
+ static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev,
+diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
+index 62be2c9..ecde6aa 100644
+--- a/include/video/sh_mobile_lcdc.h
++++ b/include/video/sh_mobile_lcdc.h
+@@ -154,8 +154,6 @@ struct sh_mobile_lcdc_board_cfg {
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+ void (*display_on)(void);
+ void (*display_off)(void);
+- int (*set_brightness)(int brightness);
+- int (*get_brightness)(void);
+ };
+
+ struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
+@@ -167,6 +165,8 @@ struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
+ struct sh_mobile_lcdc_bl_info {
+ const char *name;
+ int max_brightness;
++ int (*set_brightness)(int brightness);
++ int (*get_brightness)(void);
+ };
+
+ struct sh_mobile_lcdc_chan_cfg {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0163-fbdev-sh_mobile_lcdc-Merge-board_cfg-and-lcd_size_cf.patch b/patches.armadillo800eva/0163-fbdev-sh_mobile_lcdc-Merge-board_cfg-and-lcd_size_cf.patch
new file mode 100644
index 00000000000000..c9607616fffce7
--- /dev/null
+++ b/patches.armadillo800eva/0163-fbdev-sh_mobile_lcdc-Merge-board_cfg-and-lcd_size_cf.patch
@@ -0,0 +1,314 @@
+From 9cc62e588f6e71c7ca250eacd91f4da3e0af1f90 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 22:59:04 +0200
+Subject: fbdev: sh_mobile_lcdc: Merge board_cfg and lcd_size_cfg into
+ panel_cfg
+
+Update board code accordingly.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit afaad83b9c0d24eac88535cc5a8c6019f0c45bcb)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-bonito.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ag5evm.c | 6 +++---
+ arch/arm/mach-shmobile/board-ap4evb.c | 8 +++----
+ arch/arm/mach-shmobile/board-mackerel.c | 6 ++++--
+ arch/sh/boards/mach-ap325rxa/setup.c | 6 ++----
+ arch/sh/boards/mach-ecovec24/setup.c | 2 +-
+ arch/sh/boards/mach-kfr2r09/setup.c | 4 +---
+ arch/sh/boards/mach-migor/setup.c | 8 +++----
+ arch/sh/boards/mach-se/7724/setup.c | 2 +-
+ drivers/video/sh_mobile_lcdcfb.c | 35 +++++++++++++++----------------
+ include/video/sh_mobile_lcdc.h | 12 ++++-------
+ 10 files changed, 40 insertions(+), 49 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
+index 9865d97..22b0861 100644
+--- a/arch/arm/mach-shmobile/board-ag5evm.c
++++ b/arch/arm/mach-shmobile/board-ag5evm.c
+@@ -259,12 +259,12 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
+ .interface_type = RGB24,
+ .clock_divider = 1,
+ .flags = LCDC_FLAGS_DWPOL,
+- .lcd_size_cfg.width = 44,
+- .lcd_size_cfg.height = 79,
+ .fourcc = V4L2_PIX_FMT_RGB565,
+ .lcd_cfg = lcdc0_modes,
+ .num_cfg = ARRAY_SIZE(lcdc0_modes),
+- .board_cfg = {
++ .panel_cfg = {
++ .width = 44,
++ .height = 79,
+ .display_on = lcd_backlight_on,
+ .display_off = lcd_backlight_reset,
+ },
+diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
+index 488bd13..afdddb4 100644
+--- a/arch/arm/mach-shmobile/board-ap4evb.c
++++ b/arch/arm/mach-shmobile/board-ap4evb.c
+@@ -1324,8 +1324,8 @@ static void __init ap4evb_init(void)
+ lcdc_info.ch[0].interface_type = RGB24;
+ lcdc_info.ch[0].clock_divider = 1;
+ lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
+- lcdc_info.ch[0].lcd_size_cfg.width = 44;
+- lcdc_info.ch[0].lcd_size_cfg.height = 79;
++ lcdc_info.ch[0].panel_cfg.width = 44;
++ lcdc_info.ch[0].panel_cfg.height = 79;
+
+ platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices));
+
+@@ -1366,8 +1366,8 @@ static void __init ap4evb_init(void)
+ lcdc_info.ch[0].interface_type = RGB18;
+ lcdc_info.ch[0].clock_divider = 3;
+ lcdc_info.ch[0].flags = 0;
+- lcdc_info.ch[0].lcd_size_cfg.width = 152;
+- lcdc_info.ch[0].lcd_size_cfg.height = 91;
++ lcdc_info.ch[0].panel_cfg.width = 152;
++ lcdc_info.ch[0].panel_cfg.height = 91;
+
+ /* enable TouchScreen */
+ irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 40d61de..c9cab79 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -393,8 +393,10 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .interface_type = RGB24,
+ .clock_divider = 3,
+ .flags = 0,
+- .lcd_size_cfg.width = 152,
+- .lcd_size_cfg.height = 91,
++ .panel_cfg = {
++ .width = 152,
++ .height = 91,
++ },
+ .bl_info = {
+ .name = "sh_mobile_lcdc_bl",
+ .max_brightness = 1,
+diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
+index 514968a..f7d7ce4 100644
+--- a/arch/sh/boards/mach-ap325rxa/setup.c
++++ b/arch/sh/boards/mach-ap325rxa/setup.c
+@@ -213,11 +213,9 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .clock_divider = 1,
+ .lcd_cfg = ap325rxa_lcdc_modes,
+ .num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes),
+- .lcd_size_cfg = { /* 7.0 inch */
+- .width = 152,
++ .panel_cfg = {
++ .width = 152, /* 7.0 inch */
+ .height = 91,
+- },
+- .board_cfg = {
+ .display_on = ap320_wvga_power_on,
+ .display_off = ap320_wvga_power_off,
+ },
+diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
+index 5c2b2fc..44799f9 100644
+--- a/arch/sh/boards/mach-ecovec24/setup.c
++++ b/arch/sh/boards/mach-ecovec24/setup.c
+@@ -329,7 +329,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .interface_type = RGB18,
+ .chan = LCDC_CHAN_MAINLCD,
+ .fourcc = V4L2_PIX_FMT_RGB565,
+- .lcd_size_cfg = { /* 7.0 inch */
++ .panel_cfg = { /* 7.0 inch */
+ .width = 152,
+ .height = 91,
+ },
+diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
+index 7a35a5c..39585bb 100644
+--- a/arch/sh/boards/mach-kfr2r09/setup.c
++++ b/arch/sh/boards/mach-kfr2r09/setup.c
+@@ -153,11 +153,9 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
+ .flags = LCDC_FLAGS_DWPOL,
+ .lcd_cfg = kfr2r09_lcdc_modes,
+ .num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes),
+- .lcd_size_cfg = {
++ .panel_cfg = {
+ .width = 35,
+ .height = 58,
+- },
+- .board_cfg = {
+ .setup_sys = kfr2r09_lcd_setup,
+ .start_transfer = kfr2r09_lcd_start,
+ .display_on = kfr2r09_lcd_on,
+diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
+index 55ea682..5ce86c8 100644
+--- a/arch/sh/boards/mach-migor/setup.c
++++ b/arch/sh/boards/mach-migor/setup.c
+@@ -251,7 +251,7 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
+ .clock_divider = 2,
+ .lcd_cfg = migor_lcd_modes,
+ .num_cfg = ARRAY_SIZE(migor_lcd_modes),
+- .lcd_size_cfg = { /* 7.0 inch */
++ .panel_cfg = { /* 7.0 inch */
+ .width = 152,
+ .height = 91,
+ },
+@@ -265,11 +265,9 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
+ .clock_divider = 10,
+ .lcd_cfg = migor_lcd_modes,
+ .num_cfg = ARRAY_SIZE(migor_lcd_modes),
+- .lcd_size_cfg = { /* 2.4 inch */
+- .width = 49,
++ .panel_cfg = {
++ .width = 49, /* 2.4 inch */
+ .height = 37,
+- },
+- .board_cfg = {
+ .setup_sys = migor_lcd_qvga_setup,
+ },
+ .sys_bus_cfg = {
+diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
+index 93d53ec..23cd9d6 100644
+--- a/arch/sh/boards/mach-se/7724/setup.c
++++ b/arch/sh/boards/mach-se/7724/setup.c
+@@ -182,7 +182,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .chan = LCDC_CHAN_MAINLCD,
+ .fourcc = V4L2_PIX_FMT_RGB565,
+ .clock_divider = 1,
+- .lcd_size_cfg = { /* 7.0 inch */
++ .panel_cfg = { /* 7.0 inch */
+ .width = 152,
+ .height = 91,
+ },
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index adfffd6..9e44988 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -289,7 +289,7 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info,
+ struct list_head *pagelist)
+ {
+ struct sh_mobile_lcdc_chan *ch = info->par;
+- struct sh_mobile_lcdc_board_cfg *bcfg = &ch->cfg.board_cfg;
++ struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
+
+ /* enable clocks before accessing hardware */
+ sh_mobile_lcdc_clk_on(ch->lcdc);
+@@ -314,13 +314,13 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info,
+
+ /* trigger panel update */
+ dma_map_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
+- if (bcfg->start_transfer)
+- bcfg->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
++ if (panel->start_transfer)
++ panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
+ lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
+ dma_unmap_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
+ } else {
+- if (bcfg->start_transfer)
+- bcfg->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
++ if (panel->start_transfer)
++ panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
+ lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
+ }
+ }
+@@ -335,7 +335,7 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
+
+ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+ {
+- struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
++ struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
+
+ if (ch->tx_dev) {
+ if (ch->tx_dev->ops->display_on(ch->tx_dev, ch->info) < 0)
+@@ -343,16 +343,16 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+ }
+
+ /* HDMI must be enabled before LCDC configuration */
+- if (board_cfg->display_on)
+- board_cfg->display_on();
++ if (panel->display_on)
++ panel->display_on();
+ }
+
+ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
+ {
+- struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
++ struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
+
+- if (board_cfg->display_off)
+- board_cfg->display_off();
++ if (panel->display_off)
++ panel->display_off();
+
+ if (ch->tx_dev)
+ ch->tx_dev->ops->display_off(ch->tx_dev);
+@@ -687,16 +687,15 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
+
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+- struct sh_mobile_lcdc_board_cfg *board_cfg;
++ struct sh_mobile_lcdc_panel_cfg *panel;
+
+ ch = &priv->ch[k];
+ if (!ch->enabled)
+ continue;
+
+- board_cfg = &ch->cfg.board_cfg;
+- if (board_cfg->setup_sys) {
+- ret = board_cfg->setup_sys(ch,
+- &sh_mobile_lcdc_sys_bus_ops);
++ panel = &ch->cfg.panel_cfg;
++ if (panel->setup_sys) {
++ ret = panel->setup_sys(ch, &sh_mobile_lcdc_sys_bus_ops);
+ if (ret)
+ return ret;
+ }
+@@ -1654,8 +1653,8 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ */
+ var = &info->var;
+ fb_videomode_to_var(var, mode);
+- var->width = cfg->lcd_size_cfg.width;
+- var->height = cfg->lcd_size_cfg.height;
++ var->width = cfg->panel_cfg.width;
++ var->height = cfg->panel_cfg.height;
+ var->yres_virtual = var->yres * 2;
+ var->activate = FB_ACTIVATE_NOW;
+
+diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
+index ecde6aa..4f0fb55 100644
+--- a/include/video/sh_mobile_lcdc.h
++++ b/include/video/sh_mobile_lcdc.h
+@@ -147,7 +147,9 @@ struct sh_mobile_lcdc_sys_bus_ops {
+ unsigned long (*read_data)(void *handle);
+ };
+
+-struct sh_mobile_lcdc_board_cfg {
++struct sh_mobile_lcdc_panel_cfg {
++ unsigned long width; /* Panel width in mm */
++ unsigned long height; /* Panel height in mm */
+ int (*setup_sys)(void *sys_ops_handle,
+ struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
+ void (*start_transfer)(void *sys_ops_handle,
+@@ -156,11 +158,6 @@ struct sh_mobile_lcdc_board_cfg {
+ void (*display_off)(void);
+ };
+
+-struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
+- unsigned long width;
+- unsigned long height;
+-};
+-
+ /* backlight info */
+ struct sh_mobile_lcdc_bl_info {
+ const char *name;
+@@ -178,8 +175,7 @@ struct sh_mobile_lcdc_chan_cfg {
+ unsigned long flags; /* LCDC_FLAGS_... */
+ const struct fb_videomode *lcd_cfg;
+ int num_cfg;
+- struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg;
+- struct sh_mobile_lcdc_board_cfg board_cfg;
++ struct sh_mobile_lcdc_panel_cfg panel_cfg;
+ struct sh_mobile_lcdc_bl_info bl_info;
+ struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
+ struct sh_mobile_meram_cfg *meram_cfg;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0164-sh_mobile_lcdc-Add-an-lcdc-channel-pointer-to-sh_mob.patch b/patches.armadillo800eva/0164-sh_mobile_lcdc-Add-an-lcdc-channel-pointer-to-sh_mob.patch
new file mode 100644
index 00000000000000..9d6f5eb31f8c5c
--- /dev/null
+++ b/patches.armadillo800eva/0164-sh_mobile_lcdc-Add-an-lcdc-channel-pointer-to-sh_mob.patch
@@ -0,0 +1,64 @@
+From 60a5a49490ff63dc2a0864406fafd92b52da1e69 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 18 Sep 2011 12:21:17 +0200
+Subject: sh_mobile_lcdc: Add an lcdc channel pointer to sh_mobile_lcdc_entity
+
+The field will be used by the transmitter drivers to access
+sh_mobile_lcdc_chan fields such as fb_info.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit e34d0bbb062cc78802d0f0686c939ea1569889a6)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 5 ++++-
+ drivers/video/sh_mobile_lcdcfb.h | 2 ++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 9e44988..1ecc71e 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1495,8 +1495,10 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+ if (!info || !info->device)
+ continue;
+
+- if (ch->tx_dev)
++ if (ch->tx_dev) {
++ ch->tx_dev->lcdc = NULL;
+ module_put(ch->cfg.tx_dev->dev.driver->owner);
++ }
+
+ if (ch->sglist)
+ vfree(ch->sglist);
+@@ -1605,6 +1607,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ return -EINVAL;
+ }
+ ch->tx_dev = platform_get_drvdata(cfg->tx_dev);
++ ch->tx_dev->lcdc = ch;
+ }
+
+ /* Iterate through the modes to validate them and find the highest
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index 9601b92..36cd564 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -19,6 +19,7 @@ struct fb_info;
+ struct module;
+ struct sh_mobile_lcdc_entity;
+ struct sh_mobile_lcdc_priv;
++struct sh_mobile_lcdc_chan;
+
+ struct sh_mobile_lcdc_entity_ops {
+ /* Display */
+@@ -30,6 +31,7 @@ struct sh_mobile_lcdc_entity_ops {
+ struct sh_mobile_lcdc_entity {
+ struct module *owner;
+ const struct sh_mobile_lcdc_entity_ops *ops;
++ struct sh_mobile_lcdc_chan *lcdc;
+ };
+
+ /*
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0165-sh_mobile_hdmi-Use-sh_mobile_lcdc_entity-channel-to-.patch b/patches.armadillo800eva/0165-sh_mobile_hdmi-Use-sh_mobile_lcdc_entity-channel-to-.patch
new file mode 100644
index 00000000000000..0bfe8ff4949150
--- /dev/null
+++ b/patches.armadillo800eva/0165-sh_mobile_hdmi-Use-sh_mobile_lcdc_entity-channel-to-.patch
@@ -0,0 +1,240 @@
+From 5918dd8a351c7ce48cbe605ce93e01b7f9eda8b4 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 18 Sep 2011 12:25:21 +0200
+Subject: sh_mobile_hdmi: Use sh_mobile_lcdc_entity::channel to access fb_info
+
+The fb_info parameter passed to the display_on operation will be
+removed, don't use it.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit bce95fe838a5ca84e57411338b953be672c2a5eb)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_hdmi.c | 80 ++++++----------------------------------
+ 1 file changed, 12 insertions(+), 68 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index 3f4e4a4..bd885ee 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -219,16 +219,12 @@ struct sh_hdmi {
+ u8 edid_blocks;
+ struct clk *hdmi_clk;
+ struct device *dev;
+- struct fb_info *info;
+- struct mutex mutex; /* Protect the info pointer */
+ struct delayed_work edid_work;
+ struct fb_var_screeninfo var;
+ struct fb_monspecs monspec;
+- struct notifier_block notifier;
+ };
+
+ #define entity_to_sh_hdmi(e) container_of(e, struct sh_hdmi, entity)
+-#define notifier_to_hdmi(n) container_of(n, struct sh_hdmi, notifier)
+
+ static void hdmi_write(struct sh_hdmi *hdmi, u8 data, u8 reg)
+ {
+@@ -737,10 +733,11 @@ static unsigned long sh_hdmi_rate_error(struct sh_hdmi *hdmi,
+ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+ unsigned long *parent_rate)
+ {
++ struct fb_info *info = hdmi->entity.lcdc
++ ? hdmi->entity.lcdc->info : NULL;
+ struct fb_var_screeninfo tmpvar;
+ struct fb_var_screeninfo *var = &tmpvar;
+ const struct fb_videomode *mode, *found = NULL;
+- struct fb_info *info = hdmi->info;
+ struct fb_modelist *modelist = NULL;
+ unsigned int f_width = 0, f_height = 0, f_refresh = 0;
+ unsigned long found_rate_error = ULONG_MAX; /* silly compiler... */
+@@ -1012,13 +1009,10 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
+ * FB_EVENT_FB_UNBIND notify is also called with info->lock held
+ */
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
+- struct sh_mobile_lcdc_chan *ch = info->par;
++ struct sh_mobile_lcdc_chan *ch = entity->lcdc;
+
+ dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state);
+
+- /* No need to lock */
+- hdmi->info = info;
+-
+ /*
+ * hp_state can be set to
+ * HDMI_HOTPLUG_DISCONNECTED: on monitor unplug
+@@ -1040,7 +1034,6 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
+ return 0;
+ }
+
+-/* locking: called with info->lock held */
+ static void sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
+ {
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
+@@ -1057,15 +1050,14 @@ static const struct sh_mobile_lcdc_entity_ops sh_hdmi_ops = {
+
+ static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi)
+ {
+- struct fb_info *info = hdmi->info;
+- struct sh_mobile_lcdc_chan *ch = info->par;
++ struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc;
+ struct fb_var_screeninfo *new_var = &hdmi->var, *old_var = &ch->display_var;
+ struct fb_videomode mode1, mode2;
+
+ fb_var_to_videomode(&mode1, old_var);
+ fb_var_to_videomode(&mode2, new_var);
+
+- dev_dbg(info->dev, "Old %ux%u, new %ux%u\n",
++ dev_dbg(hdmi->dev, "Old %ux%u, new %ux%u\n",
+ mode1.xres, mode1.yres, mode2.xres, mode2.yres);
+
+ if (fb_mode_is_equal(&mode1, &mode2)) {
+@@ -1075,7 +1067,7 @@ static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi)
+ return false;
+ }
+
+- dev_dbg(info->dev, "Switching %u -> %u lines\n",
++ dev_dbg(hdmi->dev, "Switching %u -> %u lines\n",
+ mode1.yres, mode2.yres);
+ *old_var = *new_var;
+
+@@ -1121,17 +1113,13 @@ static long sh_hdmi_clk_configure(struct sh_hdmi *hdmi, unsigned long hdmi_rate,
+ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ {
+ struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work);
++ struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc;
+ struct fb_info *info;
+- struct sh_mobile_lcdc_chan *ch;
+ int ret;
+
+ dev_dbg(hdmi->dev, "%s(%p): begin, hotplug status %d\n", __func__, hdmi,
+ hdmi->hp_state);
+
+- mutex_lock(&hdmi->mutex);
+-
+- info = hdmi->info;
+-
+ if (hdmi->hp_state == HDMI_HOTPLUG_CONNECTED) {
+ unsigned long parent_rate = 0, hdmi_rate;
+
+@@ -1151,10 +1139,10 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ /* Switched to another (d) power-save mode */
+ msleep(10);
+
+- if (!info)
++ if (ch == NULL)
+ goto out;
+
+- ch = info->par;
++ info = ch->info;
+
+ if (lock_fb_info(info)) {
+ console_lock();
+@@ -1179,9 +1167,11 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ }
+ } else {
+ ret = 0;
+- if (!info)
++ if (ch == NULL)
+ goto out;
+
++ info = ch->info;
++
+ hdmi->monspec.modedb_len = 0;
+ fb_destroy_modedb(hdmi->monspec.modedb);
+ hdmi->monspec.modedb = NULL;
+@@ -1200,47 +1190,10 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ out:
+ if (ret < 0 && ret != -EAGAIN)
+ hdmi->hp_state = HDMI_HOTPLUG_DISCONNECTED;
+- mutex_unlock(&hdmi->mutex);
+
+ dev_dbg(hdmi->dev, "%s(%p): end\n", __func__, hdmi);
+ }
+
+-static int sh_hdmi_notify(struct notifier_block *nb,
+- unsigned long action, void *data)
+-{
+- struct fb_event *event = data;
+- struct fb_info *info = event->info;
+- struct sh_hdmi *hdmi = notifier_to_hdmi(nb);
+-
+- if (hdmi->info != info)
+- return NOTIFY_DONE;
+-
+- switch(action) {
+- case FB_EVENT_FB_REGISTERED:
+- /* Unneeded, activation taken care by sh_hdmi_display_on() */
+- break;
+- case FB_EVENT_FB_UNREGISTERED:
+- /*
+- * We are called from unregister_framebuffer() with the
+- * info->lock held. This is bad for us, because we can race with
+- * the scheduled work, which has to call fb_set_suspend(), which
+- * takes info->lock internally, so, sh_hdmi_edid_work_fn()
+- * cannot take and hold info->lock for the whole function
+- * duration. Using an additional lock creates a classical AB-BA
+- * lock up. Therefore, we have to release the info->lock
+- * temporarily, synchronise with the work queue and re-acquire
+- * the info->lock.
+- */
+- unlock_fb_info(info);
+- mutex_lock(&hdmi->mutex);
+- hdmi->info = NULL;
+- mutex_unlock(&hdmi->mutex);
+- lock_fb_info(info);
+- return NOTIFY_OK;
+- }
+- return NOTIFY_DONE;
+-}
+-
+ static int __init sh_hdmi_probe(struct platform_device *pdev)
+ {
+ struct sh_mobile_hdmi_info *pdata = pdev->dev.platform_data;
+@@ -1258,8 +1211,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
+ return -ENOMEM;
+ }
+
+- mutex_init(&hdmi->mutex);
+-
+ hdmi->dev = &pdev->dev;
+ hdmi->entity.owner = THIS_MODULE;
+ hdmi->entity.ops = &sh_hdmi_ops;
+@@ -1327,9 +1278,6 @@ static int __init sh_hdmi_probe(struct platform_device *pdev)
+ goto ecodec;
+ }
+
+- hdmi->notifier.notifier_call = sh_hdmi_notify;
+- fb_register_client(&hdmi->notifier);
+-
+ return 0;
+
+ ecodec:
+@@ -1345,7 +1293,6 @@ ereqreg:
+ erate:
+ clk_put(hdmi->hdmi_clk);
+ egetclk:
+- mutex_destroy(&hdmi->mutex);
+ kfree(hdmi);
+
+ return ret;
+@@ -1359,8 +1306,6 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev)
+
+ snd_soc_unregister_codec(&pdev->dev);
+
+- fb_unregister_client(&hdmi->notifier);
+-
+ /* No new work will be scheduled, wait for running ISR */
+ free_irq(irq, hdmi);
+ /* Wait for already scheduled work */
+@@ -1371,7 +1316,6 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev)
+ clk_put(hdmi->hdmi_clk);
+ iounmap(hdmi->base);
+ release_mem_region(res->start, resource_size(res));
+- mutex_destroy(&hdmi->mutex);
+ kfree(hdmi);
+
+ return 0;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0166-fbdev-sh_mobile_lcdc-Remove-fb_info-parameter-to-dis.patch b/patches.armadillo800eva/0166-fbdev-sh_mobile_lcdc-Remove-fb_info-parameter-to-dis.patch
new file mode 100644
index 00000000000000..b0c9ed726c1e30
--- /dev/null
+++ b/patches.armadillo800eva/0166-fbdev-sh_mobile_lcdc-Remove-fb_info-parameter-to-dis.patch
@@ -0,0 +1,95 @@
+From a3d2150cd0207917a39f6ae0a4bae6dcdee57800 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 18 Sep 2011 12:26:50 +0200
+Subject: fbdev: sh_mobile_lcdc: Remove fb_info parameter to display_on
+ operation
+
+The parameter is unused, remove it.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 5864ace19a2546912308e94432c1cf52d5945afe)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 3 +--
+ drivers/video/sh_mobile_hdmi.c | 11 +++--------
+ drivers/video/sh_mobile_lcdcfb.c | 2 +-
+ drivers/video/sh_mobile_lcdcfb.h | 3 +--
+ 4 files changed, 6 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index ad09a05..1ede247 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -394,8 +394,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ return 0;
+ }
+
+-static int mipi_display_on(struct sh_mobile_lcdc_entity *entity,
+- struct fb_info *info)
++static int mipi_display_on(struct sh_mobile_lcdc_entity *entity)
+ {
+ struct sh_mipi *mipi = to_sh_mipi(entity);
+ struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index bd885ee..c22e123 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -1000,16 +1000,11 @@ static irqreturn_t sh_hdmi_hotplug(int irq, void *dev_id)
+ return IRQ_HANDLED;
+ }
+
+-/* locking: called with info->lock held, or before register_framebuffer() */
+-static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity,
+- struct fb_info *info)
++static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity)
+ {
+- /*
+- * info is guaranteed to be valid, when we are called, because our
+- * FB_EVENT_FB_UNBIND notify is also called with info->lock held
+- */
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
+ struct sh_mobile_lcdc_chan *ch = entity->lcdc;
++ struct fb_info *info = ch->info;
+
+ dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state);
+
+@@ -1156,7 +1151,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ */
+ info->var.width = hdmi->var.width;
+ info->var.height = hdmi->var.height;
+- sh_hdmi_display_on(&hdmi->entity, info);
++ sh_hdmi_display_on(&hdmi->entity);
+ } else {
+ /* New monitor or have to wake up */
+ fb_set_suspend(info, 0);
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 1ecc71e..03ee382 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -338,7 +338,7 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+ struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
+
+ if (ch->tx_dev) {
+- if (ch->tx_dev->ops->display_on(ch->tx_dev, ch->info) < 0)
++ if (ch->tx_dev->ops->display_on(ch->tx_dev) < 0)
+ return;
+ }
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index 36cd564..b2cb8e6 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -23,8 +23,7 @@ struct sh_mobile_lcdc_chan;
+
+ struct sh_mobile_lcdc_entity_ops {
+ /* Display */
+- int (*display_on)(struct sh_mobile_lcdc_entity *entity,
+- struct fb_info *info);
++ int (*display_on)(struct sh_mobile_lcdc_entity *entity);
+ void (*display_off)(struct sh_mobile_lcdc_entity *entity);
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0167-fbdev-sh_mobile_lcdc-Return-display-connection-state.patch b/patches.armadillo800eva/0167-fbdev-sh_mobile_lcdc-Return-display-connection-state.patch
new file mode 100644
index 00000000000000..aa953289c1748f
--- /dev/null
+++ b/patches.armadillo800eva/0167-fbdev-sh_mobile_lcdc-Return-display-connection-state.patch
@@ -0,0 +1,102 @@
+From 202df78368566ccbb7b00d45bb973f044a7b4faf Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 28 Nov 2011 23:19:59 +0100
+Subject: fbdev: sh_mobile_lcdc: Return display connection state in display_on
+
+Return true if the display is connected and false otherwise. Set the fb
+info state to FBINFO_STATE_SUSPENDED in the sh_mobile_lcdc driver when
+the display is not connected.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 458981c3886133667e020900f53538f1fbc3ea1d)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 2 +-
+ drivers/video/sh_mobile_hdmi.c | 9 +++++----
+ drivers/video/sh_mobile_lcdcfb.c | 8 +++++++-
+ drivers/video/sh_mobile_lcdcfb.h | 3 +++
+ 4 files changed, 16 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 1ede247..5ff3742 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -412,7 +412,7 @@ static int mipi_display_on(struct sh_mobile_lcdc_entity *entity)
+
+ sh_mipi_dsi_enable(mipi, true);
+
+- return 0;
++ return SH_MOBILE_LCDC_DISPLAY_CONNECTED;
+
+ mipi_display_on_fail1:
+ pm_runtime_put_sync(&mipi->pdev->dev);
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index c22e123..1464abf 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -1004,9 +1004,9 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity)
+ {
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
+ struct sh_mobile_lcdc_chan *ch = entity->lcdc;
+- struct fb_info *info = ch->info;
+
+- dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi, info->state);
++ dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi,
++ hdmi->hp_state);
+
+ /*
+ * hp_state can be set to
+@@ -1021,12 +1021,13 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity)
+ dev_dbg(hdmi->dev, "HDMI running\n");
+ break;
+ case HDMI_HOTPLUG_DISCONNECTED:
+- info->state = FBINFO_STATE_SUSPENDED;
+ default:
+ hdmi->var = ch->display_var;
+ }
+
+- return 0;
++ return hdmi->hp_state == HDMI_HOTPLUG_DISCONNECTED
++ ? SH_MOBILE_LCDC_DISPLAY_DISCONNECTED
++ : SH_MOBILE_LCDC_DISPLAY_CONNECTED;
+ }
+
+ static void sh_hdmi_display_off(struct sh_mobile_lcdc_entity *entity)
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 03ee382..5a19ef3 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -338,8 +338,14 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+ struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
+
+ if (ch->tx_dev) {
+- if (ch->tx_dev->ops->display_on(ch->tx_dev) < 0)
++ int ret;
++
++ ret = ch->tx_dev->ops->display_on(ch->tx_dev);
++ if (ret < 0)
+ return;
++
++ if (ret == SH_MOBILE_LCDC_DISPLAY_DISCONNECTED)
++ ch->info->state = FBINFO_STATE_SUSPENDED;
+ }
+
+ /* HDMI must be enabled before LCDC configuration */
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index b2cb8e6..6fb956c 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -21,6 +21,9 @@ struct sh_mobile_lcdc_entity;
+ struct sh_mobile_lcdc_priv;
+ struct sh_mobile_lcdc_chan;
+
++#define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
++#define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
++
+ struct sh_mobile_lcdc_entity_ops {
+ /* Display */
+ int (*display_on)(struct sh_mobile_lcdc_entity *entity);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0168-sh_mobile_lcdc-Add-display-notify-callback-to-sh_mob.patch b/patches.armadillo800eva/0168-sh_mobile_lcdc-Add-display-notify-callback-to-sh_mob.patch
new file mode 100644
index 00000000000000..2290e0ce67397b
--- /dev/null
+++ b/patches.armadillo800eva/0168-sh_mobile_lcdc-Add-display-notify-callback-to-sh_mob.patch
@@ -0,0 +1,156 @@
+From bfab4418a38c6f956a1516f6a86efb8cbdc46ce5 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 18 Sep 2011 14:14:46 +0200
+Subject: sh_mobile_lcdc: Add display notify callback to sh_mobile_lcdc_chan
+
+The callback implements 3 notification events:
+
+- SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT notifies the LCDC that the
+ display has been connected
+- SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT notifies the LCDC that the
+ display has been disconnected
+- SH_MOBILE_LCDC_EVENT_DISPLAY_MODE notifies that LCDC that a display
+ mode has been detected
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit ecd29947862a9a145c07098499c76c22ed5b8eb3)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 84 ++++++++++++++++++++++++++++++++++++++
+ drivers/video/sh_mobile_lcdcfb.h | 10 +++++
+ 2 files changed, 94 insertions(+)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 5a19ef3..128eb77 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -364,6 +364,89 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
+ ch->tx_dev->ops->display_off(ch->tx_dev);
+ }
+
++static bool
++sh_mobile_lcdc_must_reconfigure(struct sh_mobile_lcdc_chan *ch,
++ const struct fb_var_screeninfo *new_var)
++{
++ struct fb_var_screeninfo *old_var = &ch->display_var;
++ struct fb_videomode old_mode;
++ struct fb_videomode new_mode;
++
++ fb_var_to_videomode(&old_mode, old_var);
++ fb_var_to_videomode(&new_mode, new_var);
++
++ dev_dbg(ch->info->dev, "Old %ux%u, new %ux%u\n",
++ old_mode.xres, old_mode.yres, new_mode.xres, new_mode.yres);
++
++ if (fb_mode_is_equal(&old_mode, &new_mode)) {
++ /* It can be a different monitor with an equal video-mode */
++ old_var->width = new_var->width;
++ old_var->height = new_var->height;
++ return false;
++ }
++
++ dev_dbg(ch->info->dev, "Switching %u -> %u lines\n",
++ old_mode.yres, new_mode.yres);
++ *old_var = *new_var;
++
++ return true;
++}
++
++static int sh_mobile_check_var(struct fb_var_screeninfo *var,
++ struct fb_info *info);
++
++static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
++ enum sh_mobile_lcdc_entity_event event,
++ struct fb_var_screeninfo *var)
++{
++ struct fb_info *info = ch->info;
++ int ret = 0;
++
++ switch (event) {
++ case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT:
++ /* HDMI plug in */
++ if (lock_fb_info(info)) {
++ console_lock();
++
++ if (!sh_mobile_lcdc_must_reconfigure(ch, var) &&
++ info->state == FBINFO_STATE_RUNNING) {
++ /* First activation with the default monitor.
++ * Just turn on, if we run a resume here, the
++ * logo disappears.
++ */
++ info->var.width = var->width;
++ info->var.height = var->height;
++ sh_mobile_lcdc_display_on(ch);
++ } else {
++ /* New monitor or have to wake up */
++ fb_set_suspend(info, 0);
++ }
++
++ console_unlock();
++ unlock_fb_info(info);
++ }
++ break;
++
++ case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT:
++ /* HDMI disconnect */
++ if (lock_fb_info(info)) {
++ console_lock();
++ fb_set_suspend(info, 1);
++ console_unlock();
++ unlock_fb_info(info);
++ }
++ break;
++
++ case SH_MOBILE_LCDC_EVENT_DISPLAY_MODE:
++ /* Validate a proposed new mode */
++ var->bits_per_pixel = info->var.bits_per_pixel;
++ ret = sh_mobile_check_var(var, info);
++ break;
++ }
++
++ return ret;
++}
++
+ /* -----------------------------------------------------------------------------
+ * Format helpers
+ */
+@@ -1591,6 +1674,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ int i;
+
+ mutex_init(&ch->open_lock);
++ ch->notify = sh_mobile_lcdc_display_notify;
+
+ /* Allocate the frame buffer device. */
+ ch->info = framebuffer_alloc(0, priv->dev);
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index 6fb956c..e2eb7af 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -30,6 +30,12 @@ struct sh_mobile_lcdc_entity_ops {
+ void (*display_off)(struct sh_mobile_lcdc_entity *entity);
+ };
+
++enum sh_mobile_lcdc_entity_event {
++ SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT,
++ SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT,
++ SH_MOBILE_LCDC_EVENT_DISPLAY_MODE,
++};
++
+ struct sh_mobile_lcdc_entity {
+ struct module *owner;
+ const struct sh_mobile_lcdc_entity_ops *ops;
+@@ -70,6 +76,10 @@ struct sh_mobile_lcdc_chan {
+ unsigned long base_addr_y;
+ unsigned long base_addr_c;
+ unsigned int pitch;
++
++ int (*notify)(struct sh_mobile_lcdc_chan *ch,
++ enum sh_mobile_lcdc_entity_event event,
++ struct fb_var_screeninfo *var);
+ };
+
+ #endif
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0169-sh_mobile_hdmi-Use-LCDC-notification-callback.patch b/patches.armadillo800eva/0169-sh_mobile_hdmi-Use-LCDC-notification-callback.patch
new file mode 100644
index 00000000000000..c82cadfeb0eb2a
--- /dev/null
+++ b/patches.armadillo800eva/0169-sh_mobile_hdmi-Use-LCDC-notification-callback.patch
@@ -0,0 +1,158 @@
+From b72769e69999f6fb428eb25bee4690f021da55bc Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 18 Sep 2011 14:18:28 +0200
+Subject: sh_mobile_hdmi: Use LCDC notification callback
+
+Instead of accessing the LCDC channel and fb_info structures directly,
+use the LCDC notification callback to inform the LCDC driver about
+display-related events.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 7295752fd7ec86feca6e3ccb407c1cbabf59e1d3)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_hdmi.c | 91 +++++++---------------------------------
+ 1 file changed, 14 insertions(+), 77 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index 1464abf..055cd92 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -733,12 +733,11 @@ static unsigned long sh_hdmi_rate_error(struct sh_hdmi *hdmi,
+ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+ unsigned long *parent_rate)
+ {
+- struct fb_info *info = hdmi->entity.lcdc
+- ? hdmi->entity.lcdc->info : NULL;
+- struct fb_var_screeninfo tmpvar;
+- struct fb_var_screeninfo *var = &tmpvar;
++ struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc;
++ struct fb_info *info = ch ? ch->info : NULL;
++ struct fb_var_screeninfo var;
+ const struct fb_videomode *mode, *found = NULL;
+- struct fb_modelist *modelist = NULL;
++ const struct fb_modelist *modelist = NULL;
+ unsigned int f_width = 0, f_height = 0, f_refresh = 0;
+ unsigned long found_rate_error = ULONG_MAX; /* silly compiler... */
+ bool scanning = false, preferred_bad = false;
+@@ -856,12 +855,10 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+ }
+
+ /* Check if supported: sufficient fb memory, supported clock-rate */
+- fb_videomode_to_var(var, mode);
++ fb_videomode_to_var(&var, mode);
+
+- var->bits_per_pixel = info->var.bits_per_pixel;
+-
+- if (info && info->fbops->fb_check_var &&
+- info->fbops->fb_check_var(var, info)) {
++ if (ch && ch->notify &&
++ ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_MODE, &var)) {
+ scanning = true;
+ preferred_bad = true;
+ continue;
+@@ -1044,32 +1041,6 @@ static const struct sh_mobile_lcdc_entity_ops sh_hdmi_ops = {
+ .display_off = sh_hdmi_display_off,
+ };
+
+-static bool sh_hdmi_must_reconfigure(struct sh_hdmi *hdmi)
+-{
+- struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc;
+- struct fb_var_screeninfo *new_var = &hdmi->var, *old_var = &ch->display_var;
+- struct fb_videomode mode1, mode2;
+-
+- fb_var_to_videomode(&mode1, old_var);
+- fb_var_to_videomode(&mode2, new_var);
+-
+- dev_dbg(hdmi->dev, "Old %ux%u, new %ux%u\n",
+- mode1.xres, mode1.yres, mode2.xres, mode2.yres);
+-
+- if (fb_mode_is_equal(&mode1, &mode2)) {
+- /* It can be a different monitor with an equal video-mode */
+- old_var->width = new_var->width;
+- old_var->height = new_var->height;
+- return false;
+- }
+-
+- dev_dbg(hdmi->dev, "Switching %u -> %u lines\n",
+- mode1.yres, mode2.yres);
+- *old_var = *new_var;
+-
+- return true;
+-}
+-
+ /**
+ * sh_hdmi_clk_configure() - set HDMI clock frequency and enable the clock
+ * @hdmi: driver context
+@@ -1110,7 +1081,6 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ {
+ struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work);
+ struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc;
+- struct fb_info *info;
+ int ret;
+
+ dev_dbg(hdmi->dev, "%s(%p): begin, hotplug status %d\n", __func__, hdmi,
+@@ -1135,52 +1105,19 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+ /* Switched to another (d) power-save mode */
+ msleep(10);
+
+- if (ch == NULL)
+- goto out;
+-
+- info = ch->info;
+-
+- if (lock_fb_info(info)) {
+- console_lock();
+-
+- /* HDMI plug in */
+- if (!sh_hdmi_must_reconfigure(hdmi) &&
+- info->state == FBINFO_STATE_RUNNING) {
+- /*
+- * First activation with the default monitor - just turn
+- * on, if we run a resume here, the logo disappears
+- */
+- info->var.width = hdmi->var.width;
+- info->var.height = hdmi->var.height;
+- sh_hdmi_display_on(&hdmi->entity);
+- } else {
+- /* New monitor or have to wake up */
+- fb_set_suspend(info, 0);
+- }
+-
+- console_unlock();
+- unlock_fb_info(info);
+- }
++ if (ch && ch->notify)
++ ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT,
++ &hdmi->var);
+ } else {
+- ret = 0;
+- if (ch == NULL)
+- goto out;
+-
+- info = ch->info;
+-
+ hdmi->monspec.modedb_len = 0;
+ fb_destroy_modedb(hdmi->monspec.modedb);
+ hdmi->monspec.modedb = NULL;
+
+- if (lock_fb_info(info)) {
+- console_lock();
++ if (ch && ch->notify)
++ ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT,
++ NULL);
+
+- /* HDMI disconnect */
+- fb_set_suspend(info, 1);
+-
+- console_unlock();
+- unlock_fb_info(info);
+- }
++ ret = 0;
+ }
+
+ out:
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0170-fbdev-sh_mobile_lcdc-Pass-a-video-mode-to-the-notify.patch b/patches.armadillo800eva/0170-fbdev-sh_mobile_lcdc-Pass-a-video-mode-to-the-notify.patch
new file mode 100644
index 00000000000000..5e624e9eece47a
--- /dev/null
+++ b/patches.armadillo800eva/0170-fbdev-sh_mobile_lcdc-Pass-a-video-mode-to-the-notify.patch
@@ -0,0 +1,296 @@
+From 34bfa3a6b085c7f80ac52fa33888f4ee7aacbab1 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 01:05:47 +0100
+Subject: fbdev: sh_mobile_lcdc: Pass a video mode to the notify callback
+
+Pass pointers to struct fb_videomode and struct fb_monspecs instead of
+struct fb_var_screeninfo to the notify callback.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit e0c8601a18969229eb63065e5c3176319c785288)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_hdmi.c | 59 +++++++++++++++++---------------------
+ drivers/video/sh_mobile_lcdcfb.c | 36 ++++++++++++-----------
+ drivers/video/sh_mobile_lcdcfb.h | 3 +-
+ 3 files changed, 48 insertions(+), 50 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index 055cd92..2617609 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -220,7 +220,7 @@ struct sh_hdmi {
+ struct clk *hdmi_clk;
+ struct device *dev;
+ struct delayed_work edid_work;
+- struct fb_var_screeninfo var;
++ struct fb_videomode mode;
+ struct fb_monspecs monspec;
+ };
+
+@@ -291,24 +291,24 @@ static struct snd_soc_codec_driver soc_codec_dev_sh_hdmi = {
+ /* External video parameter settings */
+ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
+ {
+- struct fb_var_screeninfo *var = &hdmi->var;
++ struct fb_videomode *mode = &hdmi->mode;
+ u16 htotal, hblank, hdelay, vtotal, vblank, vdelay, voffset;
+ u8 sync = 0;
+
+- htotal = var->xres + var->right_margin + var->left_margin + var->hsync_len;
+-
+- hdelay = var->hsync_len + var->left_margin;
+- hblank = var->right_margin + hdelay;
++ htotal = mode->xres + mode->right_margin + mode->left_margin
++ + mode->hsync_len;
++ hdelay = mode->hsync_len + mode->left_margin;
++ hblank = mode->right_margin + hdelay;
+
+ /*
+ * Vertical timing looks a bit different in Figure 18,
+ * but let's try the same first by setting offset = 0
+ */
+- vtotal = var->yres + var->upper_margin + var->lower_margin + var->vsync_len;
+-
+- vdelay = var->vsync_len + var->upper_margin;
+- vblank = var->lower_margin + vdelay;
+- voffset = min(var->upper_margin / 2, 6U);
++ vtotal = mode->yres + mode->upper_margin + mode->lower_margin
++ + mode->vsync_len;
++ vdelay = mode->vsync_len + mode->upper_margin;
++ vblank = mode->lower_margin + vdelay;
++ voffset = min(mode->upper_margin / 2, 6U);
+
+ /*
+ * [3]: VSYNC polarity: Positive
+@@ -316,14 +316,14 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
+ * [1]: Interlace/Progressive: Progressive
+ * [0]: External video settings enable: used.
+ */
+- if (var->sync & FB_SYNC_HOR_HIGH_ACT)
++ if (mode->sync & FB_SYNC_HOR_HIGH_ACT)
+ sync |= 4;
+- if (var->sync & FB_SYNC_VERT_HIGH_ACT)
++ if (mode->sync & FB_SYNC_VERT_HIGH_ACT)
+ sync |= 8;
+
+ dev_dbg(hdmi->dev, "H: %u, %u, %u, %u; V: %u, %u, %u, %u; sync 0x%x\n",
+- htotal, hblank, hdelay, var->hsync_len,
+- vtotal, vblank, vdelay, var->vsync_len, sync);
++ htotal, hblank, hdelay, mode->hsync_len,
++ vtotal, vblank, vdelay, mode->vsync_len, sync);
+
+ hdmi_write(hdmi, sync | (voffset << 4), HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS);
+
+@@ -336,8 +336,8 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
+ hdmi_write(hdmi, hdelay, HDMI_EXTERNAL_H_DELAY_7_0);
+ hdmi_write(hdmi, hdelay >> 8, HDMI_EXTERNAL_H_DELAY_9_8);
+
+- hdmi_write(hdmi, var->hsync_len, HDMI_EXTERNAL_H_DURATION_7_0);
+- hdmi_write(hdmi, var->hsync_len >> 8, HDMI_EXTERNAL_H_DURATION_9_8);
++ hdmi_write(hdmi, mode->hsync_len, HDMI_EXTERNAL_H_DURATION_7_0);
++ hdmi_write(hdmi, mode->hsync_len >> 8, HDMI_EXTERNAL_H_DURATION_9_8);
+
+ hdmi_write(hdmi, vtotal, HDMI_EXTERNAL_V_TOTAL_7_0);
+ hdmi_write(hdmi, vtotal >> 8, HDMI_EXTERNAL_V_TOTAL_9_8);
+@@ -346,7 +346,7 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
+
+ hdmi_write(hdmi, vdelay, HDMI_EXTERNAL_V_DELAY);
+
+- hdmi_write(hdmi, var->vsync_len, HDMI_EXTERNAL_V_DURATION);
++ hdmi_write(hdmi, mode->vsync_len, HDMI_EXTERNAL_V_DURATION);
+
+ /* Set bit 0 of HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS here for external mode */
+ if (!hdmi->preprogrammed_vic)
+@@ -473,7 +473,7 @@ static void sh_hdmi_audio_config(struct sh_hdmi *hdmi)
+ */
+ static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
+ {
+- if (hdmi->var.pixclock < 10000) {
++ if (hdmi->mode.pixclock < 10000) {
+ /* for 1080p8bit 148MHz */
+ hdmi_write(hdmi, 0x1d, HDMI_SLIPHDMIT_PARAM_SETTINGS_1);
+ hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2);
+@@ -484,7 +484,7 @@ static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
+ hdmi_write(hdmi, 0x0e, HDMI_SLIPHDMIT_PARAM_SETTINGS_8);
+ hdmi_write(hdmi, 0x25, HDMI_SLIPHDMIT_PARAM_SETTINGS_9);
+ hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10);
+- } else if (hdmi->var.pixclock < 30000) {
++ } else if (hdmi->mode.pixclock < 30000) {
+ /* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */
+ /*
+ * [1:0] Speed_A
+@@ -735,7 +735,6 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+ {
+ struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc;
+ struct fb_info *info = ch ? ch->info : NULL;
+- struct fb_var_screeninfo var;
+ const struct fb_videomode *mode, *found = NULL;
+ const struct fb_modelist *modelist = NULL;
+ unsigned int f_width = 0, f_height = 0, f_refresh = 0;
+@@ -855,10 +854,9 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+ }
+
+ /* Check if supported: sufficient fb memory, supported clock-rate */
+- fb_videomode_to_var(&var, mode);
+-
+ if (ch && ch->notify &&
+- ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_MODE, &var)) {
++ ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_MODE, mode,
++ NULL)) {
+ scanning = true;
+ preferred_bad = true;
+ continue;
+@@ -868,9 +866,6 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+ found_rate_error = rate_error;
+ }
+
+- hdmi->var.width = hdmi->monspec.max_x * 10;
+- hdmi->var.height = hdmi->monspec.max_y * 10;
+-
+ /*
+ * TODO 1: if no ->info is present, postpone running the config until
+ * after ->info first gets registered.
+@@ -916,7 +911,7 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+ found->xres, found->yres, found->refresh,
+ PICOS2KHZ(found->pixclock) * 1000, found_rate_error);
+
+- fb_videomode_to_var(&hdmi->var, found);
++ hdmi->mode = *found;
+ sh_hdmi_external_video_param(hdmi);
+
+ return 0;
+@@ -1017,9 +1012,9 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity)
+ hdmi_write(hdmi, 0x80, HDMI_SYSTEM_CTRL);
+ dev_dbg(hdmi->dev, "HDMI running\n");
+ break;
+- case HDMI_HOTPLUG_DISCONNECTED:
+ default:
+- hdmi->var = ch->display_var;
++ fb_var_to_videomode(&hdmi->mode, &ch->display_var);
++ break;
+ }
+
+ return hdmi->hp_state == HDMI_HOTPLUG_DISCONNECTED
+@@ -1107,7 +1102,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+
+ if (ch && ch->notify)
+ ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT,
+- &hdmi->var);
++ &hdmi->mode, &hdmi->monspec);
+ } else {
+ hdmi->monspec.modedb_len = 0;
+ fb_destroy_modedb(hdmi->monspec.modedb);
+@@ -1115,7 +1110,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work)
+
+ if (ch && ch->notify)
+ ch->notify(ch, SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT,
+- NULL);
++ NULL, NULL);
+
+ ret = 0;
+ }
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 128eb77..d3299ff 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -366,28 +366,23 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
+
+ static bool
+ sh_mobile_lcdc_must_reconfigure(struct sh_mobile_lcdc_chan *ch,
+- const struct fb_var_screeninfo *new_var)
++ const struct fb_videomode *new_mode)
+ {
+ struct fb_var_screeninfo *old_var = &ch->display_var;
+ struct fb_videomode old_mode;
+- struct fb_videomode new_mode;
+
+ fb_var_to_videomode(&old_mode, old_var);
+- fb_var_to_videomode(&new_mode, new_var);
+
+ dev_dbg(ch->info->dev, "Old %ux%u, new %ux%u\n",
+- old_mode.xres, old_mode.yres, new_mode.xres, new_mode.yres);
++ old_mode.xres, old_mode.yres, new_mode->xres, new_mode->yres);
+
+- if (fb_mode_is_equal(&old_mode, &new_mode)) {
+- /* It can be a different monitor with an equal video-mode */
+- old_var->width = new_var->width;
+- old_var->height = new_var->height;
++ /* It can be a different monitor with an equal video-mode */
++ if (fb_mode_is_equal(&old_mode, new_mode))
+ return false;
+- }
+
+ dev_dbg(ch->info->dev, "Switching %u -> %u lines\n",
+- old_mode.yres, new_mode.yres);
+- *old_var = *new_var;
++ old_mode.yres, new_mode->yres);
++ fb_videomode_to_var(old_var, new_mode);
+
+ return true;
+ }
+@@ -397,9 +392,11 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var,
+
+ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
+ enum sh_mobile_lcdc_entity_event event,
+- struct fb_var_screeninfo *var)
++ const struct fb_videomode *mode,
++ const struct fb_monspecs *monspec)
+ {
+ struct fb_info *info = ch->info;
++ struct fb_var_screeninfo var;
+ int ret = 0;
+
+ switch (event) {
+@@ -408,14 +405,17 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
+ if (lock_fb_info(info)) {
+ console_lock();
+
+- if (!sh_mobile_lcdc_must_reconfigure(ch, var) &&
++ ch->display_var.width = monspec->max_x * 10;
++ ch->display_var.height = monspec->max_y * 10;
++
++ if (!sh_mobile_lcdc_must_reconfigure(ch, mode) &&
+ info->state == FBINFO_STATE_RUNNING) {
+ /* First activation with the default monitor.
+ * Just turn on, if we run a resume here, the
+ * logo disappears.
+ */
+- info->var.width = var->width;
+- info->var.height = var->height;
++ info->var.width = monspec->max_x * 10;
++ info->var.height = monspec->max_y * 10;
+ sh_mobile_lcdc_display_on(ch);
+ } else {
+ /* New monitor or have to wake up */
+@@ -439,8 +439,10 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
+
+ case SH_MOBILE_LCDC_EVENT_DISPLAY_MODE:
+ /* Validate a proposed new mode */
+- var->bits_per_pixel = info->var.bits_per_pixel;
+- ret = sh_mobile_check_var(var, info);
++ fb_videomode_to_var(&var, mode);
++ var.bits_per_pixel = info->var.bits_per_pixel;
++ var.grayscale = info->var.grayscale;
++ ret = sh_mobile_check_var(&var, info);
+ break;
+ }
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index e2eb7af..10086ae 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -79,7 +79,8 @@ struct sh_mobile_lcdc_chan {
+
+ int (*notify)(struct sh_mobile_lcdc_chan *ch,
+ enum sh_mobile_lcdc_entity_event event,
+- struct fb_var_screeninfo *var);
++ const struct fb_videomode *mode,
++ const struct fb_monspecs *monspec);
+ };
+
+ #endif
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0171-fbdev-sh_mobile_hdmi-Don-t-set-sh_hdmi-mode-in-the-d.patch b/patches.armadillo800eva/0171-fbdev-sh_mobile_hdmi-Don-t-set-sh_hdmi-mode-in-the-d.patch
new file mode 100644
index 00000000000000..146ade3a173759
--- /dev/null
+++ b/patches.armadillo800eva/0171-fbdev-sh_mobile_hdmi-Don-t-set-sh_hdmi-mode-in-the-d.patch
@@ -0,0 +1,50 @@
+From ff1c59b9f903d00351b77e364a1e35a5b2b94516 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 01:07:50 +0100
+Subject: fbdev: sh_mobile_hdmi: Don't set sh_hdmi::mode in the display on
+ handler
+
+The struct sh_hdmi mode field is only used after being assigned by the
+EDID read code. There is thus no need to initialize it from the LCDC
+display var in the display on handler.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit d30555d24e462edf439a1057114e1b0df76c89ef)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_hdmi.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index 2617609..37f935f 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -995,7 +995,6 @@ static irqreturn_t sh_hdmi_hotplug(int irq, void *dev_id)
+ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity)
+ {
+ struct sh_hdmi *hdmi = entity_to_sh_hdmi(entity);
+- struct sh_mobile_lcdc_chan *ch = entity->lcdc;
+
+ dev_dbg(hdmi->dev, "%s(%p): state %x\n", __func__, hdmi,
+ hdmi->hp_state);
+@@ -1006,15 +1005,10 @@ static int sh_hdmi_display_on(struct sh_mobile_lcdc_entity *entity)
+ * HDMI_HOTPLUG_CONNECTED: on monitor plug-in
+ * HDMI_HOTPLUG_EDID_DONE: on EDID read completion
+ */
+- switch (hdmi->hp_state) {
+- case HDMI_HOTPLUG_EDID_DONE:
++ if (hdmi->hp_state == HDMI_HOTPLUG_EDID_DONE) {
+ /* PS mode d->e. All functions are active */
+ hdmi_write(hdmi, 0x80, HDMI_SYSTEM_CTRL);
+ dev_dbg(hdmi->dev, "HDMI running\n");
+- break;
+- default:
+- fb_var_to_videomode(&hdmi->mode, &ch->display_var);
+- break;
+ }
+
+ return hdmi->hp_state == HDMI_HOTPLUG_DISCONNECTED
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0172-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-fb_info.patch b/patches.armadillo800eva/0172-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-fb_info.patch
new file mode 100644
index 00000000000000..874d0b00e6e6b1
--- /dev/null
+++ b/patches.armadillo800eva/0172-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-fb_info.patch
@@ -0,0 +1,145 @@
+From e1d190da1084ca206f5eb5f948600ddba65c7332 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 01:46:12 +0100
+Subject: fbdev: sh_mobile_hdmi: Don't access LCDC fb_info
+
+The LCDC fb_info structure is only used to retrieve the default video
+mode in case none of the modes advertised by EDID information is
+acceptable. Pass a pointer to the default mode through the
+sh_mobile_lcdc_entity structure instead.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 13f80eea562be6cd58b5bdefc224c87cc0d9288d)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_hdmi.c | 34 ++++++++++++++--------------------
+ drivers/video/sh_mobile_lcdcfb.c | 24 +++++++++++++-----------
+ drivers/video/sh_mobile_lcdcfb.h | 1 +
+ 3 files changed, 28 insertions(+), 31 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
+index 37f935f..eafb19d 100644
+--- a/drivers/video/sh_mobile_hdmi.c
++++ b/drivers/video/sh_mobile_hdmi.c
+@@ -734,12 +734,11 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+ unsigned long *parent_rate)
+ {
+ struct sh_mobile_lcdc_chan *ch = hdmi->entity.lcdc;
+- struct fb_info *info = ch ? ch->info : NULL;
+ const struct fb_videomode *mode, *found = NULL;
+- const struct fb_modelist *modelist = NULL;
+ unsigned int f_width = 0, f_height = 0, f_refresh = 0;
+ unsigned long found_rate_error = ULONG_MAX; /* silly compiler... */
+ bool scanning = false, preferred_bad = false;
++ bool use_edid_mode = false;
+ u8 edid[128];
+ char *forced;
+ int i;
+@@ -864,25 +863,19 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+
+ found = mode;
+ found_rate_error = rate_error;
++ use_edid_mode = true;
+ }
+
+ /*
+- * TODO 1: if no ->info is present, postpone running the config until
+- * after ->info first gets registered.
++ * TODO 1: if no default mode is present, postpone running the config
++ * until after the LCDC channel is initialized.
+ * TODO 2: consider registering the HDMI platform device from the LCDC
+- * driver, and passing ->info with HDMI platform data.
++ * driver.
+ */
+- if (info && !found) {
+- modelist = info->modelist.next &&
+- !list_empty(&info->modelist) ?
+- list_entry(info->modelist.next,
+- struct fb_modelist, list) :
+- NULL;
+-
+- if (modelist) {
+- found = &modelist->mode;
+- found_rate_error = sh_hdmi_rate_error(hdmi, found, hdmi_rate, parent_rate);
+- }
++ if (!found && hdmi->entity.def_mode.xres != 0) {
++ found = &hdmi->entity.def_mode;
++ found_rate_error = sh_hdmi_rate_error(hdmi, found, hdmi_rate,
++ parent_rate);
+ }
+
+ /* No cookie today */
+@@ -906,10 +899,11 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
+ else
+ hdmi->preprogrammed_vic = 0;
+
+- dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), clock error %luHz\n",
+- modelist ? "default" : "EDID", hdmi->preprogrammed_vic ? "VIC" : "external",
+- found->xres, found->yres, found->refresh,
+- PICOS2KHZ(found->pixclock) * 1000, found_rate_error);
++ dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), "
++ "clock error %luHz\n", use_edid_mode ? "EDID" : "default",
++ hdmi->preprogrammed_vic ? "VIC" : "external", found->xres,
++ found->yres, found->refresh, PICOS2KHZ(found->pixclock) * 1000,
++ found_rate_error);
+
+ hdmi->mode = *found;
+ sh_hdmi_external_video_param(hdmi);
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index d3299ff..986346d 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1691,17 +1691,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ info->pseudo_palette = &ch->pseudo_palette;
+ info->flags = FBINFO_FLAG_DEFAULT;
+
+- if (cfg->tx_dev) {
+- if (!cfg->tx_dev->dev.driver ||
+- !try_module_get(cfg->tx_dev->dev.driver->owner)) {
+- dev_warn(priv->dev,
+- "unable to get transmitter device\n");
+- return -EINVAL;
+- }
+- ch->tx_dev = platform_get_drvdata(cfg->tx_dev);
+- ch->tx_dev->lcdc = ch;
+- }
+-
+ /* Iterate through the modes to validate them and find the highest
+ * resolution.
+ */
+@@ -1742,6 +1731,19 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+
+ fb_videomode_to_modelist(mode, num_cfg, &info->modelist);
+
++ /* Initialize the transmitter device if present. */
++ if (cfg->tx_dev) {
++ if (!cfg->tx_dev->dev.driver ||
++ !try_module_get(cfg->tx_dev->dev.driver->owner)) {
++ dev_warn(priv->dev,
++ "unable to get transmitter device\n");
++ return -EINVAL;
++ }
++ ch->tx_dev = platform_get_drvdata(cfg->tx_dev);
++ ch->tx_dev->lcdc = ch;
++ ch->tx_dev->def_mode = *mode;
++ }
++
+ /* Initialize variable screen information using the first mode as
+ * default. The default Y virtual resolution is twice the panel size to
+ * allow for double-buffering.
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index 10086ae..9c91fae 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -40,6 +40,7 @@ struct sh_mobile_lcdc_entity {
+ struct module *owner;
+ const struct sh_mobile_lcdc_entity_ops *ops;
+ struct sh_mobile_lcdc_chan *lcdc;
++ struct fb_videomode def_mode;
+ };
+
+ /*
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0173-fbdev-sh_mobile_lcdc-Store-display-mode-in-a-struct-.patch b/patches.armadillo800eva/0173-fbdev-sh_mobile_lcdc-Store-display-mode-in-a-struct-.patch
new file mode 100644
index 00000000000000..7dc7301aae0d84
--- /dev/null
+++ b/patches.armadillo800eva/0173-fbdev-sh_mobile_lcdc-Store-display-mode-in-a-struct-.patch
@@ -0,0 +1,193 @@
+From d77a91222ef33c9df80de28959e2a56711cf9be8 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 13:42:48 +0100
+Subject: fbdev: sh_mobile_lcdc: Store display mode in a struct fb_videomode
+
+Embed struct fb_videomode instead of struct fb_var_screeninfo in struct
+sh_mobile_lcdc_chan to store the display mode.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 2d04559dc23bed905ed2904f2bbcbcc3f1a7fd91)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 74 ++++++++++++++++++++------------------
+ drivers/video/sh_mobile_lcdcfb.h | 6 +++-
+ 2 files changed, 44 insertions(+), 36 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 986346d..422fcfd 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -368,21 +368,17 @@ static bool
+ sh_mobile_lcdc_must_reconfigure(struct sh_mobile_lcdc_chan *ch,
+ const struct fb_videomode *new_mode)
+ {
+- struct fb_var_screeninfo *old_var = &ch->display_var;
+- struct fb_videomode old_mode;
+-
+- fb_var_to_videomode(&old_mode, old_var);
+-
+ dev_dbg(ch->info->dev, "Old %ux%u, new %ux%u\n",
+- old_mode.xres, old_mode.yres, new_mode->xres, new_mode->yres);
++ ch->display.mode.xres, ch->display.mode.yres,
++ new_mode->xres, new_mode->yres);
+
+ /* It can be a different monitor with an equal video-mode */
+- if (fb_mode_is_equal(&old_mode, new_mode))
++ if (fb_mode_is_equal(&ch->display.mode, new_mode))
+ return false;
+
+ dev_dbg(ch->info->dev, "Switching %u -> %u lines\n",
+- old_mode.yres, new_mode->yres);
+- fb_videomode_to_var(old_var, new_mode);
++ ch->display.mode.yres, new_mode->yres);
++ ch->display.mode = *new_mode;
+
+ return true;
+ }
+@@ -405,8 +401,8 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
+ if (lock_fb_info(info)) {
+ console_lock();
+
+- ch->display_var.width = monspec->max_x * 10;
+- ch->display_var.height = monspec->max_y * 10;
++ ch->display.width = monspec->max_x * 10;
++ ch->display.height = monspec->max_y * 10;
+
+ if (!sh_mobile_lcdc_must_reconfigure(ch, mode) &&
+ info->state == FBINFO_STATE_RUNNING) {
+@@ -569,7 +565,8 @@ static void sh_mobile_lcdc_start_stop(struct sh_mobile_lcdc_priv *priv,
+
+ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
+ {
+- struct fb_var_screeninfo *var = &ch->info->var, *display_var = &ch->display_var;
++ const struct fb_var_screeninfo *var = &ch->info->var;
++ const struct fb_videomode *mode = &ch->display.mode;
+ unsigned long h_total, hsync_pos, display_h_total;
+ u32 tmp;
+
+@@ -588,34 +585,32 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
+ lcdc_write_chan(ch, LDMT3R, ch->cfg.sys_bus_cfg.ldmt3r);
+
+ /* horizontal configuration */
+- h_total = display_var->xres + display_var->hsync_len +
+- display_var->left_margin + display_var->right_margin;
++ h_total = mode->xres + mode->hsync_len + mode->left_margin
++ + mode->right_margin;
+ tmp = h_total / 8; /* HTCN */
+- tmp |= (min(display_var->xres, var->xres) / 8) << 16; /* HDCN */
++ tmp |= (min(mode->xres, var->xres) / 8) << 16; /* HDCN */
+ lcdc_write_chan(ch, LDHCNR, tmp);
+
+- hsync_pos = display_var->xres + display_var->right_margin;
++ hsync_pos = mode->xres + mode->right_margin;
+ tmp = hsync_pos / 8; /* HSYNP */
+- tmp |= (display_var->hsync_len / 8) << 16; /* HSYNW */
++ tmp |= (mode->hsync_len / 8) << 16; /* HSYNW */
+ lcdc_write_chan(ch, LDHSYNR, tmp);
+
+ /* vertical configuration */
+- tmp = display_var->yres + display_var->vsync_len +
+- display_var->upper_margin + display_var->lower_margin; /* VTLN */
+- tmp |= min(display_var->yres, var->yres) << 16; /* VDLN */
++ tmp = mode->yres + mode->vsync_len + mode->upper_margin
++ + mode->lower_margin; /* VTLN */
++ tmp |= min(mode->yres, var->yres) << 16; /* VDLN */
+ lcdc_write_chan(ch, LDVLNR, tmp);
+
+- tmp = display_var->yres + display_var->lower_margin; /* VSYNP */
+- tmp |= display_var->vsync_len << 16; /* VSYNW */
++ tmp = mode->yres + mode->lower_margin; /* VSYNP */
++ tmp |= mode->vsync_len << 16; /* VSYNW */
+ lcdc_write_chan(ch, LDVSYNR, tmp);
+
+ /* Adjust horizontal synchronisation for HDMI */
+- display_h_total = display_var->xres + display_var->hsync_len +
+- display_var->left_margin + display_var->right_margin;
+- tmp = ((display_var->xres & 7) << 24) |
+- ((display_h_total & 7) << 16) |
+- ((display_var->hsync_len & 7) << 8) |
+- (hsync_pos & 7);
++ display_h_total = mode->xres + mode->hsync_len + mode->left_margin
++ + mode->right_margin;
++ tmp = ((mode->xres & 7) << 24) | ((display_h_total & 7) << 16)
++ | ((mode->hsync_len & 7) << 8) | (hsync_pos & 7);
+ lcdc_write_chan(ch, LDHAJR, tmp);
+ }
+
+@@ -1106,7 +1101,8 @@ static int sh_mobile_ioctl(struct fb_info *info, unsigned int cmd,
+ static void sh_mobile_fb_reconfig(struct fb_info *info)
+ {
+ struct sh_mobile_lcdc_chan *ch = info->par;
+- struct fb_videomode mode1, mode2;
++ struct fb_var_screeninfo var;
++ struct fb_videomode mode;
+ struct fb_event event;
+ int evnt = FB_EVENT_MODE_CHANGE_ALL;
+
+@@ -1114,14 +1110,19 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
+ /* More framebuffer users are active */
+ return;
+
+- fb_var_to_videomode(&mode1, &ch->display_var);
+- fb_var_to_videomode(&mode2, &info->var);
++ fb_var_to_videomode(&mode, &info->var);
+
+- if (fb_mode_is_equal(&mode1, &mode2))
++ if (fb_mode_is_equal(&ch->display.mode, &mode))
+ return;
+
+ /* Display has been re-plugged, framebuffer is free now, reconfigure */
+- if (fb_set_var(info, &ch->display_var) < 0)
++ var = info->var;
++ fb_videomode_to_var(&var, &ch->display.mode);
++ var.width = ch->display.width;
++ var.height = ch->display.height;
++ var.activate = FB_ACTIVATE_NOW;
++
++ if (fb_set_var(info, &var) < 0)
+ /* Couldn't reconfigure, hopefully, can continue as before */
+ return;
+
+@@ -1131,7 +1132,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
+ * user event, we have to call the chain ourselves.
+ */
+ event.info = info;
+- event.data = &mode1;
++ event.data = &ch->display.mode;
+ fb_notifier_call_chain(evnt, &event);
+ }
+
+@@ -1815,7 +1816,10 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+
+ info->screen_base = buf;
+ info->device = priv->dev;
+- ch->display_var = *var;
++
++ ch->display.width = cfg->panel_cfg.width;
++ ch->display.height = cfg->panel_cfg.height;
++ ch->display.mode = *mode;
+
+ return 0;
+ }
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index 9c91fae..c175387 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -68,7 +68,11 @@ struct sh_mobile_lcdc_chan {
+ unsigned long pan_offset;
+ wait_queue_head_t frame_end_wait;
+ struct completion vsync_completion;
+- struct fb_var_screeninfo display_var;
++ struct {
++ unsigned int width;
++ unsigned int height;
++ struct fb_videomode mode;
++ } display;
+ int use_count;
+ int blank_status;
+ struct mutex open_lock; /* protects the use counter */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0174-fbdev-sh_mobile_lcdc-Rename-lcd-num-_cfg-lcd-num-_mo.patch b/patches.armadillo800eva/0174-fbdev-sh_mobile_lcdc-Rename-lcd-num-_cfg-lcd-num-_mo.patch
new file mode 100644
index 00000000000000..d0c008795f86e8
--- /dev/null
+++ b/patches.armadillo800eva/0174-fbdev-sh_mobile_lcdc-Rename-lcd-num-_cfg-lcd-num-_mo.patch
@@ -0,0 +1,405 @@
+From 918a3c709c036aaea6bae77c6fc5c8935c8979a3 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 14:33:41 +0100
+Subject: fbdev: sh_mobile_lcdc: Rename (lcd|num)_cfg (lcd|num)_modes
+
+The struct sh_mobile_lcdc_chan_cfg platform data contains a list of
+video modes. Name the lcd_cfg and num_cfg fields to reflect that they
+describe video modes.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 93ff259846a774ff37dca54792c5a3a6425882c0)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-ap4evb.c
+ arch/arm/mach-shmobile/board-bonito.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ag5evm.c | 4 ++--
+ arch/arm/mach-shmobile/board-ap4evb.c | 4 ++--
+ arch/arm/mach-shmobile/board-mackerel.c | 4 ++--
+ arch/sh/boards/mach-ap325rxa/setup.c | 4 ++--
+ arch/sh/boards/mach-ecovec24/setup.c | 8 +++----
+ arch/sh/boards/mach-kfr2r09/setup.c | 4 ++--
+ arch/sh/boards/mach-migor/setup.c | 8 +++----
+ arch/sh/boards/mach-se/7724/setup.c | 8 +++----
+ drivers/video/sh_mipi_dsi.c | 38 +++++++++++++++----------------
+ drivers/video/sh_mobile_lcdcfb.c | 20 ++++++++--------
+ include/video/sh_mobile_lcdc.h | 4 ++--
+ 11 files changed, 53 insertions(+), 53 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
+index 22b0861..f04ee16 100644
+--- a/arch/arm/mach-shmobile/board-ag5evm.c
++++ b/arch/arm/mach-shmobile/board-ag5evm.c
+@@ -260,8 +260,8 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
+ .clock_divider = 1,
+ .flags = LCDC_FLAGS_DWPOL,
+ .fourcc = V4L2_PIX_FMT_RGB565,
+- .lcd_cfg = lcdc0_modes,
+- .num_cfg = ARRAY_SIZE(lcdc0_modes),
++ .lcd_modes = lcdc0_modes,
++ .num_modes = ARRAY_SIZE(lcdc0_modes),
+ .panel_cfg = {
+ .width = 44,
+ .height = 79,
+diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
+index afdddb4..3cf12de 100644
+--- a/arch/arm/mach-shmobile/board-ap4evb.c
++++ b/arch/arm/mach-shmobile/board-ap4evb.c
+@@ -490,8 +490,8 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+ .fourcc = V4L2_PIX_FMT_RGB565,
+- .lcd_cfg = ap4evb_lcdc_modes,
+- .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
++ .lcd_modes = ap4evb_lcdc_modes,
++ .num_modes = ARRAY_SIZE(ap4evb_lcdc_modes),
+ .meram_cfg = &lcd_meram_cfg,
+ }
+ };
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index c9cab79..31d99e5 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -388,8 +388,8 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .ch[0] = {
+ .chan = LCDC_CHAN_MAINLCD,
+ .fourcc = V4L2_PIX_FMT_RGB565,
+- .lcd_cfg = mackerel_lcdc_modes,
+- .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes),
++ .lcd_modes = mackerel_lcdc_modes,
++ .num_modes = ARRAY_SIZE(mackerel_lcdc_modes),
+ .interface_type = RGB24,
+ .clock_divider = 3,
+ .flags = 0,
+diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
+index f7d7ce4..7194ae7 100644
+--- a/arch/sh/boards/mach-ap325rxa/setup.c
++++ b/arch/sh/boards/mach-ap325rxa/setup.c
+@@ -211,8 +211,8 @@ static struct sh_mobile_lcdc_info lcdc_info = {
+ .fourcc = V4L2_PIX_FMT_RGB565,
+ .interface_type = RGB18,
+ .clock_divider = 1,
+- .lcd_cfg = ap325rxa_lcdc_modes,
+- .num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes),
++ .lcd_modes = ap325rxa_lcdc_modes,
++ .num_modes = ARRAY_SIZE(ap325rxa_lcdc_modes),
+ .panel_cfg = {
+ .width = 152, /* 7.0 inch */
+ .height = 91,
+diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
+index 44799f9..15e3bfd 100644
+--- a/arch/sh/boards/mach-ecovec24/setup.c
++++ b/arch/sh/boards/mach-ecovec24/setup.c
+@@ -1146,8 +1146,8 @@ static int __init arch_setup(void)
+ /* DVI */
+ lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
+ lcdc_info.ch[0].clock_divider = 1;
+- lcdc_info.ch[0].lcd_cfg = ecovec_dvi_modes;
+- lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_dvi_modes);
++ lcdc_info.ch[0].lcd_modes = ecovec_dvi_modes;
++ lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_dvi_modes);
+
+ gpio_set_value(GPIO_PTA2, 1);
+ gpio_set_value(GPIO_PTU1, 1);
+@@ -1155,8 +1155,8 @@ static int __init arch_setup(void)
+ /* Panel */
+ lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
+ lcdc_info.ch[0].clock_divider = 2;
+- lcdc_info.ch[0].lcd_cfg = ecovec_lcd_modes;
+- lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_lcd_modes);
++ lcdc_info.ch[0].lcd_modes = ecovec_lcd_modes;
++ lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_lcd_modes);
+
+ gpio_set_value(GPIO_PTR1, 1);
+
+diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
+index 39585bb..32cf2c8 100644
+--- a/arch/sh/boards/mach-kfr2r09/setup.c
++++ b/arch/sh/boards/mach-kfr2r09/setup.c
+@@ -151,8 +151,8 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
+ .interface_type = SYS18,
+ .clock_divider = 6,
+ .flags = LCDC_FLAGS_DWPOL,
+- .lcd_cfg = kfr2r09_lcdc_modes,
+- .num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes),
++ .lcd_modes = kfr2r09_lcdc_modes,
++ .num_modes = ARRAY_SIZE(kfr2r09_lcdc_modes),
+ .panel_cfg = {
+ .width = 35,
+ .height = 58,
+diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
+index 5ce86c8..a478493 100644
+--- a/arch/sh/boards/mach-migor/setup.c
++++ b/arch/sh/boards/mach-migor/setup.c
+@@ -249,8 +249,8 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
+ .fourcc = V4L2_PIX_FMT_RGB565,
+ .interface_type = RGB16,
+ .clock_divider = 2,
+- .lcd_cfg = migor_lcd_modes,
+- .num_cfg = ARRAY_SIZE(migor_lcd_modes),
++ .lcd_modes = migor_lcd_modes,
++ .num_modes = ARRAY_SIZE(migor_lcd_modes),
+ .panel_cfg = { /* 7.0 inch */
+ .width = 152,
+ .height = 91,
+@@ -263,8 +263,8 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
+ .fourcc = V4L2_PIX_FMT_RGB565,
+ .interface_type = SYS16A,
+ .clock_divider = 10,
+- .lcd_cfg = migor_lcd_modes,
+- .num_cfg = ARRAY_SIZE(migor_lcd_modes),
++ .lcd_modes = migor_lcd_modes,
++ .num_modes = ARRAY_SIZE(migor_lcd_modes),
+ .panel_cfg = {
+ .width = 49, /* 2.4 inch */
+ .height = 37,
+diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
+index 23cd9d6..1342feb 100644
+--- a/arch/sh/boards/mach-se/7724/setup.c
++++ b/arch/sh/boards/mach-se/7724/setup.c
+@@ -904,12 +904,12 @@ static int __init devices_setup(void)
+
+ if (sw & SW41_B) {
+ /* 720p */
+- lcdc_info.ch[0].lcd_cfg = lcdc_720p_modes;
+- lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_720p_modes);
++ lcdc_info.ch[0].lcd_modes = lcdc_720p_modes;
++ lcdc_info.ch[0].num_modes = ARRAY_SIZE(lcdc_720p_modes);
+ } else {
+ /* VGA */
+- lcdc_info.ch[0].lcd_cfg = lcdc_vga_modes;
+- lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_vga_modes);
++ lcdc_info.ch[0].lcd_modes = lcdc_vga_modes;
++ lcdc_info.ch[0].num_modes = ARRAY_SIZE(lcdc_vga_modes);
+ }
+
+ if (sw & SW41_A) {
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 5ff3742..42ad0f7 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -147,77 +147,77 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ pctype = 0;
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24;
+ pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
+- linelength = ch->lcd_cfg[0].xres * 3;
++ linelength = ch->lcd_modes[0].xres * 3;
+ yuv = false;
+ break;
+ case MIPI_RGB565:
+ pctype = 1;
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16;
+ pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
+- linelength = ch->lcd_cfg[0].xres * 2;
++ linelength = ch->lcd_modes[0].xres * 2;
+ yuv = false;
+ break;
+ case MIPI_RGB666_LP:
+ pctype = 2;
+ datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
+ pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
+- linelength = ch->lcd_cfg[0].xres * 3;
++ linelength = ch->lcd_modes[0].xres * 3;
+ yuv = false;
+ break;
+ case MIPI_RGB666:
+ pctype = 3;
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18;
+ pixfmt = MIPI_DCS_PIXEL_FMT_18BIT;
+- linelength = (ch->lcd_cfg[0].xres * 18 + 7) / 8;
++ linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8;
+ yuv = false;
+ break;
+ case MIPI_BGR888:
+ pctype = 8;
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24;
+ pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
+- linelength = ch->lcd_cfg[0].xres * 3;
++ linelength = ch->lcd_modes[0].xres * 3;
+ yuv = false;
+ break;
+ case MIPI_BGR565:
+ pctype = 9;
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16;
+ pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
+- linelength = ch->lcd_cfg[0].xres * 2;
++ linelength = ch->lcd_modes[0].xres * 2;
+ yuv = false;
+ break;
+ case MIPI_BGR666_LP:
+ pctype = 0xa;
+ datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
+ pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
+- linelength = ch->lcd_cfg[0].xres * 3;
++ linelength = ch->lcd_modes[0].xres * 3;
+ yuv = false;
+ break;
+ case MIPI_BGR666:
+ pctype = 0xb;
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18;
+ pixfmt = MIPI_DCS_PIXEL_FMT_18BIT;
+- linelength = (ch->lcd_cfg[0].xres * 18 + 7) / 8;
++ linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8;
+ yuv = false;
+ break;
+ case MIPI_YUYV:
+ pctype = 4;
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16;
+ pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
+- linelength = ch->lcd_cfg[0].xres * 2;
++ linelength = ch->lcd_modes[0].xres * 2;
+ yuv = true;
+ break;
+ case MIPI_UYVY:
+ pctype = 5;
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16;
+ pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
+- linelength = ch->lcd_cfg[0].xres * 2;
++ linelength = ch->lcd_modes[0].xres * 2;
+ yuv = true;
+ break;
+ case MIPI_YUV420_L:
+ pctype = 6;
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12;
+ pixfmt = MIPI_DCS_PIXEL_FMT_12BIT;
+- linelength = (ch->lcd_cfg[0].xres * 12 + 7) / 8;
++ linelength = (ch->lcd_modes[0].xres * 12 + 7) / 8;
+ yuv = true;
+ break;
+ case MIPI_YUV420:
+@@ -225,7 +225,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12;
+ pixfmt = MIPI_DCS_PIXEL_FMT_12BIT;
+ /* Length of U/V line */
+- linelength = (ch->lcd_cfg[0].xres + 1) / 2;
++ linelength = (ch->lcd_modes[0].xres + 1) / 2;
+ yuv = true;
+ break;
+ default:
+@@ -294,7 +294,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ */
+ iowrite32(0x00000006, mipi->linkbase + DTCTR);
+ /* VSYNC width = 2 (<< 17) */
+- iowrite32((ch->lcd_cfg[0].vsync_len << pdata->vsynw_offset) |
++ iowrite32((ch->lcd_modes[0].vsync_len << pdata->vsynw_offset) |
+ (pdata->clksrc << 16) | (pctype << 12) | datatype,
+ mipi->linkbase + VMCTR1);
+
+@@ -328,7 +328,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ top = linelength << 16; /* RGBLEN */
+ bottom = 0x00000001;
+ if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */
+- bottom = (pdata->lane * ch->lcd_cfg[0].hsync_len) - 10;
++ bottom = (pdata->lane * ch->lcd_modes[0].hsync_len) - 10;
+ iowrite32(top | bottom , mipi->linkbase + VMLEN1);
+
+ /*
+@@ -348,18 +348,18 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ div = 2;
+
+ if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */
+- top = ch->lcd_cfg[0].hsync_len + ch->lcd_cfg[0].left_margin;
++ top = ch->lcd_modes[0].hsync_len + ch->lcd_modes[0].left_margin;
+ top = ((pdata->lane * top / div) - 10) << 16;
+ }
+ if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */
+- bottom = ch->lcd_cfg[0].right_margin;
++ bottom = ch->lcd_modes[0].right_margin;
+ bottom = (pdata->lane * bottom / div) - 12;
+ }
+
+- bpp = linelength / ch->lcd_cfg[0].xres; /* byte / pixel */
++ bpp = linelength / ch->lcd_modes[0].xres; /* byte / pixel */
+ if ((pdata->lane / div) > bpp) {
+- tmp = ch->lcd_cfg[0].xres / bpp; /* output cycle */
+- tmp = ch->lcd_cfg[0].xres - tmp; /* (input - output) cycle */
++ tmp = ch->lcd_modes[0].xres / bpp; /* output cycle */
++ tmp = ch->lcd_modes[0].xres - tmp; /* (input - output) cycle */
+ delay = (pdata->lane * tmp);
+ }
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 422fcfd..ab7b179 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1191,8 +1191,8 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ * distance between two modes is defined as the size of the
+ * non-overlapping parts of the two rectangles.
+ */
+- for (i = 0; i < ch->cfg.num_cfg; ++i) {
+- const struct fb_videomode *mode = &ch->cfg.lcd_cfg[i];
++ for (i = 0; i < ch->cfg.num_modes; ++i) {
++ const struct fb_videomode *mode = &ch->cfg.lcd_modes[i];
+ unsigned int dist;
+
+ /* We can only round up. */
+@@ -1211,7 +1211,7 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ }
+
+ /* If no available mode can be used, return an error. */
+- if (ch->cfg.num_cfg != 0) {
++ if (ch->cfg.num_modes != 0) {
+ if (best_dist == (unsigned int)-1)
+ return -EINVAL;
+
+@@ -1671,7 +1671,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ struct fb_var_screeninfo *var;
+ struct fb_info *info;
+ unsigned int max_size;
+- int num_cfg;
++ int num_modes;
+ void *buf;
+ int ret;
+ int i;
+@@ -1698,7 +1698,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ max_mode = NULL;
+ max_size = 0;
+
+- for (i = 0, mode = cfg->lcd_cfg; i < cfg->num_cfg; i++, mode++) {
++ for (i = 0, mode = cfg->lcd_modes; i < cfg->num_modes; i++, mode++) {
+ unsigned int size = mode->yres * mode->xres;
+
+ /* NV12/NV21 buffers must have even number of lines */
+@@ -1722,15 +1722,15 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ max_mode->xres, max_mode->yres);
+
+ /* Create the mode list. */
+- if (cfg->lcd_cfg == NULL) {
++ if (cfg->lcd_modes == NULL) {
+ mode = &default_720p;
+- num_cfg = 1;
++ num_modes = 1;
+ } else {
+- mode = cfg->lcd_cfg;
+- num_cfg = cfg->num_cfg;
++ mode = cfg->lcd_modes;
++ num_modes = cfg->num_modes;
+ }
+
+- fb_videomode_to_modelist(mode, num_cfg, &info->modelist);
++ fb_videomode_to_modelist(mode, num_modes, &info->modelist);
+
+ /* Initialize the transmitter device if present. */
+ if (cfg->tx_dev) {
+diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
+index 4f0fb55..484b0a2 100644
+--- a/include/video/sh_mobile_lcdc.h
++++ b/include/video/sh_mobile_lcdc.h
+@@ -173,8 +173,8 @@ struct sh_mobile_lcdc_chan_cfg {
+ int interface_type; /* selects RGBn or SYSn I/F, see above */
+ int clock_divider;
+ unsigned long flags; /* LCDC_FLAGS_... */
+- const struct fb_videomode *lcd_cfg;
+- int num_cfg;
++ const struct fb_videomode *lcd_modes;
++ int num_modes;
+ struct sh_mobile_lcdc_panel_cfg panel_cfg;
+ struct sh_mobile_lcdc_bl_info bl_info;
+ struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0175-fbdev-sh_mobile_lcdc-Reorganize-the-sh_mobile_lcdc_c.patch b/patches.armadillo800eva/0175-fbdev-sh_mobile_lcdc-Reorganize-the-sh_mobile_lcdc_c.patch
new file mode 100644
index 00000000000000..ad3553973518a5
--- /dev/null
+++ b/patches.armadillo800eva/0175-fbdev-sh_mobile_lcdc-Reorganize-the-sh_mobile_lcdc_c.patch
@@ -0,0 +1,84 @@
+From 3de9bc5c7d9d70a6a8323124f157fbc6ed456229 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 14:03:17 +0100
+Subject: fbdev: sh_mobile_lcdc: Reorganize the sh_mobile_lcdc_chan structure
+
+Group fields by purpose, and make the separation between core fields and
+FB-related fields clear.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 740f802af2d8c46f1423b6b3daa33e4e1ea223f0)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.h | 39 ++++++++++++++++++++++----------------
+ 1 file changed, 23 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index c175387..8e0d009 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -53,30 +53,22 @@ struct sh_mobile_lcdc_entity {
+ struct sh_mobile_lcdc_chan {
+ struct sh_mobile_lcdc_priv *lcdc;
+ struct sh_mobile_lcdc_entity *tx_dev;
++ struct sh_mobile_lcdc_chan_cfg cfg;
+
+ unsigned long *reg_offs;
+ unsigned long ldmt1r_value;
+ unsigned long enabled; /* ME and SE in LDCNT2R */
+- struct sh_mobile_lcdc_chan_cfg cfg;
+- u32 pseudo_palette[PALETTE_NR];
+- struct fb_info *info;
+- struct backlight_device *bl;
++ int meram_enabled;
++
++ struct mutex open_lock; /* protects the use counter */
++ int use_count;
++
+ dma_addr_t dma_handle;
+- struct fb_deferred_io defio;
+- struct scatterlist *sglist;
+- unsigned long frame_end;
+ unsigned long pan_offset;
++
++ unsigned long frame_end;
+ wait_queue_head_t frame_end_wait;
+ struct completion vsync_completion;
+- struct {
+- unsigned int width;
+- unsigned int height;
+- struct fb_videomode mode;
+- } display;
+- int use_count;
+- int blank_status;
+- struct mutex open_lock; /* protects the use counter */
+- int meram_enabled;
+
+ unsigned long base_addr_y;
+ unsigned long base_addr_c;
+@@ -86,6 +78,21 @@ struct sh_mobile_lcdc_chan {
+ enum sh_mobile_lcdc_entity_event event,
+ const struct fb_videomode *mode,
+ const struct fb_monspecs *monspec);
++
++ /* Backlight */
++ struct backlight_device *bl;
++
++ /* FB */
++ struct fb_info *info;
++ u32 pseudo_palette[PALETTE_NR];
++ struct {
++ unsigned int width;
++ unsigned int height;
++ struct fb_videomode mode;
++ } display;
++ struct fb_deferred_io defio;
++ struct scatterlist *sglist;
++ int blank_status;
+ };
+
+ #endif
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0176-fbdev-sh_mobile_lcdc-Add-sh_mobile_format_info-funct.patch b/patches.armadillo800eva/0176-fbdev-sh_mobile_lcdc-Add-sh_mobile_format_info-funct.patch
new file mode 100644
index 00000000000000..eedf6662e72412
--- /dev/null
+++ b/patches.armadillo800eva/0176-fbdev-sh_mobile_lcdc-Add-sh_mobile_format_info-funct.patch
@@ -0,0 +1,277 @@
+From cd6aeedfd01cbbc25b865687153f22419b922b31 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 15:58:10 +0100
+Subject: fbdev: sh_mobile_lcdc: Add sh_mobile_format_info() function
+
+The function returns a pointer to a structure describing a format based
+on its fourcc. Use the function where applicable instead of hardcoded
+switch-case statements.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 105784bbb47cd76f0fc32954b047a13b704fa840)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 174 ++++++++++++++++++++++----------------
+ 1 file changed, 102 insertions(+), 72 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index ab7b179..c66f0f4 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -449,6 +449,75 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
+ * Format helpers
+ */
+
++struct sh_mobile_lcdc_format_info {
++ u32 fourcc;
++ unsigned int bpp;
++ bool yuv;
++ u32 lddfr;
++};
++
++static const struct sh_mobile_lcdc_format_info sh_mobile_format_infos[] = {
++ {
++ .fourcc = V4L2_PIX_FMT_RGB565,
++ .bpp = 16,
++ .yuv = false,
++ .lddfr = LDDFR_PKF_RGB16,
++ }, {
++ .fourcc = V4L2_PIX_FMT_BGR24,
++ .bpp = 24,
++ .yuv = false,
++ .lddfr = LDDFR_PKF_RGB24,
++ }, {
++ .fourcc = V4L2_PIX_FMT_BGR32,
++ .bpp = 32,
++ .yuv = false,
++ .lddfr = LDDFR_PKF_ARGB32,
++ }, {
++ .fourcc = V4L2_PIX_FMT_NV12,
++ .bpp = 12,
++ .yuv = true,
++ .lddfr = LDDFR_CC | LDDFR_YF_420,
++ }, {
++ .fourcc = V4L2_PIX_FMT_NV21,
++ .bpp = 12,
++ .yuv = true,
++ .lddfr = LDDFR_CC | LDDFR_YF_420,
++ }, {
++ .fourcc = V4L2_PIX_FMT_NV16,
++ .bpp = 16,
++ .yuv = true,
++ .lddfr = LDDFR_CC | LDDFR_YF_422,
++ }, {
++ .fourcc = V4L2_PIX_FMT_NV61,
++ .bpp = 16,
++ .yuv = true,
++ .lddfr = LDDFR_CC | LDDFR_YF_422,
++ }, {
++ .fourcc = V4L2_PIX_FMT_NV24,
++ .bpp = 24,
++ .yuv = true,
++ .lddfr = LDDFR_CC | LDDFR_YF_444,
++ }, {
++ .fourcc = V4L2_PIX_FMT_NV42,
++ .bpp = 24,
++ .yuv = true,
++ .lddfr = LDDFR_CC | LDDFR_YF_444,
++ },
++};
++
++static const struct sh_mobile_lcdc_format_info *
++sh_mobile_format_info(u32 fourcc)
++{
++ unsigned int i;
++
++ for (i = 0; i < ARRAY_SIZE(sh_mobile_format_infos); ++i) {
++ if (sh_mobile_format_infos[i].fourcc == fourcc)
++ return &sh_mobile_format_infos[i];
++ }
++
++ return NULL;
++}
++
+ static int sh_mobile_format_fourcc(const struct fb_var_screeninfo *var)
+ {
+ if (var->grayscale > 1)
+@@ -473,21 +542,13 @@ static int sh_mobile_format_is_fourcc(const struct fb_var_screeninfo *var)
+
+ static bool sh_mobile_format_is_yuv(const struct fb_var_screeninfo *var)
+ {
++ const struct sh_mobile_lcdc_format_info *format;
++
+ if (var->grayscale <= 1)
+ return false;
+
+- switch (var->grayscale) {
+- case V4L2_PIX_FMT_NV12:
+- case V4L2_PIX_FMT_NV21:
+- case V4L2_PIX_FMT_NV16:
+- case V4L2_PIX_FMT_NV61:
+- case V4L2_PIX_FMT_NV24:
+- case V4L2_PIX_FMT_NV42:
+- return true;
+-
+- default:
+- return false;
+- }
++ format = sh_mobile_format_info(var->grayscale);
++ return format ? format->yuv : false;
+ }
+
+ /* -----------------------------------------------------------------------------
+@@ -667,37 +728,20 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+
+ /* Setup geometry, format, frame buffer memory and operation mode. */
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
++ const struct sh_mobile_lcdc_format_info *format;
++ u32 fourcc;
++
+ ch = &priv->ch[k];
+ if (!ch->enabled)
+ continue;
+
+ sh_mobile_lcdc_geometry(ch);
+
+- switch (sh_mobile_format_fourcc(&ch->info->var)) {
+- case V4L2_PIX_FMT_RGB565:
+- tmp = LDDFR_PKF_RGB16;
+- break;
+- case V4L2_PIX_FMT_BGR24:
+- tmp = LDDFR_PKF_RGB24;
+- break;
+- case V4L2_PIX_FMT_BGR32:
+- tmp = LDDFR_PKF_ARGB32;
+- break;
+- case V4L2_PIX_FMT_NV12:
+- case V4L2_PIX_FMT_NV21:
+- tmp = LDDFR_CC | LDDFR_YF_420;
+- break;
+- case V4L2_PIX_FMT_NV16:
+- case V4L2_PIX_FMT_NV61:
+- tmp = LDDFR_CC | LDDFR_YF_422;
+- break;
+- case V4L2_PIX_FMT_NV24:
+- case V4L2_PIX_FMT_NV42:
+- tmp = LDDFR_CC | LDDFR_YF_444;
+- break;
+- }
++ fourcc = sh_mobile_format_fourcc(&ch->info->var);
++ format = sh_mobile_format_info(fourcc);
++ tmp = format->lddfr;
+
+- if (sh_mobile_format_is_yuv(&ch->info->var)) {
++ if (format->yuv) {
+ switch (ch->info->var.colorspace) {
+ case V4L2_COLORSPACE_REC709:
+ tmp |= LDDFR_CF1;
+@@ -711,7 +755,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ lcdc_write_chan(ch, LDDFR, tmp);
+ lcdc_write_chan(ch, LDMLSR, ch->pitch);
+ lcdc_write_chan(ch, LDSA1R, ch->base_addr_y);
+- if (sh_mobile_format_is_yuv(&ch->info->var))
++ if (format->yuv)
+ lcdc_write_chan(ch, LDSA2R, ch->base_addr_c);
+
+ /* When using deferred I/O mode, configure the LCDC for one-shot
+@@ -1228,32 +1272,17 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ var->yres_virtual = var->yres;
+
+ if (sh_mobile_format_is_fourcc(var)) {
+- switch (var->grayscale) {
+- case V4L2_PIX_FMT_NV12:
+- case V4L2_PIX_FMT_NV21:
+- var->bits_per_pixel = 12;
+- break;
+- case V4L2_PIX_FMT_RGB565:
+- case V4L2_PIX_FMT_NV16:
+- case V4L2_PIX_FMT_NV61:
+- var->bits_per_pixel = 16;
+- break;
+- case V4L2_PIX_FMT_BGR24:
+- case V4L2_PIX_FMT_NV24:
+- case V4L2_PIX_FMT_NV42:
+- var->bits_per_pixel = 24;
+- break;
+- case V4L2_PIX_FMT_BGR32:
+- var->bits_per_pixel = 32;
+- break;
+- default:
++ const struct sh_mobile_lcdc_format_info *format;
++
++ format = sh_mobile_format_info(var->grayscale);
++ if (format == NULL)
+ return -EINVAL;
+- }
++ var->bits_per_pixel = format->bpp;
+
+ /* Default to RGB and JPEG color-spaces for RGB and YUV formats
+ * respectively.
+ */
+- if (!sh_mobile_format_is_yuv(var))
++ if (!format->yuv)
+ var->colorspace = V4L2_COLORSPACE_SRGB;
+ else if (var->colorspace != V4L2_COLORSPACE_REC709)
+ var->colorspace = V4L2_COLORSPACE_JPEG;
+@@ -1665,6 +1694,7 @@ static int __devinit
+ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ struct sh_mobile_lcdc_chan *ch)
+ {
++ const struct sh_mobile_lcdc_format_info *format;
+ struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg;
+ const struct fb_videomode *max_mode;
+ const struct fb_videomode *mode;
+@@ -1679,6 +1709,13 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ mutex_init(&ch->open_lock);
+ ch->notify = sh_mobile_lcdc_display_notify;
+
++ /* Validate the format. */
++ format = sh_mobile_format_info(cfg->fourcc);
++ if (format == NULL) {
++ dev_err(priv->dev, "Invalid FOURCC %08x.\n", cfg->fourcc);
++ return -EINVAL;
++ }
++
+ /* Allocate the frame buffer device. */
+ ch->info = framebuffer_alloc(0, priv->dev);
+ if (!ch->info) {
+@@ -1756,20 +1793,13 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ var->yres_virtual = var->yres * 2;
+ var->activate = FB_ACTIVATE_NOW;
+
+- switch (cfg->fourcc) {
+- case V4L2_PIX_FMT_RGB565:
+- var->bits_per_pixel = 16;
+- break;
+- case V4L2_PIX_FMT_BGR24:
+- var->bits_per_pixel = 24;
+- break;
+- case V4L2_PIX_FMT_BGR32:
+- var->bits_per_pixel = 32;
+- break;
+- default:
++ /* Use the legacy API by default for RGB formats, and the FOURCC API
++ * for YUV formats.
++ */
++ if (!format->yuv)
++ var->bits_per_pixel = format->bpp;
++ else
+ var->grayscale = cfg->fourcc;
+- break;
+- }
+
+ /* Make sure the memory size check won't fail. smem_len is initialized
+ * later based on var.
+@@ -1806,7 +1836,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ cfg->fourcc == V4L2_PIX_FMT_NV21)
+ info->fix.ypanstep = 2;
+
+- if (sh_mobile_format_is_yuv(var)) {
++ if (format->yuv) {
+ info->fix.line_length = var->xres;
+ info->fix.visual = FB_VISUAL_FOURCC;
+ } else {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0177-fbdev-sh_mobile_lcdc-Store-the-format-in-struct-sh_m.patch b/patches.armadillo800eva/0177-fbdev-sh_mobile_lcdc-Store-the-format-in-struct-sh_m.patch
new file mode 100644
index 00000000000000..b8815c65da0c9b
--- /dev/null
+++ b/patches.armadillo800eva/0177-fbdev-sh_mobile_lcdc-Store-the-format-in-struct-sh_m.patch
@@ -0,0 +1,126 @@
+From 71f3e40042bbd466f829cae0a6388f82a989f71b Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 16:05:36 +0100
+Subject: fbdev: sh_mobile_lcdc: Store the format in struct
+ sh_mobile_lcdc_chan
+
+Store the active format in the channel structure, and use it instead of
+parsing info->var all over the place when the format is needed.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit fc9e78e6b3d2ba2e96426527b8231f6b7c7b7b96)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 21 ++++++++++-----------
+ drivers/video/sh_mobile_lcdcfb.h | 4 +++-
+ 2 files changed, 13 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index c66f0f4..6d8c30b 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -728,20 +728,15 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+
+ /* Setup geometry, format, frame buffer memory and operation mode. */
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+- const struct sh_mobile_lcdc_format_info *format;
+- u32 fourcc;
+-
+ ch = &priv->ch[k];
+ if (!ch->enabled)
+ continue;
+
+ sh_mobile_lcdc_geometry(ch);
+
+- fourcc = sh_mobile_format_fourcc(&ch->info->var);
+- format = sh_mobile_format_info(fourcc);
+- tmp = format->lddfr;
++ tmp = ch->format->lddfr;
+
+- if (format->yuv) {
++ if (ch->format->yuv) {
+ switch (ch->info->var.colorspace) {
+ case V4L2_COLORSPACE_REC709:
+ tmp |= LDDFR_CF1;
+@@ -755,7 +750,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ lcdc_write_chan(ch, LDDFR, tmp);
+ lcdc_write_chan(ch, LDMLSR, ch->pitch);
+ lcdc_write_chan(ch, LDSA1R, ch->base_addr_y);
+- if (format->yuv)
++ if (ch->format->yuv)
+ lcdc_write_chan(ch, LDSA2R, ch->base_addr_c);
+
+ /* When using deferred I/O mode, configure the LCDC for one-shot
+@@ -772,7 +767,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ }
+
+ /* Word and long word swap. */
+- switch (sh_mobile_format_fourcc(&priv->ch[0].info->var)) {
++ switch (priv->ch[0].format->fourcc) {
+ case V4L2_PIX_FMT_RGB565:
+ case V4L2_PIX_FMT_NV21:
+ case V4L2_PIX_FMT_NV61:
+@@ -859,7 +854,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ ch->meram_enabled = 0;
+ }
+
+- switch (sh_mobile_format_fourcc(&ch->info->var)) {
++ switch (ch->format->fourcc) {
+ case V4L2_PIX_FMT_NV12:
+ case V4L2_PIX_FMT_NV21:
+ case V4L2_PIX_FMT_NV16:
+@@ -1065,7 +1060,7 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ + info->var.xres * info->var.yres_virtual
+ + c_offset;
+ /* Set x offset */
+- if (sh_mobile_format_fourcc(&info->var) == V4L2_PIX_FMT_NV24)
++ if (ch->format->fourcc == V4L2_PIX_FMT_NV24)
+ base_addr_c += 2 * var->xoffset;
+ else
+ base_addr_c += var->xoffset;
+@@ -1353,6 +1348,8 @@ static int sh_mobile_set_par(struct fb_info *info)
+ info->fix.line_length = info->var.xres
+ * info->var.bits_per_pixel / 8;
+
++ ch->format = sh_mobile_format_info(sh_mobile_format_fourcc(&info->var));
++
+ ret = sh_mobile_lcdc_start(ch->lcdc);
+ if (ret < 0) {
+ dev_err(info->dev, "%s: unable to restart LCDC\n", __func__);
+@@ -1716,6 +1713,8 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ return -EINVAL;
+ }
+
++ ch->format = format;
++
+ /* Allocate the frame buffer device. */
+ ch->info = framebuffer_alloc(0, priv->dev);
+ if (!ch->info) {
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index 8e0d009..5ef7559 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -17,9 +17,10 @@ enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,
+ struct backlight_device;
+ struct fb_info;
+ struct module;
++struct sh_mobile_lcdc_chan;
+ struct sh_mobile_lcdc_entity;
++struct sh_mobile_lcdc_format_info;
+ struct sh_mobile_lcdc_priv;
+-struct sh_mobile_lcdc_chan;
+
+ #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0
+ #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1
+@@ -70,6 +71,7 @@ struct sh_mobile_lcdc_chan {
+ wait_queue_head_t frame_end_wait;
+ struct completion vsync_completion;
+
++ const struct sh_mobile_lcdc_format_info *format;
+ unsigned long base_addr_y;
+ unsigned long base_addr_c;
+ unsigned int pitch;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0178-fbdev-sh_mobile_lcdc-Split-fb-init-cleanup-from-chan.patch b/patches.armadillo800eva/0178-fbdev-sh_mobile_lcdc-Split-fb-init-cleanup-from-chan.patch
new file mode 100644
index 00000000000000..50e33b7b7a305a
--- /dev/null
+++ b/patches.armadillo800eva/0178-fbdev-sh_mobile_lcdc-Split-fb-init-cleanup-from-chan.patch
@@ -0,0 +1,396 @@
+From 218c715b5e86e0b3fa6b5b52475c103db4cc1422 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 14:37:35 +0100
+Subject: fbdev: sh_mobile_lcdc: Split fb init/cleanup from channel
+ init/cleanup
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit a67f379d3648746be0dab7b616f2fb838ec0fdfb)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 285 +++++++++++++++++++++-----------------
+ drivers/video/sh_mobile_lcdcfb.h | 2 +
+ 2 files changed, 159 insertions(+), 128 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 6d8c30b..1f8dd83 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1427,6 +1427,141 @@ static struct fb_ops sh_mobile_lcdc_ops = {
+ .fb_set_par = sh_mobile_set_par,
+ };
+
++static void
++sh_mobile_lcdc_channel_fb_unregister(struct sh_mobile_lcdc_chan *ch)
++{
++ if (ch->info && ch->info->dev)
++ unregister_framebuffer(ch->info);
++}
++
++static int __devinit
++sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch)
++{
++ struct fb_info *info = ch->info;
++ int ret;
++
++ if (info->fbdefio) {
++ ch->sglist = vmalloc(sizeof(struct scatterlist) *
++ ch->fb_size >> PAGE_SHIFT);
++ if (!ch->sglist) {
++ dev_err(ch->lcdc->dev, "cannot allocate sglist\n");
++ return -ENOMEM;
++ }
++ }
++
++ info->bl_dev = ch->bl;
++
++ ret = register_framebuffer(info);
++ if (ret < 0)
++ return ret;
++
++ dev_info(ch->lcdc->dev, "registered %s/%s as %dx%d %dbpp.\n",
++ dev_name(ch->lcdc->dev), (ch->cfg.chan == LCDC_CHAN_MAINLCD) ?
++ "mainlcd" : "sublcd", info->var.xres, info->var.yres,
++ info->var.bits_per_pixel);
++
++ /* deferred io mode: disable clock to save power */
++ if (info->fbdefio || info->state == FBINFO_STATE_SUSPENDED)
++ sh_mobile_lcdc_clk_off(ch->lcdc);
++
++ return ret;
++}
++
++static void
++sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch)
++{
++ struct fb_info *info = ch->info;
++
++ if (!info || !info->device)
++ return;
++
++ if (ch->sglist)
++ vfree(ch->sglist);
++
++ fb_dealloc_cmap(&info->cmap);
++ framebuffer_release(info);
++}
++
++static int __devinit
++sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
++ const struct fb_videomode *mode,
++ unsigned int num_modes)
++{
++ struct sh_mobile_lcdc_priv *priv = ch->lcdc;
++ struct fb_var_screeninfo *var;
++ struct fb_info *info;
++ int ret;
++
++ /* Allocate and initialize the frame buffer device. Create the modes
++ * list and allocate the color map.
++ */
++ info = framebuffer_alloc(0, priv->dev);
++ if (info == NULL) {
++ dev_err(priv->dev, "unable to allocate fb_info\n");
++ return -ENOMEM;
++ }
++
++ ch->info = info;
++
++ info->flags = FBINFO_FLAG_DEFAULT;
++ info->fbops = &sh_mobile_lcdc_ops;
++ info->device = priv->dev;
++ info->screen_base = ch->fb_mem;
++ info->pseudo_palette = &ch->pseudo_palette;
++ info->par = ch;
++
++ fb_videomode_to_modelist(mode, num_modes, &info->modelist);
++
++ ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
++ if (ret < 0) {
++ dev_err(priv->dev, "unable to allocate cmap\n");
++ return ret;
++ }
++
++ /* Initialize fixed screen information. Restrict pan to 2 lines steps
++ * for NV12 and NV21.
++ */
++ info->fix = sh_mobile_lcdc_fix;
++ info->fix.smem_start = ch->dma_handle;
++ info->fix.smem_len = ch->fb_size;
++ if (ch->format->fourcc == V4L2_PIX_FMT_NV12 ||
++ ch->format->fourcc == V4L2_PIX_FMT_NV21)
++ info->fix.ypanstep = 2;
++
++ /* Initialize variable screen information using the first mode as
++ * default. The default Y virtual resolution is twice the panel size to
++ * allow for double-buffering.
++ */
++ var = &info->var;
++ fb_videomode_to_var(var, mode);
++ var->width = ch->cfg.panel_cfg.width;
++ var->height = ch->cfg.panel_cfg.height;
++ var->yres_virtual = var->yres * 2;
++ var->activate = FB_ACTIVATE_NOW;
++
++ /* Use the legacy API by default for RGB formats, and the FOURCC API
++ * for YUV formats.
++ */
++ if (!ch->format->yuv)
++ var->bits_per_pixel = ch->format->bpp;
++ else
++ var->grayscale = ch->format->fourcc;
++
++ ret = sh_mobile_check_var(var, info);
++ if (ret)
++ return ret;
++
++ if (ch->format->yuv) {
++ info->fix.line_length = var->xres;
++ info->fix.visual = FB_VISUAL_FOURCC;
++ } else {
++ info->fix.line_length = var->xres * ch->format->bpp / 8;
++ info->fix.visual = FB_VISUAL_TRUECOLOR;
++ }
++
++ return 0;
++}
++
+ /* -----------------------------------------------------------------------------
+ * Backlight
+ */
+@@ -1595,37 +1730,28 @@ static const struct fb_videomode default_720p __devinitconst = {
+ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+ {
+ struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
+- struct fb_info *info;
+ int i;
+
+ fb_unregister_client(&priv->notifier);
+
+ for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
+- if (priv->ch[i].info && priv->ch[i].info->dev)
+- unregister_framebuffer(priv->ch[i].info);
++ sh_mobile_lcdc_channel_fb_unregister(&priv->ch[i]);
+
+ sh_mobile_lcdc_stop(priv);
+
+ for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
+ struct sh_mobile_lcdc_chan *ch = &priv->ch[i];
+
+- info = ch->info;
+- if (!info || !info->device)
+- continue;
+-
+ if (ch->tx_dev) {
+ ch->tx_dev->lcdc = NULL;
+ module_put(ch->cfg.tx_dev->dev.driver->owner);
+ }
+
+- if (ch->sglist)
+- vfree(ch->sglist);
++ sh_mobile_lcdc_channel_fb_cleanup(ch);
+
+- if (info->screen_base)
+- dma_free_coherent(&pdev->dev, info->fix.smem_len,
+- info->screen_base, ch->dma_handle);
+- fb_dealloc_cmap(&info->cmap);
+- framebuffer_release(info);
++ if (ch->fb_mem)
++ dma_free_coherent(&pdev->dev, ch->fb_size,
++ ch->fb_mem, ch->dma_handle);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
+@@ -1695,13 +1821,9 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg;
+ const struct fb_videomode *max_mode;
+ const struct fb_videomode *mode;
+- struct fb_var_screeninfo *var;
+- struct fb_info *info;
++ unsigned int num_modes;
+ unsigned int max_size;
+- int num_modes;
+- void *buf;
+- int ret;
+- int i;
++ unsigned int i;
+
+ mutex_init(&ch->open_lock);
+ ch->notify = sh_mobile_lcdc_display_notify;
+@@ -1715,19 +1837,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+
+ ch->format = format;
+
+- /* Allocate the frame buffer device. */
+- ch->info = framebuffer_alloc(0, priv->dev);
+- if (!ch->info) {
+- dev_err(priv->dev, "unable to allocate fb_info\n");
+- return -ENOMEM;
+- }
+-
+- info = ch->info;
+- info->fbops = &sh_mobile_lcdc_ops;
+- info->par = ch;
+- info->pseudo_palette = &ch->pseudo_palette;
+- info->flags = FBINFO_FLAG_DEFAULT;
+-
+ /* Iterate through the modes to validate them and find the highest
+ * resolution.
+ */
+@@ -1757,7 +1866,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ dev_dbg(priv->dev, "Found largest videomode %ux%u\n",
+ max_mode->xres, max_mode->yres);
+
+- /* Create the mode list. */
+ if (cfg->lcd_modes == NULL) {
+ mode = &default_720p;
+ num_modes = 1;
+@@ -1766,7 +1874,18 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ num_modes = cfg->num_modes;
+ }
+
+- fb_videomode_to_modelist(mode, num_modes, &info->modelist);
++ ch->display.width = cfg->panel_cfg.width;
++ ch->display.height = cfg->panel_cfg.height;
++ ch->display.mode = *mode;
++
++ /* Allocate frame buffer memory. */
++ ch->fb_size = max_size * format->bpp / 8 * 2;
++ ch->fb_mem = dma_alloc_coherent(priv->dev, ch->fb_size, &ch->dma_handle,
++ GFP_KERNEL);
++ if (ch->fb_mem == NULL) {
++ dev_err(priv->dev, "unable to allocate buffer\n");
++ return -ENOMEM;
++ }
+
+ /* Initialize the transmitter device if present. */
+ if (cfg->tx_dev) {
+@@ -1781,76 +1900,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ ch->tx_dev->def_mode = *mode;
+ }
+
+- /* Initialize variable screen information using the first mode as
+- * default. The default Y virtual resolution is twice the panel size to
+- * allow for double-buffering.
+- */
+- var = &info->var;
+- fb_videomode_to_var(var, mode);
+- var->width = cfg->panel_cfg.width;
+- var->height = cfg->panel_cfg.height;
+- var->yres_virtual = var->yres * 2;
+- var->activate = FB_ACTIVATE_NOW;
+-
+- /* Use the legacy API by default for RGB formats, and the FOURCC API
+- * for YUV formats.
+- */
+- if (!format->yuv)
+- var->bits_per_pixel = format->bpp;
+- else
+- var->grayscale = cfg->fourcc;
+-
+- /* Make sure the memory size check won't fail. smem_len is initialized
+- * later based on var.
+- */
+- info->fix.smem_len = UINT_MAX;
+- ret = sh_mobile_check_var(var, info);
+- if (ret)
+- return ret;
+-
+- max_size = max_size * var->bits_per_pixel / 8 * 2;
+-
+- /* Allocate frame buffer memory and color map. */
+- buf = dma_alloc_coherent(priv->dev, max_size, &ch->dma_handle,
+- GFP_KERNEL);
+- if (!buf) {
+- dev_err(priv->dev, "unable to allocate buffer\n");
+- return -ENOMEM;
+- }
+-
+- ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
+- if (ret < 0) {
+- dev_err(priv->dev, "unable to allocate cmap\n");
+- dma_free_coherent(priv->dev, max_size, buf, ch->dma_handle);
+- return ret;
+- }
+-
+- /* Initialize fixed screen information. Restrict pan to 2 lines steps
+- * for NV12 and NV21.
+- */
+- info->fix = sh_mobile_lcdc_fix;
+- info->fix.smem_start = ch->dma_handle;
+- info->fix.smem_len = max_size;
+- if (cfg->fourcc == V4L2_PIX_FMT_NV12 ||
+- cfg->fourcc == V4L2_PIX_FMT_NV21)
+- info->fix.ypanstep = 2;
+-
+- if (format->yuv) {
+- info->fix.line_length = var->xres;
+- info->fix.visual = FB_VISUAL_FOURCC;
+- } else {
+- info->fix.line_length = var->xres * var->bits_per_pixel / 8;
+- info->fix.visual = FB_VISUAL_TRUECOLOR;
+- }
+-
+- info->screen_base = buf;
+- info->device = priv->dev;
+-
+- ch->display.width = cfg->panel_cfg.width;
+- ch->display.height = cfg->panel_cfg.height;
+- ch->display.mode = *mode;
+-
+- return 0;
++ return sh_mobile_lcdc_channel_fb_init(ch, mode, num_modes);
+ }
+
+ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+@@ -1966,31 +2016,10 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+
+ for (i = 0; i < num_channels; i++) {
+ struct sh_mobile_lcdc_chan *ch = priv->ch + i;
+- struct fb_info *info = ch->info;
+-
+- if (info->fbdefio) {
+- ch->sglist = vmalloc(sizeof(struct scatterlist) *
+- info->fix.smem_len >> PAGE_SHIFT);
+- if (!ch->sglist) {
+- dev_err(&pdev->dev, "cannot allocate sglist\n");
+- goto err1;
+- }
+- }
+
+- info->bl_dev = ch->bl;
+-
+- error = register_framebuffer(info);
+- if (error < 0)
++ error = sh_mobile_lcdc_channel_fb_register(ch);
++ if (error)
+ goto err1;
+-
+- dev_info(&pdev->dev, "registered %s/%s as %dx%d %dbpp.\n",
+- pdev->name, (ch->cfg.chan == LCDC_CHAN_MAINLCD) ?
+- "mainlcd" : "sublcd", info->var.xres, info->var.yres,
+- info->var.bits_per_pixel);
+-
+- /* deferred io mode: disable clock to save power */
+- if (info->fbdefio || info->state == FBINFO_STATE_SUSPENDED)
+- sh_mobile_lcdc_clk_off(priv);
+ }
+
+ /* Failure ignored */
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index 5ef7559..cc22b9e 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -64,6 +64,8 @@ struct sh_mobile_lcdc_chan {
+ struct mutex open_lock; /* protects the use counter */
+ int use_count;
+
++ void *fb_mem;
++ unsigned long fb_size;
+ dma_addr_t dma_handle;
+ unsigned long pan_offset;
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0179-fbdev-sh_mobile_lcdc-Pass-physical-device-pointer-to.patch b/patches.armadillo800eva/0179-fbdev-sh_mobile_lcdc-Pass-physical-device-pointer-to.patch
new file mode 100644
index 00000000000000..db0c9f199f34ed
--- /dev/null
+++ b/patches.armadillo800eva/0179-fbdev-sh_mobile_lcdc-Pass-physical-device-pointer-to.patch
@@ -0,0 +1,38 @@
+From 856a88bd9aaccdbce8d98adf7b85bd58422cc86d Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 29 Nov 2011 14:37:35 +0100
+Subject: fbdev: sh_mobile_lcdc: Pass physical device pointer to DMA functions
+
+The dma_map_sg() and dma_unmap_sg() functions need a pointer to the
+physical device.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit e8363140c02c92c122210e03103aef72dd836664)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 1f8dd83..fc12e37 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -313,11 +313,12 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info,
+ unsigned int nr_pages = sh_mobile_lcdc_sginit(info, pagelist);
+
+ /* trigger panel update */
+- dma_map_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
++ dma_map_sg(ch->lcdc->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
+ if (panel->start_transfer)
+ panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
+ lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
+- dma_unmap_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
++ dma_unmap_sg(ch->lcdc->dev, ch->sglist, nr_pages,
++ DMA_TO_DEVICE);
+ } else {
+ if (panel->start_transfer)
+ panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0180-fbdev-sh_mobile_lcdc-Store-configuration-in-channel-.patch b/patches.armadillo800eva/0180-fbdev-sh_mobile_lcdc-Store-configuration-in-channel-.patch
new file mode 100644
index 00000000000000..15e721bb1cd16c
--- /dev/null
+++ b/patches.armadillo800eva/0180-fbdev-sh_mobile_lcdc-Store-configuration-in-channel-.patch
@@ -0,0 +1,278 @@
+From 7d659e1a7850c113bb68b5f49600d2682ab5be26 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 30 Nov 2011 23:07:30 +0100
+Subject: fbdev: sh_mobile_lcdc: Store configuration in channel structure
+
+Store the frame buffer configuration (colorspace, visible/virtual
+horizontal and vertical resolutions and line pitch) in the
+sh_mobile_lcdc_chan structure, and use it instead of accessing fb_info.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 58f03d998de08bb15ce50ad875e41bdc281d77dd)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 109 +++++++++++++++++++-------------------
+ drivers/video/sh_mobile_lcdcfb.h | 8 ++-
+ 2 files changed, 61 insertions(+), 56 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index fc12e37..6d377b4 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -273,7 +273,7 @@ static int sh_mobile_lcdc_sginit(struct fb_info *info,
+ struct list_head *pagelist)
+ {
+ struct sh_mobile_lcdc_chan *ch = info->par;
+- unsigned int nr_pages_max = info->fix.smem_len >> PAGE_SHIFT;
++ unsigned int nr_pages_max = ch->fb_size >> PAGE_SHIFT;
+ struct page *page;
+ int nr_pages = 0;
+
+@@ -541,17 +541,6 @@ static int sh_mobile_format_is_fourcc(const struct fb_var_screeninfo *var)
+ return var->grayscale > 1;
+ }
+
+-static bool sh_mobile_format_is_yuv(const struct fb_var_screeninfo *var)
+-{
+- const struct sh_mobile_lcdc_format_info *format;
+-
+- if (var->grayscale <= 1)
+- return false;
+-
+- format = sh_mobile_format_info(var->grayscale);
+- return format ? format->yuv : false;
+-}
+-
+ /* -----------------------------------------------------------------------------
+ * Start, stop and IRQ
+ */
+@@ -650,7 +639,7 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
+ h_total = mode->xres + mode->hsync_len + mode->left_margin
+ + mode->right_margin;
+ tmp = h_total / 8; /* HTCN */
+- tmp |= (min(mode->xres, var->xres) / 8) << 16; /* HDCN */
++ tmp |= (min(mode->xres, ch->xres) / 8) << 16; /* HDCN */
+ lcdc_write_chan(ch, LDHCNR, tmp);
+
+ hsync_pos = mode->xres + mode->right_margin;
+@@ -661,7 +650,7 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
+ /* vertical configuration */
+ tmp = mode->yres + mode->vsync_len + mode->upper_margin
+ + mode->lower_margin; /* VTLN */
+- tmp |= min(mode->yres, var->yres) << 16; /* VDLN */
++ tmp |= min(mode->yres, ch->yres) << 16; /* VDLN */
+ lcdc_write_chan(ch, LDVLNR, tmp);
+
+ tmp = mode->yres + mode->lower_margin; /* VSYNP */
+@@ -738,7 +727,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ tmp = ch->format->lddfr;
+
+ if (ch->format->yuv) {
+- switch (ch->info->var.colorspace) {
++ switch (ch->colorspace) {
+ case V4L2_COLORSPACE_REC709:
+ tmp |= LDDFR_CF1;
+ break;
+@@ -836,11 +825,8 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ if (!ch->enabled)
+ continue;
+
+- ch->base_addr_y = ch->info->fix.smem_start;
+- ch->base_addr_c = ch->base_addr_y
+- + ch->info->var.xres
+- * ch->info->var.yres_virtual;
+- ch->pitch = ch->info->fix.line_length;
++ ch->base_addr_y = ch->dma_handle;
++ ch->base_addr_c = ch->base_addr_y + ch->xres * ch->yres_virtual;
+
+ /* Enable MERAM if possible. */
+ cfg = ch->cfg.meram_cfg;
+@@ -875,7 +861,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ }
+
+ ret = mdev->ops->meram_register(mdev, cfg, ch->pitch,
+- ch->info->var.yres, pixelformat,
++ ch->yres, pixelformat,
+ ch->base_addr_y, ch->base_addr_c,
+ &ch->base_addr_y, &ch->base_addr_c,
+ &ch->pitch);
+@@ -1037,14 +1023,12 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ unsigned long new_pan_offset;
+ unsigned long base_addr_y, base_addr_c;
+ unsigned long c_offset;
+- bool yuv = sh_mobile_format_is_yuv(&info->var);
+
+- if (!yuv)
+- new_pan_offset = var->yoffset * info->fix.line_length
+- + var->xoffset * (info->var.bits_per_pixel / 8);
++ if (!ch->format->yuv)
++ new_pan_offset = var->yoffset * ch->pitch
++ + var->xoffset * (ch->format->bpp / 8);
+ else
+- new_pan_offset = var->yoffset * info->fix.line_length
+- + var->xoffset;
++ new_pan_offset = var->yoffset * ch->pitch + var->xoffset;
+
+ if (new_pan_offset == ch->pan_offset)
+ return 0; /* No change, do nothing */
+@@ -1053,12 +1037,11 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+
+ /* Set the source address for the next refresh */
+ base_addr_y = ch->dma_handle + new_pan_offset;
+- if (yuv) {
++ if (ch->format->yuv) {
+ /* Set y offset */
+- c_offset = var->yoffset * info->fix.line_length
+- * (info->var.bits_per_pixel - 8) / 8;
+- base_addr_c = ch->dma_handle
+- + info->var.xres * info->var.yres_virtual
++ c_offset = var->yoffset * ch->pitch
++ * (ch->format->bpp - 8) / 8;
++ base_addr_c = ch->dma_handle + ch->xres * ch->yres_virtual
+ + c_offset;
+ /* Set x offset */
+ if (ch->format->fourcc == V4L2_PIX_FMT_NV24)
+@@ -1085,7 +1068,7 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ ch->base_addr_c = base_addr_c;
+
+ lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y);
+- if (yuv)
++ if (ch->format->yuv)
+ lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c);
+
+ if (lcdc_chan_is_sublcd(ch))
+@@ -1338,24 +1321,28 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ static int sh_mobile_set_par(struct fb_info *info)
+ {
+ struct sh_mobile_lcdc_chan *ch = info->par;
+- u32 line_length = info->fix.line_length;
+ int ret;
+
+ sh_mobile_lcdc_stop(ch->lcdc);
+
+- if (sh_mobile_format_is_yuv(&info->var))
+- info->fix.line_length = info->var.xres;
+- else
+- info->fix.line_length = info->var.xres
+- * info->var.bits_per_pixel / 8;
+-
+ ch->format = sh_mobile_format_info(sh_mobile_format_fourcc(&info->var));
++ ch->colorspace = info->var.colorspace;
++
++ ch->xres = info->var.xres;
++ ch->xres_virtual = info->var.xres_virtual;
++ ch->yres = info->var.yres;
++ ch->yres_virtual = info->var.yres_virtual;
++
++ if (ch->format->yuv)
++ ch->pitch = info->var.xres;
++ else
++ ch->pitch = info->var.xres * ch->format->bpp / 8;
+
+ ret = sh_mobile_lcdc_start(ch->lcdc);
+- if (ret < 0) {
++ if (ret < 0)
+ dev_err(info->dev, "%s: unable to restart LCDC\n", __func__);
+- info->fix.line_length = line_length;
+- }
++
++ info->fix.line_length = ch->pitch;
+
+ if (sh_mobile_format_is_fourcc(&info->var)) {
+ info->fix.type = FB_TYPE_FOURCC;
+@@ -1384,8 +1371,8 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
+ /* blank the screen? */
+ if (blank > FB_BLANK_UNBLANK && ch->blank_status == FB_BLANK_UNBLANK) {
+ struct fb_fillrect rect = {
+- .width = info->var.xres,
+- .height = info->var.yres,
++ .width = ch->xres,
++ .height = ch->yres,
+ };
+ sh_mobile_lcdc_fillrect(info, &rect);
+ }
+@@ -1525,6 +1512,13 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
+ info->fix = sh_mobile_lcdc_fix;
+ info->fix.smem_start = ch->dma_handle;
+ info->fix.smem_len = ch->fb_size;
++ info->fix.line_length = ch->pitch;
++
++ if (ch->format->yuv)
++ info->fix.visual = FB_VISUAL_FOURCC;
++ else
++ info->fix.visual = FB_VISUAL_TRUECOLOR;
++
+ if (ch->format->fourcc == V4L2_PIX_FMT_NV12 ||
+ ch->format->fourcc == V4L2_PIX_FMT_NV21)
+ info->fix.ypanstep = 2;
+@@ -1552,14 +1546,6 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
+ if (ret)
+ return ret;
+
+- if (ch->format->yuv) {
+- info->fix.line_length = var->xres;
+- info->fix.visual = FB_VISUAL_FOURCC;
+- } else {
+- info->fix.line_length = var->xres * ch->format->bpp / 8;
+- info->fix.visual = FB_VISUAL_TRUECOLOR;
+- }
+-
+ return 0;
+ }
+
+@@ -1836,8 +1822,6 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ return -EINVAL;
+ }
+
+- ch->format = format;
+-
+ /* Iterate through the modes to validate them and find the highest
+ * resolution.
+ */
+@@ -1875,6 +1859,21 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ num_modes = cfg->num_modes;
+ }
+
++ /* Use the first mode as default. */
++ ch->format = format;
++ ch->xres = mode->xres;
++ ch->xres_virtual = mode->xres;
++ ch->yres = mode->yres;
++ ch->yres_virtual = mode->yres * 2;
++
++ if (!format->yuv) {
++ ch->colorspace = V4L2_COLORSPACE_SRGB;
++ ch->pitch = ch->xres * format->bpp / 8;
++ } else {
++ ch->colorspace = V4L2_COLORSPACE_REC709;
++ ch->pitch = ch->xres;
++ }
++
+ ch->display.width = cfg->panel_cfg.width;
+ ch->display.height = cfg->panel_cfg.height;
+ ch->display.mode = *mode;
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index cc22b9e..19a4cd7 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -74,9 +74,15 @@ struct sh_mobile_lcdc_chan {
+ struct completion vsync_completion;
+
+ const struct sh_mobile_lcdc_format_info *format;
++ u32 colorspace;
++ unsigned int xres;
++ unsigned int xres_virtual;
++ unsigned int yres;
++ unsigned int yres_virtual;
++ unsigned int pitch;
++
+ unsigned long base_addr_y;
+ unsigned long base_addr_c;
+- unsigned int pitch;
+
+ int (*notify)(struct sh_mobile_lcdc_chan *ch,
+ enum sh_mobile_lcdc_entity_event event,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0181-fbdev-sh_mobile_lcdc-Pass-channel-pointer-to-sh_mobi.patch b/patches.armadillo800eva/0181-fbdev-sh_mobile_lcdc-Pass-channel-pointer-to-sh_mobi.patch
new file mode 100644
index 00000000000000..529d8fc9b07723
--- /dev/null
+++ b/patches.armadillo800eva/0181-fbdev-sh_mobile_lcdc-Pass-channel-pointer-to-sh_mobi.patch
@@ -0,0 +1,100 @@
+From 365ac6c239a1902178990d3b2488dadbad2f777c Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 30 Nov 2011 23:07:30 +0100
+Subject: fbdev: sh_mobile_lcdc: Pass channel pointer to
+ sh_mobile_wait_for_vsync
+
+The sh_mobile_wait_for_vsync() function isn't related to the fbdev API,
+make it generic by passing a channel pointer instead of an fb_info
+pointer.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 4976677f4d34df74d7207cae934b27f5d86feace)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 47 +++++++++++++++++++-------------------
+ 1 file changed, 23 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 6d377b4..adc911f 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -585,6 +585,26 @@ static irqreturn_t sh_mobile_lcdc_irq(int irq, void *data)
+ return IRQ_HANDLED;
+ }
+
++static int sh_mobile_wait_for_vsync(struct sh_mobile_lcdc_chan *ch)
++{
++ unsigned long ldintr;
++ int ret;
++
++ /* Enable VSync End interrupt and be careful not to acknowledge any
++ * pending interrupt.
++ */
++ ldintr = lcdc_read(ch->lcdc, _LDINTR);
++ ldintr |= LDINTR_VEE | LDINTR_STATUS_MASK;
++ lcdc_write(ch->lcdc, _LDINTR, ldintr);
++
++ ret = wait_for_completion_interruptible_timeout(&ch->vsync_completion,
++ msecs_to_jiffies(100));
++ if (!ret)
++ return -ETIMEDOUT;
++
++ return 0;
++}
++
+ static void sh_mobile_lcdc_start_stop(struct sh_mobile_lcdc_priv *priv,
+ int start)
+ {
+@@ -1083,27 +1103,6 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ return 0;
+ }
+
+-static int sh_mobile_wait_for_vsync(struct fb_info *info)
+-{
+- struct sh_mobile_lcdc_chan *ch = info->par;
+- unsigned long ldintr;
+- int ret;
+-
+- /* Enable VSync End interrupt and be careful not to acknowledge any
+- * pending interrupt.
+- */
+- ldintr = lcdc_read(ch->lcdc, _LDINTR);
+- ldintr |= LDINTR_VEE | LDINTR_STATUS_MASK;
+- lcdc_write(ch->lcdc, _LDINTR, ldintr);
+-
+- ret = wait_for_completion_interruptible_timeout(&ch->vsync_completion,
+- msecs_to_jiffies(100));
+- if (!ret)
+- return -ETIMEDOUT;
+-
+- return 0;
+-}
+-
+ static int sh_mobile_ioctl(struct fb_info *info, unsigned int cmd,
+ unsigned long arg)
+ {
+@@ -1111,7 +1110,7 @@ static int sh_mobile_ioctl(struct fb_info *info, unsigned int cmd,
+
+ switch (cmd) {
+ case FBIO_WAITFORVSYNC:
+- retval = sh_mobile_wait_for_vsync(info);
++ retval = sh_mobile_wait_for_vsync(info->par);
+ break;
+
+ default:
+@@ -1388,8 +1387,8 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
+ * mode will reenable the clocks and update the screen in time,
+ * so it does not need this. */
+ if (!info->fbdefio) {
+- sh_mobile_wait_for_vsync(info);
+- sh_mobile_wait_for_vsync(info);
++ sh_mobile_wait_for_vsync(ch);
++ sh_mobile_wait_for_vsync(ch);
+ }
+ sh_mobile_lcdc_clk_off(p);
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0182-fbdev-sh_mobile_meram-Request-memory-regions-for-mem.patch b/patches.armadillo800eva/0182-fbdev-sh_mobile_meram-Request-memory-regions-for-mem.patch
new file mode 100644
index 00000000000000..a6aa35ac3ff09b
--- /dev/null
+++ b/patches.armadillo800eva/0182-fbdev-sh_mobile_meram-Request-memory-regions-for-mem.patch
@@ -0,0 +1,127 @@
+From b7bde9b546d8f18367982ef055ba833b8107e542 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 19 Sep 2011 11:40:31 +0200
+Subject: fbdev: sh_mobile_meram: Request memory regions for memory resources
+
+Make sure the registers and MERAM spaces are reserved before using them.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit e1d1144eb92e69394958e59ff2a0fd22d58094d4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 53 +++++++++++++++++++++++++++------------
+ 1 file changed, 37 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index f45d83e..dbf5c43 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -596,13 +596,12 @@ static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
+ * initialize MERAM
+ */
+
+-static int sh_mobile_meram_remove(struct platform_device *pdev);
+-
+ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+ {
+ struct sh_mobile_meram_priv *priv;
+ struct sh_mobile_meram_info *pdata = pdev->dev.platform_data;
+- struct resource *res;
++ struct resource *regs;
++ struct resource *meram;
+ int error;
+
+ if (!pdata) {
+@@ -610,8 +609,9 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+ return -EINVAL;
+ }
+
+- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- if (!res) {
++ regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ meram = platform_get_resource(pdev, IORESOURCE_MEM, 1);
++ if (regs == NULL || meram == NULL) {
+ dev_err(&pdev->dev, "cannot get platform resources\n");
+ return -ENOENT;
+ }
+@@ -622,32 +622,50 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+ return -ENOMEM;
+ }
+
+- platform_set_drvdata(pdev, priv);
+-
+ /* initialize private data */
+ mutex_init(&priv->lock);
+- priv->base = ioremap_nocache(res->start, resource_size(res));
++ pdata->ops = &sh_mobile_meram_ops;
++ pdata->priv = priv;
++ pdata->pdev = pdev;
++
++ if (!request_mem_region(regs->start, resource_size(regs), pdev->name)) {
++ dev_err(&pdev->dev, "MERAM registers region already claimed\n");
++ error = -EBUSY;
++ goto err_req_regs;
++ }
++
++ if (!request_mem_region(meram->start, resource_size(meram),
++ pdev->name)) {
++ dev_err(&pdev->dev, "MERAM memory region already claimed\n");
++ error = -EBUSY;
++ goto err_req_meram;
++ }
++
++ priv->base = ioremap_nocache(regs->start, resource_size(regs));
+ if (!priv->base) {
+ dev_err(&pdev->dev, "ioremap failed\n");
+ error = -EFAULT;
+- goto err;
++ goto err_ioremap;
+ }
+- pdata->ops = &sh_mobile_meram_ops;
+- pdata->priv = priv;
+- pdata->pdev = pdev;
+
+ /* initialize ICB addressing mode */
+ if (pdata->addr_mode == SH_MOBILE_MERAM_MODE1)
+ meram_write_reg(priv->base, MEVCR1, MEVCR1_AMD1);
+
++ platform_set_drvdata(pdev, priv);
+ pm_runtime_enable(&pdev->dev);
+
+ dev_info(&pdev->dev, "sh_mobile_meram initialized.");
+
+ return 0;
+
+-err:
+- sh_mobile_meram_remove(pdev);
++err_ioremap:
++ release_mem_region(meram->start, resource_size(meram));
++err_req_meram:
++ release_mem_region(regs->start, resource_size(regs));
++err_req_regs:
++ mutex_destroy(&priv->lock);
++ kfree(priv);
+
+ return error;
+ }
+@@ -656,11 +674,14 @@ err:
+ static int sh_mobile_meram_remove(struct platform_device *pdev)
+ {
+ struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
++ struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ struct resource *meram = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+
+ pm_runtime_disable(&pdev->dev);
+
+- if (priv->base)
+- iounmap(priv->base);
++ iounmap(priv->base);
++ release_mem_region(meram->start, resource_size(meram));
++ release_mem_region(regs->start, resource_size(regs));
+
+ mutex_destroy(&priv->lock);
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0183-fbdev-sh_mobile_meram-Add-_cfg-suffix-to-struct-sh_m.patch b/patches.armadillo800eva/0183-fbdev-sh_mobile_meram-Add-_cfg-suffix-to-struct-sh_m.patch
new file mode 100644
index 00000000000000..0fb53d3090d49d
--- /dev/null
+++ b/patches.armadillo800eva/0183-fbdev-sh_mobile_meram-Add-_cfg-suffix-to-struct-sh_m.patch
@@ -0,0 +1,102 @@
+From 610b8ff9f3751459a209dd2c961279e9524f2e4c Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 19 Sep 2011 11:40:31 +0200
+Subject: fbdev: sh_mobile_meram: Add _cfg suffix to struct
+ sh_mobile_meram_icb
+
+The structure describe ICB configuration, no ICB objects themselves.
+Rename it to sh_mobile_meram_icb_cfg in preparation for the addition of
+an ICB structure.
+
+All the structure fields are unsigned integers, make them so.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit d272f428fac77ec57049a3293583ab3353928b1c)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 10 +++++-----
+ include/video/sh_mobile_meram.h | 14 +++++++-------
+ 2 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index dbf5c43..2ad5a45 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -156,7 +156,7 @@ static inline unsigned long meram_read_reg(void __iomem *base, int off)
+ */
+
+ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb *new)
++ struct sh_mobile_meram_icb_cfg *new)
+ {
+ int i;
+ int used_start, used_end, meram_start, meram_end;
+@@ -188,7 +188,7 @@ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ */
+
+ static inline void meram_mark(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb *new)
++ struct sh_mobile_meram_icb_cfg *new)
+ {
+ int n;
+
+@@ -211,7 +211,7 @@ static inline void meram_mark(struct sh_mobile_meram_priv *priv,
+ */
+
+ static inline void meram_unmark(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb *icb)
++ struct sh_mobile_meram_icb_cfg *icb)
+ {
+ int i;
+ unsigned long pattern;
+@@ -303,7 +303,7 @@ static inline void meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+ */
+
+ static int meram_init(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb *icb,
++ struct sh_mobile_meram_icb_cfg *icb,
+ int xres, int yres, int *out_pitch)
+ {
+ unsigned long total_byte_count = MERAM_CALC_BYTECOUNT(xres, yres);
+@@ -370,7 +370,7 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ }
+
+ static void meram_deinit(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb *icb)
++ struct sh_mobile_meram_icb_cfg *icb)
+ {
+ /* disable ICB */
+ meram_write_icb(priv->base, icb->cache_icb, MExxCTL,
+diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
+index af602d6..caae558 100644
+--- a/include/video/sh_mobile_meram.h
++++ b/include/video/sh_mobile_meram.h
+@@ -25,17 +25,17 @@ struct sh_mobile_meram_info {
+ };
+
+ /* icb config */
+-struct sh_mobile_meram_icb {
+- int marker_icb; /* ICB # for Marker ICB */
+- int cache_icb; /* ICB # for Cache ICB */
+- int meram_offset; /* MERAM Buffer Offset to use */
+- int meram_size; /* MERAM Buffer Size to use */
++struct sh_mobile_meram_icb_cfg {
++ unsigned int marker_icb; /* ICB # for Marker ICB */
++ unsigned int cache_icb; /* ICB # for Cache ICB */
++ unsigned int meram_offset; /* MERAM Buffer Offset to use */
++ unsigned int meram_size; /* MERAM Buffer Size to use */
+
+- int cache_unit; /* bytes to cache per ICB */
++ unsigned int cache_unit; /* bytes to cache per ICB */
+ };
+
+ struct sh_mobile_meram_cfg {
+- struct sh_mobile_meram_icb icb[2];
++ struct sh_mobile_meram_icb_cfg icb[2];
+ int pixelformat;
+ int current_reg;
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0184-fbdev-sh_mobile_meram-Make-variables-unsigned-where-.patch b/patches.armadillo800eva/0184-fbdev-sh_mobile_meram-Make-variables-unsigned-where-.patch
new file mode 100644
index 00000000000000..89d41979bfc41f
--- /dev/null
+++ b/patches.armadillo800eva/0184-fbdev-sh_mobile_meram-Make-variables-unsigned-where-.patch
@@ -0,0 +1,219 @@
+From 6ac80761a92140cfed244b8135d45228bf8ed59b Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 19 Sep 2011 11:40:31 +0200
+Subject: fbdev: sh_mobile_meram: Make variables unsigned where applicable
+
+Many variables, such as loop counters, sizes and offsets, should be
+unsigned integers. Make them so.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 05432837ae0dfc6c7de93d081b1377ced4eb866b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 80 +++++++++++++++++++++------------------
+ include/video/sh_mobile_meram.h | 6 ++-
+ 2 files changed, 47 insertions(+), 39 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 2ad5a45..548f700 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -104,7 +104,7 @@ struct sh_mobile_meram_priv {
+ void __iomem *base;
+ struct mutex lock;
+ unsigned long used_icb;
+- int used_meram_cache_regions;
++ unsigned int used_meram_cache_regions;
+ unsigned long used_meram_cache[SH_MOBILE_MERAM_ICB_NUM];
+ unsigned long cmn_saved_regs[CMN_REGS_SIZE];
+ unsigned long icb_saved_regs[ICB_REGS_SIZE * SH_MOBILE_MERAM_ICB_NUM];
+@@ -120,24 +120,25 @@ struct sh_mobile_meram_priv {
+
+ #define MERAM_ICB_OFFSET(base, idx, off) ((base) + (off) + (idx) * 0x20)
+
+-static inline void meram_write_icb(void __iomem *base, int idx, int off,
+- unsigned long val)
++static inline void meram_write_icb(void __iomem *base, unsigned int idx,
++ unsigned int off, unsigned long val)
+ {
+ iowrite32(val, MERAM_ICB_OFFSET(base, idx, off));
+ }
+
+-static inline unsigned long meram_read_icb(void __iomem *base, int idx, int off)
++static inline unsigned long meram_read_icb(void __iomem *base, unsigned int idx,
++ unsigned int off)
+ {
+ return ioread32(MERAM_ICB_OFFSET(base, idx, off));
+ }
+
+-static inline void meram_write_reg(void __iomem *base, int off,
+- unsigned long val)
++static inline void meram_write_reg(void __iomem *base, unsigned int off,
++ unsigned long val)
+ {
+ iowrite32(val, base + off);
+ }
+
+-static inline unsigned long meram_read_reg(void __iomem *base, int off)
++static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off)
+ {
+ return ioread32(base + off);
+ }
+@@ -158,8 +159,8 @@ static inline unsigned long meram_read_reg(void __iomem *base, int off)
+ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ struct sh_mobile_meram_icb_cfg *new)
+ {
+- int i;
+- int used_start, used_end, meram_start, meram_end;
++ unsigned int used_start, used_end, meram_start, meram_end;
++ unsigned int i;
+
+ /* valid ICB? */
+ if (new->marker_icb & ~0x1f || new->cache_icb & ~0x1f)
+@@ -190,7 +191,7 @@ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ static inline void meram_mark(struct sh_mobile_meram_priv *priv,
+ struct sh_mobile_meram_icb_cfg *new)
+ {
+- int n;
++ unsigned int n;
+
+ if (new->marker_icb < 0 || new->cache_icb < 0)
+ return;
+@@ -213,8 +214,8 @@ static inline void meram_mark(struct sh_mobile_meram_priv *priv,
+ static inline void meram_unmark(struct sh_mobile_meram_priv *priv,
+ struct sh_mobile_meram_icb_cfg *icb)
+ {
+- int i;
+ unsigned long pattern;
++ unsigned int i;
+
+ if (icb->marker_icb < 0 || icb->cache_icb < 0)
+ return;
+@@ -304,12 +305,15 @@ static inline void meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+
+ static int meram_init(struct sh_mobile_meram_priv *priv,
+ struct sh_mobile_meram_icb_cfg *icb,
+- int xres, int yres, int *out_pitch)
++ unsigned int xres, unsigned int yres,
++ unsigned int *out_pitch)
+ {
+ unsigned long total_byte_count = MERAM_CALC_BYTECOUNT(xres, yres);
+ unsigned long bnm;
+- int lcdc_pitch, xpitch, line_cnt;
+- int save_lines;
++ unsigned int lcdc_pitch;
++ unsigned int xpitch;
++ unsigned int line_cnt;
++ unsigned int save_lines;
+
+ /* adjust pitch to 1024, 2048, 4096 or 8192 */
+ lcdc_pitch = (xres - 1) | 1023;
+@@ -386,16 +390,18 @@ static void meram_deinit(struct sh_mobile_meram_priv *priv,
+
+ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ struct sh_mobile_meram_cfg *cfg,
+- int xres, int yres, int pixelformat,
++ unsigned int xres, unsigned int yres,
++ unsigned int pixelformat,
+ unsigned long base_addr_y,
+ unsigned long base_addr_c,
+ unsigned long *icb_addr_y,
+ unsigned long *icb_addr_c,
+- int *pitch)
++ unsigned int *pitch)
+ {
+ struct platform_device *pdev;
+ struct sh_mobile_meram_priv *priv;
+- int n, out_pitch;
++ unsigned int out_pitch;
++ unsigned int n;
+ int error = 0;
+
+ if (!pdata || !pdata->priv || !pdata->pdev || !cfg)
+@@ -538,21 +544,21 @@ static int sh_mobile_meram_runtime_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
+- int k, j;
++ unsigned int i, j;
+
+- for (k = 0; k < CMN_REGS_SIZE; k++)
+- priv->cmn_saved_regs[k] = meram_read_reg(priv->base,
+- common_regs[k]);
++ for (i = 0; i < CMN_REGS_SIZE; i++)
++ priv->cmn_saved_regs[i] = meram_read_reg(priv->base,
++ common_regs[i]);
+
+- for (j = 0; j < 32; j++) {
+- if (!test_bit(j, &priv->used_icb))
++ for (i = 0; i < 32; i++) {
++ if (!test_bit(i, &priv->used_icb))
+ continue;
+- for (k = 0; k < ICB_REGS_SIZE; k++) {
+- priv->icb_saved_regs[j * ICB_REGS_SIZE + k] =
+- meram_read_icb(priv->base, j, icb_regs[k]);
++ for (j = 0; j < ICB_REGS_SIZE; j++) {
++ priv->icb_saved_regs[i * ICB_REGS_SIZE + j] =
++ meram_read_icb(priv->base, i, icb_regs[j]);
+ /* Reset ICB on resume */
+- if (icb_regs[k] == MExxCTL)
+- priv->icb_saved_regs[j * ICB_REGS_SIZE + k] |=
++ if (icb_regs[j] == MExxCTL)
++ priv->icb_saved_regs[i * ICB_REGS_SIZE + j] |=
+ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF;
+ }
+ }
+@@ -563,20 +569,20 @@ static int sh_mobile_meram_runtime_resume(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
+- int k, j;
++ unsigned int i, j;
+
+- for (j = 0; j < 32; j++) {
+- if (!test_bit(j, &priv->used_icb))
++ for (i = 0; i < 32; i++) {
++ if (!test_bit(i, &priv->used_icb))
+ continue;
+- for (k = 0; k < ICB_REGS_SIZE; k++) {
+- meram_write_icb(priv->base, j, icb_regs[k],
+- priv->icb_saved_regs[j * ICB_REGS_SIZE + k]);
++ for (j = 0; j < ICB_REGS_SIZE; j++) {
++ meram_write_icb(priv->base, i, icb_regs[j],
++ priv->icb_saved_regs[i * ICB_REGS_SIZE + j]);
+ }
+ }
+
+- for (k = 0; k < CMN_REGS_SIZE; k++)
+- meram_write_reg(priv->base, common_regs[k],
+- priv->cmn_saved_regs[k]);
++ for (i = 0; i < CMN_REGS_SIZE; i++)
++ meram_write_reg(priv->base, common_regs[i],
++ priv->cmn_saved_regs[i]);
+ return 0;
+ }
+
+diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
+index caae558..6755e3f 100644
+--- a/include/video/sh_mobile_meram.h
++++ b/include/video/sh_mobile_meram.h
+@@ -46,11 +46,13 @@ struct sh_mobile_meram_ops {
+ /* register usage of meram */
+ int (*meram_register)(struct sh_mobile_meram_info *meram_dev,
+ struct sh_mobile_meram_cfg *cfg,
+- int xres, int yres, int pixelformat,
++ unsigned int xres, unsigned int yres,
++ unsigned int pixelformat,
+ unsigned long base_addr_y,
+ unsigned long base_addr_c,
+ unsigned long *icb_addr_y,
+- unsigned long *icb_addr_c, int *pitch);
++ unsigned long *icb_addr_c,
++ unsigned int *pitch);
+
+ /* unregister usage of meram */
+ int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0185-fbdev-sh_mobile_meram-Make-current_reg-field-store-t.patch b/patches.armadillo800eva/0185-fbdev-sh_mobile_meram-Make-current_reg-field-store-t.patch
new file mode 100644
index 00000000000000..7b7df7a786f80c
--- /dev/null
+++ b/patches.armadillo800eva/0185-fbdev-sh_mobile_meram-Make-current_reg-field-store-t.patch
@@ -0,0 +1,34 @@
+From e4e4366a35b394fd7ef7940651413be206adb5ff Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 19 Sep 2011 11:40:31 +0200
+Subject: fbdev: sh_mobile_meram: Make current_reg field store the current reg
+ set
+
+Make sure current_reg == 0/1 always mean register set A/B through all
+the code.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit eb4f2304ba029f78516c2fe23213d7e2d0f8d58f)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 548f700..7af2ffe 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -259,8 +259,8 @@ static inline void meram_set_next_addr(struct sh_mobile_meram_priv *priv,
+ {
+ unsigned long target;
+
+- target = (cfg->current_reg) ? MExxSARA : MExxSARB;
+ cfg->current_reg ^= 1;
++ target = cfg->current_reg ? MExxSARB : MExxSARA;
+
+ /* set the next address to fetch */
+ meram_write_icb(priv->base, cfg->icb[0].cache_icb, target,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0186-fbdev-sh_mobile_meram-Add-struct-sh_mobile_meram_icb.patch b/patches.armadillo800eva/0186-fbdev-sh_mobile_meram-Add-struct-sh_mobile_meram_icb.patch
new file mode 100644
index 00000000000000..04ba16dfed7bda
--- /dev/null
+++ b/patches.armadillo800eva/0186-fbdev-sh_mobile_meram-Add-struct-sh_mobile_meram_icb.patch
@@ -0,0 +1,444 @@
+From 9e0c96f06f5d74213714fa03fa9ea1f35ad75cb2 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 19 Sep 2011 11:40:31 +0200
+Subject: fbdev: sh_mobile_meram: Add struct sh_mobile_meram_icb
+
+The new structure stores ICB parameters for ICBs.
+
+Instead of modifying the struct sh_mobile_meram_cfg instances passed by
+callers, store the ICB parameters internally and make the public API
+take const pointers to sh_mobile_meram_cfg.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 2a618e0333f5d1d27bbd4d90d70f07e0a8dc0ba7)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 178 ++++++++++++++++++++-------------------
+ include/video/sh_mobile_meram.h | 12 +--
+ 2 files changed, 94 insertions(+), 96 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 7af2ffe..cddb180 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -100,14 +100,38 @@ static unsigned long icb_regs[] = {
+ };
+ #define ICB_REGS_SIZE ARRAY_SIZE(icb_regs)
+
++/*
++ * sh_mobile_meram_icb - MERAM ICB information
++ * @regs: Registers cache
++ * @region: Start and end addresses of the MERAM region
++ * @cache_unit: Bytes to cache per ICB
++ * @pixelformat: Video pixel format of the data stored in the ICB
++ * @current_reg: Which of Start Address Register A (0) or B (1) is in use
++ */
++struct sh_mobile_meram_icb {
++ unsigned long regs[ICB_REGS_SIZE];
++
++ unsigned long region;
++ unsigned int cache_unit;
++ unsigned int pixelformat;
++ unsigned int current_reg;
++};
++
++/*
++ * sh_mobile_meram_priv - MERAM device
++ * @base: Registers base address
++ * @regs: Registers cache
++ * @lock: Protects used_icb and icbs
++ * @used_icb: Bitmask of used ICBs
++ * @icbs: ICBs
++ */
+ struct sh_mobile_meram_priv {
+- void __iomem *base;
+- struct mutex lock;
+- unsigned long used_icb;
+- unsigned int used_meram_cache_regions;
+- unsigned long used_meram_cache[SH_MOBILE_MERAM_ICB_NUM];
+- unsigned long cmn_saved_regs[CMN_REGS_SIZE];
+- unsigned long icb_saved_regs[ICB_REGS_SIZE * SH_MOBILE_MERAM_ICB_NUM];
++ void __iomem *base;
++ unsigned long regs[CMN_REGS_SIZE];
++
++ struct mutex lock;
++ unsigned long used_icb;
++ struct sh_mobile_meram_icb icbs[SH_MOBILE_MERAM_ICB_NUM];
+ };
+
+ /* settings */
+@@ -157,7 +181,7 @@ static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off)
+ */
+
+ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb_cfg *new)
++ const struct sh_mobile_meram_icb_cfg *new)
+ {
+ unsigned int used_start, used_end, meram_start, meram_end;
+ unsigned int i;
+@@ -167,17 +191,20 @@ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ return 1;
+
+ if (test_bit(new->marker_icb, &priv->used_icb) ||
+- test_bit(new->cache_icb, &priv->used_icb))
++ test_bit(new->cache_icb, &priv->used_icb))
+ return 1;
+
+- for (i = 0; i < priv->used_meram_cache_regions; i++) {
+- used_start = MERAM_CACHE_START(priv->used_meram_cache[i]);
+- used_end = MERAM_CACHE_END(priv->used_meram_cache[i]);
++ for (i = 0; i < SH_MOBILE_MERAM_ICB_NUM; i++) {
++ if (!test_bit(i, &priv->used_icb))
++ continue;
++
++ used_start = MERAM_CACHE_START(priv->icbs[i].region);
++ used_end = MERAM_CACHE_END(priv->icbs[i].region);
+ meram_start = new->meram_offset;
+ meram_end = new->meram_offset + new->meram_size;
+
+ if ((meram_start >= used_start && meram_start < used_end) ||
+- (meram_end > used_start && meram_end < used_end))
++ (meram_end > used_start && meram_end < used_end))
+ return 1;
+ }
+
+@@ -189,22 +216,18 @@ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ */
+
+ static inline void meram_mark(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb_cfg *new)
++ const struct sh_mobile_meram_icb_cfg *new,
++ int pixelformat)
+ {
+- unsigned int n;
+-
+- if (new->marker_icb < 0 || new->cache_icb < 0)
+- return;
+-
+ __set_bit(new->marker_icb, &priv->used_icb);
+ __set_bit(new->cache_icb, &priv->used_icb);
+
+- n = priv->used_meram_cache_regions;
+-
+- priv->used_meram_cache[n] = MERAM_CACHE_SET(new->meram_offset,
+- new->meram_size);
+-
+- priv->used_meram_cache_regions++;
++ priv->icbs[new->marker_icb].region = MERAM_CACHE_SET(new->meram_offset,
++ new->meram_size);
++ priv->icbs[new->cache_icb].region = MERAM_CACHE_SET(new->meram_offset,
++ new->meram_size);
++ priv->icbs[new->marker_icb].current_reg = 1;
++ priv->icbs[new->marker_icb].pixelformat = pixelformat;
+ }
+
+ /*
+@@ -212,30 +235,10 @@ static inline void meram_mark(struct sh_mobile_meram_priv *priv,
+ */
+
+ static inline void meram_unmark(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb_cfg *icb)
++ const struct sh_mobile_meram_icb_cfg *icb)
+ {
+- unsigned long pattern;
+- unsigned int i;
+-
+- if (icb->marker_icb < 0 || icb->cache_icb < 0)
+- return;
+-
+ __clear_bit(icb->marker_icb, &priv->used_icb);
+ __clear_bit(icb->cache_icb, &priv->used_icb);
+-
+- pattern = MERAM_CACHE_SET(icb->meram_offset, icb->meram_size);
+- for (i = 0; i < priv->used_meram_cache_regions; i++) {
+- if (priv->used_meram_cache[i] == pattern) {
+- while (i < priv->used_meram_cache_regions - 1) {
+- priv->used_meram_cache[i] =
+- priv->used_meram_cache[i + 1] ;
+- i++;
+- }
+- priv->used_meram_cache[i] = 0;
+- priv->used_meram_cache_regions--;
+- break;
+- }
+- }
+ }
+
+ /*
+@@ -244,7 +247,7 @@ static inline void meram_unmark(struct sh_mobile_meram_priv *priv,
+ static inline int is_nvcolor(int cspace)
+ {
+ if (cspace == SH_MOBILE_MERAM_PF_NV ||
+- cspace == SH_MOBILE_MERAM_PF_NV24)
++ cspace == SH_MOBILE_MERAM_PF_NV24)
+ return 1;
+ return 0;
+ }
+@@ -253,46 +256,51 @@ static inline int is_nvcolor(int cspace)
+ * set the next address to fetch
+ */
+ static inline void meram_set_next_addr(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_cfg *cfg,
++ const struct sh_mobile_meram_cfg *cfg,
+ unsigned long base_addr_y,
+ unsigned long base_addr_c)
+ {
++ struct sh_mobile_meram_icb *icb = &priv->icbs[cfg->icb[0].marker_icb];
+ unsigned long target;
+
+- cfg->current_reg ^= 1;
+- target = cfg->current_reg ? MExxSARB : MExxSARA;
++ icb->current_reg ^= 1;
++ target = icb->current_reg ? MExxSARB : MExxSARA;
+
+ /* set the next address to fetch */
+- meram_write_icb(priv->base, cfg->icb[0].cache_icb, target,
++ meram_write_icb(priv->base, cfg->icb[0].cache_icb, target,
+ base_addr_y);
+ meram_write_icb(priv->base, cfg->icb[0].marker_icb, target,
+- base_addr_y + cfg->icb[0].cache_unit);
++ base_addr_y +
++ priv->icbs[cfg->icb[0].marker_icb].cache_unit);
+
+- if (is_nvcolor(cfg->pixelformat)) {
++ if (is_nvcolor(icb->pixelformat)) {
+ meram_write_icb(priv->base, cfg->icb[1].cache_icb, target,
+ base_addr_c);
+ meram_write_icb(priv->base, cfg->icb[1].marker_icb, target,
+- base_addr_c + cfg->icb[1].cache_unit);
++ base_addr_c +
++ priv->icbs[cfg->icb[1].marker_icb].cache_unit);
+ }
+ }
+
+ /*
+ * get the next ICB address
+ */
+-static inline void meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+- struct sh_mobile_meram_cfg *cfg,
+- unsigned long *icb_addr_y,
+- unsigned long *icb_addr_c)
++static inline void
++meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
++ const struct sh_mobile_meram_cfg *cfg,
++ unsigned long *icb_addr_y, unsigned long *icb_addr_c)
+ {
++ struct sh_mobile_meram_priv *priv = pdata->priv;
++ struct sh_mobile_meram_icb *icb = &priv->icbs[cfg->icb[0].marker_icb];
+ unsigned long icb_offset;
+
+ if (pdata->addr_mode == SH_MOBILE_MERAM_MODE0)
+- icb_offset = 0x80000000 | (cfg->current_reg << 29);
++ icb_offset = 0x80000000 | (icb->current_reg << 29);
+ else
+- icb_offset = 0xc0000000 | (cfg->current_reg << 23);
++ icb_offset = 0xc0000000 | (icb->current_reg << 23);
+
+ *icb_addr_y = icb_offset | (cfg->icb[0].marker_icb << 24);
+- if (is_nvcolor(cfg->pixelformat))
++ if (is_nvcolor(icb->pixelformat))
+ *icb_addr_c = icb_offset | (cfg->icb[1].marker_icb << 24);
+ }
+
+@@ -304,7 +312,7 @@ static inline void meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+ */
+
+ static int meram_init(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb_cfg *icb,
++ const struct sh_mobile_meram_icb_cfg *icb,
+ unsigned int xres, unsigned int yres,
+ unsigned int *out_pitch)
+ {
+@@ -352,7 +360,8 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ meram_write_icb(priv->base, icb->marker_icb, MExxSBSIZE, xpitch);
+
+ /* save a cache unit size */
+- icb->cache_unit = xres * save_lines;
++ priv->icbs[icb->cache_icb].cache_unit = xres * save_lines;
++ priv->icbs[icb->marker_icb].cache_unit = xres * save_lines;
+
+ /*
+ * Set MERAM for framebuffer
+@@ -374,14 +383,16 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ }
+
+ static void meram_deinit(struct sh_mobile_meram_priv *priv,
+- struct sh_mobile_meram_icb_cfg *icb)
++ const struct sh_mobile_meram_icb_cfg *icb)
+ {
+ /* disable ICB */
+ meram_write_icb(priv->base, icb->cache_icb, MExxCTL,
+ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF);
+ meram_write_icb(priv->base, icb->marker_icb, MExxCTL,
+ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF);
+- icb->cache_unit = 0;
++
++ priv->icbs[icb->cache_icb].cache_unit = 0;
++ priv->icbs[icb->marker_icb].cache_unit = 0;
+ }
+
+ /*
+@@ -389,7 +400,7 @@ static void meram_deinit(struct sh_mobile_meram_priv *priv,
+ */
+
+ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+- struct sh_mobile_meram_cfg *cfg,
++ const struct sh_mobile_meram_cfg *cfg,
+ unsigned int xres, unsigned int yres,
+ unsigned int pixelformat,
+ unsigned long base_addr_y,
+@@ -433,12 +444,6 @@ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+
+ mutex_lock(&priv->lock);
+
+- if (priv->used_meram_cache_regions + 2 > SH_MOBILE_MERAM_ICB_NUM) {
+- dev_err(&pdev->dev, "no more ICB available.");
+- error = -EINVAL;
+- goto err;
+- }
+-
+ /* make sure that there's no overlaps */
+ if (meram_check_overlap(priv, &cfg->icb[0])) {
+ dev_err(&pdev->dev, "conflicting config detected.");
+@@ -464,10 +469,9 @@ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ }
+
+ /* we now register the ICB */
+- cfg->pixelformat = pixelformat;
+- meram_mark(priv, &cfg->icb[0]);
++ meram_mark(priv, &cfg->icb[0], pixelformat);
+ if (is_nvcolor(pixelformat))
+- meram_mark(priv, &cfg->icb[1]);
++ meram_mark(priv, &cfg->icb[1], pixelformat);
+
+ /* initialize MERAM */
+ meram_init(priv, &cfg->icb[0], xres, yres, &out_pitch);
+@@ -479,7 +483,6 @@ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ meram_init(priv, &cfg->icb[1], 2 * xres, (yres + 1) / 2,
+ &out_pitch);
+
+- cfg->current_reg = 1;
+ meram_set_next_addr(priv, cfg, base_addr_y, base_addr_c);
+ meram_get_next_icb_addr(pdata, cfg, icb_addr_y, icb_addr_c);
+
+@@ -492,19 +495,21 @@ err:
+ }
+
+ static int sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata,
+- struct sh_mobile_meram_cfg *cfg)
++ const struct sh_mobile_meram_cfg *cfg)
+ {
+ struct sh_mobile_meram_priv *priv;
++ struct sh_mobile_meram_icb *icb;
+
+ if (!pdata || !pdata->priv || !cfg)
+ return -EINVAL;
+
+ priv = pdata->priv;
++ icb = &priv->icbs[cfg->icb[0].marker_icb];
+
+ mutex_lock(&priv->lock);
+
+ /* deinit & unmark */
+- if (is_nvcolor(cfg->pixelformat)) {
++ if (is_nvcolor(icb->pixelformat)) {
+ meram_deinit(priv, &cfg->icb[1]);
+ meram_unmark(priv, &cfg->icb[1]);
+ }
+@@ -517,7 +522,7 @@ static int sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata,
+ }
+
+ static int sh_mobile_meram_update(struct sh_mobile_meram_info *pdata,
+- struct sh_mobile_meram_cfg *cfg,
++ const struct sh_mobile_meram_cfg *cfg,
+ unsigned long base_addr_y,
+ unsigned long base_addr_c,
+ unsigned long *icb_addr_y,
+@@ -547,18 +552,17 @@ static int sh_mobile_meram_runtime_suspend(struct device *dev)
+ unsigned int i, j;
+
+ for (i = 0; i < CMN_REGS_SIZE; i++)
+- priv->cmn_saved_regs[i] = meram_read_reg(priv->base,
+- common_regs[i]);
++ priv->regs[i] = meram_read_reg(priv->base, common_regs[i]);
+
+ for (i = 0; i < 32; i++) {
+ if (!test_bit(i, &priv->used_icb))
+ continue;
+ for (j = 0; j < ICB_REGS_SIZE; j++) {
+- priv->icb_saved_regs[i * ICB_REGS_SIZE + j] =
++ priv->icbs[i].regs[j] =
+ meram_read_icb(priv->base, i, icb_regs[j]);
+ /* Reset ICB on resume */
+ if (icb_regs[j] == MExxCTL)
+- priv->icb_saved_regs[i * ICB_REGS_SIZE + j] |=
++ priv->icbs[i].regs[j] |=
+ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF;
+ }
+ }
+@@ -574,15 +578,13 @@ static int sh_mobile_meram_runtime_resume(struct device *dev)
+ for (i = 0; i < 32; i++) {
+ if (!test_bit(i, &priv->used_icb))
+ continue;
+- for (j = 0; j < ICB_REGS_SIZE; j++) {
++ for (j = 0; j < ICB_REGS_SIZE; j++)
+ meram_write_icb(priv->base, i, icb_regs[j],
+- priv->icb_saved_regs[i * ICB_REGS_SIZE + j]);
+- }
++ priv->icbs[i].regs[j]);
+ }
+
+ for (i = 0; i < CMN_REGS_SIZE; i++)
+- meram_write_reg(priv->base, common_regs[i],
+- priv->cmn_saved_regs[i]);
++ meram_write_reg(priv->base, common_regs[i], priv->regs[i]);
+ return 0;
+ }
+
+diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
+index 6755e3f..05ca3f9 100644
+--- a/include/video/sh_mobile_meram.h
++++ b/include/video/sh_mobile_meram.h
+@@ -30,14 +30,10 @@ struct sh_mobile_meram_icb_cfg {
+ unsigned int cache_icb; /* ICB # for Cache ICB */
+ unsigned int meram_offset; /* MERAM Buffer Offset to use */
+ unsigned int meram_size; /* MERAM Buffer Size to use */
+-
+- unsigned int cache_unit; /* bytes to cache per ICB */
+ };
+
+ struct sh_mobile_meram_cfg {
+- struct sh_mobile_meram_icb_cfg icb[2];
+- int pixelformat;
+- int current_reg;
++ struct sh_mobile_meram_icb_cfg icb[2];
+ };
+
+ struct module;
+@@ -45,7 +41,7 @@ struct sh_mobile_meram_ops {
+ struct module *module;
+ /* register usage of meram */
+ int (*meram_register)(struct sh_mobile_meram_info *meram_dev,
+- struct sh_mobile_meram_cfg *cfg,
++ const struct sh_mobile_meram_cfg *cfg,
+ unsigned int xres, unsigned int yres,
+ unsigned int pixelformat,
+ unsigned long base_addr_y,
+@@ -56,11 +52,11 @@ struct sh_mobile_meram_ops {
+
+ /* unregister usage of meram */
+ int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
+- struct sh_mobile_meram_cfg *cfg);
++ const struct sh_mobile_meram_cfg *cfg);
+
+ /* update meram settings */
+ int (*meram_update)(struct sh_mobile_meram_info *meram_dev,
+- struct sh_mobile_meram_cfg *cfg,
++ const struct sh_mobile_meram_cfg *cfg,
+ unsigned long base_addr_y,
+ unsigned long base_addr_c,
+ unsigned long *icb_addr_y,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0187-fbdev-sh_mobile_meram-Don-t-inline-everything.patch b/patches.armadillo800eva/0187-fbdev-sh_mobile_meram-Don-t-inline-everything.patch
new file mode 100644
index 00000000000000..a266eba42b9057
--- /dev/null
+++ b/patches.armadillo800eva/0187-fbdev-sh_mobile_meram-Don-t-inline-everything.patch
@@ -0,0 +1,108 @@
+From 3474589f40e2aecd6206d923372daab7713b8981 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 19 Sep 2011 11:40:31 +0200
+Subject: fbdev: sh_mobile_meram: Don't inline everything
+
+Let the compiler decide which complex functions to inline, and constify
+constant static arrays.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 762f7cc94bc5c5c8c54f9d0073a07a275b106d89)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 30 +++++++++++++++---------------
+ 1 file changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index cddb180..0c5b301 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -83,14 +83,14 @@
+
+ #define SH_MOBILE_MERAM_ICB_NUM 32
+
+-static unsigned long common_regs[] = {
++static const unsigned long common_regs[] = {
+ MEVCR1,
+ MEQSEL1,
+ MEQSEL2,
+ };
+ #define CMN_REGS_SIZE ARRAY_SIZE(common_regs)
+
+-static unsigned long icb_regs[] = {
++static const unsigned long icb_regs[] = {
+ MExxCTL,
+ MExxBSIZE,
+ MExxMNCF,
+@@ -180,8 +180,8 @@ static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off)
+ * check if there's no overlaps in MERAM allocation.
+ */
+
+-static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_icb_cfg *new)
++static int meram_check_overlap(struct sh_mobile_meram_priv *priv,
++ const struct sh_mobile_meram_icb_cfg *new)
+ {
+ unsigned int used_start, used_end, meram_start, meram_end;
+ unsigned int i;
+@@ -215,9 +215,9 @@ static inline int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ * mark the specified ICB as used
+ */
+
+-static inline void meram_mark(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_icb_cfg *new,
+- int pixelformat)
++static void meram_mark(struct sh_mobile_meram_priv *priv,
++ const struct sh_mobile_meram_icb_cfg *new,
++ int pixelformat)
+ {
+ __set_bit(new->marker_icb, &priv->used_icb);
+ __set_bit(new->cache_icb, &priv->used_icb);
+@@ -234,8 +234,8 @@ static inline void meram_mark(struct sh_mobile_meram_priv *priv,
+ * unmark the specified ICB as used
+ */
+
+-static inline void meram_unmark(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_icb_cfg *icb)
++static void meram_unmark(struct sh_mobile_meram_priv *priv,
++ const struct sh_mobile_meram_icb_cfg *icb)
+ {
+ __clear_bit(icb->marker_icb, &priv->used_icb);
+ __clear_bit(icb->cache_icb, &priv->used_icb);
+@@ -244,7 +244,7 @@ static inline void meram_unmark(struct sh_mobile_meram_priv *priv,
+ /*
+ * is this a YCbCr(NV12, NV16 or NV24) colorspace
+ */
+-static inline int is_nvcolor(int cspace)
++static int is_nvcolor(int cspace)
+ {
+ if (cspace == SH_MOBILE_MERAM_PF_NV ||
+ cspace == SH_MOBILE_MERAM_PF_NV24)
+@@ -255,10 +255,10 @@ static inline int is_nvcolor(int cspace)
+ /*
+ * set the next address to fetch
+ */
+-static inline void meram_set_next_addr(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_cfg *cfg,
+- unsigned long base_addr_y,
+- unsigned long base_addr_c)
++static void meram_set_next_addr(struct sh_mobile_meram_priv *priv,
++ const struct sh_mobile_meram_cfg *cfg,
++ unsigned long base_addr_y,
++ unsigned long base_addr_c)
+ {
+ struct sh_mobile_meram_icb *icb = &priv->icbs[cfg->icb[0].marker_icb];
+ unsigned long target;
+@@ -285,7 +285,7 @@ static inline void meram_set_next_addr(struct sh_mobile_meram_priv *priv,
+ /*
+ * get the next ICB address
+ */
+-static inline void
++static void
+ meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+ const struct sh_mobile_meram_cfg *cfg,
+ unsigned long *icb_addr_y, unsigned long *icb_addr_c)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0188-fbdev-sh_mobile_meram-Divide-the-code-into-sections.patch b/patches.armadillo800eva/0188-fbdev-sh_mobile_meram-Divide-the-code-into-sections.patch
new file mode 100644
index 00000000000000..170c6a1f34c923
--- /dev/null
+++ b/patches.armadillo800eva/0188-fbdev-sh_mobile_meram-Divide-the-code-into-sections.patch
@@ -0,0 +1,263 @@
+From 47eaa67abf18167b2b31e32d33c8c88230b61993 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 19 Sep 2011 11:40:31 +0200
+Subject: fbdev: sh_mobile_meram: Divide the code into sections
+
+And rename a couple of constants to make prefixes more uniform.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 7554340c7acae4a719b1b70b0defa3c67149610b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 98 ++++++++++++++++++---------------------
+ 1 file changed, 44 insertions(+), 54 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 0c5b301..30a3305 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -9,16 +9,20 @@
+ * for more details.
+ */
+
++#include <linux/device.h>
++#include <linux/io.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+-#include <linux/device.h>
++#include <linux/platform_device.h>
+ #include <linux/pm_runtime.h>
+-#include <linux/io.h>
+ #include <linux/slab.h>
+-#include <linux/platform_device.h>
++
+ #include <video/sh_mobile_meram.h>
+
+-/* meram registers */
++/* -----------------------------------------------------------------------------
++ * MERAM registers
++ */
++
+ #define MEVCR1 0x4
+ #define MEVCR1_RST (1 << 31)
+ #define MEVCR1_WD (1 << 30)
+@@ -81,14 +85,12 @@
+ ((yszm1) << MExxBSIZE_YSZM1_SHIFT) | \
+ ((xszm1) << MExxBSIZE_XSZM1_SHIFT))
+
+-#define SH_MOBILE_MERAM_ICB_NUM 32
+-
+ static const unsigned long common_regs[] = {
+ MEVCR1,
+ MEQSEL1,
+ MEQSEL2,
+ };
+-#define CMN_REGS_SIZE ARRAY_SIZE(common_regs)
++#define MERAM_REGS_SIZE ARRAY_SIZE(common_regs)
+
+ static const unsigned long icb_regs[] = {
+ MExxCTL,
+@@ -117,6 +119,8 @@ struct sh_mobile_meram_icb {
+ unsigned int current_reg;
+ };
+
++#define MERAM_ICB_NUM 32
++
+ /*
+ * sh_mobile_meram_priv - MERAM device
+ * @base: Registers base address
+@@ -127,19 +131,19 @@ struct sh_mobile_meram_icb {
+ */
+ struct sh_mobile_meram_priv {
+ void __iomem *base;
+- unsigned long regs[CMN_REGS_SIZE];
++ unsigned long regs[MERAM_REGS_SIZE];
+
+ struct mutex lock;
+ unsigned long used_icb;
+- struct sh_mobile_meram_icb icbs[SH_MOBILE_MERAM_ICB_NUM];
++ struct sh_mobile_meram_icb icbs[MERAM_ICB_NUM];
+ };
+
+ /* settings */
+-#define MERAM_SEC_LINE 15
+-#define MERAM_LINE_WIDTH 2048
++#define MERAM_SEC_LINE 15
++#define MERAM_LINE_WIDTH 2048
+
+-/*
+- * MERAM/ICB access functions
++/* -----------------------------------------------------------------------------
++ * Registers access
+ */
+
+ #define MERAM_ICB_OFFSET(base, idx, off) ((base) + (off) + (idx) * 0x20)
+@@ -167,8 +171,8 @@ static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off)
+ return ioread32(base + off);
+ }
+
+-/*
+- * register ICB
++/* -----------------------------------------------------------------------------
++ * Allocation
+ */
+
+ #define MERAM_CACHE_START(p) ((p) >> 16)
+@@ -176,10 +180,7 @@ static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off)
+ #define MERAM_CACHE_SET(o, s) ((((o) & 0xffff) << 16) | \
+ (((o) + (s) - 1) & 0xffff))
+
+-/*
+- * check if there's no overlaps in MERAM allocation.
+- */
+-
++/* Check if there's no overlaps in MERAM allocation. */
+ static int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ const struct sh_mobile_meram_icb_cfg *new)
+ {
+@@ -194,7 +195,7 @@ static int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ test_bit(new->cache_icb, &priv->used_icb))
+ return 1;
+
+- for (i = 0; i < SH_MOBILE_MERAM_ICB_NUM; i++) {
++ for (i = 0; i < MERAM_ICB_NUM; i++) {
+ if (!test_bit(i, &priv->used_icb))
+ continue;
+
+@@ -211,10 +212,7 @@ static int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ return 0;
+ }
+
+-/*
+- * mark the specified ICB as used
+- */
+-
++/* Mark the specified ICB as used. */
+ static void meram_mark(struct sh_mobile_meram_priv *priv,
+ const struct sh_mobile_meram_icb_cfg *new,
+ int pixelformat)
+@@ -230,10 +228,7 @@ static void meram_mark(struct sh_mobile_meram_priv *priv,
+ priv->icbs[new->marker_icb].pixelformat = pixelformat;
+ }
+
+-/*
+- * unmark the specified ICB as used
+- */
+-
++/* Unmark the specified ICB as used. */
+ static void meram_unmark(struct sh_mobile_meram_priv *priv,
+ const struct sh_mobile_meram_icb_cfg *icb)
+ {
+@@ -241,9 +236,7 @@ static void meram_unmark(struct sh_mobile_meram_priv *priv,
+ __clear_bit(icb->cache_icb, &priv->used_icb);
+ }
+
+-/*
+- * is this a YCbCr(NV12, NV16 or NV24) colorspace
+- */
++/* Is this a YCbCr(NV12, NV16 or NV24) colorspace? */
+ static int is_nvcolor(int cspace)
+ {
+ if (cspace == SH_MOBILE_MERAM_PF_NV ||
+@@ -252,9 +245,7 @@ static int is_nvcolor(int cspace)
+ return 0;
+ }
+
+-/*
+- * set the next address to fetch
+- */
++/* Set the next address to fetch. */
+ static void meram_set_next_addr(struct sh_mobile_meram_priv *priv,
+ const struct sh_mobile_meram_cfg *cfg,
+ unsigned long base_addr_y,
+@@ -282,9 +273,7 @@ static void meram_set_next_addr(struct sh_mobile_meram_priv *priv,
+ }
+ }
+
+-/*
+- * get the next ICB address
+- */
++/* Get the next ICB address. */
+ static void
+ meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+ const struct sh_mobile_meram_cfg *cfg,
+@@ -307,10 +296,7 @@ meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+ #define MERAM_CALC_BYTECOUNT(x, y) \
+ (((x) * (y) + (MERAM_LINE_WIDTH - 1)) & ~(MERAM_LINE_WIDTH - 1))
+
+-/*
+- * initialize MERAM
+- */
+-
++/* Initialize MERAM. */
+ static int meram_init(struct sh_mobile_meram_priv *priv,
+ const struct sh_mobile_meram_icb_cfg *icb,
+ unsigned int xres, unsigned int yres,
+@@ -395,8 +381,8 @@ static void meram_deinit(struct sh_mobile_meram_priv *priv,
+ priv->icbs[icb->marker_icb].cache_unit = 0;
+ }
+
+-/*
+- * register the ICB
++/* -----------------------------------------------------------------------------
++ * Registration/unregistration
+ */
+
+ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+@@ -545,13 +531,24 @@ static int sh_mobile_meram_update(struct sh_mobile_meram_info *pdata,
+ return 0;
+ }
+
++static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
++ .module = THIS_MODULE,
++ .meram_register = sh_mobile_meram_register,
++ .meram_unregister = sh_mobile_meram_unregister,
++ .meram_update = sh_mobile_meram_update,
++};
++
++/* -----------------------------------------------------------------------------
++ * Power management
++ */
++
+ static int sh_mobile_meram_runtime_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
+ unsigned int i, j;
+
+- for (i = 0; i < CMN_REGS_SIZE; i++)
++ for (i = 0; i < MERAM_REGS_SIZE; i++)
+ priv->regs[i] = meram_read_reg(priv->base, common_regs[i]);
+
+ for (i = 0; i < 32; i++) {
+@@ -583,7 +580,7 @@ static int sh_mobile_meram_runtime_resume(struct device *dev)
+ priv->icbs[i].regs[j]);
+ }
+
+- for (i = 0; i < CMN_REGS_SIZE; i++)
++ for (i = 0; i < MERAM_REGS_SIZE; i++)
+ meram_write_reg(priv->base, common_regs[i], priv->regs[i]);
+ return 0;
+ }
+@@ -593,15 +590,8 @@ static const struct dev_pm_ops sh_mobile_meram_dev_pm_ops = {
+ .runtime_resume = sh_mobile_meram_runtime_resume,
+ };
+
+-static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
+- .module = THIS_MODULE,
+- .meram_register = sh_mobile_meram_register,
+- .meram_unregister = sh_mobile_meram_unregister,
+- .meram_update = sh_mobile_meram_update,
+-};
+-
+-/*
+- * initialize MERAM
++/* -----------------------------------------------------------------------------
++ * Probe/remove and driver init/exit
+ */
+
+ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0189-fbdev-sh_mobile_meram-Use-genalloc-to-manage-MERAM-a.patch b/patches.armadillo800eva/0189-fbdev-sh_mobile_meram-Use-genalloc-to-manage-MERAM-a.patch
new file mode 100644
index 00000000000000..ecd5a725040ff1
--- /dev/null
+++ b/patches.armadillo800eva/0189-fbdev-sh_mobile_meram-Use-genalloc-to-manage-MERAM-a.patch
@@ -0,0 +1,366 @@
+From 07e420f34a6c0bc33d43d82dd2cd4098df0ee623 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 19 Sep 2011 11:40:31 +0200
+Subject: fbdev: sh_mobile_meram: Use genalloc to manage MERAM allocation
+
+Instead of requiring the users to hardcode MERAM allocation in platform
+data, allocate blocks at runtime using genalloc.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 974d250be2c70c7bf899275b23b241685d4ed7f8)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-ap4evb.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ap4evb.c | 4 --
+ arch/arm/mach-shmobile/board-mackerel.c | 4 --
+ drivers/video/Kconfig | 1 +
+ drivers/video/sh_mobile_meram.c | 112 +++++++++++++++++++------------
+ include/video/sh_mobile_meram.h | 1 -
+ 5 files changed, 71 insertions(+), 51 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
+index 3cf12de..5f2735b 100644
+--- a/arch/arm/mach-shmobile/board-ap4evb.c
++++ b/arch/arm/mach-shmobile/board-ap4evb.c
+@@ -474,13 +474,11 @@ static struct sh_mobile_meram_cfg lcd_meram_cfg = {
+ .icb[0] = {
+ .marker_icb = 28,
+ .cache_icb = 24,
+- .meram_offset = 0x0,
+ .meram_size = 0x40,
+ },
+ .icb[1] = {
+ .marker_icb = 29,
+ .cache_icb = 25,
+- .meram_offset = 0x40,
+ .meram_size = 0x40,
+ },
+ };
+@@ -769,13 +767,11 @@ static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
+ .icb[0] = {
+ .marker_icb = 30,
+ .cache_icb = 26,
+- .meram_offset = 0x80,
+ .meram_size = 0x100,
+ },
+ .icb[1] = {
+ .marker_icb = 31,
+ .cache_icb = 27,
+- .meram_offset = 0x180,
+ .meram_size = 0x100,
+ },
+ };
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 31d99e5..1fd4423 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -371,13 +371,11 @@ static struct sh_mobile_meram_cfg lcd_meram_cfg = {
+ .icb[0] = {
+ .marker_icb = 28,
+ .cache_icb = 24,
+- .meram_offset = 0x0,
+ .meram_size = 0x40,
+ },
+ .icb[1] = {
+ .marker_icb = 29,
+ .cache_icb = 25,
+- .meram_offset = 0x40,
+ .meram_size = 0x40,
+ },
+ };
+@@ -434,13 +432,11 @@ static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
+ .icb[0] = {
+ .marker_icb = 30,
+ .cache_icb = 26,
+- .meram_offset = 0x80,
+ .meram_size = 0x100,
+ },
+ .icb[1] = {
+ .marker_icb = 31,
+ .cache_icb = 27,
+- .meram_offset = 0x180,
+ .meram_size = 0x100,
+ },
+ };
+diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
+index 549b960..2316535 100644
+--- a/drivers/video/Kconfig
++++ b/drivers/video/Kconfig
+@@ -1994,6 +1994,7 @@ config FB_SH_MOBILE_HDMI
+ config FB_SH_MOBILE_MERAM
+ tristate "SuperH Mobile MERAM read ahead support for LCDC"
+ depends on FB_SH_MOBILE_LCDC
++ select GENERIC_ALLOCATOR
+ default y
+ ---help---
+ Enable MERAM support for the SH-Mobile LCD controller.
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 30a3305..92dc9bd 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -10,6 +10,7 @@
+ */
+
+ #include <linux/device.h>
++#include <linux/genalloc.h>
+ #include <linux/io.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+@@ -105,15 +106,17 @@ static const unsigned long icb_regs[] = {
+ /*
+ * sh_mobile_meram_icb - MERAM ICB information
+ * @regs: Registers cache
+- * @region: Start and end addresses of the MERAM region
++ * @offset: MERAM block offset
++ * @size: MERAM block size in bytes
+ * @cache_unit: Bytes to cache per ICB
+ * @pixelformat: Video pixel format of the data stored in the ICB
+ * @current_reg: Which of Start Address Register A (0) or B (1) is in use
+ */
+ struct sh_mobile_meram_icb {
+ unsigned long regs[ICB_REGS_SIZE];
++ unsigned long offset;
++ unsigned int size;
+
+- unsigned long region;
+ unsigned int cache_unit;
+ unsigned int pixelformat;
+ unsigned int current_reg;
+@@ -124,21 +127,27 @@ struct sh_mobile_meram_icb {
+ /*
+ * sh_mobile_meram_priv - MERAM device
+ * @base: Registers base address
++ * @meram: MERAM physical address
+ * @regs: Registers cache
+ * @lock: Protects used_icb and icbs
+ * @used_icb: Bitmask of used ICBs
+ * @icbs: ICBs
++ * @pool: Allocation pool to manage the MERAM
+ */
+ struct sh_mobile_meram_priv {
+ void __iomem *base;
++ unsigned long meram;
+ unsigned long regs[MERAM_REGS_SIZE];
+
+ struct mutex lock;
+ unsigned long used_icb;
+ struct sh_mobile_meram_icb icbs[MERAM_ICB_NUM];
++
++ struct gen_pool *pool;
+ };
+
+ /* settings */
++#define MERAM_GRANULARITY 1024
+ #define MERAM_SEC_LINE 15
+ #define MERAM_LINE_WIDTH 2048
+
+@@ -175,18 +184,10 @@ static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off)
+ * Allocation
+ */
+
+-#define MERAM_CACHE_START(p) ((p) >> 16)
+-#define MERAM_CACHE_END(p) ((p) & 0xffff)
+-#define MERAM_CACHE_SET(o, s) ((((o) & 0xffff) << 16) | \
+- (((o) + (s) - 1) & 0xffff))
+-
+ /* Check if there's no overlaps in MERAM allocation. */
+ static int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ const struct sh_mobile_meram_icb_cfg *new)
+ {
+- unsigned int used_start, used_end, meram_start, meram_end;
+- unsigned int i;
+-
+ /* valid ICB? */
+ if (new->marker_icb & ~0x1f || new->cache_icb & ~0x1f)
+ return 1;
+@@ -195,43 +196,40 @@ static int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+ test_bit(new->cache_icb, &priv->used_icb))
+ return 1;
+
+- for (i = 0; i < MERAM_ICB_NUM; i++) {
+- if (!test_bit(i, &priv->used_icb))
+- continue;
+-
+- used_start = MERAM_CACHE_START(priv->icbs[i].region);
+- used_end = MERAM_CACHE_END(priv->icbs[i].region);
+- meram_start = new->meram_offset;
+- meram_end = new->meram_offset + new->meram_size;
+-
+- if ((meram_start >= used_start && meram_start < used_end) ||
+- (meram_end > used_start && meram_end < used_end))
+- return 1;
+- }
+-
+ return 0;
+ }
+
+-/* Mark the specified ICB as used. */
+-static void meram_mark(struct sh_mobile_meram_priv *priv,
++/* Allocate memory for the ICBs and mark them as used. */
++static int meram_alloc(struct sh_mobile_meram_priv *priv,
+ const struct sh_mobile_meram_icb_cfg *new,
+ int pixelformat)
+ {
++ struct sh_mobile_meram_icb *marker = &priv->icbs[new->marker_icb];
++ unsigned long mem;
++
++ mem = gen_pool_alloc(priv->pool, new->meram_size * 1024);
++ if (mem == 0)
++ return -ENOMEM;
++
+ __set_bit(new->marker_icb, &priv->used_icb);
+ __set_bit(new->cache_icb, &priv->used_icb);
+
+- priv->icbs[new->marker_icb].region = MERAM_CACHE_SET(new->meram_offset,
+- new->meram_size);
+- priv->icbs[new->cache_icb].region = MERAM_CACHE_SET(new->meram_offset,
+- new->meram_size);
+- priv->icbs[new->marker_icb].current_reg = 1;
+- priv->icbs[new->marker_icb].pixelformat = pixelformat;
++ marker->offset = mem - priv->meram;
++ marker->size = new->meram_size * 1024;
++ marker->current_reg = 1;
++ marker->pixelformat = pixelformat;
++
++ return 0;
+ }
+
+ /* Unmark the specified ICB as used. */
+-static void meram_unmark(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_icb_cfg *icb)
++static void meram_free(struct sh_mobile_meram_priv *priv,
++ const struct sh_mobile_meram_icb_cfg *icb)
+ {
++ struct sh_mobile_meram_icb *marker = &priv->icbs[icb->marker_icb];
++
++ gen_pool_free(priv->pool, priv->meram + marker->offset, marker->size);
++
+ __clear_bit(icb->marker_icb, &priv->used_icb);
+ __clear_bit(icb->cache_icb, &priv->used_icb);
+ }
+@@ -302,6 +300,7 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ unsigned int xres, unsigned int yres,
+ unsigned int *out_pitch)
+ {
++ struct sh_mobile_meram_icb *marker = &priv->icbs[icb->marker_icb];
+ unsigned long total_byte_count = MERAM_CALC_BYTECOUNT(xres, yres);
+ unsigned long bnm;
+ unsigned int lcdc_pitch;
+@@ -356,11 +355,11 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ * we also split the allocated MERAM buffer between two ICBs.
+ */
+ meram_write_icb(priv->base, icb->cache_icb, MExxCTL,
+- MERAM_MExxCTL_VAL(icb->marker_icb, icb->meram_offset) |
++ MERAM_MExxCTL_VAL(icb->marker_icb, marker->offset) |
+ MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM |
+ MExxCTL_MD_FB);
+ meram_write_icb(priv->base, icb->marker_icb, MExxCTL,
+- MERAM_MExxCTL_VAL(icb->cache_icb, icb->meram_offset +
++ MERAM_MExxCTL_VAL(icb->cache_icb, marker->offset +
+ icb->meram_size / 2) |
+ MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM |
+ MExxCTL_MD_FB);
+@@ -454,10 +453,18 @@ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ goto err;
+ }
+
+- /* we now register the ICB */
+- meram_mark(priv, &cfg->icb[0], pixelformat);
+- if (is_nvcolor(pixelformat))
+- meram_mark(priv, &cfg->icb[1], pixelformat);
++ /* We now register the ICBs and allocate the MERAM regions. */
++ error = meram_alloc(priv, &cfg->icb[0], pixelformat);
++ if (error < 0)
++ goto err;
++
++ if (is_nvcolor(pixelformat)) {
++ error = meram_alloc(priv, &cfg->icb[1], pixelformat);
++ if (error < 0) {
++ meram_free(priv, &cfg->icb[0]);
++ goto err;
++ }
++ }
+
+ /* initialize MERAM */
+ meram_init(priv, &cfg->icb[0], xres, yres, &out_pitch);
+@@ -497,10 +504,10 @@ static int sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata,
+ /* deinit & unmark */
+ if (is_nvcolor(icb->pixelformat)) {
+ meram_deinit(priv, &cfg->icb[1]);
+- meram_unmark(priv, &cfg->icb[1]);
++ meram_free(priv, &cfg->icb[1]);
+ }
+ meram_deinit(priv, &cfg->icb[0]);
+- meram_unmark(priv, &cfg->icb[0]);
++ meram_free(priv, &cfg->icb[0]);
+
+ mutex_unlock(&priv->lock);
+
+@@ -626,6 +633,7 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+ pdata->priv = priv;
+ pdata->pdev = pdev;
+
++ /* Request memory regions and remap the registers. */
+ if (!request_mem_region(regs->start, resource_size(regs), pdev->name)) {
+ dev_err(&pdev->dev, "MERAM registers region already claimed\n");
+ error = -EBUSY;
+@@ -646,6 +654,20 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+ goto err_ioremap;
+ }
+
++ priv->meram = meram->start;
++
++ /* Create and initialize the MERAM memory pool. */
++ priv->pool = gen_pool_create(ilog2(MERAM_GRANULARITY), -1);
++ if (priv->pool == NULL) {
++ error = -ENOMEM;
++ goto err_genpool;
++ }
++
++ error = gen_pool_add(priv->pool, meram->start, resource_size(meram),
++ -1);
++ if (error < 0)
++ goto err_genpool;
++
+ /* initialize ICB addressing mode */
+ if (pdata->addr_mode == SH_MOBILE_MERAM_MODE1)
+ meram_write_reg(priv->base, MEVCR1, MEVCR1_AMD1);
+@@ -657,6 +679,10 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+
+ return 0;
+
++err_genpool:
++ if (priv->pool)
++ gen_pool_destroy(priv->pool);
++ iounmap(priv->base);
+ err_ioremap:
+ release_mem_region(meram->start, resource_size(meram));
+ err_req_meram:
+@@ -677,6 +703,8 @@ static int sh_mobile_meram_remove(struct platform_device *pdev)
+
+ pm_runtime_disable(&pdev->dev);
+
++ gen_pool_destroy(priv->pool);
++
+ iounmap(priv->base);
+ release_mem_region(meram->start, resource_size(meram));
+ release_mem_region(regs->start, resource_size(regs));
+diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
+index 05ca3f9..f7700fc 100644
+--- a/include/video/sh_mobile_meram.h
++++ b/include/video/sh_mobile_meram.h
+@@ -28,7 +28,6 @@ struct sh_mobile_meram_info {
+ struct sh_mobile_meram_icb_cfg {
+ unsigned int marker_icb; /* ICB # for Marker ICB */
+ unsigned int cache_icb; /* ICB # for Cache ICB */
+- unsigned int meram_offset; /* MERAM Buffer Offset to use */
+ unsigned int meram_size; /* MERAM Buffer Size to use */
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0190-fbdev-sh_mobile_meram-Allocate-ICBs-automatically.patch b/patches.armadillo800eva/0190-fbdev-sh_mobile_meram-Allocate-ICBs-automatically.patch
new file mode 100644
index 00000000000000..ded459307495a9
--- /dev/null
+++ b/patches.armadillo800eva/0190-fbdev-sh_mobile_meram-Allocate-ICBs-automatically.patch
@@ -0,0 +1,740 @@
+From f5284c79b76aaa4ee85b22de136984d21654f3c2 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 12 Dec 2011 16:36:13 +0100
+Subject: fbdev: sh_mobile_meram: Allocate ICBs automatically
+
+Instead of manually specifying the ICBs to use in platform data,
+allocate them automatically at runtime. The range of reserved ICBs (for
+instance to be used through UIO), if any, is passed in the platform data
+reserved_icbs field as a bitmask.
+
+The MERAM registration function now returns a pointer to an opaque MERAM
+object, which is passed to the update and unregistration functions.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 481100506b34d666243832c3f2aee905c03cb8e7)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 27 ++-
+ drivers/video/sh_mobile_lcdcfb.h | 2 +-
+ drivers/video/sh_mobile_meram.c | 345 ++++++++++++++++++++------------------
+ include/video/sh_mobile_meram.h | 27 +--
+ 4 files changed, 215 insertions(+), 186 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index adc911f..d0c9026 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -840,6 +840,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+ struct sh_mobile_meram_cfg *cfg;
+ int pixelformat;
++ void *meram;
+
+ ch = &priv->ch[k];
+ if (!ch->enabled)
+@@ -856,9 +857,9 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ /* we need to de-init configured ICBs before we can
+ * re-initialize them.
+ */
+- if (ch->meram_enabled) {
+- mdev->ops->meram_unregister(mdev, cfg);
+- ch->meram_enabled = 0;
++ if (ch->meram) {
++ mdev->ops->meram_unregister(mdev, ch->meram);
++ ch->meram = NULL;
+ }
+
+ switch (ch->format->fourcc) {
+@@ -880,13 +881,13 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ break;
+ }
+
+- ret = mdev->ops->meram_register(mdev, cfg, ch->pitch,
++ meram = mdev->ops->meram_register(mdev, cfg, ch->pitch,
+ ch->yres, pixelformat,
+ ch->base_addr_y, ch->base_addr_c,
+ &ch->base_addr_y, &ch->base_addr_c,
+ &ch->pitch);
+- if (!ret)
+- ch->meram_enabled = 1;
++ if (!IS_ERR(meram))
++ ch->meram = meram;
+ }
+
+ /* Start the LCDC. */
+@@ -951,13 +952,11 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
+ sh_mobile_lcdc_display_off(ch);
+
+ /* disable the meram */
+- if (ch->meram_enabled) {
+- struct sh_mobile_meram_cfg *cfg;
++ if (ch->meram) {
+ struct sh_mobile_meram_info *mdev;
+- cfg = ch->cfg.meram_cfg;
+ mdev = priv->meram_dev;
+- mdev->ops->meram_unregister(mdev, cfg);
+- ch->meram_enabled = 0;
++ mdev->ops->meram_unregister(mdev, ch->meram);
++ ch->meram = 0;
+ }
+
+ }
+@@ -1070,14 +1069,12 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+ base_addr_c += var->xoffset;
+ }
+
+- if (ch->meram_enabled) {
+- struct sh_mobile_meram_cfg *cfg;
++ if (ch->meram) {
+ struct sh_mobile_meram_info *mdev;
+ int ret;
+
+- cfg = ch->cfg.meram_cfg;
+ mdev = priv->meram_dev;
+- ret = mdev->ops->meram_update(mdev, cfg,
++ ret = mdev->ops->meram_update(mdev, ch->meram,
+ base_addr_y, base_addr_c,
+ &base_addr_y, &base_addr_c);
+ if (ret)
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index 19a4cd7..bf1707c 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -59,7 +59,7 @@ struct sh_mobile_lcdc_chan {
+ unsigned long *reg_offs;
+ unsigned long ldmt1r_value;
+ unsigned long enabled; /* ME and SE in LDCNT2R */
+- int meram_enabled;
++ void *meram;
+
+ struct mutex open_lock; /* protects the use counter */
+ int use_count;
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 92dc9bd..085c49a 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -10,6 +10,7 @@
+ */
+
+ #include <linux/device.h>
++#include <linux/err.h>
+ #include <linux/genalloc.h>
+ #include <linux/io.h>
+ #include <linux/kernel.h>
+@@ -106,14 +107,16 @@ static const unsigned long icb_regs[] = {
+ /*
+ * sh_mobile_meram_icb - MERAM ICB information
+ * @regs: Registers cache
++ * @index: ICB index
+ * @offset: MERAM block offset
+- * @size: MERAM block size in bytes
++ * @size: MERAM block size in KiB
+ * @cache_unit: Bytes to cache per ICB
+ * @pixelformat: Video pixel format of the data stored in the ICB
+ * @current_reg: Which of Start Address Register A (0) or B (1) is in use
+ */
+ struct sh_mobile_meram_icb {
+ unsigned long regs[ICB_REGS_SIZE];
++ unsigned int index;
+ unsigned long offset;
+ unsigned int size;
+
+@@ -124,6 +127,16 @@ struct sh_mobile_meram_icb {
+
+ #define MERAM_ICB_NUM 32
+
++struct sh_mobile_meram_fb_plane {
++ struct sh_mobile_meram_icb *marker;
++ struct sh_mobile_meram_icb *cache;
++};
++
++struct sh_mobile_meram_fb_cache {
++ unsigned int nplanes;
++ struct sh_mobile_meram_fb_plane planes[2];
++};
++
+ /*
+ * sh_mobile_meram_priv - MERAM device
+ * @base: Registers base address
+@@ -184,54 +197,46 @@ static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off)
+ * Allocation
+ */
+
+-/* Check if there's no overlaps in MERAM allocation. */
+-static int meram_check_overlap(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_icb_cfg *new)
++/* Allocate ICBs and MERAM for a plane. */
++static int __meram_alloc(struct sh_mobile_meram_priv *priv,
++ struct sh_mobile_meram_fb_plane *plane,
++ size_t size)
+ {
+- /* valid ICB? */
+- if (new->marker_icb & ~0x1f || new->cache_icb & ~0x1f)
+- return 1;
+-
+- if (test_bit(new->marker_icb, &priv->used_icb) ||
+- test_bit(new->cache_icb, &priv->used_icb))
+- return 1;
++ unsigned long mem;
++ unsigned long idx;
+
+- return 0;
+-}
++ idx = find_first_zero_bit(&priv->used_icb, 28);
++ if (idx == 28)
++ return -ENOMEM;
++ plane->cache = &priv->icbs[idx];
+
+-/* Allocate memory for the ICBs and mark them as used. */
+-static int meram_alloc(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_icb_cfg *new,
+- int pixelformat)
+-{
+- struct sh_mobile_meram_icb *marker = &priv->icbs[new->marker_icb];
+- unsigned long mem;
++ idx = find_next_zero_bit(&priv->used_icb, 32, 28);
++ if (idx == 32)
++ return -ENOMEM;
++ plane->marker = &priv->icbs[idx];
+
+- mem = gen_pool_alloc(priv->pool, new->meram_size * 1024);
++ mem = gen_pool_alloc(priv->pool, size * 1024);
+ if (mem == 0)
+ return -ENOMEM;
+
+- __set_bit(new->marker_icb, &priv->used_icb);
+- __set_bit(new->cache_icb, &priv->used_icb);
++ __set_bit(plane->marker->index, &priv->used_icb);
++ __set_bit(plane->cache->index, &priv->used_icb);
+
+- marker->offset = mem - priv->meram;
+- marker->size = new->meram_size * 1024;
+- marker->current_reg = 1;
+- marker->pixelformat = pixelformat;
++ plane->marker->offset = mem - priv->meram;
++ plane->marker->size = size;
+
+ return 0;
+ }
+
+-/* Unmark the specified ICB as used. */
+-static void meram_free(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_icb_cfg *icb)
++/* Free ICBs and MERAM for a plane. */
++static void __meram_free(struct sh_mobile_meram_priv *priv,
++ struct sh_mobile_meram_fb_plane *plane)
+ {
+- struct sh_mobile_meram_icb *marker = &priv->icbs[icb->marker_icb];
++ gen_pool_free(priv->pool, priv->meram + plane->marker->offset,
++ plane->marker->size * 1024);
+
+- gen_pool_free(priv->pool, priv->meram + marker->offset, marker->size);
+-
+- __clear_bit(icb->marker_icb, &priv->used_icb);
+- __clear_bit(icb->cache_icb, &priv->used_icb);
++ __clear_bit(plane->marker->index, &priv->used_icb);
++ __clear_bit(plane->cache->index, &priv->used_icb);
+ }
+
+ /* Is this a YCbCr(NV12, NV16 or NV24) colorspace? */
+@@ -243,42 +248,96 @@ static int is_nvcolor(int cspace)
+ return 0;
+ }
+
++/* Allocate memory for the ICBs and mark them as used. */
++static struct sh_mobile_meram_fb_cache *
++meram_alloc(struct sh_mobile_meram_priv *priv,
++ const struct sh_mobile_meram_cfg *cfg,
++ int pixelformat)
++{
++ struct sh_mobile_meram_fb_cache *cache;
++ unsigned int nplanes = is_nvcolor(pixelformat) ? 2 : 1;
++ int ret;
++
++ if (cfg->icb[0].meram_size == 0)
++ return ERR_PTR(-EINVAL);
++
++ if (nplanes == 2 && cfg->icb[1].meram_size == 0)
++ return ERR_PTR(-EINVAL);
++
++ cache = kzalloc(sizeof(*cache), GFP_KERNEL);
++ if (cache == NULL)
++ return ERR_PTR(-ENOMEM);
++
++ cache->nplanes = nplanes;
++
++ ret = __meram_alloc(priv, &cache->planes[0], cfg->icb[0].meram_size);
++ if (ret < 0)
++ goto error;
++
++ cache->planes[0].marker->current_reg = 1;
++ cache->planes[0].marker->pixelformat = pixelformat;
++
++ if (cache->nplanes == 1)
++ return cache;
++
++ ret = __meram_alloc(priv, &cache->planes[1], cfg->icb[1].meram_size);
++ if (ret < 0) {
++ __meram_free(priv, &cache->planes[0]);
++ goto error;
++ }
++
++ return cache;
++
++error:
++ kfree(cache);
++ return ERR_PTR(-ENOMEM);
++}
++
++/* Unmark the specified ICB as used. */
++static void meram_free(struct sh_mobile_meram_priv *priv,
++ struct sh_mobile_meram_fb_cache *cache)
++{
++ __meram_free(priv, &cache->planes[0]);
++ if (cache->nplanes == 2)
++ __meram_free(priv, &cache->planes[1]);
++
++ kfree(cache);
++}
++
+ /* Set the next address to fetch. */
+ static void meram_set_next_addr(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_cfg *cfg,
++ struct sh_mobile_meram_fb_cache *cache,
+ unsigned long base_addr_y,
+ unsigned long base_addr_c)
+ {
+- struct sh_mobile_meram_icb *icb = &priv->icbs[cfg->icb[0].marker_icb];
++ struct sh_mobile_meram_icb *icb = cache->planes[0].marker;
+ unsigned long target;
+
+ icb->current_reg ^= 1;
+ target = icb->current_reg ? MExxSARB : MExxSARA;
+
+ /* set the next address to fetch */
+- meram_write_icb(priv->base, cfg->icb[0].cache_icb, target,
++ meram_write_icb(priv->base, cache->planes[0].cache->index, target,
+ base_addr_y);
+- meram_write_icb(priv->base, cfg->icb[0].marker_icb, target,
+- base_addr_y +
+- priv->icbs[cfg->icb[0].marker_icb].cache_unit);
+-
+- if (is_nvcolor(icb->pixelformat)) {
+- meram_write_icb(priv->base, cfg->icb[1].cache_icb, target,
+- base_addr_c);
+- meram_write_icb(priv->base, cfg->icb[1].marker_icb, target,
+- base_addr_c +
+- priv->icbs[cfg->icb[1].marker_icb].cache_unit);
++ meram_write_icb(priv->base, cache->planes[0].marker->index, target,
++ base_addr_y + cache->planes[0].marker->cache_unit);
++
++ if (cache->nplanes == 2) {
++ meram_write_icb(priv->base, cache->planes[1].cache->index,
++ target, base_addr_c);
++ meram_write_icb(priv->base, cache->planes[1].marker->index,
++ target, base_addr_c +
++ cache->planes[1].marker->cache_unit);
+ }
+ }
+
+ /* Get the next ICB address. */
+ static void
+ meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+- const struct sh_mobile_meram_cfg *cfg,
++ struct sh_mobile_meram_fb_cache *cache,
+ unsigned long *icb_addr_y, unsigned long *icb_addr_c)
+ {
+- struct sh_mobile_meram_priv *priv = pdata->priv;
+- struct sh_mobile_meram_icb *icb = &priv->icbs[cfg->icb[0].marker_icb];
++ struct sh_mobile_meram_icb *icb = cache->planes[0].marker;
+ unsigned long icb_offset;
+
+ if (pdata->addr_mode == SH_MOBILE_MERAM_MODE0)
+@@ -286,9 +345,10 @@ meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+ else
+ icb_offset = 0xc0000000 | (icb->current_reg << 23);
+
+- *icb_addr_y = icb_offset | (cfg->icb[0].marker_icb << 24);
+- if (is_nvcolor(icb->pixelformat))
+- *icb_addr_c = icb_offset | (cfg->icb[1].marker_icb << 24);
++ *icb_addr_y = icb_offset | (cache->planes[0].marker->index << 24);
++ if (cache->nplanes == 2)
++ *icb_addr_c = icb_offset
++ | (cache->planes[1].marker->index << 24);
+ }
+
+ #define MERAM_CALC_BYTECOUNT(x, y) \
+@@ -296,11 +356,11 @@ meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata,
+
+ /* Initialize MERAM. */
+ static int meram_init(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_icb_cfg *icb,
++ struct sh_mobile_meram_fb_plane *plane,
+ unsigned int xres, unsigned int yres,
+ unsigned int *out_pitch)
+ {
+- struct sh_mobile_meram_icb *marker = &priv->icbs[icb->marker_icb];
++ struct sh_mobile_meram_icb *marker = plane->marker;
+ unsigned long total_byte_count = MERAM_CALC_BYTECOUNT(xres, yres);
+ unsigned long bnm;
+ unsigned int lcdc_pitch;
+@@ -319,13 +379,13 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ lcdc_pitch = xpitch = MERAM_LINE_WIDTH;
+ line_cnt = total_byte_count >> 11;
+ *out_pitch = xres;
+- save_lines = (icb->meram_size / 16 / MERAM_SEC_LINE);
++ save_lines = plane->marker->size / 16 / MERAM_SEC_LINE;
+ save_lines *= MERAM_SEC_LINE;
+ } else {
+ xpitch = xres;
+ line_cnt = yres;
+ *out_pitch = lcdc_pitch;
+- save_lines = icb->meram_size / (lcdc_pitch >> 10) / 2;
++ save_lines = plane->marker->size / (lcdc_pitch >> 10) / 2;
+ save_lines &= 0xff;
+ }
+ bnm = (save_lines - 1) << 16;
+@@ -333,20 +393,20 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ /* TODO: we better to check if we have enough MERAM buffer size */
+
+ /* set up ICB */
+- meram_write_icb(priv->base, icb->cache_icb, MExxBSIZE,
++ meram_write_icb(priv->base, plane->cache->index, MExxBSIZE,
+ MERAM_MExxBSIZE_VAL(0x0, line_cnt - 1, xpitch - 1));
+- meram_write_icb(priv->base, icb->marker_icb, MExxBSIZE,
++ meram_write_icb(priv->base, plane->marker->index, MExxBSIZE,
+ MERAM_MExxBSIZE_VAL(0xf, line_cnt - 1, xpitch - 1));
+
+- meram_write_icb(priv->base, icb->cache_icb, MExxMNCF, bnm);
+- meram_write_icb(priv->base, icb->marker_icb, MExxMNCF, bnm);
++ meram_write_icb(priv->base, plane->cache->index, MExxMNCF, bnm);
++ meram_write_icb(priv->base, plane->marker->index, MExxMNCF, bnm);
+
+- meram_write_icb(priv->base, icb->cache_icb, MExxSBSIZE, xpitch);
+- meram_write_icb(priv->base, icb->marker_icb, MExxSBSIZE, xpitch);
++ meram_write_icb(priv->base, plane->cache->index, MExxSBSIZE, xpitch);
++ meram_write_icb(priv->base, plane->marker->index, MExxSBSIZE, xpitch);
+
+ /* save a cache unit size */
+- priv->icbs[icb->cache_icb].cache_unit = xres * save_lines;
+- priv->icbs[icb->marker_icb].cache_unit = xres * save_lines;
++ plane->cache->cache_unit = xres * save_lines;
++ plane->marker->cache_unit = xres * save_lines;
+
+ /*
+ * Set MERAM for framebuffer
+@@ -354,13 +414,13 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ * we also chain the cache_icb and the marker_icb.
+ * we also split the allocated MERAM buffer between two ICBs.
+ */
+- meram_write_icb(priv->base, icb->cache_icb, MExxCTL,
+- MERAM_MExxCTL_VAL(icb->marker_icb, marker->offset) |
+- MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM |
++ meram_write_icb(priv->base, plane->cache->index, MExxCTL,
++ MERAM_MExxCTL_VAL(plane->marker->index, marker->offset)
++ | MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM |
+ MExxCTL_MD_FB);
+- meram_write_icb(priv->base, icb->marker_icb, MExxCTL,
+- MERAM_MExxCTL_VAL(icb->cache_icb, marker->offset +
+- icb->meram_size / 2) |
++ meram_write_icb(priv->base, plane->marker->index, MExxCTL,
++ MERAM_MExxCTL_VAL(plane->cache->index, marker->offset +
++ plane->marker->size / 2) |
+ MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM |
+ MExxCTL_MD_FB);
+
+@@ -368,45 +428,44 @@ static int meram_init(struct sh_mobile_meram_priv *priv,
+ }
+
+ static void meram_deinit(struct sh_mobile_meram_priv *priv,
+- const struct sh_mobile_meram_icb_cfg *icb)
++ struct sh_mobile_meram_fb_plane *plane)
+ {
+ /* disable ICB */
+- meram_write_icb(priv->base, icb->cache_icb, MExxCTL,
++ meram_write_icb(priv->base, plane->cache->index, MExxCTL,
+ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF);
+- meram_write_icb(priv->base, icb->marker_icb, MExxCTL,
++ meram_write_icb(priv->base, plane->marker->index, MExxCTL,
+ MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF);
+
+- priv->icbs[icb->cache_icb].cache_unit = 0;
+- priv->icbs[icb->marker_icb].cache_unit = 0;
++ plane->cache->cache_unit = 0;
++ plane->marker->cache_unit = 0;
+ }
+
+ /* -----------------------------------------------------------------------------
+ * Registration/unregistration
+ */
+
+-static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+- const struct sh_mobile_meram_cfg *cfg,
+- unsigned int xres, unsigned int yres,
+- unsigned int pixelformat,
+- unsigned long base_addr_y,
+- unsigned long base_addr_c,
+- unsigned long *icb_addr_y,
+- unsigned long *icb_addr_c,
+- unsigned int *pitch)
++static void *sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
++ const struct sh_mobile_meram_cfg *cfg,
++ unsigned int xres, unsigned int yres,
++ unsigned int pixelformat,
++ unsigned long base_addr_y,
++ unsigned long base_addr_c,
++ unsigned long *icb_addr_y,
++ unsigned long *icb_addr_c,
++ unsigned int *pitch)
+ {
+- struct platform_device *pdev;
++ struct sh_mobile_meram_fb_cache *cache;
+ struct sh_mobile_meram_priv *priv;
++ struct platform_device *pdev;
+ unsigned int out_pitch;
+- unsigned int n;
+- int error = 0;
+
+ if (!pdata || !pdata->priv || !pdata->pdev || !cfg)
+- return -EINVAL;
++ return ERR_PTR(-EINVAL);
+
+ if (pixelformat != SH_MOBILE_MERAM_PF_NV &&
+ pixelformat != SH_MOBILE_MERAM_PF_NV24 &&
+ pixelformat != SH_MOBILE_MERAM_PF_RGB)
+- return -EINVAL;
++ return ERR_PTR(-EINVAL);
+
+ priv = pdata->priv;
+ pdev = pdata->pdev;
+@@ -418,120 +477,82 @@ static int sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ /* we can't handle wider than 8192px */
+ if (xres > 8192) {
+ dev_err(&pdev->dev, "width exceeding the limit (> 8192).");
+- return -EINVAL;
+- }
+-
+- /* do we have at least one ICB config? */
+- if (cfg->icb[0].marker_icb < 0 || cfg->icb[0].cache_icb < 0) {
+- dev_err(&pdev->dev, "at least one ICB is required.");
+- return -EINVAL;
++ return ERR_PTR(-EINVAL);
+ }
+
+ mutex_lock(&priv->lock);
+
+- /* make sure that there's no overlaps */
+- if (meram_check_overlap(priv, &cfg->icb[0])) {
+- dev_err(&pdev->dev, "conflicting config detected.");
+- error = -EINVAL;
+- goto err;
+- }
+- n = 1;
+-
+- /* do the same if we have the second ICB set */
+- if (cfg->icb[1].marker_icb >= 0 && cfg->icb[1].cache_icb >= 0) {
+- if (meram_check_overlap(priv, &cfg->icb[1])) {
+- dev_err(&pdev->dev, "conflicting config detected.");
+- error = -EINVAL;
+- goto err;
+- }
+- n = 2;
+- }
+-
+- if (is_nvcolor(pixelformat) && n != 2) {
+- dev_err(&pdev->dev, "requires two ICB sets for planar Y/C.");
+- error = -EINVAL;
+- goto err;
+- }
+-
+ /* We now register the ICBs and allocate the MERAM regions. */
+- error = meram_alloc(priv, &cfg->icb[0], pixelformat);
+- if (error < 0)
++ cache = meram_alloc(priv, cfg, pixelformat);
++ if (IS_ERR(cache)) {
++ dev_err(&pdev->dev, "MERAM allocation failed (%ld).",
++ PTR_ERR(cache));
+ goto err;
+-
+- if (is_nvcolor(pixelformat)) {
+- error = meram_alloc(priv, &cfg->icb[1], pixelformat);
+- if (error < 0) {
+- meram_free(priv, &cfg->icb[0]);
+- goto err;
+- }
+ }
+
+ /* initialize MERAM */
+- meram_init(priv, &cfg->icb[0], xres, yres, &out_pitch);
++ meram_init(priv, &cache->planes[0], xres, yres, &out_pitch);
+ *pitch = out_pitch;
+ if (pixelformat == SH_MOBILE_MERAM_PF_NV)
+- meram_init(priv, &cfg->icb[1], xres, (yres + 1) / 2,
++ meram_init(priv, &cache->planes[1], xres, (yres + 1) / 2,
+ &out_pitch);
+ else if (pixelformat == SH_MOBILE_MERAM_PF_NV24)
+- meram_init(priv, &cfg->icb[1], 2 * xres, (yres + 1) / 2,
++ meram_init(priv, &cache->planes[1], 2 * xres, (yres + 1) / 2,
+ &out_pitch);
+
+- meram_set_next_addr(priv, cfg, base_addr_y, base_addr_c);
+- meram_get_next_icb_addr(pdata, cfg, icb_addr_y, icb_addr_c);
++ meram_set_next_addr(priv, cache, base_addr_y, base_addr_c);
++ meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c);
+
+ dev_dbg(&pdev->dev, "registered - can access via y=%08lx, c=%08lx",
+ *icb_addr_y, *icb_addr_c);
+
+ err:
+ mutex_unlock(&priv->lock);
+- return error;
++ return cache;
+ }
+
+-static int sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata,
+- const struct sh_mobile_meram_cfg *cfg)
++static int
++sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
+ {
++ struct sh_mobile_meram_fb_cache *cache = data;
+ struct sh_mobile_meram_priv *priv;
+- struct sh_mobile_meram_icb *icb;
+
+- if (!pdata || !pdata->priv || !cfg)
++ if (!pdata || !pdata->priv || !data)
+ return -EINVAL;
+
+ priv = pdata->priv;
+- icb = &priv->icbs[cfg->icb[0].marker_icb];
+
+ mutex_lock(&priv->lock);
+
+- /* deinit & unmark */
+- if (is_nvcolor(icb->pixelformat)) {
+- meram_deinit(priv, &cfg->icb[1]);
+- meram_free(priv, &cfg->icb[1]);
+- }
+- meram_deinit(priv, &cfg->icb[0]);
+- meram_free(priv, &cfg->icb[0]);
++ /* deinit & free */
++ meram_deinit(priv, &cache->planes[0]);
++ if (cache->nplanes == 2)
++ meram_deinit(priv, &cache->planes[1]);
++
++ meram_free(priv, cache);
+
+ mutex_unlock(&priv->lock);
+
+ return 0;
+ }
+
+-static int sh_mobile_meram_update(struct sh_mobile_meram_info *pdata,
+- const struct sh_mobile_meram_cfg *cfg,
+- unsigned long base_addr_y,
+- unsigned long base_addr_c,
+- unsigned long *icb_addr_y,
+- unsigned long *icb_addr_c)
++static int
++sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
++ unsigned long base_addr_y, unsigned long base_addr_c,
++ unsigned long *icb_addr_y, unsigned long *icb_addr_c)
+ {
++ struct sh_mobile_meram_fb_cache *cache = data;
+ struct sh_mobile_meram_priv *priv;
+
+- if (!pdata || !pdata->priv || !cfg)
++ if (!pdata || !pdata->priv || !data)
+ return -EINVAL;
+
+ priv = pdata->priv;
+
+ mutex_lock(&priv->lock);
+
+- meram_set_next_addr(priv, cfg, base_addr_y, base_addr_c);
+- meram_get_next_icb_addr(pdata, cfg, icb_addr_y, icb_addr_c);
++ meram_set_next_addr(priv, cache, base_addr_y, base_addr_c);
++ meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c);
+
+ mutex_unlock(&priv->lock);
+
+@@ -607,6 +628,7 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+ struct sh_mobile_meram_info *pdata = pdev->dev.platform_data;
+ struct resource *regs;
+ struct resource *meram;
++ unsigned int i;
+ int error;
+
+ if (!pdata) {
+@@ -627,8 +649,13 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev)
+ return -ENOMEM;
+ }
+
+- /* initialize private data */
++ /* Initialize private data. */
+ mutex_init(&priv->lock);
++ priv->used_icb = pdata->reserved_icbs;
++
++ for (i = 0; i < MERAM_ICB_NUM; ++i)
++ priv->icbs[i].index = i;
++
+ pdata->ops = &sh_mobile_meram_ops;
+ pdata->priv = priv;
+ pdata->pdev = pdev;
+diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
+index f7700fc..e0f650c 100644
+--- a/include/video/sh_mobile_meram.h
++++ b/include/video/sh_mobile_meram.h
+@@ -17,8 +17,13 @@ enum {
+ struct sh_mobile_meram_priv;
+ struct sh_mobile_meram_ops;
+
++/*
++ * struct sh_mobile_meram_info - MERAM platform data
++ * @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO)
++ */
+ struct sh_mobile_meram_info {
+ int addr_mode;
++ u32 reserved_icbs;
+ struct sh_mobile_meram_ops *ops;
+ struct sh_mobile_meram_priv *priv;
+ struct platform_device *pdev;
+@@ -39,23 +44,23 @@ struct module;
+ struct sh_mobile_meram_ops {
+ struct module *module;
+ /* register usage of meram */
+- int (*meram_register)(struct sh_mobile_meram_info *meram_dev,
+- const struct sh_mobile_meram_cfg *cfg,
+- unsigned int xres, unsigned int yres,
+- unsigned int pixelformat,
+- unsigned long base_addr_y,
+- unsigned long base_addr_c,
+- unsigned long *icb_addr_y,
+- unsigned long *icb_addr_c,
+- unsigned int *pitch);
++ void *(*meram_register)(struct sh_mobile_meram_info *meram_dev,
++ const struct sh_mobile_meram_cfg *cfg,
++ unsigned int xres, unsigned int yres,
++ unsigned int pixelformat,
++ unsigned long base_addr_y,
++ unsigned long base_addr_c,
++ unsigned long *icb_addr_y,
++ unsigned long *icb_addr_c,
++ unsigned int *pitch);
+
+ /* unregister usage of meram */
+ int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
+- const struct sh_mobile_meram_cfg *cfg);
++ void *data);
+
+ /* update meram settings */
+ int (*meram_update)(struct sh_mobile_meram_info *meram_dev,
+- const struct sh_mobile_meram_cfg *cfg,
++ void *data,
+ unsigned long base_addr_y,
+ unsigned long base_addr_c,
+ unsigned long *icb_addr_y,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0191-arm-mach-shmobile-Don-t-set-MERAM-ICB-numbers-in-pla.patch b/patches.armadillo800eva/0191-arm-mach-shmobile-Don-t-set-MERAM-ICB-numbers-in-pla.patch
new file mode 100644
index 00000000000000..e8bbb54109f2bb
--- /dev/null
+++ b/patches.armadillo800eva/0191-arm-mach-shmobile-Don-t-set-MERAM-ICB-numbers-in-pla.patch
@@ -0,0 +1,88 @@
+From b98cf20fdb3a2c39ed58add64ec9524c04cd005e Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Sun, 11 Sep 2011 23:30:45 +0200
+Subject: arm: mach-shmobile: Don't set MERAM ICB numbers in platform data
+
+The marker and cache ICBs are now allocated automatically, there's no
+need to specify them manually anymore.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit b0a49d98fa4315c17a098cb60ccc626645ed9756)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-ap4evb.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-ap4evb.c | 8 --------
+ arch/arm/mach-shmobile/board-mackerel.c | 8 --------
+ 2 files changed, 16 deletions(-)
+
+diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
+index 5f2735b..629b0f4 100644
+--- a/arch/arm/mach-shmobile/board-ap4evb.c
++++ b/arch/arm/mach-shmobile/board-ap4evb.c
+@@ -472,13 +472,9 @@ const static struct fb_videomode ap4evb_lcdc_modes[] = {
+ };
+ static struct sh_mobile_meram_cfg lcd_meram_cfg = {
+ .icb[0] = {
+- .marker_icb = 28,
+- .cache_icb = 24,
+ .meram_size = 0x40,
+ },
+ .icb[1] = {
+- .marker_icb = 29,
+- .cache_icb = 25,
+ .meram_size = 0x40,
+ },
+ };
+@@ -765,13 +761,9 @@ static struct platform_device fsi_ak4643_device = {
+ };
+ static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
+ .icb[0] = {
+- .marker_icb = 30,
+- .cache_icb = 26,
+ .meram_size = 0x100,
+ },
+ .icb[1] = {
+- .marker_icb = 31,
+- .cache_icb = 27,
+ .meram_size = 0x100,
+ },
+ };
+diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
+index 1fd4423..6d4bc29 100644
+--- a/arch/arm/mach-shmobile/board-mackerel.c
++++ b/arch/arm/mach-shmobile/board-mackerel.c
+@@ -369,13 +369,9 @@ static int mackerel_get_brightness(void)
+
+ static struct sh_mobile_meram_cfg lcd_meram_cfg = {
+ .icb[0] = {
+- .marker_icb = 28,
+- .cache_icb = 24,
+ .meram_size = 0x40,
+ },
+ .icb[1] = {
+- .marker_icb = 29,
+- .cache_icb = 25,
+ .meram_size = 0x40,
+ },
+ };
+@@ -430,13 +426,9 @@ static struct platform_device lcdc_device = {
+
+ static struct sh_mobile_meram_cfg hdmi_meram_cfg = {
+ .icb[0] = {
+- .marker_icb = 30,
+- .cache_icb = 26,
+ .meram_size = 0x100,
+ },
+ .icb[1] = {
+- .marker_icb = 31,
+- .cache_icb = 27,
+ .meram_size = 0x100,
+ },
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0192-fbdev-sh_mobile_meram-Remove-unused-sh_mobile_meram_.patch b/patches.armadillo800eva/0192-fbdev-sh_mobile_meram-Remove-unused-sh_mobile_meram_.patch
new file mode 100644
index 00000000000000..9ffed12f911bf8
--- /dev/null
+++ b/patches.armadillo800eva/0192-fbdev-sh_mobile_meram-Remove-unused-sh_mobile_meram_.patch
@@ -0,0 +1,31 @@
+From baf08efb7772e44a9227b0ddfdbd7a3c1c3f6ce0 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Mon, 12 Dec 2011 16:36:13 +0100
+Subject: fbdev: sh_mobile_meram: Remove unused sh_mobile_meram_icb_cfg fields
+
+The marker_icb and cache_icb fields are not used anymore, remove them.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit d81d5fa8adfb0ba19f44bb6c4c04a2a23effac3f)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ include/video/sh_mobile_meram.h | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
+index e0f650c..8979607 100644
+--- a/include/video/sh_mobile_meram.h
++++ b/include/video/sh_mobile_meram.h
+@@ -31,8 +31,6 @@ struct sh_mobile_meram_info {
+
+ /* icb config */
+ struct sh_mobile_meram_icb_cfg {
+- unsigned int marker_icb; /* ICB # for Marker ICB */
+- unsigned int cache_icb; /* ICB # for Cache ICB */
+ unsigned int meram_size; /* MERAM Buffer Size to use */
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0193-fbdev-sh_mobile_lcdc-Don-t-store-copy-of-platform-da.patch b/patches.armadillo800eva/0193-fbdev-sh_mobile_lcdc-Don-t-store-copy-of-platform-da.patch
new file mode 100644
index 00000000000000..42e3dc3c5478cc
--- /dev/null
+++ b/patches.armadillo800eva/0193-fbdev-sh_mobile_lcdc-Don-t-store-copy-of-platform-da.patch
@@ -0,0 +1,315 @@
+From 9fd77506008ee3c8390fe994023441bdc2dfd13a Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 22 Nov 2011 00:56:58 +0100
+Subject: fbdev: sh_mobile_lcdc: Don't store copy of platform data
+
+Instead of copying the whole platform data structure to struct
+sh_mobile_lcdc_chan, store a const pointer to the channel platform data.
+
+MERAM configuration information needs to be changed at runtime, so copy
+it to struct sh_mobile_lcdc_chan.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit b5ef967df13d4d243a2954c32bdd9181a1ee7382)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 71 +++++++++++++++++++-------------------
+ drivers/video/sh_mobile_lcdcfb.h | 3 +-
+ include/video/sh_mobile_lcdc.h | 2 +-
+ 3 files changed, 38 insertions(+), 38 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index d0c9026..0338516 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -116,7 +116,7 @@ static bool banked(int reg_nr)
+
+ static int lcdc_chan_is_sublcd(struct sh_mobile_lcdc_chan *chan)
+ {
+- return chan->cfg.chan == LCDC_CHAN_SUBLCD;
++ return chan->cfg->chan == LCDC_CHAN_SUBLCD;
+ }
+
+ static void lcdc_write_chan(struct sh_mobile_lcdc_chan *chan,
+@@ -289,7 +289,7 @@ static void sh_mobile_lcdc_deferred_io(struct fb_info *info,
+ struct list_head *pagelist)
+ {
+ struct sh_mobile_lcdc_chan *ch = info->par;
+- struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
++ const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg;
+
+ /* enable clocks before accessing hardware */
+ sh_mobile_lcdc_clk_on(ch->lcdc);
+@@ -336,7 +336,7 @@ static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
+
+ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+ {
+- struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
++ const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg;
+
+ if (ch->tx_dev) {
+ int ret;
+@@ -356,7 +356,7 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
+
+ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
+ {
+- struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg.panel_cfg;
++ const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg;
+
+ if (panel->display_off)
+ panel->display_off();
+@@ -644,16 +644,16 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
+ tmp = ch->ldmt1r_value;
+ tmp |= (var->sync & FB_SYNC_VERT_HIGH_ACT) ? 0 : LDMT1R_VPOL;
+ tmp |= (var->sync & FB_SYNC_HOR_HIGH_ACT) ? 0 : LDMT1R_HPOL;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_DWPOL) ? LDMT1R_DWPOL : 0;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_DIPOL) ? LDMT1R_DIPOL : 0;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_DAPOL) ? LDMT1R_DAPOL : 0;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_HSCNT) ? LDMT1R_HSCNT : 0;
+- tmp |= (ch->cfg.flags & LCDC_FLAGS_DWCNT) ? LDMT1R_DWCNT : 0;
++ tmp |= (ch->cfg->flags & LCDC_FLAGS_DWPOL) ? LDMT1R_DWPOL : 0;
++ tmp |= (ch->cfg->flags & LCDC_FLAGS_DIPOL) ? LDMT1R_DIPOL : 0;
++ tmp |= (ch->cfg->flags & LCDC_FLAGS_DAPOL) ? LDMT1R_DAPOL : 0;
++ tmp |= (ch->cfg->flags & LCDC_FLAGS_HSCNT) ? LDMT1R_HSCNT : 0;
++ tmp |= (ch->cfg->flags & LCDC_FLAGS_DWCNT) ? LDMT1R_DWCNT : 0;
+ lcdc_write_chan(ch, LDMT1R, tmp);
+
+ /* setup SYS bus */
+- lcdc_write_chan(ch, LDMT2R, ch->cfg.sys_bus_cfg.ldmt2r);
+- lcdc_write_chan(ch, LDMT3R, ch->cfg.sys_bus_cfg.ldmt3r);
++ lcdc_write_chan(ch, LDMT2R, ch->cfg->sys_bus_cfg.ldmt2r);
++ lcdc_write_chan(ch, LDMT3R, ch->cfg->sys_bus_cfg.ldmt3r);
+
+ /* horizontal configuration */
+ h_total = mode->xres + mode->hsync_len + mode->left_margin
+@@ -717,7 +717,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ /* Power supply */
+ lcdc_write_chan(ch, LDPMR, 0);
+
+- m = ch->cfg.clock_divider;
++ m = ch->cfg->clock_divider;
+ if (!m)
+ continue;
+
+@@ -768,7 +768,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ * continuous read mode.
+ */
+ if (ch->ldmt1r_value & LDMT1R_IFM &&
+- ch->cfg.sys_bus_cfg.deferred_io_msec) {
++ ch->cfg->sys_bus_cfg.deferred_io_msec) {
+ lcdc_write_chan(ch, LDSM1R, LDSM1R_OS);
+ lcdc_write(priv, _LDINTR, LDINTR_FE);
+ } else {
+@@ -822,13 +822,13 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
+
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+- struct sh_mobile_lcdc_panel_cfg *panel;
++ const struct sh_mobile_lcdc_panel_cfg *panel;
+
+ ch = &priv->ch[k];
+ if (!ch->enabled)
+ continue;
+
+- panel = &ch->cfg.panel_cfg;
++ panel = &ch->cfg->panel_cfg;
+ if (panel->setup_sys) {
+ ret = panel->setup_sys(ch, &sh_mobile_lcdc_sys_bus_ops);
+ if (ret)
+@@ -838,7 +838,6 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+
+ /* Compute frame buffer base address and pitch for each channel. */
+ for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
+- struct sh_mobile_meram_cfg *cfg;
+ int pixelformat;
+ void *meram;
+
+@@ -850,8 +849,8 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ ch->base_addr_c = ch->base_addr_y + ch->xres * ch->yres_virtual;
+
+ /* Enable MERAM if possible. */
+- cfg = ch->cfg.meram_cfg;
+- if (mdev == NULL || mdev->ops == NULL || cfg == NULL)
++ if (mdev == NULL || mdev->ops == NULL ||
++ ch->cfg->meram_cfg == NULL)
+ continue;
+
+ /* we need to de-init configured ICBs before we can
+@@ -881,8 +880,8 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ break;
+ }
+
+- meram = mdev->ops->meram_register(mdev, cfg, ch->pitch,
+- ch->yres, pixelformat,
++ meram = mdev->ops->meram_register(mdev, ch->cfg->meram_cfg,
++ ch->pitch, ch->yres, pixelformat,
+ ch->base_addr_y, ch->base_addr_c,
+ &ch->base_addr_y, &ch->base_addr_c,
+ &ch->pitch);
+@@ -901,7 +900,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+ if (!ch->enabled)
+ continue;
+
+- tmp = ch->cfg.sys_bus_cfg.deferred_io_msec;
++ tmp = ch->cfg->sys_bus_cfg.deferred_io_msec;
+ if (ch->ldmt1r_value & LDMT1R_IFM && tmp) {
+ ch->defio.deferred_io = sh_mobile_lcdc_deferred_io;
+ ch->defio.delay = msecs_to_jiffies(tmp);
+@@ -1210,8 +1209,8 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ * distance between two modes is defined as the size of the
+ * non-overlapping parts of the two rectangles.
+ */
+- for (i = 0; i < ch->cfg.num_modes; ++i) {
+- const struct fb_videomode *mode = &ch->cfg.lcd_modes[i];
++ for (i = 0; i < ch->cfg->num_modes; ++i) {
++ const struct fb_videomode *mode = &ch->cfg->lcd_modes[i];
+ unsigned int dist;
+
+ /* We can only round up. */
+@@ -1230,7 +1229,7 @@ static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *in
+ }
+
+ /* If no available mode can be used, return an error. */
+- if (ch->cfg.num_modes != 0) {
++ if (ch->cfg->num_modes != 0) {
+ if (best_dist == (unsigned int)-1)
+ return -EINVAL;
+
+@@ -1440,7 +1439,7 @@ sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch)
+ return ret;
+
+ dev_info(ch->lcdc->dev, "registered %s/%s as %dx%d %dbpp.\n",
+- dev_name(ch->lcdc->dev), (ch->cfg.chan == LCDC_CHAN_MAINLCD) ?
++ dev_name(ch->lcdc->dev), (ch->cfg->chan == LCDC_CHAN_MAINLCD) ?
+ "mainlcd" : "sublcd", info->var.xres, info->var.yres,
+ info->var.bits_per_pixel);
+
+@@ -1525,8 +1524,8 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
+ */
+ var = &info->var;
+ fb_videomode_to_var(var, mode);
+- var->width = ch->cfg.panel_cfg.width;
+- var->height = ch->cfg.panel_cfg.height;
++ var->width = ch->cfg->panel_cfg.width;
++ var->height = ch->cfg->panel_cfg.height;
+ var->yres_virtual = var->yres * 2;
+ var->activate = FB_ACTIVATE_NOW;
+
+@@ -1558,14 +1557,14 @@ static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
+ bdev->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
+ brightness = 0;
+
+- return ch->cfg.bl_info.set_brightness(brightness);
++ return ch->cfg->bl_info.set_brightness(brightness);
+ }
+
+ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
+ {
+ struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
+
+- return ch->cfg.bl_info.get_brightness();
++ return ch->cfg->bl_info.get_brightness();
+ }
+
+ static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev,
+@@ -1586,7 +1585,7 @@ static struct backlight_device *sh_mobile_lcdc_bl_probe(struct device *parent,
+ {
+ struct backlight_device *bl;
+
+- bl = backlight_device_register(ch->cfg.bl_info.name, parent, ch,
++ bl = backlight_device_register(ch->cfg->bl_info.name, parent, ch,
+ &sh_mobile_lcdc_bl_ops, NULL);
+ if (IS_ERR(bl)) {
+ dev_err(parent, "unable to register backlight device: %ld\n",
+@@ -1594,7 +1593,7 @@ static struct backlight_device *sh_mobile_lcdc_bl_probe(struct device *parent,
+ return NULL;
+ }
+
+- bl->props.max_brightness = ch->cfg.bl_info.max_brightness;
++ bl->props.max_brightness = ch->cfg->bl_info.max_brightness;
+ bl->props.brightness = bl->props.max_brightness;
+ backlight_update_status(bl);
+
+@@ -1727,7 +1726,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+
+ if (ch->tx_dev) {
+ ch->tx_dev->lcdc = NULL;
+- module_put(ch->cfg.tx_dev->dev.driver->owner);
++ module_put(ch->cfg->tx_dev->dev.driver->owner);
+ }
+
+ sh_mobile_lcdc_channel_fb_cleanup(ch);
+@@ -1758,7 +1757,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
+
+ static int __devinit sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
+ {
+- int interface_type = ch->cfg.interface_type;
++ int interface_type = ch->cfg->interface_type;
+
+ switch (interface_type) {
+ case RGB8:
+@@ -1801,7 +1800,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
+ struct sh_mobile_lcdc_chan *ch)
+ {
+ const struct sh_mobile_lcdc_format_info *format;
+- struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg;
++ const struct sh_mobile_lcdc_chan_cfg *cfg = ch->cfg;
+ const struct fb_videomode *max_mode;
+ const struct fb_videomode *mode;
+ unsigned int num_modes;
+@@ -1944,7 +1943,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ struct sh_mobile_lcdc_chan *ch = priv->ch + num_channels;
+
+ ch->lcdc = priv;
+- memcpy(&ch->cfg, &pdata->ch[i], sizeof(pdata->ch[i]));
++ ch->cfg = &pdata->ch[i];
+
+ error = sh_mobile_lcdc_check_interface(ch);
+ if (error) {
+@@ -1956,7 +1955,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
+ ch->pan_offset = 0;
+
+ /* probe the backlight is there is one defined */
+- if (ch->cfg.bl_info.max_brightness)
++ if (ch->cfg->bl_info.max_brightness)
+ ch->bl = sh_mobile_lcdc_bl_probe(&pdev->dev, ch);
+
+ switch (pdata->ch[i].chan) {
+diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
+index bf1707c..da1c26e 100644
+--- a/drivers/video/sh_mobile_lcdcfb.h
++++ b/drivers/video/sh_mobile_lcdcfb.h
+@@ -54,7 +54,7 @@ struct sh_mobile_lcdc_entity {
+ struct sh_mobile_lcdc_chan {
+ struct sh_mobile_lcdc_priv *lcdc;
+ struct sh_mobile_lcdc_entity *tx_dev;
+- struct sh_mobile_lcdc_chan_cfg cfg;
++ const struct sh_mobile_lcdc_chan_cfg *cfg;
+
+ unsigned long *reg_offs;
+ unsigned long ldmt1r_value;
+@@ -66,6 +66,7 @@ struct sh_mobile_lcdc_chan {
+
+ void *fb_mem;
+ unsigned long fb_size;
++
+ dma_addr_t dma_handle;
+ unsigned long pan_offset;
+
+diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
+index 484b0a2..7571b27 100644
+--- a/include/video/sh_mobile_lcdc.h
++++ b/include/video/sh_mobile_lcdc.h
+@@ -178,7 +178,7 @@ struct sh_mobile_lcdc_chan_cfg {
+ struct sh_mobile_lcdc_panel_cfg panel_cfg;
+ struct sh_mobile_lcdc_bl_info bl_info;
+ struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
+- struct sh_mobile_meram_cfg *meram_cfg;
++ const struct sh_mobile_meram_cfg *meram_cfg;
+
+ struct platform_device *tx_dev; /* HDMI/DSI transmitter device */
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0194-fbdev-sh_mobile_meram-Don-t-perform-update-in-regist.patch b/patches.armadillo800eva/0194-fbdev-sh_mobile_meram-Don-t-perform-update-in-regist.patch
new file mode 100644
index 00000000000000..1b28302e864d1c
--- /dev/null
+++ b/patches.armadillo800eva/0194-fbdev-sh_mobile_meram-Don-t-perform-update-in-regist.patch
@@ -0,0 +1,97 @@
+From ea1779467738995fccbefe4e65c1b42204e3b922 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 22 Nov 2011 00:56:58 +0100
+Subject: fbdev: sh_mobile_meram: Don't perform update in register operation
+
+Remove the RGB or Y/C base address update from the meram_register()
+operation, as this belongs to the meram_update() operation.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit 97d16fe69b6499a14a0c85c053f7bef54ce992a4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 8 +++++---
+ drivers/video/sh_mobile_meram.c | 15 ++-------------
+ include/video/sh_mobile_meram.h | 4 ----
+ 3 files changed, 7 insertions(+), 20 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 0338516..4b54cd5 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -882,11 +882,13 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
+
+ meram = mdev->ops->meram_register(mdev, ch->cfg->meram_cfg,
+ ch->pitch, ch->yres, pixelformat,
+- ch->base_addr_y, ch->base_addr_c,
+- &ch->base_addr_y, &ch->base_addr_c,
+ &ch->pitch);
+- if (!IS_ERR(meram))
++ if (!IS_ERR(meram)) {
++ mdev->ops->meram_update(mdev, meram,
++ ch->base_addr_y, ch->base_addr_c,
++ &ch->base_addr_y, &ch->base_addr_c);
+ ch->meram = meram;
++ }
+ }
+
+ /* Start the LCDC. */
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 085c49a..2ce0d8f 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -448,10 +448,6 @@ static void *sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ const struct sh_mobile_meram_cfg *cfg,
+ unsigned int xres, unsigned int yres,
+ unsigned int pixelformat,
+- unsigned long base_addr_y,
+- unsigned long base_addr_c,
+- unsigned long *icb_addr_y,
+- unsigned long *icb_addr_c,
+ unsigned int *pitch)
+ {
+ struct sh_mobile_meram_fb_cache *cache;
+@@ -470,9 +466,8 @@ static void *sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ priv = pdata->priv;
+ pdev = pdata->pdev;
+
+- dev_dbg(&pdev->dev, "registering %dx%d (%s) (y=%08lx, c=%08lx)",
+- xres, yres, (!pixelformat) ? "yuv" : "rgb",
+- base_addr_y, base_addr_c);
++ dev_dbg(&pdev->dev, "registering %dx%d (%s)", xres, yres,
++ !pixelformat ? "yuv" : "rgb");
+
+ /* we can't handle wider than 8192px */
+ if (xres > 8192) {
+@@ -500,12 +495,6 @@ static void *sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ meram_init(priv, &cache->planes[1], 2 * xres, (yres + 1) / 2,
+ &out_pitch);
+
+- meram_set_next_addr(priv, cache, base_addr_y, base_addr_c);
+- meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c);
+-
+- dev_dbg(&pdev->dev, "registered - can access via y=%08lx, c=%08lx",
+- *icb_addr_y, *icb_addr_c);
+-
+ err:
+ mutex_unlock(&priv->lock);
+ return cache;
+diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
+index 8979607..553335c 100644
+--- a/include/video/sh_mobile_meram.h
++++ b/include/video/sh_mobile_meram.h
+@@ -46,10 +46,6 @@ struct sh_mobile_meram_ops {
+ const struct sh_mobile_meram_cfg *cfg,
+ unsigned int xres, unsigned int yres,
+ unsigned int pixelformat,
+- unsigned long base_addr_y,
+- unsigned long base_addr_c,
+- unsigned long *icb_addr_y,
+- unsigned long *icb_addr_c,
+ unsigned int *pitch);
+
+ /* unregister usage of meram */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0195-fbdev-sh_mobile_meram-Remove-unneeded-sanity-checks.patch b/patches.armadillo800eva/0195-fbdev-sh_mobile_meram-Remove-unneeded-sanity-checks.patch
new file mode 100644
index 00000000000000..59eb81b81b2762
--- /dev/null
+++ b/patches.armadillo800eva/0195-fbdev-sh_mobile_meram-Remove-unneeded-sanity-checks.patch
@@ -0,0 +1,155 @@
+From b8aa2bcf6cfc6bf1963af975d01066952ecd194d Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 22 Nov 2011 00:56:58 +0100
+Subject: fbdev: sh_mobile_meram: Remove unneeded sanity checks
+
+The meram_register(), meram_unregister() and meram_update() operations
+check that the pointers they get from the caller are not NULL. Those
+checks can be remove, as the caller already ensures that the pointers
+are valid.
+
+The platform sanity checks can also be removed, as the operations can't
+be accessed without valid platform data anyway.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit cdf88b9072a86545611b9c3f5597ebc47e50ffc1)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_lcdcfb.c | 5 +----
+ drivers/video/sh_mobile_meram.c | 32 ++++++--------------------------
+ include/video/sh_mobile_meram.h | 15 +++++++--------
+ 3 files changed, 14 insertions(+), 38 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
+index 4b54cd5..7a0b301 100644
+--- a/drivers/video/sh_mobile_lcdcfb.c
++++ b/drivers/video/sh_mobile_lcdcfb.c
+@@ -1072,14 +1072,11 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
+
+ if (ch->meram) {
+ struct sh_mobile_meram_info *mdev;
+- int ret;
+
+ mdev = priv->meram_dev;
+- ret = mdev->ops->meram_update(mdev, ch->meram,
++ mdev->ops->meram_update(mdev, ch->meram,
+ base_addr_y, base_addr_c,
+ &base_addr_y, &base_addr_c);
+- if (ret)
+- return ret;
+ }
+
+ ch->base_addr_y = base_addr_y;
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index 2ce0d8f..d9f7a44 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -451,21 +451,15 @@ static void *sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+ unsigned int *pitch)
+ {
+ struct sh_mobile_meram_fb_cache *cache;
+- struct sh_mobile_meram_priv *priv;
+- struct platform_device *pdev;
++ struct sh_mobile_meram_priv *priv = pdata->priv;
++ struct platform_device *pdev = pdata->pdev;
+ unsigned int out_pitch;
+
+- if (!pdata || !pdata->priv || !pdata->pdev || !cfg)
+- return ERR_PTR(-EINVAL);
+-
+ if (pixelformat != SH_MOBILE_MERAM_PF_NV &&
+ pixelformat != SH_MOBILE_MERAM_PF_NV24 &&
+ pixelformat != SH_MOBILE_MERAM_PF_RGB)
+ return ERR_PTR(-EINVAL);
+
+- priv = pdata->priv;
+- pdev = pdata->pdev;
+-
+ dev_dbg(&pdev->dev, "registering %dx%d (%s)", xres, yres,
+ !pixelformat ? "yuv" : "rgb");
+
+@@ -500,16 +494,11 @@ err:
+ return cache;
+ }
+
+-static int
++static void
+ sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
+ {
+ struct sh_mobile_meram_fb_cache *cache = data;
+- struct sh_mobile_meram_priv *priv;
+-
+- if (!pdata || !pdata->priv || !data)
+- return -EINVAL;
+-
+- priv = pdata->priv;
++ struct sh_mobile_meram_priv *priv = pdata->priv;
+
+ mutex_lock(&priv->lock);
+
+@@ -521,22 +510,15 @@ sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
+ meram_free(priv, cache);
+
+ mutex_unlock(&priv->lock);
+-
+- return 0;
+ }
+
+-static int
++static void
+ sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
+ unsigned long base_addr_y, unsigned long base_addr_c,
+ unsigned long *icb_addr_y, unsigned long *icb_addr_c)
+ {
+ struct sh_mobile_meram_fb_cache *cache = data;
+- struct sh_mobile_meram_priv *priv;
+-
+- if (!pdata || !pdata->priv || !data)
+- return -EINVAL;
+-
+- priv = pdata->priv;
++ struct sh_mobile_meram_priv *priv = pdata->priv;
+
+ mutex_lock(&priv->lock);
+
+@@ -544,8 +526,6 @@ sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
+ meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c);
+
+ mutex_unlock(&priv->lock);
+-
+- return 0;
+ }
+
+ static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
+diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
+index 553335c..29b2fd3 100644
+--- a/include/video/sh_mobile_meram.h
++++ b/include/video/sh_mobile_meram.h
+@@ -49,16 +49,15 @@ struct sh_mobile_meram_ops {
+ unsigned int *pitch);
+
+ /* unregister usage of meram */
+- int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
+- void *data);
++ void (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
++ void *data);
+
+ /* update meram settings */
+- int (*meram_update)(struct sh_mobile_meram_info *meram_dev,
+- void *data,
+- unsigned long base_addr_y,
+- unsigned long base_addr_c,
+- unsigned long *icb_addr_y,
+- unsigned long *icb_addr_c);
++ void (*meram_update)(struct sh_mobile_meram_info *meram_dev, void *data,
++ unsigned long base_addr_y,
++ unsigned long base_addr_c,
++ unsigned long *icb_addr_y,
++ unsigned long *icb_addr_c);
+ };
+
+ #endif /* __VIDEO_SH_MOBILE_MERAM_H__ */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0196-fbdev-sh_mobile_meram-Implement-system-suspend-resum.patch b/patches.armadillo800eva/0196-fbdev-sh_mobile_meram-Implement-system-suspend-resum.patch
new file mode 100644
index 00000000000000..402db64380dbaf
--- /dev/null
+++ b/patches.armadillo800eva/0196-fbdev-sh_mobile_meram-Implement-system-suspend-resum.patch
@@ -0,0 +1,56 @@
+From 8981c1230376999c7f440d751775d650811342b7 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Tue, 22 Nov 2011 00:56:58 +0100
+Subject: fbdev: sh_mobile_meram: Implement system suspend/resume
+
+Supporting runtime PM is very nice, but that's not a reason not to
+implement system suspend/resume properly.
+
+Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+(cherry picked from commit af89956be14ae5bb304872756a47309edc2c94fb)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mobile_meram.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
+index d9f7a44..82ba830 100644
+--- a/drivers/video/sh_mobile_meram.c
++++ b/drivers/video/sh_mobile_meram.c
+@@ -539,7 +539,7 @@ static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
+ * Power management
+ */
+
+-static int sh_mobile_meram_runtime_suspend(struct device *dev)
++static int sh_mobile_meram_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
+@@ -563,7 +563,7 @@ static int sh_mobile_meram_runtime_suspend(struct device *dev)
+ return 0;
+ }
+
+-static int sh_mobile_meram_runtime_resume(struct device *dev)
++static int sh_mobile_meram_resume(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev);
+@@ -582,10 +582,9 @@ static int sh_mobile_meram_runtime_resume(struct device *dev)
+ return 0;
+ }
+
+-static const struct dev_pm_ops sh_mobile_meram_dev_pm_ops = {
+- .runtime_suspend = sh_mobile_meram_runtime_suspend,
+- .runtime_resume = sh_mobile_meram_runtime_resume,
+-};
++static UNIVERSAL_DEV_PM_OPS(sh_mobile_meram_dev_pm_ops,
++ sh_mobile_meram_suspend,
++ sh_mobile_meram_resume, NULL);
+
+ /* -----------------------------------------------------------------------------
+ * Probe/remove and driver init/exit
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0197-fbdev-sh_mipi_dsi-add-extra-phyctrl-for-sh_mipi_dsi_.patch b/patches.armadillo800eva/0197-fbdev-sh_mipi_dsi-add-extra-phyctrl-for-sh_mipi_dsi_.patch
new file mode 100644
index 00000000000000..a60316a5e6a94b
--- /dev/null
+++ b/patches.armadillo800eva/0197-fbdev-sh_mipi_dsi-add-extra-phyctrl-for-sh_mipi_dsi_.patch
@@ -0,0 +1,64 @@
+From 40b02e1ce5b088dbee79db5cc99f7482caf4ffb9 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 20 Mar 2012 18:34:10 -0700
+Subject: fbdev: sh_mipi_dsi: add extra phyctrl for sh_mipi_dsi_info
+
+sh_mipi uses some clocks, but the method of setup depends on CPU.
+
+Current SuperH (like sh73a0) can control all of these clocks
+by CPG (Clock Pulse Generator).
+It means we can control it by clock framework only.
+But on sh7372, it needs CPG settings AND sh_mipi PHYCTRL::PLLDS,
+and only sh7372 has PHYCTRL::PLLDS.
+
+But on current sh_mipi driver, PHYCTRL::PLLDS of sh7372 was
+overwrote since the callback timing of clock setting was changed
+by c2658b70f06108361aa5024798f9c1bf47c73374
+(fbdev: sh_mipi_dsi: fixup setup timing of sh_mipi_setup()).
+To solve this issue, this patch adds extra .phyctrl.
+
+This patch adds detail explanation for unclear mipi settings
+and fixup wrong PHYCTRL::PLLDS value for ap4evb (0xb -> 0x6).
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+(cherry picked from commit 8f9c60f2e29717155227f225b557d3f1fda442bd)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/board-ap4evb.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/video/sh_mipi_dsi.c | 2 +-
+ include/video/sh_mipi_dsi.h | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
+index 42ad0f7..4c6b844 100644
+--- a/drivers/video/sh_mipi_dsi.c
++++ b/drivers/video/sh_mipi_dsi.c
+@@ -273,7 +273,7 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
+ iowrite32(0x00000001, base + PHYCTRL);
+ udelay(200);
+ /* Deassert resets, power on */
+- iowrite32(0x03070001, base + PHYCTRL);
++ iowrite32(0x03070001 | pdata->phyctrl, base + PHYCTRL);
+
+ /*
+ * Default = ULPS enable |
+diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
+index 434d56b..06c67fb 100644
+--- a/include/video/sh_mipi_dsi.h
++++ b/include/video/sh_mipi_dsi.h
+@@ -51,6 +51,7 @@ struct sh_mipi_dsi_info {
+ int lane;
+ unsigned long flags;
+ u32 clksrc;
++ u32 phyctrl; /* for extra setting */
+ unsigned int vsynw_offset;
+ int (*set_dot_clock)(struct platform_device *pdev,
+ void __iomem *base,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0198-serial-sh-sci-Kill-off-bitrotted-H8-300-support.patch b/patches.armadillo800eva/0198-serial-sh-sci-Kill-off-bitrotted-H8-300-support.patch
new file mode 100644
index 00000000000000..5b9f9bbb704f9e
--- /dev/null
+++ b/patches.armadillo800eva/0198-serial-sh-sci-Kill-off-bitrotted-H8-300-support.patch
@@ -0,0 +1,263 @@
+From d220e25de0fcd549d5f8d518a05f57a4bd1e292b Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Wed, 1 Jun 2011 14:47:42 +0900
+Subject: serial: sh-sci: Kill off bitrotted H8/300 support.
+
+h8300 has never been updated upstream to support the conversion to the
+driver model (which happened mid-2.5), and it doesn't seem likely that it
+ever will. Kill off the remaining bitrotted support to reduce the
+maintenance burden going forward.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit ab7cfb5548d22604fafeaaa95950be2f97869f1e)
+
+Conflicts:
+
+ drivers/tty/serial/Kconfig
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 30 +------------
+ drivers/tty/serial/sh-sci.h | 103 +++++--------------------------------------
+ 2 files changed, 13 insertions(+), 120 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index bead17e..5174d2f 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -54,10 +54,6 @@
+ #include <asm/sh_bios.h>
+ #endif
+
+-#ifdef CONFIG_H8300
+-#include <asm/gpio.h>
+-#endif
+-
+ #include "sh-sci.h"
+
+ struct sci_port {
+@@ -164,23 +160,7 @@ static void sci_poll_put_char(struct uart_port *port, unsigned char c)
+ }
+ #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */
+
+-#if defined(__H8300H__) || defined(__H8300S__)
+-static void sci_init_pins(struct uart_port *port, unsigned int cflag)
+-{
+- int ch = (port->mapbase - SMR0) >> 3;
+-
+- /* set DDR regs */
+- H8300_GPIO_DDR(h8300_sci_pins[ch].port,
+- h8300_sci_pins[ch].rx,
+- H8300_GPIO_INPUT);
+- H8300_GPIO_DDR(h8300_sci_pins[ch].port,
+- h8300_sci_pins[ch].tx,
+- H8300_GPIO_OUTPUT);
+-
+- /* tx mark output*/
+- H8300_SCI_DR(ch) |= h8300_sci_pins[ch].tx;
+-}
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
++#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
+ static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
+ {
+ if (port->mapbase == 0xA4400000) {
+@@ -1868,14 +1848,8 @@ static int __devinit serial_console_setup(struct console *co, char *options)
+ if (options)
+ uart_parse_options(options, &baud, &parity, &bits, &flow);
+
+- ret = uart_set_options(port, co, baud, parity, bits, flow);
+-#if defined(__H8300H__) || defined(__H8300S__)
+- /* disable rx interrupt */
+- if (ret == 0)
+- sci_stop_rx(port);
+-#endif
+ /* TODO: disable clock */
+- return ret;
++ return uart_set_options(port, co, baud, parity, bits, flow);
+ }
+
+ static struct console serial_console = {
+diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
+index 1bb7130..e1ceebb 100644
+--- a/drivers/tty/serial/sh-sci.h
++++ b/drivers/tty/serial/sh-sci.h
+@@ -2,13 +2,6 @@
+ #include <linux/io.h>
+ #include <linux/gpio.h>
+
+-#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
+-#include <asm/regs306x.h>
+-#endif
+-#if defined(CONFIG_H8S2678)
+-#include <asm/regs267x.h>
+-#endif
+-
+ #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7707) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7708) || \
+@@ -72,10 +65,6 @@
+ #elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
+ # define SCSPTR2 0xffe80020 /* 16 bit SCIF */
+ # define SCIF_ORER 0x0001 /* overrun error bit */
+-#elif defined(CONFIG_H83007) || defined(CONFIG_H83068)
+-# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
+-#elif defined(CONFIG_H8S2678)
+-# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7757)
+ # define SCSPTR0 0xfe4b0020
+ # define SCIF_ORER 0x0001
+@@ -225,17 +214,6 @@
+ } \
+ }
+
+-#ifdef CONFIG_H8300
+-/* h8300 don't have SCIF */
+-#define CPU_SCIF_FNS(name) \
+- static inline unsigned int sci_##name##_in(struct uart_port *port) \
+- { \
+- return 0; \
+- } \
+- static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
+- { \
+- }
+-#else
+ #define CPU_SCIF_FNS(name, scif_offset, scif_size) \
+ static inline unsigned int sci_##name##_in(struct uart_port *port) \
+ { \
+@@ -245,7 +223,6 @@
+ { \
+ SCI_OUT(scif_size, scif_offset, value); \
+ }
+-#endif
+
+ #define CPU_SCI_FNS(name, sci_offset, sci_size) \
+ static inline unsigned int sci_##name##_in(struct uart_port* port) \
+@@ -264,8 +241,7 @@
+ defined(CONFIG_ARCH_SH7372)
+ #if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
+ #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
+- sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
+- h8_sci_offset, h8_sci_size) \
++ sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+ CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
+ #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+ CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
+@@ -284,19 +260,11 @@
+ CPU_SCIF_FNS(name, scif_offset, scif_size)
+ #else
+ #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
+- sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
+- h8_sci_offset, h8_sci_size) \
++ sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+ CPU_SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh3_scif_offset, sh3_scif_size)
+ #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+ CPU_SCIF_FNS(name, sh3_scif_offset, sh3_scif_size)
+ #endif
+-#elif defined(__H8300H__) || defined(__H8300S__)
+-#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
+- sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
+- h8_sci_offset, h8_sci_size) \
+- CPU_SCI_FNS(name, h8_sci_offset, h8_sci_size)
+-#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+- CPU_SCIF_FNS(name)
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
+ defined(CONFIG_CPU_SUBTYPE_SH7724)
+ #define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scif_offset, sh4_scif_size) \
+@@ -305,8 +273,7 @@
+ CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
+ #else
+ #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
+- sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
+- h8_sci_offset, h8_sci_size) \
++ sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+ CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
+ #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+ CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
+@@ -355,14 +322,14 @@ SCIF_FNS(SCFCR, 0x18, 16)
+ SCIF_FNS(SCFDR, 0x1c, 16)
+ SCIF_FNS(SCLSR, 0x24, 16)
+ #else
+-/* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 SCI/H8*/
+-/* name off sz off sz off sz off sz off sz*/
+-SCIx_FNS(SCSMR, 0x00, 8, 0x00, 8, 0x00, 8, 0x00, 16, 0x00, 8)
+-SCIx_FNS(SCBRR, 0x02, 8, 0x04, 8, 0x02, 8, 0x04, 8, 0x01, 8)
+-SCIx_FNS(SCSCR, 0x04, 8, 0x08, 8, 0x04, 8, 0x08, 16, 0x02, 8)
+-SCIx_FNS(SCxTDR, 0x06, 8, 0x0c, 8, 0x06, 8, 0x0C, 8, 0x03, 8)
+-SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8)
+-SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8)
++/* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 */
++/* name off sz off sz off sz off sz */
++SCIx_FNS(SCSMR, 0x00, 8, 0x00, 8, 0x00, 8, 0x00, 16)
++SCIx_FNS(SCBRR, 0x02, 8, 0x04, 8, 0x02, 8, 0x04, 8)
++SCIx_FNS(SCSCR, 0x04, 8, 0x08, 8, 0x04, 8, 0x08, 16)
++SCIx_FNS(SCxTDR, 0x06, 8, 0x0c, 8, 0x06, 8, 0x0C, 8)
++SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16)
++SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8)
+ SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16)
+ #if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7780) || \
+@@ -392,48 +359,6 @@ SCIF_FNS(SCLSR, 0, 0, 0x24, 16)
+ #define sci_in(port, reg) sci_##reg##_in(port)
+ #define sci_out(port, reg, value) sci_##reg##_out(port, value)
+
+-/* H8/300 series SCI pins assignment */
+-#if defined(__H8300H__) || defined(__H8300S__)
+-static const struct __attribute__((packed)) {
+- int port; /* GPIO port no */
+- unsigned short rx,tx; /* GPIO bit no */
+-} h8300_sci_pins[] = {
+-#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
+- { /* SCI0 */
+- .port = H8300_GPIO_P9,
+- .rx = H8300_GPIO_B2,
+- .tx = H8300_GPIO_B0,
+- },
+- { /* SCI1 */
+- .port = H8300_GPIO_P9,
+- .rx = H8300_GPIO_B3,
+- .tx = H8300_GPIO_B1,
+- },
+- { /* SCI2 */
+- .port = H8300_GPIO_PB,
+- .rx = H8300_GPIO_B7,
+- .tx = H8300_GPIO_B6,
+- }
+-#elif defined(CONFIG_H8S2678)
+- { /* SCI0 */
+- .port = H8300_GPIO_P3,
+- .rx = H8300_GPIO_B2,
+- .tx = H8300_GPIO_B0,
+- },
+- { /* SCI1 */
+- .port = H8300_GPIO_P3,
+- .rx = H8300_GPIO_B3,
+- .tx = H8300_GPIO_B1,
+- },
+- { /* SCI2 */
+- .port = H8300_GPIO_P5,
+- .rx = H8300_GPIO_B1,
+- .tx = H8300_GPIO_B0,
+- }
+-#endif
+-};
+-#endif
+-
+ #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7707) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7708) || \
+@@ -456,12 +381,6 @@ static inline int sci_rxd_in(struct uart_port *port)
+ return __raw_readb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
+ return 1;
+ }
+-#elif defined(__H8300H__) || defined(__H8300S__)
+-static inline int sci_rxd_in(struct uart_port *port)
+-{
+- int ch = (port->mapbase - SMR0) >> 3;
+- return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0;
+-}
+ #else /* default case for non-SCI processors */
+ static inline int sci_rxd_in(struct uart_port *port)
+ {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0199-serial-sh-sci-Tidy-up-ioread-write-wrappers-kill-off.patch b/patches.armadillo800eva/0199-serial-sh-sci-Tidy-up-ioread-write-wrappers-kill-off.patch
new file mode 100644
index 00000000000000..765f7e3eba1a2c
--- /dev/null
+++ b/patches.armadillo800eva/0199-serial-sh-sci-Tidy-up-ioread-write-wrappers-kill-off.patch
@@ -0,0 +1,87 @@
+From 931612e926da91a2fe197b43ed0294bd04ce1fd1 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Wed, 8 Jun 2011 17:06:25 +0900
+Subject: serial: sh-sci: Tidy up ioread/write wrappers, kill off unused SCI
+ helper.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit a01cdc10689f5d252530d14474528ea785ecfde4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.h | 35 +++++++++--------------------------
+ 1 file changed, 9 insertions(+), 26 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
+index e1ceebb..2d667ab 100644
+--- a/drivers/tty/serial/sh-sci.h
++++ b/drivers/tty/serial/sh-sci.h
+@@ -183,32 +183,25 @@
+ #define SCI_MAJOR 204
+ #define SCI_MINOR_START 8
+
+-#define SCI_IN(size, offset) \
+- if ((size) == 8) { \
+- return ioread8(port->membase + (offset)); \
+- } else { \
+- return ioread16(port->membase + (offset)); \
+- }
+-#define SCI_OUT(size, offset, value) \
+- if ((size) == 8) { \
+- iowrite8(value, port->membase + (offset)); \
+- } else if ((size) == 16) { \
+- iowrite16(value, port->membase + (offset)); \
+- }
++#define SCI_IN(size, offset) \
++ ioread##size(port->membase + (offset))
++
++#define SCI_OUT(size, offset, value) \
++ iowrite##size(value, port->membase + (offset))
+
+ #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
+ static inline unsigned int sci_##name##_in(struct uart_port *port) \
+ { \
+ if (port->type == PORT_SCIF || port->type == PORT_SCIFB) { \
+- SCI_IN(scif_size, scif_offset) \
++ return SCI_IN(scif_size, scif_offset); \
+ } else { /* PORT_SCI or PORT_SCIFA */ \
+- SCI_IN(sci_size, sci_offset); \
++ return SCI_IN(sci_size, sci_offset); \
+ } \
+ } \
+ static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
+ { \
+ if (port->type == PORT_SCIF || port->type == PORT_SCIFB) { \
+- SCI_OUT(scif_size, scif_offset, value) \
++ SCI_OUT(scif_size, scif_offset, value); \
+ } else { /* PORT_SCI or PORT_SCIFA */ \
+ SCI_OUT(sci_size, sci_offset, value); \
+ } \
+@@ -217,23 +210,13 @@
+ #define CPU_SCIF_FNS(name, scif_offset, scif_size) \
+ static inline unsigned int sci_##name##_in(struct uart_port *port) \
+ { \
+- SCI_IN(scif_size, scif_offset); \
++ return SCI_IN(scif_size, scif_offset); \
+ } \
+ static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
+ { \
+ SCI_OUT(scif_size, scif_offset, value); \
+ }
+
+-#define CPU_SCI_FNS(name, sci_offset, sci_size) \
+- static inline unsigned int sci_##name##_in(struct uart_port* port) \
+- { \
+- SCI_IN(sci_size, sci_offset); \
+- } \
+- static inline void sci_##name##_out(struct uart_port* port, unsigned int value) \
+- { \
+- SCI_OUT(sci_size, sci_offset, value); \
+- }
+-
+ #if defined(CONFIG_CPU_SH3) || \
+ defined(CONFIG_ARCH_SH73A0) || \
+ defined(CONFIG_ARCH_SH7367) || \
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0200-serial-sh-sci-Kill-off-some-more-unused-definitions.patch b/patches.armadillo800eva/0200-serial-sh-sci-Kill-off-some-more-unused-definitions.patch
new file mode 100644
index 00000000000000..238db2b8a081c7
--- /dev/null
+++ b/patches.armadillo800eva/0200-serial-sh-sci-Kill-off-some-more-unused-definitions.patch
@@ -0,0 +1,38 @@
+From 055087947c54ebcc250135502ffcc149f2a910b0 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Wed, 8 Jun 2011 17:13:20 +0900
+Subject: serial: sh-sci: Kill off some more unused definitions.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit b03034016184b7e9fd19f2a24ffb131953fdcc41)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.h | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
+index 2d667ab..a64beaf 100644
+--- a/drivers/tty/serial/sh-sci.h
++++ b/drivers/tty/serial/sh-sci.h
+@@ -9,8 +9,6 @@
+ # define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */
+ # define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7705)
+-# define SCIF0 0xA4400000
+-# define SCIF2 0xA4410000
+ # define SCPCR 0xA4000116
+ # define SCPDR 0xA4000136
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
+@@ -48,8 +46,6 @@
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7343)
+ # define SCSPTR0 0xffe00010 /* 16 bit SCIF */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7722)
+-# define PADR 0xA4050120
+-# define PSDR 0xA405013e
+ # define PWDR 0xA4050166
+ # define PSCR 0xA405011E
+ # define SCIF_ORER 0x0001 /* overrun error bit */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0201-serial-sh-sci-Generalize-overrun-handling.patch b/patches.armadillo800eva/0201-serial-sh-sci-Generalize-overrun-handling.patch
new file mode 100644
index 00000000000000..fbb6a00e4e71c1
--- /dev/null
+++ b/patches.armadillo800eva/0201-serial-sh-sci-Generalize-overrun-handling.patch
@@ -0,0 +1,304 @@
+From 7dec2c8e8106f9d403696a7e361e4b7ecbc4194e Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Wed, 8 Jun 2011 18:19:37 +0900
+Subject: serial: sh-sci: Generalize overrun handling.
+
+This consolidates all of the broken out overrun handling and ensures that
+we have sensible defaults per-port type, in addition to making sure that
+overruns are flagged appropriately in the error mask for parts that
+haven't explicitly disabled support for it.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit debf9507166eede1e676d27d3298cdfb27399cb4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 51 +++++++++++++++++++++++++++++++++++++-----
+ drivers/tty/serial/sh-sci.h | 52 ++-----------------------------------------
+ include/linux/serial_sci.h | 30 +++++++++++++++++++++++++
+ 3 files changed, 77 insertions(+), 56 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 5174d2f..b2c424b 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -563,13 +563,19 @@ static int sci_handle_errors(struct uart_port *port)
+ int copied = 0;
+ unsigned short status = sci_in(port, SCxSR);
+ struct tty_struct *tty = port->state->port.tty;
++ struct sci_port *s = to_sci_port(port);
+
+- if (status & SCxSR_ORER(port)) {
+- /* overrun error */
+- if (tty_insert_flip_char(tty, 0, TTY_OVERRUN))
+- copied++;
++ /*
++ * Handle overruns, if supported.
++ */
++ if (s->cfg->overrun_bit != SCIx_NOT_SUPPORTED) {
++ if (status & (1 << s->cfg->overrun_bit)) {
++ /* overrun error */
++ if (tty_insert_flip_char(tty, 0, TTY_OVERRUN))
++ copied++;
+
+- dev_notice(port->dev, "overrun error");
++ dev_notice(port->dev, "overrun error");
++ }
+ }
+
+ if (status & SCxSR_FER(port)) {
+@@ -617,12 +623,19 @@ static int sci_handle_errors(struct uart_port *port)
+ static int sci_handle_fifo_overrun(struct uart_port *port)
+ {
+ struct tty_struct *tty = port->state->port.tty;
++ struct sci_port *s = to_sci_port(port);
+ int copied = 0;
+
++ /*
++ * XXX: Technically not limited to non-SCIFs, it's simply the
++ * SCLSR check that is for the moment SCIF-specific. This
++ * probably wants to be revisited for SCIFA/B as well as for
++ * factoring in SCI overrun detection.
++ */
+ if (port->type != PORT_SCIF)
+ return 0;
+
+- if ((sci_in(port, SCLSR) & SCIF_ORER) != 0) {
++ if ((sci_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) {
+ sci_out(port, SCLSR, 0);
+
+ tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+@@ -1760,6 +1773,32 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ sci_port->break_timer.function = sci_break_timer;
+ init_timer(&sci_port->break_timer);
+
++ /*
++ * Establish some sensible defaults for the error detection.
++ */
++ if (!p->error_mask)
++ p->error_mask = (p->type == PORT_SCI) ?
++ SCI_DEFAULT_ERROR_MASK : SCIF_DEFAULT_ERROR_MASK;
++
++ /*
++ * Establish sensible defaults for the overrun detection, unless
++ * the part has explicitly disabled support for it.
++ */
++ if (p->overrun_bit != SCIx_NOT_SUPPORTED) {
++ if (p->type == PORT_SCI)
++ p->overrun_bit = 5;
++ else if (p->scbrr_algo_id == SCBRR_ALGO_4)
++ p->overrun_bit = 9;
++ else
++ p->overrun_bit = 0;
++
++ /*
++ * Make the error mask inclusive of overrun detection, if
++ * supported.
++ */
++ p->error_mask |= (1 << p->overrun_bit);
++ }
++
+ sci_port->cfg = p;
+
+ port->mapbase = p->mapbase;
+diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
+index a64beaf..a2f69f8 100644
+--- a/drivers/tty/serial/sh-sci.h
++++ b/drivers/tty/serial/sh-sci.h
+@@ -19,11 +19,9 @@
+ defined(CONFIG_ARCH_SH7372)
+ # define PORT_PTCR 0xA405011EUL
+ # define PORT_PVCR 0xA4050122UL
+-# define SCIF_ORER 0x0200 /* overrun error bit */
+ #elif defined(CONFIG_SH_RTS7751R2D)
+ # define SCSPTR1 0xFFE0001C /* 8 bit SCIF */
+ # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
+@@ -32,15 +30,12 @@
+ defined(CONFIG_CPU_SUBTYPE_SH7751R)
+ # define SCSPTR1 0xffe0001c /* 8 bit SCI */
+ # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7760)
+ # define SCSPTR0 0xfe600024 /* 16 bit SCIF */
+ # define SCSPTR1 0xfe610024 /* 16 bit SCIF */
+ # define SCSPTR2 0xfe620024 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
+ # define SCSPTR0 0xA4400000 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ # define PACR 0xa4050100
+ # define PBCR 0xa4050102
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7343)
+@@ -48,35 +43,24 @@
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7722)
+ # define PWDR 0xA4050166
+ # define PSCR 0xA405011E
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7366)
+ # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */
+ # define SCSPTR0 SCPDR0
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7723)
+ # define SCSPTR0 0xa4050160
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7724)
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
+ # define SCSPTR2 0xffe80020 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7757)
+ # define SCSPTR0 0xfe4b0020
+-# define SCIF_ORER 0x0001
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7763)
+ # define SCSPTR0 0xffe00024 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7770)
+ # define SCSPTR0 0xff923020 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7780)
+ # define SCSPTR0 0xffe00024 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* Overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7786)
+ # define SCSPTR0 0xffea0024 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* Overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7203) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7206) || \
+@@ -84,36 +68,12 @@
+ # define SCSPTR0 0xfffe8020 /* 16 bit SCIF */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7619)
+ # define SCSPTR0 0xf8400020 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* overrun error bit */
+ #elif defined(CONFIG_CPU_SUBTYPE_SHX3)
+ # define SCSPTR0 0xffc30020 /* 16 bit SCIF */
+-# define SCIF_ORER 0x0001 /* Overrun error bit */
+ #else
+ # error CPU subtype not defined
+ #endif
+
+-/* SCxSR SCI */
+-#define SCI_TDRE 0x80 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
+-#define SCI_RDRF 0x40 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
+-#define SCI_ORER 0x20 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
+-#define SCI_FER 0x10 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
+-#define SCI_PER 0x08 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
+-#define SCI_TEND 0x04 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
+-/* SCI_MPB 0x02 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
+-/* SCI_MPBT 0x01 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
+-
+-#define SCI_ERRORS ( SCI_PER | SCI_FER | SCI_ORER)
+-
+-/* SCxSR SCIF */
+-#define SCIF_ER 0x0080 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
+-#define SCIF_TEND 0x0040 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
+-#define SCIF_TDFE 0x0020 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
+-#define SCIF_BRK 0x0010 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
+-#define SCIF_FER 0x0008 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
+-#define SCIF_PER 0x0004 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
+-#define SCIF_RDF 0x0002 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
+-#define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
+-
+ #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7720) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+@@ -121,35 +81,27 @@
+ defined(CONFIG_ARCH_SH7367) || \
+ defined(CONFIG_ARCH_SH7377) || \
+ defined(CONFIG_ARCH_SH7372)
+-# define SCIF_ORER 0x0200
+-# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
+ # define SCIF_RFDC_MASK 0x007f
+ # define SCIF_TXROOM_MAX 64
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7763)
+-# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK )
+ # define SCIF_RFDC_MASK 0x007f
+ # define SCIF_TXROOM_MAX 64
+ /* SH7763 SCIF2 support */
+ # define SCIF2_RFDC_MASK 0x001f
+ # define SCIF2_TXROOM_MAX 16
+ #else
+-# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
+ # define SCIF_RFDC_MASK 0x001f
+ # define SCIF_TXROOM_MAX 16
+ #endif
+
+-#ifndef SCIF_ORER
+-#define SCIF_ORER 0x0000
+-#endif
+-
+ #define SCxSR_TEND(port) (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND)
+-#define SCxSR_ERRORS(port) (((port)->type == PORT_SCI) ? SCI_ERRORS : SCIF_ERRORS)
+ #define SCxSR_RDxF(port) (((port)->type == PORT_SCI) ? SCI_RDRF : SCIF_RDF)
+ #define SCxSR_TDxE(port) (((port)->type == PORT_SCI) ? SCI_TDRE : SCIF_TDFE)
+ #define SCxSR_FER(port) (((port)->type == PORT_SCI) ? SCI_FER : SCIF_FER)
+ #define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER)
+ #define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK)
+-#define SCxSR_ORER(port) (((port)->type == PORT_SCI) ? SCI_ORER : SCIF_ORER)
++
++#define SCxSR_ERRORS(port) (to_sci_port(port)->cfg->error_mask)
+
+ #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7720) || \
+diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
+index a2afc9f..5fac3bc 100644
+--- a/include/linux/serial_sci.h
++++ b/include/linux/serial_sci.h
+@@ -8,6 +8,8 @@
+ * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts)
+ */
+
++#define SCIx_NOT_SUPPORTED (-1)
++
+ enum {
+ SCBRR_ALGO_1, /* ((clk + 16 * bps) / (16 * bps) - 1) */
+ SCBRR_ALGO_2, /* ((clk + 16 * bps) / (32 * bps) - 1) */
+@@ -25,6 +27,28 @@ enum {
+ #define SCSCR_CKE1 (1 << 1)
+ #define SCSCR_CKE0 (1 << 0)
+
++/* SCxSR SCI */
++#define SCI_TDRE 0x80
++#define SCI_RDRF 0x40
++#define SCI_ORER 0x20
++#define SCI_FER 0x10
++#define SCI_PER 0x08
++#define SCI_TEND 0x04
++
++#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER)
++
++/* SCxSR SCIF */
++#define SCIF_ER 0x0080
++#define SCIF_TEND 0x0040
++#define SCIF_TDFE 0x0020
++#define SCIF_BRK 0x0010
++#define SCIF_FER 0x0008
++#define SCIF_PER 0x0004
++#define SCIF_RDF 0x0002
++#define SCIF_DR 0x0001
++
++#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
++
+ /* Offsets into the sci_port->irqs array */
+ enum {
+ SCIx_ERI_IRQ,
+@@ -56,6 +80,12 @@ struct plat_sci_port {
+ unsigned int scbrr_algo_id; /* SCBRR calculation algo */
+ unsigned int scscr; /* SCSCR initialization */
+
++ /*
++ * Platform overrides if necessary, defaults otherwise.
++ */
++ int overrun_bit;
++ unsigned int error_mask;
++
+ struct device *dma_dev;
+
+ unsigned int dma_slave_tx;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0202-serial-sh-sci-Consolidate-RXD-pin-handling.patch b/patches.armadillo800eva/0202-serial-sh-sci-Consolidate-RXD-pin-handling.patch
new file mode 100644
index 00000000000000..10fd4707d21cd4
--- /dev/null
+++ b/patches.armadillo800eva/0202-serial-sh-sci-Consolidate-RXD-pin-handling.patch
@@ -0,0 +1,108 @@
+From f310bca4c5b0a4dbaf6bf4c4f17068cab7a74d9c Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Wed, 8 Jun 2011 18:51:32 +0900
+Subject: serial: sh-sci: Consolidate RXD pin handling.
+
+Non-SCI parts do not have the special port reg necessary for cases where
+the RX and SCI pins are muxed and need to be manually polled, so these
+like always fall back on the normal FIFO processing paths. SH7760 is in a
+class in and of itself with regards to mapping its SIM card interface via
+the SCI port class despite not having any of the RXD lines wired up and
+so implicitly behaving more like a SCIF in this regard. Out of the other
+CPUs, some support the port check via the same block while others do it
+through an external SuperI/O, so it's not even possible to perform the
+check relative to the ioremapped cookie offset, so the separate read
+semantics are preserved here, too.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 514820eb982eb85677ed2ecef9710e90e24fbdab)
+
+Conflicts:
+
+ arch/sh/kernel/cpu/sh3/setup-sh770x.c
+ arch/sh/kernel/cpu/sh4/setup-sh7750.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 13 +++++++++++++
+ drivers/tty/serial/sh-sci.h | 29 -----------------------------
+ include/linux/serial_sci.h | 2 ++
+ 3 files changed, 15 insertions(+), 29 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index b2c424b..92ad023 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -363,6 +363,19 @@ static int sci_rxfill(struct uart_port *port)
+ return (sci_in(port, SCxSR) & SCxSR_RDxF(port)) != 0;
+ }
+
++/*
++ * SCI helper for checking the state of the muxed port/RXD pins.
++ */
++static inline int sci_rxd_in(struct uart_port *port)
++{
++ struct sci_port *s = to_sci_port(port);
++
++ if (s->cfg->port_reg <= 0)
++ return 1;
++
++ return !!__raw_readb(s->cfg->port_reg);
++}
++
+ /* ********************************************************************** *
+ * the interrupt related routines *
+ * ********************************************************************** */
+diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
+index a2f69f8..4c67c9a 100644
+--- a/drivers/tty/serial/sh-sci.h
++++ b/drivers/tty/serial/sh-sci.h
+@@ -289,32 +289,3 @@ SCIF_FNS(SCLSR, 0, 0, 0x24, 16)
+ #endif
+ #define sci_in(port, reg) sci_##reg##_in(port)
+ #define sci_out(port, reg, value) sci_##reg##_out(port, value)
+-
+-#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7707) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7708) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7709)
+-static inline int sci_rxd_in(struct uart_port *port)
+-{
+- if (port->mapbase == 0xfffffe80)
+- return __raw_readb(SCPDR)&0x01 ? 1 : 0; /* SCI */
+- return 1;
+-}
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7751) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7091)
+-static inline int sci_rxd_in(struct uart_port *port)
+-{
+- if (port->mapbase == 0xffe00000)
+- return __raw_readb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
+- return 1;
+-}
+-#else /* default case for non-SCI processors */
+-static inline int sci_rxd_in(struct uart_port *port)
+-{
+- return 1;
+-}
+-#endif
+diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
+index 5fac3bc..ecefec7 100644
+--- a/include/linux/serial_sci.h
++++ b/include/linux/serial_sci.h
+@@ -86,6 +86,8 @@ struct plat_sci_port {
+ int overrun_bit;
+ unsigned int error_mask;
+
++ int port_reg;
++
+ struct device *dma_dev;
+
+ unsigned int dma_slave_tx;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0203-serial-sh-sci-More-unused-define-purging.patch b/patches.armadillo800eva/0203-serial-sh-sci-More-unused-define-purging.patch
new file mode 100644
index 00000000000000..1d28a967b7cd2e
--- /dev/null
+++ b/patches.armadillo800eva/0203-serial-sh-sci-More-unused-define-purging.patch
@@ -0,0 +1,80 @@
+From deb74f85329e5db4bc1827b104badf18d13a992f Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Wed, 8 Jun 2011 19:13:06 +0900
+Subject: serial: sh-sci: More unused define purging.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit e13198894bf6308c097e5678ee315e12b2e1b7a8)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.h | 21 ++++++---------------
+ 1 file changed, 6 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
+index 4c67c9a..25788c4 100644
+--- a/drivers/tty/serial/sh-sci.h
++++ b/drivers/tty/serial/sh-sci.h
+@@ -2,15 +2,13 @@
+ #include <linux/io.h>
+ #include <linux/gpio.h>
+
+-#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
++#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
++ defined(CONFIG_CPU_SUBTYPE_SH7706) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7707) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7708) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7709)
+ # define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */
+ # define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
+-# define SCPCR 0xA4000116
+-# define SCPDR 0xA4000136
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+ defined(CONFIG_ARCH_SH73A0) || \
+@@ -19,20 +17,16 @@
+ defined(CONFIG_ARCH_SH7372)
+ # define PORT_PTCR 0xA405011EUL
+ # define PORT_PVCR 0xA4050122UL
+-#elif defined(CONFIG_SH_RTS7751R2D)
+-# define SCSPTR1 0xFFE0001C /* 8 bit SCIF */
+-# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7091) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7751) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7751R)
+-# define SCSPTR1 0xffe0001c /* 8 bit SCI */
++ defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
++ defined(CONFIG_CPU_SUBTYPE_SH4_202)
+ # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7760)
+ # define SCSPTR0 0xfe600024 /* 16 bit SCIF */
+-# define SCSPTR1 0xfe610024 /* 16 bit SCIF */
+ # define SCSPTR2 0xfe620024 /* 16 bit SCIF */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
+ # define SCSPTR0 0xA4400000 /* 16 bit SCIF */
+@@ -48,16 +42,13 @@
+ # define SCSPTR0 SCPDR0
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7723)
+ # define SCSPTR0 0xa4050160
+-#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
+-# define SCSPTR2 0xffe80020 /* 16 bit SCIF */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7757)
+ # define SCSPTR0 0xfe4b0020
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
++#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
++ defined(CONFIG_CPU_SUBTYPE_SH7780)
+ # define SCSPTR0 0xffe00024 /* 16 bit SCIF */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7770)
+ # define SCSPTR0 0xff923020 /* 16 bit SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
+-# define SCSPTR0 0xffe00024 /* 16 bit SCIF */
+ #elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7786)
+ # define SCSPTR0 0xffea0024 /* 16 bit SCIF */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0204-serial-sh-sci-Abstract-register-maps.patch b/patches.armadillo800eva/0204-serial-sh-sci-Abstract-register-maps.patch
new file mode 100644
index 00000000000000..afb06357f9d7ac
--- /dev/null
+++ b/patches.armadillo800eva/0204-serial-sh-sci-Abstract-register-maps.patch
@@ -0,0 +1,766 @@
+From 87a637a00d37956fffc06dac76e0678cc21f4cd2 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 14 Jun 2011 12:40:19 +0900
+Subject: serial: sh-sci: Abstract register maps.
+
+This takes a bit of a sledgehammer to the horribly CPU subtype
+ifdef-ridden header and abstracts all of the different register layouts
+in to distinct types which in turn can be overriden on a per-port basis,
+or permitted to default to the map matching the port type at probe time.
+
+In the process this ultimately fixes up inumerable bugs with mismatches
+on various CPU types (particularly the legacy ones that were obviously
+broken years ago and no one noticed) and provides a more tightly coupled
+and consolidated platform for extending and implementing generic
+features.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 61a6976bf19a6cf5dfcf37c3536665b316f22d49)
+
+Conflicts:
+
+ arch/sh/Makefile
+ arch/sh/include/cpu-sh3/cpu/serial.h
+ arch/sh/include/cpu-sh4a/cpu/serial.h
+ arch/sh/kernel/cpu/sh3/Makefile
+ arch/sh/kernel/cpu/sh3/serial-sh770x.c
+ arch/sh/kernel/cpu/sh3/serial-sh7710.c
+ arch/sh/kernel/cpu/sh3/serial-sh7720.c
+ arch/sh/kernel/cpu/sh3/setup-sh7705.c
+ arch/sh/kernel/cpu/sh3/setup-sh770x.c
+ arch/sh/kernel/cpu/sh3/setup-sh7720.c
+ arch/sh/kernel/cpu/sh4/setup-sh7750.c
+ arch/sh/kernel/cpu/sh4/setup-sh7760.c
+ arch/sh/kernel/cpu/sh4a/Makefile
+ arch/sh/kernel/cpu/sh4a/serial-sh7722.c
+ arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+ arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+ arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+ arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+ arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+ arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+ arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+ arch/sh/kernel/cpu/sh4a/setup-sh7786.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 364 ++++++++++++++++++++++++++++++++-----------
+ drivers/tty/serial/sh-sci.h | 222 --------------------------
+ include/linux/serial_sci.h | 36 +++++
+ 3 files changed, 309 insertions(+), 313 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 92ad023..5979668 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -117,6 +117,255 @@ to_sci_port(struct uart_port *uart)
+ return container_of(uart, struct sci_port, port);
+ }
+
++struct plat_sci_reg {
++ u8 offset, size;
++};
++
++/* Helper for invalidating specific entries of an inherited map. */
++#define sci_reg_invalid { .offset = 0, .size = 0 }
++
++static struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
++ [SCIx_PROBE_REGTYPE] = {
++ [0 ... SCIx_NR_REGS - 1] = sci_reg_invalid,
++ },
++
++ /*
++ * Common SCI definitions, dependent on the port's regshift
++ * value.
++ */
++ [SCIx_SCI_REGTYPE] = {
++ [SCSMR] = { 0x00, 8 },
++ [SCBRR] = { 0x01, 8 },
++ [SCSCR] = { 0x02, 8 },
++ [SCxTDR] = { 0x03, 8 },
++ [SCxSR] = { 0x04, 8 },
++ [SCxRDR] = { 0x05, 8 },
++ [SCFCR] = sci_reg_invalid,
++ [SCFDR] = sci_reg_invalid,
++ [SCTFDR] = sci_reg_invalid,
++ [SCRFDR] = sci_reg_invalid,
++ [SCSPTR] = sci_reg_invalid,
++ [SCLSR] = sci_reg_invalid,
++ },
++
++ /*
++ * Common definitions for legacy IrDA ports, dependent on
++ * regshift value.
++ */
++ [SCIx_IRDA_REGTYPE] = {
++ [SCSMR] = { 0x00, 8 },
++ [SCBRR] = { 0x01, 8 },
++ [SCSCR] = { 0x02, 8 },
++ [SCxTDR] = { 0x03, 8 },
++ [SCxSR] = { 0x04, 8 },
++ [SCxRDR] = { 0x05, 8 },
++ [SCFCR] = { 0x06, 8 },
++ [SCFDR] = { 0x07, 16 },
++ [SCTFDR] = sci_reg_invalid,
++ [SCRFDR] = sci_reg_invalid,
++ [SCSPTR] = sci_reg_invalid,
++ [SCLSR] = sci_reg_invalid,
++ },
++
++ /*
++ * Common SCIFA definitions.
++ */
++ [SCIx_SCIFA_REGTYPE] = {
++ [SCSMR] = { 0x00, 16 },
++ [SCBRR] = { 0x04, 8 },
++ [SCSCR] = { 0x08, 16 },
++ [SCxTDR] = { 0x20, 8 },
++ [SCxSR] = { 0x14, 16 },
++ [SCxRDR] = { 0x24, 8 },
++ [SCFCR] = { 0x18, 16 },
++ [SCFDR] = { 0x1c, 16 },
++ [SCTFDR] = sci_reg_invalid,
++ [SCRFDR] = sci_reg_invalid,
++ [SCSPTR] = sci_reg_invalid,
++ [SCLSR] = sci_reg_invalid,
++ },
++
++ /*
++ * Common SCIFB definitions.
++ */
++ [SCIx_SCIFB_REGTYPE] = {
++ [SCSMR] = { 0x00, 16 },
++ [SCBRR] = { 0x04, 8 },
++ [SCSCR] = { 0x08, 16 },
++ [SCxTDR] = { 0x40, 8 },
++ [SCxSR] = { 0x14, 16 },
++ [SCxRDR] = { 0x60, 8 },
++ [SCFCR] = { 0x18, 16 },
++ [SCFDR] = { 0x1c, 16 },
++ [SCTFDR] = sci_reg_invalid,
++ [SCRFDR] = sci_reg_invalid,
++ [SCSPTR] = sci_reg_invalid,
++ [SCLSR] = sci_reg_invalid,
++ },
++
++ /*
++ * Common SH-3 SCIF definitions.
++ */
++ [SCIx_SH3_SCIF_REGTYPE] = {
++ [SCSMR] = { 0x00, 8 },
++ [SCBRR] = { 0x02, 8 },
++ [SCSCR] = { 0x04, 8 },
++ [SCxTDR] = { 0x06, 8 },
++ [SCxSR] = { 0x08, 16 },
++ [SCxRDR] = { 0x0a, 8 },
++ [SCFCR] = { 0x0c, 8 },
++ [SCFDR] = { 0x0e, 16 },
++ [SCTFDR] = sci_reg_invalid,
++ [SCRFDR] = sci_reg_invalid,
++ [SCSPTR] = sci_reg_invalid,
++ [SCLSR] = sci_reg_invalid,
++ },
++
++ /*
++ * Common SH-4(A) SCIF(B) definitions.
++ */
++ [SCIx_SH4_SCIF_REGTYPE] = {
++ [SCSMR] = { 0x00, 16 },
++ [SCBRR] = { 0x04, 8 },
++ [SCSCR] = { 0x08, 16 },
++ [SCxTDR] = { 0x0c, 8 },
++ [SCxSR] = { 0x10, 16 },
++ [SCxRDR] = { 0x14, 8 },
++ [SCFCR] = { 0x18, 16 },
++ [SCFDR] = { 0x1c, 16 },
++ [SCTFDR] = sci_reg_invalid,
++ [SCRFDR] = sci_reg_invalid,
++ [SCSPTR] = { 0x20, 16 },
++ [SCLSR] = { 0x24, 16 },
++ },
++
++ /*
++ * Common SH-4(A) SCIF(B) definitions for ports without an SCSPTR
++ * register.
++ */
++ [SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE] = {
++ [SCSMR] = { 0x00, 16 },
++ [SCBRR] = { 0x04, 8 },
++ [SCSCR] = { 0x08, 16 },
++ [SCxTDR] = { 0x0c, 8 },
++ [SCxSR] = { 0x10, 16 },
++ [SCxRDR] = { 0x14, 8 },
++ [SCFCR] = { 0x18, 16 },
++ [SCFDR] = { 0x1c, 16 },
++ [SCTFDR] = sci_reg_invalid,
++ [SCRFDR] = sci_reg_invalid,
++ [SCSPTR] = sci_reg_invalid,
++ [SCLSR] = { 0x24, 16 },
++ },
++
++ /*
++ * Common SH-4(A) SCIF(B) definitions for ports with FIFO data
++ * count registers.
++ */
++ [SCIx_SH4_SCIF_FIFODATA_REGTYPE] = {
++ [SCSMR] = { 0x00, 16 },
++ [SCBRR] = { 0x04, 8 },
++ [SCSCR] = { 0x08, 16 },
++ [SCxTDR] = { 0x0c, 8 },
++ [SCxSR] = { 0x10, 16 },
++ [SCxRDR] = { 0x14, 8 },
++ [SCFCR] = { 0x18, 16 },
++ [SCFDR] = { 0x1c, 16 },
++ [SCTFDR] = { 0x1c, 16 }, /* aliased to SCFDR */
++ [SCRFDR] = { 0x20, 16 },
++ [SCSPTR] = { 0x24, 16 },
++ [SCLSR] = { 0x28, 16 },
++ },
++
++ /*
++ * SH7705-style SCIF(B) ports, lacking both SCSPTR and SCLSR
++ * registers.
++ */
++ [SCIx_SH7705_SCIF_REGTYPE] = {
++ [SCSMR] = { 0x00, 16 },
++ [SCBRR] = { 0x04, 8 },
++ [SCSCR] = { 0x08, 16 },
++ [SCxTDR] = { 0x20, 8 },
++ [SCxSR] = { 0x14, 16 },
++ [SCxRDR] = { 0x24, 8 },
++ [SCFCR] = { 0x18, 16 },
++ [SCFDR] = { 0x1c, 16 },
++ [SCTFDR] = sci_reg_invalid,
++ [SCRFDR] = sci_reg_invalid,
++ [SCSPTR] = sci_reg_invalid,
++ [SCLSR] = sci_reg_invalid,
++ },
++};
++
++/*
++ * The "offset" here is rather misleading, in that it refers to an enum
++ * value relative to the port mapping rather than the fixed offset
++ * itself, which needs to be manually retrieved from the platform's
++ * register map for the given port.
++ */
++static unsigned int sci_serial_in(struct uart_port *p, int offset)
++{
++ struct sci_port *s = to_sci_port(p);
++ struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + offset;
++
++ if (reg->size == 8)
++ return ioread8(p->membase + (reg->offset << p->regshift));
++ else if (reg->size == 16)
++ return ioread16(p->membase + (reg->offset << p->regshift));
++ else
++ WARN(1, "Invalid register access\n");
++
++ return 0;
++}
++
++static void sci_serial_out(struct uart_port *p, int offset, int value)
++{
++ struct sci_port *s = to_sci_port(p);
++ struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + offset;
++
++ if (reg->size == 8)
++ iowrite8(value, p->membase + (reg->offset << p->regshift));
++ else if (reg->size == 16)
++ iowrite16(value, p->membase + (reg->offset << p->regshift));
++ else
++ WARN(1, "Invalid register access\n");
++}
++
++#define sci_in(up, offset) (up->serial_in(up, offset))
++#define sci_out(up, offset, value) (up->serial_out(up, offset, value))
++
++static int sci_probe_regmap(struct plat_sci_port *cfg)
++{
++ switch (cfg->type) {
++ case PORT_SCI:
++ cfg->regtype = SCIx_SCI_REGTYPE;
++ break;
++ case PORT_IRDA:
++ cfg->regtype = SCIx_IRDA_REGTYPE;
++ break;
++ case PORT_SCIFA:
++ cfg->regtype = SCIx_SCIFA_REGTYPE;
++ break;
++ case PORT_SCIFB:
++ cfg->regtype = SCIx_SCIFB_REGTYPE;
++ break;
++ case PORT_SCIF:
++ /*
++ * The SH-4 is a bit of a misnomer here, although that's
++ * where this particular port layout originated. This
++ * configuration (or some slight variation thereof)
++ * remains the dominant model for all SCIFs.
++ */
++ cfg->regtype = SCIx_SH4_SCIF_REGTYPE;
++ break;
++ default:
++ printk(KERN_ERR "Can't probe register map for given port\n");
++ return -EINVAL;
++ }
++
++ return 0;
++}
++
+ #if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_SH_SCI_CONSOLE)
+
+ #ifdef CONFIG_CONSOLE_POLL
+@@ -160,103 +409,29 @@ static void sci_poll_put_char(struct uart_port *port, unsigned char c)
+ }
+ #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */
+
+-#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
+-static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
+-{
+- if (port->mapbase == 0xA4400000) {
+- __raw_writew(__raw_readw(PACR) & 0xffc0, PACR);
+- __raw_writew(__raw_readw(PBCR) & 0x0fff, PBCR);
+- } else if (port->mapbase == 0xA4410000)
+- __raw_writew(__raw_readw(PBCR) & 0xf003, PBCR);
+-}
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || defined(CONFIG_CPU_SUBTYPE_SH7721)
+-static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
+-{
+- unsigned short data;
+-
+- if (cflag & CRTSCTS) {
+- /* enable RTS/CTS */
+- if (port->mapbase == 0xa4430000) { /* SCIF0 */
+- /* Clear PTCR bit 9-2; enable all scif pins but sck */
+- data = __raw_readw(PORT_PTCR);
+- __raw_writew((data & 0xfc03), PORT_PTCR);
+- } else if (port->mapbase == 0xa4438000) { /* SCIF1 */
+- /* Clear PVCR bit 9-2 */
+- data = __raw_readw(PORT_PVCR);
+- __raw_writew((data & 0xfc03), PORT_PVCR);
+- }
+- } else {
+- if (port->mapbase == 0xa4430000) { /* SCIF0 */
+- /* Clear PTCR bit 5-2; enable only tx and rx */
+- data = __raw_readw(PORT_PTCR);
+- __raw_writew((data & 0xffc3), PORT_PTCR);
+- } else if (port->mapbase == 0xa4438000) { /* SCIF1 */
+- /* Clear PVCR bit 5-2 */
+- data = __raw_readw(PORT_PVCR);
+- __raw_writew((data & 0xffc3), PORT_PVCR);
+- }
+- }
+-}
+-#elif defined(CONFIG_CPU_SH3)
+-/* For SH7705, SH7706, SH7707, SH7709, SH7709A, SH7729 */
+-static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
++static void sci_init_pins(struct uart_port *port, unsigned int cflag)
+ {
+- unsigned short data;
+-
+- /* We need to set SCPCR to enable RTS/CTS */
+- data = __raw_readw(SCPCR);
+- /* Clear out SCP7MD1,0, SCP6MD1,0, SCP4MD1,0*/
+- __raw_writew(data & 0x0fcf, SCPCR);
+-
+- if (!(cflag & CRTSCTS)) {
+- /* We need to set SCPCR to enable RTS/CTS */
+- data = __raw_readw(SCPCR);
+- /* Clear out SCP7MD1,0, SCP4MD1,0,
+- Set SCP6MD1,0 = {01} (output) */
+- __raw_writew((data & 0x0fcf) | 0x1000, SCPCR);
++ struct sci_port *s = to_sci_port(port);
++ struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + SCSPTR;
+
+- data = __raw_readb(SCPDR);
+- /* Set /RTS2 (bit6) = 0 */
+- __raw_writeb(data & 0xbf, SCPDR);
++ /*
++ * Use port-specific handler if provided.
++ */
++ if (s->cfg->ops && s->cfg->ops->init_pins) {
++ s->cfg->ops->init_pins(port, cflag);
++ return;
+ }
+-}
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
+-static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
+-{
+- unsigned short data;
+
+- if (port->mapbase == 0xffe00000) {
+- data = __raw_readw(PSCR);
+- data &= ~0x03cf;
+- if (!(cflag & CRTSCTS))
+- data |= 0x0340;
++ /*
++ * For the generic path SCSPTR is necessary. Bail out if that's
++ * unavailable, too.
++ */
++ if (!reg->size)
++ return;
+
+- __raw_writew(data, PSCR);
+- }
+-}
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7757) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7763) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7780) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7785) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7786) || \
+- defined(CONFIG_CPU_SUBTYPE_SHX3)
+-static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
+-{
+- if (!(cflag & CRTSCTS))
+- __raw_writew(0x0080, SCSPTR0); /* Set RTS = 1 */
+-}
+-#elif defined(CONFIG_CPU_SH4) && !defined(CONFIG_CPU_SH4A)
+-static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
+-{
+ if (!(cflag & CRTSCTS))
+- __raw_writew(0x0080, SCSPTR2); /* Set RTS = 1 */
++ sci_out(port, SCSPTR, 0x0080); /* Set RTS = 1 */
+ }
+-#else
+-static inline void sci_init_pins(struct uart_port *port, unsigned int cflag)
+-{
+- /* Nothing to do */
+-}
+-#endif
+
+ #if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7780) || \
+@@ -1757,6 +1932,9 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ break;
+ }
+
++ if (p->regtype == SCIx_PROBE_REGTYPE)
++ BUG_ON(sci_probe_regmap(p) != 0);
++
+ if (dev) {
+ sci_port->iclk = clk_get(&dev->dev, "sci_ick");
+ if (IS_ERR(sci_port->iclk)) {
+@@ -1817,9 +1995,10 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ port->mapbase = p->mapbase;
+ port->type = p->type;
+ port->flags = p->flags;
++ port->regshift = p->regshift;
+
+ /*
+- * The UART port needs an IRQ value, so we peg this to the TX IRQ
++ * The UART port needs an IRQ value, so we peg this to the RX IRQ
+ * for the multi-IRQ ports, which is where we are primarily
+ * concerned with the shutdown path synchronization.
+ *
+@@ -1827,6 +2006,9 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ */
+ port->irq = p->irqs[SCIx_RXI_IRQ];
+
++ port->serial_in = sci_serial_in;
++ port->serial_out = sci_serial_out;
++
+ if (p->dma_dev)
+ dev_dbg(port->dev, "DMA device %p, tx %d, rx %d\n",
+ p->dma_dev, p->dma_slave_tx, p->dma_slave_rx);
+diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
+index 25788c4..f46fd23 100644
+--- a/drivers/tty/serial/sh-sci.h
++++ b/drivers/tty/serial/sh-sci.h
+@@ -3,69 +3,6 @@
+ #include <linux/gpio.h>
+
+ #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7706) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7707) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7708) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7709)
+-# define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */
+-# define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+- defined(CONFIG_ARCH_SH73A0) || \
+- defined(CONFIG_ARCH_SH7367) || \
+- defined(CONFIG_ARCH_SH7377) || \
+- defined(CONFIG_ARCH_SH7372)
+-# define PORT_PTCR 0xA405011EUL
+-# define PORT_PVCR 0xA4050122UL
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7091) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7751) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
+- defined(CONFIG_CPU_SUBTYPE_SH4_202)
+-# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
+-# define SCSPTR0 0xfe600024 /* 16 bit SCIF */
+-# define SCSPTR2 0xfe620024 /* 16 bit SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
+-# define SCSPTR0 0xA4400000 /* 16 bit SCIF */
+-# define PACR 0xa4050100
+-# define PBCR 0xa4050102
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7343)
+-# define SCSPTR0 0xffe00010 /* 16 bit SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
+-# define PWDR 0xA4050166
+-# define PSCR 0xA405011E
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7366)
+-# define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */
+-# define SCSPTR0 SCPDR0
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7723)
+-# define SCSPTR0 0xa4050160
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7757)
+-# define SCSPTR0 0xfe4b0020
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7780)
+-# define SCSPTR0 0xffe00024 /* 16 bit SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
+-# define SCSPTR0 0xff923020 /* 16 bit SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7786)
+-# define SCSPTR0 0xffea0024 /* 16 bit SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7203) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7206) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7263)
+-# define SCSPTR0 0xfffe8020 /* 16 bit SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
+-# define SCSPTR0 0xf8400020 /* 16 bit SCIF */
+-#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
+-# define SCSPTR0 0xffc30020 /* 16 bit SCIF */
+-#else
+-# error CPU subtype not defined
+-#endif
+-
+-#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7720) || \
+ defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+ defined(CONFIG_ARCH_SH73A0) || \
+@@ -121,162 +58,3 @@
+
+ #define SCI_MAJOR 204
+ #define SCI_MINOR_START 8
+-
+-#define SCI_IN(size, offset) \
+- ioread##size(port->membase + (offset))
+-
+-#define SCI_OUT(size, offset, value) \
+- iowrite##size(value, port->membase + (offset))
+-
+-#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
+- static inline unsigned int sci_##name##_in(struct uart_port *port) \
+- { \
+- if (port->type == PORT_SCIF || port->type == PORT_SCIFB) { \
+- return SCI_IN(scif_size, scif_offset); \
+- } else { /* PORT_SCI or PORT_SCIFA */ \
+- return SCI_IN(sci_size, sci_offset); \
+- } \
+- } \
+- static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
+- { \
+- if (port->type == PORT_SCIF || port->type == PORT_SCIFB) { \
+- SCI_OUT(scif_size, scif_offset, value); \
+- } else { /* PORT_SCI or PORT_SCIFA */ \
+- SCI_OUT(sci_size, sci_offset, value); \
+- } \
+- }
+-
+-#define CPU_SCIF_FNS(name, scif_offset, scif_size) \
+- static inline unsigned int sci_##name##_in(struct uart_port *port) \
+- { \
+- return SCI_IN(scif_size, scif_offset); \
+- } \
+- static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
+- { \
+- SCI_OUT(scif_size, scif_offset, value); \
+- }
+-
+-#if defined(CONFIG_CPU_SH3) || \
+- defined(CONFIG_ARCH_SH73A0) || \
+- defined(CONFIG_ARCH_SH7367) || \
+- defined(CONFIG_ARCH_SH7377) || \
+- defined(CONFIG_ARCH_SH7372)
+-#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
+-#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
+- sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+- CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
+-#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+- CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7720) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+- defined(CONFIG_ARCH_SH7367)
+-#define SCIF_FNS(name, scif_offset, scif_size) \
+- CPU_SCIF_FNS(name, scif_offset, scif_size)
+-#elif defined(CONFIG_ARCH_SH7377) || \
+- defined(CONFIG_ARCH_SH7372) || \
+- defined(CONFIG_ARCH_SH73A0)
+-#define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scifb_offset, sh4_scifb_size) \
+- CPU_SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scifb_offset, sh4_scifb_size)
+-#define SCIF_FNS(name, scif_offset, scif_size) \
+- CPU_SCIF_FNS(name, scif_offset, scif_size)
+-#else
+-#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
+- sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+- CPU_SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh3_scif_offset, sh3_scif_size)
+-#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+- CPU_SCIF_FNS(name, sh3_scif_offset, sh3_scif_size)
+-#endif
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
+- defined(CONFIG_CPU_SUBTYPE_SH7724)
+- #define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scif_offset, sh4_scif_size) \
+- CPU_SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scif_offset, sh4_scif_size)
+- #define SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) \
+- CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
+-#else
+-#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
+- sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+- CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
+-#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
+- CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
+-#endif
+-
+-#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7720) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+- defined(CONFIG_ARCH_SH7367)
+-
+-SCIF_FNS(SCSMR, 0x00, 16)
+-SCIF_FNS(SCBRR, 0x04, 8)
+-SCIF_FNS(SCSCR, 0x08, 16)
+-SCIF_FNS(SCxSR, 0x14, 16)
+-SCIF_FNS(SCFCR, 0x18, 16)
+-SCIF_FNS(SCFDR, 0x1c, 16)
+-SCIF_FNS(SCxTDR, 0x20, 8)
+-SCIF_FNS(SCxRDR, 0x24, 8)
+-SCIF_FNS(SCLSR, 0x00, 0)
+-#elif defined(CONFIG_ARCH_SH7377) || \
+- defined(CONFIG_ARCH_SH7372) || \
+- defined(CONFIG_ARCH_SH73A0)
+-SCIF_FNS(SCSMR, 0x00, 16)
+-SCIF_FNS(SCBRR, 0x04, 8)
+-SCIF_FNS(SCSCR, 0x08, 16)
+-SCIF_FNS(SCTDSR, 0x0c, 16)
+-SCIF_FNS(SCFER, 0x10, 16)
+-SCIF_FNS(SCxSR, 0x14, 16)
+-SCIF_FNS(SCFCR, 0x18, 16)
+-SCIF_FNS(SCFDR, 0x1c, 16)
+-SCIF_FNS(SCTFDR, 0x38, 16)
+-SCIF_FNS(SCRFDR, 0x3c, 16)
+-SCIx_FNS(SCxTDR, 0x20, 8, 0x40, 8)
+-SCIx_FNS(SCxRDR, 0x24, 8, 0x60, 8)
+-SCIF_FNS(SCLSR, 0x00, 0)
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
+- defined(CONFIG_CPU_SUBTYPE_SH7724)
+-SCIx_FNS(SCSMR, 0x00, 16, 0x00, 16)
+-SCIx_FNS(SCBRR, 0x04, 8, 0x04, 8)
+-SCIx_FNS(SCSCR, 0x08, 16, 0x08, 16)
+-SCIx_FNS(SCxTDR, 0x20, 8, 0x0c, 8)
+-SCIx_FNS(SCxSR, 0x14, 16, 0x10, 16)
+-SCIx_FNS(SCxRDR, 0x24, 8, 0x14, 8)
+-SCIx_FNS(SCSPTR, 0, 0, 0, 0)
+-SCIF_FNS(SCFCR, 0x18, 16)
+-SCIF_FNS(SCFDR, 0x1c, 16)
+-SCIF_FNS(SCLSR, 0x24, 16)
+-#else
+-/* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 */
+-/* name off sz off sz off sz off sz */
+-SCIx_FNS(SCSMR, 0x00, 8, 0x00, 8, 0x00, 8, 0x00, 16)
+-SCIx_FNS(SCBRR, 0x02, 8, 0x04, 8, 0x02, 8, 0x04, 8)
+-SCIx_FNS(SCSCR, 0x04, 8, 0x08, 8, 0x04, 8, 0x08, 16)
+-SCIx_FNS(SCxTDR, 0x06, 8, 0x0c, 8, 0x06, 8, 0x0C, 8)
+-SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16)
+-SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8)
+-SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16)
+-#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7780) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7785) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7786)
+-SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
+-SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
+-SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
+-SCIF_FNS(SCSPTR, 0, 0, 0x24, 16)
+-SCIF_FNS(SCLSR, 0, 0, 0x28, 16)
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
+-SCIF_FNS(SCFDR, 0, 0, 0x1C, 16)
+-SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
+-SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
+-SCIF_FNS(SCSPTR, 0, 0, 0x24, 16)
+-SCIF_FNS(SCLSR, 0, 0, 0x28, 16)
+-#else
+-SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
+-#if defined(CONFIG_CPU_SUBTYPE_SH7722)
+-SCIF_FNS(SCSPTR, 0, 0, 0, 0)
+-#else
+-SCIF_FNS(SCSPTR, 0, 0, 0x20, 16)
+-#endif
+-SCIF_FNS(SCLSR, 0, 0, 0x24, 16)
+-#endif
+-#endif
+-#define sci_in(port, reg) sci_##reg##_in(port)
+-#define sci_out(port, reg, value) sci_##reg##_out(port, value)
+diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
+index ecefec7..4ca130a 100644
+--- a/include/linux/serial_sci.h
++++ b/include/linux/serial_sci.h
+@@ -58,6 +58,22 @@ enum {
+ SCIx_NR_IRQS,
+ };
+
++enum {
++ SCIx_PROBE_REGTYPE,
++
++ SCIx_SCI_REGTYPE,
++ SCIx_IRDA_REGTYPE,
++ SCIx_SCIFA_REGTYPE,
++ SCIx_SCIFB_REGTYPE,
++ SCIx_SH3_SCIF_REGTYPE,
++ SCIx_SH4_SCIF_REGTYPE,
++ SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
++ SCIx_SH4_SCIF_FIFODATA_REGTYPE,
++ SCIx_SH7705_SCIF_REGTYPE,
++
++ SCIx_NR_REGTYPES,
++};
++
+ #define SCIx_IRQ_MUXED(irq) \
+ { \
+ [SCIx_ERI_IRQ] = (irq), \
+@@ -66,8 +82,24 @@ enum {
+ [SCIx_BRI_IRQ] = (irq), \
+ }
+
++/*
++ * SCI register subset common for all port types.
++ * Not all registers will exist on all parts.
++ */
++enum {
++ SCSMR, SCBRR, SCSCR, SCxSR,
++ SCFCR, SCFDR, SCxTDR, SCxRDR,
++ SCLSR, SCTFDR, SCRFDR, SCSPTR,
++
++ SCIx_NR_REGS,
++};
++
+ struct device;
+
++struct plat_sci_port_ops {
++ void (*init_pins)(struct uart_port *, unsigned int cflag);
++};
++
+ /*
+ * Platform device specific platform_data struct
+ */
+@@ -87,6 +119,10 @@ struct plat_sci_port {
+ unsigned int error_mask;
+
+ int port_reg;
++ unsigned char regshift;
++ unsigned char regtype;
++
++ struct plat_sci_port_ops *ops;
+
+ struct device *dma_dev;
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0205-serial-sh-sci-FIFO-sizing-helper-consolidation.patch b/patches.armadillo800eva/0205-serial-sh-sci-FIFO-sizing-helper-consolidation.patch
new file mode 100644
index 00000000000000..97fb7dcf17df0b
--- /dev/null
+++ b/patches.armadillo800eva/0205-serial-sh-sci-FIFO-sizing-helper-consolidation.patch
@@ -0,0 +1,255 @@
+From 9668c7330aa5432fbb3582ba16909fc203d6b8c1 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 14 Jun 2011 17:38:19 +0900
+Subject: serial: sh-sci: FIFO sizing helper consolidation.
+
+This consolidates all of the TX/RX fill/room nonsense in to a single set
+of fairly heavyweight definitions. The implementation goes in descending
+order of complexity, testing the register map for capabilities until we
+run out of options and do it the legacy SCI way. Masks are derived
+directly from the per-port FIFO size, meaning that platforms with FIFO
+sizes not matching the standard port types will still need to manually
+fix them up.
+
+This also fixes up a number of issues such as tx_empty being completely
+bogus for SCI and IrDA ports, some ports using masks smaller or greater
+than their FIFO size, and so forth.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 72b294cf76dcd6d37891387049ddbe3c25043cb8)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 126 +++++++++----------------------------------
+ drivers/tty/serial/sh-sci.h | 20 -------
+ 2 files changed, 24 insertions(+), 122 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 5979668..f47c534 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -297,6 +297,8 @@ static struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
+ },
+ };
+
++#define sci_getreg(up, offset) (sci_regmap[to_sci_port(up)->cfg->regtype] + offset)
++
+ /*
+ * The "offset" here is rather misleading, in that it refers to an enum
+ * value relative to the port mapping rather than the fixed offset
+@@ -305,8 +307,7 @@ static struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
+ */
+ static unsigned int sci_serial_in(struct uart_port *p, int offset)
+ {
+- struct sci_port *s = to_sci_port(p);
+- struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + offset;
++ struct plat_sci_reg *reg = sci_getreg(p, offset);
+
+ if (reg->size == 8)
+ return ioread8(p->membase + (reg->offset << p->regshift));
+@@ -320,8 +321,7 @@ static unsigned int sci_serial_in(struct uart_port *p, int offset)
+
+ static void sci_serial_out(struct uart_port *p, int offset, int value)
+ {
+- struct sci_port *s = to_sci_port(p);
+- struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + offset;
++ struct plat_sci_reg *reg = sci_getreg(p, offset);
+
+ if (reg->size == 8)
+ iowrite8(value, p->membase + (reg->offset << p->regshift));
+@@ -433,108 +433,38 @@ static void sci_init_pins(struct uart_port *port, unsigned int cflag)
+ sci_out(port, SCSPTR, 0x0080); /* Set RTS = 1 */
+ }
+
+-#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7780) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7785) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7786)
+-static int scif_txfill(struct uart_port *port)
+-{
+- return sci_in(port, SCTFDR) & 0xff;
+-}
+-
+-static int scif_txroom(struct uart_port *port)
++static int sci_txfill(struct uart_port *port)
+ {
+- return SCIF_TXROOM_MAX - scif_txfill(port);
+-}
++ struct plat_sci_reg *reg;
+
+-static int scif_rxfill(struct uart_port *port)
+-{
+- return sci_in(port, SCRFDR) & 0xff;
+-}
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
+-static int scif_txfill(struct uart_port *port)
+-{
+- if (port->mapbase == 0xffe00000 ||
+- port->mapbase == 0xffe08000)
+- /* SCIF0/1*/
++ reg = sci_getreg(port, SCTFDR);
++ if (reg->size)
+ return sci_in(port, SCTFDR) & 0xff;
+- else
+- /* SCIF2 */
+- return sci_in(port, SCFDR) >> 8;
+-}
+
+-static int scif_txroom(struct uart_port *port)
+-{
+- if (port->mapbase == 0xffe00000 ||
+- port->mapbase == 0xffe08000)
+- /* SCIF0/1*/
+- return SCIF_TXROOM_MAX - scif_txfill(port);
+- else
+- /* SCIF2 */
+- return SCIF2_TXROOM_MAX - scif_txfill(port);
+-}
+-
+-static int scif_rxfill(struct uart_port *port)
+-{
+- if ((port->mapbase == 0xffe00000) ||
+- (port->mapbase == 0xffe08000)) {
+- /* SCIF0/1*/
+- return sci_in(port, SCRFDR) & 0xff;
+- } else {
+- /* SCIF2 */
+- return sci_in(port, SCFDR) & SCIF2_RFDC_MASK;
+- }
+-}
+-#elif defined(CONFIG_ARCH_SH7372)
+-static int scif_txfill(struct uart_port *port)
+-{
+- if (port->type == PORT_SCIFA)
++ reg = sci_getreg(port, SCFDR);
++ if (reg->size)
+ return sci_in(port, SCFDR) >> 8;
+- else
+- return sci_in(port, SCTFDR);
+-}
+-
+-static int scif_txroom(struct uart_port *port)
+-{
+- return port->fifosize - scif_txfill(port);
+-}
+
+-static int scif_rxfill(struct uart_port *port)
+-{
+- if (port->type == PORT_SCIFA)
+- return sci_in(port, SCFDR) & SCIF_RFDC_MASK;
+- else
+- return sci_in(port, SCRFDR);
+-}
+-#else
+-static int scif_txfill(struct uart_port *port)
+-{
+- return sci_in(port, SCFDR) >> 8;
+-}
+-
+-static int scif_txroom(struct uart_port *port)
+-{
+- return SCIF_TXROOM_MAX - scif_txfill(port);
+-}
+-
+-static int scif_rxfill(struct uart_port *port)
+-{
+- return sci_in(port, SCFDR) & SCIF_RFDC_MASK;
+-}
+-#endif
+-
+-static int sci_txfill(struct uart_port *port)
+-{
+ return !(sci_in(port, SCxSR) & SCI_TDRE);
+ }
+
+ static int sci_txroom(struct uart_port *port)
+ {
+- return !sci_txfill(port);
++ return port->fifosize - sci_txfill(port);
+ }
+
+ static int sci_rxfill(struct uart_port *port)
+ {
++ struct plat_sci_reg *reg;
++
++ reg = sci_getreg(port, SCRFDR);
++ if (reg->size)
++ return sci_in(port, SCRFDR) & 0xff;
++
++ reg = sci_getreg(port, SCFDR);
++ if (reg->size)
++ return sci_in(port, SCFDR) & ((port->fifosize << 1) - 1);
++
+ return (sci_in(port, SCxSR) & SCxSR_RDxF(port)) != 0;
+ }
+
+@@ -574,10 +504,7 @@ static void sci_transmit_chars(struct uart_port *port)
+ return;
+ }
+
+- if (port->type == PORT_SCI)
+- count = sci_txroom(port);
+- else
+- count = scif_txroom(port);
++ count = sci_txroom(port);
+
+ do {
+ unsigned char c;
+@@ -632,13 +559,8 @@ static void sci_receive_chars(struct uart_port *port)
+ return;
+
+ while (1) {
+- if (port->type == PORT_SCI)
+- count = sci_rxfill(port);
+- else
+- count = scif_rxfill(port);
+-
+ /* Don't copy more bytes than there is room for in the buffer */
+- count = tty_buffer_request_room(tty, count);
++ count = tty_buffer_request_room(tty, sci_rxfill(port));
+
+ /* If for any reason we can't copy more data, we're done! */
+ if (count == 0)
+@@ -1096,7 +1018,7 @@ static void sci_free_irq(struct sci_port *port)
+ static unsigned int sci_tx_empty(struct uart_port *port)
+ {
+ unsigned short status = sci_in(port, SCxSR);
+- unsigned short in_tx_fifo = scif_txfill(port);
++ unsigned short in_tx_fifo = sci_txfill(port);
+
+ return (status & SCxSR_TEND(port)) && !in_tx_fifo ? TIOCSER_TEMT : 0;
+ }
+diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
+index f46fd23..a1a2d36 100644
+--- a/drivers/tty/serial/sh-sci.h
++++ b/drivers/tty/serial/sh-sci.h
+@@ -2,26 +2,6 @@
+ #include <linux/io.h>
+ #include <linux/gpio.h>
+
+-#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7720) || \
+- defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+- defined(CONFIG_ARCH_SH73A0) || \
+- defined(CONFIG_ARCH_SH7367) || \
+- defined(CONFIG_ARCH_SH7377) || \
+- defined(CONFIG_ARCH_SH7372)
+-# define SCIF_RFDC_MASK 0x007f
+-# define SCIF_TXROOM_MAX 64
+-#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
+-# define SCIF_RFDC_MASK 0x007f
+-# define SCIF_TXROOM_MAX 64
+-/* SH7763 SCIF2 support */
+-# define SCIF2_RFDC_MASK 0x001f
+-# define SCIF2_TXROOM_MAX 16
+-#else
+-# define SCIF_RFDC_MASK 0x001f
+-# define SCIF_TXROOM_MAX 16
+-#endif
+-
+ #define SCxSR_TEND(port) (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND)
+ #define SCxSR_RDxF(port) (((port)->type == PORT_SCI) ? SCI_RDRF : SCIF_RDF)
+ #define SCxSR_TDxE(port) (((port)->type == PORT_SCI) ? SCI_TDRE : SCIF_TDFE)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0206-serial-sh-sci-Support-generic-SCLSR-overrun-detectio.patch b/patches.armadillo800eva/0206-serial-sh-sci-Support-generic-SCLSR-overrun-detectio.patch
new file mode 100644
index 00000000000000..402c2e7aec111a
--- /dev/null
+++ b/patches.armadillo800eva/0206-serial-sh-sci-Support-generic-SCLSR-overrun-detectio.patch
@@ -0,0 +1,44 @@
+From b25362ad1844d24c75f3550d5184f890362f987b Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 14 Jun 2011 17:53:34 +0900
+Subject: serial: sh-sci: Support generic SCLSR overrun detection.
+
+For all ports with a valid SCLSR register we can use the generic FIFO
+overrun detection logic. Test the validity of the SCLSR register rather
+than depending explicitly on port type, which can be ambiguous for the
+SCIFA/B types.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 4b8c59a3d83e9cf2b65b16999a0c704fc72de056)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index f47c534..78efe80 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -734,15 +734,11 @@ static int sci_handle_fifo_overrun(struct uart_port *port)
+ {
+ struct tty_struct *tty = port->state->port.tty;
+ struct sci_port *s = to_sci_port(port);
++ struct plat_sci_reg *reg;
+ int copied = 0;
+
+- /*
+- * XXX: Technically not limited to non-SCIFs, it's simply the
+- * SCLSR check that is for the moment SCIF-specific. This
+- * probably wants to be revisited for SCIFA/B as well as for
+- * factoring in SCI overrun detection.
+- */
+- if (port->type != PORT_SCIF)
++ reg = sci_getreg(port, SCLSR);
++ if (!reg->size)
+ return 0;
+
+ if ((sci_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0207-serial-sh-sci-Regtype-probing-doesn-t-need-to-be-fat.patch b/patches.armadillo800eva/0207-serial-sh-sci-Regtype-probing-doesn-t-need-to-be-fat.patch
new file mode 100644
index 00000000000000..891ee02e12d2e0
--- /dev/null
+++ b/patches.armadillo800eva/0207-serial-sh-sci-Regtype-probing-doesn-t-need-to-be-fat.patch
@@ -0,0 +1,45 @@
+From 936cfe796afcee603bab904a7a71942b4edcaded Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 28 Jun 2011 13:44:37 +0900
+Subject: serial: sh-sci: Regtype probing doesn't need to be fatal.
+
+This was using a BUG_ON(), but it's not strictly necessary, so relax the
+constraints a bit.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 3127c6b225c6893bdfcd4db64d4316ce317fc10f)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 78efe80..2b3d82c 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1830,6 +1830,7 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ struct plat_sci_port *p)
+ {
+ struct uart_port *port = &sci_port->port;
++ int ret;
+
+ port->ops = &sci_uart_ops;
+ port->iotype = UPIO_MEM;
+@@ -1850,8 +1851,11 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ break;
+ }
+
+- if (p->regtype == SCIx_PROBE_REGTYPE)
+- BUG_ON(sci_probe_regmap(p) != 0);
++ if (p->regtype == SCIx_PROBE_REGTYPE) {
++ ret = sci_probe_regmap(p);
++ if (unlikely(!ret))
++ return ret;
++ }
+
+ if (dev) {
+ sci_port->iclk = clk_get(&dev->dev, "sci_ick");
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0208-serial-sh-sci-Add-missing-module-description-author-.patch b/patches.armadillo800eva/0208-serial-sh-sci-Add-missing-module-description-author-.patch
new file mode 100644
index 00000000000000..9785180be2563f
--- /dev/null
+++ b/patches.armadillo800eva/0208-serial-sh-sci-Add-missing-module-description-author-.patch
@@ -0,0 +1,26 @@
+From a8d9b329c7a7913a35fcbbe28c177a2daffa4609 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 28 Jun 2011 13:47:40 +0900
+Subject: serial: sh-sci: Add missing module description/author bits.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 7f405f9c3117acfa8a9775c467ab433b23abc5a7)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 2b3d82c..eca1821 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -2216,3 +2216,5 @@ module_exit(sci_exit);
+
+ MODULE_LICENSE("GPL");
+ MODULE_ALIAS("platform:sh-sci");
++MODULE_AUTHOR("Paul Mundt");
++MODULE_DESCRIPTION("SuperH SCI(F) serial driver");
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0209-serial-sh-sci-Kill-off-per-port-enable-disable-callb.patch b/patches.armadillo800eva/0209-serial-sh-sci-Kill-off-per-port-enable-disable-callb.patch
new file mode 100644
index 00000000000000..7370c74d28e9d8
--- /dev/null
+++ b/patches.armadillo800eva/0209-serial-sh-sci-Kill-off-per-port-enable-disable-callb.patch
@@ -0,0 +1,194 @@
+From cac09064f541adde9cb3121adb996e91a8d645a0 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 28 Jun 2011 13:55:31 +0900
+Subject: serial: sh-sci: Kill off per-port enable/disable callbacks.
+
+Ultimately we want everything to be going through the clock framework and
+runtime pm, so kill off the per-port callbacks that enabled ports to
+bypass the common infrastructure.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 23241d43eac88f63a7f0bf4d5c12bbc496651585)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 79 ++++++++++++++++++-------------------------
+ 1 file changed, 32 insertions(+), 47 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index eca1821..b78a261 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -62,12 +62,6 @@ struct sci_port {
+ /* Platform configuration */
+ struct plat_sci_port *cfg;
+
+- /* Port enable callback */
+- void (*enable)(struct uart_port *port);
+-
+- /* Port disable callback */
+- void (*disable)(struct uart_port *port);
+-
+ /* Break timer */
+ struct timer_list break_timer;
+ int break_flag;
+@@ -366,6 +360,29 @@ static int sci_probe_regmap(struct plat_sci_port *cfg)
+ return 0;
+ }
+
++static void sci_port_enable(struct sci_port *sci_port)
++{
++ if (!sci_port->port.dev)
++ return;
++
++ pm_runtime_get_sync(sci_port->port.dev);
++
++ clk_enable(sci_port->iclk);
++ sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
++ clk_enable(sci_port->fclk);
++}
++
++static void sci_port_disable(struct sci_port *sci_port)
++{
++ if (!sci_port->port.dev)
++ return;
++
++ clk_disable(sci_port->fclk);
++ clk_disable(sci_port->iclk);
++
++ pm_runtime_put_sync(sci_port->port.dev);
++}
++
+ #if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_SH_SCI_CONSOLE)
+
+ #ifdef CONFIG_CONSOLE_POLL
+@@ -651,8 +668,7 @@ static void sci_break_timer(unsigned long data)
+ {
+ struct sci_port *port = (struct sci_port *)data;
+
+- if (port->enable)
+- port->enable(&port->port);
++ sci_port_enable(port);
+
+ if (sci_rxd_in(&port->port) == 0) {
+ port->break_flag = 1;
+@@ -664,8 +680,7 @@ static void sci_break_timer(unsigned long data)
+ } else
+ port->break_flag = 0;
+
+- if (port->disable)
+- port->disable(&port->port);
++ sci_port_disable(port);
+ }
+
+ static int sci_handle_errors(struct uart_port *port)
+@@ -939,27 +954,6 @@ static int sci_notifier(struct notifier_block *self,
+ return NOTIFY_OK;
+ }
+
+-static void sci_clk_enable(struct uart_port *port)
+-{
+- struct sci_port *sci_port = to_sci_port(port);
+-
+- pm_runtime_get_sync(port->dev);
+-
+- clk_enable(sci_port->iclk);
+- sci_port->port.uartclk = clk_get_rate(sci_port->iclk);
+- clk_enable(sci_port->fclk);
+-}
+-
+-static void sci_clk_disable(struct uart_port *port)
+-{
+- struct sci_port *sci_port = to_sci_port(port);
+-
+- clk_disable(sci_port->fclk);
+- clk_disable(sci_port->iclk);
+-
+- pm_runtime_put_sync(port->dev);
+-}
+-
+ static int sci_request_irq(struct sci_port *port)
+ {
+ int i;
+@@ -1542,8 +1536,7 @@ static int sci_startup(struct uart_port *port)
+
+ dev_dbg(port->dev, "%s(%d)\n", __func__, port->line);
+
+- if (s->enable)
+- s->enable(port);
++ sci_port_enable(s);
+
+ ret = sci_request_irq(s);
+ if (unlikely(ret < 0))
+@@ -1569,8 +1562,7 @@ static void sci_shutdown(struct uart_port *port)
+ sci_free_dma(port);
+ sci_free_irq(s);
+
+- if (s->disable)
+- s->disable(port);
++ sci_port_disable(s);
+ }
+
+ static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps,
+@@ -1617,8 +1609,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+ if (likely(baud && port->uartclk))
+ t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud, port->uartclk);
+
+- if (s->enable)
+- s->enable(port);
++ sci_port_enable(s);
+
+ do {
+ status = sci_in(port, SCxSR);
+@@ -1688,8 +1679,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+ if ((termios->c_cflag & CREAD) != 0)
+ sci_start_rx(port);
+
+- if (s->disable)
+- s->disable(port);
++ sci_port_disable(s);
+ }
+
+ static const char *sci_type(struct uart_port *port)
+@@ -1875,8 +1865,6 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ if (IS_ERR(sci_port->fclk))
+ sci_port->fclk = NULL;
+
+- sci_port->enable = sci_clk_enable;
+- sci_port->disable = sci_clk_disable;
+ port->dev = &dev->dev;
+
+ pm_runtime_enable(&dev->dev);
+@@ -1955,8 +1943,7 @@ static void serial_console_write(struct console *co, const char *s,
+ struct uart_port *port = &sci_port->port;
+ unsigned short bits;
+
+- if (sci_port->enable)
+- sci_port->enable(port);
++ sci_port_enable(sci_port);
+
+ uart_console_write(port, s, count, serial_console_putchar);
+
+@@ -1965,8 +1952,7 @@ static void serial_console_write(struct console *co, const char *s,
+ while ((sci_in(port, SCxSR) & bits) != bits)
+ cpu_relax();
+
+- if (sci_port->disable)
+- sci_port->disable(port);
++ sci_port_disable(sci_port);
+ }
+
+ static int __devinit serial_console_setup(struct console *co, char *options)
+@@ -1998,8 +1984,7 @@ static int __devinit serial_console_setup(struct console *co, char *options)
+ if (unlikely(ret != 0))
+ return ret;
+
+- if (sci_port->enable)
+- sci_port->enable(port);
++ sci_port_enable(sci_port);
+
+ if (options)
+ uart_parse_options(options, &baud, &parity, &bits, &flow);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0210-serial-sh-sci-Fix-up-pretty-name-printing-for-port-I.patch b/patches.armadillo800eva/0210-serial-sh-sci-Fix-up-pretty-name-printing-for-port-I.patch
new file mode 100644
index 00000000000000..3ae6864eb74098
--- /dev/null
+++ b/patches.armadillo800eva/0210-serial-sh-sci-Fix-up-pretty-name-printing-for-port-I.patch
@@ -0,0 +1,203 @@
+From 85a65afb2bda6509a378e48512b2f7faa3ea3494 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Tue, 28 Jun 2011 15:25:36 +0900
+Subject: serial: sh-sci: Fix up pretty name printing for port IRQs.
+
+Presently these were all using the same static string with no regard to
+dev_name() and the like. This implements a bit of rework to name the IRQ
+dynamically, as it should have been doing all along anyways.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 9174fc8f111982e024a00512c521ad8f1056fccb)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 118 +++++++++++++++++++++++++++++++------------
+ include/linux/serial_sci.h | 7 +++
+ 2 files changed, 92 insertions(+), 33 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index b78a261..a0a1943 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -71,6 +71,8 @@ struct sci_port {
+ /* Function clock */
+ struct clk *fclk;
+
++ char *irqstr[SCIx_NR_IRQS];
++
+ struct dma_chan *chan_tx;
+ struct dma_chan *chan_rx;
+
+@@ -954,53 +956,102 @@ static int sci_notifier(struct notifier_block *self,
+ return NOTIFY_OK;
+ }
+
++static struct sci_irq_desc {
++ const char *desc;
++ irq_handler_t handler;
++} sci_irq_desc[] = {
++ /*
++ * Split out handlers, the default case.
++ */
++ [SCIx_ERI_IRQ] = {
++ .desc = "rx err",
++ .handler = sci_er_interrupt,
++ },
++
++ [SCIx_RXI_IRQ] = {
++ .desc = "rx full",
++ .handler = sci_rx_interrupt,
++ },
++
++ [SCIx_TXI_IRQ] = {
++ .desc = "tx empty",
++ .handler = sci_tx_interrupt,
++ },
++
++ [SCIx_BRI_IRQ] = {
++ .desc = "break",
++ .handler = sci_br_interrupt,
++ },
++
++ /*
++ * Special muxed handler.
++ */
++ [SCIx_MUX_IRQ] = {
++ .desc = "mux",
++ .handler = sci_mpxed_interrupt,
++ },
++};
++
+ static int sci_request_irq(struct sci_port *port)
+ {
+- int i;
+- irqreturn_t (*handlers[4])(int irq, void *ptr) = {
+- sci_er_interrupt, sci_rx_interrupt, sci_tx_interrupt,
+- sci_br_interrupt,
+- };
+- const char *desc[] = { "SCI Receive Error", "SCI Receive Data Full",
+- "SCI Transmit Data Empty", "SCI Break" };
+-
+- if (port->cfg->irqs[0] == port->cfg->irqs[1]) {
+- if (unlikely(!port->cfg->irqs[0]))
+- return -ENODEV;
+-
+- if (request_irq(port->cfg->irqs[0], sci_mpxed_interrupt,
+- IRQF_DISABLED, "sci", port)) {
+- dev_err(port->port.dev, "Can't allocate IRQ\n");
+- return -ENODEV;
++ struct uart_port *up = &port->port;
++ int i, j, ret = 0;
++
++ for (i = j = 0; i < SCIx_NR_IRQS; i++, j++) {
++ struct sci_irq_desc *desc;
++ unsigned int irq;
++
++ if (SCIx_IRQ_IS_MUXED(port)) {
++ i = SCIx_MUX_IRQ;
++ irq = up->irq;
++ } else
++ irq = port->cfg->irqs[i];
++
++ desc = sci_irq_desc + i;
++ port->irqstr[j] = kasprintf(GFP_KERNEL, "%s:%s",
++ dev_name(up->dev), desc->desc);
++ if (!port->irqstr[j]) {
++ dev_err(up->dev, "Failed to allocate %s IRQ string\n",
++ desc->desc);
++ goto out_nomem;
+ }
+- } else {
+- for (i = 0; i < ARRAY_SIZE(handlers); i++) {
+- if (unlikely(!port->cfg->irqs[i]))
+- continue;
+-
+- if (request_irq(port->cfg->irqs[i], handlers[i],
+- IRQF_DISABLED, desc[i], port)) {
+- dev_err(port->port.dev, "Can't allocate IRQ\n");
+- return -ENODEV;
+- }
++
++ ret = request_irq(irq, desc->handler, up->irqflags,
++ port->irqstr[j], port);
++ if (unlikely(ret)) {
++ dev_err(up->dev, "Can't allocate %s IRQ\n", desc->desc);
++ goto out_noirq;
+ }
+ }
+
+ return 0;
++
++out_noirq:
++ while (--i >= 0)
++ free_irq(port->cfg->irqs[i], port);
++
++out_nomem:
++ while (--j >= 0)
++ kfree(port->irqstr[j]);
++
++ return ret;
+ }
+
+ static void sci_free_irq(struct sci_port *port)
+ {
+ int i;
+
+- if (port->cfg->irqs[0] == port->cfg->irqs[1])
+- free_irq(port->cfg->irqs[0], port);
+- else {
+- for (i = 0; i < ARRAY_SIZE(port->cfg->irqs); i++) {
+- if (!port->cfg->irqs[i])
+- continue;
++ /*
++ * Intentionally in reverse order so we iterate over the muxed
++ * IRQ first.
++ */
++ for (i = 0; i < SCIx_NR_IRQS; i++) {
++ free_irq(port->cfg->irqs[i], port);
++ kfree(port->irqstr[i]);
+
+- free_irq(port->cfg->irqs[i], port);
++ if (SCIx_IRQ_IS_MUXED(port)) {
++ /* If there's only one IRQ, we're done. */
++ return;
+ }
+ }
+ }
+@@ -1915,6 +1966,7 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ * For the muxed case there's nothing more to do.
+ */
+ port->irq = p->irqs[SCIx_RXI_IRQ];
++ port->irqflags = IRQF_DISABLED;
+
+ port->serial_in = sci_serial_in;
+ port->serial_out = sci_serial_out;
+diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
+index 4ca130a..8bffe9a 100644
+--- a/include/linux/serial_sci.h
++++ b/include/linux/serial_sci.h
+@@ -56,6 +56,8 @@ enum {
+ SCIx_TXI_IRQ,
+ SCIx_BRI_IRQ,
+ SCIx_NR_IRQS,
++
++ SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */
+ };
+
+ enum {
+@@ -82,6 +84,11 @@ enum {
+ [SCIx_BRI_IRQ] = (irq), \
+ }
+
++#define SCIx_IRQ_IS_MUXED(port) \
++ ((port)->cfg->irqs[SCIx_ERI_IRQ] == \
++ (port)->cfg->irqs[SCIx_RXI_IRQ]) || \
++ ((port)->cfg->irqs[SCIx_ERI_IRQ] && \
++ !(port)->cfg->irqs[SCIx_RXI_IRQ])
+ /*
+ * SCI register subset common for all port types.
+ * Not all registers will exist on all parts.
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0211-serial-sh-sci-Fix-up-default-regtype-probing.patch b/patches.armadillo800eva/0211-serial-sh-sci-Fix-up-default-regtype-probing.patch
new file mode 100644
index 00000000000000..8d1af298b65bff
--- /dev/null
+++ b/patches.armadillo800eva/0211-serial-sh-sci-Fix-up-default-regtype-probing.patch
@@ -0,0 +1,34 @@
+From 09dfd1ebc4ac759bc43ff50debf53ffe339135f8 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Wed, 3 Aug 2011 12:33:20 +0900
+Subject: serial: sh-sci: Fix up default regtype probing.
+
+Presently the default regtype probing inadvertently bails out due to an
+inverted error check. This fixes it up, and gets platforms without
+explicit regtype specifications working again.
+
+Reported-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit ad75b88ac3792ae6a541d9b9fa84e379bd0b29dd)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index a0a1943..013b894 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1894,7 +1894,7 @@ static int __devinit sci_init_single(struct platform_device *dev,
+
+ if (p->regtype == SCIx_PROBE_REGTYPE) {
+ ret = sci_probe_regmap(p);
+- if (unlikely(!ret))
++ if (unlikely(ret != 0))
+ return ret;
+ }
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0212-serial-sh-sci-fix-DMA-build-by-including-dma-mapping.patch b/patches.armadillo800eva/0212-serial-sh-sci-fix-DMA-build-by-including-dma-mapping.patch
new file mode 100644
index 00000000000000..3064a6fccc7bc0
--- /dev/null
+++ b/patches.armadillo800eva/0212-serial-sh-sci-fix-DMA-build-by-including-dma-mapping.patch
@@ -0,0 +1,46 @@
+From 976f0f69e849e1e3dfd5e588f4937141c78f7744 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Tue, 2 Aug 2011 09:42:54 +0000
+Subject: serial: sh-sci: fix DMA build by including dma-mapping.h
+
+Include dma-mapping.h to fix build of the sh-sci driver on
+SH-Mobile ARM (sh73a0) when CONFIG_SERIAL_SH_SCI_DMA=y:
+
+drivers/tty/serial/sh-sci.c: In function 'sci_rx_dma_release':
+drivers/tty/serial/sh-sci.c:1182:3: error: implicit declaration of function 'dma_free_coherent'
+drivers/tty/serial/sh-sci.c: In function 'work_fn_tx':
+drivers/tty/serial/sh-sci.c:1333:2: error: implicit declaration of function 'dma_sync_sg_for_device'
+drivers/tty/serial/sh-sci.c: In function 'sci_request_dma':
+drivers/tty/serial/sh-sci.c:1498:3: error: implicit declaration of function 'dma_map_sg'
+drivers/tty/serial/sh-sci.c:1527:3: error: implicit declaration of function 'dma_alloc_coherent'
+drivers/tty/serial/sh-sci.c:1527:10: warning: assignment makes pointer from integer without a cast
+make[3]: *** [drivers/tty/serial/sh-sci.o] Error 1
+make[2]: *** [drivers/tty/serial] Error 2
+make[1]: *** [drivers/tty] Error 2
+make: *** [drivers] Error 2
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Tested-by: Simon Horman <horms@verge.net.au>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 5beabc7fcd99856084e232b37d3280ce353eaf41)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 013b894..fea0f85 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -47,6 +47,7 @@
+ #include <linux/ctype.h>
+ #include <linux/err.h>
+ #include <linux/dmaengine.h>
++#include <linux/dma-mapping.h>
+ #include <linux/scatterlist.h>
+ #include <linux/slab.h>
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0213-serial-sh-sci-console-Runtime-PM-support.patch b/patches.armadillo800eva/0213-serial-sh-sci-console-Runtime-PM-support.patch
new file mode 100644
index 00000000000000..8cd72900755326
--- /dev/null
+++ b/patches.armadillo800eva/0213-serial-sh-sci-console-Runtime-PM-support.patch
@@ -0,0 +1,145 @@
+From 54f57537acd2b7a287c2fef8cb13d5c092e2af75 Mon Sep 17 00:00:00 2001
+From: Magnus Damm <damm@opensource.se>
+Date: Wed, 3 Aug 2011 03:47:36 +0000
+Subject: serial: sh-sci: console Runtime PM support
+
+Add Runtime PM context save/restore support to
+the SCIF driver. Tested on the AP4EVB console.
+
+Signed-off-by: Magnus Damm <damm@opensource.se>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 1ba762209491e2496e58baffa3fd65d661f54404)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 68 ++++++++++++++++++++++++++++++++++++-------
+ 1 file changed, 58 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index fea0f85..0ccd33d 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -96,6 +96,12 @@ struct sci_port {
+ #endif
+
+ struct notifier_block freq_transition;
++
++#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE
++ unsigned short saved_smr;
++ unsigned short saved_fcr;
++ unsigned char saved_brr;
++#endif
+ };
+
+ /* Function prototypes */
+@@ -1639,11 +1645,25 @@ static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps,
+ return ((freq + 16 * bps) / (32 * bps) - 1);
+ }
+
++static void sci_reset(struct uart_port *port)
++{
++ unsigned int status;
++
++ do {
++ status = sci_in(port, SCxSR);
++ } while (!(status & SCxSR_TEND(port)));
++
++ sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */
++
++ if (port->type != PORT_SCI)
++ sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
++}
++
+ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+ struct ktermios *old)
+ {
+ struct sci_port *s = to_sci_port(port);
+- unsigned int status, baud, smr_val, max_baud;
++ unsigned int baud, smr_val, max_baud;
+ int t = -1;
+ u16 scfcr = 0;
+
+@@ -1663,14 +1683,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+
+ sci_port_enable(s);
+
+- do {
+- status = sci_in(port, SCxSR);
+- } while (!(status & SCxSR_TEND(port)));
+-
+- sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */
+-
+- if (port->type != PORT_SCI)
+- sci_out(port, SCFCR, scfcr | SCFCR_RFRST | SCFCR_TFRST);
++ sci_reset(port);
+
+ smr_val = sci_in(port, SCSMR) & 3;
+
+@@ -2042,7 +2055,8 @@ static int __devinit serial_console_setup(struct console *co, char *options)
+ if (options)
+ uart_parse_options(options, &baud, &parity, &bits, &flow);
+
+- /* TODO: disable clock */
++ sci_port_disable(sci_port);
++
+ return uart_set_options(port, co, baud, parity, bits, flow);
+ }
+
+@@ -2085,6 +2099,36 @@ static int __devinit sci_probe_earlyprintk(struct platform_device *pdev)
+ return 0;
+ }
+
++#define uart_console(port) ((port)->cons->index == (port)->line)
++
++static int sci_runtime_suspend(struct device *dev)
++{
++ struct sci_port *sci_port = dev_get_drvdata(dev);
++ struct uart_port *port = &sci_port->port;
++
++ if (uart_console(port)) {
++ sci_port->saved_smr = sci_in(port, SCSMR);
++ sci_port->saved_brr = sci_in(port, SCBRR);
++ sci_port->saved_fcr = sci_in(port, SCFCR);
++ }
++ return 0;
++}
++
++static int sci_runtime_resume(struct device *dev)
++{
++ struct sci_port *sci_port = dev_get_drvdata(dev);
++ struct uart_port *port = &sci_port->port;
++
++ if (uart_console(port)) {
++ sci_reset(port);
++ sci_out(port, SCSMR, sci_port->saved_smr);
++ sci_out(port, SCBRR, sci_port->saved_brr);
++ sci_out(port, SCFCR, sci_port->saved_fcr);
++ sci_out(port, SCSCR, sci_port->cfg->scscr);
++ }
++ return 0;
++}
++
+ #define SCI_CONSOLE (&serial_console)
+
+ #else
+@@ -2094,6 +2138,8 @@ static inline int __devinit sci_probe_earlyprintk(struct platform_device *pdev)
+ }
+
+ #define SCI_CONSOLE NULL
++#define sci_runtime_suspend NULL
++#define sci_runtime_resume NULL
+
+ #endif /* CONFIG_SERIAL_SH_SCI_CONSOLE */
+
+@@ -2209,6 +2255,8 @@ static int sci_resume(struct device *dev)
+ }
+
+ static const struct dev_pm_ops sci_dev_pm_ops = {
++ .runtime_suspend = sci_runtime_suspend,
++ .runtime_resume = sci_runtime_resume,
+ .suspend = sci_suspend,
+ .resume = sci_resume,
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0214-sh-sci-PM-Use-power.irq_safe.patch b/patches.armadillo800eva/0214-sh-sci-PM-Use-power.irq_safe.patch
new file mode 100644
index 00000000000000..f52dea5da1fb8d
--- /dev/null
+++ b/patches.armadillo800eva/0214-sh-sci-PM-Use-power.irq_safe.patch
@@ -0,0 +1,35 @@
+From 766abd46766d85d3c4e930138ff6acf86ece806f Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rjw@sisk.pl>
+Date: Wed, 24 Aug 2011 21:41:08 +0200
+Subject: sh-sci / PM: Use power.irq_safe
+
+Since sci_port_enable() and sci_port_disable() may be run with
+interrupts off and they execute pm_runtime_get_sync() and
+pm_runtime_put_sync(), respectively, the SCI device's
+power.irq_safe flag has to be set to indicate that it is safe
+to execute runtime PM callbacks for this device with interrupts off.
+
+Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
+Acked-by: Magnus Damm <damm@opensource.se>
+(cherry picked from commit 5a50a01bf00c8191073fdf518e1af1e950ac3af5)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 0ccd33d..bd16da5 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1932,6 +1932,7 @@ static int __devinit sci_init_single(struct platform_device *dev,
+
+ port->dev = &dev->dev;
+
++ pm_runtime_irq_safe(&dev->dev);
+ pm_runtime_enable(&dev->dev);
+ }
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0215-serial-sh-sci-report-CTS-as-active-for-get_mctrl.patch b/patches.armadillo800eva/0215-serial-sh-sci-report-CTS-as-active-for-get_mctrl.patch
new file mode 100644
index 00000000000000..f8f21cc1211adb
--- /dev/null
+++ b/patches.armadillo800eva/0215-serial-sh-sci-report-CTS-as-active-for-get_mctrl.patch
@@ -0,0 +1,43 @@
+From 77fdbc761d302a90de221ea25ef6bbb47eb64a95 Mon Sep 17 00:00:00 2001
+From: Yoshii Takashi <takashi.yoshii.zj@renesas.com>
+Date: Tue, 23 Aug 2011 08:27:18 +0000
+Subject: serial: sh-sci: report CTS as active for get_mctrl
+
+sh-sci.c sets hardware up and then let the HW do all flow controls.
+There is no software code, nor needs to get/set real CTS signal.
+
+But, when turning CRTSCTS on through termios, uart_set_termios() in
+serial_core.c checks CTS, and stops TX if it is inactive at the moment.
+
+Because sci_get_mctrl() returns a fixed value DTR|RTS|DSR but CTS,
+the sequence
+ open -> set CRTSCTS -> write
+hit the case and stop working, no more outputs.
+
+This patch makes sci_get_mctrl() report CTS in addition.
+
+Signed-off-by: Takashi YOSHII <takashi.yoshii.zj@renesas.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 4480a688b2beaa82ecac269b6e21bf1a26251bf9)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index bd16da5..afc48ba 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1083,7 +1083,7 @@ static unsigned int sci_get_mctrl(struct uart_port *port)
+ /* This routine is used for getting signals of: DTR, DCD, DSR, RI,
+ and CTS/RTS */
+
+- return TIOCM_DTR | TIOCM_RTS | TIOCM_DSR;
++ return TIOCM_DTR | TIOCM_RTS | TIOCM_CTS | TIOCM_DSR;
+ }
+
+ #ifdef CONFIG_SERIAL_SH_SCI_DMA
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0216-serial-sh-sci-don-t-filter-on-DMA-device-use-only-ch.patch b/patches.armadillo800eva/0216-serial-sh-sci-don-t-filter-on-DMA-device-use-only-ch.patch
new file mode 100644
index 00000000000000..e28c79f1f171eb
--- /dev/null
+++ b/patches.armadillo800eva/0216-serial-sh-sci-don-t-filter-on-DMA-device-use-only-ch.patch
@@ -0,0 +1,108 @@
+From 7d534d91a324c4e626a0e4ccc318f0ffe997724f Mon Sep 17 00:00:00 2001
+From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+Date: Fri, 24 Jun 2011 13:56:15 +0200
+Subject: serial: sh-sci: don't filter on DMA device, use only channel ID
+
+On some sh-mobile systems there are more than one DMA controllers, that
+can be used for serial ports. Specifying a DMA device in sh-sci platform
+data unnecessarily restricts the driver to only use one DMA controller.
+
+Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+[Fixed the trivial conflict in include/linux/serial_sci.h]
+Signed-off-by: Vinod Koul <vinod.koul@intel.com>
+(cherry picked from commit 937bb6e4c676fecbfbc1939b942241c3f27bf5d8)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 25 ++++++++-----------------
+ include/linux/serial_sci.h | 2 --
+ 2 files changed, 8 insertions(+), 19 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index afc48ba..16914a1 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1451,12 +1451,8 @@ static bool filter(struct dma_chan *chan, void *slave)
+ dev_dbg(chan->device->dev, "%s: slave ID %d\n", __func__,
+ param->slave_id);
+
+- if (param->dma_dev == chan->device->dev) {
+- chan->private = param;
+- return true;
+- } else {
+- return false;
+- }
++ chan->private = param;
++ return true;
+ }
+
+ static void rx_timer_fn(unsigned long arg)
+@@ -1482,10 +1478,10 @@ static void sci_request_dma(struct uart_port *port)
+ dma_cap_mask_t mask;
+ int nent;
+
+- dev_dbg(port->dev, "%s: port %d DMA %p\n", __func__,
+- port->line, s->cfg->dma_dev);
++ dev_dbg(port->dev, "%s: port %d\n", __func__,
++ port->line);
+
+- if (!s->cfg->dma_dev)
++ if (s->cfg->dma_slave_tx <= 0 || s->cfg->dma_slave_rx <= 0)
+ return;
+
+ dma_cap_zero(mask);
+@@ -1495,7 +1491,6 @@ static void sci_request_dma(struct uart_port *port)
+
+ /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_TX */
+ param->slave_id = s->cfg->dma_slave_tx;
+- param->dma_dev = s->cfg->dma_dev;
+
+ s->cookie_tx = -EINVAL;
+ chan = dma_request_channel(mask, filter, param);
+@@ -1524,7 +1519,6 @@ static void sci_request_dma(struct uart_port *port)
+
+ /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_RX */
+ param->slave_id = s->cfg->dma_slave_rx;
+- param->dma_dev = s->cfg->dma_dev;
+
+ chan = dma_request_channel(mask, filter, param);
+ dev_dbg(port->dev, "%s: RX: got channel %p\n", __func__, chan);
+@@ -1569,9 +1563,6 @@ static void sci_free_dma(struct uart_port *port)
+ {
+ struct sci_port *s = to_sci_port(port);
+
+- if (!s->cfg->dma_dev)
+- return;
+-
+ if (s->chan_tx)
+ sci_tx_dma_release(s, false);
+ if (s->chan_rx)
+@@ -1986,9 +1977,9 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ port->serial_in = sci_serial_in;
+ port->serial_out = sci_serial_out;
+
+- if (p->dma_dev)
+- dev_dbg(port->dev, "DMA device %p, tx %d, rx %d\n",
+- p->dma_dev, p->dma_slave_tx, p->dma_slave_rx);
++ if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0)
++ dev_dbg(port->dev, "DMA tx %d, rx %d\n",
++ p->dma_slave_tx, p->dma_slave_rx);
+
+ return 0;
+ }
+diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
+index 8bffe9a..0efa1f1 100644
+--- a/include/linux/serial_sci.h
++++ b/include/linux/serial_sci.h
+@@ -131,8 +131,6 @@ struct plat_sci_port {
+
+ struct plat_sci_port_ops *ops;
+
+- struct device *dma_dev;
+-
+ unsigned int dma_slave_tx;
+ unsigned int dma_slave_rx;
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0217-TTY-irq-Remove-IRQF_DISABLED.patch b/patches.armadillo800eva/0217-TTY-irq-Remove-IRQF_DISABLED.patch
new file mode 100644
index 00000000000000..9b3bf2450d259b
--- /dev/null
+++ b/patches.armadillo800eva/0217-TTY-irq-Remove-IRQF_DISABLED.patch
@@ -0,0 +1,60 @@
+From 8dc42793344c479e89a130235da8a26ee3684079 Mon Sep 17 00:00:00 2001
+From: Yong Zhang <yong.zhang0@gmail.com>
+Date: Thu, 22 Sep 2011 16:59:15 +0800
+Subject: TTY: irq: Remove IRQF_DISABLED
+
+Since commit [e58aa3d2: genirq: Run irq handlers with interrupts disabled],
+We run all interrupt handlers with interrupts disabled
+and we even check and yell when an interrupt handler
+returns with interrupts enabled (see commit [b738a50a:
+genirq: Warn when handler enables interrupts]).
+
+So now this flag is a NOOP and can be removed.
+
+Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
+Acked-by: Tobias Klauser <tklauser@distanz.ch>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+(cherry picked from commit 9cfb5c05fee914cc65d4706801f6bc424082b5f5)
+
+Conflicts:
+
+ drivers/tty/serial/bfin_uart.c
+ drivers/tty/amiserial.c
+ drivers/tty/cyclades.c
+ drivers/tty/hvc/hvc_irq.c
+ drivers/tty/hvc/hvcs.c
+ drivers/tty/hvc/hvsi.c
+ drivers/tty/isicom.c
+ drivers/tty/serial/68328serial.c
+ drivers/tty/serial/altera_jtaguart.c
+ drivers/tty/serial/altera_uart.c
+ drivers/tty/serial/bfin_sport_uart.c
+ drivers/tty/serial/crisv10.c
+ drivers/tty/serial/icom.c
+ drivers/tty/serial/lantiq.c
+ drivers/tty/serial/mcf.c
+ drivers/tty/serial/mpc52xx_uart.c
+ drivers/tty/serial/serial_ks8695.c
+ drivers/tty/serial/sn_console.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 16914a1..a385564f 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1972,7 +1972,7 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ * For the muxed case there's nothing more to do.
+ */
+ port->irq = p->irqs[SCIx_RXI_IRQ];
+- port->irqflags = IRQF_DISABLED;
++ port->irqflags = 0;
+
+ port->serial_in = sci_serial_in;
+ port->serial_out = sci_serial_out;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0218-serial-sh-sci-Fix-up-SH-2A-SCIF-support.patch b/patches.armadillo800eva/0218-serial-sh-sci-Fix-up-SH-2A-SCIF-support.patch
new file mode 100644
index 00000000000000..c26f8da9609f65
--- /dev/null
+++ b/patches.armadillo800eva/0218-serial-sh-sci-Fix-up-SH-2A-SCIF-support.patch
@@ -0,0 +1,71 @@
+From e7e97512e6f8a4744aa7113d61f4503dca244abf Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Mon, 3 Oct 2011 15:16:47 +0100
+Subject: serial: sh-sci: Fix up SH-2A SCIF support.
+
+This fixes up support for SH-2(A) SCIFs by introducing a new regtype. As
+expected, it's close to the SH-4A SCIF with fifodata, but still different
+enough to warrant its own type.
+
+Fixes up a number of FIFO overflows and similar for both SH7203/SH7264.
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Tested-by: Federico Fuga <fuga@studiofuga.com>
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 3af1f8a41feab47b232b0c3d3b2322426672480d)
+
+Conflicts:
+
+ arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 19 +++++++++++++++++++
+ include/linux/serial_sci.h | 1 +
+ 2 files changed, 20 insertions(+)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index a385564f..a1d1666 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -207,6 +207,25 @@ static struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
+ },
+
+ /*
++ * Common SH-2(A) SCIF definitions for ports with FIFO data
++ * count registers.
++ */
++ [SCIx_SH2_SCIF_FIFODATA_REGTYPE] = {
++ [SCSMR] = { 0x00, 16 },
++ [SCBRR] = { 0x04, 8 },
++ [SCSCR] = { 0x08, 16 },
++ [SCxTDR] = { 0x0c, 8 },
++ [SCxSR] = { 0x10, 16 },
++ [SCxRDR] = { 0x14, 8 },
++ [SCFCR] = { 0x18, 16 },
++ [SCFDR] = { 0x1c, 16 },
++ [SCTFDR] = sci_reg_invalid,
++ [SCRFDR] = sci_reg_invalid,
++ [SCSPTR] = { 0x20, 16 },
++ [SCLSR] = { 0x24, 16 },
++ },
++
++ /*
+ * Common SH-3 SCIF definitions.
+ */
+ [SCIx_SH3_SCIF_REGTYPE] = {
+diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
+index 0efa1f1..369273a 100644
+--- a/include/linux/serial_sci.h
++++ b/include/linux/serial_sci.h
+@@ -67,6 +67,7 @@ enum {
+ SCIx_IRDA_REGTYPE,
+ SCIx_SCIFA_REGTYPE,
+ SCIx_SCIFB_REGTYPE,
++ SCIx_SH2_SCIF_FIFODATA_REGTYPE,
+ SCIx_SH3_SCIF_REGTYPE,
+ SCIx_SH4_SCIF_REGTYPE,
+ SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0219-serial-sh-sci-Fix-up-SCFCR-handling.patch b/patches.armadillo800eva/0219-serial-sh-sci-Fix-up-SCFCR-handling.patch
new file mode 100644
index 00000000000000..497b9440300769
--- /dev/null
+++ b/patches.armadillo800eva/0219-serial-sh-sci-Fix-up-SCFCR-handling.patch
@@ -0,0 +1,111 @@
+From daabf4daf83a752389b9c93ce640881a5d03b53d Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Thu, 24 Nov 2011 18:35:49 +0900
+Subject: serial: sh-sci: Fix up SCFCR handling.
+
+Presently there are a few places that make assumptions about the
+existence of SCFCR, which doesn't hold true for several port types. While
+generally harmless, this does lead to bogus reads/writes in both the
+termios/runtime PM cases that are better off simply never being made in
+the first place.
+
+While we're at it, also get rid of a straggling PORT_SCI check that
+infers all non-SCI ports contain SCFCR. This doesn't presently have any
+impact, but as we're now able to test for the existence of registers
+without defering to the port type we future proof for additional port
+types.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 0979e0e641d21d3bb318da90a64fc0024a95f50e)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 33 ++++++++++++++++++++++++++++-----
+ 1 file changed, 28 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index a1d1666..7df9235 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1657,6 +1657,7 @@ static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps,
+
+ static void sci_reset(struct uart_port *port)
+ {
++ struct plat_sci_reg *reg;
+ unsigned int status;
+
+ do {
+@@ -1665,7 +1666,8 @@ static void sci_reset(struct uart_port *port)
+
+ sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */
+
+- if (port->type != PORT_SCI)
++ reg = sci_getreg(port, SCFCR);
++ if (reg->size)
+ sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
+ }
+
+@@ -1673,9 +1675,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+ struct ktermios *old)
+ {
+ struct sci_port *s = to_sci_port(port);
++ struct plat_sci_reg *reg;
+ unsigned int baud, smr_val, max_baud;
+ int t = -1;
+- u16 scfcr = 0;
+
+ /*
+ * earlyprintk comes here early on with port->uartclk set to zero.
+@@ -1725,7 +1727,18 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+ }
+
+ sci_init_pins(port, termios->c_cflag);
+- sci_out(port, SCFCR, scfcr | ((termios->c_cflag & CRTSCTS) ? SCFCR_MCE : 0));
++
++ reg = sci_getreg(port, SCFCR);
++ if (reg->size) {
++ unsigned short ctrl;
++
++ ctrl = sci_in(port, SCFCR);
++ if (termios->c_cflag & CRTSCTS)
++ ctrl |= SCFCR_MCE;
++ else
++ ctrl &= ~SCFCR_MCE;
++ sci_out(port, SCFCR, ctrl);
++ }
+
+ sci_out(port, SCSCR, s->cfg->scscr);
+
+@@ -2118,9 +2131,16 @@ static int sci_runtime_suspend(struct device *dev)
+ struct uart_port *port = &sci_port->port;
+
+ if (uart_console(port)) {
++ struct plat_sci_reg *reg;
++
+ sci_port->saved_smr = sci_in(port, SCSMR);
+ sci_port->saved_brr = sci_in(port, SCBRR);
+- sci_port->saved_fcr = sci_in(port, SCFCR);
++
++ reg = sci_getreg(port, SCFCR);
++ if (reg->size)
++ sci_port->saved_fcr = sci_in(port, SCFCR);
++ else
++ sci_port->saved_fcr = 0;
+ }
+ return 0;
+ }
+@@ -2134,7 +2154,10 @@ static int sci_runtime_resume(struct device *dev)
+ sci_reset(port);
+ sci_out(port, SCSMR, sci_port->saved_smr);
+ sci_out(port, SCBRR, sci_port->saved_brr);
+- sci_out(port, SCFCR, sci_port->saved_fcr);
++
++ if (sci_port->saved_fcr)
++ sci_out(port, SCFCR, sci_port->saved_fcr);
++
+ sci_out(port, SCSCR, sci_port->cfg->scscr);
+ }
+ return 0;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0220-serial-sh-sci-Support-icount-statistics-for-error-ca.patch b/patches.armadillo800eva/0220-serial-sh-sci-Support-icount-statistics-for-error-ca.patch
new file mode 100644
index 00000000000000..4b62e3f592978e
--- /dev/null
+++ b/patches.armadillo800eva/0220-serial-sh-sci-Support-icount-statistics-for-error-ca.patch
@@ -0,0 +1,99 @@
+From c172df9d3931d6a7c1b454cb7e57afbae81d9421 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Thu, 24 Nov 2011 19:15:06 +0900
+Subject: serial: sh-sci: Support icount statistics for error cases.
+
+Presently the icount stats are only adjusted for the rx/tx case, this
+makes sure that they're updated appropriately for the non-tx/rx cases,
+too (specifically overruns, breaks, as well as frame and parity errors).
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit d97fbbed6e5bb37df75be8993bb0c61adb7d3558)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 7df9235..635dd54 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -621,6 +621,7 @@ static void sci_receive_chars(struct uart_port *port)
+ } else {
+ for (i = 0; i < count; i++) {
+ char c = sci_in(port, SCxRDR);
++
+ status = sci_in(port, SCxSR);
+ #if defined(CONFIG_CPU_SH3)
+ /* Skip "chars" during break */
+@@ -649,9 +650,11 @@ static void sci_receive_chars(struct uart_port *port)
+ /* Store data and status */
+ if (status & SCxSR_FER(port)) {
+ flag = TTY_FRAME;
++ port->icount.frame++;
+ dev_notice(port->dev, "frame error\n");
+ } else if (status & SCxSR_PER(port)) {
+ flag = TTY_PARITY;
++ port->icount.parity++;
+ dev_notice(port->dev, "parity error\n");
+ } else
+ flag = TTY_NORMAL;
+@@ -723,6 +726,8 @@ static int sci_handle_errors(struct uart_port *port)
+ */
+ if (s->cfg->overrun_bit != SCIx_NOT_SUPPORTED) {
+ if (status & (1 << s->cfg->overrun_bit)) {
++ port->icount.overrun++;
++
+ /* overrun error */
+ if (tty_insert_flip_char(tty, 0, TTY_OVERRUN))
+ copied++;
+@@ -737,6 +742,8 @@ static int sci_handle_errors(struct uart_port *port)
+ struct sci_port *sci_port = to_sci_port(port);
+
+ if (!sci_port->break_flag) {
++ port->icount.brk++;
++
+ sci_port->break_flag = 1;
+ sci_schedule_break_timer(sci_port);
+
+@@ -752,6 +759,8 @@ static int sci_handle_errors(struct uart_port *port)
+
+ } else {
+ /* frame error */
++ port->icount.frame++;
++
+ if (tty_insert_flip_char(tty, 0, TTY_FRAME))
+ copied++;
+
+@@ -761,6 +770,8 @@ static int sci_handle_errors(struct uart_port *port)
+
+ if (status & SCxSR_PER(port)) {
+ /* parity error */
++ port->icount.parity++;
++
+ if (tty_insert_flip_char(tty, 0, TTY_PARITY))
+ copied++;
+
+@@ -787,6 +798,8 @@ static int sci_handle_fifo_overrun(struct uart_port *port)
+ if ((sci_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) {
+ sci_out(port, SCLSR, 0);
+
++ port->icount.overrun++;
++
+ tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+ tty_flip_buffer_push(tty);
+
+@@ -812,6 +825,9 @@ static int sci_handle_breaks(struct uart_port *port)
+ /* Debounce break */
+ s->break_flag = 1;
+ #endif
++
++ port->icount.brk++;
++
+ /* Notify of BREAK */
+ if (tty_insert_flip_char(tty, 0, TTY_BREAK))
+ copied++;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0221-serial-sh-sci-Clarify-enable_ms-break_ctl-comments.patch b/patches.armadillo800eva/0221-serial-sh-sci-Clarify-enable_ms-break_ctl-comments.patch
new file mode 100644
index 00000000000000..32228f5cfe00a5
--- /dev/null
+++ b/patches.armadillo800eva/0221-serial-sh-sci-Clarify-enable_ms-break_ctl-comments.patch
@@ -0,0 +1,44 @@
+From 9dda1e58ff6cbbb085d6d4d7a24983b9f23b3285 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Thu, 24 Nov 2011 19:36:46 +0900
+Subject: serial: sh-sci: Clarify enable_ms/break_ctl comments.
+
+Technically there's nothing we can do for either of these, so update the
+comments to reflect this, rather than infering that there's additional
+work to be done.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit d39ec6ce34f130d582880d1f3cbe2b38e723cafe)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 635dd54..993180f 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1470,12 +1470,17 @@ static void sci_stop_rx(struct uart_port *port)
+
+ static void sci_enable_ms(struct uart_port *port)
+ {
+- /* Nothing here yet .. */
++ /*
++ * Not supported by hardware, always a nop.
++ */
+ }
+
+ static void sci_break_ctl(struct uart_port *port, int break_state)
+ {
+- /* Nothing here yet .. */
++ /*
++ * Not supported by hardware. Most parts couple break and rx
++ * interrupts together, with break detection always enabled.
++ */
+ }
+
+ #ifdef CONFIG_SERIAL_SH_SCI_DMA
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0222-serial-sh-sci-Fix-up-modem-control-handling.patch b/patches.armadillo800eva/0222-serial-sh-sci-Fix-up-modem-control-handling.patch
new file mode 100644
index 00000000000000..2db50359c7a2f4
--- /dev/null
+++ b/patches.armadillo800eva/0222-serial-sh-sci-Fix-up-modem-control-handling.patch
@@ -0,0 +1,60 @@
+From ec7963824e42768f9049fef194b9d63ca5241c32 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Thu, 24 Nov 2011 20:18:32 +0900
+Subject: serial: sh-sci: Fix up modem control handling.
+
+At the moment things like CTS/RTS are reported for all ports, while the
+vast majority of them do not implement support at all (and others
+implement support entirely in hardware). Fix up the ->get_mctrl()
+reporting to simply assert DSR/CAR as other drivers without control
+lines do.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit cdf7c42fece7c641fcb85cfbf190fdc2a95d19ac)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 21 ++++++++++++++-------
+ 1 file changed, 14 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 993180f..a60ccdb 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1106,19 +1106,26 @@ static unsigned int sci_tx_empty(struct uart_port *port)
+ return (status & SCxSR_TEND(port)) && !in_tx_fifo ? TIOCSER_TEMT : 0;
+ }
+
++/*
++ * Modem control is a bit of a mixed bag for SCI(F) ports. Generally
++ * CTS/RTS is supported in hardware by at least one port and controlled
++ * via SCSPTR (SCxPCR for SCIFA/B parts), or external pins (presently
++ * handled via the ->init_pins() op, which is a bit of a one-way street,
++ * lacking any ability to defer pin control -- this will later be
++ * converted over to the GPIO framework).
++ */
+ static void sci_set_mctrl(struct uart_port *port, unsigned int mctrl)
+ {
+- /* This routine is used for seting signals of: DTR, DCD, CTS/RTS */
+- /* We use SCIF's hardware for CTS/RTS, so don't need any for that. */
+- /* If you have signals for DTR and DCD, please implement here. */
++ /* Nothing to do here. */
+ }
+
+ static unsigned int sci_get_mctrl(struct uart_port *port)
+ {
+- /* This routine is used for getting signals of: DTR, DCD, DSR, RI,
+- and CTS/RTS */
+-
+- return TIOCM_DTR | TIOCM_RTS | TIOCM_CTS | TIOCM_DSR;
++ /*
++ * CTS/RTS is handled in hardware when supported, while nothing
++ * else is wired up. Keep it simple and simply assert DSR/CAR.
++ */
++ return TIOCM_DSR | TIOCM_CAR;
+ }
+
+ #ifdef CONFIG_SERIAL_SH_SCI_DMA
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0223-serial-sh-sci-Add-support-for-loopback-mode.patch b/patches.armadillo800eva/0223-serial-sh-sci-Add-support-for-loopback-mode.patch
new file mode 100644
index 00000000000000..d7f4bbfbc95ce5
--- /dev/null
+++ b/patches.armadillo800eva/0223-serial-sh-sci-Add-support-for-loopback-mode.patch
@@ -0,0 +1,48 @@
+From c649509d4b4a91a603c8185ab72f99427579f50c Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Thu, 24 Nov 2011 20:20:53 +0900
+Subject: serial: sh-sci: Add support for loopback mode.
+
+This plugs in loopback control for SCFCR-enabled ports and plugs it in
+via the TIOCM_LOOP control, as others do.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit dc7e3ef7dade7041fb1809f2a5403efac655a791)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index a60ccdb..b519332 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1113,10 +1113,23 @@ static unsigned int sci_tx_empty(struct uart_port *port)
+ * handled via the ->init_pins() op, which is a bit of a one-way street,
+ * lacking any ability to defer pin control -- this will later be
+ * converted over to the GPIO framework).
++ *
++ * Other modes (such as loopback) are supported generically on certain
++ * port types, but not others. For these it's sufficient to test for the
++ * existence of the support register and simply ignore the port type.
+ */
+ static void sci_set_mctrl(struct uart_port *port, unsigned int mctrl)
+ {
+- /* Nothing to do here. */
++ if (mctrl & TIOCM_LOOP) {
++ struct plat_sci_reg *reg;
++
++ /*
++ * Standard loopback mode for SCFCR ports.
++ */
++ reg = sci_getreg(port, SCFCR);
++ if (reg->size)
++ sci_out(port, SCFCR, sci_in(port, SCFCR) | 1);
++ }
+ }
+
+ static unsigned int sci_get_mctrl(struct uart_port *port)
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0224-serial-sh-sci-per-port-modem-control.patch b/patches.armadillo800eva/0224-serial-sh-sci-per-port-modem-control.patch
new file mode 100644
index 00000000000000..8cda4f92227908
--- /dev/null
+++ b/patches.armadillo800eva/0224-serial-sh-sci-per-port-modem-control.patch
@@ -0,0 +1,110 @@
+From b9eae3d68de564c46de49a1347bffa6f03103705 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Fri, 2 Dec 2011 17:44:50 +0900
+Subject: serial: sh-sci: per-port modem control.
+
+The bulk of the ports do not support any sort of modem control, so
+blindly twiddling the MCE bit doesn't accomplish much. We now require
+ports to manually specify which line supports modem control signals.
+
+While at it, tidy up the RTS/CTSIO handling in SCSPTR parts so it's a bit
+more obvious what's going on (and without clobbering other configurations
+in the process).
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit faf02f8fee5563ea7f950b3f5f08c654aa6c4525)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 31 ++++++++++++++++++++-----------
+ include/linux/serial_sci.h | 10 ++++++++++
+ 2 files changed, 30 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index b519332..b2891bb 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -474,8 +474,15 @@ static void sci_init_pins(struct uart_port *port, unsigned int cflag)
+ if (!reg->size)
+ return;
+
+- if (!(cflag & CRTSCTS))
+- sci_out(port, SCSPTR, 0x0080); /* Set RTS = 1 */
++ if ((s->cfg->capabilities & SCIx_HAVE_RTSCTS) &&
++ ((!(cflag & CRTSCTS)))) {
++ unsigned short status;
++
++ status = sci_in(port, SCSPTR);
++ status &= ~SCSPTR_CTSIO;
++ status |= SCSPTR_RTSIO;
++ sci_out(port, SCSPTR, status); /* Set RTS = 1 */
++ }
+ }
+
+ static int sci_txfill(struct uart_port *port)
+@@ -1769,16 +1776,18 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+
+ sci_init_pins(port, termios->c_cflag);
+
+- reg = sci_getreg(port, SCFCR);
+- if (reg->size) {
+- unsigned short ctrl;
++ if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) {
++ reg = sci_getreg(port, SCFCR);
++ if (reg->size) {
++ unsigned short ctrl;
+
+- ctrl = sci_in(port, SCFCR);
+- if (termios->c_cflag & CRTSCTS)
+- ctrl |= SCFCR_MCE;
+- else
+- ctrl &= ~SCFCR_MCE;
+- sci_out(port, SCFCR, ctrl);
++ ctrl = sci_in(port, SCFCR);
++ if (termios->c_cflag & CRTSCTS)
++ ctrl |= SCFCR_MCE;
++ else
++ ctrl &= ~SCFCR_MCE;
++ sci_out(port, SCFCR, ctrl);
++ }
+ }
+
+ sci_out(port, SCSCR, s->cfg->scscr);
+diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
+index 369273a..15b1bdc 100644
+--- a/include/linux/serial_sci.h
++++ b/include/linux/serial_sci.h
+@@ -49,6 +49,10 @@ enum {
+
+ #define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
+
++/* SCSPTR, optional */
++#define SCSPTR_RTSIO (1 << 7)
++#define SCSPTR_CTSIO (1 << 5)
++
+ /* Offsets into the sci_port->irqs array */
+ enum {
+ SCIx_ERI_IRQ,
+@@ -109,6 +113,11 @@ struct plat_sci_port_ops {
+ };
+
+ /*
++ * Port-specific capabilities
++ */
++#define SCIx_HAVE_RTSCTS (1 << 0)
++
++/*
+ * Platform device specific platform_data struct
+ */
+ struct plat_sci_port {
+@@ -116,6 +125,7 @@ struct plat_sci_port {
+ unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
+ unsigned int type; /* SCI / SCIF / IRDA */
+ upf_t flags; /* UPF_* flags */
++ unsigned long capabilities; /* Port features/capabilities */
+
+ unsigned int scbrr_algo_id; /* SCBRR calculation algo */
+ unsigned int scscr; /* SCSCR initialization */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0225-serial-sh-sci-Avoid-FIFO-clear-for-MCE-toggle.patch b/patches.armadillo800eva/0225-serial-sh-sci-Avoid-FIFO-clear-for-MCE-toggle.patch
new file mode 100644
index 00000000000000..6434e196fca2bb
--- /dev/null
+++ b/patches.armadillo800eva/0225-serial-sh-sci-Avoid-FIFO-clear-for-MCE-toggle.patch
@@ -0,0 +1,56 @@
+From 992ee1e9d43621e7b239937606d65cf8abb38d11 Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Fri, 2 Dec 2011 19:02:06 +0900
+Subject: serial: sh-sci: Avoid FIFO clear for MCE toggle.
+
+When toggling the MCE support we don't want to concern ourselves with the
+FIFO state, so ensure that the clearing bits are masked out when updating
+the MCE state.
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 73c3d53f38e0a8e6c67b0d12d77a8e77c082cd03)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 19 +++++++++++++------
+ 1 file changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index b2891bb..5d9ae22 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1776,18 +1776,25 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
+
+ sci_init_pins(port, termios->c_cflag);
+
+- if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) {
+- reg = sci_getreg(port, SCFCR);
+- if (reg->size) {
+- unsigned short ctrl;
++ reg = sci_getreg(port, SCFCR);
++ if (reg->size) {
++ unsigned short ctrl = sci_in(port, SCFCR);
+
+- ctrl = sci_in(port, SCFCR);
++ if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) {
+ if (termios->c_cflag & CRTSCTS)
+ ctrl |= SCFCR_MCE;
+ else
+ ctrl &= ~SCFCR_MCE;
+- sci_out(port, SCFCR, ctrl);
+ }
++
++ /*
++ * As we've done a sci_reset() above, ensure we don't
++ * interfere with the FIFOs while toggling MCE. As the
++ * reset values could still be set, simply mask them out.
++ */
++ ctrl &= ~(SCFCR_RFRST | SCFCR_TFRST);
++
++ sci_out(port, SCFCR, ctrl);
+ }
+
+ sci_out(port, SCSCR, s->cfg->scscr);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0226-serial-sh-sci-Handle-GPIO-function-requests.patch b/patches.armadillo800eva/0226-serial-sh-sci-Handle-GPIO-function-requests.patch
new file mode 100644
index 00000000000000..b7fbf2ca0f6311
--- /dev/null
+++ b/patches.armadillo800eva/0226-serial-sh-sci-Handle-GPIO-function-requests.patch
@@ -0,0 +1,177 @@
+From 0baeaee9d22ae143cc48456dfc1131fcb4acad2f Mon Sep 17 00:00:00 2001
+From: Paul Mundt <lethal@linux-sh.org>
+Date: Fri, 2 Dec 2011 20:09:48 +0900
+Subject: serial: sh-sci: Handle GPIO function requests.
+
+This adds initial support for requesting the various GPIO functions
+necessary for certain ports. This just plugs in dumb request/free logic,
+but serves as a building block for migrating off of the ->init_pins mess
+to a wholly gpiolib backed solution (primarily parts with external
+RTS/CTS pins, but will also allow us to clean up RXD pin testing).
+
+Signed-off-by: Paul Mundt <lethal@linux-sh.org>
+(cherry picked from commit 50f0959ad4f9ac1c5ee208bb820de299a1b3730b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/tty/serial/sh-sci.c | 71 +++++++++++++++++++++++++++++++++++++++++--
+ include/linux/serial_sci.h | 12 ++++++++
+ 2 files changed, 81 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 5d9ae22..c8014d1 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -50,6 +50,7 @@
+ #include <linux/dma-mapping.h>
+ #include <linux/scatterlist.h>
+ #include <linux/slab.h>
++#include <linux/gpio.h>
+
+ #ifdef CONFIG_SUPERH
+ #include <asm/sh_bios.h>
+@@ -73,6 +74,7 @@ struct sci_port {
+ struct clk *fclk;
+
+ char *irqstr[SCIx_NR_IRQS];
++ char *gpiostr[SCIx_NR_FNS];
+
+ struct dma_chan *chan_tx;
+ struct dma_chan *chan_rx;
+@@ -1105,6 +1107,67 @@ static void sci_free_irq(struct sci_port *port)
+ }
+ }
+
++static const char *sci_gpio_names[SCIx_NR_FNS] = {
++ "sck", "rxd", "txd", "cts", "rts",
++};
++
++static const char *sci_gpio_str(unsigned int index)
++{
++ return sci_gpio_names[index];
++}
++
++static void __devinit sci_init_gpios(struct sci_port *port)
++{
++ struct uart_port *up = &port->port;
++ int i;
++
++ if (!port->cfg)
++ return;
++
++ for (i = 0; i < SCIx_NR_FNS; i++) {
++ const char *desc;
++ int ret;
++
++ if (!port->cfg->gpios[i])
++ continue;
++
++ desc = sci_gpio_str(i);
++
++ port->gpiostr[i] = kasprintf(GFP_KERNEL, "%s:%s",
++ dev_name(up->dev), desc);
++
++ /*
++ * If we've failed the allocation, we can still continue
++ * on with a NULL string.
++ */
++ if (!port->gpiostr[i])
++ dev_notice(up->dev, "%s string allocation failure\n",
++ desc);
++
++ ret = gpio_request(port->cfg->gpios[i], port->gpiostr[i]);
++ if (unlikely(ret != 0)) {
++ dev_notice(up->dev, "failed %s gpio request\n", desc);
++
++ /*
++ * If we can't get the GPIO for whatever reason,
++ * no point in keeping the verbose string around.
++ */
++ kfree(port->gpiostr[i]);
++ }
++ }
++}
++
++static void sci_free_gpios(struct sci_port *port)
++{
++ int i;
++
++ for (i = 0; i < SCIx_NR_FNS; i++)
++ if (port->cfg->gpios[i]) {
++ gpio_free(port->cfg->gpios[i]);
++ kfree(port->gpiostr[i]);
++ }
++}
++
+ static unsigned int sci_tx_empty(struct uart_port *port)
+ {
+ unsigned short status = sci_in(port, SCxSR);
+@@ -1967,6 +2030,8 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ struct uart_port *port = &sci_port->port;
+ int ret;
+
++ sci_port->cfg = p;
++
+ port->ops = &sci_uart_ops;
+ port->iotype = UPIO_MEM;
+ port->line = index;
+@@ -2012,6 +2077,8 @@ static int __devinit sci_init_single(struct platform_device *dev,
+
+ port->dev = &dev->dev;
+
++ sci_init_gpios(sci_port);
++
+ pm_runtime_irq_safe(&dev->dev);
+ pm_runtime_enable(&dev->dev);
+ }
+@@ -2046,8 +2113,6 @@ static int __devinit sci_init_single(struct platform_device *dev,
+ p->error_mask |= (1 << p->overrun_bit);
+ }
+
+- sci_port->cfg = p;
+-
+ port->mapbase = p->mapbase;
+ port->type = p->type;
+ port->flags = p->flags;
+@@ -2254,6 +2319,8 @@ static int sci_remove(struct platform_device *dev)
+ cpufreq_unregister_notifier(&port->freq_transition,
+ CPUFREQ_TRANSITION_NOTIFIER);
+
++ sci_free_gpios(port);
++
+ uart_remove_one_port(&sci_uart_driver, &port->port);
+
+ clk_put(port->iclk);
+diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
+index 15b1bdc..7877907 100644
+--- a/include/linux/serial_sci.h
++++ b/include/linux/serial_sci.h
+@@ -64,6 +64,17 @@ enum {
+ SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */
+ };
+
++/* Offsets into the sci_port->gpios array */
++enum {
++ SCIx_SCK,
++ SCIx_RXD,
++ SCIx_TXD,
++ SCIx_CTS,
++ SCIx_RTS,
++
++ SCIx_NR_FNS,
++};
++
+ enum {
+ SCIx_PROBE_REGTYPE,
+
+@@ -123,6 +134,7 @@ struct plat_sci_port_ops {
+ struct plat_sci_port {
+ unsigned long mapbase; /* resource base */
+ unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
++ unsigned int gpios[SCIx_NR_FNS]; /* SCK, RXD, TXD, CTS, RTS */
+ unsigned int type; /* SCI / SCIF / IRDA */
+ upf_t flags; /* UPF_* flags */
+ unsigned long capabilities; /* Port features/capabilities */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0227-Input-gpio_keys-switch-to-using-threaded-IRQs.patch b/patches.armadillo800eva/0227-Input-gpio_keys-switch-to-using-threaded-IRQs.patch
new file mode 100644
index 00000000000000..d9f645f3c6440d
--- /dev/null
+++ b/patches.armadillo800eva/0227-Input-gpio_keys-switch-to-using-threaded-IRQs.patch
@@ -0,0 +1,42 @@
+From 369137dc876a3f37aa6fb2173433241a3756a70c Mon Sep 17 00:00:00 2001
+From: David Jander <david@protonic.nl>
+Date: Tue, 21 Jun 2011 14:26:18 -0700
+Subject: Input: gpio_keys - switch to using threaded IRQs
+
+Use a threaded interrupt handler in order to permit the handler to use
+a GPIO driver that causes things like I2C transactions being done inside
+the handler context.
+
+Signed-off-by: David Jander <david@protonic.nl>
+Acked-by: Grant Likely <grant.likely@secretlab.ca>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit 7e2ecdf438bb479e2b4667fc16b1a84d6348da04)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index 6e6145b..6d0e2f6 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -415,7 +415,7 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
+ if (!button->can_disable)
+ irqflags |= IRQF_SHARED;
+
+- error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata);
++ error = request_threaded_irq(irq, NULL, gpio_keys_isr, irqflags, desc, bdata);
+ if (error < 0) {
+ dev_err(dev, "Unable to claim irq %d; error %d\n",
+ irq, error);
+@@ -649,5 +649,5 @@ module_exit(gpio_keys_exit);
+
+ MODULE_LICENSE("GPL");
+ MODULE_AUTHOR("Phil Blundell <pb@handhelds.org>");
+-MODULE_DESCRIPTION("Keyboard driver for CPU GPIOs");
++MODULE_DESCRIPTION("Keyboard driver for GPIOs");
+ MODULE_ALIAS("platform:gpio-keys");
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0228-Input-gpio_keys-move-to-late_initcall.patch b/patches.armadillo800eva/0228-Input-gpio_keys-move-to-late_initcall.patch
new file mode 100644
index 00000000000000..eeb2bbe187e01f
--- /dev/null
+++ b/patches.armadillo800eva/0228-Input-gpio_keys-move-to-late_initcall.patch
@@ -0,0 +1,38 @@
+From dbcdd14547f3abb2e5ae97806c7624896ab84e88 Mon Sep 17 00:00:00 2001
+From: David Jander <david@protonic.nl>
+Date: Thu, 23 Jun 2011 01:30:09 -0700
+Subject: Input: gpio_keys - move to late_initcall
+
+Initialize gpio_keys driver at late_initcall level, to give it a chance to
+work with GPIO expanders that might not be ready yet if we initialize the
+driver at module_init time.
+
+This is strictly a band-aid until there is a better way to specify
+inter-device dependencies.
+
+Signed-off-by: David Jander <david@protonic.nl>
+Acked-by: Grant Likely <grant.likely@secretlab.ca>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit b23302052d96a3945e4c72aca77b5fd28884c353)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index 6d0e2f6..320b59a 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -644,7 +644,7 @@ static void __exit gpio_keys_exit(void)
+ platform_driver_unregister(&gpio_keys_device_driver);
+ }
+
+-module_init(gpio_keys_init);
++late_initcall(gpio_keys_init);
+ module_exit(gpio_keys_exit);
+
+ MODULE_LICENSE("GPL");
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0229-Input-gpio_keys-fix-a-memory-leak.patch b/patches.armadillo800eva/0229-Input-gpio_keys-fix-a-memory-leak.patch
new file mode 100644
index 00000000000000..1432224f5d625d
--- /dev/null
+++ b/patches.armadillo800eva/0229-Input-gpio_keys-fix-a-memory-leak.patch
@@ -0,0 +1,29 @@
+From 9c9df13f1a600712533169e0f5b0d7ee82822f08 Mon Sep 17 00:00:00 2001
+From: Axel Lin <axel.lin@gmail.com>
+Date: Tue, 28 Jun 2011 14:23:30 -0700
+Subject: Input: gpio_keys - fix a memory leak
+
+Signed-off-by: Axel Lin <axel.lin@gmail.com>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit 1638207910019368253fc4c4a930c49ce2e98432)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index 320b59a..97bada4 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -569,6 +569,7 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
+ }
+
+ input_unregister_device(input);
++ kfree(ddata);
+
+ return 0;
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0230-Input-gpio_keys-add-support-for-device-tree-platform.patch b/patches.armadillo800eva/0230-Input-gpio_keys-add-support-for-device-tree-platform.patch
new file mode 100644
index 00000000000000..9fb38c91844437
--- /dev/null
+++ b/patches.armadillo800eva/0230-Input-gpio_keys-add-support-for-device-tree-platform.patch
@@ -0,0 +1,305 @@
+From 021bf10e7177aa806915d634054101dd9e60d7fd Mon Sep 17 00:00:00 2001
+From: David Jander <david@protonic.nl>
+Date: Sat, 9 Jul 2011 12:41:46 -0700
+Subject: Input: gpio_keys - add support for device-tree platform data
+
+This patch enables fetching configuration data, which is normally provided
+via platform_data, from the device-tree instead.
+
+If the device is configured from device-tree data, the platform_data struct
+is not used, and button data needs to be allocated dynamically. Big part of
+this patch deals with confining pdata usage to the probe function, to make
+this possible.
+
+Signed-off-by: David Jander <david@protonic.nl>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit fd05d08920b54d189aa247c5c5701a08e539ed0b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ .../devicetree/bindings/gpio/gpio_keys.txt | 36 +++++
+ drivers/input/keyboard/gpio_keys.c | 148 +++++++++++++++++---
+ 2 files changed, 168 insertions(+), 16 deletions(-)
+ create mode 100644 Documentation/devicetree/bindings/gpio/gpio_keys.txt
+
+diff --git a/Documentation/devicetree/bindings/gpio/gpio_keys.txt b/Documentation/devicetree/bindings/gpio/gpio_keys.txt
+new file mode 100644
+index 0000000..7190c99
+--- /dev/null
++++ b/Documentation/devicetree/bindings/gpio/gpio_keys.txt
+@@ -0,0 +1,36 @@
++Device-Tree bindings for input/gpio_keys.c keyboard driver
++
++Required properties:
++ - compatible = "gpio-keys";
++
++Optional properties:
++ - autorepeat: Boolean, Enable auto repeat feature of Linux input
++ subsystem.
++
++Each button (key) is represented as a sub-node of "gpio-keys":
++Subnode properties:
++
++ - gpios: OF devcie-tree gpio specificatin.
++ - label: Descriptive name of the key.
++ - linux,code: Keycode to emit.
++
++Optional subnode-properties:
++ - linux,input-type: Specify event type this button/key generates.
++ If not specified defaults to <1> == EV_KEY.
++ - debounce-interval: Debouncing interval time in milliseconds.
++ If not specified defaults to 5.
++ - gpio-key,wakeup: Boolean, button can wake-up the system.
++
++Example nodes:
++
++ gpio_keys {
++ compatible = "gpio-keys";
++ #address-cells = <1>;
++ #size-cells = <0>;
++ autorepeat;
++ button@21 {
++ label = "GPIO Key UP";
++ linux,code = <103>;
++ gpios = <&gpio1 0 1>;
++ };
++ ...
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index 97bada4..ad11e86 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -2,6 +2,7 @@
+ * Driver for keys on GPIO lines capable of generating interrupts.
+ *
+ * Copyright 2005 Phil Blundell
++ * Copyright 2010, 2011 David Jander <david@protonic.nl>
+ *
+ * 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
+@@ -25,6 +26,8 @@
+ #include <linux/gpio_keys.h>
+ #include <linux/workqueue.h>
+ #include <linux/gpio.h>
++#include <linux/of_platform.h>
++#include <linux/of_gpio.h>
+
+ struct gpio_button_data {
+ struct gpio_keys_button *button;
+@@ -445,15 +448,120 @@ static void gpio_keys_close(struct input_dev *input)
+ ddata->disable(input->dev.parent);
+ }
+
++/*
++ * Handlers for alternative sources of platform_data
++ */
++#ifdef CONFIG_OF
++/*
++ * Translate OpenFirmware node properties into platform_data
++ */
++static int gpio_keys_get_devtree_pdata(struct device *dev,
++ struct gpio_keys_platform_data *pdata)
++{
++ struct device_node *node, *pp;
++ int i;
++ struct gpio_keys_button *buttons;
++ const u32 *reg;
++ int len;
++
++ node = dev->of_node;
++ if (node == NULL)
++ return -ENODEV;
++
++ memset(pdata, 0, sizeof *pdata);
++
++ pdata->rep = !!of_get_property(node, "autorepeat", &len);
++
++ /* First count the subnodes */
++ pdata->nbuttons = 0;
++ pp = NULL;
++ while ((pp = of_get_next_child(node, pp)))
++ pdata->nbuttons++;
++
++ if (pdata->nbuttons == 0)
++ return -ENODEV;
++
++ buttons = kzalloc(pdata->nbuttons * (sizeof *buttons), GFP_KERNEL);
++ if (!buttons)
++ return -ENODEV;
++
++ pp = NULL;
++ i = 0;
++ while ((pp = of_get_next_child(node, pp))) {
++ enum of_gpio_flags flags;
++
++ if (!of_find_property(pp, "gpios", NULL)) {
++ pdata->nbuttons--;
++ dev_warn(dev, "Found button without gpios\n");
++ continue;
++ }
++ buttons[i].gpio = of_get_gpio_flags(pp, 0, &flags);
++ buttons[i].active_low = flags & OF_GPIO_ACTIVE_LOW;
++
++ reg = of_get_property(pp, "linux,code", &len);
++ if (!reg) {
++ dev_err(dev, "Button without keycode: 0x%x\n", buttons[i].gpio);
++ goto out_fail;
++ }
++ buttons[i].code = be32_to_cpup(reg);
++
++ buttons[i].desc = of_get_property(pp, "label", &len);
++
++ reg = of_get_property(pp, "linux,input-type", &len);
++ buttons[i].type = reg ? be32_to_cpup(reg) : EV_KEY;
++
++ buttons[i].wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL);
++
++ reg = of_get_property(pp, "debounce-interval", &len);
++ buttons[i].debounce_interval = reg ? be32_to_cpup(reg) : 5;
++
++ i++;
++ }
++
++ pdata->buttons = buttons;
++
++ return 0;
++
++out_fail:
++ kfree(buttons);
++ return -ENODEV;
++}
++
++static struct of_device_id gpio_keys_of_match[] = {
++ { .compatible = "gpio-keys", },
++ { },
++};
++MODULE_DEVICE_TABLE(of, gpio_keys_of_match);
++
++#else
++
++static int gpio_keys_get_devtree_pdata(struct device *dev,
++ struct gpio_keys_platform_data *altp)
++{
++ return -ENODEV;
++}
++
++#define gpio_keys_of_match NULL
++
++#endif
++
+ static int __devinit gpio_keys_probe(struct platform_device *pdev)
+ {
+ struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
+ struct gpio_keys_drvdata *ddata;
+ struct device *dev = &pdev->dev;
++ struct gpio_keys_platform_data alt_pdata;
+ struct input_dev *input;
+ int i, error;
+ int wakeup = 0;
+
++ if (!pdata) {
++ error = gpio_keys_get_devtree_pdata(dev, &alt_pdata);
++ if (error)
++ return error;
++ pdata = &alt_pdata;
++ }
++
+ ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
+ pdata->nbuttons * sizeof(struct gpio_button_data),
+ GFP_KERNEL);
+@@ -544,13 +652,15 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
+ fail1:
+ input_free_device(input);
+ kfree(ddata);
++ /* If we have no platform_data, we allocated buttons dynamically. */
++ if (!pdev->dev.platform_data)
++ kfree(pdata->buttons);
+
+ return error;
+ }
+
+ static int __devexit gpio_keys_remove(struct platform_device *pdev)
+ {
+- struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
+ struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);
+ struct input_dev *input = ddata->input;
+ int i;
+@@ -559,32 +669,39 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
+
+ device_init_wakeup(&pdev->dev, 0);
+
+- for (i = 0; i < pdata->nbuttons; i++) {
+- int irq = gpio_to_irq(pdata->buttons[i].gpio);
++ for (i = 0; i < ddata->n_buttons; i++) {
++ int irq = gpio_to_irq(ddata->data[i].button->gpio);
+ free_irq(irq, &ddata->data[i]);
+ if (ddata->data[i].timer_debounce)
+ del_timer_sync(&ddata->data[i].timer);
+ cancel_work_sync(&ddata->data[i].work);
+- gpio_free(pdata->buttons[i].gpio);
++ gpio_free(ddata->data[i].button->gpio);
+ }
+
+ input_unregister_device(input);
++
++ /*
++ * If we had no platform_data, we allocated buttons dynamically, and
++ * must free them here. ddata->data[0].button is the pointer to the
++ * beginning of the allocated array.
++ */
++ if (!pdev->dev.platform_data)
++ kfree(ddata->data[0].button);
++
+ kfree(ddata);
+
+ return 0;
+ }
+
+-
+ #ifdef CONFIG_PM
+ static int gpio_keys_suspend(struct device *dev)
+ {
+- struct platform_device *pdev = to_platform_device(dev);
+- struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
++ struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);
+ int i;
+
+- if (device_may_wakeup(&pdev->dev)) {
+- for (i = 0; i < pdata->nbuttons; i++) {
+- struct gpio_keys_button *button = &pdata->buttons[i];
++ if (device_may_wakeup(dev)) {
++ for (i = 0; i < ddata->n_buttons; i++) {
++ struct gpio_keys_button *button = ddata->data[i].button;
+ if (button->wakeup) {
+ int irq = gpio_to_irq(button->gpio);
+ enable_irq_wake(irq);
+@@ -597,15 +714,13 @@ static int gpio_keys_suspend(struct device *dev)
+
+ static int gpio_keys_resume(struct device *dev)
+ {
+- struct platform_device *pdev = to_platform_device(dev);
+- struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev);
+- struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
++ struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);
+ int i;
+
+- for (i = 0; i < pdata->nbuttons; i++) {
++ for (i = 0; i < ddata->n_buttons; i++) {
+
+- struct gpio_keys_button *button = &pdata->buttons[i];
+- if (button->wakeup && device_may_wakeup(&pdev->dev)) {
++ struct gpio_keys_button *button = ddata->data[i].button;
++ if (button->wakeup && device_may_wakeup(dev)) {
+ int irq = gpio_to_irq(button->gpio);
+ disable_irq_wake(irq);
+ }
+@@ -632,6 +747,7 @@ static struct platform_driver gpio_keys_device_driver = {
+ #ifdef CONFIG_PM
+ .pm = &gpio_keys_pm_ops,
+ #endif
++ .of_match_table = gpio_keys_of_match,
+ }
+ };
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0231-Input-gpio_keys-switch-to-using-SIMPLE_DEV_PM_OPS.patch b/patches.armadillo800eva/0231-Input-gpio_keys-switch-to-using-SIMPLE_DEV_PM_OPS.patch
new file mode 100644
index 00000000000000..bc221e93bb29ce
--- /dev/null
+++ b/patches.armadillo800eva/0231-Input-gpio_keys-switch-to-using-SIMPLE_DEV_PM_OPS.patch
@@ -0,0 +1,56 @@
+From a66ecd7dbf6e5f44d65e7dbaef8362621fa61084 Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Sat, 9 Jul 2011 12:41:46 -0700
+Subject: Input: gpio_keys - switch to using SIMPLE_DEV_PM_OPS
+
+This reduces amount #ifdeds in the code.
+
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit bdda82162837a20e591ac01b306dc8f052270510)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 11 +++--------
+ 1 file changed, 3 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index ad11e86..ce281d1 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -693,7 +693,7 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
+ return 0;
+ }
+
+-#ifdef CONFIG_PM
++#ifdef CONFIG_PM_SLEEP
+ static int gpio_keys_suspend(struct device *dev)
+ {
+ struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);
+@@ -731,22 +731,17 @@ static int gpio_keys_resume(struct device *dev)
+
+ return 0;
+ }
+-
+-static const struct dev_pm_ops gpio_keys_pm_ops = {
+- .suspend = gpio_keys_suspend,
+- .resume = gpio_keys_resume,
+-};
+ #endif
+
++static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume);
++
+ static struct platform_driver gpio_keys_device_driver = {
+ .probe = gpio_keys_probe,
+ .remove = __devexit_p(gpio_keys_remove),
+ .driver = {
+ .name = "gpio-keys",
+ .owner = THIS_MODULE,
+-#ifdef CONFIG_PM
+ .pm = &gpio_keys_pm_ops,
+-#endif
+ .of_match_table = gpio_keys_of_match,
+ }
+ };
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0232-Input-gpio_keys-return-proper-error-code-if-memory-a.patch b/patches.armadillo800eva/0232-Input-gpio_keys-return-proper-error-code-if-memory-a.patch
new file mode 100644
index 00000000000000..c823f8bd68d538
--- /dev/null
+++ b/patches.armadillo800eva/0232-Input-gpio_keys-return-proper-error-code-if-memory-a.patch
@@ -0,0 +1,33 @@
+From 66b7ed0e60fecd1c328be3c0de453e18d9dc3993 Mon Sep 17 00:00:00 2001
+From: Tobias Klauser <tklauser@distanz.ch>
+Date: Sat, 30 Jul 2011 12:08:10 -0700
+Subject: Input: gpio_keys - return proper error code if memory allocation
+ fails
+
+Return -ENOMEM if kzalloc fails in gpio_keys_get_devtree_pdata().
+
+Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit 1f4bb066433322f6f189b084ceebdfb4add77292)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index ce281d1..67df91a 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -483,7 +483,7 @@ static int gpio_keys_get_devtree_pdata(struct device *dev,
+
+ buttons = kzalloc(pdata->nbuttons * (sizeof *buttons), GFP_KERNEL);
+ if (!buttons)
+- return -ENODEV;
++ return -ENOMEM;
+
+ pp = NULL;
+ i = 0;
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0233-Input-gpio_keys-fix-two-typos-in-devicetree-document.patch b/patches.armadillo800eva/0233-Input-gpio_keys-fix-two-typos-in-devicetree-document.patch
new file mode 100644
index 00000000000000..afff4cdaa86865
--- /dev/null
+++ b/patches.armadillo800eva/0233-Input-gpio_keys-fix-two-typos-in-devicetree-document.patch
@@ -0,0 +1,30 @@
+From fa3c3b98a1c54fff047c6fc0110a5309623cc051 Mon Sep 17 00:00:00 2001
+From: Tobias Klauser <tklauser@distanz.ch>
+Date: Tue, 2 Aug 2011 15:40:22 -0700
+Subject: Input: gpio_keys - fix two typos in devicetree documentation
+
+Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit 0a7a8fff7b8a3bc2d3528af07c9c88083250303d)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ Documentation/devicetree/bindings/gpio/gpio_keys.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Documentation/devicetree/bindings/gpio/gpio_keys.txt b/Documentation/devicetree/bindings/gpio/gpio_keys.txt
+index 7190c99..5c2c021 100644
+--- a/Documentation/devicetree/bindings/gpio/gpio_keys.txt
++++ b/Documentation/devicetree/bindings/gpio/gpio_keys.txt
+@@ -10,7 +10,7 @@ Optional properties:
+ Each button (key) is represented as a sub-node of "gpio-keys":
+ Subnode properties:
+
+- - gpios: OF devcie-tree gpio specificatin.
++ - gpios: OF device-tree gpio specification.
+ - label: Descriptive name of the key.
+ - linux,code: Keycode to emit.
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0234-Input-gpio_keys-use-of_property_read_u32.patch b/patches.armadillo800eva/0234-Input-gpio_keys-use-of_property_read_u32.patch
new file mode 100644
index 00000000000000..1a9637b7eede82
--- /dev/null
+++ b/patches.armadillo800eva/0234-Input-gpio_keys-use-of_property_read_u32.patch
@@ -0,0 +1,78 @@
+From c66be10095b0ce9d065cd49b3344e884c0b5fd22 Mon Sep 17 00:00:00 2001
+From: Tobias Klauser <tklauser@distanz.ch>
+Date: Fri, 9 Sep 2011 11:09:50 -0700
+Subject: Input: gpio_keys - use of_property_read_u32()
+
+Use the of_property_read_u32() helper function to retrieve u32 values
+from the device tree. Also do not pass the len parameter to
+of_get_property if it isn't checked afterwards.
+
+Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit cca84699a079a91b0a0cb4f2da8548e56859376a)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 24 +++++++++++++-----------
+ 1 file changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index 67df91a..ed1ed46 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -461,8 +461,7 @@ static int gpio_keys_get_devtree_pdata(struct device *dev,
+ struct device_node *node, *pp;
+ int i;
+ struct gpio_keys_button *buttons;
+- const u32 *reg;
+- int len;
++ u32 reg;
+
+ node = dev->of_node;
+ if (node == NULL)
+@@ -470,7 +469,7 @@ static int gpio_keys_get_devtree_pdata(struct device *dev,
+
+ memset(pdata, 0, sizeof *pdata);
+
+- pdata->rep = !!of_get_property(node, "autorepeat", &len);
++ pdata->rep = !!of_get_property(node, "autorepeat", NULL);
+
+ /* First count the subnodes */
+ pdata->nbuttons = 0;
+@@ -498,22 +497,25 @@ static int gpio_keys_get_devtree_pdata(struct device *dev,
+ buttons[i].gpio = of_get_gpio_flags(pp, 0, &flags);
+ buttons[i].active_low = flags & OF_GPIO_ACTIVE_LOW;
+
+- reg = of_get_property(pp, "linux,code", &len);
+- if (!reg) {
++ if (of_property_read_u32(pp, "linux,code", &reg)) {
+ dev_err(dev, "Button without keycode: 0x%x\n", buttons[i].gpio);
+ goto out_fail;
+ }
+- buttons[i].code = be32_to_cpup(reg);
++ buttons[i].code = reg;
+
+- buttons[i].desc = of_get_property(pp, "label", &len);
++ buttons[i].desc = of_get_property(pp, "label", NULL);
+
+- reg = of_get_property(pp, "linux,input-type", &len);
+- buttons[i].type = reg ? be32_to_cpup(reg) : EV_KEY;
++ if (of_property_read_u32(pp, "linux,input-type", &reg) == 0)
++ buttons[i].type = reg;
++ else
++ buttons[i].type = EV_KEY;
+
+ buttons[i].wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL);
+
+- reg = of_get_property(pp, "debounce-interval", &len);
+- buttons[i].debounce_interval = reg ? be32_to_cpup(reg) : 5;
++ if (of_property_read_u32(pp, "debounce-interval", &reg) == 0)
++ buttons[i].debounce_interval = reg;
++ else
++ buttons[i].debounce_interval = 5;
+
+ i++;
+ }
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0235-Input-gpio_keys-fix-struct-device-declared-inside-pa.patch b/patches.armadillo800eva/0235-Input-gpio_keys-fix-struct-device-declared-inside-pa.patch
new file mode 100644
index 00000000000000..8ae605895c7b0f
--- /dev/null
+++ b/patches.armadillo800eva/0235-Input-gpio_keys-fix-struct-device-declared-inside-pa.patch
@@ -0,0 +1,36 @@
+From 52b2cc635112808cfcc06713b5c9423858bc40a9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Heiko=20St=C3=BCbner?= <heiko@sntech.de>
+Date: Wed, 1 Feb 2012 09:12:24 -0800
+Subject: Input: gpio_keys - fix struct device declared inside parameter list
+
+A struct device parameter is used in the enable and disable callbacks to
+distinguish between different gpio_keys devices.
+
+Platforms that don't use these callbacks may not include struct device
+at all, as seen on arch/arm/mach-s3c2410/mach-n30.c
+
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit b18db3d91234c03ad080d317878c7c77672ba326)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ include/linux/gpio_keys.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
+index b5ca4b2..004ff33 100644
+--- a/include/linux/gpio_keys.h
++++ b/include/linux/gpio_keys.h
+@@ -1,6 +1,8 @@
+ #ifndef _GPIO_KEYS_H
+ #define _GPIO_KEYS_H
+
++struct device;
++
+ struct gpio_keys_button {
+ /* Configuration parameters */
+ unsigned int code; /* input event code (KEY_*, SW_*) */
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0236-Input-gpio_keys-constify-platform-data.patch b/patches.armadillo800eva/0236-Input-gpio_keys-constify-platform-data.patch
new file mode 100644
index 00000000000000..99ac7f582d73b5
--- /dev/null
+++ b/patches.armadillo800eva/0236-Input-gpio_keys-constify-platform-data.patch
@@ -0,0 +1,139 @@
+From 816b88a54fd13e92637012b7ead64a709c2faa64 Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Sun, 18 Mar 2012 23:36:29 -0700
+Subject: Input: gpio_keys - constify platform data
+
+The platform data should not be altered and therefore should be
+accessed through const pointers.
+
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit d9080921aa32c70a95476ce387e973787b892591)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 31 +++++++++++++++----------------
+ 1 file changed, 15 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index ed1ed46..19887fc 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -30,7 +30,7 @@
+ #include <linux/of_gpio.h>
+
+ struct gpio_button_data {
+- struct gpio_keys_button *button;
++ const struct gpio_keys_button *button;
+ struct input_dev *input;
+ struct timer_list timer;
+ struct work_struct work;
+@@ -322,7 +322,7 @@ static struct attribute_group gpio_keys_attr_group = {
+
+ static void gpio_keys_report_event(struct gpio_button_data *bdata)
+ {
+- struct gpio_keys_button *button = bdata->button;
++ const struct gpio_keys_button *button = bdata->button;
+ struct input_dev *input = bdata->input;
+ unsigned int type = button->type ?: EV_KEY;
+ int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;
+@@ -354,7 +354,7 @@ static void gpio_keys_timer(unsigned long _data)
+ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
+ {
+ struct gpio_button_data *bdata = dev_id;
+- struct gpio_keys_button *button = bdata->button;
++ const struct gpio_keys_button *button = bdata->button;
+
+ BUG_ON(irq != gpio_to_irq(button->gpio));
+
+@@ -368,8 +368,9 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
+ }
+
+ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
++ struct input_dev *input,
+ struct gpio_button_data *bdata,
+- struct gpio_keys_button *button)
++ const struct gpio_keys_button *button)
+ {
+ const char *desc = button->desc ? button->desc : "gpio_keys";
+ struct device *dev = &pdev->dev;
+@@ -378,6 +379,8 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
+
+ setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata);
+ INIT_WORK(&bdata->work, gpio_keys_work_func);
++ bdata->input = input;
++ bdata->button = button;
+
+ error = gpio_request(button->gpio, desc);
+ if (error < 0) {
+@@ -425,6 +428,7 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
+ goto fail3;
+ }
+
++ input_set_capability(input, button->type ?: EV_KEY, button->code);
+ return 0;
+
+ fail3:
+@@ -549,7 +553,7 @@ static int gpio_keys_get_devtree_pdata(struct device *dev,
+
+ static int __devinit gpio_keys_probe(struct platform_device *pdev)
+ {
+- struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
++ const struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
+ struct gpio_keys_drvdata *ddata;
+ struct device *dev = &pdev->dev;
+ struct gpio_keys_platform_data alt_pdata;
+@@ -599,21 +603,15 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
+ __set_bit(EV_REP, input->evbit);
+
+ for (i = 0; i < pdata->nbuttons; i++) {
+- struct gpio_keys_button *button = &pdata->buttons[i];
++ const struct gpio_keys_button *button = &pdata->buttons[i];
+ struct gpio_button_data *bdata = &ddata->data[i];
+- unsigned int type = button->type ?: EV_KEY;
+
+- bdata->input = input;
+- bdata->button = button;
+-
+- error = gpio_keys_setup_key(pdev, bdata, button);
++ error = gpio_keys_setup_key(pdev, input, bdata, button);
+ if (error)
+ goto fail2;
+
+ if (button->wakeup)
+ wakeup = 1;
+-
+- input_set_capability(input, type, button->code);
+ }
+
+ error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group);
+@@ -699,11 +697,12 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
+ static int gpio_keys_suspend(struct device *dev)
+ {
+ struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);
++ const struct gpio_keys_button *button;
+ int i;
+
+ if (device_may_wakeup(dev)) {
+ for (i = 0; i < ddata->n_buttons; i++) {
+- struct gpio_keys_button *button = ddata->data[i].button;
++ button = ddata->data[i].button;
+ if (button->wakeup) {
+ int irq = gpio_to_irq(button->gpio);
+ enable_irq_wake(irq);
+@@ -717,11 +716,11 @@ static int gpio_keys_suspend(struct device *dev)
+ static int gpio_keys_resume(struct device *dev)
+ {
+ struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);
++ const struct gpio_keys_button *button;
+ int i;
+
+ for (i = 0; i < ddata->n_buttons; i++) {
+-
+- struct gpio_keys_button *button = ddata->data[i].button;
++ button = ddata->data[i].button;
+ if (button->wakeup && device_may_wakeup(dev)) {
+ int irq = gpio_to_irq(button->gpio);
+ disable_irq_wake(irq);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0237-Input-revert-gpio_keys-switch-to-using-threaded-IRQs.patch b/patches.armadillo800eva/0237-Input-revert-gpio_keys-switch-to-using-threaded-IRQs.patch
new file mode 100644
index 00000000000000..7a611d36b3f254
--- /dev/null
+++ b/patches.armadillo800eva/0237-Input-revert-gpio_keys-switch-to-using-threaded-IRQs.patch
@@ -0,0 +1,33 @@
+From 6683b1b58dc6d1d688f870aafd83546174604a35 Mon Sep 17 00:00:00 2001
+From: David Jander <david@protonic.nl>
+Date: Sun, 18 Mar 2012 23:36:29 -0700
+Subject: Input: revert "gpio_keys - switch to using threaded IRQs"
+
+request_any_context_irq() should handle the case when using GPIO expanders
+that themselves use threaded IRQs, and so the premise of change
+7e2ecdf438bb479e2b4667fc16b1a84d6348da04 is incorrect.
+
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit 6709c9a5d8c53092cbe89128df4e0a549e93133b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index 19887fc..6f06758 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -421,7 +421,7 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
+ if (!button->can_disable)
+ irqflags |= IRQF_SHARED;
+
+- error = request_threaded_irq(irq, NULL, gpio_keys_isr, irqflags, desc, bdata);
++ error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata);
+ if (error < 0) {
+ dev_err(dev, "Unable to claim irq %d; error %d\n",
+ irq, error);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0238-Input-gpio_keys-consolidate-key-destructor-code.patch b/patches.armadillo800eva/0238-Input-gpio_keys-consolidate-key-destructor-code.patch
new file mode 100644
index 00000000000000..0d78205e5862e4
--- /dev/null
+++ b/patches.armadillo800eva/0238-Input-gpio_keys-consolidate-key-destructor-code.patch
@@ -0,0 +1,78 @@
+From 777e41f4fbca9b1118637d80835af61d3dfa2d74 Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Sun, 18 Mar 2012 23:36:30 -0700
+Subject: Input: gpio_keys - consolidate key destructor code
+
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit a16ca23935afc0d72215b139720bd07df3162a9f)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 30 ++++++++++++++----------------
+ 1 file changed, 14 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index 6f06758..8f44f7b 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -195,7 +195,7 @@ static ssize_t gpio_keys_attr_show_helper(struct gpio_keys_drvdata *ddata,
+ * @type: button type (%EV_KEY, %EV_SW)
+ *
+ * This function parses stringified bitmap from @buf and disables/enables
+- * GPIO buttons accordinly. Returns 0 on success and negative error
++ * GPIO buttons accordingly. Returns 0 on success and negative error
+ * on failure.
+ */
+ static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata,
+@@ -551,6 +551,15 @@ static int gpio_keys_get_devtree_pdata(struct device *dev,
+
+ #endif
+
++static void gpio_remove_key(struct gpio_button_data *bdata)
++{
++ free_irq(gpio_to_irq(bdata->button->gpio), bdata);
++ if (bdata->timer_debounce)
++ del_timer_sync(&bdata->timer);
++ cancel_work_sync(&bdata->work);
++ gpio_free(bdata->button->gpio);
++}
++
+ static int __devinit gpio_keys_probe(struct platform_device *pdev)
+ {
+ const struct gpio_keys_platform_data *pdata = pdev->dev.platform_data;
+@@ -640,13 +649,8 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
+ fail3:
+ sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);
+ fail2:
+- while (--i >= 0) {
+- free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]);
+- if (ddata->data[i].timer_debounce)
+- del_timer_sync(&ddata->data[i].timer);
+- cancel_work_sync(&ddata->data[i].work);
+- gpio_free(pdata->buttons[i].gpio);
+- }
++ while (--i >= 0)
++ gpio_remove_key(&ddata->data[i]);
+
+ platform_set_drvdata(pdev, NULL);
+ fail1:
+@@ -669,14 +673,8 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
+
+ device_init_wakeup(&pdev->dev, 0);
+
+- for (i = 0; i < ddata->n_buttons; i++) {
+- int irq = gpio_to_irq(ddata->data[i].button->gpio);
+- free_irq(irq, &ddata->data[i]);
+- if (ddata->data[i].timer_debounce)
+- del_timer_sync(&ddata->data[i].timer);
+- cancel_work_sync(&ddata->data[i].work);
+- gpio_free(ddata->data[i].button->gpio);
+- }
++ for (i = 0; i < ddata->n_buttons; i++)
++ gpio_remove_key(&ddata->data[i]);
+
+ input_unregister_device(input);
+
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0239-Input-gpio_keys-add-support-for-interrupt-only-keys.patch b/patches.armadillo800eva/0239-Input-gpio_keys-add-support-for-interrupt-only-keys.patch
new file mode 100644
index 00000000000000..ea4c66c3a4b3c8
--- /dev/null
+++ b/patches.armadillo800eva/0239-Input-gpio_keys-add-support-for-interrupt-only-keys.patch
@@ -0,0 +1,395 @@
+From 2c51d9b9e4804ea4d2b37d18910a7f1e7df2642f Mon Sep 17 00:00:00 2001
+From: Laxman Dewangan <ldewangan@nvidia.com>
+Date: Mon, 19 Mar 2012 17:54:31 -0700
+Subject: Input: gpio_keys - add support for interrupt only keys
+
+Some of buttons, like power-on key or onkey, may only generate interrupts
+when pressed and not actually be mapped as gpio in the system. Allow
+setting gpio to invalid value and specify IRQ instead to support such
+keys. The debounce timer is used not to debounce but to ignore new IRQs
+coming while button is kept pressed.
+
+Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit d8ee4a1c90529ed06e1aa43d034986649f7b670b)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/gpio_keys.c | 214 +++++++++++++++++++++++++-----------
+ include/linux/gpio_keys.h | 3 +-
+ 2 files changed, 150 insertions(+), 67 deletions(-)
+
+diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
+index 8f44f7b..62bfce4 100644
+--- a/drivers/input/keyboard/gpio_keys.c
++++ b/drivers/input/keyboard/gpio_keys.c
+@@ -28,14 +28,18 @@
+ #include <linux/gpio.h>
+ #include <linux/of_platform.h>
+ #include <linux/of_gpio.h>
++#include <linux/spinlock.h>
+
+ struct gpio_button_data {
+ const struct gpio_keys_button *button;
+ struct input_dev *input;
+ struct timer_list timer;
+ struct work_struct work;
+- int timer_debounce; /* in msecs */
++ unsigned int timer_debounce; /* in msecs */
++ unsigned int irq;
++ spinlock_t lock;
+ bool disabled;
++ bool key_pressed;
+ };
+
+ struct gpio_keys_drvdata {
+@@ -114,7 +118,7 @@ static void gpio_keys_disable_button(struct gpio_button_data *bdata)
+ /*
+ * Disable IRQ and possible debouncing timer.
+ */
+- disable_irq(gpio_to_irq(bdata->button->gpio));
++ disable_irq(bdata->irq);
+ if (bdata->timer_debounce)
+ del_timer_sync(&bdata->timer);
+
+@@ -135,7 +139,7 @@ static void gpio_keys_disable_button(struct gpio_button_data *bdata)
+ static void gpio_keys_enable_button(struct gpio_button_data *bdata)
+ {
+ if (bdata->disabled) {
+- enable_irq(gpio_to_irq(bdata->button->gpio));
++ enable_irq(bdata->irq);
+ bdata->disabled = false;
+ }
+ }
+@@ -320,7 +324,7 @@ static struct attribute_group gpio_keys_attr_group = {
+ .attrs = gpio_keys_attrs,
+ };
+
+-static void gpio_keys_report_event(struct gpio_button_data *bdata)
++static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
+ {
+ const struct gpio_keys_button *button = bdata->button;
+ struct input_dev *input = bdata->input;
+@@ -336,27 +340,26 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata)
+ input_sync(input);
+ }
+
+-static void gpio_keys_work_func(struct work_struct *work)
++static void gpio_keys_gpio_work_func(struct work_struct *work)
+ {
+ struct gpio_button_data *bdata =
+ container_of(work, struct gpio_button_data, work);
+
+- gpio_keys_report_event(bdata);
++ gpio_keys_gpio_report_event(bdata);
+ }
+
+-static void gpio_keys_timer(unsigned long _data)
++static void gpio_keys_gpio_timer(unsigned long _data)
+ {
+- struct gpio_button_data *data = (struct gpio_button_data *)_data;
++ struct gpio_button_data *bdata = (struct gpio_button_data *)_data;
+
+- schedule_work(&data->work);
++ schedule_work(&bdata->work);
+ }
+
+-static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
++static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
+ {
+ struct gpio_button_data *bdata = dev_id;
+- const struct gpio_keys_button *button = bdata->button;
+
+- BUG_ON(irq != gpio_to_irq(button->gpio));
++ BUG_ON(irq != bdata->irq);
+
+ if (bdata->timer_debounce)
+ mod_timer(&bdata->timer,
+@@ -367,6 +370,53 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
+ return IRQ_HANDLED;
+ }
+
++static void gpio_keys_irq_timer(unsigned long _data)
++{
++ struct gpio_button_data *bdata = (struct gpio_button_data *)_data;
++ struct input_dev *input = bdata->input;
++ unsigned long flags;
++
++ spin_lock_irqsave(&bdata->lock, flags);
++ if (bdata->key_pressed) {
++ input_event(input, EV_KEY, bdata->button->code, 0);
++ input_sync(input);
++ bdata->key_pressed = false;
++ }
++ spin_unlock_irqrestore(&bdata->lock, flags);
++}
++
++static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
++{
++ struct gpio_button_data *bdata = dev_id;
++ const struct gpio_keys_button *button = bdata->button;
++ struct input_dev *input = bdata->input;
++ unsigned long flags;
++
++ BUG_ON(irq != bdata->irq);
++
++ spin_lock_irqsave(&bdata->lock, flags);
++
++ if (!bdata->key_pressed) {
++ input_event(input, EV_KEY, button->code, 1);
++ input_sync(input);
++
++ if (!bdata->timer_debounce) {
++ input_event(input, EV_KEY, button->code, 0);
++ input_sync(input);
++ goto out;
++ }
++
++ bdata->key_pressed = true;
++ }
++
++ if (bdata->timer_debounce)
++ mod_timer(&bdata->timer,
++ jiffies + msecs_to_jiffies(bdata->timer_debounce));
++out:
++ spin_unlock_irqrestore(&bdata->lock, flags);
++ return IRQ_HANDLED;
++}
++
+ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
+ struct input_dev *input,
+ struct gpio_button_data *bdata,
+@@ -374,46 +424,79 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
+ {
+ const char *desc = button->desc ? button->desc : "gpio_keys";
+ struct device *dev = &pdev->dev;
++ irq_handler_t isr;
+ unsigned long irqflags;
+ int irq, error;
+
+- setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata);
+- INIT_WORK(&bdata->work, gpio_keys_work_func);
+ bdata->input = input;
+ bdata->button = button;
++ spin_lock_init(&bdata->lock);
+
+- error = gpio_request(button->gpio, desc);
+- if (error < 0) {
+- dev_err(dev, "failed to request GPIO %d, error %d\n",
+- button->gpio, error);
+- goto fail2;
+- }
++ if (gpio_is_valid(button->gpio)) {
+
+- error = gpio_direction_input(button->gpio);
+- if (error < 0) {
+- dev_err(dev, "failed to configure"
+- " direction for GPIO %d, error %d\n",
+- button->gpio, error);
+- goto fail3;
+- }
++ error = gpio_request(button->gpio, desc);
++ if (error < 0) {
++ dev_err(dev, "Failed to request GPIO %d, error %d\n",
++ button->gpio, error);
++ return error;
++ }
+
+- if (button->debounce_interval) {
+- error = gpio_set_debounce(button->gpio,
+- button->debounce_interval * 1000);
+- /* use timer if gpiolib doesn't provide debounce */
+- if (error < 0)
+- bdata->timer_debounce = button->debounce_interval;
+- }
++ error = gpio_direction_input(button->gpio);
++ if (error < 0) {
++ dev_err(dev,
++ "Failed to configure direction for GPIO %d, error %d\n",
++ button->gpio, error);
++ goto fail;
++ }
+
+- irq = gpio_to_irq(button->gpio);
+- if (irq < 0) {
+- error = irq;
+- dev_err(dev, "Unable to get irq number for GPIO %d, error %d\n",
+- button->gpio, error);
+- goto fail3;
++ if (button->debounce_interval) {
++ error = gpio_set_debounce(button->gpio,
++ button->debounce_interval * 1000);
++ /* use timer if gpiolib doesn't provide debounce */
++ if (error < 0)
++ bdata->timer_debounce =
++ button->debounce_interval;
++ }
++
++ irq = gpio_to_irq(button->gpio);
++ if (irq < 0) {
++ error = irq;
++ dev_err(dev,
++ "Unable to get irq number for GPIO %d, error %d\n",
++ button->gpio, error);
++ goto fail;
++ }
++ bdata->irq = irq;
++
++ INIT_WORK(&bdata->work, gpio_keys_gpio_work_func);
++ setup_timer(&bdata->timer,
++ gpio_keys_gpio_timer, (unsigned long)bdata);
++
++ isr = gpio_keys_gpio_isr;
++ irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
++
++ } else {
++ if (!button->irq) {
++ dev_err(dev, "No IRQ specified\n");
++ return -EINVAL;
++ }
++ bdata->irq = button->irq;
++
++ if (button->type && button->type != EV_KEY) {
++ dev_err(dev, "Only EV_KEY allowed for IRQ buttons.\n");
++ return -EINVAL;
++ }
++
++ bdata->timer_debounce = button->debounce_interval;
++ setup_timer(&bdata->timer,
++ gpio_keys_irq_timer, (unsigned long)bdata);
++
++ isr = gpio_keys_irq_isr;
++ irqflags = 0;
+ }
+
+- irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
++ input_set_capability(input, button->type ?: EV_KEY, button->code);
++
+ /*
+ * If platform has specified that the button can be disabled,
+ * we don't want it to share the interrupt line.
+@@ -421,19 +504,19 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
+ if (!button->can_disable)
+ irqflags |= IRQF_SHARED;
+
+- error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata);
++ error = request_any_context_irq(bdata->irq, isr, irqflags, desc, bdata);
+ if (error < 0) {
+ dev_err(dev, "Unable to claim irq %d; error %d\n",
+- irq, error);
+- goto fail3;
++ bdata->irq, error);
++ goto fail;
+ }
+
+- input_set_capability(input, button->type ?: EV_KEY, button->code);
+ return 0;
+
+-fail3:
+- gpio_free(button->gpio);
+-fail2:
++fail:
++ if (gpio_is_valid(button->gpio))
++ gpio_free(button->gpio);
++
+ return error;
+ }
+
+@@ -553,11 +636,12 @@ static int gpio_keys_get_devtree_pdata(struct device *dev,
+
+ static void gpio_remove_key(struct gpio_button_data *bdata)
+ {
+- free_irq(gpio_to_irq(bdata->button->gpio), bdata);
++ free_irq(bdata->irq, bdata);
+ if (bdata->timer_debounce)
+ del_timer_sync(&bdata->timer);
+ cancel_work_sync(&bdata->work);
+- gpio_free(bdata->button->gpio);
++ if (gpio_is_valid(bdata->button->gpio))
++ gpio_free(bdata->button->gpio);
+ }
+
+ static int __devinit gpio_keys_probe(struct platform_device *pdev)
+@@ -637,9 +721,12 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
+ goto fail3;
+ }
+
+- /* get current state of buttons */
+- for (i = 0; i < pdata->nbuttons; i++)
+- gpio_keys_report_event(&ddata->data[i]);
++ /* get current state of buttons that are connected to GPIOs */
++ for (i = 0; i < pdata->nbuttons; i++) {
++ struct gpio_button_data *bdata = &ddata->data[i];
++ if (gpio_is_valid(bdata->button->gpio))
++ gpio_keys_gpio_report_event(bdata);
++ }
+ input_sync(input);
+
+ device_init_wakeup(&pdev->dev, wakeup);
+@@ -695,16 +782,13 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev)
+ static int gpio_keys_suspend(struct device *dev)
+ {
+ struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);
+- const struct gpio_keys_button *button;
+ int i;
+
+ if (device_may_wakeup(dev)) {
+ for (i = 0; i < ddata->n_buttons; i++) {
+- button = ddata->data[i].button;
+- if (button->wakeup) {
+- int irq = gpio_to_irq(button->gpio);
+- enable_irq_wake(irq);
+- }
++ struct gpio_button_data *bdata = &ddata->data[i];
++ if (bdata->button->wakeup)
++ enable_irq_wake(bdata->irq);
+ }
+ }
+
+@@ -714,17 +798,15 @@ static int gpio_keys_suspend(struct device *dev)
+ static int gpio_keys_resume(struct device *dev)
+ {
+ struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);
+- const struct gpio_keys_button *button;
+ int i;
+
+ for (i = 0; i < ddata->n_buttons; i++) {
+- button = ddata->data[i].button;
+- if (button->wakeup && device_may_wakeup(dev)) {
+- int irq = gpio_to_irq(button->gpio);
+- disable_irq_wake(irq);
+- }
++ struct gpio_button_data *bdata = &ddata->data[i];
++ if (bdata->button->wakeup && device_may_wakeup(dev))
++ disable_irq_wake(bdata->irq);
+
+- gpio_keys_report_event(&ddata->data[i]);
++ if (gpio_is_valid(bdata->button->gpio))
++ gpio_keys_gpio_report_event(bdata);
+ }
+ input_sync(ddata->input);
+
+diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
+index 004ff33..a7e977f 100644
+--- a/include/linux/gpio_keys.h
++++ b/include/linux/gpio_keys.h
+@@ -6,7 +6,7 @@ struct device;
+ struct gpio_keys_button {
+ /* Configuration parameters */
+ unsigned int code; /* input event code (KEY_*, SW_*) */
+- int gpio;
++ int gpio; /* -1 if this key does not support gpio */
+ int active_low;
+ const char *desc;
+ unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */
+@@ -14,6 +14,7 @@ struct gpio_keys_button {
+ int debounce_interval; /* debounce ticks interval in msecs */
+ bool can_disable;
+ int value; /* axis value for EV_ABS */
++ unsigned int irq; /* Irq number in case of interrupt keys */
+ };
+
+ struct gpio_keys_platform_data {
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0240-Input-sh_keysc-fix-compile-warning.patch b/patches.armadillo800eva/0240-Input-sh_keysc-fix-compile-warning.patch
new file mode 100644
index 00000000000000..ed58a9c9c8707b
--- /dev/null
+++ b/patches.armadillo800eva/0240-Input-sh_keysc-fix-compile-warning.patch
@@ -0,0 +1,36 @@
+From 27c816af3d05cf011b9aeb03dca0023cc918b896 Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Mon, 4 Jul 2011 06:34:48 -0700
+Subject: Input: sh_keysc - fix compile warning
+
+The "#if" above should really be an "#ifdef" to avoid this warning:
+
+ CC drivers/input/keyboard/sh_keysc.o
+drivers/input/keyboard/sh_keysc.c:294:5: warning: "CONFIG_PM_SLEEP" is
+not defined
+
+Reported-by: Magnus Damm <magnus.damm@gmail.com>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit cca8edfd2ec2a34d9f50f593bc753bb11e1bc1f5)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/sh_keysc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c
+index 6876700..934aeb583 100644
+--- a/drivers/input/keyboard/sh_keysc.c
++++ b/drivers/input/keyboard/sh_keysc.c
+@@ -291,7 +291,7 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev)
+ return 0;
+ }
+
+-#if CONFIG_PM_SLEEP
++#ifdef CONFIG_PM_SLEEP
+ static int sh_keysc_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0241-Input-keyboard-use-macro-module_platform_driver.patch b/patches.armadillo800eva/0241-Input-keyboard-use-macro-module_platform_driver.patch
new file mode 100644
index 00000000000000..d9ba4910dd65f2
--- /dev/null
+++ b/patches.armadillo800eva/0241-Input-keyboard-use-macro-module_platform_driver.patch
@@ -0,0 +1,73 @@
+From 132c9aae9ea700652f3542eb322a3df52d720df9 Mon Sep 17 00:00:00 2001
+From: JJ Ding <dgdunix@gmail.com>
+Date: Tue, 29 Nov 2011 11:08:39 -0800
+Subject: Input: keyboard - use macro module_platform_driver()
+
+Commit 940ab88962bc1aff3273a8356d64577a6e386736 introduced a new macro to
+save some platform_driver boilerplate code. Use it.
+
+Signed-off-by: JJ Ding <dgdunix@gmail.com>
+Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
+(cherry picked from commit 5146c84f87c8aa3d115cea0d77ed3553df426752)
+
+Conflicts:
+
+ drivers/input/keyboard/adp5520-keys.c
+ drivers/input/keyboard/amikbd.c
+ drivers/input/keyboard/bf54x-keys.c
+ drivers/input/keyboard/davinci_keyscan.c
+ drivers/input/keyboard/ep93xx_keypad.c
+ drivers/input/keyboard/gpio_keys_polled.c
+ drivers/input/keyboard/imx_keypad.c
+ drivers/input/keyboard/jornada680_kbd.c
+ drivers/input/keyboard/jornada720_kbd.c
+ drivers/input/keyboard/matrix_keypad.c
+ drivers/input/keyboard/nomadik-ske-keypad.c
+ drivers/input/keyboard/omap-keypad.c
+ drivers/input/keyboard/omap4-keypad.c
+ drivers/input/keyboard/opencores-kbd.c
+ drivers/input/keyboard/pmic8xxx-keypad.c
+ drivers/input/keyboard/pxa27x_keypad.c
+ drivers/input/keyboard/pxa930_rotary.c
+ drivers/input/keyboard/samsung-keypad.c
+ drivers/input/keyboard/spear-keyboard.c
+ drivers/input/keyboard/stmpe-keypad.c
+ drivers/input/keyboard/tc3589x-keypad.c
+ drivers/input/keyboard/tegra-kbc.c
+ drivers/input/keyboard/tnetv107x-keypad.c
+ drivers/input/keyboard/twl4030_keypad.c
+ drivers/input/keyboard/w90p910_keypad.c
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ drivers/input/keyboard/sh_keysc.c | 14 +-------------
+ 1 file changed, 1 insertion(+), 13 deletions(-)
+
+diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c
+index 934aeb583..da54ad5 100644
+--- a/drivers/input/keyboard/sh_keysc.c
++++ b/drivers/input/keyboard/sh_keysc.c
+@@ -337,19 +337,7 @@ static struct platform_driver sh_keysc_device_driver = {
+ .pm = &sh_keysc_dev_pm_ops,
+ }
+ };
+-
+-static int __init sh_keysc_init(void)
+-{
+- return platform_driver_register(&sh_keysc_device_driver);
+-}
+-
+-static void __exit sh_keysc_exit(void)
+-{
+- platform_driver_unregister(&sh_keysc_device_driver);
+-}
+-
+-module_init(sh_keysc_init);
+-module_exit(sh_keysc_exit);
++module_platform_driver(sh_keysc_device_driver);
+
+ MODULE_AUTHOR("Magnus Damm");
+ MODULE_DESCRIPTION("SuperH KEYSC Keypad Driver");
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0242-Update-Nook-Color-machine-3284-to-common-Encore-name.patch b/patches.armadillo800eva/0242-Update-Nook-Color-machine-3284-to-common-Encore-name.patch
new file mode 100644
index 00000000000000..db031b262f86fa
--- /dev/null
+++ b/patches.armadillo800eva/0242-Update-Nook-Color-machine-3284-to-common-Encore-name.patch
@@ -0,0 +1,34 @@
+From 5c0e066e0529e0045b01c48fbcb12599fc0d2290 Mon Sep 17 00:00:00 2001
+From: Oleg Drokin <green@linuxhacker.ru>
+Date: Tue, 9 Aug 2011 03:10:22 -0700
+Subject: Update Nook Color machine 3284 to common Encore name
+
+Machine database already updated:
+http://www.arm.linux.org.uk/developer/machines/list.php?id=3284
+
+Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
+Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+(cherry picked from commit 1d08fd9f6a7f2541a7b28a21fc638c4640d9cabb)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/tools/mach-types | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
+index 3b3776d..fff68d0 100644
+--- a/arch/arm/tools/mach-types
++++ b/arch/arm/tools/mach-types
+@@ -910,7 +910,7 @@ omapl138_case_a3 MACH_OMAPL138_CASE_A3 OMAPL138_CASE_A3 3280
+ uemd MACH_UEMD UEMD 3281
+ ccwmx51mut MACH_CCWMX51MUT CCWMX51MUT 3282
+ rockhopper MACH_ROCKHOPPER ROCKHOPPER 3283
+-nookcolor MACH_NOOKCOLOR NOOKCOLOR 3284
++encore MACH_ENCORE ENCORE 3284
+ hkdkc100 MACH_HKDKC100 HKDKC100 3285
+ ts42xx MACH_TS42XX TS42XX 3286
+ aebl MACH_AEBL AEBL 3287
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0243-ARM-7051-1-cpuimx-boards-fix-mach-types-errors.patch b/patches.armadillo800eva/0243-ARM-7051-1-cpuimx-boards-fix-mach-types-errors.patch
new file mode 100644
index 00000000000000..964174457c9ef3
--- /dev/null
+++ b/patches.armadillo800eva/0243-ARM-7051-1-cpuimx-boards-fix-mach-types-errors.patch
@@ -0,0 +1,90 @@
+From 6aa24bab1055ca1b44a4b68816796c6b5f641a06 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Eric=20B=C3=A9nard?= <eric@eukrea.com>
+Date: Mon, 22 Aug 2011 15:41:46 +0100
+Subject: ARM: 7051/1: cpuimx* boards: fix mach-types errors
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+I made some changes to the entry in the ARM Machine Registry after
+submission which was the wrong thing to do.
+This patch should help to fix this error.
+
+Signed-off-by: Eric Bénard <eric@eukrea.com>
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+(cherry picked from commit 0d6cfa3a75f5cde5b3ca0dde748fd22625b4f34c)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-imx/mach-cpuimx27.c | 2 +-
+ arch/arm/mach-imx/mach-cpuimx35.c | 2 +-
+ arch/arm/mach-imx/mach-eukrea_cpuimx25.c | 2 +-
+ arch/arm/tools/mach-types | 6 +++---
+ 4 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
+index 46a2e41..8183755 100644
+--- a/arch/arm/mach-imx/mach-cpuimx27.c
++++ b/arch/arm/mach-imx/mach-cpuimx27.c
+@@ -308,7 +308,7 @@ static struct sys_timer eukrea_cpuimx27_timer = {
+ .init = eukrea_cpuimx27_timer_init,
+ };
+
+-MACHINE_START(CPUIMX27, "EUKREA CPUIMX27")
++MACHINE_START(EUKREA_CPUIMX27, "EUKREA CPUIMX27")
+ .boot_params = MX27_PHYS_OFFSET + 0x100,
+ .map_io = mx27_map_io,
+ .init_early = imx27_init_early,
+diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c
+index 3f8ef82..7810222 100644
+--- a/arch/arm/mach-imx/mach-cpuimx35.c
++++ b/arch/arm/mach-imx/mach-cpuimx35.c
+@@ -190,7 +190,7 @@ struct sys_timer eukrea_cpuimx35_timer = {
+ .init = eukrea_cpuimx35_timer_init,
+ };
+
+-MACHINE_START(EUKREA_CPUIMX35, "Eukrea CPUIMX35")
++MACHINE_START(EUKREA_CPUIMX35SD, "Eukrea CPUIMX35")
+ /* Maintainer: Eukrea Electromatique */
+ .boot_params = MX3x_PHYS_OFFSET + 0x100,
+ .map_io = mx35_map_io,
+diff --git a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
+index 148cff2..19ffa9a 100644
+--- a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
++++ b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
+@@ -159,7 +159,7 @@ static struct sys_timer eukrea_cpuimx25_timer = {
+ .init = eukrea_cpuimx25_timer_init,
+ };
+
+-MACHINE_START(EUKREA_CPUIMX25, "Eukrea CPUIMX25")
++MACHINE_START(EUKREA_CPUIMX25SD, "Eukrea CPUIMX25")
+ /* Maintainer: Eukrea Electromatique */
+ .boot_params = MX25_PHYS_OFFSET + 0x100,
+ .map_io = mx25_map_io,
+diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
+index fff68d0..62cc8f9 100644
+--- a/arch/arm/tools/mach-types
++++ b/arch/arm/tools/mach-types
+@@ -351,7 +351,7 @@ centro MACH_CENTRO CENTRO 1944
+ nokia_rx51 MACH_NOKIA_RX51 NOKIA_RX51 1955
+ omap_zoom2 MACH_OMAP_ZOOM2 OMAP_ZOOM2 1967
+ cpuat9260 MACH_CPUAT9260 CPUAT9260 1973
+-eukrea_cpuimx27 MACH_CPUIMX27 CPUIMX27 1975
++eukrea_cpuimx27 MACH_EUKREA_CPUIMX27 EUKREA_CPUIMX27 1975
+ acs5k MACH_ACS5K ACS5K 1982
+ snapper_9260 MACH_SNAPPER_9260 SNAPPER_9260 1987
+ dsm320 MACH_DSM320 DSM320 1988
+@@ -476,8 +476,8 @@ cns3420vb MACH_CNS3420VB CNS3420VB 2776
+ omap4_panda MACH_OMAP4_PANDA OMAP4_PANDA 2791
+ ti8168evm MACH_TI8168EVM TI8168EVM 2800
+ teton_bga MACH_TETON_BGA TETON_BGA 2816
+-eukrea_cpuimx25sd MACH_EUKREA_CPUIMX25 EUKREA_CPUIMX25 2820
+-eukrea_cpuimx35sd MACH_EUKREA_CPUIMX35 EUKREA_CPUIMX35 2821
++eukrea_cpuimx25sd MACH_EUKREA_CPUIMX25SD EUKREA_CPUIMX25SD 2820
++eukrea_cpuimx35sd MACH_EUKREA_CPUIMX35SD EUKREA_CPUIMX35SD 2821
+ eukrea_cpuimx51sd MACH_EUKREA_CPUIMX51SD EUKREA_CPUIMX51SD 2822
+ eukrea_cpuimx51 MACH_EUKREA_CPUIMX51 EUKREA_CPUIMX51 2823
+ smdkc210 MACH_SMDKC210 SMDKC210 2838
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0244-ARM-Add-a-few-machine-types-to-mach-types.patch b/patches.armadillo800eva/0244-ARM-Add-a-few-machine-types-to-mach-types.patch
new file mode 100644
index 00000000000000..44eb8b56251fd8
--- /dev/null
+++ b/patches.armadillo800eva/0244-ARM-Add-a-few-machine-types-to-mach-types.patch
@@ -0,0 +1,122 @@
+From e12b022730fe5c700fe8d1872a2bda4ea41c6abe Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@arm.linux.org.uk>
+Date: Mon, 17 Oct 2011 10:26:51 +0100
+Subject: ARM: Add a few machine types to mach-types
+
+Add vision_ep9307, rwi_ews, usb_a9g20, karo, apf9328, tx37, tx25,
+tx51, mx51_m2id, pca101, gplugd, smdk4212 and smdk4412.
+
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+(cherry picked from commit 628e1110feebeb834359fd6f44ec7e346bdf9611)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/tools/mach-types | 20 ++++++++++++++++----
+ 1 file changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
+index 62cc8f9..5bdeef9 100644
+--- a/arch/arm/tools/mach-types
++++ b/arch/arm/tools/mach-types
+@@ -12,10 +12,9 @@
+ #
+ # http://www.arm.linux.org.uk/developer/machines/?action=new
+ #
+-# XXX: This is a cut-down version of the file; it contains only machines that
+-# XXX: are in mainline or have been submitted to the machine database within
+-# XXX: the last 12 months. If your entry is missing please email rmk at
+-# XXX: <linux@arm.linux.org.uk>
++# This is a cut-down version of the file; it contains only machines that
++# are merged into mainline or have been edited in the machine database
++# within the last 12 months. References to machine_is_NAME() do not count!
+ #
+ # Last update: Sat May 7 08:48:24 2011
+ #
+@@ -65,6 +64,7 @@ h7201 ARCH_H7201 H7201 161
+ h7202 ARCH_H7202 H7202 162
+ iq80321 ARCH_IQ80321 IQ80321 169
+ ks8695 ARCH_KS8695 KS8695 180
++karo ARCH_KARO KARO 190
+ smdk2410 ARCH_SMDK2410 SMDK2410 193
+ ceiva ARCH_CEIVA CEIVA 200
+ voiceblue MACH_VOICEBLUE VOICEBLUE 218
+@@ -188,6 +188,7 @@ omap_2430sdp MACH_OMAP_2430SDP OMAP_2430SDP 900
+ davinci_evm MACH_DAVINCI_EVM DAVINCI_EVM 901
+ palmz72 MACH_PALMZ72 PALMZ72 904
+ nxdb500 MACH_NXDB500 NXDB500 905
++apf9328 MACH_APF9328 APF9328 906
+ palmt5 MACH_PALMT5 PALMT5 917
+ palmtc MACH_PALMTC PALMTC 918
+ omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919
+@@ -271,10 +272,12 @@ pcm038 MACH_PCM038 PCM038 1551
+ ts_x09 MACH_TS209 TS209 1565
+ at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566
+ mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574
++vision_ep9307 MACH_VISION_EP9307 VISION_EP9307 1578
+ terastation_pro2 MACH_TERASTATION_PRO2 TERASTATION_PRO2 1584
+ linkstation_pro MACH_LINKSTATION_PRO LINKSTATION_PRO 1585
+ e350 MACH_E350 E350 1596
+ ts409 MACH_TS409 TS409 1601
++rsi_ews MACH_RSI_EWS RSI_EWS 1609
+ cm_x300 MACH_CM_X300 CM_X300 1616
+ at91sam9g20ek MACH_AT91SAM9G20EK AT91SAM9G20EK 1624
+ smdk6410 MACH_SMDK6410 SMDK6410 1626
+@@ -331,6 +334,7 @@ smdkc100 MACH_SMDKC100 SMDKC100 1826
+ tavorevb MACH_TAVOREVB TAVOREVB 1827
+ saar MACH_SAAR SAAR 1828
+ at91sam9m10g45ek MACH_AT91SAM9M10G45EK AT91SAM9M10G45EK 1830
++usb_a9g20 MACH_USB_A9G20 USB_A9G20 1841
+ mxlads MACH_MXLADS MXLADS 1851
+ linkstation_mini MACH_LINKSTATION_MINI LINKSTATION_MINI 1858
+ afeb9260 MACH_AFEB9260 AFEB9260 1859
+@@ -369,6 +373,7 @@ pcm043 MACH_PCM043 PCM043 2072
+ sheevaplug MACH_SHEEVAPLUG SHEEVAPLUG 2097
+ avengers_lite MACH_AVENGERS_LITE AVENGERS_LITE 2104
+ mx51_babbage MACH_MX51_BABBAGE MX51_BABBAGE 2125
++tx37 MACH_TX37 TX37 2127
+ rd78x00_masa MACH_RD78X00_MASA RD78X00_MASA 2135
+ dm355_leopard MACH_DM355_LEOPARD DM355_LEOPARD 2138
+ ts219 MACH_TS219 TS219 2139
+@@ -379,6 +384,7 @@ omap_4430sdp MACH_OMAP_4430SDP OMAP_4430SDP 2160
+ magx_zn5 MACH_MAGX_ZN5 MAGX_ZN5 2162
+ btmavb101 MACH_BTMAVB101 BTMAVB101 2172
+ btmawb101 MACH_BTMAWB101 BTMAWB101 2173
++tx25 MACH_TX25 TX25 2177
+ omap3_torpedo MACH_OMAP3_TORPEDO OMAP3_TORPEDO 2178
+ anw6410 MACH_ANW6410 ANW6410 2183
+ imx27_visstrim_m10 MACH_IMX27_VISSTRIM_M10 IMX27_VISSTRIM_M10 2187
+@@ -423,6 +429,7 @@ raumfeld_rc MACH_RAUMFELD_RC RAUMFELD_RC 2413
+ raumfeld_connector MACH_RAUMFELD_CONNECTOR RAUMFELD_CONNECTOR 2414
+ raumfeld_speaker MACH_RAUMFELD_SPEAKER RAUMFELD_SPEAKER 2415
+ tnetv107x MACH_TNETV107X TNETV107X 2418
++mx51_m2id MACH_MX51_M2ID MX51_M2ID 2428
+ smdkv210 MACH_SMDKV210 SMDKV210 2456
+ omap_zoom3 MACH_OMAP_ZOOM3 OMAP_ZOOM3 2464
+ omap_3630sdp MACH_OMAP_3630SDP OMAP_3630SDP 2465
+@@ -433,14 +440,17 @@ omapl138_hawkboard MACH_OMAPL138_HAWKBOARD OMAPL138_HAWKBOARD 2495
+ ts41x MACH_TS41X TS41X 2502
+ phy3250 MACH_PHY3250 PHY3250 2511
+ mini6410 MACH_MINI6410 MINI6410 2520
++tx51 MACH_TX51 TX51 2529
+ mx28evk MACH_MX28EVK MX28EVK 2531
+ smartq5 MACH_SMARTQ5 SMARTQ5 2534
+ davinci_dm6467tevm MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM 2548
+ mxt_td60 MACH_MXT_TD60 MXT_TD60 2550
+ riot_bei2 MACH_RIOT_BEI2 RIOT_BEI2 2576
+ riot_x37 MACH_RIOT_X37 RIOT_X37 2578
++pca101 MACH_PCA101 PCA101 2595
+ capc7117 MACH_CAPC7117 CAPC7117 2612
+ icontrol MACH_ICONTROL ICONTROL 2624
++gplugd MACH_GPLUGD GPLUGD 2625
+ qsd8x50a_st1_5 MACH_QSD8X50A_ST1_5 QSD8X50A_ST1_5 2627
+ mx23evk MACH_MX23EVK MX23EVK 2629
+ ap4evb MACH_AP4EVB AP4EVB 2630
+@@ -1113,3 +1123,5 @@ blissc MACH_BLISSC BLISSC 3491
+ thales_adc MACH_THALES_ADC THALES_ADC 3492
+ ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493
+ atdgp318 MACH_ATDGP318 ATDGP318 3494
++smdk4212 MACH_SMDK4212 SMDK4212 3638
++smdk4412 MACH_SMDK4412 SMDK4412 3765
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0245-ARM-Update-mach-types-to-fix-mxs-build-breakage.patch b/patches.armadillo800eva/0245-ARM-Update-mach-types-to-fix-mxs-build-breakage.patch
new file mode 100644
index 00000000000000..8395f2657de65a
--- /dev/null
+++ b/patches.armadillo800eva/0245-ARM-Update-mach-types-to-fix-mxs-build-breakage.patch
@@ -0,0 +1,41 @@
+From 51199f058ed4376aeea7ab3340b67d49d71d2a56 Mon Sep 17 00:00:00 2001
+From: Shawn Guo <shawn.guo@linaro.org>
+Date: Wed, 16 Nov 2011 21:44:33 +0800
+Subject: ARM: Update mach-types to fix mxs build breakage
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add entry m28evk to fix the following mxs build breakage.
+
+ CHK include/generated/compile.h
+ CC arch/arm/mach-mxs/clock-mx28.o
+arch/arm/mach-mxs/clock-mx28.c: In function 'clk_misc_init':
+arch/arm/mach-mxs/clock-mx28.c:748: error: implicit declaration of
+function 'machine_is_m28evk'
+make[1]: *** [arch/arm/mach-mxs/clock-mx28.o] Error 1
+make: *** [arch/arm/mach-mxs] Error 2
+
+Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
+Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+(cherry picked from commit 9b7c547f7747991fe62f622698ea1bf470f256f4)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/tools/mach-types | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
+index 5bdeef9..ccbe16f 100644
+--- a/arch/arm/tools/mach-types
++++ b/arch/arm/tools/mach-types
+@@ -1123,5 +1123,6 @@ blissc MACH_BLISSC BLISSC 3491
+ thales_adc MACH_THALES_ADC THALES_ADC 3492
+ ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493
+ atdgp318 MACH_ATDGP318 ATDGP318 3494
++m28evk MACH_M28EVK M28EVK 3613
+ smdk4212 MACH_SMDK4212 SMDK4212 3638
+ smdk4412 MACH_SMDK4412 SMDK4412 3765
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0246-ARM-7193-1-Fix-machine_is_xxx-naming-for-eSata-Sheev.patch b/patches.armadillo800eva/0246-ARM-7193-1-Fix-machine_is_xxx-naming-for-eSata-Sheev.patch
new file mode 100644
index 00000000000000..0687ca9739cdcc
--- /dev/null
+++ b/patches.armadillo800eva/0246-ARM-7193-1-Fix-machine_is_xxx-naming-for-eSata-Sheev.patch
@@ -0,0 +1,90 @@
+From 9bdfe76b0554ab2c6e657ec2c294ab8c43d34a28 Mon Sep 17 00:00:00 2001
+From: "Jon Medhurst (Tixy)" <tixy@yxit.co.uk>
+Date: Tue, 6 Dec 2011 09:59:38 +0100
+Subject: ARM: 7193/1: Fix machine_is_xxx() naming for eSata SheevaPlug and
+ QNAP TS-209
+
+The eSata SheevaPlug and QNAP TS-209 devices were removed from
+mach-types due to naming mismatches between machine_is_xxx(), CONFIG_XXX
+and MACH_TYPE_XXX.
+
+This patch fixes those mismatches and adds the devices back into
+mach-types.
+
+Acked-by: Nicolas Pitre <nico@linaro.org>
+Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+(cherry picked from commit d22759ed5680055fdecbdcf6644dbc8a467ab801)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-kirkwood/sheevaplug-setup.c | 6 +++---
+ arch/arm/mach-orion5x/ts209-setup.c | 2 +-
+ arch/arm/tools/mach-types | 4 ++--
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/arch/arm/mach-kirkwood/sheevaplug-setup.c b/arch/arm/mach-kirkwood/sheevaplug-setup.c
+index 17de0bf..d989c0d 100644
+--- a/arch/arm/mach-kirkwood/sheevaplug-setup.c
++++ b/arch/arm/mach-kirkwood/sheevaplug-setup.c
+@@ -107,7 +107,7 @@ static void __init sheevaplug_init(void)
+ kirkwood_init();
+
+ /* setup gpio pin select */
+- if (machine_is_sheeva_esata())
++ if (machine_is_esata_sheevaplug())
+ kirkwood_mpp_conf(sheeva_esata_mpp_config);
+ else
+ kirkwood_mpp_conf(sheevaplug_mpp_config);
+@@ -123,11 +123,11 @@ static void __init sheevaplug_init(void)
+ kirkwood_ge00_init(&sheevaplug_ge00_data);
+
+ /* honor lower power consumption for plugs with out eSATA */
+- if (machine_is_sheeva_esata())
++ if (machine_is_esata_sheevaplug())
+ kirkwood_sata_init(&sheeva_esata_sata_data);
+
+ /* enable sd wp and sd cd on plugs with esata */
+- if (machine_is_sheeva_esata())
++ if (machine_is_esata_sheevaplug())
+ kirkwood_sdio_init(&sheeva_esata_mvsdio_data);
+ else
+ kirkwood_sdio_init(&sheevaplug_mvsdio_data);
+diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
+index 47162fd..6749c2c 100644
+--- a/arch/arm/mach-orion5x/ts209-setup.c
++++ b/arch/arm/mach-orion5x/ts209-setup.c
+@@ -178,7 +178,7 @@ static struct hw_pci qnap_ts209_pci __initdata = {
+
+ static int __init qnap_ts209_pci_init(void)
+ {
+- if (machine_is_ts_x09())
++ if (machine_is_ts209())
+ pci_common_init(&qnap_ts209_pci);
+
+ return 0;
+diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
+index ccbe16f..9e66ebc 100644
+--- a/arch/arm/tools/mach-types
++++ b/arch/arm/tools/mach-types
+@@ -269,7 +269,7 @@ dns323 MACH_DNS323 DNS323 1542
+ omap3_beagle MACH_OMAP3_BEAGLE OMAP3_BEAGLE 1546
+ nokia_n810 MACH_NOKIA_N810 NOKIA_N810 1548
+ pcm038 MACH_PCM038 PCM038 1551
+-ts_x09 MACH_TS209 TS209 1565
++ts209 MACH_TS209 TS209 1565
+ at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566
+ mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574
+ vision_ep9307 MACH_VISION_EP9307 VISION_EP9307 1578
+@@ -459,7 +459,7 @@ guruplug MACH_GURUPLUG GURUPLUG 2659
+ spear310 MACH_SPEAR310 SPEAR310 2660
+ spear320 MACH_SPEAR320 SPEAR320 2661
+ aquila MACH_AQUILA AQUILA 2676
+-sheeva_esata MACH_ESATA_SHEEVAPLUG ESATA_SHEEVAPLUG 2678
++esata_sheevaplug MACH_ESATA_SHEEVAPLUG ESATA_SHEEVAPLUG 2678
+ msm7x30_surf MACH_MSM7X30_SURF MSM7X30_SURF 2679
+ ea2478devkit MACH_EA2478DEVKIT EA2478DEVKIT 2683
+ terastation_wxl MACH_TERASTATION_WXL TERASTATION_WXL 2697
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0247-ARM-Update-mach-types.patch b/patches.armadillo800eva/0247-ARM-Update-mach-types.patch
new file mode 100644
index 00000000000000..e1a51778c35bd7
--- /dev/null
+++ b/patches.armadillo800eva/0247-ARM-Update-mach-types.patch
@@ -0,0 +1,828 @@
+From f334a3eb18b1b4a67b78d645fda928fdb805f7bf Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@arm.linux.org.uk>
+Date: Tue, 6 Dec 2011 11:07:38 +0000
+Subject: ARM: Update mach-types
+
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+(cherry picked from commit a3c2b511a844641f6d0b60bd84cd6076143b3f2d)
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/tools/mach-types | 709 ++++++++++++++++++++++++---------------------
+ 1 file changed, 376 insertions(+), 333 deletions(-)
+
+diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
+index 9e66ebc..f9c9f33 100644
+--- a/arch/arm/tools/mach-types
++++ b/arch/arm/tools/mach-types
+@@ -16,7 +16,7 @@
+ # are merged into mainline or have been edited in the machine database
+ # within the last 12 months. References to machine_is_NAME() do not count!
+ #
+-# Last update: Sat May 7 08:48:24 2011
++# Last update: Tue Dec 6 11:07:38 2011
+ #
+ # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
+ #
+@@ -321,7 +321,6 @@ lb88rc8480 MACH_LB88RC8480 LB88RC8480 1769
+ mx25_3ds MACH_MX25_3DS MX25_3DS 1771
+ omap3530_lv_som MACH_OMAP3530_LV_SOM OMAP3530_LV_SOM 1773
+ davinci_da830_evm MACH_DAVINCI_DA830_EVM DAVINCI_DA830_EVM 1781
+-at572d940hfek MACH_AT572D940HFEB AT572D940HFEB 1783
+ dove_db MACH_DOVE_DB DOVE_DB 1788
+ overo MACH_OVERO OVERO 1798
+ at2440evb MACH_AT2440EVB AT2440EVB 1799
+@@ -491,380 +490,53 @@ eukrea_cpuimx35sd MACH_EUKREA_CPUIMX35SD EUKREA_CPUIMX35SD 2821
+ eukrea_cpuimx51sd MACH_EUKREA_CPUIMX51SD EUKREA_CPUIMX51SD 2822
+ eukrea_cpuimx51 MACH_EUKREA_CPUIMX51 EUKREA_CPUIMX51 2823
+ smdkc210 MACH_SMDKC210 SMDKC210 2838
+-omap3_braillo MACH_OMAP3_BRAILLO OMAP3_BRAILLO 2839
+-spyplug MACH_SPYPLUG SPYPLUG 2840
+-ginger MACH_GINGER GINGER 2841
+-tny_t3530 MACH_TNY_T3530 TNY_T3530 2842
+ pca102 MACH_PCA102 PCA102 2843
+-spade MACH_SPADE SPADE 2844
+-mxc25_topaz MACH_MXC25_TOPAZ MXC25_TOPAZ 2845
+ t5325 MACH_T5325 T5325 2846
+-gw2361 MACH_GW2361 GW2361 2847
+-elog MACH_ELOG ELOG 2848
+ income MACH_INCOME INCOME 2849
+-bcm589x MACH_BCM589X BCM589X 2850
+-etna MACH_ETNA ETNA 2851
+-hawks MACH_HAWKS HAWKS 2852
+-meson MACH_MESON MESON 2853
+-xsbase255 MACH_XSBASE255 XSBASE255 2854
+-pvm2030 MACH_PVM2030 PVM2030 2855
+-mioa502 MACH_MIOA502 MIOA502 2856
+ vvbox_sdorig2 MACH_VVBOX_SDORIG2 VVBOX_SDORIG2 2857
+ vvbox_sdlite2 MACH_VVBOX_SDLITE2 VVBOX_SDLITE2 2858
+ vvbox_sdpro4 MACH_VVBOX_SDPRO4 VVBOX_SDPRO4 2859
+-htc_spv_m700 MACH_HTC_SPV_M700 HTC_SPV_M700 2860
+ mx257sx MACH_MX257SX MX257SX 2861
+ goni MACH_GONI GONI 2862
+-msm8x55_svlte_ffa MACH_MSM8X55_SVLTE_FFA MSM8X55_SVLTE_FFA 2863
+-msm8x55_svlte_surf MACH_MSM8X55_SVLTE_SURF MSM8X55_SVLTE_SURF 2864
+-quickstep MACH_QUICKSTEP QUICKSTEP 2865
+-dmw96 MACH_DMW96 DMW96 2866
+-hammerhead MACH_HAMMERHEAD HAMMERHEAD 2867
+-trident MACH_TRIDENT TRIDENT 2868
+-lightning MACH_LIGHTNING LIGHTNING 2869
+-iconnect MACH_ICONNECT ICONNECT 2870
+-autobot MACH_AUTOBOT AUTOBOT 2871
+-coconut MACH_COCONUT COCONUT 2872
+-durian MACH_DURIAN DURIAN 2873
+-cayenne MACH_CAYENNE CAYENNE 2874
+-fuji MACH_FUJI FUJI 2875
+-synology_6282 MACH_SYNOLOGY_6282 SYNOLOGY_6282 2876
+-em1sy MACH_EM1SY EM1SY 2877
+-m502 MACH_M502 M502 2878
+-matrix518 MACH_MATRIX518 MATRIX518 2879
+-tiny_gurnard MACH_TINY_GURNARD TINY_GURNARD 2880
+-spear1310 MACH_SPEAR1310 SPEAR1310 2881
+ bv07 MACH_BV07 BV07 2882
+-mxt_td61 MACH_MXT_TD61 MXT_TD61 2883
+ openrd_ultimate MACH_OPENRD_ULTIMATE OPENRD_ULTIMATE 2884
+ devixp MACH_DEVIXP DEVIXP 2885
+ miccpt MACH_MICCPT MICCPT 2886
+ mic256 MACH_MIC256 MIC256 2887
+-as1167 MACH_AS1167 AS1167 2888
+-omap3_ibiza MACH_OMAP3_IBIZA OMAP3_IBIZA 2889
+ u5500 MACH_U5500 U5500 2890
+-davinci_picto MACH_DAVINCI_PICTO DAVINCI_PICTO 2891
+-mecha MACH_MECHA MECHA 2892
+-bubba3 MACH_BUBBA3 BUBBA3 2893
+-pupitre MACH_PUPITRE PUPITRE 2894
+-tegra_vogue MACH_TEGRA_VOGUE TEGRA_VOGUE 2896
+-tegra_e1165 MACH_TEGRA_E1165 TEGRA_E1165 2897
+-simplenet MACH_SIMPLENET SIMPLENET 2898
+-ec4350tbm MACH_EC4350TBM EC4350TBM 2899
+-pec_tc MACH_PEC_TC PEC_TC 2900
+-pec_hc2 MACH_PEC_HC2 PEC_HC2 2901
+-esl_mobilis_a MACH_ESL_MOBILIS_A ESL_MOBILIS_A 2902
+-esl_mobilis_b MACH_ESL_MOBILIS_B ESL_MOBILIS_B 2903
+-esl_wave_a MACH_ESL_WAVE_A ESL_WAVE_A 2904
+-esl_wave_b MACH_ESL_WAVE_B ESL_WAVE_B 2905
+-unisense_mmm MACH_UNISENSE_MMM UNISENSE_MMM 2906
+-blueshark MACH_BLUESHARK BLUESHARK 2907
+-e10 MACH_E10 E10 2908
+-app3k_robin MACH_APP3K_ROBIN APP3K_ROBIN 2909
+-pov15hd MACH_POV15HD POV15HD 2910
+-stella MACH_STELLA STELLA 2911
+ linkstation_lschl MACH_LINKSTATION_LSCHL LINKSTATION_LSCHL 2913
+-netwalker MACH_NETWALKER NETWALKER 2914
+-acsx106 MACH_ACSX106 ACSX106 2915
+-atlas5_c1 MACH_ATLAS5_C1 ATLAS5_C1 2916
+-nsb3ast MACH_NSB3AST NSB3AST 2917
+-gnet_slc MACH_GNET_SLC GNET_SLC 2918
+-af4000 MACH_AF4000 AF4000 2919
+-ark9431 MACH_ARK9431 ARK9431 2920
+-fs_s5pc100 MACH_FS_S5PC100 FS_S5PC100 2921
+-omap3505nova8 MACH_OMAP3505NOVA8 OMAP3505NOVA8 2922
+-omap3621_edp1 MACH_OMAP3621_EDP1 OMAP3621_EDP1 2923
+-oratisaes MACH_ORATISAES ORATISAES 2924
+ smdkv310 MACH_SMDKV310 SMDKV310 2925
+-siemens_l0 MACH_SIEMENS_L0 SIEMENS_L0 2926
+-ventana MACH_VENTANA VENTANA 2927
+ wm8505_7in_netbook MACH_WM8505_7IN_NETBOOK WM8505_7IN_NETBOOK 2928
+-ec4350sdb MACH_EC4350SDB EC4350SDB 2929
+-mimas MACH_MIMAS MIMAS 2930
+-titan MACH_TITAN TITAN 2931
+ craneboard MACH_CRANEBOARD CRANEBOARD 2932
+-es2440 MACH_ES2440 ES2440 2933
+-najay_a9263 MACH_NAJAY_A9263 NAJAY_A9263 2934
+-htctornado MACH_HTCTORNADO HTCTORNADO 2935
+-dimm_mx257 MACH_DIMM_MX257 DIMM_MX257 2936
+-jigen301 MACH_JIGEN JIGEN 2937
+ smdk6450 MACH_SMDK6450 SMDK6450 2938
+-meno_qng MACH_MENO_QNG MENO_QNG 2939
+-ns2416 MACH_NS2416 NS2416 2940
+-rpc353 MACH_RPC353 RPC353 2941
+-tq6410 MACH_TQ6410 TQ6410 2942
+-sky6410 MACH_SKY6410 SKY6410 2943
+-dynasty MACH_DYNASTY DYNASTY 2944
+-vivo MACH_VIVO VIVO 2945
+-bury_bl7582 MACH_BURY_BL7582 BURY_BL7582 2946
+-bury_bps5270 MACH_BURY_BPS5270 BURY_BPS5270 2947
+-basi MACH_BASI BASI 2948
+-tn200 MACH_TN200 TN200 2949
+-c2mmi MACH_C2MMI C2MMI 2950
+-meson_6236m MACH_MESON_6236M MESON_6236M 2951
+-meson_8626m MACH_MESON_8626M MESON_8626M 2952
+-tube MACH_TUBE TUBE 2953
+-messina MACH_MESSINA MESSINA 2954
+-mx50_arm2 MACH_MX50_ARM2 MX50_ARM2 2955
+-cetus9263 MACH_CETUS9263 CETUS9263 2956
+ brownstone MACH_BROWNSTONE BROWNSTONE 2957
+-vmx25 MACH_VMX25 VMX25 2958
+-vmx51 MACH_VMX51 VMX51 2959
+-abacus MACH_ABACUS ABACUS 2960
+-cm4745 MACH_CM4745 CM4745 2961
+-oratislink MACH_ORATISLINK ORATISLINK 2962
+-davinci_dm365_dvr MACH_DAVINCI_DM365_DVR DAVINCI_DM365_DVR 2963
+-netviz MACH_NETVIZ NETVIZ 2964
+ flexibity MACH_FLEXIBITY FLEXIBITY 2965
+-wlan_computer MACH_WLAN_COMPUTER WLAN_COMPUTER 2966
+-lpc24xx MACH_LPC24XX LPC24XX 2967
+-spica MACH_SPICA SPICA 2968
+-gpsdisplay MACH_GPSDISPLAY GPSDISPLAY 2969
+-bipnet MACH_BIPNET BIPNET 2970
+-overo_ctu_inertial MACH_OVERO_CTU_INERTIAL OVERO_CTU_INERTIAL 2971
+-davinci_dm355_mmm MACH_DAVINCI_DM355_MMM DAVINCI_DM355_MMM 2972
+-pc9260_v2 MACH_PC9260_V2 PC9260_V2 2973
+-ptx7545 MACH_PTX7545 PTX7545 2974
+-tm_efdc MACH_TM_EFDC TM_EFDC 2975
+-omap3_waldo1 MACH_OMAP3_WALDO1 OMAP3_WALDO1 2977
+-flyer MACH_FLYER FLYER 2978
+-tornado3240 MACH_TORNADO3240 TORNADO3240 2979
+-soli_01 MACH_SOLI_01 SOLI_01 2980
+-omapl138_europalc MACH_OMAPL138_EUROPALC OMAPL138_EUROPALC 2981
+-helios_v1 MACH_HELIOS_V1 HELIOS_V1 2982
+-netspace_lite_v2 MACH_NETSPACE_LITE_V2 NETSPACE_LITE_V2 2983
+-ssc MACH_SSC SSC 2984
+-premierwave_en MACH_PREMIERWAVE_EN PREMIERWAVE_EN 2985
+-wasabi MACH_WASABI WASABI 2986
+ mx50_rdp MACH_MX50_RDP MX50_RDP 2988
+ universal_c210 MACH_UNIVERSAL_C210 UNIVERSAL_C210 2989
+ real6410 MACH_REAL6410 REAL6410 2990
+-spx_sakura MACH_SPX_SAKURA SPX_SAKURA 2991
+-ij3k_2440 MACH_IJ3K_2440 IJ3K_2440 2992
+-omap3_bc10 MACH_OMAP3_BC10 OMAP3_BC10 2993
+-thebe MACH_THEBE THEBE 2994
+-rv082 MACH_RV082 RV082 2995
+-armlguest MACH_ARMLGUEST ARMLGUEST 2996
+-tjinc1000 MACH_TJINC1000 TJINC1000 2997
+ dockstar MACH_DOCKSTAR DOCKSTAR 2998
+-ax8008 MACH_AX8008 AX8008 2999
+-gnet_sgce MACH_GNET_SGCE GNET_SGCE 3000
+-pxwnas_500_1000 MACH_PXWNAS_500_1000 PXWNAS_500_1000 3001
+-ea20 MACH_EA20 EA20 3002
+-awm2 MACH_AWM2 AWM2 3003
+ ti8148evm MACH_TI8148EVM TI8148EVM 3004
+ seaboard MACH_SEABOARD SEABOARD 3005
+-linkstation_chlv2 MACH_LINKSTATION_CHLV2 LINKSTATION_CHLV2 3006
+-tera_pro2_rack MACH_TERA_PRO2_RACK TERA_PRO2_RACK 3007
+-rubys MACH_RUBYS RUBYS 3008
+-aquarius MACH_AQUARIUS AQUARIUS 3009
+ mx53_ard MACH_MX53_ARD MX53_ARD 3010
+ mx53_smd MACH_MX53_SMD MX53_SMD 3011
+-lswxl MACH_LSWXL LSWXL 3012
+-dove_avng_v3 MACH_DOVE_AVNG_V3 DOVE_AVNG_V3 3013
+-sdi_ess_9263 MACH_SDI_ESS_9263 SDI_ESS_9263 3014
+-jocpu550 MACH_JOCPU550 JOCPU550 3015
+ msm8x60_rumi3 MACH_MSM8X60_RUMI3 MSM8X60_RUMI3 3016
+ msm8x60_ffa MACH_MSM8X60_FFA MSM8X60_FFA 3017
+-yanomami MACH_YANOMAMI YANOMAMI 3018
+-gta04 MACH_GTA04 GTA04 3019
+ cm_a510 MACH_CM_A510 CM_A510 3020
+-omap3_rfs200 MACH_OMAP3_RFS200 OMAP3_RFS200 3021
+-kx33xx MACH_KX33XX KX33XX 3022
+-ptx7510 MACH_PTX7510 PTX7510 3023
+-top9000 MACH_TOP9000 TOP9000 3024
+-teenote MACH_TEENOTE TEENOTE 3025
+-ts3 MACH_TS3 TS3 3026
+-a0 MACH_A0 A0 3027
+-fsm9xxx_surf MACH_FSM9XXX_SURF FSM9XXX_SURF 3028
+-fsm9xxx_ffa MACH_FSM9XXX_FFA FSM9XXX_FFA 3029
+-frrhwcdma60w MACH_FRRHWCDMA60W FRRHWCDMA60W 3030
+-remus MACH_REMUS REMUS 3031
+-at91cap7xdk MACH_AT91CAP7XDK AT91CAP7XDK 3032
+-at91cap7stk MACH_AT91CAP7STK AT91CAP7STK 3033
+-kt_sbc_sam9_1 MACH_KT_SBC_SAM9_1 KT_SBC_SAM9_1 3034
+-armada_xp_db MACH_ARMADA_XP_DB ARMADA_XP_DB 3036
+-spdm MACH_SPDM SPDM 3037
+-gtib MACH_GTIB GTIB 3038
+-dgm3240 MACH_DGM3240 DGM3240 3039
+-htcmega MACH_HTCMEGA HTCMEGA 3041
+-tricorder MACH_TRICORDER TRICORDER 3042
+ tx28 MACH_TX28 TX28 3043
+-bstbrd MACH_BSTBRD BSTBRD 3044
+-pwb3090 MACH_PWB3090 PWB3090 3045
+-idea6410 MACH_IDEA6410 IDEA6410 3046
+-qbc9263 MACH_QBC9263 QBC9263 3047
+-borabora MACH_BORABORA BORABORA 3048
+-valdez MACH_VALDEZ VALDEZ 3049
+-ls9g20 MACH_LS9G20 LS9G20 3050
+-mios_v1 MACH_MIOS_V1 MIOS_V1 3051
+-s5pc110_crespo MACH_S5PC110_CRESPO S5PC110_CRESPO 3052
+-controltek9g20 MACH_CONTROLTEK9G20 CONTROLTEK9G20 3053
+-tin307 MACH_TIN307 TIN307 3054
+-tin510 MACH_TIN510 TIN510 3055
+-bluecheese MACH_BLUECHEESE BLUECHEESE 3057
+-tem3x30 MACH_TEM3X30 TEM3X30 3058
+-harvest_desoto MACH_HARVEST_DESOTO HARVEST_DESOTO 3059
+-msm8x60_qrdc MACH_MSM8X60_QRDC MSM8X60_QRDC 3060
+-spear900 MACH_SPEAR900 SPEAR900 3061
+ pcontrol_g20 MACH_PCONTROL_G20 PCONTROL_G20 3062
+-rdstor MACH_RDSTOR RDSTOR 3063
+-usdloader MACH_USDLOADER USDLOADER 3064
+-tsoploader MACH_TSOPLOADER TSOPLOADER 3065
+-kronos MACH_KRONOS KRONOS 3066
+-ffcore MACH_FFCORE FFCORE 3067
+-mone MACH_MONE MONE 3068
+-unit2s MACH_UNIT2S UNIT2S 3069
+-acer_a5 MACH_ACER_A5 ACER_A5 3070
+-etherpro_isp MACH_ETHERPRO_ISP ETHERPRO_ISP 3071
+-stretchs7000 MACH_STRETCHS7000 STRETCHS7000 3072
+-p87_smartsim MACH_P87_SMARTSIM P87_SMARTSIM 3073
+-tulip MACH_TULIP TULIP 3074
+-sunflower MACH_SUNFLOWER SUNFLOWER 3075
+-rib MACH_RIB RIB 3076
+-clod MACH_CLOD CLOD 3077
+-rump MACH_RUMP RUMP 3078
+-tenderloin MACH_TENDERLOIN TENDERLOIN 3079
+-shortloin MACH_SHORTLOIN SHORTLOIN 3080
+-antares MACH_ANTARES ANTARES 3082
+-wb40n MACH_WB40N WB40N 3083
+-herring MACH_HERRING HERRING 3084
+-naxy400 MACH_NAXY400 NAXY400 3085
+-naxy1200 MACH_NAXY1200 NAXY1200 3086
+ vpr200 MACH_VPR200 VPR200 3087
+-bug20 MACH_BUG20 BUG20 3088
+-goflexnet MACH_GOFLEXNET GOFLEXNET 3089
+ torbreck MACH_TORBRECK TORBRECK 3090
+-saarb_mg1 MACH_SAARB_MG1 SAARB_MG1 3091
+-callisto MACH_CALLISTO CALLISTO 3092
+-multhsu MACH_MULTHSU MULTHSU 3093
+-saluda MACH_SALUDA SALUDA 3094
+-pemp_omap3_apollo MACH_PEMP_OMAP3_APOLLO PEMP_OMAP3_APOLLO 3095
+-vc0718 MACH_VC0718 VC0718 3096
+-mvblx MACH_MVBLX MVBLX 3097
+-inhand_apeiron MACH_INHAND_APEIRON INHAND_APEIRON 3098
+-inhand_fury MACH_INHAND_FURY INHAND_FURY 3099
+-inhand_siren MACH_INHAND_SIREN INHAND_SIREN 3100
+-hdnvp MACH_HDNVP HDNVP 3101
+-softwinner MACH_SOFTWINNER SOFTWINNER 3102
+ prima2_evb MACH_PRIMA2_EVB PRIMA2_EVB 3103
+-nas6210 MACH_NAS6210 NAS6210 3104
+-unisdev MACH_UNISDEV UNISDEV 3105
+-sbca11 MACH_SBCA11 SBCA11 3106
+-saga MACH_SAGA SAGA 3107
+-ns_k330 MACH_NS_K330 NS_K330 3108
+-tanna MACH_TANNA TANNA 3109
+-imate8502 MACH_IMATE8502 IMATE8502 3110
+-aspen MACH_ASPEN ASPEN 3111
+-daintree_cwac MACH_DAINTREE_CWAC DAINTREE_CWAC 3112
+-zmx25 MACH_ZMX25 ZMX25 3113
+-maple1 MACH_MAPLE1 MAPLE1 3114
+-qsd8x72_surf MACH_QSD8X72_SURF QSD8X72_SURF 3115
+-qsd8x72_ffa MACH_QSD8X72_FFA QSD8X72_FFA 3116
+-abilene MACH_ABILENE ABILENE 3117
+-eigen_ttr MACH_EIGEN_TTR EIGEN_TTR 3118
+-iomega_ix2_200 MACH_IOMEGA_IX2_200 IOMEGA_IX2_200 3119
+-coretec_vcx7400 MACH_CORETEC_VCX7400 CORETEC_VCX7400 3120
+-santiago MACH_SANTIAGO SANTIAGO 3121
+-mx257sol MACH_MX257SOL MX257SOL 3122
+-strasbourg MACH_STRASBOURG STRASBOURG 3123
+-msm8x60_fluid MACH_MSM8X60_FLUID MSM8X60_FLUID 3124
+-smartqv5 MACH_SMARTQV5 SMARTQV5 3125
+-smartqv3 MACH_SMARTQV3 SMARTQV3 3126
+-smartqv7 MACH_SMARTQV7 SMARTQV7 3127
+ paz00 MACH_PAZ00 PAZ00 3128
+ acmenetusfoxg20 MACH_ACMENETUSFOXG20 ACMENETUSFOXG20 3129
+-fwbd_0404 MACH_FWBD_0404 FWBD_0404 3131
+-hdgu MACH_HDGU HDGU 3132
+-pyramid MACH_PYRAMID PYRAMID 3133
+-epiphan MACH_EPIPHAN EPIPHAN 3134
+-omap_bender MACH_OMAP_BENDER OMAP_BENDER 3135
+-gurnard MACH_GURNARD GURNARD 3136
+-gtl_it5100 MACH_GTL_IT5100 GTL_IT5100 3137
+-bcm2708 MACH_BCM2708 BCM2708 3138
+-mx51_ggc MACH_MX51_GGC MX51_GGC 3139
+-sharespace MACH_SHARESPACE SHARESPACE 3140
+-haba_knx_explorer MACH_HABA_KNX_EXPLORER HABA_KNX_EXPLORER 3141
+-simtec_kirkmod MACH_SIMTEC_KIRKMOD SIMTEC_KIRKMOD 3142
+-crux MACH_CRUX CRUX 3143
+-mx51_bravo MACH_MX51_BRAVO MX51_BRAVO 3144
+-charon MACH_CHARON CHARON 3145
+-picocom3 MACH_PICOCOM3 PICOCOM3 3146
+-picocom4 MACH_PICOCOM4 PICOCOM4 3147
+-serrano MACH_SERRANO SERRANO 3148
+-doubleshot MACH_DOUBLESHOT DOUBLESHOT 3149
+-evsy MACH_EVSY EVSY 3150
+-huashan MACH_HUASHAN HUASHAN 3151
+-lausanne MACH_LAUSANNE LAUSANNE 3152
+-emerald MACH_EMERALD EMERALD 3153
+-tqma35 MACH_TQMA35 TQMA35 3154
+-marvel MACH_MARVEL MARVEL 3155
+-manuae MACH_MANUAE MANUAE 3156
+-chacha MACH_CHACHA CHACHA 3157
+-lemon MACH_LEMON LEMON 3158
+-csc MACH_CSC CSC 3159
+-gira_knxip_router MACH_GIRA_KNXIP_ROUTER GIRA_KNXIP_ROUTER 3160
+-t20 MACH_T20 T20 3161
+-hdmini MACH_HDMINI HDMINI 3162
+-sciphone_g2 MACH_SCIPHONE_G2 SCIPHONE_G2 3163
+-express MACH_EXPRESS EXPRESS 3164
+-express_kt MACH_EXPRESS_KT EXPRESS_KT 3165
+-maximasp MACH_MAXIMASP MAXIMASP 3166
+-nitrogen_imx51 MACH_NITROGEN_IMX51 NITROGEN_IMX51 3167
+-nitrogen_imx53 MACH_NITROGEN_IMX53 NITROGEN_IMX53 3168
+-sunfire MACH_SUNFIRE SUNFIRE 3169
+-arowana MACH_AROWANA AROWANA 3170
+-tegra_daytona MACH_TEGRA_DAYTONA TEGRA_DAYTONA 3171
+-tegra_swordfish MACH_TEGRA_SWORDFISH TEGRA_SWORDFISH 3172
+-edison MACH_EDISON EDISON 3173
+-svp8500v1 MACH_SVP8500V1 SVP8500V1 3174
+-svp8500v2 MACH_SVP8500V2 SVP8500V2 3175
+-svp5500 MACH_SVP5500 SVP5500 3176
+-b5500 MACH_B5500 B5500 3177
+-s5500 MACH_S5500 S5500 3178
+-icon MACH_ICON ICON 3179
+-elephant MACH_ELEPHANT ELEPHANT 3180
+-shooter MACH_SHOOTER SHOOTER 3182
+-spade_lte MACH_SPADE_LTE SPADE_LTE 3183
+-philhwani MACH_PHILHWANI PHILHWANI 3184
+-gsncomm MACH_GSNCOMM GSNCOMM 3185
+-strasbourg_a2 MACH_STRASBOURG_A2 STRASBOURG_A2 3186
+-mmm MACH_MMM MMM 3187
+-davinci_dm365_bv MACH_DAVINCI_DM365_BV DAVINCI_DM365_BV 3188
+ ag5evm MACH_AG5EVM AG5EVM 3189
+-sc575plc MACH_SC575PLC SC575PLC 3190
+-sc575hmi MACH_SC575IPC SC575IPC 3191
+-omap3_tdm3730 MACH_OMAP3_TDM3730 OMAP3_TDM3730 3192
+-top9000_eval MACH_TOP9000_EVAL TOP9000_EVAL 3194
+-top9000_su MACH_TOP9000_SU TOP9000_SU 3195
+-utm300 MACH_UTM300 UTM300 3196
+ tsunagi MACH_TSUNAGI TSUNAGI 3197
+-ts75xx MACH_TS75XX TS75XX 3198
+-ts47xx MACH_TS47XX TS47XX 3200
+-da850_k5 MACH_DA850_K5 DA850_K5 3201
+-ax502 MACH_AX502 AX502 3202
+-igep0032 MACH_IGEP0032 IGEP0032 3203
+-antero MACH_ANTERO ANTERO 3204
+-synergy MACH_SYNERGY SYNERGY 3205
+ ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206
+ wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207
+-punica MACH_PUNICA PUNICA 3208
+ trimslice MACH_TRIMSLICE TRIMSLICE 3209
+-mx27_wmultra MACH_MX27_WMULTRA MX27_WMULTRA 3210
+ mackerel MACH_MACKEREL MACKEREL 3211
+-fa9x27 MACH_FA9X27 FA9X27 3213
+-ns2816tb MACH_NS2816TB NS2816TB 3214
+-ns2816_ntpad MACH_NS2816_NTPAD NS2816_NTPAD 3215
+-ns2816_ntnb MACH_NS2816_NTNB NS2816_NTNB 3216
+ kaen MACH_KAEN KAEN 3217
+-nv1000 MACH_NV1000 NV1000 3218
+-nuc950ts MACH_NUC950TS NUC950TS 3219
+ nokia_rm680 MACH_NOKIA_RM680 NOKIA_RM680 3220
+-ast2200 MACH_AST2200 AST2200 3221
+-lead MACH_LEAD LEAD 3222
+-unino1 MACH_UNINO1 UNINO1 3223
+-greeco MACH_GREECO GREECO 3224
+-verdi MACH_VERDI VERDI 3225
+ dm6446_adbox MACH_DM6446_ADBOX DM6446_ADBOX 3226
+ quad_salsa MACH_QUAD_SALSA QUAD_SALSA 3227
+ abb_gma_1_1 MACH_ABB_GMA_1_1 ABB_GMA_1_1 3228
+@@ -949,13 +621,11 @@ koi MACH_KOI KOI 3312
+ ts4800 MACH_TS4800 TS4800 3313
+ tqma9263 MACH_TQMA9263 TQMA9263 3314
+ holiday MACH_HOLIDAY HOLIDAY 3315
+-dma_6410 MACH_DMA6410 DMA6410 3316
+ pcats_overlay MACH_PCATS_OVERLAY PCATS_OVERLAY 3317
+ hwgw6410 MACH_HWGW6410 HWGW6410 3318
+ shenzhou MACH_SHENZHOU SHENZHOU 3319
+ cwme9210 MACH_CWME9210 CWME9210 3320
+ cwme9210js MACH_CWME9210JS CWME9210JS 3321
+-pgs_v1 MACH_PGS_SITARA PGS_SITARA 3322
+ colibri_tegra2 MACH_COLIBRI_TEGRA2 COLIBRI_TEGRA2 3323
+ w21 MACH_W21 W21 3324
+ polysat1 MACH_POLYSAT1 POLYSAT1 3325
+@@ -1021,13 +691,11 @@ viprinet MACH_VIPRINET VIPRINET 3385
+ bockw MACH_BOCKW BOCKW 3386
+ eva2000 MACH_EVA2000 EVA2000 3387
+ steelyard MACH_STEELYARD STEELYARD 3388
+-sdh001 MACH_MACH_SDH001 MACH_SDH001 3390
+ nsslsboard MACH_NSSLSBOARD NSSLSBOARD 3392
+ geneva_b5 MACH_GENEVA_B5 GENEVA_B5 3393
+ spear1340 MACH_SPEAR1340 SPEAR1340 3394
+ rexmas MACH_REXMAS REXMAS 3395
+ msm8960_cdp MACH_MSM8960_CDP MSM8960_CDP 3396
+-msm8960_mdp MACH_MSM8960_MDP MSM8960_MDP 3397
+ msm8960_fluid MACH_MSM8960_FLUID MSM8960_FLUID 3398
+ msm8960_apq MACH_MSM8960_APQ MSM8960_APQ 3399
+ helios_v2 MACH_HELIOS_V2 HELIOS_V2 3400
+@@ -1123,6 +791,381 @@ blissc MACH_BLISSC BLISSC 3491
+ thales_adc MACH_THALES_ADC THALES_ADC 3492
+ ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493
+ atdgp318 MACH_ATDGP318 ATDGP318 3494
++dma210u MACH_DMA210U DMA210U 3495
++em_t3 MACH_EM_T3 EM_T3 3496
++htx3250 MACH_HTX3250 HTX3250 3497
++g50 MACH_G50 G50 3498
++eco5 MACH_ECO5 ECO5 3499
++wintergrasp MACH_WINTERGRASP WINTERGRASP 3500
++puro MACH_PURO PURO 3501
++shooter_k MACH_SHOOTER_K SHOOTER_K 3502
++nspire MACH_NSPIRE NSPIRE 3503
++mickxx MACH_MICKXX MICKXX 3504
++lxmb MACH_LXMB LXMB 3505
++adam MACH_ADAM ADAM 3507
++b1004 MACH_B1004 B1004 3508
++oboea MACH_OBOEA OBOEA 3509
++a1015 MACH_A1015 A1015 3510
++robin_vbdt30 MACH_ROBIN_VBDT30 ROBIN_VBDT30 3511
++tegra_enterprise MACH_TEGRA_ENTERPRISE TEGRA_ENTERPRISE 3512
++rfl108200_mk10 MACH_RFL108200_MK10 RFL108200_MK10 3513
++rfl108300_mk16 MACH_RFL108300_MK16 RFL108300_MK16 3514
++rover_v7 MACH_ROVER_V7 ROVER_V7 3515
++miphone MACH_MIPHONE MIPHONE 3516
++femtobts MACH_FEMTOBTS FEMTOBTS 3517
++monopoli MACH_MONOPOLI MONOPOLI 3518
++boss MACH_BOSS BOSS 3519
++davinci_dm368_vtam MACH_DAVINCI_DM368_VTAM DAVINCI_DM368_VTAM 3520
++clcon MACH_CLCON CLCON 3521
++nokia_rm696 MACH_NOKIA_RM696 NOKIA_RM696 3522
++tahiti MACH_TAHITI TAHITI 3523
++fighter MACH_FIGHTER FIGHTER 3524
++sgh_i710 MACH_SGH_I710 SGH_I710 3525
++integreproscb MACH_INTEGREPROSCB INTEGREPROSCB 3526
++monza MACH_MONZA MONZA 3527
++calimain MACH_CALIMAIN CALIMAIN 3528
++mx6q_sabreauto MACH_MX6Q_SABREAUTO MX6Q_SABREAUTO 3529
++gma01x MACH_GMA01X GMA01X 3530
++sbc51 MACH_SBC51 SBC51 3531
++fit MACH_FIT FIT 3532
++steelhead MACH_STEELHEAD STEELHEAD 3533
++panther MACH_PANTHER PANTHER 3534
++msm8960_liquid MACH_MSM8960_LIQUID MSM8960_LIQUID 3535
++lexikonct MACH_LEXIKONCT LEXIKONCT 3536
++ns2816_stb MACH_NS2816_STB NS2816_STB 3537
++sei_mm2_lpc3250 MACH_SEI_MM2_LPC3250 SEI_MM2_LPC3250 3538
++cmimx53 MACH_CMIMX53 CMIMX53 3539
++sandwich MACH_SANDWICH SANDWICH 3540
++chief MACH_CHIEF CHIEF 3541
++pogo_e02 MACH_POGO_E02 POGO_E02 3542
++mikrap_x168 MACH_MIKRAP_X168 MIKRAP_X168 3543
++htcmozart MACH_HTCMOZART HTCMOZART 3544
++htcgold MACH_HTCGOLD HTCGOLD 3545
++mt72xx MACH_MT72XX MT72XX 3546
++mx51_ivy MACH_MX51_IVY MX51_IVY 3547
++mx51_lvd MACH_MX51_LVD MX51_LVD 3548
++omap3_wiser2 MACH_OMAP3_WISER2 OMAP3_WISER2 3549
++dreamplug MACH_DREAMPLUG DREAMPLUG 3550
++cobas_c_111 MACH_COBAS_C_111 COBAS_C_111 3551
++cobas_u_411 MACH_COBAS_U_411 COBAS_U_411 3552
++hssd MACH_HSSD HSSD 3553
++iom35x MACH_IOM35X IOM35X 3554
++psom_omap MACH_PSOM_OMAP PSOM_OMAP 3555
++iphone_2g MACH_IPHONE_2G IPHONE_2G 3556
++iphone_3g MACH_IPHONE_3G IPHONE_3G 3557
++ipod_touch_1g MACH_IPOD_TOUCH_1G IPOD_TOUCH_1G 3558
++pharos_tpc MACH_PHAROS_TPC PHAROS_TPC 3559
++mx53_hydra MACH_MX53_HYDRA MX53_HYDRA 3560
++ns2816_dev_board MACH_NS2816_DEV_BOARD NS2816_DEV_BOARD 3561
++iphone_3gs MACH_IPHONE_3GS IPHONE_3GS 3562
++iphone_4 MACH_IPHONE_4 IPHONE_4 3563
++ipod_touch_4g MACH_IPOD_TOUCH_4G IPOD_TOUCH_4G 3564
++dragon_e1100 MACH_DRAGON_E1100 DRAGON_E1100 3565
++topside MACH_TOPSIDE TOPSIDE 3566
++irisiii MACH_IRISIII IRISIII 3567
++deto_macarm9 MACH_DETO_MACARM9 DETO_MACARM9 3568
++eti_d1 MACH_ETI_D1 ETI_D1 3569
++som3530sdk MACH_SOM3530SDK SOM3530SDK 3570
++oc_engine MACH_OC_ENGINE OC_ENGINE 3571
++apq8064_sim MACH_APQ8064_SIM APQ8064_SIM 3572
++alps MACH_ALPS ALPS 3575
++tny_t3730 MACH_TNY_T3730 TNY_T3730 3576
++geryon_nfe MACH_GERYON_NFE GERYON_NFE 3577
++ns2816_ref_board MACH_NS2816_REF_BOARD NS2816_REF_BOARD 3578
++silverstone MACH_SILVERSTONE SILVERSTONE 3579
++mtt2440 MACH_MTT2440 MTT2440 3580
++ynicdb MACH_YNICDB YNICDB 3581
++bct MACH_BCT BCT 3582
++tuscan MACH_TUSCAN TUSCAN 3583
++xbt_sam9g45 MACH_XBT_SAM9G45 XBT_SAM9G45 3584
++enbw_cmc MACH_ENBW_CMC ENBW_CMC 3585
++ch104mx257 MACH_CH104MX257 CH104MX257 3587
++openpri MACH_OPENPRI OPENPRI 3588
++am335xevm MACH_AM335XEVM AM335XEVM 3589
++picodmb MACH_PICODMB PICODMB 3590
++waluigi MACH_WALUIGI WALUIGI 3591
++punicag7 MACH_PUNICAG7 PUNICAG7 3592
++ipad_1g MACH_IPAD_1G IPAD_1G 3593
++appletv_2g MACH_APPLETV_2G APPLETV_2G 3594
++mach_ecog45 MACH_MACH_ECOG45 MACH_ECOG45 3595
++ait_cam_enc_4xx MACH_AIT_CAM_ENC_4XX AIT_CAM_ENC_4XX 3596
++runnymede MACH_RUNNYMEDE RUNNYMEDE 3597
++play MACH_PLAY PLAY 3598
++hw90260 MACH_HW90260 HW90260 3599
++tagh MACH_TAGH TAGH 3600
++filbert MACH_FILBERT FILBERT 3601
++getinge_netcomv3 MACH_GETINGE_NETCOMV3 GETINGE_NETCOMV3 3602
++cw20 MACH_CW20 CW20 3603
++cinema MACH_CINEMA CINEMA 3604
++cinema_tea MACH_CINEMA_TEA CINEMA_TEA 3605
++cinema_coffee MACH_CINEMA_COFFEE CINEMA_COFFEE 3606
++cinema_juice MACH_CINEMA_JUICE CINEMA_JUICE 3607
++mx53_mirage2 MACH_MX53_MIRAGE2 MX53_MIRAGE2 3609
++mx53_efikasb MACH_MX53_EFIKASB MX53_EFIKASB 3610
++stm_b2000 MACH_STM_B2000 STM_B2000 3612
+ m28evk MACH_M28EVK M28EVK 3613
++pda MACH_PDA PDA 3614
++meraki_mr58 MACH_MERAKI_MR58 MERAKI_MR58 3615
++kota2 MACH_KOTA2 KOTA2 3616
++letcool MACH_LETCOOL LETCOOL 3617
++mx27iat MACH_MX27IAT MX27IAT 3618
++apollo_td MACH_APOLLO_TD APOLLO_TD 3619
++arena MACH_ARENA ARENA 3620
++gsngateway MACH_GSNGATEWAY GSNGATEWAY 3621
++lf2000 MACH_LF2000 LF2000 3622
++bonito MACH_BONITO BONITO 3623
++asymptote MACH_ASYMPTOTE ASYMPTOTE 3624
++bst2brd MACH_BST2BRD BST2BRD 3625
++tx335s MACH_TX335S TX335S 3626
++pelco_tesla MACH_PELCO_TESLA PELCO_TESLA 3627
++rrhtestplat MACH_RRHTESTPLAT RRHTESTPLAT 3628
++vidtonic_pro MACH_VIDTONIC_PRO VIDTONIC_PRO 3629
++pl_apollo MACH_PL_APOLLO PL_APOLLO 3630
++pl_phoenix MACH_PL_PHOENIX PL_PHOENIX 3631
++m28cu3 MACH_M28CU3 M28CU3 3632
++vvbox_hd MACH_VVBOX_HD VVBOX_HD 3633
++coreware_sam9260_ MACH_COREWARE_SAM9260_ COREWARE_SAM9260_ 3634
++marmaduke MACH_MARMADUKE MARMADUKE 3635
++amg_xlcore_camera MACH_AMG_XLCORE_CAMERA AMG_XLCORE_CAMERA 3636
++omap3_egf MACH_OMAP3_EGF OMAP3_EGF 3637
+ smdk4212 MACH_SMDK4212 SMDK4212 3638
++dnp9200 MACH_DNP9200 DNP9200 3639
++tf101 MACH_TF101 TF101 3640
++omap3silvio MACH_OMAP3SILVIO OMAP3SILVIO 3641
++picasso2 MACH_PICASSO2 PICASSO2 3642
++vangogh2 MACH_VANGOGH2 VANGOGH2 3643
++olpc_xo_1_75 MACH_OLPC_XO_1_75 OLPC_XO_1_75 3644
++gx400 MACH_GX400 GX400 3645
++gs300 MACH_GS300 GS300 3646
++acer_a9 MACH_ACER_A9 ACER_A9 3647
++vivow_evm MACH_VIVOW_EVM VIVOW_EVM 3648
++veloce_cxq MACH_VELOCE_CXQ VELOCE_CXQ 3649
++veloce_cxm MACH_VELOCE_CXM VELOCE_CXM 3650
++p1852 MACH_P1852 P1852 3651
++naxy100 MACH_NAXY100 NAXY100 3652
++taishan MACH_TAISHAN TAISHAN 3653
++touchlink MACH_TOUCHLINK TOUCHLINK 3654
++stm32f103ze MACH_STM32F103ZE STM32F103ZE 3655
++mcx MACH_MCX MCX 3656
++stm_nmhdk_fli7610 MACH_STM_NMHDK_FLI7610 STM_NMHDK_FLI7610 3657
++top28x MACH_TOP28X TOP28X 3658
++okl4vp_microvisor MACH_OKL4VP_MICROVISOR OKL4VP_MICROVISOR 3659
++pop MACH_POP POP 3660
++layer MACH_LAYER LAYER 3661
++trondheim MACH_TRONDHEIM TRONDHEIM 3662
++eva MACH_EVA EVA 3663
++trust_taurus MACH_TRUST_TAURUS TRUST_TAURUS 3664
++ns2816_huashan MACH_NS2816_HUASHAN NS2816_HUASHAN 3665
++ns2816_yangcheng MACH_NS2816_YANGCHENG NS2816_YANGCHENG 3666
++p852 MACH_P852 P852 3667
++flea3 MACH_FLEA3 FLEA3 3668
++bowfin MACH_BOWFIN BOWFIN 3669
++mv88de3100 MACH_MV88DE3100 MV88DE3100 3670
++pia_am35x MACH_PIA_AM35X PIA_AM35X 3671
++cedar MACH_CEDAR CEDAR 3672
++picasso_e MACH_PICASSO_E PICASSO_E 3673
++samsung_e60 MACH_SAMSUNG_E60 SAMSUNG_E60 3674
++sdvr_mini MACH_SDVR_MINI SDVR_MINI 3676
++omap3_ij3k MACH_OMAP3_IJ3K OMAP3_IJ3K 3677
++modasmc1 MACH_MODASMC1 MODASMC1 3678
++apq8064_rumi3 MACH_APQ8064_RUMI3 APQ8064_RUMI3 3679
++matrix506 MACH_MATRIX506 MATRIX506 3680
++msm9615_mtp MACH_MSM9615_MTP MSM9615_MTP 3681
++dm36x_spawndc MACH_DM36X_SPAWNDC DM36X_SPAWNDC 3682
++sff792 MACH_SFF792 SFF792 3683
++am335xiaevm MACH_AM335XIAEVM AM335XIAEVM 3684
++g3c2440 MACH_G3C2440 G3C2440 3685
++tion270 MACH_TION270 TION270 3686
++w22q7arm02 MACH_W22Q7ARM02 W22Q7ARM02 3687
++omap_cat MACH_OMAP_CAT OMAP_CAT 3688
++at91sam9n12ek MACH_AT91SAM9N12EK AT91SAM9N12EK 3689
++morrison MACH_MORRISON MORRISON 3690
++svdu MACH_SVDU SVDU 3691
++lpp01 MACH_LPP01 LPP01 3692
++ubc283 MACH_UBC283 UBC283 3693
++zeppelin MACH_ZEPPELIN ZEPPELIN 3694
++motus MACH_MOTUS MOTUS 3695
++neomainboard MACH_NEOMAINBOARD NEOMAINBOARD 3696
++devkit3250 MACH_DEVKIT3250 DEVKIT3250 3697
++devkit7000 MACH_DEVKIT7000 DEVKIT7000 3698
++fmc_uic MACH_FMC_UIC FMC_UIC 3699
++fmc_dcm MACH_FMC_DCM FMC_DCM 3700
++batwm MACH_BATWM BATWM 3701
++atlas6cb MACH_ATLAS6CB ATLAS6CB 3702
++blue MACH_BLUE BLUE 3705
++colorado MACH_COLORADO COLORADO 3706
++popc MACH_POPC POPC 3707
++promwad_jade MACH_PROMWAD_JADE PROMWAD_JADE 3708
++amp MACH_AMP AMP 3709
++gnet_amp MACH_GNET_AMP GNET_AMP 3710
++toques MACH_TOQUES TOQUES 3711
++dct_storm MACH_DCT_STORM DCT_STORM 3713
++owl MACH_OWL OWL 3715
++cogent_csb1741 MACH_COGENT_CSB1741 COGENT_CSB1741 3716
++adillustra610 MACH_ADILLUSTRA610 ADILLUSTRA610 3718
++ecafe_na04 MACH_ECAFE_NA04 ECAFE_NA04 3719
++popct MACH_POPCT POPCT 3720
++omap3_helena MACH_OMAP3_HELENA OMAP3_HELENA 3721
++ach MACH_ACH ACH 3722
++module_dtb MACH_MODULE_DTB MODULE_DTB 3723
++oslo_elisabeth MACH_OSLO_ELISABETH OSLO_ELISABETH 3725
++tt01 MACH_TT01 TT01 3726
++msm8930_cdp MACH_MSM8930_CDP MSM8930_CDP 3727
++msm8930_mtp MACH_MSM8930_MTP MSM8930_MTP 3728
++msm8930_fluid MACH_MSM8930_FLUID MSM8930_FLUID 3729
++ltu11 MACH_LTU11 LTU11 3730
++am1808_spawnco MACH_AM1808_SPAWNCO AM1808_SPAWNCO 3731
++flx6410 MACH_FLX6410 FLX6410 3732
++mx6q_qsb MACH_MX6Q_QSB MX6Q_QSB 3733
++mx53_plt424 MACH_MX53_PLT424 MX53_PLT424 3734
++jasmine MACH_JASMINE JASMINE 3735
++l138_owlboard_plus MACH_L138_OWLBOARD_PLUS L138_OWLBOARD_PLUS 3736
++wr21 MACH_WR21 WR21 3737
++peaboy MACH_PEABOY PEABOY 3739
++mx28_plato MACH_MX28_PLATO MX28_PLATO 3740
++kacom2 MACH_KACOM2 KACOM2 3741
++slco MACH_SLCO SLCO 3742
++imx51pico MACH_IMX51PICO IMX51PICO 3743
++glink1 MACH_GLINK1 GLINK1 3744
++diamond MACH_DIAMOND DIAMOND 3745
++d9000 MACH_D9000 D9000 3746
++w5300e01 MACH_W5300E01 W5300E01 3747
++im6000 MACH_IM6000 IM6000 3748
++mx51_fred51 MACH_MX51_FRED51 MX51_FRED51 3749
++stm32f2 MACH_STM32F2 STM32F2 3750
++ville MACH_VILLE VILLE 3751
++ptip_murnau MACH_PTIP_MURNAU PTIP_MURNAU 3752
++ptip_classic MACH_PTIP_CLASSIC PTIP_CLASSIC 3753
++mx53grb MACH_MX53GRB MX53GRB 3754
++gagarin MACH_GAGARIN GAGARIN 3755
++nas2big MACH_NAS2BIG NAS2BIG 3757
++superfemto MACH_SUPERFEMTO SUPERFEMTO 3758
++teufel MACH_TEUFEL TEUFEL 3759
++dinara MACH_DINARA DINARA 3760
++vanquish MACH_VANQUISH VANQUISH 3761
++zipabox1 MACH_ZIPABOX1 ZIPABOX1 3762
++u9540 MACH_U9540 U9540 3763
++jet MACH_JET JET 3764
+ smdk4412 MACH_SMDK4412 SMDK4412 3765
++elite MACH_ELITE ELITE 3766
++spear320_hmi MACH_SPEAR320_HMI SPEAR320_HMI 3767
++ontario MACH_ONTARIO ONTARIO 3768
++mx6q_sabrelite MACH_MX6Q_SABRELITE MX6Q_SABRELITE 3769
++vc200 MACH_VC200 VC200 3770
++msm7625a_ffa MACH_MSM7625A_FFA MSM7625A_FFA 3771
++msm7625a_surf MACH_MSM7625A_SURF MSM7625A_SURF 3772
++benthossbp MACH_BENTHOSSBP BENTHOSSBP 3773
++smdk5210 MACH_SMDK5210 SMDK5210 3774
++empq2300 MACH_EMPQ2300 EMPQ2300 3775
++minipos MACH_MINIPOS MINIPOS 3776
++omap5_sevm MACH_OMAP5_SEVM OMAP5_SEVM 3777
++shelter MACH_SHELTER SHELTER 3778
++omap3_devkit8500 MACH_OMAP3_DEVKIT8500 OMAP3_DEVKIT8500 3779
++edgetd MACH_EDGETD EDGETD 3780
++copperyard MACH_COPPERYARD COPPERYARD 3781
++edge MACH_EDGE EDGE 3782
++edge_u MACH_EDGE_U EDGE_U 3783
++edge_td MACH_EDGE_TD EDGE_TD 3784
++wdss MACH_WDSS WDSS 3785
++dl_pb25 MACH_DL_PB25 DL_PB25 3786
++dss11 MACH_DSS11 DSS11 3787
++cpa MACH_CPA CPA 3788
++aptp2000 MACH_APTP2000 APTP2000 3789
++marzen MACH_MARZEN MARZEN 3790
++st_turbine MACH_ST_TURBINE ST_TURBINE 3791
++gtl_it3300 MACH_GTL_IT3300 GTL_IT3300 3792
++mx6_mule MACH_MX6_MULE MX6_MULE 3793
++v7pxa_dt MACH_V7PXA_DT V7PXA_DT 3794
++v7mmp_dt MACH_V7MMP_DT V7MMP_DT 3795
++dragon7 MACH_DRAGON7 DRAGON7 3796
++krome MACH_KROME KROME 3797
++oratisdante MACH_ORATISDANTE ORATISDANTE 3798
++fathom MACH_FATHOM FATHOM 3799
++dns325 MACH_DNS325 DNS325 3800
++sarnen MACH_SARNEN SARNEN 3801
++ubisys_g1 MACH_UBISYS_G1 UBISYS_G1 3802
++mx53_pf1 MACH_MX53_PF1 MX53_PF1 3803
++asanti MACH_ASANTI ASANTI 3804
++volta MACH_VOLTA VOLTA 3805
++knight MACH_KNIGHT KNIGHT 3807
++beaglebone MACH_BEAGLEBONE BEAGLEBONE 3808
++becker MACH_BECKER BECKER 3809
++fc360 MACH_FC360 FC360 3810
++pmi2_xls MACH_PMI2_XLS PMI2_XLS 3811
++taranto MACH_TARANTO TARANTO 3812
++plutux MACH_PLUTUX PLUTUX 3813
++ipmp_medcom MACH_IPMP_MEDCOM IPMP_MEDCOM 3814
++absolut MACH_ABSOLUT ABSOLUT 3815
++awpb3 MACH_AWPB3 AWPB3 3816
++nfp32xx_dt MACH_NFP32XX_DT NFP32XX_DT 3817
++dl_pb53 MACH_DL_PB53 DL_PB53 3818
++acu_ii MACH_ACU_II ACU_II 3819
++avalon MACH_AVALON AVALON 3820
++sphinx MACH_SPHINX SPHINX 3821
++titan_t MACH_TITAN_T TITAN_T 3822
++harvest_boris MACH_HARVEST_BORIS HARVEST_BORIS 3823
++mach_msm7x30_m3s MACH_MACH_MSM7X30_M3S MACH_MSM7X30_M3S 3824
++smdk5250 MACH_SMDK5250 SMDK5250 3825
++imxt_lite MACH_IMXT_LITE IMXT_LITE 3826
++imxt_std MACH_IMXT_STD IMXT_STD 3827
++imxt_log MACH_IMXT_LOG IMXT_LOG 3828
++imxt_nav MACH_IMXT_NAV IMXT_NAV 3829
++imxt_full MACH_IMXT_FULL IMXT_FULL 3830
++ag09015 MACH_AG09015 AG09015 3831
++am3517_mt_ventoux MACH_AM3517_MT_VENTOUX AM3517_MT_VENTOUX 3832
++dp1arm9 MACH_DP1ARM9 DP1ARM9 3833
++picasso_m MACH_PICASSO_M PICASSO_M 3834
++video_gadget MACH_VIDEO_GADGET VIDEO_GADGET 3835
++mtt_om3x MACH_MTT_OM3X MTT_OM3X 3836
++mx6q_arm2 MACH_MX6Q_ARM2 MX6Q_ARM2 3837
++picosam9g45 MACH_PICOSAM9G45 PICOSAM9G45 3838
++vpm_dm365 MACH_VPM_DM365 VPM_DM365 3839
++bonfire MACH_BONFIRE BONFIRE 3840
++mt2p2d MACH_MT2P2D MT2P2D 3841
++sigpda01 MACH_SIGPDA01 SIGPDA01 3842
++cn27 MACH_CN27 CN27 3843
++mx25_cwtap MACH_MX25_CWTAP MX25_CWTAP 3844
++apf28 MACH_APF28 APF28 3845
++pelco_maxwell MACH_PELCO_MAXWELL PELCO_MAXWELL 3846
++ge_phoenix MACH_GE_PHOENIX GE_PHOENIX 3847
++empc_a500 MACH_EMPC_A500 EMPC_A500 3848
++ims_arm9 MACH_IMS_ARM9 IMS_ARM9 3849
++mini2416 MACH_MINI2416 MINI2416 3850
++mini2450 MACH_MINI2450 MINI2450 3851
++mini310 MACH_MINI310 MINI310 3852
++spear_hurricane MACH_SPEAR_HURRICANE SPEAR_HURRICANE 3853
++mt7208 MACH_MT7208 MT7208 3854
++lpc178x MACH_LPC178X LPC178X 3855
++farleys MACH_FARLEYS FARLEYS 3856
++efm32gg_dk3750 MACH_EFM32GG_DK3750 EFM32GG_DK3750 3857
++zeus_board MACH_ZEUS_BOARD ZEUS_BOARD 3858
++cc51 MACH_CC51 CC51 3859
++fxi_c210 MACH_FXI_C210 FXI_C210 3860
++msm8627_cdp MACH_MSM8627_CDP MSM8627_CDP 3861
++msm8627_mtp MACH_MSM8627_MTP MSM8627_MTP 3862
++armadillo800eva MACH_ARMADILLO800EVA ARMADILLO800EVA 3863
++primou MACH_PRIMOU PRIMOU 3864
++primoc MACH_PRIMOC PRIMOC 3865
++primoct MACH_PRIMOCT PRIMOCT 3866
++a9500 MACH_A9500 A9500 3867
++pluto MACH_PLUTO PLUTO 3869
++acfx100 MACH_ACFX100 ACFX100 3870
++msm8625_rumi3 MACH_MSM8625_RUMI3 MSM8625_RUMI3 3871
++valente MACH_VALENTE VALENTE 3872
++crfs_rfeye MACH_CRFS_RFEYE CRFS_RFEYE 3873
++rfeye MACH_RFEYE RFEYE 3874
++phidget_sbc3 MACH_PHIDGET_SBC3 PHIDGET_SBC3 3875
++tcw_mika MACH_TCW_MIKA TCW_MIKA 3876
++imx28_egf MACH_IMX28_EGF IMX28_EGF 3877
++valente_wx MACH_VALENTE_WX VALENTE_WX 3878
++huangshans MACH_HUANGSHANS HUANGSHANS 3879
++bosphorus1 MACH_BOSPHORUS1 BOSPHORUS1 3880
++prima MACH_PRIMA PRIMA 3881
++evita_ulk MACH_EVITA_ULK EVITA_ULK 3884
++merisc600 MACH_MERISC600 MERISC600 3885
++dolak MACH_DOLAK DOLAK 3886
++sbc53 MACH_SBC53 SBC53 3887
++elite_ulk MACH_ELITE_ULK ELITE_ULK 3888
++pov2 MACH_POV2 POV2 3889
++ipod_touch_2g MACH_IPOD_TOUCH_2G IPOD_TOUCH_2G 3890
++da850_pqab MACH_DA850_PQAB DA850_PQAB 3891
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0248-ARM-mach-shmobile-add-armadillo800eva-board-support.patch b/patches.armadillo800eva/0248-ARM-mach-shmobile-add-armadillo800eva-board-support.patch
new file mode 100644
index 00000000000000..c3361f29a74e63
--- /dev/null
+++ b/patches.armadillo800eva/0248-ARM-mach-shmobile-add-armadillo800eva-board-support.patch
@@ -0,0 +1,235 @@
+From ec162728d99e6a7bf4cb77588700519c7e991934 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Fri, 6 Apr 2012 01:28:59 -0700
+Subject: ARM: mach-shmobile: add armadillo800eva board support.
+
+This adds very basic armadillo800eva board (R-Mobile A1) support
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+(cherry picked from commit 092928a134e4a5a78b8dff9ce58cb6832da14a9d)
+
+Conflicts:
+
+ arch/arm/mach-shmobile/Kconfig
+ arch/arm/mach-shmobile/Makefile
+
+N.B: This patch is not present in mainline yet
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/Kconfig | 10 +-
+ arch/arm/mach-shmobile/Makefile | 1 +
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 154 ++++++++++++++++++++++++
+ 3 files changed, 163 insertions(+), 2 deletions(-)
+ create mode 100644 arch/arm/mach-shmobile/board-armadillo800eva.c
+
+diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
+index 193f011..7a1b589 100644
+--- a/arch/arm/mach-shmobile/Kconfig
++++ b/arch/arm/mach-shmobile/Kconfig
+@@ -75,6 +75,11 @@ config MACH_MACKEREL
+ depends on ARCH_SH7372
+ select ARCH_REQUIRE_GPIOLIB
+
++config MACH_ARMADILLO800EVA
++ bool "Armadillo-800 EVA board"
++ depends on ARCH_R8A7740
++ select ARCH_REQUIRE_GPIOLIB
++
+ comment "SH-Mobile System Configuration"
+
+ config CPU_HAS_INTEVT
+@@ -87,7 +92,8 @@ config MEMORY_START
+ hex "Physical memory start address"
+ default "0x50000000" if MACH_G3EVM
+ default "0x40000000" if MACH_G4EVM || MACH_AP4EVB || MACH_AG5EVM || \
+- MACH_MACKEREL
++ MACH_MACKEREL || MACH_ARMADILLO800EVA
++ default "0x41000000" if MACH_KOTA2
+ default "0x00000000"
+ ---help---
+ Tweak this only when porting to a new machine which does not
+@@ -98,7 +104,7 @@ config MEMORY_SIZE
+ hex "Physical memory size"
+ default "0x08000000" if MACH_G3EVM
+ default "0x08000000" if MACH_G4EVM
+- default "0x20000000" if MACH_AG5EVM
++ default "0x20000000" if MACH_AG5EVM || MACH_ARMADILLO800EVA
+ default "0x10000000" if MACH_AP4EVB || MACH_MACKEREL
+ default "0x04000000"
+ help
+diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
+index d76ad60..c599c5c 100644
+--- a/arch/arm/mach-shmobile/Makefile
++++ b/arch/arm/mach-shmobile/Makefile
+@@ -44,6 +44,7 @@ obj-$(CONFIG_MACH_G4EVM) += board-g4evm.o
+ obj-$(CONFIG_MACH_AP4EVB) += board-ap4evb.o
+ obj-$(CONFIG_MACH_AG5EVM) += board-ag5evm.o
+ obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
++obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
+
+ # Framework support
+ obj-$(CONFIG_SMP) += $(smp-y)
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+new file mode 100644
+index 0000000..28bc259
+--- /dev/null
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -0,0 +1,154 @@
++/*
++ * 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.
++ *
++ * 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/clk.h>
++#include <linux/err.h>
++#include <linux/kernel.h>
++#include <linux/platform_device.h>
++#include <linux/gpio.h>
++#include <mach/common.h>
++#include <mach/irqs.h>
++#include <asm/page.h>
++#include <asm/mach-types.h>
++#include <asm/mach/arch.h>
++#include <asm/mach/map.h>
++#include <asm/mach/time.h>
++#include <asm/hardware/cache-l2x0.h>
++#include <mach/r8a7740.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 enable, COM14 disable
++ * 1 | SDHI1 | COM8 enable, COM14 disable
++ * -12345678-+---------------+----------------------------
++ * 00 | JTAG | SH-X2
++ * 10 | JTAG | ARM
++ * 01 | JTAG | -
++ * 11 | JTAG | Boundary Scan
++ *-----------+---------------+----------------------------
++ */
++
++/*
++ * board devices
++ */
++static struct platform_device *eva_devices[] __initdata = {
++};
++
++/*
++ * board init
++ */
++static void __init eva_init(void)
++{
++ r8a7740_pinmux_init();
++
++ /* SCIFA1 */
++ gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
++ gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
++
++#ifdef CONFIG_CACHE_L2X0
++ /* Early BRESP enable, Shared attribute override enable, 32K*8way */
++ l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
++#endif
++
++ r8a7740_add_standard_devices();
++
++ platform_add_devices(eva_devices,
++ ARRAY_SIZE(eva_devices));
++}
++
++static void __init eva_earlytimer_init(void)
++{
++ struct clk *xtal1;
++
++ r8a7740_clock_init(MD_CK0 | MD_CK2);
++
++ xtal1 = clk_get(NULL, "extal1");
++ if (!IS_ERR(xtal1)) {
++ /* armadillo 800 eva extal1 is 24MHz */
++ clk_set_rate(xtal1, 24000000);
++ clk_put(xtal1);
++ }
++
++ shmobile_earlytimer_init();
++}
++
++static void __init eva_add_early_devices(void)
++{
++ r8a7740_add_early_devices();
++
++ /* override timer setup with board-specific code */
++ shmobile_timer.init = eva_earlytimer_init;
++}
++
++MACHINE_START(ARMADILLO800EVA, "armadillo800eva")
++ .map_io = r8a7740_map_io,
++ .init_early = eva_add_early_devices,
++ .init_irq = r8a7740_init_irq,
++ .handle_irq = shmobile_handle_irq_intc,
++ .init_machine = eva_init,
++ .timer = &shmobile_timer,
++MACHINE_END
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0249-ARM-mach-shmobile-armadillo800eva-add-defconfig.patch b/patches.armadillo800eva/0249-ARM-mach-shmobile-armadillo800eva-add-defconfig.patch
new file mode 100644
index 00000000000000..9193ee488d6836
--- /dev/null
+++ b/patches.armadillo800eva/0249-ARM-mach-shmobile-armadillo800eva-add-defconfig.patch
@@ -0,0 +1,168 @@
+From 230fd371ea4a506ebb29bfdbb693e80044cb2382 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Fri, 6 Apr 2012 01:29:36 -0700
+Subject: ARM: mach-shmobile: armadillo800eva: add defconfig
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+(cherry picked from commit 5cb573538167cf45a9f9019efed1e8da244a19ed)
+
+N.B: This patch is not present in mainline yet
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/configs/armadillo800eva_defconfig | 143 ++++++++++++++++++++++++++++
+ 1 file changed, 143 insertions(+)
+ create mode 100644 arch/arm/configs/armadillo800eva_defconfig
+
+diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
+new file mode 100644
+index 0000000..0d20749
+--- /dev/null
++++ b/arch/arm/configs/armadillo800eva_defconfig
+@@ -0,0 +1,143 @@
++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_USER_NS is not set
++# CONFIG_PID_NS is not set
++CONFIG_SYSFS_DEPRECATED=y
++CONFIG_SYSFS_DEPRECATED_V2=y
++CONFIG_CC_OPTIMIZE_FOR_SIZE=y
++CONFIG_KALLSYMS_ALL=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=y
++CONFIG_ARCH_R8A7740=y
++CONFIG_MACH_ARMADILLO800EVA=y
++# CONFIG_SH_TIMER_TMU is not set
++# CONFIG_ARM_THUMB is not set
++CONFIG_CPU_BPREDICT_DISABLE=y
++# CONFIG_CACHE_L2X0 is not set
++CONFIG_ARM_ERRATA_430973=y
++CONFIG_ARM_ERRATA_458693=y
++CONFIG_ARM_ERRATA_460075=y
++CONFIG_ARM_ERRATA_720789=y
++CONFIG_ARM_ERRATA_743622=y
++CONFIG_ARM_ERRATA_751472=y
++CONFIG_ARM_ERRATA_754322=y
++CONFIG_AEABI=y
++# CONFIG_OABI_COMPAT is not set
++CONFIG_FORCE_MAX_ZONEORDER=13
++CONFIG_ZBOOT_ROM_TEXT=0x0
++CONFIG_ZBOOT_ROM_BSS=0x0
++CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 earlyprintk=sh-sci.1,115200 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096"
++CONFIG_CMDLINE_FORCE=y
++CONFIG_KEXEC=y
++# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
++# CONFIG_SUSPEND is not set
++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_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_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_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=8
++CONFIG_SERIAL_SH_SCI_CONSOLE=y
++# CONFIG_HW_RANDOM is not set
++CONFIG_I2C=y
++CONFIG_I2C_SH_MOBILE=y
++# CONFIG_HWMON is not set
++CONFIG_FB=y
++CONFIG_FB_MODE_HELPERS=y
++CONFIG_FB_SH_MOBILE_LCDC=y
++CONFIG_LCD_CLASS_DEVICE=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_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_SOC=y
++CONFIG_SND_SOC_SH4_FSI=y
++# CONFIG_HID_SUPPORT is not set
++# CONFIG_USB_SUPPORT is not set
++CONFIG_UIO=y
++CONFIG_UIO_PDRV_GENIRQ=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=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_MAGIC_SYSRQ=y
++CONFIG_DEBUG_SECTION_MISMATCH=y
++CONFIG_DEBUG_KERNEL=y
++CONFIG_LOCKUP_DETECTOR=y
++CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
++# CONFIG_DETECT_HUNG_TASK is not set
++# CONFIG_SCHED_DEBUG is not set
++CONFIG_DEBUG_KMEMLEAK=y
++CONFIG_DEBUG_SPINLOCK=y
++CONFIG_DEBUG_INFO=y
++# CONFIG_FTRACE 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
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0250-ARM-mach-shmobile-armadillo800eva-add-support-LCDC0.patch b/patches.armadillo800eva/0250-ARM-mach-shmobile-armadillo800eva-add-support-LCDC0.patch
new file mode 100644
index 00000000000000..48eced779711a9
--- /dev/null
+++ b/patches.armadillo800eva/0250-ARM-mach-shmobile-armadillo800eva-add-support-LCDC0.patch
@@ -0,0 +1,159 @@
+From a622587f6d7ca484b22fb50badafe8a377bc8456 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Fri, 6 Apr 2012 01:30:09 -0700
+Subject: ARM: mach-shmobile: armadillo800eva: add support LCDC0
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+(cherry picked from commit 9699241a8c9b249a9d970cc81a5d4b2dbbcdad68)
+
+N.B: This patch is not present in mainline yet
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 105 ++++++++++++++++++++++++
+ 1 file changed, 105 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 28bc259..5cc17a8 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -24,6 +24,7 @@
+ #include <linux/kernel.h>
+ #include <linux/platform_device.h>
+ #include <linux/gpio.h>
++#include <linux/videodev2.h>
+ #include <mach/common.h>
+ #include <mach/irqs.h>
+ #include <asm/page.h>
+@@ -33,6 +34,7 @@
+ #include <asm/mach/time.h>
+ #include <asm/hardware/cache-l2x0.h>
+ #include <mach/r8a7740.h>
++#include <video/sh_mobile_lcdc.h>
+
+ /*
+ * CON1 Camera Module
+@@ -92,10 +94,66 @@
+ *-----------+---------------+----------------------------
+ */
+
++/* LCDC */
++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 = intcs_evt2irq(0x580),
++ .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 = ~0,
++ },
++};
++
+ /*
+ * board devices
+ */
+ static struct platform_device *eva_devices[] __initdata = {
++ &lcdc0_device,
+ };
+
+ /*
+@@ -109,6 +167,53 @@ static void __init eva_init(void)
+ gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
+ gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
+
++ /* LCDC0 */
++ gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
++ gpio_request(GPIO_FN_LCD0_D0, NULL);
++ gpio_request(GPIO_FN_LCD0_D1, NULL);
++ gpio_request(GPIO_FN_LCD0_D2, NULL);
++ gpio_request(GPIO_FN_LCD0_D3, NULL);
++ gpio_request(GPIO_FN_LCD0_D4, NULL);
++ gpio_request(GPIO_FN_LCD0_D5, NULL);
++ gpio_request(GPIO_FN_LCD0_D6, NULL);
++ gpio_request(GPIO_FN_LCD0_D7, NULL);
++ gpio_request(GPIO_FN_LCD0_D8, NULL);
++ gpio_request(GPIO_FN_LCD0_D9, NULL);
++ gpio_request(GPIO_FN_LCD0_D10, NULL);
++ gpio_request(GPIO_FN_LCD0_D11, NULL);
++ gpio_request(GPIO_FN_LCD0_D12, NULL);
++ gpio_request(GPIO_FN_LCD0_D13, NULL);
++ gpio_request(GPIO_FN_LCD0_D14, NULL);
++ gpio_request(GPIO_FN_LCD0_D15, NULL);
++ gpio_request(GPIO_FN_LCD0_D16, NULL);
++ gpio_request(GPIO_FN_LCD0_D17, NULL);
++ gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
++ gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
++ gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
++ gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
++ gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
++ gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
++ gpio_request(GPIO_FN_LCD0_DCK, NULL);
++ gpio_request(GPIO_FN_LCD0_VSYN, NULL);
++ gpio_request(GPIO_FN_LCD0_HSYN, NULL);
++ gpio_request(GPIO_FN_LCD0_DISP, NULL);
++ gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
++
++ gpio_request(GPIO_PORT61, NULL); /* LCDDON */
++ gpio_direction_output(GPIO_PORT61, 1);
++
++ gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
++ gpio_direction_output(GPIO_PORT202, 0);
++
++ /*
++ * CAUTION
++ *
++ * DBGMD/LCDC0/FSIA MUX
++ * DBGMD_SELECT_B should be set after setting PFC Function.
++ */
++ gpio_request(GPIO_PORT176, NULL);
++ gpio_direction_output(GPIO_PORT176, 1);
++
+ #ifdef CONFIG_CACHE_L2X0
+ /* Early BRESP enable, Shared attribute override enable, 32K*8way */
+ l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0251-ARM-mach-shmobile-armadillo800eva-add-support-ST1232.patch b/patches.armadillo800eva/0251-ARM-mach-shmobile-armadillo800eva-add-support-ST1232.patch
new file mode 100644
index 00000000000000..6e266bad504fb0
--- /dev/null
+++ b/patches.armadillo800eva/0251-ARM-mach-shmobile-armadillo800eva-add-support-ST1232.patch
@@ -0,0 +1,58 @@
+From bbe0b11d8e7e4bae235e6e4297f6c7338937e919 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Fri, 6 Apr 2012 01:30:42 -0700
+Subject: ARM: mach-shmobile: armadillo800eva: add support ST1232
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+(cherry picked from commit 5f0c97e98875539868fd11a0432cb9460bf75b6d)
+
+N.B: This patch is not present in mainline yet
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 5cc17a8..74213e3 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -149,6 +149,14 @@ static struct platform_device lcdc0_device = {
+ },
+ };
+
++/* I2C */
++static struct i2c_board_info i2c0_devices[] = {
++ {
++ I2C_BOARD_INFO("st1232-ts", 0x55),
++ .irq = evt2irq(0x0340),
++ },
++};
++
+ /*
+ * board devices
+ */
+@@ -205,6 +213,11 @@ static void __init eva_init(void)
+ gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
+ gpio_direction_output(GPIO_PORT202, 0);
+
++ /* Touchscreen */
++ gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
++ gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
++ gpio_direction_output(GPIO_PORT166, 1);
++
+ /*
+ * CAUTION
+ *
+@@ -219,6 +232,8 @@ static void __init eva_init(void)
+ l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
+ #endif
+
++ i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
++
+ r8a7740_add_standard_devices();
+
+ platform_add_devices(eva_devices,
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0252-ARM-mach-shmobile-armadillo800eva-add-support-gpio_k.patch b/patches.armadillo800eva/0252-ARM-mach-shmobile-armadillo800eva-add-support-gpio_k.patch
new file mode 100644
index 00000000000000..2b86687181843a
--- /dev/null
+++ b/patches.armadillo800eva/0252-ARM-mach-shmobile-armadillo800eva-add-support-gpio_k.patch
@@ -0,0 +1,69 @@
+From 602cf848bee1f0c0c6493c160f382e1cdc976c74 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Fri, 6 Apr 2012 01:31:33 -0700
+Subject: ARM: mach-shmobile: armadillo800eva: add support gpio_key
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+(cherry picked from commit 8afd7b1b2111c2a1375f197af4ceb77e3348a25c)
+
+N.B: This patch is not present in mainline yet
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 26 ++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 74213e3..8bb4d27 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -22,8 +22,10 @@
+ #include <linux/clk.h>
+ #include <linux/err.h>
+ #include <linux/kernel.h>
++#include <linux/input.h>
+ #include <linux/platform_device.h>
+ #include <linux/gpio.h>
++#include <linux/gpio_keys.h>
+ #include <linux/videodev2.h>
+ #include <mach/common.h>
+ #include <mach/irqs.h>
+@@ -157,11 +159,35 @@ static struct i2c_board_info i2c0_devices[] = {
+ },
+ };
+
++/* GPIO 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_POWER, GPIO_PORT99, "SW1"),
++ GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW2"),
++ GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW3"),
++ GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW4"),
++};
++
++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,
++ },
++};
++
+ /*
+ * board devices
+ */
+ static struct platform_device *eva_devices[] __initdata = {
+ &lcdc0_device,
++ &gpio_keys_device,
+ };
+
+ /*
+--
+1.7.10
+
diff --git a/patches.armadillo800eva/0253-ARM-mach-shmobile-armadillo800eva-add-support-sh_eth.patch b/patches.armadillo800eva/0253-ARM-mach-shmobile-armadillo800eva-add-support-sh_eth.patch
new file mode 100644
index 00000000000000..16daeeb30cfa51
--- /dev/null
+++ b/patches.armadillo800eva/0253-ARM-mach-shmobile-armadillo800eva-add-support-sh_eth.patch
@@ -0,0 +1,108 @@
+From 449c76dabd617e3f6c4f852dae7562dcf63e4c6d Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Fri, 6 Apr 2012 01:32:02 -0700
+Subject: ARM: mach-shmobile: armadillo800eva: add support sh_eth
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+(cherry picked from commit 8d6c8699cce91d5e221a4869e263ee0f7afcdca4)
+
+N.B: This patch is not present in mainline yet
+
+Signed-off-by: Simon Horman <horms@verge.net.au>
+---
+ arch/arm/mach-shmobile/board-armadillo800eva.c | 58 ++++++++++++++++++++++++
+ 1 file changed, 58 insertions(+)
+
+diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
+index 8bb4d27..c2affc4 100644
+--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
++++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
+@@ -26,6 +26,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/gpio.h>
+ #include <linux/gpio_keys.h>
++#include <linux/sh_eth.h>
+ #include <linux/videodev2.h>
+ #include <mach/common.h>
+ #include <mach/irqs.h>
+@@ -96,6 +97,38 @@
+ *-----------+---------------+----------------------------
+ */
+
++/* Ether */
++static struct sh_eth_plat_data sh_eth_platdata = {
++ .phy = 0x00, /* LAN8710A */
++ .edmac_endian = EDMAC_LITTLE_ENDIAN,
++ .register_type = SH_ETH_REG_GIGABIT,
++ .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 = evt2irq(0x0500),
++ .flags = IORESOURCE_IRQ,
++ },
++};
++
++static struct platform_device sh_eth_device = {
++ .name = "sh-eth",
++ .dev = {
++ .platform_data = &sh_eth_platdata,
++ },
++ .resource = sh_eth_resources,
++ .num_resources = ARRAY_SIZE(sh_eth_resources),
++};
++
+ /* LCDC */
+ static struct fb_videomode lcdc0_mode = {
+ .name = "AMPIER/AM-800480",
+@@ -188,6 +221,7 @@ static struct platform_device gpio_keys_device = {
+ static struct platform_device *eva_devices[] __initdata = {
+ &lcdc0_device,
+ &gpio_keys_device,
++ &sh_eth_device,
+ };
+
+ /*
+@@ -244,6 +278,30 @@ static void __init eva_init(void)
+ gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
+ gpio_direction_output(GPIO_PORT166, 1);
+
++ /* GETHER */
++ gpio_request(GPIO_FN_ET_CRS, NULL);
++ gpio_request(GPIO_FN_ET_MDC, NULL);
++ gpio_request(GPIO_FN_ET_MDIO, NULL);
++ gpio_request(GPIO_FN_ET_TX_ER, NULL);
++ gpio_request(GPIO_FN_ET_RX_ER, NULL);
++ gpio_request(GPIO_FN_ET_ERXD0, NULL);
++ gpio_request(GPIO_FN_ET_ERXD1, NULL);
++ gpio_request(GPIO_FN_ET_ERXD2, NULL);
++ gpio_request(GPIO_FN_ET_ERXD3, NULL);
++ gpio_request(GPIO_FN_ET_TX_CLK, NULL);
++ gpio_request(GPIO_FN_ET_TX_EN, NULL);
++ gpio_request(GPIO_FN_ET_ETXD0, NULL);
++ gpio_request(GPIO_FN_ET_ETXD1, NULL);
++ gpio_request(GPIO_FN_ET_ETXD2, NULL);
++ gpio_request(GPIO_FN_ET_ETXD3, NULL);
++ gpio_request(GPIO_FN_ET_PHY_INT, NULL);
++ gpio_request(GPIO_FN_ET_COL, NULL);
++ gpio_request(GPIO_FN_ET_RX_DV, NULL);
++ gpio_request(GPIO_FN_ET_RX_CLK, NULL);
++
++ gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
++ gpio_direction_output(GPIO_PORT18, 1);
++
+ /*
+ * CAUTION
+ *
+--
+1.7.10
+
diff --git a/series b/series
index b9a235ef5e0cbd..9d79672a8f69ad 100644
--- a/series
+++ b/series
@@ -53,14 +53,275 @@ patches.android/android-0037-Staging-android-Remove-pmem-driver.patch
patches.android/android-0038-Staging-android-binder-Fix-crashes-when-sharing-a-binder-fil.patch
patches.android/android-0039-staging-android-lowmemorykiller-Don-t-wait-more-than-one-sec.patch
patches.android/android-0040-staging-android-ram_console-Don-t-build-on-arches-w-o-iorema.patch
-
patches.android/staging-android-add-the-code-back-to-the-build.patch
-# non-upstream patches
+
+#############################################################################
+# backport of the armadillo800eva board and dependencies to
+# enable the SH Ethernet, LCDC (framebuffer), ST131232 (touchscreen), GPIO keys
+# and SCIF (sereial) drivers.
+patches.armadillo800eva/0001-module.h-split-out-the-EXPORT_SYMBOL-into-export.h.patch
+patches.armadillo800eva/0002-arm-Add-export.h-to-ARM-specific-files-as-required.patch
+patches.armadillo800eva/0003-ARM-mach-shmobile-cpuidle-single-global-and-last_sta.patch
+patches.armadillo800eva/0004-ARM-entry-re-allocate-registers-in-irq-entry-assembl.patch
+patches.armadillo800eva/0005-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch
+patches.armadillo800eva/0006-ARM-mach-shmobile-add-shmobile_earlytimer_init.patch
+patches.armadillo800eva/0007-ARM-mach-shmobile-default-to-no-earlytimer.patch
+patches.armadillo800eva/0008-ARM-shmobile-Consolidate-time-keeping-and-irq-enable.patch
+patches.armadillo800eva/0009-sh-pfc-get_config_reg-shift-clean-up.patch
+patches.armadillo800eva/0010-sh-pfc-Remove-unused-gpio_in_use-member.patch
+patches.armadillo800eva/0011-sh-pfc-Add-GPIO-IRQ-support.patch
+patches.armadillo800eva/0012-ARM-mach-shmobile-move-helper-macro-PORT_DATA_xx-to-.patch
+patches.armadillo800eva/0013-ARM-mach-shmobile-move-helper-macro-PORT_xx-to-sh_pf.patch
+patches.armadillo800eva/0014-ARM-mach-shmobile-move-helper-macro-PORTCR-to-sh_pfc.patch
+patches.armadillo800eva/0015-sh-pfc-ioremap-support.patch
+patches.armadillo800eva/0016-sh-pfc-Add-gpio_read_bit-for-data-register-access.patch
+patches.armadillo800eva/0017-sh-pfc-Convert-index-to-field-and-value-pair.patch
+patches.armadillo800eva/0018-sh-pfc-Add-config_reg_helper-function.patch
+patches.armadillo800eva/0019-sh-pfc-Variable-bitfield-width-config-register-suppo.patch
+patches.armadillo800eva/0020-sh-pfc-Unlock-register-support.patch
+patches.armadillo800eva/0021-ARM-mach-shmobile-Break-out-INTC-IRQ-code.patch
+patches.armadillo800eva/0022-sh-intc-enable-both-edges-GPIO-interrupts-on-sh7372.patch
+patches.armadillo800eva/0023-sh-intc-Add-IRQ-trigger-bit-field-check.patch
+patches.armadillo800eva/0024-sh-userimask.c-needs-linux-stat.h.patch
+patches.armadillo800eva/0025-sh-fix-implicit-use-of-stat.h-in-arch-sh-specific-fi.patch
+patches.armadillo800eva/0026-sh-Add-module.h-to-arch-sh-specific-files-as-require.patch
+patches.armadillo800eva/0027-sh-Add-export.h-to-arch-sh-specific-files-as-require.patch
+patches.armadillo800eva/0028-drivers-sh-Add-export.h-for-EXPORT_SYMBOL-to-intc-vi.patch
+patches.armadillo800eva/0029-driver-core-implement-sysdev-functionality-for-regul.patch
+patches.armadillo800eva/0030-sh-intc-Allow-triggering-on-both-edges-for-ARM-SoCs.patch
+patches.armadillo800eva/0031-sh-intc-convert-sysdev_class-to-a-regular-subsystem.patch
+patches.armadillo800eva/0032-PM-shmobile-Don-t-include-SH7372-s-INTCS-in-syscore-.patch
+patches.armadillo800eva/0033-sh-intc-unify-evt2irq-irq2evt-macros-for-sh-and-arm.patch
+patches.armadillo800eva/0034-sh-intc-Make-global-intc-controller-counter-static.patch
+patches.armadillo800eva/0035-genirq-Add-IRQCHIP_SKIP_SET_WAKE-flag.patch
+patches.armadillo800eva/0036-sh-intc-Prefer-IRQCHIP_SKIP_SET_WAKE-over-a-dummy-se.patch
+patches.armadillo800eva/0037-sh-intc-Kill-off-superfluous-irq_shutdown-hooking.patch
+patches.armadillo800eva/0038-sh-intc-Use-IRQ_SET_MASK_OK_NOCOPY-for-intc_set_affi.patch
+patches.armadillo800eva/0039-sh-intc-optimize-intc-IRQ-lookup.patch
+patches.armadillo800eva/0040-sh-intc-remove-dependency-on-NR_IRQS.patch
+patches.armadillo800eva/0041-sh-intc-Fix-up-section-mismatch-for-intc_ack_data.patch
+patches.armadillo800eva/0042-drivers-sh-late-disabling-of-clocks-V2.patch
+patches.armadillo800eva/0043-sh-clkfwk-Convert-to-IS_ERR_OR_NULL.patch
+patches.armadillo800eva/0044-sh-move-CLKDEV_xxx_ID-macro-to-sh_clk.h.patch
+patches.armadillo800eva/0045-switch-assorted-clock-drivers-to-debugfs_remove_recu.patch
+patches.armadillo800eva/0046-sh-clkfwk-add-clk_rate_mult_range_round.patch
+patches.armadillo800eva/0047-sh-clkfwk-Kill-off-remaining-debugfs-cruft.patch
+patches.armadillo800eva/0048-sh-clkfwk-setup-clock-parent-from-current-register-v.patch
+patches.armadillo800eva/0049-sh-extend-clock-struct-with-mapped_reg-member.patch
+patches.armadillo800eva/0050-sh-use-ioread32-iowrite32-and-mapped_reg-for-mstp32.patch
+patches.armadillo800eva/0051-sh-use-ioread32-iowrite32-and-mapped_reg-for-div4.patch
+patches.armadillo800eva/0052-sh-use-ioread32-iowrite32-and-mapped_reg-for-div6.patch
+patches.armadillo800eva/0053-sh-clkfwk-sh_clk_init_parent-should-be-called-after-.patch
+patches.armadillo800eva/0054-sh-clkfwk-bugfix-use-clk_reparent-for-div6-clocks.patch
+patches.armadillo800eva/0055-sh-introduce-sh_clk_ops-in-parallel-with-clk_ops.patch
+patches.armadillo800eva/0056-sh-convert-cpg-code-to-sh_clk_ops.patch
+patches.armadillo800eva/0057-ARM-mach-shmobile-R-Mobile-A1-support.patch
+patches.armadillo800eva/0058-ARM-mach-shmobile-r8a7740-add-PFC-support.patch
+patches.armadillo800eva/0059-ARM-mach-shmobile-r8a7740-add-i2c-support.patch
+patches.armadillo800eva/0060-ARM-mach-shmobile-r8a7740-add-INTC-support.patch
+patches.armadillo800eva/0061-ARM-mach-shmobile-bonito-Add-LCDC0-support.patch
+patches.armadillo800eva/0062-ARM-mach-shmobile-r8a7740-sh_clk_ops-rename.patch
+patches.armadillo800eva/0063-ARM-mach-shmobile-r8a7740-map_io-and-init_early-upda.patch
+patches.armadillo800eva/0064-ARM-mach-shmobile-rename-clk_init-to-shmobile_clk_in.patch
+patches.armadillo800eva/0065-ARM-mach-shmobile-r8a7740-and-Bonito-timer-rework.patch
+patches.armadillo800eva/0066-ARM-mach-shmobile-pfc-r8a7740-add-gpio_irq-support.patch
+patches.armadillo800eva/0067-net-sh_eth-tidyup-compile-warning.patch
+patches.armadillo800eva/0068-net-sh_eth-remove-__flush_purge_region.patch
+patches.armadillo800eva/0069-sh_eth-Move-the-Renesas-SuperH-driver.patch
+patches.armadillo800eva/0070-net-sh_eth-Fix-build-by-forgot-including-linux-inter.patch
+patches.armadillo800eva/0071-net-remove-use-of-ndo_set_multicast_list-in-drivers.patch
+patches.armadillo800eva/0072-net-sh_eth-fix-the-compile-error.patch
+patches.armadillo800eva/0073-net-sh_eth-use-ioremap.patch
+patches.armadillo800eva/0074-sh-modify-prototype-in-sh_eth.h.patch
+patches.armadillo800eva/0075-net-sh_eth-move-the-asm-sh_eth.h-to-include-linux.patch
+patches.armadillo800eva/0076-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-some.patch
+patches.armadillo800eva/0077-sh-modify-the-asm-sh_eth.h-to-linux-sh_eth.h-in-sh77.patch
+patches.armadillo800eva/0078-net-sh_eth-fix-build-failure.patch
+patches.armadillo800eva/0079-net-ethernet-convert-drivers-net-ethernet-to-use-mod.patch
+patches.armadillo800eva/0080-net-make-ethtool_ops-const.patch
+patches.armadillo800eva/0081-sh-eth-use-an-unique-MDIO-bus-name.patch
+patches.armadillo800eva/0082-net-sh-eth-Fix-build-error-by-the-value-which-is-not.patch
+patches.armadillo800eva/0083-drivers-net-Remove-alloc_etherdev-error-messages.patch
+patches.armadillo800eva/0084-net-sh_eth-fix-skb_over_panic-happen.patch
+patches.armadillo800eva/0085-sh-eth-use-netdev-stats-structure-and-fix-dma_map_si.patch
+patches.armadillo800eva/0086-netdev-ethernet-dev_alloc_skb-to-netdev_alloc_skb.patch
+patches.armadillo800eva/0087-renesas-sh_eth.c-fix-linux-interrupt.h-included-twic.patch
+patches.armadillo800eva/0088-net-sh_eth-add-the-value-of-tsu-to-the-SH7757-s-GETH.patch
+patches.armadillo800eva/0089-net-sh_eth-change-the-condition-of-initialization.patch
+patches.armadillo800eva/0090-net-sh_eth-modify-a-condition-of-ioremap-for-TSU.patch
+patches.armadillo800eva/0091-net-sh_eth-add-support-for-multicast-filtering.patch
+patches.armadillo800eva/0092-net-sh_eth-add-support-for-VLAN-tag-filtering.patch
+patches.armadillo800eva/0093-net-sh_eth-Add-support-SH7734.patch
+patches.armadillo800eva/0094-net-sh_eth-fix-endian-check-for-architecture-indepen.patch
+patches.armadillo800eva/0095-net-sh_eth-add-support-R8A7740.patch
+patches.armadillo800eva/0096-atomic-use-linux-atomic.h.patch
+patches.armadillo800eva/0097-fbdev-sh_mobile_meram-Enable-runtime-PM.patch
+patches.armadillo800eva/0098-fbdev-sh_mobile_meram-Enable-disable-MERAM-along-wit.patch
+patches.armadillo800eva/0099-fbdev-sh_mobile_meram-Move-private-data-from-.h-to-..patch
+patches.armadillo800eva/0100-fbdev-sh_mobile_meram-Backup-restore-device-register.patch
+patches.armadillo800eva/0101-drivercore-Add-helper-macro-for-platform_driver-boil.patch
+patches.armadillo800eva/0102-drivercore-Generalize-module_platform_driver.patch
+patches.armadillo800eva/0103-fbdev-sh_mobile_lcdc-Turn-dot-clock-on-before-resumi.patch
+patches.armadillo800eva/0104-fbdev-sh_mobile_lcdc-Replace-hardcoded-register-valu.patch
+patches.armadillo800eva/0105-fbdev-sh_mobile_lcdc-Don-t-acknowlege-interrupts-uni.patch
+patches.armadillo800eva/0106-fbdev-sh_mobile_lcdc-Compute-clock-pattern-using-div.patch
+patches.armadillo800eva/0107-fbdev-sh_mobile_lcdc-Split-LCDC-start-code-from-sh_m.patch
+patches.armadillo800eva/0108-fbdev-sh_mobile_lcdc-Store-the-frame-buffer-base-add.patch
+patches.armadillo800eva/0109-fbdev-sh_mobile_lcdc-Restart-LCDC-in-runtime-PM-resu.patch
+patches.armadillo800eva/0110-fbdev-sh_mobile_meram-Replace-hardcoded-register-val.patch
+patches.armadillo800eva/0111-fbdev-sh_mobile_meram-Validate-ICB-configuration-out.patch
+patches.armadillo800eva/0112-fbdev-sh_mobile_meram-Fix-MExxCTL-register-save-on-r.patch
+patches.armadillo800eva/0113-fbdev-sh_mobile_meram-Remove-unneeded-sh_mobile_mera.patch
+patches.armadillo800eva/0114-sh_mobile_meram-Reset-ICBs-at-unregistration-time.patch
+patches.armadillo800eva/0115-fbdev-sh_mobile_lcdc-Adjust-requested-parameters-in-.patch
+patches.armadillo800eva/0116-fbdev-sh_mobile_lcdc-Add-support-for-format-changes-.patch
+patches.armadillo800eva/0117-fbdev-sh_mobile_lcdc-use-display-information-in-info.patch
+patches.armadillo800eva/0118-fbdev-sh_mobile_lcdc-Update-fix.line_length-in-.fb_s.patch
+patches.armadillo800eva/0119-fbdev-sh_mobile_lcdc-Avoid-forward-declarations.patch
+patches.armadillo800eva/0120-fbdev-sh_mobile_lcdc-Split-channel-initialization-fr.patch
+patches.armadillo800eva/0121-fbdev-sh_mobile_lcdc-Remove-sh_mobile_lcdc_set_bpp.patch
+patches.armadillo800eva/0122-video-irq-Remove-IRQF_DISABLED.patch
+patches.armadillo800eva/0123-video-Add-module.h-to-drivers-video-files-who-really.patch
+patches.armadillo800eva/0124-fbdev-sh_mobile_lcdcfb-fixup-LDHAJR-HSYNPAJ-needs-ma.patch
+patches.armadillo800eva/0125-fbdev-sh_mipi_dsi-tidyup-dsip_clk.patch
+patches.armadillo800eva/0126-fbdev-sh_mipi_dsi-typo-fix-of-SH_MIPI_DSI_HBPBM.patch
+patches.armadillo800eva/0127-fbdev-sh_mipi_dsi-tidyup-VMCTR2-parameter-expression.patch
+patches.armadillo800eva/0128-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_HFPBM-flag.patch
+patches.armadillo800eva/0129-fbdev-sh_mipi_dsi-add-SH_MIPI_DSI_BL2E-flag.patch
+patches.armadillo800eva/0130-fbdev-sh_mipi_dsi-add-lane-control-support.patch
+patches.armadillo800eva/0131-fbdev-sh_mipi_dsi-add-sync_pulses-sync_events-burst-.patch
+patches.armadillo800eva/0132-fbdev-sh_mipi_dsi-add-VMLEN1-VMLEN2-calculation.patch
+patches.armadillo800eva/0133-fbdev-sh_mipi_dsi-add-set_dot_clock-for-each-platfor.patch
+patches.armadillo800eva/0134-fbdev-sh_mipi_dsi-add-HSxxCLK-support.patch
+patches.armadillo800eva/0135-fbdev-sh_mipi_dsi-sh_mipi-has-pdata-instead-of-dev.patch
+patches.armadillo800eva/0136-fbdev-sh_mipi_dsi-fixup-setup-timing-of-sh_mipi_setu.patch
+patches.armadillo800eva/0137-fbdev-sh_mipi_dsi-fixup-setup-timing-of-SYSCONF.patch
+patches.armadillo800eva/0138-fbdev-sh_mipi_dsi-fixup-setup-timing-DSICTRL.patch
+patches.armadillo800eva/0139-video-convert-drivers-video-to-use-module_platform_d.patch
+patches.armadillo800eva/0140-fbdev-Add-FOURCC-based-format-configuration-API.patch
+patches.armadillo800eva/0141-v4l-Add-V4L2_PIX_FMT_NV24-and-V4L2_PIX_FMT_NV42-form.patch
+patches.armadillo800eva/0142-arm-fix-compile-failure-in-mach-shmobile-board-ag5ev.patch
+patches.armadillo800eva/0143-sh-se7724-fix-compile-breakage.patch
+patches.armadillo800eva/0144-fbdev-sh_mobile_lcdc-Support-FOURCC-based-format-API.patch
+patches.armadillo800eva/0145-fbdev-sh_mobile_lcdc-Reorder-code-into-sections.patch
+patches.armadillo800eva/0146-fbdev-sh_mobile_lcdc-Mark-init-only-symbols-with-__d.patch
+patches.armadillo800eva/0147-fbdev-sh_mobile_lcdc-Move-pm-runtime-enable-to-probe.patch
+patches.armadillo800eva/0148-fbdev-sh_mobile_lcdc-Don-t-pass-struct-device-around.patch
+patches.armadillo800eva/0149-fbdev-sh_mobile_lcdc-Create-functions-to-turn-the-di.patch
+patches.armadillo800eva/0150-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-channel-in-no.patch
+patches.armadillo800eva/0151-sh_mobile_hdmi-Remove-platform-data-lcd_dev-field.patch
+patches.armadillo800eva/0152-fbdev-sh_mobile_lcdc-Add-sh_mobile_lcdc_entity-defin.patch
+patches.armadillo800eva/0153-fbdev-sh_mobile_hdmi-Implement-sh_mobile_lcdc_entity.patch
+patches.armadillo800eva/0154-fbdev-sh_mipi_dsi-Implement-sh_mobile_lcdc_entity-in.patch
+patches.armadillo800eva/0155-fbdev-sh_mobile_lcdc-Handle-HDMI-MIPI-transmitter-de.patch
+patches.armadillo800eva/0156-fbdev-sh_mipi_dsi-Don-t-hook-up-into-board_cfg-displ.patch
+patches.armadillo800eva/0157-fbdev-sh_mobile_hdmi-Don-t-hook-up-into-board_cfg-di.patch
+patches.armadillo800eva/0158-arm-mach-shmobile-Don-t-initialize-the-hdmi_info-lcd.patch
+patches.armadillo800eva/0159-fbdev-sh_mobile_hdmi-Remove-sh_mobile_hdmi_info-lcd_.patch
+patches.armadillo800eva/0160-fbdev-sh_mobile_lcdc-Remove-board-configuration-owne.patch
+patches.armadillo800eva/0161-fbdev-sh_mobile_lcdc-Remove-board-configuration-boar.patch
+patches.armadillo800eva/0162-fbdev-sh_mobile_lcdc-Move-brightness-ops-to-sh_mobil.patch
+patches.armadillo800eva/0163-fbdev-sh_mobile_lcdc-Merge-board_cfg-and-lcd_size_cf.patch
+patches.armadillo800eva/0164-sh_mobile_lcdc-Add-an-lcdc-channel-pointer-to-sh_mob.patch
+patches.armadillo800eva/0165-sh_mobile_hdmi-Use-sh_mobile_lcdc_entity-channel-to-.patch
+patches.armadillo800eva/0166-fbdev-sh_mobile_lcdc-Remove-fb_info-parameter-to-dis.patch
+patches.armadillo800eva/0167-fbdev-sh_mobile_lcdc-Return-display-connection-state.patch
+patches.armadillo800eva/0168-sh_mobile_lcdc-Add-display-notify-callback-to-sh_mob.patch
+patches.armadillo800eva/0169-sh_mobile_hdmi-Use-LCDC-notification-callback.patch
+patches.armadillo800eva/0170-fbdev-sh_mobile_lcdc-Pass-a-video-mode-to-the-notify.patch
+patches.armadillo800eva/0171-fbdev-sh_mobile_hdmi-Don-t-set-sh_hdmi-mode-in-the-d.patch
+patches.armadillo800eva/0172-fbdev-sh_mobile_hdmi-Don-t-access-LCDC-fb_info.patch
+patches.armadillo800eva/0173-fbdev-sh_mobile_lcdc-Store-display-mode-in-a-struct-.patch
+patches.armadillo800eva/0174-fbdev-sh_mobile_lcdc-Rename-lcd-num-_cfg-lcd-num-_mo.patch
+patches.armadillo800eva/0175-fbdev-sh_mobile_lcdc-Reorganize-the-sh_mobile_lcdc_c.patch
+patches.armadillo800eva/0176-fbdev-sh_mobile_lcdc-Add-sh_mobile_format_info-funct.patch
+patches.armadillo800eva/0177-fbdev-sh_mobile_lcdc-Store-the-format-in-struct-sh_m.patch
+patches.armadillo800eva/0178-fbdev-sh_mobile_lcdc-Split-fb-init-cleanup-from-chan.patch
+patches.armadillo800eva/0179-fbdev-sh_mobile_lcdc-Pass-physical-device-pointer-to.patch
+patches.armadillo800eva/0180-fbdev-sh_mobile_lcdc-Store-configuration-in-channel-.patch
+patches.armadillo800eva/0181-fbdev-sh_mobile_lcdc-Pass-channel-pointer-to-sh_mobi.patch
+patches.armadillo800eva/0182-fbdev-sh_mobile_meram-Request-memory-regions-for-mem.patch
+patches.armadillo800eva/0183-fbdev-sh_mobile_meram-Add-_cfg-suffix-to-struct-sh_m.patch
+patches.armadillo800eva/0184-fbdev-sh_mobile_meram-Make-variables-unsigned-where-.patch
+patches.armadillo800eva/0185-fbdev-sh_mobile_meram-Make-current_reg-field-store-t.patch
+patches.armadillo800eva/0186-fbdev-sh_mobile_meram-Add-struct-sh_mobile_meram_icb.patch
+patches.armadillo800eva/0187-fbdev-sh_mobile_meram-Don-t-inline-everything.patch
+patches.armadillo800eva/0188-fbdev-sh_mobile_meram-Divide-the-code-into-sections.patch
+patches.armadillo800eva/0189-fbdev-sh_mobile_meram-Use-genalloc-to-manage-MERAM-a.patch
+patches.armadillo800eva/0190-fbdev-sh_mobile_meram-Allocate-ICBs-automatically.patch
+patches.armadillo800eva/0191-arm-mach-shmobile-Don-t-set-MERAM-ICB-numbers-in-pla.patch
+patches.armadillo800eva/0192-fbdev-sh_mobile_meram-Remove-unused-sh_mobile_meram_.patch
+patches.armadillo800eva/0193-fbdev-sh_mobile_lcdc-Don-t-store-copy-of-platform-da.patch
+patches.armadillo800eva/0194-fbdev-sh_mobile_meram-Don-t-perform-update-in-regist.patch
+patches.armadillo800eva/0195-fbdev-sh_mobile_meram-Remove-unneeded-sanity-checks.patch
+patches.armadillo800eva/0196-fbdev-sh_mobile_meram-Implement-system-suspend-resum.patch
+patches.armadillo800eva/0197-fbdev-sh_mipi_dsi-add-extra-phyctrl-for-sh_mipi_dsi_.patch
+patches.armadillo800eva/0198-serial-sh-sci-Kill-off-bitrotted-H8-300-support.patch
+patches.armadillo800eva/0199-serial-sh-sci-Tidy-up-ioread-write-wrappers-kill-off.patch
+patches.armadillo800eva/0200-serial-sh-sci-Kill-off-some-more-unused-definitions.patch
+patches.armadillo800eva/0201-serial-sh-sci-Generalize-overrun-handling.patch
+patches.armadillo800eva/0202-serial-sh-sci-Consolidate-RXD-pin-handling.patch
+patches.armadillo800eva/0203-serial-sh-sci-More-unused-define-purging.patch
+patches.armadillo800eva/0204-serial-sh-sci-Abstract-register-maps.patch
+patches.armadillo800eva/0205-serial-sh-sci-FIFO-sizing-helper-consolidation.patch
+patches.armadillo800eva/0206-serial-sh-sci-Support-generic-SCLSR-overrun-detectio.patch
+patches.armadillo800eva/0207-serial-sh-sci-Regtype-probing-doesn-t-need-to-be-fat.patch
+patches.armadillo800eva/0208-serial-sh-sci-Add-missing-module-description-author-.patch
+patches.armadillo800eva/0209-serial-sh-sci-Kill-off-per-port-enable-disable-callb.patch
+patches.armadillo800eva/0210-serial-sh-sci-Fix-up-pretty-name-printing-for-port-I.patch
+patches.armadillo800eva/0211-serial-sh-sci-Fix-up-default-regtype-probing.patch
+patches.armadillo800eva/0212-serial-sh-sci-fix-DMA-build-by-including-dma-mapping.patch
+patches.armadillo800eva/0213-serial-sh-sci-console-Runtime-PM-support.patch
+patches.armadillo800eva/0214-sh-sci-PM-Use-power.irq_safe.patch
+patches.armadillo800eva/0215-serial-sh-sci-report-CTS-as-active-for-get_mctrl.patch
+patches.armadillo800eva/0216-serial-sh-sci-don-t-filter-on-DMA-device-use-only-ch.patch
+patches.armadillo800eva/0217-TTY-irq-Remove-IRQF_DISABLED.patch
+patches.armadillo800eva/0218-serial-sh-sci-Fix-up-SH-2A-SCIF-support.patch
+patches.armadillo800eva/0219-serial-sh-sci-Fix-up-SCFCR-handling.patch
+patches.armadillo800eva/0220-serial-sh-sci-Support-icount-statistics-for-error-ca.patch
+patches.armadillo800eva/0221-serial-sh-sci-Clarify-enable_ms-break_ctl-comments.patch
+patches.armadillo800eva/0222-serial-sh-sci-Fix-up-modem-control-handling.patch
+patches.armadillo800eva/0223-serial-sh-sci-Add-support-for-loopback-mode.patch
+patches.armadillo800eva/0224-serial-sh-sci-per-port-modem-control.patch
+patches.armadillo800eva/0225-serial-sh-sci-Avoid-FIFO-clear-for-MCE-toggle.patch
+patches.armadillo800eva/0226-serial-sh-sci-Handle-GPIO-function-requests.patch
+patches.armadillo800eva/0227-Input-gpio_keys-switch-to-using-threaded-IRQs.patch
+patches.armadillo800eva/0228-Input-gpio_keys-move-to-late_initcall.patch
+patches.armadillo800eva/0229-Input-gpio_keys-fix-a-memory-leak.patch
+patches.armadillo800eva/0230-Input-gpio_keys-add-support-for-device-tree-platform.patch
+patches.armadillo800eva/0231-Input-gpio_keys-switch-to-using-SIMPLE_DEV_PM_OPS.patch
+patches.armadillo800eva/0232-Input-gpio_keys-return-proper-error-code-if-memory-a.patch
+patches.armadillo800eva/0233-Input-gpio_keys-fix-two-typos-in-devicetree-document.patch
+patches.armadillo800eva/0234-Input-gpio_keys-use-of_property_read_u32.patch
+patches.armadillo800eva/0235-Input-gpio_keys-fix-struct-device-declared-inside-pa.patch
+patches.armadillo800eva/0236-Input-gpio_keys-constify-platform-data.patch
+patches.armadillo800eva/0237-Input-revert-gpio_keys-switch-to-using-threaded-IRQs.patch
+patches.armadillo800eva/0238-Input-gpio_keys-consolidate-key-destructor-code.patch
+patches.armadillo800eva/0239-Input-gpio_keys-add-support-for-interrupt-only-keys.patch
+patches.armadillo800eva/0240-Input-sh_keysc-fix-compile-warning.patch
+patches.armadillo800eva/0241-Input-keyboard-use-macro-module_platform_driver.patch
+patches.armadillo800eva/0242-Update-Nook-Color-machine-3284-to-common-Encore-name.patch
+patches.armadillo800eva/0243-ARM-7051-1-cpuimx-boards-fix-mach-types-errors.patch
+patches.armadillo800eva/0244-ARM-Add-a-few-machine-types-to-mach-types.patch
+patches.armadillo800eva/0245-ARM-Update-mach-types-to-fix-mxs-build-breakage.patch
+patches.armadillo800eva/0246-ARM-7193-1-Fix-machine_is_xxx-naming-for-eSata-Sheev.patch
+patches.armadillo800eva/0247-ARM-Update-mach-types.patch
+patches.armadillo800eva/0248-ARM-mach-shmobile-add-armadillo800eva-board-support.patch
+patches.armadillo800eva/0249-ARM-mach-shmobile-armadillo800eva-add-defconfig.patch
+patches.armadillo800eva/0250-ARM-mach-shmobile-armadillo800eva-add-support-LCDC0.patch
+patches.armadillo800eva/0251-ARM-mach-shmobile-armadillo800eva-add-support-ST1232.patch
+patches.armadillo800eva/0252-ARM-mach-shmobile-armadillo800eva-add-support-gpio_k.patch
+patches.armadillo800eva/0253-ARM-mach-shmobile-armadillo800eva-add-support-sh_eth.patch
+
#############################################################################
+# non-upstream patches
+#############################################################################
+
+#############################################################################
# LTTNG
# Patches came from short-lived experiment when they were added to the staging
# tree for a week or so.
@@ -94,3 +355,4 @@ patches.lttng/0172-staging-lttng-Fix-recent-modifications-to-string_fro.patch
patches.lttng/0173-staging-lttng-TODO-update-lttng-reported-to-work-fin.patch
patches.lttng/0174-staging-lttng-Update-max-symbol-length-to-256.patch
patches.lttng/lttng-update-to-v2.0.1.patch
+