From 0534e2c79c419cdd89e19e1c8dda45105f861280 Mon Sep 17 00:00:00 2001
From: Zoltan Herpai <wigyori@uid0.hu>
Date: Thu, 20 Mar 2014 21:40:07 +0000
Subject: [PATCH] sunxi: various changes - fix mmc, sata, usb (partially) on
 CubieTruck - fix hstimer DT on A20

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
Signed-off-by: Zalan Blenessy <zalan.blenessy@gmail.com>

SVN-Revision: 39971
---
 .../146-3-dt-sun7i-a20-add-hstimer.patch      |  8 ++--
 .../164-2-dt-sun7i-add-ahci.patch             |  3 +-
 .../patches-3.13/173-3-dt-sun7i-add-mmc.patch | 19 +++++++++
 .../184-5-dt-sun7i-add-ehci-cubietruck.patch  | 39 +++++++++++++++++++
 4 files changed, 64 insertions(+), 5 deletions(-)
 create mode 100644 target/linux/sunxi/patches-3.13/184-5-dt-sun7i-add-ehci-cubietruck.patch

diff --git a/target/linux/sunxi/patches-3.13/146-3-dt-sun7i-a20-add-hstimer.patch b/target/linux/sunxi/patches-3.13/146-3-dt-sun7i-a20-add-hstimer.patch
index dea8e6b0ae..dc9ce4f9e9 100644
--- a/target/linux/sunxi/patches-3.13/146-3-dt-sun7i-a20-add-hstimer.patch
+++ b/target/linux/sunxi/patches-3.13/146-3-dt-sun7i-a20-add-hstimer.patch
@@ -31,10 +31,10 @@ Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
 +		hstimer@01c60000 {
 +			compatible = "allwinner,sun7i-a20-hstimer";
 +			reg = <0x01c60000 0x1000>;
-+			interrupts = <0 81 1>,
-+				     <0 82 1>,
-+				     <0 83 1>,
-+				     <0 84 1>;
++			interrupts = <0 81 4>,
++				     <0 82 4>,
++				     <0 83 4>,
++				     <0 84 4>;
 +			clocks = <&ahb_gates 28>;
 +		};
 +
diff --git a/target/linux/sunxi/patches-3.13/164-2-dt-sun7i-add-ahci.patch b/target/linux/sunxi/patches-3.13/164-2-dt-sun7i-add-ahci.patch
index d43dab8dc8..5a31f926c3 100644
--- a/target/linux/sunxi/patches-3.13/164-2-dt-sun7i-add-ahci.patch
+++ b/target/linux/sunxi/patches-3.13/164-2-dt-sun7i-add-ahci.patch
@@ -70,7 +70,7 @@ index 025ce52..403bd2e 100644
  			led_pins_cubietruck: led_pins@0 {
  				allwinner,pins = "PH7", "PH11", "PH20", "PH21";
  				allwinner,function = "gpio_out";
-@@ -90,4 +103,9 @@
+@@ -90,4 +103,10 @@
  			gpios = <&pio 7 7 0>;
  		};
  	};
@@ -78,6 +78,7 @@ index 025ce52..403bd2e 100644
 +	reg_ahci_5v: ahci-5v {
 +		pinctrl-0 = <&ahci_pwr_pin_cubietruck>;
 +		gpio = <&pio 7 12 0>;
++		status = "okay";
 +	};
  };
 diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
diff --git a/target/linux/sunxi/patches-3.13/173-3-dt-sun7i-add-mmc.patch b/target/linux/sunxi/patches-3.13/173-3-dt-sun7i-add-mmc.patch
index 3fb2c6f0e7..e983863f7e 100644
--- a/target/linux/sunxi/patches-3.13/173-3-dt-sun7i-add-mmc.patch
+++ b/target/linux/sunxi/patches-3.13/173-3-dt-sun7i-add-mmc.patch
@@ -76,6 +76,25 @@ index d5c6799..d4e2355 100644
  			led_pins_olinuxino: led_pins@0 {
  				allwinner,pins = "PH2";
  				allwinner,function = "gpio_out";
+diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+index cb25d3c..66bb3ef 100644
+--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
++++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+@@ -20,6 +20,14 @@
+	compatible = "cubietech,cubietruck", "allwinner,sun7i-a20";
+
+	soc@01c00000 {
++		mmc0: mmc@01c0f000 {
++			pinctrl-names = "default", "default";
++			pinctrl-0 = <&mmc0_pins_a>;
++			pinctrl-1 = <&mmc0_cd_pin_reference_design>;
++			cd-gpios = <&pio 7 1 0>; /* PH1 */
++			status = "okay";
++		};
++
+		ahci: sata@01c18000 {
+			target-supply = <&reg_ahci_5v>;
+			status = "okay";
 diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
 index 3385994..3bc6ac5 100644
 --- a/arch/arm/boot/dts/sun7i-a20.dtsi
diff --git a/target/linux/sunxi/patches-3.13/184-5-dt-sun7i-add-ehci-cubietruck.patch b/target/linux/sunxi/patches-3.13/184-5-dt-sun7i-add-ehci-cubietruck.patch
new file mode 100644
index 0000000000..7912f2018a
--- /dev/null
+++ b/target/linux/sunxi/patches-3.13/184-5-dt-sun7i-add-ehci-cubietruck.patch
@@ -0,0 +1,39 @@
+diff -ruN old/arch/arm/boot/dts/sun7i-a20-cubietruck.dts new/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
+--- old/arch/arm/boot/dts/sun7i-a20-cubietruck.dts	2014-03-18 10:08:24.000000000 +0100
++++ new/arch/arm/boot/dts/sun7i-a20-cubietruck.dts	2014-03-18 10:27:25.142067751 +0100
+@@ -14,12 +14,35 @@
+ /dts-v1/;
+ /include/ "sun7i-a20.dtsi"
+ /include/ "sunxi-ahci-reg.dtsi"
++/include/ "sun4i-a10-usb-vbus-reg.dtsi"
+ 
+ / {
+ 	model = "Cubietech Cubietruck";
+ 	compatible = "cubietech,cubietruck", "allwinner,sun7i-a20";
+ 
+ 	soc@01c00000 {
++		usbphy: phy@01c13400 {
++			usb1_vbus-supply = <&reg_usb1_vbus>;
++			usb2_vbus-supply = <&reg_usb2_vbus>;
++			status = "okay";
++		};
++
++		ehci0: usb@01c14000 {
++			status = "okay";
++		};
++
++		ohci0: usb@01c14400 {
++			status = "okay";
++		};
++
++		ehci1: usb@01c1c000 {
++			status = "okay";
++		};
++
++		ohci1: usb@01c1c400 {
++			status = "okay";
++		};
++
+ 		mmc0: mmc@01c0f000 {
+ 			pinctrl-names = "default", "default";
+ 			pinctrl-0 = <&mmc0_pins_a>;
-- 
GitLab