clearfog: Add two MCP23S17 GPIO expanders

FIXME: This needs a kernel patch for proper CS GPIO on Orion. Without
that patch, the CS-GPIO feature would end up activating HW GPIO#0, which
is wrong.

FIXME: This needs a kernel patch for the irq-open-drain operation, too.

Change-Id: I2715304ddc013beb625a5cbbebf0fd97f305c9d1
diff --git a/board/czechlight/clearfog/czechlight-clearfog.dts b/board/czechlight/clearfog/czechlight-clearfog.dts
index 983773c..30bc5b1 100644
--- a/board/czechlight/clearfog/czechlight-clearfog.dts
+++ b/board/czechlight/clearfog/czechlight-clearfog.dts
@@ -65,18 +65,31 @@
 		gpio-hog;
 		gpios = <22 GPIO_ACTIVE_HIGH>;
 		input;
-		line-name = "MAX14830-int";
+		line-name = "MAX14830-MCP23S17-int";
+	};
+};
+
+&gpio0 {
+	gpio_cs {
+		gpio-hog;
+		gpios = <22 GPIO_ACTIVE_HIGH>;
+		output-high;
+		line-name = "MCP23S17-CS";
 	};
 };
 
 &spi1 {
 	reg = <MBUS_ID(0xf0, 0x01) 0x10680 0x50> /* control */
 		, <MBUS_ID(0x01, 0x1a) 0 0xffffffff> /* CS0 */
-		, <MBUS_ID(0x01, 0x5a) 0 0xffffffff> /* CS1 */
+		, <0>
+		/* <MBUS_ID(0x01, 0x5a) 0 0xffffffff>
+		We're using CS GPIO which doesn't play well with the direct mode at all */
 		, <MBUS_ID(0x01, 0x9a) 0 0xffffffff> /* CS2 */
 		, <MBUS_ID(0x01, 0xda) 0 0xffffffff> /* CS3 */
 		;
 
+	cs-gpios = <0>, <&gpio0 22 GPIO_ACTIVE_HIGH>, <0>;
+
 	max14830: max14830@2 {
 		compatible = "maxim,max14830";
 		reg = <2>;
@@ -88,4 +101,19 @@
 		#gpio-cells = <2>;
 		spi-max-frequency = <26000000>;
 	};
+
+	gpio_spi_chips: gpio@1 {
+		compatible = "microchip,mcp23s17";
+		reg = <1>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <22 IRQ_TYPE_LEVEL_LOW>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		microchip,spi-present-mask = <0x06>; /* extra addresses 1 and 2 */
+		microchip,irq-mirror;
+		microchip,irq-open-drain;
+		spi-max-frequency = <10000000>;
+	};
 };
diff --git a/board/czechlight/clearfog/linux.fragment b/board/czechlight/clearfog/linux.fragment
index 724d3c5..83cd006 100644
--- a/board/czechlight/clearfog/linux.fragment
+++ b/board/czechlight/clearfog/linux.fragment
@@ -17,3 +17,6 @@
 
 # Extra I2C bus for the PSUs
 CONFIG_I2C_GPIO=y
+
+# SPI GPIO expander
+CONFIG_PINCTRL_MCP23S08=y