Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6360197imu; Tue, 13 Nov 2018 23:36:33 -0800 (PST) X-Google-Smtp-Source: AJdET5eaV2UlX/ANNeKKvsJaWafoG94eka1DBV3F32141GUytcGcDx+0qrtj8536epELGZnnhCuw X-Received: by 2002:a62:f5da:: with SMTP id b87mr825853pfm.253.1542180993385; Tue, 13 Nov 2018 23:36:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542180993; cv=none; d=google.com; s=arc-20160816; b=I9/ezCWLfjPULuOV5drCNga5Bu8M+kboOnBpVTftkeOtgyGOhp8nTdokzlCcopDmRa xaXIoB8ivkSJLt92uEq6jnjVZFLsvwzzxhU7P0nl38X5TYznztp2qB1pdtXF+NfABo07 83QEhEz4s7LzRhnWn3HSMoYIle6Eat6v2RECYC6HZL2a5bU+Nuu040XwvgynRo9EWzML /eAT/61v80nb9C3j43hQobqx1UPJNr6p+eMQnviZMqochf0WNX+baCeSOtrRI36kwpGV v9GqrMNlWJ5hdN0i9RHO9sq1Bh3RGsJViVHmWN7ZdqlyO1GBwiwYRg1wEwuidtwkn9Sr ST2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=M70xVAfY2FlrVVnP/YTfa7QLpH3hYe1UY10pGY4fea0=; b=dJEg+AJcOY+7OQZvFHalIKCAgGHnmBf22AlecjWoNJTe1mvF6cyT5fL5hemczkGpt3 nFkZi0ZQat+jM5ZXUg7RxpIah1lwARJ+/MHSNDBvE/P8Bqw6FMPaM72q/fRscwlL841C awj3tsoFDOrxw50vCPXGVHXr4csp7zAvxsJQ91bBBFrl/489xeSMl+gO6f0cDsb6gTjL J+Kgt7puv6tJkRu+qpoZt7HVNVnVkdp8qgL9MnysgqnRhsyh9ewap0yTCVEw/3tNU6Jw 2a8sFXvyJKuL7JESGGj4IpQzPIO9SAe6zjMKsuACwjS6zCLFQOsu5L5jtRRD/1NC/CMJ 9icw== 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 28si20082809pgz.593.2018.11.13.23.36.18; Tue, 13 Nov 2018 23:36:33 -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 S1731774AbeKNRhv (ORCPT + 99 others); Wed, 14 Nov 2018 12:37:51 -0500 Received: from ms.tdt.de ([195.243.126.94]:57814 "EHLO mail.dev.tdt.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727966AbeKNRhu (ORCPT ); Wed, 14 Nov 2018 12:37:50 -0500 Received: from feckert01.dev.tdt.de (unknown [10.2.3.40]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 7978321971; Wed, 14 Nov 2018 07:27:07 +0000 (UTC) From: Florian Eckert To: linus.walleij@linaro.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, andy.shevchenko@gmail.com, joe@perches.com, chunkeey@gmail.com, piotr.krol@3mdeb.com, dvhart@infradead.org Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH v3 2/2] kernel: Add reset button platform device for APU2/APU3 Date: Wed, 14 Nov 2018 08:26:58 +0100 Message-Id: <20181114072658.11457-3-fe@dev.tdt.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181114072658.11457-1-fe@dev.tdt.de> References: <20181114072658.11457-1-fe@dev.tdt.de> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.dev.tdt.de Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will add a x86 platform device "gpio-keys-polled" which uses the new gpio-apu drive for APU2 and APU3 boards from PC Engines. Signed-off-by: Florian Eckert --- arch/x86/Kconfig | 14 ++++++++ arch/x86/platform/Makefile | 1 + arch/x86/platform/amd/Makefile | 1 + arch/x86/platform/amd/apu.c | 72 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 arch/x86/platform/amd/Makefile create mode 100644 arch/x86/platform/amd/apu.c diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 9d734f3c8234..97c53286fdb6 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2820,6 +2820,20 @@ config TS5500 endif # X86_32 +if X86_64 +config APU + bool "PCEngines APU System Support" + help + This option enables system support for the PCEngines APU platform. + At present this just sets up the reset button control on + APU2/APU3 boards. However, other system specific setup should + get added here. + + Note: You must still enable the drivers for GPIO and LED support + (GPIO_APU & LEDS_APU) to actually use the LEDs and the GPIOs + +endif # X86_64 + config AMD_NB def_bool y depends on CPU_SUP_AMD && PCI diff --git a/arch/x86/platform/Makefile b/arch/x86/platform/Makefile index d0e835470d01..a95d18810c29 100644 --- a/arch/x86/platform/Makefile +++ b/arch/x86/platform/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 # Platform specific code goes here obj-y += atom/ +obj-y += amd/ obj-y += ce4100/ obj-y += efi/ obj-y += geode/ diff --git a/arch/x86/platform/amd/Makefile b/arch/x86/platform/amd/Makefile new file mode 100644 index 000000000000..bf04c5799d7f --- /dev/null +++ b/arch/x86/platform/amd/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_APU) +=apu.o diff --git a/arch/x86/platform/amd/apu.c b/arch/x86/platform/amd/apu.c new file mode 100644 index 000000000000..a4b695881177 --- /dev/null +++ b/arch/x86/platform/amd/apu.c @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * System Specific setup for PC-Engines APU2/APU3 devices + * + * Copyright (C) 2018 Florian Eckert + */ + +#include +#include +#include +#include +#include + +static struct gpio_keys_button apu_gpio_buttons[] = { + { + .code = KEY_RESTART, + .gpio = 20, + .active_low = 1, + .desc = "Reset button", + .type = EV_KEY, + .debounce_interval = 60, + } +}; + +static struct gpio_keys_platform_data apu_buttons_data = { + .buttons = apu_gpio_buttons, + .nbuttons = ARRAY_SIZE(apu_gpio_buttons), + .poll_interval = 20, +}; + +static struct platform_device apu_buttons_dev = { + .name = "gpio-keys-polled", + .id = 1, + .dev = { + .platform_data = &apu_buttons_data, + } +}; + +static struct platform_device *apu_devs[] __initdata = { + &apu_buttons_dev, +}; + +static void __init register_apu(void) +{ + /* Setup push button control through gpio-apu driver */ + platform_add_devices(apu_devs, ARRAY_SIZE(apu_devs)); +} + +static int __init apu_init(void) +{ + if (!dmi_match(DMI_SYS_VENDOR, "PC Engines")) { + pr_err("No PC Engines board detected\n"); + return -ENODEV; + } + + if (!(dmi_match(DMI_PRODUCT_NAME, "APU2") || + dmi_match(DMI_PRODUCT_NAME, "apu2") || + dmi_match(DMI_PRODUCT_NAME, "PC Engines apu2") || + dmi_match(DMI_PRODUCT_NAME, "APU3") || + dmi_match(DMI_PRODUCT_NAME, "apu3") || + dmi_match(DMI_PRODUCT_NAME, "PC Engines apu3"))) { + pr_err("Unknown PC Engines board: %s\n", + dmi_get_system_info(DMI_PRODUCT_NAME)); + return -ENODEV; + } + + register_apu(); + + return 0; +} + +device_initcall(apu_init); -- 2.11.0