SPI Drive Frame -1 (DM8127 Linux2.6.37 for example)

Source: Internet
Author: User

First, the driver structure

1, Platform_device

Files:/arch/arm/mach-omap2/device.c

Static structOmap2_mcspi_platform_config Omap2_mcspi1_config ={. Num_cs=4,};Static structResource omap2_mcspi1_resources[] ={. Start=omap2_mcspi1_base,. End= Omap2_mcspi1_base +0xFF,. Flags=Ioresource_mem,},};Static structPlatform_device omap2_mcspi1 ={. Name="Omap2_mcspi",. ID=1,/* for identifying different devices in the Platform_driver probe function */
. num_resources=array_size (omap2_mcspi1_resources),. Resource=omap2_mcspi1_resources,. Dev={. Platform_data= &Omap2_mcspi1_config,},};
static void Omap_init_mcspi (void)
{
if (cpu_is_omap44xx ())
Omap4_mcspi_fixup ();

Platform_device_register (&omap2_mcspi1);
}

2, Dev_devices

Files:/arch/arm/mach-omap2/board-ti8148ipnc.c

Static structSpi_board_info dm8127_spi1_board[] = {   [0] ={. Modalias="Spidev",. Bus_num=1,. Chip_select=0,. IRQ= -1,. Max_speed_hz= -* +* +,. Mode=Spi_mode_0,},};void__init Ti8148_spi_init (void){ Spi_register_board_info (Dm8127_spi1_board, Array_size (Dm8127_spi1_board)); }

1, Platform_driver

Files:/driver/spi/omap2_mcspi.c

Static Const structDev_pm_ops Omap2_mcspi_pm_ops ={. Resume=Omap2_mcspi_resume,};Static structPlatform_driver Omap2_mcspi_driver ={. Driver={. Name="Omap2_mcspi",. Owner=This_module,. PM= &Omap2_mcspi_pm_ops},. Remove=__exit_p (Omap2_mcspi_remove),};Static int__init Omap2_mcspi_init (void) {Omap2_mcspi_wq= Create_singlethread_workqueue (/*Create a work queue*/omap2_mcspi_driver.driver.name); if(Omap2_mcspi_wq = =NULL)return-1; returnPlatform_driver_probe (&Omap2_mcspi_driver, Omap2_mcspi_probe);}

1, Dev_driver

Files:/driver/spi/spidev.c

Static struct spi_driver spidev_spi_driver = {            = {=        "spidev " ,         =    this_module,    },    =    spidev_probe,    =    __devexit_p ( Spidev_remove),};

SPI Drive Frame -1 (DM8127 Linux2.6.37 for example)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.