2009-03-27 10:43:15     boot sequence

Document created by Aaronwu Employee on Aug 14, 2013
Version 1Show Document
  • View in full screen mode

2009-03-27 10:43:15     boot sequence

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71697   

 

Hello all!

 

Is there any way to change drivers boot sequence at a kernel boot time? For example, to start rtc first, than-spi?(just for example)

 

Thank you!

QuoteReplyEditDelete

 

 

2009-03-27 11:43:04     Re: boot sequence

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71699   

 

To be more clear, I want to use in "my driver" another driver. But at a kernel boot, "my driver" boots first and i have no access to spi.

 

Is there any solution?

 

Thank you!

QuoteReplyEditDelete

 

 

2009-03-27 12:27:10     Re: boot sequence

Mike Frysinger (UNITED STATES)

Message: 71705   

 

no, you cannot control the load order of common drivers

 

you can only control the load order of your own drivers:

docs.blackfin.uclinux.org/doku.php?id=a_simple_module_example#building_the_module_into_the_kernel

QuoteReplyEditDelete

 

 

2009-03-27 12:33:09     Re: boot sequence

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71706   

 

Thank you, Mike!

QuoteReplyEditDelete

 

 

2009-03-27 16:33:35     Re: boot sequence

Michael Hennerich (GERMANY)

Message: 71715    A driver requiring another driver (bus driver) to work, is typically

probed by the bus drivers framework. This is truly the case for SPI and

I2C.

 

Your __init function just calls i2c_add_driver resp.

spi_register_driver.

Once the I2C or SPI driver is ready it will call the probe functions of

your_driver ...

 

 

static struct i2c_driver your_driver_driver = {

.driver = {

.name = "your_driver",

.owner = THIS_MODULE,

},

.probe = your_driver_probe,

.remove = __devexit_p(your_driver_remove),

.suspend = your_driver_suspend,

.resume = your_driver_resume,

.id_table = your_driver_id,

};

 

static int __init your_driver_init(void)

{

return i2c_add_driver(&your_driver_driver);

}

module_init(your_driver_init);

 

 

static struct spi_driver your_driver_driver = {

.driver = {

.name = "your_driver",

.bus = &spi_bus_type,

.owner = THIS_MODULE,

},

.probe = your_driver_probe,

.remove = __devexit_p(your_driver_remove),

.suspend = your_driver_suspend,

.resume = your_driver_resume,

};

 

static int __init your_driver_init(void)

{

return spi_register_driver(&your_driver_driver);

}

 

 

-Michael

 

 

QuoteReplyEditDelete

 

 

2009-03-30 08:13:52     Re: boot sequence

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71777   

 

Thank you, will do as you say!

QuoteReplyEditDelete

 

 

2009-03-30 09:06:30     Re: boot sequence

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71778   

 

Hmm, in my case it doesn`t work..I rolled back all thet I`ve done, now probe and remove are simply blank(with just return 0; and printk()), but it shows after _init nothing. The same thing is with modified rtc-ds1390 with added printk(KERN_ALERT""); in _init.

 

Here is dmesg:

 

Linux version 2.6.28.7 (sergey@localhost) (gcc version 4.1.2 (ADI svn)) #47 Mon Mar 30 16:01:15 MSD 2009

Warning: limiting memory to 56MB due to hardware anomaly 05000263

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text = 0x00001000-0x00102b10

  rodata = 0x00102b20-0x0014c7c4

  bss = 0x0014c7e0-0x0015b5d8

  data = 0x0015b5d8-0x0016c000

  stack = 0x0016a000-0x0016c000

  init = 0x0016c000-0x0040d000

  available = 0x0040d000-0x037ff000

  DMA Zone = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Blackfin support (C) 2004-2008 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by  blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 100 MHz System Clock

boot memmap: 000000000040d000 - 00000000037ff000 (usable)

On node 0 totalpages: 14335

free_area_init_node: node 0, pgdat 001684d8, node_mem_map 00412000

  DMA zone: 112 pages used for memmap

  DMA zone: 0 pages reserved

  DMA zone: 14223 pages, LIFO batch:3

  Normal zone: 0 pages used for memmap

  Movable zone: 0 pages used for memmap

NOMPU: setting up cplb tables for global access

Instruction Cache Enabled

Data Cache Enabled (write-through)

Built 1 zonelists in Zone order, mobility grouping off. Total pages: 14223

Kernel command line: "" [Droot=/dev/mtdblock0 rw console=ttyBF0,57600"

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 256 (order: 8, 1024 bytes)

console [ttyBF0] enabled

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Kernel managed physical pages: 14335

Memory available: 52612k/65536k RAM, (2692k init code, 1030k kernel code, 422k data, 1024k dma, 7756k reserved)

Calibrating delay loop... 995.32 BogoMIPS (lpj=1990656)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (15 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (41 KB free)

net_namespace: 288 bytes

NET: Registered protocol family 16

Blackfin GPIO Controller

Blackfin DMA Controller

stamp_init(): registering device resources

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

NET: Registered protocol family 1

msgmni has been set to 102

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler cfq registered

Serial: Blackfin serial driver

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

brd: module loaded

bfin_mac_mdio: probed

bfin_mac: attached PHY driver [SMSC LAN83C185] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=19)@sclk=100MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

cc11x8_init = 0

bfin-spi bfin-spi.0: Blackfin BF5xx on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

ds1390 : ret = 0

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

TCP cubic registered

NET: Registered protocol family 17

drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

Freeing unused kernel memory: 2692k freed

dma_alloc_init: dma_page @ 0x0040a000 - 256 pages at 0x03f00000

 

Bold underlined text is the output in _init in both drivers. 0 - is ret code. Can anyone please suggest a thing to look at?

 

Thank you,

 

Sergey

QuoteReplyEditDelete

 

 

2009-03-30 20:43:03     Re: boot sequence

Mike Frysinger (UNITED STATES)

Message: 71803   

 

sorry, but what exactly are you trying to do ?  you're trying to use a ds1390 SPI device as an RTC source ?  and you're using drivers that already exist or you're trying to write your own ?

QuoteReplyEditDelete

 

 

2009-03-31 02:41:18     Re: boot sequence

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71818   

 

For now i`m trying just to write spi driver. Idea goes further, but for now i want to have a driver, capable of writing smth to spi. I`ve deleted all code till i have a driver above, but it seems to me, that then spi_bus registers it doesn`t call probe() of registered on that bus driver. As an example, i`ve tried to print smth in a probe() function of rtc driver and my driver. Both of them are registered on spi_bus. _init functions return 0, therefore spi drivers are registered.

 

Also, i`ve tried __late_initcall to make it working after all, but the same thing was.

 

Can you tell me the steps to look at why probe of spi drivers isn`t called even though bus is registered?

 

Thank for patience!

QuoteReplyEditDelete

 

 

2009-03-31 02:56:52     Re: boot sequence

Mike Frysinger (UNITED STATES)

Message: 71823   

 

did you properly update your board resources and declare the driver bound to a cs ?

QuoteReplyEditDelete

 

 

2009-03-31 03:02:10     Re: boot sequence

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71824   

 

I`ll check, thank you!

QuoteReplyEditDelete

 

 

2009-03-31 03:20:58     Re: boot sequence

Sergey Kuznetsov (RUSSIAN FEDERATION)

Message: 71831   

 

Thank you, now works:)

Attachments

    Outcomes