Skip to content

Commit 77ab746

Browse files
jtornosmheftig
authored andcommitted
net: wwan: t7xx: Add AP CLDMA
At this moment with the current status, t7xx is not functional due to problems like this after connection, if there is no activity: [ 57.370534] mtk_t7xx 0000:72:00.0: [PM] SAP suspend error: -110 [ 57.370581] mtk_t7xx 0000:72:00.0: can't suspend (t7xx_pci_pm_runtime_suspend [mtk_t7xx] returned -110) because after this, the traffic no longer works. The complete series 'net: wwan: t7xx: fw flashing & coredump support' was reverted because of issues with the pci implementation. In order to have at least the modem working, it would be enough if just the first commit of the series is re-applied: d20ef65 net: wwan: t7xx: Add AP CLDMA With that, the Application Processor would be controlled, correctly suspended and the commented problems would be fixed (I am testing here like this with no related issue). This commit is independent of the others and not related to the commented pci implementation for the new features: fw flashing and coredump collection. Use v2 patch version of d20ef65 as JinJian Song suggests (https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/). Original text from the commit that would be re-applied: d20ef65 net: wwan: t7xx: Add AP CLDMA Author: Haijun Liu <[email protected]> Date: Tue Aug 16 09:53:28 2022 +0530 The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA. Rename small Application Processor (sAP) to AP. Signed-off-by: Haijun Liu <[email protected]> Co-developed-by: Madhusmita Sahu <[email protected]> Signed-off-by: Madhusmita Sahu <[email protected]> Signed-off-by: Moises Veleta <[email protected]> Signed-off-by: Devegowda Chandrashekar <[email protected]> Signed-off-by: M Chetan Kumar <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Reviewed-by: Jesse Brandeburg <[email protected]> Signed-off-by: Jose Ignacio Tornos Martinez <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Cherry-picked-for: https://bugs.archlinux.org/task/79728
1 parent 9e58721 commit 77ab746

File tree

11 files changed

+116
-31
lines changed

11 files changed

+116
-31
lines changed

drivers/net/wwan/t7xx/t7xx_hif_cldma.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,13 +1066,18 @@ static void t7xx_hw_info_init(struct cldma_ctrl *md_ctrl)
10661066
struct t7xx_cldma_hw *hw_info = &md_ctrl->hw_info;
10671067
u32 phy_ao_base, phy_pd_base;
10681068

1069-
if (md_ctrl->hif_id != CLDMA_ID_MD)
1070-
return;
1071-
1072-
phy_ao_base = CLDMA1_AO_BASE;
1073-
phy_pd_base = CLDMA1_PD_BASE;
1074-
hw_info->phy_interrupt_id = CLDMA1_INT;
10751069
hw_info->hw_mode = MODE_BIT_64;
1070+
1071+
if (md_ctrl->hif_id == CLDMA_ID_MD) {
1072+
phy_ao_base = CLDMA1_AO_BASE;
1073+
phy_pd_base = CLDMA1_PD_BASE;
1074+
hw_info->phy_interrupt_id = CLDMA1_INT;
1075+
} else {
1076+
phy_ao_base = CLDMA0_AO_BASE;
1077+
phy_pd_base = CLDMA0_PD_BASE;
1078+
hw_info->phy_interrupt_id = CLDMA0_INT;
1079+
}
1080+
10761081
hw_info->ap_ao_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base,
10771082
pbase->pcie_dev_reg_trsl_addr, phy_ao_base);
10781083
hw_info->ap_pdn_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base,

drivers/net/wwan/t7xx/t7xx_hif_cldma.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/**
3535
* enum cldma_id - Identifiers for CLDMA HW units.
3636
* @CLDMA_ID_MD: Modem control channel.
37-
* @CLDMA_ID_AP: Application Processor control channel (not used at the moment).
37+
* @CLDMA_ID_AP: Application Processor control channel.
3838
* @CLDMA_NUM: Number of CLDMA HW units available.
3939
*/
4040
enum cldma_id {

drivers/net/wwan/t7xx/t7xx_mhccif.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
D2H_INT_EXCEPTION_CLEARQ_DONE | \
2626
D2H_INT_EXCEPTION_ALLQ_RESET | \
2727
D2H_INT_PORT_ENUM | \
28+
D2H_INT_ASYNC_AP_HK | \
2829
D2H_INT_ASYNC_MD_HK)
2930

