Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1801369ioo; Mon, 23 May 2022 03:44:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZdasnAGDjuMQTBItSM+okul1XkU6RProUaMDOmMqFjCwuUJ+TyoEIhvMHxxpv7ej2mVn3 X-Received: by 2002:a17:90b:1c8f:b0:1b8:c6dc:ca61 with SMTP id oo15-20020a17090b1c8f00b001b8c6dcca61mr25514681pjb.13.1653302690194; Mon, 23 May 2022 03:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653302690; cv=none; d=google.com; s=arc-20160816; b=HnSoeF/aJYFWaLeB8OgIzUt+deeFFFzjMBXVQnSjh/CuKZoLKj+TJPzwxs3JYh0M19 M2yjAP6ExuOyrIGsLVxjTt3q/NTvqbEBfxzHtognOvY013Vw7DpYHKpsw/eqb9lEHG4H L3Yfcg2FHCVwRyZ2kWP/JfQoSfTSPMuSKp7J+tLNYvWKxlVSA/RtsJ/8quZ6Rz4wNjGF P5ntEIZRpBpurK0lnkaxysqdNp6CYtVc6joU7I85kmd/k4ElksRRVotvxnyanqk1d7kK q5NVaNMoMuthT3Z1SSgjRdQPHCEPiMtaqFh/O5/vZfecX4Sjmax1ItXv6Ri1ZJWtxjzp L/Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=19O1GUcZX5xzUP6s6+RY1x3SMu7x/mWLKsdRZHBs87w=; b=ELMwVJdVinBAZ8e2Fo9YJ/1EerBECllAT37lXaKjxB5AxMQw/1/LhKuXlPi6ProoiR sCkbFfAQyEP4T6oCnRv3SM8qWt2sq4IrHb9rD1qCN9o9aiRY9NPPh0nNeJXt4UDUkdAs MMvOKrcz8Wbnn6HSyYBFvmmO7ID247df7fpHSPCnp81WiDKFA+1++2lW8cfwO4r77Mts Y/r0OOxGU/gGgBGOPFHHl1PexwysRmqhSRlXjuEfky1RwFYkitJmhELYsFz1FIzOKl6F ZR7ld/ZM9QY5ZG1EWFjIVLjnKZ35QurXYyUpdb7XS9c6RiWTVOns8+uUKYBUNAbJPogV xPEw== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y7-20020a655287000000b003f9caa609a6si10140886pgp.399.2022.05.23.03.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 03:44:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B745E35ABB; Mon, 23 May 2022 03:44:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234253AbiEWKol (ORCPT + 99 others); Mon, 23 May 2022 06:44:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234236AbiEWKoj (ORCPT ); Mon, 23 May 2022 06:44:39 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B64F21833; Mon, 23 May 2022 03:44:36 -0700 (PDT) Received: from mail-yb1-f172.google.com ([209.85.219.172]) by mrelayeu.kundenserver.de (mreue012 [213.165.67.97]) with ESMTPSA (Nemesis) id 1M2gt5-1nrAXl1qU3-004EAy; Mon, 23 May 2022 12:44:34 +0200 Received: by mail-yb1-f172.google.com with SMTP id v71so24625779ybi.4; Mon, 23 May 2022 03:44:33 -0700 (PDT) X-Gm-Message-State: AOAM530qeCxaHCmTmie4hv7Wx8oD2I4W6nmutjXgFkxho8NzdLnMdAjk LrMYbxgRZCF4bwL8p6q5muFE7gCnVGMfCCzTnEk= X-Received: by 2002:a81:6283:0:b0:2ff:2443:6f3c with SMTP id w125-20020a816283000000b002ff24436f3cmr22577090ywb.135.1653302662526; Mon, 23 May 2022 03:44:22 -0700 (PDT) MIME-Version: 1.0 References: <20220522155046.260146-1-tmaimon77@gmail.com> <20220522155046.260146-13-tmaimon77@gmail.com> In-Reply-To: <20220522155046.260146-13-tmaimon77@gmail.com> From: Arnd Bergmann Date: Mon, 23 May 2022 12:44:06 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 12/19] reset: npcm: Add NPCM8XX support To: Tomer Maimon Cc: Avi Fishman , Tali Perry , Joel Stanley , Patrick Venture , Nancy Yuen , Benjamin Fair , Rob Herring , Krzysztof Kozlowski , Michael Turquette , Stephen Boyd , Philipp Zabel , gregkh , Daniel Lezcano , Thomas Gleixner , Wim Van Sebroeck , Guenter Roeck , Catalin Marinas , Will Deacon , Arnd Bergmann , Olof Johansson , Jiri Slaby , Shawn Guo , Bjorn Andersson , Geert Uytterhoeven , Marcel Ziswiler , Vinod Koul , Biju Das , Nobuhiro Iwamatsu , robert.hancock@calian.com, "nathan=20Neusch=C3=A4fer?=" , Lubomir Rintel , SoC Team , DTML , Linux Kernel Mailing List , linux-clk , "open list:SERIAL DRIVERS" , LINUXWATCHDOG , Linux ARM Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:YHq8xzHHHcsfvYjSzSq+E07jIVbAebTZh9CDYUzTJWXfz/CNC4d DH5SoIfeUq+NJ0Nc8rFHY/R3FL/QCnVF1C9T2g2LIt3h7UY5J4dV1QADFb/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M= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Sun, May 22, 2022 at 5:50 PM Tomer Maimon wrote: > static const struct of_device_id npcm_rc_match[] = { > { .compatible = "nuvoton,npcm750-reset"}, > + { .compatible = "nuvoton,npcm845-reset"}, > { } > }; > +/* > + * The following procedure should be observed in USB PHY, USB device and > + * USB host initialization at BMC boot > + */ > +static int npcm_usb_reset(struct platform_device *pdev, struct npcm_rc_data *rc) > +{ > + struct device_node *np = pdev->dev.of_node; > + struct device *dev = &pdev->dev; > + > + rc->gcr_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon"); > + if (IS_ERR(rc->gcr_regmap)) { > + dev_err(&pdev->dev, "Failed to find gcr syscon"); > + return PTR_ERR(rc->gcr_regmap); > + } > + > + if (of_device_is_compatible(np, "nuvoton,npcm750-reset")) > + npcm_usb_reset_npcm7xx(rc); > + else if (of_device_is_compatible(np, "nuvoton,npcm845-reset")) > + npcm_usb_reset_npcm8xx(rc); > + else > + return -ENODEV; > In place of the string comparison in of_device_is_compatible(), maybe just use the .data field of the of_device_id structure to point to the actual reset function. Alternatively, register two separate platform_driver instances here and use separate probe functions that do the soc specific bits and call into shared functions for the bits that are the same. Arnd