From patchwork Sat Nov 19 11:30:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ash Logan X-Patchwork-Id: 626935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ED2BC4332F for ; Sat, 19 Nov 2022 11:32:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233955AbiKSLcs (ORCPT ); Sat, 19 Nov 2022 06:32:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233941AbiKSLcS (ORCPT ); Sat, 19 Nov 2022 06:32:18 -0500 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A4B7950D2; Sat, 19 Nov 2022 03:32:17 -0800 (PST) Received: (Authenticated sender: ash@heyquark.com) by mail.gandi.net (Postfix) with ESMTPSA id BCE59FF802; Sat, 19 Nov 2022 11:32:08 +0000 (UTC) From: Ash Logan To: krzysztof.kozlowski+dt@linaro.org, paulus@samba.org, mpe@ellerman.id.au, christophe.leroy@csgroup.eu, robh+dt@kernel.org, benh@kernel.crashing.org, segher@kernel.crashing.org, pali@kernel.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, j.ne@posteo.net, linkmauve@linkmauve.fr, rw-r-r-0644@protonmail.com, devicetree@vger.kernel.org, joel@jms.id.au Subject: [PATCH v4 10/11] powerpc: wiiu: platform support Date: Sat, 19 Nov 2022 22:30:40 +1100 Message-Id: <20221119113041.284419-11-ash@heyquark.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221119113041.284419-1-ash@heyquark.com> References: <20220628133144.142185-1-ash@heyquark.com> <20221119113041.284419-1-ash@heyquark.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add platform support for the Nintendo Wii U console. Signed-off-by: Ash Logan Co-developed-by: Roberto Van Eeden Signed-off-by: Roberto Van Eeden Co-developed-by: Emmanuel Gil Peyrot Signed-off-by: Emmanuel Gil Peyrot --- v2->v3: Use of_platform_default_populate instead of a custom match table. arch/powerpc/platforms/wiiu/Makefile | 2 +- arch/powerpc/platforms/wiiu/setup.c | 60 ++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/platforms/wiiu/setup.c diff --git a/arch/powerpc/platforms/wiiu/Makefile b/arch/powerpc/platforms/wiiu/Makefile index fa16c60261e6..abcb7a1beebf 100644 --- a/arch/powerpc/platforms/wiiu/Makefile +++ b/arch/powerpc/platforms/wiiu/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_WIIU) += espresso-pic.o latte-pic.o +obj-$(CONFIG_WIIU) += setup.o espresso-pic.o latte-pic.o obj-$(CONFIG_LATTEIPC_UDBG) += udbg_latteipc.o diff --git a/arch/powerpc/platforms/wiiu/setup.c b/arch/powerpc/platforms/wiiu/setup.c new file mode 100644 index 000000000000..e3f07ce65cad --- /dev/null +++ b/arch/powerpc/platforms/wiiu/setup.c @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Nintendo Wii U board-specific support + * + * Copyright (C) 2022 The linux-wiiu Team + */ +#define DRV_MODULE_NAME "wiiu" +#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt + +#include +#include + +#include +#include + +#include "espresso-pic.h" +#include "latte-pic.h" +#include "udbg_latteipc.h" + +static int __init wiiu_probe(void) +{ + if (!of_machine_is_compatible("nintendo,wiiu")) + return 0; + + latteipc_udbg_init(); + + return 1; +} + +static void __noreturn wiiu_halt(void) +{ + for (;;) + cpu_relax(); +} + +static void __init wiiu_init_irq(void) +{ + espresso_pic_init(); + latte_pic_init(); +} + +static int __init wiiu_device_probe(void) +{ + if (!machine_is(wiiu)) + return 0; + + of_platform_default_populate(NULL, NULL, NULL); + return 0; +} +device_initcall(wiiu_device_probe); + +define_machine(wiiu) { + .name = "wiiu", + .probe = wiiu_probe, + .halt = wiiu_halt, + .progress = udbg_progress, + .calibrate_decr = generic_calibrate_decr, + .init_IRQ = wiiu_init_irq, + .get_irq = espresso_pic_get_irq, +};