SMSC LAN911x/LAN921x embedded ethernet support can't be loaded dynamically as module

If you select SMSC LAN911x/LAN921x support in kernel (CONFIG_SMSC911X) to be dynamically loaded as module, it will fail during runtime with:
# modprobe smsc911x
smsc911x: relocation out of range, section 2 reloc 0 sym 'spi_cpld_read'
modprobe: can't load module smsc911x (kernel/drivers/net/smsc911x.ko): invalid module format

store text below in a file e.g. smsc911x.patch, on your development host do:
# cd /usr/local/DigiEL-5.8/kernel/linux-2.6.35
# patch -p1 <smsc911x.patch

recompile and reinstall your project. Next time you load the module, you will see:
# modprobe smsc911x
# lsmod
Module       Size ...
smsc911x   ..

This is the patch:
From 7534d0292b83d18067d3940db4254884d2771e4a Mon Sep 17 00:00:00 2001
Date: Thu, 19 Jul 2012 16:26:28 +0200
Subject: [PATCH] mxc: smsc911x, remove unlinkable symbols.
This fixes Vantive 44419.
drivers/net/smsc911x.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index b50731b..13fdc31 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -129,7 +129,7 @@ static inline u32 __smsc911x_reg_read(struct smsc911x_data *pdata, u32 reg)
if (pdata->config.flags & SMSC911X_USE_32BIT)
return readl(pdata->ioaddr + reg);
+#ifdef CONFIG_ARCH_MX25
if (pdata->config.flags & 0x8000) {
u32 data;
unsigned long flags;
@@ -168,7 +168,7 @@ static inline void __smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg,
+#ifdef CONFIG_ARCH_MX25
if (pdata->config.flags & 0x8000) {
unsigned long flags;
spin_lock_irqsave(&pdata->dev_lock, flags);
Last updated: Jun 04, 2019

Recently Viewed

No recently viewed articles

Did you find this article helpful?