All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Greg KH <greg@kroah.com>
Cc: "linux-usb\@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: Aspeed vhub configuration
Date: Tue, 02 Jul 2019 15:56:40 +0300	[thread overview]
Message-ID: <8736jobnnb.fsf@linux.intel.com> (raw)
In-Reply-To: <e90076897577e2b4d2ad864eff85406b19f88dd3.camel@kernel.crashing.org>


Hi,

Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:

> On Tue, 2019-07-02 at 14:24 +0200, Greg KH wrote:
>> 
>> > That leaves me with two approaches, that aren't mutually exclusive, but
>> > I'd like to run them past the folks here before I start coding:
>> > 
>> >  - The defaults, currently hard coded, could be replaced with Kconfig
>> > options.
>> > 
>> >  - The device-tree node could contain optional override of those
>> > defaults, allowing a vendor to customize the hub for a given board.
>> > It's not per-se a HW description, but the device-tree is also fairly
>> > commonly used for HW configuration, even if some people disagree with
>> > me on that one (hint: they are wrong :-)
>> > 
>> >  - I could add sysfs properties underneath the vhub device instance to
>> > customize it. This would also allow userspace to control whether the
>> > hub is "connected" to the host or not, which could be useful, some
>> > systems don't want it to always be there. Today there's no choice.
>> > 
>> > Any other option ? If somebody says netlink I will scream :)
>> 
>> DT seems like the logical choice, I'll not object to that.
>
> DT for defaults sounds good yes. I'm still toying with also having
> sysfs properties. There have been people wanting to connect or
> disconnect the hub from the host programatically, a property in the
> device node would be best for that. Being able to override the serial
> number as well. The DT isn't a great place for that.

We already have an interface for disconnecting from the host
programatically by disconnecting data pullup.

static ssize_t soft_connect_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t n)
{
	struct usb_udc		*udc = container_of(dev, struct usb_udc, dev);

	if (!udc->driver) {
		dev_err(dev, "soft-connect without a gadget driver\n");
		return -EOPNOTSUPP;
	}

	if (sysfs_streq(buf, "connect")) {
		usb_gadget_udc_start(udc);
		usb_gadget_connect(udc->gadget);
	} else if (sysfs_streq(buf, "disconnect")) {
		usb_gadget_disconnect(udc->gadget);
		usb_gadget_udc_stop(udc);
	} else {
		dev_err(dev, "unsupported command '%s'\n", buf);
		return -EINVAL;
	}

	return n;
}
static DEVICE_ATTR_WO(soft_connect);

part of udc/core.c

-- 
balbi

  reply	other threads:[~2019-07-02 12:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02 11:33 Aspeed vhub configuration Benjamin Herrenschmidt
2019-07-02 12:24 ` Greg KH
2019-07-02 12:29   ` Benjamin Herrenschmidt
2019-07-02 12:56     ` Felipe Balbi [this message]
2019-07-02 13:10       ` Benjamin Herrenschmidt
2019-07-03  6:24         ` Felipe Balbi
2019-07-03 22:52           ` Benjamin Herrenschmidt

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=8736jobnnb.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=greg@kroah.com \
    --cc=linux-usb@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.