From patchwork Fri Jun 5 20:30:17 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pratyush Yadav
X-Patchwork-Id: 1304364
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Authentication-Results: ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de
(client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;
envelope-from=u-boot-bounces@lists.denx.de; receiver=)
Authentication-Results: ozlabs.org;
dmarc=pass (p=quarantine dis=none) header.from=ti.com
Authentication-Results: ozlabs.org;
dkim=pass (1024-bit key;
unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256
header.s=ti-com-17Q1 header.b=AK3WXQP5;
dkim-atps=neutral
Received: from phobos.denx.de (phobos.denx.de
[IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits))
(No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 49dvRd5MbDz9sRR
for ; Sat, 6 Jun 2020 06:30:53 +1000 (AEST)
Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
by phobos.denx.de (Postfix) with ESMTP id 8782B81EDD;
Fri, 5 Jun 2020 22:30:39 +0200 (CEST)
Authentication-Results: phobos.denx.de;
dmarc=pass (p=quarantine dis=none) header.from=ti.com
Authentication-Results: phobos.denx.de;
spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de
Authentication-Results: phobos.denx.de;
dkim=pass (1024-bit key;
unprotected) header.d=ti.com header.i=@ti.com header.b="AK3WXQP5";
dkim-atps=neutral
Received: by phobos.denx.de (Postfix, from userid 109)
id 6A2DD81E73; Fri, 5 Jun 2020 22:30:36 +0200 (CEST)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de
X-Spam-Level:
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,
DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED
autolearn=ham autolearn_force=no version=3.4.2
Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by phobos.denx.de (Postfix) with ESMTPS id 0713081CB9
for ; Fri, 5 Jun 2020 22:30:31 +0200 (CEST)
Authentication-Results: phobos.denx.de;
dmarc=pass (p=quarantine dis=none) header.from=ti.com
Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=p.yadav@ti.com
Received: from fllv0034.itg.ti.com ([10.64.40.246])
by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 055KUTuU057383;
Fri, 5 Jun 2020 15:30:29 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;
s=ti-com-17Q1; t=1591389029;
bh=RT33AjUwjUl9y68Q+3AKGJ3K4PzvRPbsu77Qnu7ypAk=;
h=From:To:CC:Subject:Date;
b=AK3WXQP579sT3tw2jZ5i9KSWgLgHLrsJmz67ZhVMCrK+Igx3ChZ0Z5QyooX6KT+y4
4uozhAIdi8a8gqwQB2HEHtZz3dPXE6ZbM4M4RqV59yT/kjKbat2DJddU2QfSCkpb6Y
CK3QYGWqWi09gcjY6NJpHnHc1JwtUDhHbhc03/6E=
Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26])
by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 055KUTDY118886
(version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);
Fri, 5 Jun 2020 15:30:29 -0500
Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE105.ent.ti.com
(10.64.6.26) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 5 Jun
2020 15:30:28 -0500
Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE107.ent.ti.com
(10.64.6.28) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via
Frontend Transport; Fri, 5 Jun 2020 15:30:28 -0500
Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com
[10.172.224.153])
by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 055KUQVo024135;
Fri, 5 Jun 2020 15:30:27 -0500
From: Pratyush Yadav
To: Simon Glass ,
CC: Pratyush Yadav , Vignesh Raghavendra ,
Sekhar Nori
Subject: [PATCH v2 0/8] regmap: Add managed API, regmap fields, regmap config
Date: Sat, 6 Jun 2020 02:00:17 +0530
Message-ID: <20200605203025.15466-1-p.yadav@ti.com>
X-Mailer: git-send-email 2.25.0
MIME-Version: 1.0
X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180
X-BeenThere: u-boot@lists.denx.de
X-Mailman-Version: 2.1.30rc1
Precedence: list
List-Id: U-Boot discussion
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: u-boot-bounces@lists.denx.de
Sender: "U-Boot"
X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de
X-Virus-Status: Clean
Hi,
This series is a re-spin of Jean-Jacques' earlier effort [0], the goal
of which was to facilitate porting drivers from the Linux kernel. It
adds the managed API, using the same API as Linux. It also adds support
for regmap fields.
Jean-Jacques' series added support for custom regmap read/write
callbacks. The design was argued against by Simon [1]. He argued that
using the driver model was a better idea instead of the custom
functions. That would mean slightly more memory usage and a more
involved change.
The main aim of adding the custom functions is to support the Cadence
Sierra PHY driver from Linux [2]. The driver's custom functions aren't
very complicated, so they can be replaced by some simple formatting
options. So, add the struct regmap_config which contains fields to alter
the behaviour of the regmap. This includes specifying the size of the
read/write operations via 'width', specifying the start and size of
range from code instead of device tree via 'r_start' and 'r_size', and
specifying a left shift of the register offset before access via
'reg_offset_shift'. The driver can't be ported verbatim now, but this
allows the changes to be very isolated and minimal.
These config options allow us to avoid converting to driver model until
we really need it.
The patches are based on [3] which fixes a segmentation fault in sandbox
which didn't allow the tests to complete.
[0] https://patchwork.ozlabs.org/project/uboot/cover/20191105114700.24989-1-jjhiblot@ti.com/
[1] https://patchwork.ozlabs.org/comment/2426186/
[2] https://elixir.bootlin.com/linux/latest/source/drivers/phy/cadence/phy-cadence-sierra.c
[3] https://patchwork.ozlabs.org/project/uboot/patch/20200526120557.26240-1-p.yadav@ti.com/
Changes in v2:
- Add comments explaining the need for regmap_field.
- Set regmap->width to a default of REGMAP_SIZE_32 in regmap_alloc() to
avoid the checks in regmap_{read,write}().
- Use calloc() instead of using malloc() and memset() to initialize a
regmap to zero.
- Update comments on regmap_{read,write}() and
regmap_raw_{read,write}().
- Drop comments explaining two non-existent fields in struct reg_field.
- Add a comment with example explaining REG_FIELD().
- Add Simon's Reviewed-by trailers.
Jean-Jacques Hiblot (3):
regmap: Add devm_regmap_init()
regmap: Add support for regmap fields
test: dm: Add tests for regmap managed API and regmap fields
Pratyush Yadav (5):
regmap: zero out the regmap on allocation
regmap: Allow specifying read/write width
regmap: Allow left shifting register offset before access
regmap: Add regmap_init_mem_range()
regmap: Allow devices to specify regmap range start and size in config
arch/sandbox/dts/test.dts | 13 +++
drivers/core/regmap.c | 163 +++++++++++++++++++++++++++++-
include/regmap.h | 205 +++++++++++++++++++++++++++++++++++---
test/dm/regmap.c | 198 ++++++++++++++++++++++++++++++++++++
4 files changed, 562 insertions(+), 17 deletions(-)
---
2.27.0