14 Jun, 2018

3 commits

  • This is a proting patch from linux kernel: 37a3a533429e
    ("usb: gadget: OS Feature Descriptors support"), the original commit
    log see below:

    There is a custom (non-USB IF) extension to the USB standard:

    http://msdn.microsoft.com/library/windows/hardware/gg463182

    They grant permission to use the specification - there is
    "Microsoft OS Descriptor Specification License Agreement"
    under the link mentioned above, and its Section 2 "Grant
    of License", letter (b) reads:

    "Patent license. Microsoft hereby grants to You a nonexclusive,
    royalty-free, nontransferable, worldwide license under Microsoft’s
    patents embodied solely within the Specification and that are owned
    or licensable by Microsoft to make, use, import, offer to sell,
    sell and distribute directly or indirectly to Your Licensees Your
    Implementation. You may sublicense this patent license to Your
    Licensees under the same terms and conditions."

    The said extension is maintained by Microsoft for Microsoft.

    Yet it is fairly common for various devices to use it, and a
    popular proprietary operating system expects devices to provide
    "OS descriptors", so Linux-based USB gadgets whishing to be able
    to talk to a variety of operating systems should be able to provide
    the "OS descriptors".

    This patch adds optional support for gadgets whishing to expose
    the so called "OS Feature Descriptors", that is "Extended Compatibility ID"
    and "Extended Properties".

    Hosts which do request "OS descriptors" from gadgets do so during
    the enumeration phase and before the configuration is set with
    SET_CONFIGURATION. What is more, those hosts never ask for configurations
    at indices other than 0. Therefore, gadgets whishing to provide
    "OS descriptors" must designate one configuration to be used with
    this kind of hosts - this is what os_desc_config is added for in
    struct usb_composite_dev. There is an additional advantage to it:
    if a gadget provides "OS descriptors" and designates one configuration
    to be used with such non-USB-compliant hosts it can invoke
    "usb_add_config" in any order because the designated configuration
    will be reported to be at index 0 anyway.

    This patch also adds handling vendor-specific requests addressed
    at device or interface and related to handling "OS descriptors"."

    Signed-off-by: Li Jun
    (cherry picked from commit 859be2fc12dbd1b99e140641f2d7fa14df29c9dd)

    Li Jun
     
  • As other users may use utf8_to_utf16le() to convert the utf8
    to utf16 for usb, so move it to head file.

    Signed-off-by: Li Jun
    (cherry picked from commit 94870cb6b587243e0a68ee9a3ec43540d76152cc)

    Li Jun
     
  • This is a porting patch from linux kernel: 19824d5eeece
    ("usb: gadget: OS String support"), original commit log
    see below:

    "There is a custom (non-USB IF) extension to the USB standard:

    http://msdn.microsoft.com/library/windows/hardware/gg463182

    They grant permission to use the specification - there is
    "Microsoft OS Descriptor Specification License Agreement"
    under the link mentioned above, and its Section 2 "Grant
    of License", letter (b) reads:

    "Patent license. Microsoft hereby grants to You a nonexclusive,
    royalty-free, nontransferable, worldwide license under Microsoft’s
    patents embodied solely within the Specification and that are owned
    or licensable by Microsoft to make, use, import, offer to sell,
    sell and distribute directly or indirectly to Your Licensees Your
    Implementation. You may sublicense this patent license to Your
    Licensees under the same terms and conditions."

    The said extension is maintained by Microsoft for Microsoft.

    Yet it is fairly common for various devices to use it, and a
    popular proprietary operating system expects devices to provide
    "OS descriptors", so Linux-based USB gadgets whishing to be able
    to talk to a variety of operating systems should be able to provide
    the "OS descriptors".

    This patch adds optional support for gadgets whishing to expose
    the so called "OS String" under index 0xEE of language 0.
    The contents of the string is generated based on the qw_sign
    array and b_vendor_code.

    Interested gadgets need to set the cdev->use_os_string flag,
    fill cdev->qw_sign with appropriate values and fill cdev->b_vendor_code
    with a value of their choice.

    This patch does not however implement responding to any vendor-specific
    USB requests."

    Signed-off-by: Li Jun
    (cherry picked from commit b6ea0aaee307be0defaf8dc2c1eae9110bdae9a7)

    Li Jun
     

