ARM DTS query for TI based SoC - linux-kernel

I am going through TI based evm dts file.
http://elixir.free-electrons.com/linux/latest/source/arch/arm/boot/dts/dra7-evm.dts#L686
&atl {
assigned-clocks = <&abe_dpll_sys_clk_mux>,
<&atl_gfclk_mux>,
<&dpll_abe_ck>,
<&dpll_abe_m2x2_ck>,
<&atl_clkin2_ck>;
assigned-clock-parents = <&sys_clkin2>, <&dpll_abe_m2_ck>;
assigned-clock-rates = <0>, <0>, <180633600>, <361267200>, <5644800>;
status = "okay";
atl2 {
bws = <DRA7_ATL_WS_MCASP2_FSX>;
aws = <DRA7_ATL_WS_MCASP3_FSX>;
};
};
&mcasp3 {
#sound-dai-cells = <0>;
assigned-clocks = <&mcasp3_ahclkx_mux>;
assigned-clock-parents = <&atl_clkin2_ck>;
status = "okay";
op-mode = <0>; /* MCASP_IIS_MODE */
tdm-slots = <2>;
/* 4 serializer */
serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
1 2 0 0
>;
tx-num-evt = <32>;
rx-num-evt = <32>;
};
assigned-clocks contains a handle to <&mcasp3_ahclkx_mux> and this clock "&mcasp3_ahclkx_mux>" is defined in "dra7xx-clocks.dtsi"
http://elixir.free-electrons.com/linux/latest/source/arch/arm/boot/dts/dra7xx-clocks.dtsi#L1814
But could not find how this" dra7xx-clocks.dtsi" has included into "dra7-evm.dtsi" ?
Can any please point me out how definition of mcasp3_ahclkx_mux is provided into dra7-evm.dts ?

But could not find how this" dra7xx-clocks.dtsi" has included into "dra7-evm.dtsi" ?
dra7-evm.dts has included dra74x.dtsi which includes dra7.dtsi, and dra7xx-clocks.dtsi is included in dra7.dtsi at the end.

Related

Error with the message "Cannot cast (inet::physicallayer::Ieee80211DimensionalTransmission*) to type 'const inet::physicallayer::IScalarSignal *'"

