From patchwork Mon Nov 30 20:24:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7729381 Return-Path: X-Original-To: patchwork-linux-spi@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 ADC059F1C2 for ; Mon, 30 Nov 2015 20:26:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6A5620524 for ; Mon, 30 Nov 2015 20:26:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E965D205B1 for ; Mon, 30 Nov 2015 20:26:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752335AbbK3U0E (ORCPT ); Mon, 30 Nov 2015 15:26:04 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:34734 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752459AbbK3U0D (ORCPT ); Mon, 30 Nov 2015 15:26:03 -0500 Received: by wmvv187 with SMTP id v187so175493718wmv.1 for ; Mon, 30 Nov 2015 12:26:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=dK0Txuqw66QAT1PS8Bej+btaumedU9L8sRh1IsjB+pY=; b=dEXiJE5c749G9I4s0wlzSddqFi48Y+jQfneGWWQIgWaDTfL0gz8wR3ir0FICvOM5u1 Z3B/JnNjjgMLvaAZJ7dRJ4YEizFSTOPR7IYJvrMGYQKp2dVhwBeAI96TFmw33ISAvddY KrOXoRasiwUocDIEMvjUzFVXa6mbwKqcQR3UWiKTLm5+RAmehuuEWWxeKxA2Y7SW/orh YPhXBbTbsYCQuzWmdDMoKpayGi9kEC8RikODOpo4R8FOZk5s7DEakSqQHYdkdGUNY6zz 9XWPEzzSiH1miSBQqseeNWI3vV7/szIk2yzPnFiQ/chHrrhtcwL+3YOv7hdVAIPncGfa wsSQ== X-Received: by 10.28.225.84 with SMTP id y81mr32024736wmg.87.1448915162609; Mon, 30 Nov 2015 12:26:02 -0800 (PST) Received: from ?IPv6:2003:62:5f55:ba00:f031:46ac:9345:ebe8? (p200300625F55BA00F03146AC9345EBE8.dip0.t-ipconnect.de. [2003:62:5f55:ba00:f031:46ac:9345:ebe8]) by smtp.googlemail.com with ESMTPSA id 186sm23046555wmv.9.2015.11.30.12.26.01 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Nov 2015 12:26:01 -0800 (PST) From: Heiner Kallweit Subject: [PATCH v2 1/2] spi: core: add max_msg_size to spi_master To: Mark Brown , Brian Norris References: <564CEB61.2000601@gmail.com> <20151118215755.GL31303@sirena.org.uk> <564D0098.4030107@gmail.com> <20151119114057.GN31303@sirena.org.uk> <20151119171538.GO31303@sirena.org.uk> <9CDADBED-FD18-4635-82A9-5AB14C9ABCAE@sperl.org> <20151120120502.GT31303@sirena.org.uk> <08871ECD-52DF-4CBF-AF3D-4C3A442C008A@sperl.org> <20151121134946.GI26072@sirena.org.uk> <56507B3B.4080608@gmail.com> Cc: Michal Suchanek , Martin Sperl , MTD Maling List , "linux-spi@vger.kernel.org" Message-ID: <565CB06B.4000503@gmail.com> Date: Mon, 30 Nov 2015 21:24:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Add a member to spi_master allowing to better handle SPI chips with a message size HW limit. Signed-off-by: Heiner Kallweit --- v2: add accessor include/linux/spi/spi.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index cce80e6..a8abd24 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -302,6 +302,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) * and it's up to the individual driver to perform any validation. * @min_speed_hz: Lowest supported transfer speed * @max_speed_hz: Highest supported transfer speed + * @max_msg_size: maximum supported message size * @flags: other constraints relevant to this driver * @bus_lock_spinlock: spinlock for SPI bus locking * @bus_lock_mutex: mutex for SPI bus locking @@ -417,6 +418,9 @@ struct spi_master { u32 min_speed_hz; u32 max_speed_hz; + /* maximum message size */ + size_t max_msg_size; + /* other constraints relevant to this driver */ u16 flags; #define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ @@ -556,6 +560,11 @@ static inline void spi_master_put(struct spi_master *master) put_device(&master->dev); } +static inline size_t spi_master_get_max_msg_size(struct spi_master *master) +{ + return master->max_msg_size; +} + /* PM calls that need to be issued by the driver */ extern int spi_master_suspend(struct spi_master *master); extern int spi_master_resume(struct spi_master *master);