19 Jul, 2019

19 commits

  • Writing/updating boot image in nand device is not
    straight forward in i.MX6 platform and it requires
    boot control block(BCB) to be configured.

    It becomes difficult to use uboot 'nand' command to
    write BCB since it requires platform specific attributes
    need to be taken care of.

    It is even difficult to use existing msx-nand.c driver by
    incorporating BCB attributes like mxs_dma_desc does
    because it requires change in mtd and nand command.

    So, cmd_nandbcb implemented in arch/arm/mach-imx

    BCB contains two data structures, Firmware Configuration Block(FCB)
    and Discovered Bad Block Table(DBBT). FCB has nand timings,
    DBBT search area, page address of firmware.

    On summary, nandbcb update will
    - erase the entire partition
    - create BCB by creating 2 FCB/DBBT block followed by
    1 FW block based on partition size and erasesize.
    - fill FCB/DBBT structures
    - write FW/SPL on FW1
    - write FCB/DBBT in first 2 blocks

    for nand boot, up on reset bootrom look for FCB structure in
    first block's if FCB found the nand timings are loaded for
    further reads. once FCB read done, DTTB will load and finally
    firmware will be loaded which is boot image.

    Refer section "NAND Boot" from doc/imx/common/imx6.txt for more usage
    information.

    Reviewed-by: Stefano Babic
    Signed-off-by: Jagan Teki
    Signed-off-by: Sergey Kubushyn
    Signed-off-by: Shyam Saini

    Shyam Saini
     
  • The clock subsystem needs active maintenance as it steadily grows.
    I do offer my help for this task.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     
  • Enable by default the Common Clock Framework [CCF] clock code for sandbox.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     
  • This patch provides code to implement the CCF clock tree in sandbox. It
    uses all the introduced primitives; some generic ones are reused, some
    sandbox specific were developed.

    In that way (after introducing the real CCF tree in sandbox) the recently
    added to clk-uclass.c: clk_get_by_id() and clk_get_parent_rate() are tested
    in their natural work environment.

    Usage (sandbox_defconfig and sandbox_flattree_defconfig):
    ./u-boot --fdt arch/sandbox/dts/test.dtb --command "ut dm clk_ccf"

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     
  • The generic mux clock code for CCF requires reading the clock multiplexer
    value from HW registers. As sandbox by design has readl() as no-op it was
    necessary to provide this value in the other way.

    The new field in the mux structure (accessible only when sandbox is run)
    has been introduced for this purpose.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     
  • The generic divider clock code for CCF requires reading the divider value
    from HW registers. As sandbox by design has readl() as no-op it was
    necessary to provide this value in the other way.

    The new field in the divider structure (accessible only when sandbox is
    run) has been introduced for this purpose.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     
  • This patch adds the 'osc' fixed clock to facilitate the CCF testing in
    the sandbox U-Boot. It is a starting point for building CCF hierarchy of
    clocks.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     
  • If the CLK_GET_RATE_NOCACHE flag is set - the clk_get_parent_rate()
    provides recalculated clock value without considering the cache setting.

    This may be necessary for some clocks tightly coupled with power domains
    (i.e. imx8), and prevents from reading invalid cached values.

    Signed-off-by: Lukasz Majewski
    Reviewed-by: Peng Fan

    Lukasz Majewski
     
  • This patch brings the files from Linux kernel (linux-stable/linux-5.1.y
    SHA1: 5752b50477da)to provide clocks support as it is used on the Linux
    kernel with Common Clock Framework [CCF] setup.

    The directory structure has been preserved. The ported code only supports
    reading information from PLL, MUX, Divider, etc and enabling/disabling
    the clocks USDHCx/ECSPIx depending on used bus. Moreover, it is agnostic
    to the alias numbering as the information about the clock is read from the
    device tree.

    One needs to pay attention to the comments indicating necessary for U-Boot's
    driver model changes.

    If needed, the code can be extended to support the "set" part of the clock
    management.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     
  • This commit adds the clk_get_by_id() function, which is responsible
    for getting the udevice with matching clk->id. Such approach allows
    re-usage of inherit DM list relationship for the same class (UCLASS_CLK).
    As a result - we don't need any other external list - it is just enough
    to look for UCLASS_CLK related udevices.

    Signed-off-by: Lukasz Majewski
    Reviewed-by: Peng Fan

    Lukasz Majewski
     
  • This commit adds the clk_get_parent_rate() function, which is responsible
    for getting the rate of parent clock.
    Unfortunately, u-boot's DM support for getting parent is different
    (the parent relationship is in udevice) than the one in Common Clock
    Framework [CCF] in Linux.

    To alleviate this problem - the clk_get_parent_rate() function has been
    introduced to clk-uclass.c.

    Signed-off-by: Lukasz Majewski
    Reviewed-by: Peng Fan

    Lukasz Majewski
     
  • This commit adds the clk_get_parent() function, which is responsible
    for getting the parent's struct clock pointer.

    U-Boot's DM support for getting parent is different (the parent
    relationship is in udevice) than the one in Common Clock Framework [CCF]
    in Linux. To obtain the pointer to struct clk of parent the
    pdev->uclass_priv field is read via dev_get_clk_ptr() wrapper.

    Signed-off-by: Lukasz Majewski
    Reviewed-by: Peng Fan

    Lukasz Majewski
     
  • This file now stores the dev_get_clk_ptr() wrapper on the dev_get_uclass_priv()
    function.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     
  • Up till now the fixed rate clock ('osc') has been added to UCLASS_CLK
    without declaring struct clk. As a result it was only accessible by
    iterating the udevice's uclass list.

    This is a problem for clock code, which operates on pointers to struct
    clk (like clk_get_rate()), not udevices.

    After this change struct clk is accessible from udevice and udevice from
    struct clk.

    Signed-off-by: Lukasz Majewski
    Reviewed-by: Peng Fan

    Lukasz Majewski
     
  • This commit extends the struct clk to provide information regarding the
    flags related to this devices.

    Those flags are clk device agnostic and indicate generic features
    (like e.g. CLK_GET_RATE_NOCACHE - the need to always recalculate the rate).

    Signed-off-by: Lukasz Majewski
    Reviewed-by: Peng Fan

    Lukasz Majewski
     
  • This commit extends the struct clk to provide information regarding the
    clock rate.
    As a result the clock tree traversal is performed at most once, and further
    reads are using the cached value.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     
  • This check requires the struct clk passed to .get_rate() to be always
    cleared out as any clock with valid ID causes -EINVAL return value.

    The return code of fixed clocks shall always be returned.

    Signed-off-by: Lukasz Majewski
    Reviewed-by: Peng Fan

    Lukasz Majewski
     
  • There is no UCLASS_CLOCK uclass defined. Instead we do use the UCLASS_CLK.

    Signed-off-by: Lukasz Majewski
    Reviewed-by: Simon Glass
    Reviewed-by: Peng Fan

    Lukasz Majewski
     
  • This patch describes the design decisions considerations and taken approach
    for porting in a separate documentation entry.

    Signed-off-by: Lukasz Majewski

    Lukasz Majewski
     

18 Jul, 2019

21 commits