I use Omnet++ and Inet 4.4, I want to simulate a scenario to investigate the effect of interference, which is as follows:
In a network consisting of two pairs of nodes including a node called source and a node called destination, in which node source sends packets to node destination and is tuned in channel 2 of Ieee802.11b/g, let's examine the second pair consisting of node Node1 and node Node2, which node Node1 sends packets to node Node 4 and is tuned in channel 4.
But recently a problem appear very often and the simulations are stopped, the error is this:
check_and_cast(): Cannot cast (inet::physicallayer::Ieee80211DimensionalTransmission*) to type 'const inet::physicallayer::IScalarSignal *' -- in module (inet::physicallayer::Ieee80211Radio) AnalogModelShowcaseDistanceNetworkRM.source.wlan[1].radio (id=200), at t=0.001s, event #24
My omnetpp.ini is as:
[Config Distance]
network = AnalogModelShowcaseDistanceNetworkRM
sim-time-limit = 5s
# Maryam **.radio.packetErrorRate.result-recording-modes = +vector
# Maryam **.radio.bitErrorRate.result-recording-modes = +vector
# application parameters
*.source.numApps = 1
*.source.app[0].typename = "UdpBasicApp"
*.source.app[*].destAddresses = "destination"
*.source.app[*].destPort = 1000
*.source.app[*].messageLength = 1000byte
*.source.app[*].sendInterval = 1ms
*.destination.numApps = 1
*.destination.app[0].typename = "UdpSink"
*.destination.app[*].localPort = 1000
*.Node1.numApps = 1
*.Node1.app[0].typename = "UdpBasicApp"
*.Node1.app[*].destAddresses = "Node2"
*.Node1.app[*].destPort = 1001
*.Node1.app[*].messageLength = 1000byte
*.Node1.app[*].sendInterval = 1ms
*.Node2.numApps = 1
*.Node2.app[0].typename = "UdpSink"
*.Node2.app[*].localPort = 1001
*.source.numWlanInterfaces = 2
*.destination.numWlanInterfaces = 2
*.Node1.numWlanInterfaces = 2
*.Node2.numWlanInterfaces = 2
*.source.wlan[*].radio.typename = "Ieee80211DimensionalRadio"
*.destination.wlan[*].radio.typename = "Ieee80211DimensionalRadio"
*.Node*.wlan[*].radio.typename = "Ieee80211DimensionalRadio"
*.source.wlan[*].radio.centerFrequency = 2.412GHz
*.source.wlan[*].radio.bandwidth = 2MHz
*.source.wlan[*].radio.transmitter.power = 2mW
*.source.wlan[*].radio.transmitter.bitrate = 2Mbps
*.source.wlan[*].radio.transmitter.preambleDuration = 0s
*.source.wlan[*].radio.transmitter.headerLength = 96b
*.source.wlan[*].radio.transmitter.modulation = "BPSK"
*.source.wlan[*].radio.receiver.sensitivity = -85dBm
*.source.wlan[*].radio.receiver.energyDetection = -85dBm
*.source.wlan[*].radio.receiver.snirThreshold = 4dB
*.destination.wlan[*].radio.centerFrequency = 2.412GHz
*.destination.wlan[*].radio.bandwidth = 2MHz
*.destination.wlan[*].radio.transmitter.power = 2mW
*.destination.wlan[*].radio.transmitter.bitrate = 2Mbps
*.destination.wlan[*].radio.transmitter.preambleDuration = 0s
*.destination.wlan[*].radio.transmitter.headerLength = 96b
*.destination.wlan[*].radio.transmitter.modulation = "BPSK"
*.destination.wlan[*].radio.receiver.sensitivity = -85dBm
*.destination.wlan[*].radio.receiver.energyDetection = -85dBm
*.destination.wlan[*].radio.receiver.snirThreshold = 4dB
*.Node*.wlan[*].radio.centerFrequency = 2.412GHz
*.Node*.wlan[*].radio.bandwidth = 2MHz
*.Node*.wlan[*].radio.transmitter.power = 2mW
*.Node*.wlan[*].radio.transmitter.bitrate = 2Mbps
*.Node*.wlan[*].radio.transmitter.preambleDuration = 0s
*.Node*.wlan[*].radio.transmitter.headerLength = 96b
*.Node*.wlan[*].radio.transmitter.modulation = "BPSK"
*.Node*.wlan[*].radio.receiver.sensitivity = -85dBm
*.Node*.wlan[*].radio.receiver.energyDetection = -85dBm
*.Node*.wlan[*].radio.receiver.snirThreshold = 4dB
*.source.wlan[0].radio.channelNumber = 2
*.destination.wlan[0].radio.channelNumber = 2
*.Node1.wlan[0].radio.channelNumber = 4
*.Node2.wlan[0].radio.channelNumber = 4
# mobility parameters
*.destination.mobility.typename = "LinearMobility"
*.destination.mobility.initialMovementHeading = 0deg
*.destination.mobility.speed = 200mps
*.destination.mobility.constraintAreaMinX = 500m
*.destination.mobility.constraintAreaMaxX = 1200m
# wlan
*.source.**.transmitter.power = 12mW
*.source.**.displayCommunicationRange = true
**.backgroundNoise.power = -105dBm
**.wlan*.mac.*.rateSelection.dataFrameBitrate = 54Mbps
**.wlan*.mac.dcf.channelAccess.pendingQueue.packetCapacity = 14
# visualizer parameters
*.visualizer.*.numStatisticVisualizers = 2
*.visualizer.*.statisticVisualizer[0].signalName = "packetSentToUpper"
*.visualizer.*.statisticVisualizer[0].statisticExpression = "packetErrorRate"
*.visualizer.*.statisticVisualizer[0].sourceFilter = "*.destination.wlan[*].radio"
*.visualizer.*.statisticVisualizer[0].format = "packetErrorRate(Maryam): %v"
*.visualizer.*.statisticVisualizer[1].signalName = "packetSentToUpper"
*.visualizer.*.statisticVisualizer[1].statisticExpression = "minimumSnir"
*.visualizer.*.statisticVisualizer[1].sourceFilter = "*.destination.wlan[*].radio"
*.visualizer.*.statisticVisualizer[1].format = "SNIR(Maryam): %v"
*.visualizer.*.statisticVisualizer[1].placementHint = "topLeft"
*.visualizer.*.dataLinkVisualizer[0].displayLinks = true
*.visualizer.*.packetDropVisualizer[0].displayPacketDrops = true
*.visualizer.*.packetDropVisualizer[0].nodeFilter = "destination"
*.visualizer.*.packetDropVisualizer[0].labelFormat = "(Maryam) %r"
*.visualizer.*.infoVisualizer[0].displayInfos = true
*.visualizer.*.infoVisualizer[0].modules = "*.destination.app[0]"
How do I solve this?
You need to set the radioMedium type to dimensional as well
radioMedium: Ieee80211DimensionalRadioMedium {
parameters:
#display("p=62.247997,287.14398");
}
In the NED file.

Device tree phandle hex to reference node

Is it possible to derive the reference node from a phandle?
For example, my RPI 4 has this:
mmcnr#7e300000 {
compatible = "brcm,bcm2835-mmc\0brcm,bcm2835-sdhci";
reg = <0x7e300000 0x100>;
interrupts = <0x00 0x7e 0x04>;
clocks = <0x07 0x1c>;
dmas = <0x0b 0x0b>;
dma-names = "rx-tx";
brcm,overclock-50 = <0x00>;
non-removable;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <0x1f>;
bus-width = <0x04>;
phandle = <0x38>;
};
How do I know what node 0x38 is?
You can iterate through all the nodes using of_find_all_nodes() starting by passing parameter to this function as NULL. This function returns device_node .. You can compare the returned device_node->phandle with 0x38, if it matches. That is the node

Get device tree node properties from tty_struct structure

Is it possible to get device tree node properties of a tty device from its tty_struct structure?
The goal would be to retrieve some custom properties of the serial port from the device tree and use them in a line discipline that I'm going to link to the serial port.
This is the device tree node of the uart I'm using.
uart2: serial#021e8000 {
compatible = "fsl,imx6q-uart", "fsl,imx21-uart";
reg = <0x021e8000 0x4000>;
interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6QDL_CLK_UART_IPG>,
<&clks IMX6QDL_CLK_UART_SERIAL>;
clock-names = "ipg", "per";
dmas = <&sdma 27 4 0>, <&sdma 28 4 0>;
dma-names = "rx", "tx";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart2>;
status = "okay";
master = <0>;
baudrate = 9600;
};
This is part of the c code in the line discipline I'm working on.
static struct tty_ldisc_ops my_ldisc = {
.owner = THIS_MODULE,
.magic = TTY_LDISC_MAGIC,
.name = "custom_ldisc",
.open = my_ldisc_open,
...
};
static int my_ldisc_open(struct tty_struct *tty)
{
// here I would like to access "master" and
// "baudrate" properties
}
Using ldattach on ttymxc1 (tty device on uart2) with my_ldisc as discipline,
my_ldisc_open() is called, but the parameter *tty seems to have no references
to the uart2 device tree node.

Getting the disk signature as negative

