diff --git a/drivers/modem/Kconfig.cellular b/drivers/modem/Kconfig.cellular index 831d0b5febc..5e1a38b99dd 100644 --- a/drivers/modem/Kconfig.cellular +++ b/drivers/modem/Kconfig.cellular @@ -16,9 +16,9 @@ config MODEM_CELLULAR depends on (DT_HAS_QUECTEL_BG95_ENABLED || \ DT_HAS_SIMCOM_SIM7080_ENABLED || DT_HAS_U_BLOX_SARA_R4_ENABLED || \ DT_HAS_U_BLOX_SARA_R5_ENABLED || DT_HAS_SWIR_HL7800_ENABLED || \ - DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_QUECTEL_EG25_G_ENABLED || \ - DT_HAS_NORDIC_NRF91_SLM_ENABLED || DT_HAS_SQN_GM02S_ENABLED || \ - DT_HAS_U_BLOX_LARA_R6_ENABLED) + DT_HAS_TELIT_ME910G1_ENABLED || DT_HAS_TELIT_ME310G1_ENABLED || \ + DT_HAS_QUECTEL_EG25_G_ENABLED || DT_HAS_NORDIC_NRF91_SLM_ENABLED || \ + DT_HAS_SQN_GM02S_ENABLED || DT_HAS_U_BLOX_LARA_R6_ENABLED) help This driver uses the generic 3gpp AT commands, along with the standard protocols CMUX and PPP, to configure diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index f8aee211752..aee527a26fa 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -2173,8 +2173,8 @@ MODEM_CHAT_SCRIPT_DEFINE(swir_hl7800_dial_chat_script, swir_hl7800_dial_chat_scr dial_abort_matches, modem_cellular_chat_callback_handler, 10); #endif -#if DT_HAS_COMPAT_STATUS_OKAY(telit_me910g1) -MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me910g1_init_chat_script_cmds, +#if DT_HAS_COMPAT_STATUS_OKAY(telit_me910g1) || DT_HAS_COMPAT_STATUS_OKAY(telit_me310g1) +MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_mex10g1_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT", 100), @@ -2212,24 +2212,35 @@ MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me910g1_init_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP_NONE("AT+CMUX=0,0,5,127,10,3,30,10,2", 300)); -MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_init_chat_script, telit_me910g1_init_chat_script_cmds, +MODEM_CHAT_SCRIPT_DEFINE(telit_mex10g1_init_chat_script, telit_mex10g1_init_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 10); -MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me910g1_dial_chat_script_cmds, +MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_mex10g1_dial_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("AT", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP_NONE("ATD*99***1#", 0)); -MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_dial_chat_script, telit_me910g1_dial_chat_script_cmds, +MODEM_CHAT_SCRIPT_DEFINE(telit_mex10g1_dial_chat_script, telit_mex10g1_dial_chat_script_cmds, dial_abort_matches, modem_cellular_chat_callback_handler, 10); -MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me910g1_periodic_chat_script_cmds, +MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_mex10g1_periodic_chat_script_cmds, MODEM_CHAT_SCRIPT_CMD_RESP("AT+CREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CGREG?", ok_match), MODEM_CHAT_SCRIPT_CMD_RESP("AT+CEREG?", ok_match)); -MODEM_CHAT_SCRIPT_DEFINE(telit_me910g1_periodic_chat_script, - telit_me910g1_periodic_chat_script_cmds, abort_matches, +MODEM_CHAT_SCRIPT_DEFINE(telit_mex10g1_periodic_chat_script, + telit_mex10g1_periodic_chat_script_cmds, abort_matches, modem_cellular_chat_callback_handler, 4); + +#endif + +#if DT_HAS_COMPAT_STATUS_OKAY(telit_me310g1) +MODEM_CHAT_SCRIPT_CMDS_DEFINE(telit_me310g1_shutdown_chat_script_cmds, + MODEM_CHAT_SCRIPT_CMD_RESP("AT#SHDN", ok_match)); + +MODEM_CHAT_SCRIPT_DEFINE(telit_me310g1_shutdown_chat_script, + telit_me310g1_shutdown_chat_script_cmds, abort_matches, + modem_cellular_chat_callback_handler, 15); + #endif #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf91_slm) @@ -2505,7 +2516,7 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, &u_blox_lara_r6_init_chat_script, \ &u_blox_lara_r6_dial_chat_script, \ &u_blox_lara_r6_periodic_chat_script, \ - NULL ) + NULL) #define MODEM_CELLULAR_DEVICE_SWIR_HL7800(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ @@ -2540,11 +2551,30 @@ MODEM_CHAT_SCRIPT_DEFINE(sqn_gm02s_periodic_chat_script, \ MODEM_CELLULAR_DEFINE_INSTANCE(inst, 5050, 250, 15000, 5000, false, \ NULL, \ - &telit_me910g1_init_chat_script, \ - &telit_me910g1_dial_chat_script, \ - &telit_me910g1_periodic_chat_script, \ + &telit_mex10g1_init_chat_script, \ + &telit_mex10g1_dial_chat_script, \ + &telit_mex10g1_periodic_chat_script, \ NULL) +#define MODEM_CELLULAR_DEVICE_TELIT_ME310G1(inst) \ + MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 64); \ + \ + static struct modem_cellular_data MODEM_CELLULAR_INST_NAME(data, inst) = { \ + .chat_delimiter = "\r", \ + .chat_filter = "\n", \ + .ppp = &MODEM_CELLULAR_INST_NAME(ppp, inst), \ + }; \ + \ + MODEM_CELLULAR_DEFINE_AND_INIT_USER_PIPES(inst, \ + (user_pipe_0, 3)) \ + \ + MODEM_CELLULAR_DEFINE_INSTANCE(inst, 5050, 0 /* unused */, 1000, 15000, false, \ + NULL, \ + &telit_mex10g1_init_chat_script, \ + &telit_mex10g1_dial_chat_script, \ + &telit_mex10g1_periodic_chat_script, \ + &telit_me310g1_shutdown_chat_script) + #define MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM(inst) \ MODEM_PPP_DEFINE(MODEM_CELLULAR_INST_NAME(ppp, inst), NULL, 98, 1500, 1500); \ \ @@ -2613,6 +2643,10 @@ DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_SWIR_HL7800) DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME910G1) #undef DT_DRV_COMPAT +#define DT_DRV_COMPAT telit_me310g1 +DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_TELIT_ME310G1) +#undef DT_DRV_COMPAT + #define DT_DRV_COMPAT nordic_nrf91_slm DT_INST_FOREACH_STATUS_OKAY(MODEM_CELLULAR_DEVICE_NORDIC_NRF91_SLM) #undef DT_DRV_COMPAT