• Radhey Shyam Pandey's avatar
    usb: misc: onboard_usb_dev: add Microchip usb5744 SMBus programming support · 6782311d
    Radhey Shyam Pandey authored
    usb5744 supports SMBus Configuration and it may be configured via the
    SMBus slave interface during the hub start-up configuration stage.
    
    To program it driver uses i2c-bus phandle (added in commit '02be19e9
    dt-bindings: usb: Add support for Microchip usb5744 hub controller') to
    get i2c client device and then based on usb5744 compatible check calls
    usb5744 i2c default initialization sequence.
    
    Apart from the USB command attach, prevent the hub from suspend.
    when the USB Attach with SMBus (0xAA56) command is issued to the hub,
    the hub is getting enumerated and then it puts in a suspend mode.
    This causes the hub to NAK any SMBus access made by the SMBus Master
    during this period and not able to see the hub's slave address while
    running the "i2c probe" command.
    
    Prevent the MCU from putting the HUB in suspend mode through register
    write. The BYPASS_UDC_SUSPEND bit (Bit 3) of the RuntimeFlags2
    register at address 0x411D controls this aspect of the hub. The
    BYPASS_UDC_SUSPEND bit in register 0x411Dh must be set to ensure that the
    MCU is always enabled and ready to respond to SMBus runtime commands.
    This register needs to be written before the USB attach command is issued.
    
    The byte sequence is as follows:
    Slave addr: 0x2d           00 00 05 00 01 41 1D 08
    Slave addr: 0x2d           99 37 00
    Slave addr: 0x2d           AA 56 00
    
    Also since usb5744 i2c initialization routine uses i2c SMBus APIs invoke
    these APIs only when i2c driver is enabled in the kernel configuration.
    Signed-off-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@amd.com>
    Link: https://lore.kernel.org/r/1725732196-70975-3-git-send-email-radhey.shyam.pandey@amd.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    6782311d
onboard_usb_dev.c 16.2 KB