-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup console from Device Tree #1388
Conversation
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Prepare for reworking the UART drivers to adopt the usual model where a device is represented by a structure holding private data (base address for instance) and a generic part (struct serial_chip). The console output functions may be used by early init code before the MMU has been turned on. Therefore, the serial drivers need a way to access the UART using either a physical or a virtual address. But, only the platform code knows how to translate the physical address to a virtual one (it knows the memory type to use in the phys_to_virt() call). So, this commit gives the platform code the opportunity to update the driver's private data for the console, by calling console_init() twice: once before the MMU is turned on, and once after. A call to console_flush() just before MMU enablement ensures that no pending data are lost. The conversion of the UART drivers will be done in later commits. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Since most platforms now use the same console_putc() and console_flush(), move them to core/kernel/console.c. Make them __weak so that platforms may still provide their own. The common code expects the platforms to initialize whatever serial device from console_init() and set the serial_console pointer. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
When CFG_DT=y, a linker section is created (.rodata.dtdrv) to hold all the DT-compatible drivers. The table can later be queried at runtime. Some manipulation functions are exported in <kernel/dt.h>. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Use the functions provided by libfdt instead of our own. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Maps a device into memory from its FDT node. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Add struct serial_driver which will be useful to UART drivers that want to create devices from a DT node. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
…path If CFG_DT=y, check the Device Tree's /secure-chosen node and look for the stdout-path property. Adjust the console output accordingly. The DT bindings for this property have been proposed on the LKML [1]. [1] https://www.spinics.net/lists/arm-kernel/msg566034.html Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMU)
…n/stdout-path Allow NULL DT. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Avoid extern in .c file Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Fix typo Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Fix typo Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
@jforissier Just wonder is there helper functions that driver can be probed by using dts? There are too many CFG_xx in my code. I would like to use dts to differentiate, optee shmem/tee ram for different platforms. Also dtb is only used in |
I agree that DT could be quite useful to many platforms, to reduce some static configuration directive. Be careful that some settings may not be easily portable into the DT. TEE RAM is an example since the OP-TEE core shall be built for the exact physical location we expect it to be loaded/executed. I also agree the DT parsing support should exit the generic_boot.c and be made available for drivers and platforms. Also, after talking about DT those last days, I believe there will likely be different needs and strategy regarding for each of the different platform. Hence, @jforissier, in the mean time, i feel your change can continue to be reviewed (and merged once agreed) since it still proposed interesting use of the DTB in OP-TEE. Bringing more flexibility into DT use can more later on. |
Superseded by #1433. |
This is a rework of my older proof-of-concept code to use DT in OP-TEE to configure devices etc., similar to what the Linux kernel is doing. The series can be divided in two parts:
Patches 1 ("serial.h: add missing #include <stdbool.h>) through 12 (" core: add common implementation for console_putc() and console_flush()") rework the UART drivers in order to use the previously introducedUpdate: moved to Serial drivers rework #1393.struct serial_chip
andstruct serial_ops
. The console initialization code is updated accordingly.Tested on QEMU with manual modifications to the emulator itself to alter the DT:
With this, the console remains on the secure UART (/pl011@9040000). When the property's value is forced to "/pl011@9000000" instead, the console is switched to the Non-Secure UART. Finally, if the /secure-chose node is left empty, the console is disabled.