diff --git a/i2c_firmware/README.md b/i2c_firmware/README.md new file mode 100644 index 0000000..c952831 --- /dev/null +++ b/i2c_firmware/README.md @@ -0,0 +1,41 @@ +# OpenWRT 24.10.4 Firmware with GPIO I²C for GL.iNet XE300 + +Custom OpenWRT build enabling **GPIO-based I²C master** on the GL.iNet XE300 (QCA9531) using `i2c-gpio` driver and clean DTS integration. + +## Locate & Edit DTS + +target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts + +git clone https://git.openwrt.org/openwrt/openwrt.git +cd openwrt +git checkout v24.10.4 +./scripts/feeds update -a +./scripts/feeds install -a + +## Menu Config + +Target System: Atheros ATH79 +Target Profile: GL.iNet GL-XE300 +Kernel Modules → I2C Support: +kmod-i2c-core +kmod-i2c-gpio +Utilities → i2c-tools + +make -j$(nproc) + +## Test It + +ls /dev/i2c-* +i2cdetect -y 0 +cat /sys/kernel/debug/gpio +i2cdump -y 0 0x48 # Adjust address accordingly + + +Ubuntu 22.04+ build tools: + +```bash +sudo apt update && sudo apt install -y \ + build-essential clang flex bison g++ gawk gcc-multilib \ + g++-multilib gettext libncurses-dev libssl-dev python3 \ + python3-pip rsync unzip zlib1g-dev file wget git + diff --git a/i2c_firmware/openwrt-ath79-nand-glinet_gl-xe300-squashfs-factory.img b/i2c_firmware/openwrt-ath79-nand-glinet_gl-xe300-squashfs-factory.img new file mode 100644 index 0000000..1143be2 Binary files /dev/null and b/i2c_firmware/openwrt-ath79-nand-glinet_gl-xe300-squashfs-factory.img differ diff --git a/i2c_firmware/qca9531_glinet_gl-xe300.dts b/i2c_firmware/qca9531_glinet_gl-xe300.dts new file mode 100644 index 0000000..205fcbd --- /dev/null +++ b/i2c_firmware/qca9531_glinet_gl-xe300.dts @@ -0,0 +1,194 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca953x.dtsi" + +#include +#include +#include + +/ { + compatible = "glinet,gl-xe300", "qca,qca9531"; + model = "GL.iNet GL-XE300"; + + aliases { + label-mac-device = ð0; + }; + + gpio-export { + compatible = "gpio-export"; + + gpio_lte_power { + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + gpio-export,name = "lte_power"; + gpio-export,output = <1>; + }; + + gpio_sd_detect { + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + gpio-export,name = "sd_detect"; + gpio-export,output = <0>; + }; + }; + + keys { + compatible = "gpio-keys"; + + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + lan { + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + function = LED_FUNCTION_LAN; + color = ; + }; + + wan { + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + function = LED_FUNCTION_WAN; + color = ; + }; + + wlan { + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + function = LED_FUNCTION_WLAN; + color = ; + linux,default-trigger = "phy0tpt"; + }; + + lte { + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + label = "green:lte"; + }; + }; + + i2c_gpio: i2c@0 { + compatible = "i2c-gpio"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH + &gpio 4 GPIO_ACTIVE_HIGH>; + i2c-gpio,delay-us = <5>; + i2c-gpio,timeout-ms = <100>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + }; +}; + +&pcie0 { + status = "okay"; +}; + +&usb0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x10000>; + }; + + partition@50000 { + label = "art"; + reg = <0x50000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + compatible = "mac-base"; + reg = <0x0 0x6>; + #nvmem-cell-cells = <1>; + }; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + }; + }; + + partition@60000 { + label = "kernel"; + reg = <0x60000 0x400000>; + }; + + partition@460000 { + label = "nor_reserved"; + reg = <0x460000 0xba0000>; + }; + }; + }; + + flash@1 { + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0x8000000>; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy4>; + + nvmem-cells = <&macaddr_art_0 0>; + nvmem-cell-names = "mac-address"; +}; + +ð1 { + nvmem-cells = <&macaddr_art_0 1>; + nvmem-cell-names = "mac-address"; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; +}; +