]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'samsung/for-next'
authorThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 13:02:00 +0000 (15:02 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 13:02:00 +0000 (15:02 +0200)
Conflicts:
arch/arm/mach-exynos/mach-exynos4-dt.c

44 files changed:
Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
Documentation/devicetree/bindings/video/exynos_hdmi.txt
Documentation/devicetree/bindings/video/exynos_mixer.txt
MAINTAINERS
arch/arm/Kconfig
arch/arm/boot/dts/cros5250-common.dtsi
arch/arm/boot/dts/exynos4.dtsi
arch/arm/boot/dts/exynos4210-origen.dts
arch/arm/boot/dts/exynos4412-origen.dts
arch/arm/boot/dts/exynos5.dtsi
arch/arm/boot/dts/exynos5250-arndale.dts
arch/arm/boot/dts/exynos5250-smdk5250.dts
arch/arm/boot/dts/exynos5250-snow.dts
arch/arm/boot/dts/exynos5250.dtsi
arch/arm/boot/dts/exynos5420-smdk5420.dts
arch/arm/boot/dts/exynos5420.dtsi
arch/arm/boot/dts/exynos5440-sd5v1.dts
arch/arm/mach-exynos/Kconfig
arch/arm/mach-exynos/Makefile
arch/arm/mach-exynos/mach-exynos4-dt.c
arch/arm/mach-exynos/mach-exynos5-dt.c
arch/arm/mach-s3c24xx/Kconfig
arch/arm/mach-s3c24xx/clock-s3c2412.c
arch/arm/mach-s3c24xx/common-s3c2443.c
arch/arm/mach-s3c24xx/common.c
arch/arm/mach-s3c24xx/common.h
arch/arm/mach-s3c24xx/mach-jive.c
arch/arm/mach-s3c24xx/mach-smdk2413.c
arch/arm/mach-s3c24xx/mach-smdk2416.c
arch/arm/mach-s3c24xx/mach-smdk2443.c
arch/arm/mach-s3c24xx/mach-vstms.c
arch/arm/mach-s3c64xx/Kconfig
arch/arm/plat-samsung/devs.c
arch/arm/plat-samsung/include/plat/uncompress.h
arch/arm/plat-samsung/s5p-irq-eint.c
drivers/dma/Kconfig
drivers/dma/Makefile
drivers/dma/s3c24xx-dma.c [new file with mode: 0644]
drivers/gpio/gpio-samsung.c
drivers/irqchip/exynos-combiner.c
drivers/media/platform/Kconfig
include/linux/platform_data/dma-s3c24xx.h [new file with mode: 0644]
sound/soc/samsung/Kconfig
sound/soc/samsung/s3c-i2s-v2.c

index c67b975c89063f51fa20ae563f601c7c6113fe08..532b1d440abc15d1f1d1e61791b274a6ec8dafe0 100644 (file)
@@ -16,6 +16,8 @@ Required Properties:
          specific extensions.
        - "samsung,exynos5250-dw-mshc": for controllers with Samsung Exynos5250
          specific extensions.
+       - "samsung,exynos5420-dw-mshc": for controllers with Samsung Exynos5420
+         specific extensions.
 
 * samsung,dw-mshc-ciu-div: Specifies the divider value for the card interface
   unit (ciu) clock. This property is applicable only for Exynos5 SoC's and
index 323983be3c30d1684ec155736f0e9e179922fccc..50decf8e1b90a573b11dc864c7b30612a5d5c5a0 100644 (file)
@@ -12,7 +12,19 @@ Required properties:
        a) phandle of the gpio controller node.
        b) pin number within the gpio controller.
        c) optional flags and pull up/down.
-
+- clocks: list of clock IDs from SoC clock driver.
+       a) hdmi: Gate of HDMI IP bus clock.
+       b) sclk_hdmi: Gate of HDMI special clock.
+       c) sclk_pixel: Pixel special clock, one of the two possible inputs of
+               HDMI clock mux.
+       d) sclk_hdmiphy: HDMI PHY clock output, one of two possible inputs of
+               HDMI clock mux.
+       e) mout_hdmi: It is required by the driver to switch between the 2
+               parents i.e. sclk_pixel and sclk_hdmiphy. If hdmiphy is stable
+               after configuration, parent is set to sclk_hdmiphy else
+               sclk_pixel.
+- clock-names: aliases as per driver requirements for above clock IDs:
+       "hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi".
 Example:
 
        hdmi {
index 3334b0a8e343ee078825100c796c6c8b77dcebcc..7bfde9c9d658d780e82452d52d3fa5cfa3e36919 100644 (file)
@@ -10,6 +10,10 @@ Required properties:
 - reg: physical base address of the mixer and length of memory mapped
        region.
 - interrupts: interrupt number to the cpu.
+- clocks: list of clock IDs from SoC clock driver.
+       a) mixer: Gate of Mixer IP bus clock.
+       b) sclk_hdmi: HDMI Special clock, one of the two possible inputs of
+               mixer mux.
 
 Example:
 
index 2906f6af30b24a62683618b2e3efbf5f4da95708..86a5ef00211fef3bba9a3e84354001aa5662fcaf 100644 (file)
@@ -1182,6 +1182,8 @@ L:        linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 L:     linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
 W:     http://www.fluff.org/ben/linux/
 S:     Maintained
+F:     arch/arm/boot/dts/s3c*
+F:     arch/arm/boot/dts/exynos*
 F:     arch/arm/plat-samsung/
 F:     arch/arm/mach-s3c24*/
 F:     arch/arm/mach-s3c64xx/
index 1a777ddb7348bc2c76f9c5a69d3a003ef46cbed6..d68898ac36f397d3731369eff8562d9394e944ec 100644 (file)
@@ -725,7 +725,7 @@ config ARCH_S3C64XX
        select CLKDEV_LOOKUP
        select CLKSRC_SAMSUNG_PWM
        select COMMON_CLK
-       select CPU_V6
+       select CPU_V6K
        select GENERIC_CLOCKEVENTS
        select GPIO_SAMSUNG
        select HAVE_S3C2410_I2C if I2C
@@ -734,10 +734,12 @@ config ARCH_S3C64XX
        select NEED_MACH_GPIO_H
        select NO_IOPORT
        select PLAT_SAMSUNG
+       select PM_GENERIC_DOMAINS
        select S3C_DEV_NAND
        select S3C_GPIO_TRACK
        select SAMSUNG_ATAGS
        select SAMSUNG_GPIOLIB_4BIT
+       select SAMSUNG_WAKEMASK
        select SAMSUNG_WDT_RESET
        select USB_ARCH_HAS_OHCI
        help
@@ -984,9 +986,7 @@ source "arch/arm/mach-sti/Kconfig"
 
 source "arch/arm/mach-s3c24xx/Kconfig"
 
-if ARCH_S3C64XX
 source "arch/arm/mach-s3c64xx/Kconfig"
-endif
 
 source "arch/arm/mach-s5p64x0/Kconfig"
 
index dc259e8b8a73a8630dc9698295e662f0ab66e43d..6470536a68c487e4af11ffa8e1cacb58edc6f621 100644 (file)
                };
        };
 
-       dwmmc0@12200000 {
+       mmc@12200000 {
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
                };
        };
 
-       dwmmc1@12210000 {
+       mmc@12210000 {
                status = "disabled";
        };
 
-       dwmmc2@12220000 {
+       mmc@12220000 {
                num-slots = <1>;
                supports-highspeed;
                fifo-depth = <0x80>;
                };
        };
 
-       dwmmc3@12230000 {
+       mmc@12230000 {
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
index caadc025734210362effb5fe01b5d0d500235e6d..a73eeb5f258fba0b88e55640f6e0df220b7b1cbb 100644 (file)
                reg = <0x10000000 0x100>;
        };
 
+       mipi_phy: video-phy@10020710 {
+               compatible = "samsung,s5pv210-mipi-video-phy";
+               reg = <0x10020710 8>;
+               #phy-cells = <1>;
+       };
+
        pd_mfc: mfc-power-domain@10023C40 {
                compatible = "samsung,exynos4210-pd";
                reg = <0x10023C40 0x20>;
                        clock-names = "csis", "sclk_csis";
                        bus-width = <4>;
                        samsung,power-domain = <&pd_cam>;
+                       phys = <&mipi_phy 0>;
+                       phy-names = "csis";
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        clock-names = "csis", "sclk_csis";
                        bus-width = <2>;
                        samsung,power-domain = <&pd_cam>;
+                       phys = <&mipi_phy 2>;
+                       phy-names = "csis";
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
index 46378fee2a13f358a7bf841163f1479852ea021a..1a12fb23767c522be3f6af9311a858d93750846a 100644 (file)
                bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc";
        };
 
-       mmc_reg: voltage-regulator {
-               compatible = "regulator-fixed";
-               regulator-name = "VMEM_VDD_2.8V";
-               regulator-min-microvolt = <2800000>;
-               regulator-max-microvolt = <2800000>;
-               gpio = <&gpx1 1 0>;
-               enable-active-high;
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               mmc_reg: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "VMEM_VDD_2.8V";
+                       regulator-min-microvolt = <2800000>;
+                       regulator-max-microvolt = <2800000>;
+                       gpio = <&gpx1 1 0>;
+                       enable-active-high;
+               };
        };
 
        tmu@100C0000 {
index 8768b03702e5a14c3ebf742677a03e0b76082a42..d65984c440f6786b245275a09497670271714e90 100644 (file)
                reg = <0x0203F000 0x1000>;
        };
 
-       mmc_reg: voltage-regulator {
-               compatible = "regulator-fixed";
-               regulator-name = "VMEM_VDD_2.8V";
-               regulator-min-microvolt = <2800000>;
-               regulator-max-microvolt = <2800000>;
-               gpio = <&gpx1 1 0>;
-               enable-active-high;
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               mmc_reg: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "VMEM_VDD_2.8V";
+                       regulator-min-microvolt = <2800000>;
+                       regulator-max-microvolt = <2800000>;
+                       gpio = <&gpx1 1 0>;
+                       enable-active-high;
+               };
        };
 
        pinctrl@11000000 {
index 074739d39e2db04490c3575fbb2131519f6cf53d..e52b038a7a1171ac1559b86b5d3a18cdfb144ff8 100644 (file)
                interrupts = <1 9 0xf04>;
        };
 
