Date: Wed, 21 Mar 2018 10:24:17 -0500 From: Kyle Evans <kevans@freebsd.org> To: Andrew Turner <andrew@freebsd.org>, Hans Petter Selasky <hselasky@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331306 - head/sys/dev/usb/controller Message-ID: <CACNAnaHCf8paMB3RP1SSnP45xPTSKEcJp-qKyKievLE0E_svWA@mail.gmail.com> In-Reply-To: <201803211517.w2LFHsHf007714@repo.freebsd.org> References: <201803211517.w2LFHsHf007714@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 21, 2018 at 10:17 AM, Andrew Turner <andrew@freebsd.org> wrote: > Author: andrew > Date: Wed Mar 21 15:17:54 2018 > New Revision: 331306 > URL: https://svnweb.freebsd.org/changeset/base/331306 > > Log: > Use a table to find the endpoint configuration > > On the Allwinner SoCs we need to set a custom endpoint configuration. To > allow for this use a table to store the configuration so the attachment > can override it. > > Reviewed by: hselasky > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D14783 > > Modified: > head/sys/dev/usb/controller/musb_otg.c > head/sys/dev/usb/controller/musb_otg.h > > Modified: head/sys/dev/usb/controller/musb_otg.c > ============================================================================== > --- head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:13:47 2018 (r331305) > +++ head/sys/dev/usb/controller/musb_otg.c Wed Mar 21 15:17:54 2018 (r331306) > @@ -149,6 +149,27 @@ static const struct usb_hw_ep_profile musbotg_ep_profi > } > }; > > +static const struct musb_otg_ep_cfg musbotg_ep_default[] = { > + { > + .ep_end = 1, > + .ep_fifosz_shift = 12, > + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_4096 | MUSB2_MASK_FIFODB, > + }, > + { > + .ep_end = 7, > + .ep_fifosz_shift = 9, > + .ep_fifosz_reg = MUSB2_VAL_FIFOSZ_512 | MUSB2_MASK_FIFODB, > + }, I'm afraid I'm not familiar with this- why did .ep_fifosz_shift for this case drop to 9? frx = 10 in the temp < 8 case in the removals of the following hunks. Mostly curious because the others seemed to stay the same. > [..snip..] > @@ -3193,20 +3220,15 @@ musbotg_init(struct musbotg_softc *sc) > > if (dynfifo) { > if (frx && (temp <= nrx)) { > - if (temp == 1) { > - frx = 12; /* 4K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, > - MUSB2_VAL_FIFOSZ_4096 | > - MUSB2_MASK_FIFODB); > - } else if (temp < 8) { > - frx = 10; /* 1K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, > - MUSB2_VAL_FIFOSZ_512 | > - MUSB2_MASK_FIFODB); > - } else { > - frx = 7; /* 128 bytes */ > - MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, > - MUSB2_VAL_FIFOSZ_128); > + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { > + cfg = &sc->sc_ep_cfg[i]; > + if (temp <= cfg->ep_end) { > + frx = cfg->ep_fifosz_shift; > + MUSB2_WRITE_1(sc, > + MUSB2_REG_RXFIFOSZ, > + cfg->ep_fifosz_reg); > + break; > + } > } > > MUSB2_WRITE_2(sc, MUSB2_REG_RXFIFOADD, > @@ -3215,20 +3237,15 @@ musbotg_init(struct musbotg_softc *sc) > offset += (1 << frx); > } > if (ftx && (temp <= ntx)) { > - if (temp == 1) { > - ftx = 12; /* 4K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, > - MUSB2_VAL_FIFOSZ_4096 | > - MUSB2_MASK_FIFODB); > - } else if (temp < 8) { > - ftx = 10; /* 1K */ > - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, > - MUSB2_VAL_FIFOSZ_512 | > - MUSB2_MASK_FIFODB); > - } else { > - ftx = 7; /* 128 bytes */ > - MUSB2_WRITE_1(sc, MUSB2_REG_TXFIFOSZ, > - MUSB2_VAL_FIFOSZ_128); > + for (i = 0; sc->sc_ep_cfg[i].ep_end >= 0; i++) { > + cfg = &sc->sc_ep_cfg[i]; > + if (temp <= cfg->ep_end) { > + ftx = cfg->ep_fifosz_shift; > + MUSB2_WRITE_1(sc, > + MUSB2_REG_TXFIFOSZ, > + cfg->ep_fifosz_reg); > + break; > + } > } > > MUSB2_WRITE_2(sc, MUSB2_REG_TXFIFOADD, > > Modified: head/sys/dev/usb/controller/musb_otg.h > ============================================================================== > --- head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:13:47 2018 (r331305) > +++ head/sys/dev/usb/controller/musb_otg.h Wed Mar 21 15:17:54 2018 (r331306) > @@ -387,6 +387,12 @@ struct musbotg_flags { > uint8_t d_pulled_up:1; > }; > > +struct musb_otg_ep_cfg { > + int ep_end; > + int ep_fifosz_shift; > + uint8_t ep_fifosz_reg; > +}; > + > struct musbotg_softc { > struct usb_bus sc_bus; > union musbotg_hub_temp sc_hub_temp; > @@ -423,6 +429,7 @@ struct musbotg_softc { > uint8_t sc_id; > uint8_t sc_mode; > void *sc_platform_data; > + const struct musb_otg_ep_cfg *sc_ep_cfg; > }; > > /* prototypes */ >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaHCf8paMB3RP1SSnP45xPTSKEcJp-qKyKievLE0E_svWA>