Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4374227pxu; Wed, 9 Dec 2020 15:49:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKpEFEcFUmiq5O7X32O5ue30PTHgTZYsHS7ccZt+V2N2x+EVVqXA+S3T0/u21OVG7VXvww X-Received: by 2002:a17:906:7784:: with SMTP id s4mr4157249ejm.93.1607557773712; Wed, 09 Dec 2020 15:49:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607557773; cv=none; d=google.com; s=arc-20160816; b=UfhwbMPmQei2HkZlfl4i5JmcNzLGiEaXGVGw28R4FUeDJf8fOSVGSxphOE14v/NNEx gzvVxnnoRMvs4WV/f06FMZG0fvgOIHdX05ye1KlutDHS4iw6P32bgoTGpBdZbc1UVM3L 24AgBo2X5T0277MaG574lMIb1hAS13SpmqphHWtZ4W6gH7n6my6tLjs4RpHVuWaM2aeO e8QF2TQ2vI8bLFePTiDZfQWk6igRETbMLpAqNZcbyx93JX9jLpZoB1bgsxt/uRswR/UD yCtgtg7ECAzeIctYS/NAvVkj2nlbYUiEeEmYVunR2bD9vt+T/BhHOsa5MT8UAgaBjcmP FiXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=iULt0ckHC+tcPnX3IhnTcguQGtZCPAjug6MWoIFyoaM=; b=Nrt/BJCHayNdVCyixF7SzyrlavJgNSegY0WFp5Tch7qGmUnpTy4uH9xKtEPSlXGUy5 bzkkl1OdnT/Av3O2M3lXiYaykBLgLNDUo5xiz6qJYPR66l4oLZ5+6Iu405hRLDmVxMHz WNkQ9QX/Djvo9oh14+LAChNrwjTOCkV/GcrzDr+BbOOeo4E4JPutPXkb1GTeN6yX6Mq6 4HIrcYZq/TFSCZb1ByI9SbWU/XogCEAJN4o0FPnyA08zvFPZCpY5fcFKnuIBx9I9BR1M mvVq/sRanxnKGq6/okJ0DCzbjhUirOeuWaxJgAFfKcJGKP7wb9nK/QJDE7XUL/Q5pSTL N2yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ministro.hu header.s=201804 header.b=eS78eQ3D; dkim=pass header.i=@ministro.hu header.s=201804 header.b=TI7dIPr1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n3si1650098edr.560.2020.12.09.15.49.11; Wed, 09 Dec 2020 15:49:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ministro.hu header.s=201804 header.b=eS78eQ3D; dkim=pass header.i=@ministro.hu header.s=201804 header.b=TI7dIPr1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387811AbgLITnm (ORCPT + 99 others); Wed, 9 Dec 2020 14:43:42 -0500 Received: from bmail1.ministro.hu ([5.249.150.236]:58490 "EHLO bmail1.ministro.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387915AbgLITnU (ORCPT ); Wed, 9 Dec 2020 14:43:20 -0500 Received: from localhost (localhost [127.0.0.1]) by bmail1.ministro.hu (Postfix) with ESMTP id 602D9123AF7; Wed, 9 Dec 2020 20:42:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ministro.hu; s=201804; t=1607542952; bh=umw3i716AA1RfHzauEg2V1/ls+eH/tEOpZLRHpRHjPc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eS78eQ3DXkYH0q0NAys4gAO5vp69q47sEYEpVbzjNxOBt2plp33STKVK/Z38B+Zw+ Z616OzHihqsdtQzVQw36ljmW9SFq1E5PGcsb30vqG5AlAEVRT/vW7bG4YATDcQvHse pnqI/IFWBk1oJjebLiQ1yprxaZC5zTrG6Kn0TBRANVFHCAYJD9zfV46Ldun6I32EM3 2cUadQWC+6aCEk19lqGspoBMDYE4WIRcWocm0MGwwOmg5R13a6XvQ6C6qXUJ+65Crx cU0GJpOG+STMg95jCQycxkMe+aJ3kMTtCCYDB3Vy7JEucUdCglwhiukeYXhCHNAAK1 HXpW+7ZymB7Mg== X-Virus-Scanned: Debian amavisd-new at ministro.hu Received: from bmail1.ministro.hu ([127.0.0.1]) by localhost (bmail1.ministro.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O-f_cmxzkNFt; Wed, 9 Dec 2020 20:41:55 +0100 (CET) Received: from dincontrollerdev (localhost [127.0.0.1]) by bmail1.ministro.hu (Postfix) with ESMTPSA id 05045123AF4; Wed, 9 Dec 2020 20:41:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ministro.hu; s=201804; t=1607542915; bh=umw3i716AA1RfHzauEg2V1/ls+eH/tEOpZLRHpRHjPc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TI7dIPr1jW2tZZkIrJPTo2HVn9JTxIyV/vwyd58YZ1C1Meq52o/v4sqRYYggwE4Xe 9MaDR006ePPjZzd/RGDvka9lNKL9TdwUaZJpX8I3Kn3PKHl0pCo4IiwOQZVzV/lrG0 J1SLvMQf4vQp4rIk3xHEWbI9u/TkGprubqytqlDPoB1rfiT8N6uaOAzvjQDPPkzdnI wwbEwECAFICaFKGM30uFBL1q0GNOHbV8Y3//7qFjcFDzi0NNSUk0/b/Q1ORYJwsmg/ uTmMxLTlwf2whDdX/qoy1Vj8BwWjmX87px2sQW9BeTa8Agt+exVvCMqAovyHA2RL1V /BGZuJA6VW0ig== Date: Wed, 9 Dec 2020 19:41:53 +0000 From: =?iso-8859-1?Q?J=F3zsef_Horv=E1th?= To: =?iso-8859-1?B?Suly9G1l?= Pouiller Cc: 'Rob Herring' , 'Greg Kroah-Hartman' , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, driverdev-devel@linuxdriverproject.org Subject: Re: [PATCH] Staging: silabs si4455 serial driver Message-ID: <20201209194153.GC30918@dincontrollerdev> References: <2907305.Mh6RI2rZIc@pc-42> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2907305.Mh6RI2rZIc@pc-42> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello J?r?me, On Wed, Dec 09, 2020 at 06:38:08PM +0100, J?r?me Pouiller wrote: > On Wednesday 9 December 2020 12:09:58 CET Info wrote: > > > > This is a serial port driver for > > Silicon Labs Si4455 Sub-GHz transciver. > > Hello J?zsef, > > Thank you for taking care of support of Silabs products :) I think great products :) and great support :) > > > > Signed-off-by: J?zsef Horv?th > > I think you have to use your personal address to sign-off. I'm a self-employed, currently this is my "personal" e-mail address. > > > --- > > .../bindings/staging/serial/silabs,si4455.txt | 39 + > > drivers/staging/Kconfig | 2 + > > drivers/staging/Makefile | 1 + > > drivers/staging/si4455/Kconfig | 8 + > > drivers/staging/si4455/Makefile | 2 + > > drivers/staging/si4455/TODO | 3 + > > drivers/staging/si4455/si4455.c | 1465 +++++++++++++++++ > > drivers/staging/si4455/si4455_api.h | 56 + > > 8 files changed, 1576 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/staging/serial/silabs,si4455.txt > > create mode 100644 drivers/staging/si4455/Kconfig > > create mode 100644 drivers/staging/si4455/Makefile > > create mode 100644 drivers/staging/si4455/TODO > > create mode 100644 drivers/staging/si4455/si4455.c > > create mode 100644 drivers/staging/si4455/si4455_api.h > > Since you add a new directory, you should also update MAINTAINERS file > (checkpatch didn't warn you about that?). > > > > diff --git > > a/Documentation/devicetree/bindings/staging/serial/silabs,si4455.txt > > b/Documentation/devicetree/bindings/staging/serial/silabs,si4455.txt > > new file mode 100644 > > index 000000000000..abd659b7b952 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/staging/serial/silabs,si4455.txt > > @@ -0,0 +1,39 @@ > > +* Silicon Labs Si4455 EASY-TO-USE, LOW-CURRENT OOK/(G)FSK SUB-GHZ > > TRANSCEIVER > > AFAIK, Si4455 is a programmable product. So I think that this driver only > work if the Si4455 use a specific firmware, isn't? In this case, you > should mention it in the documentation. Si4455 is programmed by silabs. In case of C2A, it is possible to load patch. My solution is to loading EZConfig(generated by WDS) and firmware patch with ioctl calls. You can see the definitions in si4455_api.h. A short example for EZConfig loading(patch loading will be exacly the same if Si4455 is rev C2A): ... #include "si4455_api.h" ... #include "radio.h" //< Generated by WDS3 #include "radio_config_Si4455.h" //< Generated by WDS3 ... struct si4455_iocbuff iocbuff = { 0 }; iocbuff.length = sizeof(Radio_Configuration_Data_Array); memcpy(iocbuff.data, Radio_Configuration_Data_Array, iocbuff.length); ret = ioctl(portFd, SI4455_IOC_SEZC, &iocbuff); ... After SI4455_IOC_SEZC or SI4455_IOC_SEZP ioctl calls, the driver resets the Si4455, and apply the configuration/patch. > > > > + > > +Required properties: > > +- compatible: Should be one of the following: > > + - "silabs,si4455" for Silicon Labs Si4455-B1A or Si4455-C2A (driver > > automatically detects the part info), > > + - "silabs,si4455b1a" for Silicon Labs Si4455-B1A, > > + - "silabs,si4455c2a" for Silicon Labs Si4455-C2A, > > +- reg: SPI chip select number. > > +- interrupts: Specifies the interrupt source of the parent interrupt > > + controller. The format of the interrupt specifier depends on the > > + parent interrupt controller. > > +- clocks: phandle to the IC source clock (only external clock source > > supported). > > +- spi-max-frequency: maximum clock frequency on SPI port > > +- shdn-gpios: gpio pin for SDN > > + > > +Example: > > + > > +/ { > > + clocks { > > + si4455_1_2_osc: si4455_1_2_osc { > > + compatible = "fixed-clock"; > > + #clock-cells = <0>; > > + clock-frequency = <30000000>; > > + }; > > + }; > > +}; > > + > > +&spi0 { > > + si4455: si4455@0 { > > + compatible = "silabs,si4455"; > > + reg = <0>; > > + clocks = <&si4455_1_2_osc>; > > It seems that the driver does not use this clock. So, is the clock > attribute mandatory? What is the purpose of declaring a fixed-clock > for this device? > Yes you are right, but the uart subsystem maybe. I'll check it again, and if does not, I'll remove these definitions. > > + interrupt-parent = <&gpio>; > > + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; > > + shdn-gpios = <&gpio 26 1>; > > + status = "okay"; > > + spi-max-frequency = <3000000>; > > + }; > > +}; > > [...] > > > > diff --git a/drivers/staging/si4455/Kconfig b/drivers/staging/si4455/Kconfig > > new file mode 100644 > > index 000000000000..666f726f2583 > > --- /dev/null > > +++ b/drivers/staging/si4455/Kconfig > > @@ -0,0 +1,8 @@ > > +# SPDX-License-Identifier: GPL-2.0 > > +config SERIAL_SI4455 > > + tristate "Si4455 support" > > + depends on SPI > > + select SERIAL_CORE > > + help > > + This driver is for Silicon Labs's Si4455 Sub-GHz transciver. > > + Say 'Y' here if you wish to use it as serial port. > > So, in fact, Si4455 is not a UART. I don't know how this kind of device > should be presented to the userspace. Have you check if similar devices > already exists in the kernel? I know Si4455 is not a regular UART, but in my mind it is a half-duplex serial transport channel, like UART with RS-485. This is the reason why I designed it among serial drivers. The special funcions like tx/rx channel, package size are controlled with ioctl calls. > > I suggest to add linux-wpan@vger.kernel.org to the recipients of your > patch. > > > [...] > > +static int si4455_get_part_info(struct uart_port *port, > > + struct si4455_part_info *result) > > +{ > > + int ret; > > + u8 dataOut[] = { SI4455_CMD_ID_PART_INFO }; > > + u8 dataIn[SI4455_CMD_REPLY_COUNT_PART_INFO]; > > + > > + ret = si4455_send_command_get_response(port, > > + sizeof(dataOut), > > + dataOut, > > + sizeof(dataIn), > > + dataIn); > > Why not: > I changed all like this in my code already. I test it, and I'll send it again. Ps.: For my eyes is better to read line or list, reading table is harder :) line(arg1, arg2, arg3, arg4); list(arg1, arg2, arg3, arg4); table(arg1, arg2, arg3, arg4); > ret = si4455_send_command_get_response(port, > sizeof(*result), result, > sizeof(dataIn), dataIn); > > > + if (ret == 0) { > > + result->CHIPREV = dataIn[0]; > > + memcpy(&result->PART, &dataIn[1],sizeof(result->PART)); > > + result->PBUILD = dataIn[3]; > > + memcpy(&result->ID, &dataIn[4], sizeof(result->ID)); > > + result->CUSTOMER = dataIn[6]; > > + result->ROMID = dataIn[7]; > > + result->BOND = dataIn[8]; > > ... it would avoid all these lines. > > > + } else { > > + dev_err(port->dev, > > + "%s: si4455_send_command_get_response error(%i)", > > + __func__, > > + ret); > > + } > > + return ret; > > +} > > [...] > > -- > J?r?me Pouiller > > ?dv?zlettel / Best regards: J?zsef Horv?th