* [PATCH 0/2] omap-ssi: clk change support
@ 2016-01-31 0:52 Sebastian Reichel
2016-01-31 0:52 ` [PATCH 1/2] ARM: dts: OMAP3-N950-N9: Add ssi idle pinctrl state Sebastian Reichel
2016-01-31 0:52 ` [PATCH 2/2] HSI: omap-ssi: add clk change support Sebastian Reichel
0 siblings, 2 replies; 7+ messages in thread
From: Sebastian Reichel @ 2016-01-31 0:52 UTC (permalink / raw)
To: Sebastian Reichel, Tony Lindgren, Benoît Cousson, Aaro Koskinen
Cc: linux-omap, linux-kernel
Hi,
During diffing the n950 with the mainline kernel I noticed, that the main
difference is additional DVFS support. These patches import those differences
(forward-ported to pinctrl & common clock framework) to the mainline kernel.
-- Sebastian
Sebastian Reichel (2):
ARM: dts: OMAP3-N950-N9: Add ssi idle pinctrl state
HSI: omap-ssi: add clk change support
arch/arm/boot/dts/omap3-n950-n9.dtsi | 16 ++++++++-
drivers/hsi/controllers/omap_ssi.c | 63 +++++++++++++++++++++++++++++++++
drivers/hsi/controllers/omap_ssi.h | 6 ++++
drivers/hsi/controllers/omap_ssi_port.c | 20 +++++++++++
4 files changed, 104 insertions(+), 1 deletion(-)
--
2.7.0.rc3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ARM: dts: OMAP3-N950-N9: Add ssi idle pinctrl state
2016-01-31 0:52 [PATCH 0/2] omap-ssi: clk change support Sebastian Reichel
@ 2016-01-31 0:52 ` Sebastian Reichel
2016-02-12 22:08 ` Tony Lindgren
2016-01-31 0:52 ` [PATCH 2/2] HSI: omap-ssi: add clk change support Sebastian Reichel
1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Reichel @ 2016-01-31 0:52 UTC (permalink / raw)
To: Sebastian Reichel, Tony Lindgren, Benoît Cousson, Aaro Koskinen
Cc: linux-omap, linux-kernel
This adds an idle pinctrl state, which will be used
by the driver to avoid incoming data during clock
rate changes or data flushing.
Signed-off-By: Sebastian Reichel <sre@kernel.org>
---
arch/arm/boot/dts/omap3-n950-n9.dtsi | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi
index aa8232828155..66c65e8008ef 100644
--- a/arch/arm/boot/dts/omap3-n950-n9.dtsi
+++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi
@@ -73,6 +73,19 @@
>;
};
+ ssi_pins_idle: pinmux_ssi_pins_idle {
+ pinctrl-single,pins = <
+ OMAP3_CORE1_IOPAD(0x217c, PIN_OUTPUT | MUX_MODE7) /* ssi1_dat_tx */
+ OMAP3_CORE1_IOPAD(0x217e, PIN_OUTPUT | MUX_MODE7) /* ssi1_flag_tx */
+ OMAP3_CORE1_IOPAD(0x2180, PIN_INPUT_PULLDOWN | MUX_MODE7) /* ssi1_rdy_tx */
+ OMAP3_CORE1_IOPAD(0x2182, PIN_INPUT | WAKEUP_EN | MUX_MODE4) /* ssi1_wake_tx (cawake) */
+ OMAP3_CORE1_IOPAD(0x2184, PIN_INPUT | MUX_MODE7) /* ssi1_dat_rx */
+ OMAP3_CORE1_IOPAD(0x2186, PIN_INPUT | MUX_MODE7) /* ssi1_flag_rx */
+ OMAP3_CORE1_IOPAD(0x2188, PIN_OUTPUT | MUX_MODE4) /* ssi1_rdy_rx */
+ OMAP3_CORE1_IOPAD(0x218a, PIN_OUTPUT | MUX_MODE7) /* ssi1_wake */
+ >;
+ };
+
modem_pins1: pinmux_modem_core1_pins {
pinctrl-single,pins = <
OMAP3_CORE1_IOPAD(0x207a, PIN_INPUT | WAKEUP_EN | MUX_MODE4) /* gpio_34 (ape_rst_rq) */
@@ -237,8 +250,9 @@
};
&ssi_port1 {
- pinctrl-names = "default";
+ pinctrl-names = "default", "idle";
pinctrl-0 = <&ssi_pins>;
+ pinctrl-1 = <&ssi_pins_idle>;
ti,ssi-cawake-gpio = <&gpio5 23 GPIO_ACTIVE_HIGH>; /* 151 */
--
2.7.0.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] HSI: omap-ssi: add clk change support
2016-01-31 0:52 [PATCH 0/2] omap-ssi: clk change support Sebastian Reichel
2016-01-31 0:52 ` [PATCH 1/2] ARM: dts: OMAP3-N950-N9: Add ssi idle pinctrl state Sebastian Reichel
@ 2016-01-31 0:52 ` Sebastian Reichel
2016-02-23 2:34 ` Sebastian Reichel
1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Reichel @ 2016-01-31 0:52 UTC (permalink / raw)
To: Sebastian Reichel, Tony Lindgren, Benoît Cousson, Aaro Koskinen
Cc: linux-omap, linux-kernel
This adds support for frequency changes of the SSI
functional clock, which may occur due to DVFS.
Signed-off-By: Sebastian Reichel <sre@kernel.org>
---
drivers/hsi/controllers/omap_ssi.c | 63 +++++++++++++++++++++++++++++++++
drivers/hsi/controllers/omap_ssi.h | 6 ++++
drivers/hsi/controllers/omap_ssi_port.c | 20 +++++++++++
3 files changed, 89 insertions(+)
diff --git a/drivers/hsi/controllers/omap_ssi.c b/drivers/hsi/controllers/omap_ssi.c
index f6d3100b7a32..8bc5f2fed869 100644
--- a/drivers/hsi/controllers/omap_ssi.c
+++ b/drivers/hsi/controllers/omap_ssi.c
@@ -291,6 +291,64 @@ static unsigned long ssi_get_clk_rate(struct hsi_controller *ssi)
return rate;
}
+static int ssi_clk_event(struct notifier_block *nb, unsigned long event,
+ void *data)
+{
+ struct omap_ssi_controller *omap_ssi = container_of(nb,
+ struct omap_ssi_controller, fck_nb);
+ struct hsi_controller *ssi = to_hsi_controller(omap_ssi->dev);
+ struct clk_notifier_data *clk_data = data;
+ struct omap_ssi_port *omap_port;
+ int i;
+
+ switch (event) {
+ case PRE_RATE_CHANGE:
+ dev_dbg(&ssi->device, "pre rate change\n");
+
+ for (i = 0; i < ssi->num_ports; i++) {
+ omap_port = omap_ssi->port[i];
+
+ if (!omap_port)
+ continue;
+
+ /* Workaround for SWBREAK + CAwake down race in CMT */
+ tasklet_disable(&omap_port->wake_tasklet);
+
+ /* stop all ssi communication */
+ pinctrl_pm_select_idle_state(omap_port->pdev);
+ udelay(1); /* wait for racing frames */
+ }
+
+ break;
+ case ABORT_RATE_CHANGE:
+ dev_dbg(&ssi->device, "abort rate change\n");
+ /* Fall through */
+ case POST_RATE_CHANGE:
+ dev_dbg(&ssi->device, "post rate change (%lu -> %lu)\n",
+ clk_data->old_rate, clk_data->new_rate);
+ omap_ssi->fck_rate = DIV_ROUND_CLOSEST(clk_data->new_rate, 1000); /* KHz */
+
+ for (i = 0; i < ssi->num_ports; i++) {
+ omap_port = omap_ssi->port[i];
+
+ if (!omap_port)
+ continue;
+
+ omap_ssi_port_update_fclk(ssi, omap_port);
+
+ /* resume ssi communication */
+ pinctrl_pm_select_default_state(omap_port->pdev);
+ tasklet_enable(&omap_port->wake_tasklet);
+ }
+
+ break;
+ default:
+ break;
+ }
+
+ return NOTIFY_DONE;
+}
+
static int __init ssi_get_iomem(struct platform_device *pd,
const char *name, void __iomem **pbase, dma_addr_t *phy)
{
@@ -371,6 +429,10 @@ static int __init ssi_add_controller(struct hsi_controller *ssi,
goto out_err;
}
+ omap_ssi->fck_nb.notifier_call = ssi_clk_event;
+ omap_ssi->fck_nb.priority = INT_MAX;
+ clk_notifier_register(omap_ssi->fck, &omap_ssi->fck_nb);
+
/* TODO: find register, which can be used to detect context loss */
omap_ssi->get_loss = NULL;
@@ -434,6 +496,7 @@ static void ssi_remove_controller(struct hsi_controller *ssi)
int id = ssi->id;
tasklet_kill(&omap_ssi->gdd_tasklet);
hsi_unregister_controller(ssi);
+ clk_notifier_unregister(omap_ssi->fck, &omap_ssi->fck_nb);
ida_simple_remove(&platform_omap_ssi_ida, id);
}
diff --git a/drivers/hsi/controllers/omap_ssi.h b/drivers/hsi/controllers/omap_ssi.h
index f9aaf37262be..2797ab284460 100644
--- a/drivers/hsi/controllers/omap_ssi.h
+++ b/drivers/hsi/controllers/omap_ssi.h
@@ -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,4 +167,7 @@ struct omap_ssi_controller {
#endif
};
+void omap_ssi_port_update_fclk(struct hsi_controller *ssi,
+ struct omap_ssi_port *omap_port);
+
#endif /* __LINUX_HSI_OMAP_SSI_H__ */
diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c
index 02e66032ae73..6557aaa52a36 100644
--- a/drivers/hsi/controllers/omap_ssi_port.c
+++ b/drivers/hsi/controllers/omap_ssi_port.c
@@ -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/of_gpio.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);
@@ -1319,6 +1329,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);
--
2.7.0.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ARM: dts: OMAP3-N950-N9: Add ssi idle pinctrl state
2016-01-31 0:52 ` [PATCH 1/2] ARM: dts: OMAP3-N950-N9: Add ssi idle pinctrl state Sebastian Reichel
@ 2016-02-12 22:08 ` Tony Lindgren
0 siblings, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2016-02-12 22:08 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Benoît Cousson, Aaro Koskinen, linux-omap, linux-kernel
* Sebastian Reichel <sre@kernel.org> [160130 16:53]:
> This adds an idle pinctrl state, which will be used
> by the driver to avoid incoming data during clock
> rate changes or data flushing.
Picking this patch into omap-for-v4.6/dt thanks.
Tony
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] HSI: omap-ssi: add clk change support
2016-01-31 0:52 ` [PATCH 2/2] HSI: omap-ssi: add clk change support Sebastian Reichel
@ 2016-02-23 2:34 ` Sebastian Reichel
2016-02-24 15:19 ` Arnd Bergmann
0 siblings, 1 reply; 7+ messages in thread
From: Sebastian Reichel @ 2016-02-23 2:34 UTC (permalink / raw)
To: Tony Lindgren, Benoît Cousson, Aaro Koskinen
Cc: linux-omap, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
Hi,
On Sun, Jan 31, 2016 at 01:52:38AM +0100, Sebastian Reichel wrote:
> This adds support for frequency changes of the SSI
> functional clock, which may occur due to DVFS.
I queued this one for 4.6.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] HSI: omap-ssi: add clk change support
2016-02-23 2:34 ` Sebastian Reichel
@ 2016-02-24 15:19 ` Arnd Bergmann
2016-02-24 17:05 ` Sebastian Reichel
0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2016-02-24 15:19 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen, linux-omap,
linux-kernel
On Tuesday 23 February 2016 03:34:43 Sebastian Reichel wrote:
>
> On Sun, Jan 31, 2016 at 01:52:38AM +0100, Sebastian Reichel wrote:
> > This adds support for frequency changes of the SSI
> > functional clock, which may occur due to DVFS.
>
> I queued this one for 4.6.
>
This causes a regression when SSI is a loadable module:
ERROR: "omap_ssi_port_update_fclk" [drivers/hsi/controllers/omap_ssi.ko] undefined!
I suspect that there is now some form of circular dependency between the
various modules, but I couldn't figure it out. Can you have a look,
and maybe revert the commit in linux-next for the time being?
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] HSI: omap-ssi: add clk change support
2016-02-24 15:19 ` Arnd Bergmann
@ 2016-02-24 17:05 ` Sebastian Reichel
0 siblings, 0 replies; 7+ messages in thread
From: Sebastian Reichel @ 2016-02-24 17:05 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Tony Lindgren, Benoît Cousson, Aaro Koskinen, linux-omap,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 862 bytes --]
Hi,
On Wed, Feb 24, 2016 at 04:19:09PM +0100, Arnd Bergmann wrote:
> On Tuesday 23 February 2016 03:34:43 Sebastian Reichel wrote:
> >
> > On Sun, Jan 31, 2016 at 01:52:38AM +0100, Sebastian Reichel wrote:
> > > This adds support for frequency changes of the SSI
> > > functional clock, which may occur due to DVFS.
> >
> > I queued this one for 4.6.
> >
>
> This causes a regression when SSI is a loadable module:
>
> ERROR: "omap_ssi_port_update_fclk" [drivers/hsi/controllers/omap_ssi.ko] undefined!
Thanks for the notice.
> I suspect that there is now some form of circular dependency between the
> various modules, but I couldn't figure it out. Can you have a look,
> and maybe revert the commit in linux-next for the time being?
I dropped the patch from my -next branch until I figured out what's
going on.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-02-24 17:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-31 0:52 [PATCH 0/2] omap-ssi: clk change support Sebastian Reichel
2016-01-31 0:52 ` [PATCH 1/2] ARM: dts: OMAP3-N950-N9: Add ssi idle pinctrl state Sebastian Reichel
2016-02-12 22:08 ` Tony Lindgren
2016-01-31 0:52 ` [PATCH 2/2] HSI: omap-ssi: add clk change support Sebastian Reichel
2016-02-23 2:34 ` Sebastian Reichel
2016-02-24 15:19 ` Arnd Bergmann
2016-02-24 17:05 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).