aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/net/macb.txt25
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/boot/dts/at91sam9g20.dtsi7
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi7
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts5
-rw-r--r--arch/arm/boot/dts/usb_a9g20.dts5
-rw-r--r--arch/arm/mach-at91/at91cap9.c4
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c6
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam9260.c4
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam9263.c4
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c4
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c6
-rw-r--r--arch/arm/mach-at91/board-1arm.c2
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c2
-rw-r--r--arch/arm/mach-at91/board-cam60.c2
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c2
-rw-r--r--arch/arm/mach-at91/board-carmeva.c2
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c2
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c2
-rw-r--r--arch/arm/mach-at91/board-csb337.c2
-rw-r--r--arch/arm/mach-at91/board-csb637.c2
-rw-r--r--arch/arm/mach-at91/board-eb9200.c2
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c2
-rw-r--r--arch/arm/mach-at91/board-eco920.c2
-rw-r--r--arch/arm/mach-at91/board-foxg20.c2
-rw-r--r--arch/arm/mach-at91/board-gsia18s.c2
-rw-r--r--arch/arm/mach-at91/board-kafa.c2
-rw-r--r--arch/arm/mach-at91/board-kb9202.c2
-rw-r--r--arch/arm/mach-at91/board-neocore926.c2
-rw-r--r--arch/arm/mach-at91/board-pcontrol-g20.c2
-rw-r--r--arch/arm/mach-at91/board-picotux200.c2
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c2
-rw-r--r--arch/arm/mach-at91/board-rsi-ews.c2
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c2
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c2
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c2
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c2
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c2
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c2
-rw-r--r--arch/arm/mach-at91/include/mach/board.h14
-rw-r--r--arch/arm/mach-exynos/Kconfig7
-rw-r--r--arch/arm/mach-exynos/Makefile1
-rw-r--r--arch/arm/mach-exynos/dev-ohci.c52
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h1
-rw-r--r--arch/arm/mach-exynos/include/mach/ohci.h21
-rw-r--r--arch/arm/mach-exynos/mach-origen.c13
-rw-r--r--arch/arm/mach-exynos/mach-smdkv310.c13
-rw-r--r--arch/arm/mach-exynos/setup-usb-phy.c15
-rw-r--r--arch/arm/mach-mmp/aspenite.c5
-rw-r--r--arch/arm/mach-mmp/avengers_lite.c1
-rw-r--r--arch/arm/mach-mmp/brownstone.c1
-rw-r--r--arch/arm/mach-mmp/flint.c5
-rw-r--r--arch/arm/mach-mmp/gplugd.c1
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio-pxa.h3
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-mmp/include/mach/irqs.h6
-rw-r--r--arch/arm/mach-mmp/include/mach/mmp2.h2
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa168.h2
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa910.h2
-rw-r--r--arch/arm/mach-mmp/mmp2.c39
-rw-r--r--arch/arm/mach-mmp/pxa168.c40
-rw-r--r--arch/arm/mach-mmp/pxa910.c40
-rw-r--r--arch/arm/mach-mmp/tavorevb.c6
-rw-r--r--arch/arm/mach-mmp/teton_bga.c3
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c8
-rw-r--r--arch/arm/mach-mxs/clock-mx28.c38
-rw-r--r--arch/arm/mach-mxs/devices-mx28.h3
-rw-r--r--arch/arm/mach-mxs/devices/platform-mxs-saif.c5
-rw-r--r--arch/arm/mach-mxs/include/mach/common.h1
-rw-r--r--arch/arm/mach-mxs/include/mach/devices-common.h4
-rw-r--r--arch/arm/mach-mxs/include/mach/digctl.h21
-rw-r--r--arch/arm/mach-mxs/mach-mx28evk.c18
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c22
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c37
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c10
-rw-r--r--arch/arm/mach-omap2/hsmmc.c59
-rw-r--r--arch/arm/mach-omap2/hsmmc.h1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c392
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c217
-rw-r--r--arch/arm/mach-omap2/prcm-common.h2
-rw-r--r--arch/arm/mach-omap2/usb-host.c100
-rw-r--r--arch/arm/mach-pxa/am200epd.c4
-rw-r--r--arch/arm/mach-pxa/am300epd.c4
-rw-r--r--arch/arm/mach-pxa/balloon3.c2
-rw-r--r--arch/arm/mach-pxa/capc7117.c12
-rw-r--r--arch/arm/mach-pxa/cm-x270.c4
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c4
-rw-r--r--arch/arm/mach-pxa/cm-x300.c6
-rw-r--r--arch/arm/mach-pxa/colibri-pxa270.c6
-rw-r--r--arch/arm/mach-pxa/colibri-pxa300.c4
-rw-r--r--arch/arm/mach-pxa/colibri-pxa320.c4
-rw-r--r--arch/arm/mach-pxa/corgi.c2
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c21
-rw-r--r--arch/arm/mach-pxa/devices.c30
-rw-r--r--arch/arm/mach-pxa/devices.h1
-rw-r--r--arch/arm/mach-pxa/em-x270.c6
-rw-r--r--arch/arm/mach-pxa/eseries.c4
-rw-r--r--arch/arm/mach-pxa/hx4700.c18
-rw-r--r--arch/arm/mach-pxa/icontrol.c8
-rw-r--r--arch/arm/mach-pxa/idp.c4
-rw-r--r--arch/arm/mach-pxa/include/mach/balloon3.h6
-rw-r--r--arch/arm/mach-pxa/include/mach/corgi.h26
-rw-r--r--arch/arm/mach-pxa/include/mach/csb726.h4
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio-pxa.h133
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio.h20
-rw-r--r--arch/arm/mach-pxa/include/mach/gumstix.h20
-rw-r--r--arch/arm/mach-pxa/include/mach/hx4700.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/idp.h16
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/littleton.h4
-rw-r--r--arch/arm/mach-pxa/include/mach/magician.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/palmld.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/palmt5.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/palmtc.h4
-rw-r--r--arch/arm/mach-pxa/include/mach/palmtx.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/pcm027.h8
-rw-r--r--arch/arm/mach-pxa/include/mach/pcm990_baseboard.h14
-rw-r--r--arch/arm/mach-pxa/include/mach/poodle.h26
-rw-r--r--arch/arm/mach-pxa/include/mach/spitz.h40
-rw-r--r--arch/arm/mach-pxa/include/mach/tosa.h54
-rw-r--r--arch/arm/mach-pxa/include/mach/trizeps4.h16
-rw-r--r--arch/arm/mach-pxa/irq.c61
-rw-r--r--arch/arm/mach-pxa/littleton.c6
-rw-r--r--arch/arm/mach-pxa/lpd270.c4
-rw-r--r--arch/arm/mach-pxa/lubbock.c4
-rw-r--r--arch/arm/mach-pxa/magician.c8
-rw-r--r--arch/arm/mach-pxa/mainstone.c4
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c6
-rw-r--r--arch/arm/mach-pxa/mioa701.c8
-rw-r--r--arch/arm/mach-pxa/mxm8x10.c4
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c6
-rw-r--r--arch/arm/mach-pxa/poodle.c6
-rw-r--r--arch/arm/mach-pxa/pxa25x.c6
-rw-r--r--arch/arm/mach-pxa/pxa27x.c6
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c8
-rw-r--r--arch/arm/mach-pxa/pxa95x.c5
-rw-r--r--arch/arm/mach-pxa/raumfeld.c8
-rw-r--r--arch/arm/mach-pxa/saar.c6
-rw-r--r--arch/arm/mach-pxa/saarb.c2
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c24
-rw-r--r--arch/arm/mach-pxa/spitz.c2
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c11
-rw-r--r--arch/arm/mach-pxa/stargate2.c26
-rw-r--r--arch/arm/mach-pxa/tavorevb.c4
-rw-r--r--arch/arm/mach-pxa/tavorevb3.c2
-rw-r--r--arch/arm/mach-pxa/tosa.c4
-rw-r--r--arch/arm/mach-pxa/viper.c12
-rw-r--r--arch/arm/mach-pxa/vpac270.c10
-rw-r--r--arch/arm/mach-pxa/z2.c2
-rw-r--r--arch/arm/mach-pxa/zeus.c20
-rw-r--r--arch/arm/mach-pxa/zylonite.c4
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c4
-rw-r--r--arch/arm/plat-omap/include/plat/irqs.h2
-rw-r--r--arch/arm/plat-omap/include/plat/mmc.h1
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h1
-rw-r--r--arch/arm/plat-omap/include/plat/usb.h3
-rw-r--r--arch/arm/plat-pxa/include/plat/gpio-pxa.h44
-rw-r--r--arch/arm/plat-pxa/include/plat/gpio.h30
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h1
-rw-r--r--arch/avr32/boards/atngw100/setup.c2
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c2
-rw-r--r--arch/avr32/boards/favr-32/setup.c2
-rw-r--r--arch/avr32/boards/hammerhead/setup.c2
-rw-r--r--arch/avr32/boards/merisc/setup.c2
-rw-r--r--arch/avr32/boards/mimc200/setup.c2
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c8
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h7
-rw-r--r--drivers/gpio/Kconfig6
-rw-r--r--drivers/gpio/Makefile2
-rw-r--r--drivers/gpio/gpio-pxa.c377
-rw-r--r--drivers/i2c/busses/i2c-tegra.c10
-rw-r--r--drivers/mfd/omap-usb-host.c755
-rw-r--r--drivers/mmc/host/omap_hsmmc.c26
-rw-r--r--drivers/net/ethernet/Makefile2
-rw-r--r--drivers/net/ethernet/cadence/Kconfig16
-rw-r--r--drivers/net/ethernet/cadence/at91_ether.c26
-rw-r--r--drivers/net/ethernet/cadence/at91_ether.h4
-rw-r--r--drivers/net/ethernet/cadence/macb.c416
-rw-r--r--drivers/net/ethernet/cadence/macb.h152
-rw-r--r--drivers/pcmcia/pxa2xx_cm_x255.c16
-rw-r--r--drivers/pcmcia/pxa2xx_cm_x270.c9
-rw-r--r--drivers/usb/Kconfig1
-rw-r--r--drivers/usb/host/Kconfig6
-rw-r--r--drivers/usb/host/ehci-omap.c17
-rw-r--r--drivers/usb/host/ohci-exynos.c274
-rw-r--r--drivers/usb/host/ohci-hcd.c5
-rw-r--r--drivers/usb/host/ohci-omap3.c18
-rw-r--r--include/linux/gpio-pxa.h16
-rw-r--r--include/linux/platform_data/macb.h17
-rw-r--r--include/sound/saif.h4
-rw-r--r--sound/soc/mxs/mxs-saif.c20
200 files changed, 2990 insertions, 1568 deletions
diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt
new file mode 100644
index 000000000000..44afa0e5057d
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/macb.txt
@@ -0,0 +1,25 @@
1* Cadence MACB/GEM Ethernet controller
2
3Required properties:
4- compatible: Should be "cdns,[<chip>-]{macb|gem}"
5 Use "cdns,at91sam9260-macb" Atmel at91sam9260 and at91sam9263 SoCs.
6 Use "cdns,at32ap7000-macb" for other 10/100 usage or use the generic form: "cdns,macb".
7 Use "cnds,pc302-gem" for Picochip picoXcell pc302 and later devices based on
8 the Cadence GEM, or the generic form: "cdns,gem".
9- reg: Address and length of the register set for the device
10- interrupts: Should contain macb interrupt
11- phy-mode: String, operation mode of the PHY interface.
12 Supported values are: "mii", "rmii", "gmii", "rgmii".
13
14Optional properties:
15- local-mac-address: 6 bytes, mac address
16
17Examples:
18
19 macb0: ethernet@fffc4000 {
20 compatible = "cdns,at32ap7000-macb";
21 reg = <0xfffc4000 0x4000>;
22 interrupts = <21>;
23 phy-mode = "rmii";
24 local-mac-address = [3a 0e 03 04 05 06];
25 };
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 776d76b8cb69..b8c69726839c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -592,6 +592,7 @@ config ARCH_MMP
592 select ARCH_REQUIRE_GPIOLIB 592 select ARCH_REQUIRE_GPIOLIB
593 select CLKDEV_LOOKUP 593 select CLKDEV_LOOKUP
594 select GENERIC_CLOCKEVENTS 594 select GENERIC_CLOCKEVENTS
595 select GPIO_PXA
595 select HAVE_SCHED_CLOCK 596 select HAVE_SCHED_CLOCK
596 select TICK_ONESHOT 597 select TICK_ONESHOT
597 select PLAT_PXA 598 select PLAT_PXA
@@ -674,6 +675,7 @@ config ARCH_PXA
674 select CLKSRC_MMIO 675 select CLKSRC_MMIO
675 select ARCH_REQUIRE_GPIOLIB 676 select ARCH_REQUIRE_GPIOLIB
676 select GENERIC_CLOCKEVENTS 677 select GENERIC_CLOCKEVENTS
678 select GPIO_PXA
677 select HAVE_SCHED_CLOCK 679 select HAVE_SCHED_CLOCK
678 select TICK_ONESHOT 680 select TICK_ONESHOT
679 select PLAT_PXA 681 select PLAT_PXA
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
index aeef04269cf8..07603b8c9503 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -114,6 +114,13 @@
114 atmel,use-dma-tx; 114 atmel,use-dma-tx;
115 status = "disabled"; 115 status = "disabled";
116 }; 116 };
117
118 macb0: ethernet@fffc4000 {
119 compatible = "cdns,at32ap7000-macb", "cdns,macb";
120 reg = <0xfffc4000 0x100>;
121 interrupts = <21>;
122 status = "disabled";
123 };
117 }; 124 };
118 }; 125 };
119}; 126};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index db6a45202f26..fffa005300a4 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -101,6 +101,13 @@
101 atmel,use-dma-tx; 101 atmel,use-dma-tx;
102 status = "disabled"; 102 status = "disabled";
103 }; 103 };
104
105 macb0: ethernet@fffbc000 {
106 compatible = "cdns,at32ap7000-macb", "cdns,macb";
107 reg = <0xfffbc000 0x100>;
108 interrupts = <25>;
109 status = "disabled";
110 };
104 }; 111 };
105 }; 112 };
106}; 113};
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index 85b34f59cd82..a387e7704ce1 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -30,6 +30,11 @@
30 usart1: serial@fff90000 { 30 usart1: serial@fff90000 {
31 status = "okay"; 31 status = "okay";
32 }; 32 };
33
34 macb0: ethernet@fffbc000 {
35 phy-mode = "rmii";
36 status = "okay";
37 };
33 }; 38 };
34 }; 39 };
35}; 40};
diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts
index d66e2c00ac35..f04b535477f5 100644
--- a/arch/arm/boot/dts/usb_a9g20.dts
+++ b/arch/arm/boot/dts/usb_a9g20.dts
@@ -25,6 +25,11 @@
25 dbgu: serial@fffff200 { 25 dbgu: serial@fffff200 {
26 status = "okay"; 26 status = "okay";
27 }; 27 };
28
29 macb0: ethernet@fffc4000 {
30 phy-mode = "rmii";
31 status = "okay";
32 };
28 }; 33 };
29 }; 34 };
30}; 35};
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index ecdd54dd68c6..17632b82dd76 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -137,7 +137,7 @@ static struct clk pwm_clk = {
137 .type = CLK_TYPE_PERIPHERAL, 137 .type = CLK_TYPE_PERIPHERAL,
138}; 138};
139static struct clk macb_clk = { 139static struct clk macb_clk = {
140 .name = "macb_clk", 140 .name = "pclk",
141 .pmc_mask = 1 << AT91CAP9_ID_EMAC, 141 .pmc_mask = 1 << AT91CAP9_ID_EMAC,
142 .type = CLK_TYPE_PERIPHERAL, 142 .type = CLK_TYPE_PERIPHERAL,
143}; 143};
@@ -210,6 +210,8 @@ static struct clk *periph_clocks[] __initdata = {
210}; 210};
211 211
212static struct clk_lookup periph_clocks_lookups[] = { 212static struct clk_lookup periph_clocks_lookups[] = {
213 /* One additional fake clock for macb_hclk */
214 CLKDEV_CON_ID("hclk", &macb_clk),
213 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), 215 CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk),
214 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), 216 CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
215 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), 217 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk),
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index adad70db70eb..695aecab0a67 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -200,7 +200,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
200 200
201#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) 201#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
202static u64 eth_dmamask = DMA_BIT_MASK(32); 202static u64 eth_dmamask = DMA_BIT_MASK(32);
203static struct at91_eth_data eth_data; 203static struct macb_platform_data eth_data;
204 204
205static struct resource eth_resources[] = { 205static struct resource eth_resources[] = {
206 [0] = { 206 [0] = {
@@ -227,7 +227,7 @@ static struct platform_device at91cap9_eth_device = {
227 .num_resources = ARRAY_SIZE(eth_resources), 227 .num_resources = ARRAY_SIZE(eth_resources),
228}; 228};
229 229
230void __init at91_add_device_eth(struct at91_eth_data *data) 230void __init at91_add_device_eth(struct macb_platform_data *data)
231{ 231{
232 if (!data) 232 if (!data)
233 return; 233 return;
@@ -264,7 +264,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
264 platform_device_register(&at91cap9_eth_device); 264 platform_device_register(&at91cap9_eth_device);
265} 265}
266#else 266#else
267void __init at91_add_device_eth(struct at91_eth_data *data) {} 267void __init at91_add_device_eth(struct macb_platform_data *data) {}
268#endif 268#endif
269 269
270 270
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index ad930688358c..55d22911d0c2 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -135,7 +135,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
135 135
136#if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE) 136#if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
137static u64 eth_dmamask = DMA_BIT_MASK(32); 137static u64 eth_dmamask = DMA_BIT_MASK(32);
138static struct at91_eth_data eth_data; 138static struct macb_platform_data eth_data;
139 139
140static struct resource eth_resources[] = { 140static struct resource eth_resources[] = {
141 [0] = { 141 [0] = {
@@ -162,7 +162,7 @@ static struct platform_device at91rm9200_eth_device = {
162 .num_resources = ARRAY_SIZE(eth_resources), 162 .num_resources = ARRAY_SIZE(eth_resources),
163}; 163};
164 164
165void __init at91_add_device_eth(struct at91_eth_data *data) 165void __init at91_add_device_eth(struct macb_platform_data *data)
166{ 166{
167 if (!data) 167 if (!data)
168 return; 168 return;
@@ -199,7 +199,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
199 platform_device_register(&at91rm9200_eth_device); 199 platform_device_register(&at91rm9200_eth_device);
200} 200}
201#else 201#else
202void __init at91_add_device_eth(struct at91_eth_data *data) {} 202void __init at91_add_device_eth(struct macb_platform_data *data) {}
203#endif 203#endif
204 204
205 205
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 0d20677fbef0..1c945e3ba57c 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -120,7 +120,7 @@ static struct clk ohci_clk = {
120 .type = CLK_TYPE_PERIPHERAL, 120 .type = CLK_TYPE_PERIPHERAL,
121}; 121};
122static struct clk macb_clk = { 122static struct clk macb_clk = {
123 .name = "macb_clk", 123 .name = "pclk",
124 .pmc_mask = 1 << AT91SAM9260_ID_EMAC, 124 .pmc_mask = 1 << AT91SAM9260_ID_EMAC,
125 .type = CLK_TYPE_PERIPHERAL, 125 .type = CLK_TYPE_PERIPHERAL,
126}; 126};
@@ -190,6 +190,8 @@ static struct clk *periph_clocks[] __initdata = {
190}; 190};
191 191
192static struct clk_lookup periph_clocks_lookups[] = { 192static struct clk_lookup periph_clocks_lookups[] = {
193 /* One additional fake clock for macb_hclk */
194 CLKDEV_CON_ID("hclk", &macb_clk),
193 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), 195 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
194 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), 196 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
195 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), 197 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 629fa9774972..b1a4812d9965 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -136,7 +136,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
136 136
137#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) 137#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
138static u64 eth_dmamask = DMA_BIT_MASK(32); 138static u64 eth_dmamask = DMA_BIT_MASK(32);
139static struct at91_eth_data eth_data; 139static struct macb_platform_data eth_data;
140 140
141static struct resource eth_resources[] = { 141static struct resource eth_resources[] = {
142 [0] = { 142 [0] = {
@@ -163,7 +163,7 @@ static struct platform_device at91sam9260_eth_device = {
163 .num_resources = ARRAY_SIZE(eth_resources), 163 .num_resources = ARRAY_SIZE(eth_resources),
164}; 164};
165 165
166void __init at91_add_device_eth(struct at91_eth_data *data) 166void __init at91_add_device_eth(struct macb_platform_data *data)
167{ 167{
168 if (!data) 168 if (!data)
169 return; 169 return;
@@ -200,7 +200,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
200 platform_device_register(&at91sam9260_eth_device); 200 platform_device_register(&at91sam9260_eth_device);
201} 201}
202#else 202#else
203void __init at91_add_device_eth(struct at91_eth_data *data) {} 203void __init at91_add_device_eth(struct macb_platform_data *data) {}
204#endif 204#endif
205 205
206 206
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index f83fbb0ee0c5..182d112dc59d 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -118,7 +118,7 @@ static struct clk pwm_clk = {
118 .type = CLK_TYPE_PERIPHERAL, 118 .type = CLK_TYPE_PERIPHERAL,
119}; 119};
120static struct clk macb_clk = { 120static struct clk macb_clk = {
121 .name = "macb_clk", 121 .name = "pclk",
122 .pmc_mask = 1 << AT91SAM9263_ID_EMAC, 122 .pmc_mask = 1 << AT91SAM9263_ID_EMAC,
123 .type = CLK_TYPE_PERIPHERAL, 123 .type = CLK_TYPE_PERIPHERAL,
124}; 124};
@@ -182,6 +182,8 @@ static struct clk *periph_clocks[] __initdata = {
182}; 182};
183 183
184static struct clk_lookup periph_clocks_lookups[] = { 184static struct clk_lookup periph_clocks_lookups[] = {
185 /* One additional fake clock for macb_hclk */
186 CLKDEV_CON_ID("hclk", &macb_clk),
185 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 187 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
186 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 188 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
187 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), 189 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk),
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index d5fbac9ff4fa..183b5f17f55e 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -144,7 +144,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
144 144
145#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) 145#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
146static u64 eth_dmamask = DMA_BIT_MASK(32); 146static u64 eth_dmamask = DMA_BIT_MASK(32);
147static struct at91_eth_data eth_data; 147static struct macb_platform_data eth_data;
148 148
149static struct resource eth_resources[] = { 149static struct resource eth_resources[] = {
150 [0] = { 150 [0] = {
@@ -171,7 +171,7 @@ static struct platform_device at91sam9263_eth_device = {
171 .num_resources = ARRAY_SIZE(eth_resources), 171 .num_resources = ARRAY_SIZE(eth_resources),
172}; 172};
173 173
174void __init at91_add_device_eth(struct at91_eth_data *data) 174void __init at91_add_device_eth(struct macb_platform_data *data)
175{ 175{
176 if (!data) 176 if (!data)
177 return; 177 return;
@@ -208,7 +208,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
208 platform_device_register(&at91sam9263_eth_device); 208 platform_device_register(&at91sam9263_eth_device);
209} 209}
210#else 210#else
211void __init at91_add_device_eth(struct at91_eth_data *data) {} 211void __init at91_add_device_eth(struct macb_platform_data *data) {}
212#endif 212#endif
213 213
214 214
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 318b0407ea04..5a0e522ffa94 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -150,7 +150,7 @@ static struct clk ac97_clk = {
150 .type = CLK_TYPE_PERIPHERAL, 150 .type = CLK_TYPE_PERIPHERAL,
151}; 151};
152static struct clk macb_clk = { 152static struct clk macb_clk = {
153 .name = "macb_clk", 153 .name = "pclk",
154 .pmc_mask = 1 << AT91SAM9G45_ID_EMAC, 154 .pmc_mask = 1 << AT91SAM9G45_ID_EMAC,
155 .type = CLK_TYPE_PERIPHERAL, 155 .type = CLK_TYPE_PERIPHERAL,
156}; 156};
@@ -209,6 +209,8 @@ static struct clk *periph_clocks[] __initdata = {
209}; 209};
210 210
211static struct clk_lookup periph_clocks_lookups[] = { 211static struct clk_lookup periph_clocks_lookups[] = {
212 /* One additional fake clock for macb_hclk */
213 CLKDEV_CON_ID("hclk", &macb_clk),
212 /* One additional fake clock for ohci */ 214 /* One additional fake clock for ohci */
213 CLKDEV_CON_ID("ohci_clk", &uhphs_clk), 215 CLKDEV_CON_ID("ohci_clk", &uhphs_clk),
214 CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), 216 CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk),
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 09a16d6bd5cd..e2cb835c4d7c 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -284,7 +284,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
284 284
285#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) 285#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
286static u64 eth_dmamask = DMA_BIT_MASK(32); 286static u64 eth_dmamask = DMA_BIT_MASK(32);
287static struct at91_eth_data eth_data; 287static struct macb_platform_data eth_data;
288 288
289static struct resource eth_resources[] = { 289static struct resource eth_resources[] = {
290 [0] = { 290 [0] = {
@@ -311,7 +311,7 @@ static struct platform_device at91sam9g45_eth_device = {
311 .num_resources = ARRAY_SIZE(eth_resources), 311 .num_resources = ARRAY_SIZE(eth_resources),
312}; 312};
313 313
314void __init at91_add_device_eth(struct at91_eth_data *data) 314void __init at91_add_device_eth(struct macb_platform_data *data)
315{ 315{
316 if (!data) 316 if (!data)
317 return; 317 return;
@@ -348,7 +348,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
348 platform_device_register(&at91sam9g45_eth_device); 348 platform_device_register(&at91sam9g45_eth_device);
349} 349}
350#else 350#else
351void __init at91_add_device_eth(struct at91_eth_data *data) {} 351void __init at91_add_device_eth(struct macb_platform_data *data) {}
352#endif 352#endif
353 353
354 354
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 367d5cd5e362..a60d98d7c3e2 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -63,7 +63,7 @@ static void __init onearm_init_early(void)
63 at91_set_serial_console(0); 63 at91_set_serial_console(0);
64} 64}
65 65
66static struct at91_eth_data __initdata onearm_eth_data = { 66static struct macb_platform_data __initdata onearm_eth_data = {
67 .phy_irq_pin = AT91_PIN_PC4, 67 .phy_irq_pin = AT91_PIN_PC4,
68 .is_rmii = 1, 68 .is_rmii = 1,
69}; 69};
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index 4282d96dffa8..17fc77925707 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -103,7 +103,7 @@ static struct spi_board_info afeb9260_spi_devices[] = {
103/* 103/*
104 * MACB Ethernet device 104 * MACB Ethernet device
105 */ 105 */
106static struct at91_eth_data __initdata afeb9260_macb_data = { 106static struct macb_platform_data __initdata afeb9260_macb_data = {
107 .phy_irq_pin = AT91_PIN_PA9, 107 .phy_irq_pin = AT91_PIN_PA9,
108 .is_rmii = 0, 108 .is_rmii = 0,
109}; 109};
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index f90cfb32bad2..2037d2c40eb4 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -115,7 +115,7 @@ static struct spi_board_info cam60_spi_devices[] __initdata = {
115/* 115/*
116 * MACB Ethernet device 116 * MACB Ethernet device
117 */ 117 */
118static struct __initdata at91_eth_data cam60_macb_data = { 118static struct __initdata macb_platform_data cam60_macb_data = {
119 .phy_irq_pin = AT91_PIN_PB5, 119 .phy_irq_pin = AT91_PIN_PB5,
120 .is_rmii = 0, 120 .is_rmii = 0,
121}; 121};
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index 5dffd3be62d2..af5520c366fe 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -153,7 +153,7 @@ static struct at91_mmc_data __initdata cap9adk_mmc_data = {
153/* 153/*
154 * MACB Ethernet device 154 * MACB Ethernet device
155 */ 155 */
156static struct at91_eth_data __initdata cap9adk_macb_data = { 156static struct macb_platform_data __initdata cap9adk_macb_data = {
157 .is_rmii = 1, 157 .is_rmii = 1,
158}; 158};
159 159
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 774c87fcbd5b..529b356cdb7d 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -57,7 +57,7 @@ static void __init carmeva_init_early(void)
57 at91_set_serial_console(0); 57 at91_set_serial_console(0);
58} 58}
59 59
60static struct at91_eth_data __initdata carmeva_eth_data = { 60static struct macb_platform_data __initdata carmeva_eth_data = {
61 .phy_irq_pin = AT91_PIN_PC4, 61 .phy_irq_pin = AT91_PIN_PC4,
62 .is_rmii = 1, 62 .is_rmii = 1,
63}; 63};
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index fc885a4ce243..04d2b9b50464 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -99,7 +99,7 @@ static struct at91_udc_data __initdata cpu9krea_udc_data = {
99/* 99/*
100 * MACB Ethernet device 100 * MACB Ethernet device
101 */ 101 */
102static struct at91_eth_data __initdata cpu9krea_macb_data = { 102static struct macb_platform_data __initdata cpu9krea_macb_data = {
103 .is_rmii = 1, 103 .is_rmii = 1,
104}; 104};
105 105
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index d35e65b08ccd..7a4c82e8da51 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -82,7 +82,7 @@ static void __init cpuat91_init_early(void)
82 at91_set_serial_console(0); 82 at91_set_serial_console(0);
83} 83}
84 84
85static struct at91_eth_data __initdata cpuat91_eth_data = { 85static struct macb_platform_data __initdata cpuat91_eth_data = {
86 .is_rmii = 1, 86 .is_rmii = 1,
87}; 87};
88 88
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index c3936665e645..b004b20b8e42 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -58,7 +58,7 @@ static void __init csb337_init_early(void)
58 at91_set_serial_console(0); 58 at91_set_serial_console(0);
59} 59}
60 60
61static struct at91_eth_data __initdata csb337_eth_data = { 61static struct macb_platform_data __initdata csb337_eth_data = {
62 .phy_irq_pin = AT91_PIN_PC2, 62 .phy_irq_pin = AT91_PIN_PC2,
63 .is_rmii = 0, 63 .is_rmii = 0,
64}; 64};
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 586100e2acbb..e966de5219c7 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -52,7 +52,7 @@ static void __init csb637_init_early(void)
52 at91_set_serial_console(0); 52 at91_set_serial_console(0);
53} 53}
54 54
55static struct at91_eth_data __initdata csb637_eth_data = { 55static struct macb_platform_data __initdata csb637_eth_data = {
56 .phy_irq_pin = AT91_PIN_PC0, 56 .phy_irq_pin = AT91_PIN_PC0,
57 .is_rmii = 0, 57 .is_rmii = 0,
58}; 58};
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 45db7a3dbef0..3788fa527121 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -60,7 +60,7 @@ static void __init eb9200_init_early(void)
60 at91_set_serial_console(0); 60 at91_set_serial_console(0);
61} 61}
62 62
63static struct at91_eth_data __initdata eb9200_eth_data = { 63static struct macb_platform_data __initdata eb9200_eth_data = {
64 .phy_irq_pin = AT91_PIN_PC4, 64 .phy_irq_pin = AT91_PIN_PC4,
65 .is_rmii = 1, 65 .is_rmii = 1,
66}; 66};
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index 2f9c16d29212..af7622eae1a9 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -64,7 +64,7 @@ static void __init ecb_at91init_early(void)
64 at91_set_serial_console(0); 64 at91_set_serial_console(0);
65} 65}
66 66
67static struct at91_eth_data __initdata ecb_at91eth_data = { 67static struct macb_platform_data __initdata ecb_at91eth_data = {
68 .phy_irq_pin = AT91_PIN_PC4, 68 .phy_irq_pin = AT91_PIN_PC4,
69 .is_rmii = 0, 69 .is_rmii = 0,
70}; 70};
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index 8252c722607b..8e75867d1d18 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -47,7 +47,7 @@ static void __init eco920_init_early(void)
47 at91_set_serial_console(0); 47 at91_set_serial_console(0);
48} 48}
49 49
50static struct at91_eth_data __initdata eco920_eth_data = { 50static struct macb_platform_data __initdata eco920_eth_data = {
51 .phy_irq_pin = AT91_PIN_PC2, 51 .phy_irq_pin = AT91_PIN_PC2,
52 .is_rmii = 1, 52 .is_rmii = 1,
53}; 53};
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index f27d1a780cfa..de8e09642f4e 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -135,7 +135,7 @@ static struct spi_board_info foxg20_spi_devices[] = {
135/* 135/*
136 * MACB Ethernet device 136 * MACB Ethernet device
137 */ 137 */
138static struct at91_eth_data __initdata foxg20_macb_data = { 138static struct macb_platform_data __initdata foxg20_macb_data = {
139 .phy_irq_pin = AT91_PIN_PA7, 139 .phy_irq_pin = AT91_PIN_PA7,
140 .is_rmii = 1, 140 .is_rmii = 1,
141}; 141};
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
index 2e95949737e6..51c82f151119 100644
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -93,7 +93,7 @@ static struct at91_udc_data __initdata udc_data = {
93/* 93/*
94 * MACB Ethernet device 94 * MACB Ethernet device
95 */ 95 */
96static struct at91_eth_data __initdata macb_data = { 96static struct macb_platform_data __initdata macb_data = {
97 .phy_irq_pin = AT91_PIN_PA28, 97 .phy_irq_pin = AT91_PIN_PA28,
98 .is_rmii = 1, 98 .is_rmii = 1,
99}; 99};
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index 3bae73e63633..9628a3defcf4 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -61,7 +61,7 @@ static void __init kafa_init_early(void)
61 at91_set_serial_console(0); 61 at91_set_serial_console(0);
62} 62}
63 63
64static struct at91_eth_data __initdata kafa_eth_data = { 64static struct macb_platform_data __initdata kafa_eth_data = {
65 .phy_irq_pin = AT91_PIN_PC4, 65 .phy_irq_pin = AT91_PIN_PC4,
66 .is_rmii = 0, 66 .is_rmii = 0,
67}; 67};
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index e61351ffad50..5ba5244cb632 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -69,7 +69,7 @@ static void __init kb9202_init_early(void)
69 at91_set_serial_console(0); 69 at91_set_serial_console(0);
70} 70}
71 71
72static struct at91_eth_data __initdata kb9202_eth_data = { 72static struct macb_platform_data __initdata kb9202_eth_data = {
73 .phy_irq_pin = AT91_PIN_PB29, 73 .phy_irq_pin = AT91_PIN_PB29,
74 .is_rmii = 0, 74 .is_rmii = 0,
75}; 75};
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index ef816c17dc61..56e7aee11b59 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -155,7 +155,7 @@ static struct at91_mmc_data __initdata neocore926_mmc_data = {
155/* 155/*
156 * MACB Ethernet device 156 * MACB Ethernet device
157 */ 157 */
158static struct at91_eth_data __initdata neocore926_macb_data = { 158static struct macb_platform_data __initdata neocore926_macb_data = {
159 .phy_irq_pin = AT91_PIN_PE31, 159 .phy_irq_pin = AT91_PIN_PE31,
160 .is_rmii = 1, 160 .is_rmii = 1,
161}; 161};
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index 49e3f699b48e..c545a3e635a4 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -122,7 +122,7 @@ static struct at91_udc_data __initdata pcontrol_g20_udc_data = {
122/* 122/*
123 * MACB Ethernet device 123 * MACB Ethernet device
124 */ 124 */
125static struct at91_eth_data __initdata macb_data = { 125static struct macb_platform_data __initdata macb_data = {
126 .phy_irq_pin = AT91_PIN_PA28, 126 .phy_irq_pin = AT91_PIN_PA28,
127 .is_rmii = 1, 127 .is_rmii = 1,
128}; 128};
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 0a8fe6a1b7c8..dc18759a24b4 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -60,7 +60,7 @@ static void __init picotux200_init_early(void)
60 at91_set_serial_console(0); 60 at91_set_serial_console(0);
61} 61}
62 62
63static struct at91_eth_data __initdata picotux200_eth_data = { 63static struct macb_platform_data __initdata picotux200_eth_data = {
64 .phy_irq_pin = AT91_PIN_PC4, 64 .phy_irq_pin = AT91_PIN_PC4,
65 .is_rmii = 1, 65 .is_rmii = 1,
66}; 66};
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 07421bdb88ea..5444d6ac514a 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -104,7 +104,7 @@ static struct spi_board_info ek_spi_devices[] = {
104/* 104/*
105 * MACB Ethernet device 105 * MACB Ethernet device
106 */ 106 */
107static struct at91_eth_data __initdata ek_macb_data = { 107static struct macb_platform_data __initdata ek_macb_data = {
108 .phy_irq_pin = AT91_PIN_PA31, 108 .phy_irq_pin = AT91_PIN_PA31,
109 .is_rmii = 1, 109 .is_rmii = 1,
110}; 110};
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 80a8c9c6e922..022d0cebda9d 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -65,7 +65,7 @@ static void __init dk_init_early(void)
65 at91_set_serial_console(0); 65 at91_set_serial_console(0);
66} 66}
67 67
68static struct at91_eth_data __initdata dk_eth_data = { 68static struct macb_platform_data __initdata dk_eth_data = {
69 .phy_irq_pin = AT91_PIN_PC4, 69 .phy_irq_pin = AT91_PIN_PC4,
70 .is_rmii = 1, 70 .is_rmii = 1,
71}; 71};
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 99fd7f8aee0e..ed275861adef 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -65,7 +65,7 @@ static void __init ek_init_early(void)
65 at91_set_serial_console(0); 65 at91_set_serial_console(0);
66} 66}
67 67
68static struct at91_eth_data __initdata ek_eth_data = { 68static struct macb_platform_data __initdata ek_eth_data = {
69 .phy_irq_pin = AT91_PIN_PC4, 69 .phy_irq_pin = AT91_PIN_PC4,
70 .is_rmii = 1, 70 .is_rmii = 1,
71}; 71};
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c
index e927df0175df..ed3b21f77674 100644
--- a/arch/arm/mach-at91/board-rsi-ews.c
+++ b/arch/arm/mach-at91/board-rsi-ews.c
@@ -60,7 +60,7 @@ static void __init rsi_ews_init_early(void)
60/* 60/*
61 * Ethernet 61 * Ethernet
62 */ 62 */
63static struct at91_eth_data rsi_ews_eth_data __initdata = { 63static struct macb_platform_data rsi_ews_eth_data __initdata = {
64 .phy_irq_pin = AT91_PIN_PC4, 64 .phy_irq_pin = AT91_PIN_PC4,
65 .is_rmii = 1, 65 .is_rmii = 1,
66}; 66};
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 072d53af98d9..3e4b50e6f6ab 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -109,7 +109,7 @@ static struct spi_board_info ek_spi_devices[] = {
109/* 109/*
110 * MACB Ethernet device 110 * MACB Ethernet device
111 */ 111 */
112static struct at91_eth_data __initdata ek_macb_data = { 112static struct macb_platform_data __initdata ek_macb_data = {
113 .phy_irq_pin = AT91_PIN_PA7, 113 .phy_irq_pin = AT91_PIN_PA7,
114 .is_rmii = 0, 114 .is_rmii = 0,
115}; 115};
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 4f10181a0782..13478e14a543 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -151,7 +151,7 @@ static struct spi_board_info ek_spi_devices[] = {
151/* 151/*
152 * MACB Ethernet device 152 * MACB Ethernet device
153 */ 153 */
154static struct at91_eth_data __initdata ek_macb_data = { 154static struct macb_platform_data __initdata ek_macb_data = {
155 .phy_irq_pin = AT91_PIN_PA7, 155 .phy_irq_pin = AT91_PIN_PA7,
156 .is_rmii = 1, 156 .is_rmii = 1,
157}; 157};
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index bccdcf23caa1..fcf194e6e4fe 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -158,7 +158,7 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
158/* 158/*
159 * MACB Ethernet device 159 * MACB Ethernet device
160 */ 160 */
161static struct at91_eth_data __initdata ek_macb_data = { 161static struct macb_platform_data __initdata ek_macb_data = {
162 .phy_irq_pin = AT91_PIN_PE31, 162 .phy_irq_pin = AT91_PIN_PE31,
163 .is_rmii = 1, 163 .is_rmii = 1,
164}; 164};
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 64fc75c9d0ac..78d27cc3cc09 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -123,7 +123,7 @@ static struct spi_board_info ek_spi_devices[] = {
123/* 123/*
124 * MACB Ethernet device 124 * MACB Ethernet device
125 */ 125 */
126static struct at91_eth_data __initdata ek_macb_data = { 126static struct macb_platform_data __initdata ek_macb_data = {
127 .phy_irq_pin = AT91_PIN_PA7, 127 .phy_irq_pin = AT91_PIN_PA7,
128 .is_rmii = 1, 128 .is_rmii = 1,
129}; 129};
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 92de9127923a..4e1ee9d87096 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -115,7 +115,7 @@ static struct mci_platform_data __initdata mci1_data = {
115/* 115/*
116 * MACB Ethernet device 116 * MACB Ethernet device
117 */ 117 */
118static struct at91_eth_data __initdata ek_macb_data = { 118static struct macb_platform_data __initdata ek_macb_data = {
119 .phy_irq_pin = AT91_PIN_PD5, 119 .phy_irq_pin = AT91_PIN_PD5,
120 .is_rmii = 1, 120 .is_rmii = 1,
121}; 121};
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 0df01c6e2d0c..fbec934a7ce9 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -65,7 +65,7 @@ static struct at91_udc_data __initdata snapper9260_udc_data = {
65 .vbus_polled = 1, 65 .vbus_polled = 1,
66}; 66};
67 67
68static struct at91_eth_data snapper9260_macb_data = { 68static struct macb_platform_data snapper9260_macb_data = {
69 .is_rmii = 1, 69 .is_rmii = 1,
70}; 70};
71 71
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index 936e5fd7f406..7c06c07d872b 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -157,7 +157,7 @@ static struct at91_udc_data __initdata stamp9g20evb_udc_data = {
157/* 157/*
158 * MACB Ethernet device 158 * MACB Ethernet device
159 */ 159 */
160static struct at91_eth_data __initdata macb_data = { 160static struct macb_platform_data __initdata macb_data = {
161 .phy_irq_pin = AT91_PIN_PA28, 161 .phy_irq_pin = AT91_PIN_PA28,
162 .is_rmii = 1, 162 .is_rmii = 1,
163}; 163};
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
index 0a20bab21f99..3d84233f78eb 100644
--- a/arch/arm/mach-at91/board-usb-a926x.c
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -146,7 +146,7 @@ static void __init ek_add_device_spi(void)
146/* 146/*
147 * MACB Ethernet device 147 * MACB Ethernet device
148 */ 148 */
149static struct at91_eth_data __initdata ek_macb_data = { 149static struct macb_platform_data __initdata ek_macb_data = {
150 .phy_irq_pin = AT91_PIN_PE31, 150 .phy_irq_pin = AT91_PIN_PE31,
151 .is_rmii = 1, 151 .is_rmii = 1,
152}; 152};
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index 12a3f955162b..2c40a21b2794 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -110,7 +110,7 @@ static struct gpio_led yl9200_leds[] = {
110/* 110/*
111 * Ethernet 111 * Ethernet
112 */ 112 */
113static struct at91_eth_data __initdata yl9200_eth_data = { 113static struct macb_platform_data __initdata yl9200_eth_data = {
114 .phy_irq_pin = AT91_PIN_PB28, 114 .phy_irq_pin = AT91_PIN_PB28,
115 .is_rmii = 1, 115 .is_rmii = 1,
116}; 116};
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index eac92e995bb5..e209a2992245 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -40,6 +40,7 @@
40#include <linux/atmel-mci.h> 40#include <linux/atmel-mci.h>
41#include <sound/atmel-ac97c.h> 41#include <sound/atmel-ac97c.h>
42#include <linux/serial.h> 42#include <linux/serial.h>
43#include <linux/platform_data/macb.h>
43 44
44 /* USB Device */ 45 /* USB Device */
45struct at91_udc_data { 46struct at91_udc_data {
@@ -81,18 +82,7 @@ extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
81 /* atmel-mci platform config */ 82 /* atmel-mci platform config */
82extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data); 83extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
83 84
84 /* Ethernet (EMAC & MACB) */ 85extern void __init at91_add_device_eth(struct macb_platform_data *data);
85struct at91_eth_data {
86 u32 phy_mask;
87 u8 phy_irq_pin; /* PHY IRQ */
88 u8 is_rmii; /* using RMII interface? */
89};
90extern void __init at91_add_device_eth(struct at91_eth_data *data);
91
92#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91CAP9) \
93 || defined(CONFIG_ARCH_AT91SAM9G45)
94#define eth_platform_data at91_eth_data
95#endif
96 86
97 /* USB Host */ 87 /* USB Host */
98struct at91_usbh_data { 88struct at91_usbh_data {
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 0afcc3b0f870..0da2ced1ae48 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -87,6 +87,11 @@ config EXYNOS4_DEV_DWMCI
87 help 87 help
88 Compile in platform device definitions for DWMCI 88 Compile in platform device definitions for DWMCI
89 89
90config EXYNOS4_DEV_USB_OHCI
91 bool
92 help
93 Compile in platform device definition for USB OHCI
94
90config EXYNOS4_SETUP_I2C1 95config EXYNOS4_SETUP_I2C1
91 bool 96 bool
92 help 97 help
@@ -185,6 +190,7 @@ config MACH_SMDKV310
185 select EXYNOS4_DEV_DMA 190 select EXYNOS4_DEV_DMA
186 select EXYNOS4_DEV_PD 191 select EXYNOS4_DEV_PD
187 select SAMSUNG_DEV_PWM 192 select SAMSUNG_DEV_PWM
193 select EXYNOS4_DEV_USB_OHCI
188 select EXYNOS4_DEV_SYSMMU 194 select EXYNOS4_DEV_SYSMMU
189 select EXYNOS4_SETUP_FIMD0 195 select EXYNOS4_SETUP_FIMD0
190 select EXYNOS4_SETUP_I2C1 196 select EXYNOS4_SETUP_I2C1
@@ -298,6 +304,7 @@ config MACH_ORIGEN
298 select SAMSUNG_DEV_PWM 304 select SAMSUNG_DEV_PWM
299 select EXYNOS4_DEV_DMA 305 select EXYNOS4_DEV_DMA
300 select EXYNOS4_DEV_PD 306 select EXYNOS4_DEV_PD
307 select EXYNOS4_DEV_USB_OHCI
301 select EXYNOS4_SETUP_FIMD0 308 select EXYNOS4_SETUP_FIMD0
302 select EXYNOS4_SETUP_SDHCI 309 select EXYNOS4_SETUP_SDHCI
303 select EXYNOS4_SETUP_USB_PHY 310 select EXYNOS4_SETUP_USB_PHY
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 57e529620804..a0959ad04077 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_EXYNOS4_DEV_PD) += dev-pd.o
47obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o 47obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o
48obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o 48obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o
49obj-$(CONFIG_EXYNOS4_DEV_DMA) += dma.o 49obj-$(CONFIG_EXYNOS4_DEV_DMA) += dma.o
50obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o
50 51
51obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o 52obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o
52obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o 53obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o
diff --git a/arch/arm/mach-exynos/dev-ohci.c b/arch/arm/mach-exynos/dev-ohci.c
new file mode 100644
index 000000000000..b8e75300c77d
--- /dev/null
+++ b/arch/arm/mach-exynos/dev-ohci.c
@@ -0,0 +1,52 @@
1/* linux/arch/arm/mach-exynos/dev-ohci.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS - OHCI support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/dma-mapping.h>
14#include <linux/platform_device.h>
15
16#include <mach/irqs.h>
17#include <mach/map.h>
18#include <mach/ohci.h>
19
20#include <plat/devs.h>
21#include <plat/usb-phy.h>
22
23static struct resource exynos4_ohci_resource[] = {
24 [0] = DEFINE_RES_MEM(EXYNOS4_PA_OHCI, SZ_256),
25 [1] = DEFINE_RES_IRQ(IRQ_USB_HOST),
26};
27
28static u64 exynos4_ohci_dma_mask = DMA_BIT_MASK(32);
29
30struct platform_device exynos4_device_ohci = {
31 .name = "exynos-ohci",
32 .id = -1,
33 .num_resources = ARRAY_SIZE(exynos4_ohci_resource),
34 .resource = exynos4_ohci_resource,
35 .dev = {
36 .dma_mask = &exynos4_ohci_dma_mask,
37 .coherent_dma_mask = DMA_BIT_MASK(32),
38 }
39};
40
41void __init exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd)
42{
43 struct exynos4_ohci_platdata *npd;
44
45 npd = s3c_set_platdata(pd, sizeof(struct exynos4_ohci_platdata),
46 &exynos4_device_ohci);
47
48 if (!npd->phy_init)
49 npd->phy_init = s5p_usb_phy_init;
50 if (!npd->phy_exit)
51 npd->phy_exit = s5p_usb_phy_exit;
52}
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 058541d45af0..01e1cf3f9341 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -107,6 +107,7 @@
107#define EXYNOS4_PA_SROMC 0x12570000 107#define EXYNOS4_PA_SROMC 0x12570000
108 108
109#define EXYNOS4_PA_EHCI 0x12580000 109#define EXYNOS4_PA_EHCI 0x12580000
110#define EXYNOS4_PA_OHCI 0x12590000
110#define EXYNOS4_PA_HSPHY 0x125B0000 111#define EXYNOS4_PA_HSPHY 0x125B0000
111#define EXYNOS4_PA_MFC 0x13400000 112#define EXYNOS4_PA_MFC 0x13400000
112 113
diff --git a/arch/arm/mach-exynos/include/mach/ohci.h b/arch/arm/mach-exynos/include/mach/ohci.h
new file mode 100644
index 000000000000..c256c595be5e
--- /dev/null
+++ b/arch/arm/mach-exynos/include/mach/ohci.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __MACH_EXYNOS_OHCI_H
12#define __MACH_EXYNOS_OHCI_H
13
14struct exynos4_ohci_platdata {
15 int (*phy_init)(struct platform_device *pdev, int type);
16 int (*phy_exit)(struct platform_device *pdev, int type);
17};
18
19extern void exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd);
20
21#endif /* __MACH_EXYNOS_OHCI_H */
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
index f80b563f2be7..b805e595cc35 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -41,6 +41,7 @@
41#include <plat/fb.h> 41#include <plat/fb.h>
42#include <plat/mfc.h> 42#include <plat/mfc.h>
43 43
44#include <mach/ohci.h>
44#include <mach/map.h> 45#include <mach/map.h>
45 46
46/* Following are default values for UCON, ULCON and UFCON UART registers */ 47/* Following are default values for UCON, ULCON and UFCON UART registers */
@@ -483,6 +484,16 @@ static void __init origen_ehci_init(void)
483 s5p_ehci_set_platdata(pdata); 484 s5p_ehci_set_platdata(pdata);
484} 485}
485 486
487/* USB OHCI */
488static struct exynos4_ohci_platdata origen_ohci_pdata;
489
490static void __init origen_ohci_init(void)
491{
492 struct exynos4_ohci_platdata *pdata = &origen_ohci_pdata;
493
494 exynos4_ohci_set_platdata(pdata);
495}
496
486static struct gpio_keys_button origen_gpio_keys_table[] = { 497static struct gpio_keys_button origen_gpio_keys_table[] = {
487 { 498 {
488 .code = KEY_MENU, 499 .code = KEY_MENU,
@@ -606,6 +617,7 @@ static struct platform_device *origen_devices[] __initdata = {
606 &s5p_device_mfc_l, 617 &s5p_device_mfc_l,
607 &s5p_device_mfc_r, 618 &s5p_device_mfc_r,
608 &s5p_device_mixer, 619 &s5p_device_mixer,
620 &exynos4_device_ohci,
609 &exynos4_device_pd[PD_LCD0], 621 &exynos4_device_pd[PD_LCD0],
610 &exynos4_device_pd[PD_TV], 622 &exynos4_device_pd[PD_TV],
611 &exynos4_device_pd[PD_G3D], 623 &exynos4_device_pd[PD_G3D],
@@ -670,6 +682,7 @@ static void __init origen_machine_init(void)
670 s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata); 682 s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata);
671 683
672 origen_ehci_init(); 684 origen_ehci_init();
685 origen_ohci_init();
673 clk_xusbxti.rate = 24000000; 686 clk_xusbxti.rate = 24000000;
674 687
675 s5p_tv_setup(); 688 s5p_tv_setup();
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c
index cec2afabe7b4..25a5a405c4bf 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -42,6 +42,7 @@
42#include <plat/clock.h> 42#include <plat/clock.h>
43 43
44#include <mach/map.h> 44#include <mach/map.h>
45#include <mach/ohci.h>
45 46
46/* Following are default values for UCON, ULCON and UFCON UART registers */ 47/* Following are default values for UCON, ULCON and UFCON UART registers */
47#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 48#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -245,6 +246,16 @@ static void __init smdkv310_ehci_init(void)
245 s5p_ehci_set_platdata(pdata); 246 s5p_ehci_set_platdata(pdata);
246} 247}
247 248
249/* USB OHCI */
250static struct exynos4_ohci_platdata smdkv310_ohci_pdata;
251
252static void __init smdkv310_ohci_init(void)
253{
254 struct exynos4_ohci_platdata *pdata = &smdkv310_ohci_pdata;
255
256 exynos4_ohci_set_platdata(pdata);
257}
258
248static struct platform_device *smdkv310_devices[] __initdata = { 259static struct platform_device *smdkv310_devices[] __initdata = {
249 &s3c_device_hsmmc0, 260 &s3c_device_hsmmc0,
250 &s3c_device_hsmmc1, 261 &s3c_device_hsmmc1,
@@ -261,6 +272,7 @@ static struct platform_device *smdkv310_devices[] __initdata = {
261 &s5p_device_fimc3, 272 &s5p_device_fimc3,
262 &exynos4_device_ac97, 273 &exynos4_device_ac97,
263 &exynos4_device_i2s0, 274 &exynos4_device_i2s0,
275 &exynos4_device_ohci,
264 &samsung_device_keypad, 276 &samsung_device_keypad,
265 &s5p_device_mfc, 277 &s5p_device_mfc,
266 &s5p_device_mfc_l, 278 &s5p_device_mfc_l,
@@ -363,6 +375,7 @@ static void __init smdkv310_machine_init(void)
363 s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata); 375 s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata);
364 376
365 smdkv310_ehci_init(); 377 smdkv310_ehci_init();
378 smdkv310_ohci_init();
366 clk_xusbxti.rate = 24000000; 379 clk_xusbxti.rate = 24000000;
367 380
368 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices)); 381 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c
index 39aca045f660..41743d21e8c6 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -19,6 +19,13 @@
19#include <plat/cpu.h> 19#include <plat/cpu.h>
20#include <plat/usb-phy.h> 20#include <plat/usb-phy.h>
21 21
22static atomic_t host_usage;
23
24static int exynos4_usb_host_phy_is_on(void)
25{
26 return (readl(EXYNOS4_PHYPWR) & PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1;
27}
28
22static int exynos4_usb_phy1_init(struct platform_device *pdev) 29static int exynos4_usb_phy1_init(struct platform_device *pdev)
23{ 30{
24 struct clk *otg_clk; 31 struct clk *otg_clk;
@@ -27,6 +34,8 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
27 u32 rstcon; 34 u32 rstcon;
28 int err; 35 int err;
29 36
37 atomic_inc(&host_usage);
38
30 otg_clk = clk_get(&pdev->dev, "otg"); 39 otg_clk = clk_get(&pdev->dev, "otg");
31 if (IS_ERR(otg_clk)) { 40 if (IS_ERR(otg_clk)) {
32 dev_err(&pdev->dev, "Failed to get otg clock\n"); 41 dev_err(&pdev->dev, "Failed to get otg clock\n");
@@ -39,6 +48,9 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
39 return err; 48 return err;
40 } 49 }
41 50
51 if (exynos4_usb_host_phy_is_on())
52 return 0;
53
42 writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE, 54 writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE,
43 S5P_USBHOST_PHY_CONTROL); 55 S5P_USBHOST_PHY_CONTROL);
44 56
@@ -95,6 +107,9 @@ static int exynos4_usb_phy1_exit(struct platform_device *pdev)
95 struct clk *otg_clk; 107 struct clk *otg_clk;
96 int err; 108 int err;
97 109
110 if (atomic_dec_return(&host_usage) > 0)
111 return 0;
112
98 otg_clk = clk_get(&pdev->dev, "otg"); 113 otg_clk = clk_get(&pdev->dev, "otg");
99 if (IS_ERR(otg_clk)) { 114 if (IS_ERR(otg_clk)) {
100 dev_err(&pdev->dev, "Failed to get otg clock\n"); 115 dev_err(&pdev->dev, "Failed to get otg clock\n");
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 7a60bbbce7a4..f0d236dfb02b 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -120,8 +120,8 @@ static struct resource smc91x_resources[] = {
120 .flags = IORESOURCE_MEM, 120 .flags = IORESOURCE_MEM,
121 }, 121 },
122 [1] = { 122 [1] = {
123 .start = gpio_to_irq(27), 123 .start = MMP_GPIO_TO_IRQ(27),
124 .end = gpio_to_irq(27), 124 .end = MMP_GPIO_TO_IRQ(27),
125 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 125 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
126 } 126 }
127}; 127};
@@ -232,6 +232,7 @@ static void __init common_init(void)
232 pxa168_add_nand(&aspenite_nand_info); 232 pxa168_add_nand(&aspenite_nand_info);
233 pxa168_add_fb(&aspenite_lcd_info); 233 pxa168_add_fb(&aspenite_lcd_info);
234 pxa168_add_keypad(&aspenite_keypad_info); 234 pxa168_add_keypad(&aspenite_keypad_info);
235 platform_device_register(&pxa168_device_gpio);
235 236
236 /* off-chip devices */ 237 /* off-chip devices */
237 platform_device_register(&smc91x_device); 238 platform_device_register(&smc91x_device);
diff --git a/arch/arm/mach-mmp/avengers_lite.c b/arch/arm/mach-mmp/avengers_lite.c
index 39f0878d64a0..c5d53e0742e9 100644
--- a/arch/arm/mach-mmp/avengers_lite.c
+++ b/arch/arm/mach-mmp/avengers_lite.c
@@ -38,6 +38,7 @@ static void __init avengers_lite_init(void)
38 38
39 /* on-chip devices */ 39 /* on-chip devices */
40 pxa168_add_uart(2); 40 pxa168_add_uart(2);
41 platform_device_register(&pxa168_device_gpio);
41} 42}
42 43
43MACHINE_START(AVENGERS_LITE, "PXA168 Avengers lite Development Platform") 44MACHINE_START(AVENGERS_LITE, "PXA168 Avengers lite Development Platform")
diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c
index 983cfb15fbde..eb07565a06a3 100644
--- a/arch/arm/mach-mmp/brownstone.c
+++ b/arch/arm/mach-mmp/brownstone.c
@@ -202,6 +202,7 @@ static void __init brownstone_init(void)
202 /* on-chip devices */ 202 /* on-chip devices */
203 mmp2_add_uart(1); 203 mmp2_add_uart(1);
204 mmp2_add_uart(3); 204 mmp2_add_uart(3);
205 platform_device_register(&mmp2_device_gpio);
205 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info)); 206 mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
206 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ 207 mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
207 mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */ 208 mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */
diff --git a/arch/arm/mach-mmp/flint.c b/arch/arm/mach-mmp/flint.c
index c4fd806b15b4..c1f0aa88dd8a 100644
--- a/arch/arm/mach-mmp/flint.c
+++ b/arch/arm/mach-mmp/flint.c
@@ -87,8 +87,8 @@ static struct resource smc91x_resources[] = {
87 .flags = IORESOURCE_MEM, 87 .flags = IORESOURCE_MEM,
88 }, 88 },
89 [1] = { 89 [1] = {
90 .start = gpio_to_irq(155), 90 .start = MMP_GPIO_TO_IRQ(155),
91 .end = gpio_to_irq(155), 91 .end = MMP_GPIO_TO_IRQ(155),
92 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 92 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
93 } 93 }
94}; 94};
@@ -110,6 +110,7 @@ static void __init flint_init(void)
110 /* on-chip devices */ 110 /* on-chip devices */
111 mmp2_add_uart(1); 111 mmp2_add_uart(1);
112 mmp2_add_uart(2); 112 mmp2_add_uart(2);
113 platform_device_register(&mmp2_device_gpio);
113 114
114 /* off-chip devices */ 115 /* off-chip devices */
115 platform_device_register(&smc91x_device); 116 platform_device_register(&smc91x_device);
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
index 4665767a4f79..e266f66a4670 100644
--- a/arch/arm/mach-mmp/gplugd.c
+++ b/arch/arm/mach-mmp/gplugd.c
@@ -184,6 +184,7 @@ static void __init gplugd_init(void)
184 pxa168_add_uart(3); 184 pxa168_add_uart(3);
185 pxa168_add_ssp(1); 185 pxa168_add_ssp(1);
186 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info)); 186 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
187 platform_device_register(&pxa168_device_gpio);
187 188
188 pxa168_add_eth(&gplugd_eth_platform_data); 189 pxa168_add_eth(&gplugd_eth_platform_data);
189} 190}
diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
index 99b4ce1b6562..0e135a599f3e 100644
--- a/arch/arm/mach-mmp/include/mach/gpio-pxa.h
+++ b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
@@ -2,6 +2,7 @@
2#define __ASM_MACH_GPIO_PXA_H 2#define __ASM_MACH_GPIO_PXA_H
3 3
4#include <mach/addr-map.h> 4#include <mach/addr-map.h>
5#include <mach/cputype.h>
5#include <mach/irqs.h> 6#include <mach/irqs.h>
6 7
7#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000) 8#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
@@ -9,8 +10,6 @@
9#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) 10#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
10#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x))) 11#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
11 12
12#define NR_BUILTIN_GPIO IRQ_GPIO_NUM
13
14#define gpio_to_bank(gpio) ((gpio) >> 5) 13#define gpio_to_bank(gpio) ((gpio) >> 5)
15 14
16/* NOTE: these macros are defined here to make optimization of 15/* NOTE: these macros are defined here to make optimization of
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
index 681262359d1c..13219ebf5128 100644
--- a/arch/arm/mach-mmp/include/mach/gpio.h
+++ b/arch/arm/mach-mmp/include/mach/gpio.h
@@ -3,11 +3,6 @@
3 3
4#include <asm-generic/gpio.h> 4#include <asm-generic/gpio.h>
5 5
6#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio)) 6#include <mach/cputype.h>
7#define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
8 7
9#define __gpio_is_inverted(gpio) (0)
10#define __gpio_is_occupied(gpio) (0)
11
12#include <plat/gpio.h>
13#endif /* __ASM_MACH_GPIO_H */ 8#endif /* __ASM_MACH_GPIO_H */
diff --git a/arch/arm/mach-mmp/include/mach/irqs.h b/arch/arm/mach-mmp/include/mach/irqs.h
index a09d328e2ddd..34635a0bbb59 100644
--- a/arch/arm/mach-mmp/include/mach/irqs.h
+++ b/arch/arm/mach-mmp/include/mach/irqs.h
@@ -219,10 +219,10 @@
219#define IRQ_MMP2_MUX_END (IRQ_MMP2_SSP_BASE + 2) 219#define IRQ_MMP2_MUX_END (IRQ_MMP2_SSP_BASE + 2)
220 220
221#define IRQ_GPIO_START 128 221#define IRQ_GPIO_START 128
222#define IRQ_GPIO_NUM 192 222#define MMP_NR_BUILTIN_GPIO 192
223#define IRQ_GPIO(x) (IRQ_GPIO_START + (x)) 223#define MMP_GPIO_TO_IRQ(gpio) (IRQ_GPIO_START + (gpio))
224 224
225#define IRQ_BOARD_START (IRQ_GPIO_START + IRQ_GPIO_NUM) 225#define IRQ_BOARD_START (IRQ_GPIO_START + MMP_NR_BUILTIN_GPIO)
226 226
227#define NR_IRQS (IRQ_BOARD_START) 227#define NR_IRQS (IRQ_BOARD_START)
228 228
diff --git a/arch/arm/mach-mmp/include/mach/mmp2.h b/arch/arm/mach-mmp/include/mach/mmp2.h
index 2f7b2d3c2b18..cba22fed2265 100644
--- a/arch/arm/mach-mmp/include/mach/mmp2.h
+++ b/arch/arm/mach-mmp/include/mach/mmp2.h
@@ -32,6 +32,8 @@ extern struct pxa_device_desc mmp2_device_sdh3;
32extern struct pxa_device_desc mmp2_device_asram; 32extern struct pxa_device_desc mmp2_device_asram;
33extern struct pxa_device_desc mmp2_device_isram; 33extern struct pxa_device_desc mmp2_device_isram;
34 34
35extern struct platform_device mmp2_device_gpio;
36
35static inline int mmp2_add_uart(int id) 37static inline int mmp2_add_uart(int id)
36{ 38{
37 struct pxa_device_desc *d = NULL; 39 struct pxa_device_desc *d = NULL;
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index 7fb568d2845b..f9286089da3a 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.h
@@ -42,6 +42,8 @@ struct pxa168_usb_pdata {
42/* pdata can be NULL */ 42/* pdata can be NULL */
43int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata); 43int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata);
44 44
45extern struct platform_device pxa168_device_gpio;
46
45static inline int pxa168_add_uart(int id) 47static inline int pxa168_add_uart(int id)
46{ 48{
47 struct pxa_device_desc *d = NULL; 49 struct pxa_device_desc *d = NULL;
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h
index 91be75591398..4de13abef7bb 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -21,6 +21,8 @@ extern struct pxa_device_desc pxa910_device_pwm3;
21extern struct pxa_device_desc pxa910_device_pwm4; 21extern struct pxa_device_desc pxa910_device_pwm4;
22extern struct pxa_device_desc pxa910_device_nand; 22extern struct pxa_device_desc pxa910_device_nand;
23 23
24extern struct platform_device pxa910_device_gpio;
25
24static inline int pxa910_add_uart(int id) 26static inline int pxa910_add_uart(int id)
25{ 27{
26 struct pxa_device_desc *d = NULL; 28 struct pxa_device_desc *d = NULL;
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index 5dd1d4a6aeb9..617c60a170a4 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/platform_device.h>
16 17
17#include <asm/hardware/cache-tauros2.h> 18#include <asm/hardware/cache-tauros2.h>
18 19
@@ -24,7 +25,6 @@
24#include <mach/irqs.h> 25#include <mach/irqs.h>
25#include <mach/dma.h> 26#include <mach/dma.h>
26#include <mach/mfp.h> 27#include <mach/mfp.h>
27#include <mach/gpio-pxa.h>
28#include <mach/devices.h> 28#include <mach/devices.h>
29#include <mach/mmp2.h> 29#include <mach/mmp2.h>
30 30
@@ -33,8 +33,6 @@
33 33
34#define MFPR_VIRT_BASE (APB_VIRT_BASE + 0x1e000) 34#define MFPR_VIRT_BASE (APB_VIRT_BASE + 0x1e000)
35 35
36#define APMASK(i) (GPIO_REGS_VIRT + BANK_OFF(i) + 0x9c)
37
38static struct mfp_addr_map mmp2_addr_map[] __initdata = { 36static struct mfp_addr_map mmp2_addr_map[] __initdata = {
39 37
40 MFP_ADDR_X(GPIO0, GPIO58, 0x54), 38 MFP_ADDR_X(GPIO0, GPIO58, 0x54),
@@ -95,24 +93,9 @@ void mmp2_clear_pmic_int(void)
95 __raw_writel(data, mfpr_pmic); 93 __raw_writel(data, mfpr_pmic);
96} 94}
97 95
98static void __init mmp2_init_gpio(void)
99{
100 int i;
101
102 /* enable GPIO clock */
103 __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_MMP2_GPIO);
104
105 /* unmask GPIO edge detection for all 6 banks -- APMASKx */
106 for (i = 0; i < 6; i++)
107 __raw_writel(0xffffffff, APMASK(i));
108
109 pxa_init_gpio(IRQ_MMP2_GPIO, 0, 167, NULL);
110}
111
112void __init mmp2_init_irq(void) 96void __init mmp2_init_irq(void)
113{ 97{
114 mmp2_init_icu(); 98 mmp2_init_icu();
115 mmp2_init_gpio();
116} 99}
117 100
118static void sdhc_clk_enable(struct clk *clk) 101static void sdhc_clk_enable(struct clk *clk)
@@ -149,6 +132,7 @@ static APBC_CLK(twsi3, MMP2_TWSI3, 0, 26000000);
149static APBC_CLK(twsi4, MMP2_TWSI4, 0, 26000000); 132static APBC_CLK(twsi4, MMP2_TWSI4, 0, 26000000);
150static APBC_CLK(twsi5, MMP2_TWSI5, 0, 26000000); 133static APBC_CLK(twsi5, MMP2_TWSI5, 0, 26000000);
151static APBC_CLK(twsi6, MMP2_TWSI6, 0, 26000000); 134static APBC_CLK(twsi6, MMP2_TWSI6, 0, 26000000);
135static APBC_CLK(gpio, MMP2_GPIO, 0, 26000000);
152 136
153static APMU_CLK(nand, NAND, 0xbf, 100000000); 137static APMU_CLK(nand, NAND, 0xbf, 100000000);
154static APMU_CLK_OPS(sdh0, SDH0, 0x1b, 200000000, &sdhc_clk_ops); 138static APMU_CLK_OPS(sdh0, SDH0, 0x1b, 200000000, &sdhc_clk_ops);
@@ -168,6 +152,7 @@ static struct clk_lookup mmp2_clkregs[] = {
168 INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL), 152 INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL),
169 INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL), 153 INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL),
170 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 154 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
155 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
171 INIT_CLKREG(&clk_sdh0, "sdhci-pxav3.0", "PXA-SDHCLK"), 156 INIT_CLKREG(&clk_sdh0, "sdhci-pxav3.0", "PXA-SDHCLK"),
172 INIT_CLKREG(&clk_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"), 157 INIT_CLKREG(&clk_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"),
173 INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"), 158 INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"),
@@ -230,3 +215,21 @@ MMP2_DEVICE(asram, "asram", -1, NONE, 0xe0000000, 0x4000);
230/* 0xd1000000 ~ 0xd101ffff is reserved for secure processor */ 215/* 0xd1000000 ~ 0xd101ffff is reserved for secure processor */
231MMP2_DEVICE(isram, "isram", -1, NONE, 0xd1020000, 0x18000); 216MMP2_DEVICE(isram, "isram", -1, NONE, 0xd1020000, 0x18000);
232 217
218struct resource mmp2_resource_gpio[] = {
219 {
220 .start = 0xd4019000,
221 .end = 0xd4019fff,
222 .flags = IORESOURCE_MEM,
223 }, {
224 .start = IRQ_MMP2_GPIO,
225 .end = IRQ_MMP2_GPIO,
226 .flags = IORESOURCE_IRQ,
227 },
228};
229
230struct platform_device mmp2_device_gpio = {
231 .name = "pxa-gpio",
232 .id = -1,
233 .num_resources = ARRAY_SIZE(mmp2_resource_gpio),
234 .resource = mmp2_resource_gpio,
235};
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 76ca15c00e45..84245035f351 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -13,6 +13,7 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/platform_device.h>
16 17
17#include <asm/mach/time.h> 18#include <asm/mach/time.h>
18#include <mach/addr-map.h> 19#include <mach/addr-map.h>
@@ -20,7 +21,6 @@
20#include <mach/regs-apbc.h> 21#include <mach/regs-apbc.h>
21#include <mach/regs-apmu.h> 22#include <mach/regs-apmu.h>
22#include <mach/irqs.h> 23#include <mach/irqs.h>
23#include <mach/gpio-pxa.h>
24#include <mach/dma.h> 24#include <mach/dma.h>
25#include <mach/devices.h> 25#include <mach/devices.h>
26#include <mach/mfp.h> 26#include <mach/mfp.h>
@@ -43,26 +43,9 @@ static struct mfp_addr_map pxa168_mfp_addr_map[] __initdata =
43 MFP_ADDR_END, 43 MFP_ADDR_END,
44}; 44};
45 45
46#define APMASK(i) (GPIO_REGS_VIRT + BANK_OFF(i) + 0x09c)
47
48static void __init pxa168_init_gpio(void)
49{
50 int i;
51
52 /* enable GPIO clock */
53 __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_PXA168_GPIO);
54
55 /* unmask GPIO edge detection for all 4 banks - APMASKx */
56 for (i = 0; i < 4; i++)
57 __raw_writel(0xffffffff, APMASK(i));
58
59 pxa_init_gpio(IRQ_PXA168_GPIOX, 0, 127, NULL);
60}
61
62void __init pxa168_init_irq(void) 46void __init pxa168_init_irq(void)
63{ 47{
64 icu_init_irq(); 48 icu_init_irq();
65 pxa168_init_gpio();
66} 49}
67 50
68/* APB peripheral clocks */ 51/* APB peripheral clocks */
@@ -80,6 +63,7 @@ static APBC_CLK(ssp2, PXA168_SSP2, 4, 0);
80static APBC_CLK(ssp3, PXA168_SSP3, 4, 0); 63static APBC_CLK(ssp3, PXA168_SSP3, 4, 0);
81static APBC_CLK(ssp4, PXA168_SSP4, 4, 0); 64static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
82static APBC_CLK(ssp5, PXA168_SSP5, 4, 0); 65static APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
66static APBC_CLK(gpio, PXA168_GPIO, 0, 13000000);
83static APBC_CLK(keypad, PXA168_KPC, 0, 32000); 67static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
84 68
85static APMU_CLK(nand, NAND, 0x19b, 156000000); 69static APMU_CLK(nand, NAND, 0x19b, 156000000);
@@ -105,6 +89,7 @@ static struct clk_lookup pxa168_clkregs[] = {
105 INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL), 89 INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
106 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 90 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
107 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL), 91 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
92 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
108 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), 93 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
109 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"), 94 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
110 INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"), 95 INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"),
@@ -174,6 +159,25 @@ PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
174PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c); 159PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c);
175PXA168_DEVICE(eth, "pxa168-eth", -1, MFU, 0xc0800000, 0x0fff); 160PXA168_DEVICE(eth, "pxa168-eth", -1, MFU, 0xc0800000, 0x0fff);
176 161
162struct resource pxa168_resource_gpio[] = {
163 {
164 .start = 0xd4019000,
165 .end = 0xd4019fff,
166 .flags = IORESOURCE_MEM,
167 }, {
168 .start = IRQ_PXA168_GPIOX,
169 .end = IRQ_PXA168_GPIOX,
170 .flags = IORESOURCE_IRQ,
171 },
172};
173
174struct platform_device pxa168_device_gpio = {
175 .name = "pxa-gpio",
176 .id = -1,
177 .num_resources = ARRAY_SIZE(pxa168_resource_gpio),
178 .resource = pxa168_resource_gpio,
179};
180
177struct resource pxa168_usb_host_resources[] = { 181struct resource pxa168_usb_host_resources[] = {
178 /* USB Host conroller register base */ 182 /* USB Host conroller register base */
179 [0] = { 183 [0] = {
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 4ebbfbba39fc..3241a25784d0 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/platform_device.h>
15 16
16#include <asm/mach/time.h> 17#include <asm/mach/time.h>
17#include <mach/addr-map.h> 18#include <mach/addr-map.h>
@@ -19,7 +20,6 @@
19#include <mach/regs-apmu.h> 20#include <mach/regs-apmu.h>
20#include <mach/cputype.h> 21#include <mach/cputype.h>
21#include <mach/irqs.h> 22#include <mach/irqs.h>
22#include <mach/gpio-pxa.h>
23#include <mach/dma.h> 23#include <mach/dma.h>
24#include <mach/mfp.h> 24#include <mach/mfp.h>
25#include <mach/devices.h> 25#include <mach/devices.h>
@@ -77,26 +77,9 @@ static struct mfp_addr_map pxa910_mfp_addr_map[] __initdata =
77 MFP_ADDR_END, 77 MFP_ADDR_END,
78}; 78};
79 79
80#define APMASK(i) (GPIO_REGS_VIRT + BANK_OFF(i) + 0x09c)
81
82static void __init pxa910_init_gpio(void)
83{
84 int i;
85
86 /* enable GPIO clock */
87 __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_PXA910_GPIO);
88
89 /* unmask GPIO edge detection for all 4 banks - APMASKx */
90 for (i = 0; i < 4; i++)
91 __raw_writel(0xffffffff, APMASK(i));
92
93 pxa_init_gpio(IRQ_PXA910_AP_GPIO, 0, 127, NULL);
94}
95
96void __init pxa910_init_irq(void) 80void __init pxa910_init_irq(void)
97{ 81{
98 icu_init_irq(); 82 icu_init_irq();
99 pxa910_init_gpio();
100} 83}
101 84
102/* APB peripheral clocks */ 85/* APB peripheral clocks */
@@ -108,6 +91,7 @@ static APBC_CLK(pwm1, PXA910_PWM1, 1, 13000000);
108static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000); 91static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
109static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000); 92static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
110static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000); 93static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
94static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000);
111 95
112static APMU_CLK(nand, NAND, 0x19b, 156000000); 96static APMU_CLK(nand, NAND, 0x19b, 156000000);
113static APMU_CLK(u2o, USB, 0x1b, 480000000); 97static APMU_CLK(u2o, USB, 0x1b, 480000000);
@@ -123,6 +107,7 @@ static struct clk_lookup pxa910_clkregs[] = {
123 INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL), 107 INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
124 INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL), 108 INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
125 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 109 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
110 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
126 INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"), 111 INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"),
127}; 112};
128 113
@@ -179,3 +164,22 @@ PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
179PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10); 164PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
180PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10); 165PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
181PXA910_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x80, 97, 99); 166PXA910_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x80, 97, 99);
167
168struct resource pxa910_resource_gpio[] = {
169 {
170 .start = 0xd4019000,
171 .end = 0xd4019fff,
172 .flags = IORESOURCE_MEM,
173 }, {
174 .start = IRQ_PXA910_AP_GPIO,
175 .end = IRQ_PXA910_AP_GPIO,
176 .flags = IORESOURCE_IRQ,
177 },
178};
179
180struct platform_device pxa910_device_gpio = {
181 .name = "pxa-gpio",
182 .id = -1,
183 .num_resources = ARRAY_SIZE(pxa910_resource_gpio),
184 .resource = pxa910_resource_gpio,
185};
diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
index eb5be879fd8c..bb2ddb72bca2 100644
--- a/arch/arm/mach-mmp/tavorevb.c
+++ b/arch/arm/mach-mmp/tavorevb.c
@@ -19,6 +19,7 @@
19#include <mach/addr-map.h> 19#include <mach/addr-map.h>
20#include <mach/mfp-pxa910.h> 20#include <mach/mfp-pxa910.h>
21#include <mach/pxa910.h> 21#include <mach/pxa910.h>
22#include <mach/irqs.h>
22 23
23#include "common.h" 24#include "common.h"
24 25
@@ -71,8 +72,8 @@ static struct resource smc91x_resources[] = {
71 .flags = IORESOURCE_MEM, 72 .flags = IORESOURCE_MEM,
72 }, 73 },
73 [1] = { 74 [1] = {
74 .start = gpio_to_irq(80), 75 .start = MMP_GPIO_TO_IRQ(80),
75 .end = gpio_to_irq(80), 76 .end = MMP_GPIO_TO_IRQ(80),
76 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 77 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
77 } 78 }
78}; 79};
@@ -93,6 +94,7 @@ static void __init tavorevb_init(void)
93 94
94 /* on-chip devices */ 95 /* on-chip devices */
95 pxa910_add_uart(1); 96 pxa910_add_uart(1);
97 platform_device_register(&pxa910_device_gpio);
96 98
97 /* off-chip devices */ 99 /* off-chip devices */
98 platform_device_register(&smc91x_device); 100 platform_device_register(&smc91x_device);
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
index bbe4727b96cc..703de85b571c 100644
--- a/arch/arm/mach-mmp/teton_bga.c
+++ b/arch/arm/mach-mmp/teton_bga.c
@@ -66,7 +66,7 @@ static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
66static struct i2c_board_info teton_bga_i2c_info[] __initdata = { 66static struct i2c_board_info teton_bga_i2c_info[] __initdata = {
67 { 67 {
68 I2C_BOARD_INFO("ds1337", 0x68), 68 I2C_BOARD_INFO("ds1337", 0x68),
69 .irq = gpio_to_irq(RTC_INT_GPIO) 69 .irq = MMP_GPIO_TO_IRQ(RTC_INT_GPIO)
70 }, 70 },
71}; 71};
72 72
@@ -78,6 +78,7 @@ static void __init teton_bga_init(void)
78 pxa168_add_uart(1); 78 pxa168_add_uart(1);
79 pxa168_add_keypad(&teton_bga_keypad_info); 79 pxa168_add_keypad(&teton_bga_keypad_info);
80 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info)); 80 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
81 platform_device_register(&pxa168_device_gpio);
81} 82}
82 83
83MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform") 84MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform")
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 176515a76989..a80ed262df1c 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -24,12 +24,13 @@
24#include <mach/addr-map.h> 24#include <mach/addr-map.h>
25#include <mach/mfp-pxa910.h> 25#include <mach/mfp-pxa910.h>
26#include <mach/pxa910.h> 26#include <mach/pxa910.h>
27#include <mach/irqs.h>
27 28
28#include "common.h" 29#include "common.h"
29 30
30#define TTCDKB_GPIO_EXT0(x) (NR_BUILTIN_GPIO + ((x < 0) ? 0 : \ 31#define TTCDKB_GPIO_EXT0(x) (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 : \
31 ((x < 16) ? x : 15))) 32 ((x < 16) ? x : 15)))
32#define TTCDKB_GPIO_EXT1(x) (NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \ 33#define TTCDKB_GPIO_EXT1(x) (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
33 ((x < 16) ? x : 15))) 34 ((x < 16) ? x : 15)))
34 35
35/* 36/*
@@ -122,6 +123,7 @@ static struct platform_device ttc_dkb_device_onenand = {
122}; 123};
123 124
124static struct platform_device *ttc_dkb_devices[] = { 125static struct platform_device *ttc_dkb_devices[] = {
126 &pxa910_device_gpio,
125 &ttc_dkb_device_onenand, 127 &ttc_dkb_device_onenand,
126}; 128};
127 129
@@ -136,7 +138,7 @@ static struct i2c_board_info ttc_dkb_i2c_info[] = {
136 { 138 {
137 .type = "max7312", 139 .type = "max7312",
138 .addr = 0x23, 140 .addr = 0x23,
139 .irq = IRQ_GPIO(80), 141 .irq = MMP_GPIO_TO_IRQ(80),
140 .platform_data = &max7312_data, 142 .platform_data = &max7312_data,
141 }, 143 },
142}; 144};
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index da6e4aad177c..df0ad3ce234b 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -22,6 +22,7 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/clkdev.h> 24#include <linux/clkdev.h>
25#include <linux/spinlock.h>
25 26
26#include <asm/clkdev.h> 27#include <asm/clkdev.h>
27#include <asm/div64.h> 28#include <asm/div64.h>
@@ -29,6 +30,7 @@
29#include <mach/mx28.h> 30#include <mach/mx28.h>
30#include <mach/common.h> 31#include <mach/common.h>
31#include <mach/clock.h> 32#include <mach/clock.h>
33#include <mach/digctl.h>
32 34
33#include "regs-clkctrl-mx28.h" 35#include "regs-clkctrl-mx28.h"
34 36
@@ -43,6 +45,33 @@ static struct clk emi_clk;
43static struct clk saif0_clk; 45static struct clk saif0_clk;
44static struct clk saif1_clk; 46static struct clk saif1_clk;
45static struct clk clk32k_clk; 47static struct clk clk32k_clk;
48static DEFINE_SPINLOCK(clkmux_lock);
49
50/*
51 * HW_SAIF_CLKMUX_SEL:
52 * DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and SAIF1
53 * clock pins selected for SAIF1 input clocks.
54 * CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks, and
55 * SAIF0 clock inputs selected for SAIF1 input clocks.
56 * EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input
57 * clocks.
58 * EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input
59 * clocks.
60 */
61int mxs_saif_clkmux_select(unsigned int clkmux)
62{
63 if (clkmux > 0x3)
64 return -EINVAL;
65
66 spin_lock(&clkmux_lock);
67 __raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
68 DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
69 __raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
70 DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
71 spin_unlock(&clkmux_lock);
72
73 return 0;
74}
46 75
47static int _raw_clk_enable(struct clk *clk) 76static int _raw_clk_enable(struct clk *clk)
48{ 77{
@@ -785,6 +814,15 @@ int __init mx28_clocks_init(void)
785 clk_set_parent(&saif0_clk, &pll0_clk); 814 clk_set_parent(&saif0_clk, &pll0_clk);
786 clk_set_parent(&saif1_clk, &pll0_clk); 815 clk_set_parent(&saif1_clk, &pll0_clk);
787 816
817 /*
818 * Set an initial clock rate for the saif internal logic to work
819 * properly. This is important when working in EXTMASTER mode that
820 * uses the other saif's BITCLK&LRCLK but it still needs a basic
821 * clock which should be fast enough for the internal logic.
822 */
823 clk_set_rate(&saif0_clk, 24000000);
824 clk_set_rate(&saif1_clk, 24000000);
825
788 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 826 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
789 827
790 mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0); 828 mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0);
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index c8887103f0e3..4f50094e293d 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -47,6 +47,7 @@ struct platform_device *__init mx28_add_mxsfb(
47 const struct mxsfb_platform_data *pdata); 47 const struct mxsfb_platform_data *pdata);
48 48
49extern const struct mxs_saif_data mx28_saif_data[] __initconst; 49extern const struct mxs_saif_data mx28_saif_data[] __initconst;
50#define mx28_add_saif(id) mxs_add_saif(&mx28_saif_data[id]) 50#define mx28_add_saif(id, pdata) \
51 mxs_add_saif(&mx28_saif_data[id], pdata)
51 52
52struct platform_device *__init mx28_add_rtc_stmp3xxx(void); 53struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-saif.c b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
index 1ec965e9fe92..f6e3a60b4201 100644
--- a/arch/arm/mach-mxs/devices/platform-mxs-saif.c
+++ b/arch/arm/mach-mxs/devices/platform-mxs-saif.c
@@ -32,7 +32,8 @@ const struct mxs_saif_data mx28_saif_data[] __initconst = {
32}; 32};
33#endif 33#endif
34 34
35struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data) 35struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data,
36 const struct mxs_saif_platform_data *pdata)
36{ 37{
37 struct resource res[] = { 38 struct resource res[] = {
38 { 39 {
@@ -56,5 +57,5 @@ struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
56 }; 57 };
57 58
58 return mxs_add_platform_device("mxs-saif", data->id, res, 59 return mxs_add_platform_device("mxs-saif", data->id, res,
59 ARRAY_SIZE(res), NULL, 0); 60 ARRAY_SIZE(res), pdata, sizeof(*pdata));
60} 61}
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h
index 635bb5d9a20a..3bbb94f4bbe1 100644
--- a/arch/arm/mach-mxs/include/mach/common.h
+++ b/arch/arm/mach-mxs/include/mach/common.h
@@ -16,6 +16,7 @@ struct clk;
16extern const u32 *mxs_get_ocotp(void); 16extern const u32 *mxs_get_ocotp(void);
17extern int mxs_reset_block(void __iomem *); 17extern int mxs_reset_block(void __iomem *);
18extern void mxs_timer_init(struct clk *, int); 18extern void mxs_timer_init(struct clk *, int);
19extern int mxs_saif_clkmux_select(unsigned int clkmux);
19 20
20extern int mx23_register_gpios(void); 21extern int mx23_register_gpios(void);
21extern int mx23_clocks_init(void); 22extern int mx23_clocks_init(void);
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index a8080f44c03d..dc369c1239fc 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -94,6 +94,7 @@ struct platform_device *__init mxs_add_mxs_pwm(
94 resource_size_t iobase, int id); 94 resource_size_t iobase, int id);
95 95
96/* saif */ 96/* saif */
97#include <sound/saif.h>
97struct mxs_saif_data { 98struct mxs_saif_data {
98 int id; 99 int id;
99 resource_size_t iobase; 100 resource_size_t iobase;
@@ -103,4 +104,5 @@ struct mxs_saif_data {
103}; 104};
104 105
105struct platform_device *__init mxs_add_saif( 106struct platform_device *__init mxs_add_saif(
106 const struct mxs_saif_data *data); 107 const struct mxs_saif_data *data,
108 const struct mxs_saif_platform_data *pdata);
diff --git a/arch/arm/mach-mxs/include/mach/digctl.h b/arch/arm/mach-mxs/include/mach/digctl.h
new file mode 100644
index 000000000000..49a888c65d6d
--- /dev/null
+++ b/arch/arm/mach-mxs/include/mach/digctl.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __MACH_DIGCTL_H__
10#define __MACH_DIGCTL_H__
11
12/* MXS DIGCTL SAIF CLKMUX */
13#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT 0x0
14#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT 0x1
15#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0 0x2
16#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1 0x3
17
18#define HW_DIGCTL_CTRL 0x0
19#define BP_DIGCTL_CTRL_SAIF_CLKMUX 10
20#define BM_DIGCTL_CTRL_SAIF_CLKMUX (0x3 << 10)
21#endif
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index 064ec5abaa55..ac84a10baa14 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -27,6 +27,7 @@
27 27
28#include <mach/common.h> 28#include <mach/common.h>
29#include <mach/iomux-mx28.h> 29#include <mach/iomux-mx28.h>
30#include <mach/digctl.h>
30 31
31#include "devices-mx28.h" 32#include "devices-mx28.h"
32 33
@@ -421,6 +422,18 @@ static struct gpio mx28evk_lcd_gpios[] = {
421 { MX28EVK_BL_ENABLE, GPIOF_OUT_INIT_HIGH, "bl-enable" }, 422 { MX28EVK_BL_ENABLE, GPIOF_OUT_INIT_HIGH, "bl-enable" },
422}; 423};
423 424
425static const struct mxs_saif_platform_data
426 mx28evk_mxs_saif_pdata[] __initconst = {
427 /* working on EXTMSTR0 mode (saif0 master, saif1 slave) */
428 {
429 .master_mode = 1,
430 .master_id = 0,
431 }, {
432 .master_mode = 0,
433 .master_id = 0,
434 },
435};
436
424static void __init mx28evk_init(void) 437static void __init mx28evk_init(void)
425{ 438{
426 int ret; 439 int ret;
@@ -454,8 +467,9 @@ static void __init mx28evk_init(void)
454 else 467 else
455 mx28_add_mxsfb(&mx28evk_mxsfb_pdata); 468 mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
456 469
457 mx28_add_saif(0); 470 mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
458 mx28_add_saif(1); 471 mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]);
472 mx28_add_saif(1, &mx28evk_mxs_saif_pdata[1]);
459 473
460 mx28_add_mxs_i2c(0); 474 mx28_add_mxs_i2c(0);
461 i2c_register_board_info(0, mxs_i2c0_board_info, 475 i2c_register_board_info(0, mxs_i2c0_board_info,
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 515646886b59..ba23224963d0 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -404,6 +404,7 @@ static struct omap2_hsmmc_info mmc[] = {
404 { 404 {
405 .mmc = 5, 405 .mmc = 5,
406 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, 406 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
407 .pm_caps = MMC_PM_KEEP_POWER,
407 .gpio_cd = -EINVAL, 408 .gpio_cd = -EINVAL,
408 .gpio_wp = -EINVAL, 409 .gpio_wp = -EINVAL,
409 .ocr_mask = MMC_VDD_165_195, 410 .ocr_mask = MMC_VDD_165_195,
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index d314f033c9df..f7df8d35ee90 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -24,6 +24,7 @@
24#include <linux/i2c/pca953x.h> 24#include <linux/i2c/pca953x.h>
25#include <linux/can/platform/ti_hecc.h> 25#include <linux/can/platform/ti_hecc.h>
26#include <linux/davinci_emac.h> 26#include <linux/davinci_emac.h>
27#include <linux/mmc/host.h>
27 28
28#include <mach/hardware.h> 29#include <mach/hardware.h>
29#include <mach/am35xx.h> 30#include <mach/am35xx.h>
@@ -40,6 +41,7 @@
40 41
41#include "mux.h" 42#include "mux.h"
42#include "control.h" 43#include "control.h"
44#include "hsmmc.h"
43 45
44#define AM35XX_EVM_MDIO_FREQUENCY (1000000) 46#define AM35XX_EVM_MDIO_FREQUENCY (1000000)
45 47
@@ -455,6 +457,23 @@ static void am3517_evm_hecc_init(struct ti_hecc_platform_data *pdata)
455static struct omap_board_config_kernel am3517_evm_config[] __initdata = { 457static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
456}; 458};
457 459
460static struct omap2_hsmmc_info mmc[] = {
461 {
462 .mmc = 1,
463 .caps = MMC_CAP_4_BIT_DATA,
464 .gpio_cd = 127,
465 .gpio_wp = 126,
466 },
467 {
468 .mmc = 2,
469 .caps = MMC_CAP_4_BIT_DATA,
470 .gpio_cd = 128,
471 .gpio_wp = 129,
472 },
473 {} /* Terminator */
474};
475
476
458static void __init am3517_evm_init(void) 477static void __init am3517_evm_init(void)
459{ 478{
460 omap_board_config = am3517_evm_config; 479 omap_board_config = am3517_evm_config;
@@ -483,6 +502,9 @@ static void __init am3517_evm_init(void)
483 502
484 /* MUSB */ 503 /* MUSB */
485 am3517_evm_musb_init(); 504 am3517_evm_musb_init();
505
506 /* MMC init function */
507 omap2_hsmmc_init(mmc);
486} 508}
487 509
488MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM") 510MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 5d0064a4fb5a..9d59451446d9 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -2480,6 +2480,16 @@ static struct clk uart4_fck = {
2480 .recalc = &followparent_recalc, 2480 .recalc = &followparent_recalc,
2481}; 2481};
2482 2482
2483static struct clk uart4_fck_am35xx = {
2484 .name = "uart4_fck",
2485 .ops = &clkops_omap2_dflt_wait,
2486 .parent = &per_48m_fck,
2487 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2488 .enable_bit = OMAP3430_EN_UART4_SHIFT,
2489 .clkdm_name = "core_l4_clkdm",
2490 .recalc = &followparent_recalc,
2491};
2492
2483static struct clk gpt2_fck = { 2493static struct clk gpt2_fck = {
2484 .name = "gpt2_fck", 2494 .name = "gpt2_fck",
2485 .ops = &clkops_omap2_dflt_wait, 2495 .ops = &clkops_omap2_dflt_wait,
@@ -3287,7 +3297,7 @@ static struct omap_clk omap3xxx_clks[] = {
3287 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3297 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3288 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3298 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3289 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3299 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3290 CLK("usbhs-omap.0", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3300 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3291 CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck, CK_3XXX), 3301 CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck, CK_3XXX),
3292 CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck, CK_3XXX), 3302 CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck, CK_3XXX),
3293 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX), 3303 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
@@ -3323,7 +3333,7 @@ static struct omap_clk omap3xxx_clks[] = {
3323 CLK(NULL, "pka_ick", &pka_ick, CK_34XX | CK_36XX), 3333 CLK(NULL, "pka_ick", &pka_ick, CK_34XX | CK_36XX),
3324 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX), 3334 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX),
3325 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3335 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3326 CLK("usbhs-omap.0", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3336 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3327 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3337 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3328 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX), 3338 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX),
3329 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX), 3339 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX),
@@ -3369,20 +3379,18 @@ static struct omap_clk omap3xxx_clks[] = {
3369 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX), 3379 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX),
3370 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX), 3380 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX),
3371 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3381 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3372 CLK("usbhs-omap.0", "hs_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3373 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3382 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3374 CLK("usbhs-omap.0", "fs_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3375 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3383 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3376 CLK("usbhs-omap.0", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX), 3384 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3377 CLK("usbhs-omap.0", "utmi_p1_gfclk", &dummy_ck, CK_3XXX), 3385 CLK("usbhs_omap", "utmi_p1_gfclk", &dummy_ck, CK_3XXX),
3378 CLK("usbhs-omap.0", "utmi_p2_gfclk", &dummy_ck, CK_3XXX), 3386 CLK("usbhs_omap", "utmi_p2_gfclk", &dummy_ck, CK_3XXX),
3379 CLK("usbhs-omap.0", "xclk60mhsp1_ck", &dummy_ck, CK_3XXX), 3387 CLK("usbhs_omap", "xclk60mhsp1_ck", &dummy_ck, CK_3XXX),
3380 CLK("usbhs-omap.0", "xclk60mhsp2_ck", &dummy_ck, CK_3XXX), 3388 CLK("usbhs_omap", "xclk60mhsp2_ck", &dummy_ck, CK_3XXX),
3381 CLK("usbhs-omap.0", "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX), 3389 CLK("usbhs_omap", "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX),
3382 CLK("usbhs-omap.0", "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX), 3390 CLK("usbhs_omap", "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX),
3383 CLK("usbhs-omap.0", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX), 3391 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3384 CLK("usbhs-omap.0", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX), 3392 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3385 CLK("usbhs-omap.0", "init_60m_fclk", &dummy_ck, CK_3XXX), 3393 CLK("usbhs_omap", "init_60m_fclk", &dummy_ck, CK_3XXX),
3386 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX), 3394 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3387 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX), 3395 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3388 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX), 3396 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
@@ -3403,6 +3411,7 @@ static struct omap_clk omap3xxx_clks[] = {
3403 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX), 3411 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3404 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX), 3412 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3405 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX), 3413 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3414 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_3505 | CK_3517),
3406 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX), 3415 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3407 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX), 3416 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3408 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX), 3417 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 0798a802497a..c8a1b2740778 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3295,7 +3295,7 @@ static struct omap_clk omap44xx_clks[] = {
3295 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X), 3295 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X),
3296 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X), 3296 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
3297 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X), 3297 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X),
3298 CLK("usbhs-omap.0", "fs_fck", &usb_host_fs_fck, CK_443X), 3298 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X),
3299 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X), 3299 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X),
3300 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X), 3300 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X),
3301 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X), 3301 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X),
@@ -3306,7 +3306,7 @@ static struct omap_clk omap44xx_clks[] = {
3306 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X), 3306 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X),
3307 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X), 3307 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X),
3308 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X), 3308 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X),
3309 CLK("usbhs-omap.0", "hs_fck", &usb_host_hs_fck, CK_443X), 3309 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X),
3310 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X), 3310 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
3311 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X), 3311 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
3312 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X), 3312 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
@@ -3314,7 +3314,7 @@ static struct omap_clk omap44xx_clks[] = {
3314 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X), 3314 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
3315 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X), 3315 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
3316 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X), 3316 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X),
3317 CLK("usbhs-omap.0", "usbtll_ick", &usb_tll_hs_ick, CK_443X), 3317 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
3318 CLK(NULL, "usim_ck", &usim_ck, CK_443X), 3318 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
3319 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X), 3319 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
3320 CLK(NULL, "usim_fck", &usim_fck, CK_443X), 3320 CLK(NULL, "usim_fck", &usim_fck, CK_443X),
@@ -3374,8 +3374,8 @@ static struct omap_clk omap44xx_clks[] = {
3374 CLK(NULL, "uart2_ick", &dummy_ck, CK_443X), 3374 CLK(NULL, "uart2_ick", &dummy_ck, CK_443X),
3375 CLK(NULL, "uart3_ick", &dummy_ck, CK_443X), 3375 CLK(NULL, "uart3_ick", &dummy_ck, CK_443X),
3376 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X), 3376 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X),
3377 CLK("usbhs-omap.0", "usbhost_ick", &dummy_ck, CK_443X), 3377 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
3378 CLK("usbhs-omap.0", "usbtll_fck", &dummy_ck, CK_443X), 3378 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
3379 CLK("omap_wdt", "ick", &dummy_ck, CK_443X), 3379 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
3380 CLK("omap_timer.1", "32k_ck", &sys_32k_ck, CK_443X), 3380 CLK("omap_timer.1", "32k_ck", &sys_32k_ck, CK_443X),
3381 CLK("omap_timer.2", "32k_ck", &sys_32k_ck, CK_443X), 3381 CLK("omap_timer.2", "32k_ck", &sys_32k_ck, CK_443X),
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index f4a1020559a7..bd844af13af5 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -171,6 +171,17 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
171 } 171 }
172} 172}
173 173
174static void hsmmc2_select_input_clk_src(struct omap_mmc_platform_data *mmc)
175{
176 u32 reg;
177
178 if (mmc->slots[0].internal_clock) {
179 reg = omap_ctrl_readl(control_devconf1_offset);
180 reg |= OMAP2_MMCSDIO2ADPCLKISEL;
181 omap_ctrl_writel(reg, control_devconf1_offset);
182 }
183}
184
174static void hsmmc23_before_set_reg(struct device *dev, int slot, 185static void hsmmc23_before_set_reg(struct device *dev, int slot,
175 int power_on, int vdd) 186 int power_on, int vdd)
176{ 187{
@@ -179,16 +190,19 @@ static void hsmmc23_before_set_reg(struct device *dev, int slot,
179 if (mmc->slots[0].remux) 190 if (mmc->slots[0].remux)
180 mmc->slots[0].remux(dev, slot, power_on); 191 mmc->slots[0].remux(dev, slot, power_on);
181 192
182 if (power_on) { 193 if (power_on)
183 /* Only MMC2 supports a CLKIN */ 194 hsmmc2_select_input_clk_src(mmc);
184 if (mmc->slots[0].internal_clock) { 195}
185 u32 reg;
186 196
187 reg = omap_ctrl_readl(control_devconf1_offset); 197static int am35x_hsmmc2_set_power(struct device *dev, int slot,
188 reg |= OMAP2_MMCSDIO2ADPCLKISEL; 198 int power_on, int vdd)
189 omap_ctrl_writel(reg, control_devconf1_offset); 199{
190 } 200 struct omap_mmc_platform_data *mmc = dev->platform_data;
191 } 201
202 if (power_on)
203 hsmmc2_select_input_clk_src(mmc);
204
205 return 0;
192} 206}
193 207
194static int nop_mmc_set_power(struct device *dev, int slot, int power_on, 208static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
@@ -200,10 +214,12 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
200static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, 214static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
201 int controller_nr) 215 int controller_nr)
202{ 216{
203 if (gpio_is_valid(mmc_controller->slots[0].switch_pin)) 217 if (gpio_is_valid(mmc_controller->slots[0].switch_pin) &&
218 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
204 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, 219 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
205 OMAP_PIN_INPUT_PULLUP); 220 OMAP_PIN_INPUT_PULLUP);
206 if (gpio_is_valid(mmc_controller->slots[0].gpio_wp)) 221 if (gpio_is_valid(mmc_controller->slots[0].gpio_wp) &&
222 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
207 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, 223 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
208 OMAP_PIN_INPUT_PULLUP); 224 OMAP_PIN_INPUT_PULLUP);
209 if (cpu_is_omap34xx()) { 225 if (cpu_is_omap34xx()) {
@@ -296,6 +312,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
296 mmc->slots[0].name = hc_name; 312 mmc->slots[0].name = hc_name;
297 mmc->nr_slots = 1; 313 mmc->nr_slots = 1;
298 mmc->slots[0].caps = c->caps; 314 mmc->slots[0].caps = c->caps;
315 mmc->slots[0].pm_caps = c->pm_caps;
299 mmc->slots[0].internal_clock = !c->ext_clock; 316 mmc->slots[0].internal_clock = !c->ext_clock;
300 mmc->dma_mask = 0xffffffff; 317 mmc->dma_mask = 0xffffffff;
301 if (cpu_is_omap44xx()) 318 if (cpu_is_omap44xx())
@@ -336,11 +353,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
336 * 353 *
337 * temporary HACK: ocr_mask instead of fixed supply 354 * temporary HACK: ocr_mask instead of fixed supply
338 */ 355 */
339 mmc->slots[0].ocr_mask = c->ocr_mask; 356 if (cpu_is_omap3505() || cpu_is_omap3517())
340 357 mmc->slots[0].ocr_mask = MMC_VDD_165_195 |
341 if (cpu_is_omap3517() || cpu_is_omap3505()) 358 MMC_VDD_26_27 |
342 mmc->slots[0].set_power = nop_mmc_set_power; 359 MMC_VDD_27_28 |
360 MMC_VDD_29_30 |
361 MMC_VDD_30_31 |
362 MMC_VDD_31_32;
343 else 363 else
364 mmc->slots[0].ocr_mask = c->ocr_mask;
365
366 if (!cpu_is_omap3517() && !cpu_is_omap3505())
344 mmc->slots[0].features |= HSMMC_HAS_PBIAS; 367 mmc->slots[0].features |= HSMMC_HAS_PBIAS;
345 368
346 if (cpu_is_omap44xx() && (omap_rev() > OMAP4430_REV_ES1_0)) 369 if (cpu_is_omap44xx() && (omap_rev() > OMAP4430_REV_ES1_0))
@@ -363,6 +386,9 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
363 } 386 }
364 } 387 }
365 388
389 if (cpu_is_omap3517() || cpu_is_omap3505())
390 mmc->slots[0].set_power = nop_mmc_set_power;
391
366 /* OMAP3630 HSMMC1 supports only 4-bit */ 392 /* OMAP3630 HSMMC1 supports only 4-bit */
367 if (cpu_is_omap3630() && 393 if (cpu_is_omap3630() &&
368 (c->caps & MMC_CAP_8_BIT_DATA)) { 394 (c->caps & MMC_CAP_8_BIT_DATA)) {
@@ -372,6 +398,9 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
372 } 398 }
373 break; 399 break;
374 case 2: 400 case 2:
401 if (cpu_is_omap3517() || cpu_is_omap3505())
402 mmc->slots[0].set_power = am35x_hsmmc2_set_power;
403
375 if (c->ext_clock) 404 if (c->ext_clock)
376 c->transceiver = 1; 405 c->transceiver = 1;
377 if (c->transceiver && (c->caps & MMC_CAP_8_BIT_DATA)) { 406 if (c->transceiver && (c->caps & MMC_CAP_8_BIT_DATA)) {
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index f757e78d4d4f..c4409730c4bb 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -12,6 +12,7 @@ struct omap2_hsmmc_info {
12 u8 mmc; /* controller 1/2/3 */ 12 u8 mmc; /* controller 1/2/3 */
13 u32 caps; /* 4/8 wires and any additional host 13 u32 caps; /* 4/8 wires and any additional host
14 * capabilities OR'd (ref. linux/mmc/host.h) */ 14 * capabilities OR'd (ref. linux/mmc/host.h) */
15 u32 pm_caps; /* PM capabilities */
15 bool transceiver; /* MMC-2 option */ 16 bool transceiver; /* MMC-2 option */
16 bool ext_clock; /* use external pin for input clock */ 17 bool ext_clock; /* use external pin for input clock */
17 bool cover_only; /* No card detect - just cover switch */ 18 bool cover_only; /* No card detect - just cover switch */
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 7f8915ad5099..5324e8d93bc0 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -84,6 +84,8 @@ static struct omap_hwmod omap3xxx_mcbsp4_hwmod;
84static struct omap_hwmod omap3xxx_mcbsp5_hwmod; 84static struct omap_hwmod omap3xxx_mcbsp5_hwmod;
85static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod; 85static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod;
86static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod; 86static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod;
87static struct omap_hwmod omap3xxx_usb_host_hs_hwmod;
88static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod;
87 89
88/* L3 -> L4_CORE interface */ 90/* L3 -> L4_CORE interface */
89static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { 91static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = {
@@ -164,6 +166,7 @@ static struct omap_hwmod omap3xxx_uart1_hwmod;
164static struct omap_hwmod omap3xxx_uart2_hwmod; 166static struct omap_hwmod omap3xxx_uart2_hwmod;
165static struct omap_hwmod omap3xxx_uart3_hwmod; 167static struct omap_hwmod omap3xxx_uart3_hwmod;
166static struct omap_hwmod omap3xxx_uart4_hwmod; 168static struct omap_hwmod omap3xxx_uart4_hwmod;
169static struct omap_hwmod am35xx_uart4_hwmod;
167static struct omap_hwmod omap3xxx_usbhsotg_hwmod; 170static struct omap_hwmod omap3xxx_usbhsotg_hwmod;
168 171
169/* l3_core -> usbhsotg interface */ 172/* l3_core -> usbhsotg interface */
@@ -299,6 +302,23 @@ static struct omap_hwmod_ocp_if omap3_l4_per__uart4 = {
299 .user = OCP_USER_MPU | OCP_USER_SDMA, 302 .user = OCP_USER_MPU | OCP_USER_SDMA,
300}; 303};
301 304
305/* AM35xx: L4 CORE -> UART4 interface */
306static struct omap_hwmod_addr_space am35xx_uart4_addr_space[] = {
307 {
308 .pa_start = OMAP3_UART4_AM35XX_BASE,
309 .pa_end = OMAP3_UART4_AM35XX_BASE + SZ_1K - 1,
310 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
311 },
312};
313
314static struct omap_hwmod_ocp_if am35xx_l4_core__uart4 = {
315 .master = &omap3xxx_l4_core_hwmod,
316 .slave = &am35xx_uart4_hwmod,
317 .clk = "uart4_ick",
318 .addr = am35xx_uart4_addr_space,
319 .user = OCP_USER_MPU | OCP_USER_SDMA,
320};
321
302/* L4 CORE -> I2C1 interface */ 322/* L4 CORE -> I2C1 interface */
303static struct omap_hwmod_ocp_if omap3_l4_core__i2c1 = { 323static struct omap_hwmod_ocp_if omap3_l4_core__i2c1 = {
304 .master = &omap3xxx_l4_core_hwmod, 324 .master = &omap3xxx_l4_core_hwmod,
@@ -1162,6 +1182,7 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
1162 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | 1182 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
1163 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), 1183 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
1164 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1184 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1185 .clockact = CLOCKACT_TEST_ICLK,
1165 .sysc_fields = &omap_hwmod_sysc_type1, 1186 .sysc_fields = &omap_hwmod_sysc_type1,
1166}; 1187};
1167 1188
@@ -1309,6 +1330,39 @@ static struct omap_hwmod omap3xxx_uart4_hwmod = {
1309 .class = &omap2_uart_class, 1330 .class = &omap2_uart_class,
1310}; 1331};
1311 1332
1333static struct omap_hwmod_irq_info am35xx_uart4_mpu_irqs[] = {
1334 { .irq = INT_35XX_UART4_IRQ, },
1335};
1336
1337static struct omap_hwmod_dma_info am35xx_uart4_sdma_reqs[] = {
1338 { .name = "rx", .dma_req = AM35XX_DMA_UART4_RX, },
1339 { .name = "tx", .dma_req = AM35XX_DMA_UART4_TX, },
1340};
1341
1342static struct omap_hwmod_ocp_if *am35xx_uart4_slaves[] = {
1343 &am35xx_l4_core__uart4,
1344};
1345
1346static struct omap_hwmod am35xx_uart4_hwmod = {
1347 .name = "uart4",
1348 .mpu_irqs = am35xx_uart4_mpu_irqs,
1349 .sdma_reqs = am35xx_uart4_sdma_reqs,
1350 .main_clk = "uart4_fck",
1351 .prcm = {
1352 .omap2 = {
1353 .module_offs = CORE_MOD,
1354 .prcm_reg_id = 1,
1355 .module_bit = OMAP3430_EN_UART4_SHIFT,
1356 .idlest_reg_id = 1,
1357 .idlest_idle_bit = OMAP3430_EN_UART4_SHIFT,
1358 },
1359 },
1360 .slaves = am35xx_uart4_slaves,
1361 .slaves_cnt = ARRAY_SIZE(am35xx_uart4_slaves),
1362 .class = &omap2_uart_class,
1363};
1364
1365
1312static struct omap_hwmod_class i2c_class = { 1366static struct omap_hwmod_class i2c_class = {
1313 .name = "i2c", 1367 .name = "i2c",
1314 .sysc = &i2c_sysc, 1368 .sysc = &i2c_sysc,
@@ -1636,7 +1690,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_i2c1_slaves[] = {
1636 1690
1637static struct omap_hwmod omap3xxx_i2c1_hwmod = { 1691static struct omap_hwmod omap3xxx_i2c1_hwmod = {
1638 .name = "i2c1", 1692 .name = "i2c1",
1639 .flags = HWMOD_16BIT_REG, 1693 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1640 .mpu_irqs = omap2_i2c1_mpu_irqs, 1694 .mpu_irqs = omap2_i2c1_mpu_irqs,
1641 .sdma_reqs = omap2_i2c1_sdma_reqs, 1695 .sdma_reqs = omap2_i2c1_sdma_reqs,
1642 .main_clk = "i2c1_fck", 1696 .main_clk = "i2c1_fck",
@@ -1670,7 +1724,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_i2c2_slaves[] = {
1670 1724
1671static struct omap_hwmod omap3xxx_i2c2_hwmod = { 1725static struct omap_hwmod omap3xxx_i2c2_hwmod = {
1672 .name = "i2c2", 1726 .name = "i2c2",
1673 .flags = HWMOD_16BIT_REG, 1727 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1674 .mpu_irqs = omap2_i2c2_mpu_irqs, 1728 .mpu_irqs = omap2_i2c2_mpu_irqs,
1675 .sdma_reqs = omap2_i2c2_sdma_reqs, 1729 .sdma_reqs = omap2_i2c2_sdma_reqs,
1676 .main_clk = "i2c2_fck", 1730 .main_clk = "i2c2_fck",
@@ -1715,7 +1769,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_i2c3_slaves[] = {
1715 1769
1716static struct omap_hwmod omap3xxx_i2c3_hwmod = { 1770static struct omap_hwmod omap3xxx_i2c3_hwmod = {
1717 .name = "i2c3", 1771 .name = "i2c3",
1718 .flags = HWMOD_16BIT_REG, 1772 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1719 .mpu_irqs = i2c3_mpu_irqs, 1773 .mpu_irqs = i2c3_mpu_irqs,
1720 .sdma_reqs = i2c3_sdma_reqs, 1774 .sdma_reqs = i2c3_sdma_reqs,
1721 .main_clk = "i2c3_fck", 1775 .main_clk = "i2c3_fck",
@@ -3072,7 +3126,35 @@ static struct omap_mmc_dev_attr mmc1_dev_attr = {
3072 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 3126 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
3073}; 3127};
3074 3128
3075static struct omap_hwmod omap3xxx_mmc1_hwmod = { 3129/* See 35xx errata 2.1.1.128 in SPRZ278F */
3130static struct omap_mmc_dev_attr mmc1_pre_es3_dev_attr = {
3131 .flags = (OMAP_HSMMC_SUPPORTS_DUAL_VOLT |
3132 OMAP_HSMMC_BROKEN_MULTIBLOCK_READ),
3133};
3134
3135static struct omap_hwmod omap3xxx_pre_es3_mmc1_hwmod = {
3136 .name = "mmc1",
3137 .mpu_irqs = omap34xx_mmc1_mpu_irqs,
3138 .sdma_reqs = omap34xx_mmc1_sdma_reqs,
3139 .opt_clks = omap34xx_mmc1_opt_clks,
3140 .opt_clks_cnt = ARRAY_SIZE(omap34xx_mmc1_opt_clks),
3141 .main_clk = "mmchs1_fck",
3142 .prcm = {
3143 .omap2 = {
3144 .module_offs = CORE_MOD,
3145 .prcm_reg_id = 1,
3146 .module_bit = OMAP3430_EN_MMC1_SHIFT,
3147 .idlest_reg_id = 1,
3148 .idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT,
3149 },
3150 },
3151 .dev_attr = &mmc1_pre_es3_dev_attr,
3152 .slaves = omap3xxx_mmc1_slaves,
3153 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
3154 .class = &omap34xx_mmc_class,
3155};
3156
3157static struct omap_hwmod omap3xxx_es3plus_mmc1_hwmod = {
3076 .name = "mmc1", 3158 .name = "mmc1",
3077 .mpu_irqs = omap34xx_mmc1_mpu_irqs, 3159 .mpu_irqs = omap34xx_mmc1_mpu_irqs,
3078 .sdma_reqs = omap34xx_mmc1_sdma_reqs, 3160 .sdma_reqs = omap34xx_mmc1_sdma_reqs,
@@ -3115,7 +3197,34 @@ static struct omap_hwmod_ocp_if *omap3xxx_mmc2_slaves[] = {
3115 &omap3xxx_l4_core__mmc2, 3197 &omap3xxx_l4_core__mmc2,
3116}; 3198};
3117 3199
3118static struct omap_hwmod omap3xxx_mmc2_hwmod = { 3200/* See 35xx errata 2.1.1.128 in SPRZ278F */
3201static struct omap_mmc_dev_attr mmc2_pre_es3_dev_attr = {
3202 .flags = OMAP_HSMMC_BROKEN_MULTIBLOCK_READ,
3203};
3204
3205static struct omap_hwmod omap3xxx_pre_es3_mmc2_hwmod = {
3206 .name = "mmc2",
3207 .mpu_irqs = omap34xx_mmc2_mpu_irqs,
3208 .sdma_reqs = omap34xx_mmc2_sdma_reqs,
3209 .opt_clks = omap34xx_mmc2_opt_clks,
3210 .opt_clks_cnt = ARRAY_SIZE(omap34xx_mmc2_opt_clks),
3211 .main_clk = "mmchs2_fck",
3212 .prcm = {
3213 .omap2 = {
3214 .module_offs = CORE_MOD,
3215 .prcm_reg_id = 1,
3216 .module_bit = OMAP3430_EN_MMC2_SHIFT,
3217 .idlest_reg_id = 1,
3218 .idlest_idle_bit = OMAP3430_ST_MMC2_SHIFT,
3219 },
3220 },
3221 .dev_attr = &mmc2_pre_es3_dev_attr,
3222 .slaves = omap3xxx_mmc2_slaves,
3223 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc2_slaves),
3224 .class = &omap34xx_mmc_class,
3225};
3226
3227static struct omap_hwmod omap3xxx_es3plus_mmc2_hwmod = {
3119 .name = "mmc2", 3228 .name = "mmc2",
3120 .mpu_irqs = omap34xx_mmc2_mpu_irqs, 3229 .mpu_irqs = omap34xx_mmc2_mpu_irqs,
3121 .sdma_reqs = omap34xx_mmc2_sdma_reqs, 3230 .sdma_reqs = omap34xx_mmc2_sdma_reqs,
@@ -3177,13 +3286,223 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = {
3177 .class = &omap34xx_mmc_class, 3286 .class = &omap34xx_mmc_class,
3178}; 3287};
3179 3288
3289/*
3290 * 'usb_host_hs' class
3291 * high-speed multi-port usb host controller
3292 */
3293static struct omap_hwmod_ocp_if omap3xxx_usb_host_hs__l3_main_2 = {
3294 .master = &omap3xxx_usb_host_hs_hwmod,
3295 .slave = &omap3xxx_l3_main_hwmod,
3296 .clk = "core_l3_ick",
3297 .user = OCP_USER_MPU,
3298};
3299
3300static struct omap_hwmod_class_sysconfig omap3xxx_usb_host_hs_sysc = {
3301 .rev_offs = 0x0000,
3302 .sysc_offs = 0x0010,
3303 .syss_offs = 0x0014,
3304 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
3305 SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP |
3306 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
3307 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
3308 MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
3309 .sysc_fields = &omap_hwmod_sysc_type1,
3310};
3311
3312static struct omap_hwmod_class omap3xxx_usb_host_hs_hwmod_class = {
3313 .name = "usb_host_hs",
3314 .sysc = &omap3xxx_usb_host_hs_sysc,
3315};
3316
3317static struct omap_hwmod_ocp_if *omap3xxx_usb_host_hs_masters[] = {
3318 &omap3xxx_usb_host_hs__l3_main_2,
3319};
3320
3321static struct omap_hwmod_addr_space omap3xxx_usb_host_hs_addrs[] = {
3322 {
3323 .name = "uhh",
3324 .pa_start = 0x48064000,
3325 .pa_end = 0x480643ff,
3326 .flags = ADDR_TYPE_RT
3327 },
3328 {
3329 .name = "ohci",
3330 .pa_start = 0x48064400,
3331 .pa_end = 0x480647ff,
3332 },
3333 {
3334 .name = "ehci",
3335 .pa_start = 0x48064800,
3336 .pa_end = 0x48064cff,
3337 },
3338 {}
3339};
3340
3341static struct omap_hwmod_ocp_if omap3xxx_l4_core__usb_host_hs = {
3342 .master = &omap3xxx_l4_core_hwmod,
3343 .slave = &omap3xxx_usb_host_hs_hwmod,
3344 .clk = "usbhost_ick",
3345 .addr = omap3xxx_usb_host_hs_addrs,
3346 .user = OCP_USER_MPU | OCP_USER_SDMA,
3347};
3348
3349static struct omap_hwmod_ocp_if *omap3xxx_usb_host_hs_slaves[] = {
3350 &omap3xxx_l4_core__usb_host_hs,
3351};
3352
3353static struct omap_hwmod_opt_clk omap3xxx_usb_host_hs_opt_clks[] = {
3354 { .role = "ehci_logic_fck", .clk = "usbhost_120m_fck", },
3355};
3356
3357static struct omap_hwmod_irq_info omap3xxx_usb_host_hs_irqs[] = {
3358 { .name = "ohci-irq", .irq = 76 },
3359 { .name = "ehci-irq", .irq = 77 },
3360 { .irq = -1 }
3361};
3362
3363static struct omap_hwmod omap3xxx_usb_host_hs_hwmod = {
3364 .name = "usb_host_hs",
3365 .class = &omap3xxx_usb_host_hs_hwmod_class,
3366 .clkdm_name = "l3_init_clkdm",
3367 .mpu_irqs = omap3xxx_usb_host_hs_irqs,
3368 .main_clk = "usbhost_48m_fck",
3369 .prcm = {
3370 .omap2 = {
3371 .module_offs = OMAP3430ES2_USBHOST_MOD,
3372 .prcm_reg_id = 1,
3373 .module_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
3374 .idlest_reg_id = 1,
3375 .idlest_idle_bit = OMAP3430ES2_ST_USBHOST_IDLE_SHIFT,
3376 .idlest_stdby_bit = OMAP3430ES2_ST_USBHOST_STDBY_SHIFT,
3377 },
3378 },
3379 .opt_clks = omap3xxx_usb_host_hs_opt_clks,
3380 .opt_clks_cnt = ARRAY_SIZE(omap3xxx_usb_host_hs_opt_clks),
3381 .slaves = omap3xxx_usb_host_hs_slaves,
3382 .slaves_cnt = ARRAY_SIZE(omap3xxx_usb_host_hs_slaves),
3383 .masters = omap3xxx_usb_host_hs_masters,
3384 .masters_cnt = ARRAY_SIZE(omap3xxx_usb_host_hs_masters),
3385
3386 /*
3387 * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock
3388 * id: i660
3389 *
3390 * Description:
3391 * In the following configuration :
3392 * - USBHOST module is set to smart-idle mode
3393 * - PRCM asserts idle_req to the USBHOST module ( This typically
3394 * happens when the system is going to a low power mode : all ports
3395 * have been suspended, the master part of the USBHOST module has
3396 * entered the standby state, and SW has cut the functional clocks)
3397 * - an USBHOST interrupt occurs before the module is able to answer
3398 * idle_ack, typically a remote wakeup IRQ.
3399 * Then the USB HOST module will enter a deadlock situation where it
3400 * is no more accessible nor functional.
3401 *
3402 * Workaround:
3403 * Don't use smart idle; use only force idle, hence HWMOD_SWSUP_SIDLE
3404 */
3405
3406 /*
3407 * Errata: USB host EHCI may stall when entering smart-standby mode
3408 * Id: i571
3409 *
3410 * Description:
3411 * When the USBHOST module is set to smart-standby mode, and when it is
3412 * ready to enter the standby state (i.e. all ports are suspended and
3413 * all attached devices are in suspend mode), then it can wrongly assert
3414 * the Mstandby signal too early while there are still some residual OCP
3415 * transactions ongoing. If this condition occurs, the internal state
3416 * machine may go to an undefined state and the USB link may be stuck
3417 * upon the next resume.
3418 *
3419 * Workaround:
3420 * Don't use smart standby; use only force standby,
3421 * hence HWMOD_SWSUP_MSTANDBY
3422 */
3423
3424 /*
3425 * During system boot; If the hwmod framework resets the module
3426 * the module will have smart idle settings; which can lead to deadlock
3427 * (above Errata Id:i660); so, dont reset the module during boot;
3428 * Use HWMOD_INIT_NO_RESET.
3429 */
3430
3431 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
3432 HWMOD_INIT_NO_RESET,
3433};
3434
3435/*
3436 * 'usb_tll_hs' class
3437 * usb_tll_hs module is the adapter on the usb_host_hs ports
3438 */
3439static struct omap_hwmod_class_sysconfig omap3xxx_usb_tll_hs_sysc = {
3440 .rev_offs = 0x0000,
3441 .sysc_offs = 0x0010,
3442 .syss_offs = 0x0014,
3443 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
3444 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
3445 SYSC_HAS_AUTOIDLE),
3446 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
3447 .sysc_fields = &omap_hwmod_sysc_type1,
3448};
3449
3450static struct omap_hwmod_class omap3xxx_usb_tll_hs_hwmod_class = {
3451 .name = "usb_tll_hs",
3452 .sysc = &omap3xxx_usb_tll_hs_sysc,
3453};
3454
3455static struct omap_hwmod_irq_info omap3xxx_usb_tll_hs_irqs[] = {
3456 { .name = "tll-irq", .irq = 78 },
3457 { .irq = -1 }
3458};
3459
3460static struct omap_hwmod_addr_space omap3xxx_usb_tll_hs_addrs[] = {
3461 {
3462 .name = "tll",
3463 .pa_start = 0x48062000,
3464 .pa_end = 0x48062fff,
3465 .flags = ADDR_TYPE_RT
3466 },
3467 {}
3468};
3469
3470static struct omap_hwmod_ocp_if omap3xxx_l4_core__usb_tll_hs = {
3471 .master = &omap3xxx_l4_core_hwmod,
3472 .slave = &omap3xxx_usb_tll_hs_hwmod,
3473 .clk = "usbtll_ick",
3474 .addr = omap3xxx_usb_tll_hs_addrs,
3475 .user = OCP_USER_MPU | OCP_USER_SDMA,
3476};
3477
3478static struct omap_hwmod_ocp_if *omap3xxx_usb_tll_hs_slaves[] = {
3479 &omap3xxx_l4_core__usb_tll_hs,
3480};
3481
3482static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod = {
3483 .name = "usb_tll_hs",
3484 .class = &omap3xxx_usb_tll_hs_hwmod_class,
3485 .clkdm_name = "l3_init_clkdm",
3486 .mpu_irqs = omap3xxx_usb_tll_hs_irqs,
3487 .main_clk = "usbtll_fck",
3488 .prcm = {
3489 .omap2 = {
3490 .module_offs = CORE_MOD,
3491 .prcm_reg_id = 3,
3492 .module_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
3493 .idlest_reg_id = 3,
3494 .idlest_idle_bit = OMAP3430ES2_ST_USBTLL_SHIFT,
3495 },
3496 },
3497 .slaves = omap3xxx_usb_tll_hs_slaves,
3498 .slaves_cnt = ARRAY_SIZE(omap3xxx_usb_tll_hs_slaves),
3499};
3500
3180static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { 3501static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
3181 &omap3xxx_l3_main_hwmod, 3502 &omap3xxx_l3_main_hwmod,
3182 &omap3xxx_l4_core_hwmod, 3503 &omap3xxx_l4_core_hwmod,
3183 &omap3xxx_l4_per_hwmod, 3504 &omap3xxx_l4_per_hwmod,
3184 &omap3xxx_l4_wkup_hwmod, 3505 &omap3xxx_l4_wkup_hwmod,
3185 &omap3xxx_mmc1_hwmod,
3186 &omap3xxx_mmc2_hwmod,
3187 &omap3xxx_mmc3_hwmod, 3506 &omap3xxx_mmc3_hwmod,
3188 &omap3xxx_mpu_hwmod, 3507 &omap3xxx_mpu_hwmod,
3189 3508
@@ -3198,12 +3517,12 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
3198 &omap3xxx_timer9_hwmod, 3517 &omap3xxx_timer9_hwmod,
3199 &omap3xxx_timer10_hwmod, 3518 &omap3xxx_timer10_hwmod,
3200 &omap3xxx_timer11_hwmod, 3519 &omap3xxx_timer11_hwmod,
3201 &omap3xxx_timer12_hwmod,
3202 3520
3203 &omap3xxx_wd_timer2_hwmod, 3521 &omap3xxx_wd_timer2_hwmod,
3204 &omap3xxx_uart1_hwmod, 3522 &omap3xxx_uart1_hwmod,
3205 &omap3xxx_uart2_hwmod, 3523 &omap3xxx_uart2_hwmod,
3206 &omap3xxx_uart3_hwmod, 3524 &omap3xxx_uart3_hwmod,
3525
3207 /* dss class */ 3526 /* dss class */
3208 &omap3xxx_dss_dispc_hwmod, 3527 &omap3xxx_dss_dispc_hwmod,
3209 &omap3xxx_dss_dsi1_hwmod, 3528 &omap3xxx_dss_dsi1_hwmod,
@@ -3245,20 +3564,38 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
3245 NULL, 3564 NULL,
3246}; 3565};
3247 3566
3567/* GP-only hwmods */
3568static __initdata struct omap_hwmod *omap3xxx_gp_hwmods[] = {
3569 &omap3xxx_timer12_hwmod,
3570 NULL
3571};
3572
3248/* 3430ES1-only hwmods */ 3573/* 3430ES1-only hwmods */
3249static __initdata struct omap_hwmod *omap3430es1_hwmods[] = { 3574static __initdata struct omap_hwmod *omap3430es1_hwmods[] = {
3250 &omap3xxx_iva_hwmod,
3251 &omap3430es1_dss_core_hwmod, 3575 &omap3430es1_dss_core_hwmod,
3252 &omap3xxx_mailbox_hwmod,
3253 NULL 3576 NULL
3254}; 3577};
3255 3578
3256/* 3430ES2+-only hwmods */ 3579/* 3430ES2+-only hwmods */
3257static __initdata struct omap_hwmod *omap3430es2plus_hwmods[] = { 3580static __initdata struct omap_hwmod *omap3430es2plus_hwmods[] = {
3258 &omap3xxx_iva_hwmod,
3259 &omap3xxx_dss_core_hwmod, 3581 &omap3xxx_dss_core_hwmod,
3260 &omap3xxx_usbhsotg_hwmod, 3582 &omap3xxx_usbhsotg_hwmod,
3261 &omap3xxx_mailbox_hwmod, 3583 &omap3xxx_usb_host_hs_hwmod,
3584 &omap3xxx_usb_tll_hs_hwmod,
3585 NULL
3586};
3587
3588/* <= 3430ES3-only hwmods */
3589static struct omap_hwmod *omap3430_pre_es3_hwmods[] __initdata = {
3590 &omap3xxx_pre_es3_mmc1_hwmod,
3591 &omap3xxx_pre_es3_mmc2_hwmod,
3592 NULL
3593};
3594
3595/* 3430ES3+-only hwmods */
3596static struct omap_hwmod *omap3430_es3plus_hwmods[] __initdata = {
3597 &omap3xxx_es3plus_mmc1_hwmod,
3598 &omap3xxx_es3plus_mmc2_hwmod,
3262 NULL 3599 NULL
3263}; 3600};
3264 3601
@@ -3280,12 +3617,21 @@ static __initdata struct omap_hwmod *omap36xx_hwmods[] = {
3280 &omap36xx_sr2_hwmod, 3617 &omap36xx_sr2_hwmod,
3281 &omap3xxx_usbhsotg_hwmod, 3618 &omap3xxx_usbhsotg_hwmod,
3282 &omap3xxx_mailbox_hwmod, 3619 &omap3xxx_mailbox_hwmod,
3620 &omap3xxx_usb_host_hs_hwmod,
3621 &omap3xxx_usb_tll_hs_hwmod,
3622 &omap3xxx_es3plus_mmc1_hwmod,
3623 &omap3xxx_es3plus_mmc2_hwmod,
3283 NULL 3624 NULL
3284}; 3625};
3285 3626
3286static __initdata struct omap_hwmod *am35xx_hwmods[] = { 3627static __initdata struct omap_hwmod *am35xx_hwmods[] = {
3287 &omap3xxx_dss_core_hwmod, /* XXX ??? */ 3628 &omap3xxx_dss_core_hwmod, /* XXX ??? */
3288 &am35xx_usbhsotg_hwmod, 3629 &am35xx_usbhsotg_hwmod,
3630 &am35xx_uart4_hwmod,
3631 &omap3xxx_usb_host_hs_hwmod,
3632 &omap3xxx_usb_tll_hs_hwmod,
3633 &omap3xxx_es3plus_mmc1_hwmod,
3634 &omap3xxx_es3plus_mmc2_hwmod,
3289 NULL 3635 NULL
3290}; 3636};
3291 3637
@@ -3300,6 +3646,13 @@ int __init omap3xxx_hwmod_init(void)
3300 if (r < 0) 3646 if (r < 0)
3301 return r; 3647 return r;
3302 3648
3649 /* Register GP-only hwmods. */
3650 if (omap_type() == OMAP2_DEVICE_TYPE_GP) {
3651 r = omap_hwmod_register(omap3xxx_gp_hwmods);
3652 if (r < 0)
3653 return r;
3654 }
3655
3303 rev = omap_rev(); 3656 rev = omap_rev();
3304 3657
3305 /* 3658 /*
@@ -3338,6 +3691,21 @@ int __init omap3xxx_hwmod_init(void)
3338 h = omap3430es2plus_hwmods; 3691 h = omap3430es2plus_hwmods;
3339 }; 3692 };
3340 3693
3694 if (h) {
3695 r = omap_hwmod_register(h);
3696 if (r < 0)
3697 return r;
3698 }
3699
3700 h = NULL;
3701 if (rev == OMAP3430_REV_ES1_0 || rev == OMAP3430_REV_ES2_0 ||
3702 rev == OMAP3430_REV_ES2_1) {
3703 h = omap3430_pre_es3_hwmods;
3704 } else if (rev == OMAP3430_REV_ES3_0 || rev == OMAP3430_REV_ES3_1 ||
3705 rev == OMAP3430_REV_ES3_1_2) {
3706 h = omap3430_es3plus_hwmods;
3707 };
3708
3341 if (h) 3709 if (h)
3342 r = omap_hwmod_register(h); 3710 r = omap_hwmod_register(h);
3343 3711
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index daaf165af696..f9f151081760 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -70,6 +70,8 @@ static struct omap_hwmod omap44xx_mmc2_hwmod;
70static struct omap_hwmod omap44xx_mpu_hwmod; 70static struct omap_hwmod omap44xx_mpu_hwmod;
71static struct omap_hwmod omap44xx_mpu_private_hwmod; 71static struct omap_hwmod omap44xx_mpu_private_hwmod;
72static struct omap_hwmod omap44xx_usb_otg_hs_hwmod; 72static struct omap_hwmod omap44xx_usb_otg_hs_hwmod;
73static struct omap_hwmod omap44xx_usb_host_hs_hwmod;
74static struct omap_hwmod omap44xx_usb_tll_hs_hwmod;
73 75
74/* 76/*
75 * Interconnects omap_hwmod structures 77 * Interconnects omap_hwmod structures
@@ -2246,6 +2248,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_i2c_sysc = {
2246 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), 2248 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
2247 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 2249 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
2248 SIDLE_SMART_WKUP), 2250 SIDLE_SMART_WKUP),
2251 .clockact = CLOCKACT_TEST_ICLK,
2249 .sysc_fields = &omap_hwmod_sysc_type1, 2252 .sysc_fields = &omap_hwmod_sysc_type1,
2250}; 2253};
2251 2254
@@ -2300,7 +2303,7 @@ static struct omap_hwmod omap44xx_i2c1_hwmod = {
2300 .name = "i2c1", 2303 .name = "i2c1",
2301 .class = &omap44xx_i2c_hwmod_class, 2304 .class = &omap44xx_i2c_hwmod_class,
2302 .clkdm_name = "l4_per_clkdm", 2305 .clkdm_name = "l4_per_clkdm",
2303 .flags = HWMOD_16BIT_REG, 2306 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
2304 .mpu_irqs = omap44xx_i2c1_irqs, 2307 .mpu_irqs = omap44xx_i2c1_irqs,
2305 .sdma_reqs = omap44xx_i2c1_sdma_reqs, 2308 .sdma_reqs = omap44xx_i2c1_sdma_reqs,
2306 .main_clk = "i2c1_fck", 2309 .main_clk = "i2c1_fck",
@@ -2356,7 +2359,7 @@ static struct omap_hwmod omap44xx_i2c2_hwmod = {
2356 .name = "i2c2", 2359 .name = "i2c2",
2357 .class = &omap44xx_i2c_hwmod_class, 2360 .class = &omap44xx_i2c_hwmod_class,
2358 .clkdm_name = "l4_per_clkdm", 2361 .clkdm_name = "l4_per_clkdm",
2359 .flags = HWMOD_16BIT_REG, 2362 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
2360 .mpu_irqs = omap44xx_i2c2_irqs, 2363 .mpu_irqs = omap44xx_i2c2_irqs,
2361 .sdma_reqs = omap44xx_i2c2_sdma_reqs, 2364 .sdma_reqs = omap44xx_i2c2_sdma_reqs,
2362 .main_clk = "i2c2_fck", 2365 .main_clk = "i2c2_fck",
@@ -2412,7 +2415,7 @@ static struct omap_hwmod omap44xx_i2c3_hwmod = {
2412 .name = "i2c3", 2415 .name = "i2c3",
2413 .class = &omap44xx_i2c_hwmod_class, 2416 .class = &omap44xx_i2c_hwmod_class,
2414 .clkdm_name = "l4_per_clkdm", 2417 .clkdm_name = "l4_per_clkdm",
2415 .flags = HWMOD_16BIT_REG, 2418 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
2416 .mpu_irqs = omap44xx_i2c3_irqs, 2419 .mpu_irqs = omap44xx_i2c3_irqs,
2417 .sdma_reqs = omap44xx_i2c3_sdma_reqs, 2420 .sdma_reqs = omap44xx_i2c3_sdma_reqs,
2418 .main_clk = "i2c3_fck", 2421 .main_clk = "i2c3_fck",
@@ -2468,7 +2471,7 @@ static struct omap_hwmod omap44xx_i2c4_hwmod = {
2468 .name = "i2c4", 2471 .name = "i2c4",
2469 .class = &omap44xx_i2c_hwmod_class, 2472 .class = &omap44xx_i2c_hwmod_class,
2470 .clkdm_name = "l4_per_clkdm", 2473 .clkdm_name = "l4_per_clkdm",
2471 .flags = HWMOD_16BIT_REG, 2474 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
2472 .mpu_irqs = omap44xx_i2c4_irqs, 2475 .mpu_irqs = omap44xx_i2c4_irqs,
2473 .sdma_reqs = omap44xx_i2c4_sdma_reqs, 2476 .sdma_reqs = omap44xx_i2c4_sdma_reqs,
2474 .main_clk = "i2c4_fck", 2477 .main_clk = "i2c4_fck",
@@ -5276,6 +5279,207 @@ static struct omap_hwmod omap44xx_wd_timer3_hwmod = {
5276 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer3_slaves), 5279 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer3_slaves),
5277}; 5280};
5278 5281
5282/*
5283 * 'usb_host_hs' class
5284 * high-speed multi-port usb host controller
5285 */
5286static struct omap_hwmod_ocp_if omap44xx_usb_host_hs__l3_main_2 = {
5287 .master = &omap44xx_usb_host_hs_hwmod,
5288 .slave = &omap44xx_l3_main_2_hwmod,
5289 .clk = "l3_div_ck",
5290 .user = OCP_USER_MPU | OCP_USER_SDMA,
5291};
5292
5293static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = {
5294 .rev_offs = 0x0000,
5295 .sysc_offs = 0x0010,
5296 .syss_offs = 0x0014,
5297 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
5298 SYSC_HAS_SOFTRESET),
5299 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
5300 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
5301 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
5302 .sysc_fields = &omap_hwmod_sysc_type2,
5303};
5304
5305static struct omap_hwmod_class omap44xx_usb_host_hs_hwmod_class = {
5306 .name = "usb_host_hs",
5307 .sysc = &omap44xx_usb_host_hs_sysc,
5308};
5309
5310static struct omap_hwmod_ocp_if *omap44xx_usb_host_hs_masters[] = {
5311 &omap44xx_usb_host_hs__l3_main_2,
5312};
5313
5314static struct omap_hwmod_addr_space omap44xx_usb_host_hs_addrs[] = {
5315 {
5316 .name = "uhh",
5317 .pa_start = 0x4a064000,
5318 .pa_end = 0x4a0647ff,
5319 .flags = ADDR_TYPE_RT
5320 },
5321 {
5322 .name = "ohci",
5323 .pa_start = 0x4a064800,
5324 .pa_end = 0x4a064bff,
5325 },
5326 {
5327 .name = "ehci",
5328 .pa_start = 0x4a064c00,
5329 .pa_end = 0x4a064fff,
5330 },
5331 {}
5332};
5333
5334static struct omap_hwmod_irq_info omap44xx_usb_host_hs_irqs[] = {
5335 { .name = "ohci-irq", .irq = 76 + OMAP44XX_IRQ_GIC_START },
5336 { .name = "ehci-irq", .irq = 77 + OMAP44XX_IRQ_GIC_START },
5337 { .irq = -1 }
5338};
5339
5340static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_hs = {
5341 .master = &omap44xx_l4_cfg_hwmod,
5342 .slave = &omap44xx_usb_host_hs_hwmod,
5343 .clk = "l4_div_ck",
5344 .addr = omap44xx_usb_host_hs_addrs,
5345 .user = OCP_USER_MPU | OCP_USER_SDMA,
5346};
5347
5348static struct omap_hwmod_ocp_if *omap44xx_usb_host_hs_slaves[] = {
5349 &omap44xx_l4_cfg__usb_host_hs,
5350};
5351
5352static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
5353 .name = "usb_host_hs",
5354 .class = &omap44xx_usb_host_hs_hwmod_class,
5355 .clkdm_name = "l3_init_clkdm",
5356 .main_clk = "usb_host_hs_fck",
5357 .prcm = {
5358 .omap4 = {
5359 .clkctrl_offs = OMAP4_CM_L3INIT_USB_HOST_CLKCTRL_OFFSET,
5360 .context_offs = OMAP4_RM_L3INIT_USB_HOST_CONTEXT_OFFSET,
5361 .modulemode = MODULEMODE_SWCTRL,
5362 },
5363 },
5364 .mpu_irqs = omap44xx_usb_host_hs_irqs,
5365 .slaves = omap44xx_usb_host_hs_slaves,
5366 .slaves_cnt = ARRAY_SIZE(omap44xx_usb_host_hs_slaves),
5367 .masters = omap44xx_usb_host_hs_masters,
5368 .masters_cnt = ARRAY_SIZE(omap44xx_usb_host_hs_masters),
5369
5370 /*
5371 * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock
5372 * id: i660
5373 *
5374 * Description:
5375 * In the following configuration :
5376 * - USBHOST module is set to smart-idle mode
5377 * - PRCM asserts idle_req to the USBHOST module ( This typically
5378 * happens when the system is going to a low power mode : all ports
5379 * have been suspended, the master part of the USBHOST module has
5380 * entered the standby state, and SW has cut the functional clocks)
5381 * - an USBHOST interrupt occurs before the module is able to answer
5382 * idle_ack, typically a remote wakeup IRQ.
5383 * Then the USB HOST module will enter a deadlock situation where it
5384 * is no more accessible nor functional.
5385 *
5386 * Workaround:
5387 * Don't use smart idle; use only force idle, hence HWMOD_SWSUP_SIDLE
5388 */
5389
5390 /*
5391 * Errata: USB host EHCI may stall when entering smart-standby mode
5392 * Id: i571
5393 *
5394 * Description:
5395 * When the USBHOST module is set to smart-standby mode, and when it is
5396 * ready to enter the standby state (i.e. all ports are suspended and
5397 * all attached devices are in suspend mode), then it can wrongly assert
5398 * the Mstandby signal too early while there are still some residual OCP
5399 * transactions ongoing. If this condition occurs, the internal state
5400 * machine may go to an undefined state and the USB link may be stuck
5401 * upon the next resume.
5402 *
5403 * Workaround:
5404 * Don't use smart standby; use only force standby,
5405 * hence HWMOD_SWSUP_MSTANDBY
5406 */
5407
5408 /*
5409 * During system boot; If the hwmod framework resets the module
5410 * the module will have smart idle settings; which can lead to deadlock
5411 * (above Errata Id:i660); so, dont reset the module during boot;
5412 * Use HWMOD_INIT_NO_RESET.
5413 */
5414
5415 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
5416 HWMOD_INIT_NO_RESET,
5417};
5418
5419/*
5420 * 'usb_tll_hs' class
5421 * usb_tll_hs module is the adapter on the usb_host_hs ports
5422 */
5423static struct omap_hwmod_class_sysconfig omap44xx_usb_tll_hs_sysc = {
5424 .rev_offs = 0x0000,
5425 .sysc_offs = 0x0010,
5426 .syss_offs = 0x0014,
5427 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
5428 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
5429 SYSC_HAS_AUTOIDLE),
5430 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
5431 .sysc_fields = &omap_hwmod_sysc_type1,
5432};
5433
5434static struct omap_hwmod_class omap44xx_usb_tll_hs_hwmod_class = {
5435 .name = "usb_tll_hs",
5436 .sysc = &omap44xx_usb_tll_hs_sysc,
5437};
5438
5439static struct omap_hwmod_irq_info omap44xx_usb_tll_hs_irqs[] = {
5440 { .name = "tll-irq", .irq = 78 + OMAP44XX_IRQ_GIC_START },
5441 { .irq = -1 }
5442};
5443
5444static struct omap_hwmod_addr_space omap44xx_usb_tll_hs_addrs[] = {
5445 {
5446 .name = "tll",
5447 .pa_start = 0x4a062000,
5448 .pa_end = 0x4a063fff,
5449 .flags = ADDR_TYPE_RT
5450 },
5451 {}
5452};
5453
5454static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_tll_hs = {
5455 .master = &omap44xx_l4_cfg_hwmod,
5456 .slave = &omap44xx_usb_tll_hs_hwmod,
5457 .clk = "l4_div_ck",
5458 .addr = omap44xx_usb_tll_hs_addrs,
5459 .user = OCP_USER_MPU | OCP_USER_SDMA,
5460};
5461
5462static struct omap_hwmod_ocp_if *omap44xx_usb_tll_hs_slaves[] = {
5463 &omap44xx_l4_cfg__usb_tll_hs,
5464};
5465
5466static struct omap_hwmod omap44xx_usb_tll_hs_hwmod = {
5467 .name = "usb_tll_hs",
5468 .class = &omap44xx_usb_tll_hs_hwmod_class,
5469 .clkdm_name = "l3_init_clkdm",
5470 .main_clk = "usb_tll_hs_ick",
5471 .prcm = {
5472 .omap4 = {
5473 .clkctrl_offs = OMAP4_CM_L3INIT_USB_TLL_CLKCTRL_OFFSET,
5474 .context_offs = OMAP4_RM_L3INIT_USB_TLL_CONTEXT_OFFSET,
5475 .modulemode = MODULEMODE_HWCTRL,
5476 },
5477 },
5478 .mpu_irqs = omap44xx_usb_tll_hs_irqs,
5479 .slaves = omap44xx_usb_tll_hs_slaves,
5480 .slaves_cnt = ARRAY_SIZE(omap44xx_usb_tll_hs_slaves),
5481};
5482
5279static __initdata struct omap_hwmod *omap44xx_hwmods[] = { 5483static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
5280 5484
5281 /* dmm class */ 5485 /* dmm class */
@@ -5415,13 +5619,16 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
5415 &omap44xx_uart3_hwmod, 5619 &omap44xx_uart3_hwmod,
5416 &omap44xx_uart4_hwmod, 5620 &omap44xx_uart4_hwmod,
5417 5621
5622 /* usb host class */
5623 &omap44xx_usb_host_hs_hwmod,
5624 &omap44xx_usb_tll_hs_hwmod,
5625
5418 /* usb_otg_hs class */ 5626 /* usb_otg_hs class */
5419 &omap44xx_usb_otg_hs_hwmod, 5627 &omap44xx_usb_otg_hs_hwmod,
5420 5628
5421 /* wd_timer class */ 5629 /* wd_timer class */
5422 &omap44xx_wd_timer2_hwmod, 5630 &omap44xx_wd_timer2_hwmod,
5423 &omap44xx_wd_timer3_hwmod, 5631 &omap44xx_wd_timer3_hwmod,
5424
5425 NULL, 5632 NULL,
5426}; 5633};
5427 5634
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 0363dcb0ef93..da2d80f5fcbd 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -201,6 +201,8 @@
201#define OMAP3430_EN_MMC2_SHIFT 25 201#define OMAP3430_EN_MMC2_SHIFT 25
202#define OMAP3430_EN_MMC1_MASK (1 << 24) 202#define OMAP3430_EN_MMC1_MASK (1 << 24)
203#define OMAP3430_EN_MMC1_SHIFT 24 203#define OMAP3430_EN_MMC1_SHIFT 24
204#define OMAP3430_EN_UART4_MASK (1 << 23)
205#define OMAP3430_EN_UART4_SHIFT 23
204#define OMAP3430_EN_MCSPI4_MASK (1 << 21) 206#define OMAP3430_EN_MCSPI4_MASK (1 << 21)
205#define OMAP3430_EN_MCSPI4_SHIFT 21 207#define OMAP3430_EN_MCSPI4_SHIFT 21
206#define OMAP3430_EN_MCSPI3_MASK (1 << 20) 208#define OMAP3430_EN_MCSPI3_MASK (1 << 20)
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 89ae29847c59..771dc781b746 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -28,51 +28,28 @@
28#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <mach/irqs.h> 29#include <mach/irqs.h>
30#include <plat/usb.h> 30#include <plat/usb.h>
31#include <plat/omap_device.h>
31 32
32#include "mux.h" 33#include "mux.h"
33 34
34#ifdef CONFIG_MFD_OMAP_USB_HOST 35#ifdef CONFIG_MFD_OMAP_USB_HOST
35 36
36#define OMAP_USBHS_DEVICE "usbhs-omap" 37#define OMAP_USBHS_DEVICE "usbhs_omap"
37 38#define USBHS_UHH_HWMODNAME "usb_host_hs"
38static struct resource usbhs_resources[] = { 39#define USBHS_TLL_HWMODNAME "usb_tll_hs"
39 {
40 .name = "uhh",
41 .flags = IORESOURCE_MEM,
42 },
43 {
44 .name = "tll",
45 .flags = IORESOURCE_MEM,
46 },
47 {
48 .name = "ehci",
49 .flags = IORESOURCE_MEM,
50 },
51 {
52 .name = "ehci-irq",
53 .flags = IORESOURCE_IRQ,
54 },
55 {
56 .name = "ohci",
57 .flags = IORESOURCE_MEM,
58 },
59 {
60 .name = "ohci-irq",
61 .flags = IORESOURCE_IRQ,
62 }
63};
64
65static struct platform_device usbhs_device = {
66 .name = OMAP_USBHS_DEVICE,
67 .id = 0,
68 .num_resources = ARRAY_SIZE(usbhs_resources),
69 .resource = usbhs_resources,
70};
71 40
72static struct usbhs_omap_platform_data usbhs_data; 41static struct usbhs_omap_platform_data usbhs_data;
73static struct ehci_hcd_omap_platform_data ehci_data; 42static struct ehci_hcd_omap_platform_data ehci_data;
74static struct ohci_hcd_omap_platform_data ohci_data; 43static struct ohci_hcd_omap_platform_data ohci_data;
75 44
45static struct omap_device_pm_latency omap_uhhtll_latency[] = {
46 {
47 .deactivate_func = omap_device_idle_hwmods,
48 .activate_func = omap_device_enable_hwmods,
49 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
50 },
51};
52
76/* MUX settings for EHCI pins */ 53/* MUX settings for EHCI pins */
77/* 54/*
78 * setup_ehci_io_mux - initialize IO pad mux for USBHOST 55 * setup_ehci_io_mux - initialize IO pad mux for USBHOST
@@ -508,7 +485,10 @@ static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
508 485
509void __init usbhs_init(const struct usbhs_omap_board_data *pdata) 486void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
510{ 487{
511 int i; 488 struct omap_hwmod *oh[2];
489 struct omap_device *od;
490 int bus_id = -1;
491 int i;
512 492
513 for (i = 0; i < OMAP3_HS_USB_PORTS; i++) { 493 for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
514 usbhs_data.port_mode[i] = pdata->port_mode[i]; 494 usbhs_data.port_mode[i] = pdata->port_mode[i];
@@ -523,44 +503,34 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
523 usbhs_data.ohci_data = &ohci_data; 503 usbhs_data.ohci_data = &ohci_data;
524 504
525 if (cpu_is_omap34xx()) { 505 if (cpu_is_omap34xx()) {
526 usbhs_resources[0].start = OMAP34XX_UHH_CONFIG_BASE;
527 usbhs_resources[0].end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
528 usbhs_resources[1].start = OMAP34XX_USBTLL_BASE;
529 usbhs_resources[1].end = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
530 usbhs_resources[2].start = OMAP34XX_EHCI_BASE;
531 usbhs_resources[2].end = OMAP34XX_EHCI_BASE + SZ_1K - 1;
532 usbhs_resources[3].start = INT_34XX_EHCI_IRQ;
533 usbhs_resources[4].start = OMAP34XX_OHCI_BASE;
534 usbhs_resources[4].end = OMAP34XX_OHCI_BASE + SZ_1K - 1;
535 usbhs_resources[5].start = INT_34XX_OHCI_IRQ;
536 setup_ehci_io_mux(pdata->port_mode); 506 setup_ehci_io_mux(pdata->port_mode);
537 setup_ohci_io_mux(pdata->port_mode); 507 setup_ohci_io_mux(pdata->port_mode);
538 } else if (cpu_is_omap44xx()) { 508 } else if (cpu_is_omap44xx()) {
539 usbhs_resources[0].start = OMAP44XX_UHH_CONFIG_BASE;
540 usbhs_resources[0].end = OMAP44XX_UHH_CONFIG_BASE + SZ_1K - 1;
541 usbhs_resources[1].start = OMAP44XX_USBTLL_BASE;
542 usbhs_resources[1].end = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
543 usbhs_resources[2].start = OMAP44XX_HSUSB_EHCI_BASE;
544 usbhs_resources[2].end = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
545 usbhs_resources[3].start = OMAP44XX_IRQ_EHCI;
546 usbhs_resources[4].start = OMAP44XX_HSUSB_OHCI_BASE;
547 usbhs_resources[4].end = OMAP44XX_HSUSB_OHCI_BASE + SZ_1K - 1;
548 usbhs_resources[5].start = OMAP44XX_IRQ_OHCI;
549 setup_4430ehci_io_mux(pdata->port_mode); 509 setup_4430ehci_io_mux(pdata->port_mode);
550 setup_4430ohci_io_mux(pdata->port_mode); 510 setup_4430ohci_io_mux(pdata->port_mode);
551 } 511 }
552 512
553 if (platform_device_add_data(&usbhs_device, 513 oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
554 &usbhs_data, sizeof(usbhs_data)) < 0) { 514 if (!oh[0]) {
555 printk(KERN_ERR "USBHS platform_device_add_data failed\n"); 515 pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
556 goto init_end; 516 return;
557 } 517 }
558 518
559 if (platform_device_register(&usbhs_device) < 0) 519 oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
560 printk(KERN_ERR "USBHS platform_device_register failed\n"); 520 if (!oh[1]) {
521 pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
522 return;
523 }
561 524
562init_end: 525 od = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
563 return; 526 (void *)&usbhs_data, sizeof(usbhs_data),
527 omap_uhhtll_latency,
528 ARRAY_SIZE(omap_uhhtll_latency), false);
529 if (IS_ERR(od)) {
530 pr_err("Could not build hwmod devices %s,%s\n",
531 USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
532 return;
533 }
564} 534}
565 535
566#else 536#else
@@ -570,5 +540,3 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
570} 540}
571 541
572#endif 542#endif
573
574
diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
index 4cb069fd9af2..ccdac4b6a469 100644
--- a/arch/arm/mach-pxa/am200epd.c
+++ b/arch/arm/mach-pxa/am200epd.c
@@ -138,7 +138,7 @@ static void am200_cleanup(struct metronomefb_par *par)
138{ 138{
139 int i; 139 int i;
140 140
141 free_irq(IRQ_GPIO(RDY_GPIO_PIN), par); 141 free_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), par);
142 142
143 for (i = 0; i < ARRAY_SIZE(gpios); i++) 143 for (i = 0; i < ARRAY_SIZE(gpios); i++)
144 gpio_free(gpios[i]); 144 gpio_free(gpios[i]);
@@ -292,7 +292,7 @@ static int am200_setup_irq(struct fb_info *info)
292{ 292{
293 int ret; 293 int ret;
294 294
295 ret = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am200_handle_irq, 295 ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am200_handle_irq,
296 IRQF_DISABLED|IRQF_TRIGGER_FALLING, 296 IRQF_DISABLED|IRQF_TRIGGER_FALLING,
297 "AM200", info->par); 297 "AM200", info->par);
298 if (ret) 298 if (ret)
diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
index fa8bad235d9f..76c4b9494031 100644
--- a/arch/arm/mach-pxa/am300epd.c
+++ b/arch/arm/mach-pxa/am300epd.c
@@ -176,7 +176,7 @@ static void am300_cleanup(struct broadsheetfb_par *par)
176{ 176{
177 int i; 177 int i;
178 178
179 free_irq(IRQ_GPIO(RDY_GPIO_PIN), par); 179 free_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), par);
180 180
181 for (i = 0; i < ARRAY_SIZE(gpios); i++) 181 for (i = 0; i < ARRAY_SIZE(gpios); i++)
182 gpio_free(gpios[i]); 182 gpio_free(gpios[i]);
@@ -240,7 +240,7 @@ static int am300_setup_irq(struct fb_info *info)
240 int ret; 240 int ret;
241 struct broadsheetfb_par *par = info->par; 241 struct broadsheetfb_par *par = info->par;
242 242
243 ret = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am300_handle_irq, 243 ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am300_handle_irq,
244 IRQF_DISABLED|IRQF_TRIGGER_RISING, 244 IRQF_DISABLED|IRQF_TRIGGER_RISING,
245 "AM300", par); 245 "AM300", par);
246 if (ret) 246 if (ret)
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index 4b81f59a4cba..11f2223da576 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -179,7 +179,7 @@ static unsigned long balloon3_ac97_pin_config[] __initdata = {
179}; 179};
180 180
181static struct ucb1400_pdata vpac270_ucb1400_pdata = { 181static struct ucb1400_pdata vpac270_ucb1400_pdata = {
182 .irq = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ), 182 .irq = PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ),
183}; 183};
184 184
185 185
diff --git a/arch/arm/mach-pxa/capc7117.c b/arch/arm/mach-pxa/capc7117.c
index 4efc16d39c79..5516317b9e64 100644
--- a/arch/arm/mach-pxa/capc7117.c
+++ b/arch/arm/mach-pxa/capc7117.c
@@ -50,8 +50,8 @@ static struct resource capc7117_ide_resources[] = {
50 .flags = IORESOURCE_MEM 50 .flags = IORESOURCE_MEM
51 }, 51 },
52 [2] = { 52 [2] = {
53 .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)), 53 .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
54 .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)), 54 .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
55 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING 55 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING
56 } 56 }
57}; 57};
@@ -80,7 +80,7 @@ static void __init capc7117_ide_init(void)
80static struct plat_serial8250_port ti16c752_platform_data[] = { 80static struct plat_serial8250_port ti16c752_platform_data[] = {
81 [0] = { 81 [0] = {
82 .mapbase = 0x14000000, 82 .mapbase = 0x14000000,
83 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO78)), 83 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO78)),
84 .irqflags = IRQF_TRIGGER_RISING, 84 .irqflags = IRQF_TRIGGER_RISING,
85 .flags = TI16C752_FLAGS, 85 .flags = TI16C752_FLAGS,
86 .iotype = UPIO_MEM, 86 .iotype = UPIO_MEM,
@@ -89,7 +89,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
89 }, 89 },
90 [1] = { 90 [1] = {
91 .mapbase = 0x14000040, 91 .mapbase = 0x14000040,
92 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO79)), 92 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO79)),
93 .irqflags = IRQF_TRIGGER_RISING, 93 .irqflags = IRQF_TRIGGER_RISING,
94 .flags = TI16C752_FLAGS, 94 .flags = TI16C752_FLAGS,
95 .iotype = UPIO_MEM, 95 .iotype = UPIO_MEM,
@@ -98,7 +98,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
98 }, 98 },
99 [2] = { 99 [2] = {
100 .mapbase = 0x14000080, 100 .mapbase = 0x14000080,
101 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO80)), 101 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO80)),
102 .irqflags = IRQF_TRIGGER_RISING, 102 .irqflags = IRQF_TRIGGER_RISING,
103 .flags = TI16C752_FLAGS, 103 .flags = TI16C752_FLAGS,
104 .iotype = UPIO_MEM, 104 .iotype = UPIO_MEM,
@@ -107,7 +107,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
107 }, 107 },
108 [3] = { 108 [3] = {
109 .mapbase = 0x140000c0, 109 .mapbase = 0x140000c0,
110 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO81)), 110 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO81)),
111 .irqflags = IRQF_TRIGGER_RISING, 111 .irqflags = IRQF_TRIGGER_RISING,
112 .flags = TI16C752_FLAGS, 112 .flags = TI16C752_FLAGS,
113 .iotype = UPIO_MEM, 113 .iotype = UPIO_MEM,
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 13518a705399..431ef56700c4 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -33,7 +33,7 @@
33/* GPIO IRQ usage */ 33/* GPIO IRQ usage */
34#define GPIO83_MMC_IRQ (83) 34#define GPIO83_MMC_IRQ (83)
35 35
36#define CMX270_MMC_IRQ IRQ_GPIO(GPIO83_MMC_IRQ) 36#define CMX270_MMC_IRQ PXA_GPIO_TO_IRQ(GPIO83_MMC_IRQ)
37 37
38/* MMC power enable */ 38/* MMC power enable */
39#define GPIO105_MMC_POWER (105) 39#define GPIO105_MMC_POWER (105)
@@ -380,7 +380,7 @@ static struct spi_board_info cm_x270_spi_devices[] __initdata = {
380 .modalias = "libertas_spi", 380 .modalias = "libertas_spi",
381 .max_speed_hz = 13000000, 381 .max_speed_hz = 13000000,
382 .bus_num = 2, 382 .bus_num = 2,
383 .irq = gpio_to_irq(95), 383 .irq = PXA_GPIO_TO_IRQ(95),
384 .chip_select = 0, 384 .chip_select = 0,
385 .controller_data = &cm_x270_libertas_chip, 385 .controller_data = &cm_x270_libertas_chip,
386 .platform_data = &cm_x270_libertas_pdata, 386 .platform_data = &cm_x270_libertas_pdata,
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index f2e4190080cb..9344a0e3ba8a 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -58,8 +58,8 @@ extern void cmx270_init(void);
58#define CMX255_GPIO_IT8152_IRQ (0) 58#define CMX255_GPIO_IT8152_IRQ (0)
59#define CMX270_GPIO_IT8152_IRQ (22) 59#define CMX270_GPIO_IT8152_IRQ (22)
60 60
61#define CMX255_ETHIRQ IRQ_GPIO(GPIO22_ETHIRQ) 61#define CMX255_ETHIRQ PXA_GPIO_TO_IRQ(GPIO22_ETHIRQ)
62#define CMX270_ETHIRQ IRQ_GPIO(GPIO10_ETHIRQ) 62#define CMX270_ETHIRQ PXA_GPIO_TO_IRQ(GPIO10_ETHIRQ)
63 63
64#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) 64#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
65static struct resource cmx255_dm9000_resource[] = { 65static struct resource cmx255_dm9000_resource[] = {
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index e096bba8fd57..684acf6ed3d5 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -64,7 +64,7 @@
64#define GPIO82_MMC_IRQ (82) 64#define GPIO82_MMC_IRQ (82)
65#define GPIO85_MMC_WP (85) 65#define GPIO85_MMC_WP (85)
66 66
67#define CM_X300_MMC_IRQ IRQ_GPIO(GPIO82_MMC_IRQ) 67#define CM_X300_MMC_IRQ PXA_GPIO_TO_IRQ(GPIO82_MMC_IRQ)
68 68
69#define GPIO95_RTC_CS (95) 69#define GPIO95_RTC_CS (95)
70#define GPIO96_RTC_WR (96) 70#define GPIO96_RTC_WR (96)
@@ -229,8 +229,8 @@ static struct resource dm9000_resources[] = {
229 .flags = IORESOURCE_MEM, 229 .flags = IORESOURCE_MEM,
230 }, 230 },
231 [2] = { 231 [2] = {
232 .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)), 232 .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO99)),
233 .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)), 233 .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO99)),
234 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 234 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
235 } 235 }
236}; 236};
diff --git a/arch/arm/mach-pxa/colibri-pxa270.c b/arch/arm/mach-pxa/colibri-pxa270.c
index 05bfa1b1c001..f0fe9a51dfcc 100644
--- a/arch/arm/mach-pxa/colibri-pxa270.c
+++ b/arch/arm/mach-pxa/colibri-pxa270.c
@@ -218,8 +218,8 @@ static struct resource colibri_pxa270_dm9000_resources[] = {
218 .flags = IORESOURCE_MEM, 218 .flags = IORESOURCE_MEM,
219 }, 219 },
220 { 220 {
221 .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), 221 .start = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
222 .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ), 222 .end = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
223 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING, 223 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
224 }, 224 },
225}; 225};
@@ -249,7 +249,7 @@ static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = {
249}; 249};
250 250
251static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = { 251static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = {
252 .irq = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ), 252 .irq = PXA_GPIO_TO_IRQ(GPIO113_COLIBRI_PXA270_TS_IRQ),
253}; 253};
254 254
255static struct platform_device colibri_pxa270_ucb1400_device = { 255static struct platform_device colibri_pxa270_ucb1400_device = {
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
index c825e8bf2db1..0a6222e20f9b 100644
--- a/arch/arm/mach-pxa/colibri-pxa300.c
+++ b/arch/arm/mach-pxa/colibri-pxa300.c
@@ -78,8 +78,8 @@ static struct resource colibri_asix_resource[] = {
78 .flags = IORESOURCE_MEM, 78 .flags = IORESOURCE_MEM,
79 }, 79 },
80 [1] = { 80 [1] = {
81 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), 81 .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
82 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), 82 .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
83 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, 83 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
84 } 84 }
85}; 85};
diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c
index d23b92b80488..56ab7a634bca 100644
--- a/arch/arm/mach-pxa/colibri-pxa320.c
+++ b/arch/arm/mach-pxa/colibri-pxa320.c
@@ -115,8 +115,8 @@ static struct resource colibri_asix_resource[] = {
115 .flags = IORESOURCE_MEM, 115 .flags = IORESOURCE_MEM,
116 }, 116 },
117 [1] = { 117 [1] = {
118 .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), 118 .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
119 .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), 119 .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
120 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, 120 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
121 } 121 }
122}; 122};
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 549468d088b9..3812ba0ff50c 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -531,7 +531,7 @@ static struct spi_board_info corgi_spi_devices[] = {
531 .chip_select = 0, 531 .chip_select = 0,
532 .platform_data = &corgi_ads7846_info, 532 .platform_data = &corgi_ads7846_info,
533 .controller_data= &corgi_ads7846_chip, 533 .controller_data= &corgi_ads7846_chip,
534 .irq = gpio_to_irq(CORGI_GPIO_TP_INT), 534 .irq = PXA_GPIO_TO_IRQ(CORGI_GPIO_TP_INT),
535 }, { 535 }, {
536 .modalias = "corgi-lcd", 536 .modalias = "corgi-lcd",
537 .max_speed_hz = 50000, 537 .max_speed_hz = 50000,
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index 29034778bfda..39e265cfc86d 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/gpio-pxa.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/apm-emulation.h> 21#include <linux/apm-emulation.h>
@@ -40,7 +41,9 @@ static struct gpio charger_gpios[] = {
40 { CORGI_GPIO_ADC_TEMP_ON, GPIOF_OUT_INIT_LOW, "ADC Temp On" }, 41 { CORGI_GPIO_ADC_TEMP_ON, GPIOF_OUT_INIT_LOW, "ADC Temp On" },
41 { CORGI_GPIO_CHRG_ON, GPIOF_OUT_INIT_LOW, "Charger On" }, 42 { CORGI_GPIO_CHRG_ON, GPIOF_OUT_INIT_LOW, "Charger On" },
42 { CORGI_GPIO_CHRG_UKN, GPIOF_OUT_INIT_LOW, "Charger Unknown" }, 43 { CORGI_GPIO_CHRG_UKN, GPIOF_OUT_INIT_LOW, "Charger Unknown" },
44 { CORGI_GPIO_AC_IN, GPIOF_IN, "Charger Detection" },
43 { CORGI_GPIO_KEY_INT, GPIOF_IN, "Key Interrupt" }, 45 { CORGI_GPIO_KEY_INT, GPIOF_IN, "Key Interrupt" },
46 { CORGI_GPIO_WAKEUP, GPIOF_IN, "System wakeup notification" },
44}; 47};
45 48
46static void corgi_charger_init(void) 49static void corgi_charger_init(void)
@@ -90,7 +93,12 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)
90{ 93{
91 int is_resume = 0; 94 int is_resume = 0;
92 95
93 dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR); 96 dev_dbg(sharpsl_pm.dev, "PEDR = %x, GPIO_AC_IN = %d, "
97 "GPIO_CHRG_FULL = %d, GPIO_KEY_INT = %d, GPIO_WAKEUP = %d\n",
98 PEDR, gpio_get_value(CORGI_GPIO_AC_IN),
99 gpio_get_value(CORGI_GPIO_CHRG_FULL),
100 gpio_get_value(CORGI_GPIO_KEY_INT),
101 gpio_get_value(CORGI_GPIO_WAKEUP));
94 102
95 if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) { 103 if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) {
96 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) { 104 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
@@ -124,14 +132,21 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)
124 132
125static unsigned long corgi_charger_wakeup(void) 133static unsigned long corgi_charger_wakeup(void)
126{ 134{
127 return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) ); 135 unsigned long ret;
136
137 ret = (!gpio_get_value(CORGI_GPIO_AC_IN) << GPIO_bit(CORGI_GPIO_AC_IN))
138 | (!gpio_get_value(CORGI_GPIO_KEY_INT)
139 << GPIO_bit(CORGI_GPIO_KEY_INT))
140 | (!gpio_get_value(CORGI_GPIO_WAKEUP)
141 << GPIO_bit(CORGI_GPIO_WAKEUP));
142 return ret;
128} 143}
129 144
130unsigned long corgipm_read_devdata(int type) 145unsigned long corgipm_read_devdata(int type)
131{ 146{
132 switch(type) { 147 switch(type) {
133 case SHARPSL_STATUS_ACIN: 148 case SHARPSL_STATUS_ACIN:
134 return ((GPLR(CORGI_GPIO_AC_IN) & GPIO_bit(CORGI_GPIO_AC_IN)) != 0); 149 return !gpio_get_value(CORGI_GPIO_AC_IN);
135 case SHARPSL_STATUS_LOCK: 150 case SHARPSL_STATUS_LOCK:
136 return gpio_get_value(sharpsl_pm.machinfo->gpio_batlock); 151 return gpio_get_value(sharpsl_pm.machinfo->gpio_batlock);
137 case SHARPSL_STATUS_CHRGFULL: 152 case SHARPSL_STATUS_CHRGFULL:
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 2e0425404de5..5bc13121eac5 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -1051,6 +1051,36 @@ struct platform_device pxa3xx_device_ssp4 = {
1051}; 1051};
1052#endif /* CONFIG_PXA3xx || CONFIG_PXA95x */ 1052#endif /* CONFIG_PXA3xx || CONFIG_PXA95x */
1053 1053
1054struct resource pxa_resource_gpio[] = {
1055 {
1056 .start = 0x40e00000,
1057 .end = 0x40e0ffff,
1058 .flags = IORESOURCE_MEM,
1059 }, {
1060 .start = IRQ_GPIO0,
1061 .end = IRQ_GPIO0,
1062 .name = "gpio0",
1063 .flags = IORESOURCE_IRQ,
1064 }, {
1065 .start = IRQ_GPIO1,
1066 .end = IRQ_GPIO1,
1067 .name = "gpio1",
1068 .flags = IORESOURCE_IRQ,
1069 }, {
1070 .start = IRQ_GPIO_2_x,
1071 .end = IRQ_GPIO_2_x,
1072 .name = "gpio_mux",
1073 .flags = IORESOURCE_IRQ,
1074 },
1075};
1076
1077struct platform_device pxa_device_gpio = {
1078 .name = "pxa-gpio",
1079 .id = -1,
1080 .num_resources = ARRAY_SIZE(pxa_resource_gpio),
1081 .resource = pxa_resource_gpio,
1082};
1083
1054/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1. 1084/* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
1055 * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */ 1085 * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
1056void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info) 1086void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info)
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index 2fd5a8b35757..1475db107254 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -16,6 +16,7 @@ extern struct platform_device pxa_device_ficp;
16extern struct platform_device sa1100_device_rtc; 16extern struct platform_device sa1100_device_rtc;
17extern struct platform_device pxa_device_rtc; 17extern struct platform_device pxa_device_rtc;
18extern struct platform_device pxa_device_ac97; 18extern struct platform_device pxa_device_ac97;
19extern struct platform_device pxa_device_gpio;
19 20
20extern struct platform_device pxa27x_device_i2c_power; 21extern struct platform_device pxa27x_device_i2c_power;
21extern struct platform_device pxa27x_device_ohci; 22extern struct platform_device pxa27x_device_ohci;
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 94acc0b01dd6..3358f4da2ec9 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -70,7 +70,7 @@
70/* common GPIOs */ 70/* common GPIOs */
71#define GPIO11_NAND_CS (11) 71#define GPIO11_NAND_CS (11)
72#define GPIO41_ETHIRQ (41) 72#define GPIO41_ETHIRQ (41)
73#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) 73#define EM_X270_ETHIRQ PXA_GPIO_TO_IRQ(GPIO41_ETHIRQ)
74#define GPIO115_WLAN_PWEN (115) 74#define GPIO115_WLAN_PWEN (115)
75#define GPIO19_WLAN_STRAP (19) 75#define GPIO19_WLAN_STRAP (19)
76#define GPIO9_USB_VBUS_EN (9) 76#define GPIO9_USB_VBUS_EN (9)
@@ -805,7 +805,7 @@ static struct spi_board_info em_x270_spi_devices[] __initdata = {
805 .modalias = "libertas_spi", 805 .modalias = "libertas_spi",
806 .max_speed_hz = 13000000, 806 .max_speed_hz = 13000000,
807 .bus_num = 2, 807 .bus_num = 2,
808 .irq = IRQ_GPIO(116), 808 .irq = PXA_GPIO_TO_IRQ(116),
809 .chip_select = 0, 809 .chip_select = 0,
810 .controller_data = &em_x270_libertas_chip, 810 .controller_data = &em_x270_libertas_chip,
811 .platform_data = &em_x270_libertas_pdata, 811 .platform_data = &em_x270_libertas_pdata,
@@ -1203,7 +1203,7 @@ static struct da903x_platform_data em_x270_da9030_info = {
1203 1203
1204static struct i2c_board_info em_x270_i2c_pmic_info = { 1204static struct i2c_board_info em_x270_i2c_pmic_info = {
1205 I2C_BOARD_INFO("da9030", 0x49), 1205 I2C_BOARD_INFO("da9030", 0x49),
1206 .irq = IRQ_GPIO(0), 1206 .irq = PXA_GPIO_TO_IRQ(0),
1207 .platform_data = &em_x270_da9030_info, 1207 .platform_data = &em_x270_da9030_info,
1208}; 1208};
1209 1209
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index d82b7aa3c096..e556a1e3ff0f 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -119,8 +119,8 @@ struct resource eseries_tmio_resources[] = {
119 .flags = IORESOURCE_MEM, 119 .flags = IORESOURCE_MEM,
120 }, 120 },
121 [1] = { 121 [1] = {
122 .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ), 122 .start = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
123 .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ), 123 .end = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
124 .flags = IORESOURCE_IRQ, 124 .flags = IORESOURCE_IRQ,
125 }, 125 },
126}; 126};
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 6f6368ece9bd..82e9976e5657 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -252,8 +252,8 @@ static struct resource asic3_resources[] = {
252 .flags = IORESOURCE_MEM, 252 .flags = IORESOURCE_MEM,
253 }, 253 },
254 [1] = { 254 [1] = {
255 .start = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ), 255 .start = PXA_GPIO_TO_IRQ(GPIO12_HX4700_ASIC3_IRQ),
256 .end = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ), 256 .end = PXA_GPIO_TO_IRQ(GPIO12_HX4700_ASIC3_IRQ),
257 .flags = IORESOURCE_IRQ, 257 .flags = IORESOURCE_IRQ,
258 }, 258 },
259 /* SD part */ 259 /* SD part */
@@ -263,8 +263,8 @@ static struct resource asic3_resources[] = {
263 .flags = IORESOURCE_MEM, 263 .flags = IORESOURCE_MEM,
264 }, 264 },
265 [3] = { 265 [3] = {
266 .start = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ), 266 .start = PXA_GPIO_TO_IRQ(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
267 .end = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ), 267 .end = PXA_GPIO_TO_IRQ(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
268 .flags = IORESOURCE_IRQ, 268 .flags = IORESOURCE_IRQ,
269 }, 269 },
270}; 270};
@@ -587,7 +587,7 @@ static struct spi_board_info tsc2046_board_info[] __initdata = {
587 .modalias = "ads7846", 587 .modalias = "ads7846",
588 .bus_num = 2, 588 .bus_num = 2,
589 .max_speed_hz = 2600000, /* 100 kHz sample rate */ 589 .max_speed_hz = 2600000, /* 100 kHz sample rate */
590 .irq = gpio_to_irq(GPIO58_HX4700_TSC2046_nPENIRQ), 590 .irq = PXA_GPIO_TO_IRQ(GPIO58_HX4700_TSC2046_nPENIRQ),
591 .platform_data = &tsc2046_info, 591 .platform_data = &tsc2046_info,
592 .controller_data = &tsc2046_chip, 592 .controller_data = &tsc2046_chip,
593 }, 593 },
@@ -635,15 +635,15 @@ static struct resource power_supply_resources[] = {
635 .name = "ac", 635 .name = "ac",
636 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | 636 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
637 IORESOURCE_IRQ_LOWEDGE, 637 IORESOURCE_IRQ_LOWEDGE,
638 .start = gpio_to_irq(GPIOD9_nAC_IN), 638 .start = PXA_GPIO_TO_IRQ(GPIOD9_nAC_IN),
639 .end = gpio_to_irq(GPIOD9_nAC_IN), 639 .end = PXA_GPIO_TO_IRQ(GPIOD9_nAC_IN),
640 }, 640 },
641 [1] = { 641 [1] = {
642 .name = "usb", 642 .name = "usb",
643 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | 643 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
644 IORESOURCE_IRQ_LOWEDGE, 644 IORESOURCE_IRQ_LOWEDGE,
645 .start = gpio_to_irq(GPIOD14_nUSBC_DETECT), 645 .start = PXA_GPIO_TO_IRQ(GPIOD14_nUSBC_DETECT),
646 .end = gpio_to_irq(GPIOD14_nUSBC_DETECT), 646 .end = PXA_GPIO_TO_IRQ(GPIOD14_nUSBC_DETECT),
647 }, 647 },
648}; 648};
649 649
diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c
index f78d5db758da..33e81e87a9da 100644
--- a/arch/arm/mach-pxa/icontrol.c
+++ b/arch/arm/mach-pxa/icontrol.c
@@ -86,7 +86,7 @@ static struct spi_board_info mcp251x_board_info[] = {
86 .chip_select = 0, 86 .chip_select = 0,
87 .platform_data = &mcp251x_info, 87 .platform_data = &mcp251x_info,
88 .controller_data = &mcp251x_chip_info1, 88 .controller_data = &mcp251x_chip_info1,
89 .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ1) 89 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ1)
90 }, 90 },
91 { 91 {
92 .modalias = "mcp2515", 92 .modalias = "mcp2515",
@@ -95,7 +95,7 @@ static struct spi_board_info mcp251x_board_info[] = {
95 .chip_select = 1, 95 .chip_select = 1,
96 .platform_data = &mcp251x_info, 96 .platform_data = &mcp251x_info,
97 .controller_data = &mcp251x_chip_info2, 97 .controller_data = &mcp251x_chip_info2,
98 .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ2) 98 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ2)
99 }, 99 },
100 { 100 {
101 .modalias = "mcp2515", 101 .modalias = "mcp2515",
@@ -104,7 +104,7 @@ static struct spi_board_info mcp251x_board_info[] = {
104 .chip_select = 0, 104 .chip_select = 0,
105 .platform_data = &mcp251x_info, 105 .platform_data = &mcp251x_info,
106 .controller_data = &mcp251x_chip_info3, 106 .controller_data = &mcp251x_chip_info3,
107 .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ3) 107 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ3)
108 }, 108 },
109 { 109 {
110 .modalias = "mcp2515", 110 .modalias = "mcp2515",
@@ -113,7 +113,7 @@ static struct spi_board_info mcp251x_board_info[] = {
113 .chip_select = 1, 113 .chip_select = 1,
114 .platform_data = &mcp251x_info, 114 .platform_data = &mcp251x_info,
115 .controller_data = &mcp251x_chip_info4, 115 .controller_data = &mcp251x_chip_info4,
116 .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ4) 116 .irq = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ4)
117 } 117 }
118}; 118};
119 119
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
index ddf20e5c376e..bb98ff57b71f 100644
--- a/arch/arm/mach-pxa/idp.c
+++ b/arch/arm/mach-pxa/idp.c
@@ -75,8 +75,8 @@ static struct resource smc91x_resources[] = {
75 .flags = IORESOURCE_MEM, 75 .flags = IORESOURCE_MEM,
76 }, 76 },
77 [1] = { 77 [1] = {
78 .start = IRQ_GPIO(4), 78 .start = PXA_GPIO_TO_IRQ(4),
79 .end = IRQ_GPIO(4), 79 .end = PXA_GPIO_TO_IRQ(4),
80 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 80 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
81 } 81 }
82}; 82};
diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h
index 6d7eab3d0867..f02fa1e6ba86 100644
--- a/arch/arm/mach-pxa/include/mach/balloon3.h
+++ b/arch/arm/mach-pxa/include/mach/balloon3.h
@@ -172,9 +172,9 @@ enum balloon3_features {
172/* Balloon3 Interrupts */ 172/* Balloon3 Interrupts */
173#define BALLOON3_IRQ(x) (IRQ_BOARD_START + (x)) 173#define BALLOON3_IRQ(x) (IRQ_BOARD_START + (x))
174 174
175#define BALLOON3_AUX_NIRQ IRQ_GPIO(BALLOON3_GPIO_AUX_NIRQ) 175#define BALLOON3_AUX_NIRQ PXA_GPIO_TO_IRQ(BALLOON3_GPIO_AUX_NIRQ)
176#define BALLOON3_CODEC_IRQ IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ) 176#define BALLOON3_CODEC_IRQ PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ)
177#define BALLOON3_S0_CD_IRQ IRQ_GPIO(BALLOON3_GPIO_S0_CD) 177#define BALLOON3_S0_CD_IRQ PXA_GPIO_TO_IRQ(BALLOON3_GPIO_S0_CD)
178 178
179#define BALLOON3_NR_IRQS (IRQ_BOARD_START + 16) 179#define BALLOON3_NR_IRQS (IRQ_BOARD_START + 16)
180 180
diff --git a/arch/arm/mach-pxa/include/mach/corgi.h b/arch/arm/mach-pxa/include/mach/corgi.h
index 5dfd1195a5a7..f3c3493b468d 100644
--- a/arch/arm/mach-pxa/include/mach/corgi.h
+++ b/arch/arm/mach-pxa/include/mach/corgi.h
@@ -66,18 +66,18 @@
66/* 66/*
67 * Corgi Interrupts 67 * Corgi Interrupts
68 */ 68 */
69#define CORGI_IRQ_GPIO_KEY_INT IRQ_GPIO(0) 69#define CORGI_IRQ_GPIO_KEY_INT PXA_GPIO_TO_IRQ(0)
70#define CORGI_IRQ_GPIO_AC_IN IRQ_GPIO(1) 70#define CORGI_IRQ_GPIO_AC_IN PXA_GPIO_TO_IRQ(1)
71#define CORGI_IRQ_GPIO_WAKEUP IRQ_GPIO(3) 71#define CORGI_IRQ_GPIO_WAKEUP PXA_GPIO_TO_IRQ(3)
72#define CORGI_IRQ_GPIO_AK_INT IRQ_GPIO(4) 72#define CORGI_IRQ_GPIO_AK_INT PXA_GPIO_TO_IRQ(4)
73#define CORGI_IRQ_GPIO_TP_INT IRQ_GPIO(5) 73#define CORGI_IRQ_GPIO_TP_INT PXA_GPIO_TO_IRQ(5)
74#define CORGI_IRQ_GPIO_nSD_DETECT IRQ_GPIO(9) 74#define CORGI_IRQ_GPIO_nSD_DETECT PXA_GPIO_TO_IRQ(9)
75#define CORGI_IRQ_GPIO_nSD_INT IRQ_GPIO(10) 75#define CORGI_IRQ_GPIO_nSD_INT PXA_GPIO_TO_IRQ(10)
76#define CORGI_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(11) 76#define CORGI_IRQ_GPIO_MAIN_BAT_LOW PXA_GPIO_TO_IRQ(11)
77#define CORGI_IRQ_GPIO_CF_CD IRQ_GPIO(14) 77#define CORGI_IRQ_GPIO_CF_CD PXA_GPIO_TO_IRQ(14)
78#define CORGI_IRQ_GPIO_CHRG_FULL IRQ_GPIO(16) /* Battery fully charged */ 78#define CORGI_IRQ_GPIO_CHRG_FULL PXA_GPIO_TO_IRQ(16) /* Battery fully charged */
79#define CORGI_IRQ_GPIO_CF_IRQ IRQ_GPIO(17) 79#define CORGI_IRQ_GPIO_CF_IRQ PXA_GPIO_TO_IRQ(17)
80#define CORGI_IRQ_GPIO_KEY_SENSE(a) IRQ_GPIO(58+(a)) /* Keyboard Sense lines */ 80#define CORGI_IRQ_GPIO_KEY_SENSE(a) PXA_GPIO_TO_IRQ(58+(a)) /* Keyboard Sense lines */
81 81
82 82
83/* 83/*
@@ -98,7 +98,7 @@
98 CORGI_SCP_MIC_BIAS ) 98 CORGI_SCP_MIC_BIAS )
99#define CORGI_SCOOP_IO_OUT ( CORGI_SCP_MUTE_L | CORGI_SCP_MUTE_R ) 99#define CORGI_SCOOP_IO_OUT ( CORGI_SCP_MUTE_L | CORGI_SCP_MUTE_R )
100 100
101#define CORGI_SCOOP_GPIO_BASE (NR_BUILTIN_GPIO) 101#define CORGI_SCOOP_GPIO_BASE (PXA_NR_BUILTIN_GPIO)
102#define CORGI_GPIO_LED_GREEN (CORGI_SCOOP_GPIO_BASE + 0) 102#define CORGI_GPIO_LED_GREEN (CORGI_SCOOP_GPIO_BASE + 0)
103#define CORGI_GPIO_SWA (CORGI_SCOOP_GPIO_BASE + 1) /* Hinge Switch A */ 103#define CORGI_GPIO_SWA (CORGI_SCOOP_GPIO_BASE + 1) /* Hinge Switch A */
104#define CORGI_GPIO_SWB (CORGI_SCOOP_GPIO_BASE + 2) /* Hinge Switch B */ 104#define CORGI_GPIO_SWB (CORGI_SCOOP_GPIO_BASE + 2) /* Hinge Switch B */
diff --git a/arch/arm/mach-pxa/include/mach/csb726.h b/arch/arm/mach-pxa/include/mach/csb726.h
index 747ab1a71f2f..2628e7b72116 100644
--- a/arch/arm/mach-pxa/include/mach/csb726.h
+++ b/arch/arm/mach-pxa/include/mach/csb726.h
@@ -19,8 +19,8 @@
19#define CSB726_FLASH_SIZE (64 * 1024 * 1024) 19#define CSB726_FLASH_SIZE (64 * 1024 * 1024)
20#define CSB726_FLASH_uMON (8 * 1024 * 1024) 20#define CSB726_FLASH_uMON (8 * 1024 * 1024)
21 21
22#define CSB726_IRQ_LAN gpio_to_irq(CSB726_GPIO_IRQ_LAN) 22#define CSB726_IRQ_LAN PXA_GPIO_TO_IRQ(CSB726_GPIO_IRQ_LAN)
23#define CSB726_IRQ_SM501 gpio_to_irq(CSB726_GPIO_IRQ_SM501) 23#define CSB726_IRQ_SM501 PXA_GPIO_TO_IRQ(CSB726_GPIO_IRQ_SM501)
24 24
25#endif 25#endif
26 26
diff --git a/arch/arm/mach-pxa/include/mach/gpio-pxa.h b/arch/arm/mach-pxa/include/mach/gpio-pxa.h
deleted file mode 100644
index 41b4c93a96c2..000000000000
--- a/arch/arm/mach-pxa/include/mach/gpio-pxa.h
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2 * Written by Philipp Zabel <philipp.zabel@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 */
19#ifndef __MACH_PXA_GPIO_PXA_H
20#define __MACH_PXA_GPIO_PXA_H
21
22#include <mach/irqs.h>
23#include <mach/hardware.h>
24
25#define GPIO_REGS_VIRT io_p2v(0x40E00000)
26
27#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
28#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
29
30/* GPIO Pin Level Registers */
31#define GPLR0 GPIO_REG(BANK_OFF(0) + 0x00)
32#define GPLR1 GPIO_REG(BANK_OFF(1) + 0x00)
33#define GPLR2 GPIO_REG(BANK_OFF(2) + 0x00)
34#define GPLR3 GPIO_REG(BANK_OFF(3) + 0x00)
35
36/* GPIO Pin Direction Registers */
37#define GPDR0 GPIO_REG(BANK_OFF(0) + 0x0c)
38#define GPDR1 GPIO_REG(BANK_OFF(1) + 0x0c)
39#define GPDR2 GPIO_REG(BANK_OFF(2) + 0x0c)
40#define GPDR3 GPIO_REG(BANK_OFF(3) + 0x0c)
41
42/* GPIO Pin Output Set Registers */
43#define GPSR0 GPIO_REG(BANK_OFF(0) + 0x18)
44#define GPSR1 GPIO_REG(BANK_OFF(1) + 0x18)
45#define GPSR2 GPIO_REG(BANK_OFF(2) + 0x18)
46#define GPSR3 GPIO_REG(BANK_OFF(3) + 0x18)
47
48/* GPIO Pin Output Clear Registers */
49#define GPCR0 GPIO_REG(BANK_OFF(0) + 0x24)
50#define GPCR1 GPIO_REG(BANK_OFF(1) + 0x24)
51#define GPCR2 GPIO_REG(BANK_OFF(2) + 0x24)
52#define GPCR3 GPIO_REG(BANK_OFF(3) + 0x24)
53
54/* GPIO Rising Edge Detect Registers */
55#define GRER0 GPIO_REG(BANK_OFF(0) + 0x30)
56#define GRER1 GPIO_REG(BANK_OFF(1) + 0x30)
57#define GRER2 GPIO_REG(BANK_OFF(2) + 0x30)
58#define GRER3 GPIO_REG(BANK_OFF(3) + 0x30)
59
60/* GPIO Falling Edge Detect Registers */
61#define GFER0 GPIO_REG(BANK_OFF(0) + 0x3c)
62#define GFER1 GPIO_REG(BANK_OFF(1) + 0x3c)
63#define GFER2 GPIO_REG(BANK_OFF(2) + 0x3c)
64#define GFER3 GPIO_REG(BANK_OFF(3) + 0x3c)
65
66/* GPIO Edge Detect Status Registers */
67#define GEDR0 GPIO_REG(BANK_OFF(0) + 0x48)
68#define GEDR1 GPIO_REG(BANK_OFF(1) + 0x48)
69#define GEDR2 GPIO_REG(BANK_OFF(2) + 0x48)
70#define GEDR3 GPIO_REG(BANK_OFF(3) + 0x48)
71
72/* GPIO Alternate Function Select Registers */
73#define GAFR0_L GPIO_REG(0x0054)
74#define GAFR0_U GPIO_REG(0x0058)
75#define GAFR1_L GPIO_REG(0x005C)
76#define GAFR1_U GPIO_REG(0x0060)
77#define GAFR2_L GPIO_REG(0x0064)
78#define GAFR2_U GPIO_REG(0x0068)
79#define GAFR3_L GPIO_REG(0x006C)
80#define GAFR3_U GPIO_REG(0x0070)
81
82/* More handy macros. The argument is a literal GPIO number. */
83
84#define GPIO_bit(x) (1 << ((x) & 0x1f))
85
86#define GPLR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
87#define GPDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
88#define GPSR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
89#define GPCR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
90#define GRER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
91#define GFER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
92#define GEDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
93#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2))
94
95
96#define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM
97
98#define gpio_to_bank(gpio) ((gpio) >> 5)
99
100#ifdef CONFIG_CPU_PXA26x
101/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
102 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
103 */
104static inline int __gpio_is_inverted(unsigned gpio)
105{
106 return cpu_is_pxa25x() && gpio > 85;
107}
108#else
109static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
110#endif
111
112/*
113 * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
114 * function of a GPIO, and GPDRx cannot be altered once configured. It
115 * is attributed as "occupied" here (I know this terminology isn't
116 * accurate, you are welcome to propose a better one :-)
117 */
118static inline int __gpio_is_occupied(unsigned gpio)
119{
120 if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
121 int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
122 int dir = GPDR(gpio) & GPIO_bit(gpio);
123
124 if (__gpio_is_inverted(gpio))
125 return af != 1 || dir == 0;
126 else
127 return af != 0 || dir != 0;
128 } else
129 return GPDR(gpio) & GPIO_bit(gpio);
130}
131
132#include <plat/gpio-pxa.h>
133#endif /* __MACH_PXA_GPIO_PXA_H */
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
index 004cade7bb13..0248e433bc98 100644
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -25,24 +25,8 @@
25#define __ASM_ARCH_PXA_GPIO_H 25#define __ASM_ARCH_PXA_GPIO_H
26 26
27#include <asm-generic/gpio.h> 27#include <asm-generic/gpio.h>
28/* The defines for the driver are needed for the accelerated accessors */
29#include "gpio-pxa.h"
30 28
31#define gpio_to_irq(gpio) IRQ_GPIO(gpio) 29#include <mach/irqs.h>
30#include <mach/hardware.h>
32 31
33static inline int irq_to_gpio(unsigned int irq)
34{
35 int gpio;
36
37 if (irq == IRQ_GPIO0 || irq == IRQ_GPIO1)
38 return irq - IRQ_GPIO0;
39
40 gpio = irq - PXA_GPIO_IRQ_BASE;
41 if (gpio >= 2 && gpio < NR_BUILTIN_GPIO)
42 return gpio;
43
44 return -1;
45}
46
47#include <plat/gpio.h>
48#endif 32#endif
diff --git a/arch/arm/mach-pxa/include/mach/gumstix.h b/arch/arm/mach-pxa/include/mach/gumstix.h
index 9b898680b206..dba14b6503ad 100644
--- a/arch/arm/mach-pxa/include/mach/gumstix.h
+++ b/arch/arm/mach-pxa/include/mach/gumstix.h
@@ -24,7 +24,7 @@ has detected a cable insertion; driven low otherwise. */
24#define GPIO_GUMSTIX_USB_GPIOx 41 24#define GPIO_GUMSTIX_USB_GPIOx 41
25 25
26/* usb state change */ 26/* usb state change */
27#define GUMSTIX_USB_INTR_IRQ IRQ_GPIO(GPIO_GUMSTIX_USB_GPIOn) 27#define GUMSTIX_USB_INTR_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_USB_GPIOn)
28 28
29#define GPIO_GUMSTIX_USB_GPIOn_MD (GPIO_GUMSTIX_USB_GPIOn | GPIO_IN) 29#define GPIO_GUMSTIX_USB_GPIOn_MD (GPIO_GUMSTIX_USB_GPIOn | GPIO_IN)
30#define GPIO_GUMSTIX_USB_GPIOx_CON_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_OUT) 30#define GPIO_GUMSTIX_USB_GPIOx_CON_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_OUT)
@@ -35,7 +35,7 @@ has detected a cable insertion; driven low otherwise. */
35 */ 35 */
36#define GUMSTIX_GPIO_nSD_WP 22 /* SD Write Protect */ 36#define GUMSTIX_GPIO_nSD_WP 22 /* SD Write Protect */
37#define GUMSTIX_GPIO_nSD_DETECT 11 /* MMC/SD Card Detect */ 37#define GUMSTIX_GPIO_nSD_DETECT 11 /* MMC/SD Card Detect */
38#define GUMSTIX_IRQ_GPIO_nSD_DETECT IRQ_GPIO(GUMSTIX_GPIO_nSD_DETECT) 38#define GUMSTIX_IRQ_GPIO_nSD_DETECT PXA_GPIO_TO_IRQ(GUMSTIX_GPIO_nSD_DETECT)
39 39
40/* 40/*
41 * SMC Ethernet definitions 41 * SMC Ethernet definitions
@@ -49,10 +49,10 @@ has detected a cable insertion; driven low otherwise. */
49 49
50#define GPIO_GUMSTIX_ETH0 36 50#define GPIO_GUMSTIX_ETH0 36
51#define GPIO_GUMSTIX_ETH0_MD (GPIO_GUMSTIX_ETH0 | GPIO_IN) 51#define GPIO_GUMSTIX_ETH0_MD (GPIO_GUMSTIX_ETH0 | GPIO_IN)
52#define GUMSTIX_ETH0_IRQ IRQ_GPIO(GPIO_GUMSTIX_ETH0) 52#define GUMSTIX_ETH0_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0)
53#define GPIO_GUMSTIX_ETH1 27 53#define GPIO_GUMSTIX_ETH1 27
54#define GPIO_GUMSTIX_ETH1_MD (GPIO_GUMSTIX_ETH1 | GPIO_IN) 54#define GPIO_GUMSTIX_ETH1_MD (GPIO_GUMSTIX_ETH1 | GPIO_IN)
55#define GUMSTIX_ETH1_IRQ IRQ_GPIO(GPIO_GUMSTIX_ETH1) 55#define GUMSTIX_ETH1_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH1)
56 56
57 57
58/* CF reset line */ 58/* CF reset line */
@@ -63,18 +63,18 @@ has detected a cable insertion; driven low otherwise. */
63#define GPIO4_nSTSCHG GPIO4_nBVD1 63#define GPIO4_nSTSCHG GPIO4_nBVD1
64#define GPIO11_nCD 11 64#define GPIO11_nCD 11
65#define GPIO26_PRDY_nBSY 26 65#define GPIO26_PRDY_nBSY 26
66#define GUMSTIX_S0_nSTSCHG_IRQ IRQ_GPIO(GPIO4_nSTSCHG) 66#define GUMSTIX_S0_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO4_nSTSCHG)
67#define GUMSTIX_S0_nCD_IRQ IRQ_GPIO(GPIO11_nCD) 67#define GUMSTIX_S0_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO11_nCD)
68#define GUMSTIX_S0_PRDY_nBSY_IRQ IRQ_GPIO(GPIO26_PRDY_nBSY) 68#define GUMSTIX_S0_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO26_PRDY_nBSY)
69 69
70/* CF slot 1 */ 70/* CF slot 1 */
71#define GPIO18_nBVD1 18 71#define GPIO18_nBVD1 18
72#define GPIO18_nSTSCHG GPIO18_nBVD1 72#define GPIO18_nSTSCHG GPIO18_nBVD1
73#define GPIO36_nCD 36 73#define GPIO36_nCD 36
74#define GPIO27_PRDY_nBSY 27 74#define GPIO27_PRDY_nBSY 27
75#define GUMSTIX_S1_nSTSCHG_IRQ IRQ_GPIO(GPIO18_nSTSCHG) 75#define GUMSTIX_S1_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO18_nSTSCHG)
76#define GUMSTIX_S1_nCD_IRQ IRQ_GPIO(GPIO36_nCD) 76#define GUMSTIX_S1_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO36_nCD)
77#define GUMSTIX_S1_PRDY_nBSY_IRQ IRQ_GPIO(GPIO27_PRDY_nBSY) 77#define GUMSTIX_S1_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO27_PRDY_nBSY)
78 78
79/* CF GPIO line modes */ 79/* CF GPIO line modes */
80#define GPIO4_nSTSCHG_MD (GPIO4_nSTSCHG | GPIO_IN) 80#define GPIO4_nSTSCHG_MD (GPIO4_nSTSCHG | GPIO_IN)
diff --git a/arch/arm/mach-pxa/include/mach/hx4700.h b/arch/arm/mach-pxa/include/mach/hx4700.h
index 37408449ec25..8bc02913517c 100644
--- a/arch/arm/mach-pxa/include/mach/hx4700.h
+++ b/arch/arm/mach-pxa/include/mach/hx4700.h
@@ -15,7 +15,7 @@
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16#include <linux/mfd/asic3.h> 16#include <linux/mfd/asic3.h>
17 17
18#define HX4700_ASIC3_GPIO_BASE NR_BUILTIN_GPIO 18#define HX4700_ASIC3_GPIO_BASE PXA_NR_BUILTIN_GPIO
19#define HX4700_EGPIO_BASE (HX4700_ASIC3_GPIO_BASE + ASIC3_NUM_GPIOS) 19#define HX4700_EGPIO_BASE (HX4700_ASIC3_GPIO_BASE + ASIC3_NUM_GPIOS)
20#define HX4700_NR_IRQS (IRQ_BOARD_START + 70) 20#define HX4700_NR_IRQS (IRQ_BOARD_START + 70)
21 21
diff --git a/arch/arm/mach-pxa/include/mach/idp.h b/arch/arm/mach-pxa/include/mach/idp.h
index 5eff96fcc944..22a96f87232b 100644
--- a/arch/arm/mach-pxa/include/mach/idp.h
+++ b/arch/arm/mach-pxa/include/mach/idp.h
@@ -131,28 +131,26 @@
131#define PCC_VS2 (1 << 1) 131#define PCC_VS2 (1 << 1)
132#define PCC_VS1 (1 << 0) 132#define PCC_VS1 (1 << 0)
133 133
134#define PCC_DETECT(x) (GPLR(7 + (x)) & GPIO_bit(7 + (x)))
135
136/* A listing of interrupts used by external hardware devices */ 134/* A listing of interrupts used by external hardware devices */
137 135
138#define TOUCH_PANEL_IRQ IRQ_GPIO(5) 136#define TOUCH_PANEL_IRQ PXA_GPIO_TO_IRQ(5)
139#define IDE_IRQ IRQ_GPIO(21) 137#define IDE_IRQ PXA_GPIO_TO_IRQ(21)
140 138
141#define TOUCH_PANEL_IRQ_EDGE IRQ_TYPE_EDGE_FALLING 139#define TOUCH_PANEL_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
142 140
143#define ETHERNET_IRQ IRQ_GPIO(4) 141#define ETHERNET_IRQ PXA_GPIO_TO_IRQ(4)
144#define ETHERNET_IRQ_EDGE IRQ_TYPE_EDGE_RISING 142#define ETHERNET_IRQ_EDGE IRQ_TYPE_EDGE_RISING
145 143
146#define IDE_IRQ_EDGE IRQ_TYPE_EDGE_RISING 144#define IDE_IRQ_EDGE IRQ_TYPE_EDGE_RISING
147 145
148#define PCMCIA_S0_CD_VALID IRQ_GPIO(7) 146#define PCMCIA_S0_CD_VALID PXA_GPIO_TO_IRQ(7)
149#define PCMCIA_S0_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH 147#define PCMCIA_S0_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH
150 148
151#define PCMCIA_S1_CD_VALID IRQ_GPIO(8) 149#define PCMCIA_S1_CD_VALID PXA_GPIO_TO_IRQ(8)
152#define PCMCIA_S1_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH 150#define PCMCIA_S1_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH
153 151
154#define PCMCIA_S0_RDYINT IRQ_GPIO(19) 152#define PCMCIA_S0_RDYINT PXA_GPIO_TO_IRQ(19)
155#define PCMCIA_S1_RDYINT IRQ_GPIO(22) 153#define PCMCIA_S1_RDYINT PXA_GPIO_TO_IRQ(22)
156 154
157 155
158/* 156/*
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index 7cc5a781e99e..32975adf3ca4 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -88,10 +88,8 @@
88#define IRQ_U2P PXA_IRQ(93) /* USB PHY D+/D- Lines (PXA935) */ 88#define IRQ_U2P PXA_IRQ(93) /* USB PHY D+/D- Lines (PXA935) */
89 89
90#define PXA_GPIO_IRQ_BASE PXA_IRQ(96) 90#define PXA_GPIO_IRQ_BASE PXA_IRQ(96)
91#define PXA_GPIO_IRQ_NUM (192) 91#define PXA_NR_BUILTIN_GPIO (192)
92 92#define PXA_GPIO_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x))
93#define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x))
94#define IRQ_GPIO(x) (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x))
95 93
96/* 94/*
97 * The following interrupts are for board specific purposes. Since 95 * The following interrupts are for board specific purposes. Since
@@ -100,7 +98,7 @@
100 * By default, no board IRQ is reserved. It should be finished in 98 * By default, no board IRQ is reserved. It should be finished in
101 * custom board since sparse IRQ is already enabled. 99 * custom board since sparse IRQ is already enabled.
102 */ 100 */
103#define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM) 101#define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_NR_BUILTIN_GPIO)
104 102
105#define NR_IRQS (IRQ_BOARD_START) 103#define NR_IRQS (IRQ_BOARD_START)
106 104
diff --git a/arch/arm/mach-pxa/include/mach/littleton.h b/arch/arm/mach-pxa/include/mach/littleton.h
index b6238cbd8aea..8066be54e9f5 100644
--- a/arch/arm/mach-pxa/include/mach/littleton.h
+++ b/arch/arm/mach-pxa/include/mach/littleton.h
@@ -1,13 +1,11 @@
1#ifndef __ASM_ARCH_LITTLETON_H 1#ifndef __ASM_ARCH_LITTLETON_H
2#define __ASM_ARCH_LITTLETON_H 2#define __ASM_ARCH_LITTLETON_H
3 3
4#include <mach/gpio-pxa.h>
5
6#define LITTLETON_ETH_PHYS 0x30000000 4#define LITTLETON_ETH_PHYS 0x30000000
7 5
8#define LITTLETON_GPIO_LCD_CS (17) 6#define LITTLETON_GPIO_LCD_CS (17)
9 7
10#define EXT0_GPIO_BASE (NR_BUILTIN_GPIO) 8#define EXT0_GPIO_BASE (PXA_NR_BUILTIN_GPIO)
11#define EXT0_GPIO(x) (EXT0_GPIO_BASE + (x)) 9#define EXT0_GPIO(x) (EXT0_GPIO_BASE + (x))
12 10
13#define LITTLETON_NR_IRQS (IRQ_BOARD_START + 8) 11#define LITTLETON_NR_IRQS (IRQ_BOARD_START + 8)
diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h
index 7cbfc5d3f9df..ba6a6e1d29e9 100644
--- a/arch/arm/mach-pxa/include/mach/magician.h
+++ b/arch/arm/mach-pxa/include/mach/magician.h
@@ -78,7 +78,7 @@
78 * CPLD EGPIOs 78 * CPLD EGPIOs
79 */ 79 */
80 80
81#define MAGICIAN_EGPIO_BASE NR_BUILTIN_GPIO 81#define MAGICIAN_EGPIO_BASE PXA_NR_BUILTIN_GPIO
82#define MAGICIAN_EGPIO(reg,bit) \ 82#define MAGICIAN_EGPIO(reg,bit) \
83 (MAGICIAN_EGPIO_BASE + 8*reg + bit) 83 (MAGICIAN_EGPIO_BASE + 8*reg + bit)
84 84
diff --git a/arch/arm/mach-pxa/include/mach/palmld.h b/arch/arm/mach-pxa/include/mach/palmld.h
index ae536e86d8e8..2c4471336570 100644
--- a/arch/arm/mach-pxa/include/mach/palmld.h
+++ b/arch/arm/mach-pxa/include/mach/palmld.h
@@ -68,10 +68,10 @@
68/* 20, 53 and 86 are usb related too */ 68/* 20, 53 and 86 are usb related too */
69 69
70/* INTERRUPTS */ 70/* INTERRUPTS */
71#define IRQ_GPIO_PALMLD_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMLD_GPIO_RESET) 71#define IRQ_GPIO_PALMLD_GPIO_RESET PXA_GPIO_TO_IRQ(GPIO_NR_PALMLD_GPIO_RESET)
72#define IRQ_GPIO_PALMLD_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMLD_SD_DETECT_N) 72#define IRQ_GPIO_PALMLD_SD_DETECT_N PXA_GPIO_TO_IRQ(GPIO_NR_PALMLD_SD_DETECT_N)
73#define IRQ_GPIO_PALMLD_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMLD_WM9712_IRQ) 73#define IRQ_GPIO_PALMLD_WM9712_IRQ PXA_GPIO_TO_IRQ(GPIO_NR_PALMLD_WM9712_IRQ)
74#define IRQ_GPIO_PALMLD_IDE_IRQ IRQ_GPIO(GPIO_NR_PALMLD_IDE_IRQ) 74#define IRQ_GPIO_PALMLD_IDE_IRQ PXA_GPIO_TO_IRQ(GPIO_NR_PALMLD_IDE_IRQ)
75 75
76 76
77/** HERE ARE INIT VALUES **/ 77/** HERE ARE INIT VALUES **/
diff --git a/arch/arm/mach-pxa/include/mach/palmt5.h b/arch/arm/mach-pxa/include/mach/palmt5.h
index 6baf7469d4ec..0bd4f036c72f 100644
--- a/arch/arm/mach-pxa/include/mach/palmt5.h
+++ b/arch/arm/mach-pxa/include/mach/palmt5.h
@@ -48,10 +48,10 @@
48#define GPIO_NR_PALMT5_BT_RESET 83 48#define GPIO_NR_PALMT5_BT_RESET 83
49 49
50/* INTERRUPTS */ 50/* INTERRUPTS */
51#define IRQ_GPIO_PALMT5_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMT5_SD_DETECT_N) 51#define IRQ_GPIO_PALMT5_SD_DETECT_N PXA_GPIO_TO_IRQ(GPIO_NR_PALMT5_SD_DETECT_N)
52#define IRQ_GPIO_PALMT5_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMT5_WM9712_IRQ) 52#define IRQ_GPIO_PALMT5_WM9712_IRQ PXA_GPIO_TO_IRQ(GPIO_NR_PALMT5_WM9712_IRQ)
53#define IRQ_GPIO_PALMT5_USB_DETECT IRQ_GPIO(GPIO_NR_PALMT5_USB_DETECT) 53#define IRQ_GPIO_PALMT5_USB_DETECT PXA_GPIO_TO_IRQ(GPIO_NR_PALMT5_USB_DETECT)
54#define IRQ_GPIO_PALMT5_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMT5_GPIO_RESET) 54#define IRQ_GPIO_PALMT5_GPIO_RESET PXA_GPIO_TO_IRQ(GPIO_NR_PALMT5_GPIO_RESET)
55 55
56/** HERE ARE INIT VALUES **/ 56/** HERE ARE INIT VALUES **/
57 57
diff --git a/arch/arm/mach-pxa/include/mach/palmtc.h b/arch/arm/mach-pxa/include/mach/palmtc.h
index 3f9dd3fd4638..c383a21680b6 100644
--- a/arch/arm/mach-pxa/include/mach/palmtc.h
+++ b/arch/arm/mach-pxa/include/mach/palmtc.h
@@ -52,8 +52,8 @@
52#define GPIO_NR_PALMTC_IR_DISABLE 45 52#define GPIO_NR_PALMTC_IR_DISABLE 45
53 53
54/* IRQs */ 54/* IRQs */
55#define IRQ_GPIO_PALMTC_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMTC_SD_DETECT_N) 55#define IRQ_GPIO_PALMTC_SD_DETECT_N PXA_GPIO_TO_IRQ(GPIO_NR_PALMTC_SD_DETECT_N)
56#define IRQ_GPIO_PALMTC_WLAN_READY IRQ_GPIO(GPIO_NR_PALMTC_WLAN_READY) 56#define IRQ_GPIO_PALMTC_WLAN_READY PXA_GPIO_TO_IRQ(GPIO_NR_PALMTC_WLAN_READY)
57 57
58/* UCB1400 GPIOs */ 58/* UCB1400 GPIOs */
59#define GPIO_NR_PALMTC_POWER_DETECT (0x80 | 0x00) 59#define GPIO_NR_PALMTC_POWER_DETECT (0x80 | 0x00)
diff --git a/arch/arm/mach-pxa/include/mach/palmtx.h b/arch/arm/mach-pxa/include/mach/palmtx.h
index 7074a6ed46c6..f2e530380253 100644
--- a/arch/arm/mach-pxa/include/mach/palmtx.h
+++ b/arch/arm/mach-pxa/include/mach/palmtx.h
@@ -62,10 +62,10 @@
62#define GPIO_NR_PALMTX_NAND_BUFFER_DIR 79 62#define GPIO_NR_PALMTX_NAND_BUFFER_DIR 79
63 63
64/* INTERRUPTS */ 64/* INTERRUPTS */
65#define IRQ_GPIO_PALMTX_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMTX_SD_DETECT_N) 65#define IRQ_GPIO_PALMTX_SD_DETECT_N PXA_GPIO_TO_IRQ(GPIO_NR_PALMTX_SD_DETECT_N)
66#define IRQ_GPIO_PALMTX_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMTX_WM9712_IRQ) 66#define IRQ_GPIO_PALMTX_WM9712_IRQ PXA_GPIO_TO_IRQ(GPIO_NR_PALMTX_WM9712_IRQ)
67#define IRQ_GPIO_PALMTX_USB_DETECT IRQ_GPIO(GPIO_NR_PALMTX_USB_DETECT) 67#define IRQ_GPIO_PALMTX_USB_DETECT PXA_GPIO_TO_IRQ(GPIO_NR_PALMTX_USB_DETECT)
68#define IRQ_GPIO_PALMTX_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMTX_GPIO_RESET) 68#define IRQ_GPIO_PALMTX_GPIO_RESET PXA_GPIO_TO_IRQ(GPIO_NR_PALMTX_GPIO_RESET)
69 69
70/** HERE ARE INIT VALUES **/ 70/** HERE ARE INIT VALUES **/
71 71
diff --git a/arch/arm/mach-pxa/include/mach/pcm027.h b/arch/arm/mach-pxa/include/mach/pcm027.h
index 4bac588478a8..6bf28de228bd 100644
--- a/arch/arm/mach-pxa/include/mach/pcm027.h
+++ b/arch/arm/mach-pxa/include/mach/pcm027.h
@@ -34,7 +34,7 @@
34 34
35/* I2C RTC */ 35/* I2C RTC */
36#define PCM027_RTC_IRQ_GPIO 0 36#define PCM027_RTC_IRQ_GPIO 0
37#define PCM027_RTC_IRQ IRQ_GPIO(PCM027_RTC_IRQ_GPIO) 37#define PCM027_RTC_IRQ PXA_GPIO_TO_IRQ(PCM027_RTC_IRQ_GPIO)
38#define PCM027_RTC_IRQ_EDGE IRQ_TYPE_EDGE_FALLING 38#define PCM027_RTC_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
39#define ADR_PCM027_RTC 0x51 /* I2C address */ 39#define ADR_PCM027_RTC 0x51 /* I2C address */
40 40
@@ -43,21 +43,21 @@
43 43
44/* Ethernet chip (SMSC91C111) */ 44/* Ethernet chip (SMSC91C111) */
45#define PCM027_ETH_IRQ_GPIO 52 45#define PCM027_ETH_IRQ_GPIO 52
46#define PCM027_ETH_IRQ IRQ_GPIO(PCM027_ETH_IRQ_GPIO) 46#define PCM027_ETH_IRQ PXA_GPIO_TO_IRQ(PCM027_ETH_IRQ_GPIO)
47#define PCM027_ETH_IRQ_EDGE IRQ_TYPE_EDGE_RISING 47#define PCM027_ETH_IRQ_EDGE IRQ_TYPE_EDGE_RISING
48#define PCM027_ETH_PHYS PXA_CS5_PHYS 48#define PCM027_ETH_PHYS PXA_CS5_PHYS
49#define PCM027_ETH_SIZE (1*1024*1024) 49#define PCM027_ETH_SIZE (1*1024*1024)
50 50
51/* CAN controller SJA1000 (unsupported yet) */ 51/* CAN controller SJA1000 (unsupported yet) */
52#define PCM027_CAN_IRQ_GPIO 114 52#define PCM027_CAN_IRQ_GPIO 114
53#define PCM027_CAN_IRQ IRQ_GPIO(PCM027_CAN_IRQ_GPIO) 53#define PCM027_CAN_IRQ PXA_GPIO_TO_IRQ(PCM027_CAN_IRQ_GPIO)
54#define PCM027_CAN_IRQ_EDGE IRQ_TYPE_EDGE_FALLING 54#define PCM027_CAN_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
55#define PCM027_CAN_PHYS 0x22000000 55#define PCM027_CAN_PHYS 0x22000000
56#define PCM027_CAN_SIZE 0x100 56#define PCM027_CAN_SIZE 0x100
57 57
58/* SPI GPIO expander (unsupported yet) */ 58/* SPI GPIO expander (unsupported yet) */
59#define PCM027_EGPIO_IRQ_GPIO 27 59#define PCM027_EGPIO_IRQ_GPIO 27
60#define PCM027_EGPIO_IRQ IRQ_GPIO(PCM027_EGPIO_IRQ_GPIO) 60#define PCM027_EGPIO_IRQ PXA_GPIO_TO_IRQ(PCM027_EGPIO_IRQ_GPIO)
61#define PCM027_EGPIO_IRQ_EDGE IRQ_TYPE_EDGE_FALLING 61#define PCM027_EGPIO_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
62#define PCM027_EGPIO_CS 24 62#define PCM027_EGPIO_CS 24
63/* 63/*
diff --git a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
index 8a4383b776d7..d72791695b26 100644
--- a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
+++ b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
@@ -28,14 +28,14 @@
28 28
29/* CPLD's interrupt controller is connected to PCM-027 GPIO 9 */ 29/* CPLD's interrupt controller is connected to PCM-027 GPIO 9 */
30#define PCM990_CTRL_INT_IRQ_GPIO 9 30#define PCM990_CTRL_INT_IRQ_GPIO 9
31#define PCM990_CTRL_INT_IRQ IRQ_GPIO(PCM990_CTRL_INT_IRQ_GPIO) 31#define PCM990_CTRL_INT_IRQ PXA_GPIO_TO_IRQ(PCM990_CTRL_INT_IRQ_GPIO)
32#define PCM990_CTRL_INT_IRQ_EDGE IRQ_TYPE_EDGE_RISING 32#define PCM990_CTRL_INT_IRQ_EDGE IRQ_TYPE_EDGE_RISING
33#define PCM990_CTRL_PHYS PXA_CS1_PHYS /* 16-Bit */ 33#define PCM990_CTRL_PHYS PXA_CS1_PHYS /* 16-Bit */
34#define PCM990_CTRL_BASE 0xea000000 34#define PCM990_CTRL_BASE 0xea000000
35#define PCM990_CTRL_SIZE (1*1024*1024) 35#define PCM990_CTRL_SIZE (1*1024*1024)
36 36
37#define PCM990_CTRL_PWR_IRQ_GPIO 14 37#define PCM990_CTRL_PWR_IRQ_GPIO 14
38#define PCM990_CTRL_PWR_IRQ IRQ_GPIO(PCM990_CTRL_PWR_IRQ_GPIO) 38#define PCM990_CTRL_PWR_IRQ PXA_GPIO_TO_IRQ(PCM990_CTRL_PWR_IRQ_GPIO)
39#define PCM990_CTRL_PWR_IRQ_EDGE IRQ_TYPE_EDGE_RISING 39#define PCM990_CTRL_PWR_IRQ_EDGE IRQ_TYPE_EDGE_RISING
40 40
41/* visible CPLD (U7) registers */ 41/* visible CPLD (U7) registers */
@@ -132,7 +132,7 @@
132 * IDE 132 * IDE
133 */ 133 */
134#define PCM990_IDE_IRQ_GPIO 13 134#define PCM990_IDE_IRQ_GPIO 13
135#define PCM990_IDE_IRQ IRQ_GPIO(PCM990_IDE_IRQ_GPIO) 135#define PCM990_IDE_IRQ PXA_GPIO_TO_IRQ(PCM990_IDE_IRQ_GPIO)
136#define PCM990_IDE_IRQ_EDGE IRQ_TYPE_EDGE_RISING 136#define PCM990_IDE_IRQ_EDGE IRQ_TYPE_EDGE_RISING
137#define PCM990_IDE_PLD_PHYS 0x20000000 /* 16 bit wide */ 137#define PCM990_IDE_PLD_PHYS 0x20000000 /* 16 bit wide */
138#define PCM990_IDE_PLD_BASE 0xee000000 138#define PCM990_IDE_PLD_BASE 0xee000000
@@ -188,11 +188,11 @@
188 * Compact Flash 188 * Compact Flash
189 */ 189 */
190#define PCM990_CF_IRQ_GPIO 11 190#define PCM990_CF_IRQ_GPIO 11
191#define PCM990_CF_IRQ IRQ_GPIO(PCM990_CF_IRQ_GPIO) 191#define PCM990_CF_IRQ PXA_GPIO_TO_IRQ(PCM990_CF_IRQ_GPIO)
192#define PCM990_CF_IRQ_EDGE IRQ_TYPE_EDGE_RISING 192#define PCM990_CF_IRQ_EDGE IRQ_TYPE_EDGE_RISING
193 193
194#define PCM990_CF_CD_GPIO 12 194#define PCM990_CF_CD_GPIO 12
195#define PCM990_CF_CD IRQ_GPIO(PCM990_CF_CD_GPIO) 195#define PCM990_CF_CD PXA_GPIO_TO_IRQ(PCM990_CF_CD_GPIO)
196#define PCM990_CF_CD_EDGE IRQ_TYPE_EDGE_RISING 196#define PCM990_CF_CD_EDGE IRQ_TYPE_EDGE_RISING
197 197
198#define PCM990_CF_PLD_PHYS 0x30000000 /* 16 bit wide */ 198#define PCM990_CF_PLD_PHYS 0x30000000 /* 16 bit wide */
@@ -258,14 +258,14 @@
258 * Wolfson AC97 Touch 258 * Wolfson AC97 Touch
259 */ 259 */
260#define PCM990_AC97_IRQ_GPIO 10 260#define PCM990_AC97_IRQ_GPIO 10
261#define PCM990_AC97_IRQ IRQ_GPIO(PCM990_AC97_IRQ_GPIO) 261#define PCM990_AC97_IRQ PXA_GPIO_TO_IRQ(PCM990_AC97_IRQ_GPIO)
262#define PCM990_AC97_IRQ_EDGE IRQ_TYPE_EDGE_RISING 262#define PCM990_AC97_IRQ_EDGE IRQ_TYPE_EDGE_RISING
263 263
264/* 264/*
265 * MMC phyCORE 265 * MMC phyCORE
266 */ 266 */
267#define PCM990_MMC0_IRQ_GPIO 9 267#define PCM990_MMC0_IRQ_GPIO 9
268#define PCM990_MMC0_IRQ IRQ_GPIO(PCM990_MMC0_IRQ_GPIO) 268#define PCM990_MMC0_IRQ PXA_GPIO_TO_IRQ(PCM990_MMC0_IRQ_GPIO)
269#define PCM990_MMC0_IRQ_EDGE IRQ_TYPE_EDGE_FALLING 269#define PCM990_MMC0_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
270 270
271/* 271/*
diff --git a/arch/arm/mach-pxa/include/mach/poodle.h b/arch/arm/mach-pxa/include/mach/poodle.h
index 83d1cfd00fc9..f32ff75dcca8 100644
--- a/arch/arm/mach-pxa/include/mach/poodle.h
+++ b/arch/arm/mach-pxa/include/mach/poodle.h
@@ -47,18 +47,18 @@
47#define POODLE_GPIO_DISCHARGE_ON (42) /* Enable battery discharge */ 47#define POODLE_GPIO_DISCHARGE_ON (42) /* Enable battery discharge */
48 48
49/* PXA GPIOs */ 49/* PXA GPIOs */
50#define POODLE_IRQ_GPIO_ON_KEY IRQ_GPIO(0) 50#define POODLE_IRQ_GPIO_ON_KEY PXA_GPIO_TO_IRQ(0)
51#define POODLE_IRQ_GPIO_AC_IN IRQ_GPIO(1) 51#define POODLE_IRQ_GPIO_AC_IN PXA_GPIO_TO_IRQ(1)
52#define POODLE_IRQ_GPIO_HP_IN IRQ_GPIO(4) 52#define POODLE_IRQ_GPIO_HP_IN PXA_GPIO_TO_IRQ(4)
53#define POODLE_IRQ_GPIO_CO IRQ_GPIO(16) 53#define POODLE_IRQ_GPIO_CO PXA_GPIO_TO_IRQ(16)
54#define POODLE_IRQ_GPIO_TP_INT IRQ_GPIO(5) 54#define POODLE_IRQ_GPIO_TP_INT PXA_GPIO_TO_IRQ(5)
55#define POODLE_IRQ_GPIO_WAKEUP IRQ_GPIO(11) 55#define POODLE_IRQ_GPIO_WAKEUP PXA_GPIO_TO_IRQ(11)
56#define POODLE_IRQ_GPIO_GA_INT IRQ_GPIO(10) 56#define POODLE_IRQ_GPIO_GA_INT PXA_GPIO_TO_IRQ(10)
57#define POODLE_IRQ_GPIO_CF_IRQ IRQ_GPIO(17) 57#define POODLE_IRQ_GPIO_CF_IRQ PXA_GPIO_TO_IRQ(17)
58#define POODLE_IRQ_GPIO_CF_CD IRQ_GPIO(14) 58#define POODLE_IRQ_GPIO_CF_CD PXA_GPIO_TO_IRQ(14)
59#define POODLE_IRQ_GPIO_nSD_INT IRQ_GPIO(8) 59#define POODLE_IRQ_GPIO_nSD_INT PXA_GPIO_TO_IRQ(8)
60#define POODLE_IRQ_GPIO_nSD_DETECT IRQ_GPIO(9) 60#define POODLE_IRQ_GPIO_nSD_DETECT PXA_GPIO_TO_IRQ(9)
61#define POODLE_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(13) 61#define POODLE_IRQ_GPIO_MAIN_BAT_LOW PXA_GPIO_TO_IRQ(13)
62 62
63/* SCOOP GPIOs */ 63/* SCOOP GPIOs */
64#define POODLE_SCOOP_CHARGE_ON SCOOP_GPCR_PA11 64#define POODLE_SCOOP_CHARGE_ON SCOOP_GPCR_PA11
@@ -71,7 +71,7 @@
71#define POODLE_SCOOP_IO_DIR ( POODLE_SCOOP_VPEN | POODLE_SCOOP_HS_OUT ) 71#define POODLE_SCOOP_IO_DIR ( POODLE_SCOOP_VPEN | POODLE_SCOOP_HS_OUT )
72#define POODLE_SCOOP_IO_OUT ( 0 ) 72#define POODLE_SCOOP_IO_OUT ( 0 )
73 73
74#define POODLE_SCOOP_GPIO_BASE (NR_BUILTIN_GPIO) 74#define POODLE_SCOOP_GPIO_BASE (PXA_NR_BUILTIN_GPIO)
75#define POODLE_GPIO_CHARGE_ON (POODLE_SCOOP_GPIO_BASE + 0) 75#define POODLE_GPIO_CHARGE_ON (POODLE_SCOOP_GPIO_BASE + 0)
76#define POODLE_GPIO_CP401 (POODLE_SCOOP_GPIO_BASE + 2) 76#define POODLE_GPIO_CP401 (POODLE_SCOOP_GPIO_BASE + 2)
77#define POODLE_GPIO_VPEN (POODLE_SCOOP_GPIO_BASE + 7) 77#define POODLE_GPIO_VPEN (POODLE_SCOOP_GPIO_BASE + 7)
diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h
index 685749a51c42..0bfe6507c95d 100644
--- a/arch/arm/mach-pxa/include/mach/spitz.h
+++ b/arch/arm/mach-pxa/include/mach/spitz.h
@@ -108,7 +108,7 @@
108#define SPITZ_SCP_SUS_CLR (SPITZ_SCP_MUTE_L | SPITZ_SCP_MUTE_R | SPITZ_SCP_JK_A | SPITZ_SCP_ADC_TEMP_ON) 108#define SPITZ_SCP_SUS_CLR (SPITZ_SCP_MUTE_L | SPITZ_SCP_MUTE_R | SPITZ_SCP_JK_A | SPITZ_SCP_ADC_TEMP_ON)
109#define SPITZ_SCP_SUS_SET 0 109#define SPITZ_SCP_SUS_SET 0
110 110
111#define SPITZ_SCP_GPIO_BASE (NR_BUILTIN_GPIO) 111#define SPITZ_SCP_GPIO_BASE (PXA_NR_BUILTIN_GPIO)
112#define SPITZ_GPIO_LED_GREEN (SPITZ_SCP_GPIO_BASE + 0) 112#define SPITZ_GPIO_LED_GREEN (SPITZ_SCP_GPIO_BASE + 0)
113#define SPITZ_GPIO_JK_B (SPITZ_SCP_GPIO_BASE + 1) 113#define SPITZ_GPIO_JK_B (SPITZ_SCP_GPIO_BASE + 1)
114#define SPITZ_GPIO_CHRG_ON (SPITZ_SCP_GPIO_BASE + 2) 114#define SPITZ_GPIO_CHRG_ON (SPITZ_SCP_GPIO_BASE + 2)
@@ -140,7 +140,7 @@
140 SPITZ_SCP2_BACKLIGHT_CONT | SPITZ_SCP2_BACKLIGHT_ON | SPITZ_SCP2_MIC_BIAS) 140 SPITZ_SCP2_BACKLIGHT_CONT | SPITZ_SCP2_BACKLIGHT_ON | SPITZ_SCP2_MIC_BIAS)
141#define SPITZ_SCP2_SUS_SET (SPITZ_SCP2_IR_ON | SPITZ_SCP2_RESERVED_1) 141#define SPITZ_SCP2_SUS_SET (SPITZ_SCP2_IR_ON | SPITZ_SCP2_RESERVED_1)
142 142
143#define SPITZ_SCP2_GPIO_BASE (NR_BUILTIN_GPIO + 12) 143#define SPITZ_SCP2_GPIO_BASE (PXA_NR_BUILTIN_GPIO + 12)
144#define SPITZ_GPIO_IR_ON (SPITZ_SCP2_GPIO_BASE + 0) 144#define SPITZ_GPIO_IR_ON (SPITZ_SCP2_GPIO_BASE + 0)
145#define SPITZ_GPIO_AKIN_PULLUP (SPITZ_SCP2_GPIO_BASE + 1) 145#define SPITZ_GPIO_AKIN_PULLUP (SPITZ_SCP2_GPIO_BASE + 1)
146#define SPITZ_GPIO_RESERVED_1 (SPITZ_SCP2_GPIO_BASE + 2) 146#define SPITZ_GPIO_RESERVED_1 (SPITZ_SCP2_GPIO_BASE + 2)
@@ -152,7 +152,7 @@
152#define SPITZ_GPIO_MIC_BIAS (SPITZ_SCP2_GPIO_BASE + 8) 152#define SPITZ_GPIO_MIC_BIAS (SPITZ_SCP2_GPIO_BASE + 8)
153 153
154/* Akita IO Expander GPIOs */ 154/* Akita IO Expander GPIOs */
155#define AKITA_IOEXP_GPIO_BASE (NR_BUILTIN_GPIO + 12) 155#define AKITA_IOEXP_GPIO_BASE (PXA_NR_BUILTIN_GPIO + 12)
156#define AKITA_GPIO_RESERVED_0 (AKITA_IOEXP_GPIO_BASE + 0) 156#define AKITA_GPIO_RESERVED_0 (AKITA_IOEXP_GPIO_BASE + 0)
157#define AKITA_GPIO_RESERVED_1 (AKITA_IOEXP_GPIO_BASE + 1) 157#define AKITA_GPIO_RESERVED_1 (AKITA_IOEXP_GPIO_BASE + 1)
158#define AKITA_GPIO_MIC_BIAS (AKITA_IOEXP_GPIO_BASE + 2) 158#define AKITA_GPIO_MIC_BIAS (AKITA_IOEXP_GPIO_BASE + 2)
@@ -164,23 +164,23 @@
164 164
165/* Spitz IRQ Definitions */ 165/* Spitz IRQ Definitions */
166 166
167#define SPITZ_IRQ_GPIO_KEY_INT IRQ_GPIO(SPITZ_GPIO_KEY_INT) 167#define SPITZ_IRQ_GPIO_KEY_INT PXA_GPIO_TO_IRQ(SPITZ_GPIO_KEY_INT)
168#define SPITZ_IRQ_GPIO_AC_IN IRQ_GPIO(SPITZ_GPIO_AC_IN) 168#define SPITZ_IRQ_GPIO_AC_IN PXA_GPIO_TO_IRQ(SPITZ_GPIO_AC_IN)
169#define SPITZ_IRQ_GPIO_AK_INT IRQ_GPIO(SPITZ_GPIO_AK_INT) 169#define SPITZ_IRQ_GPIO_AK_INT PXA_GPIO_TO_IRQ(SPITZ_GPIO_AK_INT)
170#define SPITZ_IRQ_GPIO_HP_IN IRQ_GPIO(SPITZ_GPIO_HP_IN) 170#define SPITZ_IRQ_GPIO_HP_IN PXA_GPIO_TO_IRQ(SPITZ_GPIO_HP_IN)
171#define SPITZ_IRQ_GPIO_TP_INT IRQ_GPIO(SPITZ_GPIO_TP_INT) 171#define SPITZ_IRQ_GPIO_TP_INT PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT)
172#define SPITZ_IRQ_GPIO_SYNC IRQ_GPIO(SPITZ_GPIO_SYNC) 172#define SPITZ_IRQ_GPIO_SYNC PXA_GPIO_TO_IRQ(SPITZ_GPIO_SYNC)
173#define SPITZ_IRQ_GPIO_ON_KEY IRQ_GPIO(SPITZ_GPIO_ON_KEY) 173#define SPITZ_IRQ_GPIO_ON_KEY PXA_GPIO_TO_IRQ(SPITZ_GPIO_ON_KEY)
174#define SPITZ_IRQ_GPIO_SWA IRQ_GPIO(SPITZ_GPIO_SWA) 174#define SPITZ_IRQ_GPIO_SWA PXA_GPIO_TO_IRQ(SPITZ_GPIO_SWA)
175#define SPITZ_IRQ_GPIO_SWB IRQ_GPIO(SPITZ_GPIO_SWB) 175#define SPITZ_IRQ_GPIO_SWB PXA_GPIO_TO_IRQ(SPITZ_GPIO_SWB)
176#define SPITZ_IRQ_GPIO_BAT_COVER IRQ_GPIO(SPITZ_GPIO_BAT_COVER) 176#define SPITZ_IRQ_GPIO_BAT_COVER PXA_GPIO_TO_IRQ(SPITZ_GPIO_BAT_COVER)
177#define SPITZ_IRQ_GPIO_FATAL_BAT IRQ_GPIO(SPITZ_GPIO_FATAL_BAT) 177#define SPITZ_IRQ_GPIO_FATAL_BAT PXA_GPIO_TO_IRQ(SPITZ_GPIO_FATAL_BAT)
178#define SPITZ_IRQ_GPIO_CO IRQ_GPIO(SPITZ_GPIO_CO) 178#define SPITZ_IRQ_GPIO_CO PXA_GPIO_TO_IRQ(SPITZ_GPIO_CO)
179#define SPITZ_IRQ_GPIO_CF_IRQ IRQ_GPIO(SPITZ_GPIO_CF_IRQ) 179#define SPITZ_IRQ_GPIO_CF_IRQ PXA_GPIO_TO_IRQ(SPITZ_GPIO_CF_IRQ)
180#define SPITZ_IRQ_GPIO_CF_CD IRQ_GPIO(SPITZ_GPIO_CF_CD) 180#define SPITZ_IRQ_GPIO_CF_CD PXA_GPIO_TO_IRQ(SPITZ_GPIO_CF_CD)
181#define SPITZ_IRQ_GPIO_CF2_IRQ IRQ_GPIO(SPITZ_GPIO_CF2_IRQ) 181#define SPITZ_IRQ_GPIO_CF2_IRQ PXA_GPIO_TO_IRQ(SPITZ_GPIO_CF2_IRQ)
182#define SPITZ_IRQ_GPIO_nSD_INT IRQ_GPIO(SPITZ_GPIO_nSD_INT) 182#define SPITZ_IRQ_GPIO_nSD_INT PXA_GPIO_TO_IRQ(SPITZ_GPIO_nSD_INT)
183#define SPITZ_IRQ_GPIO_nSD_DETECT IRQ_GPIO(SPITZ_GPIO_nSD_DETECT) 183#define SPITZ_IRQ_GPIO_nSD_DETECT PXA_GPIO_TO_IRQ(SPITZ_GPIO_nSD_DETECT)
184 184
185/* 185/*
186 * Shared data structures 186 * Shared data structures
diff --git a/arch/arm/mach-pxa/include/mach/tosa.h b/arch/arm/mach-pxa/include/mach/tosa.h
index 1272c4b56ceb..2bb0e862598c 100644
--- a/arch/arm/mach-pxa/include/mach/tosa.h
+++ b/arch/arm/mach-pxa/include/mach/tosa.h
@@ -24,7 +24,7 @@
24/* 24/*
25 * SCOOP2 internal GPIOs 25 * SCOOP2 internal GPIOs
26 */ 26 */
27#define TOSA_SCOOP_GPIO_BASE NR_BUILTIN_GPIO 27#define TOSA_SCOOP_GPIO_BASE PXA_NR_BUILTIN_GPIO
28#define TOSA_SCOOP_PXA_VCORE1 SCOOP_GPCR_PA11 28#define TOSA_SCOOP_PXA_VCORE1 SCOOP_GPCR_PA11
29#define TOSA_GPIO_TC6393XB_REST_IN (TOSA_SCOOP_GPIO_BASE + 1) 29#define TOSA_GPIO_TC6393XB_REST_IN (TOSA_SCOOP_GPIO_BASE + 1)
30#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2) 30#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2)
@@ -42,7 +42,7 @@
42/* 42/*
43 * SCOOP2 jacket GPIOs 43 * SCOOP2 jacket GPIOs
44 */ 44 */
45#define TOSA_SCOOP_JC_GPIO_BASE (NR_BUILTIN_GPIO + 12) 45#define TOSA_SCOOP_JC_GPIO_BASE (PXA_NR_BUILTIN_GPIO + 12)
46#define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0) 46#define TOSA_GPIO_BT_LED (TOSA_SCOOP_JC_GPIO_BASE + 0)
47#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1) 47#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1)
48#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2) 48#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2)
@@ -59,7 +59,7 @@
59/* 59/*
60 * TC6393XB GPIOs 60 * TC6393XB GPIOs
61 */ 61 */
62#define TOSA_TC6393XB_GPIO_BASE (NR_BUILTIN_GPIO + 2 * 12) 62#define TOSA_TC6393XB_GPIO_BASE (PXA_NR_BUILTIN_GPIO + 2 * 12)
63 63
64#define TOSA_GPIO_TG_ON (TOSA_TC6393XB_GPIO_BASE + 0) 64#define TOSA_GPIO_TG_ON (TOSA_TC6393XB_GPIO_BASE + 0)
65#define TOSA_GPIO_L_MUTE (TOSA_TC6393XB_GPIO_BASE + 1) 65#define TOSA_GPIO_L_MUTE (TOSA_TC6393XB_GPIO_BASE + 1)
@@ -141,30 +141,30 @@
141/* 141/*
142 * Interrupts 142 * Interrupts
143 */ 143 */
144#define TOSA_IRQ_GPIO_WAKEUP IRQ_GPIO(TOSA_GPIO_WAKEUP) 144#define TOSA_IRQ_GPIO_WAKEUP PXA_GPIO_TO_IRQ(TOSA_GPIO_WAKEUP)
145#define TOSA_IRQ_GPIO_AC_IN IRQ_GPIO(TOSA_GPIO_AC_IN) 145#define TOSA_IRQ_GPIO_AC_IN PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN)
146#define TOSA_IRQ_GPIO_RECORD_BTN IRQ_GPIO(TOSA_GPIO_RECORD_BTN) 146#define TOSA_IRQ_GPIO_RECORD_BTN PXA_GPIO_TO_IRQ(TOSA_GPIO_RECORD_BTN)
147#define TOSA_IRQ_GPIO_SYNC IRQ_GPIO(TOSA_GPIO_SYNC) 147#define TOSA_IRQ_GPIO_SYNC PXA_GPIO_TO_IRQ(TOSA_GPIO_SYNC)
148#define TOSA_IRQ_GPIO_USB_IN IRQ_GPIO(TOSA_GPIO_USB_IN) 148#define TOSA_IRQ_GPIO_USB_IN PXA_GPIO_TO_IRQ(TOSA_GPIO_USB_IN)
149#define TOSA_IRQ_GPIO_JACKET_DETECT IRQ_GPIO(TOSA_GPIO_JACKET_DETECT) 149#define TOSA_IRQ_GPIO_JACKET_DETECT PXA_GPIO_TO_IRQ(TOSA_GPIO_JACKET_DETECT)
150#define TOSA_IRQ_GPIO_nSD_INT IRQ_GPIO(TOSA_GPIO_nSD_INT) 150#define TOSA_IRQ_GPIO_nSD_INT PXA_GPIO_TO_IRQ(TOSA_GPIO_nSD_INT)
151#define TOSA_IRQ_GPIO_nSD_DETECT IRQ_GPIO(TOSA_GPIO_nSD_DETECT) 151#define TOSA_IRQ_GPIO_nSD_DETECT PXA_GPIO_TO_IRQ(TOSA_GPIO_nSD_DETECT)
152#define TOSA_IRQ_GPIO_BAT1_CRG IRQ_GPIO(TOSA_GPIO_BAT1_CRG) 152#define TOSA_IRQ_GPIO_BAT1_CRG PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT1_CRG)
153#define TOSA_IRQ_GPIO_CF_CD IRQ_GPIO(TOSA_GPIO_CF_CD) 153#define TOSA_IRQ_GPIO_CF_CD PXA_GPIO_TO_IRQ(TOSA_GPIO_CF_CD)
154#define TOSA_IRQ_GPIO_BAT0_CRG IRQ_GPIO(TOSA_GPIO_BAT0_CRG) 154#define TOSA_IRQ_GPIO_BAT0_CRG PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT0_CRG)
155#define TOSA_IRQ_GPIO_TC6393XB_INT IRQ_GPIO(TOSA_GPIO_TC6393XB_INT) 155#define TOSA_IRQ_GPIO_TC6393XB_INT PXA_GPIO_TO_IRQ(TOSA_GPIO_TC6393XB_INT)
156#define TOSA_IRQ_GPIO_BAT0_LOW IRQ_GPIO(TOSA_GPIO_BAT0_LOW) 156#define TOSA_IRQ_GPIO_BAT0_LOW PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT0_LOW)
157#define TOSA_IRQ_GPIO_EAR_IN IRQ_GPIO(TOSA_GPIO_EAR_IN) 157#define TOSA_IRQ_GPIO_EAR_IN PXA_GPIO_TO_IRQ(TOSA_GPIO_EAR_IN)
158#define TOSA_IRQ_GPIO_CF_IRQ IRQ_GPIO(TOSA_GPIO_CF_IRQ) 158#define TOSA_IRQ_GPIO_CF_IRQ PXA_GPIO_TO_IRQ(TOSA_GPIO_CF_IRQ)
159#define TOSA_IRQ_GPIO_ON_KEY IRQ_GPIO(TOSA_GPIO_ON_KEY) 159#define TOSA_IRQ_GPIO_ON_KEY PXA_GPIO_TO_IRQ(TOSA_GPIO_ON_KEY)
160#define TOSA_IRQ_GPIO_VGA_LINE IRQ_GPIO(TOSA_GPIO_VGA_LINE) 160#define TOSA_IRQ_GPIO_VGA_LINE PXA_GPIO_TO_IRQ(TOSA_GPIO_VGA_LINE)
161#define TOSA_IRQ_GPIO_TP_INT IRQ_GPIO(TOSA_GPIO_TP_INT) 161#define TOSA_IRQ_GPIO_TP_INT PXA_GPIO_TO_IRQ(TOSA_GPIO_TP_INT)
162#define TOSA_IRQ_GPIO_JC_CF_IRQ IRQ_GPIO(TOSA_GPIO_JC_CF_IRQ) 162#define TOSA_IRQ_GPIO_JC_CF_IRQ PXA_GPIO_TO_IRQ(TOSA_GPIO_JC_CF_IRQ)
163#define TOSA_IRQ_GPIO_BAT_LOCKED IRQ_GPIO(TOSA_GPIO_BAT_LOCKED) 163#define TOSA_IRQ_GPIO_BAT_LOCKED PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT_LOCKED)
164#define TOSA_IRQ_GPIO_BAT1_LOW IRQ_GPIO(TOSA_GPIO_BAT1_LOW) 164#define TOSA_IRQ_GPIO_BAT1_LOW PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT1_LOW)
165#define TOSA_IRQ_GPIO_KEY_SENSE(a) IRQ_GPIO(69+(a)) 165#define TOSA_IRQ_GPIO_KEY_SENSE(a) PXA_GPIO_TO_IRQ(69+(a))
166 166
167#define TOSA_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(TOSA_GPIO_MAIN_BAT_LOW) 167#define TOSA_IRQ_GPIO_MAIN_BAT_LOW PXA_GPIO_TO_IRQ(TOSA_GPIO_MAIN_BAT_LOW)
168 168
169#define TOSA_KEY_SYNC KEY_102ND /* ??? */ 169#define TOSA_KEY_SYNC KEY_102ND /* ??? */
170 170
diff --git a/arch/arm/mach-pxa/include/mach/trizeps4.h b/arch/arm/mach-pxa/include/mach/trizeps4.h
index 903e1a2e6641..d2ca01053f69 100644
--- a/arch/arm/mach-pxa/include/mach/trizeps4.h
+++ b/arch/arm/mach-pxa/include/mach/trizeps4.h
@@ -43,30 +43,30 @@
43 43
44/* Ethernet Controller Davicom DM9000 */ 44/* Ethernet Controller Davicom DM9000 */
45#define GPIO_DM9000 101 45#define GPIO_DM9000 101
46#define TRIZEPS4_ETH_IRQ IRQ_GPIO(GPIO_DM9000) 46#define TRIZEPS4_ETH_IRQ PXA_GPIO_TO_IRQ(GPIO_DM9000)
47 47
48/* UCB1400 audio / TS-controller */ 48/* UCB1400 audio / TS-controller */
49#define GPIO_UCB1400 1 49#define GPIO_UCB1400 1
50#define TRIZEPS4_UCB1400_IRQ IRQ_GPIO(GPIO_UCB1400) 50#define TRIZEPS4_UCB1400_IRQ PXA_GPIO_TO_IRQ(GPIO_UCB1400)
51 51
52/* PCMCIA socket Compact Flash */ 52/* PCMCIA socket Compact Flash */
53#define GPIO_PCD 11 /* PCMCIA Card Detect */ 53#define GPIO_PCD 11 /* PCMCIA Card Detect */
54#define TRIZEPS4_CD_IRQ IRQ_GPIO(GPIO_PCD) 54#define TRIZEPS4_CD_IRQ PXA_GPIO_TO_IRQ(GPIO_PCD)
55#define GPIO_PRDY 13 /* READY / nINT */ 55#define GPIO_PRDY 13 /* READY / nINT */
56#define TRIZEPS4_READY_NINT IRQ_GPIO(GPIO_PRDY) 56#define TRIZEPS4_READY_NINT PXA_GPIO_TO_IRQ(GPIO_PRDY)
57 57
58/* MMC socket */ 58/* MMC socket */
59#define GPIO_MMC_DET 12 59#define GPIO_MMC_DET 12
60#define TRIZEPS4_MMC_IRQ IRQ_GPIO(GPIO_MMC_DET) 60#define TRIZEPS4_MMC_IRQ PXA_GPIO_TO_IRQ(GPIO_MMC_DET)
61 61
62/* DOC NAND chip */ 62/* DOC NAND chip */
63#define GPIO_DOC_LOCK 94 63#define GPIO_DOC_LOCK 94
64#define GPIO_DOC_IRQ 93 64#define GPIO_DOC_IRQ 93
65#define TRIZEPS4_DOC_IRQ IRQ_GPIO(GPIO_DOC_IRQ) 65#define TRIZEPS4_DOC_IRQ PXA_GPIO_TO_IRQ(GPIO_DOC_IRQ)
66 66
67/* SPI interface */ 67/* SPI interface */
68#define GPIO_SPI 53 68#define GPIO_SPI 53
69#define TRIZEPS4_SPI_IRQ IRQ_GPIO(GPIO_SPI) 69#define TRIZEPS4_SPI_IRQ PXA_GPIO_TO_IRQ(GPIO_SPI)
70 70
71/* LEDS using tx2 / rx2 */ 71/* LEDS using tx2 / rx2 */
72#define GPIO_SYS_BUSY_LED 46 72#define GPIO_SYS_BUSY_LED 46
@@ -74,7 +74,7 @@
74 74
75/* Off-module PIC on ConXS board */ 75/* Off-module PIC on ConXS board */
76#define GPIO_PIC 0 76#define GPIO_PIC 0
77#define TRIZEPS4_PIC_IRQ IRQ_GPIO(GPIO_PIC) 77#define TRIZEPS4_PIC_IRQ PXA_GPIO_TO_IRQ(GPIO_PIC)
78 78
79#ifdef CONFIG_MACH_TRIZEPS_CONXS 79#ifdef CONFIG_MACH_TRIZEPS_CONXS
80/* for CONXS base board define these registers */ 80/* for CONXS base board define these registers */
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 532c5d3a97d2..5dae15ea6718 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -22,7 +22,6 @@
22 22
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <mach/irqs.h> 24#include <mach/irqs.h>
25#include <mach/gpio-pxa.h>
26 25
27#include "generic.h" 26#include "generic.h"
28 27
@@ -92,44 +91,6 @@ static struct irq_chip pxa_internal_irq_chip = {
92 .irq_unmask = pxa_unmask_irq, 91 .irq_unmask = pxa_unmask_irq,
93}; 92};
94 93
95/*
96 * GPIO IRQs for GPIO 0 and 1
97 */
98static int pxa_set_low_gpio_type(struct irq_data *d, unsigned int type)
99{
100 int gpio = d->irq - IRQ_GPIO0;
101
102 if (__gpio_is_occupied(gpio)) {
103 pr_err("%s failed: GPIO is configured\n", __func__);
104 return -EINVAL;
105 }
106
107 if (type & IRQ_TYPE_EDGE_RISING)
108 GRER0 |= GPIO_bit(gpio);
109 else
110 GRER0 &= ~GPIO_bit(gpio);
111
112 if (type & IRQ_TYPE_EDGE_FALLING)
113 GFER0 |= GPIO_bit(gpio);
114 else
115 GFER0 &= ~GPIO_bit(gpio);
116
117 return 0;
118}
119
120static void pxa_ack_low_gpio(struct irq_data *d)
121{
122 GEDR0 = (1 << (d->irq - IRQ_GPIO0));
123}
124
125static struct irq_chip pxa_low_gpio_chip = {
126 .name = "GPIO-l",
127 .irq_ack = pxa_ack_low_gpio,
128 .irq_mask = pxa_mask_irq,
129 .irq_unmask = pxa_unmask_irq,
130 .irq_set_type = pxa_set_low_gpio_type,
131};
132
133asmlinkage void __exception_irq_entry icip_handle_irq(struct pt_regs *regs) 94asmlinkage void __exception_irq_entry icip_handle_irq(struct pt_regs *regs)
134{ 95{
135 uint32_t icip, icmr, mask; 96 uint32_t icip, icmr, mask;
@@ -160,26 +121,7 @@ asmlinkage void __exception_irq_entry ichp_handle_irq(struct pt_regs *regs)
160 } while (1); 121 } while (1);
161} 122}
162 123
163static void __init pxa_init_low_gpio_irq(set_wake_t fn) 124void __init pxa_init_irq(int irq_nr, int (*fn)(struct irq_data *, unsigned int))
164{
165 int irq;
166
167 /* clear edge detection on GPIO 0 and 1 */
168 GFER0 &= ~0x3;
169 GRER0 &= ~0x3;
170 GEDR0 = 0x3;
171
172 for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) {
173 irq_set_chip_and_handler(irq, &pxa_low_gpio_chip,
174 handle_edge_irq);
175 irq_set_chip_data(irq, irq_base(0));
176 set_irq_flags(irq, IRQF_VALID);
177 }
178
179 pxa_low_gpio_chip.irq_set_wake = fn;
180}
181
182void __init pxa_init_irq(int irq_nr, set_wake_t fn)
183{ 125{
184 int irq, i, n; 126 int irq, i, n;
185 127
@@ -209,7 +151,6 @@ void __init pxa_init_irq(int irq_nr, set_wake_t fn)
209 __raw_writel(1, irq_base(0) + ICCR); 151 __raw_writel(1, irq_base(0) + ICCR);
210 152
211 pxa_internal_irq_chip.irq_set_wake = fn; 153 pxa_internal_irq_chip.irq_set_wake = fn;
212 pxa_init_low_gpio_irq(fn);
213} 154}
214 155
215#ifdef CONFIG_PM 156#ifdef CONFIG_PM
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index 7b324ec6449f..d21e28b46d81 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -124,8 +124,8 @@ static struct resource smc91x_resources[] = {
124 .flags = IORESOURCE_MEM, 124 .flags = IORESOURCE_MEM,
125 }, 125 },
126 [1] = { 126 [1] = {
127 .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)), 127 .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
128 .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)), 128 .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
129 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, 129 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
130 } 130 }
131}; 131};
@@ -396,7 +396,7 @@ static struct i2c_board_info littleton_i2c_info[] = {
396 .type = "da9034", 396 .type = "da9034",
397 .addr = 0x34, 397 .addr = 0x34,
398 .platform_data = &littleton_da9034_info, 398 .platform_data = &littleton_da9034_info,
399 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)), 399 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO18)),
400 }, 400 },
401 [1] = { 401 [1] = {
402 .type = "max7320", 402 .type = "max7320",
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index 1dd530279e0b..565dd2f2eaa2 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -152,8 +152,8 @@ static void __init lpd270_init_irq(void)
152 handle_level_irq); 152 handle_level_irq);
153 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 153 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
154 } 154 }
155 irq_set_chained_handler(IRQ_GPIO(0), lpd270_irq_handler); 155 irq_set_chained_handler(PXA_GPIO_TO_IRQ(0), lpd270_irq_handler);
156 irq_set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING); 156 irq_set_irq_type(PXA_GPIO_TO_IRQ(0), IRQ_TYPE_EDGE_FALLING);
157} 157}
158 158
159 159
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index c48ce6da9184..2fb2b50831d1 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -170,8 +170,8 @@ static void __init lubbock_init_irq(void)
170 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 170 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
171 } 171 }
172 172
173 irq_set_chained_handler(IRQ_GPIO(0), lubbock_irq_handler); 173 irq_set_chained_handler(PXA_GPIO_TO_IRQ(0), lubbock_irq_handler);
174 irq_set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING); 174 irq_set_irq_type(PXA_GPIO_TO_IRQ(0), IRQ_TYPE_EDGE_FALLING);
175} 175}
176 176
177#ifdef CONFIG_PM 177#ifdef CONFIG_PM
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 4b796c37af3e..e340ea084248 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -184,8 +184,8 @@ static struct resource egpio_resources[] = {
184 .flags = IORESOURCE_MEM, 184 .flags = IORESOURCE_MEM,
185 }, 185 },
186 [1] = { 186 [1] = {
187 .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), 187 .start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
188 .end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), 188 .end = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
189 .flags = IORESOURCE_IRQ, 189 .flags = IORESOURCE_IRQ,
190 }, 190 },
191}; 191};
@@ -468,8 +468,8 @@ static struct resource pasic3_resources[] = {
468 }, 468 },
469 /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ 469 /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */
470 [1] = { 470 [1] = {
471 .start = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), 471 .start = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
472 .end = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), 472 .end = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
473 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 473 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
474 } 474 }
475}; 475};
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 0567d3965fda..ea62a990ae4b 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -178,8 +178,8 @@ static void __init mainstone_init_irq(void)
178 MST_INTMSKENA = 0; 178 MST_INTMSKENA = 0;
179 MST_INTSETCLR = 0; 179 MST_INTSETCLR = 0;
180 180
181 irq_set_chained_handler(IRQ_GPIO(0), mainstone_irq_handler); 181 irq_set_chained_handler(PXA_GPIO_TO_IRQ(0), mainstone_irq_handler);
182 irq_set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING); 182 irq_set_irq_type(PXA_GPIO_TO_IRQ(0), IRQ_TYPE_EDGE_FALLING);
183} 183}
184 184
185#ifdef CONFIG_PM 185#ifdef CONFIG_PM
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index 43a5f6861ca3..f14775536b83 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -13,6 +13,7 @@
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16#include <linux/gpio-pxa.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/init.h> 19#include <linux/init.h>
@@ -20,7 +21,6 @@
20 21
21#include <mach/pxa2xx-regs.h> 22#include <mach/pxa2xx-regs.h>
22#include <mach/mfp-pxa2xx.h> 23#include <mach/mfp-pxa2xx.h>
23#include <mach/gpio-pxa.h>
24 24
25#include "generic.h" 25#include "generic.h"
26 26
@@ -29,6 +29,10 @@
29#define GAFR_L(x) __GAFR(0, x) 29#define GAFR_L(x) __GAFR(0, x)
30#define GAFR_U(x) __GAFR(1, x) 30#define GAFR_U(x) __GAFR(1, x)
31 31
32#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
33#define GPLR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5))
34#define GPDR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x0c)
35
32#define PWER_WE35 (1 << 24) 36#define PWER_WE35 (1 << 24)
33 37
34struct gpio_desc { 38struct gpio_desc {
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index b938fc2c316a..23f90c74c191 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -541,15 +541,15 @@ static struct pda_power_pdata power_pdata = {
541static struct resource power_resources[] = { 541static struct resource power_resources[] = {
542 [0] = { 542 [0] = {
543 .name = "ac", 543 .name = "ac",
544 .start = gpio_to_irq(GPIO96_AC_DETECT), 544 .start = PXA_GPIO_TO_IRQ(GPIO96_AC_DETECT),
545 .end = gpio_to_irq(GPIO96_AC_DETECT), 545 .end = PXA_GPIO_TO_IRQ(GPIO96_AC_DETECT),
546 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | 546 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
547 IORESOURCE_IRQ_LOWEDGE, 547 IORESOURCE_IRQ_LOWEDGE,
548 }, 548 },
549 [1] = { 549 [1] = {
550 .name = "usb", 550 .name = "usb",
551 .start = gpio_to_irq(GPIO13_nUSB_DETECT), 551 .start = PXA_GPIO_TO_IRQ(GPIO13_nUSB_DETECT),
552 .end = gpio_to_irq(GPIO13_nUSB_DETECT), 552 .end = PXA_GPIO_TO_IRQ(GPIO13_nUSB_DETECT),
553 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | 553 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
554 IORESOURCE_IRQ_LOWEDGE, 554 IORESOURCE_IRQ_LOWEDGE,
555 }, 555 },
diff --git a/arch/arm/mach-pxa/mxm8x10.c b/arch/arm/mach-pxa/mxm8x10.c
index 90928d6e1a5b..83570a79e7d2 100644
--- a/arch/arm/mach-pxa/mxm8x10.c
+++ b/arch/arm/mach-pxa/mxm8x10.c
@@ -417,8 +417,8 @@ static struct resource dm9k_resources[] = {
417 .flags = IORESOURCE_MEM 417 .flags = IORESOURCE_MEM
418 }, 418 },
419 [2] = { 419 [2] = {
420 .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)), 420 .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
421 .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)), 421 .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
422 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE 422 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
423 } 423 }
424}; 424};
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 6d38c6548b3d..abab4e2b122c 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -378,7 +378,7 @@ struct pxacamera_platform_data pcm990_pxacamera_platform_data = {
378#include <linux/i2c/pca953x.h> 378#include <linux/i2c/pca953x.h>
379 379
380static struct pca953x_platform_data pca9536_data = { 380static struct pca953x_platform_data pca9536_data = {
381 .gpio_base = NR_BUILTIN_GPIO, 381 .gpio_base = PXA_NR_BUILTIN_GPIO,
382}; 382};
383 383
384static int gpio_bus_switch = -EINVAL; 384static int gpio_bus_switch = -EINVAL;
@@ -406,9 +406,9 @@ static unsigned long pcm990_camera_query_bus_param(struct soc_camera_link *link)
406 int ret; 406 int ret;
407 407
408 if (gpio_bus_switch < 0) { 408 if (gpio_bus_switch < 0) {
409 ret = gpio_request(NR_BUILTIN_GPIO, "camera"); 409 ret = gpio_request(PXA_NR_BUILTIN_GPIO, "camera");
410 if (!ret) { 410 if (!ret) {
411 gpio_bus_switch = NR_BUILTIN_GPIO; 411 gpio_bus_switch = PXA_NR_BUILTIN_GPIO;
412 gpio_direction_output(gpio_bus_switch, 0); 412 gpio_direction_output(gpio_bus_switch, 0);
413 } 413 }
414 } 414 }
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 50c833177866..8ee4b6cfa385 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -166,8 +166,8 @@ static struct resource locomo_resources[] = {
166 .flags = IORESOURCE_MEM, 166 .flags = IORESOURCE_MEM,
167 }, 167 },
168 [1] = { 168 [1] = {
169 .start = IRQ_GPIO(10), 169 .start = PXA_GPIO_TO_IRQ(10),
170 .end = IRQ_GPIO(10), 170 .end = PXA_GPIO_TO_IRQ(10),
171 .flags = IORESOURCE_IRQ, 171 .flags = IORESOURCE_IRQ,
172 }, 172 },
173}; 173};
@@ -212,7 +212,7 @@ static struct spi_board_info poodle_spi_devices[] = {
212 .bus_num = 1, 212 .bus_num = 1,
213 .platform_data = &poodle_ads7846_info, 213 .platform_data = &poodle_ads7846_info,
214 .controller_data= &poodle_ads7846_chip, 214 .controller_data= &poodle_ads7846_chip,
215 .irq = gpio_to_irq(POODLE_GPIO_TP_INT), 215 .irq = PXA_GPIO_TO_IRQ(POODLE_GPIO_TP_INT),
216 }, 216 },
217}; 217};
218 218
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index f05f9486b0cb..8a775f631c55 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -17,6 +17,7 @@
17 * need be. 17 * need be.
18 */ 18 */
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/gpio-pxa.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/init.h> 23#include <linux/init.h>
@@ -208,6 +209,7 @@ static struct clk_lookup pxa25x_clkregs[] = {
208 INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"), 209 INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"),
209 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), 210 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
210 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), 211 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL),
212 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL),
211}; 213};
212 214
213static struct clk_lookup pxa25x_hwuart_clkreg = 215static struct clk_lookup pxa25x_hwuart_clkreg =
@@ -287,7 +289,7 @@ static inline void pxa25x_init_pm(void) {}
287 289
288static int pxa25x_set_wake(struct irq_data *d, unsigned int on) 290static int pxa25x_set_wake(struct irq_data *d, unsigned int on)
289{ 291{
290 int gpio = irq_to_gpio(d->irq); 292 int gpio = pxa_irq_to_gpio(d->irq);
291 uint32_t mask = 0; 293 uint32_t mask = 0;
292 294
293 if (gpio >= 0 && gpio < 85) 295 if (gpio >= 0 && gpio < 85)
@@ -312,14 +314,12 @@ set_pwer:
312void __init pxa25x_init_irq(void) 314void __init pxa25x_init_irq(void)
313{ 315{
314 pxa_init_irq(32, pxa25x_set_wake); 316 pxa_init_irq(32, pxa25x_set_wake);
315 pxa_init_gpio(IRQ_GPIO_2_x, 2, 84, pxa25x_set_wake);
316} 317}
317 318
318#ifdef CONFIG_CPU_PXA26x 319#ifdef CONFIG_CPU_PXA26x
319void __init pxa26x_init_irq(void) 320void __init pxa26x_init_irq(void)
320{ 321{
321 pxa_init_irq(32, pxa25x_set_wake); 322 pxa_init_irq(32, pxa25x_set_wake);
322 pxa_init_gpio(IRQ_GPIO_2_x, 2, 89, pxa25x_set_wake);
323} 323}
324#endif 324#endif
325 325
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index bc5a98ebaa72..6c49e66057e3 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -12,6 +12,7 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/gpio-pxa.h>
15#include <linux/module.h> 16#include <linux/module.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/init.h> 18#include <linux/init.h>
@@ -229,6 +230,7 @@ static struct clk_lookup pxa27x_clkregs[] = {
229 INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"), 230 INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"),
230 INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"), 231 INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"),
231 INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL), 232 INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL),
233 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL),
232}; 234};
233 235
234#ifdef CONFIG_PM 236#ifdef CONFIG_PM
@@ -355,7 +357,7 @@ static inline void pxa27x_init_pm(void) {}
355 */ 357 */
356static int pxa27x_set_wake(struct irq_data *d, unsigned int on) 358static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
357{ 359{
358 int gpio = irq_to_gpio(d->irq); 360 int gpio = pxa_irq_to_gpio(d->irq);
359 uint32_t mask; 361 uint32_t mask;
360 362
361 if (gpio >= 0 && gpio < 128) 363 if (gpio >= 0 && gpio < 128)
@@ -386,7 +388,6 @@ static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
386void __init pxa27x_init_irq(void) 388void __init pxa27x_init_irq(void)
387{ 389{
388 pxa_init_irq(34, pxa27x_set_wake); 390 pxa_init_irq(34, pxa27x_set_wake);
389 pxa_init_gpio(IRQ_GPIO_2_x, 2, 120, pxa27x_set_wake);
390} 391}
391 392
392static struct map_desc pxa27x_io_desc[] __initdata = { 393static struct map_desc pxa27x_io_desc[] __initdata = {
@@ -422,6 +423,7 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
422} 423}
423 424
424static struct platform_device *devices[] __initdata = { 425static struct platform_device *devices[] __initdata = {
426 &pxa_device_gpio,
425 &pxa27x_device_udc, 427 &pxa27x_device_udc,
426 &pxa_device_pmu, 428 &pxa_device_pmu,
427 &pxa_device_i2s, 429 &pxa_device_i2s,
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 0737c59b88ae..4f402afa6609 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -25,7 +25,6 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/suspend.h> 26#include <asm/suspend.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/gpio-pxa.h>
29#include <mach/pxa3xx-regs.h> 28#include <mach/pxa3xx-regs.h>
30#include <mach/reset.h> 29#include <mach/reset.h>
31#include <mach/ohci.h> 30#include <mach/ohci.h>
@@ -56,6 +55,7 @@ static DEFINE_PXA3_CKEN(pxa3xx_pwm0, PWM0, 13000000, 0);
56static DEFINE_PXA3_CKEN(pxa3xx_pwm1, PWM1, 13000000, 0); 55static DEFINE_PXA3_CKEN(pxa3xx_pwm1, PWM1, 13000000, 0);
57static DEFINE_PXA3_CKEN(pxa3xx_mmc1, MMC1, 19500000, 0); 56static DEFINE_PXA3_CKEN(pxa3xx_mmc1, MMC1, 19500000, 0);
58static DEFINE_PXA3_CKEN(pxa3xx_mmc2, MMC2, 19500000, 0); 57static DEFINE_PXA3_CKEN(pxa3xx_mmc2, MMC2, 19500000, 0);
58static DEFINE_PXA3_CKEN(pxa3xx_gpio, GPIO, 13000000, 0);
59 59
60static DEFINE_CK(pxa3xx_lcd, LCD, &clk_pxa3xx_hsio_ops); 60static DEFINE_CK(pxa3xx_lcd, LCD, &clk_pxa3xx_hsio_ops);
61static DEFINE_CK(pxa3xx_smemc, SMC, &clk_pxa3xx_smemc_ops); 61static DEFINE_CK(pxa3xx_smemc, SMC, &clk_pxa3xx_smemc_ops);
@@ -88,6 +88,7 @@ static struct clk_lookup pxa3xx_clkregs[] = {
88 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL), 88 INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
89 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), 89 INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL),
90 INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), 90 INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL),
91 INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL),
91}; 92};
92 93
93#ifdef CONFIG_PM 94#ifdef CONFIG_PM
@@ -365,7 +366,8 @@ static struct irq_chip pxa_ext_wakeup_chip = {
365 .irq_set_type = pxa_set_ext_wakeup_type, 366 .irq_set_type = pxa_set_ext_wakeup_type,
366}; 367};
367 368
368static void __init pxa_init_ext_wakeup_irq(set_wake_t fn) 369static void __init pxa_init_ext_wakeup_irq(int (*fn)(struct irq_data *,
370 unsigned int))
369{ 371{
370 int irq; 372 int irq;
371 373
@@ -388,7 +390,6 @@ void __init pxa3xx_init_irq(void)
388 390
389 pxa_init_irq(56, pxa3xx_set_wake); 391 pxa_init_irq(56, pxa3xx_set_wake);
390 pxa_init_ext_wakeup_irq(pxa3xx_set_wake); 392 pxa_init_ext_wakeup_irq(pxa3xx_set_wake);
391 pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
392} 393}
393 394
394static struct map_desc pxa3xx_io_desc[] __initdata = { 395static struct map_desc pxa3xx_io_desc[] __initdata = {
@@ -417,6 +418,7 @@ void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info)
417} 418}
418 419
419static struct platform_device *devices[] __initdata = { 420static struct platform_device *devices[] __initdata = {
421 &pxa_device_gpio,
420 &pxa27x_device_udc, 422 &pxa27x_device_udc,
421 &pxa_device_pmu, 423 &pxa_device_pmu,
422 &pxa_device_i2s, 424 &pxa_device_i2s,
diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c
index 51371b39d2a3..d082a583df78 100644
--- a/arch/arm/mach-pxa/pxa95x.c
+++ b/arch/arm/mach-pxa/pxa95x.c
@@ -20,7 +20,6 @@
20#include <linux/syscore_ops.h> 20#include <linux/syscore_ops.h>
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/gpio-pxa.h>
24#include <mach/pxa3xx-regs.h> 23#include <mach/pxa3xx-regs.h>
25#include <mach/pxa930.h> 24#include <mach/pxa930.h>
26#include <mach/reset.h> 25#include <mach/reset.h>
@@ -212,6 +211,7 @@ static DEFINE_PXA3_CKEN(pxa95x_ssp3, SSP3, 13000000, 0);
212static DEFINE_PXA3_CKEN(pxa95x_ssp4, SSP4, 13000000, 0); 211static DEFINE_PXA3_CKEN(pxa95x_ssp4, SSP4, 13000000, 0);
213static DEFINE_PXA3_CKEN(pxa95x_pwm0, PWM0, 13000000, 0); 212static DEFINE_PXA3_CKEN(pxa95x_pwm0, PWM0, 13000000, 0);
214static DEFINE_PXA3_CKEN(pxa95x_pwm1, PWM1, 13000000, 0); 213static DEFINE_PXA3_CKEN(pxa95x_pwm1, PWM1, 13000000, 0);
214static DEFINE_PXA3_CKEN(pxa95x_gpio, GPIO, 13000000, 0);
215 215
216static struct clk_lookup pxa95x_clkregs[] = { 216static struct clk_lookup pxa95x_clkregs[] = {
217 INIT_CLKREG(&clk_pxa95x_pout, NULL, "CLK_POUT"), 217 INIT_CLKREG(&clk_pxa95x_pout, NULL, "CLK_POUT"),
@@ -230,12 +230,12 @@ static struct clk_lookup pxa95x_clkregs[] = {
230 INIT_CLKREG(&clk_pxa95x_ssp4, "pxa27x-ssp.3", NULL), 230 INIT_CLKREG(&clk_pxa95x_ssp4, "pxa27x-ssp.3", NULL),
231 INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL), 231 INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL),
232 INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL), 232 INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL),
233 INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL),
233}; 234};
234 235
235void __init pxa95x_init_irq(void) 236void __init pxa95x_init_irq(void)
236{ 237{
237 pxa_init_irq(96, NULL); 238 pxa_init_irq(96, NULL);
238 pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
239} 239}
240 240
241/* 241/*
@@ -248,6 +248,7 @@ void __init pxa95x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
248} 248}
249 249
250static struct platform_device *devices[] __initdata = { 250static struct platform_device *devices[] __initdata = {
251 &pxa_device_gpio,
251 &sa1100_device_rtc, 252 &sa1100_device_rtc,
252 &pxa_device_rtc, 253 &pxa_device_rtc,
253 &pxa27x_device_ssp1, 254 &pxa27x_device_ssp1,
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index f0c05f4d12ed..78d643783f99 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -292,8 +292,8 @@ static struct resource smc91x_resources[] = {
292 .flags = IORESOURCE_MEM, 292 .flags = IORESOURCE_MEM,
293 }, 293 },
294 { 294 {
295 .start = gpio_to_irq(GPIO_ETH_IRQ), 295 .start = PXA_GPIO_TO_IRQ(GPIO_ETH_IRQ),
296 .end = gpio_to_irq(GPIO_ETH_IRQ), 296 .end = PXA_GPIO_TO_IRQ(GPIO_ETH_IRQ),
297 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, 297 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
298 } 298 }
299}; 299};
@@ -672,7 +672,7 @@ static struct lis3lv02d_platform_data lis3_pdata = {
672 .chip_select = 1, \ 672 .chip_select = 1, \
673 .controller_data = (void *) GPIO_ACCEL_CS, \ 673 .controller_data = (void *) GPIO_ACCEL_CS, \
674 .platform_data = &lis3_pdata, \ 674 .platform_data = &lis3_pdata, \
675 .irq = gpio_to_irq(GPIO_ACCEL_IRQ), \ 675 .irq = PXA_GPIO_TO_IRQ(GPIO_ACCEL_IRQ), \
676} 676}
677 677
678#define SPI_DAC7512 \ 678#define SPI_DAC7512 \
@@ -956,7 +956,7 @@ static struct eeti_ts_platform_data eeti_ts_pdata = {
956static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = { 956static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = {
957 .type = "eeti_ts", 957 .type = "eeti_ts",
958 .addr = 0x0a, 958 .addr = 0x0a,
959 .irq = gpio_to_irq(GPIO_TOUCH_IRQ), 959 .irq = PXA_GPIO_TO_IRQ(GPIO_TOUCH_IRQ),
960 .platform_data = &eeti_ts_pdata, 960 .platform_data = &eeti_ts_pdata,
961}; 961};
962 962
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
index fc2c1e05af9c..423ec899a8a8 100644
--- a/arch/arm/mach-pxa/saar.c
+++ b/arch/arm/mach-pxa/saar.c
@@ -96,8 +96,8 @@ static struct resource smc91x_resources[] = {
96 .flags = IORESOURCE_MEM, 96 .flags = IORESOURCE_MEM,
97 }, 97 },
98 [1] = { 98 [1] = {
99 .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)), 99 .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO97)),
100 .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)), 100 .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO97)),
101 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 101 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
102 } 102 }
103}; 103};
@@ -502,7 +502,7 @@ static struct i2c_board_info saar_i2c_info[] = {
502 .type = "da9034", 502 .type = "da9034",
503 .addr = 0x34, 503 .addr = 0x34,
504 .platform_data = &saar_da9034_info, 504 .platform_data = &saar_da9034_info,
505 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)), 505 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
506 }, 506 },
507}; 507};
508 508
diff --git a/arch/arm/mach-pxa/saarb.c b/arch/arm/mach-pxa/saarb.c
index 3e999e308a2d..d1cdd6a081ed 100644
--- a/arch/arm/mach-pxa/saarb.c
+++ b/arch/arm/mach-pxa/saarb.c
@@ -92,7 +92,7 @@ static struct i2c_board_info saarb_i2c_info[] = {
92 .type = "88PM860x", 92 .type = "88PM860x",
93 .addr = 0x34, 93 .addr = 0x34,
94 .platform_data = &saarb_pm8607_info, 94 .platform_data = &saarb_pm8607_info,
95 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)), 95 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
96 }, 96 },
97}; 97};
98 98
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 785880f67b60..8d5168d253a9 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -907,24 +907,24 @@ static int __devinit sharpsl_pm_probe(struct platform_device *pdev)
907 gpio_direction_input(sharpsl_pm.machinfo->gpio_batlock); 907 gpio_direction_input(sharpsl_pm.machinfo->gpio_batlock);
908 908
909 /* Register interrupt handlers */ 909 /* Register interrupt handlers */
910 if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) { 910 if (request_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) {
911 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin)); 911 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_acin));
912 } 912 }
913 913
914 if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) { 914 if (request_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) {
915 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock)); 915 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batlock));
916 } 916 }
917 917
918 if (sharpsl_pm.machinfo->gpio_fatal) { 918 if (sharpsl_pm.machinfo->gpio_fatal) {
919 if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) { 919 if (request_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) {
920 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal)); 920 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_fatal));
921 } 921 }
922 } 922 }
923 923
924 if (sharpsl_pm.machinfo->batfull_irq) { 924 if (sharpsl_pm.machinfo->batfull_irq) {
925 /* Register interrupt handler. */ 925 /* Register interrupt handler. */
926 if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) { 926 if (request_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) {
927 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull)); 927 dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batfull));
928 } 928 }
929 } 929 }
930 930
@@ -953,14 +953,14 @@ static int sharpsl_pm_remove(struct platform_device *pdev)
953 953
954 led_trigger_unregister_simple(sharpsl_charge_led_trigger); 954 led_trigger_unregister_simple(sharpsl_charge_led_trigger);
955 955
956 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr); 956 free_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr);
957 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr); 957 free_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr);
958 958
959 if (sharpsl_pm.machinfo->gpio_fatal) 959 if (sharpsl_pm.machinfo->gpio_fatal)
960 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr); 960 free_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr);
961 961
962 if (sharpsl_pm.machinfo->batfull_irq) 962 if (sharpsl_pm.machinfo->batfull_irq)
963 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr); 963 free_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr);
964 964
965 gpio_free(sharpsl_pm.machinfo->gpio_batlock); 965 gpio_free(sharpsl_pm.machinfo->gpio_batlock);
966 gpio_free(sharpsl_pm.machinfo->gpio_batfull); 966 gpio_free(sharpsl_pm.machinfo->gpio_batfull);
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 953a9195f9e5..1b39cec03cce 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -552,7 +552,7 @@ static struct spi_board_info spitz_spi_devices[] = {
552 .chip_select = 0, 552 .chip_select = 0,
553 .platform_data = &spitz_ads7846_info, 553 .platform_data = &spitz_ads7846_info,
554 .controller_data = &spitz_ads7846_chip, 554 .controller_data = &spitz_ads7846_chip,
555 .irq = gpio_to_irq(SPITZ_GPIO_TP_INT), 555 .irq = PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT),
556 }, { 556 }, {
557 .modalias = "corgi-lcd", 557 .modalias = "corgi-lcd",
558 .max_speed_hz = 50000, 558 .max_speed_hz = 50000,
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 094279aefe9c..34cbdac51525 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/gpio-pxa.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/apm-emulation.h> 21#include <linux/apm-emulation.h>
@@ -41,6 +42,7 @@ static int spitz_last_ac_status;
41static struct gpio spitz_charger_gpios[] = { 42static struct gpio spitz_charger_gpios[] = {
42 { SPITZ_GPIO_KEY_INT, GPIOF_IN, "Keyboard Interrupt" }, 43 { SPITZ_GPIO_KEY_INT, GPIOF_IN, "Keyboard Interrupt" },
43 { SPITZ_GPIO_SYNC, GPIOF_IN, "Sync" }, 44 { SPITZ_GPIO_SYNC, GPIOF_IN, "Sync" },
45 { SPITZ_GPIO_AC_IN, GPIOF_IN, "Charger Detection" },
44 { SPITZ_GPIO_ADC_TEMP_ON, GPIOF_OUT_INIT_LOW, "ADC Temp On" }, 46 { SPITZ_GPIO_ADC_TEMP_ON, GPIOF_OUT_INIT_LOW, "ADC Temp On" },
45 { SPITZ_GPIO_JK_B, GPIOF_OUT_INIT_LOW, "JK B" }, 47 { SPITZ_GPIO_JK_B, GPIOF_OUT_INIT_LOW, "JK B" },
46 { SPITZ_GPIO_CHRG_ON, GPIOF_OUT_INIT_LOW, "Charger On" }, 48 { SPITZ_GPIO_CHRG_ON, GPIOF_OUT_INIT_LOW, "Charger On" },
@@ -169,14 +171,19 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)
169 171
170static unsigned long spitz_charger_wakeup(void) 172static unsigned long spitz_charger_wakeup(void)
171{ 173{
172 return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC)); 174 unsigned long ret;
175 ret = (!gpio_get_value(SPITZ_GPIO_KEY_INT)
176 << GPIO_bit(SPITZ_GPIO_KEY_INT))
177 | (!gpio_get_value(SPITZ_GPIO_SYNC)
178 << GPIO_bit(SPITZ_GPIO_SYNC));
179 return ret;
173} 180}
174 181
175unsigned long spitzpm_read_devdata(int type) 182unsigned long spitzpm_read_devdata(int type)
176{ 183{
177 switch (type) { 184 switch (type) {
178 case SHARPSL_STATUS_ACIN: 185 case SHARPSL_STATUS_ACIN:
179 return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0); 186 return !gpio_get_value(SPITZ_GPIO_AC_IN);
180 case SHARPSL_STATUS_LOCK: 187 case SHARPSL_STATUS_LOCK:
181 return gpio_get_value(sharpsl_pm.machinfo->gpio_batlock); 188 return gpio_get_value(sharpsl_pm.machinfo->gpio_batlock);
182 case SHARPSL_STATUS_CHRGFULL: 189 case SHARPSL_STATUS_CHRGFULL:
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
index 4c9a48bef569..940ca56b37f9 100644
--- a/arch/arm/mach-pxa/stargate2.c
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -376,7 +376,7 @@ static struct spi_board_info spi_board_info[] __initdata = {
376 .bus_num = 1, 376 .bus_num = 1,
377 .chip_select = 0, 377 .chip_select = 0,
378 .controller_data = &staccel_chip_info, 378 .controller_data = &staccel_chip_info,
379 .irq = IRQ_GPIO(96), 379 .irq = PXA_GPIO_TO_IRQ(96),
380 }, { 380 }, {
381 .modalias = "cc2420", 381 .modalias = "cc2420",
382 .max_speed_hz = 6500000, 382 .max_speed_hz = 6500000,
@@ -546,7 +546,7 @@ static struct i2c_board_info __initdata imote2_pwr_i2c_board_info[] = {
546 .type = "da9030", 546 .type = "da9030",
547 .addr = 0x49, 547 .addr = 0x49,
548 .platform_data = &imote2_da9030_pdata, 548 .platform_data = &imote2_da9030_pdata,
549 .irq = gpio_to_irq(1), 549 .irq = PXA_GPIO_TO_IRQ(1),
550 }, 550 },
551}; 551};
552 552
@@ -560,18 +560,18 @@ static struct i2c_board_info __initdata imote2_i2c_board_info[] = {
560 /* Through a nand gate - Also beware, on V2 sensor board the 560 /* Through a nand gate - Also beware, on V2 sensor board the
561 * pull up resistors are missing. 561 * pull up resistors are missing.
562 */ 562 */
563 .irq = IRQ_GPIO(99), 563 .irq = PXA_GPIO_TO_IRQ(99),
564 }, { /* ITS400 Sensor board only */ 564 }, { /* ITS400 Sensor board only */
565 .type = "tsl2561", 565 .type = "tsl2561",
566 .addr = 0x49, 566 .addr = 0x49,
567 /* Through a nand gate - Also beware, on V2 sensor board the 567 /* Through a nand gate - Also beware, on V2 sensor board the
568 * pull up resistors are missing. 568 * pull up resistors are missing.
569 */ 569 */
570 .irq = IRQ_GPIO(99), 570 .irq = PXA_GPIO_TO_IRQ(99),
571 }, { /* ITS400 Sensor board only */ 571 }, { /* ITS400 Sensor board only */
572 .type = "tmp175", 572 .type = "tmp175",
573 .addr = 0x4A, 573 .addr = 0x4A,
574 .irq = IRQ_GPIO(96), 574 .irq = PXA_GPIO_TO_IRQ(96),
575 }, { /* IMB400 Multimedia board */ 575 }, { /* IMB400 Multimedia board */
576 .type = "wm8940", 576 .type = "wm8940",
577 .addr = 0x1A, 577 .addr = 0x1A,
@@ -661,8 +661,8 @@ static struct resource smc91x_resources[] = {
661 .flags = IORESOURCE_MEM, 661 .flags = IORESOURCE_MEM,
662 }, 662 },
663 [1] = { 663 [1] = {
664 .start = IRQ_GPIO(40), 664 .start = PXA_GPIO_TO_IRQ(40),
665 .end = IRQ_GPIO(40), 665 .end = PXA_GPIO_TO_IRQ(40),
666 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 666 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
667 } 667 }
668}; 668};
@@ -707,7 +707,7 @@ static int stargate2_mci_init(struct device *dev,
707 } 707 }
708 gpio_direction_input(SG2_GPIO_nSD_DETECT); 708 gpio_direction_input(SG2_GPIO_nSD_DETECT);
709 709
710 err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), 710 err = request_irq(PXA_GPIO_TO_IRQ(SG2_GPIO_nSD_DETECT),
711 stargate2_detect_int, 711 stargate2_detect_int,
712 IRQ_TYPE_EDGE_BOTH, 712 IRQ_TYPE_EDGE_BOTH,
713 "MMC card detect", 713 "MMC card detect",
@@ -738,7 +738,7 @@ static void stargate2_mci_setpower(struct device *dev, unsigned int vdd)
738 738
739static void stargate2_mci_exit(struct device *dev, void *data) 739static void stargate2_mci_exit(struct device *dev, void *data)
740{ 740{
741 free_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), data); 741 free_irq(PXA_GPIO_TO_IRQ(SG2_GPIO_nSD_DETECT), data);
742 gpio_free(SG2_SD_POWER_ENABLE); 742 gpio_free(SG2_SD_POWER_ENABLE);
743 gpio_free(SG2_GPIO_nSD_DETECT); 743 gpio_free(SG2_GPIO_nSD_DETECT);
744} 744}
@@ -913,7 +913,7 @@ static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {
913 .type = "da9030", 913 .type = "da9030",
914 .addr = 0x49, 914 .addr = 0x49,
915 .platform_data = &stargate2_da9030_pdata, 915 .platform_data = &stargate2_da9030_pdata,
916 .irq = gpio_to_irq(1), 916 .irq = PXA_GPIO_TO_IRQ(1),
917 }, 917 },
918}; 918};
919 919
@@ -938,18 +938,18 @@ static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
938 /* Through a nand gate - Also beware, on V2 sensor board the 938 /* Through a nand gate - Also beware, on V2 sensor board the
939 * pull up resistors are missing. 939 * pull up resistors are missing.
940 */ 940 */
941 .irq = IRQ_GPIO(99), 941 .irq = PXA_GPIO_TO_IRQ(99),
942 }, { /* ITS400 Sensor board only */ 942 }, { /* ITS400 Sensor board only */
943 .type = "tsl2561", 943 .type = "tsl2561",
944 .addr = 0x49, 944 .addr = 0x49,
945 /* Through a nand gate - Also beware, on V2 sensor board the 945 /* Through a nand gate - Also beware, on V2 sensor board the
946 * pull up resistors are missing. 946 * pull up resistors are missing.
947 */ 947 */
948 .irq = IRQ_GPIO(99), 948 .irq = PXA_GPIO_TO_IRQ(99),
949 }, { /* ITS400 Sensor board only */ 949 }, { /* ITS400 Sensor board only */
950 .type = "tmp175", 950 .type = "tmp175",
951 .addr = 0x4A, 951 .addr = 0x4A,
952 .irq = IRQ_GPIO(96), 952 .irq = PXA_GPIO_TO_IRQ(96),
953 }, 953 },
954}; 954};
955 955
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
index ad47bb98f30d..43bdcb9761f2 100644
--- a/arch/arm/mach-pxa/tavorevb.c
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -85,8 +85,8 @@ static struct resource smc91x_resources[] = {
85 .flags = IORESOURCE_MEM, 85 .flags = IORESOURCE_MEM,
86 }, 86 },
87 [1] = { 87 [1] = {
88 .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)), 88 .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47)),
89 .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)), 89 .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47)),
90 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 90 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
91 } 91 }
92}; 92};
diff --git a/arch/arm/mach-pxa/tavorevb3.c b/arch/arm/mach-pxa/tavorevb3.c
index fd569167302a..46c60b3cbe79 100644
--- a/arch/arm/mach-pxa/tavorevb3.c
+++ b/arch/arm/mach-pxa/tavorevb3.c
@@ -101,7 +101,7 @@ static struct i2c_board_info evb3_i2c_info[] = {
101 .type = "88PM860x", 101 .type = "88PM860x",
102 .addr = 0x34, 102 .addr = 0x34,
103 .platform_data = &evb3_pm8607_info, 103 .platform_data = &evb3_pm8607_info,
104 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)), 104 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
105 }, 105 },
106}; 106};
107 107
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 402b0c96613b..1ddb9826448a 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -404,8 +404,8 @@ static struct pda_power_pdata tosa_power_data = {
404static struct resource tosa_power_resource[] = { 404static struct resource tosa_power_resource[] = {
405 { 405 {
406 .name = "ac", 406 .name = "ac",
407 .start = gpio_to_irq(TOSA_GPIO_AC_IN), 407 .start = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
408 .end = gpio_to_irq(TOSA_GPIO_AC_IN), 408 .end = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
409 .flags = IORESOURCE_IRQ | 409 .flags = IORESOURCE_IRQ |
410 IORESOURCE_IRQ_HIGHEDGE | 410 IORESOURCE_IRQ_HIGHEDGE |
411 IORESOURCE_IRQ_LOWEDGE, 411 IORESOURCE_IRQ_LOWEDGE,
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 242ddae332d3..d9a653a77176 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -422,8 +422,8 @@ static struct resource smc91x_resources[] = {
422 .flags = IORESOURCE_MEM, 422 .flags = IORESOURCE_MEM,
423 }, 423 },
424 [1] = { 424 [1] = {
425 .start = gpio_to_irq(VIPER_ETH_GPIO), 425 .start = PXA_GPIO_TO_IRQ(VIPER_ETH_GPIO),
426 .end = gpio_to_irq(VIPER_ETH_GPIO), 426 .end = PXA_GPIO_TO_IRQ(VIPER_ETH_GPIO),
427 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 427 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
428 }, 428 },
429 [2] = { 429 [2] = {
@@ -546,7 +546,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
546 /* External UARTs */ 546 /* External UARTs */
547 { 547 {
548 .mapbase = VIPER_UARTA_PHYS, 548 .mapbase = VIPER_UARTA_PHYS,
549 .irq = gpio_to_irq(VIPER_UARTA_GPIO), 549 .irq = PXA_GPIO_TO_IRQ(VIPER_UARTA_GPIO),
550 .irqflags = IRQF_TRIGGER_RISING, 550 .irqflags = IRQF_TRIGGER_RISING,
551 .uartclk = 1843200, 551 .uartclk = 1843200,
552 .regshift = 1, 552 .regshift = 1,
@@ -556,7 +556,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
556 }, 556 },
557 { 557 {
558 .mapbase = VIPER_UARTB_PHYS, 558 .mapbase = VIPER_UARTB_PHYS,
559 .irq = gpio_to_irq(VIPER_UARTB_GPIO), 559 .irq = PXA_GPIO_TO_IRQ(VIPER_UARTB_GPIO),
560 .irqflags = IRQF_TRIGGER_RISING, 560 .irqflags = IRQF_TRIGGER_RISING,
561 .uartclk = 1843200, 561 .uartclk = 1843200,
562 .regshift = 1, 562 .regshift = 1,
@@ -596,8 +596,8 @@ static struct resource isp116x_resources[] = {
596 .flags = IORESOURCE_MEM, 596 .flags = IORESOURCE_MEM,
597 }, 597 },
598 [2] = { 598 [2] = {
599 .start = gpio_to_irq(VIPER_USB_GPIO), 599 .start = PXA_GPIO_TO_IRQ(VIPER_USB_GPIO),
600 .end = gpio_to_irq(VIPER_USB_GPIO), 600 .end = PXA_GPIO_TO_IRQ(VIPER_USB_GPIO),
601 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 601 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
602 }, 602 },
603}; 603};
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c
index ca0c6615028c..9edeec65f6a3 100644
--- a/arch/arm/mach-pxa/vpac270.c
+++ b/arch/arm/mach-pxa/vpac270.c
@@ -395,8 +395,8 @@ static struct resource vpac270_dm9000_resources[] = {
395 .flags = IORESOURCE_MEM, 395 .flags = IORESOURCE_MEM,
396 }, 396 },
397 [2] = { 397 [2] = {
398 .start = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ), 398 .start = PXA_GPIO_TO_IRQ(GPIO114_VPAC270_ETH_IRQ),
399 .end = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ), 399 .end = PXA_GPIO_TO_IRQ(GPIO114_VPAC270_ETH_IRQ),
400 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 400 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
401 }, 401 },
402}; 402};
@@ -433,7 +433,7 @@ static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
433}; 433};
434 434
435static struct ucb1400_pdata vpac270_ucb1400_pdata = { 435static struct ucb1400_pdata vpac270_ucb1400_pdata = {
436 .irq = IRQ_GPIO(GPIO113_VPAC270_TS_IRQ), 436 .irq = PXA_GPIO_TO_IRQ(GPIO113_VPAC270_TS_IRQ),
437}; 437};
438 438
439static struct platform_device vpac270_ucb1400_device = { 439static struct platform_device vpac270_ucb1400_device = {
@@ -610,8 +610,8 @@ static struct resource vpac270_ide_resources[] = {
610 .flags = IORESOURCE_DMA 610 .flags = IORESOURCE_DMA
611 }, 611 },
612 [3] = { /* IDE IRQ pin */ 612 [3] = { /* IDE IRQ pin */
613 .start = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ), 613 .start = PXA_GPIO_TO_IRQ(GPIO36_VPAC270_IDE_IRQ),
614 .end = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ), 614 .end = PXA_GPIO_TO_IRQ(GPIO36_VPAC270_IDE_IRQ),
615 .flags = IORESOURCE_IRQ 615 .flags = IORESOURCE_IRQ
616 } 616 }
617}; 617};
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index ead32c90fec1..424661833ce2 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -573,7 +573,7 @@ static struct spi_board_info spi_board_info[] __initdata = {
573 .modalias = "libertas_spi", 573 .modalias = "libertas_spi",
574 .platform_data = &z2_lbs_pdata, 574 .platform_data = &z2_lbs_pdata,
575 .controller_data = &z2_lbs_chip_info, 575 .controller_data = &z2_lbs_chip_info,
576 .irq = gpio_to_irq(GPIO36_ZIPITZ2_WIFI_IRQ), 576 .irq = PXA_GPIO_TO_IRQ(GPIO36_ZIPITZ2_WIFI_IRQ),
577 .max_speed_hz = 13000000, 577 .max_speed_hz = 13000000,
578 .bus_num = 1, 578 .bus_num = 1,
579 .chip_select = 0, 579 .chip_select = 0,
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index 498b83b089f3..68de9c17e4c5 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -233,7 +233,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
233 /* FIXME: Shared IRQs on COM1-COM4 will not work properly on v1i1 hardware. */ 233 /* FIXME: Shared IRQs on COM1-COM4 will not work properly on v1i1 hardware. */
234 { /* COM1 */ 234 { /* COM1 */
235 .mapbase = 0x10000000, 235 .mapbase = 0x10000000,
236 .irq = gpio_to_irq(ZEUS_UARTA_GPIO), 236 .irq = PXA_GPIO_TO_IRQ(ZEUS_UARTA_GPIO),
237 .irqflags = IRQF_TRIGGER_RISING, 237 .irqflags = IRQF_TRIGGER_RISING,
238 .uartclk = 14745600, 238 .uartclk = 14745600,
239 .regshift = 1, 239 .regshift = 1,
@@ -242,7 +242,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
242 }, 242 },
243 { /* COM2 */ 243 { /* COM2 */
244 .mapbase = 0x10800000, 244 .mapbase = 0x10800000,
245 .irq = gpio_to_irq(ZEUS_UARTB_GPIO), 245 .irq = PXA_GPIO_TO_IRQ(ZEUS_UARTB_GPIO),
246 .irqflags = IRQF_TRIGGER_RISING, 246 .irqflags = IRQF_TRIGGER_RISING,
247 .uartclk = 14745600, 247 .uartclk = 14745600,
248 .regshift = 1, 248 .regshift = 1,
@@ -251,7 +251,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
251 }, 251 },
252 { /* COM3 */ 252 { /* COM3 */
253 .mapbase = 0x11000000, 253 .mapbase = 0x11000000,
254 .irq = gpio_to_irq(ZEUS_UARTC_GPIO), 254 .irq = PXA_GPIO_TO_IRQ(ZEUS_UARTC_GPIO),
255 .irqflags = IRQF_TRIGGER_RISING, 255 .irqflags = IRQF_TRIGGER_RISING,
256 .uartclk = 14745600, 256 .uartclk = 14745600,
257 .regshift = 1, 257 .regshift = 1,
@@ -260,7 +260,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
260 }, 260 },
261 { /* COM4 */ 261 { /* COM4 */
262 .mapbase = 0x11800000, 262 .mapbase = 0x11800000,
263 .irq = gpio_to_irq(ZEUS_UARTD_GPIO), 263 .irq = PXA_GPIO_TO_IRQ(ZEUS_UARTD_GPIO),
264 .irqflags = IRQF_TRIGGER_RISING, 264 .irqflags = IRQF_TRIGGER_RISING,
265 .uartclk = 14745600, 265 .uartclk = 14745600,
266 .regshift = 1, 266 .regshift = 1,
@@ -321,8 +321,8 @@ static struct resource zeus_dm9k0_resource[] = {
321 .flags = IORESOURCE_MEM 321 .flags = IORESOURCE_MEM
322 }, 322 },
323 [2] = { 323 [2] = {
324 .start = gpio_to_irq(ZEUS_ETH0_GPIO), 324 .start = PXA_GPIO_TO_IRQ(ZEUS_ETH0_GPIO),
325 .end = gpio_to_irq(ZEUS_ETH0_GPIO), 325 .end = PXA_GPIO_TO_IRQ(ZEUS_ETH0_GPIO),
326 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, 326 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
327 }, 327 },
328}; 328};
@@ -339,8 +339,8 @@ static struct resource zeus_dm9k1_resource[] = {
339 .flags = IORESOURCE_MEM, 339 .flags = IORESOURCE_MEM,
340 }, 340 },
341 [2] = { 341 [2] = {
342 .start = gpio_to_irq(ZEUS_ETH1_GPIO), 342 .start = PXA_GPIO_TO_IRQ(ZEUS_ETH1_GPIO),
343 .end = gpio_to_irq(ZEUS_ETH1_GPIO), 343 .end = PXA_GPIO_TO_IRQ(ZEUS_ETH1_GPIO),
344 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, 344 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
345 }, 345 },
346}; 346};
@@ -423,7 +423,7 @@ static struct spi_board_info zeus_spi_board_info[] = {
423 [0] = { 423 [0] = {
424 .modalias = "mcp2515", 424 .modalias = "mcp2515",
425 .platform_data = &zeus_mcp2515_pdata, 425 .platform_data = &zeus_mcp2515_pdata,
426 .irq = gpio_to_irq(ZEUS_CAN_GPIO), 426 .irq = PXA_GPIO_TO_IRQ(ZEUS_CAN_GPIO),
427 .max_speed_hz = 1*1000*1000, 427 .max_speed_hz = 1*1000*1000,
428 .bus_num = 3, 428 .bus_num = 3,
429 .mode = SPI_MODE_0, 429 .mode = SPI_MODE_0,
@@ -753,7 +753,7 @@ static struct i2c_board_info __initdata zeus_i2c_devices[] = {
753 { 753 {
754 I2C_BOARD_INFO("pca9535", 0x20), 754 I2C_BOARD_INFO("pca9535", 0x20),
755 .platform_data = &zeus_pca953x_pdata[2], 755 .platform_data = &zeus_pca953x_pdata[2],
756 .irq = gpio_to_irq(ZEUS_EXTGPIO_GPIO), 756 .irq = PXA_GPIO_TO_IRQ(ZEUS_EXTGPIO_GPIO),
757 }, 757 },
758 { I2C_BOARD_INFO("lm75a", 0x48) }, 758 { I2C_BOARD_INFO("lm75a", 0x48) },
759 { I2C_BOARD_INFO("24c01", 0x50) }, 759 { I2C_BOARD_INFO("24c01", 0x50) },
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 6c39c3328418..a4c807527095 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -408,8 +408,8 @@ static void __init zylonite_init(void)
408 * Note: We depend that the bootloader set 408 * Note: We depend that the bootloader set
409 * the correct value to MSC register for SMC91x. 409 * the correct value to MSC register for SMC91x.
410 */ 410 */
411 smc91x_resources[1].start = gpio_to_irq(gpio_eth_irq); 411 smc91x_resources[1].start = PXA_GPIO_TO_IRQ(gpio_eth_irq);
412 smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq); 412 smc91x_resources[1].end = PXA_GPIO_TO_IRQ(gpio_eth_irq);
413 platform_device_register(&smc91x_device); 413 platform_device_register(&smc91x_device);
414 414
415 pxa_set_ac97_info(NULL); 415 pxa_set_ac97_info(NULL);
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index 93c64d8d7de9..86e59c043de2 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -231,12 +231,12 @@ static struct i2c_board_info zylonite_i2c_board_info[] = {
231 .type = "pca9539", 231 .type = "pca9539",
232 .addr = 0x74, 232 .addr = 0x74,
233 .platform_data = &gpio_exp[0], 233 .platform_data = &gpio_exp[0],
234 .irq = IRQ_GPIO(18), 234 .irq = PXA_GPIO_TO_IRQ(18),
235 }, { 235 }, {
236 .type = "pca9539", 236 .type = "pca9539",
237 .addr = 0x75, 237 .addr = 0x75,
238 .platform_data = &gpio_exp[1], 238 .platform_data = &gpio_exp[1],
239 .irq = IRQ_GPIO(19), 239 .irq = PXA_GPIO_TO_IRQ(19),
240 }, 240 },
241}; 241};
242 242
diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index 30e10719b774..6e5d3a0cb9d5 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -357,7 +357,7 @@
357#define INT_35XX_EMAC_C0_TX_PULSE_IRQ 69 357#define INT_35XX_EMAC_C0_TX_PULSE_IRQ 69
358#define INT_35XX_EMAC_C0_MISC_PULSE_IRQ 70 358#define INT_35XX_EMAC_C0_MISC_PULSE_IRQ 70
359#define INT_35XX_USBOTG_IRQ 71 359#define INT_35XX_USBOTG_IRQ 71
360#define INT_35XX_UART4 84 360#define INT_35XX_UART4_IRQ 84
361#define INT_35XX_CCDC_VD0_IRQ 88 361#define INT_35XX_CCDC_VD0_IRQ 88
362#define INT_35XX_CCDC_VD1_IRQ 92 362#define INT_35XX_CCDC_VD1_IRQ 92
363#define INT_35XX_CCDC_VD2_IRQ 93 363#define INT_35XX_CCDC_VD2_IRQ 93
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index 94cf70afb236..f75946c3293d 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -96,6 +96,7 @@ struct omap_mmc_platform_data {
96 */ 96 */
97 u8 wires; /* Used for the MMC driver on omap1 and 2420 */ 97 u8 wires; /* Used for the MMC driver on omap1 and 2420 */
98 u32 caps; /* Used for the MMC driver on 2430 and later */ 98 u32 caps; /* Used for the MMC driver on 2430 and later */
99 u32 pm_caps; /* PM capabilities of the mmc */
99 100
100 /* 101 /*
101 * nomux means "standard" muxing is wrong on this board, and 102 * nomux means "standard" muxing is wrong on this board, and
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 1ab9fd6abe6d..865a2ba7ffa8 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -44,6 +44,7 @@
44#define OMAP3_UART2_BASE OMAP2_UART2_BASE 44#define OMAP3_UART2_BASE OMAP2_UART2_BASE
45#define OMAP3_UART3_BASE 0x49020000 45#define OMAP3_UART3_BASE 0x49020000
46#define OMAP3_UART4_BASE 0x49042000 /* Only on 36xx */ 46#define OMAP3_UART4_BASE 0x49042000 /* Only on 36xx */
47#define OMAP3_UART4_AM35XX_BASE 0x4809E000 /* Only on AM35xx */
47 48
48/* OMAP4 serial ports */ 49/* OMAP4 serial ports */
49#define OMAP4_UART1_BASE OMAP2_UART1_BASE 50#define OMAP4_UART1_BASE OMAP2_UART1_BASE
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index 17d3c939775c..2b66dc266bcf 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -100,9 +100,6 @@ extern void usb_musb_init(struct omap_musb_board_data *board_data);
100 100
101extern void usbhs_init(const struct usbhs_omap_board_data *pdata); 101extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
102 102
103extern int omap_usbhs_enable(struct device *dev);
104extern void omap_usbhs_disable(struct device *dev);
105
106extern int omap4430_phy_power(struct device *dev, int ID, int on); 103extern int omap4430_phy_power(struct device *dev, int ID, int on);
107extern int omap4430_phy_set_clk(struct device *dev, int on); 104extern int omap4430_phy_set_clk(struct device *dev, int on);
108extern int omap4430_phy_init(struct device *dev); 105extern int omap4430_phy_init(struct device *dev);
diff --git a/arch/arm/plat-pxa/include/plat/gpio-pxa.h b/arch/arm/plat-pxa/include/plat/gpio-pxa.h
deleted file mode 100644
index b6390beff323..000000000000
--- a/arch/arm/plat-pxa/include/plat/gpio-pxa.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef __PLAT_PXA_GPIO_H
2#define __PLAT_PXA_GPIO_H
3
4struct irq_data;
5
6/*
7 * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
8 * one set of registers. The register offsets are organized below:
9 *
10 * GPLR GPDR GPSR GPCR GRER GFER GEDR
11 * BANK 0 - 0x0000 0x000C 0x0018 0x0024 0x0030 0x003C 0x0048
12 * BANK 1 - 0x0004 0x0010 0x001C 0x0028 0x0034 0x0040 0x004C
13 * BANK 2 - 0x0008 0x0014 0x0020 0x002C 0x0038 0x0044 0x0050
14 *
15 * BANK 3 - 0x0100 0x010C 0x0118 0x0124 0x0130 0x013C 0x0148
16 * BANK 4 - 0x0104 0x0110 0x011C 0x0128 0x0134 0x0140 0x014C
17 * BANK 5 - 0x0108 0x0114 0x0120 0x012C 0x0138 0x0144 0x0150
18 *
19 * NOTE:
20 * BANK 3 is only available on PXA27x and later processors.
21 * BANK 4 and 5 are only available on PXA935
22 */
23
24#define GPIO_BANK(n) (GPIO_REGS_VIRT + BANK_OFF(n))
25
26#define GPLR_OFFSET 0x00
27#define GPDR_OFFSET 0x0C
28#define GPSR_OFFSET 0x18
29#define GPCR_OFFSET 0x24
30#define GRER_OFFSET 0x30
31#define GFER_OFFSET 0x3C
32#define GEDR_OFFSET 0x48
33
34/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
35 * Those cases currently cause holes in the GPIO number space, the
36 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
37 */
38extern int pxa_last_gpio;
39
40typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
41
42extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
43
44#endif /* __PLAT_PXA_GPIO_H */
diff --git a/arch/arm/plat-pxa/include/plat/gpio.h b/arch/arm/plat-pxa/include/plat/gpio.h
deleted file mode 100644
index 258f77210b02..000000000000
--- a/arch/arm/plat-pxa/include/plat/gpio.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef __PLAT_GPIO_H
2#define __PLAT_GPIO_H
3
4#define __ARM_GPIOLIB_COMPLEX
5
6/* The individual machine provides register offsets and NR_BUILTIN_GPIO */
7#include <mach/gpio-pxa.h>
8
9static inline int gpio_get_value(unsigned gpio)
10{
11 if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO))
12 return GPLR(gpio) & GPIO_bit(gpio);
13 else
14 return __gpio_get_value(gpio);
15}
16
17static inline void gpio_set_value(unsigned gpio, int value)
18{
19 if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) {
20 if (value)
21 GPSR(gpio) = GPIO_bit(gpio);
22 else
23 GPCR(gpio) = GPIO_bit(gpio);
24 } else
25 __gpio_set_value(gpio, value);
26}
27
28#define gpio_cansleep __gpio_cansleep
29
30#endif /* __PLAT_GPIO_H */
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 83b1e31696d9..4214ea0ff8fe 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -123,6 +123,7 @@ extern struct platform_device exynos4_device_dwmci;
123extern struct platform_device exynos4_device_i2s0; 123extern struct platform_device exynos4_device_i2s0;
124extern struct platform_device exynos4_device_i2s1; 124extern struct platform_device exynos4_device_i2s1;
125extern struct platform_device exynos4_device_i2s2; 125extern struct platform_device exynos4_device_i2s2;
126extern struct platform_device exynos4_device_ohci;
126extern struct platform_device exynos4_device_pcm0; 127extern struct platform_device exynos4_device_pcm0;
127extern struct platform_device exynos4_device_pcm1; 128extern struct platform_device exynos4_device_pcm1;
128extern struct platform_device exynos4_device_pcm2; 129extern struct platform_device exynos4_device_pcm2;
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 1f17bde52cd4..7c756fb189f7 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -109,7 +109,7 @@ struct eth_addr {
109 u8 addr[6]; 109 u8 addr[6];
110}; 110};
111static struct eth_addr __initdata hw_addr[2]; 111static struct eth_addr __initdata hw_addr[2];
112static struct eth_platform_data __initdata eth_data[2]; 112static struct macb_platform_data __initdata eth_data[2];
113 113
114static struct spi_board_info spi0_board_info[] __initdata = { 114static struct spi_board_info spi0_board_info[] __initdata = {
115 { 115 {
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 4643ff5107c9..c56ddac85d61 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -105,7 +105,7 @@ struct eth_addr {
105}; 105};
106 106
107static struct eth_addr __initdata hw_addr[2]; 107static struct eth_addr __initdata hw_addr[2];
108static struct eth_platform_data __initdata eth_data[2] = { 108static struct macb_platform_data __initdata eth_data[2] = {
109 { 109 {
110 /* 110 /*
111 * The MDIO pullups on STK1000 are a bit too weak for 111 * The MDIO pullups on STK1000 are a bit too weak for
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 86fab77a5a00..27bd6fbe21cb 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -50,7 +50,7 @@ struct eth_addr {
50 u8 addr[6]; 50 u8 addr[6];
51}; 51};
52static struct eth_addr __initdata hw_addr[1]; 52static struct eth_addr __initdata hw_addr[1];
53static struct eth_platform_data __initdata eth_data[1] = { 53static struct macb_platform_data __initdata eth_data[1] = {
54 { 54 {
55 .phy_mask = ~(1U << 1), 55 .phy_mask = ~(1U << 1),
56 }, 56 },
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
index da14fbdd4e8e..9d1efd1cd425 100644
--- a/arch/avr32/boards/hammerhead/setup.c
+++ b/arch/avr32/boards/hammerhead/setup.c
@@ -102,7 +102,7 @@ struct eth_addr {
102}; 102};
103 103
104static struct eth_addr __initdata hw_addr[1]; 104static struct eth_addr __initdata hw_addr[1];
105static struct eth_platform_data __initdata eth_data[1]; 105static struct macb_platform_data __initdata eth_data[1];
106 106
107/* 107/*
108 * The next two functions should go away as the boot loader is 108 * The next two functions should go away as the boot loader is
diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
index e61bc948f959..ed137e335796 100644
--- a/arch/avr32/boards/merisc/setup.c
+++ b/arch/avr32/boards/merisc/setup.c
@@ -52,7 +52,7 @@ struct eth_addr {
52}; 52};
53 53
54static struct eth_addr __initdata hw_addr[2]; 54static struct eth_addr __initdata hw_addr[2];
55static struct eth_platform_data __initdata eth_data[2]; 55static struct macb_platform_data __initdata eth_data[2];
56 56
57static int ads7846_get_pendown_state_PB26(void) 57static int ads7846_get_pendown_state_PB26(void)
58{ 58{
diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c
index c4da5cba2dbf..05358aa5ef7d 100644
--- a/arch/avr32/boards/mimc200/setup.c
+++ b/arch/avr32/boards/mimc200/setup.c
@@ -86,7 +86,7 @@ struct eth_addr {
86 u8 addr[6]; 86 u8 addr[6];
87}; 87};
88static struct eth_addr __initdata hw_addr[2]; 88static struct eth_addr __initdata hw_addr[2];
89static struct eth_platform_data __initdata eth_data[2]; 89static struct macb_platform_data __initdata eth_data[2];
90 90
91static struct spi_eeprom eeprom_25lc010 = { 91static struct spi_eeprom eeprom_25lc010 = {
92 .name = "25lc010", 92 .name = "25lc010",
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 7fbf0dcb9afe..402a7bb72669 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1067,7 +1067,7 @@ void __init at32_setup_serial_console(unsigned int usart_id)
1067 * -------------------------------------------------------------------- */ 1067 * -------------------------------------------------------------------- */
1068 1068
1069#ifdef CONFIG_CPU_AT32AP7000 1069#ifdef CONFIG_CPU_AT32AP7000
1070static struct eth_platform_data macb0_data; 1070static struct macb_platform_data macb0_data;
1071static struct resource macb0_resource[] = { 1071static struct resource macb0_resource[] = {
1072 PBMEM(0xfff01800), 1072 PBMEM(0xfff01800),
1073 IRQ(25), 1073 IRQ(25),
@@ -1076,7 +1076,7 @@ DEFINE_DEV_DATA(macb, 0);
1076DEV_CLK(hclk, macb0, hsb, 8); 1076DEV_CLK(hclk, macb0, hsb, 8);
1077DEV_CLK(pclk, macb0, pbb, 6); 1077DEV_CLK(pclk, macb0, pbb, 6);
1078 1078
1079static struct eth_platform_data macb1_data; 1079static struct macb_platform_data macb1_data;
1080static struct resource macb1_resource[] = { 1080static struct resource macb1_resource[] = {
1081 PBMEM(0xfff01c00), 1081 PBMEM(0xfff01c00),
1082 IRQ(26), 1082 IRQ(26),
@@ -1086,7 +1086,7 @@ DEV_CLK(hclk, macb1, hsb, 9);
1086DEV_CLK(pclk, macb1, pbb, 7); 1086DEV_CLK(pclk, macb1, pbb, 7);
1087 1087
1088struct platform_device *__init 1088struct platform_device *__init
1089at32_add_device_eth(unsigned int id, struct eth_platform_data *data) 1089at32_add_device_eth(unsigned int id, struct macb_platform_data *data)
1090{ 1090{
1091 struct platform_device *pdev; 1091 struct platform_device *pdev;
1092 u32 pin_mask; 1092 u32 pin_mask;
@@ -1163,7 +1163,7 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
1163 return NULL; 1163 return NULL;
1164 } 1164 }
1165 1165
1166 memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data)); 1166 memcpy(pdev->dev.platform_data, data, sizeof(struct macb_platform_data));
1167 platform_device_register(pdev); 1167 platform_device_register(pdev);
1168 1168
1169 return pdev; 1169 return pdev;
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index 5d7ffca7d69f..67b111ce332d 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/serial.h> 8#include <linux/serial.h>
9#include <linux/platform_data/macb.h>
9 10
10#define GPIO_PIN_NONE (-1) 11#define GPIO_PIN_NONE (-1)
11 12
@@ -42,12 +43,8 @@ struct atmel_uart_data {
42void at32_map_usart(unsigned int hw_id, unsigned int line, int flags); 43void at32_map_usart(unsigned int hw_id, unsigned int line, int flags);
43struct platform_device *at32_add_device_usart(unsigned int id); 44struct platform_device *at32_add_device_usart(unsigned int id);
44 45
45struct eth_platform_data {
46 u32 phy_mask;
47 u8 is_rmii;
48};
49struct platform_device * 46struct platform_device *
50at32_add_device_eth(unsigned int id, struct eth_platform_data *data); 47at32_add_device_eth(unsigned int id, struct macb_platform_data *data);
51 48
52struct spi_board_info; 49struct spi_board_info;
53struct platform_device * 50struct platform_device *
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 8482a23887dc..aa0b94ff36d0 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -141,6 +141,12 @@ config GPIO_PL061
141 help 141 help
142 Say yes here to support the PrimeCell PL061 GPIO device 142 Say yes here to support the PrimeCell PL061 GPIO device
143 143
144config GPIO_PXA
145 bool "PXA GPIO support"
146 depends on ARCH_PXA || ARCH_MMP
147 help
148 Say yes here to support the PXA GPIO device
149
144config GPIO_XILINX 150config GPIO_XILINX
145 bool "Xilinx GPIO support" 151 bool "Xilinx GPIO support"
146 depends on PPC_OF || MICROBLAZE 152 depends on PPC_OF || MICROBLAZE
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 4e018d6a7639..8ef9e9abe970 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -40,7 +40,7 @@ obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o
40obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o 40obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o
41obj-$(CONFIG_GPIO_PCH) += gpio-pch.o 41obj-$(CONFIG_GPIO_PCH) += gpio-pch.o
42obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o 42obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o
43obj-$(CONFIG_PLAT_PXA) += gpio-pxa.o 43obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
44obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o 44obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
45obj-$(CONFIG_PLAT_SAMSUNG) += gpio-samsung.o 45obj-$(CONFIG_PLAT_SAMSUNG) += gpio-samsung.o
46obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o 46obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index ee137712f9db..b2d3ee1d183a 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -11,14 +11,46 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/clk.h>
15#include <linux/err.h>
14#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/gpio-pxa.h>
15#include <linux/init.h> 18#include <linux/init.h>
16#include <linux/irq.h> 19#include <linux/irq.h>
17#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/platform_device.h>
18#include <linux/syscore_ops.h> 22#include <linux/syscore_ops.h>
19#include <linux/slab.h> 23#include <linux/slab.h>
20 24
21#include <mach/gpio-pxa.h> 25/*
26 * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
27 * one set of registers. The register offsets are organized below:
28 *
29 * GPLR GPDR GPSR GPCR GRER GFER GEDR
30 * BANK 0 - 0x0000 0x000C 0x0018 0x0024 0x0030 0x003C 0x0048
31 * BANK 1 - 0x0004 0x0010 0x001C 0x0028 0x0034 0x0040 0x004C
32 * BANK 2 - 0x0008 0x0014 0x0020 0x002C 0x0038 0x0044 0x0050
33 *
34 * BANK 3 - 0x0100 0x010C 0x0118 0x0124 0x0130 0x013C 0x0148
35 * BANK 4 - 0x0104 0x0110 0x011C 0x0128 0x0134 0x0140 0x014C
36 * BANK 5 - 0x0108 0x0114 0x0120 0x012C 0x0138 0x0144 0x0150
37 *
38 * NOTE:
39 * BANK 3 is only available on PXA27x and later processors.
40 * BANK 4 and 5 are only available on PXA935
41 */
42
43#define GPLR_OFFSET 0x00
44#define GPDR_OFFSET 0x0C
45#define GPSR_OFFSET 0x18
46#define GPCR_OFFSET 0x24
47#define GRER_OFFSET 0x30
48#define GFER_OFFSET 0x3C
49#define GEDR_OFFSET 0x48
50#define GAFR_OFFSET 0x54
51#define ED_MASK_OFFSET 0x9C /* GPIO edge detection for AP side */
52
53#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
22 54
23int pxa_last_gpio; 55int pxa_last_gpio;
24 56
@@ -39,8 +71,20 @@ struct pxa_gpio_chip {
39#endif 71#endif
40}; 72};
41 73
74enum {
75 PXA25X_GPIO = 0,
76 PXA26X_GPIO,
77 PXA27X_GPIO,
78 PXA3XX_GPIO,
79 PXA93X_GPIO,
80 MMP_GPIO = 0x10,
81 MMP2_GPIO,
82};
83
42static DEFINE_SPINLOCK(gpio_lock); 84static DEFINE_SPINLOCK(gpio_lock);
43static struct pxa_gpio_chip *pxa_gpio_chips; 85static struct pxa_gpio_chip *pxa_gpio_chips;
86static int gpio_type;
87static void __iomem *gpio_reg_base;
44 88
45#define for_each_gpio_chip(i, c) \ 89#define for_each_gpio_chip(i, c) \
46 for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++) 90 for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
@@ -55,6 +99,122 @@ static inline struct pxa_gpio_chip *gpio_to_pxachip(unsigned gpio)
55 return &pxa_gpio_chips[gpio_to_bank(gpio)]; 99 return &pxa_gpio_chips[gpio_to_bank(gpio)];
56} 100}
57 101
102static inline int gpio_is_pxa_type(int type)
103{
104 return (type & MMP_GPIO) == 0;
105}
106
107static inline int gpio_is_mmp_type(int type)
108{
109 return (type & MMP_GPIO) != 0;
110}
111
112/* GPIO86/87/88/89 on PXA26x have their direction bits in PXA_GPDR(2 inverted,
113 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
114 */
115static inline int __gpio_is_inverted(int gpio)
116{
117 if ((gpio_type == PXA26X_GPIO) && (gpio > 85))
118 return 1;
119 return 0;
120}
121
122/*
123 * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
124 * function of a GPIO, and GPDRx cannot be altered once configured. It
125 * is attributed as "occupied" here (I know this terminology isn't
126 * accurate, you are welcome to propose a better one :-)
127 */
128static inline int __gpio_is_occupied(unsigned gpio)
129{
130 struct pxa_gpio_chip *pxachip;
131 void __iomem *base;
132 unsigned long gafr = 0, gpdr = 0;
133 int ret, af = 0, dir = 0;
134
135 pxachip = gpio_to_pxachip(gpio);
136 base = gpio_chip_base(&pxachip->chip);
137 gpdr = readl_relaxed(base + GPDR_OFFSET);
138
139 switch (gpio_type) {
140 case PXA25X_GPIO:
141 case PXA26X_GPIO:
142 case PXA27X_GPIO:
143 gafr = readl_relaxed(base + GAFR_OFFSET);
144 af = (gafr >> ((gpio & 0xf) * 2)) & 0x3;
145 dir = gpdr & GPIO_bit(gpio);
146
147 if (__gpio_is_inverted(gpio))
148 ret = (af != 1) || (dir == 0);
149 else
150 ret = (af != 0) || (dir != 0);
151 break;
152 default:
153 ret = gpdr & GPIO_bit(gpio);
154 break;
155 }
156 return ret;
157}
158
159#ifdef CONFIG_ARCH_PXA
160static inline int __pxa_gpio_to_irq(int gpio)
161{
162 if (gpio_is_pxa_type(gpio_type))
163 return PXA_GPIO_TO_IRQ(gpio);
164 return -1;
165}
166
167static inline int __pxa_irq_to_gpio(int irq)
168{
169 if (gpio_is_pxa_type(gpio_type))
170 return irq - PXA_GPIO_TO_IRQ(0);
171 return -1;
172}
173#else
174static inline int __pxa_gpio_to_irq(int gpio) { return -1; }
175static inline int __pxa_irq_to_gpio(int irq) { return -1; }
176#endif
177
178#ifdef CONFIG_ARCH_MMP
179static inline int __mmp_gpio_to_irq(int gpio)
180{
181 if (gpio_is_mmp_type(gpio_type))
182 return MMP_GPIO_TO_IRQ(gpio);
183 return -1;
184}
185
186static inline int __mmp_irq_to_gpio(int irq)
187{
188 if (gpio_is_mmp_type(gpio_type))
189 return irq - MMP_GPIO_TO_IRQ(0);
190 return -1;
191}
192#else
193static inline int __mmp_gpio_to_irq(int gpio) { return -1; }
194static inline int __mmp_irq_to_gpio(int irq) { return -1; }
195#endif
196
197static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
198{
199 int gpio, ret;
200
201 gpio = chip->base + offset;
202 ret = __pxa_gpio_to_irq(gpio);
203 if (ret >= 0)
204 return ret;
205 return __mmp_gpio_to_irq(gpio);
206}
207
208int pxa_irq_to_gpio(int irq)
209{
210 int ret;
211
212 ret = __pxa_irq_to_gpio(irq);
213 if (ret >= 0)
214 return ret;
215 return __mmp_irq_to_gpio(irq);
216}
217
58static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 218static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
59{ 219{
60 void __iomem *base = gpio_chip_base(chip); 220 void __iomem *base = gpio_chip_base(chip);
@@ -63,12 +223,12 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
63 223
64 spin_lock_irqsave(&gpio_lock, flags); 224 spin_lock_irqsave(&gpio_lock, flags);
65 225
66 value = __raw_readl(base + GPDR_OFFSET); 226 value = readl_relaxed(base + GPDR_OFFSET);
67 if (__gpio_is_inverted(chip->base + offset)) 227 if (__gpio_is_inverted(chip->base + offset))
68 value |= mask; 228 value |= mask;
69 else 229 else
70 value &= ~mask; 230 value &= ~mask;
71 __raw_writel(value, base + GPDR_OFFSET); 231 writel_relaxed(value, base + GPDR_OFFSET);
72 232
73 spin_unlock_irqrestore(&gpio_lock, flags); 233 spin_unlock_irqrestore(&gpio_lock, flags);
74 return 0; 234 return 0;
@@ -81,16 +241,16 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
81 uint32_t tmp, mask = 1 << offset; 241 uint32_t tmp, mask = 1 << offset;
82 unsigned long flags; 242 unsigned long flags;
83 243
84 __raw_writel(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET)); 244 writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
85 245
86 spin_lock_irqsave(&gpio_lock, flags); 246 spin_lock_irqsave(&gpio_lock, flags);
87 247
88 tmp = __raw_readl(base + GPDR_OFFSET); 248 tmp = readl_relaxed(base + GPDR_OFFSET);
89 if (__gpio_is_inverted(chip->base + offset)) 249 if (__gpio_is_inverted(chip->base + offset))
90 tmp &= ~mask; 250 tmp &= ~mask;
91 else 251 else
92 tmp |= mask; 252 tmp |= mask;
93 __raw_writel(tmp, base + GPDR_OFFSET); 253 writel_relaxed(tmp, base + GPDR_OFFSET);
94 254
95 spin_unlock_irqrestore(&gpio_lock, flags); 255 spin_unlock_irqrestore(&gpio_lock, flags);
96 return 0; 256 return 0;
@@ -98,16 +258,16 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
98 258
99static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset) 259static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset)
100{ 260{
101 return __raw_readl(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset); 261 return readl_relaxed(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset);
102} 262}
103 263
104static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 264static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
105{ 265{
106 __raw_writel(1 << offset, gpio_chip_base(chip) + 266 writel_relaxed(1 << offset, gpio_chip_base(chip) +
107 (value ? GPSR_OFFSET : GPCR_OFFSET)); 267 (value ? GPSR_OFFSET : GPCR_OFFSET));
108} 268}
109 269
110static int __init pxa_init_gpio_chip(int gpio_end) 270static int __devinit pxa_init_gpio_chip(int gpio_end)
111{ 271{
112 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; 272 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
113 struct pxa_gpio_chip *chips; 273 struct pxa_gpio_chip *chips;
@@ -122,7 +282,7 @@ static int __init pxa_init_gpio_chip(int gpio_end)
122 struct gpio_chip *c = &chips[i].chip; 282 struct gpio_chip *c = &chips[i].chip;
123 283
124 sprintf(chips[i].label, "gpio-%d", i); 284 sprintf(chips[i].label, "gpio-%d", i);
125 chips[i].regbase = GPIO_BANK(i); 285 chips[i].regbase = gpio_reg_base + BANK_OFF(i);
126 286
127 c->base = gpio; 287 c->base = gpio;
128 c->label = chips[i].label; 288 c->label = chips[i].label;
@@ -131,6 +291,7 @@ static int __init pxa_init_gpio_chip(int gpio_end)
131 c->direction_output = pxa_gpio_direction_output; 291 c->direction_output = pxa_gpio_direction_output;
132 c->get = pxa_gpio_get; 292 c->get = pxa_gpio_get;
133 c->set = pxa_gpio_set; 293 c->set = pxa_gpio_set;
294 c->to_irq = pxa_gpio_to_irq;
134 295
135 /* number of GPIOs on last bank may be less than 32 */ 296 /* number of GPIOs on last bank may be less than 32 */
136 c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32; 297 c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32;
@@ -147,18 +308,18 @@ static inline void update_edge_detect(struct pxa_gpio_chip *c)
147{ 308{
148 uint32_t grer, gfer; 309 uint32_t grer, gfer;
149 310
150 grer = __raw_readl(c->regbase + GRER_OFFSET) & ~c->irq_mask; 311 grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~c->irq_mask;
151 gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~c->irq_mask; 312 gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~c->irq_mask;
152 grer |= c->irq_edge_rise & c->irq_mask; 313 grer |= c->irq_edge_rise & c->irq_mask;
153 gfer |= c->irq_edge_fall & c->irq_mask; 314 gfer |= c->irq_edge_fall & c->irq_mask;
154 __raw_writel(grer, c->regbase + GRER_OFFSET); 315 writel_relaxed(grer, c->regbase + GRER_OFFSET);
155 __raw_writel(gfer, c->regbase + GFER_OFFSET); 316 writel_relaxed(gfer, c->regbase + GFER_OFFSET);
156} 317}
157 318
158static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type) 319static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
159{ 320{
160 struct pxa_gpio_chip *c; 321 struct pxa_gpio_chip *c;
161 int gpio = irq_to_gpio(d->irq); 322 int gpio = pxa_irq_to_gpio(d->irq);
162 unsigned long gpdr, mask = GPIO_bit(gpio); 323 unsigned long gpdr, mask = GPIO_bit(gpio);
163 324
164 c = gpio_to_pxachip(gpio); 325 c = gpio_to_pxachip(gpio);
@@ -176,12 +337,12 @@ static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
176 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; 337 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
177 } 338 }
178 339
179 gpdr = __raw_readl(c->regbase + GPDR_OFFSET); 340 gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
180 341
181 if (__gpio_is_inverted(gpio)) 342 if (__gpio_is_inverted(gpio))
182 __raw_writel(gpdr | mask, c->regbase + GPDR_OFFSET); 343 writel_relaxed(gpdr | mask, c->regbase + GPDR_OFFSET);
183 else 344 else
184 __raw_writel(gpdr & ~mask, c->regbase + GPDR_OFFSET); 345 writel_relaxed(gpdr & ~mask, c->regbase + GPDR_OFFSET);
185 346
186 if (type & IRQ_TYPE_EDGE_RISING) 347 if (type & IRQ_TYPE_EDGE_RISING)
187 c->irq_edge_rise |= mask; 348 c->irq_edge_rise |= mask;
@@ -212,9 +373,9 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
212 for_each_gpio_chip(gpio, c) { 373 for_each_gpio_chip(gpio, c) {
213 gpio_base = c->chip.base; 374 gpio_base = c->chip.base;
214 375
215 gedr = __raw_readl(c->regbase + GEDR_OFFSET); 376 gedr = readl_relaxed(c->regbase + GEDR_OFFSET);
216 gedr = gedr & c->irq_mask; 377 gedr = gedr & c->irq_mask;
217 __raw_writel(gedr, c->regbase + GEDR_OFFSET); 378 writel_relaxed(gedr, c->regbase + GEDR_OFFSET);
218 379
219 n = find_first_bit(&gedr, BITS_PER_LONG); 380 n = find_first_bit(&gedr, BITS_PER_LONG);
220 while (n < BITS_PER_LONG) { 381 while (n < BITS_PER_LONG) {
@@ -229,29 +390,29 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
229 390
230static void pxa_ack_muxed_gpio(struct irq_data *d) 391static void pxa_ack_muxed_gpio(struct irq_data *d)
231{ 392{
232 int gpio = irq_to_gpio(d->irq); 393 int gpio = pxa_irq_to_gpio(d->irq);
233 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); 394 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
234 395
235 __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET); 396 writel_relaxed(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
236} 397}
237 398
238static void pxa_mask_muxed_gpio(struct irq_data *d) 399static void pxa_mask_muxed_gpio(struct irq_data *d)
239{ 400{
240 int gpio = irq_to_gpio(d->irq); 401 int gpio = pxa_irq_to_gpio(d->irq);
241 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); 402 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
242 uint32_t grer, gfer; 403 uint32_t grer, gfer;
243 404
244 c->irq_mask &= ~GPIO_bit(gpio); 405 c->irq_mask &= ~GPIO_bit(gpio);
245 406
246 grer = __raw_readl(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio); 407 grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio);
247 gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio); 408 gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio);
248 __raw_writel(grer, c->regbase + GRER_OFFSET); 409 writel_relaxed(grer, c->regbase + GRER_OFFSET);
249 __raw_writel(gfer, c->regbase + GFER_OFFSET); 410 writel_relaxed(gfer, c->regbase + GFER_OFFSET);
250} 411}
251 412
252static void pxa_unmask_muxed_gpio(struct irq_data *d) 413static void pxa_unmask_muxed_gpio(struct irq_data *d)
253{ 414{
254 int gpio = irq_to_gpio(d->irq); 415 int gpio = pxa_irq_to_gpio(d->irq);
255 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); 416 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
256 417
257 c->irq_mask |= GPIO_bit(gpio); 418 c->irq_mask |= GPIO_bit(gpio);
@@ -266,34 +427,143 @@ static struct irq_chip pxa_muxed_gpio_chip = {
266 .irq_set_type = pxa_gpio_irq_type, 427 .irq_set_type = pxa_gpio_irq_type,
267}; 428};
268 429
269void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn) 430static int pxa_gpio_nums(void)
270{ 431{
271 struct pxa_gpio_chip *c; 432 int count = 0;
272 int gpio, irq; 433
434#ifdef CONFIG_ARCH_PXA
435 if (cpu_is_pxa25x()) {
436#ifdef CONFIG_CPU_PXA26x
437 count = 89;
438 gpio_type = PXA26X_GPIO;
439#elif defined(CONFIG_PXA25x)
440 count = 84;
441 gpio_type = PXA26X_GPIO;
442#endif /* CONFIG_CPU_PXA26x */
443 } else if (cpu_is_pxa27x()) {
444 count = 120;
445 gpio_type = PXA27X_GPIO;
446 } else if (cpu_is_pxa93x() || cpu_is_pxa95x()) {
447 count = 191;
448 gpio_type = PXA93X_GPIO;
449 } else if (cpu_is_pxa3xx()) {
450 count = 127;
451 gpio_type = PXA3XX_GPIO;
452 }
453#endif /* CONFIG_ARCH_PXA */
454
455#ifdef CONFIG_ARCH_MMP
456 if (cpu_is_pxa168() || cpu_is_pxa910()) {
457 count = 127;
458 gpio_type = MMP_GPIO;
459 } else if (cpu_is_mmp2()) {
460 count = 191;
461 gpio_type = MMP2_GPIO;
462 }
463#endif /* CONFIG_ARCH_MMP */
464 return count;
465}
273 466
274 pxa_last_gpio = end; 467static int __devinit pxa_gpio_probe(struct platform_device *pdev)
468{
469 struct pxa_gpio_chip *c;
470 struct resource *res;
471 struct clk *clk;
472 int gpio, irq, ret;
473 int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
474
475 pxa_last_gpio = pxa_gpio_nums();
476 if (!pxa_last_gpio)
477 return -EINVAL;
478
479 irq0 = platform_get_irq_byname(pdev, "gpio0");
480 irq1 = platform_get_irq_byname(pdev, "gpio1");
481 irq_mux = platform_get_irq_byname(pdev, "gpio_mux");
482 if ((irq0 > 0 && irq1 <= 0) || (irq0 <= 0 && irq1 > 0)
483 || (irq_mux <= 0))
484 return -EINVAL;
485 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
486 if (!res)
487 return -EINVAL;
488 gpio_reg_base = ioremap(res->start, resource_size(res));
489 if (!gpio_reg_base)
490 return -EINVAL;
491
492 if (irq0 > 0)
493 gpio_offset = 2;
494
495 clk = clk_get(&pdev->dev, NULL);
496 if (IS_ERR(clk)) {
497 dev_err(&pdev->dev, "Error %ld to get gpio clock\n",
498 PTR_ERR(clk));
499 iounmap(gpio_reg_base);
500 return PTR_ERR(clk);
501 }
502 ret = clk_prepare(clk);
503 if (ret) {
504 clk_put(clk);
505 iounmap(gpio_reg_base);
506 return ret;
507 }
508 ret = clk_enable(clk);
509 if (ret) {
510 clk_unprepare(clk);
511 clk_put(clk);
512 iounmap(gpio_reg_base);
513 return ret;
514 }
275 515
276 /* Initialize GPIO chips */ 516 /* Initialize GPIO chips */
277 pxa_init_gpio_chip(end); 517 pxa_init_gpio_chip(pxa_last_gpio);
278 518
279 /* clear all GPIO edge detects */ 519 /* clear all GPIO edge detects */
280 for_each_gpio_chip(gpio, c) { 520 for_each_gpio_chip(gpio, c) {
281 __raw_writel(0, c->regbase + GFER_OFFSET); 521 writel_relaxed(0, c->regbase + GFER_OFFSET);
282 __raw_writel(0, c->regbase + GRER_OFFSET); 522 writel_relaxed(0, c->regbase + GRER_OFFSET);
283 __raw_writel(~0,c->regbase + GEDR_OFFSET); 523 writel_relaxed(~0,c->regbase + GEDR_OFFSET);
524 /* unmask GPIO edge detect for AP side */
525 if (gpio_is_mmp_type(gpio_type))
526 writel_relaxed(~0, c->regbase + ED_MASK_OFFSET);
284 } 527 }
285 528
286 for (irq = gpio_to_irq(start); irq <= gpio_to_irq(end); irq++) { 529#ifdef CONFIG_ARCH_PXA
530 irq = gpio_to_irq(0);
531 irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
532 handle_edge_irq);
533 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
534 irq_set_chained_handler(IRQ_GPIO0, pxa_gpio_demux_handler);
535
536 irq = gpio_to_irq(1);
537 irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
538 handle_edge_irq);
539 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
540 irq_set_chained_handler(IRQ_GPIO1, pxa_gpio_demux_handler);
541#endif
542
543 for (irq = gpio_to_irq(gpio_offset);
544 irq <= gpio_to_irq(pxa_last_gpio); irq++) {
287 irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip, 545 irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
288 handle_edge_irq); 546 handle_edge_irq);
289 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 547 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
290 } 548 }
291 549
292 /* Install handler for GPIO>=2 edge detect interrupts */ 550 irq_set_chained_handler(irq_mux, pxa_gpio_demux_handler);
293 irq_set_chained_handler(mux_irq, pxa_gpio_demux_handler); 551 return 0;
294 pxa_muxed_gpio_chip.irq_set_wake = fn;
295} 552}
296 553
554static struct platform_driver pxa_gpio_driver = {
555 .probe = pxa_gpio_probe,
556 .driver = {
557 .name = "pxa-gpio",
558 },
559};
560
561static int __init pxa_gpio_init(void)
562{
563 return platform_driver_register(&pxa_gpio_driver);
564}
565postcore_initcall(pxa_gpio_init);
566
297#ifdef CONFIG_PM 567#ifdef CONFIG_PM
298static int pxa_gpio_suspend(void) 568static int pxa_gpio_suspend(void)
299{ 569{
@@ -301,13 +571,13 @@ static int pxa_gpio_suspend(void)
301 int gpio; 571 int gpio;
302 572
303 for_each_gpio_chip(gpio, c) { 573 for_each_gpio_chip(gpio, c) {
304 c->saved_gplr = __raw_readl(c->regbase + GPLR_OFFSET); 574 c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET);
305 c->saved_gpdr = __raw_readl(c->regbase + GPDR_OFFSET); 575 c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
306 c->saved_grer = __raw_readl(c->regbase + GRER_OFFSET); 576 c->saved_grer = readl_relaxed(c->regbase + GRER_OFFSET);
307 c->saved_gfer = __raw_readl(c->regbase + GFER_OFFSET); 577 c->saved_gfer = readl_relaxed(c->regbase + GFER_OFFSET);
308 578
309 /* Clear GPIO transition detect bits */ 579 /* Clear GPIO transition detect bits */
310 __raw_writel(0xffffffff, c->regbase + GEDR_OFFSET); 580 writel_relaxed(0xffffffff, c->regbase + GEDR_OFFSET);
311 } 581 }
312 return 0; 582 return 0;
313} 583}
@@ -319,12 +589,12 @@ static void pxa_gpio_resume(void)
319 589
320 for_each_gpio_chip(gpio, c) { 590 for_each_gpio_chip(gpio, c) {
321 /* restore level with set/clear */ 591 /* restore level with set/clear */
322 __raw_writel( c->saved_gplr, c->regbase + GPSR_OFFSET); 592 writel_relaxed( c->saved_gplr, c->regbase + GPSR_OFFSET);
323 __raw_writel(~c->saved_gplr, c->regbase + GPCR_OFFSET); 593 writel_relaxed(~c->saved_gplr, c->regbase + GPCR_OFFSET);
324 594
325 __raw_writel(c->saved_grer, c->regbase + GRER_OFFSET); 595 writel_relaxed(c->saved_grer, c->regbase + GRER_OFFSET);
326 __raw_writel(c->saved_gfer, c->regbase + GFER_OFFSET); 596 writel_relaxed(c->saved_gfer, c->regbase + GFER_OFFSET);
327 __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET); 597 writel_relaxed(c->saved_gpdr, c->regbase + GPDR_OFFSET);
328 } 598 }
329} 599}
330#else 600#else
@@ -336,3 +606,10 @@ struct syscore_ops pxa_gpio_syscore_ops = {
336 .suspend = pxa_gpio_suspend, 606 .suspend = pxa_gpio_suspend,
337 .resume = pxa_gpio_resume, 607 .resume = pxa_gpio_resume,
338}; 608};
609
610static int __init pxa_gpio_sysinit(void)
611{
612 register_syscore_ops(&pxa_gpio_syscore_ops);
613 return 0;
614}
615postcore_initcall(pxa_gpio_sysinit);
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 46b6500c5478..6381604696d3 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -558,7 +558,7 @@ static const struct i2c_algorithm tegra_i2c_algo = {
558 .functionality = tegra_i2c_func, 558 .functionality = tegra_i2c_func,
559}; 559};
560 560
561static int tegra_i2c_probe(struct platform_device *pdev) 561static int __devinit tegra_i2c_probe(struct platform_device *pdev)
562{ 562{
563 struct tegra_i2c_dev *i2c_dev; 563 struct tegra_i2c_dev *i2c_dev;
564 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data; 564 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
@@ -636,7 +636,10 @@ static int tegra_i2c_probe(struct platform_device *pdev)
636 i2c_dev->bus_clk_rate = be32_to_cpup(prop); 636 i2c_dev->bus_clk_rate = be32_to_cpup(prop);
637 } 637 }
638 638
639 if (pdev->id == 3) 639 if (pdev->dev.of_node)
640 i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
641 "nvidia,tegra20-i2c-dvc");
642 else if (pdev->id == 3)
640 i2c_dev->is_dvc = 1; 643 i2c_dev->is_dvc = 1;
641 init_completion(&i2c_dev->msg_complete); 644 init_completion(&i2c_dev->msg_complete);
642 645
@@ -690,7 +693,7 @@ err_iounmap:
690 return ret; 693 return ret;
691} 694}
692 695
693static int tegra_i2c_remove(struct platform_device *pdev) 696static int __devexit tegra_i2c_remove(struct platform_device *pdev)
694{ 697{
695 struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 698 struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
696 i2c_del_adapter(&i2c_dev->adapter); 699 i2c_del_adapter(&i2c_dev->adapter);
@@ -742,6 +745,7 @@ static int tegra_i2c_resume(struct platform_device *pdev)
742/* Match table for of_platform binding */ 745/* Match table for of_platform binding */
743static const struct of_device_id tegra_i2c_of_match[] __devinitconst = { 746static const struct of_device_id tegra_i2c_of_match[] __devinitconst = {
744 { .compatible = "nvidia,tegra20-i2c", }, 747 { .compatible = "nvidia,tegra20-i2c", },
748 { .compatible = "nvidia,tegra20-i2c-dvc", },
745 {}, 749 {},
746}; 750};
747MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); 751MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 86e14583a082..3f565ef3e149 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -27,8 +27,9 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <plat/usb.h> 29#include <plat/usb.h>
30#include <linux/pm_runtime.h>
30 31
31#define USBHS_DRIVER_NAME "usbhs-omap" 32#define USBHS_DRIVER_NAME "usbhs_omap"
32#define OMAP_EHCI_DEVICE "ehci-omap" 33#define OMAP_EHCI_DEVICE "ehci-omap"
33#define OMAP_OHCI_DEVICE "ohci-omap3" 34#define OMAP_OHCI_DEVICE "ohci-omap3"
34 35
@@ -147,9 +148,6 @@
147 148
148 149
149struct usbhs_hcd_omap { 150struct usbhs_hcd_omap {
150 struct clk *usbhost_ick;
151 struct clk *usbhost_hs_fck;
152 struct clk *usbhost_fs_fck;
153 struct clk *xclk60mhsp1_ck; 151 struct clk *xclk60mhsp1_ck;
154 struct clk *xclk60mhsp2_ck; 152 struct clk *xclk60mhsp2_ck;
155 struct clk *utmi_p1_fck; 153 struct clk *utmi_p1_fck;
@@ -159,8 +157,7 @@ struct usbhs_hcd_omap {
159 struct clk *usbhost_p2_fck; 157 struct clk *usbhost_p2_fck;
160 struct clk *usbtll_p2_fck; 158 struct clk *usbtll_p2_fck;
161 struct clk *init_60m_fclk; 159 struct clk *init_60m_fclk;
162 struct clk *usbtll_fck; 160 struct clk *ehci_logic_fck;
163 struct clk *usbtll_ick;
164 161
165 void __iomem *uhh_base; 162 void __iomem *uhh_base;
166 void __iomem *tll_base; 163 void __iomem *tll_base;
@@ -169,7 +166,6 @@ struct usbhs_hcd_omap {
169 166
170 u32 usbhs_rev; 167 u32 usbhs_rev;
171 spinlock_t lock; 168 spinlock_t lock;
172 int count;
173}; 169};
174/*-------------------------------------------------------------------------*/ 170/*-------------------------------------------------------------------------*/
175 171
@@ -319,269 +315,6 @@ err_end:
319 return ret; 315 return ret;
320} 316}
321 317
322/**
323 * usbhs_omap_probe - initialize TI-based HCDs
324 *
325 * Allocates basic resources for this USB host controller.
326 */
327static int __devinit usbhs_omap_probe(struct platform_device *pdev)
328{
329 struct device *dev = &pdev->dev;
330 struct usbhs_omap_platform_data *pdata = dev->platform_data;
331 struct usbhs_hcd_omap *omap;
332 struct resource *res;
333 int ret = 0;
334 int i;
335
336 if (!pdata) {
337 dev_err(dev, "Missing platform data\n");
338 ret = -ENOMEM;
339 goto end_probe;
340 }
341
342 omap = kzalloc(sizeof(*omap), GFP_KERNEL);
343 if (!omap) {
344 dev_err(dev, "Memory allocation failed\n");
345 ret = -ENOMEM;
346 goto end_probe;
347 }
348
349 spin_lock_init(&omap->lock);
350
351 for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
352 omap->platdata.port_mode[i] = pdata->port_mode[i];
353
354 omap->platdata.ehci_data = pdata->ehci_data;
355 omap->platdata.ohci_data = pdata->ohci_data;
356
357 omap->usbhost_ick = clk_get(dev, "usbhost_ick");
358 if (IS_ERR(omap->usbhost_ick)) {
359 ret = PTR_ERR(omap->usbhost_ick);
360 dev_err(dev, "usbhost_ick failed error:%d\n", ret);
361 goto err_end;
362 }
363
364 omap->usbhost_hs_fck = clk_get(dev, "hs_fck");
365 if (IS_ERR(omap->usbhost_hs_fck)) {
366 ret = PTR_ERR(omap->usbhost_hs_fck);
367 dev_err(dev, "usbhost_hs_fck failed error:%d\n", ret);
368 goto err_usbhost_ick;
369 }
370
371 omap->usbhost_fs_fck = clk_get(dev, "fs_fck");
372 if (IS_ERR(omap->usbhost_fs_fck)) {
373 ret = PTR_ERR(omap->usbhost_fs_fck);
374 dev_err(dev, "usbhost_fs_fck failed error:%d\n", ret);
375 goto err_usbhost_hs_fck;
376 }
377
378 omap->usbtll_fck = clk_get(dev, "usbtll_fck");
379 if (IS_ERR(omap->usbtll_fck)) {
380 ret = PTR_ERR(omap->usbtll_fck);
381 dev_err(dev, "usbtll_fck failed error:%d\n", ret);
382 goto err_usbhost_fs_fck;
383 }
384
385 omap->usbtll_ick = clk_get(dev, "usbtll_ick");
386 if (IS_ERR(omap->usbtll_ick)) {
387 ret = PTR_ERR(omap->usbtll_ick);
388 dev_err(dev, "usbtll_ick failed error:%d\n", ret);
389 goto err_usbtll_fck;
390 }
391
392 omap->utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
393 if (IS_ERR(omap->utmi_p1_fck)) {
394 ret = PTR_ERR(omap->utmi_p1_fck);
395 dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
396 goto err_usbtll_ick;
397 }
398
399 omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
400 if (IS_ERR(omap->xclk60mhsp1_ck)) {
401 ret = PTR_ERR(omap->xclk60mhsp1_ck);
402 dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
403 goto err_utmi_p1_fck;
404 }
405
406 omap->utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk");
407 if (IS_ERR(omap->utmi_p2_fck)) {
408 ret = PTR_ERR(omap->utmi_p2_fck);
409 dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
410 goto err_xclk60mhsp1_ck;
411 }
412
413 omap->xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck");
414 if (IS_ERR(omap->xclk60mhsp2_ck)) {
415 ret = PTR_ERR(omap->xclk60mhsp2_ck);
416 dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
417 goto err_utmi_p2_fck;
418 }
419
420 omap->usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk");
421 if (IS_ERR(omap->usbhost_p1_fck)) {
422 ret = PTR_ERR(omap->usbhost_p1_fck);
423 dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret);
424 goto err_xclk60mhsp2_ck;
425 }
426
427 omap->usbtll_p1_fck = clk_get(dev, "usb_tll_hs_usb_ch0_clk");
428 if (IS_ERR(omap->usbtll_p1_fck)) {
429 ret = PTR_ERR(omap->usbtll_p1_fck);
430 dev_err(dev, "usbtll_p1_fck failed error:%d\n", ret);
431 goto err_usbhost_p1_fck;
432 }
433
434 omap->usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk");
435 if (IS_ERR(omap->usbhost_p2_fck)) {
436 ret = PTR_ERR(omap->usbhost_p2_fck);
437 dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret);
438 goto err_usbtll_p1_fck;
439 }
440
441 omap->usbtll_p2_fck = clk_get(dev, "usb_tll_hs_usb_ch1_clk");
442 if (IS_ERR(omap->usbtll_p2_fck)) {
443 ret = PTR_ERR(omap->usbtll_p2_fck);
444 dev_err(dev, "usbtll_p2_fck failed error:%d\n", ret);
445 goto err_usbhost_p2_fck;
446 }
447
448 omap->init_60m_fclk = clk_get(dev, "init_60m_fclk");
449 if (IS_ERR(omap->init_60m_fclk)) {
450 ret = PTR_ERR(omap->init_60m_fclk);
451 dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
452 goto err_usbtll_p2_fck;
453 }
454
455 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
456 if (!res) {
457 dev_err(dev, "UHH EHCI get resource failed\n");
458 ret = -ENODEV;
459 goto err_init_60m_fclk;
460 }
461
462 omap->uhh_base = ioremap(res->start, resource_size(res));
463 if (!omap->uhh_base) {
464 dev_err(dev, "UHH ioremap failed\n");
465 ret = -ENOMEM;
466 goto err_init_60m_fclk;
467 }
468
469 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
470 if (!res) {
471 dev_err(dev, "UHH EHCI get resource failed\n");
472 ret = -ENODEV;
473 goto err_tll;
474 }
475
476 omap->tll_base = ioremap(res->start, resource_size(res));
477 if (!omap->tll_base) {
478 dev_err(dev, "TLL ioremap failed\n");
479 ret = -ENOMEM;
480 goto err_tll;
481 }
482
483 platform_set_drvdata(pdev, omap);
484
485 ret = omap_usbhs_alloc_children(pdev);
486 if (ret) {
487 dev_err(dev, "omap_usbhs_alloc_children failed\n");
488 goto err_alloc;
489 }
490
491 goto end_probe;
492
493err_alloc:
494 iounmap(omap->tll_base);
495
496err_tll:
497 iounmap(omap->uhh_base);
498
499err_init_60m_fclk:
500 clk_put(omap->init_60m_fclk);
501
502err_usbtll_p2_fck:
503 clk_put(omap->usbtll_p2_fck);
504
505err_usbhost_p2_fck:
506 clk_put(omap->usbhost_p2_fck);
507
508err_usbtll_p1_fck:
509 clk_put(omap->usbtll_p1_fck);
510
511err_usbhost_p1_fck:
512 clk_put(omap->usbhost_p1_fck);
513
514err_xclk60mhsp2_ck:
515 clk_put(omap->xclk60mhsp2_ck);
516
517err_utmi_p2_fck:
518 clk_put(omap->utmi_p2_fck);
519
520err_xclk60mhsp1_ck:
521 clk_put(omap->xclk60mhsp1_ck);
522
523err_utmi_p1_fck:
524 clk_put(omap->utmi_p1_fck);
525
526err_usbtll_ick:
527 clk_put(omap->usbtll_ick);
528
529err_usbtll_fck:
530 clk_put(omap->usbtll_fck);
531
532err_usbhost_fs_fck:
533 clk_put(omap->usbhost_fs_fck);
534
535err_usbhost_hs_fck:
536 clk_put(omap->usbhost_hs_fck);
537
538err_usbhost_ick:
539 clk_put(omap->usbhost_ick);
540
541err_end:
542 kfree(omap);
543
544end_probe:
545 return ret;
546}
547
548/**
549 * usbhs_omap_remove - shutdown processing for UHH & TLL HCDs
550 * @pdev: USB Host Controller being removed
551 *
552 * Reverses the effect of usbhs_omap_probe().
553 */
554static int __devexit usbhs_omap_remove(struct platform_device *pdev)
555{
556 struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
557
558 if (omap->count != 0) {
559 dev_err(&pdev->dev,
560 "Either EHCI or OHCI is still using usbhs core\n");
561 return -EBUSY;
562 }
563
564 iounmap(omap->tll_base);
565 iounmap(omap->uhh_base);
566 clk_put(omap->init_60m_fclk);
567 clk_put(omap->usbtll_p2_fck);
568 clk_put(omap->usbhost_p2_fck);
569 clk_put(omap->usbtll_p1_fck);
570 clk_put(omap->usbhost_p1_fck);
571 clk_put(omap->xclk60mhsp2_ck);
572 clk_put(omap->utmi_p2_fck);
573 clk_put(omap->xclk60mhsp1_ck);
574 clk_put(omap->utmi_p1_fck);
575 clk_put(omap->usbtll_ick);
576 clk_put(omap->usbtll_fck);
577 clk_put(omap->usbhost_fs_fck);
578 clk_put(omap->usbhost_hs_fck);
579 clk_put(omap->usbhost_ick);
580 kfree(omap);
581
582 return 0;
583}
584
585static bool is_ohci_port(enum usbhs_omap_port_mode pmode) 318static bool is_ohci_port(enum usbhs_omap_port_mode pmode)
586{ 319{
587 switch (pmode) { 320 switch (pmode) {
@@ -689,30 +422,85 @@ static void usbhs_omap_tll_init(struct device *dev, u8 tll_channel_count)
689 } 422 }
690} 423}
691 424
692static int usbhs_enable(struct device *dev) 425static int usbhs_runtime_resume(struct device *dev)
693{ 426{
694 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); 427 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
695 struct usbhs_omap_platform_data *pdata = &omap->platdata; 428 struct usbhs_omap_platform_data *pdata = &omap->platdata;
696 unsigned long flags = 0; 429 unsigned long flags;
697 int ret = 0; 430
698 unsigned long timeout; 431 dev_dbg(dev, "usbhs_runtime_resume\n");
699 unsigned reg;
700 432
701 dev_dbg(dev, "starting TI HSUSB Controller\n");
702 if (!pdata) { 433 if (!pdata) {
703 dev_dbg(dev, "missing platform_data\n"); 434 dev_dbg(dev, "missing platform_data\n");
704 return -ENODEV; 435 return -ENODEV;
705 } 436 }
706 437
707 spin_lock_irqsave(&omap->lock, flags); 438 spin_lock_irqsave(&omap->lock, flags);
708 if (omap->count > 0)
709 goto end_count;
710 439
711 clk_enable(omap->usbhost_ick); 440 if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
712 clk_enable(omap->usbhost_hs_fck); 441 clk_enable(omap->ehci_logic_fck);
713 clk_enable(omap->usbhost_fs_fck); 442
714 clk_enable(omap->usbtll_fck); 443 if (is_ehci_tll_mode(pdata->port_mode[0])) {
715 clk_enable(omap->usbtll_ick); 444 clk_enable(omap->usbhost_p1_fck);
445 clk_enable(omap->usbtll_p1_fck);
446 }
447 if (is_ehci_tll_mode(pdata->port_mode[1])) {
448 clk_enable(omap->usbhost_p2_fck);
449 clk_enable(omap->usbtll_p2_fck);
450 }
451 clk_enable(omap->utmi_p1_fck);
452 clk_enable(omap->utmi_p2_fck);
453
454 spin_unlock_irqrestore(&omap->lock, flags);
455
456 return 0;
457}
458
459static int usbhs_runtime_suspend(struct device *dev)
460{
461 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
462 struct usbhs_omap_platform_data *pdata = &omap->platdata;
463 unsigned long flags;
464
465 dev_dbg(dev, "usbhs_runtime_suspend\n");
466
467 if (!pdata) {
468 dev_dbg(dev, "missing platform_data\n");
469 return -ENODEV;
470 }
471
472 spin_lock_irqsave(&omap->lock, flags);
473
474 if (is_ehci_tll_mode(pdata->port_mode[0])) {
475 clk_disable(omap->usbhost_p1_fck);
476 clk_disable(omap->usbtll_p1_fck);
477 }
478 if (is_ehci_tll_mode(pdata->port_mode[1])) {
479 clk_disable(omap->usbhost_p2_fck);
480 clk_disable(omap->usbtll_p2_fck);
481 }
482 clk_disable(omap->utmi_p2_fck);
483 clk_disable(omap->utmi_p1_fck);
484
485 if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
486 clk_disable(omap->ehci_logic_fck);
487
488 spin_unlock_irqrestore(&omap->lock, flags);
489
490 return 0;
491}
492
493static void omap_usbhs_init(struct device *dev)
494{
495 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
496 struct usbhs_omap_platform_data *pdata = &omap->platdata;
497 unsigned long flags;
498 unsigned reg;
499
500 dev_dbg(dev, "starting TI HSUSB Controller\n");
501
502 pm_runtime_get_sync(dev);
503 spin_lock_irqsave(&omap->lock, flags);
716 504
717 if (pdata->ehci_data->phy_reset) { 505 if (pdata->ehci_data->phy_reset) {
718 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) { 506 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) {
@@ -736,50 +524,6 @@ static int usbhs_enable(struct device *dev)
736 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); 524 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
737 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); 525 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
738 526
739 /* perform TLL soft reset, and wait until reset is complete */
740 usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
741 OMAP_USBTLL_SYSCONFIG_SOFTRESET);
742
743 /* Wait for TLL reset to complete */
744 timeout = jiffies + msecs_to_jiffies(1000);
745 while (!(usbhs_read(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
746 & OMAP_USBTLL_SYSSTATUS_RESETDONE)) {
747 cpu_relax();
748
749 if (time_after(jiffies, timeout)) {
750 dev_dbg(dev, "operation timed out\n");
751 ret = -EINVAL;
752 goto err_tll;
753 }
754 }
755
756 dev_dbg(dev, "TLL RESET DONE\n");
757
758 /* (1<<3) = no idle mode only for initial debugging */
759 usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
760 OMAP_USBTLL_SYSCONFIG_ENAWAKEUP |
761 OMAP_USBTLL_SYSCONFIG_SIDLEMODE |
762 OMAP_USBTLL_SYSCONFIG_AUTOIDLE);
763
764 /* Put UHH in NoIdle/NoStandby mode */
765 reg = usbhs_read(omap->uhh_base, OMAP_UHH_SYSCONFIG);
766 if (is_omap_usbhs_rev1(omap)) {
767 reg |= (OMAP_UHH_SYSCONFIG_ENAWAKEUP
768 | OMAP_UHH_SYSCONFIG_SIDLEMODE
769 | OMAP_UHH_SYSCONFIG_CACTIVITY
770 | OMAP_UHH_SYSCONFIG_MIDLEMODE);
771 reg &= ~OMAP_UHH_SYSCONFIG_AUTOIDLE;
772
773
774 } else if (is_omap_usbhs_rev2(omap)) {
775 reg &= ~OMAP4_UHH_SYSCONFIG_IDLEMODE_CLEAR;
776 reg |= OMAP4_UHH_SYSCONFIG_NOIDLE;
777 reg &= ~OMAP4_UHH_SYSCONFIG_STDBYMODE_CLEAR;
778 reg |= OMAP4_UHH_SYSCONFIG_NOSTDBY;
779 }
780
781 usbhs_write(omap->uhh_base, OMAP_UHH_SYSCONFIG, reg);
782
783 reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG); 527 reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
784 /* setup ULPI bypass and burst configurations */ 528 /* setup ULPI bypass and burst configurations */
785 reg |= (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN 529 reg |= (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN
@@ -825,49 +569,6 @@ static int usbhs_enable(struct device *dev)
825 reg &= ~OMAP4_P1_MODE_CLEAR; 569 reg &= ~OMAP4_P1_MODE_CLEAR;
826 reg &= ~OMAP4_P2_MODE_CLEAR; 570 reg &= ~OMAP4_P2_MODE_CLEAR;
827 571
828 if (is_ehci_phy_mode(pdata->port_mode[0])) {
829 ret = clk_set_parent(omap->utmi_p1_fck,
830 omap->xclk60mhsp1_ck);
831 if (ret != 0) {
832 dev_err(dev, "xclk60mhsp1_ck set parent"
833 "failed error:%d\n", ret);
834 goto err_tll;
835 }
836 } else if (is_ehci_tll_mode(pdata->port_mode[0])) {
837 ret = clk_set_parent(omap->utmi_p1_fck,
838 omap->init_60m_fclk);
839 if (ret != 0) {
840 dev_err(dev, "init_60m_fclk set parent"
841 "failed error:%d\n", ret);
842 goto err_tll;
843 }
844 clk_enable(omap->usbhost_p1_fck);
845 clk_enable(omap->usbtll_p1_fck);
846 }
847
848 if (is_ehci_phy_mode(pdata->port_mode[1])) {
849 ret = clk_set_parent(omap->utmi_p2_fck,
850 omap->xclk60mhsp2_ck);
851 if (ret != 0) {
852 dev_err(dev, "xclk60mhsp1_ck set parent"
853 "failed error:%d\n", ret);
854 goto err_tll;
855 }
856 } else if (is_ehci_tll_mode(pdata->port_mode[1])) {
857 ret = clk_set_parent(omap->utmi_p2_fck,
858 omap->init_60m_fclk);
859 if (ret != 0) {
860 dev_err(dev, "init_60m_fclk set parent"
861 "failed error:%d\n", ret);
862 goto err_tll;
863 }
864 clk_enable(omap->usbhost_p2_fck);
865 clk_enable(omap->usbtll_p2_fck);
866 }
867
868 clk_enable(omap->utmi_p1_fck);
869 clk_enable(omap->utmi_p2_fck);
870
871 if (is_ehci_tll_mode(pdata->port_mode[0]) || 572 if (is_ehci_tll_mode(pdata->port_mode[0]) ||
872 (is_ohci_port(pdata->port_mode[0]))) 573 (is_ohci_port(pdata->port_mode[0])))
873 reg |= OMAP4_P1_MODE_TLL; 574 reg |= OMAP4_P1_MODE_TLL;
@@ -913,12 +614,15 @@ static int usbhs_enable(struct device *dev)
913 (pdata->ehci_data->reset_gpio_port[1], 1); 614 (pdata->ehci_data->reset_gpio_port[1], 1);
914 } 615 }
915 616
916end_count:
917 omap->count++;
918 spin_unlock_irqrestore(&omap->lock, flags); 617 spin_unlock_irqrestore(&omap->lock, flags);
919 return 0; 618 pm_runtime_put_sync(dev);
619}
620
621static void omap_usbhs_deinit(struct device *dev)
622{
623 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
624 struct usbhs_omap_platform_data *pdata = &omap->platdata;
920 625
921err_tll:
922 if (pdata->ehci_data->phy_reset) { 626 if (pdata->ehci_data->phy_reset) {
923 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 627 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
924 gpio_free(pdata->ehci_data->reset_gpio_port[0]); 628 gpio_free(pdata->ehci_data->reset_gpio_port[0]);
@@ -926,123 +630,272 @@ err_tll:
926 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 630 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
927 gpio_free(pdata->ehci_data->reset_gpio_port[1]); 631 gpio_free(pdata->ehci_data->reset_gpio_port[1]);
928 } 632 }
929
930 clk_disable(omap->usbtll_ick);
931 clk_disable(omap->usbtll_fck);
932 clk_disable(omap->usbhost_fs_fck);
933 clk_disable(omap->usbhost_hs_fck);
934 clk_disable(omap->usbhost_ick);
935 spin_unlock_irqrestore(&omap->lock, flags);
936 return ret;
937} 633}
938 634
939static void usbhs_disable(struct device *dev) 635
636/**
637 * usbhs_omap_probe - initialize TI-based HCDs
638 *
639 * Allocates basic resources for this USB host controller.
640 */
641static int __devinit usbhs_omap_probe(struct platform_device *pdev)
940{ 642{
941 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); 643 struct device *dev = &pdev->dev;
942 struct usbhs_omap_platform_data *pdata = &omap->platdata; 644 struct usbhs_omap_platform_data *pdata = dev->platform_data;
943 unsigned long flags = 0; 645 struct usbhs_hcd_omap *omap;
944 unsigned long timeout; 646 struct resource *res;
647 int ret = 0;
648 int i;
945 649
946 dev_dbg(dev, "stopping TI HSUSB Controller\n"); 650 if (!pdata) {
651 dev_err(dev, "Missing platform data\n");
652 ret = -ENOMEM;
653 goto end_probe;
654 }
947 655
948 spin_lock_irqsave(&omap->lock, flags); 656 omap = kzalloc(sizeof(*omap), GFP_KERNEL);
657 if (!omap) {
658 dev_err(dev, "Memory allocation failed\n");
659 ret = -ENOMEM;
660 goto end_probe;
661 }
949 662
950 if (omap->count == 0) 663 spin_lock_init(&omap->lock);
951 goto end_disble;
952 664
953 omap->count--; 665 for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
666 omap->platdata.port_mode[i] = pdata->port_mode[i];
667
668 omap->platdata.ehci_data = pdata->ehci_data;
669 omap->platdata.ohci_data = pdata->ohci_data;
954 670
955 if (omap->count != 0) 671 pm_runtime_enable(dev);
956 goto end_disble;
957 672
958 /* Reset OMAP modules for insmod/rmmod to work */
959 usbhs_write(omap->uhh_base, OMAP_UHH_SYSCONFIG,
960 is_omap_usbhs_rev2(omap) ?
961 OMAP4_UHH_SYSCONFIG_SOFTRESET :
962 OMAP_UHH_SYSCONFIG_SOFTRESET);
963 673
964 timeout = jiffies + msecs_to_jiffies(100); 674 for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
965 while (!(usbhs_read(omap->uhh_base, OMAP_UHH_SYSSTATUS) 675 if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) ||
966 & (1 << 0))) { 676 is_ehci_hsic_mode(i)) {
967 cpu_relax(); 677 omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck");
678 if (IS_ERR(omap->ehci_logic_fck)) {
679 ret = PTR_ERR(omap->ehci_logic_fck);
680 dev_warn(dev, "ehci_logic_fck failed:%d\n",
681 ret);
682 }
683 break;
684 }
968 685
969 if (time_after(jiffies, timeout)) 686 omap->utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
970 dev_dbg(dev, "operation timed out\n"); 687 if (IS_ERR(omap->utmi_p1_fck)) {
688 ret = PTR_ERR(omap->utmi_p1_fck);
689 dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
690 goto err_end;
971 } 691 }
972 692
973 while (!(usbhs_read(omap->uhh_base, OMAP_UHH_SYSSTATUS) 693 omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
974 & (1 << 1))) { 694 if (IS_ERR(omap->xclk60mhsp1_ck)) {
975 cpu_relax(); 695 ret = PTR_ERR(omap->xclk60mhsp1_ck);
696 dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
697 goto err_utmi_p1_fck;
698 }
976 699
977 if (time_after(jiffies, timeout)) 700 omap->utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk");
978 dev_dbg(dev, "operation timed out\n"); 701 if (IS_ERR(omap->utmi_p2_fck)) {
702 ret = PTR_ERR(omap->utmi_p2_fck);
703 dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
704 goto err_xclk60mhsp1_ck;
979 } 705 }
980 706
981 while (!(usbhs_read(omap->uhh_base, OMAP_UHH_SYSSTATUS) 707 omap->xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck");
982 & (1 << 2))) { 708 if (IS_ERR(omap->xclk60mhsp2_ck)) {
983 cpu_relax(); 709 ret = PTR_ERR(omap->xclk60mhsp2_ck);
710 dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
711 goto err_utmi_p2_fck;
712 }
984 713
985 if (time_after(jiffies, timeout)) 714 omap->usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk");
986 dev_dbg(dev, "operation timed out\n"); 715 if (IS_ERR(omap->usbhost_p1_fck)) {
716 ret = PTR_ERR(omap->usbhost_p1_fck);
717 dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret);
718 goto err_xclk60mhsp2_ck;
987 } 719 }
988 720
989 usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG, (1 << 1)); 721 omap->usbtll_p1_fck = clk_get(dev, "usb_tll_hs_usb_ch0_clk");
722 if (IS_ERR(omap->usbtll_p1_fck)) {
723 ret = PTR_ERR(omap->usbtll_p1_fck);
724 dev_err(dev, "usbtll_p1_fck failed error:%d\n", ret);
725 goto err_usbhost_p1_fck;
726 }
990 727
991 while (!(usbhs_read(omap->tll_base, OMAP_USBTLL_SYSSTATUS) 728 omap->usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk");
992 & (1 << 0))) { 729 if (IS_ERR(omap->usbhost_p2_fck)) {
993 cpu_relax(); 730 ret = PTR_ERR(omap->usbhost_p2_fck);
731 dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret);
732 goto err_usbtll_p1_fck;
733 }
994 734
995 if (time_after(jiffies, timeout)) 735 omap->usbtll_p2_fck = clk_get(dev, "usb_tll_hs_usb_ch1_clk");
996 dev_dbg(dev, "operation timed out\n"); 736 if (IS_ERR(omap->usbtll_p2_fck)) {
737 ret = PTR_ERR(omap->usbtll_p2_fck);
738 dev_err(dev, "usbtll_p2_fck failed error:%d\n", ret);
739 goto err_usbhost_p2_fck;
997 } 740 }
998 741
999 if (is_omap_usbhs_rev2(omap)) { 742 omap->init_60m_fclk = clk_get(dev, "init_60m_fclk");
1000 if (is_ehci_tll_mode(pdata->port_mode[0])) 743 if (IS_ERR(omap->init_60m_fclk)) {
1001 clk_disable(omap->usbtll_p1_fck); 744 ret = PTR_ERR(omap->init_60m_fclk);
1002 if (is_ehci_tll_mode(pdata->port_mode[1])) 745 dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
1003 clk_disable(omap->usbtll_p2_fck); 746 goto err_usbtll_p2_fck;
1004 clk_disable(omap->utmi_p2_fck);
1005 clk_disable(omap->utmi_p1_fck);
1006 } 747 }
1007 748
1008 clk_disable(omap->usbtll_ick); 749 if (is_ehci_phy_mode(pdata->port_mode[0])) {
1009 clk_disable(omap->usbtll_fck); 750 /* for OMAP3 , the clk set paretn fails */
1010 clk_disable(omap->usbhost_fs_fck); 751 ret = clk_set_parent(omap->utmi_p1_fck,
1011 clk_disable(omap->usbhost_hs_fck); 752 omap->xclk60mhsp1_ck);
1012 clk_disable(omap->usbhost_ick); 753 if (ret != 0)
754 dev_err(dev, "xclk60mhsp1_ck set parent"
755 "failed error:%d\n", ret);
756 } else if (is_ehci_tll_mode(pdata->port_mode[0])) {
757 ret = clk_set_parent(omap->utmi_p1_fck,
758 omap->init_60m_fclk);
759 if (ret != 0)
760 dev_err(dev, "init_60m_fclk set parent"
761 "failed error:%d\n", ret);
762 }
1013 763
1014 /* The gpio_free migh sleep; so unlock the spinlock */ 764 if (is_ehci_phy_mode(pdata->port_mode[1])) {
1015 spin_unlock_irqrestore(&omap->lock, flags); 765 ret = clk_set_parent(omap->utmi_p2_fck,
766 omap->xclk60mhsp2_ck);
767 if (ret != 0)
768 dev_err(dev, "xclk60mhsp2_ck set parent"
769 "failed error:%d\n", ret);
770 } else if (is_ehci_tll_mode(pdata->port_mode[1])) {
771 ret = clk_set_parent(omap->utmi_p2_fck,
772 omap->init_60m_fclk);
773 if (ret != 0)
774 dev_err(dev, "init_60m_fclk set parent"
775 "failed error:%d\n", ret);
776 }
1016 777
1017 if (pdata->ehci_data->phy_reset) { 778 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
1018 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 779 if (!res) {
1019 gpio_free(pdata->ehci_data->reset_gpio_port[0]); 780 dev_err(dev, "UHH EHCI get resource failed\n");
781 ret = -ENODEV;
782 goto err_init_60m_fclk;
783 }
1020 784
1021 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 785 omap->uhh_base = ioremap(res->start, resource_size(res));
1022 gpio_free(pdata->ehci_data->reset_gpio_port[1]); 786 if (!omap->uhh_base) {
787 dev_err(dev, "UHH ioremap failed\n");
788 ret = -ENOMEM;
789 goto err_init_60m_fclk;
1023 } 790 }
1024 return;
1025 791
1026end_disble: 792 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
1027 spin_unlock_irqrestore(&omap->lock, flags); 793 if (!res) {
1028} 794 dev_err(dev, "UHH EHCI get resource failed\n");
795 ret = -ENODEV;
796 goto err_tll;
797 }
1029 798
1030int omap_usbhs_enable(struct device *dev) 799 omap->tll_base = ioremap(res->start, resource_size(res));
1031{ 800 if (!omap->tll_base) {
1032 return usbhs_enable(dev->parent); 801 dev_err(dev, "TLL ioremap failed\n");
802 ret = -ENOMEM;
803 goto err_tll;
804 }
805
806 platform_set_drvdata(pdev, omap);
807
808 ret = omap_usbhs_alloc_children(pdev);
809 if (ret) {
810 dev_err(dev, "omap_usbhs_alloc_children failed\n");
811 goto err_alloc;
812 }
813
814 omap_usbhs_init(dev);
815
816 goto end_probe;
817
818err_alloc:
819 iounmap(omap->tll_base);
820
821err_tll:
822 iounmap(omap->uhh_base);
823
824err_init_60m_fclk:
825 clk_put(omap->init_60m_fclk);
826
827err_usbtll_p2_fck:
828 clk_put(omap->usbtll_p2_fck);
829
830err_usbhost_p2_fck:
831 clk_put(omap->usbhost_p2_fck);
832
833err_usbtll_p1_fck:
834 clk_put(omap->usbtll_p1_fck);
835
836err_usbhost_p1_fck:
837 clk_put(omap->usbhost_p1_fck);
838
839err_xclk60mhsp2_ck:
840 clk_put(omap->xclk60mhsp2_ck);
841
842err_utmi_p2_fck:
843 clk_put(omap->utmi_p2_fck);
844
845err_xclk60mhsp1_ck:
846 clk_put(omap->xclk60mhsp1_ck);
847
848err_utmi_p1_fck:
849 clk_put(omap->utmi_p1_fck);
850
851err_end:
852 clk_put(omap->ehci_logic_fck);
853 pm_runtime_disable(dev);
854 kfree(omap);
855
856end_probe:
857 return ret;
1033} 858}
1034EXPORT_SYMBOL_GPL(omap_usbhs_enable);
1035 859
1036void omap_usbhs_disable(struct device *dev) 860/**
861 * usbhs_omap_remove - shutdown processing for UHH & TLL HCDs
862 * @pdev: USB Host Controller being removed
863 *
864 * Reverses the effect of usbhs_omap_probe().
865 */
866static int __devexit usbhs_omap_remove(struct platform_device *pdev)
1037{ 867{
1038 usbhs_disable(dev->parent); 868 struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
869
870 omap_usbhs_deinit(&pdev->dev);
871 iounmap(omap->tll_base);
872 iounmap(omap->uhh_base);
873 clk_put(omap->init_60m_fclk);
874 clk_put(omap->usbtll_p2_fck);
875 clk_put(omap->usbhost_p2_fck);
876 clk_put(omap->usbtll_p1_fck);
877 clk_put(omap->usbhost_p1_fck);
878 clk_put(omap->xclk60mhsp2_ck);
879 clk_put(omap->utmi_p2_fck);
880 clk_put(omap->xclk60mhsp1_ck);
881 clk_put(omap->utmi_p1_fck);
882 clk_put(omap->ehci_logic_fck);
883 pm_runtime_disable(&pdev->dev);
884 kfree(omap);
885
886 return 0;
1039} 887}
1040EXPORT_SYMBOL_GPL(omap_usbhs_disable); 888
889static const struct dev_pm_ops usbhsomap_dev_pm_ops = {
890 .runtime_suspend = usbhs_runtime_suspend,
891 .runtime_resume = usbhs_runtime_resume,
892};
1041 893
1042static struct platform_driver usbhs_omap_driver = { 894static struct platform_driver usbhs_omap_driver = {
1043 .driver = { 895 .driver = {
1044 .name = (char *)usbhs_driver_name, 896 .name = (char *)usbhs_driver_name,
1045 .owner = THIS_MODULE, 897 .owner = THIS_MODULE,
898 .pm = &usbhsomap_dev_pm_ops,
1046 }, 899 },
1047 .remove = __exit_p(usbhs_omap_remove), 900 .remove = __exit_p(usbhs_omap_remove),
1048}; 901};
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d5fe43d53c51..d1fb561e089d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1991,6 +1991,8 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
1991 if (mmc_slot(host).nonremovable) 1991 if (mmc_slot(host).nonremovable)
1992 mmc->caps |= MMC_CAP_NONREMOVABLE; 1992 mmc->caps |= MMC_CAP_NONREMOVABLE;
1993 1993
1994 mmc->pm_caps = mmc_slot(host).pm_caps;
1995
1994 omap_hsmmc_conf_bus_power(host); 1996 omap_hsmmc_conf_bus_power(host);
1995 1997
1996 /* Select DMA lines */ 1998 /* Select DMA lines */
@@ -2179,13 +2181,7 @@ static int omap_hsmmc_suspend(struct device *dev)
2179 cancel_work_sync(&host->mmc_carddetect_work); 2181 cancel_work_sync(&host->mmc_carddetect_work);
2180 ret = mmc_suspend_host(host->mmc); 2182 ret = mmc_suspend_host(host->mmc);
2181 2183
2182 if (ret == 0) { 2184 if (ret) {
2183 omap_hsmmc_disable_irq(host);
2184 OMAP_HSMMC_WRITE(host->base, HCTL,
2185 OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
2186 if (host->got_dbclk)
2187 clk_disable(host->dbclk);
2188 } else {
2189 host->suspended = 0; 2185 host->suspended = 0;
2190 if (host->pdata->resume) { 2186 if (host->pdata->resume) {
2191 ret = host->pdata->resume(&pdev->dev, 2187 ret = host->pdata->resume(&pdev->dev,
@@ -2194,9 +2190,20 @@ static int omap_hsmmc_suspend(struct device *dev)
2194 dev_dbg(mmc_dev(host->mmc), 2190 dev_dbg(mmc_dev(host->mmc),
2195 "Unmask interrupt failed\n"); 2191 "Unmask interrupt failed\n");
2196 } 2192 }
2193 goto err;
2197 } 2194 }
2198 pm_runtime_put_sync(host->dev); 2195
2196 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) {
2197 omap_hsmmc_disable_irq(host);
2198 OMAP_HSMMC_WRITE(host->base, HCTL,
2199 OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
2200 }
2201 if (host->got_dbclk)
2202 clk_disable(host->dbclk);
2203
2199 } 2204 }
2205err:
2206 pm_runtime_put_sync(host->dev);
2200 return ret; 2207 return ret;
2201} 2208}
2202 2209
@@ -2216,7 +2223,8 @@ static int omap_hsmmc_resume(struct device *dev)
2216 if (host->got_dbclk) 2223 if (host->got_dbclk)
2217 clk_enable(host->dbclk); 2224 clk_enable(host->dbclk);
2218 2225
2219 omap_hsmmc_conf_bus_power(host); 2226 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
2227 omap_hsmmc_conf_bus_power(host);
2220 2228
2221 if (host->pdata->resume) { 2229 if (host->pdata->resume) {
2222 ret = host->pdata->resume(&pdev->dev, host->slot_id); 2230 ret = host->pdata->resume(&pdev->dev, host->slot_id);
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index be5dde040261..94b7f287d6c5 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/
10obj-$(CONFIG_NET_VENDOR_AMD) += amd/ 10obj-$(CONFIG_NET_VENDOR_AMD) += amd/
11obj-$(CONFIG_NET_VENDOR_APPLE) += apple/ 11obj-$(CONFIG_NET_VENDOR_APPLE) += apple/
12obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/ 12obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/
13obj-$(CONFIG_NET_ATMEL) += cadence/ 13obj-$(CONFIG_NET_CADENCE) += cadence/
14obj-$(CONFIG_NET_BFIN) += adi/ 14obj-$(CONFIG_NET_BFIN) += adi/
15obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/ 15obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/
16obj-$(CONFIG_NET_VENDOR_BROCADE) += brocade/ 16obj-$(CONFIG_NET_VENDOR_BROCADE) += brocade/
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index b48378a41e49..db931916da08 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -5,8 +5,8 @@
5config HAVE_NET_MACB 5config HAVE_NET_MACB
6 bool 6 bool
7 7
8config NET_ATMEL 8config NET_CADENCE
9 bool "Atmel devices" 9 bool "Cadence devices"
10 default y 10 default y
11 depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200) 11 depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200)
12 ---help--- 12 ---help---
@@ -21,7 +21,7 @@ config NET_ATMEL
21 the remaining Atmel network card questions. If you say Y, you will be 21 the remaining Atmel network card questions. If you say Y, you will be
22 asked for your specific card in the following questions. 22 asked for your specific card in the following questions.
23 23
24if NET_ATMEL 24if NET_CADENCE
25 25
26config ARM_AT91_ETHER 26config ARM_AT91_ETHER
27 tristate "AT91RM9200 Ethernet support" 27 tristate "AT91RM9200 Ethernet support"
@@ -33,14 +33,16 @@ config ARM_AT91_ETHER
33 ethernet support, then you should always answer Y to this. 33 ethernet support, then you should always answer Y to this.
34 34
35config MACB 35config MACB
36 tristate "Atmel MACB support" 36 tristate "Cadence MACB/GEM support"
37 depends on HAVE_NET_MACB 37 depends on HAVE_NET_MACB
38 select PHYLIB 38 select PHYLIB
39 ---help--- 39 ---help---
40 The Atmel MACB ethernet interface is found on many AT32 and AT91 40 The Cadence MACB ethernet interface is found on many Atmel AT32 and
41 parts. Say Y to include support for the MACB chip. 41 AT91 parts. This driver also supports the Cadence GEM (Gigabit
42 Ethernet MAC found in some ARM SoC devices). Note: the Gigabit mode
43 is not yet supported. Say Y to include support for the MACB/GEM chip.
42 44
43 To compile this driver as a module, choose M here: the module 45 To compile this driver as a module, choose M here: the module
44 will be called macb. 46 will be called macb.
45 47
46endif # NET_ATMEL 48endif # NET_CADENCE
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 56624d303487..1a5b6efa0120 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -26,6 +26,7 @@
26#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/ethtool.h> 28#include <linux/ethtool.h>
29#include <linux/platform_data/macb.h>
29#include <linux/platform_device.h> 30#include <linux/platform_device.h>
30#include <linux/clk.h> 31#include <linux/clk.h>
31#include <linux/gfp.h> 32#include <linux/gfp.h>
@@ -255,8 +256,7 @@ static void enable_phyirq(struct net_device *dev)
255 unsigned int dsintr, irq_number; 256 unsigned int dsintr, irq_number;
256 int status; 257 int status;
257 258
258 irq_number = lp->board_data.phy_irq_pin; 259 if (!gpio_is_valid(lp->board_data.phy_irq_pin)) {
259 if (!irq_number) {
260 /* 260 /*
261 * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L), 261 * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L),
262 * or board does not have it connected. 262 * or board does not have it connected.
@@ -265,6 +265,7 @@ static void enable_phyirq(struct net_device *dev)
265 return; 265 return;
266 } 266 }
267 267
268 irq_number = lp->board_data.phy_irq_pin;
268 status = request_irq(irq_number, at91ether_phy_interrupt, 0, dev->name, dev); 269 status = request_irq(irq_number, at91ether_phy_interrupt, 0, dev->name, dev);
269 if (status) { 270 if (status) {
270 printk(KERN_ERR "at91_ether: PHY IRQ %d request failed - status %d!\n", irq_number, status); 271 printk(KERN_ERR "at91_ether: PHY IRQ %d request failed - status %d!\n", irq_number, status);
@@ -319,8 +320,7 @@ static void disable_phyirq(struct net_device *dev)
319 unsigned int dsintr; 320 unsigned int dsintr;
320 unsigned int irq_number; 321 unsigned int irq_number;
321 322
322 irq_number = lp->board_data.phy_irq_pin; 323 if (!gpio_is_valid(lp->board_data.phy_irq_pin)) {
323 if (!irq_number) {
324 del_timer_sync(&lp->check_timer); 324 del_timer_sync(&lp->check_timer);
325 return; 325 return;
326 } 326 }
@@ -365,6 +365,7 @@ static void disable_phyirq(struct net_device *dev)
365 disable_mdi(); 365 disable_mdi();
366 spin_unlock_irq(&lp->lock); 366 spin_unlock_irq(&lp->lock);
367 367
368 irq_number = lp->board_data.phy_irq_pin;
368 free_irq(irq_number, dev); /* Free interrupt handler */ 369 free_irq(irq_number, dev); /* Free interrupt handler */
369} 370}
370 371
@@ -984,7 +985,7 @@ static const struct net_device_ops at91ether_netdev_ops = {
984static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address, 985static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address,
985 struct platform_device *pdev, struct clk *ether_clk) 986 struct platform_device *pdev, struct clk *ether_clk)
986{ 987{
987 struct at91_eth_data *board_data = pdev->dev.platform_data; 988 struct macb_platform_data *board_data = pdev->dev.platform_data;
988 struct net_device *dev; 989 struct net_device *dev;
989 struct at91_private *lp; 990 struct at91_private *lp;
990 unsigned int val; 991 unsigned int val;
@@ -1077,7 +1078,7 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add
1077 netif_carrier_off(dev); /* will be enabled in open() */ 1078 netif_carrier_off(dev); /* will be enabled in open() */
1078 1079
1079 /* If board has no PHY IRQ, use a timer to poll the PHY */ 1080 /* If board has no PHY IRQ, use a timer to poll the PHY */
1080 if (!lp->board_data.phy_irq_pin) { 1081 if (!gpio_is_valid(lp->board_data.phy_irq_pin)) {
1081 init_timer(&lp->check_timer); 1082 init_timer(&lp->check_timer);
1082 lp->check_timer.data = (unsigned long)dev; 1083 lp->check_timer.data = (unsigned long)dev;
1083 lp->check_timer.function = at91ether_check_link; 1084 lp->check_timer.function = at91ether_check_link;
@@ -1169,7 +1170,8 @@ static int __devexit at91ether_remove(struct platform_device *pdev)
1169 struct net_device *dev = platform_get_drvdata(pdev); 1170 struct net_device *dev = platform_get_drvdata(pdev);
1170 struct at91_private *lp = netdev_priv(dev); 1171 struct at91_private *lp = netdev_priv(dev);
1171 1172
1172 if (lp->board_data.phy_irq_pin >= 32) 1173 if (gpio_is_valid(lp->board_data.phy_irq_pin) &&
1174 lp->board_data.phy_irq_pin >= 32)
1173 gpio_free(lp->board_data.phy_irq_pin); 1175 gpio_free(lp->board_data.phy_irq_pin);
1174 1176
1175 unregister_netdev(dev); 1177 unregister_netdev(dev);
@@ -1188,11 +1190,12 @@ static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg)
1188{ 1190{
1189 struct net_device *net_dev = platform_get_drvdata(pdev); 1191 struct net_device *net_dev = platform_get_drvdata(pdev);
1190 struct at91_private *lp = netdev_priv(net_dev); 1192 struct at91_private *lp = netdev_priv(net_dev);
1191 int phy_irq = lp->board_data.phy_irq_pin;
1192 1193
1193 if (netif_running(net_dev)) { 1194 if (netif_running(net_dev)) {
1194 if (phy_irq) 1195 if (gpio_is_valid(lp->board_data.phy_irq_pin)) {
1196 int phy_irq = lp->board_data.phy_irq_pin;
1195 disable_irq(phy_irq); 1197 disable_irq(phy_irq);
1198 }
1196 1199
1197 netif_stop_queue(net_dev); 1200 netif_stop_queue(net_dev);
1198 netif_device_detach(net_dev); 1201 netif_device_detach(net_dev);
@@ -1206,7 +1209,6 @@ static int at91ether_resume(struct platform_device *pdev)
1206{ 1209{
1207 struct net_device *net_dev = platform_get_drvdata(pdev); 1210 struct net_device *net_dev = platform_get_drvdata(pdev);
1208 struct at91_private *lp = netdev_priv(net_dev); 1211 struct at91_private *lp = netdev_priv(net_dev);
1209 int phy_irq = lp->board_data.phy_irq_pin;
1210 1212
1211 if (netif_running(net_dev)) { 1213 if (netif_running(net_dev)) {
1212 clk_enable(lp->ether_clk); 1214 clk_enable(lp->ether_clk);
@@ -1214,8 +1216,10 @@ static int at91ether_resume(struct platform_device *pdev)
1214 netif_device_attach(net_dev); 1216 netif_device_attach(net_dev);
1215 netif_start_queue(net_dev); 1217 netif_start_queue(net_dev);
1216 1218
1217 if (phy_irq) 1219 if (gpio_is_valid(lp->board_data.phy_irq_pin)) {
1220 int phy_irq = lp->board_data.phy_irq_pin;
1218 enable_irq(phy_irq); 1221 enable_irq(phy_irq);
1222 }
1219 } 1223 }
1220 return 0; 1224 return 0;
1221} 1225}
diff --git a/drivers/net/ethernet/cadence/at91_ether.h b/drivers/net/ethernet/cadence/at91_ether.h
index 353f4dab62be..3725fbb0defe 100644
--- a/drivers/net/ethernet/cadence/at91_ether.h
+++ b/drivers/net/ethernet/cadence/at91_ether.h
@@ -85,7 +85,9 @@ struct recv_desc_bufs
85struct at91_private 85struct at91_private
86{ 86{
87 struct mii_if_info mii; /* ethtool support */ 87 struct mii_if_info mii; /* ethtool support */
88 struct at91_eth_data board_data; /* board-specific configuration */ 88 struct macb_platform_data board_data; /* board-specific
89 * configuration (shared with
90 * macb for common data */
89 struct clk *ether_clk; /* clock */ 91 struct clk *ether_clk; /* clock */
90 92
91 /* PHY */ 93 /* PHY */
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index a437b46e5490..f3d5c65d99cf 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Atmel MACB Ethernet Controller driver 2 * Cadence MACB/GEM Ethernet Controller driver
3 * 3 *
4 * Copyright (C) 2004-2006 Atmel Corporation 4 * Copyright (C) 2004-2006 Atmel Corporation
5 * 5 *
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11#include <linux/clk.h> 12#include <linux/clk.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/moduleparam.h> 14#include <linux/moduleparam.h>
@@ -19,11 +20,12 @@
19#include <linux/netdevice.h> 20#include <linux/netdevice.h>
20#include <linux/etherdevice.h> 21#include <linux/etherdevice.h>
21#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/platform_data/macb.h>
22#include <linux/platform_device.h> 24#include <linux/platform_device.h>
23#include <linux/phy.h> 25#include <linux/phy.h>
24 26#include <linux/of.h>
25#include <mach/board.h> 27#include <linux/of_device.h>
26#include <mach/cpu.h> 28#include <linux/of_net.h>
27 29
28#include "macb.h" 30#include "macb.h"
29 31
@@ -60,9 +62,9 @@ static void __macb_set_hwaddr(struct macb *bp)
60 u16 top; 62 u16 top;
61 63
62 bottom = cpu_to_le32(*((u32 *)bp->dev->dev_addr)); 64 bottom = cpu_to_le32(*((u32 *)bp->dev->dev_addr));
63 macb_writel(bp, SA1B, bottom); 65 macb_or_gem_writel(bp, SA1B, bottom);
64 top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4))); 66 top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4)));
65 macb_writel(bp, SA1T, top); 67 macb_or_gem_writel(bp, SA1T, top);
66} 68}
67 69
68static void __init macb_get_hwaddr(struct macb *bp) 70static void __init macb_get_hwaddr(struct macb *bp)
@@ -71,8 +73,8 @@ static void __init macb_get_hwaddr(struct macb *bp)
71 u16 top; 73 u16 top;
72 u8 addr[6]; 74 u8 addr[6];
73 75
74 bottom = macb_readl(bp, SA1B); 76 bottom = macb_or_gem_readl(bp, SA1B);
75 top = macb_readl(bp, SA1T); 77 top = macb_or_gem_readl(bp, SA1T);
76 78
77 addr[0] = bottom & 0xff; 79 addr[0] = bottom & 0xff;
78 addr[1] = (bottom >> 8) & 0xff; 80 addr[1] = (bottom >> 8) & 0xff;
@@ -84,7 +86,7 @@ static void __init macb_get_hwaddr(struct macb *bp)
84 if (is_valid_ether_addr(addr)) { 86 if (is_valid_ether_addr(addr)) {
85 memcpy(bp->dev->dev_addr, addr, sizeof(addr)); 87 memcpy(bp->dev->dev_addr, addr, sizeof(addr));
86 } else { 88 } else {
87 dev_info(&bp->pdev->dev, "invalid hw address, using random\n"); 89 netdev_info(bp->dev, "invalid hw address, using random\n");
88 random_ether_addr(bp->dev->dev_addr); 90 random_ether_addr(bp->dev->dev_addr);
89 } 91 }
90} 92}
@@ -178,11 +180,12 @@ static void macb_handle_link_change(struct net_device *dev)
178 180
179 if (status_change) { 181 if (status_change) {
180 if (phydev->link) 182 if (phydev->link)
181 printk(KERN_INFO "%s: link up (%d/%s)\n", 183 netdev_info(dev, "link up (%d/%s)\n",
182 dev->name, phydev->speed, 184 phydev->speed,
183 DUPLEX_FULL == phydev->duplex ? "Full":"Half"); 185 phydev->duplex == DUPLEX_FULL ?
186 "Full" : "Half");
184 else 187 else
185 printk(KERN_INFO "%s: link down\n", dev->name); 188 netdev_info(dev, "link down\n");
186 } 189 }
187} 190}
188 191
@@ -191,25 +194,21 @@ static int macb_mii_probe(struct net_device *dev)
191{ 194{
192 struct macb *bp = netdev_priv(dev); 195 struct macb *bp = netdev_priv(dev);
193 struct phy_device *phydev; 196 struct phy_device *phydev;
194 struct eth_platform_data *pdata;
195 int ret; 197 int ret;
196 198
197 phydev = phy_find_first(bp->mii_bus); 199 phydev = phy_find_first(bp->mii_bus);
198 if (!phydev) { 200 if (!phydev) {
199 printk (KERN_ERR "%s: no PHY found\n", dev->name); 201 netdev_err(dev, "no PHY found\n");
200 return -1; 202 return -1;
201 } 203 }
202 204
203 pdata = bp->pdev->dev.platform_data;
204 /* TODO : add pin_irq */ 205 /* TODO : add pin_irq */
205 206
206 /* attach the mac to the phy */ 207 /* attach the mac to the phy */
207 ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0, 208 ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0,
208 pdata && pdata->is_rmii ? 209 bp->phy_interface);
209 PHY_INTERFACE_MODE_RMII :
210 PHY_INTERFACE_MODE_MII);
211 if (ret) { 210 if (ret) {
212 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 211 netdev_err(dev, "Could not attach to PHY\n");
213 return ret; 212 return ret;
214 } 213 }
215 214
@@ -228,7 +227,7 @@ static int macb_mii_probe(struct net_device *dev)
228 227
229static int macb_mii_init(struct macb *bp) 228static int macb_mii_init(struct macb *bp)
230{ 229{
231 struct eth_platform_data *pdata; 230 struct macb_platform_data *pdata;
232 int err = -ENXIO, i; 231 int err = -ENXIO, i;
233 232
234 /* Enable management port */ 233 /* Enable management port */
@@ -285,8 +284,8 @@ err_out:
285static void macb_update_stats(struct macb *bp) 284static void macb_update_stats(struct macb *bp)
286{ 285{
287 u32 __iomem *reg = bp->regs + MACB_PFR; 286 u32 __iomem *reg = bp->regs + MACB_PFR;
288 u32 *p = &bp->hw_stats.rx_pause_frames; 287 u32 *p = &bp->hw_stats.macb.rx_pause_frames;
289 u32 *end = &bp->hw_stats.tx_pause_frames + 1; 288 u32 *end = &bp->hw_stats.macb.tx_pause_frames + 1;
290 289
291 WARN_ON((unsigned long)(end - p - 1) != (MACB_TPF - MACB_PFR) / 4); 290 WARN_ON((unsigned long)(end - p - 1) != (MACB_TPF - MACB_PFR) / 4);
292 291
@@ -303,14 +302,13 @@ static void macb_tx(struct macb *bp)
303 status = macb_readl(bp, TSR); 302 status = macb_readl(bp, TSR);
304 macb_writel(bp, TSR, status); 303 macb_writel(bp, TSR, status);
305 304
306 dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", 305 netdev_dbg(bp->dev, "macb_tx status = %02lx\n", (unsigned long)status);
307 (unsigned long)status);
308 306
309 if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { 307 if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) {
310 int i; 308 int i;
311 printk(KERN_ERR "%s: TX %s, resetting buffers\n", 309 netdev_err(bp->dev, "TX %s, resetting buffers\n",
312 bp->dev->name, status & MACB_BIT(UND) ? 310 status & MACB_BIT(UND) ?
313 "underrun" : "retry limit exceeded"); 311 "underrun" : "retry limit exceeded");
314 312
315 /* Transfer ongoing, disable transmitter, to avoid confusion */ 313 /* Transfer ongoing, disable transmitter, to avoid confusion */
316 if (status & MACB_BIT(TGO)) 314 if (status & MACB_BIT(TGO))
@@ -369,8 +367,8 @@ static void macb_tx(struct macb *bp)
369 if (!(bufstat & MACB_BIT(TX_USED))) 367 if (!(bufstat & MACB_BIT(TX_USED)))
370 break; 368 break;
371 369
372 dev_dbg(&bp->pdev->dev, "skb %u (data %p) TX complete\n", 370 netdev_dbg(bp->dev, "skb %u (data %p) TX complete\n",
373 tail, skb->data); 371 tail, skb->data);
374 dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len, 372 dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
375 DMA_TO_DEVICE); 373 DMA_TO_DEVICE);
376 bp->stats.tx_packets++; 374 bp->stats.tx_packets++;
@@ -395,8 +393,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
395 393
396 len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl); 394 len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl);
397 395
398 dev_dbg(&bp->pdev->dev, "macb_rx_frame frags %u - %u (len %u)\n", 396 netdev_dbg(bp->dev, "macb_rx_frame frags %u - %u (len %u)\n",
399 first_frag, last_frag, len); 397 first_frag, last_frag, len);
400 398
401 skb = dev_alloc_skb(len + RX_OFFSET); 399 skb = dev_alloc_skb(len + RX_OFFSET);
402 if (!skb) { 400 if (!skb) {
@@ -437,8 +435,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
437 435
438 bp->stats.rx_packets++; 436 bp->stats.rx_packets++;
439 bp->stats.rx_bytes += len; 437 bp->stats.rx_bytes += len;
440 dev_dbg(&bp->pdev->dev, "received skb of length %u, csum: %08x\n", 438 netdev_dbg(bp->dev, "received skb of length %u, csum: %08x\n",
441 skb->len, skb->csum); 439 skb->len, skb->csum);
442 netif_receive_skb(skb); 440 netif_receive_skb(skb);
443 441
444 return 0; 442 return 0;
@@ -515,8 +513,8 @@ static int macb_poll(struct napi_struct *napi, int budget)
515 513
516 work_done = 0; 514 work_done = 0;
517 515
518 dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", 516 netdev_dbg(bp->dev, "poll: status = %08lx, budget = %d\n",
519 (unsigned long)status, budget); 517 (unsigned long)status, budget);
520 518
521 work_done = macb_rx(bp, budget); 519 work_done = macb_rx(bp, budget);
522 if (work_done < budget) { 520 if (work_done < budget) {
@@ -565,8 +563,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
565 macb_writel(bp, IDR, MACB_RX_INT_FLAGS); 563 macb_writel(bp, IDR, MACB_RX_INT_FLAGS);
566 564
567 if (napi_schedule_prep(&bp->napi)) { 565 if (napi_schedule_prep(&bp->napi)) {
568 dev_dbg(&bp->pdev->dev, 566 netdev_dbg(bp->dev, "scheduling RX softirq\n");
569 "scheduling RX softirq\n");
570 __napi_schedule(&bp->napi); 567 __napi_schedule(&bp->napi);
571 } 568 }
572 } 569 }
@@ -582,16 +579,19 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
582 579
583 if (status & MACB_BIT(ISR_ROVR)) { 580 if (status & MACB_BIT(ISR_ROVR)) {
584 /* We missed at least one packet */ 581 /* We missed at least one packet */
585 bp->hw_stats.rx_overruns++; 582 if (macb_is_gem(bp))
583 bp->hw_stats.gem.rx_overruns++;
584 else
585 bp->hw_stats.macb.rx_overruns++;
586 } 586 }
587 587
588 if (status & MACB_BIT(HRESP)) { 588 if (status & MACB_BIT(HRESP)) {
589 /* 589 /*
590 * TODO: Reset the hardware, and maybe move the printk 590 * TODO: Reset the hardware, and maybe move the
591 * to a lower-priority context as well (work queue?) 591 * netdev_err to a lower-priority context as well
592 * (work queue?)
592 */ 593 */
593 printk(KERN_ERR "%s: DMA bus error: HRESP not OK\n", 594 netdev_err(dev, "DMA bus error: HRESP not OK\n");
594 dev->name);
595 } 595 }
596 596
597 status = macb_readl(bp, ISR); 597 status = macb_readl(bp, ISR);
@@ -626,16 +626,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
626 unsigned long flags; 626 unsigned long flags;
627 627
628#ifdef DEBUG 628#ifdef DEBUG
629 int i; 629 netdev_dbg(bp->dev,
630 dev_dbg(&bp->pdev->dev, 630 "start_xmit: len %u head %p data %p tail %p end %p\n",
631 "start_xmit: len %u head %p data %p tail %p end %p\n", 631 skb->len, skb->head, skb->data,
632 skb->len, skb->head, skb->data, 632 skb_tail_pointer(skb), skb_end_pointer(skb));
633 skb_tail_pointer(skb), skb_end_pointer(skb)); 633 print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_OFFSET, 16, 1,
634 dev_dbg(&bp->pdev->dev, 634 skb->data, 16, true);
635 "data:");
636 for (i = 0; i < 16; i++)
637 printk(" %02x", (unsigned int)skb->data[i]);
638 printk("\n");
639#endif 635#endif
640 636
641 len = skb->len; 637 len = skb->len;
@@ -645,21 +641,20 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
645 if (TX_BUFFS_AVAIL(bp) < 1) { 641 if (TX_BUFFS_AVAIL(bp) < 1) {
646 netif_stop_queue(dev); 642 netif_stop_queue(dev);
647 spin_unlock_irqrestore(&bp->lock, flags); 643 spin_unlock_irqrestore(&bp->lock, flags);
648 dev_err(&bp->pdev->dev, 644 netdev_err(bp->dev, "BUG! Tx Ring full when queue awake!\n");
649 "BUG! Tx Ring full when queue awake!\n"); 645 netdev_dbg(bp->dev, "tx_head = %u, tx_tail = %u\n",
650 dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n", 646 bp->tx_head, bp->tx_tail);
651 bp->tx_head, bp->tx_tail);
652 return NETDEV_TX_BUSY; 647 return NETDEV_TX_BUSY;
653 } 648 }
654 649
655 entry = bp->tx_head; 650 entry = bp->tx_head;
656 dev_dbg(&bp->pdev->dev, "Allocated ring entry %u\n", entry); 651 netdev_dbg(bp->dev, "Allocated ring entry %u\n", entry);
657 mapping = dma_map_single(&bp->pdev->dev, skb->data, 652 mapping = dma_map_single(&bp->pdev->dev, skb->data,
658 len, DMA_TO_DEVICE); 653 len, DMA_TO_DEVICE);
659 bp->tx_skb[entry].skb = skb; 654 bp->tx_skb[entry].skb = skb;
660 bp->tx_skb[entry].mapping = mapping; 655 bp->tx_skb[entry].mapping = mapping;
661 dev_dbg(&bp->pdev->dev, "Mapped skb data %p to DMA addr %08lx\n", 656 netdev_dbg(bp->dev, "Mapped skb data %p to DMA addr %08lx\n",
662 skb->data, (unsigned long)mapping); 657 skb->data, (unsigned long)mapping);
663 658
664 ctrl = MACB_BF(TX_FRMLEN, len); 659 ctrl = MACB_BF(TX_FRMLEN, len);
665 ctrl |= MACB_BIT(TX_LAST); 660 ctrl |= MACB_BIT(TX_LAST);
@@ -723,27 +718,27 @@ static int macb_alloc_consistent(struct macb *bp)
723 &bp->rx_ring_dma, GFP_KERNEL); 718 &bp->rx_ring_dma, GFP_KERNEL);
724 if (!bp->rx_ring) 719 if (!bp->rx_ring)
725 goto out_err; 720 goto out_err;
726 dev_dbg(&bp->pdev->dev, 721 netdev_dbg(bp->dev,
727 "Allocated RX ring of %d bytes at %08lx (mapped %p)\n", 722 "Allocated RX ring of %d bytes at %08lx (mapped %p)\n",
728 size, (unsigned long)bp->rx_ring_dma, bp->rx_ring); 723 size, (unsigned long)bp->rx_ring_dma, bp->rx_ring);
729 724
730 size = TX_RING_BYTES; 725 size = TX_RING_BYTES;
731 bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size, 726 bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
732 &bp->tx_ring_dma, GFP_KERNEL); 727 &bp->tx_ring_dma, GFP_KERNEL);
733 if (!bp->tx_ring) 728 if (!bp->tx_ring)
734 goto out_err; 729 goto out_err;
735 dev_dbg(&bp->pdev->dev, 730 netdev_dbg(bp->dev,
736 "Allocated TX ring of %d bytes at %08lx (mapped %p)\n", 731 "Allocated TX ring of %d bytes at %08lx (mapped %p)\n",
737 size, (unsigned long)bp->tx_ring_dma, bp->tx_ring); 732 size, (unsigned long)bp->tx_ring_dma, bp->tx_ring);
738 733
739 size = RX_RING_SIZE * RX_BUFFER_SIZE; 734 size = RX_RING_SIZE * RX_BUFFER_SIZE;
740 bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size, 735 bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size,
741 &bp->rx_buffers_dma, GFP_KERNEL); 736 &bp->rx_buffers_dma, GFP_KERNEL);
742 if (!bp->rx_buffers) 737 if (!bp->rx_buffers)
743 goto out_err; 738 goto out_err;
744 dev_dbg(&bp->pdev->dev, 739 netdev_dbg(bp->dev,
745 "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n", 740 "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n",
746 size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers); 741 size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers);
747 742
748 return 0; 743 return 0;
749 744
@@ -797,6 +792,84 @@ static void macb_reset_hw(struct macb *bp)
797 macb_readl(bp, ISR); 792 macb_readl(bp, ISR);
798} 793}
799 794
795static u32 gem_mdc_clk_div(struct macb *bp)
796{
797 u32 config;
798 unsigned long pclk_hz = clk_get_rate(bp->pclk);
799
800 if (pclk_hz <= 20000000)
801 config = GEM_BF(CLK, GEM_CLK_DIV8);
802 else if (pclk_hz <= 40000000)
803 config = GEM_BF(CLK, GEM_CLK_DIV16);
804 else if (pclk_hz <= 80000000)
805 config = GEM_BF(CLK, GEM_CLK_DIV32);
806 else if (pclk_hz <= 120000000)
807 config = GEM_BF(CLK, GEM_CLK_DIV48);
808 else if (pclk_hz <= 160000000)
809 config = GEM_BF(CLK, GEM_CLK_DIV64);
810 else
811 config = GEM_BF(CLK, GEM_CLK_DIV96);
812
813 return config;
814}
815
816static u32 macb_mdc_clk_div(struct macb *bp)
817{
818 u32 config;
819 unsigned long pclk_hz;
820
821 if (macb_is_gem(bp))
822 return gem_mdc_clk_div(bp);
823
824 pclk_hz = clk_get_rate(bp->pclk);
825 if (pclk_hz <= 20000000)
826 config = MACB_BF(CLK, MACB_CLK_DIV8);
827 else if (pclk_hz <= 40000000)
828 config = MACB_BF(CLK, MACB_CLK_DIV16);
829 else if (pclk_hz <= 80000000)
830 config = MACB_BF(CLK, MACB_CLK_DIV32);
831 else
832 config = MACB_BF(CLK, MACB_CLK_DIV64);
833
834 return config;
835}
836
837/*
838 * Get the DMA bus width field of the network configuration register that we
839 * should program. We find the width from decoding the design configuration
840 * register to find the maximum supported data bus width.
841 */
842static u32 macb_dbw(struct macb *bp)
843{
844 if (!macb_is_gem(bp))
845 return 0;
846
847 switch (GEM_BFEXT(DBWDEF, gem_readl(bp, DCFG1))) {
848 case 4:
849 return GEM_BF(DBW, GEM_DBW128);
850 case 2:
851 return GEM_BF(DBW, GEM_DBW64);
852 case 1:
853 default:
854 return GEM_BF(DBW, GEM_DBW32);
855 }
856}
857
858/*
859 * Configure the receive DMA engine to use the correct receive buffer size.
860 * This is a configurable parameter for GEM.
861 */
862static void macb_configure_dma(struct macb *bp)
863{
864 u32 dmacfg;
865
866 if (macb_is_gem(bp)) {
867 dmacfg = gem_readl(bp, DMACFG) & ~GEM_BF(RXBS, -1L);
868 dmacfg |= GEM_BF(RXBS, RX_BUFFER_SIZE / 64);
869 gem_writel(bp, DMACFG, dmacfg);
870 }
871}
872
800static void macb_init_hw(struct macb *bp) 873static void macb_init_hw(struct macb *bp)
801{ 874{
802 u32 config; 875 u32 config;
@@ -804,7 +877,7 @@ static void macb_init_hw(struct macb *bp)
804 macb_reset_hw(bp); 877 macb_reset_hw(bp);
805 __macb_set_hwaddr(bp); 878 __macb_set_hwaddr(bp);
806 879
807 config = macb_readl(bp, NCFGR) & MACB_BF(CLK, -1L); 880 config = macb_mdc_clk_div(bp);
808 config |= MACB_BIT(PAE); /* PAuse Enable */ 881 config |= MACB_BIT(PAE); /* PAuse Enable */
809 config |= MACB_BIT(DRFCS); /* Discard Rx FCS */ 882 config |= MACB_BIT(DRFCS); /* Discard Rx FCS */
810 config |= MACB_BIT(BIG); /* Receive oversized frames */ 883 config |= MACB_BIT(BIG); /* Receive oversized frames */
@@ -812,8 +885,11 @@ static void macb_init_hw(struct macb *bp)
812 config |= MACB_BIT(CAF); /* Copy All Frames */ 885 config |= MACB_BIT(CAF); /* Copy All Frames */
813 if (!(bp->dev->flags & IFF_BROADCAST)) 886 if (!(bp->dev->flags & IFF_BROADCAST))
814 config |= MACB_BIT(NBC); /* No BroadCast */ 887 config |= MACB_BIT(NBC); /* No BroadCast */
888 config |= macb_dbw(bp);
815 macb_writel(bp, NCFGR, config); 889 macb_writel(bp, NCFGR, config);
816 890
891 macb_configure_dma(bp);
892
817 /* Initialize TX and RX buffers */ 893 /* Initialize TX and RX buffers */
818 macb_writel(bp, RBQP, bp->rx_ring_dma); 894 macb_writel(bp, RBQP, bp->rx_ring_dma);
819 macb_writel(bp, TBQP, bp->tx_ring_dma); 895 macb_writel(bp, TBQP, bp->tx_ring_dma);
@@ -909,8 +985,8 @@ static void macb_sethashtable(struct net_device *dev)
909 mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); 985 mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
910 } 986 }
911 987
912 macb_writel(bp, HRB, mc_filter[0]); 988 macb_or_gem_writel(bp, HRB, mc_filter[0]);
913 macb_writel(bp, HRT, mc_filter[1]); 989 macb_or_gem_writel(bp, HRT, mc_filter[1]);
914} 990}
915 991
916/* 992/*
@@ -932,8 +1008,8 @@ static void macb_set_rx_mode(struct net_device *dev)
932 1008
933 if (dev->flags & IFF_ALLMULTI) { 1009 if (dev->flags & IFF_ALLMULTI) {
934 /* Enable all multicast mode */ 1010 /* Enable all multicast mode */
935 macb_writel(bp, HRB, -1); 1011 macb_or_gem_writel(bp, HRB, -1);
936 macb_writel(bp, HRT, -1); 1012 macb_or_gem_writel(bp, HRT, -1);
937 cfg |= MACB_BIT(NCFGR_MTI); 1013 cfg |= MACB_BIT(NCFGR_MTI);
938 } else if (!netdev_mc_empty(dev)) { 1014 } else if (!netdev_mc_empty(dev)) {
939 /* Enable specific multicasts */ 1015 /* Enable specific multicasts */
@@ -941,8 +1017,8 @@ static void macb_set_rx_mode(struct net_device *dev)
941 cfg |= MACB_BIT(NCFGR_MTI); 1017 cfg |= MACB_BIT(NCFGR_MTI);
942 } else if (dev->flags & (~IFF_ALLMULTI)) { 1018 } else if (dev->flags & (~IFF_ALLMULTI)) {
943 /* Disable all multicast mode */ 1019 /* Disable all multicast mode */
944 macb_writel(bp, HRB, 0); 1020 macb_or_gem_writel(bp, HRB, 0);
945 macb_writel(bp, HRT, 0); 1021 macb_or_gem_writel(bp, HRT, 0);
946 cfg &= ~MACB_BIT(NCFGR_MTI); 1022 cfg &= ~MACB_BIT(NCFGR_MTI);
947 } 1023 }
948 1024
@@ -954,7 +1030,7 @@ static int macb_open(struct net_device *dev)
954 struct macb *bp = netdev_priv(dev); 1030 struct macb *bp = netdev_priv(dev);
955 int err; 1031 int err;
956 1032
957 dev_dbg(&bp->pdev->dev, "open\n"); 1033 netdev_dbg(bp->dev, "open\n");
958 1034
959 /* if the phy is not yet register, retry later*/ 1035 /* if the phy is not yet register, retry later*/
960 if (!bp->phy_dev) 1036 if (!bp->phy_dev)
@@ -965,9 +1041,8 @@ static int macb_open(struct net_device *dev)
965 1041
966 err = macb_alloc_consistent(bp); 1042 err = macb_alloc_consistent(bp);
967 if (err) { 1043 if (err) {
968 printk(KERN_ERR 1044 netdev_err(dev, "Unable to allocate DMA memory (error %d)\n",
969 "%s: Unable to allocate DMA memory (error %d)\n", 1045 err);
970 dev->name, err);
971 return err; 1046 return err;
972 } 1047 }
973 1048
@@ -1005,11 +1080,62 @@ static int macb_close(struct net_device *dev)
1005 return 0; 1080 return 0;
1006} 1081}
1007 1082
1083static void gem_update_stats(struct macb *bp)
1084{
1085 u32 __iomem *reg = bp->regs + GEM_OTX;
1086 u32 *p = &bp->hw_stats.gem.tx_octets_31_0;
1087 u32 *end = &bp->hw_stats.gem.rx_udp_checksum_errors + 1;
1088
1089 for (; p < end; p++, reg++)
1090 *p += __raw_readl(reg);
1091}
1092
1093static struct net_device_stats *gem_get_stats(struct macb *bp)
1094{
1095 struct gem_stats *hwstat = &bp->hw_stats.gem;
1096 struct net_device_stats *nstat = &bp->stats;
1097
1098 gem_update_stats(bp);
1099
1100 nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors +
1101 hwstat->rx_alignment_errors +
1102 hwstat->rx_resource_errors +
1103 hwstat->rx_overruns +
1104 hwstat->rx_oversize_frames +
1105 hwstat->rx_jabbers +
1106 hwstat->rx_undersized_frames +
1107 hwstat->rx_length_field_frame_errors);
1108 nstat->tx_errors = (hwstat->tx_late_collisions +
1109 hwstat->tx_excessive_collisions +
1110 hwstat->tx_underrun +
1111 hwstat->tx_carrier_sense_errors);
1112 nstat->multicast = hwstat->rx_multicast_frames;
1113 nstat->collisions = (hwstat->tx_single_collision_frames +
1114 hwstat->tx_multiple_collision_frames +
1115 hwstat->tx_excessive_collisions);
1116 nstat->rx_length_errors = (hwstat->rx_oversize_frames +
1117 hwstat->rx_jabbers +
1118 hwstat->rx_undersized_frames +
1119 hwstat->rx_length_field_frame_errors);
1120 nstat->rx_over_errors = hwstat->rx_resource_errors;
1121 nstat->rx_crc_errors = hwstat->rx_frame_check_sequence_errors;
1122 nstat->rx_frame_errors = hwstat->rx_alignment_errors;
1123 nstat->rx_fifo_errors = hwstat->rx_overruns;
1124 nstat->tx_aborted_errors = hwstat->tx_excessive_collisions;
1125 nstat->tx_carrier_errors = hwstat->tx_carrier_sense_errors;
1126 nstat->tx_fifo_errors = hwstat->tx_underrun;
1127
1128 return nstat;
1129}
1130
1008static struct net_device_stats *macb_get_stats(struct net_device *dev) 1131static struct net_device_stats *macb_get_stats(struct net_device *dev)
1009{ 1132{
1010 struct macb *bp = netdev_priv(dev); 1133 struct macb *bp = netdev_priv(dev);
1011 struct net_device_stats *nstat = &bp->stats; 1134 struct net_device_stats *nstat = &bp->stats;
1012 struct macb_stats *hwstat = &bp->hw_stats; 1135 struct macb_stats *hwstat = &bp->hw_stats.macb;
1136
1137 if (macb_is_gem(bp))
1138 return gem_get_stats(bp);
1013 1139
1014 /* read stats from hardware */ 1140 /* read stats from hardware */
1015 macb_update_stats(bp); 1141 macb_update_stats(bp);
@@ -1117,14 +1243,59 @@ static const struct net_device_ops macb_netdev_ops = {
1117#endif 1243#endif
1118}; 1244};
1119 1245
1246#if defined(CONFIG_OF)
1247static const struct of_device_id macb_dt_ids[] = {
1248 { .compatible = "cdns,at32ap7000-macb" },
1249 { .compatible = "cdns,at91sam9260-macb" },
1250 { .compatible = "cdns,macb" },
1251 { .compatible = "cdns,pc302-gem" },
1252 { .compatible = "cdns,gem" },
1253 { /* sentinel */ }
1254};
1255
1256MODULE_DEVICE_TABLE(of, macb_dt_ids);
1257
1258static int __devinit macb_get_phy_mode_dt(struct platform_device *pdev)
1259{
1260 struct device_node *np = pdev->dev.of_node;
1261
1262 if (np)
1263 return of_get_phy_mode(np);
1264
1265 return -ENODEV;
1266}
1267
1268static int __devinit macb_get_hwaddr_dt(struct macb *bp)
1269{
1270 struct device_node *np = bp->pdev->dev.of_node;
1271 if (np) {
1272 const char *mac = of_get_mac_address(np);
1273 if (mac) {
1274 memcpy(bp->dev->dev_addr, mac, ETH_ALEN);
1275 return 0;
1276 }
1277 }
1278
1279 return -ENODEV;
1280}
1281#else
1282static int __devinit macb_get_phy_mode_dt(struct platform_device *pdev)
1283{
1284 return -ENODEV;
1285}
1286static int __devinit macb_get_hwaddr_dt(struct macb *bp)
1287{
1288 return -ENODEV;
1289}
1290#endif
1291
1120static int __init macb_probe(struct platform_device *pdev) 1292static int __init macb_probe(struct platform_device *pdev)
1121{ 1293{
1122 struct eth_platform_data *pdata; 1294 struct macb_platform_data *pdata;
1123 struct resource *regs; 1295 struct resource *regs;
1124 struct net_device *dev; 1296 struct net_device *dev;
1125 struct macb *bp; 1297 struct macb *bp;
1126 struct phy_device *phydev; 1298 struct phy_device *phydev;
1127 unsigned long pclk_hz;
1128 u32 config; 1299 u32 config;
1129 int err = -ENXIO; 1300 int err = -ENXIO;
1130 1301
@@ -1152,28 +1323,19 @@ static int __init macb_probe(struct platform_device *pdev)
1152 1323
1153 spin_lock_init(&bp->lock); 1324 spin_lock_init(&bp->lock);
1154 1325
1155#if defined(CONFIG_ARCH_AT91) 1326 bp->pclk = clk_get(&pdev->dev, "pclk");
1156 bp->pclk = clk_get(&pdev->dev, "macb_clk");
1157 if (IS_ERR(bp->pclk)) { 1327 if (IS_ERR(bp->pclk)) {
1158 dev_err(&pdev->dev, "failed to get macb_clk\n"); 1328 dev_err(&pdev->dev, "failed to get macb_clk\n");
1159 goto err_out_free_dev; 1329 goto err_out_free_dev;
1160 } 1330 }
1161 clk_enable(bp->pclk); 1331 clk_enable(bp->pclk);
1162#else 1332
1163 bp->pclk = clk_get(&pdev->dev, "pclk");
1164 if (IS_ERR(bp->pclk)) {
1165 dev_err(&pdev->dev, "failed to get pclk\n");
1166 goto err_out_free_dev;
1167 }
1168 bp->hclk = clk_get(&pdev->dev, "hclk"); 1333 bp->hclk = clk_get(&pdev->dev, "hclk");
1169 if (IS_ERR(bp->hclk)) { 1334 if (IS_ERR(bp->hclk)) {
1170 dev_err(&pdev->dev, "failed to get hclk\n"); 1335 dev_err(&pdev->dev, "failed to get hclk\n");
1171 goto err_out_put_pclk; 1336 goto err_out_put_pclk;
1172 } 1337 }
1173
1174 clk_enable(bp->pclk);
1175 clk_enable(bp->hclk); 1338 clk_enable(bp->hclk);
1176#endif
1177 1339
1178 bp->regs = ioremap(regs->start, resource_size(regs)); 1340 bp->regs = ioremap(regs->start, resource_size(regs));
1179 if (!bp->regs) { 1341 if (!bp->regs) {
@@ -1185,9 +1347,8 @@ static int __init macb_probe(struct platform_device *pdev)
1185 dev->irq = platform_get_irq(pdev, 0); 1347 dev->irq = platform_get_irq(pdev, 0);
1186 err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev); 1348 err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev);
1187 if (err) { 1349 if (err) {
1188 printk(KERN_ERR 1350 dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
1189 "%s: Unable to request IRQ %d (error %d)\n", 1351 dev->irq, err);
1190 dev->name, dev->irq, err);
1191 goto err_out_iounmap; 1352 goto err_out_iounmap;
1192 } 1353 }
1193 1354
@@ -1198,31 +1359,37 @@ static int __init macb_probe(struct platform_device *pdev)
1198 dev->base_addr = regs->start; 1359 dev->base_addr = regs->start;
1199 1360
1200 /* Set MII management clock divider */ 1361 /* Set MII management clock divider */
1201 pclk_hz = clk_get_rate(bp->pclk); 1362 config = macb_mdc_clk_div(bp);
1202 if (pclk_hz <= 20000000) 1363 config |= macb_dbw(bp);
1203 config = MACB_BF(CLK, MACB_CLK_DIV8);
1204 else if (pclk_hz <= 40000000)
1205 config = MACB_BF(CLK, MACB_CLK_DIV16);
1206 else if (pclk_hz <= 80000000)
1207 config = MACB_BF(CLK, MACB_CLK_DIV32);
1208 else
1209 config = MACB_BF(CLK, MACB_CLK_DIV64);
1210 macb_writel(bp, NCFGR, config); 1364 macb_writel(bp, NCFGR, config);
1211 1365
1212 macb_get_hwaddr(bp); 1366 err = macb_get_hwaddr_dt(bp);
1213 pdata = pdev->dev.platform_data; 1367 if (err < 0)
1368 macb_get_hwaddr(bp);
1369
1370 err = macb_get_phy_mode_dt(pdev);
1371 if (err < 0) {
1372 pdata = pdev->dev.platform_data;
1373 if (pdata && pdata->is_rmii)
1374 bp->phy_interface = PHY_INTERFACE_MODE_RMII;
1375 else
1376 bp->phy_interface = PHY_INTERFACE_MODE_MII;
1377 } else {
1378 bp->phy_interface = err;
1379 }
1214 1380
1215 if (pdata && pdata->is_rmii) 1381 if (bp->phy_interface == PHY_INTERFACE_MODE_RMII)
1216#if defined(CONFIG_ARCH_AT91) 1382#if defined(CONFIG_ARCH_AT91)
1217 macb_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN)) ); 1383 macb_or_gem_writel(bp, USRIO, (MACB_BIT(RMII) |
1384 MACB_BIT(CLKEN)));
1218#else 1385#else
1219 macb_writel(bp, USRIO, 0); 1386 macb_or_gem_writel(bp, USRIO, 0);
1220#endif 1387#endif
1221 else 1388 else
1222#if defined(CONFIG_ARCH_AT91) 1389#if defined(CONFIG_ARCH_AT91)
1223 macb_writel(bp, USRIO, MACB_BIT(CLKEN)); 1390 macb_or_gem_writel(bp, USRIO, MACB_BIT(CLKEN));
1224#else 1391#else
1225 macb_writel(bp, USRIO, MACB_BIT(MII)); 1392 macb_or_gem_writel(bp, USRIO, MACB_BIT(MII));
1226#endif 1393#endif
1227 1394
1228 bp->tx_pending = DEF_TX_RING_PENDING; 1395 bp->tx_pending = DEF_TX_RING_PENDING;
@@ -1239,13 +1406,13 @@ static int __init macb_probe(struct platform_device *pdev)
1239 1406
1240 platform_set_drvdata(pdev, dev); 1407 platform_set_drvdata(pdev, dev);
1241 1408
1242 printk(KERN_INFO "%s: Atmel MACB at 0x%08lx irq %d (%pM)\n", 1409 netdev_info(dev, "Cadence %s at 0x%08lx irq %d (%pM)\n",
1243 dev->name, dev->base_addr, dev->irq, dev->dev_addr); 1410 macb_is_gem(bp) ? "GEM" : "MACB", dev->base_addr,
1411 dev->irq, dev->dev_addr);
1244 1412
1245 phydev = bp->phy_dev; 1413 phydev = bp->phy_dev;
1246 printk(KERN_INFO "%s: attached PHY driver [%s] " 1414 netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
1247 "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name, 1415 phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
1248 phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
1249 1416
1250 return 0; 1417 return 0;
1251 1418
@@ -1256,14 +1423,10 @@ err_out_free_irq:
1256err_out_iounmap: 1423err_out_iounmap:
1257 iounmap(bp->regs); 1424 iounmap(bp->regs);
1258err_out_disable_clocks: 1425err_out_disable_clocks:
1259#ifndef CONFIG_ARCH_AT91
1260 clk_disable(bp->hclk); 1426 clk_disable(bp->hclk);
1261 clk_put(bp->hclk); 1427 clk_put(bp->hclk);
1262#endif
1263 clk_disable(bp->pclk); 1428 clk_disable(bp->pclk);
1264#ifndef CONFIG_ARCH_AT91
1265err_out_put_pclk: 1429err_out_put_pclk:
1266#endif
1267 clk_put(bp->pclk); 1430 clk_put(bp->pclk);
1268err_out_free_dev: 1431err_out_free_dev:
1269 free_netdev(dev); 1432 free_netdev(dev);
@@ -1289,10 +1452,8 @@ static int __exit macb_remove(struct platform_device *pdev)
1289 unregister_netdev(dev); 1452 unregister_netdev(dev);
1290 free_irq(dev->irq, dev); 1453 free_irq(dev->irq, dev);
1291 iounmap(bp->regs); 1454 iounmap(bp->regs);
1292#ifndef CONFIG_ARCH_AT91
1293 clk_disable(bp->hclk); 1455 clk_disable(bp->hclk);
1294 clk_put(bp->hclk); 1456 clk_put(bp->hclk);
1295#endif
1296 clk_disable(bp->pclk); 1457 clk_disable(bp->pclk);
1297 clk_put(bp->pclk); 1458 clk_put(bp->pclk);
1298 free_netdev(dev); 1459 free_netdev(dev);
@@ -1310,9 +1471,7 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state)
1310 1471
1311 netif_device_detach(netdev); 1472 netif_device_detach(netdev);
1312 1473
1313#ifndef CONFIG_ARCH_AT91
1314 clk_disable(bp->hclk); 1474 clk_disable(bp->hclk);
1315#endif
1316 clk_disable(bp->pclk); 1475 clk_disable(bp->pclk);
1317 1476
1318 return 0; 1477 return 0;
@@ -1324,9 +1483,7 @@ static int macb_resume(struct platform_device *pdev)
1324 struct macb *bp = netdev_priv(netdev); 1483 struct macb *bp = netdev_priv(netdev);
1325 1484
1326 clk_enable(bp->pclk); 1485 clk_enable(bp->pclk);
1327#ifndef CONFIG_ARCH_AT91
1328 clk_enable(bp->hclk); 1486 clk_enable(bp->hclk);
1329#endif
1330 1487
1331 netif_device_attach(netdev); 1488 netif_device_attach(netdev);
1332 1489
@@ -1344,6 +1501,7 @@ static struct platform_driver macb_driver = {
1344 .driver = { 1501 .driver = {
1345 .name = "macb", 1502 .name = "macb",
1346 .owner = THIS_MODULE, 1503 .owner = THIS_MODULE,
1504 .of_match_table = of_match_ptr(macb_dt_ids),
1347 }, 1505 },
1348}; 1506};
1349 1507
@@ -1361,6 +1519,6 @@ module_init(macb_init);
1361module_exit(macb_exit); 1519module_exit(macb_exit);
1362 1520
1363MODULE_LICENSE("GPL"); 1521MODULE_LICENSE("GPL");
1364MODULE_DESCRIPTION("Atmel MACB Ethernet driver"); 1522MODULE_DESCRIPTION("Cadence MACB/GEM Ethernet driver");
1365MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); 1523MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");
1366MODULE_ALIAS("platform:macb"); 1524MODULE_ALIAS("platform:macb");
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index d3212f6db703..335e288f5314 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -59,6 +59,24 @@
59#define MACB_TPQ 0x00bc 59#define MACB_TPQ 0x00bc
60#define MACB_USRIO 0x00c0 60#define MACB_USRIO 0x00c0
61#define MACB_WOL 0x00c4 61#define MACB_WOL 0x00c4
62#define MACB_MID 0x00fc
63
64/* GEM register offsets. */
65#define GEM_NCFGR 0x0004
66#define GEM_USRIO 0x000c
67#define GEM_DMACFG 0x0010
68#define GEM_HRB 0x0080
69#define GEM_HRT 0x0084
70#define GEM_SA1B 0x0088
71#define GEM_SA1T 0x008C
72#define GEM_OTX 0x0100
73#define GEM_DCFG1 0x0280
74#define GEM_DCFG2 0x0284
75#define GEM_DCFG3 0x0288
76#define GEM_DCFG4 0x028c
77#define GEM_DCFG5 0x0290
78#define GEM_DCFG6 0x0294
79#define GEM_DCFG7 0x0298
62 80
63/* Bitfields in NCR */ 81/* Bitfields in NCR */
64#define MACB_LB_OFFSET 0 82#define MACB_LB_OFFSET 0
@@ -126,6 +144,21 @@
126#define MACB_IRXFCS_OFFSET 19 144#define MACB_IRXFCS_OFFSET 19
127#define MACB_IRXFCS_SIZE 1 145#define MACB_IRXFCS_SIZE 1
128 146
147/* GEM specific NCFGR bitfields. */
148#define GEM_CLK_OFFSET 18
149#define GEM_CLK_SIZE 3
150#define GEM_DBW_OFFSET 21
151#define GEM_DBW_SIZE 2
152
153/* Constants for data bus width. */
154#define GEM_DBW32 0
155#define GEM_DBW64 1
156#define GEM_DBW128 2
157
158/* Bitfields in DMACFG. */
159#define GEM_RXBS_OFFSET 16
160#define GEM_RXBS_SIZE 8
161
129/* Bitfields in NSR */ 162/* Bitfields in NSR */
130#define MACB_NSR_LINK_OFFSET 0 163#define MACB_NSR_LINK_OFFSET 0
131#define MACB_NSR_LINK_SIZE 1 164#define MACB_NSR_LINK_SIZE 1
@@ -228,12 +261,30 @@
228#define MACB_WOL_MTI_OFFSET 19 261#define MACB_WOL_MTI_OFFSET 19
229#define MACB_WOL_MTI_SIZE 1 262#define MACB_WOL_MTI_SIZE 1
230 263
264/* Bitfields in MID */
265#define MACB_IDNUM_OFFSET 16
266#define MACB_IDNUM_SIZE 16
267#define MACB_REV_OFFSET 0
268#define MACB_REV_SIZE 16
269
270/* Bitfields in DCFG1. */
271#define GEM_DBWDEF_OFFSET 25
272#define GEM_DBWDEF_SIZE 3
273
231/* Constants for CLK */ 274/* Constants for CLK */
232#define MACB_CLK_DIV8 0 275#define MACB_CLK_DIV8 0
233#define MACB_CLK_DIV16 1 276#define MACB_CLK_DIV16 1
234#define MACB_CLK_DIV32 2 277#define MACB_CLK_DIV32 2
235#define MACB_CLK_DIV64 3 278#define MACB_CLK_DIV64 3
236 279
280/* GEM specific constants for CLK. */
281#define GEM_CLK_DIV8 0
282#define GEM_CLK_DIV16 1
283#define GEM_CLK_DIV32 2
284#define GEM_CLK_DIV48 3
285#define GEM_CLK_DIV64 4
286#define GEM_CLK_DIV96 5
287
237/* Constants for MAN register */ 288/* Constants for MAN register */
238#define MACB_MAN_SOF 1 289#define MACB_MAN_SOF 1
239#define MACB_MAN_WRITE 1 290#define MACB_MAN_WRITE 1
@@ -254,11 +305,52 @@
254 << MACB_##name##_OFFSET)) \ 305 << MACB_##name##_OFFSET)) \
255 | MACB_BF(name,value)) 306 | MACB_BF(name,value))
256 307
308#define GEM_BIT(name) \
309 (1 << GEM_##name##_OFFSET)
310#define GEM_BF(name, value) \
311 (((value) & ((1 << GEM_##name##_SIZE) - 1)) \
312 << GEM_##name##_OFFSET)
313#define GEM_BFEXT(name, value)\
314 (((value) >> GEM_##name##_OFFSET) \
315 & ((1 << GEM_##name##_SIZE) - 1))
316#define GEM_BFINS(name, value, old) \
317 (((old) & ~(((1 << GEM_##name##_SIZE) - 1) \
318 << GEM_##name##_OFFSET)) \
319 | GEM_BF(name, value))
320
257/* Register access macros */ 321/* Register access macros */
258#define macb_readl(port,reg) \ 322#define macb_readl(port,reg) \
259 __raw_readl((port)->regs + MACB_##reg) 323 __raw_readl((port)->regs + MACB_##reg)
260#define macb_writel(port,reg,value) \ 324#define macb_writel(port,reg,value) \
261 __raw_writel((value), (port)->regs + MACB_##reg) 325 __raw_writel((value), (port)->regs + MACB_##reg)
326#define gem_readl(port, reg) \
327 __raw_readl((port)->regs + GEM_##reg)
328#define gem_writel(port, reg, value) \
329 __raw_writel((value), (port)->regs + GEM_##reg)
330
331/*
332 * Conditional GEM/MACB macros. These perform the operation to the correct
333 * register dependent on whether the device is a GEM or a MACB. For registers
334 * and bitfields that are common across both devices, use macb_{read,write}l
335 * to avoid the cost of the conditional.
336 */
337#define macb_or_gem_writel(__bp, __reg, __value) \
338 ({ \
339 if (macb_is_gem((__bp))) \
340 gem_writel((__bp), __reg, __value); \
341 else \
342 macb_writel((__bp), __reg, __value); \
343 })
344
345#define macb_or_gem_readl(__bp, __reg) \
346 ({ \
347 u32 __v; \
348 if (macb_is_gem((__bp))) \
349 __v = gem_readl((__bp), __reg); \
350 else \
351 __v = macb_readl((__bp), __reg); \
352 __v; \
353 })
262 354
263struct dma_desc { 355struct dma_desc {
264 u32 addr; 356 u32 addr;
@@ -358,6 +450,54 @@ struct macb_stats {
358 u32 tx_pause_frames; 450 u32 tx_pause_frames;
359}; 451};
360 452
453struct gem_stats {
454 u32 tx_octets_31_0;
455 u32 tx_octets_47_32;
456 u32 tx_frames;
457 u32 tx_broadcast_frames;
458 u32 tx_multicast_frames;
459 u32 tx_pause_frames;
460 u32 tx_64_byte_frames;
461 u32 tx_65_127_byte_frames;
462 u32 tx_128_255_byte_frames;
463 u32 tx_256_511_byte_frames;
464 u32 tx_512_1023_byte_frames;
465 u32 tx_1024_1518_byte_frames;
466 u32 tx_greater_than_1518_byte_frames;
467 u32 tx_underrun;
468 u32 tx_single_collision_frames;
469 u32 tx_multiple_collision_frames;
470 u32 tx_excessive_collisions;
471 u32 tx_late_collisions;
472 u32 tx_deferred_frames;
473 u32 tx_carrier_sense_errors;
474 u32 rx_octets_31_0;
475 u32 rx_octets_47_32;
476 u32 rx_frames;
477 u32 rx_broadcast_frames;
478 u32 rx_multicast_frames;
479 u32 rx_pause_frames;
480 u32 rx_64_byte_frames;
481 u32 rx_65_127_byte_frames;
482 u32 rx_128_255_byte_frames;
483 u32 rx_256_511_byte_frames;
484 u32 rx_512_1023_byte_frames;
485 u32 rx_1024_1518_byte_frames;
486 u32 rx_greater_than_1518_byte_frames;
487 u32 rx_undersized_frames;
488 u32 rx_oversize_frames;
489 u32 rx_jabbers;
490 u32 rx_frame_check_sequence_errors;
491 u32 rx_length_field_frame_errors;
492 u32 rx_symbol_errors;
493 u32 rx_alignment_errors;
494 u32 rx_resource_errors;
495 u32 rx_overruns;
496 u32 rx_ip_header_checksum_errors;
497 u32 rx_tcp_checksum_errors;
498 u32 rx_udp_checksum_errors;
499};
500
361struct macb { 501struct macb {
362 void __iomem *regs; 502 void __iomem *regs;
363 503
@@ -376,7 +516,10 @@ struct macb {
376 struct net_device *dev; 516 struct net_device *dev;
377 struct napi_struct napi; 517 struct napi_struct napi;
378 struct net_device_stats stats; 518 struct net_device_stats stats;
379 struct macb_stats hw_stats; 519 union {
520 struct macb_stats macb;
521 struct gem_stats gem;
522 } hw_stats;
380 523
381 dma_addr_t rx_ring_dma; 524 dma_addr_t rx_ring_dma;
382 dma_addr_t tx_ring_dma; 525 dma_addr_t tx_ring_dma;
@@ -389,6 +532,13 @@ struct macb {
389 unsigned int link; 532 unsigned int link;
390 unsigned int speed; 533 unsigned int speed;
391 unsigned int duplex; 534 unsigned int duplex;
535
536 phy_interface_t phy_interface;
392}; 537};
393 538
539static inline bool macb_is_gem(struct macb *bp)
540{
541 return MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2;
542}
543
394#endif /* _MACB_H */ 544#endif /* _MACB_H */
diff --git a/drivers/pcmcia/pxa2xx_cm_x255.c b/drivers/pcmcia/pxa2xx_cm_x255.c
index 0b4f946cf13a..31ab6ddf52c9 100644
--- a/drivers/pcmcia/pxa2xx_cm_x255.c
+++ b/drivers/pcmcia/pxa2xx_cm_x255.c
@@ -16,8 +16,6 @@
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/export.h> 17#include <linux/export.h>
18 18
19#include <asm/mach-types.h>
20
21#include "soc_common.h" 19#include "soc_common.h"
22 20
23#define GPIO_PCMCIA_SKTSEL (54) 21#define GPIO_PCMCIA_SKTSEL (54)
@@ -27,15 +25,15 @@
27#define GPIO_PCMCIA_S1_RDYINT (8) 25#define GPIO_PCMCIA_S1_RDYINT (8)
28#define GPIO_PCMCIA_RESET (9) 26#define GPIO_PCMCIA_RESET (9)
29 27
30#define PCMCIA_S0_CD_VALID IRQ_GPIO(GPIO_PCMCIA_S0_CD_VALID) 28#define PCMCIA_S0_CD_VALID gpio_to_irq(GPIO_PCMCIA_S0_CD_VALID)
31#define PCMCIA_S1_CD_VALID IRQ_GPIO(GPIO_PCMCIA_S1_CD_VALID) 29#define PCMCIA_S1_CD_VALID gpio_to_irq(GPIO_PCMCIA_S1_CD_VALID)
32#define PCMCIA_S0_RDYINT IRQ_GPIO(GPIO_PCMCIA_S0_RDYINT) 30#define PCMCIA_S0_RDYINT gpio_to_irq(GPIO_PCMCIA_S0_RDYINT)
33#define PCMCIA_S1_RDYINT IRQ_GPIO(GPIO_PCMCIA_S1_RDYINT) 31#define PCMCIA_S1_RDYINT gpio_to_irq(GPIO_PCMCIA_S1_RDYINT)
34 32
35 33
36static struct pcmcia_irqs irqs[] = { 34static struct pcmcia_irqs irqs[] = {
37 { 0, PCMCIA_S0_CD_VALID, "PCMCIA0 CD" }, 35 { .sock = 0, .str = "PCMCIA0 CD" },
38 { 1, PCMCIA_S1_CD_VALID, "PCMCIA1 CD" }, 36 { .sock = 1, .str = "PCMCIA1 CD" },
39}; 37};
40 38
41static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 39static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
@@ -46,6 +44,8 @@ static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
46 gpio_direction_output(GPIO_PCMCIA_RESET, 0); 44 gpio_direction_output(GPIO_PCMCIA_RESET, 0);
47 45
48 skt->socket.pci_irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; 46 skt->socket.pci_irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT;
47 irqs[0].irq = PCMCIA_S0_CD_VALID;
48 irqs[1].irq = PCMCIA_S1_CD_VALID;
49 ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); 49 ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
50 if (!ret) 50 if (!ret)
51 gpio_free(GPIO_PCMCIA_RESET); 51 gpio_free(GPIO_PCMCIA_RESET);
diff --git a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c
index 923f315926ef..3dc7621a0767 100644
--- a/drivers/pcmcia/pxa2xx_cm_x270.c
+++ b/drivers/pcmcia/pxa2xx_cm_x270.c
@@ -16,20 +16,18 @@
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/export.h> 17#include <linux/export.h>
18 18
19#include <asm/mach-types.h>
20
21#include "soc_common.h" 19#include "soc_common.h"
22 20
23#define GPIO_PCMCIA_S0_CD_VALID (84) 21#define GPIO_PCMCIA_S0_CD_VALID (84)
24#define GPIO_PCMCIA_S0_RDYINT (82) 22#define GPIO_PCMCIA_S0_RDYINT (82)
25#define GPIO_PCMCIA_RESET (53) 23#define GPIO_PCMCIA_RESET (53)
26 24
27#define PCMCIA_S0_CD_VALID IRQ_GPIO(GPIO_PCMCIA_S0_CD_VALID) 25#define PCMCIA_S0_CD_VALID gpio_to_irq(GPIO_PCMCIA_S0_CD_VALID)
28#define PCMCIA_S0_RDYINT IRQ_GPIO(GPIO_PCMCIA_S0_RDYINT) 26#define PCMCIA_S0_RDYINT gpio_to_irq(GPIO_PCMCIA_S0_RDYINT)
29 27
30 28
31static struct pcmcia_irqs irqs[] = { 29static struct pcmcia_irqs irqs[] = {
32 { 0, PCMCIA_S0_CD_VALID, "PCMCIA0 CD" }, 30 { .sock = 0, .str = "PCMCIA0 CD" },
33}; 31};
34 32
35static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 33static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
@@ -40,6 +38,7 @@ static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
40 gpio_direction_output(GPIO_PCMCIA_RESET, 0); 38 gpio_direction_output(GPIO_PCMCIA_RESET, 0);
41 39
42 skt->socket.pci_irq = PCMCIA_S0_RDYINT; 40 skt->socket.pci_irq = PCMCIA_S0_RDYINT;
41 irqs[0].irq = PCMCIA_S0_CD_VALID;
43 ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); 42 ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
44 if (!ret) 43 if (!ret)
45 gpio_free(GPIO_PCMCIA_RESET); 44 gpio_free(GPIO_PCMCIA_RESET);
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 791f11bed606..75823a1abeb6 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -48,6 +48,7 @@ config USB_ARCH_HAS_OHCI
48 default y if ARCH_DAVINCI_DA8XX 48 default y if ARCH_DAVINCI_DA8XX
49 default y if ARCH_CNS3XXX 49 default y if ARCH_CNS3XXX
50 default y if PLAT_SPEAR 50 default y if PLAT_SPEAR
51 default y if ARCH_EXYNOS
51 # PPC: 52 # PPC:
52 default y if STB03xxx 53 default y if STB03xxx
53 default y if PPC_MPC52xx 54 default y if PPC_MPC52xx
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 060e0e2b1ae6..eea85dc16826 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -371,6 +371,12 @@ config USB_OHCI_SH
371 Enables support for the on-chip OHCI controller on the SuperH. 371 Enables support for the on-chip OHCI controller on the SuperH.
372 If you use the PCI OHCI controller, this option is not necessary. 372 If you use the PCI OHCI controller, this option is not necessary.
373 373
374config USB_OHCI_EXYNOS
375 boolean "OHCI support for Samsung EXYNOS SoC Series"
376 depends on USB_OHCI_HCD && ARCH_EXYNOS
377 help
378 Enable support for the Samsung Exynos SOC's on-chip OHCI controller.
379
374config USB_CNS3XXX_OHCI 380config USB_CNS3XXX_OHCI
375 bool "Cavium CNS3XXX OHCI Module" 381 bool "Cavium CNS3XXX OHCI Module"
376 depends on USB_OHCI_HCD && ARCH_CNS3XXX 382 depends on USB_OHCI_HCD && ARCH_CNS3XXX
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index e39b0297bad1..568cefbd63a2 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -41,6 +41,7 @@
41#include <linux/usb/ulpi.h> 41#include <linux/usb/ulpi.h>
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <linux/regulator/consumer.h> 43#include <linux/regulator/consumer.h>
44#include <linux/pm_runtime.h>
44 45
45/* EHCI Register Set */ 46/* EHCI Register Set */
46#define EHCI_INSNREG04 (0xA0) 47#define EHCI_INSNREG04 (0xA0)
@@ -190,11 +191,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
190 } 191 }
191 } 192 }
192 193
193 ret = omap_usbhs_enable(dev); 194 pm_runtime_enable(dev);
194 if (ret) { 195 pm_runtime_get_sync(dev);
195 dev_err(dev, "failed to start usbhs with err %d\n", ret);
196 goto err_enable;
197 }
198 196
199 /* 197 /*
200 * An undocumented "feature" in the OMAP3 EHCI controller, 198 * An undocumented "feature" in the OMAP3 EHCI controller,
@@ -240,11 +238,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
240 return 0; 238 return 0;
241 239
242err_add_hcd: 240err_add_hcd:
243 omap_usbhs_disable(dev);
244
245err_enable:
246 disable_put_regulator(pdata); 241 disable_put_regulator(pdata);
247 usb_put_hcd(hcd); 242 pm_runtime_put_sync(dev);
248 243
249err_io: 244err_io:
250 iounmap(regs); 245 iounmap(regs);
@@ -266,10 +261,12 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
266 struct usb_hcd *hcd = dev_get_drvdata(dev); 261 struct usb_hcd *hcd = dev_get_drvdata(dev);
267 262
268 usb_remove_hcd(hcd); 263 usb_remove_hcd(hcd);
269 omap_usbhs_disable(dev);
270 disable_put_regulator(dev->platform_data); 264 disable_put_regulator(dev->platform_data);
271 iounmap(hcd->regs); 265 iounmap(hcd->regs);
272 usb_put_hcd(hcd); 266 usb_put_hcd(hcd);
267 pm_runtime_put_sync(dev);
268 pm_runtime_disable(dev);
269
273 return 0; 270 return 0;
274} 271}
275 272
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
new file mode 100644
index 000000000000..55aa35aa3d7b
--- /dev/null
+++ b/drivers/usb/host/ohci-exynos.c
@@ -0,0 +1,274 @@
1/*
2 * SAMSUNG EXYNOS USB HOST OHCI Controller
3 *
4 * Copyright (C) 2011 Samsung Electronics Co.Ltd
5 * Author: Jingoo Han <jg1.han@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#include <linux/clk.h>
15#include <linux/platform_device.h>
16#include <mach/ohci.h>
17#include <plat/usb-phy.h>
18
19struct exynos_ohci_hcd {
20 struct device *dev;
21 struct usb_hcd *hcd;
22 struct clk *clk;
23};
24
25static int ohci_exynos_start(struct usb_hcd *hcd)
26{
27 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
28 int ret;
29
30 ohci_dbg(ohci, "ohci_exynos_start, ohci:%p", ohci);
31
32 ret = ohci_init(ohci);
33 if (ret < 0)
34 return ret;
35
36 ret = ohci_run(ohci);
37 if (ret < 0) {
38 err("can't start %s", hcd->self.bus_name);
39 ohci_stop(hcd);
40 return ret;
41 }
42
43 return 0;
44}
45
46static const struct hc_driver exynos_ohci_hc_driver = {
47 .description = hcd_name,
48 .product_desc = "EXYNOS OHCI Host Controller",
49 .hcd_priv_size = sizeof(struct ohci_hcd),
50
51 .irq = ohci_irq,
52 .flags = HCD_MEMORY|HCD_USB11,
53
54 .start = ohci_exynos_start,
55 .stop = ohci_stop,
56 .shutdown = ohci_shutdown,
57
58 .get_frame_number = ohci_get_frame,
59
60 .urb_enqueue = ohci_urb_enqueue,
61 .urb_dequeue = ohci_urb_dequeue,
62 .endpoint_disable = ohci_endpoint_disable,
63
64 .hub_status_data = ohci_hub_status_data,
65 .hub_control = ohci_hub_control,
66#ifdef CONFIG_PM
67 .bus_suspend = ohci_bus_suspend,
68 .bus_resume = ohci_bus_resume,
69#endif
70 .start_port_reset = ohci_start_port_reset,
71};
72
73static int __devinit exynos_ohci_probe(struct platform_device *pdev)
74{
75 struct exynos4_ohci_platdata *pdata;
76 struct exynos_ohci_hcd *exynos_ohci;
77 struct usb_hcd *hcd;
78 struct ohci_hcd *ohci;
79 struct resource *res;
80 int irq;
81 int err;
82
83 pdata = pdev->dev.platform_data;
84 if (!pdata) {
85 dev_err(&pdev->dev, "No platform data defined\n");
86 return -EINVAL;
87 }
88
89 exynos_ohci = kzalloc(sizeof(struct exynos_ohci_hcd), GFP_KERNEL);
90 if (!exynos_ohci)
91 return -ENOMEM;
92
93 exynos_ohci->dev = &pdev->dev;
94
95 hcd = usb_create_hcd(&exynos_ohci_hc_driver, &pdev->dev,
96 dev_name(&pdev->dev));
97 if (!hcd) {
98 dev_err(&pdev->dev, "Unable to create HCD\n");
99 err = -ENOMEM;
100 goto fail_hcd;
101 }
102
103 exynos_ohci->hcd = hcd;
104 exynos_ohci->clk = clk_get(&pdev->dev, "usbhost");
105
106 if (IS_ERR(exynos_ohci->clk)) {
107 dev_err(&pdev->dev, "Failed to get usbhost clock\n");
108 err = PTR_ERR(exynos_ohci->clk);
109 goto fail_clk;
110 }
111
112 err = clk_enable(exynos_ohci->clk);
113 if (err)
114 goto fail_clken;
115
116 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
117 if (!res) {
118 dev_err(&pdev->dev, "Failed to get I/O memory\n");
119 err = -ENXIO;
120 goto fail_io;
121 }
122
123 hcd->rsrc_start = res->start;
124 hcd->rsrc_len = resource_size(res);
125 hcd->regs = ioremap(res->start, resource_size(res));
126 if (!hcd->regs) {
127 dev_err(&pdev->dev, "Failed to remap I/O memory\n");
128 err = -ENOMEM;
129 goto fail_io;
130 }
131
132 irq = platform_get_irq(pdev, 0);
133 if (!irq) {
134 dev_err(&pdev->dev, "Failed to get IRQ\n");
135 err = -ENODEV;
136 goto fail;
137 }
138
139 if (pdata->phy_init)
140 pdata->phy_init(pdev, S5P_USB_PHY_HOST);
141
142 ohci = hcd_to_ohci(hcd);
143 ohci_hcd_init(ohci);
144
145 err = usb_add_hcd(hcd, irq, IRQF_SHARED);
146 if (err) {
147 dev_err(&pdev->dev, "Failed to add USB HCD\n");
148 goto fail;
149 }
150
151 platform_set_drvdata(pdev, exynos_ohci);
152
153 return 0;
154
155fail:
156 iounmap(hcd->regs);
157fail_io:
158 clk_disable(exynos_ohci->clk);
159fail_clken:
160 clk_put(exynos_ohci->clk);
161fail_clk:
162 usb_put_hcd(hcd);
163fail_hcd:
164 kfree(exynos_ohci);
165 return err;
166}
167
168static int __devexit exynos_ohci_remove(struct platform_device *pdev)
169{
170 struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data;
171 struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev);
172 struct usb_hcd *hcd = exynos_ohci->hcd;
173
174 usb_remove_hcd(hcd);
175
176 if (pdata && pdata->phy_exit)
177 pdata->phy_exit(pdev, S5P_USB_PHY_HOST);
178
179 iounmap(hcd->regs);
180
181 clk_disable(exynos_ohci->clk);
182 clk_put(exynos_ohci->clk);
183
184 usb_put_hcd(hcd);
185 kfree(exynos_ohci);
186
187 return 0;
188}
189
190static void exynos_ohci_shutdown(struct platform_device *pdev)
191{
192 struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev);
193 struct usb_hcd *hcd = exynos_ohci->hcd;
194
195 if (hcd->driver->shutdown)
196 hcd->driver->shutdown(hcd);
197}
198
199#ifdef CONFIG_PM
200static int exynos_ohci_suspend(struct device *dev)
201{
202 struct exynos_ohci_hcd *exynos_ohci = dev_get_drvdata(dev);
203 struct usb_hcd *hcd = exynos_ohci->hcd;
204 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
205 struct platform_device *pdev = to_platform_device(dev);
206 struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data;
207 unsigned long flags;
208 int rc = 0;
209
210 /*
211 * Root hub was already suspended. Disable irq emission and
212 * mark HW unaccessible, bail out if RH has been resumed. Use
213 * the spinlock to properly synchronize with possible pending
214 * RH suspend or resume activity.
215 *
216 * This is still racy as hcd->state is manipulated outside of
217 * any locks =P But that will be a different fix.
218 */
219 spin_lock_irqsave(&ohci->lock, flags);
220 if (hcd->state != HC_STATE_SUSPENDED && hcd->state != HC_STATE_HALT) {
221 rc = -EINVAL;
222 goto fail;
223 }
224
225 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
226
227 if (pdata && pdata->phy_exit)
228 pdata->phy_exit(pdev, S5P_USB_PHY_HOST);
229fail:
230 spin_unlock_irqrestore(&ohci->lock, flags);
231
232 return rc;
233}
234
235static int exynos_ohci_resume(struct device *dev)
236{
237 struct exynos_ohci_hcd *exynos_ohci = dev_get_drvdata(dev);
238 struct usb_hcd *hcd = exynos_ohci->hcd;
239 struct platform_device *pdev = to_platform_device(dev);
240 struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data;
241
242 if (pdata && pdata->phy_init)
243 pdata->phy_init(pdev, S5P_USB_PHY_HOST);
244
245 /* Mark hardware accessible again as we are out of D3 state by now */
246 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
247
248 ohci_finish_controller_resume(hcd);
249
250 return 0;
251}
252#else
253#define exynos_ohci_suspend NULL
254#define exynos_ohci_resume NULL
255#endif
256
257static const struct dev_pm_ops exynos_ohci_pm_ops = {
258 .suspend = exynos_ohci_suspend,
259 .resume = exynos_ohci_resume,
260};
261
262static struct platform_driver exynos_ohci_driver = {
263 .probe = exynos_ohci_probe,
264 .remove = __devexit_p(exynos_ohci_remove),
265 .shutdown = exynos_ohci_shutdown,
266 .driver = {
267 .name = "exynos-ohci",
268 .owner = THIS_MODULE,
269 .pm = &exynos_ohci_pm_ops,
270 }
271};
272
273MODULE_ALIAS("platform:exynos-ohci");
274MODULE_AUTHOR("Jingoo Han <jg1.han@samsung.com>");
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index b2639191549e..a1006ff79384 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1005,6 +1005,11 @@ MODULE_LICENSE ("GPL");
1005#define PLATFORM_DRIVER ohci_hcd_s3c2410_driver 1005#define PLATFORM_DRIVER ohci_hcd_s3c2410_driver
1006#endif 1006#endif
1007 1007
1008#ifdef CONFIG_USB_OHCI_EXYNOS
1009#include "ohci-exynos.c"
1010#define PLATFORM_DRIVER exynos_ohci_driver
1011#endif
1012
1008#ifdef CONFIG_USB_OHCI_HCD_OMAP1 1013#ifdef CONFIG_USB_OHCI_HCD_OMAP1
1009#include "ohci-omap.c" 1014#include "ohci-omap.c"
1010#define OMAP1_PLATFORM_DRIVER ohci_hcd_omap_driver 1015#define OMAP1_PLATFORM_DRIVER ohci_hcd_omap_driver
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index 516ebc4d6cc2..1b8133b6e451 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -31,6 +31,7 @@
31 31
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <plat/usb.h> 33#include <plat/usb.h>
34#include <linux/pm_runtime.h>
34 35
35/*-------------------------------------------------------------------------*/ 36/*-------------------------------------------------------------------------*/
36 37
@@ -134,7 +135,7 @@ static int __devinit ohci_hcd_omap3_probe(struct platform_device *pdev)
134 int irq; 135 int irq;
135 136
136 if (usb_disabled()) 137 if (usb_disabled())
137 goto err_end; 138 return -ENODEV;
138 139
139 if (!dev->parent) { 140 if (!dev->parent) {
140 dev_err(dev, "Missing parent device\n"); 141 dev_err(dev, "Missing parent device\n");
@@ -172,11 +173,8 @@ static int __devinit ohci_hcd_omap3_probe(struct platform_device *pdev)
172 hcd->rsrc_len = resource_size(res); 173 hcd->rsrc_len = resource_size(res);
173 hcd->regs = regs; 174 hcd->regs = regs;
174 175
175 ret = omap_usbhs_enable(dev); 176 pm_runtime_enable(dev);
176 if (ret) { 177 pm_runtime_get_sync(dev);
177 dev_dbg(dev, "failed to start ohci\n");
178 goto err_end;
179 }
180 178
181 ohci_hcd_init(hcd_to_ohci(hcd)); 179 ohci_hcd_init(hcd_to_ohci(hcd));
182 180
@@ -189,9 +187,7 @@ static int __devinit ohci_hcd_omap3_probe(struct platform_device *pdev)
189 return 0; 187 return 0;
190 188
191err_add_hcd: 189err_add_hcd:
192 omap_usbhs_disable(dev); 190 pm_runtime_put_sync(dev);
193
194err_end:
195 usb_put_hcd(hcd); 191 usb_put_hcd(hcd);
196 192
197err_io: 193err_io:
@@ -220,9 +216,9 @@ static int __devexit ohci_hcd_omap3_remove(struct platform_device *pdev)
220 216
221 iounmap(hcd->regs); 217 iounmap(hcd->regs);
222 usb_remove_hcd(hcd); 218 usb_remove_hcd(hcd);
223 omap_usbhs_disable(dev); 219 pm_runtime_put_sync(dev);
220 pm_runtime_disable(dev);
224 usb_put_hcd(hcd); 221 usb_put_hcd(hcd);
225
226 return 0; 222 return 0;
227} 223}
228 224
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h
new file mode 100644
index 000000000000..05071ee34c3f
--- /dev/null
+++ b/include/linux/gpio-pxa.h
@@ -0,0 +1,16 @@
1#ifndef __GPIO_PXA_H
2#define __GPIO_PXA_H
3
4#define GPIO_bit(x) (1 << ((x) & 0x1f))
5
6#define gpio_to_bank(gpio) ((gpio) >> 5)
7
8/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
9 * Those cases currently cause holes in the GPIO number space, the
10 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
11 */
12extern int pxa_last_gpio;
13
14extern int pxa_irq_to_gpio(int irq);
15
16#endif /* __GPIO_PXA_H */
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
new file mode 100644
index 000000000000..e7c748fb6053
--- /dev/null
+++ b/include/linux/platform_data/macb.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __MACB_PDATA_H__
9#define __MACB_PDATA_H__
10
11struct macb_platform_data {
12 u32 phy_mask;
13 u8 phy_irq_pin; /* PHY IRQ */
14 u8 is_rmii; /* using RMII interface? */
15};
16
17#endif /* __MACB_PDATA_H__ */
diff --git a/include/sound/saif.h b/include/sound/saif.h
index d0e0de7984ec..f22f3e16edf4 100644
--- a/include/sound/saif.h
+++ b/include/sound/saif.h
@@ -10,7 +10,7 @@
10#define __SOUND_SAIF_H__ 10#define __SOUND_SAIF_H__
11 11
12struct mxs_saif_platform_data { 12struct mxs_saif_platform_data {
13 int (*init) (void); 13 bool master_mode; /* if true use master mode */
14 int (*get_master_id) (unsigned int saif_id); 14 int master_id; /* id of the master if in slave mode */
15}; 15};
16#endif 16#endif
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 76dc74d24fc2..1ef697fe1731 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -625,13 +625,6 @@ static int mxs_saif_probe(struct platform_device *pdev)
625 if (pdev->id >= ARRAY_SIZE(mxs_saif)) 625 if (pdev->id >= ARRAY_SIZE(mxs_saif))
626 return -EINVAL; 626 return -EINVAL;
627 627
628 pdata = pdev->dev.platform_data;
629 if (pdata && pdata->init) {
630 ret = pdata->init();
631 if (ret)
632 return ret;
633 }
634
635 saif = kzalloc(sizeof(*saif), GFP_KERNEL); 628 saif = kzalloc(sizeof(*saif), GFP_KERNEL);
636 if (!saif) 629 if (!saif)
637 return -ENOMEM; 630 return -ENOMEM;
@@ -639,12 +632,17 @@ static int mxs_saif_probe(struct platform_device *pdev)
639 mxs_saif[pdev->id] = saif; 632 mxs_saif[pdev->id] = saif;
640 saif->id = pdev->id; 633 saif->id = pdev->id;
641 634
642 saif->master_id = saif->id; 635 pdata = pdev->dev.platform_data;
643 if (pdata && pdata->get_master_id) { 636 if (pdata && !pdata->master_mode) {
644 saif->master_id = pdata->get_master_id(saif->id); 637 saif->master_id = pdata->master_id;
645 if (saif->master_id < 0 || 638 if (saif->master_id < 0 ||
646 saif->master_id >= ARRAY_SIZE(mxs_saif)) 639 saif->master_id >= ARRAY_SIZE(mxs_saif) ||
640 saif->master_id == saif->id) {
641 dev_err(&pdev->dev, "get wrong master id\n");
647 return -EINVAL; 642 return -EINVAL;
643 }
644 } else {
645 saif->master_id = saif->id;
648 } 646 }
649 647
650 saif->clk = clk_get(&pdev->dev, NULL); 648 saif->clk = clk_get(&pdev->dev, NULL);