-
Posts
356 -
Joined
-
Last visited
Content Type
Forums
Store
Crowdfunding
Applications
Events
Raffles
Community Map
Everything posted by Nick A
-
You are right there is calibration code here. static int ccu_iosc_32k_prepare(struct clk_hw *hw) { struct ccu_common *cm = hw_to_ccu_common(hw); u32 val; if (!have_iosc_calibration) return 0; val = readl(cm->base + IOSC_CLK_CALI_REG); writel(val | IOSC_CLK_CALI_EN | IOSC_CLK_CALI_SRC_SEL, cm->base + IOSC_CLK_CALI_REG); return 0; } static void ccu_iosc_32k_unprepare(struct clk_hw *hw) { struct ccu_common *cm = hw_to_ccu_common(hw); u32 val; if (!have_iosc_calibration) return; val = readl(cm->base + IOSC_CLK_CALI_REG); writel(val & ~(IOSC_CLK_CALI_EN | IOSC_CLK_CALI_SRC_SEL), cm->base + IOSC_CLK_CALI_REG); } static unsigned long ccu_iosc_32k_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { struct ccu_common *cm = hw_to_ccu_common(hw); u32 val; if (have_iosc_calibration) { val = readl(cm->base + IOSC_CLK_CALI_REG); /* Assume the calibrated 32k clock is accurate. */ if (val & IOSC_CLK_CALI_SRC_SEL) return LOSC_RATE; } val = readl(cm->base + IOSC_32K_CLK_DIV_REG) & IOSC_32K_CLK_DIV; return parent_rate / IOSC_32K_PRE_DIV / (val + 1); } static unsigned long ccu_iosc_32k_recalc_accuracy(struct clk_hw *hw, unsigned long parent_accuracy) { struct ccu_common *cm = hw_to_ccu_common(hw); u32 val; if (have_iosc_calibration) { val = readl(cm->base + IOSC_CLK_CALI_REG); /* Assume the calibrated 32k clock is accurate. */ if (val & IOSC_CLK_CALI_SRC_SEL) return 0; } return parent_accuracy; } So I was looking at the code and I believe it's not the way the user manual calibrates the internal 32kHz clock.. I think it has to do with this. "One major difference regarding the H6 is the 24 MHz crystal is now routed through the RTC, as a digitally compensated oscillator (DCXO). This is not covered in this patch and will be supported later. Other differences are either unrelated to RTC or clock functionality, such as boot or crypto related registers, or the driver simply doesn't use the feature in question. One example of the latter is the calibration function for the RC oscillator. We consider this clock to be very bad and avoid using it." https://patchwork.kernel.org/project/linux-arm-kernel/patch/20181128093013.24442-7-wens@csie.org/ This code seems to be using the prescaler. IOSC_32K_PRE_DIV.
-
I found more information on 32kHz clock. Starting at page 275. https://www.scs.stanford.edu/~zyedidia/docs/allwinner/h616.pdf 3.13.3.4.6. RC Calibration The basic circuit of RC calibration is shown in Figure 3-39. Whether to output the calibrated RC clock can be selected by the RC_Cali_SEL control bit, the calibration principle is as follows. http://nskhuman.ru/allwinner/h616reglist.php?nreg=153 3.13.3.5.3. Fanout Set the bit0 of 32K_FANOUT_GATING_REG to 1, and ensure that external pull-up resistor and voltage are normal, then 32.768 kHz fanout square wave can be output. Fanout: The clock source of fanout can select RTC_32K, or 32K divided by PLL_PERI(2X), or 32K divided by HOSC. http://nskhuman.ru/allwinner/h616reglist.php?nreg=161 /* * There are other differences between models, including: * * - number of GPIO pins that can be configured to hold a certain level * - crypto-key related registers (H5, H6) * - boot process related (super standby, secondary processor entry address) * registers (R40, H6) * - SYS power domain controls (R40) * - DCXO controls (H6) * - RC oscillator calibration (H6) * * These functions are not covered by this driver. */ I guess there's no function to calibrate the internal RC oscillator yet. https://github.com/torvalds/linux/blob/master/drivers/rtc/rtc-sun6i.c This is the 32K_FANOUT_GATING_REG. #define SUN6I_LOSC_OUT_GATING 0x0060 rtc->ext_losc = clk_register_gate(NULL, clkout_name, init.name, 0, rtc->base + SUN6I_LOSC_OUT_GATING, SUN6I_LOSC_OUT_GATING_EN_OFFSET, 0, &rtc->lock); If we can find out which clock source we are using and change it to something more accurate? All though, Calibrating the RTC is the ideal solution. On these cheap boxes there is no external 32KHz oscillator.
-
I added HDMI audio patches and some other various fixes to my build. You can find the new images here. https://armdev.pixeldrift.net/transpeed/8k618-t/
-
Maybe you can try loading the original firmware .bin and .txt from android. If that fails try asking the sunxi linux guys for help. https://oftc.irclog.whitequark.org/linux-sunxi/
-
The current code for transpeed wifi is wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; clocks = <&rtc CLK_OSC32K_FANOUT>; clock-names = "ext_clock"; pinctrl-0 = <&x32clk_fanout_pin>; pinctrl-names = "default"; reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */ }; x32clk_fanout_pin: x32clk-fanout-pin { pins = "PG10"; function = "clock"; }; Search online I found this.. https://oftc.irclog.whitequark.org/linux-sunxi/2023-04-03 10:45 <warpme> so it looks wifi lpo is wired to PG10? 10:45 <apritzel> warpme: without a schematic I guess it's the best we can hope for. Take those Allwinner Android DTs with a grain of salt though. 10:48 <apritzel> looks like it: if you program PG10 to use mux 3, it will spit out the 32KHz clock on that pin, so you can use that where ever you need a 32KHz clock 10:57 <warpme> indeed: in android dt i see "allwinner,muxsel = <0x03>;" Can i use such entry also in mainline 6.2 dts? 10:59 <apritzel> no, not directly, but you can use something equivalent 11:01 <apritzel> we describe mux 3 for PG10 as "clock", so you describe that pin in a child of the pinctrl node (like all the other pins), and say: function = "clock"; 11:02 <apritzel> and then reference this in your .dts, in the respective pinctrl-0 property 11:03 <apritzel> that should be in the wifi device's node, not in the mmc1 node, but I am not 100% sure that works 11:07 <warpme> so for pindef: will this be ok: https://pastebin.com/4eSuDYRL line380 ? 11:12 <warpme> and for dts: https://pastebin.com/37tUnZu9 line186? 11:13 <apritzel> yes, that's what I meant TanixTX6s-axp313 has the same wifi code as Vontar. Tanix uses firmware (ap6330@SDIO) where as the Vontar uses (ap6334@SDIO). This is the wifi code for Tanix and Vontar. https://github.com/warpme/minimyth2/blob/master/script/kernel/linux-6.6/files/0633-arm64-dts-allwinner-h616-add-Tanix-TX6s-axp313-TVbox.patch https://github.com/warpme/minimyth2/blob/master/script/kernel/linux-6.6/files/0637-arm64-dts-allwinner-h618-add-vontar-h618-TVbox.patch wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; clocks = <&rtc CLK_OSC32K_FANOUT>; clock-names = "ext_clock"; pinctrl-names = "default"; pinctrl-0 = <&clk_losc>; /* PG10 with MUX3 set */ }; clk_losc: clk-losc { pins = "PG10"; function = "clock"; }; I guess clk-losc is defined in another file where it sets the MUX3. https://mjmwired.net/kernel/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml Orange pi 3/2/2w also have similar code for wifi. But they reset-gpios and add a power-on delay. https://github.com/warpme/minimyth2/blob/7a38452780ca72c198d75b9ca5fccb0c307e5b81/script/kernel/linux-6.5/files/0638-arm64-dts-allwinner-h618-add-opi-2w.patch#L113 wifi_pwrseq: wifi-pwrseq { compatible = "mmc-pwrseq-simple"; clocks = <&rtc CLK_OSC32K_FANOUT>; clock-names = "ext_clock"; pinctrl-names = "default"; pinctrl-0 = <&clk_losc>; /* PG10 with MUX3 set */ reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */ post-power-on-delay-ms = <200>; }; You probably need this patch too. 0110-drivers-net-wireless-brcmfmac-add-ap6330-firmware.patch diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index a907d7b06..ec71996c7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -619,13 +619,17 @@ BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); +/* AMPAK */ +BRCMF_FW_DEF(AP6330, "brcmfmac-ap6330-sdio"); + static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0), BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4), BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5), BRCMF_FW_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329), - BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330), + BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFEF, 4330), + BRCMF_FW_ENTRY(BRCM_CC_4330_CHIP_ID, 0x10, AP6330), BRCMF_FW_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334), BRCMF_FW_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340), BRCMF_FW_ENTRY(BRCM_CC_43341_CHIP_ID, 0xFFFFFFFF, 43340), Try the Vontar image again and see if you are getting a 32Khz clock? You can use my linux kernel dts with these changes and compile a new image using my build. Adding your box to the build/config/boards as a .wip would be even better.
-
I got the ethernet patch to work. You can find them here. Use the latest 6.7.9 kernel images. https://armdev.pixeldrift.net/transpeed/8k618-t/
-
The TanixTX6s-axp313 has the same wifi chip. Try using the miniarch image for TanixTX6s-axp313. https://github.com/warpme/miniarch/releases/download/v20240209/MiniArch-20231112-6.7.4-board-h616.tanix_tx6s_axp313-SD-Image.img.xz
-
Try using the brcmfmac4330-sdio .bin and .txt files from here. Just place them in /lib/firmware/brcm. The kernel messages should tell you the exact name it's looking for. Do you have any other brcmfmac messages in your log file? https://github.com/LibreELEC/brcmfmac_sdio-firmware/tree/master I haven't added the ethernet patches for the armbian transpeed yet. Haven't been able to get it to work. I'll look at it again sometime this week.
-
Thanks Hexdump. You are right. I found this http://warped.inet2.org/pkg/minimyth2-garchive/u-boot-h616-v2024.01-2024.01/. Looks like the latest patches for u-boot and http://warped.inet2.org/pkg/minimyth2-garchive/linux-6.7.4/ kernel patches.
-
Switching off LED lights on TV Box Lemfo HK1 Rbox
Nick A replied to stev77's topic in Allwinner CPU Boxes
🤣 -
Nitrolark, Miniarch already has done the hard work for you. Like adding patches to u-boot and the linux kernel to support your TV Box. Arch linux is a simple, lightweight distribution. Warpme choose this distro to run mythtv2 on TV Boxes because he didn't need a full linux distro. Here is the official Arch Linux for arm. https://archlinuxarm.org/platforms/armv8/allwinner/pine64 This is the installation guide for pine64. This is the only Arm64 board supported right now. You need the u-boot from tanix_tx6s_axp313_defconfig and a linux kernel that has the vontar patches. https://linux-sunxi.org/U-Boot https://linux-sunxi.org/Mainline_Kernel_Howto Then use the rootfs from Archlinuxarm. wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C root ArchLinuxARM-aarch64-latest.tar.gz rootfs might only have the minimal packages needed to run the Arch distro anyways. You probably have to spend a lot of time adding packages like Rick0cm did on his box. I think it would be easier to add Vontar to Armbian. Armbian Build Tools has everthing you need to make a custom server or desktop image. The reason I suggested Miniarch was because Warpme already has all the lastest patches for our boards. Applying them to Armbian can be pain because you have patches that are from older kernel and u-boot versions. Also, you have to work with patches from other boards that have been mainlined in Armbian that might have changed the source code you are trying to patch. Most of the patches will give you Hunk FAILED errors. You might get lucky with some of patches. Understanding C programming and Linux source is needed to get these patches to work.
-
Rick0cm, I think you have a vontar board maybe the manufacturer mistakenly used a transpeed cover. This is the vontar patch miniarch uses. We can apply that to Armbian. https://github.com/warpme/minimyth2/blob/master/script/kernel/linux-6.6/files/0637-arm64-dts-allwinner-h618-add-vontar-h618-TVbox.patch Some other patches maybe needed for the vontar patch to work. Like openvfd. https://github.com/warpme/minimyth2/tree/master/script/kernel/linux-6.6/files We can add vontar to the "build/config/boards" as WIP (Work In Progress). Since it uses a different wifi than transpeed. U-boot patches are here but I don't see one for vontar. Looks like vontar uses the tanix tx6s axp313 defconfig. The Makefile has "export mm_U-BOOT_BOARD_TYPE = tanix_tx6s_axp313_defconfig". https://github.com/warpme/minimyth2/tree/master/script/bootloaders/u-boot-h616/files https://github.com/warpme/minimyth2/blob/master/script/bootloaders/board-h618.vontar_h618/Makefile https://github.com/warpme/minimyth2/blob/master/script/bootloaders/u-boot-h616/files/53-add-tanix_tx6s_axp313_defconfig.patch When I have time.. I'll try to get vontar in the wip boards menu to build armbian.
-
First clone my build. git clone https://github.com/NickAlilovic/build.git Patches are located in the "build/patch/kernel/archive/sunxi-6.7/patches.armbian/" directory. If you are adding new patches you need to include them in these two files "build/patch/kernel/archive/sunxi-6.7/series.armbian" and "build/patch/kernel/archive/sunxi-6.7/series.conf". Compile a transpeed image. ./compile.sh In the choose board menu click on "Show CSC/WIP/EOS/TVB" option then choose "transpeed-8k618-t". Choose "bleeding edge", "bookworm", server or desktop doesn't matter. Any desktop environment. Any software. Your image should be in the output directory when it's done compiling. You can see if the patches have been applied properly in the "/build/output/logs" directory. (Note next step is for more advanced users.) If you want to create your own patch. You can find the patched kernel source code in "build/cache/sources/linux-kernel-worktree/6.7__sunxi64__arm64" directory. Go into your kernel source directory and execute these commands. git add . git commit --signoff Now you are ready to edit the patched kernel and add your own code. After you are done editing the source code execute these commands. git status git add path/to/the/file/you/just/edited git commit --signoff git format-patch -1 You should see your new patches created in the kernel source directory. Move them to "build/patch/kernel/archive/sunxi-6.7/patches.armbian/" directory. Edit the files "build/patch/kernel/archive/sunxi-6.7/series.armbian" and "build/patch/kernel/archive/sunxi-6.7/series.conf" to include your new patches. U-boot patches are in "build/patch/u-boot/u-boot-sunxi" directory. No need to edit conf files to apply them. You can find the patched source code in "build/cache/sources/u-boot-worktree/u-boot/v2024.01" directory. git add . git commit --signoff Edit the source code. git status git add path/to/the/file/you/just/edited git commit --signoff git format-patch -1 When your patch is created move them to "build/patch/u-boot/u-boot-sunxi".
-
Hi Rick0cm Looking at your board again I can see you have a different Wifi chip then mine. Try Miniarch with the Vontar Box image. It's very similar to the Transpeed box but it has the same Wifi chip as yours. https://github.com/warpme/miniarch/releases/download/v20240209/MiniArch-20231112-6.7.4-board-h618.vontar_h618-SD-Image.img.xz . Follow the install guide here. https://github.com/warpme/miniarch?tab=readme-ov-file For serial console I use gtkterm in linux. sudo gtkterm -p /dev/ttyUSB0 -s 115200
-
Already in the deconfig file. +CONFIG_MMC_SUNXI_SLOT_EXTRA=2 This maybe a bigger issue. https://github.com/apritzel/u-boot/issues/7
-
I would avoid installing this to internal emmc until we have a copy of the original firmware.
-
Yes! That is what I was looking at right now. Thanks iun cuim. I was stuck on the 100mbps ethernet. But it seems Warpme got it working. So I'm going to focus on his patches and see if I can get Transpeed working on Armbian. I got this TV Box a month ago and I didn't know Warpme already did most of the hard work.
-
No they boot fine... I was building mostly Desktop images. But it would be great to have both Desktop and Server images. I prefer Desktop because I want to get the most out of this TV Box. Hopefully, after we are done we can have decent Hardware acceleration. Using the V4L2.
-
After you flashed the image to your sdcard. Remember to rename the wifi firmware "brcmfmac4335-sdio.bin" to "brcmfmac4335-sdio.transpeed,8k618-t.bin". Then copy both "brcmfmac4335-sdio.transpeed,8k618-t.bin" and "brcmfmac4335-sdio.txt" to /lib/firmware/brcm directory on your sdcard. I'll automate the process in future builds. https://github.com/LibreELEC/brcmfmac_sdio-firmware/blob/master/brcmfmac4335-sdio.bin and https://github.com/LibreELEC/brcmfmac_sdio-firmware/blob/master/brcmfmac4335-sdio.txt
-
Most of the patches were taken from orangepi zero3 with very minimal changes. Andre Przywara gave me his transpeed-8k618-t_defconfig. The DRAM settings were the same as mine. He knew more about the config options than I do. So I kept his defconfig. He also gave me the code in dts to get wifi working. wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; clocks = <&rtc CLK_OSC32K_FANOUT>; clock-names = "ext_clock"; pinctrl-0 = <&x32clk_fanout_pin>; pinctrl-names = "default"; reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */ }; &mmc1 { vmmc-supply = <®_dldo1>; vqmmc-supply = <®_aldo1>; mmc-pwrseq = <&wifi_pwrseq>; bus-width = <4>; non-removable; status = "okay"; sdio_wifi: wifi@1 { reg = <1>; }; }; This requires an addition to the h616.dtsi file, at the end of the "pio: pinctrl@300b000" node, to introduce the CLK fanout pin: x32clk_fanout_pin: x32clk-fanout-pin { pins = "PG10"; function = "clock"; }; Here's a irc chat log of Andre and Jernej talking about the transpeed wifi. A lot of good information in these chats. https://oftc.irclog.whitequark.org/linux-sunxi/2023-12-14
-
Hi Mag911 Awesome, I was hoping my posts would help others with boxes based on the H618. Like ag123 pointed out. There are a lot of boxes that are similar but with different configurations. If I can post enough information and steps on how to setup these boxes we can get enough of them up and running. These boxes are now adding more RAM and larger eMMC's. I think it's a good time to support Armbian development on TV boxes. The original Android that came with this box was very basic. It wouldn't allow me to install most the apps I wanted. So I decided to hack it. Is HDMI and WIFI now working on your box?
-
I found the wifi firmware needed for this box. Download and rename the file to "brcmfmac4335-sdio.transpeed,8k618-t.bin". Place it in /lib/firmware/brcm. https://github.com/LibreELEC/brcmfmac_sdio-firmware/blob/master/brcmfmac4335-sdio.bin Also needs the brcmfmac4335-sdio.txt. No need to rename it just place it in /lib/firmware/brcm. https://github.com/LibreELEC/brcmfmac_sdio-firmware/blob/master/brcmfmac4335-sdio.txt
-
I only used the BRCMFMAC driver... I guess your BCMDHD driver might read the nvram_bcm4335.txt correctly. It could be an issue with BRCMFMAC. If not try the brcmfmac4335-sdio.txt. Both nvram_bcm4335.txt and brcmfmac4335-sdio.txt are very similar. It's the config file for the firmware.bin. I'll setup BCMDHD on my box and see if the original nvram_bcm4335.txt works.
-
I tried the /vendor/etc/firmware/nvram_bcm4335.txt and /vendor/etc/firmware/firmware/bcm4335b0_ag that came with my android box. But it didn't work. When I used the brcmfmac4335-sdio.txt from LibreELEC. Everything worked. Didn't matter which firmware.bin I used (I tried bcm4335b0_ag, LibreELEC and Original Linux Kernel firmware.bin). I think there may be a problem with nvram_bcm4335.txt. Something is missing. Right now, I'm changing the values in brcmfmac4335-sdio.txt because the values in nvram_bcm4335.txt might be more optimal. I'm not sure how armbian rockchip loads your drivers. but if your patches are correct and the wifi still doesn't load. Try the brcmfmac4335-sdio.txt from LibreELEC. Worth a try. It worked for me.
-
The HK2735M wifi chip is compatible to the bcm4335. the Linux driver is brcmfmac, controlled by kernel config CONFIG_BRCMFMAC_SDIO and CONFIG_BRCMFMAC. The driver expects the firmware files brcmfmac4335-sdio.bin (may need to rename the file, the driver tells you the filename it was looking for) and brcmfmac4335-sdio.txt under /lib/firmware/brcm I'm using a different TV Box. Transpeed 8K618-T TV box. I had some success with the firmware files from https://github.com/LibreELEC/brcmfmac_sdio-firmware/blob/master/. You may need to patch your DT to enable wifi. Haven't checked your DT for your box yet.