27 Apr, 2018

3 commits

  • Porting the cadence USB3 (CDNS3) driver from kernel to u-boot. We only support
    the gadget (device mode), while the host mode is not supported. Users remains
    to use xhci-imx8 driver for host mode.

    Some changes in the CDNS3 driver porting:

    1. Add match_ep call back to usb_gadget_ops. The CDNS3 gadget driver replies
    on this operation to bind the usb_ep/usb_ss_ep with the endpoint descriptor
    when function layer uses usb_ep_autoconfig to add endpoint descriptors to gadget.
    So that CDNS3 driver can know the EP information and configure the EP once the
    set configuration request is received.

    2. U-boot does not have CMA, so it won't allocate uncached memory. Need to flush
    TRB and its DMA buffer before prime to usb controller and after complete transfer.

    3. In core.c, we add functions to hook with u-boot. It needs uplayer like
    to pass the register base address of each part of the USB controller.

    4. Force the CDNS3 gadget max speed to HS. The SuperSpeed is not supported by u-boot,
    so disable it in gadget driver. A configuration USB_CDNS3_GADGET_FORCE_HIGHSPEED is
    selected.

    5. Added gadget_is_cdns3 checking to provide bcdUSB value in device descriptor.

    6. Moved some new fields in usb_ep structure to usb_ss_ep, since u-boot does not have them.

    7. Remove host part codes as it is not supported by this driver.

    Signed-off-by: Ye Li
    Acked-by: Peter Chen
    (cherry picked from commit 70514bd095ff9a94e9a523845641381486284257)

    Ye Li
     
  • change the maximum oob size to 1872 for the MT29F128G08CBCCB raw NAND
    chip on i.MX8QXP

    Signed-off-by: Han Xu
    (cherry picked from commit 58dee6ac965000f93693c36c93fb3d453293c43f)

    Han Xu
     
  • imx8mq usb xhci is a dwc3 based controller, its synopsys PHY
    can be controlled by usbmix glue layer. imx8mq has 2 USB3 instance,
    this patch enables both two USB3 controllers.

    Reviewed-by : Peng Fan
    Signed-off-by: Li Jun

    (cherry picked from commit cb77028d960277df2dc357a86e6851da74924c1a)
    Signed-off-by: Ye Li

    Li Jun
     

05 Mar, 2018

1 commit

  • Thomas reported U-Boot failed to build host tools if libfdt-devel
    package is installed because tools include libfdt headers from
    /usr/include/ instead of using internal ones.

    This commit moves the header code:
    include/libfdt.h -> include/linux/libfdt.h
    include/libfdt_env.h -> include/linux/libfdt_env.h

    and replaces include directives:
    #include -> #include
    #include -> #include

    Reported-by: Thomas Petazzoni
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

29 Jan, 2018

1 commit

  • I do not remember why, but this is apparently a file-copy mistake.
    The file name is libfdt.h, but its content is that of libfdt_env.h

    Re-import it from upstream Linux.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Simon Glass

    Masahiro Yamada
     

10 Jan, 2018

1 commit


04 Dec, 2017

2 commits

  • This is needed for ARCH_DMA_MINALIGN.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • This header was renamed to rawnand.h in Linux.

    The following is the corresponding commit in Linux.

    commit d4092d76a4a4e57b65910899948a83cc8646c5a5
    Author: Boris Brezillon
    Date: Fri Aug 4 17:29:10 2017 +0200

    mtd: nand: Rename nand.h into rawnand.h

    We are planning to share more code between different NAND based
    devices (SPI NAND, OneNAND and raw NANDs), but before doing that
    we need to move the existing include/linux/mtd/nand.h file into
    include/linux/mtd/rawnand.h so we can later create a nand.h header
    containing all common structure and function prototypes.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

28 Nov, 2017

