[bootlin/training-materials updates] master: slides/kernel-hw-devices: Explain address/size-cells properties (4228be25)

Miquel Raynal miquel.raynal at bootlin.com
Fri Mar 17 15:34:05 CET 2023


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/4228be2550aa76d3f9b1ec48caa5d45dbb6008e3

>---------------------------------------------------------------

commit 4228be2550aa76d3f9b1ec48caa5d45dbb6008e3
Author: Miquel Raynal <miquel.raynal at bootlin.com>
Date:   Fri Mar 17 09:28:29 2023 +0100

    slides/kernel-hw-devices: Explain address/size-cells properties
    
    Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>


>---------------------------------------------------------------

4228be2550aa76d3f9b1ec48caa5d45dbb6008e3
 slides/kernel-hw-devices/kernel-hw-devices.tex | 71 ++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/slides/kernel-hw-devices/kernel-hw-devices.tex b/slides/kernel-hw-devices/kernel-hw-devices.tex
index a3ce9747..04acf0df 100644
--- a/slides/kernel-hw-devices/kernel-hw-devices.tex
+++ b/slides/kernel-hw-devices/kernel-hw-devices.tex
@@ -910,6 +910,77 @@ sai4: sai at 50027000 {
   \end{itemize}
 \end{frame}
 
+\begin{frame}[fragile]{Property {\tt cells}}
+  \begin{itemize}
+  \item Property numbers shall fit into 32-bit containers called
+    \code{cells}
+  \item The compiler does not maintain information about the number of
+    entries, the OS just receives 4 independent \code{cells}
+    \begin{itemize}
+      \begin{onlyenv}<1>
+      \item Example with a \code{reg} property using 2 entries of 2 cells:
+        \begin{block}{}
+\begin{verbatim}
+    reg = <0x50027000 0x4>, <0x500273f0 0x10>;
+\end{verbatim}
+        \end{block}
+      \item The OS cannot make the difference with:
+        \begin{block}{}
+\begin{verbatim}
+    reg = <0x50027000>, <0x4>, <0x500273f0>, <0x10>;
+    reg = <0x50027000 0x4 0x500273f0>, <0x10>;
+    reg = <0x50027000>, <0x4 0x500273f0 0x10>;
+    reg = <0x50027000 0x4 0x500273f0 0x10>;
+\end{verbatim}
+        \end{block}
+      \end{onlyenv}
+    \end{itemize}
+    \pause
+  \item Need for other properties to declare the right formatting:
+    \begin{itemize}
+    \item {\tt \#address-cells}: Indicates the number of cells
+      used to carry the address
+    \item {\tt \#size-cells}: Indicates the number of cells
+      used to carry the size of the range
+    \end{itemize}
+  \item The parent-node declares the children \code{reg} property
+    formatting
+    \begin{itemize}
+    \item Platform devices need memory ranges
+      \begin{onlyenv}<2>
+        \begin{block}{}
+\begin{verbatim}
+module at a0000 {
+    #address-cells = <1>;
+    #size-cells = <1>;
+
+    serial at 1000 {
+        reg = <0x1000 0x10>, <0x2000 0x10>;
+    };
+};
+\end{verbatim}
+        \end{block}
+      \end{onlyenv}
+      \pause
+    \item SPI devices need chip-selects
+      \begin{onlyenv}<3>
+        \begin{block}{}
+\begin{verbatim}
+spi at 300000 {
+    #address-cells = <1>;
+    #size-cells = <0>;
+
+    flash at 1 {
+        reg = <1>;
+    };
+};
+\end{verbatim}
+        \end{block}
+      \end{onlyenv}
+    \end{itemize}
+  \end{itemize}
+\end{frame}
+
 \begin{frame}{Status property}
   \begin{itemize}
   \item The \code{status} property indicates if the device is really in




More information about the training-materials-updates mailing list