From 633f67a51d078bea627f22d6208442e1e1f391cb Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 17 Jan 2016 16:49:07 +0100 Subject: [PATCH 1/2] HSI: nokia-modem: add n950 and n9 support The Nokia N950 and Nokia N9 also have a SSI connected modem, which use the same protocols as the Nokia N900, but with increased link speed (96000 kbps instead of 55000 kbps) and with less GPIOs. Since it's unclear, if the N950 and the N9 use exactly the same modem, each of them gets their own compatible string. Acked-by: Rob Herring Tested-by: Aaro Koskinen Signed-off-by: Sebastian Reichel --- .../devicetree/bindings/hsi/nokia-modem.txt | 12 +++++++----- drivers/hsi/clients/nokia-modem.c | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/hsi/nokia-modem.txt b/Documentation/devicetree/bindings/hsi/nokia-modem.txt index 8a979780452b..53de1d9d0b95 100644 --- a/Documentation/devicetree/bindings/hsi/nokia-modem.txt +++ b/Documentation/devicetree/bindings/hsi/nokia-modem.txt @@ -7,6 +7,8 @@ properties are needed by the Nokia modem HSI client: Required properties: - compatible: Should be one of "nokia,n900-modem" + "nokia,n950-modem" + "nokia,n9-modem" - hsi-channel-names: Should contain the following strings "mcsaab-control" "speech-control" @@ -15,11 +17,11 @@ Required properties: - gpios: Should provide a GPIO handler for each GPIO listed in gpio-names - gpio-names: Should contain the following strings - "cmt_apeslpx" - "cmt_rst_rq" - "cmt_en" - "cmt_rst" - "cmt_bsi" + "cmt_apeslpx" (for n900, n950, n9) + "cmt_rst_rq" (for n900, n950, n9) + "cmt_en" (for n900, n950, n9) + "cmt_rst" (for n900) + "cmt_bsi" (for n900) - interrupts: Should be IRQ handle for modem's reset indication Example: diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c index 7f82c911ad74..c000780d931f 100644 --- a/drivers/hsi/clients/nokia-modem.c +++ b/drivers/hsi/clients/nokia-modem.c @@ -281,6 +281,8 @@ static int nokia_modem_remove(struct device *dev) #ifdef CONFIG_OF static const struct of_device_id nokia_modem_of_match[] = { { .compatible = "nokia,n900-modem", }, + { .compatible = "nokia,n950-modem", }, + { .compatible = "nokia,n9-modem", }, {}, }; MODULE_DEVICE_TABLE(of, nokia_modem_of_match); From 87d99063be016ceee90723a13365a40b21eec0d9 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 17 Jan 2016 16:49:08 +0100 Subject: [PATCH 2/2] HSI: ssi-protocol: Use handshake logic from n950 When using the ssi-protocol driver with the Nokia N950, the following error is thrown during modem powered up sequence. [13852.274993] port0: SSI error: 0x01 [13852.279205] ssi-protocol ssi-protocol: RX error detected [13852.284820] ssi-protocol ssi-protocol: Main state: 1 [13852.290069] ssi-protocol ssi-protocol: Recv state: 0 [13852.295288] ssi-protocol ssi-protocol: Send state: 0 [13852.300537] ssi-protocol ssi-protocol: CMT Offline [13852.305603] ssi-protocol ssi-protocol: Wake test 1 [13852.310638] ssi-protocol ssi-protocol: Data RX id: 0 [13852.315887] ssi-protocol ssi-protocol: Data TX id: 0 [13856.001464] ssi-protocol ssi-protocol: Watchdog trigerred [13856.007293] ssi-protocol ssi-protocol: Main state: 1 [13856.012542] ssi-protocol ssi-protocol: Recv state: 0 [13856.017761] ssi-protocol ssi-protocol: Send state: 0 [13856.023010] ssi-protocol ssi-protocol: CMT Offline [13856.028045] ssi-protocol ssi-protocol: Wake test 0 [13856.033111] ssi-protocol ssi-protocol: Data RX id: 0 [13856.038330] ssi-protocol ssi-protocol: Data TX id: 0 This patch fixes the issue by using the handshake setup from the Nokia N950 kernel. The new handshake sequence also works with the N900, so there is no need to differentiate between both modems. Tested-by: Aaro Koskinen Signed-off-by: Sebastian Reichel --- drivers/hsi/clients/ssi_protocol.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c index a38af68cf326..6595d2091268 100644 --- a/drivers/hsi/clients/ssi_protocol.c +++ b/drivers/hsi/clients/ssi_protocol.c @@ -521,13 +521,7 @@ static void ssip_start_rx(struct hsi_client *cl) * high transition. Therefore we need to ignore the sencond UP event. */ if ((ssi->main_state != ACTIVE) || (ssi->recv_state == RECV_READY)) { - if (ssi->main_state == INIT) { - ssi->main_state = HANDSHAKE; - spin_unlock(&ssi->lock); - ssip_send_bootinfo_req_cmd(cl); - } else { - spin_unlock(&ssi->lock); - } + spin_unlock(&ssi->lock); return; } ssip_set_rxstate(ssi, RECV_READY); @@ -671,6 +665,7 @@ static void ssip_rx_bootinforeq(struct hsi_client *cl, u32 cmd) ssip_error(cl); /* Fall through */ case INIT: + case HANDSHAKE: spin_lock(&ssi->lock); ssi->main_state = HANDSHAKE; if (!ssi->waketest) { @@ -688,9 +683,6 @@ static void ssip_rx_bootinforeq(struct hsi_client *cl, u32 cmd) msg->complete = ssip_release_cmd; hsi_async_write(cl, msg); break; - case HANDSHAKE: - /* Ignore */ - break; default: dev_dbg(&cl->device, "Wrong state M(%d)\n", ssi->main_state); break; @@ -939,9 +931,11 @@ static int ssip_pn_open(struct net_device *dev) ssi->waketest = 1; ssi_waketest(cl, 1); /* FIXME: To be removed */ } - ssi->main_state = INIT; + ssi->main_state = HANDSHAKE; spin_unlock_bh(&ssi->lock); + ssip_send_bootinfo_req_cmd(cl); + return 0; }