All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Carlos Chinea <carlos.chinea@nokia.com>
Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [RFC PATCH 1/5] HSI: Introducing HSI framework
Date: Fri, 23 Apr 2010 10:36:20 -0700	[thread overview]
Message-ID: <20100423103620.e14ba593.randy.dunlap@oracle.com> (raw)
In-Reply-To: <1272035728-6933-2-git-send-email-carlos.chinea@nokia.com>

On Fri, 23 Apr 2010 18:15:24 +0300 Carlos Chinea wrote:

> Adds HSI framework in to the linux kernel.
> 
> High Speed Synchronous Serial Interface (HSI) is a
             ^^^^^^^^^^^
             yes, correct spelling

> serial interface mainly used for connecting application
> engines (APE) with cellular modem engines (CMT) in cellular
> handsets.
> 
> HSI provides multiplexing for up to 16 logical channels,
> low-latency and full duplex communication.
> 
> Signed-off-by: Carlos Chinea <carlos.chinea@nokia.com>
> ---
>  drivers/Kconfig         |    2 +
>  drivers/Makefile        |    1 +
>  drivers/hsi/Kconfig     |   13 ++
>  drivers/hsi/Makefile    |    4 +
>  drivers/hsi/hsi.c       |  487 +++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/hsi/hsi.h |  365 +++++++++++++++++++++++++++++++++++
>  6 files changed, 872 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/hsi/Kconfig
>  create mode 100644 drivers/hsi/Makefile
>  create mode 100644 drivers/hsi/hsi.c
>  create mode 100644 include/linux/hsi/hsi.h
> 

> diff --git a/drivers/hsi/Kconfig b/drivers/hsi/Kconfig
> new file mode 100644
> index 0000000..e122584
> --- /dev/null
> +++ b/drivers/hsi/Kconfig
> @@ -0,0 +1,13 @@
> +#
> +# HSI driver configuration
> +#
> +menuconfig HSI
> +	bool "HSI support"
> +	---help---
> +	  The "High speed syncrhonous Serial Interface" is
                          ~~~~~~~~~~~

> +	  synchrnous serial interface used mainly to connect
	  ~~~~~~~~~~

Fix spelling mistakes (or typos).

> +	  application engines and celluar modems.
> +
> +if HSI
> +
> +endif # HSI

> diff --git a/drivers/hsi/hsi.c b/drivers/hsi/hsi.c
> new file mode 100644
> index 0000000..f6fd777
> --- /dev/null
> +++ b/drivers/hsi/hsi.c
> @@ -0,0 +1,487 @@
> +/*
> + * hsi.c
> + *
> + * HSI core.
> + *
> + * Copyright (C) 2010 Nokia Corporation. All rights reserved.
> + *
> + * Contact: Carlos Chinea <carlos.chinea@nokia.com>
> + */
> +#include <linux/hsi/hsi.h>
> +#include <linux/rwsem.h>

Need
#include <linux/list.h>
for LIST_HEAD().

> +
> +struct hsi_cl_info {
> +	struct list_head	list;
> +	struct hsi_board_info	info;
> +};
> +
> +static LIST_HEAD(hsi_board_list);
> +


> +
> +static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env)

#include <linux/kobject.h>


> +{
> +	add_uevent_var(env, "MODALIAS=hsi:%s", dev_name(dev));
> +
> +	return 0;
> +}
> +
> +static int hsi_bus_match(struct device *dev, struct device_driver *driver)
> +{
> +	return strcmp(dev_name(dev), driver->name) == 0;

string.h

> +}
> +
> +struct bus_type hsi_bus_type = {
> +	.name		= "hsi",
> +	.dev_attrs	= hsi_bus_dev_attrs,
> +	.match		= hsi_bus_match,
> +	.uevent		= hsi_bus_uevent,
> +};
> +
> +static void hsi_client_release(struct device *dev)
> +{
> +	kfree(to_hsi_client(dev));

slab.h

> +}
> +
> +static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info)
> +{
> +	struct hsi_client *cl;
> +
> +	cl = kzalloc(sizeof(*cl), GFP_KERNEL);

slab.h

> +	if (!cl)
> +		return;
> +	cl->device.type = &hsi_cl;
> +	cl->tx_cfg = info->tx_cfg;
> +	cl->rx_cfg = info->rx_cfg;
> +	cl->device.bus = &hsi_bus_type;
> +	cl->device.parent = &port->device;
> +	cl->device.release = hsi_client_release;
> +	dev_set_name(&cl->device, info->name);
> +	cl->device.platform_data = info->platform_data;
> +	if (info->archdata)
> +		cl->device.archdata = *info->archdata;
> +	if (device_register(&cl->device) < 0) {
> +		pr_err("hsi: failed to register client: %s\n", info->name);
> +		kfree(cl);
> +	}
> +}

...



