PoC: STM32 global clocks manager#1
Conversation
Introduce new SoC-specific framework to manage global peripheral clocks. Update all STM32 code to make use of the framework when accessing one of the global peripherals: PWR/SYSCFG. Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
allow indicating which clocks are always-on such that the calls to refer/release for thes clocks turn into no-ops which reduces footprint and speeds up runtime Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
|
|
||
| /* Enable PWR */ | ||
| LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_PWR); | ||
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_PWR); |
There was a problem hiding this comment.
I'm not fond of this name.
1- Can we find an alternative to refer/release that already exist in tree ? (eg get/put even if I don't think this one is quite clear)
2- Alternative to stm32_global_periph:
- stm32_soc_device
- stm32_device
- ...
There was a problem hiding this comment.
refer was inspired by net_buf_ref/net_buf_unref (that's why I have a comment somewhere suggesting to rename stm32_global_periph_release to _unref). In tree, we have net_buf_{ref,unref}, bt_conn_{ref,unref} and z_fd_{ref,unref}, all explicitly described as "inc/dec a refcount" which is what we're doing here, hence why I picked this name. On the other hand, get/put seems to only be used by the PM subsystem (pm_policy_state_lock_put, pm_device_runtime_put, ...) and refers to a lock-with-counter rather than a refcount.
I don't have any strong opinion on the name stm32_global_periph, that's just what I came up with. Fine with changing it.
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_PWR); | ||
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_SYSCFG); |
There was a problem hiding this comment.
What about having it as a field (with maybe shorter names, then) ?
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_PWR); | |
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_SYSCFG); | |
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_PWR|STM32_GLOBAL_PERIPH_SYSCFG); |
There was a problem hiding this comment.
This could definitely be done, I'd just need to change logic a bit. (it would add a tiny additional overhead too)
Map all pins of RT685's Flexcomm #1 peripheral. Needed for opration of Flexcomm #1 in I2S mode or Flexcomm zephyrproject-rtos#3 in I2S mode with shared signals. Signed-off-by: Vit Stanicek <vit.stanicek@nxp.com>
Add SCK and WS signals to a shared signal set between Flexcomm #1 and Flexcomm zephyrproject-rtos#3 for the mimxrt685_evk/mimxrt685s/cm33. This enables the board to both transmit and receive audio, as the BCK and WS signals produced by the WM8904 codec are only connected to the Flexcomm #1 peripheral. Signed-off-by: Vit Stanicek <vit.stanicek@nxp.com>
Per RFC9112 (REF #1), HTTP/1.1 server is expected to be backward compatible with HTTP1.0 request. Mainly HTTP/1.0 does not support 1) Transfer Encoding : chunked 2) KeepAlives So, this change will identify the HTTP protocol version in the request and respond accordingly. REF# 1) https://httpwg.org/specs/rfc9112.html Tested: 1) Verified that HTTP/1.1 requests are served as usual i.e. with chunked transfer encoding and the connection is a Keep Alive connection Query exits after 10s, indicating that the client connection to the HTTP server is a Keep Alive. ``` time printf "GET /telem HTTP/1.1\r\nHost: 192.0.3.11\r\n\r\n" | nc 192.0.3.11 80 real 0m10.185s <- Indicates connection was kept active for 10s user 0m0.023s sys 0m0.023s ``` `Transfer Encoding : chunked` header and chunked encoding metadata (chunk size hex bytes, crlf, termination byte 0) are present in the response. ``` HTTP/1.1 200 OK Transfer-Encoding: chunked <- Chunked encoding header Content-Type: text/html 3e8 <- Chunk size hex bytes : /health/secondsdevice_ae:9a:22:48:0f:70"seconds0 + /health/locatedevice_ae:9a:22:48:0f:70"0 / /network/mac-addressdevice_ae:9a:22:48:0f:70" . . . 3e8 <- Chunk size hex byte _PLUS_rawdevice_ae:9a:22:48:0f:70"0 6 /dev/ISHARE_CBU_MINUS_rawdevice_ae:9a:22:48:0f:70"0 . . . /dev/part_iddevice_ae:9a:22:48:0f:70"0��������� , /dev/part_typedevice_ae:9a:22:48:0f:70"0 7 /dev/part_telemetry_disabledevice_ae:9a:22:48:0f:70"0 0 <- Termination Byte 0 ``` 2) Verfied that HTTP/1.0 requests are served with response without chunked transfer encoding and the connection is closed immediately. Query exits immediately indicating the connection is closed immediately ``` time printf "GET /telem HTTP/1.0\r\nHost: 192.0.3.11\r\n\r\n" | nc 192.0.3.11 80 real 0m0.186s <- Indicates connection was terminated immediately. user 0m0.018s sys 0m0.030s ``` `Transfer Encoding : chunked` header and chunked encoding metadata (chunk size hex bytes, crlf) not present in the response ``` HTTP/1.1 200 OK Content-Type: text/html : /health/uptimedevice_ae:9a:22:48:0f:70"seconds0 + /health/locatedevice_ae:9a:22:48:0f:70"0 / /network/mac-addressdevice_ae:9a:22:48:0f:70" . . . 3 /dev/part_iddevice_ae:9a:22:48:0f:70"0��������� , /dev/part_typedevice_ae:9a:22:48:0f:70"0 7 /dev/can_telemetry_disabledevice_ae:9a:22:48:0f:70"0 ``` Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
I'm at a loss here. The feature this test case wants to see (on ARMv7M, not ARMv6M) is the ability to take a irq_lock() inside a system call and then see that future system calls from the same thread continue to hold the lock. That's not documented AFAICT. It's also just a terrible idea because either: 1. The obvious denial of service implications if user code is allowed to run in an unpreemptible mode, or: 2. The broken locking promise if this is implemented to release the lock and reacquire it in an attempt to avoid #1. (FWIW: my read of the code is that #1 is the current implementation. But hilariously the test isn't able to tell the difference!) And in any case it's not how any of our other platforms work (or can work, in some cases), making this a non-portable system call API/feature at best. Leave it in place for now out of conservatism, but disable with the new arch_switch() code, whose behavior matches that of other Zephyr userspaces. Signed-off-by: Andy Ross <andyross@google.com>
No description provided.