Patchwork Change linking order of SPI and MTD.

login
register
mail settings
Submitter Shawn J. Goff
Date May 1, 2012, 8:12 p.m.
Message ID <1335903148-29539-1-git-send-email-shawn7400@gmail.com>
Download mbox | patch
Permalink /patch/156208/
State New
Headers show

Comments

Shawn J. Goff - May 1, 2012, 8:12 p.m.
From: "Shawn J. Goff" <shawn7400@gmail.com>

Currently, UBI initializes before SPI. This is a problem
if you intend to boot to a UBI volume on an SPI device.  UBI will
fail to initialize with the following message:

UBI error: ubi_init: UBI error: cannot initialize UBI, error -19

The initialization order is determined by the order the modules are
linked into the kernel, so the fix was to change this order. UBI is
under the MTD tree, so SPI is now linked in before MTD.

Signed-off-by: Shawn J. Goff <shawn7400@gmail.com>
---
 drivers/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Fabio Estevam - May 2, 2012, 3:09 a.m.
On Tue, May 1, 2012 at 5:12 PM, Shawn J. Goff <shawn7400@gmail.com> wrote:
> From: "Shawn J. Goff" <shawn7400@gmail.com>
>
> Currently, UBI initializes before SPI. This is a problem
> if you intend to boot to a UBI volume on an SPI device.  UBI will
> fail to initialize with the following message:
>
> UBI error: ubi_init: UBI error: cannot initialize UBI, error -19
>
> The initialization order is determined by the order the modules are
> linked into the kernel, so the fix was to change this order. UBI is
> under the MTD tree, so SPI is now linked in before MTD.

Could EPROBE_DEFER help in this case?
Shawn J. Goff - May 2, 2012, 2:16 p.m.
On Tue, May 1, 2012 at 11:09 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Tue, May 1, 2012 at 5:12 PM, Shawn J. Goff <shawn7400@gmail.com> wrote:
>> From: "Shawn J. Goff" <shawn7400@gmail.com>
>>
>> Currently, UBI initializes before SPI. This is a problem
>> if you intend to boot to a UBI volume on an SPI device.  UBI will
>> fail to initialize with the following message:
>>
>> UBI error: ubi_init: UBI error: cannot initialize UBI, error -19
>>
>> The initialization order is determined by the order the modules are
>> linked into the kernel, so the fix was to change this order. UBI is
>> under the MTD tree, so SPI is now linked in before MTD.
>
> Could EPROBE_DEFER help in this case?

I hadn't known about EPROBE_DEFER until now. If it does help,
that's probably a better solution. I'll look into it, but it'll be
at least a few days before I'm able to spend time on it.
Mike Frysinger - May 2, 2012, 5:12 p.m.
On Tue, May 1, 2012 at 4:12 PM, Shawn J. Goff wrote:
> Currently, UBI initializes before SPI. This is a problem
> if you intend to boot to a UBI volume on an SPI device.  UBI will
> fail to initialize with the following message:

this is why many SPI bus masters use subsys_initcall() now

> The initialization order is determined by the order the modules are
> linked into the kernel, so the fix was to change this order. UBI is
> under the MTD tree, so SPI is now linked in before MTD.

NAK: linking order is arbitrary and always has been
-mike

Patch

diff --git a/drivers/Makefile b/drivers/Makefile
index c07be02..0ccc4b1 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -51,8 +51,8 @@  obj-$(CONFIG_IDE)		+= ide/
 obj-$(CONFIG_SCSI)		+= scsi/
 obj-$(CONFIG_ATA)		+= ata/
 obj-$(CONFIG_TARGET_CORE)	+= target/
-obj-$(CONFIG_MTD)		+= mtd/
 obj-$(CONFIG_SPI)		+= spi/
+obj-$(CONFIG_MTD)		+= mtd/
 obj-y				+= net/
 obj-$(CONFIG_ATM)		+= atm/
 obj-$(CONFIG_FUSION)		+= message/