-       dwmmc_0: dwmmc0@12200000 {
-               compatible = "samsung,exynos5250-dw-mshc";
-               interrupts = <0 75 0>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
-       dwmmc_1: dwmmc1@12210000 {
-               compatible = "samsung,exynos5250-dw-mshc";
-               interrupts = <0 76 0>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
-       dwmmc_2: dwmmc2@12220000 {
-               compatible = "samsung,exynos5250-dw-mshc";
-               interrupts = <0 77 0>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-       };
-
        serial@12C00000 {
                compatible = "samsung,exynos4210-uart";
                reg = <0x12C00000 0x100>;
index cee55fa33731195c7230aee40480aef77361b694..b77a37ec81c25b89affa2f90d8ef7007b0d4072a 100644 (file)
        };
 
        i2c@12C80000 {
-               status = "disabled";
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <66000>;
+               samsung,i2c-slave-addr = <0x50>;
+
+               hdmiddc@50 {
+                       compatible = "samsung,exynos4210-hdmiddc";
+                       reg = <0x50>;
+               };
        };
 
        i2c@12C90000 {
                status = "disabled";
        };
 
+       i2c@12CE0000 {
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <66000>;
+               samsung,i2c-slave-addr = <0x38>;
+
+               hdmiphy@38 {
+                       compatible = "samsung,exynos4212-hdmiphy";
+                       reg = <0x38>;
+               };
+       };
+
        i2c@121D0000 {
                status = "disabled";
        };
 
-       dwmmc_0: dwmmc0@12200000 {
+       mmc_0: mmc@12200000 {
+               status = "okay";
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
                };
        };
 
-       dwmmc_1: dwmmc1@12210000 {
-               status = "disabled";
-       };
-
-       dwmmc_2: dwmmc2@12220000 {
+       mmc_2: mmc@12220000 {
+               status = "okay";
                num-slots = <1>;
                supports-highspeed;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
                };
        };
 
-       dwmmc_3: dwmmc3@12230000 {
-               status = "disabled";
+       i2s0: i2s@03830000 {
+               status = "okay";
        };
 
        spi_0: spi@12d20000 {
                #address-cells = <1>;
                #size-cells = <0>;
 
-               main_dc_reg: fixedregulator@1 {
+               main_dc_reg: regulator@0 {
                        compatible = "regulator-fixed";
+                       reg = <0>;
                        regulator-name = "MAIN_DC";
                };
 
-               mmc_reg: voltage-regulator {
+               mmc_reg: regulator@1 {
                        compatible = "regulator-fixed";
+                       reg = <1>;
                        regulator-name = "VDD_33ON_2.8V";
                        regulator-min-microvolt = <2800000>;
                        regulator-max-microvolt = <2800000>;
                        enable-active-high;
                };
 
-               reg_hdmi_en: fixedregulator@0 {
+               reg_hdmi_en: regulator@2 {
                        compatible = "regulator-fixed";
+                       reg = <2>;
                        regulator-name = "hdmi-en";
                };
        };
index 2538b329f2cea5367f1517c37673cc77d3e13d3d..13746dfb20aae1307f4ec9ef7636d89a83cb173a 100644 (file)
                };
        };
 
-       dwmmc0@12200000 {
+       mmc@12200000 {
+               status = "okay";
                num-slots = <1>;
                supports-highspeed;
                broken-cd;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
                };
        };
 
-       dwmmc1@12210000 {
-               status = "disabled";
-       };
-
-       dwmmc2@12220000 {
+       mmc@12220000 {
+               status = "okay";
                num-slots = <1>;
                supports-highspeed;
-               fifo-depth = <0x80>;
                card-detect-delay = <200>;
                samsung,dw-mshc-ciu-div = <3>;
                samsung,dw-mshc-sdr-timing = <2 3>;
                };
        };
 
-       dwmmc3@12230000 {
-               status = "disabled";
-       };
-
        spi_0: spi@12d20000 {
                status = "disabled";
        };
                status = "okay";
        };
 
-       i2s1: i2s@12D60000 {
-               status = "disabled";
-       };
-
-       i2s2: i2s@12D70000 {
-               status = "disabled";
-       };
-
        sound {
                compatible = "samsung,smdk-wm8994";
 
index fd711e245e8d311f392bedfed7bb48dee4d4b7e6..a9395c426db44a7ddaeefd3b56040928a8f06e2f 100644 (file)
         * On Snow we've got SIP WiFi and so can keep drive strengths low to
         * reduce EMI.
         */
-       dwmmc3@12230000 {
+       mmc@12230000 {
                slot@0 {
                        pinctrl-names = "default";
                        pinctrl-0 = <&sd3_clk &sd3_cmd &sd3_bus4>;
index bbac42a78ce543c2790a7943697afda1eba2e2aa..b98ffc3a5fe289514a661cd5b5b7099c1c044be5 100644 (file)
                gsc1 = &gsc_1;
                gsc2 = &gsc_2;
                gsc3 = &gsc_3;
-               mshc0 = &dwmmc_0;
-               mshc1 = &dwmmc_1;
-               mshc2 = &dwmmc_2;
-               mshc3 = &dwmmc_3;
+               mshc0 = &mmc_0;
+               mshc1 = &mmc_1;
+               mshc2 = &mmc_2;
+               mshc3 = &mmc_3;
                i2c0 = &i2c_0;
                i2c1 = &i2c_1;
                i2c2 = &i2c_2;
                pinctrl-0 = <&spi2_bus>;
        };
 
-       dwmmc_0: dwmmc0@12200000 {
+       mmc_0: mmc@12200000 {
+               compatible = "samsung,exynos5250-dw-mshc";
+               interrupts = <0 75 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
                reg = <0x12200000 0x1000>;
                clocks = <&clock 280>, <&clock 139>;
                clock-names = "biu", "ciu";
+               fifo-depth = <0x80>;
+               status = "disabled";
        };
 
-       dwmmc_1: dwmmc1@12210000 {
+       mmc_1: mmc@12210000 {
+               compatible = "samsung,exynos5250-dw-mshc";
+               interrupts = <0 76 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
                reg = <0x12210000 0x1000>;
                clocks = <&clock 281>, <&clock 140>;
                clock-names = "biu", "ciu";
+               fifo-depth = <0x80>;
+               status = "disabled";
        };
 
-       dwmmc_2: dwmmc2@12220000 {
+       mmc_2: mmc@12220000 {
+               compatible = "samsung,exynos5250-dw-mshc";
+               interrupts = <0 77 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
                reg = <0x12220000 0x1000>;
                clocks = <&clock 282>, <&clock 141>;
                clock-names = "biu", "ciu";
+               fifo-depth = <0x80>;
+               status = "disabled";
        };
 
-       dwmmc_3: dwmmc3@12230000 {
+       mmc_3: mmc@12230000 {
                compatible = "samsung,exynos5250-dw-mshc";
                reg = <0x12230000 0x1000>;
                interrupts = <0 78 0>;
                #size-cells = <0>;
                clocks = <&clock 283>, <&clock 142>;
                clock-names = "biu", "ciu";
+               fifo-depth = <0x80>;
+               status = "disabled";
        };
 
        i2s0: i2s@03830000 {
                compatible = "samsung,s5pv210-i2s";
+               status = "disabled";
                reg = <0x03830000 0x100>;
                dmas = <&pdma0 10
                        &pdma0 9
 
        i2s1: i2s@12D60000 {
                compatible = "samsung,s3c6410-i2s";
+               status = "disabled";
                reg = <0x12D60000 0x100>;
                dmas = <&pdma1 12
                        &pdma1 11>;
 
        i2s2: i2s@12D70000 {
                compatible = "samsung,s3c6410-i2s";
+               status = "disabled";
                reg = <0x12D70000 0x100>;
                dmas = <&pdma0 12
                        &pdma0 11>;
                compatible = "samsung,exynos4212-hdmi";
                reg = <0x14530000 0x70000>;
                interrupts = <0 95 0>;
-               clocks = <&clock 333>, <&clock 136>, <&clock 137>,
-                               <&clock 333>, <&clock 333>;
+               clocks = <&clock 344>, <&clock 136>, <&clock 137>,
+                               <&clock 159>, <&clock 1024>;
                clock-names = "hdmi", "sclk_hdmi", "sclk_pixel",
-                               "sclk_hdmiphy", "hdmiphy";
+                               "sclk_hdmiphy", "mout_hdmi";
        };
 
        mixer {
                compatible = "samsung,exynos5250-mixer";
                reg = <0x14450000 0x10000>;
                interrupts = <0 94 0>;
+               clocks = <&clock 343>, <&clock 136>;
+               clock-names = "mixer", "sclk_hdmi";
        };
 
        dp_phy: video-phy@10040720 {
index bafba25ba7c29f44adba081b8bea245aa3d4b11a..fb5a1e25c632d3a4cbb3544e5e44ee67a0c1d8aa 100644 (file)
                };
        };
 
+       mmc@12200000 {
+               status = "okay";
+               broken-cd;
+               supports-highspeed;
+               card-detect-delay = <200>;
+               samsung,dw-mshc-ciu-div = <3>;
+               samsung,dw-mshc-sdr-timing = <0 4>;
+               samsung,dw-mshc-ddr-timing = <0 2>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4 &sd0_bus8>;
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <8>;
+               };
+       };
+
+       mmc@12220000 {
+               status = "okay";
+               supports-highspeed;
+               card-detect-delay = <200>;
+               samsung,dw-mshc-ciu-div = <3>;
+               samsung,dw-mshc-sdr-timing = <2 3>;
+               samsung,dw-mshc-ddr-timing = <1 2>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
+
+               slot@0 {
+                       reg = <0>;
+                       bus-width = <4>;
+               };
+       };
+
        dp-controller@145B0000 {
                pinctrl-names = "default";
                pinctrl-0 = <&dp_hpd>;
                };
        };
 
+       pinctrl@13400000 {
+               hdmi_hpd_irq: hdmi-hpd-irq {
+                       samsung,pins = "gpx3-7";
+                       samsung,pin-function = <0>;
+                       samsung,pin-pud = <1>;
+                       samsung,pin-drv = <0>;
+               };
+       };
+
+       hdmi@14530000 {
+               status = "okay";
+               hpd-gpio = <&gpx3 7 0>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdmi_hpd_irq>;
+       };
+
+       i2c_2: i2c@12C80000 {
+               samsung,i2c-sda-delay = <100>;
+               samsung,i2c-max-bus-freq = <66000>;
+               status = "okay";
+
+               hdmiddc@50 {
+                       compatible = "samsung,exynos4210-hdmiddc";
+                       reg = <0x50>;
+               };
+       };
 };
index d537cd704e190b89faec41f3d7509d2e2cb50059..6ffefd163fa0603fc9ae9602770e533a4b7e8857 100644 (file)
        compatible = "samsung,exynos5420";
 
        aliases {
+               mshc0 = &mmc_0;
+               mshc1 = &mmc_1;
+               mshc2 = &mmc_2;
                pinctrl0 = &pinctrl_0;
                pinctrl1 = &pinctrl_1;
                pinctrl2 = &pinctrl_2;
                pinctrl3 = &pinctrl_3;
                pinctrl4 = &pinctrl_4;
+               i2c0 = &i2c_0;
+               i2c1 = &i2c_1;
+               i2c2 = &i2c_2;
+               i2c3 = &i2c_3;
+               gsc0 = &gsc_0;
+               gsc1 = &gsc_1;
        };
 
        cpus {
                clock-names = "mfc";
        };
 
+       mmc_0: mmc@12200000 {
+               compatible = "samsung,exynos5420-dw-mshc-smu";
+               interrupts = <0 75 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x12200000 0x2000>;
+               clocks = <&clock 351>, <&clock 132>;
+               clock-names = "biu", "ciu";
+               fifo-depth = <0x40>;
+               status = "disabled";
+       };
+
+       mmc_1: mmc@12210000 {
+               compatible = "samsung,exynos5420-dw-mshc-smu";
+               interrupts = <0 76 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x12210000 0x2000>;
+               clocks = <&clock 352>, <&clock 133>;
+               clock-names = "biu", "ciu";
+               fifo-depth = <0x40>;
+               status = "disabled";
+       };
+
+       mmc_2: mmc@12220000 {
+               compatible = "samsung,exynos5420-dw-mshc";
+               interrupts = <0 77 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x12220000 0x1000>;
+               clocks = <&clock 353>, <&clock 134>;
+               clock-names = "biu", "ciu";
+               fifo-depth = <0x40>;
+               status = "disabled";
+       };
+
        mct@101C0000 {
                compatible = "samsung,exynos4210-mct";
                reg = <0x101C0000 0x800>;
                io-channel-ranges;
                status = "disabled";
        };
+
+       i2c_0: i2c@12C60000 {
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12C60000 0x100>;
+               interrupts = <0 56 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&clock 261>;
+               clock-names = "i2c";
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c0_bus>;
+               status = "disabled";
+       };
+
+       i2c_1: i2c@12C70000 {
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12C70000 0x100>;
+               interrupts = <0 57 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&clock 262>;
+               clock-names = "i2c";
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c1_bus>;
+               status = "disabled";
+       };
+
+       i2c_2: i2c@12C80000 {
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12C80000 0x100>;
+               interrupts = <0 58 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&clock 263>;
+               clock-names = "i2c";
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c2_bus>;
+               status = "disabled";
+       };
+
+       i2c_3: i2c@12C90000 {
+               compatible = "samsung,s3c2440-i2c";
+               reg = <0x12C90000 0x100>;
+               interrupts = <0 59 0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&clock 264>;
+               clock-names = "i2c";
+               pinctrl-names = "default";
+               pinctrl-0 = <&i2c3_bus>;
+               status = "disabled";
+       };
+
+       hdmi@14530000 {
+               compatible = "samsung,exynos4212-hdmi";
+               reg = <0x14530000 0x70000>;
+               interrupts = <0 95 0>;
+               clocks = <&clock 413>, <&clock 143>, <&clock 768>,
+                       <&clock 158>, <&clock 640>;
+               clock-names = "hdmi", "sclk_hdmi", "sclk_pixel",
+                       "sclk_hdmiphy", "mout_hdmi";
+               status = "disabled";
+       };
+
+       mixer@14450000 {
+               compatible = "samsung,exynos5420-mixer";
+               reg = <0x14450000 0x10000>;
+               interrupts = <0 94 0>;
+               clocks = <&clock 431>, <&clock 143>;
+               clock-names = "mixer", "sclk_hdmi";
+       };
+
+       gsc_0: video-scaler@13e00000 {
+               compatible = "samsung,exynos5-gsc";
+               reg = <0x13e00000 0x1000>;
+               interrupts = <0 85 0>;
+               clocks = <&clock 465>;
+               clock-names = "gscl";
+               samsung,power-domain = <&gsc_pd>;
+       };
+
+       gsc_1: video-scaler@13e10000 {
+               compatible = "samsung,exynos5-gsc";
+               reg = <0x13e10000 0x1000>;
+               interrupts = <0 86 0>;
+               clocks = <&clock 466>;
+               clock-names = "gscl";
+               samsung,power-domain = <&gsc_pd>;
+       };
 };
index 777fb1c2c70f322b00b3075472a8a412e5c42509..f7c3d9ea4f9b1505e4879aab0e876e00155e390f 100644 (file)
                status = "disabled";
        };
 
+       pcie@290000 {
+               status = "disabled";
+       };
+
+       pcie@2a0000 {
+               status = "disabled";
+       };
 };
index 56fe819ee10b0dd17919e61fdec71cd403b1d6de..f9d67a0acb2af170737db3aa60a0b54f1f4091dd 100644 (file)
@@ -14,19 +14,28 @@ menu "SAMSUNG EXYNOS SoCs Support"
 config ARCH_EXYNOS4
        bool "SAMSUNG EXYNOS4"
        default y
+       select ARM_AMBA
+       select CLKSRC_OF
+       select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210
+       select CPU_EXYNOS4210
        select GIC_NON_BANKED
+       select KEYBOARD_SAMSUNG if INPUT_KEYBOARD
        select HAVE_ARM_SCU if SMP
        select HAVE_SMP
        select MIGHT_HAVE_CACHE_L2X0
        select PINCTRL
+       select S5P_DEV_MFC
        help
          Samsung EXYNOS4 SoCs based systems
 
 config ARCH_EXYNOS5
        bool "SAMSUNG EXYNOS5"
+       select ARM_AMBA
+       select CLKSRC_OF
        select HAVE_ARM_SCU if SMP
        select HAVE_SMP
        select PINCTRL
+       select USB_ARCH_HAS_XHCI
        help
          Samsung EXYNOS5 (Cortex-A15) SoC based systems
 
@@ -110,35 +119,6 @@ config SOC_EXYNOS5440
        help
          Enable EXYNOS5440 SoC support
 
-comment "Flattened Device Tree based board for EXYNOS SoCs"
-
-config MACH_EXYNOS4_DT
-       bool "Samsung Exynos4 Machine using device tree"
-       default y
-       depends on ARCH_EXYNOS4
-       select ARM_AMBA
-       select CLKSRC_OF
-       select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210
-       select CPU_EXYNOS4210
-       select KEYBOARD_SAMSUNG if INPUT_KEYBOARD
-       select S5P_DEV_MFC
-       help
-         Machine support for Samsung Exynos4 machine with device tree enabled.
-         Select this if a fdt blob is available for the Exynos4 SoC based board.
-         Note: This is under development and not all peripherals can be supported
-         with this machine file.
-
-config MACH_EXYNOS5_DT
-       bool "SAMSUNG EXYNOS5 Machine using device tree"
-       default y
-       depends on ARCH_EXYNOS5
-       select ARM_AMBA
-       select CLKSRC_OF
-       select USB_ARCH_HAS_XHCI
-       help
-         Machine support for Samsung EXYNOS5 machine with device tree enabled.
-         Select this if a fdt blob is available for the EXYNOS5 SoC based board.
-
 endmenu
 
 endif
index 53696154aead3da032d710720cd45ca72e634827..8930b66b4abdba97b2d09aac81f28cf0df5fb21b 100644 (file)
@@ -32,5 +32,5 @@ AFLAGS_exynos-smc.o           :=-Wa,-march=armv7-a$(plus_sec)
 
 # machine support
 
-obj-$(CONFIG_MACH_EXYNOS4_DT)          += mach-exynos4-dt.o
-obj-$(CONFIG_MACH_EXYNOS5_DT)          += mach-exynos5-dt.o
+obj-$(CONFIG_ARCH_EXYNOS4)     += mach-exynos4-dt.o
+obj-$(CONFIG_ARCH_EXYNOS5)     += mach-exynos5-dt.o
index 7b441c31f516b79cf595528132f1ebd17e7e4e57..4603e6bd424b66202b895633c6fe74bd1958a3bd 100644 (file)
  * published by the Free Software Foundation.
 */
 
-#include <linux/kernel.h>
 #include <linux/of_platform.h>
 #include <linux/of_fdt.h>
-#include <linux/serial_core.h>
-#include <linux/memblock.h>
 
 #include <asm/mach/arch.h>
 #include <plat/mfc.h>
index 962b049822500dfcceba6bc79a1f7820885a2364..1fe075a70c1e83d34bf1440ac030fe86b551a4a6 100644 (file)
 
 #include <linux/of_platform.h>
 #include <linux/of_fdt.h>
-#include <linux/memblock.h>
 #include <linux/io.h>
 
 #include <asm/mach/arch.h>
 #include <mach/regs-pmu.h>
-
-#include <plat/cpu.h>
 #include <plat/mfc.h>
 
 #include "common.h"
index dba2173e70f3aceb69947dd06f9653b39deadbb7..8f1d327e0cd1566286a5f6530569dbf1bc530ca4 100644 (file)
@@ -28,6 +28,7 @@ config CPU_S3C2410
        select CPU_ARM920T
        select CPU_LLSERIAL_S3C2410
        select S3C2410_CLOCK
+       select S3C2410_DMA if S3C24XX_DMA
        select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ
        select S3C2410_PM if PM
        select SAMSUNG_WDT_RESET
@@ -70,6 +71,7 @@ config CPU_S3C2442
        select CPU_ARM920T
        select CPU_LLSERIAL_S3C2440
        select S3C2410_CLOCK
+       select S3C2410_DMA if S3C24XX_DMA
        select S3C2410_PM if PM
        help
          Support for S3C2442 Samsung Mobile CPU based systems.
@@ -148,7 +150,6 @@ config S3C2410_DMA_DEBUG
 config S3C2410_DMA
        bool
        depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442)
-       default y if CPU_S3C2410 || CPU_S3C2442
        help
          DMA device selection for S3C2410 and compatible CPUs
 
index d8f253f2b4862383888f633a400c2209aac352f5..11b3b28457bbce9130309d876f9239905f82e7e2 100644 (file)
@@ -484,22 +484,22 @@ static struct clk init_clocks_disable[] = {
 
 static struct clk init_clocks[] = {
        {
-               .name           = "dma",
+               .name           = "dma.0",
                .parent         = &clk_h,
                .enable         = s3c2412_clkcon_enable,
                .ctrlbit        = S3C2412_CLKCON_DMA0,
        }, {
-               .name           = "dma",
+               .name           = "dma.1",
                .parent         = &clk_h,
                .enable         = s3c2412_clkcon_enable,
                .ctrlbit        = S3C2412_CLKCON_DMA1,
        }, {
-               .name           = "dma",
+               .name           = "dma.2",
                .parent         = &clk_h,
                .enable         = s3c2412_clkcon_enable,
                .ctrlbit        = S3C2412_CLKCON_DMA2,
        }, {
-               .name           = "dma",
+               .name           = "dma.3",
                .parent         = &clk_h,
                .enable         = s3c2412_clkcon_enable,
                .ctrlbit        = S3C2412_CLKCON_DMA3,
index f6b9f2ef01bdde960504230f36f6db6a594a05a6..65d3eef7309040d4ccc5a71af5da8618327d8b60 100644 (file)
@@ -438,32 +438,32 @@ static struct clk init_clocks_off[] = {
 
 static struct clk init_clocks[] = {
        {
-               .name           = "dma",
+               .name           = "dma.0",
                .parent         = &clk_h,
                .enable         = s3c2443_clkcon_enable_h,
                .ctrlbit        = S3C2443_HCLKCON_DMA0,
        }, {
-               .name           = "dma",
+               .name           = "dma.1",
                .parent         = &clk_h,
                .enable         = s3c2443_clkcon_enable_h,
                .ctrlbit        = S3C2443_HCLKCON_DMA1,
        }, {
-               .name           = "dma",
+               .name           = "dma.2",
                .parent         = &clk_h,
                .enable         = s3c2443_clkcon_enable_h,
                .ctrlbit        = S3C2443_HCLKCON_DMA2,
        }, {
-               .name           = "dma",
+               .name           = "dma.3",
                .parent         = &clk_h,
                .enable         = s3c2443_clkcon_enable_h,
                .ctrlbit        = S3C2443_HCLKCON_DMA3,
        }, {
-               .name           = "dma",
+               .name           = "dma.4",
                .parent         = &clk_h,
                .enable         = s3c2443_clkcon_enable_h,
                .ctrlbit        = S3C2443_HCLKCON_DMA4,
        }, {
-               .name           = "dma",
+               .name           = "dma.5",
                .parent         = &clk_h,
                .enable         = s3c2443_clkcon_enable_h,
                .ctrlbit        = S3C2443_HCLKCON_DMA5,
index 457261c984338815c7620c8c8eeed9c150b61e8d..4adaa4b43ffe5282f915d83dcdc3d4489c6eebe7 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/io.h>
+#include <linux/platform_data/dma-s3c24xx.h>
 
 #include <mach/hardware.h>
 #include <mach/regs-clock.h>
@@ -44,6 +45,7 @@
 
 #include <mach/regs-gpio.h>
 #include <plat/regs-serial.h>
+#include <mach/dma.h>
 
 #include <plat/cpu.h>
 #include <plat/devs.h>
@@ -329,3 +331,207 @@ void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
        clk_p.rate = pclk;
        clk_f.rate = fclk;
 }
+
+#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
+       defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
+static struct resource s3c2410_dma_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
+       [1] = DEFINE_RES_IRQ(IRQ_DMA0),
+       [2] = DEFINE_RES_IRQ(IRQ_DMA1),
+       [3] = DEFINE_RES_IRQ(IRQ_DMA2),
+       [4] = DEFINE_RES_IRQ(IRQ_DMA3),
+};
+#endif
+
+#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2442)
+static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
+       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
+       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
+       [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
+                                               S3C24XX_DMA_CHANREQ(2, 2) |
+                                               S3C24XX_DMA_CHANREQ(1, 3),
+       },
+       [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
+       [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
+       [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
+       [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
+       [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
+       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
+                                                S3C24XX_DMA_CHANREQ(3, 2) |
+                                                S3C24XX_DMA_CHANREQ(3, 3),
+       },
+       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
+                                                 S3C24XX_DMA_CHANREQ(1, 2),
+       },
+       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 2), },
+       [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
+       [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
+       [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
+       [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
+};
+
+static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
+       .num_phy_channels = 4,
+       .channels = s3c2410_dma_channels,
+       .num_channels = DMACH_MAX,
+};
+
+struct platform_device s3c2410_device_dma = {
+       .name           = "s3c2410-dma",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
+       .resource       = s3c2410_dma_resource,
+       .dev    = {
+               .platform_data  = &s3c2410_dma_platdata,
+       },
+};
+#endif
+
+#ifdef CONFIG_CPU_S3C2412
+static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
+       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
+       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
+       [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
+       [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
+       [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
+       [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
+       [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
+       [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
+       [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
+       [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
+       [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
+       [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
+       [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
+       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
+       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
+       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
+       [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, 13 },
+       [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, 14 },
+       [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, 15 },
+       [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
+};
+
+static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
+       .num_phy_channels = 4,
+       .channels = s3c2412_dma_channels,
+       .num_channels = DMACH_MAX,
+};
+
+struct platform_device s3c2412_device_dma = {
+       .name           = "s3c2412-dma",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
+       .resource       = s3c2410_dma_resource,
+       .dev    = {
+               .platform_data  = &s3c2412_dma_platdata,
+       },
+};
+#endif
+
+#if defined(CONFIG_CPU_S3C2440)
+static struct s3c24xx_dma_channel s3c2440_dma_channels[DMACH_MAX] = {
+       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
+       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
+       [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
+                                               S3C24XX_DMA_CHANREQ(6, 1) |
+                                               S3C24XX_DMA_CHANREQ(2, 2) |
+                                               S3C24XX_DMA_CHANREQ(1, 3),
+       },
+       [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
+       [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
+       [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
+       [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
+       [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
+       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
+                                                S3C24XX_DMA_CHANREQ(3, 2) |
+                                                S3C24XX_DMA_CHANREQ(3, 3),
+       },
+       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
+                                                 S3C24XX_DMA_CHANREQ(1, 2),
+       },
+       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 0) |
+                                                  S3C24XX_DMA_CHANREQ(0, 2),
+       },
+       [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 0) |
+                                                 S3C24XX_DMA_CHANREQ(5, 2),
+       },
+       [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 1) |
+                                                 S3C24XX_DMA_CHANREQ(6, 3),
+       },
+       [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 2) |
+                                                 S3C24XX_DMA_CHANREQ(5, 3),
+       },
+       [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
+       [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
+       [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
+       [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
+};
+
+static struct s3c24xx_dma_platdata s3c2440_dma_platdata = {
+       .num_phy_channels = 4,
+       .channels = s3c2440_dma_channels,
+       .num_channels = DMACH_MAX,
+};
+
+struct platform_device s3c2440_device_dma = {
+       .name           = "s3c2410-dma",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
+       .resource       = s3c2410_dma_resource,
+       .dev    = {
+               .platform_data  = &s3c2440_dma_platdata,
+       },
+};
+#endif
+
+#if defined(CONFIG_CPUS_3C2443) || defined(CONFIG_CPU_S3C2416)
+static struct resource s3c2443_dma_resource[] = {
+       [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
+       [1] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA0),
+       [2] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA1),
+       [3] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA2),
+       [4] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA3),
+       [5] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA4),
+       [6] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA5),
+};
+
+static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
+       [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
+       [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
+       [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
+       [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
+       [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
+       [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
+       [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
+       [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
+       [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
+       [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
+       [DMACH_UART3] = { S3C24XX_DMA_APB, true, 25 },
+       [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
+       [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
+       [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
+       [DMACH_UART3_SRC2] = { S3C24XX_DMA_APB, true, 26 },
+       [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
+       [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
+       [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
+       [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, 28 },
+       [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, 27 },
+       [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
+};
+
+static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
+       .num_phy_channels = 6,
+       .channels = s3c2443_dma_channels,
+       .num_channels = DMACH_MAX,
+};
+
+struct platform_device s3c2443_device_dma = {
+       .name           = "s3c2443-dma",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(s3c2443_dma_resource),
+       .resource       = s3c2443_dma_resource,
+       .dev    = {
+               .platform_data  = &s3c2443_dma_platdata,
+       },
+};
+#endif
index 84b280654f4cf331252199ae2c5b2b17fcc072da..e46c1041721669e3503555cadff0c6bbbcaaf3df 100644 (file)
@@ -109,4 +109,9 @@ extern void s3c2443_init_irq(void);
 
 extern struct syscore_ops s3c24xx_irq_syscore_ops;
 
+extern struct platform_device s3c2410_device_dma;
+extern struct platform_device s3c2412_device_dma;
+extern struct platform_device s3c2440_device_dma;
+extern struct platform_device s3c2443_device_dma;
+
 #endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
index a45fcd8ccf796016c9007d0d7a44e089f30a9497..43c23e220f5b5823eb0831fe68f52430fb06f475 100644 (file)
@@ -466,6 +466,7 @@ static struct platform_device *jive_devices[] __initdata = {
        &jive_device_wm8750,
        &s3c_device_nand,
        &s3c_device_usbgadget,
+       &s3c2412_device_dma,
 };
 
 static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
index 8146e920f10d67313bbae45ddc81f47735eb67d1..c9d31ef28dd107073e63f5736437112804999ba9 100644 (file)
@@ -89,6 +89,7 @@ static struct platform_device *smdk2413_devices[] __initdata = {
        &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_usbgadget,
+       &s3c2412_device_dma,
 };
 
 static void __init smdk2413_fixup(struct tag *tags, char **cmdline,
index cb46847c66b4a71c50272a4d847ca49356266742..f88e672ad1e42786e57dc62cca8df9763fb0f5cc 100644 (file)
@@ -215,6 +215,7 @@ static struct platform_device *smdk2416_devices[] __initdata = {
        &s3c_device_hsmmc0,
        &s3c_device_hsmmc1,
        &s3c_device_usb_hsudc,
+       &s3c2443_device_dma,
 };
 
 static void __init smdk2416_map_io(void)
index 9435c3bef18a91c53da53dcc29e68498bc834946..d9933fcc6cc8bb8526af7808c28a5250c2ae2be1 100644 (file)
@@ -115,6 +115,7 @@ static struct platform_device *smdk2443_devices[] __initdata = {
 #ifdef CONFIG_SND_SOC_SMDK2443_WM9710
        &s3c_device_ac97,
 #endif
+       &s3c2443_device_dma,
 };
 
 static void __init smdk2443_map_io(void)
index b66588428ec90e7b0d4c056f60e8ddc2e5dc36be..f7ec9c55078748782cd3110c8b4cea81a5afc408 100644 (file)
@@ -126,6 +126,7 @@ static struct platform_device *vstms_devices[] __initdata = {
        &s3c_device_iis,
        &s3c_device_rtc,
        &s3c_device_nand,
+       &s3c2412_device_dma,
 };
 
 static void __init vstms_fixup(struct tag *tags, char **cmdline,
index bd14e3a37128ef9c1b84559a5c31a74eb1c06752..2cb8dc55b50ecbc4aa612ab805b52f03efec3eb9 100644 (file)
@@ -3,16 +3,7 @@
 #
 # Licensed under GPLv2
 
-# temporary until we can eliminate all drivers using it.
-config PLAT_S3C64XX
-       bool
-       depends on ARCH_S3C64XX
-       default y
-       select PM_GENERIC_DOMAINS
-       select SAMSUNG_WAKEMASK
-       help
-         Base platform code for any Samsung S3C64XX device
-
+if ARCH_S3C64XX
 
 # Configuration options for the S3C6410 CPU
 
@@ -322,3 +313,5 @@ config MACH_S3C64XX_DT
          board.
          Note: This is under development and not all peripherals can be
          supported with this machine file.
+
+endif
index 25f40c9b7f629aeffa31472ef6f31187aa2162ef..99a3590f034949cc45bc99df724857e096888e51 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/ioport.h>
 #include <linux/platform_data/s3c-hsudc.h>
 #include <linux/platform_data/s3c-hsotg.h>
+#include <linux/platform_data/dma-s3c24xx.h>
 
 #include <media/s5p_hdmi.h>
 
@@ -1465,8 +1466,10 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
        pd.num_cs = num_cs;
        pd.src_clk_nr = src_clk_nr;
        pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
-#ifdef CONFIG_PL330_DMA
+#if defined(CONFIG_PL330_DMA)
        pd.filter = pl330_filter;
+#elif defined(CONFIG_S3C24XX_DMAC)
+       pd.filter = s3c24xx_dma_filter;
 #endif
 
        s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
index 4afc32f90b6d51f553e7d987cf972730466adb57..f48dc0a4736c8d2d1703a29dc0ece5bb9662f3ca 100644 (file)
@@ -145,6 +145,8 @@ static inline void arch_enable_uart_fifo(void)
                        if (!(fifocon & S3C2410_UFCON_RESETBOTH))
                                break;
                }
+
+               uart_wr(S3C2410_UFCON, S3C2410_UFCON_FIFOMODE);
        }
 }
 #else
index faa651602780b6570b1af0d079d08a9b409e651e..ebee4dc11a946686a1c558c82f3f027b7c0f173b 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/device.h>
 #include <linux/gpio.h>
 #include <linux/irqchip/arm-vic.h>
+#include <linux/of.h>
 
 #include <plat/regs-irqtype.h>
 
@@ -202,6 +203,9 @@ static int __init s5p_init_irq_eint(void)
 {
        int irq;
 
+       if (of_have_populated_dt())
+               return -ENODEV;
+
        for (irq = IRQ_EINT(0); irq <= IRQ_EINT(15); irq++)
                irq_set_chip(irq, &s5p_irq_vic_eint);
 
index 9ec1c5c864dd7dd315b5973d438fb794bef2e6c7..dd2874ec1927a6dae0e97defce4dfc05aef38d87 100644 (file)
@@ -154,6 +154,18 @@ config TEGRA20_APB_DMA
          This DMA controller transfers data from memory to peripheral fifo
          or vice versa. It does not support memory to memory data transfer.
 
+config S3C24XX_DMAC
+       tristate "Samsung S3C24XX DMA support"
+       depends on ARCH_S3C24XX && !S3C24XX_DMA
+       select DMA_ENGINE
+       select DMA_VIRTUAL_CHANNELS
+       help
+         Support for the Samsung S3C24XX DMA controller driver. The
+         DMA controller is having multiple DMA channels which can be
+         configured for different peripherals like audio, UART, SPI.
+         The DMA controller can transfer data from memory to peripheral,
+         periphal to memory, periphal to periphal and memory to memory.
+
 source "drivers/dma/sh/Kconfig"
 
 config COH901318
index db89035b362612304a3334ab5c9834770cab1303..0ce2da97e42972b82a61197a4fe4bb52c35ceac4 100644 (file)
@@ -30,6 +30,7 @@ obj-$(CONFIG_SIRF_DMA) += sirf-dma.o
 obj-$(CONFIG_TI_EDMA) += edma.o
 obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o
 obj-$(CONFIG_TEGRA20_APB_DMA) += tegra20-apb-dma.o
+obj-$(CONFIG_S3C24XX_DMAC) += s3c24xx-dma.o
 obj-$(CONFIG_PL330_DMA) += pl330.o
 obj-$(CONFIG_PCH_DMA) += pch_dma.o
 obj-$(CONFIG_AMBA_PL08X) += amba-pl08x.o
diff --git a/drivers/dma/s3c24xx-dma.c b/drivers/dma/s3c24xx-dma.c
new file mode 100644 (file)
index 0000000..4cb1279
--- /dev/null
@@ -0,0 +1,1350 @@
+/*
+ * S3C24XX DMA handling
+ *
+ * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
+ *
+ * based on amba-pl08x.c
+ *
+ * Copyright (c) 2006 ARM Ltd.
+ * Copyright (c) 2010 ST-Ericsson SA
+ *
+ * Author: Peter Pearse <peter.pearse@arm.com>
+ * Author: Linus Walleij <linus.walleij@stericsson.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.
+ *
+ * The DMA controllers in S3C24XX SoCs have a varying number of DMA signals
+ * that can be routed to any of the 4 to 8 hardware-channels.
+ *
+ * Therefore on these DMA controllers the number of channels
+ * and the number of incoming DMA signals are two totally different things.
+ * It is usually not possible to theoretically handle all physical signals,
+ * so a multiplexing scheme with possible denial of use is necessary.
+ *
+ * Open items:
+ * - bursts
+ */
+
+#include <linux/platform_device.h>
+#include <linux/types.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/interrupt.h>
+#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/platform_data/dma-s3c24xx.h>
+
+#include "dmaengine.h"
+#include "virt-dma.h"
+
+#define MAX_DMA_CHANNELS       8
+
+#define S3C24XX_DISRC                  0x00
+#define S3C24XX_DISRCC                 0x04
+#define S3C24XX_DISRCC_INC_INCREMENT   0
+#define S3C24XX_DISRCC_INC_FIXED       BIT(0)
+#define S3C24XX_DISRCC_LOC_AHB         0
+#define S3C24XX_DISRCC_LOC_APB         BIT(1)
+
+#define S3C24XX_DIDST                  0x08
+#define S3C24XX_DIDSTC                 0x0c
+#define S3C24XX_DIDSTC_INC_INCREMENT   0
+#define S3C24XX_DIDSTC_INC_FIXED       BIT(0)
+#define S3C24XX_DIDSTC_LOC_AHB         0
+#define S3C24XX_DIDSTC_LOC_APB         BIT(1)
+#define S3C24XX_DIDSTC_INT_TC0         0
+#define S3C24XX_DIDSTC_INT_RELOAD      BIT(2)
+
+#define S3C24XX_DCON                   0x10
+
+#define S3C24XX_DCON_TC_MASK           0xfffff
+#define S3C24XX_DCON_DSZ_BYTE          (0 << 20)
+#define S3C24XX_DCON_DSZ_HALFWORD      (1 << 20)
+#define S3C24XX_DCON_DSZ_WORD          (2 << 20)
+#define S3C24XX_DCON_DSZ_MASK          (3 << 20)
+#define S3C24XX_DCON_DSZ_SHIFT         20
+#define S3C24XX_DCON_AUTORELOAD                0
+#define S3C24XX_DCON_NORELOAD          BIT(22)
+#define S3C24XX_DCON_HWTRIG            BIT(23)
+#define S3C24XX_DCON_HWSRC_SHIFT       24
+#define S3C24XX_DCON_SERV_SINGLE       0
+#define S3C24XX_DCON_SERV_WHOLE                BIT(27)
+#define S3C24XX_DCON_TSZ_UNIT          0
+#define S3C24XX_DCON_TSZ_BURST4                BIT(28)
+#define S3C24XX_DCON_INT               BIT(29)
+#define S3C24XX_DCON_SYNC_PCLK         0
+#define S3C24XX_DCON_SYNC_HCLK         BIT(30)
+#define S3C24XX_DCON_DEMAND            0
+#define S3C24XX_DCON_HANDSHAKE         BIT(31)
+
+#define S3C24XX_DSTAT                  0x14
+#define S3C24XX_DSTAT_STAT_BUSY                BIT(20)
+#define S3C24XX_DSTAT_CURRTC_MASK      0xfffff
+
+#define S3C24XX_DMASKTRIG              0x20
+#define S3C24XX_DMASKTRIG_SWTRIG       BIT(0)
+#define S3C24XX_DMASKTRIG_ON           BIT(1)
+#define S3C24XX_DMASKTRIG_STOP         BIT(2)
+
+#define S3C24XX_DMAREQSEL              0x24
+#define S3C24XX_DMAREQSEL_HW           BIT(0)
+
+/*
+ * S3C2410, S3C2440 and S3C2442 SoCs cannot select any physical channel
+ * for a DMA source. Instead only specific channels are valid.
+ * All of these SoCs have 4 physical channels and the number of request
+ * source bits is 3. Additionally we also need 1 bit to mark the channel
+ * as valid.
+ * Therefore we separate the chansel element of the channel data into 4
+ * parts of 4 bits each, to hold the information if the channel is valid
+ * and the hw request source to use.
+ *
+ * Example:
+ * SDI is valid on channels 0, 2 and 3 - with varying hw request sources.
+ * For it the chansel field would look like
+ *
+ * ((BIT(3) | 1) << 3 * 4) | // channel 3, with request source 1
+ * ((BIT(3) | 2) << 2 * 4) | // channel 2, with request source 2
+ * ((BIT(3) | 2) << 0 * 4)   // channel 0, with request source 2
+ */
+#define S3C24XX_CHANSEL_WIDTH          4
+#define S3C24XX_CHANSEL_VALID          BIT(3)
+#define S3C24XX_CHANSEL_REQ_MASK       7
+
+/*
+ * struct soc_data - vendor-specific config parameters for individual SoCs
+ * @stride: spacing between the registers of each channel
+ * @has_reqsel: does the controller use the newer requestselection mechanism
+ * @has_clocks: are controllable dma-clocks present
+ */
+struct soc_data {
+       int stride;
+       bool has_reqsel;
+       bool has_clocks;
+};
+
+/*
+ * enum s3c24xx_dma_chan_state - holds the virtual channel states
+ * @S3C24XX_DMA_CHAN_IDLE: the channel is idle
+ * @S3C24XX_DMA_CHAN_RUNNING: the channel has allocated a physical transport
+ * channel and is running a transfer on it
+ * @S3C24XX_DMA_CHAN_WAITING: the channel is waiting for a physical transport
+ * channel to become available (only pertains to memcpy channels)
+ */
+enum s3c24xx_dma_chan_state {
+       S3C24XX_DMA_CHAN_IDLE,
+       S3C24XX_DMA_CHAN_RUNNING,
+       S3C24XX_DMA_CHAN_WAITING,
+};
+
+/*
+ * struct s3c24xx_sg - structure containing data per sg
+ * @src_addr: src address of sg
+ * @dst_addr: dst address of sg
+ * @len: transfer len in bytes
+ * @node: node for txd's dsg_list
+ */
+struct s3c24xx_sg {
+       dma_addr_t src_addr;
+       dma_addr_t dst_addr;
+       size_t len;
+       struct list_head node;
+};
+
+/*
+ * struct s3c24xx_txd - wrapper for struct dma_async_tx_descriptor
+ * @vd: virtual DMA descriptor
+ * @dsg_list: list of children sg's
+ * @at: sg currently being transfered
+ * @width: transfer width
+ * @disrcc: value for source control register
+ * @didstc: value for destination control register
+ * @dcon: base value for dcon register
+ */
+struct s3c24xx_txd {
+       struct virt_dma_desc vd;
+       struct list_head dsg_list;
+       struct list_head *at;
+       u8 width;
+       u32 disrcc;
+       u32 didstc;
+       u32 dcon;
+};
+
+struct s3c24xx_dma_chan;
+
+/*
+ * struct s3c24xx_dma_phy - holder for the physical channels
+ * @id: physical index to this channel
+ * @valid: does the channel have all required elements
+ * @base: virtual memory base (remapped) for the this channel
+ * @irq: interrupt for this channel
+ * @clk: clock for this channel
+ * @lock: a lock to use when altering an instance of this struct
+ * @serving: virtual channel currently being served by this physicalchannel
+ * @host: a pointer to the host (internal use)
+ */
+struct s3c24xx_dma_phy {
+       unsigned int                    id;
+       bool                            valid;
+       void __iomem                    *base;
+       unsigned int                    irq;
+       struct clk                      *clk;
+       spinlock_t                      lock;
+       struct s3c24xx_dma_chan         *serving;
+       struct s3c24xx_dma_engine       *host;
+};
+
+/*
+ * struct s3c24xx_dma_chan - this structure wraps a DMA ENGINE channel
+ * @id: the id of the channel
+ * @name: name of the channel
+ * @vc: wrappped virtual channel
+ * @phy: the physical channel utilized by this channel, if there is one
+ * @runtime_addr: address for RX/TX according to the runtime config
+ * @at: active transaction on this channel
+ * @lock: a lock for this channel data
+ * @host: a pointer to the host (internal use)
+ * @state: whether the channel is idle, running etc
+ * @slave: whether this channel is a device (slave) or for memcpy
+ */
+struct s3c24xx_dma_chan {
+       int id;
+       const char *name;
+       struct virt_dma_chan vc;
+       struct s3c24xx_dma_phy *phy;
+       struct dma_slave_config cfg;
+       struct s3c24xx_txd *at;
+       struct s3c24xx_dma_engine *host;
+       enum s3c24xx_dma_chan_state state;
+       bool slave;
+};
+
+/*
+ * struct s3c24xx_dma_engine - the local state holder for the S3C24XX
+ * @pdev: the corresponding platform device
+ * @pdata: platform data passed in from the platform/machine
+ * @base: virtual memory base (remapped)
+ * @slave: slave engine for this instance
+ * @memcpy: memcpy engine for this instance
+ * @phy_chans: array of data for the physical channels
+ */
+struct s3c24xx_dma_engine {
+       struct platform_device                  *pdev;
+       const struct s3c24xx_dma_platdata       *pdata;
+       struct soc_data                         *sdata;
+       void __iomem                            *base;
+       struct dma_device                       slave;
+       struct dma_device                       memcpy;
+       struct s3c24xx_dma_phy                  *phy_chans;
+};
+
+/*
+ * Physical channel handling
+ */
+
+/*
+ * Check whether a certain channel is busy or not.
+ */
+static int s3c24xx_dma_phy_busy(struct s3c24xx_dma_phy *phy)
+{
+       unsigned int val = readl(phy->base + S3C24XX_DSTAT);
+       return val & S3C24XX_DSTAT_STAT_BUSY;
+}
+
+static bool s3c24xx_dma_phy_valid(struct s3c24xx_dma_chan *s3cchan,
+                                 struct s3c24xx_dma_phy *phy)
+{
+       struct s3c24xx_dma_engine *s3cdma = s3cchan->host;
+       const struct s3c24xx_dma_platdata *pdata = s3cdma->pdata;
+       struct s3c24xx_dma_channel *cdata = &pdata->channels[s3cchan->id];
+       int phyvalid;
+
+       /* every phy is valid for memcopy channels */
+       if (!s3cchan->slave)
+               return true;
+
+       /* On newer variants all phys can be used for all virtual channels */
+       if (s3cdma->sdata->has_reqsel)
+               return true;
+
+       phyvalid = (cdata->chansel >> (phy->id * S3C24XX_CHANSEL_WIDTH));
+       return (phyvalid & S3C24XX_CHANSEL_VALID) ? true : false;
+}
+
+/*
+ * Allocate a physical channel for a virtual channel
+ *
+ * Try to locate a physical channel to be used for this transfer. If all
+ * are taken return NULL and the requester will have to cope by using
+ * some fallback PIO mode or retrying later.
+ */
+static
+struct s3c24xx_dma_phy *s3c24xx_dma_get_phy(struct s3c24xx_dma_chan *s3cchan)
+{
+       struct s3c24xx_dma_engine *s3cdma = s3cchan->host;
+       const struct s3c24xx_dma_platdata *pdata = s3cdma->pdata;
+       struct s3c24xx_dma_channel *cdata;
+       struct s3c24xx_dma_phy *phy = NULL;
+       unsigned long flags;
+       int i;
+       int ret;
+
+       if (s3cchan->slave)
+               cdata = &pdata->channels[s3cchan->id];
+
+       for (i = 0; i < s3cdma->pdata->num_phy_channels; i++) {
+               phy = &s3cdma->phy_chans[i];
+
+               if (!phy->valid)
+                       continue;
+
+               if (!s3c24xx_dma_phy_valid(s3cchan, phy))
+                       continue;
+
+               spin_lock_irqsave(&phy->lock, flags);
+
+               if (!phy->serving) {
+                       phy->serving = s3cchan;
+                       spin_unlock_irqrestore(&phy->lock, flags);
+                       break;
+               }
+
+               spin_unlock_irqrestore(&phy->lock, flags);
+       }
+
+       /* No physical channel available, cope with it */
+       if (i == s3cdma->pdata->num_phy_channels) {
+               dev_warn(&s3cdma->pdev->dev, "no phy channel available\n");
+               return NULL;
+       }
+
+       /* start the phy clock */
+       if (s3cdma->sdata->has_clocks) {
+               ret = clk_enable(phy->clk);
+               if (ret) {
+                       dev_err(&s3cdma->pdev->dev, "could not enable clock for channel %d, err %d\n",
+                               phy->id, ret);
+                       phy->serving = NULL;
+                       return NULL;
+               }
+       }
+
+       return phy;
+}
+
+/*
+ * Mark the physical channel as free.
+ *
+ * This drops the link between the physical and virtual channel.
+ */
+static inline void s3c24xx_dma_put_phy(struct s3c24xx_dma_phy *phy)
+{
+       struct s3c24xx_dma_engine *s3cdma = phy->host;
+
+       if (s3cdma->sdata->has_clocks)
+               clk_disable(phy->clk);
+
+       phy->serving = NULL;
+}
+
+/*
+ * Stops the channel by writing the stop bit.
+ * This should not be used for an on-going transfer, but as a method of
+ * shutting down a channel (eg, when it's no longer used) or terminating a
+ * transfer.
+ */
+static void s3c24xx_dma_terminate_phy(struct s3c24xx_dma_phy *phy)
+{
+       writel(S3C24XX_DMASKTRIG_STOP, phy->base + S3C24XX_DMASKTRIG);
+}
+
+/*
+ * Virtual channel handling
+ */
+
+static inline
+struct s3c24xx_dma_chan *to_s3c24xx_dma_chan(struct dma_chan *chan)
+{
+       return container_of(chan, struct s3c24xx_dma_chan, vc.chan);
+}
+
+static u32 s3c24xx_dma_getbytes_chan(struct s3c24xx_dma_chan *s3cchan)
+{
+       struct s3c24xx_dma_phy *phy = s3cchan->phy;
+       struct s3c24xx_txd *txd = s3cchan->at;
+       u32 tc = readl(phy->base + S3C24XX_DSTAT) & S3C24XX_DSTAT_CURRTC_MASK;
+
+       return tc * txd->width;
+}
+
+static int s3c24xx_dma_set_runtime_config(struct s3c24xx_dma_chan *s3cchan,
+                                 struct dma_slave_config *config)
+{
+       if (!s3cchan->slave)
+               return -EINVAL;
+
+       /* Reject definitely invalid configurations */
+       if (config->src_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES ||
+           config->dst_addr_width == DMA_SLAVE_BUSWIDTH_8_BYTES)
+               return -EINVAL;
+
+       s3cchan->cfg = *config;
+
+       return 0;
+}
+
+/*
+ * Transfer handling
+ */
+
+static inline
+struct s3c24xx_txd *to_s3c24xx_txd(struct dma_async_tx_descriptor *tx)
+{
+       return container_of(tx, struct s3c24xx_txd, vd.tx);
+}
+
+static struct s3c24xx_txd *s3c24xx_dma_get_txd(void)
+{
+       struct s3c24xx_txd *txd = kzalloc(sizeof(*txd), GFP_NOWAIT);
+
+       if (txd) {
+               INIT_LIST_HEAD(&txd->dsg_list);
+               txd->dcon = S3C24XX_DCON_INT | S3C24XX_DCON_NORELOAD;
+       }
+
+       return txd;
+}
+
+static void s3c24xx_dma_free_txd(struct s3c24xx_txd *txd)
+{
+       struct s3c24xx_sg *dsg, *_dsg;
+
+       list_for_each_entry_safe(dsg, _dsg, &txd->dsg_list, node) {
+               list_del(&dsg->node);
+               kfree(dsg);
+       }
+
+       kfree(txd);
+}
+
+static void s3c24xx_dma_start_next_sg(struct s3c24xx_dma_chan *s3cchan,
+                                      struct s3c24xx_txd *txd)
+{
+       struct s3c24xx_dma_engine *s3cdma = s3cchan->host;
+       struct s3c24xx_dma_phy *phy = s3cchan->phy;
+       const struct s3c24xx_dma_platdata *pdata = s3cdma->pdata;
+       struct s3c24xx_sg *dsg = list_entry(txd->at, struct s3c24xx_sg, node);
+       u32 dcon = txd->dcon;
+       u32 val;
+
+       /* transfer-size and -count from len and width */
+       switch (txd->width) {
+       case 1:
+               dcon |= S3C24XX_DCON_DSZ_BYTE | dsg->len;
+               break;
+       case 2:
+               dcon |= S3C24XX_DCON_DSZ_HALFWORD | (dsg->len / 2);
+               break;
+       case 4:
+               dcon |= S3C24XX_DCON_DSZ_WORD | (dsg->len / 4);
+               break;
+       }
+
+       if (s3cchan->slave) {
+               struct s3c24xx_dma_channel *cdata =
+                                       &pdata->channels[s3cchan->id];
+
+               if (s3cdma->sdata->has_reqsel) {
+                       writel_relaxed((cdata->chansel << 1) |
+                                                       S3C24XX_DMAREQSEL_HW,
+                                       phy->base + S3C24XX_DMAREQSEL);
+               } else {
+                       int csel = cdata->chansel >> (phy->id *
+                                                       S3C24XX_CHANSEL_WIDTH);
+
+                       csel &= S3C24XX_CHANSEL_REQ_MASK;
+                       dcon |= csel << S3C24XX_DCON_HWSRC_SHIFT;
+                       dcon |= S3C24XX_DCON_HWTRIG;
+               }
+       } else {
+               if (s3cdma->sdata->has_reqsel)
+                       writel_relaxed(0, phy->base + S3C24XX_DMAREQSEL);
+       }
+
+       writel_relaxed(dsg->src_addr, phy->base + S3C24XX_DISRC);
+       writel_relaxed(txd->disrcc, phy->base + S3C24XX_DISRCC);
+       writel_relaxed(dsg->dst_addr, phy->base + S3C24XX_DIDST);
+       writel_relaxed(txd->didstc, phy->base + S3C24XX_DIDSTC);
+       writel_relaxed(dcon, phy->base + S3C24XX_DCON);
+
+       val = readl_relaxed(phy->base + S3C24XX_DMASKTRIG);
+       val &= ~S3C24XX_DMASKTRIG_STOP;
+       val |= S3C24XX_DMASKTRIG_ON;
+
+       /* trigger the dma operation for memcpy transfers */
+       if (!s3cchan->slave)
+               val |= S3C24XX_DMASKTRIG_SWTRIG;
+
+       writel(val, phy->base + S3C24XX_DMASKTRIG);
+}
+
+/*
+ * Set the initial DMA register values and start first sg.
+ */
+static void s3c24xx_dma_start_next_txd(struct s3c24xx_dma_chan *s3cchan)
+{
+       struct s3c24xx_dma_phy *phy = s3cchan->phy;
+       struct virt_dma_desc *vd = vchan_next_desc(&s3cchan->vc);
+       struct s3c24xx_txd *txd = to_s3c24xx_txd(&vd->tx);
+
+       list_del(&txd->vd.node);
+
+       s3cchan->at = txd;
+
+       /* Wait for channel inactive */
+       while (s3c24xx_dma_phy_busy(phy))
+               cpu_relax();
+
+       /* point to the first element of the sg list */
+       txd->at = txd->dsg_list.next;
+       s3c24xx_dma_start_next_sg(s3cchan, txd);
+}
+
+static void s3c24xx_dma_free_txd_list(struct s3c24xx_dma_engine *s3cdma,
+                               struct s3c24xx_dma_chan *s3cchan)
+{
+       LIST_HEAD(head);
+
+       vchan_get_all_descriptors(&s3cchan->vc, &head);
+       vchan_dma_desc_free_list(&s3cchan->vc, &head);
+}
+
+/*
+ * Try to allocate a physical channel.  When successful, assign it to
+ * this virtual channel, and initiate the next descriptor.  The
+ * virtual channel lock must be held at this point.
+ */
+static void s3c24xx_dma_phy_alloc_and_start(struct s3c24xx_dma_chan *s3cchan)
+{
+       struct s3c24xx_dma_engine *s3cdma = s3cchan->host;
+       struct s3c24xx_dma_phy *phy;
+
+       phy = s3c24xx_dma_get_phy(s3cchan);
+       if (!phy) {
+               dev_dbg(&s3cdma->pdev->dev, "no physical channel available for xfer on %s\n",
+                       s3cchan->name);
+               s3cchan->state = S3C24XX_DMA_CHAN_WAITING;
+               return;
+       }
+
+       dev_dbg(&s3cdma->pdev->dev, "allocated physical channel %d for xfer on %s\n",
+               phy->id, s3cchan->name);
+
+       s3cchan->phy = phy;
+       s3cchan->state = S3C24XX_DMA_CHAN_RUNNING;
+
+       s3c24xx_dma_start_next_txd(s3cchan);
+}
+
+static void s3c24xx_dma_phy_reassign_start(struct s3c24xx_dma_phy *phy,
+       struct s3c24xx_dma_chan *s3cchan)
+{
+       struct s3c24xx_dma_engine *s3cdma = s3cchan->host;
+
+       dev_dbg(&s3cdma->pdev->dev, "reassigned physical channel %d for xfer on %s\n",
+               phy->id, s3cchan->name);
+
+       /*
+        * We do this without taking the lock; we're really only concerned
+        * about whether this pointer is NULL or not, and we're guaranteed
+        * that this will only be called when it _already_ is non-NULL.
+        */
+       phy->serving = s3cchan;
+       s3cchan->phy = phy;
+       s3cchan->state = S3C24XX_DMA_CHAN_RUNNING;
+       s3c24xx_dma_start_next_txd(s3cchan);
+}
+
+/*
+ * Free a physical DMA channel, potentially reallocating it to another
+ * virtual channel if we have any pending.
+ */
+static void s3c24xx_dma_phy_free(struct s3c24xx_dma_chan *s3cchan)
+{
+       struct s3c24xx_dma_engine *s3cdma = s3cchan->host;
+       struct s3c24xx_dma_chan *p, *next;
+
+retry:
+       next = NULL;
+
+       /* Find a waiting virtual channel for the next transfer. */
+       list_for_each_entry(p, &s3cdma->memcpy.channels, vc.chan.device_node)
+               if (p->state == S3C24XX_DMA_CHAN_WAITING) {
+                       next = p;
+                       break;
+               }
+
+       if (!next) {
+               list_for_each_entry(p, &s3cdma->slave.channels,
+                                   vc.chan.device_node)
+                       if (p->state == S3C24XX_DMA_CHAN_WAITING &&
+                                     s3c24xx_dma_phy_valid(p, s3cchan->phy)) {
+                               next = p;
+                               break;
+                       }
+       }
+
+       /* Ensure that the physical channel is stopped */
+       s3c24xx_dma_terminate_phy(s3cchan->phy);
+
+       if (next) {
+               bool success;
+
+               /*
+                * Eww.  We know this isn't going to deadlock
+                * but lockdep probably doesn't.
+                */
+               spin_lock(&next->vc.lock);
+               /* Re-check the state now that we have the lock */
+               success = next->state == S3C24XX_DMA_CHAN_WAITING;
+               if (success)
+                       s3c24xx_dma_phy_reassign_start(s3cchan->phy, next);
+               spin_unlock(&next->vc.lock);
+
+               /* If the state changed, try to find another channel */
+               if (!success)
+                       goto retry;
+       } else {
+               /* No more jobs, so free up the physical channel */
+               s3c24xx_dma_put_phy(s3cchan->phy);
+       }
+
+       s3cchan->phy = NULL;
+       s3cchan->state = S3C24XX_DMA_CHAN_IDLE;
+}
+
+static void s3c24xx_dma_unmap_buffers(struct s3c24xx_txd *txd)
+{
+       struct device *dev = txd->vd.tx.chan->device->dev;
+       struct s3c24xx_sg *dsg;
+
+       if (!(txd->vd.tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) {
+               if (txd->vd.tx.flags & DMA_COMPL_SRC_UNMAP_SINGLE)
+                       list_for_each_entry(dsg, &txd->dsg_list, node)
+                               dma_unmap_single(dev, dsg->src_addr, dsg->len,
+                                               DMA_TO_DEVICE);
+               else {
+                       list_for_each_entry(dsg, &txd->dsg_list, node)
+                               dma_unmap_page(dev, dsg->src_addr, dsg->len,
+                                               DMA_TO_DEVICE);
+               }
+       }
+
+       if (!(txd->vd.tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) {
+               if (txd->vd.tx.flags & DMA_COMPL_DEST_UNMAP_SINGLE)
+                       list_for_each_entry(dsg, &txd->dsg_list, node)
+                               dma_unmap_single(dev, dsg->dst_addr, dsg->len,
+                                               DMA_FROM_DEVICE);
+               else
+                       list_for_each_entry(dsg, &txd->dsg_list, node)
+                               dma_unmap_page(dev, dsg->dst_addr, dsg->len,
+                                               DMA_FROM_DEVICE);
+       }
+}
+
+static void s3c24xx_dma_desc_free(struct virt_dma_desc *vd)
+{
+       struct s3c24xx_txd *txd = to_s3c24xx_txd(&vd->tx);
+       struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(vd->tx.chan);
+
+       if (!s3cchan->slave)
+               s3c24xx_dma_unmap_buffers(txd);
+
+       s3c24xx_dma_free_txd(txd);
+}
+
+static irqreturn_t s3c24xx_dma_irq(int irq, void *data)
+{
+       struct s3c24xx_dma_phy *phy = data;
+       struct s3c24xx_dma_chan *s3cchan = phy->serving;
+       struct s3c24xx_txd *txd;
+
+       dev_dbg(&phy->host->pdev->dev, "interrupt on channel %d\n", phy->id);
+
+       /*
+        * Interrupts happen to notify the completion of a transfer and the
+        * channel should have moved into its stop state already on its own.
+        * Therefore interrupts on channels not bound to a virtual channel
+        * should never happen. Nevertheless send a terminate command to the
+        * channel if the unlikely case happens.
+        */
+       if (unlikely(!s3cchan)) {
+               dev_err(&phy->host->pdev->dev, "interrupt on unused channel %d\n",
+                       phy->id);
+
+               s3c24xx_dma_terminate_phy(phy);
+
+               return IRQ_HANDLED;
+       }
+
+       spin_lock(&s3cchan->vc.lock);
+       txd = s3cchan->at;
+       if (txd) {
+               /* when more sg's are in this txd, start the next one */
+               if (!list_is_last(txd->at, &txd->dsg_list)) {
+                       txd->at = txd->at->next;
+                       s3c24xx_dma_start_next_sg(s3cchan, txd);
+               } else {
+                       s3cchan->at = NULL;
+                       vchan_cookie_complete(&txd->vd);
+
+                       /*
+                        * And start the next descriptor (if any),
+                        * otherwise free this channel.
+                        */
+                       if (vchan_next_desc(&s3cchan->vc))
+                               s3c24xx_dma_start_next_txd(s3cchan);
+                       else
+                               s3c24xx_dma_phy_free(s3cchan);
+               }
+       }
+       spin_unlock(&s3cchan->vc.lock);
+
+       return IRQ_HANDLED;
+}
+
+/*
+ * The DMA ENGINE API
+ */
+
+static int s3c24xx_dma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
+                        unsigned long arg)
+{
+       struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan);
+       struct s3c24xx_dma_engine *s3cdma = s3cchan->host;
+       unsigned long flags;
+       int ret = 0;
+
+       spin_lock_irqsave(&s3cchan->vc.lock, flags);
+
+       switch (cmd) {
+       case DMA_SLAVE_CONFIG:
+               ret = s3c24xx_dma_set_runtime_config(s3cchan,
+                                             (struct dma_slave_config *)arg);
+               break;
+       case DMA_TERMINATE_ALL:
+               if (!s3cchan->phy && !s3cchan->at) {
+                       dev_err(&s3cdma->pdev->dev, "trying to terminate already stopped channel %d\n",
+                               s3cchan->id);
+                       ret = -EINVAL;
+                       break;
+               }
+
+               s3cchan->state = S3C24XX_DMA_CHAN_IDLE;
+
+                /* Mark physical channel as free */
+               if (s3cchan->phy)
+                       s3c24xx_dma_phy_free(s3cchan);
+
+               /* Dequeue current job */
+               if (s3cchan->at) {
+                       s3c24xx_dma_desc_free(&s3cchan->at->vd);
+                       s3cchan->at = NULL;
+               }
+
+               /* Dequeue jobs not yet fired as well */
+               s3c24xx_dma_free_txd_list(s3cdma, s3cchan);
+               break;
+       default:
+               /* Unknown command */
+               ret = -ENXIO;
+               break;
+       }
+
+       spin_unlock_irqrestore(&s3cchan->vc.lock, flags);
+
+       return ret;
+}
+
+static int s3c24xx_dma_alloc_chan_resources(struct dma_chan *chan)
+{
+       return 0;
+}
+
+static void s3c24xx_dma_free_chan_resources(struct dma_chan *chan)
+{
+       /* Ensure all queued descriptors are freed */
+       vchan_free_chan_resources(to_virt_chan(chan));
+}
+
+static enum dma_status s3c24xx_dma_tx_status(struct dma_chan *chan,
+               dma_cookie_t cookie, struct dma_tx_state *txstate)
+{
+       struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan);
+       struct s3c24xx_txd *txd;
+       struct s3c24xx_sg *dsg;
+       struct virt_dma_desc *vd;
+       unsigned long flags;
+       enum dma_status ret;
+       size_t bytes = 0;
+
+       spin_lock_irqsave(&s3cchan->vc.lock, flags);
+       ret = dma_cookie_status(chan, cookie, txstate);
+       if (ret == DMA_SUCCESS) {
+               spin_unlock_irqrestore(&s3cchan->vc.lock, flags);
+               return ret;
+       }
+
+       /*
+        * There's no point calculating the residue if there's
+        * no txstate to store the value.
+        */
+       if (!txstate) {
+               spin_unlock_irqrestore(&s3cchan->vc.lock, flags);
+               return ret;
+       }
+
+       vd = vchan_find_desc(&s3cchan->vc, cookie);
+       if (vd) {
+               /* On the issued list, so hasn't been processed yet */
+               txd = to_s3c24xx_txd(&vd->tx);
+
+               list_for_each_entry(dsg, &txd->dsg_list, node)
+                       bytes += dsg->len;
+       } else {
+               /*
+                * Currently running, so sum over the pending sg's and
+                * the currently active one.
+                */
+               txd = s3cchan->at;
+
+               dsg = list_entry(txd->at, struct s3c24xx_sg, node);
+               list_for_each_entry_from(dsg, &txd->dsg_list, node)
+                       bytes += dsg->len;
+
+               bytes += s3c24xx_dma_getbytes_chan(s3cchan);
+       }
+       spin_unlock_irqrestore(&s3cchan->vc.lock, flags);
+
+       /*
+        * This cookie not complete yet
+        * Get number of bytes left in the active transactions and queue
+        */
+       dma_set_residue(txstate, bytes);
+
+       /* Whether waiting or running, we're in progress */
+       return ret;
+}
+
+/*
+ * Initialize a descriptor to be used by memcpy submit
+ */
+static struct dma_async_tx_descriptor *s3c24xx_dma_prep_memcpy(
+               struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
+               size_t len, unsigned long flags)
+{
+       struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan);
+       struct s3c24xx_dma_engine *s3cdma = s3cchan->host;
+       struct s3c24xx_txd *txd;
+       struct s3c24xx_sg *dsg;
+       int src_mod, dest_mod;
+
+       dev_dbg(&s3cdma->pdev->dev, "prepare memcpy of %d bytes from %s\n",
+                       len, s3cchan->name);
+
+       if ((len & S3C24XX_DCON_TC_MASK) != len) {
+               dev_err(&s3cdma->pdev->dev, "memcpy size %d to large\n", len);
+               return NULL;
+       }
+
+       txd = s3c24xx_dma_get_txd();
+       if (!txd)
+               return NULL;
+
+       dsg = kzalloc(sizeof(*dsg), GFP_NOWAIT);
+       if (!dsg) {
+               s3c24xx_dma_free_txd(txd);
+               return NULL;
+       }
+       list_add_tail(&dsg->node, &txd->dsg_list);
+
+       dsg->src_addr = src;
+       dsg->dst_addr = dest;
+       dsg->len = len;
+
+       /*
+        * Determine a suitable transfer width.
+        * The DMA controller cannot fetch/store information which is not
+        * naturally aligned on the bus, i.e., a 4 byte fetch must start at
+        * an address divisible by 4 - more generally addr % width must be 0.
+        */
+       src_mod = src % 4;
+       dest_mod = dest % 4;
+       switch (len % 4) {
+       case 0:
+               txd->width = (src_mod == 0 && dest_mod == 0) ? 4 : 1;
+               break;
+       case 2:
+               txd->width = ((src_mod == 2 || src_mod == 0) &&
+                             (dest_mod == 2 || dest_mod == 0)) ? 2 : 1;
+               break;
+       default:
+               txd->width = 1;
+               break;
+       }
+
+       txd->disrcc = S3C24XX_DISRCC_LOC_AHB | S3C24XX_DISRCC_INC_INCREMENT;
+       txd->didstc = S3C24XX_DIDSTC_LOC_AHB | S3C24XX_DIDSTC_INC_INCREMENT;
+       txd->dcon |= S3C24XX_DCON_DEMAND | S3C24XX_DCON_SYNC_HCLK |
+                    S3C24XX_DCON_SERV_WHOLE;
+
+       return vchan_tx_prep(&s3cchan->vc, &txd->vd, flags);
+}
+
+static struct dma_async_tx_descriptor *s3c24xx_dma_prep_slave_sg(
+               struct dma_chan *chan, struct scatterlist *sgl,
+               unsigned int sg_len, enum dma_transfer_direction direction,
+               unsigned long flags, void *context)
+{
+       struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan);
+       struct s3c24xx_dma_engine *s3cdma = s3cchan->host;
+       const struct s3c24xx_dma_platdata *pdata = s3cdma->pdata;
+       struct s3c24xx_dma_channel *cdata = &pdata->channels[s3cchan->id];
+       struct s3c24xx_txd *txd;
+       struct s3c24xx_sg *dsg;
+       struct scatterlist *sg;
+       dma_addr_t slave_addr;
+       u32 hwcfg = 0;
+       int tmp;
+
+       dev_dbg(&s3cdma->pdev->dev, "prepare transaction of %d bytes from %s\n",
+                       sg_dma_len(sgl), s3cchan->name);
+
+       txd = s3c24xx_dma_get_txd();
+       if (!txd)
+               return NULL;
+
+       if (cdata->handshake)
+               txd->dcon |= S3C24XX_DCON_HANDSHAKE;
+
+       switch (cdata->bus) {
+       case S3C24XX_DMA_APB:
+               txd->dcon |= S3C24XX_DCON_SYNC_PCLK;
+               hwcfg |= S3C24XX_DISRCC_LOC_APB;
+               break;
+       case S3C24XX_DMA_AHB:
+               txd->dcon |= S3C24XX_DCON_SYNC_HCLK;
+               hwcfg |= S3C24XX_DISRCC_LOC_AHB;
+               break;
+       }
+
+       /*
+        * Always assume our peripheral desintation is a fixed
+        * address in memory.
+        */
+       hwcfg |= S3C24XX_DISRCC_INC_FIXED;
+
+       /*
+        * Individual dma operations are requested by the slave,
+        * so serve only single atomic operations (S3C24XX_DCON_SERV_SINGLE).
+        */
+       txd->dcon |= S3C24XX_DCON_SERV_SINGLE;
+
+       if (direction == DMA_MEM_TO_DEV) {
+               txd->disrcc = S3C24XX_DISRCC_LOC_AHB |
+                             S3C24XX_DISRCC_INC_INCREMENT;
+               txd->didstc = hwcfg;
+               slave_addr = s3cchan->cfg.dst_addr;
+               txd->width = s3cchan->cfg.dst_addr_width;
+       } else if (direction == DMA_DEV_TO_MEM) {
+               txd->disrcc = hwcfg;
+               txd->didstc = S3C24XX_DIDSTC_LOC_AHB |
+                             S3C24XX_DIDSTC_INC_INCREMENT;
+               slave_addr = s3cchan->cfg.src_addr;
+               txd->width = s3cchan->cfg.src_addr_width;
+       } else {
+               s3c24xx_dma_free_txd(txd);
+               dev_err(&s3cdma->pdev->dev,
+                       "direction %d unsupported\n", direction);
+               return NULL;
+       }
+
+       for_each_sg(sgl, sg, sg_len, tmp) {
+               dsg = kzalloc(sizeof(*dsg), GFP_NOWAIT);
+               if (!dsg) {
+                       s3c24xx_dma_free_txd(txd);
+                       return NULL;
+               }
+               list_add_tail(&dsg->node, &txd->dsg_list);
+
+               dsg->len = sg_dma_len(sg);
+               if (direction == DMA_MEM_TO_DEV) {
+                       dsg->src_addr = sg_dma_address(sg);
+                       dsg->dst_addr = slave_addr;
+               } else { /* DMA_DEV_TO_MEM */
+                       dsg->src_addr = slave_addr;
+                       dsg->dst_addr = sg_dma_address(sg);
+               }
+               break;
+       }
+
+       return vchan_tx_prep(&s3cchan->vc, &txd->vd, flags);
+}
+
+/*
+ * Slave transactions callback to the slave device to allow
+ * synchronization of slave DMA signals with the DMAC enable
+ */
+static void s3c24xx_dma_issue_pending(struct dma_chan *chan)
+{
+       struct s3c24xx_dma_chan *s3cchan = to_s3c24xx_dma_chan(chan);
+       unsigned long flags;
+
+       spin_lock_irqsave(&s3cchan->vc.lock, flags);
+       if (vchan_issue_pending(&s3cchan->vc)) {
+               if (!s3cchan->phy && s3cchan->state != S3C24XX_DMA_CHAN_WAITING)
+                       s3c24xx_dma_phy_alloc_and_start(s3cchan);
+       }
+       spin_unlock_irqrestore(&s3cchan->vc.lock, flags);
+}
+
+/*
+ * Bringup and teardown
+ */
+
+/*
+ * Initialise the DMAC memcpy/slave channels.
+ * Make a local wrapper to hold required data
+ */
+static int s3c24xx_dma_init_virtual_channels(struct s3c24xx_dma_engine *s3cdma,
+               struct dma_device *dmadev, unsigned int channels, bool slave)
+{
+       struct s3c24xx_dma_chan *chan;
+       int i;
+
+       INIT_LIST_HEAD(&dmadev->channels);
+
+       /*
+        * Register as many many memcpy as we have physical channels,
+        * we won't always be able to use all but the code will have
+        * to cope with that situation.
+        */
+       for (i = 0; i < channels; i++) {
+               chan = devm_kzalloc(dmadev->dev, sizeof(*chan), GFP_KERNEL);
+               if (!chan) {
+                       dev_err(dmadev->dev,
+                               "%s no memory for channel\n", __func__);
+                       return -ENOMEM;
+               }
+
+               chan->id = i;
+               chan->host = s3cdma;
+               chan->state = S3C24XX_DMA_CHAN_IDLE;
+
+               if (slave) {
+                       chan->slave = true;
+                       chan->name = kasprintf(GFP_KERNEL, "slave%d", i);
+                       if (!chan->name)
+                               return -ENOMEM;
+               } else {
+                       chan->name = kasprintf(GFP_KERNEL, "memcpy%d", i);
+                       if (!chan->name)
+                               return -ENOMEM;
+               }
+               dev_dbg(dmadev->dev,
+                        "initialize virtual channel \"%s\"\n",
+                        chan->name);
+
+               chan->vc.desc_free = s3c24xx_dma_desc_free;
+               vchan_init(&chan->vc, dmadev);
+       }
+       dev_info(dmadev->dev, "initialized %d virtual %s channels\n",
+                i, slave ? "slave" : "memcpy");
+       return i;
+}
+
+static void s3c24xx_dma_free_virtual_channels(struct dma_device *dmadev)
+{
+       struct s3c24xx_dma_chan *chan = NULL;
+       struct s3c24xx_dma_chan *next;
+
+       list_for_each_entry_safe(chan,
+                                next, &dmadev->channels, vc.chan.device_node)
+               list_del(&chan->vc.chan.device_node);
+}
+
+/* s3c2410, s3c2440 and s3c2442 have a 0x40 stride without separate clocks */
+static struct soc_data soc_s3c2410 = {
+       .stride = 0x40,
+       .has_reqsel = false,
+       .has_clocks = false,
+};
+
+/* s3c2412 and s3c2413 have a 0x40 stride and dmareqsel mechanism */
+static struct soc_data soc_s3c2412 = {
+       .stride = 0x40,
+       .has_reqsel = true,
+       .has_clocks = true,
+};
+
+/* s3c2443 and following have a 0x100 stride and dmareqsel mechanism */
+static struct soc_data soc_s3c2443 = {
+       .stride = 0x100,
+       .has_reqsel = true,
+       .has_clocks = true,
+};
+
+static struct platform_device_id s3c24xx_dma_driver_ids[] = {
+       {
+               .name           = "s3c2410-dma",
+               .driver_data    = (kernel_ulong_t)&soc_s3c2410,
+       }, {
+               .name           = "s3c2412-dma",
+               .driver_data    = (kernel_ulong_t)&soc_s3c2412,
+       }, {
+               .name           = "s3c2443-dma",
+               .driver_data    = (kernel_ulong_t)&soc_s3c2443,
+       },
+       { },
+};
+
+static struct soc_data *s3c24xx_dma_get_soc_data(struct platform_device *pdev)
+{
+       return (struct soc_data *)
+                        platform_get_device_id(pdev)->driver_data;
+}
+
+static int s3c24xx_dma_probe(struct platform_device *pdev)
+{
+       const struct s3c24xx_dma_platdata *pdata = dev_get_platdata(&pdev->dev);
+       struct s3c24xx_dma_engine *s3cdma;
+       struct soc_data *sdata;
+       struct resource *res;
+       int ret;
+       int i;
+
+       if (!pdata) {
+               dev_err(&pdev->dev, "platform data missing\n");
+               return -ENODEV;
+       }
+
+       /* Basic sanity check */
+       if (pdata->num_phy_channels > MAX_DMA_CHANNELS) {
+               dev_err(&pdev->dev, "to many dma channels %d, max %d\n",
+                       pdata->num_phy_channels, MAX_DMA_CHANNELS);
+               return -EINVAL;
+       }
+
+       sdata = s3c24xx_dma_get_soc_data(pdev);
+       if (!sdata)
+               return -EINVAL;
+
+       s3cdma = devm_kzalloc(&pdev->dev, sizeof(*s3cdma), GFP_KERNEL);
+       if (!s3cdma)
+               return -ENOMEM;
+
+       s3cdma->pdev = pdev;
+       s3cdma->pdata = pdata;
+       s3cdma->sdata = sdata;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       s3cdma->base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(s3cdma->base))
+               return PTR_ERR(s3cdma->base);
+
+       s3cdma->phy_chans = devm_kzalloc(&pdev->dev,
+                                             sizeof(struct s3c24xx_dma_phy) *
+                                                       pdata->num_phy_channels,
+                                             GFP_KERNEL);
+       if (!s3cdma->phy_chans)
+               return -ENOMEM;
+
+       /* aquire irqs and clocks for all physical channels */
+       for (i = 0; i < pdata->num_phy_channels; i++) {
+               struct s3c24xx_dma_phy *phy = &s3cdma->phy_chans[i];
+               char clk_name[6];
+
+               phy->id = i;
+               phy->base = s3cdma->base + (i * sdata->stride);
+               phy->host = s3cdma;
+
+               phy->irq = platform_get_irq(pdev, i);
+               if (phy->irq < 0) {
+                       dev_err(&pdev->dev, "failed to get irq %d, err %d\n",
+                               i, phy->irq);
+                       continue;
+               }
+
+               ret = devm_request_irq(&pdev->dev, phy->irq, s3c24xx_dma_irq,
+                                      0, pdev->name, phy);
+               if (ret) {
+                       dev_err(&pdev->dev, "Unable to request irq for channel %d, error %d\n",
+                               i, ret);
+                       continue;
+               }
+
+               if (sdata->has_clocks) {
+                       sprintf(clk_name, "dma.%d", i);
+                       phy->clk = devm_clk_get(&pdev->dev, clk_name);
+                       if (IS_ERR(phy->clk) && sdata->has_clocks) {
+                               dev_err(&pdev->dev, "unable to aquire clock for channel %d, error %lu",
+                                       i, PTR_ERR(phy->clk));
+                               continue;
+                       }
+
+                       ret = clk_prepare(phy->clk);
+                       if (ret) {
+                               dev_err(&pdev->dev, "clock for phy %d failed, error %d\n",
+                                       i, ret);
+                               continue;
+                       }
+               }
+
+               spin_lock_init(&phy->lock);
+               phy->valid = true;
+
+               dev_dbg(&pdev->dev, "physical channel %d is %s\n",
+                       i, s3c24xx_dma_phy_busy(phy) ? "BUSY" : "FREE");
+       }
+
+       /* Initialize memcpy engine */
+       dma_cap_set(DMA_MEMCPY, s3cdma->memcpy.cap_mask);
+       dma_cap_set(DMA_PRIVATE, s3cdma->memcpy.cap_mask);
+       s3cdma->memcpy.dev = &pdev->dev;
+       s3cdma->memcpy.device_alloc_chan_resources =
+                                       s3c24xx_dma_alloc_chan_resources;
+       s3cdma->memcpy.device_free_chan_resources =
+                                       s3c24xx_dma_free_chan_resources;
+       s3cdma->memcpy.device_prep_dma_memcpy = s3c24xx_dma_prep_memcpy;
+       s3cdma->memcpy.device_tx_status = s3c24xx_dma_tx_status;
+       s3cdma->memcpy.device_issue_pending = s3c24xx_dma_issue_pending;
+       s3cdma->memcpy.device_control = s3c24xx_dma_control;
+
+       /* Initialize slave engine for SoC internal dedicated peripherals */
+       dma_cap_set(DMA_SLAVE, s3cdma->slave.cap_mask);
+       dma_cap_set(DMA_PRIVATE, s3cdma->slave.cap_mask);
+       s3cdma->slave.dev = &pdev->dev;
+       s3cdma->slave.device_alloc_chan_resources =
+                                       s3c24xx_dma_alloc_chan_resources;
+       s3cdma->slave.device_free_chan_resources =
+                                       s3c24xx_dma_free_chan_resources;
+       s3cdma->slave.device_tx_status = s3c24xx_dma_tx_status;
+       s3cdma->slave.device_issue_pending = s3c24xx_dma_issue_pending;
+       s3cdma->slave.device_prep_slave_sg = s3c24xx_dma_prep_slave_sg;
+       s3cdma->slave.device_control = s3c24xx_dma_control;
+
+       /* Register as many memcpy channels as there are physical channels */
+       ret = s3c24xx_dma_init_virtual_channels(s3cdma, &s3cdma->memcpy,
+                                               pdata->num_phy_channels, false);
+       if (ret <= 0) {
+               dev_warn(&pdev->dev,
+                        "%s failed to enumerate memcpy channels - %d\n",
+                        __func__, ret);
+               goto err_memcpy;
+       }
+
+       /* Register slave channels */
+       ret = s3c24xx_dma_init_virtual_channels(s3cdma, &s3cdma->slave,
+                               pdata->num_channels, true);
+       if (ret <= 0) {
+               dev_warn(&pdev->dev,
+                       "%s failed to enumerate slave channels - %d\n",
+                               __func__, ret);
+               goto err_slave;
+       }
+
+       ret = dma_async_device_register(&s3cdma->memcpy);
+       if (ret) {
+               dev_warn(&pdev->dev,
+                       "%s failed to register memcpy as an async device - %d\n",
+                       __func__, ret);
+               goto err_memcpy_reg;
+       }
+
+       ret = dma_async_device_register(&s3cdma->slave);
+       if (ret) {
+               dev_warn(&pdev->dev,
+                       "%s failed to register slave as an async device - %d\n",
+                       __func__, ret);
+               goto err_slave_reg;
+       }
+
+       platform_set_drvdata(pdev, s3cdma);
+       dev_info(&pdev->dev, "Loaded dma driver with %d physical channels\n",
+                pdata->num_phy_channels);
+
+       return 0;
+
+err_slave_reg:
+       dma_async_device_unregister(&s3cdma->memcpy);
+err_memcpy_reg:
+       s3c24xx_dma_free_virtual_channels(&s3cdma->slave);
+err_slave:
+       s3c24xx_dma_free_virtual_channels(&s3cdma->memcpy);
+err_memcpy:
+       if (sdata->has_clocks)
+               for (i = 0; i < pdata->num_phy_channels; i++) {
+                       struct s3c24xx_dma_phy *phy = &s3cdma->phy_chans[i];
+                       if (phy->valid)
+                               clk_unprepare(phy->clk);
+               }
+
+       return ret;
+}
+
+static int s3c24xx_dma_remove(struct platform_device *pdev)
+{
+       const struct s3c24xx_dma_platdata *pdata = dev_get_platdata(&pdev->dev);
+       struct s3c24xx_dma_engine *s3cdma = platform_get_drvdata(pdev);
+       struct soc_data *sdata = s3c24xx_dma_get_soc_data(pdev);
+       int i;
+
+       dma_async_device_unregister(&s3cdma->slave);
+       dma_async_device_unregister(&s3cdma->memcpy);
+
+       s3c24xx_dma_free_virtual_channels(&s3cdma->slave);
+       s3c24xx_dma_free_virtual_channels(&s3cdma->memcpy);
+
+       if (sdata->has_clocks)
+               for (i = 0; i < pdata->num_phy_channels; i++) {
+                       struct s3c24xx_dma_phy *phy = &s3cdma->phy_chans[i];
+                       if (phy->valid)
+                               clk_unprepare(phy->clk);
+               }
+
+       return 0;
+}
+
+static struct platform_driver s3c24xx_dma_driver = {
+       .driver         = {
+               .name   = "s3c24xx-dma",
+               .owner  = THIS_MODULE,
+       },
+       .id_table       = s3c24xx_dma_driver_ids,
+       .probe          = s3c24xx_dma_probe,
+       .remove         = s3c24xx_dma_remove,
+};
+
+module_platform_driver(s3c24xx_dma_driver);
+
+bool s3c24xx_dma_filter(struct dma_chan *chan, void *param)
+{
+       struct s3c24xx_dma_chan *s3cchan;
+
+       if (chan->device->dev->driver != &s3c24xx_dma_driver.driver)
+               return false;
+
+       s3cchan = to_s3c24xx_dma_chan(chan);
+
+       return s3cchan->id == (int)param;
+}
+EXPORT_SYMBOL(s3c24xx_dma_filter);
+
+MODULE_DESCRIPTION("S3C24XX DMA Driver");
+MODULE_AUTHOR("Heiko Stuebner");
+MODULE_LICENSE("GPL v2");
index 29b5d6777dc541dc9c55e1bdf1df93237117b364..76e02b9460e63abe14ccbc4aa348929f1e9c2259 100644 (file)
@@ -1033,7 +1033,7 @@ static int s3c24xx_gpiolib_fbank_to_irq(struct gpio_chip *chip, unsigned offset)
 }
 #endif
 
-#ifdef CONFIG_PLAT_S3C64XX
+#ifdef CONFIG_ARCH_S3C64XX
 static int s3c64xx_gpiolib_mbank_to_irq(struct gpio_chip *chip, unsigned pin)
 {
        return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO;
@@ -1174,7 +1174,7 @@ struct samsung_gpio_chip s3c24xx_gpios[] = {
  */
 
 static struct samsung_gpio_chip s3c64xx_gpios_4bit[] = {
-#ifdef CONFIG_PLAT_S3C64XX
+#ifdef CONFIG_ARCH_S3C64XX
        {
                .chip   = {
                        .base   = S3C64XX_GPA(0),
@@ -1227,7 +1227,7 @@ static struct samsung_gpio_chip s3c64xx_gpios_4bit[] = {
 };
 
 static struct samsung_gpio_chip s3c64xx_gpios_4bit2[] = {
-#ifdef CONFIG_PLAT_S3C64XX
+#ifdef CONFIG_ARCH_S3C64XX
        {
                .base   = S3C64XX_GPH_BASE + 0x4,
                .chip   = {
@@ -1257,7 +1257,7 @@ static struct samsung_gpio_chip s3c64xx_gpios_4bit2[] = {
 };
 
 static struct samsung_gpio_chip s3c64xx_gpios_2bit[] = {
-#ifdef CONFIG_PLAT_S3C64XX
+#ifdef CONFIG_ARCH_S3C64XX
        {
                .base   = S3C64XX_GPF_BASE,
                .config = &samsung_gpio_cfgs[6],
index 868ed40cb6bf070ba5b6b5a4156cda73f54fa9fa..40e6440348ff5d9ace76ff17510bbf40ae648415 100644 (file)
@@ -171,8 +171,7 @@ static struct irq_domain_ops combiner_irq_domain_ops = {
 
 static void __init combiner_init(void __iomem *combiner_base,
                                 struct device_node *np,
-                                unsigned int max_nr,
-                                int irq_base)
+                                unsigned int max_nr)
 {
        int i, irq;
        unsigned int nr_irq;
@@ -186,7 +185,7 @@ static void __init combiner_init(void __iomem *combiner_base,
                return;
        }
 
-       combiner_irq_domain = irq_domain_add_simple(np, nr_irq, irq_base,
+       combiner_irq_domain = irq_domain_add_linear(np, nr_irq,
                                &combiner_irq_domain_ops, combiner_data);
        if (WARN_ON(!combiner_irq_domain)) {
                pr_warning("%s: irq domain init failed\n", __func__);
@@ -207,7 +206,6 @@ static int __init combiner_of_init(struct device_node *np,
 {
        void __iomem *combiner_base;
        unsigned int max_nr = 20;
-       int irq_base = -1;
 
        combiner_base = of_iomap(np, 0);
        if (!combiner_base) {
@@ -221,14 +219,7 @@ static int __init combiner_of_init(struct device_node *np,
                        __func__, max_nr);
        }
 
-       /* 
-        * FIXME: This is a hardwired COMBINER_IRQ(0,0). Once all devices
-        * get their IRQ from DT, remove this in order to get dynamic
-        * allocation.
-        */
-       irq_base = 160;
-
-       combiner_init(combiner_base, np, max_nr, irq_base);
+       combiner_init(combiner_base, np, max_nr);
 
        return 0;
 }
index c7caf94621b418b351f19c040267c98754e4a924..eb70dda8cbf362c83ab53503eec1948ea5f36004 100644 (file)
@@ -112,7 +112,7 @@ config VIDEO_OMAP3_DEBUG
 config VIDEO_S3C_CAMIF
        tristate "Samsung S3C24XX/S3C64XX SoC Camera Interface driver"
        depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
-       depends on (PLAT_S3C64XX || PLAT_S3C24XX) && PM_RUNTIME
+       depends on (ARCH_S3C64XX || PLAT_S3C24XX) && PM_RUNTIME
        select VIDEOBUF2_DMA_CONTIG
        ---help---
          This is a v4l2 driver for s3c24xx and s3c64xx SoC series camera
diff --git a/include/linux/platform_data/dma-s3c24xx.h b/include/linux/platform_data/dma-s3c24xx.h
new file mode 100644 (file)
index 0000000..89ba1b0
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * S3C24XX DMA handling
+ *
+ * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
+ *
+ * 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.
+ */
+
+/* Helper to encode the source selection constraints for early s3c socs. */
+#define S3C24XX_DMA_CHANREQ(src, chan) ((BIT(3) | src) << chan * 4)
+
+enum s3c24xx_dma_bus {
+       S3C24XX_DMA_APB,
+       S3C24XX_DMA_AHB,
+};
+
+/**
+ * @bus: on which bus does the peripheral reside - AHB or APB.
+ * @handshake: is a handshake with the peripheral necessary
+ * @chansel: channel selection information, depending on variant; reqsel for
+ *          s3c2443 and later and channel-selection map for earlier SoCs
+ *          see CHANSEL doc in s3c2443-dma.c
+ */
+struct s3c24xx_dma_channel {
+       enum s3c24xx_dma_bus bus;
+       bool handshake;
+       u16 chansel;
+};
+
+/**
+ * struct s3c24xx_dma_platdata - platform specific settings
+ * @num_phy_channels: number of physical channels
+ * @channels: array of virtual channel descriptions
+ * @num_channels: number of virtual channels
+ */
+struct s3c24xx_dma_platdata {
+       int num_phy_channels;
+       struct s3c24xx_dma_channel *channels;
+       int num_channels;
+};
+
+struct dma_chan;
+bool s3c24xx_dma_filter(struct dma_chan *chan, void *param);
index 2eea1840315d3448248109215f216d2f607c0b89..37459dfd168d3d16362330cdf0ba047d29d41e97 100644 (file)
@@ -2,7 +2,7 @@ config SND_SOC_SAMSUNG
        tristate "ASoC support for Samsung"
        depends on PLAT_SAMSUNG
        select S3C64XX_DMA if ARCH_S3C64XX
-       select S3C2410_DMA if ARCH_S3C24XX
+       select S3C24XX_DMA if ARCH_S3C24XX
        help
          Say Y or M if you want to add support for codecs attached to
          the Samsung SoCs' Audio interfaces. You will also need to
index e5e81b11100108dbb724de7eedb0193836351253..fefc56100349d5c6c8d8c4a5015eebed545779ac 100644 (file)
 #undef S3C_IIS_V2_SUPPORTED
 
 #if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413) \
-       || defined(CONFIG_CPU_S5PV210)
-#define S3C_IIS_V2_SUPPORTED
-#endif
-
-#ifdef CONFIG_PLAT_S3C64XX
+       || defined(CONFIG_ARCH_S3C64XX) || defined(CONFIG_CPU_S5PV210)
 #define S3C_IIS_V2_SUPPORTED
 #endif