Re: [RFC PATCH 0/2] usb: typec: alternate mode bus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Heiko,

On 28-09-17 13:35, Heikki Krogerus wrote:
Hi guys,

The bus allows SVID specific communication with the partners to be
handled in separate drivers for each alternate mode.

Alternate mode handling happens with two separate logical devices:
1. Partner alternate mode devices which represent the alternate modes
    on the partner. The driver for them will handle the alternate mode
    specific communication with the partner using VDMs.
2. Port alternate mode devices which represent connections from the
    USB Type-C port to devices on the platform.

The drivers will be bind to the partner alternate modes. The alternate
mode drivers will need to deliver the result of the negotiated pin
configurations to the rest of the platform (towards the port alternate
mode devices). This series includes API for that, however, not the
final implementation yet.

The connections to the other devices on the platform the ports have
can be described by using the remote endpoint concept [1][2] on ACPI
and DT platforms, but I have no solution for the "platform data" case
where we have neither DT nor ACPI to describe the connections for us.

Sorry about the slow reply, I've been a bit swamped with other stuff,
but now I would like to get back to this.

I've been trying to wrap my head around what you're proposing here and
I see how this can help with implementing display-port alternate mode
support, but I don't see how it is going to help with regular superspeed
USB support / the mux problem.

The problems I see / questions I have are:

1) This seems to be driven by having a bus using svid-s as match functions,
but the standard USB function does not have any svid, or at least currently
does not show as such under e.g. /sys/class/typec/port0/port0-partner

2) The alt-mode drivers you are suggesting seem to be about 2 things:
a) Alt-mode specific PD communication
b) Telling other components about pin-configs, e.g. telling the i915 driver how
much display port lanes are configured

What this seems to miss a mechanism to control the mux between the "superspeed"
data-pairs on the port and the dp-port pins on the SoC / the superspeed USB
pins on the SoC. Even leaving display-port out of the picture for now we still
need to control the port -> SoC superspeed pins routing which need to be
one of: tristated (default) / normal / upside-down routing.

### end Type-c discussion ###

### Related USB device/host mode switch discussion ###

Another problem for USB is even once the right pins on the port are routed to
the right pins on the SoC then the SoC may have an internal mux to route
all the USB pins (both USB-2 and superspeed) to either the host or device
USB controller.

My previous patches for this tried to use the mux framework for this, but that
was nacked because of a misunderstanding how the current mux framemork works.

The current mux framework is based on the notion of there being a shared
bus between e.g. the SoC and various devices, where the devices are not
directly addressable from the bus, but there is a mux in between which
connects the SoC to the device it wants to talk to. So the SoC can reach
all connected devices, but only one add at a time. To make this clear
a driver talking to one of the devices needs to switch the mux to a
specific device and then release the mux when it is done. If another
driver tries to switch the mux before it is released its request will
block until the mux gets released.

With USB OTG / Type-C things are different, there is only one device
connected, and depending on which type of device is detected as being
connected we need to connect the OTG / Type-C port pins to the
corresponding controller inside the SoC. There is no "time-shared"
access to multiple devices at the same time. Thus the current mux
subsys is a poor match for the needs for USB OTG / Type-C.

One option I've been considering is to introduce a new usb_mux subsys
when I get around to this (hopefully sometime the coming month) which
will be modelled after the mux subsys, but without the "time-sharing"
concepts and thus without the need to release a mux setting before
the mux can be switched to route the data else where.

My primary target here is using this on devices with a micro-usb
connector, traditionally on ARM systems the mux in these devices has
been hidden inside the phy-driver. But on x86 systems:
a) The phy is setup from firmware and we don't have a phy driver; and
b) Often the mux is not part of the phy at all, instead we have a
separate mux (sometimes in separate IC outside the SoC) driven by
gpios or i2c.

I think we could extend this usb_mux subsys easily to also handle the
mux parts of type-c (specifically controlling mux ICs such as the
PI3USB30532 USB switch).

Regards,

Hans


[1] Documentation/devicetree/bindings/graph.txt
[2] Documentation/acpi/dsd/graph.txt


Heikki Krogerus (2):
   usb: typec: Simple bus for alternate modes
   usb: typec: dummy alternate mode driver

  drivers/usb/typec/Kconfig              |   2 +
  drivers/usb/typec/Makefile             |   3 +
  drivers/usb/typec/altmode.c            | 249 +++++++++++++++++++++++++++++++++
  drivers/usb/typec/altmode.h            |  46 ++++++
  drivers/usb/typec/altmodes/Kconfig     |   9 ++
  drivers/usb/typec/altmodes/Makefile    |   2 +
  drivers/usb/typec/altmodes/dummy.c     | 133 ++++++++++++++++++
  drivers/usb/typec/{typec.c => class.c} | 128 ++++++++++++-----
  drivers/usb/typec/tcpm.c               |   2 +-
  include/linux/usb/typec.h              |   6 +-
  include/linux/usb/typec_altmode.h      |  65 +++++++++
  11 files changed, 608 insertions(+), 37 deletions(-)
  create mode 100644 drivers/usb/typec/altmode.c
  create mode 100644 drivers/usb/typec/altmode.h
  create mode 100644 drivers/usb/typec/altmodes/Kconfig
  create mode 100644 drivers/usb/typec/altmodes/Makefile
  create mode 100644 drivers/usb/typec/altmodes/dummy.c
  rename drivers/usb/typec/{typec.c => class.c} (93%)
  create mode 100644 include/linux/usb/typec_altmode.h

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux