Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp937017pxb; Wed, 27 Oct 2021 15:36:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/+S/qKJzI1PmLmb8gWrYFGWe2YJMdVOtReNxDNgL+dywsudhpRiIUNkCgaet29lRh8Q6H X-Received: by 2002:a17:90b:1952:: with SMTP id nk18mr1409477pjb.135.1635374200238; Wed, 27 Oct 2021 15:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635374200; cv=none; d=google.com; s=arc-20160816; b=fsKW1khFyC8IzrgL/w8oO73MfnVmmEWb6du2MXGoZptgoXZsPaFTo5jP/bAc5cHZT7 0cRbzXmVq1uaOiOgF/9/psShGTJN90TVaW6rxSp/U4mqrmjLBI53ARNevHLp/+8LBK7E u/Fl4Sm6iw199j49JpQtCFTWqvr4CFDteg8cp2NfisOf+20W33mkxC3lJXIVzf6y9cDg lKxFj3FAscH+zYWdIu8/I1WBSQ+uPKTrqjkFUKCt/J02mJGUnNg/4d9NEBwP6avlKMlx tgse5RTFZNzIuLVcvLgcnHIbZilCjcxbBQVTEfimyM7OjrLrKfoSVC6MuUBr46YecRcA DSTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=JILmzYA1QRQatmwpTV0STKb+q6+K0ueje9A3sRRR1TI=; b=yoWwgvuL/3o0Iby+MGd0YuIQnKPpnhr7UWF6LhN7yg8XL/O3eneFSgn20YhKUT/3fk ypOnxU0O2PQLbXDn2ivqQTkDRjFbxzLycwwIRuU5E0ZuSKYPQWH9bMW1GP5kHuRubsrn n0PKcGxFjeTzbqDKSMC03GugWl1kthiG5clec5Jgv3d3q1QK3lJJPTnAJwUjHKwOQwTW dEFzXrxU3LxtcaiQMxEJyh0FcNAUazDpknJGfd+fAdEjcVzsspASXkEUx7OSdWZFKSgr dyLN2/b8ytB2gh6Rm8bneVyOyaco1WDWoz0wAn4kg0Xey6R/sqUKFpoqq+8N8FlUvdPB kzvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si1316156pll.305.2021.10.27.15.36.27; Wed, 27 Oct 2021 15:36:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbhJ0Whx (ORCPT + 99 others); Wed, 27 Oct 2021 18:37:53 -0400 Received: from 82-65-109-163.subs.proxad.net ([82.65.109.163]:57408 "EHLO luna.linkmauve.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbhJ0Whw (ORCPT ); Wed, 27 Oct 2021 18:37:52 -0400 Received: by luna.linkmauve.fr (Postfix, from userid 1000) id 35AEFF40C9C; Thu, 28 Oct 2021 00:35:22 +0200 (CEST) From: Emmanuel Gil Peyrot To: Alexandre Belloni , Alessandro Zummo Cc: Emmanuel Gil Peyrot , rw-r-r-0644 , Ash Logan , =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= , Rob Herring , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org Subject: [PATCH v2 0/5] rtc: nintendo: Add a RTC driver for the GameCube, Wii and Wii U Date: Thu, 28 Oct 2021 00:35:10 +0200 Message-Id: <20211027223516.2031-1-linkmauve@linkmauve.fr> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211014220524.9988-1-linkmauve@linkmauve.fr> References: <20211014220524.9988-1-linkmauve@linkmauve.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 -- 2.33.1