Skip to contentSkip to conversation

OMAP SSI driver / N900 modem support

PATCH Superseded Sebastian Reichel 4 participants 42 messages Mar 29, 2014 – May 5, 2014

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Sebastian Reichel

author maintainer
#0 lore raw

v3 cover OMAP SSI driver / N900 modem support

Hi,

This is the seventh round of the OMAP SSI driver patches. The plan is to get it merged into 3.16.

Changes since PATCHv2 [0]:
* Readded generic HSI client binding and Nokia N900 modem support. They are also intended to be added in 3.16 and useful for testing the SSI driver, so I think it makes sense to keep them in one patchset.
* Updated the DT binding for the modem. A HSI port has only a single child now, which describes the connected remote device. This better fits the DT model of strictly describing hardware, since a HSI port is a point2point interface. The driver can instantiate other drivers as needed.
* Moved channel description from the drivers into DT.
* I added Signed-off-by: Carlos Chinea <[email protected]> to the omap-ssi and ssi-protocol driver addtions, since the initial driver was from him.
* I updated my email address.
* Added DTS changes to ease reviewing/testing the patchset.

I did *not* implement proper PM for the Nokia N900 modem in kernel space, since that would break all existing userlands (ofono, fso-gsmd and Nokia's closed source binaries). I think this should be implemented later.

Please send feedback (e.g. Tested-By or Reviewed-By :)), so that I can send a pull request for 3.16. You can either apply this patchset or use the n900-modem-support branch available on [1].

For testing the patchset you should build the kernel with all config entries in the HSI subsystem activated and boot using the updated device tree information, since platform data based booting is not supported. Testing the patchset with ofono works like this:

 # provide cmt device for ofono
 ln -sf /sys/bus/hsi/n900-modem /dev/cmt
 # start ofono
 ofono --nodetach --debug
 # enable the modem
 mdbus2 -s org.ofono /n900_0 org.ofono.Modem.SetProperty Powered true
 # enable modem's RF parts
 mdbus2 -s org.ofono /n900_0 org.ofono.Modem.SetProperty Online true
 # scan for available networks (takes some time)
 mdbus2 -s org.ofono /n900_0 org.ofono.NetworkRegistration.Scan

TODO (post-merge):
* Central Message Queue
I did not yet implement a central message queue in the HSI framework. I will do this after Nokia N900 modem is working in the mainline kernel.
* Remove the hwmod DT hack
This depends on some future work merging hwmod data into DT.
* Implement proper context loss detection
* Implement N900 modem PM

[0] https://lkml.org/lkml/2014/3/9/139
[1] git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git

-- Sebastian

Sebastian Reichel (14):
Documentation: HSI: Add some general description for the HSI subsystem
MAINTAINERS: update HSI entry
HSI: hsi-char: fix driver for multiport scenarios
HSI: method to unregister clients from an hsi port
HSI: Add channel resource support to HSI clients
HSI: export method to (un)register clients
HSI: Add common DT binding for HSI client devices
HSI: Introduce OMAP SSI driver
Documentation: DT: omap-ssi binding documentation
HSI: Introduce driver for SSI Protocol
HSI: Introduce Nokia N900 modem driver
ARM: dts: omap3 clocks: simplify ssi aliases
DTS: ARM: OMAP3-N900: Add SSI support
DTS: ARM: OMAP3-N900: Add modem support

 .../devicetree/bindings/hsi/client-devices.txt     |   44 +
 .../devicetree/bindings/hsi/nokia-modem.txt        |   58 +
 Documentation/devicetree/bindings/hsi/omap-ssi.txt |   85 ++
 Documentation/hsi.txt                              |   75 ++
 MAINTAINERS                                        |    4 +-
 arch/arm/boot/dts/omap3-n900.dts                   |   65 +
 arch/arm/boot/dts/omap3.dtsi                       |   55 +
 arch/arm/boot/dts/omap3430es1-clocks.dtsi          |   10 +-
 arch/arm/boot/dts/omap34xx.dtsi                    |   11 +
 .../boot/dts/omap36xx-omap3430es2plus-clocks.dtsi  |   10 +-
 arch/arm/boot/dts/omap36xx.dtsi                    |   11 +
 drivers/hsi/Kconfig                                |    1 +
 drivers/hsi/Makefile                               |    1 +
 drivers/hsi/clients/Kconfig                        |   17 +
 drivers/hsi/clients/Makefile                       |    4 +-
 drivers/hsi/clients/hsi_char.c                     |   14 +-
 drivers/hsi/clients/nokia-modem.c                  |  272 ++++
 drivers/hsi/clients/ssi_protocol.c                 | 1188 +++++++++++++++++
 drivers/hsi/controllers/Kconfig                    |   19 +
 drivers/hsi/controllers/Makefile                   |    6 +
 drivers/hsi/controllers/omap_ssi.c                 |  621 +++++++++
 drivers/hsi/controllers/omap_ssi.h                 |  166 +++
 drivers/hsi/controllers/omap_ssi_port.c            | 1401 ++++++++++++++++++++
 drivers/hsi/controllers/omap_ssi_regs.h            |  171 +++
 drivers/hsi/hsi.c                                  |  267 +++-
 include/linux/hsi/hsi.h                            |   30 +-
 include/linux/hsi/ssi_protocol.h                   |   42 +
 27 files changed, 4619 insertions(+), 29 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hsi/client-devices.txt
 create mode 100644 Documentation/devicetree/bindings/hsi/nokia-modem.txt
 create mode 100644 Documentation/devicetree/bindings/hsi/omap-ssi.txt
 create mode 100644 Documentation/hsi.txt
 create mode 100644 drivers/hsi/clients/nokia-modem.c
 create mode 100644 drivers/hsi/clients/ssi_protocol.c
 create mode 100644 drivers/hsi/controllers/Kconfig
 create mode 100644 drivers/hsi/controllers/Makefile
 create mode 100644 drivers/hsi/controllers/omap_ssi.c
 create mode 100644 drivers/hsi/controllers/omap_ssi.h
 create mode 100644 drivers/hsi/controllers/omap_ssi_port.c
 create mode 100644 drivers/hsi/controllers/omap_ssi_regs.h
 create mode 100644 include/linux/hsi/ssi_protocol.h
Signature · 1 line
1.9.0
author maintainer
#1 lore raw

PATCH v3 1/14 Documentation: HSI: Add some general description for the HSI subsystem

Add a document, which gives a rough introduction about what HSI is and how its handled by the Linux kernel.

---
 Documentation/hsi.txt | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/hsi.txt
Documentation/hsi.txt new file +75 -0
new file mode 100644
index 0000000..6ac6cd5
@@ -0,0 +1,75 @@
+HSI - High-speed Synchronous Serial Interface
+
+1. Introduction
+~~~~~~~~~~~~~~~
+
+High Speed Syncronous Interface (HSI) is a fullduplex, low latency protocol,
+that is optimized for die-level interconnect between an Application Processor
+and a Baseband chipset. It has been specified by the MIPI alliance in 2003 and
+implemented by multiple vendors since then.
+
+The HSI interface supports full duplex communication over multiple channels
+(typically 8) and is capable of reaching speeds up to 200 Mbit/s.
+
+The serial protocol uses two signals, DATA and FLAG as combined data and clock
+signals and an additional READY signal for flow control. An additional WAKE
+signal can be used to wakeup the chips from standby modes. The signals are
+commonly prefixed by AC for signals going from the application die to the
+cellular die and CA for signals going the other way around.
+
++------------+                                 +---------------+
+|  Cellular  |                                 |  Application  |
+|    Die     |                                 |      Die      |
+|            | - - - - - - CAWAKE - - - - - - >|               |
+|           T|------------ CADATA ------------>|R              |
+|           X|------------ CAFLAG ------------>|X              |
+|            |<----------- ACREADY ------------|               |
+|            |                                 |               |
+|            |                                 |               |
+|            |< - - - - -  ACWAKE - - - - - - -|               |
+|           R|<----------- ACDATA -------------|T              |
+|           X|<----------- ACFLAG -------------|X              |
+|            |------------ CAREADY ----------->|               |
+|            |                                 |               |
+|            |                                 |               |
++------------+                                 +---------------+
+
+2. HSI Subsystem in Linux
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In the Linux kernel the hsi subsystem is supposed to be used for HSI devices.
+The hsi subsystem contains drivers for hsi controllers including support for
+multi-port controllers and provides a generic API for using the HSI ports.
+
+It also contains HSI client drivers, which make use of the generic API to
+implement a protocol used on the HSI interface. These client drivers can
+use an arbitrary number of channels.
+
+3. hsi-char Device
+~~~~~~~~~~~~~~~~~~
+
+Each port automatically registers a generic client driver called hsi_char,
+which provides a charecter device for userspace representing the HSI port.
+It can be used to communicate via HSI from userspace. Userspace may
+configure the hsi_char device using the following ioctl commands:
+
+* HSC_RESET:
+ - flush the HSI port
+
+* HSC_SET_PM
+ - enable or disable the client.
+
+* HSC_SEND_BREAK
+ - send break
+
+* HSC_SET_RX
+ - set RX configuration
+
+* HSC_GET_RX
+ - get RX configuration
+
+* HSC_SET_TX
+ - set TX configuration
+
+* HSC_GET_TX
+ - get TX configuration
Signature · 1 line
1.9.0
Reviewed-by on v3 1/14
#2 lore raw

Re: [PATCHv3 01/14] Documentation: HSI: Add some general description for the HSI subsystem

Quoted 4 lines · Sebastian Reichel

Add a document, which gives a rough introduction about what HSI is and how its handled by the Linux kernel.

Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#3 lore raw

PATCH v3 2/14 MAINTAINERS: update HSI entry

In reply to Sebastian Reichel

Add git tree for hsi subsystem, update Sebastian Reichel's e-mail address and add Documentation/hsi.txt as maintained file.

---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
MAINTAINERS +3 -1
index 82640e6..b376b79 100644
@@ -4117,9 +4117,11 @@ S:	Maintained
 F:	fs/hpfs/
 
 HSI SUBSYSTEM
-M:	Sebastian Reichel <[email protected]>
+M:	Sebastian Reichel <[email protected]>
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git
 S:	Maintained
 F:	Documentation/ABI/testing/sysfs-bus-hsi
+F:	Documentation/hsi.txt
 F:	drivers/hsi/
 F:	include/linux/hsi/
 F:	include/uapi/linux/hsi/
Signature · 1 line
1.9.0
Reviewed-by on v3 2/14
#4 lore raw

Re: [PATCHv3 02/14] MAINTAINERS: update HSI entry

Quoted 4 lines · Sebastian Reichel

