How to configure UART IO pin multiplexer in u-boot SPL for ZynqMP - u-boot

Using mainline u-boot (2023.01) I try to configure UART0 I/O pins for the SPL.
In the kernel and u-boot proper, this is done via a pinctrl-node in the devicetree. However u-boot 'strips' the devicetree for the SPL and removes the pinctrl node.
I removed pinctrl from CONFIG_OF_SPL_REMOVE_PROPS in the u-boot configuration.
What is the preferred way for configuration of IO MUX in u-boot SPL for ZynqMP ?
Hardcoded in a board setup file ?

Related

How to use custom device tree source correctly in buildroot?

I made a copy of the dts from <linux>/board/arch/arm/boot/dts/imx28-evk.dts for using with my custom board. My custom device-tree is named imx28-custom.dts and is pointed in the Out of tree custom DTS menu entry (BR2_LINUX_KERNEL_CUSTOM_DTS_PATH) in the Buildroot config.
However u-boot is configured to use the existing MX28 board config. After building a kernel I have imx28-custom.dtb and zImage in the <buildroot>/output/images folder.
When the system boots, u-boot tells that imx28-evk.dtb is not found. Why was imx28-custom.dtb built but is not found by u-boot? Why u-boot doesn't find its own device-tree (imx28-evk.dtb) for itself and my custom device-tree for the kernel? I assumed that BR2_LINUX_KERNEL_CUSTOM_DTS_PATH relates only to the kernel. How can my custom device-tree be passed to the kernel if u-boot tries to use its own imx28-evk.dtb for this?
u-boot complaining about not finding the device-tree is related to the Linux kernel: when booting, u-boot loads the device-tree and kernel image from the storage to specified addresses in the memory and then passes control to the kernel. The default configuration for the i.MX28-EVK board is to pass the imx28-evk.dtb file.
The BR2_LINUX_KERNEL_CUSTOM_DTS_PATH only serves to include the custom device-tree in the files to build and install but does not configure u-boot to use it.
Which device-tree u-boot passes to the kernel is defined by u-boot's CONFIG_DEFAULT_FDT_FILE option (you can edit this by typing make uboot-menuconfig (see my note at the end) then going under Boot to set the Default fdt file). This option should be set to something like imx28-custom.dtb.
How to configure u-boot from Buildroot is described here and here to make them permanent.
In the case of the i.MX28-EVK, Buildroot uses the Legacy build system (which is to be used up to u-boot 2015.04, but the config uses 2020.04) which does not allow the use of the make uboot-menuconfig command. You should safely be able to change that. You need to set the Build system to Kconfig and set the Board defconfig to mx28evk.

BeagleBone PWM configuration in kernel space

I'm beginner in kernel module development.
I'm running Debian 8 in BeagleBone Black with cape-universaln loaded. The module pwm_tiehrpwm is loaded. I can configure pwm signal through the respective /sys/class/pwm/pwmchipN. I have checked the signal using a scope. Everything is working.
My question is how can I configure pwm channel, duty/period, enable and disable in kernel space, in the other words, inside of the kernel module?

Using Pulse Width Modulation (PWM) interface in kernel module

I'm new in kernel development driver and I'm trying to develop a Linux kernel module, using the this module information:
http://lxr.free-electrons.com/source/drivers/pwm/pwm-tiehrpwm.c
But I didn't understand how to use it. How could adapt this module or better, how to create a new module using functions contained in this file like ehrpwm_pwm_config, ehrpwm_pwm_enable?
PS:I don't want to use sysfs, I would configure the pwm signal programmatically. I'm using a Beaglebone Black board running a Debian distribution , and cape-universaln.
Thanks
You need to enable CONFIG_PWM_TIEHRPWM in your .config file of your linux-kernel. By default, CONFIG_PWM_TIEHRPWM is not set and you need to enable it as CONFIG_PWM_TIEHRPWM=y, if you want to build it as a part of kernel image, or as CONFIG_PWM_TIEHRPWM=m, if you want to build it as a LKM.
Then, build your kernel as make -j12 and insmod your module as:
#insmod /lib/modules/$uname -r/drivers/pwm/pwm_tiehrpwm.ko if you have built it as a LKM. Check Linux kernel documentation on how to configure pwm!

What is a structure of u-boot flash file? ( ARM versatile pb )

I'm working on creating file that I can load with -kernel option of qemu. I mostly mind here u-boot config file that I have found information should be placed somewhere in file. That file have to contain u-boot binary, freebsd kernel and RTOS to run ( so i can choose which kernel to load or do some experimental developement in loading 2 OS at same time - eg. FreeBSD is loaded by u-boot and then FreeBSD loads FreeRTOS on 2nd core - so called ASMP ). It seems there is no tools around to do that in automatic way ( I mean supporting multiple kernels in one flash file ). So I need to know how is u-boot flash file structured to make my own and pass it to qemu emulating am versatilepb.
qemu-system-arm -M versatilepb -m 128M -nographic -kernel myflashfile
So the answer here depends in part on the board you are emulating with QEMU. Next, unfortunately the versatilepb has been dropped from mainline U-Boot some time ago (and being ARM926EJS it is not the ideal core for ASMP, you may wish to try vexpress a9 instead). Now, all of that said, you want -pflash to pass along a binary file you control the contents of as the parallel flash device used by the machine. And you lay that out however you like since you're still using -kernel u-boot.bin to boot the machine. You may however find it easier to use -tftp /some/dir and load the files via the network instead.

Add NAND device to QEMU Stellaris

I need to test NAND FTL on QEMU. My NAND controller(Tc6393xb) which is already emulated on QEMU has to be interfaced with ARM Cortex-M3. So I chose stellaris as my base machine. can somebody help me with information on adding this controller(Tc6393xb.c in QEMU 1.2.0) to stellaris. Secondly how do I test it on non-OS environment.
In Qemu version 2.2.1, there is a device (PXA255 Sharp Zaurus) that instantiates the controller Tc6393xb: tc6393xb_init function.

Resources