3031
void t7xx_mhccif_mask_set(struct t7xx_pci_dev *t7xx_dev, u32 val);

drivers/net/wwan/t7xx/t7xx_modem_ops.c

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "t7xx_state_monitor.h"
4545

4646
#define RT_ID_MD_PORT_ENUM 0
47+
#define RT_ID_AP_PORT_ENUM 1
4748
/* Modem feature query identification code - "ICCC" */
4849
#define MD_FEATURE_QUERY_ID 0x49434343
4950

@@ -298,6 +299,7 @@ static void t7xx_md_exception(struct t7xx_modem *md, enum hif_ex_stage stage)
298299
}
299300

300301
t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_MD], stage);
302+
t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_AP], stage);
301303

302304
if (stage == HIF_EX_INIT)
303305
t7xx_mhccif_h2d_swint_trigger(t7xx_dev, H2D_CH_EXCEPTION_ACK);
@@ -426,7 +428,7 @@ static int t7xx_parse_host_rt_data(struct t7xx_fsm_ctl *ctl, struct t7xx_sys_inf
426428
if (ft_spt_st != MTK_FEATURE_MUST_BE_SUPPORTED)
427429
return -EINVAL;
428430

429-
if (i == RT_ID_MD_PORT_ENUM)
431+
if (i == RT_ID_MD_PORT_ENUM || i == RT_ID_AP_PORT_ENUM)
430432
t7xx_port_enum_msg_handler(ctl->md, rt_feature->data);
431433
}
432434

@@ -456,12 +458,12 @@ static int t7xx_core_reset(struct t7xx_modem *md)
456458
return 0;
457459
}
458460

459-
static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_fsm_ctl *ctl,
461+
static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_sys_info *core_info,
462+
struct t7xx_fsm_ctl *ctl,
460463
enum t7xx_fsm_event_state event_id,
461464
enum t7xx_fsm_event_state err_detect)
462465
{
463466
struct t7xx_fsm_event *event = NULL, *event_next;
464-
struct t7xx_sys_info *core_info = &md->core_md;
465467
struct device *dev = &md->t7xx_dev->pdev->dev;
466468
unsigned long flags;
467469
int ret;
@@ -531,19 +533,33 @@ static void t7xx_md_hk_wq(struct work_struct *work)
531533
t7xx_cldma_start(md->md_ctrl[CLDMA_ID_MD]);
532534
t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS2);
533535
md->core_md.handshake_ongoing = true;
534-
t7xx_core_hk_handler(md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT);
536+
t7xx_core_hk_handler(md, &md->core_md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT);
537+
}
538+
539+
static void t7xx_ap_hk_wq(struct work_struct *work)
540+
{
541+
struct t7xx_modem *md = container_of(work, struct t7xx_modem, ap_handshake_work);
542+
struct t7xx_fsm_ctl *ctl = md->fsm_ctl;
543+
544+
/* Clear the HS2 EXIT event appended in t7xx_core_reset(). */
545+
t7xx_fsm_clr_event(ctl, FSM_EVENT_AP_HS2_EXIT);
546+
t7xx_cldma_stop(md->md_ctrl[CLDMA_ID_AP]);
547+
t7xx_cldma_switch_cfg(md->md_ctrl[CLDMA_ID_AP]);
548+
t7xx_cldma_start(md->md_ctrl[CLDMA_ID_AP]);
549+
md->core_ap.handshake_ongoing = true;
550+
t7xx_core_hk_handler(md, &md->core_ap, ctl, FSM_EVENT_AP_HS2, FSM_EVENT_AP_HS2_EXIT);
535551
}
536552

537553
void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id)
538554
{
539555
struct t7xx_fsm_ctl *ctl = md->fsm_ctl;
540-
void __iomem *mhccif_base;
541556
unsigned int int_sta;
542557
unsigned long flags;
543558

544559
switch (evt_id) {
545560
case FSM_PRE_START:
546-
t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM);
561+
t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM | D2H_INT_ASYNC_MD_HK |
562+
D2H_INT_ASYNC_AP_HK);
547563
break;
548564