Add git tree for hsi subsystem, update Sebastian Reichel's e-mail address and add Documentation/hsi.txt as maintained file.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author maintainer
#5 lore raw

PATCH v3 3/14 HSI: hsi-char: fix driver for multiport scenarios

In reply to Sebastian Reichel

Fix return code check of alloc_chrdev_region, which returns 0 on success.

---
 drivers/hsi/clients/hsi_char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hsi/clients/hsi_char.c +1 -1
index e61e5f9..3073320 100644
@@ -705,7 +705,7 @@ static int hsc_probe(struct device *dev)
 	if (!hsc_major) {
 		ret = alloc_chrdev_region(&hsc_dev, hsc_baseminor,
 						HSC_DEVS, devname);
-		if (ret > 0)
+		if (ret == 0)
 			hsc_major = MAJOR(hsc_dev);
 	} else {
 		hsc_dev = MKDEV(hsc_major, hsc_baseminor);
Signature · 1 line
1.9.0
Reviewed-by on v3 3/14
#6 lore raw

Re: [PATCHv3 03/14] HSI: hsi-char: fix driver for multiport scenarios

Quoted 4 lines · Sebastian Reichel

Fix return code check of alloc_chrdev_region, which returns 0 on success.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author maintainer
#7 lore raw

PATCH v3 4/14 HSI: method to unregister clients from an hsi port

In reply to Sebastian Reichel

This exports a method to unregister all clients from an hsi port.

---
 drivers/hsi/hsi.c       | 10 ++++++++++
 include/linux/hsi/hsi.h |  1 +
 2 files changed, 11 insertions(+)
drivers/hsi/hsi.c +10 -0
index 749f7b5..e96a987 100644
@@ -130,6 +130,16 @@ static void hsi_port_release(struct device *dev)
 }
 
 /**
+ * hsi_unregister_port - Unregister an HSI port
+ * @port: The HSI port to unregister
+ */
+void hsi_port_unregister_clients(struct hsi_port *port)
+{
+	device_for_each_child(&port->device, NULL, hsi_remove_client);
+}
+EXPORT_SYMBOL_GPL(hsi_port_unregister_clients);
+
+/**
  * hsi_unregister_controller - Unregister an HSI controller
  * @hsi: The HSI controller to register
  */
include/linux/hsi/hsi.h +1 -0
index 0dca785..2b1912f 100644
@@ -282,6 +282,7 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags);
 void hsi_put_controller(struct hsi_controller *hsi);
 int hsi_register_controller(struct hsi_controller *hsi);
 void hsi_unregister_controller(struct hsi_controller *hsi);
+void hsi_port_unregister_clients(struct hsi_port *port);
 
 static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi,
 								void *data)
Signature · 1 line
1.9.0
Reviewed-by on v3 4/14
#8 lore raw

Re: [PATCHv3 04/14] HSI: method to unregister clients from an hsi port

Quoted 4 lines · Sebastian Reichel

This exports a method to unregister all clients from an hsi port.

Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#9 lore raw

PATCH v3 5/14 HSI: Add channel resource support to HSI clients

In reply to Sebastian Reichel

Make HSI channel ids platform data, which can be provided by platform data.

---
 drivers/hsi/clients/hsi_char.c | 12 +++++------
 drivers/hsi/hsi.c              | 49 +++++++++++++++++++++++++++++++++++++++++-
 include/linux/hsi/hsi.h        | 24 +++++++++++++++++----
 3 files changed, 74 insertions(+), 11 deletions(-)
drivers/hsi/clients/hsi_char.c +6 -6
index 3073320..57f70c2 100644
@@ -367,7 +367,7 @@ static int hsc_rx_set(struct hsi_client *cl, struct hsc_rx_config *rxc)
 		return -EINVAL;
 	tmp = cl->rx_cfg;
 	cl->rx_cfg.mode = rxc->mode;
