All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Bur <cyrilbur@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>, openbmc@lists.ozlabs.org
Subject: Re: [PATCH linux dev-4.7 4/8] ipmi: add an Aspeed BT IPMI BMC driver
Date: Thu, 03 Nov 2016 11:56:01 +1100	[thread overview]
Message-ID: <1478134561.728.7.camel@gmail.com> (raw)
In-Reply-To: <1477465067-19034-5-git-send-email-clg@kaod.org>

On Wed, 2016-10-26 at 08:57 +0200, Cédric Le Goater wrote:
> Backport from mainline of the main IPMI BMC driver patch plus fixes :
> 
>  - commit d94655b405ba ("ipmi/bt-bmc: remove redundant return value
>    check of platform_get_resource()")
>  - commit a3e6061bad62 ("ipmi/bt-bmc: add a dependency on
>    ARCH_ASPEED")
>  - commit 1a377a79211a ("ipmi: Fix ioremap error handling in bt-bmc")
>  - commit 54f9c4d0778b ("ipmi: add an Aspeed BT IPMI BMC driver")
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

[snip]

> +
> +static int bt_bmc_probe(struct platform_device *pdev)
> +{
> +	struct bt_bmc *bt_bmc;
> +	struct device *dev;
> +	struct resource *res;
> +	int rc;
> +
> +	if (!pdev || !pdev->dev.of_node)
> +		return -ENODEV;
> +
> +	dev = &pdev->dev;
> +	dev_info(dev, "Found bt bmc device\n");
> +
> +	bt_bmc = devm_kzalloc(dev, sizeof(*bt_bmc), GFP_KERNEL);
> +	if (!bt_bmc)
> +		return -ENOMEM;
> +
> +	dev_set_drvdata(&pdev->dev, bt_bmc);
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	bt_bmc->base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(bt_bmc->base))
> +		return PTR_ERR(bt_bmc->base);
> +
> +	mutex_init(&bt_bmc->mutex);
> +	init_waitqueue_head(&bt_bmc->queue);
> +
> +	bt_bmc->miscdev.minor	= MISC_DYNAMIC_MINOR,
> +		bt_bmc->miscdev.name	= DEVICE_NAME,
> +		bt_bmc->miscdev.fops	= &bt_bmc_fops,
> +		bt_bmc->miscdev.parent = dev;
> +	rc = misc_register(&bt_bmc->miscdev);
> +	if (rc) {
> +		dev_err(dev, "Unable to register misc device\n");
> +		return rc;
> +	}
> +
> +	bt_bmc_config_irq(bt_bmc, pdev);
> +
> +	if (bt_bmc->irq) {
> +		dev_info(dev, "Using IRQ %d\n", bt_bmc->irq);
> +	} else {
> +		dev_info(dev, "No IRQ; using timer\n");
> +		setup_timer(&bt_bmc->poll_timer, poll_timer,
> +			    (unsigned long)bt_bmc);
> +		bt_bmc->poll_timer.expires = jiffies +
> msecs_to_jiffies(10);
> +		add_timer(&bt_bmc->poll_timer);
> +	}
> +
> +	iowrite32((BT_IO_BASE << BT_CR0_IO_BASE) |
> +		  (BT_IRQ << BT_CR0_IRQ) |
> +		  BT_CR0_EN_CLR_SLV_RDP |
> +		  BT_CR0_EN_CLR_SLV_WRP |
> +		  BT_CR0_ENABLE_IBT,
> +		  bt_bmc->base + BT_CR0);
> +
> +	clr_b_busy(bt_bmc);
> +
> +	return 0;
> +}
> +
> +static int bt_bmc_remove(struct platform_device *pdev)
> +{
> +	struct bt_bmc *bt_bmc = dev_get_drvdata(&pdev->dev);
> +
> +	misc_deregister(&bt_bmc->miscdev);
> +	if (!bt_bmc->irq)
> +		del_timer_sync(&bt_bmc->poll_timer);

The old bt-host driver had:
       devm_iounmap(&pdev->dev, bt_host->base);
       devm_kfree(&pdev->dev, bt_host);

Is there kernel magic that means they aren't needed?

> +	return 0;
> +}
> +
> +static const struct of_device_id bt_bmc_match[] = {
> +	{ .compatible = "aspeed,ast2400-bt-bmc" },
> +	{ },
> +};
> +
> +static struct platform_driver bt_bmc_driver = {
> +	.driver = {
> +		.name		= DEVICE_NAME,
> +		.of_match_table = bt_bmc_match,
> +	},
> +	.probe = bt_bmc_probe,
> +	.remove = bt_bmc_remove,
> +};
> +
> +module_platform_driver(bt_bmc_driver);
> +
> +MODULE_DEVICE_TABLE(of, bt_bmc_match);
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Alistair Popple <alistair@popple.id.au>");
> +MODULE_DESCRIPTION("Linux device interface to the BT interface");
> diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
> index ec10cfef166a..9493842de93b 100644
> --- a/include/uapi/linux/Kbuild
> +++ b/include/uapi/linux/Kbuild
> @@ -74,6 +74,7 @@ header-y += bpf_common.h
>  header-y += bpf.h
>  header-y += bpqether.h
>  header-y += bsg.h
> +header-y += bt-bmc.h
>  header-y += btrfs.h
>  header-y += can.h
>  header-y += capability.h
> diff --git a/include/uapi/linux/bt-bmc.h b/include/uapi/linux/bt-
> bmc.h
> new file mode 100644
> index 000000000000..d9ec766a63d0
> --- /dev/null
> +++ b/include/uapi/linux/bt-bmc.h
> @@ -0,0 +1,18 @@
> +/*
> + * Copyright (c) 2015-2016, IBM Corporation.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#ifndef _UAPI_LINUX_BT_BMC_H
> +#define _UAPI_LINUX_BT_BMC_H
> +
> +#include <linux/ioctl.h>
> +
> +#define __BT_BMC_IOCTL_MAGIC	0xb1
> +#define BT_BMC_IOCTL_SMS_ATN	_IO(__BT_BMC_IOCTL_MAGIC, 0x00)
> +
> +#endif /* _UAPI_LINUX_BT_BMC_H */

  parent reply	other threads:[~2016-11-03  0:56 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26  6:57 [PATCH linux dev-4.7 0/8] BT driver sync up Cédric Le Goater
2016-10-26  6:57 ` [PATCH linux dev-4.7 1/8] Revert "misc: Add Aspeed BT IPMI host driver" Cédric Le Goater
2016-10-26  6:57 ` [PATCH linux dev-4.7 2/8] ARM: aspeed: remove previous definitions in default config Cédric Le Goater
2016-10-26  6:57 ` [PATCH linux dev-4.7 3/8] ARM: dts: aspeed: remove previous iBT definitions Cédric Le Goater
2016-10-26  6:57 ` [PATCH linux dev-4.7 4/8] ipmi: add an Aspeed BT IPMI BMC driver Cédric Le Goater
2016-11-02  0:00   ` Joel Stanley
2016-11-02  7:08     ` Cédric Le Goater
2016-11-03  0:56   ` Cyril Bur [this message]
2016-11-03  2:46     ` Joel Stanley
2016-11-03  2:48       ` Cyril Bur
2016-10-26  6:57 ` [PATCH linux dev-4.7 5/8] ARM: aspeed: Add defconfigs for CONFIG_ASPEED_BT_IPMI_BMC Cédric Le Goater
2016-10-26  6:57 ` [PATCH linux dev-4.7 6/8] ARM: dts: aspeed: Enable BT IPMI BMC device Cédric Le Goater
2016-10-26  6:57 ` [PATCH linux dev-4.7 7/8] ipmi: maintain a request expiry list Cédric Le Goater
2016-11-03  0:26   ` Cyril Bur
2016-11-03  9:06     ` Cédric Le Goater
2016-11-10  7:53       ` Cédric Le Goater
2016-11-03 18:23     ` Patrick Williams
2016-11-03 18:46       ` Cédric Le Goater
2016-11-04  1:55         ` Patrick Williams
2016-11-04  8:09           ` Cédric Le Goater
2016-11-04 18:22             ` Brendan Higgins
2016-11-07  5:25               ` Cédric Le Goater
2016-11-07 15:02                 ` Patrick Williams
2016-11-07 19:29                   ` Brendan Higgins
2016-11-08  9:58                     ` Cédric Le Goater
2016-10-26  6:57 ` [PATCH linux dev-4.7 8/8] ipmi: add a sysfs file for configure maximum response time Cédric Le Goater
2016-11-03  0:30 ` [PATCH linux dev-4.7 0/8] BT driver sync up Cyril Bur
2016-11-10  9:13 ` Cédric Le Goater
2016-11-10 11:33   ` Joel Stanley
2016-11-10 12:04     ` Cédric Le Goater
2016-11-10 12:11       ` Joel Stanley

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=1478134561.728.7.camel@gmail.com \
    --to=cyrilbur@gmail.com \
    --cc=clg@kaod.org \
    --cc=openbmc@lists.ozlabs.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.