Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5281562imm; Wed, 12 Sep 2018 03:54:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaDAXG1VWDO3J1fFd3GsHp3570rjFIX2W+LIA0QQiDMVZ0UQpduYMBawaBmen2Pm9QfCjdP X-Received: by 2002:a63:f:: with SMTP id 15-v6mr1576207pga.430.1536749686478; Wed, 12 Sep 2018 03:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536749686; cv=none; d=google.com; s=arc-20160816; b=H8k5SDuZrIhCQ+IVsMR+rjckeSNzwjyuTZFT5lFA579+NNDTVTyVXSjy8BPtpTOkgi QDvnPwcGY/qW3F5ZrfpNJIjBnB4uivBKdaIi8Lj2n8416fv2bUm4Zf9zYkCbFzN7y2r5 SgotMFHBdgfhmfvcLK3pCyDP3Yz8pLTbrCyqgKnziQpwRjCTHNusepB+G7PvRdqQX/im iMTmYWo8JbEfNhBvevGwR52hfThoROdOhGaYGaBbhMvM1csgl3uJENubLKr/cjBnFqYa 2RkQ7HQoIgcQQs+9LsSDwgkxZRGVZPxYkABtaOQsCZvKU2v3HuPh/Uiefq2CuPvy6yPZ 8kqw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dCZ8O9DZ1ONH2hb7eQPstXDLIl/KhTzzbGzZiXh+87s=; b=Pnykr2kgVqn2dzNmzR4zrXAqe+jVVtPKaqa8H5fwrG1cMIgQZqiEElCkuHeTQdZ2SF ZqAZ+yZIBiR3YYPuZXxtNK41FxMPrU7aOSckOZR+Z1iG9zxTRJLKwslAoVWN5OCVvShQ rSpHP+ckJY4GxgsQCcy306eb8atBH5NPo2tjxOmbUptWE3fDyIKyHQIVM89Z56t/UGxv pZvEocZX8TLZXDSWicgXJyi5+2lzzbRKffCZvhQY/BT7lHgXX7C+/1mW2OPmggnbnFvk jnKEAdoU0AZ+zlbarvRv79HNzXTif3sEej3hrpOo+gGJcOw1rDcMZ29FPHEu/QWF5x2p j6xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j46GH7ec; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10-v6si654581plt.4.2018.09.12.03.54.31; Wed, 12 Sep 2018 03:54:46 -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; dkim=pass header.i=@linaro.org header.s=google header.b=j46GH7ec; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727987AbeILP6M (ORCPT + 99 others); Wed, 12 Sep 2018 11:58:12 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38495 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727662AbeILP6L (ORCPT ); Wed, 12 Sep 2018 11:58:11 -0400 Received: by mail-wr1-f67.google.com with SMTP id w11-v6so1530741wrc.5 for ; Wed, 12 Sep 2018 03:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=dCZ8O9DZ1ONH2hb7eQPstXDLIl/KhTzzbGzZiXh+87s=; b=j46GH7ecs5ROEDwzGUsGS1cSaVX4COOycu8YO0aRLZHwF/BXQnga++VqyZ1D4EpiXl L+vicJXnY91YMVN8ZzhsMa/2XEMBqhLf/hNs0WtodJWw8oaO4sVtwm12fF+Qi5x0rniy 0tsLY6rAfzYwX7Aio0BPOslyozczT2rmhLO5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=dCZ8O9DZ1ONH2hb7eQPstXDLIl/KhTzzbGzZiXh+87s=; b=OoRW2CeNtpFXiFhqzPXIyhARjKV2WYBGE+Tw1siuIfbZGZXFXlf2/lrEC7nOjduofq QCEgjwBsEBRABKdwNiPw3k7tkHyjITfmGbu/UoiAdMnW3s2Cr1Efa7LC53zRl7gvqzUQ VftvFRV2+jw77R9OX0OmVvnkehzKyvIa3y/kyBfo0zcKpvAPLJ6cU9+ZgXXiFOhMiKcK fzKoLZhIWvu0cCgrW5tdgxr+ddf4QGV5BRKQxeTDABLQyvL/PfNBeXLKi5ytUsHoAQTL WI8kZ5r+KdmW3VFhcaNFKJXqBEeaZnTXT5/War+e1/+sBYtcyQForameZenrW/VhGWF0 0bRg== X-Gm-Message-State: APzg51D+RErcpA7ORCEcuXtTTHgS4l7NdkejbW8veTpRcxZu/+psnble BJchMTftbcxGuaGWxgZ0OcuOcA== X-Received: by 2002:adf:d1c1:: with SMTP id m1-v6mr1147526wri.138.1536749649900; Wed, 12 Sep 2018 03:54:09 -0700 (PDT) Received: from dell ([2.27.167.7]) by smtp.gmail.com with ESMTPSA id w10-v6sm1110095wrp.31.2018.09.12.03.54.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Sep 2018 03:54:08 -0700 (PDT) Date: Wed, 12 Sep 2018 11:54:07 +0100 From: Lee Jones To: Geert Uytterhoeven Cc: Alexandre Belloni , 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: <20180912105407.GR4185@dell> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). 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 -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog