Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 3a01483 in mainline


Ignore:
Timestamp:
2012-04-09T04:03:42Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
c127e1c
Parents:
ea106a6
Message:

rootamdm37x: Add USB TLL initialization.

USB devices are found (if it's not some trick), but device initialization fails.

Location:
uspace/drv/infrastructure/rootamdm37x
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/infrastructure/rootamdm37x/rootamdm37x.c

    rea106a6 r3a01483  
    158158}
    159159
     160/** Initialize USB TLL port connections.
     161 *
     162 * Different modes are on page 3312 of the Manual Figure 22-34.
     163 * Select mode than can operate in FS/LS.
     164 */
    160165static int usb_tll_init()
    161166{
     
    173178                return ret;
    174179
    175         /* Reset USB tll */
     180        /* Reset USB TLL */
    176181        usb_tll->sysconfig |= TLL_SYSCONFIG_SOFTRESET_FLAG;
    177182        ddf_msg(LVL_DEBUG2, "Waiting for USB TLL reset");
     
    179184        ddf_msg(LVL_DEBUG, "USB TLL Reset done.");
    180185
     186        {
     187        /* Setup idle mode (smart idle) */
     188        uint32_t sysc = usb_tll->sysconfig;
     189        sysc |= TLL_SYSCONFIG_CLOCKACTIVITY_FLAG | TLL_SYSCONFIG_AUTOIDLE_FLAG;
     190        sysc = (sysc
     191            & ~(TLL_SYSCONFIG_SIDLE_MODE_MASK << TLL_SYSCONFIG_SIDLE_MODE_SHIFT)
     192            ) | (0x2 << TLL_SYSCONFIG_SIDLE_MODE_SHIFT);
     193        usb_tll->sysconfig = sysc;
     194        ddf_msg(LVL_DEBUG2, "Set TLL->sysconfig (%p) to %x:%x.",
     195            &usb_tll->sysconfig, usb_tll->sysconfig, sysc);
     196        }
     197
     198        {
     199        /* Smart idle for UHH */
     200        uint32_t sysc = uhh_conf->sysconfig;
     201        sysc |= UHH_SYSCONFIG_CLOCKACTIVITY_FLAG | UHH_SYSCONFIG_AUTOIDLE_FLAG;
     202        sysc = (sysc
     203            & ~(UHH_SYSCONFIG_SIDLE_MODE_MASK << UHH_SYSCONFIG_SIDLE_MODE_SHIFT)
     204            ) | (0x2 << UHH_SYSCONFIG_SIDLE_MODE_SHIFT);
     205        sysc = (sysc
     206            & ~(UHH_SYSCONFIG_MIDLE_MODE_MASK << UHH_SYSCONFIG_MIDLE_MODE_SHIFT)
     207            ) | (0x2 << UHH_SYSCONFIG_MIDLE_MODE_SHIFT);
     208        ddf_msg(LVL_DEBUG2, "Set UHH->sysconfig (%p) to %x.",
     209            &uhh_conf->sysconfig, uhh_conf->sysconfig);
     210        uhh_conf->sysconfig = sysc;
     211
     212        /* All ports are connected on BBxM */
     213        uhh_conf->hostconfig |= (UHH_HOSTCONFIG_P1_CONNECT_STATUS_FLAG
     214            | UHH_HOSTCONFIG_P2_CONNECT_STATUS_FLAG
     215            | UHH_HOSTCONFIG_P3_CONNECT_STATUS_FLAG);
     216
     217        /* Set all ports to go through TLL(UTMI)
     218         * Direct connection can only work in HS mode */
     219        uhh_conf->hostconfig |= (UHH_HOSTCONFIG_P1_ULPI_BYPASS_FLAG
     220            | UHH_HOSTCONFIG_P2_ULPI_BYPASS_FLAG
     221            | UHH_HOSTCONFIG_P3_ULPI_BYPASS_FLAG);
     222        ddf_msg(LVL_DEBUG2, "Set UHH->hostconfig (%p) to %x.",
     223            &uhh_conf->hostconfig, uhh_conf->hostconfig);
     224        }
     225
     226        usb_tll->shared_conf |= TLL_SHARED_CONF_FCLK_IS_ON_FLAG;
     227        ddf_msg(LVL_DEBUG2, "Set shared conf port (%p) to %x.",
     228            &usb_tll->shared_conf, usb_tll->shared_conf);
     229
     230        for (unsigned i = 0; i < 3; ++i) {
     231                uint32_t ch = usb_tll->channel_conf[i];
     232                /* Clear Channel mode and FSLS mode */
     233                ch &= ~(TLL_CHANNEL_CONF_CHANMODE_MASK
     234                    << TLL_CHANNEL_CONF_CHANMODE_SHIFT)
     235                    & ~(TLL_CHANNEL_CONF_FSLSMODE_MASK
     236                    << TLL_CHANNEL_CONF_FSLSMODE_SHIFT);
     237
     238                /* Serial mode is the only one capable of FS/LS operation. */
     239                ch |= (TLL_CHANNEL_CONF_CHANMODE_UTMI_SERIAL_MODE
     240                    << TLL_CHANNEL_CONF_CHANMODE_SHIFT);
     241
     242                /* Select FS/LS mode, no idea what the difference is
     243                 * one of bidirectional modes might be good choice
     244                 * 2 = 3pin bidi phy. */
     245                ch |= (2 << TLL_CHANNEL_CONF_FSLSMODE_SHIFT);
     246
     247                /* Write to register */
     248                ddf_msg(LVL_DEBUG2, "Setting port %u(%p) to %x.",
     249                    i, &usb_tll->channel_conf[i], ch);
     250                usb_tll->channel_conf[i] = ch;
     251        }
    181252        return EOK;
    182253}
  • uspace/drv/infrastructure/rootamdm37x/usbtll.h

    rea106a6 r3a01483  
    8282#define TLL_CHANNEL_CONF_CHANMODE_MASK  0x3
    8383#define TLL_CHANNEL_CONF_CHANMODE_SHIFT  1
     84#define TLL_CHANNEL_CONF_CHANMODE_UTMI_ULPI_MODE 0
     85#define TLL_CHANNEL_CONF_CHANMODE_UTMI_SERIAL_MODE 1
     86#define TLL_CHANNEL_CONF_CHANMODE_UTMI_TRANS_MODE 2
     87#define TLL_CHANNEL_CONF_CHANMODE_NO_MODE 3
    8488#define TLL_CHANNEL_CONF_UTMIISADEV_FLAG  (1 << 3)
    8589#define TLL_CHANNEL_CONF_TLLATTACH_FLAG  (1 << 4)
Note: See TracChangeset for help on using the changeset viewer.