Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751751AbcDRF4B (ORCPT ); Mon, 18 Apr 2016 01:56:01 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:37940 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751036AbcDRFz7 convert rfc822-to-8bit (ORCPT ); Mon, 18 Apr 2016 01:55:59 -0400 From: "Reizer, Eyal" To: Arnd Bergmann CC: Kalle Valo , Eyal Reizer , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-spi@vger.kernel.org" Subject: RE: [PATCHv2] wlcore: spi: add wl18xx support Thread-Topic: [PATCHv2] wlcore: spi: add wl18xx support Thread-Index: AQHRkvs3tFwJpRa2nU+to3p0n+8ju5+C0KzggAvWT4CAAJzFUA== Date: Mon, 18 Apr 2016 05:55:51 +0000 Message-ID: <8665E2433BC68541A24DFFCA87B70F5B360BF614@DFRE01.ent.ti.com> References: <1460273570-12298-1-git-send-email-eyalr@ti.com> <8665E2433BC68541A24DFFCA87B70F5B360B6C90@DFRE01.ent.ti.com> <14313437.cDJIgY3kzo@wuerfel> In-Reply-To: <14313437.cDJIgY3kzo@wuerfel> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.167.188.42] x-exclaimer-md-config: f9c360f5-3d1e-4c3c-8703-f45bf52eff6b Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1637 Lines: 44 > > > > - all wilink family needs special init command for entering wspi mode. > > extra clock cycles should be sent after the spi init command while the > > cs pin is high. > > - switch to controling the cs pin from the spi driver for achieveing the > > above. > > - the selected cs gpio is read from the spi device-tree node using the > > cs-gpios field and setup as a gpio. > > - See the example below for specifying the cs gpio using the cs-gpios entry > > &spi0 { > > ... > > cs-gpios = <&gpio0 5 0>; > > ... > > wlcore: wlcore@0 { > > compatible = "ti,wl1835"; > > ... > > ... > > }; > > }; > > > > Signed-off-by: Eyal Reizer > > I don't think this can work in general: not all SPI hosts uses GPIOs for > controlling CS, so the logic can't work, and it's also a layering violation for the > driver to look at the parent. > > I would suggest fixing this using a new API function from the SPI core, if we > don't already have a generic way to do it. > Originally this is what I have done until I was pointed to the generic cs-gpio mechanism in the SPI core. It is a generic mechanism already in the SPI core driver. See: Documentation/devicetree/bindings/spi/spi-bus.txt It is also part of the generic spi.h (include/Linux/spi/spi.h), already part of " struct spi_device" So it seemed redundant adding another mechanism for implementing the same. Platform that interact with a wilink need to use it, and platforms that don't have this capability will probably not interact with a wilink device using SPI. Best Regards, Eyal