-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
soc: st: stm32 devices: SW JTAG port pins config with hw model V2
During the migration to Hw model V2 the PR #63495 was not fully reported. This change is adding the support Serial Wire / JTAG port pins (cherry picked from commit 7291450) Original-Signed-off-by: Francois Ramu <francois.ramu@st.com> GitOrigin-RevId: 7291450 Change-Id: Idd3485735c65320b973b9370fa83cefe8b6ef137 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5409246 Tested-by: Tristan Honscheid <honscheid@google.com> Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com> Reviewed-by: Tristan Honscheid <honscheid@google.com> Commit-Queue: Tristan Honscheid <honscheid@google.com>
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2023 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/drivers/pinctrl.h> | ||
#include <zephyr/init.h> | ||
|
||
#define SWJ_NODE DT_NODELABEL(swj_port) | ||
|
||
PINCTRL_DT_DEFINE(SWJ_NODE); | ||
|
||
const struct pinctrl_dev_config *swj_pcfg = PINCTRL_DT_DEV_CONFIG_GET(SWJ_NODE); | ||
|
||
/* | ||
* Serial Wire / JTAG port pins are enabled as part of SoC default configuration. | ||
* When debug access is not needed and in case power consumption performance is | ||
* expected, configure matching pins to analog in order to save power. | ||
*/ | ||
|
||
static int swj_to_analog(void) | ||
{ | ||
int err; | ||
|
||
/* Set Serial Wire / JTAG port pins to analog mode */ | ||
err = pinctrl_apply_state(swj_pcfg, PINCTRL_STATE_SLEEP); | ||
if (err < 0) { | ||
__ASSERT(0, "SWJ pinctrl setup failed"); | ||
return err; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/* Run this routine as the earliest pin configuration in the target, | ||
* to avoid potential conflicts with devices accessing SWJ-DG pins for | ||
* their own needs. | ||
*/ | ||
SYS_INIT(swj_to_analog, PRE_KERNEL_1, CONFIG_SWJ_ANALOG_PRIORITY); |