Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1669555ybt; Thu, 25 Jun 2020 11:14:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+i15TsHrfMhDM6vPFO5rHrW2IJ643iAffiQ+inLrt+NrExyWEw58wEcs1ph8XZXv96jZg X-Received: by 2002:aa7:d492:: with SMTP id b18mr33746477edr.339.1593108877927; Thu, 25 Jun 2020 11:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593108877; cv=none; d=google.com; s=arc-20160816; b=R34FYzJJqUWTBgxT+1LodnsQPsrhVmKQGxY1yhj1eoFy2oDfnyqcHQWZH5KjwX4aPm f7Pr4Oyu4h0xu4h5l8qgJ/iY1fJ72/FAVyFStpRCyRHql452aDSYDX5z0SNSROIvQqWo 4o8k1tEtLIg87m3vefEP3rpHjMITPnxhT3WstHVQLFxz8qg5/Xnm3gtSA2WwpVOrcT4M fEm2zjS+2uIFKdNwWYIRnYmXH3qy2/AhdDrRdDaJAfwWSEfN1G7xMDLqtaafqpKgthSt h7qf6DUjfW4FmR0N3txXkX3MMelcHIXQk/SIxlmDRL0tnxmVavfwabxdNWZdJ6rj8CBW bLzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xbChdbVcaywTNz9IAKx5z3jE8SQE5AmWRKOt/C/g5VE=; b=aUxP6hRje1SL4SIh+QfgMQ7IItqcgUeZyvHGVjU6+AmtKC8WKSoUR/w56V2s39zVzA rey7b7MH6Bchog6OdYD0xgbEh71O8JRHaU8KLK+rX0Y3u8njQsgiei+AgoaD2UCRskFQ TmvqCVEsJ26YYRtAJMxf552tnAW2qEnnNeD572s+XB1YUMHGk69u+xtg4BHCQ5g/Q0b5 M31iP7F2Nol9zpF7PYL/lCKM9RughJMHk9siDB2ZYLxeDrAKl/umppwc1l5WHIWRB+Ox Iovf0UDVQrg+jOM9oimOUv0Ruh1bfT78B/W5FxFfK+ln9CUV4t66Wp+Kw4fOx/6PsXqT WPeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lYZ6hFaN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k14si3816977ejs.400.2020.06.25.11.14.14; Thu, 25 Jun 2020 11:14:37 -0700 (PDT) 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=@kernel.org header.s=default header.b=lYZ6hFaN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405897AbgFYQHp (ORCPT + 99 others); Thu, 25 Jun 2020 12:07:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:52176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403863AbgFYQHn (ORCPT ); Thu, 25 Jun 2020 12:07:43 -0400 Received: from ziggy.de (unknown [213.195.114.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0396E2082F; Thu, 25 Jun 2020 16:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593101263; bh=QubKcWc+CTAGsj/zoI+CVXhnO4FPR3/tYHewrnyJwXQ=; h=From:To:Cc:Subject:Date:From; b=lYZ6hFaNv/WLDbYsEQ2xr/TmakMNyTlO8fwWj9FdUcFXRBrK7Lnb7oDBcN4sImSR8 64q9gZZzKSiT05qa2cSzk3chMrKJ7bdjgu9BYfUmSkNnItnMewiPHUfQEV9fboDn4c cU4toUHFA+Om/IMeK+n5KXxV6kLoyNAA1g/CgVss= From: matthias.bgg@kernel.org To: arend.vanspriel@broadcom.com, kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org Cc: franky.lin@broadcom.com, hante.meuleman@broadcom.com, chi-hsien.lin@cypress.com, wright.feng@cypress.com, mbrugger@suse.com, linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, matthias.bgg@kernel.org, hdegoede@redhat.com Subject: [PATCH] brcmfmac: Transform compatible string for FW loading Date: Thu, 25 Jun 2020 18:07:25 +0200 Message-Id: <20200625160725.31581-1-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthias Brugger The driver relies on the compatible string from DT to determine which FW configuration file it should load. The DTS spec allows for '/' as part of the compatible string. We change this to '-' so that we will still be able to load the config file, even when the compatible has a '/'. This fixes explicitly the firmware loading for "solidrun,cubox-i/q". Signed-off-by: Matthias Brugger --- .../wireless/broadcom/brcm80211/brcmfmac/of.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c index b886b56a5e5a..8a41b7f9cad3 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c @@ -17,7 +17,6 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, { struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; struct device_node *root, *np = dev->of_node; - struct property *prop; int irq; u32 irqf; u32 val; @@ -25,8 +24,21 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, /* Set board-type to the first string of the machine compatible prop */ root = of_find_node_by_path("/"); if (root) { - prop = of_find_property(root, "compatible", NULL); - settings->board_type = of_prop_next_string(prop, NULL); + int i; + char *board_type; + const char *tmp; + + of_property_read_string_index(root, "compatible", 0, &tmp); + + /* get rid of '/' in the compatible string to be able to find the FW */ + board_type = devm_kzalloc(dev, strlen(tmp), GFP_KERNEL); + strncpy(board_type, tmp, strlen(tmp)); + for (i = 0; i < strlen(board_type); i++) { + if (board_type[i] == '/') + board_type[i] = '-'; + } + settings->board_type = board_type; + of_node_put(root); } -- 2.27.0