VoCore: Two UARTs

Enable two UARTs for VoCore, one UART lite, one UART full.
Just need to change DTS a little:(VOCORE.dts under openwrt source code)

First, enable uart@500

uart@500 {
    status = "okay";
};

Then, remove uartf from ralink,group:gpio.

pinctrl {
    state_default: pinctrl0 {
        gpio {
            ralink,group = "jtag", "led"; -> remove "uartf"
            ralink,function = "gpio";
        };
    };
};

Finally, delete the code that export uartf as gpio:
in gpio-export section, remove gpio7, gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14. If we keep them will get some error in log, but no effect to system boot.
PS: find a possible bug here, gpio10 and gpio11 are missed :)

Now good news is the two UARTs work same time, bad news is we lose eight gpio. 😉
Hope one day a hero will make a new rt5350-uart driver, so that allows ralink-function=”uartf,gpio”, then we can save 4 gpios. It is a good chance to practise Linux driver code. 😀

2 thoughts on “VoCore: Two UARTs

  1. Hi,
    To get the added functionality, just patch the driver, pinctrl-rt2880.c:

    if (func == 0) {
    int i;

    mode |= p->groups[group].gpio <groups[group].shift;
    /* mark the pins as gpio */
    for (i = 0; i groups[group].func[0].pin_count; i++)
    p->gpio[p->groups[group].func[0].pins[i]] = 1;
    – } else {
    + }
    + /* combined uartf and gpio function */
    + else if ((p->groups[group].name == “uartf”) && (p->func[func]->pin_count == 4)) {
    + int i, first_gpio_pin;
    +
    mode |= p->func[func]->value <groups[group].shift;
    + if (p->func[func]->pin_first == 7) {
    + first_gpio_pin = p->func[func]->pin_first + 4;
    + }
    + else {
    + first_gpio_pin = p->func[func]->pin_first – 4;
    + }
    + /* mark the pins as gpio */
    + for (i = first_gpio_pin; i gpio[i] = 1;
    }
    + /* other */
    + else {
    + mode |= p->func[func]->value <groups[group].shift;
    + }
    +
    rt_sysc_w32(mode, SYSC_REG_GPIO_MODE);

    and the rt5350.dtsi:
    uartf_pins: uartf {
    uartf {
    ralink,group = “uartf”;
    – ralink,function = “uartf”;
    + ralink,function = “gpio uartf”;
    };
    };

    Tested on the HLK-RM04, also running on the rt5350.

    Cheers,
    Fredrik

Comments are closed.