Message ID | 1ce5f56df546cec25ef741f381286f1d7c33d000.1689802933.git.daniel@makrotopia.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2743914vqt; Wed, 19 Jul 2023 15:27:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlF2xJe/BCRq9o86hqUQDk9rkfYlszq0eKOQrn43BkdMjf1bd5uaYcSUP95LLdyiryfuL4Mh X-Received: by 2002:a05:6402:1283:b0:51d:e1cf:dc8a with SMTP id w3-20020a056402128300b0051de1cfdc8amr463996edv.22.1689805634799; Wed, 19 Jul 2023 15:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689805634; cv=none; d=google.com; s=arc-20160816; b=K/2W2W3/3lcNBxWxD7cRjSEKZ5H8yUqsyq+T6WUSmO7q8XMRBepeHH35i1nZfBT8ke MGguj8RGl6jiF/I3jI34QQwit/cJ8QDHwJJ8CeZzF2KYhYsChlkWak/Vi3ISOgQZ2Srs PF7xeh8A2RMSsh4Ka4+L2Sv6B5xGuQsjYn2nSFKliX4kNvtbTjstOXLngkBzMeQkwDOZ BcHuqxfpN9B2/nIvVIavVSCeL27LFOxPe03L0rR4piYJdWZfbQjqzIIrL8ZYiclDiazY YocvJfhwxkJG3tmT04TmeTtC0dZzthh2T6WanU3x06XaiCyZm9QiybEppWWIreqYT1WT b+ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date; bh=tXYT4uAYKkmC7cZff6dBIrrvsJsYT9JZconVxKgdMQ0=; fh=O/hjEvlM0nIN8LC6WbIQ4s0L6nmnRMOzajXXMF81As0=; b=oCRucd+de//4wafo4N5pFCkSbYhQcUofS1kVYxfHWXZu+C2GI4ixomCHgR3yJng8ko NqQTbe0AXrJanAm5dHClJYx5shtAaYdiZbDCui+ISZOa6DhmGtDvW2QKMMDN1laY2Dsu YUqrzCAo2AphOFQSS75/2lWj5ZQAMtOIkvo51mOdXMzmCNt5p8hYlVF9GOaxGQsqNiH7 VzESJeDnWMRv2cEnhV2Aff1JEqB/LjWcDkqrCkHGsR52W2eY9fO3KN47iEbBQpFP1E+/ 93lnaQ6KGCQZ1tjSbO2ehSPNWwh5Q1LgwBJPbcw+xmH1GbTJVjD2MiaFNhKCfYE9e143 yrKA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u19-20020aa7d893000000b00521d23adb1asi802808edq.258.2023.07.19.15.26.51; Wed, 19 Jul 2023 15:27:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbjGSWD1 (ORCPT <rfc822;daweilics@gmail.com> + 99 others); Wed, 19 Jul 2023 18:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbjGSWDY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 19 Jul 2023 18:03:24 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88BDA2122; Wed, 19 Jul 2023 15:03:19 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from <daniel@makrotopia.org>) id 1qMFG1-0008Ji-2q; Wed, 19 Jul 2023 22:02:53 +0000 Date: Wed, 19 Jul 2023 23:02:45 +0100 From: Daniel Golle <daniel@makrotopia.org> To: Jens Axboe <axboe@kernel.dk>, Ulf Hansson <ulf.hansson@linaro.org>, Miquel Raynal <miquel.raynal@bootlin.com>, Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>, Dave Chinner <dchinner@redhat.com>, Matthew Wilcox <willy@infradead.org>, Thomas =?iso-8859-1?q?Wei=DFschuh?= <linux@weissschuh.net>, Jan Kara <jack@suse.cz>, Daniel Golle <daniel@makrotopia.org>, Damien Le Moal <dlemoal@kernel.org>, Ming Lei <ming.lei@redhat.com>, Min Li <min15.li@samsung.com>, Christian Loehle <CLoehle@hyperstone.com>, Adrian Hunter <adrian.hunter@intel.com>, Hannes Reinecke <hare@suse.de>, Jack Wang <jinpu.wang@ionos.com>, Florian Fainelli <f.fainelli@gmail.com>, Yeqi Fu <asuk4.q@gmail.com>, Avri Altman <avri.altman@wdc.com>, Hans de Goede <hdegoede@redhat.com>, Ye Bin <yebin10@huawei.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, =?utf-8?b?UmFmYcWCIE1pxYJl?= =?utf-8?b?Y2tp?= <rafal@milecki.pl>, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [RFC PATCH 2/6] mmc: block: set fwnode of disk devices Message-ID: <1ce5f56df546cec25ef741f381286f1d7c33d000.1689802933.git.daniel@makrotopia.org> References: <cover.1689802933.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <cover.1689802933.git.daniel@makrotopia.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771889633452101286 X-GMAIL-MSGID: 1771889633452101286 |
Series |
nvmem: add block device NVMEM provider
|
|
Commit Message
Daniel Golle
July 19, 2023, 10:02 p.m. UTC
Set fwnode of disk devices to 'block', 'boot0' and 'boot1' subnodes of
the mmc-card. This is done in preparation for having the eMMC act as
NVMEM provider.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/mmc/core/block.c | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
On Thu, 20 Jul 2023 at 00:02, Daniel Golle <daniel@makrotopia.org> wrote: > > Set fwnode of disk devices to 'block', 'boot0' and 'boot1' subnodes of > the mmc-card. This is done in preparation for having the eMMC act as > NVMEM provider. Sorry, but I don't quite understand what you are trying to do here. Maybe you should re-order the patches in the series so it becomes clear why this is needed? Moreover, I don't see any DT docs being updated as a part of the series, which looks like it is needed too. That would also help to understand what you are proposing, I think. > > Signed-off-by: Daniel Golle <daniel@makrotopia.org> > --- > drivers/mmc/core/block.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > index f701efb1fa785..fc1a9f31bd253 100644 > --- a/drivers/mmc/core/block.c > +++ b/drivers/mmc/core/block.c > @@ -2413,6 +2413,8 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, > int area_type, > unsigned int part_type) > { > + struct fwnode_handle *fwnode; > + struct device *ddev; > struct mmc_blk_data *md; > int devidx, ret; > char cap_str[10]; > @@ -2509,6 +2511,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, > > blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled); > > + ddev = disk_to_dev(md->disk); > + fwnode = device_get_named_child_node(subname ? md->parent->parent : > + md->parent, > + subname ? subname : "block"); > + ddev->fwnode = fwnode; > + > string_get_size((u64)size, 512, STRING_UNITS_2, > cap_str, sizeof(cap_str)); > pr_info("%s: %s %s %s%s\n", Kind regards Uffe
Hi Ulf, thank you for reviewing and suggesting ways to improve this series! On Mon, Aug 07, 2023 at 03:48:31PM +0200, Ulf Hansson wrote: > On Thu, 20 Jul 2023 at 00:02, Daniel Golle <daniel@makrotopia.org> wrote: > > > > Set fwnode of disk devices to 'block', 'boot0' and 'boot1' subnodes of > > the mmc-card. This is done in preparation for having the eMMC act as > > NVMEM provider. > > Sorry, but I don't quite understand what you are trying to do here. > Maybe you should re-order the patches in the series so it becomes > clear why this is needed? > > Moreover, I don't see any DT docs being updated as a part of the > series, which looks like it is needed too. That would also help to > understand what you are proposing, I think. I've prepared a tree on Github which now also includes commits adding dt-bindings for block devices and partitions, so they can be referenced as nvmem-cells provider. The dt-schema addition supposedly explaining this specific patch: https://github.com/dangowrt/linux/commit/b399a758f0e1c444ae9443dc80902a30de54af09 The whole tree: https://github.com/dangowrt/linux/commits/for-nvmem-next Most comments have been addressed, however, I still depend on using either a class_interface *or* adding calls to add/remove the NVMEM representation of a block device to block/genhd.c as well as block/partitions/core.c, simply because afaik there isn't any better way for in-kernel users of block devices to be notified about the creation or removal of a block device. Cheers Daniel > > > > > Signed-off-by: Daniel Golle <daniel@makrotopia.org> > > --- > > drivers/mmc/core/block.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > > index f701efb1fa785..fc1a9f31bd253 100644 > > --- a/drivers/mmc/core/block.c > > +++ b/drivers/mmc/core/block.c > > @@ -2413,6 +2413,8 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, > > int area_type, > > unsigned int part_type) > > { > > + struct fwnode_handle *fwnode; > > + struct device *ddev; > > struct mmc_blk_data *md; > > int devidx, ret; > > char cap_str[10]; > > @@ -2509,6 +2511,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, > > > > blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled); > > > > + ddev = disk_to_dev(md->disk); > > + fwnode = device_get_named_child_node(subname ? md->parent->parent : > > + md->parent, > > + subname ? subname : "block"); > > + ddev->fwnode = fwnode; > > + > > string_get_size((u64)size, 512, STRING_UNITS_2, > > cap_str, sizeof(cap_str)); > > pr_info("%s: %s %s %s%s\n", > > Kind regards > Uffe
On Tue, 8 Aug 2023 at 03:02, Daniel Golle <daniel@makrotopia.org> wrote: > > Hi Ulf, > > thank you for reviewing and suggesting ways to improve this series! > > On Mon, Aug 07, 2023 at 03:48:31PM +0200, Ulf Hansson wrote: > > On Thu, 20 Jul 2023 at 00:02, Daniel Golle <daniel@makrotopia.org> wrote: > > > > > > Set fwnode of disk devices to 'block', 'boot0' and 'boot1' subnodes of > > > the mmc-card. This is done in preparation for having the eMMC act as > > > NVMEM provider. > > > > Sorry, but I don't quite understand what you are trying to do here. > > Maybe you should re-order the patches in the series so it becomes > > clear why this is needed? > > > > Moreover, I don't see any DT docs being updated as a part of the > > series, which looks like it is needed too. That would also help to > > understand what you are proposing, I think. > > I've prepared a tree on Github which now also includes commits adding > dt-bindings for block devices and partitions, so they can be referenced > as nvmem-cells provider. > > The dt-schema addition supposedly explaining this specific patch: > > https://github.com/dangowrt/linux/commit/b399a758f0e1c444ae9443dc80902a30de54af09 > > The whole tree: > > https://github.com/dangowrt/linux/commits/for-nvmem-next Thanks for sharing. However, allow people to review, I suggest you post a new version with the updated DT bindings included. The point is, we really need confirmation from the DT maintainers - otherwise this is simply a no go. > > Most comments have been addressed, however, I still depend on using > either a class_interface *or* adding calls to add/remove the NVMEM > representation of a block device to block/genhd.c as well as > block/partitions/core.c, simply because afaik there isn't any better > way for in-kernel users of block devices to be notified about the > creation or removal of a block device. Okay, so that needs further discussions then. I will try to chim in. [...] Kind regards Uffe
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index f701efb1fa785..fc1a9f31bd253 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2413,6 +2413,8 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, int area_type, unsigned int part_type) { + struct fwnode_handle *fwnode; + struct device *ddev; struct mmc_blk_data *md; int devidx, ret; char cap_str[10]; @@ -2509,6 +2511,12 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled); + ddev = disk_to_dev(md->disk); + fwnode = device_get_named_child_node(subname ? md->parent->parent : + md->parent, + subname ? subname : "block"); + ddev->fwnode = fwnode; + string_get_size((u64)size, 512, STRING_UNITS_2, cap_str, sizeof(cap_str)); pr_info("%s: %s %s %s%s\n",