]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/main.c
Merge branch 'can-usb1' into spican1
[lincan.git] / lincan / src / main.c
index 367c98db26e13da5687768b0ec9927fa7b24da43..c5547af9e2e535021426e94c7707db77b562168f 100644 (file)
 #if defined(CONFIG_OC_LINCAN_CARD_usbcan)
        #include "../include/usbcan.h"
 #endif
+#if defined(CONFIG_OC_LINCAN_CARD_omap2_spican)
+       #include "../include/omap2_spican.h"
+#endif
 
 can_spinlock_t canuser_manipulation_lock;
 
@@ -399,6 +402,17 @@ int init_module(void)
                goto memory_error;
        }
 #endif
+#if defined(CONFIG_OC_LINCAN_CARD_omap2_spican)
+       #if  LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
+       res = omap2_spican_init();
+       if (res){
+               CANMSG("omap2_spican_register for omap2_spican failed. Error number %d.\n", res);
+               goto memory_error;
+       }
+       #else
+               #error There's no support for OMAP2 SPI subsystem in kernel versions before 2.6.23
+       #endif
+#endif
 
        return 0;
 
@@ -441,6 +455,7 @@ int init_module(void)
 
 
 
+
 struct candevice_t* register_hotplug_dev(const char *hwname,int (*chipdataregfnc)(struct canchip_t *ch,void *data),void *devdata){
        int i=0, j, board=0;
        struct candevice_t *candev;
@@ -670,7 +685,12 @@ void cleanup_module(void)
        DEBUGMSG("Unregistering usbcan.\n");
        usbcan_exit();
 #endif
-
+#if defined(CONFIG_OC_LINCAN_CARD_omap2_spican)
+       #if  LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
+       DEBUGMSG("Unregistering omap2_spican.\n");
+       omap2_spican_exit();
+       #endif
+#endif
        DEBUGMSG("Continuing with coldplug cleanup.\n");
 #ifdef CONFIG_PROC_FS
        if (can_delete_procdir())
@@ -712,7 +732,7 @@ void cleanup_module(void)
        #endif /*CAN_WITH_RTL*/
 
        DEBUGMSG("Can hardware cleanup done, freeing memory.\n");
-
+       
        if ( can_del_mem_list() )
                CANMSG("Error deallocating memory\n");