Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5844200rwd; Mon, 5 Jun 2023 09:15:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7hTX9TJEbqbFC5hIjPJpgPySBUE8g9QwvP3084Jj4iAsA8ZdhWvv7FQMAdp6xBQRCILdEs X-Received: by 2002:a05:6a20:4413:b0:114:df29:2afe with SMTP id ce19-20020a056a20441300b00114df292afemr2872075pzb.31.1685981726967; Mon, 05 Jun 2023 09:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685981726; cv=none; d=google.com; s=arc-20160816; b=NiMfoO4tSpxJ3lrCInt5UEYopngccrehDjJMIH+qrQR02NPcBqKV04G5MHCFSrEygY DLMcYx4GGc6bK/A1F+sW2vUovQT1AM2x8neFlh2Db1xE67Fza1uD/vyCXYFTEEWxmtEq cIASiX149u01EBPHFY6MaXMSwXgoyAq21eeXDXVAxPVYRZuoe3Zspw9RDV4PLNT26kMc /lRETIe/4ioMZSIM1O0kid2/PFzoSmEnGPUe/vsyE6MVYOdjYyrfc7ApbI2h2Nvn8TdX 8ge1Y4PjVz+JzZYdYvzrnB6Q4QIgVWJ4oZKE+0NGJWa/6wPR5YWbsUdoMB3tY1mmkHG0 5a+Q== 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=HjEcBUVjbxkbYiUd1LgJcsytc2FQoxDy06rDLkSoTR0=; b=O5gI6hf91F0oqVuk8gKkitO/j9/P2REoTALpP/i/4vvpnA2eifIYew6+TXxlc6VRAM n47D+tIKRNiWbE3WmXtdzQYl6WkEFUQXA3M5A2QIr9oS+NHor24LS0SHCx8XcLYe7DFp te4NsR1Qdxrehc0bFYWhWApkjhuis+sFXt8NfKwPArfMcpqSwKmaZihaxydUUzhGRYMs +5UiFsJGwirPNCzTL9EqaQTYSAITnRy+NaSRoRNXsOI0lKY1apnd2zNeux3RgIOog9T5 lfCu1WQLoduAw/+iftJq+Wq5dI0NFDyu89KipyoPbhNrxud01Wzf7GW1iAgoipOJlSmg DBbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=mdymu2SD; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k69-20020a638448000000b00542b9f14ca7si4827698pgd.24.2023.06.05.09.15.14; Mon, 05 Jun 2023 09:15:26 -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=mdymu2SD; 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 S235038AbjFEPnz (ORCPT + 99 others); Mon, 5 Jun 2023 11:43:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234103AbjFEPni (ORCPT ); Mon, 5 Jun 2023 11:43:38 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 308A610B; Mon, 5 Jun 2023 08:43:21 -0700 (PDT) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 355FfuCl106973; Mon, 5 Jun 2023 10:41:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1685979716; bh=HjEcBUVjbxkbYiUd1LgJcsytc2FQoxDy06rDLkSoTR0=; h=From:To:CC:Subject:Date; b=mdymu2SDxfrHihB9qUDr6xXpnwX8xYOEs+v7DAQloQCrxjqTFy6XKZzVl0Qm9VEoM hxb9xBDBuEuNvCU9xm2ej4KRCeTooJYH83Xq0afEVaHgdE6QPkbpz3lYH9un0Ia5wc xv5/IrsFynuPPzDX4pdqLB2j81siQdlHF368Ypoc= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 355Fftks050184 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 5 Jun 2023 10:41:55 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 5 Jun 2023 10:41:55 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 5 Jun 2023 10:41:55 -0500 Received: from fllv0039.itg.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 355FftpW005937; Mon, 5 Jun 2023 10:41:55 -0500 From: Andrew Davis To: Peter Rosin , Rob Herring , Krzysztof Kozlowski , Nishanth Menon , Vignesh Raghavendra CC: , , Andrew Davis Subject: [PATCH v2] mux: mmio: use reg property when parent device is not a syscon Date: Mon, 5 Jun 2023 10:41:53 -0500 Message-ID: <20230605154153.24025-1-afd@ti.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 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 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 reg property is provided, use that to identify the address space for this mux. If not provided fallback to using the parent device as a regmap provider. Signed-off-by: Andrew Davis --- Changes from v1: - Flip logic as suggested in v1[0] [0] https://lore.kernel.org/lkml/1c27d9d4-b1cc-c158-90f7-f7e47e02c424@ti.com/T/ 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 44a7a0e885b8d..2c9e4df9d6f2c 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 = device_node_to_regmap(np); + if (IS_ERR(regmap)) + regmap = dev_get_regmap(dev->parent, NULL) ?: ERR_PTR(-ENODEV); + } if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); dev_err(dev, "failed to get regmap: %d\n", ret); -- 2.39.2