Skip to content

Commit

Permalink
Merge branch 'feature/management_modem_etm_clock_indepently_v5.1' int…
Browse files Browse the repository at this point in the history
…o 'release/v5.1'

feat(esp_hw_support): manage modem_etm clock in modem_clock for bt/154 indepently (backport v5.1)

See merge request espressif/esp-idf!25793
  • Loading branch information
jack0c committed Sep 8, 2023
2 parents ef451ca + d3bfaf8 commit 8d08580
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
24 changes: 16 additions & 8 deletions components/esp_hw_support/modem_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ static void IRAM_ATTR modem_clock_wifi_bb_configure(modem_clock_context_t *ctx,
#if SOC_BT_SUPPORTED
static void IRAM_ATTR modem_clock_ble_mac_configure(modem_clock_context_t *ctx, bool enable)
{
modem_syscon_ll_enable_etm_clock(ctx->hal->syscon_dev, enable);
modem_syscon_ll_enable_modem_sec_clock(ctx->hal->syscon_dev, enable);
modem_syscon_ll_enable_ble_timer_clock(ctx->hal->syscon_dev, enable);
}
Expand All @@ -90,7 +89,6 @@ static void IRAM_ATTR modem_clock_ble_bb_configure(modem_clock_context_t *ctx, b
#if SOC_IEEE802154_SUPPORTED
static void IRAM_ATTR modem_clock_ieee802154_mac_configure(modem_clock_context_t *ctx, bool enable)
{
modem_syscon_ll_enable_etm_clock(ctx->hal->syscon_dev, enable);
modem_syscon_ll_enable_ieee802154_apb_clock(ctx->hal->syscon_dev, enable);
modem_syscon_ll_enable_ieee802154_mac_clock(ctx->hal->syscon_dev, enable);
}
Expand Down Expand Up @@ -283,22 +281,32 @@ void IRAM_ATTR modem_clock_module_mac_reset(periph_module_t module)
#define COEXIST_CLOCK_DEPS (BIT(MODEM_CLOCK_COEXIST))
#define PHY_CLOCK_DEPS (BIT(MODEM_CLOCK_I2C_MASTER) | BIT(MODEM_CLOCK_FE))
#define I2C_ANA_MST_CLOCK_DEPS (BIT(MODEM_CLOCK_I2C_MASTER))
#define MODEM_ETM_CLOCK_DEPS (BIT(MODEM_CLOCK_ETM))

static IRAM_ATTR uint32_t modem_clock_get_module_deps(periph_module_t module)
{
uint32_t deps = 0;
if (module == PERIPH_ANA_I2C_MASTER_MODULE) {deps = I2C_ANA_MST_CLOCK_DEPS;}
if (module == PERIPH_PHY_MODULE) {deps = PHY_CLOCK_DEPS;}
else if (module == PERIPH_COEX_MODULE) { deps = COEXIST_CLOCK_DEPS; }
switch (module) {
case PERIPH_ANA_I2C_MASTER_MODULE: deps = I2C_ANA_MST_CLOCK_DEPS; break;
case PERIPH_PHY_MODULE: deps = PHY_CLOCK_DEPS; break;
#if SOC_WIFI_SUPPORTED || SOC_BT_SUPPORTED || SOC_IEEE802154_SUPPORTED
case PERIPH_COEX_MODULE: deps = COEXIST_CLOCK_DEPS; break;
#endif
#if SOC_WIFI_SUPPORTED
else if (module == PERIPH_WIFI_MODULE) { deps = WIFI_CLOCK_DEPS; }
case PERIPH_WIFI_MODULE: deps = WIFI_CLOCK_DEPS; break;
#endif
#if SOC_BT_SUPPORTED
else if (module == PERIPH_BT_MODULE) { deps = BLE_CLOCK_DEPS; }
case PERIPH_BT_MODULE: deps = BLE_CLOCK_DEPS; break;
#endif
#if SOC_IEEE802154_SUPPORTED
else if (module == PERIPH_IEEE802154_MODULE) { deps = IEEE802154_CLOCK_DEPS; }
case PERIPH_IEEE802154_MODULE: deps = IEEE802154_CLOCK_DEPS; break;
#endif
#if SOC_BT_SUPPORTED || SOC_IEEE802154_SUPPORTED
case PERIPH_MODEM_ETM_MODULE: deps = MODEM_ETM_CLOCK_DEPS; break;
#endif
default:
assert(0);
}
return deps;
}

Expand Down
3 changes: 2 additions & 1 deletion components/soc/esp32c6/include/soc/periph_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ typedef enum {
PERIPH_COEX_MODULE,
PERIPH_PHY_MODULE,
PERIPH_ANA_I2C_MASTER_MODULE,
PERIPH_MODEM_ETM_MODULE,
PERIPH_MODULE_MAX
/* !!! Don't append soc modules here !!! */
} periph_module_t;

#define PERIPH_MODEM_MODULE_MIN PERIPH_WIFI_MODULE
#define PERIPH_MODEM_MODULE_MAX PERIPH_ANA_I2C_MASTER_MODULE
#define PERIPH_MODEM_MODULE_MAX PERIPH_MODEM_ETM_MODULE
#define PERIPH_MODEM_MODULE_NUM (PERIPH_MODEM_MODULE_MAX - PERIPH_MODEM_MODULE_MIN + 1)
#define IS_MODEM_MODULE(periph) ((periph>=PERIPH_MODEM_MODULE_MIN) && (periph<=PERIPH_MODEM_MODULE_MAX))

Expand Down
3 changes: 2 additions & 1 deletion components/soc/esp32h2/include/soc/periph_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ typedef enum {
PERIPH_COEX_MODULE,
PERIPH_PHY_MODULE,
PERIPH_ANA_I2C_MASTER_MODULE,
PERIPH_MODEM_ETM_MODULE,
PERIPH_MODULE_MAX
/* !!! Don't append soc modules here !!! */
} periph_module_t;

#define PERIPH_MODEM_MODULE_MIN PERIPH_BT_MODULE
#define PERIPH_MODEM_MODULE_MAX PERIPH_ANA_I2C_MASTER_MODULE
#define PERIPH_MODEM_MODULE_MAX PERIPH_MODEM_ETM_MODULE
#define PERIPH_MODEM_MODULE_NUM (PERIPH_MODEM_MODULE_MAX - PERIPH_MODEM_MODULE_MIN + 1)
#define IS_MODEM_MODULE(periph) ((periph>=PERIPH_MODEM_MODULE_MIN) && (periph<=PERIPH_MODEM_MODULE_MAX))

Expand Down

0 comments on commit 8d08580

Please sign in to comment.