Re: [PATCH 2/4] mfd: imanager2: Add Advantech EC APIs support for IT8516/18/28

Lee Jones
2014-07-22T08:37:07Z

On Mon, 14 Jul 2014, Wei-Chun Pan wrote:

You have to write a commit log here. What is this? Why is it needed?
What problem does it solve? What happens if it's not provided? How
is it implemented? Etc etc.

> Signed-off-by: Wei-Chun Pan <weichun.pan@advantech.com.tw>
> ---
> drivers/mfd/imanager2_ec.c | 615 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 615 insertions(+)
> create mode 100644 drivers/mfd/imanager2_ec.c
>
> diff --git a/drivers/mfd/imanager2_ec.c b/drivers/mfd/imanager2_ec.c
> new file mode 100644
> index 0000000..f7a0003
> --- /dev/null
> +++ b/drivers/mfd/imanager2_ec.c
> @@ -0,0 +1,615 @@
> +/*
> + * imanager2_ec.c - MFD accessing driver of Advantech EC IT8516/18/28
> + * Copyright (C) 2014 Richard Vidal-Dorsch <richard.dorsch@advantech.com>
> + *
> + * 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 3 of the License, or
> + * (at your option) any later version.
> + *
> + * 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/>.

I'd prefer if you used the short version.

> + */
> +
> +#include <linux/io.h>
> +#include <linux/delay.h>

I'm sure that you're missing a whole bunch of header files here. You
are to include all files that you make use of in _this_ file.

> +#include <linux/mfd/imanager2_ec.h>

Comment this line out to see what is not defined. At the very least
you will need export.h and err.h.

[...]

> +static int imanager2_read_mailbox(u32 ecflag, u8 offset, u8 *data)
> +{
> + if (ecflag & EC_FLAG_IO_MAILBOX) {
> + int ret = ec_wait_ibc0();
> + if (ret)
> + return ret;
> + inb(EC_IO_PORT_DATA);
> + outb(offset + EC_IO_CMD_READ_OFFSET, EC_IO_PORT_CMD);
> +
> + return ec_inb_after_obf1(data);
> + } else {
> + outb(offset, EC_ITE_PORT_OFS);
> + *data = inb(EC_ITE_PORT_DATA);
> + }
> +
> + return 0;
> +}

All of the Mailbox controller code in this file should live in
drivers/mailbox.

Also, does your Mailbox controller support IRQs?

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog