Hi Stephen, Wolfgang, On Fri, Mar 9, 2012 at 8:43 AM, Stephen Warren <swar...@wwwdotorg.org> wrote: > On 03/08/2012 02:29 PM, Wolfgang Denk wrote: >> Dear Stephen, >> >> In message <4f590b25.8090...@wwwdotorg.org> you wrote: >>> >>>> I don't like to see such highly architecture specific stuff in common >>>> code, especially if it's such a dirty hack like this. >>> >>> Are there any hooks where we can do the same thing in SoC-specific code? >> >> Not without additional trickery, but I think this is actually a good >> thing. >> >> The method implemented here is but a dirty hack, and should not be >> used.
INIT_FUNC will resolve this issue long-term - Tegra can just put in: int tegra_set_debug_port(void) { /* * Put a 'D' in the scratchpad to let the kernel know which UART * for earlyprintk [D]ebugging. */ serial_out('D', &com_port->spr); return 0; } INIT_FUNC(set_debug_port, tegra_set_debug_port, *serial_init) >>> The point of this information is to enable the kernel's earlyprintk >>> support, which runs well before the device tree, or other mechanisms, >>> are available. >> >> Sorry, but I don't buy that this is the only possible way to do that. >> Or how comes only tegra2 would need that, while all other SoCs and >> architectures can do without it? > > First, OMAP does something very similar; the kernel low-level debug code > looks at UART1's scratch pad register, and derives which UART to use > based on the value stored there. If none of the expected values is > found, it appears to default to UART1. > > On Tegra, the UART registers can't be read unless the UART is clocked > and not in reset. So, the Tegra code looks at each UART in the system, > and finds one that's in that state. To cater for the scenario where > multiple UARTs are clocked-and-not-reset, the code also checks whether > the UART scratch register contains 'D' ("D"ebug) so it's sure it picked > the correct one. > > So, at leasst OMAP has set precedent here. There may be others; I didn't > check. > > Some other SoCs may have only 1 UART and not need to auto-select. > > Some other SoCs with multiple UARTs may designate a single specific UART > as the debug port rather than the board designer apparently randomly > picking which one to use. In either of those cases, the kernel's > low-level debug code can simply hard-code the UART address and do > without the hand-shaking. As far as I am aware, earlyprintk happens well before processing the kernel command line so, IMHO, I don't consider setting up the hardware in order for the kernel to get some low-level information which cannot be provided by the command line as a hack. Reading the above, I actually think it is quite elegant Regards, Graeme _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot