> I've recently reviewed a patch adding serial port aliases to the device tree > and would like to pick your brains about a disagreement I had with the > developer. And here is the developer :) > > The SoC includes 8 serial ports. They are all disabled in the SoC .dtsi, and > enabled selectively by board DT files. As not all serial ports are available > on all boards, the question was whether to add aliases for all ports (in the > .dtsi in this case) like > > serial0 = &scif0; > serial1 = &scif1; > serial2 = &scif2; > serial3 = &scif3; > serial4 = &scif4; > serial5 = &scif5; > serial6 = &scif6; > serial7 = &scif7; > > or to just add aliases for the enabled ports (in the board DT file) like > > serial0 = &scif2; > serial1 = &scif3; > > Note the numbering in the latter case: as the board doesn't use serial ports 0 > and 1, hardware ports 2 and 3 become logical ports 0 and 1. > > I considered that having Linux create ttySC0 and ttySC1 devices for the first > two ports of the board, regardless of which hardware ports are used, is > simpler from a user point of view (it allows sharing the same inittab settings > for the console serial port across several boards for instance). I'd > appreciate feedback on that. First, I don't think this is restricted to serial ports but how to use aliases in general. We may decide this or that way, yet we should do it consistently. Using aliases this way for serial ports and that way for I2C busses will create a mess. And currently, I only know of 1:1 mappings for I2C/SPI. So, on the same board, you'll need to open /dev/i2c-2, not /dev/i2c-0. From my experience, things get complicated when stuff gets added and the numbers go wild: serial0 = &scif2; serial1 = &scif3; serial2 = &scif6; serial3 = &scif0; serial4 = &scif7; When debugging here, trying to remember which port to open for the terminal, and which number to scan for in the schematics is error-prone and a PITA. Yeah, the drawback is that the console might be at different places across boards. I suggest to update inittab at runtime anyhow, since not only the number but also the naming often changes (ttyXYZ to ttyABC). Regards, Wolfram
Attachment:
signature.asc
Description: Digital signature