2011-10-07 10:44:21     mount device order

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

2011-10-07 10:44:21     mount device order

Chris Page (UNITED STATES)

Message: 103743   

 

I would like to know what determines the order of devices been mounted. In the previous kernel (2009) the nand partitions were mounted then the spi partitions. In the current version my spi partition is been mounted first. Now my spi partiton resides in mtdblock0. I have tried modifying my modifed stamp.c in the stamp_init but nothing I have done can change the order. The order is very important it effects the bootloader and golden images.

 

How can I modify the order (changing mtdparts command line is not an option)

QuoteReplyEditDelete

 

 

2011-10-10 01:55:22     Re: mount device order

Aaron Wu (CHINA)

Message: 103760   

 

Do you mean if you do platform_add_devices hence register the nand first, then spi_register_board_info you still don't get the right order? could you post your stamp_init function, what's your CPU type?

QuoteReplyEditDelete

 

 

2011-10-12 17:54:27     Re: mount device order

Chris Page (UNITED STATES)

Message: 103816   

 

Hi

 

The spi mem is initialized first. Here is the relevant part of the file. No matter what I  change spi memory is always mounted first.

 

static int __init stamp_init(void)

{

    printk(KERN_INFO "%s(): registering device resources\n", __func__);

    bfin_plat_nand_init();

    /*adf702x_mac_init(); */

    platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); //nand is added here

    i2c_register_board_info(0, bfin_i2c_board_info,

                ARRAY_SIZE(bfin_i2c_board_info));

    spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); //add spi mem

 

}

 

 

static struct platform_device *stamp_devices[] __initdata = {

 

    &bfin_dpmc,

 

    &bfin_gpios_device, /* ADDED */

  

#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)

    &bfin_mii_bus,

    &bfin_mac_device,

#endif

 

#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)

    &net2272_bfin_device,

#endif

 

#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)

    &bfin_spi0_device,

#endif

 

#if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)

    &bfin_sport_spi0_device,

    &bfin_sport_spi1_device,

#endif

 

 

 

#if defined(CONFIG_FB_BF537_WINTEK) || defined(CONFIG_FB_BF537_WINTEK_MODULE)

    &bfin_fb_device,

#endif

 

#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)

#ifdef CONFIG_SERIAL_BFIN_UART0

    &bfin_uart0_device,

#endif

#ifdef CONFIG_SERIAL_BFIN_UART1

    &bfin_uart1_device,

#endif

#endif

 

#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)

#ifdef CONFIG_BFIN_SIR0

    &bfin_sir0_device,

#endif

#ifdef CONFIG_BFIN_SIR1

    &bfin_sir1_device,

#endif

#endif

 

#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)

    &i2c_bfin_twi_device,

#endif

 

/* ADD NAND */

#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)

    &bfin_async_nand_device,

#endif  

 

}

 

static struct spi_board_info bfin_spi_board_info[] __initdata = {

#if defined(CONFIG_MTD_M25P80) \

    || defined(CONFIG_MTD_M25P80_MODULE)

    {

        /* the modalias must be the same as spi device driver name */

        .modalias = "m25p80", /* Name of spi_driver for this device */

        .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */

        .bus_num = 0, /* Framework bus number */

        .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/

        .platform_data = &bfin_spi_flash_data,

        .controller_data = &spi_flash_chip_info,

        .mode = SPI_MODE_3,

    }

QuoteReplyEditDelete

 

 

2011-10-12 23:19:01     Re: mount device order

Aaron Wu (CHINA)

Message: 103819   

 

Thanks for the information, will do further check for the order. By the way, what's your CPU and NAND driver? From the code are you using a customer BF537 board with NAND on it working with a generic async interface driver? please confirm.

QuoteReplyEditDelete

 

 

2011-10-13 02:48:28     Re: mount device order

Aaron Wu (CHINA)

Message: 103823   

 

Related driver will try to create partitions according to it's partition table in the board file, the order of creating will affects the number you concern, and it's further determined by the driver probe order of these drivers, not the order of adding these device, so the order won't change if change the device adding order only, I've had a try and the result is the same as yours.

 

So what matters is to change the order of probe time of each driver, however the reasonable way should be modifying your application to assign the right dev node to operate on. In any case if you do want to change the driver probe order you may consult the include/linux/init.h and determin how you want to use facilities like module_init, subsys_initcall, arch_initcall etc.

QuoteReplyEditDelete

 

 

2011-10-13 11:36:07     Re: mount device order

Chris Page (UNITED STATES)

Message: 103846   

 

Thanks Aaron

 

I am using a bf537 rev 3. I will take a look into all of these approaches to find the best way and post my result. Hopefully it should not be to difficult to modify the node number or change the probe timing.

QuoteReplyEditDelete

 

 

2011-10-13 11:58:11     Re: mount device order

Chris Page (UNITED STATES)

Message: 103847   

 

uboot passes root=/dev/mtdblock0 to the kernel as a boot argument. Now it should be /dev/mtdblock1. Is there anyway I can modify the kernel to change this. I do not want multiple bootloaders to be released and updated. This is if I cannot change the probe or device node order.

 

 

 

 

 

 

 

QuoteReplyEditDelete

 

 

2011-10-13 16:24:15     Re: mount device order

Chris Page (UNITED STATES)

Message: 103849   

 

I have just decided to mount the spi during the init process by making it a module. this way I can maintain the order.

Attachments

    Outcomes