From patchwork Wed Jul 11 15:41:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 1183261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 97C343FC8E for ; Wed, 11 Jul 2012 15:38:08 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SoysT-00077w-OT; Wed, 11 Jul 2012 15:30:57 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Soypi-0006oq-Rj for linux-arm-kernel@lists.infradead.org; Wed, 11 Jul 2012 15:28:10 +0000 Received: from epcpsbgm1.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M7000KQT5LR5CQ0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 12 Jul 2012 00:27:38 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-0c-4ffd9b6930c0 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id A9.6B.19326.96B9DFF4; Thu, 12 Jul 2012 00:27:37 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M70002YF5LJ4S00@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 12 Jul 2012 00:27:37 +0900 (KST) From: Thomas Abraham To: spi-devel-general@lists.sourceforge.net, devicetree-discuss@lists.ozlabs.org Subject: [PATCH v5 4/6] ARM: Samsung: Modify s3c64xx_spi{0|1|2}_set_platdata function Date: Wed, 11 Jul 2012 21:11:03 +0530 Message-id: <1342021265-11212-5-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1342021265-11212-1-git-send-email-thomas.abraham@linaro.org> References: <1342021265-11212-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrAJMWRmVeSWpSXmKPExsVy+t9jQd3M2X/9DU7OsbDY9PgaqwOjx+Yl 9QGMUVw2Kak5mWWpRfp2CVwZPa2BBWdNKpbvPMTUwLhCu4uRg0NCwETi4j2/LkZOIFNM4sK9 9WxdjFwcQgLTGSW2X//GCJIQEljPJLH/SCiIzSZgIPFo4Tt2EFtEIEDiRl8rC0gDs8BtRonb l1YzgSSEBcIltt/dwAxiswioSvQt+wRm8wp4Ssz52soOsU1JYkPvUbB6TgEvicVT5jBBLPOU WLp4PfMERt4FjAyrGEVTC5ILipPScw31ihNzi0vz0vWS83M3MYL9/UxqB+PKBotDjAIcjEo8 vAtm/vUXYk0sK67MPcQowcGsJMJbPgEoxJuSWFmVWpQfX1Sak1p8iFGag0VJnNfY+6u/kEB6 YklqdmpqQWoRTJaJg1OqgVH4wJ7HegeWKVWx5jxQfa+R79qreOJdBsvWQ4IG/ZN5guJrQx4V trcyyOv8rJi9Z1JnbmyxmmrP7sf/X79U6lG8dXxZVmjs0qUs2uy/l9esUFrzPFIrw62+6Pdu 7+Rp0RZr49oVvBc68VqdObr+9ofnzqGHX2+/tOzJhZtTLHdI7ncO2mXaIKLEUpyRaKjFXFSc CAAPrY2f8wEAAA== X-TM-AS-MML: No X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-samsung-soc@vger.kernel.org, broonie@opensource.wolfsonmicro.com, rob.herring@calxeda.com, grant.likely@secretlab.ca, jaswinder.singh@linaro.org, kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org With the spi controller hardware configuration moved into the driver data, there are no more default hardware configuration data that is passed through platform data. Accordingly, the s3c64xx_spi{0|1|2}_set_platdata functions are adapted to these changes. Signed-off-by: Thomas Abraham Acked-by: Jaswinder Singh --- arch/arm/mach-s3c64xx/mach-crag6410.c | 2 +- arch/arm/plat-samsung/devs.c | 60 ++++++++------------- arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | 14 +++--- 3 files changed, 31 insertions(+), 45 deletions(-) diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c index 161c3b6..3627444 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c @@ -798,7 +798,7 @@ static void __init crag6410_machine_init(void) i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); samsung_keypad_set_platdata(&crag6410_keypad_data); - s3c64xx_spi0_set_platdata(&s3c64xx_spi0_pdata, 0, 1); + s3c64xx_spi0_set_platdata(NULL, 0, 1); platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices)); diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 1d214cb..86d0758 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c @@ -1512,7 +1512,7 @@ static struct resource s3c64xx_spi0_resource[] = { }; struct platform_device s3c64xx_device_spi0 = { - .name = "s3c64xx-spi", + .name = "s3c6410-spi", .id = 0, .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource), .resource = s3c64xx_spi0_resource, @@ -1522,13 +1522,10 @@ struct platform_device s3c64xx_device_spi0 = { }, }; -void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, - int src_clk_nr, int num_cs) +void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, + int num_cs) { - if (!pd) { - pr_err("%s:Need to pass platform data\n", __func__); - return; - } + struct s3c64xx_spi_info pd; /* Reject invalid configuration */ if (!num_cs || src_clk_nr < 0) { @@ -1536,12 +1533,11 @@ void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, return; } - pd->num_cs = num_cs; - pd->src_clk_nr = src_clk_nr; - if (!pd->cfg_gpio) - pd->cfg_gpio = s3c64xx_spi0_cfg_gpio; + pd.num_cs = num_cs; + pd.src_clk_nr = src_clk_nr; + pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio; - s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0); + s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0); } #endif /* CONFIG_S3C64XX_DEV_SPI0 */ @@ -1554,7 +1550,7 @@ static struct resource s3c64xx_spi1_resource[] = { }; struct platform_device s3c64xx_device_spi1 = { - .name = "s3c64xx-spi", + .name = "s3c6410-spi", .id = 1, .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource), .resource = s3c64xx_spi1_resource, @@ -1564,26 +1560,20 @@ struct platform_device s3c64xx_device_spi1 = { }, }; -void __init s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd, - int src_clk_nr, int num_cs) +void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), 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; - if (!pd->cfg_gpio) - pd->cfg_gpio = s3c64xx_spi1_cfg_gpio; + pd.num_cs = num_cs; + pd.src_clk_nr = src_clk_nr; + pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio; - s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi1); + s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1); } #endif /* CONFIG_S3C64XX_DEV_SPI1 */ @@ -1596,7 +1586,7 @@ static struct resource s3c64xx_spi2_resource[] = { }; struct platform_device s3c64xx_device_spi2 = { - .name = "s3c64xx-spi", + .name = "s3c6410-spi", .id = 2, .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource), .resource = s3c64xx_spi2_resource, @@ -1606,13 +1596,10 @@ struct platform_device s3c64xx_device_spi2 = { }, }; -void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, - int src_clk_nr, int num_cs) +void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, + int num_cs) { - if (!pd) { - pr_err("%s:Need to pass platform data\n", __func__); - return; - } + struct s3c64xx_spi_info pd; /* Reject invalid configuration */ if (!num_cs || src_clk_nr < 0) { @@ -1620,11 +1607,10 @@ void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, return; } - pd->num_cs = num_cs; - pd->src_clk_nr = src_clk_nr; - if (!pd->cfg_gpio) - pd->cfg_gpio = s3c64xx_spi2_cfg_gpio; + pd.num_cs = num_cs; + pd.src_clk_nr = src_clk_nr; + pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio; - s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi2); + s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2); } #endif /* CONFIG_S3C64XX_DEV_SPI2 */ diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h index 89dbaee..c818a7c 100644 --- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h +++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h @@ -45,19 +45,19 @@ struct s3c64xx_spi_info { /** * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board * initialization code. - * @pd: SPI platform data to set. + * @cfg_gpio: Pointer to gpio setup function. * @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_spi0_set_platdata(struct s3c64xx_spi_info *pd, - int src_clk_nr, int num_cs); -extern void s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd, - int src_clk_nr, int num_cs); -extern void s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, - int src_clk_nr, int num_cs); +extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, + int num_cs); +extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, + int num_cs); +extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, + int num_cs); /* defined by architecture to configure gpio */ extern int s3c64xx_spi0_cfg_gpio(void);