Received: by 10.223.176.46 with SMTP id f43csp2476468wra; Sun, 21 Jan 2018 21:07:30 -0800 (PST) X-Google-Smtp-Source: AH8x224str6+IUpUlgLaepZeb52+C4+9SdZ5wW3A+xOFYofXNKNYPGtLsnom9X6L1sgzGDGQiqiu X-Received: by 10.101.81.5 with SMTP id f5mr6246696pgq.22.1516597650675; Sun, 21 Jan 2018 21:07:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516597650; cv=none; d=google.com; s=arc-20160816; b=Y/UUHwZNj1PtjY1l1MS1/M271ANTgzucAAK6+0JOTofIHM+4DpasAZY54QWDfZGPr9 ssSVLEi1wM/L8hIAu9FBrc1PjGL2yAxxOiUruNQOVe40J6IOvPTHKNGNb9y1J0JfvDbo pLxvdy+xxvVQ/2kKksmk6XzgNzB3amEbOeZB6N6j1NKJw8DUwxtUZl57tcWAD9Ldsaxp PsUlh9nLA90+exVQv61i4maWA9a+V7IjCnmwuQL2ToCYC4jLwtAeRgPxkV7tQapRQxlg UApXIlZrWdpmOmg36uy0C90PjFD05tpu4LlRnxmntTR3rck6tgq2bwLnfaWgqBCyT6Wt IamQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=7z4bfuJT4Qo8w3nw65B9EuiSsbSl2K05O1JwSsC1riA=; b=llxy9e5zaB9Q5BHqo7ItVK/ceoajWCFZbtx/ptyD9kwOtaFdkd2B0FmlRo64eIBU5h i+P88scfgrDwwWN7RWFQVzoooVT7bRp00oYaSxU1IRcXDQeJTyfYBQZug/O0KptnDOD0 N9dps01w7PvUM7npokRAEyo8VCekyxfnxua3HgtoMGMe2USfCdtocLW+YFizhlIZT7ND FrqwERmmflM0jbn+EYxDce7aZoU9cn1GnC3trdD/xU7bMGK0dol3GrOdnn2vozQR03t1 VVzUGLbh2ElQKB6SHWGG59x9uZN0xdiBaxzdRVC1iH7YO5siSvmRQ89gD/GHcsZAWqFQ i19g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z20si14992084pfj.118.2018.01.21.21.07.16; Sun, 21 Jan 2018 21:07:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751100AbeAVFEk (ORCPT + 99 others); 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 Received: from localhost.localdomain ([88.153.6.51]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MPYqL-1ehb0p3x0z-004lWY; Mon, 22 Jan 2018 06:04:31 +0100 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 Precedence: bulk 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