This question already has answers here:
spidev Linux driver on Intel Atom board
(3 answers)
Closed 3 years ago.
I am attempting to expose the SPI #2 interface from the Intel E3900 series (specifically the E3940) as a spidev interface to CentOS 8 (kernel version 4.18). As a fallback, any method to access the SPI controller through a C/C++ API would be acceptable.
I am trying to determine if the issue is something that must be corrected by the BIOS vendor or something I can fix with an ACPI patch. The vendor (Congatec) has claimed that the SPI interface is currently not supported as a userspace entity, but I am still waiting for my issue to be escalated to their engineering group to confirm that. The vendor also stated that the BIOS setting for the SPIs should be left at "Disabled", but I have also tried the "PCI" and "ACPI" options with no change.
I have attempted to merge together snippets from several references to create an ACPI patch, including:
spidev Linux driver on Intel Atom board
https://www.kernel.org/doc/Documentation/acpi/initrd_table_override.txt
https://www.kernel.org/doc/html/latest/firmware-guide/acpi/enumeration.html
I have recompiled the CentOS 8 kernel to include all the necessary options, and I am able to successfully rebuild the Linux initrd (initramfs in CentOS 8). I confirmed through dmesg logs that my modification is being loaded at boot; I don't see any error messages in the logs, so I am assuming that it is being applied successfully.
For reference, here are the kernel options I have ensured are compiled in (=y). I plan to eventually use kernel modules in concert with the stock kernel, but for now I thought this was the easier path.
CONFIG_MFD_INTEL_LPSS
CONFIG_MFD_INTEL_LPSS_ACPI
CONFIG_MFD_INTEL_LPSS_PCI
CONFIG_X86_INTEL_LPSS
CONFIG_SERIAL_8250_LPSS
CONFIG_PWM_LPSS
CONFIG_PWM_LPSS_PCI
CONFIG_PWM_LPSS_PLATFORM
CONFIG_SPI_PXA2XX
CONFIG_SPI_SPIDEV
CONFIG_SPI_BITBANG
When I dump the unmodified ACPI device tree with the following commands, I am able to see references to three different SPI buses, which correlate with their BIOS settings. As far as I know, the Intel chip only includes two SPI buses, which makes me think this really is something that will need to be fixed in their BIOS.
acpidump >acpidump
acpixtract -a acpidump
iasl -sa *.dat
grep -i spi *.dsl
I have tried several options to patch the device tree that include both references I found and reusing the device-tree configuration from SPI#1 (which I am assuming works), but none have seemed to work. Since the examples I have found are from the E3800 series, I'm hoping that I just have some register setting or pin identifier wrong and it needs to be updated for the E3900 series.
For reference, the SPI#1 bus is used to control other components on the SOM, so I want to avoid using that for general purpose as well.
Thanks in advance for any ideas/support.
DefinitionBlock ("spidev.aml", "SSDT", 2, "INTEL ", "SpiDev", 1)
{
External (_SB_.PCI0.SPI2, DeviceObj)
Scope (\_SB.PCI0.SPI2)
{
Device (FPNT)
{
Method (_HID, 0, NotSerialized) // _HID: Hardware ID
{
Return ("FPNT_DIS")
}
Method (_STA, 0, NotSerialized) // _STA: Status
{
Return (0x0F)
}
Method (_CRS, 0, Serialized) // _CRS: Current Resource Settings
{
Name (BBUF, ResourceTemplate ()
{
SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
ControllerInitiated, 0x002DC6C0, ClockPolarityLow,
ClockPhaseFirst, "\\_SB.PCI0.SPI2",
0x00, ResourceConsumer, , Exclusive,
)
GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly,
"\\_SB.GPO1", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x0043
}
GpioInt (Edge, ActiveHigh, ExclusiveAndWake, PullDefault, 0x0000,
"\\_SB.GPO0", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x000E
}
})
Return (BBUF) /* \_SB_.PCI0.SPI2.FPNT._CRS.BBUF */
}
}
}
}
DefinitionBlock ("spidev.aml", "SSDT", 5, "INTEL", "SPIDEV", 1)
{
External (_SB_.PCI0.SPI2, DeviceObj)
Scope (\_SB.PCI0.SPI2)
{
Device (TP0) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI test device connected to CS2")
Name (_DSD, Package() {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package (2) { "compatible", "spidev" },
}
})
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
2, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\_SB.PCI0.SPI2", // SPI host controller
0 // Must be 0
)
})
}
}
}
DefinitionBlock ("spidev.aml", "SSDT", 5, "INTEL", "SPIDEV", 1)
{
External (_SB_.PCI0.SPI2, DeviceObj)
Scope (\_SB.PCI0.SPI2)
{
Device (TP0) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI test device connected to CS2")
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
2, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\_SB.PCI0.SPI2", // SPI host controller
0 // Must be 0
)
})
}
}
}
EDIT: Added dmesg output after applying above via initrd
[ 0.000000] BRK [0x63ef9000, 0x63ef9fff] PGTABLE
[ 0.000000] BRK [0x63efa000, 0x63efafff] PGTABLE
[ 0.000000] RAMDISK: [mem 0x3b4f6000-0x3ce5cfff]
[ 0.000000] ACPI: SSDT ACPI table found in initrd [kernel/firmware/acpi/spidev.aml][0xb7]
[ 0.000000] modified physical RAM map:
[ 0.000000] modified: [mem 0x0000000000000000-0x0000000000000fff] reserved
[ 0.000000] modified: [mem 0x0000000000001000-0x000000000003efff] usable
--
[ 0.000000] ACPI: UEFI 0x00000000798C8400 000042 (v01 ALASKA A M I 00000000 00000000)
[ 0.000000] ACPI: TPM2 0x00000000798C8450 000034 (v04 ALASKA A M I 00000001 AMI 00000000)
[ 0.000000] ACPI: WDAT 0x00000000798C8490 000104 (v01 00000000 00000000)
[ 0.000000] ACPI: Table Upgrade: install [SSDT- INTEL- SPIDEV]
[ 0.000000] ACPI: SSDT 0x00000000774A2000 0000B7 (v05 INTEL SPIDEV 00000001 INTL 20180629)
[ 0.000000] ACPI: Local APIC address 0xfee00000
[ 0.000000] No NUMA configuration found
[ 0.000000] Faking a node at [mem 0x0000000000000000-0x000000017fffffff]
--
[ 1.141553] dw-apb-uart.0: ttyS4 at MMIO 0x91326000 (irq = 4, base_baud = 115200) is a 16550A
[ 1.144263] dw-apb-uart.1: ttyS5 at MMIO 0x91324000 (irq = 5, base_baud = 115200) is a 16550A
[ 1.146886] dw-apb-uart.2: ttyS6 at MMIO 0x91322000 (irq = 6, base_baud = 115200) is a 16550A
[ 1.149799] pxa2xx-spi pxa2xx-spi.4: cs2 >= max 2
[ 1.151063] spi_master spi2: failed to add SPI device SPT0001:00 from ACPI
[ 1.153366] rdac: device handler registered
[ 1.154791] hp_sw: device handler registered
[ 1.156043] emc: device handler registered
[root#localhost ~]# ls /dev/
autofs fuse log nvram tty tty25 tty42 tty6 ttyS5 vcsa1
block gpiochip0 loop-control port tty0 tty26 tty43 tty60 ttyS6 vcsa2
bus gpiochip1 mapper ppp tty1 tty27 tty44 tty61 ttyS7 vcsa3
char gpiochip2 mcelog pps0 tty10 tty28 tty45 tty62 ttyS8 vcsa4
console gpiochip3 mei0 pps1 tty11 tty29 tty46 tty63 ttyS9 vcsa5
core hidraw0 mem ptmx tty12 tty3 tty47 tty7 uhid vcsa6
cpu hpet memory_bandwidth ptp0 tty13 tty30 tty48 tty8 uinput vfio
cpu_dma_latency hugepages mmcblk1 ptp1 tty14 tty31 tty49 tty9 urandom vga_arbiter
cs hwrng mmcblk1boot0 pts tty15 tty32 tty5 ttyS0 usbmon0 vhci
cuse i2c-0 mmcblk1boot1 random tty16 tty33 tty50 ttyS1 usbmon1 vhost-net
disk i2c-1 mmcblk1p1 raw tty17 tty34 tty51 ttyS10 usbmon2 vhost-vsock
dm-0 i2c-2 mmcblk1p2 rtc tty18 tty35 tty52 ttyS11 vcs zero
dm-1 i2c-3 mmcblk1p3 rtc0 tty19 tty36 tty53 ttyS12 vcs1
dri i2c-4 mmcblk1rpmb shm tty2 tty37 tty54 ttyS13 vcs2
drm_dp_aux0 i2c-5 mqueue snapshot tty20 tty38 tty55 ttyS14 vcs3
drm_dp_aux1 initctl net snd tty21 tty39 tty56 ttyS15 vcs4
fb0 input network_latency stderr tty22 tty4 tty57 ttyS2 vcs5
fd kmsg network_throughput stdin tty23 tty40 tty58 ttyS3 vcs6
full kvm null stdout tty24 tty41 tty59 ttyS4 vcsa
EDIT: Added requested tables.dat output
https://pastebin.com/TBj8LRVc
EDIT: Added requested status output
[root#localhost ~]# grep -H 15 /sys/bus/acpi/devices/*/status
/sys/bus/acpi/devices/device:19/status:15
/sys/bus/acpi/devices/device:1a/status:15
/sys/bus/acpi/devices/device:1d/status:15
/sys/bus/acpi/devices/device:3e/status:15
/sys/bus/acpi/devices/device:44/status:15
/sys/bus/acpi/devices/device:45/status:15
/sys/bus/acpi/devices/INT33A1:00/status:15
/sys/bus/acpi/devices/INT3452:00/status:15
/sys/bus/acpi/devices/INT3452:01/status:15
/sys/bus/acpi/devices/INT3452:02/status:15
/sys/bus/acpi/devices/INT3452:03/status:15
/sys/bus/acpi/devices/INT3511:00/status:15
/sys/bus/acpi/devices/INT3512:00/status:15
/sys/bus/acpi/devices/LNXPOWER:00/status:15
/sys/bus/acpi/devices/MSFT0101:00/status:15
/sys/bus/acpi/devices/PNP0103:00/status:15
/sys/bus/acpi/devices/PNP0C0D:00/status:15
/sys/bus/acpi/devices/PNP0C0E:00/status:15
EDIT: Added requested lspci output
[root#localhost ~]# lspci -nk -s 19
00:19.0 1180: 8086:5ac2 (rev 0b)
Subsystem: 8086:7270
Kernel driver in use: intel-lpss
00:19.1 1180: 8086:5ac4 (rev 0b)
Subsystem: 8086:7270
Kernel driver in use: intel-lpss
00:19.2 1180: 8086:5ac6 (rev 0b)
Subsystem: 8086:7270
Kernel driver in use: intel-lpss
Thanks to 0andriy! He got me past the roadblock and taught me a few new commands along the way. The root cause of my issue was two-fold as it turned out:
The board vendor had cautioned me against enabling SPI#1 in BIOS, as that bus is used to control items on the SoM itself (assuming via their Linux BSP/driver?). I had to enable all three SPI interfaces in ACPI mode to have them be loaded and show up in the lspci -nk -s 19 output.
The device-tree update file had an error, which I missed previously because the interface itself was not being loaded. The AML file needed to specify Chip Select 1, not 2.
The script below will make all of the initrd changes and expose all three SPI buses using SPIDEV. On the board I am testing with, the SPI bus is coming through as spidev1.
I still need to confirm the Maximum speed the E3900 can handle, but I think the other parameters are set correctly.
#!/bin/bash
#
# SCRIPT NAME: ENABLE SPIDEV ON INTEL ATOM E3900 SERIES SOC
# TARGET PLATFORM: CENTOS8_x86-64
# AUTHOR: ADAM ACKERMAN
# LICENSE: MIT
#
# REFERENCES:
# https://www.kernel.org/doc/Documentation/acpi/initrd_table_override.txt
# https://stackoverflow.com/questions/39118721/spidev-linux-driver-on-intel-atom-board
# https://www.kernel.org/doc/html/latest/firmware-guide/acpi/enumeration.html
#
# Pull current kernel version
KERNEL_VER=$(cat /proc/version | cut -d " " -f 3)
# Verify current kernel includes spidev support
# NOTE: If configured as module, must be actively loaded
if [[ ! -d /sys/class/spidev ]]; then
modprobe spidev
if [[ ! -d /sys/class/spidev ]]; then
echo "Kernel does not support SPIDEV. Please enable first."
exit 1
fi
fi
# Move the backup file back to active, if exists
if [[ -f /boot/initramfs-$KERNEL_VER.img.bak ]]; then
rm -f /boot/initramfs-$KERNEL_VER.img
mv /boot/initramfs-$KERNEL_VER.img.bak /boot/initramfs-$KERNEL_VER.img
fi
# Create new temp directory and change to it
ACPI_TMP=$(mktemp -d)
cd $ACPI_TMP
# Reference commands to pull current ACPI tree
#acpidump >acpidump
#acpixtract -a acpidump
#iasl -sa *.dat
#grep -i spi *.dsl
# Paste in ASL file to enable the SPIDEV interface
cat > spidev.asl <<'_EOF'
DefinitionBlock ("spidev.aml", "SSDT", 5, "INTEL", "SPIDEV", 1)
{
External (_SB_.PCI0.SPI1, DeviceObj)
Scope (\_SB.PCI0.SPI1)
{
Device (TP10) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI1-CS0")
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
0, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\_SB.PCI0.SPI1", // SPI host controller
0 // Must be 0
)
})
}
Device (TP11) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI1-CS1")
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
1, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\_SB.PCI0.SPI1", // SPI host controller
0 // Must be 0
)
})
}
}
External (_SB_.PCI0.SPI2, DeviceObj)
Scope (\_SB.PCI0.SPI2)
{
Device (TP20) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI2-CS0")
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
0, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\_SB.PCI0.SPI2", // SPI host controller
0 // Must be 0
)
})
}
Device (TP21) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI2-CS1")
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
1, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\_SB.PCI0.SPI2", // SPI host controller
0 // Must be 0
)
})
}
}
External (_SB_.PCI0.SPI3, DeviceObj)
Scope (\_SB.PCI0.SPI3)
{
Device (TP30) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI3-CS0")
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
0, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\_SB.PCI0.SPI3", // SPI host controller
0 // Must be 0
)
})
}
Device (TP31) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI3-CS1")
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
1, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\_SB.PCI0.SPI3", // SPI host controller
0 // Must be 0
)
})
}
}
}
_EOF
# Convert the ASL file to AML
iasl spidev.asl
# Create new directory structure to match initrd format
mkdir -p kernel/firmware/acpi
# Copy in the AML file
cp spidev.aml kernel/firmware/acpi
# Load all files into a new initrd in /boot
find kernel | cpio -H newc --create > /boot/instrumented_initrd
# Move out of the temporary directory and remove
cd ~
rm -rf $ACPI_TMP
# Merge the current initrd to the end of the one just created
cat /boot/initramfs-$KERNEL_VER.img >>/boot/instrumented_initrd
# Move the working one to a backup location
mv /boot/initramfs-$KERNEL_VER.img /boot/initramfs-$KERNEL_VER.img.bak
# Move the new one into place
mv /boot/instrumented_initrd /boot/initramfs-$KERNEL_VER.img
# Script Finished
echo "Process Complete - reboot the system for the changes to take effect."
echo "After reboot, verify success with command 'dmesg | grep -i spi'"
The resulting device list is:
[root#localhost ~]# ls /dev/spi*
/dev/spidev1.0 /dev/spidev1.1 /dev/spidev2.0 /dev/spidev2.1 /dev/spidev3.0 /dev/spidev3.1
Related
Recently I'm try to debug a nvme timeout issue:
# dd if=/dev/urandom of=/dev/nvme0n1 bs=4k count=1024000
nvme nvme0: controller is down; will reset: CSTS=0x3,
PCI_STATUS=0x2010
nvme nvme0: Shutdown timeout set to 8 seconds
nvme nvme0: 1/0/0 default/read/poll queues
nvme nvme0: I/O 388 QID 1 timeout, disable controller
blk_update_request: I/O error, dev nvme0n1, sector 64008 op 0x1:(WRITE) flags 0x104000 phys_seg 127 prio class 0
......
After some digging, I found the root cause is pcie-controller's ranges dts property, which is used for pio/outbound mapping:
<0x02000000 0x00 0x08000000 0x20 0x04000000 0x00 0x04000000>; dd timeout
<0x02000000 0x00 0x04000000 0x20 0x04000000 0x00 0x04000000>; dd ok
Regardless of the root cause, it seems the timeout here is influenced by mmio, because 0x02000000 stands for non-prefetch mmio. Is it true? is it possible that dd will trigger dma and nvme controller as a master?
It uses dma instead of mmio.
Here is answer from Keith Busch:
Generally speaking, an nvme driver notifies the controller of new
commands via a MMIO write to a specific nvme register. The nvme
controller fetches those commands from host memory with a DMA.
One exception to that description is if the nvme controller supports CMB
with SQEs, but they're not very common. If you had such a controller,
the driver will use MMIO to write commands directly into controller
memory instead of letting the controller DMA them from host memory. Do
you know if you have such a controller?
The data transfers associated with your 'dd' command will always use DMA.
Below is ftrace output:
Call stack before nvme_map_data:
# entries-in-buffer/entries-written: 376/376 #P:2
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID TGID CPU# |||| TIMESTAMP FUNCTION
# | | | | |||| | |
kworker/u4:0-379 (-------) [000] ...1 3712.711523: nvme_map_data <-nvme_queue_rq
kworker/u4:0-379 (-------) [000] ...1 3712.711533: <stack trace>
=> nvme_map_data
=> nvme_queue_rq
=> blk_mq_dispatch_rq_list
=> __blk_mq_do_dispatch_sched
=> __blk_mq_sched_dispatch_requests
=> blk_mq_sched_dispatch_requests
=> __blk_mq_run_hw_queue
=> __blk_mq_delay_run_hw_queue
=> blk_mq_run_hw_queue
=> blk_mq_sched_insert_requests
=> blk_mq_flush_plug_list
=> blk_flush_plug_list
=> blk_mq_submit_bio
=> __submit_bio_noacct_mq
=> submit_bio_noacct
=> submit_bio
=> submit_bh_wbc.constprop.0
=> __block_write_full_page
=> block_write_full_page
=> blkdev_writepage
=> __writepage
=> write_cache_pages
=> generic_writepages
=> blkdev_writepages
=> do_writepages
=> __writeback_single_inode
=> writeback_sb_inodes
=> __writeback_inodes_wb
=> wb_writeback
=> wb_do_writeback
=> wb_workfn
=> process_one_work
=> worker_thread
=> kthread
=> ret_from_fork
Call graph of nvme_map_data:
# tracer: function_graph
#
# CPU DURATION FUNCTION CALLS
# | | | | | | |
0) | nvme_map_data [nvme]() {
0) | __blk_rq_map_sg() {
0) + 15.600 us | __blk_bios_map_sg();
0) + 19.760 us | }
0) | dma_map_sg_attrs() {
0) + 62.620 us | dma_direct_map_sg();
0) + 66.520 us | }
0) | nvme_pci_setup_prps [nvme]() {
0) | dma_pool_alloc() {
0) | _raw_spin_lock_irqsave() {
0) 1.880 us | preempt_count_add();
0) 5.520 us | }
0) | _raw_spin_unlock_irqrestore() {
0) 1.820 us | preempt_count_sub();
0) 5.260 us | }
0) + 16.400 us | }
0) + 23.500 us | }
0) ! 150.100 us | }
nvme_pci_setup_prps is one method for nvme to do dma:
NVMe devices transfer data to and from system memory using Direct Memory Access (DMA). Specifically, they send messages across the PCI bus requesting data transfers. In the absence of an IOMMU, these messages contain physical memory addresses. These data transfers happen without involving the CPU, and the MMU is responsible for making access to memory coherent.
NVMe devices also may place additional requirements on the physical layout of memory for these transfers. The NVMe 1.0 specification requires all physical memory to be describable by what is called a PRP list. To be described by a PRP list, memory must have the following properties:
The memory is broken into physical 4KiB pages, which we'll call device pages.
The first device page can be a partial page starting at any 4-byte aligned address. It may extend up to the end of the current physical page, but not beyond.
If there is more than one device page, the first device page must end on a physical 4KiB page boundary.
The last device page begins on a physical 4KiB page boundary, but is not required to end on a physical 4KiB page boundary.
https://spdk.io/doc/memory.html
I am getting the below error 50% of the time during startup on an STM32 based processor (OSD32MP15x).
I've tried over 40 versions configs and setups none work and I am under high pressure to deliver this piece of hardware to a client. To me this looks like some kind of timing issue because it doesn't always happen.
I've tried to disable USB related configs, change DTS files and strip out everything that is not needed and last but not least change power config in the linux config and DTS.
Questions:
How can I debug the below?
What does this error look like to you?
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.56 (yme#ubuntu18) (gcc version 9.3.0 (Buildroot 2020.02-00011-g7ea8a52)) #1 SMP PREEMPT Wed Nov 4 17:25:46 CET 2020
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: IM45
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] Reserved memory: created DMA memory pool at 0x10000000, size 0 MiB
[ 0.000000] OF: reserved mem: initialized node mcuram2#10000000, compatible id shared-dma-pool
[ 0.000000] Reserved memory: created DMA memory pool at 0x10040000, size 0 MiB
[ 0.000000] OF: reserved mem: initialized node vdev0vring0#10040000, compatible id shared-dma-pool
[ 0.000000] Reserved memory: created DMA memory pool at 0x10041000, size 0 MiB
[ 0.000000] OF: reserved mem: initialized node vdev0vring1#10041000, compatible id shared-dma-pool
[ 0.000000] Reserved memory: created DMA memory pool at 0x10042000, size 0 MiB
[ 0.000000] OF: reserved mem: initialized node vdev0buffer#10042000, compatible id shared-dma-pool
[ 0.000000] Reserved memory: created DMA memory pool at 0x30000000, size 0 MiB
[ 0.000000] OF: reserved mem: initialized node mcuram#30000000, compatible id shared-dma-pool
[ 0.000000] Reserved memory: created DMA memory pool at 0x38000000, size 0 MiB
[ 0.000000] OF: reserved mem: initialized node retram#38000000, compatible id shared-dma-pool
[ 0.000000] cma: Reserved 128 MiB at 0xd2000000
[ 0.000000] psci: probing for conduit method from DT.
[ 0.000000] psci: PSCIv1.1 detected in firmware.
[ 0.000000] psci: Using standard PSCI v0.2 function IDs
[ 0.000000] psci: MIGRATE_INFO_TYPE not supported.
[ 0.000000] psci: SMC Calling Convention v1.0
[ 0.000000] percpu: Embedded 20 pages/cpu s50124 r8192 d23604 u81920
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113536
[ 0.000000] Kernel command line: root=/dev/mmcblk1p2 rootwait rw console=ttySTM0,115200
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 305152K/458752K available (11264K kernel code, 844K rwdata, 3364K rodata, 1024K init, 216K bss, 22528K reserved, 131072K cma-reserved, 0K highmem)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] rcu: Preemptible hierarchical RCU implementation.
[ 0.000000] rcu: RCU event tracing is enabled.
[ 0.000000] Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] random: get_random_bytes called from start_kernel+0x31c/0x4f4 with crng_init=0
[ 0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (virt).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[ 0.000009] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[ 0.000027] Switching to timer-based delay loop, resolution 41ns
[ 0.001228] Console: colour dummy device 80x30
[ 0.001276] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[ 0.001296] pid_max: default: 32768 minimum: 301
[ 0.001560] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.001581] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.002900] CPU: Testing write buffer coherency: ok
[ 0.003447] /cpus/cpu#0 missing clock-frequency property
[ 0.003484] /cpus/cpu#1 missing clock-frequency property
[ 0.003504] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.060001] Setting up static identity map for 0xc0100000 - 0xc0100060
[ 0.079971] rcu: Hierarchical SRCU implementation.
[ 0.104229] smp: Bringing up secondary CPUs ...
[ 0.180623] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.180859] smp: Brought up 1 node, 2 CPUs
[ 0.180884] SMP: Total of 2 processors activated (96.00 BogoMIPS).
[ 0.180895] CPU: All CPU(s) started in SVC mode.
[ 0.181728] devtmpfs: initialized
[ 0.201048] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[ 0.201702] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.201736] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[ 0.208702] pinctrl core: initialized pinctrl subsystem
[ 0.211039] NET: Registered protocol family 16
[ 0.223325] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.225695] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.225715] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.226146] Serial: AMBA PL011 UART driver
[ 0.228991] stm32-pm-domain pm_domain: domain core-ret-power-domain registered
[ 0.229030] stm32-pm-domain pm_domain: subdomain core-power-domain registered
[ 0.229046] stm32-pm-domain pm_domain: domains probed
[ 0.264062] SCSI subsystem initialized
[ 0.264934] usbcore: registered new interface driver usbfs
[ 0.265017] usbcore: registered new interface driver hub
[ 0.265170] usbcore: registered new device driver usb
[ 0.265576] pps_core: LinuxPPS API ver. 1 registered
[ 0.265590] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti#linux.it>
[ 0.265624] PTP clock support registered
[ 0.265887] EDAC MC: Ver: 3.0.0
[ 0.267262] Advanced Linux Sound Architecture Driver Initialized.
[ 0.269092] clocksource: Switched to clocksource arch_sys_counter
[ 0.994946] thermal_sys: Registered thermal governor 'step_wise'
[ 0.995599] NET: Registered protocol family 2
[ 0.996743] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[ 0.996799] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 0.996866] TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)
[ 0.996962] TCP: Hash tables configured (established 4096 bind 4096)
[ 0.997119] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.997165] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 0.997480] NET: Registered protocol family 1
[ 0.998493] RPC: Registered named UNIX socket transport module.
[ 0.998514] RPC: Registered udp transport module.
[ 0.998525] RPC: Registered tcp transport module.
[ 0.998536] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.999750] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available
[ 1.001772] Initialise system trusted keyrings
[ 1.002136] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[ 1.015364] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 1.016787] NFS: Registering the id_resolver key type
[ 1.016838] Key type id_resolver registered
[ 1.016850] Key type id_legacy registered
[ 1.017081] ntfs: driver 2.1.32 [Flags: R/O].
[ 1.017623] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 1.018434] fuse: init (API version 7.31)
[ 1.019683] NET: Registered protocol family 38
[ 1.019706] Key type asymmetric registered
[ 1.019719] Asymmetric key parser 'x509' registered
[ 1.019785] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[ 1.019800] io scheduler mq-deadline registered
[ 1.019811] io scheduler kyber registered
[ 1.029372] STM32 USART driver initialized
[ 1.050170] brd: module loaded
[ 1.065205] loop: module loaded
[ 1.070532] libphy: Fixed MDIO Bus: probed
[ 1.072541] CAN device driver interface
[ 1.075529] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.075582] ehci-platform: EHCI generic platform driver
[ 1.076011] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.076048] ohci-platform: OHCI generic platform driver
[ 1.076725] usbcore: registered new interface driver cdc_acm
[ 1.076739] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 1.080942] i2c /dev entries driver
[ 1.084746] stm32-cpufreq stm32-cpufreq: Failed to get chip info: -517
[ 1.087467] sdhci: Secure Digital Host Controller Interface driver
[ 1.087483] sdhci: Copyright(c) Pierre Ossman
[ 1.087493] Synopsys Designware Multimedia Card Interface Driver
[ 1.087913] sdhci-pltfm: SDHCI platform and OF driver helper
[ 1.088990] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.090464] usbcore: registered new interface driver usbhid
[ 1.090481] usbhid: USB HID core driver
[ 1.090775] arm-smc-mbox mailbox-0: ARM SMC mailbox enabled.
[ 1.090909] arm-smc-mbox mailbox-1: ARM SMC mailbox enabled.
[ 1.092452] remoteproc remoteproc0: releasing m4
[ 1.094961] Unable to get STM32 DDR PMU clock
[ 1.099244] drop_monitor: Initializing network drop monitor service
[ 1.099591] NET: Registered protocol family 17
[ 1.099625] can: controller area network core (rev 20170425 abi 9)
[ 1.099760] NET: Registered protocol family 29
[ 1.099779] can: raw protocol (rev 20170425)
[ 1.099791] can: broadcast manager protocol (rev 20170425 t)
[ 1.099809] can: netlink gateway (rev 20190810) max_hops=1
[ 1.100648] Key type dns_resolver registered
[ 1.100825] ThumbEE CPU extension supported.
[ 1.100855] Registering SWP/SWPB emulation handler
[ 1.101320] registered taskstats version 1
[ 1.101336] Loading compiled-in X.509 certificates
[ 1.112592] Loaded X.509 cert 'Build time autogenerated kernel key: a1bb00e898260e4deb50c76fbad98451248b76f2'
[ 1.132155] arm-scmi firmware:scmi-0: SCMI Protocol v2.0 'ST:' Firmware version 0x0
[ 1.135402] remoteproc remoteproc0: releasing m4
[ 1.136357] Unable to get STM32 DDR PMU clock
[ 1.159535] remoteproc remoteproc0: releasing m4
[ 1.160502] Unable to get STM32 DDR PMU clock
[ 1.199623] stm32-mdma 58000000.dma: STM32 MDMA driver registered
[ 1.202939] stm32-dma 48000000.dma: STM32 DMA driver registered
[ 1.229428] random: fast init done
[ 1.229493] stm32-crc32 58009000.crc: Initialized
[ 1.233994] random: crng init done
[ 1.241968] remoteproc remoteproc0: releasing m4
[ 1.243240] stm32-ddr-pmu: probed (ID=0x00140061 VER=0x00000010), DDR#533MHz
[ 1.243899] /soc/interrupt-controller#5000d000: bank0
[ 1.243916] /soc/interrupt-controller#5000d000: bank1
[ 1.243929] /soc/interrupt-controller#5000d000: bank2
[ 1.245454] stm32mp157-pinctrl soc:pin-controller#50002000: GPIOA bank added
[ 1.245888] stm32mp157-pinctrl soc:pin-controller#50002000: GPIOB bank added
[ 1.246272] stm32mp157-pinctrl soc:pin-controller#50002000: GPIOC bank added
[ 1.246674] stm32mp157-pinctrl soc:pin-controller#50002000: GPIOD bank added
[ 1.247034] stm32mp157-pinctrl soc:pin-controller#50002000: GPIOE bank added
[ 1.247478] stm32mp157-pinctrl soc:pin-controller#50002000: GPIOF bank added
[ 1.247852] stm32mp157-pinctrl soc:pin-controller#50002000: GPIOG bank added
[ 1.248211] stm32mp157-pinctrl soc:pin-controller#50002000: GPIOH bank added
[ 1.248577] stm32mp157-pinctrl soc:pin-controller#50002000: GPIOI bank added
[ 1.248617] stm32mp157-pinctrl soc:pin-controller#50002000: Pinctrl STM32 initialized
[ 1.249706] stm32mp157-pinctrl soc:pin-controller-z#54004000: GPIOZ bank added
[ 1.249733] stm32mp157-pinctrl soc:pin-controller-z#54004000: Pinctrl STM32 initialized
[ 1.252232] 4000f000.serial: ttySTM1 at MMIO 0x4000f000 (irq = 36, base_baud = 6527435) is a stm32-usart
[ 1.253971] stm32-usart 40010000.serial: interrupt mode for rx (no dma)
[ 1.253994] stm32-usart 40010000.serial: interrupt mode for tx (no dma)
[ 1.254033] 40010000.serial: ttySTM0 at MMIO 0x40010000 (irq = 37, base_baud = 4000000) is a stm32-usart
[ 2.327555] printk: console [ttySTM0] enabled
[ 2.336702] stm32_rtc 5c004000.rtc: registered as rtc0
[ 2.341362] stm32_rtc 5c004000.rtc: Date/Time must be initialized
[ 2.346472] stm32_rtc 5c004000.rtc: registered rev:1.2
[ 2.373942] stm32f7-i2c 5c002000.i2c: doesn't use DMA
[ 2.379061] stpmic1 0-0033: PMIC Chip Version: 0x21
[ 2.383768] genirq: irq_chip stm32-exti-h did not update eff. affinity mask of irq 42
[ 2.391628] BUCK1: supplied by vin
[ 2.397045] BUCK2: supplied by vin
[ 2.402086] BUCK3: supplied by vin
[ 2.407216] BUCK4: supplied by vin
[ 2.412185] LDO1: supplied by v3v3
[ 2.417921] LDO2: supplied by vin
[ 2.423176] LDO3: supplied by vdd_ddr
[ 2.428498] LDO4: supplied by vin
[ 2.433721] LDO5: supplied by vin
[ 2.438846] LDO6: supplied by v3v3
[ 2.444180] VREF_DDR: supplied by vin
[ 2.449317] BOOST: supplied by vin
[ 2.454858] 8<--- cut here ---
[ 2.454968] VBUS_OTG: supplied by bst_out
[ 2.456448] Unable to handle kernel NULL pointer dereference at virtual address 00000050
[ 2.468540] pgd = 65ccf75c
[ 2.471247] [00000050] *pgd=00000000
[ 2.474801] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[ 2.480100] Modules linked in:
[ 2.483148] CPU: 0 PID: 73 Comm: irq/42-pmic_irq Not tainted 5.4.56 #1
[ 2.489664] Hardware name: STM32 (Device Tree Support)
[ 2.494809] PC is at mutex_trylock+0xc/0x84
[ 2.498977] LR is at regulator_lock+0x1c/0xbc
[ 2.503319] pc : [<c0b0dfec>] lr : [<c05d48ec>] psr: 60000013
[ 2.509580] sp : df7c7ecc ip : 010a1d00 fp : c0cbe554
[ 2.514798] r10: c0cbe984 r9 : df7c3800 r8 : 0000000e
[ 2.520016] r7 : df7eec68 r6 : 00000050 r5 : c11b5550 r4 : 00000000
[ 2.526539] r3 : df7c7ecc r2 : df7c600c r1 : 00000000 r0 : 00000050
[ 2.533064] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 2.540194] Control: 10c5387d Table: c000406a DAC: 00000051
[ 2.545935] Process irq/42-pmic_irq (pid: 73, stack limit = 0xa70e693e)
[ 2.552542] Stack: (0xdf7c7ecc to 0xdf7c8000)
[ 2.556897] 7ec0: c05d48ec df7ed0c0 c11b5550 df7eec00 c05e813c
[ 2.565073] 7ee0: df7f8bc0 00000000 df7eec00 c017fba0 00000020 00000024 df7ca800 00000001
[ 2.573247] 7f00: 0000000e c069b370 00000001 df1a6540 df7ca700 c1104c88 df7c6000 df7eb380
[ 2.581422] 7f20: df7ca700 df7c6000 00000001 df7eb380 c017c470 ffffe000 00000000 c017c48c
[ 2.589599] 7f40: df7ca700 df7eb3a4 df7c6000 c017c7a4 40000013 00000000 c017c59c c1104c88
[ 2.597774] 7f60: 00000000 df5a9d00 df7eb3c0 df1cbab4 df7c6000 df7eb380 c017c670 df5a9d1c
[ 2.605949] 7f80: 00000000 c0148a70 00000000 df7eb3c0 c0148954 00000000 00000000 00000000
[ 2.614124] 7fa0: 00000000 00000000 00000000 c01010e8 00000000 00000000 00000000 00000000
[ 2.622298] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 2.630473] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[ 2.638666] [<c0b0dfec>] (mutex_trylock) from [<c05d48ec>] (regulator_lock+0x1c/0xbc)
[ 2.646486] [<c05d48ec>] (regulator_lock) from [<c05e813c>] (stpmic1_boost_irq_handler+0x44/0x1cc)
[ 2.655438] [<c05e813c>] (stpmic1_boost_irq_handler) from [<c017fba0>] (handle_nested_irq+0xc4/0x130)
[ 2.664654] [<c017fba0>] (handle_nested_irq) from [<c069b370>] (regmap_irq_thread+0x328/0x508)
[ 2.673260] [<c069b370>] (regmap_irq_thread) from [<c017c48c>] (irq_thread_fn+0x1c/0x78)
[ 2.681344] [<c017c48c>] (irq_thread_fn) from [<c017c7a4>] (irq_thread+0x134/0x200)
[ 2.688999] [<c017c7a4>] (irq_thread) from [<c0148a70>] (kthread+0x11c/0x144)
[ 2.696132] [<c0148a70>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
[ 2.703338] Exception stack(0xdf7c7fb0 to 0xdf7c7ff8)
[ 2.708385] 7fa0: 00000000 00000000 00000000 00000000
[ 2.716562] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 2.724735] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 2.731348] Code: e8bd81f0 e52de004 e1a0300d e3c32d7f (e5903000)
[ 2.737474] ---[ end trace 63a5f7bb4baf46f1 ]---
[ 2.742083] genirq: exiting task "irq/42-pmic_irq" (73) is an active IRQ thread (irq 42)
Edit link linux codebase: v5.4-stm32mp
Edit add DTS config:
pmic:stpmic#33{
compatible = "st,stpmic1";
reg = <0x33>;
interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
status = "okay";
regulators{
compatible = "st,stpmic1-regulators";
buck1-supply = <&vin>;
buck2-supply = <&vin>;
buck3-supply = <&vin>;
buck4-supply = <&vin>;
ldo1-supply = <&v3v3>;
ldo2-supply = <&vin>;
ldo3-supply = <&vdd_ddr>;
ldo4-supply = <&vin>;
ldo5-supply = <&vin>;
ldo6-supply = <&v3v3>;
vref_ddr-supply = <&vin>;
boost-supply = <&vin>;
pwr_sw1-supply = <&bst_out>;
pwr_sw2-supply = <&bst_out>;
vddcore:buck1{
regulator-name = "vddcore";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-initial-mode = <0>;
regulator-over-current-protection;
};
vdd_ddr:buck2{
regulator-name = "vdd_ddr";
regulator-min-microvolt = <1350000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-initial-mode = <0>;
regulator-over-current-protection;
};
vdd:buck3{
regulator-name = "vdd";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
st,mask-reset;
regulator-initial-mode = <0>;
regulator-over-current-protection;
};
v3v3:buck4{
regulator-name = "v3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-over-current-protection;
regulator-initial-mode = <0>;
};
v1v8_audio:ldo1{
regulator-name = "v1v8_audio";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
interrupts = <IT_CURLIM_LDO1 0>;
};
v3v3_hdmi:ldo2{
regulator-name = "v3v3_hdmi";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
interrupts = <IT_CURLIM_LDO2 0>;
};
vtt_ddr:ldo3{
regulator-name = "vtt_ddr";
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <750000>;
regulator-always-on;
regulator-over-current-protection;
};
vdd_usb:ldo4{
regulator-name = "vdd_usb";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
interrupts = <IT_CURLIM_LDO4 0>;
regulator-always-on;
};
vdda:ldo5{
regulator-name = "vdda";
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO5 0>;
regulator-boot-on;
};
v1v2_hdmi:ldo6{
regulator-name = "v1v2_hdmi";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
regulator-always-on;
interrupts = <IT_CURLIM_LDO6 0>;
};
vref_ddr:vref_ddr{
regulator-name = "vref_ddr";
regulator-always-on;
regulator-over-current-protection;
};
bst_out:boost{
regulator-name = "bst_out";
interrupts = <IT_OCP_BOOST 0>;
regulator-always-on;
};
vbus_otg:pwr_sw1{
regulator-name = "vbus_otg";
interrupts = <IT_OCP_OTG 0>;
};
vbus_sw:pwr_sw2{
regulator-name = "vbus_sw";
interrupts = <IT_OCP_SWOUT 0>;
regulator-active-discharge = <1>;
regulator-always-on;
};
};
onkey{
compatible = "st,stpmic1-onkey";
interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>;
interrupt-names = "onkey-falling", "onkey-rising";
power-off-time-sec = <10>;
status = "okay";
};
watchdog {
compatible = "st,stpmic1-wdt";
status = "disabled";
};
};
It looks like the problem was introduced by the patch: regulator: stpmic1: Usb boost over-current protection workaround.
The "boost" interrupt handler stpmic1_boost_irq_handler calls regulator_lock(usb_data->boost_rdev);
The "boost" interrupt handler (stpmic1_boost_irq_handler) is set up by the stpmic1_boost_register function, but usb_data->boost_rdev is still null at this time.
usb_data->boost_rdev is set to the return value of the stpmic1_boost_register function by thestpmic1_regulator_probe function.
If the "boost" interrupt handler stpmic1_boost_irq_handler gets called before usb_data->boost_rdev has been set by the stpmic1_regulator_probe function, then the crash occurs.
A workaround would be to set usb_data->boost_rdev = rdev; in the stpmic1_boost_register function after it has set rdev but before it sets up the interrupt handler.
This should be reported to the author of the patch. See the "Signed-off-by:" line in the patch for the email address.
I am trying to cross compile the Linux for a dual-core ARM Cortex A9 device. While booting I got the following prints on the UART which is showing some sync issue when Core-1 is starting. I remember I have enabled multi programming while compiling the kernel. What part of the building process must have gone wrong here?
zImage building or
Generating the root file system?
Uart Prints:
U-Boot SPL 2013.01.01 (Sep 13 2019 - 01:35:54)
BOARD : Altera SOCFPGA Cyclone V Board
CLOCK: EOSC1 clock 25000 KHz
CLOCK: EOSC2 clock 25000 KHz
CLOCK: F2S_SDR_REF clock 0 KHz
CLOCK: F2S_PER_REF clock 0 KHz
CLOCK: MPU clock 800 MHz
CLOCK: DDR clock 400 MHz
CLOCK: UART clock 100000 KHz
CLOCK: MMC clock 50000 KHz
CLOCK: QSPI clock 3125 KHz
RESET: COLD
INFO : Watchdog enabled
SDRAM: Initializing MMR registers
SDRAM: Calibrating PHY
SEQ.C: Preparing to start memory calibration
SEQ.C: CALIBRATION PASSED
SDRAM: 1024 MiB
ALTERA DWMMC: 0
reading u-boot.img
reading u-boot.img
U-Boot 2013.01.01-00140-g0c9a3bdf3c (Sep 13 2019 - 01:28:34)
CPU : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone V Board
I2C: ready
DRAM: 1 GiB
MMC: ALTERA DWMMC: 0
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Skipped ethaddr assignment due to invalid EMAC address in EEPROM
Net: mii0
Warning: failed to set MAC address
Hit any key to stop autoboot: 0
reading u-boot.scr
589 bytes read in 5 ms (114.3 KiB/s)
## Executing script at 02000000
-- Programming FPGA --
reading soc_system.rbf
7007204 bytes read in 361 ms (18.5 MiB/s)
## Starting application at 0x3FF785A4 ...
## Application terminated, rc = 0x0
-- Setting Env Variables --
reading zImage
4389688 bytes read in 246 ms (17 MiB/s)
reading soc_system.dtb
24091 bytes read in 9 ms (2.6 MiB/s)
## Flattened Device Tree blob at 00000100
Booting using the fdt blob at 0x00000100
Loading Device Tree to 03ff7000, end 03fffe1a ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.0-ge4c2b71c147d (gurmeet#gurmeet-VirtualBox) (gcc version 7.1.1 20170510 (Linaro GCC 7.1-2017.05) ) #1 SMP Sat Sep 14 10:50:07 IST 2019
[ 0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt:Machine model: Terasic DE10 NANO
[ 0.000000] cma: Reserved 16 MiB at 0x3f000000
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] percpu: Embedded 14 pages/cpu #ef7ca000 s26892 r8192 d22260 u57344
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260608
[ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 1012076K/1048576K available (7168K kernel code, 464K rwdata, 1436K rodata, 1024K init, 173K bss, 20116K reserved, 16384K cma-reserved, 245760K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0xc0008000 - 0xc0800000 (8160 kB)
[ 0.000000] .init : 0xc0a00000 - 0xc0b00000 (1024 kB)
[ 0.000000] .data : 0xc0b00000 - 0xc0b742b4 ( 465 kB)
[ 0.000000] .bss : 0xc0b742b4 - 0xc0b9f80c ( 174 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to 32.
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] L2C-310 erratum 769419 enabled
[ 0.000000] L2C-310 enabling early BRESP for Cortex-A9
[ 0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[ 0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[ 0.000000] L2C-310 cache controller enabled, 8 ways, 512 kB
[ 0.000000] L2C-310: CACHE_ID 0x410030c9, AUX_CTRL 0x46060001
[ 0.000000] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
[ 0.000007] sched_clock: 32 bits at 100MHz, resolution 10ns, wraps every 21474836475ns
[ 0.000019] Switching to timer-based delay loop, resolution 10ns
[ 0.000248] GIC: PPI13 is secure or misconfigured
[ 0.000285] GIC: PPI13 is secure or misconfigured
[ 0.000481] Console: colour dummy device 80x30
[ 0.000506] Calibrating delay loop (skipped), value calculated using timer frequency.. 200.00 BogoMIPS (lpj=1000000)
[ 0.000521] pid_max: default: 32768 minimum: 301
[ 0.000625] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000637] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.001356] CPU: Testing write buffer coherency: ok
[ 0.001386] ftrace: allocating 23073 entries in 68 pages
[ 0.042460] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.042709] Setting up static identity map for 0x100000 - 0x100058
[ 0.044448] GIC: PPI13 is secure or misconfigured
[ 0.044460] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.044549] Brought up 2 CPUs
[ 0.044568] SMP: Total of 2 processors activated (400.00 BogoMIPS).
[ 0.044575] CPU: All CPU(s) started in SVC mode.
[ 0.045480] devtmpfs: initialized
[ 0.051307] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[ 0.051529] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.053213] NET: Registered protocol family 16
[ 0.055578] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.056834] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[ 0.056846] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 0.115503] vgaarb: loaded
[ 0.115792] SCSI subsystem initialized
[ 0.116038] usbcore: registered new interface driver usbfs
[ 0.116099] usbcore: registered new interface driver hub
[ 0.116166] usbcore: registered new device driver usb
[ 0.116328] sopc#0:usbphy#0 supply vcc not found, using dummy regulator
[ 0.117339] pps_core: LinuxPPS API ver. 1 registered
[ 0.117351] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti#linux.it>
[ 0.117377] PTP clock support registered
[ 0.117557] FPGA manager framework
[ 0.118986] clocksource: Switched to clocksource timer
[ 0.151378] NET: Registered protocol family 2
[ 0.151919] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.151999] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.152126] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.152208] UDP hash table entries: 512 (order: 2, 16384 bytes)
[ 0.152255] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[ 0.152425] NET: Registered protocol family 1
[ 0.152936] RPC: Registered named UNIX socket transport module.
[ 0.152947] RPC: Registered udp transport module.
[ 0.152954] RPC: Registered tcp transport module.
[ 0.152961] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.153628] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
[ 0.154456] futex hash table entries: 512 (order: 3, 32768 bytes)
[ 0.155247] workingset: timestamp_bits=30 max_order=18 bucket_order=0
[ 0.164377] NFS: Registering the id_resolver key type
[ 0.164411] Key type id_resolver registered
[ 0.164419] Key type id_legacy registered
[ 0.164435] Installing knfsd (copyright (C) 1996 okir#monad.swb.de).
[ 0.165053] ntfs: driver 2.1.32 [Flags: R/W].
[ 0.165373] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.166615] bounce: pool size: 64 pages
[ 0.166628] io scheduler noop registered (default)
[ 0.174406] dma-pl330 ffe01000.dma: Loaded driver for PL330 DMAC-341330
[ 0.174424] dma-pl330 ffe01000.dma: DBUFF-512x8bytes Num_Chans-8 Num_Peri-32 Num_Events-8
[ 0.178453] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[ 0.179707] console [ttyS0] disabled
[ 0.179744] ffc02000.serial: ttyS0 at MMIO 0xffc02000 (irq = 24, base_baud = 6250000) is a 16550A
[ 0.766263] console [ttyS0] enabled
[ 0.771581] brd: module loaded
[ 0.774834] altera_ilc ff230000.ilc: Failed to register interrupt handler
[ 0.781634] altera_ilc ff230000.ilc: Failed to register interrupt handler
[ 0.788418] altera_ilc ff230000.ilc: Driver successfully loaded
[ 0.796364] libphy: Fixed MDIO Bus: probed
[ 0.801310] CAN device driver interface
[ 0.805522] socfpga-dwmac ff702000.ethernet: snps,phy-addr property is deprecated
[ 0.813151] stmmac - user ID: 0x10, Synopsys ID: 0x37
[ 0.818182] Ring mode enabled
[ 0.821237] DMA HW capability register supported[ 0.825749] Enhanced/Alternate descriptors
[ 0.829922] Enabled extended descriptors
[ 0.833913] RX Checksum Offload Engine supported
[ 0.838596] COE Type 2
[ 0.841040] TX Checksum insertion supported
[ 0.845290] Enable RX Mitigation via HW Watchdog Timer
[ 0.856614] libphy: stmmac: probed
[ 0.860049] eth0: PHY ID 00221622 at 1 IRQ POLL (stmmac-0:01) active
[ 0.866923] ffb40000.usb supply vusb_d not found, using dummy regulator
[ 0.873577] ffb40000.usb supply vusb_a not found, using dummy regulator
[ 0.880327] dwc2 ffb40000.usb: EPs: 16, dedicated fifos, 8064 entries in SPRAM
[ 0.887867] dwc2 ffb40000.usb: DWC OTG Controller
[ 0.892600] dwc2 ffb40000.usb: new USB bus registered, assigned bus number 1
[ 0.899660] dwc2 ffb40000.usb: irq
[ 0.989000] mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 400000Hz, actual 396825HZ div = 63)
[ 1.019146] dw_mmc ff704000.flash: 1 slots initialized
[ 1.024610] OF: /sopc#0/leds/fpga0: could not get #gpio-cells for /sopc#0/bridge#0xc0000000/leds#0x100000000
[ 1.034522] leds-gpio: probe of sopc#0:leds failed with error -22
[ 1.040771] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.046944] usbcore: registered new interface driver usbhid
[ 1.052514] usbhid: USB HID core driver
[ 1.056592] fpga_manager fpga0: Altera SOCFPGA FPGA Manager registered
[ 1.063805] altera_hps2fpga_bridge sopc#0:fpgabridge#0: fpga bridge [hps2fpga] registered
[ 1.072200] altera_hps2fpga_bridge sopc#0:fpgabridge#1: fpga bridge [lwhps2fpga] registered
[ 1.080687] altera_hps2fpga_bridge sopc#0:fpgabridge#2: fpga bridge [fpga2hps] registered
[ 1.089235] altera_fpga2sdram_bridge sopc#0:fpgabridge#3: fpga bridge [fpga2sdram] registered
[ 1.097728] altera_fpga2sdram_bridge sopc#0:fpgabridge#3: driver initialized with handoff 000001ff
[ 1.107005] oprofile: using arm/armv7-ca9
[ 1.111851] NET: Registered protocol family 10
[ 1.117061] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 1.123642] NET: Registered protocol family 17
[ 1.128087] NET: Registered protocol family 15
[ 1.132545] can: controller area network core (rev 20120528 abi 9)
[ 1.138755] NET: Registered protocol family 29
[ 1.143200] can: raw protocol (rev 20120528)
[ 1.147454] can: broadcast manager protocol (rev 20161123 t)
[ 1.153104] can: netlink gateway (rev 20130117) max_hops=1
[ 1.158791] 8021q: 802.1Q VLAN Support v1.8
[ 1.163021] Key type dns_resolver registered
[ 1.167350] ThumbEE CPU extension supported.
[ 1.171622] Registering SWP/SWPB emulation handler
[ 1.179767] hctosys: unable to open rtc device (rtc0)
[ 1.184823] of_cfs_init
[ 1.187332] of_cfs_init: OK
[ 1.190841] ttyS0 - failed to request DMA
[ 1.194993] Waiting for root device /dev/mmcblk0p2...
[ 1.238212] mmc0: Problem switching card into high-speed mode!
[ 1.244050] mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 25000000Hz, actual 25000000HZ div = 1)
[ 1.253817] mmc0: new SDHC card at address 0001
[ 1.258775] mmcblk0: mmc0:0001 ASTC 7.45 GiB
[ 1.265186] mmcblk0: p1 p2 p3
[ 1.320560] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
[ 1.350985] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 1.359101] VFS: Mounted root (ext4 filesystem) on device 179:2.
[ 1.366797] devtmpfs: error mounting -2
[ 1.373057] Freeing unused kernel memory: 1024K (c0a00000 - c0b00000)
[ 1.379834] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
[ 1.392908] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0-ge4c2b71c147d #1
[ 1.399924] Hardware name: Altera SOCFPGA
[ 1.403946] [<c0112004>] (unwind_backtrace) from [<c010cc88>] (show_stack+0x20/0x24)
[ 1.411671] [<c010cc88>] (show_stack) from [<c04255b8>] (dump_stack+0x90/0xa4)
[ 1.418874] [<c04255b8>] (dump_stack) from [<c01e9978>] (panic+0xec/0x258)
[ 1.425738] [<c01e9978>] (panic) from [<c0739004>] (kernel_init+0x10c/0x11c)
[ 1.432769] [<c0739004>] (kernel_init) from [<c0108478>] (ret_from_fork+0x14/0x3c)
[ 1.440309] CPU1: stopping
[ 1.443013] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.9.0-ge4c2b71c147d #1
[ 1.450029] Hardware name: Altera SOCFPGA
[ 1.454033] [<c0112004>] (unwind_backtrace) from [<c010cc88>] (show_stack+0x20/0x24)
[ 1.461749] [<c010cc88>] (show_stack) from [<c04255b8>] (dump_stack+0x90/0xa4)
[ 1.468947] [<c04255b8>] (dump_stack) from [<c0110604>] (handle_IPI+0x2e0/0x2fc)
[ 1.476316] [<c0110604>] (handle_IPI) from [<c0101544>] (gic_handle_irq+0x98/0x9c)
[ 1.483857] [<c0101544>] (gic_handle_irq) from [<c010d84c>] (__irq_svc+0x6c/0x90)
[ 1.491305] Exception stack(0xef11bf58 to 0xef11bfa0)
[ 1.496335] bf40: 00000000 000004c6
[ 1.504479] bf60: ef7da370 c011bca0 ffffe000 00000002 c0b0302c c0b0307c c0b13c83 00000001
[ 1.512622] bf80: c08c86ec ef11bfb4 ef11bfb8 ef11bfa8 c0108f44 c0108f48 60000013 ffffffff
[ 1.520771] [<c010d84c>] (__irq_svc) from [<c0108f48>] (arch_cpu_idle+0x48/0x4c)
[ 1.528142] [<c0108f48>] (arch_cpu_idle) from [<c073dd44>] (default_idle_call+0x30/0x3c)
[ 1.536205] [<c073dd44>] (default_idle_call) from [<c0164760>] (cpu_startup_entry+0xe8/0x148)
[ 1.544699] [<c0164760>] (cpu_startup_entry) from [<c01100a8>] (secondary_start_kernel+0x15c/0x164)
[ 1.553708] [<c01100a8>] (secondary_start_kernel) from [<0010194c>] (0x10194c)
[ 1.560906] ---[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
There was an error in mounting the ext4 partition of SD card. Rebuilding the Kernel and build root with right configuration solved the issue. (Enabled Support for large (2TB+) block devices and files).
I was looking to modify my GPIO driver for raspberry pi using device tree support.
First there were 2 files:
I read the device tree file in /arc/arm/boot/dts/bcm2835.dts
and for gpio following section was present:
gpio: gpio {
compatible = "brcm,bcm2835-gpio";
reg = <0x7e200000 0xb4>;
/*
* The GPIO IP block is designed for 3 banks of GPIOs.
* Each bank has a GPIO interrupt for itself.
* There is an overall "any bank" interrupt.
* In order, these are GIC interrupts 17, 18, 19, 20.
* Since the BCM2835 only has 2 banks, the 2nd bank
* interrupt output appears to be mirrored onto the
* 3rd bank's interrupt signal.
* So, a bank0 interrupt shows up on 17, 20, and
* a bank1 interrupt shows up on 18, 19, 20!
*/
interrupts = <2 17>, <2 18>, <2 19>, <2 20>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
};
From the references on the internet The reg = 0x7e200000 is understood but What is 0xb4.
I read the device tree file in /arch/arm/boot/dts/bcm2835-rpi-b.dts
and for gpio following section was present:
/ {
compatible = "raspberrypi,model-b", "brcm,bcm2835";
model = "Raspberry Pi Model B";
memory {
reg = <0 0x10000000>;
};
leds {
compatible = "gpio-leds";
act {
label = "ACT";
gpios = <&gpio 16 1>;
default-state = "keep";
linux,default-trigger = "heartbeat";
};
};
};
&gpio {
pinctrl-names = "default";
pinctrl-0 = <&alt0 &alt3>;
alt0: alt0 {
brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 14 15 40 45>;
brcm,function = <4>; /* alt0 */
};
alt3: alt3 {
brcm,pins = <48 49 50 51 52 53>;
brcm,function = <7>; /* alt3 */
};
};
So, Which one of the dts files should I use, and how to read and interpret those key value pairs, for eg: what is pinctrl. and how does this approach affect on my code.
I know I am asking a lot of stuff here, but this is new and looks interesting and I want to modify my driver using this approach. Please help.
PS: I have made a driver using the standard udev support. So dynamic device node creation is managed.
I am not using platform model.
1.
From the references on the internet The reg = 0x7e200000 is understood but What is 0xb4.
reg = <0x7e200000 0xb4>
Here 0xb4 refers to the length of the register.
"reg : Address and length of the register set for the device"
You can probably checkout this pdf for better info
http://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf
2.
So, Which one of the dts files should I use, and how to read and interpret those key value pairs,
I will split the question into two parts. For reading key value pairs:
Every Device tree entry would have an associated binding file that describes how you read the key value pairs.
For example http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/arm/bcm/brcm,bcm11351-cpu-method.txt . You can get the corresponding details .
Regarding which dts files should I use:
Now if u have noticed bcm2835.dtsi. is not a dts file but a dtsi file.
http://lxr.free-electrons.com/source/arch/arm/boot/dts/bcm2835.dtsi
dtsi files can be included into other dts or dtsi files just like we include other libraries like conio.h. or stdio.h in our C code.
Here bcm2835-rpi-b.dts is a dts file and if u notice the file here http://lxr.free-electrons.com/source/arch/arm/boot/dts/bcm2835-rpi-b.dts
it includes the following:
/include/ "bcm2835.dtsi"
This means that all the dt entries in bcm2835.dtsi is imported into bcm2835-rpi-b.dts.
You can choose to leave the nodes as is or modify the properties in rpi-b-dts, but the final entry made in dts file will be the one reflected in the dtb.
3.
for eg: what is pinctrl. and how does this approach affect on my code.
Pinctrl is framework provided in the kernel for accessing PIN's here gpio's. You can probably checkout the documentation used https://www.kernel.org/doc/Documentation/pinctrl.txt
We are using MT29F8G08ABABA in our DM365 based custom board.
We are using NAND boot.
RootFS is in UBIFS format,
Below is basic achitecture of the NAND.
I am using following commands to create ubifs,
$(UBIFS_PATH)/mkfs.ubifs -r $(TARGET_FS) -m 4096 -e 520192 -c 75 -o ubifs.img
$(UBIFS_PATH)/ubinize -o $(SYSTEM_CFG)_$(HARDWARE_CFG)_ubifs -m 4096 -p 512KiB $(HARDWARE_CFG)_ubinize.cfg
dm368_ubinize.cfg content is as follows,
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=37888KiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
Then i put this ubifs to NAND using following commands,
loady 0x82000000 ---> ubifs is loaded to RAM
nand scrub 0x1800000 0x2800000
nand erase 0x1800000 0x2800000
nand write 0x82000000 0x1800000 0x2800000
and when i boot the kernel there is error while detecting UBIFS from kernel,
Below is kernel log for the same,
[ 0.000000] Linux version 2.6[ 0.000000] Linux version 2.6.37_IPNC_DM368_5.1.0 (still-image#stillimage-VirtualBox) (gcc version 4.3.3 (GCC) ) #1 PREEMPT Sat Jan 4 11:09:29 IST 2014
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine: DaVinci DM36x IPNC
[ 0.000000] Memory policy: ECC disabled, Data cache writeback
[ 0.000000] DaVinci dm36x_rev1.2 variant 0x8
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 12192
[ 0.000000] Kernel command line: mem=48M console=ttyS0,115200n8 noinitrd ip=off rw ubi.mtd=3,4096 rootfstype=ubifs root=ubi0:rootfs cmemk.phys_start=0x83000000 cmemk.phys_end=0x88000000 cmemk.phys_start_1=0x00001000 cmemk.phys_end_1=0x00008000 cmemk.pools_1=1x28672 cmemk.allowOverlap=1 cmemk.useHeapIfPoolUnavailable=1 nohz=off highres=off clocksource=acpi_pm lpj=1077248
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Memory: 48MB = 48MB total
[ 0.000000] Memory: 44772k/44772k available, 4380k reserved, 0K highmem
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] DMA : 0xff000000 - 0xffe00000 ( 14 MB)
[ 0.000000] vmalloc : 0xc3800000 - 0xfea00000 ( 946 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc3000000 ( 48 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .init : 0xc0008000 - 0xc002c000 ( 144 kB)
[ 0.000000] .text : 0xc002c000 - 0xc0390000 (3472 kB)
[ 0.000000] .data : 0xc0390000 - 0xc03b6600 ( 154 kB)
[ 0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Preemptable hierarchical RCU implementation.
[ 0.000000] RCU-based detection of stalled CPUs is disabled.
[ 0.000000] Verbose stalled-CPUs detection is disabled.
[ 0.000000] NR_IRQS:245
[ 0.000000] Console: colour dummy device 80x30
[ 0.000407] Calibrating delay loop (skipped) preset value.. 215.44 BogoMIPS (lpj=1077248)
[ 0.000494] pid_max: default: 32768 minimum: 301
[ 0.000794] Security Framework initialized
[ 0.001001] Mount-cache hash table entries: 512
[ 0.002188] CPU: Testing write buffer coherency: ok
[ 0.004944] devtmpfs: initialized
[ 0.010877] DaVinci: 8 gpio irqs
[ 0.011931] NET: Registered protocol family 16
[ 0.066045] dm365_rmd_cs_rdk_150_wl_init
[ 0.066124] No entry for the specified index
[ 0.069960] No entry for the specified index
[ 0.192448] bio: create slab <bio-0> at 0
[ 0.199765] SCSI subsystem initialized
[ 0.206445] usbcore: registered new interface driver usbfs
[ 0.208607] usbcore: registered new interface driver hub
[ 0.210484] usbcore: registered new device driver usb
[ 0.215823] vpss vpss: dm365_vpss vpss probed
[ 0.215919] vpss vpss: dm365_vpss vpss probe success
[ 0.222681] Advanced Linux Sound Architecture Driver Version 1.0.23.
[ 0.228358] Switching to clocksource timer0_1
[ 0.356682] NET: Registered protocol family 2
[ 0.357150] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.358399] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.358604] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.358736] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.358784] TCP reno registered
[ 0.358845] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.358939] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.359791] NET: Registered protocol family 1
[ 0.466150] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.469156] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.474898] msgmni has been set to 87
[ 0.481735] io scheduler noop registered (default)
[ 0.484414] CSL: Module install successful, device major num = 254
[ 0.484478] CSL: Module version 0.10.00, built on Dec 13 2013 22:33:02
[ 0.484552] I2C: Module install successful, device major num = 253
[ 0.484609] DMA: Module install successful, device major num = 252
[ 0.484654] DRV: Module install successful
[ 0.484692] DRV: Module built on Dec 13 2013 22:33:04
[ 0.484733] DRV: EDMACC.QUEPRI = 00002777
[ 0.484769] DRV: SYSTEM.MSTPRI0 = 00440011
[ 0.484804] DRV: SYSTEM.MSTPRI1 = 00000444
[ 0.484839] DRV: ISP.BCR = 00000002
[ 0.484874] DRV: SYSTEM.MISC = 00000399
[ 0.484911] EDMAK module: built on Dec 13 2013 at 22:32:35
[ 0.484957] Reference Linux version 2.6.37
[ 0.484996] File /opt/workdir/OV9715_Ver5_0/dvsdk_ipnctools/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/edma/src/module/edmak.c
[ 0.487539] IRQK module: built on Dec 13 2013 at 22:32:33
[ 0.487612] Reference Linux version 2.6.37
[ 0.487653] File /opt/workdir/OV9715_Ver5_0/dvsdk_ipnctools/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/irq/src/module/irqk.c
[ 0.490558] irqk initialized
[ 0.490663] CMEMK module: built on Dec 13 2013 at 22:32:30
[ 0.490723] Reference Linux version 2.6.37
[ 0.490762] File /opt/workdir/OV9715_Ver5_0/dvsdk_ipnctools/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c
[ 0.498082] allocated heap buffer 0xc4000000 of size 0x5000000
[ 0.498145] heap fallback enabled - will try heap if pool buffer is not available
[ 0.498205] CMEM Range Overlaps Kernel Physical - allowing overlap
[ 0.498257] CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x83000000)
[ 0.498473] cmemk initialized
[ 0.498551] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[ 0.611337] serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A
[ 1.137052] console [ttyS0] enabled
[ 1.211160] serial8250.0: ttyS1 at MMIO 0x1d06000 (irq = 41) is a 16550A
[ 1.254825] brd: module loaded
[ 1.272762] NAND device: Manufacturer ID: 0x2c, Chip ID: 0x38 (Micron )
[ 1.281908] Bad block table not found for chip 0
[ 1.287959] Bad block table not found for chip 0
[ 1.292787] Scanning device for bad blocks
[ 1.729485] Creating 7 MTD partitions on "davinci_nand.0":
[ 1.735177] 0x000000000000-0x000000c00000 : "bootloader"
[ 1.748031] 0x000000c00000-0x000001400000 : "params"
[ 1.760990] 0x000001400000-0x000001800000 : "kernel"
[ 1.773829] 0x000001800000-0x000004000000 : "filesystem1"
[ 1.787411] 0x000004000000-0x000004800000 : "data1"
[ 1.800510] 0x000004800000-0x000007000000 : "filesystem2"
[ 1.813667] 0x000007000000-0x000040000000 : "data2"
[ 1.828113] davinci_nand davinci_nand.0: controller rev. 2.3
[ 1.839036] UBI: attaching mtd3 to ubi0
[ 1.843400] UBI: physical eraseblock size: 262144 bytes (256 KiB)
[ 1.849714] UBI: logical eraseblock size: 256000 bytes
[ 1.855391] UBI: smallest flash I/O unit: 2048
[ 1.860292] UBI: sub-page size: 512
[ 1.864953] UBI: VID header offset: 4096 (aligned 4096)
[ 1.871094] UBI: data offset: 6144
[ 1.877230] UBI error: validate_ec_hdr: bad data offset 8192, expected 6144
[ 1.884383] UBI error: validate_ec_hdr: bad EC header
[ 1.889484] UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0
[ 1.896907] UBI error: ubi_init: cannot attach mtd3
[ 1.905311] spi_davinci spi_davinci.0: Controller at 0xfec66000
[ 1.970163] davinci_mdio davinci_mdio.0: davinci mdio revision 1.4
[ 1.976404] davinci_mdio davinci_mdio.0: no live phy, scanning all
[ 1.983779] davinci_mdio: probe of davinci_mdio.0 failed with error -5
[ 1.993145] i2c /dev entries driver
[ 2.000461] Linux media interface: v0.10
[ 2.005482] Linux video capture interface: v2.00
[ 2.013867] vpbe-osd vpbe-osd: OSD sub device probe success
[ 2.021111] vpbe-venc vpbe-venc: VENC sub device probe success
[ 2.028379] vpbe-v4l2 vpbe-v4l2: vpbe v4l2 device registered
[ 2.034923] Setting default output to Composite
[ 2.039507] Setting default mode to ntsc
[ 2.043823] vpbe-v4l2 vpbe-v4l2: Trying to register VPBE display device.
[ 2.050741] vpbe-v4l2 vpbe-v4l2: layer=c2989a00,layer->video_dev=c2989ae8
[ 2.059118] vpbe-v4l2 vpbe-v4l2: Trying to register VPBE display device.
[ 2.066191] vpbe-v4l2 vpbe-v4l2: layer=c2989c00,layer->video_dev=c2989ce8
[ 2.076313] watchdog watchdog: heartbeat 60 sec
[ 2.090661] Error: Driver 'davinci-mcbsp' is already registered, aborting...
[ 2.102840] asoc: cq93vc-hifi <-> davinci-vcif mapping ok
[ 2.115028] ALSA device list:
[ 2.118092] #0: DaVinci DM365 EVM
[ 2.123853] nf_conntrack version 0.5.0 (699 buckets, 2796 max)
[ 2.133076] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 2.138907] TCP cubic registered
[ 2.142616] NET: Registered protocol family 17
[ 2.163517] UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:rootfs", error -19
[ 2.171615] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
[ 2.178710] Please append a correct "root=" boot option; here are the available partitions:
[ 2.187357] 1f00 12288 mtdblock0 (driver?)
[ 2.192678] 1f01 8192 mtdblock1 (driver?)
[ 2.197807] 1f02 4096 mtdblock2 (driver?)
[ 2.203056] 1f03 40960 mtdblock3 (driver?)
[ 2.208184] 1f04 8192 mtdblock4 (driver?)
[ 2.213414] 1f05 40960 mtdblock5 (driver?)
[ 2.218542] 1f06 933888 mtdblock6 (driver?)
[ 2.223740] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 2.232105] Backtrace:
[ 2.234600] Function entered at [<c0030504>] from [<c030ec74>]
[ 2.240524] r7:00008000 r6:c2813000 r5:c00263ec r4:c03b6e00
[ 2.246275] Function entered at [<c030ec5c>] from [<c030ecd4>]
[ 2.252188] Function entered at [<c030ec78>] from [<c0008fdc>]
[ 2.258049] r3:00000000 r2:c2824000 r1:c2825f78 r0:c0331f90
[ 2.263847] Function entered at [<c0008d78>] from [<c0009134>]
[ 2.269707] Function entered at [<c00090a0>] from [<c00084b4>]
[ 2.275614] r5:c002597c r4:c03b6618
[ 2.279248] Function entered at [<c00083a4>] from [<c0046a58>]
[ 2.285156] r5:c00083a4 r4:00000000
Now my doubt is why kernel is reporting physical eraseblock size as 256KiB? from architecture of NAND it looks to be 512KiB.
Any suggestions/pointer for the errors ?
Thank you in advance
As i have mentioned in above answer,
I was not able to create a file or folder because filesystem size and partitions size was same.
So i increased the partition size to 128MB(nand_partition in kernel) and i recreated the UBIFS. I flashed the new kernel and UBIFS in NAND.
And it started working, now i am able to create folder and/or file anywhere in the root file system.
I used below commands to create ubifs,
$(UBIFS_PATH)/mkfs.ubifs -r $(TARGET_FS) -m 2048 -e 258048 -c 506 -o ubifs.img
$(UBIFS_PATH)/ubinize -o $(SYSTEM_CFG)_$(HARDWARE_CFG)_ubifs -m 2048 -p 256KiB -O 2048 $(HARDWARE_CFG)_ubinize.cfg
content of ubinize.cfg is as follows,
[ubifs]
peb=0x40000
min_io_size=0x800
compress_type=zlib
mode=ubi
image=ubifs.img
vol_id=0
vol_size=124MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
Some calculations which will help understand
For 256Kib and pagesize 2048
Symbol Meaning Value for 128MB fs
SP PEB Size 256KiB
SL LEB Size 256kib - 2* 2kiB = 252Kib
P Total number of PEBs on the MTD device 128MiB / 256KiB = 512
B Number of PEBs reserved for bad PEB handling 1% of P = 5
O The overhead related to storing EC and VID headers in bytes, i.e. O = SP - SL 4KiB
UBI Overhead = (B + 4) * SP + O * (P - B - 4)
= (5 + 4) * 256Kib + 4 KiB * (512 - 5 - 4)
= 2304Kib + 2012Kib
= 4316 KiB
= 16.859375 PEBs (round to 17)
512 - 17 = 498 peb = 498*256kiB PEBS = 127488KiB availble for user data
we have to use -c <X> where x = 127488Kib / 252kib = 505.9 = 506
Hope this helps someone facing the similar issue.
PEB size (physical erase block) I think needs configuring as part of the ubinize config file, try adding something like this to the file:
[flash]
peb=0x20000
min_io_size=0x800
compress_type=zlib
(I've got a PEB size of 128KiB, so you'll need to change accordingly).
Also you might find UBIFS MTD pages useful - there's a question about bad VID header offset.
Hope this helps.