import wmi
wmi_connector = wmi.WMI()
def get_win_drive_mappings_locally(drivemappings):
for physical_disk in wmi_connector.Win32_DiskDrive():
for partition in physical_disk.associators("Win32_DiskDriveToDiskPartition"):
for logical_disk in partition.associators("Win32_LogicalDiskToPartition"):
print (physical_disk.Signature)
I am using wmi to get information of disks and signature.
when i print the instance of physical_disk the output is as below:
instance of Win32_DiskDrive
{
BytesPerSector = 512;
Capabilities = {3, 4};
CapabilityDescriptions = {"Random Access", "Supports Writing"};
Caption = "XXXXX SCSI Disk Device";
ConfigManagerErrorCode = 0;
ConfigManagerUserConfig = FALSE;
CreationClassName = "Win32_DiskDrive";
Description = "Disk drive";
DeviceID = "\\\\.\\PHYSICALDRIVE1";
FirmwareRevision = "0 ";
Index = 1;
InterfaceType = "SCSI";
Manufacturer = "(Standard disk drives)";
MediaLoaded = TRUE;
MediaType = "Fixed hard disk media";
Model = "XXXX SCSI Disk Device";
Name = "\\\\.\\PHYSICALDRIVE1";
Partitions = 1;
PNPDeviceID = "SCSI\\DISK&XXXXX&PROD_K\\4&5393C0A&0&000100";
SCSIBus = 0;
SCSILogicalUnit = 0;
SCSIPort = 2;
SCSITargetId = 1;
SectorsPerTrack = 63;
SerialNumber = "XXXXX";
Signature = **3908409726**;
Size = "107372805120";
Status = "OK";
SystemCreationClassName = "Win32_ComputerSystem";
SystemName = "SQLSERVER";
TotalCylinders = "13054";
TotalHeads = 255;
TotalSectors = "209712510";
TotalTracks = "3328770";
TracksPerCylinder = 255;
};
But when i print physical_disk.Signature the output is:
-386557570, i am not able to understand where its going wrong,expected output is 3908409726
-386557570 is indeed 3908409726 interpreted as a 32 bit signed integer (in 2's complement arithmetic); probably the Python WMI connector interprets all 32 bit values as signed.
To interpret it as an unsigned value, check if it's negative, and in that case add 1<<32.
def as_uint32(v):
if v<0:
return v + (1<<32)
return v
# ...
print (as_uint32(physical_disk.Signature))

What is the meaning of a phandle when used as device tree node name?

This code snippet comes from the device tree for the RIoTBoard (/arch/arm/boot/dts/imx6dl-riotboard.dts)
&hdmi {
ddc-i2c-bus = <&i2c2>;
status = "okay";
};
I have gone through the device tree documentation both on devicetree.org and in the documentation/devicetree folder of the linux kernel, but I am not able to find any description of the meaning of a phandle when used as node name.
You can understand phandle as some kind of pointer for the node which points to the definition of that node which is either kept in the same file or the other file.
I can explain phandle concept taking example from the below link for AM33xx SoC
clocks file:
http://lxr.free-electrons.com/source/arch/arm/boot/dts/am33xx-clocks.dtsi
Below is the functional clock for watchdog:
wdt1_fck: wdt1_fck {
#clock-cells = <0>;
compatible = "ti,mux-clock";
clocks = <&clk_rc32k_ck>, <&clkdiv32k_ick>;
reg = <0x0538>;
};
Now wdt1_fck has two parent clocks sources: clk_rc32k_ck and clkdiv32k_ick
These are phandles or you can say pointers to their clock definitions:
clk_rc32k_ck: clk_rc32k_ck {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <32000>;
};
clkdiv32k_ick: clkdiv32k_ick {
#clock-cells = <0>;
compatible = "ti,gate-clock";
clocks = <&clkdiv32k_ck>;
ti,bit-shift = <1>;
reg = <0x014c>;
};
So basically phandle enables to use the definitions of nodes across the files.
I'll answer with a example:
label:node {
#address-cell = <1>;
#size-cells = <0>;
}
&label {
proporties = <2>;
};
Means:
label:node {
#address-cell = <1>;
#size-cells = <0>;
proporties = <2>;
}
I think the question is more about the &hdmi part of the example, using an & reference for a node name in particular. The & in device tree files has two meanings: one for items in an array, and another for items outside an array.
In an array, the & reference will expand to a phandle.
Outside an arry, the & reference will expand to the path of the node you're referring to.
More information is available here:
https://elinux.org/Device_Tree_Mysteries#Labels
https://elinux.org/Device_Tree_Mysteries#Label_as_a_phandle_vs_Label_as_a_path

Resources