From patchwork Wed Dec 7 02:09:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Bostic X-Patchwork-Id: 9463765 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1AB7C6022E for ; Wed, 7 Dec 2016 02:12:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C02C28433 for ; Wed, 7 Dec 2016 02:12:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00503284D0; Wed, 7 Dec 2016 02:12:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BDB5528433 for ; Wed, 7 Dec 2016 02:12:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cERhY-0000cf-Qe; Wed, 07 Dec 2016 02:11:20 +0000 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cERgM-0006kb-I5 for linux-arm-kernel@lists.infradead.org; Wed, 07 Dec 2016 02:10:08 +0000 Received: by mail-oi0-x241.google.com with SMTP id v84so43674285oie.2 for ; Tue, 06 Dec 2016 18:09:46 -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:in-reply-to:references; bh=OgSQFgxkkAAohtpWudHroeD6K/UIuoMv+mdhkueGTg4=; b=JJg+e2gMh4sms5WFREhIjDgSY1OtwOOrFvnmUQxlz4WgAor6uYaEsXevuv030N1gI5 SGD0y0da6RQouJvSXZFckYExuOsY73f3N0WwzDr29MZwNEb/OL+bES5Z9m14gczKqRgW oq8VWlQkwBHOop7ZIodaLEhBah00vJpBRRv/iR5tL1OgXliR+L9m8QcwJSlQxp2hGiNE yobpEyV0mekECLPRllK5RPGYIqYL/acpNXi8ICX19cl7wsvrsh1Aong77t7LeqDOZnv5 PTOptkeAAWaWYXDbIJ5Yp4BYsT1nLh2OvNervIQETvSESPU/TSpJ+AGbWBZMmC35SHA1 dGYA== 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:in-reply-to :references; bh=OgSQFgxkkAAohtpWudHroeD6K/UIuoMv+mdhkueGTg4=; b=eWor+sLCp39UgOE8XSiUVp2K39OxirQjX0S66umWVnopJ+4xel8HQK+2Da0tot70dC EFkfUd/6t2STDJKbsvEig5VYlxDBnF/wapK8xBTlcaiBp6TZrfPnNv/zIMH+292SEVr+ X8diDvPNnAAK6lrfL8bEHiUbc8LCJlDg2ZIswFtzmQef2wQvzxBPB65Gug+KCWaNy+Nc Q8+rSYXX8iHk70A37yLJDizh9/S9hOErCB55/RbJ9ARwnaWKHNQiY11NfsB/6nQCm6j/ g/nuRGFLZQccOddXMvUVSAw0hBBaaj6mbCAwjV+ssLlsij3UL5B0CVbvoE5CraqZrpIg CpVQ== X-Gm-Message-State: AKaTC037YcjlH+Pzqt4Z/IWzDeIhrmr27NLW37YlR+JotEN07RMUxCwJwWZ4EKmVhQDybA== X-Received: by 10.202.56.70 with SMTP id f67mr3127779oia.21.1481076586374; Tue, 06 Dec 2016 18:09:46 -0800 (PST) Received: from Christophers-MacBook-Pro.local.com (45-20-192-79.lightspeed.austtx.sbcglobal.net. [45.20.192.79]) by smtp.gmail.com with ESMTPSA id q66sm8826335oic.8.2016.12.06.18.09.45 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 06 Dec 2016 18:09:45 -0800 (PST) From: Chris Bostic To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, gregkh@linuxfoundation.org, sre@kernel.org, mturquette@baylibre.com, geert+renesas@glider.be, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 12/16] drivers/fsi: Set up links for slave communication Date: Tue, 6 Dec 2016 20:09:34 -0600 Message-Id: <1481076574-54711-5-git-send-email-christopher.lee.bostic@gmail.com> X-Mailer: git-send-email 2.7.4 (Apple Git-66) In-Reply-To: <1481076574-54711-1-git-send-email-christopher.lee.bostic@gmail.com> References: <1481076574-54711-1-git-send-email-christopher.lee.bostic@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161206_181006_909546_6719F5ED X-CRM114-Status: GOOD ( 13.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@aj.id.au, alistair@popple.id.au, linux-kernel@vger.kernel.org, Chris Bostic , joel@jms.id.au, benh@kernel.crashing.org, jk@ozlabs.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chris Bostic Enable each link and send a break command in preparation for scanning each link for slaves. Signed-off-by: Chris Bostic --- drivers/fsi/fsi-core.c | 39 ++++++++++++++++++++++++++++++++++++--- drivers/fsi/fsi-master.h | 2 ++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 80feeb8..93de0f1 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -290,16 +290,49 @@ static int fsi_slave_init(struct fsi_master *master, /* FSI master support */ +static int fsi_master_link_enable(struct fsi_master *master, int link) +{ + if (master->link_enable) + return master->link_enable(master, link); + + return 0; +} + +/* + * Issue a break command on this link + */ +static int fsi_master_break(struct fsi_master *master, int link) +{ + if (master->send_break) + return master->send_break(master, link); + + return 0; +} + static int fsi_master_scan(struct fsi_master *master) { - int link, slave_id; + int link, slave_id, rc; + + for (link = 0; link < master->n_links; link++) { + rc = fsi_master_link_enable(master, link); + if (rc) { + dev_dbg(master->dev, + "enable link:%d failed with:%d\n", link, rc); + continue; + } + rc = fsi_master_break(master, link); + if (rc) { + dev_dbg(master->dev, + "Break to link:%d failed with:%d\n", link, rc); + continue; + } - for (link = 0; link < master->n_links; link++) for (slave_id = 0; slave_id < FSI_N_SLAVES; slave_id++) fsi_slave_init(master, link, slave_id); - return 0; + } + return 0; } int fsi_master_register(struct fsi_master *master) diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h index cafb433..56aad0e 100644 --- a/drivers/fsi/fsi-master.h +++ b/drivers/fsi/fsi-master.h @@ -29,6 +29,8 @@ struct fsi_master { int (*write)(struct fsi_master *, int link, uint8_t slave, uint32_t addr, const void *val, size_t size); + int (*send_break)(struct fsi_master *, int link); + int (*link_enable)(struct fsi_master *, int link); }; extern int fsi_master_register(struct fsi_master *master);