Changeset 18294


Ignore:
Timestamp:
01/24/12 04:51:45 (16 months ago)
Author:
BrainSlayer
Message:

hornet support (quick and dirty)

Location:
src/linux/universal/linux-3.2
Files:
9 added
6 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-3.2/arch/mips/Kconfig

    r18226 r18294  
    785785          Say Y here if you have a XLR or XLS based board. 
    786786 
     787config MACH_HORNET 
     788    bool "Support for Atheros HORNET based board" 
     789        select DMA_NONCOHERENT 
     790        select IRQ_CPU 
     791        select CEVT_R4K 
     792        select CSRC_R4K 
     793        select DMA_NONCOHERENT 
     794        select ARCH_REQUIRE_GPIOLIB 
     795        select SYS_HAS_CPU_MIPS32_R1 
     796        select SYS_HAS_CPU_MIPS32_R2 
     797        select SYS_SUPPORTS_32BIT_KERNEL 
     798        select SYS_SUPPORTS_BIG_ENDIAN 
     799        select SYS_HAS_EARLY_PRINTK 
     800 
     801config HORNET_EMULATION 
     802    bool "build system for Hornet emulation board?" 
     803    depends on MACH_HORNET 
     804 
    787805config  MACH_AR7100 
    788806    bool "Support for Atheros ar7100 based boards" 
  • src/linux/universal/linux-3.2/arch/mips/Makefile

    r18171 r18294  
    187187endif 
    188188 
     189#Atheros Ar9330(Hornet) 
     190# 
     191core-$(CONFIG_MACH_HORNET)              +=      arch/mips/ar7240/ 
     192load-$(CONFIG_MACH_HORNET)              +=      0xffffffff80002000 
     193cflags-$(CONFIG_MACH_HORNET)    += -I$(srctree)/arch/mips/include/asm/mach-ar7240 
     194 
     195 
    189196#Atheros Ar7240 
    190197# 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/Makefile

    r18171 r18294  
    2626                        gpio_driver.o   \ 
    2727                        dev-leds-gpio.o \ 
     28                        dev-ar9xxx-wmac.o \ 
    2829                        ar7240.o \ 
    2930                        ar71xx.o \ 
     
    3435                        platform.o 
    3536 
     37obj-$(CONFIG_EARLY_PRINTK)              += early_printk.o 
    3638#obj-$(CONFIG_AR9100)   += wdt.o 
    3739 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/ar71xx.c

    r18171 r18294  
    7272                break; 
    7373 
     74        case AR71XX_SOC_AR9330: 
     75        case AR71XX_SOC_AR9331: 
     76                spin_lock_irqsave(&ar71xx_device_lock, flags); 
     77                t = ar71xx_reset_rr(AR933X_RESET_REG_RESET_MODULE); 
     78                ar71xx_reset_wr(AR933X_RESET_REG_RESET_MODULE, t | mask); 
     79                spin_unlock_irqrestore(&ar71xx_device_lock, flags); 
     80                break; 
     81 
     82        case AR71XX_SOC_AR9341: 
     83        case AR71XX_SOC_AR9342: 
     84        case AR71XX_SOC_AR9344: 
     85                spin_lock_irqsave(&ar71xx_device_lock, flags); 
     86                t = ar71xx_reset_rr(AR934X_RESET_REG_RESET_MODULE); 
     87                ar71xx_reset_wr(AR934X_RESET_REG_RESET_MODULE, t | mask); 
     88                spin_unlock_irqrestore(&ar71xx_device_lock, flags); 
     89                break; 
     90 
    7491        default: 
    7592                BUG(); 
     
    113130                spin_unlock_irqrestore(&ar71xx_device_lock, flags); 
    114131                break; 
     132        case AR71XX_SOC_AR9330: 
     133        case AR71XX_SOC_AR9331: 
     134                spin_lock_irqsave(&ar71xx_device_lock, flags); 
     135                t = ar71xx_reset_rr(AR933X_RESET_REG_RESET_MODULE); 
     136                ar71xx_reset_wr(AR933X_RESET_REG_RESET_MODULE, t & ~mask); 
     137                spin_unlock_irqrestore(&ar71xx_device_lock, flags); 
     138                break; 
     139 
     140        case AR71XX_SOC_AR9341: 
     141        case AR71XX_SOC_AR9342: 
     142        case AR71XX_SOC_AR9344: 
     143                spin_lock_irqsave(&ar71xx_device_lock, flags); 
     144                t = ar71xx_reset_rr(AR934X_RESET_REG_RESET_MODULE); 
     145                ar71xx_reset_wr(AR934X_RESET_REG_RESET_MODULE, t & ~mask); 
     146                spin_unlock_irqrestore(&ar71xx_device_lock, flags); 
     147                break; 
    115148 
    116149        default: 
     
    149182                break; 
    150183 
     184        case AR71XX_SOC_AR9330: 
     185        case AR71XX_SOC_AR9331: 
     186                spin_lock_irqsave(&ar71xx_device_lock, flags); 
     187                t = ar71xx_reset_rr(AR933X_RESET_REG_RESET_MODULE); 
     188                spin_unlock_irqrestore(&ar71xx_device_lock, flags); 
     189                break; 
     190 
     191        case AR71XX_SOC_AR9341: 
     192        case AR71XX_SOC_AR9342: 
     193        case AR71XX_SOC_AR9344: 
     194                spin_lock_irqsave(&ar71xx_device_lock, flags); 
     195                t = ar71xx_reset_rr(AR934X_RESET_REG_RESET_MODULE); 
     196                spin_unlock_irqrestore(&ar71xx_device_lock, flags); 
     197                break; 
     198 
     199 
    151200        default: 
    152201                BUG(); 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/dev-ap91-pci.c

    r18171 r18294  
    88 *  by the Free Software Foundation. 
    99 */ 
    10  
     10#ifndef CONFIG_MACH_HORNET 
    1111#include <linux/pci.h> 
    1212#include <linux/ath9k_platform.h> 
     
    7070        pci_enable_ath9k_fixup(0, wmac_data.eeprom_data); 
    7171} 
     72#endif 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/gpio_driver.c

    r18171 r18294  
    327327 
    328328//wl gpios 
    329  
     329#ifndef CONFIG_MACH_HORNET 
    330330 
    331331        { 
     
    491491        },  
    492492#endif 
     493#endif 
    493494}; 
    494495 
     496void serial_print(char *fmt, ...); 
    495497 
    496498void __init ar71xx_gpio_init(void) 
     
    502504                panic("cannot allocate AR71xx GPIO registers page"); 
    503505 
    504         ar71xx_gpio_chip.ngpio = 48; 
     506        ar71xx_gpio_chip.ngpio = sizeof(generic_leds_gpio)/sizeof(struct gpio_led); 
    505507 
    506508        err = gpiochip_add(&ar71xx_gpio_chip); 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/irq.c

    r18171 r18294  
    6060//    setup_irq(AR7240_CPU_IRQ_PCI,   &cascade); 
    6161#endif 
    62 #ifdef CONFIG_WASP_SUPPORT 
    63         set_irq_chip_and_handler(ATH_CPU_IRQ_WLAN, 
     62#if defined(CONFIG_WASP_SUPPORT) || defined(CONFIG_MACH_HORNET) 
     63        irq_set_chip_and_handler(ATH_CPU_IRQ_WLAN, 
    6464                                &dummy_irq_chip, 
    6565                                handle_percpu_irq); 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/pci-ath9k-fixup.c

    r18171 r18294  
    88 *  by the Free Software Foundation. 
    99 */ 
    10  
     10#ifndef CONFIG_MACH_HORNET 
    1111#include <linux/pci.h> 
    1212#include <linux/delay.h> 
     
    155155        ath9k_num_fixups++; 
    156156} 
     157#endif 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/pci.c

    r18171 r18294  
    1919#include <asm/mach-ar71xx/pci.h> 
    2020 
     21#ifndef CONFIG_MACH_HORNET 
    2122unsigned ar71xx_pci_nr_irqs __initdata; 
    2223struct ar71xx_pci_irq *ar71xx_pci_irq_map __initdata; 
     
    9293        return ret; 
    9394} 
     95#endif 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/platform.c

    r18171 r18294  
    1616#include <asm/mach-ar71xx/ar71xx.h> 
    1717#include "nvram.h" 
     18#include <asm/mach-ar71xx/ar933x_uart_platform.h> 
     19 
     20void serial_print(char *fmt, ...); 
    1821 
    1922#ifdef CONFIG_WASP_SUPPORT 
     
    119122}; 
    120123 
     124 
     125static struct resource ar933x_uart_resources[] = { 
     126        { 
     127                .start  = AR933X_UART_BASE, 
     128                .end    = AR933X_UART_BASE + AR71XX_UART_SIZE - 1, 
     129                .flags  = IORESOURCE_MEM, 
     130        }, 
     131        { 
     132                .start  = AR7240_MISC_IRQ_UART, 
     133                .end    = AR7240_MISC_IRQ_UART, 
     134                .flags  = IORESOURCE_IRQ, 
     135        }, 
     136}; 
     137 
     138static struct ar933x_uart_platform_data ar933x_uart_data; 
     139static struct platform_device ar933x_uart_device = { 
     140        .name           = "ar933x-uart", 
     141        .id             = -1, 
     142        .resource       = ar933x_uart_resources, 
     143        .num_resources  = ARRAY_SIZE(ar933x_uart_resources), 
     144        .dev = { 
     145                .platform_data  = &ar933x_uart_data, 
     146        }, 
     147}; 
     148 
     149static struct resource ath_uart_resources[] = { 
     150        { 
     151         .start = AR933X_UART_BASE, 
     152         .end = AR933X_UART_BASE + 0x0fff, 
     153         .flags = IORESOURCE_MEM, 
     154         }, 
     155}; 
     156 
     157static struct plat_serial8250_port ath_uart_data[] = { 
     158        { 
     159         .mapbase = (u32) KSEG1ADDR(AR933X_UART_BASE), 
     160         .membase = (void __iomem *)((u32) (KSEG1ADDR(AR933X_UART_BASE))), 
     161         .irq = AR7240_MISC_IRQ_UART, 
     162         .flags = (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST), 
     163         .iotype = UPIO_MEM32, 
     164         .regshift = 2, 
     165         .uartclk = 0,          /* ath_ahb_freq, */ 
     166         }, 
     167        {}, 
     168}; 
     169 
     170static struct platform_device ath_uart = { 
     171        .name = "serial8250", 
     172        .id = 0, 
     173        .dev.platform_data = ath_uart_data, 
     174        .num_resources = 1, 
     175        .resource = ath_uart_resources 
     176}; 
     177 
     178 
     179 
    121180static struct platform_device *ar7241_platform_devices[] __initdata = { 
    122181        &ar7240_usb_ehci_device 
     
    128187 
    129188static struct platform_device *ar724x_platform_devices[] __initdata = { 
     189#ifdef CONFIG_MACH_HORNET 
     190        &ar933x_uart_device, 
     191        &ath_uart 
     192#else 
    130193        &ar7240_uart 
     194#endif 
    131195}; 
    132196 
    133197extern __init ap91_pci_init(u8 *cal_data, u8 *mac_addr); 
     198void ar9xxx_add_device_wmac(u8 *cal_data, u8 *mac_addr) __init; 
    134199 
    135200static void *getCalData(int slot) 
     
    177242 
    178243        /* need to set clock appropriately */ 
     244#ifdef CONFIG_MACH_HORNET 
     245//      ath_uart_data[0].uartclk = ar7240_ahb_freq; 
     246//      ar933x_uart_data.uartclk = ar7240_ahb_freq; 
     247 
     248        ath_uart_data[0].uartclk = ar71xx_ref_freq; 
     249        ar933x_uart_data.uartclk = ar71xx_ref_freq; 
     250#endif 
     251 
    179252#ifdef CONFIG_WASP_SUPPORT 
    180253        ar7240_uart_data[0].uartclk = ath_ref_clk_freq; 
     
    188261                return ret;  
    189262 
    190         if (is_ar7241() || is_ar7242()  || is_ar9330() || is_wasp()) { 
     263        if (is_ar7241() || is_ar7242()  || is_ar933x() || is_wasp()) { 
    191264            ret = platform_add_devices(ar7241_platform_devices,  
    192265                                ARRAY_SIZE(ar7241_platform_devices)); 
     
    197270        } 
    198271         
     272#ifdef CONFIG_MACH_HORNET 
     273        ee = (u8 *) KSEG1ADDR(0x1fff1000); 
     274        ar9xxx_add_device_wmac(ee, NULL); 
     275#else 
    199276        ee = getCalData(0); 
    200277        ap91_pci_init(ee, mac); 
     278#endif 
    201279return ret; 
    202280} 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/prom.c

    r18171 r18294  
    1717 
    1818int __ath_flash_size; 
    19  
    20 extern void Uart16550Put(unsigned char byte); 
    21  
    22 #define UART_READ(r) \ 
    23         __raw_readl((void __iomem *)(KSEG1ADDR(AR7240_UART_BASE) + 4 * (r))) 
    24  
    25 #define UART_WRITE(r, v) \ 
    26         __raw_writel((v), (void __iomem *)(KSEG1ADDR(AR7240_UART_BASE) + 4*(r))) 
    27  
    28 void prom_putchar(unsigned char ch) 
    29 { 
    30         while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0); 
    31         UART_WRITE(UART_TX, ch); 
    32         while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0); 
    33 } 
    3419 
    3520 
  • src/linux/universal/linux-3.2/arch/mips/ar7240/setup.c

    r18171 r18294  
    4242 
    4343static int __init ar7240_init_ioc(void); 
    44 void Uart16550Init(void); 
    4544void serial_print(char *fmt, ...); 
    4645void writeserial(char *str,int count); 
     
    5049static void ar7240_sys_frequency(void); 
    5150#endif 
     51#ifdef CONFIG_MACH_HORNET 
     52static void hornet_sys_frequency(void); 
     53void UartHornetInit(void); 
     54void UartHornetPut(u8 byte); 
     55 
     56#define Uart16550Init          UartHornetInit 
     57#define Uart16550Put           UartHornetPut 
     58#else 
     59void Uart16550Init(void); 
    5260u8 Uart16550GetPoll(void); 
     61#endif 
    5362/*  
    5463 * Export AHB freq value to be used by Ethernet MDIO. 
     
    141150                rev = 1; 
    142151                break; 
     152        case AR9330_REV_1_2: 
     153                chip = "9330"; 
     154                rev = 2; 
     155                break; 
     156        case AR9331_REV_1_0: 
     157                chip = "9331"; 
     158                rev = 0; 
     159                break; 
     160        case AR9331_REV_1_1: 
     161                chip = "9331"; 
     162                rev = 1; 
     163                break; 
     164        case AR9331_REV_1_2: 
     165                chip = "9331"; 
     166                rev = 2; 
     167                break; 
    143168        case AR9344_REV_1_0: 
    144169                chip = "9344"; 
     
    266291ar7240_sys_frequency(void) 
    267292{ 
    268  
     293#ifdef CONFIG_MACH_HORNET 
     294    hornet_sys_frequency(); 
     295#else /* CONFIG_MACH_HORNET */ 
    269296#ifdef CONFIG_AR7240_EMULATION 
    270297#ifdef FB50 
     
    304331    ar7240_ahb_freq = ar7240_cpu_freq/ahb_div; 
    305332#endif 
    306 } 
    307 #endif 
    308 extern int early_serial_setup(struct uart_port *port); 
    309  
    310 #define AR71XX_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP) 
    311 void __init 
    312 serial_setup(void) 
    313 { 
    314         struct uart_port p; 
    315  
    316         memset(&p, 0, sizeof(p)); 
    317  
    318         p.flags     = AR71XX_UART_FLAGS; 
    319         p.iotype    = UPIO_MEM32; 
    320         p.uartclk   = ar7240_ahb_freq; 
    321         p.irq       = AR7240_MISC_IRQ_UART; 
    322         p.regshift  = 2; 
    323         p.membase   = (u8 *)KSEG1ADDR(AR7240_UART_BASE); 
    324  
    325         if (early_serial_setup(&p) != 0) 
    326                 printk(KERN_ERR "early_serial_setup failed\n"); 
    327          
    328 } 
     333#endif 
     334} 
     335#endif 
    329336void __init plat_time_init(void) 
    330337{ 
     
    397404#define AR71XX_MEM_SIZE_MIN     0x0200000 
    398405#define AR71XX_MEM_SIZE_MAX     0x8000000 
    399  
     406static int ramsize; 
    400407static void __init ar71xx_detect_mem_size(void) 
    401408{ 
     
    422429        } 
    423430        *p = memsave; 
    424  
     431        ramsize = size; 
    425432        add_memory_region(0, size, BOOT_MEM_RAM); 
    426433} 
     
    437444} 
    438445 
    439  
     446#define AR71XX_REV_ID_REVISION_MASK     0x3 
     447#define AR71XX_REV_ID_REVISION_SHIFT    2 
     448#define AR933X_RESET_REG_BOOTSTRAP              0xac 
     449#define AR933X_RESET_REG_BOOTSTRAP              0xac 
     450#define AR933X_BOOTSTRAP_MDIO_GPIO_EN           BIT(18) 
     451#define AR933X_BOOTSTRAP_EEPBUSY                BIT(4) 
     452#define AR933X_BOOTSTRAP_REF_CLK_40             BIT(0) 
     453 
     454u32 ar71xx_soc_rev; 
     455EXPORT_SYMBOL_GPL(ar71xx_soc_rev); 
     456 
     457u32 ar71xx_ref_freq; 
     458EXPORT_SYMBOL_GPL(ar71xx_ref_freq); 
    440459 
    441460int is_ar9000; 
     
    443462void __init plat_mem_setup(void) 
    444463{ 
     464u32 id; 
     465u32 t; 
     466u32 rev=0; 
    445467 
    446468        if (is_ar7240()) { 
     
    450472        }else if (is_ar7242()) { 
    451473                ar71xx_soc = AR71XX_SOC_AR7242; 
     474        }else if (is_ar9330()) { 
     475                ar71xx_soc = AR71XX_SOC_AR9330; 
     476        }else if (is_ar9331()) { 
     477                ar71xx_soc = AR71XX_SOC_AR9331; 
     478        }else if (is_ar9341()) { 
     479                ar71xx_soc = AR71XX_SOC_AR9341; 
     480        }else if (is_ar9342()) { 
     481                ar71xx_soc = AR71XX_SOC_AR9342; 
     482        }else if (is_ar9344()) { 
     483                ar71xx_soc = AR71XX_SOC_AR9344; 
    452484        }  
     485        id = ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK; 
     486        ar71xx_soc_rev = id >> AR71XX_REV_ID_REVISION_SHIFT; 
     487        ar71xx_soc_rev &= AR71XX_REV_ID_REVISION_MASK; 
     488 
    453489         
    454490        ar71xx_ddr_base = ioremap_nocache(AR71XX_DDR_CTRL_BASE, 
     
    465501        ar71xx_usb_ctrl_base = ioremap_nocache(AR71XX_USB_CTRL_BASE, 
    466502                                                AR71XX_USB_CTRL_SIZE); 
     503 
     504 
     505 
     506#ifdef CONFIG_MACH_HORNET 
     507    if ( ar7240_reg_rd(HORNET_BOOTSTRAP_STATUS) & HORNET_BOOTSTRAP_SEL_25M_40M_MASK ) 
     508                ar71xx_ref_freq = (40 * 1000 * 1000); 
     509    else 
     510                ar71xx_ref_freq = (25 * 1000 * 1000); 
     511#endif 
    467512 
    468513#if 0 
     
    489534    Uart16550Init(); 
    490535#ifdef CONFIG_MACH_HORNET 
    491     serial_print("Booting AR9330(Hornet)...\n"); 
     536    serial_print("Booting %s(Hornet)...\n",get_system_type()); 
    492537    /* clear wmac reset */ 
    493538    ar7240_reg_wr(AR7240_RESET, (ar7240_reg_rd(AR7240_RESET) & (~AR7240_RESET_WMAC))); 
     
    510555 
    511556#define         REG_OFFSET              4 
     557 
     558static int serial_inited = 0; 
     559 
     560#define         MY_WRITE(y, z)  ((*((volatile u32*)(y))) = z) 
     561 
     562#ifndef CONFIG_MACH_HORNET 
    512563 
    513564/* === END OF CONFIG === */ 
     
    534585#define         UART16550_WRITE(x, z)  ar7240_reg_wr((AR7240_UART_BASE+x), z) 
    535586 
    536 static int serial_inited = 0; 
    537  
    538 #define         MY_WRITE(y, z)  ((*((volatile u32*)(y))) = z) 
    539587 
    540588void Uart16550Init() 
     
    600648    UART16550_WRITE(OFS_SEND_BUFFER, byte); 
    601649} 
    602  
     650#endif 
    603651extern int vsprintf(char *buf, const char *fmt, va_list args); 
    604652static char sprint_buf[1024]; 
     
    631679    return ar7240_cpu_freq/1000000; 
    632680} 
    633  
     681#ifdef CONFIG_MACH_HORNET 
     682 
     683void UartHornetInit(void) 
     684{ 
     685    unsigned int    rdata; 
     686    unsigned int    baudRateDivisor, clock_step; 
     687    unsigned int    fcEnable = 0;         
     688 
     689    ar7240_sys_frequency(); 
     690 
     691#if 0 
     692    MY_WRITE(0xb8040000, 0xcff); 
     693    MY_WRITE(0xb8040008, 0x3b); 
     694    /* Enable UART , SPI and Disable S26 UART */  
     695    MY_WRITE(0xb8040028, (ar7240_reg_rd(0xb8040028) | 0x48002)); 
     696 
     697    MY_WRITE(0xb8040008, 0x2f); 
     698#endif 
     699#ifdef CONFIG_HORNET_EMULATION 
     700    baudRateDivisor = ( ar7240_ahb_freq / (16*AG7240_CONSOLE_BAUD) ) - 1; // 24 MHz clock is taken as UART clock  
     701#else 
     702 
     703    rdata = ar7240_reg_rd(HORNET_BOOTSTRAP_STATUS); 
     704    rdata &= HORNET_BOOTSTRAP_SEL_25M_40M_MASK; 
     705 
     706    if (rdata) 
     707        baudRateDivisor = ( 40000000 / (16*AG7240_CONSOLE_BAUD) ) - 1; // 40 MHz clock is taken as UART clock         
     708    else 
     709        baudRateDivisor = ( 25000000 / (16*AG7240_CONSOLE_BAUD) ) - 1; // 25 MHz clock is taken as UART clock         
     710#endif 
     711 
     712    clock_step = 8192; 
     713     
     714        rdata = UARTCLOCK_UARTCLOCKSCALE_SET(baudRateDivisor) | UARTCLOCK_UARTCLOCKSTEP_SET(clock_step); 
     715        uart_reg_write(UARTCLOCK_ADDRESS, rdata);     
     716 
     717    /* Config Uart Controller */ 
     718#if 1 /* No interrupt */ 
     719        rdata = UARTCS_UARTDMAEN_SET(0) | UARTCS_UARTHOSTINTEN_SET(0) | UARTCS_UARTHOSTINT_SET(0) 
     720                | UARTCS_UARTSERIATXREADY_SET(0) | UARTCS_UARTTXREADYORIDE_SET(~fcEnable)  
     721                | UARTCS_UARTRXREADYORIDE_SET(~fcEnable) | UARTCS_UARTHOSTINTEN_SET(0); 
     722#else     
     723        rdata = UARTCS_UARTDMAEN_SET(0) | UARTCS_UARTHOSTINTEN_SET(0) | UARTCS_UARTHOSTINT_SET(0) 
     724                | UARTCS_UARTSERIATXREADY_SET(0) | UARTCS_UARTTXREADYORIDE_SET(~fcEnable)  
     725                | UARTCS_UARTRXREADYORIDE_SET(~fcEnable) | UARTCS_UARTHOSTINTEN_SET(1); 
     726#endif                           
     727                 
     728    /* is_dte == 1 */ 
     729    rdata = rdata | UARTCS_UARTINTERFACEMODE_SET(2);    
     730     
     731        if (fcEnable) { 
     732           rdata = rdata | UARTCS_UARTFLOWCONTROLMODE_SET(2);  
     733        } 
     734         
     735    /* invert_fc ==0 (Inverted Flow Control) */ 
     736    //rdata = rdata | UARTCS_UARTFLOWCONTROLMODE_SET(3); 
     737     
     738    /* parityEnable == 0 */ 
     739    //rdata = rdata | UARTCS_UARTPARITYMODE_SET(2); -->Parity Odd   
     740    //rdata = rdata | UARTCS_UARTPARITYMODE_SET(3); -->Parity Even 
     741    uart_reg_write(UARTCS_ADDRESS, rdata); 
     742     
     743    serial_inited = 1; 
     744} 
     745 
     746u8 UartHornetGetPoll(void) 
     747{ 
     748    u8              ret_val; 
     749    unsigned int    rdata;     
     750     
     751    do { 
     752        rdata = uart_reg_read(UARTDATA_ADDRESS); 
     753    } while (!UARTDATA_UARTRXCSR_GET(rdata)); 
     754     
     755    ret_val = (u8)UARTDATA_UARTTXRXDATA_GET(rdata); 
     756    rdata = UARTDATA_UARTRXCSR_SET(1); 
     757    uart_reg_write(UARTDATA_ADDRESS, rdata); 
     758     
     759    return ret_val; 
     760} 
     761 
     762void UartHornetPut(u8 byte) 
     763{ 
     764    unsigned int rdata; 
     765     
     766    if (!serial_inited) { 
     767        serial_inited = 1; 
     768        UartHornetInit(); 
     769    } 
     770 
     771    do { 
     772        rdata = uart_reg_read(UARTDATA_ADDRESS); 
     773    } while (UARTDATA_UARTTXCSR_GET(rdata) == 0); 
     774     
     775    rdata = UARTDATA_UARTTXRXDATA_SET((unsigned int)byte); 
     776    rdata |= UARTDATA_UARTTXCSR_SET(1); 
     777 
     778    uart_reg_write(UARTDATA_ADDRESS, rdata); 
     779} 
     780 
     781static void 
     782hornet_sys_frequency(void) 
     783{ 
     784#ifdef CONFIG_HORNET_EMULATION 
     785    #ifdef CONFIG_HORNET_EMULATION_WLAN_HARDI /* FPGA WLAN emulation */ 
     786    ar7240_cpu_freq = 48000000; 
     787    ar7240_ddr_freq = 48000000; 
     788    ar7240_ahb_freq = 24000000;     
     789    #else 
     790    ar7240_cpu_freq = 80000000; 
     791    ar7240_ddr_freq = 80000000; 
     792    ar7240_ahb_freq = 40000000; 
     793    #endif 
     794#else 
     795    /* Hornet's PLL is completely different from Python's */ 
     796    u32     ref_clock_rate, pll_freq; 
     797    u32     pllreg, clockreg; 
     798    u32     nint, refdiv, outdiv; 
     799    u32     cpu_div, ahb_div, ddr_div; 
     800 
     801    if ( ar7240_reg_rd(HORNET_BOOTSTRAP_STATUS) & HORNET_BOOTSTRAP_SEL_25M_40M_MASK ) 
     802        ref_clock_rate = 40 * 1000000; 
     803    else 
     804        ref_clock_rate = 25 * 1000000; 
     805 
     806    pllreg   = ar7240_reg_rd(AR7240_CPU_PLL_CONFIG); 
     807    clockreg = ar7240_reg_rd(AR7240_CPU_CLOCK_CONTROL);     
     808     
     809    if (clockreg & HORNET_CLOCK_CONTROL_BYPASS_MASK) { 
     810        /* Bypass PLL */  
     811        pll_freq = ref_clock_rate; 
     812        cpu_div = ahb_div = ddr_div = 1; 
     813    } 
     814    else { 
     815        nint = (pllreg & HORNET_PLL_CONFIG_NINT_MASK) >> HORNET_PLL_CONFIG_NINT_SHIFT; 
     816        refdiv = (pllreg & HORNET_PLL_CONFIG_REFDIV_MASK) >> HORNET_PLL_CONFIG_REFDIV_SHIFT; 
     817        outdiv = (pllreg & HORNET_PLL_CONFIG_OUTDIV_MASK) >> HORNET_PLL_CONFIG_OUTDIV_SHIFT; 
     818         
     819        pll_freq = (ref_clock_rate / refdiv) * nint; 
     820 
     821        if (outdiv == 1) 
     822            pll_freq /= 2; 
     823        else if (outdiv == 2)    
     824            pll_freq /= 4;                     
     825        else if (outdiv == 3)   
     826            pll_freq /= 8;              
     827        else if (outdiv == 4)  
     828            pll_freq /= 16;                 
     829        else if (outdiv == 5)  
     830            pll_freq /= 32;              
     831        else if (outdiv == 6)   
     832            pll_freq /= 64;               
     833        else if (outdiv == 7)   
     834            pll_freq /= 128;               
     835        else /* outdiv == 0 --> illegal value */                                                                      
     836            pll_freq /= 2;    
     837 
     838        cpu_div = (clockreg & HORNET_CLOCK_CONTROL_CPU_POST_DIV_MASK) >> HORNET_CLOCK_CONTROL_CPU_POST_DIV_SHIFT; 
     839        ddr_div = (clockreg & HORNET_CLOCK_CONTROL_DDR_POST_DIV_MASK) >> HORNET_CLOCK_CONTROL_DDR_POST_DIV_SFIFT; 
     840        ahb_div = (clockreg & HORNET_CLOCK_CONTROL_AHB_POST_DIV_MASK) >> HORNET_CLOCK_CONTROL_AHB_POST_DIV_SFIFT;                      
     841         
     842        /* 
     843         * b00 : div by 1, b01 : div by 2, b10 : div by 3, b11 : div by 4 
     844         */ 
     845        cpu_div++; 
     846        ddr_div++; 
     847        ahb_div++;         
     848    } 
     849     
     850    ar7240_cpu_freq = pll_freq / cpu_div; 
     851    ar7240_ddr_freq = pll_freq / ddr_div; 
     852    ar7240_ahb_freq = pll_freq / ahb_div;     
     853#endif 
     854} 
     855#endif 
     856 
  • src/linux/universal/linux-3.2/arch/mips/include/asm/mach-ar71xx/ar71xx.h

    r18171 r18294  
    8686#define AR71XX_MEM_SIZE_MAX     0x10000000 
    8787 
    88 #define AR71XX_CPU_IRQ_BASE    0 
    89 #define AR71XX_MISC_IRQ_BASE   8 
    90 #define AR71XX_MISC_IRQ_COUNT  8 
    91 #define AR71XX_GPIO_IRQ_BASE   16 
    92 #define AR71XX_GPIO_IRQ_COUNT  32 
    93 #define AR71XX_PCI_IRQ_BASE     48 
    94 #define AR71XX_PCI_IRQ_COUNT   8 
     88#define AR71XX_CPU_IRQ_BASE     0 
     89#define AR71XX_MISC_IRQ_BASE    0x10 
     90#define AR71XX_MISC_IRQ_COUNT   13 
     91#define AR71XX_GPIO_IRQ_BASE    0x20 
     92#define AR71XX_GPIO_IRQ_COUNT   16 
     93#define AR71XX_PCI_IRQ_BASE     0x30 
     94#define AR71XX_PCI_IRQ_COUNT    1 
     95#define AR934X_IP2_IRQ_BASE     0x40 
     96#define AR934X_IP2_IRQ_COUNT    2 
    9597 
    9698#define AR71XX_CPU_IRQ_IP2      (AR71XX_CPU_IRQ_BASE + 2) 
  • src/linux/universal/linux-3.2/arch/mips/include/asm/mach-ar7240/ar7240.h

    r18171 r18294  
    33 
    44#include <asm/addrspace.h> 
     5 
     6#ifdef CONFIG_MACH_HORNET 
     7#include "ar933x.h" 
     8#endif 
    59 
    610typedef unsigned int ar7240_reg_t; 
     
    238242 * The IPs. Connected to CPU (hardware IP's; the first two are software) 
    239243 */ 
    240 #define AR7240_CPU_IRQ_PCI                  AR7240_CPU_IRQ_BASE+2 
     244#ifdef CONFIG_WASP_SUPPORT 
     245#define ATH_CPU_IRQ_WLAN                AR7240_CPU_IRQ_BASE+2 
     246#define AR7240_CPU_IRQ_PCI              AR7240_CPU_IRQ_BASE+8 
     247#elif defined (CONFIG_MACH_HORNET) 
     248#define ATH_CPU_IRQ_WLAN                AR7240_CPU_IRQ_BASE+2 
     249#else 
     250#define AR7240_CPU_IRQ_PCI              AR7240_CPU_IRQ_BASE+2 
     251#endif 
    241252#define AR7240_CPU_IRQ_USB                  AR7240_CPU_IRQ_BASE+3 
    242253#define AR7240_CPU_IRQ_GE0                  AR7240_CPU_IRQ_BASE+4 
     
    741752#define AR7242_REV_1_1                  0x1101 
    742753#define AR9330_REV_1_0                  0x0110 
     754#define AR9331_REV_1_0                  0x1110 
    743755#define AR9330_REV_1_1                  0x0111 
    744  
     756#define AR9331_REV_1_1                  0x1111 
     757#define AR9330_REV_1_2                  0x0112 
     758#define AR9331_REV_1_2                  0x1112 
    745759#define AR9344_REV_1_0                  0x2120 
    746760#define AR9342_REV_1_0                  0x1120 
    747761#define AR9341_REV_1_0                  0x0120 
     762#define AR9344_REV_1_1                  0x2121 
     763#define AR9342_REV_1_1                  0x1121 
     764#define AR9341_REV_1_1                  0x0121 
    748765 
    749766 
     
    762779#define is_ar9341()     ((ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK) == AR9341_REV_1_0) 
    763780 
    764 #define is_ar9330()     (((ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK) == AR9330_REV_1_0) || \ 
    765                         ((ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK) == AR9330_REV_1_1)) 
     781#define is_ar9330() (((ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK) == AR9330_REV_1_0) || \ 
     782                        ((ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK) == AR9330_REV_1_1) || \ 
     783                        ((ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK) == AR9330_REV_1_2)) 
     784 
     785#define is_ar9331() (((ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK) == AR9331_REV_1_0) || \ 
     786                        ((ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK) == AR9331_REV_1_1) || \ 
     787                        ((ar7240_reg_rd(AR7240_REV_ID) & AR7240_REV_ID_MASK) == AR9331_REV_1_2)) 
    766788 
    767789#define is_ar934x()     (is_ar9344() || is_ar9342() || is_ar9341()) 
     790 
     791#define is_ar933x() (is_ar9330() || is_ar9331()) 
    768792 
    769793 
     
    793817#define AR7240_RESET_GE0_MAC                (1 << 9) 
    794818#define AR7240_RESET_GE0_PHY                (1 << 8) 
     819#ifdef CONFIG_MACH_HORNET 
     820#define AR7240_RESET_WMAC                       (1 << 11) 
     821#else 
     822#define AR7240_RESET_USB_PHY_ANALOG             (1 << 11) 
     823#endif 
    795824#define AR7240_RESET_PCIE_PHY_SHIFT         (1 << 10) 
    796825#define AR7240_RESET_USBSUS_OVRIDE          (1 << 3) 
  • src/linux/universal/linux-3.2/drivers/mtd/devices/Kconfig

    r18171 r18294  
    338338config WZRG450NH  
    339339        bool "support for buffalo WZR HP G450NH" 
    340         depends on MACH_AR7240 
     340        depends on MACH_AR7240  
    341341config WZRG300NH2 
    342342        bool "support for buffalo WZR HP G300NH2" 
     
    344344config MTD_AR7240_SPI_FLASH 
    345345        bool "Support for ar7240 spi flash" 
    346         depends on MTD && MACH_AR7240 
     346        depends on MTD && (MACH_AR7240 || MACH_HORNET) 
    347347 
    348348endmenu 
  • src/linux/universal/linux-3.2/drivers/mtd/maps/Makefile

    r18224 r18294  
    6262obj-$(CONFIG_MACH_AR7100)       += nvram_kernel.o 
    6363obj-$(CONFIG_MACH_AR7240)       += nvram_kernel.o 
     64obj-$(CONFIG_MACH_HORNET)       += nvram_kernel.o 
    6465obj-$(CONFIG_MACH_GW2388)       += nvram_kernel.o 
    6566obj-$(CONFIG_LANTIQ)            += nvram_kernel.o 
  • src/linux/universal/linux-3.2/drivers/net/ethernet/ag7240/ag7240.c

    r18171 r18294  
    441441    ag7240_desc_t *r0, *t0; 
    442442    uint32_t mgmt_cfg_val,ac; 
    443     u32 check_cnt; 
     443    u32 check_cnt=0; 
    444444 
    445445#ifdef CONFIG_AR7242_RTL8309G_PHY 
     
    493493                      mgmt_cfg_val = 0x9; 
    494494                      break; 
     495            case 40: 
     496            case 24: 
     497                /* hornet emulation...ahb is either 24 or 40Mhz */ 
     498                mgmt_cfg_val = 0x6; 
    495499            default: 
    496500                     mgmt_cfg_val = 0x7; 
     
    530534        } 
    531535#endif 
     536        else 
     537          if(is_ar933x()){ 
     538            ar7240_reg_wr(AG7240_ETH_CFG, AG7240_ETH_CFG_MII_GE0_SLAVE);  
     539            mgmt_cfg_val = 0xF; 
     540            if (mac->mac_unit == 1) { 
     541                while (check_cnt++ < 10) { 
     542                    ag7240_reg_wr(mac, AG7240_MAC_MII_MGMT_CFG, mgmt_cfg_val | (1 << 31)); 
     543                    ag7240_reg_wr(mac, AG7240_MAC_MII_MGMT_CFG, mgmt_cfg_val); 
     544                    break; 
     545                } 
     546                if(check_cnt == 11) 
     547                    printk("%s: MDC check failed (Hornet)\n", __func__); 
     548            } 
     549        } 
    532550        else { /* Python 1.0 & 1.1 */ 
    533551            if (mac->mac_unit == 0) { 
     
    764782                    ar7100_set_gpio(13+i,0); 
    765783                #endif 
    766                     s26_wr_phy(i,0x19,(s26_rd_phy(i,0x19) | (0x3c0))); 
     784                        if(is_ar933x()) { 
     785                                s26_wr_phy(i,0x19, 0x3c0); 
     786                                s26_wr_phy(i,0x18,(0x4)); 
     787                        } else { 
     788                                s26_wr_phy(i,0x19,(s26_rd_phy( i,0x19) | (0x3c0))); 
     789                        } 
    767790                    continue; 
    768791                } 
     
    775798                        ar7100_set_gpio(13+i,1); 
    776799                #endif 
     800                            if(is_ar933x()&& bRateTab->rate <= MB(5)){ 
     801                                            s26_wr_phy(i,0x18, 0); 
     802                            } else { 
    777803                        s26_wr_phy(i,0x18,((bRateTab->timeOn << 12)|(bRateTab->timeOff << 8))); 
     804                            } 
     805                            if(is_ar933x()) { 
     806                                s26_wr_phy(i,0x19, 0x140);                             
     807                            } else { 
    778808                        s26_wr_phy(i,0x19,(s26_rd_phy(i,0x19) & ~(0x280)));                 
     809                            } 
    779810                        break; 
    780811                    } 
     
    787818            } 
    788819        } 
     820            if(!is_ar933x()) { 
    789821        /* Flush all LAN MIB counters */ 
    790822        athrs26_reg_write(0x80,((1 << 17) | (1 << 24)));  
    791823        while ((athrs26_reg_read(0x80) & 0x20000) == 0x20000); 
    792824        athrs26_reg_write(0x80,0); 
     825        } 
    793826    } 
    794827 
     
    805838//              ar7100_set_gpio(17,0);                 
    806839//                #endif 
     840                    if(is_ar933x()) { 
     841                s26_wr_phy(4,0x19,((0x3c0))); 
     842                     
     843                    }else 
     844                    { 
    807845                s26_wr_phy(4,0x19,(s26_rd_phy(4,0x19) | (0x3c0))); 
     846                } 
    808847                goto done; 
    809848            } 
     
    817856//                #endif 
    818857                    s26_wr_phy(4,0x18,((bRateTab->timeOn << 12)|(bRateTab->timeOff << 8))); 
     858                        if(is_ar933x()) { 
     859                    s26_wr_phy(4,0x19,0x140); 
     860                        } else { 
    819861                    s26_wr_phy(4,0x19,(s26_rd_phy(4,0x19) & ~(0x280))); 
     862                        } 
     863 
    820864                    break; 
    821865                } 
     
    23062350#endif  
    23072351#ifdef CONFIG_ETH_SOFT_LED 
    2308         if (is_ar7240()) 
     2352    if (is_ar7240() || is_ar933x())  
    23092353            mac_set_flag(mac,ETH_SOFT_LED); 
    23102354#endif 
  • src/linux/universal/linux-3.2/drivers/net/ethernet/ag7240/ag7240_phy.h

    r18171 r18294  
    100100    } else  
    101101#endif  
    102   if (is_ar7241() || is_ar7240()) 
     102  if (is_ar7241() || is_ar7240() || is_ar933x()) 
    103103    athrs26_phy_setup (unit); 
    104104  else if (is_ar7242() && unit == 1)  
     
    127127#endif 
    128128 
    129   if (is_ar7240() || is_ar7241() || (is_ar7242() && unit == 1)) { 
     129  if (is_ar7240() || is_ar7241() || (is_ar7242() && unit == 1) || is_ar933x()) { 
    130130    *link=ag7240_phy_is_up(unit); 
    131131    *fdx=ag7240_phy_is_fdx(unit, phyUnit); 
  • src/linux/universal/linux-3.2/drivers/tty/serial/Kconfig

    r18190 r18294  
    16251625          Enable a Xilinx PS UART port to be the system console. 
    16261626 
     1627config SERIAL_AR933X 
     1628        bool "AR933X serial port support" 
     1629        depends on MACH_HORNET 
     1630        select SERIAL_CORE 
     1631        help 
     1632          If you have an Atheros AR933X SOC based board and want to use the 
     1633          built-in UART of the SoC, say Y to this option. 
     1634 
     1635config SERIAL_AR933X_CONSOLE 
     1636        bool "Console on AR933X serial port" 
     1637        depends on SERIAL_AR933X=y 
     1638        select SERIAL_CORE_CONSOLE 
     1639        help 
     1640          Enable a built-in UART port of the AR933X to be the system console. 
     1641 
     1642config SERIAL_AR933X_NR_UARTS 
     1643        int "Maximum number of AR933X serial ports" 
     1644        depends on SERIAL_AR933X 
     1645        default "2" 
     1646        help 
     1647          Set this to the number of serial ports you want the driver 
     1648          to support. 
     1649 
     1650 
    16271651endmenu 
  • src/linux/universal/linux-3.2/drivers/tty/serial/Makefile

    r18190 r18294  
    9898obj-$(CONFIG_SERIAL_LANTIQ)     += lantiq.o 
    9999obj-$(CONFIG_SERIAL_XILINX_PS_UART) += xilinx_uartps.o 
     100obj-$(CONFIG_SERIAL_AR933X)     += ar933x_uart.o 
     101#obj-$(CONFIG_SERIAL_AR933X)    += hornet_serial.o 
  • src/linux/universal/linux-3.2/drivers/usb/Kconfig

    r18224 r18294  
    6767        default y if ARCH_IXP4XX 
    6868        default y if MACH_AR7100 
     69        default y if MACH_HORNET 
    6970        default y if ARCH_W90X900 
    7071        default y if ARCH_AT91SAM9G45 
  • src/linux/universal/linux-3.2/drivers/usb/host/ehci-ar71xx.c

    r18171 r18294  
    257257 
    258258    /* Added 5_29_07 */ 
    259 #ifdef MACH_AR7240 
     259#ifdef CONFIG_MACH_AR7240 
    260260    ar9130_reg_rmw_set(AR9130_RESET,AR9130_RESET_USBSUS_OVRIDE |AR7240_RESET_USB_PHY_ANALOG); 
    261261#else 
  • src/linux/universal/linux-3.2/include/linux/serial_core.h

    r18190 r18294  
    207207/* Xilinx PSS UART */ 
    208208#define PORT_XUARTPS    98 
     209 
     210/* Atheros AR933X SoC */ 
     211#define PORT_AR933X     99 
    209212 
    210213#ifdef __KERNEL__ 
  • src/linux/universal/linux-3.2/init/main.c

    r18171 r18294  
    574574         * this. But we do want output early, in case something goes wrong. 
    575575         */ 
     576         printk(KERN_EMERG "console initcall\n"); 
    576577        console_init(); 
     578         printk(KERN_EMERG "console initcall done\n"); 
    577579        if (panic_later) 
    578580                panic(panic_later, panic_param); 
     
    785787        }*/ 
    786788        run_init_process("/sbin/init"); 
     789//      run_init_process("/bin/sh"); 
    787790 
    788791        panic("No init found.  Try passing init= option to kernel. " 
Note: See TracChangeset for help on using the changeset viewer.