Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp943110pxb; Fri, 22 Apr 2022 14:59:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2ESdIfIj2u9h3Luocffh5AQJBqilfd8TGZ047PxNls4q7yOalfJM9zah71hWRwaPS/y50 X-Received: by 2002:a62:5287:0:b0:505:651c:ffae with SMTP id g129-20020a625287000000b00505651cffaemr7012710pfb.13.1650664789282; Fri, 22 Apr 2022 14:59:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1650664789; cv=pass; d=google.com; s=arc-20160816; b=lDnUGAT3tiithttQykcvXu5aEN+DRCNh3WFVMRqSnFoAr+B1A3KDUlU4zDTv/ShAT2 DT7yWbHq9SMvS1bevCdpHuYbV9maMsUxleuMsDQXYC4/we+4fGF1pXz+EwoWZd1df+OE HN+NXJ5MkL9E/TeScnsRzZU/HrVmJJcY4TWTFe57NlNnNVzKVDLSrnQuwS6wnGOAanuI z+b3+mwHwWcwvsXjHqAzjqVCQQ4OYidzKj75HMfosTug1vIYlXIImHY1EckEWDfdn0F0 fVYY1PGZOCdY+dw/c77EcnSeETFQNaSdqHygijtX/jdmgCb92eWcdSjjQefXPIV+R+dD yeGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GoZjLK97WI4aQlNkrx10mSm0M1CPn3sGa6ohjZnI1yk=; b=YhmqcmYchZ0QV13wrrN+bNu6HRwGhRcgPioYBiV8CPJxHW2hH7lHmED5ppOcuu7GR/ DzA6FeKtzSwsi7q7E3ENUl++az6e2G7QlA2oI5kULpL7UNiYZpY6wjOCYx0oAHYMZQxU wDCffwbwnTDbjAsLZMD6P/xWJgB3ZK6kbxu42TDw2PnlFeg/ZGj/19pjrtGZ7h4tFzBF DmqgTf/PRy3t6k/JGNp0sDffNOsN6kp1zOSfIUteIMVFrhpZqgCaSMyFJ5DuAoGHGdTm l4D0OyCuYkc+/5vXrG53AR8i6mr/2dAPYvKOrtPt5cCzIwUbFEBXb1u7xeu0K5T/sIxS jCKg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@toradex.com header.s=selector2 header.b=TfE2ZgRY; arc=pass (i=1 spf=pass spfdomain=toradex.com dkim=pass dkdomain=toradex.com dmarc=pass fromdomain=toradex.com); spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=toradex.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d13-20020a170902cecd00b0015682eea101si10380579plg.557.2022.04.22.14.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:59:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@toradex.com header.s=selector2 header.b=TfE2ZgRY; arc=pass (i=1 spf=pass spfdomain=toradex.com dkim=pass dkdomain=toradex.com dmarc=pass fromdomain=toradex.com); spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=toradex.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B67F0370E49; Fri, 22 Apr 2022 13:07:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445836AbiDVJGj (ORCPT + 66 others); Fri, 22 Apr 2022 05:06:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359739AbiDVJGi (ORCPT ); Fri, 22 Apr 2022 05:06:38 -0400 Received: from CHE01-GV0-obe.outbound.protection.outlook.com (mail-gv0che01on2128.outbound.protection.outlook.com [40.107.23.128]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E27D853712; Fri, 22 Apr 2022 02:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R7tVaNWmi/LSMDSHYdRr6oQRRJGfaojbWmVUXsHHIPCnojleMsRnU7ZUnkvy1pnmDiwCAirZxj82qL8g7ffw77b6EpjS2nyMxRFn/gOp/BkcRq+xOR9/DA/d1drKgZn8CeXVw37TfaBUYW7AIU5u8nvwuXb8v+xIFL0B7RJlwStcWBFkjFFsczyGDxszHyAagZmqEvNP/6Mo/WG23DU9w3+A6nqceoJIHwfFInlPSd4Ut35G6NGnIfFSd7Nk88Rf0Y+ypbJSruq4wJ/u+CzOGmi83k7XqYOBmc6IokHuNX6YR+4LNdgt+AmFVCXQH79odyUlso65AQu1uiRIfTXixw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GoZjLK97WI4aQlNkrx10mSm0M1CPn3sGa6ohjZnI1yk=; b=KuiLfrTddDRX15TCcXScsRMv8mwtuJduS5Bnx8cR3e2n0/9Pk3/egXe2h5qZLLH6ZatHJRLWhKfu8ZJ8PVZIEnC7fwzL0Q1aYCKRQPjsJpHIMclGvG2t4k/0gPJJqrw7kzB0v3dAuscgc6bvyUhkGEsstOkNiusFNWIDvh/9ZS0iK42c6hwOuQG+UhKBlfJCWpYVsViCWFlij+AL8vw+zRFm0IbhwMBZyb1ann8mkR/nse4uUColDyxDHj/YwitPnyXN8Ca/JkQRvQ5OmKs3ffm1rK63P8n3ONGlQ84suGozvPBvw3cW9hur//ytx0HrPm/10ZkNYtgXuIXtG3wrNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=toradex.com; dmarc=pass action=none header.from=toradex.com; dkim=pass header.d=toradex.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GoZjLK97WI4aQlNkrx10mSm0M1CPn3sGa6ohjZnI1yk=; b=TfE2ZgRYqeAFihQbUbs8/efB7mjgXITxz9Ugr33yenez4vKPVXRXYJk2Dr5yncdom2AfCknOn6MhURK5FKcwOxjihIImMI6/zmuk/NobA+XZyEkoncBRfFcyZI6Kws+1tchd4mcmOgpeORXsAXhRuLHfVCSOq39b/9IzxhvVI2A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=toradex.com; Received: from GVAP278MB0929.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:57::6) by ZR0P278MB0393.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:34::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Fri, 22 Apr 2022 09:03:41 +0000 Received: from GVAP278MB0929.CHEP278.PROD.OUTLOOK.COM ([fe80::d03a:14ba:bd9a:e165]) by GVAP278MB0929.CHEP278.PROD.OUTLOOK.COM ([fe80::d03a:14ba:bd9a:e165%7]) with mapi id 15.20.5186.015; Fri, 22 Apr 2022 09:03:41 +0000 From: Andrejs Cainikovs To: linux-wireless@vger.kernel.org, Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu Cc: Andrejs Cainikovs , Kalle Valo , "David S . Miller" , Jakub Kicinski , Brian Norris , =?UTF-8?q?Jonas=20Dre=C3=9Fler?= , =?UTF-8?q?Alvin=20=C5=A0ipraga?= , Francesco Dolcini , netdev@vger.kernel.org Subject: [PATCH v2 1/2] mwifiex: Select firmware based on strapping Date: Fri, 22 Apr 2022 11:03:12 +0200 Message-Id: <20220422090313.125857-2-andrejs.cainikovs@toradex.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422090313.125857-1-andrejs.cainikovs@toradex.com> References: <20220422090313.125857-1-andrejs.cainikovs@toradex.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: ZR0P278CA0151.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::12) To GVAP278MB0929.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:57::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd730d8f-22cd-46ad-6b47-08da243eff3c X-MS-TrafficTypeDiagnostic: ZR0P278MB0393:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: giSG7MwrSEDJJKI9w5gd7x0LHXmJx3Ir3+xW8m2IoBR1S0wyO16x+SEuiW0SRfTOWrvDFz9KL+Gv8YAKOtH4DW37p/ZQQKUdYgvXk40sNemW/GlfAX1AixH5nGO2latG3+Mz7To8xNuHLPSY1FiTx7yqYowIsa6zr9RvT1eYJQZWlW3iIftsORBCKEnzoAYLJn+eWK+OpHYkQsEHmLn6dCobZGoEnIIyQqEhPUg4SVyXIM6BweZsTmkC0oAMBu1WaAmzNUVVtJrzFWUdEQayB7cH2E+FE71UlqUjhYDU6ZnZW0fSjM8zTBvlPo716bQYXPTWep8vlxjzDedGhdpuw3V01scY/RefaRhdZ28oc0L4ncIYkEN7j6aV+5EgUU2VgVKc+dFjlu9ZO/vW/KRrWMkEU31toojcfcCpQX83AaDrPShgRfYWGiar1mzQLu5D4u85P5fmfz9Pc/YRCCU+W2OwBHFP/MnfJ8dzY/MgQ3V5vpEikf9PNJzFl4pl8qKpz4Ifj3ha0VOepjp6qLNMtgsBLw5scWo7TDwKeMLFDC911SEeoEiASldfeh8wUdkBn1G4i8to8RwoLGzlmdLU25Av0qmFZ4E9z0RquVBlliHh1W200coS4/2HoL6ScrNiZmIpJPCHwVSUa+8tcB7KU5a23RsHLBV1DWCJitsZffP3jl8RIhvpl+xZ9+D28apF/Y3aMnGXeftMCVq66RH5OmNSRnclLbtajlEfzMh1uwtl5adBCeJ5reUZigp2yp7mPuoX9iLC7a/la4jI2OsmCp65lT1sO7NautWUH9Db28Q= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GVAP278MB0929.CHEP278.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(396003)(39850400004)(136003)(346002)(376002)(6506007)(2616005)(6512007)(86362001)(316002)(6666004)(44832011)(2906002)(5660300002)(7416002)(54906003)(26005)(1076003)(8936002)(110136005)(38100700002)(186003)(52116002)(508600001)(38350700002)(966005)(6486002)(36756003)(8676002)(4326008)(66574015)(66476007)(66556008)(66946007)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cjB5RmhoR1JFbG0yajZaN29id2d5RjdELzBaV2ZOc0Q4ZHhmNGFWaFVJYVZm?= =?utf-8?B?UjVxRGt3T0xzdS9nMjBwTGkvK1NqRGU5OHMzcGZWTFFqd3hsZFRqRzRKUys2?= =?utf-8?B?ZzdLbytSdzQvQ0w1TC9ZYXgydUxMbDBRQUM0NHJIOFBrdHlyZWV1QWNVdHJM?= =?utf-8?B?MzdUZjVMN1VCUk8vazJJbDZJelpKdStSU0Njd0NIaERxSlkyTWJRWU1QRVdW?= =?ut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NSUJuUVNucEh1RTRlSk1m?= =?utf-8?B?NGpVbmRCalBMNVdnNm1EYzlrSWp1NlVIRE0yL0QvUzFFTlhEa2Q0NEVJeHBE?= =?utf-8?B?blhFNG9iVG9aeGlubnFjOTc2TGQ4ZEp0NDAxLzF4S0s5L0Q5RDZxQTRqSTZI?= =?utf-8?B?T2ZKejBQVGJleFZUUjMrcjZGTGdiOTRYN3JqZDREL084eE5zMzdPcGI2Z3cv?= =?utf-8?B?bWtWZFgvUnpnRURiRE1FSW8yaCs4TjNUazdFMEQxSUZZWDdmOVBnMmdNSzVv?= =?utf-8?B?NjlscSttaWZ0NEErdkJ4RloxOHRVWnNuSHd3Zk1CdlZ2QzgvZWt0dlZzSmtI?= =?utf-8?Q?yrJRsrn+U9fZEcg0=3D?= X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd730d8f-22cd-46ad-6b47-08da243eff3c X-MS-Exchange-CrossTenant-AuthSource: GVAP278MB0929.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2022 09:03:41.5849 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vBhLL0MvdRlR03H8CtFFQJP3burn+xRsI6x2T1ckNyt9r9k5eJnVMD79PNBx0qoXiPZcO9pbwtxAAY8J19LknSxkXLWlS/CWnd77S0u6O6s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZR0P278MB0393 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Some WiFi/Bluetooth modules might have different host connection options, allowing to either use SDIO for both WiFi and Bluetooth, or SDIO for WiFi and UART for Bluetooth. It is possible to detect whether a module has SDIO-SDIO or SDIO-UART connection by reading its host strap register. This change introduces a way to automatically select appropriate firmware depending of the connection method, and removes a need of symlinking or overwriting the original firmware file with a required one. Host strap register used in this commit comes from the NXP driver [1] hosted at Code Aurora. [1] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/net/wireless/nxp/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c?h=rel_imx_5.4.70_2.3.2&id=688b67b2c7220b01521ffe560da7eee33042c7bd#n1274 Signed-off-by: Andrejs Cainikovs Reviewed-by: Alvin Šipraga --- drivers/net/wireless/marvell/mwifiex/sdio.c | 21 ++++++++++++++++++++- drivers/net/wireless/marvell/mwifiex/sdio.h | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c index 4f3238d2a171..d26efd56be08 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.c +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c @@ -182,6 +182,9 @@ static const struct mwifiex_sdio_card_reg mwifiex_reg_sd8997 = { .host_int_rsr_reg = 0x4, .host_int_status_reg = 0x0C, .host_int_mask_reg = 0x08, + .host_strap_reg = 0xF4, + .host_strap_mask = 0x01, + .host_strap_value = 0x00, .status_reg_0 = 0xE8, .status_reg_1 = 0xE9, .sdio_int_mask = 0xff, @@ -283,6 +286,9 @@ static const struct mwifiex_sdio_card_reg mwifiex_reg_sd8987 = { .host_int_rsr_reg = 0x4, .host_int_status_reg = 0x0C, .host_int_mask_reg = 0x08, + .host_strap_reg = 0xF4, + .host_strap_mask = 0x01, + .host_strap_value = 0x00, .status_reg_0 = 0xE8, .status_reg_1 = 0xE9, .sdio_int_mask = 0xff, @@ -536,6 +542,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) struct mwifiex_sdio_device *data = (void *)id->driver_data; card->firmware = data->firmware; + card->firmware_sdiouart = data->firmware_sdiouart; card->reg = data->reg; card->max_ports = data->max_ports; card->mp_agg_pkt_limit = data->mp_agg_pkt_limit; @@ -2439,6 +2446,7 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) int ret; struct sdio_mmc_card *card = adapter->card; struct sdio_func *func = card->func; + const char *firmware = card->firmware; /* save adapter pointer in card */ card->adapter = adapter; @@ -2455,7 +2463,18 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) return ret; } - strcpy(adapter->fw_name, card->firmware); + /* Select correct firmware (sdsd or sdiouart) firmware based on the strapping + * option + */ + if (card->firmware_sdiouart) { + u8 val; + + mwifiex_read_reg(adapter, card->reg->host_strap_reg, &val); + if ((val & card->reg->host_strap_mask) == card->reg->host_strap_value) + firmware = card->firmware_sdiouart; + } + strcpy(adapter->fw_name, firmware); + if (card->fw_dump_enh) { adapter->mem_type_mapping_tbl = generic_mem_type_map; adapter->num_mem_types = 1; diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h index 5648512c9300..ad2c28cbb630 100644 --- a/drivers/net/wireless/marvell/mwifiex/sdio.h +++ b/drivers/net/wireless/marvell/mwifiex/sdio.h @@ -196,6 +196,9 @@ struct mwifiex_sdio_card_reg { u8 host_int_rsr_reg; u8 host_int_status_reg; u8 host_int_mask_reg; + u8 host_strap_reg; + u8 host_strap_mask; + u8 host_strap_value; u8 status_reg_0; u8 status_reg_1; u8 sdio_int_mask; @@ -241,6 +244,7 @@ struct sdio_mmc_card { struct completion fw_done; const char *firmware; + const char *firmware_sdiouart; const struct mwifiex_sdio_card_reg *reg; u8 max_ports; u8 mp_agg_pkt_limit; @@ -274,6 +278,7 @@ struct sdio_mmc_card { struct mwifiex_sdio_device { const char *firmware; + const char *firmware_sdiouart; const struct mwifiex_sdio_card_reg *reg; u8 max_ports; u8 mp_agg_pkt_limit; -- 2.25.1