549565
case FSM_START:
@@ -556,16 +572,26 @@ void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id)
556572
ctl->exp_flg = true;
557573
md->exp_id &= ~D2H_INT_EXCEPTION_INIT;
558574
md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
575+
md->exp_id &= ~D2H_INT_ASYNC_AP_HK;
559576
} else if (ctl->exp_flg) {
560577
md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
561-
} else if (md->exp_id & D2H_INT_ASYNC_MD_HK) {
562-
queue_work(md->handshake_wq, &md->handshake_work);
563-
md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
564-
mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base;
565-
iowrite32(D2H_INT_ASYNC_MD_HK, mhccif_base + REG_EP2RC_SW_INT_ACK);
566-
t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
578+
md->exp_id &= ~D2H_INT_ASYNC_AP_HK;
567579
} else {
568-
t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
580+
void __iomem *mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base;
581+
582+
if (md->exp_id & D2H_INT_ASYNC_MD_HK) {
583+
queue_work(md->handshake_wq, &md->handshake_work);
584+
md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
585+
iowrite32(D2H_INT_ASYNC_MD_HK, mhccif_base + REG_EP2RC_SW_INT_ACK);
586+
t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
587+
}
588+
589+
if (md->exp_id & D2H_INT_ASYNC_AP_HK) {
590+
queue_work(md->handshake_wq, &md->ap_handshake_work);
591+
md->exp_id &= ~D2H_INT_ASYNC_AP_HK;
592+
iowrite32(D2H_INT_ASYNC_AP_HK, mhccif_base + REG_EP2RC_SW_INT_ACK);
593+
t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK);
594+
}
569595
}
570596
spin_unlock_irqrestore(&md->exp_lock, flags);
571597

@@ -578,6 +604,7 @@ void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id)
578604

579605
case FSM_READY:
580606
t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
607+
t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK);
581608
break;
582609

583610
default:
@@ -629,6 +656,12 @@ static struct t7xx_modem *t7xx_md_alloc(struct t7xx_pci_dev *t7xx_dev)
629656
md->core_md.feature_set[RT_ID_MD_PORT_ENUM] &= ~FEATURE_MSK;
630657
md->core_md.feature_set[RT_ID_MD_PORT_ENUM] |=
631658
FIELD_PREP(FEATURE_MSK, MTK_FEATURE_MUST_BE_SUPPORTED);
659+
660+
INIT_WORK(&md->ap_handshake_work, t7xx_ap_hk_wq);
661+
md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] &= ~FEATURE_MSK;
662+
md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] |=
663+
FIELD_PREP(FEATURE_MSK, MTK_FEATURE_MUST_BE_SUPPORTED);
664+
632665
return md;
633666
}
634667

@@ -640,6 +673,7 @@ int t7xx_md_reset(struct t7xx_pci_dev *t7xx_dev)
640673
md->exp_id = 0;
641674
t7xx_fsm_reset(md);
642675
t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_MD]);
676+
t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_AP]);
643677
t7xx_port_proxy_reset(md->port_prox);
644678
md->md_init_finish = true;
645679
return t7xx_core_reset(md);
@@ -669,6 +703,10 @@ int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev)
669703
if (ret)
670704
goto err_destroy_hswq;
671705

706+
ret = t7xx_cldma_alloc(CLDMA_ID_AP, t7xx_dev);
707+
if (ret)
708+
goto err_destroy_hswq;
709+
672710
ret = t7xx_fsm_init(md);
673711
if (ret)
674712
goto err_destroy_hswq;
@@ -681,12 +719,16 @@ int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev)
681719
if (ret)
682720
goto err_uninit_ccmni;
683721

684-
ret = t7xx_port_proxy_init(md);
722+
ret = t7xx_cldma_init(md->md_ctrl[CLDMA_ID_AP]);
685723
if (ret)
686724
goto err_uninit_md_cldma;
687725

726+
ret = t7xx_port_proxy_init(md);
727+
if (ret)
728+
goto err_uninit_ap_cldma;
729+
688730
ret = t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_START, 0);
689-
if (ret) /* fsm_uninit flushes cmd queue */
731+
if (ret) /* t7xx_fsm_uninit() flushes cmd queue */
690732
goto err_uninit_proxy;
691733

692734
t7xx_md_sys_sw_init(t7xx_dev);
@@ -696,6 +738,9 @@ int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev)
696738
err_uninit_proxy:
697739
t7xx_port_proxy_uninit(md->port_prox);
698740

741+
err_uninit_ap_cldma:
742+
t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]);
743+
699744
err_uninit_md_cldma:
700745
t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]);
701746

@@ -722,6 +767,7 @@ void t7xx_md_exit(struct t7xx_pci_dev *t7xx_dev)
722767

723768
t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_PRE_STOP, FSM_CMD_FLAG_WAIT_FOR_COMPLETION);
724769
t7xx_port_proxy_uninit(md->port_prox);
770+
t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]);
725771
t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]);
726772
t7xx_ccmni_exit(t7xx_dev);
727773
t7xx_fsm_uninit(md);

drivers/net/wwan/t7xx/t7xx_modem_ops.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ struct t7xx_modem {
6666
struct cldma_ctrl *md_ctrl[CLDMA_NUM];
6767
struct t7xx_pci_dev *t7xx_dev;
6868
struct t7xx_sys_info core_md;
69+
struct t7xx_sys_info core_ap;
6970
bool md_init_finish;
7071
bool rgu_irq_asserted;
7172
struct workqueue_struct *handshake_wq;
7273
struct work_struct handshake_work;
74+
struct work_struct ap_handshake_work;
7375
struct t7xx_fsm_ctl *fsm_ctl;
7476
struct port_proxy *port_prox;
7577
unsigned int exp_id;

drivers/net/wwan/t7xx/t7xx_port.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@
3636
/* Channel ID and Message ID definitions.
3737
* The channel number consists of peer_id(15:12) , channel_id(11:0)
3838
* peer_id:
39-
* 0:reserved, 1: to sAP, 2: to MD
39+
* 0:reserved, 1: to AP, 2: to MD
4040
*/
4141
enum port_ch {
42+
/* to AP */
43+
PORT_CH_AP_CONTROL_RX = 0x1000,
44+
PORT_CH_AP_CONTROL_TX = 0x1001,
45+
4246
/* to MD */
4347
PORT_CH_CONTROL_RX = 0x2000,
4448
PORT_CH_CONTROL_TX = 0x2001,

drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,12 @@ static int control_msg_handler(struct t7xx_port *port, struct sk_buff *skb)
167167
case CTL_ID_HS2_MSG:
168168
skb_pull(skb, sizeof(*ctrl_msg_h));
169169

170-
if (port_conf->rx_ch == PORT_CH_CONTROL_RX) {
171-
ret = t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2, skb->data,
170+
if (port_conf->rx_ch == PORT_CH_CONTROL_RX ||
171+
port_conf->rx_ch == PORT_CH_AP_CONTROL_RX) {
172+
int event = port_conf->rx_ch == PORT_CH_CONTROL_RX ?
173+
FSM_EVENT_MD_HS2 : FSM_EVENT_AP_HS2;
174+
175+
ret = t7xx_fsm_append_event(ctl, event, skb->data,
172176
le32_to_cpu(ctrl_msg_h->data_length));
173177
if (ret)
174178
dev_err(port->dev, "Failed to append Handshake 2 event");

drivers/net/wwan/t7xx/t7xx_port_proxy.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
i < (proxy)->port_count; \
4949
i++, (p) = &(proxy)->ports[i])
5050

51-
static const struct t7xx_port_conf t7xx_md_port_conf[] = {
51+
static const struct t7xx_port_conf t7xx_port_conf[] = {
5252
{
5353
.tx_ch = PORT_CH_UART2_TX,
5454
.rx_ch = PORT_CH_UART2_RX,
@@ -89,6 +89,14 @@ static const struct t7xx_port_conf t7xx_md_port_conf[] = {
8989
.path_id = CLDMA_ID_MD,
9090
.ops = &ctl_port_ops,
9191
.name = "t7xx_ctrl",
92+
}, {
93+
.tx_ch = PORT_CH_AP_CONTROL_TX,
94+
.rx_ch = PORT_CH_AP_CONTROL_RX,
95+
.txq_index = Q_IDX_CTRL,
96+
.rxq_index = Q_IDX_CTRL,
97+
.path_id = CLDMA_ID_AP,
98+
.ops = &ctl_port_ops,
99+
.name = "t7xx_ap_ctrl",
92100
},
93101
};
94102

@@ -428,6 +436,9 @@ static void t7xx_proxy_init_all_ports(struct t7xx_modem *md)
428436
if (port_conf->tx_ch == PORT_CH_CONTROL_TX)
429437
md->core_md.ctl_port = port;
430438

439+
if (port_conf->tx_ch == PORT_CH_AP_CONTROL_TX)
440+
md->core_ap.ctl_port = port;
441+
431442
port->t7xx_dev = md->t7xx_dev;
432443
port->dev = &md->t7xx_dev->pdev->dev;
433444
spin_lock_init(&port->port_update_lock);
@@ -442,7 +453,7 @@ static void t7xx_proxy_init_all_ports(struct t7xx_modem *md)
442453

443454
static int t7xx_proxy_alloc(struct t7xx_modem *md)
444455
{
445-
unsigned int port_count = ARRAY_SIZE(t7xx_md_port_conf);
456+
unsigned int port_count = ARRAY_SIZE(t7xx_port_conf);
446457
struct device *dev = &md->t7xx_dev->pdev->dev;
447458
struct port_proxy *port_prox;
448459
int i;
@@ -456,7 +467,7 @@ static int t7xx_proxy_alloc(struct t7xx_modem *md)
456467
port_prox->dev = dev;
457468

458469
for (i = 0; i < port_count; i++)
459-
port_prox->ports[i].port_conf = &t7xx_md_port_conf[i];
470+
port_prox->ports[i].port_conf = &t7xx_port_conf[i];
460471

461472
port_prox->port_count = port_count;
462473
t7xx_proxy_init_all_ports(md);
@@ -481,6 +492,7 @@ int t7xx_port_proxy_init(struct t7xx_modem *md)
481492
if (ret)
482493
return ret;
483494

495+
t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_AP], t7xx_port_proxy_recv_skb);
484496
t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_MD], t7xx_port_proxy_recv_skb);
485497
return 0;
486498
}

drivers/net/wwan/t7xx/t7xx_reg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#define D2H_INT_RESUME_ACK BIT(12)
5757
#define D2H_INT_SUSPEND_ACK_AP BIT(13)
5858
#define D2H_INT_RESUME_ACK_AP BIT(14)
59-
#define D2H_INT_ASYNC_SAP_HK BIT(15)
59+
#define D2H_INT_ASYNC_AP_HK BIT(15)
6060
#define D2H_INT_ASYNC_MD_HK BIT(16)
6161

6262
/* Register base */

drivers/net/wwan/t7xx/t7xx_state_monitor.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,9 @@ static int fsm_routine_starting(struct t7xx_fsm_ctl *ctl)
285285
t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS1);
286286
t7xx_md_event_notify(md, FSM_START);
287287

288-
wait_event_interruptible_timeout(ctl->async_hk_wq, md->core_md.ready || ctl->exp_flg,
289-
HZ * 60);
288+
wait_event_interruptible_timeout(ctl->async_hk_wq,
289+
(md->core_md.ready && md->core_ap.ready) ||
290+
ctl->exp_flg, HZ * 60);
290291
dev = &md->t7xx_dev->pdev->dev;
291292

292293
if (ctl->exp_flg)
@@ -297,6 +298,13 @@ static int fsm_routine_starting(struct t7xx_fsm_ctl *ctl)
297298
if (md->core_md.handshake_ongoing)
298299
t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2_EXIT, NULL, 0);
299300

301+
fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT);
302+
return -ETIMEDOUT;
303+
} else if (!md->core_ap.ready) {
304+
dev_err(dev, "AP handshake timeout\n");
305+
if (md->core_ap.handshake_ongoing)
306+
t7xx_fsm_append_event(ctl, FSM_EVENT_AP_HS2_EXIT, NULL, 0);
307+
300308
fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT);
301309
return -ETIMEDOUT;
302310
}
@@ -335,6 +343,7 @@ static void fsm_routine_start(struct t7xx_fsm_ctl *ctl, struct t7xx_fsm_command
335343
return;
336344
}
337345

346+
t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_AP]);
338347
t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_MD]);
339348
fsm_finish_command(ctl, cmd, fsm_routine_starting(ctl));
340349
}

0 commit comments

Comments
 (0)