From e6d87036412b952cb083eff2dc716aee97a771f2 Mon Sep 17 00:00:00 2001 From: Roman Yeryomin Date: Fri, 17 May 2013 20:40:24 +0300 Subject: Move to rsdk 3.2.4. Compiles cleanly. Signed-off-by: Roman Yeryomin --- .../realtek/files/arch/rlx/bsp_rtl8196eu/setup.c | 175 +++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 target/linux/realtek/files/arch/rlx/bsp_rtl8196eu/setup.c (limited to 'target/linux/realtek/files/arch/rlx/bsp_rtl8196eu/setup.c') diff --git a/target/linux/realtek/files/arch/rlx/bsp_rtl8196eu/setup.c b/target/linux/realtek/files/arch/rlx/bsp_rtl8196eu/setup.c new file mode 100644 index 000000000..4fe1c40aa --- /dev/null +++ b/target/linux/realtek/files/arch/rlx/bsp_rtl8196eu/setup.c @@ -0,0 +1,175 @@ +/* + * Copyright 2006, Realtek Semiconductor Corp. + * + * arch/rlx/rlxocp/setup.c + * Interrupt and exception initialization for RTL8198 + * + * Tony Wu (tonywu@realtek.com.tw) + * Nov. 7, 2006 + */ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "bspchip.h" + +extern int bsp_swcore_init(unsigned int version); + +static void prom_putchar(char c) +{ +#define UART0_BASE 0xB8002000 +#define UART0_THR (UART0_BASE + 0x000) +#define UART0_FCR (UART0_BASE + 0x008) +#define UART0_LSR (UART0_BASE + 0x014) +#define TXRST 0x04 +#define CHAR_TRIGGER_14 0xC0 +#define LSR_THRE 0x20 +#define TxCHAR_AVAIL 0x00 +#define TxCHAR_EMPTY 0x20 +unsigned int busy_cnt = 0; + + do + { + /* Prevent Hanging */ + if (busy_cnt++ >= 30000) + { + /* Reset Tx FIFO */ + REG8(UART0_FCR) = TXRST | CHAR_TRIGGER_14; + return; + } + } while ((REG8(UART0_LSR) & LSR_THRE) == TxCHAR_AVAIL); + + /* Send Character */ + REG8(UART0_THR) = c; +} + +static void early_console_write(const char *s, unsigned n) +{ + while (n-- && *s) { + if (*s == '\n') + prom_putchar('\r'); + prom_putchar(*s); + s++; + } +} + + +static void shutdown_netdev(void) +{ + struct net_device *dev; + + printk("Shutdown network interface\n"); + read_lock(&dev_base_lock); + + for_each_netdev(&init_net, dev) + { + if(dev->flags &IFF_UP) + { + printk("%s:===>\n",dev->name); + rtnl_lock(); +#if defined(CONFIG_COMPAT_NET_DEV_OPS) + if(dev->stop) + dev->stop(dev); +#else + if ((dev->netdev_ops)&&(dev->netdev_ops->ndo_stop)) + dev->netdev_ops->ndo_stop(dev); +#endif + rtnl_unlock(); + } + } +#if defined(CONFIG_RTL8192CD) + { + extern void force_stop_wlan_hw(void); + force_stop_wlan_hw(); + } +#endif + read_unlock(&dev_base_lock); +} + +static void bsp_machine_restart(char *command) +{ + static void (*back_to_prom)(void) = (void (*)(void)) 0xbfc00000; + + REG32(GIMR)=0; + + local_irq_disable(); +#ifdef CONFIG_NET + shutdown_netdev(); +#endif + REG32(BSP_WDTCNR) = 0; //enable watch dog + while (1) ; + /* Reboot */ + back_to_prom(); +} + +static void bsp_machine_halt(void) +{ + while(1); +} + +static void bsp_machine_power_off(void) +{ + while(1); +} + +/* + * callback function + */ +#define REG32(reg) (*(volatile unsigned int *)(reg)) +extern void _imem_dmem_init(void); +void __init bsp_setup(void) +{ + int ret= -1; + unsigned int version = 0; + + /* define io/mem region */ + ioport_resource.start = 0x18000000; + ioport_resource.end = 0x1fffffff; + + iomem_resource.start = 0x18000000; + iomem_resource.end = 0x1fffffff; + + /* set reset vectors */ + _machine_restart = bsp_machine_restart; + _machine_halt = bsp_machine_halt; + pm_power_off = bsp_machine_power_off; + +#if defined(CONFIG_RTL_DUAL_PCIESLOT_BIWLAN_D) +{ + unsigned int tmp=0,tmp1=0,tmp2=0; + tmp1=REG32(0xb8001004); + if((REG32(0xb8001000)&0x80000000)==0x80000000) + { + //REG32(0xb8001008)=0x6d13a4c0; + REG32(0xb8001004)=tmp1; + } +} +#endif + version = 8; + /* initialize uart */ + bsp_serial_init(); + _imem_dmem_init(); + + /* initialize switch core */ +#if defined(CONFIG_RTL_819X) + ret = bsp_swcore_init(version); + if(ret != 0) + { + bsp_machine_halt(); + } +#endif +} -- cgit v1.2.3