#include #include #include #include #include #include #include #include #include //#define DEBUG_WLAN_DECT_CONFIG #if defined(DEBUG_WLAN_DECT_CONFIG) #define DBG_WLAN_DECT(arg...) printk(KERN_ERR arg) #else #define DBG_WLAN_DECT(arg...) #endif /*--------------------------------------------------------------------------------*\ \*--------------------------------------------------------------------------------*/ static unsigned int wlan_dect_config[PUMA_MAX_CONFIG_ENTRIES]; void set_wlan_dect_config_address(unsigned int value) { int i = 0; DBG_WLAN_DECT("[%s] wlan_dect_config\n", __FUNCTION__); while (i < PUMA_MAX_CONFIG_ENTRIES) { if (!wlan_dect_config[i]) { wlan_dect_config[i] = value; DBG_WLAN_DECT("[%s] wlan_dect_config[%d] 0x%x\n", __FUNCTION__, i, wlan_dect_config[i]); break; } i++; } } EXPORT_SYMBOL(set_wlan_dect_config_address); static struct avm_prom_mtd_device prom_mtd; int init_wlan_dect_config(struct mtd_info *mtd) { int i, ret, result; prom_mtd.mtd = mtd; ret = avm_prom_config_add_mtd_device(&prom_mtd); if (ret) { pr_err("%s: Error registering mtd: %d\n", __func__, ret); prom_mtd.mtd = NULL; return ret; } result = 0; for (i = 0; i < ARRAY_SIZE(wlan_dect_config); ++i) { unsigned int offset = wlan_dect_config[i]; if (!offset) continue; ret = avm_prom_load_config_entry(offset); if (ret) { result = ret; pr_err("%s: Error loading entry at offset %u: %d\n", __func__, offset, ret); } } return result; } /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #if defined(CONFIG_EARLY_PRINTK) #include #include #define PROM_UART_BASE AVALANCHE_UART2_REGS_BASE /*--------------------------------------------------------------------------------*\ \*--------------------------------------------------------------------------------*/ static int promuart_baud(int baudrate) { int baud; int uartclk = PAL_sysClkcGetFreq(PAL_SYS_CLKC_UART2); /* UART2 use the same Clkc 1x */ baud = ((uartclk / baudrate) + 8) >> 4; return baud; } /*--------------------------------------------------------------------------------*\ \*--------------------------------------------------------------------------------*/ static void promuart_init(unsigned int baudrate) { unsigned int baud; struct _hw_uart *U = (struct _hw_uart *)PROM_UART_BASE; PAL_sysResetCtrl(AVALANCHE_UART1_RESET, OUT_OF_RESET); baud = promuart_baud(baudrate); U->iir_fcr.Register = 0; /*--- fifo disabled, no dma, .. ---*/ U->ie.Register = 0; U->lc.Bits.ws = 3; /*--- 8 Bit ---*/ U->lc.Bits.dlab = 1; U->data.tx.data = baud & 0xff; U->ie.Register = baud >> 8; U->lc.Bits.dlab = 0; U->iir_fcr.Bits_fcr.rxrst = 1; U->iir_fcr.Bits_fcr.txrst = 1; U->iir_fcr.Bits_fcr.dmam = 0; U->iir_fcr.Bits_fcr.rxtrg = 3; U->iir_fcr.Bits_fcr.fen = 1; /*--- fifo enabled ---*/ U->ie.Bits.erbi = 1; /*--- rx-irq enable ---*/ } /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ static void inline prom_putc(char c) { struct _hw_uart *U = (struct _hw_uart *)PROM_UART_BASE; while((U->ls.Bits.temt) == 0) ; U->data.tx.data = c; } /*--------------------------------------------------------------------------------*\ \*--------------------------------------------------------------------------------*/ int prom_printf(const char * fmt, ...) { static int init; static char buf[1024]; va_list args; int l; char *p, *buf_end; if(init == 0) { promuart_init(115200); prom_putc('\r'); prom_putc('\n'); init = 1; } va_start(args, fmt); l = vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); buf_end = buf + l; for ( p = buf; p < buf_end; p++ ) { if ( *p == '\n') { prom_putc('\r'); } prom_putc(*p); } return l; } EXPORT_SYMBOL(prom_printf); #endif/*--- #if defined(CONFIG_EARLY_PRINTK) ---*/