]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Merge branch 'samsung/driver' into next/drivers
authorArnd Bergmann <arnd@arndb.de>
Wed, 28 Dec 2011 00:18:56 +0000 (00:18 +0000)
committerArnd Bergmann <arnd@arndb.de>
Wed, 28 Dec 2011 00:18:56 +0000 (00:18 +0000)
* samsung/driver:
  ARM: EXYNOS: Modified files for SPI consolidation work
  ARM: S5P64X0: Enable SDHCI support
  ARM: S5P64X0: Add lookup of sdhci-s3c clocks using generic names
  ARM: S5P64X0: Add HSMMC setup for host Controller

200 files changed:
Documentation/devicetree/bindings/net/macb.txt [new file with mode: 0644]
arch/arm/Kconfig
arch/arm/boot/dts/at91sam9g20.dtsi
arch/arm/boot/dts/at91sam9g45.dtsi
arch/arm/boot/dts/at91sam9m10g45ek.dts
arch/arm/boot/dts/usb_a9g20.dts
arch/arm/mach-at91/at91cap9.c
arch/arm/mach-at91/at91cap9_devices.c
arch/arm/mach-at91/at91rm9200_devices.c
arch/arm/mach-at91/at91sam9260.c
arch/arm/mach-at91/at91sam9260_devices.c
arch/arm/mach-at91/at91sam9263.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9g45.c
arch/arm/mach-at91/at91sam9g45_devices.c
arch/arm/mach-at91/board-1arm.c
arch/arm/mach-at91/board-afeb-9260v1.c
arch/arm/mach-at91/board-cam60.c
arch/arm/mach-at91/board-cap9adk.c
arch/arm/mach-at91/board-carmeva.c
arch/arm/mach-at91/board-cpu9krea.c
arch/arm/mach-at91/board-cpuat91.c
arch/arm/mach-at91/board-csb337.c
arch/arm/mach-at91/board-csb637.c
arch/arm/mach-at91/board-eb9200.c
arch/arm/mach-at91/board-ecbat91.c
arch/arm/mach-at91/board-eco920.c
arch/arm/mach-at91/board-foxg20.c
arch/arm/mach-at91/board-gsia18s.c
arch/arm/mach-at91/board-kafa.c
arch/arm/mach-at91/board-kb9202.c
arch/arm/mach-at91/board-neocore926.c
arch/arm/mach-at91/board-pcontrol-g20.c
arch/arm/mach-at91/board-picotux200.c
arch/arm/mach-at91/board-qil-a9260.c
arch/arm/mach-at91/board-rm9200dk.c
arch/arm/mach-at91/board-rm9200ek.c
arch/arm/mach-at91/board-rsi-ews.c
arch/arm/mach-at91/board-sam9-l9260.c
arch/arm/mach-at91/board-sam9260ek.c
arch/arm/mach-at91/board-sam9263ek.c
arch/arm/mach-at91/board-sam9g20ek.c
arch/arm/mach-at91/board-sam9m10g45ek.c
arch/arm/mach-at91/board-snapper9260.c
arch/arm/mach-at91/board-stamp9g20.c
arch/arm/mach-at91/board-usb-a926x.c
arch/arm/mach-at91/board-yl-9200.c
arch/arm/mach-at91/include/mach/board.h
arch/arm/mach-exynos/Kconfig
arch/arm/mach-exynos/Makefile
arch/arm/mach-exynos/dev-ohci.c [new file with mode: 0644]
arch/arm/mach-exynos/include/mach/map.h
arch/arm/mach-exynos/include/mach/ohci.h [new file with mode: 0644]
arch/arm/mach-exynos/mach-origen.c
arch/arm/mach-exynos/mach-smdkv310.c
arch/arm/mach-exynos/setup-usb-phy.c
arch/arm/mach-mmp/aspenite.c
arch/arm/mach-mmp/avengers_lite.c
arch/arm/mach-mmp/brownstone.c
arch/arm/mach-mmp/flint.c
arch/arm/mach-mmp/gplugd.c
arch/arm/mach-mmp/include/mach/gpio-pxa.h
arch/arm/mach-mmp/include/mach/gpio.h
arch/arm/mach-mmp/include/mach/irqs.h
arch/arm/mach-mmp/include/mach/mmp2.h
arch/arm/mach-mmp/include/mach/pxa168.h
arch/arm/mach-mmp/include/mach/pxa910.h
arch/arm/mach-mmp/mmp2.c
arch/arm/mach-mmp/pxa168.c
arch/arm/mach-mmp/pxa910.c
arch/arm/mach-mmp/tavorevb.c
arch/arm/mach-mmp/teton_bga.c
arch/arm/mach-mmp/ttc_dkb.c
arch/arm/mach-mxs/clock-mx28.c
arch/arm/mach-mxs/devices-mx28.h
arch/arm/mach-mxs/devices/platform-mxs-saif.c
arch/arm/mach-mxs/include/mach/common.h
arch/arm/mach-mxs/include/mach/devices-common.h
arch/arm/mach-mxs/include/mach/digctl.h [new file with mode: 0644]
arch/arm/mach-mxs/mach-mx28evk.c
arch/arm/mach-omap2/board-4430sdp.c
arch/arm/mach-omap2/board-am3517evm.c
arch/arm/mach-omap2/clock3xxx_data.c
arch/arm/mach-omap2/clock44xx_data.c
arch/arm/mach-omap2/hsmmc.c
arch/arm/mach-omap2/hsmmc.h
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
arch/arm/mach-omap2/omap_hwmod_44xx_data.c
arch/arm/mach-omap2/prcm-common.h
arch/arm/mach-omap2/usb-host.c
arch/arm/mach-pxa/am200epd.c
arch/arm/mach-pxa/am300epd.c
arch/arm/mach-pxa/balloon3.c
arch/arm/mach-pxa/capc7117.c
arch/arm/mach-pxa/cm-x270.c
arch/arm/mach-pxa/cm-x2xx.c
arch/arm/mach-pxa/cm-x300.c
arch/arm/mach-pxa/colibri-pxa270.c
arch/arm/mach-pxa/colibri-pxa300.c
arch/arm/mach-pxa/colibri-pxa320.c
arch/arm/mach-pxa/corgi.c
arch/arm/mach-pxa/corgi_pm.c
arch/arm/mach-pxa/devices.c
arch/arm/mach-pxa/devices.h
arch/arm/mach-pxa/em-x270.c
arch/arm/mach-pxa/eseries.c
arch/arm/mach-pxa/hx4700.c
arch/arm/mach-pxa/icontrol.c
arch/arm/mach-pxa/idp.c
arch/arm/mach-pxa/include/mach/balloon3.h
arch/arm/mach-pxa/include/mach/corgi.h
arch/arm/mach-pxa/include/mach/csb726.h
arch/arm/mach-pxa/include/mach/gpio-pxa.h [deleted file]
arch/arm/mach-pxa/include/mach/gpio.h
arch/arm/mach-pxa/include/mach/gumstix.h
arch/arm/mach-pxa/include/mach/hx4700.h
arch/arm/mach-pxa/include/mach/idp.h
arch/arm/mach-pxa/include/mach/irqs.h
arch/arm/mach-pxa/include/mach/littleton.h
arch/arm/mach-pxa/include/mach/magician.h
arch/arm/mach-pxa/include/mach/palmld.h
arch/arm/mach-pxa/include/mach/palmt5.h
arch/arm/mach-pxa/include/mach/palmtc.h
arch/arm/mach-pxa/include/mach/palmtx.h
arch/arm/mach-pxa/include/mach/pcm027.h
arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
arch/arm/mach-pxa/include/mach/poodle.h
arch/arm/mach-pxa/include/mach/spitz.h
arch/arm/mach-pxa/include/mach/tosa.h
arch/arm/mach-pxa/include/mach/trizeps4.h
arch/arm/mach-pxa/irq.c
arch/arm/mach-pxa/littleton.c
arch/arm/mach-pxa/lpd270.c
arch/arm/mach-pxa/lubbock.c
arch/arm/mach-pxa/magician.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/mfp-pxa2xx.c
arch/arm/mach-pxa/mioa701.c
arch/arm/mach-pxa/mxm8x10.c
arch/arm/mach-pxa/pcm990-baseboard.c
arch/arm/mach-pxa/poodle.c
arch/arm/mach-pxa/pxa25x.c
arch/arm/mach-pxa/pxa27x.c
arch/arm/mach-pxa/pxa3xx.c
arch/arm/mach-pxa/pxa95x.c
arch/arm/mach-pxa/raumfeld.c
arch/arm/mach-pxa/saar.c
arch/arm/mach-pxa/saarb.c
arch/arm/mach-pxa/sharpsl_pm.c
arch/arm/mach-pxa/spitz.c
arch/arm/mach-pxa/spitz_pm.c
arch/arm/mach-pxa/stargate2.c
arch/arm/mach-pxa/tavorevb.c
arch/arm/mach-pxa/tavorevb3.c
arch/arm/mach-pxa/tosa.c
arch/arm/mach-pxa/viper.c
arch/arm/mach-pxa/vpac270.c
arch/arm/mach-pxa/z2.c
arch/arm/mach-pxa/zeus.c
arch/arm/mach-pxa/zylonite.c
arch/arm/mach-pxa/zylonite_pxa300.c
arch/arm/plat-omap/include/plat/irqs.h
arch/arm/plat-omap/include/plat/mmc.h
arch/arm/plat-omap/include/plat/serial.h
arch/arm/plat-omap/include/plat/usb.h
arch/arm/plat-pxa/include/plat/gpio-pxa.h [deleted file]
arch/arm/plat-pxa/include/plat/gpio.h [deleted file]
arch/arm/plat-samsung/include/plat/devs.h
arch/avr32/boards/atngw100/setup.c
arch/avr32/boards/atstk1000/atstk1002.c
arch/avr32/boards/favr-32/setup.c
arch/avr32/boards/hammerhead/setup.c
arch/avr32/boards/merisc/setup.c
arch/avr32/boards/mimc200/setup.c
arch/avr32/mach-at32ap/at32ap700x.c
arch/avr32/mach-at32ap/include/mach/board.h
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/gpio-pxa.c
drivers/i2c/busses/i2c-tegra.c
drivers/mfd/omap-usb-host.c
drivers/mmc/host/omap_hsmmc.c
drivers/net/ethernet/Makefile
drivers/net/ethernet/cadence/Kconfig
drivers/net/ethernet/cadence/at91_ether.c
drivers/net/ethernet/cadence/at91_ether.h
drivers/net/ethernet/cadence/macb.c
drivers/net/ethernet/cadence/macb.h
drivers/pcmcia/pxa2xx_cm_x255.c
drivers/pcmcia/pxa2xx_cm_x270.c
drivers/usb/Kconfig
drivers/usb/host/Kconfig
drivers/usb/host/ehci-omap.c
drivers/usb/host/ohci-exynos.c [new file with mode: 0644]
drivers/usb/host/ohci-hcd.c
drivers/usb/host/ohci-omap3.c
include/linux/gpio-pxa.h [new file with mode: 0644]
include/linux/platform_data/macb.h [new file with mode: 0644]
include/sound/saif.h
sound/soc/mxs/mxs-saif.c

diff --git a/Documentation/devicetree/bindings/net/macb.txt b/Documentation/devicetree/bindings/net/macb.txt
new file mode 100644 (file)
index 0000000..44afa0e
--- /dev/null
@@ -0,0 +1,25 @@
+* Cadence MACB/GEM Ethernet controller
+
+Required properties:
+- compatible: Should be "cdns,[<chip>-]{macb|gem}"
+  Use "cdns,at91sam9260-macb" Atmel at91sam9260 and at91sam9263 SoCs.
+  Use "cdns,at32ap7000-macb" for other 10/100 usage or use the generic form: "cdns,macb".
+  Use "cnds,pc302-gem" for Picochip picoXcell pc302 and later devices based on
+  the Cadence GEM, or the generic form: "cdns,gem".
+- reg: Address and length of the register set for the device
+- interrupts: Should contain macb interrupt
+- phy-mode: String, operation mode of the PHY interface.
+  Supported values are: "mii", "rmii", "gmii", "rgmii".
+
+Optional properties:
+- local-mac-address: 6 bytes, mac address
+
+Examples:
+
+       macb0: ethernet@fffc4000 {
+               compatible = "cdns,at32ap7000-macb";
+               reg = <0xfffc4000 0x4000>;
+               interrupts = <21>;
+               phy-mode = "rmii";
+               local-mac-address = [3a 0e 03 04 05 06];
+       };
index 776d76b8cb695ff052f310d9f50a737209e96f1b..b8c69726839c81647df6c6941fa8ea956e420980 100644 (file)
@@ -592,6 +592,7 @@ config ARCH_MMP
        select ARCH_REQUIRE_GPIOLIB
        select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
+       select GPIO_PXA
        select HAVE_SCHED_CLOCK
        select TICK_ONESHOT
        select PLAT_PXA
@@ -674,6 +675,7 @@ config ARCH_PXA
        select CLKSRC_MMIO
        select ARCH_REQUIRE_GPIOLIB
        select GENERIC_CLOCKEVENTS
+       select GPIO_PXA
        select HAVE_SCHED_CLOCK
        select TICK_ONESHOT
        select PLAT_PXA
index aeef04269cf85edfb1259de7c64453b1bfb2e843..07603b8c95037b10d85739e2dfcafc77d62be7c7 100644 (file)
                                atmel,use-dma-tx;
                                status = "disabled";
                        };
+
+                       macb0: ethernet@fffc4000 {
+                               compatible = "cdns,at32ap7000-macb", "cdns,macb";
+                               reg = <0xfffc4000 0x100>;
+                               interrupts = <21>;
+                               status = "disabled";
+                       };
                };
        };
 };
index db6a45202f26b44c6911c359902ad5e0504cbc25..fffa005300a4274fa29e2c74e610333ae729ac11 100644 (file)
                                atmel,use-dma-tx;
                                status = "disabled";
                        };
+
+                       macb0: ethernet@fffbc000 {
+                               compatible = "cdns,at32ap7000-macb", "cdns,macb";
+                               reg = <0xfffbc000 0x100>;
+                               interrupts = <25>;
+                               status = "disabled";
+                       };
                };
        };
 };
index 85b34f59cd82eaf0fe55d0bc5d47b19c0144783e..a387e7704ce1e42d2647a19a85311668507a861d 100644 (file)
                        usart1: serial@fff90000 {
                                status = "okay";
                        };
+
+                       macb0: ethernet@fffbc000 {
+                               phy-mode = "rmii";
+                               status = "okay";
+                       };
                };
        };
 };
index d66e2c00ac3507b3c5afdfd791b0ece0eab97bbf..f04b535477f54b5e63c688ab3294d9c826192eae 100644 (file)
                        dbgu: serial@fffff200 {
                                status = "okay";
                        };
+
+                       macb0: ethernet@fffc4000 {
+                               phy-mode = "rmii";
+                               status = "okay";
+                       };
                };
        };
 };
index ecdd54dd68c6c0139d10ca50595283bcf94545d7..17632b82dd76a810b11781bf7d5345412ffeebc9 100644 (file)
@@ -137,7 +137,7 @@ static struct clk pwm_clk = {
        .type           = CLK_TYPE_PERIPHERAL,
 };
 static struct clk macb_clk = {
-       .name           = "macb_clk",
+       .name           = "pclk",
        .pmc_mask       = 1 << AT91CAP9_ID_EMAC,
        .type           = CLK_TYPE_PERIPHERAL,
 };
@@ -210,6 +210,8 @@ static struct clk *periph_clocks[] __initdata = {
 };
 
 static struct clk_lookup periph_clocks_lookups[] = {
+       /* One additional fake clock for macb_hclk */
+       CLKDEV_CON_ID("hclk", &macb_clk),
        CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk),
        CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk),
        CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk),
index adad70db70eb8ce62191a481764efe2d09ee2bae..695aecab0a67edf22efc7490bbed9ba6bf67f17b 100644 (file)
@@ -200,7 +200,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
        [0] = {
@@ -227,7 +227,7 @@ static struct platform_device at91cap9_eth_device = {
        .num_resources  = ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
        if (!data)
                return;
@@ -264,7 +264,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
        platform_device_register(&at91cap9_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
index ad930688358ca1c5683e984dc1b85799b582c5c0..55d22911d0c205863fd0ec8ef7c63879dd0ccc46 100644 (file)
@@ -135,7 +135,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
        [0] = {
@@ -162,7 +162,7 @@ static struct platform_device at91rm9200_eth_device = {
        .num_resources  = ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
        if (!data)
                return;
@@ -199,7 +199,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
        platform_device_register(&at91rm9200_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
index 0d20677fbef027591c91c2d442d528f7fa6c73f0..1c945e3ba57c90d9bbeebe7b14bfe35071c8fc98 100644 (file)
@@ -120,7 +120,7 @@ static struct clk ohci_clk = {
        .type           = CLK_TYPE_PERIPHERAL,
 };
 static struct clk macb_clk = {
-       .name           = "macb_clk",
+       .name           = "pclk",
        .pmc_mask       = 1 << AT91SAM9260_ID_EMAC,
        .type           = CLK_TYPE_PERIPHERAL,
 };
@@ -190,6 +190,8 @@ static struct clk *periph_clocks[] __initdata = {
 };
 
 static struct clk_lookup periph_clocks_lookups[] = {
+       /* One additional fake clock for macb_hclk */
+       CLKDEV_CON_ID("hclk", &macb_clk),
        CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
        CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
        CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
index 629fa977497239f171d66ef47563c3da9d2b0127..b1a4812d9965f78dc5613ebc3b076f1c0e780e0d 100644 (file)
@@ -136,7 +136,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
        [0] = {
@@ -163,7 +163,7 @@ static struct platform_device at91sam9260_eth_device = {
        .num_resources  = ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
        if (!data)
                return;
@@ -200,7 +200,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
        platform_device_register(&at91sam9260_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
index f83fbb0ee0c58e9bdaab924071bedaf148096bb2..182d112dc59d3a3b83fdf77573d0443f3ecc59c8 100644 (file)
@@ -118,7 +118,7 @@ static struct clk pwm_clk = {
        .type           = CLK_TYPE_PERIPHERAL,
 };
 static struct clk macb_clk = {
-       .name           = "macb_clk",
+       .name           = "pclk",
        .pmc_mask       = 1 << AT91SAM9263_ID_EMAC,
        .type           = CLK_TYPE_PERIPHERAL,
 };
@@ -182,6 +182,8 @@ static struct clk *periph_clocks[] __initdata = {
 };
 
 static struct clk_lookup periph_clocks_lookups[] = {
+       /* One additional fake clock for macb_hclk */
+       CLKDEV_CON_ID("hclk", &macb_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
        CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk),
index d5fbac9ff4faed0da1c112869b5c5144c4cfe2f6..183b5f17f55eeaaf2b920ab3c84717d57955a10f 100644 (file)
@@ -144,7 +144,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
        [0] = {
@@ -171,7 +171,7 @@ static struct platform_device at91sam9263_eth_device = {
        .num_resources  = ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
        if (!data)
                return;
@@ -208,7 +208,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
        platform_device_register(&at91sam9263_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
index 318b0407ea041fa8d8dae59c106d8427ea48b8ec..5a0e522ffa94d41e45c174fc850bf80b89703797 100644 (file)
@@ -150,7 +150,7 @@ static struct clk ac97_clk = {
        .type           = CLK_TYPE_PERIPHERAL,
 };
 static struct clk macb_clk = {
-       .name           = "macb_clk",
+       .name           = "pclk",
        .pmc_mask       = 1 << AT91SAM9G45_ID_EMAC,
        .type           = CLK_TYPE_PERIPHERAL,
 };
@@ -209,6 +209,8 @@ static struct clk *periph_clocks[] __initdata = {
 };
 
 static struct clk_lookup periph_clocks_lookups[] = {
+       /* One additional fake clock for macb_hclk */
+       CLKDEV_CON_ID("hclk", &macb_clk),
        /* One additional fake clock for ohci */
        CLKDEV_CON_ID("ohci_clk", &uhphs_clk),
        CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk),
index 09a16d6bd5cdafa5a825fdffa38d769517bd483d..e2cb835c4d7ca4de5aa1b236e4d12166e475f9dc 100644 (file)
@@ -284,7 +284,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
 
 #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
 static u64 eth_dmamask = DMA_BIT_MASK(32);
-static struct at91_eth_data eth_data;
+static struct macb_platform_data eth_data;
 
 static struct resource eth_resources[] = {
        [0] = {
@@ -311,7 +311,7 @@ static struct platform_device at91sam9g45_eth_device = {
        .num_resources  = ARRAY_SIZE(eth_resources),
 };
 
-void __init at91_add_device_eth(struct at91_eth_data *data)
+void __init at91_add_device_eth(struct macb_platform_data *data)
 {
        if (!data)
                return;
@@ -348,7 +348,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data)
        platform_device_register(&at91sam9g45_eth_device);
 }
 #else
-void __init at91_add_device_eth(struct at91_eth_data *data) {}
+void __init at91_add_device_eth(struct macb_platform_data *data) {}
 #endif
 
 
index 367d5cd5e36288c1c5395aedc6eaec91e2138ccf..a60d98d7c3e24b8947b6d3b949ef8bc6b1a1357d 100644 (file)
@@ -63,7 +63,7 @@ static void __init onearm_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata onearm_eth_data = {
+static struct macb_platform_data __initdata onearm_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC4,
        .is_rmii        = 1,
 };
index 4282d96dffa808b1ebf059227d088ca3b92ec441..17fc77925707fcd30ab7c41696158a54e4d85d33 100644 (file)
@@ -103,7 +103,7 @@ static struct spi_board_info afeb9260_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata afeb9260_macb_data = {
+static struct macb_platform_data __initdata afeb9260_macb_data = {
        .phy_irq_pin    = AT91_PIN_PA9,
        .is_rmii        = 0,
 };
index f90cfb32bad2b89815c0ed292b15721dcaa393be..2037d2c40eb4dc501609a3fad59ef7d807c22bf1 100644 (file)
@@ -115,7 +115,7 @@ static struct spi_board_info cam60_spi_devices[] __initdata = {
 /*
  * MACB Ethernet device
  */
-static struct __initdata at91_eth_data cam60_macb_data = {
+static struct __initdata macb_platform_data cam60_macb_data = {
        .phy_irq_pin    = AT91_PIN_PB5,
        .is_rmii        = 0,
 };
index 5dffd3be62d25878b52cdbb46150a7d71ad965ac..af5520c366fe802ce2ce707628b82658cde97bd1 100644 (file)
@@ -153,7 +153,7 @@ static struct at91_mmc_data __initdata cap9adk_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata cap9adk_macb_data = {
+static struct macb_platform_data __initdata cap9adk_macb_data = {
        .is_rmii        = 1,
 };
 
index 774c87fcbd5b8f0ee355bf7b9d7c84822eb95ac9..529b356cdb7d3cfa61a39c2e10944ccd144469b9 100644 (file)
@@ -57,7 +57,7 @@ static void __init carmeva_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata carmeva_eth_data = {
+static struct macb_platform_data __initdata carmeva_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC4,
        .is_rmii        = 1,
 };
index fc885a4ce243fbedce8461435cf966c859f68886..04d2b9b5046455b47dbce8f9e19534a2c18eda95 100644 (file)
@@ -99,7 +99,7 @@ static struct at91_udc_data __initdata cpu9krea_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata cpu9krea_macb_data = {
+static struct macb_platform_data __initdata cpu9krea_macb_data = {
        .is_rmii        = 1,
 };
 
index d35e65b08ccde481aeac88978fd83d7ca1a329c1..7a4c82e8da51559edfeda6dafeb743a69eaad953 100644 (file)
@@ -82,7 +82,7 @@ static void __init cpuat91_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata cpuat91_eth_data = {
+static struct macb_platform_data __initdata cpuat91_eth_data = {
        .is_rmii        = 1,
 };
 
index c3936665e6457715dedaccb0a8b0be0e0fc5f936..b004b20b8e42d8a6ce2983f972c1e4dbc6bf946d 100644 (file)
@@ -58,7 +58,7 @@ static void __init csb337_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata csb337_eth_data = {
+static struct macb_platform_data __initdata csb337_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC2,
        .is_rmii        = 0,
 };
index 586100e2acbbb5b54c3820b0acd34dafc14f23df..e966de5219c737c53d31f669fc94bd2432e8a6d9 100644 (file)
@@ -52,7 +52,7 @@ static void __init csb637_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata csb637_eth_data = {
+static struct macb_platform_data __initdata csb637_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC0,
        .is_rmii        = 0,
 };
index 45db7a3dbef01b960caa77ff7495a3096a9308bd..3788fa527121c8d7b99c68ea6a6758348e7513af 100644 (file)
@@ -60,7 +60,7 @@ static void __init eb9200_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata eb9200_eth_data = {
+static struct macb_platform_data __initdata eb9200_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC4,
        .is_rmii        = 1,
 };
index 2f9c16d29212332f195c85ae7e6e7bc7b3e814c2..af7622eae1a9edf9b6eb79278c1a9409373b3b54 100644 (file)
@@ -64,7 +64,7 @@ static void __init ecb_at91init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata ecb_at91eth_data = {
+static struct macb_platform_data __initdata ecb_at91eth_data = {
        .phy_irq_pin    = AT91_PIN_PC4,
        .is_rmii        = 0,
 };
index 8252c722607b978007efe922f4480052d1902019..8e75867d1d18f65935cbb3e17efd10beb42487b1 100644 (file)
@@ -47,7 +47,7 @@ static void __init eco920_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata eco920_eth_data = {
+static struct macb_platform_data __initdata eco920_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC2,
        .is_rmii        = 1,
 };
index f27d1a780cfa35ef815f6298519d69ea22105019..de8e09642f4e75e417fc35ba6d9c313451ca4efa 100644 (file)
@@ -135,7 +135,7 @@ static struct spi_board_info foxg20_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata foxg20_macb_data = {
+static struct macb_platform_data __initdata foxg20_macb_data = {
        .phy_irq_pin    = AT91_PIN_PA7,
        .is_rmii        = 1,
 };
index 2e95949737e69d91e6ca5f23fcfed44ac4325155..51c82f15111909fb6229e6420e8cd716e803e114 100644 (file)
@@ -93,7 +93,7 @@ static struct at91_udc_data __initdata udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct macb_platform_data __initdata macb_data = {
        .phy_irq_pin    = AT91_PIN_PA28,
        .is_rmii        = 1,
 };
index 3bae73e636332fc5ccfef18b6e02c09915728b2d..9628a3defcf45d62a898b59744da29e344f99763 100644 (file)
@@ -61,7 +61,7 @@ static void __init kafa_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata kafa_eth_data = {
+static struct macb_platform_data __initdata kafa_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC4,
        .is_rmii        = 0,
 };
index e61351ffad50c15399dba98cb7b8b7fa9116728e..5ba5244cb6325b9b064dd0265986abc1c984e734 100644 (file)
@@ -69,7 +69,7 @@ static void __init kb9202_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata kb9202_eth_data = {
+static struct macb_platform_data __initdata kb9202_eth_data = {
        .phy_irq_pin    = AT91_PIN_PB29,
        .is_rmii        = 0,
 };
index ef816c17dc61ebd0a0b9fb0c04ab134912f5b4c7..56e7aee11b5915d31c4d44fd1772be6b51f2fca8 100644 (file)
@@ -155,7 +155,7 @@ static struct at91_mmc_data __initdata neocore926_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata neocore926_macb_data = {
+static struct macb_platform_data __initdata neocore926_macb_data = {
        .phy_irq_pin    = AT91_PIN_PE31,
        .is_rmii        = 1,
 };
index 49e3f699b48e1edff3d73921c178f4426b056896..c545a3e635a4cf1552ec4b5dc0428355b90f098e 100644 (file)
@@ -122,7 +122,7 @@ static struct at91_udc_data __initdata pcontrol_g20_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct macb_platform_data __initdata macb_data = {
        .phy_irq_pin    = AT91_PIN_PA28,
        .is_rmii        = 1,
 };
index 0a8fe6a1b7c8a8a606241f46d8a0a2ff133a75e7..dc18759a24b49d1fc06336d7eb4c3f0221cd3ce1 100644 (file)
@@ -60,7 +60,7 @@ static void __init picotux200_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata picotux200_eth_data = {
+static struct macb_platform_data __initdata picotux200_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC4,
        .is_rmii        = 1,
 };
index 07421bdb88eaf7f1b985a39c23bac74a7d61dd08..5444d6ac514ab1ae53387aabebcf15b76c19ff54 100644 (file)
@@ -104,7 +104,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
        .phy_irq_pin    = AT91_PIN_PA31,
        .is_rmii        = 1,
 };
index 80a8c9c6e92221f53b2024f95d41a1be80e90afe..022d0cebda9dfad17696709367552cfebf78ed28 100644 (file)
@@ -65,7 +65,7 @@ static void __init dk_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata dk_eth_data = {
+static struct macb_platform_data __initdata dk_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC4,
        .is_rmii        = 1,
 };
index 99fd7f8aee0e0f378583365575d3be4bd9127bfe..ed275861adef94b58ed57e2b71081bc53e9ce8a2 100644 (file)
@@ -65,7 +65,7 @@ static void __init ek_init_early(void)
        at91_set_serial_console(0);
 }
 
-static struct at91_eth_data __initdata ek_eth_data = {
+static struct macb_platform_data __initdata ek_eth_data = {
        .phy_irq_pin    = AT91_PIN_PC4,
        .is_rmii        = 1,
 };
index e927df0175dff55f05ba9ab428a7fe4e5a57138d..ed3b21f7767422ece2773767e4ddcfac11d4aa5b 100644 (file)
@@ -60,7 +60,7 @@ static void __init rsi_ews_init_early(void)
 /*
  * Ethernet
  */
-static struct at91_eth_data rsi_ews_eth_data __initdata = {
+static struct macb_platform_data rsi_ews_eth_data __initdata = {
        .phy_irq_pin    = AT91_PIN_PC4,
        .is_rmii        = 1,
 };
index 072d53af98d9ebdd594dc9d17efd68c479341976..3e4b50e6f6ab7e2f83b43a482f05957352c93956 100644 (file)
@@ -109,7 +109,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
        .phy_irq_pin    = AT91_PIN_PA7,
        .is_rmii        = 0,
 };
index 4f10181a07822b4a4a93b0634aa668f428951a19..13478e14a543a7408c30fbd50000ccbf13a633e0 100644 (file)
@@ -151,7 +151,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
        .phy_irq_pin    = AT91_PIN_PA7,
        .is_rmii        = 1,
 };
index bccdcf23caa106e392dba97fa4df69f9775a5337..fcf194e6e4fed938ea38c4c6b630825295d6384a 100644 (file)
@@ -158,7 +158,7 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
        .phy_irq_pin    = AT91_PIN_PE31,
        .is_rmii        = 1,
 };
index 64fc75c9d0ac118730cac024eeb94c4d3da17611..78d27cc3cc09f4d0ee9ceb3a87c274baba085e76 100644 (file)
@@ -123,7 +123,7 @@ static struct spi_board_info ek_spi_devices[] = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
        .phy_irq_pin    = AT91_PIN_PA7,
        .is_rmii        = 1,
 };
index 92de9127923a6dd0ecf6b61780129a1e3e9d6cf2..4e1ee9d87096070e12b23c641dd524a7dac88658 100644 (file)
@@ -115,7 +115,7 @@ static struct mci_platform_data __initdata mci1_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
        .phy_irq_pin    = AT91_PIN_PD5,
        .is_rmii        = 1,
 };
index 0df01c6e2d0c1b458bc89ac41e46740302eda69b..fbec934a7ce9c80a7077a257decd89d8f6e418c5 100644 (file)
@@ -65,7 +65,7 @@ static struct at91_udc_data __initdata snapper9260_udc_data = {
        .vbus_polled            = 1,
 };
 
-static struct at91_eth_data snapper9260_macb_data = {
+static struct macb_platform_data snapper9260_macb_data = {
        .is_rmii        = 1,
 };
 
index 936e5fd7f40696d6db2680fde276344a7e3950cb..7c06c07d872bab6fb229175286f7c092ca5c11c1 100644 (file)
@@ -157,7 +157,7 @@ static struct at91_udc_data __initdata stamp9g20evb_udc_data = {
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata macb_data = {
+static struct macb_platform_data __initdata macb_data = {
        .phy_irq_pin    = AT91_PIN_PA28,
        .is_rmii        = 1,
 };
index 0a20bab21f998ef5597be890f9ed47977d27d19f..3d84233f78eba13e01a04c2966a78cbcf4dd665f 100644 (file)
@@ -146,7 +146,7 @@ static void __init ek_add_device_spi(void)
 /*
  * MACB Ethernet device
  */
-static struct at91_eth_data __initdata ek_macb_data = {
+static struct macb_platform_data __initdata ek_macb_data = {
        .phy_irq_pin    = AT91_PIN_PE31,
        .is_rmii        = 1,
 };
index 12a3f955162b2eb84ce1346ee2eb090bc0113442..2c40a21b2794c1b19d4e5a112ee5c8838403e9a2 100644 (file)
@@ -110,7 +110,7 @@ static struct gpio_led yl9200_leds[] = {
 /*
  * Ethernet
  */
-static struct at91_eth_data __initdata yl9200_eth_data = {
+static struct macb_platform_data __initdata yl9200_eth_data = {
        .phy_irq_pin            = AT91_PIN_PB28,
        .is_rmii                = 1,
 };
index eac92e995bb52ba1d0c81cc55af29b4cf6e97b3a..e209a2992245683d4812c99b8c2250a589e1deb5 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/atmel-mci.h>
 #include <sound/atmel-ac97c.h>
 #include <linux/serial.h>
+#include <linux/platform_data/macb.h>
 
  /* USB Device */
 struct at91_udc_data {
@@ -81,18 +82,7 @@ extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
   /* atmel-mci platform config */
 extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
 
- /* Ethernet (EMAC & MACB) */
-struct at91_eth_data {
-       u32             phy_mask;
-       u8              phy_irq_pin;    /* PHY IRQ */
-       u8              is_rmii;        /* using RMII interface? */
-};
-extern void __init at91_add_device_eth(struct at91_eth_data *data);
-
-#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91CAP9) \
-       || defined(CONFIG_ARCH_AT91SAM9G45)
-#define eth_platform_data      at91_eth_data
-#endif
+extern void __init at91_add_device_eth(struct macb_platform_data *data);
 
  /* USB Host */
 struct at91_usbh_data {
index c925fecfa50ab946a5c1b88f2d42f8a398c1febe..4e36e8f4e15728595b63078280c44c7bb70ec1d6 100644 (file)
@@ -87,6 +87,11 @@ config EXYNOS4_DEV_DWMCI
        help
          Compile in platform device definitions for DWMCI
 
+config EXYNOS4_DEV_USB_OHCI
+       bool
+       help
+         Compile in platform device definition for USB OHCI
+
 config EXYNOS4_SETUP_I2C1
        bool
        help
@@ -190,6 +195,7 @@ config MACH_SMDKV310
        select EXYNOS4_DEV_DMA
        select EXYNOS4_DEV_PD
        select SAMSUNG_DEV_PWM
+       select EXYNOS4_DEV_USB_OHCI
        select EXYNOS4_DEV_SYSMMU
        select EXYNOS4_SETUP_FIMD0
        select EXYNOS4_SETUP_I2C1
@@ -303,6 +309,7 @@ config MACH_ORIGEN
        select SAMSUNG_DEV_PWM
        select EXYNOS4_DEV_DMA
        select EXYNOS4_DEV_PD
+       select EXYNOS4_DEV_USB_OHCI
        select EXYNOS4_SETUP_FIMD0
        select EXYNOS4_SETUP_SDHCI
        select EXYNOS4_SETUP_USB_PHY
index 979fdd3d14e6c87f55018505a1c9440a953dee57..db527ab4759c3e5d85aac4420f2968a64b63faf1 100644 (file)
@@ -47,6 +47,7 @@ obj-$(CONFIG_EXYNOS4_DEV_PD)          += dev-pd.o
 obj-$(CONFIG_EXYNOS4_DEV_SYSMMU)       += dev-sysmmu.o
 obj-$(CONFIG_EXYNOS4_DEV_DWMCI)                += dev-dwmci.o
 obj-$(CONFIG_EXYNOS4_DEV_DMA)          += dma.o
+obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI)     += dev-ohci.o
 
 obj-$(CONFIG_EXYNOS4_SETUP_FIMC)       += setup-fimc.o
 obj-$(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 (file)
index 0000000..b8e7530
--- /dev/null
@@ -0,0 +1,52 @@
+/* linux/arch/arm/mach-exynos/dev-ohci.c
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com
+ *
+ * EXYNOS - OHCI support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/dma-mapping.h>
+#include <linux/platform_device.h>
+
+#include <mach/irqs.h>
+#include <mach/map.h>
+#include <mach/ohci.h>
+
+#include <plat/devs.h>
+#include <plat/usb-phy.h>
+
+static struct resource exynos4_ohci_resource[] = {
+       [0] = DEFINE_RES_MEM(EXYNOS4_PA_OHCI, SZ_256),
+       [1] = DEFINE_RES_IRQ(IRQ_USB_HOST),
+};
+
+static u64 exynos4_ohci_dma_mask = DMA_BIT_MASK(32);
+
+struct platform_device exynos4_device_ohci = {
+       .name           = "exynos-ohci",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(exynos4_ohci_resource),
+       .resource       = exynos4_ohci_resource,
+       .dev            = {
+               .dma_mask               = &exynos4_ohci_dma_mask,
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       }
+};
+
+void __init exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd)
+{
+       struct exynos4_ohci_platdata *npd;
+
+       npd = s3c_set_platdata(pd, sizeof(struct exynos4_ohci_platdata),
+                       &exynos4_device_ohci);
+
+       if (!npd->phy_init)
+               npd->phy_init = s5p_usb_phy_init;
+       if (!npd->phy_exit)
+               npd->phy_exit = s5p_usb_phy_exit;
+}
index e6ba01d115f66c8535264e9d599f4ecb79862581..05ff18706776b1342924d61d3f79e6e044ebb383 100644 (file)
 #define EXYNOS4_PA_SROMC               0x12570000
 
 #define EXYNOS4_PA_EHCI                        0x12580000
+#define EXYNOS4_PA_OHCI                        0x12590000
 #define EXYNOS4_PA_HSPHY               0x125B0000
 #define EXYNOS4_PA_MFC                 0x13400000
 
diff --git a/arch/arm/mach-exynos/include/mach/ohci.h b/arch/arm/mach-exynos/include/mach/ohci.h
new file mode 100644 (file)
index 0000000..c256c59
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ *             http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __MACH_EXYNOS_OHCI_H
+#define __MACH_EXYNOS_OHCI_H
+
+struct exynos4_ohci_platdata {
+       int (*phy_init)(struct platform_device *pdev, int type);
+       int (*phy_exit)(struct platform_device *pdev, int type);
+};
+
+extern void exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd);
+
+#endif /* __MACH_EXYNOS_OHCI_H */
index f80b563f2be7841d3fc2bb939d0bb20d513b86ae..b805e595cc359460141510e906686b8f30b203f4 100644 (file)
@@ -41,6 +41,7 @@
 #include <plat/fb.h>
 #include <plat/mfc.h>
 
+#include <mach/ohci.h>
 #include <mach/map.h>
 
 /* Following are default values for UCON, ULCON and UFCON UART registers */
@@ -483,6 +484,16 @@ static void __init origen_ehci_init(void)
        s5p_ehci_set_platdata(pdata);
 }
 
+/* USB OHCI */
+static struct exynos4_ohci_platdata origen_ohci_pdata;
+
+static void __init origen_ohci_init(void)
+{
+       struct exynos4_ohci_platdata *pdata = &origen_ohci_pdata;
+
+       exynos4_ohci_set_platdata(pdata);
+}
+
 static struct gpio_keys_button origen_gpio_keys_table[] = {
        {
                .code                   = KEY_MENU,
@@ -606,6 +617,7 @@ static struct platform_device *origen_devices[] __initdata = {
        &s5p_device_mfc_l,
        &s5p_device_mfc_r,
        &s5p_device_mixer,
+       &exynos4_device_ohci,
        &exynos4_device_pd[PD_LCD0],
        &exynos4_device_pd[PD_TV],
        &exynos4_device_pd[PD_G3D],
@@ -670,6 +682,7 @@ static void __init origen_machine_init(void)
        s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata);
 
        origen_ehci_init();
+       origen_ohci_init();
        clk_xusbxti.rate = 24000000;
 
        s5p_tv_setup();
index cec2afabe7b42475e2d1f8585642b048ea7ee34b..25a5a405c4bff1a538495b563a1924c3945f70da 100644 (file)
@@ -42,6 +42,7 @@
 #include <plat/clock.h>
 
 #include <mach/map.h>
+#include <mach/ohci.h>
 
 /* Following are default values for UCON, ULCON and UFCON UART registers */
 #define SMDKV310_UCON_DEFAULT  (S3C2410_UCON_TXILEVEL |        \
@@ -245,6 +246,16 @@ static void __init smdkv310_ehci_init(void)
        s5p_ehci_set_platdata(pdata);
 }
 
+/* USB OHCI */
+static struct exynos4_ohci_platdata smdkv310_ohci_pdata;
+
+static void __init smdkv310_ohci_init(void)
+{
+       struct exynos4_ohci_platdata *pdata = &smdkv310_ohci_pdata;
+
+       exynos4_ohci_set_platdata(pdata);
+}
+
 static struct platform_device *smdkv310_devices[] __initdata = {
        &s3c_device_hsmmc0,
        &s3c_device_hsmmc1,
@@ -261,6 +272,7 @@ static struct platform_device *smdkv310_devices[] __initdata = {
        &s5p_device_fimc3,
        &exynos4_device_ac97,
        &exynos4_device_i2s0,
+       &exynos4_device_ohci,
        &samsung_device_keypad,
        &s5p_device_mfc,
        &s5p_device_mfc_l,
@@ -363,6 +375,7 @@ static void __init smdkv310_machine_init(void)
        s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata);
 
        smdkv310_ehci_init();
+       smdkv310_ohci_init();
        clk_xusbxti.rate = 24000000;
 
        platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
index 39aca045f6604ae1b7c4125ee85646ef34df95f0..41743d21e8c6a337ecac51c5499af410c8d7048a 100644 (file)
 #include <plat/cpu.h>
 #include <plat/usb-phy.h>
 
+static atomic_t host_usage;
+
+static int exynos4_usb_host_phy_is_on(void)
+{
+       return (readl(EXYNOS4_PHYPWR) & PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1;
+}
+
 static int exynos4_usb_phy1_init(struct platform_device *pdev)
 {
        struct clk *otg_clk;
@@ -27,6 +34,8 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
        u32 rstcon;
        int err;
 
+       atomic_inc(&host_usage);
+
        otg_clk = clk_get(&pdev->dev, "otg");
        if (IS_ERR(otg_clk)) {
                dev_err(&pdev->dev, "Failed to get otg clock\n");
@@ -39,6 +48,9 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
                return err;
        }
 
+       if (exynos4_usb_host_phy_is_on())
+               return 0;
+
        writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE,
                        S5P_USBHOST_PHY_CONTROL);
 
@@ -95,6 +107,9 @@ static int exynos4_usb_phy1_exit(struct platform_device *pdev)
        struct clk *otg_clk;
        int err;
 
+       if (atomic_dec_return(&host_usage) > 0)
+               return 0;
+
        otg_clk = clk_get(&pdev->dev, "otg");
        if (IS_ERR(otg_clk)) {
                dev_err(&pdev->dev, "Failed to get otg clock\n");
index 7a60bbbce7a43523c888f04a9ae8444fb95c1993..f0d236dfb02b97d08c46eaa54c70b0ec594cae08 100644 (file)
@@ -120,8 +120,8 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = gpio_to_irq(27),
-               .end    = gpio_to_irq(27),
+               .start  = MMP_GPIO_TO_IRQ(27),
+               .end    = MMP_GPIO_TO_IRQ(27),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        }
 };
@@ -232,6 +232,7 @@ static void __init common_init(void)
        pxa168_add_nand(&aspenite_nand_info);
        pxa168_add_fb(&aspenite_lcd_info);
        pxa168_add_keypad(&aspenite_keypad_info);
+       platform_device_register(&pxa168_device_gpio);
 
        /* off-chip devices */
        platform_device_register(&smc91x_device);
index 39f0878d64a0c39ba026c2be0f20755576d75045..c5d53e0742e9abc216fa54ff5defd7b6dc140b37 100644 (file)
@@ -38,6 +38,7 @@ static void __init avengers_lite_init(void)
 
        /* on-chip devices */
        pxa168_add_uart(2);
+       platform_device_register(&pxa168_device_gpio);
 }
 
 MACHINE_START(AVENGERS_LITE, "PXA168 Avengers lite Development Platform")
index 983cfb15fbde99bc0b394b56a779cc4708f6be9c..eb07565a06a363014c355e1ac086cd46c90e46d6 100644 (file)
@@ -202,6 +202,7 @@ static void __init brownstone_init(void)
        /* on-chip devices */
        mmp2_add_uart(1);
        mmp2_add_uart(3);
+       platform_device_register(&mmp2_device_gpio);
        mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
        mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
        mmp2_add_sdhost(2, &mmp2_sdh_platdata_mmc2); /* eMMC */
index c4fd806b15b42ad282533587e54a8378eb514c3d..c1f0aa88dd8ab530c543a24d869eaeb3905ac3d7 100644 (file)
@@ -87,8 +87,8 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = gpio_to_irq(155),
-               .end    = gpio_to_irq(155),
+               .start  = MMP_GPIO_TO_IRQ(155),
+               .end    = MMP_GPIO_TO_IRQ(155),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        }
 };
@@ -110,6 +110,7 @@ static void __init flint_init(void)
        /* on-chip devices */
        mmp2_add_uart(1);
        mmp2_add_uart(2);
+       platform_device_register(&mmp2_device_gpio);
 
        /* off-chip devices */
        platform_device_register(&smc91x_device);
index 4665767a4f79ee918ec1fd24053d296ce13d0806..e266f66a4670a55d566b41016b35a7d088bb9a65 100644 (file)
@@ -184,6 +184,7 @@ static void __init gplugd_init(void)
        pxa168_add_uart(3);
        pxa168_add_ssp(1);
        pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
+       platform_device_register(&pxa168_device_gpio);
 
        pxa168_add_eth(&gplugd_eth_platform_data);
 }
index 99b4ce1b6562cebf64651b9a0039599d624593d6..0e135a599f3e190fa04f94a7b5044431cf52bbb7 100644 (file)
@@ -2,6 +2,7 @@
 #define __ASM_MACH_GPIO_PXA_H
 
 #include <mach/addr-map.h>
+#include <mach/cputype.h>
 #include <mach/irqs.h>
 
 #define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
@@ -9,8 +10,6 @@
 #define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
 #define GPIO_REG(x)    (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
 
-#define NR_BUILTIN_GPIO                IRQ_GPIO_NUM
-
 #define gpio_to_bank(gpio)     ((gpio) >> 5)
 
 /* NOTE: these macros are defined here to make optimization of
index 681262359d1c28cfc30b26e4f093fc43930c17a5..13219ebf5128d033033d1159deb5b8fabedfee8f 100644 (file)
@@ -3,11 +3,6 @@
 
 #include <asm-generic/gpio.h>
 
-#define gpio_to_irq(gpio)      (IRQ_GPIO_START + (gpio))
-#define irq_to_gpio(irq)       ((irq) - IRQ_GPIO_START)
+#include <mach/cputype.h>
 
-#define __gpio_is_inverted(gpio)       (0)
-#define __gpio_is_occupied(gpio)       (0)
-
-#include <plat/gpio.h>
 #endif /* __ASM_MACH_GPIO_H */
index a09d328e2ddd02087cdd7d08c68d6950b0ff6250..34635a0bbb5924be0db26ffa8a1ddfd12d65da71 100644 (file)
 #define IRQ_MMP2_MUX_END               (IRQ_MMP2_SSP_BASE + 2)
 
 #define IRQ_GPIO_START                 128
-#define IRQ_GPIO_NUM                   192
-#define IRQ_GPIO(x)                    (IRQ_GPIO_START + (x))
+#define MMP_NR_BUILTIN_GPIO            192
+#define MMP_GPIO_TO_IRQ(gpio)          (IRQ_GPIO_START + (gpio))
 
-#define IRQ_BOARD_START                        (IRQ_GPIO_START + IRQ_GPIO_NUM)
+#define IRQ_BOARD_START                        (IRQ_GPIO_START + MMP_NR_BUILTIN_GPIO)
 
 #define NR_IRQS                                (IRQ_BOARD_START)
 
index 2f7b2d3c2b184f9717307076d281c82619f628c8..cba22fed2265b431737a5f08cae7055133d52dc5 100644 (file)
@@ -32,6 +32,8 @@ extern struct pxa_device_desc mmp2_device_sdh3;
 extern struct pxa_device_desc mmp2_device_asram;
 extern struct pxa_device_desc mmp2_device_isram;
 
+extern struct platform_device mmp2_device_gpio;
+
 static inline int mmp2_add_uart(int id)
 {
        struct pxa_device_desc *d = NULL;
index 7fb568d2845b0da8f86c2614b6072b9526b3ee5e..f9286089da3af3828a287f3427397a6eb67d9507 100644 (file)
@@ -42,6 +42,8 @@ struct pxa168_usb_pdata {
 /* pdata can be NULL */
 int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata);
 
+extern struct platform_device pxa168_device_gpio;
+
 static inline int pxa168_add_uart(int id)
 {
        struct pxa_device_desc *d = NULL;
index 91be75591398baf9427a892864316101284dc7cf..4de13abef7bbf5a6413ca8fec3f647aee96a209e 100644 (file)
@@ -21,6 +21,8 @@ extern struct pxa_device_desc pxa910_device_pwm3;
 extern struct pxa_device_desc pxa910_device_pwm4;
 extern struct pxa_device_desc pxa910_device_nand;
 
+extern struct platform_device pxa910_device_gpio;
+
 static inline int pxa910_add_uart(int id)
 {
        struct pxa_device_desc *d = NULL;
index 5dd1d4a6aeb90d4458ffeca378d1f08233908442..617c60a170a4c1787327e738d428c042ada56869 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/platform_device.h>
 
 #include <asm/hardware/cache-tauros2.h>
 
@@ -24,7 +25,6 @@
 #include <mach/irqs.h>
 #include <mach/dma.h>
 #include <mach/mfp.h>
-#include <mach/gpio-pxa.h>
 #include <mach/devices.h>
 #include <mach/mmp2.h>
 
@@ -33,8 +33,6 @@
 
 #define MFPR_VIRT_BASE (APB_VIRT_BASE + 0x1e000)
 
-#define APMASK(i)      (GPIO_REGS_VIRT + BANK_OFF(i) + 0x9c)
-
 static struct mfp_addr_map mmp2_addr_map[] __initdata = {
 
        MFP_ADDR_X(GPIO0, GPIO58, 0x54),
@@ -95,24 +93,9 @@ void mmp2_clear_pmic_int(void)
        __raw_writel(data, mfpr_pmic);
 }
 
-static void __init mmp2_init_gpio(void)
-{
-       int i;
-
-       /* enable GPIO clock */
-       __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_MMP2_GPIO);
-
-       /* unmask GPIO edge detection for all 6 banks -- APMASKx */
-       for (i = 0; i < 6; i++)
-               __raw_writel(0xffffffff, APMASK(i));
-
-       pxa_init_gpio(IRQ_MMP2_GPIO, 0, 167, NULL);
-}
-
 void __init mmp2_init_irq(void)
 {
        mmp2_init_icu();
-       mmp2_init_gpio();
 }
 
 static void sdhc_clk_enable(struct clk *clk)
@@ -149,6 +132,7 @@ static APBC_CLK(twsi3, MMP2_TWSI3, 0, 26000000);
 static APBC_CLK(twsi4, MMP2_TWSI4, 0, 26000000);
 static APBC_CLK(twsi5, MMP2_TWSI5, 0, 26000000);
 static APBC_CLK(twsi6, MMP2_TWSI6, 0, 26000000);
+static APBC_CLK(gpio, MMP2_GPIO, 0, 26000000);
 
 static APMU_CLK(nand, NAND, 0xbf, 100000000);
 static APMU_CLK_OPS(sdh0, SDH0, 0x1b, 200000000, &sdhc_clk_ops);
@@ -168,6 +152,7 @@ static struct clk_lookup mmp2_clkregs[] = {
        INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL),
        INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL),
        INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
+       INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
        INIT_CLKREG(&clk_sdh0, "sdhci-pxav3.0", "PXA-SDHCLK"),
        INIT_CLKREG(&clk_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"),
        INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"),
@@ -230,3 +215,21 @@ MMP2_DEVICE(asram, "asram", -1, NONE, 0xe0000000, 0x4000);
 /* 0xd1000000 ~ 0xd101ffff is reserved for secure processor */
 MMP2_DEVICE(isram, "isram", -1, NONE, 0xd1020000, 0x18000);
 
+struct resource mmp2_resource_gpio[] = {
+       {
+               .start  = 0xd4019000,
+               .end    = 0xd4019fff,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .start  = IRQ_MMP2_GPIO,
+               .end    = IRQ_MMP2_GPIO,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+struct platform_device mmp2_device_gpio = {
+       .name           = "pxa-gpio",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(mmp2_resource_gpio),
+       .resource       = mmp2_resource_gpio,
+};
index 76ca15c00e4589602a5123e278a9960c07095c2a..84245035f3512398d7bc71f21a51392ffbe5ea83 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/list.h>
 #include <linux/io.h>
 #include <linux/clk.h>
+#include <linux/platform_device.h>
 
 #include <asm/mach/time.h>
 #include <mach/addr-map.h>
@@ -20,7 +21,6 @@
 #include <mach/regs-apbc.h>
 #include <mach/regs-apmu.h>
 #include <mach/irqs.h>
-#include <mach/gpio-pxa.h>
 #include <mach/dma.h>
 #include <mach/devices.h>
 #include <mach/mfp.h>
@@ -43,26 +43,9 @@ static struct mfp_addr_map pxa168_mfp_addr_map[] __initdata =
        MFP_ADDR_END,
 };
 
-#define APMASK(i)      (GPIO_REGS_VIRT + BANK_OFF(i) + 0x09c)
-
-static void __init pxa168_init_gpio(void)
-{
-       int i;
-
-       /* enable GPIO clock */
-       __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_PXA168_GPIO);
-
-       /* unmask GPIO edge detection for all 4 banks - APMASKx */
-       for (i = 0; i < 4; i++)
-               __raw_writel(0xffffffff, APMASK(i));
-
-       pxa_init_gpio(IRQ_PXA168_GPIOX, 0, 127, NULL);
-}
-
 void __init pxa168_init_irq(void)
 {
        icu_init_irq();
-       pxa168_init_gpio();
 }
 
 /* APB peripheral clocks */
@@ -80,6 +63,7 @@ static APBC_CLK(ssp2, PXA168_SSP2, 4, 0);
 static APBC_CLK(ssp3, PXA168_SSP3, 4, 0);
 static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
 static APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
+static APBC_CLK(gpio, PXA168_GPIO, 0, 13000000);
 static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
 
 static APMU_CLK(nand, NAND, 0x19b, 156000000);
@@ -105,6 +89,7 @@ static struct clk_lookup pxa168_clkregs[] = {
        INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
        INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
        INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
+       INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
        INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
        INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
        INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"),
@@ -174,6 +159,25 @@ PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
 PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c);
 PXA168_DEVICE(eth, "pxa168-eth", -1, MFU, 0xc0800000, 0x0fff);
 
+struct resource pxa168_resource_gpio[] = {
+       {
+               .start  = 0xd4019000,
+               .end    = 0xd4019fff,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .start  = IRQ_PXA168_GPIOX,
+               .end    = IRQ_PXA168_GPIOX,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+struct platform_device pxa168_device_gpio = {
+       .name           = "pxa-gpio",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(pxa168_resource_gpio),
+       .resource       = pxa168_resource_gpio,
+};
+
 struct resource pxa168_usb_host_resources[] = {
        /* USB Host conroller register base */
        [0] = {
index 4ebbfbba39fcf3bb54e3da76891918c14f66ea50..3241a25784d09b6c5ba83ba88752fcee5c7f9dd0 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/io.h>
+#include <linux/platform_device.h>
 
 #include <asm/mach/time.h>
 #include <mach/addr-map.h>
@@ -19,7 +20,6 @@
 #include <mach/regs-apmu.h>
 #include <mach/cputype.h>
 #include <mach/irqs.h>
-#include <mach/gpio-pxa.h>
 #include <mach/dma.h>
 #include <mach/mfp.h>
 #include <mach/devices.h>
@@ -77,26 +77,9 @@ static struct mfp_addr_map pxa910_mfp_addr_map[] __initdata =
        MFP_ADDR_END,
 };
 
-#define APMASK(i)      (GPIO_REGS_VIRT + BANK_OFF(i) + 0x09c)
-
-static void __init pxa910_init_gpio(void)
-{
-       int i;
-
-       /* enable GPIO clock */
-       __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_PXA910_GPIO);
-
-       /* unmask GPIO edge detection for all 4 banks - APMASKx */
-       for (i = 0; i < 4; i++)
-               __raw_writel(0xffffffff, APMASK(i));
-
-       pxa_init_gpio(IRQ_PXA910_AP_GPIO, 0, 127, NULL);
-}
-
 void __init pxa910_init_irq(void)
 {
        icu_init_irq();
-       pxa910_init_gpio();
 }
 
 /* APB peripheral clocks */
@@ -108,6 +91,7 @@ static APBC_CLK(pwm1, PXA910_PWM1, 1, 13000000);
 static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
 static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
 static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
+static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000);
 
 static APMU_CLK(nand, NAND, 0x19b, 156000000);
 static APMU_CLK(u2o, USB, 0x1b, 480000000);
@@ -123,6 +107,7 @@ static struct clk_lookup pxa910_clkregs[] = {
        INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
        INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
        INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
+       INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
        INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"),
 };
 
@@ -179,3 +164,22 @@ PXA910_DEVICE(pwm2, "pxa910-pwm", 1, NONE, 0xd401a400, 0x10);
 PXA910_DEVICE(pwm3, "pxa910-pwm", 2, NONE, 0xd401a800, 0x10);
 PXA910_DEVICE(pwm4, "pxa910-pwm", 3, NONE, 0xd401ac00, 0x10);
 PXA910_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x80, 97, 99);
+
+struct resource pxa910_resource_gpio[] = {
+       {
+               .start  = 0xd4019000,
+               .end    = 0xd4019fff,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .start  = IRQ_PXA910_AP_GPIO,
+               .end    = IRQ_PXA910_AP_GPIO,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+struct platform_device pxa910_device_gpio = {
+       .name           = "pxa-gpio",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(pxa910_resource_gpio),
+       .resource       = pxa910_resource_gpio,
+};
index eb5be879fd8cd76748d109546c77d34eb9914116..bb2ddb72bca244d23c81daa52b6e1700ee912875 100644 (file)
@@ -19,6 +19,7 @@
 #include <mach/addr-map.h>
 #include <mach/mfp-pxa910.h>
 #include <mach/pxa910.h>
+#include <mach/irqs.h>
 
 #include "common.h"
 
@@ -71,8 +72,8 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = gpio_to_irq(80),
-               .end    = gpio_to_irq(80),
+               .start  = MMP_GPIO_TO_IRQ(80),
+               .end    = MMP_GPIO_TO_IRQ(80),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        }
 };
@@ -93,6 +94,7 @@ static void __init tavorevb_init(void)
 
        /* on-chip devices */
        pxa910_add_uart(1);
+       platform_device_register(&pxa910_device_gpio);
 
        /* off-chip devices */
        platform_device_register(&smc91x_device);
index bbe4727b96ccb26f068b61f4096dd01b2d07fc5d..703de85b571c65a20205654e35fb15b98ecea579 100644 (file)
@@ -66,7 +66,7 @@ static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
 static struct i2c_board_info teton_bga_i2c_info[] __initdata = {
        {
                I2C_BOARD_INFO("ds1337", 0x68),
-               .irq = gpio_to_irq(RTC_INT_GPIO)
+               .irq = MMP_GPIO_TO_IRQ(RTC_INT_GPIO)
        },
 };
 
@@ -78,6 +78,7 @@ static void __init teton_bga_init(void)
        pxa168_add_uart(1);
        pxa168_add_keypad(&teton_bga_keypad_info);
        pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
+       platform_device_register(&pxa168_device_gpio);
 }
 
 MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform")
index 176515a7698935ee136842563b1c025e39a22651..a80ed262df1ce1285ae3e6fb6dafb9a983fc14af 100644 (file)
 #include <mach/addr-map.h>
 #include <mach/mfp-pxa910.h>
 #include <mach/pxa910.h>
+#include <mach/irqs.h>
 
 #include "common.h"
 
-#define TTCDKB_GPIO_EXT0(x)    (NR_BUILTIN_GPIO + ((x < 0) ? 0 :       \
+#define TTCDKB_GPIO_EXT0(x)    (MMP_NR_BUILTIN_GPIO + ((x < 0) ? 0 :   \
                                ((x < 16) ? x : 15)))
-#define TTCDKB_GPIO_EXT1(x)    (NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 :  \
+#define TTCDKB_GPIO_EXT1(x)    (MMP_NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 : \
                                ((x < 16) ? x : 15)))
 
 /*
@@ -122,6 +123,7 @@ static struct platform_device ttc_dkb_device_onenand = {
 };
 
 static struct platform_device *ttc_dkb_devices[] = {
+       &pxa910_device_gpio,
        &ttc_dkb_device_onenand,
 };
 
@@ -136,7 +138,7 @@ static struct i2c_board_info ttc_dkb_i2c_info[] = {
        {
                .type           = "max7312",
                .addr           = 0x23,
-               .irq            = IRQ_GPIO(80),
+               .irq            = MMP_GPIO_TO_IRQ(80),
                .platform_data  = &max7312_data,
        },
 };
index da6e4aad177c2097b12515b2ddd2572e8b397ea2..df0ad3ce234bfa07f592b06af05358881235a6ae 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 #include <linux/jiffies.h>
 #include <linux/clkdev.h>
+#include <linux/spinlock.h>
 
 #include <asm/clkdev.h>
 #include <asm/div64.h>
@@ -29,6 +30,7 @@
 #include <mach/mx28.h>
 #include <mach/common.h>
 #include <mach/clock.h>
+#include <mach/digctl.h>
 
 #include "regs-clkctrl-mx28.h"
 
@@ -43,6 +45,33 @@ static struct clk emi_clk;
 static struct clk saif0_clk;
 static struct clk saif1_clk;
 static struct clk clk32k_clk;
+static DEFINE_SPINLOCK(clkmux_lock);
+
+/*
+ * HW_SAIF_CLKMUX_SEL:
+ *  DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and SAIF1
+ *             clock pins selected for SAIF1 input clocks.
+ *  CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks, and
+ *             SAIF0 clock inputs selected for SAIF1 input clocks.
+ *  EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input
+ *             clocks.
+ *  EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input
+ *             clocks.
+ */
+int mxs_saif_clkmux_select(unsigned int clkmux)
+{
+       if (clkmux > 0x3)
+               return -EINVAL;
+
+       spin_lock(&clkmux_lock);
+       __raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX,
+                       DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR);
+       __raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX,
+                       DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR);
+       spin_unlock(&clkmux_lock);
+
+       return 0;
+}
 
 static int _raw_clk_enable(struct clk *clk)
 {
@@ -785,6 +814,15 @@ int __init mx28_clocks_init(void)
        clk_set_parent(&saif0_clk, &pll0_clk);
        clk_set_parent(&saif1_clk, &pll0_clk);
 
+       /*
+        * Set an initial clock rate for the saif internal logic to work
+        * properly. This is important when working in EXTMASTER mode that
+        * uses the other saif's BITCLK&LRCLK but it still needs a basic
+        * clock which should be fast enough for the internal logic.
+        */
+       clk_set_rate(&saif0_clk, 24000000);
+       clk_set_rate(&saif1_clk, 24000000);
+
        clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 
        mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0);
index c8887103f0e32670b043d948d60f6b0fc915cecb..4f50094e293d35aa9cd28e980ae647e63c0beb8c 100644 (file)
@@ -47,6 +47,7 @@ struct platform_device *__init mx28_add_mxsfb(
                const struct mxsfb_platform_data *pdata);
 
 extern const struct mxs_saif_data mx28_saif_data[] __initconst;
-#define mx28_add_saif(id)              mxs_add_saif(&mx28_saif_data[id])
+#define mx28_add_saif(id, pdata) \
+       mxs_add_saif(&mx28_saif_data[id], pdata)
 
 struct platform_device *__init mx28_add_rtc_stmp3xxx(void);
index 1ec965e9fe92e6e14c98b3bbc4787966136dbfa4..f6e3a60b4201f1efc379a76c89e03e072cb81ac0 100644 (file)
@@ -32,7 +32,8 @@ const struct mxs_saif_data mx28_saif_data[] __initconst = {
 };
 #endif
 
-struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
+struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data,
+                               const struct mxs_saif_platform_data *pdata)
 {
        struct resource res[] = {
                {
@@ -56,5 +57,5 @@ struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
        };
 
        return mxs_add_platform_device("mxs-saif", data->id, res,
-                                       ARRAY_SIZE(res), NULL, 0);
+                               ARRAY_SIZE(res), pdata, sizeof(*pdata));
 }
index 635bb5d9a20ade988bfa61667b9513c985a47bb9..3bbb94f4bbe12a430cebebce77bc3a608f300b68 100644 (file)
@@ -16,6 +16,7 @@ struct clk;
 extern const u32 *mxs_get_ocotp(void);
 extern int mxs_reset_block(void __iomem *);
 extern void mxs_timer_init(struct clk *, int);
+extern int mxs_saif_clkmux_select(unsigned int clkmux);
 
 extern int mx23_register_gpios(void);
 extern int mx23_clocks_init(void);
index a8080f44c03d9310d74b26d2965dba0862f006f1..dc369c1239fc3eac5a1c7d27968a3bf5c27f3912 100644 (file)
@@ -94,6 +94,7 @@ struct platform_device *__init mxs_add_mxs_pwm(
                resource_size_t iobase, int id);
 
 /* saif */
+#include <sound/saif.h>
 struct mxs_saif_data {
        int id;
        resource_size_t iobase;
@@ -103,4 +104,5 @@ struct mxs_saif_data {
 };
 
 struct platform_device *__init mxs_add_saif(
-               const struct mxs_saif_data *data);
+               const struct mxs_saif_data *data,
+               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 (file)
index 0000000..49a888c
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __MACH_DIGCTL_H__
+#define __MACH_DIGCTL_H__
+
+/* MXS DIGCTL SAIF CLKMUX */
+#define MXS_DIGCTL_SAIF_CLKMUX_DIRECT          0x0
+#define MXS_DIGCTL_SAIF_CLKMUX_CROSSINPUT      0x1
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0                0x2
+#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1                0x3
+
+#define HW_DIGCTL_CTRL                 0x0
+#define  BP_DIGCTL_CTRL_SAIF_CLKMUX    10
+#define  BM_DIGCTL_CTRL_SAIF_CLKMUX    (0x3 << 10)
+#endif
index 064ec5abaa557f7c6679bf4fe965c67f3fb6a022..ac84a10baa14c5c4a3b294047b7b7dc75a1fa9ec 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <mach/common.h>
 #include <mach/iomux-mx28.h>
+#include <mach/digctl.h>
 
 #include "devices-mx28.h"
 
@@ -421,6 +422,18 @@ static struct gpio mx28evk_lcd_gpios[] = {
        { MX28EVK_BL_ENABLE, GPIOF_OUT_INIT_HIGH, "bl-enable" },
 };
 
+static const struct mxs_saif_platform_data
+                       mx28evk_mxs_saif_pdata[] __initconst = {
+       /* working on EXTMSTR0 mode (saif0 master, saif1 slave) */
+       {
+               .master_mode = 1,
+               .master_id = 0,
+       }, {
+               .master_mode = 0,
+               .master_id = 0,
+       },
+};
+
 static void __init mx28evk_init(void)
 {
        int ret;
@@ -454,8 +467,9 @@ static void __init mx28evk_init(void)
        else
                mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
 
-       mx28_add_saif(0);
-       mx28_add_saif(1);
+       mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
+       mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]);
+       mx28_add_saif(1, &mx28evk_mxs_saif_pdata[1]);
 
        mx28_add_mxs_i2c(0);
        i2c_register_board_info(0, mxs_i2c0_board_info,
index 515646886b590cc7cad81cbef4048efc609bb7b9..ba23224963d01f2744dfa4b706c9e4bf459a42de 100644 (file)
@@ -404,6 +404,7 @@ static struct omap2_hsmmc_info mmc[] = {
        {
                .mmc            = 5,
                .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
+               .pm_caps        = MMC_PM_KEEP_POWER,
                .gpio_cd        = -EINVAL,
                .gpio_wp        = -EINVAL,
                .ocr_mask       = MMC_VDD_165_195,
index d314f033c9dfd7b21e5f8f94d24b44418a19e3da..f7df8d35ee90c7557c72782dcb21558b4d18d7b8 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/i2c/pca953x.h>
 #include <linux/can/platform/ti_hecc.h>
 #include <linux/davinci_emac.h>
+#include <linux/mmc/host.h>
 
 #include <mach/hardware.h>
 #include <mach/am35xx.h>
@@ -40,6 +41,7 @@
 
 #include "mux.h"
 #include "control.h"
+#include "hsmmc.h"
 
 #define AM35XX_EVM_MDIO_FREQUENCY      (1000000)
 
@@ -455,6 +457,23 @@ static void am3517_evm_hecc_init(struct ti_hecc_platform_data *pdata)
 static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
 };
 
+static struct omap2_hsmmc_info mmc[] = {
+       {
+               .mmc            = 1,
+               .caps           = MMC_CAP_4_BIT_DATA,
+               .gpio_cd        = 127,
+               .gpio_wp        = 126,
+       },
+       {
+               .mmc            = 2,
+               .caps           = MMC_CAP_4_BIT_DATA,
+               .gpio_cd        = 128,
+               .gpio_wp        = 129,
+       },
+       {}      /* Terminator */
+};
+
+
 static void __init am3517_evm_init(void)
 {
        omap_board_config = am3517_evm_config;
@@ -483,6 +502,9 @@ static void __init am3517_evm_init(void)
 
        /* MUSB */
        am3517_evm_musb_init();
+
+       /* MMC init function */
+       omap2_hsmmc_init(mmc);
 }
 
 MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
index 5d0064a4fb5a638bb1141489354244e95899c1a1..9d59451446d9cf5e53de021f9d503dbd1e2dcb3a 100644 (file)
@@ -2480,6 +2480,16 @@ static struct clk uart4_fck = {
        .recalc         = &followparent_recalc,
 };
 
+static struct clk uart4_fck_am35xx = {
+       .name           = "uart4_fck",
+       .ops            = &clkops_omap2_dflt_wait,
+       .parent         = &per_48m_fck,
+       .enable_reg     = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
+       .enable_bit     = OMAP3430_EN_UART4_SHIFT,
+       .clkdm_name     = "core_l4_clkdm",
+       .recalc         = &followparent_recalc,
+};
+
 static struct clk gpt2_fck = {
        .name           = "gpt2_fck",
        .ops            = &clkops_omap2_dflt_wait,
@@ -3287,7 +3297,7 @@ static struct omap_clk omap3xxx_clks[] = {
        CLK(NULL,       "cpefuse_fck",  &cpefuse_fck,   CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK(NULL,       "ts_fck",       &ts_fck,        CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK(NULL,       "usbtll_fck",   &usbtll_fck,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-       CLK("usbhs-omap.0",     "usbtll_fck",   &usbtll_fck,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
+       CLK("usbhs_omap",       "usbtll_fck",   &usbtll_fck,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK("omap-mcbsp.1",     "prcm_fck",     &core_96m_fck,  CK_3XXX),
        CLK("omap-mcbsp.5",     "prcm_fck",     &core_96m_fck,  CK_3XXX),
        CLK(NULL,       "core_96m_fck", &core_96m_fck,  CK_3XXX),
@@ -3323,7 +3333,7 @@ static struct omap_clk omap3xxx_clks[] = {
        CLK(NULL,       "pka_ick",      &pka_ick,       CK_34XX | CK_36XX),
        CLK(NULL,       "core_l4_ick",  &core_l4_ick,   CK_3XXX),
        CLK(NULL,       "usbtll_ick",   &usbtll_ick,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-       CLK("usbhs-omap.0",     "usbtll_ick",   &usbtll_ick,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
+       CLK("usbhs_omap",       "usbtll_ick",   &usbtll_ick,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK("omap_hsmmc.2",     "ick",  &mmchs3_ick,    CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK(NULL,       "icr_ick",      &icr_ick,       CK_34XX | CK_36XX),
        CLK("omap-aes", "ick",  &aes2_ick,      CK_34XX | CK_36XX),
@@ -3369,20 +3379,18 @@ static struct omap_clk omap3xxx_clks[] = {
        CLK(NULL,       "cam_ick",      &cam_ick,       CK_34XX | CK_36XX),
        CLK(NULL,       "csi2_96m_fck", &csi2_96m_fck,  CK_34XX | CK_36XX),
        CLK(NULL,       "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-       CLK("usbhs-omap.0",     "hs_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK(NULL,       "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-       CLK("usbhs-omap.0",     "fs_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
        CLK(NULL,       "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-       CLK("usbhs-omap.0",     "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
-       CLK("usbhs-omap.0",     "utmi_p1_gfclk",        &dummy_ck,      CK_3XXX),
-       CLK("usbhs-omap.0",     "utmi_p2_gfclk",        &dummy_ck,      CK_3XXX),
-       CLK("usbhs-omap.0",     "xclk60mhsp1_ck",       &dummy_ck,      CK_3XXX),
-       CLK("usbhs-omap.0",     "xclk60mhsp2_ck",       &dummy_ck,      CK_3XXX),
-       CLK("usbhs-omap.0",     "usb_host_hs_utmi_p1_clk",      &dummy_ck,      CK_3XXX),
-       CLK("usbhs-omap.0",     "usb_host_hs_utmi_p2_clk",      &dummy_ck,      CK_3XXX),
-       CLK("usbhs-omap.0",     "usb_tll_hs_usb_ch0_clk",       &dummy_ck,      CK_3XXX),
-       CLK("usbhs-omap.0",     "usb_tll_hs_usb_ch1_clk",       &dummy_ck,      CK_3XXX),
-       CLK("usbhs-omap.0",     "init_60m_fclk",        &dummy_ck,      CK_3XXX),
+       CLK("usbhs_omap",       "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
+       CLK("usbhs_omap",       "utmi_p1_gfclk",        &dummy_ck,      CK_3XXX),
+       CLK("usbhs_omap",       "utmi_p2_gfclk",        &dummy_ck,      CK_3XXX),
+       CLK("usbhs_omap",       "xclk60mhsp1_ck",       &dummy_ck,      CK_3XXX),
+       CLK("usbhs_omap",       "xclk60mhsp2_ck",       &dummy_ck,      CK_3XXX),
+       CLK("usbhs_omap",       "usb_host_hs_utmi_p1_clk",      &dummy_ck,      CK_3XXX),
+       CLK("usbhs_omap",       "usb_host_hs_utmi_p2_clk",      &dummy_ck,      CK_3XXX),
+       CLK("usbhs_omap",       "usb_tll_hs_usb_ch0_clk",       &dummy_ck,      CK_3XXX),
+       CLK("usbhs_omap",       "usb_tll_hs_usb_ch1_clk",       &dummy_ck,      CK_3XXX),
+       CLK("usbhs_omap",       "init_60m_fclk",        &dummy_ck,      CK_3XXX),
        CLK(NULL,       "usim_fck",     &usim_fck,      CK_3430ES2PLUS | CK_36XX),
        CLK(NULL,       "gpt1_fck",     &gpt1_fck,      CK_3XXX),
        CLK(NULL,       "wkup_32k_fck", &wkup_32k_fck,  CK_3XXX),
@@ -3403,6 +3411,7 @@ static struct omap_clk omap3xxx_clks[] = {
        CLK(NULL,       "per_48m_fck",  &per_48m_fck,   CK_3XXX),
        CLK(NULL,       "uart3_fck",    &uart3_fck,     CK_3XXX),
        CLK(NULL,       "uart4_fck",    &uart4_fck,     CK_36XX),
+       CLK(NULL,       "uart4_fck",    &uart4_fck_am35xx, CK_3505 | CK_3517),
        CLK(NULL,       "gpt2_fck",     &gpt2_fck,      CK_3XXX),
        CLK(NULL,       "gpt3_fck",     &gpt3_fck,      CK_3XXX),
        CLK(NULL,       "gpt4_fck",     &gpt4_fck,      CK_3XXX),
index 0798a802497a543dbfc2bff9b71da28772ffa6be..c8a1b2740778f0a2570922007726841d05d39f50 100644 (file)
@@ -3295,7 +3295,7 @@ static struct omap_clk omap44xx_clks[] = {
        CLK(NULL,       "uart2_fck",                    &uart2_fck,     CK_443X),
        CLK(NULL,       "uart3_fck",                    &uart3_fck,     CK_443X),
        CLK(NULL,       "uart4_fck",                    &uart4_fck,     CK_443X),
-       CLK("usbhs-omap.0",     "fs_fck",               &usb_host_fs_fck,       CK_443X),
+       CLK("usbhs_omap",       "fs_fck",               &usb_host_fs_fck,       CK_443X),
        CLK(NULL,       "utmi_p1_gfclk",                &utmi_p1_gfclk, CK_443X),
        CLK(NULL,       "usb_host_hs_utmi_p1_clk",      &usb_host_hs_utmi_p1_clk,       CK_443X),
        CLK(NULL,       "utmi_p2_gfclk",                &utmi_p2_gfclk, CK_443X),
@@ -3306,7 +3306,7 @@ static struct omap_clk omap44xx_clks[] = {
        CLK(NULL,       "usb_host_hs_hsic60m_p2_clk",   &usb_host_hs_hsic60m_p2_clk,    CK_443X),
        CLK(NULL,       "usb_host_hs_hsic480m_p2_clk",  &usb_host_hs_hsic480m_p2_clk,   CK_443X),
        CLK(NULL,       "usb_host_hs_func48mclk",       &usb_host_hs_func48mclk,        CK_443X),
-       CLK("usbhs-omap.0",     "hs_fck",               &usb_host_hs_fck,       CK_443X),
+       CLK("usbhs_omap",       "hs_fck",               &usb_host_hs_fck,       CK_443X),
        CLK(NULL,       "otg_60m_gfclk",                &otg_60m_gfclk, CK_443X),
        CLK(NULL,       "usb_otg_hs_xclk",              &usb_otg_hs_xclk,       CK_443X),
        CLK("musb-omap2430",    "ick",                          &usb_otg_hs_ick,        CK_443X),
@@ -3314,7 +3314,7 @@ static struct omap_clk omap44xx_clks[] = {
        CLK(NULL,       "usb_tll_hs_usb_ch2_clk",       &usb_tll_hs_usb_ch2_clk,        CK_443X),
        CLK(NULL,       "usb_tll_hs_usb_ch0_clk",       &usb_tll_hs_usb_ch0_clk,        CK_443X),
        CLK(NULL,       "usb_tll_hs_usb_ch1_clk",       &usb_tll_hs_usb_ch1_clk,        CK_443X),
-       CLK("usbhs-omap.0",     "usbtll_ick",           &usb_tll_hs_ick,        CK_443X),
+       CLK("usbhs_omap",       "usbtll_ick",           &usb_tll_hs_ick,        CK_443X),
        CLK(NULL,       "usim_ck",                      &usim_ck,       CK_443X),
        CLK(NULL,       "usim_fclk",                    &usim_fclk,     CK_443X),
        CLK(NULL,       "usim_fck",                     &usim_fck,      CK_443X),
@@ -3374,8 +3374,8 @@ static struct omap_clk omap44xx_clks[] = {
        CLK(NULL,       "uart2_ick",                    &dummy_ck,      CK_443X),
        CLK(NULL,       "uart3_ick",                    &dummy_ck,      CK_443X),
        CLK(NULL,       "uart4_ick",                    &dummy_ck,      CK_443X),
-       CLK("usbhs-omap.0",     "usbhost_ick",          &dummy_ck,              CK_443X),
-       CLK("usbhs-omap.0",     "usbtll_fck",           &dummy_ck,      CK_443X),
+       CLK("usbhs_omap",       "usbhost_ick",          &dummy_ck,              CK_443X),
+       CLK("usbhs_omap",       "usbtll_fck",           &dummy_ck,      CK_443X),
        CLK("omap_wdt", "ick",                          &dummy_ck,      CK_443X),
        CLK("omap_timer.1",     "32k_ck",       &sys_32k_ck,    CK_443X),
        CLK("omap_timer.2",     "32k_ck",       &sys_32k_ck,    CK_443X),
index f4a1020559a7b84529f3f6f22e8ffec9ec41c6e3..bd844af13af56106d7fe5511dcaa6d2ebf6f7afa 100644 (file)
@@ -171,6 +171,17 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
        }
 }
 
+static void hsmmc2_select_input_clk_src(struct omap_mmc_platform_data *mmc)
+{
+       u32 reg;
+
+       if (mmc->slots[0].internal_clock) {
+               reg = omap_ctrl_readl(control_devconf1_offset);
+               reg |= OMAP2_MMCSDIO2ADPCLKISEL;
+               omap_ctrl_writel(reg, control_devconf1_offset);
+       }
+}
+
 static void hsmmc23_before_set_reg(struct device *dev, int slot,
                                   int power_on, int vdd)
 {
@@ -179,16 +190,19 @@ static void hsmmc23_before_set_reg(struct device *dev, int slot,
        if (mmc->slots[0].remux)
                mmc->slots[0].remux(dev, slot, power_on);
 
-       if (power_on) {
-               /* Only MMC2 supports a CLKIN */
-               if (mmc->slots[0].internal_clock) {
-                       u32 reg;
+       if (power_on)
+               hsmmc2_select_input_clk_src(mmc);
+}
 
-                       reg = omap_ctrl_readl(control_devconf1_offset);
-                       reg |= OMAP2_MMCSDIO2ADPCLKISEL;
-                       omap_ctrl_writel(reg, control_devconf1_offset);
-               }
-       }
+static int am35x_hsmmc2_set_power(struct device *dev, int slot,
+                                 int power_on, int vdd)
+{
+       struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+       if (power_on)
+               hsmmc2_select_input_clk_src(mmc);
+
+       return 0;
 }
 
 static 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,
 static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller,
                        int controller_nr)
 {
-       if (gpio_is_valid(mmc_controller->slots[0].switch_pin))
+       if (gpio_is_valid(mmc_controller->slots[0].switch_pin) &&
+               (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
                omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
                                        OMAP_PIN_INPUT_PULLUP);
-       if (gpio_is_valid(mmc_controller->slots[0].gpio_wp))
+       if (gpio_is_valid(mmc_controller->slots[0].gpio_wp) &&
+               (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
                omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
                                        OMAP_PIN_INPUT_PULLUP);
        if (cpu_is_omap34xx()) {
@@ -296,6 +312,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
        mmc->slots[0].name = hc_name;
        mmc->nr_slots = 1;
        mmc->slots[0].caps = c->caps;
+       mmc->slots[0].pm_caps = c->pm_caps;
        mmc->slots[0].internal_clock = !c->ext_clock;
        mmc->dma_mask = 0xffffffff;
        if (cpu_is_omap44xx())
@@ -336,11 +353,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
         *
         * temporary HACK: ocr_mask instead of fixed supply
         */
-       mmc->slots[0].ocr_mask = c->ocr_mask;
-
-       if (cpu_is_omap3517() || cpu_is_omap3505())
-               mmc->slots[0].set_power = nop_mmc_set_power;
+       if (cpu_is_omap3505() || cpu_is_omap3517())
+               mmc->slots[0].ocr_mask = MMC_VDD_165_195 |
+                                        MMC_VDD_26_27 |
+                                        MMC_VDD_27_28 |
+                                        MMC_VDD_29_30 |
+                                        MMC_VDD_30_31 |
+                                        MMC_VDD_31_32;
        else
+               mmc->slots[0].ocr_mask = c->ocr_mask;
+
+       if (!cpu_is_omap3517() && !cpu_is_omap3505())
                mmc->slots[0].features |= HSMMC_HAS_PBIAS;
 
        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,
                        }
                }
 
+               if (cpu_is_omap3517() || cpu_is_omap3505())
+                       mmc->slots[0].set_power = nop_mmc_set_power;
+
                /* OMAP3630 HSMMC1 supports only 4-bit */
                if (cpu_is_omap3630() &&
                                (c->caps & MMC_CAP_8_BIT_DATA)) {
@@ -372,6 +398,9 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
                }
                break;
        case 2:
+               if (cpu_is_omap3517() || cpu_is_omap3505())
+                       mmc->slots[0].set_power = am35x_hsmmc2_set_power;
+
                if (c->ext_clock)
                        c->transceiver = 1;
                if (c->transceiver && (c->caps & MMC_CAP_8_BIT_DATA)) {
index f757e78d4d4f5759f73bdc27acc502c1ef8f497f..c4409730c4bb6ea18d4c0b93f9bd7fab612e20a5 100644 (file)
@@ -12,6 +12,7 @@ struct omap2_hsmmc_info {
        u8      mmc;            /* controller 1/2/3 */
        u32     caps;           /* 4/8 wires and any additional host
                                 * capabilities OR'd (ref. linux/mmc/host.h) */
+       u32     pm_caps;        /* PM capabilities */
        bool    transceiver;    /* MMC-2 option */
        bool    ext_clock;      /* use external pin for input clock */
        bool    cover_only;     /* No card detect - just cover switch */
index 7f8915ad50990b1af2e877ed169c32cd0d15cd02..5324e8d93bc0262d9019db6feb7f81fdc42a8f44 100644 (file)
@@ -84,6 +84,8 @@ static struct omap_hwmod omap3xxx_mcbsp4_hwmod;
 static struct omap_hwmod omap3xxx_mcbsp5_hwmod;
 static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod;
 static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod;
+static struct omap_hwmod omap3xxx_usb_host_hs_hwmod;
+static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod;
 
 /* L3 -> L4_CORE interface */
 static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = {
@@ -164,6 +166,7 @@ static struct omap_hwmod omap3xxx_uart1_hwmod;
 static struct omap_hwmod omap3xxx_uart2_hwmod;
 static struct omap_hwmod omap3xxx_uart3_hwmod;
 static struct omap_hwmod omap3xxx_uart4_hwmod;
+static struct omap_hwmod am35xx_uart4_hwmod;
 static struct omap_hwmod omap3xxx_usbhsotg_hwmod;
 
 /* l3_core -> usbhsotg interface */
@@ -299,6 +302,23 @@ static struct omap_hwmod_ocp_if omap3_l4_per__uart4 = {
        .user           = OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* AM35xx: L4 CORE -> UART4 interface */
+static struct omap_hwmod_addr_space am35xx_uart4_addr_space[] = {
+       {
+               .pa_start       = OMAP3_UART4_AM35XX_BASE,
+               .pa_end         = OMAP3_UART4_AM35XX_BASE + SZ_1K - 1,
+               .flags          = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
+       },
+};
+
+static struct omap_hwmod_ocp_if am35xx_l4_core__uart4 = {
+       .master         = &omap3xxx_l4_core_hwmod,
+       .slave          = &am35xx_uart4_hwmod,
+       .clk            = "uart4_ick",
+       .addr           = am35xx_uart4_addr_space,
+       .user           = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* L4 CORE -> I2C1 interface */
 static struct omap_hwmod_ocp_if omap3_l4_core__i2c1 = {
        .master         = &omap3xxx_l4_core_hwmod,
@@ -1162,6 +1182,7 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
                           SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
                           SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
        .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+       .clockact       = CLOCKACT_TEST_ICLK,
        .sysc_fields    = &omap_hwmod_sysc_type1,
 };
 
@@ -1309,6 +1330,39 @@ static struct omap_hwmod omap3xxx_uart4_hwmod = {
        .class          = &omap2_uart_class,
 };
 
+static struct omap_hwmod_irq_info am35xx_uart4_mpu_irqs[] = {
+       { .irq = INT_35XX_UART4_IRQ, },
+};
+
+static struct omap_hwmod_dma_info am35xx_uart4_sdma_reqs[] = {
+       { .name = "rx", .dma_req = AM35XX_DMA_UART4_RX, },
+       { .name = "tx", .dma_req = AM35XX_DMA_UART4_TX, },
+};
+
+static struct omap_hwmod_ocp_if *am35xx_uart4_slaves[] = {
+       &am35xx_l4_core__uart4,
+};
+
+static struct omap_hwmod am35xx_uart4_hwmod = {
+       .name           = "uart4",
+       .mpu_irqs       = am35xx_uart4_mpu_irqs,
+       .sdma_reqs      = am35xx_uart4_sdma_reqs,
+       .main_clk       = "uart4_fck",
+       .prcm           = {
+               .omap2 = {
+                       .module_offs = CORE_MOD,
+                       .prcm_reg_id = 1,
+                       .module_bit = OMAP3430_EN_UART4_SHIFT,
+                       .idlest_reg_id = 1,
+                       .idlest_idle_bit = OMAP3430_EN_UART4_SHIFT,
+               },
+       },
+       .slaves         = am35xx_uart4_slaves,
+       .slaves_cnt     = ARRAY_SIZE(am35xx_uart4_slaves),
+       .class          = &omap2_uart_class,
+};
+
+
 static struct omap_hwmod_class i2c_class = {
        .name   = "i2c",
        .sysc   = &i2c_sysc,
@@ -1636,7 +1690,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_i2c1_slaves[] = {
 
 static struct omap_hwmod omap3xxx_i2c1_hwmod = {
        .name           = "i2c1",
-       .flags          = HWMOD_16BIT_REG,
+       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
        .mpu_irqs       = omap2_i2c1_mpu_irqs,
        .sdma_reqs      = omap2_i2c1_sdma_reqs,
        .main_clk       = "i2c1_fck",
@@ -1670,7 +1724,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_i2c2_slaves[] = {
 
 static struct omap_hwmod omap3xxx_i2c2_hwmod = {
        .name           = "i2c2",
-       .flags          = HWMOD_16BIT_REG,
+       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
        .mpu_irqs       = omap2_i2c2_mpu_irqs,
        .sdma_reqs      = omap2_i2c2_sdma_reqs,
        .main_clk       = "i2c2_fck",
@@ -1715,7 +1769,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_i2c3_slaves[] = {
 
 static struct omap_hwmod omap3xxx_i2c3_hwmod = {
        .name           = "i2c3",
-       .flags          = HWMOD_16BIT_REG,
+       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
        .mpu_irqs       = i2c3_mpu_irqs,
        .sdma_reqs      = i2c3_sdma_reqs,
        .main_clk       = "i2c3_fck",
@@ -3072,7 +3126,35 @@ static struct omap_mmc_dev_attr mmc1_dev_attr = {
        .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
 };
 
-static struct omap_hwmod omap3xxx_mmc1_hwmod = {
+/* See 35xx errata 2.1.1.128 in SPRZ278F */
+static struct omap_mmc_dev_attr mmc1_pre_es3_dev_attr = {
+       .flags = (OMAP_HSMMC_SUPPORTS_DUAL_VOLT |
+                 OMAP_HSMMC_BROKEN_MULTIBLOCK_READ),
+};
+
+static struct omap_hwmod omap3xxx_pre_es3_mmc1_hwmod = {
+       .name           = "mmc1",
+       .mpu_irqs       = omap34xx_mmc1_mpu_irqs,
+       .sdma_reqs      = omap34xx_mmc1_sdma_reqs,
+       .opt_clks       = omap34xx_mmc1_opt_clks,
+       .opt_clks_cnt   = ARRAY_SIZE(omap34xx_mmc1_opt_clks),
+       .main_clk       = "mmchs1_fck",
+       .prcm           = {
+               .omap2 = {
+                       .module_offs = CORE_MOD,
+                       .prcm_reg_id = 1,
+                       .module_bit = OMAP3430_EN_MMC1_SHIFT,
+                       .idlest_reg_id = 1,
+                       .idlest_idle_bit = OMAP3430_ST_MMC1_SHIFT,
+               },
+       },
+       .dev_attr       = &mmc1_pre_es3_dev_attr,
+       .slaves         = omap3xxx_mmc1_slaves,
+       .slaves_cnt     = ARRAY_SIZE(omap3xxx_mmc1_slaves),
+       .class          = &omap34xx_mmc_class,
+};
+
+static struct omap_hwmod omap3xxx_es3plus_mmc1_hwmod = {
        .name           = "mmc1",
        .mpu_irqs       = omap34xx_mmc1_mpu_irqs,
        .sdma_reqs      = omap34xx_mmc1_sdma_reqs,
@@ -3115,7 +3197,34 @@ static struct omap_hwmod_ocp_if *omap3xxx_mmc2_slaves[] = {
        &omap3xxx_l4_core__mmc2,
 };
 
-static struct omap_hwmod omap3xxx_mmc2_hwmod = {
+/* See 35xx errata 2.1.1.128 in SPRZ278F */
+static struct omap_mmc_dev_attr mmc2_pre_es3_dev_attr = {
+       .flags = OMAP_HSMMC_BROKEN_MULTIBLOCK_READ,
+};
+
+static struct omap_hwmod omap3xxx_pre_es3_mmc2_hwmod = {
+       .name           = "mmc2",
+       .mpu_irqs       = omap34xx_mmc2_mpu_irqs,
+       .sdma_reqs      = omap34xx_mmc2_sdma_reqs,
+       .opt_clks       = omap34xx_mmc2_opt_clks,
+       .opt_clks_cnt   = ARRAY_SIZE(omap34xx_mmc2_opt_clks),
+       .main_clk       = "mmchs2_fck",
+       .prcm           = {
+               .omap2 = {
+                       .module_offs = CORE_MOD,
+                       .prcm_reg_id = 1,
+                       .module_bit = OMAP3430_EN_MMC2_SHIFT,
+                       .idlest_reg_id = 1,
+                       .idlest_idle_bit = OMAP3430_ST_MMC2_SHIFT,
+               },
+       },
+       .dev_attr       = &mmc2_pre_es3_dev_attr,
+       .slaves         = omap3xxx_mmc2_slaves,
+       .slaves_cnt     = ARRAY_SIZE(omap3xxx_mmc2_slaves),
+       .class          = &omap34xx_mmc_class,
+};
+
+static struct omap_hwmod omap3xxx_es3plus_mmc2_hwmod = {
        .name           = "mmc2",
        .mpu_irqs       = omap34xx_mmc2_mpu_irqs,
        .sdma_reqs      = omap34xx_mmc2_sdma_reqs,
@@ -3177,13 +3286,223 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = {
        .class          = &omap34xx_mmc_class,
 };
 
+/*
+ * 'usb_host_hs' class
+ * high-speed multi-port usb host controller
+ */
+static struct omap_hwmod_ocp_if omap3xxx_usb_host_hs__l3_main_2 = {
+       .master         = &omap3xxx_usb_host_hs_hwmod,
+       .slave          = &omap3xxx_l3_main_hwmod,
+       .clk            = "core_l3_ick",
+       .user           = OCP_USER_MPU,
+};
+
+static struct omap_hwmod_class_sysconfig omap3xxx_usb_host_hs_sysc = {
+       .rev_offs       = 0x0000,
+       .sysc_offs      = 0x0010,
+       .syss_offs      = 0x0014,
+       .sysc_flags     = (SYSC_HAS_MIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
+                          SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP |
+                          SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+                          MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
+       .sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_usb_host_hs_hwmod_class = {
+       .name = "usb_host_hs",
+       .sysc = &omap3xxx_usb_host_hs_sysc,
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_usb_host_hs_masters[] = {
+       &omap3xxx_usb_host_hs__l3_main_2,
+};
+
+static struct omap_hwmod_addr_space omap3xxx_usb_host_hs_addrs[] = {
+       {
+               .name           = "uhh",
+               .pa_start       = 0x48064000,
+               .pa_end         = 0x480643ff,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+               .name           = "ohci",
+               .pa_start       = 0x48064400,
+               .pa_end         = 0x480647ff,
+       },
+       {
+               .name           = "ehci",
+               .pa_start       = 0x48064800,
+               .pa_end         = 0x48064cff,
+       },
+       {}
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__usb_host_hs = {
+       .master         = &omap3xxx_l4_core_hwmod,
+       .slave          = &omap3xxx_usb_host_hs_hwmod,
+       .clk            = "usbhost_ick",
+       .addr           = omap3xxx_usb_host_hs_addrs,
+       .user           = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_usb_host_hs_slaves[] = {
+       &omap3xxx_l4_core__usb_host_hs,
+};
+
+static struct omap_hwmod_opt_clk omap3xxx_usb_host_hs_opt_clks[] = {
+         { .role = "ehci_logic_fck", .clk = "usbhost_120m_fck", },
+};
+
+static struct omap_hwmod_irq_info omap3xxx_usb_host_hs_irqs[] = {
+       { .name = "ohci-irq", .irq = 76 },
+       { .name = "ehci-irq", .irq = 77 },
+       { .irq = -1 }
+};
+
+static struct omap_hwmod omap3xxx_usb_host_hs_hwmod = {
+       .name           = "usb_host_hs",
+       .class          = &omap3xxx_usb_host_hs_hwmod_class,
+       .clkdm_name     = "l3_init_clkdm",
+       .mpu_irqs       = omap3xxx_usb_host_hs_irqs,
+       .main_clk       = "usbhost_48m_fck",
+       .prcm = {
+               .omap2 = {
+                       .module_offs = OMAP3430ES2_USBHOST_MOD,
+                       .prcm_reg_id = 1,
+                       .module_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
+                       .idlest_reg_id = 1,
+                       .idlest_idle_bit = OMAP3430ES2_ST_USBHOST_IDLE_SHIFT,
+                       .idlest_stdby_bit = OMAP3430ES2_ST_USBHOST_STDBY_SHIFT,
+               },
+       },
+       .opt_clks       = omap3xxx_usb_host_hs_opt_clks,
+       .opt_clks_cnt   = ARRAY_SIZE(omap3xxx_usb_host_hs_opt_clks),
+       .slaves         = omap3xxx_usb_host_hs_slaves,
+       .slaves_cnt     = ARRAY_SIZE(omap3xxx_usb_host_hs_slaves),
+       .masters        = omap3xxx_usb_host_hs_masters,
+       .masters_cnt    = ARRAY_SIZE(omap3xxx_usb_host_hs_masters),
+
+       /*
+        * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock
+        * id: i660
+        *
+        * Description:
+        * In the following configuration :
+        * - USBHOST module is set to smart-idle mode
+        * - PRCM asserts idle_req to the USBHOST module ( This typically
+        *   happens when the system is going to a low power mode : all ports
+        *   have been suspended, the master part of the USBHOST module has
+        *   entered the standby state, and SW has cut the functional clocks)
+        * - an USBHOST interrupt occurs before the module is able to answer
+        *   idle_ack, typically a remote wakeup IRQ.
+        * Then the USB HOST module will enter a deadlock situation where it
+        * is no more accessible nor functional.
+        *
+        * Workaround:
+        * Don't use smart idle; use only force idle, hence HWMOD_SWSUP_SIDLE
+        */
+
+       /*
+        * Errata: USB host EHCI may stall when entering smart-standby mode
+        * Id: i571
+        *
+        * Description:
+        * When the USBHOST module is set to smart-standby mode, and when it is
+        * ready to enter the standby state (i.e. all ports are suspended and
+        * all attached devices are in suspend mode), then it can wrongly assert
+        * the Mstandby signal too early while there are still some residual OCP
+        * transactions ongoing. If this condition occurs, the internal state
+        * machine may go to an undefined state and the USB link may be stuck
+        * upon the next resume.
+        *
+        * Workaround:
+        * Don't use smart standby; use only force standby,
+        * hence HWMOD_SWSUP_MSTANDBY
+        */
+
+       /*
+        * During system boot; If the hwmod framework resets the module
+        * the module will have smart idle settings; which can lead to deadlock
+        * (above Errata Id:i660); so, dont reset the module during boot;
+        * Use HWMOD_INIT_NO_RESET.
+        */
+
+       .flags          = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
+                         HWMOD_INIT_NO_RESET,
+};
+
+/*
+ * 'usb_tll_hs' class
+ * usb_tll_hs module is the adapter on the usb_host_hs ports
+ */
+static struct omap_hwmod_class_sysconfig omap3xxx_usb_tll_hs_sysc = {
+       .rev_offs       = 0x0000,
+       .sysc_offs      = 0x0010,
+       .syss_offs      = 0x0014,
+       .sysc_flags     = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+                          SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+                          SYSC_HAS_AUTOIDLE),
+       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+       .sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_usb_tll_hs_hwmod_class = {
+       .name = "usb_tll_hs",
+       .sysc = &omap3xxx_usb_tll_hs_sysc,
+};
+
+static struct omap_hwmod_irq_info omap3xxx_usb_tll_hs_irqs[] = {
+       { .name = "tll-irq", .irq = 78 },
+       { .irq = -1 }
+};
+
+static struct omap_hwmod_addr_space omap3xxx_usb_tll_hs_addrs[] = {
+       {
+               .name           = "tll",
+               .pa_start       = 0x48062000,
+               .pa_end         = 0x48062fff,
+               .flags          = ADDR_TYPE_RT
+       },
+       {}
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_core__usb_tll_hs = {
+       .master         = &omap3xxx_l4_core_hwmod,
+       .slave          = &omap3xxx_usb_tll_hs_hwmod,
+       .clk            = "usbtll_ick",
+       .addr           = omap3xxx_usb_tll_hs_addrs,
+       .user           = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_usb_tll_hs_slaves[] = {
+       &omap3xxx_l4_core__usb_tll_hs,
+};
+
+static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod = {
+       .name           = "usb_tll_hs",
+       .class          = &omap3xxx_usb_tll_hs_hwmod_class,
+       .clkdm_name     = "l3_init_clkdm",
+       .mpu_irqs       = omap3xxx_usb_tll_hs_irqs,
+       .main_clk       = "usbtll_fck",
+       .prcm = {
+               .omap2 = {
+                       .module_offs = CORE_MOD,
+                       .prcm_reg_id = 3,
+                       .module_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
+                       .idlest_reg_id = 3,
+                       .idlest_idle_bit = OMAP3430ES2_ST_USBTLL_SHIFT,
+               },
+       },
+       .slaves         = omap3xxx_usb_tll_hs_slaves,
+       .slaves_cnt     = ARRAY_SIZE(omap3xxx_usb_tll_hs_slaves),
+};
+
 static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
        &omap3xxx_l3_main_hwmod,
        &omap3xxx_l4_core_hwmod,
        &omap3xxx_l4_per_hwmod,
        &omap3xxx_l4_wkup_hwmod,
-       &omap3xxx_mmc1_hwmod,
-       &omap3xxx_mmc2_hwmod,
        &omap3xxx_mmc3_hwmod,
        &omap3xxx_mpu_hwmod,
 
@@ -3198,12 +3517,12 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
        &omap3xxx_timer9_hwmod,
        &omap3xxx_timer10_hwmod,
        &omap3xxx_timer11_hwmod,
-       &omap3xxx_timer12_hwmod,
 
        &omap3xxx_wd_timer2_hwmod,
        &omap3xxx_uart1_hwmod,
        &omap3xxx_uart2_hwmod,
        &omap3xxx_uart3_hwmod,
+
        /* dss class */
        &omap3xxx_dss_dispc_hwmod,
        &omap3xxx_dss_dsi1_hwmod,
@@ -3245,20 +3564,38 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
        NULL,
 };
 
+/* GP-only hwmods */
+static __initdata struct omap_hwmod *omap3xxx_gp_hwmods[] = {
+       &omap3xxx_timer12_hwmod,
+       NULL
+};
+
 /* 3430ES1-only hwmods */
 static __initdata struct omap_hwmod *omap3430es1_hwmods[] = {
-       &omap3xxx_iva_hwmod,
        &omap3430es1_dss_core_hwmod,
-       &omap3xxx_mailbox_hwmod,
        NULL
 };
 
 /* 3430ES2+-only hwmods */
 static __initdata struct omap_hwmod *omap3430es2plus_hwmods[] = {
-       &omap3xxx_iva_hwmod,
        &omap3xxx_dss_core_hwmod,
        &omap3xxx_usbhsotg_hwmod,
-       &omap3xxx_mailbox_hwmod,
+       &omap3xxx_usb_host_hs_hwmod,
+       &omap3xxx_usb_tll_hs_hwmod,
+       NULL
+};
+
+/* <= 3430ES3-only hwmods */
+static struct omap_hwmod *omap3430_pre_es3_hwmods[] __initdata = {
+       &omap3xxx_pre_es3_mmc1_hwmod,
+       &omap3xxx_pre_es3_mmc2_hwmod,
+       NULL
+};
+
+/* 3430ES3+-only hwmods */
+static struct omap_hwmod *omap3430_es3plus_hwmods[] __initdata = {
+       &omap3xxx_es3plus_mmc1_hwmod,
+       &omap3xxx_es3plus_mmc2_hwmod,
        NULL
 };
 
@@ -3280,12 +3617,21 @@ static __initdata struct omap_hwmod *omap36xx_hwmods[] = {
        &omap36xx_sr2_hwmod,
        &omap3xxx_usbhsotg_hwmod,
        &omap3xxx_mailbox_hwmod,
+       &omap3xxx_usb_host_hs_hwmod,
+       &omap3xxx_usb_tll_hs_hwmod,
+       &omap3xxx_es3plus_mmc1_hwmod,
+       &omap3xxx_es3plus_mmc2_hwmod,
        NULL
 };
 
 static __initdata struct omap_hwmod *am35xx_hwmods[] = {
        &omap3xxx_dss_core_hwmod, /* XXX ??? */
        &am35xx_usbhsotg_hwmod,
+       &am35xx_uart4_hwmod,
+       &omap3xxx_usb_host_hs_hwmod,
+       &omap3xxx_usb_tll_hs_hwmod,
+       &omap3xxx_es3plus_mmc1_hwmod,
+       &omap3xxx_es3plus_mmc2_hwmod,
        NULL
 };
 
@@ -3300,6 +3646,13 @@ int __init omap3xxx_hwmod_init(void)
        if (r < 0)
                return r;
 
+       /* Register GP-only hwmods. */
+       if (omap_type() == OMAP2_DEVICE_TYPE_GP) {
+               r = omap_hwmod_register(omap3xxx_gp_hwmods);
+               if (r < 0)
+                       return r;
+       }
+
        rev = omap_rev();
 
        /*
@@ -3338,6 +3691,21 @@ int __init omap3xxx_hwmod_init(void)
                h = omap3430es2plus_hwmods;
        };
 
+       if (h) {
+               r = omap_hwmod_register(h);
+               if (r < 0)
+                       return r;
+       }
+
+       h = NULL;
+       if (rev == OMAP3430_REV_ES1_0 || rev == OMAP3430_REV_ES2_0 ||
+           rev == OMAP3430_REV_ES2_1) {
+               h = omap3430_pre_es3_hwmods;
+       } else if (rev == OMAP3430_REV_ES3_0 || rev == OMAP3430_REV_ES3_1 ||
+                  rev == OMAP3430_REV_ES3_1_2) {
+               h = omap3430_es3plus_hwmods;
+       };
+
        if (h)
                r = omap_hwmod_register(h);
 
index daaf165af696f212c6dcadb4db7ac3539d54dcd6..f9f1510817603332292348eedccca1155ac80895 100644 (file)
@@ -70,6 +70,8 @@ static struct omap_hwmod omap44xx_mmc2_hwmod;
 static struct omap_hwmod omap44xx_mpu_hwmod;
 static struct omap_hwmod omap44xx_mpu_private_hwmod;
 static struct omap_hwmod omap44xx_usb_otg_hs_hwmod;
+static struct omap_hwmod omap44xx_usb_host_hs_hwmod;
+static struct omap_hwmod omap44xx_usb_tll_hs_hwmod;
 
 /*
  * Interconnects omap_hwmod structures
@@ -2246,6 +2248,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_i2c_sysc = {
                           SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
        .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
                           SIDLE_SMART_WKUP),
+       .clockact       = CLOCKACT_TEST_ICLK,
        .sysc_fields    = &omap_hwmod_sysc_type1,
 };
 
@@ -2300,7 +2303,7 @@ static struct omap_hwmod omap44xx_i2c1_hwmod = {
        .name           = "i2c1",
        .class          = &omap44xx_i2c_hwmod_class,
        .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_16BIT_REG,
+       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
        .mpu_irqs       = omap44xx_i2c1_irqs,
        .sdma_reqs      = omap44xx_i2c1_sdma_reqs,
        .main_clk       = "i2c1_fck",
@@ -2356,7 +2359,7 @@ static struct omap_hwmod omap44xx_i2c2_hwmod = {
        .name           = "i2c2",
        .class          = &omap44xx_i2c_hwmod_class,
        .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_16BIT_REG,
+       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
        .mpu_irqs       = omap44xx_i2c2_irqs,
        .sdma_reqs      = omap44xx_i2c2_sdma_reqs,
        .main_clk       = "i2c2_fck",
@@ -2412,7 +2415,7 @@ static struct omap_hwmod omap44xx_i2c3_hwmod = {
        .name           = "i2c3",
        .class          = &omap44xx_i2c_hwmod_class,
        .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_16BIT_REG,
+       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
        .mpu_irqs       = omap44xx_i2c3_irqs,
        .sdma_reqs      = omap44xx_i2c3_sdma_reqs,
        .main_clk       = "i2c3_fck",
@@ -2468,7 +2471,7 @@ static struct omap_hwmod omap44xx_i2c4_hwmod = {
        .name           = "i2c4",
        .class          = &omap44xx_i2c_hwmod_class,
        .clkdm_name     = "l4_per_clkdm",
-       .flags          = HWMOD_16BIT_REG,
+       .flags          = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
        .mpu_irqs       = omap44xx_i2c4_irqs,
        .sdma_reqs      = omap44xx_i2c4_sdma_reqs,
        .main_clk       = "i2c4_fck",
@@ -5276,6 +5279,207 @@ static struct omap_hwmod omap44xx_wd_timer3_hwmod = {
        .slaves_cnt     = ARRAY_SIZE(omap44xx_wd_timer3_slaves),
 };
 
+/*
+ * 'usb_host_hs' class
+ * high-speed multi-port usb host controller
+ */
+static struct omap_hwmod_ocp_if omap44xx_usb_host_hs__l3_main_2 = {
+       .master         = &omap44xx_usb_host_hs_hwmod,
+       .slave          = &omap44xx_l3_main_2_hwmod,
+       .clk            = "l3_div_ck",
+       .user           = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = {
+       .rev_offs       = 0x0000,
+       .sysc_offs      = 0x0010,
+       .syss_offs      = 0x0014,
+       .sysc_flags     = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
+                          SYSC_HAS_SOFTRESET),
+       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
+                          SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
+                          MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
+       .sysc_fields    = &omap_hwmod_sysc_type2,
+};
+
+static struct omap_hwmod_class omap44xx_usb_host_hs_hwmod_class = {
+       .name = "usb_host_hs",
+       .sysc = &omap44xx_usb_host_hs_sysc,
+};
+
+static struct omap_hwmod_ocp_if *omap44xx_usb_host_hs_masters[] = {
+       &omap44xx_usb_host_hs__l3_main_2,
+};
+
+static struct omap_hwmod_addr_space omap44xx_usb_host_hs_addrs[] = {
+       {
+               .name           = "uhh",
+               .pa_start       = 0x4a064000,
+               .pa_end         = 0x4a0647ff,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+               .name           = "ohci",
+               .pa_start       = 0x4a064800,
+               .pa_end         = 0x4a064bff,
+       },
+       {
+               .name           = "ehci",
+               .pa_start       = 0x4a064c00,
+               .pa_end         = 0x4a064fff,
+       },
+       {}
+};
+
+static struct omap_hwmod_irq_info omap44xx_usb_host_hs_irqs[] = {
+       { .name = "ohci-irq", .irq = 76 + OMAP44XX_IRQ_GIC_START },
+       { .name = "ehci-irq", .irq = 77 + OMAP44XX_IRQ_GIC_START },
+       { .irq = -1 }
+};
+
+static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_hs = {
+       .master         = &omap44xx_l4_cfg_hwmod,
+       .slave          = &omap44xx_usb_host_hs_hwmod,
+       .clk            = "l4_div_ck",
+       .addr           = omap44xx_usb_host_hs_addrs,
+       .user           = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod_ocp_if *omap44xx_usb_host_hs_slaves[] = {
+       &omap44xx_l4_cfg__usb_host_hs,
+};
+
+static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
+       .name           = "usb_host_hs",
+       .class          = &omap44xx_usb_host_hs_hwmod_class,
+       .clkdm_name     = "l3_init_clkdm",
+       .main_clk       = "usb_host_hs_fck",
+       .prcm = {
+               .omap4 = {
+                       .clkctrl_offs = OMAP4_CM_L3INIT_USB_HOST_CLKCTRL_OFFSET,
+                       .context_offs = OMAP4_RM_L3INIT_USB_HOST_CONTEXT_OFFSET,
+                       .modulemode   = MODULEMODE_SWCTRL,
+               },
+       },
+       .mpu_irqs       = omap44xx_usb_host_hs_irqs,
+       .slaves         = omap44xx_usb_host_hs_slaves,
+       .slaves_cnt     = ARRAY_SIZE(omap44xx_usb_host_hs_slaves),
+       .masters        = omap44xx_usb_host_hs_masters,
+       .masters_cnt    = ARRAY_SIZE(omap44xx_usb_host_hs_masters),
+
+       /*
+        * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock
+        * id: i660
+        *
+        * Description:
+        * In the following configuration :
+        * - USBHOST module is set to smart-idle mode
+        * - PRCM asserts idle_req to the USBHOST module ( This typically
+        *   happens when the system is going to a low power mode : all ports
+        *   have been suspended, the master part of the USBHOST module has
+        *   entered the standby state, and SW has cut the functional clocks)
+        * - an USBHOST interrupt occurs before the module is able to answer
+        *   idle_ack, typically a remote wakeup IRQ.
+        * Then the USB HOST module will enter a deadlock situation where it
+        * is no more accessible nor functional.
+        *
+        * Workaround:
+        * Don't use smart idle; use only force idle, hence HWMOD_SWSUP_SIDLE
+        */
+
+       /*
+        * Errata: USB host EHCI may stall when entering smart-standby mode
+        * Id: i571
+        *
+        * Description:
+        * When the USBHOST module is set to smart-standby mode, and when it is
+        * ready to enter the standby state (i.e. all ports are suspended and
+        * all attached devices are in suspend mode), then it can wrongly assert
+        * the Mstandby signal too early while there are still some residual OCP
+        * transactions ongoing. If this condition occurs, the internal state
+        * machine may go to an undefined state and the USB link may be stuck
+        * upon the next resume.
+        *
+        * Workaround:
+        * Don't use smart standby; use only force standby,
+        * hence HWMOD_SWSUP_MSTANDBY
+        */
+
+       /*
+        * During system boot; If the hwmod framework resets the module
+        * the module will have smart idle settings; which can lead to deadlock
+        * (above Errata Id:i660); so, dont reset the module during boot;
+        * Use HWMOD_INIT_NO_RESET.
+        */
+
+       .flags          = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
+                         HWMOD_INIT_NO_RESET,
+};
+
+/*
+ * 'usb_tll_hs' class
+ * usb_tll_hs module is the adapter on the usb_host_hs ports
+ */
+static struct omap_hwmod_class_sysconfig omap44xx_usb_tll_hs_sysc = {
+       .rev_offs       = 0x0000,
+       .sysc_offs      = 0x0010,
+       .syss_offs      = 0x0014,
+       .sysc_flags     = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+                          SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+                          SYSC_HAS_AUTOIDLE),
+       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+       .sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap44xx_usb_tll_hs_hwmod_class = {
+       .name = "usb_tll_hs",
+       .sysc = &omap44xx_usb_tll_hs_sysc,
+};
+
+static struct omap_hwmod_irq_info omap44xx_usb_tll_hs_irqs[] = {
+       { .name = "tll-irq", .irq = 78 + OMAP44XX_IRQ_GIC_START },
+       { .irq = -1 }
+};
+
+static struct omap_hwmod_addr_space omap44xx_usb_tll_hs_addrs[] = {
+       {
+               .name           = "tll",
+               .pa_start       = 0x4a062000,
+               .pa_end         = 0x4a063fff,
+               .flags          = ADDR_TYPE_RT
+       },
+       {}
+};
+
+static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_tll_hs = {
+       .master         = &omap44xx_l4_cfg_hwmod,
+       .slave          = &omap44xx_usb_tll_hs_hwmod,
+       .clk            = "l4_div_ck",
+       .addr           = omap44xx_usb_tll_hs_addrs,
+       .user           = OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+static struct omap_hwmod_ocp_if *omap44xx_usb_tll_hs_slaves[] = {
+       &omap44xx_l4_cfg__usb_tll_hs,
+};
+
+static struct omap_hwmod omap44xx_usb_tll_hs_hwmod = {
+       .name           = "usb_tll_hs",
+       .class          = &omap44xx_usb_tll_hs_hwmod_class,
+       .clkdm_name     = "l3_init_clkdm",
+       .main_clk       = "usb_tll_hs_ick",
+       .prcm = {
+               .omap4 = {
+                       .clkctrl_offs = OMAP4_CM_L3INIT_USB_TLL_CLKCTRL_OFFSET,
+                       .context_offs = OMAP4_RM_L3INIT_USB_TLL_CONTEXT_OFFSET,
+                       .modulemode   = MODULEMODE_HWCTRL,
+               },
+       },
+       .mpu_irqs       = omap44xx_usb_tll_hs_irqs,
+       .slaves         = omap44xx_usb_tll_hs_slaves,
+       .slaves_cnt     = ARRAY_SIZE(omap44xx_usb_tll_hs_slaves),
+};
+
 static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 
        /* dmm class */
@@ -5415,13 +5619,16 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
        &omap44xx_uart3_hwmod,
        &omap44xx_uart4_hwmod,
 
+       /* usb host class */
+       &omap44xx_usb_host_hs_hwmod,
+       &omap44xx_usb_tll_hs_hwmod,
+
        /* usb_otg_hs class */
        &omap44xx_usb_otg_hs_hwmod,
 
        /* wd_timer class */
        &omap44xx_wd_timer2_hwmod,
        &omap44xx_wd_timer3_hwmod,
-
        NULL,
 };
 
index 0363dcb0ef931aa57aba6dbee6f60dd9fef11f57..da2d80f5fcbdf809637506088a57a1ab7eefc444 100644 (file)
 #define OMAP3430_EN_MMC2_SHIFT                         25
 #define OMAP3430_EN_MMC1_MASK                          (1 << 24)
 #define OMAP3430_EN_MMC1_SHIFT                         24
+#define OMAP3430_EN_UART4_MASK                         (1 << 23)
+#define OMAP3430_EN_UART4_SHIFT                                23
 #define OMAP3430_EN_MCSPI4_MASK                                (1 << 21)
 #define OMAP3430_EN_MCSPI4_SHIFT                       21
 #define OMAP3430_EN_MCSPI3_MASK                                (1 << 20)
index 89ae29847c59c11254f15a84e907c61018f70765..771dc781b746377707c23f01b2cff2516711f6ec 100644 (file)
 #include <mach/hardware.h>
 #include <mach/irqs.h>
 #include <plat/usb.h>
+#include <plat/omap_device.h>
 
 #include "mux.h"
 
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
-#define OMAP_USBHS_DEVICE      "usbhs-omap"
-
-static struct resource usbhs_resources[] = {
-       {
-               .name   = "uhh",
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               .name   = "tll",
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               .name   = "ehci",
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               .name   = "ehci-irq",
-               .flags  = IORESOURCE_IRQ,
-       },
-       {
-               .name   = "ohci",
-               .flags  = IORESOURCE_MEM,
-       },
-       {
-               .name   = "ohci-irq",
-               .flags  = IORESOURCE_IRQ,
-       }
-};
-
-static struct platform_device usbhs_device = {
-       .name           = OMAP_USBHS_DEVICE,
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(usbhs_resources),
-       .resource       = usbhs_resources,
-};
+#define OMAP_USBHS_DEVICE      "usbhs_omap"
+#define        USBHS_UHH_HWMODNAME     "usb_host_hs"
+#define USBHS_TLL_HWMODNAME    "usb_tll_hs"
 
 static struct usbhs_omap_platform_data         usbhs_data;
 static struct ehci_hcd_omap_platform_data      ehci_data;
 static struct ohci_hcd_omap_platform_data      ohci_data;
 
+static struct omap_device_pm_latency omap_uhhtll_latency[] = {
+         {
+               .deactivate_func = omap_device_idle_hwmods,
+               .activate_func   = omap_device_enable_hwmods,
+               .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+         },
+};
+
 /* MUX settings for EHCI pins */
 /*
  * 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)
 
 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 {
-       int     i;
+       struct omap_hwmod       *oh[2];
+       struct omap_device      *od;
+       int                     bus_id = -1;
+       int                     i;
 
        for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
                usbhs_data.port_mode[i] = pdata->port_mode[i];
@@ -523,44 +503,34 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
        usbhs_data.ohci_data = &ohci_data;
 
        if (cpu_is_omap34xx()) {
-               usbhs_resources[0].start = OMAP34XX_UHH_CONFIG_BASE;
-               usbhs_resources[0].end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
-               usbhs_resources[1].start = OMAP34XX_USBTLL_BASE;
-               usbhs_resources[1].end = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
-               usbhs_resources[2].start        = OMAP34XX_EHCI_BASE;
-               usbhs_resources[2].end  = OMAP34XX_EHCI_BASE + SZ_1K - 1;
-               usbhs_resources[3].start = INT_34XX_EHCI_IRQ;
-               usbhs_resources[4].start        = OMAP34XX_OHCI_BASE;
-               usbhs_resources[4].end  = OMAP34XX_OHCI_BASE + SZ_1K - 1;
-               usbhs_resources[5].start = INT_34XX_OHCI_IRQ;
                setup_ehci_io_mux(pdata->port_mode);
                setup_ohci_io_mux(pdata->port_mode);
        } else if (cpu_is_omap44xx()) {
-               usbhs_resources[0].start = OMAP44XX_UHH_CONFIG_BASE;
-               usbhs_resources[0].end = OMAP44XX_UHH_CONFIG_BASE + SZ_1K - 1;
-               usbhs_resources[1].start = OMAP44XX_USBTLL_BASE;
-               usbhs_resources[1].end = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
-               usbhs_resources[2].start = OMAP44XX_HSUSB_EHCI_BASE;
-               usbhs_resources[2].end = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
-               usbhs_resources[3].start = OMAP44XX_IRQ_EHCI;
-               usbhs_resources[4].start = OMAP44XX_HSUSB_OHCI_BASE;
-               usbhs_resources[4].end = OMAP44XX_HSUSB_OHCI_BASE + SZ_1K - 1;
-               usbhs_resources[5].start = OMAP44XX_IRQ_OHCI;
                setup_4430ehci_io_mux(pdata->port_mode);
                setup_4430ohci_io_mux(pdata->port_mode);
        }
 
-       if (platform_device_add_data(&usbhs_device,
-                               &usbhs_data, sizeof(usbhs_data)) < 0) {
-               printk(KERN_ERR "USBHS platform_device_add_data failed\n");
-               goto init_end;
+       oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
+       if (!oh[0]) {
+               pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
+               return;
        }
 
-       if (platform_device_register(&usbhs_device) < 0)
-               printk(KERN_ERR "USBHS platform_device_register failed\n");
+       oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
+       if (!oh[1]) {
+               pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
+               return;
+       }
 
-init_end:
-       return;
+       od = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
+                               (void *)&usbhs_data, sizeof(usbhs_data),
+                               omap_uhhtll_latency,
+                               ARRAY_SIZE(omap_uhhtll_latency), false);
+       if (IS_ERR(od)) {
+               pr_err("Could not build hwmod devices %s,%s\n",
+                       USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
+               return;
+       }
 }
 
 #else
@@ -570,5 +540,3 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 }
 
 #endif
-
-
index 4cb069fd9af2e82b8504f032993bd696be6d4c70..ccdac4b6a4696db1e3bcfb5bf6912496c041c498 100644 (file)
@@ -138,7 +138,7 @@ static void am200_cleanup(struct metronomefb_par *par)
 {
        int i;
 
-       free_irq(IRQ_GPIO(RDY_GPIO_PIN), par);
+       free_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), par);
 
        for (i = 0; i < ARRAY_SIZE(gpios); i++)
                gpio_free(gpios[i]);
@@ -292,7 +292,7 @@ static int am200_setup_irq(struct fb_info *info)
 {
        int ret;
 
-       ret = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am200_handle_irq,
+       ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am200_handle_irq,
                                IRQF_DISABLED|IRQF_TRIGGER_FALLING,
                                "AM200", info->par);
        if (ret)
index fa8bad235d9f94d7b374d58c5e4d4d12efa5059d..76c4b9494031c46050ef1704738bf4bbd7097561 100644 (file)
@@ -176,7 +176,7 @@ static void am300_cleanup(struct broadsheetfb_par *par)
 {
        int i;
 
-       free_irq(IRQ_GPIO(RDY_GPIO_PIN), par);
+       free_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), par);
 
        for (i = 0; i < ARRAY_SIZE(gpios); i++)
                gpio_free(gpios[i]);
@@ -240,7 +240,7 @@ static int am300_setup_irq(struct fb_info *info)
        int ret;
        struct broadsheetfb_par *par = info->par;
 
-       ret = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am300_handle_irq,
+       ret = request_irq(PXA_GPIO_TO_IRQ(RDY_GPIO_PIN), am300_handle_irq,
                                IRQF_DISABLED|IRQF_TRIGGER_RISING,
                                "AM300", par);
        if (ret)
index 4b81f59a4cbaf5aebbac8c1d55980d9b4dd45618..11f2223da5765c942312b80d9bee244dea3353b3 100644 (file)
@@ -179,7 +179,7 @@ static unsigned long balloon3_ac97_pin_config[] __initdata = {
 };
 
 static struct ucb1400_pdata vpac270_ucb1400_pdata = {
-       .irq            = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ),
+       .irq            = PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ),
 };
 
 
index 4efc16d39c7985810d45b683fdab335a988ab9e3..5516317b9e64dd59a43d90648b5b3e29678f9205 100644 (file)
@@ -50,8 +50,8 @@ static struct resource capc7117_ide_resources[] = {
               .flags = IORESOURCE_MEM
        },
        [2] = {
-              .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)),
-              .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)),
+              .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
+              .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO76)),
               .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING
        }
 };
@@ -80,7 +80,7 @@ static void __init capc7117_ide_init(void)
 static struct plat_serial8250_port ti16c752_platform_data[] = {
        [0] = {
               .mapbase = 0x14000000,
-              .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO78)),
+              .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO78)),
               .irqflags = IRQF_TRIGGER_RISING,
               .flags = TI16C752_FLAGS,
               .iotype = UPIO_MEM,
@@ -89,7 +89,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
        },
        [1] = {
               .mapbase = 0x14000040,
-              .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO79)),
+              .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO79)),
               .irqflags = IRQF_TRIGGER_RISING,
               .flags = TI16C752_FLAGS,
               .iotype = UPIO_MEM,
@@ -98,7 +98,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
        },
        [2] = {
               .mapbase = 0x14000080,
-              .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO80)),
+              .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO80)),
               .irqflags = IRQF_TRIGGER_RISING,
               .flags = TI16C752_FLAGS,
               .iotype = UPIO_MEM,
@@ -107,7 +107,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
        },
        [3] = {
               .mapbase = 0x140000c0,
-              .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO81)),
+              .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO81)),
               .irqflags = IRQF_TRIGGER_RISING,
               .flags = TI16C752_FLAGS,
               .iotype = UPIO_MEM,
index 13518a7053994dbfe6c4ce422ee994a88d3e21f4..431ef56700c419f4fa04cc73cd999644d4ba1a6e 100644 (file)
@@ -33,7 +33,7 @@
 /* GPIO IRQ usage */
 #define GPIO83_MMC_IRQ         (83)
 
-#define CMX270_MMC_IRQ         IRQ_GPIO(GPIO83_MMC_IRQ)
+#define CMX270_MMC_IRQ         PXA_GPIO_TO_IRQ(GPIO83_MMC_IRQ)
 
 /* MMC power enable */
 #define GPIO105_MMC_POWER      (105)
@@ -380,7 +380,7 @@ static struct spi_board_info cm_x270_spi_devices[] __initdata = {
                .modalias               = "libertas_spi",
                .max_speed_hz           = 13000000,
                .bus_num                = 2,
-               .irq                    = gpio_to_irq(95),
+               .irq                    = PXA_GPIO_TO_IRQ(95),
                .chip_select            = 0,
                .controller_data        = &cm_x270_libertas_chip,
                .platform_data          = &cm_x270_libertas_pdata,
index f2e4190080cbd2b5584fe03c1ce6aeae705b94e7..9344a0e3ba8aab32287c38b33a71c8cab76c57cd 100644 (file)
@@ -58,8 +58,8 @@ extern void cmx270_init(void);
 #define CMX255_GPIO_IT8152_IRQ (0)
 #define CMX270_GPIO_IT8152_IRQ (22)
 
-#define CMX255_ETHIRQ          IRQ_GPIO(GPIO22_ETHIRQ)
-#define CMX270_ETHIRQ          IRQ_GPIO(GPIO10_ETHIRQ)
+#define CMX255_ETHIRQ          PXA_GPIO_TO_IRQ(GPIO22_ETHIRQ)
+#define CMX270_ETHIRQ          PXA_GPIO_TO_IRQ(GPIO10_ETHIRQ)
 
 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
 static struct resource cmx255_dm9000_resource[] = {
index e096bba8fd57c231aaa0593c4b0efc19f2649e93..684acf6ed3d5c1b0d370c12c8eedee166da84a5e 100644 (file)
@@ -64,7 +64,7 @@
 #define GPIO82_MMC_IRQ         (82)
 #define GPIO85_MMC_WP          (85)
 
-#define        CM_X300_MMC_IRQ         IRQ_GPIO(GPIO82_MMC_IRQ)
+#define        CM_X300_MMC_IRQ         PXA_GPIO_TO_IRQ(GPIO82_MMC_IRQ)
 
 #define GPIO95_RTC_CS          (95)
 #define GPIO96_RTC_WR          (96)
@@ -229,8 +229,8 @@ static struct resource dm9000_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [2] = {
-               .start  = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)),
-               .end    = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)),
+               .start  = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO99)),
+               .end    = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO99)),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        }
 };
index 05bfa1b1c001756b465731e5ac67fa0185ef79c5..f0fe9a51dfccd108db139fe00fffe6f64e04604c 100644 (file)
@@ -218,8 +218,8 @@ static struct resource colibri_pxa270_dm9000_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        {
-               .start  = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
-               .end    = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
+               .start  = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
+               .end    = PXA_GPIO_TO_IRQ(GPIO114_COLIBRI_PXA270_ETH_IRQ),
                .flags  = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
        },
 };
@@ -249,7 +249,7 @@ static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = {
 };
 
 static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = {
-       .irq            = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ),
+       .irq            = PXA_GPIO_TO_IRQ(GPIO113_COLIBRI_PXA270_TS_IRQ),
 };
 
 static struct platform_device colibri_pxa270_ucb1400_device = {
index c825e8bf2db14a922978ae1b6442b7185fd6800d..0a6222e20f9bd7ac23a3a4d380da5347e6c5a91e 100644 (file)
@@ -78,8 +78,8 @@ static struct resource colibri_asix_resource[] = {
                .flags = IORESOURCE_MEM,
        },
        [1] = {
-               .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
-               .end   = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
+               .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
+               .end   = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
                .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
        }
 };
index d23b92b80488257db2ef2bf4af458fc4060feaf8..56ab7a634bcac80ebe1e1511b086d7e04027da59 100644 (file)
@@ -115,8 +115,8 @@ static struct resource colibri_asix_resource[] = {
                .flags = IORESOURCE_MEM,
        },
        [1] = {
-               .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
-               .end   = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
+               .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
+               .end   = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
                .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
        }
 };
index 549468d088b9e0e34336ef0b50a3551258b8c366..3812ba0ff50c52f4477f67a901b732e45e0f63d6 100644 (file)
@@ -531,7 +531,7 @@ static struct spi_board_info corgi_spi_devices[] = {
                .chip_select    = 0,
                .platform_data  = &corgi_ads7846_info,
                .controller_data= &corgi_ads7846_chip,
-               .irq            = gpio_to_irq(CORGI_GPIO_TP_INT),
+               .irq            = PXA_GPIO_TO_IRQ(CORGI_GPIO_TP_INT),
        }, {
                .modalias       = "corgi-lcd",
                .max_speed_hz   = 50000,
index 29034778bfdaa03f2cc99608ac17de638ffa0c14..39e265cfc86d1af6eefb5362a9a7cc2f5cedf189 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/gpio.h>
+#include <linux/gpio-pxa.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/apm-emulation.h>
@@ -40,7 +41,9 @@ static struct gpio charger_gpios[] = {
        { CORGI_GPIO_ADC_TEMP_ON, GPIOF_OUT_INIT_LOW, "ADC Temp On" },
        { CORGI_GPIO_CHRG_ON,     GPIOF_OUT_INIT_LOW, "Charger On" },
        { CORGI_GPIO_CHRG_UKN,    GPIOF_OUT_INIT_LOW, "Charger Unknown" },
+       { CORGI_GPIO_AC_IN,       GPIOF_IN, "Charger Detection" },
        { CORGI_GPIO_KEY_INT,     GPIOF_IN, "Key Interrupt" },
+       { CORGI_GPIO_WAKEUP,      GPIOF_IN, "System wakeup notification" },
 };
 
 static void corgi_charger_init(void)
@@ -90,7 +93,12 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)
 {
        int is_resume = 0;
 
-       dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR);
+       dev_dbg(sharpsl_pm.dev, "PEDR = %x, GPIO_AC_IN = %d, "
+               "GPIO_CHRG_FULL = %d, GPIO_KEY_INT = %d, GPIO_WAKEUP = %d\n",
+               PEDR, gpio_get_value(CORGI_GPIO_AC_IN),
+               gpio_get_value(CORGI_GPIO_CHRG_FULL),
+               gpio_get_value(CORGI_GPIO_KEY_INT),
+               gpio_get_value(CORGI_GPIO_WAKEUP));
 
        if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) {
                if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
@@ -124,14 +132,21 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)
 
 static unsigned long corgi_charger_wakeup(void)
 {
-       return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) );
+       unsigned long ret;
+
+       ret = (!gpio_get_value(CORGI_GPIO_AC_IN) << GPIO_bit(CORGI_GPIO_AC_IN))
+               | (!gpio_get_value(CORGI_GPIO_KEY_INT)
+               << GPIO_bit(CORGI_GPIO_KEY_INT))
+               | (!gpio_get_value(CORGI_GPIO_WAKEUP)
+               << GPIO_bit(CORGI_GPIO_WAKEUP));
+       return ret;
 }
 
 unsigned long corgipm_read_devdata(int type)
 {
        switch(type) {
        case SHARPSL_STATUS_ACIN:
-               return ((GPLR(CORGI_GPIO_AC_IN) & GPIO_bit(CORGI_GPIO_AC_IN)) != 0);
+               return !gpio_get_value(CORGI_GPIO_AC_IN);
        case SHARPSL_STATUS_LOCK:
                return gpio_get_value(sharpsl_pm.machinfo->gpio_batlock);
        case SHARPSL_STATUS_CHRGFULL:
index 2e0425404de52e9204f07e61a4eec50924a1114e..5bc13121eac5d15eb239e3992b18f90720f67416 100644 (file)
@@ -1051,6 +1051,36 @@ struct platform_device pxa3xx_device_ssp4 = {
 };
 #endif /* CONFIG_PXA3xx || CONFIG_PXA95x */
 
+struct resource pxa_resource_gpio[] = {
+       {
+               .start  = 0x40e00000,
+               .end    = 0x40e0ffff,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .start  = IRQ_GPIO0,
+               .end    = IRQ_GPIO0,
+               .name   = "gpio0",
+               .flags  = IORESOURCE_IRQ,
+       }, {
+               .start  = IRQ_GPIO1,
+               .end    = IRQ_GPIO1,
+               .name   = "gpio1",
+               .flags  = IORESOURCE_IRQ,
+       }, {
+               .start  = IRQ_GPIO_2_x,
+               .end    = IRQ_GPIO_2_x,
+               .name   = "gpio_mux",
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+struct platform_device pxa_device_gpio = {
+       .name           = "pxa-gpio",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(pxa_resource_gpio),
+       .resource       = pxa_resource_gpio,
+};
+
 /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1.
  * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */
 void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info)
index 2fd5a8b35757ac5463303b278d3970d7d4df9d02..1475db1072546ba7d1029b5c0de3c32e526239f5 100644 (file)
@@ -16,6 +16,7 @@ extern struct platform_device pxa_device_ficp;
 extern struct platform_device sa1100_device_rtc;
 extern struct platform_device pxa_device_rtc;
 extern struct platform_device pxa_device_ac97;
+extern struct platform_device pxa_device_gpio;
 
 extern struct platform_device pxa27x_device_i2c_power;
 extern struct platform_device pxa27x_device_ohci;
index 94acc0b01dd6791b06d469bb83963a56c2c60849..3358f4da2ec975fcf877d00d7ef8721c1be0472c 100644 (file)
@@ -70,7 +70,7 @@
 /* common  GPIOs */
 #define GPIO11_NAND_CS         (11)
 #define GPIO41_ETHIRQ          (41)
-#define EM_X270_ETHIRQ         IRQ_GPIO(GPIO41_ETHIRQ)
+#define EM_X270_ETHIRQ         PXA_GPIO_TO_IRQ(GPIO41_ETHIRQ)
 #define GPIO115_WLAN_PWEN      (115)
 #define GPIO19_WLAN_STRAP      (19)
 #define GPIO9_USB_VBUS_EN      (9)
@@ -805,7 +805,7 @@ static struct spi_board_info em_x270_spi_devices[] __initdata = {
                .modalias               = "libertas_spi",
                .max_speed_hz           = 13000000,
                .bus_num                = 2,
-               .irq                    = IRQ_GPIO(116),
+               .irq                    = PXA_GPIO_TO_IRQ(116),
                .chip_select            = 0,
                .controller_data        = &em_x270_libertas_chip,
                .platform_data          = &em_x270_libertas_pdata,
@@ -1203,7 +1203,7 @@ static struct da903x_platform_data em_x270_da9030_info = {
 
 static struct i2c_board_info em_x270_i2c_pmic_info = {
        I2C_BOARD_INFO("da9030", 0x49),
-       .irq = IRQ_GPIO(0),
+       .irq = PXA_GPIO_TO_IRQ(0),
        .platform_data = &em_x270_da9030_info,
 };
 
index d82b7aa3c096eaf09f6b99d83953efad07bb07b4..e556a1e3ff0f2334f909a0944829e1b90551d6b7 100644 (file)
@@ -119,8 +119,8 @@ struct resource eseries_tmio_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
-               .end    = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
+               .start  = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
+               .end    = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
                .flags  = IORESOURCE_IRQ,
        },
 };
index 6f6368ece9bda4288e9a99a48118db5caedae72a..82e9976e565794ecab288cf7c0ee7a662ab16060 100644 (file)
@@ -252,8 +252,8 @@ static struct resource asic3_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ),
-               .end    = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ),
+               .start  = PXA_GPIO_TO_IRQ(GPIO12_HX4700_ASIC3_IRQ),
+               .end    = PXA_GPIO_TO_IRQ(GPIO12_HX4700_ASIC3_IRQ),
                .flags  = IORESOURCE_IRQ,
        },
        /* SD part */
@@ -263,8 +263,8 @@ static struct resource asic3_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [3] = {
-               .start  = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
-               .end    = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
+               .start  = PXA_GPIO_TO_IRQ(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
+               .end    = PXA_GPIO_TO_IRQ(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -587,7 +587,7 @@ static struct spi_board_info tsc2046_board_info[] __initdata = {
                .modalias        = "ads7846",
                .bus_num         = 2,
                .max_speed_hz    = 2600000, /* 100 kHz sample rate */
-               .irq             = gpio_to_irq(GPIO58_HX4700_TSC2046_nPENIRQ),
+               .irq             = PXA_GPIO_TO_IRQ(GPIO58_HX4700_TSC2046_nPENIRQ),
                .platform_data   = &tsc2046_info,
                .controller_data = &tsc2046_chip,
        },
@@ -635,15 +635,15 @@ static struct resource power_supply_resources[] = {
                .name  = "ac",
                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
                         IORESOURCE_IRQ_LOWEDGE,
-               .start = gpio_to_irq(GPIOD9_nAC_IN),
-               .end   = gpio_to_irq(GPIOD9_nAC_IN),
+               .start = PXA_GPIO_TO_IRQ(GPIOD9_nAC_IN),
+               .end   = PXA_GPIO_TO_IRQ(GPIOD9_nAC_IN),
        },
        [1] = {
                .name  = "usb",
                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
                         IORESOURCE_IRQ_LOWEDGE,
-               .start = gpio_to_irq(GPIOD14_nUSBC_DETECT),
-               .end   = gpio_to_irq(GPIOD14_nUSBC_DETECT),
+               .start = PXA_GPIO_TO_IRQ(GPIOD14_nUSBC_DETECT),
+               .end   = PXA_GPIO_TO_IRQ(GPIOD14_nUSBC_DETECT),
        },
 };
 
index f78d5db758daf920a732ed62543bf77ae788647d..33e81e87a9da27af15cf98851e159e765337b570 100644 (file)
@@ -86,7 +86,7 @@ static struct spi_board_info mcp251x_board_info[] = {
                .chip_select     = 0,
                .platform_data   = &mcp251x_info,
                .controller_data = &mcp251x_chip_info1,
-               .irq             = gpio_to_irq(ICONTROL_MCP251x_nIRQ1)
+               .irq             = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ1)
        },
        {
                .modalias        = "mcp2515",
@@ -95,7 +95,7 @@ static struct spi_board_info mcp251x_board_info[] = {
                .chip_select     = 1,
                .platform_data   = &mcp251x_info,
                .controller_data = &mcp251x_chip_info2,
-               .irq             = gpio_to_irq(ICONTROL_MCP251x_nIRQ2)
+               .irq             = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ2)
        },
        {
                .modalias        = "mcp2515",
@@ -104,7 +104,7 @@ static struct spi_board_info mcp251x_board_info[] = {
                .chip_select     = 0,
                .platform_data   = &mcp251x_info,
                .controller_data = &mcp251x_chip_info3,
-               .irq             = gpio_to_irq(ICONTROL_MCP251x_nIRQ3)
+               .irq             = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ3)
        },
        {
                .modalias        = "mcp2515",
@@ -113,7 +113,7 @@ static struct spi_board_info mcp251x_board_info[] = {
                .chip_select     = 1,
                .platform_data   = &mcp251x_info,
                .controller_data = &mcp251x_chip_info4,
-               .irq             = gpio_to_irq(ICONTROL_MCP251x_nIRQ4)
+               .irq             = PXA_GPIO_TO_IRQ(ICONTROL_MCP251x_nIRQ4)
        }
 };
 
index ddf20e5c376ed292a11b7945d5c35dc8ed3ca167..bb98ff57b71fc5ed1f2833057d876aa8110d4e02 100644 (file)
@@ -75,8 +75,8 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = IRQ_GPIO(4),
-               .end    = IRQ_GPIO(4),
+               .start  = PXA_GPIO_TO_IRQ(4),
+               .end    = PXA_GPIO_TO_IRQ(4),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        }
 };
index 6d7eab3d0867ab0b306fe6d0b6aaf62b84f8abcf..f02fa1e6ba8619d995773d831bdd04bb7ad34802 100644 (file)
@@ -172,9 +172,9 @@ enum balloon3_features {
 /* Balloon3 Interrupts */
 #define BALLOON3_IRQ(x)                (IRQ_BOARD_START + (x))
 
-#define BALLOON3_AUX_NIRQ      IRQ_GPIO(BALLOON3_GPIO_AUX_NIRQ)
-#define BALLOON3_CODEC_IRQ     IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ)
-#define BALLOON3_S0_CD_IRQ     IRQ_GPIO(BALLOON3_GPIO_S0_CD)
+#define BALLOON3_AUX_NIRQ      PXA_GPIO_TO_IRQ(BALLOON3_GPIO_AUX_NIRQ)
+#define BALLOON3_CODEC_IRQ     PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ)
+#define BALLOON3_S0_CD_IRQ     PXA_GPIO_TO_IRQ(BALLOON3_GPIO_S0_CD)
 
 #define BALLOON3_NR_IRQS       (IRQ_BOARD_START + 16)
 
index 5dfd1195a5a795be2947907dda3a24afeee108b2..f3c3493b468dff61399381567e89dbb6d6c5eeda 100644 (file)
 /*
  * Corgi Interrupts
  */
-#define CORGI_IRQ_GPIO_KEY_INT         IRQ_GPIO(0)
-#define CORGI_IRQ_GPIO_AC_IN           IRQ_GPIO(1)
-#define CORGI_IRQ_GPIO_WAKEUP          IRQ_GPIO(3)
-#define CORGI_IRQ_GPIO_AK_INT          IRQ_GPIO(4)
-#define CORGI_IRQ_GPIO_TP_INT          IRQ_GPIO(5)
-#define CORGI_IRQ_GPIO_nSD_DETECT      IRQ_GPIO(9)
-#define CORGI_IRQ_GPIO_nSD_INT         IRQ_GPIO(10)
-#define CORGI_IRQ_GPIO_MAIN_BAT_LOW    IRQ_GPIO(11)
-#define CORGI_IRQ_GPIO_CF_CD           IRQ_GPIO(14)
-#define CORGI_IRQ_GPIO_CHRG_FULL       IRQ_GPIO(16)    /* Battery fully charged */
-#define CORGI_IRQ_GPIO_CF_IRQ          IRQ_GPIO(17)
-#define CORGI_IRQ_GPIO_KEY_SENSE(a)    IRQ_GPIO(58+(a))        /* Keyboard Sense lines */
+#define CORGI_IRQ_GPIO_KEY_INT         PXA_GPIO_TO_IRQ(0)
+#define CORGI_IRQ_GPIO_AC_IN           PXA_GPIO_TO_IRQ(1)
+#define CORGI_IRQ_GPIO_WAKEUP          PXA_GPIO_TO_IRQ(3)
+#define CORGI_IRQ_GPIO_AK_INT          PXA_GPIO_TO_IRQ(4)
+#define CORGI_IRQ_GPIO_TP_INT          PXA_GPIO_TO_IRQ(5)
+#define CORGI_IRQ_GPIO_nSD_DETECT      PXA_GPIO_TO_IRQ(9)
+#define CORGI_IRQ_GPIO_nSD_INT         PXA_GPIO_TO_IRQ(10)
+#define CORGI_IRQ_GPIO_MAIN_BAT_LOW    PXA_GPIO_TO_IRQ(11)
+#define CORGI_IRQ_GPIO_CF_CD           PXA_GPIO_TO_IRQ(14)
+#define CORGI_IRQ_GPIO_CHRG_FULL       PXA_GPIO_TO_IRQ(16)     /* Battery fully charged */
+#define CORGI_IRQ_GPIO_CF_IRQ          PXA_GPIO_TO_IRQ(17)
+#define CORGI_IRQ_GPIO_KEY_SENSE(a)    PXA_GPIO_TO_IRQ(58+(a)) /* Keyboard Sense lines */
 
 
 /*
@@ -98,7 +98,7 @@
                        CORGI_SCP_MIC_BIAS )
 #define CORGI_SCOOP_IO_OUT     ( CORGI_SCP_MUTE_L | CORGI_SCP_MUTE_R )
 
-#define CORGI_SCOOP_GPIO_BASE          (NR_BUILTIN_GPIO)
+#define CORGI_SCOOP_GPIO_BASE          (PXA_NR_BUILTIN_GPIO)
 #define CORGI_GPIO_LED_GREEN           (CORGI_SCOOP_GPIO_BASE + 0)
 #define CORGI_GPIO_SWA                 (CORGI_SCOOP_GPIO_BASE + 1)  /* Hinge Switch A */
 #define CORGI_GPIO_SWB                 (CORGI_SCOOP_GPIO_BASE + 2)  /* Hinge Switch B */
index 747ab1a71f2f833c2941a3e9921a322b3b2d532c..2628e7b721168c99cb8dc1214934bcdffbfa8e1c 100644 (file)
@@ -19,8 +19,8 @@
 #define CSB726_FLASH_SIZE      (64 * 1024 * 1024)
 #define CSB726_FLASH_uMON      (8 * 1024 * 1024)
 
-#define CSB726_IRQ_LAN         gpio_to_irq(CSB726_GPIO_IRQ_LAN)
-#define CSB726_IRQ_SM501       gpio_to_irq(CSB726_GPIO_IRQ_SM501)
+#define CSB726_IRQ_LAN         PXA_GPIO_TO_IRQ(CSB726_GPIO_IRQ_LAN)
+#define CSB726_IRQ_SM501       PXA_GPIO_TO_IRQ(CSB726_GPIO_IRQ_SM501)
 
 #endif
 
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 (file)
index 41b4c93..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Written by Philipp Zabel <philipp.zabel@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-#ifndef __MACH_PXA_GPIO_PXA_H
-#define __MACH_PXA_GPIO_PXA_H
-
-#include <mach/irqs.h>
-#include <mach/hardware.h>
-
-#define GPIO_REGS_VIRT io_p2v(0x40E00000)
-
-#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
-#define GPIO_REG(x)    (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
-
-/* GPIO Pin Level Registers */
-#define GPLR0          GPIO_REG(BANK_OFF(0) + 0x00)
-#define GPLR1          GPIO_REG(BANK_OFF(1) + 0x00)
-#define GPLR2          GPIO_REG(BANK_OFF(2) + 0x00)
-#define GPLR3          GPIO_REG(BANK_OFF(3) + 0x00)
-
-/* GPIO Pin Direction Registers */
-#define GPDR0          GPIO_REG(BANK_OFF(0) + 0x0c)
-#define GPDR1          GPIO_REG(BANK_OFF(1) + 0x0c)
-#define GPDR2          GPIO_REG(BANK_OFF(2) + 0x0c)
-#define GPDR3          GPIO_REG(BANK_OFF(3) + 0x0c)
-
-/* GPIO Pin Output Set Registers */
-#define GPSR0          GPIO_REG(BANK_OFF(0) + 0x18)
-#define GPSR1          GPIO_REG(BANK_OFF(1) + 0x18)
-#define GPSR2          GPIO_REG(BANK_OFF(2) + 0x18)
-#define GPSR3          GPIO_REG(BANK_OFF(3) + 0x18)
-
-/* GPIO Pin Output Clear Registers */
-#define GPCR0          GPIO_REG(BANK_OFF(0) + 0x24)
-#define GPCR1          GPIO_REG(BANK_OFF(1) + 0x24)
-#define GPCR2          GPIO_REG(BANK_OFF(2) + 0x24)
-#define GPCR3          GPIO_REG(BANK_OFF(3) + 0x24)
-
-/* GPIO Rising Edge Detect Registers */
-#define GRER0          GPIO_REG(BANK_OFF(0) + 0x30)
-#define GRER1          GPIO_REG(BANK_OFF(1) + 0x30)
-#define GRER2          GPIO_REG(BANK_OFF(2) + 0x30)
-#define GRER3          GPIO_REG(BANK_OFF(3) + 0x30)
-
-/* GPIO Falling Edge Detect Registers */
-#define GFER0          GPIO_REG(BANK_OFF(0) + 0x3c)
-#define GFER1          GPIO_REG(BANK_OFF(1) + 0x3c)
-#define GFER2          GPIO_REG(BANK_OFF(2) + 0x3c)
-#define GFER3          GPIO_REG(BANK_OFF(3) + 0x3c)
-
-/* GPIO Edge Detect Status Registers */
-#define GEDR0          GPIO_REG(BANK_OFF(0) + 0x48)
-#define GEDR1          GPIO_REG(BANK_OFF(1) + 0x48)
-#define GEDR2          GPIO_REG(BANK_OFF(2) + 0x48)
-#define GEDR3          GPIO_REG(BANK_OFF(3) + 0x48)
-
-/* GPIO Alternate Function Select Registers */
-#define GAFR0_L                GPIO_REG(0x0054)
-#define GAFR0_U                GPIO_REG(0x0058)
-#define GAFR1_L                GPIO_REG(0x005C)
-#define GAFR1_U                GPIO_REG(0x0060)
-#define GAFR2_L                GPIO_REG(0x0064)
-#define GAFR2_U                GPIO_REG(0x0068)
-#define GAFR3_L                GPIO_REG(0x006C)
-#define GAFR3_U                GPIO_REG(0x0070)
-
-/* More handy macros.  The argument is a literal GPIO number. */
-
-#define GPIO_bit(x)    (1 << ((x) & 0x1f))
-
-#define GPLR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
-#define GPDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
-#define GPSR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
-#define GPCR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
-#define GRER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
-#define GFER(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
-#define GEDR(x)                GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
-#define GAFR(x)                GPIO_REG(0x54 + (((x) & 0x70) >> 2))
-
-
-#define NR_BUILTIN_GPIO                PXA_GPIO_IRQ_NUM
-
-#define gpio_to_bank(gpio)     ((gpio) >> 5)
-
-#ifdef CONFIG_CPU_PXA26x
-/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
- * as well as their Alternate Function value being '1' for GPIO in GAFRx.
- */
-static inline int __gpio_is_inverted(unsigned gpio)
-{
-       return cpu_is_pxa25x() && gpio > 85;
-}
-#else
-static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
-#endif
-
-/*
- * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
- * function of a GPIO, and GPDRx cannot be altered once configured. It
- * is attributed as "occupied" here (I know this terminology isn't
- * accurate, you are welcome to propose a better one :-)
- */
-static inline int __gpio_is_occupied(unsigned gpio)
-{
-       if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
-               int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
-               int dir = GPDR(gpio) & GPIO_bit(gpio);
-
-               if (__gpio_is_inverted(gpio))
-                       return af != 1 || dir == 0;
-               else
-                       return af != 0 || dir != 0;
-       } else
-               return GPDR(gpio) & GPIO_bit(gpio);
-}
-
-#include <plat/gpio-pxa.h>
-#endif /* __MACH_PXA_GPIO_PXA_H */
index 004cade7bb13b4c24ad642272f75388ebc101ef1..0248e433bc982525e69d641fe576e960e65ea437 100644 (file)
 #define __ASM_ARCH_PXA_GPIO_H
 
 #include <asm-generic/gpio.h>
-/* The defines for the driver are needed for the accelerated accessors */
-#include "gpio-pxa.h"
 
-#define gpio_to_irq(gpio)      IRQ_GPIO(gpio)
+#include <mach/irqs.h>
+#include <mach/hardware.h>
 
-static inline int irq_to_gpio(unsigned int irq)
-{
-       int gpio;
-
-       if (irq == IRQ_GPIO0 || irq == IRQ_GPIO1)
-               return irq - IRQ_GPIO0;
-
-       gpio = irq - PXA_GPIO_IRQ_BASE;
-       if (gpio >= 2 && gpio < NR_BUILTIN_GPIO)
-               return gpio;
-
-       return -1;
-}
-
-#include <plat/gpio.h>
 #endif
index 9b898680b206a7d59ec5aacadf8dafa8dadc677a..dba14b6503ad17008660d23f81306db42c72119c 100644 (file)
@@ -24,7 +24,7 @@ has detected a cable insertion; driven low otherwise. */
 #define GPIO_GUMSTIX_USB_GPIOx         41
 
 /* usb state change */
-#define GUMSTIX_USB_INTR_IRQ           IRQ_GPIO(GPIO_GUMSTIX_USB_GPIOn)
+#define GUMSTIX_USB_INTR_IRQ           PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_USB_GPIOn)
 
 #define GPIO_GUMSTIX_USB_GPIOn_MD      (GPIO_GUMSTIX_USB_GPIOn | GPIO_IN)
 #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. */
  */
 #define GUMSTIX_GPIO_nSD_WP            22 /* SD Write Protect */
 #define GUMSTIX_GPIO_nSD_DETECT                11 /* MMC/SD Card Detect */
-#define GUMSTIX_IRQ_GPIO_nSD_DETECT    IRQ_GPIO(GUMSTIX_GPIO_nSD_DETECT)
+#define GUMSTIX_IRQ_GPIO_nSD_DETECT    PXA_GPIO_TO_IRQ(GUMSTIX_GPIO_nSD_DETECT)
 
 /*
  * SMC Ethernet definitions
@@ -49,10 +49,10 @@ has detected a cable insertion; driven low otherwise. */
 
 #define GPIO_GUMSTIX_ETH0              36
 #define GPIO_GUMSTIX_ETH0_MD           (GPIO_GUMSTIX_ETH0 | GPIO_IN)
-#define GUMSTIX_ETH0_IRQ               IRQ_GPIO(GPIO_GUMSTIX_ETH0)
+#define GUMSTIX_ETH0_IRQ               PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0)
 #define GPIO_GUMSTIX_ETH1              27
 #define GPIO_GUMSTIX_ETH1_MD           (GPIO_GUMSTIX_ETH1 | GPIO_IN)
-#define GUMSTIX_ETH1_IRQ               IRQ_GPIO(GPIO_GUMSTIX_ETH1)
+#define GUMSTIX_ETH1_IRQ               PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH1)
 
 
 /* CF reset line */
@@ -63,18 +63,18 @@ has detected a cable insertion; driven low otherwise. */
 #define GPIO4_nSTSCHG                  GPIO4_nBVD1
 #define GPIO11_nCD                     11
 #define GPIO26_PRDY_nBSY               26
-#define GUMSTIX_S0_nSTSCHG_IRQ         IRQ_GPIO(GPIO4_nSTSCHG)
-#define GUMSTIX_S0_nCD_IRQ             IRQ_GPIO(GPIO11_nCD)
-#define GUMSTIX_S0_PRDY_nBSY_IRQ       IRQ_GPIO(GPIO26_PRDY_nBSY)
+#define GUMSTIX_S0_nSTSCHG_IRQ         PXA_GPIO_TO_IRQ(GPIO4_nSTSCHG)
+#define GUMSTIX_S0_nCD_IRQ             PXA_GPIO_TO_IRQ(GPIO11_nCD)
+#define GUMSTIX_S0_PRDY_nBSY_IRQ       PXA_GPIO_TO_IRQ(GPIO26_PRDY_nBSY)
 
 /* CF slot 1 */
 #define GPIO18_nBVD1                   18
 #define GPIO18_nSTSCHG                 GPIO18_nBVD1
 #define GPIO36_nCD                     36
 #define GPIO27_PRDY_nBSY               27
-#define GUMSTIX_S1_nSTSCHG_IRQ         IRQ_GPIO(GPIO18_nSTSCHG)
-#define GUMSTIX_S1_nCD_IRQ             IRQ_GPIO(GPIO36_nCD)
-#define GUMSTIX_S1_PRDY_nBSY_IRQ       IRQ_GPIO(GPIO27_PRDY_nBSY)
+#define GUMSTIX_S1_nSTSCHG_IRQ         PXA_GPIO_TO_IRQ(GPIO18_nSTSCHG)
+#define GUMSTIX_S1_nCD_IRQ             PXA_GPIO_TO_IRQ(GPIO36_nCD)
+#define GUMSTIX_S1_PRDY_nBSY_IRQ       PXA_GPIO_TO_IRQ(GPIO27_PRDY_nBSY)
 
 /* CF GPIO line modes */
 #define GPIO4_nSTSCHG_MD               (GPIO4_nSTSCHG | GPIO_IN)
index 37408449ec25e023264ae8852fc3bec9feb381a6..8bc02913517cd14a6e96f05295ff94f9fd250ee3 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/gpio.h>
 #include <linux/mfd/asic3.h>
 
-#define HX4700_ASIC3_GPIO_BASE NR_BUILTIN_GPIO
+#define HX4700_ASIC3_GPIO_BASE PXA_NR_BUILTIN_GPIO
 #define HX4700_EGPIO_BASE      (HX4700_ASIC3_GPIO_BASE + ASIC3_NUM_GPIOS)
 #define HX4700_NR_IRQS         (IRQ_BOARD_START + 70)
 
index 5eff96fcc944d764bdf9fc00423cbb1d62b1af79..22a96f87232b5d5bdf894b55624900e832d054f4 100644 (file)
 #define PCC_VS2                (1 << 1)
 #define PCC_VS1                (1 << 0)
 
-#define PCC_DETECT(x)  (GPLR(7 + (x)) & GPIO_bit(7 + (x)))
-
 /* A listing of interrupts used by external hardware devices */
 
-#define TOUCH_PANEL_IRQ                        IRQ_GPIO(5)
-#define IDE_IRQ                                IRQ_GPIO(21)
+#define TOUCH_PANEL_IRQ                        PXA_GPIO_TO_IRQ(5)
+#define IDE_IRQ                                PXA_GPIO_TO_IRQ(21)
 
 #define TOUCH_PANEL_IRQ_EDGE           IRQ_TYPE_EDGE_FALLING
 
-#define ETHERNET_IRQ                   IRQ_GPIO(4)
+#define ETHERNET_IRQ                   PXA_GPIO_TO_IRQ(4)
 #define ETHERNET_IRQ_EDGE              IRQ_TYPE_EDGE_RISING
 
 #define IDE_IRQ_EDGE                   IRQ_TYPE_EDGE_RISING
 
-#define PCMCIA_S0_CD_VALID             IRQ_GPIO(7)
+#define PCMCIA_S0_CD_VALID             PXA_GPIO_TO_IRQ(7)
 #define PCMCIA_S0_CD_VALID_EDGE                IRQ_TYPE_EDGE_BOTH
 
-#define PCMCIA_S1_CD_VALID             IRQ_GPIO(8)
+#define PCMCIA_S1_CD_VALID             PXA_GPIO_TO_IRQ(8)
 #define PCMCIA_S1_CD_VALID_EDGE                IRQ_TYPE_EDGE_BOTH
 
-#define PCMCIA_S0_RDYINT               IRQ_GPIO(19)
-#define PCMCIA_S1_RDYINT               IRQ_GPIO(22)
+#define PCMCIA_S0_RDYINT               PXA_GPIO_TO_IRQ(19)
+#define PCMCIA_S1_RDYINT               PXA_GPIO_TO_IRQ(22)
 
 
 /*
index 7cc5a781e99e4dc6683b16d3ed132645c420126d..32975adf3ca4927a2d77eba14efb1ad7bddd0638 100644 (file)
 #define IRQ_U2P                PXA_IRQ(93)     /* USB PHY D+/D- Lines (PXA935) */
 
 #define PXA_GPIO_IRQ_BASE      PXA_IRQ(96)
-#define PXA_GPIO_IRQ_NUM       (192)
-
-#define GPIO_2_x_TO_IRQ(x)     (PXA_GPIO_IRQ_BASE + (x))
-#define IRQ_GPIO(x)    (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x))
+#define PXA_NR_BUILTIN_GPIO    (192)
+#define PXA_GPIO_TO_IRQ(x)     (PXA_GPIO_IRQ_BASE + (x))
 
 /*
  * The following interrupts are for board specific purposes. Since
  * By default, no board IRQ is reserved. It should be finished in
  * custom board since sparse IRQ is already enabled.
  */
-#define IRQ_BOARD_START                (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM)
+#define IRQ_BOARD_START                (PXA_GPIO_IRQ_BASE + PXA_NR_BUILTIN_GPIO)
 
 #define NR_IRQS                        (IRQ_BOARD_START)
 
index b6238cbd8aeab1da22f6da03655a93e8bfb8b8e6..8066be54e9f53701cc2fe80bae2bf85540f5419a 100644 (file)
@@ -1,13 +1,11 @@
 #ifndef __ASM_ARCH_LITTLETON_H
 #define __ASM_ARCH_LITTLETON_H
 
-#include <mach/gpio-pxa.h>
-
 #define LITTLETON_ETH_PHYS     0x30000000
 
 #define LITTLETON_GPIO_LCD_CS  (17)
 
-#define EXT0_GPIO_BASE (NR_BUILTIN_GPIO)
+#define EXT0_GPIO_BASE (PXA_NR_BUILTIN_GPIO)
 #define EXT0_GPIO(x)   (EXT0_GPIO_BASE + (x))
 
 #define LITTLETON_NR_IRQS      (IRQ_BOARD_START + 8)
index 7cbfc5d3f9dfb9a6e9483922a237c83457759d31..ba6a6e1d29e9611c11b95363d55010e36c3a5981 100644 (file)
@@ -78,7 +78,7 @@
  * CPLD EGPIOs
  */
 
-#define MAGICIAN_EGPIO_BASE                    NR_BUILTIN_GPIO
+#define MAGICIAN_EGPIO_BASE                    PXA_NR_BUILTIN_GPIO
 #define MAGICIAN_EGPIO(reg,bit) \
        (MAGICIAN_EGPIO_BASE + 8*reg + bit)
 
index ae536e86d8e86b0f4b910cb823d136aa0aadd858..2c4471336570f0c38563f8b19d61b2a1b3bd5ed3 100644 (file)
 /* 20, 53 and 86 are usb related too */
 
 /* INTERRUPTS */
-#define IRQ_GPIO_PALMLD_GPIO_RESET     IRQ_GPIO(GPIO_NR_PALMLD_GPIO_RESET)
-#define IRQ_GPIO_PALMLD_SD_DETECT_N    IRQ_GPIO(GPIO_NR_PALMLD_SD_DETECT_N)
-#define IRQ_GPIO_PALMLD_WM9712_IRQ     IRQ_GPIO(GPIO_NR_PALMLD_WM9712_IRQ)
-#define IRQ_GPIO_PALMLD_IDE_IRQ                IRQ_GPIO(GPIO_NR_PALMLD_IDE_IRQ)
+#define IRQ_GPIO_PALMLD_GPIO_RESET     PXA_GPIO_TO_IRQ(GPIO_NR_PALMLD_GPIO_RESET)
+#define IRQ_GPIO_PALMLD_SD_DETECT_N    PXA_GPIO_TO_IRQ(GPIO_NR_PALMLD_SD_DETECT_N)
+#define IRQ_GPIO_PALMLD_WM9712_IRQ     PXA_GPIO_TO_IRQ(GPIO_NR_PALMLD_WM9712_IRQ)
+#define IRQ_GPIO_PALMLD_IDE_IRQ                PXA_GPIO_TO_IRQ(GPIO_NR_PALMLD_IDE_IRQ)
 
 
 /** HERE ARE INIT VALUES **/
index 6baf7469d4eced9c51151537161437c5e9706e93..0bd4f036c72fbb1deda29f4a2097785a9aee8a5c 100644 (file)
 #define GPIO_NR_PALMT5_BT_RESET                        83
 
 /* INTERRUPTS */
-#define IRQ_GPIO_PALMT5_SD_DETECT_N    IRQ_GPIO(GPIO_NR_PALMT5_SD_DETECT_N)
-#define IRQ_GPIO_PALMT5_WM9712_IRQ     IRQ_GPIO(GPIO_NR_PALMT5_WM9712_IRQ)
-#define IRQ_GPIO_PALMT5_USB_DETECT     IRQ_GPIO(GPIO_NR_PALMT5_USB_DETECT)
-#define IRQ_GPIO_PALMT5_GPIO_RESET     IRQ_GPIO(GPIO_NR_PALMT5_GPIO_RESET)
+#define IRQ_GPIO_PALMT5_SD_DETECT_N    PXA_GPIO_TO_IRQ(GPIO_NR_PALMT5_SD_DETECT_N)
+#define IRQ_GPIO_PALMT5_WM9712_IRQ     PXA_GPIO_TO_IRQ(GPIO_NR_PALMT5_WM9712_IRQ)
+#define IRQ_GPIO_PALMT5_USB_DETECT     PXA_GPIO_TO_IRQ(GPIO_NR_PALMT5_USB_DETECT)
+#define IRQ_GPIO_PALMT5_GPIO_RESET     PXA_GPIO_TO_IRQ(GPIO_NR_PALMT5_GPIO_RESET)
 
 /** HERE ARE INIT VALUES **/
 
index 3f9dd3fd4638e03a103b54f16a87d3da74fd2047..c383a21680b6992e711f8397e0dee98498cb0c94 100644 (file)
@@ -52,8 +52,8 @@
 #define GPIO_NR_PALMTC_IR_DISABLE      45
 
 /* IRQs */
-#define IRQ_GPIO_PALMTC_SD_DETECT_N    IRQ_GPIO(GPIO_NR_PALMTC_SD_DETECT_N)
-#define IRQ_GPIO_PALMTC_WLAN_READY     IRQ_GPIO(GPIO_NR_PALMTC_WLAN_READY)
+#define IRQ_GPIO_PALMTC_SD_DETECT_N    PXA_GPIO_TO_IRQ(GPIO_NR_PALMTC_SD_DETECT_N)
+#define IRQ_GPIO_PALMTC_WLAN_READY     PXA_GPIO_TO_IRQ(GPIO_NR_PALMTC_WLAN_READY)
 
 /* UCB1400 GPIOs */
 #define GPIO_NR_PALMTC_POWER_DETECT    (0x80 | 0x00)
index 7074a6ed46c6b20ec321b5b0106aae3392eb7b29..f2e5303802537d79bac10b397b7b1d17e23bdf3d 100644 (file)
 #define GPIO_NR_PALMTX_NAND_BUFFER_DIR         79
 
 /* INTERRUPTS */
-#define IRQ_GPIO_PALMTX_SD_DETECT_N    IRQ_GPIO(GPIO_NR_PALMTX_SD_DETECT_N)
-#define IRQ_GPIO_PALMTX_WM9712_IRQ     IRQ_GPIO(GPIO_NR_PALMTX_WM9712_IRQ)
-#define IRQ_GPIO_PALMTX_USB_DETECT     IRQ_GPIO(GPIO_NR_PALMTX_USB_DETECT)
-#define IRQ_GPIO_PALMTX_GPIO_RESET     IRQ_GPIO(GPIO_NR_PALMTX_GPIO_RESET)
+#define IRQ_GPIO_PALMTX_SD_DETECT_N    PXA_GPIO_TO_IRQ(GPIO_NR_PALMTX_SD_DETECT_N)
+#define IRQ_GPIO_PALMTX_WM9712_IRQ     PXA_GPIO_TO_IRQ(GPIO_NR_PALMTX_WM9712_IRQ)
+#define IRQ_GPIO_PALMTX_USB_DETECT     PXA_GPIO_TO_IRQ(GPIO_NR_PALMTX_USB_DETECT)
+#define IRQ_GPIO_PALMTX_GPIO_RESET     PXA_GPIO_TO_IRQ(GPIO_NR_PALMTX_GPIO_RESET)
 
 /** HERE ARE INIT VALUES **/
 
index 4bac588478a898ee6dae6107a9cd44fc7d365c69..6bf28de228bdeb8952f14458a5ebde1a93653530 100644 (file)
@@ -34,7 +34,7 @@
 
 /* I2C RTC */
 #define PCM027_RTC_IRQ_GPIO    0
-#define PCM027_RTC_IRQ         IRQ_GPIO(PCM027_RTC_IRQ_GPIO)
+#define PCM027_RTC_IRQ         PXA_GPIO_TO_IRQ(PCM027_RTC_IRQ_GPIO)
 #define PCM027_RTC_IRQ_EDGE    IRQ_TYPE_EDGE_FALLING
 #define ADR_PCM027_RTC         0x51    /* I2C address */
 
 
 /* Ethernet chip (SMSC91C111) */
 #define PCM027_ETH_IRQ_GPIO    52
-#define PCM027_ETH_IRQ         IRQ_GPIO(PCM027_ETH_IRQ_GPIO)
+#define PCM027_ETH_IRQ         PXA_GPIO_TO_IRQ(PCM027_ETH_IRQ_GPIO)
 #define PCM027_ETH_IRQ_EDGE    IRQ_TYPE_EDGE_RISING
 #define PCM027_ETH_PHYS                PXA_CS5_PHYS
 #define PCM027_ETH_SIZE                (1*1024*1024)
 
 /* CAN controller SJA1000 (unsupported yet) */
 #define PCM027_CAN_IRQ_GPIO    114
-#define PCM027_CAN_IRQ         IRQ_GPIO(PCM027_CAN_IRQ_GPIO)
+#define PCM027_CAN_IRQ         PXA_GPIO_TO_IRQ(PCM027_CAN_IRQ_GPIO)
 #define PCM027_CAN_IRQ_EDGE    IRQ_TYPE_EDGE_FALLING
 #define PCM027_CAN_PHYS                0x22000000
 #define PCM027_CAN_SIZE                0x100
 
 /* SPI GPIO expander (unsupported yet) */
 #define PCM027_EGPIO_IRQ_GPIO  27
-#define PCM027_EGPIO_IRQ       IRQ_GPIO(PCM027_EGPIO_IRQ_GPIO)
+#define PCM027_EGPIO_IRQ       PXA_GPIO_TO_IRQ(PCM027_EGPIO_IRQ_GPIO)
 #define PCM027_EGPIO_IRQ_EDGE  IRQ_TYPE_EDGE_FALLING
 #define PCM027_EGPIO_CS                24
 /*
index 8a4383b776d7fb7806f17ed6cfb163b681aea18f..d72791695b2611ba3e55aeeab43623641d7baacf 100644 (file)
 
 /* CPLD's interrupt controller is connected to PCM-027 GPIO 9 */
 #define PCM990_CTRL_INT_IRQ_GPIO       9
-#define PCM990_CTRL_INT_IRQ            IRQ_GPIO(PCM990_CTRL_INT_IRQ_GPIO)
+#define PCM990_CTRL_INT_IRQ            PXA_GPIO_TO_IRQ(PCM990_CTRL_INT_IRQ_GPIO)
 #define PCM990_CTRL_INT_IRQ_EDGE       IRQ_TYPE_EDGE_RISING
 #define PCM990_CTRL_PHYS               PXA_CS1_PHYS    /* 16-Bit */
 #define PCM990_CTRL_BASE               0xea000000
 #define PCM990_CTRL_SIZE               (1*1024*1024)
 
 #define PCM990_CTRL_PWR_IRQ_GPIO       14
-#define PCM990_CTRL_PWR_IRQ            IRQ_GPIO(PCM990_CTRL_PWR_IRQ_GPIO)
+#define PCM990_CTRL_PWR_IRQ            PXA_GPIO_TO_IRQ(PCM990_CTRL_PWR_IRQ_GPIO)
 #define PCM990_CTRL_PWR_IRQ_EDGE       IRQ_TYPE_EDGE_RISING
 
 /* visible CPLD (U7) registers */
  * IDE
  */
 #define PCM990_IDE_IRQ_GPIO    13
-#define PCM990_IDE_IRQ         IRQ_GPIO(PCM990_IDE_IRQ_GPIO)
+#define PCM990_IDE_IRQ         PXA_GPIO_TO_IRQ(PCM990_IDE_IRQ_GPIO)
 #define PCM990_IDE_IRQ_EDGE    IRQ_TYPE_EDGE_RISING
 #define PCM990_IDE_PLD_PHYS    0x20000000      /* 16 bit wide */
 #define PCM990_IDE_PLD_BASE    0xee000000
  * Compact Flash
  */
 #define PCM990_CF_IRQ_GPIO     11
-#define PCM990_CF_IRQ          IRQ_GPIO(PCM990_CF_IRQ_GPIO)
+#define PCM990_CF_IRQ          PXA_GPIO_TO_IRQ(PCM990_CF_IRQ_GPIO)
 #define PCM990_CF_IRQ_EDGE     IRQ_TYPE_EDGE_RISING
 
 #define PCM990_CF_CD_GPIO      12
-#define PCM990_CF_CD           IRQ_GPIO(PCM990_CF_CD_GPIO)
+#define PCM990_CF_CD           PXA_GPIO_TO_IRQ(PCM990_CF_CD_GPIO)
 #define PCM990_CF_CD_EDGE      IRQ_TYPE_EDGE_RISING
 
 #define PCM990_CF_PLD_PHYS     0x30000000      /* 16 bit wide */
  * Wolfson AC97 Touch
  */
 #define PCM990_AC97_IRQ_GPIO   10
-#define PCM990_AC97_IRQ                IRQ_GPIO(PCM990_AC97_IRQ_GPIO)
+#define PCM990_AC97_IRQ                PXA_GPIO_TO_IRQ(PCM990_AC97_IRQ_GPIO)
 #define PCM990_AC97_IRQ_EDGE   IRQ_TYPE_EDGE_RISING
 
 /*
  * MMC phyCORE
  */
 #define PCM990_MMC0_IRQ_GPIO   9
-#define PCM990_MMC0_IRQ                IRQ_GPIO(PCM990_MMC0_IRQ_GPIO)
+#define PCM990_MMC0_IRQ                PXA_GPIO_TO_IRQ(PCM990_MMC0_IRQ_GPIO)
 #define PCM990_MMC0_IRQ_EDGE   IRQ_TYPE_EDGE_FALLING
 
 /*
index 83d1cfd00fc9f7d05e75c4a0c94383c479407179..f32ff75dcca83abd42fb8dfc30ac7a8ebdbf9e59 100644 (file)
 #define POODLE_GPIO_DISCHARGE_ON        (42) /* Enable battery discharge */
 
 /* PXA GPIOs */
-#define POODLE_IRQ_GPIO_ON_KEY         IRQ_GPIO(0)
-#define POODLE_IRQ_GPIO_AC_IN          IRQ_GPIO(1)
-#define POODLE_IRQ_GPIO_HP_IN          IRQ_GPIO(4)
-#define POODLE_IRQ_GPIO_CO             IRQ_GPIO(16)
-#define POODLE_IRQ_GPIO_TP_INT         IRQ_GPIO(5)
-#define POODLE_IRQ_GPIO_WAKEUP         IRQ_GPIO(11)
-#define POODLE_IRQ_GPIO_GA_INT         IRQ_GPIO(10)
-#define POODLE_IRQ_GPIO_CF_IRQ         IRQ_GPIO(17)
-#define POODLE_IRQ_GPIO_CF_CD          IRQ_GPIO(14)
-#define POODLE_IRQ_GPIO_nSD_INT                IRQ_GPIO(8)
-#define POODLE_IRQ_GPIO_nSD_DETECT     IRQ_GPIO(9)
-#define POODLE_IRQ_GPIO_MAIN_BAT_LOW   IRQ_GPIO(13)
+#define POODLE_IRQ_GPIO_ON_KEY         PXA_GPIO_TO_IRQ(0)
+#define POODLE_IRQ_GPIO_AC_IN          PXA_GPIO_TO_IRQ(1)
+#define POODLE_IRQ_GPIO_HP_IN          PXA_GPIO_TO_IRQ(4)
+#define POODLE_IRQ_GPIO_CO             PXA_GPIO_TO_IRQ(16)
+#define POODLE_IRQ_GPIO_TP_INT         PXA_GPIO_TO_IRQ(5)
+#define POODLE_IRQ_GPIO_WAKEUP         PXA_GPIO_TO_IRQ(11)
+#define POODLE_IRQ_GPIO_GA_INT         PXA_GPIO_TO_IRQ(10)
+#define POODLE_IRQ_GPIO_CF_IRQ         PXA_GPIO_TO_IRQ(17)
+#define POODLE_IRQ_GPIO_CF_CD          PXA_GPIO_TO_IRQ(14)
+#define POODLE_IRQ_GPIO_nSD_INT                PXA_GPIO_TO_IRQ(8)
+#define POODLE_IRQ_GPIO_nSD_DETECT     PXA_GPIO_TO_IRQ(9)
+#define POODLE_IRQ_GPIO_MAIN_BAT_LOW   PXA_GPIO_TO_IRQ(13)
 
 /* SCOOP GPIOs */
 #define POODLE_SCOOP_CHARGE_ON SCOOP_GPCR_PA11
@@ -71,7 +71,7 @@
 #define POODLE_SCOOP_IO_DIR    ( POODLE_SCOOP_VPEN | POODLE_SCOOP_HS_OUT )
 #define POODLE_SCOOP_IO_OUT    ( 0 )
 
-#define POODLE_SCOOP_GPIO_BASE (NR_BUILTIN_GPIO)
+#define POODLE_SCOOP_GPIO_BASE (PXA_NR_BUILTIN_GPIO)
 #define POODLE_GPIO_CHARGE_ON  (POODLE_SCOOP_GPIO_BASE + 0)
 #define POODLE_GPIO_CP401      (POODLE_SCOOP_GPIO_BASE + 2)
 #define POODLE_GPIO_VPEN       (POODLE_SCOOP_GPIO_BASE + 7)
index 685749a51c4284159324bee89c7a5e96e7404da2..0bfe6507c95dd2c4e89e8c23384a179ba1b0030d 100644 (file)
 #define SPITZ_SCP_SUS_CLR     (SPITZ_SCP_MUTE_L | SPITZ_SCP_MUTE_R | SPITZ_SCP_JK_A | SPITZ_SCP_ADC_TEMP_ON)
 #define SPITZ_SCP_SUS_SET     0
 
-#define SPITZ_SCP_GPIO_BASE    (NR_BUILTIN_GPIO)
+#define SPITZ_SCP_GPIO_BASE    (PXA_NR_BUILTIN_GPIO)
 #define SPITZ_GPIO_LED_GREEN   (SPITZ_SCP_GPIO_BASE + 0)
 #define SPITZ_GPIO_JK_B                (SPITZ_SCP_GPIO_BASE + 1)
 #define SPITZ_GPIO_CHRG_ON     (SPITZ_SCP_GPIO_BASE + 2)
                              SPITZ_SCP2_BACKLIGHT_CONT | SPITZ_SCP2_BACKLIGHT_ON | SPITZ_SCP2_MIC_BIAS)
 #define SPITZ_SCP2_SUS_SET  (SPITZ_SCP2_IR_ON | SPITZ_SCP2_RESERVED_1)
 
-#define SPITZ_SCP2_GPIO_BASE           (NR_BUILTIN_GPIO + 12)
+#define SPITZ_SCP2_GPIO_BASE           (PXA_NR_BUILTIN_GPIO + 12)
 #define SPITZ_GPIO_IR_ON               (SPITZ_SCP2_GPIO_BASE + 0)
 #define SPITZ_GPIO_AKIN_PULLUP         (SPITZ_SCP2_GPIO_BASE + 1)
 #define SPITZ_GPIO_RESERVED_1          (SPITZ_SCP2_GPIO_BASE + 2)
 #define SPITZ_GPIO_MIC_BIAS            (SPITZ_SCP2_GPIO_BASE + 8)
 
 /* Akita IO Expander GPIOs */
-#define AKITA_IOEXP_GPIO_BASE          (NR_BUILTIN_GPIO + 12)
+#define AKITA_IOEXP_GPIO_BASE          (PXA_NR_BUILTIN_GPIO + 12)
 #define AKITA_GPIO_RESERVED_0          (AKITA_IOEXP_GPIO_BASE + 0)
 #define AKITA_GPIO_RESERVED_1          (AKITA_IOEXP_GPIO_BASE + 1)
 #define AKITA_GPIO_MIC_BIAS            (AKITA_IOEXP_GPIO_BASE + 2)
 
 /* Spitz IRQ Definitions */
 
-#define SPITZ_IRQ_GPIO_KEY_INT        IRQ_GPIO(SPITZ_GPIO_KEY_INT)
-#define SPITZ_IRQ_GPIO_AC_IN          IRQ_GPIO(SPITZ_GPIO_AC_IN)
-#define SPITZ_IRQ_GPIO_AK_INT         IRQ_GPIO(SPITZ_GPIO_AK_INT)
-#define SPITZ_IRQ_GPIO_HP_IN          IRQ_GPIO(SPITZ_GPIO_HP_IN)
-#define SPITZ_IRQ_GPIO_TP_INT         IRQ_GPIO(SPITZ_GPIO_TP_INT)
-#define SPITZ_IRQ_GPIO_SYNC           IRQ_GPIO(SPITZ_GPIO_SYNC)
-#define SPITZ_IRQ_GPIO_ON_KEY         IRQ_GPIO(SPITZ_GPIO_ON_KEY)
-#define SPITZ_IRQ_GPIO_SWA            IRQ_GPIO(SPITZ_GPIO_SWA)
-#define SPITZ_IRQ_GPIO_SWB            IRQ_GPIO(SPITZ_GPIO_SWB)
-#define SPITZ_IRQ_GPIO_BAT_COVER      IRQ_GPIO(SPITZ_GPIO_BAT_COVER)
-#define SPITZ_IRQ_GPIO_FATAL_BAT      IRQ_GPIO(SPITZ_GPIO_FATAL_BAT)
-#define SPITZ_IRQ_GPIO_CO             IRQ_GPIO(SPITZ_GPIO_CO)
-#define SPITZ_IRQ_GPIO_CF_IRQ         IRQ_GPIO(SPITZ_GPIO_CF_IRQ)
-#define SPITZ_IRQ_GPIO_CF_CD          IRQ_GPIO(SPITZ_GPIO_CF_CD)
-#define SPITZ_IRQ_GPIO_CF2_IRQ        IRQ_GPIO(SPITZ_GPIO_CF2_IRQ)
-#define SPITZ_IRQ_GPIO_nSD_INT        IRQ_GPIO(SPITZ_GPIO_nSD_INT)
-#define SPITZ_IRQ_GPIO_nSD_DETECT     IRQ_GPIO(SPITZ_GPIO_nSD_DETECT)
+#define SPITZ_IRQ_GPIO_KEY_INT        PXA_GPIO_TO_IRQ(SPITZ_GPIO_KEY_INT)
+#define SPITZ_IRQ_GPIO_AC_IN          PXA_GPIO_TO_IRQ(SPITZ_GPIO_AC_IN)
+#define SPITZ_IRQ_GPIO_AK_INT         PXA_GPIO_TO_IRQ(SPITZ_GPIO_AK_INT)
+#define SPITZ_IRQ_GPIO_HP_IN          PXA_GPIO_TO_IRQ(SPITZ_GPIO_HP_IN)
+#define SPITZ_IRQ_GPIO_TP_INT         PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT)
+#define SPITZ_IRQ_GPIO_SYNC           PXA_GPIO_TO_IRQ(SPITZ_GPIO_SYNC)
+#define SPITZ_IRQ_GPIO_ON_KEY         PXA_GPIO_TO_IRQ(SPITZ_GPIO_ON_KEY)
+#define SPITZ_IRQ_GPIO_SWA            PXA_GPIO_TO_IRQ(SPITZ_GPIO_SWA)
+#define SPITZ_IRQ_GPIO_SWB            PXA_GPIO_TO_IRQ(SPITZ_GPIO_SWB)
+#define SPITZ_IRQ_GPIO_BAT_COVER      PXA_GPIO_TO_IRQ(SPITZ_GPIO_BAT_COVER)
+#define SPITZ_IRQ_GPIO_FATAL_BAT      PXA_GPIO_TO_IRQ(SPITZ_GPIO_FATAL_BAT)
+#define SPITZ_IRQ_GPIO_CO             PXA_GPIO_TO_IRQ(SPITZ_GPIO_CO)
+#define SPITZ_IRQ_GPIO_CF_IRQ         PXA_GPIO_TO_IRQ(SPITZ_GPIO_CF_IRQ)
+#define SPITZ_IRQ_GPIO_CF_CD          PXA_GPIO_TO_IRQ(SPITZ_GPIO_CF_CD)
+#define SPITZ_IRQ_GPIO_CF2_IRQ        PXA_GPIO_TO_IRQ(SPITZ_GPIO_CF2_IRQ)
+#define SPITZ_IRQ_GPIO_nSD_INT        PXA_GPIO_TO_IRQ(SPITZ_GPIO_nSD_INT)
+#define SPITZ_IRQ_GPIO_nSD_DETECT     PXA_GPIO_TO_IRQ(SPITZ_GPIO_nSD_DETECT)
 
 /*
  * Shared data structures
index 1272c4b56ceb8de05875e75310df11b86b377982..2bb0e862598c41eeca0c20b36469b49f7cdc9692 100644 (file)
@@ -24,7 +24,7 @@
 /*
  * SCOOP2 internal GPIOs
  */
-#define TOSA_SCOOP_GPIO_BASE           NR_BUILTIN_GPIO
+#define TOSA_SCOOP_GPIO_BASE           PXA_NR_BUILTIN_GPIO
 #define TOSA_SCOOP_PXA_VCORE1          SCOOP_GPCR_PA11
 #define TOSA_GPIO_TC6393XB_REST_IN     (TOSA_SCOOP_GPIO_BASE + 1)
 #define TOSA_GPIO_IR_POWERDWN          (TOSA_SCOOP_GPIO_BASE + 2)
@@ -42,7 +42,7 @@
 /*
  * SCOOP2 jacket GPIOs
  */
-#define TOSA_SCOOP_JC_GPIO_BASE                (NR_BUILTIN_GPIO + 12)
+#define TOSA_SCOOP_JC_GPIO_BASE                (PXA_NR_BUILTIN_GPIO + 12)
 #define TOSA_GPIO_BT_LED               (TOSA_SCOOP_JC_GPIO_BASE + 0)
 #define TOSA_GPIO_NOTE_LED             (TOSA_SCOOP_JC_GPIO_BASE + 1)
 #define TOSA_GPIO_CHRG_ERR_LED         (TOSA_SCOOP_JC_GPIO_BASE + 2)
@@ -59,7 +59,7 @@
 /*
  * TC6393XB GPIOs
  */
-#define TOSA_TC6393XB_GPIO_BASE                (NR_BUILTIN_GPIO + 2 * 12)
+#define TOSA_TC6393XB_GPIO_BASE                (PXA_NR_BUILTIN_GPIO + 2 * 12)
 
 #define TOSA_GPIO_TG_ON                        (TOSA_TC6393XB_GPIO_BASE + 0)
 #define TOSA_GPIO_L_MUTE               (TOSA_TC6393XB_GPIO_BASE + 1)
 /*
  * Interrupts
  */
-#define TOSA_IRQ_GPIO_WAKEUP           IRQ_GPIO(TOSA_GPIO_WAKEUP)
-#define TOSA_IRQ_GPIO_AC_IN            IRQ_GPIO(TOSA_GPIO_AC_IN)
-#define TOSA_IRQ_GPIO_RECORD_BTN       IRQ_GPIO(TOSA_GPIO_RECORD_BTN)
-#define TOSA_IRQ_GPIO_SYNC             IRQ_GPIO(TOSA_GPIO_SYNC)
-#define TOSA_IRQ_GPIO_USB_IN           IRQ_GPIO(TOSA_GPIO_USB_IN)
-#define TOSA_IRQ_GPIO_JACKET_DETECT    IRQ_GPIO(TOSA_GPIO_JACKET_DETECT)
-#define TOSA_IRQ_GPIO_nSD_INT          IRQ_GPIO(TOSA_GPIO_nSD_INT)
-#define TOSA_IRQ_GPIO_nSD_DETECT       IRQ_GPIO(TOSA_GPIO_nSD_DETECT)
-#define TOSA_IRQ_GPIO_BAT1_CRG         IRQ_GPIO(TOSA_GPIO_BAT1_CRG)
-#define TOSA_IRQ_GPIO_CF_CD            IRQ_GPIO(TOSA_GPIO_CF_CD)
-#define TOSA_IRQ_GPIO_BAT0_CRG         IRQ_GPIO(TOSA_GPIO_BAT0_CRG)
-#define TOSA_IRQ_GPIO_TC6393XB_INT     IRQ_GPIO(TOSA_GPIO_TC6393XB_INT)
-#define TOSA_IRQ_GPIO_BAT0_LOW         IRQ_GPIO(TOSA_GPIO_BAT0_LOW)
-#define TOSA_IRQ_GPIO_EAR_IN           IRQ_GPIO(TOSA_GPIO_EAR_IN)
-#define TOSA_IRQ_GPIO_CF_IRQ           IRQ_GPIO(TOSA_GPIO_CF_IRQ)
-#define TOSA_IRQ_GPIO_ON_KEY           IRQ_GPIO(TOSA_GPIO_ON_KEY)
-#define TOSA_IRQ_GPIO_VGA_LINE         IRQ_GPIO(TOSA_GPIO_VGA_LINE)
-#define TOSA_IRQ_GPIO_TP_INT           IRQ_GPIO(TOSA_GPIO_TP_INT)
-#define TOSA_IRQ_GPIO_JC_CF_IRQ        IRQ_GPIO(TOSA_GPIO_JC_CF_IRQ)
-#define TOSA_IRQ_GPIO_BAT_LOCKED       IRQ_GPIO(TOSA_GPIO_BAT_LOCKED)
-#define TOSA_IRQ_GPIO_BAT1_LOW         IRQ_GPIO(TOSA_GPIO_BAT1_LOW)
-#define TOSA_IRQ_GPIO_KEY_SENSE(a)     IRQ_GPIO(69+(a))
-
-#define TOSA_IRQ_GPIO_MAIN_BAT_LOW     IRQ_GPIO(TOSA_GPIO_MAIN_BAT_LOW)
+#define TOSA_IRQ_GPIO_WAKEUP           PXA_GPIO_TO_IRQ(TOSA_GPIO_WAKEUP)
+#define TOSA_IRQ_GPIO_AC_IN            PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN)
+#define TOSA_IRQ_GPIO_RECORD_BTN       PXA_GPIO_TO_IRQ(TOSA_GPIO_RECORD_BTN)
+#define TOSA_IRQ_GPIO_SYNC             PXA_GPIO_TO_IRQ(TOSA_GPIO_SYNC)
+#define TOSA_IRQ_GPIO_USB_IN           PXA_GPIO_TO_IRQ(TOSA_GPIO_USB_IN)
+#define TOSA_IRQ_GPIO_JACKET_DETECT    PXA_GPIO_TO_IRQ(TOSA_GPIO_JACKET_DETECT)
+#define TOSA_IRQ_GPIO_nSD_INT          PXA_GPIO_TO_IRQ(TOSA_GPIO_nSD_INT)
+#define TOSA_IRQ_GPIO_nSD_DETECT       PXA_GPIO_TO_IRQ(TOSA_GPIO_nSD_DETECT)
+#define TOSA_IRQ_GPIO_BAT1_CRG         PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT1_CRG)
+#define TOSA_IRQ_GPIO_CF_CD            PXA_GPIO_TO_IRQ(TOSA_GPIO_CF_CD)
+#define TOSA_IRQ_GPIO_BAT0_CRG         PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT0_CRG)
+#define TOSA_IRQ_GPIO_TC6393XB_INT     PXA_GPIO_TO_IRQ(TOSA_GPIO_TC6393XB_INT)
+#define TOSA_IRQ_GPIO_BAT0_LOW         PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT0_LOW)
+#define TOSA_IRQ_GPIO_EAR_IN           PXA_GPIO_TO_IRQ(TOSA_GPIO_EAR_IN)
+#define TOSA_IRQ_GPIO_CF_IRQ           PXA_GPIO_TO_IRQ(TOSA_GPIO_CF_IRQ)
+#define TOSA_IRQ_GPIO_ON_KEY           PXA_GPIO_TO_IRQ(TOSA_GPIO_ON_KEY)
+#define TOSA_IRQ_GPIO_VGA_LINE         PXA_GPIO_TO_IRQ(TOSA_GPIO_VGA_LINE)
+#define TOSA_IRQ_GPIO_TP_INT           PXA_GPIO_TO_IRQ(TOSA_GPIO_TP_INT)
+#define TOSA_IRQ_GPIO_JC_CF_IRQ        PXA_GPIO_TO_IRQ(TOSA_GPIO_JC_CF_IRQ)
+#define TOSA_IRQ_GPIO_BAT_LOCKED       PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT_LOCKED)
+#define TOSA_IRQ_GPIO_BAT1_LOW         PXA_GPIO_TO_IRQ(TOSA_GPIO_BAT1_LOW)
+#define TOSA_IRQ_GPIO_KEY_SENSE(a)     PXA_GPIO_TO_IRQ(69+(a))
+
+#define TOSA_IRQ_GPIO_MAIN_BAT_LOW     PXA_GPIO_TO_IRQ(TOSA_GPIO_MAIN_BAT_LOW)
 
 #define TOSA_KEY_SYNC          KEY_102ND /* ??? */
 
index 903e1a2e6641409d8d9ffca8f03387cabf0474ea..d2ca01053f697d888bb3d529e5f8a998efcbb27b 100644 (file)
 
 /* Ethernet Controller Davicom DM9000 */
 #define GPIO_DM9000            101
-#define TRIZEPS4_ETH_IRQ       IRQ_GPIO(GPIO_DM9000)
+#define TRIZEPS4_ETH_IRQ       PXA_GPIO_TO_IRQ(GPIO_DM9000)
 
 /* UCB1400 audio / TS-controller */
 #define GPIO_UCB1400           1
-#define TRIZEPS4_UCB1400_IRQ   IRQ_GPIO(GPIO_UCB1400)
+#define TRIZEPS4_UCB1400_IRQ   PXA_GPIO_TO_IRQ(GPIO_UCB1400)
 
 /* PCMCIA socket Compact Flash */
 #define GPIO_PCD               11              /* PCMCIA Card Detect */
-#define TRIZEPS4_CD_IRQ                IRQ_GPIO(GPIO_PCD)
+#define TRIZEPS4_CD_IRQ                PXA_GPIO_TO_IRQ(GPIO_PCD)
 #define GPIO_PRDY              13              /* READY / nINT */
-#define TRIZEPS4_READY_NINT    IRQ_GPIO(GPIO_PRDY)
+#define TRIZEPS4_READY_NINT    PXA_GPIO_TO_IRQ(GPIO_PRDY)
 
 /* MMC socket */
 #define GPIO_MMC_DET           12
-#define TRIZEPS4_MMC_IRQ       IRQ_GPIO(GPIO_MMC_DET)
+#define TRIZEPS4_MMC_IRQ       PXA_GPIO_TO_IRQ(GPIO_MMC_DET)
 
 /* DOC NAND chip */
 #define GPIO_DOC_LOCK           94
 #define GPIO_DOC_IRQ            93
-#define TRIZEPS4_DOC_IRQ        IRQ_GPIO(GPIO_DOC_IRQ)
+#define TRIZEPS4_DOC_IRQ        PXA_GPIO_TO_IRQ(GPIO_DOC_IRQ)
 
 /* SPI interface */
 #define GPIO_SPI                53
-#define TRIZEPS4_SPI_IRQ        IRQ_GPIO(GPIO_SPI)
+#define TRIZEPS4_SPI_IRQ        PXA_GPIO_TO_IRQ(GPIO_SPI)
 
 /* LEDS using tx2 / rx2 */
 #define GPIO_SYS_BUSY_LED      46
@@ -74,7 +74,7 @@
 
 /* Off-module PIC on ConXS board */
 #define GPIO_PIC               0
-#define TRIZEPS4_PIC_IRQ       IRQ_GPIO(GPIO_PIC)
+#define TRIZEPS4_PIC_IRQ       PXA_GPIO_TO_IRQ(GPIO_PIC)
 
 #ifdef CONFIG_MACH_TRIZEPS_CONXS
 /* for CONXS base board define these registers */
index 532c5d3a97d24e861ff61305280c41f8de1bbac0..5dae15ea67184a5c1b60db8c5c3fd2e62f168961 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
-#include <mach/gpio-pxa.h>
 
 #include "generic.h"
 
@@ -92,44 +91,6 @@ static struct irq_chip pxa_internal_irq_chip = {
        .irq_unmask     = pxa_unmask_irq,
 };
 
-/*
- * GPIO IRQs for GPIO 0 and 1
- */
-static int pxa_set_low_gpio_type(struct irq_data *d, unsigned int type)
-{
-       int gpio = d->irq - IRQ_GPIO0;
-
-       if (__gpio_is_occupied(gpio)) {
-               pr_err("%s failed: GPIO is configured\n", __func__);
-               return -EINVAL;
-       }
-
-       if (type & IRQ_TYPE_EDGE_RISING)
-               GRER0 |= GPIO_bit(gpio);
-       else
-               GRER0 &= ~GPIO_bit(gpio);
-
-       if (type & IRQ_TYPE_EDGE_FALLING)
-               GFER0 |= GPIO_bit(gpio);
-       else
-               GFER0 &= ~GPIO_bit(gpio);
-
-       return 0;
-}
-
-static void pxa_ack_low_gpio(struct irq_data *d)
-{
-       GEDR0 = (1 << (d->irq - IRQ_GPIO0));
-}
-
-static struct irq_chip pxa_low_gpio_chip = {
-       .name           = "GPIO-l",
-       .irq_ack        = pxa_ack_low_gpio,
-       .irq_mask       = pxa_mask_irq,
-       .irq_unmask     = pxa_unmask_irq,
-       .irq_set_type   = pxa_set_low_gpio_type,
-};
-
 asmlinkage void __exception_irq_entry icip_handle_irq(struct pt_regs *regs)
 {
        uint32_t icip, icmr, mask;
@@ -160,26 +121,7 @@ asmlinkage void __exception_irq_entry ichp_handle_irq(struct pt_regs *regs)
        } while (1);
 }
 
-static void __init pxa_init_low_gpio_irq(set_wake_t fn)
-{
-       int irq;
-
-       /* clear edge detection on GPIO 0 and 1 */
-       GFER0 &= ~0x3;
-       GRER0 &= ~0x3;
-       GEDR0 = 0x3;
-
-       for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) {
-               irq_set_chip_and_handler(irq, &pxa_low_gpio_chip,
-                                        handle_edge_irq);
-               irq_set_chip_data(irq, irq_base(0));
-               set_irq_flags(irq, IRQF_VALID);
-       }
-
-       pxa_low_gpio_chip.irq_set_wake = fn;
-}
-
-void __init pxa_init_irq(int irq_nr, set_wake_t fn)
+void __init pxa_init_irq(int irq_nr, int (*fn)(struct irq_data *, unsigned int))
 {
        int irq, i, n;
 
@@ -209,7 +151,6 @@ void __init pxa_init_irq(int irq_nr, set_wake_t fn)
        __raw_writel(1, irq_base(0) + ICCR);
 
        pxa_internal_irq_chip.irq_set_wake = fn;
-       pxa_init_low_gpio_irq(fn);
 }
 
 #ifdef CONFIG_PM
index 7b324ec6449f49553654d45b4aba900da01f23ed..d21e28b46d81032c2d4dd733f09418c89f2c1267 100644 (file)
@@ -124,8 +124,8 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
-               .end    = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
+               .start  = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
+               .end    = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
        }
 };
@@ -396,7 +396,7 @@ static struct i2c_board_info littleton_i2c_info[] = {
                .type           = "da9034",
                .addr           = 0x34,
                .platform_data  = &littleton_da9034_info,
-               .irq            = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)),
+               .irq            = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO18)),
        },
        [1] = {
                .type           = "max7320",
index 1dd530279e0b977f2726addff891d540c1fdbc46..565dd2f2eaa2b0de32f91cee90d3cb970d98b93a 100644 (file)
@@ -152,8 +152,8 @@ static void __init lpd270_init_irq(void)
                                         handle_level_irq);
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }
-       irq_set_chained_handler(IRQ_GPIO(0), lpd270_irq_handler);
-       irq_set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING);
+       irq_set_chained_handler(PXA_GPIO_TO_IRQ(0), lpd270_irq_handler);
+       irq_set_irq_type(PXA_GPIO_TO_IRQ(0), IRQ_TYPE_EDGE_FALLING);
 }
 
 
index c48ce6da9184f6d338e15ef729f8f043d66b8e77..2fb2b50831d11153a943d61ec46bdb4cdc198fb9 100644 (file)
@@ -170,8 +170,8 @@ static void __init lubbock_init_irq(void)
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }
 
-       irq_set_chained_handler(IRQ_GPIO(0), lubbock_irq_handler);
-       irq_set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING);
+       irq_set_chained_handler(PXA_GPIO_TO_IRQ(0), lubbock_irq_handler);
+       irq_set_irq_type(PXA_GPIO_TO_IRQ(0), IRQ_TYPE_EDGE_FALLING);
 }
 
 #ifdef CONFIG_PM
index 4b796c37af3ec5ab6ef15edebb1c8092b6f2ab50..e340ea08424874a61aebd6e252916bbf00b99c78 100644 (file)
@@ -184,8 +184,8 @@ static struct resource egpio_resources[] = {
                .flags = IORESOURCE_MEM,
        },
        [1] = {
-               .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ),
-               .end   = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ),
+               .start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
+               .end   = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
                .flags = IORESOURCE_IRQ,
        },
 };
@@ -468,8 +468,8 @@ static struct resource pasic3_resources[] = {
        },
        /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */
        [1] = {
-               .start  = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ),
-               .end    = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ),
+               .start  = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
+               .end    = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        }
 };
index 0567d3965fda4dffb422125a7cf4351272f2daa8..ea62a990ae4b12b17b6c2a53b20ae15ec59b30b2 100644 (file)
@@ -178,8 +178,8 @@ static void __init mainstone_init_irq(void)
        MST_INTMSKENA = 0;
        MST_INTSETCLR = 0;
 
-       irq_set_chained_handler(IRQ_GPIO(0), mainstone_irq_handler);
-       irq_set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING);
+       irq_set_chained_handler(PXA_GPIO_TO_IRQ(0), mainstone_irq_handler);
+       irq_set_irq_type(PXA_GPIO_TO_IRQ(0), IRQ_TYPE_EDGE_FALLING);
 }
 
 #ifdef CONFIG_PM
index 43a5f6861ca3f8209c79bd311cac9e0d87781e11..f14775536b8385172e929791a627c3a689fb94ac 100644 (file)
@@ -13,6 +13,7 @@
  *  published by the Free Software Foundation.
  */
 #include <linux/gpio.h>
+#include <linux/gpio-pxa.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -20,7 +21,6 @@
 
 #include <mach/pxa2xx-regs.h>
 #include <mach/mfp-pxa2xx.h>
-#include <mach/gpio-pxa.h>
 
 #include "generic.h"
 
 #define GAFR_L(x)      __GAFR(0, x)
 #define GAFR_U(x)      __GAFR(1, x)
 
+#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
+#define GPLR(x)                __REG2(0x40E00000, BANK_OFF((x) >> 5))
+#define GPDR(x)                __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x0c)
+
 #define PWER_WE35      (1 << 24)
 
 struct gpio_desc {
index b938fc2c316a7d7145423e96396d84ebae27afc6..23f90c74c1912a001afd95fe2fd8c124ecb85575 100644 (file)
@@ -541,15 +541,15 @@ static struct pda_power_pdata power_pdata = {
 static struct resource power_resources[] = {
        [0] = {
                .name   = "ac",
-               .start  = gpio_to_irq(GPIO96_AC_DETECT),
-               .end    = gpio_to_irq(GPIO96_AC_DETECT),
+               .start  = PXA_GPIO_TO_IRQ(GPIO96_AC_DETECT),
+               .end    = PXA_GPIO_TO_IRQ(GPIO96_AC_DETECT),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
                IORESOURCE_IRQ_LOWEDGE,
        },
        [1] = {
                .name   = "usb",
-               .start  = gpio_to_irq(GPIO13_nUSB_DETECT),
-               .end    = gpio_to_irq(GPIO13_nUSB_DETECT),
+               .start  = PXA_GPIO_TO_IRQ(GPIO13_nUSB_DETECT),
+               .end    = PXA_GPIO_TO_IRQ(GPIO13_nUSB_DETECT),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
                IORESOURCE_IRQ_LOWEDGE,
        },
index 90928d6e1a5bc05f3579c2901a2036eb34872aa3..83570a79e7d24f02e8f9bd0db1bc6247bf8cbeee 100644 (file)
@@ -417,8 +417,8 @@ static struct resource dm9k_resources[] = {
               .flags = IORESOURCE_MEM
        },
        [2] = {
-              .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)),
-              .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)),
+              .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
+              .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
               .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
        }
 };
index 6d38c6548b3d4ba0c6dcc0471819fca0ab7b9ee5..abab4e2b122c088195f9fcbdc8708976c68da90a 100644 (file)
@@ -378,7 +378,7 @@ struct pxacamera_platform_data pcm990_pxacamera_platform_data = {
 #include <linux/i2c/pca953x.h>
 
 static struct pca953x_platform_data pca9536_data = {
-       .gpio_base      = NR_BUILTIN_GPIO,
+       .gpio_base      = PXA_NR_BUILTIN_GPIO,
 };
 
 static int gpio_bus_switch = -EINVAL;
@@ -406,9 +406,9 @@ static unsigned long pcm990_camera_query_bus_param(struct soc_camera_link *link)
        int ret;
 
        if (gpio_bus_switch < 0) {
-               ret = gpio_request(NR_BUILTIN_GPIO, "camera");
+               ret = gpio_request(PXA_NR_BUILTIN_GPIO, "camera");
                if (!ret) {
-                       gpio_bus_switch = NR_BUILTIN_GPIO;
+                       gpio_bus_switch = PXA_NR_BUILTIN_GPIO;
                        gpio_direction_output(gpio_bus_switch, 0);
                }
        }
index 50c8331778668c66c97b4ff99b2b345e01efb999..8ee4b6cfa385ad9f7ca3fb7869f531d8b3efdd9b 100644 (file)
@@ -166,8 +166,8 @@ static struct resource locomo_resources[] = {
                .flags          = IORESOURCE_MEM,
        },
        [1] = {
-               .start          = IRQ_GPIO(10),
-               .end            = IRQ_GPIO(10),
+               .start          = PXA_GPIO_TO_IRQ(10),
+               .end            = PXA_GPIO_TO_IRQ(10),
                .flags          = IORESOURCE_IRQ,
        },
 };
@@ -212,7 +212,7 @@ static struct spi_board_info poodle_spi_devices[] = {
                .bus_num        = 1,
                .platform_data  = &poodle_ads7846_info,
                .controller_data= &poodle_ads7846_chip,
-               .irq            = gpio_to_irq(POODLE_GPIO_TP_INT),
+               .irq            = PXA_GPIO_TO_IRQ(POODLE_GPIO_TP_INT),
        },
 };
 
index f05f9486b0cbfadb8f41f3ac269fc7e1e329604b..8a775f631c551b47015900d2650329797558156f 100644 (file)
@@ -17,6 +17,7 @@
  * need be.
  */
 #include <linux/gpio.h>
+#include <linux/gpio-pxa.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -208,6 +209,7 @@ static struct clk_lookup pxa25x_clkregs[] = {
        INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"),
        INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
        INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL),
+       INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL),
 };
 
 static struct clk_lookup pxa25x_hwuart_clkreg =
@@ -287,7 +289,7 @@ static inline void pxa25x_init_pm(void) {}
 
 static int pxa25x_set_wake(struct irq_data *d, unsigned int on)
 {
-       int gpio = irq_to_gpio(d->irq);
+       int gpio = pxa_irq_to_gpio(d->irq);
        uint32_t mask = 0;
 
        if (gpio >= 0 && gpio < 85)
@@ -312,14 +314,12 @@ set_pwer:
 void __init pxa25x_init_irq(void)
 {
        pxa_init_irq(32, pxa25x_set_wake);
-       pxa_init_gpio(IRQ_GPIO_2_x, 2, 84, pxa25x_set_wake);
 }
 
 #ifdef CONFIG_CPU_PXA26x
 void __init pxa26x_init_irq(void)
 {
        pxa_init_irq(32, pxa25x_set_wake);
-       pxa_init_gpio(IRQ_GPIO_2_x, 2, 89, pxa25x_set_wake);
 }
 #endif
 
index bc5a98ebaa72872033ab49c7e535f4d5bc1317f7..6c49e66057e327539d14c543c108073318195d06 100644 (file)
@@ -12,6 +12,7 @@
  * published by the Free Software Foundation.
  */
 #include <linux/gpio.h>
+#include <linux/gpio-pxa.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -229,6 +230,7 @@ static struct clk_lookup pxa27x_clkregs[] = {
        INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"),
        INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"),
        INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL),
+       INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL),
 };
 
 #ifdef CONFIG_PM
@@ -355,7 +357,7 @@ static inline void pxa27x_init_pm(void) {}
  */
 static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
 {
-       int gpio = irq_to_gpio(d->irq);
+       int gpio = pxa_irq_to_gpio(d->irq);
        uint32_t mask;
 
        if (gpio >= 0 && gpio < 128)
@@ -386,7 +388,6 @@ static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
 void __init pxa27x_init_irq(void)
 {
        pxa_init_irq(34, pxa27x_set_wake);
-       pxa_init_gpio(IRQ_GPIO_2_x, 2, 120, pxa27x_set_wake);
 }
 
 static struct map_desc pxa27x_io_desc[] __initdata = {
@@ -422,6 +423,7 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
 }
 
 static struct platform_device *devices[] __initdata = {
+       &pxa_device_gpio,
        &pxa27x_device_udc,
        &pxa_device_pmu,
        &pxa_device_i2s,
index 0737c59b88ae4b571cef1e907f841c2dc9d1184b..4f402afa6609c0ed584100d951347ec1272f8531 100644 (file)
@@ -25,7 +25,6 @@
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
 #include <mach/hardware.h>
-#include <mach/gpio-pxa.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/reset.h>
 #include <mach/ohci.h>
@@ -56,6 +55,7 @@ static DEFINE_PXA3_CKEN(pxa3xx_pwm0, PWM0, 13000000, 0);
 static DEFINE_PXA3_CKEN(pxa3xx_pwm1, PWM1, 13000000, 0);
 static DEFINE_PXA3_CKEN(pxa3xx_mmc1, MMC1, 19500000, 0);
 static DEFINE_PXA3_CKEN(pxa3xx_mmc2, MMC2, 19500000, 0);
+static DEFINE_PXA3_CKEN(pxa3xx_gpio, GPIO, 13000000, 0);
 
 static DEFINE_CK(pxa3xx_lcd, LCD, &clk_pxa3xx_hsio_ops);
 static DEFINE_CK(pxa3xx_smemc, SMC, &clk_pxa3xx_smemc_ops);
@@ -88,6 +88,7 @@ static struct clk_lookup pxa3xx_clkregs[] = {
        INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
        INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL),
        INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL),
+       INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL),
 };
 
 #ifdef CONFIG_PM
@@ -365,7 +366,8 @@ static struct irq_chip pxa_ext_wakeup_chip = {
        .irq_set_type   = pxa_set_ext_wakeup_type,
 };
 
-static void __init pxa_init_ext_wakeup_irq(set_wake_t fn)
+static void __init pxa_init_ext_wakeup_irq(int (*fn)(struct irq_data *,
+                                          unsigned int))
 {
        int irq;
 
@@ -388,7 +390,6 @@ void __init pxa3xx_init_irq(void)
 
        pxa_init_irq(56, pxa3xx_set_wake);
        pxa_init_ext_wakeup_irq(pxa3xx_set_wake);
-       pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
 }
 
 static struct map_desc pxa3xx_io_desc[] __initdata = {
@@ -417,6 +418,7 @@ void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info)
 }
 
 static struct platform_device *devices[] __initdata = {
+       &pxa_device_gpio,
        &pxa27x_device_udc,
        &pxa_device_pmu,
        &pxa_device_i2s,
index 51371b39d2a315b8880a2d2d03ca5a061a00baa8..d082a583df78a14c0bc4074db270bb8ce2393ca1 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/syscore_ops.h>
 
 #include <mach/hardware.h>
-#include <mach/gpio-pxa.h>
 #include <mach/pxa3xx-regs.h>
 #include <mach/pxa930.h>
 #include <mach/reset.h>
@@ -212,6 +211,7 @@ static DEFINE_PXA3_CKEN(pxa95x_ssp3, SSP3, 13000000, 0);
 static DEFINE_PXA3_CKEN(pxa95x_ssp4, SSP4, 13000000, 0);
 static DEFINE_PXA3_CKEN(pxa95x_pwm0, PWM0, 13000000, 0);
 static DEFINE_PXA3_CKEN(pxa95x_pwm1, PWM1, 13000000, 0);
+static DEFINE_PXA3_CKEN(pxa95x_gpio, GPIO, 13000000, 0);
 
 static struct clk_lookup pxa95x_clkregs[] = {
        INIT_CLKREG(&clk_pxa95x_pout, NULL, "CLK_POUT"),
@@ -230,12 +230,12 @@ static struct clk_lookup pxa95x_clkregs[] = {
        INIT_CLKREG(&clk_pxa95x_ssp4, "pxa27x-ssp.3", NULL),
        INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL),
        INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL),
+       INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL),
 };
 
 void __init pxa95x_init_irq(void)
 {
        pxa_init_irq(96, NULL);
-       pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
 }
 
 /*
@@ -248,6 +248,7 @@ void __init pxa95x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
 }
 
 static struct platform_device *devices[] __initdata = {
+       &pxa_device_gpio,
        &sa1100_device_rtc,
        &pxa_device_rtc,
        &pxa27x_device_ssp1,
index f0c05f4d12ed5eb48715d8433665b20199bde3bd..78d643783f990aa7560170502f35e4ad857dc91c 100644 (file)
@@ -292,8 +292,8 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        {
-               .start  = gpio_to_irq(GPIO_ETH_IRQ),
-               .end    = gpio_to_irq(GPIO_ETH_IRQ),
+               .start  = PXA_GPIO_TO_IRQ(GPIO_ETH_IRQ),
+               .end    = PXA_GPIO_TO_IRQ(GPIO_ETH_IRQ),
                .flags  = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
        }
 };
@@ -672,7 +672,7 @@ static struct lis3lv02d_platform_data lis3_pdata = {
        .chip_select    = 1,                    \
        .controller_data = (void *) GPIO_ACCEL_CS,      \
        .platform_data  = &lis3_pdata,          \
-       .irq            = gpio_to_irq(GPIO_ACCEL_IRQ),  \
+       .irq            = PXA_GPIO_TO_IRQ(GPIO_ACCEL_IRQ),      \
 }
 
 #define SPI_DAC7512    \
@@ -956,7 +956,7 @@ static struct eeti_ts_platform_data eeti_ts_pdata = {
 static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = {
        .type   = "eeti_ts",
        .addr   = 0x0a,
-       .irq    = gpio_to_irq(GPIO_TOUCH_IRQ),
+       .irq    = PXA_GPIO_TO_IRQ(GPIO_TOUCH_IRQ),
        .platform_data = &eeti_ts_pdata,
 };
 
index fc2c1e05af9c2f59b1138dd011ef43069806d24a..423ec899a8a8d4308b278b93a6bceba963f76ac4 100644 (file)
@@ -96,8 +96,8 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
-               .end    = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
+               .start  = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO97)),
+               .end    = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO97)),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        }
 };
@@ -502,7 +502,7 @@ static struct i2c_board_info saar_i2c_info[] = {
                .type           = "da9034",
                .addr           = 0x34,
                .platform_data  = &saar_da9034_info,
-               .irq            = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
+               .irq            = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
        },
 };
 
index 3e999e308a2da66c86cee2eacbf4ee3f2eb82094..d1cdd6a081ed0ab347e03501a5932c1b832543a7 100644 (file)
@@ -92,7 +92,7 @@ static struct i2c_board_info saarb_i2c_info[] = {
                .type           = "88PM860x",
                .addr           = 0x34,
                .platform_data  = &saarb_pm8607_info,
-               .irq            = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
+               .irq            = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
        },
 };
 
index 785880f67b60f9fac6f79f10c65c4ff13a137049..8d5168d253a9c8829b54c2b09ea6b4e57b8c5fe5 100644 (file)
@@ -907,24 +907,24 @@ static int __devinit sharpsl_pm_probe(struct platform_device *pdev)
        gpio_direction_input(sharpsl_pm.machinfo->gpio_batlock);
 
        /* Register interrupt handlers */
-       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)) {
-               dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin));
+       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)) {
+               dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_acin));
        }
 
-       if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) {
-               dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock));
+       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)) {
+               dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batlock));
        }
 
        if (sharpsl_pm.machinfo->gpio_fatal) {
-               if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) {
-                       dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal));
+               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)) {
+                       dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_fatal));
                }
        }
 
        if (sharpsl_pm.machinfo->batfull_irq) {
                /* Register interrupt handler. */
-               if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) {
-                       dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull));
+               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)) {
+                       dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batfull));
                }
        }
 
@@ -953,14 +953,14 @@ static int sharpsl_pm_remove(struct platform_device *pdev)
 
        led_trigger_unregister_simple(sharpsl_charge_led_trigger);
 
-       free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr);
-       free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr);
+       free_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr);
+       free_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr);
 
        if (sharpsl_pm.machinfo->gpio_fatal)
-               free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr);
+               free_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr);
 
        if (sharpsl_pm.machinfo->batfull_irq)
-               free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr);
+               free_irq(PXA_GPIO_TO_IRQ(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr);
 
        gpio_free(sharpsl_pm.machinfo->gpio_batlock);
        gpio_free(sharpsl_pm.machinfo->gpio_batfull);
index 953a9195f9e5bdd9850f62c2632c8f62c27fc9b2..1b39cec03ccea7a1e48d4b09a9d04acecda24217 100644 (file)
@@ -552,7 +552,7 @@ static struct spi_board_info spitz_spi_devices[] = {
                .chip_select            = 0,
                .platform_data          = &spitz_ads7846_info,
                .controller_data        = &spitz_ads7846_chip,
-               .irq                    = gpio_to_irq(SPITZ_GPIO_TP_INT),
+               .irq                    = PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT),
        }, {
                .modalias               = "corgi-lcd",
                .max_speed_hz           = 50000,
index 094279aefe9c6fd5d6a86dd88fbbc44b6d55c07b..34cbdac51525524517bbedd355df413e9b9c89a1 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/gpio.h>
+#include <linux/gpio-pxa.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/apm-emulation.h>
@@ -41,6 +42,7 @@ static int spitz_last_ac_status;
 static struct gpio spitz_charger_gpios[] = {
        { SPITZ_GPIO_KEY_INT,   GPIOF_IN, "Keyboard Interrupt" },
        { SPITZ_GPIO_SYNC,      GPIOF_IN, "Sync" },
+       { SPITZ_GPIO_AC_IN,     GPIOF_IN, "Charger Detection" },
        { SPITZ_GPIO_ADC_TEMP_ON, GPIOF_OUT_INIT_LOW, "ADC Temp On" },
        { SPITZ_GPIO_JK_B,        GPIOF_OUT_INIT_LOW, "JK B" },
        { SPITZ_GPIO_CHRG_ON,     GPIOF_OUT_INIT_LOW, "Charger On" },
@@ -169,14 +171,19 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)
 
 static unsigned long spitz_charger_wakeup(void)
 {
-       return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC));
+       unsigned long ret;
+       ret = (!gpio_get_value(SPITZ_GPIO_KEY_INT)
+               << GPIO_bit(SPITZ_GPIO_KEY_INT))
+               | (!gpio_get_value(SPITZ_GPIO_SYNC)
+               << GPIO_bit(SPITZ_GPIO_SYNC));
+       return ret;
 }
 
 unsigned long spitzpm_read_devdata(int type)
 {
        switch (type) {
        case SHARPSL_STATUS_ACIN:
-               return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0);
+               return !gpio_get_value(SPITZ_GPIO_AC_IN);
        case SHARPSL_STATUS_LOCK:
                return gpio_get_value(sharpsl_pm.machinfo->gpio_batlock);
        case SHARPSL_STATUS_CHRGFULL:
index 4c9a48bef569b41c57948d43d3dd9d8de8e686b5..940ca56b37f94175caf88c0fddde4c379c01a2ea 100644 (file)
@@ -376,7 +376,7 @@ static struct spi_board_info spi_board_info[] __initdata = {
                .bus_num = 1,
                .chip_select = 0,
                .controller_data = &staccel_chip_info,
-               .irq = IRQ_GPIO(96),
+               .irq = PXA_GPIO_TO_IRQ(96),
        }, {
                .modalias = "cc2420",
                .max_speed_hz = 6500000,
@@ -546,7 +546,7 @@ static struct i2c_board_info __initdata imote2_pwr_i2c_board_info[] = {
                .type = "da9030",
                .addr = 0x49,
                .platform_data = &imote2_da9030_pdata,
-               .irq = gpio_to_irq(1),
+               .irq = PXA_GPIO_TO_IRQ(1),
        },
 };
 
@@ -560,18 +560,18 @@ static struct i2c_board_info __initdata imote2_i2c_board_info[] = {
                /* Through a nand gate - Also beware, on V2 sensor board the
                 * pull up resistors are missing.
                 */
-               .irq = IRQ_GPIO(99),
+               .irq = PXA_GPIO_TO_IRQ(99),
        }, { /* ITS400 Sensor board only */
                .type = "tsl2561",
                .addr = 0x49,
                /* Through a nand gate - Also beware, on V2 sensor board the
                 * pull up resistors are missing.
                 */
-               .irq = IRQ_GPIO(99),
+               .irq = PXA_GPIO_TO_IRQ(99),
        }, { /* ITS400 Sensor board only */
                .type = "tmp175",
                .addr = 0x4A,
-               .irq = IRQ_GPIO(96),
+               .irq = PXA_GPIO_TO_IRQ(96),
        }, { /* IMB400 Multimedia board */
                .type = "wm8940",
                .addr = 0x1A,
@@ -661,8 +661,8 @@ static struct resource smc91x_resources[] = {
                .flags = IORESOURCE_MEM,
        },
        [1] = {
-               .start = IRQ_GPIO(40),
-               .end = IRQ_GPIO(40),
+               .start = PXA_GPIO_TO_IRQ(40),
+               .end = PXA_GPIO_TO_IRQ(40),
                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        }
 };
@@ -707,7 +707,7 @@ static int stargate2_mci_init(struct device *dev,
        }
        gpio_direction_input(SG2_GPIO_nSD_DETECT);
 
-       err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT),
+       err = request_irq(PXA_GPIO_TO_IRQ(SG2_GPIO_nSD_DETECT),
                          stargate2_detect_int,
                          IRQ_TYPE_EDGE_BOTH,
                          "MMC card detect",
@@ -738,7 +738,7 @@ static void stargate2_mci_setpower(struct device *dev, unsigned int vdd)
 
 static void stargate2_mci_exit(struct device *dev, void *data)
 {
-       free_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), data);
+       free_irq(PXA_GPIO_TO_IRQ(SG2_GPIO_nSD_DETECT), data);
        gpio_free(SG2_SD_POWER_ENABLE);
        gpio_free(SG2_GPIO_nSD_DETECT);
 }
@@ -913,7 +913,7 @@ static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {
                .type = "da9030",
                .addr = 0x49,
                .platform_data = &stargate2_da9030_pdata,
-               .irq = gpio_to_irq(1),
+               .irq = PXA_GPIO_TO_IRQ(1),
        },
 };
 
@@ -938,18 +938,18 @@ static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
                /* Through a nand gate - Also beware, on V2 sensor board the
                 * pull up resistors are missing.
                 */
-               .irq = IRQ_GPIO(99),
+               .irq = PXA_GPIO_TO_IRQ(99),
        }, { /* ITS400 Sensor board only */
                .type = "tsl2561",
                .addr = 0x49,
                /* Through a nand gate - Also beware, on V2 sensor board the
                 * pull up resistors are missing.
                 */
-               .irq = IRQ_GPIO(99),
+               .irq = PXA_GPIO_TO_IRQ(99),
        }, { /* ITS400 Sensor board only */
                .type = "tmp175",
                .addr = 0x4A,
-               .irq = IRQ_GPIO(96),
+               .irq = PXA_GPIO_TO_IRQ(96),
        },
 };
 
index ad47bb98f30d88a57702462ea926880f05972071..43bdcb9761f24222500590f0c3a8c73a182951bc 100644 (file)
@@ -85,8 +85,8 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
-               .end    = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
+               .start  = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47)),
+               .end    = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO47)),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        }
 };
index fd569167302a6d57f4aaea6902782d8d16149166..46c60b3cbe794b61029f158bca77a7df370c25ab 100644 (file)
@@ -101,7 +101,7 @@ static struct i2c_board_info evb3_i2c_info[] = {
                .type           = "88PM860x",
                .addr           = 0x34,
                .platform_data  = &evb3_pm8607_info,
-               .irq            = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
+               .irq            = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO83)),
        },
 };
 
index 402b0c96613baa424941d50e650ca4d5b51cc882..1ddb9826448af7b3ad9947bfe6f253cc5e09cd3d 100644 (file)
@@ -404,8 +404,8 @@ static struct pda_power_pdata tosa_power_data = {
 static struct resource tosa_power_resource[] = {
        {
                .name           = "ac",
-               .start          = gpio_to_irq(TOSA_GPIO_AC_IN),
-               .end            = gpio_to_irq(TOSA_GPIO_AC_IN),
+               .start          = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
+               .end            = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
                .flags          = IORESOURCE_IRQ |
                                  IORESOURCE_IRQ_HIGHEDGE |
                                  IORESOURCE_IRQ_LOWEDGE,
index 242ddae332d30b6dd34a8107d3315f6f03e188c0..d9a653a7717635afb91688ccaa5c0dd8425c8c70 100644 (file)
@@ -422,8 +422,8 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = gpio_to_irq(VIPER_ETH_GPIO),
-               .end    = gpio_to_irq(VIPER_ETH_GPIO),
+               .start  = PXA_GPIO_TO_IRQ(VIPER_ETH_GPIO),
+               .end    = PXA_GPIO_TO_IRQ(VIPER_ETH_GPIO),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        },
        [2] = {
@@ -546,7 +546,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
        /* External UARTs */
        {
                .mapbase        = VIPER_UARTA_PHYS,
-               .irq            = gpio_to_irq(VIPER_UARTA_GPIO),
+               .irq            = PXA_GPIO_TO_IRQ(VIPER_UARTA_GPIO),
                .irqflags       = IRQF_TRIGGER_RISING,
                .uartclk        = 1843200,
                .regshift       = 1,
@@ -556,7 +556,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
        },
        {
                .mapbase        = VIPER_UARTB_PHYS,
-               .irq            = gpio_to_irq(VIPER_UARTB_GPIO),
+               .irq            = PXA_GPIO_TO_IRQ(VIPER_UARTB_GPIO),
                .irqflags       = IRQF_TRIGGER_RISING,
                .uartclk        = 1843200,
                .regshift       = 1,
@@ -596,8 +596,8 @@ static struct resource isp116x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [2] = {
-               .start  = gpio_to_irq(VIPER_USB_GPIO),
-               .end    = gpio_to_irq(VIPER_USB_GPIO),
+               .start  = PXA_GPIO_TO_IRQ(VIPER_USB_GPIO),
+               .end    = PXA_GPIO_TO_IRQ(VIPER_USB_GPIO),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        },
 };
index ca0c6615028c42aa0414cc2e76de4a0a29c83918..9edeec65f6a3b640b4860e38e9387f4f4892aeb3 100644 (file)
@@ -395,8 +395,8 @@ static struct resource vpac270_dm9000_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [2] = {
-               .start  = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
-               .end    = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
+               .start  = PXA_GPIO_TO_IRQ(GPIO114_VPAC270_ETH_IRQ),
+               .end    = PXA_GPIO_TO_IRQ(GPIO114_VPAC270_ETH_IRQ),
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        },
 };
@@ -433,7 +433,7 @@ static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
 };
 
 static struct ucb1400_pdata vpac270_ucb1400_pdata = {
-       .irq            = IRQ_GPIO(GPIO113_VPAC270_TS_IRQ),
+       .irq            = PXA_GPIO_TO_IRQ(GPIO113_VPAC270_TS_IRQ),
 };
 
 static struct platform_device vpac270_ucb1400_device = {
@@ -610,8 +610,8 @@ static struct resource vpac270_ide_resources[] = {
               .flags   = IORESOURCE_DMA
        },
        [3] = { /* IDE IRQ pin */
-              .start   = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
-              .end     = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
+              .start   = PXA_GPIO_TO_IRQ(GPIO36_VPAC270_IDE_IRQ),
+              .end     = PXA_GPIO_TO_IRQ(GPIO36_VPAC270_IDE_IRQ),
               .flags   = IORESOURCE_IRQ
        }
 };
index ead32c90fec17380cce3dcda522e35812d631eb1..424661833ce2ba684e2edca8aa1f05462097e41e 100644 (file)
@@ -573,7 +573,7 @@ static struct spi_board_info spi_board_info[] __initdata = {
        .modalias               = "libertas_spi",
        .platform_data          = &z2_lbs_pdata,
        .controller_data        = &z2_lbs_chip_info,
-       .irq                    = gpio_to_irq(GPIO36_ZIPITZ2_WIFI_IRQ),
+       .irq                    = PXA_GPIO_TO_IRQ(GPIO36_ZIPITZ2_WIFI_IRQ),
        .max_speed_hz           = 13000000,
        .bus_num                = 1,
        .chip_select            = 0,
index 498b83b089f32034b7d3ba8c0cfcb6aa9bcade69..68de9c17e4c54a07910f66af40c7807c71e7374a 100644 (file)
@@ -233,7 +233,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
        /* FIXME: Shared IRQs on COM1-COM4 will not work properly on v1i1 hardware. */
        { /* COM1 */
                .mapbase        = 0x10000000,
-               .irq            = gpio_to_irq(ZEUS_UARTA_GPIO),
+               .irq            = PXA_GPIO_TO_IRQ(ZEUS_UARTA_GPIO),
                .irqflags       = IRQF_TRIGGER_RISING,
                .uartclk        = 14745600,
                .regshift       = 1,
@@ -242,7 +242,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
        },
        { /* COM2 */
                .mapbase        = 0x10800000,
-               .irq            = gpio_to_irq(ZEUS_UARTB_GPIO),
+               .irq            = PXA_GPIO_TO_IRQ(ZEUS_UARTB_GPIO),
                .irqflags       = IRQF_TRIGGER_RISING,
                .uartclk        = 14745600,
                .regshift       = 1,
@@ -251,7 +251,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
        },
        { /* COM3 */
                .mapbase        = 0x11000000,
-               .irq            = gpio_to_irq(ZEUS_UARTC_GPIO),
+               .irq            = PXA_GPIO_TO_IRQ(ZEUS_UARTC_GPIO),
                .irqflags       = IRQF_TRIGGER_RISING,
                .uartclk        = 14745600,
                .regshift       = 1,
@@ -260,7 +260,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
        },
        { /* COM4 */
                .mapbase        = 0x11800000,
-               .irq            = gpio_to_irq(ZEUS_UARTD_GPIO),
+               .irq            = PXA_GPIO_TO_IRQ(ZEUS_UARTD_GPIO),
                .irqflags       = IRQF_TRIGGER_RISING,
                .uartclk        = 14745600,
                .regshift       = 1,
@@ -321,8 +321,8 @@ static struct resource zeus_dm9k0_resource[] = {
                .flags = IORESOURCE_MEM
        },
        [2] = {
-               .start = gpio_to_irq(ZEUS_ETH0_GPIO),
-               .end   = gpio_to_irq(ZEUS_ETH0_GPIO),
+               .start = PXA_GPIO_TO_IRQ(ZEUS_ETH0_GPIO),
+               .end   = PXA_GPIO_TO_IRQ(ZEUS_ETH0_GPIO),
                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
        },
 };
@@ -339,8 +339,8 @@ static struct resource zeus_dm9k1_resource[] = {
                .flags = IORESOURCE_MEM,
        },
        [2] = {
-               .start = gpio_to_irq(ZEUS_ETH1_GPIO),
-               .end   = gpio_to_irq(ZEUS_ETH1_GPIO),
+               .start = PXA_GPIO_TO_IRQ(ZEUS_ETH1_GPIO),
+               .end   = PXA_GPIO_TO_IRQ(ZEUS_ETH1_GPIO),
                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
        },
 };
@@ -423,7 +423,7 @@ static struct spi_board_info zeus_spi_board_info[] = {
        [0] = {
                .modalias       = "mcp2515",
                .platform_data  = &zeus_mcp2515_pdata,
-               .irq            = gpio_to_irq(ZEUS_CAN_GPIO),
+               .irq            = PXA_GPIO_TO_IRQ(ZEUS_CAN_GPIO),
                .max_speed_hz   = 1*1000*1000,
                .bus_num        = 3,
                .mode           = SPI_MODE_0,
@@ -753,7 +753,7 @@ static struct i2c_board_info __initdata zeus_i2c_devices[] = {
        {
                I2C_BOARD_INFO("pca9535",       0x20),
                .platform_data  = &zeus_pca953x_pdata[2],
-               .irq            = gpio_to_irq(ZEUS_EXTGPIO_GPIO),
+               .irq            = PXA_GPIO_TO_IRQ(ZEUS_EXTGPIO_GPIO),
        },
        { I2C_BOARD_INFO("lm75a",       0x48) },
        { I2C_BOARD_INFO("24c01",       0x50) },
index 6c39c332841807325864e14c77cf0cfdc6bb2bc5..a4c807527095bedece82d64167322fec829546ce 100644 (file)
@@ -408,8 +408,8 @@ static void __init zylonite_init(void)
         * Note: We depend that the bootloader set
         * the correct value to MSC register for SMC91x.
         */
-       smc91x_resources[1].start = gpio_to_irq(gpio_eth_irq);
-       smc91x_resources[1].end   = gpio_to_irq(gpio_eth_irq);
+       smc91x_resources[1].start = PXA_GPIO_TO_IRQ(gpio_eth_irq);
+       smc91x_resources[1].end   = PXA_GPIO_TO_IRQ(gpio_eth_irq);
        platform_device_register(&smc91x_device);
 
        pxa_set_ac97_info(NULL);
index 93c64d8d7de9714e52e1a37b0af18f123fd79611..86e59c043de2ba4847b0bed5349fa8e183643a68 100644 (file)
@@ -231,12 +231,12 @@ static struct i2c_board_info zylonite_i2c_board_info[] = {
                .type           = "pca9539",
                .addr           = 0x74,
                .platform_data  = &gpio_exp[0],
-               .irq            = IRQ_GPIO(18),
+               .irq            = PXA_GPIO_TO_IRQ(18),
        }, {
                .type           = "pca9539",
                .addr           = 0x75,
                .platform_data  = &gpio_exp[1],
-               .irq            = IRQ_GPIO(19),
+               .irq            = PXA_GPIO_TO_IRQ(19),
        },
 };
 
index 30e10719b774853e2247badf8a414111408c8fac..6e5d3a0cb9d52245f4f00fc72ba73c76840375c7 100644 (file)
 #define INT_35XX_EMAC_C0_TX_PULSE_IRQ  69
 #define INT_35XX_EMAC_C0_MISC_PULSE_IRQ        70
 #define INT_35XX_USBOTG_IRQ            71
-#define INT_35XX_UART4                 84
+#define INT_35XX_UART4_IRQ             84
 #define INT_35XX_CCDC_VD0_IRQ          88
 #define INT_35XX_CCDC_VD1_IRQ          92
 #define INT_35XX_CCDC_VD2_IRQ          93
index 94cf70afb236bd5950e3ca0f7aaa5cfb86010cb4..f75946c3293d2bd26b0de35b8f253c0ed832eb3d 100644 (file)
@@ -96,6 +96,7 @@ struct omap_mmc_platform_data {
                 */
                u8  wires;      /* Used for the MMC driver on omap1 and 2420 */
                u32 caps;       /* Used for the MMC driver on 2430 and later */
+               u32 pm_caps;    /* PM capabilities of the mmc */
 
                /*
                 * nomux means "standard" muxing is wrong on this board, and
index 1ab9fd6abe6de8e837e06260fbb58ff03f6b4d6f..865a2ba7ffa89ab63581a0cc8819acdbe048e141 100644 (file)
@@ -44,6 +44,7 @@
 #define OMAP3_UART2_BASE       OMAP2_UART2_BASE
 #define OMAP3_UART3_BASE       0x49020000
 #define OMAP3_UART4_BASE       0x49042000      /* Only on 36xx */
+#define OMAP3_UART4_AM35XX_BASE        0x4809E000      /* Only on AM35xx */
 
 /* OMAP4 serial ports */
 #define OMAP4_UART1_BASE       OMAP2_UART1_BASE
index 17d3c939775c7164e2c246f8a150bb212bbb0647..2b66dc266bcfba119ef5f6e678d8ce1fae9d48fe 100644 (file)
@@ -100,9 +100,6 @@ extern void usb_musb_init(struct omap_musb_board_data *board_data);
 
 extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
 
-extern int omap_usbhs_enable(struct device *dev);
-extern void omap_usbhs_disable(struct device *dev);
-
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
 extern 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 (file)
index b6390be..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef __PLAT_PXA_GPIO_H
-#define __PLAT_PXA_GPIO_H
-
-struct irq_data;
-
-/*
- * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
- * one set of registers. The register offsets are organized below:
- *
- *           GPLR    GPDR    GPSR    GPCR    GRER    GFER    GEDR
- * BANK 0 - 0x0000  0x000C  0x0018  0x0024  0x0030  0x003C  0x0048
- * BANK 1 - 0x0004  0x0010  0x001C  0x0028  0x0034  0x0040  0x004C
- * BANK 2 - 0x0008  0x0014  0x0020  0x002C  0x0038  0x0044  0x0050
- *
- * BANK 3 - 0x0100  0x010C  0x0118  0x0124  0x0130  0x013C  0x0148
- * BANK 4 - 0x0104  0x0110  0x011C  0x0128  0x0134  0x0140  0x014C
- * BANK 5 - 0x0108  0x0114  0x0120  0x012C  0x0138  0x0144  0x0150
- *
- * NOTE:
- *   BANK 3 is only available on PXA27x and later processors.
- *   BANK 4 and 5 are only available on PXA935
- */
-
-#define GPIO_BANK(n)   (GPIO_REGS_VIRT + BANK_OFF(n))
-
-#define GPLR_OFFSET    0x00
-#define GPDR_OFFSET    0x0C
-#define GPSR_OFFSET    0x18
-#define GPCR_OFFSET    0x24
-#define GRER_OFFSET    0x30
-#define GFER_OFFSET    0x3C
-#define GEDR_OFFSET    0x48
-
-/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
- * Those cases currently cause holes in the GPIO number space, the
- * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
- */
-extern int pxa_last_gpio;
-
-typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
-
-extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
-
-#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 (file)
index 258f772..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef __PLAT_GPIO_H
-#define __PLAT_GPIO_H
-
-#define __ARM_GPIOLIB_COMPLEX
-
-/* The individual machine provides register offsets and NR_BUILTIN_GPIO */
-#include <mach/gpio-pxa.h>
-
-static inline int gpio_get_value(unsigned gpio)
-{
-       if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO))
-               return GPLR(gpio) & GPIO_bit(gpio);
-       else
-               return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-       if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) {
-               if (value)
-                       GPSR(gpio) = GPIO_bit(gpio);
-               else
-                       GPCR(gpio) = GPIO_bit(gpio);
-       } else
-               __gpio_set_value(gpio, value);
-}
-
-#define gpio_cansleep          __gpio_cansleep
-
-#endif /* __PLAT_GPIO_H */
index 83b1e31696d9c184199fae70d5e5b999eb2b80fc..4214ea0ff8fe36ffb6d64d8372d2d8248b889b76 100644 (file)
@@ -123,6 +123,7 @@ extern struct platform_device exynos4_device_dwmci;
 extern struct platform_device exynos4_device_i2s0;
 extern struct platform_device exynos4_device_i2s1;
 extern struct platform_device exynos4_device_i2s2;
+extern struct platform_device exynos4_device_ohci;
 extern struct platform_device exynos4_device_pcm0;
 extern struct platform_device exynos4_device_pcm1;
 extern struct platform_device exynos4_device_pcm2;
index 1f17bde52cd4dca07e6ec59aac6a13588ed8096b..7c756fb189f713f3fd9d0b06de43530cb60833c1 100644 (file)
@@ -109,7 +109,7 @@ struct eth_addr {
        u8 addr[6];
 };
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2];
+static struct macb_platform_data __initdata eth_data[2];
 
 static struct spi_board_info spi0_board_info[] __initdata = {
        {
index 4643ff5107c9f76ea4b3fa10a2c02f217696a22e..c56ddac85d615ba7acdeac3cc5fc67fa925898b3 100644 (file)
@@ -105,7 +105,7 @@ struct eth_addr {
 };
 
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2] = {
+static struct macb_platform_data __initdata eth_data[2] = {
        {
                /*
                 * The MDIO pullups on STK1000 are a bit too weak for
index 86fab77a5a00f993b8e9f82621b0cda03bdc74a2..27bd6fbe21cb5f76253ad88f50f4a12c13f9778e 100644 (file)
@@ -50,7 +50,7 @@ struct eth_addr {
        u8 addr[6];
 };
 static struct eth_addr __initdata hw_addr[1];
-static struct eth_platform_data __initdata eth_data[1] = {
+static struct macb_platform_data __initdata eth_data[1] = {
        {
                .phy_mask       = ~(1U << 1),
        },
index da14fbdd4e8e0062a87464a8c8d9d43954f63730..9d1efd1cd42534076307d59c1444a663c3b8764d 100644 (file)
@@ -102,7 +102,7 @@ struct eth_addr {
 };
 
 static struct eth_addr __initdata hw_addr[1];
-static struct eth_platform_data __initdata eth_data[1];
+static struct macb_platform_data __initdata eth_data[1];
 
 /*
  * The next two functions should go away as the boot loader is
index e61bc948f959861047449fcce267422b0fe84c78..ed137e335796e7a7e0cf881c2879037720d4200f 100644 (file)
@@ -52,7 +52,7 @@ struct eth_addr {
 };
 
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2];
+static struct macb_platform_data __initdata eth_data[2];
 
 static int ads7846_get_pendown_state_PB26(void)
 {
index c4da5cba2dbfa718cd1a3ea34afd3a0c50257c01..05358aa5ef7d210ed42d2bb6f68be48b3fa4c690 100644 (file)
@@ -86,7 +86,7 @@ struct eth_addr {
        u8 addr[6];
 };
 static struct eth_addr __initdata hw_addr[2];
-static struct eth_platform_data __initdata eth_data[2];
+static struct macb_platform_data __initdata eth_data[2];
 
 static struct spi_eeprom eeprom_25lc010 = {
                .name = "25lc010",
index 7fbf0dcb9afe5f88e9e307f3530cdbd875cf20f1..402a7bb726696b4091e15a4e367004e634295859 100644 (file)
@@ -1067,7 +1067,7 @@ void __init at32_setup_serial_console(unsigned int usart_id)
  * -------------------------------------------------------------------- */
 
 #ifdef CONFIG_CPU_AT32AP7000
-static struct eth_platform_data macb0_data;
+static struct macb_platform_data macb0_data;
 static struct resource macb0_resource[] = {
        PBMEM(0xfff01800),
        IRQ(25),
@@ -1076,7 +1076,7 @@ DEFINE_DEV_DATA(macb, 0);
 DEV_CLK(hclk, macb0, hsb, 8);
 DEV_CLK(pclk, macb0, pbb, 6);
 
-static struct eth_platform_data macb1_data;
+static struct macb_platform_data macb1_data;
 static struct resource macb1_resource[] = {
        PBMEM(0xfff01c00),
        IRQ(26),
@@ -1086,7 +1086,7 @@ DEV_CLK(hclk, macb1, hsb, 9);
 DEV_CLK(pclk, macb1, pbb, 7);
 
 struct platform_device *__init
-at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
+at32_add_device_eth(unsigned int id, struct macb_platform_data *data)
 {
        struct platform_device *pdev;
        u32 pin_mask;
@@ -1163,7 +1163,7 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data)
                return NULL;
        }
 
-       memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data));
+       memcpy(pdev->dev.platform_data, data, sizeof(struct macb_platform_data));
        platform_device_register(pdev);
 
        return pdev;
index 5d7ffca7d69f01bb5b28cec422b8afb702d27859..67b111ce332ddf02bc32afb9eacd66869a2e7a92 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <linux/types.h>
 #include <linux/serial.h>
+#include <linux/platform_data/macb.h>
 
 #define GPIO_PIN_NONE  (-1)
 
@@ -42,12 +43,8 @@ struct atmel_uart_data {
 void at32_map_usart(unsigned int hw_id, unsigned int line, int flags);
 struct platform_device *at32_add_device_usart(unsigned int id);
 
-struct eth_platform_data {
-       u32     phy_mask;
-       u8      is_rmii;
-};
 struct platform_device *
-at32_add_device_eth(unsigned int id, struct eth_platform_data *data);
+at32_add_device_eth(unsigned int id, struct macb_platform_data *data);
 
 struct spi_board_info;
 struct platform_device *
index 8482a23887dc4e8a64f12783fad08c658d8b1ddb..aa0b94ff36d0d32ea941b9300d605c48e3b3944c 100644 (file)
@@ -141,6 +141,12 @@ config GPIO_PL061
        help
          Say yes here to support the PrimeCell PL061 GPIO device
 
+config GPIO_PXA
+       bool "PXA GPIO support"
+       depends on ARCH_PXA || ARCH_MMP
+       help
+         Say yes here to support the PXA GPIO device
+
 config GPIO_XILINX
        bool "Xilinx GPIO support"
        depends on PPC_OF || MICROBLAZE
index 4e018d6a763996127cd370a6a3908273024f37a8..8ef9e9abe97082d26acb915bc169b053a6ff30bb 100644 (file)
@@ -40,7 +40,7 @@ obj-$(CONFIG_GPIO_PCA953X)    += gpio-pca953x.o
 obj-$(CONFIG_GPIO_PCF857X)     += gpio-pcf857x.o
 obj-$(CONFIG_GPIO_PCH)         += gpio-pch.o
 obj-$(CONFIG_GPIO_PL061)       += gpio-pl061.o
-obj-$(CONFIG_PLAT_PXA)         += gpio-pxa.o
+obj-$(CONFIG_GPIO_PXA)         += gpio-pxa.o
 obj-$(CONFIG_GPIO_RDC321X)     += gpio-rdc321x.o
 obj-$(CONFIG_PLAT_SAMSUNG)     += gpio-samsung.o
 obj-$(CONFIG_ARCH_SA1100)      += gpio-sa1100.o
index ee137712f9db2cc1820343b210ce00556ee0b003..b2d3ee1d183a50b2da33ac819d2a74375966b726 100644 (file)
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
+#include <linux/clk.h>
+#include <linux/err.h>
 #include <linux/gpio.h>
+#include <linux/gpio-pxa.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/io.h>
+#include <linux/platform_device.h>
 #include <linux/syscore_ops.h>
 #include <linux/slab.h>
 
-#include <mach/gpio-pxa.h>
+/*
+ * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
+ * one set of registers. The register offsets are organized below:
+ *
+ *           GPLR    GPDR    GPSR    GPCR    GRER    GFER    GEDR
+ * BANK 0 - 0x0000  0x000C  0x0018  0x0024  0x0030  0x003C  0x0048
+ * BANK 1 - 0x0004  0x0010  0x001C  0x0028  0x0034  0x0040  0x004C
+ * BANK 2 - 0x0008  0x0014  0x0020  0x002C  0x0038  0x0044  0x0050
+ *
+ * BANK 3 - 0x0100  0x010C  0x0118  0x0124  0x0130  0x013C  0x0148
+ * BANK 4 - 0x0104  0x0110  0x011C  0x0128  0x0134  0x0140  0x014C
+ * BANK 5 - 0x0108  0x0114  0x0120  0x012C  0x0138  0x0144  0x0150
+ *
+ * NOTE:
+ *   BANK 3 is only available on PXA27x and later processors.
+ *   BANK 4 and 5 are only available on PXA935
+ */
+
+#define GPLR_OFFSET    0x00
+#define GPDR_OFFSET    0x0C
+#define GPSR_OFFSET    0x18
+#define GPCR_OFFSET    0x24
+#define GRER_OFFSET    0x30
+#define GFER_OFFSET    0x3C
+#define GEDR_OFFSET    0x48
+#define GAFR_OFFSET    0x54
+#define ED_MASK_OFFSET 0x9C    /* GPIO edge detection for AP side */
+
+#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
 
 int pxa_last_gpio;
 
@@ -39,8 +71,20 @@ struct pxa_gpio_chip {
 #endif
 };
 
+enum {
+       PXA25X_GPIO = 0,
+       PXA26X_GPIO,
+       PXA27X_GPIO,
+       PXA3XX_GPIO,
+       PXA93X_GPIO,
+       MMP_GPIO = 0x10,
+       MMP2_GPIO,
+};
+
 static DEFINE_SPINLOCK(gpio_lock);
 static struct pxa_gpio_chip *pxa_gpio_chips;
+static int gpio_type;
+static void __iomem *gpio_reg_base;
 
 #define for_each_gpio_chip(i, c)                       \
        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)
        return &pxa_gpio_chips[gpio_to_bank(gpio)];
 }
 
+static inline int gpio_is_pxa_type(int type)
+{
+       return (type & MMP_GPIO) == 0;
+}
+
+static inline int gpio_is_mmp_type(int type)
+{
+       return (type & MMP_GPIO) != 0;
+}
+
+/* GPIO86/87/88/89 on PXA26x have their direction bits in PXA_GPDR(2 inverted,
+ * as well as their Alternate Function value being '1' for GPIO in GAFRx.
+ */
+static inline int __gpio_is_inverted(int gpio)
+{
+       if ((gpio_type == PXA26X_GPIO) && (gpio > 85))
+               return 1;
+       return 0;
+}
+
+/*
+ * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
+ * function of a GPIO, and GPDRx cannot be altered once configured. It
+ * is attributed as "occupied" here (I know this terminology isn't
+ * accurate, you are welcome to propose a better one :-)
+ */
+static inline int __gpio_is_occupied(unsigned gpio)
+{
+       struct pxa_gpio_chip *pxachip;
+       void __iomem *base;
+       unsigned long gafr = 0, gpdr = 0;
+       int ret, af = 0, dir = 0;
+
+       pxachip = gpio_to_pxachip(gpio);
+       base = gpio_chip_base(&pxachip->chip);
+       gpdr = readl_relaxed(base + GPDR_OFFSET);
+
+       switch (gpio_type) {
+       case PXA25X_GPIO:
+       case PXA26X_GPIO:
+       case PXA27X_GPIO:
+               gafr = readl_relaxed(base + GAFR_OFFSET);
+               af = (gafr >> ((gpio & 0xf) * 2)) & 0x3;
+               dir = gpdr & GPIO_bit(gpio);
+
+               if (__gpio_is_inverted(gpio))
+                       ret = (af != 1) || (dir == 0);
+               else
+                       ret = (af != 0) || (dir != 0);
+               break;
+       default:
+               ret = gpdr & GPIO_bit(gpio);
+               break;
+       }
+       return ret;
+}
+
+#ifdef CONFIG_ARCH_PXA
+static inline int __pxa_gpio_to_irq(int gpio)
+{
+       if (gpio_is_pxa_type(gpio_type))
+               return PXA_GPIO_TO_IRQ(gpio);
+       return -1;
+}
+
+static inline int __pxa_irq_to_gpio(int irq)
+{
+       if (gpio_is_pxa_type(gpio_type))
+               return irq - PXA_GPIO_TO_IRQ(0);
+       return -1;
+}
+#else
+static inline int __pxa_gpio_to_irq(int gpio) { return -1; }
+static inline int __pxa_irq_to_gpio(int irq) { return -1; }
+#endif
+
+#ifdef CONFIG_ARCH_MMP
+static inline int __mmp_gpio_to_irq(int gpio)
+{
+       if (gpio_is_mmp_type(gpio_type))
+               return MMP_GPIO_TO_IRQ(gpio);
+       return -1;
+}
+
+static inline int __mmp_irq_to_gpio(int irq)
+{
+       if (gpio_is_mmp_type(gpio_type))
+               return irq - MMP_GPIO_TO_IRQ(0);
+       return -1;
+}
+#else
+static inline int __mmp_gpio_to_irq(int gpio) { return -1; }
+static inline int __mmp_irq_to_gpio(int irq) { return -1; }
+#endif
+
+static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+       int gpio, ret;
+
+       gpio = chip->base + offset;
+       ret = __pxa_gpio_to_irq(gpio);
+       if (ret >= 0)
+               return ret;
+       return __mmp_gpio_to_irq(gpio);
+}
+
+int pxa_irq_to_gpio(int irq)
+{
+       int ret;
+
+       ret = __pxa_irq_to_gpio(irq);
+       if (ret >= 0)
+               return ret;
+       return __mmp_irq_to_gpio(irq);
+}
+
 static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
        void __iomem *base = gpio_chip_base(chip);
@@ -63,12 +223,12 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 
        spin_lock_irqsave(&gpio_lock, flags);
 
-       value = __raw_readl(base + GPDR_OFFSET);
+       value = readl_relaxed(base + GPDR_OFFSET);
        if (__gpio_is_inverted(chip->base + offset))
                value |= mask;
        else
                value &= ~mask;
-       __raw_writel(value, base + GPDR_OFFSET);
+       writel_relaxed(value, base + GPDR_OFFSET);
 
        spin_unlock_irqrestore(&gpio_lock, flags);
        return 0;
@@ -81,16 +241,16 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
        uint32_t tmp, mask = 1 << offset;
        unsigned long flags;
 
-       __raw_writel(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
+       writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
 
        spin_lock_irqsave(&gpio_lock, flags);
 
-       tmp = __raw_readl(base + GPDR_OFFSET);
+       tmp = readl_relaxed(base + GPDR_OFFSET);
        if (__gpio_is_inverted(chip->base + offset))
                tmp &= ~mask;
        else
                tmp |= mask;
-       __raw_writel(tmp, base + GPDR_OFFSET);
+       writel_relaxed(tmp, base + GPDR_OFFSET);
 
        spin_unlock_irqrestore(&gpio_lock, flags);
        return 0;
@@ -98,16 +258,16 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
 
 static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-       return __raw_readl(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset);
+       return readl_relaxed(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset);
 }
 
 static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
-       __raw_writel(1 << offset, gpio_chip_base(chip) +
+       writel_relaxed(1 << offset, gpio_chip_base(chip) +
                                (value ? GPSR_OFFSET : GPCR_OFFSET));
 }
 
-static int __init pxa_init_gpio_chip(int gpio_end)
+static int __devinit pxa_init_gpio_chip(int gpio_end)
 {
        int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
        struct pxa_gpio_chip *chips;
@@ -122,7 +282,7 @@ static int __init pxa_init_gpio_chip(int gpio_end)
                struct gpio_chip *c = &chips[i].chip;
 
                sprintf(chips[i].label, "gpio-%d", i);
-               chips[i].regbase = GPIO_BANK(i);
+               chips[i].regbase = gpio_reg_base + BANK_OFF(i);
 
                c->base  = gpio;
                c->label = chips[i].label;
@@ -131,6 +291,7 @@ static int __init pxa_init_gpio_chip(int gpio_end)
                c->direction_output = pxa_gpio_direction_output;
                c->get = pxa_gpio_get;
                c->set = pxa_gpio_set;
+               c->to_irq = pxa_gpio_to_irq;
 
                /* number of GPIOs on last bank may be less than 32 */
                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)
 {
        uint32_t grer, gfer;
 
-       grer = __raw_readl(c->regbase + GRER_OFFSET) & ~c->irq_mask;
-       gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~c->irq_mask;
+       grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~c->irq_mask;
+       gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~c->irq_mask;
        grer |= c->irq_edge_rise & c->irq_mask;
        gfer |= c->irq_edge_fall & c->irq_mask;
-       __raw_writel(grer, c->regbase + GRER_OFFSET);
-       __raw_writel(gfer, c->regbase + GFER_OFFSET);
+       writel_relaxed(grer, c->regbase + GRER_OFFSET);
+       writel_relaxed(gfer, c->regbase + GFER_OFFSET);
 }
 
 static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
 {
        struct pxa_gpio_chip *c;
-       int gpio = irq_to_gpio(d->irq);
+       int gpio = pxa_irq_to_gpio(d->irq);
        unsigned long gpdr, mask = GPIO_bit(gpio);
 
        c = gpio_to_pxachip(gpio);
@@ -176,12 +337,12 @@ static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
                type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
        }
 
-       gpdr = __raw_readl(c->regbase + GPDR_OFFSET);
+       gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
 
        if (__gpio_is_inverted(gpio))
-               __raw_writel(gpdr | mask,  c->regbase + GPDR_OFFSET);
+               writel_relaxed(gpdr | mask,  c->regbase + GPDR_OFFSET);
        else
-               __raw_writel(gpdr & ~mask, c->regbase + GPDR_OFFSET);
+               writel_relaxed(gpdr & ~mask, c->regbase + GPDR_OFFSET);
 
        if (type & IRQ_TYPE_EDGE_RISING)
                c->irq_edge_rise |= mask;
@@ -212,9 +373,9 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
                for_each_gpio_chip(gpio, c) {
                        gpio_base = c->chip.base;
 
-                       gedr = __raw_readl(c->regbase + GEDR_OFFSET);
+                       gedr = readl_relaxed(c->regbase + GEDR_OFFSET);
                        gedr = gedr & c->irq_mask;
-                       __raw_writel(gedr, c->regbase + GEDR_OFFSET);
+                       writel_relaxed(gedr, c->regbase + GEDR_OFFSET);
 
                        n = find_first_bit(&gedr, BITS_PER_LONG);
                        while (n < BITS_PER_LONG) {
@@ -229,29 +390,29 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
 
 static void pxa_ack_muxed_gpio(struct irq_data *d)
 {
-       int gpio = irq_to_gpio(d->irq);
+       int gpio = pxa_irq_to_gpio(d->irq);
        struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
 
-       __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
+       writel_relaxed(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
 }
 
 static void pxa_mask_muxed_gpio(struct irq_data *d)
 {
-       int gpio = irq_to_gpio(d->irq);
+       int gpio = pxa_irq_to_gpio(d->irq);
        struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
        uint32_t grer, gfer;
 
        c->irq_mask &= ~GPIO_bit(gpio);
 
-       grer = __raw_readl(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio);
-       gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio);
-       __raw_writel(grer, c->regbase + GRER_OFFSET);
-       __raw_writel(gfer, c->regbase + GFER_OFFSET);
+       grer = readl_relaxed(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio);
+       gfer = readl_relaxed(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio);
+       writel_relaxed(grer, c->regbase + GRER_OFFSET);
+       writel_relaxed(gfer, c->regbase + GFER_OFFSET);
 }
 
 static void pxa_unmask_muxed_gpio(struct irq_data *d)
 {
-       int gpio = irq_to_gpio(d->irq);
+       int gpio = pxa_irq_to_gpio(d->irq);
        struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
 
        c->irq_mask |= GPIO_bit(gpio);
@@ -266,34 +427,143 @@ static struct irq_chip pxa_muxed_gpio_chip = {
        .irq_set_type   = pxa_gpio_irq_type,
 };
 
-void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn)
+static int pxa_gpio_nums(void)
 {
-       struct pxa_gpio_chip *c;
-       int gpio, irq;
+       int count = 0;
+
+#ifdef CONFIG_ARCH_PXA
+       if (cpu_is_pxa25x()) {
+#ifdef CONFIG_CPU_PXA26x
+               count = 89;
+               gpio_type = PXA26X_GPIO;
+#elif defined(CONFIG_PXA25x)
+               count = 84;
+               gpio_type = PXA26X_GPIO;
+#endif /* CONFIG_CPU_PXA26x */
+       } else if (cpu_is_pxa27x()) {
+               count = 120;
+               gpio_type = PXA27X_GPIO;
+       } else if (cpu_is_pxa93x() || cpu_is_pxa95x()) {
+               count = 191;
+               gpio_type = PXA93X_GPIO;
+       } else if (cpu_is_pxa3xx()) {
+               count = 127;
+               gpio_type = PXA3XX_GPIO;
+       }
+#endif /* CONFIG_ARCH_PXA */
+
+#ifdef CONFIG_ARCH_MMP
+       if (cpu_is_pxa168() || cpu_is_pxa910()) {
+               count = 127;
+               gpio_type = MMP_GPIO;
+       } else if (cpu_is_mmp2()) {
+               count = 191;
+               gpio_type = MMP2_GPIO;
+       }
+#endif /* CONFIG_ARCH_MMP */
+       return count;
+}
 
-       pxa_last_gpio = end;
+static int __devinit pxa_gpio_probe(struct platform_device *pdev)
+{
+       struct pxa_gpio_chip *c;
+       struct resource *res;
+       struct clk *clk;
+       int gpio, irq, ret;
+       int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
+
+       pxa_last_gpio = pxa_gpio_nums();
+       if (!pxa_last_gpio)
+               return -EINVAL;
+
+       irq0 = platform_get_irq_byname(pdev, "gpio0");
+       irq1 = platform_get_irq_byname(pdev, "gpio1");
+       irq_mux = platform_get_irq_byname(pdev, "gpio_mux");
+       if ((irq0 > 0 && irq1 <= 0) || (irq0 <= 0 && irq1 > 0)
+               || (irq_mux <= 0))
+               return -EINVAL;
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res)
+               return -EINVAL;
+       gpio_reg_base = ioremap(res->start, resource_size(res));
+       if (!gpio_reg_base)
+               return -EINVAL;
+
+       if (irq0 > 0)
+               gpio_offset = 2;
+
+       clk = clk_get(&pdev->dev, NULL);
+       if (IS_ERR(clk)) {
+               dev_err(&pdev->dev, "Error %ld to get gpio clock\n",
+                       PTR_ERR(clk));
+               iounmap(gpio_reg_base);
+               return PTR_ERR(clk);
+       }
+       ret = clk_prepare(clk);
+       if (ret) {
+               clk_put(clk);
+               iounmap(gpio_reg_base);
+               return ret;
+       }
+       ret = clk_enable(clk);
+       if (ret) {
+               clk_unprepare(clk);
+               clk_put(clk);
+               iounmap(gpio_reg_base);
+               return ret;
+       }
 
        /* Initialize GPIO chips */
-       pxa_init_gpio_chip(end);
+       pxa_init_gpio_chip(pxa_last_gpio);
 
        /* clear all GPIO edge detects */
        for_each_gpio_chip(gpio, c) {
-               __raw_writel(0, c->regbase + GFER_OFFSET);
-               __raw_writel(0, c->regbase + GRER_OFFSET);
-               __raw_writel(~0,c->regbase + GEDR_OFFSET);
+               writel_relaxed(0, c->regbase + GFER_OFFSET);
+               writel_relaxed(0, c->regbase + GRER_OFFSET);
+               writel_relaxed(~0,c->regbase + GEDR_OFFSET);
+               /* unmask GPIO edge detect for AP side */
+               if (gpio_is_mmp_type(gpio_type))
+                       writel_relaxed(~0, c->regbase + ED_MASK_OFFSET);
        }
 
-       for (irq  = gpio_to_irq(start); irq <= gpio_to_irq(end); irq++) {
+#ifdef CONFIG_ARCH_PXA
+       irq = gpio_to_irq(0);
+       irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
+                                handle_edge_irq);
+       set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+       irq_set_chained_handler(IRQ_GPIO0, pxa_gpio_demux_handler);
+
+       irq = gpio_to_irq(1);
+       irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
+                                handle_edge_irq);
+       set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+       irq_set_chained_handler(IRQ_GPIO1, pxa_gpio_demux_handler);
+#endif
+
+       for (irq  = gpio_to_irq(gpio_offset);
+               irq <= gpio_to_irq(pxa_last_gpio); irq++) {
                irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
                                         handle_edge_irq);
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }
 
-       /* Install handler for GPIO>=2 edge detect interrupts */
-       irq_set_chained_handler(mux_irq, pxa_gpio_demux_handler);
-       pxa_muxed_gpio_chip.irq_set_wake = fn;
+       irq_set_chained_handler(irq_mux, pxa_gpio_demux_handler);
+       return 0;
 }
 
+static struct platform_driver pxa_gpio_driver = {
+       .probe          = pxa_gpio_probe,
+       .driver         = {
+               .name   = "pxa-gpio",
+       },
+};
+
+static int __init pxa_gpio_init(void)
+{
+       return platform_driver_register(&pxa_gpio_driver);
+}
+postcore_initcall(pxa_gpio_init);
+
 #ifdef CONFIG_PM
 static int pxa_gpio_suspend(void)
 {
@@ -301,13 +571,13 @@ static int pxa_gpio_suspend(void)
        int gpio;
 
        for_each_gpio_chip(gpio, c) {
-               c->saved_gplr = __raw_readl(c->regbase + GPLR_OFFSET);
-               c->saved_gpdr = __raw_readl(c->regbase + GPDR_OFFSET);
-               c->saved_grer = __raw_readl(c->regbase + GRER_OFFSET);
-               c->saved_gfer = __raw_readl(c->regbase + GFER_OFFSET);
+               c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET);
+               c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
+               c->saved_grer = readl_relaxed(c->regbase + GRER_OFFSET);
+               c->saved_gfer = readl_relaxed(c->regbase + GFER_OFFSET);
 
                /* Clear GPIO transition detect bits */
-               __raw_writel(0xffffffff, c->regbase + GEDR_OFFSET);
+               writel_relaxed(0xffffffff, c->regbase + GEDR_OFFSET);
        }
        return 0;
 }
@@ -319,12 +589,12 @@ static void pxa_gpio_resume(void)
 
        for_each_gpio_chip(gpio, c) {
                /* restore level with set/clear */
-               __raw_writel( c->saved_gplr, c->regbase + GPSR_OFFSET);
-               __raw_writel(~c->saved_gplr, c->regbase + GPCR_OFFSET);
+               writel_relaxed( c->saved_gplr, c->regbase + GPSR_OFFSET);
+               writel_relaxed(~c->saved_gplr, c->regbase + GPCR_OFFSET);
 
-               __raw_writel(c->saved_grer, c->regbase + GRER_OFFSET);
-               __raw_writel(c->saved_gfer, c->regbase + GFER_OFFSET);
-               __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET);
+               writel_relaxed(c->saved_grer, c->regbase + GRER_OFFSET);
+               writel_relaxed(c->saved_gfer, c->regbase + GFER_OFFSET);
+               writel_relaxed(c->saved_gpdr, c->regbase + GPDR_OFFSET);
        }
 }
 #else
@@ -336,3 +606,10 @@ struct syscore_ops pxa_gpio_syscore_ops = {
        .suspend        = pxa_gpio_suspend,
        .resume         = pxa_gpio_resume,
 };
+
+static int __init pxa_gpio_sysinit(void)
+{
+       register_syscore_ops(&pxa_gpio_syscore_ops);
+       return 0;
+}
+postcore_initcall(pxa_gpio_sysinit);
index 46b6500c5478e9d3f1eb952848ed2d47dbf52a8f..6381604696d304a0508b23778ac04fe7ee05ef08 100644 (file)
@@ -558,7 +558,7 @@ static const struct i2c_algorithm tegra_i2c_algo = {
        .functionality  = tegra_i2c_func,
 };
 
-static int tegra_i2c_probe(struct platform_device *pdev)
+static int __devinit tegra_i2c_probe(struct platform_device *pdev)
 {
        struct tegra_i2c_dev *i2c_dev;
        struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
@@ -636,7 +636,10 @@ static int tegra_i2c_probe(struct platform_device *pdev)
                        i2c_dev->bus_clk_rate = be32_to_cpup(prop);
        }
 
-       if (pdev->id == 3)
+       if (pdev->dev.of_node)
+               i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
+                                               "nvidia,tegra20-i2c-dvc");
+       else if (pdev->id == 3)
                i2c_dev->is_dvc = 1;
        init_completion(&i2c_dev->msg_complete);
 
@@ -690,7 +693,7 @@ err_iounmap:
        return ret;
 }
 
-static int tegra_i2c_remove(struct platform_device *pdev)
+static int __devexit tegra_i2c_remove(struct platform_device *pdev)
 {
        struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
        i2c_del_adapter(&i2c_dev->adapter);
@@ -742,6 +745,7 @@ static int tegra_i2c_resume(struct platform_device *pdev)
 /* Match table for of_platform binding */
 static const struct of_device_id tegra_i2c_of_match[] __devinitconst = {
        { .compatible = "nvidia,tegra20-i2c", },
+       { .compatible = "nvidia,tegra20-i2c-dvc", },
        {},
 };
 MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
index 86e14583a08276fd7f76dddd3afe3433f1dfa9a8..3f565ef3e149438c86a0054f354627231a2258b2 100644 (file)
@@ -27,8 +27,9 @@
 #include <linux/spinlock.h>
 #include <linux/gpio.h>
 #include <plat/usb.h>
+#include <linux/pm_runtime.h>
 
-#define USBHS_DRIVER_NAME      "usbhs-omap"
+#define USBHS_DRIVER_NAME      "usbhs_omap"
 #define OMAP_EHCI_DEVICE       "ehci-omap"
 #define OMAP_OHCI_DEVICE       "ohci-omap3"
 
 
 
 struct usbhs_hcd_omap {
-       struct clk                      *usbhost_ick;
-       struct clk                      *usbhost_hs_fck;
-       struct clk                      *usbhost_fs_fck;
        struct clk                      *xclk60mhsp1_ck;
        struct clk                      *xclk60mhsp2_ck;
        struct clk                      *utmi_p1_fck;
@@ -159,8 +157,7 @@ struct usbhs_hcd_omap {
        struct clk                      *usbhost_p2_fck;
        struct clk                      *usbtll_p2_fck;
        struct clk                      *init_60m_fclk;
-       struct clk                      *usbtll_fck;
-       struct clk                      *usbtll_ick;
+       struct clk                      *ehci_logic_fck;
 
        void __iomem                    *uhh_base;
        void __iomem                    *tll_base;
@@ -169,7 +166,6 @@ struct usbhs_hcd_omap {
 
        u32                             usbhs_rev;
        spinlock_t                      lock;
-       int                             count;
 };
 /*-------------------------------------------------------------------------*/
 
@@ -319,269 +315,6 @@ err_end:
        return ret;
 }
 
-/**
- * usbhs_omap_probe - initialize TI-based HCDs
- *
- * Allocates basic resources for this USB host controller.
- */
-static int __devinit usbhs_omap_probe(struct platform_device *pdev)
-{
-       struct device                   *dev =  &pdev->dev;
-       struct usbhs_omap_platform_data *pdata = dev->platform_data;
-       struct usbhs_hcd_omap           *omap;
-       struct resource                 *res;
-       int                             ret = 0;
-       int                             i;
-
-       if (!pdata) {
-               dev_err(dev, "Missing platform data\n");
-               ret = -ENOMEM;
-               goto end_probe;
-       }
-
-       omap = kzalloc(sizeof(*omap), GFP_KERNEL);
-       if (!omap) {
-               dev_err(dev, "Memory allocation failed\n");
-               ret = -ENOMEM;
-               goto end_probe;
-       }
-
-       spin_lock_init(&omap->lock);
-
-       for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
-               omap->platdata.port_mode[i] = pdata->port_mode[i];
-
-       omap->platdata.ehci_data = pdata->ehci_data;
-       omap->platdata.ohci_data = pdata->ohci_data;
-
-       omap->usbhost_ick = clk_get(dev, "usbhost_ick");
-       if (IS_ERR(omap->usbhost_ick)) {
-               ret =  PTR_ERR(omap->usbhost_ick);
-               dev_err(dev, "usbhost_ick failed error:%d\n", ret);
-               goto err_end;
-       }
-
-       omap->usbhost_hs_fck = clk_get(dev, "hs_fck");
-       if (IS_ERR(omap->usbhost_hs_fck)) {
-               ret = PTR_ERR(omap->usbhost_hs_fck);
-               dev_err(dev, "usbhost_hs_fck failed error:%d\n", ret);
-               goto err_usbhost_ick;
-       }
-
-       omap->usbhost_fs_fck = clk_get(dev, "fs_fck");
-       if (IS_ERR(omap->usbhost_fs_fck)) {
-               ret = PTR_ERR(omap->usbhost_fs_fck);
-               dev_err(dev, "usbhost_fs_fck failed error:%d\n", ret);
-               goto err_usbhost_hs_fck;
-       }
-
-       omap->usbtll_fck = clk_get(dev, "usbtll_fck");
-       if (IS_ERR(omap->usbtll_fck)) {
-               ret = PTR_ERR(omap->usbtll_fck);
-               dev_err(dev, "usbtll_fck failed error:%d\n", ret);
-               goto err_usbhost_fs_fck;
-       }
-
-       omap->usbtll_ick = clk_get(dev, "usbtll_ick");
-       if (IS_ERR(omap->usbtll_ick)) {
-               ret = PTR_ERR(omap->usbtll_ick);
-               dev_err(dev, "usbtll_ick failed error:%d\n", ret);
-               goto err_usbtll_fck;
-       }
-
-       omap->utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
-       if (IS_ERR(omap->utmi_p1_fck)) {
-               ret = PTR_ERR(omap->utmi_p1_fck);
-               dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
-               goto err_usbtll_ick;
-       }
-
-       omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
-       if (IS_ERR(omap->xclk60mhsp1_ck)) {
-               ret = PTR_ERR(omap->xclk60mhsp1_ck);
-               dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
-               goto err_utmi_p1_fck;
-       }
-
-       omap->utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk");
-       if (IS_ERR(omap->utmi_p2_fck)) {
-               ret = PTR_ERR(omap->utmi_p2_fck);
-               dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
-               goto err_xclk60mhsp1_ck;
-       }
-
-       omap->xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck");
-       if (IS_ERR(omap->xclk60mhsp2_ck)) {
-               ret = PTR_ERR(omap->xclk60mhsp2_ck);
-               dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
-               goto err_utmi_p2_fck;
-       }
-
-       omap->usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk");
-       if (IS_ERR(omap->usbhost_p1_fck)) {
-               ret = PTR_ERR(omap->usbhost_p1_fck);
-               dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret);
-               goto err_xclk60mhsp2_ck;
-       }
-
-       omap->usbtll_p1_fck = clk_get(dev, "usb_tll_hs_usb_ch0_clk");
-       if (IS_ERR(omap->usbtll_p1_fck)) {
-               ret = PTR_ERR(omap->usbtll_p1_fck);
-               dev_err(dev, "usbtll_p1_fck failed error:%d\n", ret);
-               goto err_usbhost_p1_fck;
-       }
-
-       omap->usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk");
-       if (IS_ERR(omap->usbhost_p2_fck)) {
-               ret = PTR_ERR(omap->usbhost_p2_fck);
-               dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret);
-               goto err_usbtll_p1_fck;
-       }
-
-       omap->usbtll_p2_fck = clk_get(dev, "usb_tll_hs_usb_ch1_clk");
-       if (IS_ERR(omap->usbtll_p2_fck)) {
-               ret = PTR_ERR(omap->usbtll_p2_fck);
-               dev_err(dev, "usbtll_p2_fck failed error:%d\n", ret);
-               goto err_usbhost_p2_fck;
-       }
-
-       omap->init_60m_fclk = clk_get(dev, "init_60m_fclk");
-       if (IS_ERR(omap->init_60m_fclk)) {
-               ret = PTR_ERR(omap->init_60m_fclk);
-               dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
-               goto err_usbtll_p2_fck;
-       }
-
-       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
-       if (!res) {
-               dev_err(dev, "UHH EHCI get resource failed\n");
-               ret = -ENODEV;
-               goto err_init_60m_fclk;
-       }
-
-       omap->uhh_base = ioremap(res->start, resource_size(res));
-       if (!omap->uhh_base) {
-               dev_err(dev, "UHH ioremap failed\n");
-               ret = -ENOMEM;
-               goto err_init_60m_fclk;
-       }
-
-       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
-       if (!res) {
-               dev_err(dev, "UHH EHCI get resource failed\n");
-               ret = -ENODEV;
-               goto err_tll;
-       }
-
-       omap->tll_base = ioremap(res->start, resource_size(res));
-       if (!omap->tll_base) {
-               dev_err(dev, "TLL ioremap failed\n");
-               ret = -ENOMEM;
-               goto err_tll;
-       }
-
-       platform_set_drvdata(pdev, omap);
-
-       ret = omap_usbhs_alloc_children(pdev);
-       if (ret) {
-               dev_err(dev, "omap_usbhs_alloc_children failed\n");
-               goto err_alloc;
-       }
-
-       goto end_probe;
-
-err_alloc:
-       iounmap(omap->tll_base);
-
-err_tll:
-       iounmap(omap->uhh_base);
-
-err_init_60m_fclk:
-       clk_put(omap->init_60m_fclk);
-
-err_usbtll_p2_fck:
-       clk_put(omap->usbtll_p2_fck);
-
-err_usbhost_p2_fck:
-       clk_put(omap->usbhost_p2_fck);
-
-err_usbtll_p1_fck:
-       clk_put(omap->usbtll_p1_fck);
-
-err_usbhost_p1_fck:
-       clk_put(omap->usbhost_p1_fck);
-
-err_xclk60mhsp2_ck:
-       clk_put(omap->xclk60mhsp2_ck);
-
-err_utmi_p2_fck:
-       clk_put(omap->utmi_p2_fck);
-
-err_xclk60mhsp1_ck:
-       clk_put(omap->xclk60mhsp1_ck);
-
-err_utmi_p1_fck:
-       clk_put(omap->utmi_p1_fck);
-
-err_usbtll_ick:
-       clk_put(omap->usbtll_ick);
-
-err_usbtll_fck:
-       clk_put(omap->usbtll_fck);
-
-err_usbhost_fs_fck:
-       clk_put(omap->usbhost_fs_fck);
-
-err_usbhost_hs_fck:
-       clk_put(omap->usbhost_hs_fck);
-
-err_usbhost_ick:
-       clk_put(omap->usbhost_ick);
-
-err_end:
-       kfree(omap);
-
-end_probe:
-       return ret;
-}
-
-/**
- * usbhs_omap_remove - shutdown processing for UHH & TLL HCDs
- * @pdev: USB Host Controller being removed
- *
- * Reverses the effect of usbhs_omap_probe().
- */
-static int __devexit usbhs_omap_remove(struct platform_device *pdev)
-{
-       struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
-
-       if (omap->count != 0) {
-               dev_err(&pdev->dev,
-                       "Either EHCI or OHCI is still using usbhs core\n");
-               return -EBUSY;
-       }
-
-       iounmap(omap->tll_base);
-       iounmap(omap->uhh_base);
-       clk_put(omap->init_60m_fclk);
-       clk_put(omap->usbtll_p2_fck);
-       clk_put(omap->usbhost_p2_fck);
-       clk_put(omap->usbtll_p1_fck);
-       clk_put(omap->usbhost_p1_fck);
-       clk_put(omap->xclk60mhsp2_ck);
-       clk_put(omap->utmi_p2_fck);
-       clk_put(omap->xclk60mhsp1_ck);
-       clk_put(omap->utmi_p1_fck);
-       clk_put(omap->usbtll_ick);
-       clk_put(omap->usbtll_fck);
-       clk_put(omap->usbhost_fs_fck);
-       clk_put(omap->usbhost_hs_fck);
-       clk_put(omap->usbhost_ick);
-       kfree(omap);
-
-       return 0;
-}
-
 static bool is_ohci_port(enum usbhs_omap_port_mode pmode)
 {
        switch (pmode) {
@@ -689,30 +422,85 @@ static void usbhs_omap_tll_init(struct device *dev, u8 tll_channel_count)
        }
 }
 
-static int usbhs_enable(struct device *dev)
+static int usbhs_runtime_resume(struct device *dev)
 {
        struct usbhs_hcd_omap           *omap = dev_get_drvdata(dev);
        struct usbhs_omap_platform_data *pdata = &omap->platdata;
-       unsigned long                   flags = 0;
-       int                             ret = 0;
-       unsigned long                   timeout;
-       unsigned                        reg;
+       unsigned long                   flags;
+
+       dev_dbg(dev, "usbhs_runtime_resume\n");
 
-       dev_dbg(dev, "starting TI HSUSB Controller\n");
        if (!pdata) {
                dev_dbg(dev, "missing platform_data\n");
                return  -ENODEV;
        }
 
        spin_lock_irqsave(&omap->lock, flags);
-       if (omap->count > 0)
-               goto end_count;
 
-       clk_enable(omap->usbhost_ick);
-       clk_enable(omap->usbhost_hs_fck);
-       clk_enable(omap->usbhost_fs_fck);
-       clk_enable(omap->usbtll_fck);
-       clk_enable(omap->usbtll_ick);
+       if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
+               clk_enable(omap->ehci_logic_fck);
+
+       if (is_ehci_tll_mode(pdata->port_mode[0])) {
+               clk_enable(omap->usbhost_p1_fck);
+               clk_enable(omap->usbtll_p1_fck);
+       }
+       if (is_ehci_tll_mode(pdata->port_mode[1])) {
+               clk_enable(omap->usbhost_p2_fck);
+               clk_enable(omap->usbtll_p2_fck);
+       }
+       clk_enable(omap->utmi_p1_fck);
+       clk_enable(omap->utmi_p2_fck);
+
+       spin_unlock_irqrestore(&omap->lock, flags);
+
+       return 0;
+}
+
+static int usbhs_runtime_suspend(struct device *dev)
+{
+       struct usbhs_hcd_omap           *omap = dev_get_drvdata(dev);
+       struct usbhs_omap_platform_data *pdata = &omap->platdata;
+       unsigned long                   flags;
+
+       dev_dbg(dev, "usbhs_runtime_suspend\n");
+
+       if (!pdata) {
+               dev_dbg(dev, "missing platform_data\n");
+               return  -ENODEV;
+       }
+
+       spin_lock_irqsave(&omap->lock, flags);
+
+       if (is_ehci_tll_mode(pdata->port_mode[0])) {
+               clk_disable(omap->usbhost_p1_fck);
+               clk_disable(omap->usbtll_p1_fck);
+       }
+       if (is_ehci_tll_mode(pdata->port_mode[1])) {
+               clk_disable(omap->usbhost_p2_fck);
+               clk_disable(omap->usbtll_p2_fck);
+       }
+       clk_disable(omap->utmi_p2_fck);
+       clk_disable(omap->utmi_p1_fck);
+
+       if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
+               clk_disable(omap->ehci_logic_fck);
+
+       spin_unlock_irqrestore(&omap->lock, flags);
+
+       return 0;
+}
+
+static void omap_usbhs_init(struct device *dev)
+{
+       struct usbhs_hcd_omap           *omap = dev_get_drvdata(dev);
+       struct usbhs_omap_platform_data *pdata = &omap->platdata;
+       unsigned long                   flags;
+       unsigned                        reg;
+
+       dev_dbg(dev, "starting TI HSUSB Controller\n");
+
+       pm_runtime_get_sync(dev);
+       spin_lock_irqsave(&omap->lock, flags);
 
        if (pdata->ehci_data->phy_reset) {
                if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) {
@@ -736,50 +524,6 @@ static int usbhs_enable(struct device *dev)
        omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
        dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
 
-       /* perform TLL soft reset, and wait until reset is complete */
-       usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
-                       OMAP_USBTLL_SYSCONFIG_SOFTRESET);
-
-       /* Wait for TLL reset to complete */
-       timeout = jiffies + msecs_to_jiffies(1000);
-       while (!(usbhs_read(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
-                       & OMAP_USBTLL_SYSSTATUS_RESETDONE)) {
-               cpu_relax();
-
-               if (time_after(jiffies, timeout)) {
-                       dev_dbg(dev, "operation timed out\n");
-                       ret = -EINVAL;
-                       goto err_tll;
-               }
-       }
-
-       dev_dbg(dev, "TLL RESET DONE\n");
-
-       /* (1<<3) = no idle mode only for initial debugging */
-       usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
-                       OMAP_USBTLL_SYSCONFIG_ENAWAKEUP |
-                       OMAP_USBTLL_SYSCONFIG_SIDLEMODE |
-                       OMAP_USBTLL_SYSCONFIG_AUTOIDLE);
-
-       /* Put UHH in NoIdle/NoStandby mode */
-       reg = usbhs_read(omap->uhh_base, OMAP_UHH_SYSCONFIG);
-       if (is_omap_usbhs_rev1(omap)) {
-               reg |= (OMAP_UHH_SYSCONFIG_ENAWAKEUP
-                               | OMAP_UHH_SYSCONFIG_SIDLEMODE
-                               | OMAP_UHH_SYSCONFIG_CACTIVITY
-                               | OMAP_UHH_SYSCONFIG_MIDLEMODE);
-               reg &= ~OMAP_UHH_SYSCONFIG_AUTOIDLE;
-
-
-       } else if (is_omap_usbhs_rev2(omap)) {
-               reg &= ~OMAP4_UHH_SYSCONFIG_IDLEMODE_CLEAR;
-               reg |= OMAP4_UHH_SYSCONFIG_NOIDLE;
-               reg &= ~OMAP4_UHH_SYSCONFIG_STDBYMODE_CLEAR;
-               reg |= OMAP4_UHH_SYSCONFIG_NOSTDBY;
-       }
-
-       usbhs_write(omap->uhh_base, OMAP_UHH_SYSCONFIG, reg);
-
        reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
        /* setup ULPI bypass and burst configurations */
        reg |= (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN
@@ -825,49 +569,6 @@ static int usbhs_enable(struct device *dev)
                reg &= ~OMAP4_P1_MODE_CLEAR;
                reg &= ~OMAP4_P2_MODE_CLEAR;
 
-               if (is_ehci_phy_mode(pdata->port_mode[0])) {
-                       ret = clk_set_parent(omap->utmi_p1_fck,
-                                               omap->xclk60mhsp1_ck);
-                       if (ret != 0) {
-                               dev_err(dev, "xclk60mhsp1_ck set parent"
-                               "failed error:%d\n", ret);
-                               goto err_tll;
-                       }
-               } else if (is_ehci_tll_mode(pdata->port_mode[0])) {
-                       ret = clk_set_parent(omap->utmi_p1_fck,
-                                               omap->init_60m_fclk);
-                       if (ret != 0) {
-                               dev_err(dev, "init_60m_fclk set parent"
-                               "failed error:%d\n", ret);
-                               goto err_tll;
-                       }
-                       clk_enable(omap->usbhost_p1_fck);
-                       clk_enable(omap->usbtll_p1_fck);
-               }
-
-               if (is_ehci_phy_mode(pdata->port_mode[1])) {
-                       ret = clk_set_parent(omap->utmi_p2_fck,
-                                               omap->xclk60mhsp2_ck);
-                       if (ret != 0) {
-                               dev_err(dev, "xclk60mhsp1_ck set parent"
-                                       "failed error:%d\n", ret);
-                               goto err_tll;
-                       }
-               } else if (is_ehci_tll_mode(pdata->port_mode[1])) {
-                       ret = clk_set_parent(omap->utmi_p2_fck,
-                                               omap->init_60m_fclk);
-                       if (ret != 0) {
-                               dev_err(dev, "init_60m_fclk set parent"
-                               "failed error:%d\n", ret);
-                               goto err_tll;
-                       }
-                       clk_enable(omap->usbhost_p2_fck);
-                       clk_enable(omap->usbtll_p2_fck);
-               }
-
-               clk_enable(omap->utmi_p1_fck);
-               clk_enable(omap->utmi_p2_fck);
-
                if (is_ehci_tll_mode(pdata->port_mode[0]) ||
                        (is_ohci_port(pdata->port_mode[0])))
                        reg |= OMAP4_P1_MODE_TLL;
@@ -913,12 +614,15 @@ static int usbhs_enable(struct device *dev)
                                (pdata->ehci_data->reset_gpio_port[1], 1);
        }
 
-end_count:
-       omap->count++;
        spin_unlock_irqrestore(&omap->lock, flags);
-       return 0;
+       pm_runtime_put_sync(dev);
+}
+
+static void omap_usbhs_deinit(struct device *dev)
+{
+       struct usbhs_hcd_omap           *omap = dev_get_drvdata(dev);
+       struct usbhs_omap_platform_data *pdata = &omap->platdata;
 
-err_tll:
        if (pdata->ehci_data->phy_reset) {
                if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
                        gpio_free(pdata->ehci_data->reset_gpio_port[0]);
@@ -926,123 +630,272 @@ err_tll:
                if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
                        gpio_free(pdata->ehci_data->reset_gpio_port[1]);
        }
-
-       clk_disable(omap->usbtll_ick);
-       clk_disable(omap->usbtll_fck);
-       clk_disable(omap->usbhost_fs_fck);
-       clk_disable(omap->usbhost_hs_fck);
-       clk_disable(omap->usbhost_ick);
-       spin_unlock_irqrestore(&omap->lock, flags);
-       return ret;
 }
 
-static void usbhs_disable(struct device *dev)
+
+/**
+ * usbhs_omap_probe - initialize TI-based HCDs
+ *
+ * Allocates basic resources for this USB host controller.
+ */
+static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 {
-       struct usbhs_hcd_omap           *omap = dev_get_drvdata(dev);
-       struct usbhs_omap_platform_data *pdata = &omap->platdata;
-       unsigned long                   flags = 0;
-       unsigned long                   timeout;
+       struct device                   *dev =  &pdev->dev;
+       struct usbhs_omap_platform_data *pdata = dev->platform_data;
+       struct usbhs_hcd_omap           *omap;
+       struct resource                 *res;
+       int                             ret = 0;
+       int                             i;
 
-       dev_dbg(dev, "stopping TI HSUSB Controller\n");
+       if (!pdata) {
+               dev_err(dev, "Missing platform data\n");
+               ret = -ENOMEM;
+               goto end_probe;
+       }
 
-       spin_lock_irqsave(&omap->lock, flags);
+       omap = kzalloc(sizeof(*omap), GFP_KERNEL);
+       if (!omap) {
+               dev_err(dev, "Memory allocation failed\n");
+               ret = -ENOMEM;
+               goto end_probe;
+       }
 
-       if (omap->count == 0)
-               goto end_disble;
+       spin_lock_init(&omap->lock);
 
-       omap->count--;
+       for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
+               omap->platdata.port_mode[i] = pdata->port_mode[i];
+
+       omap->platdata.ehci_data = pdata->ehci_data;
+       omap->platdata.ohci_data = pdata->ohci_data;
 
-       if (omap->count != 0)
-               goto end_disble;
+       pm_runtime_enable(dev);
 
-       /* Reset OMAP modules for insmod/rmmod to work */
-       usbhs_write(omap->uhh_base, OMAP_UHH_SYSCONFIG,
-                       is_omap_usbhs_rev2(omap) ?
-                       OMAP4_UHH_SYSCONFIG_SOFTRESET :
-                       OMAP_UHH_SYSCONFIG_SOFTRESET);
 
-       timeout = jiffies + msecs_to_jiffies(100);
-       while (!(usbhs_read(omap->uhh_base, OMAP_UHH_SYSSTATUS)
-                               & (1 << 0))) {
-               cpu_relax();
+       for (i = 0; i < OMAP3_HS_USB_PORTS; i++)
+               if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) ||
+                       is_ehci_hsic_mode(i)) {
+                       omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck");
+                       if (IS_ERR(omap->ehci_logic_fck)) {
+                               ret = PTR_ERR(omap->ehci_logic_fck);
+                               dev_warn(dev, "ehci_logic_fck failed:%d\n",
+                                        ret);
+                       }
+                       break;
+               }
 
-               if (time_after(jiffies, timeout))
-                       dev_dbg(dev, "operation timed out\n");
+       omap->utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
+       if (IS_ERR(omap->utmi_p1_fck)) {
+               ret = PTR_ERR(omap->utmi_p1_fck);
+               dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
+               goto err_end;
        }
 
-       while (!(usbhs_read(omap->uhh_base, OMAP_UHH_SYSSTATUS)
-                               & (1 << 1))) {
-               cpu_relax();
+       omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
+       if (IS_ERR(omap->xclk60mhsp1_ck)) {
+               ret = PTR_ERR(omap->xclk60mhsp1_ck);
+               dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
+               goto err_utmi_p1_fck;
+       }
 
-               if (time_after(jiffies, timeout))
-                       dev_dbg(dev, "operation timed out\n");
+       omap->utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk");
+       if (IS_ERR(omap->utmi_p2_fck)) {
+               ret = PTR_ERR(omap->utmi_p2_fck);
+               dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
+               goto err_xclk60mhsp1_ck;
        }
 
-       while (!(usbhs_read(omap->uhh_base, OMAP_UHH_SYSSTATUS)
-                               & (1 << 2))) {
-               cpu_relax();
+       omap->xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck");
+       if (IS_ERR(omap->xclk60mhsp2_ck)) {
+               ret = PTR_ERR(omap->xclk60mhsp2_ck);
+               dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
+               goto err_utmi_p2_fck;
+       }
 
-               if (time_after(jiffies, timeout))
-                       dev_dbg(dev, "operation timed out\n");
+       omap->usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk");
+       if (IS_ERR(omap->usbhost_p1_fck)) {
+               ret = PTR_ERR(omap->usbhost_p1_fck);
+               dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret);
+               goto err_xclk60mhsp2_ck;
        }
 
-       usbhs_write(omap->tll_base, OMAP_USBTLL_SYSCONFIG, (1 << 1));
+       omap->usbtll_p1_fck = clk_get(dev, "usb_tll_hs_usb_ch0_clk");
+       if (IS_ERR(omap->usbtll_p1_fck)) {
+               ret = PTR_ERR(omap->usbtll_p1_fck);
+               dev_err(dev, "usbtll_p1_fck failed error:%d\n", ret);
+               goto err_usbhost_p1_fck;
+       }
 
-       while (!(usbhs_read(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
-                               & (1 << 0))) {
-               cpu_relax();
+       omap->usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk");
+       if (IS_ERR(omap->usbhost_p2_fck)) {
+               ret = PTR_ERR(omap->usbhost_p2_fck);
+               dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret);
+               goto err_usbtll_p1_fck;
+       }
 
-               if (time_after(jiffies, timeout))
-                       dev_dbg(dev, "operation timed out\n");
+       omap->usbtll_p2_fck = clk_get(dev, "usb_tll_hs_usb_ch1_clk");
+       if (IS_ERR(omap->usbtll_p2_fck)) {
+               ret = PTR_ERR(omap->usbtll_p2_fck);
+               dev_err(dev, "usbtll_p2_fck failed error:%d\n", ret);
+               goto err_usbhost_p2_fck;
        }
 
-       if (is_omap_usbhs_rev2(omap)) {
-               if (is_ehci_tll_mode(pdata->port_mode[0]))
-                       clk_disable(omap->usbtll_p1_fck);
-               if (is_ehci_tll_mode(pdata->port_mode[1]))
-                       clk_disable(omap->usbtll_p2_fck);
-               clk_disable(omap->utmi_p2_fck);
-               clk_disable(omap->utmi_p1_fck);
+       omap->init_60m_fclk = clk_get(dev, "init_60m_fclk");
+       if (IS_ERR(omap->init_60m_fclk)) {
+               ret = PTR_ERR(omap->init_60m_fclk);
+               dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
+               goto err_usbtll_p2_fck;
        }
 
-       clk_disable(omap->usbtll_ick);
-       clk_disable(omap->usbtll_fck);
-       clk_disable(omap->usbhost_fs_fck);
-       clk_disable(omap->usbhost_hs_fck);
-       clk_disable(omap->usbhost_ick);
+       if (is_ehci_phy_mode(pdata->port_mode[0])) {
+               /* for OMAP3 , the clk set paretn fails */
+               ret = clk_set_parent(omap->utmi_p1_fck,
+                                       omap->xclk60mhsp1_ck);
+               if (ret != 0)
+                       dev_err(dev, "xclk60mhsp1_ck set parent"
+                               "failed error:%d\n", ret);
+       } else if (is_ehci_tll_mode(pdata->port_mode[0])) {
+               ret = clk_set_parent(omap->utmi_p1_fck,
+                                       omap->init_60m_fclk);
+               if (ret != 0)
+                       dev_err(dev, "init_60m_fclk set parent"
+                               "failed error:%d\n", ret);
+       }
 
-       /* The gpio_free migh sleep; so unlock the spinlock */
-       spin_unlock_irqrestore(&omap->lock, flags);
+       if (is_ehci_phy_mode(pdata->port_mode[1])) {
+               ret = clk_set_parent(omap->utmi_p2_fck,
+                                       omap->xclk60mhsp2_ck);
+               if (ret != 0)
+                       dev_err(dev, "xclk60mhsp2_ck set parent"
+                                       "failed error:%d\n", ret);
+       } else if (is_ehci_tll_mode(pdata->port_mode[1])) {
+               ret = clk_set_parent(omap->utmi_p2_fck,
+                                               omap->init_60m_fclk);
+               if (ret != 0)
+                       dev_err(dev, "init_60m_fclk set parent"
+                               "failed error:%d\n", ret);
+       }
 
-       if (pdata->ehci_data->phy_reset) {
-               if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
-                       gpio_free(pdata->ehci_data->reset_gpio_port[0]);
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
+       if (!res) {
+               dev_err(dev, "UHH EHCI get resource failed\n");
+               ret = -ENODEV;
+               goto err_init_60m_fclk;
+       }
 
-               if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
-                       gpio_free(pdata->ehci_data->reset_gpio_port[1]);
+       omap->uhh_base = ioremap(res->start, resource_size(res));
+       if (!omap->uhh_base) {
+               dev_err(dev, "UHH ioremap failed\n");
+               ret = -ENOMEM;
+               goto err_init_60m_fclk;
        }
-       return;
 
-end_disble:
-       spin_unlock_irqrestore(&omap->lock, flags);
-}
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
+       if (!res) {
+               dev_err(dev, "UHH EHCI get resource failed\n");
+               ret = -ENODEV;
+               goto err_tll;
+       }
 
-int omap_usbhs_enable(struct device *dev)
-{
-       return  usbhs_enable(dev->parent);
+       omap->tll_base = ioremap(res->start, resource_size(res));
+       if (!omap->tll_base) {
+               dev_err(dev, "TLL ioremap failed\n");
+               ret = -ENOMEM;
+               goto err_tll;
+       }
+
+       platform_set_drvdata(pdev, omap);
+
+       ret = omap_usbhs_alloc_children(pdev);
+       if (ret) {
+               dev_err(dev, "omap_usbhs_alloc_children failed\n");
+               goto err_alloc;
+       }
+
+       omap_usbhs_init(dev);
+
+       goto end_probe;
+
+err_alloc:
+       iounmap(omap->tll_base);
+
+err_tll:
+       iounmap(omap->uhh_base);
+
+err_init_60m_fclk:
+       clk_put(omap->init_60m_fclk);
+
+err_usbtll_p2_fck:
+       clk_put(omap->usbtll_p2_fck);
+
+err_usbhost_p2_fck:
+       clk_put(omap->usbhost_p2_fck);
+
+err_usbtll_p1_fck:
+       clk_put(omap->usbtll_p1_fck);
+
+err_usbhost_p1_fck:
+       clk_put(omap->usbhost_p1_fck);
+
+err_xclk60mhsp2_ck:
+       clk_put(omap->xclk60mhsp2_ck);
+
+err_utmi_p2_fck:
+       clk_put(omap->utmi_p2_fck);
+
+err_xclk60mhsp1_ck:
+       clk_put(omap->xclk60mhsp1_ck);
+
+err_utmi_p1_fck:
+       clk_put(omap->utmi_p1_fck);
+
+err_end:
+       clk_put(omap->ehci_logic_fck);
+       pm_runtime_disable(dev);
+       kfree(omap);
+
+end_probe:
+       return ret;
 }
-EXPORT_SYMBOL_GPL(omap_usbhs_enable);
 
-void omap_usbhs_disable(struct device *dev)
+/**
+ * usbhs_omap_remove - shutdown processing for UHH & TLL HCDs
+ * @pdev: USB Host Controller being removed
+ *
+ * Reverses the effect of usbhs_omap_probe().
+ */
+static int __devexit usbhs_omap_remove(struct platform_device *pdev)
 {
-       usbhs_disable(dev->parent);
+       struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
+
+       omap_usbhs_deinit(&pdev->dev);
+       iounmap(omap->tll_base);
+       iounmap(omap->uhh_base);
+       clk_put(omap->init_60m_fclk);
+       clk_put(omap->usbtll_p2_fck);
+       clk_put(omap->usbhost_p2_fck);
+       clk_put(omap->usbtll_p1_fck);
+       clk_put(omap->usbhost_p1_fck);
+       clk_put(omap->xclk60mhsp2_ck);
+       clk_put(omap->utmi_p2_fck);
+       clk_put(omap->xclk60mhsp1_ck);
+       clk_put(omap->utmi_p1_fck);
+       clk_put(omap->ehci_logic_fck);
+       pm_runtime_disable(&pdev->dev);
+       kfree(omap);
+
+       return 0;
 }
-EXPORT_SYMBOL_GPL(omap_usbhs_disable);
+
+static const struct dev_pm_ops usbhsomap_dev_pm_ops = {
+       .runtime_suspend        = usbhs_runtime_suspend,
+       .runtime_resume         = usbhs_runtime_resume,
+};
 
 static struct platform_driver usbhs_omap_driver = {
        .driver = {
                .name           = (char *)usbhs_driver_name,
                .owner          = THIS_MODULE,
+               .pm             = &usbhsomap_dev_pm_ops,
        },
        .remove         = __exit_p(usbhs_omap_remove),
 };
index d5fe43d53c51894ff9e861dbced02bfde10ef705..d1fb561e089d8e0ba24888d702b01ef428745b25 100644 (file)
@@ -1991,6 +1991,8 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
        if (mmc_slot(host).nonremovable)
                mmc->caps |= MMC_CAP_NONREMOVABLE;
 
+       mmc->pm_caps = mmc_slot(host).pm_caps;
+
        omap_hsmmc_conf_bus_power(host);
 
        /* Select DMA lines */
@@ -2179,13 +2181,7 @@ static int omap_hsmmc_suspend(struct device *dev)
                cancel_work_sync(&host->mmc_carddetect_work);
                ret = mmc_suspend_host(host->mmc);
 
-               if (ret == 0) {
-                       omap_hsmmc_disable_irq(host);
-                       OMAP_HSMMC_WRITE(host->base, HCTL,
-                               OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
-                       if (host->got_dbclk)
-                               clk_disable(host->dbclk);
-               } else {
+               if (ret) {
                        host->suspended = 0;
                        if (host->pdata->resume) {
                                ret = host->pdata->resume(&pdev->dev,
@@ -2194,9 +2190,20 @@ static int omap_hsmmc_suspend(struct device *dev)
                                        dev_dbg(mmc_dev(host->mmc),
                                                "Unmask interrupt failed\n");
                        }
+                       goto err;
                }
-               pm_runtime_put_sync(host->dev);
+
+               if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) {
+                       omap_hsmmc_disable_irq(host);
+                       OMAP_HSMMC_WRITE(host->base, HCTL,
+                               OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
+               }
+               if (host->got_dbclk)
+                       clk_disable(host->dbclk);
+
        }
+err:
+       pm_runtime_put_sync(host->dev);
        return ret;
 }
 
@@ -2216,7 +2223,8 @@ static int omap_hsmmc_resume(struct device *dev)
                if (host->got_dbclk)
                        clk_enable(host->dbclk);
 
-               omap_hsmmc_conf_bus_power(host);
+               if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
+                       omap_hsmmc_conf_bus_power(host);
 
                if (host->pdata->resume) {
                        ret = host->pdata->resume(&pdev->dev, host->slot_id);
index be5dde040261b748e75535e4521cc5974f946b75..94b7f287d6c52a1a0031e32726478759800a10d5 100644 (file)
@@ -10,7 +10,7 @@ obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/
 obj-$(CONFIG_NET_VENDOR_AMD) += amd/
 obj-$(CONFIG_NET_VENDOR_APPLE) += apple/
 obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/
-obj-$(CONFIG_NET_ATMEL) += cadence/
+obj-$(CONFIG_NET_CADENCE) += cadence/
 obj-$(CONFIG_NET_BFIN) += adi/
 obj-$(CONFIG_NET_VENDOR_BROADCOM) += broadcom/
 obj-$(CONFIG_NET_VENDOR_BROCADE) += brocade/
index b48378a41e492ce3df245214235c25b901a436c1..db931916da08c8ddfd26b9068a94b7dddd1bfb46 100644 (file)
@@ -5,8 +5,8 @@
 config HAVE_NET_MACB
        bool
 
-config NET_ATMEL
-       bool "Atmel devices"
+config NET_CADENCE
+       bool "Cadence devices"
        default y
        depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200)
        ---help---
@@ -21,7 +21,7 @@ config NET_ATMEL
          the remaining Atmel network card questions. If you say Y, you will be
          asked for your specific card in the following questions.
 
-if NET_ATMEL
+if NET_CADENCE
 
 config ARM_AT91_ETHER
        tristate "AT91RM9200 Ethernet support"
@@ -33,14 +33,16 @@ config ARM_AT91_ETHER
          ethernet support, then you should always answer Y to this.
 
 config MACB
-       tristate "Atmel MACB support"
+       tristate "Cadence MACB/GEM support"
        depends on HAVE_NET_MACB
        select PHYLIB
        ---help---
-         The Atmel MACB ethernet interface is found on many AT32 and AT91
-         parts. Say Y to include support for the MACB chip.
+         The Cadence MACB ethernet interface is found on many Atmel AT32 and
+         AT91 parts.  This driver also supports the Cadence GEM (Gigabit
+         Ethernet MAC found in some ARM SoC devices).  Note: the Gigabit mode
+         is not yet supported.  Say Y to include support for the MACB/GEM chip.
 
          To compile this driver as a module, choose M here: the module
          will be called macb.
 
-endif # NET_ATMEL
+endif # NET_CADENCE
index 56624d3034871c4988ddd3e4963206133eaab517..1a5b6efa0120358b39adcfcf7f9d3a1c518d78d3 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/skbuff.h>
 #include <linux/dma-mapping.h>
 #include <linux/ethtool.h>
+#include <linux/platform_data/macb.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/gfp.h>
@@ -255,8 +256,7 @@ static void enable_phyirq(struct net_device *dev)
        unsigned int dsintr, irq_number;
        int status;
 
-       irq_number = lp->board_data.phy_irq_pin;
-       if (!irq_number) {
+       if (!gpio_is_valid(lp->board_data.phy_irq_pin)) {
                /*
                 * PHY doesn't have an IRQ pin (RTL8201, DP83847, AC101L),
                 * or board does not have it connected.
@@ -265,6 +265,7 @@ static void enable_phyirq(struct net_device *dev)
                return;
        }
 
+       irq_number = lp->board_data.phy_irq_pin;
        status = request_irq(irq_number, at91ether_phy_interrupt, 0, dev->name, dev);
        if (status) {
                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)
        unsigned int dsintr;
        unsigned int irq_number;
 
-       irq_number = lp->board_data.phy_irq_pin;
-       if (!irq_number) {
+       if (!gpio_is_valid(lp->board_data.phy_irq_pin)) {
                del_timer_sync(&lp->check_timer);
                return;
        }
@@ -365,6 +365,7 @@ static void disable_phyirq(struct net_device *dev)
        disable_mdi();
        spin_unlock_irq(&lp->lock);
 
+       irq_number = lp->board_data.phy_irq_pin;
        free_irq(irq_number, dev);                      /* Free interrupt handler */
 }
 
@@ -984,7 +985,7 @@ static const struct net_device_ops at91ether_netdev_ops = {
 static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address,
                        struct platform_device *pdev, struct clk *ether_clk)
 {
-       struct at91_eth_data *board_data = pdev->dev.platform_data;
+       struct macb_platform_data *board_data = pdev->dev.platform_data;
        struct net_device *dev;
        struct at91_private *lp;
        unsigned int val;
@@ -1077,7 +1078,7 @@ static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_add
        netif_carrier_off(dev);         /* will be enabled in open() */
 
        /* If board has no PHY IRQ, use a timer to poll the PHY */
-       if (!lp->board_data.phy_irq_pin) {
+       if (!gpio_is_valid(lp->board_data.phy_irq_pin)) {
                init_timer(&lp->check_timer);
                lp->check_timer.data = (unsigned long)dev;
                lp->check_timer.function = at91ether_check_link;
@@ -1169,7 +1170,8 @@ static int __devexit at91ether_remove(struct platform_device *pdev)
        struct net_device *dev = platform_get_drvdata(pdev);
        struct at91_private *lp = netdev_priv(dev);
 
-       if (lp->board_data.phy_irq_pin >= 32)
+       if (gpio_is_valid(lp->board_data.phy_irq_pin) &&
+           lp->board_data.phy_irq_pin >= 32)
                gpio_free(lp->board_data.phy_irq_pin);
 
        unregister_netdev(dev);
@@ -1188,11 +1190,12 @@ static int at91ether_suspend(struct platform_device *pdev, pm_message_t mesg)
 {
        struct net_device *net_dev = platform_get_drvdata(pdev);
        struct at91_private *lp = netdev_priv(net_dev);
-       int phy_irq = lp->board_data.phy_irq_pin;
 
        if (netif_running(net_dev)) {
-               if (phy_irq)
+               if (gpio_is_valid(lp->board_data.phy_irq_pin)) {
+                       int phy_irq = lp->board_data.phy_irq_pin;
                        disable_irq(phy_irq);
+               }
 
                netif_stop_queue(net_dev);
                netif_device_detach(net_dev);
@@ -1206,7 +1209,6 @@ static int at91ether_resume(struct platform_device *pdev)
 {
        struct net_device *net_dev = platform_get_drvdata(pdev);
        struct at91_private *lp = netdev_priv(net_dev);
-       int phy_irq = lp->board_data.phy_irq_pin;
 
        if (netif_running(net_dev)) {
                clk_enable(lp->ether_clk);
@@ -1214,8 +1216,10 @@ static int at91ether_resume(struct platform_device *pdev)
                netif_device_attach(net_dev);
                netif_start_queue(net_dev);
 
-               if (phy_irq)
+               if (gpio_is_valid(lp->board_data.phy_irq_pin)) {
+                       int phy_irq = lp->board_data.phy_irq_pin;
                        enable_irq(phy_irq);
+               }
        }
        return 0;
 }
index 353f4dab62be492b0310ec497a1b8481d9bb63ea..3725fbb0defe541e3f1428015093797617491280 100644 (file)
@@ -85,7 +85,9 @@ struct recv_desc_bufs
 struct at91_private
 {
        struct mii_if_info mii;                 /* ethtool support */
-       struct at91_eth_data board_data;        /* board-specific configuration */
+       struct macb_platform_data board_data;   /* board-specific
+                                                * configuration (shared with
+                                                * macb for common data */
        struct clk *ether_clk;                  /* clock */
 
        /* PHY */
index a437b46e5490f8770707a5e4373c1bb4c9302fca..f3d5c65d99cf20ae57f14fc9b7dd2007d81bba85 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Atmel MACB Ethernet Controller driver
+ * Cadence MACB/GEM Ethernet Controller driver
  *
  * Copyright (C) 2004-2006 Atmel Corporation
  *
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 #include <linux/clk.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/dma-mapping.h>
+#include <linux/platform_data/macb.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
-
-#include <mach/board.h>
-#include <mach/cpu.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_net.h>
 
 #include "macb.h"
 
@@ -60,9 +62,9 @@ static void __macb_set_hwaddr(struct macb *bp)
        u16 top;
 
        bottom = cpu_to_le32(*((u32 *)bp->dev->dev_addr));
-       macb_writel(bp, SA1B, bottom);
+       macb_or_gem_writel(bp, SA1B, bottom);
        top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4)));
-       macb_writel(bp, SA1T, top);
+       macb_or_gem_writel(bp, SA1T, top);
 }
 
 static void __init macb_get_hwaddr(struct macb *bp)
@@ -71,8 +73,8 @@ static void __init macb_get_hwaddr(struct macb *bp)
        u16 top;
        u8 addr[6];
 
-       bottom = macb_readl(bp, SA1B);
-       top = macb_readl(bp, SA1T);
+       bottom = macb_or_gem_readl(bp, SA1B);
+       top = macb_or_gem_readl(bp, SA1T);
 
        addr[0] = bottom & 0xff;
        addr[1] = (bottom >> 8) & 0xff;
@@ -84,7 +86,7 @@ static void __init macb_get_hwaddr(struct macb *bp)
        if (is_valid_ether_addr(addr)) {
                memcpy(bp->dev->dev_addr, addr, sizeof(addr));
        } else {
-               dev_info(&bp->pdev->dev, "invalid hw address, using random\n");
+               netdev_info(bp->dev, "invalid hw address, using random\n");
                random_ether_addr(bp->dev->dev_addr);
        }
 }
@@ -178,11 +180,12 @@ static void macb_handle_link_change(struct net_device *dev)
 
        if (status_change) {
                if (phydev->link)
-                       printk(KERN_INFO "%s: link up (%d/%s)\n",
-                              dev->name, phydev->speed,
-                              DUPLEX_FULL == phydev->duplex ? "Full":"Half");
+                       netdev_info(dev, "link up (%d/%s)\n",
+                                   phydev->speed,
+                                   phydev->duplex == DUPLEX_FULL ?
+                                   "Full" : "Half");
                else
-                       printk(KERN_INFO "%s: link down\n", dev->name);
+                       netdev_info(dev, "link down\n");
        }
 }
 
@@ -191,25 +194,21 @@ static int macb_mii_probe(struct net_device *dev)
 {
        struct macb *bp = netdev_priv(dev);
        struct phy_device *phydev;
-       struct eth_platform_data *pdata;
        int ret;
 
        phydev = phy_find_first(bp->mii_bus);
        if (!phydev) {
-               printk (KERN_ERR "%s: no PHY found\n", dev->name);
+               netdev_err(dev, "no PHY found\n");
                return -1;
        }
 
-       pdata = bp->pdev->dev.platform_data;
        /* TODO : add pin_irq */
 
        /* attach the mac to the phy */
        ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0,
-                                pdata && pdata->is_rmii ?
-                                PHY_INTERFACE_MODE_RMII :
-                                PHY_INTERFACE_MODE_MII);
+                                bp->phy_interface);
        if (ret) {
-               printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
+               netdev_err(dev, "Could not attach to PHY\n");
                return ret;
        }
 
@@ -228,7 +227,7 @@ static int macb_mii_probe(struct net_device *dev)
 
 static int macb_mii_init(struct macb *bp)
 {
-       struct eth_platform_data *pdata;
+       struct macb_platform_data *pdata;
        int err = -ENXIO, i;
 
        /* Enable management port */
@@ -285,8 +284,8 @@ err_out:
 static void macb_update_stats(struct macb *bp)
 {
        u32 __iomem *reg = bp->regs + MACB_PFR;
-       u32 *p = &bp->hw_stats.rx_pause_frames;
-       u32 *end = &bp->hw_stats.tx_pause_frames + 1;
+       u32 *p = &bp->hw_stats.macb.rx_pause_frames;
+       u32 *end = &bp->hw_stats.macb.tx_pause_frames + 1;
 
        WARN_ON((unsigned long)(end - p - 1) != (MACB_TPF - MACB_PFR) / 4);
 
@@ -303,14 +302,13 @@ static void macb_tx(struct macb *bp)
        status = macb_readl(bp, TSR);
        macb_writel(bp, TSR, status);
 
-       dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n",
-               (unsigned long)status);
+       netdev_dbg(bp->dev, "macb_tx status = %02lx\n", (unsigned long)status);
 
        if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) {
                int i;
-               printk(KERN_ERR "%s: TX %s, resetting buffers\n",
-                       bp->dev->name, status & MACB_BIT(UND) ?
-                       "underrun" : "retry limit exceeded");
+               netdev_err(bp->dev, "TX %s, resetting buffers\n",
+                          status & MACB_BIT(UND) ?
+                          "underrun" : "retry limit exceeded");
 
                /* Transfer ongoing, disable transmitter, to avoid confusion */
                if (status & MACB_BIT(TGO))
@@ -369,8 +367,8 @@ static void macb_tx(struct macb *bp)
                if (!(bufstat & MACB_BIT(TX_USED)))
                        break;
 
-               dev_dbg(&bp->pdev->dev, "skb %u (data %p) TX complete\n",
-                       tail, skb->data);
+               netdev_dbg(bp->dev, "skb %u (data %p) TX complete\n",
+                          tail, skb->data);
                dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
                                 DMA_TO_DEVICE);
                bp->stats.tx_packets++;
@@ -395,8 +393,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
 
        len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl);
 
-       dev_dbg(&bp->pdev->dev, "macb_rx_frame frags %u - %u (len %u)\n",
-               first_frag, last_frag, len);
+       netdev_dbg(bp->dev, "macb_rx_frame frags %u - %u (len %u)\n",
+                  first_frag, last_frag, len);
 
        skb = dev_alloc_skb(len + RX_OFFSET);
        if (!skb) {
@@ -437,8 +435,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
 
        bp->stats.rx_packets++;
        bp->stats.rx_bytes += len;
-       dev_dbg(&bp->pdev->dev, "received skb of length %u, csum: %08x\n",
-               skb->len, skb->csum);
+       netdev_dbg(bp->dev, "received skb of length %u, csum: %08x\n",
+                  skb->len, skb->csum);
        netif_receive_skb(skb);
 
        return 0;
@@ -515,8 +513,8 @@ static int macb_poll(struct napi_struct *napi, int budget)
 
        work_done = 0;
 
-       dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n",
-               (unsigned long)status, budget);
+       netdev_dbg(bp->dev, "poll: status = %08lx, budget = %d\n",
+                  (unsigned long)status, budget);
 
        work_done = macb_rx(bp, budget);
        if (work_done < budget) {
@@ -565,8 +563,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
                        macb_writel(bp, IDR, MACB_RX_INT_FLAGS);
 
                        if (napi_schedule_prep(&bp->napi)) {
-                               dev_dbg(&bp->pdev->dev,
-                                       "scheduling RX softirq\n");
+                               netdev_dbg(bp->dev, "scheduling RX softirq\n");
                                __napi_schedule(&bp->napi);
                        }
                }
@@ -582,16 +579,19 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
 
                if (status & MACB_BIT(ISR_ROVR)) {
                        /* We missed at least one packet */
-                       bp->hw_stats.rx_overruns++;
+                       if (macb_is_gem(bp))
+                               bp->hw_stats.gem.rx_overruns++;
+                       else
+                               bp->hw_stats.macb.rx_overruns++;
                }
 
                if (status & MACB_BIT(HRESP)) {
                        /*
-                        * TODO: Reset the hardware, and maybe move the printk
-                        * to a lower-priority context as well (work queue?)
+                        * TODO: Reset the hardware, and maybe move the
+                        * netdev_err to a lower-priority context as well
+                        * (work queue?)
                         */
-                       printk(KERN_ERR "%s: DMA bus error: HRESP not OK\n",
-                              dev->name);
+                       netdev_err(dev, "DMA bus error: HRESP not OK\n");
                }
 
                status = macb_readl(bp, ISR);
@@ -626,16 +626,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
        unsigned long flags;
 
 #ifdef DEBUG
-       int i;
-       dev_dbg(&bp->pdev->dev,
-               "start_xmit: len %u head %p data %p tail %p end %p\n",
-               skb->len, skb->head, skb->data,
-               skb_tail_pointer(skb), skb_end_pointer(skb));
-       dev_dbg(&bp->pdev->dev,
-               "data:");
-       for (i = 0; i < 16; i++)
-               printk(" %02x", (unsigned int)skb->data[i]);
-       printk("\n");
+       netdev_dbg(bp->dev,
+                  "start_xmit: len %u head %p data %p tail %p end %p\n",
+                  skb->len, skb->head, skb->data,
+                  skb_tail_pointer(skb), skb_end_pointer(skb));
+       print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_OFFSET, 16, 1,
+                      skb->data, 16, true);
 #endif
 
        len = skb->len;
@@ -645,21 +641,20 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if (TX_BUFFS_AVAIL(bp) < 1) {
                netif_stop_queue(dev);
                spin_unlock_irqrestore(&bp->lock, flags);
-               dev_err(&bp->pdev->dev,
-                       "BUG! Tx Ring full when queue awake!\n");
-               dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n",
-                       bp->tx_head, bp->tx_tail);
+               netdev_err(bp->dev, "BUG! Tx Ring full when queue awake!\n");
+               netdev_dbg(bp->dev, "tx_head = %u, tx_tail = %u\n",
+                          bp->tx_head, bp->tx_tail);
                return NETDEV_TX_BUSY;
        }
 
        entry = bp->tx_head;
-       dev_dbg(&bp->pdev->dev, "Allocated ring entry %u\n", entry);
+       netdev_dbg(bp->dev, "Allocated ring entry %u\n", entry);
        mapping = dma_map_single(&bp->pdev->dev, skb->data,
                                 len, DMA_TO_DEVICE);
        bp->tx_skb[entry].skb = skb;
        bp->tx_skb[entry].mapping = mapping;
-       dev_dbg(&bp->pdev->dev, "Mapped skb data %p to DMA addr %08lx\n",
-               skb->data, (unsigned long)mapping);
+       netdev_dbg(bp->dev, "Mapped skb data %p to DMA addr %08lx\n",
+                  skb->data, (unsigned long)mapping);
 
        ctrl = MACB_BF(TX_FRMLEN, len);
        ctrl |= MACB_BIT(TX_LAST);
@@ -723,27 +718,27 @@ static int macb_alloc_consistent(struct macb *bp)
                                         &bp->rx_ring_dma, GFP_KERNEL);
        if (!bp->rx_ring)
                goto out_err;
-       dev_dbg(&bp->pdev->dev,
-               "Allocated RX ring of %d bytes at %08lx (mapped %p)\n",
-               size, (unsigned long)bp->rx_ring_dma, bp->rx_ring);
+       netdev_dbg(bp->dev,
+                  "Allocated RX ring of %d bytes at %08lx (mapped %p)\n",
+                  size, (unsigned long)bp->rx_ring_dma, bp->rx_ring);
 
        size = TX_RING_BYTES;
        bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
                                         &bp->tx_ring_dma, GFP_KERNEL);
        if (!bp->tx_ring)
                goto out_err;
-       dev_dbg(&bp->pdev->dev,
-               "Allocated TX ring of %d bytes at %08lx (mapped %p)\n",
-               size, (unsigned long)bp->tx_ring_dma, bp->tx_ring);
+       netdev_dbg(bp->dev,
+                  "Allocated TX ring of %d bytes at %08lx (mapped %p)\n",
+                  size, (unsigned long)bp->tx_ring_dma, bp->tx_ring);
 
        size = RX_RING_SIZE * RX_BUFFER_SIZE;
        bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size,
                                            &bp->rx_buffers_dma, GFP_KERNEL);
        if (!bp->rx_buffers)
                goto out_err;
-       dev_dbg(&bp->pdev->dev,
-               "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n",
-               size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers);
+       netdev_dbg(bp->dev,
+                  "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n",
+                  size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers);
 
        return 0;
 
@@ -797,6 +792,84 @@ static void macb_reset_hw(struct macb *bp)
        macb_readl(bp, ISR);
 }
 
+static u32 gem_mdc_clk_div(struct macb *bp)
+{
+       u32 config;
+       unsigned long pclk_hz = clk_get_rate(bp->pclk);
+
+       if (pclk_hz <= 20000000)
+               config = GEM_BF(CLK, GEM_CLK_DIV8);
+       else if (pclk_hz <= 40000000)
+               config = GEM_BF(CLK, GEM_CLK_DIV16);
+       else if (pclk_hz <= 80000000)
+               config = GEM_BF(CLK, GEM_CLK_DIV32);
+       else if (pclk_hz <= 120000000)
+               config = GEM_BF(CLK, GEM_CLK_DIV48);
+       else if (pclk_hz <= 160000000)
+               config = GEM_BF(CLK, GEM_CLK_DIV64);
+       else
+               config = GEM_BF(CLK, GEM_CLK_DIV96);
+
+       return config;
+}
+
+static u32 macb_mdc_clk_div(struct macb *bp)
+{
+       u32 config;
+       unsigned long pclk_hz;
+
+       if (macb_is_gem(bp))
+               return gem_mdc_clk_div(bp);
+
+       pclk_hz = clk_get_rate(bp->pclk);
+       if (pclk_hz <= 20000000)
+               config = MACB_BF(CLK, MACB_CLK_DIV8);
+       else if (pclk_hz <= 40000000)
+               config = MACB_BF(CLK, MACB_CLK_DIV16);
+       else if (pclk_hz <= 80000000)
+               config = MACB_BF(CLK, MACB_CLK_DIV32);
+       else
+               config = MACB_BF(CLK, MACB_CLK_DIV64);
+
+       return config;
+}
+
+/*
+ * Get the DMA bus width field of the network configuration register that we
+ * should program.  We find the width from decoding the design configuration
+ * register to find the maximum supported data bus width.
+ */
+static u32 macb_dbw(struct macb *bp)
+{
+       if (!macb_is_gem(bp))
+               return 0;
+
+       switch (GEM_BFEXT(DBWDEF, gem_readl(bp, DCFG1))) {
+       case 4:
+               return GEM_BF(DBW, GEM_DBW128);
+       case 2:
+               return GEM_BF(DBW, GEM_DBW64);
+       case 1:
+       default:
+               return GEM_BF(DBW, GEM_DBW32);
+       }
+}
+
+/*
+ * Configure the receive DMA engine to use the correct receive buffer size.
+ * This is a configurable parameter for GEM.
+ */
+static void macb_configure_dma(struct macb *bp)
+{
+       u32 dmacfg;
+
+       if (macb_is_gem(bp)) {
+               dmacfg = gem_readl(bp, DMACFG) & ~GEM_BF(RXBS, -1L);
+               dmacfg |= GEM_BF(RXBS, RX_BUFFER_SIZE / 64);
+               gem_writel(bp, DMACFG, dmacfg);
+       }
+}
+
 static void macb_init_hw(struct macb *bp)
 {
        u32 config;
@@ -804,7 +877,7 @@ static void macb_init_hw(struct macb *bp)
        macb_reset_hw(bp);
        __macb_set_hwaddr(bp);
 
-       config = macb_readl(bp, NCFGR) & MACB_BF(CLK, -1L);
+       config = macb_mdc_clk_div(bp);
        config |= MACB_BIT(PAE);                /* PAuse Enable */
        config |= MACB_BIT(DRFCS);              /* Discard Rx FCS */
        config |= MACB_BIT(BIG);                /* Receive oversized frames */
@@ -812,8 +885,11 @@ static void macb_init_hw(struct macb *bp)
                config |= MACB_BIT(CAF);        /* Copy All Frames */
        if (!(bp->dev->flags & IFF_BROADCAST))
                config |= MACB_BIT(NBC);        /* No BroadCast */
+       config |= macb_dbw(bp);
        macb_writel(bp, NCFGR, config);
 
+       macb_configure_dma(bp);
+
        /* Initialize TX and RX buffers */
        macb_writel(bp, RBQP, bp->rx_ring_dma);
        macb_writel(bp, TBQP, bp->tx_ring_dma);
@@ -909,8 +985,8 @@ static void macb_sethashtable(struct net_device *dev)
                mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);
        }
 
-       macb_writel(bp, HRB, mc_filter[0]);
-       macb_writel(bp, HRT, mc_filter[1]);
+       macb_or_gem_writel(bp, HRB, mc_filter[0]);
+       macb_or_gem_writel(bp, HRT, mc_filter[1]);
 }
 
 /*
@@ -932,8 +1008,8 @@ static void macb_set_rx_mode(struct net_device *dev)
 
        if (dev->flags & IFF_ALLMULTI) {
                /* Enable all multicast mode */
-               macb_writel(bp, HRB, -1);
-               macb_writel(bp, HRT, -1);
+               macb_or_gem_writel(bp, HRB, -1);
+               macb_or_gem_writel(bp, HRT, -1);
                cfg |= MACB_BIT(NCFGR_MTI);
        } else if (!netdev_mc_empty(dev)) {
                /* Enable specific multicasts */
@@ -941,8 +1017,8 @@ static void macb_set_rx_mode(struct net_device *dev)
                cfg |= MACB_BIT(NCFGR_MTI);
        } else if (dev->flags & (~IFF_ALLMULTI)) {
                /* Disable all multicast mode */
-               macb_writel(bp, HRB, 0);
-               macb_writel(bp, HRT, 0);
+               macb_or_gem_writel(bp, HRB, 0);
+               macb_or_gem_writel(bp, HRT, 0);
                cfg &= ~MACB_BIT(NCFGR_MTI);
        }
 
@@ -954,7 +1030,7 @@ static int macb_open(struct net_device *dev)
        struct macb *bp = netdev_priv(dev);
        int err;
 
-       dev_dbg(&bp->pdev->dev, "open\n");
+       netdev_dbg(bp->dev, "open\n");
 
        /* if the phy is not yet register, retry later*/
        if (!bp->phy_dev)
@@ -965,9 +1041,8 @@ static int macb_open(struct net_device *dev)
 
        err = macb_alloc_consistent(bp);
        if (err) {
-               printk(KERN_ERR
-                      "%s: Unable to allocate DMA memory (error %d)\n",
-                      dev->name, err);
+               netdev_err(dev, "Unable to allocate DMA memory (error %d)\n",
+                          err);
                return err;
        }
 
@@ -1005,11 +1080,62 @@ static int macb_close(struct net_device *dev)
        return 0;
 }
 
+static void gem_update_stats(struct macb *bp)
+{
+       u32 __iomem *reg = bp->regs + GEM_OTX;
+       u32 *p = &bp->hw_stats.gem.tx_octets_31_0;
+       u32 *end = &bp->hw_stats.gem.rx_udp_checksum_errors + 1;
+
+       for (; p < end; p++, reg++)
+               *p += __raw_readl(reg);
+}
+
+static struct net_device_stats *gem_get_stats(struct macb *bp)
+{
+       struct gem_stats *hwstat = &bp->hw_stats.gem;
+       struct net_device_stats *nstat = &bp->stats;
+
+       gem_update_stats(bp);
+
+       nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors +
+                           hwstat->rx_alignment_errors +
+                           hwstat->rx_resource_errors +
+                           hwstat->rx_overruns +
+                           hwstat->rx_oversize_frames +
+                           hwstat->rx_jabbers +
+                           hwstat->rx_undersized_frames +
+                           hwstat->rx_length_field_frame_errors);
+       nstat->tx_errors = (hwstat->tx_late_collisions +
+                           hwstat->tx_excessive_collisions +
+                           hwstat->tx_underrun +
+                           hwstat->tx_carrier_sense_errors);
+       nstat->multicast = hwstat->rx_multicast_frames;
+       nstat->collisions = (hwstat->tx_single_collision_frames +
+                            hwstat->tx_multiple_collision_frames +
+                            hwstat->tx_excessive_collisions);
+       nstat->rx_length_errors = (hwstat->rx_oversize_frames +
+                                  hwstat->rx_jabbers +
+                                  hwstat->rx_undersized_frames +
+                                  hwstat->rx_length_field_frame_errors);
+       nstat->rx_over_errors = hwstat->rx_resource_errors;
+       nstat->rx_crc_errors = hwstat->rx_frame_check_sequence_errors;
+       nstat->rx_frame_errors = hwstat->rx_alignment_errors;
+       nstat->rx_fifo_errors = hwstat->rx_overruns;
+       nstat->tx_aborted_errors = hwstat->tx_excessive_collisions;
+       nstat->tx_carrier_errors = hwstat->tx_carrier_sense_errors;
+       nstat->tx_fifo_errors = hwstat->tx_underrun;
+
+       return nstat;
+}
+
 static struct net_device_stats *macb_get_stats(struct net_device *dev)
 {
        struct macb *bp = netdev_priv(dev);
        struct net_device_stats *nstat = &bp->stats;
-       struct macb_stats *hwstat = &bp->hw_stats;
+       struct macb_stats *hwstat = &bp->hw_stats.macb;
+
+       if (macb_is_gem(bp))
+               return gem_get_stats(bp);
 
        /* read stats from hardware */
        macb_update_stats(bp);
@@ -1117,14 +1243,59 @@ static const struct net_device_ops macb_netdev_ops = {
 #endif
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id macb_dt_ids[] = {
+       { .compatible = "cdns,at32ap7000-macb" },
+       { .compatible = "cdns,at91sam9260-macb" },
+       { .compatible = "cdns,macb" },
+       { .compatible = "cdns,pc302-gem" },
+       { .compatible = "cdns,gem" },
+       { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, macb_dt_ids);
+
+static int __devinit macb_get_phy_mode_dt(struct platform_device *pdev)
+{
+       struct device_node *np = pdev->dev.of_node;
+
+       if (np)
+               return of_get_phy_mode(np);
+
+       return -ENODEV;
+}
+
+static int __devinit macb_get_hwaddr_dt(struct macb *bp)
+{
+       struct device_node *np = bp->pdev->dev.of_node;
+       if (np) {
+               const char *mac = of_get_mac_address(np);
+               if (mac) {
+                       memcpy(bp->dev->dev_addr, mac, ETH_ALEN);
+                       return 0;
+               }
+       }
+
+       return -ENODEV;
+}
+#else
+static int __devinit macb_get_phy_mode_dt(struct platform_device *pdev)
+{
+       return -ENODEV;
+}
+static int __devinit macb_get_hwaddr_dt(struct macb *bp)
+{
+       return -ENODEV;
+}
+#endif
+
 static int __init macb_probe(struct platform_device *pdev)
 {
-       struct eth_platform_data *pdata;
+       struct macb_platform_data *pdata;
        struct resource *regs;
        struct net_device *dev;
        struct macb *bp;
        struct phy_device *phydev;
-       unsigned long pclk_hz;
        u32 config;
        int err = -ENXIO;
 
@@ -1152,28 +1323,19 @@ static int __init macb_probe(struct platform_device *pdev)
 
        spin_lock_init(&bp->lock);
 
-#if defined(CONFIG_ARCH_AT91)
-       bp->pclk = clk_get(&pdev->dev, "macb_clk");
+       bp->pclk = clk_get(&pdev->dev, "pclk");
        if (IS_ERR(bp->pclk)) {
                dev_err(&pdev->dev, "failed to get macb_clk\n");
                goto err_out_free_dev;
        }
        clk_enable(bp->pclk);
-#else
-       bp->pclk = clk_get(&pdev->dev, "pclk");
-       if (IS_ERR(bp->pclk)) {
-               dev_err(&pdev->dev, "failed to get pclk\n");
-               goto err_out_free_dev;
-       }
+
        bp->hclk = clk_get(&pdev->dev, "hclk");
        if (IS_ERR(bp->hclk)) {
                dev_err(&pdev->dev, "failed to get hclk\n");
                goto err_out_put_pclk;
        }
-
-       clk_enable(bp->pclk);
        clk_enable(bp->hclk);
-#endif
 
        bp->regs = ioremap(regs->start, resource_size(regs));
        if (!bp->regs) {
@@ -1185,9 +1347,8 @@ static int __init macb_probe(struct platform_device *pdev)
        dev->irq = platform_get_irq(pdev, 0);
        err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev);
        if (err) {
-               printk(KERN_ERR
-                      "%s: Unable to request IRQ %d (error %d)\n",
-                      dev->name, dev->irq, err);
+               dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
+                       dev->irq, err);
                goto err_out_iounmap;
        }
 
@@ -1198,31 +1359,37 @@ static int __init macb_probe(struct platform_device *pdev)
        dev->base_addr = regs->start;
 
        /* Set MII management clock divider */
-       pclk_hz = clk_get_rate(bp->pclk);
-       if (pclk_hz <= 20000000)
-               config = MACB_BF(CLK, MACB_CLK_DIV8);
-       else if (pclk_hz <= 40000000)
-               config = MACB_BF(CLK, MACB_CLK_DIV16);
-       else if (pclk_hz <= 80000000)
-               config = MACB_BF(CLK, MACB_CLK_DIV32);
-       else
-               config = MACB_BF(CLK, MACB_CLK_DIV64);
+       config = macb_mdc_clk_div(bp);
+       config |= macb_dbw(bp);
        macb_writel(bp, NCFGR, config);
 
-       macb_get_hwaddr(bp);
-       pdata = pdev->dev.platform_data;
+       err = macb_get_hwaddr_dt(bp);
+       if (err < 0)
+               macb_get_hwaddr(bp);
+
+       err = macb_get_phy_mode_dt(pdev);
+       if (err < 0) {
+               pdata = pdev->dev.platform_data;
+               if (pdata && pdata->is_rmii)
+                       bp->phy_interface = PHY_INTERFACE_MODE_RMII;
+               else
+                       bp->phy_interface = PHY_INTERFACE_MODE_MII;
+       } else {
+               bp->phy_interface = err;
+       }
 
-       if (pdata && pdata->is_rmii)
+       if (bp->phy_interface == PHY_INTERFACE_MODE_RMII)
 #if defined(CONFIG_ARCH_AT91)
-               macb_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN)) );
+               macb_or_gem_writel(bp, USRIO, (MACB_BIT(RMII) |
+                                              MACB_BIT(CLKEN)));
 #else
-               macb_writel(bp, USRIO, 0);
+               macb_or_gem_writel(bp, USRIO, 0);
 #endif
        else
 #if defined(CONFIG_ARCH_AT91)
-               macb_writel(bp, USRIO, MACB_BIT(CLKEN));
+               macb_or_gem_writel(bp, USRIO, MACB_BIT(CLKEN));
 #else
-               macb_writel(bp, USRIO, MACB_BIT(MII));
+               macb_or_gem_writel(bp, USRIO, MACB_BIT(MII));
 #endif
 
        bp->tx_pending = DEF_TX_RING_PENDING;
@@ -1239,13 +1406,13 @@ static int __init macb_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, dev);
 
-       printk(KERN_INFO "%s: Atmel MACB at 0x%08lx irq %d (%pM)\n",
-              dev->name, dev->base_addr, dev->irq, dev->dev_addr);
+       netdev_info(dev, "Cadence %s at 0x%08lx irq %d (%pM)\n",
+                   macb_is_gem(bp) ? "GEM" : "MACB", dev->base_addr,
+                   dev->irq, dev->dev_addr);
 
        phydev = bp->phy_dev;
-       printk(KERN_INFO "%s: attached PHY driver [%s] "
-               "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
-               phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
+       netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
+                   phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
 
        return 0;
 
@@ -1256,14 +1423,10 @@ err_out_free_irq:
 err_out_iounmap:
        iounmap(bp->regs);
 err_out_disable_clocks:
-#ifndef CONFIG_ARCH_AT91
        clk_disable(bp->hclk);
        clk_put(bp->hclk);
-#endif
        clk_disable(bp->pclk);
-#ifndef CONFIG_ARCH_AT91
 err_out_put_pclk:
-#endif
        clk_put(bp->pclk);
 err_out_free_dev:
        free_netdev(dev);
@@ -1289,10 +1452,8 @@ static int __exit macb_remove(struct platform_device *pdev)
                unregister_netdev(dev);
                free_irq(dev->irq, dev);
                iounmap(bp->regs);
-#ifndef CONFIG_ARCH_AT91
                clk_disable(bp->hclk);
                clk_put(bp->hclk);
-#endif
                clk_disable(bp->pclk);
                clk_put(bp->pclk);
                free_netdev(dev);
@@ -1310,9 +1471,7 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state)
 
        netif_device_detach(netdev);
 
-#ifndef CONFIG_ARCH_AT91
        clk_disable(bp->hclk);
-#endif
        clk_disable(bp->pclk);
 
        return 0;
@@ -1324,9 +1483,7 @@ static int macb_resume(struct platform_device *pdev)
        struct macb *bp = netdev_priv(netdev);
 
        clk_enable(bp->pclk);
-#ifndef CONFIG_ARCH_AT91
        clk_enable(bp->hclk);
-#endif
 
        netif_device_attach(netdev);
 
@@ -1344,6 +1501,7 @@ static struct platform_driver macb_driver = {
        .driver         = {
                .name           = "macb",
                .owner  = THIS_MODULE,
+               .of_match_table = of_match_ptr(macb_dt_ids),
        },
 };
 
@@ -1361,6 +1519,6 @@ module_init(macb_init);
 module_exit(macb_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Atmel MACB Ethernet driver");
+MODULE_DESCRIPTION("Cadence MACB/GEM Ethernet driver");
 MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");
 MODULE_ALIAS("platform:macb");
index d3212f6db70325a53917b380e4f4ab05f8abd9b4..335e288f53140159e2f1956a716713b69c03933a 100644 (file)
 #define MACB_TPQ                               0x00bc
 #define MACB_USRIO                             0x00c0
 #define MACB_WOL                               0x00c4
+#define MACB_MID                               0x00fc
+
+/* GEM register offsets. */
+#define GEM_NCFGR                              0x0004
+#define GEM_USRIO                              0x000c
+#define GEM_DMACFG                             0x0010
+#define GEM_HRB                                        0x0080
+#define GEM_HRT                                        0x0084
+#define GEM_SA1B                               0x0088
+#define GEM_SA1T                               0x008C
+#define GEM_OTX                                        0x0100
+#define GEM_DCFG1                              0x0280
+#define GEM_DCFG2                              0x0284
+#define GEM_DCFG3                              0x0288
+#define GEM_DCFG4                              0x028c
+#define GEM_DCFG5                              0x0290
+#define GEM_DCFG6                              0x0294
+#define GEM_DCFG7                              0x0298
 
 /* Bitfields in NCR */
 #define MACB_LB_OFFSET                         0
 #define MACB_IRXFCS_OFFSET                     19
 #define MACB_IRXFCS_SIZE                       1
 
+/* GEM specific NCFGR bitfields. */
+#define GEM_CLK_OFFSET                         18
+#define GEM_CLK_SIZE                           3
+#define GEM_DBW_OFFSET                         21
+#define GEM_DBW_SIZE                           2
+
+/* Constants for data bus width. */
+#define GEM_DBW32                              0
+#define GEM_DBW64                              1
+#define GEM_DBW128                             2
+
+/* Bitfields in DMACFG. */
+#define GEM_RXBS_OFFSET                                16
+#define GEM_RXBS_SIZE                          8
+
 /* Bitfields in NSR */
 #define MACB_NSR_LINK_OFFSET                   0
 #define MACB_NSR_LINK_SIZE                     1
 #define MACB_WOL_MTI_OFFSET                    19
 #define MACB_WOL_MTI_SIZE                      1
 
+/* Bitfields in MID */
+#define MACB_IDNUM_OFFSET                      16
+#define MACB_IDNUM_SIZE                                16
+#define MACB_REV_OFFSET                                0
+#define MACB_REV_SIZE                          16
+
+/* Bitfields in DCFG1. */
+#define GEM_DBWDEF_OFFSET                      25
+#define GEM_DBWDEF_SIZE                                3
+
 /* Constants for CLK */
 #define MACB_CLK_DIV8                          0
 #define MACB_CLK_DIV16                         1
 #define MACB_CLK_DIV32                         2
 #define MACB_CLK_DIV64                         3
 
+/* GEM specific constants for CLK. */
+#define GEM_CLK_DIV8                           0
+#define GEM_CLK_DIV16                          1
+#define GEM_CLK_DIV32                          2
+#define GEM_CLK_DIV48                          3
+#define GEM_CLK_DIV64                          4
+#define GEM_CLK_DIV96                          5
+
 /* Constants for MAN register */
 #define MACB_MAN_SOF                           1
 #define MACB_MAN_WRITE                         1
                    << MACB_##name##_OFFSET))           \
         | MACB_BF(name,value))
 
+#define GEM_BIT(name)                                  \
+       (1 << GEM_##name##_OFFSET)
+#define GEM_BF(name, value)                            \
+       (((value) & ((1 << GEM_##name##_SIZE) - 1))     \
+        << GEM_##name##_OFFSET)
+#define GEM_BFEXT(name, value)\
+       (((value) >> GEM_##name##_OFFSET)               \
+        & ((1 << GEM_##name##_SIZE) - 1))
+#define GEM_BFINS(name, value, old)                    \
+       (((old) & ~(((1 << GEM_##name##_SIZE) - 1)      \
+                   << GEM_##name##_OFFSET))            \
+        | GEM_BF(name, value))
+
 /* Register access macros */
 #define macb_readl(port,reg)                           \
        __raw_readl((port)->regs + MACB_##reg)
 #define macb_writel(port,reg,value)                    \
        __raw_writel((value), (port)->regs + MACB_##reg)
+#define gem_readl(port, reg)                           \
+       __raw_readl((port)->regs + GEM_##reg)
+#define gem_writel(port, reg, value)                   \
+       __raw_writel((value), (port)->regs + GEM_##reg)
+
+/*
+ * Conditional GEM/MACB macros.  These perform the operation to the correct
+ * register dependent on whether the device is a GEM or a MACB.  For registers
+ * and bitfields that are common across both devices, use macb_{read,write}l
+ * to avoid the cost of the conditional.
+ */
+#define macb_or_gem_writel(__bp, __reg, __value) \
+       ({ \
+               if (macb_is_gem((__bp))) \
+                       gem_writel((__bp), __reg, __value); \
+               else \
+                       macb_writel((__bp), __reg, __value); \
+       })
+
+#define macb_or_gem_readl(__bp, __reg) \
+       ({ \
+               u32 __v; \
+               if (macb_is_gem((__bp))) \
+                       __v = gem_readl((__bp), __reg); \
+               else \
+                       __v = macb_readl((__bp), __reg); \
+               __v; \
+       })
 
 struct dma_desc {
        u32     addr;
@@ -358,6 +450,54 @@ struct macb_stats {
        u32     tx_pause_frames;
 };
 
+struct gem_stats {
+       u32     tx_octets_31_0;
+       u32     tx_octets_47_32;
+       u32     tx_frames;
+       u32     tx_broadcast_frames;
+       u32     tx_multicast_frames;
+       u32     tx_pause_frames;
+       u32     tx_64_byte_frames;
+       u32     tx_65_127_byte_frames;
+       u32     tx_128_255_byte_frames;
+       u32     tx_256_511_byte_frames;
+       u32     tx_512_1023_byte_frames;
+       u32     tx_1024_1518_byte_frames;
+       u32     tx_greater_than_1518_byte_frames;
+       u32     tx_underrun;
+       u32     tx_single_collision_frames;
+       u32     tx_multiple_collision_frames;
+       u32     tx_excessive_collisions;
+       u32     tx_late_collisions;
+       u32     tx_deferred_frames;
+       u32     tx_carrier_sense_errors;
+       u32     rx_octets_31_0;
+       u32     rx_octets_47_32;
+       u32     rx_frames;
+       u32     rx_broadcast_frames;
+       u32     rx_multicast_frames;
+       u32     rx_pause_frames;
+       u32     rx_64_byte_frames;
+       u32     rx_65_127_byte_frames;
+       u32     rx_128_255_byte_frames;
+       u32     rx_256_511_byte_frames;
+       u32     rx_512_1023_byte_frames;
+       u32     rx_1024_1518_byte_frames;
+       u32     rx_greater_than_1518_byte_frames;
+       u32     rx_undersized_frames;
+       u32     rx_oversize_frames;
+       u32     rx_jabbers;
+       u32     rx_frame_check_sequence_errors;
+       u32     rx_length_field_frame_errors;
+       u32     rx_symbol_errors;
+       u32     rx_alignment_errors;
+       u32     rx_resource_errors;
+       u32     rx_overruns;
+       u32     rx_ip_header_checksum_errors;
+       u32     rx_tcp_checksum_errors;
+       u32     rx_udp_checksum_errors;
+};
+
 struct macb {
        void __iomem            *regs;
 
@@ -376,7 +516,10 @@ struct macb {
        struct net_device       *dev;
        struct napi_struct      napi;
        struct net_device_stats stats;
-       struct macb_stats       hw_stats;
+       union {
+               struct macb_stats       macb;
+               struct gem_stats        gem;
+       }                       hw_stats;
 
        dma_addr_t              rx_ring_dma;
        dma_addr_t              tx_ring_dma;
@@ -389,6 +532,13 @@ struct macb {
        unsigned int            link;
        unsigned int            speed;
        unsigned int            duplex;
+
+       phy_interface_t         phy_interface;
 };
 
+static inline bool macb_is_gem(struct macb *bp)
+{
+       return MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2;
+}
+
 #endif /* _MACB_H */
index 0b4f946cf13aa6126f9b55a371cd9279fe5a8c3e..31ab6ddf52c932c1791e87a874a2c6ace211e073 100644 (file)
@@ -16,8 +16,6 @@
 #include <linux/gpio.h>
 #include <linux/export.h>
 
-#include <asm/mach-types.h>
-
 #include "soc_common.h"
 
 #define GPIO_PCMCIA_SKTSEL     (54)
 #define GPIO_PCMCIA_S1_RDYINT  (8)
 #define GPIO_PCMCIA_RESET      (9)
 
-#define PCMCIA_S0_CD_VALID     IRQ_GPIO(GPIO_PCMCIA_S0_CD_VALID)
-#define PCMCIA_S1_CD_VALID     IRQ_GPIO(GPIO_PCMCIA_S1_CD_VALID)
-#define PCMCIA_S0_RDYINT       IRQ_GPIO(GPIO_PCMCIA_S0_RDYINT)
-#define PCMCIA_S1_RDYINT       IRQ_GPIO(GPIO_PCMCIA_S1_RDYINT)
+#define PCMCIA_S0_CD_VALID     gpio_to_irq(GPIO_PCMCIA_S0_CD_VALID)
+#define PCMCIA_S1_CD_VALID     gpio_to_irq(GPIO_PCMCIA_S1_CD_VALID)
+#define PCMCIA_S0_RDYINT       gpio_to_irq(GPIO_PCMCIA_S0_RDYINT)
+#define PCMCIA_S1_RDYINT       gpio_to_irq(GPIO_PCMCIA_S1_RDYINT)
 
 
 static struct pcmcia_irqs irqs[] = {
-       { 0, PCMCIA_S0_CD_VALID, "PCMCIA0 CD" },
-       { 1, PCMCIA_S1_CD_VALID, "PCMCIA1 CD" },
+       { .sock = 0, .str = "PCMCIA0 CD" },
+       { .sock = 1, .str = "PCMCIA1 CD" },
 };
 
 static 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)
        gpio_direction_output(GPIO_PCMCIA_RESET, 0);
 
        skt->socket.pci_irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT;
+       irqs[0].irq = PCMCIA_S0_CD_VALID;
+       irqs[1].irq = PCMCIA_S1_CD_VALID;
        ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
        if (!ret)
                gpio_free(GPIO_PCMCIA_RESET);
index 923f315926ef478dc4793924f7349074baed8d5a..3dc7621a076701a843fe0722d0340db703830fa8 100644 (file)
 #include <linux/gpio.h>
 #include <linux/export.h>
 
-#include <asm/mach-types.h>
-
 #include "soc_common.h"
 
 #define GPIO_PCMCIA_S0_CD_VALID        (84)
 #define GPIO_PCMCIA_S0_RDYINT  (82)
 #define GPIO_PCMCIA_RESET      (53)
 
-#define PCMCIA_S0_CD_VALID     IRQ_GPIO(GPIO_PCMCIA_S0_CD_VALID)
-#define PCMCIA_S0_RDYINT       IRQ_GPIO(GPIO_PCMCIA_S0_RDYINT)
+#define PCMCIA_S0_CD_VALID     gpio_to_irq(GPIO_PCMCIA_S0_CD_VALID)
+#define PCMCIA_S0_RDYINT       gpio_to_irq(GPIO_PCMCIA_S0_RDYINT)
 
 
 static struct pcmcia_irqs irqs[] = {
-       { 0, PCMCIA_S0_CD_VALID, "PCMCIA0 CD" },
+       { .sock = 0, .str = "PCMCIA0 CD" },
 };
 
 static 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)
        gpio_direction_output(GPIO_PCMCIA_RESET, 0);
 
        skt->socket.pci_irq = PCMCIA_S0_RDYINT;
+       irqs[0].irq = PCMCIA_S0_CD_VALID;
        ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
        if (!ret)
                gpio_free(GPIO_PCMCIA_RESET);
index 791f11bed6063b6fec2ffa4ab78fc4177f70b509..75823a1abeb66bebdf58f41de4cecbc7048ce0be 100644 (file)
@@ -48,6 +48,7 @@ config USB_ARCH_HAS_OHCI
        default y if ARCH_DAVINCI_DA8XX
        default y if ARCH_CNS3XXX
        default y if PLAT_SPEAR
+       default y if ARCH_EXYNOS
        # PPC:
        default y if STB03xxx
        default y if PPC_MPC52xx
index 060e0e2b1ae62330d5fb0c77540eeded603bd161..eea85dc168261816cab3439390af301b774b066f 100644 (file)
@@ -371,6 +371,12 @@ config USB_OHCI_SH
          Enables support for the on-chip OHCI controller on the SuperH.
          If you use the PCI OHCI controller, this option is not necessary.
 
+config USB_OHCI_EXYNOS
+       boolean "OHCI support for Samsung EXYNOS SoC Series"
+       depends on USB_OHCI_HCD && ARCH_EXYNOS
+       help
+        Enable support for the Samsung Exynos SOC's on-chip OHCI controller.
+
 config USB_CNS3XXX_OHCI
        bool "Cavium CNS3XXX OHCI Module"
        depends on USB_OHCI_HCD && ARCH_CNS3XXX
index e39b0297bad1806a2e2cb49e2a5047e026847dc6..568cefbd63a2a58bbd787141e2294ff1d7805ba7 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/usb/ulpi.h>
 #include <plat/usb.h>
 #include <linux/regulator/consumer.h>
+#include <linux/pm_runtime.h>
 
 /* EHCI Register Set */
 #define EHCI_INSNREG04                                 (0xA0)
@@ -190,11 +191,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
                }
        }
 
-       ret = omap_usbhs_enable(dev);
-       if (ret) {
-               dev_err(dev, "failed to start usbhs with err %d\n", ret);
-               goto err_enable;
-       }
+       pm_runtime_enable(dev);
+       pm_runtime_get_sync(dev);
 
        /*
         * An undocumented "feature" in the OMAP3 EHCI controller,
@@ -240,11 +238,8 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
        return 0;
 
 err_add_hcd:
-       omap_usbhs_disable(dev);
-
-err_enable:
        disable_put_regulator(pdata);
-       usb_put_hcd(hcd);
+       pm_runtime_put_sync(dev);
 
 err_io:
        iounmap(regs);
@@ -266,10 +261,12 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
        struct usb_hcd *hcd     = dev_get_drvdata(dev);
 
        usb_remove_hcd(hcd);
-       omap_usbhs_disable(dev);
        disable_put_regulator(dev->platform_data);
        iounmap(hcd->regs);
        usb_put_hcd(hcd);
+       pm_runtime_put_sync(dev);
+       pm_runtime_disable(dev);
+
        return 0;
 }
 
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
new file mode 100644 (file)
index 0000000..55aa35a
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+ * SAMSUNG EXYNOS USB HOST OHCI Controller
+ *
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * Author: Jingoo Han <jg1.han@samsung.com>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/platform_device.h>
+#include <mach/ohci.h>
+#include <plat/usb-phy.h>
+
+struct exynos_ohci_hcd {
+       struct device *dev;
+       struct usb_hcd *hcd;
+       struct clk *clk;
+};
+
+static int ohci_exynos_start(struct usb_hcd *hcd)
+{
+       struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+       int ret;
+
+       ohci_dbg(ohci, "ohci_exynos_start, ohci:%p", ohci);
+
+       ret = ohci_init(ohci);
+       if (ret < 0)
+               return ret;
+
+       ret = ohci_run(ohci);
+       if (ret < 0) {
+               err("can't start %s", hcd->self.bus_name);
+               ohci_stop(hcd);
+               return ret;
+       }
+
+       return 0;
+}
+
+static const struct hc_driver exynos_ohci_hc_driver = {
+       .description            = hcd_name,
+       .product_desc           = "EXYNOS OHCI Host Controller",
+       .hcd_priv_size          = sizeof(struct ohci_hcd),
+
+       .irq                    = ohci_irq,
+       .flags                  = HCD_MEMORY|HCD_USB11,
+
+       .start                  = ohci_exynos_start,
+       .stop                   = ohci_stop,
+       .shutdown               = ohci_shutdown,
+
+       .get_frame_number       = ohci_get_frame,
+
+       .urb_enqueue            = ohci_urb_enqueue,
+       .urb_dequeue            = ohci_urb_dequeue,
+       .endpoint_disable       = ohci_endpoint_disable,
+
+       .hub_status_data        = ohci_hub_status_data,
+       .hub_control            = ohci_hub_control,
+#ifdef CONFIG_PM
+       .bus_suspend            = ohci_bus_suspend,
+       .bus_resume             = ohci_bus_resume,
+#endif
+       .start_port_reset       = ohci_start_port_reset,
+};
+
+static int __devinit exynos_ohci_probe(struct platform_device *pdev)
+{
+       struct exynos4_ohci_platdata *pdata;
+       struct exynos_ohci_hcd *exynos_ohci;
+       struct usb_hcd *hcd;
+       struct ohci_hcd *ohci;
+       struct resource *res;
+       int irq;
+       int err;
+
+       pdata = pdev->dev.platform_data;
+       if (!pdata) {
+               dev_err(&pdev->dev, "No platform data defined\n");
+               return -EINVAL;
+       }
+
+       exynos_ohci = kzalloc(sizeof(struct exynos_ohci_hcd), GFP_KERNEL);
+       if (!exynos_ohci)
+               return -ENOMEM;
+
+       exynos_ohci->dev = &pdev->dev;
+
+       hcd = usb_create_hcd(&exynos_ohci_hc_driver, &pdev->dev,
+                                       dev_name(&pdev->dev));
+       if (!hcd) {
+               dev_err(&pdev->dev, "Unable to create HCD\n");
+               err = -ENOMEM;
+               goto fail_hcd;
+       }
+
+       exynos_ohci->hcd = hcd;
+       exynos_ohci->clk = clk_get(&pdev->dev, "usbhost");
+
+       if (IS_ERR(exynos_ohci->clk)) {
+               dev_err(&pdev->dev, "Failed to get usbhost clock\n");
+               err = PTR_ERR(exynos_ohci->clk);
+               goto fail_clk;
+       }
+
+       err = clk_enable(exynos_ohci->clk);
+       if (err)
+               goto fail_clken;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!res) {
+               dev_err(&pdev->dev, "Failed to get I/O memory\n");
+               err = -ENXIO;
+               goto fail_io;
+       }
+
+       hcd->rsrc_start = res->start;
+       hcd->rsrc_len = resource_size(res);
+       hcd->regs = ioremap(res->start, resource_size(res));
+       if (!hcd->regs) {
+               dev_err(&pdev->dev, "Failed to remap I/O memory\n");
+               err = -ENOMEM;
+               goto fail_io;
+       }
+
+       irq = platform_get_irq(pdev, 0);
+       if (!irq) {
+               dev_err(&pdev->dev, "Failed to get IRQ\n");
+               err = -ENODEV;
+               goto fail;
+       }
+
+       if (pdata->phy_init)
+               pdata->phy_init(pdev, S5P_USB_PHY_HOST);
+
+       ohci = hcd_to_ohci(hcd);
+       ohci_hcd_init(ohci);
+
+       err = usb_add_hcd(hcd, irq, IRQF_SHARED);
+       if (err) {
+               dev_err(&pdev->dev, "Failed to add USB HCD\n");
+               goto fail;
+       }
+
+       platform_set_drvdata(pdev, exynos_ohci);
+
+       return 0;
+
+fail:
+       iounmap(hcd->regs);
+fail_io:
+       clk_disable(exynos_ohci->clk);
+fail_clken:
+       clk_put(exynos_ohci->clk);
+fail_clk:
+       usb_put_hcd(hcd);
+fail_hcd:
+       kfree(exynos_ohci);
+       return err;
+}
+
+static int __devexit exynos_ohci_remove(struct platform_device *pdev)
+{
+       struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data;
+       struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev);
+       struct usb_hcd *hcd = exynos_ohci->hcd;
+
+       usb_remove_hcd(hcd);
+
+       if (pdata && pdata->phy_exit)
+               pdata->phy_exit(pdev, S5P_USB_PHY_HOST);
+
+       iounmap(hcd->regs);
+
+       clk_disable(exynos_ohci->clk);
+       clk_put(exynos_ohci->clk);
+
+       usb_put_hcd(hcd);
+       kfree(exynos_ohci);
+
+       return 0;
+}
+
+static void exynos_ohci_shutdown(struct platform_device *pdev)
+{
+       struct exynos_ohci_hcd *exynos_ohci = platform_get_drvdata(pdev);
+       struct usb_hcd *hcd = exynos_ohci->hcd;
+
+       if (hcd->driver->shutdown)
+               hcd->driver->shutdown(hcd);
+}
+
+#ifdef CONFIG_PM
+static int exynos_ohci_suspend(struct device *dev)
+{
+       struct exynos_ohci_hcd *exynos_ohci = dev_get_drvdata(dev);
+       struct usb_hcd *hcd = exynos_ohci->hcd;
+       struct ohci_hcd *ohci = hcd_to_ohci(hcd);
+       struct platform_device *pdev = to_platform_device(dev);
+       struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data;
+       unsigned long flags;
+       int rc = 0;
+
+       /*
+        * Root hub was already suspended. Disable irq emission and
+        * mark HW unaccessible, bail out if RH has been resumed. Use
+        * the spinlock to properly synchronize with possible pending
+        * RH suspend or resume activity.
+        *
+        * This is still racy as hcd->state is manipulated outside of
+        * any locks =P But that will be a different fix.
+        */
+       spin_lock_irqsave(&ohci->lock, flags);
+       if (hcd->state != HC_STATE_SUSPENDED && hcd->state != HC_STATE_HALT) {
+               rc = -EINVAL;
+               goto fail;
+       }
+
+       clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+
+       if (pdata && pdata->phy_exit)
+               pdata->phy_exit(pdev, S5P_USB_PHY_HOST);
+fail:
+       spin_unlock_irqrestore(&ohci->lock, flags);
+
+       return rc;
+}
+
+static int exynos_ohci_resume(struct device *dev)
+{
+       struct exynos_ohci_hcd *exynos_ohci = dev_get_drvdata(dev);
+       struct usb_hcd *hcd = exynos_ohci->hcd;
+       struct platform_device *pdev = to_platform_device(dev);
+       struct exynos4_ohci_platdata *pdata = pdev->dev.platform_data;
+
+       if (pdata && pdata->phy_init)
+               pdata->phy_init(pdev, S5P_USB_PHY_HOST);
+
+       /* Mark hardware accessible again as we are out of D3 state by now */
+       set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+
+       ohci_finish_controller_resume(hcd);
+
+       return 0;
+}
+#else
+#define exynos_ohci_suspend    NULL
+#define exynos_ohci_resume     NULL
+#endif
+
+static const struct dev_pm_ops exynos_ohci_pm_ops = {
+       .suspend        = exynos_ohci_suspend,
+       .resume         = exynos_ohci_resume,
+};
+
+static struct platform_driver exynos_ohci_driver = {
+       .probe          = exynos_ohci_probe,
+       .remove         = __devexit_p(exynos_ohci_remove),
+       .shutdown       = exynos_ohci_shutdown,
+       .driver = {
+               .name   = "exynos-ohci",
+               .owner  = THIS_MODULE,
+               .pm     = &exynos_ohci_pm_ops,
+       }
+};
+
+MODULE_ALIAS("platform:exynos-ohci");
+MODULE_AUTHOR("Jingoo Han <jg1.han@samsung.com>");
index b2639191549e88172e803281a6c53300bd103b67..a1006ff793842d2d0dc4de1be50e20ff1328a806 100644 (file)
@@ -1005,6 +1005,11 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER                ohci_hcd_s3c2410_driver
 #endif
 
+#ifdef CONFIG_USB_OHCI_EXYNOS
+#include "ohci-exynos.c"
+#define PLATFORM_DRIVER                exynos_ohci_driver
+#endif
+
 #ifdef CONFIG_USB_OHCI_HCD_OMAP1
 #include "ohci-omap.c"
 #define OMAP1_PLATFORM_DRIVER  ohci_hcd_omap_driver
index 516ebc4d6cc29a820c13d3ee4578d3c6e49c2ad8..1b8133b6e451a7a30965eae265a4106c3050521f 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <linux/platform_device.h>
 #include <plat/usb.h>
+#include <linux/pm_runtime.h>
 
 /*-------------------------------------------------------------------------*/
 
@@ -134,7 +135,7 @@ static int __devinit ohci_hcd_omap3_probe(struct platform_device *pdev)
        int                     irq;
 
        if (usb_disabled())
-               goto err_end;
+               return -ENODEV;
 
        if (!dev->parent) {
                dev_err(dev, "Missing parent device\n");
@@ -172,11 +173,8 @@ static int __devinit ohci_hcd_omap3_probe(struct platform_device *pdev)
        hcd->rsrc_len = resource_size(res);
        hcd->regs =  regs;
 
-       ret = omap_usbhs_enable(dev);
-       if (ret) {
-               dev_dbg(dev, "failed to start ohci\n");
-               goto err_end;
-       }
+       pm_runtime_enable(dev);
+       pm_runtime_get_sync(dev);
 
        ohci_hcd_init(hcd_to_ohci(hcd));
 
@@ -189,9 +187,7 @@ static int __devinit ohci_hcd_omap3_probe(struct platform_device *pdev)
        return 0;
 
 err_add_hcd:
-       omap_usbhs_disable(dev);
-
-err_end:
+       pm_runtime_put_sync(dev);
        usb_put_hcd(hcd);
 
 err_io:
@@ -220,9 +216,9 @@ static int __devexit ohci_hcd_omap3_remove(struct platform_device *pdev)
 
        iounmap(hcd->regs);
        usb_remove_hcd(hcd);
-       omap_usbhs_disable(dev);
+       pm_runtime_put_sync(dev);
+       pm_runtime_disable(dev);
        usb_put_hcd(hcd);
-
        return 0;
 }
 
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h
new file mode 100644 (file)
index 0000000..05071ee
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef __GPIO_PXA_H
+#define __GPIO_PXA_H
+
+#define GPIO_bit(x)    (1 << ((x) & 0x1f))
+
+#define gpio_to_bank(gpio)     ((gpio) >> 5)
+
+/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
+ * Those cases currently cause holes in the GPIO number space, the
+ * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
+ */
+extern int pxa_last_gpio;
+
+extern int pxa_irq_to_gpio(int irq);
+
+#endif /* __GPIO_PXA_H */
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
new file mode 100644 (file)
index 0000000..e7c748f
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __MACB_PDATA_H__
+#define __MACB_PDATA_H__
+
+struct macb_platform_data {
+       u32             phy_mask;
+       u8              phy_irq_pin;    /* PHY IRQ */
+       u8              is_rmii;        /* using RMII interface? */
+};
+
+#endif /* __MACB_PDATA_H__ */
index d0e0de7984ecb300b160bd6523e70a566d14636f..f22f3e16edf46d082b49849116001f65be8fde73 100644 (file)
@@ -10,7 +10,7 @@
 #define __SOUND_SAIF_H__
 
 struct mxs_saif_platform_data {
-       int (*init) (void);
-       int (*get_master_id) (unsigned int saif_id);
+       bool master_mode;       /* if true use master mode */
+       int master_id;          /* id of the master if in slave mode */
 };
 #endif
index 76dc74d24fc2ff7b50b9665b7443c56372c70b7c..1ef697fe17317a6860bddf14982841440bdeb87c 100644 (file)
@@ -625,13 +625,6 @@ static int mxs_saif_probe(struct platform_device *pdev)
        if (pdev->id >= ARRAY_SIZE(mxs_saif))
                return -EINVAL;
 
-       pdata = pdev->dev.platform_data;
-       if (pdata && pdata->init) {
-               ret = pdata->init();
-               if (ret)
-                       return ret;
-       }
-
        saif = kzalloc(sizeof(*saif), GFP_KERNEL);
        if (!saif)
                return -ENOMEM;
@@ -639,12 +632,17 @@ static int mxs_saif_probe(struct platform_device *pdev)
        mxs_saif[pdev->id] = saif;
        saif->id = pdev->id;
 
-       saif->master_id = saif->id;
-       if (pdata && pdata->get_master_id) {
-               saif->master_id = pdata->get_master_id(saif->id);
+       pdata = pdev->dev.platform_data;
+       if (pdata && !pdata->master_mode) {
+               saif->master_id = pdata->master_id;
                if (saif->master_id < 0 ||
-                       saif->master_id >= ARRAY_SIZE(mxs_saif))
+                       saif->master_id >= ARRAY_SIZE(mxs_saif) ||
+                       saif->master_id == saif->id) {
+                       dev_err(&pdev->dev, "get wrong master id\n");
                        return -EINVAL;
+               }
+       } else {
+               saif->master_id = saif->id;
        }
 
        saif->clk = clk_get(&pdev->dev, NULL);