Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5309300imm; Wed, 12 Sep 2018 04:18:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbjYhlQtLgWHhJ6UKU34y/7V07NAoWJsFImEfibKuj2AnPBKfMan/3YQqk9ijLQ0+5+zLuL X-Received: by 2002:a63:1823:: with SMTP id y35-v6mr1678136pgl.438.1536751118290; Wed, 12 Sep 2018 04:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536751118; cv=none; d=google.com; s=arc-20160816; b=DSeLogXhe/Z0NY/kCtfwnkVn4N9VvpuWZDHLQKs4solzanUfBLA58Q2b2SZG7wL602 YVRo7SI5/rIrdKYs8uVYhfu3Nii3GhyhPzHy+DSLdRIU2+27BLrXjdSGeGGqk502TgSu h2jhpN1p9G66yA+iohEIbIUkIe3TaZ2DGkvLNnoOnkmrFRwH+YXYuEs/tCo0im9SaNZR 0AL+x5DcWZqdQBivPGJmdDZt0YZcxxpskWYzLLQeego2akNU0CBn4X0vywGzZ6643lAz s9jvFqyy7jtapdyBzAQZHWcMQ+a5x3bRL1bG9U+pJLnb5j+UDZCBnzILHYuftzP5jUUn 2Kgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=LMVbMDCAs0BjjEJgBvK63iKoM7qJd5pcMRovGSKRQjY=; b=oMeXx0pHLn8xY4h5FxjytKC3cemcaRPh5j6tF9+oI6fGGbgr7Z6mkA9JaxSeqa9emK c4PzZ1LdB4mcQaZ5vUAu+je6OW0m8f+UaR+7j9w5oCxXOLSQT4XpYr0v5VRjj34At24/ agI+eGEyJzGceul7FE4K935c4jEJtw+/AJ5TUEcliPtgPP8zU4+zhMsLibpRQVwVFE1X TWo+9hIxOE2nkaRSpuhSg+HbnpI8BUGCHOgYIiBxcvPrzmjdNsf37WyL5SXui1vRXU5T cITgdD5kPewWuXOV0YmBXfIv1yjLWhxsikaVc7EOf1+MBERarKvZJfGjjtNOydHvaPwZ fudQ== 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 r25-v6si665222pfb.65.2018.09.12.04.18.21; Wed, 12 Sep 2018 04:18:38 -0700 (PDT) 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 S1727825AbeILQWW (ORCPT + 99 others); Wed, 12 Sep 2018 12:22:22 -0400 Received: from mail.bootlin.com ([62.4.15.54]:50065 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbeILQWW (ORCPT ); Wed, 12 Sep 2018 12:22:22 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id B325720618; Wed, 12 Sep 2018 13:18:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id 0EBDC206FF; Wed, 12 Sep 2018 13:17:58 +0200 (CEST) Date: Wed, 12 Sep 2018 13:17:57 +0200 From: Alexandre Belloni To: Lee Jones Cc: Geert Uytterhoeven , radu_nicolae.pirea@upb.ro, Rob Herring , Mark Rutland , Nicolas Ferre , Greg KH , Mark Brown , Jiri Slaby , Richard Genoud , "David S. Miller" , Mauro Carvalho Chehab , Andrew Morton , Arnd Bergmann , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , Linux Kernel Mailing List , "open list:SERIAL DRIVERS" , linux-spi Subject: Re: [PATCH v12 0/6] Driver for at91 usart in spi mode Message-ID: <20180912111757.GC2760@piout.net> References: <20180911153621.GP2494@piout.net> <20180911181838.GI4185@dell> <20180911185839.GA25212@piout.net> <20180911224418.GK4185@dell> <20180911225440.GL4185@dell> <20180912073355.GB2557@piout.net> <20180912084143.GN4185@dell> <20180912105407.GR4185@dell> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180912105407.GR4185@dell> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/09/2018 11:54:07+0100, Lee Jones wrote: > On Wed, 12 Sep 2018, Geert Uytterhoeven wrote: > > On Wed, Sep 12, 2018 at 10:41 AM Lee Jones wrote: > > > On Wed, 12 Sep 2018, Alexandre Belloni wrote: > > > > On 11/09/2018 23:54:40+0100, Lee Jones wrote: > > > > > > > http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-6438-32-bit-ARM926-Embedded-Microprocessor-SAM9G45_Datasheet.pdf > > > > > > > > > > > > > > USART doc starting p572, registers p621. > > > > > > > > > > After looking at the datasheet, I don't see any reason why one of the > > > > > two drivers can't be selected using different compatible strings. > > > > > > > > Because there is only one IP and we don't use the device tree to selecet > > > > linux specific drivers. > > > > > > We do it all the time. There are loads of MFDs (def: same IP, with > > > different functions) which have separate compatibles for their various > > > functions. If you wish this IP to operate as an SPI controller, it > > > should have an SPI compatible, if you wish it to operate as a U(S)ART, > > > then it should have a UART compatible. It's what we do for most of > > > the other MFDs in the kernel. > > > > There is a big difference: MFD functions are(more or less) independent > > functions, which can be used at the same time. It makes perfect sense for a > > single IP block that has both SPI and UART interfaces, that can be used at > > the same time. > > > > In this case, there is a single piece of hardware that can perform > > different functions, but not at the same time. Performing a different > > function means configuring the hardware for that function, hence using a > > different driver (from a different subsystem). > > Yes, I can see that PoV. > > But ... we can't have it both ways. *Either* it's a true MFD, in > which case it can/should have 2 separate compatible strings which can > be specified directly from the DT. *Or* it's not an MFD. In the > latter case, which I think we're all agreeing on (else we'd have 2 > compatible strings), MFD is not the place to handle this (my original > point). > If that is what bothers you, then let's move it out of mfd. > So ... this is a USART device which can do SPI, right? > > My current thinking is that; as this is a USART device first & > foremost, the USART should be probed in the first instance regardless, > then if SPI mode is specified it (the USART driver) registers the SPI > platform driver (as MFD does currently) and exits gracefully, allowing > the SPI driver to take over. > > Spanner in the works: is it physically possible to change the mode at > run-time? :s Yes it is possible but on Linux that will not happen without probing the drivers again. I think DT overlays will be the only possible use case because on SPI, you'd still have to provide nodes for the connected SPI devices. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com