[linux-yocto] [PATCH 1/2] valleyisland-io: enable board file for PCI mode LPSS support

rebecca.swee.fun.chang at intel.com rebecca.swee.fun.chang at intel.com
Wed Dec 4 23:07:32 PST 2013


From: "Chang, Rebecca Swee Fun" <rebecca.swee.fun.chang at intel.com>

x86/platform: This board file includes clock tree setup and
register SPI devices.

Signed-off-by: Chang, Rebecca Swee Fun <rebecca.swee.fun.chang at intel.com>
---
 ...m-Enable-board-file-for-PCI-mode-LPSS-sup.patch |  138 ++++++++++++++++++++
 1 file changed, 138 insertions(+)
 create mode 100644 meta/cfg/kernel-cache/features/valleyisland-io/0017-x86-platform-Enable-board-file-for-PCI-mode-LPSS-sup.patch

diff --git a/meta/cfg/kernel-cache/features/valleyisland-io/0017-x86-platform-Enable-board-file-for-PCI-mode-LPSS-sup.patch b/meta/cfg/kernel-cache/features/valleyisland-io/0017-x86-platform-Enable-board-file-for-PCI-mode-LPSS-sup.patch
new file mode 100644
index 0000000..a7704c2
--- /dev/null
+++ b/meta/cfg/kernel-cache/features/valleyisland-io/0017-x86-platform-Enable-board-file-for-PCI-mode-LPSS-sup.patch
@@ -0,0 +1,138 @@
+x86/platform: Enable board file for PCI mode LPSS support
+
+This board file includes clock tree setup and register SPI devices.
+
+Signed-off-by: Chang, Rebecca Swee Fun <rebecca.swee.fun.chang at intel.com>
+---
+ arch/x86/Kconfig                  |    4 ++
+ arch/x86/platform/Makefile        |    3 ++
+ arch/x86/platform/byt/Makefile    |    1 +
+ arch/x86/platform/byt/byt-board.c |   82 +++++++++++++++++++++++++++++++++++++
+ 4 files changed, 90 insertions(+)
+ create mode 100644 arch/x86/platform/byt/Makefile
+ create mode 100644 arch/x86/platform/byt/byt-board.c
+
+diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
+index b7843a8..46b0fad 100644
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -463,6 +463,10 @@ config X86_INTEL_LPSS
+ 	  things like clock tree (common clock framework) which are needed
+ 	  by the LPSS peripheral drivers.
+
++config BYT_LPSS_BRD
++        bool "PCI mode LPSS support on BYT"
++        depends on X86_INTEL_LPSS
++
+ config X86_RDC321X
+ 	bool "RDC R-321x SoC"
+ 	depends on X86_32
+diff --git a/arch/x86/platform/Makefile b/arch/x86/platform/Makefile
+index 8d87439..e522a06 100644
+--- a/arch/x86/platform/Makefile
++++ b/arch/x86/platform/Makefile
+@@ -9,3 +9,6 @@ obj-y	+= scx200/
+ obj-y	+= sfi/
+ obj-y	+= visws/
+ obj-y	+= uv/
++ifeq ($(CONFIG_BYT_LPSS_BRD),y)
++obj-y   += byt/
++endif
+diff --git a/arch/x86/platform/byt/Makefile b/arch/x86/platform/byt/Makefile
+new file mode 100644
+index 0000000..2d4af86
+--- /dev/null
++++ b/arch/x86/platform/byt/Makefile
+@@ -0,0 +1 @@
++obj-y    += byt-board.o
+diff --git a/arch/x86/platform/byt/byt-board.c b/arch/x86/platform/byt/byt-board.c
+new file mode 100644
+index 0000000..47c8bbe
+--- /dev/null
++++ b/arch/x86/platform/byt/byt-board.c
+@@ -0,0 +1,82 @@
++#include <linux/init.h>
++#include <linux/module.h>
++#include <linux/device.h>
++#include <linux/clk.h>
++#include <linux/clkdev.h>
++#include <linux/clk-provider.h>
++#include <linux/spi/spidev.h>
++#include <linux/spi/spi.h>
++#include <linux/spi/pxa2xx_spi.h>
++
++static bool disable = 0;
++module_param(disable, bool, 0);
++MODULE_PARM_DESC(disable, "set 1 to disable BYT brd file");
++
++static struct pxa2xx_spi_chip chip_data = {
++	.gpio_cs = -EINVAL,
++	.dma_burst_size = 32,
++};
++
++static struct spi_board_info byt_spi_slaves[] = {
++	{
++	 .modalias = "spidev",
++	 .max_speed_hz = 50000000,
++	 .bus_num = 0,
++	 .chip_select = 0,
++	 .controller_data = &chip_data,
++	 .mode = SPI_MODE_0,
++	}
++};
++
++static int byt_spi_board_setup()
++{
++	int ret = -1;
++
++	/* Register the SPI devices */
++	if (!spi_register_board_info
++		(byt_spi_slaves, ARRAY_SIZE(byt_spi_slaves)))
++		ret = 0;
++
++	return ret;
++}
++
++static int byt_clk_setup()
++{
++	struct clk *clk;
++
++	/* Make clock tree required by the SPI driver */
++	clk = clk_register_fixed_rate(NULL, "lpss_clk", NULL, CLK_IS_ROOT,
++								100000000);
++	if (IS_ERR(clk))
++		return PTR_ERR(clk);
++
++	clk = clk_register_fixed_rate(NULL, "spi_clk", "lpss_clk", 0, 50000000);
++	if (IS_ERR(clk))
++		return PTR_ERR(clk);
++
++	clk_register_clkdev(clk, NULL, "0000:00:1e.5");
++	clk_register_clkdev(clk, "hclk", "dw_dmac.0");
++
++	return 0;
++}
++
++static int __init byt_board_init(void)
++{
++	int ret;
++
++	if (disable)
++		return 0;
++
++	ret = byt_clk_setup();
++	if (ret)
++		goto exit;
++
++	ret = byt_spi_board_setup();
++	if (ret)
++		goto exit;
++
++exit:
++	return ret;
++}
++arch_initcall(byt_board_init);
++MODULE_LICENSE(GPL);
+--
+1.7.10.4
+
-- 
1.7.10.4



More information about the linux-yocto mailing list