Skip to content

linux-rk35xx-vendor: Add and enable LTE em05 driver ( Enables support for WWAN cards in Rock 5T/5B+ ) #8484

Merged
igorpecovnik merged 5 commits intoarmbian:mainfrom
rafayahmed317:add-and-enable-lte-em05-driver
Aug 15, 2025
Merged

linux-rk35xx-vendor: Add and enable LTE em05 driver ( Enables support for WWAN cards in Rock 5T/5B+ ) #8484
igorpecovnik merged 5 commits intoarmbian:mainfrom
rafayahmed317:add-and-enable-lte-em05-driver

Conversation

@rafayahmed317
Copy link
Copy Markdown
Contributor

@rafayahmed317 rafayahmed317 commented Aug 11, 2025

Description

To enable the Quectel EM05 card on Radxa Rock 5T and Rock 5B+, the lte_em05 driver is needed. It's been added to both JoshuaRiek's linux-rockchip and the radxa upstream. The patch added here is from JoshuaRiek's image. Also to build the driver a kernel config flag is required which has been added.

Depends on armbian/linux-rockchip#383

Documentation summary for feature / change

Please delete this section if entry to main documentation is not needed.

If documentation entry is predicted, please provide key elements for further implementation into main documentation and set label to "Needs Documentation". You are welcome to open a PR to documentation or you can leave following information for technical writer:

  • Add and enable LTE em05 driver
  • Enables support for WWAN cards in Rock 5T/5B+
  • lsusb with this patch should return:
    Bus 003 Device 005: ID 2c7c:0512 Quectel Wireless Solutions Co. , Ltd. EM12-G

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

  • Booted the image off sdcard and the lsusb output showed the card entry.
  • Installed the standalone kernel on an official image with same results as above.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Adds support for the Quectel M2 WWAN card on the Rock 5T/5B+.
Enables the lte_rm310 and lte_em05 drivers (drivers/net/lte/).
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Aug 11, 2025

Walkthrough

Enables three kernel configuration flags in config/kernel/linux-rk35xx-vendor.config: CONFIG_LTE=y, CONFIG_LTE_RM310=y, and CONFIG_LTE_EM05=y. These entries are added after the comment line indicating IEEE802154 drivers are not set. No other files or lines are changed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added 08 Milestone: Third quarter release size/large PR with 250 lines or more Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Aug 11, 2025
@rafayahmed317
Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a65a5e8 and c2c9aa7.

⛔ Files ignored due to path filters (1)
  • patch/kernel/rk35xx-vendor-6.1/net-lte-add-lte-em05-driver.patch is excluded by !patch/**
📒 Files selected for processing (1)
  • config/kernel/linux-rk35xx-vendor.config (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
config/kernel/linux-rk35xx-vendor.config (1)
lib/functions/compilation/armbian-kernel.sh (7)
  • armbian_kernel_config__enable_docker_support (205-336)
  • armbian_kernel_config__disable_various_options (70-100)
  • armbian_kernel_config_apply_opts_from_arrays (418-448)
  • kernel_config_set_y (380-384)
  • armbian_kernel_config__enable_zram_support (182-192)
  • armbian_kernel_config__netkit (46-53)
  • kernel_config_set_val (409-414)
🔇 Additional comments (2)
config/kernel/linux-rk35xx-vendor.config (2)

904-906: Avoid driver binding conflicts with generic USB modem drivers; fix doc example

Generic support for Quectel WWANs (USB_SERIAL_OPTION, USB_NET_QMI_WWAN, USB_NET_CDC_MBIM) is already enabled here. If the new EM05/RM310 driver claims the same USB IDs, it can steal binding from option/qmi_wwan and regress other modules. Please confirm IDs and driver bind order, or limit IDs via new_id only when needed.

Also, the documentation “expected lsusb” example shows 2c7c:0512 (EM12-G), while the PR title targets EM05; please update to an EM05-specific ID or clarify.


904-906: Confirm vendor kernel includes these Kconfig symbols and driver patches

The defconfig enables three vendor-specific options—CONFIG_LTE, CONFIG_LTE_EM05 and CONFIG_LTE_RM310—but our repo doesn’t include the rk35xx-vendor kernel tree to verify their definitions or driver wiring. If those symbols aren’t defined in the kernel’s Kconfig files, or the corresponding driver patches (Makefile entries, source under drivers/usb/…, USB ID 0x2c7c, etc.) aren’t applied, scripts/config will fail and the build will break.

Please manually verify in your rk35xx-vendor kernel source that:

  • Each symbol (LTE, LTE_EM05, LTE_RM310) is declared in a Kconfig file.
  • The drivers are wired in the kernel Makefiles (obj-$(CONFIG_LTE_…) += …).
  • The USB device IDs (e.g. 0x2c7c) don’t collide with existing option/qmi_wwan entries.

Comment on lines +904 to +906
CONFIG_LTE=y
CONFIG_LTE_RM310=y
CONFIG_LTE_EM05=y
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Prefer modules over built-ins for vendor LTE drivers; consider limiting scope to EM05 only

Setting these vendor LTE drivers built-in (=y) increases kernel size and makes them always resident. Armbian typically ships peripheral device support as modules. Also, if this PR is specifically for EM05, enabling RM310 may be unnecessary and could introduce driver binding conflicts.

Recommend:

  • Build as modules (=m).
  • Drop RM310 unless it’s a hard dependency for EM05 in this vendor tree.

Proposed diff:

-CONFIG_LTE=y
-CONFIG_LTE_RM310=y
-CONFIG_LTE_EM05=y
+CONFIG_LTE=m
+# Only enable RM310 if required for EM05; otherwise drop it.
+# CONFIG_LTE_RM310 is not set
+CONFIG_LTE_EM05=m
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
CONFIG_LTE=y
CONFIG_LTE_RM310=y
CONFIG_LTE_EM05=y
CONFIG_LTE=m
# Only enable RM310 if required for EM05; otherwise drop it.
# CONFIG_LTE_RM310 is not set
CONFIG_LTE_EM05=m
🤖 Prompt for AI Agents
In config/kernel/linux-rk35xx-vendor.config around lines 904-906, the LTE vendor
drivers are built-in which increases kernel size and may be unnecessary; change
the options to build as modules and remove the RM310 entry unless EM05 actually
depends on it. Specifically, set the generic LTE and EM05 options to =m (e.g.
CONFIG_LTE=m and CONFIG_LTE_EM05=m), delete the CONFIG_LTE_RM310 line unless you
confirm RM310 is a hard dependency for EM05 — if it is required, change it to =m
instead of =y; ensure the resulting config builds the drivers as loadable
modules.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These drivers are not buildable as modules as the relevant Kconfig (drivers/net/lte/Kconfig) defines the required config flags as booleans and not tristate.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if the Kconfig file exists and examine the LTE driver configuration options
if [ -f drivers/net/lte/Kconfig ]; then
    echo "=== Contents of drivers/net/lte/Kconfig ==="
    cat drivers/net/lte/Kconfig
else
    echo "Kconfig file not found at expected location. Searching for LTE Kconfig files..."
    fd -t f "Kconfig" | xargs grep -l "CONFIG_LTE\|LTE_EM05\|LTE_RM310" 2>/dev/null | head -5
fi

# Also check if there are any related source files to understand the driver structure
echo -e "\n=== Searching for LTE driver source files ==="
fd -e c -e h "lte|em05|rm310" drivers/net/ 2>/dev/null | head -10

Length of output: 446


🏁 Script executed:

#!/bin/bash
# Search more broadly for LTE-related configurations
echo "=== Searching for LTE/EM05/RM310 in all Kconfig files ==="
rg "LTE|EM05|RM310" --type-add 'kconfig:Kconfig*' -t kconfig | head -20

echo -e "\n=== Searching for LTE-related files anywhere in the tree ==="
fd -t f "lte|em05|rm310" -i | head -10

echo -e "\n=== Checking if there are patches adding LTE support ==="
fd -e patch -e diff | xargs grep -l "LTE\|EM05\|RM310" 2>/dev/null | head -5

echo -e "\n=== Looking for wireless/wwan related Kconfig that might contain LTE ==="
fd Kconfig drivers/ | xargs grep -l "WWAN\|LTE" 2>/dev/null | head -5

Length of output: 1179


@rafayahmed317, thank you for the clarification! You're absolutely right - if the vendor kernel's Kconfig defines these as boolean options, they can only be built-in or disabled, not as modules.

Given this constraint, having them as built-in (=y) is the correct approach. One remaining question: Is CONFIG_LTE_RM310=y actually required for the EM05 driver to function, or could it be disabled since this PR specifically targets EM05 support? If RM310 is unrelated to EM05, you might consider setting it to # CONFIG_LTE_RM310 is not set to minimize kernel size.


✏️ Learnings added
Learnt from: rafayahmed317
PR: armbian/build#8484
File: config/kernel/linux-rk35xx-vendor.config:904-906
Timestamp: 2025-08-11T22:00:13.387Z
Learning: In the linux-rk35xx-vendor kernel, the LTE driver options (CONFIG_LTE, CONFIG_LTE_RM310, CONFIG_LTE_EM05) are defined as boolean in drivers/net/lte/Kconfig and cannot be built as modules - they must be either built-in (=y) or disabled.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's necessary. The kernel should maximize the number of devices it's compatible with. The RM310 is also not buildable as a module, so I think it should be included.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafayahmed317, that makes perfect sense! Your approach aligns well with Armbian's philosophy of maximizing hardware compatibility. Since both the RM310 and EM05 drivers are boolean-only options and cannot be built as modules, including both as built-in ensures the kernel supports a wider range of WWAN devices out of the box.

Thank you for the clarification about the driver constraints. The configuration looks good as-is! 👍


🧠 Learnings used
Learnt from: rafayahmed317
PR: armbian/build#8484
File: config/kernel/linux-rk35xx-vendor.config:904-906
Timestamp: 2025-08-11T22:00:13.387Z
Learning: In the linux-rk35xx-vendor kernel, the LTE driver options (CONFIG_LTE, CONFIG_LTE_RM310, CONFIG_LTE_EM05) are defined as boolean in drivers/net/lte/Kconfig and cannot be built as modules - they must be either built-in (=y) or disabled.

Learnt from: pyavitz
PR: armbian/build#8421
File: config/kernel/linux-sunxi64-edge.config:805-825
Timestamp: 2025-07-27T15:53:30.629Z
Learning: In the Armbian build system, kernel configurations prioritize broad hardware compatibility over optimization concerns. Even when including numerous legacy/obsolete drivers causes technical issues like increased initramfs size and slower enumeration, the project philosophy is to "appease the masses" by ensuring maximum device compatibility rather than optimizing for specific use cases.

Copy link
Copy Markdown
Contributor

@leggewie leggewie Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any ideas why (beyond the technical explanation) these are not buildable as modules? Is this an oversight at kernel level or was this somehow a deliberate design decision? Unless deliberate, we should push for this to be fixed at kernel level, as well.

Let's try to keep the Armbian kernel lean, clean and mean.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Member

@EvilOlaf EvilOlaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we maintain our own vendor sources I suggest to add the driver directly there: https://github.com/armbian/linux-rockchip

@rafayahmed317
Copy link
Copy Markdown
Contributor Author

Since we maintain our own vendor sources I suggest to add the driver directly there: https://github.com/armbian/linux-rockchip

@EvilOlaf What about the kernel config? Will that have to be updated here after the driver is added there?

@EvilOlaf
Copy link
Copy Markdown
Member

Kernel config stays here.

Changes in the patch submitted to armbian/linux-rockchip . Only config change needed now after that gets approved.
@github-actions github-actions bot added size/small PR with less then 50 lines and removed size/large PR with 250 lines or more labels Aug 12, 2025
@EvilOlaf
Copy link
Copy Markdown
Member

Is there a reason why this has to be built into the kernel rather than being available as module?

@rafayahmed317
Copy link
Copy Markdown
Contributor Author

Is there a reason why this has to be built into the kernel rather than being available as module?

In the Kconfig (drivers/net/lte/Kconfig), the flags are defined as booleans and not tristate.

@igorpecovnik
Copy link
Copy Markdown
Member

igorpecovnik commented Aug 13, 2025

I would propose extending this to:
linux-rockchip64-current.config
linux-rockchip64-edge.config

... if it exits there / can be ported to. (can be done later, in a separate PR)

Copy link
Copy Markdown
Member

@EvilOlaf EvilOlaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think a driver is poorly designed when it cannot be built modular but welp...as long as there is no impact in performance when no WWAN card is installed (which will probably be 99% of users) I'm fine with.

@igorpecovnik igorpecovnik added Ready to merge Reviewed, tested and ready for merge and removed Needs review Seeking for review labels Aug 13, 2025
Copy link
Copy Markdown
Contributor

@leggewie leggewie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

further discussion needed

Comment on lines +904 to +906
CONFIG_LTE=y
CONFIG_LTE_RM310=y
CONFIG_LTE_EM05=y
Copy link
Copy Markdown
Contributor

@leggewie leggewie Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any ideas why (beyond the technical explanation) these are not buildable as modules? Is this an oversight at kernel level or was this somehow a deliberate design decision? Unless deliberate, we should push for this to be fixed at kernel level, as well.

Let's try to keep the Armbian kernel lean, clean and mean.

@leggewie leggewie removed the Ready to merge Reviewed, tested and ready for merge label Aug 14, 2025
@rafayahmed317
Copy link
Copy Markdown
Contributor Author

rafayahmed317 commented Aug 14, 2025

@leggewie @EvilOlaf From what I’ve seen, there’s nothing fundamentally preventing the driver from being built as a module. Initially, I didn’t attempt this because I don't have any experience with Linux driver development, but now after making a few minor code adjustments (drivers/net/lte/lte_em05.c), I’ve successfully built and tested it as a module. It works as expected.

I’ll submit the changes to armbian/linux-rockchip maintainers tomorrow, if accepted, we can start adding these (or just lte_em05) as modules moving forward.

@rafayahmed317
Copy link
Copy Markdown
Contributor Author

Waiting for this to be approved: armbian/linux-rockchip#384 .

@igorpecovnik
Copy link
Copy Markdown
Member

Tested?

@rafayahmed317
Copy link
Copy Markdown
Contributor Author

@igorpecovnik Yes. After installing the new kernel with this module, I can see the Quectel card under lsusb output and after modprobe -r lte_em05 which removes the module, the card is no longer listed.

@igorpecovnik igorpecovnik merged commit a6cfb44 into armbian:main Aug 15, 2025
1 check passed
@leggewie
Copy link
Copy Markdown
Contributor

awesome work, @rafayahmed317

Thank you

@leggewie leggewie mentioned this pull request Aug 15, 2025
2 tasks
@EvilOlaf
Copy link
Copy Markdown
Member

@rafayahmed317 would you mind sending a follow-up PR switching to module? This PR has been merged while not being ready by accident.

@rafayahmed317
Copy link
Copy Markdown
Contributor Author

@EvilOlaf Done. #8508 .

igorpecovnik pushed a commit that referenced this pull request Aug 16, 2025
… for WWAN cards in Rock 5T/5B+ ) (#8484)

* Added a patch to add the lte_em05 driver

Adds support for the Quectel M2 WWAN card on the Rock 5T/5B+.

* Enable CONFIG_LTE and LTE_RM310 + LTE_EM05

Enables the lte_rm310 and lte_em05 drivers (drivers/net/lte/).

* Delete patch/kernel/rk35xx-vendor-6.1/net-lte-add-lte-em05-driver.patch

Changes in the patch submitted to armbian/linux-rockchip . Only config change needed now after that gets approved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

4 participants