Changes between Version 2 and Version 3 of FlattenedDeviceTree


Ignore:
Timestamp:
Oct 28, 2009, 11:11:30 AM (15 years ago)
Author:
Nicolas Pouillon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FlattenedDeviceTree

    v2 v3  
    2020 * The Linux kernel documentation tree contains [http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=Documentation/powerpc/booting-without-of.txt;h=79f533f38c6112d64bed9398c44d31cf3b552f6b;hb=HEAD an useful document] about device trees (`Documentation/powerpc/booting-without-of.txt`)
    2121
    22 = Implementation and example =
     22= Implementation =
    2323
    2424In MutekH, FDT is handled through an hardware enumerator device driver, it behaves like the other enumerators (PCI, ISAPnP).
    25 
    26 Drivers may export themselves as FDT-aware, and define which device name string to match. For instance, the following subtree defines a tty device:
    27 
    28 {{{
    29         tty@0 {
    30             device_type = "soclib:tty";
    31                 tty_count = <1>;
    32                 reg = <0x90600000 0x10>;
    33                 icudev = &{/icu@0};
    34                 irq = <1>;
    35         };
    36 }}}
    37 
    38 In turn, the SoCLib tty driver declares itself (in source:trunk/mutekh/drivers/device/char/tty-soclib/tty-soclib.c#L146) as:
    39 
    40 {{{
    41 static const struct devenum_ident_s     tty_soclib_ids[] =
    42 {
    43         DEVENUM_FDTNAME_ENTRY("soclib:tty", 0, 0),
    44         { 0 }
    45 };
    46 
    47 const struct driver_s   tty_soclib_drv =
    48 {
    49   .class                = device_class_char,
    50   .id_table             = tty_soclib_ids,
    51   .f_init               = tty_soclib_init,
    52   .f_cleanup            = tty_soclib_cleanup,
    53   .f_irq                = tty_soclib_irq,
    54   .f.chr = {
    55     .f_request          = tty_soclib_request,
    56   }
    57 };
    58 }}}
    59 
    60 This will make the FDT enumerator use the correct driver, matching `"soclib:tty"`
    6125
    6226= MutekH-Specific Node syntax quick reference =
     
    148112 `PARAM_DATATYPE_BOOL`::
    149113   a simple boolean, i.e. a property with no value, if present it is true, if absent it is false (like the `cached` attribute in memory nodes)
     114
     115= Example =
     116
     117Drivers may export themselves as FDT-aware, and define which device name string to match. For instance, the following subtree defines a tty device:
     118
     119{{{
     120        tty@0 {
     121            device_type = "soclib:tty";
     122                tty_count = <1>;
     123                reg = <0x90600000 0x10>;
     124                icudev = &{/icu@0};
     125                irq = <1>;
     126        };
     127}}}
     128
     129In turn, the SoCLib tty driver declares itself (in source:trunk/mutekh/drivers/device/char/tty-soclib/tty-soclib.c#L146) as:
     130
     131{{{
     132static const struct devenum_ident_s     tty_soclib_ids[] =
     133{
     134        DEVENUM_FDTNAME_ENTRY("soclib:tty", 0, 0),
     135        { 0 }
     136};
     137
     138const struct driver_s   tty_soclib_drv =
     139{
     140  .class                = device_class_char,
     141  .id_table             = tty_soclib_ids,
     142  .f_init               = tty_soclib_init,
     143  .f_cleanup            = tty_soclib_cleanup,
     144  .f_irq                = tty_soclib_irq,
     145  .f.chr = {
     146    .f_request          = tty_soclib_request,
     147  }
     148};
     149}}}
     150
     151This will make the FDT enumerator use the correct driver, matching `"soclib:tty"`