From patchwork Fri Feb 9 12:07:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 871372 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zdDX46zxsz9s1h for ; Fri, 9 Feb 2018 23:14:44 +1100 (AEDT) Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zdDX45JD7zF0j4 for ; Fri, 9 Feb 2018 23:14:44 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmx.net (client-ip=212.227.17.21; helo=mout.gmx.net; envelope-from=j.neuschaefer@gmx.net; receiver=) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zdDNG74HvzF0jj for ; Fri, 9 Feb 2018 23:07:58 +1100 (AEDT) Received: from localhost.localdomain ([88.153.6.11]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M3u86-1f2CLe10aI-00rcNK; Fri, 09 Feb 2018 13:07:40 +0100 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Subject: [PATCH v3 1/4] powerpc: wii: Explicitly configure GPIO owner for poweroff pin Date: Fri, 9 Feb 2018 13:07:28 +0100 Message-Id: <20180209120732.17863-2-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180209120732.17863-1-j.neuschaefer@gmx.net> References: <20180209120732.17863-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K0:dwLhG+vJnBnKptY5IqOxTJLwj5v5as+LNQrGxAQmMFa8W0gxhXA 9d4RQxrXNzt6agQEOfVuBMpJGgJAL+FqsxPr/lq6rZxSFNIkzOiknh74b90v0OAwae2x5Ep tWTGmomrYFdne9lpvStGMXb0KX+wWxBd+tMkMWJ3iPSyQ6YCpdBw9MPSlrwvKhFWp2uUJsF UTALXubE03ifHL2ZucqSg== X-UI-Out-Filterresults: notjunk:1; V01:K0:bdFSbI8cPuw=:UuMsvnPwtgza2lb819+o6Q aMYKEaLtpAzybytfGVEnzxPxzNQBeuDoksU7PvkF79aQbVdZr9bxrP3hAC41SkK2UwJ3KkcRY +1E9UbF2O5w+7IvzwpsEPX2kujZ1AIUoUcHsZgg0u2CCZwFj8L1TPWFX/I3szMVeMLSkH4Yi1 jXhoyG42p+cJOmkrfIaP1nvxi+BrBe0EAH38idvMmNjhtPbgv/+K1Q/VspKvB1sydKP6qoJtg 7ugAEA476uuguViBwVTQEfl5sAEIH99wmrMk3G5WCvggNTMfX2gQmOdwRQdC1YT7Y6GBq1/D1 Y3tMGj04eOwQFhc8RoDllnjJV7xABXW0TFJXn+2VnyH+9iNXjO6KzsFaUJfgbagMs9lSAvhgu 9idu4UW0ylf0GC7/+nxzBytVVGFqQM9/8UcFiCvbiE39cEg0PpotAzEg0C6Nro5Y/342JntLD IQ2jj0wi7F3+UJwaL/OB4572FuY6OtrO7QT7gU2Lr2n0cNKGor3KNioFB9/XcNslKStVS/HPo nvo021BhTrTXsF8C+esqbMHbnC0MsjnP8mTkd+M1PCrDqmuDs0CezjWEZrAbVJRPFX+bLzi6q kN0mAs2PkhGGkrwCLp0TN454h7eRgGI+ifbn1uppCGIAkxobh9hN+rZGzI9jsknxP+8AEH4VP UXnglk4gxxYin83JxMM22anJfiJMT+iQjboig/OI41PvcMa5pZd/Bk/oCHl7hMA63Eo51obAL MLEifCkTKOSRSyHbD05NpkFgww8EDbJEcRm7HikW8dqPKAVzDwlgKNiUD1hlrJcorydGZyaYP Cp3lu2u5Q9XnKdvYcJYNQ/pHtAmbBn0XulWIwGiRx9rdphMZZw= X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , linux-gpio@vger.kernel.org, Paul Mackerras , Joel Stanley , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The Hollywood chipset's GPIO controller has two sets of registers: One for access by the PowerPC CPU, and one for access by the ARM coprocessor (but both are accessible from the PPC because the memory firewall (AHBPROT) is usually disabled when booting Linux, today). The wii_power_off function currently assumes that the poweroff GPIO pin is configured for use via the ARM side, but the upcoming GPIO driver configures all pins for use via the PPC side, breaking poweroff. Configure the owner register explicitly in wii_power_off to make wii_power_off work with and without the new GPIO driver. I think the Wii can be switched to the generic gpio-poweroff driver, after the GPIO driver is merged. Signed-off-by: Jonathan Neuschäfer --- v2, v3: - no change --- arch/powerpc/platforms/embedded6xx/wii.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c index 160fa09533ba..4682327f76a9 100644 --- a/arch/powerpc/platforms/embedded6xx/wii.c +++ b/arch/powerpc/platforms/embedded6xx/wii.c @@ -45,6 +45,7 @@ #define HW_GPIO_BASE(idx) (idx * 0x20) #define HW_GPIO_OUT(idx) (HW_GPIO_BASE(idx) + 0) #define HW_GPIO_DIR(idx) (HW_GPIO_BASE(idx) + 4) +#define HW_GPIO_OWNER (HW_GPIO_BASE(1) + 0x1c) #define HW_GPIO_SHUTDOWN (1<<1) #define HW_GPIO_SLOT_LED (1<<5) @@ -177,6 +178,12 @@ static void wii_power_off(void) local_irq_disable(); if (hw_gpio) { + /* + * set the owner of the shutdown pin to ARM, because it is + * accessed through the registers for the ARM, below + */ + clrbits32(hw_gpio + HW_GPIO_OWNER, HW_GPIO_SHUTDOWN); + /* make sure that the poweroff GPIO is configured as output */ setbits32(hw_gpio + HW_GPIO_DIR(1), HW_GPIO_SHUTDOWN);