* [PATCH 6/6] ARM: S3C64XX: Modified according to SPI consolidation work.
2011-11-04 12:43 ` [PATCH 6/6] ARM: S3C64XX: Modified according to " Padmavathi Venna
@ 2011-11-04 10:57 ` Mark Brown
[not found] ` <CAAgF-Bcj3vm50YOU4Sq4cGrOE8EHixjOuFrQq-MR6FVLf7Dekg@mail.gmail.com>
0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2011-11-04 10:57 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 04, 2011 at 08:43:54AM -0400, Padmavathi Venna wrote:
> +#ifdef CONFIG_S3C64XX_DEV_SPI0
> +static struct s3c64xx_spi_info crag6410_spi0_pdata __initdata = {
> + .cfg_gpio = s3c64xx_spi0_cfg_gpio,
> + .fifo_lvl_mask = 0x7f,
> + .rx_lvl_offset = 13,
> + .tx_st_done = 21,
> +};
> +#endif
It seems like a step backwards to have all this stuff in the individual
machines - most of this (everything except cfg_gpio pretty much) is a
property of the SoC silicon so should be somewhere central for the SoC.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 0/6] SPI platform device consolidation
@ 2011-11-04 12:43 Padmavathi Venna
2011-11-04 12:43 ` [PATCH 1/6] ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung Padmavathi Venna
` (6 more replies)
0 siblings, 7 replies; 13+ messages in thread
From: Padmavathi Venna @ 2011-11-04 12:43 UTC (permalink / raw)
To: linux-arm-kernel
SPI platform devices are defined in respective machine folder of
Samsung S3C64XX and S5P series SoCs.This patchset moves S3C64XX
and S5P series of SPI platform devices to a common place plat-samsung.
This patchset also creates SPI setup files for GPIO configurations and
initializes the platform specific data in the corresponding machine file.
Padmavathi Venna (6):
ARM: SAMSUNG: Consolidation of SPI platform devices to
plat-samsung
ARM: S3C64XX: Modified files for SPI consolidation work
ARM: S5PC100: Modified files for SPI consolidation work.
ARM: S5P64X0: Modified files for SPI consolidation work
ARM: S5PV210: Modified files for SPI consolidation work
The following patch make the corresponding SPI changes required for
Wolfson Cragganmore S3C6410 variant. This patch is only build tested.
ARM: S3C64XX: Modified according to SPI consolidation work.
arch/arm/mach-s3c64xx/Kconfig | 8 +-
arch/arm/mach-s3c64xx/Makefile | 2 +-
arch/arm/mach-s3c64xx/dev-spi.c | 172 -----------------
arch/arm/mach-s3c64xx/include/mach/map.h | 2 +
arch/arm/mach-s3c64xx/mach-crag6410.c | 9 +
arch/arm/mach-s3c64xx/mach-smdk6410.c | 19 ++
arch/arm/mach-s3c64xx/setup-spi.c | 32 +++
arch/arm/mach-s5p64x0/Kconfig | 7 +-
arch/arm/mach-s5p64x0/Makefile | 2 +-
arch/arm/mach-s5p64x0/dev-spi.c | 218 ---------------------
arch/arm/mach-s5p64x0/include/mach/map.h | 3 +
arch/arm/mach-s5p64x0/mach-smdk6440.c | 19 ++
arch/arm/mach-s5p64x0/mach-smdk6450.c | 19 ++
arch/arm/mach-s5p64x0/setup-spi.c | 42 ++++
arch/arm/mach-s5pc100/Kconfig | 5 +
arch/arm/mach-s5pc100/Makefile | 2 +-
arch/arm/mach-s5pc100/dev-spi.c | 220 ----------------------
arch/arm/mach-s5pc100/include/mach/map.h | 3 +
arch/arm/mach-s5pc100/mach-smdkc100.c | 31 +++
arch/arm/mach-s5pc100/setup-spi.c | 43 +++++
arch/arm/mach-s5pv210/Kconfig | 5 +
arch/arm/mach-s5pv210/Makefile | 2 +-
arch/arm/mach-s5pv210/dev-spi.c | 169 -----------------
arch/arm/mach-s5pv210/include/mach/map.h | 2 +
arch/arm/mach-s5pv210/mach-smdkv210.c | 21 ++
arch/arm/mach-s5pv210/setup-spi.c | 36 ++++
arch/arm/plat-samsung/Kconfig | 14 ++-
arch/arm/plat-samsung/devs.c | 112 +++++++++++
arch/arm/plat-samsung/include/plat/devs.h | 8 +-
arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | 16 +-
30 files changed, 444 insertions(+), 799 deletions(-)
delete mode 100644 arch/arm/mach-s3c64xx/dev-spi.c
create mode 100644 arch/arm/mach-s3c64xx/setup-spi.c
delete mode 100644 arch/arm/mach-s5p64x0/dev-spi.c
create mode 100644 arch/arm/mach-s5p64x0/setup-spi.c
delete mode 100644 arch/arm/mach-s5pc100/dev-spi.c
create mode 100644 arch/arm/mach-s5pc100/setup-spi.c
delete mode 100644 arch/arm/mach-s5pv210/dev-spi.c
create mode 100644 arch/arm/mach-s5pv210/setup-spi.c
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/6] ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung
2011-11-04 12:43 [PATCH 0/6] SPI platform device consolidation Padmavathi Venna
@ 2011-11-04 12:43 ` Padmavathi Venna
2011-11-15 7:08 ` Kukjin Kim
2011-11-04 12:43 ` [PATCH 2/6] ARM: S3C64XX: Modified files for SPI consolidation work Padmavathi Venna
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Padmavathi Venna @ 2011-11-04 12:43 UTC (permalink / raw)
To: linux-arm-kernel
SPI platform device definitions consolidated from respective machine
folder to plat-samsung
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
arch/arm/mach-s3c64xx/Makefile | 1 -
arch/arm/mach-s3c64xx/dev-spi.c | 172 -----------------
arch/arm/mach-s5p64x0/Makefile | 1 -
arch/arm/mach-s5p64x0/dev-spi.c | 218 ---------------------
arch/arm/mach-s5pc100/Makefile | 1 -
arch/arm/mach-s5pc100/dev-spi.c | 220 ----------------------
arch/arm/mach-s5pv210/Makefile | 1 -
arch/arm/mach-s5pv210/dev-spi.c | 169 -----------------
arch/arm/plat-samsung/Kconfig | 14 ++-
arch/arm/plat-samsung/devs.c | 112 +++++++++++
arch/arm/plat-samsung/include/plat/devs.h | 8 +-
arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | 13 +-
12 files changed, 133 insertions(+), 797 deletions(-)
delete mode 100644 arch/arm/mach-s3c64xx/dev-spi.c
delete mode 100644 arch/arm/mach-s5p64x0/dev-spi.c
delete mode 100644 arch/arm/mach-s5pc100/dev-spi.c
delete mode 100644 arch/arm/mach-s5pv210/dev-spi.c
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index e32093c..d1d0f09 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -59,4 +59,3 @@ obj-$(CONFIG_MACH_WLF_CRAGG_6410) += mach-crag6410.o mach-crag6410-module.o
obj-y += dev-uart.o
obj-y += dev-audio.o
-obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
diff --git a/arch/arm/mach-s3c64xx/dev-spi.c b/arch/arm/mach-s3c64xx/dev-spi.c
deleted file mode 100644
index 86fb130..0000000
--- a/arch/arm/mach-s3c64xx/dev-spi.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* linux/arch/arm/plat-s3c64xx/dev-spi.c
- *
- * 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.
- */
-
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/gpio.h>
-
-#include <mach/dma.h>
-#include <mach/map.h>
-#include <mach/spi-clocks.h>
-#include <mach/irqs.h>
-
-#include <plat/s3c64xx-spi.h>
-#include <plat/gpio-cfg.h>
-#include <plat/devs.h>
-
-/* SPI Controller platform_devices */
-
-/* Since we emulate multi-cs capability, we do not touch the GPC-3,7.
- * The emulated CS is toggled by board specific mechanism, as it can
- * be either some immediate GPIO or some signal out of some other
- * chip in between ... or some yet another way.
- * We simply do not assume anything about CS.
- */
-static int s3c64xx_spi_cfg_gpio(struct platform_device *pdev)
-{
- unsigned int base;
-
- switch (pdev->id) {
- case 0:
- base = S3C64XX_GPC(0);
- break;
-
- case 1:
- base = S3C64XX_GPC(4);
- break;
-
- default:
- dev_err(&pdev->dev, "Invalid SPI Controller number!");
- return -EINVAL;
- }
-
- s3c_gpio_cfgall_range(base, 3,
- S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
-
- return 0;
-}
-
-static struct resource s3c64xx_spi0_resource[] = {
- [0] = {
- .start = S3C64XX_PA_SPI0,
- .end = S3C64XX_PA_SPI0 + 0x100 - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = DMACH_SPI0_TX,
- .end = DMACH_SPI0_TX,
- .flags = IORESOURCE_DMA,
- },
- [2] = {
- .start = DMACH_SPI0_RX,
- .end = DMACH_SPI0_RX,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = IRQ_SPI0,
- .end = IRQ_SPI0,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct s3c64xx_spi_info s3c64xx_spi0_pdata = {
- .cfg_gpio = s3c64xx_spi_cfg_gpio,
- .fifo_lvl_mask = 0x7f,
- .rx_lvl_offset = 13,
- .tx_st_done = 21,
-};
-
-static u64 spi_dmamask = DMA_BIT_MASK(32);
-
-struct platform_device s3c64xx_device_spi0 = {
- .name = "s3c64xx-spi",
- .id = 0,
- .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource),
- .resource = s3c64xx_spi0_resource,
- .dev = {
- .dma_mask = &spi_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &s3c64xx_spi0_pdata,
- },
-};
-EXPORT_SYMBOL(s3c64xx_device_spi0);
-
-static struct resource s3c64xx_spi1_resource[] = {
- [0] = {
- .start = S3C64XX_PA_SPI1,
- .end = S3C64XX_PA_SPI1 + 0x100 - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = DMACH_SPI1_TX,
- .end = DMACH_SPI1_TX,
- .flags = IORESOURCE_DMA,
- },
- [2] = {
- .start = DMACH_SPI1_RX,
- .end = DMACH_SPI1_RX,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = IRQ_SPI1,
- .end = IRQ_SPI1,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct s3c64xx_spi_info s3c64xx_spi1_pdata = {
- .cfg_gpio = s3c64xx_spi_cfg_gpio,
- .fifo_lvl_mask = 0x7f,
- .rx_lvl_offset = 13,
- .tx_st_done = 21,
-};
-
-struct platform_device s3c64xx_device_spi1 = {
- .name = "s3c64xx-spi",
- .id = 1,
- .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource),
- .resource = s3c64xx_spi1_resource,
- .dev = {
- .dma_mask = &spi_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &s3c64xx_spi1_pdata,
- },
-};
-EXPORT_SYMBOL(s3c64xx_device_spi1);
-
-void __init s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
-{
- struct s3c64xx_spi_info *pd;
-
- /* Reject invalid configuration */
- if (!num_cs || src_clk_nr < 0
- || src_clk_nr > S3C64XX_SPI_SRCCLK_48M) {
- printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);
- return;
- }
-
- switch (cntrlr) {
- case 0:
- pd = &s3c64xx_spi0_pdata;
- break;
- case 1:
- pd = &s3c64xx_spi1_pdata;
- break;
- default:
- printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
- __func__, cntrlr);
- return;
- }
-
- pd->num_cs = num_cs;
- pd->src_clk_nr = src_clk_nr;
-}
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
index a1324d8..e24d316 100644
--- a/arch/arm/mach-s5p64x0/Makefile
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -26,7 +26,6 @@ obj-$(CONFIG_MACH_SMDK6450) += mach-smdk6450.o
# device support
obj-y += dev-audio.o
-obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o
diff --git a/arch/arm/mach-s5p64x0/dev-spi.c b/arch/arm/mach-s5p64x0/dev-spi.c
deleted file mode 100644
index 5b5d3c0..0000000
--- a/arch/arm/mach-s5p64x0/dev-spi.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* linux/arch/arm/mach-s5p64x0/dev-spi.c
- *
- * Copyright (c) 2010 Samsung Electronics Co., Ltd.
- * http://www.samsung.com
- *
- * Copyright (C) 2010 Samsung Electronics Co. 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.
-*/
-
-#include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/gpio.h>
-
-#include <mach/dma.h>
-#include <mach/map.h>
-#include <mach/irqs.h>
-#include <mach/regs-clock.h>
-#include <mach/spi-clocks.h>
-
-#include <plat/cpu.h>
-#include <plat/s3c64xx-spi.h>
-#include <plat/gpio-cfg.h>
-
-/* SPI Controller platform_devices */
-
-/* Since we emulate multi-cs capability, we do not touch the CS.
- * The emulated CS is toggled by board specific mechanism, as it can
- * be either some immediate GPIO or some signal out of some other
- * chip in between ... or some yet another way.
- * We simply do not assume anything about CS.
- */
-static int s5p6440_spi_cfg_gpio(struct platform_device *pdev)
-{
- unsigned int base;
-
- switch (pdev->id) {
- case 0:
- base = S5P6440_GPC(0);
- break;
-
- case 1:
- base = S5P6440_GPC(4);
- break;
-
- default:
- dev_err(&pdev->dev, "Invalid SPI Controller number!");
- return -EINVAL;
- }
-
- s3c_gpio_cfgall_range(base, 3,
- S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
-
- return 0;
-}
-
-static int s5p6450_spi_cfg_gpio(struct platform_device *pdev)
-{
- unsigned int base;
-
- switch (pdev->id) {
- case 0:
- base = S5P6450_GPC(0);
- break;
-
- case 1:
- base = S5P6450_GPC(4);
- break;
-
- default:
- dev_err(&pdev->dev, "Invalid SPI Controller number!");
- return -EINVAL;
- }
-
- s3c_gpio_cfgall_range(base, 3,
- S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
-
- return 0;
-}
-
-static struct resource s5p64x0_spi0_resource[] = {
- [0] = {
- .start = S5P64X0_PA_SPI0,
- .end = S5P64X0_PA_SPI0 + 0x100 - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = DMACH_SPI0_TX,
- .end = DMACH_SPI0_TX,
- .flags = IORESOURCE_DMA,
- },
- [2] = {
- .start = DMACH_SPI0_RX,
- .end = DMACH_SPI0_RX,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = IRQ_SPI0,
- .end = IRQ_SPI0,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct s3c64xx_spi_info s5p6440_spi0_pdata = {
- .cfg_gpio = s5p6440_spi_cfg_gpio,
- .fifo_lvl_mask = 0x1ff,
- .rx_lvl_offset = 15,
- .tx_st_done = 25,
-};
-
-static struct s3c64xx_spi_info s5p6450_spi0_pdata = {
- .cfg_gpio = s5p6450_spi_cfg_gpio,
- .fifo_lvl_mask = 0x1ff,
- .rx_lvl_offset = 15,
- .tx_st_done = 25,
-};
-
-static u64 spi_dmamask = DMA_BIT_MASK(32);
-
-struct platform_device s5p64x0_device_spi0 = {
- .name = "s3c64xx-spi",
- .id = 0,
- .num_resources = ARRAY_SIZE(s5p64x0_spi0_resource),
- .resource = s5p64x0_spi0_resource,
- .dev = {
- .dma_mask = &spi_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- },
-};
-
-static struct resource s5p64x0_spi1_resource[] = {
- [0] = {
- .start = S5P64X0_PA_SPI1,
- .end = S5P64X0_PA_SPI1 + 0x100 - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = DMACH_SPI1_TX,
- .end = DMACH_SPI1_TX,
- .flags = IORESOURCE_DMA,
- },
- [2] = {
- .start = DMACH_SPI1_RX,
- .end = DMACH_SPI1_RX,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = IRQ_SPI1,
- .end = IRQ_SPI1,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct s3c64xx_spi_info s5p6440_spi1_pdata = {
- .cfg_gpio = s5p6440_spi_cfg_gpio,
- .fifo_lvl_mask = 0x7f,
- .rx_lvl_offset = 15,
- .tx_st_done = 25,
-};
-
-static struct s3c64xx_spi_info s5p6450_spi1_pdata = {
- .cfg_gpio = s5p6450_spi_cfg_gpio,
- .fifo_lvl_mask = 0x7f,
- .rx_lvl_offset = 15,
- .tx_st_done = 25,
-};
-
-struct platform_device s5p64x0_device_spi1 = {
- .name = "s3c64xx-spi",
- .id = 1,
- .num_resources = ARRAY_SIZE(s5p64x0_spi1_resource),
- .resource = s5p64x0_spi1_resource,
- .dev = {
- .dma_mask = &spi_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- },
-};
-
-void __init s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
-{
- struct s3c64xx_spi_info *pd;
-
- /* Reject invalid configuration */
- if (!num_cs || src_clk_nr < 0
- || src_clk_nr > S5P64X0_SPI_SRCCLK_SCLK) {
- printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);
- return;
- }
-
- switch (cntrlr) {
- case 0:
- if (soc_is_s5p6450())
- pd = &s5p6450_spi0_pdata;
- else
- pd = &s5p6440_spi0_pdata;
-
- s5p64x0_device_spi0.dev.platform_data = pd;
- break;
- case 1:
- if (soc_is_s5p6450())
- pd = &s5p6450_spi1_pdata;
- else
- pd = &s5p6440_spi1_pdata;
-
- s5p64x0_device_spi1.dev.platform_data = pd;
- break;
- default:
- printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
- __func__, cntrlr);
- return;
- }
-
- pd->num_cs = num_cs;
- pd->src_clk_nr = src_clk_nr;
-}
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
index 2320e54..238a836 100644
--- a/arch/arm/mach-s5pc100/Makefile
+++ b/arch/arm/mach-s5pc100/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_S5PC100_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
# device support
obj-y += dev-audio.o
-obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
# machine support
diff --git a/arch/arm/mach-s5pc100/dev-spi.c b/arch/arm/mach-s5pc100/dev-spi.c
deleted file mode 100644
index 155f50d..0000000
--- a/arch/arm/mach-s5pc100/dev-spi.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* linux/arch/arm/mach-s5pc100/dev-spi.c
- *
- * Copyright (C) 2010 Samsung Electronics Co. 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.
- */
-
-#include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/gpio.h>
-
-#include <mach/dma.h>
-#include <mach/map.h>
-#include <mach/spi-clocks.h>
-#include <mach/irqs.h>
-
-#include <plat/s3c64xx-spi.h>
-#include <plat/gpio-cfg.h>
-#include <plat/irqs.h>
-
-/* SPI Controller platform_devices */
-
-/* Since we emulate multi-cs capability, we do not touch the CS.
- * The emulated CS is toggled by board specific mechanism, as it can
- * be either some immediate GPIO or some signal out of some other
- * chip in between ... or some yet another way.
- * We simply do not assume anything about CS.
- */
-static int s5pc100_spi_cfg_gpio(struct platform_device *pdev)
-{
- switch (pdev->id) {
- case 0:
- s3c_gpio_cfgall_range(S5PC100_GPB(0), 3,
- S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
- break;
-
- case 1:
- s3c_gpio_cfgall_range(S5PC100_GPB(4), 3,
- S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
- break;
-
- case 2:
- s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3));
- s3c_gpio_setpull(S5PC100_GPG3(0), S3C_GPIO_PULL_UP);
- s3c_gpio_cfgall_range(S5PC100_GPB(2), 2,
- S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
- break;
-
- default:
- dev_err(&pdev->dev, "Invalid SPI Controller number!");
- return -EINVAL;
- }
-
- return 0;
-}
-
-static struct resource s5pc100_spi0_resource[] = {
- [0] = {
- .start = S5PC100_PA_SPI0,
- .end = S5PC100_PA_SPI0 + 0x100 - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = DMACH_SPI0_TX,
- .end = DMACH_SPI0_TX,
- .flags = IORESOURCE_DMA,
- },
- [2] = {
- .start = DMACH_SPI0_RX,
- .end = DMACH_SPI0_RX,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = IRQ_SPI0,
- .end = IRQ_SPI0,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct s3c64xx_spi_info s5pc100_spi0_pdata = {
- .cfg_gpio = s5pc100_spi_cfg_gpio,
- .fifo_lvl_mask = 0x7f,
- .rx_lvl_offset = 13,
- .high_speed = 1,
- .tx_st_done = 21,
-};
-
-static u64 spi_dmamask = DMA_BIT_MASK(32);
-
-struct platform_device s5pc100_device_spi0 = {
- .name = "s3c64xx-spi",
- .id = 0,
- .num_resources = ARRAY_SIZE(s5pc100_spi0_resource),
- .resource = s5pc100_spi0_resource,
- .dev = {
- .dma_mask = &spi_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &s5pc100_spi0_pdata,
- },
-};
-
-static struct resource s5pc100_spi1_resource[] = {
- [0] = {
- .start = S5PC100_PA_SPI1,
- .end = S5PC100_PA_SPI1 + 0x100 - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = DMACH_SPI1_TX,
- .end = DMACH_SPI1_TX,
- .flags = IORESOURCE_DMA,
- },
- [2] = {
- .start = DMACH_SPI1_RX,
- .end = DMACH_SPI1_RX,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = IRQ_SPI1,
- .end = IRQ_SPI1,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct s3c64xx_spi_info s5pc100_spi1_pdata = {
- .cfg_gpio = s5pc100_spi_cfg_gpio,
- .fifo_lvl_mask = 0x7f,
- .rx_lvl_offset = 13,
- .high_speed = 1,
- .tx_st_done = 21,
-};
-
-struct platform_device s5pc100_device_spi1 = {
- .name = "s3c64xx-spi",
- .id = 1,
- .num_resources = ARRAY_SIZE(s5pc100_spi1_resource),
- .resource = s5pc100_spi1_resource,
- .dev = {
- .dma_mask = &spi_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &s5pc100_spi1_pdata,
- },
-};
-
-static struct resource s5pc100_spi2_resource[] = {
- [0] = {
- .start = S5PC100_PA_SPI2,
- .end = S5PC100_PA_SPI2 + 0x100 - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = DMACH_SPI2_TX,
- .end = DMACH_SPI2_TX,
- .flags = IORESOURCE_DMA,
- },
- [2] = {
- .start = DMACH_SPI2_RX,
- .end = DMACH_SPI2_RX,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = IRQ_SPI2,
- .end = IRQ_SPI2,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct s3c64xx_spi_info s5pc100_spi2_pdata = {
- .cfg_gpio = s5pc100_spi_cfg_gpio,
- .fifo_lvl_mask = 0x7f,
- .rx_lvl_offset = 13,
- .high_speed = 1,
- .tx_st_done = 21,
-};
-
-struct platform_device s5pc100_device_spi2 = {
- .name = "s3c64xx-spi",
- .id = 2,
- .num_resources = ARRAY_SIZE(s5pc100_spi2_resource),
- .resource = s5pc100_spi2_resource,
- .dev = {
- .dma_mask = &spi_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &s5pc100_spi2_pdata,
- },
-};
-
-void __init s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
-{
- struct s3c64xx_spi_info *pd;
-
- /* Reject invalid configuration */
- if (!num_cs || src_clk_nr < 0
- || src_clk_nr > S5PC100_SPI_SRCCLK_SPIBUS) {
- printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);
- return;
- }
-
- switch (cntrlr) {
- case 0:
- pd = &s5pc100_spi0_pdata;
- break;
- case 1:
- pd = &s5pc100_spi1_pdata;
- break;
- case 2:
- pd = &s5pc100_spi2_pdata;
- break;
- default:
- printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
- __func__, cntrlr);
- return;
- }
-
- pd->num_cs = num_cs;
- pd->src_clk_nr = src_clk_nr;
-}
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 53c346a..7eb8677 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_MACH_TORBRECK) += mach-torbreck.o
# device support
obj-y += dev-audio.o
-obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
obj-$(CONFIG_S5PV210_SETUP_FB_24BPP) += setup-fb-24bpp.o
obj-$(CONFIG_S5PV210_SETUP_FIMC) += setup-fimc.o
diff --git a/arch/arm/mach-s5pv210/dev-spi.c b/arch/arm/mach-s5pv210/dev-spi.c
deleted file mode 100644
index 39bef19..0000000
--- a/arch/arm/mach-s5pv210/dev-spi.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* linux/arch/arm/mach-s5pv210/dev-spi.c
- *
- * Copyright (C) 2010 Samsung Electronics Co. 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.
- */
-
-#include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/gpio.h>
-
-#include <mach/dma.h>
-#include <mach/map.h>
-#include <mach/irqs.h>
-#include <mach/spi-clocks.h>
-
-#include <plat/s3c64xx-spi.h>
-#include <plat/gpio-cfg.h>
-
-/* SPI Controller platform_devices */
-
-/* Since we emulate multi-cs capability, we do not touch the CS.
- * The emulated CS is toggled by board specific mechanism, as it can
- * be either some immediate GPIO or some signal out of some other
- * chip in between ... or some yet another way.
- * We simply do not assume anything about CS.
- */
-static int s5pv210_spi_cfg_gpio(struct platform_device *pdev)
-{
- unsigned int base;
-
- switch (pdev->id) {
- case 0:
- base = S5PV210_GPB(0);
- break;
-
- case 1:
- base = S5PV210_GPB(4);
- break;
-
- default:
- dev_err(&pdev->dev, "Invalid SPI Controller number!");
- return -EINVAL;
- }
-
- s3c_gpio_cfgall_range(base, 3,
- S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
-
- return 0;
-}
-
-static struct resource s5pv210_spi0_resource[] = {
- [0] = {
- .start = S5PV210_PA_SPI0,
- .end = S5PV210_PA_SPI0 + 0x100 - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = DMACH_SPI0_TX,
- .end = DMACH_SPI0_TX,
- .flags = IORESOURCE_DMA,
- },
- [2] = {
- .start = DMACH_SPI0_RX,
- .end = DMACH_SPI0_RX,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = IRQ_SPI0,
- .end = IRQ_SPI0,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct s3c64xx_spi_info s5pv210_spi0_pdata = {
- .cfg_gpio = s5pv210_spi_cfg_gpio,
- .fifo_lvl_mask = 0x1ff,
- .rx_lvl_offset = 15,
- .high_speed = 1,
- .tx_st_done = 25,
-};
-
-static u64 spi_dmamask = DMA_BIT_MASK(32);
-
-struct platform_device s5pv210_device_spi0 = {
- .name = "s3c64xx-spi",
- .id = 0,
- .num_resources = ARRAY_SIZE(s5pv210_spi0_resource),
- .resource = s5pv210_spi0_resource,
- .dev = {
- .dma_mask = &spi_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &s5pv210_spi0_pdata,
- },
-};
-
-static struct resource s5pv210_spi1_resource[] = {
- [0] = {
- .start = S5PV210_PA_SPI1,
- .end = S5PV210_PA_SPI1 + 0x100 - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = DMACH_SPI1_TX,
- .end = DMACH_SPI1_TX,
- .flags = IORESOURCE_DMA,
- },
- [2] = {
- .start = DMACH_SPI1_RX,
- .end = DMACH_SPI1_RX,
- .flags = IORESOURCE_DMA,
- },
- [3] = {
- .start = IRQ_SPI1,
- .end = IRQ_SPI1,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static struct s3c64xx_spi_info s5pv210_spi1_pdata = {
- .cfg_gpio = s5pv210_spi_cfg_gpio,
- .fifo_lvl_mask = 0x7f,
- .rx_lvl_offset = 15,
- .high_speed = 1,
- .tx_st_done = 25,
-};
-
-struct platform_device s5pv210_device_spi1 = {
- .name = "s3c64xx-spi",
- .id = 1,
- .num_resources = ARRAY_SIZE(s5pv210_spi1_resource),
- .resource = s5pv210_spi1_resource,
- .dev = {
- .dma_mask = &spi_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &s5pv210_spi1_pdata,
- },
-};
-
-void __init s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
-{
- struct s3c64xx_spi_info *pd;
-
- /* Reject invalid configuration */
- if (!num_cs || src_clk_nr < 0
- || src_clk_nr > S5PV210_SPI_SRCCLK_SCLK) {
- printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);
- return;
- }
-
- switch (cntrlr) {
- case 0:
- pd = &s5pv210_spi0_pdata;
- break;
- case 1:
- pd = &s5pv210_spi1_pdata;
- break;
- default:
- printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
- __func__, cntrlr);
- return;
- }
-
- pd->num_cs = num_cs;
- pd->src_clk_nr = src_clk_nr;
-}
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 313eb26..8a2b23a 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -226,7 +226,19 @@ config SAMSUNG_DEV_IDE
help
Compile in platform device definitions for IDE
-config S3C64XX_DEV_SPI
+config S3C64XX_DEV_SPI0
+ bool
+ help
+ Compile in platform device definitions for S3C64XX's type
+ SPI controllers.
+
+config S3C64XX_DEV_SPI1
+ bool
+ help
+ Compile in platform device definitions for S3C64XX's type
+ SPI controllers.
+
+config S3C64XX_DEV_SPI2
bool
help
Compile in platform device definitions for S3C64XX's type
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 4ca8b57..76e374d 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -61,6 +61,7 @@
#include <plat/regs-iic.h>
#include <plat/regs-serial.h>
#include <plat/regs-spi.h>
+#include <plat/s3c64xx-spi.h>
static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
@@ -1461,3 +1462,114 @@ struct platform_device s3c_device_wdt = {
.resource = s3c_wdt_resource,
};
#endif /* CONFIG_S3C_DEV_WDT */
+
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+static struct resource s3c64xx_spi0_resource[] = {
+ [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
+ [1] = DEFINE_RES_DMA(DMACH_SPI0_TX),
+ [2] = DEFINE_RES_DMA(DMACH_SPI0_RX),
+ [3] = DEFINE_RES_IRQ(IRQ_SPI0),
+};
+
+struct platform_device s3c64xx_device_spi0 = {
+ .name = "s3c64xx-spi",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource),
+ .resource = s3c64xx_spi0_resource,
+ .dev = {
+ .dma_mask = &samsung_device_dma_mask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ },
+};
+
+void __init s3c64xx_spi0_set_info(struct s3c64xx_spi_info *pd,
+ int src_clk_nr, int num_cs)
+{
+ if (!pd) {
+ pr_err("%s:Need to pass platform data\n", __func__);
+ return;
+ }
+ /* Reject invalid configuration */
+ if (!num_cs || src_clk_nr < 0) {
+ pr_err("%s: Invalid SPI configuration\n", __func__);
+ return;
+ }
+ pd->num_cs = num_cs;
+ pd->src_clk_nr = src_clk_nr;
+ s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0);
+}
+#endif /* CONFIG_S3C64XX_DEV_SPI0 */
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+static struct resource s3c64xx_spi1_resource[] = {
+ [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256),
+ [1] = DEFINE_RES_DMA(DMACH_SPI1_TX),
+ [2] = DEFINE_RES_DMA(DMACH_SPI1_RX),
+ [3] = DEFINE_RES_IRQ(IRQ_SPI1),
+};
+
+struct platform_device s3c64xx_device_spi1 = {
+ .name = "s3c64xx-spi",
+ .id = 1,
+ .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource),
+ .resource = s3c64xx_spi1_resource,
+ .dev = {
+ .dma_mask = &samsung_device_dma_mask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ },
+};
+
+void __init s3c64xx_spi1_set_info(struct s3c64xx_spi_info *pd,
+ int src_clk_nr, int num_cs)
+{
+ if (!pd) {
+ pr_err("%s:Need to pass platform data\n", __func__);
+ return;
+ }
+ /* Reject invalid configuration */
+ if (!num_cs || src_clk_nr < 0) {
+ pr_err("%s: Invalid SPI configuration\n", __func__);
+ return;
+ }
+ pd->num_cs = num_cs;
+ pd->src_clk_nr = src_clk_nr;
+ s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi1);
+}
+#endif /* CONFIG_S3C64XX_DEV_SPI1 */
+
+#ifdef CONFIG_S3C64XX_DEV_SPI2
+static struct resource s3c64xx_spi2_resource[] = {
+ [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256),
+ [1] = DEFINE_RES_DMA(DMACH_SPI2_TX),
+ [2] = DEFINE_RES_DMA(DMACH_SPI2_RX),
+ [3] = DEFINE_RES_IRQ(IRQ_SPI2),
+};
+
+struct platform_device s3c64xx_device_spi2 = {
+ .name = "s3c64xx-spi",
+ .id = 2,
+ .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource),
+ .resource = s3c64xx_spi2_resource,
+ .dev = {
+ .dma_mask = &samsung_device_dma_mask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ },
+};
+
+void __init s3c64xx_spi2_set_info(struct s3c64xx_spi_info *pd,
+ int src_clk_nr, int num_cs)
+{
+ if (!pd) {
+ pr_err("%s:Need to pass platform data\n", __func__);
+ return;
+ }
+ /* Reject invalid configuration */
+ if (!num_cs || src_clk_nr < 0) {
+ pr_err("%s: Invalid SPI configuration\n", __func__);
+ return;
+ }
+ pd->num_cs = num_cs;
+ pd->src_clk_nr = src_clk_nr;
+ s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi2);
+}
+#endif /* CONFIG_S3C64XX_DEV_SPI2 */
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index ab633c9..83b1e31 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -39,6 +39,7 @@ extern struct platform_device s3c64xx_device_pcm0;
extern struct platform_device s3c64xx_device_pcm1;
extern struct platform_device s3c64xx_device_spi0;
extern struct platform_device s3c64xx_device_spi1;
+extern struct platform_device s3c64xx_device_spi2;
extern struct platform_device s3c_device_adc;
extern struct platform_device s3c_device_cfcon;
@@ -98,8 +99,6 @@ extern struct platform_device s5p6450_device_iis1;
extern struct platform_device s5p6450_device_iis2;
extern struct platform_device s5p6450_device_pcm0;
-extern struct platform_device s5p64x0_device_spi0;
-extern struct platform_device s5p64x0_device_spi1;
extern struct platform_device s5pc100_device_ac97;
extern struct platform_device s5pc100_device_iis0;
@@ -108,9 +107,6 @@ extern struct platform_device s5pc100_device_iis2;
extern struct platform_device s5pc100_device_pcm0;
extern struct platform_device s5pc100_device_pcm1;
extern struct platform_device s5pc100_device_spdif;
-extern struct platform_device s5pc100_device_spi0;
-extern struct platform_device s5pc100_device_spi1;
-extern struct platform_device s5pc100_device_spi2;
extern struct platform_device s5pv210_device_ac97;
extern struct platform_device s5pv210_device_iis0;
@@ -120,8 +116,6 @@ extern struct platform_device s5pv210_device_pcm0;
extern struct platform_device s5pv210_device_pcm1;
extern struct platform_device s5pv210_device_pcm2;
extern struct platform_device s5pv210_device_spdif;
-extern struct platform_device s5pv210_device_spi0;
-extern struct platform_device s5pv210_device_spi1;
extern struct platform_device exynos4_device_ac97;
extern struct platform_device exynos4_device_ahci;
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
index c3d82a5..0dc37ad 100644
--- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
+++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
@@ -58,16 +58,17 @@ struct s3c64xx_spi_info {
/**
* s3c64xx_spi_set_info - SPI Controller configure callback by the board
* initialization code.
- * @cntrlr: SPI controller number the configuration is for.
+ * @pd: SPI platform data to set.
* @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
* @num_cs: Number of elements in the 'cs' array.
*
* Call this from machine init code for each SPI Controller that
* has some chips attached to it.
*/
-extern void s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
-extern void s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
-extern void s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
-extern void s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
-
+extern void s3c64xx_spi0_set_info(struct s3c64xx_spi_info *pd, int src_clk_nr,
+ int num_cs);
+extern void s3c64xx_spi1_set_info(struct s3c64xx_spi_info *pd, int src_clk_nr,
+ int num_cs);
+extern void s3c64xx_spi2_set_info(struct s3c64xx_spi_info *pd, int src_clk_nr,
+ int num_cs);
#endif /* __S3C64XX_PLAT_SPI_H */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/6] ARM: S3C64XX: Modified files for SPI consolidation work
2011-11-04 12:43 [PATCH 0/6] SPI platform device consolidation Padmavathi Venna
2011-11-04 12:43 ` [PATCH 1/6] ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung Padmavathi Venna
@ 2011-11-04 12:43 ` Padmavathi Venna
2011-11-04 12:43 ` [PATCH 3/6] ARM: S5PC100: " Padmavathi Venna
` (4 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Padmavathi Venna @ 2011-11-04 12:43 UTC (permalink / raw)
To: linux-arm-kernel
As SPI platform devices are consolidated to plat-samsung, some
corresponding changes are required in the respective machine folder.
Setup files are added for SPI GPIO configurations.
SPI platform specific data is initialized in the corresponding
machine file.
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
arch/arm/mach-s3c64xx/Kconfig | 5 +++
arch/arm/mach-s3c64xx/Makefile | 1 +
arch/arm/mach-s3c64xx/include/mach/map.h | 2 +
arch/arm/mach-s3c64xx/mach-smdk6410.c | 19 +++++++++++++
arch/arm/mach-s3c64xx/setup-spi.c | 32 ++++++++++++++++++++++
arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | 4 +++
6 files changed, 63 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-s3c64xx/setup-spi.c
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 5552e04..4388186 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -77,6 +77,11 @@ config S3C64XX_SETUP_SDHCI_GPIO
help
Common setup code for S3C64XX SDHCI GPIO configurations
+config S3C64XX_SETUP_SPI
+ bool
+ help
+ Common setup code for SPI GPIO configurations
+
# S36400 Macchine support
config MACH_SMDK6400
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index d1d0f09..d7d9bb5 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_S3C64XX_SETUP_IDE) += setup-ide.o
obj-$(CONFIG_S3C64XX_SETUP_KEYPAD) += setup-keypad.o
obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP) += setup-fb-24bpp.o
obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
+obj-$(CONFIG_S3C64XX_SETUP_SPI) += setup-spi.o
# PM
diff --git a/arch/arm/mach-s3c64xx/include/mach/map.h b/arch/arm/mach-s3c64xx/include/mach/map.h
index 23a1d71..8e2097b 100644
--- a/arch/arm/mach-s3c64xx/include/mach/map.h
+++ b/arch/arm/mach-s3c64xx/include/mach/map.h
@@ -115,6 +115,8 @@
#define S3C_PA_USB_HSOTG S3C64XX_PA_USB_HSOTG
#define S3C_PA_RTC S3C64XX_PA_RTC
#define S3C_PA_WDT S3C64XX_PA_WATCHDOG
+#define S3C_PA_SPI0 S3C64XX_PA_SPI0
+#define S3C_PA_SPI1 S3C64XX_PA_SPI1
#define SAMSUNG_PA_ADC S3C64XX_PA_ADC
#define SAMSUNG_PA_CFCON S3C64XX_PA_CFCON
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index 8bc8edd..6f22db8 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -72,6 +72,7 @@
#include <plat/keypad.h>
#include <plat/backlight.h>
#include <plat/regs-fb-v4.h>
+#include <plat/s3c64xx-spi.h>
#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
@@ -262,6 +263,24 @@ static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {
.cols = 8,
};
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+static struct s3c64xx_spi_info smdk6410_spi0_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi0_cfg_gpio,
+ .fifo_lvl_mask = 0x7f,
+ .rx_lvl_offset = 13,
+ .tx_st_done = 21,
+};
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+static struct s3c64xx_spi_info smdk6410_spi1_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi1_cfg_gpio,
+ .fifo_lvl_mask = 0x7f,
+ .rx_lvl_offset = 13,
+ .tx_st_done = 21,
+};
+#endif
+
static struct map_desc smdk6410_iodesc[] = {};
static struct platform_device *smdk6410_devices[] __initdata = {
diff --git a/arch/arm/mach-s3c64xx/setup-spi.c b/arch/arm/mach-s3c64xx/setup-spi.c
new file mode 100644
index 0000000..ff999d9
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/setup-spi.c
@@ -0,0 +1,32 @@
+/* linux/arch/arm/mach-s3c64xx/setup-spi.c
+ *
+ * Copyright (C) 2011 Samsung Electronics Ltd.
+ * http://www.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.
+ */
+
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+
+#include <plat/gpio-cfg.h>
+
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
+{
+ s3c_gpio_cfgall_range(S3C64XX_GPC(0), 3,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
+{
+ s3c_gpio_cfgall_range(S3C64XX_GPC(4), 3,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ return 0;
+}
+#endif
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
index 0dc37ad..da7f264 100644
--- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
+++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
@@ -71,4 +71,8 @@ extern void s3c64xx_spi1_set_info(struct s3c64xx_spi_info *pd, int src_clk_nr,
int num_cs);
extern void s3c64xx_spi2_set_info(struct s3c64xx_spi_info *pd, int src_clk_nr,
int num_cs);
+
+/* defined by architecture to configure gpio */
+extern int s3c64xx_spi0_cfg_gpio(struct platform_device *dev);
+extern int s3c64xx_spi1_cfg_gpio(struct platform_device *dev);
#endif /* __S3C64XX_PLAT_SPI_H */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/6] ARM: S5PC100: Modified files for SPI consolidation work.
2011-11-04 12:43 [PATCH 0/6] SPI platform device consolidation Padmavathi Venna
2011-11-04 12:43 ` [PATCH 1/6] ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung Padmavathi Venna
2011-11-04 12:43 ` [PATCH 2/6] ARM: S3C64XX: Modified files for SPI consolidation work Padmavathi Venna
@ 2011-11-04 12:43 ` Padmavathi Venna
2011-11-04 12:43 ` [PATCH 4/6] ARM: S5P64X0: " Padmavathi Venna
` (3 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Padmavathi Venna @ 2011-11-04 12:43 UTC (permalink / raw)
To: linux-arm-kernel
As SPI platform devices are consolidated to plat-samsung, some
corresponding changes are required in the respective machine folder.
Setup files are added for SPI GPIO configurations.
SPI platform specific data is initialized in the corresponding
machine file.
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
arch/arm/mach-s5pc100/Kconfig | 5 +++
arch/arm/mach-s5pc100/Makefile | 1 +
arch/arm/mach-s5pc100/include/mach/map.h | 3 ++
arch/arm/mach-s5pc100/mach-smdkc100.c | 31 ++++++++++++++++
arch/arm/mach-s5pc100/setup-spi.c | 43 ++++++++++++++++++++++
arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | 1 +
6 files changed, 84 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-s5pc100/setup-spi.c
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index e538a4c..75a26ea 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -45,6 +45,11 @@ config S5PC100_SETUP_SDHCI_GPIO
help
Common setup code for SDHCI gpio.
+config S5PC100_SETUP_SPI
+ bool
+ help
+ Common setup code for SPI GPIO configurations.
+
config MACH_SMDKC100
bool "SMDKC100"
select CPU_S5PC100
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
index 238a836..cf0091f 100644
--- a/arch/arm/mach-s5pc100/Makefile
+++ b/arch/arm/mach-s5pc100/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_S5PC100_SETUP_I2C1) += setup-i2c1.o
obj-$(CONFIG_S5PC100_SETUP_IDE) += setup-ide.o
obj-$(CONFIG_S5PC100_SETUP_KEYPAD) += setup-keypad.o
obj-$(CONFIG_S5PC100_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
+obj-$(CONFIG_S5PC100_SETUP_SPI) += setup-spi.o
# device support
obj-y += dev-audio.o
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h
index ccbe6b7..54bc4f8 100644
--- a/arch/arm/mach-s5pc100/include/mach/map.h
+++ b/arch/arm/mach-s5pc100/include/mach/map.h
@@ -100,6 +100,9 @@
#define S3C_PA_USB_HSOTG S5PC100_PA_USB_HSOTG
#define S3C_PA_USB_HSPHY S5PC100_PA_USB_HSPHY
#define S3C_PA_WDT S5PC100_PA_WATCHDOG
+#define S3C_PA_SPI0 S5PC100_PA_SPI0
+#define S3C_PA_SPI1 S5PC100_PA_SPI1
+#define S3C_PA_SPI2 S5PC100_PA_SPI2
#define S5P_PA_CHIPID S5PC100_PA_CHIPID
#define S5P_PA_FIMC0 S5PC100_PA_FIMC0
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 26f5c91..906f510 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -52,6 +52,7 @@
#include <plat/audio.h>
#include <plat/backlight.h>
#include <plat/regs-fb-v4.h>
+#include <plat/s3c64xx-spi.h>
/* Following are default values for UCON, ULCON and UFCON UART registers */
#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -180,6 +181,36 @@ static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
.cols = 8,
};
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+static struct s3c64xx_spi_info smdkc100_spi0_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi0_cfg_gpio,
+ .fifo_lvl_mask = 0x7f,
+ .rx_lvl_offset = 13,
+ .high_speed = 1,
+ .tx_st_done = 21,
+};
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+static struct s3c64xx_spi_info smdkc100_spi1_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi1_cfg_gpio,
+ .fifo_lvl_mask = 0x7f,
+ .rx_lvl_offset = 13,
+ .high_speed = 1,
+ .tx_st_done = 21,
+};
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI2
+static struct s3c64xx_spi_info smdkc100_spi2_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi2_cfg_gpio,
+ .fifo_lvl_mask = 0x7f,
+ .rx_lvl_offset = 13,
+ .high_speed = 1,
+ .tx_st_done = 21,
+};
+#endif
+
static struct platform_device *smdkc100_devices[] __initdata = {
&s3c_device_adc,
&s3c_device_cfcon,
diff --git a/arch/arm/mach-s5pc100/setup-spi.c b/arch/arm/mach-s5pc100/setup-spi.c
new file mode 100644
index 0000000..28a0d7f
--- /dev/null
+++ b/arch/arm/mach-s5pc100/setup-spi.c
@@ -0,0 +1,43 @@
+/* linux/arch/arm/mach-s5pc100/setup-spi0.c
+ *
+ * Copyright (C) 2011 Samsung Electronics Ltd.
+ * http://www.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.
+ */
+
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+
+#include <plat/gpio-cfg.h>
+
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
+{
+ s3c_gpio_cfgall_range(S5PC100_GPB(0), 3,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
+{
+ s3c_gpio_cfgall_range(S5PC100_GPB(4), 3,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI2
+int s3c64xx_spi2_cfg_gpio(struct platform_device *dev)
+{
+ s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3));
+ s3c_gpio_setpull(S5PC100_GPG3(0), S3C_GPIO_PULL_UP);
+ s3c_gpio_cfgall_range(S5PC100_GPB(2), 2,
+ S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
+ return 0;
+}
+#endif
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
index da7f264..15f74b6 100644
--- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
+++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
@@ -75,4 +75,5 @@ extern void s3c64xx_spi2_set_info(struct s3c64xx_spi_info *pd, int src_clk_nr,
/* defined by architecture to configure gpio */
extern int s3c64xx_spi0_cfg_gpio(struct platform_device *dev);
extern int s3c64xx_spi1_cfg_gpio(struct platform_device *dev);
+extern int s3c64xx_spi2_cfg_gpio(struct platform_device *dev);
#endif /* __S3C64XX_PLAT_SPI_H */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/6] ARM: S5P64X0: Modified files for SPI consolidation work
2011-11-04 12:43 [PATCH 0/6] SPI platform device consolidation Padmavathi Venna
` (2 preceding siblings ...)
2011-11-04 12:43 ` [PATCH 3/6] ARM: S5PC100: " Padmavathi Venna
@ 2011-11-04 12:43 ` Padmavathi Venna
2011-11-04 12:43 ` [PATCH 5/6] ARM: S5PV210: " Padmavathi Venna
` (2 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Padmavathi Venna @ 2011-11-04 12:43 UTC (permalink / raw)
To: linux-arm-kernel
As SPI platform devices are consolidated to plat-samsung, some
corresponding changes are required in the respective machine folder.
Setup files are added for SPI GPIO configurations.
SPI platform specific data is initialized in the corresponding
machine file.
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
arch/arm/mach-s5p64x0/Kconfig | 7 +++-
arch/arm/mach-s5p64x0/Makefile | 1 +
arch/arm/mach-s5p64x0/include/mach/map.h | 3 ++
arch/arm/mach-s5p64x0/mach-smdk6440.c | 19 +++++++++++++
arch/arm/mach-s5p64x0/mach-smdk6450.c | 19 +++++++++++++
arch/arm/mach-s5p64x0/setup-spi.c | 42 ++++++++++++++++++++++++++++++
6 files changed, 89 insertions(+), 2 deletions(-)
create mode 100644 arch/arm/mach-s5p64x0/setup-spi.c
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index 18690c5..dd8c85e 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -36,6 +36,11 @@ config S5P64X0_SETUP_I2C1
help
Common setup code for i2c bus 1.
+config S5P64X0_SETUP_SPI
+ bool
+ help
+ Common setup code for SPI GPIO configurations
+
# machine support
config MACH_SMDK6440
@@ -45,7 +50,6 @@ config MACH_SMDK6440
select S3C_DEV_I2C1
select S3C_DEV_RTC
select S3C_DEV_WDT
- select S3C64XX_DEV_SPI
select SAMSUNG_DEV_ADC
select SAMSUNG_DEV_BACKLIGHT
select SAMSUNG_DEV_PWM
@@ -62,7 +66,6 @@ config MACH_SMDK6450
select S3C_DEV_I2C1
select S3C_DEV_RTC
select S3C_DEV_WDT
- select S3C64XX_DEV_SPI
select SAMSUNG_DEV_ADC
select SAMSUNG_DEV_BACKLIGHT
select SAMSUNG_DEV_PWM
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
index e24d316..a7d7a49 100644
--- a/arch/arm/mach-s5p64x0/Makefile
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -29,3 +29,4 @@ obj-y += dev-audio.o
obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o
+obj-$(CONFIG_S5P64X0_SETUP_SPI) += setup-spi.o
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
index 4d3ac8a..c6af0fc 100644
--- a/arch/arm/mach-s5p64x0/include/mach/map.h
+++ b/arch/arm/mach-s5p64x0/include/mach/map.h
@@ -67,6 +67,8 @@
#define S3C_PA_RTC S5P64X0_PA_RTC
#define S3C_PA_WDT S5P64X0_PA_WDT
#define S3C_PA_FB S5P64X0_PA_FB
+#define S3C_PA_SPI0 S5P64X0_PA_SPI0
+#define S3C_PA_SPI1 S5P64X0_PA_SPI1
#define S5P_PA_CHIPID S5P64X0_PA_CHIPID
#define S5P_PA_SROMC S5P64X0_PA_SROMC
@@ -75,6 +77,7 @@
#define SAMSUNG_PA_ADC S5P64X0_PA_ADC
+
/* UART */
#define S5P6440_PA_UART(x) (0xEC000000 + ((x) * S3C_UART_OFFSET))
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c
index 4a1250c..0be83e2 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6440.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c
@@ -52,6 +52,7 @@
#include <plat/backlight.h>
#include <plat/fb.h>
#include <plat/regs-fb.h>
+#include <plat/s3c64xx-spi.h>
#define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
S3C2410_UCON_RXILEVEL | \
@@ -199,6 +200,24 @@ static struct platform_pwm_backlight_data smdk6440_bl_data = {
.pwm_id = 1,
};
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+static struct s3c64xx_spi_info smdk6440_spi0_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi0_cfg_gpio,
+ .fifo_lvl_mask = 0x1ff,
+ .rx_lvl_offset = 15,
+ .tx_st_done = 25,
+};
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+static struct s3c64xx_spi_info smdk6440_spi1_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi1_cfg_gpio,
+ .fifo_lvl_mask = 0x7f,
+ .rx_lvl_offset = 15,
+ .tx_st_done = 25,
+};
+#endif
+
static void __init smdk6440_map_io(void)
{
s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c
index 0ab129e..81196a0 100644
--- a/arch/arm/mach-s5p64x0/mach-smdk6450.c
+++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c
@@ -52,6 +52,7 @@
#include <plat/backlight.h>
#include <plat/fb.h>
#include <plat/regs-fb.h>
+#include <plat/s3c64xx-spi.h>
#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
S3C2410_UCON_RXILEVEL | \
@@ -219,6 +220,24 @@ static struct platform_pwm_backlight_data smdk6450_bl_data = {
.pwm_id = 1,
};
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+static struct s3c64xx_spi_info smdk6450_spi0_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi0_cfg_gpio,
+ .fifo_lvl_mask = 0x1ff,
+ .rx_lvl_offset = 15,
+ .tx_st_done = 25,
+};
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+static struct s3c64xx_spi_info smdk6450_spi1_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi1_cfg_gpio,
+ .fifo_lvl_mask = 0x7f,
+ .rx_lvl_offset = 15,
+ .tx_st_done = 25,
+};
+#endif
+
static void __init smdk6450_map_io(void)
{
s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
diff --git a/arch/arm/mach-s5p64x0/setup-spi.c b/arch/arm/mach-s5p64x0/setup-spi.c
new file mode 100644
index 0000000..beee6b5
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/setup-spi.c
@@ -0,0 +1,42 @@
+/* linux/arch/arm/mach-s5p64x0/setup-spi0.c
+ *
+ * Copyright (C) 2011 Samsung Electronics Ltd.
+ * http://www.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.
+ */
+
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <plat/gpio-cfg.h>
+#include <plat/cpu.h>
+
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
+{
+ if (soc_is_s5p6450())
+ s3c_gpio_cfgall_range(S5P6450_GPC(0), 3,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ else
+ s3c_gpio_cfgall_range(S5P6440_GPC(0), 3,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
+{
+ if (soc_is_s5p6450())
+ s3c_gpio_cfgall_range(S5P6450_GPC(4), 3,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ else
+ s3c_gpio_cfgall_range(S5P6440_GPC(4), 3,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ return 0;
+}
+#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/6] ARM: S5PV210: Modified files for SPI consolidation work
2011-11-04 12:43 [PATCH 0/6] SPI platform device consolidation Padmavathi Venna
` (3 preceding siblings ...)
2011-11-04 12:43 ` [PATCH 4/6] ARM: S5P64X0: " Padmavathi Venna
@ 2011-11-04 12:43 ` Padmavathi Venna
2011-11-04 12:43 ` [PATCH 6/6] ARM: S3C64XX: Modified according to " Padmavathi Venna
2011-11-05 3:32 ` [PATCH 0/6] SPI platform device consolidation Kukjin Kim
6 siblings, 0 replies; 13+ messages in thread
From: Padmavathi Venna @ 2011-11-04 12:43 UTC (permalink / raw)
To: linux-arm-kernel
As SPI platform devices are consolidated to plat-samsung, some
corresponding changes are required in the respective machine folder.
Setup files are added for SPI GPIO configurations.
SPI platform specific data is initialized in the corresponding
machine file.
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
arch/arm/mach-s5pv210/Kconfig | 5 ++++
arch/arm/mach-s5pv210/Makefile | 1 +
arch/arm/mach-s5pv210/include/mach/map.h | 2 +
arch/arm/mach-s5pv210/mach-smdkv210.c | 21 +++++++++++++++++
arch/arm/mach-s5pv210/setup-spi.c | 36 ++++++++++++++++++++++++++++++
5 files changed, 65 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-s5pv210/setup-spi.c
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 646057a..2cdc42e 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -60,6 +60,11 @@ config S5PV210_SETUP_FIMC
help
Common setup code for the camera interfaces.
+config S5PV210_SETUP_SPI
+ bool
+ help
+ Common setup code for SPI GPIO configurations.
+
menu "S5PC110 Machines"
config MACH_AQUILA
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 7eb8677..471df5d 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -35,3 +35,4 @@ obj-$(CONFIG_S5PV210_SETUP_I2C2) += setup-i2c2.o
obj-$(CONFIG_S5PV210_SETUP_IDE) += setup-ide.o
obj-$(CONFIG_S5PV210_SETUP_KEYPAD) += setup-keypad.o
obj-$(CONFIG_S5PV210_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
+obj-$(CONFIG_S5PV210_SETUP_SPI) += setup-spi.o
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h
index 7ff609f..89c34b8 100644
--- a/arch/arm/mach-s5pv210/include/mach/map.h
+++ b/arch/arm/mach-s5pv210/include/mach/map.h
@@ -109,6 +109,8 @@
#define S3C_PA_RTC S5PV210_PA_RTC
#define S3C_PA_USB_HSOTG S5PV210_PA_HSOTG
#define S3C_PA_WDT S5PV210_PA_WATCHDOG
+#define S3C_PA_SPI0 S5PV210_PA_SPI0
+#define S3C_PA_SPI1 S5PV210_PA_SPI1
#define S5P_PA_CHIPID S5PV210_PA_CHIPID
#define S5P_PA_FIMC0 S5PV210_PA_FIMC0
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index a9106c3..723dfb6 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -46,6 +46,7 @@
#include <plat/s5p-time.h>
#include <plat/backlight.h>
#include <plat/regs-fb-v4.h>
+#include <plat/s3c64xx-spi.h>
/* Following are default values for UCON, ULCON and UFCON UART registers */
#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -275,6 +276,26 @@ static struct platform_pwm_backlight_data smdkv210_bl_data = {
.pwm_id = 3,
};
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+static struct s3c64xx_spi_info smdkv210_spi0_pdata = {
+ .cfg_gpio = s3c64xx_spi0_cfg_gpio,
+ .fifo_lvl_mask = 0x1ff,
+ .rx_lvl_offset = 15,
+ .high_speed = 1,
+ .tx_st_done = 25,
+};
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+static struct s3c64xx_spi_info smdkv210_spi1_pdata = {
+ .cfg_gpio = s3c64xx_spi1_cfg_gpio,
+ .fifo_lvl_mask = 0x7f,
+ .rx_lvl_offset = 15,
+ .high_speed = 1,
+ .tx_st_done = 25,
+};
+#endif
+
static void __init smdkv210_map_io(void)
{
s5p_init_io(NULL, 0, S5P_VA_CHIPID);
diff --git a/arch/arm/mach-s5pv210/setup-spi.c b/arch/arm/mach-s5pv210/setup-spi.c
new file mode 100644
index 0000000..e53d697
--- /dev/null
+++ b/arch/arm/mach-s5pv210/setup-spi.c
@@ -0,0 +1,36 @@
+/* linux/arch/arm/mach-s5pv210/setup-spi0.c
+ *
+ * Copyright (C) 2011 Samsung Electronics Ltd.
+ * http://www.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.
+ */
+
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+
+#include <plat/gpio-cfg.h>
+
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
+{
+ s3c_gpio_cfgpin(S5PV210_GPB(0), S3C_GPIO_SFN(2));
+ s3c_gpio_setpull(S5PV210_GPB(0), S3C_GPIO_PULL_UP);
+ s3c_gpio_cfgall_range(S5PV210_GPB(2), 2,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_S3C64XX_DEV_SPI1
+int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
+{
+ s3c_gpio_cfgpin(S5PV210_GPB(4), S3C_GPIO_SFN(2));
+ s3c_gpio_setpull(S5PV210_GPB(4), S3C_GPIO_PULL_UP);
+ s3c_gpio_cfgall_range(S5PV210_GPB(6), 2,
+ S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
+ return 0;
+}
+#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/6] ARM: S3C64XX: Modified according to SPI consolidation work.
2011-11-04 12:43 [PATCH 0/6] SPI platform device consolidation Padmavathi Venna
` (4 preceding siblings ...)
2011-11-04 12:43 ` [PATCH 5/6] ARM: S5PV210: " Padmavathi Venna
@ 2011-11-04 12:43 ` Padmavathi Venna
2011-11-04 10:57 ` Mark Brown
2011-11-05 3:32 ` [PATCH 0/6] SPI platform device consolidation Kukjin Kim
6 siblings, 1 reply; 13+ messages in thread
From: Padmavathi Venna @ 2011-11-04 12:43 UTC (permalink / raw)
To: linux-arm-kernel
As SPI platform devices are consolidated to plat-samsung, some
corresponding changes are required in the respective machine file.
SPI platform specific data is initialized in the corresponding
machine file.
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
arch/arm/mach-s3c64xx/Kconfig | 3 ++-
arch/arm/mach-s3c64xx/mach-crag6410.c | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 4388186..90b34ab 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -281,6 +281,7 @@ config MACH_WLF_CRAGG_6410
select S3C64XX_SETUP_IDE
select S3C64XX_SETUP_FB_24BPP
select S3C64XX_SETUP_KEYPAD
+ select S3C64XX_SETUP_SPI
select SAMSUNG_DEV_ADC
select SAMSUNG_DEV_KEYPAD
select S3C_DEV_USB_HOST
@@ -291,7 +292,7 @@ config MACH_WLF_CRAGG_6410
select S3C_DEV_I2C1
select S3C_DEV_WDT
select S3C_DEV_RTC
- select S3C64XX_DEV_SPI
+ select S3C64XX_DEV_SPI0
select S3C24XX_GPIO_EXTRA128
select I2C
help
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index d04b654..aa3fe8f 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -669,6 +669,15 @@ static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
.cfg_gpio = crag6410_cfg_sdhci0,
};
+#ifdef CONFIG_S3C64XX_DEV_SPI0
+static struct s3c64xx_spi_info crag6410_spi0_pdata __initdata = {
+ .cfg_gpio = s3c64xx_spi0_cfg_gpio,
+ .fifo_lvl_mask = 0x7f,
+ .rx_lvl_offset = 13,
+ .tx_st_done = 21,
+};
+#endif
+
static void __init crag6410_machine_init(void)
{
/* Open drain IRQs need pullups */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 0/6] SPI platform device consolidation
2011-11-04 12:43 [PATCH 0/6] SPI platform device consolidation Padmavathi Venna
` (5 preceding siblings ...)
2011-11-04 12:43 ` [PATCH 6/6] ARM: S3C64XX: Modified according to " Padmavathi Venna
@ 2011-11-05 3:32 ` Kukjin Kim
6 siblings, 0 replies; 13+ messages in thread
From: Kukjin Kim @ 2011-11-05 3:32 UTC (permalink / raw)
To: linux-arm-kernel
Padmavathi Venna wrote:
>
> SPI platform devices are defined in respective machine folder of
> Samsung S3C64XX and S5P series SoCs.This patchset moves S3C64XX
> and S5P series of SPI platform devices to a common place plat-samsung.
> This patchset also creates SPI setup files for GPIO configurations and
> initializes the platform specific data in the corresponding machine file.
>
> Padmavathi Venna (6):
> ARM: SAMSUNG: Consolidation of SPI platform devices to
> plat-samsung
> ARM: S3C64XX: Modified files for SPI consolidation work
> ARM: S5PC100: Modified files for SPI consolidation work.
> ARM: S5P64X0: Modified files for SPI consolidation work
> ARM: S5PV210: Modified files for SPI consolidation work
>
> The following patch make the corresponding SPI changes required for
> Wolfson Cragganmore S3C6410 variant. This patch is only build tested.
>
> ARM: S3C64XX: Modified according to SPI consolidation work.
>
> arch/arm/mach-s3c64xx/Kconfig | 8 +-
> arch/arm/mach-s3c64xx/Makefile | 2 +-
> arch/arm/mach-s3c64xx/dev-spi.c | 172 -----------------
> arch/arm/mach-s3c64xx/include/mach/map.h | 2 +
> arch/arm/mach-s3c64xx/mach-crag6410.c | 9 +
> arch/arm/mach-s3c64xx/mach-smdk6410.c | 19 ++
> arch/arm/mach-s3c64xx/setup-spi.c | 32 +++
> arch/arm/mach-s5p64x0/Kconfig | 7 +-
> arch/arm/mach-s5p64x0/Makefile | 2 +-
> arch/arm/mach-s5p64x0/dev-spi.c | 218
---------------------
> arch/arm/mach-s5p64x0/include/mach/map.h | 3 +
> arch/arm/mach-s5p64x0/mach-smdk6440.c | 19 ++
> arch/arm/mach-s5p64x0/mach-smdk6450.c | 19 ++
> arch/arm/mach-s5p64x0/setup-spi.c | 42 ++++
> arch/arm/mach-s5pc100/Kconfig | 5 +
> arch/arm/mach-s5pc100/Makefile | 2 +-
> arch/arm/mach-s5pc100/dev-spi.c | 220
----------------------
> arch/arm/mach-s5pc100/include/mach/map.h | 3 +
> arch/arm/mach-s5pc100/mach-smdkc100.c | 31 +++
> arch/arm/mach-s5pc100/setup-spi.c | 43 +++++
> arch/arm/mach-s5pv210/Kconfig | 5 +
> arch/arm/mach-s5pv210/Makefile | 2 +-
> arch/arm/mach-s5pv210/dev-spi.c | 169 -----------------
> arch/arm/mach-s5pv210/include/mach/map.h | 2 +
> arch/arm/mach-s5pv210/mach-smdkv210.c | 21 ++
> arch/arm/mach-s5pv210/setup-spi.c | 36 ++++
> arch/arm/plat-samsung/Kconfig | 14 ++-
> arch/arm/plat-samsung/devs.c | 112 +++++++++++
> arch/arm/plat-samsung/include/plat/devs.h | 8 +-
> arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | 16 +-
> 30 files changed, 444 insertions(+), 799 deletions(-)
> delete mode 100644 arch/arm/mach-s3c64xx/dev-spi.c
> create mode 100644 arch/arm/mach-s3c64xx/setup-spi.c
> delete mode 100644 arch/arm/mach-s5p64x0/dev-spi.c
> create mode 100644 arch/arm/mach-s5p64x0/setup-spi.c
> delete mode 100644 arch/arm/mach-s5pc100/dev-spi.c
> create mode 100644 arch/arm/mach-s5pc100/setup-spi.c
> delete mode 100644 arch/arm/mach-s5pv210/dev-spi.c
> create mode 100644 arch/arm/mach-s5pv210/setup-spi.c
Looks good to consolidate work, but it's merge window so will be back on
this after that.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/6] ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung
2011-11-04 12:43 ` [PATCH 1/6] ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung Padmavathi Venna
@ 2011-11-15 7:08 ` Kukjin Kim
2011-11-17 1:39 ` padma venkat
0 siblings, 1 reply; 13+ messages in thread
From: Kukjin Kim @ 2011-11-15 7:08 UTC (permalink / raw)
To: linux-arm-kernel
Padmavathi Venna wrote:
>
> SPI platform device definitions consolidated from respective machine
> folder to plat-samsung
>
> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
> ---
> arch/arm/mach-s3c64xx/Makefile | 1 -
> arch/arm/mach-s3c64xx/dev-spi.c | 172 -----------------
> arch/arm/mach-s5p64x0/Makefile | 1 -
> arch/arm/mach-s5p64x0/dev-spi.c | 218
---------------------
> arch/arm/mach-s5pc100/Makefile | 1 -
> arch/arm/mach-s5pc100/dev-spi.c | 220
----------------------
> arch/arm/mach-s5pv210/Makefile | 1 -
> arch/arm/mach-s5pv210/dev-spi.c | 169 -----------------
> arch/arm/plat-samsung/Kconfig | 14 ++-
> arch/arm/plat-samsung/devs.c | 112 +++++++++++
> arch/arm/plat-samsung/include/plat/devs.h | 8 +-
> arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | 13 +-
> 12 files changed, 133 insertions(+), 797 deletions(-)
> delete mode 100644 arch/arm/mach-s3c64xx/dev-spi.c
> delete mode 100644 arch/arm/mach-s5p64x0/dev-spi.c
> delete mode 100644 arch/arm/mach-s5pc100/dev-spi.c
> delete mode 100644 arch/arm/mach-s5pv210/dev-spi.c
>
Hi Padma,
Basically, looks good and there are some comments below.
(snip)
> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
> index 313eb26..8a2b23a 100644
> --- a/arch/arm/plat-samsung/Kconfig
> +++ b/arch/arm/plat-samsung/Kconfig
> @@ -226,7 +226,19 @@ config SAMSUNG_DEV_IDE
> help
> Compile in platform device definitions for IDE
>
> -config S3C64XX_DEV_SPI
> +config S3C64XX_DEV_SPI0
> + bool
> + help
> + Compile in platform device definitions for S3C64XX's type
> + SPI controllers.
> +
> +config S3C64XX_DEV_SPI1
> + bool
> + help
> + Compile in platform device definitions for S3C64XX's type
> + SPI controllers.
> +
> +config S3C64XX_DEV_SPI2
Yeah, needs above config to check the channel now...but I'm thinking need to
sort out it anyway.
> bool
> help
> Compile in platform device definitions for S3C64XX's type
> diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
> index 4ca8b57..76e374d 100644
> --- a/arch/arm/plat-samsung/devs.c
> +++ b/arch/arm/plat-samsung/devs.c
> @@ -61,6 +61,7 @@
> #include <plat/regs-iic.h>
> #include <plat/regs-serial.h>
> #include <plat/regs-spi.h>
> +#include <plat/s3c64xx-spi.h>
>
> static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
>
> @@ -1461,3 +1462,114 @@ struct platform_device s3c_device_wdt = {
> .resource = s3c_wdt_resource,
> };
> #endif /* CONFIG_S3C_DEV_WDT */
> +
> +#ifdef CONFIG_S3C64XX_DEV_SPI0
> +static struct resource s3c64xx_spi0_resource[] = {
> + [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
> + [1] = DEFINE_RES_DMA(DMACH_SPI0_TX),
> + [2] = DEFINE_RES_DMA(DMACH_SPI0_RX),
> + [3] = DEFINE_RES_IRQ(IRQ_SPI0),
> +};
> +
> +struct platform_device s3c64xx_device_spi0 = {
> + .name = "s3c64xx-spi",
> + .id = 0,
> + .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource),
> + .resource = s3c64xx_spi0_resource,
> + .dev = {
> + .dma_mask = &samsung_device_dma_mask,
> + .coherent_dma_mask = DMA_BIT_MASK(32),
> + },
> +};
> +
> +void __init s3c64xx_spi0_set_info(struct s3c64xx_spi_info *pd,
> + int src_clk_nr, int num_cs)
How about 's3c64xx_spi_set_platdata' like others in plat-samsung/devs.c?
> +{
> + if (!pd) {
> + pr_err("%s:Need to pass platform data\n", __func__);
> + return;
> + }
Needs empty line here.
> + /* Reject invalid configuration */
> + if (!num_cs || src_clk_nr < 0) {
> + pr_err("%s: Invalid SPI configuration\n", __func__);
> + return;
> + }
Same as above.
> + pd->num_cs = num_cs;
> + pd->src_clk_nr = src_clk_nr;
> + s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0);
If we know the SPI controller number here, we can merge this function to
just one. So how about to add it to the 'struct s3c64xx_spi_info'?
> +}
(snip)
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 6/6] ARM: S3C64XX: Modified according to SPI consolidation work.
[not found] ` <CAAgF-Bcj3vm50YOU4Sq4cGrOE8EHixjOuFrQq-MR6FVLf7Dekg@mail.gmail.com>
@ 2011-11-15 7:09 ` Kukjin Kim
2011-11-17 1:41 ` padma venkat
0 siblings, 1 reply; 13+ messages in thread
From: Kukjin Kim @ 2011-11-15 7:09 UTC (permalink / raw)
To: linux-arm-kernel
padma venkat wrote:
> Hi Mark,
> On Fri, Nov 4, 2011 at 4:27 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Fri, Nov 04, 2011 at 08:43:54AM -0400, Padmavathi Venna wrote:
>
> > +#ifdef CONFIG_S3C64XX_DEV_SPI0
> > +static struct s3c64xx_spi_info crag6410_spi0_pdata __initdata = {
> > + ? ? .cfg_gpio ? ? ? = s3c64xx_spi0_cfg_gpio,
> > + ? ? .fifo_lvl_mask ?= 0x7f,
> > + ? ? .rx_lvl_offset ?= 13,
> > + ? ? .tx_st_done ? ? = 21,
> > +};
> > +#endif
> It seems like a step backwards to have all this stuff in the individual
> machines - most of this (everything except cfg_gpio pretty much) is a
> property of the SoC silicon so should be somewhere central for the SoC.
> I Will?move this stuff to SPI setup files and resend the patches.
> Thanks
> Padma
Hi Padma,
Please send text-typed e-mail when you reply :)
And I agree with Mark, how was going on?
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/6] ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung
2011-11-15 7:08 ` Kukjin Kim
@ 2011-11-17 1:39 ` padma venkat
0 siblings, 0 replies; 13+ messages in thread
From: padma venkat @ 2011-11-17 1:39 UTC (permalink / raw)
To: linux-arm-kernel
Hi Kukjin,
On Tue, Nov 15, 2011 at 12:38 PM, Kukjin Kim <kgene.kim@samsung.com> wrote:
> Padmavathi Venna wrote:
>>
>> SPI platform device definitions consolidated from respective machine
>> folder to plat-samsung
>>
>> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
>> ---
>> ?arch/arm/mach-s3c64xx/Makefile ? ? ? ? ? ? ? ? ? | ? ?1 -
>> ?arch/arm/mach-s3c64xx/dev-spi.c ? ? ? ? ? ? ? ? ?| ?172 -----------------
>> ?arch/arm/mach-s5p64x0/Makefile ? ? ? ? ? ? ? ? ? | ? ?1 -
>> ?arch/arm/mach-s5p64x0/dev-spi.c ? ? ? ? ? ? ? ? ?| ?218
> ---------------------
>> ?arch/arm/mach-s5pc100/Makefile ? ? ? ? ? ? ? ? ? | ? ?1 -
>> ?arch/arm/mach-s5pc100/dev-spi.c ? ? ? ? ? ? ? ? ?| ?220
> ----------------------
>> ?arch/arm/mach-s5pv210/Makefile ? ? ? ? ? ? ? ? ? | ? ?1 -
>> ?arch/arm/mach-s5pv210/dev-spi.c ? ? ? ? ? ? ? ? ?| ?169 -----------------
>> ?arch/arm/plat-samsung/Kconfig ? ? ? ? ? ? ? ? ? ?| ? 14 ++-
>> ?arch/arm/plat-samsung/devs.c ? ? ? ? ? ? ? ? ? ? | ?112 +++++++++++
>> ?arch/arm/plat-samsung/include/plat/devs.h ? ? ? ?| ? ?8 +-
>> ?arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | ? 13 +-
>> ?12 files changed, 133 insertions(+), 797 deletions(-)
>> ?delete mode 100644 arch/arm/mach-s3c64xx/dev-spi.c
>> ?delete mode 100644 arch/arm/mach-s5p64x0/dev-spi.c
>> ?delete mode 100644 arch/arm/mach-s5pc100/dev-spi.c
>> ?delete mode 100644 arch/arm/mach-s5pv210/dev-spi.c
>>
>
> Hi Padma,
>
> Basically, looks good and there are some comments below.
>
> (snip)
>
>> diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
>> index 313eb26..8a2b23a 100644
>> --- a/arch/arm/plat-samsung/Kconfig
>> +++ b/arch/arm/plat-samsung/Kconfig
>> @@ -226,7 +226,19 @@ config SAMSUNG_DEV_IDE
>> ? ? ? help
>> ? ? ? ? Compile in platform device definitions for IDE
>>
>> -config S3C64XX_DEV_SPI
>> +config S3C64XX_DEV_SPI0
>> + ? ? bool
>> + ? ? help
>> + ? ? ? Compile in platform device definitions for S3C64XX's type
>> + ? ? ? SPI controllers.
>> +
>> +config S3C64XX_DEV_SPI1
>> + ? ? bool
>> + ? ? help
>> + ? ? ? Compile in platform device definitions for S3C64XX's type
>> + ? ? ? SPI controllers.
>> +
>> +config S3C64XX_DEV_SPI2
>
> Yeah, needs above config to check the channel now...but I'm thinking need to
> sort out it anyway.
>
>> ? ? ? bool
>> ? ? ? help
>> ? ? ? ? Compile in platform device definitions for S3C64XX's type
>> diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
>> index 4ca8b57..76e374d 100644
>> --- a/arch/arm/plat-samsung/devs.c
>> +++ b/arch/arm/plat-samsung/devs.c
>> @@ -61,6 +61,7 @@
>> ?#include <plat/regs-iic.h>
>> ?#include <plat/regs-serial.h>
>> ?#include <plat/regs-spi.h>
>> +#include <plat/s3c64xx-spi.h>
>>
>> ?static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
>>
>> @@ -1461,3 +1462,114 @@ struct platform_device s3c_device_wdt = {
>> ? ? ? .resource ? ? ? = s3c_wdt_resource,
>> ?};
>> ?#endif /* CONFIG_S3C_DEV_WDT */
>> +
>> +#ifdef CONFIG_S3C64XX_DEV_SPI0
>> +static struct resource s3c64xx_spi0_resource[] = {
>> + ? ? [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
>> + ? ? [1] = DEFINE_RES_DMA(DMACH_SPI0_TX),
>> + ? ? [2] = DEFINE_RES_DMA(DMACH_SPI0_RX),
>> + ? ? [3] = DEFINE_RES_IRQ(IRQ_SPI0),
>> +};
>> +
>> +struct platform_device s3c64xx_device_spi0 = {
>> + ? ? .name ? ? ? ? ? = "s3c64xx-spi",
>> + ? ? .id ? ? ? ? ? ? = 0,
>> + ? ? .num_resources ?= ARRAY_SIZE(s3c64xx_spi0_resource),
>> + ? ? .resource ? ? ? = s3c64xx_spi0_resource,
>> + ? ? .dev = {
>> + ? ? ? ? ? ? .dma_mask ? ? ? ? ? ? ? = &samsung_device_dma_mask,
>> + ? ? ? ? ? ? .coherent_dma_mask ? ? ?= DMA_BIT_MASK(32),
>> + ? ? },
>> +};
>> +
>> +void __init s3c64xx_spi0_set_info(struct s3c64xx_spi_info *pd,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int src_clk_nr, int num_cs)
>
> How about 's3c64xx_spi_set_platdata' like others in plat-samsung/devs.c?
>
>> +{
>> + ? ? if (!pd) {
>> + ? ? ? ? ? ? pr_err("%s:Need to pass platform data\n", __func__);
>> + ? ? ? ? ? ? return;
>> + ? ? }
>
> Needs empty line here.
Okey.
>
>> + ? ? /* Reject invalid configuration */
>> + ? ? if (!num_cs || src_clk_nr < 0) {
>> + ? ? ? ? ? ? pr_err("%s: Invalid SPI configuration\n", __func__);
>> + ? ? ? ? ? ? return;
>> + ? ? }
>
> Same as above.
Okey.
>
>> + ? ? pd->num_cs = num_cs;
>> + ? ? pd->src_clk_nr = src_clk_nr;
>> + ? ? s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0);
>
> If we know the SPI controller number here, we can merge this function to
> just one. So how about to add it to the 'struct s3c64xx_spi_info'?
Yes. It is good to have the controller number in the SPI Controller
defining structure.
So I will rebase the patches based on latest for-next branch and
submit the patches.
Thanks&Regards
Padma
>> +}
>
> (snip)
>
> Thanks.
>
> Best regards,
> Kgene.
> --
> Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
> SW Solution Development Team, Samsung Electronics Co., Ltd.
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 6/6] ARM: S3C64XX: Modified according to SPI consolidation work.
2011-11-15 7:09 ` Kukjin Kim
@ 2011-11-17 1:41 ` padma venkat
0 siblings, 0 replies; 13+ messages in thread
From: padma venkat @ 2011-11-17 1:41 UTC (permalink / raw)
To: linux-arm-kernel
Hi Kukjin,
On Tue, Nov 15, 2011 at 12:39 PM, Kukjin Kim <kgene.kim@samsung.com> wrote:
> padma venkat wrote:
>
>> Hi Mark,
>> On Fri, Nov 4, 2011 at 4:27 PM, Mark Brown
> <broonie@opensource.wolfsonmicro.com> wrote:
>> On Fri, Nov 04, 2011 at 08:43:54AM -0400, Padmavathi Venna wrote:
>>
>> > +#ifdef CONFIG_S3C64XX_DEV_SPI0
>> > +static struct s3c64xx_spi_info crag6410_spi0_pdata __initdata = {
>> > + ? ? .cfg_gpio ? ? ? = s3c64xx_spi0_cfg_gpio,
>> > + ? ? .fifo_lvl_mask ?= 0x7f,
>> > + ? ? .rx_lvl_offset ?= 13,
>> > + ? ? .tx_st_done ? ? = 21,
>> > +};
>> > +#endif
>> It seems like a step backwards to have all this stuff in the individual
>> machines - most of this (everything except cfg_gpio pretty much) is a
>> property of the SoC silicon so should be somewhere central for the SoC.
>> I Will?move this stuff to SPI setup files and resend the patches.
>> Thanks
>> Padma
>
> Hi Padma,
>
> Please send text-typed e-mail when you reply :)
Okey.
>
> And I agree with Mark, how was going on?
I will send the patches by tomorrow.
Thanks&Regards
Padma
>
> Thanks.
>
> Best regards,
> Kgene.
> --
> Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
> SW Solution Development Team, Samsung Electronics Co., Ltd.
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-11-17 1:41 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-04 12:43 [PATCH 0/6] SPI platform device consolidation Padmavathi Venna
2011-11-04 12:43 ` [PATCH 1/6] ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung Padmavathi Venna
2011-11-15 7:08 ` Kukjin Kim
2011-11-17 1:39 ` padma venkat
2011-11-04 12:43 ` [PATCH 2/6] ARM: S3C64XX: Modified files for SPI consolidation work Padmavathi Venna
2011-11-04 12:43 ` [PATCH 3/6] ARM: S5PC100: " Padmavathi Venna
2011-11-04 12:43 ` [PATCH 4/6] ARM: S5P64X0: " Padmavathi Venna
2011-11-04 12:43 ` [PATCH 5/6] ARM: S5PV210: " Padmavathi Venna
2011-11-04 12:43 ` [PATCH 6/6] ARM: S3C64XX: Modified according to " Padmavathi Venna
2011-11-04 10:57 ` Mark Brown
[not found] ` <CAAgF-Bcj3vm50YOU4Sq4cGrOE8EHixjOuFrQq-MR6FVLf7Dekg@mail.gmail.com>
2011-11-15 7:09 ` Kukjin Kim
2011-11-17 1:41 ` padma venkat
2011-11-05 3:32 ` [PATCH 0/6] SPI platform device consolidation Kukjin Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).