# Uboot for clearfog pro cn9130

**URL:** <https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550>\
**Category:** OCTEON CN9130\
**Created:** [December 27, 2022, 9:51pm UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550 "2022-12-27T21:51:28Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 27, 2022, 9:51pm UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/1 "2022-12-27T21:51:28Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [December 28, 2022, 12:59pm UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/2 "2022-12-28T12:59:27Z")

</div>

I will take a look

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 28, 2022, 3:40pm UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/3 "2022-12-28T15:40:54Z")

</div>

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 28, 2022, 4:57pm UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/4 "2022-12-28T16:57:29Z")

</div>

Hy again 🙂

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.

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [December 29, 2022, 7:06am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/5 "2022-12-29T07:06:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 29, 2022, 7:30am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/6 "2022-12-29T07:30:14Z")

</div>

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 :

> **[drivers/gpio · next · U-Boot / Custodians / Marvell ARM architecture U-Boot...](https://source.denx.de/u-boot/custodians/u-boot-marvell/-/tree/next/drivers/gpio)**
>
> Marvell (MVEBU & Kirkwood) ARM architecture

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

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [December 29, 2022, 7:49am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/7 "2022-12-29T07:49:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 29, 2022, 7:57am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/8 "2022-12-29T07:57:45Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [December 29, 2022, 8:00am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/9 "2022-12-29T08:00:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 29, 2022, 8:06am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/10 "2022-12-29T08:06:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [December 29, 2022, 8:27am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/11 "2022-12-29T08:27:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 29, 2022, 9:28am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/12 "2022-12-29T09:28:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [December 29, 2022, 9:29am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/13 "2022-12-29T09:29:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [December 29, 2022, 10:09am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/14 "2022-12-29T10:09:36Z")

</div>

thank you to help me 🙂

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 :

> **[MCP23017-Data-Sheet-DS20001952.pdf](https://ww1.microchip.com/downloads/aemDocuments/documents/APID/ProductDocuments/DataSheets/MCP23017-Data-Sheet-DS20001952.pdf)**
>
> 995.46 KB

I have found a table with register addresses :

 ![Sans titre](https://europe1.discourse-cdn.com/flex005/uploads/solid_run/original/1X/c988b47921c0705e8b05e5b4d9f32d024b42a0d8.jpeg)

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?

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [January 1, 2023, 4:22pm UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/15 "2023-01-01T16:22:06Z")

</div>

Hy,  
first happy new year 2023 🙂

need your help 🙂

I use a fit system and disable the distroboot.

Here the error : **Image too large: increase CONFIG\_SYS\_BOOTM\_LEN**

```auto
## 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 :

```auto
/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 ☹

Thanks by advance

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [January 2, 2023, 8:32am UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/16 "2023-01-02T08:32:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![doudootiana](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@doudootiana](https://community.solid-run.com/u/doudootiana)\
**Post date:** [January 3, 2023, 8:07pm UTC](https://community.solid-run.com/t/uboot-for-clearfog-pro-cn9130/550/17 "2023-01-03T20:07:52Z")

</div>

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.
