OMAP SSI driver
Subsystems (3)
cover OMAP SSI driver
Hi,
This is the fifth round of the OMAP SSI driver patches. I think the OMAP SSI driver is ready for mainline and should be included in 3.15. I haven't heard anything from DT binding maintainers since some months though and would like to get some feedback about the binding from them.
Changes since RFCv4 [0]:
* Removed patches for nokia-cmt and ssi-protocol, those are still WIP
* tested with CONFIG_DEBUG_ATOMIC_SLEEP
* tested with Russel's "OMAP dma engine rework" patchset
* acquire clocks from DT
* minor cleanups
- removed unused include of omap specific dma header
* updated patch subjects
TODO:
* 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.
P.S.: It would be nice if I get some Reviewed-By/Acked-By.
[0] http://marc.info/?l=linux-kernel&m=138715030530931&w=2
-- Sebastian
Sebastian Reichel (6):
HSI: add Device Tree support for HSI clients
HSI: method to unregister clients from an hsi port
HSI: hsi-char: add Device Tree support
HSI: hsi-char: fix driver for multiport scenarios
HSI: Introduce OMAP SSI driver
Documentation: DT: omap-ssi binding documentation
Documentation/devicetree/bindings/hsi/omap_ssi.txt | 82 ++ .../devicetree/bindings/hsi/trivial-devices.txt | 36 + drivers/hsi/Kconfig | 1 + drivers/hsi/Makefile | 1 + drivers/hsi/clients/hsi_char.c | 13 +- drivers/hsi/controllers/Kconfig | 19 + drivers/hsi/controllers/Makefile | 6 + drivers/hsi/controllers/omap_ssi.c | 618 +++++++++ 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 | 80 +- include/dt-bindings/hsi/hsi.h | 17 + include/linux/hsi/hsi.h | 3 + 14 files changed, 2612 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/hsi/omap_ssi.txt create mode 100644 Documentation/devicetree/bindings/hsi/trivial-devices.txt 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/dt-bindings/hsi/hsi.h
Signature · 1 line
1.8.5.3
PATCH 1/6 HSI: add Device Tree support for HSI clients
Add new method hsi_add_clients_from_dt, which can be used to initialize HSI clients from a device tree node.
The patch also documents the DT binding for trivial HSI clients.
--- .../devicetree/bindings/hsi/trivial-devices.txt | 36 +++++++++++ drivers/hsi/hsi.c | 70 +++++++++++++++++++++- include/dt-bindings/hsi/hsi.h | 17 ++++++ include/linux/hsi/hsi.h | 2 + 4 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/hsi/trivial-devices.txt create mode 100644 include/dt-bindings/hsi/hsi.h
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +36 -0
@@ -0,0 +1,36 @@ +This is a list of trivial hsi client devices that have simple +device tree bindings, consisting only of a compatible field +and the optional hsi configuration. + +If a device needs more specific bindings, such as properties to +describe some aspect of it, there needs to be a specific binding +document for it just like any other devices. + +Optional HSI configuration properties: + +- hsi,mode Bit transmission mode (STREAM or FRAME) + The first value is used for RX and the second one for + TX configuration. If only one value is provided it will + be used for RX and TX. + The assignments may be found in header file + <dt-bindings/hsi/hsi.h>. +- hsi,channels Number of channels to use [1..16] + The first value is used for RX and the second one for + TX configuration. If only one value is provided it will + be used for RX and TX. +- hsi,speed Max bit transmission speed (Kbit/s) + The first value is used for RX and the second one for + TX configuration. If only one value is provided it will + be used for RX and TX. +- hsi,flow RX flow type (SYNCHRONIZED or PIPELINE) + The assignments may be found in header file + <dt-bindings/hsi/hsi.h>. +- hsi,arb_mode Arbitration mode for TX frame (Round robin, priority) + The assignments may be found in header file + <dt-bindings/hsi/hsi.h>. + +This is the list of trivial client devices: + +Compatible Description +========== ============= +hsi-char HSI character device
drivers/hsi/hsi.c +69 -1
94 lines not on this page · raw message
include/dt-bindings/hsi/hsi.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* This header provides constants for hsi client bindings. +*/ + +#ifndef _DT_BINDINGS_HSI_H +#define _DT_BINDINGS_HSI_H + +#define HSI_MODE_STREAM 1 +#define HSI_MODE_FRAME 2 + +#define HSI_FLOW_SYNC 0 +#define HSI_FLOW_PIPE 1 + +#define HSI_ARB_RR 0 +#define HSI_ARB_PRIO 1 + +#endif /* _DT_BINDINGS_HSI_H */
include/linux/hsi/hsi.h +2 -0
@@ -282,6 +282,8 @@ 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_add_clients_from_dt (struct hsi_port *port, +struct device_node *clients);static inline void hsi_controller_set_drvdata (struct hsi_controller *hsi,void *data)
Signature · 1 line
1.8.5.3
Re: [PATCHv1 1/6] HSI: add Device Tree support for HSI clients
Quoted 7 lines · Sebastian Reichel
Add new method
hsi_add_clients_from_dt, which can be used to initialize HSI clients from a device tree node.The patch also documents the DT binding for trivial HSI clients.
Signed-off-by Sebastian Reichel <[email protected]>
Quoted 8 lines
--- .../devicetree/bindings/hsi/trivial-devices.txt | 36 +++++++++++ drivers/hsi/hsi.c | 70 +++++++++++++++++++++- include/dt-bindings/hsi/hsi.h | 17 ++++++ include/linux/hsi/hsi.h | 2 + 4 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/hsi/trivial-devices.txt create mode 100644 include/dt-bindings/hsi/hsi.h
It would be nice if we had a general HSI binding document that explains what HSI is and how HSI bus devices and clients are expected too look.
Does HSI have an addressing scheme, or does each port have a single device?
Quoted 7 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +0
-0
Documentation/devicetree/bindings/hsi/trivial-devices.txt line 7
Quoted 7 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +7
-0@@ -0,0 +1,36 @@ +This is a list of trivial hsi client devices that have simple +device tree bindings, consisting only of a compatible field +and the optional hsi configuration. + +If a device needs more specific bindings, such as properties to +describe some aspect of it, there needs to be a specific binding +document for it just like any other devices.
Might this make more sense as a hsi-clients binding doc? I assume these properties could be applied to non-trivial devices?
Documentation/devicetree/bindings/hsi/trivial-devices.txt line 16
Quoted 9 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +9
-0+ +Optional HSI configuration properties: + +- hsi,mode Bit transmission mode (STREAM or FRAME) + The first value is used for RX and the second one for + TX configuration. If only one value is provided it will + be used for RX and TX. + The assignments may be found in header file + <dt-bindings/hsi/hsi.h>.
Why not have hsi,rx-mode and hsi,tx-mode? I'll certainly get confused as to which cell is tx and which is rx with the current binding.
Having separate tx-* and rx-* versions of the remaining properties would be good too.
I note that the defines are called HSI_MODE_STREAM and HSI_MODE_FRAME, not STREAM and FRAME as the binding document implies. Please refer to exact names.
It may make more sense to use a string here and for the other properties. They're easier for humans to read, and they survive decompilation (so you get _much_ better error messages).
Quoted 4 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +4
-0+- hsi,channels Number of channels to use [1..16] + The first value is used for RX and the second one for + TX configuration. If only one value is provided it will + be used for RX and TX.
Documentation/devicetree/bindings/hsi/trivial-devices.txt line 30
Quoted 10 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +10
-0+- hsi,speed Max bit transmission speed (Kbit/s) + The first value is used for RX and the second one for + TX configuration. If only one value is provided it will + be used for RX and TX. +- hsi,flow RX flow type (SYNCHRONIZED or PIPELINE) + The assignments may be found in header file + <dt-bindings/hsi/hsi.h>. +- hsi,arb_mode Arbitration mode for TX frame (Round robin, priority) + The assignments may be found in header file + <dt-bindings/hsi/hsi.h>.
s/_/-/ in property names please.
Documentation/devicetree/bindings/hsi/trivial-devices.txt line 36
Quoted 6 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +6
-0+ +This is the list of trivial client devices: + +Compatible Description +========== ============= +hsi-char HSI character device
What exactly is a HSI character device?
This seems more like a Linux abstraction than a real class of device.
Cheers,
Mark.
Re: [PATCHv1 1/6] HSI: add Device Tree support for HSI clients
In reply to Sebastian ReichelQuoted 23 lines · Sebastian Reichel
Add new method
hsi_add_clients_from_dt, which can be used to initialize HSI clients from a device tree node.The patch also documents the DT binding for trivial HSI clients.
Signed-off-by Sebastian Reichel <[email protected]>--- .../devicetree/bindings/hsi/trivial-devices.txt | 36 +++++++++++ drivers/hsi/hsi.c | 70 +++++++++++++++++++++- include/dt-bindings/hsi/hsi.h | 17 ++++++ include/linux/hsi/hsi.h | 2 + 4 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/hsi/trivial-devices.txt create mode 100644 include/dt-bindings/hsi/hsi.hDocumentation/devicetree/bindings/hsi/trivial-devices.txt new file +1
-0@@ -0,0 +1,36 @@ +This is a list of trivial hsi client devices that have simple
Documentation/devicetree/bindings/hsi/trivial-devices.txt line 11
Quoted 10 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +10
-0+device tree bindings, consisting only of a compatible field +and the optional hsi configuration. + +If a device needs more specific bindings, such as properties to +describe some aspect of it, there needs to be a specific binding +document for it just like any other devices. + +Optional HSI configuration properties: + +- hsi,mode Bit transmission mode (STREAM or FRAME)
hsi is not a vendor prefix, so all these properties should be hsi-*.
Documentation/devicetree/bindings/hsi/trivial-devices.txt line 21
Quoted 10 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +10
-0+ The first value is used for RX and the second one for + TX configuration. If only one value is provided it will + be used for RX and TX. + The assignments may be found in header file + <dt-bindings/hsi/hsi.h>. +- hsi,channels Number of channels to use [1..16] + The first value is used for RX and the second one for + TX configuration. If only one value is provided it will + be used for RX and TX. +- hsi,speed Max bit transmission speed (Kbit/s)
Include the units in the prop name: hsi-speed-kbps
Quoted 5 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +5
-0+ The first value is used for RX and the second one for + TX configuration. If only one value is provided it will + be used for RX and TX. +- hsi,flow RX flow type (SYNCHRONIZED or PIPELINE) + The assignments may be found in header file
Documentation/devicetree/bindings/hsi/trivial-devices.txt line 36
Quoted 10 lines
Documentation/devicetree/bindings/hsi/trivial-devices.txt new file +10
-0+ <dt-bindings/hsi/hsi.h>. +- hsi,arb_mode Arbitration mode for TX frame (Round robin, priority) + The assignments may be found in header file + <dt-bindings/hsi/hsi.h>. + +This is the list of trivial client devices: + +Compatible Description +========== ============= +hsi-char HSI character device
I've gotten this far and still have no idea what HSI is.
Rob
PATCH 2/6 HSI: method to unregister clients from an hsi port
In reply to Sebastian ReichelThis 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
@@ -198,6 +198,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
@@ -284,6 +284,7 @@ int hsi_register_controller(struct hsi_controller *hsi);void hsi_unregister_controller (struct hsi_controller *hsi);void hsi_add_clients_from_dt (struct hsi_port *port,struct device_node *clients); +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.8.5.3
PATCH 3/6 HSI: hsi-char: add Device Tree support
In reply to Sebastian ReichelAdd of_match_table to hsi_char driver, so that it can be referenced from Device Tree.
--- drivers/hsi/clients/hsi_char.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/hsi/clients/hsi_char.c +11 -0
@@ -42,6 +42,7 @@#include <linux/stat.h> #include <linux/hsi/hsi.h> #include <linux/hsi/hsi_char.h> +#include <linux/of_device.h> #define HSC_DEVS 16/* Num of channels */ #define HSC_MSGS 4
@@ -758,12 +759,22 @@ static int hsc_remove(struct device *dev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id hsi_char_of_match[] = { + { .compatible ="ssi-char" , }, + { .compatible ="hsi-char" , }, + {}, +}; +MODULE_DEVICE_TABLE (of, hsi_char_of_match); +#endif +static struct hsi_client_driver hsc_driver = { .driver = { .name ="hsi_char" , .owner =THIS_MODULE , .probe = hsc_probe, .remove = hsc_remove, + .of_match_table =of_match_ptr (hsi_char_of_match), }, };
Signature · 1 line
1.8.5.3
Re: [PATCHv1 3/6] HSI: hsi-char: add Device Tree support
Quoted 21 lines · Sebastian Reichel
Add
of_match_tabletohsi_chardriver, so that it can be referenced from Device Tree.Signed-off-by Sebastian Reichel <[email protected]>--- drivers/hsi/clients/hsi_char.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/hsi/clients/hsi_char.c +1
-0@@ -42,6 +42,7 @@#include <linux/stat.h> #include <linux/hsi/hsi.h> #include <linux/hsi/hsi_char.h> +#include <linux/of_device.h> #define HSC_DEVS 16/* Num of channels */ #define HSC_MSGS 4
drivers/hsi/clients/hsi_char.c static int hsc_remove(struct device *dev) · line 764
Quoted 6 lines
drivers/hsi/clients/hsi_char.c +3
-0@@ -758,12 +759,22 @@ static int hsc_remove(struct device *dev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id hsi_char_of_match[] = { + { .compatible = "ssi-char", },
This string is undocumented.
drivers/hsi/clients/hsi_char.c static int hsc_remove(struct device *dev) · line 765
Quoted 1 line
drivers/hsi/clients/hsi_char.c +1
-0+ { .compatible = "hsi-char", },
I'm not sure either string makes sense though; this feels like a binding for the sake of the driver rather than describing the device and allowing the driver to pick it up if it makes sense to do so.
What exactly is a "ssi-char" device or a "hsi-char" device?
Cheers,
Mark.
Re: [PATCHv1 3/6] HSI: hsi-char: add Device Tree support
Quoted 31 lines · Mark Rutland
Quoted 21 lines · Sebastian Reichel
Add
of_match_tabletohsi_chardriver, so that it can be referenced from Device Tree.Signed-off-by Sebastian Reichel <[email protected]>--- drivers/hsi/clients/hsi_char.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/hsi/clients/hsi_char.c +1
-0@@ -42,6 +42,7 @@#include <linux/stat.h> #include <linux/hsi/hsi.h> #include <linux/hsi/hsi_char.h> +#include <linux/of_device.h> #define HSC_DEVS 16/* Num of channels */ #define HSC_MSGS 4drivers/hsi/clients/hsi_char.c static int hsc_remove(struct device *dev) · line 764
Quoted 6 lines
drivers/hsi/clients/hsi_char.c +3
-0@@ -758,12 +759,22 @@ static int hsc_remove(struct device *dev)return 0 ; } +#ifdef CONFIG_OF +static const struct of_device_id hsi_char_of_match[] = { + { .compatible = "ssi-char", },This string is undocumented.
Quoted 7 lines
drivers/hsi/clients/hsi_char.c static int hsc_remove(struct device *dev) · line 765
Quoted 1 line
drivers/hsi/clients/hsi_char.c +1
-0+ { .compatible = "hsi-char", },I'm not sure either string makes sense though; this feels like a binding for the sake of the driver rather than describing the device and allowing the driver to pick it up if it makes sense to do so.
What exactly is a "ssi-char" device or a "hsi-char" device?
mh. I guess I will update the hsi framework, so that it simply loads the client driver for each registered port. This is indeed only a binding to load the driver.
-- Sebastian
PATCH 4/6 HSI: hsi-char: fix driver for multiport scenarios
In reply to Sebastian ReichelFix 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
@@ -706,7 +706,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.8.5.3
PATCH 5/6 HSI: Introduce OMAP SSI driver
In reply to Sebastian ReichelAdd 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 | 618 ++++++++++++++ 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, 2383 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
@@ -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
@@ -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
@@ -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
@@ -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 +618 -0
618 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.8.5.3
Re: [PATCHv1 5/6] HSI: Introduce OMAP SSI driver
Quoted 28 lines · 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.
Signed-off-by Sebastian Reichel <[email protected]>--- drivers/hsi/Kconfig | 1 + drivers/hsi/Makefile | 1 + drivers/hsi/controllers/Kconfig | 19 + drivers/hsi/controllers/Makefile | 6 + drivers/hsi/controllers/omap_ssi.c | 618 ++++++++++++++ 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, 2383 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/controllers/omap_ssi.c line 363
Quoted 7 lines
drivers/hsi/controllers/omap_ssi.c new file +7
-0+ irq =platform_get_resource_byname (pd,IORESOURCE_IRQ ,"gdd_mpu" ); +if (!irq) { +dev_err (&pd->dev,"GDD IRQ resource missing\n" ); + err = -ENXIO ; + goto out_err; + } + omap_ssi->gdd_irq = irq->start;
You can use platform_get_irq_byname here.
[...]
drivers/hsi/controllers/omap_ssi.c line 465
Quoted 11 lines
drivers/hsi/controllers/omap_ssi.c new file +11
-0+static inline int ssi_of_get_available_child_count (const struct device_node *np) +{ +struct device_node *child; +int num =0 ; + +for_each_child_of_node (np, child) +if (of_device_is_available (child)) + num++; + +return num; +}
You can find of_get_available_child_count in <linux/of.h>.
That said, this seems to be trying to count the numbero f ports, which should all be compatible with "ti,omap3-ssi-port", no?
So maybe you should count all available child nodes compatible with that.
Quoted 30 lines
drivers/hsi/controllers/omap_ssi.c new file +30
-0+ +static int __init ssi_probe (struct platform_device *pd) +{ +struct device_node *np = pd->dev.of_node; +struct hsi_controller *ssi; +int err; +int num_ports; + +if (!np) { +dev_err (&pd->dev,"missing device tree data\n" ); +return -EINVAL ; + } + + num_ports =ssi_of_get_available_child_count (np); + + ssi =hsi_alloc_controller (num_ports,GFP_KERNEL ); +if (!ssi) { +dev_err (&pd->dev,"No memory for controller\n" ); +return -ENOMEM ; + } + +platform_set_drvdata (pd, ssi); + + err =ssi_add_controller (ssi, pd); +if (err <0 ) + goto out1; + +pm_runtime_irq_safe (&pd->dev); +pm_runtime_enable (&pd->dev); +
drivers/hsi/controllers/omap_ssi.c line 505
Quoted 10 lines
drivers/hsi/controllers/omap_ssi.c new file +10
-0+ err =ssi_hw_init (ssi); +if (err <0 ) + goto out2; +#ifdef CONFIG_DEBUG_FS + err =ssi_debug_add_ctrl (ssi); +if (err <0 ) + goto out2; +#endif + + err =of_platform_populate (pd->dev.of_node,NULL ,NULL , &pd->dev);
I'm not keen on doing this because it allows arbitrary devices which are not ssi ports to be placed in the ssi host controller node that will be probed, which is nonsensical and something I'd like to avoid by construction.
Is there any reason the ports have to be platform devices at all?
If so, is there no way we can register them directly and skip any other devices?
[...]
Quoted 4 lines
drivers/hsi/controllers/omap_ssi.c new file +4
-0+static int __exit ssi_remove(struct platform_device *pd) +{ +struct hsi_controller *ssi =platform_get_drvdata (pd); +
drivers/hsi/controllers/omap_ssi.c line 546
Quoted 10 lines
drivers/hsi/controllers/omap_ssi.c new file +10
-0+#ifdef CONFIG_DEBUG_FS +ssi_debug_remove_ctrl (ssi); +#endif +ssi_remove_controller (ssi); +platform_set_drvdata (pd,NULL ); + +pm_runtime_disable (&pd->dev); + +/* cleanup of of_platform_populate() call */ +device_for_each_child (&pd->dev,NULL , ssi_remove_ports);
This would certainly be broken for a non ssi port device.
[...]
drivers/hsi/controllers/omap_ssi_port.c line 1336
Quoted 13 lines
drivers/hsi/controllers/omap_ssi_port.c new file +13
-0+static int omap_ssi_port_runtime_suspend (struct device *dev) +{ +struct hsi_port *port =dev_get_drvdata (dev); +struct omap_ssi_port *omap_port =hsi_port_drvdata (port); +struct hsi_controller *ssi =to_hsi_controller (port->device.parent); +struct omap_ssi_controller *omap_ssi =hsi_controller_drvdata (ssi); + +dev_dbg (dev,"port runtime suspend!\n" ); + +ssi_set_port_mode (omap_port,SSI_MODE_SLEEP ); +if (omap_ssi->get_loss) + omap_port->loss_count = + (*omap_ssi->get_loss)(ssi->device.parent);
You don't need to do (*struct->func)(args) when invoking a function pointer. You can jsut have struct->func(args) as we do elsewhere. This can be:
omap_ssi->get_loss(ssi->device.parent)
This should be fixed up in the other sites too.
Cheers,
Mark.
--
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
Re: [PATCHv1 5/6] HSI: Introduce OMAP SSI driver
Quoted 1 line · Mark Rutland
On Sun, Feb 23, 2014 at 11:50:00PM +0000, Sebastian Reichel wrote:
[...]
Quoted 18 lines
drivers/hsi/controllers/omap_ssi_port.c line 1336
Quoted 13 lines
drivers/hsi/controllers/omap_ssi_port.c new file +13
-0+static int omap_ssi_port_runtime_suspend (struct device *dev) +{ +struct hsi_port *port =dev_get_drvdata (dev); +struct omap_ssi_port *omap_port =hsi_port_drvdata (port); +struct hsi_controller *ssi =to_hsi_controller (port->device.parent); +struct omap_ssi_controller *omap_ssi =hsi_controller_drvdata (ssi); + +dev_dbg (dev,"port runtime suspend!\n" ); + +ssi_set_port_mode (omap_port,SSI_MODE_SLEEP ); +if (omap_ssi->get_loss) + omap_port->loss_count = + (*omap_ssi->get_loss)(ssi->device.parent);You don't need to do (*struct->func)(args) when invoking a function pointer. You can jsut have
struct->func(args)as we do elsewhere. This can be:
Quoted 3 lines
omap_ssi->get_loss(ssi->device.parent)This should be fixed up in the other sites too.
in fact, we should stop expecting that service and drivers should manage their own context_loss detection
Examples:
MMC:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=0a82e06e6183a252608df48cc4793b83e2d73dfd
DSS: http://marc.info/?l=linux-omap&m=139272358619064&w=2
Signature · 2 lines
Regards, Nishanth Menon
Re: [PATCHv1 5/6] HSI: Introduce OMAP SSI driver
Quoted 26 lines · Nishanth Menon
Quoted 1 line · Mark Rutland
On Sun, Feb 23, 2014 at 11:50:00PM +0000, Sebastian Reichel wrote:
[...]
Quoted 18 lines
drivers/hsi/controllers/omap_ssi_port.c line 1336
Quoted 13 lines
drivers/hsi/controllers/omap_ssi_port.c new file +13
-0+static int omap_ssi_port_runtime_suspend (struct device *dev) +{ +struct hsi_port *port =dev_get_drvdata (dev); +struct omap_ssi_port *omap_port =hsi_port_drvdata (port); +struct hsi_controller *ssi =to_hsi_controller (port->device.parent); +struct omap_ssi_controller *omap_ssi =hsi_controller_drvdata (ssi); + +dev_dbg (dev,"port runtime suspend!\n" ); + +ssi_set_port_mode (omap_port,SSI_MODE_SLEEP ); +if (omap_ssi->get_loss) + omap_port->loss_count = + (*omap_ssi->get_loss)(ssi->device.parent);You don't need to do (*struct->func)(args) when invoking a function pointer. You can jsut have
struct->func(args)as we do elsewhere. This can be:Quoted 3 lines
omap_ssi->get_loss(ssi->device.parent)This should be fixed up in the other sites too.
Quoted 7 lines
in fact, we should stop expecting that service and drivers should manage their own
context_lossdetection
Examples:
MMC:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=0a82e06e6183a252608df48cc4793b83e2d73dfd
I'm currently initializing get_loss as NULL, so context loss detection is currently disabled. I will try to find a way to detect context loss once the n900 modem is in a working state in the mainline kernel.
For now I will keep the get_loss() with the changes requested by Mark.
-- Sebastian
Re: [PATCHv1 5/6] HSI: Introduce OMAP SSI driver
In reply to Mark RutlandHi Mark,
Quoted 9 lines · Mark Rutland
drivers/hsi/controllers/omap_ssi.c line 363
Quoted 7 lines
drivers/hsi/controllers/omap_ssi.c new file +7
-0+ irq =platform_get_resource_byname (pd,IORESOURCE_IRQ ,"gdd_mpu" ); +if (!irq) { +dev_err (&pd->dev,"GDD IRQ resource missing\n" ); + err = -ENXIO ; + goto out_err; + } + omap_ssi->gdd_irq = irq->start;You can use
platform_get_irq_bynamehere.
Right. Will be changed in PATCHv2.
Quoted 5 lines
Quoted 5 lines
drivers/hsi/controllers/omap_ssi.c new file +5
-0+static inline int ssi_of_get_available_child_count (const struct device_node *np) +{ +struct device_node *child; +int num =0 ; +
Quoted 8 lines
drivers/hsi/controllers/omap_ssi.c line 465
Quoted 6 lines
drivers/hsi/controllers/omap_ssi.c new file +6
-0+for_each_child_of_node (np, child) +if (of_device_is_available (child)) + num++; + +return num; +}You can find
of_get_available_child_countin <linux/of.h>.
That did not exist when I started with the DT conversion of the driver.
Quoted 5 lines
That said, this seems to be trying to count the number of ports, which should all be compatible with "ti,omap3-ssi-port", no?
So maybe you should count all available child nodes compatible with that.
I updated the function to check the compatible string and use for_each_available_child_of_node(), which has also been added after I wrote this function.
Quoted 45 lines
Quoted 29 lines
drivers/hsi/controllers/omap_ssi.c new file +29
-0+static int __init ssi_probe (struct platform_device *pd) +{ +struct device_node *np = pd->dev.of_node; +struct hsi_controller *ssi; +int err; +int num_ports; + +if (!np) { +dev_err (&pd->dev,"missing device tree data\n" ); +return -EINVAL ; + } + + num_ports =ssi_of_get_available_child_count (np); + + ssi =hsi_alloc_controller (num_ports,GFP_KERNEL ); +if (!ssi) { +dev_err (&pd->dev,"No memory for controller\n" ); +return -ENOMEM ; + } + +platform_set_drvdata (pd, ssi); + + err =ssi_add_controller (ssi, pd); +if (err <0 ) + goto out1; + +pm_runtime_irq_safe (&pd->dev); +pm_runtime_enable (&pd->dev); +drivers/hsi/controllers/omap_ssi.c line 505
Quoted 10 lines
drivers/hsi/controllers/omap_ssi.c new file +10
-0+ err =ssi_hw_init (ssi); +if (err <0 ) + goto out2; +#ifdef CONFIG_DEBUG_FS + err =ssi_debug_add_ctrl (ssi); +if (err <0 ) + goto out2; +#endif + + err =of_platform_populate (pd->dev.of_node,NULL ,NULL , &pd->dev);I'm not keen on doing this because it allows arbitrary devices which are not ssi ports to be placed in the ssi host controller node that will be probed, which is nonsensical and something I'd like to avoid by construction.
Quoted 1 line
Is there any reason the ports have to be platform devices at all?
not strictly, but I get system resources via platform_get_resource_byname.
Quoted 2 lines
If so, is there no way we can register them directly and skip any other devices?
I set the second parameter (matches) of the of_platform_populate() call to a table containing the ssi-port compatible value.
Quoted 8 lines
Quoted 8 lines
drivers/hsi/controllers/omap_ssi.c new file +8
-0+static int __exit ssi_remove(struct platform_device *pd) +{ +struct hsi_controller *ssi =platform_get_drvdata (pd); + +#ifdef CONFIG_DEBUG_FS +ssi_debug_remove_ctrl (ssi); +#endif +ssi_remove_controller (ssi);
Quoted 8 lines
drivers/hsi/controllers/omap_ssi.c line 546
Quoted 6 lines
drivers/hsi/controllers/omap_ssi.c new file +6
-0+platform_set_drvdata (pd,NULL ); + +pm_runtime_disable (&pd->dev); + +/* cleanup of of_platform_populate() call */ +device_for_each_child (&pd->dev,NULL , ssi_remove_ports);This would certainly be broken for a non ssi port device.
I never intended to support other subdevices, but this only unregisters each subdevice, so its probably safe...
Quoted 18 lines
drivers/hsi/controllers/omap_ssi_port.c line 1336
Quoted 13 lines
drivers/hsi/controllers/omap_ssi_port.c new file +13
-0+static int omap_ssi_port_runtime_suspend (struct device *dev) +{ +struct hsi_port *port =dev_get_drvdata (dev); +struct omap_ssi_port *omap_port =hsi_port_drvdata (port); +struct hsi_controller *ssi =to_hsi_controller (port->device.parent); +struct omap_ssi_controller *omap_ssi =hsi_controller_drvdata (ssi); + +dev_dbg (dev,"port runtime suspend!\n" ); + +ssi_set_port_mode (omap_port,SSI_MODE_SLEEP ); +if (omap_ssi->get_loss) + omap_port->loss_count = + (*omap_ssi->get_loss)(ssi->device.parent);You don't need to do (*struct->func)(args) when invoking a function pointer. You can jsut have
struct->func(args)as we do elsewhere. This can be:
Quoted 3 lines
omap_ssi->get_loss(ssi->device.parent)This should be fixed up in the other sites too.
Thanks, fixed everywhere.
-- Sebastian
PATCH 6/6 Documentation: DT: omap-ssi binding documentation
In reply to Sebastian ReichelCreate device tree binding documentation for
OMAP Synchronous Serial Interface (SSI) device.
--- Documentation/devicetree/bindings/hsi/omap_ssi.txt | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/hsi/omap_ssi.txt
Documentation/devicetree/bindings/hsi/omap_ssi.txt new file +82 -0
@@ -0,0 +1,82 @@ +OMAP SSI controller bindings + +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_3430es1>, + <&ssi_sst_fck_3430es1>, + <&ssi_ick_3430es1>; + 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.8.5.3
v2 cover OMAP SSI driver
In reply to Sebastian ReichelHi,
This is the sixth round of the OMAP SSI driver patches. I think the OMAP SSI driver is ready for mainline and should be included in 3.15. This round updates the patchset according to the comments from Mark Rutland and Rob Herring.
Changes since PATCHv1 [0]:
* add a general description of what HSI is (Documentation/hsi.txt)
* remove generic HSI client binding for now. I will send a separate patchset to discuss the HSI client binding.
* Replace (*struct->func)(args) by struct->func(args)
* Replace platform_get_resource_byname by platform_get_irq_byname
* omap-ssi: only count childs compatible with "ti,omap3-ssi-port"
* omap-ssi: only populate subdevices compatible with "ti,omap3-ssi-port"
TODO:
* 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
P.S.: It would be nice if I get some Reviewed-By/Acked-By.
[0] https://lkml.org/lkml/2014/2/23/173
-- Sebastian
Sebastian Reichel (6):
Documentation: HSI: Add some general description for the HSI subsystem
HSI: Add function to register HSI clients from DT
HSI: method to unregister clients from an hsi port
HSI: hsi-char: fix driver for multiport scenarios
HSI: Introduce OMAP SSI driver
Documentation: DT: omap-ssi binding documentation
Documentation/devicetree/bindings/hsi/omap-ssi.txt | 82 ++ Documentation/hsi.txt | 75 ++ drivers/hsi/Kconfig | 1 + drivers/hsi/Makefile | 1 + drivers/hsi/clients/hsi_char.c | 2 +- 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 | 42 +- include/linux/hsi/hsi.h | 3 + 13 files changed, 2588 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/hsi/omap-ssi.txt create mode 100644 Documentation/hsi.txt 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
Signature · 1 line
1.9.0
PATCH v2 1/6 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
@@ -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
PATCH v2 2/6 HSI: Add function to register HSI clients from DT
In reply to Sebastian ReichelAdd new method hsi_add_clients_from_dt, which can be used to initialize HSI clients from a device tree node.
The function currently only registers the generic hsi_char device, which is the only one available in the Linux kernel. Support for loading generic hsi clients will be added once a common binding has been specified for them.
--- drivers/hsi/hsi.c | 32 +++++++++++++++++++++++++++++++- include/linux/hsi/hsi.h | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-)
drivers/hsi/hsi.c +31 -1
@@ -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" +static struct hsi_board_info hsi_char_dev_info = { + .name ="hsi_char" , +}; +static ssize_t modalias_show (struct device *dev,struct device_attribute *a__maybe_unused ,char *buf) {
@@ -50,7 +56,13 @@ static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env)static int hsi_bus_match (struct device *dev,struct device_driver *driver) { -return strcmp (dev_name (dev), driver->name) ==0 ; +if (of_driver_match_device (dev, driver)) +return true; + +if (strcmp (dev_name (dev), driver->name) ==0 ) +return true; + +return false; }static struct bus_type hsi_bus_type = {
@@ -101,6 +113,24 @@ static void hsi_scan_board_info(struct hsi_controller *hsi) } } +static void hsi_add_client_from_dt (struct hsi_port *port, +struct device_node *client) +{ +/* TODO */ +} + +void hsi_add_clients_from_dt (struct hsi_port *port,struct device_node *clients) +{ +struct device_node *child; + +/* register hsi-char device */ +hsi_new_client (port, &hsi_char_dev_info); + +for_each_available_child_of_node (clients, child) +hsi_add_client_from_dt (port, child); +} +EXPORT_SYMBOL_GPL (hsi_add_clients_from_dt); +static int hsi_remove_client (struct device *dev,void *data__maybe_unused ) {device_unregister (dev);
include/linux/hsi/hsi.h +2 -0
@@ -282,6 +282,8 @@ 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_add_clients_from_dt (struct hsi_port *port, +struct device_node *clients);static inline void hsi_controller_set_drvdata (struct hsi_controller *hsi,void *data)
Signature · 1 line
1.9.0
PATCH v2 3/6 HSI: method to unregister clients from an hsi port
In reply to Sebastian ReichelThis 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
@@ -160,6 +160,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
@@ -284,6 +284,7 @@ int hsi_register_controller(struct hsi_controller *hsi);void hsi_unregister_controller (struct hsi_controller *hsi);void hsi_add_clients_from_dt (struct hsi_port *port,struct device_node *clients); +void hsi_port_unregister_clients (struct hsi_port *port);static inline void hsi_controller_set_drvdata (struct hsi_controller *hsi,void *data)
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
PATCH v2 4/6 HSI: hsi-char: fix driver for multiport scenarios
In reply to Sebastian ReichelFix 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
@@ -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
PATCH v2 5/6 HSI: Introduce OMAP SSI driver
In reply to Sebastian ReichelAdd 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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v2 6/6 Documentation: DT: omap-ssi binding documentation
In reply to Sebastian ReichelCreate device tree binding documentation for
OMAP Synchronous Serial Interface (SSI) device.
--- Documentation/devicetree/bindings/hsi/omap-ssi.txt | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/hsi/omap-ssi.txt
Documentation/devicetree/bindings/hsi/omap-ssi.txt new file +82 -0
@@ -0,0 +1,82 @@ +OMAP SSI controller bindings + +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