Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1170258ybk; Sat, 16 May 2020 03:15:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAHMYBrKd+2NTtI8wzQdGstV3DNr0WLQ2ZOJDIcCdkNaEl9We2lAES6YE9as0STXUyTP5b X-Received: by 2002:a17:906:4eda:: with SMTP id i26mr6904866ejv.228.1589624114322; Sat, 16 May 2020 03:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589624114; cv=none; d=google.com; s=arc-20160816; b=Za39oCiSe0tnFqAMeFeuvcMxWddVRZCQ8zfDYXv5hS0HgwoLnCHB+A119VJ/CG1u/6 +EyrBxOv6amgCQ0u21nDNZexjoeuDtIpGUwpvrwkoIz4nqLSW22hHffSIrnoYdPs+ycq Mx8rpWFbxRYwghvjeEHyY+YFKdu1ppxIvZrf07WZBDy9lv3Plf09oVf4PR+vNa3rgHmN A+JIwkAwrojWJgMLgRQF7Fweyp5qShCfCOY6c042vRxJqRLoB9tu6SYQYWcZAH09pIgE N5pEknXAN2pzOAAiG9LtGhXmnikE2LOUJ72jbBcCWiwHTI2y1qWK8NEhuJM9C1qYtbvD RSjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=Pwph17mYjXF4W7X4OOaH7O6D4wWrQlD3/6R/CLTs2MU=; b=IwByFQtzb3IVR4dhoeX+fya5AyyVv3Tsij2L6ySreQ9IA/7vDa8vkz4xN2eDKrJYia klEr0P+YZV4wWKMcoqcwcKD1qezEMvHtDC25dT0chzan66Pno/4mjKTXGNGMasP/E/kb 2U9ik40hf2TiWKZpzMr3gu65V9dQYGmxQU4zA9oc0T2rAAKWPHogIkEaXZBnvd8xiJS6 kYFblrkWrkyuO9PZ2YSouST1YPvzUeoF4BD6LGegwxAXTDxqxYfRmAVTSX0C+q1DqKuF sJbH3Oe6sKsMgRuuDF0//iNWLAKpPDkwLtlrdGbf632FSr4R2a2vr2a8Qoa7OGtYdugD Mg2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FEwq0wzh; 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 gr8si2530923ejb.464.2020.05.16.03.14.49; Sat, 16 May 2020 03:15:14 -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=FEwq0wzh; 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 S1726399AbgEPKNJ (ORCPT + 99 others); Sat, 16 May 2020 06:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725853AbgEPKNI (ORCPT ); Sat, 16 May 2020 06:13:08 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 556B3C061A0C for ; Sat, 16 May 2020 03:13:08 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id f15so1988544plr.3 for ; Sat, 16 May 2020 03:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Pwph17mYjXF4W7X4OOaH7O6D4wWrQlD3/6R/CLTs2MU=; b=FEwq0wzhk004cUb5Kn1Uw/oN4qdmFYBotOM9Ve0jJ3e2E9GJ2R0tqaaIFV2xWltjW/ Y1EBCHkX0sjnpZHheR1Pb89LokE4oJ5qldBo5qX6Y5EU0wH6LAi3boBIMBWI1hBPK3W/ Bu7gHOSJoYqmzSoOwRa+OsC16F6LACp5f0iFeB7qdRpf0+vUNcLPtvey6T1W2ytpPE12 doNRArcxjKp1rcxSUUgAaHwsq7tCtGAoZd7TDb6Kac4PiM/iqp53t274WEA4LtGHHEG+ 3NuDE3g6oRi9pjPya5v3VMlC06BugU2VGXnPh1quGs6GqfMJhuYjErxLYqKahXWtEj38 Txzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Pwph17mYjXF4W7X4OOaH7O6D4wWrQlD3/6R/CLTs2MU=; b=ITeKeTkDa/AVNlE6Wz5hUXGiPQaSfWYdTAJfV8Z+2RLJ8mSVC91yZO5MXopbPM4RZi o2Li5dhYlplaCVknaPw8aDGmFewhyMOV/ee7zRCTgrdadzlm31JFIaP5YZPjFY5jdJuN m20jyw0i3LZntB2oy5eiytyOu9qUcvtBV1O1g9OU6NQpYJCL9My7m3SaO/G1FHPVwlOX ClMnT1A4kan6ItLUHbJwag0d0wf7yGy9Tc9hJ1pGelrGqySfsVe1wMyt3f90xitwSBVz pO1y2cKpDlJpuoCbGy3VF4uFtDHfWgl34UMaFVGb7+WqVnkphN1NKgOzksPlnsOz6n+J 8Q2Q== X-Gm-Message-State: AOAM533LvSSeNQ6b0hNiV2UbcQLtatR8KWYZvTqf4GyJvKZNEBDjxBmh DVlm19QCEVxRpVzQhK10lT0= X-Received: by 2002:a17:90a:fd8c:: with SMTP id cx12mr4489871pjb.211.1589623987977; Sat, 16 May 2020 03:13:07 -0700 (PDT) Received: from localhost.localdomain ([45.135.186.16]) by smtp.gmail.com with ESMTPSA id x10sm3554542pgr.65.2020.05.16.03.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 May 2020 03:13:07 -0700 (PDT) From: Baolin Wang To: lee.jones@linaro.org, arnd@arndb.de Cc: broonie@kernel.org, baolin.wang7@gmail.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/2] mfd: syscon: Support physical regmap bus Date: Sat, 16 May 2020 18:12:28 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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