[PATCH linux dev-4.10 v4 2/2] drivers: fsi: sbefifo: Add OCC driver

Joel Stanley joel at jms.id.au
Mon Jun 5 17:57:50 AEST 2017


On Sat, Jun 3, 2017 at 3:26 AM, Eddie James <eajames at linux.vnet.ibm.com> wrote:
> From: "Edward A. James" <eajames at us.ibm.com>
>
> This driver provides an atomic communications channel between the OCC on
> the POWER9 processor and a service processor (a BMC). The driver is
> dependent on the FSI SBEFIFO driver to get hardware access to the OCC
> SRAM.
>
> The format of the communication is a command followed by a response.
> Since the command and response must be performed atomically, the driver
> will perform this operations asynchronously. In this way, a write
> operation starts the command, and a read will gather the response data
> once it is complete.
>
> Signed-off-by: Edward A. James <eajames at us.ibm.com>

I applied this to dev-4.10.

Note that there are a number of outstanding issues we must address
before it is considered production quality. I propose we do that
review when you submit it to the upstream lists.

> +
> +static int occ_remove(struct platform_device *pdev)
> +{
> +       struct occ_xfr *xfr, *tmp;
> +       struct occ *occ = platform_get_drvdata(pdev);
> +       struct occ_client *client;

This created some warnings:

drivers/fsi/occ.c: In function ‘occ_remove’:
drivers/fsi/occ.c:735:21: warning: unused variable ‘client’ [-Wunused-variable]
  struct occ_client *client;
                     ^~~~~~
drivers/fsi/occ.c:733:24: warning: unused variable ‘tmp’ [-Wunused-variable]
  struct occ_xfr *xfr, *tmp;
                        ^~~
drivers/fsi/occ.c:733:18: warning: unused variable ‘xfr’ [-Wunused-variable]
  struct occ_xfr *xfr, *tmp;
                  ^~~

I fixed them for you. Please make sure you fix them in your tree
before submitting upstream.

Cheers,

Joel

> +
> +       flush_work(&occ->work);
> +
> +       misc_deregister(&occ->mdev);
> +
> +       device_for_each_child(&pdev->dev, NULL, occ_unregister_child);
> +
> +       ida_simple_remove(&occ_ida, occ->idx);
> +
> +       return 0;
> +}
> +
> +static const struct of_device_id occ_match[] = {
> +       { .compatible = "ibm,p9-occ" },
> +       { },
> +};
> +
> +static struct platform_driver occ_driver = {
> +       .driver = {
> +               .name = "occ",
> +               .of_match_table = occ_match,
> +       },
> +       .probe  = occ_probe,
> +       .remove = occ_remove,
> +};
> +
> +static int occ_init(void)
> +{
> +       occ_wq = create_singlethread_workqueue("occ");
> +       if (!occ_wq)
> +               return -ENOMEM;
> +
> +       return platform_driver_register(&occ_driver);
> +}
> +
> +static void occ_exit(void)
> +{
> +       destroy_workqueue(occ_wq);
> +
> +       platform_driver_unregister(&occ_driver);
> +}
> +
> +module_init(occ_init);
> +module_exit(occ_exit);
> +
> +MODULE_AUTHOR("Eddie James <eajames at us.ibm.com>");
> +MODULE_DESCRIPTION("BMC P9 OCC driver");
> +MODULE_LICENSE("GPL");
> diff --git a/include/linux/occ.h b/include/linux/occ.h
> new file mode 100644
> index 0000000..d78332c
> --- /dev/null
> +++ b/include/linux/occ.h
> @@ -0,0 +1,27 @@
> +/*
> + * Copyright (C) IBM Corporation 2017
> + *
> + * 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
> + * MERGCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __OCC_H__
> +#define __OCC_H__
> +
> +struct device;
> +struct occ_client;
> +
> +extern struct occ_client *occ_drv_open(struct device *dev,
> +                                      unsigned long flags);
> +extern int occ_drv_read(struct occ_client *client, char *buf, size_t len);
> +extern int occ_drv_write(struct occ_client *client, const char *buf,
> +                        size_t len);
> +extern void occ_drv_release(struct occ_client *client);
> +
> +#endif /* __OCC_H__ */
> --
> 1.8.3.1
>


More information about the openbmc mailing list