[PATCH 6/8] serial: Add Tegra Combined UART driver

Mikko Perttunen
2018-05-13T18:06:37Z

On 05/13/2018 06:36 PM, Jassi Brar wrote:
> On Tue, May 8, 2018 at 5:14 PM, Mikko Perttunen <mperttunen@nvidia.com> wrote:
>
> ....
>>
>> +config SERIAL_TEGRA_TCU
>> + tristate "NVIDIA Tegra Combined UART"
>> + depends on ARCH_TEGRA && MAILBOX
>> + select SERIAL_CORE
>> + help
>> + Support for the mailbox-based TCU (Tegra Combined UART) serial port.
>> + TCU is a virtual serial port that allows multiplexing multiple data
>> + streams into a single hardware serial port.
>> +
> Maybe make it depend upon TEGRA_HSP_MBOX ?

Yeah, that probably makes more sense. MAILBOX is enough to build it but
it won't be of any use without TEGRA_HSP_MBOX.

>
> ......
>
>> +
>> +static void tegra_tcu_write(const char *s, unsigned int count)
>> +{
>> + struct tegra_tcu *tcu = tegra_tcu_uart_port.private_data;
>> + unsigned int written = 0, i = 0;
>> + bool insert_nl = false;
>> + uint32_t value = 0;
>> +
>> + while (i < count) {
>> + if (insert_nl) {
>> + value |= '\n' << (written++ * 8);
>> + insert_nl = false;
>> + i++;
>> + } else if (s[i] == '\n') {
>> + value |= '\r' << (written++ * 8);
>> + insert_nl = true;
>> + } else {
>> + value |= s[i++] << (written++ * 8);
>> + }
>> +
>> + if (written == 3) {
>> + value |= 3 << 24;
>> + value |= BIT(26);
>> + mbox_send_message(tcu->tx, &value);
>>
> How is this supposed to work? tegra_hsp_doorbell_send_data() ignores
> the second argument.

The previous patch in the series adds support for what are called
"shared mailboxes" to the tegra-hsp driver. For these the second
argument is used.

Thanks,
Mikko

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