Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3224815ybf; Tue, 3 Mar 2020 01:53:23 -0800 (PST) X-Google-Smtp-Source: ADFU+vs8ghTkxidbikCaf3vYk1tDO2Y6fFWLnWpRgzVv54Tfbvv5HquDg+2FCxn2R7FNUN5ceVwV X-Received: by 2002:a05:6830:1511:: with SMTP id k17mr2670512otp.53.1583229203609; Tue, 03 Mar 2020 01:53:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583229203; cv=none; d=google.com; s=arc-20160816; b=GbWvZSGKNK13amSnp2dyN4oHy9Duju7HXHSDBRsQAjqfS3P9kGugi9DzhNUh9eONfY sEsXEvlJYrY799EmWCm1zfx2j6tRfID2FK8qzyy2WCx5X7uvoPzAtDBEcYOeuY0uClvG AOc6T6n7iEbOjGelNZn37lOwpK7YmERjBsLidW4l3AsuJooyDT7G28wLRybw3uxEb4m+ SQJCAyMr++BykzY000fC8ahQnkTXmU9oYhAUncLqjbfr6M42wU+c2Eo5XdP+CBBg5JMc hBWwrX403oL2hp0S1kkLId6xFfc9USFB34jlbQ54824yFOcsG1XkgRJU436v30lAAwJG oCJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=O+/xfHKtnuXW4FOy4jowG1WZO/3znxOf7DTmGAtiU4g=; b=Wkfe2KvNXyWHseEnQjaoSQd/xeT4C8ruLCXK5LgQAuKHGgRRbhP4G10mI3oBM+qIPj CjBUO8D5UOY89+EB2bqhrO+ryI/sbXkRAgGgo1OC6vVxP1GbVtVq10wnm38fzvjR5dju qQx3xwtPOyM+YB4399fYnQayOzfE+BwX1cQzvRSx6koanUafMy9qfAXEvycYAZBDym2h 6NmuGwk1i6x+RsBDq7yz3sLmrMDMSSzYcvDCiBtWMe1Wj5OIkM5JMnWLnE1vsD6Ccimh g8TOQBjkFvNJT3wtoYpzpAn17vwVvJFm5nhzA+z2l5RL7hS1t477zEyQCYCDq0OOLc8d haWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 z26si7270740oid.247.2020.03.03.01.53.11; Tue, 03 Mar 2020 01:53:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727469AbgCCJmt (ORCPT + 99 others); Tue, 3 Mar 2020 04:42:49 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:2500 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725932AbgCCJmt (ORCPT ); Tue, 3 Mar 2020 04:42:49 -0500 Received: from LHREML710-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 17437D1B0E2FDFC47141; Tue, 3 Mar 2020 09:42:47 +0000 (GMT) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by LHREML710-CAH.china.huawei.com (10.201.108.33) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 3 Mar 2020 09:42:46 +0000 Received: from [127.0.0.1] (10.202.226.45) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 3 Mar 2020 09:42:46 +0000 Subject: Re: [PATCH RFC 1/3] spi: Allow SPI controller override device buswidth To: Geert Uytterhoeven CC: Mark Brown , linux-spi , Linuxarm , Linux Kernel Mailing List , MTD Maling List , Andy Shevchenko References: <1582903131-160033-1-git-send-email-john.garry@huawei.com> <1582903131-160033-2-git-send-email-john.garry@huawei.com> From: John Garry Message-ID: Date: Tue, 3 Mar 2020 09:42:45 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.45] X-ClientProxiedBy: lhreml725-chm.china.huawei.com (10.201.108.76) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, > > On Fri, Feb 28, 2020 at 4:23 PM John Garry wrote: >> Currently ACPI firmware description for a SPI device does not have any >> method to describe the data buswidth on the board. >> >> So even through the controller and device may support higher modes than >> standard SPI, it cannot be assumed that the board does - as such, that >> device is limited to standard SPI in such a circumstance. >> >> As a workaround, allow the controller driver supply buswidth override bits, >> which are used inform the core code that the controller driver knows the >> buswidth supported on that board for that device. > > Just wondering: can't the controller just override this (e.g. in the .setuup() > callback) without having to touch the generic code? I think that this is a good idea. However, where we call .setup() in spi_setup() looks a little too late - at the point we call .setup(), most of the work on vetting/fixing the mode bits is complete. And I would not want the SPI controller driver just to disregard this work and overwrite the bits (in this way). And if we wanted to move the .setup callback earlier, then I would be worried here with 2 things: 1. Some SPI controller drivers may rely on spi->mode being set finally when .setup() is called 2. We may need to undo the work of .setup() if we later error in spi_setup(), like for invalid mode bits However, maybe another callback could be introduced, .early_setup(). Thanks, John