WindCharger: Created board configuration for gfmn100.

Change-Id: I0f5ca6c26baedf6f629d68189a868a8e40ec4edb
diff --git a/arch/mips/ath79/Kconfig b/arch/mips/ath79/Kconfig
index 0218feb..0933f72 100644
--- a/arch/mips/ath79/Kconfig
+++ b/arch/mips/ath79/Kconfig
@@ -792,7 +792,7 @@
 	select ATH79_DEV_SPI
 	select ATH79_DEV_WMAC
 	select ATH79_DEV_ETH
-	select ATH79_DEV_M25P80
+	select ATH79_DEV_GFMN100
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Google Fiber windcharger board.
@@ -861,6 +861,10 @@
 	select ATH79_DEV_SPI
 	def_bool n
 
+config ATH79_DEV_GFMN100
+	select ATH70_DEV_SPI
+	def_bool n
+
 config ATH79_DEV_DSA
 	def_bool n
 
diff --git a/arch/mips/ath79/Makefile b/arch/mips/ath79/Makefile
index 42b77ea..9f9c6e5 100644
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
@@ -25,6 +25,7 @@
 obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS)	+= dev-gpio-buttons.o
 obj-$(CONFIG_ATH79_DEV_LEDS_GPIO)	+= dev-leds-gpio.o
 obj-$(CONFIG_ATH79_DEV_M25P80)		+= dev-m25p80.o
+obj-$(CONFIG_ATH79_DEV_GFMN100)		+= dev-gfmn100.o
 obj-$(CONFIG_ATH79_DEV_NAND)		+= dev-nand.o
 obj-$(CONFIG_ATH79_DEV_NFC)		+= dev-nfc.o
 obj-$(CONFIG_ATH79_DEV_SPI)		+= dev-spi.o
diff --git a/arch/mips/ath79/dev-gfmn100.c b/arch/mips/ath79/dev-gfmn100.c
new file mode 100644
index 0000000..3b2b958
--- /dev/null
+++ b/arch/mips/ath79/dev-gfmn100.c
@@ -0,0 +1,66 @@
+/*
+ * From the header:
+ *
+ * This outlines the configuration (namely pins for SPI drivers)
+ * of the GFMN100 "WindCharger" board.
+ *
+ * GFMN100 Contains:
+ *
+ * -- One mx25l25655e nonvolatile storage device
+ * -- One lm95071 temperature sensor
+ */
+
+#include <linux/init.h>
+#include <linux/spi/spi.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
+#include "common.h"
+#include "dev-spi.h"
+#include "dev-gfmn100.h"
+
+#define GFMN100_LM95071_CS 14         /* GPIO pin for temp sensor */
+#define GFMN100_LM95071_HZ 5000000    /* max SPI clk speed */
+#define GFMN100_LM95071_MA "lm95071"  /* Modalias */
+
+#define GFMN100_BUS 0
+
+static struct ath79_spi_controller_data ath79_spi0_cdata = {
+  .cs_type = ATH79_SPI_CS_TYPE_INTERNAL,
+  .cs_line = 0,
+  .is_flash = true,
+};
+
+static struct ath79_spi_controller_data ath79_spi1_cdata = {
+  .cs_type = ATH79_SPI_CS_TYPE_GPIO,
+  .cs_line = GFMN100_LM95071_CS,
+  .is_flash = false,
+};
+
+static struct spi_board_info ath79_spi_info[] = {
+  {
+    .bus_num = GFMN100_BUS,
+    .chip_select = 0,
+    .max_speed_hz = 25000000,
+    .modalias = "mx25l25655e",
+    .controller_data = &ath79_spi0_cdata,
+  },
+  {
+    .bus_num = GFMN100_BUS,
+    .chip_select = 1,
+    .max_speed_hz = GFMN100_LM95071_HZ,
+    .modalias = GFMN100_LM95071_MA,
+    .controller_data = &ath79_spi1_cdata,
+  },
+};
+
+struct ath79_spi_platform_data ath79_spi_data;
+
+void __init ath79_register_gfmn100(void)
+{
+  ssize_t cs_count = ARRAY_SIZE(ath79_spi_info);
+  ath79_spi_data.bus_num = GFMN100_BUS;
+  ath79_spi_data.num_chipselect = cs_count;
+  ath79_gpio_direction_select(GFMN100_LM95071_CS, true);
+  ath79_register_spi(&ath79_spi_data, ath79_spi_info, cs_count);
+}
diff --git a/arch/mips/ath79/dev-gfmn100.h b/arch/mips/ath79/dev-gfmn100.h
new file mode 100644
index 0000000..3066b79
--- /dev/null
+++ b/arch/mips/ath79/dev-gfmn100.h
@@ -0,0 +1,20 @@
+/*
+ * This outlines the configuration (namely pins for SPI drivers)
+ * of the GFMN100 "WindCharger" board.
+ *
+ * GFMN100 Contains:
+ *
+ * -- One mx25l25655e nonvolatile storage device
+ * -- One lm95071 temperature sensor
+ */
+
+#ifndef __ATH79_DEV_GFMN100_H__
+#define __ATH79_DEV_GFMN100_H__
+
+#include <linux/spi/flash.h>
+
+extern struct ath79_spi_platform_data ath79_spi_data;
+
+void ath79_register_gfmn100(void) __init;
+
+#endif  /* __ATH79_DEV_GFMN100_H__ */
diff --git a/arch/mips/ath79/mach-gf-windcharger.c b/arch/mips/ath79/mach-gf-windcharger.c
index 1ebcfbd..c48f8de 100644
--- a/arch/mips/ath79/mach-gf-windcharger.c
+++ b/arch/mips/ath79/mach-gf-windcharger.c
@@ -28,7 +28,7 @@
 
 #include "common.h"
 #include "dev-eth.h"
-#include "dev-m25p80.h"
+#include "dev-gfmn100.h"
 #include "dev-spi.h"
 #include "dev-usb.h"
 #include "dev-wmac.h"
@@ -42,7 +42,7 @@
 {
 	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
 
-	ath79_register_m25p80(NULL);
+	ath79_register_gfmn100();
 
 	ath79_register_wmac(art + AP143_WMAC_CALDATA_OFFSET, NULL);