Uboot for clearfog pro cn9130

Hy
I trie to add a mcp23017 to get some gpio.
I would liké to use thèse gpio since u-boot(i 3 LEDs and 2 buttons).

I know that uboot 2022 has the driver for.

But our clearfog cn9130 isn’t compatible with.
We must use uboot 2019.

I found a patch but i think it’s not for uboot 2019

https://patchwork.ozlabs.org/project/uboot/patch/20210715154000.92119-3-sebastian.reichel@collabora.com/

Someone has an Idea to allow the mcp23017 in uboot 2019?
Can we use the reset button for another option?

Thank by advance

I will take a look

Thank you :slight_smile:

Hy again :slight_smile:

For my project, i just need two buttons and 3 leds controllable from Uboot.

I can do it with the front Button.
But i can’ do anything with the hardware reset button and the leds.

The hardware reset button is a physical button and not controllable by software. It physically pulls the reset line to ground to reset the device.

1 Like

Thank you for the Informations.
I understand better.

The LEDs can’t be mangeable too i think.

I see a uboot for Marvell version 2022 here :

I tried to apply patches but get some errors(i know patches were for 2019 version), i tried to adapt manually too.

I am sorry I misunderstood and thought you were adding your own LEDs. Yes the LEDs on the board are all tied to existing hardware.

1 Like

You don’t misunderstood,
i try to add my own LEDs and m’y own buttons with the mcp23017. :slight_smile:

I just talk about LEDs on board because i tried to use them ^^

okay, so you have that connected via the i2c bus on the mikrobus header?

1 Like

Yes, i have connected thé mcp23017 to thé i2c of the mikrobus.
I Can see it with i2c commands(adresse used 0x20).

If i well understand, if i manage to install thé good driver i Can use the gpio of thé mcp23017 liké thé gpio of the front Button.

then you should just need to backport the driver to the BSP u-boot and include the proper device-tree entries to enable it.

1 Like

Can we manage GPIO of the mcp23017 by passing I2C?
Read state of button and change state of led.

I see commands i2c mw and i2c read

yes you should be able to use raw i2c to control the device

1 Like

thank you to help me :slight_smile:

I tried to understand the I2C command ( i’m not very good in I2C).

pinout are used like this :
gpb0 = button 1
gpb1 = button 2
gpa0 = led 1
gpa1 = led 2
gpa2 = led 3

Here the doc i use to have informations :

I have found a table with register addresses :

With all these informations i tried this command : have state of led1

i2c md 0x20 0x12h.0 0x01

0x20 for the chip
0x12h.0 to select gpa(0x12) 0(0)
0x01 for 1 byte

Am i in wrong?

Hy,
first happy new year 2023 :slight_smile:

need your help :slight_smile:

I use a fit system and disable the distroboot.

Here the error : Image too large: increase CONFIG_SYS_BOOTM_LEN

## Loading kernel from FIT Image at 06000000 ...
   Using 'conf-pro' configuration
   Trying 'kernel' kernel subimage
     Description:  Kernel
     Created:      2023-01-01  14:22:15 UTC
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x060000c0
     Data Size:    22893056 Bytes = 21.8 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x07000000
     Entry Point:  0x07000000
     Hash algo:    sha1
     Hash value:   70ff8a3b72d9f2c34a410816739e6c9cd3cfce17
   Verifying Hash Integrity ... sha1+ OK
## Loading fdt from FIT Image at 06000000 ...
   Using 'conf-pro' configuration
   Trying 'fdt-pro' fdt subimage
     Description:  dtb
     Created:      2023-01-01  14:22:15 UTC
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x075d53a0
     Data Size:    25105 Bytes = 24.5 KiB
     Architecture: AArch64
     Hash algo:    sha1
     Hash value:   d7ed5d18ecdc10761768f826e7e5e50f8a29a85b
   Verifying Hash Integrity ... sha1+ OK
   Booting using the fdt blob at 0x75d53a0
   Loading Kernel Image
**Image too large: increase CONFIG_SYS_BOOTM_LEN**
Must RESET board to recover
resetting ...

Here the config of my fit files :

/dts-v1/;
/ {
	description = "Kernel et dtb pour RescueOS";

	#address-cells = <1>;
	images {
		kernel {
			description = "Kernel";
			data = /incbin/("/a/Image");
			type = "kernel";
			arch = "arm64";
			os = "linux";
			compression = "none";
			load = <0x7000000>;
			entry = <0x7000000>;
			hash-1 {
				algo = "sha1";
			};
		};
		fdt-pro {
			description = "dtb";
			data = /incbin/("/a/diagbox_pro.dtb");
			type = "flat_dt";
			arch = "arm64";
			compression = "none";

			hash-1 {
				algo = "sha1";
			};
		};
		fdt-base {
			description = "dtb";
			data = /incbin/("/a/diagbox_base.dtb");
			type = "flat_dt";
			arch = "arm64";
			compression = "none";

			hash-1 {
				algo = "sha1";
			};
		};
	};
 
	configurations {
		default = "conf-pro";
		conf-pro {
			description = "Conf DiagBox pro";
			kernel = "kernel";
			fdt = "fdt-pro";
			hash-1 {
				algo = "sha1";
			};
		};
		conf-base {
			description = "Conf DiagBox base";
			kernel = "kernel";
			fdt = "fdt-base";
			hash-1 {
				algo = "sha1";
			};
		};
	};
};

I don’t see where is my mistake :frowning:

Thanks by advance

The default BOOTM length in our u-boot config is 256M. Is your Image larger than that? If it isn’t then most likely there is not enough space after the image load address to hold the full size of your image.

1 Like

Hy,

I have found my error.

Because i use a system with fit files,
i must modify the kernel address in uboot,
to load the file fit in another address than the Image and fdt address.