This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TMDXIDK5718: Setting GPIO in SPL

Part Number: TMDXIDK5718

Tool/software: Linux

Hi

Using Linux SDK 5.2 I'm trying to set a GPIO (GPIO4, bit 16) in SPL. In U-boot it works fine: I do " gpio set gpio@4805900016".

Now I try in U-boot SPL (using code from cmd/gpio.c)

rc = gpio_lookup_name("gpio@4805900016", NULL, NULL, &gpio);

this function returns -22. So I dug depper and found that this function is calling

int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc)
{
struct gpio_dev_priv *uc_priv = NULL;
struct udevice *dev;
ulong offset;
int numeric;
int ret;

numeric = isdigit(*name) ? simple_strtoul(name, NULL, 10) : -1;
for (ret = uclass_first_device(UCLASS_GPIO, &dev); dev; ret = uclass_next_device(&dev)) {
    int len;

    uc_priv = dev_get_uclass_priv(dev);

                 ....

I found out that "uclass_first_device(UCLASS_GPIO, &dev);" sets "dev" to 0 and then the function returns -EINVAL. So it seems that not a singe UCLASS_GPIO devices is registered.

In the device tree I have set:

&gpio4 {
u-boot,dm-spl;
};

So I would expect that at least this GPIO should be in the list..

What am I doing wrong?

Best regards, Chris