From 2d1c616557c2682cee6a1ecb1259a29674528599 Mon Sep 17 00:00:00 2001
From: Heiko Stuebner <heiko.stuebner@nexst4.de>
Date: Thu, 19 Jan 2012 10:25:20 +0100
Subject: [PATCH 1/2] spi-s3c64xx: move platform data definition from
 arch-specific header

This patch moves the platform data definition for the spi-s3c64xx driver
from an arch-header to a separate one under linux/spi.

As building drivers without references to architecture code is a goal,
only the mach/dma.h reference remains now to be sorted at some point.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-exynos/setup-spi.c                 |    1 +
 arch/arm/mach-s3c64xx/mach-crag6410.c            |    1 +
 arch/arm/mach-s3c64xx/setup-spi.c                |    1 +
 arch/arm/mach-s5p64x0/setup-spi.c                |    1 +
 arch/arm/mach-s5pc100/setup-spi.c                |    1 +
 arch/arm/mach-s5pv210/setup-spi.c                |    1 +
 arch/arm/plat-samsung/devs.c                     |    1 +
 arch/arm/plat-samsung/include/plat/s3c64xx-spi.h |   44 ----------------
 drivers/spi/spi-s3c64xx.c                        |    2 +-
 include/linux/spi/s3c64xx.h                      |   59 ++++++++++++++++++++++
 10 files changed, 67 insertions(+), 45 deletions(-)
 create mode 100644 include/linux/spi/s3c64xx.h

diff --git a/arch/arm/mach-exynos/setup-spi.c b/arch/arm/mach-exynos/setup-spi.c
index 833ff40..551ea88 100644
--- a/arch/arm/mach-exynos/setup-spi.c
+++ b/arch/arm/mach-exynos/setup-spi.c
@@ -10,6 +10,7 @@
 
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/spi/s3c64xx.h>
 
 #include <plat/gpio-cfg.h>
 #include <plat/s3c64xx-spi.h>
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 7539a29..d456370 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -29,6 +29,7 @@
 #include <linux/gpio_keys.h>
 #include <linux/basic_mmio_gpio.h>
 #include <linux/spi/spi.h>
+#include <linux/spi/s3c64xx.h>
 
 #include <linux/i2c/pca953x.h>
 
diff --git a/arch/arm/mach-s3c64xx/setup-spi.c b/arch/arm/mach-s3c64xx/setup-spi.c
index d9592ad..e60ac78 100644
--- a/arch/arm/mach-s3c64xx/setup-spi.c
+++ b/arch/arm/mach-s3c64xx/setup-spi.c
@@ -10,6 +10,7 @@
 
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/spi/s3c64xx.h>
 
 #include <plat/gpio-cfg.h>
 #include <plat/s3c64xx-spi.h>
diff --git a/arch/arm/mach-s5p64x0/setup-spi.c b/arch/arm/mach-s5p64x0/setup-spi.c
index e9b8412..3d2eeb3 100644
--- a/arch/arm/mach-s5p64x0/setup-spi.c
+++ b/arch/arm/mach-s5p64x0/setup-spi.c
@@ -11,6 +11,7 @@
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/spi/s3c64xx.h>
 
 #include <plat/gpio-cfg.h>
 #include <plat/cpu.h>
diff --git a/arch/arm/mach-s5pc100/setup-spi.c b/arch/arm/mach-s5pc100/setup-spi.c
index 431a6f7..c5bc230 100644
--- a/arch/arm/mach-s5pc100/setup-spi.c
+++ b/arch/arm/mach-s5pc100/setup-spi.c
@@ -10,6 +10,7 @@
 
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/spi/s3c64xx.h>
 
 #include <plat/gpio-cfg.h>
 #include <plat/s3c64xx-spi.h>
diff --git a/arch/arm/mach-s5pv210/setup-spi.c b/arch/arm/mach-s5pv210/setup-spi.c
index f43c504..a993b82c 100644
--- a/arch/arm/mach-s5pv210/setup-spi.c
+++ b/arch/arm/mach-s5pv210/setup-spi.c
@@ -10,6 +10,7 @@
 
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/spi/s3c64xx.h>
 
 #include <plat/gpio-cfg.h>
 #include <plat/s3c64xx-spi.h>
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 145580a..c5668d2 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -30,6 +30,7 @@
 #include <linux/mmc/host.h>
 #include <linux/ioport.h>
 #include <linux/platform_data/s3c-hsudc.h>
+#include <linux/spi/s3c64xx.h>
 
 #include <asm/irq.h>
 #include <asm/pmu.h>
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
index fa95e9a..e25fc20 100644
--- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
+++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
@@ -14,50 +14,6 @@
 struct platform_device;
 
 /**
- * struct s3c64xx_spi_csinfo - ChipSelect description
- * @fb_delay: Slave specific feedback delay.
- *            Refer to FB_CLK_SEL register definition in SPI chapter.
- * @line: Custom 'identity' of the CS line.
- * @set_level: CS line control.
- *
- * This is per SPI-Slave Chipselect information.
- * Allocate and initialize one in machine init code and make the
- * spi_board_info.controller_data point to it.
- */
-struct s3c64xx_spi_csinfo {
-	u8 fb_delay;
-	unsigned line;
-	void (*set_level)(unsigned line_id, int lvl);
-};
-
-/**
- * struct s3c64xx_spi_info - SPI Controller defining structure
- * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
- * @clk_from_cmu: If the SPI clock/prescalar control block is present
- *     by the platform's clock-management-unit and not in SPI controller.
- * @num_cs: Number of CS this controller emulates.
- * @cfg_gpio: Configure pins for this SPI controller.
- * @fifo_lvl_mask: All tx fifo_lvl fields start at offset-6
- * @rx_lvl_offset: Depends on tx fifo_lvl field and bus number
- * @high_speed: If the controller supports HIGH_SPEED_EN bit
- * @tx_st_done: Depends on tx fifo_lvl field
- */
-struct s3c64xx_spi_info {
-	int src_clk_nr;
-	bool clk_from_cmu;
-
-	int num_cs;
-
-	int (*cfg_gpio)(struct platform_device *pdev);
-
-	/* Following two fields are for future compatibility */
-	int fifo_lvl_mask;
-	int rx_lvl_offset;
-	int high_speed;
-	int tx_st_done;
-};
-
-/**
  * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
  *				initialization code.
  * @pd: SPI platform data to set.
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index dcf7e10..e30006d 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -27,7 +27,7 @@
 #include <linux/spi/spi.h>
 
 #include <mach/dma.h>
-#include <plat/s3c64xx-spi.h>
+#include <linux/spi/s3c64xx.h>
 
 /* Registers and bit-fields */
 
diff --git a/include/linux/spi/s3c64xx.h b/include/linux/spi/s3c64xx.h
new file mode 100644
index 0000000..31cf023
--- /dev/null
+++ b/include/linux/spi/s3c64xx.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2009 Samsung Electronics Ltd.
+ *	Jaswinder Singh <jassi.brar@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __SPI_S3C64XX_H
+#define __SPI_S3C64XX_H
+
+struct platform_device;
+
+/**
+ * struct s3c64xx_spi_csinfo - ChipSelect description
+ * @fb_delay: Slave specific feedback delay.
+ *            Refer to FB_CLK_SEL register definition in SPI chapter.
+ * @line: Custom 'identity' of the CS line.
+ * @set_level: CS line control.
+ *
+ * This is per SPI-Slave Chipselect information.
+ * Allocate and initialize one in machine init code and make the
+ * spi_board_info.controller_data point to it.
+ */
+struct s3c64xx_spi_csinfo {
+	u8 fb_delay;
+	unsigned line;
+	void (*set_level)(unsigned line_id, int lvl);
+};
+
+/**
+ * struct s3c64xx_spi_info - SPI Controller defining structure
+ * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
+ * @clk_from_cmu: If the SPI clock/prescalar control block is present
+ *     by the platform's clock-management-unit and not in SPI controller.
+ * @num_cs: Number of CS this controller emulates.
+ * @cfg_gpio: Configure pins for this SPI controller.
+ * @fifo_lvl_mask: All tx fifo_lvl fields start at offset-6
+ * @rx_lvl_offset: Depends on tx fifo_lvl field and bus number
+ * @high_speed: If the controller supports HIGH_SPEED_EN bit
+ * @tx_st_done: Depends on tx fifo_lvl field
+ */
+struct s3c64xx_spi_info {
+	int src_clk_nr;
+	bool clk_from_cmu;
+
+	int num_cs;
+
+	int (*cfg_gpio)(struct platform_device *pdev);
+
+	/* Following two fields are for future compatibility */
+	int fifo_lvl_mask;
+	int rx_lvl_offset;
+	int high_speed;
+	int tx_st_done;
+};
+
+#endif /* __SPI_S3C64XX_H */
-- 
1.7.5.4

