From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753703AbeAODOc (ORCPT + 1 other); Sun, 14 Jan 2018 22:14:32 -0500 Received: from mout.gmx.net ([212.227.15.18]:50131 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753016AbeAODO3 (ORCPT ); Sun, 14 Jan 2018 22:14:29 -0500 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= To: linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Subject: [PATCH 2/6] powerpc: wii: Explicitly configure GPIO owner for poweroff pin Date: Mon, 15 Jan 2018 04:13:57 +0100 Message-Id: <20180115031401.19577-3-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180115031401.19577-1-j.neuschaefer@gmx.net> References: <20180115031401.19577-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:ZyCio/I3IPYIghMAzv1B8i5btL0VdqHT48zz5Qeih8qaGKDBplw EzgO1HzKK/2nHb/Usg9KFguoQMLkCEXr6T0pYaD+GLN+QvmGBTtY01rSXs8uFHmBafOcPNb J/C7Oq69kPMkJmC23Ep0FSzWDvZ0Q1Iy9BIsLdyblC+ws3Iang3k8sMpqximuM7owbYScvb WkSbUOQmpBg4Scmjih9mQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:6nwHZODyLco=:E84Ea/fsdX4G5+LI6YZbRC W+H1vyAGI2BMkJF/j5QUCDJjqkDYT3/bWFs6jMjxXTH89tftBteNSVorFyrLJPZuHKbqDvpKp XK1UKKvytTJt8rBSgdHQdLfmaVn1fGTFlwo1LVCRWi9qexPzs8TCBRGUBZmmbezoRRX+Jjbfa xwBACvwk7MBpJwFNySryaN04cE3nk2t/v/2pkriJJRIB+AA/m+WNhEX58Mpo3athxL8zEj5og OA+b0mdreBnuFmadudx399Nl5pcUba6zRtMPLT3ubFsSJk1+luxDy/BnXeRfXJ1+V/TUIA5HO L/72GjP9AdYNnnc3bzm+Q1HTWFpf7MJpf+LqrHlm5GT7Xlz4lsPAxslUz/FDWra5jD2ImpZCX d+jRluhTfzZo3YNp8hhIaNN69N2IyjzUjYHfLCFpPKrqyeuTfMvZHPr04N/I24JXepjibLqaH QKJGjP0m6R6Q9SnDVJdpoSuPTX58XL0bODywbEsTnnKZT5wcwjhXJrcfUkXX9jlHNwTCdXjRG 6AzpaAlEPxYYiTi/HUORm3Zw93r+jbPIqXfy+sPKXVq4gn7OyTJNtdlWy4fklzgqdssQyL9K7 N2WbasdveJHew8xaL7/FhfJJ6xPgQlhEXXbeC3SKfVDiEzcRCI+neM3EAtYBvAGXJmcc4OQW7 ce4dx2t17dDZ0lBVFkCDgPBCmQCUumuvJ9IvkAOIs8iuqK14+N3kCIrsV2T/3uWoYjaxwcTmE XzdRpsfMnCJ9DxnYGoApMx8qxt1Qde3HMJnI86j/G9Cvwf1oH1nv6Dxf2avj3NmqRbc/m/7V0 cvXtB1J9ZBUwCT7WZtDkbdEQXSx3iwBr1l0RXNBV+AEVT57szE= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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 --- 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 79a1fe54ebc9..6e6db1e16d71 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); -- 2.15.1