/*------------------------------------------------------------------------------------------*\ * * Copyright (C) 2006 AVM GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \*------------------------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*--- #include ---*/ /*------------------------------------------------------------------------------------------*\ * 2.6 Kernel H-Files \*------------------------------------------------------------------------------------------*/ #if KERNEL_VERSION(2, 6, 0) < LINUX_VERSION_CODE #include #include #endif /*------------------------------------------------------------------------------------------*\ * 2.4 Kernel H-Files \*------------------------------------------------------------------------------------------*/ #if KERNEL_VERSION(2, 6, 0) > LINUX_VERSION_CODE #include #include #include #include #include #include #endif #define AVM_EVENT_INTERNAL #include #include #if defined(CONFIG_MIPS) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) #include #else/*--- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ---*/ #include #endif/*--- #else ---*//*--- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ---*/ #else #include #include #endif /*--- #if defined(CONFIG_MIPS) ---*/ #include "avm_sammel.h" #include "avm_event.h" #include "avm_debug.h" #include "ar7wdt.h" #define MODULE_NAME "avm" MODULE_DESCRIPTION("AR7 Watchdog Timer + LED Driver + AVM Central Event distribution"); MODULE_LICENSE("GPL"); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ int ar7wdt_no_reboot = 0; module_param(ar7wdt_no_reboot, int, 0744); int avm_event_enable_push_button = 0; module_param(avm_event_enable_push_button, int, 0744); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ int __init avm_sammel_init(void) { int ret; char *hwrev; /*--------------------------------------------------------------------------------------*\ \*--------------------------------------------------------------------------------------*/ hwrev = prom_getenv("HWRevision"); /*--- printk("HWRevision=\"%s\"\n", hwrev); ---*/ if(hwrev) { char buff[20]; char *p; snprintf(buff, sizeof(buff), "%s ", hwrev); /*----------------------------------------------------------------------------------*\ * aus "94.0.0.1 " --> "94 " erzeugen \*----------------------------------------------------------------------------------*/ p = strchr(buff, '.'); if(p) { *p++ = ' '; *p = '\0'; } } /*--------------------------------------------------------------------------------------*\ \*--------------------------------------------------------------------------------------*/ printk("[avm] configured: " #ifdef CONFIG_AVM_WATCHDOG "watchdog " #endif #ifdef CONFIG_AVM_WATCHDOG_MODULE "watchdog (module) " #endif #ifdef CONFIG_AVM_EVENT "event " #endif #ifdef CONFIG_AVM_DEBUG "debug " #endif #ifdef CONFIG_AVM_EVENT_MODULE "event (module) " #endif ); printk("\n"); /*--------------------------------------------------------------------------------------*\ \*--------------------------------------------------------------------------------------*/ #if defined(CONFIG_AVM_WATCHDOG) || defined(CONFIG_AVM_WATCHDOG_MODULE) ret = ar7wdt_init(); if(ret) { printk("[avm]: ar7wdt_init: failed\n"); return ret; } #endif /*--- #if (CONFIG_AVM_WATCHDOG == 1) || (CONFIG_AVM_WATCHDOG_MODULE == 1) ---*/ #if defined(CONFIG_AVM_EVENT) || defined(CONFIG_AVM_EVENT_MODULE) ret = avm_event_init(); if(ret) { printk("[avm]: avm_event_init: failed\n"); return ret; } #endif /*--- #if (CONFIG_AVM_EVENT == 1) || (CONFIG_AVM_EVENT_MODULE == 1) ---*/ #if defined(CONFIG_AVM_DEBUG) || defined(CONFIG_AVM_DEBUG_MODULE) ret = avm_debug_init(); if(ret) { printk("[avm]: avm_event_init: failed\n"); return ret; } #endif /*--- #if (CONFIG_AVM_DEBUG == 1) || (CONFIG_AVM_DEBUG_MODULE == 1) ---*/ return 0; } /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ module_init(avm_sammel_init); /*--------------------------------------------------------------------------------*\ * neccessary: early install the '/proc/avm' directory \*--------------------------------------------------------------------------------*/ struct proc_dir_entry *proc_avm __attribute__((weak)); static int __init early_avm_proc_init(void) { if (!proc_avm) proc_avm = proc_mkdir("avm", NULL); return 0; } fs_initcall(early_avm_proc_init); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ #if defined(AVM_SAMMEL_MODULE) int avm_sammel_deinit(void) { #if (CONFIG_AVM_WATCHDOG_MODULE == 1) ar7wdt_cleanup(); #endif /*--- #if (CONFIG_AVM_WATCHDOG_MODULE == 1) ---*/ #if (CONFIG_AVM_EVENT_MODULE == 1) avm_event_cleanup(); #endif /*--- #if (CONFIG_AVM_EVENT_MODULE == 1) ---*/ #if (CONFIG_AVM_EVENT_MODULE == 1) avm_event_cleanup(); #endif /*--- #if (CONFIG_AVM_EVENT_MODULE == 1) ---*/ #if (CONFIG_AVM_DEBUG_MODULE == 1) avm_debug_cleanup(); #endif /*--- #if (CONFIG_AVM_DEBUG_MODULE == 1) ---*/ return 0; } /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ module_exit(avm_sammel_deinit); #endif /*--- #if defined(AVM_SAMMEL_MODULE) ---*/