From: majun258@huawei.com (majun (F))
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 2/4] irqchip: add platform device driver for mbigen device
Date: Tue, 20 Oct 2015 19:08:21 +0800 [thread overview]
Message-ID: <562620A5.5080603@huawei.com> (raw)
In-Reply-To: <1445330520-11960-3-git-send-email-majun258@huawei.com>
Sorry, I missed Makefile and Kconfig file in this patch.
I will re-send this patch set.
? 2015/10/20 16:41, MaJun ??:
> From: Ma Jun <majun258@huawei.com>
>
> Mbigen means Message Based Interrupt Generator(MBIGEN).
>
> Its a kind of interrupt controller that collects
> the interrupts from external devices and generate msi interrupt.
> Mbigen is applied to reduce the number of wire connected interrupts.
>
> As the peripherals increasing, the interrupts lines needed is
> increasing much, especially on the Arm64 server SOC.
>
> Therefore, the interrupt pin in GIC is not enough to cover so
> many peripherals.
>
> Mbigen is designed to fix this problem.
>
> Mbigen chip locates in ITS or outside of ITS.
>
> Mbigen chip hardware structure shows as below:
>
> mbigen chip
> |---------------------|-------------------|
> mgn_node0 mgn_node1 mgn_node2
> | |-------| |-------|------|
> dev1 dev1 dev2 dev1 dev3 dev4
>
> Each mbigen chip contains several mbigen nodes.
>
> External devices can connect to mbigen node through wire connecting way.
>
> Because a mbigen node only can support 128 interrupt maximum, depends
> on the interrupt lines number of devices, a device can connects to one
> more mbigen nodes.
>
> Also, several different devices can connect to a same mbigen node.
>
> When devices triggered interrupt,mbigen chip detects and collects
> the interrupts and generates the MBI interrupts by writing the ITS
> Translator register.
>
> To simplify mbigen driver,I used a new conception--mbigen device.
> Each mbigen device is initialized as a platform device.
>
> Mbigen device presents the parts(register, pin definition etc.) in
> mbigen chip corresponding to a peripheral device.
>
> So from software view, the structure likes below
>
> mbigen chip
> |---------------------|-----------------|
> mbigen device1 mbigen device2 mbigen device3
> | | |
> dev1 dev2 dev3
>
> Signed-off-by: Ma Jun <majun258@huawei.com>
> ---
> drivers/irqchip/irq-mbigen.c | 83 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 83 insertions(+), 0 deletions(-)
> create mode 100644 drivers/irqchip/irq-mbigen.c
>
> diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
> new file mode 100644
> index 0000000..f18132f
> --- /dev/null
> +++ b/drivers/irqchip/irq-mbigen.c
> @@ -0,0 +1,83 @@
> +/*
> + * Copyright (C) 2015 Hisilicon Limited, All Rights Reserved.
> + * Author: Jun Ma <majun258@huawei.com>
> + * Author: Yun Wu <wuyun.wu@huawei.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +
> +/**
> + * struct mbigen_device - holds the information of mbigen device.
> + *
> + * @pdev: pointer to the platform device structure of mbigen chip.
> + * @base: mapped address of this mbigen chip.
> + */
> +struct mbigen_device {
> + struct platform_device *pdev;
> + void __iomem *base;
> +};
> +
> +static int mbigen_device_probe(struct platform_device *pdev)
> +{
> + struct mbigen_device *mgn_chip;
> +
> + mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL);
> + if (!mgn_chip)
> + return -ENOMEM;
> +
> + mgn_chip->pdev = pdev;
> + mgn_chip->base = of_iomap(pdev->dev.of_node, 0);
> +
> + platform_set_drvdata(pdev, mgn_chip);
> +
> + return 0;
> +}
> +
> +static int mbigen_device_remove(struct platform_device *pdev)
> +{
> + struct mbigen_device *mgn_chip = platform_get_drvdata(pdev);
> +
> + iounmap(mgn_chip->base);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id mbigen_of_match[] = {
> + { .compatible = "hisilicon,mbigen-v2" },
> + { /* END */ }
> +};
> +MODULE_DEVICE_TABLE(of, mbigen_of_match);
> +
> +static struct platform_driver mbigen_platform_driver = {
> + .driver = {
> + .name = "Hisilicon MBIGEN-V2",
> + .owner = THIS_MODULE,
> + .of_match_table = mbigen_of_match,
> + },
> + .probe = mbigen_device_probe,
> + .remove = mbigen_device_remove,
> +};
> +
> +module_platform_driver(mbigen_platform_driver);
> +
> +MODULE_AUTHOR("Jun Ma <majun258@huawei.com>");
> +MODULE_AUTHOR("Yun Wu <wuyun.wu@huawei.com>");
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("Hisilicon MBI Generator driver");
>
WARNING: multiple messages have this Message-ID (diff)
From: "majun (F)" <majun258@huawei.com>
To: <Catalin.Marinas@arm.com>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <Will.Deacon@arm.com>,
<mark.rutland@arm.com>, <marc.zyngier@arm.com>,
<jason@lakedaemon.net>, <tglx@linutronix.de>,
<lizefan@huawei.com>, <huxinwei@huawei.com>,
<dingtianhong@huawei.com>, <zhaojunhua@hisilicon.com>,
<liguozhu@hisilicon.com>, <xuwei5@hisilicon.com>,
<wei.chenwei@hisilicon.com>, <guohanjun@huawei.com>,
<wuyun.wu@huawei.com>, <guodong.xu@linaro.org>,
<haojian.zhuang@linaro.org>, <zhangfei.gao@linaro.org>,
<usman.ahmad@linaro.org>, <klimov.linux@gmail.com>,
<gabriele.paoloni@huawei.com>
Subject: Re: [PATCH v6 2/4] irqchip: add platform device driver for mbigen device
Date: Tue, 20 Oct 2015 19:08:21 +0800 [thread overview]
Message-ID: <562620A5.5080603@huawei.com> (raw)
In-Reply-To: <1445330520-11960-3-git-send-email-majun258@huawei.com>
Sorry, I missed Makefile and Kconfig file in this patch.
I will re-send this patch set.
在 2015/10/20 16:41, MaJun 写道:
> From: Ma Jun <majun258@huawei.com>
>
> Mbigen means Message Based Interrupt Generator(MBIGEN).
>
> Its a kind of interrupt controller that collects
> the interrupts from external devices and generate msi interrupt.
> Mbigen is applied to reduce the number of wire connected interrupts.
>
> As the peripherals increasing, the interrupts lines needed is
> increasing much, especially on the Arm64 server SOC.
>
> Therefore, the interrupt pin in GIC is not enough to cover so
> many peripherals.
>
> Mbigen is designed to fix this problem.
>
> Mbigen chip locates in ITS or outside of ITS.
>
> Mbigen chip hardware structure shows as below:
>
> mbigen chip
> |---------------------|-------------------|
> mgn_node0 mgn_node1 mgn_node2
> | |-------| |-------|------|
> dev1 dev1 dev2 dev1 dev3 dev4
>
> Each mbigen chip contains several mbigen nodes.
>
> External devices can connect to mbigen node through wire connecting way.
>
> Because a mbigen node only can support 128 interrupt maximum, depends
> on the interrupt lines number of devices, a device can connects to one
> more mbigen nodes.
>
> Also, several different devices can connect to a same mbigen node.
>
> When devices triggered interrupt,mbigen chip detects and collects
> the interrupts and generates the MBI interrupts by writing the ITS
> Translator register.
>
> To simplify mbigen driver,I used a new conception--mbigen device.
> Each mbigen device is initialized as a platform device.
>
> Mbigen device presents the parts(register, pin definition etc.) in
> mbigen chip corresponding to a peripheral device.
>
> So from software view, the structure likes below
>
> mbigen chip
> |---------------------|-----------------|
> mbigen device1 mbigen device2 mbigen device3
> | | |
> dev1 dev2 dev3
>
> Signed-off-by: Ma Jun <majun258@huawei.com>
> ---
> drivers/irqchip/irq-mbigen.c | 83 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 83 insertions(+), 0 deletions(-)
> create mode 100644 drivers/irqchip/irq-mbigen.c
>
> diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
> new file mode 100644
> index 0000000..f18132f
> --- /dev/null
> +++ b/drivers/irqchip/irq-mbigen.c
> @@ -0,0 +1,83 @@
> +/*
> + * Copyright (C) 2015 Hisilicon Limited, All Rights Reserved.
> + * Author: Jun Ma <majun258@huawei.com>
> + * Author: Yun Wu <wuyun.wu@huawei.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +
> +/**
> + * struct mbigen_device - holds the information of mbigen device.
> + *
> + * @pdev: pointer to the platform device structure of mbigen chip.
> + * @base: mapped address of this mbigen chip.
> + */
> +struct mbigen_device {
> + struct platform_device *pdev;
> + void __iomem *base;
> +};
> +
> +static int mbigen_device_probe(struct platform_device *pdev)
> +{
> + struct mbigen_device *mgn_chip;
> +
> + mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL);
> + if (!mgn_chip)
> + return -ENOMEM;
> +
> + mgn_chip->pdev = pdev;
> + mgn_chip->base = of_iomap(pdev->dev.of_node, 0);
> +
> + platform_set_drvdata(pdev, mgn_chip);
> +
> + return 0;
> +}
> +
> +static int mbigen_device_remove(struct platform_device *pdev)
> +{
> + struct mbigen_device *mgn_chip = platform_get_drvdata(pdev);
> +
> + iounmap(mgn_chip->base);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id mbigen_of_match[] = {
> + { .compatible = "hisilicon,mbigen-v2" },
> + { /* END */ }
> +};
> +MODULE_DEVICE_TABLE(of, mbigen_of_match);
> +
> +static struct platform_driver mbigen_platform_driver = {
> + .driver = {
> + .name = "Hisilicon MBIGEN-V2",
> + .owner = THIS_MODULE,
> + .of_match_table = mbigen_of_match,
> + },
> + .probe = mbigen_device_probe,
> + .remove = mbigen_device_remove,
> +};
> +
> +module_platform_driver(mbigen_platform_driver);
> +
> +MODULE_AUTHOR("Jun Ma <majun258@huawei.com>");
> +MODULE_AUTHOR("Yun Wu <wuyun.wu@huawei.com>");
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("Hisilicon MBI Generator driver");
>
next prev parent reply other threads:[~2015-10-20 11:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 8:41 [PATCH v6 0/4] irqchip:support mbigen interrupt controller MaJun
2015-10-20 8:41 ` MaJun
2015-10-20 8:41 ` [PATCH v6 1/4] dt-binding:Documents of the mbigen bindings MaJun
2015-10-20 8:41 ` MaJun
2015-10-20 8:41 ` [PATCH v6 2/4] irqchip: add platform device driver for mbigen device MaJun
2015-10-20 8:41 ` MaJun
2015-10-20 11:08 ` majun (F) [this message]
2015-10-20 11:08 ` majun (F)
2015-10-20 8:41 ` [PATCH v6 3/4] irqchip:create irq domain for each " MaJun
2015-10-20 8:41 ` MaJun
2015-10-20 8:42 ` [PATCH v6 4/4] irqchip:implement the mbigen irq chip operation functions MaJun
2015-10-20 8:42 ` MaJun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=562620A5.5080603@huawei.com \
--to=majun258@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.