> +/**
> + * hsi_alloc_msg - Allocate an HSI message
> + * @nents: Number of memory entries
> + * @flags: Kernel allocation flags
> + *
> + * NOTE: nents can be 0. This mainly makes sense for read transfer.
> + * In that case, HSI drivers will call the complete callback when
> + * there is data to be read without cosuming it.

                                       consuming

> + *
> + * Return NULL on failure or a pointer to an hsi_msg on success.
> + */
> +struct hsi_msg *hsi_alloc_msg(unsigned int nents, gfp_t flags)
> +{
...
> +}
> +EXPORT_SYMBOL_GPL(hsi_alloc_msg);

...


> +/**
> + * hsi_event -Notifies clients about port events
> + * @port: Port where the event occurred
> + * @event: The event type:
> + *		- HSI_EVENT_START_RX: Incoming wake line high
> + *		- HSI_EVENT_STOP_RX: Incoming wake line down
> + *
> + * Note: Clients should not be concerned about wake line behavior. But due
> + * to a race condition in HSI HW protocol when the wake lines are in used,

                                                                 are in use,

> + * they need to be notified about wake line changes, so they can implement
> + * a workaround for it.
> + */
> +void hsi_event(struct hsi_port *port, unsigned int event)
> +{
...
> +}

> diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
> new file mode 100644
> index 0000000..b272f23
> --- /dev/null
> +++ b/include/linux/hsi/hsi.h
> @@ -0,0 +1,365 @@
> +/*
> + * hsi.h
> + *
> + * HSI core header file.
> + *
> + * Copyright (C) 2010 Nokia Corporation. All rights reserved.
> + *
> + * Contact: Carlos Chinea <carlos.chinea@nokia.com>
> + */
> +
> +#ifndef __LINUX_HSI_H__
> +#define __LINUX_HSI_H__
> +
> +#include <linux/device.h>
> +#include <linux/mutex.h>
> +#include <linux/scatterlist.h>
> +
> +/* HSI message ttype */
> +#define HSI_MSG_READ	0
> +#define HSI_MSG_WRITE	1
> +
> +/* HSI configuration values */
> +#define HSI_MODE_STREAM	1
> +#define HSI_MODE_FRAME	2
> +#define HSI_FLOW_SYNC	0	/* Synchronized flow */
> +#define HSI_FLOW_PIPE	1	/* Pipelined flow */
> +#define HSI_ARB_RR	0	/* Round-robin arbitration */
> +#define HSI_ARB_PRIO	1	/* Channel priority arbitration */
> +
> +#define HSI_MAX_CHANNELS	16

> +/**
> + * struct hsi_client - HSI client attached to an HSI port
> + * @device: Driver model representation of the device
> + * @tx_cfg: HSI TX configuration
> + * @rx_cfg: HSI RX configuration
> + * @hsi_start_rx: Called after incoming wake line goes high
> + * @hsi_stop_rx: Called after incoming wake line goes low
> + * @pclaimed: Set when successfully claimed a port. Internal, do not touch.
> + */
> +struct hsi_client {
> +	struct device		device;
> +	struct hsi_config	tx_cfg;
> +	struct hsi_config	rx_cfg;
> +	void			(*hsi_start_rx)(struct hsi_client *cl);
> +	void			(*hsi_stop_rx)(struct hsi_client *cl);

You can put:
	/* private: */
here and that struct field won't show up in the generated kernel-doc output...

> +	unsigned int		pclaimed:1; /* Private, do not touch */
> +};
> +
> +#define to_hsi_client(dev) container_of(dev, struct hsi_client, device)
> +



---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  reply	other threads:[~2010-04-23 17:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23 15:15 [RFC PATCH 0/5] HSI framework and drivers Carlos Chinea
2010-04-23 15:15 ` [RFC PATCH 1/5] HSI: Introducing HSI framework Carlos Chinea
2010-04-23 17:36   ` Randy Dunlap [this message]
2010-04-23 15:15 ` [RFC PATCH 2/5] OMAP SSI: Introducing OMAP SSI driver Carlos Chinea
2010-04-23 15:15 ` [RFC PATCH 3/5] OMAP SSI: Add OMAP SSI to the kernel configuration Carlos Chinea
2010-04-23 15:15 ` [RFC PATCH 4/5] HSI CHAR: Add HSI char device driver Carlos Chinea
2010-04-23 15:15 ` [RFC PATCH 5/5] HSI CHAR: Add HSI char device kernel configuration Carlos Chinea
2010-04-23 16:02 ` [RFC PATCH 0/5] HSI framework and drivers Paul Walmsley
2010-04-23 19:44   ` Kai.Vehmanen
2010-04-23 19:44     ` Kai.Vehmanen
2010-04-26  9:32     ` Carlos Chinea
2010-04-26  9:32       ` Carlos Chinea

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=20100423103620.e14ba593.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=carlos.chinea@nokia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.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.