linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry N. Mikushin" <maemarcus@gmail.com>
To: Sid Spry <sid@aeam.us>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	linux-usb@vger.kernel.org
Subject: Re: Any example of USB gadget for DRD device mode on Intel Gemini Lake?
Date: Fri, 23 Oct 2020 01:47:14 +0200	[thread overview]
Message-ID: <CAGR4S9EK317fSNAR0-uHW=ccO22=6tTXfogn_J=ER_g=r0SDuA@mail.gmail.com> (raw)
In-Reply-To: <6eff3a6b-5284-424f-96bf-ebdf5653bba7@www.fastmail.com>

This is exactly the purpose of my message here. Intel's approach to
UDC is different to what we've been used up to in ARMs. No USB options
are provided in BIOS; actually BIOS is almost empty :) Indeed, I
really hope to get this clarified with the help of Intel folks.

Kind regards,
- Dmitry.

пт, 23 окт. 2020 г. в 01:05, Sid Spry <sid@aeam.us>:
>
> On Thu, Oct 22, 2020, at 4:51 PM, Dmitry N. Mikushin wrote:
> > Hi Sid, alas no device in udc, what can I do?
> >
> > marcusmae@m1k:~$ cat /sys/class/usb_role/intel_xhci_usb_sw-role-switch/role
> > device
> > marcusmae@m1k:~$ ls -l /sys/class/udc
> > total 0
>
> I don't have an exact answer, but the device in /sys/class/udc must be there
> (as far as I am aware) if the kernel is properly communicating with the hardware.
>
> On my ARM systems I've found that DRD seems to not work in general, and
> I've had to set device mode operation via devicetree. On an Intel board I
> assume this would be a UEFI/BIOS option.
>
> If Intel is still providing support for the hardware you should try to contact
> them. In the meantime, hopefully someone else can comment.
>
> >
> > чт, 22 окт. 2020 г. в 23:26, Sid Spry <sid@aeam.us>:
> > >
> > > On Thu, Oct 22, 2020, at 4:06 PM, Dmitry N. Mikushin wrote:
> > > > Yes, AFAIK PCI_DEVICE_ID_INTEL_GLK_XHCI is actually 0x31a8, and I do have it:
> > > >
> > > > 00:15.0 USB controller [0c03]: Intel Corporation Device [8086:31a8] (rev 03)
> > > >
> > > > Board is M1K.
> > > > My kernel is 5.4.0-48-lowlatency with the following additional patch:
> > > > https://lore.kernel.org/patchwork/patch/1037542/
> > > > I have dwc3 as a kernel module.
> > > > I'm not testing any gadget, I just have no idea what to test. Could
> > > > you please suggest some sources on how I should map gadget onto my
> > > > dwc3 port?
> > > >
> > > > Thanks & Kind Regards,
> > > > - Dmitry.
> > > >
> > >
> > > After you set the DRD switch to device do you see a device in /sys/class/udc?
> > >
> > > I will show you how to use configfs. You must enable USB gadget configfs. It
> > > is easier to use in my opinion. The other gadget drivers simply need to be
> > > loaded, but I am unsure how they work with newer DWC3 hardware. Most
> > > of the code is written for android and android uses configfs.
> > >
> > > `modprobe libcomposite` then execute the following, using that name:
> > >
> > > #!/usr/bin/env bash
> > > cd /sys/kernel/config/usb_gadget
> > > if [[ -d "g0" ]]; then
> > >         echo "" > g0/UDC
> > >         rm -rf g0;
> > > fi
> > >
> > > mkdir g0
> > > cd g0
> > >
> > > echo "0x1d6b" > idVendor
> > > echo "0x0104" > idProduct
> > >
> > > mkdir strings/0x409
> > > echo "0000000000" > strings/0x409/serialnumber
> > > echo "Your Company" > strings/0x409/manufacturer
> > > echo "Your Device" > strings/0x409/product
> > >
> > > mkdir functions/ncm.usb0
> > >
> > > mkdir configs/c.1
> > > ln -s functions/ncm.usb0 configs/c.1
> > >
> > > # List /sys/class/udc and take a name for this line:
> > > echo "" > UDC
> > >
> > > This will set up a Ethernet NCM device. There are similar instructions
> > > from the configfs author in a powerpoint. More device types are in the
> > > documentation.
> >

  reply	other threads:[~2020-10-22 23:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 11:27 Any example of USB gadget for DRD device mode on Intel Gemini Lake? Dmitry N. Mikushin
2020-10-19 13:36 ` Heikki Krogerus
2020-10-22 21:06   ` Dmitry N. Mikushin
2020-10-22 21:25     ` Sid Spry
2020-10-22 21:51       ` Dmitry N. Mikushin
2020-10-22 23:04         ` Sid Spry
2020-10-22 23:47           ` Dmitry N. Mikushin [this message]
2020-10-23  6:48     ` Heikki Krogerus
2020-10-23 10:08       ` Felipe Balbi
2020-10-23 22:34         ` Dmitry N. Mikushin
2020-10-26  7:11           ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGR4S9EK317fSNAR0-uHW=ccO22=6tTXfogn_J=ER_g=r0SDuA@mail.gmail.com' \
    --to=maemarcus@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=sid@aeam.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).