-	cl->rx_cfg.channels = rxc->channels;
+	cl->rx_cfg.num_hw_channels = rxc->channels;
 	cl->rx_cfg.flow = rxc->flow;
 	ret = hsi_setup(cl);
 	if (ret < 0) {
@@ -383,7 +383,7 @@ static int hsc_rx_set(struct hsi_client *cl, struct hsc_rx_config *rxc)
 static inline void hsc_rx_get(struct hsi_client *cl, struct hsc_rx_config *rxc)
 {
 	rxc->mode = cl->rx_cfg.mode;
-	rxc->channels = cl->rx_cfg.channels;
+	rxc->channels = cl->rx_cfg.num_hw_channels;
 	rxc->flow = cl->rx_cfg.flow;
 }
 
@@ -402,7 +402,7 @@ static int hsc_tx_set(struct hsi_client *cl, struct hsc_tx_config *txc)
 		return -EINVAL;
 	tmp = cl->tx_cfg;
 	cl->tx_cfg.mode = txc->mode;
-	cl->tx_cfg.channels = txc->channels;
+	cl->tx_cfg.num_hw_channels = txc->channels;
 	cl->tx_cfg.speed = txc->speed;
 	cl->tx_cfg.arb_mode = txc->arb_mode;
 	ret = hsi_setup(cl);
@@ -417,7 +417,7 @@ static int hsc_tx_set(struct hsi_client *cl, struct hsc_tx_config *txc)
 static inline void hsc_tx_get(struct hsi_client *cl, struct hsc_tx_config *txc)
 {
 	txc->mode = cl->tx_cfg.mode;
-	txc->channels = cl->tx_cfg.channels;
+	txc->channels = cl->tx_cfg.num_hw_channels;
 	txc->speed = cl->tx_cfg.speed;
 	txc->arb_mode = cl->tx_cfg.arb_mode;
 }
@@ -435,7 +435,7 @@ static ssize_t hsc_read(struct file *file, char __user *buf, size_t len,
 		return -EINVAL;
 	if (len > max_data_size)
 		len = max_data_size;
-	if (channel->ch >= channel->cl->rx_cfg.channels)
+	if (channel->ch >= channel->cl->rx_cfg.num_hw_channels)
 		return -ECHRNG;
 	if (test_and_set_bit(HSC_CH_READ, &channel->flags))
 		return -EBUSY;
@@ -492,7 +492,7 @@ static ssize_t hsc_write(struct file *file, const char __user *buf, size_t len,
 		return -EINVAL;
 	if (len > max_data_size)
 		len = max_data_size;
-	if (channel->ch >= channel->cl->tx_cfg.channels)
+	if (channel->ch >= channel->cl->tx_cfg.num_hw_channels)
 		return -ECHRNG;
 	if (test_and_set_bit(HSC_CH_WRITE, &channel->flags))
 		return -EBUSY;
drivers/hsi/hsi.c +48 -1

72 lines not on this page · raw message

include/linux/hsi/hsi.h +20 -4
index 2b1912f..50a85a9 100644
@@ -68,17 +68,31 @@ enum {
 };
 
 /**
+ * struct hsi_channel - channel resource used by the hsi clients
+ * @id: Channel number
+ * @name: Channel name
+ */
+struct hsi_channel {
+	unsigned int	id;
+	const char	*name;
+};
+
+/**
  * struct hsi_config - Configuration for RX/TX HSI modules
  * @mode: Bit transmission mode (STREAM or FRAME)
- * @channels: Number of channels to use [1..16]
+ * @channels: Channel resources used by the client
+ * @num_channels: Number of channel resources
+ * @num_hw_channels: Number of channels the transceiver is configured for [1..16]
  * @speed: Max bit transmission speed (Kbit/s)
  * @flow: RX flow type (SYNCHRONIZED or PIPELINE)
  * @arb_mode: Arbitration mode for TX frame (Round robin, priority)
  */
 struct hsi_config {
-	unsigned int	mode;
-	unsigned int	channels;
-	unsigned int	speed;
+	unsigned int		mode;
+	struct hsi_channel	*channels;
+	unsigned int		num_channels;
+	unsigned int		num_hw_channels;
+	unsigned int		speed;
 	union {
 		unsigned int	flow;		/* RX only */
 		unsigned int	arb_mode;	/* TX only */
@@ -306,6 +320,8 @@ static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi,
  */
 int hsi_async(struct hsi_client *cl, struct hsi_msg *msg);
 
+int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name);
+
 /**
  * hsi_id - Get HSI controller ID associated to a client
  * @cl: Pointer to a HSI client
Signature · 1 line
1.9.0
#10 lore raw

Re: [PATCHv3 05/14] HSI: Add channel resource support to HSI clients

Hi!

Quoted 6 lines

Make HSI channel ids platform data, which can be provided by platform data.

static void hsi_client_release(struct device *dev) {

drivers/hsi/hsi.c static struct bus_type hsi_bus_type = { · line 72

Quoted 9 lines
drivers/hsi/hsi.c +8 -1
-	kfree(to_hsi_client(dev));
+	struct hsi_client *cl = to_hsi_client(dev);
+
+	if (cl->tx_cfg.channels)
+		kfree(cl->tx_cfg.channels);
+	if (cl->rx_cfg.channels && cl->rx_cfg.channels != cl->tx_cfg.channels)
+		kfree(cl->rx_cfg.channels);
+
+	kfree(cl);

Can cl->rx_cfg.channels == cl->tx_cfg.channels happen? That seems like quite a hack :-(.
Pavel

Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#11 lore raw

Re: [PATCHv3 05/14] HSI: Add channel resource support to HSI clients

Quoted 6 lines · Pavel Machek

Hi!

Quoted 3 lines

Make HSI channel ids platform data, which can be provided by platform data.

Quoted 14 lines

drivers/hsi/hsi.c static struct bus_type hsi_bus_type = { · line 72

Quoted 11 lines

static void hsi_client_release(struct device *dev) {

drivers/hsi/hsi.c +8 -1
-	kfree(to_hsi_client(dev));
+	struct hsi_client *cl = to_hsi_client(dev);
+
+	if (cl->tx_cfg.channels)
+		kfree(cl->tx_cfg.channels);
+	if (cl->rx_cfg.channels && cl->rx_cfg.channels != cl->tx_cfg.channels)
+		kfree(cl->rx_cfg.channels);
+
+	kfree(cl);

Can cl->rx_cfg.channels == cl->tx_cfg.channels happen? That seems like quite a hack :-(.

Yes it could happen. I have updated this for PATCHv4 (so that it can no longer happen).

-- Sebastian

author maintainer
#12 lore raw

PATCH v3 6/14 HSI: export method to (un)register clients

In reply to Sebastian Reichel

Expose method for registering and unregistering HSI clients, so that client drivers can register other client drivers.

This is useful for HSI drivers, which want to use the functionality of other HSI drivers. For example the N900 modem driver can load HSI drivers for mcsaab protocol and speech protocol.

---
 drivers/hsi/hsi.c       | 11 ++++++++---
 include/linux/hsi/hsi.h |  3 +++
 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/hsi/hsi.c +8 -3
index 9d1130d..07e1639 100644
@@ -72,14 +72,15 @@ static void hsi_client_release(struct device *dev)
 	kfree(cl);
 }
 
-static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info)
+struct hsi_client *hsi_new_client(struct hsi_port *port,
+						struct hsi_board_info *info)
 {
 	struct hsi_client *cl;
 	size_t size;
 
 	cl = kzalloc(sizeof(*cl), GFP_KERNEL);
 	if (!cl)
-		return;
+		return NULL;
 
 	cl->tx_cfg = info->tx_cfg;
 	if (cl->tx_cfg.channels) {
@@ -106,7 +107,10 @@ static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info)
 		pr_err("hsi: failed to register client: %s\n", info->name);
 		put_device(&cl->device);
 	}
+
+	return cl;
 }
+EXPORT_SYMBOL_GPL(hsi_new_client);
 
 static void hsi_scan_board_info(struct hsi_controller *hsi)
 {
@@ -122,12 +126,13 @@ static void hsi_scan_board_info(struct hsi_controller *hsi)
 		}
 }
 
-static int hsi_remove_client(struct device *dev, void *data __maybe_unused)
+int hsi_remove_client(struct device *dev, void *data __maybe_unused)
 {
 	device_unregister(dev);
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(hsi_remove_client);
 
 static int hsi_remove_port(struct device *dev, void *data __maybe_unused)
 {
include/linux/hsi/hsi.h +3 -0
index 50a85a9..57ee40f 100644
@@ -296,6 +296,9 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags);
 void hsi_put_controller(struct hsi_controller *hsi);
 int hsi_register_controller(struct hsi_controller *hsi);
 void hsi_unregister_controller(struct hsi_controller *hsi);
+struct hsi_client *hsi_new_client(struct hsi_port *port,
+						struct hsi_board_info *info);
+int hsi_remove_client(struct device *dev, void *data);
 void hsi_port_unregister_clients(struct hsi_port *port);
 
 static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi,
Signature · 1 line
1.9.0
Reviewed-by on v3 6/14
#13 lore raw

Re: [PATCHv3 06/14] HSI: export method to (un)register clients

Quoted 8 lines · Sebastian Reichel

Expose method for registering and unregistering HSI clients, so that client drivers can register other client drivers.

This is useful for HSI drivers, which want to use the functionality of other HSI drivers. For example the N900 modem driver can load HSI drivers for mcsaab protocol and speech protocol.

Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#14 lore raw

PATCH v3 7/14 HSI: Add common DT binding for HSI client devices

In reply to Sebastian Reichel

Implement and document generic DT bindings for HSI clients.

---
 .../devicetree/bindings/hsi/client-devices.txt     |  44 +++++
 drivers/hsi/hsi.c                                  | 197 ++++++++++++++++++++-
 include/linux/hsi/hsi.h                            |   2 +
 3 files changed, 241 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hsi/client-devices.txt
Documentation/devicetree/bindings/hsi/client-devices.txt new file +44 -0
new file mode 100644
index 0000000..7504cb1
@@ -0,0 +1,44 @@
+Each HSI port is supposed to have one child node, which
+symbols the remote device connected to the HSI port. The
+following properties are standardized for HSI clients:
+
+Required HSI configuration properties:
+
+- reg:			A list of channel ids
+
+- hsi-rx-mode:		Receiver Bit transmission mode ("stream" or "frame")
+- hsi-tx-mode:		Transmitter Bit transmission mode ("stream" or "frame")
+- hsi-mode:		May be used instead hsi-rx-mode and hsi-tx-mode if
+			the transmission mode is the same for receiver and
+			transmitter
+- hsi-speed-kbps:	Max bit transmission speed in kbit/s
+- hsi-flow:		RX flow type ("synchronized" or "pipeline")
+- hsi-arb-mode:		Arbitration mode for TX frame ("round-robin", "priority")
+
+Optional HSI configuration properties:
+
+- reg-names:		A list with one name per channel specified in the
+			reg property
+
+
+Device Tree node example for an HSI client:
+
+hsi-controller {
+	hsi-port {
+		modem: hsi-client {
+			compatible = "nokia,n900-modem";
+
+			reg = <0>, <1>, <2>, <3>;
+			reg-names = "mcsaab-control",
+				    "speech-control",
+				    "speech-data",
+				    "mcsaab-data";
+			hsi-speed-kbps = <55000>;
+			hsi-mode = "frame";
+			hsi-flow = "synchronized";
+			hsi-arb-mode = "round-robin";
+
+			/* more client specific properties */
+		};
+	};
+};
drivers/hsi/hsi.c +195 -2

223 lines not on this page · raw message

include/linux/hsi/hsi.h +2 -0
index 57ee40f..610c6f9 100644
@@ -298,6 +298,8 @@ int hsi_register_controller(struct hsi_controller *hsi);
 void hsi_unregister_controller(struct hsi_controller *hsi);
 struct hsi_client *hsi_new_client(struct hsi_port *port,
 						struct hsi_board_info *info);
+void hsi_add_clients_from_dt(struct hsi_port *port,
+						struct device_node *clients);
 int hsi_remove_client(struct device *dev, void *data);
 void hsi_port_unregister_clients(struct hsi_port *port);
 
Signature · 1 line
1.9.0
Reviewed-by on v3 7/14
#15 lore raw

Re: [PATCHv3 07/14] HSI: Add common DT binding for HSI client devices

Quoted 3 lines · Sebastian Reichel

Implement and document generic DT bindings for HSI clients.

Quoted 14 lines
drivers/hsi/hsi.c +3 -0
index 07e1639..5973906 100644
@@ -26,8 +26,14 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include "hsi_core.h"
 
 
+	err = hsi_of_property_parse_mode(client, "hsi-mode", &mode);

drivers/hsi/hsi.c

Quoted 10 lines
drivers/hsi/hsi.c +10 -0
+	if (err) {
+		err = hsi_of_property_parse_mode(client, "hsi-rx-mode",
+						 &cl->rx_cfg.mode);
+		if (err)
+			goto err;
+
+		err = hsi_of_property_parse_mode(client, "hsi-tx-mode",
+						 &cl->tx_cfg.mode);
+		if (err)
+			goto err;

Will this need some #ifdef CONFIG_OF?

Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#16 lore raw

Re: [PATCHv3 07/14] HSI: Add common DT binding for HSI client devices

Quoted 20 lines · Pavel Machek
Quoted 3 lines · Sebastian Reichel

Implement and document generic DT bindings for HSI clients.

Quoted 11 lines
drivers/hsi/hsi.c +2 -0
index 07e1639..5973906 100644
@@ -26,8 +26,14 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include "hsi_core.h"
Quoted 13 lines

drivers/hsi/hsi.c static void hsi_scan_board_info(struct hsi_controller *hsi) · line 230

Quoted 11 lines
drivers/hsi/hsi.c +11 -0
+	err = hsi_of_property_parse_mode(client, "hsi-mode", &mode);
+	if (err) {
+		err = hsi_of_property_parse_mode(client, "hsi-rx-mode",
+						 &cl->rx_cfg.mode);
+		if (err)
+			goto err;
+
+		err = hsi_of_property_parse_mode(client, "hsi-tx-mode",
+						 &cl->tx_cfg.mode);
+		if (err)
+			goto err;

Will this need some #ifdef CONFIG_OF?

It would only be needed to reduce the amount of kernel code for disabled Device Tree. I don't think its worth it, since there is no platform in the mainline kernel, which uses HSI without DT.

-- Sebastian

author maintainer
#17 lore raw

Re: [PATCHv3 07/14] HSI: Add common DT binding for HSI client devices

Quoted 35 lines · Sebastian Reichel
Quoted 20 lines · Pavel Machek
Quoted 3 lines · Sebastian Reichel

Implement and document generic DT bindings for HSI clients.

Quoted 11 lines
drivers/hsi/hsi.c +2 -0
index 07e1639..5973906 100644
@@ -26,8 +26,14 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include "hsi_core.h"
Quoted 13 lines

drivers/hsi/hsi.c static void hsi_scan_board_info(struct hsi_controller *hsi) · line 230

Quoted 11 lines
drivers/hsi/hsi.c +11 -0
+	err = hsi_of_property_parse_mode(client, "hsi-mode", &mode);
+	if (err) {
+		err = hsi_of_property_parse_mode(client, "hsi-rx-mode",
+						 &cl->rx_cfg.mode);
+		if (err)
+			goto err;
+
+		err = hsi_of_property_parse_mode(client, "hsi-tx-mode",
+						 &cl->tx_cfg.mode);
+		if (err)
+			goto err;

Will this need some #ifdef CONFIG_OF?

Quoted 3 lines

It would only be needed to reduce the amount of kernel code for disabled Device Tree. I don't think its worth it, since there is no platform in the mainline kernel, which uses HSI without DT.

mh actually it is needed, since there is no stub provided for of_modalias_node in non DT mode (there are stubs for all other of_* methods used). I will include the ifdef in PATCHv5.

-- Sebastian

#18 lore raw

Re: [PATCHv3 07/14] HSI: Add common DT binding for HSI client devices

Quoted 36 lines · Sebastian Reichel
Quoted 35 lines · Sebastian Reichel
Quoted 33 lines · Pavel Machek
Quoted 3 lines · Sebastian Reichel

Implement and document generic DT bindings for HSI clients.

Quoted 14 lines
drivers/hsi/hsi.c +3 -0
index 07e1639..5973906 100644
@@ -26,8 +26,14 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include "hsi_core.h"
 
 
+	err = hsi_of_property_parse_mode(client, "hsi-mode", &mode);

drivers/hsi/hsi.c

Quoted 10 lines
drivers/hsi/hsi.c +10 -0
+	if (err) {
+		err = hsi_of_property_parse_mode(client, "hsi-rx-mode",
+						 &cl->rx_cfg.mode);
+		if (err)
+			goto err;
+
+		err = hsi_of_property_parse_mode(client, "hsi-tx-mode",
+						 &cl->tx_cfg.mode);
+		if (err)
+			goto err;

Will this need some #ifdef CONFIG_OF?

Quoted 7 lines
Quoted 3 lines

It would only be needed to reduce the amount of kernel code for disabled Device Tree. I don't think its worth it, since there is no platform in the mainline kernel, which uses HSI without DT.

mh actually it is needed, since there is no stub provided for of_modalias_node in non DT mode (there are stubs for all other of_* methods used). I will include the ifdef in PATCHv5.

Alternatively, you can make driver depend on DT...

Thanks,
Pavel

Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#19 lore raw

Re: [PATCHv3 07/14] HSI: Add common DT binding for HSI client devices

Quoted 41 lines · Pavel Machek
Quoted 40 lines · Sebastian Reichel
Quoted 38 lines · Sebastian Reichel
Quoted 20 lines · Pavel Machek
Quoted 3 lines · Sebastian Reichel

Implement and document generic DT bindings for HSI clients.

Quoted 11 lines
drivers/hsi/hsi.c +2 -0
index 07e1639..5973906 100644
@@ -26,8 +26,14 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/notifier.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include "hsi_core.h"
Quoted 13 lines

drivers/hsi/hsi.c static void hsi_scan_board_info(struct hsi_controller *hsi) · line 230

Quoted 11 lines
drivers/hsi/hsi.c +11 -0
+	err = hsi_of_property_parse_mode(client, "hsi-mode", &mode);
+	if (err) {
+		err = hsi_of_property_parse_mode(client, "hsi-rx-mode",
+						 &cl->rx_cfg.mode);
+		if (err)
+			goto err;
+
+		err = hsi_of_property_parse_mode(client, "hsi-tx-mode",
+						 &cl->tx_cfg.mode);
+		if (err)
+			goto err;

Will this need some #ifdef CONFIG_OF?

It would only be needed to reduce the amount of kernel code for disabled Device Tree. I don't think its worth it, since there is no platform in the mainline kernel, which uses HSI without DT.

Quoted 5 lines
Quoted 3 lines

mh actually it is needed, since there is no stub provided for of_modalias_node in non DT mode (there are stubs for all other of_* methods used). I will include the ifdef in PATCHv5.

Alternatively, you can make driver depend on DT...

I would be ok with making individual HSI client or controller drivers dependent on DT, but I don't think its a good idea to make the whole HSI framework dependent on DT.

-- Sebastian

#20 lore raw

Re: [PATCHv3 07/14] HSI: Add common DT binding for HSI client devices

In reply to Sebastian Reichel
Quoted 3 lines · Sebastian Reichel

Implement and document generic DT bindings for HSI clients.

Seems pretty reasonable although I know little about HSI.

Quoted 32 lines
---
 .../devicetree/bindings/hsi/client-devices.txt     |  44 +++++
 drivers/hsi/hsi.c                                  | 197 ++++++++++++++++++++-
 include/linux/hsi/hsi.h                            |   2 +
 3 files changed, 241 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hsi/client-devices.txt
Documentation/devicetree/bindings/hsi/client-devices.txt new file +19 -0
new file mode 100644
index 0000000..7504cb1
@@ -0,0 +1,44 @@
+Each HSI port is supposed to have one child node, which
+symbols the remote device connected to the HSI port. The
+following properties are standardized for HSI clients:
+
+Required HSI configuration properties:
+
+- reg:                 A list of channel ids
+
+- hsi-rx-mode:         Receiver Bit transmission mode ("stream" or "frame")
+- hsi-tx-mode:         Transmitter Bit transmission mode ("stream" or "frame")
+- hsi-mode:            May be used instead hsi-rx-mode and hsi-tx-mode if
+                       the transmission mode is the same for receiver and
+                       transmitter
+- hsi-speed-kbps:      Max bit transmission speed in kbit/s
+- hsi-flow:            RX flow type ("synchronized" or "pipeline")
+- hsi-arb-mode:                Arbitration mode for TX frame ("round-robin", "priority")
+
+Optional HSI configuration properties:
+

Documentation/devicetree/bindings/hsi/client-devices.txt line 29

Quoted 10 lines
Documentation/devicetree/bindings/hsi/client-devices.txt new file +10 -0
+- reg-names:           A list with one name per channel specified in the
+                       reg property
+
+
+Device Tree node example for an HSI client:
+
+hsi-controller {
+       hsi-port {
+               modem: hsi-client {
+                       compatible = "nokia,n900-modem";

Is there only 1 version of HSI? If not, then perhaps you need to know what version a client is.

Documentation/devicetree/bindings/hsi/client-devices.txt line 31

Quoted 2 lines
Documentation/devicetree/bindings/hsi/client-devices.txt new file +2 -0
+
+                       reg = <0>, <1>, <2>, <3>;

Where do these numbers get defined? Are they always 0-N?

I don't see much advantage to using reg. Perhaps something like hsi-channel-ids would be better.

Rob

author maintainer
#21 lore raw

Re: [PATCHv3 07/14] HSI: Add common DT binding for HSI client devices

Quoted 6 lines · Rob Herring
Quoted 3 lines · Sebastian Reichel

Implement and document generic DT bindings for HSI clients.

Seems pretty reasonable although I know little about HSI.

ok.

Quoted 37 lines
Quoted 37 lines
---
 .../devicetree/bindings/hsi/client-devices.txt     |  44 +++++
 drivers/hsi/hsi.c                                  | 197 ++++++++++++++++++++-
 include/linux/hsi/hsi.h                            |   2 +
 3 files changed, 241 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hsi/client-devices.txt
Documentation/devicetree/bindings/hsi/client-devices.txt new file +24 -0
new file mode 100644
index 0000000..7504cb1
@@ -0,0 +1,44 @@
+Each HSI port is supposed to have one child node, which
+symbols the remote device connected to the HSI port. The
+following properties are standardized for HSI clients:
+
+Required HSI configuration properties:
+
+- reg:                 A list of channel ids
+
+- hsi-rx-mode:         Receiver Bit transmission mode ("stream" or "frame")
+- hsi-tx-mode:         Transmitter Bit transmission mode ("stream" or "frame")
+- hsi-mode:            May be used instead hsi-rx-mode and hsi-tx-mode if
+                       the transmission mode is the same for receiver and
+                       transmitter
+- hsi-speed-kbps:      Max bit transmission speed in kbit/s
+- hsi-flow:            RX flow type ("synchronized" or "pipeline")
+- hsi-arb-mode:                Arbitration mode for TX frame ("round-robin", "priority")
+
+Optional HSI configuration properties:
+
+- reg-names:           A list with one name per channel specified in the
+                       reg property
+
+
+Device Tree node example for an HSI client:
Quoted 8 lines

Documentation/devicetree/bindings/hsi/client-devices.txt line 29

Quoted 5 lines
Documentation/devicetree/bindings/hsi/client-devices.txt new file +5 -0
+
+hsi-controller {
+       hsi-port {
+               modem: hsi-client {
+                       compatible = "nokia,n900-modem";

Is there only 1 version of HSI? If not, then perhaps you need to know what version a client is.

There is HSI (High-speed Synchronous Serial Interface) and a legacy variant from Texas Instruments called SSI (Synchronous Serial Interface). The main difference is the speed and I don't think the difference must be encoded in the Device Tree.

Quoted 3 lines

Documentation/devicetree/bindings/hsi/client-devices.txt line 31

Quoted 1 line
Documentation/devicetree/bindings/hsi/client-devices.txt new file +1 -0
+                       reg = <0>, <1>, <2>, <3>;

Where do these numbers get defined?

HSI provides multiple serial connections and this describes which channels are used for the remote device.

Quoted 1 line

Are they always 0-N?

From what I understand they don't have to.

Quoted 2 lines

I don't see much advantage to using reg. Perhaps something like hsi-channel-ids would be better.

I will change it to hsi-channel-ids for PATCHv4.

-- Sebastian

author maintainer
#22 lore raw

PATCH v3 8/14 HSI: Introduce OMAP SSI driver

In reply to Sebastian Reichel

Add OMAP SSI driver to the HSI subsystem.

The Synchronous Serial Interface (SSI) is a legacy version of HSI. As in the case of HSI, it is mainly used to connect Application engines (APE) with cellular modem engines (CMT) in cellular handsets.

It provides a multichannel, full-duplex, multi-core communication with no reference clock. The OMAP SSI block is capable of reaching speeds of 110 Mbit/s.

---
 drivers/hsi/Kconfig                     |    1 +
 drivers/hsi/Makefile                    |    1 +
 drivers/hsi/controllers/Kconfig         |   19 +
 drivers/hsi/controllers/Makefile        |    6 +
 drivers/hsi/controllers/omap_ssi.c      |  621 ++++++++++++++
 drivers/hsi/controllers/omap_ssi.h      |  166 ++++
 drivers/hsi/controllers/omap_ssi_port.c | 1401 +++++++++++++++++++++++++++++++
 drivers/hsi/controllers/omap_ssi_regs.h |  171 ++++
 8 files changed, 2386 insertions(+)
 create mode 100644 drivers/hsi/controllers/Kconfig
 create mode 100644 drivers/hsi/controllers/Makefile
 create mode 100644 drivers/hsi/controllers/omap_ssi.c
 create mode 100644 drivers/hsi/controllers/omap_ssi.h
 create mode 100644 drivers/hsi/controllers/omap_ssi_port.c
 create mode 100644 drivers/hsi/controllers/omap_ssi_regs.h
drivers/hsi/Kconfig +1 -0
index d94e38d..2c76de4 100644
@@ -14,6 +14,7 @@ config HSI_BOARDINFO
 	bool
 	default y
 
+source "drivers/hsi/controllers/Kconfig"
 source "drivers/hsi/clients/Kconfig"
 
 endif # HSI
drivers/hsi/Makefile +1 -0
index 9d5d33f..360371e 100644
@@ -3,4 +3,5 @@
 #
 obj-$(CONFIG_HSI_BOARDINFO)	+= hsi_boardinfo.o
 obj-$(CONFIG_HSI)		+= hsi.o
+obj-y				+= controllers/
 obj-y				+= clients/
drivers/hsi/controllers/Kconfig new file +19 -0
new file mode 100644
index 0000000..037a344
@@ -0,0 +1,19 @@
+#
+# HSI controllers configuration
+#
+comment "HSI controllers"
+
+config OMAP_SSI
+	tristate "OMAP SSI hardware driver"
+	depends on ARCH_OMAP && HSI
+	---help---
+	  SSI is a legacy version of HSI. It is usually used to connect
+	  an application engine with a cellular modem.
+	  If you say Y here, you will enable the OMAP SSI hardware driver.
+
+	  If unsure, say N.
+
+config OMAP_SSI_PORT
+	tristate
+	default m if OMAP_SSI=m
+	default y if OMAP_SSI=y
drivers/hsi/controllers/Makefile new file +6 -0
new file mode 100644
index 0000000..d2665cf
@@ -0,0 +1,6 @@
+#
+# Makefile for HSI controllers drivers
+#
+
+obj-$(CONFIG_OMAP_SSI)		+= omap_ssi.o
+obj-$(CONFIG_OMAP_SSI_PORT)	+= omap_ssi_port.o
drivers/hsi/controllers/omap_ssi.c new file +621 -0

621 lines not on this page · raw message

drivers/hsi/controllers/omap_ssi.h new file +166 -0

166 lines not on this page · raw message

drivers/hsi/controllers/omap_ssi_port.c new file +1401 -0

1,401 lines not on this page · raw message

drivers/hsi/controllers/omap_ssi_regs.h new file +171 -0

171 lines not on this page · raw message

Signature · 1 line
1.9.0
#23 lore raw

Re: [PATCHv3 08/14] HSI: Introduce OMAP SSI driver

Hi!

Quoted 14 lines

Add OMAP SSI driver to the HSI subsystem.

The Synchronous Serial Interface (SSI) is a legacy version of HSI. As in the case of HSI, it is mainly used to connect Application engines (APE) with cellular modem engines (CMT) in cellular handsets.

It provides a multichannel, full-duplex, multi-core communication with no reference clock. The OMAP SSI block is capable of reaching speeds of 110 Mbit/s.

drivers/hsi/controllers/omap_ssi.h line 103

Quoted 2 lines
drivers/hsi/controllers/omap_ssi.h new file +2 -0
+	bool			wktest:1; /* FIXME: HACK to be removed */
+	bool			wkin_cken:1; /* Workaround */

There is more thanone FIXME in the code. It may be better to fix after merge...

drivers/hsi/controllers/omap_ssi_port.c line 176

Quoted 5 lines
drivers/hsi/controllers/omap_ssi_port.c new file +5 -0
+DEFINE_SIMPLE_ATTRIBUTE(ssi_sst_div_fops, ssi_div_get, ssi_div_set, "%llu\n");
+
+static int __init ssi_debug_add_port(struct omap_ssi_port *omap_port,
+							struct dentry *dir)
+{

A little strange indentation. Is it intentional?

drivers/hsi/controllers/omap_ssi_port.c line 188

Quoted 4 lines
drivers/hsi/controllers/omap_ssi_port.c new file +4 -0
+	if (IS_ERR(dir))
+		return PTR_ERR(dir);
+	debugfs_create_file("divisor", S_IRUGO | S_IWUSR, dir, port,
+							&ssi_sst_div_fops);

Here, too.

drivers/hsi/controllers/omap_ssi_port.c line 414

Quoted 3 lines
drivers/hsi/controllers/omap_ssi_port.c new file +3 -0
+	dev_dbg(&ssi->device, "TX div %d for fck_rate %lu Khz speed %d Kb/s\n",
+			tx_fckrate / omap_ssi->max_speed, omap_ssi->fck_rate,
+							omap_ssi->max_speed);

...and here.

drivers/hsi/controllers/omap_ssi_port.c line 595

Quoted 6 lines
drivers/hsi/controllers/omap_ssi_port.c new file +6 -0
+	if (--omap_port->wk_refcount) {
+		spin_unlock_bh(&omap_port->wk_lock);
+		return 0;
+	}
+	writel(SSI_WAKE(0),
+				omap_ssi->sys + SSI_CLEAR_WAKE_REG(port->num));

...and here. Should be on one line, AFAICT.
Pavel

Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#24 lore raw

Re: [PATCHv3 08/14] HSI: Introduce OMAP SSI driver

Quoted 11 lines · Pavel Machek
Quoted 11 lines

Add OMAP SSI driver to the HSI subsystem.

The Synchronous Serial Interface (SSI) is a legacy version of HSI. As in the case of HSI, it is mainly used to connect Application engines (APE) with cellular modem engines (CMT) in cellular handsets.

It provides a multichannel, full-duplex, multi-core communication with no reference clock. The OMAP SSI block is capable of reaching speeds of 110 Mbit/s.

Quoted 8 lines

drivers/hsi/controllers/omap_ssi.h line 103

Quoted 5 lines
drivers/hsi/controllers/omap_ssi.h new file +2 -0
+	bool			wktest:1; /* FIXME: HACK to be removed */
+	bool			wkin_cken:1; /* Workaround */

There is more thanone FIXME in the code. It may be better to fix after merge...

I would prefer to keep them in there and have a look after the merge. Most FIXMEs in the code are for the wakeline test and some concern the timings. Since the current code works I would prefer to add it to the mainline kernel and tackle this afterwards.

Quoted 9 lines

drivers/hsi/controllers/omap_ssi_port.c line 176

Quoted 5 lines
drivers/hsi/controllers/omap_ssi_port.c new file +5 -0
+DEFINE_SIMPLE_ATTRIBUTE(ssi_sst_div_fops, ssi_div_get, ssi_div_set, "%llu\n");
+
+static int __init ssi_debug_add_port(struct omap_ssi_port *omap_port,
+							struct dentry *dir)
+{

A little strange indentation. Is it intentional?

[...] (more ugly indentation cases)

Fixed in v4.

-- Sebastian

author maintainer
#25 lore raw

PATCH v3 9/14 Documentation: DT: omap-ssi binding documentation

In reply to Sebastian Reichel

Create device tree binding documentation for
OMAP Synchronous Serial Interface (SSI) device.

---
 Documentation/devicetree/bindings/hsi/omap-ssi.txt | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hsi/omap-ssi.txt
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +85 -0
new file mode 100644
index 0000000..709419b
@@ -0,0 +1,85 @@
+OMAP SSI controller bindings
+
+OMAP Synchronous Serial Interface (SSI) controller implements a legacy
+variant of MIPI's High Speed Synchronous Serial Interface (HSI).
+
+Required properties:
+- compatible:		Should include "ti,omap3-ssi".
+- reg-names:		Contains the values "sys" and "gdd".
+- reg:			Contains a register specifier for each entry in
+			reg-names.
+- interrupt-names:      Contains the value "gdd_mpu".
+- interrupts: 		Contains interrupt information for each entry in
+			interrupt-names.
+- ranges:		Represents the bus address mapping between the main
+			controller node and the child nodes below.
+- clocks:		Contains clock specifiers for each entry in
+                        clock-names.
+- clock-names:		Must include the following entries:
+  "ssi_ssr_fck": The OMAP clock of that name
+  "ssi_sst_fck": The OMAP clock of that name
+  "ssi_ick": The OMAP clock of that name
+- #address-cells:	Should be set to <1>
+- #size-cells:		Should be set to <1>
+
+Each port is represented as a sub-node of the ti,omap3-ssi device.
+
+Required Port sub-node properties:
+- compatible:		Should be set to the following value
+                        ti,omap3-ssi-port (applicable to OMAP34xx devices)
+- reg-names:		Contains the values "rx" and "tx".
+- reg:			Contains a register specifier for each entry in
+			reg-names.
+- interrupt-parent	Should be a phandle for the interrupt controller
+- interrupt-names:	Contains the values "mpu_irq0" and "mpu_irq1".
+- interrupts:		Contains interrupt information for each entry in
+			interrupt-names.
+- ti,ssi-cawake-gpio:	Defines which GPIO pin is used to signify CAWAKE
+			events for the port. This is an optional board-specific
+			property. If it's missing the port will not be
+			enabled.
+
+Example for Nokia N900:
+
+ssi-controller@48058000 {
+	compatible = "ti,omap3-ssi";
+
+	/* needed until hwmod is updated to use the compatible string */
+	ti,hwmods = "ssi";
+
+	reg = <0x48058000 0x1000>,
+	      <0x48059000 0x1000>;
+	reg-names = "sys",
+		    "gdd";
+
+	interrupts = <55>;
+	interrupt-names = "gdd_mpu";
+
+	clocks = <&ssi_ssr_fck>,
+		 <&ssi_sst_fck>,
+		 <&ssi_ick>;
+	clock-names = "ssi_ssr_fck",
+		      "ssi_sst_fck",
+		      "ssi_ick";
+
+	#address-cells = <1>;
+	#size-cells = <1>;
+	ranges;
+
+	ssi-port@0 {
+		compatible = "ti,omap3-ssi-port";
+
+		reg = <0x4805a000 0x800>,
+		      <0x4805a800 0x800>;
+		reg-names = "tx",
+			    "rx";
+
+		interrupt-parent = <&intc>;
+		interrupts = <51>,
+			     <52>;
+		interrupt-names = "mpu_irq0",
+				  "mpu_irq1";
+
+		ti,ssi-cawake-gpio = <&gpio5 23 GPIO_ACTIVE_HIGH>; /* 151 */
+	}
+}
Signature · 1 line
1.9.0
Reviewed-by on v3 9/14
#26 lore raw

Re: [PATCHv3 09/14] Documentation: DT: omap-ssi binding documentation

Quoted 4 lines · Sebastian Reichel

Create device tree binding documentation for
OMAP Synchronous Serial Interface (SSI) device.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#27 lore raw

Re: [PATCHv3 09/14] Documentation: DT: omap-ssi binding documentation

In reply to Sebastian Reichel
Quoted 15 lines · Sebastian Reichel

Create device tree binding documentation for
OMAP Synchronous Serial Interface (SSI) device.

---
 Documentation/devicetree/bindings/hsi/omap-ssi.txt | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hsi/omap-ssi.txt
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +0 -0
new file mode 100644
index 0000000..709419b

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +10 -0
@@ -0,0 +1,85 @@
+OMAP SSI controller bindings
+
+OMAP Synchronous Serial Interface (SSI) controller implements a legacy
+variant of MIPI's High Speed Synchronous Serial Interface (HSI).
+
+Required properties:
+- compatible:          Should include "ti,omap3-ssi".
+- reg-names:           Contains the values "sys" and "gdd".
+- reg:                 Contains a register specifier for each entry in
+                       reg-names.

You need to define the order here unless you have a strong argument why you can't.

Quoted 12 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +12 -0
+- interrupt-names:      Contains the value "gdd_mpu".
+- interrupts:          Contains interrupt information for each entry in
+                       interrupt-names.
+- ranges:              Represents the bus address mapping between the main
+                       controller node and the child nodes below.
+- clocks:              Contains clock specifiers for each entry in
+                        clock-names.
+- clock-names:         Must include the following entries:
+  "ssi_ssr_fck": The OMAP clock of that name
+  "ssi_sst_fck": The OMAP clock of that name
+  "ssi_ick": The OMAP clock of that name
+- #address-cells:      Should be set to <1>

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 32

Quoted 10 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +10 -0
+- #size-cells:         Should be set to <1>
+
+Each port is represented as a sub-node of the ti,omap3-ssi device.
+
+Required Port sub-node properties:
+- compatible:          Should be set to the following value
+                        ti,omap3-ssi-port (applicable to OMAP34xx devices)
+- reg-names:           Contains the values "rx" and "tx".
+- reg:                 Contains a register specifier for each entry in
+                       reg-names.

You need to define the order here unless you have a strong argument why you can't.

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 34

Quoted 2 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +2 -0
+- interrupt-parent     Should be a phandle for the interrupt controller
+- interrupt-names:     Contains the values "mpu_irq0" and "mpu_irq1".

Those names aren't exactly useful.

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 36

Quoted 2 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +2 -0
+- interrupts:          Contains interrupt information for each entry in
+                       interrupt-names.

You need to define the order here unless you have a strong argument why you can't.

Quoted 23 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +23 -0
+- ti,ssi-cawake-gpio:  Defines which GPIO pin is used to signify CAWAKE
+                       events for the port. This is an optional board-specific
+                       property. If it's missing the port will not be
+                       enabled.
+
+Example for Nokia N900:
+
+ssi-controller@48058000 {
+       compatible = "ti,omap3-ssi";
+
+       /* needed until hwmod is updated to use the compatible string */
+       ti,hwmods = "ssi";
+
+       reg = <0x48058000 0x1000>,
+             <0x48059000 0x1000>;
+       reg-names = "sys",
+                   "gdd";
+
+       interrupts = <55>;
+       interrupt-names = "gdd_mpu";
+
+       clocks = <&ssi_ssr_fck>,
+                <&ssi_sst_fck>,

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 69

Quoted 10 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +10 -0
+                <&ssi_ick>;
+       clock-names = "ssi_ssr_fck",
+                     "ssi_sst_fck",
+                     "ssi_ick";
+
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges;
+
+       ssi-port@0 {

Does this h/w really have more than 1 port?

This should really be "ssi-port@4805a800" Or you need to fill in ranges to have a local offset.

Quoted 19 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +16 -1
+               compatible = "ti,omap3-ssi-port";
+
+               reg = <0x4805a000 0x800>,
+                     <0x4805a800 0x800>;
+               reg-names = "tx",
+                           "rx";
+
+               interrupt-parent = <&intc>;
+               interrupts = <51>,
+                            <52>;
+               interrupt-names = "mpu_irq0",
+                                 "mpu_irq1";
+
+               ti,ssi-cawake-gpio = <&gpio5 23 GPIO_ACTIVE_HIGH>; /* 151 */
+       }
+}
--

1.9.0

author maintainer
#28 lore raw

Re: [PATCHv3 09/14] Documentation: DT: omap-ssi binding documentation

Hi,

Quoted 21 lines · Rob Herring
Quoted 20 lines · Sebastian Reichel

Create device tree binding documentation for
OMAP Synchronous Serial Interface (SSI) device.

---
 Documentation/devicetree/bindings/hsi/omap-ssi.txt | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hsi/omap-ssi.txt
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +5 -0
new file mode 100644
index 0000000..709419b
@@ -0,0 +1,85 @@
+OMAP SSI controller bindings
+
+OMAP Synchronous Serial Interface (SSI) controller implements a legacy
+variant of MIPI's High Speed Synchronous Serial Interface (HSI).
+
Quoted 8 lines

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 10

Quoted 5 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +5 -0
+Required properties:
+- compatible:          Should include "ti,omap3-ssi".
+- reg-names:           Contains the values "sys" and "gdd".
+- reg:                 Contains a register specifier for each entry in
+                       reg-names.

You need to define the order here unless you have a strong argument why you can't.

ok.

Quoted 17 lines
Quoted 17 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +17 -0
+- interrupt-names:      Contains the value "gdd_mpu".
+- interrupts:          Contains interrupt information for each entry in
+                       interrupt-names.
+- ranges:              Represents the bus address mapping between the main
+                       controller node and the child nodes below.
+- clocks:              Contains clock specifiers for each entry in
+                        clock-names.
+- clock-names:         Must include the following entries:
+  "ssi_ssr_fck": The OMAP clock of that name
+  "ssi_sst_fck": The OMAP clock of that name
+  "ssi_ick": The OMAP clock of that name
+- #address-cells:      Should be set to <1>
+- #size-cells:         Should be set to <1>
+
+Each port is represented as a sub-node of the ti,omap3-ssi device.
+
+Required Port sub-node properties:
Quoted 8 lines

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 32

Quoted 5 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +5 -0
+- compatible:          Should be set to the following value
+                        ti,omap3-ssi-port (applicable to OMAP34xx devices)
+- reg-names:           Contains the values "rx" and "tx".
+- reg:                 Contains a register specifier for each entry in
+                       reg-names.

You need to define the order here unless you have a strong argument why you can't.

ok.

Quoted 4 lines

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 34

Quoted 2 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +2 -0
+- interrupt-parent     Should be a phandle for the interrupt controller
+- interrupt-names:     Contains the values "mpu_irq0" and "mpu_irq1".

Those names aren't exactly useful.

I removed interrupt-names in PATCHv4.

Quoted 5 lines

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 36

Quoted 2 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +2 -0
+- interrupts:          Contains interrupt information for each entry in
+                       interrupt-names.

You need to define the order here unless you have a strong argument why you can't.

ok.

Quoted 27 lines
Quoted 27 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +27 -0
+- ti,ssi-cawake-gpio:  Defines which GPIO pin is used to signify CAWAKE
+                       events for the port. This is an optional board-specific
+                       property. If it's missing the port will not be
+                       enabled.
+
+Example for Nokia N900:
+
+ssi-controller@48058000 {
+       compatible = "ti,omap3-ssi";
+
+       /* needed until hwmod is updated to use the compatible string */
+       ti,hwmods = "ssi";
+
+       reg = <0x48058000 0x1000>,
+             <0x48059000 0x1000>;
+       reg-names = "sys",
+                   "gdd";
+
+       interrupts = <55>;
+       interrupt-names = "gdd_mpu";
+
+       clocks = <&ssi_ssr_fck>,
+                <&ssi_sst_fck>,
+                <&ssi_ick>;
+       clock-names = "ssi_ssr_fck",
+                     "ssi_sst_fck",
+                     "ssi_ick";
Quoted 8 lines

Documentation/devicetree/bindings/hsi/omap-ssi.txt line 69

Quoted 6 lines
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +6 -0
+
+       #address-cells = <1>;
+       #size-cells = <1>;
+       ranges;
+
+       ssi-port@0 {

Does this h/w really have more than 1 port?

Yes. I added this to the example in PATCHv4.

Quoted 2 lines

This should really be "ssi-port@4805a800" Or you need to fill in ranges to have a local offset.

ok.

Quoted 1 line
Quoted 1 line

[...]

-- Sebastian

author maintainer
#29 lore raw

PATCH v3 10/14 HSI: Introduce driver for SSI Protocol

In reply to Sebastian Reichel

This adds a driver for the SSI McSAAB protocol as used in the Nokia N900.

---
 drivers/hsi/clients/Kconfig        |    8 +
 drivers/hsi/clients/Makefile       |    3 +-
 drivers/hsi/clients/ssi_protocol.c | 1188 ++++++++++++++++++++++++++++++++++++
 include/linux/hsi/ssi_protocol.h   |   42 ++
 4 files changed, 1240 insertions(+), 1 deletion(-)
 create mode 100644 drivers/hsi/clients/ssi_protocol.c
 create mode 100644 include/linux/hsi/ssi_protocol.h
drivers/hsi/clients/Kconfig +8 -0
index 3bacd27..0c70861 100644
@@ -4,6 +4,14 @@
 
 comment "HSI clients"
 
+config SSI_PROTOCOL
+	tristate "SSI protocol"
+	depends on HSI && OMAP_SSI && PHONET
+	help
+	If you say Y here, you will enable the SSI protocol aka McSAAB.
+
+	If unsure, say N.
+
 config HSI_CHAR
 	tristate "HSI/SSI character driver"
 	depends on HSI
drivers/hsi/clients/Makefile +2 -1
index 327c0e2..ccbf768 100644
@@ -2,4 +2,5 @@
 # Makefile for HSI clients
 #
 
-obj-$(CONFIG_HSI_CHAR)	+= hsi_char.o
+obj-$(CONFIG_SSI_PROTOCOL)	+= ssi_protocol.o
+obj-$(CONFIG_HSI_CHAR)		+= hsi_char.o
drivers/hsi/clients/ssi_protocol.c new file +1188 -0

1,188 lines not on this page · raw message

include/linux/hsi/ssi_protocol.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
1.9.0
#30 lore raw

Re: [PATCHv3 10/14] HSI: Introduce driver for SSI Protocol

Hi!

Review

Quoted 8 lines

This adds a driver for the SSI McSAAB protocol as used in the Nokia N900.

(quoted diff) +2 -0
+#define SSIP_MIN_PN_HDR		6	/* FIXME: Revisit */
+#define SSIP_WDTOUT		2000	/* FIXME: has to be 500 msecs> */

Can they be fixed now, or do they have to wait?

drivers/hsi/clients/ssi_protocol.c line 634

Quoted 5 lines
drivers/hsi/clients/ssi_protocol.c new file +5 -0
+#ifdef __LITTLE_ENDIAN
+	((u16 *)skb->data)[2] = swab16(((u16 *)skb->data)[2]);
+	dev_dbg(&dev->dev, "RX length fixed (%04x -> %u)\n",
+			((u16 *)skb->data)[2], ntohs(((u16 *)skb->data)[2]));
+#endif

Uh. Can this be replaced by

    ((u16 *)skb->data)[2] = htons(((u16 *)skb->data)[2]);

(without the ifdef?)

drivers/hsi/clients/ssi_protocol.c line 988

Quoted 9 lines
drivers/hsi/clients/ssi_protocol.c new file +9 -0
+	/*
+	 * Modem sends Phonet messages over SSI with its own endianess...
+	 * Assume that modem has the same endianess as we do.
+	 */
+	if (skb_cow_head(skb, 0))
+		goto drop;
+#ifdef __LITTLE_ENDIAN
+	((u16 *)skb->data)[2] = swab16(((u16 *)skb->data)[2]);
+#endif

Here, too?

But it looks like the comment does not match the code, because we swap.

Best regards,
Pavel

Signature · 6 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#31 lore raw

Re: [PATCHv3 10/14] HSI: Introduce driver for SSI Protocol

Quoted 5 lines · Pavel Machek

Hi!

Quoted 3 lines

This adds a driver for the SSI McSAAB protocol as used in the Nokia N900.

Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +2 -0
+#define SSIP_MIN_PN_HDR		6	/* FIXME: Revisit */
+#define SSIP_WDTOUT		2000	/* FIXME: has to be 500 msecs> */

Can they be fixed now, or do they have to wait?

I would prefer to wait. The timing above works and having it in the git history doesn't hurt.

Quoted 10 lines

drivers/hsi/clients/ssi_protocol.c line 634

Quoted 5 lines
drivers/hsi/clients/ssi_protocol.c new file +5 -0
+#ifdef __LITTLE_ENDIAN
+	((u16 *)skb->data)[2] = swab16(((u16 *)skb->data)[2]);
+	dev_dbg(&dev->dev, "RX length fixed (%04x -> %u)\n",
+			((u16 *)skb->data)[2], ntohs(((u16 *)skb->data)[2]));
+#endif

Uh. Can this be replaced by

    ((u16 *)skb->data)[2] = htons(((u16 *)skb->data)[2]);

(without the ifdef?)

Yes.

Quoted 11 lines

drivers/hsi/clients/ssi_protocol.c line 988

Quoted 9 lines
drivers/hsi/clients/ssi_protocol.c new file +9 -0
+	/*
+	 * Modem sends Phonet messages over SSI with its own endianess...
+	 * Assume that modem has the same endianess as we do.
+	 */
+	if (skb_cow_head(skb, 0))
+		goto drop;
+#ifdef __LITTLE_ENDIAN
+	((u16 *)skb->data)[2] = swab16(((u16 *)skb->data)[2]);
+#endif

Here, too?

Fixed in PATCHv4.

Quoted 2 lines

But it looks like the comment does not match the code, because we swap.

The swap only converts the package length field from/to network byte order. I think the comment still applies for the other actual message.

I added a comment for the length field and kept the other comment as is for PATCHv4.

-- Sebastian

author maintainer
#32 lore raw

PATCH v3 11/14 HSI: Introduce Nokia N900 modem driver

In reply to Sebastian Reichel

The Nokia N900's modem is connected via Synchronous Serial Interface (SSI), which is a legacy version of MIPI's High-speed Synchronous Serial Interface (HSI).

The handles the GPIOs for enabling and resetting the modem and instanciates ssi-protocol for data exchange. It does not yet support exchanging voice data with the modem.

---
 .../devicetree/bindings/hsi/nokia-modem.txt        |  58 +++++
 drivers/hsi/clients/Kconfig                        |   9 +
 drivers/hsi/clients/Makefile                       |   1 +
 drivers/hsi/clients/nokia-modem.c                  | 272 +++++++++++++++++++++
 4 files changed, 340 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hsi/nokia-modem.txt
 create mode 100644 drivers/hsi/clients/nokia-modem.c
Documentation/devicetree/bindings/hsi/nokia-modem.txt new file +58 -0
new file mode 100644
index 0000000..a8b8b6b
@@ -0,0 +1,58 @@
+Nokia modem client bindings
+
+The Nokia modem HSI client follows the common HSI
+client binding and inherits all required properties.
+The following additional properties are needed by
+the Nokia modem HSI client:
+
+Required properties:
+- compatible:		Should be one of
+      "nokia,n900-modem"
+- reg-names:		Should contain the following strings
+      "mcsaab-control"
+      "speech-control"
+      "speech-data"
+      "mcsaab-data"
+- gpios:		Should provide a GPIO handler for each GPIO listed in
+                        gpio-names
+- gpio-names:		Should contain the following strings
+      "cmt_apeslpx"
+      "cmt_rst_rq"
+      "cmt_en"
+      "cmt_rst"
+      "cmt_bsi"
+- interrupts:		Should be IRQ handle for modem's reset indication
+
+Example:
+
+&ssi_port {
+	modem: hsi-client {
+		compatible = "nokia,n900-modem";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&modem_pins>;
+
+		reg = <0>, <1>, <2>, <3>;
+		reg-names = "mcsaab-control",
+			    "speech-control",
+			    "speech-data",
+			    "mcsaab-data";
+		hsi-speed-kbps = <55000>;
+		hsi-mode = "frame";
+		hsi-flow = "synchronized";
+		hsi-arb-mode = "round-robin";
+
+		interrupts-extended = <&gpio3 8 IRQ_TYPE_EDGE_FALLING>; /* 72 */
+
+		gpios = <&gpio3  6 GPIO_ACTIVE_HIGH>, /* 70 */
+			<&gpio3  9 GPIO_ACTIVE_HIGH>, /* 73 */
+			<&gpio3 10 GPIO_ACTIVE_HIGH>, /* 74 */
+			<&gpio3 11 GPIO_ACTIVE_HIGH>, /* 75 */
+			<&gpio5 29 GPIO_ACTIVE_HIGH>; /* 157 */
+		gpio-names = "cmt_apeslpx",
+			     "cmt_rst_rq",
+			     "cmt_en",
+			     "cmt_rst",
+			     "cmt_bsi";
+	};
+};
drivers/hsi/clients/Kconfig +9 -0
index 0c70861..6ce1ea2 100644
@@ -4,6 +4,15 @@
 
 comment "HSI clients"
 
+config NOKIA_MODEM
+	tristate "Nokia Modem"
+	depends on SSI_PROTOCOL
+	help
+	Say Y here if you want to add support for the modem on Nokia
+	N900 (Nokia RX-51) hardware.
+
+	If unsure, say N.
+
 config SSI_PROTOCOL
 	tristate "SSI protocol"
 	depends on HSI && OMAP_SSI && PHONET
drivers/hsi/clients/Makefile +1 -0
index ccbf768..4d5bc0e 100644
@@ -2,5 +2,6 @@
 # Makefile for HSI clients
 #
 
+obj-$(CONFIG_NOKIA_MODEM)	+= nokia-modem.o
 obj-$(CONFIG_SSI_PROTOCOL)	+= ssi_protocol.o
 obj-$(CONFIG_HSI_CHAR)		+= hsi_char.o
drivers/hsi/clients/nokia-modem.c new file +272 -0

272 lines not on this page · raw message

Signature · 6 lines
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v3 11/14
#33 lore raw

Re: [PATCHv3 11/14] HSI: Introduce Nokia N900 modem driver

Quoted 9 lines · Sebastian Reichel

The Nokia N900's modem is connected via Synchronous Serial Interface (SSI), which is a legacy version of MIPI's High-speed Synchronous Serial Interface (HSI).

The handles the GPIOs for enabling and resetting the modem and instanciates ssi-protocol for data exchange. It does not yet support exchanging voice data with the modem.

drivers/hsi/clients/nokia-modem.c line 53

Quoted 8 lines
drivers/hsi/clients/nokia-modem.c new file +8 -0
+static void do_nokia_modem_rst_ind_tasklet(unsigned long data)
+{
+	struct nokia_modem_device *modem = (struct nokia_modem_device *)data;
+
+	if (!modem)
+		return;
+
+	dev_info(modem->device, "*** CMT rst line change detected ***\n");

Maybe slightly less stars would work?

drivers/hsi/clients/nokia-modem.c line 88

Quoted 10 lines
drivers/hsi/clients/nokia-modem.c new file +10 -0
+static int nokia_modem_gpio_probe(struct device *dev)
+{
+	struct device_node *np = dev->of_node;
+	struct nokia_modem_device *modem = dev_get_drvdata(dev);
+	int gpio_count, gpio_name_count, i, err;
+
+	gpio_count = of_gpio_count(np);
+	gpio_name_count = of_property_count_strings(np, "gpio-names");
+
+	if(gpio_count != gpio_name_count) {

"if (".

drivers/hsi/clients/nokia-modem.c line 187

Quoted 2 lines
drivers/hsi/clients/nokia-modem.c new file +2 -0
+	modem->ssi_protocol = hsi_new_client(port, &ssip);
+	if (modem->ssi_protocol == NULL) {

...if (! ...)

drivers/hsi/clients/nokia-modem.c line 193

Quoted 6 lines
drivers/hsi/clients/nokia-modem.c new file +6 -0
+		dev_err(dev, "Could not register ssi-protocol device\n");
+		goto error2;
+	}
+
+	err = device_attach(&modem->ssi_protocol->device);
+	if (err == 0) {

if (!...)

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author maintainer
#34 lore raw

PATCH v3 12/14 ARM: dts: omap3 clocks: simplify ssi aliases

In reply to Sebastian Reichel

From: Sebastian Reichel <[email protected]>

update aliases for the ssi clocks ssi_ssr_fck, ssi_sst_fck and ssi_ick to make them consistent for omap34xx and omap36xx. This makes it possible to reference the clocks from generic omap3 dts files.

---
 arch/arm/boot/dts/omap3430es1-clocks.dtsi              | 10 +++++-----
 arch/arm/boot/dts/omap36xx-omap3430es2plus-clocks.dtsi | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/boot/dts/omap3430es1-clocks.dtsi +5 -5
index 02f6c7f..6f31954 100644
@@ -82,16 +82,16 @@
 		ti,dividers = <0>, <1>, <2>, <3>, <4>, <0>, <6>, <0>, <8>;
 	};
 
-	ssi_ssr_fck_3430es1: ssi_ssr_fck_3430es1 {
+	ssi_ssr_fck: ssi_ssr_fck_3430es1 {
 		#clock-cells = <0>;
 		compatible = "ti,composite-clock";
 		clocks = <&ssi_ssr_gate_fck_3430es1>, <&ssi_ssr_div_fck_3430es1>;
 	};
 
-	ssi_sst_fck_3430es1: ssi_sst_fck_3430es1 {
+	ssi_sst_fck: ssi_sst_fck_3430es1 {
 		#clock-cells = <0>;
 		compatible = "fixed-factor-clock";
-		clocks = <&ssi_ssr_fck_3430es1>;
+		clocks = <&ssi_ssr_fck>;
 		clock-mult = <1>;
 		clock-div = <2>;
 	};
@@ -120,7 +120,7 @@
 		clock-div = <1>;
 	};
 
-	ssi_ick_3430es1: ssi_ick_3430es1 {
+	ssi_ick: ssi_ick_3430es1 {
 		#clock-cells = <0>;
 		compatible = "ti,omap3-no-wait-interface-clock";
 		clocks = <&ssi_l4_ick>;
@@ -203,6 +203,6 @@
 			 <&i2c1_ick>, <&uart2_ick>, <&uart1_ick>, <&gpt11_ick>,
 			 <&gpt10_ick>, <&mcbsp5_ick>, <&mcbsp1_ick>,
 			 <&omapctrl_ick>, <&aes2_ick>, <&sha12_ick>,
-			 <&fshostusb_fck>, <&fac_ick>, <&ssi_ick_3430es1>;
+			 <&fshostusb_fck>, <&fac_ick>, <&ssi_ick>;
 	};
 };
arch/arm/boot/dts/omap36xx-omap3430es2plus-clocks.dtsi +5 -5
index 8ed475d..877318c 100644
@@ -25,16 +25,16 @@
 		ti,dividers = <0>, <1>, <2>, <3>, <4>, <0>, <6>, <0>, <8>;
 	};
 
-	ssi_ssr_fck_3430es2: ssi_ssr_fck_3430es2 {
+	ssi_ssr_fck: ssi_ssr_fck_3430es2 {
 		#clock-cells = <0>;
 		compatible = "ti,composite-clock";
 		clocks = <&ssi_ssr_gate_fck_3430es2>, <&ssi_ssr_div_fck_3430es2>;
 	};
 
-	ssi_sst_fck_3430es2: ssi_sst_fck_3430es2 {
+	ssi_sst_fck: ssi_sst_fck_3430es2 {
 		#clock-cells = <0>;
 		compatible = "fixed-factor-clock";
-		clocks = <&ssi_ssr_fck_3430es2>;
+		clocks = <&ssi_ssr_fck>;
 		clock-mult = <1>;
 		clock-div = <2>;
 	};
@@ -55,7 +55,7 @@
 		clock-div = <1>;
 	};
 
-	ssi_ick_3430es2: ssi_ick_3430es2 {
+	ssi_ick: ssi_ick_3430es2 {
 		#clock-cells = <0>;
 		compatible = "ti,omap3-ssi-interface-clock";
 		clocks = <&ssi_l4_ick>;
@@ -193,6 +193,6 @@
 			 <&i2c1_ick>, <&uart2_ick>, <&uart1_ick>, <&gpt11_ick>,
 			 <&gpt10_ick>, <&mcbsp5_ick>, <&mcbsp1_ick>,
 			 <&omapctrl_ick>, <&aes2_ick>, <&sha12_ick>,
-			 <&ssi_ick_3430es2>;
+			 <&ssi_ick>;
 	};
 };
Signature · 1 line
1.9.0
Reviewed-by on v3 12/14
#35 lore raw

Re: [PATCHv3 12/14] ARM: dts: omap3 clocks: simplify ssi aliases

Quoted 8 lines · Sebastian Reichel

From: Sebastian Reichel <[email protected]>

update aliases for the ssi clocks ssi_ssr_fck, ssi_sst_fck and ssi_ick to make them consistent for omap34xx and omap36xx. This makes it possible to reference the clocks from generic omap3 dts files.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author maintainer
#36 lore raw

PATCH v3 13/14 DTS: ARM: OMAP3-N900: Add SSI support

In reply to Sebastian Reichel

Add SSI device tree data for OMAP3 and Nokia N900.

---
 arch/arm/boot/dts/omap3-n900.dts | 24 ++++++++++++++++++
 arch/arm/boot/dts/omap3.dtsi     | 55 ++++++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/omap34xx.dtsi  | 11 ++++++++
 arch/arm/boot/dts/omap36xx.dtsi  | 11 ++++++++
 4 files changed, 101 insertions(+)
arch/arm/boot/dts/omap3-n900.dts +24 -0
index 0bf40c9..5bccd8c 100644
@@ -145,6 +145,19 @@
 			0x0d4 (PIN_OUTPUT | MUX_MODE4)		/* RX51_LCD_RESET_GPIO */
 		>;
 	};
+
+	ssi_pins: pinmux_ssi {
+		pinctrl-single,pins = <
+			0x150 (PIN_INPUT_PULLUP | MUX_MODE1)	/* ssi1_rdy_tx */
+			0x14e (PIN_OUTPUT | MUX_MODE1)		/* ssi1_flag_tx */
+			0x152 (PIN_INPUT | WAKEUP_EN | MUX_MODE4) /* ssi1_wake_tx (cawake) */
+			0x14c (PIN_OUTPUT | MUX_MODE1)		/* ssi1_dat_tx */
+			0x154 (PIN_INPUT | MUX_MODE1)		/* ssi1_dat_rx */
+			0x156 (PIN_INPUT | MUX_MODE1)		/* ssi1_flag_rx */
+			0x158 (PIN_OUTPUT | MUX_MODE1)		/* ssi1_rdy_rx */
+			0x15a (PIN_OUTPUT | MUX_MODE1)		/* ssi1_wake */
+		>;
+	};
 };
 
 &i2c1 {
@@ -490,6 +503,17 @@
 	power = <50>;
 };
 
+&ssi_port1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ssi_pins>;
+
+	ti,ssi-cawake-gpio = <&gpio5 23 GPIO_ACTIVE_HIGH>; /* 151 */
+};
+
+&ssi_port2 {
+	status = "disabled";
+};
+
 &uart1 {
 	status = "disabled";
 };
arch/arm/boot/dts/omap3.dtsi +55 -0

61 lines not on this page · raw message

arch/arm/boot/dts/omap34xx.dtsi +11 -0
index 2e92360..3819c1e 100644
@@ -40,6 +40,17 @@
 	};
 };
 
+&ssi {
+	status = "ok";
+
+	clocks = <&ssi_ssr_fck>,
+		 <&ssi_sst_fck>,
+		 <&ssi_ick>;
+	clock-names = "ssi_ssr_fck",
+		      "ssi_sst_fck",
+		      "ssi_ick";
+};
+
 /include/ "omap34xx-omap36xx-clocks.dtsi"
 /include/ "omap36xx-omap3430es2plus-clocks.dtsi"
 /include/ "omap36xx-am35xx-omap3430es2plus-clocks.dtsi"
arch/arm/boot/dts/omap36xx.dtsi +11 -0
index 7e8dee9..a634961 100644
@@ -52,6 +52,17 @@
 	};
 };
 
+&ssi {
+	status = "ok";
+
+	clocks = <&ssi_ssr_fck>,
+		 <&ssi_sst_fck>,
+		 <&ssi_ick>;
+	clock-names = "ssi_ssr_fck",
+		      "ssi_sst_fck",
+		      "ssi_ick";
+};
+
 /include/ "omap36xx-clocks.dtsi"
 /include/ "omap34xx-omap36xx-clocks.dtsi"
 /include/ "omap36xx-omap3430es2plus-clocks.dtsi"
Signature · 1 line
1.9.0
Reviewed-by on v3 13/14
#37 lore raw

Re: [PATCHv3 13/14] DTS: ARM: OMAP3-N900: Add SSI support

Quoted 3 lines · Sebastian Reichel

Add SSI device tree data for OMAP3 and Nokia N900.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author maintainer
#38 lore raw

PATCH v3 14/14 DTS: ARM: OMAP3-N900: Add modem support

In reply to Sebastian Reichel

Add modem device tree data to Nokia N900's DTS file.

---
 arch/arm/boot/dts/omap3-n900.dts | 41 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/omap3-n900.dts +41 -0
index 5bccd8c..6655790 100644
@@ -158,6 +158,17 @@
 			0x15a (PIN_OUTPUT | MUX_MODE1)		/* ssi1_wake */
 		>;
 	};
+
+	modem_pins: pinmux_modem {
+		pinctrl-single,pins = <
+			0x0ac (PIN_OUTPUT | MUX_MODE4)		/* gpio 70 => cmt_apeslpx */
+			0x0b0 (PIN_INPUT | WAKEUP_EN | MUX_MODE4) /* gpio 72 => ape_rst_rq */
+			0x0b2 (PIN_OUTPUT | MUX_MODE4)		/* gpio 73 => cmt_rst_rq */
+			0x0b4 (PIN_OUTPUT | MUX_MODE4)		/* gpio 74 => cmt_en */
+			0x0b6 (PIN_OUTPUT | MUX_MODE4)		/* gpio 75 => cmt_rst */
+			0x15e (PIN_OUTPUT | MUX_MODE4)		/* gpio 157 => cmt_bsi */
+		>;
+	};
 };
 
 &i2c1 {
@@ -508,6 +519,36 @@
 	pinctrl-0 = <&ssi_pins>;
 
 	ti,ssi-cawake-gpio = <&gpio5 23 GPIO_ACTIVE_HIGH>; /* 151 */
+
+	modem: hsi-client {
+		compatible = "nokia,n900-modem";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&modem_pins>;
+
+		reg = <0>, <1>, <2>, <3>;
+		reg-names = "mcsaab-control",
+			    "speech-control",
+			    "speech-data",
+			    "mcsaab-data";
+		hsi-speed-kbps = <55000>;
+		hsi-mode = "frame";
+		hsi-flow = "synchronized";
+		hsi-arb-mode = "round-robin";
+
+		interrupts-extended = <&gpio3 8 IRQ_TYPE_EDGE_FALLING>; /* 72 */
+
+		gpios = <&gpio3  6 GPIO_ACTIVE_HIGH>, /* 70 */
+			<&gpio3  9 GPIO_ACTIVE_HIGH>, /* 73 */
+			<&gpio3 10 GPIO_ACTIVE_HIGH>, /* 74 */
+			<&gpio3 11 GPIO_ACTIVE_HIGH>, /* 75 */
+			<&gpio5 29 GPIO_ACTIVE_HIGH>; /* 157 */
+		gpio-names = "cmt_apeslpx",
+			     "cmt_rst_rq",
+			     "cmt_en",
+			     "cmt_rst",
+			     "cmt_bsi";
+	};
 };
 
 &ssi_port2 {
Signature · 1 line
1.9.0
Reviewed-by on v3 14/14
#39 lore raw

Re: [PATCHv3 14/14] DTS: ARM: OMAP3-N900: Add modem support

Quoted 3 lines · Sebastian Reichel

Add modem device tree data to Nokia N900's DTS file.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#40 lore raw
In reply to Sebastian Reichel
Quoted 3 lines · Sebastian Reichel

Please send feedback (e.g. Tested-By or Reviewed-By :)), so that I can send a pull request for 3.16. You can either apply this patchset or use the n900-modem-support branch available on [1].

Sebastian, can you please do a separate pull request for the .dts changes for me once the driver changes are pulled? Otherwise we will be creating pointless merge conflicts.

Regards,

Tony

author maintainer
#41 lore raw
Quoted 8 lines · Tony Lindgren
Quoted 3 lines · Sebastian Reichel

Please send feedback (e.g. Tested-By or Reviewed-By :)), so that I can send a pull request for 3.16. You can either apply this patchset or use the n900-modem-support branch available on [1].

Sebastian, can you please do a separate pull request for the .dts changes for me once the driver changes are pulled? Otherwise we will be creating pointless merge conflicts.

That was my intention from the beginning. I only added those patches here to make reviewing the other patches easier.

I'm still missing a reviewed by for the most important patches (ssi driver, modem protocol driver), though. Can somebody at least test the patches and provide a Tested-By?

-- Sebastian