Prev: init: Provide a kernel start parameter to increase pid_max v2
Next: [PATCH 0/2] genirq: reliably replay pending edge-triggered irq (plus doc)
From: Randy Dunlap on 23 Apr 2010 13:40 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(a)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(a)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(a)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 *** -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Randy Dunlap on 7 May 2010 11:30 On Fri, 7 May 2010 18:18:31 +0300 Carlos Chinea wrote: > Adds HSI framework in to the linux kernel. > > High Speed Synchronous Serial Interface (HSI) is a > 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(a)nokia.com> > --- > drivers/Kconfig | 2 + > drivers/Makefile | 1 + > drivers/hsi/Kconfig | 13 ++ > drivers/hsi/Makefile | 4 + > drivers/hsi/hsi.c | 489 +++++++++++++++++++++++++++++++++++++++++++++++ > include/linux/hsi/hsi.h | 369 +++++++++++++++++++++++++++++++++++ > 6 files changed, 878 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/Kconfig b/drivers/Kconfig > index a2b902f..4fe39f9 100644 > --- a/drivers/Kconfig > +++ b/drivers/Kconfig > @@ -50,6 +50,8 @@ source "drivers/i2c/Kconfig" > > source "drivers/spi/Kconfig" > > +source "drivers/hsi/Kconfig" > + > source "drivers/pps/Kconfig" > > source "drivers/gpio/Kconfig" > diff --git a/drivers/Makefile b/drivers/Makefile > index 2c4f277..24ca5bd 100644 > --- a/drivers/Makefile > +++ b/drivers/Makefile > @@ -45,6 +45,7 @@ obj-$(CONFIG_SCSI) += scsi/ > obj-$(CONFIG_ATA) += ata/ > obj-$(CONFIG_MTD) += mtd/ > obj-$(CONFIG_SPI) += spi/ > +obj-$(CONFIG_HSI) += hsi/ > obj-y += net/ > obj-$(CONFIG_ATM) += atm/ > obj-$(CONFIG_FUSION) += message/ > diff --git a/drivers/hsi/Kconfig b/drivers/hsi/Kconfig > new file mode 100644 > index 0000000..5af62ce > --- /dev/null > +++ b/drivers/hsi/Kconfig > @@ -0,0 +1,13 @@ > +# > +# HSI driver configuration > +# > +menuconfig HSI > + bool "HSI support" Why is this bool instead of tristate? IOW, why can it not be built as a loadable module? > + ---help--- > + The "High speed synchronous Serial Interface" is > + synchronous serial interface used mainly to connect > + application engines and cellular modems. > + > +if HSI > + > +endif # HSI > diff --git a/drivers/hsi/Makefile b/drivers/hsi/Makefile > new file mode 100644 > index 0000000..b42b6cf > --- /dev/null > +++ b/drivers/hsi/Makefile > @@ -0,0 +1,4 @@ > +# > +# Makefile for HSI > +# > +obj-$(CONFIG_HSI) += hsi.o --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Randy Dunlap on 7 May 2010 12:20 On Fri, 07 May 2010 19:11:53 +0300 Carlos Chinea wrote: > Hi, > > On Fri, 2010-05-07 at 17:26 +0200, ext Randy Dunlap wrote: > > On Fri, 7 May 2010 18:18:31 +0300 Carlos Chinea wrote: > > > --[snip]-- > > > > diff --git a/drivers/hsi/Kconfig b/drivers/hsi/Kconfig > > > new file mode 100644 > > > index 0000000..5af62ce > > > --- /dev/null > > > +++ b/drivers/hsi/Kconfig > > > @@ -0,0 +1,13 @@ > > > +# > > > +# HSI driver configuration > > > +# > > > +menuconfig HSI > > > + bool "HSI support" > > > > Why is this bool instead of tristate? > > IOW, why can it not be built as a loadable module? > > > > Because, I have not implemented it yet. I was planning to do it later > on. But of course if it has to be there, I can add the module support > now. OK, it can wait, no hurry. Thanks. > > > > > + ---help--- > > > + The "High speed synchronous Serial Interface" is > > > + synchronous serial interface used mainly to connect > > > + application engines and cellular modems. > > > + > > > +if HSI > > > + > > > +endif # HSI > > > diff --git a/drivers/hsi/Makefile b/drivers/hsi/Makefile > > > new file mode 100644 > > > index 0000000..b42b6cf > > > --- /dev/null > > > +++ b/drivers/hsi/Makefile > > > @@ -0,0 +1,4 @@ > > > +# > > > +# Makefile for HSI > > > +# > > > +obj-$(CONFIG_HSI) += hsi.o > > > > > > --- > > ~Randy > > *** Remember to use Documentation/SubmitChecklist when testing your code *** > > Br, > Carlos > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo(a)vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Carlos Chinea on 7 May 2010 12:20 Hi, On Fri, 2010-05-07 at 17:26 +0200, ext Randy Dunlap wrote: > On Fri, 7 May 2010 18:18:31 +0300 Carlos Chinea wrote: > --[snip]-- > > diff --git a/drivers/hsi/Kconfig b/drivers/hsi/Kconfig > > new file mode 100644 > > index 0000000..5af62ce > > --- /dev/null > > +++ b/drivers/hsi/Kconfig > > @@ -0,0 +1,13 @@ > > +# > > +# HSI driver configuration > > +# > > +menuconfig HSI > > + bool "HSI support" > > Why is this bool instead of tristate? > IOW, why can it not be built as a loadable module? > Because, I have not implemented it yet. I was planning to do it later on. But of course if it has to be there, I can add the module support now. > > > + ---help--- > > + The "High speed synchronous Serial Interface" is > > + synchronous serial interface used mainly to connect > > + application engines and cellular modems. > > + > > +if HSI > > + > > +endif # HSI > > diff --git a/drivers/hsi/Makefile b/drivers/hsi/Makefile > > new file mode 100644 > > index 0000000..b42b6cf > > --- /dev/null > > +++ b/drivers/hsi/Makefile > > @@ -0,0 +1,4 @@ > > +# > > +# Makefile for HSI > > +# > > +obj-$(CONFIG_HSI) += hsi.o > > > --- > ~Randy > *** Remember to use Documentation/SubmitChecklist when testing your code *** Br, Carlos -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Sebastien Jan on 14 May 2010 10:20
Hi Carlos, After review, I do not have many comments on the interface, as we already aligned on most of it. Please see my comments inlined below. On Friday 07 May 2010 17:18:31 Carlos Chinea wrote: [strip] > diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h [strip] > +/** > + * hsi_start_tx - Signal the port that the client wants to start a TX > + * @cl: Pointer to the HSI client > + * > + * Return -errno on failure, 0 on success > + */ > +static inline int hsi_start_tx(struct hsi_client *cl) > +{ > + if (!hsi_port_claimed(cl)) > + return -EACCES; > + return hsi_get_port(cl)->start_tx(cl); > +} > + > +/** > + * hsi_stop_tx - Signal the port that the client no longer wants to > transmit + * @cl: Pointer to the HSI client > + * > + * Return -errno on failure, 0 on success > + */ > +static inline int hsi_stop_tx(struct hsi_client *cl) > +{ > + if (!hsi_port_claimed(cl)) > + return -EACCES; > + return hsi_get_port(cl)->stop_tx(cl); > +} As I can see, these two I/F functions are the way an HSI protocol layer can play with Tx_wake lines if it has to, right? I suppose it allows more flexibility with regards to 3/4 wires HSI flavors management and avoids additional callbacks to Tx_wake related events? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |