• G
    serial: sh-sci: Add support for dynamic instances · 7678f4c2
    Geert Uytterhoeven 提交于
    On DT platforms, the sh-sci driver requires the presence of "serialN"
    aliases in DT, from which instance IDs are derived.  If a DT alias is
    missing, the drivers fails to probe the corresponding serial port.
    
    This becomes cumbersome when considering DT overlays, as currently
    there is no upstream support for dynamically updating the /aliases node
    in DT.  Furthermore, even in the presence of such support, hardcoded
    instance IDs in independent overlays are prone to conflicts.
    
    Hence add support for dynamic instance IDs, to be used in the absence of
    a DT alias.  This makes serial ports behave similar to I2C and SPI
    buses, which already support dynamic instances.
    
    Ports in use are tracked using a simple bitmask of type unsigned long,
    which is sufficient to handle all current hardware (max. 18 ports).
    The maximum number of serial ports is still fixed, and configurable
    through Kconfig.  Range validation is done through both Kconfig and a
    compile-time check.
    
    Due to the fixed maximum number of serial ports, dynamic and static
    instances share the same ID space.  Static instances added later are
    rejected when conflicting with dynamic instances registered earlier.
    Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    7678f4c2
sh-sci.c 80.7 KB