[U-Boot] [PATCH v5] nios2: convert altera_jtag_uart to driver model

Thomas Chou
2015-09-20T03:20:34Z

Hi Simon,

On 09/19/2015 11:46 PM, Simon Glass wrote:
>> {
>> - while (1) {
>> - unsigned st = readl(&jtag->control);
>> - if (NIOS_JTAG_WSPACE(st))
>> - break;
>> + struct altera_jtaguart_platdata *plat = dev->platdata;
>> + struct altera_jtaguart_regs *const regs = plat->reg;
>> + u32 st = readl(&regs->control);
>> +
>> #ifdef CONFIG_ALTERA_JTAG_UART_BYPASS
>
> It seems odd that you return this error when writing a character.
> Don't you know whether the connection is valid in the probe() method?
> Or are you trying to avoid an error at that stage?

The console output will resume once the JTAG terminal is connected.
Before that the output is skipped.

Without the bypass, the console output will wait forever until a JTAG
terminal is connected. You will see every message the console output.

>> + plat->reg = ioremap(dev_get_addr(dev),
>> + sizeof(struct altera_jtaguart_regs));
>
> What is the ioremap() for? Is this because we don't support ranges
> properly yet? If so, perhaps we can assume that will be fixed before
> this is applied?

The reg address in dts file for nios2 linux is physical address. We will
need to map it to uncached virtual address for the peripherals.

Most linux drivers use ioremap(), though it is rare on u-boot.

We do need the range translation, as there may be bridges to the
peripherals.

Best regards,
Thomas Chou