omap-ssi cleanups + dvfs support
Sebastian Reichel
maintainercover omap-ssi cleanups + dvfs support
Hi,
The following patches add a few cleanups to the omap-ssi driver, fix module unloading (and reloading) and merge omap-ssi and omap-ssi-port into the same module to avoid a circular dependency introduced by the last patch.
P.S.: The last patch has already been sent in this patchset
(https://lkml.org/lkml/2016/1/30/283), but could not be applied due to the circular dependency.
-- Sebastian
Sebastian Reichel (6):
HSI: omap_ssi_port: switch to gpiod API
HSI: omap_ssi: fix module unloading
HSI: omap_ssi: make sure probe stays available
HSI: omap_ssi: fix removal of port platform device
HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module
HSI: omap-ssi: add clk change support
drivers/hsi/controllers/Kconfig | 5 -
drivers/hsi/controllers/Makefile | 4 +-
drivers/hsi/controllers/omap_ssi.h | 12 ++-
.../controllers/{omap_ssi.c => omap_ssi_core.c} | 106 ++++++++++++++++++---
drivers/hsi/controllers/omap_ssi_port.c | 84 ++++++++--------
5 files changed, 146 insertions(+), 65 deletions(-)
rename drivers/hsi/controllers/{omap_ssi.c => omap_ssi_core.c} (86%)Signature · 1 line
2.8.1
Sebastian Reichel
maintainerPATCH 1/6 HSI: omap_ssi_port: switch to gpiod API
Simplify driver by switching to new gpio descriptor based API.
--- drivers/hsi/controllers/omap_ssi.c | 1 - drivers/hsi/controllers/omap_ssi.h | 4 ++-- drivers/hsi/controllers/omap_ssi_port.c | 31 ++++++++++--------------------- 3 files changed, 12 insertions(+), 24 deletions(-)
drivers/hsi/controllers/omap_ssi.c +0 -1
@@ -24,7 +24,6 @@#include <linux/err.h> #include <linux/ioport.h> #include <linux/io.h> -#include <linux/gpio.h> #include <linux/clk.h> #include <linux/device.h> #include <linux/platform_device.h>
drivers/hsi/controllers/omap_ssi.h +2 -2
@@ -27,7 +27,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/hsi/hsi.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/io.h>
@@ -97,7 +97,7 @@ struct omap_ssi_port {struct list_head brkqueue;unsigned int irq;int wake_irq; -int wake_gpio; +struct gpio_desc *wake_gpio;struct tasklet_struct pio_tasklet;struct tasklet_struct wake_tasklet; bool wktest:1; /* FIXME: HACK to be removed */
drivers/hsi/controllers/omap_ssi_port.c +10 -21
@@ -24,7 +24,7 @@#include <linux/dma-mapping.h> #include <linux/pm_runtime.h> -#include <linux/of_gpio.h> +#include <linux/gpio/consumer.h> #include <linux/debugfs.h> #include "omap_ssi_regs.h"
@@ -43,7 +43,7 @@ static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused)static inline unsigned int ssi_wakein (struct hsi_port *port) {struct omap_ssi_port *omap_port =hsi_port_drvdata (port); -return gpio_get_value (omap_port->wake_gpio); +return gpiod_get_value (omap_port->wake_gpio); }#ifdef CONFIG_DEBUG_FS
@@ -1036,12 +1036,12 @@ static int __init ssi_wake_irq(struct hsi_port *port,int cawake_irq;int err; -if (omap_port->wake_gpio ==-1 ) { +if (!omap_port->wake_gpio) { omap_port->wake_irq =-1 ;return 0 ; } - cawake_irq =gpio_to_irq (omap_port->wake_gpio); + cawake_irq =gpiod_to_irq (omap_port->wake_gpio); omap_port->wake_irq = cawake_irq; tasklet_init(&omap_port->wake_tasklet, ssi_wake_tasklet,
@@ -1111,7 +1111,7 @@ static int __init ssi_port_probe(struct platform_device *pd)struct omap_ssi_port *omap_port;struct hsi_controller *ssi =dev_get_drvdata (pd->dev.parent);struct omap_ssi_controller *omap_ssi =hsi_controller_drvdata (ssi); -int cawake_gpio =0 ; +struct gpio_desc *cawake_gpio =NULL ;u32 port_id;int err;
@@ -1147,20 +1147,10 @@ static int __init ssi_port_probe(struct platform_device *pd) goto error; } - err =of_get_named_gpio (np,"ti,ssi-cawake-gpio" ,0 ); -if (err <0 ) { -dev_err (&pd->dev,"DT data is missing cawake gpio (err=%d)\n" , - err); - goto error; - } - cawake_gpio = err; - - err =devm_gpio_request_one (&port->device, cawake_gpio,GPIOF_DIR_IN , -"cawake" ); -if (err) { -dev_err (&pd->dev,"could not request cawake gpio (err=%d)!\n" , - err); - err = -ENXIO ; + cawake_gpio =devm_gpiod_get (&pd->dev,"ti,ssi-cawake" ,GPIOD_IN ); +if (IS_ERR (cawake_gpio)) { + err =PTR_ERR (cawake_gpio); +dev_err (&pd->dev,"couldn't get cawake gpio (err=%d)!\n" , err); goto error; }
@@ -1219,8 +1209,7 @@ static int __init ssi_port_probe(struct platform_device *pd)hsi_add_clients_from_dt (port, np); -dev_info (&pd->dev,"ssi port %u successfully initialized (cawake=%d)\n" , - port_id, cawake_gpio); +dev_info (&pd->dev,"ssi port %u successfully initialized\n" , port_id);return 0 ;
Signature · 1 line
2.8.1
Re: [PATCH 1/6] HSI: omap_ssi_port: switch to gpiod API
Quoted 3 lines · Sebastian Reichel
Simplify driver by switching to new gpio descriptor based API.
Signed-off-by Sebastian Reichel <[email protected]>
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Sebastian Reichel
maintainerPATCH 2/6 HSI: omap_ssi: fix module unloading
In reply to Sebastian ReichelRemoval of ssi controller debugfs directory must
happen after the clients have been removed from
it.
--- drivers/hsi/controllers/omap_ssi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hsi/controllers/omap_ssi.c +3 -3
@@ -526,6 +526,9 @@ static int __exit ssi_remove(struct platform_device *pd) {struct hsi_controller *ssi =platform_get_drvdata (pd); +/* cleanup of of_platform_populate() call */ +device_for_each_child (&pd->dev,NULL , ssi_remove_ports); +#ifdef CONFIG_DEBUG_FS ssi_debug_remove_ctrl (ssi);#endif
@@ -534,9 +537,6 @@ static int __exit ssi_remove(struct platform_device *pd)pm_runtime_disable (&pd->dev); -/* cleanup of of_platform_populate() call */ -device_for_each_child (&pd->dev,NULL , ssi_remove_ports); -return 0 ; }
Signature · 1 line
2.8.1
Re: [PATCH 2/6] HSI: omap_ssi: fix module unloading
Quoted 5 lines · Sebastian Reichel
Removal of ssi controller debugfs directory must
happen after the clients have been removed from
it.Signed-off-by Sebastian Reichel <[email protected]>
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Sebastian Reichel
maintainerPATCH 3/6 HSI: omap_ssi: make sure probe stays available
In reply to Sebastian Reicheldevice can be unbind/rebind, so probe should
stay available.
--- drivers/hsi/controllers/omap_ssi.c | 17 +++++++++-------- drivers/hsi/controllers/omap_ssi_port.c | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-)
drivers/hsi/controllers/omap_ssi.c +9 -8
@@ -140,7 +140,7 @@ static const struct file_operations ssi_gdd_regs_fops = { .release = single_release, }; -static int __init ssi_debug_add_ctrl (struct hsi_controller *ssi) +static int ssi_debug_add_ctrl (struct hsi_controller *ssi) {struct omap_ssi_controller *omap_ssi =hsi_controller_drvdata (ssi);struct dentry *dir;
@@ -290,7 +290,7 @@ static unsigned long ssi_get_clk_rate(struct hsi_controller *ssi)return rate; } -static int __init ssi_get_iomem (struct platform_device *pd, +static int ssi_get_iomem (struct platform_device *pd,const char *name,void __iomem **pbase,dma_addr_t *phy) {struct resource *mem;
@@ -310,7 +310,7 @@ static int __init ssi_get_iomem(struct platform_device *pd,return 0 ; } -static int __init ssi_add_controller (struct hsi_controller *ssi, +static int ssi_add_controller (struct hsi_controller *ssi,struct platform_device *pd) {struct omap_ssi_controller *omap_ssi;
@@ -386,7 +386,7 @@ out_err:return err; } -static int __init ssi_hw_init (struct hsi_controller *ssi) +static int ssi_hw_init (struct hsi_controller *ssi) {struct omap_ssi_controller *omap_ssi =hsi_controller_drvdata (ssi);unsigned int i;
@@ -456,7 +456,7 @@ static int ssi_remove_ports(struct device *dev, void *c)return 0 ; } -static int __init ssi_probe (struct platform_device *pd) +static int ssi_probe (struct platform_device *pd) {struct platform_device *childpdev;struct device_node *np = pd->dev.of_node;
@@ -522,7 +522,7 @@ out1:return err; } -static int __exit ssi_remove(struct platform_device *pd) +static int ssi_remove (struct platform_device *pd) {struct hsi_controller *ssi =platform_get_drvdata (pd);
@@ -592,7 +592,8 @@ MODULE_DEVICE_TABLE(of, omap_ssi_of_match);#endif static struct platform_driver ssi_pdriver = { - .remove =__exit_p (ssi_remove), + .probe = ssi_probe, + .remove = ssi_remove, .driver = { .name ="omap_ssi" , .pm =DEV_PM_OPS ,
@@ -600,7 +601,7 @@ static struct platform_driver ssi_pdriver = { }, }; -module_platform_driver_probe (ssi_pdriver, ssi_probe); +module_platform_driver (ssi_pdriver);MODULE_ALIAS ("platform:omap_ssi" );MODULE_AUTHOR ("Carlos Chinea <[email protected]>" );
drivers/hsi/controllers/omap_ssi_port.c +10 -9
@@ -171,7 +171,7 @@ static int ssi_div_set(void *data, u64 val)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, +static int ssi_debug_add_port (struct omap_ssi_port *omap_port,struct dentry *dir) {struct hsi_port *port =to_hsi_port (omap_port->dev);
@@ -1007,7 +1007,7 @@ static irqreturn_t ssi_wake_isr(int irq __maybe_unused, void *ssi_port)return IRQ_HANDLED ; } -static int __init ssi_port_irq (struct hsi_port *port, +static int ssi_port_irq (struct hsi_port *port,struct platform_device *pd) {struct omap_ssi_port *omap_port =hsi_port_drvdata (port);
@@ -1029,7 +1029,7 @@ static int __init ssi_port_irq(struct hsi_port *port,return err; } -static int __init ssi_wake_irq (struct hsi_port *port, +static int ssi_wake_irq (struct hsi_port *port,struct platform_device *pd) {struct omap_ssi_port *omap_port =hsi_port_drvdata (port);
@@ -1060,7 +1060,7 @@ static int __init ssi_wake_irq(struct hsi_port *port,return err; } -static void __init ssi_queues_init (struct omap_ssi_port *omap_port) +static void ssi_queues_init (struct omap_ssi_port *omap_port) {unsigned int ch;
@@ -1071,7 +1071,7 @@ static void __init ssi_queues_init(struct omap_ssi_port *omap_port)INIT_LIST_HEAD (&omap_port->brkqueue); } -static int __init ssi_port_get_iomem (struct platform_device *pd, +static int ssi_port_get_iomem (struct platform_device *pd,const char *name,void __iomem **pbase,dma_addr_t *phy) {struct hsi_port *port =platform_get_drvdata (pd);
@@ -1104,7 +1104,7 @@ static int __init ssi_port_get_iomem(struct platform_device *pd,return 0 ; } -static int __init ssi_port_probe (struct platform_device *pd) +static int ssi_port_probe (struct platform_device *pd) {struct device_node *np = pd->dev.of_node;struct hsi_port *port;
@@ -1217,7 +1217,7 @@ error:return err; } -static int __exit ssi_port_remove(struct platform_device *pd) +static int ssi_port_remove (struct platform_device *pd) {struct hsi_port *port =platform_get_drvdata (pd);struct omap_ssi_port *omap_port =hsi_port_drvdata (port);
@@ -1370,7 +1370,8 @@ MODULE_DEVICE_TABLE(of, omap_ssi_port_of_match);#endif static struct platform_driver ssi_port_pdriver = { - .remove =__exit_p (ssi_port_remove), + .probe = ssi_port_probe, + .remove = ssi_port_remove, .driver = { .name ="omap_ssi_port" , .of_match_table = omap_ssi_port_of_match,
@@ -1378,7 +1379,7 @@ static struct platform_driver ssi_port_pdriver = { }, }; -module_platform_driver_probe (ssi_port_pdriver, ssi_port_probe); +module_platform_driver (ssi_port_pdriver);MODULE_ALIAS ("platform:omap_ssi_port" );MODULE_AUTHOR ("Carlos Chinea <[email protected]>" );
Signature · 1 line
2.8.1
Sebastian Reichel
maintainerPATCH 4/6 HSI: omap_ssi: fix removal of port platform device
In reply to Sebastian ReichelThis avoids removal of the HSI port device when only the platform port device should be removed and clears the POPULATED bit in the DT node, so that a new platform device is created when the driver is probed again.
--- drivers/hsi/controllers/omap_ssi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hsi/controllers/omap_ssi.c +4 -0
@@ -451,6 +451,10 @@ static int ssi_remove_ports(struct device *dev, void *c) {struct platform_device *pdev =to_platform_device (dev); +if (!dev->of_node) +return 0 ; + +of_node_clear_flag (dev->of_node,OF_POPULATED );of_device_unregister (pdev);return 0 ;
Signature · 1 line
2.8.1
Re: [PATCH 4/6] HSI: omap_ssi: fix removal of port platform device
Quoted 7 lines · Sebastian Reichel
This avoids removal of the HSI port device when only the platform port device should be removed and clears the POPULATED bit in the DT node, so that a new platform device is created when the driver is probed again.
Signed-off-by Sebastian Reichel <[email protected]>
3,4: Acked-by: Pavel Machek <[email protected]>
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Sebastian Reichel
maintainerPATCH 5/6 HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module
In reply to Sebastian ReichelMerge omap_ssi and omap_ssi_port into one module. This fixes problems with module cycle dependencies introduced by future patches.
---
drivers/hsi/controllers/Kconfig | 5 -----
drivers/hsi/controllers/Makefile | 4 ++--
drivers/hsi/controllers/omap_ssi.h | 2 ++
drivers/hsi/controllers/{omap_ssi.c => omap_ssi_core.c} | 17 ++++++++++++++++-
drivers/hsi/controllers/omap_ssi_port.c | 16 +---------------
5 files changed, 21 insertions(+), 23 deletions(-)
rename drivers/hsi/controllers/{omap_ssi.c => omap_ssi_core.c} (97%)drivers/hsi/controllers/Kconfig +0 -5
@@ -12,8 +12,3 @@ config OMAP_SSI 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 +2 -2
@@ -2,5 +2,5 @@ # Makefile for HSI controllers drivers # -obj-$(CONFIG_OMAP_SSI) += omap_ssi.o -obj-$(CONFIG_OMAP_SSI_PORT) += omap_ssi_port.o +omap_ssi-objs += omap_ssi_core.o omap_ssi_port.o +obj-$(CONFIG_OMAP_SSI) += omap_ssi.o
drivers/hsi/controllers/omap_ssi.h +2 -0
@@ -164,4 +164,6 @@ struct omap_ssi_controller { #endif }; +extern struct platform_driver ssi_port_pdriver; +#endif /* __LINUX_HSI_OMAP_SSI_H__ */
drivers/hsi/controllers/omap_ssi_core.c renamed from drivers/hsi/controllers/omap_ssi.c +16 -1
@@ -605,7 +605,22 @@ static struct platform_driver ssi_pdriver = { }, }; -module_platform_driver (ssi_pdriver); +static int __init ssi_init (void ) { +int ret; + + ret =platform_driver_register (&ssi_pdriver); +if (ret) +return ret; + +return platform_driver_register (&ssi_port_pdriver); +} +module_init (ssi_init); + +static void __exit ssi_exit(void) { +platform_driver_unregister (&ssi_port_pdriver); +platform_driver_unregister (&ssi_pdriver); +} +module_exit (ssi_exit);MODULE_ALIAS ("platform:omap_ssi" );MODULE_AUTHOR ("Carlos Chinea <[email protected]>" );
drivers/hsi/controllers/omap_ssi_port.c +1 -15
@@ -1117,11 +1117,6 @@ static int ssi_port_probe(struct platform_device *pd)dev_dbg (&pd->dev,"init ssi port...\n" ); -if (!try_module_get (ssi->owner)) { -dev_err (&pd->dev,"could not increment parent module refcount\n" ); -return -ENODEV ; - } -if (!ssi->port || !omap_ssi->port) {dev_err (&pd->dev,"ssi controller not initialized!\n" ); err = -ENODEV ;
@@ -1242,7 +1237,6 @@ static int ssi_port_remove(struct platform_device *pd) omap_ssi->port[omap_port->port_id] =NULL ;platform_set_drvdata (pd,NULL ); -module_put (ssi->owner);pm_runtime_disable (&pd->dev);return 0 ;
@@ -1369,7 +1363,7 @@ MODULE_DEVICE_TABLE(of, omap_ssi_port_of_match);#define omap_ssi_port_of_match NULL#endif -static struct platform_driver ssi_port_pdriver = { +struct platform_driver ssi_port_pdriver = { .probe = ssi_port_probe, .remove = ssi_port_remove, .driver = {
@@ -1378,11 +1372,3 @@ static struct platform_driver ssi_port_pdriver = { .pm = DEV_PM_OPS, }, }; - -module_platform_driver (ssi_port_pdriver); - -MODULE_ALIAS ("platform:omap_ssi_port" ); -MODULE_AUTHOR ("Carlos Chinea <[email protected]>" ); -MODULE_AUTHOR ("Sebastian Reichel <[email protected]>" ); -MODULE_DESCRIPTION ("Synchronous Serial Interface Port Driver" ); -MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.8.1
Re: [PATCH 5/6] HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module
Hi!
Quoted 3 lines
Merge
omap_ssiandomap_ssi_portinto one module. This fixes problems with module cycle dependencies introduced by future patches.
Interesting way of saying that this prepares us for future patch :-).
drivers/hsi/controllers/Makefile line 6
Quoted 9 lines
+++ b/drivers/hsi/controllers/Makefile
drivers/hsi/controllers/Makefile +2
-2@@ -2,5 +2,5 @@ # Makefile for HSI controllers drivers # -obj-$(CONFIG_OMAP_SSI) += omap_ssi.o -obj-$(CONFIG_OMAP_SSI_PORT) += omap_ssi_port.o +omap_ssi-objs += omap_ssi_core.o omap_ssi_port.o +obj-$(CONFIG_OMAP_SSI) += omap_ssi.o
Can you simply do
obj-$(CONFIG_OMAP_SSI) += omap_ssi_core.o omap_ssi_port.o
instead?
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Sebastian Reichel
maintainerRe: [PATCH 5/6] HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module
Hi,
Quoted 5 lines · Pavel Machek
Quoted 5 lines
+++ b/drivers/hsi/controllers/Makefile
drivers/hsi/controllers/Makefile +0
-0@@ -2,5 +2,5 @@ # Makefile for HSI controllers drivers #
Quoted 8 lines
drivers/hsi/controllers/Makefile line 6
Quoted 4 lines
drivers/hsi/controllers/Makefile +2
-2-obj-$(CONFIG_OMAP_SSI) += omap_ssi.o -obj-$(CONFIG_OMAP_SSI_PORT) += omap_ssi_port.o +omap_ssi-objs += omap_ssi_core.o omap_ssi_port.o +obj-$(CONFIG_OMAP_SSI) += omap_ssi.oCan you simply do
obj-$(CONFIG_OMAP_SSI) += omap_ssi_core.o omap_ssi_port.o
No, that would result in omap_ssi_core.ko and omap_ssi_port.ko if CONFIG_OMAP_SSI is enabled. Basically it's an optimized variant of the current behaviour, but it still builds two modules.
-- Sebastian
Pavel Machek
Acked-byRe: [PATCH 5/6] HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module
Quoted 15 lines · Sebastian Reichel
Hi,
Quoted 12 lines · Pavel Machek
drivers/hsi/controllers/Makefile line 6
Quoted 9 lines
+++ b/drivers/hsi/controllers/Makefile
drivers/hsi/controllers/Makefile +2
-2@@ -2,5 +2,5 @@ # Makefile for HSI controllers drivers # -obj-$(CONFIG_OMAP_SSI) += omap_ssi.o -obj-$(CONFIG_OMAP_SSI_PORT) += omap_ssi_port.o +omap_ssi-objs += omap_ssi_core.o omap_ssi_port.o +obj-$(CONFIG_OMAP_SSI) += omap_ssi.oCan you simply do
Quoted 5 lines
Quoted 1 line
obj-$(CONFIG_OMAP_SSI) += omap_ssi_core.o omap_ssi_port.o
No, that would result in omap_ssi_core.ko and omap_ssi_port.ko if
CONFIG_OMAP_SSIis enabled. Basically it's an optimized variant of the current behaviour, but it still builds two modules.
Aha... I was not thinking about modular build.
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 5/6] HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module
In reply to Sebastian ReichelQuoted 3 lines · Sebastian Reichel
Merge
omap_ssiandomap_ssi_portinto one module. This fixes problems with module cycle dependencies introduced by future patches.
Can you please check against the hardware for the split? For reference, below is what I dumped out from dm3730 for the modules on the L4 interconnect:
0x48000000 + 0x40000 + 0x18000 = 0x48058000, size 0x1000, parent with sysc
0x48000000 + 0x40000 + 0x19000 = 0x48059000, size 0x1000, gdd 0x48000000 + 0x40000 + 0x1a000 = 0x4805a000, size 0x1000, ssi_port1 0x48000000 + 0x40000 + 0x1b000 = 0x4805b000, size 0x1000, ssi_port2
0x48000000 + 0x40000 + 0x1c000 = 0x4805c000, size 0x1000, target agent
So the parent target module at 0x48058000 controls everything with the sysc register. The gdd, ssi_port1 and ssi_port2 are children of the parent target module at 0x48058000 and should not have any sysc related registers.
Can you please check if gdd, ssi_port1 and ssi_port2 have any sysc related registers too? :) If they do, then they too can idle on their own but most likely still depend on the parent module.
The target agent above is a separate module with the interconnect related registers, no need to do anything with that AFAIK.
I believe this is the same for 34xx too but have not dumped it out of the hardware. I can do that if the above does not match what you're seeing.
If we want to have separate driver modules, you can do this:
1. Have the parent target module at 0x4805800 do PM runtime calls, they then propagate to the hwmod code properly for the ti,hwmods = "ssi" entry. This module can be minimal, and can also have child devices within it's first 0x1000 sized range if needed.
2. Have the parent target module probe the child device drivers as needed with of_platform_populate() at the end of it's probe. The children can't be pm_runtime_irq_safe as it permanently blocks the idling of the parent.
3. Have the the parent target module at 0x4805800 implement PM runtime for it's children by registering struct dev_pm_ops for them.
If you really want to have them all as a single module then that should work too as long as there's only one set of sysc related registers.
Regards,
Tony
Sebastian Reichel
maintainerRe: [PATCH 5/6] HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module
Hi,
Quoted 6 lines · Tony Lindgren
Quoted 3 lines · Sebastian Reichel
Merge
omap_ssiandomap_ssi_portinto one module. This fixes problems with module cycle dependencies introduced by future patches.Can you please check against the hardware for the split?
This only merges the kernel modules. There are still multiple devices.
Quoted 15 lines
For reference, below is what I dumped out from dm3730 for the modules on the L4 interconnect:
0x48000000+0x40000+0x18000=0x48058000, size0x1000, parent with sysc
0x48000000+0x40000+0x19000=0x48059000, size0x1000, gdd0x48000000+0x40000+0x1a000=0x4805a000, size0x1000,ssi_port10x48000000+0x40000+0x1b000=0x4805b000, size0x1000,ssi_port2
0x48000000+0x40000+0x1c000=0x4805c000, size0x1000, target agentSo the parent target module at
0x48058000controls everything with the sysc register. The gdd,ssi_port1andssi_port2are children of the parent target module at0x48058000and should not have any sysc related registers.
Quoted 4 lines
Can you please check if gdd,
ssi_port1andssi_port2have any sysc related registers too? :) If they do, then they too can idle on their own but most likely still depend on the parent module.
The original driver from Nokia (I don't have proper documentation [the SSI related parts are censored in the public OMAP TRM]) does not give hints about any port related SYSC registers. Also it used just one platform device for the whole ssi module. I'm pretty sure, that the SSI stuff shares one set of SYSC registers.
Quoted 2 lines
The target agent above is a separate module with the interconnect related registers, no need to do anything with that AFAIK.
The target agent is not referenced at all in Nokia's driver.
Quoted 3 lines
I believe this is the same for 34xx too but have not dumped it out of the hardware. I can do that if the above does not match what you're seeing.
Parent with sysc/gdd/port1/port2 looks familiar.
Quoted 13 lines
If we want to have separate driver modules, you can do this:
1. Have the parent target module at
0x4805800do PM runtime calls, they then propagate to the hwmod code properly for the ti,hwmods = "ssi" entry. This module can be minimal, and can also have child devices within it's first0x1000sized range if needed.2. Have the parent target module probe the child device drivers as needed with
of_platform_populate()at the end of it's probe. The children can't bepm_runtime_irq_safeas it permanently blocks the idling of the parent.
Quoted 7 lines
3. Have the the parent target module at
0x4805800implement PM runtime for it's children by registering structdev_pm_opsfor them.If you really want to have them all as a single module then that should work too as long as there's only one set of sysc related registers.
AFAIK there is only one set of sysc registers for the whole SSI module, which must be active if any of the SSI related registers is accessed. I think we should keep the current structure (ports being sub-devices of the core), so runtime PM API will just work.
At the moment it does not work because of pm_runtime_irq_safe. I'm currently working on that (my work-in-progress branch is [0]). With the changes from this branch runtime PM status looks fine in sysfs (I have not yet checked if SoC goes to idle if I enable runtime pm for tty e.t.c.) also there are most likely still some "sleeping function call from atomic context" bugs.
[0] https://git.kernel.org/cgit/linux/kernel/git/sre/linux-hsi.git/log/?h=runtime-pm-fixes
-- Sebastian
Re: [PATCH 5/6] HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module
Quoted 4 lines · Sebastian Reichel
Hi,
Quoted 1 line · Tony Lindgren
* Sebastian Reichel <[email protected]> [160429 19:11]:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Merge
omap_ssiandomap_ssi_portinto one module. This fixes problems with module cycle dependencies introduced by future patches.Can you please check against the hardware for the split?
This only merges the kernel modules. There are still multiple devices.
OK
Quoted 20 lines
Quoted 15 lines
For reference, below is what I dumped out from dm3730 for the modules on the L4 interconnect:
0x48000000+0x40000+0x18000=0x48058000, size0x1000, parent with sysc
0x48000000+0x40000+0x19000=0x48059000, size0x1000, gdd0x48000000+0x40000+0x1a000=0x4805a000, size0x1000,ssi_port10x48000000+0x40000+0x1b000=0x4805b000, size0x1000,ssi_port2
0x48000000+0x40000+0x1c000=0x4805c000, size0x1000, target agentSo the parent target module at
0x48058000controls everything with the sysc register. The gdd,ssi_port1andssi_port2are children of the parent target module at0x48058000and should not have any sysc related registers.Quoted 4 lines
Can you please check if gdd,
ssi_port1andssi_port2have any sysc related registers too? :) If they do, then they too can idle on their own but most likely still depend on the parent module.
Quoted 5 lines
The original driver from Nokia (I don't have proper documentation [the SSI related parts are censored in the public OMAP TRM]) does not give hints about any port related SYSC registers. Also it used just one platform device for the whole ssi module. I'm pretty sure, that the SSI stuff shares one set of SYSC registers.
OK
Quoted 4 lines
Quoted 2 lines
The target agent above is a separate module with the interconnect related registers, no need to do anything with that AFAIK.
The target agent is not referenced at all in Nokia's driver.
Yes chances are you don't have to do anything with that.
Quoted 23 lines
Quoted 3 lines
I believe this is the same for 34xx too but have not dumped it out of the hardware. I can do that if the above does not match what you're seeing.
Parent with sysc/gdd/port1/port2 looks familiar.
Quoted 17 lines
If we want to have separate driver modules, you can do this:
1. Have the parent target module at
0x4805800do PM runtime calls, they then propagate to the hwmod code properly for the ti,hwmods = "ssi" entry. This module can be minimal, and can also have child devices within it's first0x1000sized range if needed.2. Have the parent target module probe the child device drivers as needed with
of_platform_populate()at the end of it's probe. The children can't bepm_runtime_irq_safeas it permanently blocks the idling of the parent.3. Have the the parent target module at
0x4805800implement PM runtime for it's children by registering structdev_pm_opsfor them.
Quoted 8 lines
Quoted 3 lines
If you really want to have them all as a single module then that should work too as long as there's only one set of sysc related registers.
AFAIK there is only one set of sysc registers for the whole SSI module, which must be active if any of the SSI related registers is accessed. I think we should keep the current structure (ports being sub-devices of the core), so runtime PM API will just work.
OK makes sense, good to hear there's only one sysc register.
Quoted 6 lines
At the moment it does not work because of
pm_runtime_irq_safe. I'm currently working on that (my work-in-progress branch is [0]). With the changes from this branch runtime PM status looks fine in sysfs (I have not yet checked if SoC goes to idle if I enable runtime pm for ttye.t.c.) also there are most likely still some "sleeping function call from atomic context" bugs.
Yes pm_runtime_irq_safe is not nice as it permanently enables the parent.. To avoid that you should just remove that and set up delayed work where needed.
Regards,
Tony
Sebastian Reichel
maintainerPATCH 6/6 HSI: omap-ssi: add clk change support
In reply to Sebastian ReichelThis adds support for frequency changes of the SSI functional clock, which may occur due to DVFS.
--- drivers/hsi/controllers/omap_ssi.h | 6 ++++ drivers/hsi/controllers/omap_ssi_core.c | 63 +++++++++++++++++++++++++++++++++ drivers/hsi/controllers/omap_ssi_port.c | 20 +++++++++++ 3 files changed, 89 insertions(+)
drivers/hsi/controllers/omap_ssi.h +6 -0
@@ -134,6 +134,8 @@ struct gdd_trn {* @gdd_tasklet: bottom half for DMA transfers * @gdd_trn: Array of GDD transaction data for ongoing GDD transfers * @lock: lock to serialize access to GDD +* @fck_nb: DVFS notfifier block +* @fck_rate: clock rate * @loss_count: To follow if we need to restore context or not * @max_speed: Maximum TX speed (Kb/s) set by the clients. * @sysconfig: SSI controller saved context
@@ -151,6 +153,7 @@ struct omap_ssi_controller {struct tasklet_struct gdd_tasklet;struct gdd_trn gdd_trn[SSI_MAX_GDD_LCH ];spinlock_t lock; +struct notifier_block fck_nb;unsigned long fck_rate;u32 loss_count;u32 max_speed;
@@ -164,6 +167,9 @@ struct omap_ssi_controller { #endif }; +void omap_ssi_port_update_fclk (struct hsi_controller *ssi, +struct omap_ssi_port *omap_port); +extern struct platform_driver ssi_port_pdriver;#endif /* __LINUX_HSI_OMAP_SSI_H__ */
drivers/hsi/controllers/omap_ssi_core.c +63 -0
81 lines not on this page · raw message
drivers/hsi/controllers/omap_ssi_port.c +20 -0
@@ -23,6 +23,7 @@#include <linux/platform_device.h> #include <linux/dma-mapping.h> #include <linux/pm_runtime.h> +#include <linux/delay.h> #include <linux/gpio/consumer.h> #include <linux/debugfs.h>
@@ -514,6 +515,11 @@ static int ssi_flush(struct hsi_client *cl)pm_runtime_get_sync (omap_port->pdev);spin_lock_bh (&omap_port->lock); + +/* stop all ssi communication */ +pinctrl_pm_select_idle_state (omap_port->pdev); +udelay (1 );/* wait for racing frames */ +/* Stop all DMA transfers */ for (i =0 ; i <SSI_MAX_GDD_LCH ; i++) { msg = omap_ssi->gdd_trn[i].msg;
@@ -550,6 +556,10 @@ static int ssi_flush(struct hsi_client *cl)ssi_flush_queue (&omap_port->rxqueue[i],NULL ); }ssi_flush_queue (&omap_port->brkqueue,NULL ); + +/* Resume SSI communication */ +pinctrl_pm_select_default_state (omap_port->pdev); +spin_unlock_bh (&omap_port->lock);pm_runtime_put_sync (omap_port->pdev);
@@ -1302,6 +1312,16 @@ static int ssi_restore_divisor(struct omap_ssi_port *omap_port)return 0 ; } +void omap_ssi_port_update_fclk (struct hsi_controller *ssi, +struct omap_ssi_port *omap_port) +{ +/* update divisor */ +u32 div =ssi_calculate_div (ssi); + omap_port->sst.divisor = div; +ssi_restore_divisor (omap_port); +} +EXPORT_SYMBOL_GPL (omap_ssi_port_update_fclk); +static int omap_ssi_port_runtime_suspend (struct device *dev) {struct hsi_port *port =dev_get_drvdata (dev);
Signature · 1 line
2.8.1
Re: [PATCH 6/6] HSI: omap-ssi: add clk change support
Quoted 4 lines · Sebastian Reichel
This adds support for frequency changes of the SSI functional clock, which may occur due to DVFS.
Signed-off-by Sebastian Reichel <[email protected]>
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html