Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1606524ybk; Sat, 16 May 2020 17:13:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs4OLYOKPdZTZKnlNO5jfC8QGxxrox6dl6bAUB9U45n5V5mFEg40oPJmCNzpIBVrl+ya/O X-Received: by 2002:a17:906:398:: with SMTP id b24mr3470111eja.44.1589674404825; Sat, 16 May 2020 17:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589674404; cv=none; d=google.com; s=arc-20160816; b=V3lnVPldFji3ln3S0j9XzSUUux9en/qoGVOxaDlq3OjCWBoapMrGbCPm7fn1Y95gfV NsoV6HqbvU8NlG4YN0jSJMbGicvfi3gIEFzLplovfSaxMFIXWC63pYjm3K+Ecz4Hzt+X qggVFUgYuMWV8HS1Dx0kTwfuYkYWCf8J9kMN9Bh1IOCc7lGH7+/w30YPZP8Sok/8STaf BNkCKc3voi0iYAdvn700GJAkVk6DUIkFkppWM7N/GV0xTX7SGj/AOvIaxES81xtJ11tZ EnZJLN156thKaZzopCQeD2rJw3SBg5md7sksm10vmNKtop3jLv7PK+uuH/9D6rRJUjz5 ELPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4yK6XL3gt0+XVfQIVvQaBK6umA0G1wGRMLl2rxzntKg=; b=lVV7Oc/UvzZfyJT90Tg8HuT9Ofwk5eyZXDPwokR1OCvo+1rx4bPVn2XgKkN3pcPZWk eKGnIZkD8sLpQaUPUbUpfgxLn1Wj0/0UBQmLUYoXz5n8HkEi2XOu9YyeBAhAHcFyM4wX 1u7RzIskG01cpqe1zqAuST8jRqRZI77AOH9kFzd5vMh1V3CYfIH572PFYzwnPFY6nKOw cZCnBf4Ijg+jzzQYtJKskrr8mdRzFx+GylLGHkq+K0BKWvilCgiW3YNpmvXS3hLQ5clj n57WnI6lSQL92rsoH3zK2pms9cAGSGoxDyi93yY34EOfkiY4YEk09eW2CYQ0hWv5FqzQ 90EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Rw+x68Gk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si3944232edp.57.2020.05.16.17.13.02; Sat, 16 May 2020 17:13:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Rw+x68Gk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726936AbgEQAIn (ORCPT + 99 others); Sat, 16 May 2020 20:08:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726670AbgEQAIn (ORCPT ); Sat, 16 May 2020 20:08:43 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2ED6C061A0C for ; Sat, 16 May 2020 17:08:42 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id d21so6040663ljg.9 for ; Sat, 16 May 2020 17:08:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4yK6XL3gt0+XVfQIVvQaBK6umA0G1wGRMLl2rxzntKg=; b=Rw+x68Gk2KHU/UctJ+dNo0cpBoS4UMhrSzyEuXKw25+eRMQAb/NP5+GLUgjybkerCH k9g+onaYPAPx6egNYmUxxirOqXwmrxhmfnqvAJkSNcXht0YVhyfjknDGCQctTBgdPAp/ duJ1rTm3sqMfmljfgQ1fWA6b+eboSCUlXo8dTs+mS2vms5wN8UsPwDmpmrffD3WaORrP mC8QKOXD89xXzoNUvTuWDG/f8Xu6NBHV2rVbabL2RbFeChVid39qXqXM71F5HUrSh5vF shTxhe6nwUyx/VeAVZSnSlnQhUW5AzMsS4SYxSzdBxKHEXYBFeEF9531ewGCm5nlXuaM xmEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4yK6XL3gt0+XVfQIVvQaBK6umA0G1wGRMLl2rxzntKg=; b=Dthc/ZeVVZR+uJcn45L+OAFvT6DPSIWpiqKxyohhXgWRpILVtVjw3eTH20tYZq8MrF Nypj2fiZop7miyffVm/vRLcEefKHhRMPs6ysOdNFwCjE+j2akVHsxJhmySUlXZXqkZ4f 3RTkj1qDiBf/fWNSRkuHAL7IzXeZZHGb9oBQ6IPARWs0ectT75nVehQkd3ZWxcdJXKgL BVqrIbzpnxJfyyAiettul/YYN2KakyA0+dg5f4UFzeLpxyvToWASAtwMxK0+CmnJyRXE mtV+i/NOFrDA6nhEi2MPA2Zr+pg4QBcKT2burUBlC/SNoVPWqPBtIKOe3YsMGLxHk1om B7lg== X-Gm-Message-State: AOAM532+i/RgG1WdLsScRS1WVC7Xyb76aPKsz9AXg2e3I8ibnNGbI6ue ZH2W19ZkYrgS0GIaim9ZpVVhQQNVuNOGUzPSG7c= X-Received: by 2002:a2e:81d5:: with SMTP id s21mr6116080ljg.258.1589674121262; Sat, 16 May 2020 17:08:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Orson Zhai Date: Sun, 17 May 2020 08:08:29 +0800 Message-ID: Subject: Re: [PATCH v4 1/2] mfd: syscon: Support physical regmap bus To: Baolin Wang Cc: "lee.jones@linaro.org" , "arnd@arndb.de" , Mark Brown , Lyra Zhang , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 16, 2020 at 6:13 PM Baolin Wang wrote: > > Some platforms such as Spreadtrum platform, define a special method to > update bits of the registers instead of reading and writing, which means > we should use a physical regmap bus to define the reg_update_bits() > operation instead of the MMIO regmap bus. > > Thus add a a __weak function for the syscon driver to allow to register Typo -- duplicated "a". It seems to be a better idea than before. -Orson > a physical regmap bus to support this new requirement. > > Signed-off-by: Baolin Wang > --- > drivers/mfd/syscon.c | 9 ++++++++- > include/linux/mfd/syscon.h | 11 +++++++++++ > 2 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c > index 3a97816d0cba..dc92f3177ceb 100644 > --- a/drivers/mfd/syscon.c > +++ b/drivers/mfd/syscon.c > @@ -40,6 +40,13 @@ static const struct regmap_config syscon_regmap_config = { > .reg_stride = 4, > }; > > +struct regmap * __weak syscon_regmap_init(struct device_node *np, > + void __iomem *base, > + struct regmap_config *syscon_config) > +{ > + return regmap_init_mmio(NULL, base, syscon_config); > +} > + > static struct syscon *of_syscon_register(struct device_node *np, bool check_clk) > { > struct clk *clk; > @@ -106,7 +113,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk) > syscon_config.val_bits = reg_io_width * 8; > syscon_config.max_register = resource_size(&res) - reg_io_width; > > - regmap = regmap_init_mmio(NULL, base, &syscon_config); > + regmap = syscon_regmap_init(np, base, &syscon_config); > if (IS_ERR(regmap)) { > pr_err("regmap init failed\n"); > ret = PTR_ERR(regmap); > diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h > index 7f20e9b502a5..85088e44fe7c 100644 > --- a/include/linux/mfd/syscon.h > +++ b/include/linux/mfd/syscon.h > @@ -13,6 +13,7 @@ > > #include > #include > +#include > > struct device_node; > > @@ -28,6 +29,9 @@ extern struct regmap *syscon_regmap_lookup_by_phandle_args( > const char *property, > int arg_count, > unsigned int *out_args); > +extern struct regmap *syscon_regmap_init(struct device_node *np, > + void __iomem *base, > + struct regmap_config *syscon_config); > #else > static inline struct regmap *device_node_to_regmap(struct device_node *np) > { > @@ -59,6 +63,13 @@ static inline struct regmap *syscon_regmap_lookup_by_phandle_args( > { > return ERR_PTR(-ENOTSUPP); > } > + > +static inline struct regmap *syscon_regmap_init(struct device_node *np, > + void __iomem *base, > + struct regmap_config *syscon_config) > +{ > + return ERR_PTR(-ENOTSUPP); > +} > #endif > > #endif /* __LINUX_MFD_SYSCON_H__ */ > -- > 2.17.1 >