From patchwork Wed Oct 26 13:15:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 11260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp263175wru; Wed, 26 Oct 2022 06:19:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FdkxZzGN9GiIzLciR7enHi4H8pQvVTIXLyj2Tggghqur/mDba6rr8BkRgPmls4QRTKyz8 X-Received: by 2002:a63:1e56:0:b0:462:970:e0de with SMTP id p22-20020a631e56000000b004620970e0demr2817959pgm.90.1666790373565; Wed, 26 Oct 2022 06:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666790373; cv=none; d=google.com; s=arc-20160816; b=bH5b3NrDAvYycLNToupSqlXbhx3QWsxthhmAEg5x8ckY/M2od26xOu0mQCEElm4XTB 6JIy+lJi0ei4AouiNRfH3kpiJHjlKW0ax/JUKAsI0d0sa/j3Rq6RXcLQ+r+DObbk4ilX hv9n7/rLvMqX3PePm2C4jAxaDCHisoECkGKwNknqG35bdOfGh+WJ2K7LhlEbeAL9SaRW EYB/6ZcUhbcx2Z9ZSh6tZCzFHeNZY2PTClWztCyEnAaNl33qe4bGrfHq6wLO9jXwax7R PFj+DBoNawXtKmE0byRoaIEGq2Bzgetxkdjy4/bR5rPhytuJtuzi9dJOOuDbBFiVoDS3 1GKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=rmV74reOQIhMVx3wfFt0WNHhPTZ+EE2t0X4nueZsE3E=; b=ky0Vii2cD/DTEzANoQsnHlfMb6QiHOepy+9Dn0B8mfGVnG8s+VriPq0B/19q8nwXde fItf8GVbjy5W6h1IrXvWCVatAlTQY0Bl3gq/ds5dD3eJ+vgUmozAFCLqcOsKg7d4IdLC GQkBIg7L1HMoWwJa260LJePcu42Xz6YvNdPxVEQSiEu+oPr1TXHik61p6s6WzvsEFqFJ bXMmrSuZfyeaRCpcoMGkmJWqRzBOEweVUlBCJfGtT0wZnaCme1wWSnvLU/PKcfK0XL6Q Jcha7DSu1YovA525h23WD8iPuwWOnjSrgjE3Wv9oPqKj7bA9XFzs3QSYiQQ3jx+SqH34 gfCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b="lwV9B2/G"; dkim=pass header.i=@tq-group.com header.s=key1 header.b=FXDp8xAA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020a170902d2d200b0017cca111726si7855278plc.432.2022.10.26.06.19.18; Wed, 26 Oct 2022 06:19:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b="lwV9B2/G"; dkim=pass header.i=@tq-group.com header.s=key1 header.b=FXDp8xAA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233153AbiJZNQs (ORCPT + 99 others); Wed, 26 Oct 2022 09:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234034AbiJZNQh (ORCPT ); Wed, 26 Oct 2022 09:16:37 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548118306F; Wed, 26 Oct 2022 06:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790196; x=1698326196; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rmV74reOQIhMVx3wfFt0WNHhPTZ+EE2t0X4nueZsE3E=; b=lwV9B2/GGH8BD3LR4e9svhvvx7RNQizqm6gj1u8lWwh2uS3mbd2h7m77 fFIeenw0jw/sk36Jn7aB0/3WrSp0hL8FXfH2ZmWULWIKn+xthB/wfu0o+ ZBsxG0dMlFqe2vKriIiEh9HpznGjM3EH8yUW1KIryzddTvbzCcTwpW7MJ NF7GBKeuu/1t0Cinlw6WPO1PYp5Jvbv9lpEOZkAP0uBqIMbpc0lL3Rk4I dZlsGK1d153gvSVyeNXgRCb1NPTwDbtBfJtG0cofHZfv5BNuWtn0A0PW5 f7weVBgDd80tPnUa8YQLJgSzJCqUt9KtMF+Wg70X6SeXKVXrXJCCscCTv A==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988469" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 26 Oct 2022 15:16:31 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 26 Oct 2022 15:16:31 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 26 Oct 2022 15:16:31 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790191; x=1698326191; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rmV74reOQIhMVx3wfFt0WNHhPTZ+EE2t0X4nueZsE3E=; b=FXDp8xAAIqGd6/RL9y8KrOnNq0i/vgBaqMYdKGbnkXh0qoMQa68LPoQ3 5JBbE5FQHNkEgB0edF+VAwEUnlpvFXIynS+aBvLjzFu9ClGKITol5aLab Ndh6731IPrB2/3d+OG5sVUbsWvU1m+RVoRpmf0Te2jM0r7qI/AbPip9n6 vIT5zrl4QaS8x9eUdclxXUnA52znNWj8c64Y1PODYEuhDJQbzJxOyxBEb sfl/JUUIDDL5qJ9wr+Wo2UCO8p3YPG5kx2eclsonv9VPs9hEOMxZnvT44 CD2caRrZVFM8riiFR/i0e115nWeWRJjm7jJyc6udD37yC8gx/F7vDMAyU g==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988468" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 26 Oct 2022 15:16:31 +0200 Received: from localhost.localdomain (SCHIFFERM-M2.tq-net.de [10.121.49.14]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id 21BFC280072; Wed, 26 Oct 2022 15:16:30 +0200 (CEST) From: Matthias Schiffer To: Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, Matthias Schiffer Subject: [RFC 1/5] misc: introduce notify-device driver Date: Wed, 26 Oct 2022 15:15:30 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747756382570906229?= X-GMAIL-MSGID: =?utf-8?q?1747756382570906229?= A notify-device is a synchronization facility that allows to query "readiness" across drivers, without creating a direct dependency between the driver modules. The notify-device can also be used to trigger deferred probes. Signed-off-by: Matthias Schiffer --- drivers/misc/Kconfig | 4 ++ drivers/misc/Makefile | 1 + drivers/misc/notify-device.c | 109 ++++++++++++++++++++++++++++++++++ include/linux/notify-device.h | 33 ++++++++++ 4 files changed, 147 insertions(+) create mode 100644 drivers/misc/notify-device.c create mode 100644 include/linux/notify-device.h diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 358ad56f6524..63559e9f854c 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -496,6 +496,10 @@ config VCPU_STALL_DETECTOR If you do not intend to run this kernel as a guest, say N. +config NOTIFY_DEVICE + tristate "Notify device" + depends on OF + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index ac9b3e757ba1..1e8012112b43 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -62,3 +62,4 @@ obj-$(CONFIG_HI6421V600_IRQ) += hi6421v600-irq.o obj-$(CONFIG_OPEN_DICE) += open-dice.o obj-$(CONFIG_GP_PCI1XXXX) += mchp_pci1xxxx/ obj-$(CONFIG_VCPU_STALL_DETECTOR) += vcpu_stall_detector.o +obj-$(CONFIG_NOTIFY_DEVICE) += notify-device.o diff --git a/drivers/misc/notify-device.c b/drivers/misc/notify-device.c new file mode 100644 index 000000000000..42e0980394ea --- /dev/null +++ b/drivers/misc/notify-device.c @@ -0,0 +1,109 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include +#include +#include +#include + +static void notify_device_release(struct device *dev) +{ + of_node_put(dev->of_node); + kfree(dev); +} + +static struct class notify_device_class = { + .name = "notify-device", + .owner = THIS_MODULE, + .dev_release = notify_device_release, +}; + +static struct platform_driver notify_device_driver = { + .driver = { + .name = "notify-device", + }, +}; + +struct device *notify_device_create(struct device *parent, const char *child) +{ + struct device_node *node; + struct device *dev; + int err; + + if (!parent->of_node) + return ERR_PTR(-EINVAL); + + node = of_get_child_by_name(parent->of_node, child); + if (!node) + return NULL; + + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (!dev) { + of_node_put(node); + return ERR_PTR(-ENOMEM); + } + + dev_set_name(dev, "%s:%s", dev_name(parent), child); + dev->class = ¬ify_device_class; + dev->parent = parent; + dev->of_node = node; + err = device_register(dev); + if (err) { + put_device(dev); + return ERR_PTR(err); + } + + dev->driver = ¬ify_device_driver.driver; + err = device_bind_driver(dev); + if (err) { + device_unregister(dev); + return ERR_PTR(err); + } + + return dev; +} +EXPORT_SYMBOL_GPL(notify_device_create); + +void notify_device_destroy(struct device *dev) +{ + if (!dev) + return; + + device_release_driver(dev); + device_unregister(dev); +} +EXPORT_SYMBOL_GPL(notify_device_destroy); + +struct device *notify_device_find_by_of_node(struct device_node *node) +{ + return class_find_device_by_of_node(¬ify_device_class, node); +} +EXPORT_SYMBOL_GPL(notify_device_find_by_of_node); + +static int __init notify_device_init(void) +{ + int err; + + err = class_register(¬ify_device_class); + if (err) + return err; + + err = platform_driver_register(¬ify_device_driver); + if (err) { + class_unregister(¬ify_device_class); + return err; + } + + return 0; +} + +static void __exit notify_device_exit(void) +{ + platform_driver_unregister(¬ify_device_driver); + class_unregister(¬ify_device_class); +} + +module_init(notify_device_init); +module_exit(notify_device_exit); +MODULE_LICENSE("GPL"); diff --git a/include/linux/notify-device.h b/include/linux/notify-device.h new file mode 100644 index 000000000000..f8c3e15d3b8f --- /dev/null +++ b/include/linux/notify-device.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _LINUX_NOTIFY_DEVICE_H +#define _LINUX_NOTIFY_DEVICE_H +#include +#include + +#ifdef CONFIG_NOTIFY_DEVICE + +struct device *notify_device_create(struct device *parent, const char *child); +void notify_device_destroy(struct device *dev); +struct device *notify_device_find_by_of_node(struct device_node *node); + +#else + +static inline struct device *notify_device_create(struct device *parent, + const char *child) +{ + return NULL; +} + +static inline void notify_device_destroy(struct device *dev) +{ +} + +static inline struct device *notify_device_find_by_of_node(struct device_node *node) +{ + return NULL; +} + +#endif + +#endif /* _LINUX_NOTIFY_DEVICE_H */ From patchwork Wed Oct 26 13:15:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 11263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp263304wru; Wed, 26 Oct 2022 06:19:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QO5+HbeC2Zsbx8FfM4jxef60bb0RtFjO5MseL4Fj3rDlHU4/3HTTNm9edHyDXBd71qaQ0 X-Received: by 2002:a17:907:2c59:b0:78d:8e03:134 with SMTP id hf25-20020a1709072c5900b0078d8e030134mr36740331ejc.310.1666790386083; Wed, 26 Oct 2022 06:19:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666790386; cv=none; d=google.com; s=arc-20160816; b=kTnd3Ipke80eAQ3dXaKL35XXgEAX76eaiP4WoMT43e+tc+yAKS9GTT2hn11rSPvlvp odU1KkRpuz4VE7uuiSPP7mzDcF9rb0kZ1jRqVFlp0oazM9oV1WPwNFjhXkVwrFTUS8yT G0y3xtaIryoOVfvnjV2In8IR8Vt0tEWE1gnekfCis/bTvkfy0dvL/24iWKDoqeeCgYaV KCNaPn7AyzAgH3erEV2M+DZf91SDu6tGigLJW36iQ0kbomm1KmHOTLVc4JRoAh/8QVSX Ub5qrLW9lZUd90MYmjreI4xOg+iPAaZCv15tHminMdRg8z8JzzJmFbBySCDRYnU4BB4S Shfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=SZraRyM7DZleVZcuBicugzAwWfORdbPbN+RhQtnWZ+c=; b=IMNIfNIzRUb2mldUUQ2cgFuw1TjQlG7JejeNPoQBxwkciOmLyD4IEWcFvepr6gYYWR vHfsp0obMkya1f3VgffBH95cQNTEyiWoSVY4vttQOUqIx0bUW7d471mbALoFE8u1MGjP cTioJW9OC+snalGGsenvwUsGqyC247UriVKwoDlC9i0wZcF4WR9LQVm71VaE1G7KDZi0 I80B0Ed7vy5E990QY3YDfH9bZ9spFRHnbr0xiuSARq74etWCv3M9cgtFfgd8kBk7lBgS OtY2i6GyEHPM6DkDR+LjCi5DAphOcwgQpu5kw4ddbh7Ngv+sugQ57MxjsrGm87ldMUo8 GRQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Yy6Jurd1; dkim=pass header.i=@tq-group.com header.s=key1 header.b=bxJFbnSH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn3-20020a17090794c300b0076f061ffab4si6792459ejc.51.2022.10.26.06.19.17; Wed, 26 Oct 2022 06:19:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Yy6Jurd1; dkim=pass header.i=@tq-group.com header.s=key1 header.b=bxJFbnSH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234033AbiJZNQm (ORCPT + 99 others); Wed, 26 Oct 2022 09:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233619AbiJZNQh (ORCPT ); Wed, 26 Oct 2022 09:16:37 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B27CC87085; Wed, 26 Oct 2022 06:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790196; x=1698326196; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SZraRyM7DZleVZcuBicugzAwWfORdbPbN+RhQtnWZ+c=; b=Yy6Jurd1G+5PuVFvg87d3TfPLMvJuQdJkQs0Qc7iZGYioj30LSxiNHx9 f5SyReOTX0J+iYi2hN68qgl7Bx87SSJ0p1tLfaFi/5KWDFVtxLuTCmH0T 502Xm9/xOBX/pjTZu9BZrNI0i+XyOFcS3kRJzfcfFVivANF30rPTg4NTs MUty3laK0vfokZguG174gaJg3rq9iCdnWvKU7ORHZbLKGtorOic13thuu xy7wREcTF6GDlUSbrD71Dt1lwz2VZYn0kIXVPFGJQ3prUg/lpI2hVsYMM mBslZn1740sCAYvrV8XTKA9DpRlqhMdBI+jN0DA+4yqSdKRK084XtbKo3 Q==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988471" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 26 Oct 2022 15:16:31 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 26 Oct 2022 15:16:31 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 26 Oct 2022 15:16:31 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790191; x=1698326191; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SZraRyM7DZleVZcuBicugzAwWfORdbPbN+RhQtnWZ+c=; b=bxJFbnSHUHAVIw6Ud7sc0xIgs2fxUXz60xwsj6VVdyN6zDf6tPCP8NSk baon64StCZvSWTltBrb5UtB3HjXaxSJ2gnHgXOdIaX9JcKzxbj1FBHHrM GyTJBu1B261V/S979rb6438CiTcaIxEltvXiJXz9GFpaCt6irKEUnGnBo QrHEAy0J4VAvlC0oPtDBDY5E37DgtDr8V9/UEUrYzqaWv+Bxsva6EUvp4 8sp1nJqg778KyuJZvJy27N0TySSwpCMZmX4uvrPtRjkfVanqH+pxTv5wZ UWKEnKvyvZQi4FQ921CZbza+eTYiikcH/xcS0cFdqGdH8RWceRYtd3UtX Q==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988470" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 26 Oct 2022 15:16:31 +0200 Received: from localhost.localdomain (SCHIFFERM-M2.tq-net.de [10.121.49.14]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id 7212E280056; Wed, 26 Oct 2022 15:16:30 +0200 (CEST) From: Matthias Schiffer To: Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, Matthias Schiffer Subject: [RFC 2/5] wireless: mwifiex: signal firmware readiness using notify-device Date: Wed, 26 Oct 2022 15:15:31 +0200 Message-Id: <5d5e1e4b2f4d6c8abc4332f8664f911f26b18878.1666786471.git.matthias.schiffer@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747756395847653547?= X-GMAIL-MSGID: =?utf-8?q?1747756395847653547?= Signed-off-by: Matthias Schiffer --- drivers/net/wireless/marvell/mwifiex/main.c | 14 ++++++++++++++ drivers/net/wireless/marvell/mwifiex/main.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index da2e6557e684..92176e90b11e 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -5,6 +5,7 @@ * Copyright 2011-2020 NXP */ +#include #include #include "main.h" @@ -661,6 +662,16 @@ static int _mwifiex_fw_dpc(const struct firmware *firmware, void *context) mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); mwifiex_dbg(adapter, MSG, "driver_version = %s\n", fmt); adapter->is_up = true; + + adapter->notify_dev = notify_device_create(adapter->dev, "firmware-notifier"); + if (IS_ERR(adapter->notify_dev)) { + /* This error is not fatal */ + mwifiex_dbg(adapter, ERROR, + "cannot create firmware notify device: %d\n", + PTR_ERR(adapter->notify_dev)); + adapter->notify_dev = NULL; + } + goto done; err_add_intf: @@ -1482,6 +1493,9 @@ static void mwifiex_uninit_sw(struct mwifiex_adapter *adapter) rtnl_unlock(); } + notify_device_destroy(adapter->notify_dev); + adapter->notify_dev = NULL; + wiphy_unregister(adapter->wiphy); wiphy_free(adapter->wiphy); adapter->wiphy = NULL; diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 63f861e6b28a..b28e90db3128 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -870,6 +870,7 @@ struct mwifiex_adapter { int winner; struct device *dev; struct wiphy *wiphy; + struct device *notify_dev; u8 perm_addr[ETH_ALEN]; unsigned long work_flags; u32 fw_release_number; From patchwork Wed Oct 26 13:15:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 11264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp263331wru; Wed, 26 Oct 2022 06:19:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qaIbn0t8PL4reg2QdjWyUqttyZF6++sQb6yD7uePei9hXHsOhsVVKBjCpiP/IkrDAOwK/ X-Received: by 2002:a17:903:32d0:b0:17f:9224:6e1f with SMTP id i16-20020a17090332d000b0017f92246e1fmr43990058plr.126.1666790388512; Wed, 26 Oct 2022 06:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666790388; cv=none; d=google.com; s=arc-20160816; b=aWCASraWHoLDr5ryv/p9S0Wo9BMDH2bzuYPTW4hMl3RbaSR5YeBNhsQPe1vIuqN3+R iXfiIBSRLFnwhdiwgIe3NQrTQ/13/o8VFyESOcvpBtNKijqREacco0r1i9A82Iv+rilm E4vyAaxZom7cgjNL9cbp71IQS3JFeFDiG52pCNnl3/5fk4xYmxxERa1NUMaImHFa5Lwt 9zq5O8a9iQ9elUMFv1XnOsq1P8zdlBJ3vkOv2B3HDfogyuCc6T3IgdN+yB48CJiLBGJ9 XCwvYayYN/2+KP06PvJahV8pgLAya1KCrKZ6CBRv1Ncyzzc7x1KqQyu4WZjEEWLYu691 PZwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=uD3B1j8AxBWEwgk4/bzdEnH3IBUS1p5ckVASZEy9HSQ=; b=vaGh5bPqQKNvMqIn6XtE28dm/P4/5FobktdkUkbRZyFi1y9ujBnTqCIlwzKQR5t+PA pjJMHZMqPgsgF5Mr+7rZCRADznzTQcrn69/fp7ni9RMjiMjaf9UY1SxXNZbLeYMVwPpS H2tD4Vb38cnrNETMaryARaZE8vusMg8hkW3ZXwEobBZGvSx1Hm8dw/YnSsBp0ewCpvj5 QId00LgU8jRw2+2vDPx7T+mDcHVuNRmZS4l9ArEPN0siSqtVD/hyIxpJ0sI/9ViBR4Ew 3vsFD+dp1/5ptkVZrPb8hQ1LUkfczFFgg2ktw6aT4UxzAVwmJ9VpCFeTPKDz+cQaDx+3 i7MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b="iSp/2XKn"; dkim=pass header.i=@tq-group.com header.s=key1 header.b="qtmEsX8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a170903300500b0017f6a4fd6fbsi5575484pla.123.2022.10.26.06.19.35; Wed, 26 Oct 2022 06:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b="iSp/2XKn"; dkim=pass header.i=@tq-group.com header.s=key1 header.b="qtmEsX8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234060AbiJZNQx (ORCPT + 99 others); Wed, 26 Oct 2022 09:16:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232625AbiJZNQi (ORCPT ); Wed, 26 Oct 2022 09:16:38 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7BFCFAA60; Wed, 26 Oct 2022 06:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790197; x=1698326197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uD3B1j8AxBWEwgk4/bzdEnH3IBUS1p5ckVASZEy9HSQ=; b=iSp/2XKnaAngenVIBu4Dpp8SnEcvEOmoe4gcUI4RTPqf0SVbfqnaBmC0 W4zyVeTr0aIpAwCQJ3XZifMQTdJyOU/2QZMyLtX8bY6o81St3oCbhMoDJ eKZSuZYTXV+MitqNVmbKg1eDdLMVVhIMXgt4wKgHeVVJKsaw9AEtmVeBh EPxLBn/3VNL7OjzZhTKRhPlGZFPC16Owq+p5F4nxn5ybYrDUPdzoArSJI U2RDPJLXLgJvWmchJHi5053E2JxWECFwlxH+oV6V4/2TrmryelMx/cYFE O63sR5oILlAOnH5ekbODXCUNkGIcCXBLb+F5HKYPAPJeYpsHvbDXPrHfG Q==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988473" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 26 Oct 2022 15:16:32 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 26 Oct 2022 15:16:32 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 26 Oct 2022 15:16:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790192; x=1698326192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uD3B1j8AxBWEwgk4/bzdEnH3IBUS1p5ckVASZEy9HSQ=; b=qtmEsX8/qH2EXnLlTpIwKrKrOgC1DZ3uM3SSju+YcoTKgV81NBav9tyt ZWWbw9sLueP6Niakhin9beVoVcazw7AVz/pJLa0B5Z610gajyVagK+s3s LHFrkECj5a/QwNicakJM64TIVDFT6Qa/OQa6On/+SBNkw27+s3yw1SENL TDfpF4wjXxI9d5zYwWqUnSkfZmtYx8vOk6GNA8jmsJQztpjqtZjwrMHoc 0fRhQOy2ii6nTfGyPXmi9iKc0zjVc/3Bq0cTDjeamzWETp13EhQhn3+0S +oxI7nRpFYpiF5HnFM5hxkeGXGP/ZJeEa1SgJ0UKXBNobAjwYx2znZlQ+ g==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988472" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 26 Oct 2022 15:16:32 +0200 Received: from localhost.localdomain (SCHIFFERM-M2.tq-net.de [10.121.49.14]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id C3A53280073; Wed, 26 Oct 2022 15:16:30 +0200 (CEST) From: Matthias Schiffer To: Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, Matthias Schiffer Subject: [RFC 3/5] bluetooth: hci_mrvl: select firmwares to load by match data Date: Wed, 26 Oct 2022 15:15:32 +0200 Message-Id: <8417016ef049fa74a3b2961fdbc91638aebaf3a6.1666786471.git.matthias.schiffer@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747756398246108688?= X-GMAIL-MSGID: =?utf-8?q?1747756398246108688?= Make the driver more generic by adding a driver info struct. We also add support for devices without firmware (for example when the firmware is loaded by the WLAN driver on a combined module). Signed-off-by: Matthias Schiffer --- drivers/bluetooth/hci_mrvl.c | 57 +++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c index fbc3f7c3a5c7..5d191687a34a 100644 --- a/drivers/bluetooth/hci_mrvl.c +++ b/drivers/bluetooth/hci_mrvl.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -33,6 +34,20 @@ enum { STATE_FW_REQ_PENDING, }; +struct mrvl_driver_info { + const char *firmware_helper; + const char *firmware; +}; + +static const struct mrvl_driver_info mrvl_driver_info_8897 = { + .firmware_helper = "mrvl/helper_uart_3000000.bin", + .firmware = "mrvl/uart8897_bt.bin", +}; + +/* Fallback for non-OF instances */ +static const struct mrvl_driver_info *const mrvl_driver_info_default = + &mrvl_driver_info_8897; + struct mrvl_data { struct sk_buff *rx_skb; struct sk_buff_head txq; @@ -44,6 +59,7 @@ struct mrvl_data { struct mrvl_serdev { struct hci_uart hu; + const struct mrvl_driver_info *info; }; struct hci_mrvl_pkt { @@ -353,18 +369,29 @@ static int mrvl_load_firmware(struct hci_dev *hdev, const char *name) static int mrvl_setup(struct hci_uart *hu) { + const struct mrvl_driver_info *info; int err; - hci_uart_set_flow_control(hu, true); + if (hu->serdev) { + struct mrvl_serdev *mrvldev = serdev_device_get_drvdata(hu->serdev); - err = mrvl_load_firmware(hu->hdev, "mrvl/helper_uart_3000000.bin"); - if (err) { - bt_dev_err(hu->hdev, "Unable to download firmware helper"); - return -EINVAL; + info = mrvldev->info; + } else { + info = mrvl_driver_info_default; } - /* Let the final ack go out before switching the baudrate */ - hci_uart_wait_until_sent(hu); + if (info->firmware_helper) { + hci_uart_set_flow_control(hu, true); + + err = mrvl_load_firmware(hu->hdev, info->firmware_helper); + if (err) { + bt_dev_err(hu->hdev, "Unable to download firmware helper"); + return -EINVAL; + } + + /* Let the final ack go out before switching the baudrate */ + hci_uart_wait_until_sent(hu); + } if (hu->serdev) serdev_device_set_baudrate(hu->serdev, 3000000); @@ -373,9 +400,11 @@ static int mrvl_setup(struct hci_uart *hu) hci_uart_set_flow_control(hu, false); - err = mrvl_load_firmware(hu->hdev, "mrvl/uart8897_bt.bin"); - if (err) - return err; + if (info->firmware) { + err = mrvl_load_firmware(hu->hdev, info->firmware); + if (err) + return err; + } return 0; } @@ -401,6 +430,12 @@ static int mrvl_serdev_probe(struct serdev_device *serdev) if (!mrvldev) return -ENOMEM; + if (IS_ENABLED(CONFIG_OF)) { + mrvldev->info = of_device_get_match_data(&serdev->dev); + if (!mrvldev->info) + return -ENODEV; + } + mrvldev->hu.serdev = serdev; serdev_device_set_drvdata(serdev, mrvldev); @@ -416,7 +451,7 @@ static void mrvl_serdev_remove(struct serdev_device *serdev) #ifdef CONFIG_OF static const struct of_device_id mrvl_bluetooth_of_match[] = { - { .compatible = "mrvl,88w8897" }, + { .compatible = "mrvl,88w8897", .data = &mrvl_driver_info_8897 }, { }, }; MODULE_DEVICE_TABLE(of, mrvl_bluetooth_of_match); From patchwork Wed Oct 26 13:15:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 11261 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp263292wru; Wed, 26 Oct 2022 06:19:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mpiqRG0aM2f3SqTXiMIhsTB0SUxlon9arm6wr04Viql8JDYp5OasvV4CSVE7r+ns0Z06i X-Received: by 2002:a17:90a:4311:b0:20b:e232:5920 with SMTP id q17-20020a17090a431100b0020be2325920mr4303226pjg.190.1666790384699; Wed, 26 Oct 2022 06:19:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666790384; cv=none; d=google.com; s=arc-20160816; b=GlIOO410FRKRyQhLdhSPHS3okLmQmZFxfNAwajlQqnPYycwUjgWjoebaWr8sGs1xNh /IivO+eIMyVQYYBhlehWYj98RsmGo4Aqbf0bghoVRJ6Ok/vsI7olyGoJ7igMLeW07i9B i9qwKyMDiMEKNzNyXq5/v3Jx1Q+1IZ/h76kCr9nE9KNReZ/P3SrE4CX8xDl7/8HhTB4i KaTy4mgpazetL9Jgfb3phTe+A0U5Ftz41Rr3JUs9KuGM+UkB1zzNq1baieo3p7e6z4Mu ahit2TgbL1ggq+khtetGzFpMilW7TJ7zEa2TLXVqAQ0zo2PdBnaE/S02Kxl6YurAOR03 Z7Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=SRwTQYbpVvOnRI/9yYdfDenFSOi+/pq0o+qF8j6kob0=; b=JqAGIxfypBL5PIWJgQZ3gBtnlXjFWTQ6Ccp1DA9FUmT7smuB1Naix6qD7e4kWYq/pF yOI2huZo3Stg+PoG/df2QrJYwlNyDCGnFb0O6r1SZJ/lf6jfJ0OLYOLKK2PsF3hqQ/eY B7xsUodNz4r0WinBLb6Ql6UeAAhdndwUoSwj1nWN6+w00DkZR+pku/PMyB2CQ45FBL2Q gUWiV8GKOCkjQaxDnG+dLRFaxCOdRrFrpWB7hxGTZAFQOuOLUaMeKXZ2dKQ1sl9tr5k2 1TB/1AcNZJ0CqsAaAwue3eP7CGSPXt4CucSGmFOSg1/h1VaBqzx7Ei1o0Q6v7VtGjgRO QUUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=HoxWjvyn; dkim=pass header.i=@tq-group.com header.s=key1 header.b=j1X5H7FA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a632052000000b00434dd5dc135si6654309pgm.855.2022.10.26.06.19.30; Wed, 26 Oct 2022 06:19:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=HoxWjvyn; dkim=pass header.i=@tq-group.com header.s=key1 header.b=j1X5H7FA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233160AbiJZNQ7 (ORCPT + 99 others); Wed, 26 Oct 2022 09:16:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233553AbiJZNQj (ORCPT ); Wed, 26 Oct 2022 09:16:39 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 653F2FBCE3; Wed, 26 Oct 2022 06:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790198; x=1698326198; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SRwTQYbpVvOnRI/9yYdfDenFSOi+/pq0o+qF8j6kob0=; b=HoxWjvyny8MdVcXXdvjr6w+tSwgUssAuGosWdy88MS1PDD+YtxuKcvlU FgTZiKAm9liDl/KebIuPbzm780OA0QnLrJj+MQ8CPZaJvw/nPQzzHdyDo 2FgqxaGZuIYhwQ7vYpiYWsO4C2evMkzTWInflFKt9Q7vYc42XvMXvMvTM cAM0oVahNhmHs7VzZMSTKbb4riclWlfEdlwiQ0bsIxx2DZMQYaPNN+w+7 01zosYcTQ20DZFvGUXCBb2DnQydjlIegBwkZozDOA/mgtjcsqnlgpYHI3 XS8jO3IbV4U9KEkgHFKVqSzv03nMkunTZ4HztT9PuZbN7q9wEyYy1eUqt g==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988475" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 26 Oct 2022 15:16:32 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 26 Oct 2022 15:16:32 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 26 Oct 2022 15:16:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790192; x=1698326192; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SRwTQYbpVvOnRI/9yYdfDenFSOi+/pq0o+qF8j6kob0=; b=j1X5H7FAr2SH0mJ26PJql0RcBcn9Vccbb0IRzTX7JzwzWWr6nBCWk/1G slozYqPRIzy0G+OHhTVMVhtDSE7zBtSHUpvTiRbEGXiqRVQ7q/SzG/r89 7JQaAoqIdKppaqxcFppFgobICZWSSA+yeYzsWZrqy95o3bJ2cenJ+BzoW tVoEkVWViuYcq5CHeZgmM7TV6/g/rT3owz/RliOWDSjY2PdlR4dazbsMh FgcQ2Nkb9eNrKEQrbZR1Zco025Sumxkzj//8UdazOofEURhSyH3r9b/Rx LzFQyTtef+4Q1U9F3vRejFr2ZFA980asb9mWoXnGfBmPx+dW+D3Q2L7NN A==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988474" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 26 Oct 2022 15:16:32 +0200 Received: from localhost.localdomain (SCHIFFERM-M2.tq-net.de [10.121.49.14]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id 1F789280056; Wed, 26 Oct 2022 15:16:31 +0200 (CEST) From: Matthias Schiffer To: Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, Matthias Schiffer Subject: [RFC 4/5] bluetooth: hci_mrvl: add support for SD8987 Date: Wed, 26 Oct 2022 15:15:33 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747756394801315380?= X-GMAIL-MSGID: =?utf-8?q?1747756394801315380?= Do not load any firmwares, and instead expect the firmware to be initialized by the WLAN driver. Signed-off-by: Matthias Schiffer --- drivers/bluetooth/hci_mrvl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c index 5d191687a34a..b7d764e6010f 100644 --- a/drivers/bluetooth/hci_mrvl.c +++ b/drivers/bluetooth/hci_mrvl.c @@ -44,6 +44,8 @@ static const struct mrvl_driver_info mrvl_driver_info_8897 = { .firmware = "mrvl/uart8897_bt.bin", }; +static const struct mrvl_driver_info mrvl_driver_info_8987 = {}; + /* Fallback for non-OF instances */ static const struct mrvl_driver_info *const mrvl_driver_info_default = &mrvl_driver_info_8897; @@ -452,6 +454,7 @@ static void mrvl_serdev_remove(struct serdev_device *serdev) #ifdef CONFIG_OF static const struct of_device_id mrvl_bluetooth_of_match[] = { { .compatible = "mrvl,88w8897", .data = &mrvl_driver_info_8897 }, + { .compatible = "marvell,sd8987-bt", .data = &mrvl_driver_info_8987 }, { }, }; MODULE_DEVICE_TABLE(of, mrvl_bluetooth_of_match); From patchwork Wed Oct 26 13:15:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 11262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp263296wru; Wed, 26 Oct 2022 06:19:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7g7IJ5DaBOaDMIw4NhTecWSoAW8Ax44eiAQATEiJxk2VflwkDVoEGPlp/mD/4to1pt3nCW X-Received: by 2002:a63:1f0d:0:b0:464:69f8:1cbc with SMTP id f13-20020a631f0d000000b0046469f81cbcmr38195262pgf.574.1666790385048; Wed, 26 Oct 2022 06:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666790385; cv=none; d=google.com; s=arc-20160816; b=XmuWuV9INwiiLN56QITqqeWO+Xhn57MPSay5e257jxhSQDzx6DtL8zrWo4KG5IP6jK mKS0RJnvwJHLUZgem8p2bgqdwyFZtoFm/0IoutJNMA1n7965E3TKJr1DA7fZEkAMM4Wb Fthg1k/zhmxFYBYFFUP+ikhvdUFO0bzaw9zXqiUBrJujN9qCjzFdAFojdB9x9LPV5jb1 WpUxpCjvSGJ8VzXTJzFB/Yio8hNzkIifpHhSqp/no3uTicCTfd1AKFKUaO7TYp+1MU0y TuTqxNuRB7QHwFuctoPWMV0B2xNNI7/tKWWsD0HrfDPAzFAb6xSSIYSX64OHUqrGUWHi c2dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=AQ8LdJdDckBueGG5Er3mqgTunJL51UlKkWeBI9xQaPo=; b=Y5DuuLmk/F6i3PH8Rs43u4PHy6PkjJkfTcjKR7A6cT4WixsILVoMZCi5UHqXr7XXTe VRz9Ui2UHymupc594bAc38a6ugCCGNbQTlZ09+bJg9RG18ccKGQOYqf5TAmoJGfg41dH Ac+GEOWXDIQSeZknptbZykfNBSTJbj3HN1jBccS4PASTcNBoplS9fUM08I0cTEF/DE1b WF+6XTBgWzjYa/XI4sHUl2MAOlmKP+JUjVgw3QHiEQGi9zC1kjYmfLE6zf6wuN/8GSgB 4h8PVvqx2Icg6gNYX4D9yifWS4D6h8yRv76bUDTw7dPoIa3cc53z83xVijPuqCpeEp9W qVSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=HbIMkZp2; dkim=pass header.i=@tq-group.com header.s=key1 header.b=IZJ5D2z0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r3-20020a17090a438300b0020fadac08a2si2386402pjg.108.2022.10.26.06.19.30; Wed, 26 Oct 2022 06:19:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=HbIMkZp2; dkim=pass header.i=@tq-group.com header.s=key1 header.b=IZJ5D2z0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233635AbiJZNRE (ORCPT + 99 others); Wed, 26 Oct 2022 09:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233773AbiJZNQj (ORCPT ); Wed, 26 Oct 2022 09:16:39 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD51F87085; Wed, 26 Oct 2022 06:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790198; x=1698326198; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AQ8LdJdDckBueGG5Er3mqgTunJL51UlKkWeBI9xQaPo=; b=HbIMkZp2KQJcQVlQ0Pn8Rb57+XdijlvGGZBVFdyJIqaUR2jA7CI7w5Zi PPoF44RIe1qYK5IVNT/jF3HfLXVNpPFjQF2x7cvTtjCuqiux25O0IpQDQ sHkBkoNxGsJhpTJUADbNTf4Mh5f5v/jOnHgIT4WVT/2BsQT8ahwyuOeSc 7Q1xLCyg/1vnDuD6AvFfn8J+sk/7WOzP4i0wvhEGGaMlQcd/OrVmMerXG aTASRtuOQwUMSIzQnAK0AfWHBNBjO863jgxs8wObYFdKD7yPfqbHjByQJ M/J3aohSCQVaSRf46pJl/FSE5xqt5JFlifct/1D8KSlXm/2YMxnMsSuCv A==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988477" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 26 Oct 2022 15:16:32 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 26 Oct 2022 15:16:32 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 26 Oct 2022 15:16:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1666790193; x=1698326193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AQ8LdJdDckBueGG5Er3mqgTunJL51UlKkWeBI9xQaPo=; b=IZJ5D2z0IFL2KfFH0KlWWd6DscaAybMlc+Xfp/WLHFG06VCHJWaGD0f9 N/E+eXFVu8JdwIVL+e10Zgc1DqIO4gyJG058StZpr+KPW+wy+R7/K7C3y 3IxHQVJo9eDn6IoWveWT1XpGtqVtzmKBSL8S3a4iXYD/nC9fkCh7QZPDP gqsBFKtgfFC++Jdw4Ga0fBan0UxpDmtMKJKywfsbdQlF+LLLW0oQh8yrH ah4Ot4sq9viLDrpE+UkF1Xs8eX/ZXIPsf+1TCe9THdlZ/3Rd5HWYJdSlh WNYtKOPNgz7DNXOORhThSPVsJDM8Ys4s/IwQrnAF0TxHbxOPHgaRu8P4X Q==; X-IronPort-AV: E=Sophos;i="5.95,214,1661810400"; d="scan'208";a="26988476" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 26 Oct 2022 15:16:32 +0200 Received: from localhost.localdomain (SCHIFFERM-M2.tq-net.de [10.121.49.14]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id 78F70280072; Wed, 26 Oct 2022 15:16:31 +0200 (CEST) From: Matthias Schiffer To: Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski Cc: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, Matthias Schiffer Subject: [RFC 5/5] bluetooth: hci_mrvl: allow waiting for firmware load using notify-device Date: Wed, 26 Oct 2022 15:15:34 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747756394711078826?= X-GMAIL-MSGID: =?utf-8?q?1747756394711078826?= Signed-off-by: Matthias Schiffer --- drivers/bluetooth/hci_mrvl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c index b7d764e6010f..dc55053574a9 100644 --- a/drivers/bluetooth/hci_mrvl.c +++ b/drivers/bluetooth/hci_mrvl.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -433,9 +434,25 @@ static int mrvl_serdev_probe(struct serdev_device *serdev) return -ENOMEM; if (IS_ENABLED(CONFIG_OF)) { + struct device_node *firmware_ready_node; + struct device *firmware_ready; + mrvldev->info = of_device_get_match_data(&serdev->dev); if (!mrvldev->info) return -ENODEV; + + firmware_ready_node = of_parse_phandle(serdev->dev.of_node, + "firmware-ready", 0); + if (firmware_ready_node) { + firmware_ready = + notify_device_find_by_of_node(firmware_ready_node); + if (!firmware_ready) + return -EPROBE_DEFER; + if (IS_ERR(firmware_ready)) + return PTR_ERR(firmware_ready); + put_device(firmware_ready); + } + } mrvldev->hu.serdev = serdev;