I want to add RGB LEDs on my chip and wonder if ls1021a processor does support PWM pins configuration via software pinmux.
If so anyone knows how to set those pins as PWM and access it via software?
My kernel version is Kernel 4.19
PWM function is supported by "Flex Timer Module" (FTM) block.
We do offer a driver for FTM module in our Linux SDK, but this driver supports only wakeup function to wakeup processor from deep sleep. However, you can look this driver code and use is as source to underdtand how to work with FTM block.
PWM pins are multiplexed with other functions on device pins, and this multiplexing is configured in RCW settings. Please look LS1021A Reference Manual, Section 3.4.8 for details.
By saying "PWM pins are multiplexed with other functions on device pins" do you mean we can use those pins as PWM exclusively or we cannot?
How about GPIO pins ? Can I export necessary gpio pins under /sys/class/gpio and use them as GPIO directly ?
Yes, you can use those pins exclusively for PWM function, but this function should be selected in RCW settings.
GPIO pins are available, and you can export GPIO and than use it, but the GPIO block does not support PWM.
1. "Yes, you can use those pins exclusively for PWM function, but this function should be selected in RCW settings. " so in this case we can directly use the pin as PWM pins by setting the correct bit register in the RCW? if so what do I need to change in the code. Under the FTM section of the document you sent me it shows an example of alarm timer.
-> Device Drivers -> Real Time Clock -> <*> Freescale FlexTimer alarm timer
what is the right way to do for PWM?
2. Do I need to do something in the .config for GPIO pins while building the kernel. or .dtb file. If so I would appreciate any instructions. Besides, when I check the section
3.4.8 IFC, SPI, QuadSPI, I 2 C, FTM, and GPIO2 signal multiplexing does this mean the pin can switch from PWM to GPIO or vice versa ?
IFC_A25 as an example
what pins only have GPIO functionalities?
(3) How to check which GPIOs are free to use at this moment. Are they referred by GPIO3_10 for example or gpio67 as in /sys/class/gpio they always export as gpio67 manner where to find all these information thanks. I checked the reference manual I only see
what is the correspondent gpio numbers in the linux user space
1. I meant you can look this driver source code to underdtand how to work with FTM block, to write your own FTM driver. Existing driver supports only wakeup function.
2. You do not need to config GPIO pins in device tree. To reconfigure IFC_A25 to FTM5_CH0 you have to modify RCW.
3. This depends on what you mean by "free to use". If you mean "exported" or "not exported", than you can always check this in Linux, but this information is not related to actual (physical) usage of the pin. If you mean, which pin is free to use physically, i.e. has nothing connected on the schematic and can be used for your needs, than - there is no way to determine it from Linux, this can be determined by reading the schematic.
Retrieving data ...