Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1537425imm; Sat, 2 Jun 2018 03:20:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLQ7EaQGX3Qy8gSJFnvn5MpZObWGFJOpsCzOMODSd9RG2aPZ3fa+KlbdbVHV3+jETOk//Z6 X-Received: by 2002:a63:b008:: with SMTP id h8-v6mr10124617pgf.137.1527934841692; Sat, 02 Jun 2018 03:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527934841; cv=none; d=google.com; s=arc-20160816; b=QNII6fW16XJzxgCNl3KorWiMlK9whJKAZMX26HcdTFF5oAfFomOneFYN31uruy2Q11 1Gm1S7TVrdmemz/yIc9wjfuzlZgSmEqUPtuzT/Grl8saPIW1CfGiZ+oi/NrVhFK9kxR6 avaJysus70OzknUfqk6dzKkJMz02ACD+cmSJM8DdzheOUk110Pc+24wpfgDUMelw9mIR Bzei7ji69A/qppuf19SnoXWHa0i6fWugWBvcSt0qk7BnNDYgc67cSQzmYF+QRvwNjuQf Vzlp0/WnxUOhTBRhfrohEIyayeDwDFg3vW9z9AIC/F3n/3KNIHdzJ3BOU+y3xyu3B+ut j28Q== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=a3wNkOyw4dZuuX9/jR1Lr/znNwhfXz7zNwkXaZqrZ+I=; b=Erlkf2Yz4xmHL7qje6h0/cqnwlxze7ysHke//F1en6xCT+YAJwLofoOqgaxydmHj5Z LjTP0W6KtCO/TEFlomSHgwjEbWRflOZD0Zp+0ZGgPXdpV8CKtbWrntKwzX5KAUVw8n5m aDZjMrk35OrBFbrjaKbMt25hVBF5XkjL2E9Pwxed5K41/gECHmZrWgcC/X9f/02T5OS9 mSDh7d7Iwa5tjbu6TFyw9LEDH64x1WJRGchYssszmhWqKS60ryvjTLw2s0x3KG3u8B3f yg5ch6hB2Ag0w+DOgGj1vzsS2U6vYzcmUztRYRPNo1Tgb920YSyxd1jTh4am2Gt5iyeY UVuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G0cPYpME; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id bb11-v6si1173271plb.227.2018.06.02.03.19.55; Sat, 02 Jun 2018 03:20:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G0cPYpME; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1751902AbeFBKMn (ORCPT + 99 others); Sat, 2 Jun 2018 06:12:43 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:39119 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751538AbeFBKMW (ORCPT ); Sat, 2 Jun 2018 06:12:22 -0400 Received: by mail-wm0-f68.google.com with SMTP id p11-v6so5895561wmc.4; Sat, 02 Jun 2018 03:12:21 -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; bh=a3wNkOyw4dZuuX9/jR1Lr/znNwhfXz7zNwkXaZqrZ+I=; b=G0cPYpME9ZvFJp+4d+TfYc4L69oELYa2qwR7eq36q6Z+eaL6UagWrsH/c5w/XkTN4w hJ+fJV4UhL8DO/VDGNXTXcIz7+kFDpNs6HDIQdngOlASahF6kadsPQtw4LQYui+f9sK6 2Y6mHKOX6+yJWWXeajsiHYnM6b17cuXnX1rOH0lj103qKGjiYF3Gic6FISVszOFCjbsF +Njz1HaafekmOjq+E0VWZtShoNhbXMFL23ef8iFKaQwPlfgbraf1MoPS+chdFB5FbjW/ N39ZNi8kF42AAZLz4w8KCUgmjeJUKLo13cX7TUL3vSDZ+GDhaUEqadct3KDrYIYF/fNW ayqw== 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; bh=a3wNkOyw4dZuuX9/jR1Lr/znNwhfXz7zNwkXaZqrZ+I=; b=kjORHc5KzxFnjw7G+412S2Do8OwVGyC4MXEjLhCaBVuIvlGGm8/PxySJD85N27yao+ TEhDBES99d3PmCMeMHc5fDnyd/RN15IUEKVkvpnPtei8d5QgLReO4/tGHcKqNxlBNDxN FQt8vG0eK2Znh3XFhNxn+8l31W9FUVAP4eS6dY/QBir8jvdcCwehtr6o12y5hIKyrZoR 7oAVXypOJ6F40D6m8aS4Lf6Jvz1Rrzae3M4Y1JrpWHTqWtV9Cg1Z4JuRSUC2nvI2IlRd 2AE7eIkKMllGCIvQ1hb0J04EuefBvpKxXTDGR85K24dPek8rb5Km4L6anPSgNmX87Lkv 6tGw== X-Gm-Message-State: APt69E2p5HUAPOhGmWwT2+SbYme6ylwWvsMH8vbnRrwnTDxEv1fcUZUt 0fmc2UaayHKUQkx2Fq49b8mhqNfm X-Received: by 2002:a1c:dca:: with SMTP id 193-v6mr4618813wmn.36.1527934340690; Sat, 02 Jun 2018 03:12:20 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id b16-v6sm38624797wrm.89.2018.06.02.03.12.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 03:12:20 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-kernel@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Lee Jones , Mark Brown , Steve Twiss , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH v3 06/10] mfd: da9063: Add custom regmap for DA9063L Date: Sat, 2 Jun 2018 12:11:51 +0200 Message-Id: <20180602101155.26375-6-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180602101155.26375-1-marek.vasut+renesas@gmail.com> References: <20180602101155.26375-1-marek.vasut+renesas@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While the datasheet for DA9063L (2v1, 23-Mar-2017) lists the RTC register block, the DA9063L does not have an RTC. Add custom regmap for DA9063L to prevent access into that register block. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Lee Jones Cc: Mark Brown Cc: Steve Twiss Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org --- V3: New patch --- drivers/mfd/da9063-i2c.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c index 048ce55ebc5b..f0d92a37df6b 100644 --- a/drivers/mfd/da9063-i2c.c +++ b/drivers/mfd/da9063-i2c.c @@ -208,6 +208,93 @@ static const struct regmap_access_table da9063_bb_volatile_table = { .n_yes_ranges = ARRAY_SIZE(da9063_bb_volatile_ranges), }; +static const struct regmap_range da9063l_bb_readable_ranges[] = { + { + .range_min = DA9063_REG_PAGE_CON, + .range_max = DA9063_REG_MON_A10_RES, + }, { + .range_min = DA9063_REG_SEQ, + .range_max = DA9063_REG_ID_32_31, + }, { + .range_min = DA9063_REG_SEQ_A, + .range_max = DA9063_REG_AUTO3_LOW, + }, { + .range_min = DA9063_REG_T_OFFSET, + .range_max = DA9063_BB_REG_GP_ID_19, + }, { + .range_min = DA9063_REG_CHIP_ID, + .range_max = DA9063_REG_CHIP_VARIANT, + }, +}; + +static const struct regmap_range da9063l_bb_writeable_ranges[] = { + { + .range_min = DA9063_REG_PAGE_CON, + .range_max = DA9063_REG_PAGE_CON, + }, { + .range_min = DA9063_REG_FAULT_LOG, + .range_max = DA9063_REG_VSYS_MON, + }, { + .range_min = DA9063_REG_SEQ, + .range_max = DA9063_REG_ID_32_31, + }, { + .range_min = DA9063_REG_SEQ_A, + .range_max = DA9063_REG_AUTO3_LOW, + }, { + .range_min = DA9063_REG_CONFIG_I, + .range_max = DA9063_BB_REG_MON_REG_4, + }, { + .range_min = DA9063_BB_REG_GP_ID_0, + .range_max = DA9063_BB_REG_GP_ID_19, + }, +}; + +static const struct regmap_range da9063l_bb_volatile_ranges[] = { + { + .range_min = DA9063_REG_PAGE_CON, + .range_max = DA9063_REG_EVENT_D, + }, { + .range_min = DA9063_REG_CONTROL_A, + .range_max = DA9063_REG_CONTROL_B, + }, { + .range_min = DA9063_REG_CONTROL_E, + .range_max = DA9063_REG_CONTROL_F, + }, { + .range_min = DA9063_REG_BCORE2_CONT, + .range_max = DA9063_REG_LDO11_CONT, + }, { + .range_min = DA9063_REG_DVC_1, + .range_max = DA9063_REG_ADC_MAN, + }, { + .range_min = DA9063_REG_ADC_RES_L, + .range_max = DA9063_REG_MON_A10_RES, + }, { + .range_min = DA9063_REG_SEQ, + .range_max = DA9063_REG_SEQ, + }, { + .range_min = DA9063_REG_EN_32K, + .range_max = DA9063_REG_EN_32K, + }, { + .range_min = DA9063_BB_REG_MON_REG_5, + .range_max = DA9063_BB_REG_MON_REG_6, + }, +}; + +static const struct regmap_access_table da9063l_bb_readable_table = { + .yes_ranges = da9063l_bb_readable_ranges, + .n_yes_ranges = ARRAY_SIZE(da9063l_bb_readable_ranges), +}; + +static const struct regmap_access_table da9063l_bb_writeable_table = { + .yes_ranges = da9063l_bb_writeable_ranges, + .n_yes_ranges = ARRAY_SIZE(da9063l_bb_writeable_ranges), +}; + +static const struct regmap_access_table da9063l_bb_volatile_table = { + .yes_ranges = da9063l_bb_volatile_ranges, + .n_yes_ranges = ARRAY_SIZE(da9063l_bb_volatile_ranges), +}; + static const struct regmap_range_cfg da9063_range_cfg[] = { { .range_min = DA9063_REG_PAGE_CON, @@ -254,6 +341,10 @@ static int da9063_i2c_probe(struct i2c_client *i2c, da9063_regmap_config.rd_table = &da9063_ad_readable_table; da9063_regmap_config.wr_table = &da9063_ad_writeable_table; da9063_regmap_config.volatile_table = &da9063_ad_volatile_table; + } else if (da9063->type == PMIC_TYPE_DA9063L) { + da9063_regmap_config.rd_table = &da9063l_bb_readable_table; + da9063_regmap_config.wr_table = &da9063l_bb_writeable_table; + da9063_regmap_config.volatile_table = &da9063l_bb_volatile_table; } else { da9063_regmap_config.rd_table = &da9063_bb_readable_table; da9063_regmap_config.wr_table = &da9063_bb_writeable_table; -- 2.16.2