1
\$\begingroup\$

I'm using the USB2517 for a project. It's a seven port hub, and I'm using six of them. I'm working through the config settings, and I'm stumped by the port remap registers. The datasheet gives the following text (page 34 in the datasheet):

Port remap register for ports 1 & 2 When a hub is enumerated by a USB Host Controller, the hub is only permitted to report how many ports it has; the hub is not permitted to select a numerical range or assignment. The Host Controller will number the downstream ports of the hub starting with the number '1', up to the number of ports that the hub recognizes.
The host's port number is referred to as "Logical Port Number" and the physical port on the hub is the “Physical Port Number". When remapping mode is enabled (see PRTMAP_EN in
Register 08h: Configuration Data Byte 3) the hub's downstream port
numbers can be remapped to different logical port numbers (assigned by the host). Note: The OEM must ensure that Contiguous Logical Port Numbers are
used, starting from #1 up to the maximum number of enabled ports; this ensures that the hub's ports are numbered in accordance with the way a Host will communicate with the ports

So, I've got seven ports, DS[1:7]. These are the "Physical Port Numbers". The host enumerates these as a range, which we can call PORT[1:7]. These are the "Logical Port Numbers". By writing to this register, I'm mapping DS[x] to PORT[y], or outwrite [see what I did there?] disabling it

Why would I want to remap my ports, however? What does that gain me over letting the hub automatically handle remapping? Is there some kind of port priority in the USB 2.0 spec that allocates additional bandwidth to lower numbered ports? Is it just in there to keep overcautious engineers up at night?

Edit: The hub is able to automatically remap ports to ensure contiguous logical ports if physical ports in the middle of the range are disabled if PRTMAP_EN (08h:3) is low. Is there anything to be gained by manually remapping them in a different order than the hub would automatically do it?

\$\endgroup\$
  • \$\begingroup\$ My advice: stop what you are doing, and use default power-on configuration. If you want to skip a port in between for routing reasons, simply disable it with dual pull-ups (straps) option, the IC will take care of itself. \$\endgroup\$ – Ale..chenski Mar 14 '17 at 3:06
  • \$\begingroup\$ The default power-on config will work for me, I imagine. I'm interested in knowing what the benefit would be in remapping specific physical ports to specific logical ports, though. Essentially, I'm not understanding why the port remap registers are available to me when the hub is already capable of automatically remapping registers. Extra functionality comes at a premium, so why did they expose this register? What advantage is there to manually remapping over a naive automatic remap? \$\endgroup\$ – Jason_L_Bens Mar 14 '17 at 22:56
  • \$\begingroup\$ Extra configuration doesn't cost much if the VID/PID/ option change is already in place. The register is not "exposed", it was designed in by request of marketing - more features make an impression of better flexibility and dictate better price. But please be aware that there was/is a bug - the pull-down 15k are not configurable, and if you use permanent strapping option to disable a port, it will cost you about 300uA of extra consumption, which might be a concern in low-power embedded applications. \$\endgroup\$ – Ale..chenski Mar 14 '17 at 23:19
1
\$\begingroup\$

As the datasheet explains, logical port numbers have to be assigned consecutively, starting at 1. If you aren't using all of the ports, and one of the unused ports isn't at the "end" of the physical port numbers, you have to use remapping to put the active ports back in order.

For example: Let's say that you're making a 4-port hub, and, for PCB layout reasons, you have to use physical ports 2, 3, 6, and 7. Port remapping would allow you to remap these ports as logical ports 1 through 4, by setting:

PRTR12 = 0001_0000 -- physical port 2 = logical port 1, physical port 1 = disabled
PRTR34 = 0000_0010 -- physical port 4 = disabled, physical port 3 = logical port 2
PRTR56 = 0011_0000 -- physical port 6 = logical port 3, physical port 5 = disabled
PRTR7  = 0000_0100 -- physical port 7 = logical port 4
\$\endgroup\$
  • \$\begingroup\$ Is there anything to be gained by remapping in a specific order? My fault for not including it in the question, but the IC can also automatically remap the ports to accommodate disabled ports (register 08h PRTMAP_EN). I'd assume that it can make contiguous blocks of logical ports as well as I can. If that's the case, why give me the registers? \$\endgroup\$ – Jason_L_Bens Mar 14 '17 at 1:05
  • \$\begingroup\$ Usually not? It could be significant if you have a host device which "cares" about the order of ports, but most computers don't. \$\endgroup\$ – duskwuff Mar 14 '17 at 1:07
  • \$\begingroup\$ +1 To add, the standard port enabling procedure in software is to start from port1, and work them up. If you have unused unrouted port in the middle of the sequence, it will just be an unconnected port, and nothing bad would happen. This matters only if you want to certify the product. During mandatory certification test, it will ask test operator to plug mice in and out, etc. If the port is not routed and exposed to a connector, it would be impossible to follow the test, and certification will fail. Other than that, who cares... \$\endgroup\$ – Ale..chenski Mar 14 '17 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.