From patchwork Mon Apr 24 18:48:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 87141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2942786vqo; Mon, 24 Apr 2023 11:50:34 -0700 (PDT) X-Google-Smtp-Source: AKy350byil8OzaOTgOObYJQhOfa3kksO6Pz02Gt7AjEWs5NTgs1wN7oJMDJ4enClSWYg4tF8lMJP X-Received: by 2002:a05:6a20:7d8e:b0:f2:6eeb:211b with SMTP id v14-20020a056a207d8e00b000f26eeb211bmr16052070pzj.37.1682362234356; Mon, 24 Apr 2023 11:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682362234; cv=none; d=google.com; s=arc-20160816; b=z67hcukUWSfiHP06FYBpMAD9l6xeqoQz48rHWusjiWZ6rQn4DMVroQ63lSySh3e3pR 9jKh2ua86rW3a4OvC5JRUvPnXnTSyVPPpre/kqNqH7io0YzXgploR+TbkaVlsvpjZXYl JeIHunEc/JODMsV1YRjkZvIFdyfpuMH2q1m6dZcyk8Vv5qJzlLvQt2zl7C0Z3JMIEfI9 8m5aArZw0XIBnurwJcNgMlVmq0mDmwkUd5CAQz/ExJOlfgrhCZuV9gnU0U4Kh4fyYuNd yDoW66VoLewsqJhCl2y0S0gzsZgcRE/y6StpFYJAtVnwx5YAs6B1ivfOiRvdXnm0mhp3 Wy3A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=nJ7qevk+C4BYIH4h8NNDIO9iDNa/BpFJKBXbdR/B8pM=; b=ZOCVs+uXvDekSJjMEC57m3I9vXTvRqCPW5I2fdlmORWcSI3HpxQTc7OXyvzrol8qNi 6KMQPuLy62OcKKOi+gKa8dE2uMDwju71BW/4qBv9x3TRB0TiL3gvjRfCl4beFe7qk9Nx lym9BqX3cdUj5biHRJ3ZVXKKIGHoBHxxZplt9AtmqIOnTykV3SrPpk5KMv+CbJzbj5HL tCnlojFRAEGJDAnXX+hQHx8yHWpTTLANkJaddP27A3qjUx3rbynwN5afNmdjf523Y3VW sffngF/UwchLauBITXFIE4pl9bpFnDq9RLtuMTa/xwuucvI96NBlI3Ya/UphUfgVDvT9 sL7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=h6YnzudS; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t1-20020aa79461000000b0063d24bf827fsi11642101pfq.147.2023.04.24.11.50.21; Mon, 24 Apr 2023 11:50:34 -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=@ti.com header.s=ti-com-17Q1 header.b=h6YnzudS; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232458AbjDXStS (ORCPT + 99 others); Mon, 24 Apr 2023 14:49:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbjDXSsi (ORCPT ); Mon, 24 Apr 2023 14:48:38 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17FBD5B90; Mon, 24 Apr 2023 11:48:19 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 33OImBtW087511; Mon, 24 Apr 2023 13:48:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1682362091; bh=nJ7qevk+C4BYIH4h8NNDIO9iDNa/BpFJKBXbdR/B8pM=; h=From:To:CC:Subject:Date; b=h6YnzudSLEr1WSvZZH9nbV+6lPeTcHOyNaZvIABBm7BAUWcvGHxbc7bASclsv+uMZ 6JF048qSpi+Fe8bXclHPMm2T9Nhys4FR9K4g2uhr7/2ti/teNX4MD9aYTX4nI7WmR8 WiV0Dr11Pw0Sj79ApwmiqXou9/VF8+vU9LDJbgn8= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 33OImBgQ012258 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 24 Apr 2023 13:48:11 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Mon, 24 Apr 2023 13:48:11 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Mon, 24 Apr 2023 13:48:11 -0500 Received: from ula0226330.dal.design.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 33OImAW5074270; Mon, 24 Apr 2023 13:48:10 -0500 From: Andrew Davis To: Peter Rosin , Rob Herring , Krzysztof Kozlowski , Nishanth Menon , Vignesh Raghavendra CC: , , Andrew Davis Subject: [RFC] mux: mmio: use reg property when parent device is not a syscon Date: Mon, 24 Apr 2023 13:48:10 -0500 Message-ID: <20230424184810.29453-1-afd@ti.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764084661804079646?= X-GMAIL-MSGID: =?utf-8?q?1764084661804079646?= The DT binding for the reg-mux compatible states it can be used when the "parent device of mux controller is not syscon device". It also allows for a reg property. When the parent device is indeed not a syscon device, nor is it a regmap provider, we should fallback to using that reg property to identify the address space to use for this mux. Signed-off-by: Andrew Davis --- drivers/mux/mmio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c index 44a7a0e885b8..42e00b9fd0a9 100644 --- a/drivers/mux/mmio.c +++ b/drivers/mux/mmio.c @@ -44,10 +44,13 @@ static int mux_mmio_probe(struct platform_device *pdev) int ret; int i; - if (of_device_is_compatible(np, "mmio-mux")) + if (of_device_is_compatible(np, "mmio-mux")) { regmap = syscon_node_to_regmap(np->parent); - else - regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV); + } else { + regmap = dev_get_regmap(dev->parent, NULL); + if (!regmap) + regmap = device_node_to_regmap(np) ?: ERR_PTR(-ENODEV); + } if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); dev_err(dev, "failed to get regmap: %d\n", ret);