From patchwork Wed Dec 15 17:54:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emmanuel Gil Peyrot X-Patchwork-Id: 1568567 Return-Path: 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.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JDjZd1C5Rz9s5P for ; Thu, 16 Dec 2021 04:55:20 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JDjZb7490z3cJm for ; Thu, 16 Dec 2021 04:55:19 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linkmauve.fr (client-ip=82.65.109.163; helo=luna.linkmauve.fr; envelope-from=linkmauve@linkmauve.fr; receiver=) X-Greylist: delayed 163 seconds by postgrey-1.36 at boromir; Thu, 16 Dec 2021 04:55:11 AEDT Received: from luna.linkmauve.fr (82-65-109-163.subs.proxad.net [82.65.109.163]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JDjZR2Ytfz2yJM for ; Thu, 16 Dec 2021 04:55:11 +1100 (AEDT) Received: by luna.linkmauve.fr (Postfix, from userid 1000) id CE3E4F40EA4; Wed, 15 Dec 2021 18:55:04 +0100 (CET) From: Emmanuel Gil Peyrot To: Alexandre Belloni , Alessandro Zummo Subject: [PATCH v3 0/5] rtc: nintendo: Add a RTC driver for the GameCube, Wii and Wii U Date: Wed, 15 Dec 2021 18:54:56 +0100 Message-Id: <20211215175501.6761-1-linkmauve@linkmauve.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211027223516.2031-1-linkmauve@linkmauve.fr> References: <20211027223516.2031-1-linkmauve@linkmauve.fr> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, Emmanuel Gil Peyrot , linux-kernel@vger.kernel.org, rw-r-r-0644 , Rob Herring , Paul Mackerras , Ash Logan , linuxppc-dev@lists.ozlabs.org, =?utf-8?q?Jonathan_Neusch=C3=A4fer?= Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" These three consoles share a device, the MX23L4005, which contains a clock and 64 bytes of SRAM storage, and is exposed on the EXI bus (similar to SPI) on channel 0, device 1. This driver allows it to be used as a Linux RTC device, where time can be read and set. The hardware also exposes two timers, one which shuts down the console and one which powers it on, but these aren’t supported currently. On the Wii U, the counter bias is stored in a XML file, /config/rtc.xml, encrypted in the SLC (eMMC storage), using a proprietary filesystem. In order to avoid having to implement all that, this driver assumes a bootloader will parse this XML file and write the bias into the SRAM, at the same location the other two consoles have it. Changes since v1: - Rename the driver to rtc-gamecube. - Switch to the regmap API for debugfs support. - Report low battery and unstable power as invalid data. - Remove Wii U support in Kconfig, nothing specific to this console needs to be changed in the code. - Don’t attempt to change HW_SRNPROT on the GameCube, this register doesn’t exist so we can use SRAM just fine without doing anything. - Add needed changes to the wii device tree. - Enable this driver on the gamecube and wii platforms. Changes since v2: - Report low battery correctly. Emmanuel Gil Peyrot (5): rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U rtc: gamecube: Report low battery as invalid data powerpc: wii.dts: Expose HW_SRNPROT on this platform powerpc: gamecube_defconfig: Enable the RTC driver powerpc: wii_defconfig: Enable the RTC driver arch/powerpc/boot/dts/wii.dts | 5 + arch/powerpc/configs/gamecube_defconfig | 2 +- arch/powerpc/configs/wii_defconfig | 2 +- drivers/rtc/Kconfig | 11 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-gamecube.c | 377 ++++++++++++++++++++++++ 6 files changed, 396 insertions(+), 2 deletions(-) create mode 100644 drivers/rtc/rtc-gamecube.c Acked-by: Michael Ellerman (powerpc)