From patchwork Tue Feb 9 15:26:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Youngmin Nam X-Patchwork-Id: 8262871 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9B96E9F8AA for ; Tue, 9 Feb 2016 15:27:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B84842012E for ; Tue, 9 Feb 2016 15:27:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A170F20251 for ; Tue, 9 Feb 2016 15:27:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755923AbcBIP1B (ORCPT ); Tue, 9 Feb 2016 10:27:01 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33085 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754143AbcBIP1A (ORCPT ); Tue, 9 Feb 2016 10:27:00 -0500 Received: by mail-pf0-f193.google.com with SMTP id c10so9746566pfc.0; Tue, 09 Feb 2016 07:26:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=SQTPWV3mCVQ7/Ltg7MORII4y6e7It7G11BUwTVLWHAs=; b=prTNO35KqPSKfCpn2IM9sfWTpvNloSqe2bIaD7ecq27EMPia0k2ktDLo66sXg0F8UF PQ4aDxStGHtqMNZdRA2lR7fdx+9WPrc9DCZ3IqeiL7ksXG4uOnduPsfR72Gk1Yqdy7J5 BDrUCmrwsEdebsWidIr3dJn0UEaOrkaS05K3aiPmQWm4IUjznUz6HuG2Fm5Sw0WySlAN OFJjP3t7wEnfntaE0U987iZWLc6vEWSUXEjcCtHi3Zz6dzWsdNMAmdxzJgxTeo/Wxqzc kN0nNDZ5uP3RkXB3z5t+9pc6tiMLPip+E/EaQwyfDIJsmOUP6z7uMEXT7YX+l37FyDxt 0/LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SQTPWV3mCVQ7/Ltg7MORII4y6e7It7G11BUwTVLWHAs=; b=KDCoFsAZZJd4adk6jGLN7q6QaCWW4La9JanydgeLtSDkdkBvillVg3t3fmKwbzPuPa n7I9t2XnG/wsiepX4FlUaMNxq6ymgajb3AO2/JlU2Epozs7/OcREbaT4JHlN33NX332C GNbGCm2tkQEAv0UBzXyWfdpB28naSZ8C0zaBblPKpqxcAGyjozw13F2Za7aOgvE9IiUu mJP+CAlKUy1a5DE5t1ISfye3zOGGVCrWplXFW546f6zDiTbxCVU2sPokqyYWEftqgSPH RyIqjuBlWlp4jzRYXUl1+kSOp4hDm9e+ymaU4IFSf3Vb7fFMDHujyOyZYKtBAjUYVaTn xdQA== X-Gm-Message-State: AG10YOQnN6RLb2HNcs5fXVRgfNwSGTKXUedVLaRF48Vb9MIwzCkPw8HfXjV72ZzhqUgQTw== X-Received: by 10.98.72.133 with SMTP id q5mr51750572pfi.166.1455031619706; Tue, 09 Feb 2016 07:26:59 -0800 (PST) Received: from youngmin-870Z5G-880Z5F ([101.235.122.14]) by smtp.gmail.com with ESMTPSA id s197sm51376286pfs.62.2016.02.09.07.26.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Feb 2016 07:26:59 -0800 (PST) Received: by youngmin-870Z5G-880Z5F (Postfix, from userid 1000) id 1DDFA2E25F2; Wed, 10 Feb 2016 00:26:56 +0900 (KST) From: Youngmin Nam To: kgene@kernel.org, k.kozlowski@samsung.com, broonie@kernel.org Cc: linux-samsung-soc@vger.kernel.org, linux-spi@vger.kernel.org, Youngmin Nam Subject: [PATCH] spi: s3c64xx: Get fifosize via device tree Date: Wed, 10 Feb 2016 00:26:25 +0900 Message-Id: <1455031585-11113-1-git-send-email-ym0914@gmail.com> X-Mailer: git-send-email 2.7.1 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP SPI driver on some SoCs only differ in the fifosize of each SPI channel. It is useless to duplicate the s3c64xx_spi_port_config structure or create a compatible name for such a change. We can get fifosize via the device tree nodes (not mandatory). Also the device tree binding document was updated. Signed-off-by: Youngmin Nam --- Documentation/devicetree/bindings/spi/spi-samsung.txt | 6 ++++++ drivers/spi/spi-s3c64xx.c | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt index 6dbdeb3..5c4a08d 100644 --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt @@ -23,6 +23,11 @@ Required SoC Specific Properties: - dma-names: Names for the dma channels. There must be at least one channel named "tx" for transmit and named "rx" for receive. +Optional SoC Specific properties: + +- samsung,spi-fifosize: The fifo size supported by the SPI channel + + Required Board Specific Properties: - #address-cells: should be 1. @@ -73,6 +78,7 @@ Example: dma-names = "tx", "rx"; #address-cells = <1>; #size-cells = <0>; + samsung,spi-fifosize = <64>; }; - Board Specific Portion: diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 5a76a50..44f1aeb 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1032,6 +1032,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) struct spi_master *master; int ret, irq; char clk_name[16]; + int fifosize; if (!sci && pdev->dev.of_node) { sci = s3c64xx_spi_parse_dt(&pdev->dev); @@ -1083,6 +1084,18 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->port_id = pdev->id; } + if (pdev->dev.of_node) { + if (of_property_read_u32(pdev->dev.of_node, + "samsung,spi-fifosize", &fifosize)) { + } else { + sdd->port_conf->fifo_lvl_mask[sdd->port_id] = + (fifosize << 1) - 1; + dev_info(&pdev->dev, "PORT %d fifo_lvl_mask = 0x%x\n", + sdd->port_id, + sdd->port_conf->fifo_lvl_mask[sdd->port_id]); + } + } + sdd->cur_bpw = 8; if (!sdd->pdev->dev.of_node && (!sci->dma_tx || !sci->dma_rx)) {