Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6098045imu; Mon, 21 Jan 2019 03:11:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN4iOZTWlo3QOtoDVlo0cd6zEzTVc7ACk+gcVv9FF3CVenihHb6BQt7iZW373UOLpdZi32TY X-Received: by 2002:a62:3811:: with SMTP id f17mr29898998pfa.206.1548069116415; Mon, 21 Jan 2019 03:11:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548069116; cv=none; d=google.com; s=arc-20160816; b=s7zrH6To3pVxoMFtev0WZyMD+DassWbuKsH6GoEFKq6rZLgP/O5QadSjHEON+llX6B nBsqxs43hosVov/27yZ4EgNv5qmGUJzufRHKcp/8wOUda53P/H9vVayYyfWG6Ttlz6o5 125B0qka/mxoHKnOB2xnBSGxsrtrWRyGnRMn3vgprErxqQNaQkOkmKNlON+SgjGBZkzn wQk0nmoZjA4EKYi7pzYYX6fA80EEYrhLCwzAIrvd2iJB9mXxSMEuWST5X0YxtQ2mGx3Z c4c0TzNytXnm4t9H7hjgYYSPIqHWP9joPIyOHQvhH7+PUkOyTD9Zr2jIrP2T6u4PUoDO q5Sg== 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=5nBGDBEr8QgTNKieDcum6CfGdJRTjbVO1+gM0GBCLEw=; b=g2jZTsnD97ps4bxWIAQsfoVKFdQs7iuoFpS1PN93JhM6V7PdmrhA2B/bh9VJWDuwHg Mbfouk2naTn/szTnaV0lhCkZj5E11YuB5PvAhJ77veAvo1nUAimahge9chCzVAqsLx7p kYlk6yxwZfUU/ipA3wOSSONYWPUMVuBki52iJU1OBPhrpJ9fe3dMvBpi/t+vUcRnnBD4 kIgSv9zinAHTuveJX8xE/eINI6a9muFGoUJIZMKOZon4xwR6MoDSs7lP3f2hIYBeLmrj 5tce/kjDQxK0d07PWRElKoji/JjA+6CPXR2I+fUIwpfEG+PoDpqhaAotZG/KWBoTX0e1 idfQ== 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 t19si10573117pgu.5.2019.01.21.03.11.40; Mon, 21 Jan 2019 03:11:56 -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 S1727804AbfAULCL (ORCPT + 99 others); Mon, 21 Jan 2019 06:02:11 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:41568 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727658AbfAULCL (ORCPT ); Mon, 21 Jan 2019 06:02:11 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id DBFB5A68483F38294280; Mon, 21 Jan 2019 19:02:08 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x0LB1vrO011585; Mon, 21 Jan 2019 19:01:57 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019012119020475-23367767 ; Mon, 21 Jan 2019 19:02:04 +0800 From: Peng Hao To: gregkh@linuxfoundation.org, arnd@arndb.de, andy.shevchenko@gmail.com Cc: linux-kernel@vger.kernel.org, Peng Hao Subject: [PATCH 5/6] misc/pvpanic: add pvpanic mmio driver Date: Tue, 22 Jan 2019 03:25:10 +0800 Message-Id: <1548098711-52497-5-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1548098711-52497-1-git-send-email-peng.hao2@zte.com.cn> References: <1548098711-52497-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-01-21 19:02:04, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-01-21 19:01:57, Serialize complete at 2019-01-21 19:01:57 X-MAIL: mse01.zte.com.cn x0LB1vrO011585 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add pvpanic mmio driver to pvpanic driver framework. Signed-off-by: Peng Hao --- drivers/misc/pvpanic/Kconfig | 4 +++ drivers/misc/pvpanic/Makefile | 1 + drivers/misc/pvpanic/pvpanic-of.c | 53 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 drivers/misc/pvpanic/pvpanic-of.c diff --git a/drivers/misc/pvpanic/Kconfig b/drivers/misc/pvpanic/Kconfig index d274130..47f8709 100644 --- a/drivers/misc/pvpanic/Kconfig +++ b/drivers/misc/pvpanic/Kconfig @@ -13,4 +13,8 @@ config PVPANIC_ACPI depends on ACPI default PVPANIC +config PVPANIC_OF + tristate "pvpanic mmio driver" + depends on OF + endif diff --git a/drivers/misc/pvpanic/Makefile b/drivers/misc/pvpanic/Makefile index c5b73ca..63ef0db 100644 --- a/drivers/misc/pvpanic/Makefile +++ b/drivers/misc/pvpanic/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o obj-$(CONFIG_PVPANIC_ACPI) += pvpanic-acpi.o +obj-$(CONFIG_PVPANIC_OF) += pvpanic-of.o diff --git a/drivers/misc/pvpanic/pvpanic-of.c b/drivers/misc/pvpanic/pvpanic-of.c new file mode 100644 index 0000000..73ca5f3 --- /dev/null +++ b/drivers/misc/pvpanic/pvpanic-of.c @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * pvpanic of driver. + * + * Copyright (C) 2019 ZTE Ltd. + * Author: Peng Hao + */ + +#include +#include +#include +#include +#include +#include +#include "pvpanic.h" + +static int pvpanic_mmio_probe(struct platform_device *pdev) +{ + struct resource *res; + int ret; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + + ret = pvpanic_add_device(&pdev->dev, res); + if (ret) + return -ENODEV; + + return 0; +} + +static int pvpanic_mmio_remove(struct platform_device *pdev) +{ + pvpanic_remove_device(); + return 0; +} + +static const struct of_device_id pvpanic_mmio_match[] = { + { .compatible = "qemu,pvpanic-mmio", }, + {} +}; + +static struct platform_driver pvpanic_mmio_driver = { + .driver = { + .name = "pvpanic-mmio", + .of_match_table = pvpanic_mmio_match, + }, + .probe = pvpanic_mmio_probe, + .remove = pvpanic_mmio_remove, +}; + +module_platform_driver(pvpanic_mmio_driver); -- 1.8.3.1