From patchwork Tue Dec 24 00:58:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 182426 Delivered-To: patch@linaro.org Received: by 2002:a92:a146:0:0:0:0:0 with SMTP id v67csp1083297ili; Mon, 23 Dec 2019 16:59:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwwIBXpoUtl5Bge/YvCQ+J1Abf5Huy6Xk/KUFe4ybeswzZaKZcsdnpnU/MtrQYLWU+Aw4WE X-Received: by 2002:a9d:6d06:: with SMTP id o6mr36240362otp.239.1577149143066; Mon, 23 Dec 2019 16:59:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577149143; cv=none; d=google.com; s=arc-20160816; b=JFMaujSjlB+EcLHrSAZb+qsXlexE6tN9HtogfdVnzdPHeaTDK6a2NiIJ0tOxax+mwN B/AtK4ZKDYJDmDeCMl7x66pLk4LWq++isVVgak6+F/JTdObCuG5BByKmJcnuL1Tv27C9 vYzPktB90Dy4Fvte/1PccQgfC6fxXne+e1OEcE2cM6t2Pt66S99xh6+QlRzuY2wp0KiK 692OwKW4J9smmAykizUNqTlLY0DqU63I409V+uCBhFQdiCcrom0GZbPdDso9TejGk4LZ 5LrX59cgqePV/bVX8bmT0wlh2Vwc4kJkzZdLlp9rjbjo6ITew31/lIvGD0y7EEGtGEP9 L0sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=gaUknwGtgEirjGjxjp9lGlT8cAC3dFZC3L/OkyydUIQ=; b=zWB1LtNfNa0M6wRNHAz20BtDykqSi8M0abbTxM4UJiY8eAjScztg5bLX9oL4LCI8eE 858kCkjxTsrl+Zte08qN7B6zf2jtYI6ZMf8T6Lwkf6gOYRiA+K7iJrmqt7x+wg7LZ+HI 5euDGAMbcQXB+gCxXLee2oEseisczUqzQ2aZX4URWa/pgUns1zhrAeQhi6QdRw0+dlZN XRZxUYiZyPiS1TYHL6949XOv7pWAklLCtav9/I8PVRHBUaMdQwhMGJ5kiAHeYlIGCQdm 4dGKMJNbiEGkfgGBxIWeixlyixfZlazMvAc6nzaRKjXKM9HgxiPBhGQ/ERLZiht16FVm ROMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i20si5744006oie.119.2019.12.23.16.59.02; Mon, 23 Dec 2019 16:59:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727071AbfLXA67 (ORCPT + 2 others); Mon, 23 Dec 2019 19:58:59 -0500 Received: from mx.socionext.com ([202.248.49.38]:23640 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727030AbfLXA6u (ORCPT ); Mon, 23 Dec 2019 19:58:50 -0500 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 24 Dec 2019 09:58:48 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id C4C45603AB; Tue, 24 Dec 2019 09:58:48 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Tue, 24 Dec 2019 09:59:28 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 4149E1A01CF; Tue, 24 Dec 2019 09:58:48 +0900 (JST) From: Kunihiko Hayashi To: Mark Brown , linux-spi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Masahiro Yamada , Keiji Hayashibara , Masami Hiramatsu , Jassi Brar , Kunihiko Hayashi Subject: [PATCH 3/5] spi: uniphier: Add handle_err callback function Date: Tue, 24 Dec 2019 09:58:25 +0900 Message-Id: <1577149107-30670-4-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1577149107-30670-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1577149107-30670-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org This adds master->handle_err() callback function to stop transfer due to error. The function also resets FIFOs and disables interrupt. Signed-off-by: Kunihiko Hayashi --- drivers/spi/spi-uniphier.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.7.4 diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c index 3859649..c4e3b96 100644 --- a/drivers/spi/spi-uniphier.c +++ b/drivers/spi/spi-uniphier.c @@ -432,6 +432,22 @@ static int uniphier_spi_unprepare_transfer_hardware(struct spi_master *master) return 0; } +static void uniphier_spi_handle_err(struct spi_master *master, + struct spi_message *msg) +{ + struct uniphier_spi_priv *priv = spi_master_get_devdata(master); + u32 val; + + /* stop running spi transfer */ + writel(0, priv->base + SSI_CTL); + + /* reset FIFOs */ + val = SSI_FC_TXFFL | SSI_FC_RXFFL; + writel(val, priv->base + SSI_FC); + + uniphier_spi_irq_disable(priv, SSI_IE_RCIE | SSI_IE_RORIE); +} + static irqreturn_t uniphier_spi_handler(int irq, void *dev_id) { struct uniphier_spi_priv *priv = dev_id; @@ -538,6 +554,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) = uniphier_spi_prepare_transfer_hardware; master->unprepare_transfer_hardware = uniphier_spi_unprepare_transfer_hardware; + master->handle_err = uniphier_spi_handle_err; master->num_chipselect = 1; ret = devm_spi_register_master(&pdev->dev, master);