And second the user @mad_ady for his very detailed thread of setting up Home-Assistant.
Not to forget the user @igorpec for his work to bring Armbian to Odroid C1.
First I installed a working Armbian image that comes with a 5.x kernel.
Here I repeat the steps to compile and install the mainline kernel:
Code: Select all
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export PATH=/path/to/jour/toolchain/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin:$PATH
make odroidc1_defconfig
make -j 4 LOADADDR=0x00208000 uImage dtbs modules
kver=`make kernelrelease`
sudo echo ${kver} > ../kernel.release
#put the sdcard to your host computer
#and copy the needed files to it
sudo mkdir /path/to/sdcard/boot/mainline
sudo cp arch/arm/boot/uImage arch/arm/boot/dts/meson8b-odroidc1.dtb /path/to/sdcard/boot/mainline
sudo make modules_install ARCH=arm INSTALL_MOD_PATH=/path/to/sdcard/boot/mainline
sudo cp .config /path/to/sdcard/boot/mainline/config-${kver}
sudo cp ../kernel.release /path/to/sdcard/boot/mainline
#this copies all relevant files
#then put the sdcard to the C1 and boot
#on the C1:
cd /boot/mainline
VERSION=$(cat kernel.release)
sudo update-initramfs -c -k ${VERSION}
sudo mkimage -A arm -O linux -T ramdisk -a 0x0 -e 0x0 -n ../initrd.img-${VERSION} -d ../initrd.img-${VERSION} ../uInitrd-${VERSION}
Code: Select all
# Booting
ext4load mmc 0:1 0x21000000 /boot/mainline/uImage
ext4load mmc 0:1 0x22000000 /boot/uInitrd-5.2.0-rc6
ext4load mmc 0:1 0x21800000 /boot/mainline/meson8b-odroidc1.dtb
#mainline kernel
#ext4load mmc 0:1 0x21800000 /boot/dtb/meson8b-odroidc1.dtb
In the mainline kernel there are missing reasonable values in /proc/cpuinfo:
Code: Select all
...
Hardware : Amlogic Meson platform
Revision : 0000
Serial : 0000000000000000
Code: Select all
...
Hardware : ODROIDC
Revision : 000a
Serial : 1b00000000000001
Code: Select all
diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
index f3ad939..8892151 100644
--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
+++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
@@ -52,6 +52,10 @@
model = "Hardkernel ODROID-C1";
compatible = "hardkernel,odroid-c1", "amlogic,meson8b";
+ hardware = "ODROIDC";
+ serial-number = "1b00000000000001";
+ revision = <0x000a>;
+
aliases {
serial0 = &uart_AO;
mmc0 = &sd_card_slot;
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index d0a464e..b54a855 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -99,6 +99,9 @@ EXPORT_SYMBOL(system_serial);
unsigned int system_serial_low;
EXPORT_SYMBOL(system_serial_low);
+const char *system_hardware;
+EXPORT_SYMBOL(system_hardware);
+
unsigned int system_serial_high;
EXPORT_SYMBOL(system_serial_high);
@@ -959,6 +962,23 @@ static int __init init_machine_late(void)
system_serial_high,
system_serial_low);
+ if (root) {
+ ret = of_property_read_u32(root, "revision",
+ &system_rev);
+ if (ret)
+ system_rev = 0x0000;
+ }
+
+ if (root) {
+ ret = of_property_read_string(root, "hardware",
+ &system_hardware);
+ if (ret)
+ system_hardware = NULL;
+ }
+
+ if (!system_hardware)
+ system_hardware = machine_name;
+
return 0;
}
late_initcall(init_machine_late);
@@ -1295,7 +1315,7 @@ static int c_show(struct seq_file *m, void *v)
seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15);
}
- seq_printf(m, "Hardware\t: %s\n", machine_name);
+ seq_printf(m, "Hardware\t: %s\n", system_hardware);
seq_printf(m, "Revision\t: %04x\n", system_rev);
seq_printf(m, "Serial\t\t: %s\n", system_serial);
Code: Select all
sudo fdtput -t s /boot/mainline/meson8b-odroidc1.dtb / serial-number 1b00000000000002
It took while to find the right values for the devicetree. And there is still a unsolved problem. After apply of following patch to the devicetree I have the
/dev/i2c-0
that serve the pins 3 and 5, and the /dev/i2c-1
that serve the pins 27 and 28. With the kernel 3.10.107 this is different, the device numbering of the i2c start with 1 and so the wiringPi is searching the i2c-1 device.I haven't found a solution yet. One possible solution would be to modify wiringPi only for Odroid C1 using mainline kernel, to use the i2c-0 device.
i2c-patch:
Code: Select all
diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
index 8892151..c1d6e40 100644
--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
+++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
@@ -313,6 +313,25 @@
};
};
+&i2c_A {
+ status = "okay";
+ clock-frequency = <100000>;
+ pinctrl-0 = <&i2c_a_pins>;
+ pinctrl-names = "default";
+};
+
+&i2c_B {
+ status = "okay";
+ clock-frequency = <100000>;
+ pinctrl-0 = <&i2c_b0_pins>;
+ pinctrl-names = "default";
+ ds3231@68 {
+ compatible = "dallas,ds1307";
+ reg = <0x68>;
+ status = "okay";
+ };
+};
+
&ir_receiver {
status = "okay";
pinctrl-0 = <&ir_recv_pins>;
diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi
index 800cd65..5831437 100644
--- a/arch/arm/boot/dts/meson8b.dtsi
+++ b/arch/arm/boot/dts/meson8b.dtsi
@@ -397,6 +397,14 @@
bias-disable;
};
};
+
+ i2c_b0_pins: i2c-b {
+ mux {
+ groups = "i2c_sda_b0", "i2c_sck_b0";
+ function = "i2c_b";
+ bias-disable;
+ };
+ };
};
};
For some days or even weeks I will test if the i2c reads and writes are without errors. The background is that on my installed C1 with kernel 3.10.107 the i2c from time to time hangs and I have to reboot (every 3 ...4 months).