From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751106AbeAVFEk (ORCPT ); Mon, 22 Jan 2018 00:04:40 -0500 Received: from mout.gmx.net ([212.227.17.20]:65024 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751048AbeAVFEg (ORCPT ); Mon, 22 Jan 2018 00:04:36 -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 v2 2/6] powerpc: wii: Explicitly configure GPIO owner for poweroff pin Date: Mon, 22 Jan 2018 06:04:07 +0100 Message-Id: <20180122050411.32460-3-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180122050411.32460-1-j.neuschaefer@gmx.net> References: <20180122050411.32460-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:ipEcxI650fqJqLRTlEyk0Ce/9hzbUDHR/tAd6LhSK/yl8aTtQa4 GpD6UpndgicEmMfcrxcb5q7ZGfT5GMXawN0/Xksmid95bfsZMN6rFrVSkGhRC9Ohxch3yML A1J5StMlXQyXiCm8Q3z4Ty8L48ZpDXaIxmAhTzJBT3RPLfRxf2thb5tFTnqgj5hd3ITDKnt 8INL8kGqlYV7RLxtsQuTg== X-UI-Out-Filterresults: notjunk:1;V01:K0:/bg58mqbduc=:8kvpzSeyv4KXTONn5gjVWY TUjgeAsg3DNs4gRvM0nrzqIwhsSN9dAK448xr8zb23nohlT7X7DuTIJ9kpizeVVR9pLUrIb1Q jpFBo9naIYnIe/D/u7kYYLa5CzIYQQs2g7UQjmzhO6MR3FMz10PWk4Uv5/j2wXBFmHTNRdo2I YlUhfJaqUk3i6XLEBaY7G1HU2vm0UHcPHmVTrzOCcipRSAAHqOYdav7u66fc2IS51wDHp35zR 7TFVMfjmnYBEU2WFx5bv1AY8MqWTnGYMKrC5/bXxNvzYKiIQI/a/wojCre0MB5WyypdOJa0iG 8FIcv2VQEYo173E16G3wU4hcY7Qvz2jrzSUFFb4evKFUnsqeCq/QtPniokXvFy32VTek0GeMW oQ//wPkqoGAsHYShCAOjYRkdFOZYX8eNG45YV68vq26a5tOTT7mvjuXS2VUXfbF+6zE1tJcSB QEW1i+LH+d/zPs6Cq7AeS93DgLuZjymn1g0zSr3pt+hiPFAs5NuZVv7jo/3RH+SqBRfM/pQFt OD0vvw9CbN5wWT1p3hSxYGWlEk5RhXFoBaR1akBgJGy6mJ62cCWFK3ueMSnfawqWYBi3WlggO SukggbEpFuwigZYproqpcoMb/2kPqgUKP03NeqLnpyXBT2EUubzpyCOeT3V8S5cyKCOLRsJjB hzNMOCQAq0s75NWbxCK2s6RUggVYcIh4T8AxRcGDSZerswhGgE5REW9DFJtCkkMfN+Ykbu7mH hv8d4zP9ZsVcFuEH1CGtZ9x/thuYWRoJz1EwUD+uOHRp5xJAJzqHswTfAhDVFxR1vI+j7sCvq ix1/OWMFoc/WWelLpgtfOlfH3DiByz0+IYMIUAIBQIYVj8WIYM= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: - 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 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