mirror of https://github.com/hak5/openwrt.git
ramips: replace RALINK_SOC_* macros with global variables
SVN-Revision: 30888lede-17.01
parent
8cff770eb3
commit
acb4ad86e5
|
@ -11,6 +11,9 @@
|
||||||
|
|
||||||
#define RAMIPS_SYS_TYPE_LEN 64
|
#define RAMIPS_SYS_TYPE_LEN 64
|
||||||
extern unsigned char ramips_sys_type[RAMIPS_SYS_TYPE_LEN];
|
extern unsigned char ramips_sys_type[RAMIPS_SYS_TYPE_LEN];
|
||||||
|
extern unsigned long ramips_mem_base;
|
||||||
|
extern unsigned long ramips_mem_size_min;
|
||||||
|
extern unsigned long ramips_mem_size_max;
|
||||||
|
|
||||||
void ramips_intc_irq_init(unsigned intc_base, unsigned irq, unsigned irq_base);
|
void ramips_intc_irq_init(unsigned intc_base, unsigned irq, unsigned irq_base);
|
||||||
u32 ramips_intc_get_status(void);
|
u32 ramips_intc_get_status(void);
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
|
||||||
|
#define RT288X_MEM_SIZE_MIN (2 * 1024 * 1024)
|
||||||
|
#define RT288X_MEM_SIZE_MAX (128 * 1024 * 1024)
|
||||||
|
|
||||||
#define RT288X_CPU_IRQ_BASE 0
|
#define RT288X_CPU_IRQ_BASE 0
|
||||||
#define RT288X_INTC_IRQ_BASE 8
|
#define RT288X_INTC_IRQ_BASE 8
|
||||||
#define RT288X_INTC_IRQ_COUNT 32
|
#define RT288X_INTC_IRQ_COUNT 32
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
/*
|
|
||||||
* Ralink RT288x specific SOC defines
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __RT288X_RALINK_SOC_H
|
|
||||||
#define __RT288X_RALINK_SOC_H
|
|
||||||
|
|
||||||
#define RALINK_SOC_SDRAM_BASE 0x08000000
|
|
||||||
#define RALINK_SOC_MEM_SIZE_MIN (2 * 1024 * 1024)
|
|
||||||
#define RALINK_SOC_MEM_SIZE_MAX (128 * 1024 * 1024)
|
|
||||||
|
|
||||||
#endif /* __RT288X_RALINK_SOC_H */
|
|
|
@ -1,18 +0,0 @@
|
||||||
/*
|
|
||||||
* Ralink RT305x specific SOC defines
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __RT288X_RALINK_SOC_H
|
|
||||||
#define __RT288X_RALINK_SOC_H
|
|
||||||
|
|
||||||
#define RALINK_SOC_SDRAM_BASE 0
|
|
||||||
#define RALINK_SOC_MEM_SIZE_MIN (2 * 1024 * 1024)
|
|
||||||
#define RALINK_SOC_MEM_SIZE_MAX (64 * 1024 * 1024)
|
|
||||||
|
|
||||||
#endif /* __RT288X_RALINK_SOC_H */
|
|
|
@ -1,18 +0,0 @@
|
||||||
/*
|
|
||||||
* Ralink RT3662/RT3883 specific SOC defines
|
|
||||||
*
|
|
||||||
* Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 as published
|
|
||||||
* by the Free Software Foundation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _RT3883_RALINK_SOC_H
|
|
||||||
#define _RT3883_RALINK_SOC_H
|
|
||||||
|
|
||||||
#define RALINK_SOC_SDRAM_BASE 0
|
|
||||||
#define RALINK_SOC_MEM_SIZE_MIN (2 * 1024 * 1024)
|
|
||||||
#define RALINK_SOC_MEM_SIZE_MAX (256 * 1024 * 1024)
|
|
||||||
|
|
||||||
#endif /* _RT3883_RALINK_SOC_H */
|
|
|
@ -18,26 +18,29 @@
|
||||||
|
|
||||||
#include <asm/mach-ralink/common.h>
|
#include <asm/mach-ralink/common.h>
|
||||||
#include <asm/mach-ralink/machine.h>
|
#include <asm/mach-ralink/machine.h>
|
||||||
#include <ralink_soc.h>
|
|
||||||
|
unsigned long ramips_mem_base;
|
||||||
|
unsigned long ramips_mem_size_min;
|
||||||
|
unsigned long ramips_mem_size_max;
|
||||||
|
|
||||||
static inline void *to_ram_addr(void *addr)
|
static inline void *to_ram_addr(void *addr)
|
||||||
{
|
{
|
||||||
u32 base;
|
u32 base;
|
||||||
|
|
||||||
base = KSEG0ADDR(RALINK_SOC_SDRAM_BASE);
|
base = KSEG0ADDR(ramips_mem_base);
|
||||||
if (((u32) addr > base) &&
|
if (((u32) addr > base) &&
|
||||||
((u32) addr < (base + RALINK_SOC_MEM_SIZE_MAX)))
|
((u32) addr < (base + ramips_mem_size_max)))
|
||||||
return addr;
|
return addr;
|
||||||
|
|
||||||
base = KSEG1ADDR(RALINK_SOC_SDRAM_BASE);
|
base = KSEG1ADDR(ramips_mem_base);
|
||||||
if (((u32) addr > base) &&
|
if (((u32) addr > base) &&
|
||||||
((u32) addr < (base + RALINK_SOC_MEM_SIZE_MAX)))
|
((u32) addr < (base + ramips_mem_size_max)))
|
||||||
return addr;
|
return addr;
|
||||||
|
|
||||||
/* some U-Boot variants uses physical addresses */
|
/* some U-Boot variants uses physical addresses */
|
||||||
base = RALINK_SOC_SDRAM_BASE;
|
base = ramips_mem_base;
|
||||||
if (((u32) addr > base) &&
|
if (((u32) addr > base) &&
|
||||||
((u32) addr < (base + RALINK_SOC_MEM_SIZE_MAX)))
|
((u32) addr < (base + ramips_mem_size_max)))
|
||||||
return (void *)KSEG0ADDR(addr);
|
return (void *)KSEG0ADDR(addr);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <asm/mach-ralink/common.h>
|
#include <asm/mach-ralink/common.h>
|
||||||
#include <asm/mach-ralink/machine.h>
|
#include <asm/mach-ralink/machine.h>
|
||||||
#include <ralink_soc.h>
|
|
||||||
|
|
||||||
unsigned char ramips_sys_type[RAMIPS_SYS_TYPE_LEN];
|
unsigned char ramips_sys_type[RAMIPS_SYS_TYPE_LEN];
|
||||||
|
|
||||||
|
@ -34,13 +33,13 @@ static void __init detect_mem_size(void)
|
||||||
void *base;
|
void *base;
|
||||||
|
|
||||||
base = (void *) KSEG1ADDR(detect_mem_size);
|
base = (void *) KSEG1ADDR(detect_mem_size);
|
||||||
for (size = RALINK_SOC_MEM_SIZE_MIN; size < RALINK_SOC_MEM_SIZE_MAX;
|
for (size = ramips_mem_size_min; size < ramips_mem_size_max;
|
||||||
size <<= 1 ) {
|
size <<= 1 ) {
|
||||||
if (!memcmp(base, base + size, 1024))
|
if (!memcmp(base, base + size, 1024))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_memory_region(RALINK_SOC_SDRAM_BASE, size, BOOT_MEM_RAM);
|
add_memory_region(ramips_mem_base, size, BOOT_MEM_RAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init ramips_early_serial_setup(int line, unsigned base, unsigned freq,
|
void __init ramips_early_serial_setup(int line, unsigned base, unsigned freq,
|
||||||
|
|
|
@ -42,6 +42,10 @@ void __init ramips_soc_prom_init(void)
|
||||||
(char) ((n1 >> 16) & 0xff), (char) ((n1 >> 24) & 0xff),
|
(char) ((n1 >> 16) & 0xff), (char) ((n1 >> 24) & 0xff),
|
||||||
(id >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK,
|
(id >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK,
|
||||||
(id & CHIP_ID_REV_MASK));
|
(id & CHIP_ID_REV_MASK));
|
||||||
|
|
||||||
|
ramips_mem_base = RT2880_SDRAM_BASE;
|
||||||
|
ramips_mem_size_min = RT288X_MEM_SIZE_MIN;
|
||||||
|
ramips_mem_size_max = RT288X_MEM_SIZE_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ramips_gpio_chip rt288x_gpio_chips[] = {
|
static struct ramips_gpio_chip rt288x_gpio_chips[] = {
|
||||||
|
|
|
@ -42,6 +42,10 @@ void __init ramips_soc_prom_init(void)
|
||||||
(char) ((n1 >> 16) & 0xff), (char) ((n1 >> 24) & 0xff),
|
(char) ((n1 >> 16) & 0xff), (char) ((n1 >> 24) & 0xff),
|
||||||
(id >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK,
|
(id >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK,
|
||||||
(id & CHIP_ID_REV_MASK));
|
(id & CHIP_ID_REV_MASK));
|
||||||
|
|
||||||
|
ramips_mem_base = RT305X_SDRAM_BASE;
|
||||||
|
ramips_mem_size_min = RT305X_MEM_SIZE_MIN;
|
||||||
|
ramips_mem_size_max = RT305X_MEM_SIZE_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ramips_gpio_chip rt305x_gpio_chips[] = {
|
static struct ramips_gpio_chip rt305x_gpio_chips[] = {
|
||||||
|
|
|
@ -41,6 +41,10 @@ void __init ramips_soc_prom_init(void)
|
||||||
(char) ((n1 >> 16) & 0xff), (char) ((n1 >> 24) & 0xff),
|
(char) ((n1 >> 16) & 0xff), (char) ((n1 >> 24) & 0xff),
|
||||||
(id >> RT3883_REVID_VER_ID_SHIFT) & RT3883_REVID_VER_ID_MASK,
|
(id >> RT3883_REVID_VER_ID_SHIFT) & RT3883_REVID_VER_ID_MASK,
|
||||||
(id & RT3883_REVID_ECO_ID_MASK));
|
(id & RT3883_REVID_ECO_ID_MASK));
|
||||||
|
|
||||||
|
ramips_mem_base = RT3883_SDRAM_BASE;
|
||||||
|
ramips_mem_size_min = RT3883_MEM_SIZE_MIN;
|
||||||
|
ramips_mem_size_max = RT3883_MEM_SIZE_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ramips_gpio_chip rt3883_gpio_chips[] = {
|
static struct ramips_gpio_chip rt3883_gpio_chips[] = {
|
||||||
|
|
Loading…
Reference in New Issue