From patchwork Mon Jun 25 13:57:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 10486225 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A6ED4601D5 for ; Mon, 25 Jun 2018 13:57:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E4FC283E8 for ; Mon, 25 Jun 2018 13:57:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92EB72843C; Mon, 25 Jun 2018 13:57:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEA5B283E8 for ; Mon, 25 Jun 2018 13:57:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933755AbeFYN55 (ORCPT ); Mon, 25 Jun 2018 09:57:57 -0400 Received: from mail-sn1nam02on0048.outbound.protection.outlook.com ([104.47.36.48]:12358 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933144AbeFYN54 (ORCPT ); Mon, 25 Jun 2018 09:57:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MR0BT9jhyX8h2vMrnWPcLDh3J0+e022SPjWEMZRx/o4=; b=GWnWeY09laW9H4FOXOgGCFlHZYwpBveh+40BZb13qtLxslvH0cB3AY2rdWf/zgeZNB+djqMslVgmhfdYdusG0aymWIOhp8KTXNlD51YLH+TQaYQDZJBLFONHaL5ERfQmOjdttmRveJ62z+bxTLRdxpdjSwgo5QnEmnJ2pTOZPUM= Received: from CY4PR03CA0017.namprd03.prod.outlook.com (2603:10b6:903:33::27) by CY1PR0301MB1227.namprd03.prod.outlook.com (2a01:111:e400:4c5a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.23; Mon, 25 Jun 2018 13:57:53 +0000 Received: from BN1AFFO11FD010.protection.gbl (2a01:111:f400:7c10::106) by CY4PR03CA0017.outlook.office365.com (2603:10b6:903:33::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.884.21 via Frontend Transport; Mon, 25 Jun 2018 13:57:53 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.57) smtp.mailfrom=analog.com; osg.samsung.com; dkim=none (message not signed) header.d=none;osg.samsung.com; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta4.analog.com; Received: from nwd2mta4.analog.com (137.71.25.57) by BN1AFFO11FD010.mail.protection.outlook.com (10.58.52.70) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.820.5 via Frontend Transport; Mon, 25 Jun 2018 13:57:52 +0000 Received: from NWD2HUBCAS9.ad.analog.com (nwd2hubcas9.ad.analog.com [10.64.69.109]) by nwd2mta4.analog.com (8.13.8/8.13.8) with ESMTP id w5PDvpvu032079 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK); Mon, 25 Jun 2018 06:57:51 -0700 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS9.ad.analog.com (10.64.69.109) with Microsoft SMTP Server id 14.3.210.2; Mon, 25 Jun 2018 09:57:51 -0400 Received: from saturn.analog.com ([10.50.1.244]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id w5PDviBL005351; Mon, 25 Jun 2018 09:57:44 -0400 From: Alexandru Ardelean To: , , CC: Michael Hennerich , Alexandru Ardelean Subject: [PATCH V2] net: ieee802154: adf7242: Fix OCL calibration runs Date: Mon, 25 Jun 2018 16:57:37 +0300 Message-ID: <20180625135737.18238-1-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(39380400002)(39860400002)(2980300002)(438002)(199004)(189003)(1076002)(7636002)(356003)(50226002)(51416003)(7696005)(48376002)(5660300001)(47776003)(50466002)(426003)(59450400001)(6666003)(478600001)(486006)(8936002)(77096007)(2201001)(2906002)(305945005)(476003)(126002)(8676002)(4326008)(26005)(86362001)(44832011)(186003)(246002)(336012)(54906003)(107886003)(110136005)(16586007)(53416004)(316002)(36756003)(106466001)(2616005)(106002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1227; H:nwd2mta4.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD010; 1:H5MrMcHhuqdWAVLcfEPdh62bRXMhft2OP7kKpZKHjHrBNiujgVX+uXiuEIfTC0eoNUY4DZJ31i14F3OWoG9x1SjRRA039DsEqZRFMjGOclM/7F9KS2w9/HlRMQGbwUem X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b4efa4a-3cc8-4051-22e2-08d5daa3a4d8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(4608076)(2017052603328)(7153060); SRVR:CY1PR0301MB1227; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1227; 3:1S92IdrayB/Kq3WFt//wg/slz/jG4lkK0SdVZxgGgvx1k7E7/CVNPs4MH1SAInQm7Kf1OWX1zlDPEtvisluhTL8VEVjpzR+2hSDqloNXExQd2cuiYdBc/PqLx82G5ZVZbNwlC6KMsu9NEaxz/0d5U7KIEAruDtQRFXajM3ujI8bSla7y5trFW7satMV2Vz5grDdCKbvPTCAHbuDBVw8FTdVRVJssX+9CbqMQemNIqluqg/bGW5V6X7vF4SYGxIqhYAxe6aKn0ko+XqyuROnnowrhOgeE+zc9ptPmSBXAASmkaSNwp+hqCZgLRn8pOWIfjvnxSdwFpzJYhPESsgyIDF1+Uh3dlZ0xteqVdKNg77Y=; 25:JRbeIjYUiq+yUhQRQ+7dJnIa6aM+hQbUEd9339aLAYAfL2xZIqOzdV1EjVv1aXZtEzEfmwP9pMfiTYOdJOaSnj1cLpeokktwT77cc7IsFv6naUbxTXj9qUFklk5MCuLhWh1tX+wp5eJqsJS92O4u5YhWFDX6NaLE2lYxOkt0kA/+eE4VDxLoAMZERXCG6J9i97hszaWstZcEwBuXdd5YKRjKf9L7xua7G/0ECfcNgP3tR7q9T28zy67omOqd24P9f6ZP6H48p7eTbE4uV/tu3mXYAWx/n2a09qJLFsB/cX1jBboCwvZcGo+NKjt30Co7MssAr1HYZd9qss1Eag/GyQ== X-MS-TrafficTypeDiagnostic: CY1PR0301MB1227: X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1227; 31:PzS4Oz9vUXKCX2cXSm5kJtq6YDbMOiPRItaRC0gwS2nWtY6FqHUhwrsWOFnkXFPROGf2P2r76qQ2o/r5Om2nSNoDCY51Ybg8TQy9GU+Gdy07aOtTfLsR0nYLP5t4rDlAHCwO26w3Q7h25KPOoXsgWDi5cLEOtkEK/962C6bxlmomGxEi3ywdlth0DCvTDht+Smj8EUO49fXB4DvK9rsaRjBt+AMYL9yW42WbY1cvU5s=; 20:E9hFlRdji9xHvqTpfJqKlMi82JZyhYpbXZbL7Bi5SBJNhiR/xi4DB66s8jTFpOW1J2d8iK9ZLqzCsSE6O+ZNbAOq4gYZRlZfwUoyBFPSqAsIkqgfgcH0XQEJUGrSs3cx+kNTTVZa4VwaP5cogsAxF/GiVTTupmBaoiNq9jg1+XoQgtUsU92ZyI/EoFiVqgKfmV1t3Bg5IW/GCCcgMMxRl8/evsn+N/gldaL1OU0dDNXADkzXHfkmO+bWpWR9yVcqKoIlUv4IJj+F8Vr8oLaRslJ2iGAC3QyHRmVuF5u/EkW6+XRbuw0lMhcOueLNyfRTpTzWfo/c5caNL9/hVYIW3/caOoC23L6a+KFrLXvL7pfKdTanw5lLSUUFAhaY9kZqFumIckS+KYqEgtlm+XmhuJgR/2RtvpnsvyFL2mjSLRRNgYXxHrKdsbtjinHhb+pIf+HiT2Gk5jKUngFmCyosbA5hHyNdN9u4bZYi3wXTUzKJpXFHQNExE75d28n33G/J X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(232431446821674)(277106579953875); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93004095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:CY1PR0301MB1227; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1227; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1227; 4:csD08u9Ga7tQUvIIkTYIfW8agRiV4dCo6tm6DybilOEgwjybDWYHvaxLYzS2tuh8Ypl8catYXO5eTNxNG7SvKdyTvA59c1FaCO7VKSS4cJ7Xp/6wlLEbcX6qudKM9vqmBvTA7lJT6sUYYwkvqBX72iP2Rfmz0L5lw8D4Sd2XEzrUJDq2QKNJNyowblyo9JmRjDVCURe4yIu4PBR1n0sZ0NCp7DejkP1wipn8V55w67r3WYzT5IOanh4THuFG3b4PaEaV5hvx9piR++d/v2Z9xIUyFp8LizfbSRDbciqVkCj0VKJsLbr/X2zaD03F1sNUaTdsc+imfpmgRc2LJU8sNv/WN+QudKYcKve+LjCOCV0= X-Forefront-PRVS: 0714841678 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1227; 23:qxC8zWhIP0bMNFxPyhMDOEDBXlzlbxabcXcehL/?= =?us-ascii?Q?hhQebkdt31Zk751/qxeDM5SIM1fdW5VG3N7Zsamw+z373PEyNY7BIrkbptYJ?= =?us-ascii?Q?7N4FriipiHopWor9kJ2878lQrmFP0u4G8DuqmTzkA/0zHApCDxqpkVkDvI5Y?= =?us-ascii?Q?bWAMQVjUyHtjOsh3ky/d6DNKas8i5qrGGpvzXbRj/UKcQM118we01VYL04cJ?= =?us-ascii?Q?CUIBPsuGKgrAwOHmOlYBcQ94CKHGcvb/FAxBjcdaqWePx+IVSH3sv0bunKh5?= =?us-ascii?Q?m1CVDM5XSL3QGY5tg66ynsVi15Zu040E+K9GVmiHNvSRUK4FSi2YstV6cc+y?= =?us-ascii?Q?bB1A5jVmyWlhVy+eQNS/o7rdpm70kehc5nuLzXRdq/Su1yrmkS2eSZIjryeH?= =?us-ascii?Q?M1vEa4c3e5B5xaotquAxffUQjDavGITxaEZ3i6EigUMUiOJDo2O/M1G1ExKz?= =?us-ascii?Q?U+mPyXH70KocdQyQsOyvW+rZ/g7neKa2+A1VoaFyFkb04SFyPPhk0Re4X12N?= =?us-ascii?Q?TPRQcWdWEy57mY46VBHy56fSZaPUpSRUKEE6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YtPEPQqMUIvgaXAu1h+0MFVgXQiGYuSs0SEzGEyscY4fMNYQ3A1rTBhbjy X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2018 13:57:52.1697 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b4efa4a-3cc8-4051-22e2-08d5daa3a4d8 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta4.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1227 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michael Hennerich Reissuing RC_RX every 400ms - to adjust for offset drift in receiver see datasheet page 61, OCL section. Signed-off-by: Michael Hennerich Signed-off-by: Alexandru Ardelean --- v1 -> v2: * fixed checkpatch.pl reported issues * 1 line too long: `lp->wqueue = alloc_ordered_workqueue(dev_name(&s` * 1 comment was adjusted: `/* Reissuing RC_RX every 400ms - ` drivers/net/ieee802154/adf7242.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c index 64f1b1e77bc0..4e87dd041c02 100644 --- a/drivers/net/ieee802154/adf7242.c +++ b/drivers/net/ieee802154/adf7242.c @@ -275,6 +275,8 @@ struct adf7242_local { struct spi_message stat_msg; struct spi_transfer stat_xfer; struct dentry *debugfs_root; + struct delayed_work work; + struct workqueue_struct *wqueue; unsigned long flags; int tx_stat; bool promiscuous; @@ -575,10 +577,26 @@ static int adf7242_cmd_rx(struct adf7242_local *lp) /* Wait until the ACK is sent */ adf7242_wait_status(lp, RC_STATUS_PHY_RDY, RC_STATUS_MASK, __LINE__); adf7242_clear_irqstat(lp); + mod_delayed_work(lp->wqueue, &lp->work, msecs_to_jiffies(400)); return adf7242_cmd(lp, CMD_RC_RX); } +static void adf7242_rx_cal_work(struct work_struct *work) +{ + struct adf7242_local *lp = + container_of(work, struct adf7242_local, work.work); + + /* Reissuing RC_RX every 400ms - to adjust for offset + * drift in receiver (datasheet page 61, OCL section) + */ + + if (!test_bit(FLAG_XMIT, &lp->flags)) { + adf7242_cmd(lp, CMD_RC_PHY_RDY); + adf7242_cmd_rx(lp); + } +} + static int adf7242_set_txpower(struct ieee802154_hw *hw, int mbm) { struct adf7242_local *lp = hw->priv; @@ -686,7 +704,7 @@ static int adf7242_start(struct ieee802154_hw *hw) enable_irq(lp->spi->irq); set_bit(FLAG_START, &lp->flags); - return adf7242_cmd(lp, CMD_RC_RX); + return adf7242_cmd_rx(lp); } static void adf7242_stop(struct ieee802154_hw *hw) @@ -694,6 +712,7 @@ static void adf7242_stop(struct ieee802154_hw *hw) struct adf7242_local *lp = hw->priv; disable_irq(lp->spi->irq); + cancel_delayed_work_sync(&lp->work); adf7242_cmd(lp, CMD_RC_IDLE); clear_bit(FLAG_START, &lp->flags); adf7242_clear_irqstat(lp); @@ -814,6 +833,7 @@ static int adf7242_xmit(struct ieee802154_hw *hw, struct sk_buff *skb) /* ensure existing instances of the IRQ handler have completed */ disable_irq(lp->spi->irq); set_bit(FLAG_XMIT, &lp->flags); + cancel_delayed_work_sync(&lp->work); reinit_completion(&lp->tx_complete); adf7242_cmd(lp, CMD_RC_PHY_RDY); adf7242_clear_irqstat(lp); @@ -952,6 +972,7 @@ static irqreturn_t adf7242_isr(int irq, void *data) unsigned int xmit; u8 irq1; + mod_delayed_work(lp->wqueue, &lp->work, msecs_to_jiffies(400)); adf7242_read_reg(lp, REG_IRQ1_SRC1, &irq1); if (!(irq1 & (IRQ_RX_PKT_RCVD | IRQ_CSMA_CA))) @@ -1241,6 +1262,9 @@ static int adf7242_probe(struct spi_device *spi) spi_message_add_tail(&lp->stat_xfer, &lp->stat_msg); spi_set_drvdata(spi, lp); + INIT_DELAYED_WORK(&lp->work, adf7242_rx_cal_work); + lp->wqueue = alloc_ordered_workqueue(dev_name(&spi->dev), + WQ_MEM_RECLAIM); ret = adf7242_hw_init(lp); if (ret) @@ -1284,6 +1308,9 @@ static int adf7242_remove(struct spi_device *spi) if (!IS_ERR_OR_NULL(lp->debugfs_root)) debugfs_remove_recursive(lp->debugfs_root); + cancel_delayed_work_sync(&lp->work); + destroy_workqueue(lp->wqueue); + ieee802154_unregister_hw(lp->hw); mutex_destroy(&lp->bmux); ieee802154_free_hw(lp->hw);