Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1286841imm; Tue, 3 Jul 2018 08:34:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL2W6saz8OtOjexeS9mNwhPdMd82n4xoEF9VfQ2+8ZgQr+wkp02UkAcpXog59dm8V/xhL6i X-Received: by 2002:a17:902:8d96:: with SMTP id v22-v6mr30272230plo.176.1530632041565; Tue, 03 Jul 2018 08:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530632041; cv=none; d=google.com; s=arc-20160816; b=kjPBC2+46+UmY4KuYeC1yAx/tmsyAC6W/c57n3ord7lQ36zZeMy9nK9enwAINuosa8 OGMGQCkAvfudE2aS/DtVrSpLUtcyjbBnBk+N+Lm+IZbNHmhYvlWilunsWP5+M48X60io FJIJHx0nFh9Qk9ZvaIQGJIih1F/HWIZMvI3A/iFUWicOioD4BsxavaU3YgStTR3xc6GT 1rqC3Sw4SiVhUFBVHrI50tmFqVSoI2sDbCSTt+AVY626yfJMgOE+P/BwTOarsytdbz3+ Jj8IQ+5arDGuKEIibnX1r7HoJoP0OujEPB3Z+DXFtfhgoFdGfNowln9v8PU1ad9pVlRt MPKA== 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:dkim-signature:arc-authentication-results; bh=FSRXtc547TiJ/Ek+9nzTt7NxLBNfnZIoF5dyOdV3v8g=; b=znhvVxQV2M8mlvdko53d5zoEgwoiOKgOD2Ie3yY+mikIVzVhKFwYx5W5Kra7oE4KIy viG0LDFHuayPGkhSD8lQd1UUm1Pi+gOdUJ7DiozQmdm95p2vWcBB9AMaG9nz8EqPjzXf 6eegsF09yMCbC4ZrjiQabycnLAR947RNGsxLWA1NClLZEbnsP8Jb25QJBXscG/pXIvjB AUOHliT9rmZ37QFhn36dsnNf/pckyI0Pu4v+GBUoT7LWfmnXKJItjyyZfa3aai/T4CQh IjMvvN/jPlOIps7DxZdtL8qQ5zvhv881X8kyC2qZFrKp2aWey8pV9nXJMI0Rwl21BzVy Oedg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=YBPBuHz7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w21-v6si1304789plp.199.2018.07.03.08.33.46; Tue, 03 Jul 2018 08:34:01 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=YBPBuHz7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933569AbeGCPcO (ORCPT + 99 others); Tue, 3 Jul 2018 11:32:14 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:34200 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932440AbeGCPcM (ORCPT ); Tue, 3 Jul 2018 11:32:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FSRXtc547TiJ/Ek+9nzTt7NxLBNfnZIoF5dyOdV3v8g=; b=YBPBuHz7petmBvGo5XEFYNUrR YzJ8ThlIv9T6Q8MhPa4BHBsL0gyoerUip6FjFX4/UIKirnZeU7ljFWNk57c10JxDjNrxnIPv45y+v xOI9Nv9h1n5x53mhvLMSspy6ATTkGYxf2iWJuETbSsuIMxhnXDE7bF12du8T/Oj3dMkTw=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1faNHG-00069P-S0; Tue, 03 Jul 2018 15:31:39 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1faNHF-0003Ui-Qr; Tue, 03 Jul 2018 16:31:37 +0100 Date: Tue, 3 Jul 2018 16:31:37 +0100 From: Mark Brown To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jian-Hong Pan , Jiri Pirko , Marcel Holtmann , "David S . Miller" , Matthias Brugger , Janus Piwek , Michael =?iso-8859-1?Q?R=F6der?= , Dollar Chen , Ken Yu , Ben Whitten , Steve deRosier , linux-spi@vger.kernel.org, LoRa_Community_Support@semtech.com Subject: Re: [RFC net-next 15/15] net: lora: Add Semtech SX1301 Message-ID: <20180703153137.GB13744@sirena.org.uk> References: <20180701110804.32415-1-afaerber@suse.de> <20180701110804.32415-16-afaerber@suse.de> <20180702161258.GA18744@sirena.org.uk> <4e06cc72-2092-70f3-c801-bf6e4c3cbec2@suse.de> <20180703145022.GA13744@sirena.org.uk> <809fc546-6012-37f3-9485-cfd8eaf99488@suse.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="24zk1gE8NUlDmwG9" Content-Disposition: inline In-Reply-To: <809fc546-6012-37f3-9485-cfd8eaf99488@suse.de> X-Cookie: Dental health is next to mental health. User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --24zk1gE8NUlDmwG9 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 03, 2018 at 05:09:38PM +0200, Andreas F=E4rber wrote: > Am 03.07.2018 um 16:50 schrieb Mark Brown: > >> 2) This SPI device is in turn exposing the two SPI masters that you > >> already found below, and I didn't see a sane way to split that code out > >> into drivers/spi/, so it's in drivers/net/lora/ here - has there been > >> any precedence either way? > > A MFD? > I know of mfd, but how would the the the net vs. spi pieces interact > then? Some functions would need to be exported then or is there an > easier way without needing to set a cross-module API in stone? It's an in-kernel ABI it's not exactly set in stone but yeah, you'll need some interface. A lot of devices work by having the children know that they're part of a MFD and fish things out of the parent device, either the pdata or (in the common case where the MFD bit mostly just instantiates subdevices and holds a regmap) with dev_get_regmap(). > > A register map would work just as well here, we already have plenty of > > devices that abstract at this level (most obviously the I2C/SPI devices > > that use it to offer both interfaces with a single core driver). > The address and data registers together form a two-byte SPI message! > It is transmitted by writing to the CS register. > The received data is afterwards available in another register. Right, but it seems from the code that the hardware understands that it's formatting register I/O and not just shifting in and out a byte stream which is what a SPI controller does. I'd not be surprised to learn that the register you're calling a chip select register is a strobe that initiates the transfer (and that this may be some of the difficulty you're having with handling it in the way the framework expects), the pattern with writing 1 followed immediately by 0 is a bit of a flag here. I've seen such before hardware where I know it was intentionally designed that way so it wouldn't be totally surprising. --24zk1gE8NUlDmwG9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAls7ltkACgkQJNaLcl1U h9A+lwf+M8MTt6KWaR4J9ViDILdK0W8JxGgJ2Glb/wXPZ7TDowwt6N0oQs8Cg8cZ ch1D/dW0vBuW/NmvFtarbcfqAEJCIlL9oFovgMTao6RLZTc1L2unzKifbtTzUhHo bqUXZA5ubjQuwESRbbd5C9PM2HSMfXKn2BrvvLYz9FyYMRlGVJf9oom8vGzYBo/t DbMe/c4o+Tw7golyzKKraTTV61DAtXeaT0wgYLKR5iB/sPtViqn9LombTM7tyQxi Oi3SLV/Q838Bpk+fwQEXfRzSVO073z9+46kpG4lg11xzf9WT9lOq6e2qrtOgsCVy FEW068wwEBTdALjHWYCx3DUkN4prIQ== =Dyei -----END PGP SIGNATURE----- --24zk1gE8NUlDmwG9--