20 commits

  • Several drivers check ->chipsize to see if the third row address cycle
    is needed. Instead of embedding magic sizes such as 32MB, 128MB in
    drivers, introduce a new flag NAND_ROW_ADDR_3 for clean-up. Since
    nand_scan_ident() knows well about the device, it can handle this
    properly. The flag is set if the row address bit width is greater
    than 16.

    Delete comments such as "One more address cycle for ..." because
    intention is now clear enough from the code.

    Signed-off-by: Masahiro Yamada
    Acked-by: Wenyou Yang
    Signed-off-by: Boris Brezillon

    [Linux commit: 14157f861437ebe2d624b0a845b91bbdf8ca9a2d]

    Masahiro Yamada
     
  • struct nand_ecc_caps was designed as flexible as possible to support
    multiple stepsizes (like sunxi_nand.c).

    So, we need to write multiple arrays even for the simplest case.
    I guess many controllers support a single stepsize, so here is a
    shorthand macro for the case.

    It allows to describe like ...

    NAND_ECC_CAPS_SINGLE(denali_pci_ecc_caps, denali_calc_ecc_bytes, 512, 8, 15);

    ... instead of

    static const int denali_pci_ecc_strengths[] = {8, 15};
    static const struct nand_ecc_step_info denali_pci_ecc_stepinfo = {
    .stepsize = 512,
    .strengths = denali_pci_ecc_strengths,
    .nstrengths = ARRAY_SIZE(denali_pci_ecc_strengths),
    };
    static const struct nand_ecc_caps denali_pci_ecc_caps = {
    .stepinfos = &denali_pci_ecc_stepinfo,
    .nstepinfos = 1,
    .calc_ecc_bytes = denali_calc_ecc_bytes,
    };

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Boris Brezillon

    [Linux commit: a03c60178c181767ecfb26fb311a88742d228118]

    Masahiro Yamada
     
  • Driver are responsible for setting up ECC parameters correctly.
    Those include:
    - Check if ECC parameters specified (usually by DT) are valid
    - Meet the chip's ECC requirement
    - Maximize ECC strength if NAND_ECC_MAXIMIZE flag is set

    The logic can be generalized by factoring out common code.

    This commit adds 3 helpers to the NAND framework:
    nand_check_ecc_caps - Check if preset step_size and strength are valid
    nand_match_ecc_req - Match the chip's requirement
    nand_maximize_ecc - Maximize the ECC strength

    To use the helpers above, a driver needs to provide:
    - Data array of supported ECC step size and strength
    - A hook that calculates ECC bytes from the combination of
    step_size and strength.

    By using those helpers, code duplication among drivers will be
    reduced.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Boris Brezillon

    [Linux commit: 2c8f8afa7f92acb07641bf95b940d384ed1d0294]

    Masahiro Yamada
     
  • Some NAND controllers can assign different NAND timings to different
    CS lines. Pass the CS line information to ->setup_data_interface() so
    that the NAND controller driver knows which CS line is concerned by
    the setup_data_interface() request.

    Signed-off-by: Boris Brezillon
    [Linux commit: 104e442a67cfba4d0cc982384761befb917fb6a1]
    Signed-off-by: Masahiro Yamada

    Boris Brezillon
     
  • In some cases, nand_do_{read,write}_ops is passed with unaligned
    ops->datbuf. Drivers using DMA will be unhappy about unaligned
    buffer.

    The new struct member, buf_align, represents the minimum alignment
    the driver require for the buffer. If the buffer passed from the
    upper MTD layer does not have enough alignment, nand_do_*_ops will
    use bufpoi.

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Boris Brezillon

    [Linux commit: 477544c62a84d3bacd9f90ba75ffc16c04d78071]

    Masahiro Yamada
     
  • The ->errstat() hook is no longer implemented NAND controller drivers.
    Get rid of it before someone starts abusing it.

    Signed-off-by: Boris Brezillon
    [Linux commit: 7d135bcced20be2b50128432c5426a7278ec4f6d]
    [masahiro: modify davinci_nand.c for U-Boot]
    Signed-off-by: Masahiro Yamada

    Boris Brezillon
     
  • Cached programming is always skipped, so drop the associated code until
    we decide to really support it.

    Signed-off-by: Boris Brezillon
    [Linux commit: 0b4773fd1649e0d418275557723a7ef54f769dc9]
    [masahiro: modify davinci_nand.c for U-Boot]
    Signed-off-by: Masahiro Yamada

    Boris Brezillon
     
  • In order to make the ecclayout definition completely dynamic we need to
    rework the way the OOB layout are defined and iterated.

    Create a few mtd_ooblayout_xxx() helpers to ease OOB bytes manipulation
    and hide ecclayout internals to their users.

    Signed-off-by: Boris Brezillon
    [Linux commit: 75eb2cec251fda33c9bb716ecc372819abb9278a]
    [masahiro:
    cherry-pick more code from adbbc3bc827eb1f43a932d783f09ba55c8ec8379]
    Signed-off-by: Masahiro Yamada

    Boris Brezillon
     
  • If your controller already sends the required NAND commands when
    reading or writing a page, then the framework is not supposed to
    send READ0 and SEQIN/PAGEPROG respectively.

    Signed-off-by: Marc Gonzalez
    Signed-off-by: Boris Brezillon
    [Linux commit: 3371d663bb4579f1b2003a92162edd6d90edd089]
    Signed-off-by: Masahiro Yamada

    Marc Gonzalez
     
  • Add the tR_max, tBERS_max, tPROG_max and tCCS_min timings to the
    nand_sdr_timings struct.
    Assign default/safe values for the statically defined timings, and
    extract them from the ONFI parameter table if the NAND is ONFI
    compliant.

    Signed-off-by: Boris Brezillon
    Tested-by: Marc Gonzalez
    [Linux commit: 204e7ecd47e26cc12d9e8e8a7e7a2eeb9573f0ba
    Fixup commit: 6d29231000bbe0fb9e4893a9c68151ffdd3b5469]
    Signed-off-by: Masahiro Yamada

    Boris Brezillon
     
  • When changing from one data interface setting to another, one has to
    ensure a specific sequence which is described in the ONFI spec.

    One of these constraints is that the CE line has go high after a reset
    before a command can be sent with the new data interface setting, which
    is not guaranteed by the current implementation.

    Rework the nand_reset() function and all the call sites to make sure the
    CE line is asserted and released when required.

    Also make sure to actually apply the new data interface setting on the
    first die.

    Signed-off-by: Boris Brezillon
    Fixes: d8e725dd8311 ("mtd: nand: automate NAND timings selection")
    Reviewed-by: Sascha Hauer
    Tested-by: Marc Gonzalez
    [Linux commit: 73f907fd5fa56b0066d199bdd7126bbd04f6cd7b]
    Signed-off-by: Masahiro Yamada

    Boris Brezillon
     
  • The NAND framework provides several helpers to query timing modes supported
    by a NAND chip, but this implies that all NAND controller drivers have
    to implement the same timings selection dance. Also currently NAND
    devices can be resetted at arbitrary places which also resets the timing
    for ONFI chips to timing mode 0.

    Provide a common logic to select the best timings based on ONFI or
    ->onfi_timing_mode_default information. Hook this into nand_reset()
    to make sure the new timing is applied each time during a reset.

    NAND controller willing to support timings adjustment should just
    implement the ->setup_data_interface() method.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Sascha Hauer
    [Linux commit: d8e725dd831186a3595036b2b1df9f68cbc6efa3]
    Signed-off-by: Masahiro Yamada

    Boris Brezillon
     
  • The nand layer will need ONFI mode 0 to use it as timing mode
    before and right after reset.

    Signed-off-by: Sascha Hauer
    Signed-off-by: Boris Brezillon
    [Linux commit: 6e1f9708dbf3c50a8da93c1952a01a7a2acb5e66]
    Signed-off-by: Masahiro Yamada

    Sascha Hauer
     
  • struct nand_data_interface is the designated type to pass to
    the NAND drivers to configure the timing. To simplify further
    patches convert the onfi_sdr_timings array from type struct
    nand_sdr_timings nand_data_interface.

    Signed-off-by: Sascha Hauer
    Signed-off-by: Boris Brezillon
    [Linux commit: b1dd3ca203fccd111926c3f6ac59bf903ec62b05]
    Signed-off-by: Masahiro Yamada

    Sascha Hauer
     
  • Currently we have no data structure to fully describe a NAND timing.
    We only have struct nand_sdr_timings for NAND timings in SDR mode,
    but nothing for DDR mode and also no container to store both types
    of timing.
    This patch adds struct nand_data_interface which stores the timing
    type and a union of different timings. This can be used to pass to
    drivers in order to configure the timing.
    Add kerneldoc for struct nand_sdr_timings while touching it anyway.

    Signed-off-by: Sascha Hauer
    Signed-off-by: Boris Brezillon
    [Linux commit: eee64b700e26b9bcc6fce024681c31f5e12271fc]
    Signed-off-by: Masahiro Yamada

    Sascha Hauer
     
  • When NAND devices are resetted some initialization may have to be done,
    like for example they have to be configured for the timing mode that
    shall be used. To get a common place where this initialization can be
    implemented create a nand_reset() function. This currently only issues
    a NAND_CMD_RESET to the NAND device. The places issuing this command
    manually are replaced with a call to nand_reset().

    Signed-off-by: Sascha Hauer
    Signed-off-by: Boris Brezillon
    [Linux commit: 2f94abfe35b210e7711af9202a3dcfc9e779219a]
    Signed-off-by: Masahiro Yamada

    Sascha Hauer
     
  • 'extern' is not necessary for function declarations. To prevent
    people from adding the keyword to new declarations remove the
    existing ones.

    Signed-off-by: Sascha Hauer
    Signed-off-by: Boris Brezillon
    [Linux commit: 79022591839f110f465cac0223e117b91d47d5db]
    Signed-off-by: Masahiro Yamada

    Sascha Hauer
     
  • The generic NAND DT bindings allows one to tweak the ECC strength and
    step size to their need. It can be used to lower the ECC strength to
    match a bootloader/firmware config, but might also be used to get a better
    reliability.

    In the latter case, the user might want to use the maximum ECC strength
    without having to explicitly calculate the exact value (this value not
    only depends on the OOB size, but also on the NAND controller, and can
    be tricky to extract).

    Add a generic 'nand-ecc-maximize' DT property and the associated
    NAND_ECC_MAXIMIZE flag, to let ECC controller drivers select the best
    ECC strength and step-size on their own.

    Signed-off-by: Boris Brezillon
    Acked-by: Rob Herring
    [Linux commit: ba78ee00e1ff84de9b3ad33edbd3ec599099ee82]
    [masahiro: of_property_read_bool -> fdt_getprop for U-Boot]
    Signed-off-by: Masahiro Yamada

    Boris Brezillon
     
  • Add stubs to the header in case CONFIG_SYS_NAND_ONFI_DETECTION is
    disabled. This is much easier than adding around #ifdef to the
    caller side.

    Also, I removed the #ifdef around onfi_params. In Linux, onfi_params
    and jedec_params are unified as union. It will be the right thing
    to do.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Same macros are defined in various places. Collect them into
    include/linux/bitops.h like Linux.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

