From patchwork Fri Apr 23 18:29:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 427133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, PDS_BAD_THREAD_QP_64, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51212C43460 for ; Fri, 23 Apr 2021 18:29:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21D4E61458 for ; Fri, 23 Apr 2021 18:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243756AbhDWSab (ORCPT ); Fri, 23 Apr 2021 14:30:31 -0400 Received: from esa.microchip.iphmx.com ([68.232.153.233]:3592 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243453AbhDWSa2 (ORCPT ); Fri, 23 Apr 2021 14:30:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1619202592; x=1650738592; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=S6AULILydVprhZ60aAOxzuDKn+3RyO50Oe2MNAOm5Bw=; b=TEzDqOriFXeSAZT2VT+PwrZZhkfY7iycsJNaQ5TkOQ67Xy9oyDxFTXoB lpdv/3er3LB4M8SfwBnUDJm6hQZ6cto5UnvBPA3BBUrLpeJ/XeSW929Xx Mcq0qq5JvS4ZNXGmGWAfHL9tXx9TThYDrI0++RLVVObWWyIe+ZR0jA63a j+Jm/J+qxqTjT8epLxitpLHeDlciB3Bp73q9wqyklySW8Mtc2P7fDOqOW h+TWRuKLZRxw3T2QlDBKOhjy+UAEI0+4nb6c0ocUBDPP0ryp+2yA3WgJP 5QM0RpZytuRUX2JRys567sx/oV76KnT02zwVm66H/AY+5vTMwhznpeiS3 A==; IronPort-SDR: 8seebXZvxjaTIKb4ZtudqDIdzXSI8Iama+J9BalBlySkQqKhBBBtTTAOGee+k1i4a5sRqkDVLt CDjR7WCShRfq9X30v9KQV8wwsgJdXXYUdBy6SfKI2Rf4aDaY+QEsH7EergGpM9FkGI6Dwymyqo EQH/+9l6cgivJQXEtDYCqBVtZjX+l9IurnPn5azt4Ex2yQV/4OgZwjqXyXysPdpPzDvwp2B343 2RiCbhR4poB2c2SOvvPwOThhHOBD8dNYe1Y4rAttRW1eizlD27btq6Jm0Ceccs5RKDxgw08fZL F5M= X-IronPort-AV: E=Sophos;i="5.82,246,1613458800"; d="scan'208";a="118174646" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Apr 2021 11:29:49 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 23 Apr 2021 11:29:48 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2 via Frontend Transport; Fri, 23 Apr 2021 11:29:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l8yibjxErIMxGz/sfzDhJsco4U7g71RNvqi8fAfOnuDrVeO5Q5XjsNqp/FfunZw5gVTAaEfQWGnZr1bUBgxUlPSm6DpByf2IUH0ut56jqkZcU3o5tBCWTrH4rYyCGWr/yrsO833jd6U/ZGcAqna+nzc9sRaK2gFXnZgdXNEt0qc0hdNJc6uh++DHh+JxkUgzIMJhd9jXlSwAJA1eMlRPURvA2ksDGa3el7yXswnm7wxyA7K32yMsJJDGwRbQdJKrchm6ER2X69CsebT3nklPe/T+zrIn5/wHf5BjJNduTwzpxt7vTp02oTzPA734W69Ii1zTO5Wfta8X4NBsI5PTkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PmnVUDB5J2sOnmpgt1ij2uwNxGcIBPaz72bn9NM93kA=; b=TqzAQ9xjMiJtNbcQUL2T/vU4vFgF+PnmCwRkphbW+crKLNGKK780yFgG+hVbCJidXtrIGRAOJ7S1YDKHFEgpJaVA/ir12bP19qZVKJ52Ldcj9Rd8huweqBmI4IjYQvPbdmxOn334N8+P3Ontimh7dgUxH4Amf56rhFzdW25+DEc36vzfSa7hiGEXTkJi+s9an/KTeKEkv3iz5h+mPs0pINSAUUMDAFHF4Kzch2xiUjyNE+k4S7tpNvgM9fqRvytWFJB6d5uiMPIvr0wrrhQmsfkq7tycwHeKWPyoQs+lGU5tyHmXQE+DsF7Xp4iaWwhA4KCZqDAmqStcfftyfZu4cA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PmnVUDB5J2sOnmpgt1ij2uwNxGcIBPaz72bn9NM93kA=; b=UDZdtETp3Eaiq1hHJdCov0gg7QBUgk12POqjUMswB0g0JNm0uoCMO0QjOqQBprHsRecB8GhBo6RprJJxRih2npskF+876pfkHacIzOgJSvru7V1sXOIDZ6b8jUHIgwBpyjICVLtz0lCKK//JLNJkeeNBuUcVsQQCAqTThSOj/1M= Received: from SJ0PR11MB4943.namprd11.prod.outlook.com (2603:10b6:a03:2ad::17) by BYAPR11MB3318.namprd11.prod.outlook.com (2603:10b6:a03:7d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Fri, 23 Apr 2021 18:29:47 +0000 Received: from SJ0PR11MB4943.namprd11.prod.outlook.com ([fe80::5da7:92e6:d6c9:64b3]) by SJ0PR11MB4943.namprd11.prod.outlook.com ([fe80::5da7:92e6:d6c9:64b3%7]) with mapi id 15.20.4065.024; Fri, 23 Apr 2021 18:29:47 +0000 From: To: CC: , Subject: [PATCH 08/12] wilc1000: invoke chip reset register while FW download Thread-Topic: [PATCH 08/12] wilc1000: invoke chip reset register while FW download Thread-Index: AQHXOG6jlLzEUJ2GxEOXwEu7VmPRmA== Date: Fri, 23 Apr 2021 18:29:47 +0000 Message-ID: <20210423182925.5865-9-ajay.kathat@microchip.com> References: <20210423182925.5865-1-ajay.kathat@microchip.com> In-Reply-To: <20210423182925.5865-1-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=microchip.com; x-originating-ip: [106.51.107.119] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8106f16c-ef96-4523-2fc0-08d90685c658 x-ms-traffictypediagnostic: BYAPR11MB3318: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:529; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /E8MChLCU/XG3d1Lso3J6l1tdt6iE9P7HcN1pe83H+wQxViHHHnb2jHd8EQeY9uSaSb3JfcFduMLvtTZRoLkfH2RDyuzNEoPZNQl5t1mgAqbEykYVFBL06ohcq2bnNqyaCGwfdCjRGRzaVH6GWVBuu75wTwX6TDf66BMdT7Ps6NP2J9CiH136hq+CSxdktKtyRkewaRVS9fvgX37FwWw3jqGLqO2x+QfUTpJLw1I16CvHfqVnteeq1NT/pgeDiYlaMb9iNNnoJBVt3A3VRrZWZ/5Mb08X90zRbOEKMq4/c/+fdc6pbup/omIgcA4PH/9uX9tM8KWglzbFLeM1jhpQt/GtcZVKs4pkZAYQfYfeHTlBLt61N729Oz7JnuIMqlwYocDJNUEpp9TDk1tH+6U7gSE9oLs3wwq5IFM5czf3HBeXTNg7zO4x9qIHhq3UCFdpXBC2h6cTavP2ICi05GyMrorW075H+UmTkVVIab50yiR9Fgz2BJXkuf5r85NUYTpDmVvg0x8Us1KhPM4430P1Rsqy3HZF2rssX5GZCZMaLBH6V/a1FeZOj77SFJlDHZdi6DIDMb8rZpWXJ7iq8pIDEV/ZCptOrmkFnbg9JlU3zE= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB4943.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(376002)(136003)(39860400002)(346002)(366004)(8676002)(478600001)(55236004)(5660300002)(54906003)(6506007)(71200400001)(1076003)(4326008)(2616005)(6486002)(86362001)(316002)(107886003)(6916009)(66476007)(66446008)(186003)(66946007)(36756003)(122000001)(26005)(66556008)(91956017)(83380400001)(38100700002)(8936002)(64756008)(76116006)(6512007)(2906002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?q?WrW22ydweTfsAf3yaetrcp?=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cjIVg/n4kMBb1Bnrvl/NEj+vmwjZgM75n2nGDlB0bc09?= =?iso-8859-1?q?SeMHeNAKasLwj2boJkzLHGYx3VjCLwcqjFc4cylyIDY0OdETwn4?= =?iso-8859-1?q?25cbIEn65lTsOUl4BVrkNj44QOSpB0ub2GcrXHIWwTo2Mh90OG7?= =?iso-8859-1?q?acpJCgfF8l4h0liluKukmb68b08tUN/wrUHNMpB2J0B5le7edV2?= =?iso-8859-1?q?KLbeDYkn0Buut+Mdt9ysCNqGFjzdcQrXSnCMK9Cchk/FJKp1XJn?= =?iso-8859-1?q?twmrX3aKRdA854olxQ42HuVdvyx1fovl4HVPLvKHhqJI72gHmsp?= =?iso-8859-1?q?9JyyN6WahjSGVDtEki7CecJbYSEIDX2jptITRmzaOPSV0SilAiG?= =?iso-8859-1?q?4SM1gg8stmL2N5nE/QjZdMCxJXa8I08yZ5Fa+MzQSiZjAheiYww?= =?iso-8859-1?q?UXf33NBj9v6EhjZnbZxOV15/BXTpP/7jna4E/uLri73xcREPwZb?= =?iso-8859-1?q?Demk6F+p0RaKTbTJOG6rIxeua7b7NksxJuEokLLXx5SSkQBKAsj?= =?iso-8859-1?q?Te2dD0B0AspZTsIuSg=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB4943.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8106f16c-ef96-4523-2fc0-08d90685c658 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2021 18:29:47.6566 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: dWrmlRPWeEhi1a1EX36tAK+CtQWERBpFpAr3k8nBza+SmLgfooXjCcRstaQt6rWPqRwwDa3xdn3SgLJbzIsDXubpNyffCqO396geY5iqUf0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3318 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ajay Singh Added chip-reset command before firmware download to initialize the chip. Also configure chip in wake state, ready to accept the FW binary. Signed-off-by: Ajay Singh --- .../net/wireless/microchip/wilc1000/wlan.c | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index 9f0bb876975a..24e016a0dfa8 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -1080,6 +1080,7 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 addr, size, size2, blksz; u8 *dma_buffer; int ret = 0; + u32 reg = 0; blksz = BIT(12); @@ -1088,10 +1089,22 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, return -EIO; offset = 0; + pr_info("%s: Downloading firmware size = %d\n", __func__, buffer_size); + + acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); + + wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, ®); + reg &= ~BIT(10); + ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); + wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, ®); + if (reg & BIT(10)) + pr_err("%s: Failed to reset\n", __func__); + + release_bus(wilc, WILC_BUS_RELEASE_ONLY); do { addr = get_unaligned_le32(&buffer[offset]); size = get_unaligned_le32(&buffer[offset + 4]); - acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY); + acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); offset += 8; while (((int)size) && (offset < buffer_size)) { if (size <= blksz) @@ -1109,10 +1122,13 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, offset += size2; size -= size2; } - release_bus(wilc, WILC_BUS_RELEASE_ONLY); + release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); - if (ret) + if (ret) { + pr_err("%s Bus error\n", __func__); goto fail; + } + pr_info("%s Offset = %d\n", __func__, offset); } while (offset < buffer_size); fail: