From patchwork Mon May 4 21:20:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1283015 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=none (p=none dis=none) header.from=prevas.dk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=gVqlPmFg; 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 49GG4G72N0z9sSc for ; Tue, 5 May 2020 07:20:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1275781FB6; Mon, 4 May 2020 23:20:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk 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=prevas.dk header.i=@prevas.dk header.b="gVqlPmFg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 06E3981FB6; Mon, 4 May 2020 23:20:48 +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=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0730.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::730]) (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 01E7681FB6 for ; Mon, 4 May 2020 23:20:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nbxHM7uHRm4FE7k8um6BpQ9zdK+UpFTNDr2PDQBAU9xlH+dKF3t8RRL4d9ia009tm4oEtffY6BHshh0bn/Be3RxeYnv6PflwqVMdwxKhGqzn4sR6ZbGo1Tafk4Vyl8V9wU2JeT5SJ4D19W1n6rZ6s5sXfTcfiOMhrWNFNiedXeKe+3uOWodIQKFwUrljuwvMptO0sOCBKBUSdgtE6HFCoA4oYxth88+HUyqsv7v/FD/5TeaB0KV4xU/iwZ/p5D9KV/BAcOaLjm3YM8Lnmh9x/fS/UHhELm2jDZZsf+ccxrEut5uiK7/H585XMz8PD1s7aK7szLIHDGlosGev6FNksw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rCwryskBrukRO572r/43mi4a20HaRAf6Rlq0zyXLdC8=; b=iXnbT5rqOXvgq/siMdCwxFvcdfOvSzbhxGc3SL+1pwik5j3JYhRbnCNKd/7rXv5ADzO5PKrZAPe9PGVjZtlFeI601mt/3QjZm2gsF0ymlPLBTIhpgl8Fq75Gfcn6KPfOyT7s2QnvbrAqCLXIEwwXCFAgL6ra0a+2Pv0x3+wGUaulW15kAPyp236xnZvpsdw3vUb8bsTiWDSszD9NuGR4fFSKasc4+Aibkxrbj02Qp1Hbj5StVAguJMxBPZRSdgy4oQYdnpIgwS7QvMfDQQaBIb3rLZXsxvBSg1/RLkUmxIgZN7kuQ2fJV+70r/cGu+wR8CtWUDZFbo+CLJ+BhPZ5tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rCwryskBrukRO572r/43mi4a20HaRAf6Rlq0zyXLdC8=; b=gVqlPmFg7lDYPF2oBJwwa7QdKjROV05fNhWCTdr2u9tRUGL0c7QXNGkN3tDmU8FUaTl6s5pMoVTI9n1/FWB3ugaDSD573er0UalFNBmwL3uOZzv1o7do61+fHvJboLZNGe4HrU6w6ISBR3umfNJoCqyUn8rzqcdn3Xl8zVmPtv0= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) by VI1PR10MB1598.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:802:31::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.29; Mon, 4 May 2020 21:20:41 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::f0ac:4e97:2536:faa%7]) with mapi id 15.20.2958.030; Mon, 4 May 2020 21:20:41 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Heiko Schocher , Lukasz Majewski , Biwen Li , Rasmus Villemoes Subject: [PATCH 0/6] rtc: add rtc_{read,write}8_array and rtc command Date: Mon, 4 May 2020 23:20:26 +0200 Message-Id: <20200504212032.3759-1-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 X-ClientProxiedBy: AM6PR02CA0018.eurprd02.prod.outlook.com (2603:10a6:20b:6e::31) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.116.45) by AM6PR02CA0018.eurprd02.prod.outlook.com (2603:10a6:20b:6e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Mon, 4 May 2020 21:20:40 +0000 X-Mailer: git-send-email 2.23.0 X-Originating-IP: [5.186.116.45] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b71d7391-5b3f-4054-57a9-08d7f070ff9f X-MS-TrafficTypeDiagnostic: VI1PR10MB1598: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-Forefront-PRVS: 03932714EB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uvYWKtkvIIJrnN2FYBBBxtUocECnRHKpKgjMNmzduWlFZmR93cO7X+WhS/f3MQ6Ka+LEa6TKa3ms2qgVN4uUr35EcjqSHvL7Ffu97tjHYBOEnHCgBMRmcnN+YOEwlVf3kPZD+L9z2x7zwMj0hzK+lRF9Bu/CxqhhzxpWARwtrN1Wsg+MpFu/bYe4Usyu0rYaD+jTQTFthFye6DaRyIIkBH8xZdgkH/4IHGSiP3duyOTE0gbUP+HqDqbQm5Mari014SI6ZIm2NaHJjlgFvx3uodxnHIYQLr7FdZrdWbfAzvo2+0xdUl6WJB5FHqB2y6Hg1Od+7XkhZHVV8PNpcp1C1m4oifIzfHs+l1AXEEP1krEWmnBm/81ygqPcMTbwq4/wphDFxSU4+BP5kw38Ehp9nVFoRNlCMbXnL5WbT7QImJEB49iI0+z2jcbEHWnjdSmxxaAE9X4pvimaKAt54S3AMVM+0frb84PDecvyGTuqAEFVZxAIw+O8FPnLWvw6YTXK X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(346002)(376002)(136003)(366004)(396003)(39850400004)(54906003)(6512007)(2616005)(956004)(8676002)(8936002)(8976002)(66556008)(36756003)(66946007)(5660300002)(66476007)(4326008)(6486002)(316002)(44832011)(1076003)(6916009)(86362001)(478600001)(6666004)(107886003)(26005)(16526019)(52116002)(6506007)(2906002)(186003)(142933001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: QDKiaEOvf2H/GBkgzw0HKxJM1wCJHGrr3ei0E/1qTYI1/OZGgzDRpsogX7ctvmVEfiGm2ZsvmR7Ni5AhGXnnVNWoC/Wnd4iHKNCYbG14OxF7OJEHI3t/F2ODegSIiKWWX+CO6q+IJiuv3BpNdofUVwiIGQCqE7ivv/RXne9eQF/qy1yGEeoyr9Ql3d0TcepNgCMpptMpM1s4MmlKr9NWTnx3cwpUbNTCyXapkK1ZWMQ9yhiE8xwL2yZRmC42S2tTdPe9QMncjB75ioHaD6RTdypVy9P/+DZwrOMaH45tgoM1lpDxngcM6dl6DNxKjvbZpNtpcpt3sOQEYNdfPwIpeJj06ZEU4mudPRv1fidIH7PjUubXnvPL202Ixnnd3IySO6370bwr/+SRsLKvrLTkAZ1MFej7vy0cLYJcPM6kiDQ9jrpp6an9UQg1SgTWgLimJhrPICrUnPWPBTxrTFnVloZH4653eI4oZoBeWQGFnFFcnrS9s8UtFeuiCJQPx7HiCqhsBGWRxd6ZojRu2aPYeAcFUwHkR0khegM5Xn7n5oQIGD0jddMcycS9R/Li2CxNCTn/C5iTA6k+2rk16IWFa0TnaQM8lKgcnUo7NVhluPhowLIyiLWO0U9aVcn/5ce+OE4/kVMo03/dKYUNB964h1yLfMDXgjuZFS1X57V2MFZX/IPG1lj3zu80ja2Q3Zc+1x00nXURXElLd/WfVb10+jH8AWgljqn8IIAS1xCSR2iIeviZgFSMIHPCpvfaPPzTkBAurUcrdQwb3ExfAelt95LYpKeSi1YzWDxGyVFd4sk= X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: b71d7391-5b3f-4054-57a9-08d7f070ff9f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2020 21:20:41.3959 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cd8KrL1SV2/H+8+ksQtj4HB00oIVa0zfKhyz02lbwCzmf24n9heXvSYpe9Iwl5UbnwjQkJqSYYmgEzy+J+To+q5zvHpojQ8OaoE1KiZaoAE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB1598 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 I need access to registers other than just the timekeeping ones of the pcf2127, so I wanted to implement ->read8 and ->write8. But for testing these it appeared there was no convenient way to invoke those from the shell, so I also ended up adding such a command. Also, it seemed more natural to provide array variants that can read or write several registers at once, so rtc_ops is expanded a bit. There are a few things one could do on top, but for now I just want some feedback, especially on the new _array methods. "rtc set", "rtc get" and "rtc reset" are rather obvious subsommands to add at some point. Also, rtc_{read,write}{16,32} can be simplified a bit, along the lines of __le16 v; int ret = rtc_read8_array(dev, reg, &v, 2); if (ret) return ret; *valuep = __le16_to_cpu(v); return 0; Rasmus Villemoes (6): rtc: add rtc_read8_array helper and ->read8_array method rtc: add rtc_write8_array() helper rtc: fall back to ->{read,write}8_array if ->{read,write}8 are not provided rtc: pcf2127: provide ->read8_array method rtc: pcf2127: provide ->write8_array method rtc: add rtc command cmd/Kconfig | 6 ++ cmd/Makefile | 1 + cmd/rtc.c | 153 +++++++++++++++++++++++++++++++++++++++ drivers/rtc/pcf2127.c | 14 +++- drivers/rtc/rtc-uclass.c | 53 +++++++++++++- include/rtc.h | 48 ++++++++++++ 6 files changed, 270 insertions(+), 5 deletions(-) create mode 100644 cmd/rtc.c