17 Nov, 2017

2 commits

  • lib/libfdt/ and scripts/dtc/libfdt have the same copies for the
    followings 6 files:
    fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c
    fdt_sw.c

    Make them a wrapper of scripts/dtc/libfdt/*. This is exactly what
    Linux does to sync libfdt. In order to make is possible, import
    and from Linux 4.14-rc5.

    Unfortunately, U-Boot locally modified the following 3 files:
    fdt_ro.c fdt_wip.c fdt_rw.c

    The fdt_region.c is U-Boot own file.

    I did not touch them in order to avoid unpredictable impact.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Add this typedef in the same place as in Linux. This is necessary
    to refactor libfdt inclusion.

    U-Boot also defines it in include/compiler.h. Of course it should
    not do that, but I do not want to open a can of worms.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

28 Oct, 2017

1 commit


27 Oct, 2017

1 commit


24 Oct, 2017

1 commit

  • All users of this macro have been converted. Remove MTDDEBUG and
    related CONFIG options.

    ubifs_dbg_msg_key() is kept. It is silent unless DEBUG is defined.

    I am not touching scripts/config_whitelist.txt. The deprecated options
    will be dropped by the next resync.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

16 Oct, 2017

1 commit


06 Oct, 2017

2 commits


05 Oct, 2017

1 commit