From patchwork Tue Dec 1 18:55:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7739811 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 4C0AF9F30B for ; Tue, 1 Dec 2015 18:57:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 657702065B for ; Tue, 1 Dec 2015 18:57:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5FF942067A for ; Tue, 1 Dec 2015 18:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756807AbbLAS5m (ORCPT ); Tue, 1 Dec 2015 13:57:42 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:33336 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756774AbbLAS5l (ORCPT ); Tue, 1 Dec 2015 13:57:41 -0500 Received: by wmec201 with SMTP id c201so220183653wme.0 for ; Tue, 01 Dec 2015 10:57:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=dK0Txuqw66QAT1PS8Bej+btaumedU9L8sRh1IsjB+pY=; b=I3k5lhcD44Pp4ywtUG6F1SAHBYB6cfqSUEqlP/EOwwRRbe0+PgzRYiJ4/lsRTLKEbG E0vsCwkoB8CKF0aZXn1B5SWHjgYkBZV6+bzmSSiSvv7QoIHxIBRsdbRY+iKqKpc79wzL osDx3YXtVSGcYABll/rJomD6kuMpmcs8kEY4NYkwmx/9jaZf0pyoWsfxQn4oQ68A9kKx RUD9zWIDVyjGFu5zvb4V7T7BTreQSU3sPWlw6X6kivTu/2tdPtizkDki3BWHWo+UYUJc FWJj2pRDzS1CDcPZ/ITau/PZqB12wUgQivFMrOulJkl/azBUJvxW/+Pdw80O5b9Ub8yw PBug== X-Received: by 10.28.126.197 with SMTP id z188mr39986358wmc.88.1448996260295; Tue, 01 Dec 2015 10:57:40 -0800 (PST) Received: from ?IPv6:2003:62:5f55:ba00:949c:d06:4422:d8e5? (p200300625F55BA00949C0D064422D8E5.dip0.t-ipconnect.de. [2003:62:5f55:ba00:949c:d06:4422:d8e5]) by smtp.googlemail.com with ESMTPSA id he3sm52918034wjc.25.2015.12.01.10.57.39 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 Dec 2015 10:57:39 -0800 (PST) To: Mark Brown Cc: "linux-spi@vger.kernel.org" From: Heiner Kallweit Subject: [PATCH v2 1/2] spi: core: add max_msg_size to spi_master Message-ID: <565DED1B.90903@gmail.com> Date: Tue, 1 Dec 2015 19:55:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 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);