x86: ich6_gpio: Add use-lvl-write-cache for I/O access mode

Add a device-tree property use-lvl-write-cache that will cause
writes to lvl to be cached instead of read from lvl before each
write. This is required on some platforms that have the register
implemented as dual read/write (such as Baytrail).

Prior to this fix the blue USB port on the Minnowboard Max was
unusable since USB_HOST_EN0 was set high then immediately set
low when USB_HOST_EN1 was written.

This also resolves the 'gpio clear | set' command warning like:
  "Warning: value of pin is still 0"

Signed-off-by: George McCollister <george.mccollister@gmail.com>
<rebased on latest origin/master, fixed all baytrail boards>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/arch/x86/dts/bayleybay.dts b/arch/x86/dts/bayleybay.dts
index 18b310d..1ae058d 100644
--- a/arch/x86/dts/bayleybay.dts
+++ b/arch/x86/dts/bayleybay.dts
@@ -189,6 +189,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0 0x20>;
 				bank-name = "A";
+				use-lvl-write-cache;
 			};
 
 			gpiob {
@@ -196,6 +197,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x20 0x20>;
 				bank-name = "B";
+				use-lvl-write-cache;
 			};
 
 			gpioc {
@@ -203,6 +205,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x40 0x20>;
 				bank-name = "C";
+				use-lvl-write-cache;
 			};
 
 			gpiod {
@@ -210,6 +213,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x60 0x20>;
 				bank-name = "D";
+				use-lvl-write-cache;
 			};
 
 			gpioe {
@@ -217,6 +221,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x80 0x20>;
 				bank-name = "E";
+				use-lvl-write-cache;
 			};
 
 			gpiof {
@@ -224,6 +229,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0xA0 0x20>;
 				bank-name = "F";
+				use-lvl-write-cache;
 			};
 		};
 	};
diff --git a/arch/x86/dts/baytrail_som-db5800-som-6867.dts b/arch/x86/dts/baytrail_som-db5800-som-6867.dts
index e1d81a7..aa8bfb8 100644
--- a/arch/x86/dts/baytrail_som-db5800-som-6867.dts
+++ b/arch/x86/dts/baytrail_som-db5800-som-6867.dts
@@ -212,6 +212,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0 0x20>;
 				bank-name = "A";
+				use-lvl-write-cache;
 			};
 
 			gpiob {
@@ -219,6 +220,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x20 0x20>;
 				bank-name = "B";
+				use-lvl-write-cache;
 			};
 
 			gpioc {
@@ -226,6 +228,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x40 0x20>;
 				bank-name = "C";
+				use-lvl-write-cache;
 			};
 
 			gpiod {
@@ -233,6 +236,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x60 0x20>;
 				bank-name = "D";
+				use-lvl-write-cache;
 			};
 
 			gpioe {
@@ -240,6 +244,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x80 0x20>;
 				bank-name = "E";
+				use-lvl-write-cache;
 			};
 
 			gpiof {
@@ -247,6 +252,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0xA0 0x20>;
 				bank-name = "F";
+				use-lvl-write-cache;
 			};
 		};
 	};
diff --git a/arch/x86/dts/conga-qeval20-qa3-e3845.dts b/arch/x86/dts/conga-qeval20-qa3-e3845.dts
index f0efe90..898e9c9 100644
--- a/arch/x86/dts/conga-qeval20-qa3-e3845.dts
+++ b/arch/x86/dts/conga-qeval20-qa3-e3845.dts
@@ -199,6 +199,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0 0x20>;
 				bank-name = "A";
+				use-lvl-write-cache;
 			};
 
 			gpiob {
@@ -206,6 +207,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x20 0x20>;
 				bank-name = "B";
+				use-lvl-write-cache;
 			};
 
 			gpioc {
@@ -213,6 +215,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x40 0x20>;
 				bank-name = "C";
+				use-lvl-write-cache;
 			};
 
 			gpiod {
@@ -220,6 +223,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x60 0x20>;
 				bank-name = "D";
+				use-lvl-write-cache;
 			};
 
 			gpioe {
@@ -227,6 +231,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x80 0x20>;
 				bank-name = "E";
+				use-lvl-write-cache;
 			};
 
 			gpiof {
@@ -234,6 +239,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0xA0 0x20>;
 				bank-name = "F";
+				use-lvl-write-cache;
 			};
 		};
 	};
diff --git a/arch/x86/dts/dfi-bt700.dtsi b/arch/x86/dts/dfi-bt700.dtsi
index 75ee6ad..546981a 100644
--- a/arch/x86/dts/dfi-bt700.dtsi
+++ b/arch/x86/dts/dfi-bt700.dtsi
@@ -201,6 +201,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0 0x20>;
 				bank-name = "A";
+				use-lvl-write-cache;
 			};
 
 			gpiob {
@@ -208,6 +209,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x20 0x20>;
 				bank-name = "B";
+				use-lvl-write-cache;
 			};
 
 			gpioc {
@@ -215,6 +217,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x40 0x20>;
 				bank-name = "C";
+				use-lvl-write-cache;
 			};
 
 			gpiod {
@@ -222,6 +225,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x60 0x20>;
 				bank-name = "D";
+				use-lvl-write-cache;
 			};
 
 			gpioe {
@@ -229,6 +233,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x80 0x20>;
 				bank-name = "E";
+				use-lvl-write-cache;
 			};
 
 			gpiof {
@@ -236,6 +241,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0xA0 0x20>;
 				bank-name = "F";
+				use-lvl-write-cache;
 			};
 		};
 	};
diff --git a/arch/x86/dts/minnowmax.dts b/arch/x86/dts/minnowmax.dts
index d51318b..bc382a8 100644
--- a/arch/x86/dts/minnowmax.dts
+++ b/arch/x86/dts/minnowmax.dts
@@ -218,6 +218,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0 0x20>;
 				bank-name = "A";
+				use-lvl-write-cache;
 			};
 
 			gpiob {
@@ -225,6 +226,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x20 0x20>;
 				bank-name = "B";
+				use-lvl-write-cache;
 			};
 
 			gpioc {
@@ -232,6 +234,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x40 0x20>;
 				bank-name = "C";
+				use-lvl-write-cache;
 			};
 
 			gpiod {
@@ -239,6 +242,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x60 0x20>;
 				bank-name = "D";
+				use-lvl-write-cache;
 			};
 
 			gpioe {
@@ -246,6 +250,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0x80 0x20>;
 				bank-name = "E";
+				use-lvl-write-cache;
 			};
 
 			gpiof {
@@ -253,6 +258,7 @@
 				u-boot,dm-pre-reloc;
 				reg = <0xA0 0x20>;
 				bank-name = "F";
+				use-lvl-write-cache;
 			};
 		};
 	};