Message ID | 20200128111020.15136-2-rasmus.villemoes@prevas.dk |
---|---|
State | Superseded |
Delegated to: | Mario Six |
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) 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=eorWZ1Bf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 486P6w23ytz9sNx for <incoming@patchwork.ozlabs.org>; Tue, 28 Jan 2020 22:10:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A463381A02; Tue, 28 Jan 2020 12:10:43 +0100 (CET) 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="eorWZ1Bf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7282E819B8; Tue, 28 Jan 2020 12:10:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FORGED_SPF_HELO, SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02on0724.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe07::724]) (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 6134181844 for <u-boot@lists.denx.de>; Tue, 28 Jan 2020 12:10:36 +0100 (CET) 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=ROrd0DBp+JycdzCXWFgv6A5pn7nArDse3X7qOKkO0bvHogkCF3135e8en2VP3m+e3QUYpedUtWEr7BTd5QS4lGOtpjmOu7q4phRBYWk5n8Vfu/3/771WtOZf1HF9DvDXGxeRpSzAQHxzH6CcHuScG4jrSYoT++MR7E1Wjnh+r2cn7vrapXnYVDVwJdK79mT48D2ZrUH7HYYxdsQHZ+IjW4/m34mdBg6XBlgsf5dX/sIJS+5tbs5RcF3wwRs8t7KvF1K5FbOwZyrtm0bAKF8AC6TKlLsbZz+wG0+atrH9N7JT3uRpVDV2IkWYrosjKyLGfBejS4xubvZpnKgrIPWDmQ== 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=4TD1aRjBit2oWwr3qv4zzfvk/WCgvJnKtFUlq/fC4yw=; b=ByjqM9Vxxho+zwyjyLBtzPEt/kch+MTvatnCS2t2/SRGKmSwJlC7E7GKGG8hDzv05PsJeF/qX67OclOw0oXiU7707Wva+h4vFRWDDmVLEFkTLIcZZz0FZScV6LpaqASIMrwzLTJZd5c3Dw35RYdQp7m4LR4FwM+X+Xj4id6XFKCODDXMeBf8yZnRSGycNIsOBDzN533muk5kl8Weric5Yr1leo3mBfqPU1hXHhiIUxtpbaiMTp7ECAHDZy3m1KYz8m0FgAHGwFSfaG74jIUtuQzjOcdwmjJIoeoRx9mTJn8ipdSUJxYEA7wcj8PU84leQxMv1iI84s49QFM1CUqtcA== 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=4TD1aRjBit2oWwr3qv4zzfvk/WCgvJnKtFUlq/fC4yw=; b=eorWZ1Bf7TktKMx5WwKCcmAoFbf12aNHTPtypKnc4x/L9s3WQQtrQ3kM3tbsqEcT8JJ1bWYtUR421D64bepLO+VMMYs9G7Vduvl2CpcSBDoxzrAU/NQMJUU1TXk4pTpPepc4KwdNSxKQB6shwR0l/VR4ShGbgc7RgNRyxzCNOeA= Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (20.178.126.85) by VI1PR10MB3709.EURPRD10.PROD.OUTLOOK.COM (10.186.162.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.22; Tue, 28 Jan 2020 11:10:30 +0000 Received: from VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::8175:5aa2:2870:766d]) by VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM ([fe80::8175:5aa2:2870:766d%6]) with mapi id 15.20.2665.026; Tue, 28 Jan 2020 11:10:30 +0000 Received: from prevas-ravi.prevas.se (81.216.59.226) by HE1PR0701CA0054.eurprd07.prod.outlook.com (2603:10a6:3:9e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2665.14 via Frontend Transport; Tue, 28 Jan 2020 11:10:29 +0000 From: Rasmus Villemoes <rasmus.villemoes@prevas.dk> To: "u-boot@lists.denx.de" <u-boot@lists.denx.de> Subject: [PATCH 1/2] gpio: mpc8xxx: don't modify gpdat when setting gpio as input Thread-Topic: [PATCH 1/2] gpio: mpc8xxx: don't modify gpdat when setting gpio as input Thread-Index: AQHV1cuN7B7xFq1gQUG5ecP2HYLisg== Date: Tue, 28 Jan 2020 11:10:30 +0000 Message-ID: <20200128111020.15136-2-rasmus.villemoes@prevas.dk> References: <20200128111020.15136-1-rasmus.villemoes@prevas.dk> In-Reply-To: <20200128111020.15136-1-rasmus.villemoes@prevas.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: HE1PR0701CA0054.eurprd07.prod.outlook.com (2603:10a6:3:9e::22) To VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:e1::21) x-mailer: git-send-email 2.23.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasmus.villemoes@prevas.dk; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [81.216.59.226] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 416db937-9de1-45d1-3fde-08d7a3e2af9d x-ms-traffictypediagnostic: VI1PR10MB3709: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: <VI1PR10MB3709F03566B13130DE5905E3930A0@VI1PR10MB3709.EURPRD10.PROD.OUTLOOK.COM> x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 029651C7A1 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(136003)(366004)(39850400004)(376002)(396003)(199004)(189003)(26005)(54906003)(6506007)(66476007)(66946007)(71200400001)(44832011)(956004)(2616005)(2906002)(5660300002)(66446008)(64756008)(66556008)(6666004)(8676002)(4326008)(107886003)(8936002)(81166006)(81156014)(86362001)(16526019)(478600001)(8976002)(186003)(6512007)(36756003)(316002)(6486002)(6916009)(52116002)(1076003)(32563001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR10MB3709; H:VI1PR10MB2765.EURPRD10.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: prevas.dk does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: flOab6zqZaU+3aAGR1wZkT71X8GfyQP2n/ZkHwTVpT9Wf8mtZ6O6naeelDfw6cP7KHU9ZQHJqRd/3qWh6ao/cxbkVTLQH0Kk4QlAByAW3vt7di+KKmqv5DtdRGq2PEcqOlSRc1iSLJQPKsvQn2/XdRfGY0W+rTty8xm2OsViTXLYvxv55675fQsKjiuWaIrtrGTyh5wd/JhqytBbVF8Pxs7L4jQ/bTb/w4YSesc8YleHceTOl7lzKy5k9nN7BZQcMBx3JRBvmBl4C7+cwqk9T4v3yXUPasngmepxnXFJ3alW+kcXH4E40BrLYR0lwA7GHwADB2Ri8NjVY3KrDZGQvEOBPUJRhTSg8NF9whQldZjIAWHIQ5/BhiefpH43ZrgKMDDHN4916adBIsIQ+LtuXzqajv+B7geYWCSbRGuc5z7QPTA6Gof2jPMdh9CuF//ATIZ9rTMf1HQIMe779wL1pWN+ObL1EHoGZRuVsqYoMts= x-ms-exchange-antispam-messagedata: uo4DjRMetdgyrQ+ym2WQlnH/CK6+sGKzJxSBZriEAvUqrntzLtFE/nqvdFLfJJIWTYVMyoThrHpjyUmy0qz0wmYT8kbH/KN/kbE3OcZeF/AKU12fg9535OVhsQTvUmKJK5I1IOhDguX12xCfoBb0Tw== Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 416db937-9de1-45d1-3fde-08d7a3e2af9d X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jan 2020 11:10:30.2528 (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: hRhnXrjPDtilqMZAP69m8uWcLuncVEaxz5wCzSQd3q4+jgoA1FCgtMQoTr1qG/T2bmEJAUi446bJwzRrpEuUnHGgMMX3UuBdkKei8GT2USY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3709 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Cc: Marek Vasut <marex@denx.de>, Mario Six <six@gdsys.cc> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean |
Series |
gpio: mpc8xxx: honour shadow register when writing gpdat
|
expand
|
diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c index 9964d69035..5438196fe0 100644 --- a/drivers/gpio/mpc8xxx_gpio.c +++ b/drivers/gpio/mpc8xxx_gpio.c @@ -57,13 +57,6 @@ static inline u32 mpc8xxx_gpio_get_dir(struct ccsr_gpio *base, u32 mask) return in_be32(&base->gpdir) & mask; } -static inline void mpc8xxx_gpio_set_in(struct ccsr_gpio *base, u32 gpios) -{ - clrbits_be32(&base->gpdat, gpios); - /* GPDIR register 0 -> input */ - clrbits_be32(&base->gpdir, gpios); -} - static inline void mpc8xxx_gpio_set_low(struct ccsr_gpio *base, u32 gpios) { clrbits_be32(&base->gpdat, gpios); @@ -100,8 +93,11 @@ static inline void mpc8xxx_gpio_open_drain_off(struct ccsr_gpio *base, static int mpc8xxx_gpio_direction_input(struct udevice *dev, uint gpio) { struct mpc8xxx_gpio_data *data = dev_get_priv(dev); + u32 mask = gpio_mask(gpio); + + /* GPDIR register 0 -> input */ + clrbits_be32(&data->base->gpdir, mask); - mpc8xxx_gpio_set_in(data->base, gpio_mask(gpio)); return 0; }
Since some chips don't support reading back the value of output gpios from the gpdat register, we should not do a RMW cycle (i.e., the clrbits_be32) on the gpdat register when setting a gpio as input, as that might accidentally change the value of some other (still configured as output) gpio. The extra indirection through mpc8xxx_gpio_set_in() does not help readability, so just fold the gpdir update into mpc8xxx_gpio_direction_input(). Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> --- drivers/gpio/mpc8xxx_gpio.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)